@contrail/cli 3.6.0-alpha-8-alpha.7d24daa → 3.6.0-alpha-8-alpha.19e980d

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 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.7d24daa linux-x64 node-v24.21.0
20
+ @contrail/cli/3.6.0-alpha-8-alpha.19e980d linux-x64 node-v24.21.0
21
21
  $ contrail --help [COMMAND]
22
22
  USAGE
23
23
  $ contrail COMMAND
@@ -548,7 +548,7 @@ Create entities
548
548
  ```
549
549
  USAGE
550
550
  $ contrail entities create PATH [-l error|warn|info|debug] [-e true|false] [-n <value>] [-d] [-i <value>] [-o
551
- <value>] [-g] [-r] [-S] [--suffix <value>]
551
+ <value>] [-g] [-r] [-S] [--suffix <value>] [--apiVersion 1|2]
552
552
 
553
553
  ARGUMENTS
554
554
  PATH Path of the entity type to create
@@ -568,6 +568,8 @@ FLAGS
568
568
  -n, --count=<value> Number of random entities to create
569
569
  -o, --outputFile=<value> File to save the output (optional)
570
570
  -r, --readableIds If true, uses readable IDs for the created entities
571
+ --apiVersion=<option> Api-Version header to send; selects the V1 or V2 variant of the endpoint
572
+ <options: 1|2>
571
573
  --suffix=<value> Append a sub-route to the entity endpoint (e.g. --suffix=synchronous targets
572
574
  /<entities>/synchronous)
573
575
 
@@ -601,7 +603,7 @@ Delete entities by id
601
603
  ```
602
604
  USAGE
603
605
  $ contrail entities delete ENTITYNAME [IDS] [-l error|warn|info|debug] [-e true|false] [-d] [-i <value>] [--suffix
604
- <value>]
606
+ <value>] [--apiVersion 1|2]
605
607
 
606
608
  ARGUMENTS
607
609
  ENTITYNAME The name of the entity type to delete
@@ -615,6 +617,8 @@ FLAGS
615
617
  entity in the file.
616
618
  -l, --logLevel=<option> The Log Level
617
619
  <options: error|warn|info|debug>
620
+ --apiVersion=<option> Api-Version header to send; selects the V1 or V2 variant of the endpoint
621
+ <options: 1|2>
618
622
  --suffix=<value> Append a sub-route to the entity endpoint (e.g. --suffix=synchronous targets
619
623
  /<entities>/synchronous)
620
624
 
@@ -636,7 +640,7 @@ Get an entity
636
640
  ```
637
641
  USAGE
638
642
  $ contrail entities get TYPEPATH [IDS] [-l error|warn|info|debug] [-e true|false] [-o <value>] [-p <value>] [-P]
639
- [-s <value>] [-S] [-t <value>] [-r <value>] [--suffix <value>]
643
+ [-s <value>] [-S] [-t <value>] [-r <value>] [--suffix <value>] [--apiVersion 1|2]
640
644
 
641
645
  ARGUMENTS
642
646
  TYPEPATH The name of the entity type to fetch
@@ -654,6 +658,8 @@ FLAGS
654
658
  -r, --relations=<value> Comma-separated list of relations to include in the output
655
659
  -s, --skip=<value> Number of entities to skip (used with paginated fetch)
656
660
  -t, --take=<value> Number of entities to fetch in a single request (default is 100)
661
+ --apiVersion=<option> Api-Version header to send; selects the V1 or V2 variant of the endpoint
662
+ <options: 1|2>
657
663
  --suffix=<value> Append a sub-route to the entity endpoint (e.g. --suffix=synchronous targets
658
664
  /<entities>/synchronous)
659
665
 
@@ -681,7 +687,7 @@ Update an entity
681
687
  ```
682
688
  USAGE
683
689
  $ contrail entities update ENTITYNAME [IDS] [-l error|warn|info|debug] [-e true|false] [-S] [-d] [-i <value>] [-F]
684
- [--suffix <value>]
690
+ [--suffix <value>] [--apiVersion 1|2]
685
691
 
686
692
  ARGUMENTS
687
693
  ENTITYNAME The name of the entity type to update
@@ -696,6 +702,8 @@ FLAGS
696
702
  -i, --inputFile=<value> File containing properties to update the entity (optional)
697
703
  -l, --logLevel=<option> The Log Level
698
704
  <options: error|warn|info|debug>
705
+ --apiVersion=<option> Api-Version header to send; selects the V1 or V2 variant of the endpoint
706
+ <options: 1|2>
699
707
  --suffix=<value> Append a sub-route to the entity endpoint (e.g. --suffix=synchronous targets
700
708
  /<entities>/synchronous)
701
709
 
@@ -15,6 +15,7 @@ export default class CreateEntity extends BaseCommand {
15
15
  readableIds: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
16
16
  skipHydrateRelationships: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
17
17
  suffix: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
18
+ apiVersion: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
18
19
  alwaysConfirmEnv: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
19
20
  logLevel: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
20
21
  };
@@ -204,6 +204,11 @@ class CreateEntity extends basecommand_1.BaseCommand {
204
204
  description: 'Append a sub-route to the entity endpoint (e.g. --suffix=synchronous targets /<entities>/synchronous)',
205
205
  required: false,
206
206
  }),
207
+ apiVersion: core_1.Flags.string({
208
+ description: 'Api-Version header to send; selects the V1 or V2 variant of the endpoint',
209
+ options: ['1', '2'],
210
+ required: false,
211
+ }),
207
212
  };
208
213
  static args = {
209
214
  path: core_1.Args.string({
@@ -217,7 +222,7 @@ class CreateEntity extends basecommand_1.BaseCommand {
217
222
  (0, common_1.routeConsoleLogToStderr)();
218
223
  await (0, login_1.authUser)();
219
224
  const { flags, argv, args } = await this.parse(CreateEntity);
220
- const { count, dryRun: isDryRun, inputFile: inputFilename, outputFile: outputFilename, generateValues: shouldGenerateMissingValues, readableIds: shouldUseReadableIds, skipHydrateRelationships, suffix, } = flags;
225
+ const { count, dryRun: isDryRun, inputFile: inputFilename, outputFile: outputFilename, generateValues: shouldGenerateMissingValues, readableIds: shouldUseReadableIds, skipHydrateRelationships, suffix, apiVersion, } = flags;
221
226
  const { path: entityTypePath } = args;
222
227
  // Global flags is a little hacky, but it was easier
223
228
  // and it doesn't see *that* bad because they are only valid
@@ -263,7 +268,10 @@ class CreateEntity extends basecommand_1.BaseCommand {
263
268
  }
264
269
  try {
265
270
  const entitiesToCreate = await buildEntitiesToCreate(entityTypePath, partialEntities, propertySpecBySlug);
266
- const summary = await createEntities(entityName, entitiesToCreate, suffix);
271
+ const summary = await createEntities(entityName, entitiesToCreate, {
272
+ suffix,
273
+ apiVersion: apiVersion,
274
+ });
267
275
  if (outputFilename) {
268
276
  fs_1.default.writeFileSync(outputFilename, JSON.stringify(summary, null, 2));
269
277
  console.error(`Output saved to ${outputFilename}`);
@@ -282,8 +290,6 @@ class CreateEntity extends basecommand_1.BaseCommand {
282
290
  }
283
291
  }
284
292
  exports.default = CreateEntity;
285
- // Every row is attempted; a failed row never stops the run. The summary pairs
286
- // each failed input with its error so the failed rows can be retried as-is.
287
293
  function summarizeSettledCreates(inputs, settled) {
288
294
  const created = [];
289
295
  const failed = [];
@@ -298,13 +304,13 @@ function summarizeSettledCreates(inputs, settled) {
298
304
  return { created, failed };
299
305
  }
300
306
  exports.summarizeSettledCreates = summarizeSettledCreates;
301
- async function createEntities(entityName, entities, suffix) {
307
+ async function createEntities(entityName, entities, routing = {}) {
302
308
  if (IS_DRY_RUN) {
303
309
  console.error(`Dry run mode: not creating entities, but simulating creation for ${entityName}`);
304
310
  return { created: entities, failed: [] };
305
311
  }
306
312
  const limit = (0, p_limit_1.default)(20);
307
- const settled = await Promise.allSettled(entities.map(async (e) => limit(() => createEntity(entityName, e, suffix))));
313
+ const settled = await Promise.allSettled(entities.map(async (e) => limit(() => createEntity(entityName, e, routing))));
308
314
  return summarizeSettledCreates(entities, settled);
309
315
  }
310
316
  async function buildEntitiesToCreate(entityTypePath, entities, propertySpecificationBySlug) {
@@ -530,9 +536,7 @@ function castValueToPropertyType(value, propertyType) {
530
536
  if (Array.isArray(value)) {
531
537
  return value;
532
538
  }
533
- // Migration hazard: the old comma syntax parses as one string with a
534
- // comma in it. Warn with the repeated-key equivalent instead of
535
- // guessing at a split.
539
+ // the old comma syntax parses as one literal value; warn instead of guessing at a split
536
540
  if (typeof value === 'string' && value.includes(',')) {
537
541
  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
538
542
  .split(',')
@@ -544,9 +548,10 @@ function castValueToPropertyType(value, propertyType) {
544
548
  }
545
549
  }
546
550
  exports.castValueToPropertyType = castValueToPropertyType;
547
- async function createEntity(entityName, entity, suffix) {
551
+ async function createEntity(entityName, entity, routing = {}) {
548
552
  const client = new sdk_1.Entities();
549
553
  const skipHydrateRelationships = SHOULD_SKIP_HYDRATE_RELATIONSHIPS;
554
+ const { suffix, apiVersion } = routing;
550
555
  if (entityName === 'assortment-item' && !suffix)
551
556
  return (0, entities_1.createAssortmentItem)(entity, { skipHydrateRelationships }); // special case
552
557
  const response = await client.create({
@@ -554,6 +559,7 @@ async function createEntity(entityName, entity, suffix) {
554
559
  object: entity,
555
560
  skipHydrateRelationships,
556
561
  suffix,
562
+ apiVersion,
557
563
  });
558
564
  return response;
559
565
  }
@@ -333,8 +333,6 @@ 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
338
336
  const roles = [].concat(propertySpecs.get('roles'));
339
337
  // Test that property level matching works with specified roles
340
338
  expect((0, create_1.doesPropertyLevelMatchRole)(types_1.PropertyLevel.OPTION, roles[0])).toBe(true);
@@ -6,6 +6,7 @@ export default class DeleteEntity extends BaseCommand {
6
6
  dryRun: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
7
  inputFile: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
8
8
  suffix: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
+ apiVersion: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
10
  alwaysConfirmEnv: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
11
  logLevel: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
12
  };
@@ -34,6 +34,11 @@ class DeleteEntity extends basecommand_1.BaseCommand {
34
34
  description: 'Append a sub-route to the entity endpoint (e.g. --suffix=synchronous targets /<entities>/synchronous)',
35
35
  required: false,
36
36
  }),
37
+ apiVersion: core_1.Flags.string({
38
+ description: 'Api-Version header to send; selects the V1 or V2 variant of the endpoint',
39
+ options: ['1', '2'],
40
+ required: false,
41
+ }),
37
42
  };
38
43
  static args = {
39
44
  entityName: core_1.Args.string({
@@ -51,7 +56,7 @@ class DeleteEntity extends basecommand_1.BaseCommand {
51
56
  await (0, login_1.authUser)();
52
57
  const { args, flags, argv } = await this.parse(DeleteEntity);
53
58
  const { entityName } = args;
54
- const { inputFile: inputFilename, suffix } = flags;
59
+ const { inputFile: inputFilename, suffix, apiVersion } = flags;
55
60
  if (flags.dryRun) {
56
61
  IS_DRY_RUN = true;
57
62
  console.error('Running in dry run mode. No entities will be deleted.');
@@ -75,7 +80,10 @@ class DeleteEntity extends basecommand_1.BaseCommand {
75
80
  }
76
81
  const ids = rowsWithId ? rowsWithId.map((item) => item.id) : positionalIds;
77
82
  try {
78
- const response = await deleteEntityByIds(entityName, ids, suffix);
83
+ const response = await deleteEntityByIds(entityName, ids, {
84
+ suffix,
85
+ apiVersion: apiVersion,
86
+ });
79
87
  if (IS_DRY_RUN) {
80
88
  console.error('simulated deletion of entities:');
81
89
  }
@@ -94,12 +102,12 @@ class DeleteEntity extends basecommand_1.BaseCommand {
94
102
  }
95
103
  }
96
104
  exports.default = DeleteEntity;
97
- async function deleteEntityByIds(entityName, ids, suffix) {
105
+ async function deleteEntityByIds(entityName, ids, routing = {}) {
98
106
  const idsDeleted = new Set();
99
107
  const idsNotFound = new Set();
100
108
  const idsErrored = new Set();
101
109
  const limit = (0, p_limit_1.default)(10);
102
- const deletePromises = ids.map((id) => limit(() => deleteEntityById(entityName, id, suffix).then((entity) => {
110
+ const deletePromises = ids.map((id) => limit(() => deleteEntityById(entityName, id, routing).then((entity) => {
103
111
  if (!entity) {
104
112
  idsNotFound.add(id);
105
113
  return null;
@@ -122,12 +130,15 @@ async function deleteEntityByIds(entityName, ids, suffix) {
122
130
  idsErrored: Array.from(idsErrored),
123
131
  };
124
132
  }
125
- async function deleteEntityById(entityName, id, suffix) {
133
+ async function deleteEntityById(entityName, id, routing = {}) {
126
134
  const client = new sdk_1.Entities();
127
135
  if (IS_DRY_RUN) {
128
136
  return client.get({ entityName, id, ignore404: true }).catch(throwIfNot404);
129
137
  }
130
- return client.delete({ entityName, id, ignore404: true, suffix }).catch(throwIfNot404);
138
+ const { suffix, apiVersion } = routing;
139
+ return client
140
+ .delete({ entityName, id, ignore404: true, suffix, apiVersion })
141
+ .catch(throwIfNot404);
131
142
  }
132
143
  function throwIfNot404(e) {
133
144
  const { statusCode } = parseSDKErrorMessage(e);
@@ -11,6 +11,7 @@ export default class GetEntity extends BaseCommand {
11
11
  take: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
12
12
  relations: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
13
13
  suffix: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
14
+ apiVersion: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
14
15
  alwaysConfirmEnv: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
15
16
  logLevel: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
16
17
  };
@@ -66,6 +66,11 @@ class GetEntity extends basecommand_1.BaseCommand {
66
66
  description: 'Append a sub-route to the entity endpoint (e.g. --suffix=synchronous targets /<entities>/synchronous)',
67
67
  required: false,
68
68
  }),
69
+ apiVersion: core_1.Flags.string({
70
+ description: 'Api-Version header to send; selects the V1 or V2 variant of the endpoint',
71
+ options: ['1', '2'],
72
+ required: false,
73
+ }),
69
74
  };
70
75
  static args = {
71
76
  typePath: core_1.Args.string({
@@ -83,7 +88,7 @@ class GetEntity extends basecommand_1.BaseCommand {
83
88
  await (0, login_1.authUser)();
84
89
  const { args, flags, argv } = await this.parse(GetEntity);
85
90
  const { typePath } = args;
86
- const { outputFile, paginated: shouldUsePaginatedFind, propertySlugs, relations: relationString, skip, skipHydrateRelationships, suffix, take, } = flags;
91
+ const { outputFile, paginated: shouldUsePaginatedFind, propertySlugs, relations: relationString, skip, skipHydrateRelationships, suffix, apiVersion, take, } = flags;
87
92
  SHOULD_USE_PAGINATED_FIND = shouldUsePaginatedFind;
88
93
  MAX_NUMBER_OF_ENTITIES_TO_FETCH = take;
89
94
  if (MAX_NUMBER_OF_ENTITIES_TO_FETCH)
@@ -125,6 +130,7 @@ class GetEntity extends basecommand_1.BaseCommand {
125
130
  skipHydrateRelationships,
126
131
  skip,
127
132
  suffix,
133
+ apiVersion: apiVersion,
128
134
  relations,
129
135
  propertySlugs: propertySlugsArray,
130
136
  });
@@ -148,6 +154,7 @@ class GetEntity extends basecommand_1.BaseCommand {
148
154
  propertySlugs: propertySlugsArray,
149
155
  skip,
150
156
  suffix,
157
+ apiVersion: apiVersion,
151
158
  take,
152
159
  });
153
160
  if (outputFile) {
@@ -166,7 +173,7 @@ class GetEntity extends basecommand_1.BaseCommand {
166
173
  }
167
174
  exports.default = GetEntity;
168
175
  async function getEntityByTypePath(typePath, propertySpec, options = {}) {
169
- const { propertySlugs, relations, skipHydrateRelationships, skip, suffix, take } = options;
176
+ const { propertySlugs, relations, skipHydrateRelationships, skip, suffix, apiVersion, take } = options;
170
177
  const id = propertySpec?.get('id')?.toString() || undefined;
171
178
  const criteria = convertPropertySpecIntoCriteria(propertySpec || new Map());
172
179
  const { root: entityName } = (0, types_1.parseTypePath)(typePath);
@@ -181,6 +188,7 @@ async function getEntityByTypePath(typePath, propertySpec, options = {}) {
181
188
  criteria,
182
189
  skip,
183
190
  suffix,
191
+ apiVersion,
184
192
  take,
185
193
  });
186
194
  }
@@ -193,13 +201,14 @@ function convertPropertySpecIntoCriteria(propertySpec) {
193
201
  }
194
202
  async function find(entityName, options = {}) {
195
203
  const client = new sdk_1.Entities();
196
- const { criteria, id, propertySlugs, skipHydrateRelationships, relations, skip, suffix, take } = options;
204
+ const { criteria, id, propertySlugs, skipHydrateRelationships, relations, skip, suffix, apiVersion, take, } = options;
197
205
  const queryOptions = {
198
206
  entityName,
199
207
  skipHydrateRelationships,
200
208
  relations,
201
209
  skip,
202
210
  suffix,
211
+ apiVersion,
203
212
  take,
204
213
  };
205
214
  if (propertySlugs && propertySlugs.length > 0) {
@@ -223,7 +232,8 @@ async function* streamPaginatedFind(typePath, options = {}) {
223
232
  const opts = {
224
233
  ...options,
225
234
  entityName,
226
- apiVersion: sdk_1.API_VERSION.V2,
235
+ // paginated reads require the V2 response shape unless overridden
236
+ apiVersion: options.apiVersion ?? sdk_1.API_VERSION.V2,
227
237
  nextPageKey,
228
238
  };
229
239
  if (options.propertySlugs?.length > 0) {
@@ -71,5 +71,10 @@ describe('entities command grammar: entities <verb> <typePath> [ID...]', () => {
71
71
  expect(update_1.default.flags.suffix).toBeDefined();
72
72
  expect(delete_1.default.flags.suffix).toBeDefined();
73
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
+ });
74
79
  });
75
80
  });
@@ -8,6 +8,7 @@ export default class UpdateEntity extends BaseCommand {
8
8
  inputFile: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
9
  force: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
10
  suffix: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
+ apiVersion: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
12
  alwaysConfirmEnv: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
12
13
  logLevel: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
13
14
  };
@@ -45,6 +45,11 @@ class UpdateEntity extends basecommand_1.BaseCommand {
45
45
  description: 'Append a sub-route to the entity endpoint (e.g. --suffix=synchronous targets /<entities>/synchronous)',
46
46
  required: false,
47
47
  }),
48
+ apiVersion: core_1.Flags.string({
49
+ description: 'Api-Version header to send; selects the V1 or V2 variant of the endpoint',
50
+ options: ['1', '2'],
51
+ required: false,
52
+ }),
48
53
  };
49
54
  static args = {
50
55
  entityName: core_1.Args.string({
@@ -62,7 +67,7 @@ class UpdateEntity extends basecommand_1.BaseCommand {
62
67
  await (0, login_1.authUser)();
63
68
  const { args, argv } = await this.parse(UpdateEntity);
64
69
  const { entityName } = args;
65
- const { dryRun: isDryRun, inputFile: inputFilename, skipHydrateRelationships, suffix, force, } = this.flags;
70
+ const { dryRun: isDryRun, inputFile: inputFilename, skipHydrateRelationships, suffix, apiVersion, force, } = this.flags;
66
71
  const { ids: positionalIds, specs } = (0, propertySpecifications_1.partitionIdsAndSpecs)(argv.slice(1));
67
72
  const propertySpec = (0, propertySpecifications_1.parsePropertySpecificationsIntoMap)(specs);
68
73
  if (propertySpec.has('id') || propertySpec.has('ids')) {
@@ -95,6 +100,7 @@ class UpdateEntity extends basecommand_1.BaseCommand {
95
100
  : updateEntityById(entityName, id, newEntityState, {
96
101
  skipHydrateRelationships,
97
102
  suffix,
103
+ apiVersion: apiVersion,
98
104
  force,
99
105
  });
100
106
  }
@@ -117,8 +123,6 @@ class UpdateEntity extends basecommand_1.BaseCommand {
117
123
  }
118
124
  }
119
125
  exports.default = UpdateEntity;
120
- // Every row is attempted; a failed row never stops the run. The summary pairs
121
- // each failed id with its error so the failed rows can be retried.
122
126
  function summarizeSettledUpdates(inputs, settled, skipped) {
123
127
  const updated = [];
124
128
  const failed = [];
@@ -138,8 +142,15 @@ function summarizeSettledUpdates(inputs, settled, skipped) {
138
142
  exports.summarizeSettledUpdates = summarizeSettledUpdates;
139
143
  async function updateEntityById(entityName, id, changes, options = {}) {
140
144
  const client = new sdk_1.Entities();
141
- const { skipHydrateRelationships, suffix, force } = options;
142
- return client.update({ entityName, id, object: changes, skipHydrateRelationships, suffix });
145
+ const { skipHydrateRelationships, suffix, apiVersion, force } = options;
146
+ return client.update({
147
+ entityName,
148
+ id,
149
+ object: changes,
150
+ skipHydrateRelationships,
151
+ suffix,
152
+ apiVersion,
153
+ });
143
154
  }
144
155
  async function mockUpdateById(entityName, id, changes, options = {}) {
145
156
  const client = new sdk_1.Entities();
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.6.0-alpha-8-alpha.7d24daa",
2
+ "version": "3.6.0-alpha-8-alpha.19e980d",
3
3
  "commands": {
4
4
  "app:create": {
5
5
  "id": "app:create",
@@ -782,6 +782,17 @@
782
782
  "description": "Append a sub-route to the entity endpoint (e.g. --suffix=synchronous targets /<entities>/synchronous)",
783
783
  "required": false,
784
784
  "multiple": false
785
+ },
786
+ "apiVersion": {
787
+ "name": "apiVersion",
788
+ "type": "option",
789
+ "description": "Api-Version header to send; selects the V1 or V2 variant of the endpoint",
790
+ "required": false,
791
+ "multiple": false,
792
+ "options": [
793
+ "1",
794
+ "2"
795
+ ]
785
796
  }
786
797
  },
787
798
  "args": {
@@ -855,6 +866,17 @@
855
866
  "description": "Append a sub-route to the entity endpoint (e.g. --suffix=synchronous targets /<entities>/synchronous)",
856
867
  "required": false,
857
868
  "multiple": false
869
+ },
870
+ "apiVersion": {
871
+ "name": "apiVersion",
872
+ "type": "option",
873
+ "description": "Api-Version header to send; selects the V1 or V2 variant of the endpoint",
874
+ "required": false,
875
+ "multiple": false,
876
+ "options": [
877
+ "1",
878
+ "2"
879
+ ]
858
880
  }
859
881
  },
860
882
  "args": {
@@ -976,6 +998,17 @@
976
998
  "description": "Append a sub-route to the entity endpoint (e.g. --suffix=synchronous targets /<entities>/synchronous)",
977
999
  "required": false,
978
1000
  "multiple": false
1001
+ },
1002
+ "apiVersion": {
1003
+ "name": "apiVersion",
1004
+ "type": "option",
1005
+ "description": "Api-Version header to send; selects the V1 or V2 variant of the endpoint",
1006
+ "required": false,
1007
+ "multiple": false,
1008
+ "options": [
1009
+ "1",
1010
+ "2"
1011
+ ]
979
1012
  }
980
1013
  },
981
1014
  "args": {
@@ -1070,6 +1103,17 @@
1070
1103
  "description": "Append a sub-route to the entity endpoint (e.g. --suffix=synchronous targets /<entities>/synchronous)",
1071
1104
  "required": false,
1072
1105
  "multiple": false
1106
+ },
1107
+ "apiVersion": {
1108
+ "name": "apiVersion",
1109
+ "type": "option",
1110
+ "description": "Api-Version header to send; selects the V1 or V2 variant of the endpoint",
1111
+ "required": false,
1112
+ "multiple": false,
1113
+ "options": [
1114
+ "1",
1115
+ "2"
1116
+ ]
1073
1117
  }
1074
1118
  },
1075
1119
  "args": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/cli",
3
- "version": "3.6.0-alpha-8-alpha.7d24daa",
3
+ "version": "3.6.0-alpha-8-alpha.19e980d",
4
4
  "description": "VibeIQ's Contrail Platform CLI.",
5
5
  "bin": {
6
6
  "contrail-cli": "./bin/run",