diff --git a/packages/daf-graphql/src/client.ts b/packages/daf-graphql/src/client.ts index d2ba3e66e..551dac306 100644 --- a/packages/daf-graphql/src/client.ts +++ b/packages/daf-graphql/src/client.ts @@ -1,12 +1,34 @@ import 'cross-fetch/polyfill' -import { IAgentPlugin, IPluginMethodMap } from 'daf-core' +import { IAgentPlugin, IPluginMethodMap, IAgentPluginSchema } from 'daf-core' import { GraphQLClient } from 'graphql-request' import { IAgentGraphQLMethod } from './types' import { supportedMethods } from './methods' +import IMessageHandler from 'daf-core/build/schemas/IMessageHandler' +import IDataStore from 'daf-core/build/schemas/IDataStore' +import IKeyManager from 'daf-core/build/schemas/IKeyManager' +import IResolver from 'daf-core/build/schemas/IResolver' + +const schema: IAgentPluginSchema = { + components: { + schemas: { + ...IMessageHandler.components.schemas, + ...IDataStore.components.schemas, + ...IKeyManager.components.schemas, + ...IResolver.components.schemas, + }, + methods: { + ...IMessageHandler.components.methods, + ...IDataStore.components.methods, + ...IKeyManager.components.methods, + ...IResolver.components.methods, + }, + } +} export class AgentGraphQLClient implements IAgentPlugin { private client: GraphQLClient readonly methods: IPluginMethodMap = {} + readonly schema = schema constructor(options: { url: string diff --git a/packages/daf-message-handler/src/message-handler.ts b/packages/daf-message-handler/src/message-handler.ts index 02b167d25..55d002b15 100644 --- a/packages/daf-message-handler/src/message-handler.ts +++ b/packages/daf-message-handler/src/message-handler.ts @@ -2,6 +2,7 @@ import { EventEmitter } from 'events' import { IDataStore, IAgentPlugin, IAgentContext, IMessageHandler, IHandleMessageArgs } from 'daf-core' import { Message } from './message' import { AbstractMessageHandler } from './abstract-message-handler' +import schema from 'daf-core/build/schemas/IMessageHandler' import Debug from 'debug' const debug = Debug('daf:message-handler') @@ -21,6 +22,7 @@ export class MessageHandler extends EventEmitter implements IAgentPlugin { * @public */ readonly methods: IMessageHandler + readonly schema = schema private messageHandler?: AbstractMessageHandler constructor(options: { messageHandlers: AbstractMessageHandler[] }) { diff --git a/packages/daf-rest/src/client.ts b/packages/daf-rest/src/client.ts index 22591c2db..530dd8faf 100644 --- a/packages/daf-rest/src/client.ts +++ b/packages/daf-rest/src/client.ts @@ -1,9 +1,32 @@ import 'cross-fetch/polyfill' -import { IAgentPlugin, IPluginMethodMap } from 'daf-core' +import { IAgentPlugin, IPluginMethodMap, IAgentPluginSchema } from 'daf-core' import { supportedMethods } from './index' +import IMessageHandler from 'daf-core/build/schemas/IMessageHandler' +import IDataStore from 'daf-core/build/schemas/IDataStore' +import IKeyManager from 'daf-core/build/schemas/IKeyManager' +import IResolver from 'daf-core/build/schemas/IResolver' + +const schema: IAgentPluginSchema = { + components: { + schemas: { + ...IMessageHandler.components.schemas, + ...IDataStore.components.schemas, + ...IKeyManager.components.schemas, + ...IResolver.components.schemas, + }, + methods: { + ...IMessageHandler.components.methods, + ...IDataStore.components.methods, + ...IKeyManager.components.methods, + ...IResolver.components.methods, + }, + } +} + export class AgentRestClient implements IAgentPlugin { readonly methods: IPluginMethodMap = {} + readonly schema = schema private url: string constructor(options: {