@salesforce/lds-adapters-commerce-extensions 1.260.0 → 1.261.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +1 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +2 -0
- package/package.json +4 -4
- package/sfdc/index.d.ts +1 -1
- package/sfdc/index.js +809 -809
- package/dist/es/es2018/types/src/main.d.ts +0 -2
- package/dist/es/es2018/types/src/sfdc.d.ts +0 -3
package/sfdc/index.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
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, ingestShape, deepFreeze,
|
|
17
|
+
import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$8, typeCheckConfig as typeCheckConfig$8, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$5 } from 'force/luvioEngine';
|
|
18
18
|
|
|
19
19
|
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
20
20
|
const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
|
|
@@ -104,111 +104,97 @@ function createLink(ref) {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
const TTL$5 = 60000;
|
|
107
|
-
const VERSION$7 = "
|
|
108
|
-
function validate$7(obj, path = '
|
|
107
|
+
const VERSION$7 = "cef52859122e69e7f8552d6d2fbf67f8";
|
|
108
|
+
function validate$7(obj, path = 'MappingOutputRepresentation') {
|
|
109
109
|
const v_error = (() => {
|
|
110
110
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
111
111
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
112
112
|
}
|
|
113
|
-
const obj_domain = obj.domain;
|
|
114
|
-
const path_domain = path + '.domain';
|
|
115
|
-
if (typeof obj_domain !== 'string') {
|
|
116
|
-
return new TypeError('Expected "string" but received "' + typeof obj_domain + '" (at "' + path_domain + '")');
|
|
117
|
-
}
|
|
118
113
|
const obj_epn = obj.epn;
|
|
119
114
|
const path_epn = path + '.epn';
|
|
120
115
|
if (typeof obj_epn !== 'string') {
|
|
121
116
|
return new TypeError('Expected "string" but received "' + typeof obj_epn + '" (at "' + path_epn + '")');
|
|
122
117
|
}
|
|
123
|
-
const
|
|
124
|
-
const
|
|
125
|
-
if (typeof
|
|
126
|
-
return new TypeError('Expected "string" but received "' + typeof
|
|
118
|
+
const obj_id = obj.id;
|
|
119
|
+
const path_id = path + '.id';
|
|
120
|
+
if (typeof obj_id !== 'string') {
|
|
121
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
127
122
|
}
|
|
128
|
-
const
|
|
129
|
-
const
|
|
130
|
-
if (typeof
|
|
131
|
-
return new TypeError('Expected "string" but received "' + typeof
|
|
123
|
+
const obj_providerName = obj.providerName;
|
|
124
|
+
const path_providerName = path + '.providerName';
|
|
125
|
+
if (typeof obj_providerName !== 'string') {
|
|
126
|
+
return new TypeError('Expected "string" but received "' + typeof obj_providerName + '" (at "' + path_providerName + '")');
|
|
132
127
|
}
|
|
133
|
-
const
|
|
134
|
-
const
|
|
135
|
-
if (typeof
|
|
136
|
-
return new TypeError('Expected "string" but received "' + typeof
|
|
128
|
+
const obj_webstoreId = obj.webstoreId;
|
|
129
|
+
const path_webstoreId = path + '.webstoreId';
|
|
130
|
+
if (typeof obj_webstoreId !== 'string') {
|
|
131
|
+
return new TypeError('Expected "string" but received "' + typeof obj_webstoreId + '" (at "' + path_webstoreId + '")');
|
|
137
132
|
}
|
|
138
133
|
})();
|
|
139
134
|
return v_error === undefined ? null : v_error;
|
|
140
135
|
}
|
|
141
|
-
const RepresentationType$5 = '
|
|
136
|
+
const RepresentationType$5 = 'MappingOutputRepresentation';
|
|
142
137
|
function keyBuilder$d(luvio, config) {
|
|
143
|
-
return keyPrefix + '::' + RepresentationType$5 + ':' + config.
|
|
138
|
+
return keyPrefix + '::' + RepresentationType$5 + ':' + config.id;
|
|
144
139
|
}
|
|
145
140
|
function keyBuilderFromType$2(luvio, object) {
|
|
146
141
|
const keyParams = {
|
|
147
|
-
|
|
142
|
+
id: object.id
|
|
148
143
|
};
|
|
149
144
|
return keyBuilder$d(luvio, keyParams);
|
|
150
145
|
}
|
|
151
146
|
function normalize$5(input, existing, path, luvio, store, timestamp) {
|
|
152
147
|
return input;
|
|
153
148
|
}
|
|
154
|
-
const select$e = function
|
|
149
|
+
const select$e = function MappingOutputRepresentationSelect() {
|
|
155
150
|
return {
|
|
156
151
|
kind: 'Fragment',
|
|
157
152
|
version: VERSION$7,
|
|
158
153
|
private: [],
|
|
159
154
|
selections: [
|
|
160
|
-
{
|
|
161
|
-
name: 'domain',
|
|
162
|
-
kind: 'Scalar'
|
|
163
|
-
},
|
|
164
155
|
{
|
|
165
156
|
name: 'epn',
|
|
166
157
|
kind: 'Scalar'
|
|
167
158
|
},
|
|
168
159
|
{
|
|
169
|
-
name: '
|
|
160
|
+
name: 'id',
|
|
170
161
|
kind: 'Scalar'
|
|
171
162
|
},
|
|
172
163
|
{
|
|
173
|
-
name: '
|
|
164
|
+
name: 'providerName',
|
|
174
165
|
kind: 'Scalar'
|
|
175
166
|
},
|
|
176
167
|
{
|
|
177
|
-
name: '
|
|
168
|
+
name: 'webstoreId',
|
|
178
169
|
kind: 'Scalar'
|
|
179
170
|
}
|
|
180
171
|
]
|
|
181
172
|
};
|
|
182
173
|
};
|
|
183
174
|
function equals$7(existing, incoming) {
|
|
184
|
-
const existing_domain = existing.domain;
|
|
185
|
-
const incoming_domain = incoming.domain;
|
|
186
|
-
if (!(existing_domain === incoming_domain)) {
|
|
187
|
-
return false;
|
|
188
|
-
}
|
|
189
175
|
const existing_epn = existing.epn;
|
|
190
176
|
const incoming_epn = incoming.epn;
|
|
191
177
|
if (!(existing_epn === incoming_epn)) {
|
|
192
178
|
return false;
|
|
193
179
|
}
|
|
194
|
-
const
|
|
195
|
-
const
|
|
196
|
-
if (!(
|
|
180
|
+
const existing_id = existing.id;
|
|
181
|
+
const incoming_id = incoming.id;
|
|
182
|
+
if (!(existing_id === incoming_id)) {
|
|
197
183
|
return false;
|
|
198
184
|
}
|
|
199
|
-
const
|
|
200
|
-
const
|
|
201
|
-
if (!(
|
|
185
|
+
const existing_providerName = existing.providerName;
|
|
186
|
+
const incoming_providerName = incoming.providerName;
|
|
187
|
+
if (!(existing_providerName === incoming_providerName)) {
|
|
202
188
|
return false;
|
|
203
189
|
}
|
|
204
|
-
const
|
|
205
|
-
const
|
|
206
|
-
if (!(
|
|
190
|
+
const existing_webstoreId = existing.webstoreId;
|
|
191
|
+
const incoming_webstoreId = incoming.webstoreId;
|
|
192
|
+
if (!(existing_webstoreId === incoming_webstoreId)) {
|
|
207
193
|
return false;
|
|
208
194
|
}
|
|
209
195
|
return true;
|
|
210
196
|
}
|
|
211
|
-
const ingest$5 = function
|
|
197
|
+
const ingest$5 = function MappingOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
212
198
|
if (process.env.NODE_ENV !== 'production') {
|
|
213
199
|
const validateError = validate$7(input);
|
|
214
200
|
if (validateError !== null) {
|
|
@@ -229,135 +215,36 @@ function getTypeCacheKeys$5(rootKeySet, luvio, input, fullPathFactory) {
|
|
|
229
215
|
mergeable: false
|
|
230
216
|
});
|
|
231
217
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
const path_count = path + '.count';
|
|
242
|
-
if (typeof obj_count !== 'number' || (typeof obj_count === 'number' && Math.floor(obj_count) !== obj_count)) {
|
|
243
|
-
return new TypeError('Expected "integer" but received "' + typeof obj_count + '" (at "' + path_count + '")');
|
|
244
|
-
}
|
|
245
|
-
const obj_items = obj.items;
|
|
246
|
-
const path_items = path + '.items';
|
|
247
|
-
if (!ArrayIsArray(obj_items)) {
|
|
248
|
-
return new TypeError('Expected "array" but received "' + typeof obj_items + '" (at "' + path_items + '")');
|
|
249
|
-
}
|
|
250
|
-
for (let i = 0; i < obj_items.length; i++) {
|
|
251
|
-
const obj_items_item = obj_items[i];
|
|
252
|
-
const path_items_item = path_items + '[' + i + ']';
|
|
253
|
-
if (typeof obj_items_item !== 'object') {
|
|
254
|
-
return new TypeError('Expected "object" but received "' + typeof obj_items_item + '" (at "' + path_items_item + '")');
|
|
255
|
-
}
|
|
218
|
+
const notifyUpdateAvailableFactory = (luvio) => {
|
|
219
|
+
return function notifyMappingUpdateAvailable(configs) {
|
|
220
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
221
|
+
const requiredKeyParams = ['id'];
|
|
222
|
+
configs.forEach(config => {
|
|
223
|
+
if (false === requiredKeyParams.every(req => req in config)) {
|
|
224
|
+
throw new Error(`one of the configs did not contain all required parameters: ${JSONStringify(ObjectKeys(config))}`);
|
|
225
|
+
}
|
|
226
|
+
});
|
|
256
227
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}
|
|
260
|
-
const RepresentationType$4 = 'ExtensionOutputCollectionRepresentation';
|
|
261
|
-
function normalize$4(input, existing, path, luvio, store, timestamp) {
|
|
262
|
-
const input_items = input.items;
|
|
263
|
-
const input_items_id = path.fullPath + '__items';
|
|
264
|
-
for (let i = 0; i < input_items.length; i++) {
|
|
265
|
-
const input_items_item = input_items[i];
|
|
266
|
-
let input_items_item_id = input_items_id + '__' + i;
|
|
267
|
-
input_items[i] = ingest$5(input_items_item, {
|
|
268
|
-
fullPath: input_items_item_id,
|
|
269
|
-
propertyName: i,
|
|
270
|
-
parent: {
|
|
271
|
-
data: input,
|
|
272
|
-
key: path.fullPath,
|
|
273
|
-
existing: existing,
|
|
274
|
-
},
|
|
275
|
-
ttl: path.ttl
|
|
276
|
-
}, luvio, store, timestamp);
|
|
277
|
-
}
|
|
278
|
-
return input;
|
|
279
|
-
}
|
|
280
|
-
const select$d = function ExtensionOutputCollectionRepresentationSelect() {
|
|
281
|
-
return {
|
|
282
|
-
kind: 'Fragment',
|
|
283
|
-
version: VERSION$6,
|
|
284
|
-
private: [],
|
|
285
|
-
selections: [
|
|
286
|
-
{
|
|
287
|
-
name: 'count',
|
|
288
|
-
kind: 'Scalar'
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
name: 'items',
|
|
292
|
-
kind: 'Link',
|
|
293
|
-
plural: true,
|
|
294
|
-
fragment: select$e()
|
|
295
|
-
}
|
|
296
|
-
]
|
|
228
|
+
const keys = configs.map(c => keyBuilder$d(luvio, c));
|
|
229
|
+
return luvio.notifyStoreUpdateAvailable(keys);
|
|
297
230
|
};
|
|
298
231
|
};
|
|
299
|
-
function equals$6(existing, incoming) {
|
|
300
|
-
const existing_count = existing.count;
|
|
301
|
-
const incoming_count = incoming.count;
|
|
302
|
-
if (!(existing_count === incoming_count)) {
|
|
303
|
-
return false;
|
|
304
|
-
}
|
|
305
|
-
const existing_items = existing.items;
|
|
306
|
-
const incoming_items = incoming.items;
|
|
307
|
-
const equals_items_items = equalsArray(existing_items, incoming_items, (existing_items_item, incoming_items_item) => {
|
|
308
|
-
if (!(existing_items_item.__ref === incoming_items_item.__ref)) {
|
|
309
|
-
return false;
|
|
310
|
-
}
|
|
311
|
-
});
|
|
312
|
-
if (equals_items_items === false) {
|
|
313
|
-
return false;
|
|
314
|
-
}
|
|
315
|
-
return true;
|
|
316
|
-
}
|
|
317
|
-
const ingest$4 = function ExtensionOutputCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
318
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
319
|
-
const validateError = validate$6(input);
|
|
320
|
-
if (validateError !== null) {
|
|
321
|
-
throw validateError;
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
const key = path.fullPath;
|
|
325
|
-
const ttlToUse = TTL$4;
|
|
326
|
-
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$4, "extensions", VERSION$6, RepresentationType$4, equals$6);
|
|
327
|
-
return createLink(key);
|
|
328
|
-
};
|
|
329
|
-
function getTypeCacheKeys$4(rootKeySet, luvio, input, fullPathFactory) {
|
|
330
|
-
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
331
|
-
const rootKey = fullPathFactory();
|
|
332
|
-
rootKeySet.set(rootKey, {
|
|
333
|
-
namespace: keyPrefix,
|
|
334
|
-
representationName: RepresentationType$4,
|
|
335
|
-
mergeable: false
|
|
336
|
-
});
|
|
337
|
-
const input_items_length = input.items.length;
|
|
338
|
-
for (let i = 0; i < input_items_length; i++) {
|
|
339
|
-
getTypeCacheKeys$5(rootKeySet, luvio, input.items[i]);
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
232
|
|
|
343
|
-
function select$
|
|
344
|
-
return select$
|
|
345
|
-
}
|
|
346
|
-
function keyBuilder$c(luvio, params) {
|
|
347
|
-
return keyPrefix + '::ExtensionOutputCollectionRepresentation:(' + ')';
|
|
233
|
+
function select$d(luvio, params) {
|
|
234
|
+
return select$e();
|
|
348
235
|
}
|
|
349
236
|
function getResponseCacheKeys$7(storeKeyMap, luvio, resourceParams, response) {
|
|
350
|
-
getTypeCacheKeys$
|
|
237
|
+
getTypeCacheKeys$5(storeKeyMap, luvio, response);
|
|
351
238
|
}
|
|
352
|
-
function ingestSuccess$6(luvio, resourceParams, response
|
|
239
|
+
function ingestSuccess$6(luvio, resourceParams, response) {
|
|
353
240
|
const { body } = response;
|
|
354
|
-
const key =
|
|
355
|
-
luvio.storeIngest(key, ingest$
|
|
241
|
+
const key = keyBuilderFromType$2(luvio, body);
|
|
242
|
+
luvio.storeIngest(key, ingest$5, body);
|
|
356
243
|
const snapshot = luvio.storeLookup({
|
|
357
244
|
recordId: key,
|
|
358
|
-
node: select$
|
|
245
|
+
node: select$d(),
|
|
359
246
|
variables: {},
|
|
360
|
-
}
|
|
247
|
+
});
|
|
361
248
|
if (process.env.NODE_ENV !== 'production') {
|
|
362
249
|
if (snapshot.state !== 'Fulfilled') {
|
|
363
250
|
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
@@ -366,25 +253,13 @@ function ingestSuccess$6(luvio, resourceParams, response, snapshotRefresh) {
|
|
|
366
253
|
deepFreeze(snapshot.data);
|
|
367
254
|
return snapshot;
|
|
368
255
|
}
|
|
369
|
-
function ingestError$4(luvio, params, error, snapshotRefresh) {
|
|
370
|
-
const key = keyBuilder$c();
|
|
371
|
-
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
372
|
-
const storeMetadataParams = {
|
|
373
|
-
ttl: TTL$4,
|
|
374
|
-
namespace: keyPrefix,
|
|
375
|
-
version: VERSION$6,
|
|
376
|
-
representationName: RepresentationType$4
|
|
377
|
-
};
|
|
378
|
-
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
379
|
-
return errorSnapshot;
|
|
380
|
-
}
|
|
381
256
|
function createResourceRequest$7(config) {
|
|
382
257
|
const headers = {};
|
|
383
258
|
return {
|
|
384
259
|
baseUri: '/services/data/v60.0',
|
|
385
|
-
basePath: '/commerce/extension/
|
|
386
|
-
method: '
|
|
387
|
-
body:
|
|
260
|
+
basePath: '/commerce/extension/mappings',
|
|
261
|
+
method: 'post',
|
|
262
|
+
body: config.body,
|
|
388
263
|
urlParams: {},
|
|
389
264
|
queryParams: {},
|
|
390
265
|
headers,
|
|
@@ -392,16 +267,18 @@ function createResourceRequest$7(config) {
|
|
|
392
267
|
};
|
|
393
268
|
}
|
|
394
269
|
|
|
395
|
-
const adapterName$7 = '
|
|
396
|
-
const
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
270
|
+
const adapterName$7 = 'createMapping';
|
|
271
|
+
const createMapping_ConfigPropertyMetadata = [
|
|
272
|
+
generateParamConfigMetadata('epn', true, 2 /* Body */, 0 /* String */),
|
|
273
|
+
generateParamConfigMetadata('id', false, 2 /* Body */, 0 /* String */),
|
|
274
|
+
generateParamConfigMetadata('providerName', true, 2 /* Body */, 0 /* String */),
|
|
275
|
+
generateParamConfigMetadata('webstoreId', true, 2 /* Body */, 0 /* String */),
|
|
276
|
+
];
|
|
277
|
+
const createMapping_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$7, createMapping_ConfigPropertyMetadata);
|
|
278
|
+
const createResourceParams$7 = /*#__PURE__*/ createResourceParams$8(createMapping_ConfigPropertyMetadata);
|
|
403
279
|
function typeCheckConfig$7(untrustedConfig) {
|
|
404
280
|
const config = {};
|
|
281
|
+
typeCheckConfig$8(untrustedConfig, config, createMapping_ConfigPropertyMetadata);
|
|
405
282
|
return config;
|
|
406
283
|
}
|
|
407
284
|
function validateAdapterConfig$7(untrustedConfig, configPropertyNames) {
|
|
@@ -411,200 +288,255 @@ function validateAdapterConfig$7(untrustedConfig, configPropertyNames) {
|
|
|
411
288
|
if (process.env.NODE_ENV !== 'production') {
|
|
412
289
|
validateConfig(untrustedConfig, configPropertyNames);
|
|
413
290
|
}
|
|
414
|
-
const config = typeCheckConfig$7();
|
|
291
|
+
const config = typeCheckConfig$7(untrustedConfig);
|
|
415
292
|
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
416
293
|
return null;
|
|
417
294
|
}
|
|
418
295
|
return config;
|
|
419
296
|
}
|
|
420
|
-
function adapterFragment$4(luvio, config) {
|
|
421
|
-
createResourceParams$7(config);
|
|
422
|
-
return select$c();
|
|
423
|
-
}
|
|
424
|
-
function onFetchResponseSuccess$4(luvio, config, resourceParams, response) {
|
|
425
|
-
const snapshot = ingestSuccess$6(luvio, resourceParams, response, {
|
|
426
|
-
config,
|
|
427
|
-
resolve: () => buildNetworkSnapshot$7(luvio, config, snapshotRefreshOptions)
|
|
428
|
-
});
|
|
429
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
430
|
-
}
|
|
431
|
-
function onFetchResponseError$4(luvio, config, resourceParams, response) {
|
|
432
|
-
const snapshot = ingestError$4(luvio, resourceParams, response, {
|
|
433
|
-
config,
|
|
434
|
-
resolve: () => buildNetworkSnapshot$7(luvio, config, snapshotRefreshOptions)
|
|
435
|
-
});
|
|
436
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
437
|
-
}
|
|
438
297
|
function buildNetworkSnapshot$7(luvio, config, options) {
|
|
439
298
|
const resourceParams = createResourceParams$7(config);
|
|
440
|
-
const request = createResourceRequest$7();
|
|
299
|
+
const request = createResourceRequest$7(resourceParams);
|
|
441
300
|
return luvio.dispatchResourceRequest(request, options)
|
|
442
301
|
.then((response) => {
|
|
443
|
-
return luvio.handleSuccessResponse(() =>
|
|
302
|
+
return luvio.handleSuccessResponse(() => {
|
|
303
|
+
const snapshot = ingestSuccess$6(luvio, resourceParams, response);
|
|
304
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
305
|
+
}, () => {
|
|
444
306
|
const cache = new StoreKeyMap();
|
|
445
307
|
getResponseCacheKeys$7(cache, luvio, resourceParams, response.body);
|
|
446
308
|
return cache;
|
|
447
309
|
});
|
|
448
310
|
}, (response) => {
|
|
449
|
-
|
|
311
|
+
deepFreeze(response);
|
|
312
|
+
throw response;
|
|
450
313
|
});
|
|
451
314
|
}
|
|
452
|
-
|
|
453
|
-
return
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
variables: {},
|
|
315
|
+
const createMappingAdapterFactory = (luvio) => {
|
|
316
|
+
return function createMapping(untrustedConfig) {
|
|
317
|
+
const config = validateAdapterConfig$7(untrustedConfig, createMapping_ConfigPropertyNames);
|
|
318
|
+
// Invalid or incomplete config
|
|
319
|
+
if (config === null) {
|
|
320
|
+
throw new Error('Invalid config for "createMapping"');
|
|
321
|
+
}
|
|
322
|
+
return buildNetworkSnapshot$7(luvio, config);
|
|
461
323
|
};
|
|
462
|
-
const cacheSnapshot = storeLookup(selector, {
|
|
463
|
-
config,
|
|
464
|
-
resolve: () => buildNetworkSnapshot$7(luvio, config, snapshotRefreshOptions)
|
|
465
|
-
});
|
|
466
|
-
return cacheSnapshot;
|
|
467
|
-
}
|
|
468
|
-
const getExtensionsAdapterFactory = (luvio) => function extensions__getExtensions(untrustedConfig, requestContext) {
|
|
469
|
-
const config = validateAdapterConfig$7(untrustedConfig, getExtensions_ConfigPropertyNames);
|
|
470
|
-
// Invalid or incomplete config
|
|
471
|
-
if (config === null) {
|
|
472
|
-
return null;
|
|
473
|
-
}
|
|
474
|
-
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
475
|
-
buildCachedSnapshotCachePolicy$4, buildNetworkSnapshotCachePolicy$4);
|
|
476
324
|
};
|
|
477
325
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
326
|
+
function keyBuilder$c(luvio, params) {
|
|
327
|
+
return keyBuilder$d(luvio, {
|
|
328
|
+
id: params.urlParams.mappingId
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
function getResponseCacheKeys$6(cacheKeyMap, luvio, resourceParams) {
|
|
332
|
+
const key = keyBuilder$c(luvio, resourceParams);
|
|
333
|
+
cacheKeyMap.set(key, {
|
|
334
|
+
namespace: keyPrefix,
|
|
335
|
+
representationName: RepresentationType$5,
|
|
336
|
+
mergeable: false
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
function evictSuccess(luvio, resourceParams) {
|
|
340
|
+
const key = keyBuilder$c(luvio, resourceParams);
|
|
341
|
+
luvio.storeEvict(key);
|
|
342
|
+
}
|
|
343
|
+
function createResourceRequest$6(config) {
|
|
344
|
+
const headers = {};
|
|
345
|
+
return {
|
|
346
|
+
baseUri: '/services/data/v60.0',
|
|
347
|
+
basePath: '/commerce/extension/mappings/' + config.urlParams.mappingId + '',
|
|
348
|
+
method: 'delete',
|
|
349
|
+
body: null,
|
|
350
|
+
urlParams: config.urlParams,
|
|
351
|
+
queryParams: {},
|
|
352
|
+
headers,
|
|
353
|
+
priority: 'normal',
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
const adapterName$6 = 'deleteMapping';
|
|
358
|
+
const deleteMapping_ConfigPropertyMetadata = [
|
|
359
|
+
generateParamConfigMetadata('mappingId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
360
|
+
];
|
|
361
|
+
const deleteMapping_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$6, deleteMapping_ConfigPropertyMetadata);
|
|
362
|
+
const createResourceParams$6 = /*#__PURE__*/ createResourceParams$8(deleteMapping_ConfigPropertyMetadata);
|
|
363
|
+
function typeCheckConfig$6(untrustedConfig) {
|
|
364
|
+
const config = {};
|
|
365
|
+
typeCheckConfig$8(untrustedConfig, config, deleteMapping_ConfigPropertyMetadata);
|
|
366
|
+
return config;
|
|
367
|
+
}
|
|
368
|
+
function validateAdapterConfig$6(untrustedConfig, configPropertyNames) {
|
|
369
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
370
|
+
return null;
|
|
371
|
+
}
|
|
372
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
373
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
374
|
+
}
|
|
375
|
+
const config = typeCheckConfig$6(untrustedConfig);
|
|
376
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
377
|
+
return null;
|
|
378
|
+
}
|
|
379
|
+
return config;
|
|
380
|
+
}
|
|
381
|
+
function buildNetworkSnapshot$6(luvio, config, options) {
|
|
382
|
+
const resourceParams = createResourceParams$6(config);
|
|
383
|
+
const request = createResourceRequest$6(resourceParams);
|
|
384
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
385
|
+
.then(() => {
|
|
386
|
+
return luvio.handleSuccessResponse(() => {
|
|
387
|
+
evictSuccess(luvio, resourceParams);
|
|
388
|
+
return luvio.storeBroadcast();
|
|
389
|
+
}, () => {
|
|
390
|
+
const cache = new StoreKeyMap();
|
|
391
|
+
getResponseCacheKeys$6(cache, luvio, resourceParams);
|
|
392
|
+
return cache;
|
|
393
|
+
});
|
|
394
|
+
}, (response) => {
|
|
395
|
+
deepFreeze(response);
|
|
396
|
+
throw response;
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
const deleteMappingAdapterFactory = (luvio) => {
|
|
400
|
+
return function extensionsdeleteMapping(untrustedConfig) {
|
|
401
|
+
const config = validateAdapterConfig$6(untrustedConfig, deleteMapping_ConfigPropertyNames);
|
|
402
|
+
// Invalid or incomplete config
|
|
403
|
+
if (config === null) {
|
|
404
|
+
throw new Error(`Invalid config for "${adapterName$6}"`);
|
|
405
|
+
}
|
|
406
|
+
return buildNetworkSnapshot$6(luvio, config);
|
|
407
|
+
};
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
const TTL$4 = 60000;
|
|
411
|
+
const VERSION$6 = "851ba1c62498092f7289da5b20b692d8";
|
|
412
|
+
function validate$6(obj, path = 'ExtensionOutputRepresentation') {
|
|
413
|
+
const v_error = (() => {
|
|
414
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
415
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
416
|
+
}
|
|
417
|
+
const obj_domain = obj.domain;
|
|
418
|
+
const path_domain = path + '.domain';
|
|
419
|
+
if (typeof obj_domain !== 'string') {
|
|
420
|
+
return new TypeError('Expected "string" but received "' + typeof obj_domain + '" (at "' + path_domain + '")');
|
|
421
|
+
}
|
|
485
422
|
const obj_epn = obj.epn;
|
|
486
423
|
const path_epn = path + '.epn';
|
|
487
424
|
if (typeof obj_epn !== 'string') {
|
|
488
425
|
return new TypeError('Expected "string" but received "' + typeof obj_epn + '" (at "' + path_epn + '")');
|
|
489
426
|
}
|
|
490
|
-
const
|
|
491
|
-
const
|
|
492
|
-
if (typeof
|
|
493
|
-
return new TypeError('Expected "string" but received "' + typeof
|
|
427
|
+
const obj_name = obj.name;
|
|
428
|
+
const path_name = path + '.name';
|
|
429
|
+
if (typeof obj_name !== 'string') {
|
|
430
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
494
431
|
}
|
|
495
|
-
const
|
|
496
|
-
const
|
|
497
|
-
if (typeof
|
|
498
|
-
return new TypeError('Expected "string" but received "' + typeof
|
|
432
|
+
const obj_product = obj.product;
|
|
433
|
+
const path_product = path + '.product';
|
|
434
|
+
if (typeof obj_product !== 'string') {
|
|
435
|
+
return new TypeError('Expected "string" but received "' + typeof obj_product + '" (at "' + path_product + '")');
|
|
499
436
|
}
|
|
500
|
-
const
|
|
501
|
-
const
|
|
502
|
-
if (typeof
|
|
503
|
-
return new TypeError('Expected "string" but received "' + typeof
|
|
437
|
+
const obj_type = obj.type;
|
|
438
|
+
const path_type = path + '.type';
|
|
439
|
+
if (typeof obj_type !== 'string') {
|
|
440
|
+
return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
|
|
504
441
|
}
|
|
505
442
|
})();
|
|
506
443
|
return v_error === undefined ? null : v_error;
|
|
507
444
|
}
|
|
508
|
-
const RepresentationType$
|
|
509
|
-
function keyBuilder$
|
|
510
|
-
return keyPrefix + '::' + RepresentationType$
|
|
445
|
+
const RepresentationType$4 = 'ExtensionOutputRepresentation';
|
|
446
|
+
function keyBuilder$b(luvio, config) {
|
|
447
|
+
return keyPrefix + '::' + RepresentationType$4 + ':' + config.epn;
|
|
511
448
|
}
|
|
512
449
|
function keyBuilderFromType$1(luvio, object) {
|
|
513
450
|
const keyParams = {
|
|
514
|
-
|
|
451
|
+
epn: object.epn
|
|
515
452
|
};
|
|
516
|
-
return keyBuilder$
|
|
453
|
+
return keyBuilder$b(luvio, keyParams);
|
|
517
454
|
}
|
|
518
|
-
function normalize$
|
|
455
|
+
function normalize$4(input, existing, path, luvio, store, timestamp) {
|
|
519
456
|
return input;
|
|
520
457
|
}
|
|
521
|
-
const select$
|
|
458
|
+
const select$c = function ExtensionOutputRepresentationSelect() {
|
|
522
459
|
return {
|
|
523
460
|
kind: 'Fragment',
|
|
524
|
-
version: VERSION$
|
|
461
|
+
version: VERSION$6,
|
|
525
462
|
private: [],
|
|
526
463
|
selections: [
|
|
464
|
+
{
|
|
465
|
+
name: 'domain',
|
|
466
|
+
kind: 'Scalar'
|
|
467
|
+
},
|
|
527
468
|
{
|
|
528
469
|
name: 'epn',
|
|
529
470
|
kind: 'Scalar'
|
|
530
471
|
},
|
|
531
472
|
{
|
|
532
|
-
name: '
|
|
473
|
+
name: 'name',
|
|
533
474
|
kind: 'Scalar'
|
|
534
475
|
},
|
|
535
476
|
{
|
|
536
|
-
name: '
|
|
477
|
+
name: 'product',
|
|
537
478
|
kind: 'Scalar'
|
|
538
479
|
},
|
|
539
480
|
{
|
|
540
|
-
name: '
|
|
481
|
+
name: 'type',
|
|
541
482
|
kind: 'Scalar'
|
|
542
483
|
}
|
|
543
484
|
]
|
|
544
485
|
};
|
|
545
486
|
};
|
|
546
|
-
function equals$
|
|
487
|
+
function equals$6(existing, incoming) {
|
|
488
|
+
const existing_domain = existing.domain;
|
|
489
|
+
const incoming_domain = incoming.domain;
|
|
490
|
+
if (!(existing_domain === incoming_domain)) {
|
|
491
|
+
return false;
|
|
492
|
+
}
|
|
547
493
|
const existing_epn = existing.epn;
|
|
548
494
|
const incoming_epn = incoming.epn;
|
|
549
495
|
if (!(existing_epn === incoming_epn)) {
|
|
550
496
|
return false;
|
|
551
497
|
}
|
|
552
|
-
const
|
|
553
|
-
const
|
|
554
|
-
if (!(
|
|
498
|
+
const existing_name = existing.name;
|
|
499
|
+
const incoming_name = incoming.name;
|
|
500
|
+
if (!(existing_name === incoming_name)) {
|
|
555
501
|
return false;
|
|
556
502
|
}
|
|
557
|
-
const
|
|
558
|
-
const
|
|
559
|
-
if (!(
|
|
503
|
+
const existing_product = existing.product;
|
|
504
|
+
const incoming_product = incoming.product;
|
|
505
|
+
if (!(existing_product === incoming_product)) {
|
|
560
506
|
return false;
|
|
561
507
|
}
|
|
562
|
-
const
|
|
563
|
-
const
|
|
564
|
-
if (!(
|
|
508
|
+
const existing_type = existing.type;
|
|
509
|
+
const incoming_type = incoming.type;
|
|
510
|
+
if (!(existing_type === incoming_type)) {
|
|
565
511
|
return false;
|
|
566
512
|
}
|
|
567
513
|
return true;
|
|
568
514
|
}
|
|
569
|
-
const ingest$
|
|
515
|
+
const ingest$4 = function ExtensionOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
570
516
|
if (process.env.NODE_ENV !== 'production') {
|
|
571
|
-
const validateError = validate$
|
|
517
|
+
const validateError = validate$6(input);
|
|
572
518
|
if (validateError !== null) {
|
|
573
519
|
throw validateError;
|
|
574
520
|
}
|
|
575
521
|
}
|
|
576
522
|
const key = keyBuilderFromType$1(luvio, input);
|
|
577
|
-
const ttlToUse = TTL$
|
|
578
|
-
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$
|
|
523
|
+
const ttlToUse = TTL$4;
|
|
524
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$4, "extensions", VERSION$6, RepresentationType$4, equals$6);
|
|
579
525
|
return createLink(key);
|
|
580
526
|
};
|
|
581
|
-
function getTypeCacheKeys$
|
|
527
|
+
function getTypeCacheKeys$4(rootKeySet, luvio, input, fullPathFactory) {
|
|
582
528
|
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
583
529
|
const rootKey = keyBuilderFromType$1(luvio, input);
|
|
584
530
|
rootKeySet.set(rootKey, {
|
|
585
531
|
namespace: keyPrefix,
|
|
586
|
-
representationName: RepresentationType$
|
|
532
|
+
representationName: RepresentationType$4,
|
|
587
533
|
mergeable: false
|
|
588
534
|
});
|
|
589
535
|
}
|
|
590
|
-
const notifyUpdateAvailableFactory = (luvio) => {
|
|
591
|
-
return function notifyMappingUpdateAvailable(configs) {
|
|
592
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
593
|
-
const requiredKeyParams = ['id'];
|
|
594
|
-
configs.forEach(config => {
|
|
595
|
-
if (false === requiredKeyParams.every(req => req in config)) {
|
|
596
|
-
throw new Error(`one of the configs did not contain all required parameters: ${JSONStringify(ObjectKeys(config))}`);
|
|
597
|
-
}
|
|
598
|
-
});
|
|
599
|
-
}
|
|
600
|
-
const keys = configs.map(c => keyBuilder$a(luvio, c));
|
|
601
|
-
return luvio.notifyStoreUpdateAvailable(keys);
|
|
602
|
-
};
|
|
603
|
-
};
|
|
604
536
|
|
|
605
|
-
const TTL$
|
|
606
|
-
const VERSION$
|
|
607
|
-
function validate$
|
|
537
|
+
const TTL$3 = 60000;
|
|
538
|
+
const VERSION$5 = "d4f70ccafbea6d39e182d71c60d4ba89";
|
|
539
|
+
function validate$5(obj, path = 'ExtensionOutputCollectionRepresentation') {
|
|
608
540
|
const v_error = (() => {
|
|
609
541
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
610
542
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
@@ -629,14 +561,14 @@ function validate$4(obj, path = 'MappingOutputCollectionRepresentation') {
|
|
|
629
561
|
})();
|
|
630
562
|
return v_error === undefined ? null : v_error;
|
|
631
563
|
}
|
|
632
|
-
const RepresentationType$
|
|
633
|
-
function normalize$
|
|
564
|
+
const RepresentationType$3 = 'ExtensionOutputCollectionRepresentation';
|
|
565
|
+
function normalize$3(input, existing, path, luvio, store, timestamp) {
|
|
634
566
|
const input_items = input.items;
|
|
635
567
|
const input_items_id = path.fullPath + '__items';
|
|
636
568
|
for (let i = 0; i < input_items.length; i++) {
|
|
637
569
|
const input_items_item = input_items[i];
|
|
638
570
|
let input_items_item_id = input_items_id + '__' + i;
|
|
639
|
-
input_items[i] = ingest$
|
|
571
|
+
input_items[i] = ingest$4(input_items_item, {
|
|
640
572
|
fullPath: input_items_item_id,
|
|
641
573
|
propertyName: i,
|
|
642
574
|
parent: {
|
|
@@ -649,10 +581,10 @@ function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
|
649
581
|
}
|
|
650
582
|
return input;
|
|
651
583
|
}
|
|
652
|
-
const select$
|
|
584
|
+
const select$b = function ExtensionOutputCollectionRepresentationSelect() {
|
|
653
585
|
return {
|
|
654
586
|
kind: 'Fragment',
|
|
655
|
-
version: VERSION$
|
|
587
|
+
version: VERSION$5,
|
|
656
588
|
private: [],
|
|
657
589
|
selections: [
|
|
658
590
|
{
|
|
@@ -663,12 +595,12 @@ const select$a = function MappingOutputCollectionRepresentationSelect() {
|
|
|
663
595
|
name: 'items',
|
|
664
596
|
kind: 'Link',
|
|
665
597
|
plural: true,
|
|
666
|
-
fragment: select$
|
|
598
|
+
fragment: select$c()
|
|
667
599
|
}
|
|
668
600
|
]
|
|
669
601
|
};
|
|
670
602
|
};
|
|
671
|
-
function equals$
|
|
603
|
+
function equals$5(existing, incoming) {
|
|
672
604
|
const existing_count = existing.count;
|
|
673
605
|
const incoming_count = incoming.count;
|
|
674
606
|
if (!(existing_count === incoming_count)) {
|
|
@@ -686,48 +618,48 @@ function equals$4(existing, incoming) {
|
|
|
686
618
|
}
|
|
687
619
|
return true;
|
|
688
620
|
}
|
|
689
|
-
const ingest$
|
|
621
|
+
const ingest$3 = function ExtensionOutputCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
690
622
|
if (process.env.NODE_ENV !== 'production') {
|
|
691
|
-
const validateError = validate$
|
|
623
|
+
const validateError = validate$5(input);
|
|
692
624
|
if (validateError !== null) {
|
|
693
625
|
throw validateError;
|
|
694
626
|
}
|
|
695
627
|
}
|
|
696
628
|
const key = path.fullPath;
|
|
697
|
-
const ttlToUse = TTL$
|
|
698
|
-
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$
|
|
629
|
+
const ttlToUse = TTL$3;
|
|
630
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$3, "extensions", VERSION$5, RepresentationType$3, equals$5);
|
|
699
631
|
return createLink(key);
|
|
700
632
|
};
|
|
701
|
-
function getTypeCacheKeys$
|
|
633
|
+
function getTypeCacheKeys$3(rootKeySet, luvio, input, fullPathFactory) {
|
|
702
634
|
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
703
635
|
const rootKey = fullPathFactory();
|
|
704
636
|
rootKeySet.set(rootKey, {
|
|
705
637
|
namespace: keyPrefix,
|
|
706
|
-
representationName: RepresentationType$
|
|
638
|
+
representationName: RepresentationType$3,
|
|
707
639
|
mergeable: false
|
|
708
640
|
});
|
|
709
641
|
const input_items_length = input.items.length;
|
|
710
642
|
for (let i = 0; i < input_items_length; i++) {
|
|
711
|
-
getTypeCacheKeys$
|
|
643
|
+
getTypeCacheKeys$4(rootKeySet, luvio, input.items[i]);
|
|
712
644
|
}
|
|
713
645
|
}
|
|
714
646
|
|
|
715
|
-
function select$
|
|
716
|
-
return select$
|
|
647
|
+
function select$a(luvio, params) {
|
|
648
|
+
return select$b();
|
|
717
649
|
}
|
|
718
|
-
function keyBuilder$
|
|
719
|
-
return keyPrefix + '::
|
|
650
|
+
function keyBuilder$a(luvio, params) {
|
|
651
|
+
return keyPrefix + '::ExtensionOutputCollectionRepresentation:(' + ')';
|
|
720
652
|
}
|
|
721
|
-
function getResponseCacheKeys$
|
|
722
|
-
getTypeCacheKeys$
|
|
653
|
+
function getResponseCacheKeys$5(storeKeyMap, luvio, resourceParams, response) {
|
|
654
|
+
getTypeCacheKeys$3(storeKeyMap, luvio, response, () => keyBuilder$a());
|
|
723
655
|
}
|
|
724
656
|
function ingestSuccess$5(luvio, resourceParams, response, snapshotRefresh) {
|
|
725
657
|
const { body } = response;
|
|
726
|
-
const key = keyBuilder$
|
|
727
|
-
luvio.storeIngest(key, ingest$
|
|
658
|
+
const key = keyBuilder$a();
|
|
659
|
+
luvio.storeIngest(key, ingest$3, body);
|
|
728
660
|
const snapshot = luvio.storeLookup({
|
|
729
661
|
recordId: key,
|
|
730
|
-
node: select$
|
|
662
|
+
node: select$a(),
|
|
731
663
|
variables: {},
|
|
732
664
|
}, snapshotRefresh);
|
|
733
665
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -738,134 +670,135 @@ function ingestSuccess$5(luvio, resourceParams, response, snapshotRefresh) {
|
|
|
738
670
|
deepFreeze(snapshot.data);
|
|
739
671
|
return snapshot;
|
|
740
672
|
}
|
|
741
|
-
function ingestError$
|
|
742
|
-
const key = keyBuilder$
|
|
673
|
+
function ingestError$4(luvio, params, error, snapshotRefresh) {
|
|
674
|
+
const key = keyBuilder$a();
|
|
743
675
|
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
744
676
|
const storeMetadataParams = {
|
|
745
|
-
ttl: TTL$
|
|
677
|
+
ttl: TTL$3,
|
|
746
678
|
namespace: keyPrefix,
|
|
747
|
-
version: VERSION$
|
|
748
|
-
representationName: RepresentationType$
|
|
679
|
+
version: VERSION$5,
|
|
680
|
+
representationName: RepresentationType$3
|
|
749
681
|
};
|
|
750
682
|
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
751
683
|
return errorSnapshot;
|
|
752
684
|
}
|
|
753
|
-
function createResourceRequest$
|
|
685
|
+
function createResourceRequest$5(config) {
|
|
754
686
|
const headers = {};
|
|
755
687
|
return {
|
|
756
688
|
baseUri: '/services/data/v60.0',
|
|
757
|
-
basePath: '/commerce/extension/
|
|
689
|
+
basePath: '/commerce/extension/extensions',
|
|
758
690
|
method: 'get',
|
|
759
691
|
body: null,
|
|
760
692
|
urlParams: {},
|
|
761
|
-
queryParams:
|
|
693
|
+
queryParams: {},
|
|
762
694
|
headers,
|
|
763
695
|
priority: 'normal',
|
|
764
696
|
};
|
|
765
697
|
}
|
|
766
698
|
|
|
767
|
-
const adapterName$
|
|
768
|
-
const
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
function keyBuilder$8(luvio, config) {
|
|
775
|
-
const resourceParams = createResourceParams$6(config);
|
|
776
|
-
return keyBuilder$9(luvio, resourceParams);
|
|
699
|
+
const adapterName$5 = 'getExtensions';
|
|
700
|
+
const getExtensions_ConfigPropertyMetadata = [];
|
|
701
|
+
const getExtensions_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$5, getExtensions_ConfigPropertyMetadata);
|
|
702
|
+
const createResourceParams$5 = /*#__PURE__*/ createResourceParams$8(getExtensions_ConfigPropertyMetadata);
|
|
703
|
+
function keyBuilder$9(luvio, config) {
|
|
704
|
+
createResourceParams$5(config);
|
|
705
|
+
return keyBuilder$a();
|
|
777
706
|
}
|
|
778
|
-
function typeCheckConfig$
|
|
707
|
+
function typeCheckConfig$5(untrustedConfig) {
|
|
779
708
|
const config = {};
|
|
780
|
-
typeCheckConfig$8(untrustedConfig, config, getMappings_ConfigPropertyMetadata);
|
|
781
709
|
return config;
|
|
782
710
|
}
|
|
783
|
-
function validateAdapterConfig$
|
|
711
|
+
function validateAdapterConfig$5(untrustedConfig, configPropertyNames) {
|
|
784
712
|
if (!untrustedIsObject(untrustedConfig)) {
|
|
785
713
|
return null;
|
|
786
714
|
}
|
|
787
715
|
if (process.env.NODE_ENV !== 'production') {
|
|
788
716
|
validateConfig(untrustedConfig, configPropertyNames);
|
|
789
717
|
}
|
|
790
|
-
const config = typeCheckConfig$
|
|
718
|
+
const config = typeCheckConfig$5();
|
|
791
719
|
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
792
720
|
return null;
|
|
793
721
|
}
|
|
794
722
|
return config;
|
|
795
723
|
}
|
|
796
|
-
function adapterFragment$
|
|
797
|
-
createResourceParams$
|
|
798
|
-
return select$
|
|
724
|
+
function adapterFragment$4(luvio, config) {
|
|
725
|
+
createResourceParams$5(config);
|
|
726
|
+
return select$a();
|
|
799
727
|
}
|
|
800
|
-
function onFetchResponseSuccess$
|
|
728
|
+
function onFetchResponseSuccess$4(luvio, config, resourceParams, response) {
|
|
801
729
|
const snapshot = ingestSuccess$5(luvio, resourceParams, response, {
|
|
802
730
|
config,
|
|
803
|
-
resolve: () => buildNetworkSnapshot$
|
|
731
|
+
resolve: () => buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions)
|
|
804
732
|
});
|
|
805
733
|
return luvio.storeBroadcast().then(() => snapshot);
|
|
806
734
|
}
|
|
807
|
-
function onFetchResponseError$
|
|
808
|
-
const snapshot = ingestError$
|
|
735
|
+
function onFetchResponseError$4(luvio, config, resourceParams, response) {
|
|
736
|
+
const snapshot = ingestError$4(luvio, resourceParams, response, {
|
|
809
737
|
config,
|
|
810
|
-
resolve: () => buildNetworkSnapshot$
|
|
738
|
+
resolve: () => buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions)
|
|
811
739
|
});
|
|
812
740
|
return luvio.storeBroadcast().then(() => snapshot);
|
|
813
741
|
}
|
|
814
|
-
function buildNetworkSnapshot$
|
|
815
|
-
const resourceParams = createResourceParams$
|
|
816
|
-
const request = createResourceRequest$
|
|
742
|
+
function buildNetworkSnapshot$5(luvio, config, options) {
|
|
743
|
+
const resourceParams = createResourceParams$5(config);
|
|
744
|
+
const request = createResourceRequest$5();
|
|
817
745
|
return luvio.dispatchResourceRequest(request, options)
|
|
818
746
|
.then((response) => {
|
|
819
|
-
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$
|
|
747
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$4(luvio, config, resourceParams, response), () => {
|
|
820
748
|
const cache = new StoreKeyMap();
|
|
821
|
-
getResponseCacheKeys$
|
|
749
|
+
getResponseCacheKeys$5(cache, luvio, resourceParams, response.body);
|
|
822
750
|
return cache;
|
|
823
751
|
});
|
|
824
752
|
}, (response) => {
|
|
825
|
-
return luvio.handleErrorResponse(() => onFetchResponseError$
|
|
753
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$4(luvio, config, resourceParams, response));
|
|
826
754
|
});
|
|
827
755
|
}
|
|
828
|
-
function buildNetworkSnapshotCachePolicy$
|
|
829
|
-
return buildNetworkSnapshotCachePolicy$5(context, coercedAdapterRequestContext, buildNetworkSnapshot$
|
|
756
|
+
function buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext) {
|
|
757
|
+
return buildNetworkSnapshotCachePolicy$5(context, coercedAdapterRequestContext, buildNetworkSnapshot$5, undefined, false);
|
|
830
758
|
}
|
|
831
|
-
function buildCachedSnapshotCachePolicy$
|
|
759
|
+
function buildCachedSnapshotCachePolicy$4(context, storeLookup) {
|
|
832
760
|
const { luvio, config } = context;
|
|
833
761
|
const selector = {
|
|
834
|
-
recordId: keyBuilder$
|
|
835
|
-
node: adapterFragment$
|
|
762
|
+
recordId: keyBuilder$9(luvio, config),
|
|
763
|
+
node: adapterFragment$4(luvio, config),
|
|
836
764
|
variables: {},
|
|
837
765
|
};
|
|
838
766
|
const cacheSnapshot = storeLookup(selector, {
|
|
839
767
|
config,
|
|
840
|
-
resolve: () => buildNetworkSnapshot$
|
|
768
|
+
resolve: () => buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions)
|
|
841
769
|
});
|
|
842
770
|
return cacheSnapshot;
|
|
843
771
|
}
|
|
844
|
-
const
|
|
845
|
-
const config = validateAdapterConfig$
|
|
772
|
+
const getExtensionsAdapterFactory = (luvio) => function extensions__getExtensions(untrustedConfig, requestContext) {
|
|
773
|
+
const config = validateAdapterConfig$5(untrustedConfig, getExtensions_ConfigPropertyNames);
|
|
846
774
|
// Invalid or incomplete config
|
|
847
775
|
if (config === null) {
|
|
848
776
|
return null;
|
|
849
777
|
}
|
|
850
778
|
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
851
|
-
buildCachedSnapshotCachePolicy$
|
|
779
|
+
buildCachedSnapshotCachePolicy$4, buildNetworkSnapshotCachePolicy$4);
|
|
852
780
|
};
|
|
853
781
|
|
|
854
|
-
function select$
|
|
855
|
-
return select$
|
|
782
|
+
function select$9(luvio, params) {
|
|
783
|
+
return select$e();
|
|
856
784
|
}
|
|
857
|
-
function
|
|
858
|
-
|
|
785
|
+
function keyBuilder$8(luvio, params) {
|
|
786
|
+
return keyBuilder$d(luvio, {
|
|
787
|
+
id: params.urlParams.mappingId
|
|
788
|
+
});
|
|
859
789
|
}
|
|
860
|
-
function
|
|
790
|
+
function getResponseCacheKeys$4(storeKeyMap, luvio, resourceParams, response) {
|
|
791
|
+
getTypeCacheKeys$5(storeKeyMap, luvio, response);
|
|
792
|
+
}
|
|
793
|
+
function ingestSuccess$4(luvio, resourceParams, response, snapshotRefresh) {
|
|
861
794
|
const { body } = response;
|
|
862
|
-
const key =
|
|
863
|
-
luvio.storeIngest(key, ingest$
|
|
795
|
+
const key = keyBuilder$8(luvio, resourceParams);
|
|
796
|
+
luvio.storeIngest(key, ingest$5, body);
|
|
864
797
|
const snapshot = luvio.storeLookup({
|
|
865
798
|
recordId: key,
|
|
866
|
-
node: select$
|
|
799
|
+
node: select$9(),
|
|
867
800
|
variables: {},
|
|
868
|
-
});
|
|
801
|
+
}, snapshotRefresh);
|
|
869
802
|
if (process.env.NODE_ENV !== 'production') {
|
|
870
803
|
if (snapshot.state !== 'Fulfilled') {
|
|
871
804
|
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
@@ -874,99 +807,24 @@ function ingestSuccess$4(luvio, resourceParams, response) {
|
|
|
874
807
|
deepFreeze(snapshot.data);
|
|
875
808
|
return snapshot;
|
|
876
809
|
}
|
|
877
|
-
function
|
|
878
|
-
const
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
method: 'post',
|
|
883
|
-
body: config.body,
|
|
884
|
-
urlParams: {},
|
|
885
|
-
queryParams: {},
|
|
886
|
-
headers,
|
|
887
|
-
priority: 'normal',
|
|
888
|
-
};
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
const adapterName$5 = 'createMapping';
|
|
892
|
-
const createMapping_ConfigPropertyMetadata = [
|
|
893
|
-
generateParamConfigMetadata('epn', true, 2 /* Body */, 0 /* String */),
|
|
894
|
-
generateParamConfigMetadata('id', false, 2 /* Body */, 0 /* String */),
|
|
895
|
-
generateParamConfigMetadata('providerName', true, 2 /* Body */, 0 /* String */),
|
|
896
|
-
generateParamConfigMetadata('webstoreId', true, 2 /* Body */, 0 /* String */),
|
|
897
|
-
];
|
|
898
|
-
const createMapping_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$5, createMapping_ConfigPropertyMetadata);
|
|
899
|
-
const createResourceParams$5 = /*#__PURE__*/ createResourceParams$8(createMapping_ConfigPropertyMetadata);
|
|
900
|
-
function typeCheckConfig$5(untrustedConfig) {
|
|
901
|
-
const config = {};
|
|
902
|
-
typeCheckConfig$8(untrustedConfig, config, createMapping_ConfigPropertyMetadata);
|
|
903
|
-
return config;
|
|
904
|
-
}
|
|
905
|
-
function validateAdapterConfig$5(untrustedConfig, configPropertyNames) {
|
|
906
|
-
if (!untrustedIsObject(untrustedConfig)) {
|
|
907
|
-
return null;
|
|
908
|
-
}
|
|
909
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
910
|
-
validateConfig(untrustedConfig, configPropertyNames);
|
|
911
|
-
}
|
|
912
|
-
const config = typeCheckConfig$5(untrustedConfig);
|
|
913
|
-
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
914
|
-
return null;
|
|
915
|
-
}
|
|
916
|
-
return config;
|
|
917
|
-
}
|
|
918
|
-
function buildNetworkSnapshot$5(luvio, config, options) {
|
|
919
|
-
const resourceParams = createResourceParams$5(config);
|
|
920
|
-
const request = createResourceRequest$5(resourceParams);
|
|
921
|
-
return luvio.dispatchResourceRequest(request, options)
|
|
922
|
-
.then((response) => {
|
|
923
|
-
return luvio.handleSuccessResponse(() => {
|
|
924
|
-
const snapshot = ingestSuccess$4(luvio, resourceParams, response);
|
|
925
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
926
|
-
}, () => {
|
|
927
|
-
const cache = new StoreKeyMap();
|
|
928
|
-
getResponseCacheKeys$5(cache, luvio, resourceParams, response.body);
|
|
929
|
-
return cache;
|
|
930
|
-
});
|
|
931
|
-
}, (response) => {
|
|
932
|
-
deepFreeze(response);
|
|
933
|
-
throw response;
|
|
934
|
-
});
|
|
935
|
-
}
|
|
936
|
-
const createMappingAdapterFactory = (luvio) => {
|
|
937
|
-
return function createMapping(untrustedConfig) {
|
|
938
|
-
const config = validateAdapterConfig$5(untrustedConfig, createMapping_ConfigPropertyNames);
|
|
939
|
-
// Invalid or incomplete config
|
|
940
|
-
if (config === null) {
|
|
941
|
-
throw new Error('Invalid config for "createMapping"');
|
|
942
|
-
}
|
|
943
|
-
return buildNetworkSnapshot$5(luvio, config);
|
|
944
|
-
};
|
|
945
|
-
};
|
|
946
|
-
|
|
947
|
-
function keyBuilder$7(luvio, params) {
|
|
948
|
-
return keyBuilder$a(luvio, {
|
|
949
|
-
id: params.urlParams.mappingId
|
|
950
|
-
});
|
|
951
|
-
}
|
|
952
|
-
function getResponseCacheKeys$4(cacheKeyMap, luvio, resourceParams) {
|
|
953
|
-
const key = keyBuilder$7(luvio, resourceParams);
|
|
954
|
-
cacheKeyMap.set(key, {
|
|
810
|
+
function ingestError$3(luvio, params, error, snapshotRefresh) {
|
|
811
|
+
const key = keyBuilder$8(luvio, params);
|
|
812
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
813
|
+
const storeMetadataParams = {
|
|
814
|
+
ttl: TTL$5,
|
|
955
815
|
namespace: keyPrefix,
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
const key = keyBuilder$7(luvio, resourceParams);
|
|
962
|
-
luvio.storeEvict(key);
|
|
816
|
+
version: VERSION$7,
|
|
817
|
+
representationName: RepresentationType$5
|
|
818
|
+
};
|
|
819
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
820
|
+
return errorSnapshot;
|
|
963
821
|
}
|
|
964
822
|
function createResourceRequest$4(config) {
|
|
965
823
|
const headers = {};
|
|
966
824
|
return {
|
|
967
825
|
baseUri: '/services/data/v60.0',
|
|
968
826
|
basePath: '/commerce/extension/mappings/' + config.urlParams.mappingId + '',
|
|
969
|
-
method: '
|
|
827
|
+
method: 'get',
|
|
970
828
|
body: null,
|
|
971
829
|
urlParams: config.urlParams,
|
|
972
830
|
queryParams: {},
|
|
@@ -974,16 +832,27 @@ function createResourceRequest$4(config) {
|
|
|
974
832
|
priority: 'normal',
|
|
975
833
|
};
|
|
976
834
|
}
|
|
835
|
+
function createResourceRequestFromRepresentation$1(representation) {
|
|
836
|
+
const config = {
|
|
837
|
+
urlParams: {},
|
|
838
|
+
};
|
|
839
|
+
config.urlParams.mappingId = representation.id;
|
|
840
|
+
return createResourceRequest$4(config);
|
|
841
|
+
}
|
|
977
842
|
|
|
978
|
-
const adapterName$4 = '
|
|
979
|
-
const
|
|
843
|
+
const adapterName$4 = 'getMapping';
|
|
844
|
+
const getMapping_ConfigPropertyMetadata = [
|
|
980
845
|
generateParamConfigMetadata('mappingId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
981
846
|
];
|
|
982
|
-
const
|
|
983
|
-
const createResourceParams$4 = /*#__PURE__*/ createResourceParams$8(
|
|
847
|
+
const getMapping_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$4, getMapping_ConfigPropertyMetadata);
|
|
848
|
+
const createResourceParams$4 = /*#__PURE__*/ createResourceParams$8(getMapping_ConfigPropertyMetadata);
|
|
849
|
+
function keyBuilder$7(luvio, config) {
|
|
850
|
+
const resourceParams = createResourceParams$4(config);
|
|
851
|
+
return keyBuilder$8(luvio, resourceParams);
|
|
852
|
+
}
|
|
984
853
|
function typeCheckConfig$4(untrustedConfig) {
|
|
985
854
|
const config = {};
|
|
986
|
-
typeCheckConfig$8(untrustedConfig, config,
|
|
855
|
+
typeCheckConfig$8(untrustedConfig, config, getMapping_ConfigPropertyMetadata);
|
|
987
856
|
return config;
|
|
988
857
|
}
|
|
989
858
|
function validateAdapterConfig$4(untrustedConfig, configPropertyNames) {
|
|
@@ -999,50 +868,221 @@ function validateAdapterConfig$4(untrustedConfig, configPropertyNames) {
|
|
|
999
868
|
}
|
|
1000
869
|
return config;
|
|
1001
870
|
}
|
|
871
|
+
function adapterFragment$3(luvio, config) {
|
|
872
|
+
createResourceParams$4(config);
|
|
873
|
+
return select$9();
|
|
874
|
+
}
|
|
875
|
+
function onFetchResponseSuccess$3(luvio, config, resourceParams, response) {
|
|
876
|
+
const snapshot = ingestSuccess$4(luvio, resourceParams, response, {
|
|
877
|
+
config,
|
|
878
|
+
resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
|
|
879
|
+
});
|
|
880
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
881
|
+
}
|
|
882
|
+
function onFetchResponseError$3(luvio, config, resourceParams, response) {
|
|
883
|
+
const snapshot = ingestError$3(luvio, resourceParams, response, {
|
|
884
|
+
config,
|
|
885
|
+
resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
|
|
886
|
+
});
|
|
887
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
888
|
+
}
|
|
1002
889
|
function buildNetworkSnapshot$4(luvio, config, options) {
|
|
1003
890
|
const resourceParams = createResourceParams$4(config);
|
|
1004
891
|
const request = createResourceRequest$4(resourceParams);
|
|
1005
892
|
return luvio.dispatchResourceRequest(request, options)
|
|
1006
|
-
.then(() => {
|
|
1007
|
-
return luvio.handleSuccessResponse(() => {
|
|
1008
|
-
evictSuccess(luvio, resourceParams);
|
|
1009
|
-
return luvio.storeBroadcast();
|
|
1010
|
-
}, () => {
|
|
893
|
+
.then((response) => {
|
|
894
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$3(luvio, config, resourceParams, response), () => {
|
|
1011
895
|
const cache = new StoreKeyMap();
|
|
1012
|
-
getResponseCacheKeys$4(cache, luvio, resourceParams);
|
|
896
|
+
getResponseCacheKeys$4(cache, luvio, resourceParams, response.body);
|
|
1013
897
|
return cache;
|
|
1014
898
|
});
|
|
1015
899
|
}, (response) => {
|
|
1016
|
-
|
|
1017
|
-
throw response;
|
|
900
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$3(luvio, config, resourceParams, response));
|
|
1018
901
|
});
|
|
1019
902
|
}
|
|
1020
|
-
|
|
1021
|
-
return
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
903
|
+
function buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext) {
|
|
904
|
+
return buildNetworkSnapshotCachePolicy$5(context, coercedAdapterRequestContext, buildNetworkSnapshot$4, undefined, false);
|
|
905
|
+
}
|
|
906
|
+
function buildCachedSnapshotCachePolicy$3(context, storeLookup) {
|
|
907
|
+
const { luvio, config } = context;
|
|
908
|
+
const selector = {
|
|
909
|
+
recordId: keyBuilder$7(luvio, config),
|
|
910
|
+
node: adapterFragment$3(luvio, config),
|
|
911
|
+
variables: {},
|
|
912
|
+
};
|
|
913
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
914
|
+
config,
|
|
915
|
+
resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
|
|
916
|
+
});
|
|
917
|
+
return cacheSnapshot;
|
|
918
|
+
}
|
|
919
|
+
const getMappingAdapterFactory = (luvio) => function extensions__getMapping(untrustedConfig, requestContext) {
|
|
920
|
+
const config = validateAdapterConfig$4(untrustedConfig, getMapping_ConfigPropertyNames);
|
|
921
|
+
// Invalid or incomplete config
|
|
922
|
+
if (config === null) {
|
|
923
|
+
return null;
|
|
924
|
+
}
|
|
925
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
926
|
+
buildCachedSnapshotCachePolicy$3, buildNetworkSnapshotCachePolicy$3);
|
|
927
|
+
};
|
|
928
|
+
const notifyChangeFactory$1 = (luvio, options) => {
|
|
929
|
+
return function getCommerceExtensionMappingsByMappingIdNotifyChange(configs) {
|
|
930
|
+
const keys = configs.map(c => keyBuilder$d(luvio, c));
|
|
931
|
+
luvio.getNotifyChangeStoreEntries(keys).then(entries => {
|
|
932
|
+
for (let i = 0, len = entries.length; i < len; i++) {
|
|
933
|
+
const { key, record: val } = entries[i];
|
|
934
|
+
const refreshRequest = createResourceRequestFromRepresentation$1(val);
|
|
935
|
+
luvio.dispatchResourceRequest(refreshRequest, options)
|
|
936
|
+
.then((response) => {
|
|
937
|
+
return luvio.handleSuccessResponse(() => {
|
|
938
|
+
const { body } = response;
|
|
939
|
+
luvio.storeIngest(key, ingest$5, body);
|
|
940
|
+
return luvio.storeBroadcast();
|
|
941
|
+
}, () => {
|
|
942
|
+
const cache = new StoreKeyMap();
|
|
943
|
+
getTypeCacheKeys$5(cache, luvio, response.body);
|
|
944
|
+
return cache;
|
|
945
|
+
});
|
|
946
|
+
}, (error) => {
|
|
947
|
+
return luvio.handleErrorResponse(() => {
|
|
948
|
+
const errorSnapshot = luvio.errorSnapshot(error);
|
|
949
|
+
luvio.storeIngestError(key, errorSnapshot, {
|
|
950
|
+
ttl: TTL$5,
|
|
951
|
+
namespace: keyPrefix,
|
|
952
|
+
version: VERSION$7,
|
|
953
|
+
representationName: RepresentationType$5
|
|
954
|
+
});
|
|
955
|
+
return luvio.storeBroadcast().then(() => errorSnapshot);
|
|
956
|
+
});
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
});
|
|
960
|
+
};
|
|
961
|
+
};
|
|
962
|
+
|
|
963
|
+
const TTL$2 = 60000;
|
|
964
|
+
const VERSION$4 = "7aeadbbc38a3c6a4adff51c98906ed3e";
|
|
965
|
+
function validate$4(obj, path = 'MappingOutputCollectionRepresentation') {
|
|
966
|
+
const v_error = (() => {
|
|
967
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
968
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
969
|
+
}
|
|
970
|
+
const obj_count = obj.count;
|
|
971
|
+
const path_count = path + '.count';
|
|
972
|
+
if (typeof obj_count !== 'number' || (typeof obj_count === 'number' && Math.floor(obj_count) !== obj_count)) {
|
|
973
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_count + '" (at "' + path_count + '")');
|
|
1026
974
|
}
|
|
1027
|
-
|
|
975
|
+
const obj_items = obj.items;
|
|
976
|
+
const path_items = path + '.items';
|
|
977
|
+
if (!ArrayIsArray(obj_items)) {
|
|
978
|
+
return new TypeError('Expected "array" but received "' + typeof obj_items + '" (at "' + path_items + '")');
|
|
979
|
+
}
|
|
980
|
+
for (let i = 0; i < obj_items.length; i++) {
|
|
981
|
+
const obj_items_item = obj_items[i];
|
|
982
|
+
const path_items_item = path_items + '[' + i + ']';
|
|
983
|
+
if (typeof obj_items_item !== 'object') {
|
|
984
|
+
return new TypeError('Expected "object" but received "' + typeof obj_items_item + '" (at "' + path_items_item + '")');
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
})();
|
|
988
|
+
return v_error === undefined ? null : v_error;
|
|
989
|
+
}
|
|
990
|
+
const RepresentationType$2 = 'MappingOutputCollectionRepresentation';
|
|
991
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
992
|
+
const input_items = input.items;
|
|
993
|
+
const input_items_id = path.fullPath + '__items';
|
|
994
|
+
for (let i = 0; i < input_items.length; i++) {
|
|
995
|
+
const input_items_item = input_items[i];
|
|
996
|
+
let input_items_item_id = input_items_id + '__' + i;
|
|
997
|
+
input_items[i] = ingest$5(input_items_item, {
|
|
998
|
+
fullPath: input_items_item_id,
|
|
999
|
+
propertyName: i,
|
|
1000
|
+
parent: {
|
|
1001
|
+
data: input,
|
|
1002
|
+
key: path.fullPath,
|
|
1003
|
+
existing: existing,
|
|
1004
|
+
},
|
|
1005
|
+
ttl: path.ttl
|
|
1006
|
+
}, luvio, store, timestamp);
|
|
1007
|
+
}
|
|
1008
|
+
return input;
|
|
1009
|
+
}
|
|
1010
|
+
const select$8 = function MappingOutputCollectionRepresentationSelect() {
|
|
1011
|
+
return {
|
|
1012
|
+
kind: 'Fragment',
|
|
1013
|
+
version: VERSION$4,
|
|
1014
|
+
private: [],
|
|
1015
|
+
selections: [
|
|
1016
|
+
{
|
|
1017
|
+
name: 'count',
|
|
1018
|
+
kind: 'Scalar'
|
|
1019
|
+
},
|
|
1020
|
+
{
|
|
1021
|
+
name: 'items',
|
|
1022
|
+
kind: 'Link',
|
|
1023
|
+
plural: true,
|
|
1024
|
+
fragment: select$e()
|
|
1025
|
+
}
|
|
1026
|
+
]
|
|
1028
1027
|
};
|
|
1029
1028
|
};
|
|
1029
|
+
function equals$4(existing, incoming) {
|
|
1030
|
+
const existing_count = existing.count;
|
|
1031
|
+
const incoming_count = incoming.count;
|
|
1032
|
+
if (!(existing_count === incoming_count)) {
|
|
1033
|
+
return false;
|
|
1034
|
+
}
|
|
1035
|
+
const existing_items = existing.items;
|
|
1036
|
+
const incoming_items = incoming.items;
|
|
1037
|
+
const equals_items_items = equalsArray(existing_items, incoming_items, (existing_items_item, incoming_items_item) => {
|
|
1038
|
+
if (!(existing_items_item.__ref === incoming_items_item.__ref)) {
|
|
1039
|
+
return false;
|
|
1040
|
+
}
|
|
1041
|
+
});
|
|
1042
|
+
if (equals_items_items === false) {
|
|
1043
|
+
return false;
|
|
1044
|
+
}
|
|
1045
|
+
return true;
|
|
1046
|
+
}
|
|
1047
|
+
const ingest$2 = function MappingOutputCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1048
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1049
|
+
const validateError = validate$4(input);
|
|
1050
|
+
if (validateError !== null) {
|
|
1051
|
+
throw validateError;
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
const key = path.fullPath;
|
|
1055
|
+
const ttlToUse = TTL$2;
|
|
1056
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "extensions", VERSION$4, RepresentationType$2, equals$4);
|
|
1057
|
+
return createLink(key);
|
|
1058
|
+
};
|
|
1059
|
+
function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
|
|
1060
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1061
|
+
const rootKey = fullPathFactory();
|
|
1062
|
+
rootKeySet.set(rootKey, {
|
|
1063
|
+
namespace: keyPrefix,
|
|
1064
|
+
representationName: RepresentationType$2,
|
|
1065
|
+
mergeable: false
|
|
1066
|
+
});
|
|
1067
|
+
const input_items_length = input.items.length;
|
|
1068
|
+
for (let i = 0; i < input_items_length; i++) {
|
|
1069
|
+
getTypeCacheKeys$5(rootKeySet, luvio, input.items[i]);
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1030
1072
|
|
|
1031
1073
|
function select$7(luvio, params) {
|
|
1032
|
-
return select$
|
|
1074
|
+
return select$8();
|
|
1033
1075
|
}
|
|
1034
1076
|
function keyBuilder$6(luvio, params) {
|
|
1035
|
-
return
|
|
1036
|
-
id: params.urlParams.mappingId
|
|
1037
|
-
});
|
|
1077
|
+
return keyPrefix + '::MappingOutputCollectionRepresentation:(' + 'epn:' + params.queryParams.epn + ',' + 'webstoreId:' + params.queryParams.webstoreId + ')';
|
|
1038
1078
|
}
|
|
1039
1079
|
function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
|
|
1040
|
-
getTypeCacheKeys$
|
|
1080
|
+
getTypeCacheKeys$2(storeKeyMap, luvio, response, () => keyBuilder$6(luvio, resourceParams));
|
|
1041
1081
|
}
|
|
1042
1082
|
function ingestSuccess$3(luvio, resourceParams, response, snapshotRefresh) {
|
|
1043
1083
|
const { body } = response;
|
|
1044
1084
|
const key = keyBuilder$6(luvio, resourceParams);
|
|
1045
|
-
luvio.storeIngest(key, ingest$
|
|
1085
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
1046
1086
|
const snapshot = luvio.storeLookup({
|
|
1047
1087
|
recordId: key,
|
|
1048
1088
|
node: select$7(),
|
|
@@ -1060,10 +1100,10 @@ function ingestError$2(luvio, params, error, snapshotRefresh) {
|
|
|
1060
1100
|
const key = keyBuilder$6(luvio, params);
|
|
1061
1101
|
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1062
1102
|
const storeMetadataParams = {
|
|
1063
|
-
ttl: TTL$
|
|
1103
|
+
ttl: TTL$2,
|
|
1064
1104
|
namespace: keyPrefix,
|
|
1065
|
-
version: VERSION$
|
|
1066
|
-
representationName: RepresentationType$
|
|
1105
|
+
version: VERSION$4,
|
|
1106
|
+
representationName: RepresentationType$2
|
|
1067
1107
|
};
|
|
1068
1108
|
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
1069
1109
|
return errorSnapshot;
|
|
@@ -1072,36 +1112,30 @@ function createResourceRequest$3(config) {
|
|
|
1072
1112
|
const headers = {};
|
|
1073
1113
|
return {
|
|
1074
1114
|
baseUri: '/services/data/v60.0',
|
|
1075
|
-
basePath: '/commerce/extension/mappings
|
|
1115
|
+
basePath: '/commerce/extension/mappings',
|
|
1076
1116
|
method: 'get',
|
|
1077
1117
|
body: null,
|
|
1078
|
-
urlParams:
|
|
1079
|
-
queryParams:
|
|
1118
|
+
urlParams: {},
|
|
1119
|
+
queryParams: config.queryParams,
|
|
1080
1120
|
headers,
|
|
1081
1121
|
priority: 'normal',
|
|
1082
1122
|
};
|
|
1083
1123
|
}
|
|
1084
|
-
function createResourceRequestFromRepresentation$1(representation) {
|
|
1085
|
-
const config = {
|
|
1086
|
-
urlParams: {},
|
|
1087
|
-
};
|
|
1088
|
-
config.urlParams.mappingId = representation.id;
|
|
1089
|
-
return createResourceRequest$3(config);
|
|
1090
|
-
}
|
|
1091
1124
|
|
|
1092
|
-
const adapterName$3 = '
|
|
1093
|
-
const
|
|
1094
|
-
generateParamConfigMetadata('
|
|
1125
|
+
const adapterName$3 = 'getMappings';
|
|
1126
|
+
const getMappings_ConfigPropertyMetadata = [
|
|
1127
|
+
generateParamConfigMetadata('epn', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1128
|
+
generateParamConfigMetadata('webstoreId', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1095
1129
|
];
|
|
1096
|
-
const
|
|
1097
|
-
const createResourceParams$3 = /*#__PURE__*/ createResourceParams$8(
|
|
1130
|
+
const getMappings_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, getMappings_ConfigPropertyMetadata);
|
|
1131
|
+
const createResourceParams$3 = /*#__PURE__*/ createResourceParams$8(getMappings_ConfigPropertyMetadata);
|
|
1098
1132
|
function keyBuilder$5(luvio, config) {
|
|
1099
1133
|
const resourceParams = createResourceParams$3(config);
|
|
1100
1134
|
return keyBuilder$6(luvio, resourceParams);
|
|
1101
1135
|
}
|
|
1102
1136
|
function typeCheckConfig$3(untrustedConfig) {
|
|
1103
1137
|
const config = {};
|
|
1104
|
-
typeCheckConfig$8(untrustedConfig, config,
|
|
1138
|
+
typeCheckConfig$8(untrustedConfig, config, getMappings_ConfigPropertyMetadata);
|
|
1105
1139
|
return config;
|
|
1106
1140
|
}
|
|
1107
1141
|
function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
|
|
@@ -1165,8 +1199,8 @@ function buildCachedSnapshotCachePolicy$2(context, storeLookup) {
|
|
|
1165
1199
|
});
|
|
1166
1200
|
return cacheSnapshot;
|
|
1167
1201
|
}
|
|
1168
|
-
const
|
|
1169
|
-
const config = validateAdapterConfig$3(untrustedConfig,
|
|
1202
|
+
const getMappingsAdapterFactory = (luvio) => function extensions__getMappings(untrustedConfig, requestContext) {
|
|
1203
|
+
const config = validateAdapterConfig$3(untrustedConfig, getMappings_ConfigPropertyNames);
|
|
1170
1204
|
// Invalid or incomplete config
|
|
1171
1205
|
if (config === null) {
|
|
1172
1206
|
return null;
|
|
@@ -1174,134 +1208,6 @@ const getMappingAdapterFactory = (luvio) => function extensions__getMapping(untr
|
|
|
1174
1208
|
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1175
1209
|
buildCachedSnapshotCachePolicy$2, buildNetworkSnapshotCachePolicy$2);
|
|
1176
1210
|
};
|
|
1177
|
-
const notifyChangeFactory$1 = (luvio, options) => {
|
|
1178
|
-
return function getCommerceExtensionMappingsByMappingIdNotifyChange(configs) {
|
|
1179
|
-
const keys = configs.map(c => keyBuilder$a(luvio, c));
|
|
1180
|
-
luvio.getNotifyChangeStoreEntries(keys).then(entries => {
|
|
1181
|
-
for (let i = 0, len = entries.length; i < len; i++) {
|
|
1182
|
-
const { key, record: val } = entries[i];
|
|
1183
|
-
const refreshRequest = createResourceRequestFromRepresentation$1(val);
|
|
1184
|
-
luvio.dispatchResourceRequest(refreshRequest, options)
|
|
1185
|
-
.then((response) => {
|
|
1186
|
-
return luvio.handleSuccessResponse(() => {
|
|
1187
|
-
const { body } = response;
|
|
1188
|
-
luvio.storeIngest(key, ingest$3, body);
|
|
1189
|
-
return luvio.storeBroadcast();
|
|
1190
|
-
}, () => {
|
|
1191
|
-
const cache = new StoreKeyMap();
|
|
1192
|
-
getTypeCacheKeys$3(cache, luvio, response.body);
|
|
1193
|
-
return cache;
|
|
1194
|
-
});
|
|
1195
|
-
}, (error) => {
|
|
1196
|
-
return luvio.handleErrorResponse(() => {
|
|
1197
|
-
const errorSnapshot = luvio.errorSnapshot(error);
|
|
1198
|
-
luvio.storeIngestError(key, errorSnapshot, {
|
|
1199
|
-
ttl: TTL$3,
|
|
1200
|
-
namespace: keyPrefix,
|
|
1201
|
-
version: VERSION$5,
|
|
1202
|
-
representationName: RepresentationType$3
|
|
1203
|
-
});
|
|
1204
|
-
return luvio.storeBroadcast().then(() => errorSnapshot);
|
|
1205
|
-
});
|
|
1206
|
-
});
|
|
1207
|
-
}
|
|
1208
|
-
});
|
|
1209
|
-
};
|
|
1210
|
-
};
|
|
1211
|
-
|
|
1212
|
-
function select$6(luvio, params) {
|
|
1213
|
-
return select$b();
|
|
1214
|
-
}
|
|
1215
|
-
function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
|
|
1216
|
-
getTypeCacheKeys$3(storeKeyMap, luvio, response);
|
|
1217
|
-
}
|
|
1218
|
-
function ingestSuccess$2(luvio, resourceParams, response) {
|
|
1219
|
-
const { body } = response;
|
|
1220
|
-
const key = keyBuilderFromType$1(luvio, body);
|
|
1221
|
-
luvio.storeIngest(key, ingest$3, body);
|
|
1222
|
-
const snapshot = luvio.storeLookup({
|
|
1223
|
-
recordId: key,
|
|
1224
|
-
node: select$6(),
|
|
1225
|
-
variables: {},
|
|
1226
|
-
});
|
|
1227
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1228
|
-
if (snapshot.state !== 'Fulfilled') {
|
|
1229
|
-
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1230
|
-
}
|
|
1231
|
-
}
|
|
1232
|
-
deepFreeze(snapshot.data);
|
|
1233
|
-
return snapshot;
|
|
1234
|
-
}
|
|
1235
|
-
function createResourceRequest$2(config) {
|
|
1236
|
-
const headers = {};
|
|
1237
|
-
return {
|
|
1238
|
-
baseUri: '/services/data/v60.0',
|
|
1239
|
-
basePath: '/commerce/extension/mappings/' + config.urlParams.mappingId + '',
|
|
1240
|
-
method: 'put',
|
|
1241
|
-
body: config.body,
|
|
1242
|
-
urlParams: config.urlParams,
|
|
1243
|
-
queryParams: {},
|
|
1244
|
-
headers,
|
|
1245
|
-
priority: 'normal',
|
|
1246
|
-
};
|
|
1247
|
-
}
|
|
1248
|
-
|
|
1249
|
-
const adapterName$2 = 'updateMapping';
|
|
1250
|
-
const updateMapping_ConfigPropertyMetadata = [
|
|
1251
|
-
generateParamConfigMetadata('mappingId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1252
|
-
generateParamConfigMetadata('epn', true, 2 /* Body */, 0 /* String */),
|
|
1253
|
-
generateParamConfigMetadata('id', false, 2 /* Body */, 0 /* String */),
|
|
1254
|
-
generateParamConfigMetadata('providerName', true, 2 /* Body */, 0 /* String */),
|
|
1255
|
-
generateParamConfigMetadata('webstoreId', true, 2 /* Body */, 0 /* String */),
|
|
1256
|
-
];
|
|
1257
|
-
const updateMapping_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, updateMapping_ConfigPropertyMetadata);
|
|
1258
|
-
const createResourceParams$2 = /*#__PURE__*/ createResourceParams$8(updateMapping_ConfigPropertyMetadata);
|
|
1259
|
-
function typeCheckConfig$2(untrustedConfig) {
|
|
1260
|
-
const config = {};
|
|
1261
|
-
typeCheckConfig$8(untrustedConfig, config, updateMapping_ConfigPropertyMetadata);
|
|
1262
|
-
return config;
|
|
1263
|
-
}
|
|
1264
|
-
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
1265
|
-
if (!untrustedIsObject(untrustedConfig)) {
|
|
1266
|
-
return null;
|
|
1267
|
-
}
|
|
1268
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1269
|
-
validateConfig(untrustedConfig, configPropertyNames);
|
|
1270
|
-
}
|
|
1271
|
-
const config = typeCheckConfig$2(untrustedConfig);
|
|
1272
|
-
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1273
|
-
return null;
|
|
1274
|
-
}
|
|
1275
|
-
return config;
|
|
1276
|
-
}
|
|
1277
|
-
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
1278
|
-
const resourceParams = createResourceParams$2(config);
|
|
1279
|
-
const request = createResourceRequest$2(resourceParams);
|
|
1280
|
-
return luvio.dispatchResourceRequest(request, options)
|
|
1281
|
-
.then((response) => {
|
|
1282
|
-
return luvio.handleSuccessResponse(() => {
|
|
1283
|
-
const snapshot = ingestSuccess$2(luvio, resourceParams, response);
|
|
1284
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
1285
|
-
}, () => {
|
|
1286
|
-
const cache = new StoreKeyMap();
|
|
1287
|
-
getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
|
|
1288
|
-
return cache;
|
|
1289
|
-
});
|
|
1290
|
-
}, (response) => {
|
|
1291
|
-
deepFreeze(response);
|
|
1292
|
-
throw response;
|
|
1293
|
-
});
|
|
1294
|
-
}
|
|
1295
|
-
const updateMappingAdapterFactory = (luvio) => {
|
|
1296
|
-
return function updateMapping(untrustedConfig) {
|
|
1297
|
-
const config = validateAdapterConfig$2(untrustedConfig, updateMapping_ConfigPropertyNames);
|
|
1298
|
-
// Invalid or incomplete config
|
|
1299
|
-
if (config === null) {
|
|
1300
|
-
throw new Error('Invalid config for "updateMapping"');
|
|
1301
|
-
}
|
|
1302
|
-
return buildNetworkSnapshot$2(luvio, config);
|
|
1303
|
-
};
|
|
1304
|
-
};
|
|
1305
1211
|
|
|
1306
1212
|
const VERSION$3 = "bed780ad418f5f02446c1b0f9d165e5d";
|
|
1307
1213
|
function validate$3(obj, path = 'ApexClassOutputRepresentation') {
|
|
@@ -1332,7 +1238,7 @@ function validate$3(obj, path = 'ApexClassOutputRepresentation') {
|
|
|
1332
1238
|
})();
|
|
1333
1239
|
return v_error === undefined ? null : v_error;
|
|
1334
1240
|
}
|
|
1335
|
-
const select$
|
|
1241
|
+
const select$6 = function ApexClassOutputRepresentationSelect() {
|
|
1336
1242
|
return {
|
|
1337
1243
|
kind: 'Fragment',
|
|
1338
1244
|
version: VERSION$3,
|
|
@@ -1395,7 +1301,7 @@ function validate$2(obj, path = 'EffectiveMappingRepresentation') {
|
|
|
1395
1301
|
})();
|
|
1396
1302
|
return v_error === undefined ? null : v_error;
|
|
1397
1303
|
}
|
|
1398
|
-
const select$
|
|
1304
|
+
const select$5 = function EffectiveMappingRepresentationSelect() {
|
|
1399
1305
|
return {
|
|
1400
1306
|
kind: 'Fragment',
|
|
1401
1307
|
version: VERSION$2,
|
|
@@ -1503,9 +1409,9 @@ function keyBuilderFromType(luvio, object) {
|
|
|
1503
1409
|
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
1504
1410
|
return input;
|
|
1505
1411
|
}
|
|
1506
|
-
const select$
|
|
1507
|
-
const { selections: ApexClassOutputRepresentation__selections, opaque: ApexClassOutputRepresentation__opaque, } = select$
|
|
1508
|
-
const { selections: EffectiveMappingRepresentation__selections, opaque: EffectiveMappingRepresentation__opaque, } = select$
|
|
1412
|
+
const select$4 = function ProviderOutputRepresentationSelect() {
|
|
1413
|
+
const { selections: ApexClassOutputRepresentation__selections, opaque: ApexClassOutputRepresentation__opaque, } = select$6();
|
|
1414
|
+
const { selections: EffectiveMappingRepresentation__selections, opaque: EffectiveMappingRepresentation__opaque, } = select$5();
|
|
1509
1415
|
return {
|
|
1510
1416
|
kind: 'Fragment',
|
|
1511
1417
|
version: VERSION$1,
|
|
@@ -1610,32 +1516,213 @@ function equals$1(existing, incoming) {
|
|
|
1610
1516
|
return false;
|
|
1611
1517
|
}
|
|
1612
1518
|
});
|
|
1613
|
-
if (equals_effectiveMappings_items === false) {
|
|
1614
|
-
return false;
|
|
1615
|
-
}
|
|
1616
|
-
return true;
|
|
1519
|
+
if (equals_effectiveMappings_items === false) {
|
|
1520
|
+
return false;
|
|
1521
|
+
}
|
|
1522
|
+
return true;
|
|
1523
|
+
}
|
|
1524
|
+
const ingest$1 = function ProviderOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1525
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1526
|
+
const validateError = validate$1(input);
|
|
1527
|
+
if (validateError !== null) {
|
|
1528
|
+
throw validateError;
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
const key = keyBuilderFromType(luvio, input);
|
|
1532
|
+
const ttlToUse = TTL$1;
|
|
1533
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "extensions", VERSION$1, RepresentationType$1, equals$1);
|
|
1534
|
+
return createLink(key);
|
|
1535
|
+
};
|
|
1536
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
1537
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1538
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
1539
|
+
rootKeySet.set(rootKey, {
|
|
1540
|
+
namespace: keyPrefix,
|
|
1541
|
+
representationName: RepresentationType$1,
|
|
1542
|
+
mergeable: false
|
|
1543
|
+
});
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
function select$3(luvio, params) {
|
|
1547
|
+
return select$4();
|
|
1548
|
+
}
|
|
1549
|
+
function keyBuilder$3(luvio, params) {
|
|
1550
|
+
return keyBuilder$4(luvio, {
|
|
1551
|
+
id: params.urlParams.providerId
|
|
1552
|
+
});
|
|
1553
|
+
}
|
|
1554
|
+
function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
|
|
1555
|
+
getTypeCacheKeys$1(storeKeyMap, luvio, response);
|
|
1556
|
+
}
|
|
1557
|
+
function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
|
|
1558
|
+
const { body } = response;
|
|
1559
|
+
const key = keyBuilder$3(luvio, resourceParams);
|
|
1560
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
1561
|
+
const snapshot = luvio.storeLookup({
|
|
1562
|
+
recordId: key,
|
|
1563
|
+
node: select$3(),
|
|
1564
|
+
variables: {},
|
|
1565
|
+
}, snapshotRefresh);
|
|
1566
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1567
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1568
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
deepFreeze(snapshot.data);
|
|
1572
|
+
return snapshot;
|
|
1573
|
+
}
|
|
1574
|
+
function ingestError$1(luvio, params, error, snapshotRefresh) {
|
|
1575
|
+
const key = keyBuilder$3(luvio, params);
|
|
1576
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1577
|
+
const storeMetadataParams = {
|
|
1578
|
+
ttl: TTL$1,
|
|
1579
|
+
namespace: keyPrefix,
|
|
1580
|
+
version: VERSION$1,
|
|
1581
|
+
representationName: RepresentationType$1
|
|
1582
|
+
};
|
|
1583
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
1584
|
+
return errorSnapshot;
|
|
1585
|
+
}
|
|
1586
|
+
function createResourceRequest$2(config) {
|
|
1587
|
+
const headers = {};
|
|
1588
|
+
return {
|
|
1589
|
+
baseUri: '/services/data/v60.0',
|
|
1590
|
+
basePath: '/commerce/extension/providers/' + config.urlParams.providerId + '',
|
|
1591
|
+
method: 'get',
|
|
1592
|
+
body: null,
|
|
1593
|
+
urlParams: config.urlParams,
|
|
1594
|
+
queryParams: {},
|
|
1595
|
+
headers,
|
|
1596
|
+
priority: 'normal',
|
|
1597
|
+
};
|
|
1598
|
+
}
|
|
1599
|
+
function createResourceRequestFromRepresentation(representation) {
|
|
1600
|
+
const config = {
|
|
1601
|
+
urlParams: {},
|
|
1602
|
+
};
|
|
1603
|
+
config.urlParams.providerId = representation.id;
|
|
1604
|
+
return createResourceRequest$2(config);
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
const adapterName$2 = 'getProvider';
|
|
1608
|
+
const getProvider_ConfigPropertyMetadata = [
|
|
1609
|
+
generateParamConfigMetadata('providerId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1610
|
+
];
|
|
1611
|
+
const getProvider_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getProvider_ConfigPropertyMetadata);
|
|
1612
|
+
const createResourceParams$2 = /*#__PURE__*/ createResourceParams$8(getProvider_ConfigPropertyMetadata);
|
|
1613
|
+
function keyBuilder$2(luvio, config) {
|
|
1614
|
+
const resourceParams = createResourceParams$2(config);
|
|
1615
|
+
return keyBuilder$3(luvio, resourceParams);
|
|
1616
|
+
}
|
|
1617
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
1618
|
+
const config = {};
|
|
1619
|
+
typeCheckConfig$8(untrustedConfig, config, getProvider_ConfigPropertyMetadata);
|
|
1620
|
+
return config;
|
|
1621
|
+
}
|
|
1622
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
1623
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1624
|
+
return null;
|
|
1625
|
+
}
|
|
1626
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1627
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1628
|
+
}
|
|
1629
|
+
const config = typeCheckConfig$2(untrustedConfig);
|
|
1630
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1631
|
+
return null;
|
|
1632
|
+
}
|
|
1633
|
+
return config;
|
|
1634
|
+
}
|
|
1635
|
+
function adapterFragment$1(luvio, config) {
|
|
1636
|
+
createResourceParams$2(config);
|
|
1637
|
+
return select$3();
|
|
1638
|
+
}
|
|
1639
|
+
function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
|
|
1640
|
+
const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
|
|
1641
|
+
config,
|
|
1642
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1643
|
+
});
|
|
1644
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1645
|
+
}
|
|
1646
|
+
function onFetchResponseError$1(luvio, config, resourceParams, response) {
|
|
1647
|
+
const snapshot = ingestError$1(luvio, resourceParams, response, {
|
|
1648
|
+
config,
|
|
1649
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1650
|
+
});
|
|
1651
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1652
|
+
}
|
|
1653
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
1654
|
+
const resourceParams = createResourceParams$2(config);
|
|
1655
|
+
const request = createResourceRequest$2(resourceParams);
|
|
1656
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1657
|
+
.then((response) => {
|
|
1658
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
|
|
1659
|
+
const cache = new StoreKeyMap();
|
|
1660
|
+
getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
|
|
1661
|
+
return cache;
|
|
1662
|
+
});
|
|
1663
|
+
}, (response) => {
|
|
1664
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
|
|
1665
|
+
});
|
|
1617
1666
|
}
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1632
|
-
const rootKey = keyBuilderFromType(luvio, input);
|
|
1633
|
-
rootKeySet.set(rootKey, {
|
|
1634
|
-
namespace: keyPrefix,
|
|
1635
|
-
representationName: RepresentationType$1,
|
|
1636
|
-
mergeable: false
|
|
1667
|
+
function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
|
|
1668
|
+
return buildNetworkSnapshotCachePolicy$5(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, undefined, false);
|
|
1669
|
+
}
|
|
1670
|
+
function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
|
|
1671
|
+
const { luvio, config } = context;
|
|
1672
|
+
const selector = {
|
|
1673
|
+
recordId: keyBuilder$2(luvio, config),
|
|
1674
|
+
node: adapterFragment$1(luvio, config),
|
|
1675
|
+
variables: {},
|
|
1676
|
+
};
|
|
1677
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
1678
|
+
config,
|
|
1679
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1637
1680
|
});
|
|
1681
|
+
return cacheSnapshot;
|
|
1638
1682
|
}
|
|
1683
|
+
const getProviderAdapterFactory = (luvio) => function extensions__getProvider(untrustedConfig, requestContext) {
|
|
1684
|
+
const config = validateAdapterConfig$2(untrustedConfig, getProvider_ConfigPropertyNames);
|
|
1685
|
+
// Invalid or incomplete config
|
|
1686
|
+
if (config === null) {
|
|
1687
|
+
return null;
|
|
1688
|
+
}
|
|
1689
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1690
|
+
buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
|
|
1691
|
+
};
|
|
1692
|
+
const notifyChangeFactory = (luvio, options) => {
|
|
1693
|
+
return function getCommerceExtensionProvidersByProviderIdNotifyChange(configs) {
|
|
1694
|
+
const keys = configs.map(c => keyBuilder$4(luvio, c));
|
|
1695
|
+
luvio.getNotifyChangeStoreEntries(keys).then(entries => {
|
|
1696
|
+
for (let i = 0, len = entries.length; i < len; i++) {
|
|
1697
|
+
const { key, record: val } = entries[i];
|
|
1698
|
+
const refreshRequest = createResourceRequestFromRepresentation(val);
|
|
1699
|
+
luvio.dispatchResourceRequest(refreshRequest, options)
|
|
1700
|
+
.then((response) => {
|
|
1701
|
+
return luvio.handleSuccessResponse(() => {
|
|
1702
|
+
const { body } = response;
|
|
1703
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
1704
|
+
return luvio.storeBroadcast();
|
|
1705
|
+
}, () => {
|
|
1706
|
+
const cache = new StoreKeyMap();
|
|
1707
|
+
getTypeCacheKeys$1(cache, luvio, response.body);
|
|
1708
|
+
return cache;
|
|
1709
|
+
});
|
|
1710
|
+
}, (error) => {
|
|
1711
|
+
return luvio.handleErrorResponse(() => {
|
|
1712
|
+
const errorSnapshot = luvio.errorSnapshot(error);
|
|
1713
|
+
luvio.storeIngestError(key, errorSnapshot, {
|
|
1714
|
+
ttl: TTL$1,
|
|
1715
|
+
namespace: keyPrefix,
|
|
1716
|
+
version: VERSION$1,
|
|
1717
|
+
representationName: RepresentationType$1
|
|
1718
|
+
});
|
|
1719
|
+
return luvio.storeBroadcast().then(() => errorSnapshot);
|
|
1720
|
+
});
|
|
1721
|
+
});
|
|
1722
|
+
}
|
|
1723
|
+
});
|
|
1724
|
+
};
|
|
1725
|
+
};
|
|
1639
1726
|
|
|
1640
1727
|
const TTL = 60000;
|
|
1641
1728
|
const VERSION = "d9978417e0efd08a87aa592d226979e1";
|
|
@@ -1698,7 +1785,7 @@ const select$2 = function ProviderOutputCollectionRepresentationSelect() {
|
|
|
1698
1785
|
name: 'items',
|
|
1699
1786
|
kind: 'Link',
|
|
1700
1787
|
plural: true,
|
|
1701
|
-
fragment: select$
|
|
1788
|
+
fragment: select$4()
|
|
1702
1789
|
}
|
|
1703
1790
|
]
|
|
1704
1791
|
};
|
|
@@ -1750,15 +1837,15 @@ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
|
1750
1837
|
function select$1(luvio, params) {
|
|
1751
1838
|
return select$2();
|
|
1752
1839
|
}
|
|
1753
|
-
function keyBuilder$
|
|
1840
|
+
function keyBuilder$1(luvio, params) {
|
|
1754
1841
|
return keyPrefix + '::ProviderOutputCollectionRepresentation:(' + 'effectiveMappingsWebstoreId:' + params.queryParams.effectiveMappingsWebstoreId + ',' + 'epn:' + params.queryParams.epn + ')';
|
|
1755
1842
|
}
|
|
1756
1843
|
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
1757
|
-
getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$
|
|
1844
|
+
getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$1(luvio, resourceParams));
|
|
1758
1845
|
}
|
|
1759
1846
|
function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
|
|
1760
1847
|
const { body } = response;
|
|
1761
|
-
const key = keyBuilder$
|
|
1848
|
+
const key = keyBuilder$1(luvio, resourceParams);
|
|
1762
1849
|
luvio.storeIngest(key, ingest, body);
|
|
1763
1850
|
const snapshot = luvio.storeLookup({
|
|
1764
1851
|
recordId: key,
|
|
@@ -1773,8 +1860,8 @@ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
|
|
|
1773
1860
|
deepFreeze(snapshot.data);
|
|
1774
1861
|
return snapshot;
|
|
1775
1862
|
}
|
|
1776
|
-
function ingestError
|
|
1777
|
-
const key = keyBuilder$
|
|
1863
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
1864
|
+
const key = keyBuilder$1(luvio, params);
|
|
1778
1865
|
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1779
1866
|
const storeMetadataParams = {
|
|
1780
1867
|
ttl: TTL,
|
|
@@ -1806,9 +1893,9 @@ const getProviders_ConfigPropertyMetadata = [
|
|
|
1806
1893
|
];
|
|
1807
1894
|
const getProviders_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getProviders_ConfigPropertyMetadata);
|
|
1808
1895
|
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$8(getProviders_ConfigPropertyMetadata);
|
|
1809
|
-
function keyBuilder
|
|
1896
|
+
function keyBuilder(luvio, config) {
|
|
1810
1897
|
const resourceParams = createResourceParams$1(config);
|
|
1811
|
-
return keyBuilder$
|
|
1898
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
1812
1899
|
}
|
|
1813
1900
|
function typeCheckConfig$1(untrustedConfig) {
|
|
1814
1901
|
const config = {};
|
|
@@ -1828,19 +1915,19 @@ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
|
1828
1915
|
}
|
|
1829
1916
|
return config;
|
|
1830
1917
|
}
|
|
1831
|
-
function adapterFragment
|
|
1918
|
+
function adapterFragment(luvio, config) {
|
|
1832
1919
|
createResourceParams$1(config);
|
|
1833
1920
|
return select$1();
|
|
1834
1921
|
}
|
|
1835
|
-
function onFetchResponseSuccess
|
|
1922
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
1836
1923
|
const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
|
|
1837
1924
|
config,
|
|
1838
1925
|
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
1839
1926
|
});
|
|
1840
1927
|
return luvio.storeBroadcast().then(() => snapshot);
|
|
1841
1928
|
}
|
|
1842
|
-
function onFetchResponseError
|
|
1843
|
-
const snapshot = ingestError
|
|
1929
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
1930
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
1844
1931
|
config,
|
|
1845
1932
|
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
1846
1933
|
});
|
|
@@ -1851,23 +1938,23 @@ function buildNetworkSnapshot$1(luvio, config, options) {
|
|
|
1851
1938
|
const request = createResourceRequest$1(resourceParams);
|
|
1852
1939
|
return luvio.dispatchResourceRequest(request, options)
|
|
1853
1940
|
.then((response) => {
|
|
1854
|
-
return luvio.handleSuccessResponse(() => onFetchResponseSuccess
|
|
1941
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
1855
1942
|
const cache = new StoreKeyMap();
|
|
1856
1943
|
getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
|
|
1857
1944
|
return cache;
|
|
1858
1945
|
});
|
|
1859
1946
|
}, (response) => {
|
|
1860
|
-
return luvio.handleErrorResponse(() => onFetchResponseError
|
|
1947
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
1861
1948
|
});
|
|
1862
1949
|
}
|
|
1863
|
-
function buildNetworkSnapshotCachePolicy
|
|
1950
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
1864
1951
|
return buildNetworkSnapshotCachePolicy$5(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
|
|
1865
1952
|
}
|
|
1866
|
-
function buildCachedSnapshotCachePolicy
|
|
1953
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
1867
1954
|
const { luvio, config } = context;
|
|
1868
1955
|
const selector = {
|
|
1869
|
-
recordId: keyBuilder
|
|
1870
|
-
node: adapterFragment
|
|
1956
|
+
recordId: keyBuilder(luvio, config),
|
|
1957
|
+
node: adapterFragment(luvio, config),
|
|
1871
1958
|
variables: {},
|
|
1872
1959
|
};
|
|
1873
1960
|
const cacheSnapshot = storeLookup(selector, {
|
|
@@ -1883,29 +1970,24 @@ const getProvidersAdapterFactory = (luvio) => function extensions__getProviders(
|
|
|
1883
1970
|
return null;
|
|
1884
1971
|
}
|
|
1885
1972
|
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1886
|
-
buildCachedSnapshotCachePolicy
|
|
1973
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
1887
1974
|
};
|
|
1888
1975
|
|
|
1889
1976
|
function select(luvio, params) {
|
|
1890
|
-
return select$
|
|
1891
|
-
}
|
|
1892
|
-
function keyBuilder$1(luvio, params) {
|
|
1893
|
-
return keyBuilder$4(luvio, {
|
|
1894
|
-
id: params.urlParams.providerId
|
|
1895
|
-
});
|
|
1977
|
+
return select$e();
|
|
1896
1978
|
}
|
|
1897
1979
|
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
1898
|
-
getTypeCacheKeys$
|
|
1980
|
+
getTypeCacheKeys$5(storeKeyMap, luvio, response);
|
|
1899
1981
|
}
|
|
1900
|
-
function ingestSuccess(luvio, resourceParams, response
|
|
1982
|
+
function ingestSuccess(luvio, resourceParams, response) {
|
|
1901
1983
|
const { body } = response;
|
|
1902
|
-
const key =
|
|
1903
|
-
luvio.storeIngest(key, ingest$
|
|
1984
|
+
const key = keyBuilderFromType$2(luvio, body);
|
|
1985
|
+
luvio.storeIngest(key, ingest$5, body);
|
|
1904
1986
|
const snapshot = luvio.storeLookup({
|
|
1905
1987
|
recordId: key,
|
|
1906
1988
|
node: select(),
|
|
1907
1989
|
variables: {},
|
|
1908
|
-
}
|
|
1990
|
+
});
|
|
1909
1991
|
if (process.env.NODE_ENV !== 'production') {
|
|
1910
1992
|
if (snapshot.state !== 'Fulfilled') {
|
|
1911
1993
|
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
@@ -1914,52 +1996,33 @@ function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
|
1914
1996
|
deepFreeze(snapshot.data);
|
|
1915
1997
|
return snapshot;
|
|
1916
1998
|
}
|
|
1917
|
-
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
1918
|
-
const key = keyBuilder$1(luvio, params);
|
|
1919
|
-
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1920
|
-
const storeMetadataParams = {
|
|
1921
|
-
ttl: TTL$1,
|
|
1922
|
-
namespace: keyPrefix,
|
|
1923
|
-
version: VERSION$1,
|
|
1924
|
-
representationName: RepresentationType$1
|
|
1925
|
-
};
|
|
1926
|
-
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
1927
|
-
return errorSnapshot;
|
|
1928
|
-
}
|
|
1929
1999
|
function createResourceRequest(config) {
|
|
1930
2000
|
const headers = {};
|
|
1931
2001
|
return {
|
|
1932
2002
|
baseUri: '/services/data/v60.0',
|
|
1933
|
-
basePath: '/commerce/extension/
|
|
1934
|
-
method: '
|
|
1935
|
-
body:
|
|
2003
|
+
basePath: '/commerce/extension/mappings/' + config.urlParams.mappingId + '',
|
|
2004
|
+
method: 'put',
|
|
2005
|
+
body: config.body,
|
|
1936
2006
|
urlParams: config.urlParams,
|
|
1937
2007
|
queryParams: {},
|
|
1938
2008
|
headers,
|
|
1939
2009
|
priority: 'normal',
|
|
1940
2010
|
};
|
|
1941
2011
|
}
|
|
1942
|
-
function createResourceRequestFromRepresentation(representation) {
|
|
1943
|
-
const config = {
|
|
1944
|
-
urlParams: {},
|
|
1945
|
-
};
|
|
1946
|
-
config.urlParams.providerId = representation.id;
|
|
1947
|
-
return createResourceRequest(config);
|
|
1948
|
-
}
|
|
1949
2012
|
|
|
1950
|
-
const adapterName = '
|
|
1951
|
-
const
|
|
1952
|
-
generateParamConfigMetadata('
|
|
2013
|
+
const adapterName = 'updateMapping';
|
|
2014
|
+
const updateMapping_ConfigPropertyMetadata = [
|
|
2015
|
+
generateParamConfigMetadata('mappingId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
2016
|
+
generateParamConfigMetadata('epn', true, 2 /* Body */, 0 /* String */),
|
|
2017
|
+
generateParamConfigMetadata('id', false, 2 /* Body */, 0 /* String */),
|
|
2018
|
+
generateParamConfigMetadata('providerName', true, 2 /* Body */, 0 /* String */),
|
|
2019
|
+
generateParamConfigMetadata('webstoreId', true, 2 /* Body */, 0 /* String */),
|
|
1953
2020
|
];
|
|
1954
|
-
const
|
|
1955
|
-
const createResourceParams = /*#__PURE__*/ createResourceParams$8(
|
|
1956
|
-
function keyBuilder(luvio, config) {
|
|
1957
|
-
const resourceParams = createResourceParams(config);
|
|
1958
|
-
return keyBuilder$1(luvio, resourceParams);
|
|
1959
|
-
}
|
|
2021
|
+
const updateMapping_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, updateMapping_ConfigPropertyMetadata);
|
|
2022
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$8(updateMapping_ConfigPropertyMetadata);
|
|
1960
2023
|
function typeCheckConfig(untrustedConfig) {
|
|
1961
2024
|
const config = {};
|
|
1962
|
-
typeCheckConfig$8(untrustedConfig, config,
|
|
2025
|
+
typeCheckConfig$8(untrustedConfig, config, updateMapping_ConfigPropertyMetadata);
|
|
1963
2026
|
return config;
|
|
1964
2027
|
}
|
|
1965
2028
|
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
@@ -1975,95 +2038,32 @@ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
|
1975
2038
|
}
|
|
1976
2039
|
return config;
|
|
1977
2040
|
}
|
|
1978
|
-
function adapterFragment(luvio, config) {
|
|
1979
|
-
createResourceParams(config);
|
|
1980
|
-
return select();
|
|
1981
|
-
}
|
|
1982
|
-
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
1983
|
-
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
1984
|
-
config,
|
|
1985
|
-
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1986
|
-
});
|
|
1987
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
1988
|
-
}
|
|
1989
|
-
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
1990
|
-
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
1991
|
-
config,
|
|
1992
|
-
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1993
|
-
});
|
|
1994
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
1995
|
-
}
|
|
1996
2041
|
function buildNetworkSnapshot(luvio, config, options) {
|
|
1997
2042
|
const resourceParams = createResourceParams(config);
|
|
1998
2043
|
const request = createResourceRequest(resourceParams);
|
|
1999
2044
|
return luvio.dispatchResourceRequest(request, options)
|
|
2000
2045
|
.then((response) => {
|
|
2001
|
-
return luvio.handleSuccessResponse(() =>
|
|
2046
|
+
return luvio.handleSuccessResponse(() => {
|
|
2047
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
2048
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
2049
|
+
}, () => {
|
|
2002
2050
|
const cache = new StoreKeyMap();
|
|
2003
2051
|
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
2004
2052
|
return cache;
|
|
2005
2053
|
});
|
|
2006
2054
|
}, (response) => {
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
}
|
|
2010
|
-
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
2011
|
-
return buildNetworkSnapshotCachePolicy$5(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
|
|
2012
|
-
}
|
|
2013
|
-
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
2014
|
-
const { luvio, config } = context;
|
|
2015
|
-
const selector = {
|
|
2016
|
-
recordId: keyBuilder(luvio, config),
|
|
2017
|
-
node: adapterFragment(luvio, config),
|
|
2018
|
-
variables: {},
|
|
2019
|
-
};
|
|
2020
|
-
const cacheSnapshot = storeLookup(selector, {
|
|
2021
|
-
config,
|
|
2022
|
-
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
2055
|
+
deepFreeze(response);
|
|
2056
|
+
throw response;
|
|
2023
2057
|
});
|
|
2024
|
-
return cacheSnapshot;
|
|
2025
2058
|
}
|
|
2026
|
-
const
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
};
|
|
2035
|
-
const notifyChangeFactory = (luvio, options) => {
|
|
2036
|
-
return function getCommerceExtensionProvidersByProviderIdNotifyChange(configs) {
|
|
2037
|
-
const keys = configs.map(c => keyBuilder$4(luvio, c));
|
|
2038
|
-
luvio.getNotifyChangeStoreEntries(keys).then(entries => {
|
|
2039
|
-
for (let i = 0, len = entries.length; i < len; i++) {
|
|
2040
|
-
const { key, record: val } = entries[i];
|
|
2041
|
-
const refreshRequest = createResourceRequestFromRepresentation(val);
|
|
2042
|
-
luvio.dispatchResourceRequest(refreshRequest, options)
|
|
2043
|
-
.then((response) => {
|
|
2044
|
-
return luvio.handleSuccessResponse(() => {
|
|
2045
|
-
const { body } = response;
|
|
2046
|
-
luvio.storeIngest(key, ingest$1, body);
|
|
2047
|
-
return luvio.storeBroadcast();
|
|
2048
|
-
}, () => {
|
|
2049
|
-
const cache = new StoreKeyMap();
|
|
2050
|
-
getTypeCacheKeys$1(cache, luvio, response.body);
|
|
2051
|
-
return cache;
|
|
2052
|
-
});
|
|
2053
|
-
}, (error) => {
|
|
2054
|
-
return luvio.handleErrorResponse(() => {
|
|
2055
|
-
const errorSnapshot = luvio.errorSnapshot(error);
|
|
2056
|
-
luvio.storeIngestError(key, errorSnapshot, {
|
|
2057
|
-
ttl: TTL$1,
|
|
2058
|
-
namespace: keyPrefix,
|
|
2059
|
-
version: VERSION$1,
|
|
2060
|
-
representationName: RepresentationType$1
|
|
2061
|
-
});
|
|
2062
|
-
return luvio.storeBroadcast().then(() => errorSnapshot);
|
|
2063
|
-
});
|
|
2064
|
-
});
|
|
2065
|
-
}
|
|
2066
|
-
});
|
|
2059
|
+
const updateMappingAdapterFactory = (luvio) => {
|
|
2060
|
+
return function updateMapping(untrustedConfig) {
|
|
2061
|
+
const config = validateAdapterConfig(untrustedConfig, updateMapping_ConfigPropertyNames);
|
|
2062
|
+
// Invalid or incomplete config
|
|
2063
|
+
if (config === null) {
|
|
2064
|
+
throw new Error('Invalid config for "updateMapping"');
|
|
2065
|
+
}
|
|
2066
|
+
return buildNetworkSnapshot(luvio, config);
|
|
2067
2067
|
};
|
|
2068
2068
|
};
|
|
2069
2069
|
|
|
@@ -2088,6 +2088,8 @@ const getMappingMetadata = { apiFamily: 'extensions', name: 'getMapping', ttl: 6
|
|
|
2088
2088
|
const getMappingsMetadata = { apiFamily: 'extensions', name: 'getMappings', ttl: 60000 };
|
|
2089
2089
|
const getProviderMetadata = { apiFamily: 'extensions', name: 'getProvider', ttl: 60000 };
|
|
2090
2090
|
const getProvidersMetadata = { apiFamily: 'extensions', name: 'getProviders', ttl: 60000 };
|
|
2091
|
+
// Notify Update Available
|
|
2092
|
+
let notifyMappingUpdateAvailable;
|
|
2091
2093
|
function bindExportsTo(luvio) {
|
|
2092
2094
|
// LDS Adapters
|
|
2093
2095
|
const getExtensions_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getExtensions', getExtensionsAdapterFactory), getExtensionsMetadata);
|
|
@@ -2101,7 +2103,7 @@ function bindExportsTo(luvio) {
|
|
|
2101
2103
|
}
|
|
2102
2104
|
return {
|
|
2103
2105
|
createMapping: unwrapSnapshotData(createMappingAdapterFactory),
|
|
2104
|
-
deleteMapping: createLDSAdapter(luvio, adapterName$
|
|
2106
|
+
deleteMapping: createLDSAdapter(luvio, adapterName$6, deleteMappingAdapterFactory),
|
|
2105
2107
|
getExtensions: createWireAdapterConstructor(luvio, getExtensions_ldsAdapter, getExtensionsMetadata),
|
|
2106
2108
|
getMapping: createWireAdapterConstructor(luvio, getMapping_ldsAdapter, getMappingMetadata),
|
|
2107
2109
|
getMappingNotifyChange: createLDSAdapter(luvio, 'getMappingNotifyChange', notifyChangeFactory$1),
|
|
@@ -2115,7 +2117,9 @@ function bindExportsTo(luvio) {
|
|
|
2115
2117
|
getMapping_imperative: createImperativeAdapter(luvio, getMapping_ldsAdapter, getMappingMetadata),
|
|
2116
2118
|
getMappings_imperative: createImperativeAdapter(luvio, getMappings_ldsAdapter, getMappingsMetadata),
|
|
2117
2119
|
getProvider_imperative: createImperativeAdapter(luvio, getProvider_ldsAdapter, getProviderMetadata),
|
|
2118
|
-
getProviders_imperative: createImperativeAdapter(luvio, getProviders_ldsAdapter, getProvidersMetadata)
|
|
2120
|
+
getProviders_imperative: createImperativeAdapter(luvio, getProviders_ldsAdapter, getProvidersMetadata),
|
|
2121
|
+
// Notify Update Availables
|
|
2122
|
+
notifyMappingUpdateAvailable: createLDSAdapter(luvio, 'notifyMappingUpdateAvailable', notifyUpdateAvailableFactory)
|
|
2119
2123
|
};
|
|
2120
2124
|
}
|
|
2121
2125
|
withDefaultLuvio((luvio) => {
|
|
@@ -2134,14 +2138,10 @@ withDefaultLuvio((luvio) => {
|
|
|
2134
2138
|
getMapping_imperative,
|
|
2135
2139
|
getMappings_imperative,
|
|
2136
2140
|
getProvider_imperative,
|
|
2137
|
-
getProviders_imperative
|
|
2141
|
+
getProviders_imperative,
|
|
2142
|
+
notifyMappingUpdateAvailable,
|
|
2138
2143
|
} = bindExportsTo(luvio));
|
|
2139
2144
|
});
|
|
2140
2145
|
|
|
2141
|
-
let notifyMappingUpdateAvailable;
|
|
2142
|
-
withDefaultLuvio((luvio) => {
|
|
2143
|
-
notifyMappingUpdateAvailable = createLDSAdapter(luvio, 'notifyMappingUpdateAvailable', notifyUpdateAvailableFactory);
|
|
2144
|
-
});
|
|
2145
|
-
|
|
2146
2146
|
export { createMapping, deleteMapping, getExtensions, getExtensions_imperative, getMapping, getMappingNotifyChange, getMapping_imperative, getMappings, getMappings_imperative, getProvider, getProviderNotifyChange, getProvider_imperative, getProviders, getProviders_imperative, notifyMappingUpdateAvailable, updateMapping };
|
|
2147
|
-
// version: 1.
|
|
2147
|
+
// version: 1.261.0-10ee630e7
|