@salesforce/lds-adapters-analytics-wave-private 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 (26) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/analytics-wave-private.js +1364 -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 +22 -0
  5. package/dist/es/es2018/types/src/generated/adapters/executeSoqlQueryPost.d.ts +27 -0
  6. package/dist/es/es2018/types/src/generated/adapters/executeTemplateSetupPlan.d.ts +16 -0
  7. package/dist/es/es2018/types/src/generated/adapters/getTemplateSetupPlan.d.ts +29 -0
  8. package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +4 -0
  9. package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +8 -0
  10. package/dist/es/es2018/types/src/generated/resources/getWaveTemplatesPlansByPlanNameAndTemplateIdOrApiName.d.ts +17 -0
  11. package/dist/es/es2018/types/src/generated/resources/postWaveDashboards.d.ts +19 -0
  12. package/dist/es/es2018/types/src/generated/resources/postWaveSoql.d.ts +15 -0
  13. package/dist/es/es2018/types/src/generated/resources/postWaveTemplatesPlansByPlanNameAndTemplateIdOrApiName.d.ts +13 -0
  14. package/dist/es/es2018/types/src/generated/types/BaseDashboardInputRepresentation.d.ts +47 -0
  15. package/dist/es/es2018/types/src/generated/types/DashboardRepresentation.d.ts +40 -0
  16. package/dist/es/es2018/types/src/generated/types/SoqlQueryInputRepresentation.d.ts +28 -0
  17. package/dist/es/es2018/types/src/generated/types/SoqlQueryResultRepresentation.d.ts +35 -0
  18. package/dist/es/es2018/types/src/generated/types/TemplateSetupJobRepresentation.d.ts +41 -0
  19. package/dist/es/es2018/types/src/generated/types/TemplateSetupPlanRepresentation.d.ts +60 -0
  20. package/dist/es/es2018/types/src/generated/types/TemplateSetupTaskRepresentation.d.ts +55 -0
  21. package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
  22. package/package.json +75 -0
  23. package/sfdc/index.d.ts +1 -0
  24. package/sfdc/index.js +1460 -0
  25. package/src/raml/api.raml +278 -0
  26. package/src/raml/luvio.raml +43 -0
@@ -0,0 +1,1364 @@
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$4, StoreKeyMap, createResourceParams as createResourceParams$4 } 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 = 'WAVE';
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 equalsObject(a, b, equalsProp) {
91
+ const aKeys = ObjectKeys(a).sort();
92
+ const bKeys = ObjectKeys(b).sort();
93
+ const aKeysLength = aKeys.length;
94
+ const bKeysLength = bKeys.length;
95
+ if (aKeysLength !== bKeysLength) {
96
+ return false;
97
+ }
98
+ for (let i = 0; i < aKeys.length; i++) {
99
+ const key = aKeys[i];
100
+ if (key !== bKeys[i]) {
101
+ return false;
102
+ }
103
+ if (equalsProp(a[key], b[key]) === false) {
104
+ return false;
105
+ }
106
+ }
107
+ return true;
108
+ }
109
+ function createLink(ref) {
110
+ return {
111
+ __ref: serializeStructuredKey(ref),
112
+ };
113
+ }
114
+
115
+ const TTL$2 = 5000;
116
+ const VERSION$4 = "f4d046d44230e53375ee20bbd2483a1f";
117
+ function validate$4(obj, path = 'SoqlQueryResultRepresentation') {
118
+ const v_error = (() => {
119
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
120
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
121
+ }
122
+ const obj_keys = ObjectKeys(obj);
123
+ for (let i = 0; i < obj_keys.length; i++) {
124
+ const key = obj_keys[i];
125
+ const obj_prop = obj[key];
126
+ const path_prop = path + '["' + key + '"]';
127
+ if (obj_prop === undefined) {
128
+ return new TypeError('Expected "defined" but received "' + typeof obj_prop + '" (at "' + path_prop + '")');
129
+ }
130
+ }
131
+ if (obj.done !== undefined) {
132
+ const obj_done = obj.done;
133
+ const path_done = path + '.done';
134
+ if (typeof obj_done !== 'boolean') {
135
+ return new TypeError('Expected "boolean" but received "' + typeof obj_done + '" (at "' + path_done + '")');
136
+ }
137
+ }
138
+ const obj_records = obj.records;
139
+ const path_records = path + '.records';
140
+ if (!ArrayIsArray(obj_records)) {
141
+ return new TypeError('Expected "array" but received "' + typeof obj_records + '" (at "' + path_records + '")');
142
+ }
143
+ for (let i = 0; i < obj_records.length; i++) {
144
+ const obj_records_item = obj_records[i];
145
+ const path_records_item = path_records + '[' + i + ']';
146
+ if (obj_records_item === undefined) {
147
+ return new TypeError('Expected "defined" but received "' + typeof obj_records_item + '" (at "' + path_records_item + '")');
148
+ }
149
+ }
150
+ if (obj.totalSize !== undefined) {
151
+ const obj_totalSize = obj.totalSize;
152
+ const path_totalSize = path + '.totalSize';
153
+ if (typeof obj_totalSize !== 'number') {
154
+ return new TypeError('Expected "number" but received "' + typeof obj_totalSize + '" (at "' + path_totalSize + '")');
155
+ }
156
+ }
157
+ })();
158
+ return v_error === undefined ? null : v_error;
159
+ }
160
+ const RepresentationType$2 = 'SoqlQueryResultRepresentation';
161
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
162
+ return input;
163
+ }
164
+ const select$8 = function SoqlQueryResultRepresentationSelect() {
165
+ return {
166
+ kind: 'Fragment',
167
+ version: VERSION$4,
168
+ private: [],
169
+ opaque: true
170
+ };
171
+ };
172
+ function equals$4(existing, incoming) {
173
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
174
+ return false;
175
+ }
176
+ return true;
177
+ }
178
+ const ingest$2 = function SoqlQueryResultRepresentationIngest(input, path, luvio, store, timestamp) {
179
+ if (process.env.NODE_ENV !== 'production') {
180
+ const validateError = validate$4(input);
181
+ if (validateError !== null) {
182
+ throw validateError;
183
+ }
184
+ }
185
+ const key = path.fullPath;
186
+ const ttlToUse = TTL$2;
187
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "WAVE", VERSION$4, RepresentationType$2, equals$4);
188
+ return createLink(key);
189
+ };
190
+ function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
191
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
192
+ const rootKey = fullPathFactory();
193
+ rootKeySet.set(rootKey, {
194
+ namespace: keyPrefix,
195
+ representationName: RepresentationType$2,
196
+ mergeable: false
197
+ });
198
+ }
199
+
200
+ function select$7(luvio, params) {
201
+ return select$8();
202
+ }
203
+ function keyBuilder$5(luvio, params) {
204
+ return keyPrefix + '::SoqlQueryResultRepresentation:(' + 'query:' + params.body.query + ')';
205
+ }
206
+ function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
207
+ getTypeCacheKeys$2(storeKeyMap, luvio, response, () => keyBuilder$5(luvio, resourceParams));
208
+ }
209
+ function ingestSuccess$3(luvio, resourceParams, response, snapshotRefresh) {
210
+ const { body } = response;
211
+ const key = keyBuilder$5(luvio, resourceParams);
212
+ luvio.storeIngest(key, ingest$2, body);
213
+ const snapshot = luvio.storeLookup({
214
+ recordId: key,
215
+ node: select$7(),
216
+ variables: {},
217
+ }, snapshotRefresh);
218
+ if (process.env.NODE_ENV !== 'production') {
219
+ if (snapshot.state !== 'Fulfilled') {
220
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
221
+ }
222
+ }
223
+ deepFreeze(snapshot.data);
224
+ return snapshot;
225
+ }
226
+ function ingestError$1(luvio, params, error, snapshotRefresh) {
227
+ const key = keyBuilder$5(luvio, params);
228
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
229
+ const storeMetadataParams = {
230
+ ttl: TTL$2,
231
+ namespace: keyPrefix,
232
+ version: VERSION$4,
233
+ representationName: RepresentationType$2
234
+ };
235
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
236
+ return errorSnapshot;
237
+ }
238
+ function createResourceRequest$3(config) {
239
+ const headers = {};
240
+ return {
241
+ baseUri: '/services/data/v66.0',
242
+ basePath: '/wave/soql',
243
+ method: 'post',
244
+ body: config.body,
245
+ urlParams: {},
246
+ queryParams: {},
247
+ headers,
248
+ priority: 'normal',
249
+ };
250
+ }
251
+
252
+ const adapterName$3 = 'executeSoqlQueryPost';
253
+ const executeSoqlQueryPost_ConfigPropertyMetadata = [
254
+ generateParamConfigMetadata('query', true, 2 /* Body */, 0 /* String */),
255
+ ];
256
+ const executeSoqlQueryPost_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, executeSoqlQueryPost_ConfigPropertyMetadata);
257
+ const createResourceParams$3 = /*#__PURE__*/ createResourceParams$4(executeSoqlQueryPost_ConfigPropertyMetadata);
258
+ function keyBuilder$4(luvio, config) {
259
+ const resourceParams = createResourceParams$3(config);
260
+ return keyBuilder$5(luvio, resourceParams);
261
+ }
262
+ function typeCheckConfig$3(untrustedConfig) {
263
+ const config = {};
264
+ typeCheckConfig$4(untrustedConfig, config, executeSoqlQueryPost_ConfigPropertyMetadata);
265
+ return config;
266
+ }
267
+ function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
268
+ if (!untrustedIsObject(untrustedConfig)) {
269
+ return null;
270
+ }
271
+ if (process.env.NODE_ENV !== 'production') {
272
+ validateConfig(untrustedConfig, configPropertyNames);
273
+ }
274
+ const config = typeCheckConfig$3(untrustedConfig);
275
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
276
+ return null;
277
+ }
278
+ return config;
279
+ }
280
+ function adapterFragment$1(luvio, config) {
281
+ createResourceParams$3(config);
282
+ return select$7();
283
+ }
284
+ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
285
+ const snapshot = ingestSuccess$3(luvio, resourceParams, response, {
286
+ config,
287
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
288
+ });
289
+ return luvio.storeBroadcast().then(() => snapshot);
290
+ }
291
+ function onFetchResponseError$1(luvio, config, resourceParams, response) {
292
+ const snapshot = ingestError$1(luvio, resourceParams, response, {
293
+ config,
294
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
295
+ });
296
+ return luvio.storeBroadcast().then(() => snapshot);
297
+ }
298
+ function buildNetworkSnapshot$3(luvio, config, options) {
299
+ const resourceParams = createResourceParams$3(config);
300
+ const request = createResourceRequest$3(resourceParams);
301
+ return luvio.dispatchResourceRequest(request, options)
302
+ .then((response) => {
303
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
304
+ const cache = new StoreKeyMap();
305
+ getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
306
+ return cache;
307
+ });
308
+ }, (response) => {
309
+ return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
310
+ });
311
+ }
312
+ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
313
+ return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$3, 'get', false);
314
+ }
315
+ function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
316
+ const { luvio, config } = context;
317
+ const selector = {
318
+ recordId: keyBuilder$4(luvio, config),
319
+ node: adapterFragment$1(luvio, config),
320
+ variables: {},
321
+ };
322
+ const cacheSnapshot = storeLookup(selector, {
323
+ config,
324
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
325
+ });
326
+ return cacheSnapshot;
327
+ }
328
+ const executeSoqlQueryPostAdapterFactory = (luvio) => function WAVE__executeSoqlQueryPost(untrustedConfig, requestContext) {
329
+ const config = validateAdapterConfig$3(untrustedConfig, executeSoqlQueryPost_ConfigPropertyNames);
330
+ // Invalid or incomplete config
331
+ if (config === null) {
332
+ return null;
333
+ }
334
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
335
+ buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
336
+ };
337
+
338
+ const VERSION$3 = "8414479b5bce7ab7da1015deb3422035";
339
+ function validate$3(obj, path = 'TemplateSetupTaskRepresentation') {
340
+ const v_error = (() => {
341
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
342
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
343
+ }
344
+ if (obj.description !== undefined) {
345
+ const obj_description = obj.description;
346
+ const path_description = path + '.description';
347
+ if (typeof obj_description !== 'string') {
348
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
349
+ }
350
+ }
351
+ if (obj.details !== undefined) {
352
+ const obj_details = obj.details;
353
+ const path_details = path + '.details';
354
+ if (typeof obj_details !== 'string') {
355
+ return new TypeError('Expected "string" but received "' + typeof obj_details + '" (at "' + path_details + '")');
356
+ }
357
+ }
358
+ if (obj.duration !== undefined) {
359
+ obj.duration;
360
+ }
361
+ if (obj.enabled !== undefined) {
362
+ const obj_enabled = obj.enabled;
363
+ const path_enabled = path + '.enabled';
364
+ if (typeof obj_enabled !== 'boolean') {
365
+ return new TypeError('Expected "boolean" but received "' + typeof obj_enabled + '" (at "' + path_enabled + '")');
366
+ }
367
+ }
368
+ if (obj.endDate !== undefined) {
369
+ const obj_endDate = obj.endDate;
370
+ const path_endDate = path + '.endDate';
371
+ if (typeof obj_endDate !== 'string') {
372
+ return new TypeError('Expected "string" but received "' + typeof obj_endDate + '" (at "' + path_endDate + '")');
373
+ }
374
+ }
375
+ if (obj.error !== undefined) {
376
+ const obj_error = obj.error;
377
+ const path_error = path + '.error';
378
+ if (typeof obj_error !== 'string') {
379
+ return new TypeError('Expected "string" but received "' + typeof obj_error + '" (at "' + path_error + '")');
380
+ }
381
+ }
382
+ const obj_name = obj.name;
383
+ const path_name = path + '.name';
384
+ if (typeof obj_name !== 'string') {
385
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
386
+ }
387
+ if (obj.setupUrl !== undefined) {
388
+ const obj_setupUrl = obj.setupUrl;
389
+ const path_setupUrl = path + '.setupUrl';
390
+ if (typeof obj_setupUrl !== 'string') {
391
+ return new TypeError('Expected "string" but received "' + typeof obj_setupUrl + '" (at "' + path_setupUrl + '")');
392
+ }
393
+ }
394
+ if (obj.startDate !== undefined) {
395
+ const obj_startDate = obj.startDate;
396
+ const path_startDate = path + '.startDate';
397
+ if (typeof obj_startDate !== 'string') {
398
+ return new TypeError('Expected "string" but received "' + typeof obj_startDate + '" (at "' + path_startDate + '")');
399
+ }
400
+ }
401
+ const obj_status = obj.status;
402
+ const path_status = path + '.status';
403
+ if (typeof obj_status !== 'string') {
404
+ return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
405
+ }
406
+ })();
407
+ return v_error === undefined ? null : v_error;
408
+ }
409
+ const select$6 = function TemplateSetupTaskRepresentationSelect() {
410
+ return {
411
+ kind: 'Fragment',
412
+ version: VERSION$3,
413
+ private: [],
414
+ selections: [
415
+ {
416
+ name: 'description',
417
+ kind: 'Scalar',
418
+ required: false
419
+ },
420
+ {
421
+ name: 'details',
422
+ kind: 'Scalar',
423
+ required: false
424
+ },
425
+ {
426
+ name: 'duration',
427
+ kind: 'Scalar',
428
+ required: false
429
+ },
430
+ {
431
+ name: 'enabled',
432
+ kind: 'Scalar',
433
+ required: false
434
+ },
435
+ {
436
+ name: 'endDate',
437
+ kind: 'Scalar',
438
+ required: false
439
+ },
440
+ {
441
+ name: 'error',
442
+ kind: 'Scalar',
443
+ required: false
444
+ },
445
+ {
446
+ name: 'name',
447
+ kind: 'Scalar'
448
+ },
449
+ {
450
+ name: 'setupUrl',
451
+ kind: 'Scalar',
452
+ required: false
453
+ },
454
+ {
455
+ name: 'startDate',
456
+ kind: 'Scalar',
457
+ required: false
458
+ },
459
+ {
460
+ name: 'status',
461
+ kind: 'Scalar'
462
+ }
463
+ ]
464
+ };
465
+ };
466
+ function equals$3(existing, incoming) {
467
+ const existing_enabled = existing.enabled;
468
+ const incoming_enabled = incoming.enabled;
469
+ // if at least one of these optionals is defined
470
+ if (existing_enabled !== undefined || incoming_enabled !== undefined) {
471
+ // if one of these is not defined we know the other is defined and therefore
472
+ // not equal
473
+ if (existing_enabled === undefined || incoming_enabled === undefined) {
474
+ return false;
475
+ }
476
+ if (!(existing_enabled === incoming_enabled)) {
477
+ return false;
478
+ }
479
+ }
480
+ const existing_description = existing.description;
481
+ const incoming_description = incoming.description;
482
+ // if at least one of these optionals is defined
483
+ if (existing_description !== undefined || incoming_description !== undefined) {
484
+ // if one of these is not defined we know the other is defined and therefore
485
+ // not equal
486
+ if (existing_description === undefined || incoming_description === undefined) {
487
+ return false;
488
+ }
489
+ if (!(existing_description === incoming_description)) {
490
+ return false;
491
+ }
492
+ }
493
+ const existing_details = existing.details;
494
+ const incoming_details = incoming.details;
495
+ // if at least one of these optionals is defined
496
+ if (existing_details !== undefined || incoming_details !== undefined) {
497
+ // if one of these is not defined we know the other is defined and therefore
498
+ // not equal
499
+ if (existing_details === undefined || incoming_details === undefined) {
500
+ return false;
501
+ }
502
+ if (!(existing_details === incoming_details)) {
503
+ return false;
504
+ }
505
+ }
506
+ const existing_endDate = existing.endDate;
507
+ const incoming_endDate = incoming.endDate;
508
+ // if at least one of these optionals is defined
509
+ if (existing_endDate !== undefined || incoming_endDate !== undefined) {
510
+ // if one of these is not defined we know the other is defined and therefore
511
+ // not equal
512
+ if (existing_endDate === undefined || incoming_endDate === undefined) {
513
+ return false;
514
+ }
515
+ if (!(existing_endDate === incoming_endDate)) {
516
+ return false;
517
+ }
518
+ }
519
+ const existing_error = existing.error;
520
+ const incoming_error = incoming.error;
521
+ // if at least one of these optionals is defined
522
+ if (existing_error !== undefined || incoming_error !== undefined) {
523
+ // if one of these is not defined we know the other is defined and therefore
524
+ // not equal
525
+ if (existing_error === undefined || incoming_error === undefined) {
526
+ return false;
527
+ }
528
+ if (!(existing_error === incoming_error)) {
529
+ return false;
530
+ }
531
+ }
532
+ const existing_name = existing.name;
533
+ const incoming_name = incoming.name;
534
+ if (!(existing_name === incoming_name)) {
535
+ return false;
536
+ }
537
+ const existing_setupUrl = existing.setupUrl;
538
+ const incoming_setupUrl = incoming.setupUrl;
539
+ // if at least one of these optionals is defined
540
+ if (existing_setupUrl !== undefined || incoming_setupUrl !== undefined) {
541
+ // if one of these is not defined we know the other is defined and therefore
542
+ // not equal
543
+ if (existing_setupUrl === undefined || incoming_setupUrl === undefined) {
544
+ return false;
545
+ }
546
+ if (!(existing_setupUrl === incoming_setupUrl)) {
547
+ return false;
548
+ }
549
+ }
550
+ const existing_startDate = existing.startDate;
551
+ const incoming_startDate = incoming.startDate;
552
+ // if at least one of these optionals is defined
553
+ if (existing_startDate !== undefined || incoming_startDate !== undefined) {
554
+ // if one of these is not defined we know the other is defined and therefore
555
+ // not equal
556
+ if (existing_startDate === undefined || incoming_startDate === undefined) {
557
+ return false;
558
+ }
559
+ if (!(existing_startDate === incoming_startDate)) {
560
+ return false;
561
+ }
562
+ }
563
+ const existing_status = existing.status;
564
+ const incoming_status = incoming.status;
565
+ if (!(existing_status === incoming_status)) {
566
+ return false;
567
+ }
568
+ const existing_duration = existing.duration;
569
+ const incoming_duration = incoming.duration;
570
+ // if at least one of these optionals is defined
571
+ if (existing_duration !== undefined || incoming_duration !== undefined) {
572
+ // if one of these is not defined we know the other is defined and therefore
573
+ // not equal
574
+ if (existing_duration === undefined || incoming_duration === undefined) {
575
+ return false;
576
+ }
577
+ if (!(existing_duration === incoming_duration)) {
578
+ return false;
579
+ }
580
+ }
581
+ return true;
582
+ }
583
+
584
+ const VERSION$2 = "902a8640d811c60e0dd88853dfbfe319";
585
+ function validate$2(obj, path = 'TemplateSetupJobRepresentation') {
586
+ const v_error = (() => {
587
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
588
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
589
+ }
590
+ if (obj.description !== undefined) {
591
+ const obj_description = obj.description;
592
+ const path_description = path + '.description';
593
+ if (typeof obj_description !== 'string') {
594
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
595
+ }
596
+ }
597
+ if (obj.duration !== undefined) {
598
+ obj.duration;
599
+ }
600
+ const obj_name = obj.name;
601
+ const path_name = path + '.name';
602
+ if (typeof obj_name !== 'string') {
603
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
604
+ }
605
+ const obj_status = obj.status;
606
+ const path_status = path + '.status';
607
+ if (typeof obj_status !== 'string') {
608
+ return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
609
+ }
610
+ const obj_tasks = obj.tasks;
611
+ const path_tasks = path + '.tasks';
612
+ if (!ArrayIsArray(obj_tasks)) {
613
+ return new TypeError('Expected "array" but received "' + typeof obj_tasks + '" (at "' + path_tasks + '")');
614
+ }
615
+ for (let i = 0; i < obj_tasks.length; i++) {
616
+ const obj_tasks_item = obj_tasks[i];
617
+ const path_tasks_item = path_tasks + '[' + i + ']';
618
+ const referencepath_tasks_itemValidationError = validate$3(obj_tasks_item, path_tasks_item);
619
+ if (referencepath_tasks_itemValidationError !== null) {
620
+ let message = 'Object doesn\'t match TemplateSetupTaskRepresentation (at "' + path_tasks_item + '")\n';
621
+ message += referencepath_tasks_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
622
+ return new TypeError(message);
623
+ }
624
+ }
625
+ })();
626
+ return v_error === undefined ? null : v_error;
627
+ }
628
+ const select$5 = function TemplateSetupJobRepresentationSelect() {
629
+ const { selections: TemplateSetupTaskRepresentation__selections, opaque: TemplateSetupTaskRepresentation__opaque, } = select$6();
630
+ return {
631
+ kind: 'Fragment',
632
+ version: VERSION$2,
633
+ private: [],
634
+ selections: [
635
+ {
636
+ name: 'description',
637
+ kind: 'Scalar',
638
+ required: false
639
+ },
640
+ {
641
+ name: 'duration',
642
+ kind: 'Scalar',
643
+ required: false
644
+ },
645
+ {
646
+ name: 'name',
647
+ kind: 'Scalar'
648
+ },
649
+ {
650
+ name: 'status',
651
+ kind: 'Scalar'
652
+ },
653
+ {
654
+ name: 'tasks',
655
+ kind: 'Object',
656
+ plural: true,
657
+ selections: TemplateSetupTaskRepresentation__selections
658
+ }
659
+ ]
660
+ };
661
+ };
662
+ function equals$2(existing, incoming) {
663
+ const existing_description = existing.description;
664
+ const incoming_description = incoming.description;
665
+ // if at least one of these optionals is defined
666
+ if (existing_description !== undefined || incoming_description !== undefined) {
667
+ // if one of these is not defined we know the other is defined and therefore
668
+ // not equal
669
+ if (existing_description === undefined || incoming_description === undefined) {
670
+ return false;
671
+ }
672
+ if (!(existing_description === incoming_description)) {
673
+ return false;
674
+ }
675
+ }
676
+ const existing_name = existing.name;
677
+ const incoming_name = incoming.name;
678
+ if (!(existing_name === incoming_name)) {
679
+ return false;
680
+ }
681
+ const existing_status = existing.status;
682
+ const incoming_status = incoming.status;
683
+ if (!(existing_status === incoming_status)) {
684
+ return false;
685
+ }
686
+ const existing_duration = existing.duration;
687
+ const incoming_duration = incoming.duration;
688
+ // if at least one of these optionals is defined
689
+ if (existing_duration !== undefined || incoming_duration !== undefined) {
690
+ // if one of these is not defined we know the other is defined and therefore
691
+ // not equal
692
+ if (existing_duration === undefined || incoming_duration === undefined) {
693
+ return false;
694
+ }
695
+ if (!(existing_duration === incoming_duration)) {
696
+ return false;
697
+ }
698
+ }
699
+ const existing_tasks = existing.tasks;
700
+ const incoming_tasks = incoming.tasks;
701
+ const equals_tasks_items = equalsArray(existing_tasks, incoming_tasks, (existing_tasks_item, incoming_tasks_item) => {
702
+ if (!(equals$3(existing_tasks_item, incoming_tasks_item))) {
703
+ return false;
704
+ }
705
+ });
706
+ if (equals_tasks_items === false) {
707
+ return false;
708
+ }
709
+ return true;
710
+ }
711
+
712
+ const TTL$1 = 1000;
713
+ const VERSION$1 = "21fb8a334009879b4efd92014fb2c9b6";
714
+ function validate$1(obj, path = 'TemplateSetupPlanRepresentation') {
715
+ const v_error = (() => {
716
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
717
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
718
+ }
719
+ if (obj.description !== undefined) {
720
+ const obj_description = obj.description;
721
+ const path_description = path + '.description';
722
+ if (typeof obj_description !== 'string') {
723
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
724
+ }
725
+ }
726
+ if (obj.details !== undefined) {
727
+ const obj_details = obj.details;
728
+ const path_details = path + '.details';
729
+ if (typeof obj_details !== 'string') {
730
+ return new TypeError('Expected "string" but received "' + typeof obj_details + '" (at "' + path_details + '")');
731
+ }
732
+ }
733
+ if (obj.duration !== undefined) {
734
+ obj.duration;
735
+ }
736
+ const obj_jobs = obj.jobs;
737
+ const path_jobs = path + '.jobs';
738
+ if (!ArrayIsArray(obj_jobs)) {
739
+ return new TypeError('Expected "array" but received "' + typeof obj_jobs + '" (at "' + path_jobs + '")');
740
+ }
741
+ for (let i = 0; i < obj_jobs.length; i++) {
742
+ const obj_jobs_item = obj_jobs[i];
743
+ const path_jobs_item = path_jobs + '[' + i + ']';
744
+ const referencepath_jobs_itemValidationError = validate$2(obj_jobs_item, path_jobs_item);
745
+ if (referencepath_jobs_itemValidationError !== null) {
746
+ let message = 'Object doesn\'t match TemplateSetupJobRepresentation (at "' + path_jobs_item + '")\n';
747
+ message += referencepath_jobs_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
748
+ return new TypeError(message);
749
+ }
750
+ }
751
+ const obj_name = obj.name;
752
+ const path_name = path + '.name';
753
+ if (typeof obj_name !== 'string') {
754
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
755
+ }
756
+ const obj_status = obj.status;
757
+ const path_status = path + '.status';
758
+ if (typeof obj_status !== 'string') {
759
+ return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
760
+ }
761
+ const obj_templateId = obj.templateId;
762
+ const path_templateId = path + '.templateId';
763
+ if (typeof obj_templateId !== 'string') {
764
+ return new TypeError('Expected "string" but received "' + typeof obj_templateId + '" (at "' + path_templateId + '")');
765
+ }
766
+ })();
767
+ return v_error === undefined ? null : v_error;
768
+ }
769
+ const RepresentationType$1 = 'TemplateSetupPlanRepresentation';
770
+ function keyBuilder$3(luvio, config) {
771
+ return keyPrefix + '::' + RepresentationType$1 + ':' + config.templateId + ':' + config.planName;
772
+ }
773
+ function keyBuilderFromType$1(luvio, object) {
774
+ const keyParams = {
775
+ templateId: object.templateId,
776
+ planName: object.name
777
+ };
778
+ return keyBuilder$3(luvio, keyParams);
779
+ }
780
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
781
+ return input;
782
+ }
783
+ const select$4 = function TemplateSetupPlanRepresentationSelect() {
784
+ const { selections: TemplateSetupJobRepresentation__selections, opaque: TemplateSetupJobRepresentation__opaque, } = select$5();
785
+ return {
786
+ kind: 'Fragment',
787
+ version: VERSION$1,
788
+ private: [],
789
+ selections: [
790
+ {
791
+ name: 'description',
792
+ kind: 'Scalar',
793
+ required: false
794
+ },
795
+ {
796
+ name: 'details',
797
+ kind: 'Scalar',
798
+ required: false
799
+ },
800
+ {
801
+ name: 'duration',
802
+ kind: 'Scalar',
803
+ required: false
804
+ },
805
+ {
806
+ name: 'jobs',
807
+ kind: 'Object',
808
+ plural: true,
809
+ selections: TemplateSetupJobRepresentation__selections
810
+ },
811
+ {
812
+ name: 'name',
813
+ kind: 'Scalar'
814
+ },
815
+ {
816
+ name: 'status',
817
+ kind: 'Scalar'
818
+ },
819
+ {
820
+ name: 'templateId',
821
+ kind: 'Scalar'
822
+ }
823
+ ]
824
+ };
825
+ };
826
+ function equals$1(existing, incoming) {
827
+ const existing_description = existing.description;
828
+ const incoming_description = incoming.description;
829
+ // if at least one of these optionals is defined
830
+ if (existing_description !== undefined || incoming_description !== undefined) {
831
+ // if one of these is not defined we know the other is defined and therefore
832
+ // not equal
833
+ if (existing_description === undefined || incoming_description === undefined) {
834
+ return false;
835
+ }
836
+ if (!(existing_description === incoming_description)) {
837
+ return false;
838
+ }
839
+ }
840
+ const existing_details = existing.details;
841
+ const incoming_details = incoming.details;
842
+ // if at least one of these optionals is defined
843
+ if (existing_details !== undefined || incoming_details !== undefined) {
844
+ // if one of these is not defined we know the other is defined and therefore
845
+ // not equal
846
+ if (existing_details === undefined || incoming_details === undefined) {
847
+ return false;
848
+ }
849
+ if (!(existing_details === incoming_details)) {
850
+ return false;
851
+ }
852
+ }
853
+ const existing_name = existing.name;
854
+ const incoming_name = incoming.name;
855
+ if (!(existing_name === incoming_name)) {
856
+ return false;
857
+ }
858
+ const existing_status = existing.status;
859
+ const incoming_status = incoming.status;
860
+ if (!(existing_status === incoming_status)) {
861
+ return false;
862
+ }
863
+ const existing_templateId = existing.templateId;
864
+ const incoming_templateId = incoming.templateId;
865
+ if (!(existing_templateId === incoming_templateId)) {
866
+ return false;
867
+ }
868
+ const existing_duration = existing.duration;
869
+ const incoming_duration = incoming.duration;
870
+ // if at least one of these optionals is defined
871
+ if (existing_duration !== undefined || incoming_duration !== undefined) {
872
+ // if one of these is not defined we know the other is defined and therefore
873
+ // not equal
874
+ if (existing_duration === undefined || incoming_duration === undefined) {
875
+ return false;
876
+ }
877
+ if (!(existing_duration === incoming_duration)) {
878
+ return false;
879
+ }
880
+ }
881
+ const existing_jobs = existing.jobs;
882
+ const incoming_jobs = incoming.jobs;
883
+ const equals_jobs_items = equalsArray(existing_jobs, incoming_jobs, (existing_jobs_item, incoming_jobs_item) => {
884
+ if (!(equals$2(existing_jobs_item, incoming_jobs_item))) {
885
+ return false;
886
+ }
887
+ });
888
+ if (equals_jobs_items === false) {
889
+ return false;
890
+ }
891
+ return true;
892
+ }
893
+ const ingest$1 = function TemplateSetupPlanRepresentationIngest(input, path, luvio, store, timestamp) {
894
+ if (process.env.NODE_ENV !== 'production') {
895
+ const validateError = validate$1(input);
896
+ if (validateError !== null) {
897
+ throw validateError;
898
+ }
899
+ }
900
+ const key = keyBuilderFromType$1(luvio, input);
901
+ const ttlToUse = TTL$1;
902
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "WAVE", VERSION$1, RepresentationType$1, equals$1);
903
+ return createLink(key);
904
+ };
905
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
906
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
907
+ const rootKey = keyBuilderFromType$1(luvio, input);
908
+ rootKeySet.set(rootKey, {
909
+ namespace: keyPrefix,
910
+ representationName: RepresentationType$1,
911
+ mergeable: false
912
+ });
913
+ }
914
+
915
+ function select$3(luvio, params) {
916
+ return select$4();
917
+ }
918
+ function keyBuilder$2(luvio, params) {
919
+ return keyBuilder$3(luvio, {
920
+ templateId: params.urlParams.templateIdOrApiName,
921
+ planName: params.urlParams.planName
922
+ });
923
+ }
924
+ function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
925
+ getTypeCacheKeys$1(storeKeyMap, luvio, response);
926
+ }
927
+ function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
928
+ const { body } = response;
929
+ const key = keyBuilder$2(luvio, resourceParams);
930
+ luvio.storeIngest(key, ingest$1, body);
931
+ const snapshot = luvio.storeLookup({
932
+ recordId: key,
933
+ node: select$3(),
934
+ variables: {},
935
+ }, snapshotRefresh);
936
+ if (process.env.NODE_ENV !== 'production') {
937
+ if (snapshot.state !== 'Fulfilled') {
938
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
939
+ }
940
+ }
941
+ deepFreeze(snapshot.data);
942
+ return snapshot;
943
+ }
944
+ function ingestError(luvio, params, error, snapshotRefresh) {
945
+ const key = keyBuilder$2(luvio, params);
946
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
947
+ const storeMetadataParams = {
948
+ ttl: TTL$1,
949
+ namespace: keyPrefix,
950
+ version: VERSION$1,
951
+ representationName: RepresentationType$1
952
+ };
953
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
954
+ return errorSnapshot;
955
+ }
956
+ function createResourceRequest$2(config) {
957
+ const headers = {};
958
+ return {
959
+ baseUri: '/services/data/v66.0',
960
+ basePath: '/wave/templates/' + config.urlParams.templateIdOrApiName + '/plans/' + config.urlParams.planName + '',
961
+ method: 'get',
962
+ body: null,
963
+ urlParams: config.urlParams,
964
+ queryParams: {},
965
+ headers,
966
+ priority: 'normal',
967
+ };
968
+ }
969
+
970
+ const adapterName$2 = 'getTemplateSetupPlan';
971
+ const getTemplateSetupPlan_ConfigPropertyMetadata = [
972
+ generateParamConfigMetadata('planName', true, 0 /* UrlParameter */, 0 /* String */),
973
+ generateParamConfigMetadata('templateIdOrApiName', true, 0 /* UrlParameter */, 0 /* String */),
974
+ ];
975
+ const getTemplateSetupPlan_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getTemplateSetupPlan_ConfigPropertyMetadata);
976
+ const createResourceParams$2 = /*#__PURE__*/ createResourceParams$4(getTemplateSetupPlan_ConfigPropertyMetadata);
977
+ function keyBuilder$1(luvio, config) {
978
+ const resourceParams = createResourceParams$2(config);
979
+ return keyBuilder$2(luvio, resourceParams);
980
+ }
981
+ function typeCheckConfig$2(untrustedConfig) {
982
+ const config = {};
983
+ typeCheckConfig$4(untrustedConfig, config, getTemplateSetupPlan_ConfigPropertyMetadata);
984
+ return config;
985
+ }
986
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
987
+ if (!untrustedIsObject(untrustedConfig)) {
988
+ return null;
989
+ }
990
+ if (process.env.NODE_ENV !== 'production') {
991
+ validateConfig(untrustedConfig, configPropertyNames);
992
+ }
993
+ const config = typeCheckConfig$2(untrustedConfig);
994
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
995
+ return null;
996
+ }
997
+ return config;
998
+ }
999
+ function adapterFragment(luvio, config) {
1000
+ createResourceParams$2(config);
1001
+ return select$3();
1002
+ }
1003
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
1004
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
1005
+ config,
1006
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
1007
+ });
1008
+ return luvio.storeBroadcast().then(() => snapshot);
1009
+ }
1010
+ function onFetchResponseError(luvio, config, resourceParams, response) {
1011
+ const snapshot = ingestError(luvio, resourceParams, response, {
1012
+ config,
1013
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
1014
+ });
1015
+ return luvio.storeBroadcast().then(() => snapshot);
1016
+ }
1017
+ function buildNetworkSnapshot$2(luvio, config, options) {
1018
+ const resourceParams = createResourceParams$2(config);
1019
+ const request = createResourceRequest$2(resourceParams);
1020
+ return luvio.dispatchResourceRequest(request, options)
1021
+ .then((response) => {
1022
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
1023
+ const cache = new StoreKeyMap();
1024
+ getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
1025
+ return cache;
1026
+ });
1027
+ }, (response) => {
1028
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
1029
+ });
1030
+ }
1031
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
1032
+ return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, undefined, false);
1033
+ }
1034
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
1035
+ const { luvio, config } = context;
1036
+ const selector = {
1037
+ recordId: keyBuilder$1(luvio, config),
1038
+ node: adapterFragment(luvio, config),
1039
+ variables: {},
1040
+ };
1041
+ const cacheSnapshot = storeLookup(selector, {
1042
+ config,
1043
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
1044
+ });
1045
+ return cacheSnapshot;
1046
+ }
1047
+ const getTemplateSetupPlanAdapterFactory = (luvio) => function WAVE__getTemplateSetupPlan(untrustedConfig, requestContext) {
1048
+ const config = validateAdapterConfig$2(untrustedConfig, getTemplateSetupPlan_ConfigPropertyNames);
1049
+ // Invalid or incomplete config
1050
+ if (config === null) {
1051
+ return null;
1052
+ }
1053
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
1054
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
1055
+ };
1056
+
1057
+ function select$2(luvio, params) {
1058
+ return select$4();
1059
+ }
1060
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
1061
+ getTypeCacheKeys$1(storeKeyMap, luvio, response);
1062
+ }
1063
+ function ingestSuccess$1(luvio, resourceParams, response) {
1064
+ const { body } = response;
1065
+ const key = keyBuilderFromType$1(luvio, body);
1066
+ luvio.storeIngest(key, ingest$1, body);
1067
+ const snapshot = luvio.storeLookup({
1068
+ recordId: key,
1069
+ node: select$2(),
1070
+ variables: {},
1071
+ });
1072
+ if (process.env.NODE_ENV !== 'production') {
1073
+ if (snapshot.state !== 'Fulfilled') {
1074
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1075
+ }
1076
+ }
1077
+ deepFreeze(snapshot.data);
1078
+ return snapshot;
1079
+ }
1080
+ function createResourceRequest$1(config) {
1081
+ const headers = {};
1082
+ return {
1083
+ baseUri: '/services/data/v66.0',
1084
+ basePath: '/wave/templates/' + config.urlParams.templateIdOrApiName + '/plans/' + config.urlParams.planName + '',
1085
+ method: 'post',
1086
+ body: null,
1087
+ urlParams: config.urlParams,
1088
+ queryParams: {},
1089
+ headers,
1090
+ priority: 'normal',
1091
+ };
1092
+ }
1093
+
1094
+ const adapterName$1 = 'executeTemplateSetupPlan';
1095
+ const executeTemplateSetupPlan_ConfigPropertyMetadata = [
1096
+ generateParamConfigMetadata('planName', true, 0 /* UrlParameter */, 0 /* String */),
1097
+ generateParamConfigMetadata('templateIdOrApiName', true, 0 /* UrlParameter */, 0 /* String */),
1098
+ ];
1099
+ const executeTemplateSetupPlan_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, executeTemplateSetupPlan_ConfigPropertyMetadata);
1100
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$4(executeTemplateSetupPlan_ConfigPropertyMetadata);
1101
+ function typeCheckConfig$1(untrustedConfig) {
1102
+ const config = {};
1103
+ typeCheckConfig$4(untrustedConfig, config, executeTemplateSetupPlan_ConfigPropertyMetadata);
1104
+ return config;
1105
+ }
1106
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
1107
+ if (!untrustedIsObject(untrustedConfig)) {
1108
+ return null;
1109
+ }
1110
+ if (process.env.NODE_ENV !== 'production') {
1111
+ validateConfig(untrustedConfig, configPropertyNames);
1112
+ }
1113
+ const config = typeCheckConfig$1(untrustedConfig);
1114
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1115
+ return null;
1116
+ }
1117
+ return config;
1118
+ }
1119
+ function buildNetworkSnapshot$1(luvio, config, options) {
1120
+ const resourceParams = createResourceParams$1(config);
1121
+ const request = createResourceRequest$1(resourceParams);
1122
+ return luvio.dispatchResourceRequest(request, options)
1123
+ .then((response) => {
1124
+ return luvio.handleSuccessResponse(() => {
1125
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response);
1126
+ return luvio.storeBroadcast().then(() => snapshot);
1127
+ }, () => {
1128
+ const cache = new StoreKeyMap();
1129
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
1130
+ return cache;
1131
+ });
1132
+ }, (response) => {
1133
+ deepFreeze(response);
1134
+ throw response;
1135
+ });
1136
+ }
1137
+ const executeTemplateSetupPlanAdapterFactory = (luvio) => {
1138
+ return function executeTemplateSetupPlan(untrustedConfig) {
1139
+ const config = validateAdapterConfig$1(untrustedConfig, executeTemplateSetupPlan_ConfigPropertyNames);
1140
+ // Invalid or incomplete config
1141
+ if (config === null) {
1142
+ throw new Error('Invalid config for "executeTemplateSetupPlan"');
1143
+ }
1144
+ return buildNetworkSnapshot$1(luvio, config);
1145
+ };
1146
+ };
1147
+
1148
+ const TTL = 5000;
1149
+ const VERSION = "699a5919410241df24d74fe9ab64fdd8";
1150
+ function validate(obj, path = 'DashboardRepresentation') {
1151
+ const v_error = (() => {
1152
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1153
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1154
+ }
1155
+ const obj_keys = ObjectKeys(obj);
1156
+ for (let i = 0; i < obj_keys.length; i++) {
1157
+ const key = obj_keys[i];
1158
+ const obj_prop = obj[key];
1159
+ const path_prop = path + '["' + key + '"]';
1160
+ if (obj_prop === undefined) {
1161
+ return new TypeError('Expected "defined" but received "' + typeof obj_prop + '" (at "' + path_prop + '")');
1162
+ }
1163
+ }
1164
+ const obj_id = obj.id;
1165
+ const path_id = path + '.id';
1166
+ let obj_id_union0 = null;
1167
+ const obj_id_union0_error = (() => {
1168
+ if (typeof obj_id !== 'string') {
1169
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
1170
+ }
1171
+ })();
1172
+ if (obj_id_union0_error != null) {
1173
+ obj_id_union0 = obj_id_union0_error.message;
1174
+ }
1175
+ let obj_id_union1 = null;
1176
+ const obj_id_union1_error = (() => {
1177
+ if (obj_id !== null) {
1178
+ return new TypeError('Expected "null" but received "' + typeof obj_id + '" (at "' + path_id + '")');
1179
+ }
1180
+ })();
1181
+ if (obj_id_union1_error != null) {
1182
+ obj_id_union1 = obj_id_union1_error.message;
1183
+ }
1184
+ if (obj_id_union0 && obj_id_union1) {
1185
+ let message = 'Object doesn\'t match union (at "' + path_id + '")';
1186
+ message += '\n' + obj_id_union0.split('\n').map((line) => '\t' + line).join('\n');
1187
+ message += '\n' + obj_id_union1.split('\n').map((line) => '\t' + line).join('\n');
1188
+ return new TypeError(message);
1189
+ }
1190
+ })();
1191
+ return v_error === undefined ? null : v_error;
1192
+ }
1193
+ const RepresentationType = 'DashboardRepresentation';
1194
+ function keyBuilder(luvio, config) {
1195
+ return keyPrefix + '::' + RepresentationType + ':' + (config.id === null ? '' : config.id);
1196
+ }
1197
+ function keyBuilderFromType(luvio, object) {
1198
+ const keyParams = {
1199
+ id: object.id
1200
+ };
1201
+ return keyBuilder(luvio, keyParams);
1202
+ }
1203
+ function normalize(input, existing, path, luvio, store, timestamp) {
1204
+ return input;
1205
+ }
1206
+ const select$1 = function DashboardRepresentationSelect() {
1207
+ return {
1208
+ kind: 'Fragment',
1209
+ version: VERSION,
1210
+ private: [],
1211
+ selections: [
1212
+ {
1213
+ name: 'id',
1214
+ kind: 'Scalar'
1215
+ }
1216
+ ]
1217
+ };
1218
+ };
1219
+ function equals(existing, incoming) {
1220
+ const equals_props = equalsObject(existing, incoming, (existing_prop, incoming_prop) => {
1221
+ if (JSONStringify(incoming_prop) !== JSONStringify(existing_prop)) {
1222
+ return false;
1223
+ }
1224
+ });
1225
+ if (equals_props === false) {
1226
+ return false;
1227
+ }
1228
+ return true;
1229
+ }
1230
+ const ingest = function DashboardRepresentationIngest(input, path, luvio, store, timestamp) {
1231
+ if (process.env.NODE_ENV !== 'production') {
1232
+ const validateError = validate(input);
1233
+ if (validateError !== null) {
1234
+ throw validateError;
1235
+ }
1236
+ }
1237
+ const key = keyBuilderFromType(luvio, input);
1238
+ const ttlToUse = TTL;
1239
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "WAVE", VERSION, RepresentationType, equals);
1240
+ return createLink(key);
1241
+ };
1242
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
1243
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
1244
+ const rootKey = keyBuilderFromType(luvio, input);
1245
+ rootKeySet.set(rootKey, {
1246
+ namespace: keyPrefix,
1247
+ representationName: RepresentationType,
1248
+ mergeable: false
1249
+ });
1250
+ }
1251
+
1252
+ function select(luvio, params) {
1253
+ return select$1();
1254
+ }
1255
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
1256
+ getTypeCacheKeys(storeKeyMap, luvio, response);
1257
+ }
1258
+ function ingestSuccess(luvio, resourceParams, response) {
1259
+ const { body } = response;
1260
+ const key = keyBuilderFromType(luvio, body);
1261
+ luvio.storeIngest(key, ingest, body);
1262
+ const snapshot = luvio.storeLookup({
1263
+ recordId: key,
1264
+ node: select(),
1265
+ variables: {},
1266
+ });
1267
+ if (process.env.NODE_ENV !== 'production') {
1268
+ if (snapshot.state !== 'Fulfilled') {
1269
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1270
+ }
1271
+ }
1272
+ deepFreeze(snapshot.data);
1273
+ return snapshot;
1274
+ }
1275
+ function createResourceRequest(config) {
1276
+ const headers = {};
1277
+ return {
1278
+ baseUri: '/services/data/v66.0',
1279
+ basePath: '/wave/dashboards',
1280
+ method: 'post',
1281
+ body: config.body,
1282
+ urlParams: {},
1283
+ queryParams: {},
1284
+ headers,
1285
+ priority: 'normal',
1286
+ };
1287
+ }
1288
+
1289
+ const adapterName = 'createDashboard';
1290
+ const createDashboard_ConfigPropertyMetadata = [
1291
+ generateParamConfigMetadata('folder', true, 2 /* Body */, 4 /* Unsupported */),
1292
+ generateParamConfigMetadata('label', true, 2 /* Body */, 0 /* String */),
1293
+ generateParamConfigMetadata('name', true, 2 /* Body */, 0 /* String */),
1294
+ generateParamConfigMetadata('description', true, 2 /* Body */, 0 /* String */),
1295
+ generateParamConfigMetadata('templateSourceId', true, 2 /* Body */, 0 /* String */),
1296
+ generateParamConfigMetadata('templateValues', true, 2 /* Body */, 4 /* Unsupported */),
1297
+ ];
1298
+ const createDashboard_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, createDashboard_ConfigPropertyMetadata);
1299
+ const createResourceParams = /*#__PURE__*/ createResourceParams$4(createDashboard_ConfigPropertyMetadata);
1300
+ function typeCheckConfig(untrustedConfig) {
1301
+ const config = {};
1302
+ typeCheckConfig$4(untrustedConfig, config, createDashboard_ConfigPropertyMetadata);
1303
+ const untrustedConfig_folder = untrustedConfig.folder;
1304
+ config.folder = untrustedConfig_folder;
1305
+ const untrustedConfig_templateValues = untrustedConfig.templateValues;
1306
+ if (untrustedIsObject(untrustedConfig_templateValues)) {
1307
+ const untrustedConfig_templateValues_object = {};
1308
+ const untrustedConfig_templateValues_keys = Object.keys(untrustedConfig_templateValues);
1309
+ for (let i = 0, arrayLength = untrustedConfig_templateValues_keys.length; i < arrayLength; i++) {
1310
+ const key = untrustedConfig_templateValues_keys[i];
1311
+ const untrustedConfig_templateValues_prop = untrustedConfig_templateValues[key];
1312
+ if (untrustedConfig_templateValues_object !== undefined) {
1313
+ untrustedConfig_templateValues_object[key] = untrustedConfig_templateValues_prop;
1314
+ }
1315
+ }
1316
+ if (untrustedConfig_templateValues_object !== undefined && Object.keys(untrustedConfig_templateValues_object).length >= 0) {
1317
+ config.templateValues = untrustedConfig_templateValues_object;
1318
+ }
1319
+ }
1320
+ return config;
1321
+ }
1322
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
1323
+ if (!untrustedIsObject(untrustedConfig)) {
1324
+ return null;
1325
+ }
1326
+ if (process.env.NODE_ENV !== 'production') {
1327
+ validateConfig(untrustedConfig, configPropertyNames);
1328
+ }
1329
+ const config = typeCheckConfig(untrustedConfig);
1330
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1331
+ return null;
1332
+ }
1333
+ return config;
1334
+ }
1335
+ function buildNetworkSnapshot(luvio, config, options) {
1336
+ const resourceParams = createResourceParams(config);
1337
+ const request = createResourceRequest(resourceParams);
1338
+ return luvio.dispatchResourceRequest(request, options)
1339
+ .then((response) => {
1340
+ return luvio.handleSuccessResponse(() => {
1341
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
1342
+ return luvio.storeBroadcast().then(() => snapshot);
1343
+ }, () => {
1344
+ const cache = new StoreKeyMap();
1345
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
1346
+ return cache;
1347
+ });
1348
+ }, (response) => {
1349
+ deepFreeze(response);
1350
+ throw response;
1351
+ });
1352
+ }
1353
+ const createDashboardAdapterFactory = (luvio) => {
1354
+ return function createDashboard(untrustedConfig) {
1355
+ const config = validateAdapterConfig(untrustedConfig, createDashboard_ConfigPropertyNames);
1356
+ // Invalid or incomplete config
1357
+ if (config === null) {
1358
+ throw new Error('Invalid config for "createDashboard"');
1359
+ }
1360
+ return buildNetworkSnapshot(luvio, config);
1361
+ };
1362
+ };
1363
+
1364
+ export { createDashboardAdapterFactory, executeSoqlQueryPostAdapterFactory, executeTemplateSetupPlanAdapterFactory, getTemplateSetupPlanAdapterFactory };