@etohq/framework 1.0.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 (234) hide show
  1. package/README.md +0 -0
  2. package/dist/build-tools/compiler.d.ts +49 -0
  3. package/dist/build-tools/compiler.d.ts.map +1 -0
  4. package/dist/build-tools/compiler.js +291 -0
  5. package/dist/build-tools/compiler.js.map +1 -0
  6. package/dist/build-tools/index.d.ts +2 -0
  7. package/dist/build-tools/index.d.ts.map +1 -0
  8. package/dist/build-tools/index.js +18 -0
  9. package/dist/build-tools/index.js.map +1 -0
  10. package/dist/config/config.d.ts +34 -0
  11. package/dist/config/config.d.ts.map +1 -0
  12. package/dist/config/config.js +132 -0
  13. package/dist/config/config.js.map +1 -0
  14. package/dist/config/index.d.ts +5 -0
  15. package/dist/config/index.d.ts.map +1 -0
  16. package/dist/config/index.js +21 -0
  17. package/dist/config/index.js.map +1 -0
  18. package/dist/config/loader.d.ts +11 -0
  19. package/dist/config/loader.d.ts.map +1 -0
  20. package/dist/config/loader.js +35 -0
  21. package/dist/config/loader.js.map +1 -0
  22. package/dist/config/types.d.ts +901 -0
  23. package/dist/config/types.d.ts.map +1 -0
  24. package/dist/config/types.js +3 -0
  25. package/dist/config/types.js.map +1 -0
  26. package/dist/container.d.ts +3 -0
  27. package/dist/container.d.ts.map +1 -0
  28. package/dist/container.js +21 -0
  29. package/dist/container.js.map +1 -0
  30. package/dist/database/index.d.ts +3 -0
  31. package/dist/database/index.d.ts.map +1 -0
  32. package/dist/database/index.js +19 -0
  33. package/dist/database/index.js.map +1 -0
  34. package/dist/database/pg-connection-loader.d.ts +6 -0
  35. package/dist/database/pg-connection-loader.d.ts.map +1 -0
  36. package/dist/database/pg-connection-loader.js +37 -0
  37. package/dist/database/pg-connection-loader.js.map +1 -0
  38. package/dist/eto-app-loader.d.ts +51 -0
  39. package/dist/eto-app-loader.d.ts.map +1 -0
  40. package/dist/eto-app-loader.js +183 -0
  41. package/dist/eto-app-loader.js.map +1 -0
  42. package/dist/feature-flags/feature-flag-loader.d.ts +8 -0
  43. package/dist/feature-flags/feature-flag-loader.d.ts.map +1 -0
  44. package/dist/feature-flags/feature-flag-loader.js +81 -0
  45. package/dist/feature-flags/feature-flag-loader.js.map +1 -0
  46. package/dist/feature-flags/flag-router.d.ts +32 -0
  47. package/dist/feature-flags/flag-router.d.ts.map +1 -0
  48. package/dist/feature-flags/flag-router.js +67 -0
  49. package/dist/feature-flags/flag-router.js.map +1 -0
  50. package/dist/feature-flags/index.d.ts +5 -0
  51. package/dist/feature-flags/index.d.ts.map +1 -0
  52. package/dist/feature-flags/index.js +21 -0
  53. package/dist/feature-flags/index.js.map +1 -0
  54. package/dist/feature-flags/types.d.ts +31 -0
  55. package/dist/feature-flags/types.d.ts.map +1 -0
  56. package/dist/feature-flags/types.js +3 -0
  57. package/dist/feature-flags/types.js.map +1 -0
  58. package/dist/http/express-loader.d.ts +8 -0
  59. package/dist/http/express-loader.d.ts.map +1 -0
  60. package/dist/http/express-loader.js +85 -0
  61. package/dist/http/express-loader.js.map +1 -0
  62. package/dist/http/index.d.ts +15 -0
  63. package/dist/http/index.d.ts.map +1 -0
  64. package/dist/http/index.js +31 -0
  65. package/dist/http/index.js.map +1 -0
  66. package/dist/http/middlewares/apply-default-filters.d.ts +3 -0
  67. package/dist/http/middlewares/apply-default-filters.d.ts.map +1 -0
  68. package/dist/http/middlewares/apply-default-filters.js +32 -0
  69. package/dist/http/middlewares/apply-default-filters.js.map +1 -0
  70. package/dist/http/middlewares/apply-params-as-filters.d.ts +5 -0
  71. package/dist/http/middlewares/apply-params-as-filters.d.ts.map +1 -0
  72. package/dist/http/middlewares/apply-params-as-filters.js +14 -0
  73. package/dist/http/middlewares/apply-params-as-filters.js.map +1 -0
  74. package/dist/http/middlewares/authenticate-middleware.d.ts +11 -0
  75. package/dist/http/middlewares/authenticate-middleware.d.ts.map +1 -0
  76. package/dist/http/middlewares/authenticate-middleware.js +135 -0
  77. package/dist/http/middlewares/authenticate-middleware.js.map +1 -0
  78. package/dist/http/middlewares/clear-filters-by-key.d.ts +3 -0
  79. package/dist/http/middlewares/clear-filters-by-key.d.ts.map +1 -0
  80. package/dist/http/middlewares/clear-filters-by-key.js +12 -0
  81. package/dist/http/middlewares/clear-filters-by-key.js.map +1 -0
  82. package/dist/http/middlewares/ensure-publishable-api-key.d.ts +3 -0
  83. package/dist/http/middlewares/ensure-publishable-api-key.d.ts.map +1 -0
  84. package/dist/http/middlewares/ensure-publishable-api-key.js +49 -0
  85. package/dist/http/middlewares/ensure-publishable-api-key.js.map +1 -0
  86. package/dist/http/middlewares/error-handler.d.ts +23 -0
  87. package/dist/http/middlewares/error-handler.d.ts.map +1 -0
  88. package/dist/http/middlewares/error-handler.js +85 -0
  89. package/dist/http/middlewares/error-handler.js.map +1 -0
  90. package/dist/http/middlewares/exception-formatter.d.ts +9 -0
  91. package/dist/http/middlewares/exception-formatter.d.ts.map +1 -0
  92. package/dist/http/middlewares/exception-formatter.js +36 -0
  93. package/dist/http/middlewares/exception-formatter.js.map +1 -0
  94. package/dist/http/middlewares/index.d.ts +8 -0
  95. package/dist/http/middlewares/index.d.ts.map +1 -0
  96. package/dist/http/middlewares/index.js +24 -0
  97. package/dist/http/middlewares/index.js.map +1 -0
  98. package/dist/http/middlewares/set-context.d.ts +3 -0
  99. package/dist/http/middlewares/set-context.d.ts.map +1 -0
  100. package/dist/http/middlewares/set-context.js +18 -0
  101. package/dist/http/middlewares/set-context.js.map +1 -0
  102. package/dist/http/router.d.ts +100 -0
  103. package/dist/http/router.d.ts.map +1 -0
  104. package/dist/http/router.js +764 -0
  105. package/dist/http/router.js.map +1 -0
  106. package/dist/http/types.d.ts +141 -0
  107. package/dist/http/types.d.ts.map +1 -0
  108. package/dist/http/types.js +16 -0
  109. package/dist/http/types.js.map +1 -0
  110. package/dist/http/utils/define-middlewares.d.ts +18 -0
  111. package/dist/http/utils/define-middlewares.d.ts.map +1 -0
  112. package/dist/http/utils/define-middlewares.js +40 -0
  113. package/dist/http/utils/define-middlewares.js.map +1 -0
  114. package/dist/http/utils/get-query-config.d.ts +42 -0
  115. package/dist/http/utils/get-query-config.d.ts.map +1 -0
  116. package/dist/http/utils/get-query-config.js +183 -0
  117. package/dist/http/utils/get-query-config.js.map +1 -0
  118. package/dist/http/utils/http-compression.d.ts +5 -0
  119. package/dist/http/utils/http-compression.d.ts.map +1 -0
  120. package/dist/http/utils/http-compression.js +33 -0
  121. package/dist/http/utils/http-compression.js.map +1 -0
  122. package/dist/http/utils/maybe-apply-link-filter.d.ts +8 -0
  123. package/dist/http/utils/maybe-apply-link-filter.d.ts.map +1 -0
  124. package/dist/http/utils/maybe-apply-link-filter.js +71 -0
  125. package/dist/http/utils/maybe-apply-link-filter.js.map +1 -0
  126. package/dist/http/utils/refetch-entities.d.ts +5 -0
  127. package/dist/http/utils/refetch-entities.d.ts.map +1 -0
  128. package/dist/http/utils/refetch-entities.js +29 -0
  129. package/dist/http/utils/refetch-entities.js.map +1 -0
  130. package/dist/http/utils/restricted-fields.d.ts +6 -0
  131. package/dist/http/utils/restricted-fields.d.ts.map +1 -0
  132. package/dist/http/utils/restricted-fields.js +30 -0
  133. package/dist/http/utils/restricted-fields.js.map +1 -0
  134. package/dist/http/utils/unless-path.d.ts +9 -0
  135. package/dist/http/utils/unless-path.d.ts.map +1 -0
  136. package/dist/http/utils/unless-path.js +19 -0
  137. package/dist/http/utils/unless-path.js.map +1 -0
  138. package/dist/http/utils/validate-body.d.ts +5 -0
  139. package/dist/http/utils/validate-body.d.ts.map +1 -0
  140. package/dist/http/utils/validate-body.js +23 -0
  141. package/dist/http/utils/validate-body.js.map +1 -0
  142. package/dist/http/utils/validate-query.d.ts +6 -0
  143. package/dist/http/utils/validate-query.d.ts.map +1 -0
  144. package/dist/http/utils/validate-query.js +79 -0
  145. package/dist/http/utils/validate-query.js.map +1 -0
  146. package/dist/index.d.ts +16 -0
  147. package/dist/index.d.ts.map +1 -0
  148. package/dist/index.js +34 -0
  149. package/dist/index.js.map +1 -0
  150. package/dist/jobs/index.d.ts +2 -0
  151. package/dist/jobs/index.d.ts.map +1 -0
  152. package/dist/jobs/index.js +18 -0
  153. package/dist/jobs/index.js.map +1 -0
  154. package/dist/jobs/job-loader.d.ts +37 -0
  155. package/dist/jobs/job-loader.d.ts.map +1 -0
  156. package/dist/jobs/job-loader.js +130 -0
  157. package/dist/jobs/job-loader.js.map +1 -0
  158. package/dist/links/index.d.ts +2 -0
  159. package/dist/links/index.d.ts.map +1 -0
  160. package/dist/links/index.js +18 -0
  161. package/dist/links/index.js.map +1 -0
  162. package/dist/links/link-loader.d.ts +10 -0
  163. package/dist/links/link-loader.d.ts.map +1 -0
  164. package/dist/links/link-loader.js +74 -0
  165. package/dist/links/link-loader.js.map +1 -0
  166. package/dist/logger/index.d.ts +3 -0
  167. package/dist/logger/index.d.ts.map +1 -0
  168. package/dist/logger/index.js +9 -0
  169. package/dist/logger/index.js.map +1 -0
  170. package/dist/mikro-orm-cli/bin.d.ts +14 -0
  171. package/dist/mikro-orm-cli/bin.d.ts.map +1 -0
  172. package/dist/mikro-orm-cli/bin.js +54 -0
  173. package/dist/mikro-orm-cli/bin.js.map +1 -0
  174. package/dist/modules-sdk/index.d.ts +2 -0
  175. package/dist/modules-sdk/index.d.ts.map +1 -0
  176. package/dist/modules-sdk/index.js +18 -0
  177. package/dist/modules-sdk/index.js.map +1 -0
  178. package/dist/orchestration/index.d.ts +2 -0
  179. package/dist/orchestration/index.d.ts.map +1 -0
  180. package/dist/orchestration/index.js +18 -0
  181. package/dist/orchestration/index.js.map +1 -0
  182. package/dist/subscribers/index.d.ts +3 -0
  183. package/dist/subscribers/index.d.ts.map +1 -0
  184. package/dist/subscribers/index.js +19 -0
  185. package/dist/subscribers/index.js.map +1 -0
  186. package/dist/subscribers/subscriber-loader.d.ts +11 -0
  187. package/dist/subscribers/subscriber-loader.d.ts.map +1 -0
  188. package/dist/subscribers/subscriber-loader.js +196 -0
  189. package/dist/subscribers/subscriber-loader.js.map +1 -0
  190. package/dist/subscribers/types.d.ts +15 -0
  191. package/dist/subscribers/types.d.ts.map +1 -0
  192. package/dist/subscribers/types.js +3 -0
  193. package/dist/subscribers/types.js.map +1 -0
  194. package/dist/telemetry/index.d.ts +50 -0
  195. package/dist/telemetry/index.d.ts.map +1 -0
  196. package/dist/telemetry/index.js +81 -0
  197. package/dist/telemetry/index.js.map +1 -0
  198. package/dist/types/container.d.ts +62 -0
  199. package/dist/types/container.d.ts.map +1 -0
  200. package/dist/types/container.js +3 -0
  201. package/dist/types/container.js.map +1 -0
  202. package/dist/types/index.d.ts +2 -0
  203. package/dist/types/index.d.ts.map +1 -0
  204. package/dist/types/index.js +18 -0
  205. package/dist/types/index.js.map +1 -0
  206. package/dist/utils/index.d.ts +3 -0
  207. package/dist/utils/index.d.ts.map +1 -0
  208. package/dist/utils/index.js +19 -0
  209. package/dist/utils/index.js.map +1 -0
  210. package/dist/workflows/index.d.ts +3 -0
  211. package/dist/workflows/index.d.ts.map +1 -0
  212. package/dist/workflows/index.js +19 -0
  213. package/dist/workflows/index.js.map +1 -0
  214. package/dist/workflows/workflow-loader.d.ts +10 -0
  215. package/dist/workflows/workflow-loader.d.ts.map +1 -0
  216. package/dist/workflows/workflow-loader.js +74 -0
  217. package/dist/workflows/workflow-loader.js.map +1 -0
  218. package/dist/workflows-sdk/composer.d.ts +2 -0
  219. package/dist/workflows-sdk/composer.d.ts.map +1 -0
  220. package/dist/workflows-sdk/composer.js +18 -0
  221. package/dist/workflows-sdk/composer.js.map +1 -0
  222. package/dist/workflows-sdk/index.d.ts +3 -0
  223. package/dist/workflows-sdk/index.d.ts.map +1 -0
  224. package/dist/workflows-sdk/index.js +19 -0
  225. package/dist/workflows-sdk/index.js.map +1 -0
  226. package/dist/zod/index.d.ts +2 -0
  227. package/dist/zod/index.d.ts.map +1 -0
  228. package/dist/zod/index.js +18 -0
  229. package/dist/zod/index.js.map +1 -0
  230. package/dist/zod/zod-helpers.d.ts +3 -0
  231. package/dist/zod/zod-helpers.d.ts.map +1 -0
  232. package/dist/zod/zod-helpers.js +95 -0
  233. package/dist/zod/zod-helpers.js.map +1 -0
  234. package/package.json +120 -0
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./link-loader"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/links/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA6B"}
@@ -0,0 +1,10 @@
1
+ export declare class LinkLoader {
2
+ #private;
3
+ constructor(sourceDir: string | string[]);
4
+ /**
5
+ * Load links from the source paths, links are registering themselves,
6
+ * therefore we only need to import them
7
+ */
8
+ load(): Promise<void>;
9
+ }
10
+ //# sourceMappingURL=link-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link-loader.d.ts","sourceRoot":"","sources":["../../src/links/link-loader.ts"],"names":[],"mappings":"AAMA,qBAAa,UAAU;;gBAmBT,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE;IAIxC;;;OAGG;IACG,IAAI;CAoCX"}
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
+ };
8
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
+ };
13
+ var _LinkLoader_sourceDir, _LinkLoader_excludes;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.LinkLoader = void 0;
16
+ const utils_1 = require("@etohq/utils");
17
+ const promises_1 = require("fs/promises");
18
+ const path_1 = require("path");
19
+ const logger_1 = require("../logger");
20
+ class LinkLoader {
21
+ constructor(sourceDir) {
22
+ /**
23
+ * The directory from which to load the links
24
+ * @private
25
+ */
26
+ _LinkLoader_sourceDir.set(this, void 0);
27
+ /**
28
+ * The list of file names to exclude from the subscriber scan
29
+ * @private
30
+ */
31
+ _LinkLoader_excludes.set(this, [
32
+ /index\.js/,
33
+ /index\.ts/,
34
+ /\.DS_Store/,
35
+ /(\.ts\.map|\.js\.map|\.d\.ts|\.md)/,
36
+ /^_[^/\\]*(\.[^/\\]+)?$/,
37
+ ]);
38
+ __classPrivateFieldSet(this, _LinkLoader_sourceDir, sourceDir, "f");
39
+ }
40
+ /**
41
+ * Load links from the source paths, links are registering themselves,
42
+ * therefore we only need to import them
43
+ */
44
+ async load() {
45
+ const normalizedSourcePath = Array.isArray(__classPrivateFieldGet(this, _LinkLoader_sourceDir, "f"))
46
+ ? __classPrivateFieldGet(this, _LinkLoader_sourceDir, "f")
47
+ : [__classPrivateFieldGet(this, _LinkLoader_sourceDir, "f")];
48
+ const promises = normalizedSourcePath.map(async (sourcePath) => {
49
+ try {
50
+ await (0, promises_1.access)(sourcePath);
51
+ }
52
+ catch {
53
+ logger_1.logger.info(`No link to load from ${sourcePath}. skipped.`);
54
+ return;
55
+ }
56
+ return await (0, utils_1.readDirRecursive)(sourcePath).then(async (entries) => {
57
+ const fileEntries = entries.filter((entry) => {
58
+ return (!entry.isDirectory() &&
59
+ !__classPrivateFieldGet(this, _LinkLoader_excludes, "f").some((exclude) => exclude.test(entry.name)));
60
+ });
61
+ logger_1.logger.debug(`Registering links from ${sourcePath}.`);
62
+ return await (0, utils_1.promiseAll)(fileEntries.map(async (entry) => {
63
+ const fullPath = (0, path_1.join)(entry.path, entry.name);
64
+ return await (0, utils_1.dynamicImport)(fullPath);
65
+ }));
66
+ });
67
+ });
68
+ await (0, utils_1.promiseAll)(promises);
69
+ logger_1.logger.debug(`Links registered.`);
70
+ }
71
+ }
72
+ exports.LinkLoader = LinkLoader;
73
+ _LinkLoader_sourceDir = new WeakMap(), _LinkLoader_excludes = new WeakMap();
74
+ //# sourceMappingURL=link-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link-loader.js","sourceRoot":"","sources":["../../src/links/link-loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,wCAA0E;AAE1E,0CAAoC;AACpC,+BAA2B;AAC3B,sCAAkC;AAElC,MAAa,UAAU;IAmBrB,YAAY,SAA4B;QAlBxC;;;WAGG;QACH,wCAA6B;QAE7B;;;WAGG;QACH,+BAAsB;YACpB,WAAW;YACX,WAAW;YACX,YAAY;YACZ,oCAAoC;YACpC,wBAAwB;SACzB,EAAA;QAGC,uBAAA,IAAI,yBAAc,SAAS,MAAA,CAAA;IAC7B,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,IAAI;QACR,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,CAAC,u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eAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAA;IACnC,CAAC;CACF;AA/DD,gCA+DC"}
@@ -0,0 +1,3 @@
1
+ import logger from "@etohq/cli/dist/reporter";
2
+ export { logger };
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logger/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,0BAA0B,CAAA;AAE7C,OAAO,EAAE,MAAM,EAAE,CAAA"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.logger = void 0;
7
+ const reporter_1 = __importDefault(require("@etohq/cli/dist/reporter"));
8
+ exports.logger = reporter_1.default;
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/logger/index.ts"],"names":[],"mappings":";;;;;;AAAA,wEAA6C;AAEpC,iBAFF,kBAAM,CAEE"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Custom wrapper on top of MikroORM CLI to override the issue
3
+ * they have when importing TypeScript files.
4
+ *
5
+ * They have hardcoded the module system of TypeScript to CommonJS
6
+ * and that makes it impossible to use any other module system
7
+ * like Node16 or NodeNext and so on.
8
+ *
9
+ * With this wrapper, we monkey patch the code responsible for register
10
+ * ts-node and then boot their CLI. Since, the code footprint is
11
+ * small, we should be okay with managing this wrapper.
12
+ */
13
+ export {};
14
+ //# sourceMappingURL=bin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../src/mikro-orm-cli/bin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ /**
3
+ * Custom wrapper on top of MikroORM CLI to override the issue
4
+ * they have when importing TypeScript files.
5
+ *
6
+ * They have hardcoded the module system of TypeScript to CommonJS
7
+ * and that makes it impossible to use any other module system
8
+ * like Node16 or NodeNext and so on.
9
+ *
10
+ * With this wrapper, we monkey patch the code responsible for register
11
+ * ts-node and then boot their CLI. Since, the code footprint is
12
+ * small, we should be okay with managing this wrapper.
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const path_1 = require("path");
16
+ const core_1 = require("@mikro-orm/core");
17
+ const cli_1 = require("@mikro-orm/cli");
18
+ /**
19
+ * Monkey patching the TSNode registration of Mikro ORM to not use
20
+ * hardcoded module system with TypeScript.
21
+ */
22
+ core_1.ConfigurationLoader.registerTsNode = async function (configPath = "tsconfig.json") {
23
+ const tsConfigPath = (0, path_1.isAbsolute)(configPath)
24
+ ? configPath
25
+ : (0, path_1.join)(process.cwd(), configPath);
26
+ const tsNode = require(require.resolve("ts-node", { paths: [tsConfigPath] }));
27
+ if (!tsNode) {
28
+ return false;
29
+ }
30
+ const { options } = tsNode.register({
31
+ project: tsConfigPath,
32
+ transpileOnly: true,
33
+ }).config;
34
+ if (Object.entries(options?.paths ?? {}).length > 0) {
35
+ require("tsconfig-paths").register({
36
+ baseUrl: options.baseUrl ?? ".",
37
+ paths: options.paths,
38
+ });
39
+ }
40
+ return true;
41
+ };
42
+ require("@jercle/yargonaut")
43
+ .style("blue")
44
+ .style("yellow", "required")
45
+ .helpStyle("green")
46
+ .errorsStyle("red");
47
+ (async () => {
48
+ const argv = await cli_1.CLIConfigurator.configure();
49
+ const args = await argv.parse(process.argv.slice(2));
50
+ if (args._.length === 0) {
51
+ cli_1.CLIHelper.showHelp();
52
+ }
53
+ })();
54
+ //# sourceMappingURL=bin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.js","sourceRoot":"","sources":["../../src/mikro-orm-cli/bin.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;AAEH,+BAAuC;AACvC,0CAAqD;AACrD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CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;IACpD,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,eAAS,CAAC,QAAQ,EAAE,CAAA;IACtB,CAAC;AACH,CAAC,CAAC,EAAE,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from "@etohq/modules-sdk";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/modules-sdk/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("@etohq/modules-sdk"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules-sdk/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAkC"}
@@ -0,0 +1,2 @@
1
+ export * from "@etohq/orchestration";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/orchestration/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("@etohq/orchestration"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/orchestration/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAoC"}
@@ -0,0 +1,3 @@
1
+ export * from "./subscriber-loader";
2
+ export * from "./types";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/subscribers/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,SAAS,CAAA"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./subscriber-loader"), exports);
18
+ __exportStar(require("./types"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/subscribers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAmC;AACnC,0CAAuB"}
@@ -0,0 +1,11 @@
1
+ export declare class SubscriberLoader {
2
+ #private;
3
+ constructor(sourceDir: string | string[], options?: Record<string, unknown>);
4
+ private validateSubscriber;
5
+ private createDescriptor;
6
+ private createMap;
7
+ private inferIdentifier;
8
+ private createSubscriber;
9
+ load(): Promise<string[]>;
10
+ }
11
+ //# sourceMappingURL=subscriber-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriber-loader.d.ts","sourceRoot":"","sources":["../../src/subscribers/subscriber-loader.ts"],"names":[],"mappings":"AAyBA,qBAAa,gBAAgB;;gBAgCzB,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,EAC5B,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;IAMvC,OAAO,CAAC,kBAAkB;YA4DZ,gBAAgB;YAgBhB,SAAS;IAoBvB,OAAO,CAAC,eAAe;IA4BvB,OAAO,CAAC,gBAAgB;IAmClB,IAAI;CAoCX"}
@@ -0,0 +1,196 @@
1
+ "use strict";
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
+ };
8
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
+ };
13
+ var _SubscriberLoader_pluginOptions, _SubscriberLoader_sourceDir, _SubscriberLoader_excludes, _SubscriberLoader_subscriberDescriptors;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.SubscriberLoader = void 0;
16
+ const utils_1 = require("@etohq/utils");
17
+ const promises_1 = require("fs/promises");
18
+ const path_1 = require("path");
19
+ const config_1 = require("../config");
20
+ const container_1 = require("../container");
21
+ const logger_1 = require("../logger");
22
+ class SubscriberLoader {
23
+ constructor(sourceDir, options = {}) {
24
+ /**
25
+ * The options of the plugin from which the subscribers are being loaded
26
+ * @private
27
+ */
28
+ _SubscriberLoader_pluginOptions.set(this, void 0);
29
+ /**
30
+ * The base directory from which to scan for the subscribers
31
+ * @private
32
+ */
33
+ _SubscriberLoader_sourceDir.set(this, void 0);
34
+ /**
35
+ * The list of file names to exclude from the subscriber scan
36
+ * @private
37
+ */
38
+ _SubscriberLoader_excludes.set(this, [
39
+ /index\.js/,
40
+ /index\.ts/,
41
+ /\.DS_Store/,
42
+ /(\.ts\.map|\.js\.map|\.d\.ts|\.md)/,
43
+ /^_[^/\\]*(\.[^/\\]+)?$/,
44
+ ]
45
+ /**
46
+ * Map of subscribers descriptors to consume in the loader
47
+ * @private
48
+ */
49
+ );
50
+ /**
51
+ * Map of subscribers descriptors to consume in the loader
52
+ * @private
53
+ */
54
+ _SubscriberLoader_subscriberDescriptors.set(this, new Map());
55
+ __classPrivateFieldSet(this, _SubscriberLoader_sourceDir, sourceDir, "f");
56
+ __classPrivateFieldSet(this, _SubscriberLoader_pluginOptions, options, "f");
57
+ }
58
+ validateSubscriber(subscriber, path) {
59
+ const handler = subscriber.default;
60
+ if (!handler || typeof handler !== "function") {
61
+ /**
62
+ * If the handler is not a function, we can't use it
63
+ */
64
+ logger_1.logger.warn(`The subscriber in ${path} is not a function. skipped.`);
65
+ return false;
66
+ }
67
+ const config = subscriber.config;
68
+ if (!config) {
69
+ /**
70
+ * If the subscriber is missing a config, we can't use it
71
+ */
72
+ logger_1.logger.warn(`The subscriber in ${path} is missing a config. skipped.`);
73
+ return false;
74
+ }
75
+ if (!config.event) {
76
+ /**
77
+ * If the subscriber is missing an event, we can't use it.
78
+ * In production we throw an error, else we log a warning
79
+ */
80
+ if (config_1.configManager.isProduction) {
81
+ throw new Error(`The subscriber in ${path} is missing an event in the config.`);
82
+ }
83
+ else {
84
+ logger_1.logger.warn(`The subscriber in ${path} is missing an event in the config. skipped.`);
85
+ }
86
+ return false;
87
+ }
88
+ const events = Array.isArray(config.event) ? config.event : [config.event];
89
+ if (events.some((e) => !(typeof e === "string"))) {
90
+ /**
91
+ * If the subscribers event is not a string or an array of strings, we can't use it
92
+ */
93
+ logger_1.logger.warn(`The subscriber in ${path} has an invalid event config. The event must be a string or an array of strings. skipped.`);
94
+ return false;
95
+ }
96
+ return true;
97
+ }
98
+ async createDescriptor(absolutePath) {
99
+ return await (0, utils_1.dynamicImport)(absolutePath).then((module_) => {
100
+ module_ = (0, utils_1.resolveExports)(module_);
101
+ const isValid = this.validateSubscriber(module_, absolutePath);
102
+ if (!isValid) {
103
+ return;
104
+ }
105
+ __classPrivateFieldGet(this, _SubscriberLoader_subscriberDescriptors, "f").set(absolutePath, {
106
+ config: module_.config,
107
+ handler: module_.default,
108
+ });
109
+ });
110
+ }
111
+ async createMap(dirPath) {
112
+ const promises = await (0, utils_1.readDirRecursive)(dirPath).then(async (entries) => {
113
+ const fileEntries = entries.filter((entry) => {
114
+ return (!entry.isDirectory() &&
115
+ !__classPrivateFieldGet(this, _SubscriberLoader_excludes, "f").some((exclude) => exclude.test(entry.name)));
116
+ });
117
+ logger_1.logger.debug(`Registering subscribers from ${dirPath}.`);
118
+ return fileEntries.flatMap(async (entry) => {
119
+ const fullPath = (0, path_1.join)(entry.path, entry.name);
120
+ return await this.createDescriptor(fullPath);
121
+ });
122
+ });
123
+ await (0, utils_1.promiseAll)(promises);
124
+ }
125
+ inferIdentifier(fileName, { context }, handler) {
126
+ /**
127
+ * If subscriberId is provided, use that
128
+ */
129
+ if (context?.subscriberId) {
130
+ return context.subscriberId;
131
+ }
132
+ const handlerName = handler.name;
133
+ /**
134
+ * If the handler is not anonymous, use the name
135
+ */
136
+ if (handlerName && !handlerName.startsWith("_default")) {
137
+ return (0, utils_1.kebabCase)(handlerName);
138
+ }
139
+ /**
140
+ * If the handler is anonymous, use the file name
141
+ */
142
+ const idFromFile = (0, path_1.parse)(fileName).name;
143
+ return (0, utils_1.kebabCase)(idFromFile);
144
+ }
145
+ createSubscriber({ fileName, config, handler, }) {
146
+ const eventBusService = container_1.container.resolve(utils_1.Modules.EVENT_BUS);
147
+ const { event } = config;
148
+ const events = Array.isArray(event) ? event : [event];
149
+ const subscriberId = this.inferIdentifier(fileName, config, handler);
150
+ for (const e of events) {
151
+ const subscriber = async (data) => {
152
+ return await handler({
153
+ event: { name: e, ...data },
154
+ container: container_1.container,
155
+ pluginOptions: __classPrivateFieldGet(this, _SubscriberLoader_pluginOptions, "f"),
156
+ });
157
+ };
158
+ eventBusService.subscribe(e, subscriber, {
159
+ ...config.context,
160
+ subscriberId,
161
+ });
162
+ }
163
+ }
164
+ async load() {
165
+ const normalizeSourcePaths = Array.isArray(__classPrivateFieldGet(this, _SubscriberLoader_sourceDir, "f"))
166
+ ? __classPrivateFieldGet(this, _SubscriberLoader_sourceDir, "f")
167
+ : [__classPrivateFieldGet(this, _SubscriberLoader_sourceDir, "f")];
168
+ const promises = normalizeSourcePaths.map(async (sourcePath) => {
169
+ try {
170
+ await (0, promises_1.access)(sourcePath);
171
+ }
172
+ catch {
173
+ logger_1.logger.info(`No subscribers to load from ${sourcePath}. skipped.`);
174
+ return;
175
+ }
176
+ return await this.createMap(sourcePath);
177
+ });
178
+ await (0, utils_1.promiseAll)(promises);
179
+ for (const [fileName, { config, handler },] of __classPrivateFieldGet(this, _SubscriberLoader_subscriberDescriptors, "f").entries()) {
180
+ this.createSubscriber({
181
+ fileName,
182
+ config,
183
+ handler,
184
+ });
185
+ }
186
+ logger_1.logger.debug(`Subscribers registered.`);
187
+ /**
188
+ * Return the file paths of the registered subscribers, to prevent the
189
+ * backwards compatible loader from trying to register them.
190
+ */
191
+ return [...__classPrivateFieldGet(this, _SubscriberLoader_subscriberDescriptors, "f").keys()];
192
+ }
193
+ }
194
+ exports.SubscriberLoader = SubscriberLoader;
195
+ _SubscriberLoader_pluginOptions = new WeakMap(), _SubscriberLoader_sourceDir = new WeakMap(), _SubscriberLoader_excludes = new WeakMap(), _SubscriberLoader_subscriberDescriptors = new WeakMap();
196
+ //# sourceMappingURL=subscriber-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriber-loader.js","sourceRoot":"","sources":["../../src/subscribers/subscriber-loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,wCAOqB;AACrB,0CAAoC;AACpC,+BAAkC;AAGlC,sCAAyC;AACzC,4CAAwC;AACxC,sCAAkC;AAUlC,MAAa,gBAAgB;IA+B3B,YACE,SAA4B,EAC5B,UAAmC,EAAE;QAhCvC;;;WAGG;QACH,kDAAuC;QAEvC;;;WAGG;QACH,8CAA6B;QAE7B;;;WAGG;QACH,qCAAsB;YACpB,WAAW;YACX,WAAW;YACX,YAAY;YACZ,oCAAoC;YACpC,wBAAwB;SACzB;QAED;;;WAGG;UALF;QAED;;;WAGG;QACH,kDAA6D,IAAI,GAAG,EAAE,EAAA;QAMpE,uBAAA,IAAI,+BAAc,SAAS,MAAA,CAAA;QAC3B,uBAAA,IA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CAAC,CAAA;IAChD,CAAC;CACF;AA1OD,4CA0OC"}
@@ -0,0 +1,15 @@
1
+ import { Event, EtoContainer } from "@etohq/types";
2
+ interface SubscriberContext extends Record<string, unknown> {
3
+ subscriberId?: string;
4
+ }
5
+ export type SubscriberConfig = {
6
+ event: string | string[];
7
+ context?: SubscriberContext;
8
+ };
9
+ export type SubscriberArgs<T = unknown> = {
10
+ event: Event<T>;
11
+ container: EtoContainer;
12
+ pluginOptions: Record<string, unknown>;
13
+ };
14
+ export {};
15
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/subscribers/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAElD,UAAU,iBAAkB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzD,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACxB,OAAO,CAAC,EAAE,iBAAiB,CAAA;CAC5B,CAAA;AAED,MAAM,MAAM,cAAc,CAAC,CAAC,GAAG,OAAO,IAAI;IACxC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAA;IACf,SAAS,EAAE,YAAY,CAAA;IACvB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACvC,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/subscribers/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,50 @@
1
+ import { Tracer as OTTracer, Span } from "@opentelemetry/api";
2
+ /**
3
+ * Tracer creates an instrumentation scope within the application
4
+ * code. For example: You might create a tracer for the API
5
+ * requests, another one for the modules, one for workflows
6
+ * and so on.
7
+ *
8
+ * There is no need to create a Tracer instance per HTTP
9
+ * call.
10
+ */
11
+ export declare class Tracer {
12
+ #private;
13
+ name: string;
14
+ version?: string | undefined;
15
+ constructor(name: string, version?: string | undefined);
16
+ /**
17
+ * Returns the underlying tracer from open telemetry that
18
+ * could be used directly for certain advanced use-cases
19
+ */
20
+ getOTTracer(): OTTracer;
21
+ /**
22
+ * Trace a function call. Using this method will create a
23
+ * child scope for the invocations within the callback.
24
+ */
25
+ trace<F extends (span: Span) => unknown>(name: string, callback: F): ReturnType<F>;
26
+ /**
27
+ * Returns the active context
28
+ */
29
+ getActiveContext(): import("@opentelemetry/api").Context;
30
+ /**
31
+ * Returns the propagation state from the current active
32
+ * context
33
+ */
34
+ getPropagationState(): {
35
+ traceparent: string;
36
+ tracestate?: string;
37
+ };
38
+ /**
39
+ * Use the existing propogation state and trace an action. This
40
+ * will allow the newly traced action to be part of some
41
+ * existing trace
42
+ */
43
+ withPropagationState(state: {
44
+ traceparent: string;
45
+ tracestate?: string;
46
+ }): {
47
+ trace: <F extends (span: Span) => unknown>(name: string, callback: F) => ReturnType<F>;
48
+ };
49
+ }
50
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/telemetry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,IAAI,QAAQ,EAClB,IAAI,EAIL,MAAM,oBAAoB,CAAA;AAE3B;;;;;;;;GAQG;AACH,qBAAa,MAAM;;IAKE,IAAI,EAAE,MAAM;IAAS,OAAO,CAAC,EAAE,MAAM;gBAArC,IAAI,EAAE,MAAM,EAAS,OAAO,CAAC,EAAE,MAAM,YAAA;IAIxD;;;OAGG;IACH,WAAW;IAIX;;;OAGG;IACH,KAAK,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,EACrC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,GACV,UAAU,CAAC,CAAC,CAAC;IAIhB;;OAEG;IACH,gBAAgB;IAIhB;;;OAGG;IACH,mBAAmB,IAGA;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE;IAG/D;;;;OAIG;IACH,oBAAoB,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE;gBAE5D,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,QACjC,MAAM,YACF,CAAC,KACV,UAAU,CAAC,CAAC,CAAC;;CAMrB"}