@salesforce/lds-adapters-sfap-analytics-insights 0.1.0-dev1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/sfap-analytics-insights.js +3750 -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 +20 -0
  5. package/dist/es/es2018/types/src/generated/adapters/generateInsights.d.ts +22 -0
  6. package/dist/es/es2018/types/src/generated/adapters/generateInsightsBasic.d.ts +22 -0
  7. package/dist/es/es2018/types/src/generated/adapters/getInsightsBatch.d.ts +30 -0
  8. package/dist/es/es2018/types/src/generated/adapters/getMetricFilterValues.d.ts +27 -0
  9. package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +5 -0
  10. package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +8 -0
  11. package/dist/es/es2018/types/src/generated/resources/getAnalyticsInsightsV1BatchesByBatchId.d.ts +20 -0
  12. package/dist/es/es2018/types/src/generated/resources/postAnalyticsInsightsV1BasicGenerateBundle.d.ts +21 -0
  13. package/dist/es/es2018/types/src/generated/resources/postAnalyticsInsightsV1Batches.d.ts +19 -0
  14. package/dist/es/es2018/types/src/generated/resources/postAnalyticsInsightsV1FilterValues.d.ts +26 -0
  15. package/dist/es/es2018/types/src/generated/resources/postAnalyticsInsightsV1GenerateBundle.d.ts +21 -0
  16. package/dist/es/es2018/types/src/generated/types/BatchInput.d.ts +31 -0
  17. package/dist/es/es2018/types/src/generated/types/BatchOptions.d.ts +36 -0
  18. package/dist/es/es2018/types/src/generated/types/CategoricalFilterOptions.d.ts +32 -0
  19. package/dist/es/es2018/types/src/generated/types/CompareConfig.d.ts +27 -0
  20. package/dist/es/es2018/types/src/generated/types/Error.d.ts +29 -0
  21. package/dist/es/es2018/types/src/generated/types/ExtensionOptions.d.ts +29 -0
  22. package/dist/es/es2018/types/src/generated/types/FieldId.d.ts +31 -0
  23. package/dist/es/es2018/types/src/generated/types/Filter.d.ts +45 -0
  24. package/dist/es/es2018/types/src/generated/types/FlattenFilter.d.ts +32 -0
  25. package/dist/es/es2018/types/src/generated/types/GenerateInsightBatchRequest.d.ts +33 -0
  26. package/dist/es/es2018/types/src/generated/types/GenerateInsightBatchResponse.d.ts +48 -0
  27. package/dist/es/es2018/types/src/generated/types/GenerateInsightBundleRequest.d.ts +37 -0
  28. package/dist/es/es2018/types/src/generated/types/GenerateInsightBundleResponse.d.ts +51 -0
  29. package/dist/es/es2018/types/src/generated/types/GenerateInsightBundleV2Request.d.ts +47 -0
  30. package/dist/es/es2018/types/src/generated/types/GetFilterValuesRequest.d.ts +46 -0
  31. package/dist/es/es2018/types/src/generated/types/GetFilterValuesResponse.d.ts +43 -0
  32. package/dist/es/es2018/types/src/generated/types/GetFilterValuesResponse_CategoricalValues.d.ts +29 -0
  33. package/dist/es/es2018/types/src/generated/types/GetInsightBatchResponse.d.ts +61 -0
  34. package/dist/es/es2018/types/src/generated/types/GoalMetadata.d.ts +30 -0
  35. package/dist/es/es2018/types/src/generated/types/GoalMetadata_StatusCondition.d.ts +37 -0
  36. package/dist/es/es2018/types/src/generated/types/InputMetric.d.ts +43 -0
  37. package/dist/es/es2018/types/src/generated/types/Insight.d.ts +46 -0
  38. package/dist/es/es2018/types/src/generated/types/InsightBundle.d.ts +35 -0
  39. package/dist/es/es2018/types/src/generated/types/InsightBundleInput.d.ts +31 -0
  40. package/dist/es/es2018/types/src/generated/types/InsightBundleOptions.d.ts +40 -0
  41. package/dist/es/es2018/types/src/generated/types/InsightFeedbackMetadata.d.ts +31 -0
  42. package/dist/es/es2018/types/src/generated/types/InsightGroup.d.ts +36 -0
  43. package/dist/es/es2018/types/src/generated/types/InsightResponse.d.ts +33 -0
  44. package/dist/es/es2018/types/src/generated/types/InsightsOptions.d.ts +28 -0
  45. package/dist/es/es2018/types/src/generated/types/InsightsOptions_InsightSetting.d.ts +29 -0
  46. package/dist/es/es2018/types/src/generated/types/Measure.d.ts +30 -0
  47. package/dist/es/es2018/types/src/generated/types/MeasurementPeriod.d.ts +35 -0
  48. package/dist/es/es2018/types/src/generated/types/MetricDefinition.d.ts +46 -0
  49. package/dist/es/es2018/types/src/generated/types/MetricInstance.d.ts +38 -0
  50. package/dist/es/es2018/types/src/generated/types/MetricInstanceInput.d.ts +32 -0
  51. package/dist/es/es2018/types/src/generated/types/MetricMetadata.d.ts +29 -0
  52. package/dist/es/es2018/types/src/generated/types/Overview.d.ts +30 -0
  53. package/dist/es/es2018/types/src/generated/types/OverviewResponse.d.ts +31 -0
  54. package/dist/es/es2018/types/src/generated/types/RangeFilterOptions.d.ts +35 -0
  55. package/dist/es/es2018/types/src/generated/types/RelativeDate.d.ts +49 -0
  56. package/dist/es/es2018/types/src/generated/types/RelativeDateFilterOptions.d.ts +25 -0
  57. package/dist/es/es2018/types/src/generated/types/RelativePeriod.d.ts +29 -0
  58. package/dist/es/es2018/types/src/generated/types/RepresentationOptions.d.ts +32 -0
  59. package/dist/es/es2018/types/src/generated/types/RepresentationOptions_NumberUnits.d.ts +29 -0
  60. package/dist/es/es2018/types/src/generated/types/SemanticDataModel.d.ts +27 -0
  61. package/dist/es/es2018/types/src/generated/types/SemanticFilter.d.ts +37 -0
  62. package/dist/es/es2018/types/src/generated/types/Status.d.ts +32 -0
  63. package/dist/es/es2018/types/src/generated/types/SummarizationOptions.d.ts +28 -0
  64. package/dist/es/es2018/types/src/generated/types/Summary.d.ts +37 -0
  65. package/dist/es/es2018/types/src/generated/types/SummaryResponse.d.ts +31 -0
  66. package/dist/es/es2018/types/src/generated/types/TimeDimension.d.ts +28 -0
  67. package/dist/es/es2018/types/src/generated/types/UnifiedFilter.d.ts +33 -0
  68. package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
  69. package/package.json +66 -0
  70. package/sfdc/index.d.ts +1 -0
  71. package/sfdc/index.js +3847 -0
  72. package/src/raml/api.raml +1198 -0
  73. package/src/raml/luvio.raml +53 -0
package/sfdc/index.js ADDED
@@ -0,0 +1,3847 @@
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$5, typeCheckConfig as typeCheckConfig$5, 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$I(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$H(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$G(obj, path = 'GoalMetadata_StatusCondition') {
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.color !== undefined) {
164
+ const obj_color = obj.color;
165
+ const path_color = path + '.color';
166
+ if (typeof obj_color !== 'string') {
167
+ return new TypeError('Expected "string" but received "' + typeof obj_color + '" (at "' + path_color + '")');
168
+ }
169
+ }
170
+ if (obj.currencyIsoCode !== undefined) {
171
+ const obj_currencyIsoCode = obj.currencyIsoCode;
172
+ const path_currencyIsoCode = path + '.currencyIsoCode';
173
+ if (typeof obj_currencyIsoCode !== 'string') {
174
+ return new TypeError('Expected "string" but received "' + typeof obj_currencyIsoCode + '" (at "' + path_currencyIsoCode + '")');
175
+ }
176
+ }
177
+ if (obj.operator !== undefined) {
178
+ const obj_operator = obj.operator;
179
+ const path_operator = path + '.operator';
180
+ if (typeof obj_operator !== 'string') {
181
+ return new TypeError('Expected "string" but received "' + typeof obj_operator + '" (at "' + path_operator + '")');
182
+ }
183
+ }
184
+ if (obj.primary !== undefined) {
185
+ const obj_primary = obj.primary;
186
+ const path_primary = path + '.primary';
187
+ if (typeof obj_primary !== 'boolean') {
188
+ return new TypeError('Expected "boolean" but received "' + typeof obj_primary + '" (at "' + path_primary + '")');
189
+ }
190
+ }
191
+ if (obj.statusName !== undefined) {
192
+ const obj_statusName = obj.statusName;
193
+ const path_statusName = path + '.statusName';
194
+ if (typeof obj_statusName !== 'string') {
195
+ return new TypeError('Expected "string" but received "' + typeof obj_statusName + '" (at "' + path_statusName + '")');
196
+ }
197
+ }
198
+ if (obj.value !== undefined) {
199
+ const obj_value = obj.value;
200
+ const path_value = path + '.value';
201
+ if (typeof obj_value !== 'string') {
202
+ return new TypeError('Expected "string" but received "' + typeof obj_value + '" (at "' + path_value + '")');
203
+ }
204
+ }
205
+ })();
206
+ return v_error === undefined ? null : v_error;
207
+ }
208
+
209
+ function validate$F(obj, path = 'GoalMetadata') {
210
+ const v_error = (() => {
211
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
212
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
213
+ }
214
+ if (obj.forecasting !== undefined) {
215
+ const obj_forecasting = obj.forecasting;
216
+ const path_forecasting = path + '.forecasting';
217
+ if (typeof obj_forecasting !== 'boolean') {
218
+ return new TypeError('Expected "boolean" but received "' + typeof obj_forecasting + '" (at "' + path_forecasting + '")');
219
+ }
220
+ }
221
+ if (obj.statusConditions !== undefined) {
222
+ const obj_statusConditions = obj.statusConditions;
223
+ const path_statusConditions = path + '.statusConditions';
224
+ if (!ArrayIsArray(obj_statusConditions)) {
225
+ return new TypeError('Expected "array" but received "' + typeof obj_statusConditions + '" (at "' + path_statusConditions + '")');
226
+ }
227
+ for (let i = 0; i < obj_statusConditions.length; i++) {
228
+ const obj_statusConditions_item = obj_statusConditions[i];
229
+ const path_statusConditions_item = path_statusConditions + '[' + i + ']';
230
+ const referencepath_statusConditions_itemValidationError = validate$G(obj_statusConditions_item, path_statusConditions_item);
231
+ if (referencepath_statusConditions_itemValidationError !== null) {
232
+ let message = 'Object doesn\'t match GoalMetadata_StatusCondition (at "' + path_statusConditions_item + '")\n';
233
+ message += referencepath_statusConditions_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
234
+ return new TypeError(message);
235
+ }
236
+ }
237
+ }
238
+ })();
239
+ return v_error === undefined ? null : v_error;
240
+ }
241
+
242
+ function validate$E(obj, path = 'InsightsOptions_InsightSetting') {
243
+ const v_error = (() => {
244
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
245
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
246
+ }
247
+ if (obj.disabled !== undefined) {
248
+ const obj_disabled = obj.disabled;
249
+ const path_disabled = path + '.disabled';
250
+ if (typeof obj_disabled !== 'boolean') {
251
+ return new TypeError('Expected "boolean" but received "' + typeof obj_disabled + '" (at "' + path_disabled + '")');
252
+ }
253
+ }
254
+ if (obj.type !== undefined) {
255
+ const obj_type = obj.type;
256
+ const path_type = path + '.type';
257
+ if (typeof obj_type !== 'string') {
258
+ return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
259
+ }
260
+ }
261
+ })();
262
+ return v_error === undefined ? null : v_error;
263
+ }
264
+
265
+ function validate$D(obj, path = 'InsightsOptions') {
266
+ const v_error = (() => {
267
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
268
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
269
+ }
270
+ if (obj.settings !== undefined) {
271
+ const obj_settings = obj.settings;
272
+ const path_settings = path + '.settings';
273
+ if (!ArrayIsArray(obj_settings)) {
274
+ return new TypeError('Expected "array" but received "' + typeof obj_settings + '" (at "' + path_settings + '")');
275
+ }
276
+ for (let i = 0; i < obj_settings.length; i++) {
277
+ const obj_settings_item = obj_settings[i];
278
+ const path_settings_item = path_settings + '[' + i + ']';
279
+ const referencepath_settings_itemValidationError = validate$E(obj_settings_item, path_settings_item);
280
+ if (referencepath_settings_itemValidationError !== null) {
281
+ let message = 'Object doesn\'t match InsightsOptions_InsightSetting (at "' + path_settings_item + '")\n';
282
+ message += referencepath_settings_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
283
+ return new TypeError(message);
284
+ }
285
+ }
286
+ }
287
+ })();
288
+ return v_error === undefined ? null : v_error;
289
+ }
290
+
291
+ function validate$C(obj, path = 'CategoricalFilterOptions') {
292
+ const v_error = (() => {
293
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
294
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
295
+ }
296
+ if (obj.nullOption !== undefined) {
297
+ const obj_nullOption = obj.nullOption;
298
+ const path_nullOption = path + '.nullOption';
299
+ if (typeof obj_nullOption !== 'string') {
300
+ return new TypeError('Expected "string" but received "' + typeof obj_nullOption + '" (at "' + path_nullOption + '")');
301
+ }
302
+ }
303
+ if (obj.operator !== undefined) {
304
+ const obj_operator = obj.operator;
305
+ const path_operator = path + '.operator';
306
+ if (typeof obj_operator !== 'string') {
307
+ return new TypeError('Expected "string" but received "' + typeof obj_operator + '" (at "' + path_operator + '")');
308
+ }
309
+ }
310
+ if (obj.values !== undefined) {
311
+ const obj_values = obj.values;
312
+ const path_values = path + '.values';
313
+ if (!ArrayIsArray(obj_values)) {
314
+ return new TypeError('Expected "array" but received "' + typeof obj_values + '" (at "' + path_values + '")');
315
+ }
316
+ for (let i = 0; i < obj_values.length; i++) {
317
+ const obj_values_item = obj_values[i];
318
+ const path_values_item = path_values + '[' + i + ']';
319
+ if (obj_values_item === undefined) {
320
+ return new TypeError('Expected "defined" but received "' + typeof obj_values_item + '" (at "' + path_values_item + '")');
321
+ }
322
+ }
323
+ }
324
+ })();
325
+ return v_error === undefined ? null : v_error;
326
+ }
327
+
328
+ function validate$B(obj, path = 'FieldId') {
329
+ const v_error = (() => {
330
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
331
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
332
+ }
333
+ if (obj.datasource !== undefined) {
334
+ const obj_datasource = obj.datasource;
335
+ const path_datasource = path + '.datasource';
336
+ if (typeof obj_datasource !== 'string') {
337
+ return new TypeError('Expected "string" but received "' + typeof obj_datasource + '" (at "' + path_datasource + '")');
338
+ }
339
+ }
340
+ if (obj.fieldName !== undefined) {
341
+ const obj_fieldName = obj.fieldName;
342
+ const path_fieldName = path + '.fieldName';
343
+ if (typeof obj_fieldName !== 'string') {
344
+ return new TypeError('Expected "string" but received "' + typeof obj_fieldName + '" (at "' + path_fieldName + '")');
345
+ }
346
+ }
347
+ if (obj.objectName !== undefined) {
348
+ const obj_objectName = obj.objectName;
349
+ const path_objectName = path + '.objectName';
350
+ if (typeof obj_objectName !== 'string') {
351
+ return new TypeError('Expected "string" but received "' + typeof obj_objectName + '" (at "' + path_objectName + '")');
352
+ }
353
+ }
354
+ })();
355
+ return v_error === undefined ? null : v_error;
356
+ }
357
+
358
+ function validate$A(obj, path = 'RangeFilterOptions') {
359
+ const v_error = (() => {
360
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
361
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
362
+ }
363
+ if (obj.excludeMax !== undefined) {
364
+ const obj_excludeMax = obj.excludeMax;
365
+ const path_excludeMax = path + '.excludeMax';
366
+ if (typeof obj_excludeMax !== 'boolean') {
367
+ return new TypeError('Expected "boolean" but received "' + typeof obj_excludeMax + '" (at "' + path_excludeMax + '")');
368
+ }
369
+ }
370
+ if (obj.excludeMin !== undefined) {
371
+ const obj_excludeMin = obj.excludeMin;
372
+ const path_excludeMin = path + '.excludeMin';
373
+ if (typeof obj_excludeMin !== 'boolean') {
374
+ return new TypeError('Expected "boolean" but received "' + typeof obj_excludeMin + '" (at "' + path_excludeMin + '")');
375
+ }
376
+ }
377
+ if (obj.max !== undefined) {
378
+ const obj_max = obj.max;
379
+ const path_max = path + '.max';
380
+ if (obj_max === undefined) {
381
+ return new TypeError('Expected "defined" but received "' + typeof obj_max + '" (at "' + path_max + '")');
382
+ }
383
+ }
384
+ if (obj.min !== undefined) {
385
+ const obj_min = obj.min;
386
+ const path_min = path + '.min';
387
+ if (obj_min === undefined) {
388
+ return new TypeError('Expected "defined" but received "' + typeof obj_min + '" (at "' + path_min + '")');
389
+ }
390
+ }
391
+ if (obj.nullOption !== undefined) {
392
+ const obj_nullOption = obj.nullOption;
393
+ const path_nullOption = path + '.nullOption';
394
+ if (typeof obj_nullOption !== 'string') {
395
+ return new TypeError('Expected "string" but received "' + typeof obj_nullOption + '" (at "' + path_nullOption + '")');
396
+ }
397
+ }
398
+ })();
399
+ return v_error === undefined ? null : v_error;
400
+ }
401
+
402
+ function validate$z(obj, path = 'RelativeDateFilterOptions') {
403
+ const v_error = (() => {
404
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
405
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
406
+ }
407
+ })();
408
+ return v_error === undefined ? null : v_error;
409
+ }
410
+
411
+ function validate$y(obj, path = 'Filter') {
412
+ const v_error = (() => {
413
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
414
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
415
+ }
416
+ if (obj.categoricalFilterOptions !== undefined) {
417
+ const obj_categoricalFilterOptions = obj.categoricalFilterOptions;
418
+ const path_categoricalFilterOptions = path + '.categoricalFilterOptions';
419
+ const referencepath_categoricalFilterOptionsValidationError = validate$C(obj_categoricalFilterOptions, path_categoricalFilterOptions);
420
+ if (referencepath_categoricalFilterOptionsValidationError !== null) {
421
+ let message = 'Object doesn\'t match CategoricalFilterOptions (at "' + path_categoricalFilterOptions + '")\n';
422
+ message += referencepath_categoricalFilterOptionsValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
423
+ return new TypeError(message);
424
+ }
425
+ }
426
+ if (obj.field !== undefined) {
427
+ const obj_field = obj.field;
428
+ const path_field = path + '.field';
429
+ const referencepath_fieldValidationError = validate$B(obj_field, path_field);
430
+ if (referencepath_fieldValidationError !== null) {
431
+ let message = 'Object doesn\'t match FieldId (at "' + path_field + '")\n';
432
+ message += referencepath_fieldValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
433
+ return new TypeError(message);
434
+ }
435
+ }
436
+ if (obj.fieldId !== undefined) {
437
+ const obj_fieldId = obj.fieldId;
438
+ const path_fieldId = path + '.fieldId';
439
+ const referencepath_fieldIdValidationError = validate$B(obj_fieldId, path_fieldId);
440
+ if (referencepath_fieldIdValidationError !== null) {
441
+ let message = 'Object doesn\'t match FieldId (at "' + path_fieldId + '")\n';
442
+ message += referencepath_fieldIdValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
443
+ return new TypeError(message);
444
+ }
445
+ }
446
+ if (obj.rangeFilterOptions !== undefined) {
447
+ const obj_rangeFilterOptions = obj.rangeFilterOptions;
448
+ const path_rangeFilterOptions = path + '.rangeFilterOptions';
449
+ const referencepath_rangeFilterOptionsValidationError = validate$A(obj_rangeFilterOptions, path_rangeFilterOptions);
450
+ if (referencepath_rangeFilterOptionsValidationError !== null) {
451
+ let message = 'Object doesn\'t match RangeFilterOptions (at "' + path_rangeFilterOptions + '")\n';
452
+ message += referencepath_rangeFilterOptionsValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
453
+ return new TypeError(message);
454
+ }
455
+ }
456
+ if (obj.relativeDateFilterOptions !== undefined) {
457
+ const obj_relativeDateFilterOptions = obj.relativeDateFilterOptions;
458
+ const path_relativeDateFilterOptions = path + '.relativeDateFilterOptions';
459
+ const referencepath_relativeDateFilterOptionsValidationError = validate$z(obj_relativeDateFilterOptions, path_relativeDateFilterOptions);
460
+ if (referencepath_relativeDateFilterOptionsValidationError !== null) {
461
+ let message = 'Object doesn\'t match RelativeDateFilterOptions (at "' + path_relativeDateFilterOptions + '")\n';
462
+ message += referencepath_relativeDateFilterOptionsValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
463
+ return new TypeError(message);
464
+ }
465
+ }
466
+ if (obj.type !== undefined) {
467
+ const obj_type = obj.type;
468
+ const path_type = path + '.type';
469
+ if (typeof obj_type !== 'string') {
470
+ return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
471
+ }
472
+ }
473
+ })();
474
+ return v_error === undefined ? null : v_error;
475
+ }
476
+
477
+ function validate$x(obj, path = 'SemanticFilter') {
478
+ const v_error = (() => {
479
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
480
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
481
+ }
482
+ if (obj.aggregationMethod !== undefined) {
483
+ const obj_aggregationMethod = obj.aggregationMethod;
484
+ const path_aggregationMethod = path + '.aggregationMethod';
485
+ if (typeof obj_aggregationMethod !== 'string') {
486
+ return new TypeError('Expected "string" but received "' + typeof obj_aggregationMethod + '" (at "' + path_aggregationMethod + '")');
487
+ }
488
+ }
489
+ const obj_fieldName = obj.fieldName;
490
+ const path_fieldName = path + '.fieldName';
491
+ if (typeof obj_fieldName !== 'string') {
492
+ return new TypeError('Expected "string" but received "' + typeof obj_fieldName + '" (at "' + path_fieldName + '")');
493
+ }
494
+ if (obj.fieldType !== undefined) {
495
+ const obj_fieldType = obj.fieldType;
496
+ const path_fieldType = path + '.fieldType';
497
+ if (typeof obj_fieldType !== 'string') {
498
+ return new TypeError('Expected "string" but received "' + typeof obj_fieldType + '" (at "' + path_fieldType + '")');
499
+ }
500
+ }
501
+ const obj_operator = obj.operator;
502
+ const path_operator = path + '.operator';
503
+ if (typeof obj_operator !== 'string') {
504
+ return new TypeError('Expected "string" but received "' + typeof obj_operator + '" (at "' + path_operator + '")');
505
+ }
506
+ if (obj.value !== undefined) {
507
+ const obj_value = obj.value;
508
+ const path_value = path + '.value';
509
+ if (typeof obj_value !== 'string') {
510
+ return new TypeError('Expected "string" but received "' + typeof obj_value + '" (at "' + path_value + '")');
511
+ }
512
+ }
513
+ if (obj.values !== undefined) {
514
+ const obj_values = obj.values;
515
+ const path_values = path + '.values';
516
+ if (!ArrayIsArray(obj_values)) {
517
+ return new TypeError('Expected "array" but received "' + typeof obj_values + '" (at "' + path_values + '")');
518
+ }
519
+ for (let i = 0; i < obj_values.length; i++) {
520
+ const obj_values_item = obj_values[i];
521
+ const path_values_item = path_values + '[' + i + ']';
522
+ if (typeof obj_values_item !== 'string') {
523
+ return new TypeError('Expected "string" but received "' + typeof obj_values_item + '" (at "' + path_values_item + '")');
524
+ }
525
+ }
526
+ }
527
+ })();
528
+ return v_error === undefined ? null : v_error;
529
+ }
530
+
531
+ function validate$w(obj, path = 'FlattenFilter') {
532
+ const v_error = (() => {
533
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
534
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
535
+ }
536
+ if (obj.filterLogic !== undefined) {
537
+ const obj_filterLogic = obj.filterLogic;
538
+ const path_filterLogic = path + '.filterLogic';
539
+ if (typeof obj_filterLogic !== 'string') {
540
+ return new TypeError('Expected "string" but received "' + typeof obj_filterLogic + '" (at "' + path_filterLogic + '")');
541
+ }
542
+ }
543
+ if (obj.filters !== undefined) {
544
+ const obj_filters = obj.filters;
545
+ const path_filters = path + '.filters';
546
+ if (!ArrayIsArray(obj_filters)) {
547
+ return new TypeError('Expected "array" but received "' + typeof obj_filters + '" (at "' + path_filters + '")');
548
+ }
549
+ for (let i = 0; i < obj_filters.length; i++) {
550
+ const obj_filters_item = obj_filters[i];
551
+ const path_filters_item = path_filters + '[' + i + ']';
552
+ const referencepath_filters_itemValidationError = validate$x(obj_filters_item, path_filters_item);
553
+ if (referencepath_filters_itemValidationError !== null) {
554
+ let message = 'Object doesn\'t match SemanticFilter (at "' + path_filters_item + '")\n';
555
+ message += referencepath_filters_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
556
+ return new TypeError(message);
557
+ }
558
+ }
559
+ }
560
+ })();
561
+ return v_error === undefined ? null : v_error;
562
+ }
563
+
564
+ function validate$v(obj, path = 'MetricInstance') {
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.filters !== undefined) {
570
+ const obj_filters = obj.filters;
571
+ const path_filters = path + '.filters';
572
+ if (!ArrayIsArray(obj_filters)) {
573
+ return new TypeError('Expected "array" but received "' + typeof obj_filters + '" (at "' + path_filters + '")');
574
+ }
575
+ for (let i = 0; i < obj_filters.length; i++) {
576
+ const obj_filters_item = obj_filters[i];
577
+ const path_filters_item = path_filters + '[' + i + ']';
578
+ const referencepath_filters_itemValidationError = validate$y(obj_filters_item, path_filters_item);
579
+ if (referencepath_filters_itemValidationError !== null) {
580
+ let message = 'Object doesn\'t match Filter (at "' + path_filters_item + '")\n';
581
+ message += referencepath_filters_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
582
+ return new TypeError(message);
583
+ }
584
+ }
585
+ }
586
+ if (obj.goals !== undefined) {
587
+ const obj_goals = obj.goals;
588
+ const path_goals = path + '.goals';
589
+ const referencepath_goalsValidationError = validate$F(obj_goals, path_goals);
590
+ if (referencepath_goalsValidationError !== null) {
591
+ let message = 'Object doesn\'t match GoalMetadata (at "' + path_goals + '")\n';
592
+ message += referencepath_goalsValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
593
+ return new TypeError(message);
594
+ }
595
+ }
596
+ if (obj.measurementPeriod !== undefined) {
597
+ const obj_measurementPeriod = obj.measurementPeriod;
598
+ const path_measurementPeriod = path + '.measurementPeriod';
599
+ if (obj_measurementPeriod === undefined) {
600
+ return new TypeError('Expected "defined" but received "' + typeof obj_measurementPeriod + '" (at "' + path_measurementPeriod + '")');
601
+ }
602
+ }
603
+ if (obj.semanticFilter !== undefined) {
604
+ const obj_semanticFilter = obj.semanticFilter;
605
+ const path_semanticFilter = path + '.semanticFilter';
606
+ const referencepath_semanticFilterValidationError = validate$w(obj_semanticFilter, path_semanticFilter);
607
+ if (referencepath_semanticFilterValidationError !== null) {
608
+ let message = 'Object doesn\'t match FlattenFilter (at "' + path_semanticFilter + '")\n';
609
+ message += referencepath_semanticFilterValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
610
+ return new TypeError(message);
611
+ }
612
+ }
613
+ })();
614
+ return v_error === undefined ? null : v_error;
615
+ }
616
+
617
+ function validate$u(obj, path = 'CompareConfig') {
618
+ const v_error = (() => {
619
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
620
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
621
+ }
622
+ if (obj.comparison !== undefined) {
623
+ const obj_comparison = obj.comparison;
624
+ const path_comparison = path + '.comparison';
625
+ if (typeof obj_comparison !== 'string') {
626
+ return new TypeError('Expected "string" but received "' + typeof obj_comparison + '" (at "' + path_comparison + '")');
627
+ }
628
+ }
629
+ })();
630
+ return v_error === undefined ? null : v_error;
631
+ }
632
+
633
+ function validate$t(obj, path = 'Measure') {
634
+ const v_error = (() => {
635
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
636
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
637
+ }
638
+ if (obj.aggregation !== undefined) {
639
+ const obj_aggregation = obj.aggregation;
640
+ const path_aggregation = path + '.aggregation';
641
+ if (typeof obj_aggregation !== 'string') {
642
+ return new TypeError('Expected "string" but received "' + typeof obj_aggregation + '" (at "' + path_aggregation + '")');
643
+ }
644
+ }
645
+ const obj_field = obj.field;
646
+ const path_field = path + '.field';
647
+ const referencepath_fieldValidationError = validate$B(obj_field, path_field);
648
+ if (referencepath_fieldValidationError !== null) {
649
+ let message = 'Object doesn\'t match FieldId (at "' + path_field + '")\n';
650
+ message += referencepath_fieldValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
651
+ return new TypeError(message);
652
+ }
653
+ })();
654
+ return v_error === undefined ? null : v_error;
655
+ }
656
+
657
+ function validate$s(obj, path = 'SemanticDataModel') {
658
+ const v_error = (() => {
659
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
660
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
661
+ }
662
+ if (obj.apiName !== undefined) {
663
+ const obj_apiName = obj.apiName;
664
+ const path_apiName = path + '.apiName';
665
+ if (typeof obj_apiName !== 'string') {
666
+ return new TypeError('Expected "string" but received "' + typeof obj_apiName + '" (at "' + path_apiName + '")');
667
+ }
668
+ }
669
+ })();
670
+ return v_error === undefined ? null : v_error;
671
+ }
672
+
673
+ function validate$r(obj, path = 'TimeDimension') {
674
+ const v_error = (() => {
675
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
676
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
677
+ }
678
+ const obj_field = obj.field;
679
+ const path_field = path + '.field';
680
+ const referencepath_fieldValidationError = validate$B(obj_field, path_field);
681
+ if (referencepath_fieldValidationError !== null) {
682
+ let message = 'Object doesn\'t match FieldId (at "' + path_field + '")\n';
683
+ message += referencepath_fieldValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
684
+ return new TypeError(message);
685
+ }
686
+ })();
687
+ return v_error === undefined ? null : v_error;
688
+ }
689
+
690
+ function validate$q(obj, path = 'MetricDefinition') {
691
+ const v_error = (() => {
692
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
693
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
694
+ }
695
+ const obj_comparison = obj.comparison;
696
+ const path_comparison = path + '.comparison';
697
+ const referencepath_comparisonValidationError = validate$u(obj_comparison, path_comparison);
698
+ if (referencepath_comparisonValidationError !== null) {
699
+ let message = 'Object doesn\'t match CompareConfig (at "' + path_comparison + '")\n';
700
+ message += referencepath_comparisonValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
701
+ return new TypeError(message);
702
+ }
703
+ if (obj.filters !== undefined) {
704
+ const obj_filters = obj.filters;
705
+ const path_filters = path + '.filters';
706
+ if (!ArrayIsArray(obj_filters)) {
707
+ return new TypeError('Expected "array" but received "' + typeof obj_filters + '" (at "' + path_filters + '")');
708
+ }
709
+ for (let i = 0; i < obj_filters.length; i++) {
710
+ const obj_filters_item = obj_filters[i];
711
+ const path_filters_item = path_filters + '[' + i + ']';
712
+ const referencepath_filters_itemValidationError = validate$y(obj_filters_item, path_filters_item);
713
+ if (referencepath_filters_itemValidationError !== null) {
714
+ let message = 'Object doesn\'t match Filter (at "' + path_filters_item + '")\n';
715
+ message += referencepath_filters_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
716
+ return new TypeError(message);
717
+ }
718
+ }
719
+ }
720
+ const obj_measure = obj.measure;
721
+ const path_measure = path + '.measure';
722
+ const referencepath_measureValidationError = validate$t(obj_measure, path_measure);
723
+ if (referencepath_measureValidationError !== null) {
724
+ let message = 'Object doesn\'t match Measure (at "' + path_measure + '")\n';
725
+ message += referencepath_measureValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
726
+ return new TypeError(message);
727
+ }
728
+ if (obj.runningTotal !== undefined) {
729
+ const obj_runningTotal = obj.runningTotal;
730
+ const path_runningTotal = path + '.runningTotal';
731
+ if (typeof obj_runningTotal !== 'boolean') {
732
+ return new TypeError('Expected "boolean" but received "' + typeof obj_runningTotal + '" (at "' + path_runningTotal + '")');
733
+ }
734
+ }
735
+ const obj_semanticDataModel = obj.semanticDataModel;
736
+ const path_semanticDataModel = path + '.semanticDataModel';
737
+ const referencepath_semanticDataModelValidationError = validate$s(obj_semanticDataModel, path_semanticDataModel);
738
+ if (referencepath_semanticDataModelValidationError !== null) {
739
+ let message = 'Object doesn\'t match SemanticDataModel (at "' + path_semanticDataModel + '")\n';
740
+ message += referencepath_semanticDataModelValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
741
+ return new TypeError(message);
742
+ }
743
+ if (obj.semanticFilter !== undefined) {
744
+ const obj_semanticFilter = obj.semanticFilter;
745
+ const path_semanticFilter = path + '.semanticFilter';
746
+ const referencepath_semanticFilterValidationError = validate$w(obj_semanticFilter, path_semanticFilter);
747
+ if (referencepath_semanticFilterValidationError !== null) {
748
+ let message = 'Object doesn\'t match FlattenFilter (at "' + path_semanticFilter + '")\n';
749
+ message += referencepath_semanticFilterValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
750
+ return new TypeError(message);
751
+ }
752
+ }
753
+ const obj_timeDimension = obj.timeDimension;
754
+ const path_timeDimension = path + '.timeDimension';
755
+ const referencepath_timeDimensionValidationError = validate$r(obj_timeDimension, path_timeDimension);
756
+ if (referencepath_timeDimensionValidationError !== null) {
757
+ let message = 'Object doesn\'t match TimeDimension (at "' + path_timeDimension + '")\n';
758
+ message += referencepath_timeDimensionValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
759
+ return new TypeError(message);
760
+ }
761
+ })();
762
+ return v_error === undefined ? null : v_error;
763
+ }
764
+
765
+ function validate$p(obj, path = 'RepresentationOptions_NumberUnits') {
766
+ const v_error = (() => {
767
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
768
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
769
+ }
770
+ if (obj.pluralNoun !== undefined) {
771
+ const obj_pluralNoun = obj.pluralNoun;
772
+ const path_pluralNoun = path + '.pluralNoun';
773
+ if (typeof obj_pluralNoun !== 'string') {
774
+ return new TypeError('Expected "string" but received "' + typeof obj_pluralNoun + '" (at "' + path_pluralNoun + '")');
775
+ }
776
+ }
777
+ if (obj.singularNoun !== undefined) {
778
+ const obj_singularNoun = obj.singularNoun;
779
+ const path_singularNoun = path + '.singularNoun';
780
+ if (typeof obj_singularNoun !== 'string') {
781
+ return new TypeError('Expected "string" but received "' + typeof obj_singularNoun + '" (at "' + path_singularNoun + '")');
782
+ }
783
+ }
784
+ })();
785
+ return v_error === undefined ? null : v_error;
786
+ }
787
+
788
+ function validate$o(obj, path = 'RepresentationOptions') {
789
+ const v_error = (() => {
790
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
791
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
792
+ }
793
+ const obj_numberUnits = obj.numberUnits;
794
+ const path_numberUnits = path + '.numberUnits';
795
+ const referencepath_numberUnitsValidationError = validate$p(obj_numberUnits, path_numberUnits);
796
+ if (referencepath_numberUnitsValidationError !== null) {
797
+ let message = 'Object doesn\'t match RepresentationOptions_NumberUnits (at "' + path_numberUnits + '")\n';
798
+ message += referencepath_numberUnitsValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
799
+ return new TypeError(message);
800
+ }
801
+ if (obj.sentimentType !== undefined) {
802
+ const obj_sentimentType = obj.sentimentType;
803
+ const path_sentimentType = path + '.sentimentType';
804
+ if (typeof obj_sentimentType !== 'string') {
805
+ return new TypeError('Expected "string" but received "' + typeof obj_sentimentType + '" (at "' + path_sentimentType + '")');
806
+ }
807
+ }
808
+ if (obj.type !== undefined) {
809
+ const obj_type = obj.type;
810
+ const path_type = path + '.type';
811
+ if (typeof obj_type !== 'string') {
812
+ return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
813
+ }
814
+ }
815
+ })();
816
+ return v_error === undefined ? null : v_error;
817
+ }
818
+
819
+ function validate$n(obj, path = 'InputMetric') {
820
+ const v_error = (() => {
821
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
822
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
823
+ }
824
+ const obj_extensionOptions = obj.extensionOptions;
825
+ const path_extensionOptions = path + '.extensionOptions';
826
+ const referencepath_extensionOptionsValidationError = validate$H(obj_extensionOptions, path_extensionOptions);
827
+ if (referencepath_extensionOptionsValidationError !== null) {
828
+ let message = 'Object doesn\'t match ExtensionOptions (at "' + path_extensionOptions + '")\n';
829
+ message += referencepath_extensionOptionsValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
830
+ return new TypeError(message);
831
+ }
832
+ if (obj.goals !== undefined) {
833
+ const obj_goals = obj.goals;
834
+ const path_goals = path + '.goals';
835
+ const referencepath_goalsValidationError = validate$F(obj_goals, path_goals);
836
+ if (referencepath_goalsValidationError !== null) {
837
+ let message = 'Object doesn\'t match GoalMetadata (at "' + path_goals + '")\n';
838
+ message += referencepath_goalsValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
839
+ return new TypeError(message);
840
+ }
841
+ }
842
+ const obj_insightsOptions = obj.insightsOptions;
843
+ const path_insightsOptions = path + '.insightsOptions';
844
+ const referencepath_insightsOptionsValidationError = validate$D(obj_insightsOptions, path_insightsOptions);
845
+ if (referencepath_insightsOptionsValidationError !== null) {
846
+ let message = 'Object doesn\'t match InsightsOptions (at "' + path_insightsOptions + '")\n';
847
+ message += referencepath_insightsOptionsValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
848
+ return new TypeError(message);
849
+ }
850
+ const obj_instance = obj.instance;
851
+ const path_instance = path + '.instance';
852
+ const referencepath_instanceValidationError = validate$v(obj_instance, path_instance);
853
+ if (referencepath_instanceValidationError !== null) {
854
+ let message = 'Object doesn\'t match MetricInstance (at "' + path_instance + '")\n';
855
+ message += referencepath_instanceValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
856
+ return new TypeError(message);
857
+ }
858
+ const obj_metric = obj.metric;
859
+ const path_metric = path + '.metric';
860
+ const referencepath_metricValidationError = validate$q(obj_metric, path_metric);
861
+ if (referencepath_metricValidationError !== null) {
862
+ let message = 'Object doesn\'t match MetricDefinition (at "' + path_metric + '")\n';
863
+ message += referencepath_metricValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
864
+ return new TypeError(message);
865
+ }
866
+ const obj_representationOptions = obj.representationOptions;
867
+ const path_representationOptions = path + '.representationOptions';
868
+ const referencepath_representationOptionsValidationError = validate$o(obj_representationOptions, path_representationOptions);
869
+ if (referencepath_representationOptionsValidationError !== null) {
870
+ let message = 'Object doesn\'t match RepresentationOptions (at "' + path_representationOptions + '")\n';
871
+ message += referencepath_representationOptionsValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
872
+ return new TypeError(message);
873
+ }
874
+ })();
875
+ return v_error === undefined ? null : v_error;
876
+ }
877
+
878
+ function validate$m(obj, path = 'InsightBundleInput') {
879
+ const v_error = (() => {
880
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
881
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
882
+ }
883
+ const obj_metadata = obj.metadata;
884
+ const path_metadata = path + '.metadata';
885
+ const referencepath_metadataValidationError = validate$I(obj_metadata, path_metadata);
886
+ if (referencepath_metadataValidationError !== null) {
887
+ let message = 'Object doesn\'t match MetricMetadata (at "' + path_metadata + '")\n';
888
+ message += referencepath_metadataValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
889
+ return new TypeError(message);
890
+ }
891
+ const obj_metric = obj.metric;
892
+ const path_metric = path + '.metric';
893
+ const referencepath_metricValidationError = validate$n(obj_metric, path_metric);
894
+ if (referencepath_metricValidationError !== null) {
895
+ let message = 'Object doesn\'t match InputMetric (at "' + path_metric + '")\n';
896
+ message += referencepath_metricValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
897
+ return new TypeError(message);
898
+ }
899
+ })();
900
+ return v_error === undefined ? null : v_error;
901
+ }
902
+
903
+ const VERSION$g = "7948f62379bf327a3cc190504223aecc";
904
+ function validate$l(obj, path = 'UnifiedFilter') {
905
+ const v_error = (() => {
906
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
907
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
908
+ }
909
+ if (obj.fieldName !== undefined) {
910
+ const obj_fieldName = obj.fieldName;
911
+ const path_fieldName = path + '.fieldName';
912
+ if (typeof obj_fieldName !== 'string') {
913
+ return new TypeError('Expected "string" but received "' + typeof obj_fieldName + '" (at "' + path_fieldName + '")');
914
+ }
915
+ }
916
+ if (obj.operator !== undefined) {
917
+ const obj_operator = obj.operator;
918
+ const path_operator = path + '.operator';
919
+ if (typeof obj_operator !== 'string') {
920
+ return new TypeError('Expected "string" but received "' + typeof obj_operator + '" (at "' + path_operator + '")');
921
+ }
922
+ }
923
+ if (obj.values !== undefined) {
924
+ const obj_values = obj.values;
925
+ const path_values = path + '.values';
926
+ if (!ArrayIsArray(obj_values)) {
927
+ return new TypeError('Expected "array" but received "' + typeof obj_values + '" (at "' + path_values + '")');
928
+ }
929
+ for (let i = 0; i < obj_values.length; i++) {
930
+ const obj_values_item = obj_values[i];
931
+ const path_values_item = path_values + '[' + i + ']';
932
+ if (obj_values_item === undefined) {
933
+ return new TypeError('Expected "defined" but received "' + typeof obj_values_item + '" (at "' + path_values_item + '")');
934
+ }
935
+ }
936
+ }
937
+ })();
938
+ return v_error === undefined ? null : v_error;
939
+ }
940
+ const select$l = function UnifiedFilterSelect() {
941
+ return {
942
+ kind: 'Fragment',
943
+ version: VERSION$g,
944
+ private: [],
945
+ selections: [
946
+ {
947
+ name: 'fieldName',
948
+ kind: 'Scalar',
949
+ required: false
950
+ },
951
+ {
952
+ name: 'operator',
953
+ kind: 'Scalar',
954
+ required: false
955
+ },
956
+ {
957
+ name: 'values',
958
+ kind: 'Object',
959
+ // any
960
+ }
961
+ ]
962
+ };
963
+ };
964
+ function equals$g(existing, incoming) {
965
+ const existing_fieldName = existing.fieldName;
966
+ const incoming_fieldName = incoming.fieldName;
967
+ // if at least one of these optionals is defined
968
+ if (existing_fieldName !== undefined || incoming_fieldName !== undefined) {
969
+ // if one of these is not defined we know the other is defined and therefore
970
+ // not equal
971
+ if (existing_fieldName === undefined || incoming_fieldName === undefined) {
972
+ return false;
973
+ }
974
+ if (!(existing_fieldName === incoming_fieldName)) {
975
+ return false;
976
+ }
977
+ }
978
+ const existing_operator = existing.operator;
979
+ const incoming_operator = incoming.operator;
980
+ // if at least one of these optionals is defined
981
+ if (existing_operator !== undefined || incoming_operator !== undefined) {
982
+ // if one of these is not defined we know the other is defined and therefore
983
+ // not equal
984
+ if (existing_operator === undefined || incoming_operator === undefined) {
985
+ return false;
986
+ }
987
+ if (!(existing_operator === incoming_operator)) {
988
+ return false;
989
+ }
990
+ }
991
+ const existing_values = existing.values;
992
+ const incoming_values = incoming.values;
993
+ // if at least one of these optionals is defined
994
+ if (existing_values !== undefined || incoming_values !== undefined) {
995
+ // if one of these is not defined we know the other is defined and therefore
996
+ // not equal
997
+ if (existing_values === undefined || incoming_values === undefined) {
998
+ return false;
999
+ }
1000
+ const equals_values_items = equalsArray(existing_values, incoming_values, (existing_values_item, incoming_values_item) => {
1001
+ if (JSONStringify(incoming_values_item) !== JSONStringify(existing_values_item)) {
1002
+ return false;
1003
+ }
1004
+ });
1005
+ if (equals_values_items === false) {
1006
+ return false;
1007
+ }
1008
+ }
1009
+ return true;
1010
+ }
1011
+
1012
+ function validate$k(obj, path = 'MetricInstanceInput') {
1013
+ const v_error = (() => {
1014
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1015
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1016
+ }
1017
+ if (obj.measurementPeriod !== undefined) {
1018
+ const obj_measurementPeriod = obj.measurementPeriod;
1019
+ const path_measurementPeriod = path + '.measurementPeriod';
1020
+ const referencepath_measurementPeriodValidationError = validate$l(obj_measurementPeriod, path_measurementPeriod);
1021
+ if (referencepath_measurementPeriodValidationError !== null) {
1022
+ let message = 'Object doesn\'t match UnifiedFilter (at "' + path_measurementPeriod + '")\n';
1023
+ message += referencepath_measurementPeriodValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1024
+ return new TypeError(message);
1025
+ }
1026
+ }
1027
+ const obj_metricInstanceId = obj.metricInstanceId;
1028
+ const path_metricInstanceId = path + '.metricInstanceId';
1029
+ if (typeof obj_metricInstanceId !== 'string') {
1030
+ return new TypeError('Expected "string" but received "' + typeof obj_metricInstanceId + '" (at "' + path_metricInstanceId + '")');
1031
+ }
1032
+ const obj_sdmId = obj.sdmId;
1033
+ const path_sdmId = path + '.sdmId';
1034
+ if (typeof obj_sdmId !== 'string') {
1035
+ return new TypeError('Expected "string" but received "' + typeof obj_sdmId + '" (at "' + path_sdmId + '")');
1036
+ }
1037
+ })();
1038
+ return v_error === undefined ? null : v_error;
1039
+ }
1040
+
1041
+ function validate$j(obj, path = 'BatchInput') {
1042
+ const v_error = (() => {
1043
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1044
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1045
+ }
1046
+ if (obj.bundleInput !== undefined) {
1047
+ const obj_bundleInput = obj.bundleInput;
1048
+ const path_bundleInput = path + '.bundleInput';
1049
+ const referencepath_bundleInputValidationError = validate$m(obj_bundleInput, path_bundleInput);
1050
+ if (referencepath_bundleInputValidationError !== null) {
1051
+ let message = 'Object doesn\'t match InsightBundleInput (at "' + path_bundleInput + '")\n';
1052
+ message += referencepath_bundleInputValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1053
+ return new TypeError(message);
1054
+ }
1055
+ }
1056
+ if (obj.metricInstanceInput !== undefined) {
1057
+ const obj_metricInstanceInput = obj.metricInstanceInput;
1058
+ const path_metricInstanceInput = path + '.metricInstanceInput';
1059
+ const referencepath_metricInstanceInputValidationError = validate$k(obj_metricInstanceInput, path_metricInstanceInput);
1060
+ if (referencepath_metricInstanceInputValidationError !== null) {
1061
+ let message = 'Object doesn\'t match MetricInstanceInput (at "' + path_metricInstanceInput + '")\n';
1062
+ message += referencepath_metricInstanceInputValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1063
+ return new TypeError(message);
1064
+ }
1065
+ }
1066
+ })();
1067
+ return v_error === undefined ? null : v_error;
1068
+ }
1069
+
1070
+ function validate$i(obj, path = 'InsightBundleOptions') {
1071
+ const v_error = (() => {
1072
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1073
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1074
+ }
1075
+ if (obj.now !== undefined) {
1076
+ const obj_now = obj.now;
1077
+ const path_now = path + '.now';
1078
+ if (typeof obj_now !== 'string') {
1079
+ return new TypeError('Expected "string" but received "' + typeof obj_now + '" (at "' + path_now + '")');
1080
+ }
1081
+ }
1082
+ if (obj.outputFormat !== undefined) {
1083
+ const obj_outputFormat = obj.outputFormat;
1084
+ const path_outputFormat = path + '.outputFormat';
1085
+ if (typeof obj_outputFormat !== 'string') {
1086
+ return new TypeError('Expected "string" but received "' + typeof obj_outputFormat + '" (at "' + path_outputFormat + '")');
1087
+ }
1088
+ }
1089
+ if (obj.timeZone !== undefined) {
1090
+ const obj_timeZone = obj.timeZone;
1091
+ const path_timeZone = path + '.timeZone';
1092
+ if (typeof obj_timeZone !== 'string') {
1093
+ return new TypeError('Expected "string" but received "' + typeof obj_timeZone + '" (at "' + path_timeZone + '")');
1094
+ }
1095
+ }
1096
+ })();
1097
+ return v_error === undefined ? null : v_error;
1098
+ }
1099
+
1100
+ function validate$h(obj, path = 'SummarizationOptions') {
1101
+ const v_error = (() => {
1102
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1103
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1104
+ }
1105
+ if (obj.strategy !== undefined) {
1106
+ const obj_strategy = obj.strategy;
1107
+ const path_strategy = path + '.strategy';
1108
+ if (typeof obj_strategy !== 'string') {
1109
+ return new TypeError('Expected "string" but received "' + typeof obj_strategy + '" (at "' + path_strategy + '")');
1110
+ }
1111
+ }
1112
+ })();
1113
+ return v_error === undefined ? null : v_error;
1114
+ }
1115
+
1116
+ function validate$g(obj, path = 'BatchOptions') {
1117
+ const v_error = (() => {
1118
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1119
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1120
+ }
1121
+ if (obj.bundle !== undefined) {
1122
+ const obj_bundle = obj.bundle;
1123
+ const path_bundle = path + '.bundle';
1124
+ const referencepath_bundleValidationError = validate$i(obj_bundle, path_bundle);
1125
+ if (referencepath_bundleValidationError !== null) {
1126
+ let message = 'Object doesn\'t match InsightBundleOptions (at "' + path_bundle + '")\n';
1127
+ message += referencepath_bundleValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1128
+ return new TypeError(message);
1129
+ }
1130
+ }
1131
+ if (obj.skipCache !== undefined) {
1132
+ const obj_skipCache = obj.skipCache;
1133
+ const path_skipCache = path + '.skipCache';
1134
+ if (typeof obj_skipCache !== 'boolean') {
1135
+ return new TypeError('Expected "boolean" but received "' + typeof obj_skipCache + '" (at "' + path_skipCache + '")');
1136
+ }
1137
+ }
1138
+ if (obj.summarization !== undefined) {
1139
+ const obj_summarization = obj.summarization;
1140
+ const path_summarization = path + '.summarization';
1141
+ const referencepath_summarizationValidationError = validate$h(obj_summarization, path_summarization);
1142
+ if (referencepath_summarizationValidationError !== null) {
1143
+ let message = 'Object doesn\'t match SummarizationOptions (at "' + path_summarization + '")\n';
1144
+ message += referencepath_summarizationValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1145
+ return new TypeError(message);
1146
+ }
1147
+ }
1148
+ })();
1149
+ return v_error === undefined ? null : v_error;
1150
+ }
1151
+
1152
+ const VERSION$f = "07a8c889542dbad6f958515513d4e3fb";
1153
+ function validate$f(obj, path = 'Error') {
1154
+ const v_error = (() => {
1155
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1156
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1157
+ }
1158
+ if (obj.code !== undefined) {
1159
+ const obj_code = obj.code;
1160
+ const path_code = path + '.code';
1161
+ if (typeof obj_code !== 'string') {
1162
+ return new TypeError('Expected "string" but received "' + typeof obj_code + '" (at "' + path_code + '")');
1163
+ }
1164
+ }
1165
+ if (obj.message !== undefined) {
1166
+ const obj_message = obj.message;
1167
+ const path_message = path + '.message';
1168
+ if (typeof obj_message !== 'string') {
1169
+ return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
1170
+ }
1171
+ }
1172
+ })();
1173
+ return v_error === undefined ? null : v_error;
1174
+ }
1175
+ const select$k = function ErrorSelect() {
1176
+ return {
1177
+ kind: 'Fragment',
1178
+ version: VERSION$f,
1179
+ private: [],
1180
+ selections: [
1181
+ {
1182
+ name: 'code',
1183
+ kind: 'Scalar',
1184
+ required: false
1185
+ },
1186
+ {
1187
+ name: 'message',
1188
+ kind: 'Scalar',
1189
+ required: false
1190
+ }
1191
+ ]
1192
+ };
1193
+ };
1194
+ function equals$f(existing, incoming) {
1195
+ const existing_code = existing.code;
1196
+ const incoming_code = incoming.code;
1197
+ // if at least one of these optionals is defined
1198
+ if (existing_code !== undefined || incoming_code !== undefined) {
1199
+ // if one of these is not defined we know the other is defined and therefore
1200
+ // not equal
1201
+ if (existing_code === undefined || incoming_code === undefined) {
1202
+ return false;
1203
+ }
1204
+ if (!(existing_code === incoming_code)) {
1205
+ return false;
1206
+ }
1207
+ }
1208
+ const existing_message = existing.message;
1209
+ const incoming_message = incoming.message;
1210
+ // if at least one of these optionals is defined
1211
+ if (existing_message !== undefined || incoming_message !== undefined) {
1212
+ // if one of these is not defined we know the other is defined and therefore
1213
+ // not equal
1214
+ if (existing_message === undefined || incoming_message === undefined) {
1215
+ return false;
1216
+ }
1217
+ if (!(existing_message === incoming_message)) {
1218
+ return false;
1219
+ }
1220
+ }
1221
+ return true;
1222
+ }
1223
+
1224
+ const VERSION$e = "6e24eb6767cb7eb05e4ae19fffe299b1";
1225
+ function validate$e(obj, path = 'Summary') {
1226
+ const v_error = (() => {
1227
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1228
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1229
+ }
1230
+ if (obj.generationId !== undefined) {
1231
+ const obj_generationId = obj.generationId;
1232
+ const path_generationId = path + '.generationId';
1233
+ if (typeof obj_generationId !== 'string') {
1234
+ return new TypeError('Expected "string" but received "' + typeof obj_generationId + '" (at "' + path_generationId + '")');
1235
+ }
1236
+ }
1237
+ const obj_markup = obj.markup;
1238
+ const path_markup = path + '.markup';
1239
+ if (typeof obj_markup !== 'string') {
1240
+ return new TypeError('Expected "string" but received "' + typeof obj_markup + '" (at "' + path_markup + '")');
1241
+ }
1242
+ const obj_strategy = obj.strategy;
1243
+ const path_strategy = path + '.strategy';
1244
+ if (typeof obj_strategy !== 'string') {
1245
+ return new TypeError('Expected "string" but received "' + typeof obj_strategy + '" (at "' + path_strategy + '")');
1246
+ }
1247
+ const obj_timestamp = obj.timestamp;
1248
+ const path_timestamp = path + '.timestamp';
1249
+ if (typeof obj_timestamp !== 'string') {
1250
+ return new TypeError('Expected "string" but received "' + typeof obj_timestamp + '" (at "' + path_timestamp + '")');
1251
+ }
1252
+ })();
1253
+ return v_error === undefined ? null : v_error;
1254
+ }
1255
+ const select$j = function SummarySelect() {
1256
+ return {
1257
+ kind: 'Fragment',
1258
+ version: VERSION$e,
1259
+ private: [],
1260
+ selections: [
1261
+ {
1262
+ name: 'generationId',
1263
+ kind: 'Scalar',
1264
+ required: false
1265
+ },
1266
+ {
1267
+ name: 'markup',
1268
+ kind: 'Scalar'
1269
+ },
1270
+ {
1271
+ name: 'strategy',
1272
+ kind: 'Scalar'
1273
+ },
1274
+ {
1275
+ name: 'timestamp',
1276
+ kind: 'Scalar'
1277
+ }
1278
+ ]
1279
+ };
1280
+ };
1281
+ function equals$e(existing, incoming) {
1282
+ const existing_generationId = existing.generationId;
1283
+ const incoming_generationId = incoming.generationId;
1284
+ // if at least one of these optionals is defined
1285
+ if (existing_generationId !== undefined || incoming_generationId !== undefined) {
1286
+ // if one of these is not defined we know the other is defined and therefore
1287
+ // not equal
1288
+ if (existing_generationId === undefined || incoming_generationId === undefined) {
1289
+ return false;
1290
+ }
1291
+ if (!(existing_generationId === incoming_generationId)) {
1292
+ return false;
1293
+ }
1294
+ }
1295
+ const existing_markup = existing.markup;
1296
+ const incoming_markup = incoming.markup;
1297
+ if (!(existing_markup === incoming_markup)) {
1298
+ return false;
1299
+ }
1300
+ const existing_strategy = existing.strategy;
1301
+ const incoming_strategy = incoming.strategy;
1302
+ if (!(existing_strategy === incoming_strategy)) {
1303
+ return false;
1304
+ }
1305
+ const existing_timestamp = existing.timestamp;
1306
+ const incoming_timestamp = incoming.timestamp;
1307
+ if (!(existing_timestamp === incoming_timestamp)) {
1308
+ return false;
1309
+ }
1310
+ return true;
1311
+ }
1312
+
1313
+ const VERSION$d = "fc433e1c68019470090193fa4fdf976f";
1314
+ function validate$d(obj, path = 'SummaryResponse') {
1315
+ const v_error = (() => {
1316
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1317
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1318
+ }
1319
+ if (obj.error !== undefined) {
1320
+ const obj_error = obj.error;
1321
+ const path_error = path + '.error';
1322
+ const referencepath_errorValidationError = validate$f(obj_error, path_error);
1323
+ if (referencepath_errorValidationError !== null) {
1324
+ let message = 'Object doesn\'t match Error (at "' + path_error + '")\n';
1325
+ message += referencepath_errorValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1326
+ return new TypeError(message);
1327
+ }
1328
+ }
1329
+ const obj_result = obj.result;
1330
+ const path_result = path + '.result';
1331
+ const referencepath_resultValidationError = validate$e(obj_result, path_result);
1332
+ if (referencepath_resultValidationError !== null) {
1333
+ let message = 'Object doesn\'t match Summary (at "' + path_result + '")\n';
1334
+ message += referencepath_resultValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1335
+ return new TypeError(message);
1336
+ }
1337
+ })();
1338
+ return v_error === undefined ? null : v_error;
1339
+ }
1340
+ const select$i = function SummaryResponseSelect() {
1341
+ const { selections: Error__selections, opaque: Error__opaque, } = select$k();
1342
+ const { selections: Summary__selections, opaque: Summary__opaque, } = select$j();
1343
+ return {
1344
+ kind: 'Fragment',
1345
+ version: VERSION$d,
1346
+ private: [],
1347
+ selections: [
1348
+ {
1349
+ name: 'error',
1350
+ kind: 'Object',
1351
+ selections: Error__selections,
1352
+ required: false
1353
+ },
1354
+ {
1355
+ name: 'result',
1356
+ kind: 'Object',
1357
+ selections: Summary__selections
1358
+ }
1359
+ ]
1360
+ };
1361
+ };
1362
+ function equals$d(existing, incoming) {
1363
+ const existing_error = existing.error;
1364
+ const incoming_error = incoming.error;
1365
+ // if at least one of these optionals is defined
1366
+ if (existing_error !== undefined || incoming_error !== undefined) {
1367
+ // if one of these is not defined we know the other is defined and therefore
1368
+ // not equal
1369
+ if (existing_error === undefined || incoming_error === undefined) {
1370
+ return false;
1371
+ }
1372
+ if (!(equals$f(existing_error, incoming_error))) {
1373
+ return false;
1374
+ }
1375
+ }
1376
+ const existing_result = existing.result;
1377
+ const incoming_result = incoming.result;
1378
+ if (!(equals$e(existing_result, incoming_result))) {
1379
+ return false;
1380
+ }
1381
+ return true;
1382
+ }
1383
+
1384
+ const VERSION$c = "18d65084646c870abf335d268675999e";
1385
+ function validate$c(obj, path = 'GenerateInsightBatchResponse') {
1386
+ const v_error = (() => {
1387
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1388
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1389
+ }
1390
+ const obj_batchId = obj.batchId;
1391
+ const path_batchId = path + '.batchId';
1392
+ if (typeof obj_batchId !== 'string') {
1393
+ return new TypeError('Expected "string" but received "' + typeof obj_batchId + '" (at "' + path_batchId + '")');
1394
+ }
1395
+ if (obj.generatingSummary !== undefined) {
1396
+ const obj_generatingSummary = obj.generatingSummary;
1397
+ const path_generatingSummary = path + '.generatingSummary';
1398
+ if (typeof obj_generatingSummary !== 'boolean') {
1399
+ return new TypeError('Expected "boolean" but received "' + typeof obj_generatingSummary + '" (at "' + path_generatingSummary + '")');
1400
+ }
1401
+ }
1402
+ if (obj.summary !== undefined) {
1403
+ const obj_summary = obj.summary;
1404
+ const path_summary = path + '.summary';
1405
+ const referencepath_summaryValidationError = validate$d(obj_summary, path_summary);
1406
+ if (referencepath_summaryValidationError !== null) {
1407
+ let message = 'Object doesn\'t match SummaryResponse (at "' + path_summary + '")\n';
1408
+ message += referencepath_summaryValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1409
+ return new TypeError(message);
1410
+ }
1411
+ }
1412
+ if (obj.timestamp !== undefined) {
1413
+ const obj_timestamp = obj.timestamp;
1414
+ const path_timestamp = path + '.timestamp';
1415
+ if (typeof obj_timestamp !== 'string') {
1416
+ return new TypeError('Expected "string" but received "' + typeof obj_timestamp + '" (at "' + path_timestamp + '")');
1417
+ }
1418
+ }
1419
+ })();
1420
+ return v_error === undefined ? null : v_error;
1421
+ }
1422
+ const RepresentationType$3 = 'GenerateInsightBatchResponse';
1423
+ function keyBuilder$5(luvio, config) {
1424
+ return keyPrefix + '::' + RepresentationType$3 + ':' + config.batchid;
1425
+ }
1426
+ function keyBuilderFromType$3(luvio, object) {
1427
+ const keyParams = {
1428
+ batchid: object.batchId
1429
+ };
1430
+ return keyBuilder$5(luvio, keyParams);
1431
+ }
1432
+ function normalize$3(input, existing, path, luvio, store, timestamp) {
1433
+ return input;
1434
+ }
1435
+ const select$h = function GenerateInsightBatchResponseSelect() {
1436
+ const { selections: SummaryResponse__selections, opaque: SummaryResponse__opaque, } = select$i();
1437
+ return {
1438
+ kind: 'Fragment',
1439
+ version: VERSION$c,
1440
+ private: [],
1441
+ selections: [
1442
+ {
1443
+ name: 'batchId',
1444
+ kind: 'Scalar'
1445
+ },
1446
+ {
1447
+ name: 'generatingSummary',
1448
+ kind: 'Scalar',
1449
+ required: false
1450
+ },
1451
+ {
1452
+ name: 'summary',
1453
+ kind: 'Object',
1454
+ selections: SummaryResponse__selections,
1455
+ required: false
1456
+ },
1457
+ {
1458
+ name: 'timestamp',
1459
+ kind: 'Scalar',
1460
+ required: false
1461
+ }
1462
+ ]
1463
+ };
1464
+ };
1465
+ function equals$c(existing, incoming) {
1466
+ const existing_generatingSummary = existing.generatingSummary;
1467
+ const incoming_generatingSummary = incoming.generatingSummary;
1468
+ // if at least one of these optionals is defined
1469
+ if (existing_generatingSummary !== undefined || incoming_generatingSummary !== undefined) {
1470
+ // if one of these is not defined we know the other is defined and therefore
1471
+ // not equal
1472
+ if (existing_generatingSummary === undefined || incoming_generatingSummary === undefined) {
1473
+ return false;
1474
+ }
1475
+ if (!(existing_generatingSummary === incoming_generatingSummary)) {
1476
+ return false;
1477
+ }
1478
+ }
1479
+ const existing_batchId = existing.batchId;
1480
+ const incoming_batchId = incoming.batchId;
1481
+ if (!(existing_batchId === incoming_batchId)) {
1482
+ return false;
1483
+ }
1484
+ const existing_timestamp = existing.timestamp;
1485
+ const incoming_timestamp = incoming.timestamp;
1486
+ // if at least one of these optionals is defined
1487
+ if (existing_timestamp !== undefined || incoming_timestamp !== undefined) {
1488
+ // if one of these is not defined we know the other is defined and therefore
1489
+ // not equal
1490
+ if (existing_timestamp === undefined || incoming_timestamp === undefined) {
1491
+ return false;
1492
+ }
1493
+ if (!(existing_timestamp === incoming_timestamp)) {
1494
+ return false;
1495
+ }
1496
+ }
1497
+ const existing_summary = existing.summary;
1498
+ const incoming_summary = incoming.summary;
1499
+ // if at least one of these optionals is defined
1500
+ if (existing_summary !== undefined || incoming_summary !== undefined) {
1501
+ // if one of these is not defined we know the other is defined and therefore
1502
+ // not equal
1503
+ if (existing_summary === undefined || incoming_summary === undefined) {
1504
+ return false;
1505
+ }
1506
+ if (!(equals$d(existing_summary, incoming_summary))) {
1507
+ return false;
1508
+ }
1509
+ }
1510
+ return true;
1511
+ }
1512
+ const ingest$3 = function GenerateInsightBatchResponseIngest(input, path, luvio, store, timestamp) {
1513
+ if (process.env.NODE_ENV !== 'production') {
1514
+ const validateError = validate$c(input);
1515
+ if (validateError !== null) {
1516
+ throw validateError;
1517
+ }
1518
+ }
1519
+ const key = keyBuilderFromType$3(luvio, input);
1520
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 300000;
1521
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$3, "analytics-insights", VERSION$c, RepresentationType$3, equals$c);
1522
+ return createLink(key);
1523
+ };
1524
+ function getTypeCacheKeys$3(rootKeySet, luvio, input, fullPathFactory) {
1525
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
1526
+ const rootKey = keyBuilderFromType$3(luvio, input);
1527
+ rootKeySet.set(rootKey, {
1528
+ namespace: keyPrefix,
1529
+ representationName: RepresentationType$3,
1530
+ mergeable: false
1531
+ });
1532
+ }
1533
+
1534
+ function select$g(luvio, params) {
1535
+ return select$h();
1536
+ }
1537
+ function getResponseCacheKeys$4(storeKeyMap, luvio, resourceParams, response) {
1538
+ getTypeCacheKeys$3(storeKeyMap, luvio, response);
1539
+ }
1540
+ function ingestSuccess$4(luvio, resourceParams, response) {
1541
+ const { body } = response;
1542
+ const key = keyBuilderFromType$3(luvio, body);
1543
+ luvio.storeIngest(key, ingest$3, body);
1544
+ const snapshot = luvio.storeLookup({
1545
+ recordId: key,
1546
+ node: select$g(),
1547
+ variables: {},
1548
+ });
1549
+ if (process.env.NODE_ENV !== 'production') {
1550
+ if (snapshot.state !== 'Fulfilled') {
1551
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1552
+ }
1553
+ }
1554
+ deepFreeze(snapshot.data);
1555
+ return snapshot;
1556
+ }
1557
+ function createResourceRequest$4(config) {
1558
+ const headers = {};
1559
+ const header_xSfdcSourceapp = config.headers.xSfdcSourceapp;
1560
+ if (header_xSfdcSourceapp !== undefined) {
1561
+ headers['x-sfdc-sourceapp'] = header_xSfdcSourceapp;
1562
+ }
1563
+ const header_xSfdcSourcecontext = config.headers.xSfdcSourcecontext;
1564
+ if (header_xSfdcSourcecontext !== undefined) {
1565
+ headers['x-sfdc-sourcecontext'] = header_xSfdcSourcecontext;
1566
+ }
1567
+ return {
1568
+ baseUri: 'api.salesforce.com',
1569
+ basePath: '/analytics/insights/v1/batches',
1570
+ method: 'post',
1571
+ body: config.body,
1572
+ urlParams: {},
1573
+ queryParams: {},
1574
+ headers,
1575
+ priority: 'normal',
1576
+ };
1577
+ }
1578
+
1579
+ const adapterName$4 = 'createInsightsBatch';
1580
+ const createInsightsBatch_ConfigPropertyMetadata = [
1581
+ generateParamConfigMetadata('batchInput', false, 2 /* Body */, 4 /* Unsupported */, true),
1582
+ generateParamConfigMetadata('options', false, 2 /* Body */, 4 /* Unsupported */),
1583
+ generateParamConfigMetadata('xSfdcSourceapp', false, 3 /* Header */, 0 /* String */),
1584
+ generateParamConfigMetadata('xSfdcSourcecontext', false, 3 /* Header */, 0 /* String */),
1585
+ ];
1586
+ const createInsightsBatch_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$4, createInsightsBatch_ConfigPropertyMetadata);
1587
+ const createResourceParams$4 = /*#__PURE__*/ createResourceParams$5(createInsightsBatch_ConfigPropertyMetadata);
1588
+ function typeCheckConfig$4(untrustedConfig) {
1589
+ const config = {};
1590
+ typeCheckConfig$5(untrustedConfig, config, createInsightsBatch_ConfigPropertyMetadata);
1591
+ const untrustedConfig_batchInput = untrustedConfig.batchInput;
1592
+ if (ArrayIsArray$1(untrustedConfig_batchInput)) {
1593
+ const untrustedConfig_batchInput_array = [];
1594
+ for (let i = 0, arrayLength = untrustedConfig_batchInput.length; i < arrayLength; i++) {
1595
+ const untrustedConfig_batchInput_item = untrustedConfig_batchInput[i];
1596
+ const referenceBatchInputValidationError = validate$j(untrustedConfig_batchInput_item);
1597
+ if (referenceBatchInputValidationError === null) {
1598
+ untrustedConfig_batchInput_array.push(untrustedConfig_batchInput_item);
1599
+ }
1600
+ }
1601
+ config.batchInput = untrustedConfig_batchInput_array;
1602
+ }
1603
+ const untrustedConfig_options = untrustedConfig.options;
1604
+ const referenceBatchOptionsValidationError = validate$g(untrustedConfig_options);
1605
+ if (referenceBatchOptionsValidationError === null) {
1606
+ config.options = untrustedConfig_options;
1607
+ }
1608
+ return config;
1609
+ }
1610
+ function validateAdapterConfig$4(untrustedConfig, configPropertyNames) {
1611
+ if (!untrustedIsObject(untrustedConfig)) {
1612
+ return null;
1613
+ }
1614
+ if (process.env.NODE_ENV !== 'production') {
1615
+ validateConfig(untrustedConfig, configPropertyNames);
1616
+ }
1617
+ const config = typeCheckConfig$4(untrustedConfig);
1618
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1619
+ return null;
1620
+ }
1621
+ return config;
1622
+ }
1623
+ function buildNetworkSnapshot$4(luvio, config, options) {
1624
+ const resourceParams = createResourceParams$4(config);
1625
+ const request = createResourceRequest$4(resourceParams);
1626
+ return luvio.dispatchResourceRequest(request, options)
1627
+ .then((response) => {
1628
+ return luvio.handleSuccessResponse(() => {
1629
+ const snapshot = ingestSuccess$4(luvio, resourceParams, response);
1630
+ return luvio.storeBroadcast().then(() => snapshot);
1631
+ }, () => {
1632
+ const cache = new StoreKeyMap();
1633
+ getResponseCacheKeys$4(cache, luvio, resourceParams, response.body);
1634
+ return cache;
1635
+ });
1636
+ }, (response) => {
1637
+ deepFreeze(response);
1638
+ throw response;
1639
+ });
1640
+ }
1641
+ const createInsightsBatchAdapterFactory = (luvio) => {
1642
+ return function createInsightsBatch(untrustedConfig) {
1643
+ const config = validateAdapterConfig$4(untrustedConfig, createInsightsBatch_ConfigPropertyNames);
1644
+ // Invalid or incomplete config
1645
+ if (config === null) {
1646
+ throw new Error('Invalid config for "createInsightsBatch"');
1647
+ }
1648
+ return buildNetworkSnapshot$4(luvio, config);
1649
+ };
1650
+ };
1651
+
1652
+ const VERSION$b = "6b47d2ed35a900956ff58b7d8a527e7f";
1653
+ function validate$b(obj, path = 'InsightFeedbackMetadata') {
1654
+ const v_error = (() => {
1655
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1656
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1657
+ }
1658
+ if (obj.dimensionHash !== undefined) {
1659
+ const obj_dimensionHash = obj.dimensionHash;
1660
+ const path_dimensionHash = path + '.dimensionHash';
1661
+ if (typeof obj_dimensionHash !== 'string') {
1662
+ return new TypeError('Expected "string" but received "' + typeof obj_dimensionHash + '" (at "' + path_dimensionHash + '")');
1663
+ }
1664
+ }
1665
+ if (obj.score !== undefined) {
1666
+ obj.score;
1667
+ }
1668
+ if (obj.type !== undefined) {
1669
+ const obj_type = obj.type;
1670
+ const path_type = path + '.type';
1671
+ if (typeof obj_type !== 'string') {
1672
+ return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
1673
+ }
1674
+ }
1675
+ })();
1676
+ return v_error === undefined ? null : v_error;
1677
+ }
1678
+ const select$f = function InsightFeedbackMetadataSelect() {
1679
+ return {
1680
+ kind: 'Fragment',
1681
+ version: VERSION$b,
1682
+ private: [],
1683
+ selections: [
1684
+ {
1685
+ name: 'dimensionHash',
1686
+ kind: 'Scalar',
1687
+ required: false
1688
+ },
1689
+ {
1690
+ name: 'score',
1691
+ kind: 'Scalar',
1692
+ required: false
1693
+ },
1694
+ {
1695
+ name: 'type',
1696
+ kind: 'Scalar',
1697
+ required: false
1698
+ }
1699
+ ]
1700
+ };
1701
+ };
1702
+ function equals$b(existing, incoming) {
1703
+ const existing_dimensionHash = existing.dimensionHash;
1704
+ const incoming_dimensionHash = incoming.dimensionHash;
1705
+ // if at least one of these optionals is defined
1706
+ if (existing_dimensionHash !== undefined || incoming_dimensionHash !== undefined) {
1707
+ // if one of these is not defined we know the other is defined and therefore
1708
+ // not equal
1709
+ if (existing_dimensionHash === undefined || incoming_dimensionHash === undefined) {
1710
+ return false;
1711
+ }
1712
+ if (!(existing_dimensionHash === incoming_dimensionHash)) {
1713
+ return false;
1714
+ }
1715
+ }
1716
+ const existing_type = existing.type;
1717
+ const incoming_type = incoming.type;
1718
+ // if at least one of these optionals is defined
1719
+ if (existing_type !== undefined || incoming_type !== undefined) {
1720
+ // if one of these is not defined we know the other is defined and therefore
1721
+ // not equal
1722
+ if (existing_type === undefined || incoming_type === undefined) {
1723
+ return false;
1724
+ }
1725
+ if (!(existing_type === incoming_type)) {
1726
+ return false;
1727
+ }
1728
+ }
1729
+ const existing_score = existing.score;
1730
+ const incoming_score = incoming.score;
1731
+ // if at least one of these optionals is defined
1732
+ if (existing_score !== undefined || incoming_score !== undefined) {
1733
+ // if one of these is not defined we know the other is defined and therefore
1734
+ // not equal
1735
+ if (existing_score === undefined || incoming_score === undefined) {
1736
+ return false;
1737
+ }
1738
+ if (!(existing_score === incoming_score)) {
1739
+ return false;
1740
+ }
1741
+ }
1742
+ return true;
1743
+ }
1744
+
1745
+ const VERSION$a = "be7014b0043386672b06a22807d7e549";
1746
+ function validate$a(obj, path = 'Insight') {
1747
+ const v_error = (() => {
1748
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1749
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1750
+ }
1751
+ if (obj.characterization !== undefined) {
1752
+ const obj_characterization = obj.characterization;
1753
+ const path_characterization = path + '.characterization';
1754
+ if (typeof obj_characterization !== 'string') {
1755
+ return new TypeError('Expected "string" but received "' + typeof obj_characterization + '" (at "' + path_characterization + '")');
1756
+ }
1757
+ }
1758
+ if (obj.facts !== undefined) {
1759
+ const obj_facts = obj.facts;
1760
+ const path_facts = path + '.facts';
1761
+ if (obj_facts === undefined) {
1762
+ return new TypeError('Expected "defined" but received "' + typeof obj_facts + '" (at "' + path_facts + '")');
1763
+ }
1764
+ }
1765
+ if (obj.id !== undefined) {
1766
+ const obj_id = obj.id;
1767
+ const path_id = path + '.id';
1768
+ if (typeof obj_id !== 'string') {
1769
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
1770
+ }
1771
+ }
1772
+ const obj_insightFeedbackMetadata = obj.insightFeedbackMetadata;
1773
+ const path_insightFeedbackMetadata = path + '.insightFeedbackMetadata';
1774
+ const referencepath_insightFeedbackMetadataValidationError = validate$b(obj_insightFeedbackMetadata, path_insightFeedbackMetadata);
1775
+ if (referencepath_insightFeedbackMetadataValidationError !== null) {
1776
+ let message = 'Object doesn\'t match InsightFeedbackMetadata (at "' + path_insightFeedbackMetadata + '")\n';
1777
+ message += referencepath_insightFeedbackMetadataValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1778
+ return new TypeError(message);
1779
+ }
1780
+ if (obj.markup !== undefined) {
1781
+ const obj_markup = obj.markup;
1782
+ const path_markup = path + '.markup';
1783
+ if (typeof obj_markup !== 'string') {
1784
+ return new TypeError('Expected "string" but received "' + typeof obj_markup + '" (at "' + path_markup + '")');
1785
+ }
1786
+ }
1787
+ if (obj.question !== undefined) {
1788
+ const obj_question = obj.question;
1789
+ const path_question = path + '.question';
1790
+ if (typeof obj_question !== 'string') {
1791
+ return new TypeError('Expected "string" but received "' + typeof obj_question + '" (at "' + path_question + '")');
1792
+ }
1793
+ }
1794
+ if (obj.score !== undefined) {
1795
+ obj.score;
1796
+ }
1797
+ if (obj.type !== undefined) {
1798
+ const obj_type = obj.type;
1799
+ const path_type = path + '.type';
1800
+ if (typeof obj_type !== 'string') {
1801
+ return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
1802
+ }
1803
+ }
1804
+ if (obj.version !== undefined) {
1805
+ const obj_version = obj.version;
1806
+ const path_version = path + '.version';
1807
+ if (typeof obj_version !== 'number' || (typeof obj_version === 'number' && Math.floor(obj_version) !== obj_version)) {
1808
+ return new TypeError('Expected "integer" but received "' + typeof obj_version + '" (at "' + path_version + '")');
1809
+ }
1810
+ }
1811
+ if (obj.viz !== undefined) {
1812
+ const obj_viz = obj.viz;
1813
+ const path_viz = path + '.viz';
1814
+ if (obj_viz === undefined) {
1815
+ return new TypeError('Expected "defined" but received "' + typeof obj_viz + '" (at "' + path_viz + '")');
1816
+ }
1817
+ }
1818
+ })();
1819
+ return v_error === undefined ? null : v_error;
1820
+ }
1821
+ const select$e = function InsightSelect() {
1822
+ const { selections: InsightFeedbackMetadata__selections, opaque: InsightFeedbackMetadata__opaque, } = select$f();
1823
+ return {
1824
+ kind: 'Fragment',
1825
+ version: VERSION$a,
1826
+ private: [],
1827
+ selections: [
1828
+ {
1829
+ name: 'characterization',
1830
+ kind: 'Scalar',
1831
+ required: false
1832
+ },
1833
+ {
1834
+ name: 'facts',
1835
+ kind: 'Object',
1836
+ // any
1837
+ },
1838
+ {
1839
+ name: 'id',
1840
+ kind: 'Scalar',
1841
+ required: false
1842
+ },
1843
+ {
1844
+ name: 'insightFeedbackMetadata',
1845
+ kind: 'Object',
1846
+ selections: InsightFeedbackMetadata__selections
1847
+ },
1848
+ {
1849
+ name: 'markup',
1850
+ kind: 'Scalar',
1851
+ required: false
1852
+ },
1853
+ {
1854
+ name: 'question',
1855
+ kind: 'Scalar',
1856
+ required: false
1857
+ },
1858
+ {
1859
+ name: 'score',
1860
+ kind: 'Scalar',
1861
+ required: false
1862
+ },
1863
+ {
1864
+ name: 'type',
1865
+ kind: 'Scalar',
1866
+ required: false
1867
+ },
1868
+ {
1869
+ name: 'version',
1870
+ kind: 'Scalar',
1871
+ required: false
1872
+ },
1873
+ {
1874
+ name: 'viz',
1875
+ kind: 'Object',
1876
+ // any
1877
+ }
1878
+ ]
1879
+ };
1880
+ };
1881
+ function equals$a(existing, incoming) {
1882
+ const existing_version = existing.version;
1883
+ const incoming_version = incoming.version;
1884
+ // if at least one of these optionals is defined
1885
+ if (existing_version !== undefined || incoming_version !== undefined) {
1886
+ // if one of these is not defined we know the other is defined and therefore
1887
+ // not equal
1888
+ if (existing_version === undefined || incoming_version === undefined) {
1889
+ return false;
1890
+ }
1891
+ if (!(existing_version === incoming_version)) {
1892
+ return false;
1893
+ }
1894
+ }
1895
+ const existing_characterization = existing.characterization;
1896
+ const incoming_characterization = incoming.characterization;
1897
+ // if at least one of these optionals is defined
1898
+ if (existing_characterization !== undefined || incoming_characterization !== undefined) {
1899
+ // if one of these is not defined we know the other is defined and therefore
1900
+ // not equal
1901
+ if (existing_characterization === undefined || incoming_characterization === undefined) {
1902
+ return false;
1903
+ }
1904
+ if (!(existing_characterization === incoming_characterization)) {
1905
+ return false;
1906
+ }
1907
+ }
1908
+ const existing_id = existing.id;
1909
+ const incoming_id = incoming.id;
1910
+ // if at least one of these optionals is defined
1911
+ if (existing_id !== undefined || incoming_id !== undefined) {
1912
+ // if one of these is not defined we know the other is defined and therefore
1913
+ // not equal
1914
+ if (existing_id === undefined || incoming_id === undefined) {
1915
+ return false;
1916
+ }
1917
+ if (!(existing_id === incoming_id)) {
1918
+ return false;
1919
+ }
1920
+ }
1921
+ const existing_markup = existing.markup;
1922
+ const incoming_markup = incoming.markup;
1923
+ // if at least one of these optionals is defined
1924
+ if (existing_markup !== undefined || incoming_markup !== undefined) {
1925
+ // if one of these is not defined we know the other is defined and therefore
1926
+ // not equal
1927
+ if (existing_markup === undefined || incoming_markup === undefined) {
1928
+ return false;
1929
+ }
1930
+ if (!(existing_markup === incoming_markup)) {
1931
+ return false;
1932
+ }
1933
+ }
1934
+ const existing_question = existing.question;
1935
+ const incoming_question = incoming.question;
1936
+ // if at least one of these optionals is defined
1937
+ if (existing_question !== undefined || incoming_question !== undefined) {
1938
+ // if one of these is not defined we know the other is defined and therefore
1939
+ // not equal
1940
+ if (existing_question === undefined || incoming_question === undefined) {
1941
+ return false;
1942
+ }
1943
+ if (!(existing_question === incoming_question)) {
1944
+ return false;
1945
+ }
1946
+ }
1947
+ const existing_type = existing.type;
1948
+ const incoming_type = incoming.type;
1949
+ // if at least one of these optionals is defined
1950
+ if (existing_type !== undefined || incoming_type !== undefined) {
1951
+ // if one of these is not defined we know the other is defined and therefore
1952
+ // not equal
1953
+ if (existing_type === undefined || incoming_type === undefined) {
1954
+ return false;
1955
+ }
1956
+ if (!(existing_type === incoming_type)) {
1957
+ return false;
1958
+ }
1959
+ }
1960
+ const existing_score = existing.score;
1961
+ const incoming_score = incoming.score;
1962
+ // if at least one of these optionals is defined
1963
+ if (existing_score !== undefined || incoming_score !== undefined) {
1964
+ // if one of these is not defined we know the other is defined and therefore
1965
+ // not equal
1966
+ if (existing_score === undefined || incoming_score === undefined) {
1967
+ return false;
1968
+ }
1969
+ if (!(existing_score === incoming_score)) {
1970
+ return false;
1971
+ }
1972
+ }
1973
+ const existing_facts = existing.facts;
1974
+ const incoming_facts = incoming.facts;
1975
+ // if at least one of these optionals is defined
1976
+ if (existing_facts !== undefined || incoming_facts !== undefined) {
1977
+ // if one of these is not defined we know the other is defined and therefore
1978
+ // not equal
1979
+ if (existing_facts === undefined || incoming_facts === undefined) {
1980
+ return false;
1981
+ }
1982
+ if (JSONStringify(incoming_facts) !== JSONStringify(existing_facts)) {
1983
+ return false;
1984
+ }
1985
+ }
1986
+ const existing_insightFeedbackMetadata = existing.insightFeedbackMetadata;
1987
+ const incoming_insightFeedbackMetadata = incoming.insightFeedbackMetadata;
1988
+ if (!(equals$b(existing_insightFeedbackMetadata, incoming_insightFeedbackMetadata))) {
1989
+ return false;
1990
+ }
1991
+ const existing_viz = existing.viz;
1992
+ const incoming_viz = incoming.viz;
1993
+ // if at least one of these optionals is defined
1994
+ if (existing_viz !== undefined || incoming_viz !== undefined) {
1995
+ // if one of these is not defined we know the other is defined and therefore
1996
+ // not equal
1997
+ if (existing_viz === undefined || incoming_viz === undefined) {
1998
+ return false;
1999
+ }
2000
+ if (JSONStringify(incoming_viz) !== JSONStringify(existing_viz)) {
2001
+ return false;
2002
+ }
2003
+ }
2004
+ return true;
2005
+ }
2006
+
2007
+ const VERSION$9 = "09a140bdbc97294bdce2b9555910f209";
2008
+ function validate$9(obj, path = 'InsightResponse') {
2009
+ const v_error = (() => {
2010
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
2011
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
2012
+ }
2013
+ if (obj.error !== undefined) {
2014
+ const obj_error = obj.error;
2015
+ const path_error = path + '.error';
2016
+ const referencepath_errorValidationError = validate$f(obj_error, path_error);
2017
+ if (referencepath_errorValidationError !== null) {
2018
+ let message = 'Object doesn\'t match Error (at "' + path_error + '")\n';
2019
+ message += referencepath_errorValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2020
+ return new TypeError(message);
2021
+ }
2022
+ }
2023
+ if (obj.insightType !== undefined) {
2024
+ const obj_insightType = obj.insightType;
2025
+ const path_insightType = path + '.insightType';
2026
+ if (typeof obj_insightType !== 'string') {
2027
+ return new TypeError('Expected "string" but received "' + typeof obj_insightType + '" (at "' + path_insightType + '")');
2028
+ }
2029
+ }
2030
+ if (obj.result !== undefined) {
2031
+ const obj_result = obj.result;
2032
+ const path_result = path + '.result';
2033
+ const referencepath_resultValidationError = validate$a(obj_result, path_result);
2034
+ if (referencepath_resultValidationError !== null) {
2035
+ let message = 'Object doesn\'t match Insight (at "' + path_result + '")\n';
2036
+ message += referencepath_resultValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2037
+ return new TypeError(message);
2038
+ }
2039
+ }
2040
+ })();
2041
+ return v_error === undefined ? null : v_error;
2042
+ }
2043
+ const select$d = function InsightResponseSelect() {
2044
+ const { selections: Error__selections, opaque: Error__opaque, } = select$k();
2045
+ const { selections: Insight__selections, opaque: Insight__opaque, } = select$e();
2046
+ return {
2047
+ kind: 'Fragment',
2048
+ version: VERSION$9,
2049
+ private: [],
2050
+ selections: [
2051
+ {
2052
+ name: 'error',
2053
+ kind: 'Object',
2054
+ selections: Error__selections,
2055
+ required: false
2056
+ },
2057
+ {
2058
+ name: 'insightType',
2059
+ kind: 'Scalar',
2060
+ required: false
2061
+ },
2062
+ {
2063
+ name: 'result',
2064
+ kind: 'Object',
2065
+ selections: Insight__selections,
2066
+ required: false
2067
+ }
2068
+ ]
2069
+ };
2070
+ };
2071
+ function equals$9(existing, incoming) {
2072
+ const existing_insightType = existing.insightType;
2073
+ const incoming_insightType = incoming.insightType;
2074
+ // if at least one of these optionals is defined
2075
+ if (existing_insightType !== undefined || incoming_insightType !== undefined) {
2076
+ // if one of these is not defined we know the other is defined and therefore
2077
+ // not equal
2078
+ if (existing_insightType === undefined || incoming_insightType === undefined) {
2079
+ return false;
2080
+ }
2081
+ if (!(existing_insightType === incoming_insightType)) {
2082
+ return false;
2083
+ }
2084
+ }
2085
+ const existing_error = existing.error;
2086
+ const incoming_error = incoming.error;
2087
+ // if at least one of these optionals is defined
2088
+ if (existing_error !== undefined || incoming_error !== undefined) {
2089
+ // if one of these is not defined we know the other is defined and therefore
2090
+ // not equal
2091
+ if (existing_error === undefined || incoming_error === undefined) {
2092
+ return false;
2093
+ }
2094
+ if (!(equals$f(existing_error, incoming_error))) {
2095
+ return false;
2096
+ }
2097
+ }
2098
+ const existing_result = existing.result;
2099
+ const incoming_result = incoming.result;
2100
+ // if at least one of these optionals is defined
2101
+ if (existing_result !== undefined || incoming_result !== undefined) {
2102
+ // if one of these is not defined we know the other is defined and therefore
2103
+ // not equal
2104
+ if (existing_result === undefined || incoming_result === undefined) {
2105
+ return false;
2106
+ }
2107
+ if (!(equals$a(existing_result, incoming_result))) {
2108
+ return false;
2109
+ }
2110
+ }
2111
+ return true;
2112
+ }
2113
+
2114
+ const VERSION$8 = "bbba5f281b443221e96fa2e9e8eae2d9";
2115
+ function validate$8(obj, path = 'Status') {
2116
+ const v_error = (() => {
2117
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
2118
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
2119
+ }
2120
+ if (obj.qualifier !== undefined) {
2121
+ const obj_qualifier = obj.qualifier;
2122
+ const path_qualifier = path + '.qualifier';
2123
+ if (typeof obj_qualifier !== 'string') {
2124
+ return new TypeError('Expected "string" but received "' + typeof obj_qualifier + '" (at "' + path_qualifier + '")');
2125
+ }
2126
+ }
2127
+ if (obj.sentiment !== undefined) {
2128
+ const obj_sentiment = obj.sentiment;
2129
+ const path_sentiment = path + '.sentiment';
2130
+ if (typeof obj_sentiment !== 'string') {
2131
+ return new TypeError('Expected "string" but received "' + typeof obj_sentiment + '" (at "' + path_sentiment + '")');
2132
+ }
2133
+ }
2134
+ })();
2135
+ return v_error === undefined ? null : v_error;
2136
+ }
2137
+ const select$c = function StatusSelect() {
2138
+ return {
2139
+ kind: 'Fragment',
2140
+ version: VERSION$8,
2141
+ private: [],
2142
+ selections: [
2143
+ {
2144
+ name: 'qualifier',
2145
+ kind: 'Scalar',
2146
+ required: false
2147
+ },
2148
+ {
2149
+ name: 'sentiment',
2150
+ kind: 'Scalar',
2151
+ required: false
2152
+ }
2153
+ ]
2154
+ };
2155
+ };
2156
+ function equals$8(existing, incoming) {
2157
+ const existing_qualifier = existing.qualifier;
2158
+ const incoming_qualifier = incoming.qualifier;
2159
+ // if at least one of these optionals is defined
2160
+ if (existing_qualifier !== undefined || incoming_qualifier !== undefined) {
2161
+ // if one of these is not defined we know the other is defined and therefore
2162
+ // not equal
2163
+ if (existing_qualifier === undefined || incoming_qualifier === undefined) {
2164
+ return false;
2165
+ }
2166
+ if (!(existing_qualifier === incoming_qualifier)) {
2167
+ return false;
2168
+ }
2169
+ }
2170
+ const existing_sentiment = existing.sentiment;
2171
+ const incoming_sentiment = incoming.sentiment;
2172
+ // if at least one of these optionals is defined
2173
+ if (existing_sentiment !== undefined || incoming_sentiment !== undefined) {
2174
+ // if one of these is not defined we know the other is defined and therefore
2175
+ // not equal
2176
+ if (existing_sentiment === undefined || incoming_sentiment === undefined) {
2177
+ return false;
2178
+ }
2179
+ if (!(existing_sentiment === incoming_sentiment)) {
2180
+ return false;
2181
+ }
2182
+ }
2183
+ return true;
2184
+ }
2185
+
2186
+ const VERSION$7 = "b8ee380c83f9ec2fff1e8045ba2301fc";
2187
+ function validate$7(obj, path = 'Overview') {
2188
+ const v_error = (() => {
2189
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
2190
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
2191
+ }
2192
+ if (obj.status !== undefined) {
2193
+ const obj_status = obj.status;
2194
+ const path_status = path + '.status';
2195
+ const referencepath_statusValidationError = validate$8(obj_status, path_status);
2196
+ if (referencepath_statusValidationError !== null) {
2197
+ let message = 'Object doesn\'t match Status (at "' + path_status + '")\n';
2198
+ message += referencepath_statusValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2199
+ return new TypeError(message);
2200
+ }
2201
+ }
2202
+ if (obj.viz !== undefined) {
2203
+ const obj_viz = obj.viz;
2204
+ const path_viz = path + '.viz';
2205
+ if (obj_viz === undefined) {
2206
+ return new TypeError('Expected "defined" but received "' + typeof obj_viz + '" (at "' + path_viz + '")');
2207
+ }
2208
+ }
2209
+ })();
2210
+ return v_error === undefined ? null : v_error;
2211
+ }
2212
+ const select$b = function OverviewSelect() {
2213
+ const { selections: Status__selections, opaque: Status__opaque, } = select$c();
2214
+ return {
2215
+ kind: 'Fragment',
2216
+ version: VERSION$7,
2217
+ private: [],
2218
+ selections: [
2219
+ {
2220
+ name: 'status',
2221
+ kind: 'Object',
2222
+ selections: Status__selections,
2223
+ required: false
2224
+ },
2225
+ {
2226
+ name: 'viz',
2227
+ kind: 'Object',
2228
+ // any
2229
+ }
2230
+ ]
2231
+ };
2232
+ };
2233
+ function equals$7(existing, incoming) {
2234
+ const existing_status = existing.status;
2235
+ const incoming_status = incoming.status;
2236
+ // if at least one of these optionals is defined
2237
+ if (existing_status !== undefined || incoming_status !== undefined) {
2238
+ // if one of these is not defined we know the other is defined and therefore
2239
+ // not equal
2240
+ if (existing_status === undefined || incoming_status === undefined) {
2241
+ return false;
2242
+ }
2243
+ if (!(equals$8(existing_status, incoming_status))) {
2244
+ return false;
2245
+ }
2246
+ }
2247
+ const existing_viz = existing.viz;
2248
+ const incoming_viz = incoming.viz;
2249
+ // if at least one of these optionals is defined
2250
+ if (existing_viz !== undefined || incoming_viz !== undefined) {
2251
+ // if one of these is not defined we know the other is defined and therefore
2252
+ // not equal
2253
+ if (existing_viz === undefined || incoming_viz === undefined) {
2254
+ return false;
2255
+ }
2256
+ if (JSONStringify(incoming_viz) !== JSONStringify(existing_viz)) {
2257
+ return false;
2258
+ }
2259
+ }
2260
+ return true;
2261
+ }
2262
+
2263
+ const VERSION$6 = "ff01bfcbb0b2877fe279be648aceb371";
2264
+ function validate$6(obj, path = 'OverviewResponse') {
2265
+ const v_error = (() => {
2266
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
2267
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
2268
+ }
2269
+ if (obj.error !== undefined) {
2270
+ const obj_error = obj.error;
2271
+ const path_error = path + '.error';
2272
+ const referencepath_errorValidationError = validate$f(obj_error, path_error);
2273
+ if (referencepath_errorValidationError !== null) {
2274
+ let message = 'Object doesn\'t match Error (at "' + path_error + '")\n';
2275
+ message += referencepath_errorValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2276
+ return new TypeError(message);
2277
+ }
2278
+ }
2279
+ if (obj.result !== undefined) {
2280
+ const obj_result = obj.result;
2281
+ const path_result = path + '.result';
2282
+ const referencepath_resultValidationError = validate$7(obj_result, path_result);
2283
+ if (referencepath_resultValidationError !== null) {
2284
+ let message = 'Object doesn\'t match Overview (at "' + path_result + '")\n';
2285
+ message += referencepath_resultValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2286
+ return new TypeError(message);
2287
+ }
2288
+ }
2289
+ })();
2290
+ return v_error === undefined ? null : v_error;
2291
+ }
2292
+ const select$a = function OverviewResponseSelect() {
2293
+ const { selections: Error__selections, opaque: Error__opaque, } = select$k();
2294
+ const { selections: Overview__selections, opaque: Overview__opaque, } = select$b();
2295
+ return {
2296
+ kind: 'Fragment',
2297
+ version: VERSION$6,
2298
+ private: [],
2299
+ selections: [
2300
+ {
2301
+ name: 'error',
2302
+ kind: 'Object',
2303
+ selections: Error__selections,
2304
+ required: false
2305
+ },
2306
+ {
2307
+ name: 'result',
2308
+ kind: 'Object',
2309
+ selections: Overview__selections,
2310
+ required: false
2311
+ }
2312
+ ]
2313
+ };
2314
+ };
2315
+ function equals$6(existing, incoming) {
2316
+ const existing_error = existing.error;
2317
+ const incoming_error = incoming.error;
2318
+ // if at least one of these optionals is defined
2319
+ if (existing_error !== undefined || incoming_error !== undefined) {
2320
+ // if one of these is not defined we know the other is defined and therefore
2321
+ // not equal
2322
+ if (existing_error === undefined || incoming_error === undefined) {
2323
+ return false;
2324
+ }
2325
+ if (!(equals$f(existing_error, incoming_error))) {
2326
+ return false;
2327
+ }
2328
+ }
2329
+ const existing_result = existing.result;
2330
+ const incoming_result = incoming.result;
2331
+ // if at least one of these optionals is defined
2332
+ if (existing_result !== undefined || incoming_result !== undefined) {
2333
+ // if one of these is not defined we know the other is defined and therefore
2334
+ // not equal
2335
+ if (existing_result === undefined || incoming_result === undefined) {
2336
+ return false;
2337
+ }
2338
+ if (!(equals$7(existing_result, incoming_result))) {
2339
+ return false;
2340
+ }
2341
+ }
2342
+ return true;
2343
+ }
2344
+
2345
+ const VERSION$5 = "a70a5e68e786c3f38efb73cc0812d394";
2346
+ function validate$5(obj, path = 'InsightGroup') {
2347
+ const v_error = (() => {
2348
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
2349
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
2350
+ }
2351
+ if (obj.error !== undefined) {
2352
+ const obj_error = obj.error;
2353
+ const path_error = path + '.error';
2354
+ const referencepath_errorValidationError = validate$f(obj_error, path_error);
2355
+ if (referencepath_errorValidationError !== null) {
2356
+ let message = 'Object doesn\'t match Error (at "' + path_error + '")\n';
2357
+ message += referencepath_errorValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2358
+ return new TypeError(message);
2359
+ }
2360
+ }
2361
+ if (obj.insights !== undefined) {
2362
+ const obj_insights = obj.insights;
2363
+ const path_insights = path + '.insights';
2364
+ if (!ArrayIsArray(obj_insights)) {
2365
+ return new TypeError('Expected "array" but received "' + typeof obj_insights + '" (at "' + path_insights + '")');
2366
+ }
2367
+ for (let i = 0; i < obj_insights.length; i++) {
2368
+ const obj_insights_item = obj_insights[i];
2369
+ const path_insights_item = path_insights + '[' + i + ']';
2370
+ const referencepath_insights_itemValidationError = validate$9(obj_insights_item, path_insights_item);
2371
+ if (referencepath_insights_itemValidationError !== null) {
2372
+ let message = 'Object doesn\'t match InsightResponse (at "' + path_insights_item + '")\n';
2373
+ message += referencepath_insights_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2374
+ return new TypeError(message);
2375
+ }
2376
+ }
2377
+ }
2378
+ if (obj.overviews !== undefined) {
2379
+ const obj_overviews = obj.overviews;
2380
+ const path_overviews = path + '.overviews';
2381
+ if (!ArrayIsArray(obj_overviews)) {
2382
+ return new TypeError('Expected "array" but received "' + typeof obj_overviews + '" (at "' + path_overviews + '")');
2383
+ }
2384
+ for (let i = 0; i < obj_overviews.length; i++) {
2385
+ const obj_overviews_item = obj_overviews[i];
2386
+ const path_overviews_item = path_overviews + '[' + i + ']';
2387
+ const referencepath_overviews_itemValidationError = validate$6(obj_overviews_item, path_overviews_item);
2388
+ if (referencepath_overviews_itemValidationError !== null) {
2389
+ let message = 'Object doesn\'t match OverviewResponse (at "' + path_overviews_item + '")\n';
2390
+ message += referencepath_overviews_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2391
+ return new TypeError(message);
2392
+ }
2393
+ }
2394
+ }
2395
+ if (obj.type !== undefined) {
2396
+ const obj_type = obj.type;
2397
+ const path_type = path + '.type';
2398
+ if (typeof obj_type !== 'string') {
2399
+ return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
2400
+ }
2401
+ }
2402
+ })();
2403
+ return v_error === undefined ? null : v_error;
2404
+ }
2405
+ const select$9 = function InsightGroupSelect() {
2406
+ const { selections: Error__selections, opaque: Error__opaque, } = select$k();
2407
+ const { selections: InsightResponse__selections, opaque: InsightResponse__opaque, } = select$d();
2408
+ const { selections: OverviewResponse__selections, opaque: OverviewResponse__opaque, } = select$a();
2409
+ return {
2410
+ kind: 'Fragment',
2411
+ version: VERSION$5,
2412
+ private: [],
2413
+ selections: [
2414
+ {
2415
+ name: 'error',
2416
+ kind: 'Object',
2417
+ selections: Error__selections,
2418
+ required: false
2419
+ },
2420
+ {
2421
+ name: 'insights',
2422
+ kind: 'Object',
2423
+ plural: true,
2424
+ selections: InsightResponse__selections,
2425
+ required: false
2426
+ },
2427
+ {
2428
+ name: 'overviews',
2429
+ kind: 'Object',
2430
+ plural: true,
2431
+ selections: OverviewResponse__selections,
2432
+ required: false
2433
+ },
2434
+ {
2435
+ name: 'type',
2436
+ kind: 'Scalar',
2437
+ required: false
2438
+ }
2439
+ ]
2440
+ };
2441
+ };
2442
+ function equals$5(existing, incoming) {
2443
+ const existing_type = existing.type;
2444
+ const incoming_type = incoming.type;
2445
+ // if at least one of these optionals is defined
2446
+ if (existing_type !== undefined || incoming_type !== undefined) {
2447
+ // if one of these is not defined we know the other is defined and therefore
2448
+ // not equal
2449
+ if (existing_type === undefined || incoming_type === undefined) {
2450
+ return false;
2451
+ }
2452
+ if (!(existing_type === incoming_type)) {
2453
+ return false;
2454
+ }
2455
+ }
2456
+ const existing_error = existing.error;
2457
+ const incoming_error = incoming.error;
2458
+ // if at least one of these optionals is defined
2459
+ if (existing_error !== undefined || incoming_error !== undefined) {
2460
+ // if one of these is not defined we know the other is defined and therefore
2461
+ // not equal
2462
+ if (existing_error === undefined || incoming_error === undefined) {
2463
+ return false;
2464
+ }
2465
+ if (!(equals$f(existing_error, incoming_error))) {
2466
+ return false;
2467
+ }
2468
+ }
2469
+ const existing_insights = existing.insights;
2470
+ const incoming_insights = incoming.insights;
2471
+ // if at least one of these optionals is defined
2472
+ if (existing_insights !== undefined || incoming_insights !== undefined) {
2473
+ // if one of these is not defined we know the other is defined and therefore
2474
+ // not equal
2475
+ if (existing_insights === undefined || incoming_insights === undefined) {
2476
+ return false;
2477
+ }
2478
+ const equals_insights_items = equalsArray(existing_insights, incoming_insights, (existing_insights_item, incoming_insights_item) => {
2479
+ if (!(equals$9(existing_insights_item, incoming_insights_item))) {
2480
+ return false;
2481
+ }
2482
+ });
2483
+ if (equals_insights_items === false) {
2484
+ return false;
2485
+ }
2486
+ }
2487
+ const existing_overviews = existing.overviews;
2488
+ const incoming_overviews = incoming.overviews;
2489
+ // if at least one of these optionals is defined
2490
+ if (existing_overviews !== undefined || incoming_overviews !== undefined) {
2491
+ // if one of these is not defined we know the other is defined and therefore
2492
+ // not equal
2493
+ if (existing_overviews === undefined || incoming_overviews === undefined) {
2494
+ return false;
2495
+ }
2496
+ const equals_overviews_items = equalsArray(existing_overviews, incoming_overviews, (existing_overviews_item, incoming_overviews_item) => {
2497
+ if (!(equals$6(existing_overviews_item, incoming_overviews_item))) {
2498
+ return false;
2499
+ }
2500
+ });
2501
+ if (equals_overviews_items === false) {
2502
+ return false;
2503
+ }
2504
+ }
2505
+ return true;
2506
+ }
2507
+
2508
+ const VERSION$4 = "ccf83d258110a04c1949592c91b69b3b";
2509
+ function validate$4(obj, path = 'InsightBundle') {
2510
+ const v_error = (() => {
2511
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
2512
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
2513
+ }
2514
+ if (obj.characterization !== undefined) {
2515
+ const obj_characterization = obj.characterization;
2516
+ const path_characterization = path + '.characterization';
2517
+ if (typeof obj_characterization !== 'string') {
2518
+ return new TypeError('Expected "string" but received "' + typeof obj_characterization + '" (at "' + path_characterization + '")');
2519
+ }
2520
+ }
2521
+ if (obj.hasErrors !== undefined) {
2522
+ const obj_hasErrors = obj.hasErrors;
2523
+ const path_hasErrors = path + '.hasErrors';
2524
+ if (typeof obj_hasErrors !== 'boolean') {
2525
+ return new TypeError('Expected "boolean" but received "' + typeof obj_hasErrors + '" (at "' + path_hasErrors + '")');
2526
+ }
2527
+ }
2528
+ if (obj.insightGroups !== undefined) {
2529
+ const obj_insightGroups = obj.insightGroups;
2530
+ const path_insightGroups = path + '.insightGroups';
2531
+ if (!ArrayIsArray(obj_insightGroups)) {
2532
+ return new TypeError('Expected "array" but received "' + typeof obj_insightGroups + '" (at "' + path_insightGroups + '")');
2533
+ }
2534
+ for (let i = 0; i < obj_insightGroups.length; i++) {
2535
+ const obj_insightGroups_item = obj_insightGroups[i];
2536
+ const path_insightGroups_item = path_insightGroups + '[' + i + ']';
2537
+ const referencepath_insightGroups_itemValidationError = validate$5(obj_insightGroups_item, path_insightGroups_item);
2538
+ if (referencepath_insightGroups_itemValidationError !== null) {
2539
+ let message = 'Object doesn\'t match InsightGroup (at "' + path_insightGroups_item + '")\n';
2540
+ message += referencepath_insightGroups_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2541
+ return new TypeError(message);
2542
+ }
2543
+ }
2544
+ }
2545
+ })();
2546
+ return v_error === undefined ? null : v_error;
2547
+ }
2548
+ const select$8 = function InsightBundleSelect() {
2549
+ const { selections: InsightGroup__selections, opaque: InsightGroup__opaque, } = select$9();
2550
+ return {
2551
+ kind: 'Fragment',
2552
+ version: VERSION$4,
2553
+ private: [],
2554
+ selections: [
2555
+ {
2556
+ name: 'characterization',
2557
+ kind: 'Scalar',
2558
+ required: false
2559
+ },
2560
+ {
2561
+ name: 'hasErrors',
2562
+ kind: 'Scalar',
2563
+ required: false
2564
+ },
2565
+ {
2566
+ name: 'insightGroups',
2567
+ kind: 'Object',
2568
+ plural: true,
2569
+ selections: InsightGroup__selections,
2570
+ required: false
2571
+ }
2572
+ ]
2573
+ };
2574
+ };
2575
+ function equals$4(existing, incoming) {
2576
+ const existing_hasErrors = existing.hasErrors;
2577
+ const incoming_hasErrors = incoming.hasErrors;
2578
+ // if at least one of these optionals is defined
2579
+ if (existing_hasErrors !== undefined || incoming_hasErrors !== undefined) {
2580
+ // if one of these is not defined we know the other is defined and therefore
2581
+ // not equal
2582
+ if (existing_hasErrors === undefined || incoming_hasErrors === undefined) {
2583
+ return false;
2584
+ }
2585
+ if (!(existing_hasErrors === incoming_hasErrors)) {
2586
+ return false;
2587
+ }
2588
+ }
2589
+ const existing_characterization = existing.characterization;
2590
+ const incoming_characterization = incoming.characterization;
2591
+ // if at least one of these optionals is defined
2592
+ if (existing_characterization !== undefined || incoming_characterization !== undefined) {
2593
+ // if one of these is not defined we know the other is defined and therefore
2594
+ // not equal
2595
+ if (existing_characterization === undefined || incoming_characterization === undefined) {
2596
+ return false;
2597
+ }
2598
+ if (!(existing_characterization === incoming_characterization)) {
2599
+ return false;
2600
+ }
2601
+ }
2602
+ const existing_insightGroups = existing.insightGroups;
2603
+ const incoming_insightGroups = incoming.insightGroups;
2604
+ // if at least one of these optionals is defined
2605
+ if (existing_insightGroups !== undefined || incoming_insightGroups !== undefined) {
2606
+ // if one of these is not defined we know the other is defined and therefore
2607
+ // not equal
2608
+ if (existing_insightGroups === undefined || incoming_insightGroups === undefined) {
2609
+ return false;
2610
+ }
2611
+ const equals_insightGroups_items = equalsArray(existing_insightGroups, incoming_insightGroups, (existing_insightGroups_item, incoming_insightGroups_item) => {
2612
+ if (!(equals$5(existing_insightGroups_item, incoming_insightGroups_item))) {
2613
+ return false;
2614
+ }
2615
+ });
2616
+ if (equals_insightGroups_items === false) {
2617
+ return false;
2618
+ }
2619
+ }
2620
+ return true;
2621
+ }
2622
+
2623
+ const VERSION$3 = "5da3ddbbd8ef8f7b1f24b4d609f91108";
2624
+ function validate$3(obj, path = 'GenerateInsightBundleResponse') {
2625
+ const v_error = (() => {
2626
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
2627
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
2628
+ }
2629
+ if (obj.error !== undefined) {
2630
+ const obj_error = obj.error;
2631
+ const path_error = path + '.error';
2632
+ const referencepath_errorValidationError = validate$f(obj_error, path_error);
2633
+ if (referencepath_errorValidationError !== null) {
2634
+ let message = 'Object doesn\'t match Error (at "' + path_error + '")\n';
2635
+ message += referencepath_errorValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2636
+ return new TypeError(message);
2637
+ }
2638
+ }
2639
+ if (obj.measurementPeriod !== undefined) {
2640
+ const obj_measurementPeriod = obj.measurementPeriod;
2641
+ const path_measurementPeriod = path + '.measurementPeriod';
2642
+ const referencepath_measurementPeriodValidationError = validate$l(obj_measurementPeriod, path_measurementPeriod);
2643
+ if (referencepath_measurementPeriodValidationError !== null) {
2644
+ let message = 'Object doesn\'t match UnifiedFilter (at "' + path_measurementPeriod + '")\n';
2645
+ message += referencepath_measurementPeriodValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2646
+ return new TypeError(message);
2647
+ }
2648
+ }
2649
+ if (obj.result !== undefined) {
2650
+ const obj_result = obj.result;
2651
+ const path_result = path + '.result';
2652
+ const referencepath_resultValidationError = validate$4(obj_result, path_result);
2653
+ if (referencepath_resultValidationError !== null) {
2654
+ let message = 'Object doesn\'t match InsightBundle (at "' + path_result + '")\n';
2655
+ message += referencepath_resultValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2656
+ return new TypeError(message);
2657
+ }
2658
+ }
2659
+ const obj_sdm = obj.sdm;
2660
+ const path_sdm = path + '.sdm';
2661
+ if (typeof obj_sdm !== 'string') {
2662
+ return new TypeError('Expected "string" but received "' + typeof obj_sdm + '" (at "' + path_sdm + '")');
2663
+ }
2664
+ const obj_submetric = obj.submetric;
2665
+ const path_submetric = path + '.submetric';
2666
+ if (typeof obj_submetric !== 'string') {
2667
+ return new TypeError('Expected "string" but received "' + typeof obj_submetric + '" (at "' + path_submetric + '")');
2668
+ }
2669
+ })();
2670
+ return v_error === undefined ? null : v_error;
2671
+ }
2672
+ const RepresentationType$2 = 'GenerateInsightBundleResponse';
2673
+ function keyBuilder$4(luvio, config) {
2674
+ return keyPrefix + '::' + RepresentationType$2 + ':' + config.metricid;
2675
+ }
2676
+ function keyBuilderFromType$2(luvio, object) {
2677
+ const keyParams = {
2678
+ metricid: object.submetric
2679
+ };
2680
+ return keyBuilder$4(luvio, keyParams);
2681
+ }
2682
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
2683
+ return input;
2684
+ }
2685
+ const select$7 = function GenerateInsightBundleResponseSelect() {
2686
+ const { selections: Error__selections, opaque: Error__opaque, } = select$k();
2687
+ const { selections: UnifiedFilter__selections, opaque: UnifiedFilter__opaque, } = select$l();
2688
+ const { selections: InsightBundle__selections, opaque: InsightBundle__opaque, } = select$8();
2689
+ return {
2690
+ kind: 'Fragment',
2691
+ version: VERSION$3,
2692
+ private: [],
2693
+ selections: [
2694
+ {
2695
+ name: 'error',
2696
+ kind: 'Object',
2697
+ selections: Error__selections,
2698
+ required: false
2699
+ },
2700
+ {
2701
+ name: 'measurementPeriod',
2702
+ kind: 'Object',
2703
+ selections: UnifiedFilter__selections,
2704
+ required: false
2705
+ },
2706
+ {
2707
+ name: 'result',
2708
+ kind: 'Object',
2709
+ selections: InsightBundle__selections,
2710
+ required: false
2711
+ },
2712
+ {
2713
+ name: 'sdm',
2714
+ kind: 'Scalar'
2715
+ },
2716
+ {
2717
+ name: 'submetric',
2718
+ kind: 'Scalar'
2719
+ }
2720
+ ]
2721
+ };
2722
+ };
2723
+ function equals$3(existing, incoming) {
2724
+ const existing_sdm = existing.sdm;
2725
+ const incoming_sdm = incoming.sdm;
2726
+ if (!(existing_sdm === incoming_sdm)) {
2727
+ return false;
2728
+ }
2729
+ const existing_submetric = existing.submetric;
2730
+ const incoming_submetric = incoming.submetric;
2731
+ if (!(existing_submetric === incoming_submetric)) {
2732
+ return false;
2733
+ }
2734
+ const existing_error = existing.error;
2735
+ const incoming_error = incoming.error;
2736
+ // if at least one of these optionals is defined
2737
+ if (existing_error !== undefined || incoming_error !== undefined) {
2738
+ // if one of these is not defined we know the other is defined and therefore
2739
+ // not equal
2740
+ if (existing_error === undefined || incoming_error === undefined) {
2741
+ return false;
2742
+ }
2743
+ if (!(equals$f(existing_error, incoming_error))) {
2744
+ return false;
2745
+ }
2746
+ }
2747
+ const existing_measurementPeriod = existing.measurementPeriod;
2748
+ const incoming_measurementPeriod = incoming.measurementPeriod;
2749
+ // if at least one of these optionals is defined
2750
+ if (existing_measurementPeriod !== undefined || incoming_measurementPeriod !== undefined) {
2751
+ // if one of these is not defined we know the other is defined and therefore
2752
+ // not equal
2753
+ if (existing_measurementPeriod === undefined || incoming_measurementPeriod === undefined) {
2754
+ return false;
2755
+ }
2756
+ if (!(equals$g(existing_measurementPeriod, incoming_measurementPeriod))) {
2757
+ return false;
2758
+ }
2759
+ }
2760
+ const existing_result = existing.result;
2761
+ const incoming_result = incoming.result;
2762
+ // if at least one of these optionals is defined
2763
+ if (existing_result !== undefined || incoming_result !== undefined) {
2764
+ // if one of these is not defined we know the other is defined and therefore
2765
+ // not equal
2766
+ if (existing_result === undefined || incoming_result === undefined) {
2767
+ return false;
2768
+ }
2769
+ if (!(equals$4(existing_result, incoming_result))) {
2770
+ return false;
2771
+ }
2772
+ }
2773
+ return true;
2774
+ }
2775
+ const ingest$2 = function GenerateInsightBundleResponseIngest(input, path, luvio, store, timestamp) {
2776
+ if (process.env.NODE_ENV !== 'production') {
2777
+ const validateError = validate$3(input);
2778
+ if (validateError !== null) {
2779
+ throw validateError;
2780
+ }
2781
+ }
2782
+ const key = keyBuilderFromType$2(luvio, input);
2783
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 300000;
2784
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "analytics-insights", VERSION$3, RepresentationType$2, equals$3);
2785
+ return createLink(key);
2786
+ };
2787
+ function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
2788
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
2789
+ const rootKey = keyBuilderFromType$2(luvio, input);
2790
+ rootKeySet.set(rootKey, {
2791
+ namespace: keyPrefix,
2792
+ representationName: RepresentationType$2,
2793
+ mergeable: false
2794
+ });
2795
+ }
2796
+
2797
+ function select$6(luvio, params) {
2798
+ return select$7();
2799
+ }
2800
+ function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
2801
+ getTypeCacheKeys$2(storeKeyMap, luvio, response);
2802
+ }
2803
+ function ingestSuccess$3(luvio, resourceParams, response) {
2804
+ const { body } = response;
2805
+ const key = keyBuilderFromType$2(luvio, body);
2806
+ luvio.storeIngest(key, ingest$2, body);
2807
+ const snapshot = luvio.storeLookup({
2808
+ recordId: key,
2809
+ node: select$6(),
2810
+ variables: {},
2811
+ });
2812
+ if (process.env.NODE_ENV !== 'production') {
2813
+ if (snapshot.state !== 'Fulfilled') {
2814
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
2815
+ }
2816
+ }
2817
+ deepFreeze(snapshot.data);
2818
+ return snapshot;
2819
+ }
2820
+ function createResourceRequest$3(config) {
2821
+ const headers = {};
2822
+ const header_xSfdcSourceapp = config.headers.xSfdcSourceapp;
2823
+ if (header_xSfdcSourceapp !== undefined) {
2824
+ headers['x-sfdc-sourceapp'] = header_xSfdcSourceapp;
2825
+ }
2826
+ const header_xSfdcSourcecontext = config.headers.xSfdcSourcecontext;
2827
+ if (header_xSfdcSourcecontext !== undefined) {
2828
+ headers['x-sfdc-sourcecontext'] = header_xSfdcSourcecontext;
2829
+ }
2830
+ return {
2831
+ baseUri: 'api.salesforce.com',
2832
+ basePath: '/analytics/insights/v1/generateBundle',
2833
+ method: 'post',
2834
+ body: config.body,
2835
+ urlParams: {},
2836
+ queryParams: {},
2837
+ headers,
2838
+ priority: 'normal',
2839
+ };
2840
+ }
2841
+
2842
+ const adapterName$3 = 'generateInsights';
2843
+ const generateInsights_ConfigPropertyMetadata = [
2844
+ generateParamConfigMetadata('type', false, 2 /* Body */, 0 /* String */),
2845
+ generateParamConfigMetadata('version', false, 2 /* Body */, 3 /* Integer */),
2846
+ generateParamConfigMetadata('input', false, 2 /* Body */, 4 /* Unsupported */),
2847
+ generateParamConfigMetadata('options', false, 2 /* Body */, 4 /* Unsupported */),
2848
+ generateParamConfigMetadata('xSfdcSourceapp', false, 3 /* Header */, 0 /* String */),
2849
+ generateParamConfigMetadata('xSfdcSourcecontext', false, 3 /* Header */, 0 /* String */),
2850
+ ];
2851
+ const generateInsights_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, generateInsights_ConfigPropertyMetadata);
2852
+ const createResourceParams$3 = /*#__PURE__*/ createResourceParams$5(generateInsights_ConfigPropertyMetadata);
2853
+ function typeCheckConfig$3(untrustedConfig) {
2854
+ const config = {};
2855
+ typeCheckConfig$5(untrustedConfig, config, generateInsights_ConfigPropertyMetadata);
2856
+ const untrustedConfig_input = untrustedConfig.input;
2857
+ const referenceInsightBundleInputValidationError = validate$m(untrustedConfig_input);
2858
+ if (referenceInsightBundleInputValidationError === null) {
2859
+ config.input = untrustedConfig_input;
2860
+ }
2861
+ const untrustedConfig_options = untrustedConfig.options;
2862
+ const referenceInsightBundleOptionsValidationError = validate$i(untrustedConfig_options);
2863
+ if (referenceInsightBundleOptionsValidationError === null) {
2864
+ config.options = untrustedConfig_options;
2865
+ }
2866
+ return config;
2867
+ }
2868
+ function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
2869
+ if (!untrustedIsObject(untrustedConfig)) {
2870
+ return null;
2871
+ }
2872
+ if (process.env.NODE_ENV !== 'production') {
2873
+ validateConfig(untrustedConfig, configPropertyNames);
2874
+ }
2875
+ const config = typeCheckConfig$3(untrustedConfig);
2876
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
2877
+ return null;
2878
+ }
2879
+ return config;
2880
+ }
2881
+ function buildNetworkSnapshot$3(luvio, config, options) {
2882
+ const resourceParams = createResourceParams$3(config);
2883
+ const request = createResourceRequest$3(resourceParams);
2884
+ return luvio.dispatchResourceRequest(request, options)
2885
+ .then((response) => {
2886
+ return luvio.handleSuccessResponse(() => {
2887
+ const snapshot = ingestSuccess$3(luvio, resourceParams, response);
2888
+ return luvio.storeBroadcast().then(() => snapshot);
2889
+ }, () => {
2890
+ const cache = new StoreKeyMap();
2891
+ getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
2892
+ return cache;
2893
+ });
2894
+ }, (response) => {
2895
+ deepFreeze(response);
2896
+ throw response;
2897
+ });
2898
+ }
2899
+ const generateInsightsAdapterFactory = (luvio) => {
2900
+ return function generateInsights(untrustedConfig) {
2901
+ const config = validateAdapterConfig$3(untrustedConfig, generateInsights_ConfigPropertyNames);
2902
+ // Invalid or incomplete config
2903
+ if (config === null) {
2904
+ throw new Error('Invalid config for "generateInsights"');
2905
+ }
2906
+ return buildNetworkSnapshot$3(luvio, config);
2907
+ };
2908
+ };
2909
+
2910
+ function select$5(luvio, params) {
2911
+ return select$7();
2912
+ }
2913
+ function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
2914
+ getTypeCacheKeys$2(storeKeyMap, luvio, response);
2915
+ }
2916
+ function ingestSuccess$2(luvio, resourceParams, response) {
2917
+ const { body } = response;
2918
+ const key = keyBuilderFromType$2(luvio, body);
2919
+ luvio.storeIngest(key, ingest$2, body);
2920
+ const snapshot = luvio.storeLookup({
2921
+ recordId: key,
2922
+ node: select$5(),
2923
+ variables: {},
2924
+ });
2925
+ if (process.env.NODE_ENV !== 'production') {
2926
+ if (snapshot.state !== 'Fulfilled') {
2927
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
2928
+ }
2929
+ }
2930
+ deepFreeze(snapshot.data);
2931
+ return snapshot;
2932
+ }
2933
+ function createResourceRequest$2(config) {
2934
+ const headers = {};
2935
+ const header_xSfdcSourceapp = config.headers.xSfdcSourceapp;
2936
+ if (header_xSfdcSourceapp !== undefined) {
2937
+ headers['x-sfdc-sourceapp'] = header_xSfdcSourceapp;
2938
+ }
2939
+ const header_xSfdcSourcecontext = config.headers.xSfdcSourcecontext;
2940
+ if (header_xSfdcSourcecontext !== undefined) {
2941
+ headers['x-sfdc-sourcecontext'] = header_xSfdcSourcecontext;
2942
+ }
2943
+ return {
2944
+ baseUri: 'api.salesforce.com',
2945
+ basePath: '/analytics/insights/v1/basic/generateBundle',
2946
+ method: 'post',
2947
+ body: config.body,
2948
+ urlParams: {},
2949
+ queryParams: {},
2950
+ headers,
2951
+ priority: 'normal',
2952
+ };
2953
+ }
2954
+
2955
+ const adapterName$2 = 'generateInsightsBasic';
2956
+ const generateInsightsBasic_ConfigPropertyMetadata = [
2957
+ generateParamConfigMetadata('type', false, 2 /* Body */, 0 /* String */),
2958
+ generateParamConfigMetadata('version', false, 2 /* Body */, 3 /* Integer */),
2959
+ generateParamConfigMetadata('input', false, 2 /* Body */, 4 /* Unsupported */),
2960
+ generateParamConfigMetadata('options', false, 2 /* Body */, 4 /* Unsupported */),
2961
+ generateParamConfigMetadata('xSfdcSourceapp', false, 3 /* Header */, 0 /* String */),
2962
+ generateParamConfigMetadata('xSfdcSourcecontext', false, 3 /* Header */, 0 /* String */),
2963
+ ];
2964
+ const generateInsightsBasic_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, generateInsightsBasic_ConfigPropertyMetadata);
2965
+ const createResourceParams$2 = /*#__PURE__*/ createResourceParams$5(generateInsightsBasic_ConfigPropertyMetadata);
2966
+ function typeCheckConfig$2(untrustedConfig) {
2967
+ const config = {};
2968
+ typeCheckConfig$5(untrustedConfig, config, generateInsightsBasic_ConfigPropertyMetadata);
2969
+ const untrustedConfig_input = untrustedConfig.input;
2970
+ const referenceInsightBundleInputValidationError = validate$m(untrustedConfig_input);
2971
+ if (referenceInsightBundleInputValidationError === null) {
2972
+ config.input = untrustedConfig_input;
2973
+ }
2974
+ const untrustedConfig_options = untrustedConfig.options;
2975
+ const referenceInsightBundleOptionsValidationError = validate$i(untrustedConfig_options);
2976
+ if (referenceInsightBundleOptionsValidationError === null) {
2977
+ config.options = untrustedConfig_options;
2978
+ }
2979
+ return config;
2980
+ }
2981
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
2982
+ if (!untrustedIsObject(untrustedConfig)) {
2983
+ return null;
2984
+ }
2985
+ if (process.env.NODE_ENV !== 'production') {
2986
+ validateConfig(untrustedConfig, configPropertyNames);
2987
+ }
2988
+ const config = typeCheckConfig$2(untrustedConfig);
2989
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
2990
+ return null;
2991
+ }
2992
+ return config;
2993
+ }
2994
+ function buildNetworkSnapshot$2(luvio, config, options) {
2995
+ const resourceParams = createResourceParams$2(config);
2996
+ const request = createResourceRequest$2(resourceParams);
2997
+ return luvio.dispatchResourceRequest(request, options)
2998
+ .then((response) => {
2999
+ return luvio.handleSuccessResponse(() => {
3000
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response);
3001
+ return luvio.storeBroadcast().then(() => snapshot);
3002
+ }, () => {
3003
+ const cache = new StoreKeyMap();
3004
+ getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
3005
+ return cache;
3006
+ });
3007
+ }, (response) => {
3008
+ deepFreeze(response);
3009
+ throw response;
3010
+ });
3011
+ }
3012
+ const generateInsightsBasicAdapterFactory = (luvio) => {
3013
+ return function generateInsightsBasic(untrustedConfig) {
3014
+ const config = validateAdapterConfig$2(untrustedConfig, generateInsightsBasic_ConfigPropertyNames);
3015
+ // Invalid or incomplete config
3016
+ if (config === null) {
3017
+ throw new Error('Invalid config for "generateInsightsBasic"');
3018
+ }
3019
+ return buildNetworkSnapshot$2(luvio, config);
3020
+ };
3021
+ };
3022
+
3023
+ const TTL = 5000;
3024
+ const VERSION$2 = "b3ecf416df1c88948a22534e1143e6d5";
3025
+ function validate$2(obj, path = 'GetInsightBatchResponse') {
3026
+ const v_error = (() => {
3027
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
3028
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
3029
+ }
3030
+ const obj_batchId = obj.batchId;
3031
+ const path_batchId = path + '.batchId';
3032
+ if (typeof obj_batchId !== 'string') {
3033
+ return new TypeError('Expected "string" but received "' + typeof obj_batchId + '" (at "' + path_batchId + '")');
3034
+ }
3035
+ if (obj.bundles !== undefined) {
3036
+ const obj_bundles = obj.bundles;
3037
+ const path_bundles = path + '.bundles';
3038
+ if (!ArrayIsArray(obj_bundles)) {
3039
+ return new TypeError('Expected "array" but received "' + typeof obj_bundles + '" (at "' + path_bundles + '")');
3040
+ }
3041
+ for (let i = 0; i < obj_bundles.length; i++) {
3042
+ const obj_bundles_item = obj_bundles[i];
3043
+ const path_bundles_item = path_bundles + '[' + i + ']';
3044
+ if (typeof obj_bundles_item !== 'object' || Array.isArray(obj_bundles_item)) {
3045
+ return new TypeError('Expected "object" but received "' + typeof obj_bundles_item + '" (at "' + path_bundles_item + '")');
3046
+ }
3047
+ }
3048
+ }
3049
+ if (obj.hasErrors !== undefined) {
3050
+ const obj_hasErrors = obj.hasErrors;
3051
+ const path_hasErrors = path + '.hasErrors';
3052
+ if (typeof obj_hasErrors !== 'boolean') {
3053
+ return new TypeError('Expected "boolean" but received "' + typeof obj_hasErrors + '" (at "' + path_hasErrors + '")');
3054
+ }
3055
+ }
3056
+ if (obj.status !== undefined) {
3057
+ const obj_status = obj.status;
3058
+ const path_status = path + '.status';
3059
+ if (typeof obj_status !== 'string') {
3060
+ return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
3061
+ }
3062
+ }
3063
+ if (obj.summary !== undefined) {
3064
+ const obj_summary = obj.summary;
3065
+ const path_summary = path + '.summary';
3066
+ const referencepath_summaryValidationError = validate$d(obj_summary, path_summary);
3067
+ if (referencepath_summaryValidationError !== null) {
3068
+ let message = 'Object doesn\'t match SummaryResponse (at "' + path_summary + '")\n';
3069
+ message += referencepath_summaryValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
3070
+ return new TypeError(message);
3071
+ }
3072
+ }
3073
+ })();
3074
+ return v_error === undefined ? null : v_error;
3075
+ }
3076
+ const RepresentationType$1 = 'GetInsightBatchResponse';
3077
+ function keyBuilder$3(luvio, config) {
3078
+ return keyPrefix + '::' + RepresentationType$1 + ':' + config.batchid;
3079
+ }
3080
+ function keyBuilderFromType$1(luvio, object) {
3081
+ const keyParams = {
3082
+ batchid: object.batchId
3083
+ };
3084
+ return keyBuilder$3(luvio, keyParams);
3085
+ }
3086
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
3087
+ const input_bundles = input.bundles;
3088
+ const input_bundles_id = path.fullPath + '__bundles';
3089
+ if (input_bundles !== undefined) {
3090
+ for (let i = 0; i < input_bundles.length; i++) {
3091
+ const input_bundles_item = input_bundles[i];
3092
+ let input_bundles_item_id = input_bundles_id + '__' + i;
3093
+ input_bundles[i] = ingest$2(input_bundles_item, {
3094
+ fullPath: input_bundles_item_id,
3095
+ propertyName: i,
3096
+ parent: {
3097
+ data: input,
3098
+ key: path.fullPath,
3099
+ existing: existing,
3100
+ },
3101
+ ttl: path.ttl
3102
+ }, luvio, store, timestamp);
3103
+ }
3104
+ }
3105
+ return input;
3106
+ }
3107
+ const select$4 = function GetInsightBatchResponseSelect() {
3108
+ const { selections: SummaryResponse__selections, opaque: SummaryResponse__opaque, } = select$i();
3109
+ return {
3110
+ kind: 'Fragment',
3111
+ version: VERSION$2,
3112
+ private: [],
3113
+ selections: [
3114
+ {
3115
+ name: 'batchId',
3116
+ kind: 'Scalar'
3117
+ },
3118
+ {
3119
+ name: 'bundles',
3120
+ kind: 'Link',
3121
+ plural: true,
3122
+ required: false,
3123
+ fragment: select$7()
3124
+ },
3125
+ {
3126
+ name: 'hasErrors',
3127
+ kind: 'Scalar',
3128
+ required: false
3129
+ },
3130
+ {
3131
+ name: 'status',
3132
+ kind: 'Scalar',
3133
+ required: false
3134
+ },
3135
+ {
3136
+ name: 'summary',
3137
+ kind: 'Object',
3138
+ selections: SummaryResponse__selections,
3139
+ required: false
3140
+ }
3141
+ ]
3142
+ };
3143
+ };
3144
+ function equals$2(existing, incoming) {
3145
+ const existing_hasErrors = existing.hasErrors;
3146
+ const incoming_hasErrors = incoming.hasErrors;
3147
+ // if at least one of these optionals is defined
3148
+ if (existing_hasErrors !== undefined || incoming_hasErrors !== undefined) {
3149
+ // if one of these is not defined we know the other is defined and therefore
3150
+ // not equal
3151
+ if (existing_hasErrors === undefined || incoming_hasErrors === undefined) {
3152
+ return false;
3153
+ }
3154
+ if (!(existing_hasErrors === incoming_hasErrors)) {
3155
+ return false;
3156
+ }
3157
+ }
3158
+ const existing_batchId = existing.batchId;
3159
+ const incoming_batchId = incoming.batchId;
3160
+ if (!(existing_batchId === incoming_batchId)) {
3161
+ return false;
3162
+ }
3163
+ const existing_status = existing.status;
3164
+ const incoming_status = incoming.status;
3165
+ // if at least one of these optionals is defined
3166
+ if (existing_status !== undefined || incoming_status !== undefined) {
3167
+ // if one of these is not defined we know the other is defined and therefore
3168
+ // not equal
3169
+ if (existing_status === undefined || incoming_status === undefined) {
3170
+ return false;
3171
+ }
3172
+ if (!(existing_status === incoming_status)) {
3173
+ return false;
3174
+ }
3175
+ }
3176
+ const existing_bundles = existing.bundles;
3177
+ const incoming_bundles = incoming.bundles;
3178
+ // if at least one of these optionals is defined
3179
+ if (existing_bundles !== undefined || incoming_bundles !== undefined) {
3180
+ // if one of these is not defined we know the other is defined and therefore
3181
+ // not equal
3182
+ if (existing_bundles === undefined || incoming_bundles === undefined) {
3183
+ return false;
3184
+ }
3185
+ const equals_bundles_items = equalsArray(existing_bundles, incoming_bundles, (existing_bundles_item, incoming_bundles_item) => {
3186
+ if (!(existing_bundles_item.__ref === incoming_bundles_item.__ref)) {
3187
+ return false;
3188
+ }
3189
+ });
3190
+ if (equals_bundles_items === false) {
3191
+ return false;
3192
+ }
3193
+ }
3194
+ const existing_summary = existing.summary;
3195
+ const incoming_summary = incoming.summary;
3196
+ // if at least one of these optionals is defined
3197
+ if (existing_summary !== undefined || incoming_summary !== undefined) {
3198
+ // if one of these is not defined we know the other is defined and therefore
3199
+ // not equal
3200
+ if (existing_summary === undefined || incoming_summary === undefined) {
3201
+ return false;
3202
+ }
3203
+ if (!(equals$d(existing_summary, incoming_summary))) {
3204
+ return false;
3205
+ }
3206
+ }
3207
+ return true;
3208
+ }
3209
+ const ingest$1 = function GetInsightBatchResponseIngest(input, path, luvio, store, timestamp) {
3210
+ if (process.env.NODE_ENV !== 'production') {
3211
+ const validateError = validate$2(input);
3212
+ if (validateError !== null) {
3213
+ throw validateError;
3214
+ }
3215
+ }
3216
+ const key = keyBuilderFromType$1(luvio, input);
3217
+ const ttlToUse = TTL;
3218
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "analytics-insights", VERSION$2, RepresentationType$1, equals$2);
3219
+ return createLink(key);
3220
+ };
3221
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
3222
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
3223
+ const rootKey = keyBuilderFromType$1(luvio, input);
3224
+ rootKeySet.set(rootKey, {
3225
+ namespace: keyPrefix,
3226
+ representationName: RepresentationType$1,
3227
+ mergeable: false
3228
+ });
3229
+ if (input.bundles !== undefined) {
3230
+ const input_bundles_length = input.bundles.length;
3231
+ for (let i = 0; i < input_bundles_length; i++) {
3232
+ getTypeCacheKeys$2(rootKeySet, luvio, input.bundles[i]);
3233
+ }
3234
+ }
3235
+ }
3236
+
3237
+ function select$3(luvio, params) {
3238
+ return select$4();
3239
+ }
3240
+ function keyBuilder$2(luvio, params) {
3241
+ return keyBuilder$3(luvio, {
3242
+ batchid: params.urlParams.batchId
3243
+ });
3244
+ }
3245
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
3246
+ getTypeCacheKeys$1(storeKeyMap, luvio, response);
3247
+ }
3248
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
3249
+ const { body } = response;
3250
+ const key = keyBuilder$2(luvio, resourceParams);
3251
+ luvio.storeIngest(key, ingest$1, body);
3252
+ const snapshot = luvio.storeLookup({
3253
+ recordId: key,
3254
+ node: select$3(),
3255
+ variables: {},
3256
+ }, snapshotRefresh);
3257
+ if (process.env.NODE_ENV !== 'production') {
3258
+ if (snapshot.state !== 'Fulfilled') {
3259
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
3260
+ }
3261
+ }
3262
+ deepFreeze(snapshot.data);
3263
+ return snapshot;
3264
+ }
3265
+ function ingestError(luvio, params, error, snapshotRefresh) {
3266
+ const key = keyBuilder$2(luvio, params);
3267
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
3268
+ const storeMetadataParams = {
3269
+ ttl: TTL,
3270
+ namespace: keyPrefix,
3271
+ version: VERSION$2,
3272
+ representationName: RepresentationType$1
3273
+ };
3274
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
3275
+ return errorSnapshot;
3276
+ }
3277
+ function createResourceRequest$1(config) {
3278
+ const headers = {};
3279
+ const header_xSfdcSourceapp = config.headers.xSfdcSourceapp;
3280
+ if (header_xSfdcSourceapp !== undefined) {
3281
+ headers['x-sfdc-sourceapp'] = header_xSfdcSourceapp;
3282
+ }
3283
+ const header_xSfdcSourcecontext = config.headers.xSfdcSourcecontext;
3284
+ if (header_xSfdcSourcecontext !== undefined) {
3285
+ headers['x-sfdc-sourcecontext'] = header_xSfdcSourcecontext;
3286
+ }
3287
+ return {
3288
+ baseUri: 'api.salesforce.com',
3289
+ basePath: '/analytics/insights/v1/batches/' + config.urlParams.batchId + '',
3290
+ method: 'get',
3291
+ body: null,
3292
+ urlParams: config.urlParams,
3293
+ queryParams: {},
3294
+ headers,
3295
+ priority: 'normal',
3296
+ };
3297
+ }
3298
+ function createResourceRequestFromRepresentation(representation) {
3299
+ const config = {
3300
+ urlParams: {},
3301
+ };
3302
+ config.urlParams.batchId = representation.batchId;
3303
+ return createResourceRequest$1(config);
3304
+ }
3305
+
3306
+ const adapterName$1 = 'getInsightsBatch';
3307
+ const getInsightsBatch_ConfigPropertyMetadata = [
3308
+ generateParamConfigMetadata('batchId', true, 0 /* UrlParameter */, 0 /* String */),
3309
+ generateParamConfigMetadata('xSfdcSourceapp', false, 3 /* Header */, 0 /* String */),
3310
+ generateParamConfigMetadata('xSfdcSourcecontext', false, 3 /* Header */, 0 /* String */),
3311
+ ];
3312
+ const getInsightsBatch_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getInsightsBatch_ConfigPropertyMetadata);
3313
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$5(getInsightsBatch_ConfigPropertyMetadata);
3314
+ function keyBuilder$1(luvio, config) {
3315
+ const resourceParams = createResourceParams$1(config);
3316
+ return keyBuilder$2(luvio, resourceParams);
3317
+ }
3318
+ function typeCheckConfig$1(untrustedConfig) {
3319
+ const config = {};
3320
+ typeCheckConfig$5(untrustedConfig, config, getInsightsBatch_ConfigPropertyMetadata);
3321
+ return config;
3322
+ }
3323
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
3324
+ if (!untrustedIsObject(untrustedConfig)) {
3325
+ return null;
3326
+ }
3327
+ if (process.env.NODE_ENV !== 'production') {
3328
+ validateConfig(untrustedConfig, configPropertyNames);
3329
+ }
3330
+ const config = typeCheckConfig$1(untrustedConfig);
3331
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
3332
+ return null;
3333
+ }
3334
+ return config;
3335
+ }
3336
+ function adapterFragment(luvio, config) {
3337
+ createResourceParams$1(config);
3338
+ return select$3();
3339
+ }
3340
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
3341
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
3342
+ config,
3343
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
3344
+ });
3345
+ return luvio.storeBroadcast().then(() => snapshot);
3346
+ }
3347
+ function onFetchResponseError(luvio, config, resourceParams, response) {
3348
+ const snapshot = ingestError(luvio, resourceParams, response, {
3349
+ config,
3350
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
3351
+ });
3352
+ return luvio.storeBroadcast().then(() => snapshot);
3353
+ }
3354
+ function buildNetworkSnapshot$1(luvio, config, options) {
3355
+ const resourceParams = createResourceParams$1(config);
3356
+ const request = createResourceRequest$1(resourceParams);
3357
+ return luvio.dispatchResourceRequest(request, options)
3358
+ .then((response) => {
3359
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
3360
+ const cache = new StoreKeyMap();
3361
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
3362
+ return cache;
3363
+ });
3364
+ }, (response) => {
3365
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
3366
+ });
3367
+ }
3368
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
3369
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
3370
+ }
3371
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
3372
+ const { luvio, config } = context;
3373
+ const selector = {
3374
+ recordId: keyBuilder$1(luvio, config),
3375
+ node: adapterFragment(luvio, config),
3376
+ variables: {},
3377
+ };
3378
+ const cacheSnapshot = storeLookup(selector, {
3379
+ config,
3380
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
3381
+ });
3382
+ return cacheSnapshot;
3383
+ }
3384
+ const getInsightsBatchAdapterFactory = (luvio) => function analyticsInsights__getInsightsBatch(untrustedConfig, requestContext) {
3385
+ const config = validateAdapterConfig$1(untrustedConfig, getInsightsBatch_ConfigPropertyNames);
3386
+ // Invalid or incomplete config
3387
+ if (config === null) {
3388
+ return null;
3389
+ }
3390
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
3391
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
3392
+ };
3393
+ const notifyChangeFactory = (luvio, options) => {
3394
+ return function getAnalyticsInsightsV1BatchesByBatchIdNotifyChange(configs) {
3395
+ const keys = configs.map(c => keyBuilder$3(luvio, c));
3396
+ luvio.getNotifyChangeStoreEntries(keys).then(entries => {
3397
+ for (let i = 0, len = entries.length; i < len; i++) {
3398
+ const { key, record: val } = entries[i];
3399
+ const refreshRequest = createResourceRequestFromRepresentation(val);
3400
+ luvio.dispatchResourceRequest(refreshRequest, options)
3401
+ .then((response) => {
3402
+ return luvio.handleSuccessResponse(() => {
3403
+ const { body } = response;
3404
+ luvio.storeIngest(key, ingest$1, body);
3405
+ return luvio.storeBroadcast();
3406
+ }, () => {
3407
+ const cache = new StoreKeyMap();
3408
+ getTypeCacheKeys$1(cache, luvio, response.body);
3409
+ return cache;
3410
+ });
3411
+ }, (error) => {
3412
+ return luvio.handleErrorResponse(() => {
3413
+ const errorSnapshot = luvio.errorSnapshot(error);
3414
+ luvio.storeIngestError(key, errorSnapshot, {
3415
+ ttl: TTL,
3416
+ namespace: keyPrefix,
3417
+ version: VERSION$2,
3418
+ representationName: RepresentationType$1
3419
+ });
3420
+ return luvio.storeBroadcast().then(() => errorSnapshot);
3421
+ });
3422
+ });
3423
+ }
3424
+ });
3425
+ };
3426
+ };
3427
+
3428
+ const VERSION$1 = "f898ff84f82ad0ca1eca0045e17ce492";
3429
+ function validate$1(obj, path = 'GetFilterValuesResponse_CategoricalValues') {
3430
+ const v_error = (() => {
3431
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
3432
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
3433
+ }
3434
+ if (obj.values !== undefined) {
3435
+ const obj_values = obj.values;
3436
+ const path_values = path + '.values';
3437
+ if (!ArrayIsArray(obj_values)) {
3438
+ return new TypeError('Expected "array" but received "' + typeof obj_values + '" (at "' + path_values + '")');
3439
+ }
3440
+ for (let i = 0; i < obj_values.length; i++) {
3441
+ const obj_values_item = obj_values[i];
3442
+ const path_values_item = path_values + '[' + i + ']';
3443
+ let obj_values_item_union0 = null;
3444
+ const obj_values_item_union0_error = (() => {
3445
+ if (typeof obj_values_item !== 'string') {
3446
+ return new TypeError('Expected "string" but received "' + typeof obj_values_item + '" (at "' + path_values_item + '")');
3447
+ }
3448
+ })();
3449
+ if (obj_values_item_union0_error != null) {
3450
+ obj_values_item_union0 = obj_values_item_union0_error.message;
3451
+ }
3452
+ let obj_values_item_union1 = null;
3453
+ const obj_values_item_union1_error = (() => {
3454
+ if (typeof obj_values_item !== 'number') {
3455
+ return new TypeError('Expected "number" but received "' + typeof obj_values_item + '" (at "' + path_values_item + '")');
3456
+ }
3457
+ })();
3458
+ if (obj_values_item_union1_error != null) {
3459
+ obj_values_item_union1 = obj_values_item_union1_error.message;
3460
+ }
3461
+ let obj_values_item_union2 = null;
3462
+ const obj_values_item_union2_error = (() => {
3463
+ if (typeof obj_values_item !== 'boolean') {
3464
+ return new TypeError('Expected "boolean" but received "' + typeof obj_values_item + '" (at "' + path_values_item + '")');
3465
+ }
3466
+ })();
3467
+ if (obj_values_item_union2_error != null) {
3468
+ obj_values_item_union2 = obj_values_item_union2_error.message;
3469
+ }
3470
+ let obj_values_item_union3 = null;
3471
+ const obj_values_item_union3_error = (() => {
3472
+ if (obj_values_item !== null) {
3473
+ return new TypeError('Expected "null" but received "' + typeof obj_values_item + '" (at "' + path_values_item + '")');
3474
+ }
3475
+ })();
3476
+ if (obj_values_item_union3_error != null) {
3477
+ obj_values_item_union3 = obj_values_item_union3_error.message;
3478
+ }
3479
+ if (obj_values_item_union0 && obj_values_item_union1 && obj_values_item_union2 && obj_values_item_union3) {
3480
+ let message = 'Object doesn\'t match union (at "' + path_values_item + '")';
3481
+ message += '\n' + obj_values_item_union0.split('\n').map((line) => '\t' + line).join('\n');
3482
+ message += '\n' + obj_values_item_union1.split('\n').map((line) => '\t' + line).join('\n');
3483
+ message += '\n' + obj_values_item_union2.split('\n').map((line) => '\t' + line).join('\n');
3484
+ message += '\n' + obj_values_item_union3.split('\n').map((line) => '\t' + line).join('\n');
3485
+ return new TypeError(message);
3486
+ }
3487
+ }
3488
+ }
3489
+ })();
3490
+ return v_error === undefined ? null : v_error;
3491
+ }
3492
+ const select$2 = function GetFilterValuesResponse_CategoricalValuesSelect() {
3493
+ return {
3494
+ kind: 'Fragment',
3495
+ version: VERSION$1,
3496
+ private: [],
3497
+ selections: [
3498
+ {
3499
+ name: 'values',
3500
+ kind: 'Scalar',
3501
+ plural: true,
3502
+ required: false
3503
+ }
3504
+ ]
3505
+ };
3506
+ };
3507
+ function equals$1(existing, incoming) {
3508
+ const existing_values = existing.values;
3509
+ const incoming_values = incoming.values;
3510
+ // if at least one of these optionals is defined
3511
+ if (existing_values !== undefined || incoming_values !== undefined) {
3512
+ // if one of these is not defined we know the other is defined and therefore
3513
+ // not equal
3514
+ if (existing_values === undefined || incoming_values === undefined) {
3515
+ return false;
3516
+ }
3517
+ const equals_values_items = equalsArray(existing_values, incoming_values, (existing_values_item, incoming_values_item) => {
3518
+ if (!(existing_values_item === incoming_values_item)) {
3519
+ return false;
3520
+ }
3521
+ });
3522
+ if (equals_values_items === false) {
3523
+ return false;
3524
+ }
3525
+ }
3526
+ return true;
3527
+ }
3528
+
3529
+ const VERSION = "2025bbf393050a10fae76d5b4d5d0f58";
3530
+ function validate(obj, path = 'GetFilterValuesResponse') {
3531
+ const v_error = (() => {
3532
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
3533
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
3534
+ }
3535
+ const obj_categoricalValues = obj.categoricalValues;
3536
+ const path_categoricalValues = path + '.categoricalValues';
3537
+ const referencepath_categoricalValuesValidationError = validate$1(obj_categoricalValues, path_categoricalValues);
3538
+ if (referencepath_categoricalValuesValidationError !== null) {
3539
+ let message = 'Object doesn\'t match GetFilterValuesResponse_CategoricalValues (at "' + path_categoricalValues + '")\n';
3540
+ message += referencepath_categoricalValuesValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
3541
+ return new TypeError(message);
3542
+ }
3543
+ const obj_id = obj.id;
3544
+ const path_id = path + '.id';
3545
+ if (typeof obj_id !== 'string') {
3546
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
3547
+ }
3548
+ if (obj.nextPageToken !== undefined) {
3549
+ const obj_nextPageToken = obj.nextPageToken;
3550
+ const path_nextPageToken = path + '.nextPageToken';
3551
+ if (typeof obj_nextPageToken !== 'string') {
3552
+ return new TypeError('Expected "string" but received "' + typeof obj_nextPageToken + '" (at "' + path_nextPageToken + '")');
3553
+ }
3554
+ }
3555
+ if (obj.totalAvailable !== undefined) {
3556
+ const obj_totalAvailable = obj.totalAvailable;
3557
+ const path_totalAvailable = path + '.totalAvailable';
3558
+ if (typeof obj_totalAvailable !== 'number' || (typeof obj_totalAvailable === 'number' && Math.floor(obj_totalAvailable) !== obj_totalAvailable)) {
3559
+ return new TypeError('Expected "integer" but received "' + typeof obj_totalAvailable + '" (at "' + path_totalAvailable + '")');
3560
+ }
3561
+ }
3562
+ })();
3563
+ return v_error === undefined ? null : v_error;
3564
+ }
3565
+ const RepresentationType = 'GetFilterValuesResponse';
3566
+ function keyBuilder(luvio, config) {
3567
+ return keyPrefix + '::' + RepresentationType + ':' + config.filterpageid;
3568
+ }
3569
+ function keyBuilderFromType(luvio, object) {
3570
+ const keyParams = {
3571
+ filterpageid: object.id
3572
+ };
3573
+ return keyBuilder(luvio, keyParams);
3574
+ }
3575
+ function normalize(input, existing, path, luvio, store, timestamp) {
3576
+ return input;
3577
+ }
3578
+ const select$1 = function GetFilterValuesResponseSelect() {
3579
+ const { selections: GetFilterValuesResponse_CategoricalValues__selections, opaque: GetFilterValuesResponse_CategoricalValues__opaque, } = select$2();
3580
+ return {
3581
+ kind: 'Fragment',
3582
+ version: VERSION,
3583
+ private: [],
3584
+ selections: [
3585
+ {
3586
+ name: 'categoricalValues',
3587
+ kind: 'Object',
3588
+ selections: GetFilterValuesResponse_CategoricalValues__selections
3589
+ },
3590
+ {
3591
+ name: 'id',
3592
+ kind: 'Scalar'
3593
+ },
3594
+ {
3595
+ name: 'nextPageToken',
3596
+ kind: 'Scalar',
3597
+ required: false
3598
+ },
3599
+ {
3600
+ name: 'totalAvailable',
3601
+ kind: 'Scalar',
3602
+ required: false
3603
+ }
3604
+ ]
3605
+ };
3606
+ };
3607
+ function equals(existing, incoming) {
3608
+ const existing_totalAvailable = existing.totalAvailable;
3609
+ const incoming_totalAvailable = incoming.totalAvailable;
3610
+ // if at least one of these optionals is defined
3611
+ if (existing_totalAvailable !== undefined || incoming_totalAvailable !== undefined) {
3612
+ // if one of these is not defined we know the other is defined and therefore
3613
+ // not equal
3614
+ if (existing_totalAvailable === undefined || incoming_totalAvailable === undefined) {
3615
+ return false;
3616
+ }
3617
+ if (!(existing_totalAvailable === incoming_totalAvailable)) {
3618
+ return false;
3619
+ }
3620
+ }
3621
+ const existing_id = existing.id;
3622
+ const incoming_id = incoming.id;
3623
+ if (!(existing_id === incoming_id)) {
3624
+ return false;
3625
+ }
3626
+ const existing_nextPageToken = existing.nextPageToken;
3627
+ const incoming_nextPageToken = incoming.nextPageToken;
3628
+ // if at least one of these optionals is defined
3629
+ if (existing_nextPageToken !== undefined || incoming_nextPageToken !== undefined) {
3630
+ // if one of these is not defined we know the other is defined and therefore
3631
+ // not equal
3632
+ if (existing_nextPageToken === undefined || incoming_nextPageToken === undefined) {
3633
+ return false;
3634
+ }
3635
+ if (!(existing_nextPageToken === incoming_nextPageToken)) {
3636
+ return false;
3637
+ }
3638
+ }
3639
+ const existing_categoricalValues = existing.categoricalValues;
3640
+ const incoming_categoricalValues = incoming.categoricalValues;
3641
+ if (!(equals$1(existing_categoricalValues, incoming_categoricalValues))) {
3642
+ return false;
3643
+ }
3644
+ return true;
3645
+ }
3646
+ const ingest = function GetFilterValuesResponseIngest(input, path, luvio, store, timestamp) {
3647
+ if (process.env.NODE_ENV !== 'production') {
3648
+ const validateError = validate(input);
3649
+ if (validateError !== null) {
3650
+ throw validateError;
3651
+ }
3652
+ }
3653
+ const key = keyBuilderFromType(luvio, input);
3654
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 300000;
3655
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "analytics-insights", VERSION, RepresentationType, equals);
3656
+ return createLink(key);
3657
+ };
3658
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
3659
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
3660
+ const rootKey = keyBuilderFromType(luvio, input);
3661
+ rootKeySet.set(rootKey, {
3662
+ namespace: keyPrefix,
3663
+ representationName: RepresentationType,
3664
+ mergeable: false
3665
+ });
3666
+ }
3667
+
3668
+ function select(luvio, params) {
3669
+ return select$1();
3670
+ }
3671
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
3672
+ getTypeCacheKeys(storeKeyMap, luvio, response);
3673
+ }
3674
+ function ingestSuccess(luvio, resourceParams, response) {
3675
+ const { body } = response;
3676
+ const key = keyBuilderFromType(luvio, body);
3677
+ luvio.storeIngest(key, ingest, body);
3678
+ const snapshot = luvio.storeLookup({
3679
+ recordId: key,
3680
+ node: select(),
3681
+ variables: {},
3682
+ });
3683
+ if (process.env.NODE_ENV !== 'production') {
3684
+ if (snapshot.state !== 'Fulfilled') {
3685
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
3686
+ }
3687
+ }
3688
+ deepFreeze(snapshot.data);
3689
+ return snapshot;
3690
+ }
3691
+ function createResourceRequest(config) {
3692
+ const headers = {};
3693
+ const header_xSfdcSourceapp = config.headers.xSfdcSourceapp;
3694
+ if (header_xSfdcSourceapp !== undefined) {
3695
+ headers['x-sfdc-sourceapp'] = header_xSfdcSourceapp;
3696
+ }
3697
+ const header_xSfdcSourcecontext = config.headers.xSfdcSourcecontext;
3698
+ if (header_xSfdcSourcecontext !== undefined) {
3699
+ headers['x-sfdc-sourcecontext'] = header_xSfdcSourcecontext;
3700
+ }
3701
+ return {
3702
+ baseUri: 'api.salesforce.com',
3703
+ basePath: '/analytics/insights/v1/filterValues',
3704
+ method: 'post',
3705
+ body: config.body,
3706
+ urlParams: {},
3707
+ queryParams: {},
3708
+ headers,
3709
+ priority: 'normal',
3710
+ };
3711
+ }
3712
+
3713
+ const adapterName = 'getMetricFilterValues';
3714
+ const getMetricFilterValues_ConfigPropertyMetadata = [
3715
+ generateParamConfigMetadata('semanticDataModel', true, 2 /* Body */, 4 /* Unsupported */),
3716
+ generateParamConfigMetadata('field', true, 2 /* Body */, 4 /* Unsupported */),
3717
+ generateParamConfigMetadata('pageToken', false, 2 /* Body */, 0 /* String */),
3718
+ generateParamConfigMetadata('pageSize', false, 2 /* Body */, 3 /* Integer */),
3719
+ generateParamConfigMetadata('searchTerm', false, 2 /* Body */, 0 /* String */),
3720
+ generateParamConfigMetadata('filters', false, 2 /* Body */, 4 /* Unsupported */, true),
3721
+ generateParamConfigMetadata('semanticFilter', false, 2 /* Body */, 4 /* Unsupported */),
3722
+ generateParamConfigMetadata('xSfdcSourceapp', false, 3 /* Header */, 0 /* String */),
3723
+ generateParamConfigMetadata('xSfdcSourcecontext', false, 3 /* Header */, 0 /* String */),
3724
+ ];
3725
+ const getMetricFilterValues_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getMetricFilterValues_ConfigPropertyMetadata);
3726
+ const createResourceParams = /*#__PURE__*/ createResourceParams$5(getMetricFilterValues_ConfigPropertyMetadata);
3727
+ function typeCheckConfig(untrustedConfig) {
3728
+ const config = {};
3729
+ typeCheckConfig$5(untrustedConfig, config, getMetricFilterValues_ConfigPropertyMetadata);
3730
+ const untrustedConfig_semanticDataModel = untrustedConfig.semanticDataModel;
3731
+ const referenceSemanticDataModelValidationError = validate$s(untrustedConfig_semanticDataModel);
3732
+ if (referenceSemanticDataModelValidationError === null) {
3733
+ config.semanticDataModel = untrustedConfig_semanticDataModel;
3734
+ }
3735
+ const untrustedConfig_field = untrustedConfig.field;
3736
+ const referenceFieldIdValidationError = validate$B(untrustedConfig_field);
3737
+ if (referenceFieldIdValidationError === null) {
3738
+ config.field = untrustedConfig_field;
3739
+ }
3740
+ const untrustedConfig_filters = untrustedConfig.filters;
3741
+ if (ArrayIsArray$1(untrustedConfig_filters)) {
3742
+ const untrustedConfig_filters_array = [];
3743
+ for (let i = 0, arrayLength = untrustedConfig_filters.length; i < arrayLength; i++) {
3744
+ const untrustedConfig_filters_item = untrustedConfig_filters[i];
3745
+ const referenceFilterValidationError = validate$y(untrustedConfig_filters_item);
3746
+ if (referenceFilterValidationError === null) {
3747
+ untrustedConfig_filters_array.push(untrustedConfig_filters_item);
3748
+ }
3749
+ }
3750
+ config.filters = untrustedConfig_filters_array;
3751
+ }
3752
+ const untrustedConfig_semanticFilter = untrustedConfig.semanticFilter;
3753
+ const referenceFlattenFilterValidationError = validate$w(untrustedConfig_semanticFilter);
3754
+ if (referenceFlattenFilterValidationError === null) {
3755
+ config.semanticFilter = untrustedConfig_semanticFilter;
3756
+ }
3757
+ return config;
3758
+ }
3759
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
3760
+ if (!untrustedIsObject(untrustedConfig)) {
3761
+ return null;
3762
+ }
3763
+ if (process.env.NODE_ENV !== 'production') {
3764
+ validateConfig(untrustedConfig, configPropertyNames);
3765
+ }
3766
+ const config = typeCheckConfig(untrustedConfig);
3767
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
3768
+ return null;
3769
+ }
3770
+ return config;
3771
+ }
3772
+ function buildNetworkSnapshot(luvio, config, options) {
3773
+ const resourceParams = createResourceParams(config);
3774
+ const request = createResourceRequest(resourceParams);
3775
+ return luvio.dispatchResourceRequest(request, options)
3776
+ .then((response) => {
3777
+ return luvio.handleSuccessResponse(() => {
3778
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
3779
+ return luvio.storeBroadcast().then(() => snapshot);
3780
+ }, () => {
3781
+ const cache = new StoreKeyMap();
3782
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
3783
+ return cache;
3784
+ });
3785
+ }, (response) => {
3786
+ deepFreeze(response);
3787
+ throw response;
3788
+ });
3789
+ }
3790
+ const getMetricFilterValuesAdapterFactory = (luvio) => {
3791
+ return function getMetricFilterValues(untrustedConfig) {
3792
+ const config = validateAdapterConfig(untrustedConfig, getMetricFilterValues_ConfigPropertyNames);
3793
+ // Invalid or incomplete config
3794
+ if (config === null) {
3795
+ throw new Error('Invalid config for "getMetricFilterValues"');
3796
+ }
3797
+ return buildNetworkSnapshot(luvio, config);
3798
+ };
3799
+ };
3800
+
3801
+ let createInsightsBatch;
3802
+ let generateInsights;
3803
+ let generateInsightsBasic;
3804
+ let getInsightsBatch;
3805
+ let getInsightsBatchNotifyChange;
3806
+ let getMetricFilterValues;
3807
+ // Imperative GET Adapters
3808
+ let getInsightsBatch_imperative;
3809
+ const getInsightsBatchMetadata = {
3810
+ apiFamily: 'analyticsinsights',
3811
+ name: 'getInsightsBatch',
3812
+ ttl: 5000,
3813
+ };
3814
+ // Notify Update Available
3815
+ function bindExportsTo(luvio) {
3816
+ // LDS Adapters
3817
+ const getInsightsBatch_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getInsightsBatch', getInsightsBatchAdapterFactory), getInsightsBatchMetadata);
3818
+ function unwrapSnapshotData(factory) {
3819
+ const adapter = factory(luvio);
3820
+ return (config) => adapter(config).then((snapshot) => snapshot.data);
3821
+ }
3822
+ return {
3823
+ createInsightsBatch: unwrapSnapshotData(createInsightsBatchAdapterFactory),
3824
+ generateInsights: unwrapSnapshotData(generateInsightsAdapterFactory),
3825
+ generateInsightsBasic: unwrapSnapshotData(generateInsightsBasicAdapterFactory),
3826
+ getInsightsBatch: createWireAdapterConstructor(luvio, getInsightsBatch_ldsAdapter, getInsightsBatchMetadata),
3827
+ getInsightsBatchNotifyChange: createLDSAdapter(luvio, 'getInsightsBatchNotifyChange', notifyChangeFactory),
3828
+ getMetricFilterValues: unwrapSnapshotData(getMetricFilterValuesAdapterFactory),
3829
+ // Imperative GET Adapters
3830
+ getInsightsBatch_imperative: createImperativeAdapter(luvio, getInsightsBatch_ldsAdapter, getInsightsBatchMetadata),
3831
+ // Notify Update Availables
3832
+ };
3833
+ }
3834
+ withDefaultLuvio((luvio) => {
3835
+ ({
3836
+ createInsightsBatch,
3837
+ generateInsights,
3838
+ generateInsightsBasic,
3839
+ getInsightsBatch,
3840
+ getInsightsBatchNotifyChange,
3841
+ getMetricFilterValues,
3842
+ getInsightsBatch_imperative,
3843
+ } = bindExportsTo(luvio));
3844
+ });
3845
+
3846
+ export { createInsightsBatch, generateInsights, generateInsightsBasic, getInsightsBatch, getInsightsBatchNotifyChange, getInsightsBatch_imperative, getMetricFilterValues };
3847
+ // version: 0.1.0-dev1-c978a7b010