@achinet/nestjs-async 0.0.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.
Files changed (148) hide show
  1. package/.eslintrc.js +9 -0
  2. package/.prettierrc +5 -0
  3. package/CHANGELOG.md +7 -0
  4. package/README.md +1 -0
  5. package/dist/asyncapi-document.builder.d.ts +27 -0
  6. package/dist/asyncapi-document.builder.js +110 -0
  7. package/dist/asyncapi-document.builder.js.map +1 -0
  8. package/dist/asyncapi.constants.d.ts +6 -0
  9. package/dist/asyncapi.constants.js +11 -0
  10. package/dist/asyncapi.constants.js.map +1 -0
  11. package/dist/asyncapi.module.d.ts +8 -0
  12. package/dist/asyncapi.module.js +44 -0
  13. package/dist/asyncapi.module.js.map +1 -0
  14. package/dist/binding/asyncapi.amqp.interfaces.d.ts +38 -0
  15. package/dist/binding/asyncapi.amqp.interfaces.js +3 -0
  16. package/dist/binding/asyncapi.amqp.interfaces.js.map +1 -0
  17. package/dist/binding/asyncapi.kafka.interfaces.d.ts +21 -0
  18. package/dist/binding/asyncapi.kafka.interfaces.js +3 -0
  19. package/dist/binding/asyncapi.kafka.interfaces.js.map +1 -0
  20. package/dist/binding/index.d.ts +2 -0
  21. package/dist/binding/index.js +19 -0
  22. package/dist/binding/index.js.map +1 -0
  23. package/dist/decorators/asyncapi-operation-for-meta-key.decorator.d.ts +2 -0
  24. package/dist/decorators/asyncapi-operation-for-meta-key.decorator.js +38 -0
  25. package/dist/decorators/asyncapi-operation-for-meta-key.decorator.js.map +1 -0
  26. package/dist/decorators/asyncapi-operation.decorator.d.ts +2 -0
  27. package/dist/decorators/asyncapi-operation.decorator.js +10 -0
  28. package/dist/decorators/asyncapi-operation.decorator.js.map +1 -0
  29. package/dist/decorators/asyncapi-pub.decorator.d.ts +2 -0
  30. package/dist/decorators/asyncapi-pub.decorator.js +11 -0
  31. package/dist/decorators/asyncapi-pub.decorator.js.map +1 -0
  32. package/dist/decorators/asyncapi-service.decorator.d.ts +1 -0
  33. package/dist/decorators/asyncapi-service.decorator.js +10 -0
  34. package/dist/decorators/asyncapi-service.decorator.js.map +1 -0
  35. package/dist/decorators/asyncapi-sub.decorator.d.ts +2 -0
  36. package/dist/decorators/asyncapi-sub.decorator.js +11 -0
  37. package/dist/decorators/asyncapi-sub.decorator.js.map +1 -0
  38. package/dist/decorators/index.d.ts +4 -0
  39. package/dist/decorators/index.js +21 -0
  40. package/dist/decorators/index.js.map +1 -0
  41. package/dist/explorers/asyncapi-class.explorer.d.ts +5 -0
  42. package/dist/explorers/asyncapi-class.explorer.js +31 -0
  43. package/dist/explorers/asyncapi-class.explorer.js.map +1 -0
  44. package/dist/explorers/asyncapi-operation.explorer.d.ts +17 -0
  45. package/dist/explorers/asyncapi-operation.explorer.js +26 -0
  46. package/dist/explorers/asyncapi-operation.explorer.js.map +1 -0
  47. package/dist/explorers/index.d.ts +2 -0
  48. package/dist/explorers/index.js +19 -0
  49. package/dist/explorers/index.js.map +1 -0
  50. package/dist/index.d.ts +4 -0
  51. package/dist/index.js +21 -0
  52. package/dist/index.js.map +1 -0
  53. package/dist/interface/asyncapi-common.interfaces.d.ts +126 -0
  54. package/dist/interface/asyncapi-common.interfaces.js +3 -0
  55. package/dist/interface/asyncapi-common.interfaces.js.map +1 -0
  56. package/dist/interface/asyncapi-document-options.interface.d.ts +3 -0
  57. package/dist/interface/asyncapi-document-options.interface.js +3 -0
  58. package/dist/interface/asyncapi-document-options.interface.js.map +1 -0
  59. package/dist/interface/asyncapi-message.interface.d.ts +8 -0
  60. package/dist/interface/asyncapi-message.interface.js +3 -0
  61. package/dist/interface/asyncapi-message.interface.js.map +1 -0
  62. package/dist/interface/asyncapi-operation-headers.interface.d.ts +6 -0
  63. package/dist/interface/asyncapi-operation-headers.interface.js +3 -0
  64. package/dist/interface/asyncapi-operation-headers.interface.js.map +1 -0
  65. package/dist/interface/asyncapi-operation-options-raw.interface.d.ts +21 -0
  66. package/dist/interface/asyncapi-operation-options-raw.interface.js +3 -0
  67. package/dist/interface/asyncapi-operation-options-raw.interface.js.map +1 -0
  68. package/dist/interface/asyncapi-operation-options.interface.d.ts +8 -0
  69. package/dist/interface/asyncapi-operation-options.interface.js +3 -0
  70. package/dist/interface/asyncapi-operation-options.interface.js.map +1 -0
  71. package/dist/interface/asyncapi-operation-payload.interface.d.ts +2 -0
  72. package/dist/interface/asyncapi-operation-payload.interface.js +3 -0
  73. package/dist/interface/asyncapi-operation-payload.interface.js.map +1 -0
  74. package/dist/interface/asyncapi-server.interface.d.ts +10 -0
  75. package/dist/interface/asyncapi-server.interface.js +3 -0
  76. package/dist/interface/asyncapi-server.interface.js.map +1 -0
  77. package/dist/interface/asyncapi-template-options.interface.d.ts +7 -0
  78. package/dist/interface/asyncapi-template-options.interface.js +3 -0
  79. package/dist/interface/asyncapi-template-options.interface.js.map +1 -0
  80. package/dist/interface/denormalized-doc-resolvers.interface.d.ts +6 -0
  81. package/dist/interface/denormalized-doc-resolvers.interface.js +3 -0
  82. package/dist/interface/denormalized-doc-resolvers.interface.js.map +1 -0
  83. package/dist/interface/denormalized-doc.interface.d.ts +10 -0
  84. package/dist/interface/denormalized-doc.interface.js +3 -0
  85. package/dist/interface/denormalized-doc.interface.js.map +1 -0
  86. package/dist/interface/generator-options.interface.d.ts +22 -0
  87. package/dist/interface/generator-options.interface.js +3 -0
  88. package/dist/interface/generator-options.interface.js.map +1 -0
  89. package/dist/interface/index.d.ts +11 -0
  90. package/dist/interface/index.js +28 -0
  91. package/dist/interface/index.js.map +1 -0
  92. package/dist/services/asyncapi.explorer.d.ts +12 -0
  93. package/dist/services/asyncapi.explorer.js +72 -0
  94. package/dist/services/asyncapi.explorer.js.map +1 -0
  95. package/dist/services/asyncapi.generator.d.ts +7 -0
  96. package/dist/services/asyncapi.generator.js +27 -0
  97. package/dist/services/asyncapi.generator.js.map +1 -0
  98. package/dist/services/asyncapi.scanner.d.ts +14 -0
  99. package/dist/services/asyncapi.scanner.js +82 -0
  100. package/dist/services/asyncapi.scanner.js.map +1 -0
  101. package/dist/services/asyncapi.transformer.d.ts +4 -0
  102. package/dist/services/asyncapi.transformer.js +33 -0
  103. package/dist/services/asyncapi.transformer.js.map +1 -0
  104. package/dist/services/index.d.ts +5 -0
  105. package/dist/services/index.js +22 -0
  106. package/dist/services/index.js.map +1 -0
  107. package/dist/services/operation-object.factory.d.ts +9 -0
  108. package/dist/services/operation-object.factory.js +37 -0
  109. package/dist/services/operation-object.factory.js.map +1 -0
  110. package/dist/tsconfig.tsbuildinfo +1 -0
  111. package/package.json +94 -0
  112. package/src/asyncapi-document.builder.ts +186 -0
  113. package/src/asyncapi.constants.ts +8 -0
  114. package/src/asyncapi.module.ts +76 -0
  115. package/src/binding/asyncapi.amqp.interfaces.ts +48 -0
  116. package/src/binding/asyncapi.kafka.interfaces.ts +35 -0
  117. package/src/binding/index.ts +2 -0
  118. package/src/decorators/asyncapi-operation-for-meta-key.decorator.ts +70 -0
  119. package/src/decorators/asyncapi-operation.decorator.ts +9 -0
  120. package/src/decorators/asyncapi-pub.decorator.ts +18 -0
  121. package/src/decorators/asyncapi-service.decorator.ts +9 -0
  122. package/src/decorators/asyncapi-sub.decorator.ts +18 -0
  123. package/src/decorators/index.ts +4 -0
  124. package/src/explorers/asyncapi-class.explorer.ts +30 -0
  125. package/src/explorers/asyncapi-operation.explorer.ts +49 -0
  126. package/src/explorers/index.ts +2 -0
  127. package/src/index.ts +4 -0
  128. package/src/interface/asyncapi-common.interfaces.ts +172 -0
  129. package/src/interface/asyncapi-document-options.interface.ts +3 -0
  130. package/src/interface/asyncapi-message.interface.ts +10 -0
  131. package/src/interface/asyncapi-operation-headers.interface.ts +6 -0
  132. package/src/interface/asyncapi-operation-options-raw.interface.ts +23 -0
  133. package/src/interface/asyncapi-operation-options.interface.ts +12 -0
  134. package/src/interface/asyncapi-operation-payload.interface.ts +7 -0
  135. package/src/interface/asyncapi-server.interface.ts +14 -0
  136. package/src/interface/asyncapi-template-options.interface.ts +20 -0
  137. package/src/interface/denormalized-doc-resolvers.interface.ts +6 -0
  138. package/src/interface/denormalized-doc.interface.ts +10 -0
  139. package/src/interface/generator-options.interface.ts +21 -0
  140. package/src/interface/index.ts +12 -0
  141. package/src/services/asyncapi.explorer.ts +121 -0
  142. package/src/services/asyncapi.generator.ts +33 -0
  143. package/src/services/asyncapi.scanner.ts +155 -0
  144. package/src/services/asyncapi.transformer.ts +39 -0
  145. package/src/services/index.ts +5 -0
  146. package/src/services/operation-object.factory.ts +56 -0
  147. package/tsconfig.build.json +4 -0
  148. package/tsconfig.json +8 -0
package/.eslintrc.js ADDED
@@ -0,0 +1,9 @@
1
+ module.exports = {
2
+ root: true,
3
+ extends: ["@achinet/eslint-config-custom"],
4
+ parserOptions: {
5
+ project: 'tsconfig.json',
6
+ tsconfigRootDir: __dirname,
7
+ sourceType: 'module',
8
+ },
9
+ };
package/.prettierrc ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "singleQuote": true,
3
+ "trailingComma": "all",
4
+ "printWidth": 120
5
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # @achinet/nestjs-async
2
+
3
+ ## 0.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 7ca0b6b: First version of the package
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # nestjs-async
@@ -0,0 +1,27 @@
1
+ import { ExternalDocumentationObject, SecuritySchemeObject } from '@nestjs/swagger/dist/interfaces/open-api-spec.interface';
2
+ import { AsyncApiDocument, AsyncSecuritySchemeObject, AsyncServerObject } from './interface';
3
+ export declare class AsyncApiDocumentBuilder {
4
+ private readonly buildDocumentBase;
5
+ private readonly document;
6
+ setTitle(title: string): this;
7
+ setDescription(description: string): this;
8
+ setVersion(version: string): this;
9
+ setTermsOfService(termsOfService: string): this;
10
+ setContact(name: string, url: string, email: string): this;
11
+ setLicense(name: string, url: string): this;
12
+ addServer(name: string, server: AsyncServerObject): this;
13
+ addServers(servers: {
14
+ name: string;
15
+ server: AsyncServerObject;
16
+ }[]): this;
17
+ setExternalDoc(description: string, url: string): this;
18
+ setDefaultContentType(contentType: string): this;
19
+ addTag(name: string, description?: string, externalDocs?: ExternalDocumentationObject): this;
20
+ addSecurity(name: string, options: AsyncSecuritySchemeObject): this;
21
+ addBearerAuth(options?: SecuritySchemeObject, name?: string): this;
22
+ addOAuth2(options?: SecuritySchemeObject, name?: string): this;
23
+ addApiKey(options?: SecuritySchemeObject, name?: string): this;
24
+ addBasicAuth(options?: SecuritySchemeObject, name?: string): this;
25
+ addCookieAuth(cookieName?: string, options?: SecuritySchemeObject, securityName?: string): this;
26
+ build(): Omit<AsyncApiDocument, 'components' | 'channels'>;
27
+ }
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AsyncApiDocumentBuilder = void 0;
4
+ const lodash_1 = require("lodash");
5
+ class AsyncApiDocumentBuilder {
6
+ constructor() {
7
+ this.buildDocumentBase = () => ({
8
+ asyncapi: '2.5.0',
9
+ info: {
10
+ title: '',
11
+ description: '',
12
+ version: '1.0.0',
13
+ contact: {},
14
+ },
15
+ tags: [],
16
+ servers: {},
17
+ components: {},
18
+ });
19
+ this.document = this.buildDocumentBase();
20
+ }
21
+ setTitle(title) {
22
+ this.document.info.title = title;
23
+ return this;
24
+ }
25
+ setDescription(description) {
26
+ this.document.info.description = description;
27
+ return this;
28
+ }
29
+ setVersion(version) {
30
+ this.document.info.version = version;
31
+ return this;
32
+ }
33
+ setTermsOfService(termsOfService) {
34
+ this.document.info.termsOfService = termsOfService;
35
+ return this;
36
+ }
37
+ setContact(name, url, email) {
38
+ this.document.info.contact = { name, url, email };
39
+ return this;
40
+ }
41
+ setLicense(name, url) {
42
+ this.document.info.license = { name, url };
43
+ return this;
44
+ }
45
+ addServer(name, server) {
46
+ this.document.servers[name] = server;
47
+ return this;
48
+ }
49
+ addServers(servers) {
50
+ for (const { name, server } of servers) {
51
+ this.addServer(name, server);
52
+ }
53
+ return this;
54
+ }
55
+ setExternalDoc(description, url) {
56
+ this.document.externalDocs = { description, url };
57
+ return this;
58
+ }
59
+ setDefaultContentType(contentType) {
60
+ this.document.defaultContentType = contentType;
61
+ return this;
62
+ }
63
+ addTag(name, description = '', externalDocs) {
64
+ this.document.tags = this.document.tags.concat((0, lodash_1.pickBy)({
65
+ name,
66
+ description,
67
+ externalDocs,
68
+ }, (0, lodash_1.negate)(lodash_1.isUndefined)));
69
+ return this;
70
+ }
71
+ addSecurity(name, options) {
72
+ this.document.components.securitySchemes = Object.assign(Object.assign({}, (this.document.components.securitySchemes || {})), { [name]: options });
73
+ return this;
74
+ }
75
+ addBearerAuth(options = {
76
+ type: 'http',
77
+ }, name = 'bearer') {
78
+ this.addSecurity(name, Object.assign({ scheme: 'bearer', bearerFormat: 'JWT' }, options));
79
+ return this;
80
+ }
81
+ addOAuth2(options = {
82
+ type: 'oauth2',
83
+ }, name = 'oauth2') {
84
+ this.addSecurity(name, Object.assign({ flows: {} }, options));
85
+ return this;
86
+ }
87
+ addApiKey(options = {
88
+ type: 'apiKey',
89
+ }, name = 'api_key') {
90
+ this.addSecurity(name, Object.assign({ in: 'header', name }, options));
91
+ return this;
92
+ }
93
+ addBasicAuth(options = {
94
+ type: 'http',
95
+ }, name = 'basic') {
96
+ this.addSecurity(name, Object.assign({ scheme: 'basic' }, options));
97
+ return this;
98
+ }
99
+ addCookieAuth(cookieName = 'connect.sid', options = {
100
+ type: 'apiKey',
101
+ }, securityName = 'cookie') {
102
+ this.addSecurity(securityName, Object.assign({ in: 'cookie', name: cookieName }, options));
103
+ return this;
104
+ }
105
+ build() {
106
+ return this.document;
107
+ }
108
+ }
109
+ exports.AsyncApiDocumentBuilder = AsyncApiDocumentBuilder;
110
+ //# sourceMappingURL=asyncapi-document.builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asyncapi-document.builder.js","sourceRoot":"","sources":["../src/asyncapi-document.builder.ts"],"names":[],"mappings":";;;AAKA,mCAAqD;AAOrD,MAAa,uBAA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"use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DECORATORS = void 0;
4
+ const DECORATORS_PREFIX = 'asyncapi';
5
+ exports.DECORATORS = {
6
+ AsyncApiClass: `${DECORATORS_PREFIX}/class`,
7
+ AsyncApiOperation: `${DECORATORS_PREFIX}/operation`,
8
+ AsyncApiPub: `${DECORATORS_PREFIX}/pub`,
9
+ AsyncApiSub: `${DECORATORS_PREFIX}/sub`,
10
+ };
11
+ //# sourceMappingURL=asyncapi.constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asyncapi.constants.js","sourceRoot":"","sources":["../src/asyncapi.constants.ts"],"names":[],"mappings":";;;AAAA,MAAM,iBAAiB,GAAG,UAAU,CAAC;AAExB,QAAA,UAAU,GAAG;IACxB,aAAa,EAAE,GAAG,iBAAiB,QAAQ;IAC3C,iBAAiB,EAAE,GAAG,iBAAiB,YAAY;IACnD,WAAW,EAAE,GAAG,iBAAiB,MAAM;IACvC,WAAW,EAAE,GAAG,iBAAiB,MAAM;CACxC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { INestApplication, INestApplicationContext } from '@nestjs/common';
2
+ import { AsyncApiDocument, AsyncApiDocumentOptions, AsyncApiTemplateOptions } from './interface';
3
+ export declare class AsyncApiModule {
4
+ private static readonly logger;
5
+ static createDocument(app: INestApplicationContext, config: Omit<AsyncApiDocument, 'channels'>, options?: AsyncApiDocumentOptions): AsyncApiDocument;
6
+ static composeHtml(contract: AsyncApiDocument, templateOptions?: AsyncApiTemplateOptions): Promise<string>;
7
+ static setup(path: string, app: INestApplication, document: AsyncApiDocument, templateOptions?: AsyncApiTemplateOptions): Promise<void>;
8
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AsyncApiModule = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const validate_path_util_1 = require("@nestjs/swagger/dist/utils/validate-path.util");
6
+ const js_yaml_1 = require("js-yaml");
7
+ const services_1 = require("./services");
8
+ class AsyncApiModule {
9
+ static createDocument(app, config, options = {}) {
10
+ const asyncapiScanner = new services_1.AsyncapiScanner();
11
+ const document = asyncapiScanner.scanApplication(app, options);
12
+ document.components = Object.assign(Object.assign({}, (config.components || {})), document.components);
13
+ return Object.assign(Object.assign({}, config), document);
14
+ }
15
+ static async composeHtml(contract, templateOptions) {
16
+ const generator = new services_1.AsyncapiGenerator(templateOptions);
17
+ return generator.generate(contract).catch((err) => {
18
+ this.logger.error(err);
19
+ throw err;
20
+ });
21
+ }
22
+ static async setup(path, app, document, templateOptions) {
23
+ const httpAdapter = app.getHttpAdapter();
24
+ const finalPath = (0, validate_path_util_1.validatePath)(path);
25
+ const html = await this.composeHtml(document, templateOptions);
26
+ const yamlDocument = js_yaml_1.default.dump(document);
27
+ const jsonDocument = JSON.stringify(document);
28
+ httpAdapter.get(finalPath, (req, res) => {
29
+ res.type('text/html');
30
+ res.send(html);
31
+ });
32
+ httpAdapter.get(finalPath + '-json', (req, res) => {
33
+ res.type('application/json');
34
+ res.send(jsonDocument);
35
+ });
36
+ httpAdapter.get(finalPath + '-yaml', (req, res) => {
37
+ res.type('text/yaml');
38
+ res.send(yamlDocument);
39
+ });
40
+ }
41
+ }
42
+ exports.AsyncApiModule = AsyncApiModule;
43
+ AsyncApiModule.logger = new common_1.Logger(AsyncApiModule.name);
44
+ //# sourceMappingURL=asyncapi.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asyncapi.module.js","sourceRoot":"","sources":["../src/asyncapi.module.ts"],"names":[],"mappings":";;;AAAA,2CAIwB;AACxB,sFAA6E;AAC7E,qCAA6B;AAM7B,yCAAgE;AAEhE,MAAa,cAAc;IAGlB,MAAM,CAAC,cAAc,CAC1B,GAA4B,EAC5B,MAA0C,EAC1C,UAAmC,EAAE;QAErC,MAAM,eAAe,GAAG,IAAI,0BAAe,EAAE,CAAC;QAC9C,MAAM,QAAQ,GAAG,eAAe,CAAC,eAAe,CAAC,GAA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AAE,EAAE;YAChD,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;YAC7B,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;QAEH,WAAW,CAAC,GAAG,CAAC,SAAS,GAAG,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YAChD,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACtB,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC;;AA5DH,wCA6DC;AA5DyB,qBAAM,GAAG,IAAI,eAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,38 @@
1
+ export interface AmqpServerBinding {
2
+ }
3
+ export interface AmqpChannelBinding {
4
+ is: string;
5
+ exchange?: {
6
+ name: string;
7
+ type: string;
8
+ durable?: boolean;
9
+ autoDelete?: boolean;
10
+ vhost?: string;
11
+ };
12
+ queue?: {
13
+ name: string;
14
+ durable?: boolean;
15
+ exclusive?: boolean;
16
+ autoDelete?: boolean;
17
+ vhost?: string;
18
+ };
19
+ bindingVersion?: string;
20
+ }
21
+ export interface AmqpOperationBinding {
22
+ expiration?: number;
23
+ userId?: string;
24
+ cc?: string[];
25
+ priority?: number;
26
+ deliveryMode?: number;
27
+ mandatory?: boolean;
28
+ bcc?: string[];
29
+ replyTo?: string;
30
+ timestamp?: boolean;
31
+ ack?: boolean;
32
+ bindingVersion?: string;
33
+ }
34
+ export interface AmqpMessageBinding {
35
+ contentEncoding?: string;
36
+ messageType?: string;
37
+ bindingVersion?: string;
38
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=asyncapi.amqp.interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asyncapi.amqp.interfaces.js","sourceRoot":"","sources":["../../src/binding/asyncapi.amqp.interfaces.ts"],"names":[],"mappings":""}
@@ -0,0 +1,21 @@
1
+ import { SchemaObject } from '@nestjs/swagger/dist/interfaces/open-api-spec.interface';
2
+ export interface KafkaServerBinding {
3
+ schemaRegistryUrl: string;
4
+ schemaRegistryVendor: string;
5
+ bindingVersion: string;
6
+ }
7
+ export interface KafkaChannelBinding {
8
+ topic: string;
9
+ partitions: number;
10
+ replicas: number;
11
+ bindingVersion: string;
12
+ }
13
+ export interface KafkaOperationBinding {
14
+ groupId?: SchemaObject;
15
+ clientId?: SchemaObject;
16
+ bindingVersion?: string;
17
+ }
18
+ export interface KafkaMessageBinding {
19
+ key?: SchemaObject;
20
+ bindingVersion?: string;
21
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=asyncapi.kafka.interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asyncapi.kafka.interfaces.js","sourceRoot":"","sources":["../../src/binding/asyncapi.kafka.interfaces.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from './asyncapi.amqp.interfaces';
2
+ export * from './asyncapi.kafka.interfaces';
@@ -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("./asyncapi.amqp.interfaces"), exports);
18
+ __exportStar(require("./asyncapi.kafka.interfaces"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/binding/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C;AAC3C,8DAA4C"}
@@ -0,0 +1,2 @@
1
+ import { AsyncApiOperationOptions } from '../interface';
2
+ export declare function AsyncApiOperationForMetaKey(metaKey: string, options: AsyncApiOperationOptions[]): MethodDecorator;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AsyncApiOperationForMetaKey = void 0;
4
+ const helpers_1 = require("@nestjs/swagger/dist/decorators/helpers");
5
+ function makeHeaders(headers) {
6
+ return headers
7
+ ? {
8
+ type: 'object',
9
+ properties: Object.entries(headers)
10
+ .map(([key, value]) => ({
11
+ [key]: Object.assign({ type: 'string' }, value),
12
+ }))
13
+ .reduce((acc, j) => (Object.assign(Object.assign({}, acc), j)), {}),
14
+ }
15
+ : undefined;
16
+ }
17
+ function makeMessage(message, defaultName) {
18
+ return Object.assign(Object.assign({}, message), { name: message.name || defaultName, payload: {
19
+ type: message.payload,
20
+ }, headers: makeHeaders(message.headers) });
21
+ }
22
+ function AsyncApiOperationForMetaKey(metaKey, options) {
23
+ return (target, propertyKey, descriptor) => {
24
+ const methodName = `${target.constructor.name}#${String(propertyKey)}`;
25
+ const transformedOptions = options.map((i) => {
26
+ const message = Array.isArray(i.message)
27
+ ? {
28
+ oneOf: i.message.map((i, index) => makeMessage(i, `${methodName}#${index}`)),
29
+ }
30
+ : makeMessage(i.message, methodName);
31
+ const transformedOptionInstance = Object.assign(Object.assign({}, i), { message });
32
+ return transformedOptionInstance;
33
+ });
34
+ return (0, helpers_1.createMethodDecorator)(metaKey, transformedOptions)(target, propertyKey, descriptor);
35
+ };
36
+ }
37
+ exports.AsyncApiOperationForMetaKey = AsyncApiOperationForMetaKey;
38
+ //# sourceMappingURL=asyncapi-operation-for-meta-key.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asyncapi-operation-for-meta-key.decorator.js","sourceRoot":"","sources":["../../src/decorators/asyncapi-operation-for-meta-key.decorator.ts"],"names":[],"mappings":";;;AAAA,qEAAgF;AAShF,SAAS,WAAW,CAAC,OAAkC;IACrD,OAAO,OAAO;QACZ,CAAC,CAAC;YACE,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;iBAChC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;gBACtB,CAAC,GAAG,CAAC,kBACH,IAAI,EAAE,QAAQ,IACX,KAAK,CACT;aACF,CAAC,CAAC;iBACF,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,iCAAM,GAAG,GAAK,CAAC,EAAG,EAAE,EAAE,CAAC;SAC9C;QACH,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAED,SAAS,WAAW,CAClB,OAA2B,EAC3B,WAAmB;IAEnB,uCACK,OAAO,KACV,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,WAAW,EACjC,OAAO,EAAE;YACP,IAAI,EAAE,OAAO,CAAC,OAAO;SACtB,EACD,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,IACrC;AACJ,CAAC;AAED,SAAgB,2BAA2B,CACzC,OAAe,EACf,OAAmC;IAEnC,OAAO,CAAC,MAAM,EAAE,WAA4B,EAAE,UAAU,EAAE,EAAE;QAC1D,MAAM,UAAU,GAAG,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,IAAI,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;QAEvE,MAAM,kBAAkB,GAA2B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YACnE,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;gBACtC,CAAC,CAAC;oBACE,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAChC,WAAW,CAAC,CAAC,EAAE,GAAG,UAAU,IAAI,KAAK,EAAE,CAAC,CACzC;iBACF;gBACH,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;YAEvC,MAAM,yBAAyB,mCAC1B,CAAC,KACJ,OAAO,GACR,CAAC;YAEF,OAAO,yBAAyB,CAAC;QACnC,CAAC,CAAC,CAAC;QAEH,OAAO,IAAA,+BAAqB,EAAC,OAAO,EAAE,kBAAkB,CAAC,CACvD,MAAM,EACN,WAAW,EACX,UAAU,CACX,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AA9BD,kEA8BC"}
@@ -0,0 +1,2 @@
1
+ import { AsyncApiOperationOptions } from '../interface';
2
+ export declare function AsyncApiOperation(...options: AsyncApiOperationOptions[]): MethodDecorator;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AsyncApiOperation = void 0;
4
+ const asyncapi_constants_1 = require("../asyncapi.constants");
5
+ const asyncapi_operation_for_meta_key_decorator_1 = require("./asyncapi-operation-for-meta-key.decorator");
6
+ function AsyncApiOperation(...options) {
7
+ return (0, asyncapi_operation_for_meta_key_decorator_1.AsyncApiOperationForMetaKey)(asyncapi_constants_1.DECORATORS.AsyncApiOperation, options);
8
+ }
9
+ exports.AsyncApiOperation = AsyncApiOperation;
10
+ //# sourceMappingURL=asyncapi-operation.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asyncapi-operation.decorator.js","sourceRoot":"","sources":["../../src/decorators/asyncapi-operation.decorator.ts"],"names":[],"mappings":";;;AAAA,8DAAmD;AAEnD,2GAA0F;AAE1F,SAAgB,iBAAiB,CAC/B,GAAG,OAAmC;IAEtC,OAAO,IAAA,uEAA2B,EAAC,+BAAU,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;AAC5E,CAAC;AAJD,8CAIC"}
@@ -0,0 +1,2 @@
1
+ import { AsyncApiSpecificOperationOptions } from '../interface';
2
+ export declare function AsyncApiPub(...specificOperationOptions: AsyncApiSpecificOperationOptions[]): MethodDecorator;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AsyncApiPub = void 0;
4
+ const asyncapi_constants_1 = require("../asyncapi.constants");
5
+ const asyncapi_operation_for_meta_key_decorator_1 = require("./asyncapi-operation-for-meta-key.decorator");
6
+ function AsyncApiPub(...specificOperationOptions) {
7
+ const options = specificOperationOptions.map((i) => (Object.assign(Object.assign({}, i), { type: 'pub' })));
8
+ return (0, asyncapi_operation_for_meta_key_decorator_1.AsyncApiOperationForMetaKey)(asyncapi_constants_1.DECORATORS.AsyncApiPub, options);
9
+ }
10
+ exports.AsyncApiPub = AsyncApiPub;
11
+ //# sourceMappingURL=asyncapi-pub.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asyncapi-pub.decorator.js","sourceRoot":"","sources":["../../src/decorators/asyncapi-pub.decorator.ts"],"names":[],"mappings":";;;AAAA,8DAAmD;AAKnD,2GAA0F;AAE1F,SAAgB,WAAW,CACzB,GAAG,wBAA4D;IAE/D,MAAM,OAAO,GAA+B,wBAAwB,CAAC,GAAG,CACtE,CAAC,CAAC,EAAE,EAAE,CAAC,iCACF,CAAC,KACJ,IAAI,EAAE,KAAK,IACX,CACH,CAAC;IACF,OAAO,IAAA,uEAA2B,EAAC,+BAAU,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AACtE,CAAC;AAVD,kCAUC"}
@@ -0,0 +1 @@
1
+ export declare function AsyncApi(): MethodDecorator & ClassDecorator;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AsyncApi = void 0;
4
+ const helpers_1 = require("@nestjs/swagger/dist/decorators/helpers");
5
+ const asyncapi_constants_1 = require("../asyncapi.constants");
6
+ function AsyncApi() {
7
+ return (0, helpers_1.createMixedDecorator)(asyncapi_constants_1.DECORATORS.AsyncApiClass, true);
8
+ }
9
+ exports.AsyncApi = AsyncApi;
10
+ //# sourceMappingURL=asyncapi-service.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asyncapi-service.decorator.js","sourceRoot":"","sources":["../../src/decorators/asyncapi-service.decorator.ts"],"names":[],"mappings":";;;AAAA,qEAA+E;AAC/E,8DAAmD;AAKnD,SAAgB,QAAQ;IACtB,OAAO,IAAA,8BAAoB,EAAC,+BAAU,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;AAC9D,CAAC;AAFD,4BAEC"}
@@ -0,0 +1,2 @@
1
+ import { AsyncApiSpecificOperationOptions } from '../interface';
2
+ export declare function AsyncApiSub(...specificOperationOptions: AsyncApiSpecificOperationOptions[]): MethodDecorator;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AsyncApiSub = void 0;
4
+ const asyncapi_constants_1 = require("../asyncapi.constants");
5
+ const asyncapi_operation_for_meta_key_decorator_1 = require("./asyncapi-operation-for-meta-key.decorator");
6
+ function AsyncApiSub(...specificOperationOptions) {
7
+ const options = specificOperationOptions.map((i) => (Object.assign(Object.assign({}, i), { type: 'sub' })));
8
+ return (0, asyncapi_operation_for_meta_key_decorator_1.AsyncApiOperationForMetaKey)(asyncapi_constants_1.DECORATORS.AsyncApiSub, options);
9
+ }
10
+ exports.AsyncApiSub = AsyncApiSub;
11
+ //# sourceMappingURL=asyncapi-sub.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asyncapi-sub.decorator.js","sourceRoot":"","sources":["../../src/decorators/asyncapi-sub.decorator.ts"],"names":[],"mappings":";;;AAAA,8DAAmD;AAKnD,2GAA0F;AAE1F,SAAgB,WAAW,CACzB,GAAG,wBAA4D;IAE/D,MAAM,OAAO,GAA+B,wBAAwB,CAAC,GAAG,CACtE,CAAC,CAAC,EAAE,EAAE,CAAC,iCACF,CAAC,KACJ,IAAI,EAAE,KAAK,IACX,CACH,CAAC;IACF,OAAO,IAAA,uEAA2B,EAAC,+BAAU,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AACtE,CAAC;AAVD,kCAUC"}
@@ -0,0 +1,4 @@
1
+ export * from './asyncapi-service.decorator';
2
+ export * from './asyncapi-operation.decorator';
3
+ export * from './asyncapi-sub.decorator';
4
+ export * from './asyncapi-pub.decorator';
@@ -0,0 +1,21 @@
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("./asyncapi-service.decorator"), exports);
18
+ __exportStar(require("./asyncapi-operation.decorator"), exports);
19
+ __exportStar(require("./asyncapi-sub.decorator"), exports);
20
+ __exportStar(require("./asyncapi-pub.decorator"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+DAA6C;AAC7C,iEAA+C;AAC/C,2DAAyC;AACzC,2DAAyC"}
@@ -0,0 +1,5 @@
1
+ import { Type } from '@nestjs/common';
2
+ export declare const asyncApiClassAnnotationLabels: any[];
3
+ export declare const exploreAsyncapiClassMetadata: (metatype: Type<unknown>) => any;
4
+ export declare const exploreControllerMetadata: (metatype: Type<unknown>) => any;
5
+ export declare const exploreGatewayMetadata: (metatype: Type<unknown>) => any;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.exploreGatewayMetadata = exports.exploreControllerMetadata = exports.exploreAsyncapiClassMetadata = exports.asyncApiClassAnnotationLabels = void 0;
4
+ const constants_1 = require("@nestjs/common/constants");
5
+ const asyncapi_constants_1 = require("../asyncapi.constants");
6
+ let GATEWAY_METADATA;
7
+ try {
8
+ const wsConstants = require('@nestjs/websockets/constants');
9
+ GATEWAY_METADATA = wsConstants.GATEWAY_METADATA;
10
+ }
11
+ catch (_a) {
12
+ GATEWAY_METADATA = '__gateway__';
13
+ }
14
+ exports.asyncApiClassAnnotationLabels = [
15
+ asyncapi_constants_1.DECORATORS.AsyncApiClass,
16
+ constants_1.CONTROLLER_WATERMARK,
17
+ GATEWAY_METADATA,
18
+ ];
19
+ const exploreAsyncapiClassMetadata = (metatype) => {
20
+ return Reflect.getMetadata(asyncapi_constants_1.DECORATORS.AsyncApiClass, metatype);
21
+ };
22
+ exports.exploreAsyncapiClassMetadata = exploreAsyncapiClassMetadata;
23
+ const exploreControllerMetadata = (metatype) => {
24
+ return Reflect.getMetadata(constants_1.CONTROLLER_WATERMARK, metatype);
25
+ };
26
+ exports.exploreControllerMetadata = exploreControllerMetadata;
27
+ const exploreGatewayMetadata = (metatype) => {
28
+ return Reflect.getMetadata(GATEWAY_METADATA, metatype);
29
+ };
30
+ exports.exploreGatewayMetadata = exploreGatewayMetadata;
31
+ //# sourceMappingURL=asyncapi-class.explorer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asyncapi-class.explorer.js","sourceRoot":"","sources":["../../src/explorers/asyncapi-class.explorer.ts"],"names":[],"mappings":";;;AACA,wDAAgE;AAChE,8DAAmD;AAEnD,IAAI,gBAAgB,CAAC;AACrB,IAAI,CAAC;IAEH,MAAM,WAAW,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;IAC5D,gBAAgB,GAAG,WAAW,CAAC,gBAAgB,CAAC;AAClD,CAAC;AAAC,WAAM,CAAC;IACP,gBAAgB,GAAG,aAAa,CAAC;AACnC,CAAC;AAEY,QAAA,6BAA6B,GAAG;IAC3C,+BAAU,CAAC,aAAa;IACxB,gCAAoB;IACpB,gBAAgB;CACjB,CAAC;AAEK,MAAM,4BAA4B,GAAG,CAAC,QAAuB,EAAE,EAAE;IACtE,OAAO,OAAO,CAAC,WAAW,CAAC,+BAAU,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;AACjE,CAAC,CAAC;AAFW,QAAA,4BAA4B,gCAEvC;AAEK,MAAM,yBAAyB,GAAG,CAAC,QAAuB,EAAE,EAAE;IACnE,OAAO,OAAO,CAAC,WAAW,CAAC,gCAAoB,EAAE,QAAQ,CAAC,CAAC;AAC7D,CAAC,CAAC;AAFW,QAAA,yBAAyB,6BAEpC;AAEK,MAAM,sBAAsB,GAAG,CAAC,QAAuB,EAAE,EAAE;IAChE,OAAO,OAAO,CAAC,WAAW,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;AACzD,CAAC,CAAC;AAFW,QAAA,sBAAsB,0BAEjC"}
@@ -0,0 +1,17 @@
1
+ import { Type } from '@nestjs/common';
2
+ import { SchemaObject } from '@nestjs/swagger/dist/interfaces/open-api-spec.interface';
3
+ export declare const exploreAsyncApiOperationMetadata: (schemas: Record<string, SchemaObject>, _instance: object, _prototype: Type<unknown>, method: object) => {
4
+ [x: string]: string | {
5
+ channel: undefined;
6
+ type: undefined;
7
+ operationId?: string | undefined;
8
+ summary?: string | undefined;
9
+ description?: string | undefined;
10
+ tags?: import("../interface").AsyncTagObject[] | undefined;
11
+ externalDocs?: import("../interface").ExternalDocumentationObject | undefined;
12
+ bindings?: Record<string, import("../binding").KafkaOperationBinding | import("../binding").AmqpOperationBinding> | undefined;
13
+ traits?: Record<string, import("../interface").AsyncOperationTraitObject> | undefined;
14
+ message?: import("../interface").AsyncOperationMessage | undefined;
15
+ };
16
+ channel: string;
17
+ }[];
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.exploreAsyncApiOperationMetadata = void 0;
4
+ const asyncapi_constants_1 = require("../asyncapi.constants");
5
+ const services_1 = require("../services");
6
+ const operationObjectFactory = new services_1.OperationObjectFactory();
7
+ const exploreAsyncApiOperationMetadata = (schemas, _instance, _prototype, method) => {
8
+ const metadataOperations = Reflect.getMetadata(asyncapi_constants_1.DECORATORS.AsyncApiOperation, method);
9
+ const metadataSubs = Reflect.getMetadata(asyncapi_constants_1.DECORATORS.AsyncApiSub, method);
10
+ const metadataPubs = Reflect.getMetadata(asyncapi_constants_1.DECORATORS.AsyncApiPub, method);
11
+ const metadataCombined = [
12
+ ...(metadataOperations ? Object.values(metadataOperations) : []),
13
+ ...(metadataSubs ? Object.values(metadataSubs) : []),
14
+ ...(metadataPubs ? Object.values(metadataPubs) : []),
15
+ ];
16
+ return metadataCombined.map((option) => {
17
+ const { channel, type } = option;
18
+ const methodTypeData = Object.assign(Object.assign(Object.assign({}, option), operationObjectFactory.create(option, ['application/json'], schemas)), { channel: undefined, type: undefined });
19
+ return {
20
+ channel,
21
+ [type]: methodTypeData,
22
+ };
23
+ });
24
+ };
25
+ exports.exploreAsyncApiOperationMetadata = exploreAsyncApiOperationMetadata;
26
+ //# sourceMappingURL=asyncapi-operation.explorer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asyncapi-operation.explorer.js","sourceRoot":"","sources":["../../src/explorers/asyncapi-operation.explorer.ts"],"names":[],"mappings":";;;AAEA,8DAAmD;AAEnD,0CAAqD;AAErD,MAAM,sBAAsB,GAAG,IAAI,iCAAsB,EAAE,CAAC;AAEr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