@contrail/cli 3.5.3-alpha.d39a3e1 → 3.5.3-alpha.d91b702
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.5.3-alpha.
|
|
20
|
+
@contrail/cli/3.5.3-alpha.d91b702 linux-x64 node-v24.16.0
|
|
21
21
|
$ contrail --help [COMMAND]
|
|
22
22
|
USAGE
|
|
23
23
|
$ contrail COMMAND
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.exportWorkflowsToFile = exports.exportWorkflowsByApp =
|
|
3
|
+
exports.exportWorkflowsToFile = exports.exportWorkflowsByApp = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const path = tslib_1.__importStar(require("path"));
|
|
6
6
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
@@ -15,7 +15,6 @@ const schedules_1 = require("../../api/schedules");
|
|
|
15
15
|
const apps_1 = require("../../api/apps");
|
|
16
16
|
const helper_1 = require("../../helpers/workflow-templates/helper");
|
|
17
17
|
const basecommand_1 = require("../../basecommand");
|
|
18
|
-
exports.DEFAULT_FILE_LOCATION = 'workflows.yml';
|
|
19
18
|
class ExportWorkflows extends basecommand_1.BaseCommand {
|
|
20
19
|
static description = 'Export all workflows in the org. By default exports one file per app to the current directory.';
|
|
21
20
|
static examples = [
|
|
@@ -63,10 +62,14 @@ class ExportWorkflows extends basecommand_1.BaseCommand {
|
|
|
63
62
|
}
|
|
64
63
|
exports.default = ExportWorkflows;
|
|
65
64
|
async function exportWorkflowsByApp(outputDir, overwrite) {
|
|
66
|
-
const allWorkflowsInOrg = await
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
const [allWorkflowsInOrg, allSchedules, installedApps] = await Promise.all([
|
|
66
|
+
(0, event_workflow_templates_1.getExistingWorkflowTemplates)(),
|
|
67
|
+
(0, schedules_1.getExistingSchedules)(),
|
|
68
|
+
(0, apps_1.getInstalledApps)(),
|
|
69
|
+
]);
|
|
70
|
+
const appIdToIdentifier = new Map(installedApps
|
|
71
|
+
.filter((appOrg) => appOrg.appId && appOrg.app?.identifier)
|
|
72
|
+
.map((appOrg) => [appOrg.appId, appOrg.app.identifier]));
|
|
70
73
|
const workflowsByApp = new Map();
|
|
71
74
|
const unassigned = [];
|
|
72
75
|
for (const workflow of allWorkflowsInOrg) {
|
|
@@ -118,8 +121,10 @@ async function exportWorkflowsByApp(outputDir, overwrite) {
|
|
|
118
121
|
}
|
|
119
122
|
exports.exportWorkflowsByApp = exportWorkflowsByApp;
|
|
120
123
|
async function exportWorkflowsToFile(fileLocation, overwrite) {
|
|
121
|
-
const allWorkflowsInOrg = await
|
|
122
|
-
|
|
124
|
+
const [allWorkflowsInOrg, allSchedules] = await Promise.all([
|
|
125
|
+
(0, event_workflow_templates_1.getExistingWorkflowTemplates)(),
|
|
126
|
+
(0, schedules_1.getExistingSchedules)(),
|
|
127
|
+
]);
|
|
123
128
|
const workflowsObj = { workflows: [] };
|
|
124
129
|
for (const workflow of allWorkflowsInOrg) {
|
|
125
130
|
workflowsObj.workflows.push(await buildExportWorkflow(workflow, allSchedules));
|
|
@@ -20,6 +20,7 @@ class LocalWorkflowTemplateDeployer {
|
|
|
20
20
|
const existingWorkflows = await (0, event_workflow_templates_1.getExistingWorkflowTemplates)();
|
|
21
21
|
// UPSERT / DELETE BASED ON WORKFLOW TEMPLATES IDENTIFIER
|
|
22
22
|
logger_1.default.info(`${chalk_1.default.yellow.bold('WORKFLOW TEMPLATES')} Deploying workflow templates.`);
|
|
23
|
+
logger_1.default.info(wtDeclaration);
|
|
23
24
|
for (const workflowKey of Object.keys(wtDeclaration.workflows)) {
|
|
24
25
|
await this.deployWorkflowTemplate(wtDeclaration.workflows[workflowKey], existingWorkflows, wtDeclaration.appIdentifier);
|
|
25
26
|
}
|
|
@@ -57,6 +58,7 @@ class LocalWorkflowTemplateDeployer {
|
|
|
57
58
|
async populateActionIds(workflowTemplate, workflowKey, appIdentifier) {
|
|
58
59
|
const installedApps = await (0, apps_1.getInstalledApps)();
|
|
59
60
|
const appOrg = installedApps.find((x) => x.app?.identifier === appIdentifier);
|
|
61
|
+
logger_1.default.info('workflow template:', JSON.stringify(workflowTemplate, null, 2));
|
|
60
62
|
if (!appOrg) {
|
|
61
63
|
throw new Error(`Could not find installed app with identifier "${appIdentifier}". Make sure the app is installed in this org before importing workflows.`);
|
|
62
64
|
}
|
package/oclif.manifest.json
CHANGED