@contrail/cli 3.6.0-alpha-8-alpha.828359d → 3.6.0-alpha-8-alpha.2a57edb

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.828359d linux-x64 node-v24.21.0
20
+ @contrail/cli/3.6.0-alpha-8-alpha.2a57edb linux-x64 node-v24.21.0
21
21
  $ contrail --help [COMMAND]
22
22
  USAGE
23
23
  $ contrail COMMAND
@@ -686,7 +686,7 @@ Update an entity
686
686
 
687
687
  ```
688
688
  USAGE
689
- $ contrail entities update ENTITYNAME [IDS] [-l error|warn|info|debug] [-e true|false] [-S] [-d] [-i <value>]
689
+ $ contrail entities update ENTITYNAME [IDS] [-l error|warn|info|debug] [-e true|false] [-S] [-d] [-i <value>] [-F]
690
690
  [--suffix <value>] [--apiVersion 1|2]
691
691
 
692
692
  ARGUMENTS
@@ -694,6 +694,7 @@ ARGUMENTS
694
694
  IDS One or more entity ids to update
695
695
 
696
696
  FLAGS
697
+ -F, --force Force update without validation. Internal use only
697
698
  -S, --skipHydrateRelationships Skip hydrating relationships when updating the entity
698
699
  -d, --dryRun If true, does not update the entities but simulates the update
699
700
  -e, --alwaysConfirmEnv=<option> [default: true] The Environment variables
@@ -91,8 +91,8 @@ class DeleteEntity extends basecommand_1.BaseCommand {
91
91
  console.error('deleted entities:');
92
92
  }
93
93
  this.log(JSON.stringify(response, null, 2));
94
- if (response.failed.length > 0) {
95
- console.error(`${response.failed.length} of ${ids.length} deletes failed.`);
94
+ if (response.idsErrored.length > 0) {
95
+ console.error(`${response.idsErrored.length} of ${ids.length} deletes failed.`);
96
96
  process.exitCode = 1;
97
97
  }
98
98
  }
@@ -103,26 +103,32 @@ class DeleteEntity extends basecommand_1.BaseCommand {
103
103
  }
104
104
  exports.default = DeleteEntity;
105
105
  async function deleteEntityByIds(entityName, ids, routing = {}) {
106
- const deletedIds = [];
107
- const notFoundIds = [];
108
- const failed = [];
106
+ const idsDeleted = new Set();
107
+ const idsNotFound = new Set();
108
+ const idsErrored = new Set();
109
109
  const limit = (0, p_limit_1.default)(10);
110
110
  const deletePromises = ids.map((id) => limit(() => deleteEntityById(entityName, id, routing).then((entity) => {
111
111
  if (!entity) {
112
- notFoundIds.push(id);
113
- return;
112
+ idsNotFound.add(id);
113
+ return null;
114
114
  }
115
- deletedIds.push(id);
115
+ idsDeleted.add(id);
116
+ return entity;
116
117
  }, (error) => {
117
118
  if (error.message.includes('not found')) {
118
- notFoundIds.push(id);
119
+ idsNotFound.add(id);
119
120
  }
120
121
  else {
121
- failed.push({ id, error: (0, common_1.sdkErrorMessage)(error) });
122
+ idsErrored.add(id);
122
123
  }
124
+ return null;
123
125
  })));
124
126
  await Promise.all(deletePromises);
125
- return { deletedIds, notFoundIds, failed };
127
+ return {
128
+ idsDeleted: Array.from(idsDeleted),
129
+ idsNotFound: Array.from(idsNotFound),
130
+ idsErrored: Array.from(idsErrored),
131
+ };
126
132
  }
127
133
  async function deleteEntityById(entityName, id, routing = {}) {
128
134
  const client = new sdk_1.Entities();
@@ -157,9 +157,6 @@ class GetEntity extends basecommand_1.BaseCommand {
157
157
  apiVersion: apiVersion,
158
158
  take,
159
159
  });
160
- if (response === null) {
161
- this.error(`Entity not found: ${propertySpecBySlug.get('id')}`, { exit: 1 });
162
- }
163
160
  if (outputFile) {
164
161
  fs_1.default.writeFileSync(outputFile, JSON.stringify(response, null, 2));
165
162
  console.error(`Output saved to ${outputFile}`);
@@ -170,9 +167,6 @@ class GetEntity extends basecommand_1.BaseCommand {
170
167
  }
171
168
  }
172
169
  catch (e) {
173
- if (e.message?.startsWith('Entity not found:')) {
174
- throw e;
175
- }
176
170
  this.error(`Error fetching entity: ${e.message}`);
177
171
  }
178
172
  }
@@ -188,8 +182,6 @@ async function getEntityByTypePath(typePath, propertySpec, options = {}) {
188
182
  }
189
183
  return find(entityName, {
190
184
  id,
191
- // a missing id returns null (no retries); the command turns it into a clean not-found error
192
- ignore404: id !== undefined,
193
185
  skipHydrateRelationships,
194
186
  relations,
195
187
  propertySlugs,
@@ -209,10 +201,9 @@ function convertPropertySpecIntoCriteria(propertySpec) {
209
201
  }
210
202
  async function find(entityName, options = {}) {
211
203
  const client = new sdk_1.Entities();
212
- const { criteria, id, ignore404, propertySlugs, skipHydrateRelationships, relations, skip, suffix, apiVersion, take, } = options;
204
+ const { criteria, id, propertySlugs, skipHydrateRelationships, relations, skip, suffix, apiVersion, take, } = options;
213
205
  const queryOptions = {
214
206
  entityName,
215
- ignore404,
216
207
  skipHydrateRelationships,
217
208
  relations,
218
209
  skip,
@@ -6,6 +6,7 @@ export default class UpdateEntity extends BaseCommand {
6
6
  skipHydrateRelationships: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
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
+ force: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
10
  suffix: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
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>;
@@ -36,6 +36,11 @@ class UpdateEntity extends basecommand_1.BaseCommand {
36
36
  description: 'A file with a JSON array of {id, ...} objects; each object is one entity to update.',
37
37
  required: false,
38
38
  }),
39
+ force: core_1.Flags.boolean({
40
+ char: 'F',
41
+ description: 'Force update without validation. Internal use only',
42
+ required: false,
43
+ }),
39
44
  suffix: core_1.Flags.string({
40
45
  description: 'Append a sub-route to the entity endpoint (e.g. --suffix=synchronous targets /<entities>/synchronous)',
41
46
  required: false,
@@ -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, apiVersion, } = 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')) {
@@ -96,6 +101,7 @@ class UpdateEntity extends basecommand_1.BaseCommand {
96
101
  skipHydrateRelationships,
97
102
  suffix,
98
103
  apiVersion: apiVersion,
104
+ force,
99
105
  });
100
106
  }
101
107
  try {
@@ -136,7 +142,7 @@ function summarizeSettledUpdates(inputs, settled, skipped) {
136
142
  exports.summarizeSettledUpdates = summarizeSettledUpdates;
137
143
  async function updateEntityById(entityName, id, changes, options = {}) {
138
144
  const client = new sdk_1.Entities();
139
- const { skipHydrateRelationships, suffix, apiVersion } = options;
145
+ const { skipHydrateRelationships, suffix, apiVersion, force } = options;
140
146
  return client.update({
141
147
  entityName,
142
148
  id,
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.6.0-alpha-8-alpha.828359d",
2
+ "version": "3.6.0-alpha-8-alpha.2a57edb",
3
3
  "commands": {
4
4
  "app:create": {
5
5
  "id": "app:create",
@@ -1089,6 +1089,14 @@
1089
1089
  "required": false,
1090
1090
  "multiple": false
1091
1091
  },
1092
+ "force": {
1093
+ "name": "force",
1094
+ "type": "boolean",
1095
+ "char": "F",
1096
+ "description": "Force update without validation. Internal use only",
1097
+ "required": false,
1098
+ "allowNo": false
1099
+ },
1092
1100
  "suffix": {
1093
1101
  "name": "suffix",
1094
1102
  "type": "option",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/cli",
3
- "version": "3.6.0-alpha-8-alpha.828359d",
3
+ "version": "3.6.0-alpha-8-alpha.2a57edb",
4
4
  "description": "VibeIQ's Contrail Platform CLI.",
5
5
  "bin": {
6
6
  "contrail-cli": "./bin/run",