@salesforce/lds-adapters-industries-decision-matrix-designer 0.1.0-dev1

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