@webiny/handler 5.23.0 → 5.24.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/createHandler.d.ts +2 -1
- package/createHandler.js +2 -2
- package/package.json +5 -5
- package/plugins/Context.d.ts +2 -1
- package/plugins/Context.js +7 -3
- package/types.d.ts +1 -1
package/createHandler.d.ts
CHANGED
package/createHandler.js
CHANGED
|
@@ -7,12 +7,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
+
var _middleware = _interopRequireDefault(require("./middleware"));
|
|
11
|
+
|
|
10
12
|
var _HandlerPlugin = require("./plugins/HandlerPlugin");
|
|
11
13
|
|
|
12
14
|
var _ContextPlugin = require("./plugins/ContextPlugin");
|
|
13
15
|
|
|
14
|
-
var _middleware = _interopRequireDefault(require("./middleware"));
|
|
15
|
-
|
|
16
16
|
var _BeforeHandlerPlugin = require("./plugins/BeforeHandlerPlugin");
|
|
17
17
|
|
|
18
18
|
var _Context = require("./plugins/Context");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/handler",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.24.0-beta.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "7.16.7",
|
|
18
|
-
"@webiny/plugins": "5.
|
|
18
|
+
"@webiny/plugins": "5.24.0-beta.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@babel/cli": "^7.16.0",
|
|
22
22
|
"@babel/core": "^7.16.0",
|
|
23
23
|
"@babel/preset-env": "^7.16.4",
|
|
24
|
-
"@webiny/cli": "^5.
|
|
25
|
-
"@webiny/project-utils": "^5.
|
|
24
|
+
"@webiny/cli": "^5.24.0-beta.0",
|
|
25
|
+
"@webiny/project-utils": "^5.24.0-beta.0",
|
|
26
26
|
"rimraf": "^3.0.2",
|
|
27
27
|
"ttypescript": "^1.5.13",
|
|
28
28
|
"typescript": "^4.1.3"
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"build": "yarn webiny run build",
|
|
36
36
|
"watch": "yarn webiny run watch"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "05b90b92bbaf2ef3adf275d008c4641580cf5f42"
|
|
39
39
|
}
|
package/plugins/Context.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Context as ContextInterface, HandlerArgs } from "../types";
|
|
2
2
|
import { PluginsContainer } from "@webiny/plugins";
|
|
3
|
+
import { PluginCollection } from "@webiny/plugins/types";
|
|
3
4
|
export interface ContextParams {
|
|
4
5
|
args?: HandlerArgs;
|
|
5
|
-
plugins?:
|
|
6
|
+
plugins?: PluginCollection;
|
|
6
7
|
WEBINY_VERSION: string;
|
|
7
8
|
}
|
|
8
9
|
export declare class Context implements ContextInterface {
|
package/plugins/Context.js
CHANGED
|
@@ -47,10 +47,12 @@ class Context {
|
|
|
47
47
|
* We go only through the first level properties
|
|
48
48
|
*/
|
|
49
49
|
|
|
50
|
-
for (const
|
|
50
|
+
for (const key in initialTargets) {
|
|
51
|
+
const target = initialTargets[key];
|
|
51
52
|
/**
|
|
52
53
|
* If property already exists, there is no need to wait for it, so we just continue the loop.
|
|
53
54
|
*/
|
|
55
|
+
|
|
54
56
|
if (this[target]) {
|
|
55
57
|
continue;
|
|
56
58
|
}
|
|
@@ -67,7 +69,8 @@ class Context {
|
|
|
67
69
|
* And that is why we add __ around the property name.
|
|
68
70
|
*/
|
|
69
71
|
set: value => {
|
|
70
|
-
|
|
72
|
+
const newTargetKey = `__${target}__`;
|
|
73
|
+
this[newTargetKey] = value;
|
|
71
74
|
/**
|
|
72
75
|
* WWhen the property is set, we will go through all the waiters and, if any of them include currently set property, act on it.
|
|
73
76
|
*/
|
|
@@ -103,7 +106,8 @@ class Context {
|
|
|
103
106
|
* As we have set property with __ around it, we must get it as well.
|
|
104
107
|
*/
|
|
105
108
|
get: () => {
|
|
106
|
-
|
|
109
|
+
const newTargetKey = `__${target}__`;
|
|
110
|
+
return this[newTargetKey];
|
|
107
111
|
},
|
|
108
112
|
configurable: false
|
|
109
113
|
});
|
package/types.d.ts
CHANGED
|
@@ -59,7 +59,7 @@ export declare type ContextPlugin<C0 = Context, C1 = Context, C2 = Context, C3 =
|
|
|
59
59
|
*/
|
|
60
60
|
export declare type HandlerPlugin<C0 = Context, C1 = Context, C2 = Context, C3 = Context, C4 = Context, C5 = Context, C6 = Context, C7 = Context, C8 = Context, C9 = Context> = Plugin & {
|
|
61
61
|
type: "handler";
|
|
62
|
-
handle(context: C0 & C1 & C2 & C3 & C4 & C5 & C6 & C7 & C8 & C9, next:
|
|
62
|
+
handle(context: C0 & C1 & C2 & C3 & C4 & C5 & C6 & C7 & C8 & C9, next: () => Promise<void>): any;
|
|
63
63
|
};
|
|
64
64
|
/**
|
|
65
65
|
* Left for backwards-compatibility.
|