@contrail/cli 3.3.0-alpha → 3.3.1

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.
Files changed (43) hide show
  1. package/README.md +1 -142
  2. package/dist/api/types.d.ts +0 -35
  3. package/dist/api/types.js +1 -47
  4. package/dist/basecommand.d.ts +1 -3
  5. package/dist/basecommand.js +1 -1
  6. package/dist/commands/app/create.js +15 -0
  7. package/dist/commands/app/init.js +14 -0
  8. package/dist/commands/app/upgrade.js +6 -6
  9. package/dist/common.d.ts +1 -1
  10. package/dist/helpers/app/app-deployer.js +24 -24
  11. package/dist/helpers/app/setup-template.d.ts +2 -0
  12. package/dist/helpers/app/setup-template.js +2 -1
  13. package/dist/helpers/file-helpers.d.ts +0 -1
  14. package/dist/helpers/file-helpers.js +1 -19
  15. package/dist/interfaces.d.ts +2 -9
  16. package/dist/interfaces.js +1 -8
  17. package/dist/templates/typescript/app.yml +1 -0
  18. package/oclif.manifest.json +1 -341
  19. package/package.json +4 -5
  20. package/dist/commands/entities/create.d.ts +0 -37
  21. package/dist/commands/entities/create.js +0 -532
  22. package/dist/commands/entities/create.spec.d.ts +0 -1
  23. package/dist/commands/entities/create.spec.js +0 -514
  24. package/dist/commands/entities/delete.d.ts +0 -16
  25. package/dist/commands/entities/delete.js +0 -103
  26. package/dist/commands/entities/get.d.ts +0 -19
  27. package/dist/commands/entities/get.js +0 -151
  28. package/dist/commands/entities/update.d.ts +0 -17
  29. package/dist/commands/entities/update.js +0 -86
  30. package/dist/helpers/entities/assortment-items.d.ts +0 -10
  31. package/dist/helpers/entities/assortment-items.js +0 -86
  32. package/dist/helpers/entities/batchFetch.d.ts +0 -8
  33. package/dist/helpers/entities/batchFetch.js +0 -41
  34. package/dist/helpers/entities/index.d.ts +0 -3
  35. package/dist/helpers/entities/index.js +0 -6
  36. package/dist/helpers/entities/items.d.ts +0 -10
  37. package/dist/helpers/entities/items.js +0 -84
  38. package/dist/helpers/entities/project-items.d.ts +0 -3
  39. package/dist/helpers/entities/project-items.js +0 -65
  40. package/dist/helpers/propertySpecifications/propertySpecifications.d.ts +0 -26
  41. package/dist/helpers/propertySpecifications/propertySpecifications.js +0 -58
  42. package/dist/helpers/propertySpecifications/propertySpecifications.spec.d.ts +0 -1
  43. package/dist/helpers/propertySpecifications/propertySpecifications.spec.js +0 -266
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.3.0-alpha darwin-arm64 node-v23.5.0
20
+ @contrail/cli/3.3.1 darwin-arm64 node-v20.9.0
21
21
  $ contrail --help [COMMAND]
22
22
  USAGE
23
23
  $ contrail COMMAND
@@ -51,10 +51,6 @@ To get instructions on how to set up autocomplete for your shell, run `contrail
51
51
  * [`contrail config list`](#contrail-config-list)
52
52
  * [`contrail config set`](#contrail-config-set)
53
53
  * [`contrail config use [NAME]`](#contrail-config-use-name)
54
- * [`contrail entities create PATH`](#contrail-entities-create-path)
55
- * [`contrail entities delete ENTITYNAME`](#contrail-entities-delete-entityname)
56
- * [`contrail entities get TYPEPATH`](#contrail-entities-get-typepath)
57
- * [`contrail entities update ENTITYNAME ID`](#contrail-entities-update-entityname-id)
58
54
  * [`contrail file upload FILELOCATION CONTENTTYPE`](#contrail-file-upload-filelocation-contenttype)
59
55
  * [`contrail groups export`](#contrail-groups-export)
60
56
  * [`contrail groups import GROUPSFILE`](#contrail-groups-import-groupsfile)
@@ -539,143 +535,6 @@ EXAMPLES
539
535
  $ contrail config use demo-org
540
536
  ```
541
537
 
542
- ## `contrail entities create PATH`
543
-
544
- (BETA) Create entities
545
-
546
- ```
547
- USAGE
548
- $ contrail entities create PATH [-l error|warn|info|debug] [-e true|false] [-n <value>] [-d] [-i <value>] [-o
549
- <value>] [-p] [-r] [-s]
550
-
551
- ARGUMENTS
552
- PATH Path of the entity type to create
553
-
554
- FLAGS
555
- -d, --dryRun If true, does not create the entity but simulates the creation
556
- -e, --alwaysConfirmEnv=<option> [default: true] The Environment variables
557
- <options: true|false>
558
- -i, --input=<value> A JSON array of objects where each object is one entity to create. Cannot be used
559
- with --count. Unless --precise is specified, any missing values will be populated
560
- with random values.
561
- -l, --logLevel=<option> The Log Level
562
- <options: error|warn|info|debug>
563
- -n, --count=<value> Number of random entities to create
564
- -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
- -r, --readableIds If true, uses readable IDs for the created entities
568
- -s, --skipHydrateRelationships If true, does not hydrate relationships for the created entities
569
-
570
- DESCRIPTION
571
- (BETA) Create entities
572
-
573
- EXAMPLES
574
- $ contrail entities create color -n=10 # creates 10 random colors
575
-
576
- $ contrail entities create color # creates one item
577
-
578
- $ contrail entities create custom-entities:franchise
579
-
580
- $ contrail entities create project-item -n=1 -- projectId=abc # creates 10 project items within project ABC
581
-
582
- $ contrail entities create color -r # creates a random color with a human readable ID
583
-
584
- $ contrail entities create color -d # simulates the creation of a random color without actually creating it
585
-
586
- $ contrail entities create custom-entity:franchise -s # creates a random color and the response does not contain hydrating relationships
587
-
588
- $ contrail entities create color -p -- name=Electric Blue green=1 red=2 blue=3 # creates a color with specified properties
589
-
590
- $ contrail entities create color -o /tmp/colors.json # creates a random color and saves the output to /tmp/colors.json
591
- ```
592
-
593
- ## `contrail entities delete ENTITYNAME`
594
-
595
- (BETA) Delete an entity
596
-
597
- ```
598
- USAGE
599
- $ contrail entities delete ENTITYNAME [-l error|warn|info|debug] [-e true|false] [-d] [-i <value>] [--id <value>]
600
-
601
- ARGUMENTS
602
- ENTITYNAME The name of the entity type to delete
603
-
604
- FLAGS
605
- -d, --dryRun If true, does not delete the entity but simulates the deletion
606
- -e, --alwaysConfirmEnv=<option> [default: true] The Environment variables
607
- <options: true|false>
608
- -i, --input=<value> A JSON array of objects where each object is one entity to create. Cannot be used
609
- with --count. Unless --precise is specified, any missing values will be populated
610
- with random values.
611
- -l, --logLevel=<option> The Log Level
612
- <options: error|warn|info|debug>
613
- --id=<value> The unique identifier of the entity
614
-
615
- DESCRIPTION
616
- (BETA) Delete an entity
617
-
618
- EXAMPLES
619
- $ contrail entities delete color 123
620
- ```
621
-
622
- ## `contrail entities get TYPEPATH`
623
-
624
- (BETA) Get an entity
625
-
626
- ```
627
- USAGE
628
- $ contrail entities get TYPEPATH [-l error|warn|info|debug] [-e true|false] [-o <value>] [-s] [-r <value>] [-p
629
- <value>] [-P]
630
-
631
- ARGUMENTS
632
- TYPEPATH The name of the entity type to fetch
633
-
634
- FLAGS
635
- -P, --paginated If true, fetches all entities in a paginated manner
636
- -e, --alwaysConfirmEnv=<option> [default: true] The Environment variables
637
- <options: true|false>
638
- -l, --logLevel=<option> The Log Level
639
- <options: error|warn|info|debug>
640
- -o, --outputFile=<value> File to save the output (optional)
641
- -p, --propertySlugs=<value> Comma-separated list of property slugs to include in the output
642
- -r, --relations=<value> Comma-separated list of relations to include in the output
643
- -s, --skipHydrateRelationships Skip hydrating relationships when fetching the entity
644
-
645
- DESCRIPTION
646
- (BETA) Get an entity
647
-
648
- EXAMPLES
649
- $ contrail entities get color -- id=123
650
- ```
651
-
652
- ## `contrail entities update ENTITYNAME ID`
653
-
654
- (BETA) Update an entity
655
-
656
- ```
657
- USAGE
658
- $ contrail entities update ENTITYNAME ID [-l error|warn|info|debug] [-e true|false] [-s] [-d]
659
-
660
- ARGUMENTS
661
- ENTITYNAME The name of the entity type to update
662
- ID The unique identifier of the entity
663
-
664
- FLAGS
665
- -d, --dryRun If true, does not create the entity but simulates the creation
666
- -e, --alwaysConfirmEnv=<option> [default: true] The Environment variables
667
- <options: true|false>
668
- -l, --logLevel=<option> The Log Level
669
- <options: error|warn|info|debug>
670
- -s, --skipHydrateRelationships Skip hydrating relationships when updating the entity
671
-
672
- DESCRIPTION
673
- (BETA) Update an entity
674
-
675
- EXAMPLES
676
- $ contrail entities update color 123 -- name=obsidian hex=000000
677
- ```
678
-
679
538
  ## `contrail file upload FILELOCATION CONTENTTYPE`
680
539
 
681
540
  Uploads a file to the VibeIQ platform
@@ -1,5 +1,3 @@
1
- import { TypeProperty as SDKTypeProperty } from '@contrail/types';
2
- import { PropertyLevel, PropertyType, Type } from '@contrail/types';
3
1
  export declare function getOptionSets(): Promise<any[]>;
4
2
  export declare function getUserLists(): Promise<any[]>;
5
3
  export declare function getOptionSetHierarchies(): Promise<any[]>;
@@ -11,36 +9,3 @@ export declare function getTypePropertyPolicies(): Promise<any[]>;
11
9
  export declare function getTypePropertyPolicyLinks(): Promise<any[]>;
12
10
  export declare function getTypePolicies(): Promise<any[]>;
13
11
  export declare function getTypePolicyLinks(): Promise<any[]>;
14
- type ColonDelimitedHelper<S extends string> = S extends `${infer Head}:${infer Tail}` ? `${Head}:${ColonDelimitedHelper<Tail>}` : S;
15
- export type ColonDelimited = ColonDelimitedHelper<string>;
16
- export type TypeWithProperties = Type & {
17
- typeProperties: TypeProperty[];
18
- };
19
- export interface Option {
20
- value: string;
21
- display: string;
22
- disabled?: boolean;
23
- }
24
- export interface TypeProperty extends SDKTypeProperty {
25
- propertyType?: PropertyType;
26
- referencedTypePath?: string;
27
- referencedTypeRootSlug?: string;
28
- propertyLevel?: PropertyLevel;
29
- }
30
- export interface TypePropertyOptionSet {
31
- id?: string;
32
- orgId?: string;
33
- name: string;
34
- slug: string;
35
- optionSet: Option[];
36
- isArchived?: boolean;
37
- }
38
- export type TypeReferencesCacheByPath = Map<string, TypeWithProperties>;
39
- export declare function getTypeByPath(path: ColonDelimited): Promise<TypeWithProperties>;
40
- export declare function buildLocalTypesCache(paths: ColonDelimited[]): Promise<TypeReferencesCacheByPath>;
41
- export declare function parseTypePath(path: ColonDelimited): {
42
- root: string;
43
- path: string;
44
- };
45
- export declare function getReferencedTypePaths(type: TypeWithProperties): ColonDelimited[];
46
- export {};
package/dist/api/types.js CHANGED
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getReferencedTypePaths = exports.parseTypePath = exports.buildLocalTypesCache = exports.getTypeByPath = exports.getTypePolicyLinks = exports.getTypePolicies = exports.getTypePropertyPolicyLinks = exports.getTypePropertyPolicies = exports.getUsageInfo = exports.getRuleSetLinks = exports.getRuleSets = exports.getOptionSetHierarchyLinks = exports.getOptionSetHierarchies = exports.getUserLists = exports.getOptionSets = void 0;
3
+ exports.getTypePolicyLinks = exports.getTypePolicies = exports.getTypePropertyPolicyLinks = exports.getTypePropertyPolicies = exports.getUsageInfo = exports.getRuleSetLinks = exports.getRuleSets = exports.getOptionSetHierarchyLinks = exports.getOptionSetHierarchies = exports.getUserLists = exports.getOptionSets = void 0;
4
4
  const sdk_1 = require("@contrail/sdk");
5
- const types_1 = require("@contrail/types");
6
5
  async function getOptionSets() {
7
6
  return await new sdk_1.Entities().get({
8
7
  entityName: 'type-property-option-set',
@@ -78,48 +77,3 @@ async function getTypePolicyLinks() {
78
77
  });
79
78
  }
80
79
  exports.getTypePolicyLinks = getTypePolicyLinks;
81
- const TYPES_CACHE_BY_PATH = new Map();
82
- async function fetchTypeByPath(path) {
83
- const { root } = parseTypePath(path);
84
- const client = new sdk_1.Entities();
85
- const type = await client.get({
86
- entityName: 'type',
87
- suffix: `roots/${root}/path/${path}`,
88
- relations: ['typeProperties'],
89
- });
90
- return type;
91
- }
92
- async function getTypeByPath(path) {
93
- if (TYPES_CACHE_BY_PATH.has(path)) {
94
- return TYPES_CACHE_BY_PATH.get(path);
95
- }
96
- const type = await fetchTypeByPath(path);
97
- TYPES_CACHE_BY_PATH.set(path, type);
98
- return type;
99
- }
100
- exports.getTypeByPath = getTypeByPath;
101
- async function buildLocalTypesCache(paths) {
102
- const types = await Promise.all(paths.map((path) => getTypeByPath(path)));
103
- const newCache = types.reduce((acc, type) => {
104
- acc.set(type.typePath, type);
105
- return acc;
106
- }, new Map());
107
- return newCache;
108
- }
109
- exports.buildLocalTypesCache = buildLocalTypesCache;
110
- function parseTypePath(path) {
111
- const parts = path.split(':').filter(Boolean);
112
- if (parts.length === 0) {
113
- throw new Error('Path cannot be empty');
114
- }
115
- const root = parts[0];
116
- return { root, path };
117
- }
118
- exports.parseTypePath = parseTypePath;
119
- function getReferencedTypePaths(type) {
120
- const properties = type.typeProperties || [];
121
- return properties
122
- .filter((prop) => prop.propertyType === types_1.PropertyType.TypeReference)
123
- .map(({ referencedTypePath }) => referencedTypePath);
124
- }
125
- exports.getReferencedTypePaths = getReferencedTypePaths;
@@ -8,9 +8,7 @@ export declare abstract class BaseCommand extends Command {
8
8
  logLevel: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
9
  };
10
10
  protected flags: any;
11
- protected args: {
12
- [key: string]: any;
13
- };
11
+ protected args: any;
14
12
  init(): Promise<void>;
15
13
  setLogLevel(logLevel: string, config?: any): void;
16
14
  private confirmEnv;
@@ -17,7 +17,7 @@ class BaseCommand extends core_1.Command {
17
17
  ...baseFlags_1.baseFlags,
18
18
  };
19
19
  flags;
20
- args = {};
20
+ args;
21
21
  async init() {
22
22
  await super.init();
23
23
  if (!this.ctor?.flags)
@@ -9,6 +9,7 @@ const setup_template_1 = require("../../helpers/app/setup-template");
9
9
  const logger_1 = tslib_1.__importDefault(require("../../logger"));
10
10
  const app_deployer_1 = require("../../helpers/app/app-deployer");
11
11
  const load_app_config_1 = require("../../helpers/app/load-app-config");
12
+ const entity_types_1 = require("@contrail/entity-types");
12
13
  class CreateApp extends basecommand_1.BaseCommand {
13
14
  static description = 'Create a new app. The current organization will be set as the owner of the app';
14
15
  static examples = [
@@ -26,6 +27,7 @@ class CreateApp extends basecommand_1.BaseCommand {
26
27
  const defaultAppIdentifier = `@${username}/hello-world`;
27
28
  const defaultAppDescription = `Hello world app by ${currentUser.email}`;
28
29
  const defaultAppPublisher = `${currentUser.email}`;
30
+ const defaultNodeRuntime = entity_types_1.NodeRuntime.NODEJS_22_X;
29
31
  const answers = await inquirer_1.default.prompt([
30
32
  {
31
33
  type: 'input',
@@ -55,6 +57,17 @@ class CreateApp extends basecommand_1.BaseCommand {
55
57
  default: defaultAppPublisher,
56
58
  required: true,
57
59
  },
60
+ {
61
+ type: 'list',
62
+ name: 'nodeRuntime',
63
+ message: 'Select the Node.js runtime for your app:',
64
+ choices: [
65
+ { name: 'Node.js 22.x (recommended)', value: entity_types_1.NodeRuntime.NODEJS_22_X },
66
+ { name: 'Node.js 18.x (deprecated)', value: entity_types_1.NodeRuntime.NODEJS_18_X },
67
+ ],
68
+ default: defaultNodeRuntime,
69
+ required: true,
70
+ },
58
71
  ]);
59
72
  let sanitizedIdentifier = answers.appIdentifier;
60
73
  if (!sanitizedIdentifier.startsWith('@')) {
@@ -68,6 +81,7 @@ class CreateApp extends basecommand_1.BaseCommand {
68
81
  public: false,
69
82
  description: answers.appDescription,
70
83
  frameworkVersion: 2,
84
+ nodeRuntime: answers.nodeRuntime,
71
85
  };
72
86
  try {
73
87
  await new sdk_1.Entities().create({ entityName: 'app', object: newApp });
@@ -81,6 +95,7 @@ class CreateApp extends basecommand_1.BaseCommand {
81
95
  appIdentifier: sanitizedIdentifier,
82
96
  appDescription: answers.appDescription,
83
97
  appPublisher: answers.appPublisher,
98
+ nodeRuntime: answers.nodeRuntime,
84
99
  });
85
100
  try {
86
101
  let appDeclaration = (0, load_app_config_1.loadAppConfig)();
@@ -6,6 +6,7 @@ const login_1 = require("../../auth/login");
6
6
  const basecommand_1 = require("../../basecommand");
7
7
  const setup_template_1 = require("../../helpers/app/setup-template");
8
8
  const sdk_1 = require("@contrail/sdk");
9
+ const entity_types_1 = require("@contrail/entity-types");
9
10
  class InitApp extends basecommand_1.BaseCommand {
10
11
  static description = 'Initialize an app directory from a template';
11
12
  static examples = [
@@ -23,6 +24,7 @@ class InitApp extends basecommand_1.BaseCommand {
23
24
  const defaultAppIdentifier = `@${username}/hello-world`;
24
25
  const defaultAppDescription = `Hello world app by ${currentUser.email}`;
25
26
  const defaultAppPublisher = `${currentUser.email}`;
27
+ const defaultNodeRuntime = entity_types_1.NodeRuntime.NODEJS_22_X;
26
28
  const answers = await inquirer_1.default.prompt([
27
29
  {
28
30
  type: 'input',
@@ -52,6 +54,17 @@ class InitApp extends basecommand_1.BaseCommand {
52
54
  default: defaultAppPublisher,
53
55
  required: true,
54
56
  },
57
+ {
58
+ type: 'list',
59
+ name: 'nodeRuntime',
60
+ message: 'Select the Node.js runtime for your app:',
61
+ choices: [
62
+ { name: 'Node.js 22.x (recommended)', value: entity_types_1.NodeRuntime.NODEJS_22_X },
63
+ { name: 'Node.js 18.x (deprecated)', value: entity_types_1.NodeRuntime.NODEJS_18_X },
64
+ ],
65
+ default: defaultNodeRuntime,
66
+ required: true,
67
+ },
55
68
  ]);
56
69
  let sanitizedIdentifier = answers.appIdentifier;
57
70
  if (!sanitizedIdentifier.startsWith('@')) {
@@ -62,6 +75,7 @@ class InitApp extends basecommand_1.BaseCommand {
62
75
  appIdentifier: sanitizedIdentifier,
63
76
  appDescription: answers.appDescription,
64
77
  appPublisher: answers.appPublisher,
78
+ nodeRuntime: answers.nodeRuntime,
65
79
  });
66
80
  }
67
81
  }
@@ -64,13 +64,13 @@ class UpgradeApp extends basecommand_1.BaseCommand {
64
64
  name: 'appVersion',
65
65
  message: 'Which app version would you like to upgrade to?',
66
66
  choices: versions
67
- .map((x) => {
68
- const number = x.semver;
69
- const name = x.id === appOrgToUpgrade.appVersionId
70
- ? `${number} - ${x.id} (${x.createdOn}) (${x.appRuntime}) (current)`
71
- : `${number} - ${x.id} (${x.createdOn}) (${x.appRuntime})`;
67
+ .map((version) => {
68
+ const number = version.semver;
69
+ const name = version.id === appOrgToUpgrade.appVersionId
70
+ ? `${number} - ${version.id} (${version.createdOn}) (current)`
71
+ : `${number} - ${version.id} (${version.createdOn})`;
72
72
  return {
73
- value: x.id,
73
+ value: version.id,
74
74
  name,
75
75
  };
76
76
  })
package/dist/common.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  /// <reference types="node" />
2
2
  export declare function getSeparatorByPlatform(): string;
3
3
  export declare function delay(ms: number): Promise<NodeJS.Timeout>;
4
- export declare function removeSlash(string: string): string;
4
+ export declare function removeSlash(string: any): string;
@@ -58,9 +58,11 @@ class AppDeployer {
58
58
  if (appDeclaration?.triggers) {
59
59
  triggerKeyDefinitions = app_template_parsers_1.TriggerKeyDefinitionParser.buildTriggersArray(appDeclaration);
60
60
  }
61
- let accessGrants = [];
62
- if (appDeclaration?.accessGrants) {
63
- accessGrants = await app_template_parsers_1.AccessGrantsParser.buildAccessGrants(appDeclaration);
61
+ const accessGrants = appDeclaration.accessGrants
62
+ ? await app_template_parsers_1.AccessGrantsParser.buildAccessGrants(appDeclaration)
63
+ : [];
64
+ if ('dockerImageRef' in appDeclaration) {
65
+ throw new Error('Docker apps are no longer supported. Please use a node app.');
64
66
  }
65
67
  const newApp = {
66
68
  identifier: appDeclaration.appIdentifier,
@@ -76,8 +78,8 @@ class AppDeployer {
76
78
  configProperties,
77
79
  externalLinks,
78
80
  triggerKeyDefinitions,
79
- dockerImageRef: appDeclaration.dockerImageRef ?? null,
80
81
  frameworkVersion: 2,
82
+ nodeRuntime: appDeclaration.nodeRuntime,
81
83
  };
82
84
  if (this.dryRun) {
83
85
  logger_1.default.info('Dry run, not creating app');
@@ -85,14 +87,11 @@ class AppDeployer {
85
87
  }
86
88
  let app = await new sdk_1.Entities().create({ entityName: 'app', object: newApp });
87
89
  logger_1.default.info(`${chalk_1.default.yellow.bold('APP')} Created new app: ${app.name}`);
88
- const isDocker = Object.hasOwnProperty.call(appDeclaration, 'dockerImageRef');
89
- if (!isDocker) {
90
- // this is the expected default behavior
91
- const appCodePackage = await createNodePackage(appDeclaration.appIdentifier, this.debug, this.dryRun);
92
- app.appCodePackageId = appCodePackage.id;
93
- app = await new sdk_1.Entities().update({ entityName: 'app', id: app.id, object: app });
94
- logger_1.default.info(`${chalk_1.default.yellow.bold('APP')} Updated app with code package: ${app.name}`);
95
- }
90
+ // this is the expected default behavior
91
+ const appCodePackage = await createNodePackage(appDeclaration.appIdentifier, this.debug, this.dryRun);
92
+ app.appCodePackageId = appCodePackage.id;
93
+ app = await new sdk_1.Entities().update({ entityName: 'app', id: app.id, object: app });
94
+ logger_1.default.info(`${chalk_1.default.yellow.bold('APP')} Updated app with code package: ${app.name}`);
96
95
  return app;
97
96
  }
98
97
  async updateExistingApp(appDeclaration, existingApp) {
@@ -108,14 +107,12 @@ class AppDeployer {
108
107
  if (appDeclaration?.accessGrants) {
109
108
  accessGrants = await app_template_parsers_1.AccessGrantsParser.buildAccessGrants(appDeclaration);
110
109
  }
111
- // does appDeclaration have dockerImageRef
112
- const isDocker = Object.hasOwnProperty.call(appDeclaration, 'dockerImageRef');
113
- let appCodePackageId;
114
- if (!isDocker) {
115
- // this is the expected default behavior
116
- const appCodePackage = await createNodePackage(appDeclaration.appIdentifier, this.debug, this.dryRun);
117
- appCodePackageId = appCodePackage.id;
110
+ // eslint-disable-next-line no-prototype-builtins
111
+ if (appDeclaration.hasOwnProperty('dockerImageRef')) {
112
+ throw new Error('Docker apps are no longer supported. Please use a node app.');
118
113
  }
114
+ const appCodePackage = await createNodePackage(appDeclaration.appIdentifier, this.debug, this.dryRun);
115
+ const appCodePackageId = appCodePackage.id;
119
116
  const externalLinks = appDeclaration.externalLinks
120
117
  ? app_template_parsers_1.ExternalLinkParser.validateAndGetExternalLinks(appDeclaration.externalLinks)
121
118
  : [];
@@ -132,9 +129,9 @@ class AppDeployer {
132
129
  configProperties,
133
130
  externalLinks,
134
131
  triggerKeyDefinitions,
135
- dockerImageRef: appDeclaration.dockerImageRef ?? null,
136
132
  appCodePackageId: appCodePackageId ?? null,
137
133
  frameworkVersion: 2,
134
+ nodeRuntime: appDeclaration.nodeRuntime,
138
135
  };
139
136
  logger_1.default.debug(`app update: ${JSON.stringify(updates, null, 2)}`);
140
137
  if (this.dryRun) {
@@ -205,7 +202,11 @@ async function createNodePackage(appIdentifier, debug, dryRun) {
205
202
  logger_1.default.info('Installing production dependencies done.');
206
203
  logger_1.default.info('Building package...');
207
204
  try {
208
- child_process_1.default.execSync('npx tsc --outDir tmp/dist');
205
+ // Check for tsconfig.build.json first, fallback to tsconfig.json
206
+ const buildConfigPath = fs_1.default.existsSync('tsconfig.build.json')
207
+ ? 'tsconfig.build.json'
208
+ : 'tsconfig.json';
209
+ child_process_1.default.execSync(`npx tsc --project ${buildConfigPath} --outDir tmp/dist`);
209
210
  }
210
211
  catch (e) {
211
212
  logger_1.default.error(`${chalk_1.default.red.bold('APP')} Failed to build package.`);
@@ -232,7 +233,7 @@ async function createNodePackage(appIdentifier, debug, dryRun) {
232
233
  return {};
233
234
  }
234
235
  logger_1.default.info('Uploading package to S3...');
235
- let apps = await entitiesClient.get({ entityName: 'app' });
236
+ const apps = await entitiesClient.get({ entityName: 'app' });
236
237
  const thisApp = apps.find((x) => x.identifier === appIdentifier);
237
238
  if (!thisApp) {
238
239
  throw new Error('App not found');
@@ -242,8 +243,7 @@ async function createNodePackage(appIdentifier, debug, dryRun) {
242
243
  object: { appId: thisApp.id },
243
244
  });
244
245
  // upload an s3 object using a signed url with an https put request
245
- const readStream = fs_1.default.readFileSync('tmp.zip');
246
- const postBody = Buffer.from(readStream);
246
+ const postBody = fs_1.default.readFileSync('tmp.zip');
247
247
  // await axios.put(uploadUrlObject.signedUrl, postBody.toString());
248
248
  await axios_1.default.request({
249
249
  method: 'PUT',
@@ -1,8 +1,10 @@
1
+ import { NodeRuntime } from '@contrail/entity-types';
1
2
  interface AppSetUpInputs {
2
3
  appName: string;
3
4
  appIdentifier: string;
4
5
  appDescription: string;
5
6
  appPublisher: string;
7
+ nodeRuntime: NodeRuntime;
6
8
  }
7
9
  export declare function setUpTemplate(appInput: AppSetUpInputs): Promise<void>;
8
10
  export {};
@@ -38,7 +38,8 @@ async function setUpTemplate(appInput) {
38
38
  .replace(/APP_IDENTIFIER_STUB/g, appInput.appIdentifier)
39
39
  .replace(/APP_NAME_STUB/g, appInput.appName)
40
40
  .replace(/APP_DESCRIPTION_STUB/g, appInput.appDescription)
41
- .replace(/APP_PUBLISHER_STUB/g, appInput.appPublisher);
41
+ .replace(/APP_PUBLISHER_STUB/g, appInput.appPublisher)
42
+ .replace(/NODE_RUNTIME_STUB/g, appInput.nodeRuntime);
42
43
  fs_1.default.writeFileSync(appYmlFileLoc, newAppYml);
43
44
  }
44
45
  catch (e) {
@@ -1,3 +1,2 @@
1
1
  export declare function safeFileOverwrite(fileLocation: string, overwrite: boolean): Promise<boolean>;
2
2
  export declare function parseCSVData(data: string): any;
3
- export declare function parseFileAsJsonArray(fileName: string): any[];
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseFileAsJsonArray = exports.parseCSVData = exports.safeFileOverwrite = void 0;
3
+ exports.parseCSVData = exports.safeFileOverwrite = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const fs_1 = tslib_1.__importDefault(require("fs"));
6
5
  const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
7
6
  const logger_1 = tslib_1.__importDefault(require("../logger"));
8
7
  const sync_1 = require("csv-parse/sync");
@@ -35,20 +34,3 @@ function parseCSVData(data) {
35
34
  });
36
35
  }
37
36
  exports.parseCSVData = parseCSVData;
38
- function parseFileAsJsonArray(fileName) {
39
- if (!fs_1.default.existsSync(fileName)) {
40
- throw new Error(`File not found: ${fileName}`);
41
- }
42
- const fileContent = fs_1.default.readFileSync(fileName, 'utf-8');
43
- try {
44
- const jsonArray = JSON.parse(fileContent);
45
- if (!Array.isArray(jsonArray)) {
46
- throw new Error(`File content is not a valid JSON array: ${fileName}`);
47
- }
48
- return jsonArray;
49
- }
50
- catch (error) {
51
- throw new Error(`Error parsing JSON from file ${fileName}: ${error.message}`);
52
- }
53
- }
54
- exports.parseFileAsJsonArray = parseFileAsJsonArray;
@@ -1,4 +1,4 @@
1
- import { AppExtensionType, AppExtensionUserApps } from '@contrail/entity-types';
1
+ import { AppExtensionType, AppExtensionUserApps, NodeRuntime } from '@contrail/entity-types';
2
2
  import { ExternalLink } from '@contrail/entity-types';
3
3
  /** Describes the derivative JSON / object represented
4
4
  * in app.yml file.
@@ -26,7 +26,7 @@ export interface AppDeclaration {
26
26
  workflows?: {
27
27
  [key: string]: WorkflowDefinition | WorkflowTemplateDeclaration;
28
28
  };
29
- dockerImageRef?: string;
29
+ nodeRuntime?: NodeRuntime;
30
30
  }
31
31
  export interface AccessGrantConfiguration {
32
32
  orgSlug: string;
@@ -149,7 +149,6 @@ export interface App {
149
149
  configProperties?: ConfigProperty[];
150
150
  triggerKeyDefinitions?: TriggerKeyDefinition[];
151
151
  latestAppVersionId?: string;
152
- appRuntime?: AppRuntime;
153
152
  }
154
153
  export interface AppOrg {
155
154
  id: string;
@@ -195,10 +194,6 @@ export declare enum AppVersionStatus {
195
194
  FAILED_ARCHIVING = "FAILED_ARCHIVING",
196
195
  ARCHIVED = "ARCHIVED"
197
196
  }
198
- export declare enum AppRuntime {
199
- DOCKER = "DOCKER",
200
- NODE = "NODE"
201
- }
202
197
  export declare class AppVersion {
203
198
  id: string;
204
199
  createdOn?: Date;
@@ -217,8 +212,6 @@ export declare class AppVersion {
217
212
  eventWorkflowTriggerKeyMapping: string;
218
213
  configProperties?: ConfigProperty[];
219
214
  triggerKeyDefinitions?: TriggerKeyDefinition[];
220
- dockerImageRef?: string;
221
- appRuntime?: AppRuntime;
222
215
  }
223
216
  export declare class AppApiKey {
224
217
  id: string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AppExtensionPackageStatus = exports.AppExtensionDeploymentStatus = exports.AssortmentConfigurationRelationships = exports.AssortmentConfigurationSlim = exports.FolderSlim = exports.ProjectConfigurationTemplate = exports.ProjectConfiguration = exports.Folder = exports.AssortmentConfiguration = exports.AssortmentType = exports.CommonConfiguration = exports.TriggerKeyDefinition = exports.ConfigProperty = exports.AppApiKey = exports.AppVersion = exports.AppRuntime = exports.AppVersionStatus = exports.AppOrgStatus = exports.AppAccessPermission = exports.AppAccessGrantScope = void 0;
3
+ exports.AppExtensionPackageStatus = exports.AppExtensionDeploymentStatus = exports.AssortmentConfigurationRelationships = exports.AssortmentConfigurationSlim = exports.FolderSlim = exports.ProjectConfigurationTemplate = exports.ProjectConfiguration = exports.Folder = exports.AssortmentConfiguration = exports.AssortmentType = exports.CommonConfiguration = exports.TriggerKeyDefinition = exports.ConfigProperty = exports.AppApiKey = exports.AppVersion = exports.AppVersionStatus = exports.AppOrgStatus = exports.AppAccessPermission = exports.AppAccessGrantScope = void 0;
4
4
  var AppAccessGrantScope;
5
5
  (function (AppAccessGrantScope) {
6
6
  AppAccessGrantScope["install"] = "INSTALL";
@@ -26,11 +26,6 @@ var AppVersionStatus;
26
26
  AppVersionStatus["FAILED_ARCHIVING"] = "FAILED_ARCHIVING";
27
27
  AppVersionStatus["ARCHIVED"] = "ARCHIVED";
28
28
  })(AppVersionStatus = exports.AppVersionStatus || (exports.AppVersionStatus = {}));
29
- var AppRuntime;
30
- (function (AppRuntime) {
31
- AppRuntime["DOCKER"] = "DOCKER";
32
- AppRuntime["NODE"] = "NODE";
33
- })(AppRuntime = exports.AppRuntime || (exports.AppRuntime = {}));
34
29
  class AppVersion {
35
30
  id;
36
31
  createdOn;
@@ -49,8 +44,6 @@ class AppVersion {
49
44
  eventWorkflowTriggerKeyMapping;
50
45
  configProperties;
51
46
  triggerKeyDefinitions;
52
- dockerImageRef;
53
- appRuntime;
54
47
  }
55
48
  exports.AppVersion = AppVersion;
56
49
  class AppApiKey {
@@ -1,6 +1,7 @@
1
1
  appIdentifier: 'APP_IDENTIFIER_STUB' # Change to be your company root domain and the name of the app
2
2
  appName: 'APP_NAME_STUB' # Give your app a name
3
3
  appDescription: 'APP_DESCRIPTION_STUB' # Give your app a description
4
+ nodeRuntime: 'NODE_RUNTIME_STUB' # The Node.js runtime version to use for your app
4
5
  visibility: private # This should be private unless you want to develop an app for all VibeIQ customers to use
5
6
  # Access Grants
6
7
  # Use this section to share this app with other organizations.