@contrail/cli 3.6.0-alpha-6 → 3.6.0-alpha-7

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-6 darwin-arm64 node-v23.5.0
20
+ @contrail/cli/3.6.0-alpha-7 darwin-arm64 node-v22.19.0
21
21
  $ contrail --help [COMMAND]
22
22
  USAGE
23
23
  $ contrail COMMAND
@@ -546,7 +546,7 @@ EXAMPLES
546
546
  ```
547
547
  USAGE
548
548
  $ contrail entities create PATH [-l error|warn|info|debug] [-e true|false] [-n <value>] [-d] [-i <value>] [-o
549
- <value>] [-p] [-r] [-s]
549
+ <value>] [-g] [-r] [-s]
550
550
 
551
551
  ARGUMENTS
552
552
  PATH Path of the entity type to create
@@ -555,15 +555,15 @@ FLAGS
555
555
  -d, --dryRun If true, does not create the entity but simulates the creation
556
556
  -e, --alwaysConfirmEnv=<option> [default: true] The Environment variables
557
557
  <options: true|false>
558
+ -g, --generateValues If true, generates random values for properties that are not specified. By default,
559
+ only specified properties are used.
558
560
  -i, --inputFile=<value> A file with a JSON array of objects where each object is one entity to create. Cannot
559
- be used with --count. Unless --precise is specified, any missing values will be
560
- populated with random values.
561
+ be used with --count. Unless --generate-values is specified, only the properties in
562
+ the file will be used.
561
563
  -l, --logLevel=<option> The Log Level
562
564
  <options: error|warn|info|debug>
563
565
  -n, --count=<value> Number of random entities to create
564
566
  -o, --outputFile=<value> File to save the output (optional)
565
- -p, --preciseProperties If true, does not generate random values for properties. All values must be
566
- specified.
567
567
  -r, --readableIds If true, uses readable IDs for the created entities
568
568
  -s, --skipHydrateRelationships If true, does not hydrate relationships for the created entities
569
569
 
@@ -571,23 +571,23 @@ DESCRIPTION
571
571
  (BETA) Create entities
572
572
 
573
573
  EXAMPLES
574
- $ contrail entities create color -n=10 # creates 10 random colors
574
+ $ contrail entities create color -g -n=10 # creates 10 random colors
575
575
 
576
- $ contrail entities create color # creates one item
576
+ $ contrail entities create color -- name="Electric Blue" green=1 red=2 blue=3 # creates one color with specified properties only
577
577
 
578
578
  $ contrail entities create custom-entities:franchise
579
579
 
580
580
  $ contrail entities create project-item -n=1 -- projectId=abc # creates 10 project items within project ABC
581
581
 
582
- $ contrail entities create color -r # creates a random color with a human readable ID
582
+ $ contrail entities create color -g -r # creates a random color with a human readable ID
583
583
 
584
- $ contrail entities create color -d # simulates the creation of a random color without actually creating it
584
+ $ contrail entities create color -d -- name=test # simulates the creation of a color without actually creating it
585
585
 
586
- $ contrail entities create custom-entity:franchise -s # creates a random color and the response does not contain hydrating relationships
586
+ $ contrail entities create custom-entity:franchise -s # creates an entity and the response does not contain hydrating relationships
587
587
 
588
- $ contrail entities create color -p -- name=Electric Blue green=1 red=2 blue=3 # creates a color with specified properties
588
+ $ contrail entities create color -g -- name=Electric Blue # creates a color with the name specified and other properties auto-generated
589
589
 
590
- $ contrail entities create color -o /tmp/colors.json # creates a random color and saves the output to /tmp/colors.json
590
+ $ contrail entities create color -o /tmp/colors.json -- name=Blue green=1 red=2 blue=3 # creates a color and saves the output to /tmp/colors.json
591
591
  ```
592
592
 
593
593
  ## `contrail entities delete ENTITYNAME`
@@ -11,7 +11,7 @@ export default class CreateEntity extends BaseCommand {
11
11
  dryRun: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
12
12
  inputFile: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
13
13
  outputFile: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
14
- preciseProperties: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
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
17
  alwaysConfirmEnv: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
@@ -18,7 +18,7 @@ const file_helpers_1 = require("../../helpers/file-helpers");
18
18
  let IS_DRY_RUN = false;
19
19
  let SHOULD_USE_READABLE_IDS = false;
20
20
  let SHOULD_SKIP_HYDRATE_RELATIONSHIPS = false;
21
- let SHOULD_ONLY_USE_SPECIFIED_PROPERTIES = false;
21
+ let SHOULD_GENERATE_MISSING_VALUES = false;
22
22
  let NUM_ENTITIES_TO_CREATE = 1; // Default to creating one entity if not specified
23
23
  const getNumEntitiesToCreate = () => NUM_ENTITIES_TO_CREATE; // method to get the latest number in case this changes later
24
24
  const baseValidationMap = {
@@ -146,15 +146,15 @@ const FIND_VALID_VALUE_MAP = {
146
146
  class CreateEntity extends basecommand_1.BaseCommand {
147
147
  static description = '(BETA) Create entities';
148
148
  static examples = [
149
- 'contrail entities create color -n=10 # creates 10 random colors',
150
- 'contrail entities create color # creates one item',
149
+ 'contrail entities create color -g -n=10 # creates 10 random colors',
150
+ 'contrail entities create color -- name="Electric Blue" green=1 red=2 blue=3 # creates one color with specified properties only',
151
151
  'contrail entities create custom-entities:franchise',
152
152
  'contrail entities create project-item -n=1 -- projectId=abc # creates 10 project items within project ABC',
153
- 'contrail entities create color -r # creates a random color with a human readable ID',
154
- 'contrail entities create color -d # simulates the creation of a random color without actually creating it',
155
- 'contrail entities create custom-entity:franchise -s # creates a random color and the response does not contain hydrating relationships',
156
- 'contrail entities create color -p -- name=Electric Blue green=1 red=2 blue=3 # creates a color with specified properties',
157
- 'contrail entities create color -o /tmp/colors.json # creates a random color and saves the output to /tmp/colors.json',
153
+ 'contrail entities create color -g -r # creates a random color with a human readable ID',
154
+ 'contrail entities create color -d -- name=test # simulates the creation of a color without actually creating it',
155
+ 'contrail entities create custom-entity:franchise -s # creates an entity and the response does not contain hydrating relationships',
156
+ 'contrail entities create color -g -- name=Electric Blue # creates a color with the name specified and other properties auto-generated',
157
+ 'contrail entities create color -o /tmp/colors.json -- name=Blue green=1 red=2 blue=3 # creates a color and saves the output to /tmp/colors.json',
158
158
  ];
159
159
  static flags = {
160
160
  ...basecommand_1.BaseCommand.baseFlags,
@@ -171,7 +171,7 @@ class CreateEntity extends basecommand_1.BaseCommand {
171
171
  }),
172
172
  inputFile: core_1.Flags.string({
173
173
  char: 'i',
174
- description: 'A file with a JSON array of objects where each object is one entity to create. Cannot be used with --count. Unless --precise is specified, any missing values will be populated with random values.',
174
+ description: 'A file with a JSON array of objects where each object is one entity to create. Cannot be used with --count. Unless --generate-values is specified, only the properties in the file will be used.',
175
175
  required: false,
176
176
  multiple: false,
177
177
  }),
@@ -181,9 +181,9 @@ class CreateEntity extends basecommand_1.BaseCommand {
181
181
  required: false,
182
182
  multiple: false,
183
183
  }),
184
- preciseProperties: core_1.Flags.boolean({
185
- char: 'p',
186
- description: 'If true, does not generate random values for properties. All values must be specified.',
184
+ generateValues: core_1.Flags.boolean({
185
+ char: 'g',
186
+ description: 'If true, generates random values for properties that are not specified. By default, only specified properties are used.',
187
187
  required: false,
188
188
  default: false,
189
189
  }),
@@ -212,7 +212,7 @@ class CreateEntity extends basecommand_1.BaseCommand {
212
212
  this.log('🚨 This command is in BETA and may change or be removed at any time.');
213
213
  await (0, login_1.authUser)();
214
214
  const { flags, argv, args } = await this.parse(CreateEntity);
215
- const { count, dryRun: isDryRun, inputFile: inputFilename, outputFile: outputFilename, preciseProperties: shouldOnlyUseSpecifiedProperties, readableIds: shouldUseReadableIds, skipHydrateRelationships, } = flags;
215
+ const { count, dryRun: isDryRun, inputFile: inputFilename, outputFile: outputFilename, generateValues: shouldGenerateMissingValues, readableIds: shouldUseReadableIds, skipHydrateRelationships, } = flags;
216
216
  const { path: entityTypePath } = args;
217
217
  // Global flags is a little hacky, but it was easier
218
218
  // and it doesn't see *that* bad because they are only valid
@@ -220,7 +220,7 @@ class CreateEntity extends basecommand_1.BaseCommand {
220
220
  IS_DRY_RUN = isDryRun;
221
221
  SHOULD_USE_READABLE_IDS = shouldUseReadableIds;
222
222
  SHOULD_SKIP_HYDRATE_RELATIONSHIPS = skipHydrateRelationships;
223
- SHOULD_ONLY_USE_SPECIFIED_PROPERTIES = shouldOnlyUseSpecifiedProperties;
223
+ SHOULD_GENERATE_MISSING_VALUES = shouldGenerateMissingValues;
224
224
  const propertySpecificationArgs = argv
225
225
  .slice(1, argv.length)
226
226
  .filter(propertySpecifications_1.isValidPropertySpecification);
@@ -301,9 +301,9 @@ async function buildEntitiesToCreate(entityTypePath, entities, propertySpecifica
301
301
  }));
302
302
  const limit = (0, p_limit_1.default)(30);
303
303
  await Promise.all(populatedEntities.map(async () => limit(() => throwIfEntityIsInvalid)));
304
- // Skip system value generation if -p flag is set (preciseProperties mode)
305
- if (SHOULD_ONLY_USE_SPECIFIED_PROPERTIES) {
306
- console.log('Precise properties mode: skipping system value generation.');
304
+ // Skip system value generation unless -g flag is set (generateValues mode)
305
+ if (!SHOULD_GENERATE_MISSING_VALUES) {
306
+ console.log('Using only specified properties. Use --generate-values to auto-generate missing values.');
307
307
  return populatedEntities;
308
308
  }
309
309
  // Add system values if needed
@@ -333,9 +333,9 @@ async function buildEntitiesToCreate(entityTypePath, entities, propertySpecifica
333
333
  }
334
334
  function createEntityWithPopulatedValues(type, typeReferencesCache, objectReferencesCache, propertySpecificationBySlug) {
335
335
  const roles = propertySpecificationBySlug?.get('roles');
336
- const entity = SHOULD_ONLY_USE_SPECIFIED_PROPERTIES
337
- ? {}
338
- : pickRandomPropertyValues(type, objectReferencesCache, typeReferencesCache, roles);
336
+ const entity = SHOULD_GENERATE_MISSING_VALUES
337
+ ? pickRandomPropertyValues(type, objectReferencesCache, typeReferencesCache, roles)
338
+ : {};
339
339
  // Handle property specifications
340
340
  for (const [propertySlug, specifiedValue] of propertySpecificationBySlug.entries()) {
341
341
  const correspondingProperty = type.typeProperties.find((prop) => getPropertySlug(prop) === propertySlug);
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.6.0-alpha-6",
2
+ "version": "3.6.0-alpha-7",
3
3
  "commands": {
4
4
  "app:create": {
5
5
  "id": "app:create",
@@ -682,15 +682,15 @@
682
682
  "pluginType": "core",
683
683
  "aliases": [],
684
684
  "examples": [
685
- "contrail entities create color -n=10 # creates 10 random colors",
686
- "contrail entities create color # creates one item",
685
+ "contrail entities create color -g -n=10 # creates 10 random colors",
686
+ "contrail entities create color -- name=\"Electric Blue\" green=1 red=2 blue=3 # creates one color with specified properties only",
687
687
  "contrail entities create custom-entities:franchise",
688
688
  "contrail entities create project-item -n=1 -- projectId=abc # creates 10 project items within project ABC",
689
- "contrail entities create color -r # creates a random color with a human readable ID",
690
- "contrail entities create color -d # simulates the creation of a random color without actually creating it",
691
- "contrail entities create custom-entity:franchise -s # creates a random color and the response does not contain hydrating relationships",
692
- "contrail entities create color -p -- name=Electric Blue green=1 red=2 blue=3 # creates a color with specified properties",
693
- "contrail entities create color -o /tmp/colors.json # creates a random color and saves the output to /tmp/colors.json"
689
+ "contrail entities create color -g -r # creates a random color with a human readable ID",
690
+ "contrail entities create color -d -- name=test # simulates the creation of a color without actually creating it",
691
+ "contrail entities create custom-entity:franchise -s # creates an entity and the response does not contain hydrating relationships",
692
+ "contrail entities create color -g -- name=Electric Blue # creates a color with the name specified and other properties auto-generated",
693
+ "contrail entities create color -o /tmp/colors.json -- name=Blue green=1 red=2 blue=3 # creates a color and saves the output to /tmp/colors.json"
694
694
  ],
695
695
  "flags": {
696
696
  "logLevel": {
@@ -740,7 +740,7 @@
740
740
  "name": "inputFile",
741
741
  "type": "option",
742
742
  "char": "i",
743
- "description": "A file with a JSON array of objects where each object is one entity to create. Cannot be used with --count. Unless --precise is specified, any missing values will be populated with random values.",
743
+ "description": "A file with a JSON array of objects where each object is one entity to create. Cannot be used with --count. Unless --generate-values is specified, only the properties in the file will be used.",
744
744
  "required": false,
745
745
  "multiple": false
746
746
  },
@@ -752,11 +752,11 @@
752
752
  "required": false,
753
753
  "multiple": false
754
754
  },
755
- "preciseProperties": {
756
- "name": "preciseProperties",
755
+ "generateValues": {
756
+ "name": "generateValues",
757
757
  "type": "boolean",
758
- "char": "p",
759
- "description": "If true, does not generate random values for properties. All values must be specified.",
758
+ "char": "g",
759
+ "description": "If true, generates random values for properties that are not specified. By default, only specified properties are used.",
760
760
  "required": false,
761
761
  "allowNo": false
762
762
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/cli",
3
- "version": "3.6.0-alpha-6",
3
+ "version": "3.6.0-alpha-7",
4
4
  "description": "VibeIQ's Contrail Platform CLI.",
5
5
  "bin": {
6
6
  "contrail-cli": "./bin/run",