@asyncapi-actions-test/trusted-publishing-test_asyncapi-cli 4.1.3
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/LICENSE +201 -0
- package/README.md +117 -0
- package/assets/create-template/templates/default/asyncapi.yaml +34 -0
- package/assets/create-template/templates/default/package-lock.json +4062 -0
- package/assets/create-template/templates/default/package.json +10 -0
- package/assets/create-template/templates/default/readme.md +4 -0
- package/assets/create-template/templates/default/template/index.js +11 -0
- package/assets/examples/adeo-kafka-request-reply-asyncapi.yml +298 -0
- package/assets/examples/anyof-asyncapi.yml +36 -0
- package/assets/examples/application-headers-asyncapi.yml +86 -0
- package/assets/examples/correlation-id-asyncapi.yml +180 -0
- package/assets/examples/default-example.json +51 -0
- package/assets/examples/default-example.yaml +31 -0
- package/assets/examples/examples.json +82 -0
- package/assets/examples/gitter-streaming-asyncapi.yml +178 -0
- package/assets/examples/kraken-websocket-request-reply-message-filter-in-reply-asyncapi.yml +388 -0
- package/assets/examples/kraken-websocket-request-reply-multiple-channels-asyncapi.yml +394 -0
- package/assets/examples/mercure-asyncapi.yml +58 -0
- package/assets/examples/not-asyncapi.yml +29 -0
- package/assets/examples/oneof-asyncapi.yml +57 -0
- package/assets/examples/operation-security-asyncapi.yml +117 -0
- package/assets/examples/rpc-client-asyncapi.yml +72 -0
- package/assets/examples/rpc-server-asyncapi.yml +69 -0
- package/assets/examples/simple-asyncapi.yml +31 -0
- package/assets/examples/slack-rtm-asyncapi.yml +982 -0
- package/assets/examples/streetlights-kafka-asyncapi.yml +199 -0
- package/assets/examples/streetlights-mqtt-asyncapi.yml +253 -0
- package/assets/examples/streetlights-operation-security-asyncapi.yml +240 -0
- package/assets/examples/tutorial.yml +41 -0
- package/assets/examples/websocket-gemini-asyncapi.yml +301 -0
- package/assets/logo.png +0 -0
- package/assets/server-api.png +0 -0
- package/bin/dev +17 -0
- package/bin/dev.cmd +3 -0
- package/bin/run +12 -0
- package/bin/run.cmd +3 -0
- package/bin/run_bin +13 -0
- package/bin/run_bin.cmd +3 -0
- package/lib/apps/api/app.d.ts +15 -0
- package/lib/apps/api/app.js +91 -0
- package/lib/apps/api/configs/development.json +16 -0
- package/lib/apps/api/configs/production.json +16 -0
- package/lib/apps/api/configs/test.json +16 -0
- package/lib/apps/api/constants.d.ts +1 -0
- package/lib/apps/api/constants.js +4 -0
- package/lib/apps/api/controllers/bundle.controller.d.ts +7 -0
- package/lib/apps/api/controllers/bundle.controller.js +44 -0
- package/lib/apps/api/controllers/convert.controller.d.ts +11 -0
- package/lib/apps/api/controllers/convert.controller.js +69 -0
- package/lib/apps/api/controllers/diff.controller.d.ts +7 -0
- package/lib/apps/api/controllers/diff.controller.js +42 -0
- package/lib/apps/api/controllers/docs.controller.d.ts +6 -0
- package/lib/apps/api/controllers/docs.controller.js +24 -0
- package/lib/apps/api/controllers/generate.controller.d.ts +22 -0
- package/lib/apps/api/controllers/generate.controller.js +174 -0
- package/lib/apps/api/controllers/help.controller.d.ts +6 -0
- package/lib/apps/api/controllers/help.controller.js +101 -0
- package/lib/apps/api/controllers/parse.controller.d.ts +10 -0
- package/lib/apps/api/controllers/parse.controller.js +35 -0
- package/lib/apps/api/controllers/validate.controller.d.ts +10 -0
- package/lib/apps/api/controllers/validate.controller.js +50 -0
- package/lib/apps/api/controllers/version.controller.d.ts +8 -0
- package/lib/apps/api/controllers/version.controller.js +69 -0
- package/lib/apps/api/exceptions/problem.exception.d.ts +14 -0
- package/lib/apps/api/exceptions/problem.exception.js +10 -0
- package/lib/apps/api/index.d.ts +10 -0
- package/lib/apps/api/index.js +23 -0
- package/lib/apps/api/middlewares/logger.middleware.d.ts +2 -0
- package/lib/apps/api/middlewares/logger.middleware.js +12 -0
- package/lib/apps/api/middlewares/problem.middleware.d.ts +6 -0
- package/lib/apps/api/middlewares/problem.middleware.js +27 -0
- package/lib/apps/api/middlewares/validation.middleware.d.ts +12 -0
- package/lib/apps/api/middlewares/validation.middleware.js +245 -0
- package/lib/apps/api/server.d.ts +3 -0
- package/lib/apps/api/server.js +19 -0
- package/lib/apps/cli/commands/bundle.d.ts +15 -0
- package/lib/apps/cli/commands/bundle.js +75 -0
- package/lib/apps/cli/commands/config/analytics.d.ts +11 -0
- package/lib/apps/cli/commands/config/analytics.js +61 -0
- package/lib/apps/cli/commands/config/auth/add.d.ts +13 -0
- package/lib/apps/cli/commands/config/auth/add.js +68 -0
- package/lib/apps/cli/commands/config/context/add.d.ts +13 -0
- package/lib/apps/cli/commands/config/context/add.js +46 -0
- package/lib/apps/cli/commands/config/context/current.d.ts +8 -0
- package/lib/apps/cli/commands/config/context/current.js +37 -0
- package/lib/apps/cli/commands/config/context/edit.d.ts +12 -0
- package/lib/apps/cli/commands/config/context/edit.js +44 -0
- package/lib/apps/cli/commands/config/context/index.d.ts +5 -0
- package/lib/apps/cli/commands/config/context/index.js +16 -0
- package/lib/apps/cli/commands/config/context/init.d.ts +12 -0
- package/lib/apps/cli/commands/config/context/init.js +31 -0
- package/lib/apps/cli/commands/config/context/list.d.ts +8 -0
- package/lib/apps/cli/commands/config/context/list.js +36 -0
- package/lib/apps/cli/commands/config/context/remove.d.ts +11 -0
- package/lib/apps/cli/commands/config/context/remove.js +39 -0
- package/lib/apps/cli/commands/config/context/use.d.ts +11 -0
- package/lib/apps/cli/commands/config/context/use.js +40 -0
- package/lib/apps/cli/commands/config/index.d.ts +5 -0
- package/lib/apps/cli/commands/config/index.js +16 -0
- package/lib/apps/cli/commands/config/versions.d.ts +8 -0
- package/lib/apps/cli/commands/config/versions.js +56 -0
- package/lib/apps/cli/commands/convert.d.ts +21 -0
- package/lib/apps/cli/commands/convert.js +85 -0
- package/lib/apps/cli/commands/diff.d.ts +36 -0
- package/lib/apps/cli/commands/diff.js +335 -0
- package/lib/apps/cli/commands/format.d.ts +18 -0
- package/lib/apps/cli/commands/format.js +97 -0
- package/lib/apps/cli/commands/generate/client.d.ts +30 -0
- package/lib/apps/cli/commands/generate/client.js +94 -0
- package/lib/apps/cli/commands/generate/fromTemplate.d.ts +29 -0
- package/lib/apps/cli/commands/generate/fromTemplate.js +91 -0
- package/lib/apps/cli/commands/generate/index.d.ts +5 -0
- package/lib/apps/cli/commands/generate/index.js +15 -0
- package/lib/apps/cli/commands/generate/models.d.ts +16 -0
- package/lib/apps/cli/commands/generate/models.js +166 -0
- package/lib/apps/cli/commands/new/file.d.ts +16 -0
- package/lib/apps/cli/commands/new/file.js +180 -0
- package/lib/apps/cli/commands/new/index.d.ts +5 -0
- package/lib/apps/cli/commands/new/index.js +15 -0
- package/lib/apps/cli/commands/new/template.d.ts +18 -0
- package/lib/apps/cli/commands/new/template.js +102 -0
- package/lib/apps/cli/commands/optimize.d.ts +41 -0
- package/lib/apps/cli/commands/optimize.js +289 -0
- package/lib/apps/cli/commands/pretty.d.ts +12 -0
- package/lib/apps/cli/commands/pretty.js +70 -0
- package/lib/apps/cli/commands/start/api.d.ts +11 -0
- package/lib/apps/cli/commands/start/api.js +23 -0
- package/lib/apps/cli/commands/start/index.d.ts +5 -0
- package/lib/apps/cli/commands/start/index.js +15 -0
- package/lib/apps/cli/commands/start/preview.d.ts +17 -0
- package/lib/apps/cli/commands/start/preview.js +41 -0
- package/lib/apps/cli/commands/start/studio.d.ts +16 -0
- package/lib/apps/cli/commands/start/studio.js +94 -0
- package/lib/apps/cli/commands/validate.d.ts +23 -0
- package/lib/apps/cli/commands/validate.js +95 -0
- package/lib/apps/cli/internal/args/generate.args.d.ts +3 -0
- package/lib/apps/cli/internal/args/generate.args.js +10 -0
- package/lib/apps/cli/internal/base/BaseGeneratorCommand.d.ts +42 -0
- package/lib/apps/cli/internal/base/BaseGeneratorCommand.js +119 -0
- package/lib/apps/cli/internal/base.d.ts +20 -0
- package/lib/apps/cli/internal/base.js +173 -0
- package/lib/apps/cli/internal/flags/bundle.flags.d.ts +7 -0
- package/lib/apps/cli/internal/flags/bundle.flags.js +26 -0
- package/lib/apps/cli/internal/flags/config/analytics.flags.d.ts +6 -0
- package/lib/apps/cli/internal/flags/config/analytics.flags.js +24 -0
- package/lib/apps/cli/internal/flags/config/context.flags.d.ts +4 -0
- package/lib/apps/cli/internal/flags/config/context.flags.js +16 -0
- package/lib/apps/cli/internal/flags/convert.flags.d.ts +7 -0
- package/lib/apps/cli/internal/flags/convert.flags.js +32 -0
- package/lib/apps/cli/internal/flags/diff.flags.d.ts +13 -0
- package/lib/apps/cli/internal/flags/diff.flags.js +29 -0
- package/lib/apps/cli/internal/flags/format.flags.d.ts +6 -0
- package/lib/apps/cli/internal/flags/format.flags.js +22 -0
- package/lib/apps/cli/internal/flags/generate/clients.flags.d.ts +16 -0
- package/lib/apps/cli/internal/flags/generate/clients.flags.js +8 -0
- package/lib/apps/cli/internal/flags/generate/fromTemplate.flags.d.ts +16 -0
- package/lib/apps/cli/internal/flags/generate/fromTemplate.flags.js +8 -0
- package/lib/apps/cli/internal/flags/generate/models.flags.d.ts +1 -0
- package/lib/apps/cli/internal/flags/generate/models.flags.js +14 -0
- package/lib/apps/cli/internal/flags/generate/sharedFlags.d.ts +16 -0
- package/lib/apps/cli/internal/flags/generate/sharedFlags.js +57 -0
- package/lib/apps/cli/internal/flags/global.flags.d.ts +4 -0
- package/lib/apps/cli/internal/flags/global.flags.js +18 -0
- package/lib/apps/cli/internal/flags/new/file.flags.d.ts +8 -0
- package/lib/apps/cli/internal/flags/new/file.flags.js +20 -0
- package/lib/apps/cli/internal/flags/new/template.flags.d.ts +7 -0
- package/lib/apps/cli/internal/flags/new/template.flags.js +28 -0
- package/lib/apps/cli/internal/flags/optimize.flags.d.ts +21 -0
- package/lib/apps/cli/internal/flags/optimize.flags.js +51 -0
- package/lib/apps/cli/internal/flags/parser.flags.d.ts +10 -0
- package/lib/apps/cli/internal/flags/parser.flags.js +28 -0
- package/lib/apps/cli/internal/flags/pretty.flags.d.ts +3 -0
- package/lib/apps/cli/internal/flags/pretty.flags.js +13 -0
- package/lib/apps/cli/internal/flags/proxy.flags.d.ts +4 -0
- package/lib/apps/cli/internal/flags/proxy.flags.js +17 -0
- package/lib/apps/cli/internal/flags/start/api.flags.d.ts +5 -0
- package/lib/apps/cli/internal/flags/start/api.flags.js +20 -0
- package/lib/apps/cli/internal/flags/start/preview.flags.d.ts +9 -0
- package/lib/apps/cli/internal/flags/start/preview.flags.js +32 -0
- package/lib/apps/cli/internal/flags/start/studio.flags.d.ts +7 -0
- package/lib/apps/cli/internal/flags/start/studio.flags.js +25 -0
- package/lib/apps/cli/internal/flags/validate.flags.d.ts +11 -0
- package/lib/apps/cli/internal/flags/validate.flags.js +22 -0
- package/lib/apps/cli/internal/globals.d.ts +10 -0
- package/lib/apps/cli/internal/globals.js +46 -0
- package/lib/apps/cli/internal/hooks/command_not_found/myhook.d.ts +4 -0
- package/lib/apps/cli/internal/hooks/command_not_found/myhook.js +85 -0
- package/lib/domains/models/Context.d.ts +21 -0
- package/lib/domains/models/Context.js +321 -0
- package/lib/domains/models/Preview.d.ts +2 -0
- package/lib/domains/models/Preview.js +227 -0
- package/lib/domains/models/SpecificationFile.d.ts +40 -0
- package/lib/domains/models/SpecificationFile.js +295 -0
- package/lib/domains/models/Studio.d.ts +2 -0
- package/lib/domains/models/Studio.js +182 -0
- package/lib/domains/models/generate/ClientLanguages.d.ts +12 -0
- package/lib/domains/models/generate/ClientLanguages.js +17 -0
- package/lib/domains/models/generate/Flags.d.ts +9 -0
- package/lib/domains/models/generate/Flags.js +2 -0
- package/lib/domains/services/archiver.service.d.ts +17 -0
- package/lib/domains/services/archiver.service.js +53 -0
- package/lib/domains/services/base.service.d.ts +6 -0
- package/lib/domains/services/base.service.js +26 -0
- package/lib/domains/services/config.service.d.ts +42 -0
- package/lib/domains/services/config.service.js +95 -0
- package/lib/domains/services/convert.service.d.ts +12 -0
- package/lib/domains/services/convert.service.js +65 -0
- package/lib/domains/services/generator.service.d.ts +15 -0
- package/lib/domains/services/generator.service.js +75 -0
- package/lib/domains/services/validation.service.d.ts +54 -0
- package/lib/domains/services/validation.service.js +375 -0
- package/lib/errors/context-error.d.ts +26 -0
- package/lib/errors/context-error.js +71 -0
- package/lib/errors/diff-error.d.ts +9 -0
- package/lib/errors/diff-error.js +27 -0
- package/lib/errors/generator-error.d.ts +3 -0
- package/lib/errors/generator-error.js +11 -0
- package/lib/errors/specification-file.d.ts +18 -0
- package/lib/errors/specification-file.js +65 -0
- package/lib/errors/validation-error.d.ts +11 -0
- package/lib/errors/validation-error.js +55 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +11 -0
- package/lib/interfaces/index.d.ts +87 -0
- package/lib/interfaces/index.js +7 -0
- package/lib/utils/ajv.d.ts +2 -0
- package/lib/utils/ajv.js +18 -0
- package/lib/utils/app-openapi.d.ts +4 -0
- package/lib/utils/app-openapi.js +28 -0
- package/lib/utils/generate/flags.d.ts +2 -0
- package/lib/utils/generate/flags.js +14 -0
- package/lib/utils/generate/mapBaseUrl.d.ts +6 -0
- package/lib/utils/generate/mapBaseUrl.js +34 -0
- package/lib/utils/generate/parseParams.d.ts +3 -0
- package/lib/utils/generate/parseParams.js +58 -0
- package/lib/utils/generate/prompts.d.ts +4 -0
- package/lib/utils/generate/prompts.js +77 -0
- package/lib/utils/generate/registry.d.ts +2 -0
- package/lib/utils/generate/registry.js +30 -0
- package/lib/utils/generate/watcher.d.ts +51 -0
- package/lib/utils/generate/watcher.js +230 -0
- package/lib/utils/logger.d.ts +6 -0
- package/lib/utils/logger.js +33 -0
- package/lib/utils/retrieve-language.d.ts +1 -0
- package/lib/utils/retrieve-language.js +9 -0
- package/lib/utils/scoreCalculator.d.ts +2 -0
- package/lib/utils/scoreCalculator.js +22 -0
- package/lib/utils/temp-dir.d.ts +2 -0
- package/lib/utils/temp-dir.js +26 -0
- package/oclif.manifest.json +2137 -0
- package/openapi.yaml +713 -0
- package/package.json +203 -0
- package/scripts/enableAutoComplete.js +160 -0
- package/scripts/fetch-asyncapi-example.js +126 -0
- package/scripts/generateTypesForGenerateCommand.js +40 -0
- package/scripts/releasePackagesRename.js +88 -0
- package/scripts/updateUsageDocs.js +73 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Command from '../internal/base';
|
|
2
|
+
export default class Validate extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
private validationService;
|
|
5
|
+
static flags: {
|
|
6
|
+
proxyHost: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
proxyPort: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
score: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
suppressWarnings: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
suppressAllWarnings: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
'log-diagnostics': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
'diagnostics-format': import("@oclif/core/lib/interfaces").OptionFlag<import("@stoplight/spectral-cli/dist/services/config").OutputFormat, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"error" | "warn" | "info" | "hint", import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
|
+
'save-output': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
16
|
+
watch: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
17
|
+
};
|
|
18
|
+
static args: {
|
|
19
|
+
'spec-file': import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
20
|
+
};
|
|
21
|
+
run(): Promise<void>;
|
|
22
|
+
private handleDiagnostics;
|
|
23
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const base_1 = tslib_1.__importDefault(require("../internal/base"));
|
|
6
|
+
const SpecificationFile_1 = require("../../../domains/models/SpecificationFile");
|
|
7
|
+
const globals_1 = require("../internal/globals");
|
|
8
|
+
const validate_flags_1 = require("../internal/flags/validate.flags");
|
|
9
|
+
const proxy_flags_1 = require("../internal/flags/proxy.flags");
|
|
10
|
+
const validation_service_1 = require("../../../domains/services/validation.service");
|
|
11
|
+
class Validate extends base_1.default {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.validationService = new validation_service_1.ValidationService();
|
|
15
|
+
}
|
|
16
|
+
run() {
|
|
17
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
var _a, _b;
|
|
19
|
+
const { args, flags } = yield this.parse(Validate); //NOSONAR
|
|
20
|
+
let filePath = args['spec-file'];
|
|
21
|
+
const proxyHost = flags['proxyHost'];
|
|
22
|
+
const proxyPort = flags['proxyPort'];
|
|
23
|
+
if (proxyHost && proxyPort) {
|
|
24
|
+
const proxyUrl = `http://${proxyHost}:${proxyPort}`;
|
|
25
|
+
filePath = `${filePath}+${proxyUrl}`; // Update filePath with proxyUrl
|
|
26
|
+
}
|
|
27
|
+
this.specFile = yield (0, SpecificationFile_1.load)(filePath);
|
|
28
|
+
const watchMode = flags.watch;
|
|
29
|
+
if (watchMode) {
|
|
30
|
+
(0, globals_1.specWatcher)({
|
|
31
|
+
spec: this.specFile,
|
|
32
|
+
handler: this,
|
|
33
|
+
handlerName: 'validate',
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
// Prepare validate options
|
|
37
|
+
const validateOptions = Object.assign(Object.assign({}, flags), { suppressWarnings: flags['suppressWarnings'], suppressAllWarnings: flags['suppressAllWarnings'] });
|
|
38
|
+
const result = yield this.validationService.validateDocument(this.specFile, validateOptions);
|
|
39
|
+
if (!result.success) {
|
|
40
|
+
this.error(result.error || 'Validation failed', { exit: 1 });
|
|
41
|
+
}
|
|
42
|
+
this.metricsMetadata.validation_result = result;
|
|
43
|
+
if (flags['score']) {
|
|
44
|
+
this.log(`The score of the asyncapi document is ${(_a = result.data) === null || _a === void 0 ? void 0 : _a.score}`);
|
|
45
|
+
}
|
|
46
|
+
if (flags['log-diagnostics']) {
|
|
47
|
+
yield this.handleDiagnostics(result, flags);
|
|
48
|
+
}
|
|
49
|
+
if (((_b = result.data) === null || _b === void 0 ? void 0 : _b.status) === validation_service_1.ValidationStatus.INVALID) {
|
|
50
|
+
process.exitCode = 1;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
handleDiagnostics(result, flags) {
|
|
55
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
57
|
+
const diagnosticsFormat = (_a = flags['diagnostics-format']) !== null && _a !== void 0 ? _a : 'stylish';
|
|
58
|
+
const writeOutput = flags['save-output'];
|
|
59
|
+
const hasIssues = (_c = (((_b = result.data) === null || _b === void 0 ? void 0 : _b.diagnostics) && result.data.diagnostics.length > 0)) !== null && _c !== void 0 ? _c : false;
|
|
60
|
+
const isFailSeverity = ((_d = result.data) === null || _d === void 0 ? void 0 : _d.status) === validation_service_1.ValidationStatus.INVALID;
|
|
61
|
+
const sourceString = ((_e = this.specFile) === null || _e === void 0 ? void 0 : _e.toSourceString()) || '';
|
|
62
|
+
const governanceMessage = this.validationService.generateGovernanceMessage(sourceString, hasIssues, isFailSeverity);
|
|
63
|
+
if (isFailSeverity) {
|
|
64
|
+
this.logToStderr(governanceMessage);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
this.log(governanceMessage);
|
|
68
|
+
}
|
|
69
|
+
const diagnosticsOutput = this.validationService.formatDiagnosticsOutput(((_f = result.data) === null || _f === void 0 ? void 0 : _f.diagnostics) || [], diagnosticsFormat, (_g = flags['fail-severity']) !== null && _g !== void 0 ? _g : 'error');
|
|
70
|
+
if (writeOutput) {
|
|
71
|
+
const { success, error } = yield this.validationService.saveDiagnosticsToFile(writeOutput, diagnosticsFormat, diagnosticsOutput);
|
|
72
|
+
if (!success) {
|
|
73
|
+
this.logToStderr(error || 'Failed to save diagnostics to file', {
|
|
74
|
+
exit: 1,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
this.log(`Diagnostics saved to ${writeOutput}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
this.log(diagnosticsOutput);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
Validate.description = 'validate asyncapi file';
|
|
88
|
+
Validate.flags = Object.assign(Object.assign({}, (0, validate_flags_1.validateFlags)()), (0, proxy_flags_1.proxyFlags)());
|
|
89
|
+
Validate.args = {
|
|
90
|
+
'spec-file': core_1.Args.string({
|
|
91
|
+
description: 'spec path, url, or context-name',
|
|
92
|
+
required: false,
|
|
93
|
+
}),
|
|
94
|
+
};
|
|
95
|
+
exports.default = Validate;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateArgs = void 0;
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
exports.generateArgs = {
|
|
6
|
+
asyncapi: core_1.Args.string({
|
|
7
|
+
description: '- Local path, url or context-name pointing to AsyncAPI file',
|
|
8
|
+
required: false
|
|
9
|
+
})
|
|
10
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import Command from '../../internal/base';
|
|
2
|
+
import { Specification } from '../../../../domains/models/SpecificationFile';
|
|
3
|
+
import { Parser } from '@asyncapi/parser';
|
|
4
|
+
import { ParsedFlags } from '../../../../domains/models/generate/Flags';
|
|
5
|
+
import { GeneratorService } from '../../../../domains/services/generator.service';
|
|
6
|
+
export interface GeneratorOptions {
|
|
7
|
+
forceWrite: boolean;
|
|
8
|
+
install: boolean;
|
|
9
|
+
debug: boolean;
|
|
10
|
+
templateParams: any;
|
|
11
|
+
noOverwriteGlobs: string[];
|
|
12
|
+
mapBaseUrlToFolder: any;
|
|
13
|
+
disabledHooks: Record<string, string>;
|
|
14
|
+
registry: {
|
|
15
|
+
url?: string;
|
|
16
|
+
auth?: string;
|
|
17
|
+
token?: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export declare abstract class BaseGeneratorCommand extends Command {
|
|
21
|
+
static readonly flags: {
|
|
22
|
+
proxyHost: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
23
|
+
proxyPort: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
24
|
+
};
|
|
25
|
+
static args: {
|
|
26
|
+
asyncapi: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
27
|
+
};
|
|
28
|
+
parser: Parser;
|
|
29
|
+
protected generatorService: GeneratorService;
|
|
30
|
+
protected buildGeneratorOptions(flags: any, parsedFlags: ParsedFlags): Promise<GeneratorOptions>;
|
|
31
|
+
protected applyProxyConfiguration(asyncapi: string, proxyHost?: string, proxyPort?: string): string;
|
|
32
|
+
protected handleWatchMode(asyncapi: string, template: string, output: string, options: GeneratorOptions, genOption: any, interactive: boolean): Promise<void>;
|
|
33
|
+
protected buildGenOption(flags: any, parsedFlags: ParsedFlags): any;
|
|
34
|
+
protected generate(asyncapi: string | undefined, template: string, output: string, options: GeneratorOptions, genOption: any, interactive?: boolean): Promise<void>;
|
|
35
|
+
protected parseCommonArgs(args: Record<string, any>, output?: string): Promise<{
|
|
36
|
+
asyncapi: string;
|
|
37
|
+
output: string;
|
|
38
|
+
}>;
|
|
39
|
+
protected loadAsyncAPIInput(asyncapi: string): Promise<Specification>;
|
|
40
|
+
protected handleCancellation(value: any): void;
|
|
41
|
+
protected loadSpecificationSafely(asyncapi: string | undefined): Promise<Specification>;
|
|
42
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseGeneratorCommand = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const base_1 = tslib_1.__importDefault(require("../../internal/base"));
|
|
6
|
+
// eslint-disable-next-line
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
const generator_1 = tslib_1.__importDefault(require("@asyncapi/generator"));
|
|
9
|
+
const SpecificationFile_1 = require("../../../../domains/models/SpecificationFile");
|
|
10
|
+
const validation_error_1 = require("../../../../errors/validation-error");
|
|
11
|
+
const generator_error_1 = require("../../../../errors/generator-error");
|
|
12
|
+
const parser_1 = require("@asyncapi/parser");
|
|
13
|
+
const prompts_1 = require("@clack/prompts");
|
|
14
|
+
const proxy_flags_1 = require("../../internal/flags/proxy.flags");
|
|
15
|
+
const generate_args_1 = require("../../internal/args/generate.args");
|
|
16
|
+
const watcher_1 = require("../../../../utils/generate/watcher");
|
|
17
|
+
const mapBaseUrl_1 = require("../../../../utils/generate/mapBaseUrl");
|
|
18
|
+
const prompts_2 = require("../../../../utils/generate/prompts");
|
|
19
|
+
const generator_service_1 = require("../../../../domains/services/generator.service");
|
|
20
|
+
class BaseGeneratorCommand extends base_1.default {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments);
|
|
23
|
+
this.parser = new parser_1.Parser();
|
|
24
|
+
this.generatorService = new generator_service_1.GeneratorService();
|
|
25
|
+
}
|
|
26
|
+
buildGeneratorOptions(flags, parsedFlags) {
|
|
27
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
return {
|
|
29
|
+
forceWrite: flags['force-write'],
|
|
30
|
+
install: flags.install,
|
|
31
|
+
debug: flags.debug,
|
|
32
|
+
templateParams: parsedFlags.params,
|
|
33
|
+
noOverwriteGlobs: flags['no-overwrite'],
|
|
34
|
+
mapBaseUrlToFolder: parsedFlags.mapBaseUrlToFolder,
|
|
35
|
+
disabledHooks: parsedFlags.disableHooks,
|
|
36
|
+
registry: {
|
|
37
|
+
url: flags['registry-url'],
|
|
38
|
+
auth: flags['registry-auth'],
|
|
39
|
+
token: flags['registry-token'],
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
applyProxyConfiguration(asyncapi, proxyHost, proxyPort) {
|
|
45
|
+
if (proxyHost && proxyPort) {
|
|
46
|
+
const proxyUrl = `http://${proxyHost}:${proxyPort}`;
|
|
47
|
+
return `${asyncapi}+${proxyUrl}`;
|
|
48
|
+
}
|
|
49
|
+
return asyncapi;
|
|
50
|
+
}
|
|
51
|
+
handleWatchMode(asyncapi, template, output, options, genOption, interactive) {
|
|
52
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
const watcher = (0, watcher_1.watcherHandler)(this, asyncapi, template, output, options, genOption, interactive);
|
|
54
|
+
yield (0, watcher_1.runWatchMode)(this, asyncapi, template, output, generator_1.default, watcher);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
buildGenOption(flags, parsedFlags) {
|
|
58
|
+
const genOption = {};
|
|
59
|
+
if (flags['map-base-url']) {
|
|
60
|
+
genOption.resolve = { resolve: (0, mapBaseUrl_1.getMapBaseUrlToFolderResolver)(parsedFlags.mapBaseUrlToFolder) };
|
|
61
|
+
}
|
|
62
|
+
return genOption;
|
|
63
|
+
}
|
|
64
|
+
generate(asyncapi_1, template_1, output_1, options_1, genOption_1) {
|
|
65
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* (asyncapi, template, output, options, genOption, interactive = true) {
|
|
66
|
+
const specification = yield this.loadSpecificationSafely(asyncapi);
|
|
67
|
+
const result = yield this.generatorService.generate(specification, template, output, options, // GeneratorService expects different options interface
|
|
68
|
+
genOption, interactive);
|
|
69
|
+
if (!result.success) {
|
|
70
|
+
throw new generator_error_1.GeneratorError(new Error(result.error));
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
parseCommonArgs(args, output) {
|
|
75
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
let asyncapi = args['asyncapi'];
|
|
77
|
+
const cancellationMessage = 'Operation cancelled';
|
|
78
|
+
if (!asyncapi) {
|
|
79
|
+
asyncapi = yield (0, prompts_2.promptForAsyncAPIPath)();
|
|
80
|
+
}
|
|
81
|
+
if ((0, prompts_1.isCancel)(asyncapi)) {
|
|
82
|
+
this.error(cancellationMessage, { exit: 1 });
|
|
83
|
+
}
|
|
84
|
+
if (!output) {
|
|
85
|
+
output = yield (0, prompts_2.promptForOutputDir)();
|
|
86
|
+
}
|
|
87
|
+
if ((0, prompts_1.isCancel)(output)) {
|
|
88
|
+
this.error(cancellationMessage, { exit: 1 });
|
|
89
|
+
}
|
|
90
|
+
return { asyncapi, output };
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
loadAsyncAPIInput(asyncapi) {
|
|
94
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
95
|
+
return (yield (0, SpecificationFile_1.load)(asyncapi)) || (yield (0, SpecificationFile_1.load)());
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
handleCancellation(value) {
|
|
99
|
+
if ((0, prompts_1.isCancel)(value)) {
|
|
100
|
+
this.error('Operation cancelled', { exit: 1 });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
loadSpecificationSafely(asyncapi) {
|
|
104
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
try {
|
|
106
|
+
return yield (0, SpecificationFile_1.load)(asyncapi);
|
|
107
|
+
}
|
|
108
|
+
catch (err) {
|
|
109
|
+
return this.error(new validation_error_1.ValidationError({
|
|
110
|
+
type: 'invalid-file',
|
|
111
|
+
filepath: asyncapi,
|
|
112
|
+
}), { exit: 1 });
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
exports.BaseGeneratorCommand = BaseGeneratorCommand;
|
|
118
|
+
BaseGeneratorCommand.flags = Object.assign({}, (0, proxy_flags_1.proxyFlags)());
|
|
119
|
+
BaseGeneratorCommand.args = Object.assign({}, generate_args_1.generateArgs);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { MetricMetadata, Recorder } from '@smoya/asyncapi-adoption-metrics';
|
|
3
|
+
import { Parser } from '@asyncapi/parser';
|
|
4
|
+
import { Specification } from '../../../domains/models/SpecificationFile';
|
|
5
|
+
export default abstract class extends Command {
|
|
6
|
+
recorder: Promise<Recorder>;
|
|
7
|
+
parser: Parser;
|
|
8
|
+
metricsMetadata: MetricMetadata;
|
|
9
|
+
specFile: Specification | undefined;
|
|
10
|
+
init(): Promise<void>;
|
|
11
|
+
catch(err: Error & {
|
|
12
|
+
exitCode?: number;
|
|
13
|
+
}): Promise<any>;
|
|
14
|
+
recordActionFinished(action: string, metadata?: MetricMetadata, rawDocument?: string): Promise<void>;
|
|
15
|
+
recordActionInvoked(action: string, metadata?: MetricMetadata): Promise<void>;
|
|
16
|
+
recordActionMetric(recordFunc: (recorder: Recorder) => Promise<void>): Promise<void>;
|
|
17
|
+
setSource(): Promise<void>;
|
|
18
|
+
finally(error: Error | undefined): Promise<any>;
|
|
19
|
+
recorderFromEnv(prefix: string): Promise<Recorder>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const asyncapi_adoption_metrics_1 = require("@smoya/asyncapi-adoption-metrics");
|
|
6
|
+
const parser_1 = require("@asyncapi/parser");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
const fs_extra_1 = require("fs-extra");
|
|
9
|
+
const fs_1 = require("fs");
|
|
10
|
+
const uuid_1 = require("uuid");
|
|
11
|
+
const os_1 = require("os");
|
|
12
|
+
const { readFile, writeFile, stat } = fs_1.promises;
|
|
13
|
+
class DiscardSink {
|
|
14
|
+
send() {
|
|
15
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
// noop
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
class default_1 extends core_1.Command {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments);
|
|
23
|
+
this.recorder = this.recorderFromEnv('asyncapi_adoption');
|
|
24
|
+
this.parser = new parser_1.Parser();
|
|
25
|
+
this.metricsMetadata = {};
|
|
26
|
+
}
|
|
27
|
+
init() {
|
|
28
|
+
const _super = Object.create(null, {
|
|
29
|
+
init: { get: () => super.init }
|
|
30
|
+
});
|
|
31
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
yield _super.init.call(this);
|
|
33
|
+
const commandName = this.id || '';
|
|
34
|
+
yield this.recordActionInvoked(commandName, this.metricsMetadata);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
catch(err) {
|
|
38
|
+
const _super = Object.create(null, {
|
|
39
|
+
catch: { get: () => super.catch }
|
|
40
|
+
});
|
|
41
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
try {
|
|
43
|
+
return yield _super.catch.call(this, err);
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
if (e.message.includes('EEXIT: 0')) {
|
|
47
|
+
process.exitCode = 0;
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (e instanceof Error) {
|
|
51
|
+
this.logToStderr(`${e.name}: ${e.message}`);
|
|
52
|
+
process.exitCode = 1;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
recordActionFinished(action_1) {
|
|
58
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* (action, metadata = {}, rawDocument) {
|
|
59
|
+
if (rawDocument !== undefined) {
|
|
60
|
+
try {
|
|
61
|
+
const { document } = yield this.parser.parse(rawDocument);
|
|
62
|
+
if (document !== undefined) {
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
64
|
+
// @ts-ignore
|
|
65
|
+
metadata = (0, asyncapi_adoption_metrics_1.MetadataFromDocument)(document, metadata);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch (e) {
|
|
69
|
+
if (e instanceof Error) {
|
|
70
|
+
this.log(`Skipping submitting anonymous metrics due to the following error: ${e.name}: ${e.message}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const callable = function (recorder) {
|
|
75
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
yield recorder.recordActionFinished(action, metadata);
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
yield this.recordActionMetric(callable);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
recordActionInvoked(action, metadata) {
|
|
83
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
const callable = function (recorder) {
|
|
85
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
86
|
+
yield recorder.recordActionInvoked(action, metadata);
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
yield this.recordActionMetric(callable);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
recordActionMetric(recordFunc) {
|
|
93
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
try {
|
|
95
|
+
yield this.setSource();
|
|
96
|
+
yield recordFunc(yield this.recorder);
|
|
97
|
+
yield (yield this.recorder).flush();
|
|
98
|
+
}
|
|
99
|
+
catch (e) {
|
|
100
|
+
if (e instanceof Error) {
|
|
101
|
+
this.log(`Skipping submitting anonymous metrics due to the following error: ${e.name}: ${e.message}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
setSource() {
|
|
107
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
var _a;
|
|
109
|
+
const specFilePath = (_a = this.specFile) === null || _a === void 0 ? void 0 : _a.getFilePath();
|
|
110
|
+
if (!specFilePath) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
try {
|
|
114
|
+
const stats = yield stat(specFilePath);
|
|
115
|
+
this.metricsMetadata['file_creation_timestamp'] = stats.birthtimeMs;
|
|
116
|
+
}
|
|
117
|
+
catch (e) {
|
|
118
|
+
// If there's an error with the file, we don't handle it here because it's expected to be handled and reported in the 'finally' method of the command.
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
finally(error) {
|
|
123
|
+
const _super = Object.create(null, {
|
|
124
|
+
finally: { get: () => super.finally }
|
|
125
|
+
});
|
|
126
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
var _a;
|
|
128
|
+
yield _super.finally.call(this, error);
|
|
129
|
+
this.metricsMetadata['success'] = error === undefined;
|
|
130
|
+
yield this.recordActionFinished(this.id, this.metricsMetadata, (_a = this.specFile) === null || _a === void 0 ? void 0 : _a.text());
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
recorderFromEnv(prefix) {
|
|
134
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
135
|
+
let sink = new DiscardSink();
|
|
136
|
+
const analyticsConfigFile = process.env.ASYNCAPI_METRICS_CONFIG_PATH ||
|
|
137
|
+
(0, path_1.join)((0, os_1.homedir)(), '.asyncapi-analytics');
|
|
138
|
+
if (!(0, fs_extra_1.existsSync)(analyticsConfigFile)) {
|
|
139
|
+
yield writeFile(analyticsConfigFile, JSON.stringify({
|
|
140
|
+
analyticsEnabled: 'true',
|
|
141
|
+
infoMessageShown: 'false',
|
|
142
|
+
userID: (0, uuid_1.v4)(),
|
|
143
|
+
}), { encoding: 'utf8' });
|
|
144
|
+
}
|
|
145
|
+
const analyticsConfigFileContent = JSON.parse(yield readFile((0, path_1.resolve)(analyticsConfigFile), { encoding: 'utf8' }));
|
|
146
|
+
this.metricsMetadata['user'] = analyticsConfigFileContent.userID;
|
|
147
|
+
if (analyticsConfigFileContent.analyticsEnabled !== 'false' &&
|
|
148
|
+
process.env.CI !== 'true') {
|
|
149
|
+
switch (process.env.NODE_ENV) {
|
|
150
|
+
case 'development':
|
|
151
|
+
// NODE_ENV set to `development` in bin/run
|
|
152
|
+
if (!process.env.TEST) {
|
|
153
|
+
// Do not pollute stdout when running tests
|
|
154
|
+
sink = new asyncapi_adoption_metrics_1.StdOutSink();
|
|
155
|
+
}
|
|
156
|
+
break;
|
|
157
|
+
case 'production':
|
|
158
|
+
// NODE_ENV set to `production` in bin/run_bin, which is specified in 'bin' package.json section
|
|
159
|
+
sink = new asyncapi_adoption_metrics_1.NewRelicSink(process.env.ASYNCAPI_METRICS_NEWRELIC_KEY ||
|
|
160
|
+
'eu01xx73a8521047150dd9414f6aedd2FFFFNRAL');
|
|
161
|
+
if (analyticsConfigFileContent.infoMessageShown === 'false') {
|
|
162
|
+
this.log('\nAsyncAPI anonymously tracks command executions to improve the specification and tools, ensuring no sensitive data reaches our servers. It aids in comprehending how AsyncAPI tools are used and adopted, facilitating ongoing improvements to our specifications and tools.\n\nTo disable tracking, please run the following command:\n asyncapi config analytics --disable\n\nOnce disabled, if you want to enable tracking back again then run:\n asyncapi config analytics --enable\n');
|
|
163
|
+
analyticsConfigFileContent.infoMessageShown = 'true';
|
|
164
|
+
yield writeFile(analyticsConfigFile, JSON.stringify(analyticsConfigFileContent), { encoding: 'utf8' });
|
|
165
|
+
}
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return new asyncapi_adoption_metrics_1.Recorder(prefix, sink);
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
exports.default = default_1;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const bundleFlags: () => {
|
|
2
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
3
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
4
|
+
base: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
5
|
+
baseDir: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
6
|
+
xOrigin: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bundleFlags = void 0;
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const bundleFlags = () => {
|
|
6
|
+
return {
|
|
7
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
8
|
+
output: core_1.Flags.string({
|
|
9
|
+
char: 'o',
|
|
10
|
+
description: 'The output file name. Omitting this flag the result will be printed in the console.',
|
|
11
|
+
}),
|
|
12
|
+
base: core_1.Flags.string({
|
|
13
|
+
char: 'b',
|
|
14
|
+
description: 'Path to the file which will act as a base. This is required when some properties need to be overwritten.',
|
|
15
|
+
}),
|
|
16
|
+
baseDir: core_1.Flags.string({
|
|
17
|
+
char: 'd',
|
|
18
|
+
description: 'One relative/absolute path to directory relative to which paths to AsyncAPI Documents that should be bundled will be resolved.',
|
|
19
|
+
}),
|
|
20
|
+
xOrigin: core_1.Flags.boolean({
|
|
21
|
+
char: 'x',
|
|
22
|
+
description: 'Pass this switch to generate properties "x-origin" that will contain historical values of dereferenced "$ref"s.',
|
|
23
|
+
}),
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
exports.bundleFlags = bundleFlags;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const analyticsFlags: () => {
|
|
2
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
3
|
+
disable: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
4
|
+
enable: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
5
|
+
status: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
6
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.analyticsFlags = void 0;
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const analyticsFlags = () => {
|
|
6
|
+
return {
|
|
7
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
8
|
+
disable: core_1.Flags.boolean({
|
|
9
|
+
char: 'd',
|
|
10
|
+
description: 'disable analytics',
|
|
11
|
+
default: false,
|
|
12
|
+
}),
|
|
13
|
+
enable: core_1.Flags.boolean({
|
|
14
|
+
char: 'e',
|
|
15
|
+
description: 'enable analytics',
|
|
16
|
+
default: false,
|
|
17
|
+
}),
|
|
18
|
+
status: core_1.Flags.boolean({
|
|
19
|
+
char: 's',
|
|
20
|
+
description: 'show current status of analytics',
|
|
21
|
+
}),
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
exports.analyticsFlags = analyticsFlags;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addFlags = void 0;
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const addFlags = () => {
|
|
6
|
+
return {
|
|
7
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
8
|
+
'set-current': core_1.Flags.boolean({
|
|
9
|
+
char: 's',
|
|
10
|
+
description: 'Set context being added as the current context',
|
|
11
|
+
default: false,
|
|
12
|
+
required: false,
|
|
13
|
+
}),
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
exports.addFlags = addFlags;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const convertFlags: (latestVersion: string) => {
|
|
2
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
3
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
4
|
+
format: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
5
|
+
'target-version': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
6
|
+
perspective: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertFlags = void 0;
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const convertFlags = (latestVersion) => {
|
|
6
|
+
return {
|
|
7
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
8
|
+
output: core_1.Flags.string({
|
|
9
|
+
char: 'o',
|
|
10
|
+
description: 'path to the file where the result is saved',
|
|
11
|
+
}),
|
|
12
|
+
format: core_1.Flags.string({
|
|
13
|
+
char: 'f',
|
|
14
|
+
description: 'Specify the format to convert from (openapi or asyncapi)',
|
|
15
|
+
options: ['openapi', 'asyncapi', 'postman-collection'],
|
|
16
|
+
required: true,
|
|
17
|
+
default: 'asyncapi',
|
|
18
|
+
}),
|
|
19
|
+
'target-version': core_1.Flags.string({
|
|
20
|
+
char: 't',
|
|
21
|
+
description: 'asyncapi version to convert to',
|
|
22
|
+
default: latestVersion,
|
|
23
|
+
}),
|
|
24
|
+
perspective: core_1.Flags.string({
|
|
25
|
+
char: 'p',
|
|
26
|
+
description: 'Perspective to use when converting OpenAPI to AsyncAPI (client or server). Note: This option is only applicable for OpenAPI to AsyncAPI conversions.',
|
|
27
|
+
options: ['client', 'server'],
|
|
28
|
+
default: 'server',
|
|
29
|
+
}),
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
exports.convertFlags = convertFlags;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const diffFlags: () => {
|
|
2
|
+
'log-diagnostics': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
3
|
+
'diagnostics-format': import("@oclif/core/lib/interfaces").OptionFlag<import("@stoplight/spectral-cli/dist/services/config").OutputFormat, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
4
|
+
'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"error" | "warn" | "info" | "hint", import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
5
|
+
'save-output': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
6
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
7
|
+
format: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
type: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
markdownSubtype: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
overrides: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
'no-error': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
watch: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
};
|