@salesforce/lds-adapters-analytics-unifiedanalytics 1.287.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/analytics-unifiedanalytics.js +1138 -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/createDashboard.d.ts +24 -0
  5. package/dist/es/es2018/types/src/generated/adapters/getDashboardByName.d.ts +28 -0
  6. package/dist/es/es2018/types/src/generated/adapters/getDashboards.d.ts +28 -0
  7. package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +3 -0
  8. package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +7 -0
  9. package/dist/es/es2018/types/src/generated/resources/deleteUnifiedAnalyticsDashboardsByDashboardIdOrApiName.d.ts +11 -0
  10. package/dist/es/es2018/types/src/generated/resources/getUnifiedAnalyticsDashboards.d.ts +16 -0
  11. package/dist/es/es2018/types/src/generated/resources/getUnifiedAnalyticsDashboardsByDashboardIdOrApiName.d.ts +16 -0
  12. package/dist/es/es2018/types/src/generated/resources/patchUnifiedAnalyticsDashboardsByDashboardIdOrApiName.d.ts +24 -0
  13. package/dist/es/es2018/types/src/generated/resources/postUnifiedAnalyticsDashboards.d.ts +21 -0
  14. package/dist/es/es2018/types/src/generated/types/AnalyticsUserRepresentation.d.ts +29 -0
  15. package/dist/es/es2018/types/src/generated/types/AnalyticsWidgetInputRepresentation.d.ts +43 -0
  16. package/dist/es/es2018/types/src/generated/types/AnalyticsWidgetRepresentation.d.ts +32 -0
  17. package/dist/es/es2018/types/src/generated/types/AnalyticsWidgetStylesInputRepresentation.d.ts +40 -0
  18. package/dist/es/es2018/types/src/generated/types/AnalyticsWidgetStylesRepresentation.d.ts +40 -0
  19. package/dist/es/es2018/types/src/generated/types/BaseAnalyticsRepresentation.d.ts +37 -0
  20. package/dist/es/es2018/types/src/generated/types/ButtonWidgetIconInputRepresentation.d.ts +31 -0
  21. package/dist/es/es2018/types/src/generated/types/ButtonWidgetIconRepresentation.d.ts +31 -0
  22. package/dist/es/es2018/types/src/generated/types/ButtonWidgetParametersInputRepresentation.d.ts +46 -0
  23. package/dist/es/es2018/types/src/generated/types/ButtonWidgetParametersRepresentation.d.ts +46 -0
  24. package/dist/es/es2018/types/src/generated/types/ButtonWidgetStylesInputRepresentation.d.ts +32 -0
  25. package/dist/es/es2018/types/src/generated/types/ButtonWidgetStylesRepresentation.d.ts +32 -0
  26. package/dist/es/es2018/types/src/generated/types/DashboardCollectionRepresentation.d.ts +38 -0
  27. package/dist/es/es2018/types/src/generated/types/DashboardInputRepresentation.d.ts +49 -0
  28. package/dist/es/es2018/types/src/generated/types/DashboardLayoutInputRepresentation.d.ts +41 -0
  29. package/dist/es/es2018/types/src/generated/types/DashboardLayoutPageInputRepresentation.d.ts +44 -0
  30. package/dist/es/es2018/types/src/generated/types/DashboardLayoutPageRepresentation.d.ts +33 -0
  31. package/dist/es/es2018/types/src/generated/types/DashboardLayoutRepresentation.d.ts +30 -0
  32. package/dist/es/es2018/types/src/generated/types/DashboardPageWidgetInputRepresentation.d.ts +49 -0
  33. package/dist/es/es2018/types/src/generated/types/DashboardPageWidgetRepresentation.d.ts +38 -0
  34. package/dist/es/es2018/types/src/generated/types/DashboardRepresentation.d.ts +74 -0
  35. package/dist/es/es2018/types/src/generated/types/FilterWidgetParametersInputRepresentation.d.ts +32 -0
  36. package/dist/es/es2018/types/src/generated/types/FilterWidgetParametersRepresentation.d.ts +32 -0
  37. package/dist/es/es2018/types/src/generated/types/TextWidgetContentAttributeInputRepresentation.d.ts +34 -0
  38. package/dist/es/es2018/types/src/generated/types/TextWidgetContentAttributeRepresentation.d.ts +34 -0
  39. package/dist/es/es2018/types/src/generated/types/TextWidgetContentParameterInputRepresentation.d.ts +31 -0
  40. package/dist/es/es2018/types/src/generated/types/TextWidgetContentParameterRepresentation.d.ts +32 -0
  41. package/dist/es/es2018/types/src/generated/types/TextWidgetParametersInputRepresentation.d.ts +31 -0
  42. package/dist/es/es2018/types/src/generated/types/TextWidgetParametersRepresentation.d.ts +32 -0
  43. package/dist/es/es2018/types/src/generated/types/VisualizationWidgetParametersInputRepresentation.d.ts +31 -0
  44. package/dist/es/es2018/types/src/generated/types/VisualizationWidgetParametersRepresentation.d.ts +31 -0
  45. package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
  46. package/package.json +66 -0
  47. package/sfdc/index.d.ts +1 -0
  48. package/sfdc/index.js +1225 -0
  49. package/src/raml/api.raml +623 -0
  50. package/src/raml/luvio.raml +29 -0
@@ -0,0 +1,1138 @@
1
+ /**
2
+ * Copyright (c) 2022, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+
7
+ import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$2, typeCheckConfig as typeCheckConfig$3, StoreKeyMap, createResourceParams as createResourceParams$3 } from '@luvio/engine';
8
+
9
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
+ const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
11
+ const { isArray: ArrayIsArray$1 } = Array;
12
+ /**
13
+ * Validates an adapter config is well-formed.
14
+ * @param config The config to validate.
15
+ * @param adapter The adapter validation configuration.
16
+ * @param oneOf The keys the config must contain at least one of.
17
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
18
+ */
19
+ function validateConfig(config, adapter, oneOf) {
20
+ const { displayName } = adapter;
21
+ const { required, optional, unsupported } = adapter.parameters;
22
+ if (config === undefined ||
23
+ required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
24
+ throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
25
+ }
26
+ if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
27
+ throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
28
+ }
29
+ if (unsupported !== undefined &&
30
+ unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
31
+ throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
32
+ }
33
+ const supported = required.concat(optional);
34
+ if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
35
+ throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
36
+ }
37
+ }
38
+ function untrustedIsObject(untrusted) {
39
+ return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
40
+ }
41
+ function areRequiredParametersPresent(config, configPropertyNames) {
42
+ return configPropertyNames.parameters.required.every(req => req in config);
43
+ }
44
+ const snapshotRefreshOptions = {
45
+ overrides: {
46
+ headers: {
47
+ 'Cache-Control': 'no-cache',
48
+ },
49
+ }
50
+ };
51
+ function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
52
+ return {
53
+ name,
54
+ required,
55
+ resourceType,
56
+ typeCheckShape,
57
+ isArrayShape,
58
+ coerceFn,
59
+ };
60
+ }
61
+ function buildAdapterValidationConfig(displayName, paramsMeta) {
62
+ const required = paramsMeta.filter(p => p.required).map(p => p.name);
63
+ const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
64
+ return {
65
+ displayName,
66
+ parameters: {
67
+ required,
68
+ optional,
69
+ }
70
+ };
71
+ }
72
+ const keyPrefix = 'UnifiedAnalytics';
73
+
74
+ const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
75
+ const { isArray: ArrayIsArray } = Array;
76
+ const { stringify: JSONStringify } = JSON;
77
+ function equalsArray(a, b, equalsItem) {
78
+ const aLength = a.length;
79
+ const bLength = b.length;
80
+ if (aLength !== bLength) {
81
+ return false;
82
+ }
83
+ for (let i = 0; i < aLength; i++) {
84
+ if (equalsItem(a[i], b[i]) === false) {
85
+ return false;
86
+ }
87
+ }
88
+ return true;
89
+ }
90
+ function createLink(ref) {
91
+ return {
92
+ __ref: serializeStructuredKey(ref),
93
+ };
94
+ }
95
+
96
+ function validate$b(obj, path = 'BaseAnalyticsRepresentation') {
97
+ const v_error = (() => {
98
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
99
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
100
+ }
101
+ if (obj.description !== undefined) {
102
+ const obj_description = obj.description;
103
+ const path_description = path + '.description';
104
+ if (typeof obj_description !== 'string') {
105
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
106
+ }
107
+ }
108
+ const obj_id = obj.id;
109
+ const path_id = path + '.id';
110
+ if (typeof obj_id !== 'string') {
111
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
112
+ }
113
+ if (obj.label !== undefined) {
114
+ const obj_label = obj.label;
115
+ const path_label = path + '.label';
116
+ if (typeof obj_label !== 'string') {
117
+ return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
118
+ }
119
+ }
120
+ if (obj.name !== undefined) {
121
+ const obj_name = obj.name;
122
+ const path_name = path + '.name';
123
+ if (typeof obj_name !== 'string') {
124
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
125
+ }
126
+ }
127
+ })();
128
+ return v_error === undefined ? null : v_error;
129
+ }
130
+
131
+ function validate$a(obj, path = 'AnalyticsUserRepresentation') {
132
+ const validateBaseAnalyticsRepresentation_validateError = validate$b(obj, path);
133
+ if (validateBaseAnalyticsRepresentation_validateError !== null) {
134
+ return validateBaseAnalyticsRepresentation_validateError;
135
+ }
136
+ const v_error = (() => {
137
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
138
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
139
+ }
140
+ if (obj.profilePhotoUrl !== undefined) {
141
+ const obj_profilePhotoUrl = obj.profilePhotoUrl;
142
+ const path_profilePhotoUrl = path + '.profilePhotoUrl';
143
+ let obj_profilePhotoUrl_union0 = null;
144
+ const obj_profilePhotoUrl_union0_error = (() => {
145
+ if (typeof obj_profilePhotoUrl !== 'string') {
146
+ return new TypeError('Expected "string" but received "' + typeof obj_profilePhotoUrl + '" (at "' + path_profilePhotoUrl + '")');
147
+ }
148
+ })();
149
+ if (obj_profilePhotoUrl_union0_error != null) {
150
+ obj_profilePhotoUrl_union0 = obj_profilePhotoUrl_union0_error.message;
151
+ }
152
+ let obj_profilePhotoUrl_union1 = null;
153
+ const obj_profilePhotoUrl_union1_error = (() => {
154
+ if (obj_profilePhotoUrl !== null) {
155
+ return new TypeError('Expected "null" but received "' + typeof obj_profilePhotoUrl + '" (at "' + path_profilePhotoUrl + '")');
156
+ }
157
+ })();
158
+ if (obj_profilePhotoUrl_union1_error != null) {
159
+ obj_profilePhotoUrl_union1 = obj_profilePhotoUrl_union1_error.message;
160
+ }
161
+ if (obj_profilePhotoUrl_union0 && obj_profilePhotoUrl_union1) {
162
+ let message = 'Object doesn\'t match union (at "' + path_profilePhotoUrl + '")';
163
+ message += '\n' + obj_profilePhotoUrl_union0.split('\n').map((line) => '\t' + line).join('\n');
164
+ message += '\n' + obj_profilePhotoUrl_union1.split('\n').map((line) => '\t' + line).join('\n');
165
+ return new TypeError(message);
166
+ }
167
+ }
168
+ })();
169
+ return v_error === undefined ? null : v_error;
170
+ }
171
+
172
+ function validate$9(obj, path = 'DashboardPageWidgetRepresentation') {
173
+ const validateBaseAnalyticsRepresentation_validateError = validate$b(obj, path);
174
+ if (validateBaseAnalyticsRepresentation_validateError !== null) {
175
+ return validateBaseAnalyticsRepresentation_validateError;
176
+ }
177
+ const v_error = (() => {
178
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
179
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
180
+ }
181
+ const obj_colspan = obj.colspan;
182
+ const path_colspan = path + '.colspan';
183
+ if (typeof obj_colspan !== 'number' || (typeof obj_colspan === 'number' && Math.floor(obj_colspan) !== obj_colspan)) {
184
+ return new TypeError('Expected "integer" but received "' + typeof obj_colspan + '" (at "' + path_colspan + '")');
185
+ }
186
+ const obj_column = obj.column;
187
+ const path_column = path + '.column';
188
+ if (typeof obj_column !== 'number' || (typeof obj_column === 'number' && Math.floor(obj_column) !== obj_column)) {
189
+ return new TypeError('Expected "integer" but received "' + typeof obj_column + '" (at "' + path_column + '")');
190
+ }
191
+ const obj_row = obj.row;
192
+ const path_row = path + '.row';
193
+ if (typeof obj_row !== 'number' || (typeof obj_row === 'number' && Math.floor(obj_row) !== obj_row)) {
194
+ return new TypeError('Expected "integer" but received "' + typeof obj_row + '" (at "' + path_row + '")');
195
+ }
196
+ const obj_rowspan = obj.rowspan;
197
+ const path_rowspan = path + '.rowspan';
198
+ if (typeof obj_rowspan !== 'number' || (typeof obj_rowspan === 'number' && Math.floor(obj_rowspan) !== obj_rowspan)) {
199
+ return new TypeError('Expected "integer" but received "' + typeof obj_rowspan + '" (at "' + path_rowspan + '")');
200
+ }
201
+ })();
202
+ return v_error === undefined ? null : v_error;
203
+ }
204
+
205
+ function validate$8(obj, path = 'DashboardLayoutPageRepresentation') {
206
+ const validateBaseAnalyticsRepresentation_validateError = validate$b(obj, path);
207
+ if (validateBaseAnalyticsRepresentation_validateError !== null) {
208
+ return validateBaseAnalyticsRepresentation_validateError;
209
+ }
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.navigationHidden !== undefined) {
215
+ const obj_navigationHidden = obj.navigationHidden;
216
+ const path_navigationHidden = path + '.navigationHidden';
217
+ if (typeof obj_navigationHidden !== 'boolean') {
218
+ return new TypeError('Expected "boolean" but received "' + typeof obj_navigationHidden + '" (at "' + path_navigationHidden + '")');
219
+ }
220
+ }
221
+ const obj_widgets = obj.widgets;
222
+ const path_widgets = path + '.widgets';
223
+ if (!ArrayIsArray(obj_widgets)) {
224
+ return new TypeError('Expected "array" but received "' + typeof obj_widgets + '" (at "' + path_widgets + '")');
225
+ }
226
+ for (let i = 0; i < obj_widgets.length; i++) {
227
+ const obj_widgets_item = obj_widgets[i];
228
+ const path_widgets_item = path_widgets + '[' + i + ']';
229
+ const referencepath_widgets_itemValidationError = validate$9(obj_widgets_item, path_widgets_item);
230
+ if (referencepath_widgets_itemValidationError !== null) {
231
+ let message = 'Object doesn\'t match DashboardPageWidgetRepresentation (at "' + path_widgets_item + '")\n';
232
+ message += referencepath_widgets_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
233
+ return new TypeError(message);
234
+ }
235
+ }
236
+ })();
237
+ return v_error === undefined ? null : v_error;
238
+ }
239
+
240
+ function validate$7(obj, path = 'DashboardLayoutRepresentation') {
241
+ const validateBaseAnalyticsRepresentation_validateError = validate$b(obj, path);
242
+ if (validateBaseAnalyticsRepresentation_validateError !== null) {
243
+ return validateBaseAnalyticsRepresentation_validateError;
244
+ }
245
+ const v_error = (() => {
246
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
247
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
248
+ }
249
+ const obj_pages = obj.pages;
250
+ const path_pages = path + '.pages';
251
+ if (!ArrayIsArray(obj_pages)) {
252
+ return new TypeError('Expected "array" but received "' + typeof obj_pages + '" (at "' + path_pages + '")');
253
+ }
254
+ for (let i = 0; i < obj_pages.length; i++) {
255
+ const obj_pages_item = obj_pages[i];
256
+ const path_pages_item = path_pages + '[' + i + ']';
257
+ const referencepath_pages_itemValidationError = validate$8(obj_pages_item, path_pages_item);
258
+ if (referencepath_pages_itemValidationError !== null) {
259
+ let message = 'Object doesn\'t match DashboardLayoutPageRepresentation (at "' + path_pages_item + '")\n';
260
+ message += referencepath_pages_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
261
+ return new TypeError(message);
262
+ }
263
+ }
264
+ })();
265
+ return v_error === undefined ? null : v_error;
266
+ }
267
+
268
+ function validate$6(obj, path = 'AnalyticsWidgetRepresentation') {
269
+ const validateBaseAnalyticsRepresentation_validateError = validate$b(obj, path);
270
+ if (validateBaseAnalyticsRepresentation_validateError !== null) {
271
+ return validateBaseAnalyticsRepresentation_validateError;
272
+ }
273
+ const v_error = (() => {
274
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
275
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
276
+ }
277
+ const obj_parameters = obj.parameters;
278
+ const path_parameters = path + '.parameters';
279
+ if (obj_parameters === undefined) {
280
+ return new TypeError('Expected "defined" but received "' + typeof obj_parameters + '" (at "' + path_parameters + '")');
281
+ }
282
+ const obj_type = obj.type;
283
+ const path_type = path + '.type';
284
+ if (typeof obj_type !== 'string') {
285
+ return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
286
+ }
287
+ })();
288
+ return v_error === undefined ? null : v_error;
289
+ }
290
+
291
+ const VERSION$1 = "0f0931d08d785620d6d9fe5956fcf344";
292
+ function validate$5(obj, path = 'DashboardRepresentation') {
293
+ const v_error = (() => {
294
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
295
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
296
+ }
297
+ const obj_createdBy = obj.createdBy;
298
+ const path_createdBy = path + '.createdBy';
299
+ const referencepath_createdByValidationError = validate$a(obj_createdBy, path_createdBy);
300
+ if (referencepath_createdByValidationError !== null) {
301
+ let message = 'Object doesn\'t match AnalyticsUserRepresentation (at "' + path_createdBy + '")\n';
302
+ message += referencepath_createdByValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
303
+ return new TypeError(message);
304
+ }
305
+ const obj_createdDate = obj.createdDate;
306
+ const path_createdDate = path + '.createdDate';
307
+ if (typeof obj_createdDate !== 'string') {
308
+ return new TypeError('Expected "string" but received "' + typeof obj_createdDate + '" (at "' + path_createdDate + '")');
309
+ }
310
+ if (obj.description !== undefined) {
311
+ const obj_description = obj.description;
312
+ const path_description = path + '.description';
313
+ if (typeof obj_description !== 'string') {
314
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
315
+ }
316
+ }
317
+ const obj_id = obj.id;
318
+ const path_id = path + '.id';
319
+ if (typeof obj_id !== 'string') {
320
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
321
+ }
322
+ const obj_label = obj.label;
323
+ const path_label = path + '.label';
324
+ if (typeof obj_label !== 'string') {
325
+ return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
326
+ }
327
+ if (obj.lastModifiedBy !== undefined) {
328
+ const obj_lastModifiedBy = obj.lastModifiedBy;
329
+ const path_lastModifiedBy = path + '.lastModifiedBy';
330
+ const referencepath_lastModifiedByValidationError = validate$a(obj_lastModifiedBy, path_lastModifiedBy);
331
+ if (referencepath_lastModifiedByValidationError !== null) {
332
+ let message = 'Object doesn\'t match AnalyticsUserRepresentation (at "' + path_lastModifiedBy + '")\n';
333
+ message += referencepath_lastModifiedByValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
334
+ return new TypeError(message);
335
+ }
336
+ }
337
+ if (obj.lastModifiedDate !== undefined) {
338
+ const obj_lastModifiedDate = obj.lastModifiedDate;
339
+ const path_lastModifiedDate = path + '.lastModifiedDate';
340
+ if (typeof obj_lastModifiedDate !== 'string') {
341
+ return new TypeError('Expected "string" but received "' + typeof obj_lastModifiedDate + '" (at "' + path_lastModifiedDate + '")');
342
+ }
343
+ }
344
+ const obj_layouts = obj.layouts;
345
+ const path_layouts = path + '.layouts';
346
+ if (!ArrayIsArray(obj_layouts)) {
347
+ return new TypeError('Expected "array" but received "' + typeof obj_layouts + '" (at "' + path_layouts + '")');
348
+ }
349
+ for (let i = 0; i < obj_layouts.length; i++) {
350
+ const obj_layouts_item = obj_layouts[i];
351
+ const path_layouts_item = path_layouts + '[' + i + ']';
352
+ const referencepath_layouts_itemValidationError = validate$7(obj_layouts_item, path_layouts_item);
353
+ if (referencepath_layouts_itemValidationError !== null) {
354
+ let message = 'Object doesn\'t match DashboardLayoutRepresentation (at "' + path_layouts_item + '")\n';
355
+ message += referencepath_layouts_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
356
+ return new TypeError(message);
357
+ }
358
+ }
359
+ const obj_name = obj.name;
360
+ const path_name = path + '.name';
361
+ if (typeof obj_name !== 'string') {
362
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
363
+ }
364
+ const obj_url = obj.url;
365
+ const path_url = path + '.url';
366
+ if (typeof obj_url !== 'string') {
367
+ return new TypeError('Expected "string" but received "' + typeof obj_url + '" (at "' + path_url + '")');
368
+ }
369
+ const obj_widgets = obj.widgets;
370
+ const path_widgets = path + '.widgets';
371
+ if (typeof obj_widgets !== 'object' || ArrayIsArray(obj_widgets) || obj_widgets === null) {
372
+ return new TypeError('Expected "object" but received "' + typeof obj_widgets + '" (at "' + path_widgets + '")');
373
+ }
374
+ const obj_widgets_keys = ObjectKeys(obj_widgets);
375
+ for (let i = 0; i < obj_widgets_keys.length; i++) {
376
+ const key = obj_widgets_keys[i];
377
+ const obj_widgets_prop = obj_widgets[key];
378
+ const path_widgets_prop = path_widgets + '["' + key + '"]';
379
+ const referencepath_widgets_propValidationError = validate$6(obj_widgets_prop, path_widgets_prop);
380
+ if (referencepath_widgets_propValidationError !== null) {
381
+ let message = 'Object doesn\'t match AnalyticsWidgetRepresentation (at "' + path_widgets_prop + '")\n';
382
+ message += referencepath_widgets_propValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
383
+ return new TypeError(message);
384
+ }
385
+ }
386
+ })();
387
+ return v_error === undefined ? null : v_error;
388
+ }
389
+ const RepresentationType$1 = 'DashboardRepresentation';
390
+ function keyBuilder$4(luvio, config) {
391
+ return keyPrefix + '::' + RepresentationType$1 + ':' + config.name;
392
+ }
393
+ function keyBuilderFromType(luvio, object) {
394
+ const keyParams = {
395
+ name: object.name
396
+ };
397
+ return keyBuilder$4(luvio, keyParams);
398
+ }
399
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
400
+ return input;
401
+ }
402
+ const select$4 = function DashboardRepresentationSelect() {
403
+ return {
404
+ kind: 'Fragment',
405
+ version: VERSION$1,
406
+ private: [],
407
+ opaque: true
408
+ };
409
+ };
410
+ function equals$1(existing, incoming) {
411
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
412
+ return false;
413
+ }
414
+ return true;
415
+ }
416
+ const ingest$1 = function DashboardRepresentationIngest(input, path, luvio, store, timestamp) {
417
+ if (process.env.NODE_ENV !== 'production') {
418
+ const validateError = validate$5(input);
419
+ if (validateError !== null) {
420
+ throw validateError;
421
+ }
422
+ }
423
+ const key = keyBuilderFromType(luvio, input);
424
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 2592000000;
425
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "UnifiedAnalytics", VERSION$1, RepresentationType$1, equals$1);
426
+ return createLink(key);
427
+ };
428
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
429
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
430
+ const rootKey = keyBuilderFromType(luvio, input);
431
+ rootKeySet.set(rootKey, {
432
+ namespace: keyPrefix,
433
+ representationName: RepresentationType$1,
434
+ mergeable: false
435
+ });
436
+ }
437
+
438
+ const VERSION = "962823130e6a9315240ef0e0f0c5f757";
439
+ function validate$4(obj, path = 'DashboardCollectionRepresentation') {
440
+ const v_error = (() => {
441
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
442
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
443
+ }
444
+ const obj_dashboards = obj.dashboards;
445
+ const path_dashboards = path + '.dashboards';
446
+ if (!ArrayIsArray(obj_dashboards)) {
447
+ return new TypeError('Expected "array" but received "' + typeof obj_dashboards + '" (at "' + path_dashboards + '")');
448
+ }
449
+ for (let i = 0; i < obj_dashboards.length; i++) {
450
+ const obj_dashboards_item = obj_dashboards[i];
451
+ const path_dashboards_item = path_dashboards + '[' + i + ']';
452
+ if (typeof obj_dashboards_item !== 'object') {
453
+ return new TypeError('Expected "object" but received "' + typeof obj_dashboards_item + '" (at "' + path_dashboards_item + '")');
454
+ }
455
+ }
456
+ })();
457
+ return v_error === undefined ? null : v_error;
458
+ }
459
+ const RepresentationType = 'DashboardCollectionRepresentation';
460
+ function normalize(input, existing, path, luvio, store, timestamp) {
461
+ const input_dashboards = input.dashboards;
462
+ const input_dashboards_id = path.fullPath + '__dashboards';
463
+ for (let i = 0; i < input_dashboards.length; i++) {
464
+ const input_dashboards_item = input_dashboards[i];
465
+ let input_dashboards_item_id = input_dashboards_id + '__' + i;
466
+ input_dashboards[i] = ingest$1(input_dashboards_item, {
467
+ fullPath: input_dashboards_item_id,
468
+ propertyName: i,
469
+ parent: {
470
+ data: input,
471
+ key: path.fullPath,
472
+ existing: existing,
473
+ },
474
+ ttl: path.ttl
475
+ }, luvio, store, timestamp);
476
+ }
477
+ return input;
478
+ }
479
+ const select$3 = function DashboardCollectionRepresentationSelect() {
480
+ return {
481
+ kind: 'Fragment',
482
+ version: VERSION,
483
+ private: [],
484
+ selections: [
485
+ {
486
+ name: 'dashboards',
487
+ kind: 'Link',
488
+ plural: true,
489
+ fragment: select$4()
490
+ }
491
+ ]
492
+ };
493
+ };
494
+ function equals(existing, incoming) {
495
+ const existing_dashboards = existing.dashboards;
496
+ const incoming_dashboards = incoming.dashboards;
497
+ const equals_dashboards_items = equalsArray(existing_dashboards, incoming_dashboards, (existing_dashboards_item, incoming_dashboards_item) => {
498
+ if (!(existing_dashboards_item.__ref === incoming_dashboards_item.__ref)) {
499
+ return false;
500
+ }
501
+ });
502
+ if (equals_dashboards_items === false) {
503
+ return false;
504
+ }
505
+ return true;
506
+ }
507
+ const ingest = function DashboardCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
508
+ if (process.env.NODE_ENV !== 'production') {
509
+ const validateError = validate$4(input);
510
+ if (validateError !== null) {
511
+ throw validateError;
512
+ }
513
+ }
514
+ const key = path.fullPath;
515
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 2592000000;
516
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "UnifiedAnalytics", VERSION, RepresentationType, equals);
517
+ return createLink(key);
518
+ };
519
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
520
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
521
+ const rootKey = fullPathFactory();
522
+ rootKeySet.set(rootKey, {
523
+ namespace: keyPrefix,
524
+ representationName: RepresentationType,
525
+ mergeable: false
526
+ });
527
+ const input_dashboards_length = input.dashboards.length;
528
+ for (let i = 0; i < input_dashboards_length; i++) {
529
+ getTypeCacheKeys$1(rootKeySet, luvio, input.dashboards[i]);
530
+ }
531
+ }
532
+
533
+ function select$2(luvio, params) {
534
+ return select$3();
535
+ }
536
+ function keyBuilder$3(luvio, params) {
537
+ return keyPrefix + '::DashboardCollectionRepresentation:(' + 'limit:' + params.queryParams.limit + ',' + 'offset:' + params.queryParams.offset + ')';
538
+ }
539
+ function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
540
+ getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$3(luvio, resourceParams));
541
+ }
542
+ function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
543
+ const { body } = response;
544
+ const key = keyBuilder$3(luvio, resourceParams);
545
+ luvio.storeIngest(key, ingest, body);
546
+ const snapshot = luvio.storeLookup({
547
+ recordId: key,
548
+ node: select$2(),
549
+ variables: {},
550
+ }, snapshotRefresh);
551
+ if (process.env.NODE_ENV !== 'production') {
552
+ if (snapshot.state !== 'Fulfilled') {
553
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
554
+ }
555
+ }
556
+ deepFreeze(snapshot.data);
557
+ return snapshot;
558
+ }
559
+ function ingestError$1(luvio, params, error, snapshotRefresh) {
560
+ const key = keyBuilder$3(luvio, params);
561
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
562
+ luvio.storeIngestError(key, errorSnapshot);
563
+ return errorSnapshot;
564
+ }
565
+ function createResourceRequest$2(config) {
566
+ const headers = {};
567
+ return {
568
+ baseUri: '/services/data/v61.0',
569
+ basePath: '/unified-analytics/dashboards',
570
+ method: 'get',
571
+ body: null,
572
+ urlParams: {},
573
+ queryParams: config.queryParams,
574
+ headers,
575
+ priority: 'normal',
576
+ };
577
+ }
578
+
579
+ const adapterName$2 = 'getDashboards';
580
+ const getDashboards_ConfigPropertyMetadata = [
581
+ generateParamConfigMetadata('limit', false, 1 /* QueryParameter */, 3 /* Integer */),
582
+ generateParamConfigMetadata('offset', false, 1 /* QueryParameter */, 3 /* Integer */),
583
+ ];
584
+ const getDashboards_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getDashboards_ConfigPropertyMetadata);
585
+ const createResourceParams$2 = /*#__PURE__*/ createResourceParams$3(getDashboards_ConfigPropertyMetadata);
586
+ function keyBuilder$2(luvio, config) {
587
+ const resourceParams = createResourceParams$2(config);
588
+ return keyBuilder$3(luvio, resourceParams);
589
+ }
590
+ function typeCheckConfig$2(untrustedConfig) {
591
+ const config = {};
592
+ typeCheckConfig$3(untrustedConfig, config, getDashboards_ConfigPropertyMetadata);
593
+ return config;
594
+ }
595
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
596
+ if (!untrustedIsObject(untrustedConfig)) {
597
+ return null;
598
+ }
599
+ if (process.env.NODE_ENV !== 'production') {
600
+ validateConfig(untrustedConfig, configPropertyNames);
601
+ }
602
+ const config = typeCheckConfig$2(untrustedConfig);
603
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
604
+ return null;
605
+ }
606
+ return config;
607
+ }
608
+ function adapterFragment$1(luvio, config) {
609
+ createResourceParams$2(config);
610
+ return select$2();
611
+ }
612
+ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
613
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
614
+ config,
615
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
616
+ });
617
+ return luvio.storeBroadcast().then(() => snapshot);
618
+ }
619
+ function onFetchResponseError$1(luvio, config, resourceParams, response) {
620
+ const snapshot = ingestError$1(luvio, resourceParams, response, {
621
+ config,
622
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
623
+ });
624
+ return luvio.storeBroadcast().then(() => snapshot);
625
+ }
626
+ function buildNetworkSnapshot$2(luvio, config, options) {
627
+ const resourceParams = createResourceParams$2(config);
628
+ const request = createResourceRequest$2(resourceParams);
629
+ return luvio.dispatchResourceRequest(request, options)
630
+ .then((response) => {
631
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
632
+ const cache = new StoreKeyMap();
633
+ getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
634
+ return cache;
635
+ });
636
+ }, (response) => {
637
+ return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
638
+ });
639
+ }
640
+ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
641
+ return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, undefined, false);
642
+ }
643
+ function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
644
+ const { luvio, config } = context;
645
+ const selector = {
646
+ recordId: keyBuilder$2(luvio, config),
647
+ node: adapterFragment$1(luvio, config),
648
+ variables: {},
649
+ };
650
+ const cacheSnapshot = storeLookup(selector, {
651
+ config,
652
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
653
+ });
654
+ return cacheSnapshot;
655
+ }
656
+ const getDashboardsAdapterFactory = (luvio) => function UnifiedAnalytics__getDashboards(untrustedConfig, requestContext) {
657
+ const config = validateAdapterConfig$2(untrustedConfig, getDashboards_ConfigPropertyNames);
658
+ // Invalid or incomplete config
659
+ if (config === null) {
660
+ return null;
661
+ }
662
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
663
+ buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
664
+ };
665
+
666
+ function validate$3(obj, path = 'DashboardPageWidgetInputRepresentation') {
667
+ const v_error = (() => {
668
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
669
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
670
+ }
671
+ const obj_colspan = obj.colspan;
672
+ const path_colspan = path + '.colspan';
673
+ if (typeof obj_colspan !== 'number' || (typeof obj_colspan === 'number' && Math.floor(obj_colspan) !== obj_colspan)) {
674
+ return new TypeError('Expected "integer" but received "' + typeof obj_colspan + '" (at "' + path_colspan + '")');
675
+ }
676
+ const obj_column = obj.column;
677
+ const path_column = path + '.column';
678
+ if (typeof obj_column !== 'number' || (typeof obj_column === 'number' && Math.floor(obj_column) !== obj_column)) {
679
+ return new TypeError('Expected "integer" but received "' + typeof obj_column + '" (at "' + path_column + '")');
680
+ }
681
+ if (obj.description !== undefined) {
682
+ const obj_description = obj.description;
683
+ const path_description = path + '.description';
684
+ if (typeof obj_description !== 'string') {
685
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
686
+ }
687
+ }
688
+ if (obj.id !== undefined) {
689
+ const obj_id = obj.id;
690
+ const path_id = path + '.id';
691
+ if (typeof obj_id !== 'string') {
692
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
693
+ }
694
+ }
695
+ if (obj.label !== undefined) {
696
+ const obj_label = obj.label;
697
+ const path_label = path + '.label';
698
+ if (typeof obj_label !== 'string') {
699
+ return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
700
+ }
701
+ }
702
+ if (obj.name !== undefined) {
703
+ const obj_name = obj.name;
704
+ const path_name = path + '.name';
705
+ if (typeof obj_name !== 'string') {
706
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
707
+ }
708
+ }
709
+ const obj_row = obj.row;
710
+ const path_row = path + '.row';
711
+ if (typeof obj_row !== 'number' || (typeof obj_row === 'number' && Math.floor(obj_row) !== obj_row)) {
712
+ return new TypeError('Expected "integer" but received "' + typeof obj_row + '" (at "' + path_row + '")');
713
+ }
714
+ const obj_rowspan = obj.rowspan;
715
+ const path_rowspan = path + '.rowspan';
716
+ if (typeof obj_rowspan !== 'number' || (typeof obj_rowspan === 'number' && Math.floor(obj_rowspan) !== obj_rowspan)) {
717
+ return new TypeError('Expected "integer" but received "' + typeof obj_rowspan + '" (at "' + path_rowspan + '")');
718
+ }
719
+ })();
720
+ return v_error === undefined ? null : v_error;
721
+ }
722
+
723
+ function validate$2(obj, path = 'DashboardLayoutPageInputRepresentation') {
724
+ const v_error = (() => {
725
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
726
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
727
+ }
728
+ if (obj.description !== undefined) {
729
+ const obj_description = obj.description;
730
+ const path_description = path + '.description';
731
+ if (typeof obj_description !== 'string') {
732
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
733
+ }
734
+ }
735
+ if (obj.id !== undefined) {
736
+ const obj_id = obj.id;
737
+ const path_id = path + '.id';
738
+ if (typeof obj_id !== 'string') {
739
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
740
+ }
741
+ }
742
+ const obj_label = obj.label;
743
+ const path_label = path + '.label';
744
+ if (typeof obj_label !== 'string') {
745
+ return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
746
+ }
747
+ if (obj.name !== undefined) {
748
+ const obj_name = obj.name;
749
+ const path_name = path + '.name';
750
+ if (typeof obj_name !== 'string') {
751
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
752
+ }
753
+ }
754
+ if (obj.navigationHidden !== undefined) {
755
+ const obj_navigationHidden = obj.navigationHidden;
756
+ const path_navigationHidden = path + '.navigationHidden';
757
+ if (typeof obj_navigationHidden !== 'boolean') {
758
+ return new TypeError('Expected "boolean" but received "' + typeof obj_navigationHidden + '" (at "' + path_navigationHidden + '")');
759
+ }
760
+ }
761
+ const obj_widgets = obj.widgets;
762
+ const path_widgets = path + '.widgets';
763
+ if (!ArrayIsArray(obj_widgets)) {
764
+ return new TypeError('Expected "array" but received "' + typeof obj_widgets + '" (at "' + path_widgets + '")');
765
+ }
766
+ for (let i = 0; i < obj_widgets.length; i++) {
767
+ const obj_widgets_item = obj_widgets[i];
768
+ const path_widgets_item = path_widgets + '[' + i + ']';
769
+ const referencepath_widgets_itemValidationError = validate$3(obj_widgets_item, path_widgets_item);
770
+ if (referencepath_widgets_itemValidationError !== null) {
771
+ let message = 'Object doesn\'t match DashboardPageWidgetInputRepresentation (at "' + path_widgets_item + '")\n';
772
+ message += referencepath_widgets_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
773
+ return new TypeError(message);
774
+ }
775
+ }
776
+ })();
777
+ return v_error === undefined ? null : v_error;
778
+ }
779
+
780
+ function validate$1(obj, path = 'DashboardLayoutInputRepresentation') {
781
+ const v_error = (() => {
782
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
783
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
784
+ }
785
+ if (obj.description !== undefined) {
786
+ const obj_description = obj.description;
787
+ const path_description = path + '.description';
788
+ if (typeof obj_description !== 'string') {
789
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
790
+ }
791
+ }
792
+ if (obj.id !== undefined) {
793
+ const obj_id = obj.id;
794
+ const path_id = path + '.id';
795
+ if (typeof obj_id !== 'string') {
796
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
797
+ }
798
+ }
799
+ if (obj.label !== undefined) {
800
+ const obj_label = obj.label;
801
+ const path_label = path + '.label';
802
+ if (typeof obj_label !== 'string') {
803
+ return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
804
+ }
805
+ }
806
+ if (obj.name !== undefined) {
807
+ const obj_name = obj.name;
808
+ const path_name = path + '.name';
809
+ if (typeof obj_name !== 'string') {
810
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
811
+ }
812
+ }
813
+ const obj_pages = obj.pages;
814
+ const path_pages = path + '.pages';
815
+ if (!ArrayIsArray(obj_pages)) {
816
+ return new TypeError('Expected "array" but received "' + typeof obj_pages + '" (at "' + path_pages + '")');
817
+ }
818
+ for (let i = 0; i < obj_pages.length; i++) {
819
+ const obj_pages_item = obj_pages[i];
820
+ const path_pages_item = path_pages + '[' + i + ']';
821
+ const referencepath_pages_itemValidationError = validate$2(obj_pages_item, path_pages_item);
822
+ if (referencepath_pages_itemValidationError !== null) {
823
+ let message = 'Object doesn\'t match DashboardLayoutPageInputRepresentation (at "' + path_pages_item + '")\n';
824
+ message += referencepath_pages_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
825
+ return new TypeError(message);
826
+ }
827
+ }
828
+ })();
829
+ return v_error === undefined ? null : v_error;
830
+ }
831
+
832
+ function validate(obj, path = 'AnalyticsWidgetInputRepresentation') {
833
+ const v_error = (() => {
834
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
835
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
836
+ }
837
+ if (obj.description !== undefined) {
838
+ const obj_description = obj.description;
839
+ const path_description = path + '.description';
840
+ if (typeof obj_description !== 'string') {
841
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
842
+ }
843
+ }
844
+ if (obj.id !== undefined) {
845
+ const obj_id = obj.id;
846
+ const path_id = path + '.id';
847
+ if (typeof obj_id !== 'string') {
848
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
849
+ }
850
+ }
851
+ if (obj.label !== undefined) {
852
+ const obj_label = obj.label;
853
+ const path_label = path + '.label';
854
+ if (typeof obj_label !== 'string') {
855
+ return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
856
+ }
857
+ }
858
+ if (obj.name !== undefined) {
859
+ const obj_name = obj.name;
860
+ const path_name = path + '.name';
861
+ if (typeof obj_name !== 'string') {
862
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
863
+ }
864
+ }
865
+ const obj_parameters = obj.parameters;
866
+ const path_parameters = path + '.parameters';
867
+ if (obj_parameters === undefined) {
868
+ return new TypeError('Expected "defined" but received "' + typeof obj_parameters + '" (at "' + path_parameters + '")');
869
+ }
870
+ const obj_type = obj.type;
871
+ const path_type = path + '.type';
872
+ if (typeof obj_type !== 'string') {
873
+ return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
874
+ }
875
+ })();
876
+ return v_error === undefined ? null : v_error;
877
+ }
878
+
879
+ function select$1(luvio, params) {
880
+ return select$4();
881
+ }
882
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
883
+ getTypeCacheKeys$1(storeKeyMap, luvio, response);
884
+ }
885
+ function ingestSuccess$1(luvio, resourceParams, response) {
886
+ const { body } = response;
887
+ const key = keyBuilderFromType(luvio, body);
888
+ luvio.storeIngest(key, ingest$1, body);
889
+ const snapshot = luvio.storeLookup({
890
+ recordId: key,
891
+ node: select$1(),
892
+ variables: {},
893
+ });
894
+ if (process.env.NODE_ENV !== 'production') {
895
+ if (snapshot.state !== 'Fulfilled') {
896
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
897
+ }
898
+ }
899
+ deepFreeze(snapshot.data);
900
+ return snapshot;
901
+ }
902
+ function createResourceRequest$1(config) {
903
+ const headers = {};
904
+ return {
905
+ baseUri: '/services/data/v61.0',
906
+ basePath: '/unified-analytics/dashboards',
907
+ method: 'post',
908
+ body: config.body,
909
+ urlParams: {},
910
+ queryParams: {},
911
+ headers,
912
+ priority: 'normal',
913
+ };
914
+ }
915
+
916
+ const adapterName$1 = 'createDashboard';
917
+ const createDashboard_ConfigPropertyMetadata = [
918
+ generateParamConfigMetadata('description', false, 2 /* Body */, 0 /* String */),
919
+ generateParamConfigMetadata('id', false, 2 /* Body */, 0 /* String */),
920
+ generateParamConfigMetadata('label', true, 2 /* Body */, 0 /* String */),
921
+ generateParamConfigMetadata('name', false, 2 /* Body */, 0 /* String */),
922
+ generateParamConfigMetadata('layouts', true, 2 /* Body */, 4 /* Unsupported */, true),
923
+ generateParamConfigMetadata('widgets', true, 2 /* Body */, 4 /* Unsupported */),
924
+ ];
925
+ const createDashboard_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, createDashboard_ConfigPropertyMetadata);
926
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(createDashboard_ConfigPropertyMetadata);
927
+ function typeCheckConfig$1(untrustedConfig) {
928
+ const config = {};
929
+ typeCheckConfig$3(untrustedConfig, config, createDashboard_ConfigPropertyMetadata);
930
+ const untrustedConfig_layouts = untrustedConfig.layouts;
931
+ if (ArrayIsArray$1(untrustedConfig_layouts)) {
932
+ const untrustedConfig_layouts_array = [];
933
+ for (let i = 0, arrayLength = untrustedConfig_layouts.length; i < arrayLength; i++) {
934
+ const untrustedConfig_layouts_item = untrustedConfig_layouts[i];
935
+ const referenceDashboardLayoutInputRepresentationValidationError = validate$1(untrustedConfig_layouts_item);
936
+ if (referenceDashboardLayoutInputRepresentationValidationError === null) {
937
+ untrustedConfig_layouts_array.push(untrustedConfig_layouts_item);
938
+ }
939
+ }
940
+ config.layouts = untrustedConfig_layouts_array;
941
+ }
942
+ const untrustedConfig_widgets = untrustedConfig.widgets;
943
+ if (untrustedIsObject(untrustedConfig_widgets)) {
944
+ const untrustedConfig_widgets_object = {};
945
+ const untrustedConfig_widgets_keys = Object.keys(untrustedConfig_widgets);
946
+ for (let i = 0, arrayLength = untrustedConfig_widgets_keys.length; i < arrayLength; i++) {
947
+ const key = untrustedConfig_widgets_keys[i];
948
+ const untrustedConfig_widgets_prop = untrustedConfig_widgets[key];
949
+ const referenceAnalyticsWidgetInputRepresentationValidationError = validate(untrustedConfig_widgets_prop);
950
+ if (referenceAnalyticsWidgetInputRepresentationValidationError === null) {
951
+ if (untrustedConfig_widgets_object !== undefined) {
952
+ untrustedConfig_widgets_object[key] = untrustedConfig_widgets_prop;
953
+ }
954
+ }
955
+ }
956
+ if (untrustedConfig_widgets_object !== undefined && Object.keys(untrustedConfig_widgets_object).length >= 0) {
957
+ config.widgets = untrustedConfig_widgets_object;
958
+ }
959
+ }
960
+ return config;
961
+ }
962
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
963
+ if (!untrustedIsObject(untrustedConfig)) {
964
+ return null;
965
+ }
966
+ if (process.env.NODE_ENV !== 'production') {
967
+ validateConfig(untrustedConfig, configPropertyNames);
968
+ }
969
+ const config = typeCheckConfig$1(untrustedConfig);
970
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
971
+ return null;
972
+ }
973
+ return config;
974
+ }
975
+ function buildNetworkSnapshot$1(luvio, config, options) {
976
+ const resourceParams = createResourceParams$1(config);
977
+ const request = createResourceRequest$1(resourceParams);
978
+ return luvio.dispatchResourceRequest(request, options)
979
+ .then((response) => {
980
+ return luvio.handleSuccessResponse(() => {
981
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response);
982
+ return luvio.storeBroadcast().then(() => snapshot);
983
+ }, () => {
984
+ const cache = new StoreKeyMap();
985
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
986
+ return cache;
987
+ });
988
+ }, (response) => {
989
+ deepFreeze(response);
990
+ throw response;
991
+ });
992
+ }
993
+ const createDashboardAdapterFactory = (luvio) => {
994
+ return function createDashboard(untrustedConfig) {
995
+ const config = validateAdapterConfig$1(untrustedConfig, createDashboard_ConfigPropertyNames);
996
+ // Invalid or incomplete config
997
+ if (config === null) {
998
+ throw new Error('Invalid config for "createDashboard"');
999
+ }
1000
+ return buildNetworkSnapshot$1(luvio, config);
1001
+ };
1002
+ };
1003
+
1004
+ function select(luvio, params) {
1005
+ return select$4();
1006
+ }
1007
+ function keyBuilder$1(luvio, params) {
1008
+ return keyBuilder$4(luvio, {
1009
+ name: params.urlParams.dashboardIdOrApiName
1010
+ });
1011
+ }
1012
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
1013
+ getTypeCacheKeys$1(storeKeyMap, luvio, response);
1014
+ }
1015
+ function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
1016
+ const { body } = response;
1017
+ const key = keyBuilder$1(luvio, resourceParams);
1018
+ luvio.storeIngest(key, ingest$1, body);
1019
+ const snapshot = luvio.storeLookup({
1020
+ recordId: key,
1021
+ node: select(),
1022
+ variables: {},
1023
+ }, snapshotRefresh);
1024
+ if (process.env.NODE_ENV !== 'production') {
1025
+ if (snapshot.state !== 'Fulfilled') {
1026
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1027
+ }
1028
+ }
1029
+ deepFreeze(snapshot.data);
1030
+ return snapshot;
1031
+ }
1032
+ function ingestError(luvio, params, error, snapshotRefresh) {
1033
+ const key = keyBuilder$1(luvio, params);
1034
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1035
+ luvio.storeIngestError(key, errorSnapshot);
1036
+ return errorSnapshot;
1037
+ }
1038
+ function createResourceRequest(config) {
1039
+ const headers = {};
1040
+ return {
1041
+ baseUri: '/services/data/v61.0',
1042
+ basePath: '/unified-analytics/dashboards/' + config.urlParams.dashboardIdOrApiName + '',
1043
+ method: 'get',
1044
+ body: null,
1045
+ urlParams: config.urlParams,
1046
+ queryParams: {},
1047
+ headers,
1048
+ priority: 'normal',
1049
+ };
1050
+ }
1051
+
1052
+ const adapterName = 'getDashboardByName';
1053
+ const getDashboardByName_ConfigPropertyMetadata = [
1054
+ generateParamConfigMetadata('dashboardIdOrApiName', true, 0 /* UrlParameter */, 0 /* String */),
1055
+ ];
1056
+ const getDashboardByName_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getDashboardByName_ConfigPropertyMetadata);
1057
+ const createResourceParams = /*#__PURE__*/ createResourceParams$3(getDashboardByName_ConfigPropertyMetadata);
1058
+ function keyBuilder(luvio, config) {
1059
+ const resourceParams = createResourceParams(config);
1060
+ return keyBuilder$1(luvio, resourceParams);
1061
+ }
1062
+ function typeCheckConfig(untrustedConfig) {
1063
+ const config = {};
1064
+ typeCheckConfig$3(untrustedConfig, config, getDashboardByName_ConfigPropertyMetadata);
1065
+ return config;
1066
+ }
1067
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
1068
+ if (!untrustedIsObject(untrustedConfig)) {
1069
+ return null;
1070
+ }
1071
+ if (process.env.NODE_ENV !== 'production') {
1072
+ validateConfig(untrustedConfig, configPropertyNames);
1073
+ }
1074
+ const config = typeCheckConfig(untrustedConfig);
1075
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1076
+ return null;
1077
+ }
1078
+ return config;
1079
+ }
1080
+ function adapterFragment(luvio, config) {
1081
+ createResourceParams(config);
1082
+ return select();
1083
+ }
1084
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
1085
+ const snapshot = ingestSuccess(luvio, resourceParams, response, {
1086
+ config,
1087
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
1088
+ });
1089
+ return luvio.storeBroadcast().then(() => snapshot);
1090
+ }
1091
+ function onFetchResponseError(luvio, config, resourceParams, response) {
1092
+ const snapshot = ingestError(luvio, resourceParams, response, {
1093
+ config,
1094
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
1095
+ });
1096
+ return luvio.storeBroadcast().then(() => snapshot);
1097
+ }
1098
+ function buildNetworkSnapshot(luvio, config, options) {
1099
+ const resourceParams = createResourceParams(config);
1100
+ const request = createResourceRequest(resourceParams);
1101
+ return luvio.dispatchResourceRequest(request, options)
1102
+ .then((response) => {
1103
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
1104
+ const cache = new StoreKeyMap();
1105
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
1106
+ return cache;
1107
+ });
1108
+ }, (response) => {
1109
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
1110
+ });
1111
+ }
1112
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
1113
+ return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
1114
+ }
1115
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
1116
+ const { luvio, config } = context;
1117
+ const selector = {
1118
+ recordId: keyBuilder(luvio, config),
1119
+ node: adapterFragment(luvio, config),
1120
+ variables: {},
1121
+ };
1122
+ const cacheSnapshot = storeLookup(selector, {
1123
+ config,
1124
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
1125
+ });
1126
+ return cacheSnapshot;
1127
+ }
1128
+ const getDashboardByNameAdapterFactory = (luvio) => function UnifiedAnalytics__getDashboardByName(untrustedConfig, requestContext) {
1129
+ const config = validateAdapterConfig(untrustedConfig, getDashboardByName_ConfigPropertyNames);
1130
+ // Invalid or incomplete config
1131
+ if (config === null) {
1132
+ return null;
1133
+ }
1134
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
1135
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
1136
+ };
1137
+
1138
+ export { createDashboardAdapterFactory, getDashboardByNameAdapterFactory, getDashboardsAdapterFactory };