@contrail/cli 2.2.4 → 2.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -17,7 +17,7 @@ $ npm install -g @contrail/cli
17
17
  $ contrail COMMAND
18
18
  running command...
19
19
  $ contrail (--version)
20
- @contrail/cli/2.2.4 darwin-arm64 node-v18.13.0
20
+ @contrail/cli/2.2.6 darwin-arm64 node-v18.13.0
21
21
  $ contrail --help [COMMAND]
22
22
  USAGE
23
23
  $ contrail COMMAND
@@ -131,7 +131,8 @@ function reduceTypePropertyPolicyLinks(data) {
131
131
  const typePropertySlug = (_a = typeProperties.find((y) => y.id === x.typePropertyId)) === null || _a === void 0 ? void 0 : _a.slug;
132
132
  const typePropertyPolicyIdentifier = (_b = data.typePropertyPolicies.find((y) => y.id === x.typePropertyPolicyId)) === null || _b === void 0 ? void 0 : _b.identifier;
133
133
  if (!typeSlug || !typePropertySlug || !typePropertyPolicyIdentifier) {
134
- logger_1.default.warn(`Could not reduce bad type property policy link... skipping ${x}`);
134
+ logger_1.default.debug(`typeSlug: ${typeSlug} typePropertySlug: ${typePropertySlug}, typePropertyPolicyIdentifier: ${typePropertyPolicyIdentifier} `);
135
+ logger_1.default.warn(`Could not reduce bad type property policy link... skipping ${JSON.stringify(x, null, 2)}`);
135
136
  return null;
136
137
  }
137
138
  return {
@@ -325,6 +326,8 @@ function reduceTypes(dataHolder) {
325
326
  referencedTypeRootSlug: typeProperty.referencedTypeRootSlug,
326
327
  defaultValue: typeProperty.defaultValue,
327
328
  propertyLevel: typeProperty.propertyLevel,
329
+ carryOverBehavior: typeProperty.carryOverBehavior,
330
+ carryOverDefault: typeProperty.carryOverDefault,
328
331
  inherited: typeProperty.inherited,
329
332
  formulaFunction: typeProperty.formulaFunction,
330
333
  validationFunction: typeProperty.validationFunction,
@@ -94,7 +94,7 @@ function mergeOptionSet(existingOptionSet, uploadedOptionSet) {
94
94
  var _a;
95
95
  const merged = {
96
96
  name: uploadedOptionSet.name,
97
- identifier: uploadedOptionSet.identifier,
97
+ slug: uploadedOptionSet.slug,
98
98
  optionSet: uploadedOptionSet.optionSet,
99
99
  isArchived: uploadedOptionSet.isArchived,
100
100
  };
@@ -78,28 +78,28 @@ async function uploadOSH(loadedOSHs) {
78
78
  const currentOSHs = await new sdk_1.Entities().get({
79
79
  entityName: 'option-set-hierarchy',
80
80
  });
81
- const optionSetsByName = {};
81
+ const optionSetsByIdentifier = {};
82
82
  for (const optionSet of optionSets) {
83
- optionSetsByName[optionSet.name] = optionSet;
83
+ optionSetsByIdentifier[optionSet.identifier] = optionSet;
84
84
  }
85
- const currentOSHByName = {};
85
+ const currentOSHByIdentifier = {};
86
86
  for (const currentOSH of currentOSHs) {
87
- currentOSHByName[currentOSH.name] = currentOSH;
87
+ currentOSHByIdentifier[currentOSH.identifier] = currentOSH;
88
88
  }
89
- const loadedOSHByName = {};
89
+ const loadedOSHByIdentifier = {};
90
90
  for (const loadedOSH of loadedOSHs) {
91
- loadedOSHByName[loadedOSH.name] = loadedOSH;
91
+ loadedOSHByIdentifier[loadedOSH.identifier] = loadedOSH;
92
92
  }
93
93
  logger_1.default.debug(`current OSH: ${currentOSHs}`);
94
94
  logger_1.default.debug(`loaded OSH: ${loadedOSHs}`);
95
95
  for (const osh of loadedOSHs) {
96
96
  try {
97
- const found = currentOSHByName[osh.name];
97
+ const found = currentOSHByIdentifier[osh.identifier];
98
98
  if (!found) {
99
99
  if (!transformOSHNameToID(osh.hierarchy, optionSets)) {
100
100
  continue;
101
101
  }
102
- logger_1.default.debug(`Creating: ${JSON.stringify(osh)}`);
102
+ logger_1.default.debug(`Creating: ${JSON.stringify(osh, null, 2)}`);
103
103
  await new sdk_1.Entities().create({
104
104
  entityName: 'option-set-hierarchy',
105
105
  object: osh,
@@ -118,12 +118,12 @@ async function uploadOSH(loadedOSHs) {
118
118
  }
119
119
  }
120
120
  catch (err) {
121
- throw new Error(`Error Uploading option set hierarchy: ${err}`);
121
+ logger_1.default.error(`Error Uploading option set hierarchy: ${err}`);
122
122
  }
123
123
  }
124
124
  for (const currentOSH of currentOSHs) {
125
125
  try {
126
- const found = loadedOSHByName[currentOSH.name];
126
+ const found = loadedOSHByIdentifier[currentOSH.name];
127
127
  if (!found) {
128
128
  logger_1.default.info(`Deleting: ${currentOSH.name}`);
129
129
  await new sdk_1.Entities().delete({
@@ -133,7 +133,7 @@ async function uploadOSH(loadedOSHs) {
133
133
  }
134
134
  }
135
135
  catch (err) {
136
- throw new Error(`Error Deleting Option set hierarchy: ${err}`);
136
+ logger_1.default.error(`Error Deleting Option set hierarchy: ${err}`);
137
137
  }
138
138
  }
139
139
  }
@@ -141,7 +141,7 @@ async function uploadOSH(loadedOSHs) {
141
141
  function transformOSHNameToID(hierarchy, optionSets) {
142
142
  logger_1.default.info(`passed hierarchy: ${hierarchy}`);
143
143
  for (let i = 0; i < hierarchy.length; i++) {
144
- const os = optionSets.find((os) => os.name === hierarchy[i]);
144
+ const os = optionSets.find((os) => os.slug === hierarchy[i]);
145
145
  if (!os) {
146
146
  logger_1.default.error(`could not find option set with name ${hierarchy[i]} at position ${i}. skipping...`);
147
147
  return false;
@@ -178,7 +178,7 @@ async function uploadOSHLinks(reducedOSHLinks) {
178
178
  if (!foundType ||
179
179
  !foundOSH ||
180
180
  foundTPSlugs.length !== currentLink.hierarchyTypePropertyIds.length) {
181
- logger_1.default.info(`skipping unhashable, invalid type option set hierarchy link: ${currentLink}`);
181
+ logger_1.default.info(`skipping unhashable, invalid type option set hierarchy link: ${JSON.stringify(currentLink, null, 2)}`);
182
182
  }
183
183
  // don't mutate original array
184
184
  const sortedFoundTPSlugs = [...foundTPSlugs].sort();
@@ -201,7 +201,7 @@ async function uploadOSHLinks(reducedOSHLinks) {
201
201
  if (!transformReducedLink(loadedLink, typesWithProperties, currentOSHs)) {
202
202
  continue;
203
203
  }
204
- logger_1.default.debug(`Creating: ${JSON.stringify(loadedLink)}`);
204
+ logger_1.default.debug(`Creating: ${JSON.stringify(loadedLink, null, 2)}`);
205
205
  await new sdk_1.Entities().create({
206
206
  entityName: 'type-option-set-hierarchy-link',
207
207
  object: {
@@ -213,7 +213,7 @@ async function uploadOSHLinks(reducedOSHLinks) {
213
213
  }
214
214
  }
215
215
  catch (err) {
216
- throw new Error(`Error uploading type option set hierarchy links: ${err}`);
216
+ logger_1.default.error(`Error uploading type option set hierarchy links: ${err}`);
217
217
  }
218
218
  }
219
219
  for (const [currentLinkHash, currentLink] of Object.entries(currentOSHLinkHashes)) {
@@ -228,7 +228,7 @@ async function uploadOSHLinks(reducedOSHLinks) {
228
228
  }
229
229
  }
230
230
  catch (err) {
231
- throw new Error(`Error Deleting rule set link: ${err}`);
231
+ logger_1.default.error(`Error Deleting rule set link: ${err}`);
232
232
  }
233
233
  }
234
234
  }
@@ -65,40 +65,41 @@ async function uploadOS(dir) {
65
65
  const currentOptionSets = await new sdk_1.Entities().get({
66
66
  entityName: 'type-property-option-set',
67
67
  });
68
- const currentOptionSetsByIdentifier = {};
68
+ const currentOptionSetsBySlug = {};
69
69
  for (const currentOptionSet of currentOptionSets) {
70
- currentOptionSetsByIdentifier[currentOptionSet.identifier] = currentOptionSet;
70
+ currentOptionSetsBySlug[currentOptionSet.slug] = currentOptionSet;
71
71
  }
72
- const newOptionSetsByIdentifier = {};
72
+ const newOptionSetsBySlug = {};
73
73
  for (const optionSet of optionSets) {
74
- newOptionSetsByIdentifier[optionSet.identifier] = optionSet;
74
+ newOptionSetsBySlug[optionSet.slug] = optionSet;
75
75
  }
76
76
  for (const optionSet of optionSets) {
77
77
  try {
78
- const found = currentOptionSetsByIdentifier[optionSet.identifier];
78
+ const found = currentOptionSetsBySlug[optionSet.slug];
79
79
  if (!found) {
80
80
  if (!optionSet.optionSet) {
81
- logger_1.default.info(`No OptionSet for: ${optionSet.identifier}`);
81
+ logger_1.default.info(`No OptionSet for: ${optionSet.slug}`);
82
82
  continue;
83
83
  }
84
- logger_1.default.info(`Creating: ${optionSet.identifier}`);
84
+ logger_1.default.info(`Creating: ${JSON.stringify(optionSet, null, 2)}`);
85
85
  await new sdk_1.Entities().create({
86
86
  entityName: 'type-property-option-set',
87
87
  object: {
88
88
  name: optionSet.name,
89
- identifier: optionSet.identifier,
89
+ slug: optionSet.slug,
90
90
  optionSet: optionSet.optionSet,
91
91
  isArchived: optionSet.isArchived,
92
92
  },
93
93
  });
94
94
  }
95
95
  else {
96
- logger_1.default.info(`Updating: ${optionSet.identifier}`);
96
+ logger_1.default.info(`Updating: ${optionSet.slug}`);
97
97
  await new sdk_1.Entities().update({
98
98
  entityName: 'type-property-option-set',
99
99
  id: found.id,
100
100
  object: {
101
101
  name: optionSet.name,
102
+ slug: optionSet.slug,
102
103
  optionSet: optionSet.optionSet,
103
104
  isArchived: optionSet.isArchived,
104
105
  },
@@ -106,14 +107,14 @@ async function uploadOS(dir) {
106
107
  }
107
108
  }
108
109
  catch (err) {
109
- throw new Error(`Error Uploading OptionSets: ${err}`);
110
+ logger_1.default.error(`Error Uploading OptionSets: ${err}`);
110
111
  }
111
112
  }
112
113
  for (const currentOptionSet of currentOptionSets) {
113
114
  try {
114
- const found = newOptionSetsByIdentifier[currentOptionSet.identifier];
115
+ const found = newOptionSetsBySlug[currentOptionSet.slug];
115
116
  if (!found) {
116
- logger_1.default.info(`Deleting: ${currentOptionSet.identifier}`);
117
+ logger_1.default.info(`Deleting: ${currentOptionSet.slug}`);
117
118
  await new sdk_1.Entities().delete({
118
119
  entityName: 'type-property-option-set',
119
120
  id: currentOptionSet.id,
@@ -121,7 +122,7 @@ async function uploadOS(dir) {
121
122
  }
122
123
  }
123
124
  catch (err) {
124
- throw new Error(`Error Deleting OptionSets: ${err}`);
125
+ logger_1.default.error(`Error Deleting OptionSets: ${err}`);
125
126
  }
126
127
  }
127
128
  }
@@ -97,7 +97,7 @@ async function uploadRuleSetObjects(reducedRuleSets) {
97
97
  }
98
98
  }
99
99
  catch (err) {
100
- throw new Error(`Error Uploading rule sets: ${err}`);
100
+ logger_1.default.error(`Error Uploading rule sets: ${err}`);
101
101
  }
102
102
  }
103
103
  for (const currentRuleSet of currentRuleSets) {
@@ -112,7 +112,7 @@ async function uploadRuleSetObjects(reducedRuleSets) {
112
112
  }
113
113
  }
114
114
  catch (err) {
115
- throw new Error(`Error Deleting rule set: ${err}`);
115
+ logger_1.default.error(`Error Deleting rule set: ${err}`);
116
116
  }
117
117
  }
118
118
  }
@@ -145,7 +145,7 @@ async function uploadRuleSetLinkObjects(loadedRuleSetLinks) {
145
145
  if (!transformReducedLink(loadedRuleSetLink, types, currentRuleSets)) {
146
146
  continue;
147
147
  }
148
- logger_1.default.info(`Creating: ${loadedRuleSetLink}`);
148
+ logger_1.default.info(`Creating: ${JSON.stringify(loadedRuleSetLink, null, 2)}`);
149
149
  await new sdk_1.Entities().create({
150
150
  entityName: 'type-rule-set-link',
151
151
  object: {
@@ -162,7 +162,7 @@ async function uploadRuleSetLinkObjects(loadedRuleSetLinks) {
162
162
  }
163
163
  }
164
164
  catch (err) {
165
- throw new Error(`Error Uploading rule set links: ${err}`);
165
+ logger_1.default.error(`Error Uploading rule set links: ${err}`);
166
166
  }
167
167
  }
168
168
  for (const [currentLinkHash, currentLink] of Object.entries(currentLinksHashes)) {
@@ -177,7 +177,7 @@ async function uploadRuleSetLinkObjects(loadedRuleSetLinks) {
177
177
  }
178
178
  }
179
179
  catch (err) {
180
- throw new Error(`Error Deleting rule set link: ${err}`);
180
+ logger_1.default.error(`Error Deleting rule set link: ${err}`);
181
181
  }
182
182
  }
183
183
  }
@@ -188,7 +188,7 @@ function transformReducedLink(ruleSetLink, types, ruleSets) {
188
188
  return false;
189
189
  }
190
190
  ruleSetLink.type = foundType.id;
191
- const foundRuleSet = ruleSets.find((rs) => rs.name === ruleSetLink.ruleSet);
191
+ const foundRuleSet = ruleSets.find((rs) => rs.identifier === ruleSetLink.ruleSet);
192
192
  if (!foundRuleSet) {
193
193
  logger_1.default.error(`Could not find rule set with name ${foundType.ruleSet}`);
194
194
  return false;
@@ -133,7 +133,7 @@ async function uploadTypePolicyObjects(reducedTypePolicies) {
133
133
  }
134
134
  }
135
135
  catch (err) {
136
- throw new Error(`Error Uploading Type Policy: ${err}`);
136
+ logger_1.default.error(`Error Uploading Type Policy: ${err}`);
137
137
  }
138
138
  }
139
139
  for (const [identifier, currentTPP] of Object.entries(currentTypePolicyByIdentifier)) {
@@ -148,7 +148,7 @@ async function uploadTypePolicyObjects(reducedTypePolicies) {
148
148
  }
149
149
  }
150
150
  catch (err) {
151
- throw new Error(`Error Type Policy: ${err}`);
151
+ logger_1.default.error(`Error Type Policy: ${err}`);
152
152
  }
153
153
  }
154
154
  }
@@ -165,7 +165,7 @@ 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: ${JSON.stringify(currentLink, null, 2)}`);
169
169
  }
170
170
  const hash = `${foundType.slug}|${foundTypePolicy.identifier}`;
171
171
  currentLinksHashes[hash] = currentLink;
@@ -197,7 +197,7 @@ async function uploadTypePolicyLinks(reducedTypePolicyLinks) {
197
197
  }
198
198
  }
199
199
  catch (err) {
200
- throw new Error(`Error Uploading type policy links: ${err}`);
200
+ logger_1.default.error(`Error Uploading type policy links: ${err}`);
201
201
  }
202
202
  }
203
203
  for (const [currentLinkHash, currentLink] of Object.entries(currentLinksHashes)) {
@@ -212,7 +212,7 @@ async function uploadTypePolicyLinks(reducedTypePolicyLinks) {
212
212
  }
213
213
  }
214
214
  catch (err) {
215
- throw new Error(`Error Deleting rule set link: ${err}`);
215
+ logger_1.default.error(`Error Deleting rule set link: ${err}`);
216
216
  }
217
217
  }
218
218
  }
@@ -107,26 +107,26 @@ async function uploadTPPolicyObjects(reducedTypePropertyPolicies) {
107
107
  const currentTPPolicies = await new sdk_1.Entities().get({
108
108
  entityName: 'type-property-policy',
109
109
  });
110
- const currentTPPByLabel = {};
110
+ const currentTPPByIdentifier = {};
111
111
  for (const currentTPP of currentTPPolicies) {
112
- currentTPPByLabel[currentTPP.label] = currentTPP;
112
+ currentTPPByIdentifier[currentTPP.identifier] = currentTPP;
113
113
  }
114
- const loadedTPPByName = {};
114
+ const loadedTPPByIdentifier = {};
115
115
  for (const loadedTPP of reducedTypePropertyPolicies) {
116
- loadedTPPByName[loadedTPP.label] = loadedTPP;
116
+ loadedTPPByIdentifier[loadedTPP.identifier] = loadedTPP;
117
117
  }
118
- for (const [label, loadedTPP] of Object.entries(loadedTPPByName)) {
118
+ for (const [identifier, loadedTPP] of Object.entries(loadedTPPByIdentifier)) {
119
119
  try {
120
- const found = currentTPPByLabel[label];
120
+ const found = currentTPPByIdentifier[identifier];
121
121
  if (!found) {
122
- logger_1.default.info(`Creating: ${label}`);
122
+ logger_1.default.info(`Creating: ${identifier}`);
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: ${identifier}`);
130
130
  await new sdk_1.Entities().update({
131
131
  entityName: 'type-property-policy',
132
132
  id: found.id,
@@ -135,14 +135,14 @@ async function uploadTPPolicyObjects(reducedTypePropertyPolicies) {
135
135
  }
136
136
  }
137
137
  catch (err) {
138
- throw new Error(`Error Uploading Type Property Policy: ${err}`);
138
+ logger_1.default.error(`Error Uploading Type Property Policy: ${err}`);
139
139
  }
140
140
  }
141
- for (const [label, currentTPP] of Object.entries(currentTPPByLabel)) {
141
+ for (const [identifier, currentTPP] of Object.entries(currentTPPByIdentifier)) {
142
142
  try {
143
- const found = loadedTPPByName[label];
143
+ const found = loadedTPPByIdentifier[identifier];
144
144
  if (!found) {
145
- logger_1.default.info(`Deleting: ${label}`);
145
+ logger_1.default.info(`Deleting: ${identifier}`);
146
146
  await new sdk_1.Entities().delete({
147
147
  entityName: 'type-property-policy',
148
148
  id: currentTPP['id'],
@@ -150,7 +150,7 @@ async function uploadTPPolicyObjects(reducedTypePropertyPolicies) {
150
150
  }
151
151
  }
152
152
  catch (err) {
153
- throw new Error(`Error Type Property Policy: ${err}`);
153
+ logger_1.default.error(`Error Type Property Policy: ${err}`);
154
154
  }
155
155
  }
156
156
  }
@@ -177,7 +177,8 @@ 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: ${JSON.stringify(currentLink, null, 2)}`);
181
+ continue;
181
182
  }
182
183
  const hash = `${foundTypeProperty.typeSlug}${foundTypeProperty.slug}|${foundTPP.identifier}`;
183
184
  currentLinksHashes[hash] = currentLink;
@@ -209,7 +210,7 @@ async function uploadTypePropertyPolicyLinks(reducedTypePropertyPolicyLinks) {
209
210
  }
210
211
  }
211
212
  catch (err) {
212
- throw new Error(`Error Uploading type property policy links: ${err}`);
213
+ logger_1.default.error(`Error Uploading type property policy links: ${err}`);
213
214
  }
214
215
  }
215
216
  for (const [currentLinkHash, currentLink] of Object.entries(currentLinksHashes)) {
@@ -224,7 +225,7 @@ async function uploadTypePropertyPolicyLinks(reducedTypePropertyPolicyLinks) {
224
225
  }
225
226
  }
226
227
  catch (err) {
227
- throw new Error(`Error Deleting type property policy link: ${err}`);
228
+ logger_1.default.error(`Error Deleting type property policy link: ${err}`);
228
229
  }
229
230
  }
230
231
  }
@@ -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: ${JSON.stringify(currentUI, null, 2)}`);
74
74
  continue;
75
75
  }
76
76
  const hash = `${foundType.slug}|${foundTypeProperty.slug}`;
@@ -122,7 +122,7 @@ async function uploadUsageInfoObjects(loadedUsageInfo) {
122
122
  }
123
123
  }
124
124
  catch (err) {
125
- throw new Error(`Error Uploading usage info: ${err}`);
125
+ logger_1.default.error(`Error Uploading usage info: ${err}`);
126
126
  }
127
127
  }
128
128
  for (const [hash, currentUI] of Object.entries(currentUsageInfosHashes)) {
@@ -137,7 +137,7 @@ async function uploadUsageInfoObjects(loadedUsageInfo) {
137
137
  }
138
138
  }
139
139
  catch (err) {
140
- throw new Error(`Error Deleting usage info: ${err}`);
140
+ logger_1.default.error(`Error Deleting usage info: ${err}`);
141
141
  }
142
142
  }
143
143
  }
@@ -40,9 +40,7 @@ function visibilityValidator(appDeclaration) {
40
40
  error: 'Invalid visibility. Visibility must be "public" or "private".',
41
41
  };
42
42
  }
43
- if (appDeclaration.visibility === 'private' &&
44
- Object.prototype.hasOwnProperty.call(appDeclaration, 'hidden') &&
45
- appDeclaration.hidden === true) {
43
+ if (appDeclaration.visibility === 'private' && appDeclaration.hidden !== true) {
46
44
  return {
47
45
  error: 'Apps can not be private and hidden.',
48
46
  };
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const app_config_validators_1 = require("./app-config-validators");
4
- const app_config_validators_2 = require("./app-config-validators");
5
4
  describe('appVersionValidator', () => {
6
5
  it('should return an error if "version" field is missing', () => {
7
6
  const appDeclaration = {};
@@ -66,41 +65,3 @@ it('should return an error if app version has invalid format', () => {
66
65
  const validationResult = (0, app_config_validators_1.appVersionValidator)(appDeclaration);
67
66
  expect(validationResult).toEqual(expectedError);
68
67
  });
69
- describe('visibilityValidator', () => {
70
- it('should return an error if visibility is neither "public" nor "private"', () => {
71
- const appDeclaration = {
72
- visibility: 'invalidVisibility',
73
- };
74
- const expectedError = {
75
- error: 'Invalid visibility. Visibility must be "public" or "private".',
76
- };
77
- const validationResult = (0, app_config_validators_2.visibilityValidator)(appDeclaration);
78
- expect(validationResult).toEqual(expectedError);
79
- });
80
- it('should return an error if app is private and not hidden', () => {
81
- const appDeclaration = {
82
- visibility: 'private',
83
- hidden: true,
84
- };
85
- const expectedError = {
86
- error: 'Apps can not be private and hidden.',
87
- };
88
- const validationResult = (0, app_config_validators_2.visibilityValidator)(appDeclaration);
89
- expect(validationResult).toEqual(expectedError);
90
- });
91
- it('should not return an error if visibility is "public"', () => {
92
- const appDeclaration = {
93
- visibility: 'public',
94
- };
95
- const validationResult = (0, app_config_validators_2.visibilityValidator)(appDeclaration);
96
- expect(validationResult).toBeUndefined();
97
- });
98
- it('should not return an error if app is private and hidden', () => {
99
- const appDeclaration = {
100
- visibility: 'private',
101
- hidden: false,
102
- };
103
- const validationResult = (0, app_config_validators_2.visibilityValidator)(appDeclaration);
104
- expect(validationResult).toBeUndefined();
105
- });
106
- });
@@ -104,7 +104,7 @@ async function uploadReducedTypes(dir) {
104
104
  }
105
105
  }
106
106
  async function uploadReducedTypeProperties(type, currentPropertyTypes, newPropertyTypes) {
107
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
107
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
108
108
  const currentPropertyTypeBySlug = {};
109
109
  for (const currentPropertyType of currentPropertyTypes) {
110
110
  currentPropertyTypeBySlug[currentPropertyType.slug] = currentPropertyType;
@@ -116,9 +116,9 @@ async function uploadReducedTypeProperties(type, currentPropertyTypes, newProper
116
116
  const optionSets = await new sdk_1.Entities().get({
117
117
  entityName: 'type-property-option-set',
118
118
  });
119
- const optionSetIdByIdentifier = {};
119
+ const optionSetIdBySlug = {};
120
120
  for (const optionSet of optionSets) {
121
- optionSetIdByIdentifier[optionSet.identifier] = optionSet.id;
121
+ optionSetIdBySlug[optionSet.slug] = optionSet.id;
122
122
  }
123
123
  for (const newPropertyType of newPropertyTypes) {
124
124
  try {
@@ -135,9 +135,11 @@ async function uploadReducedTypeProperties(type, currentPropertyTypes, newProper
135
135
  editable: newPropertyType.editable,
136
136
  searchable: newPropertyType.searchable,
137
137
  core: newPropertyType.core,
138
- typePropertyOptionSetId: optionSetIdByIdentifier[newPropertyType.typePropertyOptionSetSlug],
138
+ typePropertyOptionSetId: optionSetIdBySlug[newPropertyType.typePropertyOptionSetSlug],
139
139
  formula: newPropertyType.formula,
140
140
  referencedTypePath: newPropertyType.referencedTypePath,
141
+ carryOverBehavior: newPropertyType.carryOverBehavior,
142
+ carryOverDefault: newPropertyType.carryOverDefault,
141
143
  referencedTypeRootSlug: newPropertyType.referencedTypeRootSlug,
142
144
  defaultValue: newPropertyType.defaultValue,
143
145
  propertyLevel: newPropertyType.propertyLevel,
@@ -154,7 +156,7 @@ async function uploadReducedTypeProperties(type, currentPropertyTypes, newProper
154
156
  }
155
157
  else if (found &&
156
158
  !newPropertyType.inherited &&
157
- !typePropertiesEqual(found, newPropertyType, optionSetIdByIdentifier)) {
159
+ !typePropertiesEqual(found, newPropertyType, optionSetIdBySlug)) {
158
160
  logger_1.default.info(`Updating Type-Property: ${newPropertyType.slug}`);
159
161
  await new sdk_1.Entities().update({
160
162
  entityName: 'type-property',
@@ -167,16 +169,18 @@ async function uploadReducedTypeProperties(type, currentPropertyTypes, newProper
167
169
  editable: (_e = newPropertyType.editable) !== null && _e !== void 0 ? _e : null,
168
170
  searchable: (_f = newPropertyType.searchable) !== null && _f !== void 0 ? _f : null,
169
171
  core: (_g = newPropertyType.core) !== null && _g !== void 0 ? _g : null,
170
- typePropertyOptionSetId: (_h = optionSetIdByIdentifier[newPropertyType.typePropertyOptionSetSlug]) !== null && _h !== void 0 ? _h : null,
172
+ typePropertyOptionSetId: (_h = optionSetIdBySlug[newPropertyType.typePropertyOptionSetSlug]) !== null && _h !== void 0 ? _h : null,
171
173
  formula: (_j = newPropertyType.formula) !== null && _j !== void 0 ? _j : null,
172
174
  referencedTypePath: (_k = newPropertyType.referencedTypePath) !== null && _k !== void 0 ? _k : null,
173
- referencedTypeRootSlug: (_l = newPropertyType.referencedTypeRootSlug) !== null && _l !== void 0 ? _l : null,
174
- defaultValue: (_m = newPropertyType.defaultValue) !== null && _m !== void 0 ? _m : null,
175
- propertyLevel: (_o = newPropertyType.propertyLevel) !== null && _o !== void 0 ? _o : null,
176
- formulaFunction: (_p = newPropertyType.formulaFunction) !== null && _p !== void 0 ? _p : null,
177
- validationFunction: (_q = newPropertyType.validationFunction) !== null && _q !== void 0 ? _q : null,
178
- numberFormat: (_r = newPropertyType.numberFormat) !== null && _r !== void 0 ? _r : null,
179
- sequenceSeedValue: (_s = newPropertyType.sequenceSeedValue) !== null && _s !== void 0 ? _s : null,
175
+ carryOverBehavior: (_l = newPropertyType.carryOverBehavior) !== null && _l !== void 0 ? _l : null,
176
+ carryOverDefault: (_m = newPropertyType.carryOverDefault) !== null && _m !== void 0 ? _m : null,
177
+ referencedTypeRootSlug: (_o = newPropertyType.referencedTypeRootSlug) !== null && _o !== void 0 ? _o : null,
178
+ defaultValue: (_p = newPropertyType.defaultValue) !== null && _p !== void 0 ? _p : null,
179
+ propertyLevel: (_q = newPropertyType.propertyLevel) !== null && _q !== void 0 ? _q : null,
180
+ formulaFunction: (_r = newPropertyType.formulaFunction) !== null && _r !== void 0 ? _r : null,
181
+ validationFunction: (_s = newPropertyType.validationFunction) !== null && _s !== void 0 ? _s : null,
182
+ numberFormat: (_t = newPropertyType.numberFormat) !== null && _t !== void 0 ? _t : null,
183
+ sequenceSeedValue: (_u = newPropertyType.sequenceSeedValue) !== null && _u !== void 0 ? _u : null,
180
184
  },
181
185
  });
182
186
  }
@@ -219,6 +223,8 @@ function typePropertiesEqual(typeProperty1, typeProperty2, optionSetIdByIdentifi
219
223
  referencedTypeRootSlug: typeProperty1.referencedTypeRootSlug,
220
224
  defaultValue: typeProperty1.defaultValue,
221
225
  propertyLevel: typeProperty1.propertyLevel,
226
+ carryOverBehavior: typeProperty1.carryOverBehavior,
227
+ carryOverDefault: typeProperty1.carryOverDefault,
222
228
  formulaFunction: typeProperty1.formulaFunction,
223
229
  validationFunction: typeProperty1.validationFunction,
224
230
  numberFormat: typeProperty1.numberFormat,
@@ -238,6 +244,8 @@ function typePropertiesEqual(typeProperty1, typeProperty2, optionSetIdByIdentifi
238
244
  referencedTypeRootSlug: typeProperty2.referencedTypeRootSlug,
239
245
  defaultValue: typeProperty2.defaultValue,
240
246
  propertyLevel: typeProperty2.propertyLevel,
247
+ carryOverBehavior: typeProperty2.carryOverBehavior,
248
+ carryOverDefault: typeProperty2.carryOverDefault,
241
249
  formulaFunction: typeProperty2.formulaFunction,
242
250
  validationFunction: typeProperty2.validationFunction,
243
251
  numberFormat: typeProperty2.numberFormat,
@@ -325,6 +325,8 @@ export interface ReducedTypeProperty {
325
325
  isArchived: boolean;
326
326
  propertyType: PropertyType;
327
327
  slug: string;
328
+ carryOverDefault: any;
329
+ carryOverBehavior: string;
328
330
  label: string;
329
331
  editable: boolean;
330
332
  searchable: boolean;
@@ -343,7 +345,7 @@ export interface ReducedTypeProperty {
343
345
  }
344
346
  export interface ReducedOptionSet {
345
347
  name: string;
346
- identifier: string;
348
+ slug: string;
347
349
  isArchived: boolean;
348
350
  optionSet: any[];
349
351
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.2.4",
2
+ "version": "2.2.6",
3
3
  "commands": {
4
4
  "app:create": {
5
5
  "id": "app:create",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/cli",
3
- "version": "2.2.4",
3
+ "version": "2.2.6",
4
4
  "description": "VibeIQ's Contrail Platform CLI.",
5
5
  "bin": {
6
6
  "contrail-cli": "./bin/run",