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