@webiny/handler-client 5.30.0 → 5.31.0-beta.0
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.
- package/HandlerClient.d.ts +5 -0
- package/HandlerClient.js +57 -23
- package/HandlerClient.js.map +1 -1
- package/HandlerClientPlugin.d.ts +18 -0
- package/HandlerClientPlugin.js +41 -0
- package/HandlerClientPlugin.js.map +1 -0
- package/index.d.ts +4 -3
- package/index.js +22 -4
- package/index.js.map +1 -1
- package/package.json +8 -8
- package/types.d.ts +2 -6
- package/types.js.map +1 -1
package/HandlerClient.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { InvokeArgs, ClientContext } from "./types";
|
|
2
2
|
declare class HandlerClient {
|
|
3
3
|
private readonly plugin;
|
|
4
|
+
/**
|
|
5
|
+
* We need the default plugin to later on fetch another plugin than initially selected.
|
|
6
|
+
* If name of the required plugin is not the default one, fetch new one.
|
|
7
|
+
*/
|
|
8
|
+
private readonly default;
|
|
4
9
|
constructor(context: ClientContext);
|
|
5
10
|
invoke<TInvokeArgsPayload = any, TResponse = any>(params: InvokeArgs<TInvokeArgsPayload>): Promise<TResponse>;
|
|
6
11
|
}
|
package/HandlerClient.js
CHANGED
|
@@ -11,24 +11,18 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
11
11
|
|
|
12
12
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
async invoke({
|
|
28
|
-
name,
|
|
29
|
-
payload,
|
|
30
|
-
await: useAwait
|
|
31
|
-
}) {
|
|
14
|
+
var _HandlerClientPlugin = require("./HandlerClientPlugin");
|
|
15
|
+
|
|
16
|
+
const defaultPluginName = "handler-client";
|
|
17
|
+
|
|
18
|
+
const getPluginFetcher = context => {
|
|
19
|
+
const pl = new _HandlerClientPlugin.HandlerClientPlugin({
|
|
20
|
+
invoke: async params => {
|
|
21
|
+
const {
|
|
22
|
+
name,
|
|
23
|
+
payload,
|
|
24
|
+
await: useAwait
|
|
25
|
+
} = params;
|
|
32
26
|
const plugin = context.plugins.byName(name);
|
|
33
27
|
|
|
34
28
|
if (!plugin) {
|
|
@@ -43,21 +37,61 @@ const getHandlerClientPlugin = context => {
|
|
|
43
37
|
|
|
44
38
|
return promise;
|
|
45
39
|
}
|
|
40
|
+
});
|
|
41
|
+
pl.name = defaultPluginName;
|
|
42
|
+
return pl;
|
|
43
|
+
};
|
|
46
44
|
|
|
47
|
-
|
|
45
|
+
const getHandlerClientPlugin = context => {
|
|
46
|
+
const plugin = context.plugins.byName("handler-client");
|
|
47
|
+
|
|
48
|
+
if (plugin) {
|
|
49
|
+
return plugin;
|
|
50
|
+
} // If not specified, use a fallback plugin that fetches different handlers via plugins.
|
|
51
|
+
// This might also be useful for testing purposes.
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
return getPluginFetcher(context);
|
|
48
55
|
};
|
|
49
56
|
|
|
50
57
|
class HandlerClient {
|
|
58
|
+
/**
|
|
59
|
+
* We need the default plugin to later on fetch another plugin than initially selected.
|
|
60
|
+
* If name of the required plugin is not the default one, fetch new one.
|
|
61
|
+
*/
|
|
51
62
|
constructor(context) {
|
|
52
63
|
(0, _defineProperty2.default)(this, "plugin", void 0);
|
|
64
|
+
(0, _defineProperty2.default)(this, "default", void 0);
|
|
53
65
|
this.plugin = getHandlerClientPlugin(context);
|
|
66
|
+
this.default = getPluginFetcher(context);
|
|
54
67
|
}
|
|
55
68
|
|
|
56
|
-
invoke(params) {
|
|
69
|
+
async invoke(params) {
|
|
70
|
+
let plugin = this.plugin;
|
|
71
|
+
|
|
72
|
+
if (plugin.canHandle && plugin.canHandle(params) === false) {
|
|
73
|
+
plugin = this.default;
|
|
74
|
+
}
|
|
75
|
+
|
|
57
76
|
try {
|
|
58
|
-
return
|
|
59
|
-
} catch (
|
|
60
|
-
|
|
77
|
+
return await plugin.invoke(params);
|
|
78
|
+
} catch (ex) {
|
|
79
|
+
/**
|
|
80
|
+
* We collect error that was caught and the description of the invoke, if any.
|
|
81
|
+
*/
|
|
82
|
+
const data = {
|
|
83
|
+
error: {
|
|
84
|
+
message: ex.message,
|
|
85
|
+
data: ex.data,
|
|
86
|
+
code: ex.code
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
if (params.description) {
|
|
91
|
+
data.description = params.description;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
throw new _error.default(`An error occurred while trying to invoke another handler with the following params: ${JSON.stringify(params, null, 2)}`, "INVOKE_ERROR", data);
|
|
61
95
|
}
|
|
62
96
|
}
|
|
63
97
|
|
package/HandlerClient.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
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,gBAA1B;;AAEA,MAAMC,gBAAgB,GAAIC,OAAD,IAAiD;EACtE,MAAMC,EAAE,GAAG,IAAIC,wCAAJ,CAAwB;IAC/BC,MAAM,EAAE,MAAMC,MAAN,IAAgB;MACpB,MAAM;QAAEC,IAAF;QAAQC,OAAR;QAAiBC,KAAK,EAAEC;MAAxB,IAAqCJ,MAA3C;MACA,MAAMK,MAAM,GAAGT,OAAO,CAACU,OAAR,CAAgBC,MAAhB,CAAmDN,IAAnD,CAAf;;MACA,IAAI,CAACI,MAAL,EAAa;QACT,MAAM,IAAIG,cAAJ,CAAiB,mBAAkBP,IAAK,mBAAxC,CAAN;MACH;;MAED,MAAMQ,OAAO,GAAGJ,MAAM,CAACN,MAAP,CAAcG,OAAd,CAAhB;;MACA,IAAIE,QAAQ,KAAK,KAAjB,EAAwB;QACpB,OAAO,IAAP;MACH;;MAED,OAAOK,OAAP;IACH;EAd8B,CAAxB,CAAX;EAgBAZ,EAAE,CAACI,IAAH,GAAUP,iBAAV;EACA,OAAOG,EAAP;AACH,CAnBD;;AAqBA,MAAMa,sBAAsB,GAAId,OAAD,IAAiD;EAC5E,MAAMS,MAAM,GAAGT,OAAO,CAACU,OAAR,CAAgBC,MAAhB,CAA4C,gBAA5C,CAAf;;EACA,IAAIF,MAAJ,EAAY;IACR,OAAOA,MAAP;EACH,CAJ2E,CAK5E;EACA;;;EACA,OAAOV,gBAAgB,CAACC,OAAD,CAAvB;AACH,CARD;;AAUA,MAAMe,aAAN,CAAoB;EAEhB;AACJ;AACA;AACA;EAGIC,WAAW,CAAChB,OAAD,EAAyB;IAAA;IAAA;IAChC,KAAKS,MAAL,GAAcK,sBAAsB,CAACd,OAAD,CAApC;IACA,KAAKiB,OAAL,GAAelB,gBAAgB,CAACC,OAAD,CAA/B;EACH;;EAEkB,MAANG,MAAM,CACfC,MADe,EAEG;IAClB,IAAIK,MAA2B,GAAG,KAAKA,MAAvC;;IACA,IAAIA,MAAM,CAACS,SAAP,IAAoBT,MAAM,CAACS,SAAP,CAAiBd,MAAjB,MAA6B,KAArD,EAA4D;MACxDK,MAAM,GAAG,KAAKQ,OAAd;IACH;;IACD,IAAI;MACA,OAAO,MAAMR,MAAM,CAACN,MAAP,CAAcC,MAAd,CAAb;IACH,CAFD,CAEE,OAAOe,EAAP,EAAW;MACT;AACZ;AACA;MACY,MAAMC,IAAyB,GAAG;QAC9BC,KAAK,EAAE;UACHC,OAAO,EAAEH,EAAE,CAACG,OADT;UAEHF,IAAI,EAAED,EAAE,CAACC,IAFN;UAGHG,IAAI,EAAEJ,EAAE,CAACI;QAHN;MADuB,CAAlC;;MAOA,IAAInB,MAAM,CAACoB,WAAX,EAAwB;QACpBJ,IAAI,CAACI,WAAL,GAAmBpB,MAAM,CAACoB,WAA1B;MACH;;MACD,MAAM,IAAIZ,cAAJ,CACD,uFAAsFa,IAAI,CAACC,SAAL,CACnFtB,MADmF,EAEnF,IAFmF,EAGnF,CAHmF,CAIrF,EALA,EAMF,cANE,EAOFgB,IAPE,CAAN;IASH;EACJ;;AA9Ce;;eAiDLL,a"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Plugin } from "@webiny/plugins/Plugin";
|
|
2
|
+
import { InvokeArgs } from "./types";
|
|
3
|
+
interface HandlerClientPluginCallable<Payload = Record<string, any>, Response = any> {
|
|
4
|
+
(params: InvokeArgs<Payload>): Promise<Response>;
|
|
5
|
+
}
|
|
6
|
+
export interface HandlerClientPluginParams {
|
|
7
|
+
invoke: HandlerClientPluginCallable;
|
|
8
|
+
canUse?: (params: InvokeArgs) => boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare class HandlerClientPlugin extends Plugin {
|
|
11
|
+
static type: string;
|
|
12
|
+
private readonly _invoke;
|
|
13
|
+
private readonly canUse?;
|
|
14
|
+
constructor({ invoke, canUse }: HandlerClientPluginParams);
|
|
15
|
+
canHandle(params: InvokeArgs): boolean;
|
|
16
|
+
invoke<Payload = any, Response = any>(params: InvokeArgs<Payload>): Promise<Response>;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.HandlerClientPlugin = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _Plugin = require("@webiny/plugins/Plugin");
|
|
13
|
+
|
|
14
|
+
class HandlerClientPlugin extends _Plugin.Plugin {
|
|
15
|
+
constructor({
|
|
16
|
+
invoke,
|
|
17
|
+
canUse
|
|
18
|
+
}) {
|
|
19
|
+
super();
|
|
20
|
+
(0, _defineProperty2.default)(this, "_invoke", void 0);
|
|
21
|
+
(0, _defineProperty2.default)(this, "canUse", void 0);
|
|
22
|
+
this._invoke = invoke;
|
|
23
|
+
this.canUse = canUse;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
canHandle(params) {
|
|
27
|
+
if (!this.canUse) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return this.canUse(params);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
invoke(params) {
|
|
35
|
+
return this._invoke(params);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
exports.HandlerClientPlugin = HandlerClientPlugin;
|
|
41
|
+
(0, _defineProperty2.default)(HandlerClientPlugin, "type", "handler-client");
|
|
@@ -0,0 +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,mBAAN,SAAkCC,cAAlC,CAAyC;EAMrCC,WAAW,CAAC;IAAEC,MAAF;IAAUC;EAAV,CAAD,EAAgD;IAC9D;IAD8D;IAAA;IAE9D,KAAKC,OAAL,GAAeF,MAAf;IACA,KAAKC,MAAL,GAAcA,MAAd;EACH;;EAEME,SAAS,CAACC,MAAD,EAA8B;IAC1C,IAAI,CAAC,KAAKH,MAAV,EAAkB;MACd,OAAO,IAAP;IACH;;IACD,OAAO,KAAKA,MAAL,CAAYG,MAAZ,CAAP;EACH;;EAEMJ,MAAM,CAAgCI,MAAhC,EAAgF;IACzF,OAAO,KAAKF,OAAL,CAAaE,MAAb,CAAP;EACH;;AArB2C;;;8BAAnCP,mB,UACqB,gB"}
|
package/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ClientContext } from "./types";
|
|
2
|
-
|
|
2
|
+
export * from "./HandlerClientPlugin";
|
|
3
|
+
export declare const createHandlerClient: () => {
|
|
3
4
|
type: string;
|
|
4
|
-
|
|
5
|
+
name: string;
|
|
6
|
+
apply(context: ClientContext): Promise<void>;
|
|
5
7
|
};
|
|
6
|
-
export default _default;
|
package/index.js
CHANGED
|
@@ -5,17 +5,35 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
|
|
8
|
+
var _exportNames = {
|
|
9
|
+
createHandlerClient: true
|
|
10
|
+
};
|
|
11
|
+
exports.createHandlerClient = void 0;
|
|
9
12
|
|
|
10
13
|
var _HandlerClient = _interopRequireDefault(require("./HandlerClient"));
|
|
11
14
|
|
|
12
|
-
var
|
|
15
|
+
var _HandlerClientPlugin = require("./HandlerClientPlugin");
|
|
16
|
+
|
|
17
|
+
Object.keys(_HandlerClientPlugin).forEach(function (key) {
|
|
18
|
+
if (key === "default" || key === "__esModule") return;
|
|
19
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
20
|
+
if (key in exports && exports[key] === _HandlerClientPlugin[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _HandlerClientPlugin[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const createHandlerClient = () => ({
|
|
13
30
|
type: "context",
|
|
31
|
+
name: "handler-client.context",
|
|
14
32
|
|
|
15
|
-
apply(context) {
|
|
33
|
+
async apply(context) {
|
|
16
34
|
context.handlerClient = new _HandlerClient.default(context);
|
|
17
35
|
}
|
|
18
36
|
|
|
19
37
|
});
|
|
20
38
|
|
|
21
|
-
exports.
|
|
39
|
+
exports.createHandlerClient = createHandlerClient;
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["type","apply","context","handlerClient","HandlerClient"],"sources":["index.ts"],"sourcesContent":["import HandlerClient from \"./HandlerClient\";\nimport { ClientContext } from \"~/types\";\n\nexport
|
|
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,SADgC;EAEtCC,IAAI,EAAE,wBAFgC;;EAGtC,MAAMC,KAAN,CAAYC,OAAZ,EAAoC;IAChCA,OAAO,CAACC,aAAR,GAAwB,IAAIC,sBAAJ,CAAkBF,OAAlB,CAAxB;EACH;;AALqC,CAAP,CAA5B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/handler-client",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.31.0-beta.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,18 +14,18 @@
|
|
|
14
14
|
],
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@babel/runtime": "7.18.
|
|
18
|
-
"@webiny/
|
|
19
|
-
"@webiny/
|
|
20
|
-
"@webiny/plugins": "5.
|
|
17
|
+
"@babel/runtime": "7.18.9",
|
|
18
|
+
"@webiny/api": "5.31.0-beta.0",
|
|
19
|
+
"@webiny/error": "5.31.0-beta.0",
|
|
20
|
+
"@webiny/plugins": "5.31.0-beta.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@babel/cli": "^7.16.0",
|
|
24
24
|
"@babel/core": "^7.16.0",
|
|
25
25
|
"@babel/preset-env": "^7.16.4",
|
|
26
26
|
"@babel/preset-typescript": "^7.16.0",
|
|
27
|
-
"@webiny/cli": "^5.
|
|
28
|
-
"@webiny/project-utils": "^5.
|
|
27
|
+
"@webiny/cli": "^5.31.0-beta.0",
|
|
28
|
+
"@webiny/project-utils": "^5.31.0-beta.0",
|
|
29
29
|
"babel-plugin-lodash": "^3.3.4",
|
|
30
30
|
"jest": "^28.1.0",
|
|
31
31
|
"merge": "^1.2.1",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"build": "yarn webiny run build",
|
|
41
41
|
"watch": "yarn webiny run watch"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "dea7c56325ff140ef0e2d761f3e65708d46d401e"
|
|
44
44
|
}
|
package/types.d.ts
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import HandlerClient from "./HandlerClient";
|
|
2
2
|
import { Plugin } from "@webiny/plugins/types";
|
|
3
|
-
import { Context } from "@webiny/
|
|
3
|
+
import { Context } from "@webiny/api/types";
|
|
4
4
|
export declare type InvokeArgs<TInvokeArgsPayload = any> = {
|
|
5
5
|
name: string;
|
|
6
6
|
payload?: TInvokeArgsPayload;
|
|
7
7
|
await?: boolean;
|
|
8
|
-
|
|
9
|
-
export declare type HandlerClientPlugin = Plugin & {
|
|
10
|
-
type: "handler-client";
|
|
11
|
-
name: "handler-client";
|
|
12
|
-
invoke: <TInvokeArgsPayload = Record<string, any>>(params: InvokeArgs<TInvokeArgsPayload>) => any;
|
|
8
|
+
description?: string;
|
|
13
9
|
};
|
|
14
10
|
export declare type HandlerClientHandlerPlugin = Plugin & {
|
|
15
11
|
type: "handler-client-handler";
|
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/
|
|
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":""}
|