@salesforce/lds-adapters-sfap-analytics-insights 1.298.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 (60) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/sfap-analytics-insights.js +2767 -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/createInsightsBatch.d.ts +17 -0
  5. package/dist/es/es2018/types/src/generated/adapters/generateInsights.d.ts +18 -0
  6. package/dist/es/es2018/types/src/generated/adapters/getInsightsBatch.d.ts +28 -0
  7. package/dist/es/es2018/types/src/generated/adapters/getMetricFilterValues.d.ts +25 -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/getBatchesByBatch_id.d.ts +16 -0
  11. package/dist/es/es2018/types/src/generated/resources/postBatches.d.ts +14 -0
  12. package/dist/es/es2018/types/src/generated/resources/postFilterValues.d.ts +22 -0
  13. package/dist/es/es2018/types/src/generated/resources/postV1GenerateBundle.d.ts +15 -0
  14. package/dist/es/es2018/types/src/generated/types/BatchInput.d.ts +30 -0
  15. package/dist/es/es2018/types/src/generated/types/BatchOptions.d.ts +34 -0
  16. package/dist/es/es2018/types/src/generated/types/CompareConfig.d.ts +27 -0
  17. package/dist/es/es2018/types/src/generated/types/Error.d.ts +29 -0
  18. package/dist/es/es2018/types/src/generated/types/ExtensionOptions.d.ts +29 -0
  19. package/dist/es/es2018/types/src/generated/types/Filter.d.ts +36 -0
  20. package/dist/es/es2018/types/src/generated/types/GenerateInsightBatchRequest.d.ts +32 -0
  21. package/dist/es/es2018/types/src/generated/types/GenerateInsightBatchResponse.d.ts +47 -0
  22. package/dist/es/es2018/types/src/generated/types/GenerateInsightBundleRequest.d.ts +37 -0
  23. package/dist/es/es2018/types/src/generated/types/GenerateInsightBundleResponse.d.ts +45 -0
  24. package/dist/es/es2018/types/src/generated/types/GetFilterValuesRequest.d.ts +45 -0
  25. package/dist/es/es2018/types/src/generated/types/GetFilterValuesResponse.d.ts +43 -0
  26. package/dist/es/es2018/types/src/generated/types/GetFilterValuesResponse_CategoricalValues.d.ts +29 -0
  27. package/dist/es/es2018/types/src/generated/types/GetInsightBatchResponse.d.ts +47 -0
  28. package/dist/es/es2018/types/src/generated/types/InputMetric.d.ts +40 -0
  29. package/dist/es/es2018/types/src/generated/types/Insight.d.ts +49 -0
  30. package/dist/es/es2018/types/src/generated/types/InsightBundle.d.ts +35 -0
  31. package/dist/es/es2018/types/src/generated/types/InsightBundleInput.d.ts +31 -0
  32. package/dist/es/es2018/types/src/generated/types/InsightBundleOptions.d.ts +40 -0
  33. package/dist/es/es2018/types/src/generated/types/InsightFeedbackMetadata.d.ts +31 -0
  34. package/dist/es/es2018/types/src/generated/types/InsightGroup.d.ts +36 -0
  35. package/dist/es/es2018/types/src/generated/types/InsightResponse.d.ts +33 -0
  36. package/dist/es/es2018/types/src/generated/types/InsightsOptions.d.ts +28 -0
  37. package/dist/es/es2018/types/src/generated/types/InsightsOptions_InsightSetting.d.ts +29 -0
  38. package/dist/es/es2018/types/src/generated/types/Measure.d.ts +33 -0
  39. package/dist/es/es2018/types/src/generated/types/MeasurementPeriod.d.ts +41 -0
  40. package/dist/es/es2018/types/src/generated/types/MetricDefinition.d.ts +42 -0
  41. package/dist/es/es2018/types/src/generated/types/MetricInstance.d.ts +31 -0
  42. package/dist/es/es2018/types/src/generated/types/MetricMetadata.d.ts +29 -0
  43. package/dist/es/es2018/types/src/generated/types/NullableValue.d.ts +36 -0
  44. package/dist/es/es2018/types/src/generated/types/Overview.d.ts +30 -0
  45. package/dist/es/es2018/types/src/generated/types/OverviewResponse.d.ts +31 -0
  46. package/dist/es/es2018/types/src/generated/types/RepresentationOptions.d.ts +32 -0
  47. package/dist/es/es2018/types/src/generated/types/RepresentationOptions_NumberUnits.d.ts +29 -0
  48. package/dist/es/es2018/types/src/generated/types/SemanticDataModel.d.ts +27 -0
  49. package/dist/es/es2018/types/src/generated/types/SemanticField.d.ts +28 -0
  50. package/dist/es/es2018/types/src/generated/types/SummarizationOptions.d.ts +28 -0
  51. package/dist/es/es2018/types/src/generated/types/Summary.d.ts +37 -0
  52. package/dist/es/es2018/types/src/generated/types/SummaryResponse.d.ts +31 -0
  53. package/dist/es/es2018/types/src/generated/types/TableField.d.ts +31 -0
  54. package/dist/es/es2018/types/src/generated/types/TimeDimension.d.ts +31 -0
  55. package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
  56. package/package.json +66 -0
  57. package/sfdc/index.d.ts +1 -0
  58. package/sfdc/index.js +2852 -0
  59. package/src/raml/api.raml +723 -0
  60. package/src/raml/luvio.raml +47 -0
@@ -0,0 +1,2767 @@
1
+ /**
2
+ * Copyright (c) 2022, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+
7
+ import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$4, typeCheckConfig as typeCheckConfig$4, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1 } from '@luvio/engine';
8
+
9
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
+ const { keys: ObjectKeys, create: ObjectCreate } = Object;
11
+ const { isArray: ArrayIsArray$1 } = Array;
12
+ /**
13
+ * Validates an adapter config is well-formed.
14
+ * @param config The config to validate.
15
+ * @param adapter The adapter validation configuration.
16
+ * @param oneOf The keys the config must contain at least one of.
17
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
18
+ */
19
+ function validateConfig(config, adapter, oneOf) {
20
+ const { displayName } = adapter;
21
+ const { required, optional, unsupported } = adapter.parameters;
22
+ if (config === undefined ||
23
+ required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
24
+ throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
25
+ }
26
+ if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
27
+ throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
28
+ }
29
+ if (unsupported !== undefined &&
30
+ unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
31
+ throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
32
+ }
33
+ const supported = required.concat(optional);
34
+ if (ObjectKeys(config).some(key => !supported.includes(key))) {
35
+ throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
36
+ }
37
+ }
38
+ function untrustedIsObject(untrusted) {
39
+ return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
40
+ }
41
+ function areRequiredParametersPresent(config, configPropertyNames) {
42
+ return configPropertyNames.parameters.required.every(req => req in config);
43
+ }
44
+ const snapshotRefreshOptions = {
45
+ overrides: {
46
+ headers: {
47
+ 'Cache-Control': 'no-cache',
48
+ },
49
+ }
50
+ };
51
+ function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
52
+ return {
53
+ name,
54
+ required,
55
+ resourceType,
56
+ typeCheckShape,
57
+ isArrayShape,
58
+ coerceFn,
59
+ };
60
+ }
61
+ function buildAdapterValidationConfig(displayName, paramsMeta) {
62
+ const required = paramsMeta.filter(p => p.required).map(p => p.name);
63
+ const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
64
+ return {
65
+ displayName,
66
+ parameters: {
67
+ required,
68
+ optional,
69
+ }
70
+ };
71
+ }
72
+ const keyPrefix = 'analytics-insights';
73
+
74
+ const { isArray: ArrayIsArray } = Array;
75
+ const { stringify: JSONStringify } = JSON;
76
+ function equalsArray(a, b, equalsItem) {
77
+ const aLength = a.length;
78
+ const bLength = b.length;
79
+ if (aLength !== bLength) {
80
+ return false;
81
+ }
82
+ for (let i = 0; i < aLength; i++) {
83
+ if (equalsItem(a[i], b[i]) === false) {
84
+ return false;
85
+ }
86
+ }
87
+ return true;
88
+ }
89
+ function createLink(ref) {
90
+ return {
91
+ __ref: serializeStructuredKey(ref),
92
+ };
93
+ }
94
+
95
+ function validate$w(obj, path = 'MetricMetadata') {
96
+ const v_error = (() => {
97
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
98
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
99
+ }
100
+ if (obj.definitionId !== undefined) {
101
+ const obj_definitionId = obj.definitionId;
102
+ const path_definitionId = path + '.definitionId';
103
+ if (typeof obj_definitionId !== 'string') {
104
+ return new TypeError('Expected "string" but received "' + typeof obj_definitionId + '" (at "' + path_definitionId + '")');
105
+ }
106
+ }
107
+ if (obj.name !== undefined) {
108
+ const obj_name = obj.name;
109
+ const path_name = path + '.name';
110
+ if (typeof obj_name !== 'string') {
111
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
112
+ }
113
+ }
114
+ })();
115
+ return v_error === undefined ? null : v_error;
116
+ }
117
+
118
+ function validate$v(obj, path = 'ExtensionOptions') {
119
+ const v_error = (() => {
120
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
121
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
122
+ }
123
+ if (obj.analysisDimensions !== undefined) {
124
+ const obj_analysisDimensions = obj.analysisDimensions;
125
+ const path_analysisDimensions = path + '.analysisDimensions';
126
+ if (!ArrayIsArray(obj_analysisDimensions)) {
127
+ return new TypeError('Expected "array" but received "' + typeof obj_analysisDimensions + '" (at "' + path_analysisDimensions + '")');
128
+ }
129
+ for (let i = 0; i < obj_analysisDimensions.length; i++) {
130
+ const obj_analysisDimensions_item = obj_analysisDimensions[i];
131
+ const path_analysisDimensions_item = path_analysisDimensions + '[' + i + ']';
132
+ if (typeof obj_analysisDimensions_item !== 'string') {
133
+ return new TypeError('Expected "string" but received "' + typeof obj_analysisDimensions_item + '" (at "' + path_analysisDimensions_item + '")');
134
+ }
135
+ }
136
+ }
137
+ if (obj.minimumGranularity !== undefined) {
138
+ const obj_minimumGranularity = obj.minimumGranularity;
139
+ const path_minimumGranularity = path + '.minimumGranularity';
140
+ if (typeof obj_minimumGranularity !== 'string') {
141
+ return new TypeError('Expected "string" but received "' + typeof obj_minimumGranularity + '" (at "' + path_minimumGranularity + '")');
142
+ }
143
+ }
144
+ })();
145
+ return v_error === undefined ? null : v_error;
146
+ }
147
+
148
+ function validate$u(obj, path = 'InsightsOptions_InsightSetting') {
149
+ const v_error = (() => {
150
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
151
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
152
+ }
153
+ if (obj.disabled !== undefined) {
154
+ const obj_disabled = obj.disabled;
155
+ const path_disabled = path + '.disabled';
156
+ if (typeof obj_disabled !== 'boolean') {
157
+ return new TypeError('Expected "boolean" but received "' + typeof obj_disabled + '" (at "' + path_disabled + '")');
158
+ }
159
+ }
160
+ if (obj.type !== undefined) {
161
+ const obj_type = obj.type;
162
+ const path_type = path + '.type';
163
+ if (typeof obj_type !== 'string') {
164
+ return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
165
+ }
166
+ }
167
+ })();
168
+ return v_error === undefined ? null : v_error;
169
+ }
170
+
171
+ function validate$t(obj, path = 'InsightsOptions') {
172
+ const v_error = (() => {
173
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
174
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
175
+ }
176
+ if (obj.settings !== undefined) {
177
+ const obj_settings = obj.settings;
178
+ const path_settings = path + '.settings';
179
+ if (!ArrayIsArray(obj_settings)) {
180
+ return new TypeError('Expected "array" but received "' + typeof obj_settings + '" (at "' + path_settings + '")');
181
+ }
182
+ for (let i = 0; i < obj_settings.length; i++) {
183
+ const obj_settings_item = obj_settings[i];
184
+ const path_settings_item = path_settings + '[' + i + ']';
185
+ const referencepath_settings_itemValidationError = validate$u(obj_settings_item, path_settings_item);
186
+ if (referencepath_settings_itemValidationError !== null) {
187
+ let message = 'Object doesn\'t match InsightsOptions_InsightSetting (at "' + path_settings_item + '")\n';
188
+ message += referencepath_settings_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
189
+ return new TypeError(message);
190
+ }
191
+ }
192
+ }
193
+ })();
194
+ return v_error === undefined ? null : v_error;
195
+ }
196
+
197
+ function validate$s(obj, path = 'SemanticField') {
198
+ const v_error = (() => {
199
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
200
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
201
+ }
202
+ if (obj.name !== undefined) {
203
+ const obj_name = obj.name;
204
+ const path_name = path + '.name';
205
+ if (typeof obj_name !== 'string') {
206
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
207
+ }
208
+ }
209
+ })();
210
+ return v_error === undefined ? null : v_error;
211
+ }
212
+
213
+ function validate$r(obj, path = 'TableField') {
214
+ const v_error = (() => {
215
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
216
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
217
+ }
218
+ if (obj.name !== undefined) {
219
+ const obj_name = obj.name;
220
+ const path_name = path + '.name';
221
+ if (typeof obj_name !== 'string') {
222
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
223
+ }
224
+ }
225
+ if (obj.tableName !== undefined) {
226
+ const obj_tableName = obj.tableName;
227
+ const path_tableName = path + '.tableName';
228
+ if (typeof obj_tableName !== 'string') {
229
+ return new TypeError('Expected "string" but received "' + typeof obj_tableName + '" (at "' + path_tableName + '")');
230
+ }
231
+ }
232
+ })();
233
+ return v_error === undefined ? null : v_error;
234
+ }
235
+
236
+ function validate$q(obj, path = 'NullableValue') {
237
+ const v_error = (() => {
238
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
239
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
240
+ }
241
+ if (obj.boolean !== undefined) {
242
+ const obj_boolean = obj.boolean;
243
+ const path_boolean = path + '.boolean';
244
+ if (typeof obj_boolean !== 'boolean') {
245
+ return new TypeError('Expected "boolean" but received "' + typeof obj_boolean + '" (at "' + path_boolean + '")');
246
+ }
247
+ }
248
+ if (obj.date !== undefined) {
249
+ const obj_date = obj.date;
250
+ const path_date = path + '.date';
251
+ if (typeof obj_date !== 'string') {
252
+ return new TypeError('Expected "string" but received "' + typeof obj_date + '" (at "' + path_date + '")');
253
+ }
254
+ }
255
+ if (obj.nullValue !== undefined) {
256
+ const obj_nullValue = obj.nullValue;
257
+ const path_nullValue = path + '.nullValue';
258
+ if (typeof obj_nullValue !== 'string') {
259
+ return new TypeError('Expected "string" but received "' + typeof obj_nullValue + '" (at "' + path_nullValue + '")');
260
+ }
261
+ }
262
+ if (obj.number !== undefined) {
263
+ const obj_number = obj.number;
264
+ const path_number = path + '.number';
265
+ if (typeof obj_number !== 'number') {
266
+ return new TypeError('Expected "number" but received "' + typeof obj_number + '" (at "' + path_number + '")');
267
+ }
268
+ }
269
+ if (obj.string !== undefined) {
270
+ const obj_string = obj.string;
271
+ const path_string = path + '.string';
272
+ if (typeof obj_string !== 'string') {
273
+ return new TypeError('Expected "string" but received "' + typeof obj_string + '" (at "' + path_string + '")');
274
+ }
275
+ }
276
+ })();
277
+ return v_error === undefined ? null : v_error;
278
+ }
279
+
280
+ function validate$p(obj, path = 'Filter') {
281
+ const v_error = (() => {
282
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
283
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
284
+ }
285
+ if (obj.operator !== undefined) {
286
+ const obj_operator = obj.operator;
287
+ const path_operator = path + '.operator';
288
+ if (typeof obj_operator !== 'string') {
289
+ return new TypeError('Expected "string" but received "' + typeof obj_operator + '" (at "' + path_operator + '")');
290
+ }
291
+ }
292
+ const obj_semanticField = obj.semanticField;
293
+ const path_semanticField = path + '.semanticField';
294
+ const referencepath_semanticFieldValidationError = validate$s(obj_semanticField, path_semanticField);
295
+ if (referencepath_semanticFieldValidationError !== null) {
296
+ let message = 'Object doesn\'t match SemanticField (at "' + path_semanticField + '")\n';
297
+ message += referencepath_semanticFieldValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
298
+ return new TypeError(message);
299
+ }
300
+ const obj_tableField = obj.tableField;
301
+ const path_tableField = path + '.tableField';
302
+ const referencepath_tableFieldValidationError = validate$r(obj_tableField, path_tableField);
303
+ if (referencepath_tableFieldValidationError !== null) {
304
+ let message = 'Object doesn\'t match TableField (at "' + path_tableField + '")\n';
305
+ message += referencepath_tableFieldValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
306
+ return new TypeError(message);
307
+ }
308
+ if (obj.values !== undefined) {
309
+ const obj_values = obj.values;
310
+ const path_values = path + '.values';
311
+ if (!ArrayIsArray(obj_values)) {
312
+ return new TypeError('Expected "array" but received "' + typeof obj_values + '" (at "' + path_values + '")');
313
+ }
314
+ for (let i = 0; i < obj_values.length; i++) {
315
+ const obj_values_item = obj_values[i];
316
+ const path_values_item = path_values + '[' + i + ']';
317
+ const referencepath_values_itemValidationError = validate$q(obj_values_item, path_values_item);
318
+ if (referencepath_values_itemValidationError !== null) {
319
+ let message = 'Object doesn\'t match NullableValue (at "' + path_values_item + '")\n';
320
+ message += referencepath_values_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
321
+ return new TypeError(message);
322
+ }
323
+ }
324
+ }
325
+ })();
326
+ return v_error === undefined ? null : v_error;
327
+ }
328
+
329
+ function validate$o(obj, path = 'MeasurementPeriod') {
330
+ const v_error = (() => {
331
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
332
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
333
+ }
334
+ if (obj.end !== undefined) {
335
+ const obj_end = obj.end;
336
+ const path_end = path + '.end';
337
+ if (typeof obj_end !== 'string') {
338
+ return new TypeError('Expected "string" but received "' + typeof obj_end + '" (at "' + path_end + '")');
339
+ }
340
+ }
341
+ if (obj.granularity !== undefined) {
342
+ const obj_granularity = obj.granularity;
343
+ const path_granularity = path + '.granularity';
344
+ if (typeof obj_granularity !== 'string') {
345
+ return new TypeError('Expected "string" but received "' + typeof obj_granularity + '" (at "' + path_granularity + '")');
346
+ }
347
+ }
348
+ if (obj.range !== undefined) {
349
+ const obj_range = obj.range;
350
+ const path_range = path + '.range';
351
+ if (typeof obj_range !== 'string') {
352
+ return new TypeError('Expected "string" but received "' + typeof obj_range + '" (at "' + path_range + '")');
353
+ }
354
+ }
355
+ if (obj.start !== undefined) {
356
+ const obj_start = obj.start;
357
+ const path_start = path + '.start';
358
+ if (typeof obj_start !== 'string') {
359
+ return new TypeError('Expected "string" but received "' + typeof obj_start + '" (at "' + path_start + '")');
360
+ }
361
+ }
362
+ })();
363
+ return v_error === undefined ? null : v_error;
364
+ }
365
+
366
+ function validate$n(obj, path = 'MetricInstance') {
367
+ const v_error = (() => {
368
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
369
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
370
+ }
371
+ if (obj.filters !== undefined) {
372
+ const obj_filters = obj.filters;
373
+ const path_filters = path + '.filters';
374
+ if (!ArrayIsArray(obj_filters)) {
375
+ return new TypeError('Expected "array" but received "' + typeof obj_filters + '" (at "' + path_filters + '")');
376
+ }
377
+ for (let i = 0; i < obj_filters.length; i++) {
378
+ const obj_filters_item = obj_filters[i];
379
+ const path_filters_item = path_filters + '[' + i + ']';
380
+ const referencepath_filters_itemValidationError = validate$p(obj_filters_item, path_filters_item);
381
+ if (referencepath_filters_itemValidationError !== null) {
382
+ let message = 'Object doesn\'t match Filter (at "' + path_filters_item + '")\n';
383
+ message += referencepath_filters_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
384
+ return new TypeError(message);
385
+ }
386
+ }
387
+ }
388
+ const obj_measurementPeriod = obj.measurementPeriod;
389
+ const path_measurementPeriod = path + '.measurementPeriod';
390
+ const referencepath_measurementPeriodValidationError = validate$o(obj_measurementPeriod, path_measurementPeriod);
391
+ if (referencepath_measurementPeriodValidationError !== null) {
392
+ let message = 'Object doesn\'t match MeasurementPeriod (at "' + path_measurementPeriod + '")\n';
393
+ message += referencepath_measurementPeriodValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
394
+ return new TypeError(message);
395
+ }
396
+ })();
397
+ return v_error === undefined ? null : v_error;
398
+ }
399
+
400
+ function validate$m(obj, path = 'CompareConfig') {
401
+ const v_error = (() => {
402
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
403
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
404
+ }
405
+ if (obj.comparison !== undefined) {
406
+ const obj_comparison = obj.comparison;
407
+ const path_comparison = path + '.comparison';
408
+ if (typeof obj_comparison !== 'string') {
409
+ return new TypeError('Expected "string" but received "' + typeof obj_comparison + '" (at "' + path_comparison + '")');
410
+ }
411
+ }
412
+ })();
413
+ return v_error === undefined ? null : v_error;
414
+ }
415
+
416
+ function validate$l(obj, path = 'Measure') {
417
+ const v_error = (() => {
418
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
419
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
420
+ }
421
+ if (obj.aggregation !== undefined) {
422
+ const obj_aggregation = obj.aggregation;
423
+ const path_aggregation = path + '.aggregation';
424
+ if (typeof obj_aggregation !== 'string') {
425
+ return new TypeError('Expected "string" but received "' + typeof obj_aggregation + '" (at "' + path_aggregation + '")');
426
+ }
427
+ }
428
+ const obj_semanticField = obj.semanticField;
429
+ const path_semanticField = path + '.semanticField';
430
+ const referencepath_semanticFieldValidationError = validate$s(obj_semanticField, path_semanticField);
431
+ if (referencepath_semanticFieldValidationError !== null) {
432
+ let message = 'Object doesn\'t match SemanticField (at "' + path_semanticField + '")\n';
433
+ message += referencepath_semanticFieldValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
434
+ return new TypeError(message);
435
+ }
436
+ const obj_tableField = obj.tableField;
437
+ const path_tableField = path + '.tableField';
438
+ const referencepath_tableFieldValidationError = validate$r(obj_tableField, path_tableField);
439
+ if (referencepath_tableFieldValidationError !== null) {
440
+ let message = 'Object doesn\'t match TableField (at "' + path_tableField + '")\n';
441
+ message += referencepath_tableFieldValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
442
+ return new TypeError(message);
443
+ }
444
+ })();
445
+ return v_error === undefined ? null : v_error;
446
+ }
447
+
448
+ function validate$k(obj, path = 'SemanticDataModel') {
449
+ const v_error = (() => {
450
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
451
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
452
+ }
453
+ if (obj.apiName !== undefined) {
454
+ const obj_apiName = obj.apiName;
455
+ const path_apiName = path + '.apiName';
456
+ if (typeof obj_apiName !== 'string') {
457
+ return new TypeError('Expected "string" but received "' + typeof obj_apiName + '" (at "' + path_apiName + '")');
458
+ }
459
+ }
460
+ })();
461
+ return v_error === undefined ? null : v_error;
462
+ }
463
+
464
+ function validate$j(obj, path = 'TimeDimension') {
465
+ const v_error = (() => {
466
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
467
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
468
+ }
469
+ const obj_semanticField = obj.semanticField;
470
+ const path_semanticField = path + '.semanticField';
471
+ const referencepath_semanticFieldValidationError = validate$s(obj_semanticField, path_semanticField);
472
+ if (referencepath_semanticFieldValidationError !== null) {
473
+ let message = 'Object doesn\'t match SemanticField (at "' + path_semanticField + '")\n';
474
+ message += referencepath_semanticFieldValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
475
+ return new TypeError(message);
476
+ }
477
+ const obj_tableField = obj.tableField;
478
+ const path_tableField = path + '.tableField';
479
+ const referencepath_tableFieldValidationError = validate$r(obj_tableField, path_tableField);
480
+ if (referencepath_tableFieldValidationError !== null) {
481
+ let message = 'Object doesn\'t match TableField (at "' + path_tableField + '")\n';
482
+ message += referencepath_tableFieldValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
483
+ return new TypeError(message);
484
+ }
485
+ })();
486
+ return v_error === undefined ? null : v_error;
487
+ }
488
+
489
+ function validate$i(obj, path = 'MetricDefinition') {
490
+ const v_error = (() => {
491
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
492
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
493
+ }
494
+ const obj_comparison = obj.comparison;
495
+ const path_comparison = path + '.comparison';
496
+ const referencepath_comparisonValidationError = validate$m(obj_comparison, path_comparison);
497
+ if (referencepath_comparisonValidationError !== null) {
498
+ let message = 'Object doesn\'t match CompareConfig (at "' + path_comparison + '")\n';
499
+ message += referencepath_comparisonValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
500
+ return new TypeError(message);
501
+ }
502
+ if (obj.filters !== undefined) {
503
+ const obj_filters = obj.filters;
504
+ const path_filters = path + '.filters';
505
+ if (!ArrayIsArray(obj_filters)) {
506
+ return new TypeError('Expected "array" but received "' + typeof obj_filters + '" (at "' + path_filters + '")');
507
+ }
508
+ for (let i = 0; i < obj_filters.length; i++) {
509
+ const obj_filters_item = obj_filters[i];
510
+ const path_filters_item = path_filters + '[' + i + ']';
511
+ const referencepath_filters_itemValidationError = validate$p(obj_filters_item, path_filters_item);
512
+ if (referencepath_filters_itemValidationError !== null) {
513
+ let message = 'Object doesn\'t match Filter (at "' + path_filters_item + '")\n';
514
+ message += referencepath_filters_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
515
+ return new TypeError(message);
516
+ }
517
+ }
518
+ }
519
+ const obj_measure = obj.measure;
520
+ const path_measure = path + '.measure';
521
+ const referencepath_measureValidationError = validate$l(obj_measure, path_measure);
522
+ if (referencepath_measureValidationError !== null) {
523
+ let message = 'Object doesn\'t match Measure (at "' + path_measure + '")\n';
524
+ message += referencepath_measureValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
525
+ return new TypeError(message);
526
+ }
527
+ if (obj.runningTotal !== undefined) {
528
+ const obj_runningTotal = obj.runningTotal;
529
+ const path_runningTotal = path + '.runningTotal';
530
+ if (typeof obj_runningTotal !== 'boolean') {
531
+ return new TypeError('Expected "boolean" but received "' + typeof obj_runningTotal + '" (at "' + path_runningTotal + '")');
532
+ }
533
+ }
534
+ const obj_semanticDataModel = obj.semanticDataModel;
535
+ const path_semanticDataModel = path + '.semanticDataModel';
536
+ const referencepath_semanticDataModelValidationError = validate$k(obj_semanticDataModel, path_semanticDataModel);
537
+ if (referencepath_semanticDataModelValidationError !== null) {
538
+ let message = 'Object doesn\'t match SemanticDataModel (at "' + path_semanticDataModel + '")\n';
539
+ message += referencepath_semanticDataModelValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
540
+ return new TypeError(message);
541
+ }
542
+ const obj_timeDimension = obj.timeDimension;
543
+ const path_timeDimension = path + '.timeDimension';
544
+ const referencepath_timeDimensionValidationError = validate$j(obj_timeDimension, path_timeDimension);
545
+ if (referencepath_timeDimensionValidationError !== null) {
546
+ let message = 'Object doesn\'t match TimeDimension (at "' + path_timeDimension + '")\n';
547
+ message += referencepath_timeDimensionValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
548
+ return new TypeError(message);
549
+ }
550
+ })();
551
+ return v_error === undefined ? null : v_error;
552
+ }
553
+
554
+ function validate$h(obj, path = 'RepresentationOptions_NumberUnits') {
555
+ const v_error = (() => {
556
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
557
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
558
+ }
559
+ if (obj.pluralNoun !== undefined) {
560
+ const obj_pluralNoun = obj.pluralNoun;
561
+ const path_pluralNoun = path + '.pluralNoun';
562
+ if (typeof obj_pluralNoun !== 'string') {
563
+ return new TypeError('Expected "string" but received "' + typeof obj_pluralNoun + '" (at "' + path_pluralNoun + '")');
564
+ }
565
+ }
566
+ if (obj.singularNoun !== undefined) {
567
+ const obj_singularNoun = obj.singularNoun;
568
+ const path_singularNoun = path + '.singularNoun';
569
+ if (typeof obj_singularNoun !== 'string') {
570
+ return new TypeError('Expected "string" but received "' + typeof obj_singularNoun + '" (at "' + path_singularNoun + '")');
571
+ }
572
+ }
573
+ })();
574
+ return v_error === undefined ? null : v_error;
575
+ }
576
+
577
+ function validate$g(obj, path = 'RepresentationOptions') {
578
+ const v_error = (() => {
579
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
580
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
581
+ }
582
+ const obj_numberUnits = obj.numberUnits;
583
+ const path_numberUnits = path + '.numberUnits';
584
+ const referencepath_numberUnitsValidationError = validate$h(obj_numberUnits, path_numberUnits);
585
+ if (referencepath_numberUnitsValidationError !== null) {
586
+ let message = 'Object doesn\'t match RepresentationOptions_NumberUnits (at "' + path_numberUnits + '")\n';
587
+ message += referencepath_numberUnitsValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
588
+ return new TypeError(message);
589
+ }
590
+ if (obj.sentimentType !== undefined) {
591
+ const obj_sentimentType = obj.sentimentType;
592
+ const path_sentimentType = path + '.sentimentType';
593
+ if (typeof obj_sentimentType !== 'string') {
594
+ return new TypeError('Expected "string" but received "' + typeof obj_sentimentType + '" (at "' + path_sentimentType + '")');
595
+ }
596
+ }
597
+ if (obj.type !== undefined) {
598
+ const obj_type = obj.type;
599
+ const path_type = path + '.type';
600
+ if (typeof obj_type !== 'string') {
601
+ return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
602
+ }
603
+ }
604
+ })();
605
+ return v_error === undefined ? null : v_error;
606
+ }
607
+
608
+ function validate$f(obj, path = 'InputMetric') {
609
+ const v_error = (() => {
610
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
611
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
612
+ }
613
+ const obj_extensionOptions = obj.extensionOptions;
614
+ const path_extensionOptions = path + '.extensionOptions';
615
+ const referencepath_extensionOptionsValidationError = validate$v(obj_extensionOptions, path_extensionOptions);
616
+ if (referencepath_extensionOptionsValidationError !== null) {
617
+ let message = 'Object doesn\'t match ExtensionOptions (at "' + path_extensionOptions + '")\n';
618
+ message += referencepath_extensionOptionsValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
619
+ return new TypeError(message);
620
+ }
621
+ const obj_insightsOptions = obj.insightsOptions;
622
+ const path_insightsOptions = path + '.insightsOptions';
623
+ const referencepath_insightsOptionsValidationError = validate$t(obj_insightsOptions, path_insightsOptions);
624
+ if (referencepath_insightsOptionsValidationError !== null) {
625
+ let message = 'Object doesn\'t match InsightsOptions (at "' + path_insightsOptions + '")\n';
626
+ message += referencepath_insightsOptionsValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
627
+ return new TypeError(message);
628
+ }
629
+ const obj_instance = obj.instance;
630
+ const path_instance = path + '.instance';
631
+ const referencepath_instanceValidationError = validate$n(obj_instance, path_instance);
632
+ if (referencepath_instanceValidationError !== null) {
633
+ let message = 'Object doesn\'t match MetricInstance (at "' + path_instance + '")\n';
634
+ message += referencepath_instanceValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
635
+ return new TypeError(message);
636
+ }
637
+ const obj_metric = obj.metric;
638
+ const path_metric = path + '.metric';
639
+ const referencepath_metricValidationError = validate$i(obj_metric, path_metric);
640
+ if (referencepath_metricValidationError !== null) {
641
+ let message = 'Object doesn\'t match MetricDefinition (at "' + path_metric + '")\n';
642
+ message += referencepath_metricValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
643
+ return new TypeError(message);
644
+ }
645
+ const obj_representationOptions = obj.representationOptions;
646
+ const path_representationOptions = path + '.representationOptions';
647
+ const referencepath_representationOptionsValidationError = validate$g(obj_representationOptions, path_representationOptions);
648
+ if (referencepath_representationOptionsValidationError !== null) {
649
+ let message = 'Object doesn\'t match RepresentationOptions (at "' + path_representationOptions + '")\n';
650
+ message += referencepath_representationOptionsValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
651
+ return new TypeError(message);
652
+ }
653
+ })();
654
+ return v_error === undefined ? null : v_error;
655
+ }
656
+
657
+ function validate$e(obj, path = 'InsightBundleInput') {
658
+ const v_error = (() => {
659
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
660
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
661
+ }
662
+ const obj_metadata = obj.metadata;
663
+ const path_metadata = path + '.metadata';
664
+ const referencepath_metadataValidationError = validate$w(obj_metadata, path_metadata);
665
+ if (referencepath_metadataValidationError !== null) {
666
+ let message = 'Object doesn\'t match MetricMetadata (at "' + path_metadata + '")\n';
667
+ message += referencepath_metadataValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
668
+ return new TypeError(message);
669
+ }
670
+ const obj_metric = obj.metric;
671
+ const path_metric = path + '.metric';
672
+ const referencepath_metricValidationError = validate$f(obj_metric, path_metric);
673
+ if (referencepath_metricValidationError !== null) {
674
+ let message = 'Object doesn\'t match InputMetric (at "' + path_metric + '")\n';
675
+ message += referencepath_metricValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
676
+ return new TypeError(message);
677
+ }
678
+ })();
679
+ return v_error === undefined ? null : v_error;
680
+ }
681
+
682
+ function validate$d(obj, path = 'BatchInput') {
683
+ const v_error = (() => {
684
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
685
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
686
+ }
687
+ if (obj.bundleInput !== undefined) {
688
+ const obj_bundleInput = obj.bundleInput;
689
+ const path_bundleInput = path + '.bundleInput';
690
+ const referencepath_bundleInputValidationError = validate$e(obj_bundleInput, path_bundleInput);
691
+ if (referencepath_bundleInputValidationError !== null) {
692
+ let message = 'Object doesn\'t match InsightBundleInput (at "' + path_bundleInput + '")\n';
693
+ message += referencepath_bundleInputValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
694
+ return new TypeError(message);
695
+ }
696
+ }
697
+ if (obj.metricInstanceId !== undefined) {
698
+ const obj_metricInstanceId = obj.metricInstanceId;
699
+ const path_metricInstanceId = path + '.metricInstanceId';
700
+ if (typeof obj_metricInstanceId !== 'string') {
701
+ return new TypeError('Expected "string" but received "' + typeof obj_metricInstanceId + '" (at "' + path_metricInstanceId + '")');
702
+ }
703
+ }
704
+ })();
705
+ return v_error === undefined ? null : v_error;
706
+ }
707
+
708
+ const VERSION$c = "a8b8e8e21e2dc1b5b067efa90209dce3";
709
+ function validate$c(obj, path = 'GenerateInsightBatchResponse') {
710
+ const v_error = (() => {
711
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
712
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
713
+ }
714
+ const obj_batchId = obj.batchId;
715
+ const path_batchId = path + '.batchId';
716
+ if (typeof obj_batchId !== 'string') {
717
+ return new TypeError('Expected "string" but received "' + typeof obj_batchId + '" (at "' + path_batchId + '")');
718
+ }
719
+ if (obj.generatingSummary !== undefined) {
720
+ const obj_generatingSummary = obj.generatingSummary;
721
+ const path_generatingSummary = path + '.generatingSummary';
722
+ if (typeof obj_generatingSummary !== 'boolean') {
723
+ return new TypeError('Expected "boolean" but received "' + typeof obj_generatingSummary + '" (at "' + path_generatingSummary + '")');
724
+ }
725
+ }
726
+ if (obj.summary !== undefined) {
727
+ const obj_summary = obj.summary;
728
+ const path_summary = path + '.summary';
729
+ if (obj_summary === undefined) {
730
+ return new TypeError('Expected "defined" but received "' + typeof obj_summary + '" (at "' + path_summary + '")');
731
+ }
732
+ }
733
+ if (obj.timestamp !== undefined) {
734
+ const obj_timestamp = obj.timestamp;
735
+ const path_timestamp = path + '.timestamp';
736
+ if (typeof obj_timestamp !== 'string') {
737
+ return new TypeError('Expected "string" but received "' + typeof obj_timestamp + '" (at "' + path_timestamp + '")');
738
+ }
739
+ }
740
+ })();
741
+ return v_error === undefined ? null : v_error;
742
+ }
743
+ const RepresentationType$3 = 'GenerateInsightBatchResponse';
744
+ function keyBuilder$5(luvio, config) {
745
+ return keyPrefix + '::' + RepresentationType$3 + ':' + config.batchid;
746
+ }
747
+ function keyBuilderFromType$3(luvio, object) {
748
+ const keyParams = {
749
+ batchid: object.batchId
750
+ };
751
+ return keyBuilder$5(luvio, keyParams);
752
+ }
753
+ function normalize$3(input, existing, path, luvio, store, timestamp) {
754
+ return input;
755
+ }
756
+ const select$g = function GenerateInsightBatchResponseSelect() {
757
+ return {
758
+ kind: 'Fragment',
759
+ version: VERSION$c,
760
+ private: [],
761
+ selections: [
762
+ {
763
+ name: 'batchId',
764
+ kind: 'Scalar'
765
+ },
766
+ {
767
+ name: 'generatingSummary',
768
+ kind: 'Scalar',
769
+ required: false
770
+ },
771
+ {
772
+ name: 'summary',
773
+ kind: 'Object',
774
+ // any
775
+ },
776
+ {
777
+ name: 'timestamp',
778
+ kind: 'Scalar',
779
+ required: false
780
+ }
781
+ ]
782
+ };
783
+ };
784
+ function equals$c(existing, incoming) {
785
+ const existing_generatingSummary = existing.generatingSummary;
786
+ const incoming_generatingSummary = incoming.generatingSummary;
787
+ // if at least one of these optionals is defined
788
+ if (existing_generatingSummary !== undefined || incoming_generatingSummary !== undefined) {
789
+ // if one of these is not defined we know the other is defined and therefore
790
+ // not equal
791
+ if (existing_generatingSummary === undefined || incoming_generatingSummary === undefined) {
792
+ return false;
793
+ }
794
+ if (!(existing_generatingSummary === incoming_generatingSummary)) {
795
+ return false;
796
+ }
797
+ }
798
+ const existing_batchId = existing.batchId;
799
+ const incoming_batchId = incoming.batchId;
800
+ if (!(existing_batchId === incoming_batchId)) {
801
+ return false;
802
+ }
803
+ const existing_timestamp = existing.timestamp;
804
+ const incoming_timestamp = incoming.timestamp;
805
+ // if at least one of these optionals is defined
806
+ if (existing_timestamp !== undefined || incoming_timestamp !== undefined) {
807
+ // if one of these is not defined we know the other is defined and therefore
808
+ // not equal
809
+ if (existing_timestamp === undefined || incoming_timestamp === undefined) {
810
+ return false;
811
+ }
812
+ if (!(existing_timestamp === incoming_timestamp)) {
813
+ return false;
814
+ }
815
+ }
816
+ const existing_summary = existing.summary;
817
+ const incoming_summary = incoming.summary;
818
+ // if at least one of these optionals is defined
819
+ if (existing_summary !== undefined || incoming_summary !== undefined) {
820
+ // if one of these is not defined we know the other is defined and therefore
821
+ // not equal
822
+ if (existing_summary === undefined || incoming_summary === undefined) {
823
+ return false;
824
+ }
825
+ if (JSONStringify(incoming_summary) !== JSONStringify(existing_summary)) {
826
+ return false;
827
+ }
828
+ }
829
+ return true;
830
+ }
831
+ const ingest$3 = function GenerateInsightBatchResponseIngest(input, path, luvio, store, timestamp) {
832
+ if (process.env.NODE_ENV !== 'production') {
833
+ const validateError = validate$c(input);
834
+ if (validateError !== null) {
835
+ throw validateError;
836
+ }
837
+ }
838
+ const key = keyBuilderFromType$3(luvio, input);
839
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 300000;
840
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$3, "analytics-insights", VERSION$c, RepresentationType$3, equals$c);
841
+ return createLink(key);
842
+ };
843
+ function getTypeCacheKeys$3(rootKeySet, luvio, input, fullPathFactory) {
844
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
845
+ const rootKey = keyBuilderFromType$3(luvio, input);
846
+ rootKeySet.set(rootKey, {
847
+ namespace: keyPrefix,
848
+ representationName: RepresentationType$3,
849
+ mergeable: false
850
+ });
851
+ }
852
+
853
+ function select$f(luvio, params) {
854
+ return select$g();
855
+ }
856
+ function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
857
+ getTypeCacheKeys$3(storeKeyMap, luvio, response);
858
+ }
859
+ function ingestSuccess$3(luvio, resourceParams, response) {
860
+ const { body } = response;
861
+ const key = keyBuilderFromType$3(luvio, body);
862
+ luvio.storeIngest(key, ingest$3, body);
863
+ const snapshot = luvio.storeLookup({
864
+ recordId: key,
865
+ node: select$f(),
866
+ variables: {},
867
+ });
868
+ if (process.env.NODE_ENV !== 'production') {
869
+ if (snapshot.state !== 'Fulfilled') {
870
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
871
+ }
872
+ }
873
+ deepFreeze(snapshot.data);
874
+ return snapshot;
875
+ }
876
+ function createResourceRequest$3(config) {
877
+ const headers = {};
878
+ return {
879
+ baseUri: 'https://api.salesforce.com/analytics/insights/{version}',
880
+ basePath: '/batches',
881
+ method: 'post',
882
+ body: config.body,
883
+ urlParams: {},
884
+ queryParams: {},
885
+ headers,
886
+ priority: 'normal',
887
+ };
888
+ }
889
+
890
+ const adapterName$3 = 'createInsightsBatch';
891
+ const createInsightsBatch_ConfigPropertyMetadata = [
892
+ generateParamConfigMetadata('batchInput', false, 2 /* Body */, 4 /* Unsupported */, true),
893
+ generateParamConfigMetadata('options', false, 2 /* Body */, 4 /* Unsupported */),
894
+ ];
895
+ const createInsightsBatch_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, createInsightsBatch_ConfigPropertyMetadata);
896
+ const createResourceParams$3 = /*#__PURE__*/ createResourceParams$4(createInsightsBatch_ConfigPropertyMetadata);
897
+ function typeCheckConfig$3(untrustedConfig) {
898
+ const config = {};
899
+ const untrustedConfig_batchInput = untrustedConfig.batchInput;
900
+ if (ArrayIsArray$1(untrustedConfig_batchInput)) {
901
+ const untrustedConfig_batchInput_array = [];
902
+ for (let i = 0, arrayLength = untrustedConfig_batchInput.length; i < arrayLength; i++) {
903
+ const untrustedConfig_batchInput_item = untrustedConfig_batchInput[i];
904
+ const referenceBatchInputValidationError = validate$d(untrustedConfig_batchInput_item);
905
+ if (referenceBatchInputValidationError === null) {
906
+ untrustedConfig_batchInput_array.push(untrustedConfig_batchInput_item);
907
+ }
908
+ }
909
+ config.batchInput = untrustedConfig_batchInput_array;
910
+ }
911
+ const untrustedConfig_options = untrustedConfig.options;
912
+ config.options = untrustedConfig_options;
913
+ return config;
914
+ }
915
+ function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
916
+ if (!untrustedIsObject(untrustedConfig)) {
917
+ return null;
918
+ }
919
+ if (process.env.NODE_ENV !== 'production') {
920
+ validateConfig(untrustedConfig, configPropertyNames);
921
+ }
922
+ const config = typeCheckConfig$3(untrustedConfig);
923
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
924
+ return null;
925
+ }
926
+ return config;
927
+ }
928
+ function buildNetworkSnapshot$3(luvio, config, options) {
929
+ const resourceParams = createResourceParams$3(config);
930
+ const request = createResourceRequest$3(resourceParams);
931
+ return luvio.dispatchResourceRequest(request, options)
932
+ .then((response) => {
933
+ return luvio.handleSuccessResponse(() => {
934
+ const snapshot = ingestSuccess$3(luvio, resourceParams, response);
935
+ return luvio.storeBroadcast().then(() => snapshot);
936
+ }, () => {
937
+ const cache = new StoreKeyMap();
938
+ getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
939
+ return cache;
940
+ });
941
+ }, (response) => {
942
+ deepFreeze(response);
943
+ throw response;
944
+ });
945
+ }
946
+ const createInsightsBatchAdapterFactory = (luvio) => {
947
+ return function createInsightsBatch(untrustedConfig) {
948
+ const config = validateAdapterConfig$3(untrustedConfig, createInsightsBatch_ConfigPropertyNames);
949
+ // Invalid or incomplete config
950
+ if (config === null) {
951
+ throw new Error('Invalid config for "createInsightsBatch"');
952
+ }
953
+ return buildNetworkSnapshot$3(luvio, config);
954
+ };
955
+ };
956
+
957
+ const VERSION$b = "f898ff84f82ad0ca1eca0045e17ce492";
958
+ function validate$b(obj, path = 'GetFilterValuesResponse_CategoricalValues') {
959
+ const v_error = (() => {
960
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
961
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
962
+ }
963
+ if (obj.values !== undefined) {
964
+ const obj_values = obj.values;
965
+ const path_values = path + '.values';
966
+ if (!ArrayIsArray(obj_values)) {
967
+ return new TypeError('Expected "array" but received "' + typeof obj_values + '" (at "' + path_values + '")');
968
+ }
969
+ for (let i = 0; i < obj_values.length; i++) {
970
+ const obj_values_item = obj_values[i];
971
+ const path_values_item = path_values + '[' + i + ']';
972
+ let obj_values_item_union0 = null;
973
+ const obj_values_item_union0_error = (() => {
974
+ if (typeof obj_values_item !== 'string') {
975
+ return new TypeError('Expected "string" but received "' + typeof obj_values_item + '" (at "' + path_values_item + '")');
976
+ }
977
+ })();
978
+ if (obj_values_item_union0_error != null) {
979
+ obj_values_item_union0 = obj_values_item_union0_error.message;
980
+ }
981
+ let obj_values_item_union1 = null;
982
+ const obj_values_item_union1_error = (() => {
983
+ if (typeof obj_values_item !== 'number') {
984
+ return new TypeError('Expected "number" but received "' + typeof obj_values_item + '" (at "' + path_values_item + '")');
985
+ }
986
+ })();
987
+ if (obj_values_item_union1_error != null) {
988
+ obj_values_item_union1 = obj_values_item_union1_error.message;
989
+ }
990
+ let obj_values_item_union2 = null;
991
+ const obj_values_item_union2_error = (() => {
992
+ if (typeof obj_values_item !== 'boolean') {
993
+ return new TypeError('Expected "boolean" but received "' + typeof obj_values_item + '" (at "' + path_values_item + '")');
994
+ }
995
+ })();
996
+ if (obj_values_item_union2_error != null) {
997
+ obj_values_item_union2 = obj_values_item_union2_error.message;
998
+ }
999
+ let obj_values_item_union3 = null;
1000
+ const obj_values_item_union3_error = (() => {
1001
+ if (obj_values_item !== null) {
1002
+ return new TypeError('Expected "null" but received "' + typeof obj_values_item + '" (at "' + path_values_item + '")');
1003
+ }
1004
+ })();
1005
+ if (obj_values_item_union3_error != null) {
1006
+ obj_values_item_union3 = obj_values_item_union3_error.message;
1007
+ }
1008
+ if (obj_values_item_union0 && obj_values_item_union1 && obj_values_item_union2 && obj_values_item_union3) {
1009
+ let message = 'Object doesn\'t match union (at "' + path_values_item + '")';
1010
+ message += '\n' + obj_values_item_union0.split('\n').map((line) => '\t' + line).join('\n');
1011
+ message += '\n' + obj_values_item_union1.split('\n').map((line) => '\t' + line).join('\n');
1012
+ message += '\n' + obj_values_item_union2.split('\n').map((line) => '\t' + line).join('\n');
1013
+ message += '\n' + obj_values_item_union3.split('\n').map((line) => '\t' + line).join('\n');
1014
+ return new TypeError(message);
1015
+ }
1016
+ }
1017
+ }
1018
+ })();
1019
+ return v_error === undefined ? null : v_error;
1020
+ }
1021
+ const select$e = function GetFilterValuesResponse_CategoricalValuesSelect() {
1022
+ return {
1023
+ kind: 'Fragment',
1024
+ version: VERSION$b,
1025
+ private: [],
1026
+ selections: [
1027
+ {
1028
+ name: 'values',
1029
+ kind: 'Scalar',
1030
+ plural: true,
1031
+ required: false
1032
+ }
1033
+ ]
1034
+ };
1035
+ };
1036
+ function equals$b(existing, incoming) {
1037
+ const existing_values = existing.values;
1038
+ const incoming_values = incoming.values;
1039
+ // if at least one of these optionals is defined
1040
+ if (existing_values !== undefined || incoming_values !== undefined) {
1041
+ // if one of these is not defined we know the other is defined and therefore
1042
+ // not equal
1043
+ if (existing_values === undefined || incoming_values === undefined) {
1044
+ return false;
1045
+ }
1046
+ const equals_values_items = equalsArray(existing_values, incoming_values, (existing_values_item, incoming_values_item) => {
1047
+ if (!(existing_values_item === incoming_values_item)) {
1048
+ return false;
1049
+ }
1050
+ });
1051
+ if (equals_values_items === false) {
1052
+ return false;
1053
+ }
1054
+ }
1055
+ return true;
1056
+ }
1057
+
1058
+ const VERSION$a = "2025bbf393050a10fae76d5b4d5d0f58";
1059
+ function validate$a(obj, path = 'GetFilterValuesResponse') {
1060
+ const v_error = (() => {
1061
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1062
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1063
+ }
1064
+ const obj_categoricalValues = obj.categoricalValues;
1065
+ const path_categoricalValues = path + '.categoricalValues';
1066
+ const referencepath_categoricalValuesValidationError = validate$b(obj_categoricalValues, path_categoricalValues);
1067
+ if (referencepath_categoricalValuesValidationError !== null) {
1068
+ let message = 'Object doesn\'t match GetFilterValuesResponse_CategoricalValues (at "' + path_categoricalValues + '")\n';
1069
+ message += referencepath_categoricalValuesValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1070
+ return new TypeError(message);
1071
+ }
1072
+ const obj_id = obj.id;
1073
+ const path_id = path + '.id';
1074
+ if (typeof obj_id !== 'string') {
1075
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
1076
+ }
1077
+ if (obj.nextPageToken !== undefined) {
1078
+ const obj_nextPageToken = obj.nextPageToken;
1079
+ const path_nextPageToken = path + '.nextPageToken';
1080
+ if (typeof obj_nextPageToken !== 'string') {
1081
+ return new TypeError('Expected "string" but received "' + typeof obj_nextPageToken + '" (at "' + path_nextPageToken + '")');
1082
+ }
1083
+ }
1084
+ if (obj.totalAvailable !== undefined) {
1085
+ const obj_totalAvailable = obj.totalAvailable;
1086
+ const path_totalAvailable = path + '.totalAvailable';
1087
+ if (typeof obj_totalAvailable !== 'number' || (typeof obj_totalAvailable === 'number' && Math.floor(obj_totalAvailable) !== obj_totalAvailable)) {
1088
+ return new TypeError('Expected "integer" but received "' + typeof obj_totalAvailable + '" (at "' + path_totalAvailable + '")');
1089
+ }
1090
+ }
1091
+ })();
1092
+ return v_error === undefined ? null : v_error;
1093
+ }
1094
+ const RepresentationType$2 = 'GetFilterValuesResponse';
1095
+ function keyBuilder$4(luvio, config) {
1096
+ return keyPrefix + '::' + RepresentationType$2 + ':' + config.filterpageid;
1097
+ }
1098
+ function keyBuilderFromType$2(luvio, object) {
1099
+ const keyParams = {
1100
+ filterpageid: object.id
1101
+ };
1102
+ return keyBuilder$4(luvio, keyParams);
1103
+ }
1104
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
1105
+ return input;
1106
+ }
1107
+ const select$d = function GetFilterValuesResponseSelect() {
1108
+ const { selections: GetFilterValuesResponse_CategoricalValues__selections, opaque: GetFilterValuesResponse_CategoricalValues__opaque, } = select$e();
1109
+ return {
1110
+ kind: 'Fragment',
1111
+ version: VERSION$a,
1112
+ private: [],
1113
+ selections: [
1114
+ {
1115
+ name: 'categoricalValues',
1116
+ kind: 'Object',
1117
+ selections: GetFilterValuesResponse_CategoricalValues__selections
1118
+ },
1119
+ {
1120
+ name: 'id',
1121
+ kind: 'Scalar'
1122
+ },
1123
+ {
1124
+ name: 'nextPageToken',
1125
+ kind: 'Scalar',
1126
+ required: false
1127
+ },
1128
+ {
1129
+ name: 'totalAvailable',
1130
+ kind: 'Scalar',
1131
+ required: false
1132
+ }
1133
+ ]
1134
+ };
1135
+ };
1136
+ function equals$a(existing, incoming) {
1137
+ const existing_totalAvailable = existing.totalAvailable;
1138
+ const incoming_totalAvailable = incoming.totalAvailable;
1139
+ // if at least one of these optionals is defined
1140
+ if (existing_totalAvailable !== undefined || incoming_totalAvailable !== undefined) {
1141
+ // if one of these is not defined we know the other is defined and therefore
1142
+ // not equal
1143
+ if (existing_totalAvailable === undefined || incoming_totalAvailable === undefined) {
1144
+ return false;
1145
+ }
1146
+ if (!(existing_totalAvailable === incoming_totalAvailable)) {
1147
+ return false;
1148
+ }
1149
+ }
1150
+ const existing_id = existing.id;
1151
+ const incoming_id = incoming.id;
1152
+ if (!(existing_id === incoming_id)) {
1153
+ return false;
1154
+ }
1155
+ const existing_nextPageToken = existing.nextPageToken;
1156
+ const incoming_nextPageToken = incoming.nextPageToken;
1157
+ // if at least one of these optionals is defined
1158
+ if (existing_nextPageToken !== undefined || incoming_nextPageToken !== undefined) {
1159
+ // if one of these is not defined we know the other is defined and therefore
1160
+ // not equal
1161
+ if (existing_nextPageToken === undefined || incoming_nextPageToken === undefined) {
1162
+ return false;
1163
+ }
1164
+ if (!(existing_nextPageToken === incoming_nextPageToken)) {
1165
+ return false;
1166
+ }
1167
+ }
1168
+ const existing_categoricalValues = existing.categoricalValues;
1169
+ const incoming_categoricalValues = incoming.categoricalValues;
1170
+ if (!(equals$b(existing_categoricalValues, incoming_categoricalValues))) {
1171
+ return false;
1172
+ }
1173
+ return true;
1174
+ }
1175
+ const ingest$2 = function GetFilterValuesResponseIngest(input, path, luvio, store, timestamp) {
1176
+ if (process.env.NODE_ENV !== 'production') {
1177
+ const validateError = validate$a(input);
1178
+ if (validateError !== null) {
1179
+ throw validateError;
1180
+ }
1181
+ }
1182
+ const key = keyBuilderFromType$2(luvio, input);
1183
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 300000;
1184
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "analytics-insights", VERSION$a, RepresentationType$2, equals$a);
1185
+ return createLink(key);
1186
+ };
1187
+ function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
1188
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
1189
+ const rootKey = keyBuilderFromType$2(luvio, input);
1190
+ rootKeySet.set(rootKey, {
1191
+ namespace: keyPrefix,
1192
+ representationName: RepresentationType$2,
1193
+ mergeable: false
1194
+ });
1195
+ }
1196
+
1197
+ function select$c(luvio, params) {
1198
+ return select$d();
1199
+ }
1200
+ function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
1201
+ getTypeCacheKeys$2(storeKeyMap, luvio, response);
1202
+ }
1203
+ function ingestSuccess$2(luvio, resourceParams, response) {
1204
+ const { body } = response;
1205
+ const key = keyBuilderFromType$2(luvio, body);
1206
+ luvio.storeIngest(key, ingest$2, body);
1207
+ const snapshot = luvio.storeLookup({
1208
+ recordId: key,
1209
+ node: select$c(),
1210
+ variables: {},
1211
+ });
1212
+ if (process.env.NODE_ENV !== 'production') {
1213
+ if (snapshot.state !== 'Fulfilled') {
1214
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1215
+ }
1216
+ }
1217
+ deepFreeze(snapshot.data);
1218
+ return snapshot;
1219
+ }
1220
+ function createResourceRequest$2(config) {
1221
+ const headers = {};
1222
+ return {
1223
+ baseUri: 'https://api.salesforce.com/analytics/insights/{version}',
1224
+ basePath: '/filterValues',
1225
+ method: 'post',
1226
+ body: config.body,
1227
+ urlParams: {},
1228
+ queryParams: {},
1229
+ headers,
1230
+ priority: 'normal',
1231
+ };
1232
+ }
1233
+
1234
+ const adapterName$2 = 'getMetricFilterValues';
1235
+ const getMetricFilterValues_ConfigPropertyMetadata = [
1236
+ generateParamConfigMetadata('semanticDataModel', true, 2 /* Body */, 4 /* Unsupported */),
1237
+ generateParamConfigMetadata('tableField', false, 2 /* Body */, 4 /* Unsupported */),
1238
+ generateParamConfigMetadata('semanticField', false, 2 /* Body */, 4 /* Unsupported */),
1239
+ generateParamConfigMetadata('pageToken', false, 2 /* Body */, 0 /* String */),
1240
+ generateParamConfigMetadata('pageSize', false, 2 /* Body */, 3 /* Integer */),
1241
+ generateParamConfigMetadata('searchTerm', false, 2 /* Body */, 0 /* String */),
1242
+ generateParamConfigMetadata('filters', false, 2 /* Body */, 4 /* Unsupported */, true),
1243
+ ];
1244
+ const getMetricFilterValues_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getMetricFilterValues_ConfigPropertyMetadata);
1245
+ const createResourceParams$2 = /*#__PURE__*/ createResourceParams$4(getMetricFilterValues_ConfigPropertyMetadata);
1246
+ function typeCheckConfig$2(untrustedConfig) {
1247
+ const config = {};
1248
+ typeCheckConfig$4(untrustedConfig, config, getMetricFilterValues_ConfigPropertyMetadata);
1249
+ const untrustedConfig_semanticDataModel = untrustedConfig.semanticDataModel;
1250
+ const referenceSemanticDataModelValidationError = validate$k(untrustedConfig_semanticDataModel);
1251
+ if (referenceSemanticDataModelValidationError === null) {
1252
+ config.semanticDataModel = untrustedConfig_semanticDataModel;
1253
+ }
1254
+ const untrustedConfig_tableField = untrustedConfig.tableField;
1255
+ const referenceTableFieldValidationError = validate$r(untrustedConfig_tableField);
1256
+ if (referenceTableFieldValidationError === null) {
1257
+ config.tableField = untrustedConfig_tableField;
1258
+ }
1259
+ const untrustedConfig_semanticField = untrustedConfig.semanticField;
1260
+ const referenceSemanticFieldValidationError = validate$s(untrustedConfig_semanticField);
1261
+ if (referenceSemanticFieldValidationError === null) {
1262
+ config.semanticField = untrustedConfig_semanticField;
1263
+ }
1264
+ const untrustedConfig_filters = untrustedConfig.filters;
1265
+ if (ArrayIsArray$1(untrustedConfig_filters)) {
1266
+ const untrustedConfig_filters_array = [];
1267
+ for (let i = 0, arrayLength = untrustedConfig_filters.length; i < arrayLength; i++) {
1268
+ const untrustedConfig_filters_item = untrustedConfig_filters[i];
1269
+ const referenceFilterValidationError = validate$p(untrustedConfig_filters_item);
1270
+ if (referenceFilterValidationError === null) {
1271
+ untrustedConfig_filters_array.push(untrustedConfig_filters_item);
1272
+ }
1273
+ }
1274
+ config.filters = untrustedConfig_filters_array;
1275
+ }
1276
+ return config;
1277
+ }
1278
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
1279
+ if (!untrustedIsObject(untrustedConfig)) {
1280
+ return null;
1281
+ }
1282
+ if (process.env.NODE_ENV !== 'production') {
1283
+ validateConfig(untrustedConfig, configPropertyNames);
1284
+ }
1285
+ const config = typeCheckConfig$2(untrustedConfig);
1286
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1287
+ return null;
1288
+ }
1289
+ return config;
1290
+ }
1291
+ function buildNetworkSnapshot$2(luvio, config, options) {
1292
+ const resourceParams = createResourceParams$2(config);
1293
+ const request = createResourceRequest$2(resourceParams);
1294
+ return luvio.dispatchResourceRequest(request, options)
1295
+ .then((response) => {
1296
+ return luvio.handleSuccessResponse(() => {
1297
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response);
1298
+ return luvio.storeBroadcast().then(() => snapshot);
1299
+ }, () => {
1300
+ const cache = new StoreKeyMap();
1301
+ getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
1302
+ return cache;
1303
+ });
1304
+ }, (response) => {
1305
+ deepFreeze(response);
1306
+ throw response;
1307
+ });
1308
+ }
1309
+ const getMetricFilterValuesAdapterFactory = (luvio) => {
1310
+ return function getMetricFilterValues(untrustedConfig) {
1311
+ const config = validateAdapterConfig$2(untrustedConfig, getMetricFilterValues_ConfigPropertyNames);
1312
+ // Invalid or incomplete config
1313
+ if (config === null) {
1314
+ throw new Error('Invalid config for "getMetricFilterValues"');
1315
+ }
1316
+ return buildNetworkSnapshot$2(luvio, config);
1317
+ };
1318
+ };
1319
+
1320
+ const VERSION$9 = "07a8c889542dbad6f958515513d4e3fb";
1321
+ function validate$9(obj, path = 'Error') {
1322
+ const v_error = (() => {
1323
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1324
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1325
+ }
1326
+ if (obj.code !== undefined) {
1327
+ const obj_code = obj.code;
1328
+ const path_code = path + '.code';
1329
+ if (typeof obj_code !== 'string') {
1330
+ return new TypeError('Expected "string" but received "' + typeof obj_code + '" (at "' + path_code + '")');
1331
+ }
1332
+ }
1333
+ if (obj.message !== undefined) {
1334
+ const obj_message = obj.message;
1335
+ const path_message = path + '.message';
1336
+ if (typeof obj_message !== 'string') {
1337
+ return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
1338
+ }
1339
+ }
1340
+ })();
1341
+ return v_error === undefined ? null : v_error;
1342
+ }
1343
+ const select$b = function ErrorSelect() {
1344
+ return {
1345
+ kind: 'Fragment',
1346
+ version: VERSION$9,
1347
+ private: [],
1348
+ selections: [
1349
+ {
1350
+ name: 'code',
1351
+ kind: 'Scalar',
1352
+ required: false
1353
+ },
1354
+ {
1355
+ name: 'message',
1356
+ kind: 'Scalar',
1357
+ required: false
1358
+ }
1359
+ ]
1360
+ };
1361
+ };
1362
+ function equals$9(existing, incoming) {
1363
+ const existing_code = existing.code;
1364
+ const incoming_code = incoming.code;
1365
+ // if at least one of these optionals is defined
1366
+ if (existing_code !== undefined || incoming_code !== undefined) {
1367
+ // if one of these is not defined we know the other is defined and therefore
1368
+ // not equal
1369
+ if (existing_code === undefined || incoming_code === undefined) {
1370
+ return false;
1371
+ }
1372
+ if (!(existing_code === incoming_code)) {
1373
+ return false;
1374
+ }
1375
+ }
1376
+ const existing_message = existing.message;
1377
+ const incoming_message = incoming.message;
1378
+ // if at least one of these optionals is defined
1379
+ if (existing_message !== undefined || incoming_message !== undefined) {
1380
+ // if one of these is not defined we know the other is defined and therefore
1381
+ // not equal
1382
+ if (existing_message === undefined || incoming_message === undefined) {
1383
+ return false;
1384
+ }
1385
+ if (!(existing_message === incoming_message)) {
1386
+ return false;
1387
+ }
1388
+ }
1389
+ return true;
1390
+ }
1391
+
1392
+ const VERSION$8 = "6b47d2ed35a900956ff58b7d8a527e7f";
1393
+ function validate$8(obj, path = 'InsightFeedbackMetadata') {
1394
+ const v_error = (() => {
1395
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1396
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1397
+ }
1398
+ if (obj.dimensionHash !== undefined) {
1399
+ const obj_dimensionHash = obj.dimensionHash;
1400
+ const path_dimensionHash = path + '.dimensionHash';
1401
+ if (typeof obj_dimensionHash !== 'string') {
1402
+ return new TypeError('Expected "string" but received "' + typeof obj_dimensionHash + '" (at "' + path_dimensionHash + '")');
1403
+ }
1404
+ }
1405
+ if (obj.score !== undefined) {
1406
+ obj.score;
1407
+ }
1408
+ if (obj.type !== undefined) {
1409
+ const obj_type = obj.type;
1410
+ const path_type = path + '.type';
1411
+ if (typeof obj_type !== 'string') {
1412
+ return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
1413
+ }
1414
+ }
1415
+ })();
1416
+ return v_error === undefined ? null : v_error;
1417
+ }
1418
+ const select$a = function InsightFeedbackMetadataSelect() {
1419
+ return {
1420
+ kind: 'Fragment',
1421
+ version: VERSION$8,
1422
+ private: [],
1423
+ selections: [
1424
+ {
1425
+ name: 'dimensionHash',
1426
+ kind: 'Scalar',
1427
+ required: false
1428
+ },
1429
+ {
1430
+ name: 'score',
1431
+ kind: 'Scalar',
1432
+ required: false
1433
+ },
1434
+ {
1435
+ name: 'type',
1436
+ kind: 'Scalar',
1437
+ required: false
1438
+ }
1439
+ ]
1440
+ };
1441
+ };
1442
+ function equals$8(existing, incoming) {
1443
+ const existing_dimensionHash = existing.dimensionHash;
1444
+ const incoming_dimensionHash = incoming.dimensionHash;
1445
+ // if at least one of these optionals is defined
1446
+ if (existing_dimensionHash !== undefined || incoming_dimensionHash !== undefined) {
1447
+ // if one of these is not defined we know the other is defined and therefore
1448
+ // not equal
1449
+ if (existing_dimensionHash === undefined || incoming_dimensionHash === undefined) {
1450
+ return false;
1451
+ }
1452
+ if (!(existing_dimensionHash === incoming_dimensionHash)) {
1453
+ return false;
1454
+ }
1455
+ }
1456
+ const existing_type = existing.type;
1457
+ const incoming_type = incoming.type;
1458
+ // if at least one of these optionals is defined
1459
+ if (existing_type !== undefined || incoming_type !== undefined) {
1460
+ // if one of these is not defined we know the other is defined and therefore
1461
+ // not equal
1462
+ if (existing_type === undefined || incoming_type === undefined) {
1463
+ return false;
1464
+ }
1465
+ if (!(existing_type === incoming_type)) {
1466
+ return false;
1467
+ }
1468
+ }
1469
+ const existing_score = existing.score;
1470
+ const incoming_score = incoming.score;
1471
+ // if at least one of these optionals is defined
1472
+ if (existing_score !== undefined || incoming_score !== undefined) {
1473
+ // if one of these is not defined we know the other is defined and therefore
1474
+ // not equal
1475
+ if (existing_score === undefined || incoming_score === undefined) {
1476
+ return false;
1477
+ }
1478
+ if (!(existing_score === incoming_score)) {
1479
+ return false;
1480
+ }
1481
+ }
1482
+ return true;
1483
+ }
1484
+
1485
+ const VERSION$7 = "b973507f0d8eb5a125451461b0e5cea2";
1486
+ function validate$7(obj, path = 'Insight') {
1487
+ const v_error = (() => {
1488
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1489
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1490
+ }
1491
+ if (obj.characterization !== undefined) {
1492
+ const obj_characterization = obj.characterization;
1493
+ const path_characterization = path + '.characterization';
1494
+ if (typeof obj_characterization !== 'string') {
1495
+ return new TypeError('Expected "string" but received "' + typeof obj_characterization + '" (at "' + path_characterization + '")');
1496
+ }
1497
+ }
1498
+ if (obj.facts !== undefined) {
1499
+ const obj_facts = obj.facts;
1500
+ const path_facts = path + '.facts';
1501
+ if (typeof obj_facts !== 'object' || ArrayIsArray(obj_facts) || obj_facts === null) {
1502
+ return new TypeError('Expected "object" but received "' + typeof obj_facts + '" (at "' + path_facts + '")');
1503
+ }
1504
+ }
1505
+ if (obj.id !== undefined) {
1506
+ const obj_id = obj.id;
1507
+ const path_id = path + '.id';
1508
+ if (typeof obj_id !== 'string') {
1509
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
1510
+ }
1511
+ }
1512
+ const obj_insightFeedbackMetadata = obj.insightFeedbackMetadata;
1513
+ const path_insightFeedbackMetadata = path + '.insightFeedbackMetadata';
1514
+ const referencepath_insightFeedbackMetadataValidationError = validate$8(obj_insightFeedbackMetadata, path_insightFeedbackMetadata);
1515
+ if (referencepath_insightFeedbackMetadataValidationError !== null) {
1516
+ let message = 'Object doesn\'t match InsightFeedbackMetadata (at "' + path_insightFeedbackMetadata + '")\n';
1517
+ message += referencepath_insightFeedbackMetadataValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1518
+ return new TypeError(message);
1519
+ }
1520
+ if (obj.markup !== undefined) {
1521
+ const obj_markup = obj.markup;
1522
+ const path_markup = path + '.markup';
1523
+ if (typeof obj_markup !== 'string') {
1524
+ return new TypeError('Expected "string" but received "' + typeof obj_markup + '" (at "' + path_markup + '")');
1525
+ }
1526
+ }
1527
+ if (obj.question !== undefined) {
1528
+ const obj_question = obj.question;
1529
+ const path_question = path + '.question';
1530
+ if (typeof obj_question !== 'string') {
1531
+ return new TypeError('Expected "string" but received "' + typeof obj_question + '" (at "' + path_question + '")');
1532
+ }
1533
+ }
1534
+ if (obj.score !== undefined) {
1535
+ obj.score;
1536
+ }
1537
+ if (obj.type !== undefined) {
1538
+ const obj_type = obj.type;
1539
+ const path_type = path + '.type';
1540
+ if (typeof obj_type !== 'string') {
1541
+ return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
1542
+ }
1543
+ }
1544
+ if (obj.vegaLiteViz !== undefined) {
1545
+ const obj_vegaLiteViz = obj.vegaLiteViz;
1546
+ const path_vegaLiteViz = path + '.vegaLiteViz';
1547
+ if (typeof obj_vegaLiteViz !== 'object' || ArrayIsArray(obj_vegaLiteViz) || obj_vegaLiteViz === null) {
1548
+ return new TypeError('Expected "object" but received "' + typeof obj_vegaLiteViz + '" (at "' + path_vegaLiteViz + '")');
1549
+ }
1550
+ }
1551
+ if (obj.version !== undefined) {
1552
+ const obj_version = obj.version;
1553
+ const path_version = path + '.version';
1554
+ if (typeof obj_version !== 'number' || (typeof obj_version === 'number' && Math.floor(obj_version) !== obj_version)) {
1555
+ return new TypeError('Expected "integer" but received "' + typeof obj_version + '" (at "' + path_version + '")');
1556
+ }
1557
+ }
1558
+ if (obj.viz !== undefined) {
1559
+ const obj_viz = obj.viz;
1560
+ const path_viz = path + '.viz';
1561
+ if (typeof obj_viz !== 'object' || ArrayIsArray(obj_viz) || obj_viz === null) {
1562
+ return new TypeError('Expected "object" but received "' + typeof obj_viz + '" (at "' + path_viz + '")');
1563
+ }
1564
+ }
1565
+ })();
1566
+ return v_error === undefined ? null : v_error;
1567
+ }
1568
+ const select$9 = function InsightSelect() {
1569
+ const { selections: InsightFeedbackMetadata__selections, opaque: InsightFeedbackMetadata__opaque, } = select$a();
1570
+ return {
1571
+ kind: 'Fragment',
1572
+ version: VERSION$7,
1573
+ private: [],
1574
+ selections: [
1575
+ {
1576
+ name: 'characterization',
1577
+ kind: 'Scalar',
1578
+ required: false
1579
+ },
1580
+ {
1581
+ name: 'id',
1582
+ kind: 'Scalar',
1583
+ required: false
1584
+ },
1585
+ {
1586
+ name: 'insightFeedbackMetadata',
1587
+ kind: 'Object',
1588
+ selections: InsightFeedbackMetadata__selections
1589
+ },
1590
+ {
1591
+ name: 'markup',
1592
+ kind: 'Scalar',
1593
+ required: false
1594
+ },
1595
+ {
1596
+ name: 'question',
1597
+ kind: 'Scalar',
1598
+ required: false
1599
+ },
1600
+ {
1601
+ name: 'score',
1602
+ kind: 'Scalar',
1603
+ required: false
1604
+ },
1605
+ {
1606
+ name: 'type',
1607
+ kind: 'Scalar',
1608
+ required: false
1609
+ },
1610
+ {
1611
+ name: 'version',
1612
+ kind: 'Scalar',
1613
+ required: false
1614
+ }
1615
+ ]
1616
+ };
1617
+ };
1618
+ function equals$7(existing, incoming) {
1619
+ const existing_version = existing.version;
1620
+ const incoming_version = incoming.version;
1621
+ // if at least one of these optionals is defined
1622
+ if (existing_version !== undefined || incoming_version !== undefined) {
1623
+ // if one of these is not defined we know the other is defined and therefore
1624
+ // not equal
1625
+ if (existing_version === undefined || incoming_version === undefined) {
1626
+ return false;
1627
+ }
1628
+ if (!(existing_version === incoming_version)) {
1629
+ return false;
1630
+ }
1631
+ }
1632
+ const existing_characterization = existing.characterization;
1633
+ const incoming_characterization = incoming.characterization;
1634
+ // if at least one of these optionals is defined
1635
+ if (existing_characterization !== undefined || incoming_characterization !== undefined) {
1636
+ // if one of these is not defined we know the other is defined and therefore
1637
+ // not equal
1638
+ if (existing_characterization === undefined || incoming_characterization === undefined) {
1639
+ return false;
1640
+ }
1641
+ if (!(existing_characterization === incoming_characterization)) {
1642
+ return false;
1643
+ }
1644
+ }
1645
+ const existing_id = existing.id;
1646
+ const incoming_id = incoming.id;
1647
+ // if at least one of these optionals is defined
1648
+ if (existing_id !== undefined || incoming_id !== undefined) {
1649
+ // if one of these is not defined we know the other is defined and therefore
1650
+ // not equal
1651
+ if (existing_id === undefined || incoming_id === undefined) {
1652
+ return false;
1653
+ }
1654
+ if (!(existing_id === incoming_id)) {
1655
+ return false;
1656
+ }
1657
+ }
1658
+ const existing_markup = existing.markup;
1659
+ const incoming_markup = incoming.markup;
1660
+ // if at least one of these optionals is defined
1661
+ if (existing_markup !== undefined || incoming_markup !== undefined) {
1662
+ // if one of these is not defined we know the other is defined and therefore
1663
+ // not equal
1664
+ if (existing_markup === undefined || incoming_markup === undefined) {
1665
+ return false;
1666
+ }
1667
+ if (!(existing_markup === incoming_markup)) {
1668
+ return false;
1669
+ }
1670
+ }
1671
+ const existing_question = existing.question;
1672
+ const incoming_question = incoming.question;
1673
+ // if at least one of these optionals is defined
1674
+ if (existing_question !== undefined || incoming_question !== undefined) {
1675
+ // if one of these is not defined we know the other is defined and therefore
1676
+ // not equal
1677
+ if (existing_question === undefined || incoming_question === undefined) {
1678
+ return false;
1679
+ }
1680
+ if (!(existing_question === incoming_question)) {
1681
+ return false;
1682
+ }
1683
+ }
1684
+ const existing_type = existing.type;
1685
+ const incoming_type = incoming.type;
1686
+ // if at least one of these optionals is defined
1687
+ if (existing_type !== undefined || incoming_type !== undefined) {
1688
+ // if one of these is not defined we know the other is defined and therefore
1689
+ // not equal
1690
+ if (existing_type === undefined || incoming_type === undefined) {
1691
+ return false;
1692
+ }
1693
+ if (!(existing_type === incoming_type)) {
1694
+ return false;
1695
+ }
1696
+ }
1697
+ const existing_score = existing.score;
1698
+ const incoming_score = incoming.score;
1699
+ // if at least one of these optionals is defined
1700
+ if (existing_score !== undefined || incoming_score !== undefined) {
1701
+ // if one of these is not defined we know the other is defined and therefore
1702
+ // not equal
1703
+ if (existing_score === undefined || incoming_score === undefined) {
1704
+ return false;
1705
+ }
1706
+ if (!(existing_score === incoming_score)) {
1707
+ return false;
1708
+ }
1709
+ }
1710
+ const existing_facts = existing.facts;
1711
+ const incoming_facts = incoming.facts;
1712
+ // if at least one of these optionals is defined
1713
+ if (existing_facts !== undefined || incoming_facts !== undefined) {
1714
+ // if one of these is not defined we know the other is defined and therefore
1715
+ // not equal
1716
+ if (existing_facts === undefined || incoming_facts === undefined) {
1717
+ return false;
1718
+ }
1719
+ }
1720
+ const existing_insightFeedbackMetadata = existing.insightFeedbackMetadata;
1721
+ const incoming_insightFeedbackMetadata = incoming.insightFeedbackMetadata;
1722
+ if (!(equals$8(existing_insightFeedbackMetadata, incoming_insightFeedbackMetadata))) {
1723
+ return false;
1724
+ }
1725
+ const existing_vegaLiteViz = existing.vegaLiteViz;
1726
+ const incoming_vegaLiteViz = incoming.vegaLiteViz;
1727
+ // if at least one of these optionals is defined
1728
+ if (existing_vegaLiteViz !== undefined || incoming_vegaLiteViz !== undefined) {
1729
+ // if one of these is not defined we know the other is defined and therefore
1730
+ // not equal
1731
+ if (existing_vegaLiteViz === undefined || incoming_vegaLiteViz === undefined) {
1732
+ return false;
1733
+ }
1734
+ }
1735
+ const existing_viz = existing.viz;
1736
+ const incoming_viz = incoming.viz;
1737
+ // if at least one of these optionals is defined
1738
+ if (existing_viz !== undefined || incoming_viz !== undefined) {
1739
+ // if one of these is not defined we know the other is defined and therefore
1740
+ // not equal
1741
+ if (existing_viz === undefined || incoming_viz === undefined) {
1742
+ return false;
1743
+ }
1744
+ }
1745
+ return true;
1746
+ }
1747
+
1748
+ const VERSION$6 = "6707f0d0aa09112abbca1db5e32bb172";
1749
+ function validate$6(obj, path = 'InsightResponse') {
1750
+ const v_error = (() => {
1751
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1752
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1753
+ }
1754
+ if (obj.error !== undefined) {
1755
+ const obj_error = obj.error;
1756
+ const path_error = path + '.error';
1757
+ const referencepath_errorValidationError = validate$9(obj_error, path_error);
1758
+ if (referencepath_errorValidationError !== null) {
1759
+ let message = 'Object doesn\'t match Error (at "' + path_error + '")\n';
1760
+ message += referencepath_errorValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1761
+ return new TypeError(message);
1762
+ }
1763
+ }
1764
+ if (obj.insightType !== undefined) {
1765
+ const obj_insightType = obj.insightType;
1766
+ const path_insightType = path + '.insightType';
1767
+ if (typeof obj_insightType !== 'string') {
1768
+ return new TypeError('Expected "string" but received "' + typeof obj_insightType + '" (at "' + path_insightType + '")');
1769
+ }
1770
+ }
1771
+ const obj_result = obj.result;
1772
+ const path_result = path + '.result';
1773
+ const referencepath_resultValidationError = validate$7(obj_result, path_result);
1774
+ if (referencepath_resultValidationError !== null) {
1775
+ let message = 'Object doesn\'t match Insight (at "' + path_result + '")\n';
1776
+ message += referencepath_resultValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1777
+ return new TypeError(message);
1778
+ }
1779
+ })();
1780
+ return v_error === undefined ? null : v_error;
1781
+ }
1782
+ const select$8 = function InsightResponseSelect() {
1783
+ const { selections: Error__selections, opaque: Error__opaque, } = select$b();
1784
+ const { selections: Insight__selections, opaque: Insight__opaque, } = select$9();
1785
+ return {
1786
+ kind: 'Fragment',
1787
+ version: VERSION$6,
1788
+ private: [],
1789
+ selections: [
1790
+ {
1791
+ name: 'error',
1792
+ kind: 'Object',
1793
+ selections: Error__selections,
1794
+ required: false
1795
+ },
1796
+ {
1797
+ name: 'insightType',
1798
+ kind: 'Scalar',
1799
+ required: false
1800
+ },
1801
+ {
1802
+ name: 'result',
1803
+ kind: 'Object',
1804
+ selections: Insight__selections
1805
+ }
1806
+ ]
1807
+ };
1808
+ };
1809
+ function equals$6(existing, incoming) {
1810
+ const existing_insightType = existing.insightType;
1811
+ const incoming_insightType = incoming.insightType;
1812
+ // if at least one of these optionals is defined
1813
+ if (existing_insightType !== undefined || incoming_insightType !== undefined) {
1814
+ // if one of these is not defined we know the other is defined and therefore
1815
+ // not equal
1816
+ if (existing_insightType === undefined || incoming_insightType === undefined) {
1817
+ return false;
1818
+ }
1819
+ if (!(existing_insightType === incoming_insightType)) {
1820
+ return false;
1821
+ }
1822
+ }
1823
+ const existing_error = existing.error;
1824
+ const incoming_error = incoming.error;
1825
+ // if at least one of these optionals is defined
1826
+ if (existing_error !== undefined || incoming_error !== undefined) {
1827
+ // if one of these is not defined we know the other is defined and therefore
1828
+ // not equal
1829
+ if (existing_error === undefined || incoming_error === undefined) {
1830
+ return false;
1831
+ }
1832
+ if (!(equals$9(existing_error, incoming_error))) {
1833
+ return false;
1834
+ }
1835
+ }
1836
+ const existing_result = existing.result;
1837
+ const incoming_result = incoming.result;
1838
+ if (!(equals$7(existing_result, incoming_result))) {
1839
+ return false;
1840
+ }
1841
+ return true;
1842
+ }
1843
+
1844
+ const VERSION$5 = "9a4f5492d8e4788f172b90ac222f71c5";
1845
+ function validate$5(obj, path = 'Overview') {
1846
+ const v_error = (() => {
1847
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1848
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1849
+ }
1850
+ if (obj.vegaLiteViz !== undefined) {
1851
+ const obj_vegaLiteViz = obj.vegaLiteViz;
1852
+ const path_vegaLiteViz = path + '.vegaLiteViz';
1853
+ if (typeof obj_vegaLiteViz !== 'object' || ArrayIsArray(obj_vegaLiteViz) || obj_vegaLiteViz === null) {
1854
+ return new TypeError('Expected "object" but received "' + typeof obj_vegaLiteViz + '" (at "' + path_vegaLiteViz + '")');
1855
+ }
1856
+ }
1857
+ if (obj.viz !== undefined) {
1858
+ const obj_viz = obj.viz;
1859
+ const path_viz = path + '.viz';
1860
+ if (typeof obj_viz !== 'object' || ArrayIsArray(obj_viz) || obj_viz === null) {
1861
+ return new TypeError('Expected "object" but received "' + typeof obj_viz + '" (at "' + path_viz + '")');
1862
+ }
1863
+ }
1864
+ })();
1865
+ return v_error === undefined ? null : v_error;
1866
+ }
1867
+ const select$7 = function OverviewSelect() {
1868
+ return {
1869
+ kind: 'Fragment',
1870
+ version: VERSION$5,
1871
+ private: [],
1872
+ selections: []
1873
+ };
1874
+ };
1875
+ function equals$5(existing, incoming) {
1876
+ const existing_vegaLiteViz = existing.vegaLiteViz;
1877
+ const incoming_vegaLiteViz = incoming.vegaLiteViz;
1878
+ // if at least one of these optionals is defined
1879
+ if (existing_vegaLiteViz !== undefined || incoming_vegaLiteViz !== undefined) {
1880
+ // if one of these is not defined we know the other is defined and therefore
1881
+ // not equal
1882
+ if (existing_vegaLiteViz === undefined || incoming_vegaLiteViz === undefined) {
1883
+ return false;
1884
+ }
1885
+ }
1886
+ const existing_viz = existing.viz;
1887
+ const incoming_viz = incoming.viz;
1888
+ // if at least one of these optionals is defined
1889
+ if (existing_viz !== undefined || incoming_viz !== undefined) {
1890
+ // if one of these is not defined we know the other is defined and therefore
1891
+ // not equal
1892
+ if (existing_viz === undefined || incoming_viz === undefined) {
1893
+ return false;
1894
+ }
1895
+ }
1896
+ return true;
1897
+ }
1898
+
1899
+ const VERSION$4 = "ac3296a9832f46fda66420bc753d8c61";
1900
+ function validate$4(obj, path = 'OverviewResponse') {
1901
+ const v_error = (() => {
1902
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1903
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1904
+ }
1905
+ if (obj.error !== undefined) {
1906
+ const obj_error = obj.error;
1907
+ const path_error = path + '.error';
1908
+ const referencepath_errorValidationError = validate$9(obj_error, path_error);
1909
+ if (referencepath_errorValidationError !== null) {
1910
+ let message = 'Object doesn\'t match Error (at "' + path_error + '")\n';
1911
+ message += referencepath_errorValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1912
+ return new TypeError(message);
1913
+ }
1914
+ }
1915
+ const obj_result = obj.result;
1916
+ const path_result = path + '.result';
1917
+ const referencepath_resultValidationError = validate$5(obj_result, path_result);
1918
+ if (referencepath_resultValidationError !== null) {
1919
+ let message = 'Object doesn\'t match Overview (at "' + path_result + '")\n';
1920
+ message += referencepath_resultValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1921
+ return new TypeError(message);
1922
+ }
1923
+ })();
1924
+ return v_error === undefined ? null : v_error;
1925
+ }
1926
+ const select$6 = function OverviewResponseSelect() {
1927
+ const { selections: Error__selections, opaque: Error__opaque, } = select$b();
1928
+ const { selections: Overview__selections, opaque: Overview__opaque, } = select$7();
1929
+ return {
1930
+ kind: 'Fragment',
1931
+ version: VERSION$4,
1932
+ private: [],
1933
+ selections: [
1934
+ {
1935
+ name: 'error',
1936
+ kind: 'Object',
1937
+ selections: Error__selections,
1938
+ required: false
1939
+ },
1940
+ {
1941
+ name: 'result',
1942
+ kind: 'Object',
1943
+ selections: Overview__selections
1944
+ }
1945
+ ]
1946
+ };
1947
+ };
1948
+ function equals$4(existing, incoming) {
1949
+ const existing_error = existing.error;
1950
+ const incoming_error = incoming.error;
1951
+ // if at least one of these optionals is defined
1952
+ if (existing_error !== undefined || incoming_error !== undefined) {
1953
+ // if one of these is not defined we know the other is defined and therefore
1954
+ // not equal
1955
+ if (existing_error === undefined || incoming_error === undefined) {
1956
+ return false;
1957
+ }
1958
+ if (!(equals$9(existing_error, incoming_error))) {
1959
+ return false;
1960
+ }
1961
+ }
1962
+ const existing_result = existing.result;
1963
+ const incoming_result = incoming.result;
1964
+ if (!(equals$5(existing_result, incoming_result))) {
1965
+ return false;
1966
+ }
1967
+ return true;
1968
+ }
1969
+
1970
+ const VERSION$3 = "a70a5e68e786c3f38efb73cc0812d394";
1971
+ function validate$3(obj, path = 'InsightGroup') {
1972
+ const v_error = (() => {
1973
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1974
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1975
+ }
1976
+ if (obj.error !== undefined) {
1977
+ const obj_error = obj.error;
1978
+ const path_error = path + '.error';
1979
+ const referencepath_errorValidationError = validate$9(obj_error, path_error);
1980
+ if (referencepath_errorValidationError !== null) {
1981
+ let message = 'Object doesn\'t match Error (at "' + path_error + '")\n';
1982
+ message += referencepath_errorValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1983
+ return new TypeError(message);
1984
+ }
1985
+ }
1986
+ if (obj.insights !== undefined) {
1987
+ const obj_insights = obj.insights;
1988
+ const path_insights = path + '.insights';
1989
+ if (!ArrayIsArray(obj_insights)) {
1990
+ return new TypeError('Expected "array" but received "' + typeof obj_insights + '" (at "' + path_insights + '")');
1991
+ }
1992
+ for (let i = 0; i < obj_insights.length; i++) {
1993
+ const obj_insights_item = obj_insights[i];
1994
+ const path_insights_item = path_insights + '[' + i + ']';
1995
+ const referencepath_insights_itemValidationError = validate$6(obj_insights_item, path_insights_item);
1996
+ if (referencepath_insights_itemValidationError !== null) {
1997
+ let message = 'Object doesn\'t match InsightResponse (at "' + path_insights_item + '")\n';
1998
+ message += referencepath_insights_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1999
+ return new TypeError(message);
2000
+ }
2001
+ }
2002
+ }
2003
+ if (obj.overviews !== undefined) {
2004
+ const obj_overviews = obj.overviews;
2005
+ const path_overviews = path + '.overviews';
2006
+ if (!ArrayIsArray(obj_overviews)) {
2007
+ return new TypeError('Expected "array" but received "' + typeof obj_overviews + '" (at "' + path_overviews + '")');
2008
+ }
2009
+ for (let i = 0; i < obj_overviews.length; i++) {
2010
+ const obj_overviews_item = obj_overviews[i];
2011
+ const path_overviews_item = path_overviews + '[' + i + ']';
2012
+ const referencepath_overviews_itemValidationError = validate$4(obj_overviews_item, path_overviews_item);
2013
+ if (referencepath_overviews_itemValidationError !== null) {
2014
+ let message = 'Object doesn\'t match OverviewResponse (at "' + path_overviews_item + '")\n';
2015
+ message += referencepath_overviews_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2016
+ return new TypeError(message);
2017
+ }
2018
+ }
2019
+ }
2020
+ if (obj.type !== undefined) {
2021
+ const obj_type = obj.type;
2022
+ const path_type = path + '.type';
2023
+ if (typeof obj_type !== 'string') {
2024
+ return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
2025
+ }
2026
+ }
2027
+ })();
2028
+ return v_error === undefined ? null : v_error;
2029
+ }
2030
+ const select$5 = function InsightGroupSelect() {
2031
+ const { selections: Error__selections, opaque: Error__opaque, } = select$b();
2032
+ const { selections: InsightResponse__selections, opaque: InsightResponse__opaque, } = select$8();
2033
+ const { selections: OverviewResponse__selections, opaque: OverviewResponse__opaque, } = select$6();
2034
+ return {
2035
+ kind: 'Fragment',
2036
+ version: VERSION$3,
2037
+ private: [],
2038
+ selections: [
2039
+ {
2040
+ name: 'error',
2041
+ kind: 'Object',
2042
+ selections: Error__selections,
2043
+ required: false
2044
+ },
2045
+ {
2046
+ name: 'insights',
2047
+ kind: 'Object',
2048
+ plural: true,
2049
+ selections: InsightResponse__selections,
2050
+ required: false
2051
+ },
2052
+ {
2053
+ name: 'overviews',
2054
+ kind: 'Object',
2055
+ plural: true,
2056
+ selections: OverviewResponse__selections,
2057
+ required: false
2058
+ },
2059
+ {
2060
+ name: 'type',
2061
+ kind: 'Scalar',
2062
+ required: false
2063
+ }
2064
+ ]
2065
+ };
2066
+ };
2067
+ function equals$3(existing, incoming) {
2068
+ const existing_type = existing.type;
2069
+ const incoming_type = incoming.type;
2070
+ // if at least one of these optionals is defined
2071
+ if (existing_type !== undefined || incoming_type !== undefined) {
2072
+ // if one of these is not defined we know the other is defined and therefore
2073
+ // not equal
2074
+ if (existing_type === undefined || incoming_type === undefined) {
2075
+ return false;
2076
+ }
2077
+ if (!(existing_type === incoming_type)) {
2078
+ return false;
2079
+ }
2080
+ }
2081
+ const existing_error = existing.error;
2082
+ const incoming_error = incoming.error;
2083
+ // if at least one of these optionals is defined
2084
+ if (existing_error !== undefined || incoming_error !== undefined) {
2085
+ // if one of these is not defined we know the other is defined and therefore
2086
+ // not equal
2087
+ if (existing_error === undefined || incoming_error === undefined) {
2088
+ return false;
2089
+ }
2090
+ if (!(equals$9(existing_error, incoming_error))) {
2091
+ return false;
2092
+ }
2093
+ }
2094
+ const existing_insights = existing.insights;
2095
+ const incoming_insights = incoming.insights;
2096
+ // if at least one of these optionals is defined
2097
+ if (existing_insights !== undefined || incoming_insights !== undefined) {
2098
+ // if one of these is not defined we know the other is defined and therefore
2099
+ // not equal
2100
+ if (existing_insights === undefined || incoming_insights === undefined) {
2101
+ return false;
2102
+ }
2103
+ const equals_insights_items = equalsArray(existing_insights, incoming_insights, (existing_insights_item, incoming_insights_item) => {
2104
+ if (!(equals$6(existing_insights_item, incoming_insights_item))) {
2105
+ return false;
2106
+ }
2107
+ });
2108
+ if (equals_insights_items === false) {
2109
+ return false;
2110
+ }
2111
+ }
2112
+ const existing_overviews = existing.overviews;
2113
+ const incoming_overviews = incoming.overviews;
2114
+ // if at least one of these optionals is defined
2115
+ if (existing_overviews !== undefined || incoming_overviews !== undefined) {
2116
+ // if one of these is not defined we know the other is defined and therefore
2117
+ // not equal
2118
+ if (existing_overviews === undefined || incoming_overviews === undefined) {
2119
+ return false;
2120
+ }
2121
+ const equals_overviews_items = equalsArray(existing_overviews, incoming_overviews, (existing_overviews_item, incoming_overviews_item) => {
2122
+ if (!(equals$4(existing_overviews_item, incoming_overviews_item))) {
2123
+ return false;
2124
+ }
2125
+ });
2126
+ if (equals_overviews_items === false) {
2127
+ return false;
2128
+ }
2129
+ }
2130
+ return true;
2131
+ }
2132
+
2133
+ const VERSION$2 = "ccf83d258110a04c1949592c91b69b3b";
2134
+ function validate$2(obj, path = 'InsightBundle') {
2135
+ const v_error = (() => {
2136
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
2137
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
2138
+ }
2139
+ if (obj.characterization !== undefined) {
2140
+ const obj_characterization = obj.characterization;
2141
+ const path_characterization = path + '.characterization';
2142
+ if (typeof obj_characterization !== 'string') {
2143
+ return new TypeError('Expected "string" but received "' + typeof obj_characterization + '" (at "' + path_characterization + '")');
2144
+ }
2145
+ }
2146
+ if (obj.hasErrors !== undefined) {
2147
+ const obj_hasErrors = obj.hasErrors;
2148
+ const path_hasErrors = path + '.hasErrors';
2149
+ if (typeof obj_hasErrors !== 'boolean') {
2150
+ return new TypeError('Expected "boolean" but received "' + typeof obj_hasErrors + '" (at "' + path_hasErrors + '")');
2151
+ }
2152
+ }
2153
+ if (obj.insightGroups !== undefined) {
2154
+ const obj_insightGroups = obj.insightGroups;
2155
+ const path_insightGroups = path + '.insightGroups';
2156
+ if (!ArrayIsArray(obj_insightGroups)) {
2157
+ return new TypeError('Expected "array" but received "' + typeof obj_insightGroups + '" (at "' + path_insightGroups + '")');
2158
+ }
2159
+ for (let i = 0; i < obj_insightGroups.length; i++) {
2160
+ const obj_insightGroups_item = obj_insightGroups[i];
2161
+ const path_insightGroups_item = path_insightGroups + '[' + i + ']';
2162
+ const referencepath_insightGroups_itemValidationError = validate$3(obj_insightGroups_item, path_insightGroups_item);
2163
+ if (referencepath_insightGroups_itemValidationError !== null) {
2164
+ let message = 'Object doesn\'t match InsightGroup (at "' + path_insightGroups_item + '")\n';
2165
+ message += referencepath_insightGroups_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2166
+ return new TypeError(message);
2167
+ }
2168
+ }
2169
+ }
2170
+ })();
2171
+ return v_error === undefined ? null : v_error;
2172
+ }
2173
+ const select$4 = function InsightBundleSelect() {
2174
+ const { selections: InsightGroup__selections, opaque: InsightGroup__opaque, } = select$5();
2175
+ return {
2176
+ kind: 'Fragment',
2177
+ version: VERSION$2,
2178
+ private: [],
2179
+ selections: [
2180
+ {
2181
+ name: 'characterization',
2182
+ kind: 'Scalar',
2183
+ required: false
2184
+ },
2185
+ {
2186
+ name: 'hasErrors',
2187
+ kind: 'Scalar',
2188
+ required: false
2189
+ },
2190
+ {
2191
+ name: 'insightGroups',
2192
+ kind: 'Object',
2193
+ plural: true,
2194
+ selections: InsightGroup__selections,
2195
+ required: false
2196
+ }
2197
+ ]
2198
+ };
2199
+ };
2200
+ function equals$2(existing, incoming) {
2201
+ const existing_hasErrors = existing.hasErrors;
2202
+ const incoming_hasErrors = incoming.hasErrors;
2203
+ // if at least one of these optionals is defined
2204
+ if (existing_hasErrors !== undefined || incoming_hasErrors !== undefined) {
2205
+ // if one of these is not defined we know the other is defined and therefore
2206
+ // not equal
2207
+ if (existing_hasErrors === undefined || incoming_hasErrors === undefined) {
2208
+ return false;
2209
+ }
2210
+ if (!(existing_hasErrors === incoming_hasErrors)) {
2211
+ return false;
2212
+ }
2213
+ }
2214
+ const existing_characterization = existing.characterization;
2215
+ const incoming_characterization = incoming.characterization;
2216
+ // if at least one of these optionals is defined
2217
+ if (existing_characterization !== undefined || incoming_characterization !== undefined) {
2218
+ // if one of these is not defined we know the other is defined and therefore
2219
+ // not equal
2220
+ if (existing_characterization === undefined || incoming_characterization === undefined) {
2221
+ return false;
2222
+ }
2223
+ if (!(existing_characterization === incoming_characterization)) {
2224
+ return false;
2225
+ }
2226
+ }
2227
+ const existing_insightGroups = existing.insightGroups;
2228
+ const incoming_insightGroups = incoming.insightGroups;
2229
+ // if at least one of these optionals is defined
2230
+ if (existing_insightGroups !== undefined || incoming_insightGroups !== undefined) {
2231
+ // if one of these is not defined we know the other is defined and therefore
2232
+ // not equal
2233
+ if (existing_insightGroups === undefined || incoming_insightGroups === undefined) {
2234
+ return false;
2235
+ }
2236
+ const equals_insightGroups_items = equalsArray(existing_insightGroups, incoming_insightGroups, (existing_insightGroups_item, incoming_insightGroups_item) => {
2237
+ if (!(equals$3(existing_insightGroups_item, incoming_insightGroups_item))) {
2238
+ return false;
2239
+ }
2240
+ });
2241
+ if (equals_insightGroups_items === false) {
2242
+ return false;
2243
+ }
2244
+ }
2245
+ return true;
2246
+ }
2247
+
2248
+ const VERSION$1 = "8c719ff91e25e9ab6139733bd1b5c2bc";
2249
+ function validate$1(obj, path = 'GetInsightBatchResponse') {
2250
+ const v_error = (() => {
2251
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
2252
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
2253
+ }
2254
+ const obj_batchId = obj.batchId;
2255
+ const path_batchId = path + '.batchId';
2256
+ if (typeof obj_batchId !== 'string') {
2257
+ return new TypeError('Expected "string" but received "' + typeof obj_batchId + '" (at "' + path_batchId + '")');
2258
+ }
2259
+ if (obj.bundles !== undefined) {
2260
+ const obj_bundles = obj.bundles;
2261
+ const path_bundles = path + '.bundles';
2262
+ if (!ArrayIsArray(obj_bundles)) {
2263
+ return new TypeError('Expected "array" but received "' + typeof obj_bundles + '" (at "' + path_bundles + '")');
2264
+ }
2265
+ for (let i = 0; i < obj_bundles.length; i++) {
2266
+ const obj_bundles_item = obj_bundles[i];
2267
+ const path_bundles_item = path_bundles + '[' + i + ']';
2268
+ const referencepath_bundles_itemValidationError = validate$2(obj_bundles_item, path_bundles_item);
2269
+ if (referencepath_bundles_itemValidationError !== null) {
2270
+ let message = 'Object doesn\'t match InsightBundle (at "' + path_bundles_item + '")\n';
2271
+ message += referencepath_bundles_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2272
+ return new TypeError(message);
2273
+ }
2274
+ }
2275
+ }
2276
+ if (obj.hasErrors !== undefined) {
2277
+ const obj_hasErrors = obj.hasErrors;
2278
+ const path_hasErrors = path + '.hasErrors';
2279
+ if (typeof obj_hasErrors !== 'boolean') {
2280
+ return new TypeError('Expected "boolean" but received "' + typeof obj_hasErrors + '" (at "' + path_hasErrors + '")');
2281
+ }
2282
+ }
2283
+ if (obj.summary !== undefined) {
2284
+ const obj_summary = obj.summary;
2285
+ const path_summary = path + '.summary';
2286
+ if (obj_summary === undefined) {
2287
+ return new TypeError('Expected "defined" but received "' + typeof obj_summary + '" (at "' + path_summary + '")');
2288
+ }
2289
+ }
2290
+ })();
2291
+ return v_error === undefined ? null : v_error;
2292
+ }
2293
+ const RepresentationType$1 = 'GetInsightBatchResponse';
2294
+ function keyBuilder$3(luvio, config) {
2295
+ return keyPrefix + '::' + RepresentationType$1 + ':' + config.batchid;
2296
+ }
2297
+ function keyBuilderFromType$1(luvio, object) {
2298
+ const keyParams = {
2299
+ batchid: object.batchId
2300
+ };
2301
+ return keyBuilder$3(luvio, keyParams);
2302
+ }
2303
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
2304
+ return input;
2305
+ }
2306
+ const select$3 = function GetInsightBatchResponseSelect() {
2307
+ const { selections: InsightBundle__selections, opaque: InsightBundle__opaque, } = select$4();
2308
+ return {
2309
+ kind: 'Fragment',
2310
+ version: VERSION$1,
2311
+ private: [],
2312
+ selections: [
2313
+ {
2314
+ name: 'batchId',
2315
+ kind: 'Scalar'
2316
+ },
2317
+ {
2318
+ name: 'bundles',
2319
+ kind: 'Object',
2320
+ plural: true,
2321
+ selections: InsightBundle__selections,
2322
+ required: false
2323
+ },
2324
+ {
2325
+ name: 'hasErrors',
2326
+ kind: 'Scalar',
2327
+ required: false
2328
+ },
2329
+ {
2330
+ name: 'summary',
2331
+ kind: 'Object',
2332
+ // any
2333
+ }
2334
+ ]
2335
+ };
2336
+ };
2337
+ function equals$1(existing, incoming) {
2338
+ const existing_hasErrors = existing.hasErrors;
2339
+ const incoming_hasErrors = incoming.hasErrors;
2340
+ // if at least one of these optionals is defined
2341
+ if (existing_hasErrors !== undefined || incoming_hasErrors !== undefined) {
2342
+ // if one of these is not defined we know the other is defined and therefore
2343
+ // not equal
2344
+ if (existing_hasErrors === undefined || incoming_hasErrors === undefined) {
2345
+ return false;
2346
+ }
2347
+ if (!(existing_hasErrors === incoming_hasErrors)) {
2348
+ return false;
2349
+ }
2350
+ }
2351
+ const existing_batchId = existing.batchId;
2352
+ const incoming_batchId = incoming.batchId;
2353
+ if (!(existing_batchId === incoming_batchId)) {
2354
+ return false;
2355
+ }
2356
+ const existing_bundles = existing.bundles;
2357
+ const incoming_bundles = incoming.bundles;
2358
+ // if at least one of these optionals is defined
2359
+ if (existing_bundles !== undefined || incoming_bundles !== undefined) {
2360
+ // if one of these is not defined we know the other is defined and therefore
2361
+ // not equal
2362
+ if (existing_bundles === undefined || incoming_bundles === undefined) {
2363
+ return false;
2364
+ }
2365
+ const equals_bundles_items = equalsArray(existing_bundles, incoming_bundles, (existing_bundles_item, incoming_bundles_item) => {
2366
+ if (!(equals$2(existing_bundles_item, incoming_bundles_item))) {
2367
+ return false;
2368
+ }
2369
+ });
2370
+ if (equals_bundles_items === false) {
2371
+ return false;
2372
+ }
2373
+ }
2374
+ const existing_summary = existing.summary;
2375
+ const incoming_summary = incoming.summary;
2376
+ // if at least one of these optionals is defined
2377
+ if (existing_summary !== undefined || incoming_summary !== undefined) {
2378
+ // if one of these is not defined we know the other is defined and therefore
2379
+ // not equal
2380
+ if (existing_summary === undefined || incoming_summary === undefined) {
2381
+ return false;
2382
+ }
2383
+ if (JSONStringify(incoming_summary) !== JSONStringify(existing_summary)) {
2384
+ return false;
2385
+ }
2386
+ }
2387
+ return true;
2388
+ }
2389
+ const ingest$1 = function GetInsightBatchResponseIngest(input, path, luvio, store, timestamp) {
2390
+ if (process.env.NODE_ENV !== 'production') {
2391
+ const validateError = validate$1(input);
2392
+ if (validateError !== null) {
2393
+ throw validateError;
2394
+ }
2395
+ }
2396
+ const key = keyBuilderFromType$1(luvio, input);
2397
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 300000;
2398
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "analytics-insights", VERSION$1, RepresentationType$1, equals$1);
2399
+ return createLink(key);
2400
+ };
2401
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
2402
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
2403
+ const rootKey = keyBuilderFromType$1(luvio, input);
2404
+ rootKeySet.set(rootKey, {
2405
+ namespace: keyPrefix,
2406
+ representationName: RepresentationType$1,
2407
+ mergeable: false
2408
+ });
2409
+ }
2410
+
2411
+ function select$2(luvio, params) {
2412
+ return select$3();
2413
+ }
2414
+ function keyBuilder$2(luvio, params) {
2415
+ return keyBuilder$3(luvio, {
2416
+ batchid: params.urlParams.batch_id
2417
+ });
2418
+ }
2419
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
2420
+ getTypeCacheKeys$1(storeKeyMap, luvio, response);
2421
+ }
2422
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
2423
+ const { body } = response;
2424
+ const key = keyBuilder$2(luvio, resourceParams);
2425
+ luvio.storeIngest(key, ingest$1, body);
2426
+ const snapshot = luvio.storeLookup({
2427
+ recordId: key,
2428
+ node: select$2(),
2429
+ variables: {},
2430
+ }, snapshotRefresh);
2431
+ if (process.env.NODE_ENV !== 'production') {
2432
+ if (snapshot.state !== 'Fulfilled') {
2433
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
2434
+ }
2435
+ }
2436
+ deepFreeze(snapshot.data);
2437
+ return snapshot;
2438
+ }
2439
+ function ingestError(luvio, params, error, snapshotRefresh) {
2440
+ const key = keyBuilder$2(luvio, params);
2441
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
2442
+ luvio.storeIngestError(key, errorSnapshot);
2443
+ return errorSnapshot;
2444
+ }
2445
+ function createResourceRequest$1(config) {
2446
+ const headers = {};
2447
+ return {
2448
+ baseUri: 'https://api.salesforce.com/analytics/insights/{version}',
2449
+ basePath: '/batches/' + config.urlParams.batch_id + '',
2450
+ method: 'get',
2451
+ body: null,
2452
+ urlParams: config.urlParams,
2453
+ queryParams: {},
2454
+ headers,
2455
+ priority: 'normal',
2456
+ };
2457
+ }
2458
+
2459
+ const adapterName$1 = 'getInsightsBatch';
2460
+ const getInsightsBatch_ConfigPropertyMetadata = [
2461
+ generateParamConfigMetadata('batch_id', true, 0 /* UrlParameter */, 0 /* String */),
2462
+ ];
2463
+ const getInsightsBatch_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getInsightsBatch_ConfigPropertyMetadata);
2464
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$4(getInsightsBatch_ConfigPropertyMetadata);
2465
+ function keyBuilder$1(luvio, config) {
2466
+ const resourceParams = createResourceParams$1(config);
2467
+ return keyBuilder$2(luvio, resourceParams);
2468
+ }
2469
+ function typeCheckConfig$1(untrustedConfig) {
2470
+ const config = {};
2471
+ typeCheckConfig$4(untrustedConfig, config, getInsightsBatch_ConfigPropertyMetadata);
2472
+ return config;
2473
+ }
2474
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
2475
+ if (!untrustedIsObject(untrustedConfig)) {
2476
+ return null;
2477
+ }
2478
+ if (process.env.NODE_ENV !== 'production') {
2479
+ validateConfig(untrustedConfig, configPropertyNames);
2480
+ }
2481
+ const config = typeCheckConfig$1(untrustedConfig);
2482
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
2483
+ return null;
2484
+ }
2485
+ return config;
2486
+ }
2487
+ function adapterFragment(luvio, config) {
2488
+ createResourceParams$1(config);
2489
+ return select$2();
2490
+ }
2491
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
2492
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
2493
+ config,
2494
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
2495
+ });
2496
+ return luvio.storeBroadcast().then(() => snapshot);
2497
+ }
2498
+ function onFetchResponseError(luvio, config, resourceParams, response) {
2499
+ const snapshot = ingestError(luvio, resourceParams, response, {
2500
+ config,
2501
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
2502
+ });
2503
+ return luvio.storeBroadcast().then(() => snapshot);
2504
+ }
2505
+ function buildNetworkSnapshot$1(luvio, config, options) {
2506
+ const resourceParams = createResourceParams$1(config);
2507
+ const request = createResourceRequest$1(resourceParams);
2508
+ return luvio.dispatchResourceRequest(request, options)
2509
+ .then((response) => {
2510
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
2511
+ const cache = new StoreKeyMap();
2512
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
2513
+ return cache;
2514
+ });
2515
+ }, (response) => {
2516
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
2517
+ });
2518
+ }
2519
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
2520
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
2521
+ }
2522
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
2523
+ const { luvio, config } = context;
2524
+ const selector = {
2525
+ recordId: keyBuilder$1(luvio, config),
2526
+ node: adapterFragment(luvio, config),
2527
+ variables: {},
2528
+ };
2529
+ const cacheSnapshot = storeLookup(selector, {
2530
+ config,
2531
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
2532
+ });
2533
+ return cacheSnapshot;
2534
+ }
2535
+ const getInsightsBatchAdapterFactory = (luvio) => function analyticsInsights__getInsightsBatch(untrustedConfig, requestContext) {
2536
+ const config = validateAdapterConfig$1(untrustedConfig, getInsightsBatch_ConfigPropertyNames);
2537
+ // Invalid or incomplete config
2538
+ if (config === null) {
2539
+ return null;
2540
+ }
2541
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
2542
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
2543
+ };
2544
+
2545
+ const VERSION = "e64bc88a0a4f11fcf5a12538b4b51a87";
2546
+ function validate(obj, path = 'GenerateInsightBundleResponse') {
2547
+ const v_error = (() => {
2548
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
2549
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
2550
+ }
2551
+ if (obj.error !== undefined) {
2552
+ const obj_error = obj.error;
2553
+ const path_error = path + '.error';
2554
+ const referencepath_errorValidationError = validate$9(obj_error, path_error);
2555
+ if (referencepath_errorValidationError !== null) {
2556
+ let message = 'Object doesn\'t match Error (at "' + path_error + '")\n';
2557
+ message += referencepath_errorValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2558
+ return new TypeError(message);
2559
+ }
2560
+ }
2561
+ const obj_id = obj.id;
2562
+ const path_id = path + '.id';
2563
+ if (typeof obj_id !== 'string') {
2564
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
2565
+ }
2566
+ if (obj.result !== undefined) {
2567
+ const obj_result = obj.result;
2568
+ const path_result = path + '.result';
2569
+ if (obj_result === undefined) {
2570
+ return new TypeError('Expected "defined" but received "' + typeof obj_result + '" (at "' + path_result + '")');
2571
+ }
2572
+ }
2573
+ })();
2574
+ return v_error === undefined ? null : v_error;
2575
+ }
2576
+ const RepresentationType = 'GenerateInsightBundleResponse';
2577
+ function keyBuilder(luvio, config) {
2578
+ return keyPrefix + '::' + RepresentationType + ':' + config.bundleresponseid;
2579
+ }
2580
+ function keyBuilderFromType(luvio, object) {
2581
+ const keyParams = {
2582
+ bundleresponseid: object.id
2583
+ };
2584
+ return keyBuilder(luvio, keyParams);
2585
+ }
2586
+ function normalize(input, existing, path, luvio, store, timestamp) {
2587
+ return input;
2588
+ }
2589
+ const select$1 = function GenerateInsightBundleResponseSelect() {
2590
+ const { selections: Error__selections, opaque: Error__opaque, } = select$b();
2591
+ return {
2592
+ kind: 'Fragment',
2593
+ version: VERSION,
2594
+ private: [],
2595
+ selections: [
2596
+ {
2597
+ name: 'error',
2598
+ kind: 'Object',
2599
+ selections: Error__selections,
2600
+ required: false
2601
+ },
2602
+ {
2603
+ name: 'id',
2604
+ kind: 'Scalar'
2605
+ },
2606
+ {
2607
+ name: 'result',
2608
+ kind: 'Object',
2609
+ // any
2610
+ }
2611
+ ]
2612
+ };
2613
+ };
2614
+ function equals(existing, incoming) {
2615
+ const existing_id = existing.id;
2616
+ const incoming_id = incoming.id;
2617
+ if (!(existing_id === incoming_id)) {
2618
+ return false;
2619
+ }
2620
+ const existing_error = existing.error;
2621
+ const incoming_error = incoming.error;
2622
+ // if at least one of these optionals is defined
2623
+ if (existing_error !== undefined || incoming_error !== undefined) {
2624
+ // if one of these is not defined we know the other is defined and therefore
2625
+ // not equal
2626
+ if (existing_error === undefined || incoming_error === undefined) {
2627
+ return false;
2628
+ }
2629
+ if (!(equals$9(existing_error, incoming_error))) {
2630
+ return false;
2631
+ }
2632
+ }
2633
+ const existing_result = existing.result;
2634
+ const incoming_result = incoming.result;
2635
+ // if at least one of these optionals is defined
2636
+ if (existing_result !== undefined || incoming_result !== undefined) {
2637
+ // if one of these is not defined we know the other is defined and therefore
2638
+ // not equal
2639
+ if (existing_result === undefined || incoming_result === undefined) {
2640
+ return false;
2641
+ }
2642
+ if (JSONStringify(incoming_result) !== JSONStringify(existing_result)) {
2643
+ return false;
2644
+ }
2645
+ }
2646
+ return true;
2647
+ }
2648
+ const ingest = function GenerateInsightBundleResponseIngest(input, path, luvio, store, timestamp) {
2649
+ if (process.env.NODE_ENV !== 'production') {
2650
+ const validateError = validate(input);
2651
+ if (validateError !== null) {
2652
+ throw validateError;
2653
+ }
2654
+ }
2655
+ const key = keyBuilderFromType(luvio, input);
2656
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 300000;
2657
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "analytics-insights", VERSION, RepresentationType, equals);
2658
+ return createLink(key);
2659
+ };
2660
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
2661
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
2662
+ const rootKey = keyBuilderFromType(luvio, input);
2663
+ rootKeySet.set(rootKey, {
2664
+ namespace: keyPrefix,
2665
+ representationName: RepresentationType,
2666
+ mergeable: false
2667
+ });
2668
+ }
2669
+
2670
+ function select(luvio, params) {
2671
+ return select$1();
2672
+ }
2673
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
2674
+ getTypeCacheKeys(storeKeyMap, luvio, response);
2675
+ }
2676
+ function ingestSuccess(luvio, resourceParams, response) {
2677
+ const { body } = response;
2678
+ const key = keyBuilderFromType(luvio, body);
2679
+ luvio.storeIngest(key, ingest, body);
2680
+ const snapshot = luvio.storeLookup({
2681
+ recordId: key,
2682
+ node: select(),
2683
+ variables: {},
2684
+ });
2685
+ if (process.env.NODE_ENV !== 'production') {
2686
+ if (snapshot.state !== 'Fulfilled') {
2687
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
2688
+ }
2689
+ }
2690
+ deepFreeze(snapshot.data);
2691
+ return snapshot;
2692
+ }
2693
+ function createResourceRequest(config) {
2694
+ const headers = {};
2695
+ return {
2696
+ baseUri: 'https://api.salesforce.com/analytics/insights/{version}',
2697
+ basePath: '/v1/generateBundle',
2698
+ method: 'post',
2699
+ body: config.body,
2700
+ urlParams: {},
2701
+ queryParams: {},
2702
+ headers,
2703
+ priority: 'normal',
2704
+ };
2705
+ }
2706
+
2707
+ const adapterName = 'generateInsights';
2708
+ const generateInsights_ConfigPropertyMetadata = [
2709
+ generateParamConfigMetadata('type', false, 2 /* Body */, 0 /* String */),
2710
+ generateParamConfigMetadata('version', false, 2 /* Body */, 3 /* Integer */),
2711
+ generateParamConfigMetadata('input', false, 2 /* Body */, 4 /* Unsupported */),
2712
+ generateParamConfigMetadata('options', false, 2 /* Body */, 4 /* Unsupported */),
2713
+ ];
2714
+ const generateInsights_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, generateInsights_ConfigPropertyMetadata);
2715
+ const createResourceParams = /*#__PURE__*/ createResourceParams$4(generateInsights_ConfigPropertyMetadata);
2716
+ function typeCheckConfig(untrustedConfig) {
2717
+ const config = {};
2718
+ typeCheckConfig$4(untrustedConfig, config, generateInsights_ConfigPropertyMetadata);
2719
+ const untrustedConfig_input = untrustedConfig.input;
2720
+ config.input = untrustedConfig_input;
2721
+ const untrustedConfig_options = untrustedConfig.options;
2722
+ config.options = untrustedConfig_options;
2723
+ return config;
2724
+ }
2725
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
2726
+ if (!untrustedIsObject(untrustedConfig)) {
2727
+ return null;
2728
+ }
2729
+ if (process.env.NODE_ENV !== 'production') {
2730
+ validateConfig(untrustedConfig, configPropertyNames);
2731
+ }
2732
+ const config = typeCheckConfig(untrustedConfig);
2733
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
2734
+ return null;
2735
+ }
2736
+ return config;
2737
+ }
2738
+ function buildNetworkSnapshot(luvio, config, options) {
2739
+ const resourceParams = createResourceParams(config);
2740
+ const request = createResourceRequest(resourceParams);
2741
+ return luvio.dispatchResourceRequest(request, options)
2742
+ .then((response) => {
2743
+ return luvio.handleSuccessResponse(() => {
2744
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
2745
+ return luvio.storeBroadcast().then(() => snapshot);
2746
+ }, () => {
2747
+ const cache = new StoreKeyMap();
2748
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
2749
+ return cache;
2750
+ });
2751
+ }, (response) => {
2752
+ deepFreeze(response);
2753
+ throw response;
2754
+ });
2755
+ }
2756
+ const generateInsightsAdapterFactory = (luvio) => {
2757
+ return function generateInsights(untrustedConfig) {
2758
+ const config = validateAdapterConfig(untrustedConfig, generateInsights_ConfigPropertyNames);
2759
+ // Invalid or incomplete config
2760
+ if (config === null) {
2761
+ throw new Error('Invalid config for "generateInsights"');
2762
+ }
2763
+ return buildNetworkSnapshot(luvio, config);
2764
+ };
2765
+ };
2766
+
2767
+ export { createInsightsBatchAdapterFactory, generateInsightsAdapterFactory, getInsightsBatchAdapterFactory, getMetricFilterValuesAdapterFactory };