@contrail/cli 3.6.0-alpha-8-alpha.2a57edb → 3.6.0-alpha-8-alpha.afa500a
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 +3 -3
- package/dist/commands/entities/create.js +5 -1
- package/dist/commands/entities/create.spec.js +2 -0
- package/dist/commands/entities/update.js +4 -2
- package/dist/helpers/propertySpecifications/propertySpecifications.js +1 -2
- package/dist/helpers/propertySpecifications/propertySpecifications.spec.js +0 -5
- package/oclif.manifest.json +3 -3
- 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.afa500a linux-x64 node-v24.21.0
|
|
21
21
|
$ contrail --help [COMMAND]
|
|
22
22
|
USAGE
|
|
23
23
|
$ contrail COMMAND
|
|
@@ -696,10 +696,10 @@ ARGUMENTS
|
|
|
696
696
|
FLAGS
|
|
697
697
|
-F, --force Force update without validation. Internal use only
|
|
698
698
|
-S, --skipHydrateRelationships Skip hydrating relationships when updating the entity
|
|
699
|
-
-d, --dryRun If true, does not
|
|
699
|
+
-d, --dryRun If true, does not create the entity but simulates the creation
|
|
700
700
|
-e, --alwaysConfirmEnv=<option> [default: true] The Environment variables
|
|
701
701
|
<options: true|false>
|
|
702
|
-
-i, --inputFile=<value>
|
|
702
|
+
-i, --inputFile=<value> File containing properties to update the entity (optional)
|
|
703
703
|
-l, --logLevel=<option> The Log Level
|
|
704
704
|
<options: error|warn|info|debug>
|
|
705
705
|
--apiVersion=<option> Api-Version header to send; selects the V1 or V2 variant of the endpoint
|
|
@@ -290,6 +290,8 @@ class CreateEntity extends basecommand_1.BaseCommand {
|
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
exports.default = CreateEntity;
|
|
293
|
+
// Every row is attempted; a failed row never stops the run. The summary pairs
|
|
294
|
+
// each failed input with its error so the failed rows can be retried as-is.
|
|
293
295
|
function summarizeSettledCreates(inputs, settled) {
|
|
294
296
|
const created = [];
|
|
295
297
|
const failed = [];
|
|
@@ -536,7 +538,9 @@ function castValueToPropertyType(value, propertyType) {
|
|
|
536
538
|
if (Array.isArray(value)) {
|
|
537
539
|
return value;
|
|
538
540
|
}
|
|
539
|
-
// the old comma syntax parses as one
|
|
541
|
+
// Migration hazard: the old comma syntax parses as one string with a
|
|
542
|
+
// comma in it. Warn with the repeated-key equivalent instead of
|
|
543
|
+
// guessing at a split.
|
|
540
544
|
if (typeof value === 'string' && value.includes(',')) {
|
|
541
545
|
console.error(`Value "${value}" for a multi-value property contains a comma and is treated as one literal value. To pass several values, repeat the key: slug=${value
|
|
542
546
|
.split(',')
|
|
@@ -333,6 +333,8 @@ describe('Entity Creation E2E Happy Path', () => {
|
|
|
333
333
|
const propertySpecs = (0, propertySpecifications_1.parsePropertySpecificationsIntoMap)([
|
|
334
334
|
'roles=option',
|
|
335
335
|
]);
|
|
336
|
+
// a single roles value stays scalar at the parse layer and is
|
|
337
|
+
// normalized to an array where it is consumed
|
|
336
338
|
const roles = [].concat(propertySpecs.get('roles'));
|
|
337
339
|
// Test that property level matching works with specified roles
|
|
338
340
|
expect((0, create_1.doesPropertyLevelMatchRole)(types_1.PropertyLevel.OPTION, roles[0])).toBe(true);
|
|
@@ -27,13 +27,13 @@ class UpdateEntity extends basecommand_1.BaseCommand {
|
|
|
27
27
|
}),
|
|
28
28
|
dryRun: core_1.Flags.boolean({
|
|
29
29
|
char: 'd',
|
|
30
|
-
description: 'If true, does not
|
|
30
|
+
description: 'If true, does not create the entity but simulates the creation',
|
|
31
31
|
required: false,
|
|
32
32
|
default: false,
|
|
33
33
|
}),
|
|
34
34
|
inputFile: core_1.Flags.string({
|
|
35
35
|
char: 'i',
|
|
36
|
-
description: '
|
|
36
|
+
description: 'File containing properties to update the entity (optional)',
|
|
37
37
|
required: false,
|
|
38
38
|
}),
|
|
39
39
|
force: core_1.Flags.boolean({
|
|
@@ -123,6 +123,8 @@ class UpdateEntity extends basecommand_1.BaseCommand {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
exports.default = UpdateEntity;
|
|
126
|
+
// Every row is attempted; a failed row never stops the run. The summary pairs
|
|
127
|
+
// each failed id with its error so the failed rows can be retried.
|
|
126
128
|
function summarizeSettledUpdates(inputs, settled, skipped) {
|
|
127
129
|
const updated = [];
|
|
128
130
|
const failed = [];
|
|
@@ -68,8 +68,7 @@ function parsePropertySpecificationsIntoMap(propertySpecifications) {
|
|
|
68
68
|
// ids is the one comma-split exception: it is a list of ids by definition
|
|
69
69
|
// and ids never contain commas.
|
|
70
70
|
const idsArray = value.split(',').map((id) => id.trim());
|
|
71
|
-
|
|
72
|
-
propertySpecBySlug.set(slug, Array.isArray(existingIds) ? [...existingIds, ...idsArray] : idsArray);
|
|
71
|
+
propertySpecBySlug.set(slug, idsArray);
|
|
73
72
|
continue;
|
|
74
73
|
}
|
|
75
74
|
const existing = propertySpecBySlug.get(slug);
|
|
@@ -190,11 +190,6 @@ describe('parsePropertySpecificationsIntoMap', () => {
|
|
|
190
190
|
expect(result.get('ids')).toEqual(['1', '2', '3']);
|
|
191
191
|
expect(result.get('name')).toBe('Test');
|
|
192
192
|
});
|
|
193
|
-
it('should accumulate repeated ids keys', () => {
|
|
194
|
-
const specs = ['ids=1,2', 'ids=3'];
|
|
195
|
-
const result = (0, propertySpecifications_1.parsePropertySpecificationsIntoMap)(specs);
|
|
196
|
-
expect(result.get('ids')).toEqual(['1', '2', '3']);
|
|
197
|
-
});
|
|
198
193
|
it('should handle ids as single value', () => {
|
|
199
194
|
const specs = ['ids=123'];
|
|
200
195
|
const result = (0, propertySpecifications_1.parsePropertySpecificationsIntoMap)(specs);
|
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.afa500a",
|
|
3
3
|
"commands": {
|
|
4
4
|
"app:create": {
|
|
5
5
|
"id": "app:create",
|
|
@@ -1077,7 +1077,7 @@
|
|
|
1077
1077
|
"name": "dryRun",
|
|
1078
1078
|
"type": "boolean",
|
|
1079
1079
|
"char": "d",
|
|
1080
|
-
"description": "If true, does not
|
|
1080
|
+
"description": "If true, does not create the entity but simulates the creation",
|
|
1081
1081
|
"required": false,
|
|
1082
1082
|
"allowNo": false
|
|
1083
1083
|
},
|
|
@@ -1085,7 +1085,7 @@
|
|
|
1085
1085
|
"name": "inputFile",
|
|
1086
1086
|
"type": "option",
|
|
1087
1087
|
"char": "i",
|
|
1088
|
-
"description": "
|
|
1088
|
+
"description": "File containing properties to update the entity (optional)",
|
|
1089
1089
|
"required": false,
|
|
1090
1090
|
"multiple": false
|
|
1091
1091
|
},
|