Skip to content

Commit

Permalink
feat: Generating plugin schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
simonas-notcat committed Oct 8, 2020
1 parent 297c8d4 commit d4450cd
Show file tree
Hide file tree
Showing 161 changed files with 40,263 additions and 7,189 deletions.
16 changes: 14 additions & 2 deletions __tests__/shared/resolveDid.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TAgent, IResolver } from '../../packages/daf-core/src'
import { TAgent, IResolver, ValidationError } from '../../packages/daf-core/src'

type ConfiguredAgent = TAgent<IResolver>

Expand All @@ -23,6 +23,18 @@ export default (testContext: {
expect(didDoc.id).toEqual(didUrl)
})

it.todo('should throw an error for unsupported did methods')
// it('should throw an error for unsupported did methods', async () => {
// await expect(agent.resolveDid({ didUrl: 'did:foo:bar' })).rejects.toThrow("Unsupported DID method: 'foo'")
// })

// it('should throw validation error', async () => {
// //@ts-ignore
// await expect(agent.resolveDid()).rejects.toHaveProperty('name', 'ValidationError')
// //@ts-ignore
// await expect(agent.resolveDid({})).rejects.toHaveProperty('name', 'ValidationError')
// //@ts-ignore
// await expect(agent.resolveDid({didUrl: 1})).rejects.toHaveProperty('name', 'ValidationError')

// })
})
}
1 change: 1 addition & 0 deletions docs/api/daf-core.iagentplugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ export interface IAgentPlugin
| Property | Type | Description |
| --- | --- | --- |
| [methods](./daf-core.iagentplugin.methods.md) | [IPluginMethodMap](./daf-core.ipluginmethodmap.md) | |
| [schema](./daf-core.iagentplugin.schema.md) | [IAgentPluginSchema](./daf-core.iagentpluginschema.md) | |

11 changes: 11 additions & 0 deletions docs/api/daf-core.iagentplugin.schema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [daf-core](./daf-core.md) &gt; [IAgentPlugin](./daf-core.iagentplugin.md) &gt; [schema](./daf-core.iagentplugin.schema.md)

## IAgentPlugin.schema property

<b>Signature:</b>

```typescript
readonly schema?: IAgentPluginSchema;
```
14 changes: 14 additions & 0 deletions docs/api/daf-core.iagentpluginschema.components.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [daf-core](./daf-core.md) &gt; [IAgentPluginSchema](./daf-core.iagentpluginschema.md) &gt; [components](./daf-core.iagentpluginschema.components.md)

## IAgentPluginSchema.components property

<b>Signature:</b>

```typescript
components: {
schemas: any;
methods: any;
};
```
20 changes: 20 additions & 0 deletions docs/api/daf-core.iagentpluginschema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [daf-core](./daf-core.md) &gt; [IAgentPluginSchema](./daf-core.iagentpluginschema.md)

## IAgentPluginSchema interface

Agent plugin schema

<b>Signature:</b>

```typescript
export interface IAgentPluginSchema
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [components](./daf-core.iagentpluginschema.components.md) | { schemas: any; methods: any; } | |

8 changes: 8 additions & 0 deletions docs/api/daf-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Provides [Agent](./daf-core.agent.md) implementation and defines [IResolver](./d
| Class | Description |
| --- | --- |
| [Agent](./daf-core.agent.md) | Provides a common context for all plugin methods.<!-- -->This is the main entry point into the API of the DID Agent Framework. When plugins are installed, they extend the API of the agent and the methods they provide can all use the common context so that plugins can build on top of each other and create a richer experience. |
| [ValidationError](./daf-core.validationerror.md) | |

## Functions

Expand All @@ -27,6 +28,7 @@ Provides [Agent](./daf-core.agent.md) implementation and defines [IResolver](./d
| [IAgentContext](./daf-core.iagentcontext.md) | Standard plugin method context interface |
| [IAgentOptions](./daf-core.iagentoptions.md) | Agent configuration options.<!-- -->This interface is used to describe the constellation of plugins that this agent will use and provide.<!-- -->You will use this to attach plugins, to setup overrides for their methods and to explicitly set the methods that this agent instance is allowed to call. This permissioning method is also used for internal calls made by plugin code. |
| [IAgentPlugin](./daf-core.iagentplugin.md) | Agent plugin interface |
| [IAgentPluginSchema](./daf-core.iagentpluginschema.md) | Agent plugin schema |
| [IDataStore](./daf-core.idatastore.md) | Basic data store interface |
| [IDataStoreGetMessageArgs](./daf-core.idatastoregetmessageargs.md) | Input arguments for [dataStoreGetMessage](./daf-core.idatastore.datastoregetmessage.md) |
| [IDataStoreGetVerifiableCredentialArgs](./daf-core.idatastoregetverifiablecredentialargs.md) | Input arguments for [dataStoreGetVerifiableCredential](./daf-core.idatastore.datastoregetverifiablecredential.md) |
Expand Down Expand Up @@ -67,6 +69,12 @@ Provides [Agent](./daf-core.agent.md) implementation and defines [IResolver](./d
| [RemoveContext](./daf-core.removecontext.md) | Removes context parameter from plugin method interface |
| [ResolveDidArgs](./daf-core.resolvedidargs.md) | Input arguments for [resolveDid](./daf-core.iresolver.resolvedid.md) |

## Variables

| Variable | Description |
| --- | --- |
| [validate](./daf-core.validate.md) | |

## Type Aliases

| Type Alias | Description |
Expand Down
11 changes: 11 additions & 0 deletions docs/api/daf-core.validate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [daf-core](./daf-core.md) &gt; [validate](./daf-core.validate.md)

## validate variable

<b>Signature:</b>

```typescript
validate: (args: object, schema: object, schemaPath?: string | undefined) => void
```
23 changes: 23 additions & 0 deletions docs/api/daf-core.validationerror._constructor_.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [daf-core](./daf-core.md) &gt; [ValidationError](./daf-core.validationerror.md) &gt; [(constructor)](./daf-core.validationerror._constructor_.md)

## ValidationError.(constructor)

Constructs a new instance of the `ValidationError` class

<b>Signature:</b>

```typescript
constructor(message: string, code: string, path: string, description: string);
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| message | string | |
| code | string | |
| path | string | |
| description | string | |

11 changes: 11 additions & 0 deletions docs/api/daf-core.validationerror.code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [daf-core](./daf-core.md) &gt; [ValidationError](./daf-core.validationerror.md) &gt; [code](./daf-core.validationerror.code.md)

## ValidationError.code property

<b>Signature:</b>

```typescript
code: string;
```
11 changes: 11 additions & 0 deletions docs/api/daf-core.validationerror.description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [daf-core](./daf-core.md) &gt; [ValidationError](./daf-core.validationerror.md) &gt; [description](./daf-core.validationerror.description.md)

## ValidationError.description property

<b>Signature:</b>

```typescript
description: string;
```
28 changes: 28 additions & 0 deletions docs/api/daf-core.validationerror.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [daf-core](./daf-core.md) &gt; [ValidationError](./daf-core.validationerror.md)

## ValidationError class

<b>Signature:</b>

```typescript
export declare class ValidationError extends Error
```
<b>Extends:</b> Error
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(message, code, path, description)](./daf-core.validationerror._constructor_.md) | | Constructs a new instance of the <code>ValidationError</code> class |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [code](./daf-core.validationerror.code.md) | | string | |
| [description](./daf-core.validationerror.description.md) | | string | |
| [message](./daf-core.validationerror.message.md) | | string | |
| [path](./daf-core.validationerror.path.md) | | string | |
11 changes: 11 additions & 0 deletions docs/api/daf-core.validationerror.message.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [daf-core](./daf-core.md) &gt; [ValidationError](./daf-core.validationerror.md) &gt; [message](./daf-core.validationerror.message.md)

## ValidationError.message property

<b>Signature:</b>

```typescript
message: string;
```
11 changes: 11 additions & 0 deletions docs/api/daf-core.validationerror.path.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [daf-core](./daf-core.md) &gt; [ValidationError](./daf-core.validationerror.md) &gt; [path](./daf-core.validationerror.path.md)

## ValidationError.path property

<b>Signature:</b>

```typescript
path: string;
```
1 change: 1 addition & 0 deletions docs/api/daf-did-comm.didcomm.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Be advised that this spec is still not final and that this protocol may need to
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [methods](./daf-did-comm.didcomm.methods.md) | | [IDIDComm](./daf-did-comm.ididcomm.md) | <b><i>(BETA)</i></b> Plugin methods |
| [schema](./daf-did-comm.didcomm.schema.md) | | { components: { schemas: { ISendMessageDIDCommAlpha1Args: { type: string; properties: { url: { type: string; }; save: { type: string; }; data: { type: string; properties: { id: { type: string; }; from: { type: string; }; to: { type: string; }; type: { type: string; }; body: { anyOf: { type: string; }\[\]; }; }; required: string\[\]; additionalProperties: boolean; }; }; required: string\[\]; additionalProperties: boolean; description: string; }; IMessage: { type: string; properties: { id: { type: string; description: string; }; type: { type: string; description: string; }; createdAt: { type: string; description: string; }; expiresAt: { type: string; description: string; }; threadId: { type: string; description: string; }; raw: { type: string; /\*\* {@inheritdoc IDIDComm.sendMessageDIDCommAlpha1} \*/ description: string; }; data: { anyOf: { type: string; }\[\]; description: string; }; replyTo: { type: string; items: { type: string; }; description: string; }; replyUrl: { type: string; description: string; }; from: { type: string; description: string; }; to: { type: string; description: string; }; metaData: { type: string; items: { $ref: string; }; description: string; }; credentials: { type: string; items: { $ref: string; }; description: string; }; presentations: { type: string; items: { $ref: string; }; description: string; }; }; required: string\[\]; additionalProperties: boolean; description: string; }; IMetaData: { type: string; properties: { type: { type: string; description: string; }; value: { type: string; description: string; }; }; required: string\[\]; additionalProperties: boolean; description: string; }; VerifiableCredential: { $ref: string; description: string; }; "Verifiable-W3CCredential": { type: string; additionalProperties: boolean; properties: { proof: { $ref: string; }; id: { type: string; }; credentialSubject: { type: string; properties: { id: { type: string; }; }; }; credentialStatus: { type: string; properties: { id: { type: string; }; type: { type: string; }; }; required: string\[\]; }; "@context": { type: string; properties: {}; }; type: { type: string; properties: {}; }; issuer: { type: string; properties: { id: { type: string; }; }; required: string\[\]; }; issuanceDate: { type: string; }; expirationDate: { type: string; }; }; required: string\[\]; description: string; }; Proof: { type: string; properties: { type: { type: string; }; }; }; VerifiablePresentation: { $ref: string; description: string; }; "Verifiable-W3CPresentation": { type: string; additionalProperties: boolean; properties: { proof: { $ref: string; }; id: { type: string; }; holder: { type: string; }; issuanceDate: { type: string; }; expirationDate: { type: string; }; "@context": { type: string; properties: {}; }; type: { type: string; properties: {}; }; verifier: { type: string; properties: {}; }; verifiableCredential: { type: string; properties: {}; }; }; required: string\[\]; description: string; }; }; methods: { sendMessageDIDCommAlpha1: { description: string; arguments: { $ref: string; }; returnType: { $ref: string; }; }; }; }; } | <b><i>(BETA)</i></b> |
## Methods
Expand Down
Loading

0 comments on commit d4450cd

Please sign in to comment.