@webiny/handler-client 0.0.0-unstable.2af142b57e → 0.0.0-unstable.3bc8100a7f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { InvokeArgs, ClientContext } from "./types";
1
+ import type { InvokeArgs, ClientContext } from "./types";
2
2
  declare class HandlerClient {
3
3
  private readonly plugin;
4
4
  /**
package/HandlerClient.js CHANGED
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
8
  var _error = _interopRequireDefault(require("@webiny/error"));
10
9
  var _HandlerClientPlugin = require("./HandlerClientPlugin");
11
10
  const defaultPluginName = "handler-client";
@@ -47,8 +46,6 @@ class HandlerClient {
47
46
  */
48
47
 
49
48
  constructor(context) {
50
- (0, _defineProperty2.default)(this, "plugin", void 0);
51
- (0, _defineProperty2.default)(this, "default", void 0);
52
49
  this.plugin = getHandlerClientPlugin(context);
53
50
  this.default = getPluginFetcher(context);
54
51
  }
@@ -77,5 +74,6 @@ class HandlerClient {
77
74
  }
78
75
  }
79
76
  }
80
- var _default = HandlerClient;
81
- exports.default = _default;
77
+ var _default = exports.default = HandlerClient;
78
+
79
+ //# sourceMappingURL=HandlerClient.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["defaultPluginName","getPluginFetcher","context","pl","HandlerClientPlugin","invoke","params","name","payload","await","useAwait","plugin","plugins","byName","WebinyError","promise","getHandlerClientPlugin","HandlerClient","constructor","default","canHandle","ex","data","error","message","code","description","JSON","stringify"],"sources":["HandlerClient.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { HandlerClientHandlerPlugin, InvokeArgs, ClientContext } from \"./types\";\nimport { HandlerClientPlugin } from \"~/HandlerClientPlugin\";\n\nconst defaultPluginName = \"handler-client\";\n\nconst getPluginFetcher = (context: ClientContext): HandlerClientPlugin => {\n const pl = new HandlerClientPlugin({\n invoke: async params => {\n const { name, payload, await: useAwait } = params;\n const plugin = context.plugins.byName<HandlerClientHandlerPlugin>(name);\n if (!plugin) {\n throw new WebinyError(`Could not find \"${name}\" handler plugin.`);\n }\n\n const promise = plugin.invoke(payload);\n if (useAwait === false) {\n return null;\n }\n\n return promise;\n }\n });\n pl.name = defaultPluginName;\n return pl;\n};\n\nconst getHandlerClientPlugin = (context: ClientContext): HandlerClientPlugin => {\n const plugin = context.plugins.byName<HandlerClientPlugin>(\"handler-client\");\n if (plugin) {\n return plugin;\n }\n // If not specified, use a fallback plugin that fetches different handlers via plugins.\n // This might also be useful for testing purposes.\n return getPluginFetcher(context);\n};\n\nclass HandlerClient {\n private readonly plugin: HandlerClientPlugin;\n /**\n * We need the default plugin to later on fetch another plugin than initially selected.\n * If name of the required plugin is not the default one, fetch new one.\n */\n private readonly default: HandlerClientPlugin;\n\n constructor(context: ClientContext) {\n this.plugin = getHandlerClientPlugin(context);\n this.default = getPluginFetcher(context);\n }\n\n public async invoke<TInvokeArgsPayload = any, TResponse = any>(\n params: InvokeArgs<TInvokeArgsPayload>\n ): Promise<TResponse> {\n let plugin: HandlerClientPlugin = this.plugin;\n if (plugin.canHandle && plugin.canHandle(params) === false) {\n plugin = this.default;\n }\n try {\n return await plugin.invoke(params);\n } catch (ex) {\n /**\n * We collect error that was caught and the description of the invoke, if any.\n */\n const data: Record<string, any> = {\n error: {\n message: ex.message,\n data: ex.data,\n code: ex.code\n }\n };\n if (params.description) {\n data.description = params.description;\n }\n throw new WebinyError(\n `An error occurred while trying to invoke another handler with the following params: ${JSON.stringify(\n params,\n null,\n 2\n )}`,\n \"INVOKE_ERROR\",\n data\n );\n }\n }\n}\n\nexport default HandlerClient;\n"],"mappings":";;;;;;;;AAAA;AAEA;AAEA,MAAMA,iBAAiB,GAAG,gBAAgB;AAE1C,MAAMC,gBAAgB,GAAIC,OAAsB,IAA0B;EACtE,MAAMC,EAA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AAO;IACzB;IACA,IAAI;MACA,OAAO,MAAMR,MAAM,CAACN,MAAM,CAACC,MAAM,CAAC;IACtC,CAAC,CAAC,OAAOe,EAAE,EAAE;MACT;AACZ;AACA;MACY,MAAMC,IAAyB,GAAG;QAC9BC,KAAK,EAAE;UACHC,OAAO,EAAEH,EAAE,CAACG,OAAO;UACnBF,IAAI,EAAED,EAAE,CAACC,IAAI;UACbG,IAAI,EAAEJ,EAAE,CAACI;QACb;MACJ,CAAC;MACD,IAAInB,MAAM,CAACoB,WAAW,EAAE;QACpBJ,IAAI,CAACI,WAAW,GAAGpB,MAAM,CAACoB,WAAW;MACzC;MACA,MAAM,IAAIZ,cAAW,CAChB,uFAAsFa,IAAI,CAACC,SAAS,CACjGtB,MAAM,EACN,IAAI,EACJ,CAAC,CACH,EAAC,EACH,cAAc,EACdgB,IAAI,CACP;IACL;EACJ;AACJ;AAAC,eAEcL,aAAa;AAAA"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_HandlerClientPlugin","defaultPluginName","getPluginFetcher","context","pl","HandlerClientPlugin","invoke","params","name","payload","await","useAwait","plugin","plugins","byName","WebinyError","promise","getHandlerClientPlugin","HandlerClient","constructor","default","canHandle","ex","data","error","message","code","description","JSON","stringify","_default","exports"],"sources":["HandlerClient.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { HandlerClientHandlerPlugin, InvokeArgs, ClientContext } from \"./types\";\nimport { HandlerClientPlugin } from \"~/HandlerClientPlugin\";\n\nconst defaultPluginName = \"handler-client\";\n\nconst getPluginFetcher = (context: ClientContext): HandlerClientPlugin => {\n const pl = new HandlerClientPlugin({\n invoke: async params => {\n const { name, payload, await: useAwait } = params;\n const plugin = context.plugins.byName<HandlerClientHandlerPlugin>(name);\n if (!plugin) {\n throw new WebinyError(`Could not find \"${name}\" handler plugin.`);\n }\n\n const promise = plugin.invoke(payload);\n if (useAwait === false) {\n return null;\n }\n\n return promise;\n }\n });\n pl.name = defaultPluginName;\n return pl;\n};\n\nconst getHandlerClientPlugin = (context: ClientContext): HandlerClientPlugin => {\n const plugin = context.plugins.byName<HandlerClientPlugin>(\"handler-client\");\n if (plugin) {\n return plugin;\n }\n // If not specified, use a fallback plugin that fetches different handlers via plugins.\n // This might also be useful for testing purposes.\n return getPluginFetcher(context);\n};\n\nclass HandlerClient {\n private readonly plugin: HandlerClientPlugin;\n /**\n * We need the default plugin to later on fetch another plugin than initially selected.\n * If name of the required plugin is not the default one, fetch new one.\n */\n private readonly default: HandlerClientPlugin;\n\n constructor(context: ClientContext) {\n this.plugin = getHandlerClientPlugin(context);\n this.default = getPluginFetcher(context);\n }\n\n public async invoke<TInvokeArgsPayload = any, TResponse = any>(\n params: InvokeArgs<TInvokeArgsPayload>\n ): Promise<TResponse> {\n let plugin: HandlerClientPlugin = this.plugin;\n if (plugin.canHandle && plugin.canHandle(params) === false) {\n plugin = this.default;\n }\n try {\n return await plugin.invoke(params);\n } catch (ex) {\n /**\n * We collect error that was caught and the description of the invoke, if any.\n */\n const data: Record<string, any> = {\n error: {\n message: ex.message,\n data: ex.data,\n code: ex.code\n }\n };\n if (params.description) {\n data.description = params.description;\n }\n throw new WebinyError(\n `An error occurred while trying to invoke another handler with the following params: ${JSON.stringify(\n params,\n null,\n 2\n )}`,\n \"INVOKE_ERROR\",\n data\n );\n }\n }\n}\n\nexport default HandlerClient;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,oBAAA,GAAAD,OAAA;AAEA,MAAME,iBAAiB,GAAG,gBAAgB;AAE1C,MAAMC,gBAAgB,GAAIC,OAAsB,IAA0B;EACtE,MAAMC,EAAE,GAAG,IAAIC,wCAAmB,CAAC;IAC/BC,MAAM,EAAE,MAAMC,MAAM,IAAI;MACpB,MAAM;QAAEC,IAAI;QAAEC,OAAO;QAAEC,KAAK,EAAEC;MAAS,CAAC,GAAGJ,MAAM;MACjD,MAAMK,MAAM,GAAGT,OAAO,CAACU,O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,OAAO;UACnBF,IAAI,EAAED,EAAE,CAACC,IAAI;UACbG,IAAI,EAAEJ,EAAE,CAACI;QACb;MACJ,CAAC;MACD,IAAInB,MAAM,CAACoB,WAAW,EAAE;QACpBJ,IAAI,CAACI,WAAW,GAAGpB,MAAM,CAACoB,WAAW;MACzC;MACA,MAAM,IAAIZ,cAAW,CACjB,uFAAuFa,IAAI,CAACC,SAAS,CACjGtB,MAAM,EACN,IAAI,EACJ,CACJ,CAAC,EAAE,EACH,cAAc,EACdgB,IACJ,CAAC;IACL;EACJ;AACJ;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAX,OAAA,GAEcF,aAAa","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  import { Plugin } from "@webiny/plugins/Plugin";
2
- import { InvokeArgs } from "./types";
3
- interface HandlerClientPluginCallable<Payload = Record<string, any>, Response = any> {
2
+ import type { InvokeArgs } from "./types";
3
+ interface HandlerClientPluginCallable<Payload = any, Response = any> {
4
4
  (params: InvokeArgs<Payload>): Promise<Response>;
5
5
  }
6
6
  export interface HandlerClientPluginParams {
@@ -1,20 +1,17 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.HandlerClientPlugin = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
7
  var _Plugin = require("@webiny/plugins/Plugin");
10
8
  class HandlerClientPlugin extends _Plugin.Plugin {
9
+ static type = "handler-client";
11
10
  constructor({
12
11
  invoke,
13
12
  canUse
14
13
  }) {
15
14
  super();
16
- (0, _defineProperty2.default)(this, "_invoke", void 0);
17
- (0, _defineProperty2.default)(this, "canUse", void 0);
18
15
  this._invoke = invoke;
19
16
  this.canUse = canUse;
20
17
  }
@@ -29,4 +26,5 @@ class HandlerClientPlugin extends _Plugin.Plugin {
29
26
  }
30
27
  }
31
28
  exports.HandlerClientPlugin = HandlerClientPlugin;
32
- (0, _defineProperty2.default)(HandlerClientPlugin, "type", "handler-client");
29
+
30
+ //# sourceMappingURL=HandlerClientPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["HandlerClientPlugin","Plugin","constructor","invoke","canUse","_invoke","canHandle","params"],"sources":["HandlerClientPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/Plugin\";\nimport { InvokeArgs } from \"~/types\";\n\ninterface HandlerClientPluginCallable<Payload = Record<string, any>, Response = any> {\n (params: InvokeArgs<Payload>): Promise<Response>;\n}\n\nexport interface HandlerClientPluginParams {\n invoke: HandlerClientPluginCallable;\n canUse?: (params: InvokeArgs) => boolean;\n}\n\nexport class HandlerClientPlugin extends Plugin {\n public static override type = \"handler-client\";\n\n private readonly _invoke: HandlerClientPluginCallable;\n private readonly canUse?: (params: InvokeArgs) => boolean;\n\n public constructor({ invoke, canUse }: HandlerClientPluginParams) {\n super();\n this._invoke = invoke;\n this.canUse = canUse;\n }\n\n public canHandle(params: InvokeArgs): boolean {\n if (!this.canUse) {\n return true;\n }\n return this.canUse(params);\n }\n\n public invoke<Payload = any, Response = any>(params: InvokeArgs<Payload>): Promise<Response> {\n return this._invoke(params);\n }\n}\n"],"mappings":";;;;;;;;AAAA;AAYO,MAAMA,mBAAmB,SAASC,cAAM,CAAC;EAMrCC,WAAW,CAAC;IAAEC,MAAM;IAAEC;EAAkC,CAAC,EAAE;IAC9D,KAAK,EAAE;IAAC;IAAA;IACR,IAAI,CAACC,OAAO,GAAGF,MAAM;IACrB,IAAI,CAACC,MAAM,GAAGA,MAAM;EACxB;EAEOE,SAAS,CAACC,MAAkB,EAAW;IAC1C,IAAI,CAAC,IAAI,CAACH,MAAM,EAAE;MACd,OAAO,IAAI;IACf;IACA,OAAO,IAAI,CAACA,MAAM,CAACG,MAAM,CAAC;EAC9B;EAEOJ,MAAM,CAAgCI,MAA2B,EAAqB;IACzF,OAAO,IAAI,CAACF,OAAO,CAACE,MAAM,CAAC;EAC/B;AACJ;AAAC;AAAA,8BAtBYP,mBAAmB,UACE,gBAAgB"}
1
+ {"version":3,"names":["_Plugin","require","HandlerClientPlugin","Plugin","type","constructor","invoke","canUse","_invoke","canHandle","params","exports"],"sources":["HandlerClientPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/Plugin\";\nimport type { InvokeArgs } from \"~/types\";\n\ninterface HandlerClientPluginCallable<Payload = any, Response = any> {\n (params: InvokeArgs<Payload>): Promise<Response>;\n}\n\nexport interface HandlerClientPluginParams {\n invoke: HandlerClientPluginCallable;\n canUse?: (params: InvokeArgs) => boolean;\n}\n\nexport class HandlerClientPlugin extends Plugin {\n public static override type = \"handler-client\";\n\n private readonly _invoke: HandlerClientPluginCallable;\n private readonly canUse?: (params: InvokeArgs) => boolean;\n\n public constructor({ invoke, canUse }: HandlerClientPluginParams) {\n super();\n this._invoke = invoke;\n this.canUse = canUse;\n }\n\n public canHandle(params: InvokeArgs): boolean {\n if (!this.canUse) {\n return true;\n }\n return this.canUse(params);\n }\n\n public invoke<Payload = any, Response = any>(params: InvokeArgs<Payload>): Promise<Response> {\n return this._invoke(params);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAYO,MAAMC,mBAAmB,SAASC,cAAM,CAAC;EAC5C,OAAuBC,IAAI,GAAG,gBAAgB;EAKvCC,WAAWA,CAAC;IAAEC,MAAM;IAAEC;EAAkC,CAAC,EAAE;IAC9D,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,OAAO,GAAGF,MAAM;IACrB,IAAI,CAACC,MAAM,GAAGA,MAAM;EACxB;EAEOE,SAASA,CAACC,MAAkB,EAAW;IAC1C,IAAI,CAAC,IAAI,CAACH,MAAM,EAAE;MACd,OAAO,IAAI;IACf;IACA,OAAO,IAAI,CAACA,MAAM,CAACG,MAAM,CAAC;EAC9B;EAEOJ,MAAMA,CAAgCI,MAA2B,EAAqB;IACzF,OAAO,IAAI,CAACF,OAAO,CAACE,MAAM,CAAC;EAC/B;AACJ;AAACC,OAAA,CAAAT,mBAAA,GAAAA,mBAAA","ignoreList":[]}
package/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ClientContext } from "./types";
1
+ import type { ClientContext } from "./types";
2
2
  export * from "./HandlerClientPlugin";
3
3
  export declare const createHandlerClient: () => {
4
4
  type: string;
package/index.js CHANGED
@@ -28,4 +28,6 @@ const createHandlerClient = () => ({
28
28
  context.handlerClient = new _HandlerClient.default(context);
29
29
  }
30
30
  });
31
- exports.createHandlerClient = createHandlerClient;
31
+ exports.createHandlerClient = createHandlerClient;
32
+
33
+ //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["createHandlerClient","type","name","apply","context","handlerClient","HandlerClient"],"sources":["index.ts"],"sourcesContent":["import HandlerClient from \"./HandlerClient\";\nimport { ClientContext } from \"~/types\";\n\nexport * from \"./HandlerClientPlugin\";\n\nexport const createHandlerClient = () => ({\n type: \"context\",\n name: \"handler-client.context\",\n async apply(context: ClientContext) {\n context.handlerClient = new HandlerClient(context);\n }\n});\n"],"mappings":";;;;;;;;;;AAAA;AAGA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAEO,MAAMA,mBAAmB,GAAG,OAAO;EACtCC,IAAI,EAAE,SAAS;EACfC,IAAI,EAAE,wBAAwB;EAC9B,MAAMC,KAAK,CAACC,OAAsB,EAAE;IAChCA,OAAO,CAACC,aAAa,GAAG,IAAIC,sBAAa,CAACF,OAAO,CAAC;EACtD;AACJ,CAAC,CAAC;AAAC"}
1
+ {"version":3,"names":["_HandlerClient","_interopRequireDefault","require","_HandlerClientPlugin","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","createHandlerClient","type","name","apply","context","handlerClient","HandlerClient"],"sources":["index.ts"],"sourcesContent":["import HandlerClient from \"./HandlerClient\";\nimport type { ClientContext } from \"~/types\";\n\nexport * from \"./HandlerClientPlugin\";\n\nexport const createHandlerClient = () => ({\n type: \"context\",\n name: \"handler-client.context\",\n async apply(context: ClientContext) {\n context.handlerClient = new HandlerClient(context);\n }\n});\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,oBAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,oBAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,oBAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,oBAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAEO,MAAMS,mBAAmB,GAAGA,CAAA,MAAO;EACtCC,IAAI,EAAE,SAAS;EACfC,IAAI,EAAE,wBAAwB;EAC9B,MAAMC,KAAKA,CAACC,OAAsB,EAAE;IAChCA,OAAO,CAACC,aAAa,GAAG,IAAIC,sBAAa,CAACF,OAAO,CAAC;EACtD;AACJ,CAAC,CAAC;AAACR,OAAA,CAAAI,mBAAA,GAAAA,mBAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/handler-client",
3
- "version": "0.0.0-unstable.2af142b57e",
3
+ "version": "0.0.0-unstable.3bc8100a7f",
4
4
  "main": "index.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,31 +14,23 @@
14
14
  ],
15
15
  "license": "MIT",
16
16
  "dependencies": {
17
- "@babel/runtime": "7.20.13",
18
- "@webiny/api": "0.0.0-unstable.2af142b57e",
19
- "@webiny/error": "0.0.0-unstable.2af142b57e",
20
- "@webiny/plugins": "0.0.0-unstable.2af142b57e"
17
+ "@webiny/api": "0.0.0-unstable.3bc8100a7f",
18
+ "@webiny/error": "0.0.0-unstable.3bc8100a7f",
19
+ "@webiny/plugins": "0.0.0-unstable.3bc8100a7f"
21
20
  },
22
21
  "devDependencies": {
23
- "@babel/cli": "^7.19.3",
24
- "@babel/core": "^7.19.3",
25
- "@babel/preset-env": "^7.19.4",
26
- "@babel/preset-typescript": "^7.18.6",
27
- "@webiny/cli": "^0.0.0-unstable.2af142b57e",
28
- "@webiny/project-utils": "^0.0.0-unstable.2af142b57e",
29
- "babel-plugin-lodash": "^3.3.4",
30
- "jest": "^28.1.0",
31
- "merge": "^1.2.1",
32
- "rimraf": "^3.0.2",
33
- "typescript": "4.7.4"
22
+ "@webiny/project-utils": "0.0.0-unstable.3bc8100a7f",
23
+ "jest": "29.7.0",
24
+ "rimraf": "6.0.1",
25
+ "typescript": "5.3.3"
34
26
  },
35
27
  "publishConfig": {
36
28
  "access": "public",
37
29
  "directory": "dist"
38
30
  },
39
31
  "scripts": {
40
- "build": "yarn webiny run build",
41
- "watch": "yarn webiny run watch"
32
+ "build": "node ../cli/bin.js run build",
33
+ "watch": "node ../cli/bin.js run watch"
42
34
  },
43
- "gitHead": "2af142b57e7cdc433f5098b3b6d43ae6caa5d54e"
35
+ "gitHead": "3bc8100a7f1fb3a8d6a3454a2765f8ef377c279e"
44
36
  }
package/types.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import HandlerClient from "./HandlerClient";
2
- import { Plugin } from "@webiny/plugins/types";
3
- import { Context } from "@webiny/api/types";
4
- export declare type InvokeArgs<TInvokeArgsPayload = any> = {
1
+ import type HandlerClient from "./HandlerClient";
2
+ import type { Plugin } from "@webiny/plugins/types";
3
+ import type { Context } from "@webiny/api/types";
4
+ export type InvokeArgs<TInvokeArgsPayload = any> = {
5
5
  name: string;
6
6
  payload?: TInvokeArgsPayload;
7
7
  await?: boolean;
8
8
  description?: string;
9
9
  };
10
- export declare type HandlerClientHandlerPlugin = Plugin & {
10
+ export type HandlerClientHandlerPlugin = Plugin & {
11
11
  type: "handler-client-handler";
12
12
  invoke: <TArgs = Record<string, any>, TResponse = Record<string, any>>(params: TArgs) => TResponse | Promise<TResponse>;
13
13
  };
package/types.js CHANGED
@@ -2,4 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
- });
5
+ });
6
+
7
+ //# sourceMappingURL=types.js.map
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import HandlerClient from \"./HandlerClient\";\nimport { Plugin } from \"@webiny/plugins/types\";\nimport { Context } from \"@webiny/api/types\";\n\nexport type InvokeArgs<TInvokeArgsPayload = any> = {\n name: string;\n payload?: TInvokeArgsPayload;\n await?: boolean;\n description?: string;\n};\n\nexport type HandlerClientHandlerPlugin = Plugin & {\n type: \"handler-client-handler\";\n invoke: <TArgs = Record<string, any>, TResponse = Record<string, any>>(\n params: TArgs\n ) => TResponse | Promise<TResponse>;\n};\n\nexport interface ClientContext extends Context {\n handlerClient: HandlerClient;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type HandlerClient from \"./HandlerClient\";\nimport type { Plugin } from \"@webiny/plugins/types\";\nimport type { Context } from \"@webiny/api/types\";\n\nexport type InvokeArgs<TInvokeArgsPayload = any> = {\n name: string;\n payload?: TInvokeArgsPayload;\n await?: boolean;\n description?: string;\n};\n\nexport type HandlerClientHandlerPlugin = Plugin & {\n type: \"handler-client-handler\";\n invoke: <TArgs = Record<string, any>, TResponse = Record<string, any>>(\n params: TArgs\n ) => TResponse | Promise<TResponse>;\n};\n\nexport interface ClientContext extends Context {\n handlerClient: HandlerClient;\n}\n"],"mappings":"","ignoreList":[]}