@webiny/api-websockets 6.0.0-alpha.5 → 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.
Files changed (125) hide show
  1. package/README.md +10 -9
  2. package/context/WebsocketsContext.d.ts +10 -8
  3. package/context/WebsocketsContext.js +44 -33
  4. package/context/WebsocketsContext.js.map +1 -1
  5. package/context/abstractions/IWebsocketsContext.d.ts +10 -9
  6. package/context/abstractions/IWebsocketsContext.js +1 -5
  7. package/context/abstractions/IWebsocketsContext.js.map +1 -1
  8. package/context/index.d.ts +2 -3
  9. package/context/index.js +11 -42
  10. package/context/index.js.map +1 -1
  11. package/features/WebsocketService/abstractions.d.ts +9 -0
  12. package/features/WebsocketService/abstractions.js +4 -0
  13. package/features/WebsocketService/abstractions.js.map +1 -0
  14. package/features/WebsocketService/errors.d.ts +19 -0
  15. package/features/WebsocketService/errors.js +36 -0
  16. package/features/WebsocketService/errors.js.map +1 -0
  17. package/features/WebsocketService/index.d.ts +1 -0
  18. package/features/WebsocketService/index.js +3 -0
  19. package/features/WebsocketService/index.js.map +1 -0
  20. package/graphql/checkPermissions.d.ts +1 -1
  21. package/graphql/checkPermissions.js +6 -11
  22. package/graphql/checkPermissions.js.map +1 -1
  23. package/graphql/createResolvers.d.ts +2 -3
  24. package/graphql/createResolvers.js +41 -29
  25. package/graphql/createResolvers.js.map +1 -1
  26. package/graphql/createTypeDefs.js +2 -11
  27. package/graphql/createTypeDefs.js.map +1 -1
  28. package/graphql/index.d.ts +1 -1
  29. package/graphql/index.js +7 -14
  30. package/graphql/index.js.map +1 -1
  31. package/graphql/utils.js +5 -13
  32. package/graphql/utils.js.map +1 -1
  33. package/handler/handler.d.ts +1 -1
  34. package/handler/handler.js +45 -48
  35. package/handler/handler.js.map +1 -1
  36. package/handler/headers.d.ts +1 -2
  37. package/handler/headers.js +1 -13
  38. package/handler/headers.js.map +1 -1
  39. package/handler/register.js +5 -7
  40. package/handler/register.js.map +1 -1
  41. package/handler/types.d.ts +5 -8
  42. package/handler/types.js +2 -8
  43. package/handler/types.js.map +1 -1
  44. package/index.d.ts +9 -9
  45. package/index.js +11 -98
  46. package/index.js.map +1 -1
  47. package/package.json +28 -27
  48. package/plugins/WebsocketsActionPlugin.d.ts +2 -2
  49. package/plugins/WebsocketsActionPlugin.js +3 -11
  50. package/plugins/WebsocketsActionPlugin.js.map +1 -1
  51. package/plugins/WebsocketsRoutePlugin.d.ts +6 -7
  52. package/plugins/WebsocketsRoutePlugin.js +3 -11
  53. package/plugins/WebsocketsRoutePlugin.js.map +1 -1
  54. package/plugins/abstrations/IWebsocketsActionPlugin.d.ts +2 -3
  55. package/plugins/abstrations/IWebsocketsActionPlugin.js +1 -5
  56. package/plugins/abstrations/IWebsocketsActionPlugin.js.map +1 -1
  57. package/plugins/index.d.ts +3 -3
  58. package/plugins/index.js +2 -38
  59. package/plugins/index.js.map +1 -1
  60. package/registry/WebsocketsConnectionRegistry.d.ts +3 -3
  61. package/registry/WebsocketsConnectionRegistry.js +34 -59
  62. package/registry/WebsocketsConnectionRegistry.js.map +1 -1
  63. package/registry/abstractions/IWebsocketsConnectionRegistry.d.ts +2 -4
  64. package/registry/abstractions/IWebsocketsConnectionRegistry.js +1 -5
  65. package/registry/abstractions/IWebsocketsConnectionRegistry.js.map +1 -1
  66. package/registry/entity.d.ts +3 -108
  67. package/registry/entity.js +18 -33
  68. package/registry/entity.js.map +1 -1
  69. package/registry/index.d.ts +2 -2
  70. package/registry/index.js +1 -27
  71. package/registry/index.js.map +1 -1
  72. package/response/WebsocketsResponse.d.ts +1 -1
  73. package/response/WebsocketsResponse.js +1 -8
  74. package/response/WebsocketsResponse.js.map +1 -1
  75. package/response/abstractions/IWebsocketsResponse.d.ts +1 -1
  76. package/response/abstractions/IWebsocketsResponse.js +1 -5
  77. package/response/abstractions/IWebsocketsResponse.js.map +1 -1
  78. package/response/index.d.ts +2 -2
  79. package/response/index.js +1 -27
  80. package/response/index.js.map +1 -1
  81. package/runner/WebsocketsRunner.d.ts +6 -6
  82. package/runner/WebsocketsRunner.js +10 -23
  83. package/runner/WebsocketsRunner.js.map +1 -1
  84. package/runner/abstractions/IWebsocketsRunner.d.ts +2 -2
  85. package/runner/abstractions/IWebsocketsRunner.js +1 -5
  86. package/runner/abstractions/IWebsocketsRunner.js.map +1 -1
  87. package/runner/index.d.ts +2 -2
  88. package/runner/index.js +1 -27
  89. package/runner/index.js.map +1 -1
  90. package/runner/routes/connect.d.ts +1 -1
  91. package/runner/routes/connect.js +9 -19
  92. package/runner/routes/connect.js.map +1 -1
  93. package/runner/routes/default.d.ts +1 -1
  94. package/runner/routes/default.js +4 -17
  95. package/runner/routes/default.js.map +1 -1
  96. package/runner/routes/disconnect.d.ts +1 -1
  97. package/runner/routes/disconnect.js +4 -11
  98. package/runner/routes/disconnect.js.map +1 -1
  99. package/runner/routes/index.d.ts +1 -1
  100. package/runner/routes/index.js +5 -12
  101. package/runner/routes/index.js.map +1 -1
  102. package/transport/WebsocketsTransport.d.ts +2 -2
  103. package/transport/WebsocketsTransport.js +5 -12
  104. package/transport/WebsocketsTransport.js.map +1 -1
  105. package/transport/abstractions/IWebsocketsTransport.d.ts +2 -2
  106. package/transport/abstractions/IWebsocketsTransport.js +1 -5
  107. package/transport/abstractions/IWebsocketsTransport.js.map +1 -1
  108. package/transport/index.d.ts +2 -2
  109. package/transport/index.js +1 -27
  110. package/transport/index.js.map +1 -1
  111. package/types.d.ts +5 -5
  112. package/types.js +1 -5
  113. package/types.js.map +1 -1
  114. package/utils/middleware.d.ts +1 -1
  115. package/utils/middleware.js +1 -8
  116. package/utils/middleware.js.map +1 -1
  117. package/validator/WebsocketsEventValidator.d.ts +2 -2
  118. package/validator/WebsocketsEventValidator.js +25 -34
  119. package/validator/WebsocketsEventValidator.js.map +1 -1
  120. package/validator/abstractions/IWebsocketsEventValidator.d.ts +1 -1
  121. package/validator/abstractions/IWebsocketsEventValidator.js +1 -5
  122. package/validator/abstractions/IWebsocketsEventValidator.js.map +1 -1
  123. package/validator/index.d.ts +2 -2
  124. package/validator/index.js +1 -27
  125. package/validator/index.js.map +1 -1
package/index.js CHANGED
@@ -1,101 +1,14 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
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
- exports.createWebsockets = createWebsockets;
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":["require","_context","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_graphql","_validator","_transport","_runner","_registry","_plugins","_types","createWebsockets","createWebsocketsContext","createWebsocketsGraphQL"],"sources":["index.ts"],"sourcesContent":["import \"./handler/register\";\nimport type { Plugin } from \"@webiny/plugins/types\";\nimport { createWebsocketsContext } from \"~/context\";\nimport { createWebsocketsGraphQL } from \"~/graphql\";\n\nexport const createWebsockets = (): Plugin[] => {\n return [createWebsocketsContext(), createWebsocketsGraphQL()];\n};\n\nexport * from \"./validator\";\nexport * from \"./transport\";\nexport * from \"./runner\";\nexport * from \"./registry\";\nexport * from \"./context\";\n\nexport * from \"./plugins\";\nexport * from \"./types\";\n"],"mappings":"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","ignoreList":[]}
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-alpha.5",
3
+ "version": "6.0.0-rc.0",
4
+ "type": "module",
4
5
  "main": "index.js",
5
6
  "repository": {
6
7
  "type": "git",
@@ -10,39 +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
- "@webiny/api": "6.0.0-alpha.5",
16
- "@webiny/api-i18n": "6.0.0-alpha.5",
17
- "@webiny/api-security": "6.0.0-alpha.5",
18
- "@webiny/api-tenancy": "6.0.0-alpha.5",
19
- "@webiny/aws-sdk": "6.0.0-alpha.5",
20
- "@webiny/db-dynamodb": "6.0.0-alpha.5",
21
- "@webiny/error": "6.0.0-alpha.5",
22
- "@webiny/handler": "6.0.0-alpha.5",
23
- "@webiny/handler-aws": "6.0.0-alpha.5",
24
- "@webiny/plugins": "6.0.0-alpha.5",
25
- "@webiny/utils": "6.0.0-alpha.5",
26
- "type-fest": "4.14.0",
27
- "zod": "3.23.8"
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"
28
32
  },
29
33
  "devDependencies": {
30
- "@webiny/api-headless-cms": "6.0.0-alpha.5",
31
- "@webiny/api-wcp": "6.0.0-alpha.5",
32
- "@webiny/handler-db": "6.0.0-alpha.5",
33
- "@webiny/handler-graphql": "6.0.0-alpha.5",
34
- "@webiny/project-utils": "6.0.0-alpha.5",
35
- "graphql": "15.9.0",
36
- "rimraf": "6.0.1",
37
- "typescript": "5.3.3"
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"
38
43
  },
39
44
  "publishConfig": {
40
45
  "access": "public",
41
46
  "directory": "dist"
42
47
  },
43
- "scripts": {
44
- "build": "node ../cli/bin.js run build",
45
- "watch": "node ../cli/bin.js run watch"
46
- },
47
- "gitHead": "b7e120541b093e91f214904a9f13e4c2c4640978"
48
+ "gitHead": "0f2aa699f4642e550ab62c96fcd050e8d02345c9"
48
49
  }
@@ -1,6 +1,6 @@
1
1
  import { Plugin } from "@webiny/plugins";
2
- import type { GenericRecord } from "@webiny/api/types";
3
- import type { 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;
@@ -1,11 +1,5 @@
1
- "use strict";
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
- exports.WebsocketsActionPlugin = WebsocketsActionPlugin;
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":["_plugins","require","WebsocketsActionPlugin","Plugin","type","constructor","action","cb","run","params","exports","createWebsocketsAction"],"sources":["WebsocketsActionPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { GenericRecord } from \"@webiny/api/types\";\nimport type {\n IWebsocketsActionPluginCallable,\n IWebsocketsActionPluginCallableParams,\n WebsocketsActionPluginCallableResponse\n} from \"./abstrations/IWebsocketsActionPlugin\";\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,IAAAA,QAAA,GAAAC,OAAA;AAQO,MAAMC,sBAAsB,SAAkDC,eAAM,CAAC;EACxF,OAAgCC,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;AAACC,OAAA,CAAAR,sBAAA,GAAAA,sBAAA;AAEM,MAAMS,sBAAsB,GAAGA,CAClCL,MAAc,EACdC,EAAsC,KACrC;EACD,OAAO,IAAIL,sBAAsB,CAAII,MAAM,EAAEC,EAAE,CAAC;AACpD,CAAC;AAACG,OAAA,CAAAC,sBAAA,GAAAA,sBAAA","ignoreList":[]}
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 type { IWebsocketsEvent, IWebsocketsEventData, WebsocketsEventRoute } from "../handler/types";
3
- import type { Context } from "../types";
4
- import type { IWebsocketsRunnerResponse } from "../runner";
5
- import type { IWebsocketsConnectionRegistry } from "../registry";
6
- import type { IWebsocketsResponse } from "../response/abstractions/IWebsocketsResponse";
7
- import type { 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
- "use strict";
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
- exports.WebsocketsRoutePlugin = WebsocketsRoutePlugin;
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":["_plugins","require","WebsocketsRoutePlugin","Plugin","type","constructor","route","cb","run","params","exports","createWebsocketsRoutePlugin"],"sources":["WebsocketsRoutePlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { IWebsocketsEvent, IWebsocketsEventData, WebsocketsEventRoute } from \"~/handler/types\";\nimport type { Context } from \"~/types\";\nimport type { IWebsocketsRunnerResponse } from \"~/runner\";\nimport type { IWebsocketsConnectionRegistry } from \"~/registry\";\nimport type { IWebsocketsResponse } from \"~/response/abstractions/IWebsocketsResponse\";\nimport type { IWebsocketsIdentity } from \"~/context\";\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 getLocale: () => 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,IAAAA,QAAA,GAAAC,OAAA;AA+BO,MAAMC,qBAAqB,SAIxBC,eAAM,CAAC;EACb,OAAgCC,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;AAACC,OAAA,CAAAR,qBAAA,GAAAA,qBAAA;AAEM,MAAMS,2BAA2B,GAAGA,CAKvCL,KAAoC,EACpCC,EAA2C,KAC1C;EACD,OAAO,IAAIL,qBAAqB,CAAUI,KAAK,EAAEC,EAAE,CAAC;AACxD,CAAC;AAACG,OAAA,CAAAC,2BAAA,GAAAA,2BAAA","ignoreList":[]}
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 type { GenericRecord } from "@webiny/api/types";
2
- import type { 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> {
@@ -1,7 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
1
+ export {};
6
2
 
7
3
  //# sourceMappingURL=IWebsocketsActionPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["IWebsocketsActionPlugin.ts"],"sourcesContent":["import type { GenericRecord } from \"@webiny/api/types\";\nimport type { 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 toTenantAndLocale<T extends GenericRecord = GenericRecord>(\n tenant: string,\n locale: string,\n data: T\n ): 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 (params: IWebsocketsActionPluginCallableParams): Promise<\n WebsocketsActionPluginCallableResponse<T>\n >;\n}\n"],"mappings":"","ignoreList":[]}
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":[]}
@@ -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
- "use strict";
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
@@ -1 +1 @@
1
- {"version":3,"names":["_WebsocketsRoutePlugin","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_WebsocketsActionPlugin","_IWebsocketsActionPlugin"],"sources":["index.ts"],"sourcesContent":["export * from \"./WebsocketsRoutePlugin\";\nexport * from \"./WebsocketsActionPlugin\";\nexport * from \"./abstrations/IWebsocketsActionPlugin\";\n"],"mappings":";;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,sBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,sBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,sBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,uBAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,uBAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,uBAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,uBAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,wBAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,wBAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,wBAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,wBAAA,CAAAN,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
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 type { IWebsocketsConnectionRegistry, IWebsocketsConnectionRegistryData, IWebsocketsConnectionRegistryRegisterParams, IWebsocketsConnectionRegistryUnregisterParams } from "./abstractions/IWebsocketsConnectionRegistry";
2
- import type { 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, locale?: string): Promise<IWebsocketsConnectionRegistryData[]>;
20
+ listViaTenant(tenant: string): Promise<IWebsocketsConnectionRegistryData[]>;
21
21
  listAll(): Promise<IWebsocketsConnectionRegistryData[]>;
22
22
  private store;
23
23
  }
@@ -1,25 +1,16 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.WebsocketsConnectionRegistry = void 0;
8
- var _error = _interopRequireDefault(require("@webiny/error"));
9
- var _entity = require("./entity");
10
- var _dbDynamodb = require("@webiny/db-dynamodb");
1
+ import WebinyError from "@webiny/error";
2
+ import { createEntity } from "./entity.js";
11
3
  const PK = `WS#CONNECTIONS`;
12
4
  const GSI1_PK = "WS#CONNECTIONS#IDENTITY";
13
- const GSI2_PK = "WS#CONNECTIONS#TENANT#LOCALE";
14
- class WebsocketsConnectionRegistry {
5
+ const GSI2_PK = "WS#CONNECTIONS#TENANT";
6
+ export class WebsocketsConnectionRegistry {
15
7
  constructor(documentClient) {
16
- this.entity = (0, _entity.createEntity)(documentClient);
8
+ this.entity = createEntity(documentClient);
17
9
  }
18
10
  async register(params) {
19
11
  const {
20
12
  connectionId,
21
13
  tenant,
22
- locale,
23
14
  identity,
24
15
  domainName,
25
16
  stage,
@@ -29,7 +20,6 @@ class WebsocketsConnectionRegistry {
29
20
  connectionId,
30
21
  identity,
31
22
  tenant,
32
- locale,
33
23
  domainName,
34
24
  stage,
35
25
  connectedOn
@@ -49,26 +39,23 @@ class WebsocketsConnectionRegistry {
49
39
  if (!original) {
50
40
  const message = `There is no connection with ID "${connectionId}".`;
51
41
  console.error(message);
52
- throw new _error.default(message, "CONNECTION_NOT_FOUND", keys);
42
+ throw new WebinyError(message, "CONNECTION_NOT_FOUND", keys);
53
43
  }
54
44
  try {
55
- await (0, _dbDynamodb.deleteItem)({
56
- entity: this.entity,
57
- keys
58
- });
45
+ await this.entity.delete(keys);
59
46
  } catch (ex) {
60
47
  console.error(`Could not remove connection from the database: ${original.connectionId}`);
61
- throw new _error.default(ex.message, ex.code, keys);
48
+ throw new WebinyError(ex.message, ex.code, keys);
62
49
  }
63
50
  }
64
51
  async getViaConnection(connectionId) {
65
- const item = await (0, _dbDynamodb.get)({
66
- entity: this.entity,
67
- keys: {
68
- PK,
69
- SK: connectionId
70
- }
52
+ const item = await this.entity.get({
53
+ PK,
54
+ SK: connectionId
71
55
  });
56
+ if (!item) {
57
+ return null;
58
+ }
72
59
  return item?.data || null;
73
60
  }
74
61
 
@@ -76,16 +63,15 @@ class WebsocketsConnectionRegistry {
76
63
  * Uses Primary keys
77
64
  */
78
65
  async listViaConnections(connections) {
79
- const items = connections.map(connectionId => {
80
- return this.entity.getBatch({
81
- PK,
82
- SK: connectionId
83
- });
84
- });
85
- const results = await (0, _dbDynamodb.batchReadAll)({
86
- table: this.entity.table,
87
- items
66
+ const reader = this.entity.createEntityReader({
67
+ read: connections.map(id => {
68
+ return {
69
+ PK,
70
+ SK: id
71
+ };
72
+ })
88
73
  });
74
+ const results = await reader.execute();
89
75
  return results.map(item => {
90
76
  return item.data;
91
77
  });
@@ -95,8 +81,7 @@ class WebsocketsConnectionRegistry {
95
81
  * Uses GSI1 keys
96
82
  */
97
83
  async listViaIdentity(identity) {
98
- const items = await (0, _dbDynamodb.queryAll)({
99
- entity: this.entity,
84
+ const items = await this.entity.queryAll({
100
85
  partitionKey: GSI1_PK,
101
86
  options: {
102
87
  index: "GSI1",
@@ -111,17 +96,11 @@ class WebsocketsConnectionRegistry {
111
96
  /**
112
97
  * Uses GSI2 keys
113
98
  */
114
- async listViaTenant(tenant, locale) {
115
- let options = {
116
- beginsWith: `T#${tenant}#L#`
99
+ async listViaTenant(tenant) {
100
+ const options = {
101
+ beginsWith: `T#${tenant}`
117
102
  };
118
- if (locale) {
119
- options = {
120
- eq: `T#${tenant}#L#${locale}`
121
- };
122
- }
123
- const items = await (0, _dbDynamodb.queryAll)({
124
- entity: this.entity,
103
+ const items = await this.entity.queryAll({
125
104
  partitionKey: GSI2_PK,
126
105
  options: {
127
106
  ...options,
@@ -133,8 +112,7 @@ class WebsocketsConnectionRegistry {
133
112
  });
134
113
  }
135
114
  async listAll() {
136
- const items = await (0, _dbDynamodb.queryAll)({
137
- entity: this.entity,
115
+ const items = await this.entity.queryAll({
138
116
  partitionKey: PK,
139
117
  options: {
140
118
  gte: " "
@@ -148,7 +126,6 @@ class WebsocketsConnectionRegistry {
148
126
  const {
149
127
  connectionId,
150
128
  tenant,
151
- locale,
152
129
  identity
153
130
  } = data;
154
131
  const item = {
@@ -158,18 +135,17 @@ class WebsocketsConnectionRegistry {
158
135
  // to find all connections related to given identity
159
136
  GSI1_PK,
160
137
  GSI1_SK: identity.id,
161
- // to find all connections related to given tenant/locale combination
138
+ // to find all connections related to given tenant
162
139
  GSI2_PK,
163
- GSI2_SK: `T#${tenant}#L#${locale}`,
140
+ GSI2_SK: `T#${tenant}`,
141
+ GSI_TENANT: tenant,
142
+ TYPE: "ws.connection",
164
143
  data
165
144
  };
166
145
  try {
167
- return await (0, _dbDynamodb.put)({
168
- entity: this.entity,
169
- item
170
- });
146
+ return await this.entity.put(item);
171
147
  } catch (err) {
172
- throw _error.default.from(err, {
148
+ throw WebinyError.from(err, {
173
149
  message: "Could not store websockets connection data.",
174
150
  code: "STORE_WEBSOCKETS_CONNECTION_DATA_ERROR",
175
151
  data: item
@@ -177,6 +153,5 @@ class WebsocketsConnectionRegistry {
177
153
  }
178
154
  }
179
155
  }
180
- exports.WebsocketsConnectionRegistry = WebsocketsConnectionRegistry;
181
156
 
182
157
  //# sourceMappingURL=WebsocketsConnectionRegistry.js.map