@webiny/api-websockets 6.0.0-beta.0 → 6.0.0-rc.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/README.md +10 -9
- package/context/WebsocketsContext.d.ts +10 -8
- package/context/WebsocketsContext.js +44 -33
- package/context/WebsocketsContext.js.map +1 -1
- package/context/abstractions/IWebsocketsContext.d.ts +12 -11
- package/context/abstractions/IWebsocketsContext.js +1 -5
- package/context/abstractions/IWebsocketsContext.js.map +1 -1
- package/context/index.d.ts +2 -3
- package/context/index.js +11 -42
- package/context/index.js.map +1 -1
- package/features/WebsocketService/abstractions.d.ts +9 -0
- package/features/WebsocketService/abstractions.js +4 -0
- package/features/WebsocketService/abstractions.js.map +1 -0
- package/features/WebsocketService/errors.d.ts +19 -0
- package/features/WebsocketService/errors.js +36 -0
- package/features/WebsocketService/errors.js.map +1 -0
- package/features/WebsocketService/index.d.ts +1 -0
- package/features/WebsocketService/index.js +3 -0
- package/features/WebsocketService/index.js.map +1 -0
- package/graphql/checkPermissions.d.ts +1 -1
- package/graphql/checkPermissions.js +6 -11
- package/graphql/checkPermissions.js.map +1 -1
- package/graphql/createResolvers.d.ts +2 -3
- package/graphql/createResolvers.js +41 -32
- package/graphql/createResolvers.js.map +1 -1
- package/graphql/createTypeDefs.js +2 -11
- package/graphql/createTypeDefs.js.map +1 -1
- package/graphql/index.d.ts +1 -1
- package/graphql/index.js +7 -14
- package/graphql/index.js.map +1 -1
- package/graphql/utils.js +5 -13
- package/graphql/utils.js.map +1 -1
- package/handler/handler.d.ts +1 -1
- package/handler/handler.js +45 -48
- package/handler/handler.js.map +1 -1
- package/handler/headers.d.ts +1 -2
- package/handler/headers.js +1 -13
- package/handler/headers.js.map +1 -1
- package/handler/register.js +5 -7
- package/handler/register.js.map +1 -1
- package/handler/types.d.ts +6 -9
- package/handler/types.js +2 -8
- package/handler/types.js.map +1 -1
- package/index.d.ts +9 -9
- package/index.js +11 -98
- package/index.js.map +1 -1
- package/package.json +28 -36
- package/plugins/WebsocketsActionPlugin.d.ts +3 -3
- package/plugins/WebsocketsActionPlugin.js +3 -11
- package/plugins/WebsocketsActionPlugin.js.map +1 -1
- package/plugins/WebsocketsRoutePlugin.d.ts +6 -7
- package/plugins/WebsocketsRoutePlugin.js +3 -11
- package/plugins/WebsocketsRoutePlugin.js.map +1 -1
- package/plugins/abstrations/IWebsocketsActionPlugin.d.ts +3 -4
- package/plugins/abstrations/IWebsocketsActionPlugin.js +1 -5
- package/plugins/abstrations/IWebsocketsActionPlugin.js.map +1 -1
- package/plugins/index.d.ts +3 -3
- package/plugins/index.js +2 -38
- package/plugins/index.js.map +1 -1
- package/registry/WebsocketsConnectionRegistry.d.ts +3 -3
- package/registry/WebsocketsConnectionRegistry.js +34 -59
- package/registry/WebsocketsConnectionRegistry.js.map +1 -1
- package/registry/abstractions/IWebsocketsConnectionRegistry.d.ts +2 -4
- package/registry/abstractions/IWebsocketsConnectionRegistry.js +1 -5
- package/registry/abstractions/IWebsocketsConnectionRegistry.js.map +1 -1
- package/registry/entity.d.ts +3 -108
- package/registry/entity.js +18 -33
- package/registry/entity.js.map +1 -1
- package/registry/index.d.ts +2 -2
- package/registry/index.js +1 -27
- package/registry/index.js.map +1 -1
- package/response/WebsocketsResponse.d.ts +1 -1
- package/response/WebsocketsResponse.js +1 -8
- package/response/WebsocketsResponse.js.map +1 -1
- package/response/abstractions/IWebsocketsResponse.d.ts +1 -1
- package/response/abstractions/IWebsocketsResponse.js +1 -5
- package/response/abstractions/IWebsocketsResponse.js.map +1 -1
- package/response/index.d.ts +2 -2
- package/response/index.js +1 -27
- package/response/index.js.map +1 -1
- package/runner/WebsocketsRunner.d.ts +6 -6
- package/runner/WebsocketsRunner.js +10 -23
- package/runner/WebsocketsRunner.js.map +1 -1
- package/runner/abstractions/IWebsocketsRunner.d.ts +2 -2
- package/runner/abstractions/IWebsocketsRunner.js +1 -5
- package/runner/abstractions/IWebsocketsRunner.js.map +1 -1
- package/runner/index.d.ts +2 -2
- package/runner/index.js +1 -27
- package/runner/index.js.map +1 -1
- package/runner/routes/connect.d.ts +1 -1
- package/runner/routes/connect.js +9 -19
- package/runner/routes/connect.js.map +1 -1
- package/runner/routes/default.d.ts +1 -1
- package/runner/routes/default.js +4 -17
- package/runner/routes/default.js.map +1 -1
- package/runner/routes/disconnect.d.ts +1 -1
- package/runner/routes/disconnect.js +4 -11
- package/runner/routes/disconnect.js.map +1 -1
- package/runner/routes/index.d.ts +1 -1
- package/runner/routes/index.js +5 -12
- package/runner/routes/index.js.map +1 -1
- package/transport/WebsocketsTransport.d.ts +2 -2
- package/transport/WebsocketsTransport.js +5 -12
- package/transport/WebsocketsTransport.js.map +1 -1
- package/transport/abstractions/IWebsocketsTransport.d.ts +4 -4
- package/transport/abstractions/IWebsocketsTransport.js +1 -5
- package/transport/abstractions/IWebsocketsTransport.js.map +1 -1
- package/transport/index.d.ts +2 -2
- package/transport/index.js +1 -27
- package/transport/index.js.map +1 -1
- package/types.d.ts +5 -5
- package/types.js +1 -5
- package/types.js.map +1 -1
- package/utils/middleware.d.ts +2 -2
- package/utils/middleware.js +1 -8
- package/utils/middleware.js.map +1 -1
- package/validator/WebsocketsEventValidator.d.ts +2 -2
- package/validator/WebsocketsEventValidator.js +25 -34
- package/validator/WebsocketsEventValidator.js.map +1 -1
- package/validator/abstractions/IWebsocketsEventValidator.d.ts +2 -2
- package/validator/abstractions/IWebsocketsEventValidator.js +1 -5
- package/validator/abstractions/IWebsocketsEventValidator.js.map +1 -1
- package/validator/index.d.ts +2 -2
- package/validator/index.js +1 -27
- package/validator/index.js.map +1 -1
package/handler/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["WebsocketsEventRoute","
|
|
1
|
+
{"version":3,"names":["WebsocketsEventRoute","WebsocketsEventRequestContextEventType"],"sources":["types.ts"],"sourcesContent":["import type { HandlerFactoryParams } from \"@webiny/handler-aws/types.js\";\nimport type { IWebsocketsEventValidator } from \"~/validator/index.js\";\nimport type { IWebsocketsResponse } from \"~/response/index.js\";\nimport type {\n APIGatewayProxyResult,\n Context as LambdaContext\n} from \"@webiny/aws-sdk/types/index.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport type { PartialDeep } from \"type-fest\";\n\nexport interface HandlerCallable {\n (event: IWebsocketsIncomingEvent, context: LambdaContext): Promise<APIGatewayProxyResult>;\n}\n\nexport interface HandlerParams extends HandlerFactoryParams {\n validator?: IWebsocketsEventValidator;\n response?: IWebsocketsResponse;\n}\n\nexport enum WebsocketsEventRoute {\n \"connect\" = \"$connect\",\n \"disconnect\" = \"$disconnect\",\n \"default\" = \"$default\"\n}\n\nexport interface IWebsocketsEventData {\n token?: string;\n tenant?: string;\n messageId?: string;\n action?: string;\n data?: GenericRecord;\n}\n\nexport enum WebsocketsEventRequestContextEventType {\n \"message\" = \"MESSAGE\",\n \"connect\" = \"CONNECT\",\n \"disconnect\" = \"DISCONNECT\"\n}\n\nexport interface IWebsocketsEventRequestContext {\n connectionId: string;\n connectedAt: number;\n domainName: string;\n eventType: WebsocketsEventRequestContextEventType;\n routeKey: WebsocketsEventRoute | string;\n stage: string;\n}\n\nexport interface IWebsocketsEventHeaders {\n \"Accept-Encoding\"?: string;\n \"Accept-Language\"?: string;\n \"Cache-Control\"?: string;\n Host?: string;\n Origin?: string;\n Pragma?: string;\n \"Sec-WebSocket-Extensions\"?: string;\n \"Sec-WebSocket-Key\"?: string;\n \"Sec-WebSocket-Version\"?: string;\n \"Sec-WebSocket-Protocol\"?: string;\n \"User-Agent\"?: string;\n \"X-Amzn-Trace-Id\"?: string;\n \"X-Forwarded-For\"?: string;\n \"X-Forwarded-Port\"?: `${number}`;\n \"X-Forwarded-Proto\"?: \"https\" | \"http\";\n [\"x-tenant\"]?: string;\n [\"x-webiny-cms-endpoint\"]?: string;\n}\n\nexport interface IWebsocketsEventQueryStringParameters {\n tenant?: string;\n token?: string;\n}\n\nexport interface IWebsocketsEvent<T extends IWebsocketsEventData = IWebsocketsEventData> {\n headers?: IWebsocketsEventHeaders;\n queryStringParameters?: IWebsocketsEventQueryStringParameters;\n requestContext: IWebsocketsEventRequestContext;\n body?: T;\n}\n\nexport interface IWebsocketsIncomingEvent extends PartialDeep<Omit<IWebsocketsEvent, \"body\">> {\n body?: string | GenericRecord;\n}\n"],"mappings":"AAmBA,WAAYA,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAchC,WAAYC,sCAAsC,0BAAtCA,sCAAsC;EAAtCA,sCAAsC;EAAtCA,sCAAsC;EAAtCA,sCAAsC;EAAA,OAAtCA,sCAAsC;AAAA","ignoreList":[]}
|
package/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import "./handler/register";
|
|
2
|
-
import { Plugin } from "@webiny/plugins/types";
|
|
1
|
+
import "./handler/register.js";
|
|
2
|
+
import type { Plugin } from "@webiny/plugins/types.js";
|
|
3
3
|
export declare const createWebsockets: () => Plugin[];
|
|
4
|
-
export * from "./validator";
|
|
5
|
-
export * from "./transport";
|
|
6
|
-
export * from "./runner";
|
|
7
|
-
export * from "./registry";
|
|
8
|
-
export * from "./context";
|
|
9
|
-
export * from "./plugins";
|
|
10
|
-
export * from "./types";
|
|
4
|
+
export * from "./validator/index.js";
|
|
5
|
+
export * from "./transport/index.js";
|
|
6
|
+
export * from "./runner/index.js";
|
|
7
|
+
export * from "./registry/index.js";
|
|
8
|
+
export * from "./context/index.js";
|
|
9
|
+
export * from "./plugins/index.js";
|
|
10
|
+
export type * from "./types.js";
|
package/index.js
CHANGED
|
@@ -1,101 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _exportNames = {
|
|
7
|
-
createWebsockets: true
|
|
8
|
-
};
|
|
9
|
-
exports.createWebsockets = void 0;
|
|
10
|
-
require("./handler/register");
|
|
11
|
-
var _context = require("./context");
|
|
12
|
-
Object.keys(_context).forEach(function (key) {
|
|
13
|
-
if (key === "default" || key === "__esModule") return;
|
|
14
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
15
|
-
if (key in exports && exports[key] === _context[key]) return;
|
|
16
|
-
Object.defineProperty(exports, key, {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function () {
|
|
19
|
-
return _context[key];
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
var _graphql = require("./graphql");
|
|
24
|
-
var _validator = require("./validator");
|
|
25
|
-
Object.keys(_validator).forEach(function (key) {
|
|
26
|
-
if (key === "default" || key === "__esModule") return;
|
|
27
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
28
|
-
if (key in exports && exports[key] === _validator[key]) return;
|
|
29
|
-
Object.defineProperty(exports, key, {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
get: function () {
|
|
32
|
-
return _validator[key];
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
var _transport = require("./transport");
|
|
37
|
-
Object.keys(_transport).forEach(function (key) {
|
|
38
|
-
if (key === "default" || key === "__esModule") return;
|
|
39
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
40
|
-
if (key in exports && exports[key] === _transport[key]) return;
|
|
41
|
-
Object.defineProperty(exports, key, {
|
|
42
|
-
enumerable: true,
|
|
43
|
-
get: function () {
|
|
44
|
-
return _transport[key];
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
var _runner = require("./runner");
|
|
49
|
-
Object.keys(_runner).forEach(function (key) {
|
|
50
|
-
if (key === "default" || key === "__esModule") return;
|
|
51
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
52
|
-
if (key in exports && exports[key] === _runner[key]) return;
|
|
53
|
-
Object.defineProperty(exports, key, {
|
|
54
|
-
enumerable: true,
|
|
55
|
-
get: function () {
|
|
56
|
-
return _runner[key];
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
var _registry = require("./registry");
|
|
61
|
-
Object.keys(_registry).forEach(function (key) {
|
|
62
|
-
if (key === "default" || key === "__esModule") return;
|
|
63
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
64
|
-
if (key in exports && exports[key] === _registry[key]) return;
|
|
65
|
-
Object.defineProperty(exports, key, {
|
|
66
|
-
enumerable: true,
|
|
67
|
-
get: function () {
|
|
68
|
-
return _registry[key];
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
var _plugins = require("./plugins");
|
|
73
|
-
Object.keys(_plugins).forEach(function (key) {
|
|
74
|
-
if (key === "default" || key === "__esModule") return;
|
|
75
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
76
|
-
if (key in exports && exports[key] === _plugins[key]) return;
|
|
77
|
-
Object.defineProperty(exports, key, {
|
|
78
|
-
enumerable: true,
|
|
79
|
-
get: function () {
|
|
80
|
-
return _plugins[key];
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
var _types = require("./types");
|
|
85
|
-
Object.keys(_types).forEach(function (key) {
|
|
86
|
-
if (key === "default" || key === "__esModule") return;
|
|
87
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
88
|
-
if (key in exports && exports[key] === _types[key]) return;
|
|
89
|
-
Object.defineProperty(exports, key, {
|
|
90
|
-
enumerable: true,
|
|
91
|
-
get: function () {
|
|
92
|
-
return _types[key];
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
const createWebsockets = () => {
|
|
97
|
-
return [(0, _context.createWebsocketsContext)(), (0, _graphql.createWebsocketsGraphQL)()];
|
|
1
|
+
import "./handler/register.js";
|
|
2
|
+
import { createWebsocketsContext } from "./context/index.js";
|
|
3
|
+
import { createWebsocketsGraphQL } from "./graphql/index.js";
|
|
4
|
+
export const createWebsockets = () => {
|
|
5
|
+
return [createWebsocketsContext(), createWebsocketsGraphQL()];
|
|
98
6
|
};
|
|
99
|
-
|
|
7
|
+
export * from "./validator/index.js";
|
|
8
|
+
export * from "./transport/index.js";
|
|
9
|
+
export * from "./runner/index.js";
|
|
10
|
+
export * from "./registry/index.js";
|
|
11
|
+
export * from "./context/index.js";
|
|
12
|
+
export * from "./plugins/index.js";
|
|
100
13
|
|
|
101
14
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["createWebsocketsContext","createWebsocketsGraphQL","createWebsockets"],"sources":["index.ts"],"sourcesContent":["import \"./handler/register.js\";\nimport type { Plugin } from \"@webiny/plugins/types.js\";\nimport { createWebsocketsContext } from \"~/context/index.js\";\nimport { createWebsocketsGraphQL } from \"~/graphql/index.js\";\n\nexport const createWebsockets = (): Plugin[] => {\n return [createWebsocketsContext(), createWebsocketsGraphQL()];\n};\n\nexport * from \"./validator/index.js\";\nexport * from \"./transport/index.js\";\nexport * from \"./runner/index.js\";\nexport * from \"./registry/index.js\";\nexport * from \"./context/index.js\";\n\nexport * from \"./plugins/index.js\";\nexport type * from \"./types.js\";\n"],"mappings":"AAAA;AAEA,SAASA,uBAAuB;AAChC,SAASC,uBAAuB;AAEhC,OAAO,MAAMC,gBAAgB,GAAGA,CAAA,KAAgB;EAC5C,OAAO,CAACF,uBAAuB,CAAC,CAAC,EAAEC,uBAAuB,CAAC,CAAC,CAAC;AACjE,CAAC;AAED;AACA;AACA;AACA;AACA;AAEA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-websockets",
|
|
3
|
-
"version": "6.0.0-
|
|
3
|
+
"version": "6.0.0-rc.0",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"main": "index.js",
|
|
5
6
|
"repository": {
|
|
6
7
|
"type": "git",
|
|
@@ -10,48 +11,39 @@
|
|
|
10
11
|
"contributors": [
|
|
11
12
|
"Bruno Zorić <bruno@webiny.com>"
|
|
12
13
|
],
|
|
14
|
+
"exports": {
|
|
15
|
+
"./*": "./*",
|
|
16
|
+
".": "./index.js"
|
|
17
|
+
},
|
|
13
18
|
"license": "MIT",
|
|
14
19
|
"dependencies": {
|
|
15
|
-
"@
|
|
16
|
-
"@webiny/api": "6.0.0-
|
|
17
|
-
"@webiny/
|
|
18
|
-
"@webiny/
|
|
19
|
-
"@webiny/
|
|
20
|
-
"@webiny/
|
|
21
|
-
"@webiny/
|
|
22
|
-
"@webiny/
|
|
23
|
-
"@webiny/
|
|
24
|
-
"@webiny/
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"type-fest": "2.19.0",
|
|
28
|
-
"zod": "3.22.4"
|
|
20
|
+
"@webiny/api": "6.0.0-rc.0",
|
|
21
|
+
"@webiny/api-core": "6.0.0-rc.0",
|
|
22
|
+
"@webiny/aws-sdk": "6.0.0-rc.0",
|
|
23
|
+
"@webiny/db-dynamodb": "6.0.0-rc.0",
|
|
24
|
+
"@webiny/error": "6.0.0-rc.0",
|
|
25
|
+
"@webiny/feature": "6.0.0-rc.0",
|
|
26
|
+
"@webiny/handler": "6.0.0-rc.0",
|
|
27
|
+
"@webiny/handler-aws": "6.0.0-rc.0",
|
|
28
|
+
"@webiny/plugins": "6.0.0-rc.0",
|
|
29
|
+
"@webiny/utils": "6.0.0-rc.0",
|
|
30
|
+
"type-fest": "5.4.4",
|
|
31
|
+
"zod": "3.25.76"
|
|
29
32
|
},
|
|
30
33
|
"devDependencies": {
|
|
31
|
-
"@
|
|
32
|
-
"@
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"@webiny/handler-graphql": "6.0.0-beta.0",
|
|
41
|
-
"@webiny/project-utils": "6.0.0-beta.0",
|
|
42
|
-
"aws-lambda": "1.0.7",
|
|
43
|
-
"graphql": "15.8.0",
|
|
44
|
-
"rimraf": "5.0.5",
|
|
45
|
-
"ttypescript": "1.5.15",
|
|
46
|
-
"typescript": "4.7.4"
|
|
34
|
+
"@webiny/api-headless-cms": "6.0.0-rc.0",
|
|
35
|
+
"@webiny/build-tools": "6.0.0-rc.0",
|
|
36
|
+
"@webiny/handler-db": "6.0.0-rc.0",
|
|
37
|
+
"@webiny/handler-graphql": "6.0.0-rc.0",
|
|
38
|
+
"@webiny/project-utils": "6.0.0-rc.0",
|
|
39
|
+
"graphql": "16.12.0",
|
|
40
|
+
"rimraf": "6.1.3",
|
|
41
|
+
"typescript": "5.9.3",
|
|
42
|
+
"vitest": "4.0.18"
|
|
47
43
|
},
|
|
48
44
|
"publishConfig": {
|
|
49
45
|
"access": "public",
|
|
50
46
|
"directory": "dist"
|
|
51
47
|
},
|
|
52
|
-
"
|
|
53
|
-
"build": "yarn webiny run build",
|
|
54
|
-
"watch": "yarn webiny run watch"
|
|
55
|
-
},
|
|
56
|
-
"gitHead": "aa8dbfbbd5ad13ec271adba6f2431e02991a300f"
|
|
48
|
+
"gitHead": "0f2aa699f4642e550ab62c96fcd050e8d02345c9"
|
|
57
49
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Plugin } from "@webiny/plugins";
|
|
2
|
-
import { GenericRecord } from "@webiny/api/types";
|
|
3
|
-
import { IWebsocketsActionPluginCallable, IWebsocketsActionPluginCallableParams, WebsocketsActionPluginCallableResponse } from "./abstrations/IWebsocketsActionPlugin";
|
|
2
|
+
import type { GenericRecord } from "@webiny/api/types.js";
|
|
3
|
+
import type { IWebsocketsActionPluginCallable, IWebsocketsActionPluginCallableParams, WebsocketsActionPluginCallableResponse } from "./abstrations/IWebsocketsActionPlugin.js";
|
|
4
4
|
export declare class WebsocketsActionPlugin<T extends GenericRecord = GenericRecord> extends Plugin {
|
|
5
5
|
static readonly type: string;
|
|
6
6
|
readonly action: string;
|
|
@@ -8,4 +8,4 @@ export declare class WebsocketsActionPlugin<T extends GenericRecord = GenericRec
|
|
|
8
8
|
constructor(action: string, cb: IWebsocketsActionPluginCallable<T>);
|
|
9
9
|
run(params: IWebsocketsActionPluginCallableParams): Promise<WebsocketsActionPluginCallableResponse<T>>;
|
|
10
10
|
}
|
|
11
|
-
export declare const createWebsocketsAction: <T extends GenericRecord
|
|
11
|
+
export declare const createWebsocketsAction: <T extends GenericRecord = GenericRecord>(action: string, cb: IWebsocketsActionPluginCallable<T>) => WebsocketsActionPlugin<T>;
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createWebsocketsAction = exports.WebsocketsActionPlugin = void 0;
|
|
7
|
-
var _plugins = require("@webiny/plugins");
|
|
8
|
-
class WebsocketsActionPlugin extends _plugins.Plugin {
|
|
1
|
+
import { Plugin } from "@webiny/plugins";
|
|
2
|
+
export class WebsocketsActionPlugin extends Plugin {
|
|
9
3
|
static type = "websockets.route.action";
|
|
10
4
|
constructor(action, cb) {
|
|
11
5
|
super();
|
|
@@ -16,10 +10,8 @@ class WebsocketsActionPlugin extends _plugins.Plugin {
|
|
|
16
10
|
return this.cb(params);
|
|
17
11
|
}
|
|
18
12
|
}
|
|
19
|
-
|
|
20
|
-
const createWebsocketsAction = (action, cb) => {
|
|
13
|
+
export const createWebsocketsAction = (action, cb) => {
|
|
21
14
|
return new WebsocketsActionPlugin(action, cb);
|
|
22
15
|
};
|
|
23
|
-
exports.createWebsocketsAction = createWebsocketsAction;
|
|
24
16
|
|
|
25
17
|
//# sourceMappingURL=WebsocketsActionPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["Plugin","WebsocketsActionPlugin","type","constructor","action","cb","run","params","createWebsocketsAction"],"sources":["WebsocketsActionPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport type {\n IWebsocketsActionPluginCallable,\n IWebsocketsActionPluginCallableParams,\n WebsocketsActionPluginCallableResponse\n} from \"./abstrations/IWebsocketsActionPlugin.js\";\n\nexport class WebsocketsActionPlugin<T extends GenericRecord = GenericRecord> extends Plugin {\n public static override readonly type: string = \"websockets.route.action\";\n\n public readonly action: string;\n private readonly cb: IWebsocketsActionPluginCallable<T>;\n\n public constructor(action: string, cb: IWebsocketsActionPluginCallable<T>) {\n super();\n this.action = action;\n this.cb = cb;\n }\n\n public run(\n params: IWebsocketsActionPluginCallableParams\n ): Promise<WebsocketsActionPluginCallableResponse<T>> {\n return this.cb(params);\n }\n}\n\nexport const createWebsocketsAction = <T extends GenericRecord = GenericRecord>(\n action: string,\n cb: IWebsocketsActionPluginCallable<T>\n) => {\n return new WebsocketsActionPlugin<T>(action, cb);\n};\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,iBAAiB;AAQxC,OAAO,MAAMC,sBAAsB,SAAkDD,MAAM,CAAC;EACxF,OAAgCE,IAAI,GAAW,yBAAyB;EAKjEC,WAAWA,CAACC,MAAc,EAAEC,EAAsC,EAAE;IACvE,KAAK,CAAC,CAAC;IACP,IAAI,CAACD,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACC,EAAE,GAAGA,EAAE;EAChB;EAEOC,GAAGA,CACNC,MAA6C,EACK;IAClD,OAAO,IAAI,CAACF,EAAE,CAACE,MAAM,CAAC;EAC1B;AACJ;AAEA,OAAO,MAAMC,sBAAsB,GAAGA,CAClCJ,MAAc,EACdC,EAAsC,KACrC;EACD,OAAO,IAAIJ,sBAAsB,CAAIG,MAAM,EAAEC,EAAE,CAAC;AACpD,CAAC","ignoreList":[]}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { Plugin } from "@webiny/plugins";
|
|
2
|
-
import { IWebsocketsEvent, IWebsocketsEventData, WebsocketsEventRoute } from "../handler/types";
|
|
3
|
-
import { Context } from "../types";
|
|
4
|
-
import { IWebsocketsRunnerResponse } from "../runner";
|
|
5
|
-
import { IWebsocketsConnectionRegistry } from "../registry";
|
|
6
|
-
import { IWebsocketsResponse } from "../response/abstractions/IWebsocketsResponse";
|
|
7
|
-
import { IWebsocketsIdentity } from "../context";
|
|
2
|
+
import type { IWebsocketsEvent, IWebsocketsEventData, WebsocketsEventRoute } from "../handler/types.js";
|
|
3
|
+
import type { Context } from "../types.js";
|
|
4
|
+
import type { IWebsocketsRunnerResponse } from "../runner/index.js";
|
|
5
|
+
import type { IWebsocketsConnectionRegistry } from "../registry/index.js";
|
|
6
|
+
import type { IWebsocketsResponse } from "../response/abstractions/IWebsocketsResponse.js";
|
|
7
|
+
import type { IWebsocketsIdentity } from "../context/index.js";
|
|
8
8
|
export interface IWebsocketsRoutePluginCallableParams<C extends Context = Context, R extends IWebsocketsRunnerResponse = IWebsocketsRunnerResponse, T extends IWebsocketsEventData = IWebsocketsEventData> {
|
|
9
9
|
event: IWebsocketsEvent<T>;
|
|
10
10
|
registry: IWebsocketsConnectionRegistry;
|
|
11
11
|
context: C;
|
|
12
12
|
response: IWebsocketsResponse;
|
|
13
13
|
getTenant: () => string | null;
|
|
14
|
-
getLocale: () => string | null;
|
|
15
14
|
getIdentity: () => IWebsocketsIdentity | null;
|
|
16
15
|
next: () => Promise<R>;
|
|
17
16
|
}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createWebsocketsRoutePlugin = exports.WebsocketsRoutePlugin = void 0;
|
|
7
|
-
var _plugins = require("@webiny/plugins");
|
|
8
|
-
class WebsocketsRoutePlugin extends _plugins.Plugin {
|
|
1
|
+
import { Plugin } from "@webiny/plugins";
|
|
2
|
+
export class WebsocketsRoutePlugin extends Plugin {
|
|
9
3
|
static type = "websockets.route";
|
|
10
4
|
constructor(route, cb) {
|
|
11
5
|
super();
|
|
@@ -16,10 +10,8 @@ class WebsocketsRoutePlugin extends _plugins.Plugin {
|
|
|
16
10
|
return this.cb(params);
|
|
17
11
|
}
|
|
18
12
|
}
|
|
19
|
-
|
|
20
|
-
const createWebsocketsRoutePlugin = (route, cb) => {
|
|
13
|
+
export const createWebsocketsRoutePlugin = (route, cb) => {
|
|
21
14
|
return new WebsocketsRoutePlugin(route, cb);
|
|
22
15
|
};
|
|
23
|
-
exports.createWebsocketsRoutePlugin = createWebsocketsRoutePlugin;
|
|
24
16
|
|
|
25
17
|
//# sourceMappingURL=WebsocketsRoutePlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["Plugin","WebsocketsRoutePlugin","type","constructor","route","cb","run","params","createWebsocketsRoutePlugin"],"sources":["WebsocketsRoutePlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type {\n IWebsocketsEvent,\n IWebsocketsEventData,\n WebsocketsEventRoute\n} from \"~/handler/types.js\";\nimport type { Context } from \"~/types.js\";\nimport type { IWebsocketsRunnerResponse } from \"~/runner/index.js\";\nimport type { IWebsocketsConnectionRegistry } from \"~/registry/index.js\";\nimport type { IWebsocketsResponse } from \"~/response/abstractions/IWebsocketsResponse.js\";\nimport type { IWebsocketsIdentity } from \"~/context/index.js\";\n\nexport interface IWebsocketsRoutePluginCallableParams<\n C extends Context = Context,\n R extends IWebsocketsRunnerResponse = IWebsocketsRunnerResponse,\n T extends IWebsocketsEventData = IWebsocketsEventData\n> {\n event: IWebsocketsEvent<T>;\n registry: IWebsocketsConnectionRegistry;\n context: C;\n response: IWebsocketsResponse;\n getTenant: () => string | null;\n getIdentity: () => IWebsocketsIdentity | null;\n next: () => Promise<R>;\n}\n\nexport interface IWebsocketsRoutePluginCallable<\n C extends Context = Context,\n R extends IWebsocketsRunnerResponse = IWebsocketsRunnerResponse,\n T extends IWebsocketsEventData = IWebsocketsEventData\n> {\n (params: IWebsocketsRoutePluginCallableParams<C, R, T>): Promise<R>;\n}\n\nexport class WebsocketsRoutePlugin<\n C extends Context = Context,\n R extends IWebsocketsRunnerResponse = IWebsocketsRunnerResponse,\n T extends IWebsocketsEventData = IWebsocketsEventData\n> extends Plugin {\n public static override readonly type: string = \"websockets.route\";\n\n public readonly route: WebsocketsEventRoute | string;\n private readonly cb: IWebsocketsRoutePluginCallable<C, R, T>;\n\n public constructor(\n route: WebsocketsEventRoute | string,\n cb: IWebsocketsRoutePluginCallable<C, R, T>\n ) {\n super();\n this.route = route;\n this.cb = cb;\n }\n\n public async run(params: IWebsocketsRoutePluginCallableParams<C, R, T>): Promise<R> {\n return this.cb(params);\n }\n}\n\nexport const createWebsocketsRoutePlugin = <\n C extends Context = Context,\n R extends IWebsocketsRunnerResponse = IWebsocketsRunnerResponse,\n T extends IWebsocketsEventData = IWebsocketsEventData\n>(\n route: WebsocketsEventRoute | string,\n cb: IWebsocketsRoutePluginCallable<C, R, T>\n) => {\n return new WebsocketsRoutePlugin<C, R, T>(route, cb);\n};\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,iBAAiB;AAkCxC,OAAO,MAAMC,qBAAqB,SAIxBD,MAAM,CAAC;EACb,OAAgCE,IAAI,GAAW,kBAAkB;EAK1DC,WAAWA,CACdC,KAAoC,EACpCC,EAA2C,EAC7C;IACE,KAAK,CAAC,CAAC;IACP,IAAI,CAACD,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACC,EAAE,GAAGA,EAAE;EAChB;EAEA,MAAaC,GAAGA,CAACC,MAAqD,EAAc;IAChF,OAAO,IAAI,CAACF,EAAE,CAACE,MAAM,CAAC;EAC1B;AACJ;AAEA,OAAO,MAAMC,2BAA2B,GAAGA,CAKvCJ,KAAoC,EACpCC,EAA2C,KAC1C;EACD,OAAO,IAAIJ,qBAAqB,CAAUG,KAAK,EAAEC,EAAE,CAAC;AACxD,CAAC","ignoreList":[]}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { GenericRecord } from "@webiny/api/types";
|
|
2
|
-
import { Context } from "../../types";
|
|
1
|
+
import type { GenericRecord } from "@webiny/api/types.js";
|
|
2
|
+
import type { Context } from "../../types.js";
|
|
3
3
|
export interface IWebsocketsActionPluginCallableParamsSend {
|
|
4
4
|
toConnection<T extends GenericRecord = GenericRecord>(connectionId: string, data: T): Promise<void>;
|
|
5
5
|
toTenant<T extends GenericRecord = GenericRecord>(tenant: string, data: T): Promise<void>;
|
|
6
|
-
toTenantAndLocale<T extends GenericRecord = GenericRecord>(tenant: string, locale: string, data: T): Promise<void>;
|
|
7
6
|
toIdentity<T extends GenericRecord = GenericRecord>(identity: string, data: T): Promise<void>;
|
|
8
7
|
}
|
|
9
8
|
export interface IWebsocketsActionPluginCallableParamsRespondError<T extends GenericRecord = GenericRecord> {
|
|
@@ -29,7 +28,7 @@ export interface IWebsocketsActionPluginCallableParams<C extends Context = Conte
|
|
|
29
28
|
send: IWebsocketsActionPluginCallableParamsSend;
|
|
30
29
|
respond: IWebsocketsActionPluginCallableParamsRespond;
|
|
31
30
|
}
|
|
32
|
-
export
|
|
31
|
+
export type WebsocketsActionPluginCallableResponse<T extends GenericRecord = GenericRecord> = IWebsocketsActionPluginCallableParamsRespondOkResponse<T> | IWebsocketsActionPluginCallableParamsRespondErrorResponse<T>;
|
|
33
32
|
export interface IWebsocketsActionPluginCallable<T extends GenericRecord = GenericRecord> {
|
|
34
33
|
(params: IWebsocketsActionPluginCallableParams): Promise<WebsocketsActionPluginCallableResponse<T>>;
|
|
35
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["IWebsocketsActionPlugin.ts"],"sourcesContent":["import { GenericRecord } from \"@webiny/api/types\";\nimport { Context } from \"~/types\";\n\nexport interface IWebsocketsActionPluginCallableParamsSend {\n toConnection<T extends GenericRecord = GenericRecord>(\n connectionId: string,\n data: T\n ): Promise<void>;\n toTenant<T extends GenericRecord = GenericRecord>(tenant: string, data: T): Promise<void>;\n
|
|
1
|
+
{"version":3,"names":[],"sources":["IWebsocketsActionPlugin.ts"],"sourcesContent":["import type { GenericRecord } from \"@webiny/api/types.js\";\nimport type { Context } from \"~/types.js\";\n\nexport interface IWebsocketsActionPluginCallableParamsSend {\n toConnection<T extends GenericRecord = GenericRecord>(\n connectionId: string,\n data: T\n ): Promise<void>;\n toTenant<T extends GenericRecord = GenericRecord>(tenant: string, data: T): Promise<void>;\n toIdentity<T extends GenericRecord = GenericRecord>(identity: string, data: T): Promise<void>;\n}\n\nexport interface IWebsocketsActionPluginCallableParamsRespondError<\n T extends GenericRecord = GenericRecord\n> {\n message: string;\n code: string;\n data: T;\n}\n\nexport interface IWebsocketsActionPluginCallableParamsRespondOkResponse<\n T extends GenericRecord = GenericRecord\n> {\n data: T;\n error?: never;\n}\n\nexport interface IWebsocketsActionPluginCallableParamsRespondErrorResponse<\n T extends GenericRecord = GenericRecord\n> {\n error: IWebsocketsActionPluginCallableParamsRespondError<T>;\n data?: never;\n}\n\nexport interface IWebsocketsActionPluginCallableParamsRespond {\n ok<T extends GenericRecord = GenericRecord>(\n data: T\n ): Promise<IWebsocketsActionPluginCallableParamsRespondOkResponse<T>>;\n error<T extends GenericRecord = GenericRecord>(\n error: IWebsocketsActionPluginCallableParamsRespondError<T>\n ): Promise<IWebsocketsActionPluginCallableParamsRespondErrorResponse<T>>;\n}\n\nexport interface IWebsocketsActionPluginCallableParams<C extends Context = Context> {\n context: C;\n next(): Promise<void>;\n send: IWebsocketsActionPluginCallableParamsSend;\n respond: IWebsocketsActionPluginCallableParamsRespond;\n}\n\nexport type WebsocketsActionPluginCallableResponse<T extends GenericRecord = GenericRecord> =\n | IWebsocketsActionPluginCallableParamsRespondOkResponse<T>\n | IWebsocketsActionPluginCallableParamsRespondErrorResponse<T>;\n\nexport interface IWebsocketsActionPluginCallable<T extends GenericRecord = GenericRecord> {\n (\n params: IWebsocketsActionPluginCallableParams\n ): Promise<WebsocketsActionPluginCallableResponse<T>>;\n}\n"],"mappings":"","ignoreList":[]}
|
package/plugins/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./WebsocketsRoutePlugin";
|
|
2
|
-
export * from "./WebsocketsActionPlugin";
|
|
3
|
-
export * from "./abstrations/IWebsocketsActionPlugin";
|
|
1
|
+
export * from "./WebsocketsRoutePlugin.js";
|
|
2
|
+
export * from "./WebsocketsActionPlugin.js";
|
|
3
|
+
export type * from "./abstrations/IWebsocketsActionPlugin.js";
|
package/plugins/index.js
CHANGED
|
@@ -1,40 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _WebsocketsRoutePlugin = require("./WebsocketsRoutePlugin");
|
|
7
|
-
Object.keys(_WebsocketsRoutePlugin).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _WebsocketsRoutePlugin[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _WebsocketsRoutePlugin[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _WebsocketsActionPlugin = require("./WebsocketsActionPlugin");
|
|
18
|
-
Object.keys(_WebsocketsActionPlugin).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _WebsocketsActionPlugin[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _WebsocketsActionPlugin[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
var _IWebsocketsActionPlugin = require("./abstrations/IWebsocketsActionPlugin");
|
|
29
|
-
Object.keys(_IWebsocketsActionPlugin).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] === _IWebsocketsActionPlugin[key]) return;
|
|
32
|
-
Object.defineProperty(exports, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return _IWebsocketsActionPlugin[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
1
|
+
export * from "./WebsocketsRoutePlugin.js";
|
|
2
|
+
export * from "./WebsocketsActionPlugin.js";
|
|
39
3
|
|
|
40
4
|
//# sourceMappingURL=index.js.map
|
package/plugins/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./WebsocketsRoutePlugin.js\";\nexport * from \"./WebsocketsActionPlugin.js\";\nexport type * from \"./abstrations/IWebsocketsActionPlugin.js\";\n"],"mappings":"AAAA;AACA","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IWebsocketsConnectionRegistry, IWebsocketsConnectionRegistryData, IWebsocketsConnectionRegistryRegisterParams, IWebsocketsConnectionRegistryUnregisterParams } from "./abstractions/IWebsocketsConnectionRegistry";
|
|
2
|
-
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
|
|
1
|
+
import type { IWebsocketsConnectionRegistry, IWebsocketsConnectionRegistryData, IWebsocketsConnectionRegistryRegisterParams, IWebsocketsConnectionRegistryUnregisterParams } from "./abstractions/IWebsocketsConnectionRegistry.js";
|
|
2
|
+
import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb/index.js";
|
|
3
3
|
export declare class WebsocketsConnectionRegistry implements IWebsocketsConnectionRegistry {
|
|
4
4
|
private readonly entity;
|
|
5
5
|
constructor(documentClient: DynamoDBDocument);
|
|
@@ -17,7 +17,7 @@ export declare class WebsocketsConnectionRegistry implements IWebsocketsConnecti
|
|
|
17
17
|
/**
|
|
18
18
|
* Uses GSI2 keys
|
|
19
19
|
*/
|
|
20
|
-
listViaTenant(tenant: string
|
|
20
|
+
listViaTenant(tenant: string): Promise<IWebsocketsConnectionRegistryData[]>;
|
|
21
21
|
listAll(): Promise<IWebsocketsConnectionRegistryData[]>;
|
|
22
22
|
private store;
|
|
23
23
|
}
|