@asyncapi/cli 1.17.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commands/bundle.d.ts +1 -1
- package/lib/commands/bundle.js +4 -10
- package/lib/commands/config/analytics.d.ts +1 -1
- package/lib/commands/config/analytics.js +3 -8
- package/lib/commands/config/context/add.d.ts +1 -1
- package/lib/commands/config/context/add.js +5 -12
- package/lib/commands/config/context/current.d.ts +1 -1
- package/lib/commands/config/context/current.js +5 -7
- package/lib/commands/config/context/edit.d.ts +1 -1
- package/lib/commands/config/context/edit.js +5 -6
- package/lib/commands/config/context/index.d.ts +1 -1
- package/lib/commands/config/context/index.js +1 -1
- package/lib/commands/config/context/init.d.ts +1 -1
- package/lib/commands/config/context/init.js +4 -5
- package/lib/commands/config/context/list.d.ts +1 -1
- package/lib/commands/config/context/list.js +5 -7
- package/lib/commands/config/context/remove.d.ts +1 -1
- package/lib/commands/config/context/remove.js +5 -6
- package/lib/commands/config/context/use.d.ts +1 -1
- package/lib/commands/config/context/use.js +5 -6
- package/lib/commands/config/index.d.ts +1 -1
- package/lib/commands/config/index.js +1 -1
- package/lib/commands/config/versions.d.ts +1 -1
- package/lib/commands/config/versions.js +3 -5
- package/lib/commands/convert.d.ts +1 -1
- package/lib/commands/convert.js +6 -9
- package/lib/commands/diff.d.ts +1 -1
- package/lib/commands/diff.js +9 -28
- package/lib/commands/generate/fromTemplate.d.ts +1 -1
- package/lib/commands/generate/fromTemplate.js +7 -59
- package/lib/commands/generate/index.d.ts +1 -1
- package/lib/commands/generate/index.js +1 -1
- package/lib/commands/generate/models.d.ts +13 -31
- package/lib/commands/generate/models.js +18 -306
- package/lib/commands/new/file.d.ts +1 -1
- package/lib/commands/new/file.js +5 -12
- package/lib/commands/new/glee.d.ts +2 -2
- package/lib/commands/new/glee.js +6 -26
- package/lib/commands/optimize.d.ts +1 -1
- package/lib/commands/optimize.js +5 -9
- package/lib/commands/start/index.d.ts +1 -1
- package/lib/commands/start/index.js +2 -2
- package/lib/commands/start/studio.d.ts +1 -1
- package/lib/commands/start/studio.js +5 -9
- package/lib/commands/validate.d.ts +1 -1
- package/lib/commands/validate.js +6 -6
- package/lib/{base.d.ts → core/base.d.ts} +1 -1
- package/lib/core/flags/bundle.flags.d.ts +7 -0
- package/lib/core/flags/bundle.flags.js +14 -0
- package/lib/core/flags/config/analytics.flags.d.ts +6 -0
- package/lib/core/flags/config/analytics.flags.js +13 -0
- package/lib/core/flags/config/context.flags.d.ts +4 -0
- package/lib/core/flags/config/context.flags.js +16 -0
- package/lib/core/flags/convert.flags.d.ts +5 -0
- package/lib/core/flags/convert.flags.js +12 -0
- package/lib/core/flags/diff.flags.d.ts +12 -0
- package/lib/core/flags/diff.flags.js +29 -0
- package/lib/core/flags/generate/fromTemplate.flags.d.ts +16 -0
- package/lib/core/flags/generate/fromTemplate.flags.js +61 -0
- package/lib/core/flags/generate/models.flags.d.ts +28 -0
- package/lib/core/flags/generate/models.flags.js +14 -0
- package/lib/{flags.d.ts → core/flags/global.flags.d.ts} +3 -0
- package/lib/{flags.js → core/flags/global.flags.js} +7 -1
- package/lib/core/flags/new/file.flags.d.ts +8 -0
- package/lib/core/flags/new/file.flags.js +15 -0
- package/lib/core/flags/new/glee.flags.d.ts +7 -0
- package/lib/core/flags/new/glee.flags.js +28 -0
- package/lib/core/flags/optimize.flags.d.ts +17 -0
- package/lib/core/flags/optimize.flags.js +26 -0
- package/lib/core/flags/start/studio.flags.d.ts +5 -0
- package/lib/core/flags/start/studio.flags.js +12 -0
- package/lib/core/flags/validate.flags.d.ts +7 -0
- package/lib/core/flags/validate.flags.js +10 -0
- package/oclif.manifest.json +49 -48
- package/package.json +2 -2
- /package/lib/{base.js → core/base.js} +0 -0
- /package/lib/{errors → core/errors}/context-error.d.ts +0 -0
- /package/lib/{errors → core/errors}/context-error.js +0 -0
- /package/lib/{errors → core/errors}/diff-error.d.ts +0 -0
- /package/lib/{errors → core/errors}/diff-error.js +0 -0
- /package/lib/{errors → core/errors}/generator-error.d.ts +0 -0
- /package/lib/{errors → core/errors}/generator-error.js +0 -0
- /package/lib/{errors → core/errors}/specification-file.d.ts +0 -0
- /package/lib/{errors → core/errors}/specification-file.js +0 -0
- /package/lib/{errors → core/errors}/validation-error.d.ts +0 -0
- /package/lib/{errors → core/errors}/validation-error.js +0 -0
- /package/lib/{globals.d.ts → core/globals.d.ts} +0 -0
- /package/lib/{globals.js → core/globals.js} +0 -0
- /package/lib/{hooks → core/hooks}/command_not_found/myhook.d.ts +0 -0
- /package/lib/{hooks → core/hooks}/command_not_found/myhook.js +0 -0
- /package/lib/{models → core/models}/Context.d.ts +0 -0
- /package/lib/{models → core/models}/Context.js +0 -0
- /package/lib/{models → core/models}/SpecificationFile.d.ts +0 -0
- /package/lib/{models → core/models}/SpecificationFile.js +0 -0
- /package/lib/{models → core/models}/Studio.d.ts +0 -0
- /package/lib/{models → core/models}/Studio.js +0 -0
- /package/lib/{parser.d.ts → core/parser.d.ts} +0 -0
- /package/lib/{parser.js → core/parser.js} +0 -0
- /package/lib/{utils → core/utils}/generator.d.ts +0 -0
- /package/lib/{utils → core/utils}/generator.js +0 -0
package/lib/commands/bundle.d.ts
CHANGED
package/lib/commands/bundle.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
5
|
-
const base_1 = tslib_1.__importDefault(require("../base"));
|
|
4
|
+
const base_1 = tslib_1.__importDefault(require("../core/base"));
|
|
6
5
|
const bundler_1 = tslib_1.__importDefault(require("@asyncapi/bundler"));
|
|
7
6
|
const fs_1 = require("fs");
|
|
8
7
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
9
|
-
const SpecificationFile_1 = require("../models/SpecificationFile");
|
|
8
|
+
const SpecificationFile_1 = require("../core/models/SpecificationFile");
|
|
9
|
+
const bundle_flags_1 = require("../core/flags/bundle.flags");
|
|
10
10
|
const { writeFile } = fs_1.promises;
|
|
11
11
|
class Bundle extends base_1.default {
|
|
12
12
|
run() {
|
|
@@ -72,10 +72,4 @@ Bundle.examples = [
|
|
|
72
72
|
'asyncapi bundle ./asyncapi.yaml ./features.yaml --base ./main.yaml --xOrigin',
|
|
73
73
|
'asyncapi bundle ./asyncapi.yaml -o final-asyncapi.yaml --base ../public-api/main.yaml --baseDir ./social-media/comments-service',
|
|
74
74
|
];
|
|
75
|
-
Bundle.flags =
|
|
76
|
-
help: core_1.Flags.help({ char: 'h' }),
|
|
77
|
-
output: core_1.Flags.string({ char: 'o', description: 'The output file name. Omitting this flag the result will be printed in the console.' }),
|
|
78
|
-
base: core_1.Flags.string({ char: 'b', description: 'Path to the file which will act as a base. This is required when some properties need to be overwritten.' }),
|
|
79
|
-
baseDir: core_1.Flags.string({ char: 'd', description: 'One relative/absolute path to directory relative to which paths to AsyncAPI Documents that should be bundled will be resolved.' }),
|
|
80
|
-
xOrigin: core_1.Flags.boolean({ char: 'x', description: 'Pass this switch to generate properties "x-origin" that will contain historical values of dereferenced "$ref"s.' }),
|
|
81
|
-
};
|
|
75
|
+
Bundle.flags = (0, bundle_flags_1.bundleFlags)();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const core_1 = require("@oclif/core");
|
|
5
4
|
const path_1 = require("path");
|
|
6
|
-
const base_1 = tslib_1.__importDefault(require("../../base"));
|
|
5
|
+
const base_1 = tslib_1.__importDefault(require("../../core/base"));
|
|
7
6
|
const fs_1 = require("fs");
|
|
8
7
|
const os_1 = require("os");
|
|
8
|
+
const analytics_flags_1 = require("../../core/flags/config/analytics.flags");
|
|
9
9
|
const { readFile, writeFile } = fs_1.promises;
|
|
10
10
|
class Analytics extends base_1.default {
|
|
11
11
|
run() {
|
|
@@ -56,9 +56,4 @@ class Analytics extends base_1.default {
|
|
|
56
56
|
}
|
|
57
57
|
exports.default = Analytics;
|
|
58
58
|
Analytics.description = 'Enable or disable analytics for metrics collection';
|
|
59
|
-
Analytics.flags =
|
|
60
|
-
help: core_1.Flags.help({ char: 'h' }),
|
|
61
|
-
disable: core_1.Flags.boolean({ char: 'd', description: 'disable analytics', default: false }),
|
|
62
|
-
enable: core_1.Flags.boolean({ char: 'e', description: 'enable analytics', default: false }),
|
|
63
|
-
status: core_1.Flags.boolean({ char: 's', description: 'show current status of analytics' }),
|
|
64
|
-
};
|
|
59
|
+
Analytics.flags = (0, analytics_flags_1.analyticsFlags)();
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
|
-
const base_1 = tslib_1.__importDefault(require("../../../base"));
|
|
6
|
-
const Context_1 = require("../../../models/Context");
|
|
7
|
-
const context_error_1 = require("../../../errors/context-error");
|
|
5
|
+
const base_1 = tslib_1.__importDefault(require("../../../core/base"));
|
|
6
|
+
const Context_1 = require("../../../core/models/Context");
|
|
7
|
+
const context_error_1 = require("../../../core/errors/context-error");
|
|
8
|
+
const context_flags_1 = require("../../../core/flags/config/context.flags");
|
|
8
9
|
class ContextAdd extends base_1.default {
|
|
9
10
|
run() {
|
|
10
11
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -32,15 +33,7 @@ class ContextAdd extends base_1.default {
|
|
|
32
33
|
}
|
|
33
34
|
exports.default = ContextAdd;
|
|
34
35
|
ContextAdd.description = 'Add a context to the store';
|
|
35
|
-
ContextAdd.flags =
|
|
36
|
-
help: core_1.Flags.help({ char: 'h' }),
|
|
37
|
-
'set-current': core_1.Flags.boolean({
|
|
38
|
-
char: 's',
|
|
39
|
-
description: 'Set context being added as the current context',
|
|
40
|
-
default: false,
|
|
41
|
-
required: false,
|
|
42
|
-
})
|
|
43
|
-
};
|
|
36
|
+
ContextAdd.flags = (0, context_flags_1.addFlags)();
|
|
44
37
|
ContextAdd.args = {
|
|
45
38
|
'context-name': core_1.Args.string({ description: 'context name', required: true }),
|
|
46
39
|
'spec-file-path': core_1.Args.string({ description: 'file path of the spec file', required: true }),
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
4
|
+
const base_1 = tslib_1.__importDefault(require("../../../core/base"));
|
|
5
|
+
const Context_1 = require("../../../core/models/Context");
|
|
6
|
+
const context_error_1 = require("../../../core/errors/context-error");
|
|
7
|
+
const global_flags_1 = require("../../../core/flags/global.flags");
|
|
8
8
|
class ContextCurrent extends base_1.default {
|
|
9
9
|
run() {
|
|
10
10
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -36,6 +36,4 @@ class ContextCurrent extends base_1.default {
|
|
|
36
36
|
}
|
|
37
37
|
exports.default = ContextCurrent;
|
|
38
38
|
ContextCurrent.description = 'Shows the current context that is being used';
|
|
39
|
-
ContextCurrent.flags =
|
|
40
|
-
help: core_1.Flags.help({ char: 'h' }),
|
|
41
|
-
};
|
|
39
|
+
ContextCurrent.flags = (0, global_flags_1.helpFlag)();
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
|
-
const base_1 = tslib_1.__importDefault(require("../../../base"));
|
|
6
|
-
const Context_1 = require("../../../models/Context");
|
|
7
|
-
const context_error_1 = require("../../../errors/context-error");
|
|
5
|
+
const base_1 = tslib_1.__importDefault(require("../../../core/base"));
|
|
6
|
+
const Context_1 = require("../../../core/models/Context");
|
|
7
|
+
const context_error_1 = require("../../../core/errors/context-error");
|
|
8
|
+
const global_flags_1 = require("../../../core/flags/global.flags");
|
|
8
9
|
class ContextEdit extends base_1.default {
|
|
9
10
|
run() {
|
|
10
11
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -31,9 +32,7 @@ class ContextEdit extends base_1.default {
|
|
|
31
32
|
}
|
|
32
33
|
exports.default = ContextEdit;
|
|
33
34
|
ContextEdit.description = 'Edit a context in the store';
|
|
34
|
-
ContextEdit.flags =
|
|
35
|
-
help: core_1.Flags.help({ char: 'h' }),
|
|
36
|
-
};
|
|
35
|
+
ContextEdit.flags = (0, global_flags_1.helpFlag)();
|
|
37
36
|
ContextEdit.args = {
|
|
38
37
|
'context-name': core_1.Args.string({ description: 'context name', required: true }),
|
|
39
38
|
'new-spec-file-path': core_1.Args.string({ description: 'file path of the spec file', required: true }),
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
|
-
const base_1 = tslib_1.__importDefault(require("../../../base"));
|
|
5
|
+
const base_1 = tslib_1.__importDefault(require("../../../core/base"));
|
|
6
6
|
class Context extends base_1.default {
|
|
7
7
|
run() {
|
|
8
8
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
|
-
const base_1 = tslib_1.__importDefault(require("../../../base"));
|
|
6
|
-
const Context_1 = require("../../../models/Context");
|
|
5
|
+
const base_1 = tslib_1.__importDefault(require("../../../core/base"));
|
|
6
|
+
const Context_1 = require("../../../core/models/Context");
|
|
7
|
+
const global_flags_1 = require("../../../core/flags/global.flags");
|
|
7
8
|
class ContextInit extends base_1.default {
|
|
8
9
|
run() {
|
|
9
10
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -16,9 +17,7 @@ class ContextInit extends base_1.default {
|
|
|
16
17
|
}
|
|
17
18
|
exports.default = ContextInit;
|
|
18
19
|
ContextInit.description = 'Initialize context';
|
|
19
|
-
ContextInit.flags =
|
|
20
|
-
help: core_1.Flags.help({ char: 'h' }),
|
|
21
|
-
};
|
|
20
|
+
ContextInit.flags = (0, global_flags_1.helpFlag)();
|
|
22
21
|
ContextInit.contextFilePathMessage = `Specify directory in which context file should be created:
|
|
23
22
|
- current directory : asyncapi config context init . (default)
|
|
24
23
|
- root of current repository : asyncapi config context init ./
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
4
|
+
const base_1 = tslib_1.__importDefault(require("../../../core/base"));
|
|
5
|
+
const Context_1 = require("../../../core/models/Context");
|
|
6
|
+
const context_error_1 = require("../../../core/errors/context-error");
|
|
7
|
+
const global_flags_1 = require("../../../core/flags/global.flags");
|
|
8
8
|
class ContextList extends base_1.default {
|
|
9
9
|
run() {
|
|
10
10
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -32,6 +32,4 @@ class ContextList extends base_1.default {
|
|
|
32
32
|
}
|
|
33
33
|
exports.default = ContextList;
|
|
34
34
|
ContextList.description = 'List all the stored contexts in the store';
|
|
35
|
-
ContextList.flags =
|
|
36
|
-
help: core_1.Flags.help({ char: 'h' }),
|
|
37
|
-
};
|
|
35
|
+
ContextList.flags = (0, global_flags_1.helpFlag)();
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
|
-
const base_1 = tslib_1.__importDefault(require("../../../base"));
|
|
6
|
-
const Context_1 = require("../../../models/Context");
|
|
7
|
-
const context_error_1 = require("../../../errors/context-error");
|
|
5
|
+
const base_1 = tslib_1.__importDefault(require("../../../core/base"));
|
|
6
|
+
const Context_1 = require("../../../core/models/Context");
|
|
7
|
+
const context_error_1 = require("../../../core/errors/context-error");
|
|
8
|
+
const global_flags_1 = require("../../../core/flags/global.flags");
|
|
8
9
|
class ContextRemove extends base_1.default {
|
|
9
10
|
run() {
|
|
10
11
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -30,9 +31,7 @@ class ContextRemove extends base_1.default {
|
|
|
30
31
|
}
|
|
31
32
|
exports.default = ContextRemove;
|
|
32
33
|
ContextRemove.description = 'Delete a context from the store';
|
|
33
|
-
ContextRemove.flags =
|
|
34
|
-
help: core_1.Flags.help({ char: 'h' }),
|
|
35
|
-
};
|
|
34
|
+
ContextRemove.flags = (0, global_flags_1.helpFlag)();
|
|
36
35
|
ContextRemove.args = {
|
|
37
36
|
'context-name': core_1.Args.string({ description: 'Name of the context to delete', required: true }),
|
|
38
37
|
};
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
|
-
const base_1 = tslib_1.__importDefault(require("../../../base"));
|
|
6
|
-
const Context_1 = require("../../../models/Context");
|
|
7
|
-
const context_error_1 = require("../../../errors/context-error");
|
|
5
|
+
const base_1 = tslib_1.__importDefault(require("../../../core/base"));
|
|
6
|
+
const Context_1 = require("../../../core/models/Context");
|
|
7
|
+
const context_error_1 = require("../../../core/errors/context-error");
|
|
8
|
+
const global_flags_1 = require("../../../core/flags/global.flags");
|
|
8
9
|
class ContextUse extends base_1.default {
|
|
9
10
|
run() {
|
|
10
11
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -30,9 +31,7 @@ class ContextUse extends base_1.default {
|
|
|
30
31
|
}
|
|
31
32
|
exports.default = ContextUse;
|
|
32
33
|
ContextUse.description = 'Set a context as current';
|
|
33
|
-
ContextUse.flags =
|
|
34
|
-
help: core_1.Flags.help({ char: 'h' }),
|
|
35
|
-
};
|
|
34
|
+
ContextUse.flags = (0, global_flags_1.helpFlag)();
|
|
36
35
|
ContextUse.args = {
|
|
37
36
|
'context-name': core_1.Args.string({ description: 'name of the saved context', required: true }),
|
|
38
37
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const base_1 = tslib_1.__importDefault(require("../../base"));
|
|
4
|
+
const base_1 = tslib_1.__importDefault(require("../../core/base"));
|
|
5
5
|
const core_1 = require("@oclif/core");
|
|
6
6
|
class Config extends base_1.default {
|
|
7
7
|
run() {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const base_1 = tslib_1.__importDefault(require("../../core/base"));
|
|
5
|
+
const global_flags_1 = require("../../core/flags/global.flags");
|
|
6
6
|
class Versions extends base_1.default {
|
|
7
7
|
run() {
|
|
8
8
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -52,6 +52,4 @@ class Versions extends base_1.default {
|
|
|
52
52
|
}
|
|
53
53
|
exports.default = Versions;
|
|
54
54
|
Versions.description = 'Show versions of AsyncAPI tools used';
|
|
55
|
-
Versions.flags =
|
|
56
|
-
help: core_1.Flags.help({ char: 'h' }),
|
|
57
|
-
};
|
|
55
|
+
Versions.flags = (0, global_flags_1.helpFlag)();
|
package/lib/commands/convert.js
CHANGED
|
@@ -4,14 +4,15 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const core_1 = require("@oclif/core");
|
|
7
|
-
const base_1 = tslib_1.__importDefault(require("../base"));
|
|
8
|
-
const validation_error_1 = require("../errors/validation-error");
|
|
9
|
-
const SpecificationFile_1 = require("../models/SpecificationFile");
|
|
10
|
-
const specification_file_1 = require("../errors/specification-file");
|
|
7
|
+
const base_1 = tslib_1.__importDefault(require("../core/base"));
|
|
8
|
+
const validation_error_1 = require("../core/errors/validation-error");
|
|
9
|
+
const SpecificationFile_1 = require("../core/models/SpecificationFile");
|
|
10
|
+
const specification_file_1 = require("../core/errors/specification-file");
|
|
11
11
|
const converter_1 = require("@asyncapi/converter");
|
|
12
12
|
const picocolors_1 = require("picocolors");
|
|
13
13
|
// @ts-ignore
|
|
14
14
|
const specs_1 = tslib_1.__importDefault(require("@asyncapi/specs"));
|
|
15
|
+
const convert_flags_1 = require("../core/flags/convert.flags");
|
|
15
16
|
const latestVersion = Object.keys(specs_1.default.schemas).pop();
|
|
16
17
|
class Convert extends base_1.default {
|
|
17
18
|
run() {
|
|
@@ -68,11 +69,7 @@ class Convert extends base_1.default {
|
|
|
68
69
|
}
|
|
69
70
|
exports.default = Convert;
|
|
70
71
|
Convert.description = 'Convert asyncapi documents older to newer versions';
|
|
71
|
-
Convert.flags =
|
|
72
|
-
help: core_1.Flags.help({ char: 'h' }),
|
|
73
|
-
output: core_1.Flags.string({ char: 'o', description: 'path to the file where the result is saved' }),
|
|
74
|
-
'target-version': core_1.Flags.string({ char: 't', description: 'asyncapi version to convert to', default: latestVersion })
|
|
75
|
-
};
|
|
72
|
+
Convert.flags = (0, convert_flags_1.convertFlags)(latestVersion);
|
|
76
73
|
Convert.args = {
|
|
77
74
|
'spec-file': core_1.Args.string({ description: 'spec path, url, or context-name', required: false }),
|
|
78
75
|
};
|
package/lib/commands/diff.d.ts
CHANGED
package/lib/commands/diff.js
CHANGED
|
@@ -6,14 +6,14 @@ const core_1 = require("@oclif/core");
|
|
|
6
6
|
const diff = tslib_1.__importStar(require("@asyncapi/diff"));
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
9
|
-
const SpecificationFile_1 = require("../models/SpecificationFile");
|
|
10
|
-
const base_1 = tslib_1.__importDefault(require("../base"));
|
|
11
|
-
const validation_error_1 = require("../errors/validation-error");
|
|
12
|
-
const specification_file_1 = require("../errors/specification-file");
|
|
13
|
-
const diff_error_1 = require("../errors/diff-error");
|
|
14
|
-
const globals_1 = require("../globals");
|
|
15
|
-
const
|
|
16
|
-
const
|
|
9
|
+
const SpecificationFile_1 = require("../core/models/SpecificationFile");
|
|
10
|
+
const base_1 = tslib_1.__importDefault(require("../core/base"));
|
|
11
|
+
const validation_error_1 = require("../core/errors/validation-error");
|
|
12
|
+
const specification_file_1 = require("../core/errors/specification-file");
|
|
13
|
+
const diff_error_1 = require("../core/errors/diff-error");
|
|
14
|
+
const globals_1 = require("../core/globals");
|
|
15
|
+
const parser_1 = require("../core/parser");
|
|
16
|
+
const diff_flags_1 = require("../core/flags/diff.flags");
|
|
17
17
|
const { readFile } = fs_1.promises;
|
|
18
18
|
class Diff extends base_1.default {
|
|
19
19
|
/* eslint-disable sonarjs/cognitive-complexity */
|
|
@@ -152,26 +152,7 @@ class Diff extends base_1.default {
|
|
|
152
152
|
}
|
|
153
153
|
exports.default = Diff;
|
|
154
154
|
Diff.description = 'Find diff between two asyncapi files';
|
|
155
|
-
Diff.flags =
|
|
156
|
-
char: 'f',
|
|
157
|
-
description: 'format of the output',
|
|
158
|
-
default: 'yaml',
|
|
159
|
-
options: ['json', 'yaml', 'yml', 'md'],
|
|
160
|
-
}), type: core_1.Flags.string({
|
|
161
|
-
char: 't',
|
|
162
|
-
description: 'type of the output',
|
|
163
|
-
default: 'all',
|
|
164
|
-
options: ['breaking', 'non-breaking', 'unclassified', 'all'],
|
|
165
|
-
}), markdownSubtype: core_1.Flags.string({
|
|
166
|
-
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.',
|
|
167
|
-
default: undefined,
|
|
168
|
-
options: ['json', 'yaml', 'yml']
|
|
169
|
-
}), overrides: core_1.Flags.string({
|
|
170
|
-
char: 'o',
|
|
171
|
-
description: 'path to JSON file containing the override properties',
|
|
172
|
-
}), 'no-error': core_1.Flags.boolean({
|
|
173
|
-
description: 'don\'t show error on breaking changes',
|
|
174
|
-
}), watch: (0, flags_1.watchFlag)() }, (0, parser_1.validationFlags)({ logDiagnostics: false }));
|
|
155
|
+
Diff.flags = (0, diff_flags_1.diffFlags)();
|
|
175
156
|
Diff.args = {
|
|
176
157
|
old: core_1.Args.string({ description: 'old spec path, URL or context-name', required: true }),
|
|
177
158
|
new: core_1.Args.string({ description: 'new spec path, URL or context-name', required: true }),
|
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
|
-
const base_1 = tslib_1.__importDefault(require("../../base"));
|
|
5
|
+
const base_1 = tslib_1.__importDefault(require("../../core/base"));
|
|
6
6
|
// eslint-disable-next-line
|
|
7
7
|
// @ts-ignore
|
|
8
8
|
const generator_1 = tslib_1.__importDefault(require("@asyncapi/generator"));
|
|
9
9
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
10
10
|
const os_1 = tslib_1.__importDefault(require("os"));
|
|
11
11
|
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
12
|
-
const SpecificationFile_1 = require("../../models/SpecificationFile");
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const generator_error_1 = require("../../errors/generator-error");
|
|
12
|
+
const SpecificationFile_1 = require("../../core/models/SpecificationFile");
|
|
13
|
+
const generator_2 = require("../../core/utils/generator");
|
|
14
|
+
const validation_error_1 = require("../../core/errors/validation-error");
|
|
15
|
+
const generator_error_1 = require("../../core/errors/generator-error");
|
|
17
16
|
const parser_1 = require("@asyncapi/parser");
|
|
18
17
|
const prompts_1 = require("@clack/prompts");
|
|
19
18
|
const picocolors_1 = require("picocolors");
|
|
20
19
|
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
20
|
+
const fromTemplate_flags_1 = require("../../core/flags/generate/fromTemplate.flags");
|
|
21
21
|
const templatesNotSupportingV3 = {
|
|
22
22
|
'@asyncapi/minimaltemplate': 'some link',
|
|
23
23
|
'@asyncapi/dotnet-nats-template': 'https://github.com/asyncapi/dotnet-nats-template/issues/384',
|
|
@@ -354,59 +354,7 @@ Template.description = 'Generates whatever you want using templates compatible w
|
|
|
354
354
|
Template.examples = [
|
|
355
355
|
'asyncapi generate fromTemplate asyncapi.yaml @asyncapi/html-template --param version=1.0.0 singleFile=true --output ./docs --force-write'
|
|
356
356
|
];
|
|
357
|
-
Template.flags =
|
|
358
|
-
help: core_1.Flags.help({ char: 'h' }),
|
|
359
|
-
'disable-hook': core_1.Flags.string({
|
|
360
|
-
char: 'd',
|
|
361
|
-
description: 'Disable a specific hook type or hooks from a given hook type',
|
|
362
|
-
multiple: true
|
|
363
|
-
}),
|
|
364
|
-
'no-interactive': core_1.Flags.boolean({
|
|
365
|
-
description: 'Disable interactive mode and run with the provided flags.',
|
|
366
|
-
required: false,
|
|
367
|
-
default: false,
|
|
368
|
-
}),
|
|
369
|
-
install: core_1.Flags.boolean({
|
|
370
|
-
char: 'i',
|
|
371
|
-
default: false,
|
|
372
|
-
description: 'Installs the template and its dependencies (defaults to false)'
|
|
373
|
-
}),
|
|
374
|
-
debug: core_1.Flags.boolean({
|
|
375
|
-
description: 'Enable more specific errors in the console'
|
|
376
|
-
}),
|
|
377
|
-
'no-overwrite': core_1.Flags.string({
|
|
378
|
-
char: 'n',
|
|
379
|
-
multiple: true,
|
|
380
|
-
description: 'Glob or path of the file(s) to skip when regenerating'
|
|
381
|
-
}),
|
|
382
|
-
output: core_1.Flags.string({
|
|
383
|
-
char: 'o',
|
|
384
|
-
description: 'Directory where to put the generated files (defaults to current directory)',
|
|
385
|
-
}),
|
|
386
|
-
'force-write': core_1.Flags.boolean({
|
|
387
|
-
default: false,
|
|
388
|
-
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)'
|
|
389
|
-
}),
|
|
390
|
-
watch: (0, flags_1.watchFlag)('Watches the template directory and the AsyncAPI document, and re-generate the files when changes occur. Ignores the output directory.'),
|
|
391
|
-
param: core_1.Flags.string({
|
|
392
|
-
char: 'p',
|
|
393
|
-
description: 'Additional param to pass to templates',
|
|
394
|
-
multiple: true
|
|
395
|
-
}),
|
|
396
|
-
'map-base-url': core_1.Flags.string({
|
|
397
|
-
description: 'Maps all schema references from base url to local folder'
|
|
398
|
-
}),
|
|
399
|
-
'registry-url': core_1.Flags.string({
|
|
400
|
-
default: 'https://registry.npmjs.org',
|
|
401
|
-
description: 'Specifies the URL of the private registry for fetching templates and dependencies'
|
|
402
|
-
}),
|
|
403
|
-
'registry-auth': core_1.Flags.string({
|
|
404
|
-
description: 'The registry username and password encoded with base64, formatted as username:password'
|
|
405
|
-
}),
|
|
406
|
-
'registry-token': core_1.Flags.string({
|
|
407
|
-
description: 'The npm registry authentication token, that can be passed instead of base64 encoded username and password'
|
|
408
|
-
})
|
|
409
|
-
};
|
|
357
|
+
Template.flags = (0, fromTemplate_flags_1.fromTemplateFlags)();
|
|
410
358
|
Template.args = {
|
|
411
359
|
asyncapi: core_1.Args.string({ description: '- Local path, url or context-name pointing to AsyncAPI file', required: true }),
|
|
412
360
|
template: core_1.Args.string({ description: '- Name of the generator template like for example @asyncapi/html-template or https://github.com/asyncapi/html-template', required: true }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const base_1 = tslib_1.__importDefault(require("../../base"));
|
|
4
|
+
const base_1 = tslib_1.__importDefault(require("../../core/base"));
|
|
5
5
|
const core_1 = require("@oclif/core");
|
|
6
6
|
class Generate extends base_1.default {
|
|
7
7
|
run() {
|