@salesforce/lds-adapters-industries-decisiontable 1.281.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$3, 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, create: ObjectCreate } = Object;
@@ -79,7 +79,7 @@ function createLink(ref) {
79
79
  };
80
80
  }
81
81
 
82
- function validate$3(obj, path = 'DecisionTableParameterOutputRepresentation') {
82
+ function validate$9(obj, path = 'DecisionTableParameterOutputRepresentation') {
83
83
  const v_error = (() => {
84
84
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
85
85
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -179,7 +179,7 @@ function validate$3(obj, path = 'DecisionTableParameterOutputRepresentation') {
179
179
  return v_error === undefined ? null : v_error;
180
180
  }
181
181
 
182
- function validate$2(obj, path = 'DecisionTableSourceCriteriaOutputRepresentation') {
182
+ function validate$8(obj, path = 'DecisionTableSourceCriteriaOutputRepresentation') {
183
183
  const v_error = (() => {
184
184
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
185
185
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -223,7 +223,7 @@ function validate$2(obj, path = 'DecisionTableSourceCriteriaOutputRepresentation
223
223
  return v_error === undefined ? null : v_error;
224
224
  }
225
225
 
226
- function validate$1(obj, path = 'DecisionTableDefinitionOutputRepresentation') {
226
+ function validate$7(obj, path = 'DecisionTableDefinitionOutputRepresentation') {
227
227
  const v_error = (() => {
228
228
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
229
229
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -285,7 +285,7 @@ function validate$1(obj, path = 'DecisionTableDefinitionOutputRepresentation') {
285
285
  for (let i = 0; i < obj_parameters.length; i++) {
286
286
  const obj_parameters_item = obj_parameters[i];
287
287
  const path_parameters_item = path_parameters + '[' + i + ']';
288
- const referencepath_parameters_itemValidationError = validate$3(obj_parameters_item, path_parameters_item);
288
+ const referencepath_parameters_itemValidationError = validate$9(obj_parameters_item, path_parameters_item);
289
289
  if (referencepath_parameters_itemValidationError !== null) {
290
290
  let message = 'Object doesn\'t match DecisionTableParameterOutputRepresentation (at "' + path_parameters_item + '")\n';
291
291
  message += referencepath_parameters_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -307,7 +307,7 @@ function validate$1(obj, path = 'DecisionTableDefinitionOutputRepresentation') {
307
307
  for (let i = 0; i < obj_sourceCriteria.length; i++) {
308
308
  const obj_sourceCriteria_item = obj_sourceCriteria[i];
309
309
  const path_sourceCriteria_item = path_sourceCriteria + '[' + i + ']';
310
- const referencepath_sourceCriteria_itemValidationError = validate$2(obj_sourceCriteria_item, path_sourceCriteria_item);
310
+ const referencepath_sourceCriteria_itemValidationError = validate$8(obj_sourceCriteria_item, path_sourceCriteria_item);
311
311
  if (referencepath_sourceCriteria_itemValidationError !== null) {
312
312
  let message = 'Object doesn\'t match DecisionTableSourceCriteriaOutputRepresentation (at "' + path_sourceCriteria_item + '")\n';
313
313
  message += referencepath_sourceCriteria_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -353,9 +353,9 @@ function validate$1(obj, path = 'DecisionTableDefinitionOutputRepresentation') {
353
353
  return v_error === undefined ? null : v_error;
354
354
  }
355
355
 
356
- const TTL = 1000;
357
- const VERSION = "21435364536c593ed8b8972af7d154d5";
358
- function validate(obj, path = 'DecisionTableOutputRepresentation') {
356
+ const TTL$2 = 1000;
357
+ const VERSION$2 = "21435364536c593ed8b8972af7d154d5";
358
+ function validate$6(obj, path = 'DecisionTableOutputRepresentation') {
359
359
  const v_error = (() => {
360
360
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
361
361
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -369,7 +369,7 @@ function validate(obj, path = 'DecisionTableOutputRepresentation') {
369
369
  }
370
370
  const obj_decisionTable = obj.decisionTable;
371
371
  const path_decisionTable = path + '.decisionTable';
372
- const referencepath_decisionTableValidationError = validate$1(obj_decisionTable, path_decisionTable);
372
+ const referencepath_decisionTableValidationError = validate$7(obj_decisionTable, path_decisionTable);
373
373
  if (referencepath_decisionTableValidationError !== null) {
374
374
  let message = 'Object doesn\'t match DecisionTableDefinitionOutputRepresentation (at "' + path_decisionTable + '")\n';
375
375
  message += referencepath_decisionTableValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -392,11 +392,588 @@ function validate(obj, path = 'DecisionTableOutputRepresentation') {
392
392
  })();
393
393
  return v_error === undefined ? null : v_error;
394
394
  }
395
- const RepresentationType = 'DecisionTableOutputRepresentation';
395
+ const RepresentationType$2 = 'DecisionTableOutputRepresentation';
396
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
397
+ return input;
398
+ }
399
+ const select$5 = function DecisionTableOutputRepresentationSelect() {
400
+ return {
401
+ kind: 'Fragment',
402
+ version: VERSION$2,
403
+ private: [],
404
+ opaque: true
405
+ };
406
+ };
407
+ function equals$2(existing, incoming) {
408
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
409
+ return false;
410
+ }
411
+ return true;
412
+ }
413
+ const ingest$2 = function DecisionTableOutputRepresentationIngest(input, path, luvio, store, timestamp) {
414
+ if (process.env.NODE_ENV !== 'production') {
415
+ const validateError = validate$6(input);
416
+ if (validateError !== null) {
417
+ throw validateError;
418
+ }
419
+ }
420
+ const key = path.fullPath;
421
+ const ttlToUse = TTL$2;
422
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "DecisionTable", VERSION$2, RepresentationType$2, equals$2);
423
+ return createLink(key);
424
+ };
425
+ function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
426
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
427
+ const rootKey = fullPathFactory();
428
+ rootKeySet.set(rootKey, {
429
+ namespace: keyPrefix,
430
+ representationName: RepresentationType$2,
431
+ mergeable: false
432
+ });
433
+ }
434
+
435
+ function select$4(luvio, params) {
436
+ return select$5();
437
+ }
438
+ function keyBuilder$5(luvio, params) {
439
+ return keyPrefix + '::DecisionTableOutputRepresentation:(' + 'decisionTableId:' + params.urlParams.decisionTableId + ')';
440
+ }
441
+ function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
442
+ getTypeCacheKeys$2(storeKeyMap, luvio, response, () => keyBuilder$5(luvio, resourceParams));
443
+ }
444
+ function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
445
+ const { body } = response;
446
+ const key = keyBuilder$5(luvio, resourceParams);
447
+ luvio.storeIngest(key, ingest$2, body);
448
+ const snapshot = luvio.storeLookup({
449
+ recordId: key,
450
+ node: select$4(),
451
+ variables: {},
452
+ }, snapshotRefresh);
453
+ if (process.env.NODE_ENV !== 'production') {
454
+ if (snapshot.state !== 'Fulfilled') {
455
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
456
+ }
457
+ }
458
+ deepFreeze(snapshot.data);
459
+ return snapshot;
460
+ }
461
+ function ingestError$2(luvio, params, error, snapshotRefresh) {
462
+ const key = keyBuilder$5(luvio, params);
463
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
464
+ const storeMetadataParams = {
465
+ ttl: TTL$2,
466
+ namespace: keyPrefix,
467
+ version: VERSION$2,
468
+ representationName: RepresentationType$2
469
+ };
470
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
471
+ return errorSnapshot;
472
+ }
473
+ function createResourceRequest$2(config) {
474
+ const headers = {};
475
+ return {
476
+ baseUri: '/services/data/v61.0',
477
+ basePath: '/connect/business-rules/decision-table/definitions/' + config.urlParams.decisionTableId + '',
478
+ method: 'get',
479
+ body: null,
480
+ urlParams: config.urlParams,
481
+ queryParams: {},
482
+ headers,
483
+ priority: 'normal',
484
+ };
485
+ }
486
+
487
+ const adapterName$2 = 'getDecisionTable';
488
+ const getDecisionTable_ConfigPropertyMetadata = [
489
+ generateParamConfigMetadata('decisionTableId', true, 0 /* UrlParameter */, 0 /* String */),
490
+ ];
491
+ const getDecisionTable_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getDecisionTable_ConfigPropertyMetadata);
492
+ const createResourceParams$2 = /*#__PURE__*/ createResourceParams$3(getDecisionTable_ConfigPropertyMetadata);
493
+ function keyBuilder$4(luvio, config) {
494
+ const resourceParams = createResourceParams$2(config);
495
+ return keyBuilder$5(luvio, resourceParams);
496
+ }
497
+ function typeCheckConfig$2(untrustedConfig) {
498
+ const config = {};
499
+ typeCheckConfig$3(untrustedConfig, config, getDecisionTable_ConfigPropertyMetadata);
500
+ return config;
501
+ }
502
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
503
+ if (!untrustedIsObject(untrustedConfig)) {
504
+ return null;
505
+ }
506
+ if (process.env.NODE_ENV !== 'production') {
507
+ validateConfig(untrustedConfig, configPropertyNames);
508
+ }
509
+ const config = typeCheckConfig$2(untrustedConfig);
510
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
511
+ return null;
512
+ }
513
+ return config;
514
+ }
515
+ function adapterFragment$2(luvio, config) {
516
+ createResourceParams$2(config);
517
+ return select$4();
518
+ }
519
+ function onFetchResponseSuccess$2(luvio, config, resourceParams, response) {
520
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
521
+ config,
522
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
523
+ });
524
+ return luvio.storeBroadcast().then(() => snapshot);
525
+ }
526
+ function onFetchResponseError$2(luvio, config, resourceParams, response) {
527
+ const snapshot = ingestError$2(luvio, resourceParams, response, {
528
+ config,
529
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
530
+ });
531
+ return luvio.storeBroadcast().then(() => snapshot);
532
+ }
533
+ function buildNetworkSnapshot$2(luvio, config, options) {
534
+ const resourceParams = createResourceParams$2(config);
535
+ const request = createResourceRequest$2(resourceParams);
536
+ return luvio.dispatchResourceRequest(request, options)
537
+ .then((response) => {
538
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$2(luvio, config, resourceParams, response), () => {
539
+ const cache = new StoreKeyMap();
540
+ getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
541
+ return cache;
542
+ });
543
+ }, (response) => {
544
+ return luvio.handleErrorResponse(() => onFetchResponseError$2(luvio, config, resourceParams, response));
545
+ });
546
+ }
547
+ function buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext) {
548
+ return buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, undefined, false);
549
+ }
550
+ function buildCachedSnapshotCachePolicy$2(context, storeLookup) {
551
+ const { luvio, config } = context;
552
+ const selector = {
553
+ recordId: keyBuilder$4(luvio, config),
554
+ node: adapterFragment$2(luvio, config),
555
+ variables: {},
556
+ };
557
+ const cacheSnapshot = storeLookup(selector, {
558
+ config,
559
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
560
+ });
561
+ return cacheSnapshot;
562
+ }
563
+ const getDecisionTableAdapterFactory = (luvio) => function DecisionTable__getDecisionTable(untrustedConfig, requestContext) {
564
+ const config = validateAdapterConfig$2(untrustedConfig, getDecisionTable_ConfigPropertyNames);
565
+ // Invalid or incomplete config
566
+ if (config === null) {
567
+ return null;
568
+ }
569
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
570
+ buildCachedSnapshotCachePolicy$2, buildNetworkSnapshotCachePolicy$2);
571
+ };
572
+
573
+ function validate$5(obj, path = 'DecisionTableTemplateOutputRepresentation') {
574
+ const v_error = (() => {
575
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
576
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
577
+ }
578
+ if (obj.location !== undefined) {
579
+ const obj_location = obj.location;
580
+ const path_location = path + '.location';
581
+ if (typeof obj_location !== 'string') {
582
+ return new TypeError('Expected "string" but received "' + typeof obj_location + '" (at "' + path_location + '")');
583
+ }
584
+ }
585
+ if (obj.templateName !== undefined) {
586
+ const obj_templateName = obj.templateName;
587
+ const path_templateName = path + '.templateName';
588
+ if (typeof obj_templateName !== 'string') {
589
+ return new TypeError('Expected "string" but received "' + typeof obj_templateName + '" (at "' + path_templateName + '")');
590
+ }
591
+ }
592
+ if (obj.usageType !== undefined) {
593
+ const obj_usageType = obj.usageType;
594
+ const path_usageType = path + '.usageType';
595
+ if (typeof obj_usageType !== 'string') {
596
+ return new TypeError('Expected "string" but received "' + typeof obj_usageType + '" (at "' + path_usageType + '")');
597
+ }
598
+ }
599
+ })();
600
+ return v_error === undefined ? null : v_error;
601
+ }
602
+
603
+ function validate$4(obj, path = 'ErrorParametersOutputRepresentation') {
604
+ const v_error = (() => {
605
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
606
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
607
+ }
608
+ if (obj.name !== undefined) {
609
+ const obj_name = obj.name;
610
+ const path_name = path + '.name';
611
+ if (typeof obj_name !== 'string') {
612
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
613
+ }
614
+ }
615
+ if (obj.value !== undefined) {
616
+ const obj_value = obj.value;
617
+ const path_value = path + '.value';
618
+ if (typeof obj_value !== 'string') {
619
+ return new TypeError('Expected "string" but received "' + typeof obj_value + '" (at "' + path_value + '")');
620
+ }
621
+ }
622
+ })();
623
+ return v_error === undefined ? null : v_error;
624
+ }
625
+
626
+ function validate$3(obj, path = 'ErrorTargetsOutputRepresentation') {
627
+ const v_error = (() => {
628
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
629
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
630
+ }
631
+ if (obj.reference !== undefined) {
632
+ const obj_reference = obj.reference;
633
+ const path_reference = path + '.reference';
634
+ if (typeof obj_reference !== 'string') {
635
+ return new TypeError('Expected "string" but received "' + typeof obj_reference + '" (at "' + path_reference + '")');
636
+ }
637
+ }
638
+ if (obj.type !== undefined) {
639
+ const obj_type = obj.type;
640
+ const path_type = path + '.type';
641
+ if (typeof obj_type !== 'string') {
642
+ return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
643
+ }
644
+ }
645
+ })();
646
+ return v_error === undefined ? null : v_error;
647
+ }
648
+
649
+ function validate$2(obj, path = 'ErrorOutputRepresentation') {
650
+ const v_error = (() => {
651
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
652
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
653
+ }
654
+ if (obj.errorCode !== undefined) {
655
+ const obj_errorCode = obj.errorCode;
656
+ const path_errorCode = path + '.errorCode';
657
+ if (typeof obj_errorCode !== 'string') {
658
+ return new TypeError('Expected "string" but received "' + typeof obj_errorCode + '" (at "' + path_errorCode + '")');
659
+ }
660
+ }
661
+ if (obj.message !== undefined) {
662
+ const obj_message = obj.message;
663
+ const path_message = path + '.message';
664
+ if (typeof obj_message !== 'string') {
665
+ return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
666
+ }
667
+ }
668
+ if (obj.messageCode !== undefined) {
669
+ const obj_messageCode = obj.messageCode;
670
+ const path_messageCode = path + '.messageCode';
671
+ if (typeof obj_messageCode !== 'string') {
672
+ return new TypeError('Expected "string" but received "' + typeof obj_messageCode + '" (at "' + path_messageCode + '")');
673
+ }
674
+ }
675
+ if (obj.parameters !== undefined) {
676
+ const obj_parameters = obj.parameters;
677
+ const path_parameters = path + '.parameters';
678
+ if (!ArrayIsArray(obj_parameters)) {
679
+ return new TypeError('Expected "array" but received "' + typeof obj_parameters + '" (at "' + path_parameters + '")');
680
+ }
681
+ for (let i = 0; i < obj_parameters.length; i++) {
682
+ const obj_parameters_item = obj_parameters[i];
683
+ const path_parameters_item = path_parameters + '[' + i + ']';
684
+ const referencepath_parameters_itemValidationError = validate$4(obj_parameters_item, path_parameters_item);
685
+ if (referencepath_parameters_itemValidationError !== null) {
686
+ let message = 'Object doesn\'t match ErrorParametersOutputRepresentation (at "' + path_parameters_item + '")\n';
687
+ message += referencepath_parameters_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
688
+ return new TypeError(message);
689
+ }
690
+ }
691
+ }
692
+ if (obj.targets !== undefined) {
693
+ const obj_targets = obj.targets;
694
+ const path_targets = path + '.targets';
695
+ if (!ArrayIsArray(obj_targets)) {
696
+ return new TypeError('Expected "array" but received "' + typeof obj_targets + '" (at "' + path_targets + '")');
697
+ }
698
+ for (let i = 0; i < obj_targets.length; i++) {
699
+ const obj_targets_item = obj_targets[i];
700
+ const path_targets_item = path_targets + '[' + i + ']';
701
+ const referencepath_targets_itemValidationError = validate$3(obj_targets_item, path_targets_item);
702
+ if (referencepath_targets_itemValidationError !== null) {
703
+ let message = 'Object doesn\'t match ErrorTargetsOutputRepresentation (at "' + path_targets_item + '")\n';
704
+ message += referencepath_targets_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
705
+ return new TypeError(message);
706
+ }
707
+ }
708
+ }
709
+ })();
710
+ return v_error === undefined ? null : v_error;
711
+ }
712
+
713
+ const TTL$1 = 1000;
714
+ const VERSION$1 = "a2891bd122ab9f728d5937bf70b9f600";
715
+ function validate$1(obj, path = 'DecisionTableTemplatesListOutputRepresentation') {
716
+ const v_error = (() => {
717
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
718
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
719
+ }
720
+ if (obj.decisionTableTemplates !== undefined) {
721
+ const obj_decisionTableTemplates = obj.decisionTableTemplates;
722
+ const path_decisionTableTemplates = path + '.decisionTableTemplates';
723
+ if (!ArrayIsArray(obj_decisionTableTemplates)) {
724
+ return new TypeError('Expected "array" but received "' + typeof obj_decisionTableTemplates + '" (at "' + path_decisionTableTemplates + '")');
725
+ }
726
+ for (let i = 0; i < obj_decisionTableTemplates.length; i++) {
727
+ const obj_decisionTableTemplates_item = obj_decisionTableTemplates[i];
728
+ const path_decisionTableTemplates_item = path_decisionTableTemplates + '[' + i + ']';
729
+ const referencepath_decisionTableTemplates_itemValidationError = validate$5(obj_decisionTableTemplates_item, path_decisionTableTemplates_item);
730
+ if (referencepath_decisionTableTemplates_itemValidationError !== null) {
731
+ let message = 'Object doesn\'t match DecisionTableTemplateOutputRepresentation (at "' + path_decisionTableTemplates_item + '")\n';
732
+ message += referencepath_decisionTableTemplates_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
733
+ return new TypeError(message);
734
+ }
735
+ }
736
+ }
737
+ if (obj.errors !== undefined) {
738
+ const obj_errors = obj.errors;
739
+ const path_errors = path + '.errors';
740
+ if (!ArrayIsArray(obj_errors)) {
741
+ return new TypeError('Expected "array" but received "' + typeof obj_errors + '" (at "' + path_errors + '")');
742
+ }
743
+ for (let i = 0; i < obj_errors.length; i++) {
744
+ const obj_errors_item = obj_errors[i];
745
+ const path_errors_item = path_errors + '[' + i + ']';
746
+ const referencepath_errors_itemValidationError = validate$2(obj_errors_item, path_errors_item);
747
+ if (referencepath_errors_itemValidationError !== null) {
748
+ let message = 'Object doesn\'t match ErrorOutputRepresentation (at "' + path_errors_item + '")\n';
749
+ message += referencepath_errors_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
750
+ return new TypeError(message);
751
+ }
752
+ }
753
+ }
754
+ })();
755
+ return v_error === undefined ? null : v_error;
756
+ }
757
+ const RepresentationType$1 = 'DecisionTableTemplatesListOutputRepresentation';
758
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
759
+ return input;
760
+ }
761
+ const select$3 = function DecisionTableTemplatesListOutputRepresentationSelect() {
762
+ return {
763
+ kind: 'Fragment',
764
+ version: VERSION$1,
765
+ private: [],
766
+ opaque: true
767
+ };
768
+ };
769
+ function equals$1(existing, incoming) {
770
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
771
+ return false;
772
+ }
773
+ return true;
774
+ }
775
+ const ingest$1 = function DecisionTableTemplatesListOutputRepresentationIngest(input, path, luvio, store, timestamp) {
776
+ if (process.env.NODE_ENV !== 'production') {
777
+ const validateError = validate$1(input);
778
+ if (validateError !== null) {
779
+ throw validateError;
780
+ }
781
+ }
782
+ const key = path.fullPath;
783
+ const ttlToUse = TTL$1;
784
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "DecisionTable", VERSION$1, RepresentationType$1, equals$1);
785
+ return createLink(key);
786
+ };
787
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
788
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
789
+ const rootKey = fullPathFactory();
790
+ rootKeySet.set(rootKey, {
791
+ namespace: keyPrefix,
792
+ representationName: RepresentationType$1,
793
+ mergeable: false
794
+ });
795
+ }
796
+
797
+ function select$2(luvio, params) {
798
+ return select$3();
799
+ }
800
+ function keyBuilder$3(luvio, params) {
801
+ return keyPrefix + '::DecisionTableTemplatesListOutputRepresentation:(' + 'usageType:' + params.queryParams.usageType + ')';
802
+ }
803
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
804
+ getTypeCacheKeys$1(storeKeyMap, luvio, response, () => keyBuilder$3(luvio, resourceParams));
805
+ }
806
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
807
+ const { body } = response;
808
+ const key = keyBuilder$3(luvio, resourceParams);
809
+ luvio.storeIngest(key, ingest$1, body);
810
+ const snapshot = luvio.storeLookup({
811
+ recordId: key,
812
+ node: select$2(),
813
+ variables: {},
814
+ }, snapshotRefresh);
815
+ if (process.env.NODE_ENV !== 'production') {
816
+ if (snapshot.state !== 'Fulfilled') {
817
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
818
+ }
819
+ }
820
+ deepFreeze(snapshot.data);
821
+ return snapshot;
822
+ }
823
+ function ingestError$1(luvio, params, error, snapshotRefresh) {
824
+ const key = keyBuilder$3(luvio, params);
825
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
826
+ const storeMetadataParams = {
827
+ ttl: TTL$1,
828
+ namespace: keyPrefix,
829
+ version: VERSION$1,
830
+ representationName: RepresentationType$1
831
+ };
832
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
833
+ return errorSnapshot;
834
+ }
835
+ function createResourceRequest$1(config) {
836
+ const headers = {};
837
+ return {
838
+ baseUri: '/services/data/v61.0',
839
+ basePath: '/connect/business-rules/decision-table/templates',
840
+ method: 'get',
841
+ body: null,
842
+ urlParams: {},
843
+ queryParams: config.queryParams,
844
+ headers,
845
+ priority: 'normal',
846
+ };
847
+ }
848
+
849
+ const adapterName$1 = 'getDecisionTableTemplate';
850
+ const getDecisionTableTemplate_ConfigPropertyMetadata = [
851
+ generateParamConfigMetadata('usageType', false, 1 /* QueryParameter */, 0 /* String */),
852
+ ];
853
+ const getDecisionTableTemplate_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getDecisionTableTemplate_ConfigPropertyMetadata);
854
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(getDecisionTableTemplate_ConfigPropertyMetadata);
855
+ function keyBuilder$2(luvio, config) {
856
+ const resourceParams = createResourceParams$1(config);
857
+ return keyBuilder$3(luvio, resourceParams);
858
+ }
859
+ function typeCheckConfig$1(untrustedConfig) {
860
+ const config = {};
861
+ typeCheckConfig$3(untrustedConfig, config, getDecisionTableTemplate_ConfigPropertyMetadata);
862
+ return config;
863
+ }
864
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
865
+ if (!untrustedIsObject(untrustedConfig)) {
866
+ return null;
867
+ }
868
+ if (process.env.NODE_ENV !== 'production') {
869
+ validateConfig(untrustedConfig, configPropertyNames);
870
+ }
871
+ const config = typeCheckConfig$1(untrustedConfig);
872
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
873
+ return null;
874
+ }
875
+ return config;
876
+ }
877
+ function adapterFragment$1(luvio, config) {
878
+ createResourceParams$1(config);
879
+ return select$2();
880
+ }
881
+ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
882
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
883
+ config,
884
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
885
+ });
886
+ return luvio.storeBroadcast().then(() => snapshot);
887
+ }
888
+ function onFetchResponseError$1(luvio, config, resourceParams, response) {
889
+ const snapshot = ingestError$1(luvio, resourceParams, response, {
890
+ config,
891
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
892
+ });
893
+ return luvio.storeBroadcast().then(() => snapshot);
894
+ }
895
+ function buildNetworkSnapshot$1(luvio, config, options) {
896
+ const resourceParams = createResourceParams$1(config);
897
+ const request = createResourceRequest$1(resourceParams);
898
+ return luvio.dispatchResourceRequest(request, options)
899
+ .then((response) => {
900
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
901
+ const cache = new StoreKeyMap();
902
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
903
+ return cache;
904
+ });
905
+ }, (response) => {
906
+ return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
907
+ });
908
+ }
909
+ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
910
+ return buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
911
+ }
912
+ function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
913
+ const { luvio, config } = context;
914
+ const selector = {
915
+ recordId: keyBuilder$2(luvio, config),
916
+ node: adapterFragment$1(luvio, config),
917
+ variables: {},
918
+ };
919
+ const cacheSnapshot = storeLookup(selector, {
920
+ config,
921
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
922
+ });
923
+ return cacheSnapshot;
924
+ }
925
+ const getDecisionTableTemplateAdapterFactory = (luvio) => function DecisionTable__getDecisionTableTemplate(untrustedConfig, requestContext) {
926
+ const config = validateAdapterConfig$1(untrustedConfig, getDecisionTableTemplate_ConfigPropertyNames);
927
+ // Invalid or incomplete config
928
+ if (config === null) {
929
+ return null;
930
+ }
931
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
932
+ buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
933
+ };
934
+
935
+ const TTL = 1000;
936
+ const VERSION = "9a106f486843ccdb3e85594fb33ef97f";
937
+ function validate(obj, path = 'DecisionTableTemplateDefinitionOutputRepresentation') {
938
+ const v_error = (() => {
939
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
940
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
941
+ }
942
+ if (obj.decisionTableTemplate !== undefined) {
943
+ const obj_decisionTableTemplate = obj.decisionTableTemplate;
944
+ const path_decisionTableTemplate = path + '.decisionTableTemplate';
945
+ const referencepath_decisionTableTemplateValidationError = validate$7(obj_decisionTableTemplate, path_decisionTableTemplate);
946
+ if (referencepath_decisionTableTemplateValidationError !== null) {
947
+ let message = 'Object doesn\'t match DecisionTableDefinitionOutputRepresentation (at "' + path_decisionTableTemplate + '")\n';
948
+ message += referencepath_decisionTableTemplateValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
949
+ return new TypeError(message);
950
+ }
951
+ }
952
+ if (obj.errors !== undefined) {
953
+ const obj_errors = obj.errors;
954
+ const path_errors = path + '.errors';
955
+ if (!ArrayIsArray(obj_errors)) {
956
+ return new TypeError('Expected "array" but received "' + typeof obj_errors + '" (at "' + path_errors + '")');
957
+ }
958
+ for (let i = 0; i < obj_errors.length; i++) {
959
+ const obj_errors_item = obj_errors[i];
960
+ const path_errors_item = path_errors + '[' + i + ']';
961
+ const referencepath_errors_itemValidationError = validate$2(obj_errors_item, path_errors_item);
962
+ if (referencepath_errors_itemValidationError !== null) {
963
+ let message = 'Object doesn\'t match ErrorOutputRepresentation (at "' + path_errors_item + '")\n';
964
+ message += referencepath_errors_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
965
+ return new TypeError(message);
966
+ }
967
+ }
968
+ }
969
+ })();
970
+ return v_error === undefined ? null : v_error;
971
+ }
972
+ const RepresentationType = 'DecisionTableTemplateDefinitionOutputRepresentation';
396
973
  function normalize(input, existing, path, luvio, store, timestamp) {
397
974
  return input;
398
975
  }
399
- const select$1 = function DecisionTableOutputRepresentationSelect() {
976
+ const select$1 = function DecisionTableTemplateDefinitionOutputRepresentationSelect() {
400
977
  return {
401
978
  kind: 'Fragment',
402
979
  version: VERSION,
@@ -410,7 +987,7 @@ function equals(existing, incoming) {
410
987
  }
411
988
  return true;
412
989
  }
413
- const ingest = function DecisionTableOutputRepresentationIngest(input, path, luvio, store, timestamp) {
990
+ const ingest = function DecisionTableTemplateDefinitionOutputRepresentationIngest(input, path, luvio, store, timestamp) {
414
991
  if (process.env.NODE_ENV !== 'production') {
415
992
  const validateError = validate(input);
416
993
  if (validateError !== null) {
@@ -436,7 +1013,7 @@ function select(luvio, params) {
436
1013
  return select$1();
437
1014
  }
438
1015
  function keyBuilder$1(luvio, params) {
439
- return keyPrefix + '::DecisionTableOutputRepresentation:(' + 'decisionTableId:' + params.urlParams.decisionTableId + ')';
1016
+ return keyPrefix + '::DecisionTableTemplateDefinitionOutputRepresentation:(' + 'templateName:' + params.urlParams.templateName + ')';
440
1017
  }
441
1018
  function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
442
1019
  getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$1(luvio, resourceParams));
@@ -474,7 +1051,7 @@ function createResourceRequest(config) {
474
1051
  const headers = {};
475
1052
  return {
476
1053
  baseUri: '/services/data/v61.0',
477
- basePath: '/connect/business-rules/decision-table/definitions/' + config.urlParams.decisionTableId + '',
1054
+ basePath: '/connect/business-rules/decision-table/templates/' + config.urlParams.templateName + '',
478
1055
  method: 'get',
479
1056
  body: null,
480
1057
  urlParams: config.urlParams,
@@ -484,19 +1061,19 @@ function createResourceRequest(config) {
484
1061
  };
485
1062
  }
486
1063
 
487
- const adapterName = 'getDecisionTable';
488
- const getDecisionTable_ConfigPropertyMetadata = [
489
- generateParamConfigMetadata('decisionTableId', true, 0 /* UrlParameter */, 0 /* String */),
1064
+ const adapterName = 'getDecisionTableTemplateList';
1065
+ const getDecisionTableTemplateList_ConfigPropertyMetadata = [
1066
+ generateParamConfigMetadata('templateName', true, 0 /* UrlParameter */, 0 /* String */),
490
1067
  ];
491
- const getDecisionTable_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getDecisionTable_ConfigPropertyMetadata);
492
- const createResourceParams = /*#__PURE__*/ createResourceParams$1(getDecisionTable_ConfigPropertyMetadata);
1068
+ const getDecisionTableTemplateList_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getDecisionTableTemplateList_ConfigPropertyMetadata);
1069
+ const createResourceParams = /*#__PURE__*/ createResourceParams$3(getDecisionTableTemplateList_ConfigPropertyMetadata);
493
1070
  function keyBuilder(luvio, config) {
494
1071
  const resourceParams = createResourceParams(config);
495
1072
  return keyBuilder$1(luvio, resourceParams);
496
1073
  }
497
1074
  function typeCheckConfig(untrustedConfig) {
498
1075
  const config = {};
499
- typeCheckConfig$1(untrustedConfig, config, getDecisionTable_ConfigPropertyMetadata);
1076
+ typeCheckConfig$3(untrustedConfig, config, getDecisionTableTemplateList_ConfigPropertyMetadata);
500
1077
  return config;
501
1078
  }
502
1079
  function validateAdapterConfig(untrustedConfig, configPropertyNames) {
@@ -545,7 +1122,7 @@ function buildNetworkSnapshot(luvio, config, options) {
545
1122
  });
546
1123
  }
547
1124
  function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
548
- return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
1125
+ return buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
549
1126
  }
550
1127
  function buildCachedSnapshotCachePolicy(context, storeLookup) {
551
1128
  const { luvio, config } = context;
@@ -560,8 +1137,8 @@ function buildCachedSnapshotCachePolicy(context, storeLookup) {
560
1137
  });
561
1138
  return cacheSnapshot;
562
1139
  }
563
- const getDecisionTableAdapterFactory = (luvio) => function DecisionTable__getDecisionTable(untrustedConfig, requestContext) {
564
- const config = validateAdapterConfig(untrustedConfig, getDecisionTable_ConfigPropertyNames);
1140
+ const getDecisionTableTemplateListAdapterFactory = (luvio) => function DecisionTable__getDecisionTableTemplateList(untrustedConfig, requestContext) {
1141
+ const config = validateAdapterConfig(untrustedConfig, getDecisionTableTemplateList_ConfigPropertyNames);
565
1142
  // Invalid or incomplete config
566
1143
  if (config === null) {
567
1144
  return null;
@@ -570,4 +1147,4 @@ const getDecisionTableAdapterFactory = (luvio) => function DecisionTable__getDec
570
1147
  buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
571
1148
  };
572
1149
 
573
- export { getDecisionTableAdapterFactory };
1150
+ export { getDecisionTableAdapterFactory, getDecisionTableTemplateAdapterFactory, getDecisionTableTemplateListAdapterFactory };