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