@salesforce/lds-adapters-analytics-wave-private 1.280.0 → 1.282.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.
@@ -4,7 +4,7 @@
4
4
  * For full license text, see the LICENSE.txt file
5
5
  */
6
6
 
7
- import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, typeCheckConfig as typeCheckConfig$1, StoreKeyMap, createResourceParams as createResourceParams$1 } from '@luvio/engine';
7
+ import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$2, typeCheckConfig as typeCheckConfig$3, StoreKeyMap, createResourceParams as createResourceParams$3 } from '@luvio/engine';
8
8
 
9
9
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
10
  const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
@@ -74,15 +74,28 @@ const keyPrefix = 'WAVE';
74
74
  const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
75
75
  const { isArray: ArrayIsArray } = Array;
76
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
+ }
77
90
  function createLink(ref) {
78
91
  return {
79
92
  __ref: serializeStructuredKey(ref),
80
93
  };
81
94
  }
82
95
 
83
- const TTL = 5000;
84
- const VERSION = "f4d046d44230e53375ee20bbd2483a1f";
85
- function validate(obj, path = 'SoqlQueryResultRepresentation') {
96
+ const TTL$1 = 5000;
97
+ const VERSION$3 = "f4d046d44230e53375ee20bbd2483a1f";
98
+ function validate$3(obj, path = 'SoqlQueryResultRepresentation') {
86
99
  const v_error = (() => {
87
100
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
88
101
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -125,39 +138,704 @@ function validate(obj, path = 'SoqlQueryResultRepresentation') {
125
138
  })();
126
139
  return v_error === undefined ? null : v_error;
127
140
  }
128
- const RepresentationType = 'SoqlQueryResultRepresentation';
141
+ const RepresentationType$1 = 'SoqlQueryResultRepresentation';
142
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
143
+ return input;
144
+ }
145
+ const select$6 = function SoqlQueryResultRepresentationSelect() {
146
+ return {
147
+ kind: 'Fragment',
148
+ version: VERSION$3,
149
+ private: [],
150
+ opaque: true
151
+ };
152
+ };
153
+ function equals$3(existing, incoming) {
154
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
155
+ return false;
156
+ }
157
+ return true;
158
+ }
159
+ const ingest$1 = function SoqlQueryResultRepresentationIngest(input, path, luvio, store, timestamp) {
160
+ if (process.env.NODE_ENV !== 'production') {
161
+ const validateError = validate$3(input);
162
+ if (validateError !== null) {
163
+ throw validateError;
164
+ }
165
+ }
166
+ const key = path.fullPath;
167
+ const ttlToUse = TTL$1;
168
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "WAVE", VERSION$3, RepresentationType$1, equals$3);
169
+ return createLink(key);
170
+ };
171
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
172
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
173
+ const rootKey = fullPathFactory();
174
+ rootKeySet.set(rootKey, {
175
+ namespace: keyPrefix,
176
+ representationName: RepresentationType$1,
177
+ mergeable: false
178
+ });
179
+ }
180
+
181
+ function select$5(luvio, params) {
182
+ return select$6();
183
+ }
184
+ function keyBuilder$4(luvio, params) {
185
+ return keyPrefix + '::SoqlQueryResultRepresentation:(' + 'query:' + params.body.query + ')';
186
+ }
187
+ function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
188
+ getTypeCacheKeys$1(storeKeyMap, luvio, response, () => keyBuilder$4(luvio, resourceParams));
189
+ }
190
+ function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
191
+ const { body } = response;
192
+ const key = keyBuilder$4(luvio, resourceParams);
193
+ luvio.storeIngest(key, ingest$1, body);
194
+ const snapshot = luvio.storeLookup({
195
+ recordId: key,
196
+ node: select$5(),
197
+ variables: {},
198
+ }, snapshotRefresh);
199
+ if (process.env.NODE_ENV !== 'production') {
200
+ if (snapshot.state !== 'Fulfilled') {
201
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
202
+ }
203
+ }
204
+ deepFreeze(snapshot.data);
205
+ return snapshot;
206
+ }
207
+ function ingestError$1(luvio, params, error, snapshotRefresh) {
208
+ const key = keyBuilder$4(luvio, params);
209
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
210
+ const storeMetadataParams = {
211
+ ttl: TTL$1,
212
+ namespace: keyPrefix,
213
+ version: VERSION$3,
214
+ representationName: RepresentationType$1
215
+ };
216
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
217
+ return errorSnapshot;
218
+ }
219
+ function createResourceRequest$2(config) {
220
+ const headers = {};
221
+ return {
222
+ baseUri: '/services/data/v61.0',
223
+ basePath: '/wave/soql',
224
+ method: 'post',
225
+ body: config.body,
226
+ urlParams: {},
227
+ queryParams: {},
228
+ headers,
229
+ priority: 'normal',
230
+ };
231
+ }
232
+
233
+ const adapterName$2 = 'executeSoqlQueryPost';
234
+ const executeSoqlQueryPost_ConfigPropertyMetadata = [
235
+ generateParamConfigMetadata('query', true, 2 /* Body */, 0 /* String */),
236
+ ];
237
+ const executeSoqlQueryPost_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, executeSoqlQueryPost_ConfigPropertyMetadata);
238
+ const createResourceParams$2 = /*#__PURE__*/ createResourceParams$3(executeSoqlQueryPost_ConfigPropertyMetadata);
239
+ function keyBuilder$3(luvio, config) {
240
+ const resourceParams = createResourceParams$2(config);
241
+ return keyBuilder$4(luvio, resourceParams);
242
+ }
243
+ function typeCheckConfig$2(untrustedConfig) {
244
+ const config = {};
245
+ typeCheckConfig$3(untrustedConfig, config, executeSoqlQueryPost_ConfigPropertyMetadata);
246
+ return config;
247
+ }
248
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
249
+ if (!untrustedIsObject(untrustedConfig)) {
250
+ return null;
251
+ }
252
+ if (process.env.NODE_ENV !== 'production') {
253
+ validateConfig(untrustedConfig, configPropertyNames);
254
+ }
255
+ const config = typeCheckConfig$2(untrustedConfig);
256
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
257
+ return null;
258
+ }
259
+ return config;
260
+ }
261
+ function adapterFragment$1(luvio, config) {
262
+ createResourceParams$2(config);
263
+ return select$5();
264
+ }
265
+ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
266
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
267
+ config,
268
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
269
+ });
270
+ return luvio.storeBroadcast().then(() => snapshot);
271
+ }
272
+ function onFetchResponseError$1(luvio, config, resourceParams, response) {
273
+ const snapshot = ingestError$1(luvio, resourceParams, response, {
274
+ config,
275
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
276
+ });
277
+ return luvio.storeBroadcast().then(() => snapshot);
278
+ }
279
+ function buildNetworkSnapshot$2(luvio, config, options) {
280
+ const resourceParams = createResourceParams$2(config);
281
+ const request = createResourceRequest$2(resourceParams);
282
+ return luvio.dispatchResourceRequest(request, options)
283
+ .then((response) => {
284
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
285
+ const cache = new StoreKeyMap();
286
+ getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
287
+ return cache;
288
+ });
289
+ }, (response) => {
290
+ return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
291
+ });
292
+ }
293
+ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
294
+ return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, 'get', false);
295
+ }
296
+ function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
297
+ const { luvio, config } = context;
298
+ const selector = {
299
+ recordId: keyBuilder$3(luvio, config),
300
+ node: adapterFragment$1(luvio, config),
301
+ variables: {},
302
+ };
303
+ const cacheSnapshot = storeLookup(selector, {
304
+ config,
305
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
306
+ });
307
+ return cacheSnapshot;
308
+ }
309
+ const executeSoqlQueryPostAdapterFactory = (luvio) => function WAVE__executeSoqlQueryPost(untrustedConfig, requestContext) {
310
+ const config = validateAdapterConfig$2(untrustedConfig, executeSoqlQueryPost_ConfigPropertyNames);
311
+ // Invalid or incomplete config
312
+ if (config === null) {
313
+ return null;
314
+ }
315
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
316
+ buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
317
+ };
318
+
319
+ const VERSION$2 = "9e681ab82c528c8089c98c05156af0bc";
320
+ function validate$2(obj, path = 'TemplateSetupTaskRepresentation') {
321
+ const v_error = (() => {
322
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
323
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
324
+ }
325
+ if (obj.description !== undefined) {
326
+ const obj_description = obj.description;
327
+ const path_description = path + '.description';
328
+ if (typeof obj_description !== 'string') {
329
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
330
+ }
331
+ }
332
+ if (obj.details !== undefined) {
333
+ const obj_details = obj.details;
334
+ const path_details = path + '.details';
335
+ if (typeof obj_details !== 'string') {
336
+ return new TypeError('Expected "string" but received "' + typeof obj_details + '" (at "' + path_details + '")');
337
+ }
338
+ }
339
+ if (obj.duration !== undefined) {
340
+ obj.duration;
341
+ }
342
+ if (obj.enabled !== undefined) {
343
+ const obj_enabled = obj.enabled;
344
+ const path_enabled = path + '.enabled';
345
+ if (typeof obj_enabled !== 'boolean') {
346
+ return new TypeError('Expected "boolean" but received "' + typeof obj_enabled + '" (at "' + path_enabled + '")');
347
+ }
348
+ }
349
+ if (obj.error !== undefined) {
350
+ const obj_error = obj.error;
351
+ const path_error = path + '.error';
352
+ if (typeof obj_error !== 'string') {
353
+ return new TypeError('Expected "string" but received "' + typeof obj_error + '" (at "' + path_error + '")');
354
+ }
355
+ }
356
+ const obj_name = obj.name;
357
+ const path_name = path + '.name';
358
+ if (typeof obj_name !== 'string') {
359
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
360
+ }
361
+ if (obj.setupUrl !== undefined) {
362
+ const obj_setupUrl = obj.setupUrl;
363
+ const path_setupUrl = path + '.setupUrl';
364
+ if (typeof obj_setupUrl !== 'string') {
365
+ return new TypeError('Expected "string" but received "' + typeof obj_setupUrl + '" (at "' + path_setupUrl + '")');
366
+ }
367
+ }
368
+ const obj_status = obj.status;
369
+ const path_status = path + '.status';
370
+ if (typeof obj_status !== 'string') {
371
+ return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
372
+ }
373
+ })();
374
+ return v_error === undefined ? null : v_error;
375
+ }
376
+ const select$4 = function TemplateSetupTaskRepresentationSelect() {
377
+ return {
378
+ kind: 'Fragment',
379
+ version: VERSION$2,
380
+ private: [],
381
+ selections: [
382
+ {
383
+ name: 'description',
384
+ kind: 'Scalar',
385
+ required: false
386
+ },
387
+ {
388
+ name: 'details',
389
+ kind: 'Scalar',
390
+ required: false
391
+ },
392
+ {
393
+ name: 'duration',
394
+ kind: 'Scalar',
395
+ required: false
396
+ },
397
+ {
398
+ name: 'enabled',
399
+ kind: 'Scalar',
400
+ required: false
401
+ },
402
+ {
403
+ name: 'error',
404
+ kind: 'Scalar',
405
+ required: false
406
+ },
407
+ {
408
+ name: 'name',
409
+ kind: 'Scalar'
410
+ },
411
+ {
412
+ name: 'setupUrl',
413
+ kind: 'Scalar',
414
+ required: false
415
+ },
416
+ {
417
+ name: 'status',
418
+ kind: 'Scalar'
419
+ }
420
+ ]
421
+ };
422
+ };
423
+ function equals$2(existing, incoming) {
424
+ const existing_enabled = existing.enabled;
425
+ const incoming_enabled = incoming.enabled;
426
+ // if at least one of these optionals is defined
427
+ if (existing_enabled !== undefined || incoming_enabled !== undefined) {
428
+ // if one of these is not defined we know the other is defined and therefore
429
+ // not equal
430
+ if (existing_enabled === undefined || incoming_enabled === undefined) {
431
+ return false;
432
+ }
433
+ if (!(existing_enabled === incoming_enabled)) {
434
+ return false;
435
+ }
436
+ }
437
+ const existing_description = existing.description;
438
+ const incoming_description = incoming.description;
439
+ // if at least one of these optionals is defined
440
+ if (existing_description !== undefined || incoming_description !== undefined) {
441
+ // if one of these is not defined we know the other is defined and therefore
442
+ // not equal
443
+ if (existing_description === undefined || incoming_description === undefined) {
444
+ return false;
445
+ }
446
+ if (!(existing_description === incoming_description)) {
447
+ return false;
448
+ }
449
+ }
450
+ const existing_details = existing.details;
451
+ const incoming_details = incoming.details;
452
+ // if at least one of these optionals is defined
453
+ if (existing_details !== undefined || incoming_details !== undefined) {
454
+ // if one of these is not defined we know the other is defined and therefore
455
+ // not equal
456
+ if (existing_details === undefined || incoming_details === undefined) {
457
+ return false;
458
+ }
459
+ if (!(existing_details === incoming_details)) {
460
+ return false;
461
+ }
462
+ }
463
+ const existing_error = existing.error;
464
+ const incoming_error = incoming.error;
465
+ // if at least one of these optionals is defined
466
+ if (existing_error !== undefined || incoming_error !== undefined) {
467
+ // if one of these is not defined we know the other is defined and therefore
468
+ // not equal
469
+ if (existing_error === undefined || incoming_error === undefined) {
470
+ return false;
471
+ }
472
+ if (!(existing_error === incoming_error)) {
473
+ return false;
474
+ }
475
+ }
476
+ const existing_name = existing.name;
477
+ const incoming_name = incoming.name;
478
+ if (!(existing_name === incoming_name)) {
479
+ return false;
480
+ }
481
+ const existing_setupUrl = existing.setupUrl;
482
+ const incoming_setupUrl = incoming.setupUrl;
483
+ // if at least one of these optionals is defined
484
+ if (existing_setupUrl !== undefined || incoming_setupUrl !== undefined) {
485
+ // if one of these is not defined we know the other is defined and therefore
486
+ // not equal
487
+ if (existing_setupUrl === undefined || incoming_setupUrl === undefined) {
488
+ return false;
489
+ }
490
+ if (!(existing_setupUrl === incoming_setupUrl)) {
491
+ return false;
492
+ }
493
+ }
494
+ const existing_status = existing.status;
495
+ const incoming_status = incoming.status;
496
+ if (!(existing_status === incoming_status)) {
497
+ return false;
498
+ }
499
+ const existing_duration = existing.duration;
500
+ const incoming_duration = incoming.duration;
501
+ // if at least one of these optionals is defined
502
+ if (existing_duration !== undefined || incoming_duration !== undefined) {
503
+ // if one of these is not defined we know the other is defined and therefore
504
+ // not equal
505
+ if (existing_duration === undefined || incoming_duration === undefined) {
506
+ return false;
507
+ }
508
+ if (!(existing_duration === incoming_duration)) {
509
+ return false;
510
+ }
511
+ }
512
+ return true;
513
+ }
514
+
515
+ const VERSION$1 = "902a8640d811c60e0dd88853dfbfe319";
516
+ function validate$1(obj, path = 'TemplateSetupJobRepresentation') {
517
+ const v_error = (() => {
518
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
519
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
520
+ }
521
+ if (obj.description !== undefined) {
522
+ const obj_description = obj.description;
523
+ const path_description = path + '.description';
524
+ if (typeof obj_description !== 'string') {
525
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
526
+ }
527
+ }
528
+ if (obj.duration !== undefined) {
529
+ obj.duration;
530
+ }
531
+ const obj_name = obj.name;
532
+ const path_name = path + '.name';
533
+ if (typeof obj_name !== 'string') {
534
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
535
+ }
536
+ const obj_status = obj.status;
537
+ const path_status = path + '.status';
538
+ if (typeof obj_status !== 'string') {
539
+ return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
540
+ }
541
+ const obj_tasks = obj.tasks;
542
+ const path_tasks = path + '.tasks';
543
+ if (!ArrayIsArray(obj_tasks)) {
544
+ return new TypeError('Expected "array" but received "' + typeof obj_tasks + '" (at "' + path_tasks + '")');
545
+ }
546
+ for (let i = 0; i < obj_tasks.length; i++) {
547
+ const obj_tasks_item = obj_tasks[i];
548
+ const path_tasks_item = path_tasks + '[' + i + ']';
549
+ const referencepath_tasks_itemValidationError = validate$2(obj_tasks_item, path_tasks_item);
550
+ if (referencepath_tasks_itemValidationError !== null) {
551
+ let message = 'Object doesn\'t match TemplateSetupTaskRepresentation (at "' + path_tasks_item + '")\n';
552
+ message += referencepath_tasks_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
553
+ return new TypeError(message);
554
+ }
555
+ }
556
+ })();
557
+ return v_error === undefined ? null : v_error;
558
+ }
559
+ const select$3 = function TemplateSetupJobRepresentationSelect() {
560
+ const { selections: TemplateSetupTaskRepresentation__selections, opaque: TemplateSetupTaskRepresentation__opaque, } = select$4();
561
+ return {
562
+ kind: 'Fragment',
563
+ version: VERSION$1,
564
+ private: [],
565
+ selections: [
566
+ {
567
+ name: 'description',
568
+ kind: 'Scalar',
569
+ required: false
570
+ },
571
+ {
572
+ name: 'duration',
573
+ kind: 'Scalar',
574
+ required: false
575
+ },
576
+ {
577
+ name: 'name',
578
+ kind: 'Scalar'
579
+ },
580
+ {
581
+ name: 'status',
582
+ kind: 'Scalar'
583
+ },
584
+ {
585
+ name: 'tasks',
586
+ kind: 'Object',
587
+ plural: true,
588
+ selections: TemplateSetupTaskRepresentation__selections
589
+ }
590
+ ]
591
+ };
592
+ };
593
+ function equals$1(existing, incoming) {
594
+ const existing_description = existing.description;
595
+ const incoming_description = incoming.description;
596
+ // if at least one of these optionals is defined
597
+ if (existing_description !== undefined || incoming_description !== undefined) {
598
+ // if one of these is not defined we know the other is defined and therefore
599
+ // not equal
600
+ if (existing_description === undefined || incoming_description === undefined) {
601
+ return false;
602
+ }
603
+ if (!(existing_description === incoming_description)) {
604
+ return false;
605
+ }
606
+ }
607
+ const existing_name = existing.name;
608
+ const incoming_name = incoming.name;
609
+ if (!(existing_name === incoming_name)) {
610
+ return false;
611
+ }
612
+ const existing_status = existing.status;
613
+ const incoming_status = incoming.status;
614
+ if (!(existing_status === incoming_status)) {
615
+ return false;
616
+ }
617
+ const existing_duration = existing.duration;
618
+ const incoming_duration = incoming.duration;
619
+ // if at least one of these optionals is defined
620
+ if (existing_duration !== undefined || incoming_duration !== undefined) {
621
+ // if one of these is not defined we know the other is defined and therefore
622
+ // not equal
623
+ if (existing_duration === undefined || incoming_duration === undefined) {
624
+ return false;
625
+ }
626
+ if (!(existing_duration === incoming_duration)) {
627
+ return false;
628
+ }
629
+ }
630
+ const existing_tasks = existing.tasks;
631
+ const incoming_tasks = incoming.tasks;
632
+ const equals_tasks_items = equalsArray(existing_tasks, incoming_tasks, (existing_tasks_item, incoming_tasks_item) => {
633
+ if (!(equals$2(existing_tasks_item, incoming_tasks_item))) {
634
+ return false;
635
+ }
636
+ });
637
+ if (equals_tasks_items === false) {
638
+ return false;
639
+ }
640
+ return true;
641
+ }
642
+
643
+ const TTL = 1000;
644
+ const VERSION = "21fb8a334009879b4efd92014fb2c9b6";
645
+ function validate(obj, path = 'TemplateSetupPlanRepresentation') {
646
+ const v_error = (() => {
647
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
648
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
649
+ }
650
+ if (obj.description !== undefined) {
651
+ const obj_description = obj.description;
652
+ const path_description = path + '.description';
653
+ if (typeof obj_description !== 'string') {
654
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
655
+ }
656
+ }
657
+ if (obj.details !== undefined) {
658
+ const obj_details = obj.details;
659
+ const path_details = path + '.details';
660
+ if (typeof obj_details !== 'string') {
661
+ return new TypeError('Expected "string" but received "' + typeof obj_details + '" (at "' + path_details + '")');
662
+ }
663
+ }
664
+ if (obj.duration !== undefined) {
665
+ obj.duration;
666
+ }
667
+ const obj_jobs = obj.jobs;
668
+ const path_jobs = path + '.jobs';
669
+ if (!ArrayIsArray(obj_jobs)) {
670
+ return new TypeError('Expected "array" but received "' + typeof obj_jobs + '" (at "' + path_jobs + '")');
671
+ }
672
+ for (let i = 0; i < obj_jobs.length; i++) {
673
+ const obj_jobs_item = obj_jobs[i];
674
+ const path_jobs_item = path_jobs + '[' + i + ']';
675
+ const referencepath_jobs_itemValidationError = validate$1(obj_jobs_item, path_jobs_item);
676
+ if (referencepath_jobs_itemValidationError !== null) {
677
+ let message = 'Object doesn\'t match TemplateSetupJobRepresentation (at "' + path_jobs_item + '")\n';
678
+ message += referencepath_jobs_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
679
+ return new TypeError(message);
680
+ }
681
+ }
682
+ const obj_name = obj.name;
683
+ const path_name = path + '.name';
684
+ if (typeof obj_name !== 'string') {
685
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
686
+ }
687
+ const obj_status = obj.status;
688
+ const path_status = path + '.status';
689
+ if (typeof obj_status !== 'string') {
690
+ return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
691
+ }
692
+ const obj_templateId = obj.templateId;
693
+ const path_templateId = path + '.templateId';
694
+ if (typeof obj_templateId !== 'string') {
695
+ return new TypeError('Expected "string" but received "' + typeof obj_templateId + '" (at "' + path_templateId + '")');
696
+ }
697
+ })();
698
+ return v_error === undefined ? null : v_error;
699
+ }
700
+ const RepresentationType = 'TemplateSetupPlanRepresentation';
701
+ function keyBuilder$2(luvio, config) {
702
+ return keyPrefix + '::' + RepresentationType + ':' + config.templateId + ':' + config.planName;
703
+ }
704
+ function keyBuilderFromType(luvio, object) {
705
+ const keyParams = {
706
+ templateId: object.templateId,
707
+ planName: object.name
708
+ };
709
+ return keyBuilder$2(luvio, keyParams);
710
+ }
129
711
  function normalize(input, existing, path, luvio, store, timestamp) {
130
712
  return input;
131
713
  }
132
- const select$1 = function SoqlQueryResultRepresentationSelect() {
714
+ const select$2 = function TemplateSetupPlanRepresentationSelect() {
715
+ const { selections: TemplateSetupJobRepresentation__selections, opaque: TemplateSetupJobRepresentation__opaque, } = select$3();
133
716
  return {
134
717
  kind: 'Fragment',
135
718
  version: VERSION,
136
719
  private: [],
137
- opaque: true
720
+ selections: [
721
+ {
722
+ name: 'description',
723
+ kind: 'Scalar',
724
+ required: false
725
+ },
726
+ {
727
+ name: 'details',
728
+ kind: 'Scalar',
729
+ required: false
730
+ },
731
+ {
732
+ name: 'duration',
733
+ kind: 'Scalar',
734
+ required: false
735
+ },
736
+ {
737
+ name: 'jobs',
738
+ kind: 'Object',
739
+ plural: true,
740
+ selections: TemplateSetupJobRepresentation__selections
741
+ },
742
+ {
743
+ name: 'name',
744
+ kind: 'Scalar'
745
+ },
746
+ {
747
+ name: 'status',
748
+ kind: 'Scalar'
749
+ },
750
+ {
751
+ name: 'templateId',
752
+ kind: 'Scalar'
753
+ }
754
+ ]
138
755
  };
139
756
  };
140
757
  function equals(existing, incoming) {
141
- if (JSONStringify(incoming) !== JSONStringify(existing)) {
758
+ const existing_description = existing.description;
759
+ const incoming_description = incoming.description;
760
+ // if at least one of these optionals is defined
761
+ if (existing_description !== undefined || incoming_description !== undefined) {
762
+ // if one of these is not defined we know the other is defined and therefore
763
+ // not equal
764
+ if (existing_description === undefined || incoming_description === undefined) {
765
+ return false;
766
+ }
767
+ if (!(existing_description === incoming_description)) {
768
+ return false;
769
+ }
770
+ }
771
+ const existing_details = existing.details;
772
+ const incoming_details = incoming.details;
773
+ // if at least one of these optionals is defined
774
+ if (existing_details !== undefined || incoming_details !== undefined) {
775
+ // if one of these is not defined we know the other is defined and therefore
776
+ // not equal
777
+ if (existing_details === undefined || incoming_details === undefined) {
778
+ return false;
779
+ }
780
+ if (!(existing_details === incoming_details)) {
781
+ return false;
782
+ }
783
+ }
784
+ const existing_name = existing.name;
785
+ const incoming_name = incoming.name;
786
+ if (!(existing_name === incoming_name)) {
787
+ return false;
788
+ }
789
+ const existing_status = existing.status;
790
+ const incoming_status = incoming.status;
791
+ if (!(existing_status === incoming_status)) {
792
+ return false;
793
+ }
794
+ const existing_templateId = existing.templateId;
795
+ const incoming_templateId = incoming.templateId;
796
+ if (!(existing_templateId === incoming_templateId)) {
797
+ return false;
798
+ }
799
+ const existing_duration = existing.duration;
800
+ const incoming_duration = incoming.duration;
801
+ // if at least one of these optionals is defined
802
+ if (existing_duration !== undefined || incoming_duration !== undefined) {
803
+ // if one of these is not defined we know the other is defined and therefore
804
+ // not equal
805
+ if (existing_duration === undefined || incoming_duration === undefined) {
806
+ return false;
807
+ }
808
+ if (!(existing_duration === incoming_duration)) {
809
+ return false;
810
+ }
811
+ }
812
+ const existing_jobs = existing.jobs;
813
+ const incoming_jobs = incoming.jobs;
814
+ const equals_jobs_items = equalsArray(existing_jobs, incoming_jobs, (existing_jobs_item, incoming_jobs_item) => {
815
+ if (!(equals$1(existing_jobs_item, incoming_jobs_item))) {
816
+ return false;
817
+ }
818
+ });
819
+ if (equals_jobs_items === false) {
142
820
  return false;
143
821
  }
144
822
  return true;
145
823
  }
146
- const ingest = function SoqlQueryResultRepresentationIngest(input, path, luvio, store, timestamp) {
824
+ const ingest = function TemplateSetupPlanRepresentationIngest(input, path, luvio, store, timestamp) {
147
825
  if (process.env.NODE_ENV !== 'production') {
148
826
  const validateError = validate(input);
149
827
  if (validateError !== null) {
150
828
  throw validateError;
151
829
  }
152
830
  }
153
- const key = path.fullPath;
831
+ const key = keyBuilderFromType(luvio, input);
154
832
  const ttlToUse = TTL;
155
833
  ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "WAVE", VERSION, RepresentationType, equals);
156
834
  return createLink(key);
157
835
  };
158
836
  function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
159
837
  // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
160
- const rootKey = fullPathFactory();
838
+ const rootKey = keyBuilderFromType(luvio, input);
161
839
  rootKeySet.set(rootKey, {
162
840
  namespace: keyPrefix,
163
841
  representationName: RepresentationType,
@@ -165,22 +843,25 @@ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
165
843
  });
166
844
  }
167
845
 
168
- function select(luvio, params) {
169
- return select$1();
846
+ function select$1(luvio, params) {
847
+ return select$2();
170
848
  }
171
849
  function keyBuilder$1(luvio, params) {
172
- return keyPrefix + '::SoqlQueryResultRepresentation:(' + 'query:' + params.body.query + ')';
850
+ return keyBuilder$2(luvio, {
851
+ templateId: params.urlParams.templateIdOrApiName,
852
+ planName: params.urlParams.planName
853
+ });
173
854
  }
174
- function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
175
- getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$1(luvio, resourceParams));
855
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
856
+ getTypeCacheKeys(storeKeyMap, luvio, response);
176
857
  }
177
- function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
858
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
178
859
  const { body } = response;
179
860
  const key = keyBuilder$1(luvio, resourceParams);
180
861
  luvio.storeIngest(key, ingest, body);
181
862
  const snapshot = luvio.storeLookup({
182
863
  recordId: key,
183
- node: select(),
864
+ node: select$1(),
184
865
  variables: {},
185
866
  }, snapshotRefresh);
186
867
  if (process.env.NODE_ENV !== 'production') {
@@ -203,74 +884,75 @@ function ingestError(luvio, params, error, snapshotRefresh) {
203
884
  luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
204
885
  return errorSnapshot;
205
886
  }
206
- function createResourceRequest(config) {
887
+ function createResourceRequest$1(config) {
207
888
  const headers = {};
208
889
  return {
209
890
  baseUri: '/services/data/v61.0',
210
- basePath: '/wave/soql',
211
- method: 'post',
212
- body: config.body,
213
- urlParams: {},
891
+ basePath: '/wave/templates/' + config.urlParams.templateIdOrApiName + '/plans/' + config.urlParams.planName + '',
892
+ method: 'get',
893
+ body: null,
894
+ urlParams: config.urlParams,
214
895
  queryParams: {},
215
896
  headers,
216
897
  priority: 'normal',
217
898
  };
218
899
  }
219
900
 
220
- const adapterName = 'executeSoqlQueryPost';
221
- const executeSoqlQueryPost_ConfigPropertyMetadata = [
222
- generateParamConfigMetadata('query', true, 2 /* Body */, 0 /* String */),
901
+ const adapterName$1 = 'getTemplateSetupPlan';
902
+ const getTemplateSetupPlan_ConfigPropertyMetadata = [
903
+ generateParamConfigMetadata('planName', true, 0 /* UrlParameter */, 0 /* String */),
904
+ generateParamConfigMetadata('templateIdOrApiName', true, 0 /* UrlParameter */, 0 /* String */),
223
905
  ];
224
- const executeSoqlQueryPost_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, executeSoqlQueryPost_ConfigPropertyMetadata);
225
- const createResourceParams = /*#__PURE__*/ createResourceParams$1(executeSoqlQueryPost_ConfigPropertyMetadata);
906
+ const getTemplateSetupPlan_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getTemplateSetupPlan_ConfigPropertyMetadata);
907
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(getTemplateSetupPlan_ConfigPropertyMetadata);
226
908
  function keyBuilder(luvio, config) {
227
- const resourceParams = createResourceParams(config);
909
+ const resourceParams = createResourceParams$1(config);
228
910
  return keyBuilder$1(luvio, resourceParams);
229
911
  }
230
- function typeCheckConfig(untrustedConfig) {
912
+ function typeCheckConfig$1(untrustedConfig) {
231
913
  const config = {};
232
- typeCheckConfig$1(untrustedConfig, config, executeSoqlQueryPost_ConfigPropertyMetadata);
914
+ typeCheckConfig$3(untrustedConfig, config, getTemplateSetupPlan_ConfigPropertyMetadata);
233
915
  return config;
234
916
  }
235
- function validateAdapterConfig(untrustedConfig, configPropertyNames) {
917
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
236
918
  if (!untrustedIsObject(untrustedConfig)) {
237
919
  return null;
238
920
  }
239
921
  if (process.env.NODE_ENV !== 'production') {
240
922
  validateConfig(untrustedConfig, configPropertyNames);
241
923
  }
242
- const config = typeCheckConfig(untrustedConfig);
924
+ const config = typeCheckConfig$1(untrustedConfig);
243
925
  if (!areRequiredParametersPresent(config, configPropertyNames)) {
244
926
  return null;
245
927
  }
246
928
  return config;
247
929
  }
248
930
  function adapterFragment(luvio, config) {
249
- createResourceParams(config);
250
- return select();
931
+ createResourceParams$1(config);
932
+ return select$1();
251
933
  }
252
934
  function onFetchResponseSuccess(luvio, config, resourceParams, response) {
253
- const snapshot = ingestSuccess(luvio, resourceParams, response, {
935
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
254
936
  config,
255
- resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
937
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
256
938
  });
257
939
  return luvio.storeBroadcast().then(() => snapshot);
258
940
  }
259
941
  function onFetchResponseError(luvio, config, resourceParams, response) {
260
942
  const snapshot = ingestError(luvio, resourceParams, response, {
261
943
  config,
262
- resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
944
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
263
945
  });
264
946
  return luvio.storeBroadcast().then(() => snapshot);
265
947
  }
266
- function buildNetworkSnapshot(luvio, config, options) {
267
- const resourceParams = createResourceParams(config);
268
- const request = createResourceRequest(resourceParams);
948
+ function buildNetworkSnapshot$1(luvio, config, options) {
949
+ const resourceParams = createResourceParams$1(config);
950
+ const request = createResourceRequest$1(resourceParams);
269
951
  return luvio.dispatchResourceRequest(request, options)
270
952
  .then((response) => {
271
953
  return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
272
954
  const cache = new StoreKeyMap();
273
- getResponseCacheKeys(cache, luvio, resourceParams, response.body);
955
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
274
956
  return cache;
275
957
  });
276
958
  }, (response) => {
@@ -278,7 +960,7 @@ function buildNetworkSnapshot(luvio, config, options) {
278
960
  });
279
961
  }
280
962
  function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
281
- return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, 'get', false);
963
+ return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
282
964
  }
283
965
  function buildCachedSnapshotCachePolicy(context, storeLookup) {
284
966
  const { luvio, config } = context;
@@ -289,12 +971,12 @@ function buildCachedSnapshotCachePolicy(context, storeLookup) {
289
971
  };
290
972
  const cacheSnapshot = storeLookup(selector, {
291
973
  config,
292
- resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
974
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
293
975
  });
294
976
  return cacheSnapshot;
295
977
  }
296
- const executeSoqlQueryPostAdapterFactory = (luvio) => function WAVE__executeSoqlQueryPost(untrustedConfig, requestContext) {
297
- const config = validateAdapterConfig(untrustedConfig, executeSoqlQueryPost_ConfigPropertyNames);
978
+ const getTemplateSetupPlanAdapterFactory = (luvio) => function WAVE__getTemplateSetupPlan(untrustedConfig, requestContext) {
979
+ const config = validateAdapterConfig$1(untrustedConfig, getTemplateSetupPlan_ConfigPropertyNames);
298
980
  // Invalid or incomplete config
299
981
  if (config === null) {
300
982
  return null;
@@ -303,4 +985,95 @@ const executeSoqlQueryPostAdapterFactory = (luvio) => function WAVE__executeSoql
303
985
  buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
304
986
  };
305
987
 
306
- export { executeSoqlQueryPostAdapterFactory };
988
+ function select(luvio, params) {
989
+ return select$2();
990
+ }
991
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
992
+ getTypeCacheKeys(storeKeyMap, luvio, response);
993
+ }
994
+ function ingestSuccess(luvio, resourceParams, response) {
995
+ const { body } = response;
996
+ const key = keyBuilderFromType(luvio, body);
997
+ luvio.storeIngest(key, ingest, body);
998
+ const snapshot = luvio.storeLookup({
999
+ recordId: key,
1000
+ node: select(),
1001
+ variables: {},
1002
+ });
1003
+ if (process.env.NODE_ENV !== 'production') {
1004
+ if (snapshot.state !== 'Fulfilled') {
1005
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1006
+ }
1007
+ }
1008
+ deepFreeze(snapshot.data);
1009
+ return snapshot;
1010
+ }
1011
+ function createResourceRequest(config) {
1012
+ const headers = {};
1013
+ return {
1014
+ baseUri: '/services/data/v61.0',
1015
+ basePath: '/wave/templates/' + config.urlParams.templateIdOrApiName + '/plans/' + config.urlParams.planName + '',
1016
+ method: 'post',
1017
+ body: null,
1018
+ urlParams: config.urlParams,
1019
+ queryParams: {},
1020
+ headers,
1021
+ priority: 'normal',
1022
+ };
1023
+ }
1024
+
1025
+ const adapterName = 'executeTemplateSetupPlan';
1026
+ const executeTemplateSetupPlan_ConfigPropertyMetadata = [
1027
+ generateParamConfigMetadata('planName', true, 0 /* UrlParameter */, 0 /* String */),
1028
+ generateParamConfigMetadata('templateIdOrApiName', true, 0 /* UrlParameter */, 0 /* String */),
1029
+ ];
1030
+ const executeTemplateSetupPlan_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, executeTemplateSetupPlan_ConfigPropertyMetadata);
1031
+ const createResourceParams = /*#__PURE__*/ createResourceParams$3(executeTemplateSetupPlan_ConfigPropertyMetadata);
1032
+ function typeCheckConfig(untrustedConfig) {
1033
+ const config = {};
1034
+ typeCheckConfig$3(untrustedConfig, config, executeTemplateSetupPlan_ConfigPropertyMetadata);
1035
+ return config;
1036
+ }
1037
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
1038
+ if (!untrustedIsObject(untrustedConfig)) {
1039
+ return null;
1040
+ }
1041
+ if (process.env.NODE_ENV !== 'production') {
1042
+ validateConfig(untrustedConfig, configPropertyNames);
1043
+ }
1044
+ const config = typeCheckConfig(untrustedConfig);
1045
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1046
+ return null;
1047
+ }
1048
+ return config;
1049
+ }
1050
+ function buildNetworkSnapshot(luvio, config, options) {
1051
+ const resourceParams = createResourceParams(config);
1052
+ const request = createResourceRequest(resourceParams);
1053
+ return luvio.dispatchResourceRequest(request, options)
1054
+ .then((response) => {
1055
+ return luvio.handleSuccessResponse(() => {
1056
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
1057
+ return luvio.storeBroadcast().then(() => snapshot);
1058
+ }, () => {
1059
+ const cache = new StoreKeyMap();
1060
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
1061
+ return cache;
1062
+ });
1063
+ }, (response) => {
1064
+ deepFreeze(response);
1065
+ throw response;
1066
+ });
1067
+ }
1068
+ const executeTemplateSetupPlanAdapterFactory = (luvio) => {
1069
+ return function executeTemplateSetupPlan(untrustedConfig) {
1070
+ const config = validateAdapterConfig(untrustedConfig, executeTemplateSetupPlan_ConfigPropertyNames);
1071
+ // Invalid or incomplete config
1072
+ if (config === null) {
1073
+ throw new Error('Invalid config for "executeTemplateSetupPlan"');
1074
+ }
1075
+ return buildNetworkSnapshot(luvio, config);
1076
+ };
1077
+ };
1078
+
1079
+ export { executeSoqlQueryPostAdapterFactory, executeTemplateSetupPlanAdapterFactory, getTemplateSetupPlanAdapterFactory };