@contrail/cli 3.2.0 → 3.3.0
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 +1 -1
- package/dist/commands/app/create.js +15 -0
- package/dist/commands/app/init.js +14 -0
- package/dist/commands/app/upgrade.js +6 -6
- package/dist/helpers/app/app-deployer.js +16 -20
- package/dist/helpers/app/setup-template.d.ts +2 -0
- package/dist/helpers/app/setup-template.js +2 -1
- package/dist/interfaces.d.ts +2 -9
- package/dist/interfaces.js +1 -8
- package/dist/templates/typescript/app.yml +1 -0
- package/oclif.manifest.json +1 -1
- package/package.json +2 -2
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.
|
|
20
|
+
@contrail/cli/3.3.0 darwin-arm64 node-v21.7.1
|
|
21
21
|
$ contrail --help [COMMAND]
|
|
22
22
|
USAGE
|
|
23
23
|
$ contrail COMMAND
|
|
@@ -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((
|
|
68
|
-
const number =
|
|
69
|
-
const name =
|
|
70
|
-
? `${number} - ${
|
|
71
|
-
: `${number} - ${
|
|
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:
|
|
73
|
+
value: version.id,
|
|
74
74
|
name,
|
|
75
75
|
};
|
|
76
76
|
})
|
|
@@ -58,9 +58,11 @@ class AppDeployer {
|
|
|
58
58
|
if (appDeclaration?.triggers) {
|
|
59
59
|
triggerKeyDefinitions = app_template_parsers_1.TriggerKeyDefinitionParser.buildTriggersArray(appDeclaration);
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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,11 @@ class AppDeployer {
|
|
|
108
107
|
if (appDeclaration?.accessGrants) {
|
|
109
108
|
accessGrants = await app_template_parsers_1.AccessGrantsParser.buildAccessGrants(appDeclaration);
|
|
110
109
|
}
|
|
111
|
-
|
|
112
|
-
|
|
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
|
+
if (appDeclaration.hasOwnProperty('dockerImageRef')) {
|
|
111
|
+
throw new Error('Docker apps are no longer supported. Please use a node app.');
|
|
118
112
|
}
|
|
113
|
+
const appCodePackage = await createNodePackage(appDeclaration.appIdentifier, this.debug, this.dryRun);
|
|
114
|
+
const appCodePackageId = appCodePackage.id;
|
|
119
115
|
const externalLinks = appDeclaration.externalLinks
|
|
120
116
|
? app_template_parsers_1.ExternalLinkParser.validateAndGetExternalLinks(appDeclaration.externalLinks)
|
|
121
117
|
: [];
|
|
@@ -132,9 +128,9 @@ class AppDeployer {
|
|
|
132
128
|
configProperties,
|
|
133
129
|
externalLinks,
|
|
134
130
|
triggerKeyDefinitions,
|
|
135
|
-
dockerImageRef: appDeclaration.dockerImageRef ?? null,
|
|
136
131
|
appCodePackageId: appCodePackageId ?? null,
|
|
137
132
|
frameworkVersion: 2,
|
|
133
|
+
nodeRuntime: appDeclaration.nodeRuntime,
|
|
138
134
|
};
|
|
139
135
|
logger_1.default.debug(`app update: ${JSON.stringify(updates, null, 2)}`);
|
|
140
136
|
if (this.dryRun) {
|
|
@@ -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) {
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -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
|
-
|
|
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;
|
package/dist/interfaces.js
CHANGED
|
@@ -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.
|
|
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.
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrail/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "VibeIQ's Contrail Platform CLI.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"contrail-cli": "./bin/run",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"/oclif.manifest.json"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@contrail/entity-types": "^1.
|
|
25
|
+
"@contrail/entity-types": "^1.3.0",
|
|
26
26
|
"@contrail/org-config-migration": "^1.1.4",
|
|
27
27
|
"@contrail/sdk": "^1.4.6",
|
|
28
28
|
"@contrail/types": "^3.0.48",
|