@salesforce/lds-adapters-cdp-byoc 1.332.0-dev20 → 1.332.0-dev22

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, StoreKeyMap, createResourceParams as createResourceParams$1, typeCheckConfig as typeCheckConfig$1 } from '@luvio/engine';
7
+ import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$5, typeCheckConfig as typeCheckConfig$5, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$2 } from '@luvio/engine';
8
8
 
9
9
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
10
  const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
@@ -41,6 +41,13 @@ function untrustedIsObject(untrusted) {
41
41
  function areRequiredParametersPresent(config, configPropertyNames) {
42
42
  return configPropertyNames.parameters.required.every(req => req in config);
43
43
  }
44
+ const snapshotRefreshOptions = {
45
+ overrides: {
46
+ headers: {
47
+ 'Cache-Control': 'no-cache',
48
+ },
49
+ }
50
+ };
44
51
  function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
45
52
  return {
46
53
  name,
@@ -104,8 +111,8 @@ function createLink(ref) {
104
111
  };
105
112
  }
106
113
 
107
- const VERSION$1 = "2fe1bfd9fd1c6a94767d2ea000d6d318";
108
- function validate$1(obj, path = 'CdpUserRepresentation') {
114
+ const VERSION$2 = "2fe1bfd9fd1c6a94767d2ea000d6d318";
115
+ function validate$2(obj, path = 'CdpUserRepresentation') {
109
116
  const v_error = (() => {
110
117
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
111
118
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -128,10 +135,10 @@ function validate$1(obj, path = 'CdpUserRepresentation') {
128
135
  })();
129
136
  return v_error === undefined ? null : v_error;
130
137
  }
131
- const select$2 = function CdpUserRepresentationSelect() {
138
+ const select$6 = function CdpUserRepresentationSelect() {
132
139
  return {
133
140
  kind: 'Fragment',
134
- version: VERSION$1,
141
+ version: VERSION$2,
135
142
  private: [],
136
143
  selections: [
137
144
  {
@@ -149,7 +156,7 @@ const select$2 = function CdpUserRepresentationSelect() {
149
156
  ]
150
157
  };
151
158
  };
152
- function equals$1(existing, incoming) {
159
+ function equals$2(existing, incoming) {
153
160
  const existing_id = existing.id;
154
161
  const incoming_id = incoming.id;
155
162
  if (!(existing_id === incoming_id)) {
@@ -168,8 +175,8 @@ function equals$1(existing, incoming) {
168
175
  return true;
169
176
  }
170
177
 
171
- const VERSION = "bc7c21323d31a68bdc0ef7484dc4fa2b";
172
- function validate(obj, path = 'CustomCodeDeploymentRepresentation') {
178
+ const VERSION$1 = "bc7c21323d31a68bdc0ef7484dc4fa2b";
179
+ function validate$1(obj, path = 'CustomCodeDeploymentRepresentation') {
173
180
  const v_error = (() => {
174
181
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
175
182
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -186,7 +193,7 @@ function validate(obj, path = 'CustomCodeDeploymentRepresentation') {
186
193
  }
187
194
  const obj_createdBy = obj.createdBy;
188
195
  const path_createdBy = path + '.createdBy';
189
- const referencepath_createdByValidationError = validate$1(obj_createdBy, path_createdBy);
196
+ const referencepath_createdByValidationError = validate$2(obj_createdBy, path_createdBy);
190
197
  if (referencepath_createdByValidationError !== null) {
191
198
  let message = 'Object doesn\'t match CdpUserRepresentation (at "' + path_createdBy + '")\n';
192
199
  message += referencepath_createdByValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -254,7 +261,7 @@ function validate(obj, path = 'CustomCodeDeploymentRepresentation') {
254
261
  }
255
262
  const obj_lastModifiedBy = obj.lastModifiedBy;
256
263
  const path_lastModifiedBy = path + '.lastModifiedBy';
257
- const referencepath_lastModifiedByValidationError = validate$1(obj_lastModifiedBy, path_lastModifiedBy);
264
+ const referencepath_lastModifiedByValidationError = validate$2(obj_lastModifiedBy, path_lastModifiedBy);
258
265
  if (referencepath_lastModifiedByValidationError !== null) {
259
266
  let message = 'Object doesn\'t match CdpUserRepresentation (at "' + path_lastModifiedBy + '")\n';
260
267
  message += referencepath_lastModifiedByValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -309,24 +316,24 @@ function validate(obj, path = 'CustomCodeDeploymentRepresentation') {
309
316
  })();
310
317
  return v_error === undefined ? null : v_error;
311
318
  }
312
- const RepresentationType = 'CustomCodeDeploymentRepresentation';
313
- function keyBuilder(luvio, config) {
314
- return keyPrefix + '::' + RepresentationType + ':' + config.id;
319
+ const RepresentationType$1 = 'CustomCodeDeploymentRepresentation';
320
+ function keyBuilder$5(luvio, config) {
321
+ return keyPrefix + '::' + RepresentationType$1 + ':' + config.id;
315
322
  }
316
323
  function keyBuilderFromType(luvio, object) {
317
324
  const keyParams = {
318
325
  id: object.id
319
326
  };
320
- return keyBuilder(luvio, keyParams);
327
+ return keyBuilder$5(luvio, keyParams);
321
328
  }
322
- function normalize(input, existing, path, luvio, store, timestamp) {
329
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
323
330
  return input;
324
331
  }
325
- const select$1 = function CustomCodeDeploymentRepresentationSelect() {
326
- const { selections: CdpUserRepresentation__selections, opaque: CdpUserRepresentation__opaque, } = select$2();
332
+ const select$5 = function CustomCodeDeploymentRepresentationSelect() {
333
+ const { selections: CdpUserRepresentation__selections, opaque: CdpUserRepresentation__opaque, } = select$6();
327
334
  return {
328
335
  kind: 'Fragment',
329
- version: VERSION,
336
+ version: VERSION$1,
330
337
  private: [],
331
338
  selections: [
332
339
  {
@@ -421,7 +428,7 @@ const select$1 = function CustomCodeDeploymentRepresentationSelect() {
421
428
  ]
422
429
  };
423
430
  };
424
- function equals(existing, incoming) {
431
+ function equals$1(existing, incoming) {
425
432
  const existing_deploymentFailureCode = existing.deploymentFailureCode;
426
433
  const incoming_deploymentFailureCode = incoming.deploymentFailureCode;
427
434
  // if at least one of these optionals is defined
@@ -536,7 +543,7 @@ function equals(existing, incoming) {
536
543
  }
537
544
  const existing_createdBy = existing.createdBy;
538
545
  const incoming_createdBy = incoming.createdBy;
539
- if (!(equals$1(existing_createdBy, incoming_createdBy))) {
546
+ if (!(equals$2(existing_createdBy, incoming_createdBy))) {
540
547
  return false;
541
548
  }
542
549
  const existing_functionInvokeOptions = existing.functionInvokeOptions;
@@ -559,7 +566,7 @@ function equals(existing, incoming) {
559
566
  }
560
567
  const existing_lastModifiedBy = existing.lastModifiedBy;
561
568
  const incoming_lastModifiedBy = incoming.lastModifiedBy;
562
- if (!(equals$1(existing_lastModifiedBy, incoming_lastModifiedBy))) {
569
+ if (!(equals$2(existing_lastModifiedBy, incoming_lastModifiedBy))) {
563
570
  return false;
564
571
  }
565
572
  const existing_parameters = existing.parameters;
@@ -574,41 +581,41 @@ function equals(existing, incoming) {
574
581
  }
575
582
  return true;
576
583
  }
577
- const ingest = function CustomCodeDeploymentRepresentationIngest(input, path, luvio, store, timestamp) {
584
+ const ingest$1 = function CustomCodeDeploymentRepresentationIngest(input, path, luvio, store, timestamp) {
578
585
  if (process.env.NODE_ENV !== 'production') {
579
- const validateError = validate(input);
586
+ const validateError = validate$1(input);
580
587
  if (validateError !== null) {
581
588
  throw validateError;
582
589
  }
583
590
  }
584
591
  const key = keyBuilderFromType(luvio, input);
585
592
  const ttlToUse = path.ttl !== undefined ? path.ttl : 60000;
586
- ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "byoc", VERSION, RepresentationType, equals);
593
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "byoc", VERSION$1, RepresentationType$1, equals$1);
587
594
  return createLink(key);
588
595
  };
589
- function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
596
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
590
597
  // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
591
598
  const rootKey = keyBuilderFromType(luvio, input);
592
599
  rootKeySet.set(rootKey, {
593
600
  namespace: keyPrefix,
594
- representationName: RepresentationType,
601
+ representationName: RepresentationType$1,
595
602
  mergeable: false
596
603
  });
597
604
  }
598
605
 
599
- function select(luvio, params) {
600
- return select$1();
606
+ function select$4(luvio, params) {
607
+ return select$5();
601
608
  }
602
- function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
603
- getTypeCacheKeys(storeKeyMap, luvio, response);
609
+ function getResponseCacheKeys$4(storeKeyMap, luvio, resourceParams, response) {
610
+ getTypeCacheKeys$1(storeKeyMap, luvio, response);
604
611
  }
605
- function ingestSuccess(luvio, resourceParams, response) {
612
+ function ingestSuccess$3(luvio, resourceParams, response) {
606
613
  const { body } = response;
607
614
  const key = keyBuilderFromType(luvio, body);
608
- luvio.storeIngest(key, ingest, body);
615
+ luvio.storeIngest(key, ingest$1, body);
609
616
  const snapshot = luvio.storeLookup({
610
617
  recordId: key,
611
- node: select(),
618
+ node: select$4(),
612
619
  variables: {},
613
620
  });
614
621
  if (process.env.NODE_ENV !== 'production') {
@@ -619,7 +626,7 @@ function ingestSuccess(luvio, resourceParams, response) {
619
626
  deepFreeze(snapshot.data);
620
627
  return snapshot;
621
628
  }
622
- function createResourceRequest(config) {
629
+ function createResourceRequest$4(config) {
623
630
  const headers = {};
624
631
  return {
625
632
  baseUri: '/services/data/v63.0',
@@ -633,7 +640,7 @@ function createResourceRequest(config) {
633
640
  };
634
641
  }
635
642
 
636
- const adapterName = 'createCustomCodeDeployment';
643
+ const adapterName$4 = 'createCustomCodeDeployment';
637
644
  const createCustomCodeDeployment_ConfigPropertyMetadata = [
638
645
  generateParamConfigMetadata('codeType', false, 2 /* Body */, 0 /* String */),
639
646
  generateParamConfigMetadata('computeType', true, 2 /* Body */, 0 /* String */),
@@ -645,11 +652,11 @@ const createCustomCodeDeployment_ConfigPropertyMetadata = [
645
652
  generateParamConfigMetadata('parameters', false, 2 /* Body */, 4 /* Unsupported */),
646
653
  generateParamConfigMetadata('version', true, 2 /* Body */, 0 /* String */),
647
654
  ];
648
- const createCustomCodeDeployment_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, createCustomCodeDeployment_ConfigPropertyMetadata);
649
- const createResourceParams = /*#__PURE__*/ createResourceParams$1(createCustomCodeDeployment_ConfigPropertyMetadata);
650
- function typeCheckConfig(untrustedConfig) {
655
+ const createCustomCodeDeployment_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$4, createCustomCodeDeployment_ConfigPropertyMetadata);
656
+ const createResourceParams$4 = /*#__PURE__*/ createResourceParams$5(createCustomCodeDeployment_ConfigPropertyMetadata);
657
+ function typeCheckConfig$4(untrustedConfig) {
651
658
  const config = {};
652
- typeCheckConfig$1(untrustedConfig, config, createCustomCodeDeployment_ConfigPropertyMetadata);
659
+ typeCheckConfig$5(untrustedConfig, config, createCustomCodeDeployment_ConfigPropertyMetadata);
653
660
  const untrustedConfig_parameters = untrustedConfig.parameters;
654
661
  if (untrustedIsObject(untrustedConfig_parameters)) {
655
662
  const untrustedConfig_parameters_object = {};
@@ -669,6 +676,600 @@ function typeCheckConfig(untrustedConfig) {
669
676
  }
670
677
  return config;
671
678
  }
679
+ function validateAdapterConfig$4(untrustedConfig, configPropertyNames) {
680
+ if (!untrustedIsObject(untrustedConfig)) {
681
+ return null;
682
+ }
683
+ if (process.env.NODE_ENV !== 'production') {
684
+ validateConfig(untrustedConfig, configPropertyNames);
685
+ }
686
+ const config = typeCheckConfig$4(untrustedConfig);
687
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
688
+ return null;
689
+ }
690
+ return config;
691
+ }
692
+ function buildNetworkSnapshot$4(luvio, config, options) {
693
+ const resourceParams = createResourceParams$4(config);
694
+ const request = createResourceRequest$4(resourceParams);
695
+ return luvio.dispatchResourceRequest(request, options)
696
+ .then((response) => {
697
+ return luvio.handleSuccessResponse(() => {
698
+ const snapshot = ingestSuccess$3(luvio, resourceParams, response);
699
+ return luvio.storeBroadcast().then(() => snapshot);
700
+ }, () => {
701
+ const cache = new StoreKeyMap();
702
+ getResponseCacheKeys$4(cache, luvio, resourceParams, response.body);
703
+ return cache;
704
+ });
705
+ }, (response) => {
706
+ deepFreeze(response);
707
+ throw response;
708
+ });
709
+ }
710
+ const createCustomCodeDeploymentAdapterFactory = (luvio) => {
711
+ return function createCustomCodeDeployment(untrustedConfig) {
712
+ const config = validateAdapterConfig$4(untrustedConfig, createCustomCodeDeployment_ConfigPropertyNames);
713
+ // Invalid or incomplete config
714
+ if (config === null) {
715
+ throw new Error('Invalid config for "createCustomCodeDeployment"');
716
+ }
717
+ return buildNetworkSnapshot$4(luvio, config);
718
+ };
719
+ };
720
+
721
+ const VERSION = "3d9a814ca87df7e7c79c5d385c146820";
722
+ function validate(obj, path = 'CustomCodeDeploymentCollectionRepresentation') {
723
+ const v_error = (() => {
724
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
725
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
726
+ }
727
+ const obj_currentPageUrl = obj.currentPageUrl;
728
+ const path_currentPageUrl = path + '.currentPageUrl';
729
+ if (typeof obj_currentPageUrl !== 'string') {
730
+ return new TypeError('Expected "string" but received "' + typeof obj_currentPageUrl + '" (at "' + path_currentPageUrl + '")');
731
+ }
732
+ const obj_customCodeDeployments = obj.customCodeDeployments;
733
+ const path_customCodeDeployments = path + '.customCodeDeployments';
734
+ if (!ArrayIsArray(obj_customCodeDeployments)) {
735
+ return new TypeError('Expected "array" but received "' + typeof obj_customCodeDeployments + '" (at "' + path_customCodeDeployments + '")');
736
+ }
737
+ for (let i = 0; i < obj_customCodeDeployments.length; i++) {
738
+ const obj_customCodeDeployments_item = obj_customCodeDeployments[i];
739
+ const path_customCodeDeployments_item = path_customCodeDeployments + '[' + i + ']';
740
+ if (typeof obj_customCodeDeployments_item !== 'object') {
741
+ return new TypeError('Expected "object" but received "' + typeof obj_customCodeDeployments_item + '" (at "' + path_customCodeDeployments_item + '")');
742
+ }
743
+ }
744
+ if (obj.nextPageUrl !== undefined) {
745
+ const obj_nextPageUrl = obj.nextPageUrl;
746
+ const path_nextPageUrl = path + '.nextPageUrl';
747
+ if (typeof obj_nextPageUrl !== 'string') {
748
+ return new TypeError('Expected "string" but received "' + typeof obj_nextPageUrl + '" (at "' + path_nextPageUrl + '")');
749
+ }
750
+ }
751
+ const obj_totalSize = obj.totalSize;
752
+ const path_totalSize = path + '.totalSize';
753
+ if (typeof obj_totalSize !== 'number' || (typeof obj_totalSize === 'number' && Math.floor(obj_totalSize) !== obj_totalSize)) {
754
+ return new TypeError('Expected "integer" but received "' + typeof obj_totalSize + '" (at "' + path_totalSize + '")');
755
+ }
756
+ })();
757
+ return v_error === undefined ? null : v_error;
758
+ }
759
+ const RepresentationType = 'CustomCodeDeploymentCollectionRepresentation';
760
+ function normalize(input, existing, path, luvio, store, timestamp) {
761
+ const input_customCodeDeployments = input.customCodeDeployments;
762
+ const input_customCodeDeployments_id = path.fullPath + '__customCodeDeployments';
763
+ for (let i = 0; i < input_customCodeDeployments.length; i++) {
764
+ const input_customCodeDeployments_item = input_customCodeDeployments[i];
765
+ let input_customCodeDeployments_item_id = input_customCodeDeployments_id + '__' + i;
766
+ input_customCodeDeployments[i] = ingest$1(input_customCodeDeployments_item, {
767
+ fullPath: input_customCodeDeployments_item_id,
768
+ propertyName: i,
769
+ parent: {
770
+ data: input,
771
+ key: path.fullPath,
772
+ existing: existing,
773
+ },
774
+ ttl: path.ttl
775
+ }, luvio, store, timestamp);
776
+ }
777
+ return input;
778
+ }
779
+ const select$3 = function CustomCodeDeploymentCollectionRepresentationSelect() {
780
+ return {
781
+ kind: 'Fragment',
782
+ version: VERSION,
783
+ private: [],
784
+ selections: [
785
+ {
786
+ name: 'currentPageUrl',
787
+ kind: 'Scalar'
788
+ },
789
+ {
790
+ name: 'customCodeDeployments',
791
+ kind: 'Link',
792
+ plural: true,
793
+ fragment: select$5()
794
+ },
795
+ {
796
+ name: 'nextPageUrl',
797
+ kind: 'Scalar',
798
+ required: false
799
+ },
800
+ {
801
+ name: 'totalSize',
802
+ kind: 'Scalar'
803
+ }
804
+ ]
805
+ };
806
+ };
807
+ function equals(existing, incoming) {
808
+ const existing_totalSize = existing.totalSize;
809
+ const incoming_totalSize = incoming.totalSize;
810
+ if (!(existing_totalSize === incoming_totalSize)) {
811
+ return false;
812
+ }
813
+ const existing_currentPageUrl = existing.currentPageUrl;
814
+ const incoming_currentPageUrl = incoming.currentPageUrl;
815
+ if (!(existing_currentPageUrl === incoming_currentPageUrl)) {
816
+ return false;
817
+ }
818
+ const existing_nextPageUrl = existing.nextPageUrl;
819
+ const incoming_nextPageUrl = incoming.nextPageUrl;
820
+ // if at least one of these optionals is defined
821
+ if (existing_nextPageUrl !== undefined || incoming_nextPageUrl !== undefined) {
822
+ // if one of these is not defined we know the other is defined and therefore
823
+ // not equal
824
+ if (existing_nextPageUrl === undefined || incoming_nextPageUrl === undefined) {
825
+ return false;
826
+ }
827
+ if (!(existing_nextPageUrl === incoming_nextPageUrl)) {
828
+ return false;
829
+ }
830
+ }
831
+ const existing_customCodeDeployments = existing.customCodeDeployments;
832
+ const incoming_customCodeDeployments = incoming.customCodeDeployments;
833
+ const equals_customCodeDeployments_items = equalsArray(existing_customCodeDeployments, incoming_customCodeDeployments, (existing_customCodeDeployments_item, incoming_customCodeDeployments_item) => {
834
+ if (!(existing_customCodeDeployments_item.__ref === incoming_customCodeDeployments_item.__ref)) {
835
+ return false;
836
+ }
837
+ });
838
+ if (equals_customCodeDeployments_items === false) {
839
+ return false;
840
+ }
841
+ return true;
842
+ }
843
+ const ingest = function CustomCodeDeploymentCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
844
+ if (process.env.NODE_ENV !== 'production') {
845
+ const validateError = validate(input);
846
+ if (validateError !== null) {
847
+ throw validateError;
848
+ }
849
+ }
850
+ const key = path.fullPath;
851
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 60000;
852
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "byoc", VERSION, RepresentationType, equals);
853
+ return createLink(key);
854
+ };
855
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
856
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
857
+ const rootKey = fullPathFactory();
858
+ rootKeySet.set(rootKey, {
859
+ namespace: keyPrefix,
860
+ representationName: RepresentationType,
861
+ mergeable: false
862
+ });
863
+ const input_customCodeDeployments_length = input.customCodeDeployments.length;
864
+ for (let i = 0; i < input_customCodeDeployments_length; i++) {
865
+ getTypeCacheKeys$1(rootKeySet, luvio, input.customCodeDeployments[i]);
866
+ }
867
+ }
868
+
869
+ function select$2(luvio, params) {
870
+ return select$3();
871
+ }
872
+ function keyBuilder$4(luvio, params) {
873
+ return keyPrefix + '::CustomCodeDeploymentCollectionRepresentation:(' + 'limit:' + params.queryParams.limit + ',' + 'offset:' + params.queryParams.offset + ',' + 'orderBy:' + params.queryParams.orderBy + ')';
874
+ }
875
+ function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
876
+ getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$4(luvio, resourceParams));
877
+ }
878
+ function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
879
+ const { body } = response;
880
+ const key = keyBuilder$4(luvio, resourceParams);
881
+ luvio.storeIngest(key, ingest, body);
882
+ const snapshot = luvio.storeLookup({
883
+ recordId: key,
884
+ node: select$2(),
885
+ variables: {},
886
+ }, snapshotRefresh);
887
+ if (process.env.NODE_ENV !== 'production') {
888
+ if (snapshot.state !== 'Fulfilled') {
889
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
890
+ }
891
+ }
892
+ deepFreeze(snapshot.data);
893
+ return snapshot;
894
+ }
895
+ function ingestError$1(luvio, params, error, snapshotRefresh) {
896
+ const key = keyBuilder$4(luvio, params);
897
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
898
+ luvio.storeIngestError(key, errorSnapshot);
899
+ return errorSnapshot;
900
+ }
901
+ function createResourceRequest$3(config) {
902
+ const headers = {};
903
+ return {
904
+ baseUri: '/services/data/v63.0',
905
+ basePath: '/ssot/data-custom-code',
906
+ method: 'get',
907
+ body: null,
908
+ urlParams: {},
909
+ queryParams: config.queryParams,
910
+ headers,
911
+ priority: 'normal',
912
+ };
913
+ }
914
+
915
+ const adapterName$3 = 'getCustomCodeDeployments';
916
+ const getCustomCodeDeployments_ConfigPropertyMetadata = [
917
+ generateParamConfigMetadata('limit', false, 1 /* QueryParameter */, 3 /* Integer */),
918
+ generateParamConfigMetadata('offset', false, 1 /* QueryParameter */, 3 /* Integer */),
919
+ generateParamConfigMetadata('orderBy', false, 1 /* QueryParameter */, 0 /* String */),
920
+ ];
921
+ const getCustomCodeDeployments_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, getCustomCodeDeployments_ConfigPropertyMetadata);
922
+ const createResourceParams$3 = /*#__PURE__*/ createResourceParams$5(getCustomCodeDeployments_ConfigPropertyMetadata);
923
+ function keyBuilder$3(luvio, config) {
924
+ const resourceParams = createResourceParams$3(config);
925
+ return keyBuilder$4(luvio, resourceParams);
926
+ }
927
+ function typeCheckConfig$3(untrustedConfig) {
928
+ const config = {};
929
+ typeCheckConfig$5(untrustedConfig, config, getCustomCodeDeployments_ConfigPropertyMetadata);
930
+ return config;
931
+ }
932
+ function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
933
+ if (!untrustedIsObject(untrustedConfig)) {
934
+ return null;
935
+ }
936
+ if (process.env.NODE_ENV !== 'production') {
937
+ validateConfig(untrustedConfig, configPropertyNames);
938
+ }
939
+ const config = typeCheckConfig$3(untrustedConfig);
940
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
941
+ return null;
942
+ }
943
+ return config;
944
+ }
945
+ function adapterFragment$1(luvio, config) {
946
+ createResourceParams$3(config);
947
+ return select$2();
948
+ }
949
+ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
950
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
951
+ config,
952
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
953
+ });
954
+ return luvio.storeBroadcast().then(() => snapshot);
955
+ }
956
+ function onFetchResponseError$1(luvio, config, resourceParams, response) {
957
+ const snapshot = ingestError$1(luvio, resourceParams, response, {
958
+ config,
959
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
960
+ });
961
+ return luvio.storeBroadcast().then(() => snapshot);
962
+ }
963
+ function buildNetworkSnapshot$3(luvio, config, options) {
964
+ const resourceParams = createResourceParams$3(config);
965
+ const request = createResourceRequest$3(resourceParams);
966
+ return luvio.dispatchResourceRequest(request, options)
967
+ .then((response) => {
968
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
969
+ const cache = new StoreKeyMap();
970
+ getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
971
+ return cache;
972
+ });
973
+ }, (response) => {
974
+ return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
975
+ });
976
+ }
977
+ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
978
+ return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$3, undefined, false);
979
+ }
980
+ function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
981
+ const { luvio, config } = context;
982
+ const selector = {
983
+ recordId: keyBuilder$3(luvio, config),
984
+ node: adapterFragment$1(luvio, config),
985
+ variables: {},
986
+ };
987
+ const cacheSnapshot = storeLookup(selector, {
988
+ config,
989
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
990
+ });
991
+ return cacheSnapshot;
992
+ }
993
+ const getCustomCodeDeploymentsAdapterFactory = (luvio) => function byoc__getCustomCodeDeployments(untrustedConfig, requestContext) {
994
+ const config = validateAdapterConfig$3(untrustedConfig, getCustomCodeDeployments_ConfigPropertyNames);
995
+ // Invalid or incomplete config
996
+ if (config === null) {
997
+ return null;
998
+ }
999
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
1000
+ buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
1001
+ };
1002
+
1003
+ function keyBuilder$2(luvio, params) {
1004
+ return keyBuilder$5(luvio, {
1005
+ id: params.urlParams.customCodeNameOrId
1006
+ });
1007
+ }
1008
+ function getResponseCacheKeys$2(cacheKeyMap, luvio, resourceParams) {
1009
+ const key = keyBuilder$2(luvio, resourceParams);
1010
+ cacheKeyMap.set(key, {
1011
+ namespace: keyPrefix,
1012
+ representationName: RepresentationType$1,
1013
+ mergeable: false
1014
+ });
1015
+ }
1016
+ function evictSuccess(luvio, resourceParams) {
1017
+ const key = keyBuilder$2(luvio, resourceParams);
1018
+ luvio.storeEvict(key);
1019
+ }
1020
+ function createResourceRequest$2(config) {
1021
+ const headers = {};
1022
+ return {
1023
+ baseUri: '/services/data/v63.0',
1024
+ basePath: '/ssot/data-custom-code/' + config.urlParams.customCodeNameOrId + '',
1025
+ method: 'delete',
1026
+ body: null,
1027
+ urlParams: config.urlParams,
1028
+ queryParams: {},
1029
+ headers,
1030
+ priority: 'normal',
1031
+ };
1032
+ }
1033
+
1034
+ const adapterName$2 = 'deleteCustomCodeDeployment';
1035
+ const deleteCustomCodeDeployment_ConfigPropertyMetadata = [
1036
+ generateParamConfigMetadata('customCodeNameOrId', true, 0 /* UrlParameter */, 0 /* String */),
1037
+ ];
1038
+ const deleteCustomCodeDeployment_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, deleteCustomCodeDeployment_ConfigPropertyMetadata);
1039
+ const createResourceParams$2 = /*#__PURE__*/ createResourceParams$5(deleteCustomCodeDeployment_ConfigPropertyMetadata);
1040
+ function typeCheckConfig$2(untrustedConfig) {
1041
+ const config = {};
1042
+ typeCheckConfig$5(untrustedConfig, config, deleteCustomCodeDeployment_ConfigPropertyMetadata);
1043
+ return config;
1044
+ }
1045
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
1046
+ if (!untrustedIsObject(untrustedConfig)) {
1047
+ return null;
1048
+ }
1049
+ if (process.env.NODE_ENV !== 'production') {
1050
+ validateConfig(untrustedConfig, configPropertyNames);
1051
+ }
1052
+ const config = typeCheckConfig$2(untrustedConfig);
1053
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1054
+ return null;
1055
+ }
1056
+ return config;
1057
+ }
1058
+ function buildNetworkSnapshot$2(luvio, config, options) {
1059
+ const resourceParams = createResourceParams$2(config);
1060
+ const request = createResourceRequest$2(resourceParams);
1061
+ return luvio.dispatchResourceRequest(request, options)
1062
+ .then(() => {
1063
+ return luvio.handleSuccessResponse(() => {
1064
+ evictSuccess(luvio, resourceParams);
1065
+ return luvio.storeBroadcast();
1066
+ }, () => {
1067
+ const cache = new StoreKeyMap();
1068
+ getResponseCacheKeys$2(cache, luvio, resourceParams);
1069
+ return cache;
1070
+ });
1071
+ }, (response) => {
1072
+ deepFreeze(response);
1073
+ throw response;
1074
+ });
1075
+ }
1076
+ const deleteCustomCodeDeploymentAdapterFactory = (luvio) => {
1077
+ return function byocdeleteCustomCodeDeployment(untrustedConfig) {
1078
+ const config = validateAdapterConfig$2(untrustedConfig, deleteCustomCodeDeployment_ConfigPropertyNames);
1079
+ // Invalid or incomplete config
1080
+ if (config === null) {
1081
+ throw new Error(`Invalid config for "${adapterName$2}"`);
1082
+ }
1083
+ return buildNetworkSnapshot$2(luvio, config);
1084
+ };
1085
+ };
1086
+
1087
+ function select$1(luvio, params) {
1088
+ return select$5();
1089
+ }
1090
+ function keyBuilder$1(luvio, params) {
1091
+ return keyBuilder$5(luvio, {
1092
+ id: params.urlParams.customCodeNameOrId
1093
+ });
1094
+ }
1095
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
1096
+ getTypeCacheKeys$1(storeKeyMap, luvio, response);
1097
+ }
1098
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
1099
+ const { body } = response;
1100
+ const key = keyBuilder$1(luvio, resourceParams);
1101
+ luvio.storeIngest(key, ingest$1, body);
1102
+ const snapshot = luvio.storeLookup({
1103
+ recordId: key,
1104
+ node: select$1(),
1105
+ variables: {},
1106
+ }, snapshotRefresh);
1107
+ if (process.env.NODE_ENV !== 'production') {
1108
+ if (snapshot.state !== 'Fulfilled') {
1109
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1110
+ }
1111
+ }
1112
+ deepFreeze(snapshot.data);
1113
+ return snapshot;
1114
+ }
1115
+ function ingestError(luvio, params, error, snapshotRefresh) {
1116
+ const key = keyBuilder$1(luvio, params);
1117
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1118
+ luvio.storeIngestError(key, errorSnapshot);
1119
+ return errorSnapshot;
1120
+ }
1121
+ function createResourceRequest$1(config) {
1122
+ const headers = {};
1123
+ return {
1124
+ baseUri: '/services/data/v63.0',
1125
+ basePath: '/ssot/data-custom-code/' + config.urlParams.customCodeNameOrId + '',
1126
+ method: 'get',
1127
+ body: null,
1128
+ urlParams: config.urlParams,
1129
+ queryParams: {},
1130
+ headers,
1131
+ priority: 'normal',
1132
+ };
1133
+ }
1134
+
1135
+ const adapterName$1 = 'getCustomCodeDeployment';
1136
+ const getCustomCodeDeployment_ConfigPropertyMetadata = [
1137
+ generateParamConfigMetadata('customCodeNameOrId', true, 0 /* UrlParameter */, 0 /* String */),
1138
+ ];
1139
+ const getCustomCodeDeployment_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getCustomCodeDeployment_ConfigPropertyMetadata);
1140
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$5(getCustomCodeDeployment_ConfigPropertyMetadata);
1141
+ function keyBuilder(luvio, config) {
1142
+ const resourceParams = createResourceParams$1(config);
1143
+ return keyBuilder$1(luvio, resourceParams);
1144
+ }
1145
+ function typeCheckConfig$1(untrustedConfig) {
1146
+ const config = {};
1147
+ typeCheckConfig$5(untrustedConfig, config, getCustomCodeDeployment_ConfigPropertyMetadata);
1148
+ return config;
1149
+ }
1150
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
1151
+ if (!untrustedIsObject(untrustedConfig)) {
1152
+ return null;
1153
+ }
1154
+ if (process.env.NODE_ENV !== 'production') {
1155
+ validateConfig(untrustedConfig, configPropertyNames);
1156
+ }
1157
+ const config = typeCheckConfig$1(untrustedConfig);
1158
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1159
+ return null;
1160
+ }
1161
+ return config;
1162
+ }
1163
+ function adapterFragment(luvio, config) {
1164
+ createResourceParams$1(config);
1165
+ return select$1();
1166
+ }
1167
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
1168
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
1169
+ config,
1170
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1171
+ });
1172
+ return luvio.storeBroadcast().then(() => snapshot);
1173
+ }
1174
+ function onFetchResponseError(luvio, config, resourceParams, response) {
1175
+ const snapshot = ingestError(luvio, resourceParams, response, {
1176
+ config,
1177
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1178
+ });
1179
+ return luvio.storeBroadcast().then(() => snapshot);
1180
+ }
1181
+ function buildNetworkSnapshot$1(luvio, config, options) {
1182
+ const resourceParams = createResourceParams$1(config);
1183
+ const request = createResourceRequest$1(resourceParams);
1184
+ return luvio.dispatchResourceRequest(request, options)
1185
+ .then((response) => {
1186
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
1187
+ const cache = new StoreKeyMap();
1188
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
1189
+ return cache;
1190
+ });
1191
+ }, (response) => {
1192
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
1193
+ });
1194
+ }
1195
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
1196
+ return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
1197
+ }
1198
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
1199
+ const { luvio, config } = context;
1200
+ const selector = {
1201
+ recordId: keyBuilder(luvio, config),
1202
+ node: adapterFragment(luvio, config),
1203
+ variables: {},
1204
+ };
1205
+ const cacheSnapshot = storeLookup(selector, {
1206
+ config,
1207
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1208
+ });
1209
+ return cacheSnapshot;
1210
+ }
1211
+ const getCustomCodeDeploymentAdapterFactory = (luvio) => function byoc__getCustomCodeDeployment(untrustedConfig, requestContext) {
1212
+ const config = validateAdapterConfig$1(untrustedConfig, getCustomCodeDeployment_ConfigPropertyNames);
1213
+ // Invalid or incomplete config
1214
+ if (config === null) {
1215
+ return null;
1216
+ }
1217
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
1218
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
1219
+ };
1220
+
1221
+ function select(luvio, params) {
1222
+ return select$5();
1223
+ }
1224
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
1225
+ getTypeCacheKeys$1(storeKeyMap, luvio, response);
1226
+ }
1227
+ function ingestSuccess(luvio, resourceParams, response) {
1228
+ const { body } = response;
1229
+ const key = keyBuilderFromType(luvio, body);
1230
+ luvio.storeIngest(key, ingest$1, body);
1231
+ const snapshot = luvio.storeLookup({
1232
+ recordId: key,
1233
+ node: select(),
1234
+ variables: {},
1235
+ });
1236
+ if (process.env.NODE_ENV !== 'production') {
1237
+ if (snapshot.state !== 'Fulfilled') {
1238
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1239
+ }
1240
+ }
1241
+ deepFreeze(snapshot.data);
1242
+ return snapshot;
1243
+ }
1244
+ function createResourceRequest(config) {
1245
+ const headers = {};
1246
+ return {
1247
+ baseUri: '/services/data/v63.0',
1248
+ basePath: '/ssot/data-custom-code/' + config.urlParams.customCodeNameOrId + '',
1249
+ method: 'patch',
1250
+ body: config.body,
1251
+ urlParams: config.urlParams,
1252
+ queryParams: {},
1253
+ headers,
1254
+ priority: 'normal',
1255
+ };
1256
+ }
1257
+
1258
+ const adapterName = 'updateCustomCodeDeployment';
1259
+ const updateCustomCodeDeployment_ConfigPropertyMetadata = [
1260
+ generateParamConfigMetadata('customCodeNameOrId', true, 0 /* UrlParameter */, 0 /* String */),
1261
+ generateParamConfigMetadata('computeType', false, 2 /* Body */, 0 /* String */),
1262
+ generateParamConfigMetadata('description', false, 2 /* Body */, 0 /* String */),
1263
+ generateParamConfigMetadata('label', false, 2 /* Body */, 0 /* String */),
1264
+ generateParamConfigMetadata('version', false, 2 /* Body */, 0 /* String */),
1265
+ ];
1266
+ const updateCustomCodeDeployment_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, updateCustomCodeDeployment_ConfigPropertyMetadata);
1267
+ const createResourceParams = /*#__PURE__*/ createResourceParams$5(updateCustomCodeDeployment_ConfigPropertyMetadata);
1268
+ function typeCheckConfig(untrustedConfig) {
1269
+ const config = {};
1270
+ typeCheckConfig$5(untrustedConfig, config, updateCustomCodeDeployment_ConfigPropertyMetadata);
1271
+ return config;
1272
+ }
672
1273
  function validateAdapterConfig(untrustedConfig, configPropertyNames) {
673
1274
  if (!untrustedIsObject(untrustedConfig)) {
674
1275
  return null;
@@ -700,15 +1301,15 @@ function buildNetworkSnapshot(luvio, config, options) {
700
1301
  throw response;
701
1302
  });
702
1303
  }
703
- const createCustomCodeDeploymentAdapterFactory = (luvio) => {
704
- return function createCustomCodeDeployment(untrustedConfig) {
705
- const config = validateAdapterConfig(untrustedConfig, createCustomCodeDeployment_ConfigPropertyNames);
1304
+ const updateCustomCodeDeploymentAdapterFactory = (luvio) => {
1305
+ return function updateCustomCodeDeployment(untrustedConfig) {
1306
+ const config = validateAdapterConfig(untrustedConfig, updateCustomCodeDeployment_ConfigPropertyNames);
706
1307
  // Invalid or incomplete config
707
1308
  if (config === null) {
708
- throw new Error('Invalid config for "createCustomCodeDeployment"');
1309
+ throw new Error('Invalid config for "updateCustomCodeDeployment"');
709
1310
  }
710
1311
  return buildNetworkSnapshot(luvio, config);
711
1312
  };
712
1313
  };
713
1314
 
714
- export { createCustomCodeDeploymentAdapterFactory };
1315
+ export { createCustomCodeDeploymentAdapterFactory, deleteCustomCodeDeploymentAdapterFactory, getCustomCodeDeploymentAdapterFactory, getCustomCodeDeploymentsAdapterFactory, updateCustomCodeDeploymentAdapterFactory };