@webiny/api-websockets 6.0.0-beta.0 → 6.0.0-rc.1
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/transport/index.js
CHANGED
|
@@ -1,29 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _WebsocketsTransport = require("./WebsocketsTransport");
|
|
7
|
-
Object.keys(_WebsocketsTransport).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _WebsocketsTransport[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _WebsocketsTransport[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _IWebsocketsTransport = require("./abstractions/IWebsocketsTransport");
|
|
18
|
-
Object.keys(_IWebsocketsTransport).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _IWebsocketsTransport[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _IWebsocketsTransport[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
1
|
+
export * from "./WebsocketsTransport.js";
|
|
28
2
|
|
|
29
3
|
//# sourceMappingURL=index.js.map
|
package/transport/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./WebsocketsTransport.js\";\nexport type * from \"./abstractions/IWebsocketsTransport.js\";\n"],"mappings":"AAAA","ignoreList":[]}
|
package/types.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { DbContext } from "@webiny/handler-db/types";
|
|
2
|
-
import { IWebsocketsContextObject } from "./context/abstractions/IWebsocketsContext";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import type { DbContext } from "@webiny/handler-db/types.js";
|
|
2
|
+
import type { IWebsocketsContextObject } from "./context/abstractions/IWebsocketsContext.js";
|
|
3
|
+
import type { ApiCoreContext } from "@webiny/api-core/types/core.js";
|
|
4
|
+
import type { SecurityPermission } from "@webiny/api-core/types/security.js";
|
|
5
5
|
export type { IWebsocketsContextObject };
|
|
6
|
-
export interface Context extends DbContext,
|
|
6
|
+
export interface Context extends DbContext, ApiCoreContext {
|
|
7
7
|
websockets: IWebsocketsContextObject;
|
|
8
8
|
}
|
|
9
9
|
export interface WebsocketsPermission extends SecurityPermission {
|
package/types.js
CHANGED
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import { DbContext } from \"@webiny/handler-db/types\";\nimport { IWebsocketsContextObject } from \"./context/abstractions/IWebsocketsContext\";\nimport {
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { DbContext } from \"@webiny/handler-db/types.js\";\nimport type { IWebsocketsContextObject } from \"./context/abstractions/IWebsocketsContext.js\";\nimport type { ApiCoreContext } from \"@webiny/api-core/types/core.js\";\nimport type { SecurityPermission } from \"@webiny/api-core/types/security.js\";\n\nexport type { IWebsocketsContextObject };\n\nexport interface Context extends DbContext, ApiCoreContext {\n websockets: IWebsocketsContextObject;\n}\n\nexport interface WebsocketsPermission extends SecurityPermission {\n name: \"websockets\";\n rwd?: string;\n}\n"],"mappings":"","ignoreList":[]}
|
package/utils/middleware.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GenericRecord } from "@webiny/api/types";
|
|
1
|
+
import type { GenericRecord } from "@webiny/api/types.js";
|
|
2
2
|
export interface MiddlewareCallable<I extends GenericRecord = GenericRecord, O extends GenericRecord = GenericRecord> {
|
|
3
3
|
(input: I, next: () => Promise<O>): Promise<O>;
|
|
4
4
|
}
|
|
5
|
-
export declare const middleware: <I extends GenericRecord
|
|
5
|
+
export declare const middleware: <I extends GenericRecord = GenericRecord, O extends GenericRecord = GenericRecord>(functions: MiddlewareCallable<I, O>[]) => (input: I) => Promise<O>;
|
package/utils/middleware.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.middleware = void 0;
|
|
7
|
-
const middleware = functions => {
|
|
1
|
+
export const middleware = functions => {
|
|
8
2
|
return async input => {
|
|
9
3
|
const chain = Array.from(functions);
|
|
10
4
|
const exec = async () => {
|
|
@@ -20,6 +14,5 @@ const middleware = functions => {
|
|
|
20
14
|
return exec();
|
|
21
15
|
};
|
|
22
16
|
};
|
|
23
|
-
exports.middleware = middleware;
|
|
24
17
|
|
|
25
18
|
//# sourceMappingURL=middleware.js.map
|
package/utils/middleware.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["middleware","functions","input","chain","Array","from","exec","fn","shift","next"
|
|
1
|
+
{"version":3,"names":["middleware","functions","input","chain","Array","from","exec","fn","shift","next"],"sources":["middleware.ts"],"sourcesContent":["import type { GenericRecord } from \"@webiny/api/types.js\";\n\nexport interface MiddlewareCallable<\n I extends GenericRecord = GenericRecord,\n O extends GenericRecord = GenericRecord\n> {\n (input: I, next: () => Promise<O>): Promise<O>;\n}\n\nexport const middleware = <\n I extends GenericRecord = GenericRecord,\n O extends GenericRecord = GenericRecord\n>(\n functions: MiddlewareCallable<I, O>[]\n) => {\n return async (input: I): Promise<O> => {\n const chain = Array.from(functions);\n const exec = async (): Promise<O> => {\n const fn = chain.shift();\n if (!fn) {\n return {} as O;\n }\n const next = async () => {\n return exec();\n };\n return fn(input, next);\n };\n return exec();\n };\n};\n"],"mappings":"AASA,OAAO,MAAMA,UAAU,GAInBC,SAAqC,IACpC;EACD,OAAO,MAAOC,KAAQ,IAAiB;IACnC,MAAMC,KAAK,GAAGC,KAAK,CAACC,IAAI,CAACJ,SAAS,CAAC;IACnC,MAAMK,IAAI,GAAG,MAAAA,CAAA,KAAwB;MACjC,MAAMC,EAAE,GAAGJ,KAAK,CAACK,KAAK,CAAC,CAAC;MACxB,IAAI,CAACD,EAAE,EAAE;QACL,OAAO,CAAC,CAAC;MACb;MACA,MAAME,IAAI,GAAG,MAAAA,CAAA,KAAY;QACrB,OAAOH,IAAI,CAAC,CAAC;MACjB,CAAC;MACD,OAAOC,EAAE,CAACL,KAAK,EAAEO,IAAI,CAAC;IAC1B,CAAC;IACD,OAAOH,IAAI,CAAC,CAAC;EACjB,CAAC;AACL,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IWebsocketsEvent, IWebsocketsEventData } from "../handler/types";
|
|
2
|
-
import { IWebsocketsEventValidator, IWebsocketsEventValidatorValidateParams } from "./abstractions/IWebsocketsEventValidator";
|
|
1
|
+
import type { IWebsocketsEvent, IWebsocketsEventData } from "../handler/types.js";
|
|
2
|
+
import type { IWebsocketsEventValidator, IWebsocketsEventValidatorValidateParams } from "./abstractions/IWebsocketsEventValidator.js";
|
|
3
3
|
export declare class WebsocketsEventValidator implements IWebsocketsEventValidator {
|
|
4
4
|
validate<T extends IWebsocketsEventData = IWebsocketsEventData>(input: IWebsocketsEventValidatorValidateParams): Promise<IWebsocketsEvent<T>>;
|
|
5
5
|
}
|
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
requestContext: _zod.default.object({
|
|
14
|
-
connectionId: _zod.default.string(),
|
|
15
|
-
stage: _zod.default.string(),
|
|
16
|
-
connectedAt: _zod.default.number(),
|
|
17
|
-
domainName: _zod.default.string(),
|
|
18
|
-
eventType: _zod.default.enum([_types.WebsocketsEventRequestContextEventType.connect, _types.WebsocketsEventRequestContextEventType.message, _types.WebsocketsEventRequestContextEventType.disconnect]),
|
|
19
|
-
routeKey: _zod.default.string()
|
|
1
|
+
import zod from "zod";
|
|
2
|
+
import { WebsocketsEventRequestContextEventType } from "../handler/types.js";
|
|
3
|
+
import { createZodError } from "@webiny/utils";
|
|
4
|
+
const validation = zod.object({
|
|
5
|
+
headers: zod.object({}).passthrough().optional(),
|
|
6
|
+
requestContext: zod.object({
|
|
7
|
+
connectionId: zod.string(),
|
|
8
|
+
stage: zod.string(),
|
|
9
|
+
connectedAt: zod.number(),
|
|
10
|
+
domainName: zod.string(),
|
|
11
|
+
eventType: zod.enum([WebsocketsEventRequestContextEventType.connect, WebsocketsEventRequestContextEventType.message, WebsocketsEventRequestContextEventType.disconnect]),
|
|
12
|
+
routeKey: zod.string()
|
|
20
13
|
}),
|
|
21
|
-
body:
|
|
14
|
+
body: zod.string().transform((value, context) => {
|
|
22
15
|
if (!value) {
|
|
23
16
|
return undefined;
|
|
24
17
|
}
|
|
@@ -36,13 +29,13 @@ const validation = _zod.default.object({
|
|
|
36
29
|
context.addIssue({
|
|
37
30
|
path: [],
|
|
38
31
|
message: `Invalid JSON: ${ex.message}`,
|
|
39
|
-
code:
|
|
32
|
+
code: zod.ZodIssueCode.custom,
|
|
40
33
|
fatal: true
|
|
41
34
|
});
|
|
42
35
|
}
|
|
43
36
|
}).optional()
|
|
44
37
|
}).superRefine((output, context) => {
|
|
45
|
-
if (output.requestContext.eventType !==
|
|
38
|
+
if (output.requestContext.eventType !== WebsocketsEventRequestContextEventType.message) {
|
|
46
39
|
return;
|
|
47
40
|
} else if (output.body) {
|
|
48
41
|
return;
|
|
@@ -50,27 +43,26 @@ const validation = _zod.default.object({
|
|
|
50
43
|
context.addIssue({
|
|
51
44
|
path: ["body"],
|
|
52
45
|
message: "There must be a body defined when having a message event.",
|
|
53
|
-
code:
|
|
46
|
+
code: zod.ZodIssueCode.custom,
|
|
54
47
|
fatal: true
|
|
55
48
|
});
|
|
56
49
|
});
|
|
57
|
-
const bodyValidation =
|
|
58
|
-
token:
|
|
59
|
-
tenant:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
data: _zod.default.object({}).passthrough().nullish()
|
|
50
|
+
const bodyValidation = zod.object({
|
|
51
|
+
token: zod.string(),
|
|
52
|
+
tenant: zod.string(),
|
|
53
|
+
messageId: zod.string().nullish(),
|
|
54
|
+
action: zod.string(),
|
|
55
|
+
data: zod.object({}).passthrough().nullish()
|
|
64
56
|
}).passthrough().optional();
|
|
65
|
-
class WebsocketsEventValidator {
|
|
57
|
+
export class WebsocketsEventValidator {
|
|
66
58
|
async validate(input) {
|
|
67
59
|
const result = await validation.safeParseAsync(input);
|
|
68
60
|
if (!result.success) {
|
|
69
|
-
throw
|
|
61
|
+
throw createZodError(result.error);
|
|
70
62
|
}
|
|
71
63
|
const bodyResult = await bodyValidation.safeParseAsync(result.data.body);
|
|
72
64
|
if (!bodyResult.success) {
|
|
73
|
-
throw
|
|
65
|
+
throw createZodError(bodyResult.error);
|
|
74
66
|
}
|
|
75
67
|
return {
|
|
76
68
|
...result.data,
|
|
@@ -80,6 +72,5 @@ class WebsocketsEventValidator {
|
|
|
80
72
|
};
|
|
81
73
|
}
|
|
82
74
|
}
|
|
83
|
-
exports.WebsocketsEventValidator = WebsocketsEventValidator;
|
|
84
75
|
|
|
85
76
|
//# sourceMappingURL=WebsocketsEventValidator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["zod","WebsocketsEventRequestContextEventType","createZodError","validation","object","headers","passthrough","optional","requestContext","connectionId","string","stage","connectedAt","number","domainName","eventType","enum","connect","message","disconnect","routeKey","body","transform","value","context","undefined","JSON","parse","ex","console","error","log","addIssue","path","code","ZodIssueCode","custom","fatal","superRefine","output","bodyValidation","token","tenant","messageId","nullish","action","data","WebsocketsEventValidator","validate","input","result","safeParseAsync","success","bodyResult"],"sources":["WebsocketsEventValidator.ts"],"sourcesContent":["import zod from \"zod\";\nimport type { IWebsocketsEvent, IWebsocketsEventData } from \"~/handler/types.js\";\nimport { WebsocketsEventRequestContextEventType } from \"~/handler/types.js\";\nimport type {\n IWebsocketsEventValidator,\n IWebsocketsEventValidatorValidateParams\n} from \"./abstractions/IWebsocketsEventValidator.js\";\nimport { createZodError } from \"@webiny/utils\";\n\nconst validation = zod\n .object({\n headers: zod.object({}).passthrough().optional(),\n requestContext: zod.object({\n connectionId: zod.string(),\n stage: zod.string(),\n connectedAt: zod.number(),\n domainName: zod.string(),\n eventType: zod.enum([\n WebsocketsEventRequestContextEventType.connect,\n WebsocketsEventRequestContextEventType.message,\n WebsocketsEventRequestContextEventType.disconnect\n ]),\n routeKey: zod.string()\n }),\n body: zod\n .string()\n .transform<IWebsocketsEventData>((value, context) => {\n if (!value) {\n return undefined;\n }\n try {\n return JSON.parse(value);\n } catch (ex) {\n /**\n * We want to log the error, for easier debugging.\n */\n console.error(`Failed body validation: ${ex.message}`);\n console.log(`Body: ${value}`);\n /**\n * And we want to add an issue to the context, so that the user knows what went wrong.\n */\n context.addIssue({\n path: [],\n message: `Invalid JSON: ${ex.message}`,\n code: zod.ZodIssueCode.custom,\n fatal: true\n });\n }\n })\n .optional()\n })\n .superRefine((output, context) => {\n if (output.requestContext.eventType !== WebsocketsEventRequestContextEventType.message) {\n return;\n } else if (output.body) {\n return;\n }\n context.addIssue({\n path: [\"body\"],\n message: \"There must be a body defined when having a message event.\",\n code: zod.ZodIssueCode.custom,\n fatal: true\n });\n });\n\nconst bodyValidation = zod\n .object({\n token: zod.string(),\n tenant: zod.string(),\n messageId: zod.string().nullish(),\n action: zod.string(),\n data: zod.object({}).passthrough().nullish()\n })\n .passthrough()\n .optional();\n\nexport class WebsocketsEventValidator implements IWebsocketsEventValidator {\n public async validate<T extends IWebsocketsEventData = IWebsocketsEventData>(\n input: IWebsocketsEventValidatorValidateParams\n ): Promise<IWebsocketsEvent<T>> {\n const result = await validation.safeParseAsync(input);\n if (!result.success) {\n throw createZodError(result.error);\n }\n const bodyResult = await bodyValidation.safeParseAsync(result.data.body);\n if (!bodyResult.success) {\n throw createZodError(bodyResult.error);\n }\n return {\n ...result.data,\n body: {\n ...((bodyResult.data || {}) as T)\n }\n };\n }\n}\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,KAAK;AAErB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;IACA,MAAMuB,UAAU,GAAG,MAAMb,cAAc,CAACW,cAAc,CAACD,MAAM,CAACJ,IAAI,CAACzB,IAAI,CAAC;IACxE,IAAI,CAACgC,UAAU,CAACD,OAAO,EAAE;MACrB,MAAMlD,cAAc,CAACmD,UAAU,CAACvB,KAAK,CAAC;IAC1C;IACA,OAAO;MACH,GAAGoB,MAAM,CAACJ,IAAI;MACdzB,IAAI,EAAE;QACF,IAAKgC,UAAU,CAACP,IAAI,IAAI,CAAC,CAAC;MAC9B;IACJ,CAAC;EACL;AACJ","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IWebsocketsEvent, IWebsocketsEventData, IWebsocketsIncomingEvent } from "../../handler/types";
|
|
2
|
-
export
|
|
1
|
+
import type { IWebsocketsEvent, IWebsocketsEventData, IWebsocketsIncomingEvent } from "../../handler/types.js";
|
|
2
|
+
export type IWebsocketsEventValidatorValidateParams = IWebsocketsIncomingEvent;
|
|
3
3
|
export interface IWebsocketsEventValidator {
|
|
4
4
|
/**
|
|
5
5
|
* @throws {Error}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["IWebsocketsEventValidator.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"names":[],"sources":["IWebsocketsEventValidator.ts"],"sourcesContent":["import type {\n IWebsocketsEvent,\n IWebsocketsEventData,\n IWebsocketsIncomingEvent\n} from \"~/handler/types.js\";\n\nexport type IWebsocketsEventValidatorValidateParams = IWebsocketsIncomingEvent;\n\nexport interface IWebsocketsEventValidator {\n /**\n * @throws {Error}\n */\n validate<T extends IWebsocketsEventData = IWebsocketsEventData>(\n params: IWebsocketsEventValidatorValidateParams\n ): Promise<IWebsocketsEvent<T>>;\n}\n"],"mappings":"","ignoreList":[]}
|
package/validator/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./abstractions/IWebsocketsEventValidator";
|
|
2
|
-
export * from "./WebsocketsEventValidator";
|
|
1
|
+
export type * from "./abstractions/IWebsocketsEventValidator.js";
|
|
2
|
+
export * from "./WebsocketsEventValidator.js";
|
package/validator/index.js
CHANGED
|
@@ -1,29 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _IWebsocketsEventValidator = require("./abstractions/IWebsocketsEventValidator");
|
|
7
|
-
Object.keys(_IWebsocketsEventValidator).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _IWebsocketsEventValidator[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _IWebsocketsEventValidator[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _WebsocketsEventValidator = require("./WebsocketsEventValidator");
|
|
18
|
-
Object.keys(_WebsocketsEventValidator).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _WebsocketsEventValidator[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _WebsocketsEventValidator[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
1
|
+
export * from "./WebsocketsEventValidator.js";
|
|
28
2
|
|
|
29
3
|
//# sourceMappingURL=index.js.map
|
package/validator/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export type * from \"./abstractions/IWebsocketsEventValidator.js\";\nexport * from \"./WebsocketsEventValidator.js\";\n"],"mappings":"AACA","ignoreList":[]}
|