@contrail/cli 3.6.0-alpha-8-alpha.8cae9b1 → 3.6.0-alpha-8-alpha.d292a3d

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.8cae9b1 linux-x64 node-v24.21.0
20
+ @contrail/cli/3.6.0-alpha-8-alpha.d292a3d 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]
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,10 @@ 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>
573
+ --suffix=<value> Append a sub-route to the entity endpoint (e.g. --suffix=synchronous targets
574
+ /<entities>/synchronous)
571
575
 
572
576
  DESCRIPTION
573
577
  Create entities
@@ -598,7 +602,8 @@ Delete entities by id
598
602
 
599
603
  ```
600
604
  USAGE
601
- $ contrail entities delete ENTITYNAME [IDS] [-l error|warn|info|debug] [-e true|false] [-d] [-i <value>]
605
+ $ contrail entities delete ENTITYNAME [IDS] [-l error|warn|info|debug] [-e true|false] [-d] [-i <value>] [--suffix
606
+ <value>] [--apiVersion 1|2]
602
607
 
603
608
  ARGUMENTS
604
609
  ENTITYNAME The name of the entity type to delete
@@ -612,6 +617,10 @@ FLAGS
612
617
  entity in the file.
613
618
  -l, --logLevel=<option> The Log Level
614
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>
622
+ --suffix=<value> Append a sub-route to the entity endpoint (e.g. --suffix=synchronous targets
623
+ /<entities>/synchronous)
615
624
 
616
625
  DESCRIPTION
617
626
  Delete entities by id
@@ -631,7 +640,7 @@ Get an entity
631
640
  ```
632
641
  USAGE
633
642
  $ contrail entities get TYPEPATH [IDS] [-l error|warn|info|debug] [-e true|false] [-o <value>] [-p <value>] [-P]
634
- [-s <value>] [-S] [-t <value>] [-r <value>]
643
+ [-s <value>] [-S] [-t <value>] [-r <value>] [--suffix <value>] [--apiVersion 1|2]
635
644
 
636
645
  ARGUMENTS
637
646
  TYPEPATH The name of the entity type to fetch
@@ -649,6 +658,10 @@ FLAGS
649
658
  -r, --relations=<value> Comma-separated list of relations to include in the output
650
659
  -s, --skip=<value> Number of entities to skip (used with paginated fetch)
651
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>
663
+ --suffix=<value> Append a sub-route to the entity endpoint (e.g. --suffix=synchronous targets
664
+ /<entities>/synchronous)
652
665
 
653
666
  DESCRIPTION
654
667
  Get an entity
@@ -674,6 +687,7 @@ Update an entity
674
687
  ```
675
688
  USAGE
676
689
  $ contrail entities update ENTITYNAME [IDS] [-l error|warn|info|debug] [-e true|false] [-S] [-d] [-i <value>] [-F]
690
+ [--suffix <value>] [--apiVersion 1|2]
677
691
 
678
692
  ARGUMENTS
679
693
  ENTITYNAME The name of the entity type to update
@@ -688,6 +702,10 @@ FLAGS
688
702
  -i, --inputFile=<value> File containing properties to update the entity (optional)
689
703
  -l, --logLevel=<option> The Log Level
690
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>
707
+ --suffix=<value> Append a sub-route to the entity endpoint (e.g. --suffix=synchronous targets
708
+ /<entities>/synchronous)
691
709
 
692
710
  DESCRIPTION
693
711
  Update an entity
@@ -14,6 +14,8 @@ export default class CreateEntity extends BaseCommand {
14
14
  generateValues: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
15
15
  readableIds: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
16
16
  skipHydrateRelationships: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
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>;
17
19
  alwaysConfirmEnv: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
18
20
  logLevel: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
19
21
  };
@@ -200,6 +200,15 @@ class CreateEntity extends basecommand_1.BaseCommand {
200
200
  required: false,
201
201
  default: false,
202
202
  }),
203
+ suffix: core_1.Flags.string({
204
+ description: 'Append a sub-route to the entity endpoint (e.g. --suffix=synchronous targets /<entities>/synchronous)',
205
+ required: false,
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
+ }),
203
212
  };
204
213
  static args = {
205
214
  path: core_1.Args.string({
@@ -213,7 +222,7 @@ class CreateEntity extends basecommand_1.BaseCommand {
213
222
  (0, common_1.routeConsoleLogToStderr)();
214
223
  await (0, login_1.authUser)();
215
224
  const { flags, argv, args } = await this.parse(CreateEntity);
216
- const { count, dryRun: isDryRun, inputFile: inputFilename, outputFile: outputFilename, generateValues: shouldGenerateMissingValues, readableIds: shouldUseReadableIds, skipHydrateRelationships, } = flags;
225
+ const { count, dryRun: isDryRun, inputFile: inputFilename, outputFile: outputFilename, generateValues: shouldGenerateMissingValues, readableIds: shouldUseReadableIds, skipHydrateRelationships, suffix, apiVersion, } = flags;
217
226
  const { path: entityTypePath } = args;
218
227
  // Global flags is a little hacky, but it was easier
219
228
  // and it doesn't see *that* bad because they are only valid
@@ -259,7 +268,10 @@ class CreateEntity extends basecommand_1.BaseCommand {
259
268
  }
260
269
  try {
261
270
  const entitiesToCreate = await buildEntitiesToCreate(entityTypePath, partialEntities, propertySpecBySlug);
262
- const summary = await createEntities(entityName, entitiesToCreate);
271
+ const summary = await createEntities(entityName, entitiesToCreate, {
272
+ suffix,
273
+ apiVersion: apiVersion,
274
+ });
263
275
  if (outputFilename) {
264
276
  fs_1.default.writeFileSync(outputFilename, JSON.stringify(summary, null, 2));
265
277
  console.error(`Output saved to ${outputFilename}`);
@@ -294,13 +306,13 @@ function summarizeSettledCreates(inputs, settled) {
294
306
  return { created, failed };
295
307
  }
296
308
  exports.summarizeSettledCreates = summarizeSettledCreates;
297
- async function createEntities(entityName, entities) {
309
+ async function createEntities(entityName, entities, routing = {}) {
298
310
  if (IS_DRY_RUN) {
299
311
  console.error(`Dry run mode: not creating entities, but simulating creation for ${entityName}`);
300
312
  return { created: entities, failed: [] };
301
313
  }
302
314
  const limit = (0, p_limit_1.default)(20);
303
- const settled = await Promise.allSettled(entities.map(async (e) => limit(() => createEntity(entityName, e))));
315
+ const settled = await Promise.allSettled(entities.map(async (e) => limit(() => createEntity(entityName, e, routing))));
304
316
  return summarizeSettledCreates(entities, settled);
305
317
  }
306
318
  async function buildEntitiesToCreate(entityTypePath, entities, propertySpecificationBySlug) {
@@ -540,12 +552,19 @@ function castValueToPropertyType(value, propertyType) {
540
552
  }
541
553
  }
542
554
  exports.castValueToPropertyType = castValueToPropertyType;
543
- async function createEntity(entityName, entity) {
555
+ async function createEntity(entityName, entity, routing = {}) {
544
556
  const client = new sdk_1.Entities();
545
557
  const skipHydrateRelationships = SHOULD_SKIP_HYDRATE_RELATIONSHIPS;
546
- if (entityName === 'assortment-item')
558
+ const { suffix, apiVersion } = routing;
559
+ if (entityName === 'assortment-item' && !suffix)
547
560
  return (0, entities_1.createAssortmentItem)(entity, { skipHydrateRelationships }); // special case
548
- const response = await client.create({ entityName, object: entity, skipHydrateRelationships });
561
+ const response = await client.create({
562
+ entityName,
563
+ object: entity,
564
+ skipHydrateRelationships,
565
+ suffix,
566
+ apiVersion,
567
+ });
549
568
  return response;
550
569
  }
551
570
  function getReferencedObjectPaths(type) {
@@ -5,6 +5,8 @@ export default class DeleteEntity extends BaseCommand {
5
5
  static flags: {
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
+ 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>;
8
10
  alwaysConfirmEnv: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
11
  logLevel: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
12
  };
@@ -30,6 +30,15 @@ class DeleteEntity extends basecommand_1.BaseCommand {
30
30
  required: false,
31
31
  multiple: false,
32
32
  }),
33
+ suffix: core_1.Flags.string({
34
+ description: 'Append a sub-route to the entity endpoint (e.g. --suffix=synchronous targets /<entities>/synchronous)',
35
+ required: false,
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
+ }),
33
42
  };
34
43
  static args = {
35
44
  entityName: core_1.Args.string({
@@ -47,7 +56,7 @@ class DeleteEntity extends basecommand_1.BaseCommand {
47
56
  await (0, login_1.authUser)();
48
57
  const { args, flags, argv } = await this.parse(DeleteEntity);
49
58
  const { entityName } = args;
50
- const { inputFile: inputFilename } = flags;
59
+ const { inputFile: inputFilename, suffix, apiVersion } = flags;
51
60
  if (flags.dryRun) {
52
61
  IS_DRY_RUN = true;
53
62
  console.error('Running in dry run mode. No entities will be deleted.');
@@ -71,7 +80,10 @@ class DeleteEntity extends basecommand_1.BaseCommand {
71
80
  }
72
81
  const ids = rowsWithId ? rowsWithId.map((item) => item.id) : positionalIds;
73
82
  try {
74
- const response = await deleteEntityByIds(entityName, ids);
83
+ const response = await deleteEntityByIds(entityName, ids, {
84
+ suffix,
85
+ apiVersion: apiVersion,
86
+ });
75
87
  if (IS_DRY_RUN) {
76
88
  console.error('simulated deletion of entities:');
77
89
  }
@@ -90,12 +102,12 @@ class DeleteEntity extends basecommand_1.BaseCommand {
90
102
  }
91
103
  }
92
104
  exports.default = DeleteEntity;
93
- async function deleteEntityByIds(entityName, ids) {
105
+ async function deleteEntityByIds(entityName, ids, routing = {}) {
94
106
  const idsDeleted = new Set();
95
107
  const idsNotFound = new Set();
96
108
  const idsErrored = new Set();
97
109
  const limit = (0, p_limit_1.default)(10);
98
- const deletePromises = ids.map((id) => limit(() => deleteEntityById(entityName, id).then((entity) => {
110
+ const deletePromises = ids.map((id) => limit(() => deleteEntityById(entityName, id, routing).then((entity) => {
99
111
  if (!entity) {
100
112
  idsNotFound.add(id);
101
113
  return null;
@@ -118,12 +130,15 @@ async function deleteEntityByIds(entityName, ids) {
118
130
  idsErrored: Array.from(idsErrored),
119
131
  };
120
132
  }
121
- async function deleteEntityById(entityName, id) {
133
+ async function deleteEntityById(entityName, id, routing = {}) {
122
134
  const client = new sdk_1.Entities();
123
135
  if (IS_DRY_RUN) {
124
136
  return client.get({ entityName, id, ignore404: true }).catch(throwIfNot404);
125
137
  }
126
- return client.delete({ entityName, id, ignore404: true }).catch(throwIfNot404);
138
+ const { suffix, apiVersion } = routing;
139
+ return client
140
+ .delete({ entityName, id, ignore404: true, suffix, apiVersion })
141
+ .catch(throwIfNot404);
127
142
  }
128
143
  function throwIfNot404(e) {
129
144
  const { statusCode } = parseSDKErrorMessage(e);
@@ -10,6 +10,8 @@ export default class GetEntity extends BaseCommand {
10
10
  skipHydrateRelationships: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
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
+ 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>;
13
15
  alwaysConfirmEnv: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
14
16
  logLevel: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
15
17
  };
@@ -62,6 +62,15 @@ class GetEntity extends basecommand_1.BaseCommand {
62
62
  description: 'Comma-separated list of relations to include in the output',
63
63
  required: false,
64
64
  }),
65
+ suffix: core_1.Flags.string({
66
+ description: 'Append a sub-route to the entity endpoint (e.g. --suffix=synchronous targets /<entities>/synchronous)',
67
+ required: false,
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
+ }),
65
74
  };
66
75
  static args = {
67
76
  typePath: core_1.Args.string({
@@ -79,7 +88,7 @@ class GetEntity extends basecommand_1.BaseCommand {
79
88
  await (0, login_1.authUser)();
80
89
  const { args, flags, argv } = await this.parse(GetEntity);
81
90
  const { typePath } = args;
82
- const { outputFile, paginated: shouldUsePaginatedFind, propertySlugs, relations: relationString, skip, skipHydrateRelationships, take, } = flags;
91
+ const { outputFile, paginated: shouldUsePaginatedFind, propertySlugs, relations: relationString, skip, skipHydrateRelationships, suffix, apiVersion, take, } = flags;
83
92
  SHOULD_USE_PAGINATED_FIND = shouldUsePaginatedFind;
84
93
  MAX_NUMBER_OF_ENTITIES_TO_FETCH = take;
85
94
  if (MAX_NUMBER_OF_ENTITIES_TO_FETCH)
@@ -120,6 +129,8 @@ class GetEntity extends basecommand_1.BaseCommand {
120
129
  criteria: convertPropertySpecIntoCriteria(propertySpecBySlug),
121
130
  skipHydrateRelationships,
122
131
  skip,
132
+ suffix,
133
+ apiVersion: apiVersion,
123
134
  relations,
124
135
  propertySlugs: propertySlugsArray,
125
136
  });
@@ -142,6 +153,8 @@ class GetEntity extends basecommand_1.BaseCommand {
142
153
  relations,
143
154
  propertySlugs: propertySlugsArray,
144
155
  skip,
156
+ suffix,
157
+ apiVersion: apiVersion,
145
158
  take,
146
159
  });
147
160
  if (outputFile) {
@@ -160,7 +173,7 @@ class GetEntity extends basecommand_1.BaseCommand {
160
173
  }
161
174
  exports.default = GetEntity;
162
175
  async function getEntityByTypePath(typePath, propertySpec, options = {}) {
163
- const { propertySlugs, relations, skipHydrateRelationships, skip, take } = options;
176
+ const { propertySlugs, relations, skipHydrateRelationships, skip, suffix, apiVersion, take } = options;
164
177
  const id = propertySpec?.get('id')?.toString() || undefined;
165
178
  const criteria = convertPropertySpecIntoCriteria(propertySpec || new Map());
166
179
  const { root: entityName } = (0, types_1.parseTypePath)(typePath);
@@ -174,6 +187,8 @@ async function getEntityByTypePath(typePath, propertySpec, options = {}) {
174
187
  propertySlugs,
175
188
  criteria,
176
189
  skip,
190
+ suffix,
191
+ apiVersion,
177
192
  take,
178
193
  });
179
194
  }
@@ -186,19 +201,22 @@ function convertPropertySpecIntoCriteria(propertySpec) {
186
201
  }
187
202
  async function find(entityName, options = {}) {
188
203
  const client = new sdk_1.Entities();
189
- const { criteria, id, propertySlugs, skipHydrateRelationships, relations, skip, take } = options;
204
+ const { criteria, id, propertySlugs, skipHydrateRelationships, relations, skip, suffix, apiVersion, take, } = options;
190
205
  const queryOptions = {
191
206
  entityName,
192
207
  skipHydrateRelationships,
193
208
  relations,
194
209
  skip,
210
+ suffix,
211
+ apiVersion,
195
212
  take,
196
213
  };
197
214
  if (propertySlugs && propertySlugs.length > 0) {
198
215
  queryOptions.customParams = { propertySlugs: propertySlugs.join(',') };
199
216
  }
200
217
  const payload = id ? { id, ...queryOptions } : { criteria, ...queryOptions };
201
- if ((0, batchFetch_1.canBatchFetchEntity)(entityName)) {
218
+ // a suffix names a specific sub-route, so it always goes through the plain client
219
+ if ((0, batchFetch_1.canBatchFetchEntity)(entityName) && !suffix) {
202
220
  return (0, batchFetch_1.batchFetch)(entityName, payload);
203
221
  }
204
222
  else {
@@ -214,7 +232,8 @@ async function* streamPaginatedFind(typePath, options = {}) {
214
232
  const opts = {
215
233
  ...options,
216
234
  entityName,
217
- 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,
218
237
  nextPageKey,
219
238
  };
220
239
  if (options.propertySlugs?.length > 0) {
@@ -65,5 +65,16 @@ describe('entities command grammar: entities <verb> <typePath> [ID...]', () => {
65
65
  it('should keep -s for --skip on get', () => {
66
66
  expect(get_1.default.flags.skip.char).toBe('s');
67
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
+ });
68
79
  });
69
80
  });
@@ -7,6 +7,8 @@ export default class UpdateEntity extends BaseCommand {
7
7
  dryRun: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
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
+ 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>;
10
12
  alwaysConfirmEnv: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
13
  logLevel: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
12
14
  };
@@ -41,6 +41,15 @@ class UpdateEntity extends basecommand_1.BaseCommand {
41
41
  description: 'Force update without validation. Internal use only',
42
42
  required: false,
43
43
  }),
44
+ suffix: core_1.Flags.string({
45
+ description: 'Append a sub-route to the entity endpoint (e.g. --suffix=synchronous targets /<entities>/synchronous)',
46
+ required: false,
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
+ }),
44
53
  };
45
54
  static args = {
46
55
  entityName: core_1.Args.string({
@@ -58,7 +67,7 @@ class UpdateEntity extends basecommand_1.BaseCommand {
58
67
  await (0, login_1.authUser)();
59
68
  const { args, argv } = await this.parse(UpdateEntity);
60
69
  const { entityName } = args;
61
- const { dryRun: isDryRun, inputFile: inputFilename, skipHydrateRelationships, force, } = this.flags;
70
+ const { dryRun: isDryRun, inputFile: inputFilename, skipHydrateRelationships, suffix, apiVersion, force, } = this.flags;
62
71
  const { ids: positionalIds, specs } = (0, propertySpecifications_1.partitionIdsAndSpecs)(argv.slice(1));
63
72
  const propertySpec = (0, propertySpecifications_1.parsePropertySpecificationsIntoMap)(specs);
64
73
  if (propertySpec.has('id') || propertySpec.has('ids')) {
@@ -88,7 +97,12 @@ class UpdateEntity extends basecommand_1.BaseCommand {
88
97
  const id = entity.id;
89
98
  return isDryRun
90
99
  ? mockUpdateById(entityName, id, newEntityState, { skipHydrateRelationships })
91
- : updateEntityById(entityName, id, newEntityState, { skipHydrateRelationships, force });
100
+ : updateEntityById(entityName, id, newEntityState, {
101
+ skipHydrateRelationships,
102
+ suffix,
103
+ apiVersion: apiVersion,
104
+ force,
105
+ });
92
106
  }
93
107
  try {
94
108
  const limit = (0, p_limit_1.default)(20);
@@ -130,8 +144,15 @@ function summarizeSettledUpdates(inputs, settled, skipped) {
130
144
  exports.summarizeSettledUpdates = summarizeSettledUpdates;
131
145
  async function updateEntityById(entityName, id, changes, options = {}) {
132
146
  const client = new sdk_1.Entities();
133
- const { skipHydrateRelationships, force } = options;
134
- return client.update({ entityName, id, object: changes, skipHydrateRelationships });
147
+ const { skipHydrateRelationships, suffix, apiVersion, force } = options;
148
+ return client.update({
149
+ entityName,
150
+ id,
151
+ object: changes,
152
+ skipHydrateRelationships,
153
+ suffix,
154
+ apiVersion,
155
+ });
135
156
  }
136
157
  async function mockUpdateById(entityName, id, changes, options = {}) {
137
158
  const client = new sdk_1.Entities();
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.6.0-alpha-8-alpha.8cae9b1",
2
+ "version": "3.6.0-alpha-8-alpha.d292a3d",
3
3
  "commands": {
4
4
  "app:create": {
5
5
  "id": "app:create",
@@ -775,6 +775,24 @@
775
775
  "description": "If true, does not hydrate relationships for the created entities",
776
776
  "required": false,
777
777
  "allowNo": false
778
+ },
779
+ "suffix": {
780
+ "name": "suffix",
781
+ "type": "option",
782
+ "description": "Append a sub-route to the entity endpoint (e.g. --suffix=synchronous targets /<entities>/synchronous)",
783
+ "required": false,
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
+ ]
778
796
  }
779
797
  },
780
798
  "args": {
@@ -841,6 +859,24 @@
841
859
  "description": "A file with a JSON array of objects; only each object's id is used. Deletes every entity in the file.",
842
860
  "required": false,
843
861
  "multiple": false
862
+ },
863
+ "suffix": {
864
+ "name": "suffix",
865
+ "type": "option",
866
+ "description": "Append a sub-route to the entity endpoint (e.g. --suffix=synchronous targets /<entities>/synchronous)",
867
+ "required": false,
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
+ ]
844
880
  }
845
881
  },
846
882
  "args": {
@@ -955,6 +991,24 @@
955
991
  "description": "Comma-separated list of relations to include in the output",
956
992
  "required": false,
957
993
  "multiple": false
994
+ },
995
+ "suffix": {
996
+ "name": "suffix",
997
+ "type": "option",
998
+ "description": "Append a sub-route to the entity endpoint (e.g. --suffix=synchronous targets /<entities>/synchronous)",
999
+ "required": false,
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
+ ]
958
1012
  }
959
1013
  },
960
1014
  "args": {
@@ -1042,6 +1096,24 @@
1042
1096
  "description": "Force update without validation. Internal use only",
1043
1097
  "required": false,
1044
1098
  "allowNo": false
1099
+ },
1100
+ "suffix": {
1101
+ "name": "suffix",
1102
+ "type": "option",
1103
+ "description": "Append a sub-route to the entity endpoint (e.g. --suffix=synchronous targets /<entities>/synchronous)",
1104
+ "required": false,
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
+ ]
1045
1117
  }
1046
1118
  },
1047
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.8cae9b1",
3
+ "version": "3.6.0-alpha-8-alpha.d292a3d",
4
4
  "description": "VibeIQ's Contrail Platform CLI.",
5
5
  "bin": {
6
6
  "contrail-cli": "./bin/run",