@salesforce/lds-adapters-commerce-store-pricing 1.134.7 → 1.134.9

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,10 +4,10 @@
4
4
  * For full license text, see the LICENSE.txt file
5
5
  */
6
6
 
7
- import { serializeStructuredKey, StoreKeyMap } from '@luvio/engine';
7
+ import { serializeStructuredKey, StoreKeyMap, deepFreeze } from '@luvio/engine';
8
8
 
9
9
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
- const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = Object;
10
+ const { keys: ObjectKeys, create: ObjectCreate } = Object;
11
11
  const { isArray: ArrayIsArray$1 } = Array;
12
12
  /**
13
13
  * Validates an adapter config is well-formed.
@@ -31,7 +31,7 @@ function validateConfig(config, adapter, oneOf) {
31
31
  throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
32
32
  }
33
33
  const supported = required.concat(optional);
34
- if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
34
+ if (ObjectKeys(config).some(key => !supported.includes(key))) {
35
35
  throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
36
36
  }
37
37
  }
@@ -50,7 +50,6 @@ const snapshotRefreshOptions = {
50
50
  };
51
51
  const keyPrefix = 'Commerce';
52
52
 
53
- const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
54
53
  const { isArray: ArrayIsArray } = Array;
55
54
  const { stringify: JSONStringify } = JSON;
56
55
  function createLink(ref) {
@@ -97,9 +96,6 @@ function validate$2(obj, path = 'PriceAdjustmentTierRepresentation') {
97
96
  })();
98
97
  return v_error === undefined ? null : v_error;
99
98
  }
100
- function deepFreeze$2(input) {
101
- ObjectFreeze(input);
102
- }
103
99
 
104
100
  function validate$1(obj, path = 'PriceAdjustmentScheduleRepresentation') {
105
101
  const v_error = (() => {
@@ -129,15 +125,6 @@ function validate$1(obj, path = 'PriceAdjustmentScheduleRepresentation') {
129
125
  })();
130
126
  return v_error === undefined ? null : v_error;
131
127
  }
132
- function deepFreeze$1(input) {
133
- const input_priceAdjustmentTiers = input.priceAdjustmentTiers;
134
- for (let i = 0; i < input_priceAdjustmentTiers.length; i++) {
135
- const input_priceAdjustmentTiers_item = input_priceAdjustmentTiers[i];
136
- deepFreeze$2(input_priceAdjustmentTiers_item);
137
- }
138
- ObjectFreeze(input_priceAdjustmentTiers);
139
- ObjectFreeze(input);
140
- }
141
128
 
142
129
  const VERSION = "3e2882f4e8e38efd02e1a14114269e4c";
143
130
  function validate(obj, path = 'ProductPriceRepresentation') {
@@ -215,13 +202,6 @@ function equals(existing, incoming) {
215
202
  }
216
203
  return true;
217
204
  }
218
- function deepFreeze(input) {
219
- const input_priceAdjustment = input.priceAdjustment;
220
- if (input_priceAdjustment !== null && typeof input_priceAdjustment === 'object') {
221
- deepFreeze$1(input_priceAdjustment);
222
- }
223
- ObjectFreeze(input);
224
- }
225
205
  const ingest = function ProductPriceRepresentationIngest(input, path, luvio, store, timestamp) {
226
206
  if (process.env.NODE_ENV !== 'production') {
227
207
  const validateError = validate(input);
@@ -238,7 +218,6 @@ const ingest = function ProductPriceRepresentationIngest(input, path, luvio, sto
238
218
  propertyName: path.propertyName,
239
219
  ttl: ttlToUse
240
220
  });
241
- deepFreeze(input);
242
221
  if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
243
222
  luvio.storePublish(key, incomingRecord);
244
223
  }
@@ -288,6 +267,7 @@ function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
288
267
  throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
289
268
  }
290
269
  }
270
+ deepFreeze(snapshot.data);
291
271
  return snapshot;
292
272
  }
293
273
  function ingestError(luvio, params, error, snapshotRefresh) {
@@ -3,17 +3,11 @@ export declare const ObjectPrototypeHasOwnProperty: (v: PropertyKey) => boolean;
3
3
  declare const ObjectKeys: {
4
4
  (o: object): string[];
5
5
  (o: {}): string[];
6
- }, ObjectFreeze: {
7
- <T extends Function>(f: T): T;
8
- <T_1 extends {
9
- [idx: string]: object | U | null | undefined;
10
- }, U extends string | number | bigint | boolean | symbol>(o: T_1): Readonly<T_1>;
11
- <T_2>(o: T_2): Readonly<T_2>;
12
6
  }, ObjectCreate: {
13
7
  (o: object | null): any;
14
8
  (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any;
15
9
  };
16
- export { ObjectFreeze, ObjectCreate, ObjectKeys };
10
+ export { ObjectCreate, ObjectKeys };
17
11
  export declare const ArrayIsArray: (arg: any) => arg is any[];
18
12
  export declare const ArrayPrototypePush: (...items: any[]) => number;
19
13
  export interface AdapterValidationConfig {
@@ -6,7 +6,6 @@ export declare const RepresentationType: string;
6
6
  export declare function normalize(input: PriceAdjustmentScheduleRepresentation, existing: PriceAdjustmentScheduleRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): PriceAdjustmentScheduleRepresentationNormalized;
7
7
  export declare const select: () => $64$luvio_engine_FragmentSelection;
8
8
  export declare function equals(existing: PriceAdjustmentScheduleRepresentationNormalized, incoming: PriceAdjustmentScheduleRepresentationNormalized): boolean;
9
- export declare function deepFreeze(input: PriceAdjustmentScheduleRepresentation): void;
10
9
  export declare const ingest: $64$luvio_engine_ResourceIngest;
11
10
  export declare function getTypeCacheKeys(luvio: $64$luvio_engine_Luvio, input: PriceAdjustmentScheduleRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): $64$luvio_engine_DurableStoreKeyMetadataMap;
12
11
  /**
@@ -5,7 +5,6 @@ export declare const RepresentationType: string;
5
5
  export declare function normalize(input: PriceAdjustmentTierRepresentation, existing: PriceAdjustmentTierRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): PriceAdjustmentTierRepresentationNormalized;
6
6
  export declare const select: () => $64$luvio_engine_FragmentSelection;
7
7
  export declare function equals(existing: PriceAdjustmentTierRepresentationNormalized, incoming: PriceAdjustmentTierRepresentationNormalized): boolean;
8
- export declare function deepFreeze(input: PriceAdjustmentTierRepresentation): void;
9
8
  export declare const ingest: $64$luvio_engine_ResourceIngest;
10
9
  export declare function getTypeCacheKeys(luvio: $64$luvio_engine_Luvio, input: PriceAdjustmentTierRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): $64$luvio_engine_DurableStoreKeyMetadataMap;
11
10
  /**
@@ -5,7 +5,6 @@ export declare const RepresentationType: string;
5
5
  export declare function normalize(input: PricingInputRepresentation, existing: PricingInputRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): PricingInputRepresentationNormalized;
6
6
  export declare const select: () => $64$luvio_engine_FragmentSelection;
7
7
  export declare function equals(existing: PricingInputRepresentationNormalized, incoming: PricingInputRepresentationNormalized): boolean;
8
- export declare function deepFreeze(input: PricingInputRepresentation): void;
9
8
  export declare const ingest: $64$luvio_engine_ResourceIngest;
10
9
  export declare function getTypeCacheKeys(luvio: $64$luvio_engine_Luvio, input: PricingInputRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): $64$luvio_engine_DurableStoreKeyMetadataMap;
11
10
  /**
@@ -5,7 +5,6 @@ export declare const RepresentationType: string;
5
5
  export declare function normalize(input: PricingLineItemInputRepresentation, existing: PricingLineItemInputRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): PricingLineItemInputRepresentationNormalized;
6
6
  export declare const select: () => $64$luvio_engine_FragmentSelection;
7
7
  export declare function equals(existing: PricingLineItemInputRepresentationNormalized, incoming: PricingLineItemInputRepresentationNormalized): boolean;
8
- export declare function deepFreeze(input: PricingLineItemInputRepresentation): void;
9
8
  export declare const ingest: $64$luvio_engine_ResourceIngest;
10
9
  export declare function getTypeCacheKeys(luvio: $64$luvio_engine_Luvio, input: PricingLineItemInputRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): $64$luvio_engine_DurableStoreKeyMetadataMap;
11
10
  /**
@@ -5,7 +5,6 @@ export declare const RepresentationType: string;
5
5
  export declare function normalize(input: PricingLineItemInputRepresentationList, existing: PricingLineItemInputRepresentationListNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): PricingLineItemInputRepresentationListNormalized;
6
6
  export declare const select: () => $64$luvio_engine_FragmentSelection;
7
7
  export declare function equals(existing: PricingLineItemInputRepresentationListNormalized, incoming: PricingLineItemInputRepresentationListNormalized): boolean;
8
- export declare function deepFreeze(input: PricingLineItemInputRepresentationList): void;
9
8
  export declare const ingest: $64$luvio_engine_ResourceIngest;
10
9
  export declare function getTypeCacheKeys(luvio: $64$luvio_engine_Luvio, input: PricingLineItemInputRepresentationList, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): $64$luvio_engine_DurableStoreKeyMetadataMap;
11
10
  /**
@@ -5,7 +5,6 @@ export declare const RepresentationType: string;
5
5
  export declare function normalize(input: PricingResultLineItemRepresentation, existing: PricingResultLineItemRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): PricingResultLineItemRepresentationNormalized;
6
6
  export declare const select: () => $64$luvio_engine_FragmentSelection;
7
7
  export declare function equals(existing: PricingResultLineItemRepresentationNormalized, incoming: PricingResultLineItemRepresentationNormalized): boolean;
8
- export declare function deepFreeze(input: PricingResultLineItemRepresentation): void;
9
8
  export declare const ingest: $64$luvio_engine_ResourceIngest;
10
9
  export declare function getTypeCacheKeys(luvio: $64$luvio_engine_Luvio, input: PricingResultLineItemRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): $64$luvio_engine_DurableStoreKeyMetadataMap;
11
10
  /**
@@ -6,7 +6,6 @@ export declare const RepresentationType: string;
6
6
  export declare function normalize(input: PricingResultRepresentation, existing: PricingResultRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): PricingResultRepresentationNormalized;
7
7
  export declare const select: () => $64$luvio_engine_FragmentSelection;
8
8
  export declare function equals(existing: PricingResultRepresentationNormalized, incoming: PricingResultRepresentationNormalized): boolean;
9
- export declare function deepFreeze(input: PricingResultRepresentation): void;
10
9
  export declare const ingest: $64$luvio_engine_ResourceIngest;
11
10
  export declare function getTypeCacheKeys(luvio: $64$luvio_engine_Luvio, input: PricingResultRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): $64$luvio_engine_DurableStoreKeyMetadataMap;
12
11
  /**
@@ -6,7 +6,6 @@ export declare const RepresentationType: string;
6
6
  export declare function normalize(input: ProductPriceRepresentation, existing: ProductPriceRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): ProductPriceRepresentationNormalized;
7
7
  export declare const select: () => $64$luvio_engine_BaseFragment;
8
8
  export declare function equals(existing: ProductPriceRepresentationNormalized, incoming: ProductPriceRepresentationNormalized): boolean;
9
- export declare function deepFreeze(input: ProductPriceRepresentation): void;
10
9
  export declare const ingest: $64$luvio_engine_ResourceIngest;
11
10
  export declare function getTypeCacheKeys(luvio: $64$luvio_engine_Luvio, input: ProductPriceRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): $64$luvio_engine_DurableStoreKeyMetadataMap;
12
11
  /**
@@ -1,11 +1,5 @@
1
1
  import { NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata } from '@luvio/engine';
2
- export declare const ObjectFreeze: {
3
- <T extends Function>(f: T): T;
4
- <T_1 extends {
5
- [idx: string]: object | U | null | undefined;
6
- }, U extends string | number | bigint | boolean | symbol>(o: T_1): Readonly<T_1>;
7
- <T_2>(o: T_2): Readonly<T_2>;
8
- }, ObjectKeys: {
2
+ export declare const ObjectKeys: {
9
3
  (o: object): string[];
10
4
  (o: {}): string[];
11
5
  }, ObjectCreate: {
@@ -31,7 +25,6 @@ export declare function equalsArray<U, V extends U[]>(a: V, b: V, equalsItem: (i
31
25
  export declare function equalsObject<U, V extends {
32
26
  [key: string]: U;
33
27
  }>(a: V, b: V, equalsProp: (propA: U, propB: U) => boolean | void): boolean;
34
- export declare function deepFreeze(value: any): void;
35
28
  export declare function createLink(ref: string | $64$luvio_engine_NormalizedKeyMetadata): {
36
29
  __ref: string;
37
30
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-adapters-commerce-store-pricing",
3
- "version": "1.134.7",
3
+ "version": "1.134.9",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "Wire adapters Commerce Store Pricing",
6
6
  "main": "dist/es/es2018/commerce-store-pricing.js",
package/sfdc/index.js CHANGED
@@ -14,10 +14,10 @@
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, StoreKeyMap } from 'force/luvioEngine';
17
+ import { serializeStructuredKey, StoreKeyMap, deepFreeze } from 'force/luvioEngine';
18
18
 
19
19
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
20
- const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = Object;
20
+ const { keys: ObjectKeys, create: ObjectCreate } = Object;
21
21
  const { isArray: ArrayIsArray$1 } = Array;
22
22
  /**
23
23
  * Validates an adapter config is well-formed.
@@ -41,7 +41,7 @@ function validateConfig(config, adapter, oneOf) {
41
41
  throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
42
42
  }
43
43
  const supported = required.concat(optional);
44
- if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
44
+ if (ObjectKeys(config).some(key => !supported.includes(key))) {
45
45
  throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
46
46
  }
47
47
  }
@@ -60,7 +60,6 @@ const snapshotRefreshOptions = {
60
60
  };
61
61
  const keyPrefix = 'Commerce';
62
62
 
63
- const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
64
63
  const { isArray: ArrayIsArray } = Array;
65
64
  const { stringify: JSONStringify } = JSON;
66
65
  function createLink(ref) {
@@ -107,9 +106,6 @@ function validate$2(obj, path = 'PriceAdjustmentTierRepresentation') {
107
106
  })();
108
107
  return v_error === undefined ? null : v_error;
109
108
  }
110
- function deepFreeze$2(input) {
111
- ObjectFreeze(input);
112
- }
113
109
 
114
110
  function validate$1(obj, path = 'PriceAdjustmentScheduleRepresentation') {
115
111
  const v_error = (() => {
@@ -139,15 +135,6 @@ function validate$1(obj, path = 'PriceAdjustmentScheduleRepresentation') {
139
135
  })();
140
136
  return v_error === undefined ? null : v_error;
141
137
  }
142
- function deepFreeze$1(input) {
143
- const input_priceAdjustmentTiers = input.priceAdjustmentTiers;
144
- for (let i = 0; i < input_priceAdjustmentTiers.length; i++) {
145
- const input_priceAdjustmentTiers_item = input_priceAdjustmentTiers[i];
146
- deepFreeze$2(input_priceAdjustmentTiers_item);
147
- }
148
- ObjectFreeze(input_priceAdjustmentTiers);
149
- ObjectFreeze(input);
150
- }
151
138
 
152
139
  const VERSION = "3e2882f4e8e38efd02e1a14114269e4c";
153
140
  function validate(obj, path = 'ProductPriceRepresentation') {
@@ -225,13 +212,6 @@ function equals(existing, incoming) {
225
212
  }
226
213
  return true;
227
214
  }
228
- function deepFreeze(input) {
229
- const input_priceAdjustment = input.priceAdjustment;
230
- if (input_priceAdjustment !== null && typeof input_priceAdjustment === 'object') {
231
- deepFreeze$1(input_priceAdjustment);
232
- }
233
- ObjectFreeze(input);
234
- }
235
215
  const ingest = function ProductPriceRepresentationIngest(input, path, luvio, store, timestamp) {
236
216
  if (process.env.NODE_ENV !== 'production') {
237
217
  const validateError = validate(input);
@@ -248,7 +228,6 @@ const ingest = function ProductPriceRepresentationIngest(input, path, luvio, sto
248
228
  propertyName: path.propertyName,
249
229
  ttl: ttlToUse
250
230
  });
251
- deepFreeze(input);
252
231
  if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
253
232
  luvio.storePublish(key, incomingRecord);
254
233
  }
@@ -298,6 +277,7 @@ function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
298
277
  throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
299
278
  }
300
279
  }
280
+ deepFreeze(snapshot.data);
301
281
  return snapshot;
302
282
  }
303
283
  function ingestError(luvio, params, error, snapshotRefresh) {
@@ -461,4 +441,4 @@ withDefaultLuvio((luvio) => {
461
441
  });
462
442
 
463
443
  export { getProductPrice, getProductPrice_imperative };
464
- // version: 1.134.7-ed0df45ef
444
+ // version: 1.134.9-fd822024c