@contrail/cli 2.1.23 → 2.1.24
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 +173 -65
- package/dist/{commands/basecommand.d.ts → basecommand.d.ts} +4 -0
- package/dist/basecommand.js +74 -0
- package/dist/commands/app/create.d.ts +1 -1
- package/dist/commands/app/create.js +1 -3
- package/dist/commands/app/delete.d.ts +1 -1
- package/dist/commands/app/delete.js +1 -3
- package/dist/commands/app/getApiKey.d.ts +1 -1
- package/dist/commands/app/getApiKey.js +1 -2
- package/dist/commands/app/install.d.ts +1 -1
- package/dist/commands/app/install.js +1 -2
- package/dist/commands/app/publish.d.ts +1 -1
- package/dist/commands/app/publish.js +1 -2
- package/dist/commands/app/uninstall.d.ts +1 -1
- package/dist/commands/app/uninstall.js +1 -2
- package/dist/commands/app/upgrade.d.ts +1 -1
- package/dist/commands/app/upgrade.js +1 -2
- package/dist/commands/colors/deleteAll.d.ts +1 -1
- package/dist/commands/colors/deleteAll.js +1 -3
- package/dist/commands/colors/load.d.ts +1 -1
- package/dist/commands/colors/load.js +1 -3
- package/dist/commands/config/environments/list.d.ts +6 -0
- package/dist/commands/config/environments/list.js +18 -0
- package/dist/commands/config/environments/remove.d.ts +11 -0
- package/dist/commands/config/environments/remove.js +35 -0
- package/dist/commands/config/environments/set.d.ts +11 -0
- package/dist/commands/config/environments/set.js +28 -0
- package/dist/commands/config/list.d.ts +1 -1
- package/dist/commands/config/list.js +1 -3
- package/dist/commands/config/remove.d.ts +1 -1
- package/dist/commands/config/remove.js +1 -2
- package/dist/commands/config/set.d.ts +1 -1
- package/dist/commands/config/set.js +1 -2
- package/dist/commands/groups/export.d.ts +1 -1
- package/dist/commands/groups/export.js +1 -2
- package/dist/commands/groups/upload.d.ts +1 -1
- package/dist/commands/groups/upload.js +2 -3
- package/dist/commands/instance/export.d.ts +1 -1
- package/dist/commands/instance/export.js +1 -2
- package/dist/commands/instance/import.d.ts +1 -1
- package/dist/commands/instance/import.js +1 -2
- package/dist/commands/loader-process/load.d.ts +1 -1
- package/dist/commands/loader-process/load.js +2 -3
- package/dist/commands/loader-process/upload-and-load.d.ts +1 -1
- package/dist/commands/loader-process/upload-and-load.js +2 -3
- package/dist/commands/projects/export.d.ts +1 -1
- package/dist/commands/projects/export.js +2 -3
- package/dist/commands/projects/list.d.ts +1 -1
- package/dist/commands/projects/list.js +1 -3
- package/dist/commands/projects/load.d.ts +1 -1
- package/dist/commands/projects/load.js +2 -3
- package/dist/commands/types/exportOptionSetHierarchies.d.ts +1 -1
- package/dist/commands/types/exportOptionSetHierarchies.js +1 -3
- package/dist/commands/types/getAll.d.ts +1 -1
- package/dist/commands/types/getAll.js +1 -2
- package/dist/commands/types/loadAll.d.ts +1 -1
- package/dist/commands/types/loadAll.js +1 -2
- package/dist/commands/types/mergeOptionSets.d.ts +1 -1
- package/dist/commands/types/mergeOptionSets.js +2 -3
- package/dist/commands/types/mergeTypeProperties.d.ts +1 -1
- package/dist/commands/types/mergeTypeProperties.js +2 -3
- package/dist/commands/types/parseOptionSetsHierarchyLocalFile.d.ts +1 -1
- package/dist/commands/types/parseOptionSetsHierarchyLocalFile.js +37 -21
- package/dist/commands/types/parseOptionSetsHierarchyValuesToKeysLocalFile.d.ts +1 -1
- package/dist/commands/types/parseOptionSetsHierarchyValuesToKeysLocalFile.js +2 -3
- package/dist/commands/types/parseOptionSetsLocalFiles.d.ts +1 -1
- package/dist/commands/types/parseOptionSetsLocalFiles.js +1 -2
- package/dist/commands/types/parseOptionSetsToFolderStructure.d.ts +1 -1
- package/dist/commands/types/parseOptionSetsToFolderStructure.js +2 -3
- package/dist/commands/types/parseTypesFromFiles.d.ts +1 -1
- package/dist/commands/types/parseTypesFromFiles.js +2 -3
- package/dist/commands/types/parseTypesFromLocalFiles.d.ts +1 -1
- package/dist/commands/types/parseTypesFromLocalFiles.js +2 -3
- package/dist/commands/types/parseTypesFromTemplateAndDataFromLocalFiles.d.ts +1 -1
- package/dist/commands/types/parseTypesFromTemplateAndDataFromLocalFiles.js +2 -3
- package/dist/commands/types/parseTypesFromTemplateFromLocalFiles.d.ts +1 -1
- package/dist/commands/types/parseTypesFromTemplateFromLocalFiles.js +2 -3
- package/dist/commands/types/uploadOptionSetHierarchies.d.ts +1 -1
- package/dist/commands/types/uploadOptionSetHierarchies.js +1 -2
- package/dist/commands/types/uploadOptionSets.d.ts +1 -1
- package/dist/commands/types/uploadOptionSets.js +1 -2
- package/dist/commands/types/uploadOptionSetsHierarchyLocalFile.d.ts +1 -1
- package/dist/commands/types/uploadOptionSetsHierarchyLocalFile.js +2 -3
- package/dist/commands/types/uploadRuleSets.d.ts +1 -1
- package/dist/commands/types/uploadRuleSets.js +1 -2
- package/dist/commands/types/uploadTypePolicies.d.ts +1 -1
- package/dist/commands/types/uploadTypePolicies.js +1 -2
- package/dist/commands/types/uploadTypePropertyPolicies.d.ts +1 -1
- package/dist/commands/types/uploadTypePropertyPolicies.js +1 -2
- package/dist/commands/types/uploadTypes.d.ts +1 -1
- package/dist/commands/types/uploadTypes.js +1 -2
- package/dist/commands/types/uploadUsageInfo.d.ts +1 -1
- package/dist/commands/types/uploadUsageInfo.js +1 -2
- package/dist/commands/users/export.d.ts +1 -1
- package/dist/commands/users/export.js +1 -2
- package/dist/commands/users/upload.d.ts +1 -1
- package/dist/commands/users/upload.js +2 -3
- package/dist/commands/webhooks/create.d.ts +1 -1
- package/dist/commands/webhooks/create.js +1 -2
- package/dist/commands/webhooks/delete.d.ts +1 -1
- package/dist/commands/webhooks/delete.js +1 -2
- package/dist/commands/webhooks/getWebhookTrigger.d.ts +1 -1
- package/dist/commands/webhooks/getWebhookTrigger.js +2 -3
- package/dist/commands/webhooks/list.d.ts +1 -1
- package/dist/commands/webhooks/list.js +1 -2
- package/dist/commands/workflow-template-definitions/install.d.ts +1 -1
- package/dist/commands/workflow-template-definitions/install.js +1 -3
- package/dist/commands/workflow-template-definitions/list.d.ts +1 -1
- package/dist/commands/workflow-template-definitions/list.js +1 -3
- package/dist/commands/workflow-templates/delete.d.ts +1 -1
- package/dist/commands/workflow-templates/delete.js +1 -3
- package/dist/commands/workflow-templates/export.d.ts +1 -1
- package/dist/commands/workflow-templates/export.js +1 -2
- package/dist/commands/workflow-templates/list.d.ts +1 -1
- package/dist/commands/workflow-templates/list.js +1 -3
- package/dist/commands/workflow-templates/load.d.ts +1 -1
- package/dist/commands/workflow-templates/load.js +2 -3
- package/dist/helpers/app/app-deployer.js +2 -0
- package/dist/helpers/app/extensions-deployer.d.ts +9 -0
- package/dist/helpers/app/extensions-deployer.js +92 -0
- package/dist/helpers/types/type-uploader.js +20 -16
- package/dist/interfaces.d.ts +10 -0
- package/oclif.manifest.json +565 -26
- package/package.json +4 -4
- package/dist/commands/basecommand.js +0 -29
|
@@ -10,13 +10,12 @@ const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
|
|
|
10
10
|
const core_1 = require("@oclif/core");
|
|
11
11
|
const file_helpers_1 = require("../../helpers/file-helpers");
|
|
12
12
|
const users_1 = require("../../api/users");
|
|
13
|
-
const basecommand_1 = require("
|
|
13
|
+
const basecommand_1 = require("../../basecommand");
|
|
14
14
|
exports.DEFAULT_FILE_LOCATION = 'users.yml';
|
|
15
15
|
class ExportUsers extends basecommand_1.BaseCommand {
|
|
16
16
|
async run() {
|
|
17
17
|
var _a;
|
|
18
18
|
const { flags } = await this.parse(ExportUsers);
|
|
19
|
-
await super.setLogLevel(flags.logLevel);
|
|
20
19
|
try {
|
|
21
20
|
await (0, login_1.authUser)();
|
|
22
21
|
this.log('%s Getting Users.', chalk_1.default.blue.bold('START'));
|
|
@@ -9,11 +9,10 @@ const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
|
9
9
|
const login_1 = require("../../auth/login");
|
|
10
10
|
const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
|
|
11
11
|
const core_1 = require("@oclif/core");
|
|
12
|
-
const basecommand_1 = require("
|
|
12
|
+
const basecommand_1 = require("../../basecommand");
|
|
13
13
|
class ImportUsers extends basecommand_1.BaseCommand {
|
|
14
14
|
async run() {
|
|
15
|
-
const { args
|
|
16
|
-
await super.setLogLevel(flags.logLevel);
|
|
15
|
+
const { args } = await this.parse(ImportUsers);
|
|
17
16
|
try {
|
|
18
17
|
await (0, login_1.authUser)();
|
|
19
18
|
this.log('%s Uploading Users.', chalk_1.default.blue.bold('START'));
|
|
@@ -4,12 +4,11 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
5
|
const login_1 = require("../../auth/login");
|
|
6
6
|
const webhooks_1 = require("../../api/webhooks");
|
|
7
|
-
const basecommand_1 = require("
|
|
7
|
+
const basecommand_1 = require("../../basecommand");
|
|
8
8
|
const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
9
9
|
class CreateWebhooks extends basecommand_1.BaseCommand {
|
|
10
10
|
async run() {
|
|
11
11
|
const { flags } = await this.parse(CreateWebhooks);
|
|
12
|
-
await super.setLogLevel(flags.logLevel);
|
|
13
12
|
await (0, login_1.authUser)();
|
|
14
13
|
const webhook = await (0, webhooks_1.createWebhook)({});
|
|
15
14
|
if (flags.json) {
|
|
@@ -5,12 +5,11 @@ const core_1 = require("@oclif/core");
|
|
|
5
5
|
const login_1 = require("../../auth/login");
|
|
6
6
|
const webhooks_1 = require("../../api/webhooks");
|
|
7
7
|
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
8
|
-
const basecommand_1 = require("
|
|
8
|
+
const basecommand_1 = require("../../basecommand");
|
|
9
9
|
const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
10
10
|
class DeleteWebhooks extends basecommand_1.BaseCommand {
|
|
11
11
|
async run() {
|
|
12
12
|
const { flags, args } = await this.parse(DeleteWebhooks);
|
|
13
|
-
await super.setLogLevel(flags.logLevel);
|
|
14
13
|
await (0, login_1.authUser)();
|
|
15
14
|
const webhooks = await (0, webhooks_1.getWebhooks)();
|
|
16
15
|
const deletedWebhooks = [];
|
|
@@ -5,12 +5,11 @@ const core_1 = require("@oclif/core");
|
|
|
5
5
|
const login_1 = require("../../auth/login");
|
|
6
6
|
const webhooks_1 = require("../../api/webhooks");
|
|
7
7
|
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
8
|
-
const basecommand_1 = require("
|
|
8
|
+
const basecommand_1 = require("../../basecommand");
|
|
9
9
|
const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
10
10
|
class GetWebhookTrigger extends basecommand_1.BaseCommand {
|
|
11
11
|
async run() {
|
|
12
|
-
const { args
|
|
13
|
-
await super.setLogLevel(flags.logLevel);
|
|
12
|
+
const { args } = await this.parse(GetWebhookTrigger);
|
|
14
13
|
await (0, login_1.authUser)();
|
|
15
14
|
const webhooks = await (0, webhooks_1.getWebhooks)();
|
|
16
15
|
if (args.webhookId) {
|
|
@@ -4,12 +4,11 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
5
|
const login_1 = require("../../auth/login");
|
|
6
6
|
const webhooks_1 = require("../../api/webhooks");
|
|
7
|
-
const basecommand_1 = require("
|
|
7
|
+
const basecommand_1 = require("../../basecommand");
|
|
8
8
|
const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
9
9
|
class ListWebhooks extends basecommand_1.BaseCommand {
|
|
10
10
|
async run() {
|
|
11
11
|
const { flags } = await this.parse(ListWebhooks);
|
|
12
|
-
await super.setLogLevel(flags.logLevel);
|
|
13
12
|
await (0, login_1.authUser)();
|
|
14
13
|
const webhooks = await (0, webhooks_1.getWebhooks)();
|
|
15
14
|
if (flags.json) {
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const login_1 = require("../../auth/login");
|
|
4
4
|
const workflow_template_definition_deployer_1 = require("../../helpers/workflow-template-definitions/workflow-template-definition-deployer");
|
|
5
|
-
const basecommand_1 = require("
|
|
5
|
+
const basecommand_1 = require("../../basecommand");
|
|
6
6
|
class InstallWorkflowTemplateDefinitions extends basecommand_1.BaseCommand {
|
|
7
7
|
async run() {
|
|
8
|
-
const { flags } = await this.parse(InstallWorkflowTemplateDefinitions);
|
|
9
|
-
await super.setLogLevel(flags.logLevel);
|
|
10
8
|
await (0, login_1.authUser)();
|
|
11
9
|
await new workflow_template_definition_deployer_1.WorkflowTemplateDefinitionDeployer().cliInstallWorkflowTemplateDefinitions();
|
|
12
10
|
}
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const login_1 = require("../../auth/login");
|
|
4
4
|
const workflow_template_definition_deployer_1 = require("../../helpers/workflow-template-definitions/workflow-template-definition-deployer");
|
|
5
|
-
const basecommand_1 = require("
|
|
5
|
+
const basecommand_1 = require("../../basecommand");
|
|
6
6
|
class ListWorkflowTemplateDefinitions extends basecommand_1.BaseCommand {
|
|
7
7
|
async run() {
|
|
8
|
-
const { flags } = await this.parse(ListWorkflowTemplateDefinitions);
|
|
9
|
-
await super.setLogLevel(flags.logLevel);
|
|
10
8
|
await (0, login_1.authUser)();
|
|
11
9
|
await new workflow_template_definition_deployer_1.WorkflowTemplateDefinitionDeployer().listWorkflowTemplateDefinitions();
|
|
12
10
|
}
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const login_1 = require("../../auth/login");
|
|
4
4
|
const helper_1 = require("../../helpers/workflow-templates/helper");
|
|
5
|
-
const basecommand_1 = require("
|
|
5
|
+
const basecommand_1 = require("../../basecommand");
|
|
6
6
|
class DeleteWorkflowTemplates extends basecommand_1.BaseCommand {
|
|
7
7
|
async run() {
|
|
8
|
-
const { flags } = await this.parse(DeleteWorkflowTemplates);
|
|
9
|
-
await super.setLogLevel(flags.logLevel);
|
|
10
8
|
await (0, login_1.authUser)();
|
|
11
9
|
await new helper_1.WorkflowTemplateDeployer().deleteWorkflowTemplates();
|
|
12
10
|
}
|
|
@@ -12,13 +12,12 @@ const core_1 = require("@oclif/core");
|
|
|
12
12
|
const file_helpers_1 = require("../../helpers/file-helpers");
|
|
13
13
|
const event_workflow_templates_1 = require("../../api/event-workflow-templates");
|
|
14
14
|
const helper_1 = require("../../helpers/workflow-templates/helper");
|
|
15
|
-
const basecommand_1 = require("
|
|
15
|
+
const basecommand_1 = require("../../basecommand");
|
|
16
16
|
exports.DEFAULT_FILE_LOCATION = 'workflows.yml';
|
|
17
17
|
class ExportWorkflows extends basecommand_1.BaseCommand {
|
|
18
18
|
async run() {
|
|
19
19
|
var _a;
|
|
20
20
|
const { flags } = await this.parse(ExportWorkflows);
|
|
21
|
-
await super.setLogLevel(flags.logLevel);
|
|
22
21
|
try {
|
|
23
22
|
await (0, login_1.authUser)();
|
|
24
23
|
this.log('%s Getting Workflows.', chalk_1.default.blue.bold('START'));
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const login_1 = require("../../auth/login");
|
|
4
4
|
const helper_1 = require("../../helpers/workflow-templates/helper");
|
|
5
|
-
const basecommand_1 = require("
|
|
5
|
+
const basecommand_1 = require("../../basecommand");
|
|
6
6
|
class ListWorkflowTemplates extends basecommand_1.BaseCommand {
|
|
7
7
|
async run() {
|
|
8
|
-
const { flags } = await this.parse(ListWorkflowTemplates);
|
|
9
|
-
await super.setLogLevel(flags.logLevel);
|
|
10
8
|
await (0, login_1.authUser)();
|
|
11
9
|
return await new helper_1.WorkflowTemplateDeployer().listExistingWorkflowTemplates();
|
|
12
10
|
}
|
|
@@ -3,11 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
4
|
const login_1 = require("../../auth/login");
|
|
5
5
|
const helper_1 = require("../../helpers/workflow-templates/helper");
|
|
6
|
-
const basecommand_1 = require("
|
|
6
|
+
const basecommand_1 = require("../../basecommand");
|
|
7
7
|
class LoadWorkflowTemplates extends basecommand_1.BaseCommand {
|
|
8
8
|
async run() {
|
|
9
|
-
const { args
|
|
10
|
-
await super.setLogLevel(flags.logLevel);
|
|
9
|
+
const { args } = await this.parse(LoadWorkflowTemplates);
|
|
11
10
|
await (0, login_1.authUser)();
|
|
12
11
|
await (0, helper_1.localDeployWorkflowTemplate)(args.fileLocation);
|
|
13
12
|
}
|
|
@@ -14,6 +14,7 @@ const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
|
14
14
|
const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
15
15
|
const child_process_1 = tslib_1.__importDefault(require("child_process"));
|
|
16
16
|
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
17
|
+
const extensions_deployer_1 = require("./extensions-deployer");
|
|
17
18
|
class AppDeployer {
|
|
18
19
|
constructor(debug = false, dryRun = false) {
|
|
19
20
|
this.debug = debug;
|
|
@@ -35,6 +36,7 @@ class AppDeployer {
|
|
|
35
36
|
return {};
|
|
36
37
|
}
|
|
37
38
|
await new actions_deployer_1.ActionsDeployer().deployActions(appDeclaration, app);
|
|
39
|
+
await new extensions_deployer_1.ExtensionsDeployer().deployExtensions(appDeclaration, app);
|
|
38
40
|
await new workflow_template_definition_deployer_1.WorkflowTemplateDefinitionDeployer().deployWorkflowTemplateDefinitions(appDeclaration, app);
|
|
39
41
|
return app;
|
|
40
42
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AppExtensionDefinition } from '@contrail/entity-types';
|
|
2
|
+
import { App, AppDeclaration, ExtensionDefinitionDeclaration } from '../../interfaces';
|
|
3
|
+
export declare function getExtensionDefinitionsForAppVersion(app: App): Promise<AppExtensionDefinition[]>;
|
|
4
|
+
export declare class ExtensionsDeployer {
|
|
5
|
+
deployExtensions(appDeclaration: AppDeclaration, app: App): Promise<void>;
|
|
6
|
+
deployExtension(extension: ExtensionDefinitionDeclaration, app: App, existingExtensions: Array<any>): Promise<void>;
|
|
7
|
+
private createNewExtensionDefinition;
|
|
8
|
+
private updateActionDefinition;
|
|
9
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExtensionsDeployer = exports.getExtensionDefinitionsForAppVersion = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const sdk_1 = require("@contrail/sdk");
|
|
6
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
|
+
const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
8
|
+
const util_1 = require("@contrail/util");
|
|
9
|
+
async function getExtensionDefinitionsForAppVersion(app) {
|
|
10
|
+
return await new sdk_1.Entities().get({
|
|
11
|
+
entityName: 'app-extension-definition',
|
|
12
|
+
criteria: { appVersionId: `${app.latestAppVersionId}` },
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
exports.getExtensionDefinitionsForAppVersion = getExtensionDefinitionsForAppVersion;
|
|
16
|
+
class ExtensionsDeployer {
|
|
17
|
+
async deployExtensions(appDeclaration, app) {
|
|
18
|
+
var _a;
|
|
19
|
+
// FETCH ALL EXTENSIONS FROM THE API.
|
|
20
|
+
if (!appDeclaration.extensions) {
|
|
21
|
+
logger_1.default.info('%s \tNo extensions found...skipping.', chalk_1.default.yellow.bold('EXTENSION'));
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
// UPSERT / DELETE BASED ON EXTENSION IDENTIFIER
|
|
25
|
+
logger_1.default.info('%s \tDeploying extensions.', chalk_1.default.yellow.bold('EXTENSION'));
|
|
26
|
+
const existingExtensions = await getExtensionDefinitionsForAppVersion(app);
|
|
27
|
+
logger_1.default.debug(appDeclaration.extensions);
|
|
28
|
+
if (appDeclaration.extensions) {
|
|
29
|
+
for (const extension of (_a = appDeclaration === null || appDeclaration === void 0 ? void 0 : appDeclaration.extensions) !== null && _a !== void 0 ? _a : []) {
|
|
30
|
+
await this.deployExtension(extension, app, existingExtensions);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async deployExtension(extension, app, existingExtensions) {
|
|
35
|
+
logger_1.default.info(`%s \tDeploying extension: ${extension === null || extension === void 0 ? void 0 : extension.identifier}`, chalk_1.default.yellow.bold('EXTENSION'));
|
|
36
|
+
const identifier = util_1.AppUtil.createExtensionIdentifier({
|
|
37
|
+
appIdentifier: app.identifier,
|
|
38
|
+
extensionIdentifier: extension.identifier,
|
|
39
|
+
});
|
|
40
|
+
const existingDefinition = existingExtensions.find((ad) => ad.identifier === identifier);
|
|
41
|
+
if (!existingDefinition) {
|
|
42
|
+
await this.createNewExtensionDefinition(extension, app);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
await this.updateActionDefinition(existingDefinition, extension, app);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async createNewExtensionDefinition(extension, app) {
|
|
49
|
+
const newObject = {
|
|
50
|
+
identifier: util_1.AppUtil.createExtensionIdentifier({
|
|
51
|
+
extensionIdentifier: extension === null || extension === void 0 ? void 0 : extension.identifier,
|
|
52
|
+
appIdentifier: app.identifier,
|
|
53
|
+
}),
|
|
54
|
+
name: extension.name,
|
|
55
|
+
appId: app.id,
|
|
56
|
+
appVersionId: app.latestAppVersionId,
|
|
57
|
+
extensionType: extension.extensionType,
|
|
58
|
+
userApps: extension.userApps,
|
|
59
|
+
modalDimensions: extension.modalDimensions,
|
|
60
|
+
iframeUrl: extension.iframeUrl,
|
|
61
|
+
};
|
|
62
|
+
const actionDefinition = await new sdk_1.Entities().create({
|
|
63
|
+
entityName: 'app-extension-definition',
|
|
64
|
+
object: newObject,
|
|
65
|
+
});
|
|
66
|
+
logger_1.default.info(`%s Created new extension definition: ${extension === null || extension === void 0 ? void 0 : extension.identifier}`, chalk_1.default.yellow.bold('APP'));
|
|
67
|
+
return actionDefinition;
|
|
68
|
+
}
|
|
69
|
+
async updateActionDefinition(existingActionDefinition, extension, app) {
|
|
70
|
+
const updates = {
|
|
71
|
+
identifier: util_1.AppUtil.createExtensionIdentifier({
|
|
72
|
+
extensionIdentifier: extension === null || extension === void 0 ? void 0 : extension.identifier,
|
|
73
|
+
appIdentifier: app.identifier,
|
|
74
|
+
}),
|
|
75
|
+
name: extension.name,
|
|
76
|
+
appId: app.id,
|
|
77
|
+
appVersionId: app.latestAppVersionId,
|
|
78
|
+
extensionType: extension.extensionType,
|
|
79
|
+
userApps: extension.userApps,
|
|
80
|
+
modalDimensions: extension.modalDimensions,
|
|
81
|
+
iframeUrl: extension.iframeUrl,
|
|
82
|
+
};
|
|
83
|
+
const extensionDefinition = await new sdk_1.Entities().update({
|
|
84
|
+
entityName: 'app-extension-definition',
|
|
85
|
+
id: existingActionDefinition.id,
|
|
86
|
+
object: updates,
|
|
87
|
+
});
|
|
88
|
+
logger_1.default.info(`%s Updated existing extension definition: ${extensionDefinition.identifier}`, chalk_1.default.yellow.bold('APP'));
|
|
89
|
+
return extensionDefinition;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.ExtensionsDeployer = ExtensionsDeployer;
|
|
@@ -104,6 +104,7 @@ async function uploadReducedTypes(dir) {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
async function uploadReducedTypeProperties(type, currentPropertyTypes, newPropertyTypes) {
|
|
107
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
107
108
|
const currentPropertyTypeBySlug = {};
|
|
108
109
|
for (const currentPropertyType of currentPropertyTypes) {
|
|
109
110
|
currentPropertyTypeBySlug[currentPropertyType.slug] = currentPropertyType;
|
|
@@ -159,22 +160,23 @@ async function uploadReducedTypeProperties(type, currentPropertyTypes, newProper
|
|
|
159
160
|
entityName: 'type-property',
|
|
160
161
|
id: found.id,
|
|
161
162
|
object: {
|
|
162
|
-
isArchived: newPropertyType.isArchived,
|
|
163
|
-
propertyType: newPropertyType.propertyType,
|
|
164
|
-
slug: newPropertyType.slug,
|
|
165
|
-
label: newPropertyType.label,
|
|
166
|
-
editable: newPropertyType.editable,
|
|
167
|
-
searchable: newPropertyType.searchable,
|
|
168
|
-
core: newPropertyType.core,
|
|
169
|
-
typePropertyOptionSetId: optionSetIdByName[newPropertyType.typePropertyOptionSetName],
|
|
170
|
-
formula: newPropertyType.formula,
|
|
171
|
-
referencedTypePath: newPropertyType.referencedTypePath,
|
|
172
|
-
referencedTypeRootSlug: newPropertyType.referencedTypeRootSlug,
|
|
173
|
-
defaultValue: newPropertyType.defaultValue,
|
|
174
|
-
propertyLevel: newPropertyType.propertyLevel,
|
|
175
|
-
formulaFunction: newPropertyType.formulaFunction,
|
|
176
|
-
validationFunction: newPropertyType.validationFunction,
|
|
177
|
-
numberFormat: newPropertyType.numberFormat,
|
|
163
|
+
isArchived: (_a = newPropertyType.isArchived) !== null && _a !== void 0 ? _a : null,
|
|
164
|
+
propertyType: (_b = newPropertyType.propertyType) !== null && _b !== void 0 ? _b : null,
|
|
165
|
+
slug: (_c = newPropertyType.slug) !== null && _c !== void 0 ? _c : null,
|
|
166
|
+
label: (_d = newPropertyType.label) !== null && _d !== void 0 ? _d : null,
|
|
167
|
+
editable: (_e = newPropertyType.editable) !== null && _e !== void 0 ? _e : null,
|
|
168
|
+
searchable: (_f = newPropertyType.searchable) !== null && _f !== void 0 ? _f : null,
|
|
169
|
+
core: (_g = newPropertyType.core) !== null && _g !== void 0 ? _g : null,
|
|
170
|
+
typePropertyOptionSetId: (_h = optionSetIdByName[newPropertyType.typePropertyOptionSetName]) !== null && _h !== void 0 ? _h : null,
|
|
171
|
+
formula: (_j = newPropertyType.formula) !== null && _j !== void 0 ? _j : null,
|
|
172
|
+
referencedTypePath: (_k = newPropertyType.referencedTypePath) !== null && _k !== void 0 ? _k : null,
|
|
173
|
+
referencedTypeRootSlug: (_l = newPropertyType.referencedTypeRootSlug) !== null && _l !== void 0 ? _l : null,
|
|
174
|
+
defaultValue: (_m = newPropertyType.defaultValue) !== null && _m !== void 0 ? _m : null,
|
|
175
|
+
propertyLevel: (_o = newPropertyType.propertyLevel) !== null && _o !== void 0 ? _o : null,
|
|
176
|
+
formulaFunction: (_p = newPropertyType.formulaFunction) !== null && _p !== void 0 ? _p : null,
|
|
177
|
+
validationFunction: (_q = newPropertyType.validationFunction) !== null && _q !== void 0 ? _q : null,
|
|
178
|
+
numberFormat: (_r = newPropertyType.numberFormat) !== null && _r !== void 0 ? _r : null,
|
|
179
|
+
sequenceSeedValue: (_s = newPropertyType.sequenceSeedValue) !== null && _s !== void 0 ? _s : null,
|
|
178
180
|
},
|
|
179
181
|
});
|
|
180
182
|
}
|
|
@@ -220,6 +222,7 @@ function typePropertiesEqual(typeProperty1, typeProperty2, optionSetIdByName) {
|
|
|
220
222
|
formulaFunction: typeProperty1.formulaFunction,
|
|
221
223
|
validationFunction: typeProperty1.validationFunction,
|
|
222
224
|
numberFormat: typeProperty1.numberFormat,
|
|
225
|
+
sequenceSeedValue: typeProperty1.sequenceSeedValue,
|
|
223
226
|
};
|
|
224
227
|
const reducedProperty2 = {
|
|
225
228
|
isArchived: typeProperty2.isArchived,
|
|
@@ -238,6 +241,7 @@ function typePropertiesEqual(typeProperty1, typeProperty2, optionSetIdByName) {
|
|
|
238
241
|
formulaFunction: typeProperty2.formulaFunction,
|
|
239
242
|
validationFunction: typeProperty2.validationFunction,
|
|
240
243
|
numberFormat: typeProperty2.numberFormat,
|
|
244
|
+
sequenceSeedValue: typeProperty2.sequenceSeedValue,
|
|
241
245
|
};
|
|
242
246
|
return _.isEqual(reducedProperty1, reducedProperty2);
|
|
243
247
|
}
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AppExtensionType, AppExtensionUserApps } from '@contrail/entity-types';
|
|
1
2
|
import { ExternalLink } from '@contrail/entity-types';
|
|
2
3
|
/** Describes the derivative JSON / object represented
|
|
3
4
|
* in app.yml file.
|
|
@@ -16,6 +17,7 @@ export interface AppDeclaration {
|
|
|
16
17
|
actions?: {
|
|
17
18
|
[key: string]: AppActionDeclaration;
|
|
18
19
|
};
|
|
20
|
+
extensions?: ExtensionDefinitionDeclaration[];
|
|
19
21
|
appConfiguration: ConfigPropertyElements;
|
|
20
22
|
externalLinks: ExternalLink[];
|
|
21
23
|
triggers: {
|
|
@@ -26,6 +28,14 @@ export interface AppDeclaration {
|
|
|
26
28
|
};
|
|
27
29
|
dockerImageRef?: string;
|
|
28
30
|
}
|
|
31
|
+
export interface ExtensionDefinitionDeclaration {
|
|
32
|
+
name: string;
|
|
33
|
+
identifier: string;
|
|
34
|
+
extensionType?: AppExtensionType;
|
|
35
|
+
userApps?: AppExtensionUserApps[];
|
|
36
|
+
modalDimensions?: any;
|
|
37
|
+
iframeUrl?: string;
|
|
38
|
+
}
|
|
29
39
|
export interface ConfigPropertyElements {
|
|
30
40
|
[key: string]: ConfigPropertyElement;
|
|
31
41
|
}
|