@asyncapi/cli 1.12.3 → 1.14.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/bin/dev +0 -1
- package/bin/run +0 -1
- package/bin/run_bin +0 -1
- package/lib/base.d.ts +1 -0
- package/lib/base.js +18 -1
- package/lib/commands/bundle.d.ts +4 -5
- package/lib/commands/bundle.js +1 -0
- package/lib/commands/config/context/add.d.ts +3 -4
- package/lib/commands/config/context/add.js +4 -8
- package/lib/commands/config/context/edit.d.ts +3 -4
- package/lib/commands/config/context/edit.js +4 -8
- package/lib/commands/config/context/init.d.ts +2 -4
- package/lib/commands/config/context/init.js +3 -7
- package/lib/commands/config/context/remove.d.ts +2 -4
- package/lib/commands/config/context/remove.js +3 -7
- package/lib/commands/config/context/use.d.ts +2 -4
- package/lib/commands/config/context/use.js +3 -7
- package/lib/commands/convert.d.ts +4 -6
- package/lib/commands/convert.js +3 -3
- package/lib/commands/diff.d.ts +9 -10
- package/lib/commands/diff.js +4 -12
- package/lib/commands/generate/fromTemplate.d.ts +14 -10
- package/lib/commands/generate/fromTemplate.js +41 -6
- package/lib/commands/generate/models.d.ts +14 -19
- package/lib/commands/generate/models.js +5 -9
- package/lib/commands/new/file.d.ts +3 -3
- package/lib/commands/new/glee.d.ts +3 -3
- package/lib/commands/optimize.d.ts +5 -8
- package/lib/commands/optimize.js +3 -3
- package/lib/commands/start/studio.d.ts +2 -3
- package/lib/commands/start/studio.js +0 -1
- package/lib/commands/validate.d.ts +4 -6
- package/lib/commands/validate.js +3 -3
- package/lib/hooks/command_not_found/myhook.js +2 -2
- package/lib/parser.d.ts +3 -3
- package/lib/parser.js +4 -4
- package/oclif.manifest.json +33 -12
- package/package.json +3 -2
package/bin/dev
CHANGED
package/bin/run
CHANGED
package/bin/run_bin
CHANGED
package/lib/base.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export default abstract class extends Command {
|
|
|
14
14
|
recordActionFinished(action: string, metadata?: MetricMetadata, rawDocument?: string): Promise<void>;
|
|
15
15
|
recordActionInvoked(action: string, metadata?: MetricMetadata): Promise<void>;
|
|
16
16
|
recordActionMetric(recordFunc: (recorder: Recorder) => Promise<void>): Promise<void>;
|
|
17
|
+
setSource(): Promise<void>;
|
|
17
18
|
finally(error: Error | undefined): Promise<any>;
|
|
18
19
|
recorderFromEnv(prefix: string): Promise<Recorder>;
|
|
19
20
|
}
|
package/lib/base.js
CHANGED
|
@@ -9,7 +9,7 @@ const fs_extra_1 = require("fs-extra");
|
|
|
9
9
|
const fs_1 = require("fs");
|
|
10
10
|
const uuid_1 = require("uuid");
|
|
11
11
|
const os_1 = require("os");
|
|
12
|
-
const { readFile, writeFile } = fs_1.promises;
|
|
12
|
+
const { readFile, writeFile, stat } = fs_1.promises;
|
|
13
13
|
class DiscardSink {
|
|
14
14
|
send() {
|
|
15
15
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -86,6 +86,7 @@ class default_1 extends core_1.Command {
|
|
|
86
86
|
recordActionMetric(recordFunc) {
|
|
87
87
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
88
88
|
try {
|
|
89
|
+
yield this.setSource();
|
|
89
90
|
yield recordFunc(yield this.recorder);
|
|
90
91
|
yield (yield this.recorder).flush();
|
|
91
92
|
}
|
|
@@ -96,6 +97,22 @@ class default_1 extends core_1.Command {
|
|
|
96
97
|
}
|
|
97
98
|
});
|
|
98
99
|
}
|
|
100
|
+
setSource() {
|
|
101
|
+
var _a;
|
|
102
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
const specFilePath = (_a = this.specFile) === null || _a === void 0 ? void 0 : _a.getFilePath();
|
|
104
|
+
if (!specFilePath) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
try {
|
|
108
|
+
const stats = yield stat(specFilePath);
|
|
109
|
+
this.metricsMetadata['file_creation_timestamp'] = stats.birthtimeMs;
|
|
110
|
+
}
|
|
111
|
+
catch (e) {
|
|
112
|
+
// 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.
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
99
116
|
finally(error) {
|
|
100
117
|
const _super = Object.create(null, {
|
|
101
118
|
finally: { get: () => super.finally }
|
package/lib/commands/bundle.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { Example } from '@oclif/core/lib/interfaces';
|
|
2
1
|
import Command from '../base';
|
|
3
2
|
export default class Bundle extends Command {
|
|
4
3
|
static readonly description = "Bundle one or multiple AsyncAPI Documents and their references together.";
|
|
5
4
|
static strict: boolean;
|
|
6
|
-
static examples:
|
|
5
|
+
static examples: string[];
|
|
7
6
|
static flags: {
|
|
8
7
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
9
|
-
output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
10
|
-
base: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
11
|
-
baseDir: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
8
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
base: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
baseDir: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
11
|
xOrigin: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
12
|
};
|
|
14
13
|
run(): Promise<void>;
|
package/lib/commands/bundle.js
CHANGED
|
@@ -65,6 +65,7 @@ exports.default = Bundle;
|
|
|
65
65
|
Bundle.description = 'Bundle one or multiple AsyncAPI Documents and their references together.';
|
|
66
66
|
Bundle.strict = false;
|
|
67
67
|
Bundle.examples = [
|
|
68
|
+
'asyncapi bundle ./asyncapi.yaml > final-asyncapi.yaml',
|
|
68
69
|
'asyncapi bundle ./asyncapi.yaml --output final-asyncapi.yaml',
|
|
69
70
|
'asyncapi bundle ./asyncapi.yaml ./features.yaml',
|
|
70
71
|
'asyncapi bundle ./asyncapi.yaml ./features.yaml --base ./main.yaml',
|
|
@@ -6,9 +6,8 @@ export default class ContextAdd extends Command {
|
|
|
6
6
|
'set-current': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
7
|
};
|
|
8
8
|
static args: {
|
|
9
|
-
name: string
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}[];
|
|
9
|
+
'context-name': import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
10
|
+
'spec-file-path': import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
11
|
+
};
|
|
13
12
|
run(): Promise<void>;
|
|
14
13
|
}
|
|
@@ -41,11 +41,7 @@ ContextAdd.flags = {
|
|
|
41
41
|
required: false,
|
|
42
42
|
})
|
|
43
43
|
};
|
|
44
|
-
ContextAdd.args =
|
|
45
|
-
|
|
46
|
-
{
|
|
47
|
-
|
|
48
|
-
description: 'file path of the spec file',
|
|
49
|
-
required: true,
|
|
50
|
-
},
|
|
51
|
-
];
|
|
44
|
+
ContextAdd.args = {
|
|
45
|
+
'context-name': core_1.Args.string({ description: 'context name', required: true }),
|
|
46
|
+
'spec-file-path': core_1.Args.string({ description: 'file path of the spec file', required: true }),
|
|
47
|
+
};
|
|
@@ -5,9 +5,8 @@ export default class ContextEdit extends Command {
|
|
|
5
5
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
6
6
|
};
|
|
7
7
|
static args: {
|
|
8
|
-
name: string
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}[];
|
|
8
|
+
'context-name': import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
9
|
+
'new-spec-file-path': import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
10
|
+
};
|
|
12
11
|
run(): Promise<void>;
|
|
13
12
|
}
|
|
@@ -34,11 +34,7 @@ ContextEdit.description = 'Edit a context in the store';
|
|
|
34
34
|
ContextEdit.flags = {
|
|
35
35
|
help: core_1.Flags.help({ char: 'h' }),
|
|
36
36
|
};
|
|
37
|
-
ContextEdit.args =
|
|
38
|
-
|
|
39
|
-
{
|
|
40
|
-
|
|
41
|
-
description: 'new file path of the spec file',
|
|
42
|
-
required: true,
|
|
43
|
-
},
|
|
44
|
-
];
|
|
37
|
+
ContextEdit.args = {
|
|
38
|
+
'context-name': core_1.Args.string({ description: 'context name', required: true }),
|
|
39
|
+
'new-spec-file-path': core_1.Args.string({ description: 'file path of the spec file', required: true }),
|
|
40
|
+
};
|
|
@@ -6,9 +6,7 @@ export default class ContextInit extends Command {
|
|
|
6
6
|
};
|
|
7
7
|
static contextFilePathMessage: string;
|
|
8
8
|
static args: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
required: boolean;
|
|
12
|
-
}[];
|
|
9
|
+
'context-file-path': import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
10
|
+
};
|
|
13
11
|
run(): Promise<void>;
|
|
14
12
|
}
|
|
@@ -23,10 +23,6 @@ ContextInit.contextFilePathMessage = `Specify directory in which context file sh
|
|
|
23
23
|
- current directory : asyncapi config context init . (default)
|
|
24
24
|
- root of current repository : asyncapi config context init ./
|
|
25
25
|
- user's home directory : asyncapi config context init ~`;
|
|
26
|
-
ContextInit.args =
|
|
27
|
-
{
|
|
28
|
-
|
|
29
|
-
description: `${ContextInit.contextFilePathMessage}`,
|
|
30
|
-
required: false,
|
|
31
|
-
},
|
|
32
|
-
];
|
|
26
|
+
ContextInit.args = {
|
|
27
|
+
'context-file-path': core_1.Args.string({ description: `${ContextInit.contextFilePathMessage}`, required: false })
|
|
28
|
+
};
|
|
@@ -5,9 +5,7 @@ export default class ContextRemove extends Command {
|
|
|
5
5
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
6
6
|
};
|
|
7
7
|
static args: {
|
|
8
|
-
name: string
|
|
9
|
-
|
|
10
|
-
required: boolean;
|
|
11
|
-
}[];
|
|
8
|
+
'context-name': import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
9
|
+
};
|
|
12
10
|
run(): Promise<void>;
|
|
13
11
|
}
|
|
@@ -33,10 +33,6 @@ ContextRemove.description = 'Delete a context from the store';
|
|
|
33
33
|
ContextRemove.flags = {
|
|
34
34
|
help: core_1.Flags.help({ char: 'h' }),
|
|
35
35
|
};
|
|
36
|
-
ContextRemove.args =
|
|
37
|
-
{
|
|
38
|
-
|
|
39
|
-
description: 'Name of the context to delete',
|
|
40
|
-
required: true,
|
|
41
|
-
},
|
|
42
|
-
];
|
|
36
|
+
ContextRemove.args = {
|
|
37
|
+
'context-name': core_1.Args.string({ description: 'Name of the context to delete', required: true }),
|
|
38
|
+
};
|
|
@@ -5,9 +5,7 @@ export default class ContextUse extends Command {
|
|
|
5
5
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
6
6
|
};
|
|
7
7
|
static args: {
|
|
8
|
-
name: string
|
|
9
|
-
|
|
10
|
-
required: boolean;
|
|
11
|
-
}[];
|
|
8
|
+
'context-name': import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
9
|
+
};
|
|
12
10
|
run(): Promise<void>;
|
|
13
11
|
}
|
|
@@ -33,10 +33,6 @@ ContextUse.description = 'Set a context as current';
|
|
|
33
33
|
ContextUse.flags = {
|
|
34
34
|
help: core_1.Flags.help({ char: 'h' }),
|
|
35
35
|
};
|
|
36
|
-
ContextUse.args =
|
|
37
|
-
{
|
|
38
|
-
|
|
39
|
-
description: 'name of the saved context',
|
|
40
|
-
required: true,
|
|
41
|
-
},
|
|
42
|
-
];
|
|
36
|
+
ContextUse.args = {
|
|
37
|
+
'context-name': core_1.Args.string({ description: 'name of the saved context', required: true }),
|
|
38
|
+
};
|
|
@@ -3,13 +3,11 @@ export default class Convert extends Command {
|
|
|
3
3
|
static description: string;
|
|
4
4
|
static flags: {
|
|
5
5
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
6
|
-
output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
7
|
-
'target-version': import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
6
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
'target-version': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
8
|
};
|
|
9
9
|
static args: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
required: boolean;
|
|
13
|
-
}[];
|
|
10
|
+
'spec-file': import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
11
|
+
};
|
|
14
12
|
run(): Promise<void>;
|
|
15
13
|
}
|
package/lib/commands/convert.js
CHANGED
|
@@ -73,6 +73,6 @@ Convert.flags = {
|
|
|
73
73
|
output: core_1.Flags.string({ char: 'o', description: 'path to the file where the result is saved' }),
|
|
74
74
|
'target-version': core_1.Flags.string({ char: 't', description: 'asyncapi version to convert to', default: latestVersion })
|
|
75
75
|
};
|
|
76
|
-
Convert.args =
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
Convert.args = {
|
|
77
|
+
'spec-file': core_1.Args.string({ description: 'spec path, url, or context-name', required: false }),
|
|
78
|
+
};
|
package/lib/commands/diff.d.ts
CHANGED
|
@@ -4,21 +4,20 @@ export default class Diff extends Command {
|
|
|
4
4
|
static description: string;
|
|
5
5
|
static flags: {
|
|
6
6
|
'log-diagnostics': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
|
-
'diagnostics-format': import("@oclif/core/lib/interfaces").OptionFlag<import("@stoplight/spectral-cli/dist/services/config").OutputFormat>;
|
|
8
|
-
'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<import("
|
|
7
|
+
'diagnostics-format': import("@oclif/core/lib/interfaces").OptionFlag<import("@stoplight/spectral-cli/dist/services/config").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
9
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
10
|
-
format: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
11
|
-
type: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
12
|
-
markdownSubtype: import("@oclif/core/lib/interfaces").OptionFlag<string
|
|
13
|
-
overrides: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
10
|
+
format: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
type: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
markdownSubtype: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
overrides: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
14
|
'no-error': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
15
15
|
watch: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
16
16
|
};
|
|
17
17
|
static args: {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}[];
|
|
18
|
+
old: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
19
|
+
new: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
20
|
+
};
|
|
22
21
|
run(): Promise<void>;
|
|
23
22
|
outputJSON(diffOutput: AsyncAPIDiff, outputType: string): void;
|
|
24
23
|
outputYAML(diffOutput: AsyncAPIDiff, outputType: string): void;
|
package/lib/commands/diff.js
CHANGED
|
@@ -167,18 +167,10 @@ Diff.flags = Object.assign({ help: core_1.Flags.help({ char: 'h' }), format: cor
|
|
|
167
167
|
}), 'no-error': core_1.Flags.boolean({
|
|
168
168
|
description: 'don\'t show error on breaking changes',
|
|
169
169
|
}), watch: (0, flags_1.watchFlag)() }, (0, parser_1.validationFlags)({ logDiagnostics: false }));
|
|
170
|
-
Diff.args =
|
|
171
|
-
{
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
required: true,
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
name: 'new',
|
|
178
|
-
description: 'new spec path, URL or context-name',
|
|
179
|
-
required: true,
|
|
180
|
-
},
|
|
181
|
-
];
|
|
170
|
+
Diff.args = {
|
|
171
|
+
old: core_1.Args.string({ description: 'old spec path, URL or context-name', required: true }),
|
|
172
|
+
new: core_1.Args.string({ description: 'new spec path, URL or context-name', required: true }),
|
|
173
|
+
};
|
|
182
174
|
/**
|
|
183
175
|
* A generic output function for diff output
|
|
184
176
|
* @param diffOutput The diff output data
|
|
@@ -1,30 +1,34 @@
|
|
|
1
1
|
import Command from '../../base';
|
|
2
2
|
import { Parser } from '@asyncapi/parser';
|
|
3
|
-
import type { Example } from '@oclif/core/lib/interfaces';
|
|
4
3
|
export default class Template extends Command {
|
|
5
4
|
static description: string;
|
|
6
|
-
static examples:
|
|
5
|
+
static examples: string[];
|
|
7
6
|
static flags: {
|
|
8
7
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
9
|
-
'disable-hook': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined>;
|
|
8
|
+
'disable-hook': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
9
|
'no-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
10
|
install: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
11
|
debug: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
|
-
'no-overwrite': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined>;
|
|
14
|
-
output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
12
|
+
'no-overwrite': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
14
|
'force-write': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
16
15
|
watch: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
17
|
-
param: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined>;
|
|
18
|
-
'map-base-url': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
16
|
+
param: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
17
|
+
'map-base-url': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
18
|
+
'registry-url': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
19
|
+
'registry-auth': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
20
|
+
'registry-token': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
19
21
|
};
|
|
20
22
|
static args: {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
23
|
+
asyncapi: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
24
|
+
template: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
25
|
+
};
|
|
24
26
|
parser: Parser;
|
|
25
27
|
run(): Promise<void>;
|
|
26
28
|
private parseArgs;
|
|
27
29
|
private parseFlags;
|
|
30
|
+
private registryURLParser;
|
|
31
|
+
private registryValidation;
|
|
28
32
|
private paramParser;
|
|
29
33
|
private disableHooksParser;
|
|
30
34
|
private mapBaseURLParser;
|
|
@@ -17,6 +17,7 @@ const generator_error_1 = require("../../errors/generator-error");
|
|
|
17
17
|
const parser_1 = require("@asyncapi/parser");
|
|
18
18
|
const prompts_1 = require("@clack/prompts");
|
|
19
19
|
const picocolors_1 = require("picocolors");
|
|
20
|
+
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
20
21
|
const templatesNotSupportingV3 = {
|
|
21
22
|
'@asyncapi/minimaltemplate': 'some link',
|
|
22
23
|
'@asyncapi/dotnet-nats-template': 'https://github.com/asyncapi/dotnet-nats-template/issues/384',
|
|
@@ -84,7 +85,7 @@ class Template extends base_1.default {
|
|
|
84
85
|
template = parsedArgs.template;
|
|
85
86
|
output = parsedArgs.output;
|
|
86
87
|
}
|
|
87
|
-
const parsedFlags = this.parseFlags(flags['disable-hook'], flags['param'], flags['map-base-url']);
|
|
88
|
+
const parsedFlags = this.parseFlags(flags['disable-hook'], flags['param'], flags['map-base-url'], flags['registry.url'], flags['registry.auth'], flags['registry.token']);
|
|
88
89
|
const options = {
|
|
89
90
|
forceWrite: flags['force-write'],
|
|
90
91
|
install: flags.install,
|
|
@@ -93,6 +94,11 @@ class Template extends base_1.default {
|
|
|
93
94
|
noOverwriteGlobs: flags['no-overwrite'],
|
|
94
95
|
mapBaseUrlToFolder: parsedFlags.mapBaseUrlToFolder,
|
|
95
96
|
disabledHooks: parsedFlags.disableHooks,
|
|
97
|
+
registry: {
|
|
98
|
+
url: flags['registry-url'],
|
|
99
|
+
auth: flags['registry-auth'],
|
|
100
|
+
token: flags['registry-token']
|
|
101
|
+
}
|
|
96
102
|
};
|
|
97
103
|
const asyncapiInput = (yield (0, SpecificationFile_1.load)(asyncapi)) || (yield (0, SpecificationFile_1.load)());
|
|
98
104
|
this.specFile = asyncapiInput;
|
|
@@ -165,13 +171,32 @@ class Template extends base_1.default {
|
|
|
165
171
|
return { asyncapi, template, output };
|
|
166
172
|
});
|
|
167
173
|
}
|
|
168
|
-
parseFlags(disableHooks, params, mapBaseUrl) {
|
|
174
|
+
parseFlags(disableHooks, params, mapBaseUrl, registryUrl, registryAuth, registryToken) {
|
|
169
175
|
return {
|
|
170
176
|
params: this.paramParser(params),
|
|
171
177
|
disableHooks: this.disableHooksParser(disableHooks),
|
|
172
178
|
mapBaseUrlToFolder: this.mapBaseURLParser(mapBaseUrl),
|
|
179
|
+
registryURLValidation: this.registryURLParser(registryUrl),
|
|
180
|
+
registryAuthentication: this.registryValidation(registryUrl, registryAuth, registryToken)
|
|
173
181
|
};
|
|
174
182
|
}
|
|
183
|
+
registryURLParser(input) {
|
|
184
|
+
if (!input) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
const isURL = /^https?:/;
|
|
188
|
+
if (!isURL.test(input.toLowerCase())) {
|
|
189
|
+
throw new Error('Invalid --registry-url flag. The param requires a valid http/https url.');
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
registryValidation(registryUrl, registryAuth, registryToken) {
|
|
193
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
194
|
+
const response = yield (0, node_fetch_1.default)(registryUrl);
|
|
195
|
+
if (response.status === 401 && !registryAuth && !registryToken) {
|
|
196
|
+
throw new Error('Need to pass either registryAuth in username:password encoded in Base64 or need to pass registryToken');
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
175
200
|
paramParser(inputs) {
|
|
176
201
|
if (!inputs) {
|
|
177
202
|
return {};
|
|
@@ -363,8 +388,18 @@ Template.flags = {
|
|
|
363
388
|
'map-base-url': core_1.Flags.string({
|
|
364
389
|
description: 'Maps all schema references from base url to local folder'
|
|
365
390
|
}),
|
|
391
|
+
'registry-url': core_1.Flags.string({
|
|
392
|
+
default: 'https://registry.npmjs.org',
|
|
393
|
+
description: 'Specifies the URL of the private registry for fetching templates and dependencies'
|
|
394
|
+
}),
|
|
395
|
+
'registry-auth': core_1.Flags.string({
|
|
396
|
+
description: 'The registry username and password encoded with base64, formatted as username:password'
|
|
397
|
+
}),
|
|
398
|
+
'registry-token': core_1.Flags.string({
|
|
399
|
+
description: 'The npm registry authentication token, that can be passed instead of base64 encoded username and password'
|
|
400
|
+
})
|
|
401
|
+
};
|
|
402
|
+
Template.args = {
|
|
403
|
+
asyncapi: core_1.Args.string({ description: '- Local path, url or context-name pointing to AsyncAPI file', required: true }),
|
|
404
|
+
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 }),
|
|
366
405
|
};
|
|
367
|
-
Template.args = [
|
|
368
|
-
{ name: 'asyncapi', description: '- Local path, url or context-name pointing to AsyncAPI file' },
|
|
369
|
-
{ name: 'template', description: '- Name of the generator template like for example @asyncapi/html-template or https://github.com/asyncapi/html-template' },
|
|
370
|
-
];
|
|
@@ -1,37 +1,32 @@
|
|
|
1
1
|
import Command from '../../base';
|
|
2
2
|
export default class Models extends Command {
|
|
3
3
|
static description: string;
|
|
4
|
-
static args:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} | {
|
|
9
|
-
name: string;
|
|
10
|
-
description: string;
|
|
11
|
-
options?: undefined;
|
|
12
|
-
})[];
|
|
4
|
+
static args: {
|
|
5
|
+
language: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
file: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
13
8
|
static flags: {
|
|
14
9
|
'log-diagnostics': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
15
|
-
'diagnostics-format': import("@oclif/core/lib/interfaces").OptionFlag<import("@stoplight/spectral-cli/dist/services/config").OutputFormat>;
|
|
16
|
-
'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<import("
|
|
10
|
+
'diagnostics-format': import("@oclif/core/lib/interfaces").OptionFlag<import("@stoplight/spectral-cli/dist/services/config").OutputFormat, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"error" | "warn" | "info" | "hint", import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
17
12
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
18
13
|
'no-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
19
|
-
output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
14
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
20
15
|
/**
|
|
21
16
|
* TypeScript specific options
|
|
22
17
|
*/
|
|
23
|
-
tsModelType: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
24
|
-
tsEnumType: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
25
|
-
tsModuleSystem: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
18
|
+
tsModelType: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
19
|
+
tsEnumType: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
20
|
+
tsModuleSystem: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
26
21
|
tsIncludeComments: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
27
|
-
tsExportType: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
22
|
+
tsExportType: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
28
23
|
tsJsonBinPack: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
29
24
|
tsMarshalling: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
30
25
|
tsExampleInstance: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
31
26
|
/**
|
|
32
27
|
* Go and Java specific package name to use for the generated models
|
|
33
28
|
*/
|
|
34
|
-
packageName: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
29
|
+
packageName: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
35
30
|
/**
|
|
36
31
|
* Java specific options
|
|
37
32
|
*/
|
|
@@ -41,13 +36,13 @@ export default class Models extends Command {
|
|
|
41
36
|
/**
|
|
42
37
|
* C++ and C# and PHP specific namespace to use for the generated models
|
|
43
38
|
*/
|
|
44
|
-
namespace: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
39
|
+
namespace: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
45
40
|
/**
|
|
46
41
|
* C# specific options
|
|
47
42
|
*/
|
|
48
43
|
csharpAutoImplement: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
49
44
|
csharpNewtonsoft: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
50
|
-
csharpArrayType: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
45
|
+
csharpArrayType: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
51
46
|
csharpHashcode: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
52
47
|
csharpEqual: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
53
48
|
csharpSystemJson: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
@@ -50,7 +50,7 @@ class Models extends base_1.default {
|
|
|
50
50
|
this.log(`Input is not a correct AsyncAPI document so it cannot be processed.${(0, parser_1.formatOutput)(severityErrors, 'stylish', 'error')}`);
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
|
-
// Modelina, atm, is not using @asyncapi/parser@v3.x but @asyncapi/parser@v2.x, so it still uses Parser-API v1.0.0.
|
|
53
|
+
// Modelina, atm, is not using @asyncapi/parser@v3.x but @asyncapi/parser@v2.x, so it still uses Parser-API v1.0.0.
|
|
54
54
|
// This call converts the parsed document object using @asyncapi/parser@v3.x (Parser-API v2) to a document compatible with the Parser-API version in use in @asyncapi/parser@v2.x (v1)
|
|
55
55
|
// This is needed until https://github.com/asyncapi/modelina/issues/1493 gets fixed.
|
|
56
56
|
const convertedDoc = (0, multi_parser_1.ConvertDocumentParserAPIVersion)(document.json(), 1);
|
|
@@ -276,14 +276,10 @@ class Models extends base_1.default {
|
|
|
276
276
|
}
|
|
277
277
|
exports.default = Models;
|
|
278
278
|
Models.description = 'Generates typed models';
|
|
279
|
-
Models.args =
|
|
280
|
-
{
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
options: Object.keys(Languages),
|
|
284
|
-
},
|
|
285
|
-
{ name: 'file', description: 'Path or URL to the AsyncAPI document, or context-name' },
|
|
286
|
-
];
|
|
279
|
+
Models.args = {
|
|
280
|
+
language: core_1.Args.string({ description: 'The language you want the typed models generated for.', options: Object.keys(Languages), required: true }),
|
|
281
|
+
file: core_1.Args.string({ description: 'Path or URL to the AsyncAPI document, or context-name', required: true }),
|
|
282
|
+
};
|
|
287
283
|
Models.flags = Object.assign({ help: core_1.Flags.help({ char: 'h' }), 'no-interactive': core_1.Flags.boolean({
|
|
288
284
|
description: 'Disable interactive mode and run with the provided flags.',
|
|
289
285
|
required: false,
|
|
@@ -3,10 +3,10 @@ export default class NewFile extends Command {
|
|
|
3
3
|
static description: string;
|
|
4
4
|
static flags: {
|
|
5
5
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
6
|
-
'file-name': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
7
|
-
example: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
6
|
+
'file-name': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
example: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
8
|
studio: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
-
port: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
|
|
9
|
+
port: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
10
|
'no-tty': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
11
|
};
|
|
12
12
|
static examples: string[];
|
|
@@ -10,9 +10,9 @@ export default class NewGlee extends Command {
|
|
|
10
10
|
};
|
|
11
11
|
static flags: {
|
|
12
12
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
13
|
-
name: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
14
|
-
template: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
15
|
-
file: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
13
|
+
name: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
|
+
template: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
|
+
file: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
16
16
|
'force-write': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
17
17
|
};
|
|
18
18
|
getFilteredServers(serversObject: any): Promise<string[]>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import Command from '../base';
|
|
2
|
-
import { Example } from '@oclif/core/lib/interfaces';
|
|
3
2
|
import { Parser } from '@asyncapi/parser';
|
|
4
3
|
export declare enum Optimizations {
|
|
5
4
|
REMOVE_COMPONENTS = "remove-components",
|
|
@@ -17,18 +16,16 @@ export default class Optimize extends Command {
|
|
|
17
16
|
isInteractive: boolean;
|
|
18
17
|
selectedOptimizations?: Optimizations[];
|
|
19
18
|
outputMethod?: Outputs;
|
|
20
|
-
static examples:
|
|
19
|
+
static examples: string[];
|
|
21
20
|
static flags: {
|
|
22
21
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
23
|
-
optimization: import("@oclif/core/lib/interfaces").OptionFlag<string[]>;
|
|
24
|
-
output: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
22
|
+
optimization: import("@oclif/core/lib/interfaces").OptionFlag<string[], import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
23
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
25
24
|
'no-tty': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
26
25
|
};
|
|
27
26
|
static args: {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
required: boolean;
|
|
31
|
-
}[];
|
|
27
|
+
'spec-file': import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
28
|
+
};
|
|
32
29
|
parser: Parser;
|
|
33
30
|
run(): Promise<void>;
|
|
34
31
|
private showOptimizations;
|
package/lib/commands/optimize.js
CHANGED
|
@@ -201,6 +201,6 @@ Optimize.flags = {
|
|
|
201
201
|
output: core_1.Flags.string({ char: 'o', default: Outputs.TERMINAL, options: Object.values(Outputs), description: 'select where you want the output.' }),
|
|
202
202
|
'no-tty': core_1.Flags.boolean({ description: 'do not use an interactive terminal', default: false }),
|
|
203
203
|
};
|
|
204
|
-
Optimize.args =
|
|
205
|
-
|
|
206
|
-
|
|
204
|
+
Optimize.args = {
|
|
205
|
+
'spec-file': core_1.Args.string({ description: 'spec path, url, or context-name', required: false }),
|
|
206
|
+
};
|
|
@@ -3,9 +3,8 @@ export default class StartStudio extends Command {
|
|
|
3
3
|
static description: string;
|
|
4
4
|
static flags: {
|
|
5
5
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
6
|
-
file: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
7
|
-
port: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
|
|
6
|
+
file: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
port: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
8
|
};
|
|
9
|
-
static args: never[];
|
|
10
9
|
run(): Promise<void>;
|
|
11
10
|
}
|
|
@@ -3,15 +3,13 @@ export default class Validate extends Command {
|
|
|
3
3
|
static description: string;
|
|
4
4
|
static flags: {
|
|
5
5
|
'log-diagnostics': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
6
|
-
'diagnostics-format': import("@oclif/core/lib/interfaces").OptionFlag<import("@stoplight/spectral-cli/dist/services/config").OutputFormat>;
|
|
7
|
-
'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<import("
|
|
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<"error" | "warn" | "info" | "hint", import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
8
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
9
9
|
watch: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
10
|
};
|
|
11
11
|
static args: {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
required: boolean;
|
|
15
|
-
}[];
|
|
12
|
+
'spec-file': import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
13
|
+
};
|
|
16
14
|
run(): Promise<void>;
|
|
17
15
|
}
|
package/lib/commands/validate.js
CHANGED
|
@@ -28,6 +28,6 @@ class Validate extends base_1.default {
|
|
|
28
28
|
exports.default = Validate;
|
|
29
29
|
Validate.description = 'validate asyncapi file';
|
|
30
30
|
Validate.flags = Object.assign({ help: core_1.Flags.help({ char: 'h' }), watch: (0, flags_1.watchFlag)() }, (0, parser_1.validationFlags)());
|
|
31
|
-
Validate.args =
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
Validate.args = {
|
|
32
|
+
'spec-file': core_1.Args.string({ description: 'spec path, url, or context-name', required: false }),
|
|
33
|
+
};
|
|
@@ -32,7 +32,7 @@ const hook = function (opts) {
|
|
|
32
32
|
// if valid topic, update binHelp with topic
|
|
33
33
|
binHelp = `${binHelp} ${idSplit[0]}`;
|
|
34
34
|
}
|
|
35
|
-
//if there is a topic in the opts we just upgrade the our commnad like
|
|
35
|
+
//if there is a topic in the opts we just upgrade the our commnad like
|
|
36
36
|
// alter the suggestion in the help scenario so that help is the first command
|
|
37
37
|
// otherwise the user will be presented 'did you mean 'help'?' instead of 'did you mean "help <command>"?'
|
|
38
38
|
let suggestion = (/:?help:?/).test(opts.id)
|
|
@@ -46,7 +46,7 @@ const hook = function (opts) {
|
|
|
46
46
|
if (opts.id === 'help') {
|
|
47
47
|
readableSuggestion = '--help';
|
|
48
48
|
}
|
|
49
|
-
response = yield core_1.
|
|
49
|
+
response = yield core_1.ux.prompt(`Did you mean ${chalk_1.default.blueBright(readableSuggestion)}? [y/n]`, { timeout: 10000 });
|
|
50
50
|
}
|
|
51
51
|
catch (error) {
|
|
52
52
|
this.log('');
|
package/lib/parser.d.ts
CHANGED
|
@@ -14,10 +14,10 @@ export declare enum ValidationStatus {
|
|
|
14
14
|
}
|
|
15
15
|
export declare function validationFlags({ logDiagnostics }?: ValidationFlagsOptions): {
|
|
16
16
|
'log-diagnostics': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
17
|
-
'diagnostics-format': import("@oclif/core/lib/interfaces").OptionFlag<OutputFormat>;
|
|
18
|
-
'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<
|
|
17
|
+
'diagnostics-format': import("@oclif/core/lib/interfaces").OptionFlag<OutputFormat, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
18
|
+
'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"error" | "warn" | "info" | "hint", import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
19
19
|
};
|
|
20
|
-
interface ValidateOptions {
|
|
20
|
+
export interface ValidateOptions {
|
|
21
21
|
'log-diagnostics'?: boolean;
|
|
22
22
|
'diagnostics-format'?: `${OutputFormat}`;
|
|
23
23
|
'fail-severity'?: SeverityKind;
|
package/lib/parser.js
CHANGED
|
@@ -36,16 +36,16 @@ function validationFlags({ logDiagnostics = true } = {}) {
|
|
|
36
36
|
default: logDiagnostics,
|
|
37
37
|
allowNo: true,
|
|
38
38
|
}),
|
|
39
|
-
'diagnostics-format': core_1.Flags.
|
|
39
|
+
'diagnostics-format': core_1.Flags.option({
|
|
40
40
|
description: 'format to use for validation diagnostics',
|
|
41
41
|
options: Object.values(config_1.OutputFormat),
|
|
42
42
|
default: config_1.OutputFormat.STYLISH,
|
|
43
|
-
}),
|
|
44
|
-
'fail-severity': core_1.Flags.
|
|
43
|
+
})(),
|
|
44
|
+
'fail-severity': core_1.Flags.option({
|
|
45
45
|
description: 'diagnostics of this level or above will trigger a failure exit code',
|
|
46
46
|
options: ['error', 'warn', 'info', 'hint'],
|
|
47
47
|
default: 'error',
|
|
48
|
-
}),
|
|
48
|
+
})(),
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
exports.validationFlags = validationFlags;
|
package/oclif.manifest.json
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
"args": {},
|
|
6
6
|
"description": "Bundle one or multiple AsyncAPI Documents and their references together.",
|
|
7
7
|
"examples": [
|
|
8
|
+
"asyncapi bundle ./asyncapi.yaml > final-asyncapi.yaml",
|
|
8
9
|
"asyncapi bundle ./asyncapi.yaml --output final-asyncapi.yaml",
|
|
9
10
|
"asyncapi bundle ./asyncapi.yaml ./features.yaml",
|
|
10
11
|
"asyncapi bundle ./asyncapi.yaml ./features.yaml --base ./main.yaml",
|
|
@@ -212,7 +213,6 @@
|
|
|
212
213
|
"name": "diagnostics-format",
|
|
213
214
|
"default": "stylish",
|
|
214
215
|
"hasDynamicHelp": false,
|
|
215
|
-
"helpValue": "(json|stylish|junit|html|text|teamcity|pretty)",
|
|
216
216
|
"multiple": false,
|
|
217
217
|
"options": [
|
|
218
218
|
"json",
|
|
@@ -230,7 +230,6 @@
|
|
|
230
230
|
"name": "fail-severity",
|
|
231
231
|
"default": "error",
|
|
232
232
|
"hasDynamicHelp": false,
|
|
233
|
-
"helpValue": "(error|warn|info|hint)",
|
|
234
233
|
"multiple": false,
|
|
235
234
|
"options": [
|
|
236
235
|
"error",
|
|
@@ -370,7 +369,6 @@
|
|
|
370
369
|
"name": "diagnostics-format",
|
|
371
370
|
"default": "stylish",
|
|
372
371
|
"hasDynamicHelp": false,
|
|
373
|
-
"helpValue": "(json|stylish|junit|html|text|teamcity|pretty)",
|
|
374
372
|
"multiple": false,
|
|
375
373
|
"options": [
|
|
376
374
|
"json",
|
|
@@ -388,7 +386,6 @@
|
|
|
388
386
|
"name": "fail-severity",
|
|
389
387
|
"default": "error",
|
|
390
388
|
"hasDynamicHelp": false,
|
|
391
|
-
"helpValue": "(error|warn|info|hint)",
|
|
392
389
|
"multiple": false,
|
|
393
390
|
"options": [
|
|
394
391
|
"error",
|
|
@@ -515,11 +512,13 @@
|
|
|
515
512
|
"args": {
|
|
516
513
|
"asyncapi": {
|
|
517
514
|
"description": "- Local path, url or context-name pointing to AsyncAPI file",
|
|
518
|
-
"name": "asyncapi"
|
|
515
|
+
"name": "asyncapi",
|
|
516
|
+
"required": true
|
|
519
517
|
},
|
|
520
518
|
"template": {
|
|
521
519
|
"description": "- Name of the generator template like for example @asyncapi/html-template or https://github.com/asyncapi/html-template",
|
|
522
|
-
"name": "template"
|
|
520
|
+
"name": "template",
|
|
521
|
+
"required": true
|
|
523
522
|
}
|
|
524
523
|
},
|
|
525
524
|
"description": "Generates whatever you want using templates compatible with AsyncAPI Generator.",
|
|
@@ -605,6 +604,28 @@
|
|
|
605
604
|
"hasDynamicHelp": false,
|
|
606
605
|
"multiple": false,
|
|
607
606
|
"type": "option"
|
|
607
|
+
},
|
|
608
|
+
"registry-url": {
|
|
609
|
+
"description": "Specifies the URL of the private registry for fetching templates and dependencies",
|
|
610
|
+
"name": "registry-url",
|
|
611
|
+
"default": "https://registry.npmjs.org",
|
|
612
|
+
"hasDynamicHelp": false,
|
|
613
|
+
"multiple": false,
|
|
614
|
+
"type": "option"
|
|
615
|
+
},
|
|
616
|
+
"registry-auth": {
|
|
617
|
+
"description": "The registry username and password encoded with base64, formatted as username:password",
|
|
618
|
+
"name": "registry-auth",
|
|
619
|
+
"hasDynamicHelp": false,
|
|
620
|
+
"multiple": false,
|
|
621
|
+
"type": "option"
|
|
622
|
+
},
|
|
623
|
+
"registry-token": {
|
|
624
|
+
"description": "The npm registry authentication token, that can be passed instead of base64 encoded username and password",
|
|
625
|
+
"name": "registry-token",
|
|
626
|
+
"hasDynamicHelp": false,
|
|
627
|
+
"multiple": false,
|
|
628
|
+
"type": "option"
|
|
608
629
|
}
|
|
609
630
|
},
|
|
610
631
|
"hasDynamicHelp": false,
|
|
@@ -660,11 +681,13 @@
|
|
|
660
681
|
"kotlin",
|
|
661
682
|
"php",
|
|
662
683
|
"cplusplus"
|
|
663
|
-
]
|
|
684
|
+
],
|
|
685
|
+
"required": true
|
|
664
686
|
},
|
|
665
687
|
"file": {
|
|
666
688
|
"description": "Path or URL to the AsyncAPI document, or context-name",
|
|
667
|
-
"name": "file"
|
|
689
|
+
"name": "file",
|
|
690
|
+
"required": true
|
|
668
691
|
}
|
|
669
692
|
},
|
|
670
693
|
"description": "Generates typed models",
|
|
@@ -868,7 +891,6 @@
|
|
|
868
891
|
"name": "diagnostics-format",
|
|
869
892
|
"default": "stylish",
|
|
870
893
|
"hasDynamicHelp": false,
|
|
871
|
-
"helpValue": "(json|stylish|junit|html|text|teamcity|pretty)",
|
|
872
894
|
"multiple": false,
|
|
873
895
|
"options": [
|
|
874
896
|
"json",
|
|
@@ -886,7 +908,6 @@
|
|
|
886
908
|
"name": "fail-severity",
|
|
887
909
|
"default": "error",
|
|
888
910
|
"hasDynamicHelp": false,
|
|
889
|
-
"helpValue": "(error|warn|info|hint)",
|
|
890
911
|
"multiple": false,
|
|
891
912
|
"options": [
|
|
892
913
|
"error",
|
|
@@ -1260,7 +1281,7 @@
|
|
|
1260
1281
|
"required": true
|
|
1261
1282
|
},
|
|
1262
1283
|
"new-spec-file-path": {
|
|
1263
|
-
"description": "
|
|
1284
|
+
"description": "file path of the spec file",
|
|
1264
1285
|
"name": "new-spec-file-path",
|
|
1265
1286
|
"required": true
|
|
1266
1287
|
}
|
|
@@ -1448,5 +1469,5 @@
|
|
|
1448
1469
|
]
|
|
1449
1470
|
}
|
|
1450
1471
|
},
|
|
1451
|
-
"version": "1.
|
|
1472
|
+
"version": "1.14.0"
|
|
1452
1473
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asyncapi/cli",
|
|
3
3
|
"description": "All in one CLI for all AsyncAPI tools",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.14.0",
|
|
5
5
|
"author": "@asyncapi",
|
|
6
6
|
"bin": {
|
|
7
7
|
"asyncapi": "./bin/run_bin"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"@asyncapi/raml-dt-schema-parser": "^4.0.22",
|
|
22
22
|
"@asyncapi/studio": "^0.20.0",
|
|
23
23
|
"@clack/prompts": "^0.7.0",
|
|
24
|
-
"@oclif/core": "^
|
|
24
|
+
"@oclif/core": "^3",
|
|
25
25
|
"@oclif/errors": "^1.3.6",
|
|
26
26
|
"@oclif/plugin-not-found": "^2.3.22",
|
|
27
27
|
"@smoya/asyncapi-adoption-metrics": "^2.4.7",
|
|
@@ -169,6 +169,7 @@
|
|
|
169
169
|
"release": "semantic-release",
|
|
170
170
|
"test": "npm run test:unit",
|
|
171
171
|
"test:unit": "cross-env NODE_ENV=development TEST=1 CUSTOM_CONTEXT_FILENAME=\"test.asyncapi-cli\" CUSTOM_CONTEXT_FILE_LOCATION=\"\" nyc --extension .ts mocha --require ts-node/register --require test/helpers/init.js --reporter spec --timeout 100000 \"test/**/*.test.ts\"",
|
|
172
|
+
"test:one": "cross-env NODE_ENV=development TEST=1 CUSTOM_CONTEXT_FILENAME=\"test.asyncapi-cli\" CUSTOM_CONTEXT_FILE_LOCATION=\"\" nyc --extension .ts mocha --require ts-node/register --require test/helpers/init.js --reporter spec --timeout 100000",
|
|
172
173
|
"get-version": "echo $npm_package_version",
|
|
173
174
|
"createhook": "oclif generate hook myhook --event=command_not_found",
|
|
174
175
|
"createhookinit": "oclif generate hook inithook --event=init"
|