@contrail/cli 2.2.3 → 2.2.5
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 +1 -1
- package/dist/commands/types/getAll.js +4 -1
- package/dist/commands/types/mergeOptionSets.js +1 -1
- package/dist/commands/types/uploadOptionSetHierarchies.js +15 -15
- package/dist/commands/types/uploadOptionSets.js +14 -13
- package/dist/commands/types/uploadRuleSets.js +6 -6
- package/dist/commands/types/uploadTypePolicies.js +4 -4
- package/dist/commands/types/uploadTypePropertyPolicies.js +16 -15
- package/dist/commands/types/uploadUsageInfo.js +2 -2
- package/dist/helpers/types/type-uploader.js +21 -13
- package/dist/interfaces.d.ts +3 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
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.
|
|
20
|
+
@contrail/cli/2.2.5 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.
|
|
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
|
-
|
|
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
|
|
81
|
+
const optionSetsByIdentifier = {};
|
|
82
82
|
for (const optionSet of optionSets) {
|
|
83
|
-
|
|
83
|
+
optionSetsByIdentifier[optionSet.identifier] = optionSet;
|
|
84
84
|
}
|
|
85
|
-
const
|
|
85
|
+
const currentOSHByIdentifier = {};
|
|
86
86
|
for (const currentOSH of currentOSHs) {
|
|
87
|
-
|
|
87
|
+
currentOSHByIdentifier[currentOSH.identifier] = currentOSH;
|
|
88
88
|
}
|
|
89
|
-
const
|
|
89
|
+
const loadedOSHByIdentifier = {};
|
|
90
90
|
for (const loadedOSH of loadedOSHs) {
|
|
91
|
-
|
|
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 =
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
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.
|
|
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;
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
|
68
|
+
const currentOptionSetsBySlug = {};
|
|
69
69
|
for (const currentOptionSet of currentOptionSets) {
|
|
70
|
-
|
|
70
|
+
currentOptionSetsBySlug[currentOptionSet.slug] = currentOptionSet;
|
|
71
71
|
}
|
|
72
|
-
const
|
|
72
|
+
const newOptionSetsBySlug = {};
|
|
73
73
|
for (const optionSet of optionSets) {
|
|
74
|
-
|
|
74
|
+
newOptionSetsBySlug[optionSet.slug] = optionSet;
|
|
75
75
|
}
|
|
76
76
|
for (const optionSet of optionSets) {
|
|
77
77
|
try {
|
|
78
|
-
const found =
|
|
78
|
+
const found = currentOptionSetsBySlug[optionSet.slug];
|
|
79
79
|
if (!found) {
|
|
80
80
|
if (!optionSet.optionSet) {
|
|
81
|
-
logger_1.default.info(`No OptionSet for: ${optionSet.
|
|
81
|
+
logger_1.default.info(`No OptionSet for: ${optionSet.slug}`);
|
|
82
82
|
continue;
|
|
83
83
|
}
|
|
84
|
-
logger_1.default.info(`Creating: ${optionSet
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
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 =
|
|
115
|
+
const found = newOptionSetsBySlug[currentOptionSet.slug];
|
|
115
116
|
if (!found) {
|
|
116
|
-
logger_1.default.info(`Deleting: ${currentOptionSet.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
151
|
+
logger_1.default.error(`Error Type Policy: ${err}`);
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
}
|
|
@@ -197,7 +197,7 @@ async function uploadTypePolicyLinks(reducedTypePolicyLinks) {
|
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
catch (err) {
|
|
200
|
-
|
|
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
|
-
|
|
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
|
|
110
|
+
const currentTPPByIdentifier = {};
|
|
111
111
|
for (const currentTPP of currentTPPolicies) {
|
|
112
|
-
|
|
112
|
+
currentTPPByIdentifier[currentTPP.identifier] = currentTPP;
|
|
113
113
|
}
|
|
114
|
-
const
|
|
114
|
+
const loadedTPPByIdentifier = {};
|
|
115
115
|
for (const loadedTPP of reducedTypePropertyPolicies) {
|
|
116
|
-
|
|
116
|
+
loadedTPPByIdentifier[loadedTPP.identifier] = loadedTPP;
|
|
117
117
|
}
|
|
118
|
-
for (const [
|
|
118
|
+
for (const [identifier, loadedTPP] of Object.entries(loadedTPPByIdentifier)) {
|
|
119
119
|
try {
|
|
120
|
-
const found =
|
|
120
|
+
const found = currentTPPByIdentifier[identifier];
|
|
121
121
|
if (!found) {
|
|
122
|
-
logger_1.default.info(`Creating: ${
|
|
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: ${
|
|
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
|
-
|
|
138
|
+
logger_1.default.error(`Error Uploading Type Property Policy: ${err}`);
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
-
for (const [
|
|
141
|
+
for (const [identifier, currentTPP] of Object.entries(currentTPPByIdentifier)) {
|
|
142
142
|
try {
|
|
143
|
-
const found =
|
|
143
|
+
const found = loadedTPPByIdentifier[identifier];
|
|
144
144
|
if (!found) {
|
|
145
|
-
logger_1.default.info(`Deleting: ${
|
|
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
|
-
|
|
153
|
+
logger_1.default.error(`Error Type Property Policy: ${err}`);
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
}
|
|
@@ -178,6 +178,7 @@ async function uploadTypePropertyPolicyLinks(reducedTypePropertyPolicyLinks) {
|
|
|
178
178
|
const foundTPP = currentTPPs.find((tpp) => tpp.id === currentLink.typePropertyPolicyId);
|
|
179
179
|
if (!foundTypeProperty || !foundTPP) {
|
|
180
180
|
logger_1.default.info(`skipping unhashable, invalid policy link: ${currentLink}`);
|
|
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
|
-
|
|
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
|
-
|
|
228
|
+
logger_1.default.error(`Error Deleting type property policy link: ${err}`);
|
|
228
229
|
}
|
|
229
230
|
}
|
|
230
231
|
}
|
|
@@ -122,7 +122,7 @@ async function uploadUsageInfoObjects(loadedUsageInfo) {
|
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
catch (err) {
|
|
125
|
-
|
|
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
|
-
|
|
140
|
+
logger_1.default.error(`Error Deleting usage info: ${err}`);
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
}
|
|
@@ -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
|
|
119
|
+
const optionSetIdBySlug = {};
|
|
120
120
|
for (const optionSet of optionSets) {
|
|
121
|
-
|
|
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:
|
|
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,
|
|
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 =
|
|
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
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
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,
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -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
|
-
|
|
348
|
+
slug: string;
|
|
347
349
|
isArchived: boolean;
|
|
348
350
|
optionSet: any[];
|
|
349
351
|
}
|
package/oclif.manifest.json
CHANGED