@contrail/cli 2.4.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +550 -196
- package/dist/auth/login.d.ts +1 -0
- package/dist/auth/login.js +119 -48
- package/dist/auth/login.spec.d.ts +1 -0
- package/dist/auth/login.spec.js +10 -0
- package/dist/baseFlags.d.ts +10 -0
- package/dist/baseFlags.js +25 -0
- package/dist/basecommand.d.ts +5 -2
- package/dist/basecommand.js +51 -47
- package/dist/commands/app/create.d.ts +2 -2
- package/dist/commands/app/create.js +1 -1
- package/dist/commands/app/delete.d.ts +4 -0
- package/dist/commands/app/delete.js +3 -0
- package/dist/commands/app/getApiKey.d.ts +2 -0
- package/dist/commands/app/getApiKey.js +3 -3
- package/dist/commands/app/init.d.ts +5 -1
- package/dist/commands/app/init.js +6 -3
- package/dist/commands/app/install.d.ts +1 -1
- package/dist/commands/app/install.js +10 -11
- package/dist/commands/app/publish.d.ts +2 -0
- package/dist/commands/app/publish.js +3 -3
- package/dist/commands/app/uninstall.d.ts +2 -0
- package/dist/commands/app/uninstall.js +5 -5
- package/dist/commands/app/upgrade.d.ts +2 -0
- package/dist/commands/app/upgrade.js +8 -8
- package/dist/commands/app/version/major.d.ts +4 -0
- package/dist/commands/app/version/major.js +3 -0
- package/dist/commands/app/version/minor.d.ts +4 -0
- package/dist/commands/app/version/minor.js +3 -0
- package/dist/commands/app/version/patch.d.ts +4 -0
- package/dist/commands/app/version/patch.js +3 -0
- package/dist/commands/config/create.d.ts +12 -0
- package/dist/commands/config/create.js +27 -0
- package/dist/commands/config/describe.d.ts +14 -0
- package/dist/commands/config/describe.js +46 -0
- package/dist/commands/config/list.d.ts +4 -0
- package/dist/commands/config/list.js +5 -1
- package/dist/commands/config/set.d.ts +3 -2
- package/dist/commands/config/set.js +17 -13
- package/dist/commands/config/use.d.ts +14 -0
- package/dist/commands/config/use.js +47 -0
- package/dist/commands/file/upload.d.ts +15 -0
- package/dist/commands/file/upload.js +69 -0
- package/dist/commands/groups/export.d.ts +2 -0
- package/dist/commands/groups/export.js +2 -2
- package/dist/commands/groups/{upload.d.ts → import.d.ts} +4 -0
- package/dist/commands/groups/{upload.js → import.js} +60 -23
- package/dist/commands/instance/export.d.ts +2 -0
- package/dist/commands/instance/export.js +4 -4
- package/dist/commands/instance/import.d.ts +2 -0
- package/dist/commands/instance/import.js +8 -8
- package/dist/commands/load/colors.d.ts +14 -0
- package/dist/commands/load/colors.js +53 -0
- package/dist/commands/load/custom-entity.d.ts +14 -0
- package/dist/commands/load/custom-entity.js +55 -0
- package/dist/commands/load/line-sheet.d.ts +14 -0
- package/dist/commands/load/line-sheet.js +55 -0
- package/dist/commands/{loader-process → load}/upload-and-load.d.ts +4 -0
- package/dist/commands/{loader-process → load}/upload-and-load.js +6 -4
- package/dist/commands/projects/export.d.ts +4 -1
- package/dist/commands/projects/export.js +4 -3
- package/dist/commands/projects/list.d.ts +4 -0
- package/dist/commands/projects/list.js +3 -0
- package/dist/commands/projects/load.d.ts +4 -0
- package/dist/commands/projects/load.js +5 -3
- package/dist/commands/types/exportOptionSetHierarchies.d.ts +4 -0
- package/dist/commands/types/exportOptionSetHierarchies.js +3 -0
- package/dist/commands/types/getAll.d.ts +9 -27
- package/dist/commands/types/getAll.js +6 -313
- package/dist/commands/types/getOptionSets.d.ts +16 -0
- package/dist/commands/types/getOptionSets.js +171 -0
- package/dist/commands/types/loadAll.d.ts +2 -0
- package/dist/commands/types/loadAll.js +2 -2
- package/dist/commands/types/mergeOptionSets.d.ts +4 -0
- package/dist/commands/types/mergeOptionSets.js +5 -3
- package/dist/commands/types/mergeTypeProperties.d.ts +4 -0
- package/dist/commands/types/mergeTypeProperties.js +11 -9
- package/dist/commands/types/parseOptionSetsHierarchyLocalFile.d.ts +4 -0
- package/dist/commands/types/parseOptionSetsHierarchyLocalFile.js +4 -2
- package/dist/commands/types/parseOptionSetsHierarchyValuesToKeysLocalFile.d.ts +4 -0
- package/dist/commands/types/parseOptionSetsHierarchyValuesToKeysLocalFile.js +4 -2
- package/dist/commands/types/parseOptionSetsLocalFiles.d.ts +2 -0
- package/dist/commands/types/parseOptionSetsLocalFiles.js +4 -4
- package/dist/commands/types/parseOptionSetsToFolderStructure.d.ts +4 -0
- package/dist/commands/types/parseOptionSetsToFolderStructure.js +6 -4
- package/dist/commands/types/parseTypesFromFiles.d.ts +4 -0
- package/dist/commands/types/parseTypesFromFiles.js +4 -2
- package/dist/commands/types/parseTypesFromLocalFiles.d.ts +4 -0
- package/dist/commands/types/parseTypesFromLocalFiles.js +4 -2
- package/dist/commands/types/parseTypesFromTemplateAndDataFromLocalFiles.d.ts +4 -0
- package/dist/commands/types/parseTypesFromTemplateAndDataFromLocalFiles.js +5 -3
- package/dist/commands/types/parseTypesFromTemplateFromLocalFiles.d.ts +4 -0
- package/dist/commands/types/parseTypesFromTemplateFromLocalFiles.js +5 -3
- package/dist/commands/types/uploadOptionSetHierarchies.d.ts +2 -0
- package/dist/commands/types/uploadOptionSetHierarchies.js +2 -2
- package/dist/commands/types/uploadOptionSets.d.ts +2 -0
- package/dist/commands/types/uploadOptionSets.js +2 -2
- package/dist/commands/types/uploadOptionSetsHierarchyLocalFile.d.ts +4 -0
- package/dist/commands/types/uploadOptionSetsHierarchyLocalFile.js +4 -2
- package/dist/commands/types/uploadRuleSets.d.ts +2 -0
- package/dist/commands/types/uploadRuleSets.js +2 -2
- package/dist/commands/types/uploadTypePolicies.d.ts +2 -0
- package/dist/commands/types/uploadTypePolicies.js +2 -2
- package/dist/commands/types/uploadTypePropertyPolicies.d.ts +2 -0
- package/dist/commands/types/uploadTypePropertyPolicies.js +2 -2
- package/dist/commands/types/uploadTypes.d.ts +2 -0
- package/dist/commands/types/uploadTypes.js +2 -2
- package/dist/commands/types/uploadUsageInfo.d.ts +2 -0
- package/dist/commands/types/uploadUsageInfo.js +2 -2
- package/dist/commands/users/export.d.ts +2 -0
- package/dist/commands/users/export.js +2 -2
- package/dist/commands/users/{upload.d.ts → import.d.ts} +4 -0
- package/dist/commands/users/{upload.js → import.js} +4 -2
- package/dist/commands/webhooks/create.d.ts +2 -0
- package/dist/commands/webhooks/create.js +2 -2
- package/dist/commands/webhooks/delete.d.ts +2 -0
- package/dist/commands/webhooks/delete.js +5 -5
- package/dist/commands/webhooks/getWebhookTrigger.d.ts +4 -0
- package/dist/commands/webhooks/getWebhookTrigger.js +6 -4
- package/dist/commands/webhooks/list.d.ts +2 -0
- package/dist/commands/webhooks/list.js +2 -2
- package/dist/commands/workflow-template-definitions/install.d.ts +4 -0
- package/dist/commands/workflow-template-definitions/install.js +3 -0
- package/dist/commands/workflow-template-definitions/list.d.ts +4 -0
- package/dist/commands/workflow-template-definitions/list.js +3 -0
- package/dist/commands/workflow-templates/delete.d.ts +4 -0
- package/dist/commands/workflow-templates/delete.js +3 -0
- package/dist/commands/workflow-templates/export.d.ts +2 -0
- package/dist/commands/workflow-templates/export.js +4 -2
- package/dist/commands/workflow-templates/list.d.ts +4 -0
- package/dist/commands/workflow-templates/list.js +3 -0
- package/dist/commands/workflow-templates/load.d.ts +4 -0
- package/dist/commands/workflow-templates/load.js +4 -2
- package/dist/helpers/app/app-template-parsers.d.ts +1 -1
- package/dist/helpers/app/app-template-parsers.js +3 -4
- package/dist/helpers/config/config.d.ts +12 -2
- package/dist/helpers/config/config.js +158 -16
- package/dist/helpers/file-helpers.d.ts +1 -0
- package/dist/helpers/file-helpers.js +11 -1
- package/dist/helpers/load/helpers.d.ts +20 -0
- package/dist/helpers/load/helpers.js +141 -0
- package/dist/helpers/load/helpers.spec.d.ts +1 -0
- package/dist/helpers/load/helpers.spec.js +62 -0
- package/dist/helpers/load/validators.d.ts +14 -0
- package/dist/helpers/load/validators.js +182 -0
- package/dist/helpers/load/validators.spec.d.ts +1 -0
- package/dist/helpers/load/validators.spec.js +450 -0
- package/dist/helpers/types/type-uploader.js +11 -3
- package/dist/helpers/workflow-template-definitions/workflow-template-definition-deployer.js +1 -1
- package/dist/helpers/workflow-templates/helper.js +0 -4
- package/dist/interfaces.d.ts +1 -0
- package/dist/templates/typescript/app.yml +17 -19
- package/dist/templates/typescript/package.json +14 -0
- package/dist/templates/typescript/src/actions/logItem.ts +1 -2
- package/oclif.manifest.json +1955 -250
- package/package.json +4 -2
- package/dist/commands/colors/deleteAll.d.ts +0 -6
- package/dist/commands/colors/deleteAll.js +0 -31
- package/dist/commands/colors/load.d.ts +0 -6
- package/dist/commands/colors/load.js +0 -30
- package/dist/commands/config/environments/list.d.ts +0 -7
- package/dist/commands/config/environments/list.js +0 -19
- package/dist/commands/config/environments/remove.d.ts +0 -12
- package/dist/commands/config/environments/remove.js +0 -36
- package/dist/commands/config/environments/set.d.ts +0 -12
- package/dist/commands/config/environments/set.js +0 -29
- package/dist/commands/config/remove.d.ts +0 -15
- package/dist/commands/config/remove.js +0 -28
- package/dist/commands/loader-process/load.d.ts +0 -9
- package/dist/commands/loader-process/load.js +0 -39
- package/dist/helpers/loader-process/helpers.d.ts +0 -2
- package/dist/helpers/loader-process/helpers.js +0 -99
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrail/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "VibeIQ's Contrail Platform CLI.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"contrail-cli": "./bin/run",
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@contrail/entity-types": "^1.1.17",
|
|
26
|
-
"@contrail/
|
|
26
|
+
"@contrail/org-config-migration": "^1.0.3",
|
|
27
|
+
"@contrail/sdk": "^1.4.6",
|
|
27
28
|
"@contrail/types": "^3.0.48",
|
|
28
29
|
"@contrail/util": "^1.0.41",
|
|
29
30
|
"@oclif/core": "^2",
|
|
@@ -37,6 +38,7 @@
|
|
|
37
38
|
"axios": "^1.3.5",
|
|
38
39
|
"chalk": "^4.0.0",
|
|
39
40
|
"command-line-usage": "^6.1.1",
|
|
41
|
+
"csv-parse": "^5.5.5",
|
|
40
42
|
"csvtojson": "^2.0.10",
|
|
41
43
|
"esm": "^3.2.25",
|
|
42
44
|
"execa": "^5.0.0",
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
5
|
-
const login_1 = require("../../auth/login");
|
|
6
|
-
const helpers_1 = require("../../helpers/colors/helpers");
|
|
7
|
-
const basecommand_1 = require("../../basecommand");
|
|
8
|
-
const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
9
|
-
class DeleteAllColors extends basecommand_1.BaseCommand {
|
|
10
|
-
static description = 'Say hello';
|
|
11
|
-
static examples = [
|
|
12
|
-
`$ contrail colors deleteAll
|
|
13
|
-
`,
|
|
14
|
-
];
|
|
15
|
-
async run() {
|
|
16
|
-
try {
|
|
17
|
-
await (0, login_1.authUser)();
|
|
18
|
-
const colors = await (0, helpers_1.getExistingColors)();
|
|
19
|
-
logger_1.default.info(`Deleting %s colors ${colors.length}`);
|
|
20
|
-
for (const color of colors) {
|
|
21
|
-
await (0, helpers_1.deleteColor)(color);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
catch (e) {
|
|
25
|
-
logger_1.default.info(`${chalk_1.default.red.bold('FAIL')} Loading Colors Failed. ${e}`);
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
logger_1.default.info(`${chalk_1.default.green.bold('COMPLETE')} Deleting Colors Complete.`);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.default = DeleteAllColors;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
5
|
-
const login_1 = require("../../auth/login");
|
|
6
|
-
const helpers_1 = require("../../helpers/colors/helpers");
|
|
7
|
-
const basecommand_1 = require("../../basecommand");
|
|
8
|
-
const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
9
|
-
class LoadColors extends basecommand_1.BaseCommand {
|
|
10
|
-
static description = 'Say hello';
|
|
11
|
-
static examples = [
|
|
12
|
-
`$ contrail colors load
|
|
13
|
-
`,
|
|
14
|
-
];
|
|
15
|
-
async run() {
|
|
16
|
-
try {
|
|
17
|
-
await (0, login_1.authUser)();
|
|
18
|
-
logger_1.default.info(`${chalk_1.default.yellow.bold('COLORS')} Getting Existing Colors`);
|
|
19
|
-
logger_1.default.info(`${chalk_1.default.yellow.bold('COLORS')} Uploading`);
|
|
20
|
-
await (0, helpers_1.uploadColors)();
|
|
21
|
-
logger_1.default.info(`${chalk_1.default.yellow.bold('COLORS')} Uploaded`);
|
|
22
|
-
}
|
|
23
|
-
catch (e) {
|
|
24
|
-
logger_1.default.info(`${chalk_1.default.red.bold('FAIL')} Loading Colors Failed. ${e}`);
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
logger_1.default.info(`${chalk_1.default.green.bold('COMPLETE')} Loading Colors Complete.`);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.default = LoadColors;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const config_1 = require("../../../helpers/config/config");
|
|
4
|
-
const basecommand_1 = require("../../../basecommand");
|
|
5
|
-
class ListConfigEnvironment extends basecommand_1.BaseCommand {
|
|
6
|
-
skipConfirmEnv = true;
|
|
7
|
-
static description = 'List the environment configurations';
|
|
8
|
-
static examples = [
|
|
9
|
-
`$ contrail config environments list
|
|
10
|
-
`,
|
|
11
|
-
];
|
|
12
|
-
async run() {
|
|
13
|
-
const { flags } = await this.parse(ListConfigEnvironment);
|
|
14
|
-
await super.setLogLevel(flags.logLevel);
|
|
15
|
-
const envConfig = await (0, config_1.readVibeIQConfig)();
|
|
16
|
-
this.log(envConfig.environments || {});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.default = ListConfigEnvironment;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { BaseCommand } from '../../../basecommand';
|
|
2
|
-
export default class RemoveConfigEnvironment extends BaseCommand {
|
|
3
|
-
skipConfirmEnv: boolean;
|
|
4
|
-
static description: string;
|
|
5
|
-
static examples: string[];
|
|
6
|
-
static strict: boolean;
|
|
7
|
-
static flags: {
|
|
8
|
-
name: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
9
|
-
};
|
|
10
|
-
static args: {};
|
|
11
|
-
run(): Promise<void>;
|
|
12
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const core_1 = require("@oclif/core");
|
|
5
|
-
const basecommand_1 = require("../../../basecommand");
|
|
6
|
-
const config_1 = require("../../../helpers/config/config");
|
|
7
|
-
const logger_1 = tslib_1.__importDefault(require("../../../logger"));
|
|
8
|
-
class RemoveConfigEnvironment extends basecommand_1.BaseCommand {
|
|
9
|
-
skipConfirmEnv = true;
|
|
10
|
-
static description = 'Remove a variable from the configuration';
|
|
11
|
-
static examples = [
|
|
12
|
-
`$ contrail config environments remove --name stage
|
|
13
|
-
`,
|
|
14
|
-
];
|
|
15
|
-
// variable argument length
|
|
16
|
-
static strict = false;
|
|
17
|
-
static flags = {
|
|
18
|
-
name: core_1.Flags.string({ description: 'The env name', required: true }),
|
|
19
|
-
};
|
|
20
|
-
static args = {};
|
|
21
|
-
async run() {
|
|
22
|
-
const { flags } = await this.parse(RemoveConfigEnvironment);
|
|
23
|
-
await super.setLogLevel(flags.logLevel);
|
|
24
|
-
const envConfig = await (0, config_1.readVibeIQConfig)();
|
|
25
|
-
if (envConfig.environments && envConfig.environments[flags.name]) {
|
|
26
|
-
delete envConfig.environments[flags.name];
|
|
27
|
-
await (0, config_1.storeConfig)(envConfig);
|
|
28
|
-
logger_1.default.info(`Successfully deleted environment with name ${flags.name}`);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
logger_1.default.info(`No existing environment found with name ${flags.name}`);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.default = RemoveConfigEnvironment;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { BaseCommand } from '../../../basecommand';
|
|
2
|
-
export default class SetConfigEnvironment extends BaseCommand {
|
|
3
|
-
skipConfirmEnv: boolean;
|
|
4
|
-
static description: string;
|
|
5
|
-
static examples: string[];
|
|
6
|
-
static flags: {
|
|
7
|
-
name: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
8
|
-
url: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
9
|
-
};
|
|
10
|
-
static args: {};
|
|
11
|
-
run(): Promise<void>;
|
|
12
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const core_1 = require("@oclif/core");
|
|
5
|
-
const config_1 = require("../../../helpers/config/config");
|
|
6
|
-
const basecommand_1 = require("../../../basecommand");
|
|
7
|
-
const logger_1 = tslib_1.__importDefault(require("../../../logger"));
|
|
8
|
-
class SetConfigEnvironment extends basecommand_1.BaseCommand {
|
|
9
|
-
skipConfirmEnv = true;
|
|
10
|
-
static description = 'Set a environment in the configuration';
|
|
11
|
-
static examples = ['$ contrail config environments set --name dev --url https://www.google.com'];
|
|
12
|
-
static flags = {
|
|
13
|
-
name: core_1.Flags.string({ description: 'The env name', required: true }),
|
|
14
|
-
url: core_1.Flags.string({
|
|
15
|
-
description: 'The env url',
|
|
16
|
-
required: true,
|
|
17
|
-
}),
|
|
18
|
-
};
|
|
19
|
-
static args = {};
|
|
20
|
-
async run() {
|
|
21
|
-
const { flags } = await this.parse(SetConfigEnvironment);
|
|
22
|
-
await super.setLogLevel(flags.logLevel);
|
|
23
|
-
const envConfig = await (0, config_1.readVibeIQConfig)();
|
|
24
|
-
envConfig.environments = { ...envConfig.environments, ...{ [flags.name]: flags.url } };
|
|
25
|
-
await (0, config_1.storeConfig)(envConfig);
|
|
26
|
-
logger_1.default.info(`Successfully added/updated environment with name ${flags.name}`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
exports.default = SetConfigEnvironment;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { BaseCommand } from '../../basecommand';
|
|
2
|
-
export default class RemoveConfig extends BaseCommand {
|
|
3
|
-
static description: string;
|
|
4
|
-
skipConfirmEnv: boolean;
|
|
5
|
-
static examples: string[];
|
|
6
|
-
static strict: boolean;
|
|
7
|
-
static flags: {
|
|
8
|
-
orgSlug: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
-
apiGateway: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
-
orgId: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
-
apiUserToken: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
|
-
};
|
|
13
|
-
static args: {};
|
|
14
|
-
run(): Promise<void>;
|
|
15
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const core_1 = require("@oclif/core");
|
|
4
|
-
const config_1 = require("../../helpers/config/config");
|
|
5
|
-
const basecommand_1 = require("../../basecommand");
|
|
6
|
-
class RemoveConfig extends basecommand_1.BaseCommand {
|
|
7
|
-
static description = 'Remove a variable from the configuration';
|
|
8
|
-
skipConfirmEnv = true;
|
|
9
|
-
static examples = [
|
|
10
|
-
`$ contrail config remove --orgId
|
|
11
|
-
`,
|
|
12
|
-
];
|
|
13
|
-
// variable argument length
|
|
14
|
-
static strict = false;
|
|
15
|
-
static flags = {
|
|
16
|
-
// list: Flags.string({char: 'f', description: 'Who is saying hello', required: true}),
|
|
17
|
-
orgSlug: core_1.Flags.boolean({ description: 'The org slug', required: false }),
|
|
18
|
-
apiGateway: core_1.Flags.boolean({ description: 'The API Gateway', required: false }),
|
|
19
|
-
orgId: core_1.Flags.boolean({ description: 'The org Id', required: false }),
|
|
20
|
-
apiUserToken: core_1.Flags.boolean({ description: 'The API User Token', required: false }),
|
|
21
|
-
};
|
|
22
|
-
static args = {};
|
|
23
|
-
async run() {
|
|
24
|
-
const { flags } = await this.parse(RemoveConfig);
|
|
25
|
-
await (0, config_1.deleteConfigs)(Object.keys(flags));
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.default = RemoveConfig;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { BaseCommand } from '../../basecommand';
|
|
2
|
-
export default class LoadPS extends BaseCommand {
|
|
3
|
-
static description: string;
|
|
4
|
-
static examples: string[];
|
|
5
|
-
static args: {
|
|
6
|
-
configFileName: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
|
|
7
|
-
};
|
|
8
|
-
run(): Promise<void>;
|
|
9
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const core_1 = require("@oclif/core");
|
|
5
|
-
const login_1 = require("../../auth/login");
|
|
6
|
-
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
|
-
const helpers_1 = require("../../helpers/loader-process/helpers");
|
|
8
|
-
const basecommand_1 = require("../../basecommand");
|
|
9
|
-
const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
10
|
-
class LoadPS extends basecommand_1.BaseCommand {
|
|
11
|
-
static description = 'Upload a csv file and kick off a load job for the uploaded file. The config path must be a reference to a .json or a .yml file.';
|
|
12
|
-
static examples = [
|
|
13
|
-
`$ contrail load-processor load
|
|
14
|
-
`,
|
|
15
|
-
];
|
|
16
|
-
static args = {
|
|
17
|
-
configFileName: core_1.Args.string({
|
|
18
|
-
char: 'c',
|
|
19
|
-
description: 'The configuration file location',
|
|
20
|
-
required: true,
|
|
21
|
-
}),
|
|
22
|
-
};
|
|
23
|
-
async run() {
|
|
24
|
-
const { args } = await this.parse(LoadPS);
|
|
25
|
-
try {
|
|
26
|
-
await (0, login_1.authUser)();
|
|
27
|
-
logger_1.default.info(`${chalk_1.default.yellow.bold('LOADER')} Uploading file`);
|
|
28
|
-
const configFileName = args.configFileName;
|
|
29
|
-
await (0, helpers_1.loadLocalFile)(configFileName);
|
|
30
|
-
logger_1.default.info(`${chalk_1.default.yellow.bold('LOADER')} Uploaded`);
|
|
31
|
-
}
|
|
32
|
-
catch (e) {
|
|
33
|
-
logger_1.default.info(`${chalk_1.default.red.bold('FAIL')} Starting Load Failed. ${e}`);
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
logger_1.default.info(`${chalk_1.default.green.bold('COMPLETE')} Starting Load Complete.`);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.default = LoadPS;
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.loadLocalFile = exports.uploadAndLoadLocalFile = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const path = tslib_1.__importStar(require("path"));
|
|
6
|
-
const sdk_1 = require("@contrail/sdk");
|
|
7
|
-
const fs = tslib_1.__importStar(require("fs"));
|
|
8
|
-
const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
|
|
9
|
-
const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
10
|
-
async function getLocalFile(incomingFileName) {
|
|
11
|
-
const ext = getFileExtension(incomingFileName);
|
|
12
|
-
if (ext !== '.csv') {
|
|
13
|
-
throw new Error('Upload file must be a .csv');
|
|
14
|
-
}
|
|
15
|
-
const TARGET_DIR = process.cwd();
|
|
16
|
-
try {
|
|
17
|
-
return fs.readFileSync(path.join(TARGET_DIR, incomingFileName));
|
|
18
|
-
}
|
|
19
|
-
catch (e) {
|
|
20
|
-
throw new Error(`ERROR LOADING CSV: ${e}`);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
function getLocalUploadConfig(configFileName) {
|
|
24
|
-
const ext = getFileExtension(configFileName);
|
|
25
|
-
if (ext !== '.json' && ext !== '.yml') {
|
|
26
|
-
throw new Error('Upload file must be a .json or .yml');
|
|
27
|
-
}
|
|
28
|
-
const CURRENT_DIR = process.cwd();
|
|
29
|
-
const fullPath = path.join(CURRENT_DIR, configFileName);
|
|
30
|
-
logger_1.default.info(`Getting config from path: ${fullPath}`);
|
|
31
|
-
if (ext === '.yml') {
|
|
32
|
-
try {
|
|
33
|
-
const doc = js_yaml_1.default.load(fs.readFileSync(fullPath, 'utf8'));
|
|
34
|
-
return doc;
|
|
35
|
-
}
|
|
36
|
-
catch (e) {
|
|
37
|
-
throw new Error(`ERROR LOADING UPLOAD CONFIGURATION FILE: ${e}`);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
try {
|
|
41
|
-
const doc = JSON.parse(fs.readFileSync(fullPath, 'utf8'));
|
|
42
|
-
return doc;
|
|
43
|
-
}
|
|
44
|
-
catch (e) {
|
|
45
|
-
throw new Error(`ERROR LOADING UPLOAD CONFIGURATION FILE: ${e}`);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
async function uploadFile(incomingFileName) {
|
|
49
|
-
const csvContent = await getLocalFile(incomingFileName);
|
|
50
|
-
const entities = new sdk_1.Entities();
|
|
51
|
-
const fileName = `${incomingFileName.slice(0, incomingFileName.length - 4)}-Upload-${new Date().getTime()}.csv`;
|
|
52
|
-
const file = await entities.create({
|
|
53
|
-
entityName: 'file',
|
|
54
|
-
object: { contentType: 'text/csv', fileName: fileName, ttl: 24 * 60 * 60 * 1000 },
|
|
55
|
-
});
|
|
56
|
-
logger_1.default.info(`VibeIQ file ID: ${file.id}`);
|
|
57
|
-
// Upload the CSV data to the newly created VibeIQ file
|
|
58
|
-
const fileDetails = {
|
|
59
|
-
contentType: 'text/csv',
|
|
60
|
-
};
|
|
61
|
-
await new sdk_1.Files().uploadFileAsStream(file.uploadPost, csvContent, fileDetails);
|
|
62
|
-
logger_1.default.info('File uploaded.');
|
|
63
|
-
return file;
|
|
64
|
-
}
|
|
65
|
-
async function loadFile(config) {
|
|
66
|
-
const entities = new sdk_1.Entities();
|
|
67
|
-
// start a load job referencing the newly created file
|
|
68
|
-
logger_1.default.info(`Loading with config: ${config}`);
|
|
69
|
-
const loadJob = await entities.create({
|
|
70
|
-
entityName: 'loader-process',
|
|
71
|
-
object: {
|
|
72
|
-
...config,
|
|
73
|
-
},
|
|
74
|
-
});
|
|
75
|
-
logger_1.default.info(`Load has been kicked off. loader-process ID: ${loadJob.id}`);
|
|
76
|
-
}
|
|
77
|
-
async function uploadAndLoadLocalFile(incomingFileName, configFileName) {
|
|
78
|
-
const file = await uploadFile(incomingFileName);
|
|
79
|
-
const config = getLocalUploadConfig(configFileName);
|
|
80
|
-
const fullConfig = {
|
|
81
|
-
fileLocation: file.id,
|
|
82
|
-
...config,
|
|
83
|
-
};
|
|
84
|
-
await loadFile(fullConfig);
|
|
85
|
-
}
|
|
86
|
-
exports.uploadAndLoadLocalFile = uploadAndLoadLocalFile;
|
|
87
|
-
async function loadLocalFile(configFileName) {
|
|
88
|
-
const config = getLocalUploadConfig(configFileName);
|
|
89
|
-
await loadFile(config);
|
|
90
|
-
}
|
|
91
|
-
exports.loadLocalFile = loadLocalFile;
|
|
92
|
-
function getFileExtension(fileName) {
|
|
93
|
-
let ext = '';
|
|
94
|
-
const parts = fileName?.split('.');
|
|
95
|
-
if (parts?.length > 1) {
|
|
96
|
-
ext = `.${parts[parts?.length - 1]}`;
|
|
97
|
-
}
|
|
98
|
-
return ext;
|
|
99
|
-
}
|