@achinet/nestjs-async 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +31 -0
- package/CHANGELOG.md +6 -0
- package/dist/decorators/asyncapi-operation-for-meta-key.decorator.js +1 -2
- package/dist/decorators/asyncapi-operation-for-meta-key.decorator.js.map +1 -1
- package/dist/decorators/asyncapi-operation.decorator.js +1 -2
- package/dist/decorators/asyncapi-operation.decorator.js.map +1 -1
- package/dist/decorators/asyncapi-pub.decorator.js +1 -2
- package/dist/decorators/asyncapi-pub.decorator.js.map +1 -1
- package/dist/decorators/asyncapi-service.decorator.js +1 -2
- package/dist/decorators/asyncapi-service.decorator.js.map +1 -1
- package/dist/decorators/asyncapi-sub.decorator.js +1 -2
- package/dist/decorators/asyncapi-sub.decorator.js.map +1 -1
- package/dist/explorers/asyncapi-operation.explorer.d.ts +8 -8
- package/dist/sample/app.module.d.ts +2 -0
- package/dist/sample/app.module.js +20 -0
- package/dist/sample/app.module.js.map +1 -0
- package/dist/sample/common.d.ts +3 -0
- package/dist/sample/common.js +40 -0
- package/dist/sample/common.js.map +1 -0
- package/dist/sample/constants.d.ts +12 -0
- package/dist/sample/constants.js +16 -0
- package/dist/sample/constants.js.map +1 -0
- package/dist/sample/felines/class/cat.class.d.ts +4 -0
- package/dist/sample/felines/class/cat.class.js +24 -0
- package/dist/sample/felines/class/cat.class.js.map +1 -0
- package/dist/sample/felines/class/feline.class.d.ts +19 -0
- package/dist/sample/felines/class/feline.class.js +20 -0
- package/dist/sample/felines/class/feline.class.js.map +1 -0
- package/dist/sample/felines/class/index.d.ts +5 -0
- package/dist/sample/felines/class/index.js +22 -0
- package/dist/sample/felines/class/index.js.map +1 -0
- package/dist/sample/felines/class/lion.class.d.ts +4 -0
- package/dist/sample/felines/class/lion.class.js +8 -0
- package/dist/sample/felines/class/lion.class.js.map +1 -0
- package/dist/sample/felines/class/message.class.d.ts +7 -0
- package/dist/sample/felines/class/message.class.js +28 -0
- package/dist/sample/felines/class/message.class.js.map +1 -0
- package/dist/sample/felines/class/tiger.class.d.ts +4 -0
- package/dist/sample/felines/class/tiger.class.js +8 -0
- package/dist/sample/felines/class/tiger.class.js.map +1 -0
- package/dist/sample/felines/dto/create-feline.dto.d.ts +4 -0
- package/dist/sample/felines/dto/create-feline.dto.js +28 -0
- package/dist/sample/felines/dto/create-feline.dto.js.map +1 -0
- package/dist/sample/felines/dto/index.d.ts +2 -0
- package/dist/sample/felines/dto/index.js +19 -0
- package/dist/sample/felines/dto/index.js.map +1 -0
- package/dist/sample/felines/dto/journaling-data.dto.d.ts +4 -0
- package/dist/sample/felines/dto/journaling-data.dto.js +8 -0
- package/dist/sample/felines/dto/journaling-data.dto.js.map +1 -0
- package/dist/sample/felines/felines.constants.d.ts +1 -0
- package/dist/sample/felines/felines.constants.js +5 -0
- package/dist/sample/felines/felines.constants.js.map +1 -0
- package/dist/sample/felines/felines.controller.d.ts +15 -0
- package/dist/sample/felines/felines.controller.js +101 -0
- package/dist/sample/felines/felines.controller.js.map +1 -0
- package/dist/sample/felines/felines.gateway.d.ts +16 -0
- package/dist/sample/felines/felines.gateway.js +90 -0
- package/dist/sample/felines/felines.gateway.js.map +1 -0
- package/dist/sample/felines/felines.module.d.ts +2 -0
- package/dist/sample/felines/felines.module.js +28 -0
- package/dist/sample/felines/felines.module.js.map +1 -0
- package/dist/sample/felines/felines.service.d.ts +8 -0
- package/dist/sample/felines/felines.service.js +33 -0
- package/dist/sample/felines/felines.service.js.map +1 -0
- package/dist/sample/felines/rto/feline.rto.d.ts +7 -0
- package/dist/sample/felines/rto/feline.rto.js +31 -0
- package/dist/sample/felines/rto/feline.rto.js.map +1 -0
- package/dist/sample/felines/rto/index.d.ts +1 -0
- package/dist/sample/felines/rto/index.js +18 -0
- package/dist/sample/felines/rto/index.js.map +1 -0
- package/dist/sample/index.d.ts +3 -0
- package/dist/sample/index.js +20 -0
- package/dist/sample/index.js.map +1 -0
- package/dist/sample/main.d.ts +1 -0
- package/dist/sample/main.js +30 -0
- package/dist/sample/main.js.map +1 -0
- package/dist/src/asyncapi-document.builder.d.ts +27 -0
- package/dist/src/asyncapi-document.builder.js +110 -0
- package/dist/src/asyncapi-document.builder.js.map +1 -0
- package/dist/src/asyncapi.constants.d.ts +6 -0
- package/dist/src/asyncapi.constants.js +11 -0
- package/dist/src/asyncapi.constants.js.map +1 -0
- package/dist/src/asyncapi.module.d.ts +8 -0
- package/dist/src/asyncapi.module.js +47 -0
- package/dist/src/asyncapi.module.js.map +1 -0
- package/dist/src/binding/asyncapi.amqp.interfaces.d.ts +38 -0
- package/dist/src/binding/asyncapi.amqp.interfaces.js +3 -0
- package/dist/src/binding/asyncapi.amqp.interfaces.js.map +1 -0
- package/dist/src/binding/asyncapi.kafka.interfaces.d.ts +21 -0
- package/dist/src/binding/asyncapi.kafka.interfaces.js +3 -0
- package/dist/src/binding/asyncapi.kafka.interfaces.js.map +1 -0
- package/dist/src/binding/index.d.ts +2 -0
- package/dist/src/binding/index.js +19 -0
- package/dist/src/binding/index.js.map +1 -0
- package/dist/src/decorators/asyncapi-operation-for-meta-key.decorator.d.ts +2 -0
- package/dist/src/decorators/asyncapi-operation-for-meta-key.decorator.js +37 -0
- package/dist/src/decorators/asyncapi-operation-for-meta-key.decorator.js.map +1 -0
- package/dist/src/decorators/asyncapi-operation.decorator.d.ts +2 -0
- package/dist/src/decorators/asyncapi-operation.decorator.js +9 -0
- package/dist/src/decorators/asyncapi-operation.decorator.js.map +1 -0
- package/dist/src/decorators/asyncapi-pub.decorator.d.ts +2 -0
- package/dist/src/decorators/asyncapi-pub.decorator.js +10 -0
- package/dist/src/decorators/asyncapi-pub.decorator.js.map +1 -0
- package/dist/src/decorators/asyncapi-service.decorator.d.ts +1 -0
- package/dist/src/decorators/asyncapi-service.decorator.js +9 -0
- package/dist/src/decorators/asyncapi-service.decorator.js.map +1 -0
- package/dist/src/decorators/asyncapi-sub.decorator.d.ts +2 -0
- package/dist/src/decorators/asyncapi-sub.decorator.js +10 -0
- package/dist/src/decorators/asyncapi-sub.decorator.js.map +1 -0
- package/dist/src/decorators/index.d.ts +4 -0
- package/dist/src/decorators/index.js +21 -0
- package/dist/src/decorators/index.js.map +1 -0
- package/dist/src/explorers/asyncapi-class.explorer.d.ts +5 -0
- package/dist/src/explorers/asyncapi-class.explorer.js +27 -0
- package/dist/src/explorers/asyncapi-class.explorer.js.map +1 -0
- package/dist/src/explorers/asyncapi-operation.explorer.d.ts +17 -0
- package/dist/src/explorers/asyncapi-operation.explorer.js +26 -0
- package/dist/src/explorers/asyncapi-operation.explorer.js.map +1 -0
- package/dist/src/explorers/index.d.ts +2 -0
- package/dist/src/explorers/index.js +19 -0
- package/dist/src/explorers/index.js.map +1 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.js +21 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/interface/asyncapi-common.interfaces.d.ts +126 -0
- package/dist/src/interface/asyncapi-common.interfaces.js +3 -0
- package/dist/src/interface/asyncapi-common.interfaces.js.map +1 -0
- package/dist/src/interface/asyncapi-document-options.interface.d.ts +3 -0
- package/dist/src/interface/asyncapi-document-options.interface.js +3 -0
- package/dist/src/interface/asyncapi-document-options.interface.js.map +1 -0
- package/dist/src/interface/asyncapi-message.interface.d.ts +8 -0
- package/dist/src/interface/asyncapi-message.interface.js +3 -0
- package/dist/src/interface/asyncapi-message.interface.js.map +1 -0
- package/dist/src/interface/asyncapi-operation-headers.interface.d.ts +6 -0
- package/dist/src/interface/asyncapi-operation-headers.interface.js +3 -0
- package/dist/src/interface/asyncapi-operation-headers.interface.js.map +1 -0
- package/dist/src/interface/asyncapi-operation-options-raw.interface.d.ts +21 -0
- package/dist/src/interface/asyncapi-operation-options-raw.interface.js +3 -0
- package/dist/src/interface/asyncapi-operation-options-raw.interface.js.map +1 -0
- package/dist/src/interface/asyncapi-operation-options.interface.d.ts +8 -0
- package/dist/src/interface/asyncapi-operation-options.interface.js +3 -0
- package/dist/src/interface/asyncapi-operation-options.interface.js.map +1 -0
- package/dist/src/interface/asyncapi-operation-payload.interface.d.ts +2 -0
- package/dist/src/interface/asyncapi-operation-payload.interface.js +3 -0
- package/dist/src/interface/asyncapi-operation-payload.interface.js.map +1 -0
- package/dist/src/interface/asyncapi-server.interface.d.ts +10 -0
- package/dist/src/interface/asyncapi-server.interface.js +3 -0
- package/dist/src/interface/asyncapi-server.interface.js.map +1 -0
- package/dist/src/interface/asyncapi-template-options.interface.d.ts +7 -0
- package/dist/src/interface/asyncapi-template-options.interface.js +3 -0
- package/dist/src/interface/asyncapi-template-options.interface.js.map +1 -0
- package/dist/src/interface/denormalized-doc-resolvers.interface.d.ts +6 -0
- package/dist/src/interface/denormalized-doc-resolvers.interface.js +3 -0
- package/dist/src/interface/denormalized-doc-resolvers.interface.js.map +1 -0
- package/dist/src/interface/denormalized-doc.interface.d.ts +10 -0
- package/dist/src/interface/denormalized-doc.interface.js +3 -0
- package/dist/src/interface/denormalized-doc.interface.js.map +1 -0
- package/dist/src/interface/generator-options.interface.d.ts +22 -0
- package/dist/src/interface/generator-options.interface.js +3 -0
- package/dist/src/interface/generator-options.interface.js.map +1 -0
- package/dist/src/interface/index.d.ts +11 -0
- package/dist/src/interface/index.js +28 -0
- package/dist/src/interface/index.js.map +1 -0
- package/dist/src/services/asyncapi.explorer.d.ts +12 -0
- package/dist/src/services/asyncapi.explorer.js +69 -0
- package/dist/src/services/asyncapi.explorer.js.map +1 -0
- package/dist/src/services/asyncapi.generator.d.ts +6 -0
- package/dist/src/services/asyncapi.generator.js +68 -0
- package/dist/src/services/asyncapi.generator.js.map +1 -0
- package/dist/src/services/asyncapi.scanner.d.ts +14 -0
- package/dist/src/services/asyncapi.scanner.js +71 -0
- package/dist/src/services/asyncapi.scanner.js.map +1 -0
- package/dist/src/services/asyncapi.transformer.d.ts +4 -0
- package/dist/src/services/asyncapi.transformer.js +33 -0
- package/dist/src/services/asyncapi.transformer.js.map +1 -0
- package/dist/src/services/index.d.ts +4 -0
- package/dist/src/services/index.js +21 -0
- package/dist/src/services/index.js.map +1 -0
- package/dist/src/services/operation-object.factory.d.ts +9 -0
- package/dist/src/services/operation-object.factory.js +37 -0
- package/dist/src/services/operation-object.factory.js.map +1 -0
- package/dist/test/configs/jest-base.config.d.ts +3 -0
- package/dist/test/configs/jest-base.config.js +20 -0
- package/dist/test/configs/jest-base.config.js.map +1 -0
- package/dist/test/configs/jest-e2e.config.d.ts +3 -0
- package/dist/test/configs/jest-e2e.config.js +16 -0
- package/dist/test/configs/jest-e2e.config.js.map +1 -0
- package/dist/test/express.e2e-spec.d.ts +1 -0
- package/dist/test/express.e2e-spec.js +89 -0
- package/dist/test/express.e2e-spec.js.map +1 -0
- package/dist/test/fastify.e2e-spec.d.ts +1 -0
- package/dist/test/fastify.e2e-spec.js +57 -0
- package/dist/test/fastify.e2e-spec.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/misc/references/ref.html +303 -0
- package/misc/references/ref.json +1 -0
- package/misc/references/ref.yaml +292 -0
- package/misc/take-snaphots.sh +8 -0
- package/package.json +18 -11
- package/sample/app.module.ts +7 -0
- package/sample/common.ts +49 -0
- package/sample/constants.ts +12 -0
- package/sample/felines/class/cat.class.ts +9 -0
- package/sample/felines/class/feline.class.ts +29 -0
- package/sample/felines/class/index.ts +5 -0
- package/sample/felines/class/lion.class.ts +5 -0
- package/sample/felines/class/message.class.ts +17 -0
- package/sample/felines/class/tiger.class.ts +5 -0
- package/sample/felines/dto/create-feline.dto.ts +13 -0
- package/sample/felines/dto/index.ts +2 -0
- package/sample/felines/dto/journaling-data.dto.ts +5 -0
- package/sample/felines/felines.constants.ts +1 -0
- package/sample/felines/felines.controller.ts +76 -0
- package/sample/felines/felines.gateway.ts +76 -0
- package/sample/felines/felines.module.ts +15 -0
- package/sample/felines/felines.service.ts +24 -0
- package/sample/felines/rto/feline.rto.ts +17 -0
- package/sample/felines/rto/index.ts +1 -0
- package/sample/index.ts +3 -0
- package/sample/main.ts +34 -0
- package/src/asyncapi-document.builder.ts +5 -19
- package/src/asyncapi.module.ts +5 -16
- package/src/decorators/asyncapi-operation-for-meta-key.decorator.ts +4 -16
- package/src/decorators/asyncapi-operation.decorator.ts +1 -3
- package/src/decorators/asyncapi-pub.decorator.ts +6 -13
- package/src/decorators/asyncapi-sub.decorator.ts +6 -13
- package/src/explorers/asyncapi-class.explorer.ts +2 -6
- package/src/explorers/asyncapi-operation.explorer.ts +3 -12
- package/src/interface/asyncapi-common.interfaces.ts +1 -4
- package/src/interface/asyncapi-operation-options.interface.ts +2 -4
- package/src/interface/asyncapi-operation-payload.interface.ts +1 -5
- package/src/interface/asyncapi-server.interface.ts +1 -4
- package/src/interface/asyncapi-template-options.interface.ts +5 -5
- package/src/interface/denormalized-doc.interface.ts +1 -5
- package/src/services/asyncapi.explorer.ts +25 -34
- package/src/services/asyncapi.generator.ts +28 -16
- package/src/services/asyncapi.scanner.ts +39 -89
- package/src/services/asyncapi.transformer.ts +2 -8
- package/src/services/index.ts +0 -1
- package/test/__mocks__/@asyncapi/generator.js +41 -0
- package/test/configs/jest-base.config.ts +19 -0
- package/test/configs/jest-e2e.config.js +7 -0
- package/test/configs/jest-e2e.config.ts +19 -0
- package/test/configs/jest-swagger-plugin.js +16 -0
- package/test/express.e2e-spec.ts +64 -0
- package/test/fastify.e2e-spec.ts +65 -0
|
@@ -0,0 +1,47 @@
|
|
|
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.AsyncApiModule = void 0;
|
|
7
|
+
const common_1 = require("@nestjs/common");
|
|
8
|
+
const validate_path_util_1 = require("@nestjs/swagger/dist/utils/validate-path.util");
|
|
9
|
+
const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
10
|
+
const services_1 = require("./services");
|
|
11
|
+
class AsyncApiModule {
|
|
12
|
+
static createDocument(app, config, options = {}) {
|
|
13
|
+
const asyncapiScanner = new services_1.AsyncapiScanner();
|
|
14
|
+
const document = asyncapiScanner.scanApplication(app, options);
|
|
15
|
+
document.components = Object.assign(Object.assign({}, (config.components || {})), document.components);
|
|
16
|
+
return Object.assign(Object.assign({}, config), document);
|
|
17
|
+
}
|
|
18
|
+
static async composeHtml(contract, templateOptions) {
|
|
19
|
+
const generator = new services_1.AsyncapiGenerator(templateOptions);
|
|
20
|
+
return generator.generate(contract).catch((err) => {
|
|
21
|
+
this.logger.error(err);
|
|
22
|
+
throw err;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
static async setup(path, app, document, templateOptions) {
|
|
26
|
+
const httpAdapter = app.getHttpAdapter();
|
|
27
|
+
const finalPath = (0, validate_path_util_1.validatePath)(path);
|
|
28
|
+
const html = await this.composeHtml(document, templateOptions);
|
|
29
|
+
const yamlDocument = js_yaml_1.default.dump(document);
|
|
30
|
+
const jsonDocument = JSON.stringify(document);
|
|
31
|
+
httpAdapter.get(finalPath, (req, res) => {
|
|
32
|
+
res.type('text/html');
|
|
33
|
+
res.send(html);
|
|
34
|
+
});
|
|
35
|
+
httpAdapter.get(`${finalPath}-json`, (req, res) => {
|
|
36
|
+
res.type('application/json');
|
|
37
|
+
res.send(jsonDocument);
|
|
38
|
+
});
|
|
39
|
+
httpAdapter.get(`${finalPath}-yaml`, (req, res) => {
|
|
40
|
+
res.type('text/yaml');
|
|
41
|
+
res.send(yamlDocument);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.AsyncApiModule = AsyncApiModule;
|
|
46
|
+
AsyncApiModule.logger = new common_1.Logger(AsyncApiModule.name);
|
|
47
|
+
//# sourceMappingURL=asyncapi.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asyncapi.module.js","sourceRoot":"","sources":["../../src/asyncapi.module.ts"],"names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,WAAW,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YACtC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACtB,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC,CAAC,CAAC;QAEH,WAAW,CAAC,GAAG,CAAC,GAAG,SAAS,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,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,GAAG,SAAS,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;;AAzDH,wCA0DC;AAzDyB,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 @@
|
|
|
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 @@
|
|
|
1
|
+
{"version":3,"file":"asyncapi.kafka.interfaces.js","sourceRoot":"","sources":["../../../src/binding/asyncapi.kafka.interfaces.ts"],"names":[],"mappings":""}
|
|
@@ -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,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AsyncApiOperationForMetaKey = AsyncApiOperationForMetaKey;
|
|
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((j, index) => makeMessage(j, `${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
|
+
//# 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":";;AAoCA,kEAqBC;AAzDD,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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C,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;IAC7F,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AsyncApiOperation = AsyncApiOperation;
|
|
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
|
+
//# 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":";;AAIA,8CAEC;AAND,8DAAmD;AAEnD,2GAA0F;AAE1F,SAAgB,iBAAiB,CAAC,GAAG,OAAmC;IACtE,OAAO,IAAA,uEAA2B,EAAC,+BAAU,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;AAC5E,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AsyncApiPub = AsyncApiPub;
|
|
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
|
+
//# 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":";;AAIA,kCAMC;AAVD,8DAAmD;AAEnD,2GAA0F;AAE1F,SAAgB,WAAW,CAAC,GAAG,wBAA4D;IACzF,MAAM,OAAO,GAA+B,wBAAwB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iCAC3E,CAAC,KACJ,IAAI,EAAE,KAAK,IACX,CAAC,CAAC;IACJ,OAAO,IAAA,uEAA2B,EAAC,+BAAU,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AACtE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function AsyncApi(): MethodDecorator & ClassDecorator;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AsyncApi = AsyncApi;
|
|
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
|
+
//# 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":";;AAMA,4BAEC;AARD,qEAA+E;AAC/E,8DAAmD;AAKnD,SAAgB,QAAQ;IACtB,OAAO,IAAA,8BAAoB,EAAC,+BAAU,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AsyncApiSub = AsyncApiSub;
|
|
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
|
+
//# 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":";;AAIA,kCAMC;AAVD,8DAAmD;AAEnD,2GAA0F;AAE1F,SAAgB,WAAW,CAAC,GAAG,wBAA4D;IACzF,MAAM,OAAO,GAA+B,wBAAwB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iCAC3E,CAAC,KACJ,IAAI,EAAE,KAAK,IACX,CAAC,CAAC;IACJ,OAAO,IAAA,uEAA2B,EAAC,+BAAU,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AACtE,CAAC"}
|
|
@@ -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,27 @@
|
|
|
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 = [asyncapi_constants_1.DECORATORS.AsyncApiClass, constants_1.CONTROLLER_WATERMARK, GATEWAY_METADATA];
|
|
15
|
+
const exploreAsyncapiClassMetadata = (metatype) => {
|
|
16
|
+
return Reflect.getMetadata(asyncapi_constants_1.DECORATORS.AsyncApiClass, metatype);
|
|
17
|
+
};
|
|
18
|
+
exports.exploreAsyncapiClassMetadata = exploreAsyncapiClassMetadata;
|
|
19
|
+
const exploreControllerMetadata = (metatype) => {
|
|
20
|
+
return Reflect.getMetadata(constants_1.CONTROLLER_WATERMARK, metatype);
|
|
21
|
+
};
|
|
22
|
+
exports.exploreControllerMetadata = exploreControllerMetadata;
|
|
23
|
+
const exploreGatewayMetadata = (metatype) => {
|
|
24
|
+
return Reflect.getMetadata(GATEWAY_METADATA, metatype);
|
|
25
|
+
};
|
|
26
|
+
exports.exploreGatewayMetadata = exploreGatewayMetadata;
|
|
27
|
+
//# 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,CAAC,+BAAU,CAAC,aAAa,EAAE,gCAAoB,EAAE,gBAAgB,CAAC,CAAC;AAEzG,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;
|
|
8
|
+
summary?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
tags?: import("../interface").AsyncTagObject[];
|
|
11
|
+
externalDocs?: import("../interface").ExternalDocumentationObject;
|
|
12
|
+
bindings?: Record<string, import("../binding").KafkaOperationBinding | import("../binding").AmqpOperationBinding>;
|
|
13
|
+
traits?: Record<string, import("../interface").AsyncOperationTraitObject>;
|
|
14
|
+
message?: import("../interface").AsyncOperationMessage;
|
|
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,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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-operation.explorer"), exports);
|
|
18
|
+
__exportStar(require("./asyncapi-class.explorer"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/explorers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gEAA8C;AAC9C,4DAA0C"}
|
|
@@ -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-document.builder"), exports);
|
|
18
|
+
__exportStar(require("./interface"), exports);
|
|
19
|
+
__exportStar(require("./asyncapi.module"), exports);
|
|
20
|
+
__exportStar(require("./decorators"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA4C;AAC5C,8CAA4B;AAC5B,oDAAkC;AAClC,+CAA6B"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { InfoObject, ReferenceObject, SchemaObject, ServerVariableObject } from '@nestjs/swagger/dist/interfaces/open-api-spec.interface';
|
|
2
|
+
import { AmqpChannelBinding, AmqpMessageBinding, AmqpOperationBinding, AmqpServerBinding, KafkaChannelBinding, KafkaMessageBinding, KafkaOperationBinding, KafkaServerBinding } from '../binding';
|
|
3
|
+
import { AsyncOperationPayload } from './asyncapi-operation-payload.interface';
|
|
4
|
+
import { AsyncServerObject } from './asyncapi-server.interface';
|
|
5
|
+
export interface AsyncApiDocument {
|
|
6
|
+
asyncapi: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
info: InfoObject;
|
|
9
|
+
servers?: Record<string, AsyncServerObject>;
|
|
10
|
+
channels: AsyncChannelsObject;
|
|
11
|
+
components?: AsyncComponentsObject;
|
|
12
|
+
tags?: AsyncTagObject[];
|
|
13
|
+
externalDocs?: ExternalDocumentationObject;
|
|
14
|
+
defaultContentType?: string;
|
|
15
|
+
}
|
|
16
|
+
export type AsyncChannelsObject = Record<string, AsyncChannelObject>;
|
|
17
|
+
export interface AsyncChannelObject {
|
|
18
|
+
description?: string;
|
|
19
|
+
subscribe?: AsyncOperationObject;
|
|
20
|
+
publish?: AsyncOperationObject;
|
|
21
|
+
parameters?: Record<string, ParameterObject>;
|
|
22
|
+
bindings?: Record<string, KafkaChannelBinding | AmqpChannelBinding>;
|
|
23
|
+
}
|
|
24
|
+
export interface AsyncServerVariableObject extends ServerVariableObject {
|
|
25
|
+
examples?: string[];
|
|
26
|
+
}
|
|
27
|
+
export type SecurityObject = Record<string, string[]>;
|
|
28
|
+
export interface AsyncComponentsObject {
|
|
29
|
+
schemas?: Record<string, SchemaObject>;
|
|
30
|
+
messages?: Record<string, AsyncMessageObject>;
|
|
31
|
+
securitySchemes?: Record<string, AsyncSecuritySchemeObject>;
|
|
32
|
+
parameters?: Record<string, ParameterObject>;
|
|
33
|
+
correlationIds?: Record<string, AsyncCorrelationObject>;
|
|
34
|
+
operationTraits?: Record<string, AsyncOperationTraitObject>;
|
|
35
|
+
messageTraits?: Record<string, AsyncMessageTraitObject>;
|
|
36
|
+
serverBindings?: Record<string, KafkaServerBinding | AmqpServerBinding>;
|
|
37
|
+
channelBindings?: Record<string, KafkaChannelBinding | AmqpChannelBinding>;
|
|
38
|
+
operationBindings?: Record<string, KafkaOperationBinding | AmqpOperationBinding>;
|
|
39
|
+
messageBindings?: Record<string, KafkaMessageBinding | AmqpMessageBinding>;
|
|
40
|
+
}
|
|
41
|
+
export interface AsyncMessageObject extends AsyncMessageTraitObject {
|
|
42
|
+
payload?: {
|
|
43
|
+
type?: AsyncOperationPayload;
|
|
44
|
+
$ref?: AsyncOperationPayload;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export type MessageType = AsyncMessageObject | ReferenceObject;
|
|
48
|
+
export interface OneOfMessageType {
|
|
49
|
+
oneOf: MessageType[];
|
|
50
|
+
}
|
|
51
|
+
export type AsyncOperationMessage = OneOfMessageType | MessageType;
|
|
52
|
+
export interface AsyncOperationObject {
|
|
53
|
+
channel: string;
|
|
54
|
+
operationId?: string;
|
|
55
|
+
summary?: string;
|
|
56
|
+
description?: string;
|
|
57
|
+
tags?: AsyncTagObject[];
|
|
58
|
+
externalDocs?: ExternalDocumentationObject;
|
|
59
|
+
bindings?: Record<string, KafkaOperationBinding | AmqpOperationBinding>;
|
|
60
|
+
traits?: Record<string, AsyncOperationTraitObject>;
|
|
61
|
+
message?: AsyncOperationMessage;
|
|
62
|
+
}
|
|
63
|
+
export interface AsyncOperationTraitObject {
|
|
64
|
+
operationId?: string;
|
|
65
|
+
summary?: string;
|
|
66
|
+
description?: string;
|
|
67
|
+
tags?: AsyncTagObject[];
|
|
68
|
+
externalDocs?: ExternalDocumentationObject;
|
|
69
|
+
bindings?: Record<string, KafkaOperationBinding | AmqpOperationBinding>;
|
|
70
|
+
}
|
|
71
|
+
export interface AsyncMessageTraitObject {
|
|
72
|
+
headers?: SchemaObject;
|
|
73
|
+
correlationId?: AsyncCorrelationObject;
|
|
74
|
+
schemaFormat?: string;
|
|
75
|
+
contentType?: string;
|
|
76
|
+
name?: string;
|
|
77
|
+
title?: string;
|
|
78
|
+
summary?: string;
|
|
79
|
+
description?: string;
|
|
80
|
+
tags?: AsyncTagObject[];
|
|
81
|
+
externalDocs?: ExternalDocumentationObject;
|
|
82
|
+
bindings?: Record<string, KafkaMessageBinding | AmqpMessageBinding>;
|
|
83
|
+
}
|
|
84
|
+
export interface AsyncCorrelationObject {
|
|
85
|
+
description?: string;
|
|
86
|
+
location: string;
|
|
87
|
+
}
|
|
88
|
+
export interface AsyncTagObject {
|
|
89
|
+
name: string;
|
|
90
|
+
description?: string;
|
|
91
|
+
externalDocs?: ExternalDocumentationObject;
|
|
92
|
+
}
|
|
93
|
+
export interface AsyncSecuritySchemeObject {
|
|
94
|
+
type: SecuritySchemeType;
|
|
95
|
+
description?: string;
|
|
96
|
+
name?: string;
|
|
97
|
+
in?: string;
|
|
98
|
+
scheme?: string;
|
|
99
|
+
bearerFormat?: string;
|
|
100
|
+
flows?: OAuthFlowsObject;
|
|
101
|
+
openIdConnectUrl?: string;
|
|
102
|
+
}
|
|
103
|
+
export declare type SecuritySchemeType = 'userPassword' | 'apiKey' | 'X509' | 'symmetricEncryption' | 'asymmetricEncryption' | 'http' | 'oauth2' | 'openIdConnect';
|
|
104
|
+
export interface OAuthFlowsObject {
|
|
105
|
+
implicit?: OAuthFlowObject;
|
|
106
|
+
password?: OAuthFlowObject;
|
|
107
|
+
clientCredentials?: OAuthFlowObject;
|
|
108
|
+
authorizationCode?: OAuthFlowObject;
|
|
109
|
+
}
|
|
110
|
+
export interface OAuthFlowObject {
|
|
111
|
+
authorizationUrl?: string;
|
|
112
|
+
tokenUrl?: string;
|
|
113
|
+
refreshUrl?: string;
|
|
114
|
+
scopes: ScopesObject;
|
|
115
|
+
}
|
|
116
|
+
export type ScopesObject = Record<string, unknown>;
|
|
117
|
+
export type ParameterObject = BaseParameterObject;
|
|
118
|
+
export interface BaseParameterObject {
|
|
119
|
+
description?: string;
|
|
120
|
+
schema?: SchemaObject | ReferenceObject;
|
|
121
|
+
location?: string;
|
|
122
|
+
}
|
|
123
|
+
export interface ExternalDocumentationObject {
|
|
124
|
+
description?: string;
|
|
125
|
+
url: string;
|
|
126
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asyncapi-common.interfaces.js","sourceRoot":"","sources":["../../../src/interface/asyncapi-common.interfaces.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asyncapi-document-options.interface.js","sourceRoot":"","sources":["../../../src/interface/asyncapi-document-options.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AsyncApiOperationHeaders } from './asyncapi-operation-headers.interface';
|
|
2
|
+
import { AsyncOperationPayload } from './asyncapi-operation-payload.interface';
|
|
3
|
+
export interface OneAsyncApiMessage {
|
|
4
|
+
name?: string;
|
|
5
|
+
payload: AsyncOperationPayload;
|
|
6
|
+
headers?: AsyncApiOperationHeaders;
|
|
7
|
+
}
|
|
8
|
+
export type AsyncApiMessage = OneAsyncApiMessage | OneAsyncApiMessage[];
|