@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
|
@@ -16,16 +16,18 @@ class ImportUsers extends basecommand_1.BaseCommand {
|
|
|
16
16
|
`$ contrail users import <USERS_FILE>
|
|
17
17
|
`,
|
|
18
18
|
];
|
|
19
|
+
static flags = {
|
|
20
|
+
...basecommand_1.BaseCommand.baseFlags,
|
|
21
|
+
};
|
|
19
22
|
static args = {
|
|
20
23
|
usersFile: core_1.Args.string({ description: 'The .yml file containing the users', required: true }),
|
|
21
24
|
};
|
|
22
25
|
async run() {
|
|
23
|
-
const { args } = await this.parse(ImportUsers);
|
|
24
26
|
try {
|
|
25
27
|
await (0, login_1.authUser)();
|
|
26
28
|
this.log('%s Uploading Users.', chalk_1.default.blue.bold('START'));
|
|
27
29
|
this.log('%s Uploading', chalk_1.default.yellow.bold('USER'));
|
|
28
|
-
await uploadUsers(args.usersFile);
|
|
30
|
+
await uploadUsers(this.args.usersFile);
|
|
29
31
|
this.log('%s Uploaded', chalk_1.default.yellow.bold('USER'));
|
|
30
32
|
}
|
|
31
33
|
catch (e) {
|
|
@@ -4,6 +4,8 @@ export default class CreateWebhooks extends BaseCommand {
|
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
6
|
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
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>;
|
|
7
9
|
};
|
|
8
10
|
run(): Promise<void>;
|
|
9
11
|
}
|
|
@@ -8,13 +8,13 @@ class CreateWebhooks extends basecommand_1.BaseCommand {
|
|
|
8
8
|
static description = 'Create a new webhook';
|
|
9
9
|
static examples = ['contrail webhooks create'];
|
|
10
10
|
static flags = {
|
|
11
|
+
...basecommand_1.BaseCommand.baseFlags,
|
|
11
12
|
json: core_1.Flags.boolean({ char: 'j', description: 'output in json format', default: false }),
|
|
12
13
|
};
|
|
13
14
|
async run() {
|
|
14
|
-
const { flags } = await this.parse(CreateWebhooks);
|
|
15
15
|
await (0, login_1.authUser)();
|
|
16
16
|
const webhook = await (0, webhooks_1.createWebhook)({});
|
|
17
|
-
if (flags.json) {
|
|
17
|
+
if (this.flags.json) {
|
|
18
18
|
console.log(JSON.stringify(webhook, null, 2));
|
|
19
19
|
}
|
|
20
20
|
else {
|
|
@@ -4,6 +4,8 @@ export default class DeleteWebhooks extends BaseCommand {
|
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
6
|
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
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>;
|
|
7
9
|
};
|
|
8
10
|
static args: {
|
|
9
11
|
webhookId: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
|
|
@@ -14,20 +14,20 @@ class DeleteWebhooks extends basecommand_1.BaseCommand {
|
|
|
14
14
|
'contrail webhooks delete 12345abcd-1234-abcd-1234-12345abcde',
|
|
15
15
|
];
|
|
16
16
|
static flags = {
|
|
17
|
+
...basecommand_1.BaseCommand.baseFlags,
|
|
17
18
|
json: core_1.Flags.boolean({ char: 'j', description: 'output in json format', default: false }),
|
|
18
19
|
};
|
|
19
20
|
static args = {
|
|
20
21
|
webhookId: core_1.Args.string({ description: 'The id of the webhook to delete', required: false }),
|
|
21
22
|
};
|
|
22
23
|
async run() {
|
|
23
|
-
const { flags, args } = await this.parse(DeleteWebhooks);
|
|
24
24
|
await (0, login_1.authUser)();
|
|
25
25
|
const webhooks = await (0, webhooks_1.getWebhooks)();
|
|
26
26
|
const deletedWebhooks = [];
|
|
27
|
-
if (args.webhookId) {
|
|
28
|
-
const toDelete = webhooks.find((x) => x.id === args.webhookId);
|
|
27
|
+
if (this.args.webhookId) {
|
|
28
|
+
const toDelete = webhooks.find((x) => x.id === this.args.webhookId);
|
|
29
29
|
if (!toDelete) {
|
|
30
|
-
throw new Error(`No webhook found with id ${args.webhookId}`);
|
|
30
|
+
throw new Error(`No webhook found with id ${this.args.webhookId}`);
|
|
31
31
|
}
|
|
32
32
|
deletedWebhooks.push(await (0, webhooks_1.deleteWebhook)(toDelete.id));
|
|
33
33
|
}
|
|
@@ -42,7 +42,7 @@ class DeleteWebhooks extends basecommand_1.BaseCommand {
|
|
|
42
42
|
deletedWebhooks.push(await (0, webhooks_1.deleteWebhook)(id));
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
if (flags.json) {
|
|
45
|
+
if (this.flags.json) {
|
|
46
46
|
logger_1.default.info(JSON.stringify(deletedWebhooks, null, 2));
|
|
47
47
|
}
|
|
48
48
|
else {
|
|
@@ -2,6 +2,10 @@ import { BaseCommand } from '../../basecommand';
|
|
|
2
2
|
export default class GetWebhookTrigger extends BaseCommand {
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
alwaysConfirmEnv: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
7
|
+
logLevel: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
8
|
+
};
|
|
5
9
|
static args: {
|
|
6
10
|
webhookId: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
|
|
7
11
|
};
|
|
@@ -10,17 +10,19 @@ const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
|
10
10
|
class GetWebhookTrigger extends basecommand_1.BaseCommand {
|
|
11
11
|
static description = 'Crafts a webhook trigger that can be used for event workflows. This command does not alter the state of any webhook or event workflow. It is only a utility for generating a webhook trigger.';
|
|
12
12
|
static examples = ['contrail webhooks getWebhookTrigger 1234-abcd-1234-abcd-1234abcd'];
|
|
13
|
+
static flags = {
|
|
14
|
+
...basecommand_1.BaseCommand.baseFlags,
|
|
15
|
+
};
|
|
13
16
|
static args = {
|
|
14
17
|
webhookId: core_1.Args.string({ description: 'The id of the webhook to delete', required: false }),
|
|
15
18
|
};
|
|
16
19
|
async run() {
|
|
17
|
-
const { args } = await this.parse(GetWebhookTrigger);
|
|
18
20
|
await (0, login_1.authUser)();
|
|
19
21
|
const webhooks = await (0, webhooks_1.getWebhooks)();
|
|
20
|
-
if (args.webhookId) {
|
|
21
|
-
const foundWebhook = webhooks.find((x) => x.id === args.webhookId);
|
|
22
|
+
if (this.args.webhookId) {
|
|
23
|
+
const foundWebhook = webhooks.find((x) => x.id === this.args.webhookId);
|
|
22
24
|
if (!foundWebhook) {
|
|
23
|
-
throw new Error(`No webhook found with id ${args.webhookId}`);
|
|
25
|
+
throw new Error(`No webhook found with id ${this.args.webhookId}`);
|
|
24
26
|
}
|
|
25
27
|
logger_1.default.info(`webhookId:${foundWebhook.id}`);
|
|
26
28
|
}
|
|
@@ -4,6 +4,8 @@ export default class ListWebhooks extends BaseCommand {
|
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
6
|
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
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>;
|
|
7
9
|
};
|
|
8
10
|
static args: {};
|
|
9
11
|
run(): Promise<void>;
|
|
@@ -11,16 +11,16 @@ class ListWebhooks extends basecommand_1.BaseCommand {
|
|
|
11
11
|
// // flag with a value (-n, --name=VALUE)
|
|
12
12
|
// name: Flags.string({char: 'n', description: 'name to print'}),
|
|
13
13
|
// flag with no value (-f, --force)
|
|
14
|
+
...basecommand_1.BaseCommand.baseFlags,
|
|
14
15
|
json: core_1.Flags.boolean({ char: 'j', description: 'output in json format', default: false }),
|
|
15
16
|
};
|
|
16
17
|
static args = {
|
|
17
18
|
// file: Args.string({description: 'file to read'}),
|
|
18
19
|
};
|
|
19
20
|
async run() {
|
|
20
|
-
const { flags } = await this.parse(ListWebhooks);
|
|
21
21
|
await (0, login_1.authUser)();
|
|
22
22
|
const webhooks = await (0, webhooks_1.getWebhooks)();
|
|
23
|
-
if (flags.json) {
|
|
23
|
+
if (this.flags.json) {
|
|
24
24
|
console.info(JSON.stringify(webhooks, null, 2));
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
@@ -2,5 +2,9 @@ import { BaseCommand } from '../../basecommand';
|
|
|
2
2
|
export default class InstallWorkflowTemplateDefinitions extends BaseCommand {
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
alwaysConfirmEnv: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
7
|
+
logLevel: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
8
|
+
};
|
|
5
9
|
run(): Promise<void>;
|
|
6
10
|
}
|
|
@@ -9,6 +9,9 @@ class InstallWorkflowTemplateDefinitions extends basecommand_1.BaseCommand {
|
|
|
9
9
|
`$ contrail workflow-template-definitions install
|
|
10
10
|
`,
|
|
11
11
|
];
|
|
12
|
+
static flags = {
|
|
13
|
+
...basecommand_1.BaseCommand.baseFlags,
|
|
14
|
+
};
|
|
12
15
|
async run() {
|
|
13
16
|
await (0, login_1.authUser)();
|
|
14
17
|
await new workflow_template_definition_deployer_1.WorkflowTemplateDefinitionDeployer().cliInstallWorkflowTemplateDefinitions();
|
|
@@ -2,5 +2,9 @@ import { BaseCommand } from '../../basecommand';
|
|
|
2
2
|
export default class ListWorkflowTemplateDefinitions extends BaseCommand {
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
alwaysConfirmEnv: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
7
|
+
logLevel: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
8
|
+
};
|
|
5
9
|
run(): Promise<void>;
|
|
6
10
|
}
|
|
@@ -9,6 +9,9 @@ class ListWorkflowTemplateDefinitions extends basecommand_1.BaseCommand {
|
|
|
9
9
|
`$ contrail workflow-template-definitions list
|
|
10
10
|
`,
|
|
11
11
|
];
|
|
12
|
+
static flags = {
|
|
13
|
+
...basecommand_1.BaseCommand.baseFlags,
|
|
14
|
+
};
|
|
12
15
|
async run() {
|
|
13
16
|
await (0, login_1.authUser)();
|
|
14
17
|
await new workflow_template_definition_deployer_1.WorkflowTemplateDefinitionDeployer().listWorkflowTemplateDefinitions();
|
|
@@ -2,5 +2,9 @@ import { BaseCommand } from '../../basecommand';
|
|
|
2
2
|
export default class DeleteWorkflowTemplates extends BaseCommand {
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
alwaysConfirmEnv: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
7
|
+
logLevel: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
8
|
+
};
|
|
5
9
|
run(): Promise<void>;
|
|
6
10
|
}
|
|
@@ -9,6 +9,9 @@ class DeleteWorkflowTemplates extends basecommand_1.BaseCommand {
|
|
|
9
9
|
`$ contrail workflow-templates delete
|
|
10
10
|
`,
|
|
11
11
|
];
|
|
12
|
+
static flags = {
|
|
13
|
+
...basecommand_1.BaseCommand.baseFlags,
|
|
14
|
+
};
|
|
12
15
|
async run() {
|
|
13
16
|
await (0, login_1.authUser)();
|
|
14
17
|
await new helper_1.WorkflowTemplateDeployer().deleteWorkflowTemplates();
|
|
@@ -6,6 +6,8 @@ export default class ExportWorkflows extends BaseCommand {
|
|
|
6
6
|
static flags: {
|
|
7
7
|
outFile: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
8
8
|
overwrite: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
alwaysConfirmEnv: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
10
|
+
logLevel: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
9
11
|
};
|
|
10
12
|
run(): Promise<void>;
|
|
11
13
|
}
|
|
@@ -21,6 +21,7 @@ class ExportWorkflows extends basecommand_1.BaseCommand {
|
|
|
21
21
|
`,
|
|
22
22
|
];
|
|
23
23
|
static flags = {
|
|
24
|
+
...basecommand_1.BaseCommand.baseFlags,
|
|
24
25
|
outFile: core_1.Flags.string({
|
|
25
26
|
char: 'f',
|
|
26
27
|
description: 'The location for the file to be saved',
|
|
@@ -34,11 +35,10 @@ class ExportWorkflows extends basecommand_1.BaseCommand {
|
|
|
34
35
|
}),
|
|
35
36
|
};
|
|
36
37
|
async run() {
|
|
37
|
-
const { flags } = await this.parse(ExportWorkflows);
|
|
38
38
|
try {
|
|
39
39
|
await (0, login_1.authUser)();
|
|
40
40
|
this.log('%s Getting Workflows.', chalk_1.default.blue.bold('START'));
|
|
41
|
-
await exportWorkflows(flags.outFile ?? exports.DEFAULT_FILE_LOCATION, flags.overwrite);
|
|
41
|
+
await exportWorkflows(this.flags.outFile ?? exports.DEFAULT_FILE_LOCATION, this.flags.overwrite);
|
|
42
42
|
this.log('%s Done', chalk_1.default.yellow.bold('WORKFLOWS'));
|
|
43
43
|
}
|
|
44
44
|
catch (e) {
|
|
@@ -59,6 +59,8 @@ async function exportWorkflows(fileLocation, overwrite) {
|
|
|
59
59
|
'name',
|
|
60
60
|
'isActive',
|
|
61
61
|
'identifier',
|
|
62
|
+
'messageGroup',
|
|
63
|
+
'dynamicMessageGroupId',
|
|
62
64
|
]);
|
|
63
65
|
await (0, helper_1.populateActionIdentifiers)(exportWorkflow);
|
|
64
66
|
workflowsObj.workflows.push(exportWorkflow);
|
|
@@ -2,5 +2,9 @@ import { BaseCommand } from '../../basecommand';
|
|
|
2
2
|
export default class ListWorkflowTemplates extends BaseCommand {
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
alwaysConfirmEnv: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
7
|
+
logLevel: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
8
|
+
};
|
|
5
9
|
run(): Promise<void>;
|
|
6
10
|
}
|
|
@@ -9,6 +9,9 @@ class ListWorkflowTemplates extends basecommand_1.BaseCommand {
|
|
|
9
9
|
`$ contrail workflow-templates list
|
|
10
10
|
`,
|
|
11
11
|
];
|
|
12
|
+
static flags = {
|
|
13
|
+
...basecommand_1.BaseCommand.baseFlags,
|
|
14
|
+
};
|
|
12
15
|
async run() {
|
|
13
16
|
await (0, login_1.authUser)();
|
|
14
17
|
return await new helper_1.WorkflowTemplateDeployer().listExistingWorkflowTemplates();
|
|
@@ -2,6 +2,10 @@ import { BaseCommand } from '../../basecommand';
|
|
|
2
2
|
export default class LoadWorkflowTemplates extends BaseCommand {
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
alwaysConfirmEnv: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
7
|
+
logLevel: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
8
|
+
};
|
|
5
9
|
static args: {
|
|
6
10
|
fileLocation: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
|
|
7
11
|
};
|
|
@@ -10,6 +10,9 @@ class LoadWorkflowTemplates extends basecommand_1.BaseCommand {
|
|
|
10
10
|
`$ contrail workflow-templates load <FILE_LOCATION>
|
|
11
11
|
`,
|
|
12
12
|
];
|
|
13
|
+
static flags = {
|
|
14
|
+
...basecommand_1.BaseCommand.baseFlags,
|
|
15
|
+
};
|
|
13
16
|
static args = {
|
|
14
17
|
fileLocation: core_1.Args.string({
|
|
15
18
|
description: 'The workflow template file to load',
|
|
@@ -17,9 +20,8 @@ class LoadWorkflowTemplates extends basecommand_1.BaseCommand {
|
|
|
17
20
|
}),
|
|
18
21
|
};
|
|
19
22
|
async run() {
|
|
20
|
-
const { args } = await this.parse(LoadWorkflowTemplates);
|
|
21
23
|
await (0, login_1.authUser)();
|
|
22
|
-
await (0, helper_1.localDeployWorkflowTemplate)(args.fileLocation);
|
|
24
|
+
await (0, helper_1.localDeployWorkflowTemplate)(this.args.fileLocation);
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
27
|
exports.default = LoadWorkflowTemplates;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExternalLink } from '@contrail/entity-types';
|
|
2
|
-
import { AppDeclaration, ConfigPropertyElements, CreateAppAccessGrantDTO
|
|
2
|
+
import { AppDeclaration, TriggerKeyDefinition, ConfigPropertyElements, CreateAppAccessGrantDTO } from '../../interfaces';
|
|
3
3
|
export declare class TriggerKeyDefinitionParser {
|
|
4
4
|
static buildTriggersArray(appDeclaration: AppDeclaration): Array<TriggerKeyDefinition>;
|
|
5
5
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AccessGrantsParser = exports.ExternalLinkParser = exports.ConfigPropertiesParser = exports.TriggerKeyDefinitionParser = void 0;
|
|
4
|
-
const sdk_1 = require("@contrail/sdk");
|
|
5
4
|
const interfaces_1 = require("../../interfaces");
|
|
5
|
+
const sdk_1 = require("@contrail/sdk");
|
|
6
6
|
class TriggerKeyDefinitionParser {
|
|
7
7
|
static buildTriggersArray(appDeclaration) {
|
|
8
8
|
const triggers = [];
|
|
@@ -79,10 +79,9 @@ class AccessGrantsParser {
|
|
|
79
79
|
static async buildAccessGrants(appDeclaration) {
|
|
80
80
|
const accessGrants = [];
|
|
81
81
|
const currentUser = await (0, sdk_1.getCurrentUser)();
|
|
82
|
-
|
|
83
|
-
let currentOrgId = config.orgId;
|
|
82
|
+
let currentOrgId = sdk_1.Auth.config.orgId;
|
|
84
83
|
if (!currentOrgId) {
|
|
85
|
-
let currentOrg = currentUser.orgs.find((o) => o.orgSlug === config.orgSlug);
|
|
84
|
+
let currentOrg = currentUser.orgs.find((o) => o.orgSlug === sdk_1.Auth.config.orgSlug);
|
|
86
85
|
currentOrgId = currentOrg.orgId;
|
|
87
86
|
}
|
|
88
87
|
for (const accessGrant of appDeclaration.accessGrants) {
|
|
@@ -1,6 +1,16 @@
|
|
|
1
|
+
export declare const ENVIRONMENTS: {
|
|
2
|
+
dev: string;
|
|
3
|
+
prod: string;
|
|
4
|
+
};
|
|
1
5
|
export declare function initializeVibeIQConfig(): Promise<void>;
|
|
2
6
|
export declare function readVibeIQConfig(): Promise<any>;
|
|
3
7
|
export declare function writeVibeIQConfig(config: any): Promise<void>;
|
|
8
|
+
export declare function storeVibeIQConfig(incomingConfig: any): Promise<void>;
|
|
9
|
+
export declare function createConfig(fileName: any): Promise<void>;
|
|
10
|
+
export declare function writeConfig(config: any, configName?: string): Promise<void>;
|
|
4
11
|
export declare function getConfig(): Promise<any>;
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
12
|
+
export declare function storeConfig(incomingConfig: any, configName?: string, merge?: boolean): Promise<void>;
|
|
13
|
+
export declare function getConfigFiles(): Promise<any>;
|
|
14
|
+
export declare function getConfigContent(fileName: string): Promise<any>;
|
|
15
|
+
export declare function validateEnvironments(envName?: any): Promise<any>;
|
|
16
|
+
export declare function checkTelemetry(cliVersion: string): Promise<void>;
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.checkTelemetry = exports.validateEnvironments = exports.getConfigContent = exports.getConfigFiles = exports.storeConfig = exports.getConfig = exports.writeConfig = exports.createConfig = exports.storeVibeIQConfig = exports.writeVibeIQConfig = exports.readVibeIQConfig = exports.initializeVibeIQConfig = exports.ENVIRONMENTS = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const node_fs_1 = require("node:fs");
|
|
6
6
|
const node_path_1 = require("node:path");
|
|
7
7
|
const node_os_1 = require("node:os");
|
|
8
8
|
const logger_1 = tslib_1.__importDefault(require("../../logger"));
|
|
9
|
+
const configFileName = 'config.json';
|
|
10
|
+
const defaultConfigFileName = 'default.json';
|
|
9
11
|
const userHomeDir = (0, node_os_1.homedir)();
|
|
10
|
-
const configDirectoryLocation = (0, node_path_1.join)(userHomeDir, '.vibeiq');
|
|
11
|
-
const configFileLocation = (0, node_path_1.join)(configDirectoryLocation,
|
|
12
|
+
const configDirectoryLocation = (0, node_path_1.join)(userHomeDir, '.vibeiq', 'configs');
|
|
13
|
+
const configFileLocation = (0, node_path_1.join)(configDirectoryLocation, configFileName);
|
|
14
|
+
const defaultConfigFileLocation = (0, node_path_1.join)(configDirectoryLocation, defaultConfigFileName);
|
|
15
|
+
exports.ENVIRONMENTS = {
|
|
16
|
+
dev: 'https://api.dev.vibeiq.com/dev/api',
|
|
17
|
+
prod: 'https://api.vibeiq.com/prod/api',
|
|
18
|
+
};
|
|
12
19
|
async function initializeVibeIQConfig() {
|
|
13
20
|
try {
|
|
14
21
|
await node_fs_1.promises.mkdir(configDirectoryLocation, { recursive: true });
|
|
@@ -18,7 +25,12 @@ async function initializeVibeIQConfig() {
|
|
|
18
25
|
throw error;
|
|
19
26
|
}
|
|
20
27
|
try {
|
|
21
|
-
|
|
28
|
+
const config = {
|
|
29
|
+
configInUse: (0, node_path_1.parse)(defaultConfigFileName).name,
|
|
30
|
+
logLevel: 'debug',
|
|
31
|
+
};
|
|
32
|
+
await node_fs_1.promises.writeFile(configFileLocation, JSON.stringify(config, null, 2));
|
|
33
|
+
await node_fs_1.promises.writeFile(defaultConfigFileLocation, '{}');
|
|
22
34
|
}
|
|
23
35
|
catch (error) {
|
|
24
36
|
logger_1.default.error(`could not initialize config file (${configFileLocation}).`);
|
|
@@ -55,27 +67,157 @@ async function writeVibeIQConfig(config) {
|
|
|
55
67
|
}
|
|
56
68
|
}
|
|
57
69
|
exports.writeVibeIQConfig = writeVibeIQConfig;
|
|
70
|
+
async function storeVibeIQConfig(incomingConfig) {
|
|
71
|
+
const config = {
|
|
72
|
+
...(await readVibeIQConfig()),
|
|
73
|
+
...incomingConfig,
|
|
74
|
+
};
|
|
75
|
+
await writeVibeIQConfig(config);
|
|
76
|
+
}
|
|
77
|
+
exports.storeVibeIQConfig = storeVibeIQConfig;
|
|
78
|
+
async function createConfig(fileName) {
|
|
79
|
+
try {
|
|
80
|
+
await node_fs_1.promises.writeFile((0, node_path_1.join)(configDirectoryLocation, `${fileName}.json`), '{}');
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
logger_1.default.error('Could not create config file.');
|
|
84
|
+
throw error;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.createConfig = createConfig;
|
|
88
|
+
async function writeConfig(config, configName = null) {
|
|
89
|
+
try {
|
|
90
|
+
let configFileName = configName;
|
|
91
|
+
if (!configName) {
|
|
92
|
+
const fileContent = await readVibeIQConfig();
|
|
93
|
+
configFileName = fileContent.configInUse;
|
|
94
|
+
}
|
|
95
|
+
await node_fs_1.promises.writeFile((0, node_path_1.join)(configDirectoryLocation, `${configFileName}.json`), JSON.stringify(config, null, 2));
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
logger_1.default.error('Could not open config file for writing.');
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.writeConfig = writeConfig;
|
|
58
103
|
async function getConfig() {
|
|
59
|
-
|
|
60
|
-
|
|
104
|
+
let fileContent;
|
|
105
|
+
try {
|
|
106
|
+
fileContent = await (await node_fs_1.promises.readFile(configFileLocation)).toString();
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
logger_1.default.debug(`failed to open config file (${configFileLocation}) for reading.`);
|
|
110
|
+
logger_1.default.debug('trying to initialize config file');
|
|
111
|
+
await initializeVibeIQConfig();
|
|
112
|
+
fileContent = await (await node_fs_1.promises.readFile(configFileLocation)).toString();
|
|
113
|
+
}
|
|
114
|
+
try {
|
|
115
|
+
const configFileJSON = JSON.parse(fileContent);
|
|
116
|
+
return getConfigContent(configFileJSON.configInUse);
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
logger_1.default.error('Could not parse local vibeiq config.');
|
|
120
|
+
}
|
|
61
121
|
}
|
|
62
122
|
exports.getConfig = getConfig;
|
|
63
|
-
async function
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
123
|
+
async function storeConfig(incomingConfig, configName = null, merge = true) {
|
|
124
|
+
let configContent;
|
|
125
|
+
if (!configName) {
|
|
126
|
+
configContent = await getConfig();
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
configContent = await getConfigContent(configName);
|
|
67
130
|
}
|
|
68
|
-
await storeConfig(currentConfig, false);
|
|
69
|
-
}
|
|
70
|
-
exports.deleteConfigs = deleteConfigs;
|
|
71
|
-
async function storeConfig(incomingConfig, merge = true) {
|
|
72
131
|
let config = {
|
|
73
|
-
...
|
|
132
|
+
...configContent,
|
|
74
133
|
...incomingConfig,
|
|
75
134
|
};
|
|
76
135
|
if (!merge) {
|
|
77
136
|
config = incomingConfig;
|
|
78
137
|
}
|
|
79
|
-
await
|
|
138
|
+
await writeConfig(config, configName);
|
|
80
139
|
}
|
|
81
140
|
exports.storeConfig = storeConfig;
|
|
141
|
+
async function getConfigFiles() {
|
|
142
|
+
try {
|
|
143
|
+
const dirContent = (await node_fs_1.promises.readdir(configDirectoryLocation, { withFileTypes: true }))
|
|
144
|
+
.filter((content) => content.isFile() &&
|
|
145
|
+
content.name !== configFileName &&
|
|
146
|
+
(0, node_path_1.parse)(content.name).ext === '.json')
|
|
147
|
+
.map((content) => (0, node_path_1.parse)(content.name).name);
|
|
148
|
+
return dirContent;
|
|
149
|
+
}
|
|
150
|
+
catch {
|
|
151
|
+
logger_1.default.error(`Failed to open config directory (${configDirectoryLocation}) for getting files.`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
exports.getConfigFiles = getConfigFiles;
|
|
155
|
+
async function getConfigContent(fileName) {
|
|
156
|
+
const configFilePath = (0, node_path_1.join)(configDirectoryLocation, `${fileName}.json`);
|
|
157
|
+
let fileContent;
|
|
158
|
+
try {
|
|
159
|
+
fileContent = await (await node_fs_1.promises.readFile(configFilePath)).toString();
|
|
160
|
+
return JSON.parse(fileContent);
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
logger_1.default.error(`Failed to open/parse config file (${fileName}) might be malformed or not found.`);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
exports.getConfigContent = getConfigContent;
|
|
167
|
+
async function validateEnvironments(envName = null) {
|
|
168
|
+
if (envName === 'development') {
|
|
169
|
+
envName = 'dev';
|
|
170
|
+
}
|
|
171
|
+
else if (envName === 'production') {
|
|
172
|
+
envName = 'prod';
|
|
173
|
+
}
|
|
174
|
+
if (envName && !exports.ENVIRONMENTS[envName]) {
|
|
175
|
+
throw new Error(`No environment found with name ${envName}`);
|
|
176
|
+
}
|
|
177
|
+
return envName ? exports.ENVIRONMENTS[envName] : true;
|
|
178
|
+
}
|
|
179
|
+
exports.validateEnvironments = validateEnvironments;
|
|
180
|
+
async function checkTelemetry(cliVersion) {
|
|
181
|
+
try {
|
|
182
|
+
// TODO: remove comment when api is available so that we don't get errors
|
|
183
|
+
// const response = await axios.post('https://api.vibeiq.com/prod/api/telemetry/cli', {
|
|
184
|
+
// cli_version: cliVersion,
|
|
185
|
+
// });
|
|
186
|
+
// const { deprecations, warnings, errors } = response.data;
|
|
187
|
+
// eg: how the response should look like
|
|
188
|
+
// const deprecations = [
|
|
189
|
+
// { message: 'Deprecation 1' },
|
|
190
|
+
// { message: 'Deprecation 2' },
|
|
191
|
+
// { message: 'Deprecation 3' },
|
|
192
|
+
// ];
|
|
193
|
+
// const warnings = [{ message: 'Warning 1' }, { message: 'Warning 2' }, { message: 'Warning 3' }];
|
|
194
|
+
// const errors = [{ message: 'Error 1' }, { message: 'Error 2' }, { message: 'Error 3' }];
|
|
195
|
+
// TODO: Remove the hardcoded data when the API is available
|
|
196
|
+
const deprecations = [];
|
|
197
|
+
const warnings = [];
|
|
198
|
+
const errors = [];
|
|
199
|
+
if (errors.length > 0) {
|
|
200
|
+
const latestVersion = '2.4.0'; // TODO: Replace with the latest version of the CLI by calling the API
|
|
201
|
+
console.error(`Contrail CLI verison ${cliVersion} contains known critical bugs. Please upgrade to version ${latestVersion}.\n\nQuitting the CLI for safety.`);
|
|
202
|
+
errors.forEach((error) => {
|
|
203
|
+
logger_1.default.error(`${error.message}`);
|
|
204
|
+
});
|
|
205
|
+
const failed_exit_code = 1;
|
|
206
|
+
process.exit(failed_exit_code);
|
|
207
|
+
}
|
|
208
|
+
if (warnings.length > 0) {
|
|
209
|
+
warnings.forEach((warning) => {
|
|
210
|
+
logger_1.default.warn(`${warning.message}`);
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
if (deprecations.length > 0) {
|
|
214
|
+
deprecations.forEach((deprecation) => {
|
|
215
|
+
logger_1.default.warn(`${deprecation.message}`);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
catch (error) {
|
|
220
|
+
console.error('Failed to check telemetry:', error.message);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
exports.checkTelemetry = checkTelemetry;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.safeFileOverwrite = void 0;
|
|
3
|
+
exports.parseCSVData = exports.safeFileOverwrite = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
6
6
|
const logger_1 = tslib_1.__importDefault(require("../logger"));
|
|
7
|
+
const sync_1 = require("csv-parse/sync");
|
|
7
8
|
const PASS_FORCE_TO_OVERWRITE = 'Pass --overwrite to overwrite without prompting';
|
|
8
9
|
//throws an error if the user declines to overwrite the file
|
|
9
10
|
async function safeFileOverwrite(fileLocation, overwrite) {
|
|
@@ -24,3 +25,12 @@ async function safeFileOverwrite(fileLocation, overwrite) {
|
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
exports.safeFileOverwrite = safeFileOverwrite;
|
|
28
|
+
function parseCSVData(data) {
|
|
29
|
+
return (0, sync_1.parse)(data, {
|
|
30
|
+
columns: true,
|
|
31
|
+
skip_empty_lines: true,
|
|
32
|
+
relax_quotes: true,
|
|
33
|
+
bom: true,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
exports.parseCSVData = parseCSVData;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare enum FileExtension {
|
|
2
|
+
JSON = "JSON",
|
|
3
|
+
YAML = "YAML",
|
|
4
|
+
CSV = "CSV"
|
|
5
|
+
}
|
|
6
|
+
export declare function readFile(configFileName: any, fileExtensionType?: FileExtension): any;
|
|
7
|
+
export declare function uploadAndLoadLocalFile(incomingFileName: string, configFileName: string): Promise<void>;
|
|
8
|
+
export declare function loadLocalFile(configFileName: string): Promise<void>;
|
|
9
|
+
export declare function getDuplicateFederatedIds(data: any[], federatedIdField: string): string[];
|
|
10
|
+
/**
|
|
11
|
+
* Returns federated IDs that have more than one unique mapping to the groupByField.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getConflictingFederatedIdsGroupedByField(data: any[], federatedIdField: string, groupByField: string): string[];
|
|
14
|
+
/**
|
|
15
|
+
* Returns all the conflicting (non-unique) field values when grouped by federated ID.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getConflictingFieldForFederatedId(data: any[], federatedIdField: string, field: string): {
|
|
18
|
+
federatedId: string;
|
|
19
|
+
values: string[];
|
|
20
|
+
}[];
|