@contrail/cli 3.5.3-alpha.776a5c5 → 3.5.3-alpha.82946f6
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 +57 -12
- package/dist/api/org-config.d.ts +3 -0
- package/dist/api/org-config.js +28 -0
- package/dist/commands/groups/export.js +1 -13
- package/dist/commands/groups/import.js +2 -15
- package/dist/commands/instance/import.js +3 -1
- package/dist/commands/org-config/export.d.ts +13 -0
- package/dist/commands/org-config/export.js +74 -0
- package/dist/commands/org-config/import.d.ts +12 -0
- package/dist/commands/org-config/import.js +63 -0
- package/dist/commands/types/getAll.js +2 -0
- package/dist/commands/types/loadAll.d.ts +2 -1
- package/dist/commands/types/loadAll.js +25 -2
- package/dist/commands/types/mergeOptionSets.js +2 -9
- package/dist/commands/types/mergeTypeProperties.js +2 -6
- package/dist/commands/types/parseOptionSetsLocalFiles.js +3 -7
- package/dist/commands/users/export.js +1 -13
- package/dist/commands/users/import.js +2 -15
- package/dist/commands/workflow-templates/export.d.ts +1 -3
- package/dist/commands/workflow-templates/export.js +21 -110
- package/dist/helpers/file-helpers.d.ts +2 -0
- package/dist/helpers/file-helpers.js +25 -1
- package/dist/helpers/projects/helpers.js +2 -6
- package/dist/helpers/types/type-parser.js +9 -15
- package/dist/helpers/workflow-templates/helper.d.ts +0 -1
- package/dist/helpers/workflow-templates/helper.js +3 -26
- package/oclif.manifest.json +122 -15
- package/package.json +4 -1
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.82946f6 linux-x64 node-v24.20.0
|
|
21
21
|
$ contrail --help [COMMAND]
|
|
22
22
|
USAGE
|
|
23
23
|
$ contrail COMMAND
|
|
@@ -61,6 +61,8 @@ To get instructions on how to set up autocomplete for your shell, run `contrail
|
|
|
61
61
|
* [`contrail load custom-entity DATAFILE CONFIGFILE`](#contrail-load-custom-entity-datafile-configfile)
|
|
62
62
|
* [`contrail load line-sheet DATAFILE CONFIGFILE`](#contrail-load-line-sheet-datafile-configfile)
|
|
63
63
|
* [`contrail load upload-and-load INCOMINGFILE CONFIGFILENAME`](#contrail-load-upload-and-load-incomingfile-configfilename)
|
|
64
|
+
* [`contrail org-config export`](#contrail-org-config-export)
|
|
65
|
+
* [`contrail org-config import`](#contrail-org-config-import)
|
|
64
66
|
* [`contrail projects export PROJECTNAME`](#contrail-projects-export-projectname)
|
|
65
67
|
* [`contrail projects list`](#contrail-projects-list)
|
|
66
68
|
* [`contrail projects load TEMPLATEFILELOCATION`](#contrail-projects-load-templatefilelocation)
|
|
@@ -777,6 +779,53 @@ EXAMPLES
|
|
|
777
779
|
$ contrail load-processor upload-and-load <File Path> <Config Path>
|
|
778
780
|
```
|
|
779
781
|
|
|
782
|
+
## `contrail org-config export`
|
|
783
|
+
|
|
784
|
+
Export the org config for your Org
|
|
785
|
+
|
|
786
|
+
```
|
|
787
|
+
USAGE
|
|
788
|
+
$ contrail org-config export [-l error|warn|info|debug] [-e true|false] [-d <value>] [-f]
|
|
789
|
+
|
|
790
|
+
FLAGS
|
|
791
|
+
-d, --outDir=<value> [default: .] The directory to which to export the org config data. Defaults to the
|
|
792
|
+
current directory
|
|
793
|
+
-e, --alwaysConfirmEnv=<option> [default: true] The Environment variables
|
|
794
|
+
<options: true|false>
|
|
795
|
+
-f, --overwrite Replaces any existing export files in outDir
|
|
796
|
+
-l, --logLevel=<option> The Log Level
|
|
797
|
+
<options: error|warn|info|debug>
|
|
798
|
+
|
|
799
|
+
DESCRIPTION
|
|
800
|
+
Export the org config for your Org
|
|
801
|
+
|
|
802
|
+
EXAMPLES
|
|
803
|
+
$ contrail org-config export
|
|
804
|
+
```
|
|
805
|
+
|
|
806
|
+
## `contrail org-config import`
|
|
807
|
+
|
|
808
|
+
Upload an extracted org config
|
|
809
|
+
|
|
810
|
+
```
|
|
811
|
+
USAGE
|
|
812
|
+
$ contrail org-config import [-l error|warn|info|debug] [-e true|false] [-d <value>]
|
|
813
|
+
|
|
814
|
+
FLAGS
|
|
815
|
+
-d, --dir=<value> [default: .] The directory from which to import the org config data. Defaults to the
|
|
816
|
+
current directory. The org config data will be loaded from $dir/org-config.yml
|
|
817
|
+
-e, --alwaysConfirmEnv=<option> [default: true] The Environment variables
|
|
818
|
+
<options: true|false>
|
|
819
|
+
-l, --logLevel=<option> The Log Level
|
|
820
|
+
<options: error|warn|info|debug>
|
|
821
|
+
|
|
822
|
+
DESCRIPTION
|
|
823
|
+
Upload an extracted org config
|
|
824
|
+
|
|
825
|
+
EXAMPLES
|
|
826
|
+
$ contrail org-config import
|
|
827
|
+
```
|
|
828
|
+
|
|
780
829
|
## `contrail projects export PROJECTNAME`
|
|
781
830
|
|
|
782
831
|
Export a project.
|
|
@@ -919,7 +968,7 @@ loads all the type data that has been exported by getAll
|
|
|
919
968
|
|
|
920
969
|
```
|
|
921
970
|
USAGE
|
|
922
|
-
$ contrail types loadAll [-l error|warn|info|debug] [-e true|false] [-d <value>]
|
|
971
|
+
$ contrail types loadAll [-l error|warn|info|debug] [-e true|false] [-d <value>] [--orgConfig]
|
|
923
972
|
|
|
924
973
|
FLAGS
|
|
925
974
|
-d, --dir=<value> [default: .] The directory from which to load the types data. Defaults to the current
|
|
@@ -928,6 +977,8 @@ FLAGS
|
|
|
928
977
|
<options: true|false>
|
|
929
978
|
-l, --logLevel=<option> The Log Level
|
|
930
979
|
<options: error|warn|info|debug>
|
|
980
|
+
--[no-]orgConfig Also load org config data from this directory. If not specified, you will be
|
|
981
|
+
prompted.
|
|
931
982
|
|
|
932
983
|
DESCRIPTION
|
|
933
984
|
loads all the type data that has been exported by getAll
|
|
@@ -1611,31 +1662,25 @@ EXAMPLES
|
|
|
1611
1662
|
|
|
1612
1663
|
## `contrail workflow-templates export`
|
|
1613
1664
|
|
|
1614
|
-
Export all workflows in the org.
|
|
1665
|
+
Export all workflows in the org.
|
|
1615
1666
|
|
|
1616
1667
|
```
|
|
1617
1668
|
USAGE
|
|
1618
|
-
$ contrail workflow-templates export [-l error|warn|info|debug] [-e true|false] [-f <value>] [
|
|
1619
|
-
[--overwrite]
|
|
1669
|
+
$ contrail workflow-templates export [-l error|warn|info|debug] [-e true|false] [-f <value>] [--overwrite]
|
|
1620
1670
|
|
|
1621
1671
|
FLAGS
|
|
1622
|
-
-d, --dir=<value> [default: .] Directory to write per-app workflow files
|
|
1623
1672
|
-e, --alwaysConfirmEnv=<option> [default: true] The Environment variables
|
|
1624
1673
|
<options: true|false>
|
|
1625
|
-
-f, --outFile=<value>
|
|
1674
|
+
-f, --outFile=<value> [default: workflows.yml] The location for the file to be saved
|
|
1626
1675
|
-l, --logLevel=<option> The Log Level
|
|
1627
1676
|
<options: error|warn|info|debug>
|
|
1628
1677
|
--overwrite Replaces existing files if they exist
|
|
1629
1678
|
|
|
1630
1679
|
DESCRIPTION
|
|
1631
|
-
Export all workflows in the org.
|
|
1680
|
+
Export all workflows in the org.
|
|
1632
1681
|
|
|
1633
1682
|
EXAMPLES
|
|
1634
1683
|
$ contrail workflow-templates export
|
|
1635
|
-
|
|
1636
|
-
$ contrail workflow-templates export --dir ./workflows
|
|
1637
|
-
|
|
1638
|
-
$ contrail workflow-templates export --outFile workflows.yml
|
|
1639
1684
|
```
|
|
1640
1685
|
|
|
1641
1686
|
## `contrail workflow-templates list`
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createOrgConfig = exports.updateOrgConfig = exports.getOrgConfigs = void 0;
|
|
4
|
+
const sdk_1 = require("@contrail/sdk");
|
|
5
|
+
// every org has exactly one org-config record (created at provisioning),
|
|
6
|
+
// so callers can safely use the first element of the returned list
|
|
7
|
+
async function getOrgConfigs(options) {
|
|
8
|
+
return new sdk_1.Entities().get({
|
|
9
|
+
entityName: 'org-config',
|
|
10
|
+
...options,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
exports.getOrgConfigs = getOrgConfigs;
|
|
14
|
+
async function updateOrgConfig(id, changes) {
|
|
15
|
+
return new sdk_1.Entities().update({
|
|
16
|
+
entityName: 'org-config',
|
|
17
|
+
id,
|
|
18
|
+
object: changes,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
exports.updateOrgConfig = updateOrgConfig;
|
|
22
|
+
async function createOrgConfig(orgConfig) {
|
|
23
|
+
return new sdk_1.Entities().create({
|
|
24
|
+
entityName: 'org-config',
|
|
25
|
+
object: orgConfig,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
exports.createOrgConfig = createOrgConfig;
|
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.exportGroups = exports.DEFAULT_FILE_LOCATION = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const path = tslib_1.__importStar(require("path"));
|
|
6
5
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
8
6
|
const login_1 = require("../../auth/login");
|
|
9
|
-
const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
|
|
10
7
|
const core_1 = require("@oclif/core");
|
|
11
8
|
const file_helpers_1 = require("../../helpers/file-helpers");
|
|
12
9
|
const users_1 = require("../../api/users");
|
|
@@ -61,18 +58,9 @@ async function exportGroups(fileLocation, overwrite) {
|
|
|
61
58
|
});
|
|
62
59
|
}
|
|
63
60
|
groups = groups.sort((one, two) => (one.name < two.name ? -1 : 1));
|
|
64
|
-
await saveData(groups, fileLocation, overwrite);
|
|
61
|
+
await (0, file_helpers_1.saveData)(groups, fileLocation, overwrite);
|
|
65
62
|
}
|
|
66
63
|
exports.exportGroups = exportGroups;
|
|
67
|
-
async function saveData(data, fileLocation, overwrite) {
|
|
68
|
-
const yamlStr = js_yaml_1.default.dump(data);
|
|
69
|
-
const CURRENT_DIR = process.cwd();
|
|
70
|
-
const pathToWrite = path.join(CURRENT_DIR, fileLocation);
|
|
71
|
-
if (fs_1.default.existsSync(pathToWrite)) {
|
|
72
|
-
await (0, file_helpers_1.safeFileOverwrite)(pathToWrite, overwrite);
|
|
73
|
-
}
|
|
74
|
-
fs_1.default.writeFileSync(pathToWrite, yamlStr, 'utf8');
|
|
75
|
-
}
|
|
76
64
|
function getGroupPrincipals(group, allGroups, orgUsers) {
|
|
77
65
|
if (!group?.groupPrincipals) {
|
|
78
66
|
return [];
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.uploadGroups = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const path = tslib_1.__importStar(require("path"));
|
|
6
5
|
const sdk_1 = require("@contrail/sdk");
|
|
7
6
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
8
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
9
7
|
const login_1 = require("../../auth/login");
|
|
10
|
-
const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
|
|
11
8
|
const core_1 = require("@oclif/core");
|
|
9
|
+
const file_helpers_1 = require("../../helpers/file-helpers");
|
|
12
10
|
const basecommand_1 = require("../../basecommand");
|
|
13
11
|
const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
14
12
|
class ImportGroups extends basecommand_1.BaseCommand {
|
|
@@ -39,23 +37,12 @@ class ImportGroups extends basecommand_1.BaseCommand {
|
|
|
39
37
|
}
|
|
40
38
|
}
|
|
41
39
|
exports.default = ImportGroups;
|
|
42
|
-
function getGroupsFile(fileLocation) {
|
|
43
|
-
const CURRENT_DIR = process.cwd();
|
|
44
|
-
try {
|
|
45
|
-
const fullPath = path.join(CURRENT_DIR, fileLocation);
|
|
46
|
-
const doc = js_yaml_1.default.load(fs_1.default.readFileSync(fullPath, 'utf8'));
|
|
47
|
-
return doc;
|
|
48
|
-
}
|
|
49
|
-
catch (e) {
|
|
50
|
-
throw new Error(`ERROR PARSING YAML: ${e}`);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
40
|
async function uploadGroups(fileLocation) {
|
|
54
41
|
const existingGroups = await new sdk_1.Entities().get({
|
|
55
42
|
entityName: 'group',
|
|
56
43
|
relations: ['groupPrincipals'],
|
|
57
44
|
});
|
|
58
|
-
const groupsToImport =
|
|
45
|
+
const groupsToImport = (0, file_helpers_1.loadData)(fileLocation);
|
|
59
46
|
const orgUsers = await new sdk_1.Entities().get({
|
|
60
47
|
entityName: 'user-org',
|
|
61
48
|
});
|
|
@@ -8,6 +8,7 @@ const import_1 = require("../users/import");
|
|
|
8
8
|
const import_2 = require("../groups/import");
|
|
9
9
|
const uploadTypePropertyPolicies_1 = require("../types/uploadTypePropertyPolicies");
|
|
10
10
|
const uploadTypePolicies_1 = require("../types/uploadTypePolicies");
|
|
11
|
+
const import_3 = require("../org-config/import");
|
|
11
12
|
const basecommand_1 = require("../../basecommand");
|
|
12
13
|
class ImportInstance extends basecommand_1.BaseCommand {
|
|
13
14
|
static description = 'Import the data to an instance, including types and users';
|
|
@@ -25,11 +26,12 @@ class ImportInstance extends basecommand_1.BaseCommand {
|
|
|
25
26
|
}),
|
|
26
27
|
};
|
|
27
28
|
async run() {
|
|
28
|
-
await (0, loadAll_1.loadAll)(this.flags.dir, true);
|
|
29
|
+
await (0, loadAll_1.loadAll)(this.flags.dir, true, false);
|
|
29
30
|
await (0, import_1.uploadUsers)(path.join(this.flags.dir, 'users.yml'));
|
|
30
31
|
await (0, import_2.uploadGroups)(path.join(this.flags.dir, 'groups.yml'));
|
|
31
32
|
await (0, uploadTypePropertyPolicies_1.uploadTypePropertyPolicies)(this.flags.dir);
|
|
32
33
|
await (0, uploadTypePolicies_1.uploadTypePolicies)(this.flags.dir);
|
|
34
|
+
await (0, import_3.uploadOrgConfig)(this.flags.dir);
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
exports.default = ImportInstance;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseCommand } from '../../basecommand';
|
|
2
|
+
export default class ExportOrgConfig extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
outDir: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
7
|
+
overwrite: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
alwaysConfirmEnv: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
9
|
+
logLevel: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export declare function exportOrgConfig(outDir: string, overwrite: boolean): Promise<void>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.exportOrgConfig = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const path = tslib_1.__importStar(require("path"));
|
|
6
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
8
|
+
const login_1 = require("../../auth/login");
|
|
9
|
+
const core_1 = require("@oclif/core");
|
|
10
|
+
const file_helpers_1 = require("../../helpers/file-helpers");
|
|
11
|
+
const org_config_1 = require("../../api/org-config");
|
|
12
|
+
const basecommand_1 = require("../../basecommand");
|
|
13
|
+
const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
14
|
+
const ORG_SPECIFIC_FIELDS = [
|
|
15
|
+
'id',
|
|
16
|
+
'orgId',
|
|
17
|
+
'createdOn',
|
|
18
|
+
'updatedOn',
|
|
19
|
+
'createdById',
|
|
20
|
+
'updatedById',
|
|
21
|
+
'createdBy',
|
|
22
|
+
'updatedBy',
|
|
23
|
+
];
|
|
24
|
+
class ExportOrgConfig extends basecommand_1.BaseCommand {
|
|
25
|
+
static description = 'Export the org config for your Org';
|
|
26
|
+
static examples = [
|
|
27
|
+
`$ contrail org-config export
|
|
28
|
+
`,
|
|
29
|
+
];
|
|
30
|
+
static flags = {
|
|
31
|
+
...basecommand_1.BaseCommand.baseFlags,
|
|
32
|
+
outDir: core_1.Flags.string({
|
|
33
|
+
char: 'd',
|
|
34
|
+
description: 'The directory to which to export the org config data. Defaults to the current directory',
|
|
35
|
+
required: false,
|
|
36
|
+
default: '.',
|
|
37
|
+
}),
|
|
38
|
+
overwrite: core_1.Flags.boolean({
|
|
39
|
+
char: 'f',
|
|
40
|
+
description: 'Replaces any existing export files in outDir',
|
|
41
|
+
required: false,
|
|
42
|
+
default: false,
|
|
43
|
+
}),
|
|
44
|
+
};
|
|
45
|
+
async run() {
|
|
46
|
+
try {
|
|
47
|
+
await (0, login_1.authUser)();
|
|
48
|
+
this.log(`${chalk_1.default.blue.bold('START')} Getting Org Config.`);
|
|
49
|
+
this.log(`${chalk_1.default.yellow.bold('ORG CONFIG')} Exporting`);
|
|
50
|
+
await exportOrgConfig(this.flags.outDir, this.flags.overwrite);
|
|
51
|
+
this.log(`${chalk_1.default.yellow.bold('ORG CONFIG')} Exported`);
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
this.log(`${chalk_1.default.red.bold('FAIL')} Org Config Export Failed. ${e}`);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
this.log(`${chalk_1.default.green.bold('COMPLETE')} Org Config Export Complete.`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.default = ExportOrgConfig;
|
|
61
|
+
async function exportOrgConfig(outDir, overwrite) {
|
|
62
|
+
const orgConfigs = await (0, org_config_1.getOrgConfigs)();
|
|
63
|
+
if (!orgConfigs?.length) {
|
|
64
|
+
logger_1.default.info(`${chalk_1.default.yellow.bold('ORG CONFIG')} No org config found. Skipping.`);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const orgConfig = { ...orgConfigs[0] };
|
|
68
|
+
for (const field of ORG_SPECIFIC_FIELDS) {
|
|
69
|
+
delete orgConfig[field];
|
|
70
|
+
}
|
|
71
|
+
fs_1.default.mkdirSync(path.resolve(outDir), { recursive: true });
|
|
72
|
+
await (0, file_helpers_1.saveData)(orgConfig, path.join(outDir, 'org-config.yml'), overwrite);
|
|
73
|
+
}
|
|
74
|
+
exports.exportOrgConfig = exportOrgConfig;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseCommand } from '../../basecommand';
|
|
2
|
+
export default class ImportOrgConfig extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
dir: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
7
|
+
alwaysConfirmEnv: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
8
|
+
logLevel: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
9
|
+
};
|
|
10
|
+
run(): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export declare function uploadOrgConfig(dir: string): Promise<void>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.uploadOrgConfig = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const path = tslib_1.__importStar(require("path"));
|
|
6
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
8
|
+
const login_1 = require("../../auth/login");
|
|
9
|
+
const core_1 = require("@oclif/core");
|
|
10
|
+
const file_helpers_1 = require("../../helpers/file-helpers");
|
|
11
|
+
const org_config_1 = require("../../api/org-config");
|
|
12
|
+
const basecommand_1 = require("../../basecommand");
|
|
13
|
+
const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
14
|
+
class ImportOrgConfig extends basecommand_1.BaseCommand {
|
|
15
|
+
static description = 'Upload an extracted org config';
|
|
16
|
+
static examples = [
|
|
17
|
+
`$ contrail org-config import
|
|
18
|
+
`,
|
|
19
|
+
];
|
|
20
|
+
static flags = {
|
|
21
|
+
...basecommand_1.BaseCommand.baseFlags,
|
|
22
|
+
dir: core_1.Flags.string({
|
|
23
|
+
char: 'd',
|
|
24
|
+
description: 'The directory from which to import the org config data. Defaults to the current directory. The org config data will be loaded from $dir/org-config.yml',
|
|
25
|
+
required: false,
|
|
26
|
+
default: '.',
|
|
27
|
+
}),
|
|
28
|
+
};
|
|
29
|
+
async run() {
|
|
30
|
+
try {
|
|
31
|
+
await (0, login_1.authUser)();
|
|
32
|
+
this.log(`${chalk_1.default.blue.bold('START')} Uploading Org Config.`);
|
|
33
|
+
this.log(`${chalk_1.default.yellow.bold('ORG CONFIG')} Uploading`);
|
|
34
|
+
await uploadOrgConfig(this.flags.dir);
|
|
35
|
+
this.log(`${chalk_1.default.yellow.bold('ORG CONFIG')} Uploaded`);
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
this.log(`${chalk_1.default.red.bold('FAIL')} Org Config Upload Failed. ${e}`);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
this.log(`${chalk_1.default.green.bold('COMPLETE')} Org Config Upload Complete.`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.default = ImportOrgConfig;
|
|
45
|
+
async function uploadOrgConfig(dir) {
|
|
46
|
+
const filePath = path.join(dir, 'org-config.yml');
|
|
47
|
+
if (!fs_1.default.existsSync(filePath)) {
|
|
48
|
+
logger_1.default.info(`${chalk_1.default.yellow.bold('ORG CONFIG')} No org config found in ${dir}. Skipping.`);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const orgConfig = (0, file_helpers_1.loadData)(filePath);
|
|
52
|
+
if (!orgConfig || typeof orgConfig !== 'object' || Array.isArray(orgConfig)) {
|
|
53
|
+
throw new Error(`${filePath} must contain a single YAML object`);
|
|
54
|
+
}
|
|
55
|
+
const existingOrgConfigs = await (0, org_config_1.getOrgConfigs)();
|
|
56
|
+
if (existingOrgConfigs?.length) {
|
|
57
|
+
await (0, org_config_1.updateOrgConfig)(existingOrgConfigs[0].id, orgConfig);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
await (0, org_config_1.createOrgConfig)(orgConfig);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.uploadOrgConfig = uploadOrgConfig;
|
|
@@ -11,6 +11,7 @@ const type_extractor_1 = require("../../helpers/types/type-extractor");
|
|
|
11
11
|
const types_1 = require("../../api/types");
|
|
12
12
|
const types_2 = require("@contrail/org-config-migration/lib/types");
|
|
13
13
|
const file_helpers_1 = require("../../helpers/file-helpers");
|
|
14
|
+
const export_1 = require("../org-config/export");
|
|
14
15
|
const basecommand_1 = require("../../basecommand");
|
|
15
16
|
const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
16
17
|
const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
|
|
@@ -64,6 +65,7 @@ async function getAll(outDir, overwrite) {
|
|
|
64
65
|
};
|
|
65
66
|
const reducedData = await (0, types_2.getAllReducedTypes)(data);
|
|
66
67
|
await saveData(reducedData, outDir, overwrite);
|
|
68
|
+
await (0, export_1.exportOrgConfig)(outDir, overwrite);
|
|
67
69
|
logger_1.default.info(`${chalk_1.default.yellow.bold('TYPES')} Retrieved`);
|
|
68
70
|
}
|
|
69
71
|
catch (e) {
|
|
@@ -4,9 +4,10 @@ export default class LoadAllTypes extends BaseCommand {
|
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
6
|
dir: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
7
|
+
orgConfig: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
8
|
alwaysConfirmEnv: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
8
9
|
logLevel: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
9
10
|
};
|
|
10
11
|
run(): Promise<void>;
|
|
11
12
|
}
|
|
12
|
-
export declare function loadAll(dir: string, skipPolicies?: boolean): Promise<void>;
|
|
13
|
+
export declare function loadAll(dir: string, skipPolicies?: boolean, loadOrgConfig?: boolean): Promise<void>;
|
|
@@ -4,6 +4,7 @@ exports.loadAll = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const core_1 = require("@oclif/core");
|
|
6
6
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
|
+
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
7
8
|
const login_1 = require("../../auth/login");
|
|
8
9
|
const uploadOptionSets_1 = require("./uploadOptionSets");
|
|
9
10
|
const uploadOptionSetHierarchies_1 = require("./uploadOptionSetHierarchies");
|
|
@@ -12,6 +13,7 @@ const uploadTypePropertyPolicies_1 = require("./uploadTypePropertyPolicies");
|
|
|
12
13
|
const type_uploader_1 = require("../../helpers/types/type-uploader");
|
|
13
14
|
const uploadTypeOverrides_1 = require("./uploadTypeOverrides");
|
|
14
15
|
const uploadTypePolicies_1 = require("./uploadTypePolicies");
|
|
16
|
+
const import_1 = require("../org-config/import");
|
|
15
17
|
const basecommand_1 = require("../../basecommand");
|
|
16
18
|
const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
17
19
|
class LoadAllTypes extends basecommand_1.BaseCommand {
|
|
@@ -28,13 +30,19 @@ class LoadAllTypes extends basecommand_1.BaseCommand {
|
|
|
28
30
|
required: false,
|
|
29
31
|
default: '.',
|
|
30
32
|
}),
|
|
33
|
+
orgConfig: core_1.Flags.boolean({
|
|
34
|
+
description: 'Also load org config data from this directory. If not specified, you will be prompted.',
|
|
35
|
+
required: false,
|
|
36
|
+
default: undefined,
|
|
37
|
+
allowNo: true,
|
|
38
|
+
}),
|
|
31
39
|
};
|
|
32
40
|
async run() {
|
|
33
|
-
await loadAll(this.flags.dir);
|
|
41
|
+
await loadAll(this.flags.dir, false, this.flags.orgConfig);
|
|
34
42
|
}
|
|
35
43
|
}
|
|
36
44
|
exports.default = LoadAllTypes;
|
|
37
|
-
async function loadAll(dir, skipPolicies = false) {
|
|
45
|
+
async function loadAll(dir, skipPolicies = false, loadOrgConfig) {
|
|
38
46
|
try {
|
|
39
47
|
await (0, login_1.authUser)();
|
|
40
48
|
await (0, uploadOptionSets_1.uploadOptionSets)(dir);
|
|
@@ -46,6 +54,21 @@ async function loadAll(dir, skipPolicies = false) {
|
|
|
46
54
|
await (0, uploadTypePolicies_1.uploadTypePolicies)(dir);
|
|
47
55
|
}
|
|
48
56
|
await (0, uploadTypeOverrides_1.uploadTypeOverrides)(dir);
|
|
57
|
+
let shouldLoadOrgConfig = loadOrgConfig;
|
|
58
|
+
if (shouldLoadOrgConfig === undefined) {
|
|
59
|
+
const answers = await inquirer_1.default.prompt([
|
|
60
|
+
{
|
|
61
|
+
type: 'confirm',
|
|
62
|
+
name: 'loadOrgConfig',
|
|
63
|
+
message: 'Also load org config details from this directory?',
|
|
64
|
+
default: false,
|
|
65
|
+
},
|
|
66
|
+
]);
|
|
67
|
+
shouldLoadOrgConfig = answers.loadOrgConfig;
|
|
68
|
+
}
|
|
69
|
+
if (shouldLoadOrgConfig) {
|
|
70
|
+
await (0, import_1.uploadOrgConfig)(dir);
|
|
71
|
+
}
|
|
49
72
|
}
|
|
50
73
|
catch (e) {
|
|
51
74
|
logger_1.default.info(`${chalk_1.default.red.bold('FAIL')} Types Upload Failed. ${e}`);
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const path = tslib_1.__importStar(require("path"));
|
|
5
4
|
const sdk_1 = require("@contrail/sdk");
|
|
6
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
7
5
|
const login_1 = require("../../auth/login");
|
|
8
6
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
9
7
|
const core_1 = require("@oclif/core");
|
|
10
8
|
const basecommand_1 = require("../../basecommand");
|
|
11
9
|
const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
12
|
-
const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
|
|
13
10
|
const option_set_helper_1 = require("../../helpers/types/option-set-helper");
|
|
11
|
+
const file_helpers_1 = require("../../helpers/file-helpers");
|
|
14
12
|
class MergeOptionSets extends basecommand_1.BaseCommand {
|
|
15
13
|
static description = 'Merge the OptionSets from an existing org and the OptionSets passed in. OptionSets File must be .yml or a directory with yml files. The files can contain a single option set or an array of option sets.';
|
|
16
14
|
static examples = [
|
|
@@ -88,7 +86,7 @@ async function mergeOptionSets(fileLocation) {
|
|
|
88
86
|
mergedOptionSets.push(currentOptionSet);
|
|
89
87
|
}
|
|
90
88
|
}
|
|
91
|
-
saveData(mergedOptionSets);
|
|
89
|
+
await (0, file_helpers_1.saveData)(mergedOptionSets, 'merged_optionSets.yml', true);
|
|
92
90
|
}
|
|
93
91
|
function mergeOptionSet(existingOptionSet, uploadedOptionSet) {
|
|
94
92
|
const merged = {
|
|
@@ -110,8 +108,3 @@ function mergeOptionSet(existingOptionSet, uploadedOptionSet) {
|
|
|
110
108
|
}
|
|
111
109
|
return merged;
|
|
112
110
|
}
|
|
113
|
-
function saveData(data) {
|
|
114
|
-
const yamlStr = js_yaml_1.default.dump(data);
|
|
115
|
-
const CURRENT_DIR = process.cwd();
|
|
116
|
-
fs_1.default.writeFileSync(path.resolve(path.join(CURRENT_DIR, 'merged_optionSets.yml')), yamlStr, 'utf8');
|
|
117
|
-
}
|
|
@@ -11,6 +11,7 @@ const types_1 = require("@contrail/org-config-migration/lib/types");
|
|
|
11
11
|
const types_2 = require("../../api/types");
|
|
12
12
|
const basecommand_1 = require("../../basecommand");
|
|
13
13
|
const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
14
|
+
const file_helpers_1 = require("../../helpers/file-helpers");
|
|
14
15
|
const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
|
|
15
16
|
class MergeTypeProperties extends basecommand_1.BaseCommand {
|
|
16
17
|
static description = 'Merge the TypeProperties from an existing org and the TypeProperties passed in. Add to Types via TypePath File must be .yml';
|
|
@@ -74,7 +75,7 @@ async function mergeTypeProperties(fileLocation, typePaths) {
|
|
|
74
75
|
}
|
|
75
76
|
mergeType(foundType, uploadedTypeProperties);
|
|
76
77
|
}
|
|
77
|
-
saveData({ types: reducedData.reducedTypes });
|
|
78
|
+
await (0, file_helpers_1.saveData)({ types: reducedData.reducedTypes }, 'merged_types.yml', true);
|
|
78
79
|
}
|
|
79
80
|
function mergeType(reducedType, typePropertiesToAdd) {
|
|
80
81
|
for (const typeProperty of typePropertiesToAdd) {
|
|
@@ -84,8 +85,3 @@ function mergeType(reducedType, typePropertiesToAdd) {
|
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
|
-
function saveData(data) {
|
|
88
|
-
const yamlStr = js_yaml_1.default.dump(data);
|
|
89
|
-
const CURRENT_DIR = process.cwd();
|
|
90
|
-
fs_1.default.writeFileSync(path.resolve(path.join(CURRENT_DIR, 'merged_types.yml')), yamlStr, 'utf8');
|
|
91
|
-
}
|
|
@@ -12,6 +12,7 @@ const core_1 = require("@oclif/core");
|
|
|
12
12
|
const basecommand_1 = require("../../basecommand");
|
|
13
13
|
const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
14
14
|
const common_1 = require("../../common");
|
|
15
|
+
const file_helpers_1 = require("../../helpers/file-helpers");
|
|
15
16
|
class ParseOptionSetsLocalFiles extends basecommand_1.BaseCommand {
|
|
16
17
|
static description = 'Parse CSV files into OptionSets. Style denotes the format the csv is in. If the csv file has a column for option set' +
|
|
17
18
|
'name, option key, and option label, use "NameAndLabelAndKey". If the file has one column for each option set with ' +
|
|
@@ -109,22 +110,17 @@ async function parseOptionSetsLocalFiles(fileLocation, csvStyle) {
|
|
|
109
110
|
const uploadedOptionData = await loadOptionSetCSV(fileLocation);
|
|
110
111
|
if (csvStyle === 'NameAndLabelAndKey') {
|
|
111
112
|
const parsedOptionSets = parseNameAndLabelAndKey(uploadedOptionData);
|
|
112
|
-
saveData(parsedOptionSets);
|
|
113
|
+
await (0, file_helpers_1.saveData)(parsedOptionSets, 'parsed_local_optionSets.yml', true);
|
|
113
114
|
}
|
|
114
115
|
if (csvStyle === 'LabelsInColumn') {
|
|
115
116
|
const parsedOptionSets = parseLabelsInColumn(uploadedOptionData);
|
|
116
|
-
saveData(parsedOptionSets);
|
|
117
|
+
await (0, file_helpers_1.saveData)(parsedOptionSets, 'parsed_local_optionSets.yml', true);
|
|
117
118
|
}
|
|
118
119
|
}
|
|
119
120
|
async function parseOptionSetsToFolderStructure(fileLocation) {
|
|
120
121
|
const uploadedOptionData = await loadOptionSets(fileLocation);
|
|
121
122
|
saveDataInFolders(uploadedOptionData);
|
|
122
123
|
}
|
|
123
|
-
function saveData(data) {
|
|
124
|
-
const yamlStr = js_yaml_1.default.dump(data);
|
|
125
|
-
const CURRENT_DIR = process.cwd();
|
|
126
|
-
fs_1.default.writeFileSync(path.resolve(path.join(CURRENT_DIR, 'parsed_local_optionSets.yml')), yamlStr, 'utf8');
|
|
127
|
-
}
|
|
128
124
|
function saveDataInFolders(data) {
|
|
129
125
|
const folder = { filename: 'option-sets', split: true, fileLabel: 'name' };
|
|
130
126
|
const dir = 'merged_option_sets';
|
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.exportUsers = exports.DEFAULT_FILE_LOCATION = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const path = tslib_1.__importStar(require("path"));
|
|
6
5
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
8
6
|
const login_1 = require("../../auth/login");
|
|
9
|
-
const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
|
|
10
7
|
const core_1 = require("@oclif/core");
|
|
11
8
|
const file_helpers_1 = require("../../helpers/file-helpers");
|
|
12
9
|
const users_1 = require("../../api/users");
|
|
@@ -63,15 +60,6 @@ async function exportUsers(fileLocation, overwrite) {
|
|
|
63
60
|
});
|
|
64
61
|
}
|
|
65
62
|
users = users.sort((one, two) => (one.email < two.email ? -1 : 1));
|
|
66
|
-
await saveData(users, fileLocation, overwrite);
|
|
63
|
+
await (0, file_helpers_1.saveData)(users, fileLocation, overwrite);
|
|
67
64
|
}
|
|
68
65
|
exports.exportUsers = exportUsers;
|
|
69
|
-
async function saveData(data, fileLocation, overwrite) {
|
|
70
|
-
const yamlStr = js_yaml_1.default.dump(data);
|
|
71
|
-
const CURRENT_DIR = process.cwd();
|
|
72
|
-
const pathToWrite = path.resolve(path.join(CURRENT_DIR, fileLocation));
|
|
73
|
-
if (fs_1.default.existsSync(pathToWrite)) {
|
|
74
|
-
await (0, file_helpers_1.safeFileOverwrite)(pathToWrite, overwrite);
|
|
75
|
-
}
|
|
76
|
-
fs_1.default.writeFileSync(pathToWrite, yamlStr, 'utf8');
|
|
77
|
-
}
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.uploadUsers = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const path = tslib_1.__importStar(require("path"));
|
|
6
5
|
const sdk_1 = require("@contrail/sdk");
|
|
7
6
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
8
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
9
7
|
const login_1 = require("../../auth/login");
|
|
10
|
-
const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
|
|
11
8
|
const core_1 = require("@oclif/core");
|
|
9
|
+
const file_helpers_1 = require("../../helpers/file-helpers");
|
|
12
10
|
const basecommand_1 = require("../../basecommand");
|
|
13
11
|
class ImportUsers extends basecommand_1.BaseCommand {
|
|
14
12
|
static description = 'Import all users in the users.yml file';
|
|
@@ -38,19 +36,8 @@ class ImportUsers extends basecommand_1.BaseCommand {
|
|
|
38
36
|
}
|
|
39
37
|
}
|
|
40
38
|
exports.default = ImportUsers;
|
|
41
|
-
function getUsersFile(fileLocation) {
|
|
42
|
-
const CURRENT_DIR = process.cwd();
|
|
43
|
-
try {
|
|
44
|
-
const fullPath = path.join(CURRENT_DIR, fileLocation);
|
|
45
|
-
const doc = js_yaml_1.default.load(fs_1.default.readFileSync(fullPath, 'utf8'));
|
|
46
|
-
return doc;
|
|
47
|
-
}
|
|
48
|
-
catch (e) {
|
|
49
|
-
throw new Error(`ERROR PARSING YAML: ${e}`);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
39
|
async function uploadUsers(fileLocation) {
|
|
53
|
-
const users =
|
|
40
|
+
const users = (0, file_helpers_1.loadData)(fileLocation);
|
|
54
41
|
for (const user of users) {
|
|
55
42
|
const role = user.role;
|
|
56
43
|
const email = user.email;
|
|
@@ -5,12 +5,10 @@ export default class ExportWorkflows extends BaseCommand {
|
|
|
5
5
|
static examples: string[];
|
|
6
6
|
static flags: {
|
|
7
7
|
outFile: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
8
|
-
dir: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
9
8
|
overwrite: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
9
|
alwaysConfirmEnv: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
11
10
|
logLevel: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
12
11
|
};
|
|
13
12
|
run(): Promise<void>;
|
|
14
13
|
}
|
|
15
|
-
export declare function
|
|
16
|
-
export declare function exportWorkflowsToFile(fileLocation: string, overwrite: boolean): Promise<void>;
|
|
14
|
+
export declare function exportWorkflows(fileLocation: string, overwrite: boolean): Promise<void>;
|
|
@@ -1,40 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.exportWorkflows = exports.DEFAULT_FILE_LOCATION = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const path = tslib_1.__importStar(require("path"));
|
|
6
5
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
8
6
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
9
7
|
const login_1 = require("../../auth/login");
|
|
10
|
-
const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
|
|
11
8
|
const core_1 = require("@oclif/core");
|
|
12
9
|
const file_helpers_1 = require("../../helpers/file-helpers");
|
|
13
10
|
const event_workflow_templates_1 = require("../../api/event-workflow-templates");
|
|
14
|
-
const schedules_1 = require("../../api/schedules");
|
|
15
|
-
const apps_1 = require("../../api/apps");
|
|
16
11
|
const helper_1 = require("../../helpers/workflow-templates/helper");
|
|
17
12
|
const basecommand_1 = require("../../basecommand");
|
|
18
13
|
exports.DEFAULT_FILE_LOCATION = 'workflows.yml';
|
|
19
14
|
class ExportWorkflows extends basecommand_1.BaseCommand {
|
|
20
|
-
static description = 'Export all workflows in the org.
|
|
15
|
+
static description = 'Export all workflows in the org.';
|
|
21
16
|
static examples = [
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
'$ contrail workflow-templates export --outFile workflows.yml',
|
|
17
|
+
`$ contrail workflow-templates export
|
|
18
|
+
`,
|
|
25
19
|
];
|
|
26
20
|
static flags = {
|
|
27
21
|
...basecommand_1.BaseCommand.baseFlags,
|
|
28
22
|
outFile: core_1.Flags.string({
|
|
29
23
|
char: 'f',
|
|
30
|
-
description: '
|
|
24
|
+
description: 'The location for the file to be saved',
|
|
31
25
|
required: false,
|
|
32
|
-
|
|
33
|
-
dir: core_1.Flags.string({
|
|
34
|
-
char: 'd',
|
|
35
|
-
description: 'Directory to write per-app workflow files',
|
|
36
|
-
required: false,
|
|
37
|
-
default: '.',
|
|
26
|
+
default: exports.DEFAULT_FILE_LOCATION,
|
|
38
27
|
}),
|
|
39
28
|
overwrite: core_1.Flags.boolean({
|
|
40
29
|
description: 'Replaces existing files if they exist',
|
|
@@ -46,12 +35,7 @@ class ExportWorkflows extends basecommand_1.BaseCommand {
|
|
|
46
35
|
try {
|
|
47
36
|
await (0, login_1.authUser)();
|
|
48
37
|
this.log(`${chalk_1.default.blue.bold('START')} Getting Workflows.`);
|
|
49
|
-
|
|
50
|
-
await exportWorkflowsToFile(this.flags.outFile, this.flags.overwrite);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
await exportWorkflowsByApp(this.flags.dir ?? '.', this.flags.overwrite);
|
|
54
|
-
}
|
|
38
|
+
await exportWorkflows(this.flags.outFile ?? exports.DEFAULT_FILE_LOCATION, this.flags.overwrite);
|
|
55
39
|
this.log(`${chalk_1.default.yellow.bold('WORKFLOWS')} Done`);
|
|
56
40
|
}
|
|
57
41
|
catch (e) {
|
|
@@ -62,95 +46,22 @@ class ExportWorkflows extends basecommand_1.BaseCommand {
|
|
|
62
46
|
}
|
|
63
47
|
}
|
|
64
48
|
exports.default = ExportWorkflows;
|
|
65
|
-
async function
|
|
49
|
+
async function exportWorkflows(fileLocation, overwrite) {
|
|
66
50
|
const allWorkflowsInOrg = await (0, event_workflow_templates_1.getExistingWorkflowTemplates)();
|
|
67
|
-
const allSchedules = await (0, schedules_1.getExistingSchedules)();
|
|
68
|
-
const installedApps = await (0, apps_1.getInstalledApps)();
|
|
69
|
-
const appIdToIdentifier = new Map(installedApps.map((a) => [a.appId, a.app.identifier]));
|
|
70
|
-
const workflowsByApp = new Map();
|
|
71
|
-
const unassigned = [];
|
|
72
|
-
for (const workflow of allWorkflowsInOrg) {
|
|
73
|
-
let appIdentifier = workflow.supportingAppId
|
|
74
|
-
? appIdToIdentifier.get(workflow.supportingAppId)
|
|
75
|
-
: undefined;
|
|
76
|
-
// If no supportingAppId, try to extract app identifier from workflow identifier
|
|
77
|
-
// Format: @{appIdentifier}@{randomId}:{workflowName}
|
|
78
|
-
if (!appIdentifier && workflow.identifier) {
|
|
79
|
-
const match = workflow.identifier.match(/^@([^@]+)@/);
|
|
80
|
-
if (match) {
|
|
81
|
-
// Keep the @ prefix in the appIdentifier
|
|
82
|
-
appIdentifier = `@${match[1]}`;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
if (appIdentifier) {
|
|
86
|
-
if (!workflowsByApp.has(appIdentifier)) {
|
|
87
|
-
workflowsByApp.set(appIdentifier, []);
|
|
88
|
-
}
|
|
89
|
-
const workflows = workflowsByApp.get(appIdentifier);
|
|
90
|
-
if (workflows) {
|
|
91
|
-
workflows.push(workflow);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
unassigned.push(workflow);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
const resolvedDir = path.resolve(process.cwd(), outputDir);
|
|
99
|
-
for (const [appIdentifier, workflows] of workflowsByApp.entries()) {
|
|
100
|
-
const exportObj = { appIdentifier, workflows: [] };
|
|
101
|
-
for (const workflow of workflows) {
|
|
102
|
-
exportObj.workflows.push(await buildExportWorkflow(workflow, allSchedules));
|
|
103
|
-
}
|
|
104
|
-
const safeAppIdentifier = appIdentifier.replace(/[\\/]/g, '-');
|
|
105
|
-
const filePath = path.join(resolvedDir, `workflows-${safeAppIdentifier}.yml`);
|
|
106
|
-
await writeYamlFile(exportObj, filePath, overwrite);
|
|
107
|
-
console.log(`${chalk_1.default.green('EXPORTED')} ${filePath}`);
|
|
108
|
-
}
|
|
109
|
-
if (unassigned.length > 0) {
|
|
110
|
-
const unassignedObj = { workflows: [] };
|
|
111
|
-
for (const workflow of unassigned) {
|
|
112
|
-
unassignedObj.workflows.push(await buildExportWorkflow(workflow, allSchedules));
|
|
113
|
-
}
|
|
114
|
-
const unassignedFilePath = path.join(resolvedDir, 'workflows-unassigned.yml');
|
|
115
|
-
await writeYamlFile(unassignedObj, unassignedFilePath, overwrite);
|
|
116
|
-
console.log(`${chalk_1.default.yellow('EXPORTED')} ${unassignedFilePath} (unassigned workflows)`);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
exports.exportWorkflowsByApp = exportWorkflowsByApp;
|
|
120
|
-
async function exportWorkflowsToFile(fileLocation, overwrite) {
|
|
121
|
-
const allWorkflowsInOrg = await (0, event_workflow_templates_1.getExistingWorkflowTemplates)();
|
|
122
|
-
const allSchedules = await (0, schedules_1.getExistingSchedules)();
|
|
123
51
|
const workflowsObj = { workflows: [] };
|
|
124
52
|
for (const workflow of allWorkflowsInOrg) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
'isActive',
|
|
137
|
-
'messageGroup',
|
|
138
|
-
'dynamicMessageGroupId',
|
|
139
|
-
'parallelWorkerCount',
|
|
140
|
-
'workflowDefinition',
|
|
141
|
-
]);
|
|
142
|
-
const schedules = allSchedules.filter((s) => s.ownerReference === `event-workflow-template:${workflow.id}`);
|
|
143
|
-
if (schedules.length > 0) {
|
|
144
|
-
exportWorkflow.crons = schedules.map((s) => ({ name: s.name, cron: s.cron }));
|
|
145
|
-
}
|
|
146
|
-
await (0, helper_1.populateActionIdentifiers)(exportWorkflow);
|
|
147
|
-
(0, helper_1.extractShortActionKeys)(exportWorkflow);
|
|
148
|
-
return exportWorkflow;
|
|
149
|
-
}
|
|
150
|
-
async function writeYamlFile(data, absolutePath, overwrite) {
|
|
151
|
-
if (fs_1.default.existsSync(absolutePath)) {
|
|
152
|
-
await (0, file_helpers_1.safeFileOverwrite)(absolutePath, overwrite);
|
|
53
|
+
const exportWorkflow = lodash_1.default.pick(workflow, [
|
|
54
|
+
'triggerKey',
|
|
55
|
+
'workflowDefinition',
|
|
56
|
+
'name',
|
|
57
|
+
'isActive',
|
|
58
|
+
'identifier',
|
|
59
|
+
'messageGroup',
|
|
60
|
+
'dynamicMessageGroupId',
|
|
61
|
+
]);
|
|
62
|
+
await (0, helper_1.populateActionIdentifiers)(exportWorkflow);
|
|
63
|
+
workflowsObj.workflows.push(exportWorkflow);
|
|
153
64
|
}
|
|
154
|
-
|
|
155
|
-
fs_1.default.writeFileSync(absolutePath, js_yaml_1.default.dump(data), 'utf8');
|
|
65
|
+
await (0, file_helpers_1.saveData)(workflowsObj, fileLocation, overwrite);
|
|
156
66
|
}
|
|
67
|
+
exports.exportWorkflows = exportWorkflows;
|
|
@@ -1,2 +1,4 @@
|
|
|
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 saveData(data: any, fileLocation: string, overwrite: boolean): Promise<void>;
|
|
4
|
+
export declare function loadData(fileLocation: string): any;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseCSVData = exports.safeFileOverwrite = void 0;
|
|
3
|
+
exports.loadData = exports.saveData = exports.parseCSVData = exports.safeFileOverwrite = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const path = tslib_1.__importStar(require("path"));
|
|
6
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
5
7
|
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
8
|
+
const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
|
|
6
9
|
const logger_1 = tslib_1.__importDefault(require("../logger"));
|
|
7
10
|
const sync_1 = require("csv-parse/sync");
|
|
8
11
|
const PASS_FORCE_TO_OVERWRITE = 'Pass --overwrite to overwrite without prompting';
|
|
@@ -34,3 +37,24 @@ function parseCSVData(data) {
|
|
|
34
37
|
});
|
|
35
38
|
}
|
|
36
39
|
exports.parseCSVData = parseCSVData;
|
|
40
|
+
//saves data as yaml to fileLocation (resolved against the current directory), prompting before overwriting unless overwrite is passed
|
|
41
|
+
async function saveData(data, fileLocation, overwrite) {
|
|
42
|
+
const yamlStr = js_yaml_1.default.dump(data);
|
|
43
|
+
const pathToWrite = path.resolve(fileLocation);
|
|
44
|
+
if (fs_1.default.existsSync(pathToWrite)) {
|
|
45
|
+
await safeFileOverwrite(pathToWrite, overwrite);
|
|
46
|
+
}
|
|
47
|
+
fs_1.default.writeFileSync(pathToWrite, yamlStr, 'utf8');
|
|
48
|
+
}
|
|
49
|
+
exports.saveData = saveData;
|
|
50
|
+
//loads yaml data from fileLocation (resolved against the current directory)
|
|
51
|
+
function loadData(fileLocation) {
|
|
52
|
+
const pathToRead = path.resolve(fileLocation);
|
|
53
|
+
try {
|
|
54
|
+
return js_yaml_1.default.load(fs_1.default.readFileSync(pathToRead, 'utf8'));
|
|
55
|
+
}
|
|
56
|
+
catch (e) {
|
|
57
|
+
throw new Error(`ERROR PARSING YAML: ${e}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.loadData = loadData;
|
|
@@ -8,6 +8,7 @@ const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
|
8
8
|
const sdk_1 = require("@contrail/sdk");
|
|
9
9
|
const util_1 = require("@contrail/util");
|
|
10
10
|
const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
11
|
+
const file_helpers_1 = require("../file-helpers");
|
|
11
12
|
function getProjectFile(fileName) {
|
|
12
13
|
const CURRENT_DIR = process.cwd();
|
|
13
14
|
try {
|
|
@@ -42,7 +43,7 @@ async function exportProject(name) {
|
|
|
42
43
|
const allAssortments = [];
|
|
43
44
|
await getAssortmentsAndSubFolders(workspace.id, projectConfiguration.assortments, projectConfiguration.subFolders, allAssortments);
|
|
44
45
|
await convertRelationshipsInFolders(projectConfiguration, allAssortments);
|
|
45
|
-
saveData({ projectConfiguration: projectConfiguration }, name);
|
|
46
|
+
await (0, file_helpers_1.saveData)({ projectConfiguration: projectConfiguration }, `${name}-export.yml`, true);
|
|
46
47
|
}
|
|
47
48
|
exports.exportProject = exportProject;
|
|
48
49
|
async function getAssortmentsAndSubFolders(parentId, assortments, subFolders, allAssortments) {
|
|
@@ -160,8 +161,3 @@ function deleteNonUserKeys(assortment) {
|
|
|
160
161
|
delete assortment.updatedOn;
|
|
161
162
|
delete assortment.workspaceId;
|
|
162
163
|
}
|
|
163
|
-
function saveData(data, name) {
|
|
164
|
-
const yamlStr = js_yaml_1.default.dump(data);
|
|
165
|
-
const CURRENT_DIR = process.cwd();
|
|
166
|
-
fs_1.default.writeFileSync(path.join(CURRENT_DIR, `${name}-export.yml`), yamlStr, 'utf8');
|
|
167
|
-
}
|
|
@@ -4,12 +4,11 @@ exports.parseTypesFromFiles = exports.parseTypesFromTemplateAndDataFromLocalFile
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const path = tslib_1.__importStar(require("path"));
|
|
6
6
|
const types_1 = require("@contrail/types");
|
|
7
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
8
7
|
const csvToJson = tslib_1.__importStar(require("csvtojson"));
|
|
9
8
|
const login_1 = require("../../auth/login");
|
|
10
9
|
const csv_parser_1 = require("../../helpers/types/csv-parser");
|
|
11
10
|
const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
12
|
-
const
|
|
11
|
+
const file_helpers_1 = require("../file-helpers");
|
|
13
12
|
async function loadDataFromLocalCSV(fileName) {
|
|
14
13
|
const CURRENT_DIR = process.cwd();
|
|
15
14
|
try {
|
|
@@ -37,8 +36,8 @@ async function parseTypesFromLocalFiles(fileLocations) {
|
|
|
37
36
|
}
|
|
38
37
|
logger_1.default.info(`CSV imports were successful. ${csvJSONData?.length} total rows found.`);
|
|
39
38
|
const suggestions = (0, types_1.GetSuggestedTypes)(csvJSONData);
|
|
40
|
-
saveData(suggestions.OptionSets, 'parsed_optionSets.yml');
|
|
41
|
-
saveData({ typeProperties: suggestions.TypeProperties }, 'parsed_typeProperties.yml');
|
|
39
|
+
await (0, file_helpers_1.saveData)(suggestions.OptionSets, 'parsed_optionSets.yml', true);
|
|
40
|
+
await (0, file_helpers_1.saveData)({ typeProperties: suggestions.TypeProperties }, 'parsed_typeProperties.yml', true);
|
|
42
41
|
}
|
|
43
42
|
exports.parseTypesFromLocalFiles = parseTypesFromLocalFiles;
|
|
44
43
|
async function parseTypesFromTemplateFromLocalFiles(templateFileLocation, dataFileLocation) {
|
|
@@ -57,8 +56,8 @@ async function parseTypesFromTemplateFromLocalFiles(templateFileLocation, dataFi
|
|
|
57
56
|
throw e;
|
|
58
57
|
}
|
|
59
58
|
const types = (0, types_1.GetTypesFromTemplate)(templateCSVData, dataCSVData);
|
|
60
|
-
saveData(types.OptionSets, 'parsed_optionSets.yml');
|
|
61
|
-
saveData({ TypePropertiesByEntity: types.TypePropertiesByEntity }, 'parsed_TypePropertiesByEntity.yml');
|
|
59
|
+
await (0, file_helpers_1.saveData)(types.OptionSets, 'parsed_optionSets.yml', true);
|
|
60
|
+
await (0, file_helpers_1.saveData)({ TypePropertiesByEntity: types.TypePropertiesByEntity }, 'parsed_TypePropertiesByEntity.yml', true);
|
|
62
61
|
}
|
|
63
62
|
exports.parseTypesFromTemplateFromLocalFiles = parseTypesFromTemplateFromLocalFiles;
|
|
64
63
|
async function parseTypesFromTemplateAndDataFromLocalFiles(templateFileLocation, dataFileLocations) {
|
|
@@ -86,8 +85,8 @@ async function parseTypesFromTemplateAndDataFromLocalFiles(templateFileLocation,
|
|
|
86
85
|
}
|
|
87
86
|
}
|
|
88
87
|
const types = (0, types_1.GetTypesFromTemplateWithOptionSetsFromData)(templateCSVData, dataCSVData);
|
|
89
|
-
saveData(types.OptionSets, 'parsed_optionSets.yml');
|
|
90
|
-
saveData({ TypePropertiesByEntity: types.TypePropertiesByEntity }, 'parsed_TypePropertiesByEntity.yml');
|
|
88
|
+
await (0, file_helpers_1.saveData)(types.OptionSets, 'parsed_optionSets.yml', true);
|
|
89
|
+
await (0, file_helpers_1.saveData)({ TypePropertiesByEntity: types.TypePropertiesByEntity }, 'parsed_TypePropertiesByEntity.yml', true);
|
|
91
90
|
}
|
|
92
91
|
exports.parseTypesFromTemplateAndDataFromLocalFiles = parseTypesFromTemplateAndDataFromLocalFiles;
|
|
93
92
|
async function parseTypesFromFiles(fileIds) {
|
|
@@ -108,12 +107,7 @@ async function parseTypesFromFiles(fileIds) {
|
|
|
108
107
|
}
|
|
109
108
|
logger_1.default.info(`CSV downloads were successful. ${csvJSONData?.length} total rows found.`);
|
|
110
109
|
const suggestions = (0, types_1.GetSuggestedTypes)(csvJSONData);
|
|
111
|
-
saveData(suggestions.OptionSets, 'parsed_optionSets.yml');
|
|
112
|
-
saveData({ typeProperties: suggestions.TypeProperties }, 'parsed_typeProperties.yml');
|
|
110
|
+
await (0, file_helpers_1.saveData)(suggestions.OptionSets, 'parsed_optionSets.yml', true);
|
|
111
|
+
await (0, file_helpers_1.saveData)({ typeProperties: suggestions.TypeProperties }, 'parsed_typeProperties.yml', true);
|
|
113
112
|
}
|
|
114
113
|
exports.parseTypesFromFiles = parseTypesFromFiles;
|
|
115
|
-
function saveData(data, name) {
|
|
116
|
-
const yamlStr = js_yaml_1.default.dump(data);
|
|
117
|
-
const CURRENT_DIR = process.cwd();
|
|
118
|
-
fs_1.default.writeFileSync(path.resolve(path.join(CURRENT_DIR, name, yamlStr)), 'utf8');
|
|
119
|
-
}
|
|
@@ -18,4 +18,3 @@ export declare class WorkflowTemplateDeployer {
|
|
|
18
18
|
export declare function deleteWorkflowTemplates(): Promise<void>;
|
|
19
19
|
export declare function localDeployWorkflowTemplate(saveFileLocation: string): Promise<void>;
|
|
20
20
|
export declare function populateActionIdentifiers(workflowTemplate: WorkflowTemplate): Promise<void>;
|
|
21
|
-
export declare function extractShortActionKeys(workflowTemplate: WorkflowTemplate): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.populateActionIdentifiers = exports.localDeployWorkflowTemplate = exports.deleteWorkflowTemplates = exports.WorkflowTemplateDeployer = exports.getActionByIdentifier = exports.getWorkflowTemplateIdentifier = exports.LocalWorkflowTemplateDeployer = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const util_1 = require("@contrail/util");
|
|
6
6
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
@@ -44,8 +44,6 @@ class LocalWorkflowTemplateDeployer {
|
|
|
44
44
|
isActive: workflowTemplate.isActive,
|
|
45
45
|
supportingAppId: workflowTemplate.supportingAppId,
|
|
46
46
|
messageGroupId: workflowTemplate.messageGroupId,
|
|
47
|
-
messageGroup: workflowTemplate.messageGroup,
|
|
48
|
-
dynamicMessageGroupId: workflowTemplate.dynamicMessageGroupId,
|
|
49
47
|
parallelWorkerCount: workflowTemplate.parallelWorkerCount,
|
|
50
48
|
};
|
|
51
49
|
const newWorkflowTemplate = await (0, event_workflow_templates_1.createWorkflowTemplate)(newObject);
|
|
@@ -57,11 +55,8 @@ class LocalWorkflowTemplateDeployer {
|
|
|
57
55
|
}
|
|
58
56
|
async populateActionIds(workflowTemplate, workflowKey, appIdentifier) {
|
|
59
57
|
const installedApps = await (0, apps_1.getInstalledApps)();
|
|
60
|
-
const appOrg = installedApps.find((x) => x.app
|
|
58
|
+
const appOrg = installedApps.find((x) => x.app.identifier === appIdentifier);
|
|
61
59
|
logger_1.default.info('workflow template:', JSON.stringify(workflowTemplate, null, 2));
|
|
62
|
-
if (!appOrg) {
|
|
63
|
-
throw new Error(`Could not find installed app with identifier "${appIdentifier}". Make sure the app is installed in this org before importing workflows.`);
|
|
64
|
-
}
|
|
65
60
|
if (!workflowTemplate?.workflowDefinition?.paths) {
|
|
66
61
|
return;
|
|
67
62
|
}
|
|
@@ -91,7 +86,7 @@ class LocalWorkflowTemplateDeployer {
|
|
|
91
86
|
}
|
|
92
87
|
}
|
|
93
88
|
async createWorkflowSchedule(workflowTemplate, workflowId) {
|
|
94
|
-
if (!workflowTemplate?.crons?.length) {
|
|
89
|
+
if (!workflowTemplate?.crons?.length || !workflowTemplate.id) {
|
|
95
90
|
return;
|
|
96
91
|
}
|
|
97
92
|
const crons = [];
|
|
@@ -288,21 +283,3 @@ async function populateActionIdentifiers(workflowTemplate) {
|
|
|
288
283
|
}
|
|
289
284
|
}
|
|
290
285
|
exports.populateActionIdentifiers = populateActionIdentifiers;
|
|
291
|
-
function extractShortActionKeys(workflowTemplate) {
|
|
292
|
-
if (!workflowTemplate?.workflowDefinition?.paths) {
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
|
-
for (const wfPath of workflowTemplate.workflowDefinition.paths) {
|
|
296
|
-
if (!wfPath?.actionDefinitionConfigs) {
|
|
297
|
-
continue;
|
|
298
|
-
}
|
|
299
|
-
for (const actionConfig of wfPath.actionDefinitionConfigs) {
|
|
300
|
-
if (actionConfig.action?.includes(':')) {
|
|
301
|
-
// Full identifier format: "app-id@version:action-name" -> "action-name"
|
|
302
|
-
actionConfig.action = actionConfig.action.split(':').pop();
|
|
303
|
-
}
|
|
304
|
-
delete actionConfig.identifier;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
exports.extractShortActionKeys = extractShortActionKeys;
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.5.3-alpha.
|
|
2
|
+
"version": "3.5.3-alpha.82946f6",
|
|
3
3
|
"commands": {
|
|
4
4
|
"app:create": {
|
|
5
5
|
"id": "app:create",
|
|
@@ -1239,6 +1239,116 @@
|
|
|
1239
1239
|
}
|
|
1240
1240
|
}
|
|
1241
1241
|
},
|
|
1242
|
+
"org-config:export": {
|
|
1243
|
+
"id": "org-config:export",
|
|
1244
|
+
"description": "Export the org config for your Org",
|
|
1245
|
+
"strict": true,
|
|
1246
|
+
"pluginName": "@contrail/cli",
|
|
1247
|
+
"pluginAlias": "@contrail/cli",
|
|
1248
|
+
"pluginType": "core",
|
|
1249
|
+
"aliases": [],
|
|
1250
|
+
"examples": [
|
|
1251
|
+
"$ contrail org-config export\n"
|
|
1252
|
+
],
|
|
1253
|
+
"flags": {
|
|
1254
|
+
"logLevel": {
|
|
1255
|
+
"name": "logLevel",
|
|
1256
|
+
"type": "option",
|
|
1257
|
+
"char": "l",
|
|
1258
|
+
"description": "The Log Level",
|
|
1259
|
+
"required": false,
|
|
1260
|
+
"multiple": false,
|
|
1261
|
+
"options": [
|
|
1262
|
+
"error",
|
|
1263
|
+
"warn",
|
|
1264
|
+
"info",
|
|
1265
|
+
"debug"
|
|
1266
|
+
]
|
|
1267
|
+
},
|
|
1268
|
+
"alwaysConfirmEnv": {
|
|
1269
|
+
"name": "alwaysConfirmEnv",
|
|
1270
|
+
"type": "option",
|
|
1271
|
+
"char": "e",
|
|
1272
|
+
"description": "The Environment variables",
|
|
1273
|
+
"required": false,
|
|
1274
|
+
"multiple": false,
|
|
1275
|
+
"options": [
|
|
1276
|
+
"true",
|
|
1277
|
+
"false"
|
|
1278
|
+
],
|
|
1279
|
+
"default": "true"
|
|
1280
|
+
},
|
|
1281
|
+
"outDir": {
|
|
1282
|
+
"name": "outDir",
|
|
1283
|
+
"type": "option",
|
|
1284
|
+
"char": "d",
|
|
1285
|
+
"description": "The directory to which to export the org config data. Defaults to the current directory",
|
|
1286
|
+
"required": false,
|
|
1287
|
+
"multiple": false,
|
|
1288
|
+
"default": "."
|
|
1289
|
+
},
|
|
1290
|
+
"overwrite": {
|
|
1291
|
+
"name": "overwrite",
|
|
1292
|
+
"type": "boolean",
|
|
1293
|
+
"char": "f",
|
|
1294
|
+
"description": "Replaces any existing export files in outDir",
|
|
1295
|
+
"required": false,
|
|
1296
|
+
"allowNo": false
|
|
1297
|
+
}
|
|
1298
|
+
},
|
|
1299
|
+
"args": {}
|
|
1300
|
+
},
|
|
1301
|
+
"org-config:import": {
|
|
1302
|
+
"id": "org-config:import",
|
|
1303
|
+
"description": "Upload an extracted org config",
|
|
1304
|
+
"strict": true,
|
|
1305
|
+
"pluginName": "@contrail/cli",
|
|
1306
|
+
"pluginAlias": "@contrail/cli",
|
|
1307
|
+
"pluginType": "core",
|
|
1308
|
+
"aliases": [],
|
|
1309
|
+
"examples": [
|
|
1310
|
+
"$ contrail org-config import\n"
|
|
1311
|
+
],
|
|
1312
|
+
"flags": {
|
|
1313
|
+
"logLevel": {
|
|
1314
|
+
"name": "logLevel",
|
|
1315
|
+
"type": "option",
|
|
1316
|
+
"char": "l",
|
|
1317
|
+
"description": "The Log Level",
|
|
1318
|
+
"required": false,
|
|
1319
|
+
"multiple": false,
|
|
1320
|
+
"options": [
|
|
1321
|
+
"error",
|
|
1322
|
+
"warn",
|
|
1323
|
+
"info",
|
|
1324
|
+
"debug"
|
|
1325
|
+
]
|
|
1326
|
+
},
|
|
1327
|
+
"alwaysConfirmEnv": {
|
|
1328
|
+
"name": "alwaysConfirmEnv",
|
|
1329
|
+
"type": "option",
|
|
1330
|
+
"char": "e",
|
|
1331
|
+
"description": "The Environment variables",
|
|
1332
|
+
"required": false,
|
|
1333
|
+
"multiple": false,
|
|
1334
|
+
"options": [
|
|
1335
|
+
"true",
|
|
1336
|
+
"false"
|
|
1337
|
+
],
|
|
1338
|
+
"default": "true"
|
|
1339
|
+
},
|
|
1340
|
+
"dir": {
|
|
1341
|
+
"name": "dir",
|
|
1342
|
+
"type": "option",
|
|
1343
|
+
"char": "d",
|
|
1344
|
+
"description": "The directory from which to import the org config data. Defaults to the current directory. The org config data will be loaded from $dir/org-config.yml",
|
|
1345
|
+
"required": false,
|
|
1346
|
+
"multiple": false,
|
|
1347
|
+
"default": "."
|
|
1348
|
+
}
|
|
1349
|
+
},
|
|
1350
|
+
"args": {}
|
|
1351
|
+
},
|
|
1242
1352
|
"projects:export": {
|
|
1243
1353
|
"id": "projects:export",
|
|
1244
1354
|
"description": "Export a project.",
|
|
@@ -1593,6 +1703,13 @@
|
|
|
1593
1703
|
"required": false,
|
|
1594
1704
|
"multiple": false,
|
|
1595
1705
|
"default": "."
|
|
1706
|
+
},
|
|
1707
|
+
"orgConfig": {
|
|
1708
|
+
"name": "orgConfig",
|
|
1709
|
+
"type": "boolean",
|
|
1710
|
+
"description": "Also load org config data from this directory. If not specified, you will be prompted.",
|
|
1711
|
+
"required": false,
|
|
1712
|
+
"allowNo": true
|
|
1596
1713
|
}
|
|
1597
1714
|
},
|
|
1598
1715
|
"args": {}
|
|
@@ -2956,16 +3073,14 @@
|
|
|
2956
3073
|
},
|
|
2957
3074
|
"workflow-templates:export": {
|
|
2958
3075
|
"id": "workflow-templates:export",
|
|
2959
|
-
"description": "Export all workflows in the org.
|
|
3076
|
+
"description": "Export all workflows in the org.",
|
|
2960
3077
|
"strict": true,
|
|
2961
3078
|
"pluginName": "@contrail/cli",
|
|
2962
3079
|
"pluginAlias": "@contrail/cli",
|
|
2963
3080
|
"pluginType": "core",
|
|
2964
3081
|
"aliases": [],
|
|
2965
3082
|
"examples": [
|
|
2966
|
-
"$ contrail workflow-templates export"
|
|
2967
|
-
"$ contrail workflow-templates export --dir ./workflows",
|
|
2968
|
-
"$ contrail workflow-templates export --outFile workflows.yml"
|
|
3083
|
+
"$ contrail workflow-templates export\n"
|
|
2969
3084
|
],
|
|
2970
3085
|
"flags": {
|
|
2971
3086
|
"logLevel": {
|
|
@@ -2999,18 +3114,10 @@
|
|
|
2999
3114
|
"name": "outFile",
|
|
3000
3115
|
"type": "option",
|
|
3001
3116
|
"char": "f",
|
|
3002
|
-
"description": "
|
|
3003
|
-
"required": false,
|
|
3004
|
-
"multiple": false
|
|
3005
|
-
},
|
|
3006
|
-
"dir": {
|
|
3007
|
-
"name": "dir",
|
|
3008
|
-
"type": "option",
|
|
3009
|
-
"char": "d",
|
|
3010
|
-
"description": "Directory to write per-app workflow files",
|
|
3117
|
+
"description": "The location for the file to be saved",
|
|
3011
3118
|
"required": false,
|
|
3012
3119
|
"multiple": false,
|
|
3013
|
-
"default": "."
|
|
3120
|
+
"default": "workflows.yml"
|
|
3014
3121
|
},
|
|
3015
3122
|
"overwrite": {
|
|
3016
3123
|
"name": "overwrite",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrail/cli",
|
|
3
|
-
"version": "3.5.3-alpha.
|
|
3
|
+
"version": "3.5.3-alpha.82946f6",
|
|
4
4
|
"description": "VibeIQ's Contrail Platform CLI.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"contrail-cli": "./bin/run",
|
|
@@ -113,6 +113,9 @@
|
|
|
113
113
|
"groups": {
|
|
114
114
|
"description": "Export and import user groups"
|
|
115
115
|
},
|
|
116
|
+
"org-config": {
|
|
117
|
+
"description": "Export and import org-level configuration"
|
|
118
|
+
},
|
|
116
119
|
"webhooks": {
|
|
117
120
|
"description": "Manage VibeIQ webhooks"
|
|
118
121
|
},
|