@asyncapi/cli 3.2.0 → 3.3.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/assets/create-template/templates/default/package-lock.json +4 -3
- package/lib/apps/api/app.d.ts +15 -0
- package/lib/apps/api/app.js +89 -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 +176 -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/exceptions/problem.exception.d.ts +14 -0
- package/lib/apps/api/exceptions/problem.exception.js +10 -0
- package/lib/apps/api/index.d.ts +9 -0
- package/lib/apps/api/index.js +21 -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 +236 -0
- package/lib/apps/api/server.d.ts +3 -0
- package/lib/apps/api/server.js +19 -0
- package/lib/{commands → apps/cli/commands}/bundle.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/bundle.js +3 -3
- package/lib/{commands → apps/cli/commands}/config/analytics.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/config/analytics.js +4 -3
- package/lib/{commands → apps/cli/commands}/config/context/add.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/config/context/add.js +12 -6
- package/lib/{commands → apps/cli/commands}/config/context/current.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/config/context/current.js +4 -4
- package/lib/{commands → apps/cli/commands}/config/context/edit.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/config/context/edit.js +12 -6
- package/lib/{commands → apps/cli/commands}/config/context/index.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/config/context/index.js +1 -1
- package/lib/{commands → apps/cli/commands}/config/context/init.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/config/context/init.js +7 -4
- package/lib/{commands → apps/cli/commands}/config/context/list.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/config/context/list.js +4 -4
- package/lib/{commands → apps/cli/commands}/config/context/remove.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/config/context/remove.js +8 -5
- package/lib/{commands → apps/cli/commands}/config/context/use.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/config/context/use.js +8 -5
- package/lib/{commands → apps/cli/commands}/config/index.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/config/index.js +1 -1
- package/lib/{commands → apps/cli/commands}/config/versions.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/config/versions.js +2 -2
- package/lib/{commands → apps/cli/commands}/convert.d.ts +2 -7
- package/lib/apps/cli/commands/convert.js +85 -0
- package/lib/{commands → apps/cli/commands}/diff.d.ts +11 -2
- package/lib/{commands → apps/cli/commands}/diff.js +85 -31
- package/lib/{commands → apps/cli/commands}/format.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/format.js +4 -4
- package/lib/{commands → apps/cli/commands}/generate/fromTemplate.d.ts +4 -5
- package/lib/{commands → apps/cli/commands}/generate/fromTemplate.js +89 -122
- package/lib/{commands → apps/cli/commands}/generate/index.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/generate/index.js +1 -1
- package/lib/{commands → apps/cli/commands}/generate/models.d.ts +6 -1
- package/lib/{commands → apps/cli/commands}/generate/models.js +48 -9
- package/lib/{commands → apps/cli/commands}/new/file.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/new/file.js +11 -8
- package/lib/{commands → apps/cli/commands}/new/glee.d.ts +2 -2
- package/lib/{commands → apps/cli/commands}/new/glee.js +4 -4
- package/lib/{commands → apps/cli/commands}/new/index.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/new/index.js +1 -1
- package/lib/{commands → apps/cli/commands}/new/template.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/new/template.js +10 -8
- package/lib/{commands → apps/cli/commands}/optimize.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/optimize.js +71 -30
- package/lib/{commands → apps/cli/commands}/pretty.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/pretty.js +8 -5
- package/lib/apps/cli/commands/start/api.d.ts +11 -0
- package/lib/apps/cli/commands/start/api.js +23 -0
- package/lib/{commands → apps/cli/commands}/start/index.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/start/index.js +1 -1
- package/lib/{commands → apps/cli/commands}/start/preview.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/start/preview.js +9 -6
- package/lib/{commands → apps/cli/commands}/start/studio.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/start/studio.js +10 -7
- package/lib/{commands → apps/cli/commands}/validate.d.ts +4 -2
- package/lib/apps/cli/commands/validate.js +94 -0
- package/lib/{core → apps/cli/internal}/base.d.ts +1 -1
- package/lib/{core → apps/cli/internal}/base.js +12 -4
- package/lib/apps/cli/internal/flags/bundle.flags.js +26 -0
- package/lib/apps/cli/internal/flags/config/analytics.flags.js +24 -0
- package/lib/{core → apps/cli/internal}/flags/config/context.flags.js +1 -1
- package/lib/{core → apps/cli/internal}/flags/convert.flags.js +9 -2
- package/lib/{core → apps/cli/internal}/flags/diff.flags.d.ts +1 -1
- package/lib/{core → apps/cli/internal}/flags/diff.flags.js +3 -3
- package/lib/{core → apps/cli/internal}/flags/generate/fromTemplate.flags.js +12 -12
- package/lib/{core → apps/cli/internal}/flags/generate/models.flags.js +2 -2
- package/lib/{core → apps/cli/internal}/flags/global.flags.js +1 -1
- package/lib/{core → apps/cli/internal}/flags/new/file.flags.js +7 -2
- package/lib/{core → apps/cli/internal}/flags/optimize.flags.js +24 -4
- 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/{core → apps/cli/internal}/flags/proxy.flags.js +3 -3
- 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.js +31 -0
- package/lib/{core → apps/cli/internal}/flags/start/studio.flags.js +9 -2
- package/lib/{core → apps/cli/internal}/flags/validate.flags.d.ts +1 -1
- package/lib/{core → apps/cli/internal}/flags/validate.flags.js +2 -2
- package/lib/{core → apps/cli/internal}/globals.d.ts +1 -1
- package/lib/{core → apps/cli/internal}/globals.js +2 -4
- package/lib/{core → apps/cli/internal}/hooks/command_not_found/myhook.js +14 -4
- package/lib/{core → domains}/models/Context.js +1 -1
- package/lib/{core → domains}/models/Preview.js +35 -19
- package/lib/{core → domains}/models/SpecificationFile.d.ts +2 -2
- package/lib/{core → domains}/models/SpecificationFile.js +8 -5
- package/lib/{core → domains}/models/Studio.js +4 -4
- 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/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 +95 -0
- package/lib/domains/services/validation.service.d.ts +54 -0
- package/lib/domains/services/validation.service.js +288 -0
- package/lib/{core/errors → errors}/specification-file.js +1 -1
- package/lib/{core/errors → errors}/validation-error.js +6 -5
- 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/{core/utils/generator.js → utils/fileWatcher.js} +8 -2
- 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/temp-dir.d.ts +2 -0
- package/lib/utils/temp-dir.js +25 -0
- package/oclif.manifest.json +109 -1
- package/package.json +36 -10
- package/lib/commands/convert.js +0 -132
- package/lib/commands/validate.js +0 -47
- package/lib/core/flags/bundle.flags.js +0 -14
- package/lib/core/flags/config/analytics.flags.js +0 -13
- package/lib/core/flags/start/preview.flags.js +0 -15
- package/lib/core/parser.d.ts +0 -35
- package/lib/core/parser.js +0 -230
- /package/lib/{core → apps/cli/internal}/flags/bundle.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/config/analytics.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/config/context.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/convert.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/format.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/format.flags.js +0 -0
- /package/lib/{core → apps/cli/internal}/flags/generate/fromTemplate.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/generate/models.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/global.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/new/file.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/new/glee.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/new/glee.flags.js +0 -0
- /package/lib/{core → apps/cli/internal}/flags/new/template.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/new/template.flags.js +0 -0
- /package/lib/{core → apps/cli/internal}/flags/optimize.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/pretty.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/pretty.flags.js +0 -0
- /package/lib/{core → apps/cli/internal}/flags/proxy.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/start/preview.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/start/studio.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/hooks/command_not_found/myhook.d.ts +0 -0
- /package/lib/{core → domains}/models/Context.d.ts +0 -0
- /package/lib/{core → domains}/models/Preview.d.ts +0 -0
- /package/lib/{core → domains}/models/Studio.d.ts +0 -0
- /package/lib/{core/errors → errors}/context-error.d.ts +0 -0
- /package/lib/{core/errors → errors}/context-error.js +0 -0
- /package/lib/{core/errors → errors}/diff-error.d.ts +0 -0
- /package/lib/{core/errors → errors}/diff-error.js +0 -0
- /package/lib/{core/errors → errors}/generator-error.d.ts +0 -0
- /package/lib/{core/errors → errors}/generator-error.js +0 -0
- /package/lib/{core/errors → errors}/specification-file.d.ts +0 -0
- /package/lib/{core/errors → errors}/validation-error.d.ts +0 -0
- /package/lib/{core/utils/generator.d.ts → utils/fileWatcher.d.ts} +0 -0
- /package/lib/{core/utils → utils}/scoreCalculator.d.ts +0 -0
- /package/lib/{core/utils → utils}/scoreCalculator.js +0 -0
|
@@ -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,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;
|
|
@@ -5,7 +5,10 @@ const core_1 = require("@oclif/core");
|
|
|
5
5
|
const convertFlags = (latestVersion) => {
|
|
6
6
|
return {
|
|
7
7
|
help: core_1.Flags.help({ char: 'h' }),
|
|
8
|
-
output: core_1.Flags.string({
|
|
8
|
+
output: core_1.Flags.string({
|
|
9
|
+
char: 'o',
|
|
10
|
+
description: 'path to the file where the result is saved',
|
|
11
|
+
}),
|
|
9
12
|
format: core_1.Flags.string({
|
|
10
13
|
char: 'f',
|
|
11
14
|
description: 'Specify the format to convert from (openapi or asyncapi)',
|
|
@@ -13,7 +16,11 @@ const convertFlags = (latestVersion) => {
|
|
|
13
16
|
required: true,
|
|
14
17
|
default: 'asyncapi',
|
|
15
18
|
}),
|
|
16
|
-
'target-version': core_1.Flags.string({
|
|
19
|
+
'target-version': core_1.Flags.string({
|
|
20
|
+
char: 't',
|
|
21
|
+
description: 'asyncapi version to convert to',
|
|
22
|
+
default: latestVersion,
|
|
23
|
+
}),
|
|
17
24
|
perspective: core_1.Flags.string({
|
|
18
25
|
char: 'p',
|
|
19
26
|
description: 'Perspective to use when converting OpenAPI to AsyncAPI (client or server). Note: This option is only applicable for OpenAPI to AsyncAPI conversions.',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const diffFlags: () => {
|
|
2
2
|
'log-diagnostics': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
3
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<"
|
|
4
|
+
'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"error" | "warn" | "info" | "hint", import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
5
5
|
output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
6
6
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
7
7
|
format: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.diffFlags = void 0;
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
|
-
const parser_1 = require("../parser");
|
|
6
5
|
const global_flags_1 = require("./global.flags");
|
|
6
|
+
const parser_flags_1 = require("./parser.flags");
|
|
7
7
|
const diffFlags = () => {
|
|
8
8
|
return Object.assign({ help: core_1.Flags.help({ char: 'h' }), format: core_1.Flags.string({
|
|
9
9
|
char: 'f',
|
|
@@ -18,12 +18,12 @@ const diffFlags = () => {
|
|
|
18
18
|
}), markdownSubtype: core_1.Flags.string({
|
|
19
19
|
description: 'the format of changes made to AsyncAPI document. It works only when diff is generated using md type. For example, when you specify subtype as json, then diff information in markdown is dumped as json structure.',
|
|
20
20
|
default: undefined,
|
|
21
|
-
options: ['json', 'yaml', 'yml']
|
|
21
|
+
options: ['json', 'yaml', 'yml'],
|
|
22
22
|
}), overrides: core_1.Flags.string({
|
|
23
23
|
char: 'o',
|
|
24
24
|
description: 'path to JSON file containing the override properties',
|
|
25
25
|
}), 'no-error': core_1.Flags.boolean({
|
|
26
26
|
description: 'don\'t show error on breaking changes',
|
|
27
|
-
}), watch: (0, global_flags_1.watchFlag)() }, (0,
|
|
27
|
+
}), watch: (0, global_flags_1.watchFlag)() }, (0, parser_flags_1.parserFlags)({ logDiagnostics: false }));
|
|
28
28
|
};
|
|
29
29
|
exports.diffFlags = diffFlags;
|
|
@@ -9,7 +9,7 @@ const fromTemplateFlags = () => {
|
|
|
9
9
|
'disable-hook': core_1.Flags.string({
|
|
10
10
|
char: 'd',
|
|
11
11
|
description: 'Disable a specific hook type or hooks from a given hook type',
|
|
12
|
-
multiple: true
|
|
12
|
+
multiple: true,
|
|
13
13
|
}),
|
|
14
14
|
'no-interactive': core_1.Flags.boolean({
|
|
15
15
|
description: 'Disable interactive mode and run with the provided flags.',
|
|
@@ -19,15 +19,15 @@ const fromTemplateFlags = () => {
|
|
|
19
19
|
install: core_1.Flags.boolean({
|
|
20
20
|
char: 'i',
|
|
21
21
|
default: false,
|
|
22
|
-
description: 'Installs the template and its dependencies (defaults to false)'
|
|
22
|
+
description: 'Installs the template and its dependencies (defaults to false)',
|
|
23
23
|
}),
|
|
24
24
|
debug: core_1.Flags.boolean({
|
|
25
|
-
description: 'Enable more specific errors in the console'
|
|
25
|
+
description: 'Enable more specific errors in the console',
|
|
26
26
|
}),
|
|
27
27
|
'no-overwrite': core_1.Flags.string({
|
|
28
28
|
char: 'n',
|
|
29
29
|
multiple: true,
|
|
30
|
-
description: 'Glob or path of the file(s) to skip when regenerating'
|
|
30
|
+
description: 'Glob or path of the file(s) to skip when regenerating',
|
|
31
31
|
}),
|
|
32
32
|
output: core_1.Flags.string({
|
|
33
33
|
char: 'o',
|
|
@@ -35,31 +35,31 @@ const fromTemplateFlags = () => {
|
|
|
35
35
|
}),
|
|
36
36
|
'force-write': core_1.Flags.boolean({
|
|
37
37
|
default: false,
|
|
38
|
-
description: 'Force writing of the generated files to given directory even if it is a git repo with unstaged files or not empty dir (defaults to false)'
|
|
38
|
+
description: 'Force writing of the generated files to given directory even if it is a git repo with unstaged files or not empty dir (defaults to false)',
|
|
39
39
|
}),
|
|
40
40
|
watch: (0, global_flags_1.watchFlag)('Watches the template directory and the AsyncAPI document, and re-generate the files when changes occur. Ignores the output directory.'),
|
|
41
41
|
param: core_1.Flags.string({
|
|
42
42
|
char: 'p',
|
|
43
43
|
description: 'Additional param to pass to templates',
|
|
44
|
-
multiple: true
|
|
44
|
+
multiple: true,
|
|
45
45
|
}),
|
|
46
46
|
'map-base-url': core_1.Flags.string({
|
|
47
|
-
description: 'Maps all schema references from base url to local folder'
|
|
47
|
+
description: 'Maps all schema references from base url to local folder',
|
|
48
48
|
}),
|
|
49
49
|
'registry-url': core_1.Flags.string({
|
|
50
50
|
default: 'https://registry.npmjs.org',
|
|
51
|
-
description: 'Specifies the URL of the private registry for fetching templates and dependencies'
|
|
51
|
+
description: 'Specifies the URL of the private registry for fetching templates and dependencies',
|
|
52
52
|
}),
|
|
53
53
|
'registry-auth': core_1.Flags.string({
|
|
54
|
-
description: 'The registry username and password encoded with base64, formatted as username:password'
|
|
54
|
+
description: 'The registry username and password encoded with base64, formatted as username:password',
|
|
55
55
|
}),
|
|
56
56
|
'registry-token': core_1.Flags.string({
|
|
57
|
-
description: 'The npm registry authentication token, that can be passed instead of base64 encoded username and password'
|
|
57
|
+
description: 'The npm registry authentication token, that can be passed instead of base64 encoded username and password',
|
|
58
58
|
}),
|
|
59
59
|
'use-new-generator': core_1.Flags.boolean({
|
|
60
60
|
default: false,
|
|
61
|
-
description: 'Use v2 generator, for generating from newer templates'
|
|
62
|
-
})
|
|
61
|
+
description: 'Use v2 generator, for generating from newer templates',
|
|
62
|
+
}),
|
|
63
63
|
};
|
|
64
64
|
};
|
|
65
65
|
exports.fromTemplateFlags = fromTemplateFlags;
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.modelsFlags = void 0;
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
|
-
const parser_1 = require("../../parser");
|
|
6
5
|
const modelina_cli_1 = require("@asyncapi/modelina-cli");
|
|
6
|
+
const parser_flags_1 = require("../parser.flags");
|
|
7
7
|
const modelsFlags = () => {
|
|
8
8
|
return Object.assign(Object.assign(Object.assign({}, modelina_cli_1.ModelinaFlags), { 'no-interactive': core_1.Flags.boolean({
|
|
9
9
|
description: 'Disable interactive mode and run with the provided flags.',
|
|
10
10
|
required: false,
|
|
11
11
|
default: false,
|
|
12
|
-
}) }), (0,
|
|
12
|
+
}) }), (0, parser_flags_1.parserFlags)({ logDiagnostics: false }));
|
|
13
13
|
};
|
|
14
14
|
exports.modelsFlags = modelsFlags;
|
|
@@ -8,8 +8,13 @@ const fileFlags = (exampleFlagDescription) => {
|
|
|
8
8
|
'file-name': core_1.Flags.string({ char: 'n', description: 'name of the file' }),
|
|
9
9
|
example: core_1.Flags.string({ char: 'e', description: exampleFlagDescription }),
|
|
10
10
|
studio: core_1.Flags.boolean({ char: 's', description: 'open in Studio' }),
|
|
11
|
-
port: core_1.Flags.integer({
|
|
12
|
-
|
|
11
|
+
port: core_1.Flags.integer({
|
|
12
|
+
char: 'p',
|
|
13
|
+
description: 'port in which to start Studio',
|
|
14
|
+
}),
|
|
15
|
+
'no-tty': core_1.Flags.boolean({
|
|
16
|
+
description: 'do not use an interactive terminal',
|
|
17
|
+
}),
|
|
13
18
|
};
|
|
14
19
|
};
|
|
15
20
|
exports.fileFlags = fileFlags;
|
|
@@ -22,10 +22,30 @@ var Outputs;
|
|
|
22
22
|
const optimizeFlags = () => {
|
|
23
23
|
return {
|
|
24
24
|
help: core_1.Flags.help({ char: 'h' }),
|
|
25
|
-
optimization: core_1.Flags.string({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
optimization: core_1.Flags.string({
|
|
26
|
+
char: 'p',
|
|
27
|
+
default: Object.values(Optimizations),
|
|
28
|
+
options: Object.values(Optimizations),
|
|
29
|
+
multiple: true,
|
|
30
|
+
description: 'select the type of optimizations that you want to apply.',
|
|
31
|
+
}),
|
|
32
|
+
ignore: core_1.Flags.string({
|
|
33
|
+
char: 'i',
|
|
34
|
+
default: [],
|
|
35
|
+
options: Object.values(DisableOptimizations),
|
|
36
|
+
multiple: true,
|
|
37
|
+
description: 'list of components to be ignored from the optimization process',
|
|
38
|
+
}),
|
|
39
|
+
output: core_1.Flags.string({
|
|
40
|
+
char: 'o',
|
|
41
|
+
default: Outputs.TERMINAL,
|
|
42
|
+
options: Object.values(Outputs),
|
|
43
|
+
description: 'select where you want the output.',
|
|
44
|
+
}),
|
|
45
|
+
'no-tty': core_1.Flags.boolean({
|
|
46
|
+
description: 'do not use an interactive terminal',
|
|
47
|
+
default: false,
|
|
48
|
+
}),
|
|
29
49
|
};
|
|
30
50
|
};
|
|
31
51
|
exports.optimizeFlags = optimizeFlags;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { OutputFormat } from '@stoplight/spectral-cli/dist/services/config';
|
|
2
|
+
export interface ValidationFlagsOptions {
|
|
3
|
+
logDiagnostics?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function parserFlags({ logDiagnostics, }?: ValidationFlagsOptions): {
|
|
6
|
+
'log-diagnostics': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
'diagnostics-format': import("@oclif/core/lib/interfaces").OptionFlag<OutputFormat, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"error" | "warn" | "info" | "hint", import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parserFlags = parserFlags;
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const config_1 = require("@stoplight/spectral-cli/dist/services/config");
|
|
6
|
+
function parserFlags({ logDiagnostics = true, } = {}) {
|
|
7
|
+
return {
|
|
8
|
+
'log-diagnostics': core_1.Flags.boolean({
|
|
9
|
+
description: 'log validation diagnostics or not',
|
|
10
|
+
default: logDiagnostics,
|
|
11
|
+
allowNo: true,
|
|
12
|
+
}),
|
|
13
|
+
'diagnostics-format': core_1.Flags.option({
|
|
14
|
+
description: 'format to use for validation diagnostics',
|
|
15
|
+
options: Object.values(config_1.OutputFormat),
|
|
16
|
+
default: config_1.OutputFormat.STYLISH,
|
|
17
|
+
})(),
|
|
18
|
+
'fail-severity': core_1.Flags.option({
|
|
19
|
+
description: 'diagnostics of this level or above will trigger a failure exit code',
|
|
20
|
+
options: ['error', 'warn', 'info', 'hint'],
|
|
21
|
+
default: 'error',
|
|
22
|
+
})(),
|
|
23
|
+
output: core_1.Flags.string({
|
|
24
|
+
description: 'The output file name. Omitting this flag the result will be printed in the console.',
|
|
25
|
+
char: 'o',
|
|
26
|
+
}),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -6,12 +6,12 @@ const proxyFlags = () => {
|
|
|
6
6
|
return {
|
|
7
7
|
proxyHost: core_1.Flags.string({
|
|
8
8
|
description: 'Name of the ProxyHost',
|
|
9
|
-
required: false
|
|
9
|
+
required: false,
|
|
10
10
|
}),
|
|
11
11
|
proxyPort: core_1.Flags.string({
|
|
12
12
|
description: 'Port number number for the proxyHost.',
|
|
13
|
-
required: false
|
|
14
|
-
})
|
|
13
|
+
required: false,
|
|
14
|
+
}),
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
17
|
exports.proxyFlags = proxyFlags;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const apiFlags: () => {
|
|
2
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
3
|
+
mode: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
4
|
+
port: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
5
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.apiFlags = void 0;
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const apiFlags = () => {
|
|
6
|
+
return {
|
|
7
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
8
|
+
mode: core_1.Flags.string({
|
|
9
|
+
char: 'm',
|
|
10
|
+
description: 'mode in which to start the API',
|
|
11
|
+
default: 'production',
|
|
12
|
+
options: ['development', 'production', 'test'],
|
|
13
|
+
}),
|
|
14
|
+
port: core_1.Flags.integer({
|
|
15
|
+
char: 'p',
|
|
16
|
+
description: 'port in which to start the API',
|
|
17
|
+
}),
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
exports.apiFlags = apiFlags;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.previewFlags = void 0;
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const previewFlags = () => {
|
|
6
|
+
return {
|
|
7
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
8
|
+
port: core_1.Flags.integer({
|
|
9
|
+
char: 'p',
|
|
10
|
+
description: 'port in which to start Studio in the preview mode',
|
|
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 while bundling with the file.',
|
|
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
|
+
suppressLogs: core_1.Flags.boolean({
|
|
25
|
+
char: 'l',
|
|
26
|
+
description: 'Pass this to suppress the detiled error logs.',
|
|
27
|
+
default: false,
|
|
28
|
+
}),
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
exports.previewFlags = previewFlags;
|
|
@@ -5,8 +5,15 @@ const core_1 = require("@oclif/core");
|
|
|
5
5
|
const studioFlags = () => {
|
|
6
6
|
return {
|
|
7
7
|
help: core_1.Flags.help({ char: 'h' }),
|
|
8
|
-
file: core_1.Flags.string({
|
|
9
|
-
|
|
8
|
+
file: core_1.Flags.string({
|
|
9
|
+
char: 'f',
|
|
10
|
+
description: 'path to the AsyncAPI file to link with Studio',
|
|
11
|
+
deprecated: true,
|
|
12
|
+
}),
|
|
13
|
+
port: core_1.Flags.integer({
|
|
14
|
+
char: 'p',
|
|
15
|
+
description: 'port in which to start Studio',
|
|
16
|
+
}),
|
|
10
17
|
'no-interactive': core_1.Flags.boolean({
|
|
11
18
|
description: 'disable prompts for this command which asks for file path if not passed via the arguments.',
|
|
12
19
|
required: false,
|
|
@@ -4,7 +4,7 @@ export declare const validateFlags: () => {
|
|
|
4
4
|
suppressAllWarnings: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
5
5
|
'log-diagnostics': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
6
6
|
'diagnostics-format': import("@oclif/core/lib/interfaces").OptionFlag<import("@stoplight/spectral-cli/dist/services/config").OutputFormat, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
-
'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"
|
|
7
|
+
'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"error" | "warn" | "info" | "hint", import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
8
|
output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
9
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
10
10
|
watch: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateFlags = void 0;
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
|
-
const parser_1 = require("../parser");
|
|
6
5
|
const global_flags_1 = require("./global.flags");
|
|
6
|
+
const parser_flags_1 = require("./parser.flags");
|
|
7
7
|
const validateFlags = () => {
|
|
8
|
-
return Object.assign(Object.assign({ help: core_1.Flags.help({ char: 'h' }), watch: (0, global_flags_1.watchFlag)() }, (0,
|
|
8
|
+
return Object.assign(Object.assign({ help: core_1.Flags.help({ char: 'h' }), watch: (0, global_flags_1.watchFlag)() }, (0, parser_flags_1.parserFlags)()), { score: core_1.Flags.boolean({
|
|
9
9
|
description: 'Compute the score of the AsyncAPI document. Scoring is based on whether the document has description, license, server and/or channels.',
|
|
10
10
|
required: false,
|
|
11
11
|
default: false,
|
|
@@ -12,7 +12,7 @@ const CHOKIDAR_CONFIG = {
|
|
|
12
12
|
const WATCH_MESSAGES = {
|
|
13
13
|
logOnStart: (filePath) => console.log(GreenLog(`Watching AsyncAPI file at ${filePath}\n`)),
|
|
14
14
|
logOnChange: (handlerName) => console.log(OrangeLog(`Change detected, running ${handlerName}\n`)),
|
|
15
|
-
logOnAutoDisable: (docVersion = '') => console.log(OrangeLog(`Watch mode for ${docVersion || 'AsyncAPI'} file was not enabled.`), OrangeLog('\nINFO: Watch works only with files from local file system\n'))
|
|
15
|
+
logOnAutoDisable: (docVersion = '') => console.log(OrangeLog(`Watch mode for ${docVersion || 'AsyncAPI'} file was not enabled.`), OrangeLog('\nINFO: Watch works only with files from local file system\n')),
|
|
16
16
|
};
|
|
17
17
|
const CHOKIDAR_INSTANCE_STORE = new Map();
|
|
18
18
|
const specWatcher = (params) => {
|
|
@@ -26,9 +26,7 @@ const specWatcher = (params) => {
|
|
|
26
26
|
const filePath = params.spec.getFilePath();
|
|
27
27
|
try {
|
|
28
28
|
WATCH_MESSAGES.logOnStart(filePath);
|
|
29
|
-
chokidar_1.default
|
|
30
|
-
.watch(filePath, CHOKIDAR_CONFIG)
|
|
31
|
-
.on('change', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
29
|
+
chokidar_1.default.watch(filePath, CHOKIDAR_CONFIG).on('change', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
32
30
|
if (params.handlerName) {
|
|
33
31
|
WATCH_MESSAGES.logOnChange(params.handlerName);
|
|
34
32
|
}
|
|
@@ -9,7 +9,10 @@ const fast_levenshtein_1 = tslib_1.__importDefault(require("fast-levenshtein"));
|
|
|
9
9
|
const closest = (target, possibilities) => {
|
|
10
10
|
var _a, _b;
|
|
11
11
|
return (_b = (_a = possibilities
|
|
12
|
-
.map((id) => ({
|
|
12
|
+
.map((id) => ({
|
|
13
|
+
distance: fast_levenshtein_1.default.get(target, id, { useCollator: true }),
|
|
14
|
+
id,
|
|
15
|
+
}))
|
|
13
16
|
.sort((a, b) => a.distance - b.distance)[0]) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : '';
|
|
14
17
|
};
|
|
15
18
|
exports.closest = closest;
|
|
@@ -22,7 +25,10 @@ const hook = function (opts) {
|
|
|
22
25
|
return;
|
|
23
26
|
}
|
|
24
27
|
const hiddenCommandIds = new Set(opts.config.commands.filter((c) => c.hidden).map((c) => c.id));
|
|
25
|
-
const commandIDs = [
|
|
28
|
+
const commandIDs = [
|
|
29
|
+
...opts.config.commandIDs,
|
|
30
|
+
...opts.config.commands.flatMap((c) => c.aliases),
|
|
31
|
+
].filter((c) => !hiddenCommandIds.has(c));
|
|
26
32
|
if (commandIDs.length === 0) {
|
|
27
33
|
return;
|
|
28
34
|
}
|
|
@@ -47,7 +53,9 @@ const hook = function (opts) {
|
|
|
47
53
|
if (opts.id === 'help') {
|
|
48
54
|
readableSuggestion = '--help';
|
|
49
55
|
}
|
|
50
|
-
response = yield (0, prompts_1.confirm)({
|
|
56
|
+
response = yield (0, prompts_1.confirm)({
|
|
57
|
+
message: `Did you mean ${chalk_1.default.blueBright(readableSuggestion)}? [y/n]`,
|
|
58
|
+
});
|
|
51
59
|
}
|
|
52
60
|
catch (error) {
|
|
53
61
|
this.log('');
|
|
@@ -56,7 +64,9 @@ const hook = function (opts) {
|
|
|
56
64
|
if (response === true) {
|
|
57
65
|
// this will split the original command from the suggested replacement, and gather the remaining args as varargs to help with situations like:
|
|
58
66
|
// confit set foo-bar -> confit:set:foo-bar -> config:set:foo-bar -> config:set foo-bar
|
|
59
|
-
let argv = ((_a = opts.argv) === null || _a === void 0 ? void 0 : _a.length)
|
|
67
|
+
let argv = ((_a = opts.argv) === null || _a === void 0 ? void 0 : _a.length)
|
|
68
|
+
? opts.argv
|
|
69
|
+
: opts.id.split(':').slice(suggestion.split(':').length);
|
|
60
70
|
if (suggestion.startsWith('help:')) {
|
|
61
71
|
// the args are the command/partial command you need help for (package:version)
|
|
62
72
|
// we created the suggestion variable to start with "help" so slice the first entry
|
|
@@ -14,7 +14,7 @@ const tslib_1 = require("tslib");
|
|
|
14
14
|
const fs_1 = require("fs");
|
|
15
15
|
const path = tslib_1.__importStar(require("path"));
|
|
16
16
|
const os = tslib_1.__importStar(require("os"));
|
|
17
|
-
const context_error_1 = require("
|
|
17
|
+
const context_error_1 = require("../../errors/context-error");
|
|
18
18
|
const { readFile, writeFile } = fs_1.promises;
|
|
19
19
|
// `repoRootPath` is optimistically assigned current working directory's
|
|
20
20
|
// filesystem path because chances are it will become 'official' repository root
|