@contrail/cli 3.6.0-alpha-8-alpha.e4ae6bd → 3.6.0-alpha-8-alpha.8cae9b1
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 +9 -9
- package/dist/commands/entities/create.js +1 -2
- package/dist/commands/entities/create.spec.js +2 -2
- package/dist/commands/entities/delete.js +2 -3
- package/dist/commands/entities/get.js +1 -2
- package/dist/commands/entities/grammar.spec.js +6 -6
- package/dist/commands/entities/update.js +1 -2
- package/dist/helpers/propertySpecifications/propertySpecifications.d.ts +1 -2
- package/dist/helpers/propertySpecifications/propertySpecifications.js +1 -4
- package/dist/logger.spec.js +1 -1
- package/oclif.manifest.json +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ $ npm install -g @contrail/cli
|
|
|
17
17
|
$ contrail COMMAND
|
|
18
18
|
running command...
|
|
19
19
|
$ contrail (--version)
|
|
20
|
-
@contrail/cli/3.6.0-alpha-8-alpha.
|
|
20
|
+
@contrail/cli/3.6.0-alpha-8-alpha.8cae9b1 linux-x64 node-v24.21.0
|
|
21
21
|
$ contrail --help [COMMAND]
|
|
22
22
|
USAGE
|
|
23
23
|
$ contrail COMMAND
|
|
@@ -543,7 +543,7 @@ EXAMPLES
|
|
|
543
543
|
|
|
544
544
|
## `contrail entities create PATH`
|
|
545
545
|
|
|
546
|
-
|
|
546
|
+
Create entities
|
|
547
547
|
|
|
548
548
|
```
|
|
549
549
|
USAGE
|
|
@@ -570,7 +570,7 @@ FLAGS
|
|
|
570
570
|
-r, --readableIds If true, uses readable IDs for the created entities
|
|
571
571
|
|
|
572
572
|
DESCRIPTION
|
|
573
|
-
|
|
573
|
+
Create entities
|
|
574
574
|
|
|
575
575
|
EXAMPLES
|
|
576
576
|
$ contrail entities create color -g -n=10 # creates 10 random colors
|
|
@@ -594,7 +594,7 @@ EXAMPLES
|
|
|
594
594
|
|
|
595
595
|
## `contrail entities delete ENTITYNAME [IDS]`
|
|
596
596
|
|
|
597
|
-
|
|
597
|
+
Delete entities by id
|
|
598
598
|
|
|
599
599
|
```
|
|
600
600
|
USAGE
|
|
@@ -614,7 +614,7 @@ FLAGS
|
|
|
614
614
|
<options: error|warn|info|debug>
|
|
615
615
|
|
|
616
616
|
DESCRIPTION
|
|
617
|
-
|
|
617
|
+
Delete entities by id
|
|
618
618
|
|
|
619
619
|
EXAMPLES
|
|
620
620
|
$ contrail entities delete color 123
|
|
@@ -626,7 +626,7 @@ EXAMPLES
|
|
|
626
626
|
|
|
627
627
|
## `contrail entities get TYPEPATH [IDS]`
|
|
628
628
|
|
|
629
|
-
|
|
629
|
+
Get an entity
|
|
630
630
|
|
|
631
631
|
```
|
|
632
632
|
USAGE
|
|
@@ -651,7 +651,7 @@ FLAGS
|
|
|
651
651
|
-t, --take=<value> Number of entities to fetch in a single request (default is 100)
|
|
652
652
|
|
|
653
653
|
DESCRIPTION
|
|
654
|
-
|
|
654
|
+
Get an entity
|
|
655
655
|
|
|
656
656
|
EXAMPLES
|
|
657
657
|
$ contrail entities get color 123
|
|
@@ -669,7 +669,7 @@ EXAMPLES
|
|
|
669
669
|
|
|
670
670
|
## `contrail entities update ENTITYNAME [IDS]`
|
|
671
671
|
|
|
672
|
-
|
|
672
|
+
Update an entity
|
|
673
673
|
|
|
674
674
|
```
|
|
675
675
|
USAGE
|
|
@@ -690,7 +690,7 @@ FLAGS
|
|
|
690
690
|
<options: error|warn|info|debug>
|
|
691
691
|
|
|
692
692
|
DESCRIPTION
|
|
693
|
-
|
|
693
|
+
Update an entity
|
|
694
694
|
|
|
695
695
|
EXAMPLES
|
|
696
696
|
$ contrail entities update color 123 -- name=obsidian hex=000000
|
|
@@ -145,7 +145,7 @@ const FIND_VALID_VALUE_MAP = {
|
|
|
145
145
|
],
|
|
146
146
|
};
|
|
147
147
|
class CreateEntity extends basecommand_1.BaseCommand {
|
|
148
|
-
static description = '
|
|
148
|
+
static description = 'Create entities';
|
|
149
149
|
static examples = [
|
|
150
150
|
'contrail entities create color -g -n=10 # creates 10 random colors',
|
|
151
151
|
'contrail entities create color -- name="Electric Blue" green=1 red=2 blue=3 # creates one color with specified properties only',
|
|
@@ -211,7 +211,6 @@ class CreateEntity extends basecommand_1.BaseCommand {
|
|
|
211
211
|
static strict = false;
|
|
212
212
|
async run() {
|
|
213
213
|
(0, common_1.routeConsoleLogToStderr)();
|
|
214
|
-
console.error('🚨 This command is in BETA and may change or be removed at any time.');
|
|
215
214
|
await (0, login_1.authUser)();
|
|
216
215
|
const { flags, argv, args } = await this.parse(CreateEntity);
|
|
217
216
|
const { count, dryRun: isDryRun, inputFile: inputFilename, outputFile: outputFilename, generateValues: shouldGenerateMissingValues, readableIds: shouldUseReadableIds, skipHydrateRelationships, } = flags;
|
|
@@ -527,7 +527,7 @@ describe('castValueToPropertyType array coercion', () => {
|
|
|
527
527
|
]);
|
|
528
528
|
});
|
|
529
529
|
it('should keep a comma value literal on a multi-value property and warn with the repeated-key form', () => {
|
|
530
|
-
const consoleError = jest.spyOn(console, 'error').mockImplementation(() =>
|
|
530
|
+
const consoleError = jest.spyOn(console, 'error').mockImplementation(() => undefined);
|
|
531
531
|
expect((0, create_1.castValueToPropertyType)('option,family', types_1.PropertyType.MultiSelect)).toEqual([
|
|
532
532
|
'option,family',
|
|
533
533
|
]);
|
|
@@ -535,7 +535,7 @@ describe('castValueToPropertyType array coercion', () => {
|
|
|
535
535
|
consoleError.mockRestore();
|
|
536
536
|
});
|
|
537
537
|
it('should keep commas literal on string properties without warning', () => {
|
|
538
|
-
const consoleError = jest.spyOn(console, 'error').mockImplementation(() =>
|
|
538
|
+
const consoleError = jest.spyOn(console, 'error').mockImplementation(() => undefined);
|
|
539
539
|
expect((0, create_1.castValueToPropertyType)('my,name', types_1.PropertyType.String)).toBe('my,name');
|
|
540
540
|
expect(consoleError).not.toHaveBeenCalled();
|
|
541
541
|
consoleError.mockRestore();
|
|
@@ -10,7 +10,7 @@ const common_1 = require("../../common");
|
|
|
10
10
|
const file_helpers_1 = require("../../helpers/file-helpers");
|
|
11
11
|
let IS_DRY_RUN = false;
|
|
12
12
|
class DeleteEntity extends basecommand_1.BaseCommand {
|
|
13
|
-
static description = '
|
|
13
|
+
static description = 'Delete entities by id';
|
|
14
14
|
static examples = [
|
|
15
15
|
'contrail entities delete color 123',
|
|
16
16
|
'contrail entities delete color id1 id2 id3',
|
|
@@ -26,7 +26,7 @@ class DeleteEntity extends basecommand_1.BaseCommand {
|
|
|
26
26
|
}),
|
|
27
27
|
inputFile: core_1.Flags.string({
|
|
28
28
|
char: 'i',
|
|
29
|
-
description:
|
|
29
|
+
description: "A file with a JSON array of objects; only each object's id is used. Deletes every entity in the file.",
|
|
30
30
|
required: false,
|
|
31
31
|
multiple: false,
|
|
32
32
|
}),
|
|
@@ -44,7 +44,6 @@ class DeleteEntity extends basecommand_1.BaseCommand {
|
|
|
44
44
|
static strict = false;
|
|
45
45
|
async run() {
|
|
46
46
|
(0, common_1.routeConsoleLogToStderr)();
|
|
47
|
-
console.error('🚨 This command is in BETA and may change or be removed at any time.');
|
|
48
47
|
await (0, login_1.authUser)();
|
|
49
48
|
const { args, flags, argv } = await this.parse(DeleteEntity);
|
|
50
49
|
const { entityName } = args;
|
|
@@ -13,7 +13,7 @@ const batchFetch_1 = require("../../helpers/entities/batchFetch");
|
|
|
13
13
|
let SHOULD_USE_PAGINATED_FIND = false;
|
|
14
14
|
let MAX_NUMBER_OF_ENTITIES_TO_FETCH = undefined;
|
|
15
15
|
class GetEntity extends basecommand_1.BaseCommand {
|
|
16
|
-
static description = '
|
|
16
|
+
static description = 'Get an entity';
|
|
17
17
|
static examples = [
|
|
18
18
|
'contrail entities get color 123',
|
|
19
19
|
'contrail entities get color id1 id2 id3',
|
|
@@ -76,7 +76,6 @@ class GetEntity extends basecommand_1.BaseCommand {
|
|
|
76
76
|
static strict = false;
|
|
77
77
|
async run() {
|
|
78
78
|
(0, common_1.routeConsoleLogToStderr)();
|
|
79
|
-
console.error('🚨 This command is in BETA and may change or be removed at any time.');
|
|
80
79
|
await (0, login_1.authUser)();
|
|
81
80
|
const { args, flags, argv } = await this.parse(GetEntity);
|
|
82
81
|
const { typePath } = args;
|
|
@@ -35,34 +35,34 @@ describe('entities command grammar: entities <verb> <typePath> [ID...]', () => {
|
|
|
35
35
|
});
|
|
36
36
|
});
|
|
37
37
|
describe('positional id arguments', () => {
|
|
38
|
-
it('
|
|
38
|
+
it('should accept variadic positional ids on get', () => {
|
|
39
39
|
expect(get_1.default.strict).toBe(false);
|
|
40
40
|
expect(get_1.default.args.ids).toBeDefined();
|
|
41
41
|
});
|
|
42
|
-
it('
|
|
42
|
+
it('should accept variadic positional ids on update with no single id arg', () => {
|
|
43
43
|
expect(update_1.default.strict).toBe(false);
|
|
44
44
|
expect(update_1.default.args.ids).toBeDefined();
|
|
45
45
|
expect(update_1.default.args.id).toBeUndefined();
|
|
46
46
|
});
|
|
47
|
-
it('
|
|
47
|
+
it('should accept variadic positional ids on delete with no --id flag', () => {
|
|
48
48
|
expect(delete_1.default.strict).toBe(false);
|
|
49
49
|
expect(delete_1.default.args.ids).toBeDefined();
|
|
50
50
|
expect(delete_1.default.flags.id).toBeUndefined();
|
|
51
51
|
});
|
|
52
52
|
});
|
|
53
53
|
describe('flag alignment across verbs', () => {
|
|
54
|
-
it('the input file
|
|
54
|
+
it('should name the input file -i, --inputFile on every verb that accepts one', () => {
|
|
55
55
|
expect(create_1.default.flags.inputFile.char).toBe('i');
|
|
56
56
|
expect(update_1.default.flags.inputFile.char).toBe('i');
|
|
57
57
|
expect(delete_1.default.flags.inputFile.char).toBe('i');
|
|
58
58
|
expect(delete_1.default.flags.input).toBeUndefined();
|
|
59
59
|
});
|
|
60
|
-
it('skipHydrateRelationships
|
|
60
|
+
it('should map skipHydrateRelationships to -S on every verb', () => {
|
|
61
61
|
expect(create_1.default.flags.skipHydrateRelationships.char).toBe('S');
|
|
62
62
|
expect(get_1.default.flags.skipHydrateRelationships.char).toBe('S');
|
|
63
63
|
expect(update_1.default.flags.skipHydrateRelationships.char).toBe('S');
|
|
64
64
|
});
|
|
65
|
-
it('
|
|
65
|
+
it('should keep -s for --skip on get', () => {
|
|
66
66
|
expect(get_1.default.flags.skip.char).toBe('s');
|
|
67
67
|
});
|
|
68
68
|
});
|
|
@@ -11,7 +11,7 @@ const common_1 = require("../../common");
|
|
|
11
11
|
const propertySpecifications_1 = require("../../helpers/propertySpecifications/propertySpecifications");
|
|
12
12
|
const file_helpers_1 = require("../../helpers/file-helpers");
|
|
13
13
|
class UpdateEntity extends basecommand_1.BaseCommand {
|
|
14
|
-
static description = '
|
|
14
|
+
static description = 'Update an entity';
|
|
15
15
|
static examples = [
|
|
16
16
|
'contrail entities update color 123 -- name=obsidian hex=000000',
|
|
17
17
|
'contrail entities update item id1 id2 id3 -- status=archived # apply the same change to several entities',
|
|
@@ -55,7 +55,6 @@ class UpdateEntity extends basecommand_1.BaseCommand {
|
|
|
55
55
|
static strict = false;
|
|
56
56
|
async run() {
|
|
57
57
|
(0, common_1.routeConsoleLogToStderr)();
|
|
58
|
-
console.error('🚨 This command is in BETA and may change or be removed at any time.');
|
|
59
58
|
await (0, login_1.authUser)();
|
|
60
59
|
const { args, argv } = await this.parse(UpdateEntity);
|
|
61
60
|
const { entityName } = args;
|
|
@@ -31,8 +31,7 @@ export declare function parsePropertySpecification(spec: PropertySpecificationSt
|
|
|
31
31
|
export declare function parsePropertySpecificationsIntoMap(propertySpecifications: PropertySpecificationString[]): PropertySpecificationBySlug;
|
|
32
32
|
/**
|
|
33
33
|
* Splits command argv tokens (after the typePath) into positional ids and
|
|
34
|
-
* property specifications.
|
|
35
|
-
* candidate; every other token is an id.
|
|
34
|
+
* property specifications.
|
|
36
35
|
*/
|
|
37
36
|
export declare function partitionIdsAndSpecs(tokens: string[]): {
|
|
38
37
|
ids: string[];
|
|
@@ -71,8 +71,6 @@ function parsePropertySpecificationsIntoMap(propertySpecifications) {
|
|
|
71
71
|
propertySpecBySlug.set(slug, idsArray);
|
|
72
72
|
continue;
|
|
73
73
|
}
|
|
74
|
-
// Repeating a key accumulates values into an array; commas in every other
|
|
75
|
-
// value are literal.
|
|
76
74
|
const existing = propertySpecBySlug.get(slug);
|
|
77
75
|
if (propertySpecBySlug.has(slug) && existing !== undefined && value !== undefined) {
|
|
78
76
|
propertySpecBySlug.set(slug, Array.isArray(existing) ? [...existing, value] : [existing, value]);
|
|
@@ -85,8 +83,7 @@ function parsePropertySpecificationsIntoMap(propertySpecifications) {
|
|
|
85
83
|
exports.parsePropertySpecificationsIntoMap = parsePropertySpecificationsIntoMap;
|
|
86
84
|
/**
|
|
87
85
|
* Splits command argv tokens (after the typePath) into positional ids and
|
|
88
|
-
* property specifications.
|
|
89
|
-
* candidate; every other token is an id.
|
|
86
|
+
* property specifications.
|
|
90
87
|
*/
|
|
91
88
|
function partitionIdsAndSpecs(tokens) {
|
|
92
89
|
return {
|
package/dist/logger.spec.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const logger_1 = tslib_1.__importDefault(require("./logger"));
|
|
5
5
|
describe('logger', () => {
|
|
6
|
-
it('
|
|
6
|
+
it('should write every log level to stderr so stdout carries only command output', () => {
|
|
7
7
|
const consoleTransport = logger_1.default.transports[0];
|
|
8
8
|
for (const level of ['error', 'warn', 'info', 'debug']) {
|
|
9
9
|
expect(consoleTransport.stderrLevels[level]).toBe(true);
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.6.0-alpha-8-alpha.
|
|
2
|
+
"version": "3.6.0-alpha-8-alpha.8cae9b1",
|
|
3
3
|
"commands": {
|
|
4
4
|
"app:create": {
|
|
5
5
|
"id": "app:create",
|
|
@@ -675,7 +675,7 @@
|
|
|
675
675
|
},
|
|
676
676
|
"entities:create": {
|
|
677
677
|
"id": "entities:create",
|
|
678
|
-
"description": "
|
|
678
|
+
"description": "Create entities",
|
|
679
679
|
"strict": false,
|
|
680
680
|
"pluginName": "@contrail/cli",
|
|
681
681
|
"pluginAlias": "@contrail/cli",
|
|
@@ -787,7 +787,7 @@
|
|
|
787
787
|
},
|
|
788
788
|
"entities:delete": {
|
|
789
789
|
"id": "entities:delete",
|
|
790
|
-
"description": "
|
|
790
|
+
"description": "Delete entities by id",
|
|
791
791
|
"strict": false,
|
|
792
792
|
"pluginName": "@contrail/cli",
|
|
793
793
|
"pluginAlias": "@contrail/cli",
|
|
@@ -858,7 +858,7 @@
|
|
|
858
858
|
},
|
|
859
859
|
"entities:get": {
|
|
860
860
|
"id": "entities:get",
|
|
861
|
-
"description": "
|
|
861
|
+
"description": "Get an entity",
|
|
862
862
|
"strict": false,
|
|
863
863
|
"pluginName": "@contrail/cli",
|
|
864
864
|
"pluginAlias": "@contrail/cli",
|
|
@@ -972,7 +972,7 @@
|
|
|
972
972
|
},
|
|
973
973
|
"entities:update": {
|
|
974
974
|
"id": "entities:update",
|
|
975
|
-
"description": "
|
|
975
|
+
"description": "Update an entity",
|
|
976
976
|
"strict": false,
|
|
977
977
|
"pluginName": "@contrail/cli",
|
|
978
978
|
"pluginAlias": "@contrail/cli",
|