@contrail/cli 3.6.0-alpha-8-alpha.2ab4f80 → 3.6.0-alpha-8-alpha.351376b
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/README.md +80 -58
- package/dist/api/feature-flags.d.ts +3 -0
- package/dist/api/feature-flags.js +29 -0
- package/dist/api/users.d.ts +1 -0
- package/dist/api/users.js +10 -1
- package/dist/auth/login.js +44 -26
- package/dist/auth/login.spec.js +124 -0
- package/dist/basecommand.js +3 -3
- package/dist/commands/app/getApiKey.js +2 -2
- package/dist/commands/entities/create.d.ts +1 -13
- package/dist/commands/entities/create.js +31 -98
- package/dist/commands/entities/create.spec.js +3 -32
- package/dist/commands/entities/delete.d.ts +2 -6
- package/dist/commands/entities/delete.js +53 -72
- package/dist/commands/entities/get.d.ts +0 -4
- package/dist/commands/entities/get.js +15 -66
- package/dist/commands/entities/update.d.ts +2 -15
- package/dist/commands/entities/update.js +44 -80
- package/dist/commands/feature-flags/export.d.ts +19 -0
- package/dist/commands/feature-flags/export.js +66 -0
- package/dist/commands/feature-flags/export.spec.js +109 -0
- package/dist/commands/feature-flags/import.d.ts +42 -0
- package/dist/commands/feature-flags/import.js +191 -0
- package/dist/commands/feature-flags/import.spec.js +194 -0
- package/dist/commands/instance/export.d.ts +9 -0
- package/dist/commands/instance/export.js +18 -3
- package/dist/commands/instance/export.spec.js +32 -0
- package/dist/commands/instance/import.d.ts +3 -0
- package/dist/commands/instance/import.js +5 -0
- package/dist/commands/instance/import.spec.js +4 -0
- package/dist/common.d.ts +0 -3
- package/dist/common.js +1 -18
- package/dist/helpers/config/config.d.ts +2 -0
- package/dist/helpers/config/config.js +6 -1
- package/dist/helpers/entities/assortment-items.d.ts +2 -4
- package/dist/helpers/entities/assortment-items.js +1 -4
- package/dist/helpers/file-helpers.js +2 -2
- package/dist/helpers/propertySpecifications/propertySpecifications.d.ts +0 -8
- package/dist/helpers/propertySpecifications/propertySpecifications.js +9 -21
- package/dist/helpers/propertySpecifications/propertySpecifications.spec.js +10 -20
- package/dist/logger.js +1 -4
- package/node_modules/@contrail/entity-compare/package.json +3 -6
- package/node_modules/@contrail/loader/lib/common/conditional-columns.js +1 -1
- package/node_modules/@contrail/loader/lib/constants.d.ts +8 -0
- package/node_modules/@contrail/loader/lib/constants.js +9 -1
- package/node_modules/@contrail/loader/lib/entities-v2/linesheet-v2/item-processor.d.ts +4 -0
- package/node_modules/@contrail/loader/lib/entities-v2/linesheet-v2/item-processor.js +57 -0
- package/node_modules/@contrail/loader/lib/entities-v2/linesheet-v2/item-processor.spec.js +492 -34
- package/node_modules/@contrail/loader/lib/pipeline/validate.js +2 -52
- package/node_modules/@contrail/loader/lib/pipeline/validate.spec.js +0 -85
- package/node_modules/@contrail/loader/package.json +2 -2
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/image-search/image-search.d.ts +34 -0
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/image-search/image-search.js +42 -0
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/image-search/index.d.ts +1 -0
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/image-search/index.js +17 -0
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/index.d.ts +1 -0
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/index.js +1 -0
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/package.json +1 -1
- package/oclif.manifest.json +137 -99
- package/package.json +4 -1
- package/dist/commands/entities/grammar.spec.js +0 -80
- package/dist/commands/entities/output.spec.js +0 -72
- package/dist/logger.spec.js +0 -12
- /package/dist/commands/{entities/grammar.spec.d.ts → feature-flags/export.spec.d.ts} +0 -0
- /package/dist/commands/{entities/output.spec.d.ts → feature-flags/import.spec.d.ts} +0 -0
- /package/dist/{logger.spec.d.ts → commands/instance/export.spec.d.ts} +0 -0
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const create_1 = tslib_1.__importDefault(require("./create"));
|
|
5
|
-
const get_1 = tslib_1.__importDefault(require("./get"));
|
|
6
|
-
const update_1 = tslib_1.__importDefault(require("./update"));
|
|
7
|
-
const delete_1 = tslib_1.__importDefault(require("./delete"));
|
|
8
|
-
const propertySpecifications_1 = require("../../helpers/propertySpecifications/propertySpecifications");
|
|
9
|
-
describe('entities command grammar: entities <verb> <typePath> [ID...]', () => {
|
|
10
|
-
describe('partitionIdsAndSpecs', () => {
|
|
11
|
-
it('should treat tokens without an equals sign as ids', () => {
|
|
12
|
-
const { ids, specs } = (0, propertySpecifications_1.partitionIdsAndSpecs)(['id1', 'id2', 'id3']);
|
|
13
|
-
expect(ids).toEqual(['id1', 'id2', 'id3']);
|
|
14
|
-
expect(specs).toEqual([]);
|
|
15
|
-
});
|
|
16
|
-
it('should treat slug=value tokens as property specifications', () => {
|
|
17
|
-
const { ids, specs } = (0, propertySpecifications_1.partitionIdsAndSpecs)(['name=jet', 'hex=000000']);
|
|
18
|
-
expect(ids).toEqual([]);
|
|
19
|
-
expect(specs).toEqual(['name=jet', 'hex=000000']);
|
|
20
|
-
});
|
|
21
|
-
it('should split mixed tokens preserving order within each group', () => {
|
|
22
|
-
const { ids, specs } = (0, propertySpecifications_1.partitionIdsAndSpecs)(['id1', 'name=jet', 'id2', 'status=archived']);
|
|
23
|
-
expect(ids).toEqual(['id1', 'id2']);
|
|
24
|
-
expect(specs).toEqual(['name=jet', 'status=archived']);
|
|
25
|
-
});
|
|
26
|
-
it('should not classify malformed specs as ids', () => {
|
|
27
|
-
const { ids, specs } = (0, propertySpecifications_1.partitionIdsAndSpecs)(['=value']);
|
|
28
|
-
expect(ids).toEqual([]);
|
|
29
|
-
expect(specs).toEqual([]);
|
|
30
|
-
});
|
|
31
|
-
it('should handle empty input', () => {
|
|
32
|
-
const { ids, specs } = (0, propertySpecifications_1.partitionIdsAndSpecs)([]);
|
|
33
|
-
expect(ids).toEqual([]);
|
|
34
|
-
expect(specs).toEqual([]);
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
describe('positional id arguments', () => {
|
|
38
|
-
it('should accept variadic positional ids on get', () => {
|
|
39
|
-
expect(get_1.default.strict).toBe(false);
|
|
40
|
-
expect(get_1.default.args.ids).toBeDefined();
|
|
41
|
-
});
|
|
42
|
-
it('should accept variadic positional ids on update with no single id arg', () => {
|
|
43
|
-
expect(update_1.default.strict).toBe(false);
|
|
44
|
-
expect(update_1.default.args.ids).toBeDefined();
|
|
45
|
-
expect(update_1.default.args.id).toBeUndefined();
|
|
46
|
-
});
|
|
47
|
-
it('should accept variadic positional ids on delete with no --id flag', () => {
|
|
48
|
-
expect(delete_1.default.strict).toBe(false);
|
|
49
|
-
expect(delete_1.default.args.ids).toBeDefined();
|
|
50
|
-
expect(delete_1.default.flags.id).toBeUndefined();
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
describe('flag alignment across verbs', () => {
|
|
54
|
-
it('should name the input file -i, --inputFile on every verb that accepts one', () => {
|
|
55
|
-
expect(create_1.default.flags.inputFile.char).toBe('i');
|
|
56
|
-
expect(update_1.default.flags.inputFile.char).toBe('i');
|
|
57
|
-
expect(delete_1.default.flags.inputFile.char).toBe('i');
|
|
58
|
-
expect(delete_1.default.flags.input).toBeUndefined();
|
|
59
|
-
});
|
|
60
|
-
it('should map skipHydrateRelationships to -S on every verb', () => {
|
|
61
|
-
expect(create_1.default.flags.skipHydrateRelationships.char).toBe('S');
|
|
62
|
-
expect(get_1.default.flags.skipHydrateRelationships.char).toBe('S');
|
|
63
|
-
expect(update_1.default.flags.skipHydrateRelationships.char).toBe('S');
|
|
64
|
-
});
|
|
65
|
-
it('should keep -s for --skip on get', () => {
|
|
66
|
-
expect(get_1.default.flags.skip.char).toBe('s');
|
|
67
|
-
});
|
|
68
|
-
it('should expose --suffix on every verb to reach entity sub-routes', () => {
|
|
69
|
-
expect(create_1.default.flags.suffix).toBeDefined();
|
|
70
|
-
expect(get_1.default.flags.suffix).toBeDefined();
|
|
71
|
-
expect(update_1.default.flags.suffix).toBeDefined();
|
|
72
|
-
expect(delete_1.default.flags.suffix).toBeDefined();
|
|
73
|
-
});
|
|
74
|
-
it('should expose --apiVersion on every verb, constrained to 1 or 2', () => {
|
|
75
|
-
for (const command of [create_1.default, get_1.default, update_1.default, delete_1.default]) {
|
|
76
|
-
expect(command.flags.apiVersion.options).toEqual(['1', '2']);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
});
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const create_1 = require("./create");
|
|
4
|
-
const update_1 = require("./update");
|
|
5
|
-
const fulfilled = (value) => ({ status: 'fulfilled', value });
|
|
6
|
-
const rejected = (message) => ({
|
|
7
|
-
status: 'rejected',
|
|
8
|
-
reason: new Error(message),
|
|
9
|
-
});
|
|
10
|
-
describe('mutation output summaries', () => {
|
|
11
|
-
describe('summarizeSettledCreates', () => {
|
|
12
|
-
it('should put every fulfilled result under created', () => {
|
|
13
|
-
const inputs = [{ name: 'a' }, { name: 'b' }];
|
|
14
|
-
const summary = (0, create_1.summarizeSettledCreates)(inputs, [
|
|
15
|
-
fulfilled({ id: '1', name: 'a' }),
|
|
16
|
-
fulfilled({ id: '2', name: 'b' }),
|
|
17
|
-
]);
|
|
18
|
-
expect(summary.created).toEqual([
|
|
19
|
-
{ id: '1', name: 'a' },
|
|
20
|
-
{ id: '2', name: 'b' },
|
|
21
|
-
]);
|
|
22
|
-
expect(summary.failed).toEqual([]);
|
|
23
|
-
});
|
|
24
|
-
it('should pair each failed input with its error so it can be retried as-is', () => {
|
|
25
|
-
const inputs = [{ itemId: 'itm-1' }, { itemId: 'itm-41x' }, { itemId: 'itm-3' }];
|
|
26
|
-
const summary = (0, create_1.summarizeSettledCreates)(inputs, [
|
|
27
|
-
fulfilled({ id: 'ai-1' }),
|
|
28
|
-
rejected('Item with ID itm-41x does not exist'),
|
|
29
|
-
fulfilled({ id: 'ai-3' }),
|
|
30
|
-
]);
|
|
31
|
-
expect(summary.created).toEqual([{ id: 'ai-1' }, { id: 'ai-3' }]);
|
|
32
|
-
expect(summary.failed).toEqual([
|
|
33
|
-
{ input: { itemId: 'itm-41x' }, error: 'Item with ID itm-41x does not exist' },
|
|
34
|
-
]);
|
|
35
|
-
});
|
|
36
|
-
it('should fall back to details when the SDK error message is empty', () => {
|
|
37
|
-
const sdkError = Object.assign(new Error(''), {
|
|
38
|
-
details: '{"message":"Assortment not found.","statusCode":404}',
|
|
39
|
-
});
|
|
40
|
-
const summary = (0, create_1.summarizeSettledCreates)([{ assortmentId: 'bogus' }], [{ status: 'rejected', reason: sdkError }]);
|
|
41
|
-
expect(summary.failed[0].error).toBe('{"message":"Assortment not found.","statusCode":404}');
|
|
42
|
-
});
|
|
43
|
-
it('should stringify reasons that are not Errors', () => {
|
|
44
|
-
const summary = (0, create_1.summarizeSettledCreates)([{ name: 'a' }], [{ status: 'rejected', reason: 'boom' }]);
|
|
45
|
-
expect(summary.failed).toEqual([{ input: { name: 'a' }, error: 'boom' }]);
|
|
46
|
-
});
|
|
47
|
-
it('should handle empty input', () => {
|
|
48
|
-
expect((0, create_1.summarizeSettledCreates)([], [])).toEqual({ created: [], failed: [] });
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
describe('summarizeSettledUpdates', () => {
|
|
52
|
-
it('should report updated, failed, and skipped without stopping on failures', () => {
|
|
53
|
-
const inputs = [{ id: 'id1' }, { id: 'id2' }, { id: 'id3' }];
|
|
54
|
-
const summary = (0, update_1.summarizeSettledUpdates)(inputs, [
|
|
55
|
-
fulfilled({ id: 'id1', status: 'archived' }),
|
|
56
|
-
rejected('Entity not found.'),
|
|
57
|
-
fulfilled({ id: 'id3', status: 'archived' }),
|
|
58
|
-
], 2);
|
|
59
|
-
expect(summary.updated).toEqual([
|
|
60
|
-
{ id: 'id1', status: 'archived' },
|
|
61
|
-
{ id: 'id3', status: 'archived' },
|
|
62
|
-
]);
|
|
63
|
-
expect(summary.failed).toEqual([{ id: 'id2', error: 'Entity not found.' }]);
|
|
64
|
-
expect(summary.skipped).toBe(2);
|
|
65
|
-
});
|
|
66
|
-
it('should not report a failed id as updated', () => {
|
|
67
|
-
const summary = (0, update_1.summarizeSettledUpdates)([{ id: 'id1' }], [rejected('boom')], 0);
|
|
68
|
-
expect(summary.updated).toEqual([]);
|
|
69
|
-
expect(summary.failed).toEqual([{ id: 'id1', error: 'boom' }]);
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
});
|
package/dist/logger.spec.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const logger_1 = tslib_1.__importDefault(require("./logger"));
|
|
5
|
-
describe('logger', () => {
|
|
6
|
-
it('should write every log level to stderr so stdout carries only command output', () => {
|
|
7
|
-
const consoleTransport = logger_1.default.transports[0];
|
|
8
|
-
for (const level of ['error', 'warn', 'info', 'debug']) {
|
|
9
|
-
expect(consoleTransport.stderrLevels[level]).toBe(true);
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|