@axinom/mosaic-cli 0.18.0 → 0.18.1
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/dist/cli/index.js +4 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/apply-templates/index.js +1 -1
- package/dist/commands/apply-templates/index.js.map +1 -1
- package/dist/commands/create-extension-config/create-extension-config.js +5 -4
- package/dist/commands/create-extension-config/create-extension-config.js.map +1 -1
- package/dist/commands/get-access-token/get-dev-access-token.js +1 -1
- package/dist/commands/get-access-token/index.js +1 -1
- package/dist/commands/graphql-diff.js +2 -2
- package/dist/commands/msg-codegen/codegen.js +13 -13
- package/dist/commands/msg-codegen/index.js +1 -1
- package/dist/commands/msg-codegen/lint.js +1 -1
- package/dist/commands/msg-diff/index.js +1 -1
- package/dist/commands/msg-diff/msg-diff.d.ts +1 -1
- package/dist/commands/msg-diff/msg-diff.js +5 -5
- package/dist/commands/publish-schema-to-db/abstractions/index.js +5 -5
- package/dist/commands/publish-schema-to-db/abstractions/index.js.map +1 -1
- package/dist/commands/publish-schema-to-db/abstractions/pg-type.d.ts +1 -1
- package/dist/commands/publish-schema-to-db/generate.js +1 -1
- package/dist/commands/publish-schema-to-db/index.js +1 -1
- package/dist/commands/publish-schema-to-db/pg-models/columns/index.js +4 -4
- package/dist/commands/publish-schema-to-db/pg-models/columns/index.js.map +1 -1
- package/dist/commands/publish-schema-to-db/pg-models/json-schema-parse-utils.js +1 -1
- package/dist/commands/publish-schema-to-db/pg-models/pg-sql-gen-utils.js +1 -1
- package/dist/commands/publish-schema-to-db/pg-models/tables/index.js +3 -3
- package/dist/commands/publish-schema-to-db/pg-models/tables/index.js.map +1 -1
- package/dist/commands/publish-schema-to-db/postprocessors/index.js +6 -6
- package/dist/commands/publish-schema-to-db/postprocessors/index.js.map +1 -1
- package/dist/common/index.js +1 -1
- package/dist/common/index.js.map +1 -1
- package/dist/exports.js +2 -2
- package/dist/exports.js.map +1 -1
- package/package.json +8 -8
- package/src/commands/apply-templates/apply-templates.spec.ts +6 -5
- package/src/commands/msg-diff/msg-diff.spec.ts +15 -15
- package/src/commands/msg-diff/msg-diff.ts +1 -1
- package/src/commands/publish-schema-to-db/jest.config.js +1 -0
package/dist/cli/index.js
CHANGED
|
@@ -11,7 +11,7 @@ const msg_codegen_1 = require("../commands/msg-codegen");
|
|
|
11
11
|
const msg_diff_1 = require("../commands/msg-diff");
|
|
12
12
|
const pg_dump_1 = require("../commands/pg-dump");
|
|
13
13
|
const publish_schema_to_db_1 = require("../commands/publish-schema-to-db");
|
|
14
|
-
const run = () =>
|
|
14
|
+
const run = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
15
15
|
yargs
|
|
16
16
|
.scriptName('mosaic')
|
|
17
17
|
.env()
|
|
@@ -24,9 +24,10 @@ const run = () => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () {
|
|
|
24
24
|
.command(create_extension_config_1.createExtensionConfigCommand)
|
|
25
25
|
.command(graphql_diff_1.graphqlDiff);
|
|
26
26
|
//adding cli extensions:
|
|
27
|
-
yield Promise.all((0, create_extension_config_1.getExtensions)().map((library) =>
|
|
27
|
+
yield Promise.all((0, create_extension_config_1.getExtensions)().map((library) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
28
|
+
var _a;
|
|
28
29
|
try {
|
|
29
|
-
const { cliExtension } = yield Promise.resolve().then(() => require(
|
|
30
|
+
const { cliExtension } = yield (_a = library, Promise.resolve().then(() => require(_a)));
|
|
30
31
|
if (cliExtension) {
|
|
31
32
|
cliExtension().map((cmd) => {
|
|
32
33
|
yargs.command(cmd);
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;;AAAA,+BAA+B;AAC/B,iEAA6D;AAC7D,iFAG6C;AAC7C,mEAA8D;AAC9D,2DAAuD;AACvD,yDAAqD;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EAAE,GAAG,YAAa,OAAO,4CAAC,CAAC;YAC/C,IAAI,YAAY,EAAE;gBAChB,YAAY,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;oBACzB,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;gBACrB,CAAC,CAAC,CAAC;aACJ;SACF;QAAC,OAAO,KAAK,EAAE;YACd,gEAAgE;SACjE;IACH,CAAC,CAAA,CAAC,CACH,CAAC;IAEF,KAAK;SACF,aAAa,EAAE;SACf,IAAI,EAAE;SACN,MAAM,CAAC,wDAAwD,CAAC,CAAC,IAAI,CAAC;AAC3E,CAAC,CAAA,CAAC;AAjCW,QAAA,GAAG,OAiCd"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
|
|
4
|
+
tslib_1.__exportStar(require("./apply-templates"), exports);
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/apply-templates/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/apply-templates/index.ts"],"names":[],"mappings":";;;AAAA,4DAAkC"}
|
|
@@ -21,7 +21,7 @@ const mosaicLibraryRegex = /(?<prefix>@axinom\/mosaic-)(?<library>[-A-Za-z0-9]+)
|
|
|
21
21
|
* Find all Mosaic packages used in project.
|
|
22
22
|
* @returns list of installed packages.
|
|
23
23
|
*/
|
|
24
|
-
const findInstalledPackages = () =>
|
|
24
|
+
const findInstalledPackages = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
25
25
|
var _a;
|
|
26
26
|
let installedMosaicLibs = [];
|
|
27
27
|
const yarnVersionResult = yield execAsync('yarn -v');
|
|
@@ -59,14 +59,15 @@ exports.getExtensionConfigPath = getExtensionConfigPath;
|
|
|
59
59
|
/**
|
|
60
60
|
* Creates `.mosaic` configuration file with list of libraries, that provide extension for Mosaic CLI.
|
|
61
61
|
*/
|
|
62
|
-
const createExtensionConfig = () =>
|
|
62
|
+
const createExtensionConfig = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
63
63
|
console.log(`Starting extension configuration generation!`);
|
|
64
64
|
const installedMosaicLibs = yield findInstalledPackages();
|
|
65
65
|
const extensions = [];
|
|
66
|
-
yield Promise.all(installedMosaicLibs.map((lib) =>
|
|
66
|
+
yield Promise.all(installedMosaicLibs.map((lib) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
67
|
+
var _b;
|
|
67
68
|
//filter libraries, that have cli extension
|
|
68
69
|
try {
|
|
69
|
-
const result = yield Promise.resolve().then(() => require(
|
|
70
|
+
const result = yield (_b = lib, Promise.resolve().then(() => require(_b)));
|
|
70
71
|
if (result.cliExtension) {
|
|
71
72
|
extensions.push(lib);
|
|
72
73
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-extension-config.js","sourceRoot":"","sources":["../../../src/commands/create-extension-config/create-extension-config.ts"],"names":[],"mappings":";;;;AAAA,iDAAqC;AACrC,qDAAqD;AACrD,yBAAyB;AACzB,6BAA6B;AAC7B,+BAAiC;AACjC,MAAM,SAAS,GAAG,IAAA,gBAAS,EAAC,oBAAI,CAAC,CAAC;AAElC;;;GAGG;AACH,MAAM,uBAAuB,GAAG,YAAY,CAAC;AAE7C;;GAEG;AACH,MAAM,kBAAkB,GACtB,yDAAyD,CAAC;AAE5D;;;GAGG;AACH,MAAM,qBAAqB,GAAG,GAA4B,EAAE;;IAC1D,IAAI,mBAAmB,GAAa,EAAE,CAAC;IACvC,MAAM,iBAAiB,GAAG,MAAM,SAAS,CAAC,SAAS,CAAC,CAAC;IAErD,IAAI,iBAAiB,CAAC,MAAM,EAAE;QAC5B,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC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E
|
|
1
|
+
{"version":3,"file":"create-extension-config.js","sourceRoot":"","sources":["../../../src/commands/create-extension-config/create-extension-config.ts"],"names":[],"mappings":";;;;AAAA,iDAAqC;AACrC,qDAAqD;AACrD,yBAAyB;AACzB,6BAA6B;AAC7B,+BAAiC;AACjC,MAAM,SAAS,GAAG,IAAA,gBAAS,EAAC,oBAAI,CAAC,CAAC;AAElC;;;GAGG;AACH,MAAM,uBAAuB,GAAG,YAAY,CAAC;AAE7C;;GAEG;AACH,MAAM,kBAAkB,GACtB,yDAAyD,CAAC;AAE5D;;;GAGG;AACH,MAAM,qBAAqB,GAAG,GAA4B,EAAE;;IAC1D,IAAI,mBAAmB,GAAa,EAAE,CAAC;IACvC,MAAM,iBAAiB,GAAG,MAAM,SAAS,CAAC,SAAS,CAAC,CAAC;IAErD,IAAI,iBAAiB,CAAC,MAAM,EAAE;QAC5B,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;KACvC;IAED,IAAI,iBAAiB,CAAC,MAAM,EAAE;QAC5B,MAAM,mBAAmB,GAAG,uBAAuB,CAAC,IAAI,CACtD,iBAAiB,CAAC,MAAM,CACzB;YACC,CAAC,CAAC,gDAAgD;YAClD,CAAC,CAAC,0DAA0D,CAAC;QAE/D,MAAM,kBAAkB,GAAG,MAAM,SAAS,CAAC,mBAAmB,CAAC,CAAC;QAChE,IAAI,kBAAkB,CAAC,MAAM,EAAE;YAC7B,mBAAmB,GAAG;gBACpB,GAAG,IAAI,GAAG,CAAC,MAAA,kBAAkB,CAAC,MAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,mCAAI,EAAE,CAAC;aACtE,CAAC;SACH;QACD,IAAI,kBAAkB,CAAC,MAAM,EAAE;YAC7B,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;SACxC;KACF;IACD,OAAO,mBAAmB,CAAC;AAC7B,CAAC,CAAA,CAAC;AAEF;;;GAGG;AACI,MAAM,sBAAsB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A,qBAAqB,yBAyBhC"}
|
|
@@ -7,7 +7,7 @@ const fs_1 = require("fs");
|
|
|
7
7
|
/**
|
|
8
8
|
* Returns a development ID JWT token based on passed options.
|
|
9
9
|
*/
|
|
10
|
-
const getDevAccessToken = (options) =>
|
|
10
|
+
const getDevAccessToken = (options) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
11
11
|
const permissions = JSON.parse((0, fs_1.readFileSync)(options.permissionsFile, 'utf-8'));
|
|
12
12
|
const serviceAccountToken = yield (0, mosaic_id_link_be_1.getServiceAccountToken)(options.authEndpoint, options.clientId, options.clientSecret);
|
|
13
13
|
return (0, mosaic_id_link_be_1.devGenerateUserAccessTokenWithPermissions)(options.authEndpoint, serviceAccountToken.accessToken, permissions, options.userEmail, options.expiration, options.failOnUnknownPermission);
|
|
@@ -50,7 +50,7 @@ exports.getAccessToken = {
|
|
|
50
50
|
number: true,
|
|
51
51
|
default: 2592000,
|
|
52
52
|
}),
|
|
53
|
-
handler: (options) =>
|
|
53
|
+
handler: (options) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
54
54
|
try {
|
|
55
55
|
const result = yield (0, get_dev_access_token_1.getDevAccessToken)(options);
|
|
56
56
|
console.log(chalk.greenBright(result.accessToken));
|
|
@@ -37,7 +37,7 @@ exports.graphqlDiff = {
|
|
|
37
37
|
type: 'boolean',
|
|
38
38
|
default: false,
|
|
39
39
|
}),
|
|
40
|
-
handler: (argv) =>
|
|
40
|
+
handler: (argv) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
41
41
|
let totalBreaking = 0;
|
|
42
42
|
try {
|
|
43
43
|
for (const file of argv.files) {
|
|
@@ -54,7 +54,7 @@ exports.graphqlDiff = {
|
|
|
54
54
|
}),
|
|
55
55
|
};
|
|
56
56
|
function gqlDiff(file, branch, verbose) {
|
|
57
|
-
return
|
|
57
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
58
58
|
const root = path.dirname(__dirname);
|
|
59
59
|
const relPath = path.relative(root, file);
|
|
60
60
|
console.log(`Comparing schema '${relPath}' with branch '${branch}':`);
|
|
@@ -33,7 +33,7 @@ class Codegen {
|
|
|
33
33
|
this.messagingSettingsOutputRoot = path.join(this.outputRoot, 'config');
|
|
34
34
|
}
|
|
35
35
|
run() {
|
|
36
|
-
return
|
|
36
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
37
37
|
console.log('Running message codegen.');
|
|
38
38
|
console.log(`* schema root: ${this.schemaRoot}`);
|
|
39
39
|
console.log(`* output root: ${this.outputRoot}`);
|
|
@@ -50,7 +50,7 @@ class Codegen {
|
|
|
50
50
|
* @param dir - Directory to walk.
|
|
51
51
|
*/
|
|
52
52
|
walk(dir) {
|
|
53
|
-
return
|
|
53
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
54
54
|
const items = yield fs.promises.readdir(dir);
|
|
55
55
|
const fullPathItems = items.map((i) => path.join(dir, i));
|
|
56
56
|
const dirs = fullPathItems.filter((i) => fs.statSync(i).isDirectory());
|
|
@@ -102,7 +102,7 @@ class Codegen {
|
|
|
102
102
|
* @param asyncApiFile - path to AsyncAPI document
|
|
103
103
|
*/
|
|
104
104
|
processAsyncAPIDocument(asyncApiFile) {
|
|
105
|
-
return
|
|
105
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
106
106
|
const schemaContent = fs.readFileSync(asyncApiFile, 'utf8');
|
|
107
107
|
const asyncApiDocument = yield (0, parser_1.parse)(schemaContent, { path: asyncApiFile });
|
|
108
108
|
//export Typescript models
|
|
@@ -122,7 +122,7 @@ class Codegen {
|
|
|
122
122
|
* @param outputPath - output path for generated files
|
|
123
123
|
*/
|
|
124
124
|
exportTsModels(asyncAPIDocument, outputPath) {
|
|
125
|
-
return
|
|
125
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
126
126
|
const generator = new modelina_1.TypeScriptGenerator({
|
|
127
127
|
modelType: 'interface',
|
|
128
128
|
namingConvention: CustomNamingConvention,
|
|
@@ -181,7 +181,7 @@ class Codegen {
|
|
|
181
181
|
* @param outputPath - output path for generated files
|
|
182
182
|
*/
|
|
183
183
|
exportSchemas(asyncAPIDocument, outputPath) {
|
|
184
|
-
return
|
|
184
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
185
185
|
const groupedSchemas = {};
|
|
186
186
|
for (const [, message] of asyncAPIDocument.allMessages()) {
|
|
187
187
|
const schemaPathPrefix = getModelPathPrefix(getMessageTitle(message));
|
|
@@ -220,7 +220,7 @@ class Codegen {
|
|
|
220
220
|
* @param outputPath - output path for generated files
|
|
221
221
|
*/
|
|
222
222
|
exportSettings(asyncAPIDocument, outputPath) {
|
|
223
|
-
return
|
|
223
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
224
224
|
const serviceTitle = getServiceTitle(asyncAPIDocument);
|
|
225
225
|
const serviceId = getServiceId(asyncAPIDocument);
|
|
226
226
|
const channelsData = [];
|
|
@@ -253,7 +253,7 @@ class Codegen {
|
|
|
253
253
|
* @param outputPath - output path for generated files
|
|
254
254
|
*/
|
|
255
255
|
generateMessagingSettings(serviceId, serviceTitle, channelsData, outputPath) {
|
|
256
|
-
return
|
|
256
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
257
257
|
const messagingSettingFiles = [];
|
|
258
258
|
messagingSettingFiles.push(yield this.createMessagingSettingFile(true, serviceId, serviceTitle, channelsData.filter((data) => data.isMultiTenant === true), outputPath));
|
|
259
259
|
messagingSettingFiles.push(yield this.createMessagingSettingFile(false, serviceId, serviceTitle, channelsData.filter((data) => data.isMultiTenant === false), outputPath));
|
|
@@ -271,7 +271,7 @@ class Codegen {
|
|
|
271
271
|
* @param outputPath - output path for generated files
|
|
272
272
|
*/
|
|
273
273
|
createMessagingSettingFile(isMultiTenant, serviceId, serviceTitle, channelsData, outputPath) {
|
|
274
|
-
return
|
|
274
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
275
275
|
if (channelsData.length === 0) {
|
|
276
276
|
return ``;
|
|
277
277
|
}
|
|
@@ -329,7 +329,7 @@ class Codegen {
|
|
|
329
329
|
* @param outPath - Output JSON schema path.
|
|
330
330
|
*/
|
|
331
331
|
bundleSchema(jsonSchema, outPath) {
|
|
332
|
-
return
|
|
332
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
333
333
|
yield fs.promises.mkdir(path.dirname(outPath), { recursive: true });
|
|
334
334
|
yield fs.promises.writeFile(outPath, JSON.stringify(jsonSchema, null, 2));
|
|
335
335
|
});
|
|
@@ -344,7 +344,7 @@ class Codegen {
|
|
|
344
344
|
* @param outPath - Path where to write `index.ts`.
|
|
345
345
|
*/
|
|
346
346
|
barrelExportTs(files, dirs, outPath) {
|
|
347
|
-
return
|
|
347
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
348
348
|
console.log(`Rolling up TS exports to ${outPath}.`);
|
|
349
349
|
const items = [
|
|
350
350
|
...files.map((f) => path.basename(f, '.ts')),
|
|
@@ -410,7 +410,7 @@ class Codegen {
|
|
|
410
410
|
* @param outPath - Path where to write `index.ts`.
|
|
411
411
|
*/
|
|
412
412
|
barrelExportSettings(files, dirs, outPath) {
|
|
413
|
-
return
|
|
413
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
414
414
|
console.log(`Rolling up Messaging Settings exports to ${outPath}.`);
|
|
415
415
|
const items = [
|
|
416
416
|
...files.map((f) => path.basename(f, '.ts')),
|
|
@@ -443,7 +443,7 @@ class Codegen {
|
|
|
443
443
|
* @param outPath - Path where to write `index.ts`.
|
|
444
444
|
*/
|
|
445
445
|
barrelExportSchema(files, dirs, outPath) {
|
|
446
|
-
return
|
|
446
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
447
447
|
console.log(`Rolling up JSON exports to ${outPath}.`);
|
|
448
448
|
const items = [
|
|
449
449
|
...files.map((f) => path.basename(f, '.json')),
|
|
@@ -550,7 +550,7 @@ const EXPORT_INTERFACE_PRESET = {
|
|
|
550
550
|
const EXPORT_UNION_TYPE_PRESET = {
|
|
551
551
|
type: {
|
|
552
552
|
self({ renderer }) {
|
|
553
|
-
return
|
|
553
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
554
554
|
return `export ${yield renderer.defaultSelf()}`;
|
|
555
555
|
});
|
|
556
556
|
},
|
|
@@ -36,7 +36,7 @@ exports.msgCodegen = {
|
|
|
36
36
|
describe: 'Path to a Spectral ruleset file for linting.',
|
|
37
37
|
type: 'string',
|
|
38
38
|
}),
|
|
39
|
-
handler: (argv) =>
|
|
39
|
+
handler: (argv) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
40
40
|
if (argv.lint) {
|
|
41
41
|
yield (0, lint_1.lint)(argv);
|
|
42
42
|
}
|
|
@@ -7,7 +7,7 @@ const fs = require("fs");
|
|
|
7
7
|
const glob = require("glob");
|
|
8
8
|
const path = require("path");
|
|
9
9
|
function lint(options) {
|
|
10
|
-
return
|
|
10
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
11
11
|
console.log(`Linting schemas at ${options.inputDir}.`);
|
|
12
12
|
// Configure Spectral
|
|
13
13
|
const spectral = new spectral_1.Spectral({});
|
|
@@ -38,7 +38,7 @@ exports.msgDiff = {
|
|
|
38
38
|
type: 'boolean',
|
|
39
39
|
default: false,
|
|
40
40
|
}),
|
|
41
|
-
handler: (argv) =>
|
|
41
|
+
handler: (argv) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
42
42
|
const diff = new msg_diff_1.MessageDiff(argv);
|
|
43
43
|
yield diff.run();
|
|
44
44
|
console.log('done.');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AsyncAPIDocument, Channel } from '@asyncapi/parser';
|
|
2
|
-
import { MessageDiffOptions
|
|
2
|
+
import { MessageDiffOptions } from './message-diff-options';
|
|
3
3
|
/**
|
|
4
4
|
* Diff results. Each file (asyncapi document or payload) is classified to one of 'skipped', 'same', 'changed' or 'breaking'.
|
|
5
5
|
*/
|
|
@@ -60,7 +60,7 @@ class MessageDiff {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
run() {
|
|
63
|
-
return
|
|
63
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
64
64
|
// checkout branch to temp dir
|
|
65
65
|
const gitTmp = new git_checkout_tmp_1.GitCheckoutTmp();
|
|
66
66
|
gitTmp.checkout(this.schemaRoot, this.branch);
|
|
@@ -103,7 +103,7 @@ class MessageDiff {
|
|
|
103
103
|
* @param dir2 - Root dir for comparision.
|
|
104
104
|
*/
|
|
105
105
|
walk(dir1, dir2) {
|
|
106
|
-
return
|
|
106
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
107
107
|
const items = yield fs.promises.readdir(dir1);
|
|
108
108
|
const fullPathItems = items.map((i) => path.join(dir1, i));
|
|
109
109
|
const dirs = fullPathItems.filter((i) => fs.statSync(i).isDirectory());
|
|
@@ -127,7 +127,7 @@ class MessageDiff {
|
|
|
127
127
|
* Full comparison of asyncapi documents. Each channel payload is also compared.
|
|
128
128
|
*/
|
|
129
129
|
asyncApiDiff(file1, file2) {
|
|
130
|
-
return
|
|
130
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
131
131
|
console.log(`Comparing asyncapi document '${file2}'. Changes from branch '${this.branch}':`);
|
|
132
132
|
let document1;
|
|
133
133
|
let document2;
|
|
@@ -175,7 +175,7 @@ class MessageDiff {
|
|
|
175
175
|
* Note: non standard rules are defined in file: asyncapi-override.ts
|
|
176
176
|
*/
|
|
177
177
|
documentDiff(document1, document2) {
|
|
178
|
-
return
|
|
178
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
179
179
|
// generate diff
|
|
180
180
|
// overrides are applied through options here:
|
|
181
181
|
const output = (0, diff_1.diff)(document1.json(), document2.json(), { override: asyncapi_override_1.override });
|
|
@@ -217,7 +217,7 @@ class MessageDiff {
|
|
|
217
217
|
* If any other version is used (in local file or git) then the comparison result will be 'skipped'.
|
|
218
218
|
*/
|
|
219
219
|
payloadDiff(channel1, channel2) {
|
|
220
|
-
return
|
|
220
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
221
221
|
const getChannelPayload = (channel) => {
|
|
222
222
|
var _a, _b, _c;
|
|
223
223
|
const json = channel.json();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
tslib_1.__exportStar(require("./base-smart-tags"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./pg-column"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./pg-fk-column"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./pg-table"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./pg-type"), exports);
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/publish-schema-to-db/abstractions/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/publish-schema-to-db/abstractions/index.ts"],"names":[],"mappings":";;;AAAA,4DAAkC;AAClC,sDAA4B;AAC5B,yDAA+B;AAC/B,qDAA2B;AAC3B,oDAA0B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Supported Postgres data types. */
|
|
2
|
-
export
|
|
2
|
+
export type PgType = 'TEXT' | 'TEXT[]' | 'INTEGER' | 'INTEGER[]' | 'BOOLEAN' | 'TIMESTAMPTZ';
|
|
@@ -12,7 +12,7 @@ const postprocessors_1 = require("./postprocessors");
|
|
|
12
12
|
* Generates a database schema from an asset publish format JSON schema.
|
|
13
13
|
*/
|
|
14
14
|
function generate(options) {
|
|
15
|
-
return
|
|
15
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
16
16
|
console.log(`Searching for schemas matching pattern ${options.inputGlob}`);
|
|
17
17
|
// 1. Read all publish events.
|
|
18
18
|
const contentTypeSchemas = yield (0, json_schema_parse_utils_1.getContentMetadataSchemas)(options.inputGlob);
|
|
@@ -38,7 +38,7 @@ exports.publishSchemaToDb = {
|
|
|
38
38
|
type: 'string',
|
|
39
39
|
demandOption: true,
|
|
40
40
|
}),
|
|
41
|
-
handler: (argv) =>
|
|
41
|
+
handler: (argv) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
42
42
|
yield (0, generate_1.generate)(argv);
|
|
43
43
|
}),
|
|
44
44
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
tslib_1.__exportStar(require("./fk-column"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./pk-column"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./primitive-column"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./virtual-fk-column"), exports);
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/commands/publish-schema-to-db/pg-models/columns/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/commands/publish-schema-to-db/pg-models/columns/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B;AAC5B,sDAA4B;AAC5B,6DAAmC;AACnC,8DAAoC"}
|
|
@@ -91,7 +91,7 @@ function mapString(schema, isArray) {
|
|
|
91
91
|
* @param schema - Publish message schema.
|
|
92
92
|
*/
|
|
93
93
|
function getContentMetadataSchemas(schemaGlob) {
|
|
94
|
-
return
|
|
94
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
95
95
|
const files = glob_1.glob.sync(schemaGlob);
|
|
96
96
|
const schemas = [];
|
|
97
97
|
for (const file of files) {
|
|
@@ -86,7 +86,7 @@ exports.formatSql = formatSql;
|
|
|
86
86
|
* @param outPath - Path where the dump is created.
|
|
87
87
|
*/
|
|
88
88
|
function generateMigration(statements, outPath) {
|
|
89
|
-
return
|
|
89
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
90
90
|
const dirPath = path.dirname(outPath);
|
|
91
91
|
if (!fs.existsSync(dirPath)) {
|
|
92
92
|
fs.mkdirSync(dirPath, { recursive: 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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
tslib_1.__exportStar(require("./content-entity-table"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./object-property-table"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./relations-table"), exports);
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/commands/publish-schema-to-db/pg-models/tables/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/commands/publish-schema-to-db/pg-models/tables/index.ts"],"names":[],"mappings":";;;AAAA,iEAAuC;AACvC,kEAAwC;AACxC,4DAAkC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
tslib_1.__exportStar(require("./collection-postprocessor"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./content-entity-model-postprocessor"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./episode-postprocessor"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./movie-postprocessor"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./season-postprocessor"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./tvshow-postprocessor"), exports);
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/publish-schema-to-db/postprocessors/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/publish-schema-to-db/postprocessors/index.ts"],"names":[],"mappings":";;;AAAA,qEAA2C;AAC3C,+EAAqD;AACrD,kEAAwC;AACxC,gEAAsC;AACtC,iEAAuC;AACvC,iEAAuC"}
|
package/dist/common/index.js
CHANGED
package/dist/common/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":";;;AAAA,kDAAwB"}
|
package/dist/exports.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
tslib_1.__exportStar(require("./commands/get-access-token/get-access-token-options"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./commands/get-access-token/get-dev-access-token"), exports);
|
|
6
6
|
//# sourceMappingURL=exports.js.map
|
package/dist/exports.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":";;;AAAA,+FAAqE;AACrE,2FAAiE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axinom/mosaic-cli",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.1",
|
|
4
4
|
"description": "The Axinom Mosaic CLI",
|
|
5
5
|
"author": "Axinom",
|
|
6
6
|
"license": "PROPRIETARY",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"build": "yarn clean && tsc --project tsconfig.build.json",
|
|
24
24
|
"build:ci": "yarn workspaces focus && yarn build",
|
|
25
25
|
"dev": "tsc --watch",
|
|
26
|
-
"test": "jest",
|
|
26
|
+
"test": "jest --silent",
|
|
27
27
|
"test:ci": "jest --reporters=default --reporters=jest-junit --coverage --coverageReporters=cobertura --coverageReporters=html",
|
|
28
28
|
"test:cov": "jest --coverage --silent && yarn posttest:cov",
|
|
29
29
|
"posttest:cov": "ts-node ../../scripts/open-test-coverage.ts -- libs/cli",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"@asyncapi/diff": "^0.4.0",
|
|
34
34
|
"@asyncapi/modelina": "^0.43.0",
|
|
35
35
|
"@asyncapi/parser": "^1.15.0",
|
|
36
|
-
"@axinom/mosaic-id-link-be": "^0.12.
|
|
37
|
-
"@axinom/mosaic-service-common": "^0.30.
|
|
36
|
+
"@axinom/mosaic-id-link-be": "^0.12.2",
|
|
37
|
+
"@axinom/mosaic-service-common": "^0.30.1",
|
|
38
38
|
"@graphql-inspector/core": "^3.1.2",
|
|
39
39
|
"@stoplight/spectral": "^5.9.1",
|
|
40
40
|
"chalk": "^4.1.0",
|
|
@@ -56,14 +56,14 @@
|
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/diff": "^5.0.0",
|
|
58
58
|
"@types/yargs": "^16",
|
|
59
|
-
"jest": "
|
|
59
|
+
"jest": "^29",
|
|
60
60
|
"rimraf": "^3.0.2",
|
|
61
|
-
"ts-node": "^9.1
|
|
62
|
-
"typescript": "^4.5
|
|
61
|
+
"ts-node": "^10.9.1",
|
|
62
|
+
"typescript": "^4.9.5",
|
|
63
63
|
"yargs": "^16.2.0"
|
|
64
64
|
},
|
|
65
65
|
"publishConfig": {
|
|
66
66
|
"access": "public"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "539529319d7b39e57fb9832bfd23c07b023a50d0"
|
|
69
69
|
}
|
|
@@ -39,7 +39,7 @@ class MockVault implements Vault {
|
|
|
39
39
|
|
|
40
40
|
// .env file helpers
|
|
41
41
|
const loadEnv = (name: string): Record<string, string> =>
|
|
42
|
-
envfile.parse(readFileSync(name
|
|
42
|
+
envfile.parse(readFileSync(name).toString());
|
|
43
43
|
const saveEnv = (
|
|
44
44
|
name: string,
|
|
45
45
|
vars: Record<string, string>,
|
|
@@ -115,7 +115,9 @@ describe('applyTemplates', () => {
|
|
|
115
115
|
'# new template comment\n' + // ignored
|
|
116
116
|
'VAR7=\n' +
|
|
117
117
|
'VAR9=new-template-value';
|
|
118
|
+
const prefix = '#@TEMPLATE = 1.env.template\n';
|
|
118
119
|
const target =
|
|
120
|
+
prefix +
|
|
119
121
|
'VAR1=1\n' +
|
|
120
122
|
'VAR2=Old value\n' +
|
|
121
123
|
'#VAR3=3\n' +
|
|
@@ -125,9 +127,8 @@ describe('applyTemplates', () => {
|
|
|
125
127
|
'VAR8=My new value\n' +
|
|
126
128
|
'#VAR9=old-template-value\n' +
|
|
127
129
|
'VAR9=custom-value\n';
|
|
128
|
-
const prefix = '#@TEMPLATE = 1.env.template\n';
|
|
129
130
|
writeFileSync('1.env.template', template);
|
|
130
|
-
writeFileSync('1.env', target
|
|
131
|
+
writeFileSync('1.env', target);
|
|
131
132
|
|
|
132
133
|
// Act
|
|
133
134
|
const transform = new EnvConfigTransform('1.env.template', '1.env');
|
|
@@ -158,10 +159,10 @@ describe('applyTemplates', () => {
|
|
|
158
159
|
it('target with differences and commentObsolete option -> different, non-template variables commented', () => {
|
|
159
160
|
// Arrange
|
|
160
161
|
const template = 'VAR1=1\n';
|
|
161
|
-
const target = 'VAR1=1\n' + 'VAR8=My new value\n';
|
|
162
162
|
const prefix = '#@TEMPLATE = 1.env.template\n';
|
|
163
|
+
const target = prefix + 'VAR1=1\n' + 'VAR8=My new value\n';
|
|
163
164
|
writeFileSync('1.env.template', template);
|
|
164
|
-
writeFileSync('1.env', target
|
|
165
|
+
writeFileSync('1.env', target);
|
|
165
166
|
|
|
166
167
|
// Act
|
|
167
168
|
const transform = new EnvConfigTransform('1.env.template', '1.env');
|
|
@@ -117,7 +117,7 @@ describe('sanity', () => {
|
|
|
117
117
|
const result = await msgDiff.documentDiff(document1, document2);
|
|
118
118
|
|
|
119
119
|
// Assert
|
|
120
|
-
expect(result).
|
|
120
|
+
expect(result).toBe('breaking');
|
|
121
121
|
});
|
|
122
122
|
|
|
123
123
|
it('remove event -> breaking', async () => {
|
|
@@ -135,7 +135,7 @@ describe('sanity', () => {
|
|
|
135
135
|
const result = await msgDiff.documentDiff(document1, document2);
|
|
136
136
|
|
|
137
137
|
// Assert
|
|
138
|
-
expect(result).
|
|
138
|
+
expect(result).toBe('breaking');
|
|
139
139
|
});
|
|
140
140
|
|
|
141
141
|
it('rename channel -> breaking', async () => {
|
|
@@ -154,7 +154,7 @@ describe('sanity', () => {
|
|
|
154
154
|
const result = await msgDiff.documentDiff(document1, document2);
|
|
155
155
|
|
|
156
156
|
// Assert
|
|
157
|
-
expect(result).
|
|
157
|
+
expect(result).toBe('breaking');
|
|
158
158
|
});
|
|
159
159
|
|
|
160
160
|
it('rename queue -> breaking', async () => {
|
|
@@ -173,7 +173,7 @@ describe('sanity', () => {
|
|
|
173
173
|
const result = await msgDiff.documentDiff(document1, document2);
|
|
174
174
|
|
|
175
175
|
// Assert
|
|
176
|
-
expect(result).
|
|
176
|
+
expect(result).toBe('breaking');
|
|
177
177
|
});
|
|
178
178
|
|
|
179
179
|
it('add channel -> changed', async () => {
|
|
@@ -191,7 +191,7 @@ describe('sanity', () => {
|
|
|
191
191
|
const result = await msgDiff.documentDiff(document1, document2);
|
|
192
192
|
|
|
193
193
|
// Assert
|
|
194
|
-
expect(result).
|
|
194
|
+
expect(result).toBe('changed');
|
|
195
195
|
});
|
|
196
196
|
|
|
197
197
|
it('change info -> changed', async () => {
|
|
@@ -210,7 +210,7 @@ describe('sanity', () => {
|
|
|
210
210
|
const result = await msgDiff.documentDiff(document1, document2);
|
|
211
211
|
|
|
212
212
|
// Assert
|
|
213
|
-
expect(result).
|
|
213
|
+
expect(result).toBe('changed');
|
|
214
214
|
});
|
|
215
215
|
|
|
216
216
|
it('change x-service-id -> breaking', async () => {
|
|
@@ -228,7 +228,7 @@ describe('sanity', () => {
|
|
|
228
228
|
const result = await msgDiff.documentDiff(document1, document2);
|
|
229
229
|
|
|
230
230
|
// Assert
|
|
231
|
-
expect(result).
|
|
231
|
+
expect(result).toBe('breaking');
|
|
232
232
|
});
|
|
233
233
|
});
|
|
234
234
|
|
|
@@ -251,7 +251,7 @@ describe('sanity', () => {
|
|
|
251
251
|
);
|
|
252
252
|
|
|
253
253
|
// Assert
|
|
254
|
-
expect(result).
|
|
254
|
+
expect(result).toBe('skipped');
|
|
255
255
|
expect(consoleSpy).toHaveBeenCalledWith(
|
|
256
256
|
expect.stringContaining(
|
|
257
257
|
'WARNING: Unsupported JsonSchema version. This payload will be skipped.',
|
|
@@ -277,7 +277,7 @@ describe('sanity', () => {
|
|
|
277
277
|
);
|
|
278
278
|
|
|
279
279
|
// Assert
|
|
280
|
-
expect(result).
|
|
280
|
+
expect(result).toBe('breaking');
|
|
281
281
|
});
|
|
282
282
|
|
|
283
283
|
it('remove required from a field -> changed', async () => {
|
|
@@ -298,7 +298,7 @@ describe('sanity', () => {
|
|
|
298
298
|
);
|
|
299
299
|
|
|
300
300
|
// Assert
|
|
301
|
-
expect(result).
|
|
301
|
+
expect(result).toBe('changed');
|
|
302
302
|
});
|
|
303
303
|
|
|
304
304
|
it('remove a non required field -> breaking', async () => {
|
|
@@ -319,7 +319,7 @@ describe('sanity', () => {
|
|
|
319
319
|
);
|
|
320
320
|
|
|
321
321
|
// Assert
|
|
322
|
-
expect(result).
|
|
322
|
+
expect(result).toBe('breaking');
|
|
323
323
|
});
|
|
324
324
|
|
|
325
325
|
it('add a non required field -> changed', async () => {
|
|
@@ -343,7 +343,7 @@ describe('sanity', () => {
|
|
|
343
343
|
);
|
|
344
344
|
|
|
345
345
|
// Assert
|
|
346
|
-
expect(result).
|
|
346
|
+
expect(result).toBe('changed');
|
|
347
347
|
});
|
|
348
348
|
|
|
349
349
|
it('extending type of a field -> changed', async () => {
|
|
@@ -364,7 +364,7 @@ describe('sanity', () => {
|
|
|
364
364
|
);
|
|
365
365
|
|
|
366
366
|
// Assert
|
|
367
|
-
expect(result).
|
|
367
|
+
expect(result).toBe('changed');
|
|
368
368
|
});
|
|
369
369
|
|
|
370
370
|
it('reducing type of a field -> breaking', async () => {
|
|
@@ -385,7 +385,7 @@ describe('sanity', () => {
|
|
|
385
385
|
);
|
|
386
386
|
|
|
387
387
|
// Assert
|
|
388
|
-
expect(result).
|
|
388
|
+
expect(result).toBe('breaking');
|
|
389
389
|
});
|
|
390
390
|
|
|
391
391
|
it('changing field description -> same', async () => {
|
|
@@ -406,7 +406,7 @@ describe('sanity', () => {
|
|
|
406
406
|
);
|
|
407
407
|
|
|
408
408
|
// Assert
|
|
409
|
-
expect(result).
|
|
409
|
+
expect(result).toBe('same');
|
|
410
410
|
});
|
|
411
411
|
});
|
|
412
412
|
});
|
|
@@ -9,7 +9,7 @@ import * as jsonSchemaDiff from 'json-schema-diff';
|
|
|
9
9
|
import * as path from 'path';
|
|
10
10
|
import { override } from './asyncapi-override';
|
|
11
11
|
import { GitCheckoutTmp } from './git-checkout-tmp';
|
|
12
|
-
import { MessageDiffOptions
|
|
12
|
+
import { MessageDiffOptions } from './message-diff-options';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Diff results. Each file (asyncapi document or payload) is classified to one of 'skipped', 'same', 'changed' or 'breaking'.
|