@contrail/cli 2.2.8 → 2.3.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.
Files changed (83) hide show
  1. package/README.md +135 -367
  2. package/dist/api/apps.js +1 -2
  3. package/dist/auth/auth.js +1 -0
  4. package/dist/basecommand.js +16 -19
  5. package/dist/commands/app/create.js +5 -5
  6. package/dist/commands/app/delete.js +7 -7
  7. package/dist/commands/app/getApiKey.js +8 -8
  8. package/dist/commands/app/init.js +5 -5
  9. package/dist/commands/app/install.js +24 -24
  10. package/dist/commands/app/publish.js +24 -24
  11. package/dist/commands/app/uninstall.js +14 -14
  12. package/dist/commands/app/upgrade.js +19 -19
  13. package/dist/commands/app/version/major.js +6 -9
  14. package/dist/commands/app/version/minor.js +6 -9
  15. package/dist/commands/app/version/patch.js +6 -9
  16. package/dist/commands/colors/deleteAll.js +5 -5
  17. package/dist/commands/colors/load.js +5 -5
  18. package/dist/commands/config/environments/list.js +6 -9
  19. package/dist/commands/config/environments/remove.js +12 -15
  20. package/dist/commands/config/environments/set.js +11 -14
  21. package/dist/commands/config/list.js +6 -9
  22. package/dist/commands/config/remove.js +16 -19
  23. package/dist/commands/config/set.js +22 -25
  24. package/dist/commands/groups/export.js +21 -22
  25. package/dist/commands/groups/upload.js +10 -11
  26. package/dist/commands/instance/export.js +19 -19
  27. package/dist/commands/instance/import.js +13 -13
  28. package/dist/commands/loader-process/load.js +12 -12
  29. package/dist/commands/loader-process/upload-and-load.js +17 -17
  30. package/dist/commands/projects/export.js +9 -9
  31. package/dist/commands/projects/list.js +5 -5
  32. package/dist/commands/projects/load.js +16 -17
  33. package/dist/commands/types/exportOptionSetHierarchies.js +5 -5
  34. package/dist/commands/types/getAll.js +73 -72
  35. package/dist/commands/types/loadAll.js +13 -13
  36. package/dist/commands/types/mergeOptionSets.js +9 -10
  37. package/dist/commands/types/mergeTypeProperties.js +11 -11
  38. package/dist/commands/types/parseOptionSetsHierarchyLocalFile.js +9 -9
  39. package/dist/commands/types/parseOptionSetsHierarchyValuesToKeysLocalFile.js +9 -9
  40. package/dist/commands/types/parseOptionSetsLocalFiles.d.ts +21 -0
  41. package/dist/commands/types/parseOptionSetsLocalFiles.js +97 -17
  42. package/dist/commands/types/parseOptionSetsToFolderStructure.d.ts +0 -1
  43. package/dist/commands/types/parseOptionSetsToFolderStructure.js +5 -41
  44. package/dist/commands/types/parseTypesFromFiles.js +13 -13
  45. package/dist/commands/types/parseTypesFromLocalFiles.js +10 -10
  46. package/dist/commands/types/parseTypesFromTemplateAndDataFromLocalFiles.js +10 -10
  47. package/dist/commands/types/parseTypesFromTemplateFromLocalFiles.js +9 -9
  48. package/dist/commands/types/uploadOptionSetHierarchies.js +15 -16
  49. package/dist/commands/types/uploadOptionSets.js +15 -13
  50. package/dist/commands/types/uploadOptionSetsHierarchyLocalFile.js +13 -13
  51. package/dist/commands/types/uploadRuleSets.js +13 -13
  52. package/dist/commands/types/uploadTypePolicies.js +16 -16
  53. package/dist/commands/types/uploadTypePropertyPolicies.js +16 -16
  54. package/dist/commands/types/uploadTypes.js +13 -13
  55. package/dist/commands/types/uploadUsageInfo.js +13 -13
  56. package/dist/commands/users/export.js +19 -20
  57. package/dist/commands/users/upload.js +8 -8
  58. package/dist/commands/webhooks/create.js +5 -5
  59. package/dist/commands/webhooks/delete.js +11 -11
  60. package/dist/commands/webhooks/getWebhookTrigger.js +5 -5
  61. package/dist/commands/webhooks/list.js +11 -11
  62. package/dist/commands/workflow-template-definitions/install.js +5 -5
  63. package/dist/commands/workflow-template-definitions/list.js +5 -5
  64. package/dist/commands/workflow-templates/delete.js +5 -5
  65. package/dist/commands/workflow-templates/export.js +19 -20
  66. package/dist/commands/workflow-templates/list.js +5 -5
  67. package/dist/commands/workflow-templates/load.js +11 -11
  68. package/dist/helpers/app/actions-deployer.js +4 -4
  69. package/dist/helpers/app/app-deployer.js +9 -9
  70. package/dist/helpers/app/app-template-parsers.js +1 -1
  71. package/dist/helpers/app/extensions-deployer.js +5 -6
  72. package/dist/helpers/app/load-app-config.js +1 -1
  73. package/dist/helpers/loader-process/helpers.js +3 -3
  74. package/dist/helpers/projects/helpers.js +5 -5
  75. package/dist/helpers/types/type-parser.js +8 -8
  76. package/dist/helpers/types/type-uploader.js +19 -20
  77. package/dist/helpers/workflow-template-definitions/workflow-template-definition-deployer.js +3 -4
  78. package/dist/helpers/workflow-templates/helper.js +11 -16
  79. package/dist/interface-converters.js +1 -2
  80. package/dist/interfaces.js +79 -0
  81. package/dist/logger.js +7 -6
  82. package/oclif.manifest.json +60 -1422
  83. package/package.json +1 -1
@@ -10,7 +10,7 @@ function loadAppConfig(config = { skipValidation: false }) {
10
10
  const TARGET_DIR = process.cwd();
11
11
  try {
12
12
  const doc = js_yaml_1.default.load(fs_1.default.readFileSync(path.resolve(path.join(TARGET_DIR, 'app.yml')), 'utf8'));
13
- if (!(config === null || config === void 0 ? void 0 : config.skipValidation)) {
13
+ if (!config?.skipValidation) {
14
14
  (0, app_config_validators_1.validateAppConfig)(doc);
15
15
  }
16
16
  return doc;
@@ -91,9 +91,9 @@ async function loadLocalFile(configFileName) {
91
91
  exports.loadLocalFile = loadLocalFile;
92
92
  function getFileExtension(fileName) {
93
93
  let ext = '';
94
- const parts = fileName === null || fileName === void 0 ? void 0 : fileName.split('.');
95
- if ((parts === null || parts === void 0 ? void 0 : parts.length) > 1) {
96
- ext = `.${parts[(parts === null || parts === void 0 ? void 0 : parts.length) - 1]}`;
94
+ const parts = fileName?.split('.');
95
+ if (parts?.length > 1) {
96
+ ext = `.${parts[parts?.length - 1]}`;
97
97
  }
98
98
  return ext;
99
99
  }
@@ -53,7 +53,7 @@ async function getAssortmentsAndSubFolders(parentId, assortments, subFolders, al
53
53
  },
54
54
  });
55
55
  const integrationAssortments = workspaceAssortments; //?.filter(a => a.assortmentType === 'INTEGRATION');
56
- if ((integrationAssortments === null || integrationAssortments === void 0 ? void 0 : integrationAssortments.length) > 0) {
56
+ if (integrationAssortments?.length > 0) {
57
57
  allAssortments.push(...integrationAssortments);
58
58
  for (const a of integrationAssortments) {
59
59
  const integrationAssortmentsCopy = util_1.ObjectUtil.cloneDeep(a);
@@ -81,8 +81,8 @@ async function getAssortmentsAndSubFolders(parentId, assortments, subFolders, al
81
81
  },
82
82
  relations: ['entity'],
83
83
  });
84
- const workspaceFolders = workspaceFolderLinks === null || workspaceFolderLinks === void 0 ? void 0 : workspaceFolderLinks.map((wfl) => wfl.entity);
85
- if ((workspaceFolders === null || workspaceFolders === void 0 ? void 0 : workspaceFolders.length) > 0) {
84
+ const workspaceFolders = workspaceFolderLinks?.map((wfl) => wfl.entity);
85
+ if (workspaceFolders?.length > 0) {
86
86
  for (const folder of workspaceFolders) {
87
87
  const converted = {
88
88
  identifier: folder.identifier,
@@ -112,11 +112,11 @@ function convertRelationshipsToIdentifiers(assortments, allAssortments) {
112
112
  }
113
113
  for (const assortment of assortments) {
114
114
  if (assortment.sourceAssortmentIds) {
115
- assortment.sourceAssortmentIdentifier = assortment.sourceAssortmentIds.map((id) => { var _a; return (_a = allAssortments.find((a) => a.id === id)) === null || _a === void 0 ? void 0 : _a.identifier; });
115
+ assortment.sourceAssortmentIdentifier = assortment.sourceAssortmentIds.map((id) => allAssortments.find((a) => a.id === id)?.identifier);
116
116
  }
117
117
  delete assortment.sourceAssortmentIds;
118
118
  if (assortment.composedFromAssortmentIds) {
119
- assortment.composedFromAssortmentIdentifiers = assortment.composedFromAssortmentIds.map((id) => { var _a; return (_a = allAssortments.find((a) => a.id === id)) === null || _a === void 0 ? void 0 : _a.identifier; });
119
+ assortment.composedFromAssortmentIdentifiers = assortment.composedFromAssortmentIds.map((id) => allAssortments.find((a) => a.id === id)?.identifier);
120
120
  }
121
121
  delete assortment.composedFromAssortmentIds;
122
122
  }
@@ -27,7 +27,7 @@ async function parseTypesFromLocalFiles(fileLocations) {
27
27
  try {
28
28
  logger_1.default.info(`Getting data for fileLocation: ${fileLocation}`);
29
29
  const csvData = await loadDataFromLocalCSV(fileLocation);
30
- logger_1.default.info(`CSV import was successful. ${csvData === null || csvData === void 0 ? void 0 : csvData.length} rows found. Adding to total rows.`);
30
+ logger_1.default.info(`CSV import was successful. ${csvData?.length} rows found. Adding to total rows.`);
31
31
  csvJSONData.push(...csvData);
32
32
  }
33
33
  catch (e) {
@@ -35,7 +35,7 @@ async function parseTypesFromLocalFiles(fileLocations) {
35
35
  throw e;
36
36
  }
37
37
  }
38
- logger_1.default.info(`CSV imports were successful. ${csvJSONData === null || csvJSONData === void 0 ? void 0 : csvJSONData.length} total rows found.`);
38
+ logger_1.default.info(`CSV imports were successful. ${csvJSONData?.length} total rows found.`);
39
39
  const suggestions = (0, types_1.GetSuggestedTypes)(csvJSONData);
40
40
  saveData(suggestions.OptionSets, 'parsed_optionSets.yml');
41
41
  saveData({ typeProperties: suggestions.TypeProperties }, 'parsed_typeProperties.yml');
@@ -47,10 +47,10 @@ async function parseTypesFromTemplateFromLocalFiles(templateFileLocation, dataFi
47
47
  try {
48
48
  logger_1.default.info(`Getting template from fileLocation: ${templateFileLocation}`);
49
49
  templateCSVData = await loadDataFromLocalCSV(templateFileLocation);
50
- logger_1.default.info(`CSV import was successful. ${templateCSVData === null || templateCSVData === void 0 ? void 0 : templateCSVData.length} rows found.`);
50
+ logger_1.default.info(`CSV import was successful. ${templateCSVData?.length} rows found.`);
51
51
  logger_1.default.info(`Getting data from fileLocation: ${dataFileLocation}`);
52
52
  dataCSVData = await loadDataFromLocalCSV(dataFileLocation);
53
- logger_1.default.info(`CSV import was successful. ${dataCSVData === null || dataCSVData === void 0 ? void 0 : dataCSVData.length} rows found.`);
53
+ logger_1.default.info(`CSV import was successful. ${dataCSVData?.length} rows found.`);
54
54
  }
55
55
  catch (e) {
56
56
  logger_1.default.info(`Error importing csv data. ${e}`);
@@ -66,7 +66,7 @@ async function parseTypesFromTemplateAndDataFromLocalFiles(templateFileLocation,
66
66
  try {
67
67
  logger_1.default.info(`Getting template from fileLocation: ${templateFileLocation}`);
68
68
  templateCSVData = await loadDataFromLocalCSV(templateFileLocation);
69
- logger_1.default.info(`CSV import was successful. ${templateCSVData === null || templateCSVData === void 0 ? void 0 : templateCSVData.length} rows found.`);
69
+ logger_1.default.info(`CSV import was successful. ${templateCSVData?.length} rows found.`);
70
70
  }
71
71
  catch (e) {
72
72
  logger_1.default.info(`Error importing csv data. ${e}`);
@@ -77,7 +77,7 @@ async function parseTypesFromTemplateAndDataFromLocalFiles(templateFileLocation,
77
77
  try {
78
78
  logger_1.default.info(`Getting data for dataFileLocation: ${dataFileLocation}`);
79
79
  const csvData = await loadDataFromLocalCSV(dataFileLocation);
80
- logger_1.default.info(`CSV import was successful. ${csvData === null || csvData === void 0 ? void 0 : csvData.length} rows found. Adding to total rows.`);
80
+ logger_1.default.info(`CSV import was successful. ${csvData?.length} rows found. Adding to total rows.`);
81
81
  dataCSVData.push(...csvData);
82
82
  }
83
83
  catch (e) {
@@ -98,7 +98,7 @@ async function parseTypesFromFiles(fileIds) {
98
98
  try {
99
99
  logger_1.default.info(`Getting data for fileId: ${loadFileId}`);
100
100
  const csvJSON = await (0, csv_parser_1.getCSVFromFile)(loadFileId);
101
- logger_1.default.info(`CSV download was successful. ${csvJSON === null || csvJSON === void 0 ? void 0 : csvJSON.length} rows found. Adding to total rows`);
101
+ logger_1.default.info(`CSV download was successful. ${csvJSON?.length} rows found. Adding to total rows`);
102
102
  csvJSONData.push(...csvJSON);
103
103
  }
104
104
  catch (e) {
@@ -106,7 +106,7 @@ async function parseTypesFromFiles(fileIds) {
106
106
  throw e;
107
107
  }
108
108
  }
109
- logger_1.default.info(`CSV downloads were successful. ${csvJSONData === null || csvJSONData === void 0 ? void 0 : csvJSONData.length} total rows found.`);
109
+ logger_1.default.info(`CSV downloads were successful. ${csvJSONData?.length} total rows found.`);
110
110
  const suggestions = (0, types_1.GetSuggestedTypes)(csvJSONData);
111
111
  saveData(suggestions.OptionSets, 'parsed_optionSets.yml');
112
112
  saveData({ typeProperties: suggestions.TypeProperties }, 'parsed_typeProperties.yml');
@@ -137,7 +137,6 @@ async function uploadReducedTypes(dir) {
137
137
  }
138
138
  }
139
139
  async function uploadReducedTypeProperties(type, currentPropertyTypes, newPropertyTypes, optionSets) {
140
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
141
140
  const currentPropertyTypeBySlug = {};
142
141
  for (const currentPropertyType of currentPropertyTypes) {
143
142
  currentPropertyTypeBySlug[currentPropertyType.slug] = currentPropertyType;
@@ -189,25 +188,25 @@ async function uploadReducedTypeProperties(type, currentPropertyTypes, newProper
189
188
  // !typePropertiesEqual(found, newPropertyType, optionSetIdBySlug)
190
189
  ) {
191
190
  const proposedTP = {
192
- isArchived: (_a = newPropertyType.isArchived) !== null && _a !== void 0 ? _a : null,
193
- propertyType: (_b = newPropertyType.propertyType) !== null && _b !== void 0 ? _b : null,
194
- slug: (_c = newPropertyType.slug) !== null && _c !== void 0 ? _c : null,
195
- label: (_d = newPropertyType.label) !== null && _d !== void 0 ? _d : null,
196
- editable: (_e = newPropertyType.editable) !== null && _e !== void 0 ? _e : null,
197
- searchable: (_f = newPropertyType.searchable) !== null && _f !== void 0 ? _f : null,
198
- core: (_g = newPropertyType.core) !== null && _g !== void 0 ? _g : null,
199
- typePropertyOptionSetId: (_h = optionSetIdBySlug[newPropertyType.typePropertyOptionSetSlug]) !== null && _h !== void 0 ? _h : null,
200
- formula: (_j = newPropertyType.formula) !== null && _j !== void 0 ? _j : null,
201
- referencedTypePath: (_k = newPropertyType.referencedTypePath) !== null && _k !== void 0 ? _k : null,
202
- carryOverBehavior: (_l = newPropertyType.carryOverBehavior) !== null && _l !== void 0 ? _l : null,
203
- carryOverDefault: (_m = newPropertyType.carryOverDefault) !== null && _m !== void 0 ? _m : null,
204
- referencedTypeRootSlug: (_o = newPropertyType.referencedTypeRootSlug) !== null && _o !== void 0 ? _o : null,
205
- defaultValue: (_p = newPropertyType.defaultValue) !== null && _p !== void 0 ? _p : null,
206
- propertyLevel: (_q = newPropertyType.propertyLevel) !== null && _q !== void 0 ? _q : null,
207
- formulaFunction: (_r = newPropertyType.formulaFunction) !== null && _r !== void 0 ? _r : null,
208
- validationFunction: (_s = newPropertyType.validationFunction) !== null && _s !== void 0 ? _s : null,
209
- numberFormat: (_t = newPropertyType.numberFormat) !== null && _t !== void 0 ? _t : null,
210
- sequenceSeedValue: (_u = newPropertyType.sequenceSeedValue) !== null && _u !== void 0 ? _u : null,
191
+ isArchived: newPropertyType.isArchived ?? null,
192
+ propertyType: newPropertyType.propertyType ?? null,
193
+ slug: newPropertyType.slug ?? null,
194
+ label: newPropertyType.label ?? null,
195
+ editable: newPropertyType.editable ?? null,
196
+ searchable: newPropertyType.searchable ?? null,
197
+ core: newPropertyType.core ?? null,
198
+ typePropertyOptionSetId: optionSetIdBySlug[newPropertyType.typePropertyOptionSetSlug] ?? null,
199
+ formula: newPropertyType.formula ?? null,
200
+ referencedTypePath: newPropertyType.referencedTypePath ?? null,
201
+ carryOverBehavior: newPropertyType.carryOverBehavior ?? null,
202
+ carryOverDefault: newPropertyType.carryOverDefault ?? null,
203
+ referencedTypeRootSlug: newPropertyType.referencedTypeRootSlug ?? null,
204
+ defaultValue: newPropertyType.defaultValue ?? null,
205
+ propertyLevel: newPropertyType.propertyLevel ?? null,
206
+ formulaFunction: newPropertyType.formulaFunction ?? null,
207
+ validationFunction: newPropertyType.validationFunction ?? null,
208
+ numberFormat: newPropertyType.numberFormat ?? null,
209
+ sequenceSeedValue: newPropertyType.sequenceSeedValue ?? null,
211
210
  };
212
211
  // logger.debug(
213
212
  // `found type property option set: ${newPropertyType.typePropertyOptionSetSlug}, ${proposedTP.typePropertyOptionSetId}, `,
@@ -95,7 +95,7 @@ class WorkflowTemplateDefinitionDeployer {
95
95
  logger_1.default.info('WORKFLOW DEFINITION \tDeploying workflow definitions.');
96
96
  if (appDeclaration.workflows) {
97
97
  const localWorkflows = Object.keys(appDeclaration.workflows);
98
- if ((localWorkflows === null || localWorkflows === void 0 ? void 0 : localWorkflows.length) > 0) {
98
+ if (localWorkflows?.length > 0) {
99
99
  for (const workflowKey of localWorkflows) {
100
100
  await this.deployWorkflow(workflowKey, appDeclaration.workflows[workflowKey], app, existingWorkflows);
101
101
  }
@@ -131,13 +131,12 @@ class WorkflowTemplateDefinitionDeployer {
131
131
  return workflowTemplate;
132
132
  }
133
133
  async populateActionIds(workflowDefinition, app) {
134
- var _a;
135
134
  const availableAppActions = await (0, actions_deployer_1.getActionsForAppVersion)(app);
136
- if (!((_a = workflowDefinition.workflowDefinition) === null || _a === void 0 ? void 0 : _a.paths)) {
135
+ if (!workflowDefinition.workflowDefinition?.paths) {
137
136
  return;
138
137
  }
139
138
  for (const path of workflowDefinition.workflowDefinition.paths) {
140
- if (!(path === null || path === void 0 ? void 0 : path.actionDefinitionConfigs)) {
139
+ if (!path?.actionDefinitionConfigs) {
141
140
  continue;
142
141
  }
143
142
  for (const actionConfiguration of path.actionDefinitionConfigs) {
@@ -56,15 +56,14 @@ class LocalWorkflowTemplateDeployer {
56
56
  return newWorkflowTemplate;
57
57
  }
58
58
  async populateActionIds(workflowTemplate, workflowKey, appIdentifier) {
59
- var _a;
60
59
  const installedApps = await (0, apps_1.getInstalledApps)();
61
60
  const appOrg = installedApps.find((x) => x.app.identifier === appIdentifier);
62
61
  logger_1.default.info('workflow template:', JSON.stringify(workflowTemplate, null, 2));
63
- if (!((_a = workflowTemplate === null || workflowTemplate === void 0 ? void 0 : workflowTemplate.workflowDefinition) === null || _a === void 0 ? void 0 : _a.paths)) {
62
+ if (!workflowTemplate?.workflowDefinition?.paths) {
64
63
  return;
65
64
  }
66
65
  for (const path of workflowTemplate.workflowDefinition.paths) {
67
- if (!(path === null || path === void 0 ? void 0 : path.actionDefinitionConfigs)) {
66
+ if (!path?.actionDefinitionConfigs) {
68
67
  continue;
69
68
  }
70
69
  for (const actionConfiguration of path.actionDefinitionConfigs) {
@@ -89,8 +88,7 @@ class LocalWorkflowTemplateDeployer {
89
88
  }
90
89
  }
91
90
  async createWorkflowSchedule(workflowTemplate, workflowId) {
92
- var _a;
93
- if (!((_a = workflowTemplate === null || workflowTemplate === void 0 ? void 0 : workflowTemplate.crons) === null || _a === void 0 ? void 0 : _a.length) || !workflowTemplate.id) {
91
+ if (!workflowTemplate?.crons?.length || !workflowTemplate.id) {
94
92
  return;
95
93
  }
96
94
  const crons = [];
@@ -111,11 +109,10 @@ class LocalWorkflowTemplateDeployer {
111
109
  return crons;
112
110
  }
113
111
  async updateWorkflowSchedule(workflowTemplate, workflowId) {
114
- var _a, _b, _c, _d;
115
- const existingSchedules = (_a = (await (0, schedules_1.getExistingSchedules)()).filter((x) => (x === null || x === void 0 ? void 0 : x.ownerReference) === `event-workflow-template:${workflowId}`)) !== null && _a !== void 0 ? _a : [];
116
- const newSchedules = (_b = workflowTemplate === null || workflowTemplate === void 0 ? void 0 : workflowTemplate.crons) !== null && _b !== void 0 ? _b : [];
117
- const existingCronNames = (_c = existingSchedules.map((x) => x.name)) !== null && _c !== void 0 ? _c : [];
118
- const newCronNames = (_d = newSchedules.map((x) => x.name)) !== null && _d !== void 0 ? _d : [];
112
+ const existingSchedules = (await (0, schedules_1.getExistingSchedules)()).filter((x) => x?.ownerReference === `event-workflow-template:${workflowId}`) ?? [];
113
+ const newSchedules = workflowTemplate?.crons ?? [];
114
+ const existingCronNames = existingSchedules.map((x) => x.name) ?? [];
115
+ const newCronNames = newSchedules.map((x) => x.name) ?? [];
119
116
  const cronsToAdd = newSchedules.filter((x) => !existingCronNames.includes(x.name));
120
117
  const cronsToRemove = existingSchedules.filter((x) => !newCronNames.includes(x.name));
121
118
  const cronsToEdit = existingSchedules.filter((x) => newCronNames.includes(x.name));
@@ -157,15 +154,14 @@ class LocalWorkflowTemplateDeployer {
157
154
  }
158
155
  }
159
156
  async updateWorkflowTemplate(workflowKey, existingWorkflowTemplate, workflowTemplate, appIdentifier) {
160
- var _a, _b;
161
157
  await this.populateActionIds(workflowTemplate, workflowKey, appIdentifier);
162
158
  const updates = Object.assign(new Object(), {
163
159
  name: workflowTemplate.name,
164
160
  triggerKey: workflowTemplate.triggerKey,
165
161
  builtIn: workflowTemplate.builtIn,
166
162
  workflowDefinition: workflowTemplate.workflowDefinition,
167
- messageGroupId: (_a = workflowTemplate.messageGroupId) !== null && _a !== void 0 ? _a : existingWorkflowTemplate.messageGroupId,
168
- parallelWorkerCount: (_b = workflowTemplate.parallelWorkerCount) !== null && _b !== void 0 ? _b : existingWorkflowTemplate.parallelWorkerCount,
163
+ messageGroupId: workflowTemplate.messageGroupId ?? existingWorkflowTemplate.messageGroupId,
164
+ parallelWorkerCount: workflowTemplate.parallelWorkerCount ?? existingWorkflowTemplate.parallelWorkerCount,
169
165
  });
170
166
  const updatedWorkflowTemplate = await (0, event_workflow_templates_1.updateWorkflowTemplate)({
171
167
  id: existingWorkflowTemplate.id,
@@ -265,12 +261,11 @@ function loadTemplateConfig(saveFile) {
265
261
  }
266
262
  }
267
263
  async function populateActionIdentifiers(workflowTemplate) {
268
- var _a;
269
- if (!((_a = workflowTemplate === null || workflowTemplate === void 0 ? void 0 : workflowTemplate.workflowDefinition) === null || _a === void 0 ? void 0 : _a.paths)) {
264
+ if (!workflowTemplate?.workflowDefinition?.paths) {
270
265
  return;
271
266
  }
272
267
  for (const path of workflowTemplate.workflowDefinition.paths) {
273
- if (!(path === null || path === void 0 ? void 0 : path.actionDefinitionConfigs)) {
268
+ if (!path?.actionDefinitionConfigs) {
274
269
  continue;
275
270
  }
276
271
  for (const actionConfiguration of path.actionDefinitionConfigs) {
@@ -4,8 +4,7 @@ exports.convertWorkflow = exports.DEFAULT_WORKFLOW_PARALLELISM = void 0;
4
4
  exports.DEFAULT_WORKFLOW_PARALLELISM = 1;
5
5
  // parses the user-facing interface of the workflow and converts it to the cloud-facing format in-place.
6
6
  function convertWorkflow(workflow) {
7
- var _a;
8
- workflow.parallelWorkerCount = (_a = workflow.parallelism) !== null && _a !== void 0 ? _a : exports.DEFAULT_WORKFLOW_PARALLELISM;
7
+ workflow.parallelWorkerCount = workflow.parallelism ?? exports.DEFAULT_WORKFLOW_PARALLELISM;
9
8
  workflow.messageGroupId = workflow.groupId;
10
9
  }
11
10
  exports.convertWorkflow = convertWorkflow;
@@ -24,15 +24,52 @@ var AppRuntime;
24
24
  AppRuntime["NODE"] = "NODE";
25
25
  })(AppRuntime = exports.AppRuntime || (exports.AppRuntime = {}));
26
26
  class AppVersion {
27
+ id;
28
+ createdOn;
29
+ updatedOn;
30
+ createdById;
31
+ updatedById;
32
+ createdBy;
33
+ updatedBy;
34
+ orgId;
35
+ appId;
36
+ app;
37
+ appOrgs;
38
+ versionNumber;
39
+ status;
40
+ eventWorkflowTriggerKeyMapping;
41
+ configProperties;
42
+ triggerKeyDefinitions;
43
+ dockerImageRef;
44
+ appRuntime;
27
45
  }
28
46
  exports.AppVersion = AppVersion;
29
47
  class AppApiKey {
48
+ id;
49
+ createdOn;
50
+ updatedOn;
51
+ createdById;
52
+ updatedById;
53
+ createdBy;
54
+ updatedBy;
55
+ orgId;
56
+ appOrgId;
57
+ appOrg;
58
+ apiKey;
30
59
  }
31
60
  exports.AppApiKey = AppApiKey;
32
61
  class ConfigProperty {
62
+ slug;
63
+ propertyType;
64
+ options;
65
+ label;
33
66
  }
34
67
  exports.ConfigProperty = ConfigProperty;
35
68
  class TriggerKeyDefinition {
69
+ name;
70
+ description;
71
+ triggerKey;
72
+ external;
36
73
  }
37
74
  exports.TriggerKeyDefinition = TriggerKeyDefinition;
38
75
  class CommonConfiguration {
@@ -46,23 +83,65 @@ var AssortmentType;
46
83
  AssortmentType["SHOWCASE"] = "SHOWCASE";
47
84
  })(AssortmentType = exports.AssortmentType || (exports.AssortmentType = {}));
48
85
  class AssortmentConfiguration {
86
+ identifier;
87
+ name;
88
+ type;
89
+ sourceAssortmentIdentifier;
90
+ composedFromAssortmentIdentifiers;
91
+ ownerAtts;
92
+ assortmentAtts;
49
93
  }
50
94
  exports.AssortmentConfiguration = AssortmentConfiguration;
51
95
  class Folder {
96
+ identifier;
97
+ name;
98
+ principals;
99
+ assortments;
100
+ subFolders;
52
101
  }
53
102
  exports.Folder = Folder;
54
103
  class ProjectConfiguration {
104
+ projectName;
105
+ identifier;
106
+ commonConfig;
107
+ principals;
108
+ assortments;
109
+ subFolders;
55
110
  }
56
111
  exports.ProjectConfiguration = ProjectConfiguration;
57
112
  class ProjectConfigurationTemplate {
113
+ projectName;
114
+ identifier;
115
+ commonConfig;
116
+ principals;
117
+ allFolders;
118
+ allAssortments;
119
+ allAssortmentRelationships;
58
120
  }
59
121
  exports.ProjectConfigurationTemplate = ProjectConfigurationTemplate;
60
122
  class FolderSlim {
123
+ identifier;
124
+ name;
125
+ principals;
126
+ folderIdentifier;
61
127
  }
62
128
  exports.FolderSlim = FolderSlim;
63
129
  class AssortmentConfigurationSlim {
130
+ identifier;
131
+ name;
132
+ type;
133
+ folderIdentifier;
134
+ sourceAssortmentIdentifier;
135
+ composedFromAssortmentIdentifiers;
136
+ ownerAtts;
137
+ assortmentAtts;
64
138
  }
65
139
  exports.AssortmentConfigurationSlim = AssortmentConfigurationSlim;
66
140
  class AssortmentConfigurationRelationships {
141
+ identifier;
142
+ sourceAssortmentIdentifier;
143
+ composedFromAssortmentIdentifiers;
144
+ ownerAtts;
145
+ assortmentAtts;
67
146
  }
68
147
  exports.AssortmentConfigurationRelationships = AssortmentConfigurationRelationships;
package/dist/logger.js CHANGED
@@ -4,13 +4,14 @@ const tslib_1 = require("tslib");
4
4
  const winston_1 = tslib_1.__importStar(require("winston"));
5
5
  const lodash_1 = tslib_1.__importDefault(require("lodash"));
6
6
  class Logger {
7
+ logger;
8
+ colors = {
9
+ error: 'red',
10
+ warn: 'yellow',
11
+ info: 'green',
12
+ debug: 'blue',
13
+ };
7
14
  constructor() {
8
- this.colors = {
9
- error: 'red',
10
- warn: 'yellow',
11
- info: 'green',
12
- debug: 'blue',
13
- };
14
15
  const transport = new winston_1.transports.Console();
15
16
  winston_1.default.addColors(this.colors);
16
17
  this.logger = (0, winston_1.createLogger)({