@salesforce/lds-adapters-commerce-store-pricing 1.124.2 → 1.124.3

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.
Files changed (21) hide show
  1. package/dist/es/es2018/commerce-store-pricing.js +409 -409
  2. package/dist/{types → es/es2018/types}/src/generated/adapters/adapter-utils.d.ts +66 -66
  3. package/dist/{types → es/es2018/types}/src/generated/adapters/getProductPrice.d.ts +28 -28
  4. package/dist/{types → es/es2018/types}/src/generated/artifacts/main.d.ts +1 -1
  5. package/dist/{types → es/es2018/types}/src/generated/artifacts/sfdc.d.ts +3 -3
  6. package/dist/{types → es/es2018/types}/src/generated/resources/getCommerceWebstoresPricingProductsByProductIdAndWebstoreId.d.ts +19 -19
  7. package/dist/{types → es/es2018/types}/src/generated/resources/postCommerceWebstoresPricingProductsByWebstoreId.d.ts +18 -18
  8. package/dist/{types → es/es2018/types}/src/generated/types/PriceAdjustmentScheduleRepresentation.d.ts +33 -33
  9. package/dist/{types → es/es2018/types}/src/generated/types/PriceAdjustmentTierRepresentation.d.ts +44 -44
  10. package/dist/{types → es/es2018/types}/src/generated/types/PricingInputRepresentation.d.ts +29 -29
  11. package/dist/{types → es/es2018/types}/src/generated/types/PricingLineItemInputRepresentation.d.ts +29 -29
  12. package/dist/{types → es/es2018/types}/src/generated/types/PricingLineItemInputRepresentationList.d.ts +29 -29
  13. package/dist/{types → es/es2018/types}/src/generated/types/PricingResultLineItemRepresentation.d.ts +41 -41
  14. package/dist/{types → es/es2018/types}/src/generated/types/PricingResultRepresentation.d.ts +36 -36
  15. package/dist/{types → es/es2018/types}/src/generated/types/ProductPriceRepresentation.d.ts +42 -42
  16. package/dist/{types → es/es2018/types}/src/generated/types/type-utils.d.ts +39 -39
  17. package/package.json +3 -3
  18. package/sfdc/index.d.ts +1 -1
  19. package/sfdc/index.js +429 -429
  20. package/dist/umd/es2018/commerce-store-pricing.js +0 -440
  21. package/dist/umd/es5/commerce-store-pricing.js +0 -443
package/sfdc/index.js CHANGED
@@ -16,449 +16,449 @@ import { createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstruct
16
16
  import { withDefaultLuvio } from 'force/ldsEngine';
17
17
  import { serializeStructuredKey, StoreKeyMap } from 'force/luvioEngine';
18
18
 
19
- const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
20
- const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = Object;
21
- const { isArray: ArrayIsArray$1 } = Array;
22
- /**
23
- * Validates an adapter config is well-formed.
24
- * @param config The config to validate.
25
- * @param adapter The adapter validation configuration.
26
- * @param oneOf The keys the config must contain at least one of.
27
- * @throws A TypeError if config doesn't satisfy the adapter's config validation.
28
- */
29
- function validateConfig(config, adapter, oneOf) {
30
- const { displayName } = adapter;
31
- const { required, optional, unsupported } = adapter.parameters;
32
- if (config === undefined ||
33
- required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
34
- throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
35
- }
36
- if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
37
- throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
38
- }
39
- if (unsupported !== undefined &&
40
- unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
41
- throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
42
- }
43
- const supported = required.concat(optional);
44
- if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
45
- throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
46
- }
47
- }
48
- function untrustedIsObject(untrusted) {
49
- return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
50
- }
51
- function areRequiredParametersPresent(config, configPropertyNames) {
52
- return configPropertyNames.parameters.required.every(req => req in config);
53
- }
54
- const snapshotRefreshOptions = {
55
- overrides: {
56
- headers: {
57
- 'Cache-Control': 'no-cache',
58
- },
59
- }
60
- };
19
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
20
+ const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = Object;
21
+ const { isArray: ArrayIsArray$1 } = Array;
22
+ /**
23
+ * Validates an adapter config is well-formed.
24
+ * @param config The config to validate.
25
+ * @param adapter The adapter validation configuration.
26
+ * @param oneOf The keys the config must contain at least one of.
27
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
28
+ */
29
+ function validateConfig(config, adapter, oneOf) {
30
+ const { displayName } = adapter;
31
+ const { required, optional, unsupported } = adapter.parameters;
32
+ if (config === undefined ||
33
+ required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
34
+ throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
35
+ }
36
+ if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
37
+ throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
38
+ }
39
+ if (unsupported !== undefined &&
40
+ unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
41
+ throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
42
+ }
43
+ const supported = required.concat(optional);
44
+ if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
45
+ throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
46
+ }
47
+ }
48
+ function untrustedIsObject(untrusted) {
49
+ return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
50
+ }
51
+ function areRequiredParametersPresent(config, configPropertyNames) {
52
+ return configPropertyNames.parameters.required.every(req => req in config);
53
+ }
54
+ const snapshotRefreshOptions = {
55
+ overrides: {
56
+ headers: {
57
+ 'Cache-Control': 'no-cache',
58
+ },
59
+ }
60
+ };
61
61
  const keyPrefix = 'Commerce';
62
62
 
63
- const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
64
- const { isArray: ArrayIsArray } = Array;
65
- const { stringify: JSONStringify } = JSON;
66
- function createLink(ref) {
67
- return {
68
- __ref: serializeStructuredKey(ref),
69
- };
63
+ const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
64
+ const { isArray: ArrayIsArray } = Array;
65
+ const { stringify: JSONStringify } = JSON;
66
+ function createLink(ref) {
67
+ return {
68
+ __ref: serializeStructuredKey(ref),
69
+ };
70
70
  }
71
71
 
72
- function validate$2(obj, path = 'PriceAdjustmentTierRepresentation') {
73
- const v_error = (() => {
74
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
75
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
76
- }
77
- const obj_adjustmentType = obj.adjustmentType;
78
- const path_adjustmentType = path + '.adjustmentType';
79
- if (typeof obj_adjustmentType !== 'string') {
80
- return new TypeError('Expected "string" but received "' + typeof obj_adjustmentType + '" (at "' + path_adjustmentType + '")');
81
- }
82
- const obj_adjustmentValue = obj.adjustmentValue;
83
- const path_adjustmentValue = path + '.adjustmentValue';
84
- if (typeof obj_adjustmentValue !== 'string') {
85
- return new TypeError('Expected "string" but received "' + typeof obj_adjustmentValue + '" (at "' + path_adjustmentValue + '")');
86
- }
87
- const obj_id = obj.id;
88
- const path_id = path + '.id';
89
- if (typeof obj_id !== 'string') {
90
- return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
91
- }
92
- const obj_lowerBound = obj.lowerBound;
93
- const path_lowerBound = path + '.lowerBound';
94
- if (typeof obj_lowerBound !== 'string') {
95
- return new TypeError('Expected "string" but received "' + typeof obj_lowerBound + '" (at "' + path_lowerBound + '")');
96
- }
97
- const obj_tierUnitPrice = obj.tierUnitPrice;
98
- const path_tierUnitPrice = path + '.tierUnitPrice';
99
- if (typeof obj_tierUnitPrice !== 'string') {
100
- return new TypeError('Expected "string" but received "' + typeof obj_tierUnitPrice + '" (at "' + path_tierUnitPrice + '")');
101
- }
102
- const obj_upperBound = obj.upperBound;
103
- const path_upperBound = path + '.upperBound';
104
- if (typeof obj_upperBound !== 'string') {
105
- return new TypeError('Expected "string" but received "' + typeof obj_upperBound + '" (at "' + path_upperBound + '")');
106
- }
107
- })();
108
- return v_error === undefined ? null : v_error;
109
- }
110
- function deepFreeze$2(input) {
111
- ObjectFreeze(input);
72
+ function validate$2(obj, path = 'PriceAdjustmentTierRepresentation') {
73
+ const v_error = (() => {
74
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
75
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
76
+ }
77
+ const obj_adjustmentType = obj.adjustmentType;
78
+ const path_adjustmentType = path + '.adjustmentType';
79
+ if (typeof obj_adjustmentType !== 'string') {
80
+ return new TypeError('Expected "string" but received "' + typeof obj_adjustmentType + '" (at "' + path_adjustmentType + '")');
81
+ }
82
+ const obj_adjustmentValue = obj.adjustmentValue;
83
+ const path_adjustmentValue = path + '.adjustmentValue';
84
+ if (typeof obj_adjustmentValue !== 'string') {
85
+ return new TypeError('Expected "string" but received "' + typeof obj_adjustmentValue + '" (at "' + path_adjustmentValue + '")');
86
+ }
87
+ const obj_id = obj.id;
88
+ const path_id = path + '.id';
89
+ if (typeof obj_id !== 'string') {
90
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
91
+ }
92
+ const obj_lowerBound = obj.lowerBound;
93
+ const path_lowerBound = path + '.lowerBound';
94
+ if (typeof obj_lowerBound !== 'string') {
95
+ return new TypeError('Expected "string" but received "' + typeof obj_lowerBound + '" (at "' + path_lowerBound + '")');
96
+ }
97
+ const obj_tierUnitPrice = obj.tierUnitPrice;
98
+ const path_tierUnitPrice = path + '.tierUnitPrice';
99
+ if (typeof obj_tierUnitPrice !== 'string') {
100
+ return new TypeError('Expected "string" but received "' + typeof obj_tierUnitPrice + '" (at "' + path_tierUnitPrice + '")');
101
+ }
102
+ const obj_upperBound = obj.upperBound;
103
+ const path_upperBound = path + '.upperBound';
104
+ if (typeof obj_upperBound !== 'string') {
105
+ return new TypeError('Expected "string" but received "' + typeof obj_upperBound + '" (at "' + path_upperBound + '")');
106
+ }
107
+ })();
108
+ return v_error === undefined ? null : v_error;
109
+ }
110
+ function deepFreeze$2(input) {
111
+ ObjectFreeze(input);
112
112
  }
113
113
 
114
- function validate$1(obj, path = 'PriceAdjustmentScheduleRepresentation') {
115
- const v_error = (() => {
116
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
117
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
118
- }
119
- const obj_id = obj.id;
120
- const path_id = path + '.id';
121
- if (typeof obj_id !== 'string') {
122
- return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
123
- }
124
- const obj_priceAdjustmentTiers = obj.priceAdjustmentTiers;
125
- const path_priceAdjustmentTiers = path + '.priceAdjustmentTiers';
126
- if (!ArrayIsArray(obj_priceAdjustmentTiers)) {
127
- return new TypeError('Expected "array" but received "' + typeof obj_priceAdjustmentTiers + '" (at "' + path_priceAdjustmentTiers + '")');
128
- }
129
- for (let i = 0; i < obj_priceAdjustmentTiers.length; i++) {
130
- const obj_priceAdjustmentTiers_item = obj_priceAdjustmentTiers[i];
131
- const path_priceAdjustmentTiers_item = path_priceAdjustmentTiers + '[' + i + ']';
132
- const referencepath_priceAdjustmentTiers_itemValidationError = validate$2(obj_priceAdjustmentTiers_item, path_priceAdjustmentTiers_item);
133
- if (referencepath_priceAdjustmentTiers_itemValidationError !== null) {
134
- let message = 'Object doesn\'t match PriceAdjustmentTierRepresentation (at "' + path_priceAdjustmentTiers_item + '")\n';
135
- message += referencepath_priceAdjustmentTiers_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
136
- return new TypeError(message);
137
- }
138
- }
139
- })();
140
- return v_error === undefined ? null : v_error;
141
- }
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);
114
+ function validate$1(obj, path = 'PriceAdjustmentScheduleRepresentation') {
115
+ const v_error = (() => {
116
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
117
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
118
+ }
119
+ const obj_id = obj.id;
120
+ const path_id = path + '.id';
121
+ if (typeof obj_id !== 'string') {
122
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
123
+ }
124
+ const obj_priceAdjustmentTiers = obj.priceAdjustmentTiers;
125
+ const path_priceAdjustmentTiers = path + '.priceAdjustmentTiers';
126
+ if (!ArrayIsArray(obj_priceAdjustmentTiers)) {
127
+ return new TypeError('Expected "array" but received "' + typeof obj_priceAdjustmentTiers + '" (at "' + path_priceAdjustmentTiers + '")');
128
+ }
129
+ for (let i = 0; i < obj_priceAdjustmentTiers.length; i++) {
130
+ const obj_priceAdjustmentTiers_item = obj_priceAdjustmentTiers[i];
131
+ const path_priceAdjustmentTiers_item = path_priceAdjustmentTiers + '[' + i + ']';
132
+ const referencepath_priceAdjustmentTiers_itemValidationError = validate$2(obj_priceAdjustmentTiers_item, path_priceAdjustmentTiers_item);
133
+ if (referencepath_priceAdjustmentTiers_itemValidationError !== null) {
134
+ let message = 'Object doesn\'t match PriceAdjustmentTierRepresentation (at "' + path_priceAdjustmentTiers_item + '")\n';
135
+ message += referencepath_priceAdjustmentTiers_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
136
+ return new TypeError(message);
137
+ }
138
+ }
139
+ })();
140
+ return v_error === undefined ? null : v_error;
141
+ }
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
150
  }
151
151
 
152
- const VERSION = "3e2882f4e8e38efd02e1a14114269e4c";
153
- function validate(obj, path = 'ProductPriceRepresentation') {
154
- const v_error = (() => {
155
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
156
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
157
- }
158
- const obj_currencyIsoCode = obj.currencyIsoCode;
159
- const path_currencyIsoCode = path + '.currencyIsoCode';
160
- if (typeof obj_currencyIsoCode !== 'string') {
161
- return new TypeError('Expected "string" but received "' + typeof obj_currencyIsoCode + '" (at "' + path_currencyIsoCode + '")');
162
- }
163
- const obj_listPrice = obj.listPrice;
164
- const path_listPrice = path + '.listPrice';
165
- if (typeof obj_listPrice !== 'string') {
166
- return new TypeError('Expected "string" but received "' + typeof obj_listPrice + '" (at "' + path_listPrice + '")');
167
- }
168
- const obj_priceAdjustment = obj.priceAdjustment;
169
- const path_priceAdjustment = path + '.priceAdjustment';
170
- let obj_priceAdjustment_union0 = null;
171
- const obj_priceAdjustment_union0_error = (() => {
172
- const referencepath_priceAdjustmentValidationError = validate$1(obj_priceAdjustment, path_priceAdjustment);
173
- if (referencepath_priceAdjustmentValidationError !== null) {
174
- let message = 'Object doesn\'t match PriceAdjustmentScheduleRepresentation (at "' + path_priceAdjustment + '")\n';
175
- message += referencepath_priceAdjustmentValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
176
- return new TypeError(message);
177
- }
178
- })();
179
- if (obj_priceAdjustment_union0_error != null) {
180
- obj_priceAdjustment_union0 = obj_priceAdjustment_union0_error.message;
181
- }
182
- let obj_priceAdjustment_union1 = null;
183
- const obj_priceAdjustment_union1_error = (() => {
184
- if (obj_priceAdjustment !== null) {
185
- return new TypeError('Expected "null" but received "' + typeof obj_priceAdjustment + '" (at "' + path_priceAdjustment + '")');
186
- }
187
- })();
188
- if (obj_priceAdjustment_union1_error != null) {
189
- obj_priceAdjustment_union1 = obj_priceAdjustment_union1_error.message;
190
- }
191
- if (obj_priceAdjustment_union0 && obj_priceAdjustment_union1) {
192
- let message = 'Object doesn\'t match union (at "' + path_priceAdjustment + '")';
193
- message += '\n' + obj_priceAdjustment_union0.split('\n').map((line) => '\t' + line).join('\n');
194
- message += '\n' + obj_priceAdjustment_union1.split('\n').map((line) => '\t' + line).join('\n');
195
- return new TypeError(message);
196
- }
197
- const obj_pricebookEntryId = obj.pricebookEntryId;
198
- const path_pricebookEntryId = path + '.pricebookEntryId';
199
- if (typeof obj_pricebookEntryId !== 'string') {
200
- return new TypeError('Expected "string" but received "' + typeof obj_pricebookEntryId + '" (at "' + path_pricebookEntryId + '")');
201
- }
202
- const obj_unitPrice = obj.unitPrice;
203
- const path_unitPrice = path + '.unitPrice';
204
- if (typeof obj_unitPrice !== 'string') {
205
- return new TypeError('Expected "string" but received "' + typeof obj_unitPrice + '" (at "' + path_unitPrice + '")');
206
- }
207
- })();
208
- return v_error === undefined ? null : v_error;
209
- }
210
- const RepresentationType = 'ProductPriceRepresentation';
211
- function normalize(input, existing, path, luvio, store, timestamp) {
212
- return input;
213
- }
214
- const select$1 = function ProductPriceRepresentationSelect() {
215
- return {
216
- kind: 'Fragment',
217
- version: VERSION,
218
- private: [],
219
- opaque: true
220
- };
221
- };
222
- function equals(existing, incoming) {
223
- if (JSONStringify(incoming) !== JSONStringify(existing)) {
224
- return false;
225
- }
226
- return true;
227
- }
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
- const ingest = function ProductPriceRepresentationIngest(input, path, luvio, store, timestamp) {
236
- if (process.env.NODE_ENV !== 'production') {
237
- const validateError = validate(input);
238
- if (validateError !== null) {
239
- throw validateError;
240
- }
241
- }
242
- const key = path.fullPath;
243
- const existingRecord = store.readEntry(key);
244
- const ttlToUse = path.ttl !== undefined ? path.ttl : 2592000000;
245
- let incomingRecord = normalize(input, store.readEntry(key), {
246
- fullPath: key,
247
- parent: path.parent,
248
- propertyName: path.propertyName,
249
- ttl: ttlToUse
250
- });
251
- deepFreeze(input);
252
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
253
- luvio.storePublish(key, incomingRecord);
254
- }
255
- if (ttlToUse !== undefined) {
256
- const storeMetadataParams = {
257
- ttl: ttlToUse,
258
- namespace: "Commerce",
259
- version: VERSION,
260
- representationName: RepresentationType,
261
- };
262
- luvio.publishStoreMetadata(key, storeMetadataParams);
263
- }
264
- return createLink(key);
265
- };
266
- function getTypeCacheKeys(luvio, input, fullPathFactory) {
267
- const rootKeySet = new StoreKeyMap();
268
- // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
269
- const rootKey = fullPathFactory();
270
- rootKeySet.set(rootKey, {
271
- namespace: keyPrefix,
272
- representationName: RepresentationType,
273
- mergeable: false
274
- });
275
- return rootKeySet;
152
+ const VERSION = "3e2882f4e8e38efd02e1a14114269e4c";
153
+ function validate(obj, path = 'ProductPriceRepresentation') {
154
+ const v_error = (() => {
155
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
156
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
157
+ }
158
+ const obj_currencyIsoCode = obj.currencyIsoCode;
159
+ const path_currencyIsoCode = path + '.currencyIsoCode';
160
+ if (typeof obj_currencyIsoCode !== 'string') {
161
+ return new TypeError('Expected "string" but received "' + typeof obj_currencyIsoCode + '" (at "' + path_currencyIsoCode + '")');
162
+ }
163
+ const obj_listPrice = obj.listPrice;
164
+ const path_listPrice = path + '.listPrice';
165
+ if (typeof obj_listPrice !== 'string') {
166
+ return new TypeError('Expected "string" but received "' + typeof obj_listPrice + '" (at "' + path_listPrice + '")');
167
+ }
168
+ const obj_priceAdjustment = obj.priceAdjustment;
169
+ const path_priceAdjustment = path + '.priceAdjustment';
170
+ let obj_priceAdjustment_union0 = null;
171
+ const obj_priceAdjustment_union0_error = (() => {
172
+ const referencepath_priceAdjustmentValidationError = validate$1(obj_priceAdjustment, path_priceAdjustment);
173
+ if (referencepath_priceAdjustmentValidationError !== null) {
174
+ let message = 'Object doesn\'t match PriceAdjustmentScheduleRepresentation (at "' + path_priceAdjustment + '")\n';
175
+ message += referencepath_priceAdjustmentValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
176
+ return new TypeError(message);
177
+ }
178
+ })();
179
+ if (obj_priceAdjustment_union0_error != null) {
180
+ obj_priceAdjustment_union0 = obj_priceAdjustment_union0_error.message;
181
+ }
182
+ let obj_priceAdjustment_union1 = null;
183
+ const obj_priceAdjustment_union1_error = (() => {
184
+ if (obj_priceAdjustment !== null) {
185
+ return new TypeError('Expected "null" but received "' + typeof obj_priceAdjustment + '" (at "' + path_priceAdjustment + '")');
186
+ }
187
+ })();
188
+ if (obj_priceAdjustment_union1_error != null) {
189
+ obj_priceAdjustment_union1 = obj_priceAdjustment_union1_error.message;
190
+ }
191
+ if (obj_priceAdjustment_union0 && obj_priceAdjustment_union1) {
192
+ let message = 'Object doesn\'t match union (at "' + path_priceAdjustment + '")';
193
+ message += '\n' + obj_priceAdjustment_union0.split('\n').map((line) => '\t' + line).join('\n');
194
+ message += '\n' + obj_priceAdjustment_union1.split('\n').map((line) => '\t' + line).join('\n');
195
+ return new TypeError(message);
196
+ }
197
+ const obj_pricebookEntryId = obj.pricebookEntryId;
198
+ const path_pricebookEntryId = path + '.pricebookEntryId';
199
+ if (typeof obj_pricebookEntryId !== 'string') {
200
+ return new TypeError('Expected "string" but received "' + typeof obj_pricebookEntryId + '" (at "' + path_pricebookEntryId + '")');
201
+ }
202
+ const obj_unitPrice = obj.unitPrice;
203
+ const path_unitPrice = path + '.unitPrice';
204
+ if (typeof obj_unitPrice !== 'string') {
205
+ return new TypeError('Expected "string" but received "' + typeof obj_unitPrice + '" (at "' + path_unitPrice + '")');
206
+ }
207
+ })();
208
+ return v_error === undefined ? null : v_error;
209
+ }
210
+ const RepresentationType = 'ProductPriceRepresentation';
211
+ function normalize(input, existing, path, luvio, store, timestamp) {
212
+ return input;
213
+ }
214
+ const select$1 = function ProductPriceRepresentationSelect() {
215
+ return {
216
+ kind: 'Fragment',
217
+ version: VERSION,
218
+ private: [],
219
+ opaque: true
220
+ };
221
+ };
222
+ function equals(existing, incoming) {
223
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
224
+ return false;
225
+ }
226
+ return true;
227
+ }
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
+ const ingest = function ProductPriceRepresentationIngest(input, path, luvio, store, timestamp) {
236
+ if (process.env.NODE_ENV !== 'production') {
237
+ const validateError = validate(input);
238
+ if (validateError !== null) {
239
+ throw validateError;
240
+ }
241
+ }
242
+ const key = path.fullPath;
243
+ const existingRecord = store.readEntry(key);
244
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 2592000000;
245
+ let incomingRecord = normalize(input, store.readEntry(key), {
246
+ fullPath: key,
247
+ parent: path.parent,
248
+ propertyName: path.propertyName,
249
+ ttl: ttlToUse
250
+ });
251
+ deepFreeze(input);
252
+ if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
253
+ luvio.storePublish(key, incomingRecord);
254
+ }
255
+ if (ttlToUse !== undefined) {
256
+ const storeMetadataParams = {
257
+ ttl: ttlToUse,
258
+ namespace: "Commerce",
259
+ version: VERSION,
260
+ representationName: RepresentationType,
261
+ };
262
+ luvio.publishStoreMetadata(key, storeMetadataParams);
263
+ }
264
+ return createLink(key);
265
+ };
266
+ function getTypeCacheKeys(luvio, input, fullPathFactory) {
267
+ const rootKeySet = new StoreKeyMap();
268
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
269
+ const rootKey = fullPathFactory();
270
+ rootKeySet.set(rootKey, {
271
+ namespace: keyPrefix,
272
+ representationName: RepresentationType,
273
+ mergeable: false
274
+ });
275
+ return rootKeySet;
276
276
  }
277
277
 
278
- function select(luvio, params) {
279
- return select$1();
280
- }
281
- function keyBuilder$1(luvio, params) {
282
- return keyPrefix + '::ProductPriceRepresentation:(' + 'effectiveAccountId:' + params.queryParams.effectiveAccountId + ',' + 'productId:' + params.urlParams.productId + ',' + 'webstoreId:' + params.urlParams.webstoreId + ')';
283
- }
284
- function getResponseCacheKeys(luvio, resourceParams, response) {
285
- return getTypeCacheKeys(luvio, response, () => keyBuilder$1(luvio, resourceParams));
286
- }
287
- function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
288
- const { body } = response;
289
- const key = keyBuilder$1(luvio, resourceParams);
290
- luvio.storeIngest(key, ingest, body);
291
- const snapshot = luvio.storeLookup({
292
- recordId: key,
293
- node: select(),
294
- variables: {},
295
- }, snapshotRefresh);
296
- if (process.env.NODE_ENV !== 'production') {
297
- if (snapshot.state !== 'Fulfilled') {
298
- throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
299
- }
300
- }
301
- return snapshot;
302
- }
303
- function ingestError(luvio, params, error, snapshotRefresh) {
304
- const key = keyBuilder$1(luvio, params);
305
- const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
306
- luvio.storeIngestError(key, errorSnapshot);
307
- return errorSnapshot;
308
- }
309
- function createResourceRequest(config) {
310
- const headers = {};
311
- return {
312
- baseUri: '/services/data/v58.0',
313
- basePath: '/commerce/webstores/' + config.urlParams.webstoreId + '/pricing/products/' + config.urlParams.productId + '',
314
- method: 'get',
315
- body: null,
316
- urlParams: config.urlParams,
317
- queryParams: config.queryParams,
318
- headers,
319
- priority: 'normal',
320
- };
278
+ function select(luvio, params) {
279
+ return select$1();
280
+ }
281
+ function keyBuilder$1(luvio, params) {
282
+ return keyPrefix + '::ProductPriceRepresentation:(' + 'effectiveAccountId:' + params.queryParams.effectiveAccountId + ',' + 'productId:' + params.urlParams.productId + ',' + 'webstoreId:' + params.urlParams.webstoreId + ')';
283
+ }
284
+ function getResponseCacheKeys(luvio, resourceParams, response) {
285
+ return getTypeCacheKeys(luvio, response, () => keyBuilder$1(luvio, resourceParams));
286
+ }
287
+ function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
288
+ const { body } = response;
289
+ const key = keyBuilder$1(luvio, resourceParams);
290
+ luvio.storeIngest(key, ingest, body);
291
+ const snapshot = luvio.storeLookup({
292
+ recordId: key,
293
+ node: select(),
294
+ variables: {},
295
+ }, snapshotRefresh);
296
+ if (process.env.NODE_ENV !== 'production') {
297
+ if (snapshot.state !== 'Fulfilled') {
298
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
299
+ }
300
+ }
301
+ return snapshot;
302
+ }
303
+ function ingestError(luvio, params, error, snapshotRefresh) {
304
+ const key = keyBuilder$1(luvio, params);
305
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
306
+ luvio.storeIngestError(key, errorSnapshot);
307
+ return errorSnapshot;
308
+ }
309
+ function createResourceRequest(config) {
310
+ const headers = {};
311
+ return {
312
+ baseUri: '/services/data/v58.0',
313
+ basePath: '/commerce/webstores/' + config.urlParams.webstoreId + '/pricing/products/' + config.urlParams.productId + '',
314
+ method: 'get',
315
+ body: null,
316
+ urlParams: config.urlParams,
317
+ queryParams: config.queryParams,
318
+ headers,
319
+ priority: 'normal',
320
+ };
321
321
  }
322
322
 
323
- const getProductPrice_ConfigPropertyNames = {
324
- displayName: 'getProductPrice',
325
- parameters: {
326
- required: ['productId', 'webstoreId'],
327
- optional: ['effectiveAccountId']
328
- }
329
- };
330
- function createResourceParams(config) {
331
- const resourceParams = {
332
- urlParams: {
333
- productId: config.productId, webstoreId: config.webstoreId
334
- },
335
- queryParams: {
336
- effectiveAccountId: config.effectiveAccountId
337
- }
338
- };
339
- return resourceParams;
340
- }
341
- function keyBuilder(luvio, config) {
342
- const resourceParams = createResourceParams(config);
343
- return keyBuilder$1(luvio, resourceParams);
344
- }
345
- function typeCheckConfig(untrustedConfig) {
346
- const config = {};
347
- const untrustedConfig_productId = untrustedConfig.productId;
348
- if (typeof untrustedConfig_productId === 'string') {
349
- config.productId = untrustedConfig_productId;
350
- }
351
- const untrustedConfig_webstoreId = untrustedConfig.webstoreId;
352
- if (typeof untrustedConfig_webstoreId === 'string') {
353
- config.webstoreId = untrustedConfig_webstoreId;
354
- }
355
- const untrustedConfig_effectiveAccountId = untrustedConfig.effectiveAccountId;
356
- if (typeof untrustedConfig_effectiveAccountId === 'string') {
357
- config.effectiveAccountId = untrustedConfig_effectiveAccountId;
358
- }
359
- return config;
360
- }
361
- function validateAdapterConfig(untrustedConfig, configPropertyNames) {
362
- if (!untrustedIsObject(untrustedConfig)) {
363
- return null;
364
- }
365
- if (process.env.NODE_ENV !== 'production') {
366
- validateConfig(untrustedConfig, configPropertyNames);
367
- }
368
- const config = typeCheckConfig(untrustedConfig);
369
- if (!areRequiredParametersPresent(config, configPropertyNames)) {
370
- return null;
371
- }
372
- return config;
373
- }
374
- function adapterFragment(luvio, config) {
375
- createResourceParams(config);
376
- return select();
377
- }
378
- function onFetchResponseSuccess(luvio, config, resourceParams, response) {
379
- const snapshot = ingestSuccess(luvio, resourceParams, response, {
380
- config,
381
- resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
382
- });
383
- return luvio.storeBroadcast().then(() => snapshot);
384
- }
385
- function onFetchResponseError(luvio, config, resourceParams, response) {
386
- const snapshot = ingestError(luvio, resourceParams, response, {
387
- config,
388
- resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
389
- });
390
- return luvio.storeBroadcast().then(() => snapshot);
391
- }
392
- function buildNetworkSnapshot(luvio, config, options) {
393
- const resourceParams = createResourceParams(config);
394
- const request = createResourceRequest(resourceParams);
395
- return luvio.dispatchResourceRequest(request, options)
396
- .then((response) => {
397
- return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys(luvio, resourceParams, response.body));
398
- }, (response) => {
399
- return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
400
- });
401
- }
402
- function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
403
- const { luvio, config } = context;
404
- const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
405
- const dispatchOptions = {
406
- resourceRequestContext: {
407
- requestCorrelator,
408
- luvioRequestMethod: undefined,
409
- },
410
- eventObservers
411
- };
412
- if (networkPriority !== 'normal') {
413
- dispatchOptions.overrides = {
414
- priority: networkPriority
415
- };
416
- }
417
- return buildNetworkSnapshot(luvio, config, dispatchOptions);
418
- }
419
- function buildCachedSnapshotCachePolicy(context, storeLookup) {
420
- const { luvio, config } = context;
421
- const selector = {
422
- recordId: keyBuilder(luvio, config),
423
- node: adapterFragment(luvio, config),
424
- variables: {},
425
- };
426
- const cacheSnapshot = storeLookup(selector, {
427
- config,
428
- resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
429
- });
430
- return cacheSnapshot;
431
- }
432
- const getProductPriceAdapterFactory = (luvio) => function Commerce__getProductPrice(untrustedConfig, requestContext) {
433
- const config = validateAdapterConfig(untrustedConfig, getProductPrice_ConfigPropertyNames);
434
- // Invalid or incomplete config
435
- if (config === null) {
436
- return null;
437
- }
438
- return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
439
- buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
323
+ const getProductPrice_ConfigPropertyNames = {
324
+ displayName: 'getProductPrice',
325
+ parameters: {
326
+ required: ['productId', 'webstoreId'],
327
+ optional: ['effectiveAccountId']
328
+ }
329
+ };
330
+ function createResourceParams(config) {
331
+ const resourceParams = {
332
+ urlParams: {
333
+ productId: config.productId, webstoreId: config.webstoreId
334
+ },
335
+ queryParams: {
336
+ effectiveAccountId: config.effectiveAccountId
337
+ }
338
+ };
339
+ return resourceParams;
340
+ }
341
+ function keyBuilder(luvio, config) {
342
+ const resourceParams = createResourceParams(config);
343
+ return keyBuilder$1(luvio, resourceParams);
344
+ }
345
+ function typeCheckConfig(untrustedConfig) {
346
+ const config = {};
347
+ const untrustedConfig_productId = untrustedConfig.productId;
348
+ if (typeof untrustedConfig_productId === 'string') {
349
+ config.productId = untrustedConfig_productId;
350
+ }
351
+ const untrustedConfig_webstoreId = untrustedConfig.webstoreId;
352
+ if (typeof untrustedConfig_webstoreId === 'string') {
353
+ config.webstoreId = untrustedConfig_webstoreId;
354
+ }
355
+ const untrustedConfig_effectiveAccountId = untrustedConfig.effectiveAccountId;
356
+ if (typeof untrustedConfig_effectiveAccountId === 'string') {
357
+ config.effectiveAccountId = untrustedConfig_effectiveAccountId;
358
+ }
359
+ return config;
360
+ }
361
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
362
+ if (!untrustedIsObject(untrustedConfig)) {
363
+ return null;
364
+ }
365
+ if (process.env.NODE_ENV !== 'production') {
366
+ validateConfig(untrustedConfig, configPropertyNames);
367
+ }
368
+ const config = typeCheckConfig(untrustedConfig);
369
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
370
+ return null;
371
+ }
372
+ return config;
373
+ }
374
+ function adapterFragment(luvio, config) {
375
+ createResourceParams(config);
376
+ return select();
377
+ }
378
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
379
+ const snapshot = ingestSuccess(luvio, resourceParams, response, {
380
+ config,
381
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
382
+ });
383
+ return luvio.storeBroadcast().then(() => snapshot);
384
+ }
385
+ function onFetchResponseError(luvio, config, resourceParams, response) {
386
+ const snapshot = ingestError(luvio, resourceParams, response, {
387
+ config,
388
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
389
+ });
390
+ return luvio.storeBroadcast().then(() => snapshot);
391
+ }
392
+ function buildNetworkSnapshot(luvio, config, options) {
393
+ const resourceParams = createResourceParams(config);
394
+ const request = createResourceRequest(resourceParams);
395
+ return luvio.dispatchResourceRequest(request, options)
396
+ .then((response) => {
397
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys(luvio, resourceParams, response.body));
398
+ }, (response) => {
399
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
400
+ });
401
+ }
402
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
403
+ const { luvio, config } = context;
404
+ const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
405
+ const dispatchOptions = {
406
+ resourceRequestContext: {
407
+ requestCorrelator,
408
+ luvioRequestMethod: undefined,
409
+ },
410
+ eventObservers
411
+ };
412
+ if (networkPriority !== 'normal') {
413
+ dispatchOptions.overrides = {
414
+ priority: networkPriority
415
+ };
416
+ }
417
+ return buildNetworkSnapshot(luvio, config, dispatchOptions);
418
+ }
419
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
420
+ const { luvio, config } = context;
421
+ const selector = {
422
+ recordId: keyBuilder(luvio, config),
423
+ node: adapterFragment(luvio, config),
424
+ variables: {},
425
+ };
426
+ const cacheSnapshot = storeLookup(selector, {
427
+ config,
428
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
429
+ });
430
+ return cacheSnapshot;
431
+ }
432
+ const getProductPriceAdapterFactory = (luvio) => function Commerce__getProductPrice(untrustedConfig, requestContext) {
433
+ const config = validateAdapterConfig(untrustedConfig, getProductPrice_ConfigPropertyNames);
434
+ // Invalid or incomplete config
435
+ if (config === null) {
436
+ return null;
437
+ }
438
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
439
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
440
440
  };
441
441
 
442
- let getProductPrice;
443
- // Imperative GET Adapters
444
- let getProductPrice_imperative;
445
- // Adapter Metadata
446
- const getProductPriceMetadata = { apiFamily: 'Commerce', name: 'getProductPrice' };
447
- function bindExportsTo(luvio) {
448
- // LDS Adapters
449
- const getProductPrice_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getProductPrice', getProductPriceAdapterFactory), getProductPriceMetadata);
450
- return {
451
- getProductPrice: createWireAdapterConstructor(luvio, getProductPrice_ldsAdapter, getProductPriceMetadata),
452
- // Imperative GET Adapters
453
- getProductPrice_imperative: createImperativeAdapter(luvio, getProductPrice_ldsAdapter, getProductPriceMetadata)
454
- };
455
- }
456
- withDefaultLuvio((luvio) => {
457
- ({
458
- getProductPrice,
459
- getProductPrice_imperative
460
- } = bindExportsTo(luvio));
442
+ let getProductPrice;
443
+ // Imperative GET Adapters
444
+ let getProductPrice_imperative;
445
+ // Adapter Metadata
446
+ const getProductPriceMetadata = { apiFamily: 'Commerce', name: 'getProductPrice' };
447
+ function bindExportsTo(luvio) {
448
+ // LDS Adapters
449
+ const getProductPrice_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getProductPrice', getProductPriceAdapterFactory), getProductPriceMetadata);
450
+ return {
451
+ getProductPrice: createWireAdapterConstructor(luvio, getProductPrice_ldsAdapter, getProductPriceMetadata),
452
+ // Imperative GET Adapters
453
+ getProductPrice_imperative: createImperativeAdapter(luvio, getProductPrice_ldsAdapter, getProductPriceMetadata)
454
+ };
455
+ }
456
+ withDefaultLuvio((luvio) => {
457
+ ({
458
+ getProductPrice,
459
+ getProductPrice_imperative
460
+ } = bindExportsTo(luvio));
461
461
  });
462
462
 
463
463
  export { getProductPrice, getProductPrice_imperative };
464
- // version: 1.124.2-4dc3034f1
464
+ // version: 1.124.3-c058f7d96