@salesforce/lds-adapters-cdp-calculated-insights 1.295.0

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 (27) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/cdp-calculated-insights.js +1457 -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/getCdpCalculatedInsight.d.ts +28 -0
  5. package/dist/es/es2018/types/src/generated/adapters/getCdpCalculatedInsightCollection.d.ts +32 -0
  6. package/dist/es/es2018/types/src/generated/adapters/getCdpInsightsQuery.d.ts +35 -0
  7. package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +3 -0
  8. package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +8 -0
  9. package/dist/es/es2018/types/src/generated/resources/getSsotCalculatedInsights.d.ts +20 -0
  10. package/dist/es/es2018/types/src/generated/resources/getSsotCalculatedInsightsByApiName.d.ts +16 -0
  11. package/dist/es/es2018/types/src/generated/resources/getSsotInsightCalculatedInsightsByCiName.d.ts +25 -0
  12. package/dist/es/es2018/types/src/generated/types/CdpCalculatedInsightCollectionDataRepresentation.d.ts +62 -0
  13. package/dist/es/es2018/types/src/generated/types/CdpCalculatedInsightCollectionRepresentation.d.ts +29 -0
  14. package/dist/es/es2018/types/src/generated/types/CdpCalculatedInsightDataSourceRepresentation.d.ts +31 -0
  15. package/dist/es/es2018/types/src/generated/types/CdpCalculatedInsightDimensionRepresentation.d.ts +50 -0
  16. package/dist/es/es2018/types/src/generated/types/CdpCalculatedInsightErrorResponseRepresentation.d.ts +40 -0
  17. package/dist/es/es2018/types/src/generated/types/CdpCalculatedInsightMeasureRepresentation.d.ts +50 -0
  18. package/dist/es/es2018/types/src/generated/types/CdpCalculatedInsightRepresentation.d.ts +99 -0
  19. package/dist/es/es2018/types/src/generated/types/CdpQueryMetadataItemRepresentation.d.ts +34 -0
  20. package/dist/es/es2018/types/src/generated/types/CdpQueryMetadataOutputRepresentation.d.ts +28 -0
  21. package/dist/es/es2018/types/src/generated/types/CdpQueryOutputRepresentation.d.ts +54 -0
  22. package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
  23. package/package.json +66 -0
  24. package/sfdc/index.d.ts +1 -0
  25. package/sfdc/index.js +1555 -0
  26. package/src/raml/api.raml +360 -0
  27. package/src/raml/luvio.raml +49 -0
package/sfdc/index.js ADDED
@@ -0,0 +1,1555 @@
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, StoreKeyMap, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$3, typeCheckConfig as typeCheckConfig$3, createResourceParams as createResourceParams$3 } 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 = 'calculated-insights';
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 equalsObject(a, b, equalsProp) {
101
+ const aKeys = ObjectKeys(a).sort();
102
+ const bKeys = ObjectKeys(b).sort();
103
+ const aKeysLength = aKeys.length;
104
+ const bKeysLength = bKeys.length;
105
+ if (aKeysLength !== bKeysLength) {
106
+ return false;
107
+ }
108
+ for (let i = 0; i < aKeys.length; i++) {
109
+ const key = aKeys[i];
110
+ if (key !== bKeys[i]) {
111
+ return false;
112
+ }
113
+ if (equalsProp(a[key], b[key]) === false) {
114
+ return false;
115
+ }
116
+ }
117
+ return true;
118
+ }
119
+ function createLink(ref) {
120
+ return {
121
+ __ref: serializeStructuredKey(ref),
122
+ };
123
+ }
124
+
125
+ function validate$6(obj, path = 'CdpCalculatedInsightDataSourceRepresentation') {
126
+ const v_error = (() => {
127
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
128
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
129
+ }
130
+ const obj_sourceApiName = obj.sourceApiName;
131
+ const path_sourceApiName = path + '.sourceApiName';
132
+ if (typeof obj_sourceApiName !== 'string') {
133
+ return new TypeError('Expected "string" but received "' + typeof obj_sourceApiName + '" (at "' + path_sourceApiName + '")');
134
+ }
135
+ const obj_type = obj.type;
136
+ const path_type = path + '.type';
137
+ if (typeof obj_type !== 'string') {
138
+ return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
139
+ }
140
+ })();
141
+ return v_error === undefined ? null : v_error;
142
+ }
143
+
144
+ function validate$5(obj, path = 'CdpCalculatedInsightDimensionRepresentation') {
145
+ const v_error = (() => {
146
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
147
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
148
+ }
149
+ const obj_apiName = obj.apiName;
150
+ const path_apiName = path + '.apiName';
151
+ if (typeof obj_apiName !== 'string') {
152
+ return new TypeError('Expected "string" but received "' + typeof obj_apiName + '" (at "' + path_apiName + '")');
153
+ }
154
+ const obj_creationType = obj.creationType;
155
+ const path_creationType = path + '.creationType';
156
+ if (typeof obj_creationType !== 'string') {
157
+ return new TypeError('Expected "string" but received "' + typeof obj_creationType + '" (at "' + path_creationType + '")');
158
+ }
159
+ const obj_dataSource = obj.dataSource;
160
+ const path_dataSource = path + '.dataSource';
161
+ const referencepath_dataSourceValidationError = validate$6(obj_dataSource, path_dataSource);
162
+ if (referencepath_dataSourceValidationError !== null) {
163
+ let message = 'Object doesn\'t match CdpCalculatedInsightDataSourceRepresentation (at "' + path_dataSource + '")\n';
164
+ message += referencepath_dataSourceValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
165
+ return new TypeError(message);
166
+ }
167
+ const obj_dataType = obj.dataType;
168
+ const path_dataType = path + '.dataType';
169
+ if (typeof obj_dataType !== 'string') {
170
+ return new TypeError('Expected "string" but received "' + typeof obj_dataType + '" (at "' + path_dataType + '")');
171
+ }
172
+ const obj_dateGranularity = obj.dateGranularity;
173
+ const path_dateGranularity = path + '.dateGranularity';
174
+ let obj_dateGranularity_union0 = null;
175
+ const obj_dateGranularity_union0_error = (() => {
176
+ if (typeof obj_dateGranularity !== 'string') {
177
+ return new TypeError('Expected "string" but received "' + typeof obj_dateGranularity + '" (at "' + path_dateGranularity + '")');
178
+ }
179
+ })();
180
+ if (obj_dateGranularity_union0_error != null) {
181
+ obj_dateGranularity_union0 = obj_dateGranularity_union0_error.message;
182
+ }
183
+ let obj_dateGranularity_union1 = null;
184
+ const obj_dateGranularity_union1_error = (() => {
185
+ if (obj_dateGranularity !== null) {
186
+ return new TypeError('Expected "null" but received "' + typeof obj_dateGranularity + '" (at "' + path_dateGranularity + '")');
187
+ }
188
+ })();
189
+ if (obj_dateGranularity_union1_error != null) {
190
+ obj_dateGranularity_union1 = obj_dateGranularity_union1_error.message;
191
+ }
192
+ if (obj_dateGranularity_union0 && obj_dateGranularity_union1) {
193
+ let message = 'Object doesn\'t match union (at "' + path_dateGranularity + '")';
194
+ message += '\n' + obj_dateGranularity_union0.split('\n').map((line) => '\t' + line).join('\n');
195
+ message += '\n' + obj_dateGranularity_union1.split('\n').map((line) => '\t' + line).join('\n');
196
+ return new TypeError(message);
197
+ }
198
+ const obj_displayName = obj.displayName;
199
+ const path_displayName = path + '.displayName';
200
+ if (typeof obj_displayName !== 'string') {
201
+ return new TypeError('Expected "string" but received "' + typeof obj_displayName + '" (at "' + path_displayName + '")');
202
+ }
203
+ const obj_fieldRole = obj.fieldRole;
204
+ const path_fieldRole = path + '.fieldRole';
205
+ if (typeof obj_fieldRole !== 'string') {
206
+ return new TypeError('Expected "string" but received "' + typeof obj_fieldRole + '" (at "' + path_fieldRole + '")');
207
+ }
208
+ const obj_formula = obj.formula;
209
+ const path_formula = path + '.formula';
210
+ if (typeof obj_formula !== 'string') {
211
+ return new TypeError('Expected "string" but received "' + typeof obj_formula + '" (at "' + path_formula + '")');
212
+ }
213
+ })();
214
+ return v_error === undefined ? null : v_error;
215
+ }
216
+
217
+ function validate$4(obj, path = 'CdpCalculatedInsightMeasureRepresentation') {
218
+ const v_error = (() => {
219
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
220
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
221
+ }
222
+ const obj_apiName = obj.apiName;
223
+ const path_apiName = path + '.apiName';
224
+ if (typeof obj_apiName !== 'string') {
225
+ return new TypeError('Expected "string" but received "' + typeof obj_apiName + '" (at "' + path_apiName + '")');
226
+ }
227
+ const obj_creationType = obj.creationType;
228
+ const path_creationType = path + '.creationType';
229
+ if (typeof obj_creationType !== 'string') {
230
+ return new TypeError('Expected "string" but received "' + typeof obj_creationType + '" (at "' + path_creationType + '")');
231
+ }
232
+ const obj_dataSource = obj.dataSource;
233
+ const path_dataSource = path + '.dataSource';
234
+ const referencepath_dataSourceValidationError = validate$6(obj_dataSource, path_dataSource);
235
+ if (referencepath_dataSourceValidationError !== null) {
236
+ let message = 'Object doesn\'t match CdpCalculatedInsightDataSourceRepresentation (at "' + path_dataSource + '")\n';
237
+ message += referencepath_dataSourceValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
238
+ return new TypeError(message);
239
+ }
240
+ const obj_dataType = obj.dataType;
241
+ const path_dataType = path + '.dataType';
242
+ if (typeof obj_dataType !== 'string') {
243
+ return new TypeError('Expected "string" but received "' + typeof obj_dataType + '" (at "' + path_dataType + '")');
244
+ }
245
+ const obj_displayName = obj.displayName;
246
+ const path_displayName = path + '.displayName';
247
+ if (typeof obj_displayName !== 'string') {
248
+ return new TypeError('Expected "string" but received "' + typeof obj_displayName + '" (at "' + path_displayName + '")');
249
+ }
250
+ const obj_fieldAggregationType = obj.fieldAggregationType;
251
+ const path_fieldAggregationType = path + '.fieldAggregationType';
252
+ if (typeof obj_fieldAggregationType !== 'string') {
253
+ return new TypeError('Expected "string" but received "' + typeof obj_fieldAggregationType + '" (at "' + path_fieldAggregationType + '")');
254
+ }
255
+ const obj_fieldRole = obj.fieldRole;
256
+ const path_fieldRole = path + '.fieldRole';
257
+ if (typeof obj_fieldRole !== 'string') {
258
+ return new TypeError('Expected "string" but received "' + typeof obj_fieldRole + '" (at "' + path_fieldRole + '")');
259
+ }
260
+ const obj_formula = obj.formula;
261
+ const path_formula = path + '.formula';
262
+ if (typeof obj_formula !== 'string') {
263
+ return new TypeError('Expected "string" but received "' + typeof obj_formula + '" (at "' + path_formula + '")');
264
+ }
265
+ })();
266
+ return v_error === undefined ? null : v_error;
267
+ }
268
+
269
+ const VERSION$2 = "f316567639b3e0e679952c9d3a21ba22";
270
+ function validate$3(obj, path = 'CdpCalculatedInsightRepresentation') {
271
+ const v_error = (() => {
272
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
273
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
274
+ }
275
+ const obj_apiName = obj.apiName;
276
+ const path_apiName = path + '.apiName';
277
+ if (typeof obj_apiName !== 'string') {
278
+ return new TypeError('Expected "string" but received "' + typeof obj_apiName + '" (at "' + path_apiName + '")');
279
+ }
280
+ const obj_calculatedInsightStatus = obj.calculatedInsightStatus;
281
+ const path_calculatedInsightStatus = path + '.calculatedInsightStatus';
282
+ if (typeof obj_calculatedInsightStatus !== 'string') {
283
+ return new TypeError('Expected "string" but received "' + typeof obj_calculatedInsightStatus + '" (at "' + path_calculatedInsightStatus + '")');
284
+ }
285
+ const obj_creationType = obj.creationType;
286
+ const path_creationType = path + '.creationType';
287
+ if (typeof obj_creationType !== 'string') {
288
+ return new TypeError('Expected "string" but received "' + typeof obj_creationType + '" (at "' + path_creationType + '")');
289
+ }
290
+ const obj_dataSpace = obj.dataSpace;
291
+ const path_dataSpace = path + '.dataSpace';
292
+ if (typeof obj_dataSpace !== 'string') {
293
+ return new TypeError('Expected "string" but received "' + typeof obj_dataSpace + '" (at "' + path_dataSpace + '")');
294
+ }
295
+ const obj_definitionStatus = obj.definitionStatus;
296
+ const path_definitionStatus = path + '.definitionStatus';
297
+ if (typeof obj_definitionStatus !== 'string') {
298
+ return new TypeError('Expected "string" but received "' + typeof obj_definitionStatus + '" (at "' + path_definitionStatus + '")');
299
+ }
300
+ const obj_definitionType = obj.definitionType;
301
+ const path_definitionType = path + '.definitionType';
302
+ if (typeof obj_definitionType !== 'string') {
303
+ return new TypeError('Expected "string" but received "' + typeof obj_definitionType + '" (at "' + path_definitionType + '")');
304
+ }
305
+ const obj_description = obj.description;
306
+ const path_description = path + '.description';
307
+ let obj_description_union0 = null;
308
+ const obj_description_union0_error = (() => {
309
+ if (typeof obj_description !== 'string') {
310
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
311
+ }
312
+ })();
313
+ if (obj_description_union0_error != null) {
314
+ obj_description_union0 = obj_description_union0_error.message;
315
+ }
316
+ let obj_description_union1 = null;
317
+ const obj_description_union1_error = (() => {
318
+ if (obj_description !== null) {
319
+ return new TypeError('Expected "null" but received "' + typeof obj_description + '" (at "' + path_description + '")');
320
+ }
321
+ })();
322
+ if (obj_description_union1_error != null) {
323
+ obj_description_union1 = obj_description_union1_error.message;
324
+ }
325
+ if (obj_description_union0 && obj_description_union1) {
326
+ let message = 'Object doesn\'t match union (at "' + path_description + '")';
327
+ message += '\n' + obj_description_union0.split('\n').map((line) => '\t' + line).join('\n');
328
+ message += '\n' + obj_description_union1.split('\n').map((line) => '\t' + line).join('\n');
329
+ return new TypeError(message);
330
+ }
331
+ const obj_dimensions = obj.dimensions;
332
+ const path_dimensions = path + '.dimensions';
333
+ if (!ArrayIsArray(obj_dimensions)) {
334
+ return new TypeError('Expected "array" but received "' + typeof obj_dimensions + '" (at "' + path_dimensions + '")');
335
+ }
336
+ for (let i = 0; i < obj_dimensions.length; i++) {
337
+ const obj_dimensions_item = obj_dimensions[i];
338
+ const path_dimensions_item = path_dimensions + '[' + i + ']';
339
+ const referencepath_dimensions_itemValidationError = validate$5(obj_dimensions_item, path_dimensions_item);
340
+ if (referencepath_dimensions_itemValidationError !== null) {
341
+ let message = 'Object doesn\'t match CdpCalculatedInsightDimensionRepresentation (at "' + path_dimensions_item + '")\n';
342
+ message += referencepath_dimensions_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
343
+ return new TypeError(message);
344
+ }
345
+ }
346
+ const obj_displayName = obj.displayName;
347
+ const path_displayName = path + '.displayName';
348
+ if (typeof obj_displayName !== 'string') {
349
+ return new TypeError('Expected "string" but received "' + typeof obj_displayName + '" (at "' + path_displayName + '")');
350
+ }
351
+ const obj_expression = obj.expression;
352
+ const path_expression = path + '.expression';
353
+ if (typeof obj_expression !== 'string') {
354
+ return new TypeError('Expected "string" but received "' + typeof obj_expression + '" (at "' + path_expression + '")');
355
+ }
356
+ const obj_isEnabled = obj.isEnabled;
357
+ const path_isEnabled = path + '.isEnabled';
358
+ if (typeof obj_isEnabled !== 'boolean') {
359
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isEnabled + '" (at "' + path_isEnabled + '")');
360
+ }
361
+ const obj_lastCalcInsightStatusDateTime = obj.lastCalcInsightStatusDateTime;
362
+ const path_lastCalcInsightStatusDateTime = path + '.lastCalcInsightStatusDateTime';
363
+ if (typeof obj_lastCalcInsightStatusDateTime !== 'string') {
364
+ return new TypeError('Expected "string" but received "' + typeof obj_lastCalcInsightStatusDateTime + '" (at "' + path_lastCalcInsightStatusDateTime + '")');
365
+ }
366
+ const obj_lastCalcInsightStatusErrorCode = obj.lastCalcInsightStatusErrorCode;
367
+ const path_lastCalcInsightStatusErrorCode = path + '.lastCalcInsightStatusErrorCode';
368
+ let obj_lastCalcInsightStatusErrorCode_union0 = null;
369
+ const obj_lastCalcInsightStatusErrorCode_union0_error = (() => {
370
+ if (typeof obj_lastCalcInsightStatusErrorCode !== 'string') {
371
+ return new TypeError('Expected "string" but received "' + typeof obj_lastCalcInsightStatusErrorCode + '" (at "' + path_lastCalcInsightStatusErrorCode + '")');
372
+ }
373
+ })();
374
+ if (obj_lastCalcInsightStatusErrorCode_union0_error != null) {
375
+ obj_lastCalcInsightStatusErrorCode_union0 = obj_lastCalcInsightStatusErrorCode_union0_error.message;
376
+ }
377
+ let obj_lastCalcInsightStatusErrorCode_union1 = null;
378
+ const obj_lastCalcInsightStatusErrorCode_union1_error = (() => {
379
+ if (obj_lastCalcInsightStatusErrorCode !== null) {
380
+ return new TypeError('Expected "null" but received "' + typeof obj_lastCalcInsightStatusErrorCode + '" (at "' + path_lastCalcInsightStatusErrorCode + '")');
381
+ }
382
+ })();
383
+ if (obj_lastCalcInsightStatusErrorCode_union1_error != null) {
384
+ obj_lastCalcInsightStatusErrorCode_union1 = obj_lastCalcInsightStatusErrorCode_union1_error.message;
385
+ }
386
+ if (obj_lastCalcInsightStatusErrorCode_union0 && obj_lastCalcInsightStatusErrorCode_union1) {
387
+ let message = 'Object doesn\'t match union (at "' + path_lastCalcInsightStatusErrorCode + '")';
388
+ message += '\n' + obj_lastCalcInsightStatusErrorCode_union0.split('\n').map((line) => '\t' + line).join('\n');
389
+ message += '\n' + obj_lastCalcInsightStatusErrorCode_union1.split('\n').map((line) => '\t' + line).join('\n');
390
+ return new TypeError(message);
391
+ }
392
+ const obj_lastRunDateTime = obj.lastRunDateTime;
393
+ const path_lastRunDateTime = path + '.lastRunDateTime';
394
+ let obj_lastRunDateTime_union0 = null;
395
+ const obj_lastRunDateTime_union0_error = (() => {
396
+ if (typeof obj_lastRunDateTime !== 'string') {
397
+ return new TypeError('Expected "string" but received "' + typeof obj_lastRunDateTime + '" (at "' + path_lastRunDateTime + '")');
398
+ }
399
+ })();
400
+ if (obj_lastRunDateTime_union0_error != null) {
401
+ obj_lastRunDateTime_union0 = obj_lastRunDateTime_union0_error.message;
402
+ }
403
+ let obj_lastRunDateTime_union1 = null;
404
+ const obj_lastRunDateTime_union1_error = (() => {
405
+ if (obj_lastRunDateTime !== null) {
406
+ return new TypeError('Expected "null" but received "' + typeof obj_lastRunDateTime + '" (at "' + path_lastRunDateTime + '")');
407
+ }
408
+ })();
409
+ if (obj_lastRunDateTime_union1_error != null) {
410
+ obj_lastRunDateTime_union1 = obj_lastRunDateTime_union1_error.message;
411
+ }
412
+ if (obj_lastRunDateTime_union0 && obj_lastRunDateTime_union1) {
413
+ let message = 'Object doesn\'t match union (at "' + path_lastRunDateTime + '")';
414
+ message += '\n' + obj_lastRunDateTime_union0.split('\n').map((line) => '\t' + line).join('\n');
415
+ message += '\n' + obj_lastRunDateTime_union1.split('\n').map((line) => '\t' + line).join('\n');
416
+ return new TypeError(message);
417
+ }
418
+ const obj_lastRunStatus = obj.lastRunStatus;
419
+ const path_lastRunStatus = path + '.lastRunStatus';
420
+ let obj_lastRunStatus_union0 = null;
421
+ const obj_lastRunStatus_union0_error = (() => {
422
+ if (typeof obj_lastRunStatus !== 'string') {
423
+ return new TypeError('Expected "string" but received "' + typeof obj_lastRunStatus + '" (at "' + path_lastRunStatus + '")');
424
+ }
425
+ })();
426
+ if (obj_lastRunStatus_union0_error != null) {
427
+ obj_lastRunStatus_union0 = obj_lastRunStatus_union0_error.message;
428
+ }
429
+ let obj_lastRunStatus_union1 = null;
430
+ const obj_lastRunStatus_union1_error = (() => {
431
+ if (obj_lastRunStatus !== null) {
432
+ return new TypeError('Expected "null" but received "' + typeof obj_lastRunStatus + '" (at "' + path_lastRunStatus + '")');
433
+ }
434
+ })();
435
+ if (obj_lastRunStatus_union1_error != null) {
436
+ obj_lastRunStatus_union1 = obj_lastRunStatus_union1_error.message;
437
+ }
438
+ if (obj_lastRunStatus_union0 && obj_lastRunStatus_union1) {
439
+ let message = 'Object doesn\'t match union (at "' + path_lastRunStatus + '")';
440
+ message += '\n' + obj_lastRunStatus_union0.split('\n').map((line) => '\t' + line).join('\n');
441
+ message += '\n' + obj_lastRunStatus_union1.split('\n').map((line) => '\t' + line).join('\n');
442
+ return new TypeError(message);
443
+ }
444
+ const obj_lastRunStatusDateTime = obj.lastRunStatusDateTime;
445
+ const path_lastRunStatusDateTime = path + '.lastRunStatusDateTime';
446
+ let obj_lastRunStatusDateTime_union0 = null;
447
+ const obj_lastRunStatusDateTime_union0_error = (() => {
448
+ if (typeof obj_lastRunStatusDateTime !== 'string') {
449
+ return new TypeError('Expected "string" but received "' + typeof obj_lastRunStatusDateTime + '" (at "' + path_lastRunStatusDateTime + '")');
450
+ }
451
+ })();
452
+ if (obj_lastRunStatusDateTime_union0_error != null) {
453
+ obj_lastRunStatusDateTime_union0 = obj_lastRunStatusDateTime_union0_error.message;
454
+ }
455
+ let obj_lastRunStatusDateTime_union1 = null;
456
+ const obj_lastRunStatusDateTime_union1_error = (() => {
457
+ if (obj_lastRunStatusDateTime !== null) {
458
+ return new TypeError('Expected "null" but received "' + typeof obj_lastRunStatusDateTime + '" (at "' + path_lastRunStatusDateTime + '")');
459
+ }
460
+ })();
461
+ if (obj_lastRunStatusDateTime_union1_error != null) {
462
+ obj_lastRunStatusDateTime_union1 = obj_lastRunStatusDateTime_union1_error.message;
463
+ }
464
+ if (obj_lastRunStatusDateTime_union0 && obj_lastRunStatusDateTime_union1) {
465
+ let message = 'Object doesn\'t match union (at "' + path_lastRunStatusDateTime + '")';
466
+ message += '\n' + obj_lastRunStatusDateTime_union0.split('\n').map((line) => '\t' + line).join('\n');
467
+ message += '\n' + obj_lastRunStatusDateTime_union1.split('\n').map((line) => '\t' + line).join('\n');
468
+ return new TypeError(message);
469
+ }
470
+ const obj_lastRunStatusErrorCode = obj.lastRunStatusErrorCode;
471
+ const path_lastRunStatusErrorCode = path + '.lastRunStatusErrorCode';
472
+ let obj_lastRunStatusErrorCode_union0 = null;
473
+ const obj_lastRunStatusErrorCode_union0_error = (() => {
474
+ if (typeof obj_lastRunStatusErrorCode !== 'string') {
475
+ return new TypeError('Expected "string" but received "' + typeof obj_lastRunStatusErrorCode + '" (at "' + path_lastRunStatusErrorCode + '")');
476
+ }
477
+ })();
478
+ if (obj_lastRunStatusErrorCode_union0_error != null) {
479
+ obj_lastRunStatusErrorCode_union0 = obj_lastRunStatusErrorCode_union0_error.message;
480
+ }
481
+ let obj_lastRunStatusErrorCode_union1 = null;
482
+ const obj_lastRunStatusErrorCode_union1_error = (() => {
483
+ if (obj_lastRunStatusErrorCode !== null) {
484
+ return new TypeError('Expected "null" but received "' + typeof obj_lastRunStatusErrorCode + '" (at "' + path_lastRunStatusErrorCode + '")');
485
+ }
486
+ })();
487
+ if (obj_lastRunStatusErrorCode_union1_error != null) {
488
+ obj_lastRunStatusErrorCode_union1 = obj_lastRunStatusErrorCode_union1_error.message;
489
+ }
490
+ if (obj_lastRunStatusErrorCode_union0 && obj_lastRunStatusErrorCode_union1) {
491
+ let message = 'Object doesn\'t match union (at "' + path_lastRunStatusErrorCode + '")';
492
+ message += '\n' + obj_lastRunStatusErrorCode_union0.split('\n').map((line) => '\t' + line).join('\n');
493
+ message += '\n' + obj_lastRunStatusErrorCode_union1.split('\n').map((line) => '\t' + line).join('\n');
494
+ return new TypeError(message);
495
+ }
496
+ const obj_measures = obj.measures;
497
+ const path_measures = path + '.measures';
498
+ if (!ArrayIsArray(obj_measures)) {
499
+ return new TypeError('Expected "array" but received "' + typeof obj_measures + '" (at "' + path_measures + '")');
500
+ }
501
+ for (let i = 0; i < obj_measures.length; i++) {
502
+ const obj_measures_item = obj_measures[i];
503
+ const path_measures_item = path_measures + '[' + i + ']';
504
+ const referencepath_measures_itemValidationError = validate$4(obj_measures_item, path_measures_item);
505
+ if (referencepath_measures_itemValidationError !== null) {
506
+ let message = 'Object doesn\'t match CdpCalculatedInsightMeasureRepresentation (at "' + path_measures_item + '")\n';
507
+ message += referencepath_measures_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
508
+ return new TypeError(message);
509
+ }
510
+ }
511
+ const obj_publishScheduleEndDate = obj.publishScheduleEndDate;
512
+ const path_publishScheduleEndDate = path + '.publishScheduleEndDate';
513
+ let obj_publishScheduleEndDate_union0 = null;
514
+ const obj_publishScheduleEndDate_union0_error = (() => {
515
+ if (typeof obj_publishScheduleEndDate !== 'string') {
516
+ return new TypeError('Expected "string" but received "' + typeof obj_publishScheduleEndDate + '" (at "' + path_publishScheduleEndDate + '")');
517
+ }
518
+ })();
519
+ if (obj_publishScheduleEndDate_union0_error != null) {
520
+ obj_publishScheduleEndDate_union0 = obj_publishScheduleEndDate_union0_error.message;
521
+ }
522
+ let obj_publishScheduleEndDate_union1 = null;
523
+ const obj_publishScheduleEndDate_union1_error = (() => {
524
+ if (obj_publishScheduleEndDate !== null) {
525
+ return new TypeError('Expected "null" but received "' + typeof obj_publishScheduleEndDate + '" (at "' + path_publishScheduleEndDate + '")');
526
+ }
527
+ })();
528
+ if (obj_publishScheduleEndDate_union1_error != null) {
529
+ obj_publishScheduleEndDate_union1 = obj_publishScheduleEndDate_union1_error.message;
530
+ }
531
+ if (obj_publishScheduleEndDate_union0 && obj_publishScheduleEndDate_union1) {
532
+ let message = 'Object doesn\'t match union (at "' + path_publishScheduleEndDate + '")';
533
+ message += '\n' + obj_publishScheduleEndDate_union0.split('\n').map((line) => '\t' + line).join('\n');
534
+ message += '\n' + obj_publishScheduleEndDate_union1.split('\n').map((line) => '\t' + line).join('\n');
535
+ return new TypeError(message);
536
+ }
537
+ const obj_publishScheduleInterval = obj.publishScheduleInterval;
538
+ const path_publishScheduleInterval = path + '.publishScheduleInterval';
539
+ if (typeof obj_publishScheduleInterval !== 'string') {
540
+ return new TypeError('Expected "string" but received "' + typeof obj_publishScheduleInterval + '" (at "' + path_publishScheduleInterval + '")');
541
+ }
542
+ const obj_publishScheduleStartDateTime = obj.publishScheduleStartDateTime;
543
+ const path_publishScheduleStartDateTime = path + '.publishScheduleStartDateTime';
544
+ let obj_publishScheduleStartDateTime_union0 = null;
545
+ const obj_publishScheduleStartDateTime_union0_error = (() => {
546
+ if (typeof obj_publishScheduleStartDateTime !== 'string') {
547
+ return new TypeError('Expected "string" but received "' + typeof obj_publishScheduleStartDateTime + '" (at "' + path_publishScheduleStartDateTime + '")');
548
+ }
549
+ })();
550
+ if (obj_publishScheduleStartDateTime_union0_error != null) {
551
+ obj_publishScheduleStartDateTime_union0 = obj_publishScheduleStartDateTime_union0_error.message;
552
+ }
553
+ let obj_publishScheduleStartDateTime_union1 = null;
554
+ const obj_publishScheduleStartDateTime_union1_error = (() => {
555
+ if (obj_publishScheduleStartDateTime !== null) {
556
+ return new TypeError('Expected "null" but received "' + typeof obj_publishScheduleStartDateTime + '" (at "' + path_publishScheduleStartDateTime + '")');
557
+ }
558
+ })();
559
+ if (obj_publishScheduleStartDateTime_union1_error != null) {
560
+ obj_publishScheduleStartDateTime_union1 = obj_publishScheduleStartDateTime_union1_error.message;
561
+ }
562
+ if (obj_publishScheduleStartDateTime_union0 && obj_publishScheduleStartDateTime_union1) {
563
+ let message = 'Object doesn\'t match union (at "' + path_publishScheduleStartDateTime + '")';
564
+ message += '\n' + obj_publishScheduleStartDateTime_union0.split('\n').map((line) => '\t' + line).join('\n');
565
+ message += '\n' + obj_publishScheduleStartDateTime_union1.split('\n').map((line) => '\t' + line).join('\n');
566
+ return new TypeError(message);
567
+ }
568
+ })();
569
+ return v_error === undefined ? null : v_error;
570
+ }
571
+ const RepresentationType$2 = 'CdpCalculatedInsightRepresentation';
572
+ function keyBuilder$6(luvio, config) {
573
+ return keyPrefix + '::' + RepresentationType$2 + ':' + config.apiName;
574
+ }
575
+ function keyBuilderFromType(luvio, object) {
576
+ const keyParams = {
577
+ apiName: object.apiName
578
+ };
579
+ return keyBuilder$6(luvio, keyParams);
580
+ }
581
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
582
+ return input;
583
+ }
584
+ const select$5 = function CdpCalculatedInsightRepresentationSelect() {
585
+ return {
586
+ kind: 'Fragment',
587
+ version: VERSION$2,
588
+ private: [],
589
+ opaque: true
590
+ };
591
+ };
592
+ function equals$2(existing, incoming) {
593
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
594
+ return false;
595
+ }
596
+ return true;
597
+ }
598
+ const ingest$2 = function CdpCalculatedInsightRepresentationIngest(input, path, luvio, store, timestamp) {
599
+ if (process.env.NODE_ENV !== 'production') {
600
+ const validateError = validate$3(input);
601
+ if (validateError !== null) {
602
+ throw validateError;
603
+ }
604
+ }
605
+ const key = keyBuilderFromType(luvio, input);
606
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 3000000;
607
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "calculated-insights", VERSION$2, RepresentationType$2, equals$2);
608
+ return createLink(key);
609
+ };
610
+ function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
611
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
612
+ const rootKey = keyBuilderFromType(luvio, input);
613
+ rootKeySet.set(rootKey, {
614
+ namespace: keyPrefix,
615
+ representationName: RepresentationType$2,
616
+ mergeable: false
617
+ });
618
+ }
619
+
620
+ function select$4(luvio, params) {
621
+ return select$5();
622
+ }
623
+ function keyBuilder$5(luvio, params) {
624
+ return keyBuilder$6(luvio, {
625
+ apiName: params.urlParams.apiName
626
+ });
627
+ }
628
+ function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
629
+ getTypeCacheKeys$2(storeKeyMap, luvio, response);
630
+ }
631
+ function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
632
+ const { body } = response;
633
+ const key = keyBuilder$5(luvio, resourceParams);
634
+ luvio.storeIngest(key, ingest$2, body);
635
+ const snapshot = luvio.storeLookup({
636
+ recordId: key,
637
+ node: select$4(),
638
+ variables: {},
639
+ }, snapshotRefresh);
640
+ if (process.env.NODE_ENV !== 'production') {
641
+ if (snapshot.state !== 'Fulfilled') {
642
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
643
+ }
644
+ }
645
+ deepFreeze(snapshot.data);
646
+ return snapshot;
647
+ }
648
+ function ingestError$2(luvio, params, error, snapshotRefresh) {
649
+ const key = keyBuilder$5(luvio, params);
650
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
651
+ luvio.storeIngestError(key, errorSnapshot);
652
+ return errorSnapshot;
653
+ }
654
+ function createResourceRequest$2(config) {
655
+ const headers = {};
656
+ return {
657
+ baseUri: '/services/data/v62.0',
658
+ basePath: '/ssot/calculated-insights/' + config.urlParams.apiName + '',
659
+ method: 'get',
660
+ body: null,
661
+ urlParams: config.urlParams,
662
+ queryParams: {},
663
+ headers,
664
+ priority: 'normal',
665
+ };
666
+ }
667
+ function createResourceRequestFromRepresentation(representation) {
668
+ const config = {
669
+ urlParams: {},
670
+ };
671
+ config.urlParams.apiName = representation.apiName;
672
+ return createResourceRequest$2(config);
673
+ }
674
+
675
+ const adapterName$2 = 'getCdpCalculatedInsight';
676
+ const getCdpCalculatedInsight_ConfigPropertyMetadata = [
677
+ generateParamConfigMetadata('apiName', true, 0 /* UrlParameter */, 0 /* String */),
678
+ ];
679
+ const getCdpCalculatedInsight_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getCdpCalculatedInsight_ConfigPropertyMetadata);
680
+ const createResourceParams$2 = /*#__PURE__*/ createResourceParams$3(getCdpCalculatedInsight_ConfigPropertyMetadata);
681
+ function keyBuilder$4(luvio, config) {
682
+ const resourceParams = createResourceParams$2(config);
683
+ return keyBuilder$5(luvio, resourceParams);
684
+ }
685
+ function typeCheckConfig$2(untrustedConfig) {
686
+ const config = {};
687
+ typeCheckConfig$3(untrustedConfig, config, getCdpCalculatedInsight_ConfigPropertyMetadata);
688
+ return config;
689
+ }
690
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
691
+ if (!untrustedIsObject(untrustedConfig)) {
692
+ return null;
693
+ }
694
+ if (process.env.NODE_ENV !== 'production') {
695
+ validateConfig(untrustedConfig, configPropertyNames);
696
+ }
697
+ const config = typeCheckConfig$2(untrustedConfig);
698
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
699
+ return null;
700
+ }
701
+ return config;
702
+ }
703
+ function adapterFragment$2(luvio, config) {
704
+ createResourceParams$2(config);
705
+ return select$4();
706
+ }
707
+ function onFetchResponseSuccess$2(luvio, config, resourceParams, response) {
708
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
709
+ config,
710
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
711
+ });
712
+ return luvio.storeBroadcast().then(() => snapshot);
713
+ }
714
+ function onFetchResponseError$2(luvio, config, resourceParams, response) {
715
+ const snapshot = ingestError$2(luvio, resourceParams, response, {
716
+ config,
717
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
718
+ });
719
+ return luvio.storeBroadcast().then(() => snapshot);
720
+ }
721
+ function buildNetworkSnapshot$2(luvio, config, options) {
722
+ const resourceParams = createResourceParams$2(config);
723
+ const request = createResourceRequest$2(resourceParams);
724
+ return luvio.dispatchResourceRequest(request, options)
725
+ .then((response) => {
726
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$2(luvio, config, resourceParams, response), () => {
727
+ const cache = new StoreKeyMap();
728
+ getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
729
+ return cache;
730
+ });
731
+ }, (response) => {
732
+ return luvio.handleErrorResponse(() => onFetchResponseError$2(luvio, config, resourceParams, response));
733
+ });
734
+ }
735
+ function buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext) {
736
+ return buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, undefined, false);
737
+ }
738
+ function buildCachedSnapshotCachePolicy$2(context, storeLookup) {
739
+ const { luvio, config } = context;
740
+ const selector = {
741
+ recordId: keyBuilder$4(luvio, config),
742
+ node: adapterFragment$2(luvio, config),
743
+ variables: {},
744
+ };
745
+ const cacheSnapshot = storeLookup(selector, {
746
+ config,
747
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
748
+ });
749
+ return cacheSnapshot;
750
+ }
751
+ const getCdpCalculatedInsightAdapterFactory = (luvio) => function calculatedInsights__getCdpCalculatedInsight(untrustedConfig, requestContext) {
752
+ const config = validateAdapterConfig$2(untrustedConfig, getCdpCalculatedInsight_ConfigPropertyNames);
753
+ // Invalid or incomplete config
754
+ if (config === null) {
755
+ return null;
756
+ }
757
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
758
+ buildCachedSnapshotCachePolicy$2, buildNetworkSnapshotCachePolicy$2);
759
+ };
760
+ const notifyChangeFactory = (luvio, options) => {
761
+ return function getSsotCalculatedInsightsByApiNameNotifyChange(configs) {
762
+ const keys = configs.map(c => keyBuilder$6(luvio, c));
763
+ luvio.getNotifyChangeStoreEntries(keys).then(entries => {
764
+ for (let i = 0, len = entries.length; i < len; i++) {
765
+ const { key, record: val } = entries[i];
766
+ const refreshRequest = createResourceRequestFromRepresentation(val);
767
+ luvio.dispatchResourceRequest(refreshRequest, options)
768
+ .then((response) => {
769
+ return luvio.handleSuccessResponse(() => {
770
+ const { body } = response;
771
+ luvio.storeIngest(key, ingest$2, body);
772
+ return luvio.storeBroadcast();
773
+ }, () => {
774
+ const cache = new StoreKeyMap();
775
+ getTypeCacheKeys$2(cache, luvio, response.body);
776
+ return cache;
777
+ });
778
+ }, (error) => {
779
+ return luvio.handleErrorResponse(() => {
780
+ const errorSnapshot = luvio.errorSnapshot(error);
781
+ luvio.storeIngestError(key, errorSnapshot, undefined);
782
+ return luvio.storeBroadcast().then(() => errorSnapshot);
783
+ });
784
+ });
785
+ }
786
+ });
787
+ };
788
+ };
789
+
790
+ function validate$2(obj, path = 'CdpCalculatedInsightCollectionDataRepresentation') {
791
+ const v_error = (() => {
792
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
793
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
794
+ }
795
+ const obj_count = obj.count;
796
+ const path_count = path + '.count';
797
+ if (typeof obj_count !== 'number' || (typeof obj_count === 'number' && Math.floor(obj_count) !== obj_count)) {
798
+ return new TypeError('Expected "integer" but received "' + typeof obj_count + '" (at "' + path_count + '")');
799
+ }
800
+ const obj_currentPageToken = obj.currentPageToken;
801
+ const path_currentPageToken = path + '.currentPageToken';
802
+ if (typeof obj_currentPageToken !== 'string') {
803
+ return new TypeError('Expected "string" but received "' + typeof obj_currentPageToken + '" (at "' + path_currentPageToken + '")');
804
+ }
805
+ const obj_currentPageUrl = obj.currentPageUrl;
806
+ const path_currentPageUrl = path + '.currentPageUrl';
807
+ if (typeof obj_currentPageUrl !== 'string') {
808
+ return new TypeError('Expected "string" but received "' + typeof obj_currentPageUrl + '" (at "' + path_currentPageUrl + '")');
809
+ }
810
+ const obj_items = obj.items;
811
+ const path_items = path + '.items';
812
+ if (!ArrayIsArray(obj_items)) {
813
+ return new TypeError('Expected "array" but received "' + typeof obj_items + '" (at "' + path_items + '")');
814
+ }
815
+ for (let i = 0; i < obj_items.length; i++) {
816
+ const obj_items_item = obj_items[i];
817
+ const path_items_item = path_items + '[' + i + ']';
818
+ const referencepath_items_itemValidationError = validate$3(obj_items_item, path_items_item);
819
+ if (referencepath_items_itemValidationError !== null) {
820
+ let message = 'Object doesn\'t match CdpCalculatedInsightRepresentation (at "' + path_items_item + '")\n';
821
+ message += referencepath_items_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
822
+ return new TypeError(message);
823
+ }
824
+ }
825
+ const obj_nextPageToken = obj.nextPageToken;
826
+ const path_nextPageToken = path + '.nextPageToken';
827
+ let obj_nextPageToken_union0 = null;
828
+ const obj_nextPageToken_union0_error = (() => {
829
+ if (typeof obj_nextPageToken !== 'string') {
830
+ return new TypeError('Expected "string" but received "' + typeof obj_nextPageToken + '" (at "' + path_nextPageToken + '")');
831
+ }
832
+ })();
833
+ if (obj_nextPageToken_union0_error != null) {
834
+ obj_nextPageToken_union0 = obj_nextPageToken_union0_error.message;
835
+ }
836
+ let obj_nextPageToken_union1 = null;
837
+ const obj_nextPageToken_union1_error = (() => {
838
+ if (obj_nextPageToken !== null) {
839
+ return new TypeError('Expected "null" but received "' + typeof obj_nextPageToken + '" (at "' + path_nextPageToken + '")');
840
+ }
841
+ })();
842
+ if (obj_nextPageToken_union1_error != null) {
843
+ obj_nextPageToken_union1 = obj_nextPageToken_union1_error.message;
844
+ }
845
+ if (obj_nextPageToken_union0 && obj_nextPageToken_union1) {
846
+ let message = 'Object doesn\'t match union (at "' + path_nextPageToken + '")';
847
+ message += '\n' + obj_nextPageToken_union0.split('\n').map((line) => '\t' + line).join('\n');
848
+ message += '\n' + obj_nextPageToken_union1.split('\n').map((line) => '\t' + line).join('\n');
849
+ return new TypeError(message);
850
+ }
851
+ const obj_nextPageUrl = obj.nextPageUrl;
852
+ const path_nextPageUrl = path + '.nextPageUrl';
853
+ let obj_nextPageUrl_union0 = null;
854
+ const obj_nextPageUrl_union0_error = (() => {
855
+ if (typeof obj_nextPageUrl !== 'string') {
856
+ return new TypeError('Expected "string" but received "' + typeof obj_nextPageUrl + '" (at "' + path_nextPageUrl + '")');
857
+ }
858
+ })();
859
+ if (obj_nextPageUrl_union0_error != null) {
860
+ obj_nextPageUrl_union0 = obj_nextPageUrl_union0_error.message;
861
+ }
862
+ let obj_nextPageUrl_union1 = null;
863
+ const obj_nextPageUrl_union1_error = (() => {
864
+ if (obj_nextPageUrl !== null) {
865
+ return new TypeError('Expected "null" but received "' + typeof obj_nextPageUrl + '" (at "' + path_nextPageUrl + '")');
866
+ }
867
+ })();
868
+ if (obj_nextPageUrl_union1_error != null) {
869
+ obj_nextPageUrl_union1 = obj_nextPageUrl_union1_error.message;
870
+ }
871
+ if (obj_nextPageUrl_union0 && obj_nextPageUrl_union1) {
872
+ let message = 'Object doesn\'t match union (at "' + path_nextPageUrl + '")';
873
+ message += '\n' + obj_nextPageUrl_union0.split('\n').map((line) => '\t' + line).join('\n');
874
+ message += '\n' + obj_nextPageUrl_union1.split('\n').map((line) => '\t' + line).join('\n');
875
+ return new TypeError(message);
876
+ }
877
+ const obj_previousPageToken = obj.previousPageToken;
878
+ const path_previousPageToken = path + '.previousPageToken';
879
+ let obj_previousPageToken_union0 = null;
880
+ const obj_previousPageToken_union0_error = (() => {
881
+ if (typeof obj_previousPageToken !== 'string') {
882
+ return new TypeError('Expected "string" but received "' + typeof obj_previousPageToken + '" (at "' + path_previousPageToken + '")');
883
+ }
884
+ })();
885
+ if (obj_previousPageToken_union0_error != null) {
886
+ obj_previousPageToken_union0 = obj_previousPageToken_union0_error.message;
887
+ }
888
+ let obj_previousPageToken_union1 = null;
889
+ const obj_previousPageToken_union1_error = (() => {
890
+ if (obj_previousPageToken !== null) {
891
+ return new TypeError('Expected "null" but received "' + typeof obj_previousPageToken + '" (at "' + path_previousPageToken + '")');
892
+ }
893
+ })();
894
+ if (obj_previousPageToken_union1_error != null) {
895
+ obj_previousPageToken_union1 = obj_previousPageToken_union1_error.message;
896
+ }
897
+ if (obj_previousPageToken_union0 && obj_previousPageToken_union1) {
898
+ let message = 'Object doesn\'t match union (at "' + path_previousPageToken + '")';
899
+ message += '\n' + obj_previousPageToken_union0.split('\n').map((line) => '\t' + line).join('\n');
900
+ message += '\n' + obj_previousPageToken_union1.split('\n').map((line) => '\t' + line).join('\n');
901
+ return new TypeError(message);
902
+ }
903
+ const obj_previousPageUrl = obj.previousPageUrl;
904
+ const path_previousPageUrl = path + '.previousPageUrl';
905
+ let obj_previousPageUrl_union0 = null;
906
+ const obj_previousPageUrl_union0_error = (() => {
907
+ if (typeof obj_previousPageUrl !== 'string') {
908
+ return new TypeError('Expected "string" but received "' + typeof obj_previousPageUrl + '" (at "' + path_previousPageUrl + '")');
909
+ }
910
+ })();
911
+ if (obj_previousPageUrl_union0_error != null) {
912
+ obj_previousPageUrl_union0 = obj_previousPageUrl_union0_error.message;
913
+ }
914
+ let obj_previousPageUrl_union1 = null;
915
+ const obj_previousPageUrl_union1_error = (() => {
916
+ if (obj_previousPageUrl !== null) {
917
+ return new TypeError('Expected "null" but received "' + typeof obj_previousPageUrl + '" (at "' + path_previousPageUrl + '")');
918
+ }
919
+ })();
920
+ if (obj_previousPageUrl_union1_error != null) {
921
+ obj_previousPageUrl_union1 = obj_previousPageUrl_union1_error.message;
922
+ }
923
+ if (obj_previousPageUrl_union0 && obj_previousPageUrl_union1) {
924
+ let message = 'Object doesn\'t match union (at "' + path_previousPageUrl + '")';
925
+ message += '\n' + obj_previousPageUrl_union0.split('\n').map((line) => '\t' + line).join('\n');
926
+ message += '\n' + obj_previousPageUrl_union1.split('\n').map((line) => '\t' + line).join('\n');
927
+ return new TypeError(message);
928
+ }
929
+ const obj_total = obj.total;
930
+ const path_total = path + '.total';
931
+ if (typeof obj_total !== 'number' || (typeof obj_total === 'number' && Math.floor(obj_total) !== obj_total)) {
932
+ return new TypeError('Expected "integer" but received "' + typeof obj_total + '" (at "' + path_total + '")');
933
+ }
934
+ })();
935
+ return v_error === undefined ? null : v_error;
936
+ }
937
+
938
+ const VERSION$1 = "7df690c1f12184b48859d00c5e68f477";
939
+ function validate$1(obj, path = 'CdpCalculatedInsightCollectionRepresentation') {
940
+ const v_error = (() => {
941
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
942
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
943
+ }
944
+ const obj_collection = obj.collection;
945
+ const path_collection = path + '.collection';
946
+ const referencepath_collectionValidationError = validate$2(obj_collection, path_collection);
947
+ if (referencepath_collectionValidationError !== null) {
948
+ let message = 'Object doesn\'t match CdpCalculatedInsightCollectionDataRepresentation (at "' + path_collection + '")\n';
949
+ message += referencepath_collectionValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
950
+ return new TypeError(message);
951
+ }
952
+ })();
953
+ return v_error === undefined ? null : v_error;
954
+ }
955
+ const RepresentationType$1 = 'CdpCalculatedInsightCollectionRepresentation';
956
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
957
+ return input;
958
+ }
959
+ const select$3 = function CdpCalculatedInsightCollectionRepresentationSelect() {
960
+ return {
961
+ kind: 'Fragment',
962
+ version: VERSION$1,
963
+ private: [],
964
+ opaque: true
965
+ };
966
+ };
967
+ function equals$1(existing, incoming) {
968
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
969
+ return false;
970
+ }
971
+ return true;
972
+ }
973
+ const ingest$1 = function CdpCalculatedInsightCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
974
+ if (process.env.NODE_ENV !== 'production') {
975
+ const validateError = validate$1(input);
976
+ if (validateError !== null) {
977
+ throw validateError;
978
+ }
979
+ }
980
+ const key = path.fullPath;
981
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 3000000;
982
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "calculated-insights", VERSION$1, RepresentationType$1, equals$1);
983
+ return createLink(key);
984
+ };
985
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
986
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
987
+ const rootKey = fullPathFactory();
988
+ rootKeySet.set(rootKey, {
989
+ namespace: keyPrefix,
990
+ representationName: RepresentationType$1,
991
+ mergeable: false
992
+ });
993
+ }
994
+
995
+ function select$2(luvio, params) {
996
+ return select$3();
997
+ }
998
+ function keyBuilder$3(luvio, params) {
999
+ return keyPrefix + '::CdpCalculatedInsightCollectionRepresentation:(' + 'batchSize:' + params.queryParams.batchSize + ',' + 'dataspace:' + params.queryParams.dataspace + ',' + 'definitionType:' + params.queryParams.definitionType + ',' + 'offset:' + params.queryParams.offset + ',' + 'orderby:' + params.queryParams.orderby + ',' + 'pageToken:' + params.queryParams.pageToken + ')';
1000
+ }
1001
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
1002
+ getTypeCacheKeys$1(storeKeyMap, luvio, response, () => keyBuilder$3(luvio, resourceParams));
1003
+ }
1004
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
1005
+ const { body } = response;
1006
+ const key = keyBuilder$3(luvio, resourceParams);
1007
+ luvio.storeIngest(key, ingest$1, body);
1008
+ const snapshot = luvio.storeLookup({
1009
+ recordId: key,
1010
+ node: select$2(),
1011
+ variables: {},
1012
+ }, snapshotRefresh);
1013
+ if (process.env.NODE_ENV !== 'production') {
1014
+ if (snapshot.state !== 'Fulfilled') {
1015
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1016
+ }
1017
+ }
1018
+ deepFreeze(snapshot.data);
1019
+ return snapshot;
1020
+ }
1021
+ function ingestError$1(luvio, params, error, snapshotRefresh) {
1022
+ const key = keyBuilder$3(luvio, params);
1023
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1024
+ luvio.storeIngestError(key, errorSnapshot);
1025
+ return errorSnapshot;
1026
+ }
1027
+ function createResourceRequest$1(config) {
1028
+ const headers = {};
1029
+ return {
1030
+ baseUri: '/services/data/v62.0',
1031
+ basePath: '/ssot/calculated-insights',
1032
+ method: 'get',
1033
+ body: null,
1034
+ urlParams: {},
1035
+ queryParams: config.queryParams,
1036
+ headers,
1037
+ priority: 'normal',
1038
+ };
1039
+ }
1040
+
1041
+ const adapterName$1 = 'getCdpCalculatedInsightCollection';
1042
+ const getCdpCalculatedInsightCollection_ConfigPropertyMetadata = [
1043
+ generateParamConfigMetadata('batchSize', false, 1 /* QueryParameter */, 3 /* Integer */),
1044
+ generateParamConfigMetadata('dataspace', false, 1 /* QueryParameter */, 0 /* String */),
1045
+ generateParamConfigMetadata('definitionType', false, 1 /* QueryParameter */, 0 /* String */),
1046
+ generateParamConfigMetadata('offset', false, 1 /* QueryParameter */, 3 /* Integer */),
1047
+ generateParamConfigMetadata('orderby', false, 1 /* QueryParameter */, 0 /* String */),
1048
+ generateParamConfigMetadata('pageToken', false, 1 /* QueryParameter */, 0 /* String */),
1049
+ ];
1050
+ const getCdpCalculatedInsightCollection_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getCdpCalculatedInsightCollection_ConfigPropertyMetadata);
1051
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(getCdpCalculatedInsightCollection_ConfigPropertyMetadata);
1052
+ function keyBuilder$2(luvio, config) {
1053
+ const resourceParams = createResourceParams$1(config);
1054
+ return keyBuilder$3(luvio, resourceParams);
1055
+ }
1056
+ function typeCheckConfig$1(untrustedConfig) {
1057
+ const config = {};
1058
+ typeCheckConfig$3(untrustedConfig, config, getCdpCalculatedInsightCollection_ConfigPropertyMetadata);
1059
+ return config;
1060
+ }
1061
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
1062
+ if (!untrustedIsObject(untrustedConfig)) {
1063
+ return null;
1064
+ }
1065
+ if (process.env.NODE_ENV !== 'production') {
1066
+ validateConfig(untrustedConfig, configPropertyNames);
1067
+ }
1068
+ const config = typeCheckConfig$1(untrustedConfig);
1069
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1070
+ return null;
1071
+ }
1072
+ return config;
1073
+ }
1074
+ function adapterFragment$1(luvio, config) {
1075
+ createResourceParams$1(config);
1076
+ return select$2();
1077
+ }
1078
+ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
1079
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
1080
+ config,
1081
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1082
+ });
1083
+ return luvio.storeBroadcast().then(() => snapshot);
1084
+ }
1085
+ function onFetchResponseError$1(luvio, config, resourceParams, response) {
1086
+ const snapshot = ingestError$1(luvio, resourceParams, response, {
1087
+ config,
1088
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1089
+ });
1090
+ return luvio.storeBroadcast().then(() => snapshot);
1091
+ }
1092
+ function buildNetworkSnapshot$1(luvio, config, options) {
1093
+ const resourceParams = createResourceParams$1(config);
1094
+ const request = createResourceRequest$1(resourceParams);
1095
+ return luvio.dispatchResourceRequest(request, options)
1096
+ .then((response) => {
1097
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
1098
+ const cache = new StoreKeyMap();
1099
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
1100
+ return cache;
1101
+ });
1102
+ }, (response) => {
1103
+ return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
1104
+ });
1105
+ }
1106
+ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
1107
+ return buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
1108
+ }
1109
+ function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
1110
+ const { luvio, config } = context;
1111
+ const selector = {
1112
+ recordId: keyBuilder$2(luvio, config),
1113
+ node: adapterFragment$1(luvio, config),
1114
+ variables: {},
1115
+ };
1116
+ const cacheSnapshot = storeLookup(selector, {
1117
+ config,
1118
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1119
+ });
1120
+ return cacheSnapshot;
1121
+ }
1122
+ const getCdpCalculatedInsightCollectionAdapterFactory = (luvio) => function calculatedInsights__getCdpCalculatedInsightCollection(untrustedConfig, requestContext) {
1123
+ const config = validateAdapterConfig$1(untrustedConfig, getCdpCalculatedInsightCollection_ConfigPropertyNames);
1124
+ // Invalid or incomplete config
1125
+ if (config === null) {
1126
+ return null;
1127
+ }
1128
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
1129
+ buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
1130
+ };
1131
+
1132
+ const VERSION = "f7dafa2848516fc627f377709ba0b375";
1133
+ function validate(obj, path = 'CdpQueryOutputRepresentation') {
1134
+ const v_error = (() => {
1135
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1136
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1137
+ }
1138
+ const obj_data = obj.data;
1139
+ const path_data = path + '.data';
1140
+ if (!ArrayIsArray(obj_data)) {
1141
+ return new TypeError('Expected "array" but received "' + typeof obj_data + '" (at "' + path_data + '")');
1142
+ }
1143
+ for (let i = 0; i < obj_data.length; i++) {
1144
+ const obj_data_item = obj_data[i];
1145
+ const path_data_item = path_data + '[' + i + ']';
1146
+ if (typeof obj_data_item !== 'object' || ArrayIsArray(obj_data_item) || obj_data_item === null) {
1147
+ return new TypeError('Expected "object" but received "' + typeof obj_data_item + '" (at "' + path_data_item + '")');
1148
+ }
1149
+ const obj_data_item_keys = ObjectKeys(obj_data_item);
1150
+ for (let i = 0; i < obj_data_item_keys.length; i++) {
1151
+ const key = obj_data_item_keys[i];
1152
+ const obj_data_item_prop = obj_data_item[key];
1153
+ const path_data_item_prop = path_data_item + '["' + key + '"]';
1154
+ if (obj_data_item_prop === undefined) {
1155
+ return new TypeError('Expected "defined" but received "' + typeof obj_data_item_prop + '" (at "' + path_data_item_prop + '")');
1156
+ }
1157
+ }
1158
+ }
1159
+ const obj_done = obj.done;
1160
+ const path_done = path + '.done';
1161
+ if (typeof obj_done !== 'boolean') {
1162
+ return new TypeError('Expected "boolean" but received "' + typeof obj_done + '" (at "' + path_done + '")');
1163
+ }
1164
+ if (obj.endTime !== undefined) {
1165
+ const obj_endTime = obj.endTime;
1166
+ const path_endTime = path + '.endTime';
1167
+ if (typeof obj_endTime !== 'string') {
1168
+ return new TypeError('Expected "string" but received "' + typeof obj_endTime + '" (at "' + path_endTime + '")');
1169
+ }
1170
+ }
1171
+ const obj_metadata = obj.metadata;
1172
+ const path_metadata = path + '.metadata';
1173
+ if (typeof obj_metadata !== 'object' || ArrayIsArray(obj_metadata) || obj_metadata === null) {
1174
+ return new TypeError('Expected "object" but received "' + typeof obj_metadata + '" (at "' + path_metadata + '")');
1175
+ }
1176
+ const obj_metadata_keys = ObjectKeys(obj_metadata);
1177
+ for (let i = 0; i < obj_metadata_keys.length; i++) {
1178
+ const key = obj_metadata_keys[i];
1179
+ const obj_metadata_prop = obj_metadata[key];
1180
+ const path_metadata_prop = path_metadata + '["' + key + '"]';
1181
+ if (obj_metadata_prop === undefined) {
1182
+ return new TypeError('Expected "defined" but received "' + typeof obj_metadata_prop + '" (at "' + path_metadata_prop + '")');
1183
+ }
1184
+ }
1185
+ if (obj.queryId !== undefined) {
1186
+ const obj_queryId = obj.queryId;
1187
+ const path_queryId = path + '.queryId';
1188
+ if (typeof obj_queryId !== 'string') {
1189
+ return new TypeError('Expected "string" but received "' + typeof obj_queryId + '" (at "' + path_queryId + '")');
1190
+ }
1191
+ }
1192
+ if (obj.rowCount !== undefined) {
1193
+ const obj_rowCount = obj.rowCount;
1194
+ const path_rowCount = path + '.rowCount';
1195
+ if (typeof obj_rowCount !== 'number' || (typeof obj_rowCount === 'number' && Math.floor(obj_rowCount) !== obj_rowCount)) {
1196
+ return new TypeError('Expected "integer" but received "' + typeof obj_rowCount + '" (at "' + path_rowCount + '")');
1197
+ }
1198
+ }
1199
+ if (obj.startTime !== undefined) {
1200
+ const obj_startTime = obj.startTime;
1201
+ const path_startTime = path + '.startTime';
1202
+ if (typeof obj_startTime !== 'string') {
1203
+ return new TypeError('Expected "string" but received "' + typeof obj_startTime + '" (at "' + path_startTime + '")');
1204
+ }
1205
+ }
1206
+ })();
1207
+ return v_error === undefined ? null : v_error;
1208
+ }
1209
+ const RepresentationType = 'CdpQueryOutputRepresentation';
1210
+ function normalize(input, existing, path, luvio, store, timestamp) {
1211
+ return input;
1212
+ }
1213
+ const select$1 = function CdpQueryOutputRepresentationSelect() {
1214
+ return {
1215
+ kind: 'Fragment',
1216
+ version: VERSION,
1217
+ private: [],
1218
+ selections: [
1219
+ {
1220
+ name: 'data',
1221
+ kind: 'Object',
1222
+ // any
1223
+ },
1224
+ {
1225
+ name: 'done',
1226
+ kind: 'Scalar'
1227
+ },
1228
+ {
1229
+ name: 'endTime',
1230
+ kind: 'Scalar',
1231
+ required: false
1232
+ },
1233
+ {
1234
+ name: 'metadata',
1235
+ kind: 'Object',
1236
+ // any
1237
+ },
1238
+ {
1239
+ name: 'queryId',
1240
+ kind: 'Scalar',
1241
+ required: false
1242
+ },
1243
+ {
1244
+ name: 'rowCount',
1245
+ kind: 'Scalar',
1246
+ required: false
1247
+ },
1248
+ {
1249
+ name: 'startTime',
1250
+ kind: 'Scalar',
1251
+ required: false
1252
+ }
1253
+ ]
1254
+ };
1255
+ };
1256
+ function equals(existing, incoming) {
1257
+ const existing_done = existing.done;
1258
+ const incoming_done = incoming.done;
1259
+ if (!(existing_done === incoming_done)) {
1260
+ return false;
1261
+ }
1262
+ const existing_rowCount = existing.rowCount;
1263
+ const incoming_rowCount = incoming.rowCount;
1264
+ // if at least one of these optionals is defined
1265
+ if (existing_rowCount !== undefined || incoming_rowCount !== undefined) {
1266
+ // if one of these is not defined we know the other is defined and therefore
1267
+ // not equal
1268
+ if (existing_rowCount === undefined || incoming_rowCount === undefined) {
1269
+ return false;
1270
+ }
1271
+ if (!(existing_rowCount === incoming_rowCount)) {
1272
+ return false;
1273
+ }
1274
+ }
1275
+ const existing_endTime = existing.endTime;
1276
+ const incoming_endTime = incoming.endTime;
1277
+ // if at least one of these optionals is defined
1278
+ if (existing_endTime !== undefined || incoming_endTime !== undefined) {
1279
+ // if one of these is not defined we know the other is defined and therefore
1280
+ // not equal
1281
+ if (existing_endTime === undefined || incoming_endTime === undefined) {
1282
+ return false;
1283
+ }
1284
+ if (!(existing_endTime === incoming_endTime)) {
1285
+ return false;
1286
+ }
1287
+ }
1288
+ const existing_queryId = existing.queryId;
1289
+ const incoming_queryId = incoming.queryId;
1290
+ // if at least one of these optionals is defined
1291
+ if (existing_queryId !== undefined || incoming_queryId !== undefined) {
1292
+ // if one of these is not defined we know the other is defined and therefore
1293
+ // not equal
1294
+ if (existing_queryId === undefined || incoming_queryId === undefined) {
1295
+ return false;
1296
+ }
1297
+ if (!(existing_queryId === incoming_queryId)) {
1298
+ return false;
1299
+ }
1300
+ }
1301
+ const existing_startTime = existing.startTime;
1302
+ const incoming_startTime = incoming.startTime;
1303
+ // if at least one of these optionals is defined
1304
+ if (existing_startTime !== undefined || incoming_startTime !== undefined) {
1305
+ // if one of these is not defined we know the other is defined and therefore
1306
+ // not equal
1307
+ if (existing_startTime === undefined || incoming_startTime === undefined) {
1308
+ return false;
1309
+ }
1310
+ if (!(existing_startTime === incoming_startTime)) {
1311
+ return false;
1312
+ }
1313
+ }
1314
+ const existing_data = existing.data;
1315
+ const incoming_data = incoming.data;
1316
+ const equals_data_items = equalsArray(existing_data, incoming_data, (existing_data_item, incoming_data_item) => {
1317
+ const equals_data_items_props = equalsObject(existing_data_item, incoming_data_item, (existing_data_item_prop, incoming_data_item_prop) => {
1318
+ if (JSONStringify(incoming_data_item_prop) !== JSONStringify(existing_data_item_prop)) {
1319
+ return false;
1320
+ }
1321
+ });
1322
+ if (equals_data_items_props === false) {
1323
+ return false;
1324
+ }
1325
+ });
1326
+ if (equals_data_items === false) {
1327
+ return false;
1328
+ }
1329
+ const existing_metadata = existing.metadata;
1330
+ const incoming_metadata = incoming.metadata;
1331
+ const equals_metadata_props = equalsObject(existing_metadata, incoming_metadata, (existing_metadata_prop, incoming_metadata_prop) => {
1332
+ if (JSONStringify(incoming_metadata_prop) !== JSONStringify(existing_metadata_prop)) {
1333
+ return false;
1334
+ }
1335
+ });
1336
+ if (equals_metadata_props === false) {
1337
+ return false;
1338
+ }
1339
+ return true;
1340
+ }
1341
+ const ingest = function CdpQueryOutputRepresentationIngest(input, path, luvio, store, timestamp) {
1342
+ if (process.env.NODE_ENV !== 'production') {
1343
+ const validateError = validate(input);
1344
+ if (validateError !== null) {
1345
+ throw validateError;
1346
+ }
1347
+ }
1348
+ const key = path.fullPath;
1349
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 3000000;
1350
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "calculated-insights", VERSION, RepresentationType, equals);
1351
+ return createLink(key);
1352
+ };
1353
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
1354
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
1355
+ const rootKey = fullPathFactory();
1356
+ rootKeySet.set(rootKey, {
1357
+ namespace: keyPrefix,
1358
+ representationName: RepresentationType,
1359
+ mergeable: false
1360
+ });
1361
+ }
1362
+
1363
+ function select(luvio, params) {
1364
+ return select$1();
1365
+ }
1366
+ function keyBuilder$1(luvio, params) {
1367
+ return keyPrefix + '::CdpQueryOutputRepresentation:(' + 'batchSize:' + params.queryParams.batchSize + ',' + 'dataspace:' + params.queryParams.dataspace + ',' + 'dimensions:' + params.queryParams.dimensions + ',' + 'filters:' + params.queryParams.filters + ',' + 'measures:' + params.queryParams.measures + ',' + 'offset:' + params.queryParams.offset + ',' + 'orderby:' + params.queryParams.orderby + ',' + 'timeGranularity:' + params.queryParams.timeGranularity + ',' + 'ciName:' + params.urlParams.ciName + ')';
1368
+ }
1369
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
1370
+ getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$1(luvio, resourceParams));
1371
+ }
1372
+ function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
1373
+ const { body } = response;
1374
+ const key = keyBuilder$1(luvio, resourceParams);
1375
+ luvio.storeIngest(key, ingest, body);
1376
+ const snapshot = luvio.storeLookup({
1377
+ recordId: key,
1378
+ node: select(),
1379
+ variables: {},
1380
+ }, snapshotRefresh);
1381
+ if (process.env.NODE_ENV !== 'production') {
1382
+ if (snapshot.state !== 'Fulfilled') {
1383
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1384
+ }
1385
+ }
1386
+ deepFreeze(snapshot.data);
1387
+ return snapshot;
1388
+ }
1389
+ function ingestError(luvio, params, error, snapshotRefresh) {
1390
+ const key = keyBuilder$1(luvio, params);
1391
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1392
+ luvio.storeIngestError(key, errorSnapshot);
1393
+ return errorSnapshot;
1394
+ }
1395
+ function createResourceRequest(config) {
1396
+ const headers = {};
1397
+ return {
1398
+ baseUri: '/services/data/v62.0',
1399
+ basePath: '/ssot/insight/calculated-insights/' + config.urlParams.ciName + '',
1400
+ method: 'get',
1401
+ body: null,
1402
+ urlParams: config.urlParams,
1403
+ queryParams: config.queryParams,
1404
+ headers,
1405
+ priority: 'normal',
1406
+ };
1407
+ }
1408
+
1409
+ const adapterName = 'getCdpInsightsQuery';
1410
+ const getCdpInsightsQuery_ConfigPropertyMetadata = [
1411
+ generateParamConfigMetadata('ciName', true, 0 /* UrlParameter */, 0 /* String */),
1412
+ generateParamConfigMetadata('batchSize', false, 1 /* QueryParameter */, 3 /* Integer */),
1413
+ generateParamConfigMetadata('dataspace', false, 1 /* QueryParameter */, 0 /* String */),
1414
+ generateParamConfigMetadata('dimensions', false, 1 /* QueryParameter */, 0 /* String */),
1415
+ generateParamConfigMetadata('filters', false, 1 /* QueryParameter */, 0 /* String */),
1416
+ generateParamConfigMetadata('measures', false, 1 /* QueryParameter */, 0 /* String */),
1417
+ generateParamConfigMetadata('offset', false, 1 /* QueryParameter */, 3 /* Integer */),
1418
+ generateParamConfigMetadata('orderby', false, 1 /* QueryParameter */, 0 /* String */),
1419
+ generateParamConfigMetadata('timeGranularity', false, 1 /* QueryParameter */, 0 /* String */),
1420
+ ];
1421
+ const getCdpInsightsQuery_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getCdpInsightsQuery_ConfigPropertyMetadata);
1422
+ const createResourceParams = /*#__PURE__*/ createResourceParams$3(getCdpInsightsQuery_ConfigPropertyMetadata);
1423
+ function keyBuilder(luvio, config) {
1424
+ const resourceParams = createResourceParams(config);
1425
+ return keyBuilder$1(luvio, resourceParams);
1426
+ }
1427
+ function typeCheckConfig(untrustedConfig) {
1428
+ const config = {};
1429
+ typeCheckConfig$3(untrustedConfig, config, getCdpInsightsQuery_ConfigPropertyMetadata);
1430
+ return config;
1431
+ }
1432
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
1433
+ if (!untrustedIsObject(untrustedConfig)) {
1434
+ return null;
1435
+ }
1436
+ if (process.env.NODE_ENV !== 'production') {
1437
+ validateConfig(untrustedConfig, configPropertyNames);
1438
+ }
1439
+ const config = typeCheckConfig(untrustedConfig);
1440
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1441
+ return null;
1442
+ }
1443
+ return config;
1444
+ }
1445
+ function adapterFragment(luvio, config) {
1446
+ createResourceParams(config);
1447
+ return select();
1448
+ }
1449
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
1450
+ const snapshot = ingestSuccess(luvio, resourceParams, response, {
1451
+ config,
1452
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
1453
+ });
1454
+ return luvio.storeBroadcast().then(() => snapshot);
1455
+ }
1456
+ function onFetchResponseError(luvio, config, resourceParams, response) {
1457
+ const snapshot = ingestError(luvio, resourceParams, response, {
1458
+ config,
1459
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
1460
+ });
1461
+ return luvio.storeBroadcast().then(() => snapshot);
1462
+ }
1463
+ function buildNetworkSnapshot(luvio, config, options) {
1464
+ const resourceParams = createResourceParams(config);
1465
+ const request = createResourceRequest(resourceParams);
1466
+ return luvio.dispatchResourceRequest(request, options)
1467
+ .then((response) => {
1468
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
1469
+ const cache = new StoreKeyMap();
1470
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
1471
+ return cache;
1472
+ });
1473
+ }, (response) => {
1474
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
1475
+ });
1476
+ }
1477
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
1478
+ return buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
1479
+ }
1480
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
1481
+ const { luvio, config } = context;
1482
+ const selector = {
1483
+ recordId: keyBuilder(luvio, config),
1484
+ node: adapterFragment(luvio, config),
1485
+ variables: {},
1486
+ };
1487
+ const cacheSnapshot = storeLookup(selector, {
1488
+ config,
1489
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
1490
+ });
1491
+ return cacheSnapshot;
1492
+ }
1493
+ const getCdpInsightsQueryAdapterFactory = (luvio) => function calculatedInsights__getCdpInsightsQuery(untrustedConfig, requestContext) {
1494
+ const config = validateAdapterConfig(untrustedConfig, getCdpInsightsQuery_ConfigPropertyNames);
1495
+ // Invalid or incomplete config
1496
+ if (config === null) {
1497
+ return null;
1498
+ }
1499
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
1500
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
1501
+ };
1502
+
1503
+ let getCdpCalculatedInsight;
1504
+ let getCdpCalculatedInsightCollection;
1505
+ let getCdpCalculatedInsightNotifyChange;
1506
+ let getCdpInsightsQuery;
1507
+ // Imperative GET Adapters
1508
+ let getCdpCalculatedInsight_imperative;
1509
+ let getCdpCalculatedInsightCollection_imperative;
1510
+ let getCdpInsightsQuery_imperative;
1511
+ // Adapter Metadata
1512
+ const getCdpCalculatedInsightMetadata = {
1513
+ apiFamily: 'calculatedinsights',
1514
+ name: 'getCdpCalculatedInsight',
1515
+ };
1516
+ const getCdpCalculatedInsightCollectionMetadata = {
1517
+ apiFamily: 'calculatedinsights',
1518
+ name: 'getCdpCalculatedInsightCollection',
1519
+ };
1520
+ const getCdpInsightsQueryMetadata = {
1521
+ apiFamily: 'calculatedinsights',
1522
+ name: 'getCdpInsightsQuery',
1523
+ };
1524
+ // Notify Update Available
1525
+ function bindExportsTo(luvio) {
1526
+ // LDS Adapters
1527
+ const getCdpCalculatedInsight_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getCdpCalculatedInsight', getCdpCalculatedInsightAdapterFactory), getCdpCalculatedInsightMetadata);
1528
+ const getCdpCalculatedInsightCollection_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getCdpCalculatedInsightCollection', getCdpCalculatedInsightCollectionAdapterFactory), getCdpCalculatedInsightCollectionMetadata);
1529
+ const getCdpInsightsQuery_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getCdpInsightsQuery', getCdpInsightsQueryAdapterFactory), getCdpInsightsQueryMetadata);
1530
+ return {
1531
+ getCdpCalculatedInsight: createWireAdapterConstructor(luvio, getCdpCalculatedInsight_ldsAdapter, getCdpCalculatedInsightMetadata),
1532
+ getCdpCalculatedInsightCollection: createWireAdapterConstructor(luvio, getCdpCalculatedInsightCollection_ldsAdapter, getCdpCalculatedInsightCollectionMetadata),
1533
+ getCdpCalculatedInsightNotifyChange: createLDSAdapter(luvio, 'getCdpCalculatedInsightNotifyChange', notifyChangeFactory),
1534
+ getCdpInsightsQuery: createWireAdapterConstructor(luvio, getCdpInsightsQuery_ldsAdapter, getCdpInsightsQueryMetadata),
1535
+ // Imperative GET Adapters
1536
+ getCdpCalculatedInsight_imperative: createImperativeAdapter(luvio, getCdpCalculatedInsight_ldsAdapter, getCdpCalculatedInsightMetadata),
1537
+ getCdpCalculatedInsightCollection_imperative: createImperativeAdapter(luvio, getCdpCalculatedInsightCollection_ldsAdapter, getCdpCalculatedInsightCollectionMetadata),
1538
+ getCdpInsightsQuery_imperative: createImperativeAdapter(luvio, getCdpInsightsQuery_ldsAdapter, getCdpInsightsQueryMetadata),
1539
+ // Notify Update Availables
1540
+ };
1541
+ }
1542
+ withDefaultLuvio((luvio) => {
1543
+ ({
1544
+ getCdpCalculatedInsight,
1545
+ getCdpCalculatedInsightCollection,
1546
+ getCdpCalculatedInsightNotifyChange,
1547
+ getCdpInsightsQuery,
1548
+ getCdpCalculatedInsight_imperative,
1549
+ getCdpCalculatedInsightCollection_imperative,
1550
+ getCdpInsightsQuery_imperative,
1551
+ } = bindExportsTo(luvio));
1552
+ });
1553
+
1554
+ export { getCdpCalculatedInsight, getCdpCalculatedInsightCollection, getCdpCalculatedInsightCollection_imperative, getCdpCalculatedInsightNotifyChange, getCdpCalculatedInsight_imperative, getCdpInsightsQuery, getCdpInsightsQuery_imperative };
1555
+ // version: 1.295.0-e85f207c7