@salesforce/lds-adapters-industries-decision-matrix-designer 1.100.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +82 -0
- package/dist/es/es2018/industries-decision-matrix-designer.js +1284 -0
- package/dist/types/src/generated/adapters/adapter-utils.d.ts +66 -0
- package/dist/types/src/generated/adapters/getColumns.d.ts +26 -0
- package/dist/types/src/generated/adapters/getRows.d.ts +29 -0
- package/dist/types/src/generated/adapters/saveColumns.d.ts +16 -0
- package/dist/types/src/generated/adapters/saveRows.d.ts +17 -0
- package/dist/types/src/generated/artifacts/main.d.ts +4 -0
- package/dist/types/src/generated/artifacts/sfdc.d.ts +7 -0
- package/dist/types/src/generated/resources/getConnectOmnistudioDecisionMatricesColumnsByMatrixId.d.ts +15 -0
- package/dist/types/src/generated/resources/getConnectOmnistudioDecisionMatricesVersionsRowsByMatrixIdAndVersionId.d.ts +20 -0
- package/dist/types/src/generated/resources/postConnectOmnistudioDecisionMatricesColumnsByMatrixId.d.ts +16 -0
- package/dist/types/src/generated/resources/postConnectOmnistudioDecisionMatricesVersionsRowsByMatrixIdAndVersionId.d.ts +17 -0
- package/dist/types/src/generated/types/Columns.d.ts +39 -0
- package/dist/types/src/generated/types/DecisionMatrixColumnOutputRepresentation.d.ts +47 -0
- package/dist/types/src/generated/types/DecisionMatrixColumnRepresentation.d.ts +50 -0
- package/dist/types/src/generated/types/DecisionMatrixColumnsInputRepresentation.d.ts +30 -0
- package/dist/types/src/generated/types/DecisionMatrixColumnsOutputRepresentation.d.ts +31 -0
- package/dist/types/src/generated/types/DecisionMatrixOutputRepresentation.d.ts +48 -0
- package/dist/types/src/generated/types/DecisionMatrixRowInputRepresentation.d.ts +42 -0
- package/dist/types/src/generated/types/DecisionMatrixRowOutputRepresentation.d.ts +39 -0
- package/dist/types/src/generated/types/DecisionMatrixRowsInputRepresentation.d.ts +33 -0
- package/dist/types/src/generated/types/DecisionMatrixRowsOutputRepresentation.d.ts +37 -0
- package/dist/types/src/generated/types/RowsInput.d.ts +39 -0
- package/dist/types/src/generated/types/type-utils.d.ts +39 -0
- package/dist/umd/es2018/industries-decision-matrix-designer.js +1295 -0
- package/dist/umd/es5/industries-decision-matrix-designer.js +1307 -0
- package/package.json +71 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +1334 -0
- package/src/raml/api.raml +274 -0
- package/src/raml/luvio.raml +45 -0
|
@@ -0,0 +1,1307 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
(function (global, factory) {
|
|
8
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@luvio/engine')) :
|
|
9
|
+
typeof define === 'function' && define.amd ? define(['exports', '@luvio/engine'], factory) :
|
|
10
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["industriesDecision-matrix-designer"] = {}, global.engine));
|
|
11
|
+
})(this, (function (exports, engine) { 'use strict';
|
|
12
|
+
|
|
13
|
+
var ObjectPrototypeHasOwnProperty = Object.prototype.hasOwnProperty;
|
|
14
|
+
var ObjectKeys$1 = Object.keys;
|
|
15
|
+
var ArrayIsArray$1 = Array.isArray;
|
|
16
|
+
/**
|
|
17
|
+
* Validates an adapter config is well-formed.
|
|
18
|
+
* @param config The config to validate.
|
|
19
|
+
* @param adapter The adapter validation configuration.
|
|
20
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
21
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
22
|
+
*/
|
|
23
|
+
function validateConfig(config, adapter, oneOf) {
|
|
24
|
+
var displayName = adapter.displayName;
|
|
25
|
+
var _a = adapter.parameters, required = _a.required, optional = _a.optional, unsupported = _a.unsupported;
|
|
26
|
+
if (config === undefined ||
|
|
27
|
+
required.every(function (req) { return ObjectPrototypeHasOwnProperty.call(config, req); }) === false) {
|
|
28
|
+
throw new TypeError("adapter ".concat(displayName, " configuration must specify ").concat(required.sort().join(', ')));
|
|
29
|
+
}
|
|
30
|
+
if (oneOf && oneOf.some(function (req) { return ObjectPrototypeHasOwnProperty.call(config, req); }) === false) {
|
|
31
|
+
throw new TypeError("adapter ".concat(displayName, " configuration must specify one of ").concat(oneOf.sort().join(', ')));
|
|
32
|
+
}
|
|
33
|
+
if (unsupported !== undefined &&
|
|
34
|
+
unsupported.some(function (req) { return ObjectPrototypeHasOwnProperty.call(config, req); })) {
|
|
35
|
+
throw new TypeError("adapter ".concat(displayName, " does not yet support ").concat(unsupported.sort().join(', ')));
|
|
36
|
+
}
|
|
37
|
+
var supported = required.concat(optional);
|
|
38
|
+
if (ObjectKeys$1(config).some(function (key) { return !supported.includes(key); })) {
|
|
39
|
+
throw new TypeError("adapter ".concat(displayName, " configuration supports only ").concat(supported.sort().join(', ')));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function untrustedIsObject(untrusted) {
|
|
43
|
+
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
|
|
44
|
+
}
|
|
45
|
+
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
46
|
+
return configPropertyNames.parameters.required.every(function (req) { return req in config; });
|
|
47
|
+
}
|
|
48
|
+
var snapshotRefreshOptions = {
|
|
49
|
+
overrides: {
|
|
50
|
+
headers: {
|
|
51
|
+
'Cache-Control': 'no-cache',
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
var keyPrefix = 'decision-matrix-designer';
|
|
56
|
+
|
|
57
|
+
var ObjectFreeze = Object.freeze, ObjectKeys = Object.keys;
|
|
58
|
+
var ArrayIsArray = Array.isArray;
|
|
59
|
+
var JSONStringify = JSON.stringify;
|
|
60
|
+
function equalsArray(a, b, equalsItem) {
|
|
61
|
+
var aLength = a.length;
|
|
62
|
+
var bLength = b.length;
|
|
63
|
+
if (aLength !== bLength) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
for (var i = 0; i < aLength; i++) {
|
|
67
|
+
if (equalsItem(a[i], b[i]) === false) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
function deepFreeze$4(value) {
|
|
74
|
+
// No need to freeze primitives
|
|
75
|
+
if (typeof value !== 'object' || value === null) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (ArrayIsArray(value)) {
|
|
79
|
+
for (var i = 0, len = value.length; i < len; i += 1) {
|
|
80
|
+
deepFreeze$4(value[i]);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
var keys = ObjectKeys(value);
|
|
85
|
+
for (var i = 0, len = keys.length; i < len; i += 1) {
|
|
86
|
+
deepFreeze$4(value[keys[i]]);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
ObjectFreeze(value);
|
|
90
|
+
}
|
|
91
|
+
function createLink(ref) {
|
|
92
|
+
return {
|
|
93
|
+
__ref: engine.serializeStructuredKey(ref),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function validate$6(obj, path) {
|
|
98
|
+
if (path === void 0) { path = 'DecisionMatrixColumnOutputRepresentation'; }
|
|
99
|
+
var v_error = (function () {
|
|
100
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
101
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
102
|
+
}
|
|
103
|
+
var obj_apiName = obj.apiName;
|
|
104
|
+
var path_apiName = path + '.apiName';
|
|
105
|
+
if (typeof obj_apiName !== 'string') {
|
|
106
|
+
return new TypeError('Expected "string" but received "' + typeof obj_apiName + '" (at "' + path_apiName + '")');
|
|
107
|
+
}
|
|
108
|
+
var obj_columnType = obj.columnType;
|
|
109
|
+
var path_columnType = path + '.columnType';
|
|
110
|
+
if (typeof obj_columnType !== 'string') {
|
|
111
|
+
return new TypeError('Expected "string" but received "' + typeof obj_columnType + '" (at "' + path_columnType + '")');
|
|
112
|
+
}
|
|
113
|
+
var obj_dataType = obj.dataType;
|
|
114
|
+
var path_dataType = path + '.dataType';
|
|
115
|
+
if (typeof obj_dataType !== 'string') {
|
|
116
|
+
return new TypeError('Expected "string" but received "' + typeof obj_dataType + '" (at "' + path_dataType + '")');
|
|
117
|
+
}
|
|
118
|
+
var obj_displaySequence = obj.displaySequence;
|
|
119
|
+
var path_displaySequence = path + '.displaySequence';
|
|
120
|
+
var obj_displaySequence_union0 = null;
|
|
121
|
+
var obj_displaySequence_union0_error = (function () {
|
|
122
|
+
if (typeof obj_displaySequence !== 'number' || (typeof obj_displaySequence === 'number' && Math.floor(obj_displaySequence) !== obj_displaySequence)) {
|
|
123
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_displaySequence + '" (at "' + path_displaySequence + '")');
|
|
124
|
+
}
|
|
125
|
+
})();
|
|
126
|
+
if (obj_displaySequence_union0_error != null) {
|
|
127
|
+
obj_displaySequence_union0 = obj_displaySequence_union0_error.message;
|
|
128
|
+
}
|
|
129
|
+
var obj_displaySequence_union1 = null;
|
|
130
|
+
var obj_displaySequence_union1_error = (function () {
|
|
131
|
+
if (obj_displaySequence !== null) {
|
|
132
|
+
return new TypeError('Expected "null" but received "' + typeof obj_displaySequence + '" (at "' + path_displaySequence + '")');
|
|
133
|
+
}
|
|
134
|
+
})();
|
|
135
|
+
if (obj_displaySequence_union1_error != null) {
|
|
136
|
+
obj_displaySequence_union1 = obj_displaySequence_union1_error.message;
|
|
137
|
+
}
|
|
138
|
+
if (obj_displaySequence_union0 && obj_displaySequence_union1) {
|
|
139
|
+
var message = 'Object doesn\'t match union (at "' + path_displaySequence + '")';
|
|
140
|
+
message += '\n' + obj_displaySequence_union0.split('\n').map(function (line) { return '\t' + line; }).join('\n');
|
|
141
|
+
message += '\n' + obj_displaySequence_union1.split('\n').map(function (line) { return '\t' + line; }).join('\n');
|
|
142
|
+
return new TypeError(message);
|
|
143
|
+
}
|
|
144
|
+
var obj_id = obj.id;
|
|
145
|
+
var path_id = path + '.id';
|
|
146
|
+
if (typeof obj_id !== 'string') {
|
|
147
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
148
|
+
}
|
|
149
|
+
var obj_name = obj.name;
|
|
150
|
+
var path_name = path + '.name';
|
|
151
|
+
if (typeof obj_name !== 'string') {
|
|
152
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
153
|
+
}
|
|
154
|
+
var obj_rangeValues = obj.rangeValues;
|
|
155
|
+
var path_rangeValues = path + '.rangeValues';
|
|
156
|
+
var obj_rangeValues_union0 = null;
|
|
157
|
+
var obj_rangeValues_union0_error = (function () {
|
|
158
|
+
if (typeof obj_rangeValues !== 'string') {
|
|
159
|
+
return new TypeError('Expected "string" but received "' + typeof obj_rangeValues + '" (at "' + path_rangeValues + '")');
|
|
160
|
+
}
|
|
161
|
+
})();
|
|
162
|
+
if (obj_rangeValues_union0_error != null) {
|
|
163
|
+
obj_rangeValues_union0 = obj_rangeValues_union0_error.message;
|
|
164
|
+
}
|
|
165
|
+
var obj_rangeValues_union1 = null;
|
|
166
|
+
var obj_rangeValues_union1_error = (function () {
|
|
167
|
+
if (obj_rangeValues !== null) {
|
|
168
|
+
return new TypeError('Expected "null" but received "' + typeof obj_rangeValues + '" (at "' + path_rangeValues + '")');
|
|
169
|
+
}
|
|
170
|
+
})();
|
|
171
|
+
if (obj_rangeValues_union1_error != null) {
|
|
172
|
+
obj_rangeValues_union1 = obj_rangeValues_union1_error.message;
|
|
173
|
+
}
|
|
174
|
+
if (obj_rangeValues_union0 && obj_rangeValues_union1) {
|
|
175
|
+
var message = 'Object doesn\'t match union (at "' + path_rangeValues + '")';
|
|
176
|
+
message += '\n' + obj_rangeValues_union0.split('\n').map(function (line) { return '\t' + line; }).join('\n');
|
|
177
|
+
message += '\n' + obj_rangeValues_union1.split('\n').map(function (line) { return '\t' + line; }).join('\n');
|
|
178
|
+
return new TypeError(message);
|
|
179
|
+
}
|
|
180
|
+
})();
|
|
181
|
+
return v_error === undefined ? null : v_error;
|
|
182
|
+
}
|
|
183
|
+
function deepFreeze$3(input) {
|
|
184
|
+
ObjectFreeze(input);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
var TTL$2 = 1000;
|
|
188
|
+
var VERSION$2 = "5d95e8249486b2b28b41c80d3f8add99";
|
|
189
|
+
function validate$5(obj, path) {
|
|
190
|
+
if (path === void 0) { path = 'DecisionMatrixColumnsOutputRepresentation'; }
|
|
191
|
+
var v_error = (function () {
|
|
192
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
193
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
194
|
+
}
|
|
195
|
+
var obj_columns = obj.columns;
|
|
196
|
+
var path_columns = path + '.columns';
|
|
197
|
+
if (!ArrayIsArray(obj_columns)) {
|
|
198
|
+
return new TypeError('Expected "array" but received "' + typeof obj_columns + '" (at "' + path_columns + '")');
|
|
199
|
+
}
|
|
200
|
+
for (var i = 0; i < obj_columns.length; i++) {
|
|
201
|
+
var obj_columns_item = obj_columns[i];
|
|
202
|
+
var path_columns_item = path_columns + '[' + i + ']';
|
|
203
|
+
var referencepath_columns_itemValidationError = validate$6(obj_columns_item, path_columns_item);
|
|
204
|
+
if (referencepath_columns_itemValidationError !== null) {
|
|
205
|
+
var message = 'Object doesn\'t match DecisionMatrixColumnOutputRepresentation (at "' + path_columns_item + '")\n';
|
|
206
|
+
message += referencepath_columns_itemValidationError.message.split('\n').map(function (line) { return '\t' + line; }).join('\n');
|
|
207
|
+
return new TypeError(message);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
})();
|
|
211
|
+
return v_error === undefined ? null : v_error;
|
|
212
|
+
}
|
|
213
|
+
var RepresentationType$2 = 'DecisionMatrixColumnsOutputRepresentation';
|
|
214
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
215
|
+
return input;
|
|
216
|
+
}
|
|
217
|
+
var select$6 = function DecisionMatrixColumnsOutputRepresentationSelect() {
|
|
218
|
+
return {
|
|
219
|
+
kind: 'Fragment',
|
|
220
|
+
version: VERSION$2,
|
|
221
|
+
private: [],
|
|
222
|
+
opaque: true
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
function equals$2(existing, incoming) {
|
|
226
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
return true;
|
|
230
|
+
}
|
|
231
|
+
function deepFreeze$2(input) {
|
|
232
|
+
var input_columns = input.columns;
|
|
233
|
+
for (var i = 0; i < input_columns.length; i++) {
|
|
234
|
+
var input_columns_item = input_columns[i];
|
|
235
|
+
deepFreeze$3(input_columns_item);
|
|
236
|
+
}
|
|
237
|
+
ObjectFreeze(input_columns);
|
|
238
|
+
ObjectFreeze(input);
|
|
239
|
+
}
|
|
240
|
+
var ingest$2 = function DecisionMatrixColumnsOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
241
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
242
|
+
var validateError = validate$5(input);
|
|
243
|
+
if (validateError !== null) {
|
|
244
|
+
throw validateError;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
var key = path.fullPath;
|
|
248
|
+
var existingRecord = store.readEntry(key);
|
|
249
|
+
var ttlToUse = TTL$2;
|
|
250
|
+
var incomingRecord = normalize$2(input, store.readEntry(key), {
|
|
251
|
+
fullPath: key,
|
|
252
|
+
parent: path.parent,
|
|
253
|
+
propertyName: path.propertyName,
|
|
254
|
+
ttl: ttlToUse
|
|
255
|
+
});
|
|
256
|
+
deepFreeze$2(input);
|
|
257
|
+
if (existingRecord === undefined || equals$2(existingRecord, incomingRecord) === false) {
|
|
258
|
+
luvio.storePublish(key, incomingRecord);
|
|
259
|
+
}
|
|
260
|
+
{
|
|
261
|
+
var storeMetadataParams = {
|
|
262
|
+
ttl: ttlToUse,
|
|
263
|
+
namespace: "decision-matrix-designer",
|
|
264
|
+
version: VERSION$2,
|
|
265
|
+
representationName: RepresentationType$2,
|
|
266
|
+
};
|
|
267
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
268
|
+
}
|
|
269
|
+
return createLink(key);
|
|
270
|
+
};
|
|
271
|
+
function getTypeCacheKeys$2(luvio, input, fullPathFactory) {
|
|
272
|
+
var rootKeySet = new engine.StoreKeyMap();
|
|
273
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
274
|
+
var rootKey = fullPathFactory();
|
|
275
|
+
rootKeySet.set(rootKey, {
|
|
276
|
+
namespace: keyPrefix,
|
|
277
|
+
representationName: RepresentationType$2,
|
|
278
|
+
mergeable: false
|
|
279
|
+
});
|
|
280
|
+
return rootKeySet;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function select$5(luvio, params) {
|
|
284
|
+
return select$6();
|
|
285
|
+
}
|
|
286
|
+
function keyBuilder$4(luvio, params) {
|
|
287
|
+
return keyPrefix + '::DecisionMatrixColumnsOutputRepresentation:(' + 'matrixId:' + params.urlParams.matrixId + ')';
|
|
288
|
+
}
|
|
289
|
+
function getResponseCacheKeys$3(luvio, resourceParams, response) {
|
|
290
|
+
return getTypeCacheKeys$2(luvio, response, function () { return keyBuilder$4(luvio, resourceParams); });
|
|
291
|
+
}
|
|
292
|
+
function ingestSuccess$3(luvio, resourceParams, response, snapshotRefresh) {
|
|
293
|
+
var body = response.body;
|
|
294
|
+
var key = keyBuilder$4(luvio, resourceParams);
|
|
295
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
296
|
+
var snapshot = luvio.storeLookup({
|
|
297
|
+
recordId: key,
|
|
298
|
+
node: select$5(),
|
|
299
|
+
variables: {},
|
|
300
|
+
}, snapshotRefresh);
|
|
301
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
302
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
303
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return snapshot;
|
|
307
|
+
}
|
|
308
|
+
function ingestError$1(luvio, params, error, snapshotRefresh) {
|
|
309
|
+
var key = keyBuilder$4(luvio, params);
|
|
310
|
+
var errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
311
|
+
var storeMetadataParams = {
|
|
312
|
+
ttl: TTL$2,
|
|
313
|
+
namespace: keyPrefix,
|
|
314
|
+
version: VERSION$2,
|
|
315
|
+
representationName: RepresentationType$2
|
|
316
|
+
};
|
|
317
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
318
|
+
return errorSnapshot;
|
|
319
|
+
}
|
|
320
|
+
function createResourceRequest$3(config) {
|
|
321
|
+
var headers = {};
|
|
322
|
+
return {
|
|
323
|
+
baseUri: '/services/data/v58.0',
|
|
324
|
+
basePath: '/connect/omnistudio/decision-matrices/' + config.urlParams.matrixId + '/columns',
|
|
325
|
+
method: 'get',
|
|
326
|
+
body: null,
|
|
327
|
+
urlParams: config.urlParams,
|
|
328
|
+
queryParams: {},
|
|
329
|
+
headers: headers,
|
|
330
|
+
priority: 'normal',
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
var getColumns_ConfigPropertyNames = {
|
|
335
|
+
displayName: 'getColumns',
|
|
336
|
+
parameters: {
|
|
337
|
+
required: ['matrixId'],
|
|
338
|
+
optional: []
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
function createResourceParams$3(config) {
|
|
342
|
+
var resourceParams = {
|
|
343
|
+
urlParams: {
|
|
344
|
+
matrixId: config.matrixId
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
return resourceParams;
|
|
348
|
+
}
|
|
349
|
+
function keyBuilder$3(luvio, config) {
|
|
350
|
+
var resourceParams = createResourceParams$3(config);
|
|
351
|
+
return keyBuilder$4(luvio, resourceParams);
|
|
352
|
+
}
|
|
353
|
+
function typeCheckConfig$3(untrustedConfig) {
|
|
354
|
+
var config = {};
|
|
355
|
+
var untrustedConfig_matrixId = untrustedConfig.matrixId;
|
|
356
|
+
if (typeof untrustedConfig_matrixId === 'string') {
|
|
357
|
+
config.matrixId = untrustedConfig_matrixId;
|
|
358
|
+
}
|
|
359
|
+
return config;
|
|
360
|
+
}
|
|
361
|
+
function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
|
|
362
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
363
|
+
return null;
|
|
364
|
+
}
|
|
365
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
366
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
367
|
+
}
|
|
368
|
+
var config = typeCheckConfig$3(untrustedConfig);
|
|
369
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
370
|
+
return null;
|
|
371
|
+
}
|
|
372
|
+
return config;
|
|
373
|
+
}
|
|
374
|
+
function adapterFragment$1(luvio, config) {
|
|
375
|
+
createResourceParams$3(config);
|
|
376
|
+
return select$5();
|
|
377
|
+
}
|
|
378
|
+
function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
|
|
379
|
+
var snapshot = ingestSuccess$3(luvio, resourceParams, response, {
|
|
380
|
+
config: config,
|
|
381
|
+
resolve: function () { return buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions); }
|
|
382
|
+
});
|
|
383
|
+
return luvio.storeBroadcast().then(function () { return snapshot; });
|
|
384
|
+
}
|
|
385
|
+
function onFetchResponseError$1(luvio, config, resourceParams, response) {
|
|
386
|
+
var snapshot = ingestError$1(luvio, resourceParams, response, {
|
|
387
|
+
config: config,
|
|
388
|
+
resolve: function () { return buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions); }
|
|
389
|
+
});
|
|
390
|
+
return luvio.storeBroadcast().then(function () { return snapshot; });
|
|
391
|
+
}
|
|
392
|
+
function buildNetworkSnapshot$3(luvio, config, options) {
|
|
393
|
+
var resourceParams = createResourceParams$3(config);
|
|
394
|
+
var request = createResourceRequest$3(resourceParams);
|
|
395
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
396
|
+
.then(function (response) {
|
|
397
|
+
return luvio.handleSuccessResponse(function () { return onFetchResponseSuccess$1(luvio, config, resourceParams, response); }, function () { return getResponseCacheKeys$3(luvio, resourceParams, response.body); });
|
|
398
|
+
}, function (response) {
|
|
399
|
+
return luvio.handleErrorResponse(function () { return onFetchResponseError$1(luvio, config, resourceParams, response); });
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
|
|
403
|
+
var luvio = context.luvio, config = context.config;
|
|
404
|
+
var networkPriority = coercedAdapterRequestContext.networkPriority, requestCorrelator = coercedAdapterRequestContext.requestCorrelator, eventObservers = coercedAdapterRequestContext.eventObservers;
|
|
405
|
+
var dispatchOptions = {
|
|
406
|
+
resourceRequestContext: {
|
|
407
|
+
requestCorrelator: requestCorrelator,
|
|
408
|
+
luvioRequestMethod: undefined,
|
|
409
|
+
},
|
|
410
|
+
eventObservers: eventObservers
|
|
411
|
+
};
|
|
412
|
+
if (networkPriority !== 'normal') {
|
|
413
|
+
dispatchOptions.overrides = {
|
|
414
|
+
priority: networkPriority
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
return buildNetworkSnapshot$3(luvio, config, dispatchOptions);
|
|
418
|
+
}
|
|
419
|
+
function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
|
|
420
|
+
var luvio = context.luvio, config = context.config;
|
|
421
|
+
var selector = {
|
|
422
|
+
recordId: keyBuilder$3(luvio, config),
|
|
423
|
+
node: adapterFragment$1(luvio, config),
|
|
424
|
+
variables: {},
|
|
425
|
+
};
|
|
426
|
+
var cacheSnapshot = storeLookup(selector, {
|
|
427
|
+
config: config,
|
|
428
|
+
resolve: function () { return buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions); }
|
|
429
|
+
});
|
|
430
|
+
return cacheSnapshot;
|
|
431
|
+
}
|
|
432
|
+
var getColumnsAdapterFactory = function (luvio) { return function decisionMatrixDesigner__getColumns(untrustedConfig, requestContext) {
|
|
433
|
+
var config = validateAdapterConfig$3(untrustedConfig, getColumns_ConfigPropertyNames);
|
|
434
|
+
// Invalid or incomplete config
|
|
435
|
+
if (config === null) {
|
|
436
|
+
return null;
|
|
437
|
+
}
|
|
438
|
+
return luvio.applyCachePolicy((requestContext || {}), { config: config, luvio: luvio }, // BuildSnapshotContext
|
|
439
|
+
buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
|
|
440
|
+
}; };
|
|
441
|
+
|
|
442
|
+
function validate$4(obj, path) {
|
|
443
|
+
if (path === void 0) { path = 'DecisionMatrixColumnsInputRepresentation'; }
|
|
444
|
+
var v_error = (function () {
|
|
445
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
446
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
447
|
+
}
|
|
448
|
+
var obj_columns = obj.columns;
|
|
449
|
+
var path_columns = path + '.columns';
|
|
450
|
+
if (!ArrayIsArray(obj_columns)) {
|
|
451
|
+
return new TypeError('Expected "array" but received "' + typeof obj_columns + '" (at "' + path_columns + '")');
|
|
452
|
+
}
|
|
453
|
+
for (var i = 0; i < obj_columns.length; i++) {
|
|
454
|
+
var obj_columns_item = obj_columns[i];
|
|
455
|
+
var path_columns_item = path_columns + '[' + i + ']';
|
|
456
|
+
if (typeof obj_columns_item !== 'object' || ArrayIsArray(obj_columns_item) || obj_columns_item === null) {
|
|
457
|
+
return new TypeError('Expected "object" but received "' + typeof obj_columns_item + '" (at "' + path_columns_item + '")');
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
})();
|
|
461
|
+
return v_error === undefined ? null : v_error;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
var TTL$1 = 1000;
|
|
465
|
+
var VERSION$1 = "60c06d14589677c0dcc40b0116fabdee";
|
|
466
|
+
function validate$3(obj, path) {
|
|
467
|
+
if (path === void 0) { path = 'DecisionMatrixOutputRepresentation'; }
|
|
468
|
+
var v_error = (function () {
|
|
469
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
470
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
471
|
+
}
|
|
472
|
+
var obj_errorFileId = obj.errorFileId;
|
|
473
|
+
var path_errorFileId = path + '.errorFileId';
|
|
474
|
+
var obj_errorFileId_union0 = null;
|
|
475
|
+
var obj_errorFileId_union0_error = (function () {
|
|
476
|
+
if (typeof obj_errorFileId !== 'string') {
|
|
477
|
+
return new TypeError('Expected "string" but received "' + typeof obj_errorFileId + '" (at "' + path_errorFileId + '")');
|
|
478
|
+
}
|
|
479
|
+
})();
|
|
480
|
+
if (obj_errorFileId_union0_error != null) {
|
|
481
|
+
obj_errorFileId_union0 = obj_errorFileId_union0_error.message;
|
|
482
|
+
}
|
|
483
|
+
var obj_errorFileId_union1 = null;
|
|
484
|
+
var obj_errorFileId_union1_error = (function () {
|
|
485
|
+
if (obj_errorFileId !== null) {
|
|
486
|
+
return new TypeError('Expected "null" but received "' + typeof obj_errorFileId + '" (at "' + path_errorFileId + '")');
|
|
487
|
+
}
|
|
488
|
+
})();
|
|
489
|
+
if (obj_errorFileId_union1_error != null) {
|
|
490
|
+
obj_errorFileId_union1 = obj_errorFileId_union1_error.message;
|
|
491
|
+
}
|
|
492
|
+
if (obj_errorFileId_union0 && obj_errorFileId_union1) {
|
|
493
|
+
var message = 'Object doesn\'t match union (at "' + path_errorFileId + '")';
|
|
494
|
+
message += '\n' + obj_errorFileId_union0.split('\n').map(function (line) { return '\t' + line; }).join('\n');
|
|
495
|
+
message += '\n' + obj_errorFileId_union1.split('\n').map(function (line) { return '\t' + line; }).join('\n');
|
|
496
|
+
return new TypeError(message);
|
|
497
|
+
}
|
|
498
|
+
var obj_errors = obj.errors;
|
|
499
|
+
var path_errors = path + '.errors';
|
|
500
|
+
if (!ArrayIsArray(obj_errors)) {
|
|
501
|
+
return new TypeError('Expected "array" but received "' + typeof obj_errors + '" (at "' + path_errors + '")');
|
|
502
|
+
}
|
|
503
|
+
for (var i = 0; i < obj_errors.length; i++) {
|
|
504
|
+
var obj_errors_item = obj_errors[i];
|
|
505
|
+
var path_errors_item = path_errors + '[' + i + ']';
|
|
506
|
+
if (typeof obj_errors_item !== 'string') {
|
|
507
|
+
return new TypeError('Expected "string" but received "' + typeof obj_errors_item + '" (at "' + path_errors_item + '")');
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
var obj_message = obj.message;
|
|
511
|
+
var path_message = path + '.message';
|
|
512
|
+
var obj_message_union0 = null;
|
|
513
|
+
var obj_message_union0_error = (function () {
|
|
514
|
+
if (typeof obj_message !== 'string') {
|
|
515
|
+
return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
|
|
516
|
+
}
|
|
517
|
+
})();
|
|
518
|
+
if (obj_message_union0_error != null) {
|
|
519
|
+
obj_message_union0 = obj_message_union0_error.message;
|
|
520
|
+
}
|
|
521
|
+
var obj_message_union1 = null;
|
|
522
|
+
var obj_message_union1_error = (function () {
|
|
523
|
+
if (obj_message !== null) {
|
|
524
|
+
return new TypeError('Expected "null" but received "' + typeof obj_message + '" (at "' + path_message + '")');
|
|
525
|
+
}
|
|
526
|
+
})();
|
|
527
|
+
if (obj_message_union1_error != null) {
|
|
528
|
+
obj_message_union1 = obj_message_union1_error.message;
|
|
529
|
+
}
|
|
530
|
+
if (obj_message_union0 && obj_message_union1) {
|
|
531
|
+
var message = 'Object doesn\'t match union (at "' + path_message + '")';
|
|
532
|
+
message += '\n' + obj_message_union0.split('\n').map(function (line) { return '\t' + line; }).join('\n');
|
|
533
|
+
message += '\n' + obj_message_union1.split('\n').map(function (line) { return '\t' + line; }).join('\n');
|
|
534
|
+
return new TypeError(message);
|
|
535
|
+
}
|
|
536
|
+
var obj_success = obj.success;
|
|
537
|
+
var path_success = path + '.success';
|
|
538
|
+
if (typeof obj_success !== 'boolean') {
|
|
539
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_success + '" (at "' + path_success + '")');
|
|
540
|
+
}
|
|
541
|
+
})();
|
|
542
|
+
return v_error === undefined ? null : v_error;
|
|
543
|
+
}
|
|
544
|
+
var RepresentationType$1 = 'DecisionMatrixOutputRepresentation';
|
|
545
|
+
function keyBuilder$2(luvio, config) {
|
|
546
|
+
return keyPrefix + '::' + RepresentationType$1 + ':' + config.success;
|
|
547
|
+
}
|
|
548
|
+
function keyBuilderFromType(luvio, object) {
|
|
549
|
+
var keyParams = {
|
|
550
|
+
success: object.success
|
|
551
|
+
};
|
|
552
|
+
return keyBuilder$2(luvio, keyParams);
|
|
553
|
+
}
|
|
554
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
555
|
+
return input;
|
|
556
|
+
}
|
|
557
|
+
var select$4 = function DecisionMatrixOutputRepresentationSelect() {
|
|
558
|
+
return {
|
|
559
|
+
kind: 'Fragment',
|
|
560
|
+
version: VERSION$1,
|
|
561
|
+
private: [],
|
|
562
|
+
selections: [
|
|
563
|
+
{
|
|
564
|
+
name: 'errorFileId',
|
|
565
|
+
kind: 'Scalar'
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
name: 'errors',
|
|
569
|
+
kind: 'Scalar',
|
|
570
|
+
plural: true
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
name: 'message',
|
|
574
|
+
kind: 'Scalar'
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
name: 'success',
|
|
578
|
+
kind: 'Scalar'
|
|
579
|
+
}
|
|
580
|
+
]
|
|
581
|
+
};
|
|
582
|
+
};
|
|
583
|
+
function equals$1(existing, incoming) {
|
|
584
|
+
var existing_success = existing.success;
|
|
585
|
+
var incoming_success = incoming.success;
|
|
586
|
+
if (!(existing_success === incoming_success)) {
|
|
587
|
+
return false;
|
|
588
|
+
}
|
|
589
|
+
var existing_errorFileId = existing.errorFileId;
|
|
590
|
+
var incoming_errorFileId = incoming.errorFileId;
|
|
591
|
+
if (!(existing_errorFileId === incoming_errorFileId)) {
|
|
592
|
+
return false;
|
|
593
|
+
}
|
|
594
|
+
var existing_errors = existing.errors;
|
|
595
|
+
var incoming_errors = incoming.errors;
|
|
596
|
+
var equals_errors_items = equalsArray(existing_errors, incoming_errors, function (existing_errors_item, incoming_errors_item) {
|
|
597
|
+
if (!(existing_errors_item === incoming_errors_item)) {
|
|
598
|
+
return false;
|
|
599
|
+
}
|
|
600
|
+
});
|
|
601
|
+
if (equals_errors_items === false) {
|
|
602
|
+
return false;
|
|
603
|
+
}
|
|
604
|
+
var existing_message = existing.message;
|
|
605
|
+
var incoming_message = incoming.message;
|
|
606
|
+
if (!(existing_message === incoming_message)) {
|
|
607
|
+
return false;
|
|
608
|
+
}
|
|
609
|
+
return true;
|
|
610
|
+
}
|
|
611
|
+
var ingest$1 = function DecisionMatrixOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
612
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
613
|
+
var validateError = validate$3(input);
|
|
614
|
+
if (validateError !== null) {
|
|
615
|
+
throw validateError;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
var key = keyBuilderFromType(luvio, input);
|
|
619
|
+
var existingRecord = store.readEntry(key);
|
|
620
|
+
var ttlToUse = TTL$1;
|
|
621
|
+
var incomingRecord = normalize$1(input, store.readEntry(key), {
|
|
622
|
+
fullPath: key,
|
|
623
|
+
parent: path.parent,
|
|
624
|
+
propertyName: path.propertyName,
|
|
625
|
+
ttl: ttlToUse
|
|
626
|
+
});
|
|
627
|
+
if (existingRecord === undefined || equals$1(existingRecord, incomingRecord) === false) {
|
|
628
|
+
luvio.storePublish(key, incomingRecord);
|
|
629
|
+
}
|
|
630
|
+
{
|
|
631
|
+
var storeMetadataParams = {
|
|
632
|
+
ttl: ttlToUse,
|
|
633
|
+
namespace: "decision-matrix-designer",
|
|
634
|
+
version: VERSION$1,
|
|
635
|
+
representationName: RepresentationType$1,
|
|
636
|
+
};
|
|
637
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
638
|
+
}
|
|
639
|
+
return createLink(key);
|
|
640
|
+
};
|
|
641
|
+
function getTypeCacheKeys$1(luvio, input, fullPathFactory) {
|
|
642
|
+
var rootKeySet = new engine.StoreKeyMap();
|
|
643
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
644
|
+
var rootKey = keyBuilderFromType(luvio, input);
|
|
645
|
+
rootKeySet.set(rootKey, {
|
|
646
|
+
namespace: keyPrefix,
|
|
647
|
+
representationName: RepresentationType$1,
|
|
648
|
+
mergeable: false
|
|
649
|
+
});
|
|
650
|
+
return rootKeySet;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
function select$3(luvio, params) {
|
|
654
|
+
return select$4();
|
|
655
|
+
}
|
|
656
|
+
function getResponseCacheKeys$2(luvio, resourceParams, response) {
|
|
657
|
+
return getTypeCacheKeys$1(luvio, response);
|
|
658
|
+
}
|
|
659
|
+
function ingestSuccess$2(luvio, resourceParams, response) {
|
|
660
|
+
var body = response.body;
|
|
661
|
+
var key = keyBuilderFromType(luvio, body);
|
|
662
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
663
|
+
var snapshot = luvio.storeLookup({
|
|
664
|
+
recordId: key,
|
|
665
|
+
node: select$3(),
|
|
666
|
+
variables: {},
|
|
667
|
+
});
|
|
668
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
669
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
670
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
return snapshot;
|
|
674
|
+
}
|
|
675
|
+
function createResourceRequest$2(config) {
|
|
676
|
+
var headers = {};
|
|
677
|
+
return {
|
|
678
|
+
baseUri: '/services/data/v58.0',
|
|
679
|
+
basePath: '/connect/omnistudio/decision-matrices/' + config.urlParams.matrixId + '/columns',
|
|
680
|
+
method: 'post',
|
|
681
|
+
body: config.body,
|
|
682
|
+
urlParams: config.urlParams,
|
|
683
|
+
queryParams: {},
|
|
684
|
+
headers: headers,
|
|
685
|
+
priority: 'normal',
|
|
686
|
+
};
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
var saveColumns_ConfigPropertyNames = {
|
|
690
|
+
displayName: 'saveColumns',
|
|
691
|
+
parameters: {
|
|
692
|
+
required: ['matrixId', 'columns'],
|
|
693
|
+
optional: []
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
function createResourceParams$2(config) {
|
|
697
|
+
var resourceParams = {
|
|
698
|
+
urlParams: {
|
|
699
|
+
matrixId: config.matrixId
|
|
700
|
+
},
|
|
701
|
+
body: {
|
|
702
|
+
columns: config.columns
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
return resourceParams;
|
|
706
|
+
}
|
|
707
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
708
|
+
var config = {};
|
|
709
|
+
var untrustedConfig_matrixId = untrustedConfig.matrixId;
|
|
710
|
+
if (typeof untrustedConfig_matrixId === 'string') {
|
|
711
|
+
config.matrixId = untrustedConfig_matrixId;
|
|
712
|
+
}
|
|
713
|
+
var untrustedConfig_columns = untrustedConfig.columns;
|
|
714
|
+
var referenceDecisionMatrixColumnsInputRepresentationValidationError = validate$4(untrustedConfig_columns);
|
|
715
|
+
if (referenceDecisionMatrixColumnsInputRepresentationValidationError === null) {
|
|
716
|
+
config.columns = untrustedConfig_columns;
|
|
717
|
+
}
|
|
718
|
+
return config;
|
|
719
|
+
}
|
|
720
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
721
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
722
|
+
return null;
|
|
723
|
+
}
|
|
724
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
725
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
726
|
+
}
|
|
727
|
+
var config = typeCheckConfig$2(untrustedConfig);
|
|
728
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
729
|
+
return null;
|
|
730
|
+
}
|
|
731
|
+
return config;
|
|
732
|
+
}
|
|
733
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
734
|
+
var resourceParams = createResourceParams$2(config);
|
|
735
|
+
var request = createResourceRequest$2(resourceParams);
|
|
736
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
737
|
+
.then(function (response) {
|
|
738
|
+
return luvio.handleSuccessResponse(function () {
|
|
739
|
+
var snapshot = ingestSuccess$2(luvio, resourceParams, response);
|
|
740
|
+
return luvio.storeBroadcast().then(function () { return snapshot; });
|
|
741
|
+
}, function () { return getResponseCacheKeys$2(luvio, resourceParams, response.body); });
|
|
742
|
+
}, function (response) {
|
|
743
|
+
deepFreeze$4(response);
|
|
744
|
+
throw response;
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
var saveColumnsAdapterFactory = function (luvio) {
|
|
748
|
+
return function saveColumns(untrustedConfig) {
|
|
749
|
+
var config = validateAdapterConfig$2(untrustedConfig, saveColumns_ConfigPropertyNames);
|
|
750
|
+
// Invalid or incomplete config
|
|
751
|
+
if (config === null) {
|
|
752
|
+
throw new Error('Invalid config for "saveColumns"');
|
|
753
|
+
}
|
|
754
|
+
return buildNetworkSnapshot$2(luvio, config);
|
|
755
|
+
};
|
|
756
|
+
};
|
|
757
|
+
|
|
758
|
+
function validate$2(obj, path) {
|
|
759
|
+
if (path === void 0) { path = 'DecisionMatrixRowOutputRepresentation'; }
|
|
760
|
+
var v_error = (function () {
|
|
761
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
762
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
763
|
+
}
|
|
764
|
+
var obj_id = obj.id;
|
|
765
|
+
var path_id = path + '.id';
|
|
766
|
+
if (typeof obj_id !== 'string') {
|
|
767
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
768
|
+
}
|
|
769
|
+
var obj_name = obj.name;
|
|
770
|
+
var path_name = path + '.name';
|
|
771
|
+
if (typeof obj_name !== 'string') {
|
|
772
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
773
|
+
}
|
|
774
|
+
var obj_rowData = obj.rowData;
|
|
775
|
+
var path_rowData = path + '.rowData';
|
|
776
|
+
if (typeof obj_rowData !== 'object' || ArrayIsArray(obj_rowData) || obj_rowData === null) {
|
|
777
|
+
return new TypeError('Expected "object" but received "' + typeof obj_rowData + '" (at "' + path_rowData + '")');
|
|
778
|
+
}
|
|
779
|
+
var obj_rowData_keys = ObjectKeys(obj_rowData);
|
|
780
|
+
var _loop_1 = function (i) {
|
|
781
|
+
var key = obj_rowData_keys[i];
|
|
782
|
+
var obj_rowData_prop = obj_rowData[key];
|
|
783
|
+
var path_rowData_prop = path_rowData + '["' + key + '"]';
|
|
784
|
+
var obj_rowData_prop_union0 = null;
|
|
785
|
+
var obj_rowData_prop_union0_error = (function () {
|
|
786
|
+
if (typeof obj_rowData_prop !== 'string') {
|
|
787
|
+
return new TypeError('Expected "string" but received "' + typeof obj_rowData_prop + '" (at "' + path_rowData_prop + '")');
|
|
788
|
+
}
|
|
789
|
+
})();
|
|
790
|
+
if (obj_rowData_prop_union0_error != null) {
|
|
791
|
+
obj_rowData_prop_union0 = obj_rowData_prop_union0_error.message;
|
|
792
|
+
}
|
|
793
|
+
var obj_rowData_prop_union1 = null;
|
|
794
|
+
var obj_rowData_prop_union1_error = (function () {
|
|
795
|
+
if (typeof obj_rowData_prop !== 'number') {
|
|
796
|
+
return new TypeError('Expected "number" but received "' + typeof obj_rowData_prop + '" (at "' + path_rowData_prop + '")');
|
|
797
|
+
}
|
|
798
|
+
})();
|
|
799
|
+
if (obj_rowData_prop_union1_error != null) {
|
|
800
|
+
obj_rowData_prop_union1 = obj_rowData_prop_union1_error.message;
|
|
801
|
+
}
|
|
802
|
+
var obj_rowData_prop_union2 = null;
|
|
803
|
+
var obj_rowData_prop_union2_error = (function () {
|
|
804
|
+
if (typeof obj_rowData_prop !== 'boolean') {
|
|
805
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_rowData_prop + '" (at "' + path_rowData_prop + '")');
|
|
806
|
+
}
|
|
807
|
+
})();
|
|
808
|
+
if (obj_rowData_prop_union2_error != null) {
|
|
809
|
+
obj_rowData_prop_union2 = obj_rowData_prop_union2_error.message;
|
|
810
|
+
}
|
|
811
|
+
if (obj_rowData_prop_union0 && obj_rowData_prop_union1 && obj_rowData_prop_union2) {
|
|
812
|
+
var message = 'Object doesn\'t match union (at "' + path_rowData_prop + '")';
|
|
813
|
+
message += '\n' + obj_rowData_prop_union0.split('\n').map(function (line) { return '\t' + line; }).join('\n');
|
|
814
|
+
message += '\n' + obj_rowData_prop_union1.split('\n').map(function (line) { return '\t' + line; }).join('\n');
|
|
815
|
+
message += '\n' + obj_rowData_prop_union2.split('\n').map(function (line) { return '\t' + line; }).join('\n');
|
|
816
|
+
return { value: new TypeError(message) };
|
|
817
|
+
}
|
|
818
|
+
};
|
|
819
|
+
for (var i = 0; i < obj_rowData_keys.length; i++) {
|
|
820
|
+
var state_1 = _loop_1(i);
|
|
821
|
+
if (typeof state_1 === "object")
|
|
822
|
+
return state_1.value;
|
|
823
|
+
}
|
|
824
|
+
})();
|
|
825
|
+
return v_error === undefined ? null : v_error;
|
|
826
|
+
}
|
|
827
|
+
function deepFreeze$1(input) {
|
|
828
|
+
var input_rowData = input.rowData;
|
|
829
|
+
var input_rowData_keys = Object.keys(input_rowData);
|
|
830
|
+
var input_rowData_length = input_rowData_keys.length;
|
|
831
|
+
for (var i = 0; i < input_rowData_length; i++) {
|
|
832
|
+
input_rowData_keys[i];
|
|
833
|
+
}
|
|
834
|
+
ObjectFreeze(input_rowData);
|
|
835
|
+
ObjectFreeze(input);
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
var TTL = 1000;
|
|
839
|
+
var VERSION = "29ed6d4f3fd86e3a72843e30d2858825";
|
|
840
|
+
function validate$1(obj, path) {
|
|
841
|
+
if (path === void 0) { path = 'DecisionMatrixRowsOutputRepresentation'; }
|
|
842
|
+
var v_error = (function () {
|
|
843
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
844
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
845
|
+
}
|
|
846
|
+
var obj_message = obj.message;
|
|
847
|
+
var path_message = path + '.message';
|
|
848
|
+
var obj_message_union0 = null;
|
|
849
|
+
var obj_message_union0_error = (function () {
|
|
850
|
+
if (typeof obj_message !== 'string') {
|
|
851
|
+
return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
|
|
852
|
+
}
|
|
853
|
+
})();
|
|
854
|
+
if (obj_message_union0_error != null) {
|
|
855
|
+
obj_message_union0 = obj_message_union0_error.message;
|
|
856
|
+
}
|
|
857
|
+
var obj_message_union1 = null;
|
|
858
|
+
var obj_message_union1_error = (function () {
|
|
859
|
+
if (obj_message !== null) {
|
|
860
|
+
return new TypeError('Expected "null" but received "' + typeof obj_message + '" (at "' + path_message + '")');
|
|
861
|
+
}
|
|
862
|
+
})();
|
|
863
|
+
if (obj_message_union1_error != null) {
|
|
864
|
+
obj_message_union1 = obj_message_union1_error.message;
|
|
865
|
+
}
|
|
866
|
+
if (obj_message_union0 && obj_message_union1) {
|
|
867
|
+
var message = 'Object doesn\'t match union (at "' + path_message + '")';
|
|
868
|
+
message += '\n' + obj_message_union0.split('\n').map(function (line) { return '\t' + line; }).join('\n');
|
|
869
|
+
message += '\n' + obj_message_union1.split('\n').map(function (line) { return '\t' + line; }).join('\n');
|
|
870
|
+
return new TypeError(message);
|
|
871
|
+
}
|
|
872
|
+
var obj_rows = obj.rows;
|
|
873
|
+
var path_rows = path + '.rows';
|
|
874
|
+
if (!ArrayIsArray(obj_rows)) {
|
|
875
|
+
return new TypeError('Expected "array" but received "' + typeof obj_rows + '" (at "' + path_rows + '")');
|
|
876
|
+
}
|
|
877
|
+
for (var i = 0; i < obj_rows.length; i++) {
|
|
878
|
+
var obj_rows_item = obj_rows[i];
|
|
879
|
+
var path_rows_item = path_rows + '[' + i + ']';
|
|
880
|
+
var referencepath_rows_itemValidationError = validate$2(obj_rows_item, path_rows_item);
|
|
881
|
+
if (referencepath_rows_itemValidationError !== null) {
|
|
882
|
+
var message = 'Object doesn\'t match DecisionMatrixRowOutputRepresentation (at "' + path_rows_item + '")\n';
|
|
883
|
+
message += referencepath_rows_itemValidationError.message.split('\n').map(function (line) { return '\t' + line; }).join('\n');
|
|
884
|
+
return new TypeError(message);
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
var obj_totalRows = obj.totalRows;
|
|
888
|
+
var path_totalRows = path + '.totalRows';
|
|
889
|
+
var obj_totalRows_union0 = null;
|
|
890
|
+
var obj_totalRows_union0_error = (function () {
|
|
891
|
+
if (typeof obj_totalRows !== 'number' || (typeof obj_totalRows === 'number' && Math.floor(obj_totalRows) !== obj_totalRows)) {
|
|
892
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_totalRows + '" (at "' + path_totalRows + '")');
|
|
893
|
+
}
|
|
894
|
+
})();
|
|
895
|
+
if (obj_totalRows_union0_error != null) {
|
|
896
|
+
obj_totalRows_union0 = obj_totalRows_union0_error.message;
|
|
897
|
+
}
|
|
898
|
+
var obj_totalRows_union1 = null;
|
|
899
|
+
var obj_totalRows_union1_error = (function () {
|
|
900
|
+
if (obj_totalRows !== null) {
|
|
901
|
+
return new TypeError('Expected "null" but received "' + typeof obj_totalRows + '" (at "' + path_totalRows + '")');
|
|
902
|
+
}
|
|
903
|
+
})();
|
|
904
|
+
if (obj_totalRows_union1_error != null) {
|
|
905
|
+
obj_totalRows_union1 = obj_totalRows_union1_error.message;
|
|
906
|
+
}
|
|
907
|
+
if (obj_totalRows_union0 && obj_totalRows_union1) {
|
|
908
|
+
var message = 'Object doesn\'t match union (at "' + path_totalRows + '")';
|
|
909
|
+
message += '\n' + obj_totalRows_union0.split('\n').map(function (line) { return '\t' + line; }).join('\n');
|
|
910
|
+
message += '\n' + obj_totalRows_union1.split('\n').map(function (line) { return '\t' + line; }).join('\n');
|
|
911
|
+
return new TypeError(message);
|
|
912
|
+
}
|
|
913
|
+
})();
|
|
914
|
+
return v_error === undefined ? null : v_error;
|
|
915
|
+
}
|
|
916
|
+
var RepresentationType = 'DecisionMatrixRowsOutputRepresentation';
|
|
917
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
918
|
+
return input;
|
|
919
|
+
}
|
|
920
|
+
var select$2 = function DecisionMatrixRowsOutputRepresentationSelect() {
|
|
921
|
+
return {
|
|
922
|
+
kind: 'Fragment',
|
|
923
|
+
version: VERSION,
|
|
924
|
+
private: [],
|
|
925
|
+
opaque: true
|
|
926
|
+
};
|
|
927
|
+
};
|
|
928
|
+
function equals(existing, incoming) {
|
|
929
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
930
|
+
return false;
|
|
931
|
+
}
|
|
932
|
+
return true;
|
|
933
|
+
}
|
|
934
|
+
function deepFreeze(input) {
|
|
935
|
+
var input_rows = input.rows;
|
|
936
|
+
for (var i = 0; i < input_rows.length; i++) {
|
|
937
|
+
var input_rows_item = input_rows[i];
|
|
938
|
+
deepFreeze$1(input_rows_item);
|
|
939
|
+
}
|
|
940
|
+
ObjectFreeze(input_rows);
|
|
941
|
+
ObjectFreeze(input);
|
|
942
|
+
}
|
|
943
|
+
var ingest = function DecisionMatrixRowsOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
944
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
945
|
+
var validateError = validate$1(input);
|
|
946
|
+
if (validateError !== null) {
|
|
947
|
+
throw validateError;
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
var key = path.fullPath;
|
|
951
|
+
var existingRecord = store.readEntry(key);
|
|
952
|
+
var ttlToUse = TTL;
|
|
953
|
+
var incomingRecord = normalize(input, store.readEntry(key), {
|
|
954
|
+
fullPath: key,
|
|
955
|
+
parent: path.parent,
|
|
956
|
+
propertyName: path.propertyName,
|
|
957
|
+
ttl: ttlToUse
|
|
958
|
+
});
|
|
959
|
+
deepFreeze(input);
|
|
960
|
+
if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
|
|
961
|
+
luvio.storePublish(key, incomingRecord);
|
|
962
|
+
}
|
|
963
|
+
{
|
|
964
|
+
var storeMetadataParams = {
|
|
965
|
+
ttl: ttlToUse,
|
|
966
|
+
namespace: "decision-matrix-designer",
|
|
967
|
+
version: VERSION,
|
|
968
|
+
representationName: RepresentationType,
|
|
969
|
+
};
|
|
970
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
971
|
+
}
|
|
972
|
+
return createLink(key);
|
|
973
|
+
};
|
|
974
|
+
function getTypeCacheKeys(luvio, input, fullPathFactory) {
|
|
975
|
+
var rootKeySet = new engine.StoreKeyMap();
|
|
976
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
977
|
+
var rootKey = fullPathFactory();
|
|
978
|
+
rootKeySet.set(rootKey, {
|
|
979
|
+
namespace: keyPrefix,
|
|
980
|
+
representationName: RepresentationType,
|
|
981
|
+
mergeable: false
|
|
982
|
+
});
|
|
983
|
+
return rootKeySet;
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
function select$1(luvio, params) {
|
|
987
|
+
return select$2();
|
|
988
|
+
}
|
|
989
|
+
function keyBuilder$1(luvio, params) {
|
|
990
|
+
return keyPrefix + '::DecisionMatrixRowsOutputRepresentation:(' + 'file:' + params.queryParams.file + ',' + 'filter:' + params.queryParams.filter + ',' + 'matrixId:' + params.urlParams.matrixId + ',' + 'versionId:' + params.urlParams.versionId + ')';
|
|
991
|
+
}
|
|
992
|
+
function getResponseCacheKeys$1(luvio, resourceParams, response) {
|
|
993
|
+
return getTypeCacheKeys(luvio, response, function () { return keyBuilder$1(luvio, resourceParams); });
|
|
994
|
+
}
|
|
995
|
+
function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
|
|
996
|
+
var body = response.body;
|
|
997
|
+
var key = keyBuilder$1(luvio, resourceParams);
|
|
998
|
+
luvio.storeIngest(key, ingest, body);
|
|
999
|
+
var snapshot = luvio.storeLookup({
|
|
1000
|
+
recordId: key,
|
|
1001
|
+
node: select$1(),
|
|
1002
|
+
variables: {},
|
|
1003
|
+
}, snapshotRefresh);
|
|
1004
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1005
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1006
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
return snapshot;
|
|
1010
|
+
}
|
|
1011
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
1012
|
+
var key = keyBuilder$1(luvio, params);
|
|
1013
|
+
var errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1014
|
+
var storeMetadataParams = {
|
|
1015
|
+
ttl: TTL,
|
|
1016
|
+
namespace: keyPrefix,
|
|
1017
|
+
version: VERSION,
|
|
1018
|
+
representationName: RepresentationType
|
|
1019
|
+
};
|
|
1020
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
1021
|
+
return errorSnapshot;
|
|
1022
|
+
}
|
|
1023
|
+
function createResourceRequest$1(config) {
|
|
1024
|
+
var headers = {};
|
|
1025
|
+
return {
|
|
1026
|
+
baseUri: '/services/data/v58.0',
|
|
1027
|
+
basePath: '/connect/omnistudio/decision-matrices/' + config.urlParams.matrixId + '/versions/' + config.urlParams.versionId + '/rows',
|
|
1028
|
+
method: 'get',
|
|
1029
|
+
body: null,
|
|
1030
|
+
urlParams: config.urlParams,
|
|
1031
|
+
queryParams: config.queryParams,
|
|
1032
|
+
headers: headers,
|
|
1033
|
+
priority: 'normal',
|
|
1034
|
+
};
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
var getRows_ConfigPropertyNames = {
|
|
1038
|
+
displayName: 'getRows',
|
|
1039
|
+
parameters: {
|
|
1040
|
+
required: ['matrixId', 'versionId'],
|
|
1041
|
+
optional: ['file', 'filter']
|
|
1042
|
+
}
|
|
1043
|
+
};
|
|
1044
|
+
function createResourceParams$1(config) {
|
|
1045
|
+
var resourceParams = {
|
|
1046
|
+
urlParams: {
|
|
1047
|
+
matrixId: config.matrixId, versionId: config.versionId
|
|
1048
|
+
},
|
|
1049
|
+
queryParams: {
|
|
1050
|
+
file: config.file, filter: config.filter
|
|
1051
|
+
}
|
|
1052
|
+
};
|
|
1053
|
+
return resourceParams;
|
|
1054
|
+
}
|
|
1055
|
+
function keyBuilder(luvio, config) {
|
|
1056
|
+
var resourceParams = createResourceParams$1(config);
|
|
1057
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
1058
|
+
}
|
|
1059
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
1060
|
+
var config = {};
|
|
1061
|
+
var untrustedConfig_matrixId = untrustedConfig.matrixId;
|
|
1062
|
+
if (typeof untrustedConfig_matrixId === 'string') {
|
|
1063
|
+
config.matrixId = untrustedConfig_matrixId;
|
|
1064
|
+
}
|
|
1065
|
+
var untrustedConfig_versionId = untrustedConfig.versionId;
|
|
1066
|
+
if (typeof untrustedConfig_versionId === 'string') {
|
|
1067
|
+
config.versionId = untrustedConfig_versionId;
|
|
1068
|
+
}
|
|
1069
|
+
var untrustedConfig_file = untrustedConfig.file;
|
|
1070
|
+
if (typeof untrustedConfig_file === 'boolean') {
|
|
1071
|
+
config.file = untrustedConfig_file;
|
|
1072
|
+
}
|
|
1073
|
+
var untrustedConfig_filter = untrustedConfig.filter;
|
|
1074
|
+
if (typeof untrustedConfig_filter === 'string') {
|
|
1075
|
+
config.filter = untrustedConfig_filter;
|
|
1076
|
+
}
|
|
1077
|
+
return config;
|
|
1078
|
+
}
|
|
1079
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
1080
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1081
|
+
return null;
|
|
1082
|
+
}
|
|
1083
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1084
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1085
|
+
}
|
|
1086
|
+
var config = typeCheckConfig$1(untrustedConfig);
|
|
1087
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1088
|
+
return null;
|
|
1089
|
+
}
|
|
1090
|
+
return config;
|
|
1091
|
+
}
|
|
1092
|
+
function adapterFragment(luvio, config) {
|
|
1093
|
+
createResourceParams$1(config);
|
|
1094
|
+
return select$1();
|
|
1095
|
+
}
|
|
1096
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
1097
|
+
var snapshot = ingestSuccess$1(luvio, resourceParams, response, {
|
|
1098
|
+
config: config,
|
|
1099
|
+
resolve: function () { return buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions); }
|
|
1100
|
+
});
|
|
1101
|
+
return luvio.storeBroadcast().then(function () { return snapshot; });
|
|
1102
|
+
}
|
|
1103
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
1104
|
+
var snapshot = ingestError(luvio, resourceParams, response, {
|
|
1105
|
+
config: config,
|
|
1106
|
+
resolve: function () { return buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions); }
|
|
1107
|
+
});
|
|
1108
|
+
return luvio.storeBroadcast().then(function () { return snapshot; });
|
|
1109
|
+
}
|
|
1110
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
1111
|
+
var resourceParams = createResourceParams$1(config);
|
|
1112
|
+
var request = createResourceRequest$1(resourceParams);
|
|
1113
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1114
|
+
.then(function (response) {
|
|
1115
|
+
return luvio.handleSuccessResponse(function () { return onFetchResponseSuccess(luvio, config, resourceParams, response); }, function () { return getResponseCacheKeys$1(luvio, resourceParams, response.body); });
|
|
1116
|
+
}, function (response) {
|
|
1117
|
+
return luvio.handleErrorResponse(function () { return onFetchResponseError(luvio, config, resourceParams, response); });
|
|
1118
|
+
});
|
|
1119
|
+
}
|
|
1120
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
1121
|
+
var luvio = context.luvio, config = context.config;
|
|
1122
|
+
var networkPriority = coercedAdapterRequestContext.networkPriority, requestCorrelator = coercedAdapterRequestContext.requestCorrelator, eventObservers = coercedAdapterRequestContext.eventObservers;
|
|
1123
|
+
var dispatchOptions = {
|
|
1124
|
+
resourceRequestContext: {
|
|
1125
|
+
requestCorrelator: requestCorrelator,
|
|
1126
|
+
luvioRequestMethod: undefined,
|
|
1127
|
+
},
|
|
1128
|
+
eventObservers: eventObservers
|
|
1129
|
+
};
|
|
1130
|
+
if (networkPriority !== 'normal') {
|
|
1131
|
+
dispatchOptions.overrides = {
|
|
1132
|
+
priority: networkPriority
|
|
1133
|
+
};
|
|
1134
|
+
}
|
|
1135
|
+
return buildNetworkSnapshot$1(luvio, config, dispatchOptions);
|
|
1136
|
+
}
|
|
1137
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
1138
|
+
var luvio = context.luvio, config = context.config;
|
|
1139
|
+
var selector = {
|
|
1140
|
+
recordId: keyBuilder(luvio, config),
|
|
1141
|
+
node: adapterFragment(luvio, config),
|
|
1142
|
+
variables: {},
|
|
1143
|
+
};
|
|
1144
|
+
var cacheSnapshot = storeLookup(selector, {
|
|
1145
|
+
config: config,
|
|
1146
|
+
resolve: function () { return buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions); }
|
|
1147
|
+
});
|
|
1148
|
+
return cacheSnapshot;
|
|
1149
|
+
}
|
|
1150
|
+
var getRowsAdapterFactory = function (luvio) { return function decisionMatrixDesigner__getRows(untrustedConfig, requestContext) {
|
|
1151
|
+
var config = validateAdapterConfig$1(untrustedConfig, getRows_ConfigPropertyNames);
|
|
1152
|
+
// Invalid or incomplete config
|
|
1153
|
+
if (config === null) {
|
|
1154
|
+
return null;
|
|
1155
|
+
}
|
|
1156
|
+
return luvio.applyCachePolicy((requestContext || {}), { config: config, luvio: luvio }, // BuildSnapshotContext
|
|
1157
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
1158
|
+
}; };
|
|
1159
|
+
|
|
1160
|
+
function validate(obj, path) {
|
|
1161
|
+
if (path === void 0) { path = 'DecisionMatrixRowsInputRepresentation'; }
|
|
1162
|
+
var v_error = (function () {
|
|
1163
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1164
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1165
|
+
}
|
|
1166
|
+
if (obj.fileId !== undefined) {
|
|
1167
|
+
var obj_fileId = obj.fileId;
|
|
1168
|
+
var path_fileId = path + '.fileId';
|
|
1169
|
+
if (typeof obj_fileId !== 'string') {
|
|
1170
|
+
return new TypeError('Expected "string" but received "' + typeof obj_fileId + '" (at "' + path_fileId + '")');
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
if (obj.rows !== undefined) {
|
|
1174
|
+
var obj_rows = obj.rows;
|
|
1175
|
+
var path_rows = path + '.rows';
|
|
1176
|
+
if (!ArrayIsArray(obj_rows)) {
|
|
1177
|
+
return new TypeError('Expected "array" but received "' + typeof obj_rows + '" (at "' + path_rows + '")');
|
|
1178
|
+
}
|
|
1179
|
+
for (var i = 0; i < obj_rows.length; i++) {
|
|
1180
|
+
var obj_rows_item = obj_rows[i];
|
|
1181
|
+
var path_rows_item = path_rows + '[' + i + ']';
|
|
1182
|
+
if (typeof obj_rows_item !== 'object' || ArrayIsArray(obj_rows_item) || obj_rows_item === null) {
|
|
1183
|
+
return new TypeError('Expected "object" but received "' + typeof obj_rows_item + '" (at "' + path_rows_item + '")');
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
})();
|
|
1188
|
+
return v_error === undefined ? null : v_error;
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
function select(luvio, params) {
|
|
1192
|
+
return select$4();
|
|
1193
|
+
}
|
|
1194
|
+
function getResponseCacheKeys(luvio, resourceParams, response) {
|
|
1195
|
+
return getTypeCacheKeys$1(luvio, response);
|
|
1196
|
+
}
|
|
1197
|
+
function ingestSuccess(luvio, resourceParams, response) {
|
|
1198
|
+
var body = response.body;
|
|
1199
|
+
var key = keyBuilderFromType(luvio, body);
|
|
1200
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
1201
|
+
var snapshot = luvio.storeLookup({
|
|
1202
|
+
recordId: key,
|
|
1203
|
+
node: select(),
|
|
1204
|
+
variables: {},
|
|
1205
|
+
});
|
|
1206
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1207
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1208
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
return snapshot;
|
|
1212
|
+
}
|
|
1213
|
+
function createResourceRequest(config) {
|
|
1214
|
+
var headers = {};
|
|
1215
|
+
return {
|
|
1216
|
+
baseUri: '/services/data/v58.0',
|
|
1217
|
+
basePath: '/connect/omnistudio/decision-matrices/' + config.urlParams.matrixId + '/versions/' + config.urlParams.versionId + '/rows',
|
|
1218
|
+
method: 'post',
|
|
1219
|
+
body: config.body,
|
|
1220
|
+
urlParams: config.urlParams,
|
|
1221
|
+
queryParams: {},
|
|
1222
|
+
headers: headers,
|
|
1223
|
+
priority: 'normal',
|
|
1224
|
+
};
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
var saveRows_ConfigPropertyNames = {
|
|
1228
|
+
displayName: 'saveRows',
|
|
1229
|
+
parameters: {
|
|
1230
|
+
required: ['matrixId', 'versionId', 'rowsInput'],
|
|
1231
|
+
optional: []
|
|
1232
|
+
}
|
|
1233
|
+
};
|
|
1234
|
+
function createResourceParams(config) {
|
|
1235
|
+
var resourceParams = {
|
|
1236
|
+
urlParams: {
|
|
1237
|
+
matrixId: config.matrixId, versionId: config.versionId
|
|
1238
|
+
},
|
|
1239
|
+
body: {
|
|
1240
|
+
rowsInput: config.rowsInput
|
|
1241
|
+
}
|
|
1242
|
+
};
|
|
1243
|
+
return resourceParams;
|
|
1244
|
+
}
|
|
1245
|
+
function typeCheckConfig(untrustedConfig) {
|
|
1246
|
+
var config = {};
|
|
1247
|
+
var untrustedConfig_matrixId = untrustedConfig.matrixId;
|
|
1248
|
+
if (typeof untrustedConfig_matrixId === 'string') {
|
|
1249
|
+
config.matrixId = untrustedConfig_matrixId;
|
|
1250
|
+
}
|
|
1251
|
+
var untrustedConfig_versionId = untrustedConfig.versionId;
|
|
1252
|
+
if (typeof untrustedConfig_versionId === 'string') {
|
|
1253
|
+
config.versionId = untrustedConfig_versionId;
|
|
1254
|
+
}
|
|
1255
|
+
var untrustedConfig_rowsInput = untrustedConfig.rowsInput;
|
|
1256
|
+
var referenceDecisionMatrixRowsInputRepresentationValidationError = validate(untrustedConfig_rowsInput);
|
|
1257
|
+
if (referenceDecisionMatrixRowsInputRepresentationValidationError === null) {
|
|
1258
|
+
config.rowsInput = untrustedConfig_rowsInput;
|
|
1259
|
+
}
|
|
1260
|
+
return config;
|
|
1261
|
+
}
|
|
1262
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
1263
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1264
|
+
return null;
|
|
1265
|
+
}
|
|
1266
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1267
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1268
|
+
}
|
|
1269
|
+
var config = typeCheckConfig(untrustedConfig);
|
|
1270
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1271
|
+
return null;
|
|
1272
|
+
}
|
|
1273
|
+
return config;
|
|
1274
|
+
}
|
|
1275
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
1276
|
+
var resourceParams = createResourceParams(config);
|
|
1277
|
+
var request = createResourceRequest(resourceParams);
|
|
1278
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1279
|
+
.then(function (response) {
|
|
1280
|
+
return luvio.handleSuccessResponse(function () {
|
|
1281
|
+
var snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
1282
|
+
return luvio.storeBroadcast().then(function () { return snapshot; });
|
|
1283
|
+
}, function () { return getResponseCacheKeys(luvio, resourceParams, response.body); });
|
|
1284
|
+
}, function (response) {
|
|
1285
|
+
deepFreeze$4(response);
|
|
1286
|
+
throw response;
|
|
1287
|
+
});
|
|
1288
|
+
}
|
|
1289
|
+
var saveRowsAdapterFactory = function (luvio) {
|
|
1290
|
+
return function saveRows(untrustedConfig) {
|
|
1291
|
+
var config = validateAdapterConfig(untrustedConfig, saveRows_ConfigPropertyNames);
|
|
1292
|
+
// Invalid or incomplete config
|
|
1293
|
+
if (config === null) {
|
|
1294
|
+
throw new Error('Invalid config for "saveRows"');
|
|
1295
|
+
}
|
|
1296
|
+
return buildNetworkSnapshot(luvio, config);
|
|
1297
|
+
};
|
|
1298
|
+
};
|
|
1299
|
+
|
|
1300
|
+
exports.getColumnsAdapterFactory = getColumnsAdapterFactory;
|
|
1301
|
+
exports.getRowsAdapterFactory = getRowsAdapterFactory;
|
|
1302
|
+
exports.saveColumnsAdapterFactory = saveColumnsAdapterFactory;
|
|
1303
|
+
exports.saveRowsAdapterFactory = saveRowsAdapterFactory;
|
|
1304
|
+
|
|
1305
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1306
|
+
|
|
1307
|
+
}));
|