@contrail/cli 2.1.28 → 2.2.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 (65) hide show
  1. package/README.md +86 -2
  2. package/dist/commands/app/create.js +3 -4
  3. package/dist/commands/app/delete.js +5 -5
  4. package/dist/commands/app/init.d.ts +6 -0
  5. package/dist/commands/app/init.js +63 -0
  6. package/dist/commands/app/publish.js +3 -3
  7. package/dist/commands/app/version/major.d.ts +7 -0
  8. package/dist/commands/app/version/major.js +40 -0
  9. package/dist/commands/app/version/minor.d.ts +7 -0
  10. package/dist/commands/app/version/minor.js +40 -0
  11. package/dist/commands/app/version/patch.d.ts +7 -0
  12. package/dist/commands/app/version/patch.js +40 -0
  13. package/dist/commands/colors/deleteAll.js +3 -3
  14. package/dist/commands/colors/load.js +5 -5
  15. package/dist/commands/config/environments/remove.js +2 -2
  16. package/dist/commands/config/environments/set.js +1 -1
  17. package/dist/commands/groups/export.js +1 -1
  18. package/dist/commands/loader-process/load.js +4 -4
  19. package/dist/commands/loader-process/upload-and-load.js +4 -4
  20. package/dist/commands/projects/load.js +2 -2
  21. package/dist/commands/types/exportOptionSetHierarchies.js +4 -4
  22. package/dist/commands/types/getAll.js +31 -25
  23. package/dist/commands/types/loadAll.js +2 -2
  24. package/dist/commands/types/mergeOptionSets.js +5 -4
  25. package/dist/commands/types/mergeTypeProperties.js +2 -2
  26. package/dist/commands/types/parseOptionSetsHierarchyLocalFile.js +4 -4
  27. package/dist/commands/types/parseOptionSetsHierarchyValuesToKeysLocalFile.js +2 -2
  28. package/dist/commands/types/parseOptionSetsLocalFiles.js +2 -2
  29. package/dist/commands/types/parseOptionSetsToFolderStructure.js +2 -2
  30. package/dist/commands/types/parseTypesFromFiles.js +2 -2
  31. package/dist/commands/types/parseTypesFromLocalFiles.js +2 -2
  32. package/dist/commands/types/parseTypesFromTemplateAndDataFromLocalFiles.js +2 -2
  33. package/dist/commands/types/parseTypesFromTemplateFromLocalFiles.js +2 -2
  34. package/dist/commands/types/uploadOptionSetHierarchies.js +30 -20
  35. package/dist/commands/types/uploadOptionSets.js +16 -15
  36. package/dist/commands/types/uploadOptionSetsHierarchyLocalFile.js +5 -5
  37. package/dist/commands/types/uploadRuleSets.js +20 -22
  38. package/dist/commands/types/uploadTypePolicies.js +23 -23
  39. package/dist/commands/types/uploadTypePropertyPolicies.js +14 -14
  40. package/dist/commands/types/uploadUsageInfo.js +12 -12
  41. package/dist/commands/webhooks/create.js +2 -4
  42. package/dist/commands/webhooks/list.js +2 -4
  43. package/dist/helpers/app/actions-deployer.js +4 -4
  44. package/dist/helpers/app/app-deployer.js +9 -9
  45. package/dist/helpers/app/extensions-deployer.js +4 -4
  46. package/dist/helpers/app/update-app-config.d.ts +2 -0
  47. package/dist/helpers/app/update-app-config.js +20 -0
  48. package/dist/helpers/app/upgrade-version.d.ts +16 -0
  49. package/dist/helpers/app/upgrade-version.js +37 -0
  50. package/dist/helpers/app/upgrade-version.spec.d.ts +1 -0
  51. package/dist/helpers/app/upgrade-version.spec.js +33 -0
  52. package/dist/helpers/colors/helpers.js +2 -2
  53. package/dist/helpers/loader-process/helpers.js +4 -4
  54. package/dist/helpers/projects/helpers.js +1 -1
  55. package/dist/helpers/types/csv-parser.js +6 -6
  56. package/dist/helpers/types/type-extractor.js +1 -1
  57. package/dist/helpers/types/type-parser.js +11 -11
  58. package/dist/helpers/types/type-uploader.js +21 -21
  59. package/dist/helpers/workflow-template-definitions/workflow-template-definition-deployer.js +6 -6
  60. package/dist/helpers/workflow-templates/helper.js +7 -7
  61. package/dist/interfaces.d.ts +2 -1
  62. package/dist/templates/typescript/app.yml +1 -1
  63. package/dist/templates/typescript/package.json +2 -2
  64. package/oclif.manifest.json +150 -2
  65. package/package.json +3 -2
@@ -37,13 +37,13 @@ async function uploadOptionSetsHierarchyLocalFile(fileLocation, name) {
37
37
  logger_1.default.info('Using File: ', fileLocation);
38
38
  logger_1.default.info('Using Name: ', name);
39
39
  await uploadOptionSetHierarchiesLocalFile(fileLocation, name);
40
- logger_1.default.info('%s Uploaded', chalk_1.default.yellow.bold('OPTION SET HIERARCHY UPLOAD'));
40
+ logger_1.default.info(`${chalk_1.default.yellow.bold('OPTION SET HIERARCHY UPLOAD')} Uploaded`);
41
41
  }
42
42
  catch (e) {
43
- logger_1.default.info(`%s UPLOAD Failed. ${e}`, chalk_1.default.red.bold('FAIL'));
43
+ logger_1.default.info(`${chalk_1.default.red.bold('FAIL')} UPLOAD Failed . ${e}`);
44
44
  return;
45
45
  }
46
- logger_1.default.info('%s UPLOAD Complete.', chalk_1.default.green.bold('COMPLETE'));
46
+ logger_1.default.info(`${chalk_1.default.green.bold('COMPLETE')} UPLOAD Complete.`);
47
47
  }
48
48
  exports.uploadOptionSetsHierarchyLocalFile = uploadOptionSetsHierarchyLocalFile;
49
49
  async function loadOptionSetHierarchyCSV(fileLocation) {
@@ -101,7 +101,7 @@ async function uploadOptionSetHierarchiesLocalFile(fileLocation, name) {
101
101
  });
102
102
  const existing = currentOptionSetHierarchies.find((osh) => osh.name === name);
103
103
  if (existing) {
104
- logger_1.default.info('Updating: ', optionSetHierarchy.name);
104
+ logger_1.default.info(`Updating: ': ${optionSetHierarchy.name}`);
105
105
  await new sdk_1.Entities().update({
106
106
  entityName: 'option-set-hierarchy',
107
107
  id: existing.id,
@@ -109,7 +109,7 @@ async function uploadOptionSetHierarchiesLocalFile(fileLocation, name) {
109
109
  });
110
110
  }
111
111
  else {
112
- logger_1.default.info('Creating: ', optionSetHierarchy.name);
112
+ logger_1.default.info(`Creating: ': ${optionSetHierarchy.name}`);
113
113
  await new sdk_1.Entities().create({
114
114
  entityName: 'option-set-hierarchy',
115
115
  object: optionSetHierarchy,
@@ -34,17 +34,17 @@ UploadRuleSets.flags = {
34
34
  async function uploadRuleSets(dir) {
35
35
  try {
36
36
  await (0, login_1.authUser)();
37
- logger_1.default.info('%s Uploading', chalk_1.default.yellow.bold('RULE SET'));
37
+ logger_1.default.info(`${chalk_1.default.yellow.bold('RULE SET')} Uploading`);
38
38
  const [reducedRuleSets, reducedRuleSetLinks] = await loadReducedRuleSets(dir);
39
39
  await uploadRuleSetObjects(reducedRuleSets);
40
40
  await uploadRuleSetLinkObjects(reducedRuleSetLinks);
41
- logger_1.default.info('%s Uploaded', chalk_1.default.yellow.bold('RULE SET'));
41
+ logger_1.default.info(`${chalk_1.default.yellow.bold('RULE SET')} Uploaded`);
42
42
  }
43
43
  catch (e) {
44
- logger_1.default.info(`%s Rule Set Upload Failed. ${e}`, chalk_1.default.red.bold('FAIL'));
44
+ logger_1.default.info(`${chalk_1.default.red.bold('FAIL')} Rule Set Upload Failed. ${e}`);
45
45
  return;
46
46
  }
47
- logger_1.default.info('%s Rule set Upload Complete.', chalk_1.default.green.bold('COMPLETE'));
47
+ logger_1.default.info(`${chalk_1.default.green.bold('COMPLETE')} Rule set Upload Complete.`);
48
48
  }
49
49
  exports.uploadRuleSets = uploadRuleSets;
50
50
  function loadReducedRuleSets(fromDir) {
@@ -67,28 +67,28 @@ async function uploadRuleSetObjects(reducedRuleSets) {
67
67
  const currentRuleSets = await new sdk_1.Entities().get({
68
68
  entityName: 'type-rule-set',
69
69
  });
70
- const currentRuleSetsByName = {};
70
+ const currentRuleSetsByIdentifier = {};
71
71
  for (const currentRuleSet of currentRuleSets) {
72
- currentRuleSetsByName[currentRuleSet.name] = currentRuleSet;
72
+ currentRuleSetsByIdentifier[currentRuleSet.identifier] = currentRuleSet;
73
73
  }
74
- const loadedRuleSetsByName = {};
74
+ const loadedRuleSetsByIdentifier = {};
75
75
  for (const loadedRuleSet of reducedRuleSets) {
76
- loadedRuleSetsByName[loadedRuleSet.name] = loadedRuleSet;
76
+ loadedRuleSetsByIdentifier[loadedRuleSet.identifier] = loadedRuleSet;
77
77
  }
78
- logger_1.default.debug('current rule sets:', currentRuleSets);
79
- logger_1.default.debug('reduced rule sets:', reducedRuleSets);
78
+ logger_1.default.debug(`current rule sets: ${currentRuleSets}`);
79
+ logger_1.default.debug(`reduced rule sets: ${reducedRuleSets}`);
80
80
  for (const reducedRuleSet of reducedRuleSets) {
81
81
  try {
82
- const found = currentRuleSetsByName[reducedRuleSet.name];
82
+ const found = currentRuleSetsByIdentifier[reducedRuleSet.identifier];
83
83
  if (!found) {
84
- logger_1.default.info('Creating: ', reducedRuleSet.name);
84
+ logger_1.default.info(`Creating: ${reducedRuleSet.identifier}`);
85
85
  await new sdk_1.Entities().create({
86
86
  entityName: 'type-rule-set',
87
87
  object: reducedRuleSet,
88
88
  });
89
89
  }
90
90
  else {
91
- logger_1.default.info('Updating: ', reducedRuleSet.name);
91
+ logger_1.default.info(`Updating: ${reducedRuleSet.identifier}`);
92
92
  await new sdk_1.Entities().update({
93
93
  entityName: 'type-rule-set',
94
94
  id: found.id,
@@ -102,9 +102,9 @@ async function uploadRuleSetObjects(reducedRuleSets) {
102
102
  }
103
103
  for (const currentRuleSet of currentRuleSets) {
104
104
  try {
105
- const found = loadedRuleSetsByName[currentRuleSet.name];
105
+ const found = loadedRuleSetsByIdentifier[currentRuleSet.identifier];
106
106
  if (!found) {
107
- logger_1.default.info('Deleting: ', currentRuleSet.name);
107
+ logger_1.default.info(`Deleting: ${currentRuleSet.identifier}`);
108
108
  await new sdk_1.Entities().delete({
109
109
  entityName: 'type-rule-set',
110
110
  id: currentRuleSet.id,
@@ -138,8 +138,6 @@ async function uploadRuleSetLinkObjects(loadedRuleSetLinks) {
138
138
  const hash = `${loadedLink.type}|${loadedLink.ruleSet}`;
139
139
  reducedLinksByHashes[hash] = loadedLink;
140
140
  }
141
- // logger.debug('reduced rule set links:', reducedLinksByHashes);
142
- // logger.debug('current rule set links:', currentLinksHashes);
143
141
  for (const loadedRuleSetLink of loadedRuleSetLinks) {
144
142
  try {
145
143
  const found = currentLinksHashes[`${loadedRuleSetLink.type}|${loadedRuleSetLink.ruleSet}`];
@@ -147,7 +145,7 @@ async function uploadRuleSetLinkObjects(loadedRuleSetLinks) {
147
145
  if (!transformReducedLink(loadedRuleSetLink, types, currentRuleSets)) {
148
146
  continue;
149
147
  }
150
- logger_1.default.info('Creating: ', loadedRuleSetLink);
148
+ logger_1.default.info(`Creating: ${loadedRuleSetLink}`);
151
149
  await new sdk_1.Entities().create({
152
150
  entityName: 'type-rule-set-link',
153
151
  object: {
@@ -160,7 +158,7 @@ async function uploadRuleSetLinkObjects(loadedRuleSetLinks) {
160
158
  if (!transformReducedLink(loadedRuleSetLink, types, currentRuleSets)) {
161
159
  continue;
162
160
  }
163
- logger_1.default.info('skipping updating existing rule set link: ', loadedRuleSetLink);
161
+ logger_1.default.info(`skipping updating existing rule set link: ${loadedRuleSetLink}`);
164
162
  }
165
163
  }
166
164
  catch (err) {
@@ -171,7 +169,7 @@ async function uploadRuleSetLinkObjects(loadedRuleSetLinks) {
171
169
  try {
172
170
  const found = reducedLinksByHashes[currentLinkHash];
173
171
  if (!found) {
174
- logger_1.default.info('Deleting: ', currentLinkHash);
172
+ logger_1.default.info(`Deleting: ${currentLinkHash}`);
175
173
  await new sdk_1.Entities().delete({
176
174
  entityName: 'type-rule-set-link',
177
175
  id: currentLink['id'],
@@ -186,13 +184,13 @@ async function uploadRuleSetLinkObjects(loadedRuleSetLinks) {
186
184
  function transformReducedLink(ruleSetLink, types, ruleSets) {
187
185
  const foundType = types.find((t) => t.slug === ruleSetLink.type);
188
186
  if (!foundType) {
189
- logger_1.default.error('Could not find type with name', ruleSetLink.type);
187
+ logger_1.default.error(`Could not find type with name ${ruleSetLink.type}`);
190
188
  return false;
191
189
  }
192
190
  ruleSetLink.type = foundType.id;
193
191
  const foundRuleSet = ruleSets.find((rs) => rs.name === ruleSetLink.ruleSet);
194
192
  if (!foundRuleSet) {
195
- logger_1.default.error('Could not find rule set with name', foundType.ruleSet);
193
+ logger_1.default.error(`Could not find rule set with name ${foundType.ruleSet}`);
196
194
  return false;
197
195
  }
198
196
  ruleSetLink.ruleSet = foundRuleSet.id;
@@ -36,17 +36,17 @@ UploadTypePolicies.flags = {
36
36
  async function uploadTypePolicies(dir) {
37
37
  try {
38
38
  await (0, login_1.authUser)();
39
- logger_1.default.info('%s Uploading', chalk_1.default.yellow.bold('TYPE POLICY'));
39
+ logger_1.default.info(`${chalk_1.default.yellow.bold('TYPE POLICY')} Uploading`);
40
40
  const [reducedTypePolicies, reducedTypePolicyLinks] = await loadTypePolicies(dir);
41
41
  await uploadTypePolicyObjects(reducedTypePolicies);
42
42
  await uploadTypePolicyLinks(reducedTypePolicyLinks);
43
- logger_1.default.info('%s Uploaded', chalk_1.default.yellow.bold('TYPE POLICY'));
43
+ logger_1.default.info(`${chalk_1.default.yellow.bold('TYPE POLICY')} Uploaded`);
44
44
  }
45
45
  catch (e) {
46
- logger_1.default.info(`%s Type Policy Upload Failed. ${e}`, chalk_1.default.red.bold('FAIL'));
46
+ logger_1.default.info(`${chalk_1.default.red.bold('FAIL')} Type Policy Upload Failed . ${e}`);
47
47
  return;
48
48
  }
49
- logger_1.default.info('%s Type Policy Upload Complete.', chalk_1.default.green.bold('COMPLETE'));
49
+ logger_1.default.info(`${chalk_1.default.green.bold('COMPLETE')} Type Policy Upload Complete.`);
50
50
  }
51
51
  exports.uploadTypePolicies = uploadTypePolicies;
52
52
  function loadTypePolicies(fromDir) {
@@ -105,26 +105,26 @@ async function uploadTypePolicyObjects(reducedTypePolicies) {
105
105
  const currentTypePolicies = await new sdk_1.Entities().get({
106
106
  entityName: 'type-policy',
107
107
  });
108
- const currentTypePolicyByLabel = {};
108
+ const currentTypePolicyByIdentifier = {};
109
109
  for (const currentTypePolicy of currentTypePolicies) {
110
- currentTypePolicyByLabel[currentTypePolicy.label] = currentTypePolicy;
110
+ currentTypePolicyByIdentifier[currentTypePolicy.identifier] = currentTypePolicy;
111
111
  }
112
- const loadedTypePolicyByName = {};
112
+ const loadedTypePolicyByIdentifier = {};
113
113
  for (const loadedTPP of reducedTypePolicies) {
114
- loadedTypePolicyByName[loadedTPP.label] = loadedTPP;
114
+ loadedTypePolicyByIdentifier[loadedTPP.identifier] = loadedTPP;
115
115
  }
116
- for (const [label, loadedTPP] of Object.entries(loadedTypePolicyByName)) {
116
+ for (const [identifier, loadedTPP] of Object.entries(loadedTypePolicyByIdentifier)) {
117
117
  try {
118
- const found = currentTypePolicyByLabel[label];
118
+ const found = currentTypePolicyByIdentifier[identifier];
119
119
  if (!found) {
120
- logger_1.default.info('Creating: ', label);
120
+ logger_1.default.info(`Creating: ': ${identifier}`);
121
121
  await new sdk_1.Entities().create({
122
122
  entityName: 'type-policy',
123
123
  object: loadedTPP,
124
124
  });
125
125
  }
126
126
  else {
127
- logger_1.default.info('Updating: ', label);
127
+ logger_1.default.info(`Updating: ': ${identifier}`);
128
128
  await new sdk_1.Entities().update({
129
129
  entityName: 'type-policy',
130
130
  id: found.id,
@@ -136,11 +136,11 @@ async function uploadTypePolicyObjects(reducedTypePolicies) {
136
136
  throw new Error(`Error Uploading Type Policy: ${err}`);
137
137
  }
138
138
  }
139
- for (const [label, currentTPP] of Object.entries(currentTypePolicyByLabel)) {
139
+ for (const [identifier, currentTPP] of Object.entries(currentTypePolicyByIdentifier)) {
140
140
  try {
141
- const found = loadedTypePolicyByName[label];
141
+ const found = loadedTypePolicyByIdentifier[identifier];
142
142
  if (!found) {
143
- logger_1.default.info('Deleting: ', label);
143
+ logger_1.default.info(`Deleting: ': ${identifier}`);
144
144
  await new sdk_1.Entities().delete({
145
145
  entityName: 'type-policy',
146
146
  id: currentTPP['id'],
@@ -165,19 +165,19 @@ async function uploadTypePolicyLinks(reducedTypePolicyLinks) {
165
165
  const foundType = types.find((type) => type.id === currentLink.typeId);
166
166
  const foundTypePolicy = currentTypePolicies.find((tp) => tp.id === currentLink.typePolicyId);
167
167
  if (!foundType || !foundTypePolicy) {
168
- logger_1.default.info('skipping unhashable, invalid policy link:', currentLink);
168
+ logger_1.default.info(`skipping unhashable, invalid policy link:': ${currentLink}`);
169
169
  }
170
- const hash = `${foundType.slug}|${foundTypePolicy.label}`;
170
+ const hash = `${foundType.slug}|${foundTypePolicy.identifier}`;
171
171
  currentLinksHashes[hash] = currentLink;
172
172
  }
173
173
  const reducedLinksByHashes = {};
174
174
  for (const loadedLink of reducedTypePolicyLinks) {
175
- const hash = `${loadedLink.typeSlug}|${loadedLink.typePolicyLabel}`;
175
+ const hash = `${loadedLink.typeSlug}|${loadedLink.typePolicyIdentifier}`;
176
176
  reducedLinksByHashes[hash] = loadedLink;
177
177
  }
178
178
  for (const loadedTPLink of reducedTypePolicyLinks) {
179
179
  try {
180
- const found = currentLinksHashes[`${loadedTPLink.typeSlug}|${loadedTPLink.typePolicyLabel}`];
180
+ const found = currentLinksHashes[`${loadedTPLink.typeSlug}|${loadedTPLink.typePolicyIdentifier}`];
181
181
  if (!found) {
182
182
  if (!transformReducedLink(loadedTPLink, types, currentTypePolicies)) {
183
183
  continue;
@@ -204,7 +204,7 @@ async function uploadTypePolicyLinks(reducedTypePolicyLinks) {
204
204
  try {
205
205
  const found = reducedLinksByHashes[currentLinkHash];
206
206
  if (!found) {
207
- logger_1.default.info('Deleting: ', currentLinkHash);
207
+ logger_1.default.info(`Deleting: ': ${currentLinkHash}`);
208
208
  await new sdk_1.Entities().delete({
209
209
  entityName: 'type-policy-link',
210
210
  id: currentLink['id'],
@@ -219,13 +219,13 @@ async function uploadTypePolicyLinks(reducedTypePolicyLinks) {
219
219
  function transformReducedLink(typePolicyLink, types, typePolicies) {
220
220
  const foundType = types.find((type) => type.slug === typePolicyLink.typeSlug);
221
221
  if (!foundType) {
222
- logger_1.default.error('Could not find type with slug', typePolicyLink.typeSlug);
222
+ logger_1.default.error(`Could not find type with slug ${typePolicyLink.typeSlug}`);
223
223
  return false;
224
224
  }
225
225
  typePolicyLink.typeId = foundType.id;
226
- const foundTypePolicy = typePolicies.find((tpp) => tpp.label === typePolicyLink.typePolicyLabel);
226
+ const foundTypePolicy = typePolicies.find((tpp) => tpp.identifier === typePolicyLink.typePolicyIdentifier);
227
227
  if (!foundTypePolicy) {
228
- logger_1.default.error('Could not find type policy with label', typePolicyLink.typePolicyLabel);
228
+ logger_1.default.error(`Could not find type policy with identifier ${typePolicyLink.typePolicyIdentifier}`);
229
229
  return false;
230
230
  }
231
231
  typePolicyLink.typePolicyId = foundTypePolicy.id;
@@ -40,15 +40,15 @@ async function uploadTypePropertyPolicies(dir) {
40
40
  const [reducedTypePropertyPolicies, reducedTypePropertyPolicyLinks] = await loadTPPolicies(dir);
41
41
  await uploadTPPolicyObjects(reducedTypePropertyPolicies);
42
42
  await uploadTypePropertyPolicyLinks(reducedTypePropertyPolicyLinks);
43
- logger_1.default.info('%s Uploaded', chalk_1.default.yellow.bold('TYPE PROPERTY POLICY'));
43
+ logger_1.default.info(`${chalk_1.default.yellow.bold('TYPE PROPERTY POLICY')} Uploaded`);
44
44
  }
45
45
  catch (e) {
46
- logger_1.default.info(`%s Type Property Policy Upload Failed. ${e}`, chalk_1.default.red.bold('FAIL'));
46
+ logger_1.default.info(`${chalk_1.default.red.bold('FAIL')} Type Property Policy Upload Failed . ${e}`);
47
47
  //TODO make this only print if a debug flag is set
48
48
  console.trace(e);
49
49
  return;
50
50
  }
51
- logger_1.default.info('%s Type Property Policy Upload Complete.', chalk_1.default.green.bold('COMPLETE'));
51
+ logger_1.default.info(`${chalk_1.default.green.bold('COMPLETE')} Type Property Policy Upload Complete.`);
52
52
  }
53
53
  exports.uploadTypePropertyPolicies = uploadTypePropertyPolicies;
54
54
  function loadTPPolicies(fromDir) {
@@ -119,14 +119,14 @@ async function uploadTPPolicyObjects(reducedTypePropertyPolicies) {
119
119
  try {
120
120
  const found = currentTPPByLabel[label];
121
121
  if (!found) {
122
- logger_1.default.info('Creating: ', label);
122
+ logger_1.default.info(`Creating: ': ${label}`);
123
123
  await new sdk_1.Entities().create({
124
124
  entityName: 'type-property-policy',
125
125
  object: loadedTPP,
126
126
  });
127
127
  }
128
128
  else {
129
- logger_1.default.info('Updating: ', label);
129
+ logger_1.default.info(`Updating: ': ${label}`);
130
130
  await new sdk_1.Entities().update({
131
131
  entityName: 'type-property-policy',
132
132
  id: found.id,
@@ -142,7 +142,7 @@ async function uploadTPPolicyObjects(reducedTypePropertyPolicies) {
142
142
  try {
143
143
  const found = loadedTPPByName[label];
144
144
  if (!found) {
145
- logger_1.default.info('Deleting: ', label);
145
+ logger_1.default.info(`Deleting: ': ${label}`);
146
146
  await new sdk_1.Entities().delete({
147
147
  entityName: 'type-property-policy',
148
148
  id: currentTPP['id'],
@@ -177,19 +177,19 @@ async function uploadTypePropertyPolicyLinks(reducedTypePropertyPolicyLinks) {
177
177
  const foundTypeProperty = typeProperties.find((tp) => tp.id === currentLink.typePropertyId);
178
178
  const foundTPP = currentTPPs.find((tpp) => tpp.id === currentLink.typePropertyPolicyId);
179
179
  if (!foundTypeProperty || !foundTPP) {
180
- logger_1.default.info('skipping unhashable, invalid policy link:', currentLink);
180
+ logger_1.default.info(`skipping unhashable, invalid policy link:': ${currentLink}`);
181
181
  }
182
- const hash = `${foundTypeProperty.typeSlug}${foundTypeProperty.slug}|${foundTPP.label}`;
182
+ const hash = `${foundTypeProperty.typeSlug}${foundTypeProperty.slug}|${foundTPP.identifier}`;
183
183
  currentLinksHashes[hash] = currentLink;
184
184
  }
185
185
  const reducedLinksByHashes = {};
186
186
  for (const loadedLink of reducedTypePropertyPolicyLinks) {
187
- const hash = `${loadedLink.typeSlug}|${loadedLink.typePropertySlug}|${loadedLink.typePropertyPolicyLabel}`;
187
+ const hash = `${loadedLink.typeSlug}|${loadedLink.typePropertySlug}|${loadedLink.typePropertyPolicyIdentifier}`;
188
188
  reducedLinksByHashes[hash] = loadedLink;
189
189
  }
190
190
  for (const loadedTPPLink of reducedTypePropertyPolicyLinks) {
191
191
  try {
192
- const found = currentLinksHashes[`${loadedTPPLink.typeSlug}|${loadedTPPLink.typePropertySlug}|${loadedTPPLink.typePropertyPolicyLabel}`];
192
+ const found = currentLinksHashes[`${loadedTPPLink.typeSlug}|${loadedTPPLink.typePropertySlug}|${loadedTPPLink.typePropertyPolicyIdentifier}`];
193
193
  if (!found) {
194
194
  if (!transformReducedLink(loadedTPPLink, typeProperties, currentTPPs)) {
195
195
  continue;
@@ -216,7 +216,7 @@ async function uploadTypePropertyPolicyLinks(reducedTypePropertyPolicyLinks) {
216
216
  try {
217
217
  const found = reducedLinksByHashes[currentLinkHash];
218
218
  if (!found) {
219
- logger_1.default.info('Deleting: ', currentLinkHash);
219
+ logger_1.default.info(`Deleting: ': ${currentLinkHash}`);
220
220
  await new sdk_1.Entities().delete({
221
221
  entityName: 'type-property-policy-link',
222
222
  id: currentLink['id'],
@@ -231,13 +231,13 @@ async function uploadTypePropertyPolicyLinks(reducedTypePropertyPolicyLinks) {
231
231
  function transformReducedLink(TPPLink, typeProperties, typePropertyPolicies) {
232
232
  const foundTP = typeProperties.find((tp) => tp.slug === TPPLink.typePropertySlug && tp.typeSlug === TPPLink.typeSlug);
233
233
  if (!foundTP) {
234
- logger_1.default.error('Could not find type property with label', TPPLink.typePropertySlug);
234
+ logger_1.default.error(`Could not find type property with slug ${TPPLink.typePropertySlug}`);
235
235
  return false;
236
236
  }
237
237
  TPPLink.typePropertyId = foundTP.id;
238
- const foundTPP = typePropertyPolicies.find((tpp) => tpp.label === TPPLink.typePropertyPolicyLabel);
238
+ const foundTPP = typePropertyPolicies.find((tpp) => tpp.identifier === TPPLink.typePropertyPolicyIdentifier);
239
239
  if (!foundTPP) {
240
- logger_1.default.error('Could not find type property policy with label', TPPLink.typePropertyPolicyLabel);
240
+ logger_1.default.error(`Could not find type property policy with identifier ${TPPLink.typePropertyPolicyIdentifier}`);
241
241
  return false;
242
242
  }
243
243
  TPPLink.typePropertyPolicyId = foundTPP.id;
@@ -27,7 +27,7 @@ UploadUsageInfo.examples = [
27
27
  UploadUsageInfo.flags = {
28
28
  dir: core_1.Flags.string({
29
29
  char: 'd',
30
- description: 'The directory from which to export the usage info data. Defaults to the current directory. The option set data will be loaded from $dir/usage-info.yml',
30
+ description: 'The directory from which to export the usage info data. Defaults to the current directory. The usage info data will be loaded from $dir/usage-info.yml',
31
31
  required: false,
32
32
  default: '.',
33
33
  }),
@@ -35,16 +35,16 @@ UploadUsageInfo.flags = {
35
35
  async function uploadUsageInfo(dir) {
36
36
  try {
37
37
  await (0, login_1.authUser)();
38
- logger_1.default.info('%s Uploading', chalk_1.default.yellow.bold('USAGE INFO'));
38
+ logger_1.default.info(`${chalk_1.default.yellow.bold('USAGE INFO')} Uploading`);
39
39
  const reducedUsageInfo = await loadUsageInfo(dir);
40
40
  await uploadUsageInfoObjects(reducedUsageInfo);
41
- logger_1.default.info('%s Uploaded', chalk_1.default.yellow.bold('USAGE INFO'));
41
+ logger_1.default.info(`${chalk_1.default.yellow.bold('USAGE INFO')} Uploaded`);
42
42
  }
43
43
  catch (e) {
44
- logger_1.default.info(`%s Usage Info Upload Failed. ${e}`, chalk_1.default.red.bold('FAIL'));
44
+ logger_1.default.info(`${chalk_1.default.red.bold('FAIL')} Usage Info Upload Failed . ${e}`);
45
45
  return;
46
46
  }
47
- logger_1.default.info('%s Usage Info Upload Complete.', chalk_1.default.green.bold('COMPLETE'));
47
+ logger_1.default.info(`${chalk_1.default.green.bold('COMPLETE')} Usage Info Upload Complete.`);
48
48
  }
49
49
  exports.uploadUsageInfo = uploadUsageInfo;
50
50
  function loadUsageInfo(dir) {
@@ -70,7 +70,7 @@ async function uploadUsageInfoObjects(loadedUsageInfo) {
70
70
  const foundType = typesWithProperties.find((t) => t.id === currentUI.typeId);
71
71
  const foundTypeProperty = typeProperties.find((tp) => tp.id === currentUI.typePropertyId);
72
72
  if (!foundType || !foundTypeProperty) {
73
- logger_1.default.info('skipping unhashable, invalid usage info:', currentUI);
73
+ logger_1.default.info(`skipping unhashable, invalid usage info:': ${currentUI}`);
74
74
  continue;
75
75
  }
76
76
  const hash = `${foundType.slug}|${foundTypeProperty.slug}`;
@@ -81,7 +81,7 @@ async function uploadUsageInfoObjects(loadedUsageInfo) {
81
81
  const hash = `${loadedUI.typeSlug}|${loadedUI.typePropertySlug}`;
82
82
  reducedUsageInfoHashes[hash] = loadedUI;
83
83
  }
84
- logger_1.default.debug('current usage info:', currentUsageInfo);
84
+ logger_1.default.debug(`current usage info:': ${currentUsageInfo}`);
85
85
  logger_1.default.debug('loaded usage info:', loadedUsageInfo);
86
86
  for (const loadedUI of loadedUsageInfo) {
87
87
  try {
@@ -90,7 +90,7 @@ async function uploadUsageInfoObjects(loadedUsageInfo) {
90
90
  if (!transformReducedUI(loadedUI, typesWithProperties, typeProperties)) {
91
91
  continue;
92
92
  }
93
- logger_1.default.debug('Creating: ', loadedUI);
93
+ logger_1.default.debug(`Creating: ': ${loadedUI}`);
94
94
  await new sdk_1.Entities().create({
95
95
  entityName: 'type-property-usage-info',
96
96
  object: {
@@ -110,7 +110,7 @@ async function uploadUsageInfoObjects(loadedUsageInfo) {
110
110
  if (!transformReducedUI(loadedUI, typesWithProperties, typeProperties)) {
111
111
  continue;
112
112
  }
113
- logger_1.default.info('Updating: ', loadedUI);
113
+ logger_1.default.info(`Updating: ': ${loadedUI}`);
114
114
  await new sdk_1.Entities().update({
115
115
  entityName: 'type-property-usage-info',
116
116
  id: found.id,
@@ -129,7 +129,7 @@ async function uploadUsageInfoObjects(loadedUsageInfo) {
129
129
  try {
130
130
  const found = reducedUsageInfoHashes[hash];
131
131
  if (!found) {
132
- logger_1.default.debug('Deleting: ', hash);
132
+ logger_1.default.debug(`Creating: ': ${hash}`);
133
133
  await new sdk_1.Entities().delete({
134
134
  entityName: 'type-property-usage-info',
135
135
  id: currentUI['id'],
@@ -145,13 +145,13 @@ async function uploadUsageInfoObjects(loadedUsageInfo) {
145
145
  function transformReducedUI(reducedUsageInfo, types, typeProperties) {
146
146
  const foundType = types.find((t) => t.slug === reducedUsageInfo.typeSlug);
147
147
  if (!foundType) {
148
- logger_1.default.error('Could not find type with slug', reducedUsageInfo.typeSlug, 'while transforming', reducedUsageInfo);
148
+ logger_1.default.error(`Could not find type with slug ${reducedUsageInfo.typeSlug} while transforming ${reducedUsageInfo}`);
149
149
  return false;
150
150
  }
151
151
  reducedUsageInfo.typeId = foundType.id;
152
152
  const foundTypeProperty = typeProperties.find((tp) => tp.slug === reducedUsageInfo.typePropertySlug);
153
153
  if (!foundTypeProperty) {
154
- logger_1.default.error('Could not find type property with slug', reducedUsageInfo.typePropertySlug, 'while transforming', reducedUsageInfo);
154
+ logger_1.default.error(`Could not find type property with slug ${reducedUsageInfo.typePropertySlug} while transforming ${reducedUsageInfo}`);
155
155
  return false;
156
156
  }
157
157
  reducedUsageInfo.typePropertyId = foundTypeProperty.id;
@@ -1,21 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
3
  const core_1 = require("@oclif/core");
5
4
  const login_1 = require("../../auth/login");
6
5
  const webhooks_1 = require("../../api/webhooks");
7
6
  const basecommand_1 = require("../../basecommand");
8
- const logger_1 = tslib_1.__importDefault(require("../../logger"));
9
7
  class CreateWebhooks extends basecommand_1.BaseCommand {
10
8
  async run() {
11
9
  const { flags } = await this.parse(CreateWebhooks);
12
10
  await (0, login_1.authUser)();
13
11
  const webhook = await (0, webhooks_1.createWebhook)({});
14
12
  if (flags.json) {
15
- logger_1.default.info(JSON.stringify(webhook, null, 2));
13
+ console.log(JSON.stringify(webhook, null, 2));
16
14
  }
17
15
  else {
18
- logger_1.default.info(webhook.id);
16
+ console.log(webhook.id);
19
17
  }
20
18
  }
21
19
  }
@@ -1,21 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
3
  const core_1 = require("@oclif/core");
5
4
  const login_1 = require("../../auth/login");
6
5
  const webhooks_1 = require("../../api/webhooks");
7
6
  const basecommand_1 = require("../../basecommand");
8
- const logger_1 = tslib_1.__importDefault(require("../../logger"));
9
7
  class ListWebhooks extends basecommand_1.BaseCommand {
10
8
  async run() {
11
9
  const { flags } = await this.parse(ListWebhooks);
12
10
  await (0, login_1.authUser)();
13
11
  const webhooks = await (0, webhooks_1.getWebhooks)();
14
12
  if (flags.json) {
15
- logger_1.default.info(JSON.stringify(webhooks, null, 2));
13
+ console.info(JSON.stringify(webhooks, null, 2));
16
14
  }
17
15
  else {
18
- logger_1.default.info(webhooks.map((x) => x.id).join('\n'));
16
+ console.info(webhooks.map((x) => x.id).join('\n'));
19
17
  }
20
18
  }
21
19
  }
@@ -31,7 +31,7 @@ class ActionsDeployer {
31
31
  // FETCH ALL ACTIONS FROM THE API.
32
32
  const existingActions = await getActionsForAppVersion(app);
33
33
  // UPSERT / DELETE BASED ON ACTION IDENTIFIER
34
- logger_1.default.info('%s \tDeploying actions.', chalk_1.default.yellow.bold('ACTION'));
34
+ logger_1.default.info(`${chalk_1.default.yellow.bold('ACTION')} \tDeploying actions.`);
35
35
  if (appDeclaration.actions) {
36
36
  const localActionKeys = Object.keys(appDeclaration.actions);
37
37
  if ((localActionKeys === null || localActionKeys === void 0 ? void 0 : localActionKeys.length) > 0) {
@@ -42,7 +42,7 @@ class ActionsDeployer {
42
42
  }
43
43
  }
44
44
  async deployAction(actionKey, actionDeclaration, app, existingActions) {
45
- logger_1.default.info(`%s \tDeploying action: ${actionKey}`, chalk_1.default.yellow.bold('ACTION'));
45
+ logger_1.default.info(`${chalk_1.default.yellow.bold('ACTION')} \tDeploying action: ${actionKey}`);
46
46
  const identifier = getActionDeclarationIdentifier(actionKey, app);
47
47
  const existingDefinition = existingActions.find((ad) => ad.identifier === identifier);
48
48
  if (!existingDefinition) {
@@ -74,7 +74,7 @@ class ActionsDeployer {
74
74
  entityName: 'event-workflow-action-definition',
75
75
  object: newObject,
76
76
  });
77
- logger_1.default.info(`%s Created new action definition: ${actionKey}`, chalk_1.default.yellow.bold('APP'));
77
+ logger_1.default.info(`${chalk_1.default.yellow.bold('ACTION')} Created new action definition: ${actionKey}`);
78
78
  return actionDefinition;
79
79
  }
80
80
  async updateActionDefinition(existingActionDefinition, actionDeclaration, app) {
@@ -103,7 +103,7 @@ class ActionsDeployer {
103
103
  id: existingActionDefinition.id,
104
104
  object: updates,
105
105
  });
106
- logger_1.default.info(`%s Updated existing action definition: ${actionDefinition.identifier}`, chalk_1.default.yellow.bold('APP'));
106
+ logger_1.default.info(`${chalk_1.default.yellow.bold('ACTION')} Updated existing action definition: ${actionDefinition.identifier}`);
107
107
  return actionDefinition;
108
108
  }
109
109
  async getFunction(actionDeclaration) {
@@ -24,11 +24,11 @@ class AppDeployer {
24
24
  async deploy(appDeclaration) {
25
25
  let app = await this.getExistingApp(appDeclaration);
26
26
  if (!app) {
27
- logger_1.default.info('%s Creating new app.', chalk_1.default.yellow.bold('APP'));
27
+ logger_1.default.info(`${chalk_1.default.yellow.bold('APP')} Creating new app.`);
28
28
  app = await this.createNewApp(appDeclaration);
29
29
  }
30
30
  else {
31
- logger_1.default.info('%s Updating existing app.', chalk_1.default.yellow.bold('APP'));
31
+ logger_1.default.info(`${chalk_1.default.yellow.bold('APP')} Updating existing app.`);
32
32
  app = await this.updateExistingApp(appDeclaration, app);
33
33
  }
34
34
  if (this.dryRun) {
@@ -79,14 +79,14 @@ class AppDeployer {
79
79
  return {};
80
80
  }
81
81
  let app = await new sdk_1.Entities().create({ entityName: 'app', object: newApp });
82
- logger_1.default.info(`%s Created new app: ${app.name}`, chalk_1.default.yellow.bold('APP'));
82
+ logger_1.default.info(`${chalk_1.default.yellow.bold('APP')} Created new app: ${app.name}`);
83
83
  const isDocker = Object.hasOwnProperty.call(appDeclaration, 'dockerImageRef');
84
84
  if (!isDocker) {
85
85
  // this is the expected default behavior
86
86
  const appCodePackage = await createNodePackage(appDeclaration.appIdentifier, this.debug, this.dryRun);
87
87
  app.appCodePackageId = appCodePackage.id;
88
88
  app = await new sdk_1.Entities().update({ entityName: 'app', id: app.id, object: app });
89
- logger_1.default.info(`%s Updated app with code package: ${app.name}`, chalk_1.default.yellow.bold('APP'));
89
+ logger_1.default.info(`${chalk_1.default.yellow.bold('APP')} Updated app with code package: ${app.name}`);
90
90
  }
91
91
  return app;
92
92
  }
@@ -136,7 +136,7 @@ class AppDeployer {
136
136
  id: existingApp.id,
137
137
  object: updates,
138
138
  });
139
- logger_1.default.info(`%s Updated app: ${app.name}`, chalk_1.default.yellow.bold('APP'));
139
+ logger_1.default.info(`${chalk_1.default.yellow.bold('APP')} Updated app: ${app.name}`);
140
140
  return app;
141
141
  }
142
142
  async remove(appDeclaration) {
@@ -144,11 +144,11 @@ class AppDeployer {
144
144
  if (app) {
145
145
  const actions = await (0, actions_deployer_1.getActionsForAppVersion)(app);
146
146
  for (const action of actions) {
147
- logger_1.default.info(`%s Deleting action: ${action.identifier}`, chalk_1.default.yellow.bold('APP'));
147
+ logger_1.default.info(`${chalk_1.default.yellow.bold('APP')} Deleting action: ${action.identifier}`);
148
148
  await (0, actions_deployer_1.deleteAction)(action.id);
149
149
  }
150
150
  app = await new sdk_1.Entities().delete({ entityName: 'app', id: app.id });
151
- logger_1.default.info(`%s Deleted app: ${app.name}`, chalk_1.default.yellow.bold('APP'));
151
+ logger_1.default.info(`${chalk_1.default.green.bold('APP')} Deleted app: ${app.name}`);
152
152
  }
153
153
  else {
154
154
  throw new Error('App not found.');
@@ -177,7 +177,7 @@ async function createNodePackage(appIdentifier, debug, dryRun) {
177
177
  child_process_1.default.execSync('npx tsc --outDir tmp/dist');
178
178
  }
179
179
  catch (e) {
180
- logger_1.default.error('%s Failed to build package.', chalk_1.default.red.bold('APP'));
180
+ logger_1.default.error(`${chalk_1.default.red.bold('APP')} Failed to build package.`);
181
181
  const stdOut = e.stdout.toString();
182
182
  const stdErr = e.stderr.toString();
183
183
  logger_1.default.error('Build Error(stdout):', stdOut);
@@ -224,7 +224,7 @@ async function createNodePackage(appIdentifier, debug, dryRun) {
224
224
  return appCodePackage;
225
225
  }
226
226
  catch (e) {
227
- logger_1.default.error('%s Failed to create app package.', chalk_1.default.red.bold('APP'));
227
+ logger_1.default.error(`${chalk_1.default.red.bold('APP')} Failed to create app package.`);
228
228
  throw e;
229
229
  }
230
230
  finally {