@contrail/cli 1.0.71 → 2.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/LICENSE +21 -0
- package/README.md +1034 -5
- package/bin/dev +17 -0
- package/bin/dev.cmd +3 -0
- package/bin/run +5 -0
- package/bin/run.cmd +3 -0
- package/{lib → dist}/api/apps.d.ts +13 -13
- package/dist/api/apps.js +96 -0
- package/{lib → dist}/api/event-workflow-action-definition.d.ts +1 -1
- package/dist/api/event-workflow-action-definition.js +11 -0
- package/{lib → dist}/api/event-workflow-template-definition.d.ts +6 -6
- package/dist/api/event-workflow-template-definition.js +26 -0
- package/{lib → dist}/api/event-workflow-templates.d.ts +7 -7
- package/dist/api/event-workflow-templates.js +32 -0
- package/dist/api/types.d.ts +7 -0
- package/dist/api/types.js +52 -0
- package/{lib → dist}/auth/auth.d.ts +9 -9
- package/dist/auth/auth.js +6 -0
- package/{lib → dist}/auth/login.d.ts +2 -2
- package/{lib → dist}/auth/login.js +146 -141
- package/dist/commands/app/create.d.ts +6 -0
- package/dist/commands/app/create.js +15 -0
- package/dist/commands/app/delete.d.ts +7 -0
- package/dist/commands/app/delete.js +38 -0
- package/dist/commands/app/install.d.ts +11 -0
- package/dist/commands/app/install.js +117 -0
- package/dist/commands/app/publish.d.ts +7 -0
- package/dist/commands/app/publish.js +45 -0
- package/dist/commands/app/uninstall.d.ts +10 -0
- package/dist/commands/app/uninstall.js +58 -0
- package/dist/commands/app/upgrade.d.ts +11 -0
- package/dist/commands/app/upgrade.js +79 -0
- package/dist/commands/colors/deleteAll.d.ts +6 -0
- package/dist/commands/colors/deleteAll.js +30 -0
- package/dist/commands/colors/load.d.ts +6 -0
- package/dist/commands/colors/load.js +29 -0
- package/dist/commands/config/list.d.ts +6 -0
- package/dist/commands/config/list.js +15 -0
- package/dist/commands/config/remove.d.ts +14 -0
- package/dist/commands/config/remove.js +26 -0
- package/dist/commands/config/set.d.ts +13 -0
- package/dist/commands/config/set.js +29 -0
- package/dist/commands/loader-process/load.d.ts +9 -0
- package/dist/commands/loader-process/load.js +33 -0
- package/dist/commands/loader-process/upload-and-load.d.ts +10 -0
- package/dist/commands/loader-process/upload-and-load.js +35 -0
- package/dist/commands/projects/export.d.ts +10 -0
- package/dist/commands/projects/export.js +34 -0
- package/dist/commands/projects/list.d.ts +6 -0
- package/dist/commands/projects/list.js +34 -0
- package/dist/commands/projects/load.d.ts +9 -0
- package/{lib/projects/project-uploader.js → dist/commands/projects/load.js} +106 -105
- package/dist/commands/types/exportOptionSetHierarchies.d.ts +7 -0
- package/{lib/types/option-set-hierarchy-exporter.js → dist/commands/types/exportOptionSetHierarchies.js} +130 -113
- package/{lib/types/types-extractor.d.ts → dist/commands/types/getAll.d.ts} +29 -27
- package/{lib/types/types-extractor.js → dist/commands/types/getAll.js} +267 -318
- package/dist/commands/types/loadAll.d.ts +7 -0
- package/dist/commands/types/loadAll.js +41 -0
- package/dist/commands/types/mergeOptionSets.d.ts +9 -0
- package/{lib/types/option-set-merger.js → dist/commands/types/mergeOptionSets.js} +114 -105
- package/dist/commands/types/mergeTypeProperties.d.ts +11 -0
- package/dist/commands/types/mergeTypeProperties.js +89 -0
- package/dist/commands/types/parseOptionSetsHierarchyLocalFile.d.ts +10 -0
- package/dist/commands/types/parseOptionSetsHierarchyLocalFile.js +112 -0
- package/dist/commands/types/parseOptionSetsLocalFiles.d.ts +14 -0
- package/dist/commands/types/parseOptionSetsLocalFiles.js +153 -0
- package/dist/commands/types/parseOptionSetsToFolderStructure.d.ts +10 -0
- package/dist/commands/types/parseOptionSetsToFolderStructure.js +104 -0
- package/dist/commands/types/parseTypesFromFiles.d.ts +10 -0
- package/dist/commands/types/parseTypesFromFiles.js +34 -0
- package/dist/commands/types/parseTypesFromLocalFiles.d.ts +10 -0
- package/dist/commands/types/parseTypesFromLocalFiles.js +34 -0
- package/dist/commands/types/parseTypesFromTemplateAndDataFromLocalFiles.d.ts +11 -0
- package/dist/commands/types/parseTypesFromTemplateAndDataFromLocalFiles.js +36 -0
- package/dist/commands/types/parseTypesFromTemplateFromLocalFiles.d.ts +10 -0
- package/dist/commands/types/parseTypesFromTemplateFromLocalFiles.js +35 -0
- package/dist/commands/types/uploadOptionSetHierarchies.d.ts +7 -0
- package/{lib/types/option-set-hierarchy-uploader.js → dist/commands/types/uploadOptionSetHierarchies.js} +130 -113
- package/dist/commands/types/uploadOptionSets.d.ts +7 -0
- package/{lib/types/option-set-uploader.js → dist/commands/types/uploadOptionSets.js} +115 -98
- package/dist/commands/types/uploadOptionSetsHierarchyLocalFile.d.ts +11 -0
- package/{lib/types/option-set-hierarchy-parser.js → dist/commands/types/uploadOptionSetsHierarchyLocalFile.js} +128 -140
- package/dist/commands/types/uploadRuleSets.d.ts +7 -0
- package/{lib/types/rule-set-uploader.js → dist/commands/types/uploadRuleSets.js} +189 -172
- package/dist/commands/types/uploadTypePropertyPolicies.d.ts +7 -0
- package/{lib/types/type-property-policy-uploader.js → dist/commands/types/uploadTypePropertyPolicies.js} +195 -178
- package/dist/commands/types/uploadUsageInfo.d.ts +7 -0
- package/{lib/types/usage-info-uploader.js → dist/commands/types/uploadUsageInfo.js} +149 -132
- package/dist/commands/users/export.d.ts +9 -0
- package/dist/commands/users/export.js +60 -0
- package/dist/commands/users/upload.d.ts +9 -0
- package/dist/commands/users/upload.js +65 -0
- package/dist/commands/workflow-template-definitions/install.d.ts +6 -0
- package/dist/commands/workflow-template-definitions/install.js +17 -0
- package/dist/commands/workflow-template-definitions/list.d.ts +6 -0
- package/dist/commands/workflow-template-definitions/list.js +17 -0
- package/dist/commands/workflow-templates/delete.d.ts +6 -0
- package/dist/commands/workflow-templates/delete.js +17 -0
- package/dist/commands/workflow-templates/list.d.ts +6 -0
- package/dist/commands/workflow-templates/list.js +17 -0
- package/dist/commands/workflow-templates/load.d.ts +9 -0
- package/dist/commands/workflow-templates/load.js +21 -0
- package/{lib → dist}/common.d.ts +1 -1
- package/dist/common.js +9 -0
- package/{lib/apps/deploy-app → dist/helpers/app}/actions-deployer.d.ts +11 -11
- package/{lib/apps/deploy-app → dist/helpers/app}/actions-deployer.js +122 -114
- package/{lib/apps/deploy-app → dist/helpers/app}/app-deployer.d.ts +8 -8
- package/{lib/apps/deploy-app → dist/helpers/app}/app-deployer.js +98 -93
- package/{lib/apps/deploy-app → dist/helpers/app}/app-template-parsers.d.ts +7 -7
- package/{lib/apps/deploy-app → dist/helpers/app}/app-template-parsers.js +43 -38
- package/dist/helpers/app/load-app-config.d.ts +1 -0
- package/dist/helpers/app/load-app-config.js +18 -0
- package/dist/helpers/app/setup-template.d.ts +1 -0
- package/dist/helpers/app/setup-template.js +38 -0
- package/dist/helpers/colors/helpers.d.ts +4 -0
- package/dist/helpers/colors/helpers.js +74 -0
- package/{lib → dist/helpers}/config/config.d.ts +6 -6
- package/dist/helpers/config/config.js +76 -0
- package/dist/helpers/loader-process/helpers.d.ts +2 -0
- package/{lib/loader-process/loader-process.js → dist/helpers/loader-process/helpers.js} +98 -120
- package/dist/helpers/projects/helpers.d.ts +2 -0
- package/{lib/projects/project-exporter.js → dist/helpers/projects/helpers.js} +165 -187
- package/{lib → dist/helpers}/types/csv-parser.d.ts +1 -1
- package/{lib → dist/helpers}/types/csv-parser.js +56 -51
- package/dist/helpers/types/type-extractor.d.ts +1 -0
- package/dist/helpers/types/type-extractor.js +32 -0
- package/dist/helpers/types/type-parser.d.ts +4 -0
- package/dist/helpers/types/type-parser.js +118 -0
- package/{lib/types/types-uploader.d.ts → dist/helpers/types/type-uploader.d.ts} +1 -1
- package/{lib/types/types-uploader.js → dist/helpers/types/type-uploader.js} +244 -239
- package/{lib → dist/helpers}/workflow-template-definitions/workflow-template-definition-deployer.d.ts +12 -12
- package/{lib → dist/helpers}/workflow-template-definitions/workflow-template-definition-deployer.js +156 -151
- package/{lib/workflow-templates/local-workflow-template-deployer.d.ts → dist/helpers/workflow-templates/helper.d.ts} +17 -11
- package/dist/helpers/workflow-templates/helper.js +166 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -0
- package/{lib → dist}/interfaces.d.ts +323 -191
- package/dist/interfaces.js +63 -0
- package/{templates → dist/templates}/typescript/Dockerfile +15 -15
- package/{templates → dist/templates}/typescript/README.md +10 -10
- package/{templates → dist/templates}/typescript/app.yml +49 -49
- package/{templates → dist/templates}/typescript/docker_deploy.bat +1 -1
- package/{templates → dist/templates}/typescript/package.json +54 -54
- package/{templates → dist/templates}/typescript/src/actions/logItem.ts +25 -25
- package/{templates → dist/templates}/typescript/src/framework/action-dispatcher.ts +89 -89
- package/{templates → dist/templates}/typescript/src/framework/app-config.ts +26 -26
- package/{templates → dist/templates}/typescript/src/framework/handler.ts +11 -11
- package/{templates → dist/templates}/typescript/src/framework/index.ts +2 -2
- package/{templates → dist/templates}/typescript/src/framework/interfaces.ts +32 -32
- package/{templates → dist/templates}/typescript/src/framework/logger.ts +21 -21
- package/{templates → dist/templates}/typescript/src/framework/mock-server.ts +31 -31
- package/{templates → dist/templates}/typescript/tsconfig.json +28 -28
- package/oclif.manifest.json +821 -0
- package/package.json +116 -72
- package/.eslintrc.js +0 -53
- package/.vscode/settings.json +0 -6
- package/bin/init +0 -4
- package/lib/api/apps.js +0 -85
- package/lib/api/event-workflow-action-definition.js +0 -7
- package/lib/api/event-workflow-template-definition.js +0 -20
- package/lib/api/event-workflow-templates.js +0 -25
- package/lib/apps/create-app/create.d.ts +0 -1
- package/lib/apps/create-app/create.js +0 -60
- package/lib/apps/create-app/setup-template.d.ts +0 -1
- package/lib/apps/create-app/setup-template.js +0 -34
- package/lib/apps/deploy-app/deploy.d.ts +0 -2
- package/lib/apps/deploy-app/deploy.js +0 -58
- package/lib/apps/install-app/app-installer.d.ts +0 -2
- package/lib/apps/install-app/app-installer.js +0 -120
- package/lib/apps/upgrade-app/app-upgrader.d.ts +0 -3
- package/lib/apps/upgrade-app/app-upgrader.js +0 -126
- package/lib/auth/auth.js +0 -2
- package/lib/cli.d.ts +0 -5
- package/lib/cli.js +0 -524
- package/lib/colors/color-loader.d.ts +0 -2
- package/lib/colors/color-loader.js +0 -96
- package/lib/common.js +0 -5
- package/lib/config/config.js +0 -70
- package/lib/config/configCommands.d.ts +0 -3
- package/lib/config/configCommands.js +0 -34
- package/lib/interfaces.js +0 -25
- package/lib/loader-process/loader-process.d.ts +0 -2
- package/lib/projects/interfaces.d.ts +0 -77
- package/lib/projects/interfaces.js +0 -23
- package/lib/projects/project-exporter.d.ts +0 -2
- package/lib/projects/project-uploader.d.ts +0 -1
- package/lib/types/allUploader.d.ts +0 -1
- package/lib/types/allUploader.js +0 -24
- package/lib/types/interfaces.d.ts +0 -55
- package/lib/types/interfaces.js +0 -1
- package/lib/types/option-set-hierarchy-exporter.d.ts +0 -1
- package/lib/types/option-set-hierarchy-parser.d.ts +0 -2
- package/lib/types/option-set-hierarchy-uploader.d.ts +0 -1
- package/lib/types/option-set-merger.d.ts +0 -1
- package/lib/types/option-set-parser.d.ts +0 -3
- package/lib/types/option-set-parser.js +0 -140
- package/lib/types/option-set-uploader.d.ts +0 -1
- package/lib/types/parse-types.d.ts +0 -4
- package/lib/types/parse-types.js +0 -189
- package/lib/types/rule-set-uploader.d.ts +0 -1
- package/lib/types/type-property-policy-uploader.d.ts +0 -1
- package/lib/types/types-properties-merger.d.ts +0 -1
- package/lib/types/types-properties-merger.js +0 -75
- package/lib/types/usage-info-uploader.d.ts +0 -1
- package/lib/users/user-exporter.d.ts +0 -1
- package/lib/users/user-exporter.js +0 -41
- package/lib/users/user-uploader.d.ts +0 -1
- package/lib/users/user-uploader.js +0 -45
- package/lib/workflow-template-definitions/workflow-template-definition-commands.d.ts +0 -2
- package/lib/workflow-template-definitions/workflow-template-definition-commands.js +0 -10
- package/lib/workflow-templates/local-workflow-template-deployer.js +0 -102
- package/lib/workflow-templates/workflow-template-commands.d.ts +0 -4
- package/lib/workflow-templates/workflow-template-commands.js +0 -51
- package/lib/workflow-templates/workflow-template-deployer.d.ts +0 -4
- package/lib/workflow-templates/workflow-template-deployer.js +0 -26
- package/publish.bat +0 -5
- package/publish.sh +0 -5
- package/src/api/apps.ts +0 -97
- package/src/api/event-workflow-action-definition.ts +0 -8
- package/src/api/event-workflow-template-definition.ts +0 -23
- package/src/api/event-workflow-templates.ts +0 -29
- package/src/apps/create-app/create.ts +0 -74
- package/src/apps/create-app/setup-template.ts +0 -38
- package/src/apps/deploy-app/actions-deployer.ts +0 -140
- package/src/apps/deploy-app/app-deployer.ts +0 -105
- package/src/apps/deploy-app/app-template-parsers.ts +0 -44
- package/src/apps/deploy-app/deploy.ts +0 -66
- package/src/apps/install-app/app-installer.ts +0 -126
- package/src/apps/upgrade-app/app-upgrader.ts +0 -132
- package/src/auth/auth.ts +0 -10
- package/src/auth/login.ts +0 -155
- package/src/cli.ts +0 -540
- package/src/colors/color-loader.ts +0 -112
- package/src/colors/colors.csv +0 -866
- package/src/common.ts +0 -5
- package/src/config/config.ts +0 -74
- package/src/config/configCommands.ts +0 -38
- package/src/interfaces.ts +0 -200
- package/src/loader-process/loader-process.ts +0 -152
- package/src/projects/interfaces.ts +0 -73
- package/src/projects/project-exporter.ts +0 -225
- package/src/projects/project-uploader.ts +0 -131
- package/src/types/allUploader.ts +0 -28
- package/src/types/csv-parser.ts +0 -59
- package/src/types/interfaces.ts +0 -58
- package/src/types/option-set-hierarchy-exporter.ts +0 -125
- package/src/types/option-set-hierarchy-parser.ts +0 -169
- package/src/types/option-set-hierarchy-uploader.ts +0 -122
- package/src/types/option-set-merger.ts +0 -124
- package/src/types/option-set-parser.ts +0 -166
- package/src/types/option-set-uploader.ts +0 -108
- package/src/types/parse-types.ts +0 -227
- package/src/types/rule-set-uploader.ts +0 -187
- package/src/types/type-property-policy-uploader.ts +0 -192
- package/src/types/types-extractor.ts +0 -369
- package/src/types/types-properties-merger.ts +0 -90
- package/src/types/types-uploader.ts +0 -271
- package/src/types/usage-info-uploader.ts +0 -139
- package/src/users/user-exporter.ts +0 -52
- package/src/users/user-uploader.ts +0 -58
- package/src/workflow-template-definitions/workflow-template-definition-commands.ts +0 -13
- package/src/workflow-template-definitions/workflow-template-definition-deployer.ts +0 -184
- package/src/workflow-templates/local-workflow-template-deployer.ts +0 -126
- package/src/workflow-templates/workflow-template-commands.ts +0 -59
- package/src/workflow-templates/workflow-template-deployer.ts +0 -30
- package/templates/javascript/actions/example/action.js +0 -38
- package/templates/javascript/app.yml +0 -53
- package/templates/javascript/package.json +0 -23
- package/templates/typescript/package-lock.json +0 -14
- package/tsconfig.json +0 -32
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { deleteConfigs, readVibeIQConfig, storeConfig } from './config';
|
|
2
|
-
export async function listConfig() {
|
|
3
|
-
console.log(await readVibeIQConfig());
|
|
4
|
-
}
|
|
5
|
-
export async function setConfig(args) {
|
|
6
|
-
const helpConfigLine = `
|
|
7
|
-
Usage:
|
|
8
|
-
contrail config.set key1=value1 key2=value2
|
|
9
|
-
`;
|
|
10
|
-
if ((args === null || args === void 0 ? void 0 : args.length) < 4) {
|
|
11
|
-
console.log(helpConfigLine);
|
|
12
|
-
throw new Error('You need to pass at least one config to set');
|
|
13
|
-
}
|
|
14
|
-
const configsToSet = args.slice(3);
|
|
15
|
-
const config = {};
|
|
16
|
-
for (const conf of configsToSet) {
|
|
17
|
-
if (conf.length < 3 || conf.indexOf('=') <= 0) {
|
|
18
|
-
console.log(helpConfigLine);
|
|
19
|
-
throw new Error(`value ${conf} does not adhere to key1=value1 standard`);
|
|
20
|
-
}
|
|
21
|
-
const [key, value] = conf.split('=');
|
|
22
|
-
console.log('key and value:', key, value);
|
|
23
|
-
console.log(conf.split('='));
|
|
24
|
-
config[key] = value;
|
|
25
|
-
}
|
|
26
|
-
console.log('config is:', config);
|
|
27
|
-
await storeConfig(config);
|
|
28
|
-
}
|
|
29
|
-
export async function removeConfig(args) {
|
|
30
|
-
if ((args === null || args === void 0 ? void 0 : args.length) < 4) {
|
|
31
|
-
throw new Error('At least one configuration must be included to be removed.');
|
|
32
|
-
}
|
|
33
|
-
await deleteConfigs(args.slice(3));
|
|
34
|
-
}
|
package/lib/interfaces.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export var AppOrgStatus;
|
|
2
|
-
(function (AppOrgStatus) {
|
|
3
|
-
AppOrgStatus["INSTALLING"] = "INSTALLING";
|
|
4
|
-
AppOrgStatus["FAILED_INSTALLING"] = "FAILED_INSTALLING";
|
|
5
|
-
AppOrgStatus["READY"] = "READY";
|
|
6
|
-
AppOrgStatus["DELETING"] = "DELETING";
|
|
7
|
-
AppOrgStatus["FAILED_DELETING"] = "FAILED_DELETING";
|
|
8
|
-
})(AppOrgStatus || (AppOrgStatus = {}));
|
|
9
|
-
export var AppVersionStatus;
|
|
10
|
-
(function (AppVersionStatus) {
|
|
11
|
-
AppVersionStatus["PUBLISHING"] = "PUBLISHING";
|
|
12
|
-
AppVersionStatus["FAILED_PUBLISHING"] = "FAILED_PUBLISHING";
|
|
13
|
-
AppVersionStatus["PUBLISHED"] = "PUBLISHED";
|
|
14
|
-
AppVersionStatus["ARCHIVING"] = "ARCHIVING";
|
|
15
|
-
AppVersionStatus["FAILED_ARCHIVING"] = "FAILED_ARCHIVING";
|
|
16
|
-
AppVersionStatus["ARCHIVED"] = "ARCHIVED";
|
|
17
|
-
})(AppVersionStatus || (AppVersionStatus = {}));
|
|
18
|
-
export class AppVersion {
|
|
19
|
-
}
|
|
20
|
-
export class AppApiKey {
|
|
21
|
-
}
|
|
22
|
-
export class ConfigProperty {
|
|
23
|
-
}
|
|
24
|
-
export class TriggerKeyDefinition {
|
|
25
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
export declare class CommonConfiguration {
|
|
2
|
-
[key: string]: any;
|
|
3
|
-
}
|
|
4
|
-
export declare enum AssortmentType {
|
|
5
|
-
ASSORTMENT = "ASSORTMENT",
|
|
6
|
-
BOARD = "BOARD",
|
|
7
|
-
PLAN = "PLAN",
|
|
8
|
-
SHOWCASE = "SHOWCASE"
|
|
9
|
-
}
|
|
10
|
-
export declare class AssortmentConfiguration {
|
|
11
|
-
identifier: string;
|
|
12
|
-
name: string;
|
|
13
|
-
type: AssortmentType;
|
|
14
|
-
sourceAssortmentIdentifier?: string;
|
|
15
|
-
composedFromAssortmentIdentifiers?: string[];
|
|
16
|
-
ownerAtts?: {
|
|
17
|
-
[key: string]: any;
|
|
18
|
-
};
|
|
19
|
-
assortmentAtts?: {
|
|
20
|
-
[key: string]: any;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
export declare class Folder {
|
|
24
|
-
identifier: string;
|
|
25
|
-
name: string;
|
|
26
|
-
principals: string[];
|
|
27
|
-
assortments: AssortmentConfiguration[];
|
|
28
|
-
subFolders: Folder[];
|
|
29
|
-
}
|
|
30
|
-
export declare class ProjectConfiguration {
|
|
31
|
-
projectName: string;
|
|
32
|
-
identifier: string;
|
|
33
|
-
commonConfig: CommonConfiguration;
|
|
34
|
-
principals: string[];
|
|
35
|
-
assortments: AssortmentConfiguration[];
|
|
36
|
-
subFolders: Folder[];
|
|
37
|
-
}
|
|
38
|
-
export declare class ProjectConfigurationTemplate {
|
|
39
|
-
projectName: string;
|
|
40
|
-
identifier: string;
|
|
41
|
-
commonConfig: CommonConfiguration;
|
|
42
|
-
principals: string[];
|
|
43
|
-
allFolders: FolderSlim[];
|
|
44
|
-
allAssortments: AssortmentConfigurationSlim[];
|
|
45
|
-
allAssortmentRelationships: AssortmentConfigurationRelationships[];
|
|
46
|
-
}
|
|
47
|
-
export declare class FolderSlim {
|
|
48
|
-
identifier: string;
|
|
49
|
-
name: string;
|
|
50
|
-
principals: string[];
|
|
51
|
-
folderIdentifier: string;
|
|
52
|
-
}
|
|
53
|
-
export declare class AssortmentConfigurationSlim {
|
|
54
|
-
identifier: string;
|
|
55
|
-
name: string;
|
|
56
|
-
type: AssortmentType;
|
|
57
|
-
folderIdentifier: string;
|
|
58
|
-
sourceAssortmentIdentifier?: string;
|
|
59
|
-
composedFromAssortmentIdentifiers?: string[];
|
|
60
|
-
ownerAtts?: {
|
|
61
|
-
[key: string]: any;
|
|
62
|
-
};
|
|
63
|
-
assortmentAtts?: {
|
|
64
|
-
[key: string]: any;
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
export declare class AssortmentConfigurationRelationships {
|
|
68
|
-
identifier: string;
|
|
69
|
-
sourceAssortmentIdentifier?: string;
|
|
70
|
-
composedFromAssortmentIdentifiers?: string[];
|
|
71
|
-
ownerAtts?: {
|
|
72
|
-
[key: string]: any;
|
|
73
|
-
};
|
|
74
|
-
assortmentAtts?: {
|
|
75
|
-
[key: string]: any;
|
|
76
|
-
};
|
|
77
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export class CommonConfiguration {
|
|
2
|
-
}
|
|
3
|
-
export var AssortmentType;
|
|
4
|
-
(function (AssortmentType) {
|
|
5
|
-
AssortmentType["ASSORTMENT"] = "ASSORTMENT";
|
|
6
|
-
AssortmentType["BOARD"] = "BOARD";
|
|
7
|
-
AssortmentType["PLAN"] = "PLAN";
|
|
8
|
-
AssortmentType["SHOWCASE"] = "SHOWCASE";
|
|
9
|
-
})(AssortmentType || (AssortmentType = {}));
|
|
10
|
-
export class AssortmentConfiguration {
|
|
11
|
-
}
|
|
12
|
-
export class Folder {
|
|
13
|
-
}
|
|
14
|
-
export class ProjectConfiguration {
|
|
15
|
-
}
|
|
16
|
-
export class ProjectConfigurationTemplate {
|
|
17
|
-
}
|
|
18
|
-
export class FolderSlim {
|
|
19
|
-
}
|
|
20
|
-
export class AssortmentConfigurationSlim {
|
|
21
|
-
}
|
|
22
|
-
export class AssortmentConfigurationRelationships {
|
|
23
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function configureProject(args: any): Promise<void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function uploadAll(): Promise<void>;
|
package/lib/types/allUploader.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { authUser } from '../auth/login';
|
|
3
|
-
import { UploadOptionSets } from './option-set-uploader';
|
|
4
|
-
import { UploadOptionSetHierarchies } from './option-set-hierarchy-uploader';
|
|
5
|
-
import { uploadTypes } from './types-uploader';
|
|
6
|
-
import { uploadUsageInfo } from './usage-info-uploader';
|
|
7
|
-
import { uploadRuleSets } from './rule-set-uploader';
|
|
8
|
-
import { uploadTypePropertyPolicies } from './type-property-policy-uploader';
|
|
9
|
-
export async function uploadAll() {
|
|
10
|
-
try {
|
|
11
|
-
await authUser();
|
|
12
|
-
await UploadOptionSets(null);
|
|
13
|
-
await UploadOptionSetHierarchies(null);
|
|
14
|
-
await uploadTypes();
|
|
15
|
-
await uploadUsageInfo(null);
|
|
16
|
-
await uploadRuleSets(null);
|
|
17
|
-
await uploadTypePropertyPolicies(null);
|
|
18
|
-
}
|
|
19
|
-
catch (e) {
|
|
20
|
-
console.log(`%s Types Upload Failed. ${e}`, chalk.red.bold('FAIL'));
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
console.log('%s Types Upload Complete.', chalk.green.bold('COMPLETE'));
|
|
24
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
export interface ReducedType {
|
|
2
|
-
slug: string;
|
|
3
|
-
label: string;
|
|
4
|
-
typePath: string;
|
|
5
|
-
isArchived: boolean;
|
|
6
|
-
typeProperties: ReducedTypeProperty[];
|
|
7
|
-
}
|
|
8
|
-
export interface ReducedTypeProperty {
|
|
9
|
-
id: string;
|
|
10
|
-
isArchived: boolean;
|
|
11
|
-
propertyType: PropertyType;
|
|
12
|
-
slug: string;
|
|
13
|
-
label: string;
|
|
14
|
-
editable: boolean;
|
|
15
|
-
searchable: boolean;
|
|
16
|
-
core: boolean;
|
|
17
|
-
typePropertyOptionSetName: string;
|
|
18
|
-
formula: string;
|
|
19
|
-
referencedTypeRootSlug: string;
|
|
20
|
-
defaultValue: string;
|
|
21
|
-
propertyLevel: string;
|
|
22
|
-
inherited: boolean;
|
|
23
|
-
formulaFunction?: string;
|
|
24
|
-
validationFunction?: string;
|
|
25
|
-
numberFormat?: any;
|
|
26
|
-
}
|
|
27
|
-
export interface ReducedOptionSet {
|
|
28
|
-
name: string;
|
|
29
|
-
isArchived: boolean;
|
|
30
|
-
optionSet: any[];
|
|
31
|
-
}
|
|
32
|
-
export declare enum PropertyType {
|
|
33
|
-
Text = "text",
|
|
34
|
-
String = "string",
|
|
35
|
-
Number = "number",
|
|
36
|
-
Date = "date",
|
|
37
|
-
Boolean = "boolean",
|
|
38
|
-
MultiSelect = "multi_select",
|
|
39
|
-
SingleSelect = "choice",
|
|
40
|
-
Url = "url",
|
|
41
|
-
Currency = "currency",
|
|
42
|
-
Percent = "percent",
|
|
43
|
-
Rating = "rating",
|
|
44
|
-
Formula = "formula",
|
|
45
|
-
ObjectReference = "object_reference",
|
|
46
|
-
ObjectReferenceList = "object_ref_list",
|
|
47
|
-
DataGrid = "data_grid",
|
|
48
|
-
CascadingSelect = "cascading_select",
|
|
49
|
-
Sequence = "sequence",
|
|
50
|
-
Constant = "constant",
|
|
51
|
-
Composite = "composite",
|
|
52
|
-
UserList = "userList",
|
|
53
|
-
Image = "image",
|
|
54
|
-
Json = "json"
|
|
55
|
-
}
|
package/lib/types/interfaces.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function ExportOptionSetsHierarchies(): Promise<void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function UploadOptionSetHierarchies(args: any): Promise<void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function MergeOptionSets(args: any): Promise<void>;
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import { getSeparatorByPlatform } from '../common';
|
|
3
|
-
import { parseOptionSets } from '@contrail/types';
|
|
4
|
-
import { StringUtil } from '@contrail/util';
|
|
5
|
-
import chalk from 'chalk';
|
|
6
|
-
const csv = require('csvtojson');
|
|
7
|
-
const yaml = require('js-yaml');
|
|
8
|
-
import * as path from 'path';
|
|
9
|
-
export async function ParseOptionSetsLocalFiles(args) {
|
|
10
|
-
try {
|
|
11
|
-
if ((args === null || args === void 0 ? void 0 : args.length) < 4) {
|
|
12
|
-
throw new Error('File name must be included.');
|
|
13
|
-
}
|
|
14
|
-
console.log('%s Importing local file', chalk.yellow.bold('OPTION SET PARSE'));
|
|
15
|
-
const fileLocation = args[3];
|
|
16
|
-
const csvStyle = args[4];
|
|
17
|
-
console.log('Using File: ', fileLocation);
|
|
18
|
-
await parseOptionSetsLocalFiles(fileLocation, csvStyle);
|
|
19
|
-
console.log('%s Parsed', chalk.yellow.bold('OPTION SET PARSE'));
|
|
20
|
-
}
|
|
21
|
-
catch (e) {
|
|
22
|
-
console.log(`%s PARSE Failed. ${e}`, chalk.red.bold('FAIL'));
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
console.log('%s PARSE Complete.', chalk.green.bold('COMPLETE'));
|
|
26
|
-
}
|
|
27
|
-
export async function ParseOptionSetsToFolderStructure(args) {
|
|
28
|
-
try {
|
|
29
|
-
if ((args === null || args === void 0 ? void 0 : args.length) < 4) {
|
|
30
|
-
throw new Error('File name must be included.');
|
|
31
|
-
}
|
|
32
|
-
console.log('%s Importing local file', chalk.yellow.bold('OPTION SET PARSE'));
|
|
33
|
-
const fileLocation = args[3];
|
|
34
|
-
console.log('Using File: ', fileLocation);
|
|
35
|
-
await parseOptionSetsToFolderStructure(fileLocation);
|
|
36
|
-
console.log('%s Parsed', chalk.yellow.bold('OPTION SET PARSE'));
|
|
37
|
-
}
|
|
38
|
-
catch (e) {
|
|
39
|
-
console.log(`%s PARSE Failed. ${e}`, chalk.red.bold('FAIL'));
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
console.log('%s PARSE Complete.', chalk.green.bold('COMPLETE'));
|
|
43
|
-
}
|
|
44
|
-
async function loadOptionSetCSV(fileLocation) {
|
|
45
|
-
const TARGET_DIR = process.cwd();
|
|
46
|
-
try {
|
|
47
|
-
const separator = getSeparatorByPlatform();
|
|
48
|
-
const fullPath = TARGET_DIR + separator + fileLocation;
|
|
49
|
-
console.log('Getting file from path: ', fullPath);
|
|
50
|
-
return await csv().fromFile(fullPath);
|
|
51
|
-
}
|
|
52
|
-
catch (e) {
|
|
53
|
-
throw new Error(`ERROR PARSING CSV: ${e}`);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function loadOptionSets(fileLocation) {
|
|
57
|
-
const TARGET_DIR = process.cwd();
|
|
58
|
-
try {
|
|
59
|
-
const separator = getSeparatorByPlatform();
|
|
60
|
-
const fullPath = TARGET_DIR + separator + fileLocation;
|
|
61
|
-
console.log('Getting file from path: ', fullPath);
|
|
62
|
-
const doc = yaml.load(fs.readFileSync(TARGET_DIR + separator + fileLocation, 'utf8'));
|
|
63
|
-
return doc;
|
|
64
|
-
}
|
|
65
|
-
catch (e) {
|
|
66
|
-
throw new Error(`ERROR PARSING YAML: ${e}`);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
async function parseOptionSetsLocalFiles(fileLocation, csvStyle) {
|
|
70
|
-
const uploadedOptionData = await loadOptionSetCSV(fileLocation);
|
|
71
|
-
if (csvStyle === 'NameAndLabel') {
|
|
72
|
-
const parsedOptionSets = parseOptionSets(uploadedOptionData);
|
|
73
|
-
saveData(parsedOptionSets);
|
|
74
|
-
}
|
|
75
|
-
if (csvStyle === 'LabelsInColumn') {
|
|
76
|
-
const parsedOptionSets = parseLabelsInColumn(uploadedOptionData);
|
|
77
|
-
saveData(parsedOptionSets);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
async function parseOptionSetsToFolderStructure(fileLocation) {
|
|
81
|
-
const uploadedOptionData = await loadOptionSets(fileLocation);
|
|
82
|
-
saveDataInFolders(uploadedOptionData);
|
|
83
|
-
}
|
|
84
|
-
function saveData(data) {
|
|
85
|
-
const yamlStr = yaml.dump(data);
|
|
86
|
-
const CURRENT_DIR = process.cwd();
|
|
87
|
-
const separator = getSeparatorByPlatform();
|
|
88
|
-
fs.writeFileSync(CURRENT_DIR + separator + 'parsed_local_optionSets.yml', yamlStr, 'utf8');
|
|
89
|
-
}
|
|
90
|
-
function saveDataInFolders(data) {
|
|
91
|
-
const folder = { filename: 'option-sets', split: true, fileLabel: 'name' };
|
|
92
|
-
const dir = 'merged_option_sets';
|
|
93
|
-
const CURRENT_DIR = process.cwd();
|
|
94
|
-
const subDir = path.join(CURRENT_DIR, dir, folder.filename);
|
|
95
|
-
if (!fs.existsSync(subDir)) {
|
|
96
|
-
fs.mkdirSync(subDir, { recursive: true });
|
|
97
|
-
}
|
|
98
|
-
for (const item of data) {
|
|
99
|
-
const yamlStr = yaml.dump(item);
|
|
100
|
-
const fileLabel = item[folder.fileLabel];
|
|
101
|
-
if (!fileLabel) {
|
|
102
|
-
console.warn('skipping bad data:', item);
|
|
103
|
-
}
|
|
104
|
-
fs.writeFileSync(path.join(subDir, `${removeSlash(fileLabel)}.yml`), yamlStr, 'utf8');
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
function removeSlash(string) {
|
|
108
|
-
const re = /\//gi;
|
|
109
|
-
return string.replace(re, '-');
|
|
110
|
-
}
|
|
111
|
-
export function parseLabelsInColumn(uploadedOptionData) {
|
|
112
|
-
const optionSets = [];
|
|
113
|
-
const optionSetNames = Object.keys(uploadedOptionData[0]);
|
|
114
|
-
for (const optionSetName of optionSetNames) {
|
|
115
|
-
const uniqueOptionSetValues = new Set();
|
|
116
|
-
for (const data of uploadedOptionData) {
|
|
117
|
-
const label = data[optionSetName];
|
|
118
|
-
uniqueOptionSetValues.add(label);
|
|
119
|
-
}
|
|
120
|
-
const optionSet = [];
|
|
121
|
-
if (uniqueOptionSetValues) {
|
|
122
|
-
for (const entry of uniqueOptionSetValues.values()) {
|
|
123
|
-
if (entry === '') {
|
|
124
|
-
continue;
|
|
125
|
-
}
|
|
126
|
-
optionSet.push({
|
|
127
|
-
value: StringUtil.convertToCamelCase(entry),
|
|
128
|
-
display: entry,
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
const reducedOptionSet = {
|
|
133
|
-
name: optionSetName,
|
|
134
|
-
isArchived: false,
|
|
135
|
-
optionSet,
|
|
136
|
-
};
|
|
137
|
-
optionSets.push(reducedOptionSet);
|
|
138
|
-
}
|
|
139
|
-
return optionSets;
|
|
140
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function UploadOptionSets(args: any): Promise<void>;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare function ParseTypesFromLocalFiles(args: any): Promise<void>;
|
|
2
|
-
export declare function ParseTypesFromFiles(args: any): Promise<void>;
|
|
3
|
-
export declare function ParseTypesFromTemplateFromLocalFiles(args: any): Promise<void>;
|
|
4
|
-
export declare function ParseTypesFromTemplateAndDataFromLocalFiles(args: any): Promise<void>;
|
package/lib/types/parse-types.js
DELETED
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import { GetSuggestedTypes, GetTypesFromTemplate, GetTypesFromTemplateWithOptionSetsFromData } from '@contrail/types';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import fs from 'fs';
|
|
4
|
-
import { getSeparatorByPlatform } from '../common';
|
|
5
|
-
import * as csvToJson from 'csvtojson';
|
|
6
|
-
import { authUser } from '../auth/login';
|
|
7
|
-
import { getCSVFromFile } from './csv-parser';
|
|
8
|
-
const yaml = require('js-yaml');
|
|
9
|
-
// This uses local files to get the data to parse into types
|
|
10
|
-
export async function ParseTypesFromLocalFiles(args) {
|
|
11
|
-
try {
|
|
12
|
-
if ((args === null || args === void 0 ? void 0 : args.length) < 4) {
|
|
13
|
-
throw new Error('File names must be included.');
|
|
14
|
-
}
|
|
15
|
-
console.log('%s Parsing', chalk.yellow.bold('TYPES AND OPTION SETS'));
|
|
16
|
-
const fileLocations = args.slice(3);
|
|
17
|
-
console.log('Using File Location(s): ', fileLocations);
|
|
18
|
-
await parseTypesFromLocalFiles(fileLocations);
|
|
19
|
-
console.log('%s Parsed', chalk.yellow.bold('TYPES AND OPTION SETS'));
|
|
20
|
-
}
|
|
21
|
-
catch (e) {
|
|
22
|
-
console.log(`%s Parsing Failed. ${e}`, chalk.red.bold('FAIL'));
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
console.log('%s Parsing Complete.', chalk.green.bold('COMPLETE'));
|
|
26
|
-
}
|
|
27
|
-
// This uses VibeIq file ids to get the data to parse into types
|
|
28
|
-
export async function ParseTypesFromFiles(args) {
|
|
29
|
-
try {
|
|
30
|
-
if ((args === null || args === void 0 ? void 0 : args.length) < 4) {
|
|
31
|
-
throw new Error('File ids must be included.');
|
|
32
|
-
}
|
|
33
|
-
console.log('%s Parsing', chalk.yellow.bold('TYPES AND OPTION SETS'));
|
|
34
|
-
const fileIds = args.slice(3);
|
|
35
|
-
console.log('Using FileId(s): ', fileIds);
|
|
36
|
-
await parseTypesFromFiles(fileIds);
|
|
37
|
-
console.log('%s Parsed', chalk.yellow.bold('TYPES AND OPTION SETS'));
|
|
38
|
-
}
|
|
39
|
-
catch (e) {
|
|
40
|
-
console.log(`%s Parsing Failed. ${e}`, chalk.red.bold('FAIL'));
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
console.log('%s Parsing Complete.', chalk.green.bold('COMPLETE'));
|
|
44
|
-
}
|
|
45
|
-
// This uses local files to get type template file and the data file to parse into types
|
|
46
|
-
export async function ParseTypesFromTemplateFromLocalFiles(args) {
|
|
47
|
-
try {
|
|
48
|
-
if ((args === null || args === void 0 ? void 0 : args.length) < 5) {
|
|
49
|
-
throw new Error('File names must be included.');
|
|
50
|
-
}
|
|
51
|
-
console.log('%s Parsing', chalk.yellow.bold('TYPES AND OPTION SETS'));
|
|
52
|
-
const templateFileLocation = args[3];
|
|
53
|
-
const dataFileLocation = args[4];
|
|
54
|
-
console.log('Using Template File Location: ', templateFileLocation);
|
|
55
|
-
console.log('Using Data File Location: ', dataFileLocation);
|
|
56
|
-
await parseTypesFromTemplateFromLocalFiles(templateFileLocation, dataFileLocation);
|
|
57
|
-
console.log('%s Parsed', chalk.yellow.bold('TYPES AND OPTION SETS'));
|
|
58
|
-
}
|
|
59
|
-
catch (e) {
|
|
60
|
-
console.log(`%s Parsing Failed. ${e}`, chalk.red.bold('FAIL'));
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
console.log('%s Parsing Complete.', chalk.green.bold('COMPLETE'));
|
|
64
|
-
}
|
|
65
|
-
export async function ParseTypesFromTemplateAndDataFromLocalFiles(args) {
|
|
66
|
-
try {
|
|
67
|
-
if ((args === null || args === void 0 ? void 0 : args.length) < 5) {
|
|
68
|
-
throw new Error('File names must be included.');
|
|
69
|
-
}
|
|
70
|
-
console.log('%s Parsing', chalk.yellow.bold('TYPES AND OPTION SETS'));
|
|
71
|
-
const templateFileLocation = args[3];
|
|
72
|
-
const dataFileLocations = args.slice(4);
|
|
73
|
-
console.log('Using Template File Location: ', templateFileLocation);
|
|
74
|
-
console.log('Using Data File Location: ', dataFileLocations);
|
|
75
|
-
await parseTypesFromTemplateAndDataFromLocalFiles(templateFileLocation, dataFileLocations);
|
|
76
|
-
console.log('%s Parsed', chalk.yellow.bold('TYPES AND OPTION SETS'));
|
|
77
|
-
}
|
|
78
|
-
catch (e) {
|
|
79
|
-
console.log(`%s Parsing Failed. ${e}`, chalk.red.bold('FAIL'));
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
console.log('%s Parsing Complete.', chalk.green.bold('COMPLETE'));
|
|
83
|
-
}
|
|
84
|
-
async function loadDataFromLocalCSV(fileName) {
|
|
85
|
-
const CURRENT_DIR = process.cwd();
|
|
86
|
-
try {
|
|
87
|
-
const separator = getSeparatorByPlatform();
|
|
88
|
-
const fullPath = CURRENT_DIR + separator + fileName;
|
|
89
|
-
console.log('Getting file from path: ', fullPath);
|
|
90
|
-
const csvData = await csvToJson.default({ flatKeys: true }).fromFile(fullPath);
|
|
91
|
-
return csvData;
|
|
92
|
-
}
|
|
93
|
-
catch (e) {
|
|
94
|
-
throw new Error(`ERROR PARSING CSV: ${e}`);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
async function parseTypesFromLocalFiles(fileLocations) {
|
|
98
|
-
const csvJSONData = [];
|
|
99
|
-
for (const fileLocation of fileLocations) {
|
|
100
|
-
try {
|
|
101
|
-
console.log('Getting data for fileLocation: ', fileLocation);
|
|
102
|
-
const csvData = await loadDataFromLocalCSV(fileLocation);
|
|
103
|
-
console.log(`CSV import was successful. ${csvData === null || csvData === void 0 ? void 0 : csvData.length} rows found. Adding to total rows.`);
|
|
104
|
-
csvJSONData.push(...csvData);
|
|
105
|
-
}
|
|
106
|
-
catch (e) {
|
|
107
|
-
console.log('Error importing csv data.', e);
|
|
108
|
-
throw e;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
console.log(`CSV imports were successful. ${csvJSONData === null || csvJSONData === void 0 ? void 0 : csvJSONData.length} total rows found.`);
|
|
112
|
-
const suggestions = GetSuggestedTypes(csvJSONData);
|
|
113
|
-
saveData(suggestions.OptionSets, 'parsed_optionSets.yml');
|
|
114
|
-
saveData({ typeProperties: suggestions.TypeProperties }, 'parsed_typeProperties.yml');
|
|
115
|
-
}
|
|
116
|
-
async function parseTypesFromTemplateFromLocalFiles(templateFileLocation, dataFileLocation) {
|
|
117
|
-
let templateCSVData = [];
|
|
118
|
-
let dataCSVData = [];
|
|
119
|
-
try {
|
|
120
|
-
console.log('Getting template from fileLocation: ', templateFileLocation);
|
|
121
|
-
templateCSVData = await loadDataFromLocalCSV(templateFileLocation);
|
|
122
|
-
console.log(`CSV import was successful. ${templateCSVData === null || templateCSVData === void 0 ? void 0 : templateCSVData.length} rows found.`);
|
|
123
|
-
console.log('Getting data from fileLocation: ', dataFileLocation);
|
|
124
|
-
dataCSVData = await loadDataFromLocalCSV(dataFileLocation);
|
|
125
|
-
console.log(`CSV import was successful. ${dataCSVData === null || dataCSVData === void 0 ? void 0 : dataCSVData.length} rows found.`);
|
|
126
|
-
}
|
|
127
|
-
catch (e) {
|
|
128
|
-
console.log('Error importing csv data.', e);
|
|
129
|
-
throw e;
|
|
130
|
-
}
|
|
131
|
-
const types = GetTypesFromTemplate(templateCSVData, dataCSVData);
|
|
132
|
-
saveData(types.OptionSets, 'parsed_optionSets.yml');
|
|
133
|
-
saveData({ TypePropertiesByEntity: types.TypePropertiesByEntity }, 'parsed_TypePropertiesByEntity.yml');
|
|
134
|
-
}
|
|
135
|
-
async function parseTypesFromTemplateAndDataFromLocalFiles(templateFileLocation, dataFileLocations) {
|
|
136
|
-
let templateCSVData = [];
|
|
137
|
-
try {
|
|
138
|
-
console.log('Getting template from fileLocation: ', templateFileLocation);
|
|
139
|
-
templateCSVData = await loadDataFromLocalCSV(templateFileLocation);
|
|
140
|
-
console.log(`CSV import was successful. ${templateCSVData === null || templateCSVData === void 0 ? void 0 : templateCSVData.length} rows found.`);
|
|
141
|
-
}
|
|
142
|
-
catch (e) {
|
|
143
|
-
console.log('Error importing csv data.', e);
|
|
144
|
-
throw e;
|
|
145
|
-
}
|
|
146
|
-
const dataCSVData = [];
|
|
147
|
-
for (const dataFileLocation of dataFileLocations) {
|
|
148
|
-
try {
|
|
149
|
-
console.log('Getting data for dataFileLocation: ', dataFileLocation);
|
|
150
|
-
const csvData = await loadDataFromLocalCSV(dataFileLocation);
|
|
151
|
-
console.log(`CSV import was successful. ${csvData === null || csvData === void 0 ? void 0 : csvData.length} rows found. Adding to total rows.`);
|
|
152
|
-
dataCSVData.push(...csvData);
|
|
153
|
-
}
|
|
154
|
-
catch (e) {
|
|
155
|
-
console.log('Error importing csv data.', e);
|
|
156
|
-
throw e;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
const types = GetTypesFromTemplateWithOptionSetsFromData(templateCSVData, dataCSVData);
|
|
160
|
-
saveData(types.OptionSets, 'parsed_optionSets.yml');
|
|
161
|
-
saveData({ TypePropertiesByEntity: types.TypePropertiesByEntity }, 'parsed_TypePropertiesByEntity.yml');
|
|
162
|
-
}
|
|
163
|
-
async function parseTypesFromFiles(fileIds) {
|
|
164
|
-
await authUser();
|
|
165
|
-
// get csv data
|
|
166
|
-
const csvJSONData = [];
|
|
167
|
-
for (const loadFileId of fileIds) {
|
|
168
|
-
try {
|
|
169
|
-
console.log('Getting data for fileId: ', loadFileId);
|
|
170
|
-
const csvJSON = await getCSVFromFile(loadFileId);
|
|
171
|
-
console.log(`CSV download was successful. ${csvJSON === null || csvJSON === void 0 ? void 0 : csvJSON.length} rows found. Adding to total rows`);
|
|
172
|
-
csvJSONData.push(...csvJSON);
|
|
173
|
-
}
|
|
174
|
-
catch (e) {
|
|
175
|
-
console.log('Error retrieving csv data', e);
|
|
176
|
-
throw e;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
console.log(`CSV downloads were successful. ${csvJSONData === null || csvJSONData === void 0 ? void 0 : csvJSONData.length} total rows found.`);
|
|
180
|
-
const suggestions = GetSuggestedTypes(csvJSONData);
|
|
181
|
-
saveData(suggestions.OptionSets, 'parsed_optionSets.yml');
|
|
182
|
-
saveData({ typeProperties: suggestions.TypeProperties }, 'parsed_typeProperties.yml');
|
|
183
|
-
}
|
|
184
|
-
function saveData(data, name) {
|
|
185
|
-
const yamlStr = yaml.dump(data);
|
|
186
|
-
const CURRENT_DIR = process.cwd();
|
|
187
|
-
const separator = getSeparatorByPlatform();
|
|
188
|
-
fs.writeFileSync(CURRENT_DIR + separator + name, yamlStr, 'utf8');
|
|
189
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function uploadRuleSets(args: any): Promise<void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function uploadTypePropertyPolicies(args: any): Promise<void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function MergeTypeProperties(args: any): Promise<void>;
|