@salesforce/lds-adapters-commerce-configuration 0.1.0-dev1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +82 -0
- package/dist/es/es2018/commerce-configuration.js +747 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/deleteCommerceConfigurationAttribute.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/adapters/getCommerceConfigurationAttribute.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/adapters/putCommerceConfigurationAttribute.d.ts +22 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +3 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +6 -0
- package/dist/es/es2018/types/src/generated/resources/deleteCommerceConfigurationByAttributeIdAndContextIdAndContextType.d.ts +14 -0
- package/dist/es/es2018/types/src/generated/resources/getCommerceConfigurationByAttributeIdAndContextIdAndContextType.d.ts +21 -0
- package/dist/es/es2018/types/src/generated/resources/putCommerceConfigurationByAttributeIdAndContextIdAndContextType.d.ts +21 -0
- package/dist/es/es2018/types/src/generated/types/CommerceConfigurationAttributeInputRepresentation.d.ts +40 -0
- package/dist/es/es2018/types/src/generated/types/CommerceConfigurationAttributeOutputRepresentation.d.ts +65 -0
- package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
- package/package.json +66 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +841 -0
- package/src/raml/api.raml +152 -0
- package/src/raml/luvio.raml +36 -0
package/sfdc/index.js
ADDED
|
@@ -0,0 +1,841 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* ATTENTION!
|
|
9
|
+
* THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
|
|
10
|
+
* If you would like to contribute to LDS, please follow the steps outlined in the git repo.
|
|
11
|
+
* Any changes made to this file in p4 will be automatically overwritten.
|
|
12
|
+
* *******************************************************************************************
|
|
13
|
+
*/
|
|
14
|
+
/* proxy-compat-disable */
|
|
15
|
+
import { createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstructor, createImperativeAdapter } from 'force/ldsBindings';
|
|
16
|
+
import { withDefaultLuvio } from 'force/ldsEngine';
|
|
17
|
+
import { serializeStructuredKey, ingestShape, StoreKeyMap, deepFreeze, createResourceParams as createResourceParams$3, typeCheckConfig as typeCheckConfig$3, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1 } from 'force/luvioEngine';
|
|
18
|
+
|
|
19
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
20
|
+
const { keys: ObjectKeys, create: ObjectCreate } = 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(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
|
+
function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
|
|
62
|
+
return {
|
|
63
|
+
name,
|
|
64
|
+
required,
|
|
65
|
+
resourceType,
|
|
66
|
+
typeCheckShape,
|
|
67
|
+
isArrayShape,
|
|
68
|
+
coerceFn,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function buildAdapterValidationConfig(displayName, paramsMeta) {
|
|
72
|
+
const required = paramsMeta.filter(p => p.required).map(p => p.name);
|
|
73
|
+
const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
|
|
74
|
+
return {
|
|
75
|
+
displayName,
|
|
76
|
+
parameters: {
|
|
77
|
+
required,
|
|
78
|
+
optional,
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const keyPrefix = 'commerce-configuration';
|
|
83
|
+
|
|
84
|
+
const { isArray: ArrayIsArray } = Array;
|
|
85
|
+
function equalsArray(a, b, equalsItem) {
|
|
86
|
+
const aLength = a.length;
|
|
87
|
+
const bLength = b.length;
|
|
88
|
+
if (aLength !== bLength) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
for (let i = 0; i < aLength; i++) {
|
|
92
|
+
if (equalsItem(a[i], b[i]) === false) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
function createLink(ref) {
|
|
99
|
+
return {
|
|
100
|
+
__ref: serializeStructuredKey(ref),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const TTL = 1000;
|
|
105
|
+
const VERSION = "3f1cb4f5f9992e44d62eef68eeaa8ee0";
|
|
106
|
+
function validate(obj, path = 'CommerceConfigurationAttributeOutputRepresentation') {
|
|
107
|
+
const v_error = (() => {
|
|
108
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
109
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
110
|
+
}
|
|
111
|
+
if (obj.booleanValue !== undefined) {
|
|
112
|
+
const obj_booleanValue = obj.booleanValue;
|
|
113
|
+
const path_booleanValue = path + '.booleanValue';
|
|
114
|
+
let obj_booleanValue_union0 = null;
|
|
115
|
+
const obj_booleanValue_union0_error = (() => {
|
|
116
|
+
if (typeof obj_booleanValue !== 'boolean') {
|
|
117
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_booleanValue + '" (at "' + path_booleanValue + '")');
|
|
118
|
+
}
|
|
119
|
+
})();
|
|
120
|
+
if (obj_booleanValue_union0_error != null) {
|
|
121
|
+
obj_booleanValue_union0 = obj_booleanValue_union0_error.message;
|
|
122
|
+
}
|
|
123
|
+
let obj_booleanValue_union1 = null;
|
|
124
|
+
const obj_booleanValue_union1_error = (() => {
|
|
125
|
+
if (obj_booleanValue !== null) {
|
|
126
|
+
return new TypeError('Expected "null" but received "' + typeof obj_booleanValue + '" (at "' + path_booleanValue + '")');
|
|
127
|
+
}
|
|
128
|
+
})();
|
|
129
|
+
if (obj_booleanValue_union1_error != null) {
|
|
130
|
+
obj_booleanValue_union1 = obj_booleanValue_union1_error.message;
|
|
131
|
+
}
|
|
132
|
+
if (obj_booleanValue_union0 && obj_booleanValue_union1) {
|
|
133
|
+
let message = 'Object doesn\'t match union (at "' + path_booleanValue + '")';
|
|
134
|
+
message += '\n' + obj_booleanValue_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
135
|
+
message += '\n' + obj_booleanValue_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
136
|
+
return new TypeError(message);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const obj_contextId = obj.contextId;
|
|
140
|
+
const path_contextId = path + '.contextId';
|
|
141
|
+
if (typeof obj_contextId !== 'string') {
|
|
142
|
+
return new TypeError('Expected "string" but received "' + typeof obj_contextId + '" (at "' + path_contextId + '")');
|
|
143
|
+
}
|
|
144
|
+
const obj_contextType = obj.contextType;
|
|
145
|
+
const path_contextType = path + '.contextType';
|
|
146
|
+
if (typeof obj_contextType !== 'string') {
|
|
147
|
+
return new TypeError('Expected "string" but received "' + typeof obj_contextType + '" (at "' + path_contextType + '")');
|
|
148
|
+
}
|
|
149
|
+
const obj_id = obj.id;
|
|
150
|
+
const path_id = path + '.id';
|
|
151
|
+
if (typeof obj_id !== 'string') {
|
|
152
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
153
|
+
}
|
|
154
|
+
if (obj.integerValue !== undefined) {
|
|
155
|
+
const obj_integerValue = obj.integerValue;
|
|
156
|
+
const path_integerValue = path + '.integerValue';
|
|
157
|
+
let obj_integerValue_union0 = null;
|
|
158
|
+
const obj_integerValue_union0_error = (() => {
|
|
159
|
+
if (typeof obj_integerValue !== 'number' || (typeof obj_integerValue === 'number' && Math.floor(obj_integerValue) !== obj_integerValue)) {
|
|
160
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_integerValue + '" (at "' + path_integerValue + '")');
|
|
161
|
+
}
|
|
162
|
+
})();
|
|
163
|
+
if (obj_integerValue_union0_error != null) {
|
|
164
|
+
obj_integerValue_union0 = obj_integerValue_union0_error.message;
|
|
165
|
+
}
|
|
166
|
+
let obj_integerValue_union1 = null;
|
|
167
|
+
const obj_integerValue_union1_error = (() => {
|
|
168
|
+
if (obj_integerValue !== null) {
|
|
169
|
+
return new TypeError('Expected "null" but received "' + typeof obj_integerValue + '" (at "' + path_integerValue + '")');
|
|
170
|
+
}
|
|
171
|
+
})();
|
|
172
|
+
if (obj_integerValue_union1_error != null) {
|
|
173
|
+
obj_integerValue_union1 = obj_integerValue_union1_error.message;
|
|
174
|
+
}
|
|
175
|
+
if (obj_integerValue_union0 && obj_integerValue_union1) {
|
|
176
|
+
let message = 'Object doesn\'t match union (at "' + path_integerValue + '")';
|
|
177
|
+
message += '\n' + obj_integerValue_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
178
|
+
message += '\n' + obj_integerValue_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
179
|
+
return new TypeError(message);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (obj.numberValue !== undefined) {
|
|
183
|
+
const obj_numberValue = obj.numberValue;
|
|
184
|
+
const path_numberValue = path + '.numberValue';
|
|
185
|
+
let obj_numberValue_union0 = null;
|
|
186
|
+
const obj_numberValue_union0_error = (() => {
|
|
187
|
+
if (typeof obj_numberValue !== 'number') {
|
|
188
|
+
return new TypeError('Expected "number" but received "' + typeof obj_numberValue + '" (at "' + path_numberValue + '")');
|
|
189
|
+
}
|
|
190
|
+
})();
|
|
191
|
+
if (obj_numberValue_union0_error != null) {
|
|
192
|
+
obj_numberValue_union0 = obj_numberValue_union0_error.message;
|
|
193
|
+
}
|
|
194
|
+
let obj_numberValue_union1 = null;
|
|
195
|
+
const obj_numberValue_union1_error = (() => {
|
|
196
|
+
if (obj_numberValue !== null) {
|
|
197
|
+
return new TypeError('Expected "null" but received "' + typeof obj_numberValue + '" (at "' + path_numberValue + '")');
|
|
198
|
+
}
|
|
199
|
+
})();
|
|
200
|
+
if (obj_numberValue_union1_error != null) {
|
|
201
|
+
obj_numberValue_union1 = obj_numberValue_union1_error.message;
|
|
202
|
+
}
|
|
203
|
+
if (obj_numberValue_union0 && obj_numberValue_union1) {
|
|
204
|
+
let message = 'Object doesn\'t match union (at "' + path_numberValue + '")';
|
|
205
|
+
message += '\n' + obj_numberValue_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
206
|
+
message += '\n' + obj_numberValue_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
207
|
+
return new TypeError(message);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
if (obj.stringValue !== undefined) {
|
|
211
|
+
const obj_stringValue = obj.stringValue;
|
|
212
|
+
const path_stringValue = path + '.stringValue';
|
|
213
|
+
let obj_stringValue_union0 = null;
|
|
214
|
+
const obj_stringValue_union0_error = (() => {
|
|
215
|
+
if (typeof obj_stringValue !== 'string') {
|
|
216
|
+
return new TypeError('Expected "string" but received "' + typeof obj_stringValue + '" (at "' + path_stringValue + '")');
|
|
217
|
+
}
|
|
218
|
+
})();
|
|
219
|
+
if (obj_stringValue_union0_error != null) {
|
|
220
|
+
obj_stringValue_union0 = obj_stringValue_union0_error.message;
|
|
221
|
+
}
|
|
222
|
+
let obj_stringValue_union1 = null;
|
|
223
|
+
const obj_stringValue_union1_error = (() => {
|
|
224
|
+
if (obj_stringValue !== null) {
|
|
225
|
+
return new TypeError('Expected "null" but received "' + typeof obj_stringValue + '" (at "' + path_stringValue + '")');
|
|
226
|
+
}
|
|
227
|
+
})();
|
|
228
|
+
if (obj_stringValue_union1_error != null) {
|
|
229
|
+
obj_stringValue_union1 = obj_stringValue_union1_error.message;
|
|
230
|
+
}
|
|
231
|
+
if (obj_stringValue_union0 && obj_stringValue_union1) {
|
|
232
|
+
let message = 'Object doesn\'t match union (at "' + path_stringValue + '")';
|
|
233
|
+
message += '\n' + obj_stringValue_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
234
|
+
message += '\n' + obj_stringValue_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
235
|
+
return new TypeError(message);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
if (obj.stringValues !== undefined) {
|
|
239
|
+
const obj_stringValues = obj.stringValues;
|
|
240
|
+
const path_stringValues = path + '.stringValues';
|
|
241
|
+
if (!ArrayIsArray(obj_stringValues)) {
|
|
242
|
+
return new TypeError('Expected "array" but received "' + typeof obj_stringValues + '" (at "' + path_stringValues + '")');
|
|
243
|
+
}
|
|
244
|
+
for (let i = 0; i < obj_stringValues.length; i++) {
|
|
245
|
+
const obj_stringValues_item = obj_stringValues[i];
|
|
246
|
+
const path_stringValues_item = path_stringValues + '[' + i + ']';
|
|
247
|
+
if (typeof obj_stringValues_item !== 'string') {
|
|
248
|
+
return new TypeError('Expected "string" but received "' + typeof obj_stringValues_item + '" (at "' + path_stringValues_item + '")');
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
})();
|
|
253
|
+
return v_error === undefined ? null : v_error;
|
|
254
|
+
}
|
|
255
|
+
const RepresentationType = 'CommerceConfigurationAttributeOutputRepresentation';
|
|
256
|
+
function keyBuilder$3(luvio, config) {
|
|
257
|
+
return keyPrefix + '::' + RepresentationType + ':' + config.id + ':' + config.contextId + ':' + config.contextType;
|
|
258
|
+
}
|
|
259
|
+
function keyBuilderFromType(luvio, object) {
|
|
260
|
+
const keyParams = {
|
|
261
|
+
id: object.id,
|
|
262
|
+
contextId: object.contextId,
|
|
263
|
+
contextType: object.contextType
|
|
264
|
+
};
|
|
265
|
+
return keyBuilder$3(luvio, keyParams);
|
|
266
|
+
}
|
|
267
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
268
|
+
return input;
|
|
269
|
+
}
|
|
270
|
+
const select$2 = function CommerceConfigurationAttributeOutputRepresentationSelect() {
|
|
271
|
+
return {
|
|
272
|
+
kind: 'Fragment',
|
|
273
|
+
version: VERSION,
|
|
274
|
+
private: [],
|
|
275
|
+
selections: [
|
|
276
|
+
{
|
|
277
|
+
name: 'booleanValue',
|
|
278
|
+
kind: 'Scalar',
|
|
279
|
+
required: false
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
name: 'contextId',
|
|
283
|
+
kind: 'Scalar'
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
name: 'contextType',
|
|
287
|
+
kind: 'Scalar'
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
name: 'id',
|
|
291
|
+
kind: 'Scalar'
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
name: 'integerValue',
|
|
295
|
+
kind: 'Scalar',
|
|
296
|
+
required: false
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
name: 'numberValue',
|
|
300
|
+
kind: 'Scalar',
|
|
301
|
+
required: false
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
name: 'stringValue',
|
|
305
|
+
kind: 'Scalar',
|
|
306
|
+
required: false
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
name: 'stringValues',
|
|
310
|
+
kind: 'Scalar',
|
|
311
|
+
plural: true,
|
|
312
|
+
required: false
|
|
313
|
+
}
|
|
314
|
+
]
|
|
315
|
+
};
|
|
316
|
+
};
|
|
317
|
+
function equals(existing, incoming) {
|
|
318
|
+
const existing_contextId = existing.contextId;
|
|
319
|
+
const incoming_contextId = incoming.contextId;
|
|
320
|
+
if (!(existing_contextId === incoming_contextId)) {
|
|
321
|
+
return false;
|
|
322
|
+
}
|
|
323
|
+
const existing_contextType = existing.contextType;
|
|
324
|
+
const incoming_contextType = incoming.contextType;
|
|
325
|
+
if (!(existing_contextType === incoming_contextType)) {
|
|
326
|
+
return false;
|
|
327
|
+
}
|
|
328
|
+
const existing_id = existing.id;
|
|
329
|
+
const incoming_id = incoming.id;
|
|
330
|
+
if (!(existing_id === incoming_id)) {
|
|
331
|
+
return false;
|
|
332
|
+
}
|
|
333
|
+
const existing_booleanValue = existing.booleanValue;
|
|
334
|
+
const incoming_booleanValue = incoming.booleanValue;
|
|
335
|
+
// if at least one of these optionals is defined
|
|
336
|
+
if (existing_booleanValue !== undefined || incoming_booleanValue !== undefined) {
|
|
337
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
338
|
+
// not equal
|
|
339
|
+
if (existing_booleanValue === undefined || incoming_booleanValue === undefined) {
|
|
340
|
+
return false;
|
|
341
|
+
}
|
|
342
|
+
if (!(existing_booleanValue === incoming_booleanValue)) {
|
|
343
|
+
return false;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
const existing_integerValue = existing.integerValue;
|
|
347
|
+
const incoming_integerValue = incoming.integerValue;
|
|
348
|
+
// if at least one of these optionals is defined
|
|
349
|
+
if (existing_integerValue !== undefined || incoming_integerValue !== undefined) {
|
|
350
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
351
|
+
// not equal
|
|
352
|
+
if (existing_integerValue === undefined || incoming_integerValue === undefined) {
|
|
353
|
+
return false;
|
|
354
|
+
}
|
|
355
|
+
if (!(existing_integerValue === incoming_integerValue)) {
|
|
356
|
+
return false;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
const existing_numberValue = existing.numberValue;
|
|
360
|
+
const incoming_numberValue = incoming.numberValue;
|
|
361
|
+
// if at least one of these optionals is defined
|
|
362
|
+
if (existing_numberValue !== undefined || incoming_numberValue !== undefined) {
|
|
363
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
364
|
+
// not equal
|
|
365
|
+
if (existing_numberValue === undefined || incoming_numberValue === undefined) {
|
|
366
|
+
return false;
|
|
367
|
+
}
|
|
368
|
+
if (!(existing_numberValue === incoming_numberValue)) {
|
|
369
|
+
return false;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
const existing_stringValue = existing.stringValue;
|
|
373
|
+
const incoming_stringValue = incoming.stringValue;
|
|
374
|
+
// if at least one of these optionals is defined
|
|
375
|
+
if (existing_stringValue !== undefined || incoming_stringValue !== undefined) {
|
|
376
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
377
|
+
// not equal
|
|
378
|
+
if (existing_stringValue === undefined || incoming_stringValue === undefined) {
|
|
379
|
+
return false;
|
|
380
|
+
}
|
|
381
|
+
if (!(existing_stringValue === incoming_stringValue)) {
|
|
382
|
+
return false;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
const existing_stringValues = existing.stringValues;
|
|
386
|
+
const incoming_stringValues = incoming.stringValues;
|
|
387
|
+
// if at least one of these optionals is defined
|
|
388
|
+
if (existing_stringValues !== undefined || incoming_stringValues !== undefined) {
|
|
389
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
390
|
+
// not equal
|
|
391
|
+
if (existing_stringValues === undefined || incoming_stringValues === undefined) {
|
|
392
|
+
return false;
|
|
393
|
+
}
|
|
394
|
+
const equals_stringValues_items = equalsArray(existing_stringValues, incoming_stringValues, (existing_stringValues_item, incoming_stringValues_item) => {
|
|
395
|
+
if (!(existing_stringValues_item === incoming_stringValues_item)) {
|
|
396
|
+
return false;
|
|
397
|
+
}
|
|
398
|
+
});
|
|
399
|
+
if (equals_stringValues_items === false) {
|
|
400
|
+
return false;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
return true;
|
|
404
|
+
}
|
|
405
|
+
const ingest = function CommerceConfigurationAttributeOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
406
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
407
|
+
const validateError = validate(input);
|
|
408
|
+
if (validateError !== null) {
|
|
409
|
+
throw validateError;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
const key = keyBuilderFromType(luvio, input);
|
|
413
|
+
const ttlToUse = TTL;
|
|
414
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "commerce-configuration", VERSION, RepresentationType, equals);
|
|
415
|
+
return createLink(key);
|
|
416
|
+
};
|
|
417
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
418
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
419
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
420
|
+
rootKeySet.set(rootKey, {
|
|
421
|
+
namespace: keyPrefix,
|
|
422
|
+
representationName: RepresentationType,
|
|
423
|
+
mergeable: false
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
function keyBuilder$2(luvio, params) {
|
|
428
|
+
return keyBuilder$3(luvio, {
|
|
429
|
+
id: params.urlParams.attributeId,
|
|
430
|
+
contextId: params.urlParams.contextId,
|
|
431
|
+
contextType: params.urlParams.contextType
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
function getResponseCacheKeys$2(cacheKeyMap, luvio, resourceParams) {
|
|
435
|
+
const key = keyBuilder$2(luvio, resourceParams);
|
|
436
|
+
cacheKeyMap.set(key, {
|
|
437
|
+
namespace: keyPrefix,
|
|
438
|
+
representationName: RepresentationType,
|
|
439
|
+
mergeable: false
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
function evictSuccess(luvio, resourceParams) {
|
|
443
|
+
const key = keyBuilder$2(luvio, resourceParams);
|
|
444
|
+
luvio.storeEvict(key);
|
|
445
|
+
}
|
|
446
|
+
function createResourceRequest$2(config) {
|
|
447
|
+
const headers = {};
|
|
448
|
+
return {
|
|
449
|
+
baseUri: '/services/data/v66.0',
|
|
450
|
+
basePath: '/commerce/configuration/' + config.urlParams.attributeId + '/' + config.urlParams.contextType + '/' + config.urlParams.contextId + '',
|
|
451
|
+
method: 'delete',
|
|
452
|
+
body: null,
|
|
453
|
+
urlParams: config.urlParams,
|
|
454
|
+
queryParams: {},
|
|
455
|
+
headers,
|
|
456
|
+
priority: 'normal',
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
const adapterName$2 = 'deleteCommerceConfigurationAttribute';
|
|
461
|
+
const deleteCommerceConfigurationAttribute_ConfigPropertyMetadata = [
|
|
462
|
+
generateParamConfigMetadata('attributeId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
463
|
+
generateParamConfigMetadata('contextId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
464
|
+
generateParamConfigMetadata('contextType', true, 0 /* UrlParameter */, 0 /* String */),
|
|
465
|
+
];
|
|
466
|
+
const deleteCommerceConfigurationAttribute_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, deleteCommerceConfigurationAttribute_ConfigPropertyMetadata);
|
|
467
|
+
const createResourceParams$2 = /*#__PURE__*/ createResourceParams$3(deleteCommerceConfigurationAttribute_ConfigPropertyMetadata);
|
|
468
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
469
|
+
const config = {};
|
|
470
|
+
typeCheckConfig$3(untrustedConfig, config, deleteCommerceConfigurationAttribute_ConfigPropertyMetadata);
|
|
471
|
+
return config;
|
|
472
|
+
}
|
|
473
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
474
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
475
|
+
return null;
|
|
476
|
+
}
|
|
477
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
478
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
479
|
+
}
|
|
480
|
+
const config = typeCheckConfig$2(untrustedConfig);
|
|
481
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
482
|
+
return null;
|
|
483
|
+
}
|
|
484
|
+
return config;
|
|
485
|
+
}
|
|
486
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
487
|
+
const resourceParams = createResourceParams$2(config);
|
|
488
|
+
const request = createResourceRequest$2(resourceParams);
|
|
489
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
490
|
+
.then(() => {
|
|
491
|
+
return luvio.handleSuccessResponse(() => {
|
|
492
|
+
evictSuccess(luvio, resourceParams);
|
|
493
|
+
return luvio.storeBroadcast();
|
|
494
|
+
}, () => {
|
|
495
|
+
const cache = new StoreKeyMap();
|
|
496
|
+
getResponseCacheKeys$2(cache, luvio, resourceParams);
|
|
497
|
+
return cache;
|
|
498
|
+
});
|
|
499
|
+
}, (response) => {
|
|
500
|
+
deepFreeze(response);
|
|
501
|
+
throw response;
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
const deleteCommerceConfigurationAttributeAdapterFactory = (luvio) => {
|
|
505
|
+
return function commerceConfigurationdeleteCommerceConfigurationAttribute(untrustedConfig) {
|
|
506
|
+
const config = validateAdapterConfig$2(untrustedConfig, deleteCommerceConfigurationAttribute_ConfigPropertyNames);
|
|
507
|
+
// Invalid or incomplete config
|
|
508
|
+
if (config === null) {
|
|
509
|
+
throw new Error(`Invalid config for "${adapterName$2}"`);
|
|
510
|
+
}
|
|
511
|
+
return buildNetworkSnapshot$2(luvio, config);
|
|
512
|
+
};
|
|
513
|
+
};
|
|
514
|
+
|
|
515
|
+
function select$1(luvio, params) {
|
|
516
|
+
return select$2();
|
|
517
|
+
}
|
|
518
|
+
function keyBuilder$1(luvio, params) {
|
|
519
|
+
return keyBuilder$3(luvio, {
|
|
520
|
+
id: params.urlParams.attributeId,
|
|
521
|
+
contextId: params.urlParams.contextId,
|
|
522
|
+
contextType: params.urlParams.contextType
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
526
|
+
getTypeCacheKeys(storeKeyMap, luvio, response);
|
|
527
|
+
}
|
|
528
|
+
function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
|
|
529
|
+
const { body } = response;
|
|
530
|
+
const key = keyBuilder$1(luvio, resourceParams);
|
|
531
|
+
luvio.storeIngest(key, ingest, body);
|
|
532
|
+
const snapshot = luvio.storeLookup({
|
|
533
|
+
recordId: key,
|
|
534
|
+
node: select$1(),
|
|
535
|
+
variables: {},
|
|
536
|
+
}, snapshotRefresh);
|
|
537
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
538
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
539
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
deepFreeze(snapshot.data);
|
|
543
|
+
return snapshot;
|
|
544
|
+
}
|
|
545
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
546
|
+
const key = keyBuilder$1(luvio, params);
|
|
547
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
548
|
+
const storeMetadataParams = {
|
|
549
|
+
ttl: TTL,
|
|
550
|
+
namespace: keyPrefix,
|
|
551
|
+
version: VERSION,
|
|
552
|
+
representationName: RepresentationType
|
|
553
|
+
};
|
|
554
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
555
|
+
return errorSnapshot;
|
|
556
|
+
}
|
|
557
|
+
function createResourceRequest$1(config) {
|
|
558
|
+
const headers = {};
|
|
559
|
+
return {
|
|
560
|
+
baseUri: '/services/data/v66.0',
|
|
561
|
+
basePath: '/commerce/configuration/' + config.urlParams.attributeId + '/' + config.urlParams.contextType + '/' + config.urlParams.contextId + '',
|
|
562
|
+
method: 'get',
|
|
563
|
+
body: null,
|
|
564
|
+
urlParams: config.urlParams,
|
|
565
|
+
queryParams: config.queryParams,
|
|
566
|
+
headers,
|
|
567
|
+
priority: 'normal',
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
function createResourceRequestFromRepresentation(representation) {
|
|
571
|
+
const config = {
|
|
572
|
+
urlParams: {},
|
|
573
|
+
queryParams: {},
|
|
574
|
+
};
|
|
575
|
+
config.urlParams.attributeId = representation.id;
|
|
576
|
+
config.urlParams.contextId = representation.contextId;
|
|
577
|
+
config.urlParams.contextType = representation.contextType;
|
|
578
|
+
return createResourceRequest$1(config);
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
const adapterName$1 = 'getCommerceConfigurationAttribute';
|
|
582
|
+
const getCommerceConfigurationAttribute_ConfigPropertyMetadata = [
|
|
583
|
+
generateParamConfigMetadata('attributeId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
584
|
+
generateParamConfigMetadata('contextId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
585
|
+
generateParamConfigMetadata('contextType', true, 0 /* UrlParameter */, 0 /* String */),
|
|
586
|
+
generateParamConfigMetadata('fallback', false, 1 /* QueryParameter */, 1 /* Boolean */),
|
|
587
|
+
];
|
|
588
|
+
const getCommerceConfigurationAttribute_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getCommerceConfigurationAttribute_ConfigPropertyMetadata);
|
|
589
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(getCommerceConfigurationAttribute_ConfigPropertyMetadata);
|
|
590
|
+
function keyBuilder(luvio, config) {
|
|
591
|
+
const resourceParams = createResourceParams$1(config);
|
|
592
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
593
|
+
}
|
|
594
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
595
|
+
const config = {};
|
|
596
|
+
typeCheckConfig$3(untrustedConfig, config, getCommerceConfigurationAttribute_ConfigPropertyMetadata);
|
|
597
|
+
return config;
|
|
598
|
+
}
|
|
599
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
600
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
601
|
+
return null;
|
|
602
|
+
}
|
|
603
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
604
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
605
|
+
}
|
|
606
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
607
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
608
|
+
return null;
|
|
609
|
+
}
|
|
610
|
+
return config;
|
|
611
|
+
}
|
|
612
|
+
function adapterFragment(luvio, config) {
|
|
613
|
+
createResourceParams$1(config);
|
|
614
|
+
return select$1();
|
|
615
|
+
}
|
|
616
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
617
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
|
|
618
|
+
config,
|
|
619
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
620
|
+
});
|
|
621
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
622
|
+
}
|
|
623
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
624
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
625
|
+
config,
|
|
626
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
627
|
+
});
|
|
628
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
629
|
+
}
|
|
630
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
631
|
+
const resourceParams = createResourceParams$1(config);
|
|
632
|
+
const request = createResourceRequest$1(resourceParams);
|
|
633
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
634
|
+
.then((response) => {
|
|
635
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
636
|
+
const cache = new StoreKeyMap();
|
|
637
|
+
getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
|
|
638
|
+
return cache;
|
|
639
|
+
});
|
|
640
|
+
}, (response) => {
|
|
641
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
645
|
+
return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
|
|
646
|
+
}
|
|
647
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
648
|
+
const { luvio, config } = context;
|
|
649
|
+
const selector = {
|
|
650
|
+
recordId: keyBuilder(luvio, config),
|
|
651
|
+
node: adapterFragment(luvio, config),
|
|
652
|
+
variables: {},
|
|
653
|
+
};
|
|
654
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
655
|
+
config,
|
|
656
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
657
|
+
});
|
|
658
|
+
return cacheSnapshot;
|
|
659
|
+
}
|
|
660
|
+
const getCommerceConfigurationAttributeAdapterFactory = (luvio) => function commerceConfiguration__getCommerceConfigurationAttribute(untrustedConfig, requestContext) {
|
|
661
|
+
const config = validateAdapterConfig$1(untrustedConfig, getCommerceConfigurationAttribute_ConfigPropertyNames);
|
|
662
|
+
// Invalid or incomplete config
|
|
663
|
+
if (config === null) {
|
|
664
|
+
return null;
|
|
665
|
+
}
|
|
666
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
667
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
668
|
+
};
|
|
669
|
+
const notifyChangeFactory = (luvio, options) => {
|
|
670
|
+
return function getCommerceConfigurationByAttributeIdAndContextIdAndContextTypeNotifyChange(configs) {
|
|
671
|
+
const keys = configs.map(c => keyBuilder$3(luvio, c));
|
|
672
|
+
luvio.getNotifyChangeStoreEntries(keys).then(entries => {
|
|
673
|
+
for (let i = 0, len = entries.length; i < len; i++) {
|
|
674
|
+
const { key, record: val } = entries[i];
|
|
675
|
+
const refreshRequest = createResourceRequestFromRepresentation(val);
|
|
676
|
+
luvio.dispatchResourceRequest(refreshRequest, options)
|
|
677
|
+
.then((response) => {
|
|
678
|
+
return luvio.handleSuccessResponse(() => {
|
|
679
|
+
const { body } = response;
|
|
680
|
+
luvio.storeIngest(key, ingest, body);
|
|
681
|
+
return luvio.storeBroadcast();
|
|
682
|
+
}, () => {
|
|
683
|
+
const cache = new StoreKeyMap();
|
|
684
|
+
getTypeCacheKeys(cache, luvio, response.body);
|
|
685
|
+
return cache;
|
|
686
|
+
});
|
|
687
|
+
}, (error) => {
|
|
688
|
+
return luvio.handleErrorResponse(() => {
|
|
689
|
+
const errorSnapshot = luvio.errorSnapshot(error);
|
|
690
|
+
luvio.storeIngestError(key, errorSnapshot, {
|
|
691
|
+
ttl: TTL,
|
|
692
|
+
namespace: keyPrefix,
|
|
693
|
+
version: VERSION,
|
|
694
|
+
representationName: RepresentationType
|
|
695
|
+
});
|
|
696
|
+
return luvio.storeBroadcast().then(() => errorSnapshot);
|
|
697
|
+
});
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
});
|
|
701
|
+
};
|
|
702
|
+
};
|
|
703
|
+
|
|
704
|
+
function select(luvio, params) {
|
|
705
|
+
return select$2();
|
|
706
|
+
}
|
|
707
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
708
|
+
getTypeCacheKeys(storeKeyMap, luvio, response);
|
|
709
|
+
}
|
|
710
|
+
function ingestSuccess(luvio, resourceParams, response) {
|
|
711
|
+
const { body } = response;
|
|
712
|
+
const key = keyBuilderFromType(luvio, body);
|
|
713
|
+
luvio.storeIngest(key, ingest, body);
|
|
714
|
+
const snapshot = luvio.storeLookup({
|
|
715
|
+
recordId: key,
|
|
716
|
+
node: select(),
|
|
717
|
+
variables: {},
|
|
718
|
+
});
|
|
719
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
720
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
721
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
deepFreeze(snapshot.data);
|
|
725
|
+
return snapshot;
|
|
726
|
+
}
|
|
727
|
+
function createResourceRequest(config) {
|
|
728
|
+
const headers = {};
|
|
729
|
+
return {
|
|
730
|
+
baseUri: '/services/data/v66.0',
|
|
731
|
+
basePath: '/commerce/configuration/' + config.urlParams.attributeId + '/' + config.urlParams.contextType + '/' + config.urlParams.contextId + '',
|
|
732
|
+
method: 'put',
|
|
733
|
+
body: config.body,
|
|
734
|
+
urlParams: config.urlParams,
|
|
735
|
+
queryParams: {},
|
|
736
|
+
headers,
|
|
737
|
+
priority: 'normal',
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
const adapterName = 'putCommerceConfigurationAttribute';
|
|
742
|
+
const putCommerceConfigurationAttribute_ConfigPropertyMetadata = [
|
|
743
|
+
generateParamConfigMetadata('attributeId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
744
|
+
generateParamConfigMetadata('contextId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
745
|
+
generateParamConfigMetadata('contextType', true, 0 /* UrlParameter */, 0 /* String */),
|
|
746
|
+
generateParamConfigMetadata('booleanValue', false, 2 /* Body */, 1 /* Boolean */),
|
|
747
|
+
generateParamConfigMetadata('integerValue', false, 2 /* Body */, 3 /* Integer */),
|
|
748
|
+
generateParamConfigMetadata('numberValue', false, 2 /* Body */, 2 /* Number */),
|
|
749
|
+
generateParamConfigMetadata('stringValue', false, 2 /* Body */, 0 /* String */),
|
|
750
|
+
generateParamConfigMetadata('stringValues', false, 2 /* Body */, 0 /* String */, true),
|
|
751
|
+
];
|
|
752
|
+
const putCommerceConfigurationAttribute_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, putCommerceConfigurationAttribute_ConfigPropertyMetadata);
|
|
753
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$3(putCommerceConfigurationAttribute_ConfigPropertyMetadata);
|
|
754
|
+
function typeCheckConfig(untrustedConfig) {
|
|
755
|
+
const config = {};
|
|
756
|
+
typeCheckConfig$3(untrustedConfig, config, putCommerceConfigurationAttribute_ConfigPropertyMetadata);
|
|
757
|
+
return config;
|
|
758
|
+
}
|
|
759
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
760
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
761
|
+
return null;
|
|
762
|
+
}
|
|
763
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
764
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
765
|
+
}
|
|
766
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
767
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
768
|
+
return null;
|
|
769
|
+
}
|
|
770
|
+
return config;
|
|
771
|
+
}
|
|
772
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
773
|
+
const resourceParams = createResourceParams(config);
|
|
774
|
+
const request = createResourceRequest(resourceParams);
|
|
775
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
776
|
+
.then((response) => {
|
|
777
|
+
return luvio.handleSuccessResponse(() => {
|
|
778
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
779
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
780
|
+
}, () => {
|
|
781
|
+
const cache = new StoreKeyMap();
|
|
782
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
783
|
+
return cache;
|
|
784
|
+
});
|
|
785
|
+
}, (response) => {
|
|
786
|
+
deepFreeze(response);
|
|
787
|
+
throw response;
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
const putCommerceConfigurationAttributeAdapterFactory = (luvio) => {
|
|
791
|
+
return function putCommerceConfigurationAttribute(untrustedConfig) {
|
|
792
|
+
const config = validateAdapterConfig(untrustedConfig, putCommerceConfigurationAttribute_ConfigPropertyNames);
|
|
793
|
+
// Invalid or incomplete config
|
|
794
|
+
if (config === null) {
|
|
795
|
+
throw new Error('Invalid config for "putCommerceConfigurationAttribute"');
|
|
796
|
+
}
|
|
797
|
+
return buildNetworkSnapshot(luvio, config);
|
|
798
|
+
};
|
|
799
|
+
};
|
|
800
|
+
|
|
801
|
+
let deleteCommerceConfigurationAttribute;
|
|
802
|
+
let getCommerceConfigurationAttribute;
|
|
803
|
+
let getCommerceConfigurationAttributeNotifyChange;
|
|
804
|
+
let putCommerceConfigurationAttribute;
|
|
805
|
+
// Imperative GET Adapters
|
|
806
|
+
let getCommerceConfigurationAttribute_imperative;
|
|
807
|
+
const getCommerceConfigurationAttributeMetadata = {
|
|
808
|
+
apiFamily: 'commerceconfiguration',
|
|
809
|
+
name: 'getCommerceConfigurationAttribute',
|
|
810
|
+
ttl: 1000,
|
|
811
|
+
};
|
|
812
|
+
// Notify Update Available
|
|
813
|
+
function bindExportsTo(luvio) {
|
|
814
|
+
// LDS Adapters
|
|
815
|
+
const getCommerceConfigurationAttribute_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getCommerceConfigurationAttribute', getCommerceConfigurationAttributeAdapterFactory), getCommerceConfigurationAttributeMetadata);
|
|
816
|
+
function unwrapSnapshotData(factory) {
|
|
817
|
+
const adapter = factory(luvio);
|
|
818
|
+
return (config) => adapter(config).then((snapshot) => snapshot.data);
|
|
819
|
+
}
|
|
820
|
+
return {
|
|
821
|
+
deleteCommerceConfigurationAttribute: createLDSAdapter(luvio, adapterName$2, deleteCommerceConfigurationAttributeAdapterFactory),
|
|
822
|
+
getCommerceConfigurationAttribute: createWireAdapterConstructor(luvio, getCommerceConfigurationAttribute_ldsAdapter, getCommerceConfigurationAttributeMetadata),
|
|
823
|
+
getCommerceConfigurationAttributeNotifyChange: createLDSAdapter(luvio, 'getCommerceConfigurationAttributeNotifyChange', notifyChangeFactory),
|
|
824
|
+
putCommerceConfigurationAttribute: unwrapSnapshotData(putCommerceConfigurationAttributeAdapterFactory),
|
|
825
|
+
// Imperative GET Adapters
|
|
826
|
+
getCommerceConfigurationAttribute_imperative: createImperativeAdapter(luvio, getCommerceConfigurationAttribute_ldsAdapter, getCommerceConfigurationAttributeMetadata),
|
|
827
|
+
// Notify Update Availables
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
withDefaultLuvio((luvio) => {
|
|
831
|
+
({
|
|
832
|
+
deleteCommerceConfigurationAttribute,
|
|
833
|
+
getCommerceConfigurationAttribute,
|
|
834
|
+
getCommerceConfigurationAttributeNotifyChange,
|
|
835
|
+
putCommerceConfigurationAttribute,
|
|
836
|
+
getCommerceConfigurationAttribute_imperative,
|
|
837
|
+
} = bindExportsTo(luvio));
|
|
838
|
+
});
|
|
839
|
+
|
|
840
|
+
export { deleteCommerceConfigurationAttribute, getCommerceConfigurationAttribute, getCommerceConfigurationAttributeNotifyChange, getCommerceConfigurationAttribute_imperative, putCommerceConfigurationAttribute };
|
|
841
|
+
// version: 0.1.0-dev1-c978a7b010
|