@salesforce/lds-adapters-commerce-extensions 1.124.1 → 1.124.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/es2018/commerce-extensions.js +1994 -1994
- package/dist/{types → es/es2018/types}/src/generated/adapters/adapter-utils.d.ts +66 -66
- package/dist/{types → es/es2018/types}/src/generated/adapters/createMapping.d.ts +17 -17
- package/dist/{types → es/es2018/types}/src/generated/adapters/deleteMapping.d.ts +13 -13
- package/dist/{types → es/es2018/types}/src/generated/adapters/getExtensions.d.ts +25 -25
- package/dist/{types → es/es2018/types}/src/generated/adapters/getMapping.d.ts +27 -27
- package/dist/{types → es/es2018/types}/src/generated/adapters/getMappings.d.ts +27 -27
- package/dist/{types → es/es2018/types}/src/generated/adapters/getProviders.d.ts +27 -27
- package/dist/{types → es/es2018/types}/src/generated/adapters/updateMapping.d.ts +18 -18
- package/dist/{types → es/es2018/types}/src/generated/artifacts/main.d.ts +7 -7
- package/dist/{types → es/es2018/types}/src/generated/artifacts/sfdc.d.ts +13 -13
- package/dist/{types → es/es2018/types}/src/generated/resources/deleteCommerceExtensionMappingsByMappingId.d.ts +12 -12
- package/dist/{types → es/es2018/types}/src/generated/resources/getCommerceExtensionExtensions.d.ts +12 -12
- package/dist/{types → es/es2018/types}/src/generated/resources/getCommerceExtensionMappings.d.ts +16 -16
- package/dist/{types → es/es2018/types}/src/generated/resources/getCommerceExtensionMappingsByMappingId.d.ts +16 -16
- package/dist/{types → es/es2018/types}/src/generated/resources/getCommerceExtensionProviders.d.ts +16 -16
- package/dist/{types → es/es2018/types}/src/generated/resources/postCommerceExtensionMappings.d.ts +15 -15
- package/dist/{types → es/es2018/types}/src/generated/resources/putCommerceExtensionMappingsByMappingId.d.ts +18 -18
- package/dist/{types → es/es2018/types}/src/generated/types/ApexClassOutputRepresentation.d.ts +38 -38
- package/dist/{types → es/es2018/types}/src/generated/types/EffectiveMappingRepresentation.d.ts +29 -29
- package/dist/{types → es/es2018/types}/src/generated/types/ExtensionOutputCollectionRepresentation.d.ts +43 -43
- package/dist/{types → es/es2018/types}/src/generated/types/ExtensionOutputRepresentation.d.ts +57 -57
- package/dist/{types → es/es2018/types}/src/generated/types/MappingInputRepresentation.d.ts +48 -48
- package/dist/{types → es/es2018/types}/src/generated/types/MappingOutputCollectionRepresentation.d.ts +43 -43
- package/dist/{types → es/es2018/types}/src/generated/types/MappingOutputRepresentation.d.ts +49 -49
- package/dist/{types → es/es2018/types}/src/generated/types/ProviderOutputCollectionRepresentation.d.ts +43 -43
- package/dist/{types → es/es2018/types}/src/generated/types/ProviderOutputRepresentation.d.ts +53 -53
- package/dist/{types → es/es2018/types}/src/generated/types/type-utils.d.ts +39 -39
- package/dist/{types → es/es2018/types}/src/main.d.ts +2 -2
- package/dist/{types → es/es2018/types}/src/sfdc.d.ts +3 -3
- package/package.json +1 -1
- package/sfdc/index.d.ts +1 -1
- package/sfdc/index.js +2093 -2093
- package/dist/umd/es2018/commerce-extensions.js +0 -2066
- package/dist/umd/es5/commerce-extensions.js +0 -2074
|
@@ -6,2046 +6,2046 @@
|
|
|
6
6
|
|
|
7
7
|
import { serializeStructuredKey, StoreKeyMap } from '@luvio/engine';
|
|
8
8
|
|
|
9
|
-
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
10
|
-
const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = Object;
|
|
11
|
-
const { isArray: ArrayIsArray$1 } = Array;
|
|
12
|
-
/**
|
|
13
|
-
* Validates an adapter config is well-formed.
|
|
14
|
-
* @param config The config to validate.
|
|
15
|
-
* @param adapter The adapter validation configuration.
|
|
16
|
-
* @param oneOf The keys the config must contain at least one of.
|
|
17
|
-
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
18
|
-
*/
|
|
19
|
-
function validateConfig(config, adapter, oneOf) {
|
|
20
|
-
const { displayName } = adapter;
|
|
21
|
-
const { required, optional, unsupported } = adapter.parameters;
|
|
22
|
-
if (config === undefined ||
|
|
23
|
-
required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
24
|
-
throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
|
|
25
|
-
}
|
|
26
|
-
if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
27
|
-
throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
|
|
28
|
-
}
|
|
29
|
-
if (unsupported !== undefined &&
|
|
30
|
-
unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
|
|
31
|
-
throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
|
|
32
|
-
}
|
|
33
|
-
const supported = required.concat(optional);
|
|
34
|
-
if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
|
|
35
|
-
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function untrustedIsObject(untrusted) {
|
|
39
|
-
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
|
|
40
|
-
}
|
|
41
|
-
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
42
|
-
return configPropertyNames.parameters.required.every(req => req in config);
|
|
43
|
-
}
|
|
44
|
-
const snapshotRefreshOptions = {
|
|
45
|
-
overrides: {
|
|
46
|
-
headers: {
|
|
47
|
-
'Cache-Control': 'no-cache',
|
|
48
|
-
},
|
|
49
|
-
}
|
|
50
|
-
};
|
|
9
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
10
|
+
const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = Object;
|
|
11
|
+
const { isArray: ArrayIsArray$1 } = Array;
|
|
12
|
+
/**
|
|
13
|
+
* Validates an adapter config is well-formed.
|
|
14
|
+
* @param config The config to validate.
|
|
15
|
+
* @param adapter The adapter validation configuration.
|
|
16
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
17
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
18
|
+
*/
|
|
19
|
+
function validateConfig(config, adapter, oneOf) {
|
|
20
|
+
const { displayName } = adapter;
|
|
21
|
+
const { required, optional, unsupported } = adapter.parameters;
|
|
22
|
+
if (config === undefined ||
|
|
23
|
+
required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
24
|
+
throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
|
|
25
|
+
}
|
|
26
|
+
if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
27
|
+
throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
|
|
28
|
+
}
|
|
29
|
+
if (unsupported !== undefined &&
|
|
30
|
+
unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
|
|
31
|
+
throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
|
|
32
|
+
}
|
|
33
|
+
const supported = required.concat(optional);
|
|
34
|
+
if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
|
|
35
|
+
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function untrustedIsObject(untrusted) {
|
|
39
|
+
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
|
|
40
|
+
}
|
|
41
|
+
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
42
|
+
return configPropertyNames.parameters.required.every(req => req in config);
|
|
43
|
+
}
|
|
44
|
+
const snapshotRefreshOptions = {
|
|
45
|
+
overrides: {
|
|
46
|
+
headers: {
|
|
47
|
+
'Cache-Control': 'no-cache',
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
51
|
const keyPrefix = 'extensions';
|
|
52
52
|
|
|
53
|
-
const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
|
|
54
|
-
const { isArray: ArrayIsArray } = Array;
|
|
55
|
-
const { stringify: JSONStringify } = JSON;
|
|
56
|
-
function equalsArray(a, b, equalsItem) {
|
|
57
|
-
const aLength = a.length;
|
|
58
|
-
const bLength = b.length;
|
|
59
|
-
if (aLength !== bLength) {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
for (let i = 0; i < aLength; i++) {
|
|
63
|
-
if (equalsItem(a[i], b[i]) === false) {
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return true;
|
|
68
|
-
}
|
|
69
|
-
function deepFreeze(value) {
|
|
70
|
-
// No need to freeze primitives
|
|
71
|
-
if (typeof value !== 'object' || value === null) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
if (ArrayIsArray(value)) {
|
|
75
|
-
for (let i = 0, len = value.length; i < len; i += 1) {
|
|
76
|
-
deepFreeze(value[i]);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
const keys = ObjectKeys(value);
|
|
81
|
-
for (let i = 0, len = keys.length; i < len; i += 1) {
|
|
82
|
-
deepFreeze(value[keys[i]]);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
ObjectFreeze(value);
|
|
86
|
-
}
|
|
87
|
-
function createLink(ref) {
|
|
88
|
-
return {
|
|
89
|
-
__ref: serializeStructuredKey(ref),
|
|
90
|
-
};
|
|
53
|
+
const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
|
|
54
|
+
const { isArray: ArrayIsArray } = Array;
|
|
55
|
+
const { stringify: JSONStringify } = JSON;
|
|
56
|
+
function equalsArray(a, b, equalsItem) {
|
|
57
|
+
const aLength = a.length;
|
|
58
|
+
const bLength = b.length;
|
|
59
|
+
if (aLength !== bLength) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
for (let i = 0; i < aLength; i++) {
|
|
63
|
+
if (equalsItem(a[i], b[i]) === false) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
function deepFreeze(value) {
|
|
70
|
+
// No need to freeze primitives
|
|
71
|
+
if (typeof value !== 'object' || value === null) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (ArrayIsArray(value)) {
|
|
75
|
+
for (let i = 0, len = value.length; i < len; i += 1) {
|
|
76
|
+
deepFreeze(value[i]);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
const keys = ObjectKeys(value);
|
|
81
|
+
for (let i = 0, len = keys.length; i < len; i += 1) {
|
|
82
|
+
deepFreeze(value[keys[i]]);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
ObjectFreeze(value);
|
|
86
|
+
}
|
|
87
|
+
function createLink(ref) {
|
|
88
|
+
return {
|
|
89
|
+
__ref: serializeStructuredKey(ref),
|
|
90
|
+
};
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
const TTL$5 = 60000;
|
|
94
|
-
const VERSION$7 = "504c635d0167987915edb8f94a23ca6d";
|
|
95
|
-
function validate$7(obj, path = 'ExtensionOutputRepresentation') {
|
|
96
|
-
const v_error = (() => {
|
|
97
|
-
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
98
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
99
|
-
}
|
|
100
|
-
const obj_domain = obj.domain;
|
|
101
|
-
const path_domain = path + '.domain';
|
|
102
|
-
if (typeof obj_domain !== 'string') {
|
|
103
|
-
return new TypeError('Expected "string" but received "' + typeof obj_domain + '" (at "' + path_domain + '")');
|
|
104
|
-
}
|
|
105
|
-
const obj_epn = obj.epn;
|
|
106
|
-
const path_epn = path + '.epn';
|
|
107
|
-
if (typeof obj_epn !== 'string') {
|
|
108
|
-
return new TypeError('Expected "string" but received "' + typeof obj_epn + '" (at "' + path_epn + '")');
|
|
109
|
-
}
|
|
110
|
-
const obj_name = obj.name;
|
|
111
|
-
const path_name = path + '.name';
|
|
112
|
-
if (typeof obj_name !== 'string') {
|
|
113
|
-
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
114
|
-
}
|
|
115
|
-
const obj_product = obj.product;
|
|
116
|
-
const path_product = path + '.product';
|
|
117
|
-
if (typeof obj_product !== 'string') {
|
|
118
|
-
return new TypeError('Expected "string" but received "' + typeof obj_product + '" (at "' + path_product + '")');
|
|
119
|
-
}
|
|
120
|
-
const obj_status = obj.status;
|
|
121
|
-
const path_status = path + '.status';
|
|
122
|
-
if (typeof obj_status !== 'string') {
|
|
123
|
-
return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
|
|
124
|
-
}
|
|
125
|
-
const obj_type = obj.type;
|
|
126
|
-
const path_type = path + '.type';
|
|
127
|
-
if (typeof obj_type !== 'string') {
|
|
128
|
-
return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
|
|
129
|
-
}
|
|
130
|
-
const obj_version = obj.version;
|
|
131
|
-
const path_version = path + '.version';
|
|
132
|
-
if (typeof obj_version !== 'number' || (typeof obj_version === 'number' && Math.floor(obj_version) !== obj_version)) {
|
|
133
|
-
return new TypeError('Expected "integer" but received "' + typeof obj_version + '" (at "' + path_version + '")');
|
|
134
|
-
}
|
|
135
|
-
})();
|
|
136
|
-
return v_error === undefined ? null : v_error;
|
|
137
|
-
}
|
|
138
|
-
const RepresentationType$5 = 'ExtensionOutputRepresentation';
|
|
139
|
-
function keyBuilder$b(luvio, config) {
|
|
140
|
-
return keyPrefix + '::' + RepresentationType$5 + ':' + config.epn;
|
|
141
|
-
}
|
|
142
|
-
function keyBuilderFromType$2(luvio, object) {
|
|
143
|
-
const keyParams = {
|
|
144
|
-
epn: object.epn
|
|
145
|
-
};
|
|
146
|
-
return keyBuilder$b(luvio, keyParams);
|
|
147
|
-
}
|
|
148
|
-
function normalize$5(input, existing, path, luvio, store, timestamp) {
|
|
149
|
-
return input;
|
|
150
|
-
}
|
|
151
|
-
const select$d = function ExtensionOutputRepresentationSelect() {
|
|
152
|
-
return {
|
|
153
|
-
kind: 'Fragment',
|
|
154
|
-
version: VERSION$7,
|
|
155
|
-
private: [],
|
|
156
|
-
selections: [
|
|
157
|
-
{
|
|
158
|
-
name: 'domain',
|
|
159
|
-
kind: 'Scalar'
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
name: 'epn',
|
|
163
|
-
kind: 'Scalar'
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
name: 'name',
|
|
167
|
-
kind: 'Scalar'
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
name: 'product',
|
|
171
|
-
kind: 'Scalar'
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
name: 'status',
|
|
175
|
-
kind: 'Scalar'
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
name: 'type',
|
|
179
|
-
kind: 'Scalar'
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
name: 'version',
|
|
183
|
-
kind: 'Scalar'
|
|
184
|
-
}
|
|
185
|
-
]
|
|
186
|
-
};
|
|
187
|
-
};
|
|
188
|
-
function equals$7(existing, incoming) {
|
|
189
|
-
const existing_version = existing.version;
|
|
190
|
-
const incoming_version = incoming.version;
|
|
191
|
-
if (!(existing_version === incoming_version)) {
|
|
192
|
-
return false;
|
|
193
|
-
}
|
|
194
|
-
const existing_domain = existing.domain;
|
|
195
|
-
const incoming_domain = incoming.domain;
|
|
196
|
-
if (!(existing_domain === incoming_domain)) {
|
|
197
|
-
return false;
|
|
198
|
-
}
|
|
199
|
-
const existing_epn = existing.epn;
|
|
200
|
-
const incoming_epn = incoming.epn;
|
|
201
|
-
if (!(existing_epn === incoming_epn)) {
|
|
202
|
-
return false;
|
|
203
|
-
}
|
|
204
|
-
const existing_name = existing.name;
|
|
205
|
-
const incoming_name = incoming.name;
|
|
206
|
-
if (!(existing_name === incoming_name)) {
|
|
207
|
-
return false;
|
|
208
|
-
}
|
|
209
|
-
const existing_product = existing.product;
|
|
210
|
-
const incoming_product = incoming.product;
|
|
211
|
-
if (!(existing_product === incoming_product)) {
|
|
212
|
-
return false;
|
|
213
|
-
}
|
|
214
|
-
const existing_status = existing.status;
|
|
215
|
-
const incoming_status = incoming.status;
|
|
216
|
-
if (!(existing_status === incoming_status)) {
|
|
217
|
-
return false;
|
|
218
|
-
}
|
|
219
|
-
const existing_type = existing.type;
|
|
220
|
-
const incoming_type = incoming.type;
|
|
221
|
-
if (!(existing_type === incoming_type)) {
|
|
222
|
-
return false;
|
|
223
|
-
}
|
|
224
|
-
return true;
|
|
225
|
-
}
|
|
226
|
-
const ingest$5 = function ExtensionOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
227
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
228
|
-
const validateError = validate$7(input);
|
|
229
|
-
if (validateError !== null) {
|
|
230
|
-
throw validateError;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
const key = keyBuilderFromType$2(luvio, input);
|
|
234
|
-
const existingRecord = store.readEntry(key);
|
|
235
|
-
const ttlToUse = TTL$5;
|
|
236
|
-
let incomingRecord = normalize$5(input, store.readEntry(key), {
|
|
237
|
-
fullPath: key,
|
|
238
|
-
parent: path.parent,
|
|
239
|
-
propertyName: path.propertyName,
|
|
240
|
-
ttl: ttlToUse
|
|
241
|
-
});
|
|
242
|
-
if (existingRecord === undefined || equals$7(existingRecord, incomingRecord) === false) {
|
|
243
|
-
luvio.storePublish(key, incomingRecord);
|
|
244
|
-
}
|
|
245
|
-
{
|
|
246
|
-
const storeMetadataParams = {
|
|
247
|
-
ttl: ttlToUse,
|
|
248
|
-
namespace: "extensions",
|
|
249
|
-
version: VERSION$7,
|
|
250
|
-
representationName: RepresentationType$5,
|
|
251
|
-
};
|
|
252
|
-
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
253
|
-
}
|
|
254
|
-
return createLink(key);
|
|
255
|
-
};
|
|
256
|
-
function getTypeCacheKeys$5(luvio, input, fullPathFactory) {
|
|
257
|
-
const rootKeySet = new StoreKeyMap();
|
|
258
|
-
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
259
|
-
const rootKey = keyBuilderFromType$2(luvio, input);
|
|
260
|
-
rootKeySet.set(rootKey, {
|
|
261
|
-
namespace: keyPrefix,
|
|
262
|
-
representationName: RepresentationType$5,
|
|
263
|
-
mergeable: false
|
|
264
|
-
});
|
|
265
|
-
return rootKeySet;
|
|
93
|
+
const TTL$5 = 60000;
|
|
94
|
+
const VERSION$7 = "504c635d0167987915edb8f94a23ca6d";
|
|
95
|
+
function validate$7(obj, path = 'ExtensionOutputRepresentation') {
|
|
96
|
+
const v_error = (() => {
|
|
97
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
98
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
99
|
+
}
|
|
100
|
+
const obj_domain = obj.domain;
|
|
101
|
+
const path_domain = path + '.domain';
|
|
102
|
+
if (typeof obj_domain !== 'string') {
|
|
103
|
+
return new TypeError('Expected "string" but received "' + typeof obj_domain + '" (at "' + path_domain + '")');
|
|
104
|
+
}
|
|
105
|
+
const obj_epn = obj.epn;
|
|
106
|
+
const path_epn = path + '.epn';
|
|
107
|
+
if (typeof obj_epn !== 'string') {
|
|
108
|
+
return new TypeError('Expected "string" but received "' + typeof obj_epn + '" (at "' + path_epn + '")');
|
|
109
|
+
}
|
|
110
|
+
const obj_name = obj.name;
|
|
111
|
+
const path_name = path + '.name';
|
|
112
|
+
if (typeof obj_name !== 'string') {
|
|
113
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
114
|
+
}
|
|
115
|
+
const obj_product = obj.product;
|
|
116
|
+
const path_product = path + '.product';
|
|
117
|
+
if (typeof obj_product !== 'string') {
|
|
118
|
+
return new TypeError('Expected "string" but received "' + typeof obj_product + '" (at "' + path_product + '")');
|
|
119
|
+
}
|
|
120
|
+
const obj_status = obj.status;
|
|
121
|
+
const path_status = path + '.status';
|
|
122
|
+
if (typeof obj_status !== 'string') {
|
|
123
|
+
return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
|
|
124
|
+
}
|
|
125
|
+
const obj_type = obj.type;
|
|
126
|
+
const path_type = path + '.type';
|
|
127
|
+
if (typeof obj_type !== 'string') {
|
|
128
|
+
return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
|
|
129
|
+
}
|
|
130
|
+
const obj_version = obj.version;
|
|
131
|
+
const path_version = path + '.version';
|
|
132
|
+
if (typeof obj_version !== 'number' || (typeof obj_version === 'number' && Math.floor(obj_version) !== obj_version)) {
|
|
133
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_version + '" (at "' + path_version + '")');
|
|
134
|
+
}
|
|
135
|
+
})();
|
|
136
|
+
return v_error === undefined ? null : v_error;
|
|
137
|
+
}
|
|
138
|
+
const RepresentationType$5 = 'ExtensionOutputRepresentation';
|
|
139
|
+
function keyBuilder$b(luvio, config) {
|
|
140
|
+
return keyPrefix + '::' + RepresentationType$5 + ':' + config.epn;
|
|
141
|
+
}
|
|
142
|
+
function keyBuilderFromType$2(luvio, object) {
|
|
143
|
+
const keyParams = {
|
|
144
|
+
epn: object.epn
|
|
145
|
+
};
|
|
146
|
+
return keyBuilder$b(luvio, keyParams);
|
|
147
|
+
}
|
|
148
|
+
function normalize$5(input, existing, path, luvio, store, timestamp) {
|
|
149
|
+
return input;
|
|
150
|
+
}
|
|
151
|
+
const select$d = function ExtensionOutputRepresentationSelect() {
|
|
152
|
+
return {
|
|
153
|
+
kind: 'Fragment',
|
|
154
|
+
version: VERSION$7,
|
|
155
|
+
private: [],
|
|
156
|
+
selections: [
|
|
157
|
+
{
|
|
158
|
+
name: 'domain',
|
|
159
|
+
kind: 'Scalar'
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
name: 'epn',
|
|
163
|
+
kind: 'Scalar'
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: 'name',
|
|
167
|
+
kind: 'Scalar'
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
name: 'product',
|
|
171
|
+
kind: 'Scalar'
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
name: 'status',
|
|
175
|
+
kind: 'Scalar'
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
name: 'type',
|
|
179
|
+
kind: 'Scalar'
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
name: 'version',
|
|
183
|
+
kind: 'Scalar'
|
|
184
|
+
}
|
|
185
|
+
]
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
function equals$7(existing, incoming) {
|
|
189
|
+
const existing_version = existing.version;
|
|
190
|
+
const incoming_version = incoming.version;
|
|
191
|
+
if (!(existing_version === incoming_version)) {
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
const existing_domain = existing.domain;
|
|
195
|
+
const incoming_domain = incoming.domain;
|
|
196
|
+
if (!(existing_domain === incoming_domain)) {
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
const existing_epn = existing.epn;
|
|
200
|
+
const incoming_epn = incoming.epn;
|
|
201
|
+
if (!(existing_epn === incoming_epn)) {
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
const existing_name = existing.name;
|
|
205
|
+
const incoming_name = incoming.name;
|
|
206
|
+
if (!(existing_name === incoming_name)) {
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
const existing_product = existing.product;
|
|
210
|
+
const incoming_product = incoming.product;
|
|
211
|
+
if (!(existing_product === incoming_product)) {
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
const existing_status = existing.status;
|
|
215
|
+
const incoming_status = incoming.status;
|
|
216
|
+
if (!(existing_status === incoming_status)) {
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
const existing_type = existing.type;
|
|
220
|
+
const incoming_type = incoming.type;
|
|
221
|
+
if (!(existing_type === incoming_type)) {
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
226
|
+
const ingest$5 = function ExtensionOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
227
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
228
|
+
const validateError = validate$7(input);
|
|
229
|
+
if (validateError !== null) {
|
|
230
|
+
throw validateError;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
const key = keyBuilderFromType$2(luvio, input);
|
|
234
|
+
const existingRecord = store.readEntry(key);
|
|
235
|
+
const ttlToUse = TTL$5;
|
|
236
|
+
let incomingRecord = normalize$5(input, store.readEntry(key), {
|
|
237
|
+
fullPath: key,
|
|
238
|
+
parent: path.parent,
|
|
239
|
+
propertyName: path.propertyName,
|
|
240
|
+
ttl: ttlToUse
|
|
241
|
+
});
|
|
242
|
+
if (existingRecord === undefined || equals$7(existingRecord, incomingRecord) === false) {
|
|
243
|
+
luvio.storePublish(key, incomingRecord);
|
|
244
|
+
}
|
|
245
|
+
{
|
|
246
|
+
const storeMetadataParams = {
|
|
247
|
+
ttl: ttlToUse,
|
|
248
|
+
namespace: "extensions",
|
|
249
|
+
version: VERSION$7,
|
|
250
|
+
representationName: RepresentationType$5,
|
|
251
|
+
};
|
|
252
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
253
|
+
}
|
|
254
|
+
return createLink(key);
|
|
255
|
+
};
|
|
256
|
+
function getTypeCacheKeys$5(luvio, input, fullPathFactory) {
|
|
257
|
+
const rootKeySet = new StoreKeyMap();
|
|
258
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
259
|
+
const rootKey = keyBuilderFromType$2(luvio, input);
|
|
260
|
+
rootKeySet.set(rootKey, {
|
|
261
|
+
namespace: keyPrefix,
|
|
262
|
+
representationName: RepresentationType$5,
|
|
263
|
+
mergeable: false
|
|
264
|
+
});
|
|
265
|
+
return rootKeySet;
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
-
const TTL$4 = 60000;
|
|
269
|
-
const VERSION$6 = "d4f70ccafbea6d39e182d71c60d4ba89";
|
|
270
|
-
function validate$6(obj, path = 'ExtensionOutputCollectionRepresentation') {
|
|
271
|
-
const v_error = (() => {
|
|
272
|
-
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
273
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
274
|
-
}
|
|
275
|
-
const obj_count = obj.count;
|
|
276
|
-
const path_count = path + '.count';
|
|
277
|
-
if (typeof obj_count !== 'number' || (typeof obj_count === 'number' && Math.floor(obj_count) !== obj_count)) {
|
|
278
|
-
return new TypeError('Expected "integer" but received "' + typeof obj_count + '" (at "' + path_count + '")');
|
|
279
|
-
}
|
|
280
|
-
const obj_items = obj.items;
|
|
281
|
-
const path_items = path + '.items';
|
|
282
|
-
if (!ArrayIsArray(obj_items)) {
|
|
283
|
-
return new TypeError('Expected "array" but received "' + typeof obj_items + '" (at "' + path_items + '")');
|
|
284
|
-
}
|
|
285
|
-
for (let i = 0; i < obj_items.length; i++) {
|
|
286
|
-
const obj_items_item = obj_items[i];
|
|
287
|
-
const path_items_item = path_items + '[' + i + ']';
|
|
288
|
-
if (typeof obj_items_item !== 'object') {
|
|
289
|
-
return new TypeError('Expected "object" but received "' + typeof obj_items_item + '" (at "' + path_items_item + '")');
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
})();
|
|
293
|
-
return v_error === undefined ? null : v_error;
|
|
294
|
-
}
|
|
295
|
-
const RepresentationType$4 = 'ExtensionOutputCollectionRepresentation';
|
|
296
|
-
function normalize$4(input, existing, path, luvio, store, timestamp) {
|
|
297
|
-
const input_items = input.items;
|
|
298
|
-
const input_items_id = path.fullPath + '__items';
|
|
299
|
-
for (let i = 0; i < input_items.length; i++) {
|
|
300
|
-
const input_items_item = input_items[i];
|
|
301
|
-
let input_items_item_id = input_items_id + '__' + i;
|
|
302
|
-
input_items[i] = ingest$5(input_items_item, {
|
|
303
|
-
fullPath: input_items_item_id,
|
|
304
|
-
propertyName: i,
|
|
305
|
-
parent: {
|
|
306
|
-
data: input,
|
|
307
|
-
key: path.fullPath,
|
|
308
|
-
existing: existing,
|
|
309
|
-
},
|
|
310
|
-
ttl: path.ttl
|
|
311
|
-
}, luvio, store);
|
|
312
|
-
}
|
|
313
|
-
return input;
|
|
314
|
-
}
|
|
315
|
-
const select$c = function ExtensionOutputCollectionRepresentationSelect() {
|
|
316
|
-
return {
|
|
317
|
-
kind: 'Fragment',
|
|
318
|
-
version: VERSION$6,
|
|
319
|
-
private: [],
|
|
320
|
-
selections: [
|
|
321
|
-
{
|
|
322
|
-
name: 'count',
|
|
323
|
-
kind: 'Scalar'
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
name: 'items',
|
|
327
|
-
kind: 'Link',
|
|
328
|
-
plural: true,
|
|
329
|
-
fragment: select$d()
|
|
330
|
-
}
|
|
331
|
-
]
|
|
332
|
-
};
|
|
333
|
-
};
|
|
334
|
-
function equals$6(existing, incoming) {
|
|
335
|
-
const existing_count = existing.count;
|
|
336
|
-
const incoming_count = incoming.count;
|
|
337
|
-
if (!(existing_count === incoming_count)) {
|
|
338
|
-
return false;
|
|
339
|
-
}
|
|
340
|
-
const existing_items = existing.items;
|
|
341
|
-
const incoming_items = incoming.items;
|
|
342
|
-
const equals_items_items = equalsArray(existing_items, incoming_items, (existing_items_item, incoming_items_item) => {
|
|
343
|
-
if (!(existing_items_item.__ref === incoming_items_item.__ref)) {
|
|
344
|
-
return false;
|
|
345
|
-
}
|
|
346
|
-
});
|
|
347
|
-
if (equals_items_items === false) {
|
|
348
|
-
return false;
|
|
349
|
-
}
|
|
350
|
-
return true;
|
|
351
|
-
}
|
|
352
|
-
const ingest$4 = function ExtensionOutputCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
353
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
354
|
-
const validateError = validate$6(input);
|
|
355
|
-
if (validateError !== null) {
|
|
356
|
-
throw validateError;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
const key = path.fullPath;
|
|
360
|
-
const existingRecord = store.readEntry(key);
|
|
361
|
-
const ttlToUse = TTL$4;
|
|
362
|
-
let incomingRecord = normalize$4(input, store.readEntry(key), {
|
|
363
|
-
fullPath: key,
|
|
364
|
-
parent: path.parent,
|
|
365
|
-
propertyName: path.propertyName,
|
|
366
|
-
ttl: ttlToUse
|
|
367
|
-
}, luvio, store);
|
|
368
|
-
if (existingRecord === undefined || equals$6(existingRecord, incomingRecord) === false) {
|
|
369
|
-
luvio.storePublish(key, incomingRecord);
|
|
370
|
-
}
|
|
371
|
-
{
|
|
372
|
-
const storeMetadataParams = {
|
|
373
|
-
ttl: ttlToUse,
|
|
374
|
-
namespace: "extensions",
|
|
375
|
-
version: VERSION$6,
|
|
376
|
-
representationName: RepresentationType$4,
|
|
377
|
-
};
|
|
378
|
-
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
379
|
-
}
|
|
380
|
-
return createLink(key);
|
|
381
|
-
};
|
|
382
|
-
function getTypeCacheKeys$4(luvio, input, fullPathFactory) {
|
|
383
|
-
const rootKeySet = new StoreKeyMap();
|
|
384
|
-
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
385
|
-
const rootKey = fullPathFactory();
|
|
386
|
-
rootKeySet.set(rootKey, {
|
|
387
|
-
namespace: keyPrefix,
|
|
388
|
-
representationName: RepresentationType$4,
|
|
389
|
-
mergeable: false
|
|
390
|
-
});
|
|
391
|
-
const input_items_length = input.items.length;
|
|
392
|
-
for (let i = 0; i < input_items_length; i++) {
|
|
393
|
-
rootKeySet.merge(getTypeCacheKeys$5(luvio, input.items[i]));
|
|
394
|
-
}
|
|
395
|
-
return rootKeySet;
|
|
268
|
+
const TTL$4 = 60000;
|
|
269
|
+
const VERSION$6 = "d4f70ccafbea6d39e182d71c60d4ba89";
|
|
270
|
+
function validate$6(obj, path = 'ExtensionOutputCollectionRepresentation') {
|
|
271
|
+
const v_error = (() => {
|
|
272
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
273
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
274
|
+
}
|
|
275
|
+
const obj_count = obj.count;
|
|
276
|
+
const path_count = path + '.count';
|
|
277
|
+
if (typeof obj_count !== 'number' || (typeof obj_count === 'number' && Math.floor(obj_count) !== obj_count)) {
|
|
278
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_count + '" (at "' + path_count + '")');
|
|
279
|
+
}
|
|
280
|
+
const obj_items = obj.items;
|
|
281
|
+
const path_items = path + '.items';
|
|
282
|
+
if (!ArrayIsArray(obj_items)) {
|
|
283
|
+
return new TypeError('Expected "array" but received "' + typeof obj_items + '" (at "' + path_items + '")');
|
|
284
|
+
}
|
|
285
|
+
for (let i = 0; i < obj_items.length; i++) {
|
|
286
|
+
const obj_items_item = obj_items[i];
|
|
287
|
+
const path_items_item = path_items + '[' + i + ']';
|
|
288
|
+
if (typeof obj_items_item !== 'object') {
|
|
289
|
+
return new TypeError('Expected "object" but received "' + typeof obj_items_item + '" (at "' + path_items_item + '")');
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
})();
|
|
293
|
+
return v_error === undefined ? null : v_error;
|
|
294
|
+
}
|
|
295
|
+
const RepresentationType$4 = 'ExtensionOutputCollectionRepresentation';
|
|
296
|
+
function normalize$4(input, existing, path, luvio, store, timestamp) {
|
|
297
|
+
const input_items = input.items;
|
|
298
|
+
const input_items_id = path.fullPath + '__items';
|
|
299
|
+
for (let i = 0; i < input_items.length; i++) {
|
|
300
|
+
const input_items_item = input_items[i];
|
|
301
|
+
let input_items_item_id = input_items_id + '__' + i;
|
|
302
|
+
input_items[i] = ingest$5(input_items_item, {
|
|
303
|
+
fullPath: input_items_item_id,
|
|
304
|
+
propertyName: i,
|
|
305
|
+
parent: {
|
|
306
|
+
data: input,
|
|
307
|
+
key: path.fullPath,
|
|
308
|
+
existing: existing,
|
|
309
|
+
},
|
|
310
|
+
ttl: path.ttl
|
|
311
|
+
}, luvio, store);
|
|
312
|
+
}
|
|
313
|
+
return input;
|
|
314
|
+
}
|
|
315
|
+
const select$c = function ExtensionOutputCollectionRepresentationSelect() {
|
|
316
|
+
return {
|
|
317
|
+
kind: 'Fragment',
|
|
318
|
+
version: VERSION$6,
|
|
319
|
+
private: [],
|
|
320
|
+
selections: [
|
|
321
|
+
{
|
|
322
|
+
name: 'count',
|
|
323
|
+
kind: 'Scalar'
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
name: 'items',
|
|
327
|
+
kind: 'Link',
|
|
328
|
+
plural: true,
|
|
329
|
+
fragment: select$d()
|
|
330
|
+
}
|
|
331
|
+
]
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
function equals$6(existing, incoming) {
|
|
335
|
+
const existing_count = existing.count;
|
|
336
|
+
const incoming_count = incoming.count;
|
|
337
|
+
if (!(existing_count === incoming_count)) {
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
340
|
+
const existing_items = existing.items;
|
|
341
|
+
const incoming_items = incoming.items;
|
|
342
|
+
const equals_items_items = equalsArray(existing_items, incoming_items, (existing_items_item, incoming_items_item) => {
|
|
343
|
+
if (!(existing_items_item.__ref === incoming_items_item.__ref)) {
|
|
344
|
+
return false;
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
if (equals_items_items === false) {
|
|
348
|
+
return false;
|
|
349
|
+
}
|
|
350
|
+
return true;
|
|
351
|
+
}
|
|
352
|
+
const ingest$4 = function ExtensionOutputCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
353
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
354
|
+
const validateError = validate$6(input);
|
|
355
|
+
if (validateError !== null) {
|
|
356
|
+
throw validateError;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
const key = path.fullPath;
|
|
360
|
+
const existingRecord = store.readEntry(key);
|
|
361
|
+
const ttlToUse = TTL$4;
|
|
362
|
+
let incomingRecord = normalize$4(input, store.readEntry(key), {
|
|
363
|
+
fullPath: key,
|
|
364
|
+
parent: path.parent,
|
|
365
|
+
propertyName: path.propertyName,
|
|
366
|
+
ttl: ttlToUse
|
|
367
|
+
}, luvio, store);
|
|
368
|
+
if (existingRecord === undefined || equals$6(existingRecord, incomingRecord) === false) {
|
|
369
|
+
luvio.storePublish(key, incomingRecord);
|
|
370
|
+
}
|
|
371
|
+
{
|
|
372
|
+
const storeMetadataParams = {
|
|
373
|
+
ttl: ttlToUse,
|
|
374
|
+
namespace: "extensions",
|
|
375
|
+
version: VERSION$6,
|
|
376
|
+
representationName: RepresentationType$4,
|
|
377
|
+
};
|
|
378
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
379
|
+
}
|
|
380
|
+
return createLink(key);
|
|
381
|
+
};
|
|
382
|
+
function getTypeCacheKeys$4(luvio, input, fullPathFactory) {
|
|
383
|
+
const rootKeySet = new StoreKeyMap();
|
|
384
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
385
|
+
const rootKey = fullPathFactory();
|
|
386
|
+
rootKeySet.set(rootKey, {
|
|
387
|
+
namespace: keyPrefix,
|
|
388
|
+
representationName: RepresentationType$4,
|
|
389
|
+
mergeable: false
|
|
390
|
+
});
|
|
391
|
+
const input_items_length = input.items.length;
|
|
392
|
+
for (let i = 0; i < input_items_length; i++) {
|
|
393
|
+
rootKeySet.merge(getTypeCacheKeys$5(luvio, input.items[i]));
|
|
394
|
+
}
|
|
395
|
+
return rootKeySet;
|
|
396
396
|
}
|
|
397
397
|
|
|
398
|
-
function select$b(luvio, params) {
|
|
399
|
-
return select$c();
|
|
400
|
-
}
|
|
401
|
-
function keyBuilder$a(luvio, params) {
|
|
402
|
-
return keyPrefix + '::ExtensionOutputCollectionRepresentation:(' + ')';
|
|
403
|
-
}
|
|
404
|
-
function getResponseCacheKeys$6(luvio, resourceParams, response) {
|
|
405
|
-
return getTypeCacheKeys$4(luvio, response, () => keyBuilder$a());
|
|
406
|
-
}
|
|
407
|
-
function ingestSuccess$5(luvio, resourceParams, response, snapshotRefresh) {
|
|
408
|
-
const { body } = response;
|
|
409
|
-
const key = keyBuilder$a();
|
|
410
|
-
luvio.storeIngest(key, ingest$4, body);
|
|
411
|
-
const snapshot = luvio.storeLookup({
|
|
412
|
-
recordId: key,
|
|
413
|
-
node: select$b(),
|
|
414
|
-
variables: {},
|
|
415
|
-
}, snapshotRefresh);
|
|
416
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
417
|
-
if (snapshot.state !== 'Fulfilled') {
|
|
418
|
-
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
return snapshot;
|
|
422
|
-
}
|
|
423
|
-
function ingestError$3(luvio, params, error, snapshotRefresh) {
|
|
424
|
-
const key = keyBuilder$a();
|
|
425
|
-
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
426
|
-
const storeMetadataParams = {
|
|
427
|
-
ttl: TTL$4,
|
|
428
|
-
namespace: keyPrefix,
|
|
429
|
-
version: VERSION$6,
|
|
430
|
-
representationName: RepresentationType$4
|
|
431
|
-
};
|
|
432
|
-
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
433
|
-
return errorSnapshot;
|
|
434
|
-
}
|
|
435
|
-
function createResourceRequest$6(config) {
|
|
436
|
-
const headers = {};
|
|
437
|
-
return {
|
|
438
|
-
baseUri: '/services/data/v58.0',
|
|
439
|
-
basePath: '/commerce/extension/extensions',
|
|
440
|
-
method: 'get',
|
|
441
|
-
body: null,
|
|
442
|
-
urlParams: {},
|
|
443
|
-
queryParams: {},
|
|
444
|
-
headers,
|
|
445
|
-
priority: 'normal',
|
|
446
|
-
};
|
|
398
|
+
function select$b(luvio, params) {
|
|
399
|
+
return select$c();
|
|
400
|
+
}
|
|
401
|
+
function keyBuilder$a(luvio, params) {
|
|
402
|
+
return keyPrefix + '::ExtensionOutputCollectionRepresentation:(' + ')';
|
|
403
|
+
}
|
|
404
|
+
function getResponseCacheKeys$6(luvio, resourceParams, response) {
|
|
405
|
+
return getTypeCacheKeys$4(luvio, response, () => keyBuilder$a());
|
|
406
|
+
}
|
|
407
|
+
function ingestSuccess$5(luvio, resourceParams, response, snapshotRefresh) {
|
|
408
|
+
const { body } = response;
|
|
409
|
+
const key = keyBuilder$a();
|
|
410
|
+
luvio.storeIngest(key, ingest$4, body);
|
|
411
|
+
const snapshot = luvio.storeLookup({
|
|
412
|
+
recordId: key,
|
|
413
|
+
node: select$b(),
|
|
414
|
+
variables: {},
|
|
415
|
+
}, snapshotRefresh);
|
|
416
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
417
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
418
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
return snapshot;
|
|
422
|
+
}
|
|
423
|
+
function ingestError$3(luvio, params, error, snapshotRefresh) {
|
|
424
|
+
const key = keyBuilder$a();
|
|
425
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
426
|
+
const storeMetadataParams = {
|
|
427
|
+
ttl: TTL$4,
|
|
428
|
+
namespace: keyPrefix,
|
|
429
|
+
version: VERSION$6,
|
|
430
|
+
representationName: RepresentationType$4
|
|
431
|
+
};
|
|
432
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
433
|
+
return errorSnapshot;
|
|
434
|
+
}
|
|
435
|
+
function createResourceRequest$6(config) {
|
|
436
|
+
const headers = {};
|
|
437
|
+
return {
|
|
438
|
+
baseUri: '/services/data/v58.0',
|
|
439
|
+
basePath: '/commerce/extension/extensions',
|
|
440
|
+
method: 'get',
|
|
441
|
+
body: null,
|
|
442
|
+
urlParams: {},
|
|
443
|
+
queryParams: {},
|
|
444
|
+
headers,
|
|
445
|
+
priority: 'normal',
|
|
446
|
+
};
|
|
447
447
|
}
|
|
448
448
|
|
|
449
|
-
const getExtensions_ConfigPropertyNames = {
|
|
450
|
-
displayName: 'getExtensions',
|
|
451
|
-
parameters: {
|
|
452
|
-
required: [],
|
|
453
|
-
optional: []
|
|
454
|
-
}
|
|
455
|
-
};
|
|
456
|
-
function createResourceParams$6(config) {
|
|
457
|
-
const resourceParams = {};
|
|
458
|
-
return resourceParams;
|
|
459
|
-
}
|
|
460
|
-
function keyBuilder$9(luvio, config) {
|
|
461
|
-
return keyBuilder$a();
|
|
462
|
-
}
|
|
463
|
-
function typeCheckConfig$6(untrustedConfig) {
|
|
464
|
-
const config = {};
|
|
465
|
-
return config;
|
|
466
|
-
}
|
|
467
|
-
function validateAdapterConfig$6(untrustedConfig, configPropertyNames) {
|
|
468
|
-
if (!untrustedIsObject(untrustedConfig)) {
|
|
469
|
-
return null;
|
|
470
|
-
}
|
|
471
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
472
|
-
validateConfig(untrustedConfig, configPropertyNames);
|
|
473
|
-
}
|
|
474
|
-
const config = typeCheckConfig$6();
|
|
475
|
-
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
476
|
-
return null;
|
|
477
|
-
}
|
|
478
|
-
return config;
|
|
479
|
-
}
|
|
480
|
-
function adapterFragment$3(luvio, config) {
|
|
481
|
-
return select$b();
|
|
482
|
-
}
|
|
483
|
-
function onFetchResponseSuccess$3(luvio, config, resourceParams, response) {
|
|
484
|
-
const snapshot = ingestSuccess$5(luvio, resourceParams, response, {
|
|
485
|
-
config,
|
|
486
|
-
resolve: () => buildNetworkSnapshot$6(luvio, config, snapshotRefreshOptions)
|
|
487
|
-
});
|
|
488
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
489
|
-
}
|
|
490
|
-
function onFetchResponseError$3(luvio, config, resourceParams, response) {
|
|
491
|
-
const snapshot = ingestError$3(luvio, resourceParams, response, {
|
|
492
|
-
config,
|
|
493
|
-
resolve: () => buildNetworkSnapshot$6(luvio, config, snapshotRefreshOptions)
|
|
494
|
-
});
|
|
495
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
496
|
-
}
|
|
497
|
-
function buildNetworkSnapshot$6(luvio, config, options) {
|
|
498
|
-
const resourceParams = createResourceParams$6();
|
|
499
|
-
const request = createResourceRequest$6();
|
|
500
|
-
return luvio.dispatchResourceRequest(request, options)
|
|
501
|
-
.then((response) => {
|
|
502
|
-
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$3(luvio, config, resourceParams, response), () => getResponseCacheKeys$6(luvio, resourceParams, response.body));
|
|
503
|
-
}, (response) => {
|
|
504
|
-
return luvio.handleErrorResponse(() => onFetchResponseError$3(luvio, config, resourceParams, response));
|
|
505
|
-
});
|
|
506
|
-
}
|
|
507
|
-
function buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext) {
|
|
508
|
-
const { luvio, config } = context;
|
|
509
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
510
|
-
const dispatchOptions = {
|
|
511
|
-
resourceRequestContext: {
|
|
512
|
-
requestCorrelator,
|
|
513
|
-
luvioRequestMethod: undefined,
|
|
514
|
-
},
|
|
515
|
-
eventObservers
|
|
516
|
-
};
|
|
517
|
-
if (networkPriority !== 'normal') {
|
|
518
|
-
dispatchOptions.overrides = {
|
|
519
|
-
priority: networkPriority
|
|
520
|
-
};
|
|
521
|
-
}
|
|
522
|
-
return buildNetworkSnapshot$6(luvio, config, dispatchOptions);
|
|
523
|
-
}
|
|
524
|
-
function buildCachedSnapshotCachePolicy$3(context, storeLookup) {
|
|
525
|
-
const { luvio, config } = context;
|
|
526
|
-
const selector = {
|
|
527
|
-
recordId: keyBuilder$9(),
|
|
528
|
-
node: adapterFragment$3(),
|
|
529
|
-
variables: {},
|
|
530
|
-
};
|
|
531
|
-
const cacheSnapshot = storeLookup(selector, {
|
|
532
|
-
config,
|
|
533
|
-
resolve: () => buildNetworkSnapshot$6(luvio, config, snapshotRefreshOptions)
|
|
534
|
-
});
|
|
535
|
-
return cacheSnapshot;
|
|
536
|
-
}
|
|
537
|
-
const getExtensionsAdapterFactory = (luvio) => function extensions__getExtensions(untrustedConfig, requestContext) {
|
|
538
|
-
const config = validateAdapterConfig$6(untrustedConfig, getExtensions_ConfigPropertyNames);
|
|
539
|
-
// Invalid or incomplete config
|
|
540
|
-
if (config === null) {
|
|
541
|
-
return null;
|
|
542
|
-
}
|
|
543
|
-
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
544
|
-
buildCachedSnapshotCachePolicy$3, buildNetworkSnapshotCachePolicy$3);
|
|
449
|
+
const getExtensions_ConfigPropertyNames = {
|
|
450
|
+
displayName: 'getExtensions',
|
|
451
|
+
parameters: {
|
|
452
|
+
required: [],
|
|
453
|
+
optional: []
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
function createResourceParams$6(config) {
|
|
457
|
+
const resourceParams = {};
|
|
458
|
+
return resourceParams;
|
|
459
|
+
}
|
|
460
|
+
function keyBuilder$9(luvio, config) {
|
|
461
|
+
return keyBuilder$a();
|
|
462
|
+
}
|
|
463
|
+
function typeCheckConfig$6(untrustedConfig) {
|
|
464
|
+
const config = {};
|
|
465
|
+
return config;
|
|
466
|
+
}
|
|
467
|
+
function validateAdapterConfig$6(untrustedConfig, configPropertyNames) {
|
|
468
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
469
|
+
return null;
|
|
470
|
+
}
|
|
471
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
472
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
473
|
+
}
|
|
474
|
+
const config = typeCheckConfig$6();
|
|
475
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
476
|
+
return null;
|
|
477
|
+
}
|
|
478
|
+
return config;
|
|
479
|
+
}
|
|
480
|
+
function adapterFragment$3(luvio, config) {
|
|
481
|
+
return select$b();
|
|
482
|
+
}
|
|
483
|
+
function onFetchResponseSuccess$3(luvio, config, resourceParams, response) {
|
|
484
|
+
const snapshot = ingestSuccess$5(luvio, resourceParams, response, {
|
|
485
|
+
config,
|
|
486
|
+
resolve: () => buildNetworkSnapshot$6(luvio, config, snapshotRefreshOptions)
|
|
487
|
+
});
|
|
488
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
489
|
+
}
|
|
490
|
+
function onFetchResponseError$3(luvio, config, resourceParams, response) {
|
|
491
|
+
const snapshot = ingestError$3(luvio, resourceParams, response, {
|
|
492
|
+
config,
|
|
493
|
+
resolve: () => buildNetworkSnapshot$6(luvio, config, snapshotRefreshOptions)
|
|
494
|
+
});
|
|
495
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
496
|
+
}
|
|
497
|
+
function buildNetworkSnapshot$6(luvio, config, options) {
|
|
498
|
+
const resourceParams = createResourceParams$6();
|
|
499
|
+
const request = createResourceRequest$6();
|
|
500
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
501
|
+
.then((response) => {
|
|
502
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$3(luvio, config, resourceParams, response), () => getResponseCacheKeys$6(luvio, resourceParams, response.body));
|
|
503
|
+
}, (response) => {
|
|
504
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$3(luvio, config, resourceParams, response));
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
function buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext) {
|
|
508
|
+
const { luvio, config } = context;
|
|
509
|
+
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
510
|
+
const dispatchOptions = {
|
|
511
|
+
resourceRequestContext: {
|
|
512
|
+
requestCorrelator,
|
|
513
|
+
luvioRequestMethod: undefined,
|
|
514
|
+
},
|
|
515
|
+
eventObservers
|
|
516
|
+
};
|
|
517
|
+
if (networkPriority !== 'normal') {
|
|
518
|
+
dispatchOptions.overrides = {
|
|
519
|
+
priority: networkPriority
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
return buildNetworkSnapshot$6(luvio, config, dispatchOptions);
|
|
523
|
+
}
|
|
524
|
+
function buildCachedSnapshotCachePolicy$3(context, storeLookup) {
|
|
525
|
+
const { luvio, config } = context;
|
|
526
|
+
const selector = {
|
|
527
|
+
recordId: keyBuilder$9(),
|
|
528
|
+
node: adapterFragment$3(),
|
|
529
|
+
variables: {},
|
|
530
|
+
};
|
|
531
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
532
|
+
config,
|
|
533
|
+
resolve: () => buildNetworkSnapshot$6(luvio, config, snapshotRefreshOptions)
|
|
534
|
+
});
|
|
535
|
+
return cacheSnapshot;
|
|
536
|
+
}
|
|
537
|
+
const getExtensionsAdapterFactory = (luvio) => function extensions__getExtensions(untrustedConfig, requestContext) {
|
|
538
|
+
const config = validateAdapterConfig$6(untrustedConfig, getExtensions_ConfigPropertyNames);
|
|
539
|
+
// Invalid or incomplete config
|
|
540
|
+
if (config === null) {
|
|
541
|
+
return null;
|
|
542
|
+
}
|
|
543
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
544
|
+
buildCachedSnapshotCachePolicy$3, buildNetworkSnapshotCachePolicy$3);
|
|
545
545
|
};
|
|
546
546
|
|
|
547
|
-
const TTL$3 = 60000;
|
|
548
|
-
const VERSION$5 = "cef52859122e69e7f8552d6d2fbf67f8";
|
|
549
|
-
function validate$5(obj, path = 'MappingOutputRepresentation') {
|
|
550
|
-
const v_error = (() => {
|
|
551
|
-
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
552
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
553
|
-
}
|
|
554
|
-
const obj_epn = obj.epn;
|
|
555
|
-
const path_epn = path + '.epn';
|
|
556
|
-
if (typeof obj_epn !== 'string') {
|
|
557
|
-
return new TypeError('Expected "string" but received "' + typeof obj_epn + '" (at "' + path_epn + '")');
|
|
558
|
-
}
|
|
559
|
-
const obj_id = obj.id;
|
|
560
|
-
const path_id = path + '.id';
|
|
561
|
-
if (typeof obj_id !== 'string') {
|
|
562
|
-
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
563
|
-
}
|
|
564
|
-
const obj_providerName = obj.providerName;
|
|
565
|
-
const path_providerName = path + '.providerName';
|
|
566
|
-
if (typeof obj_providerName !== 'string') {
|
|
567
|
-
return new TypeError('Expected "string" but received "' + typeof obj_providerName + '" (at "' + path_providerName + '")');
|
|
568
|
-
}
|
|
569
|
-
const obj_webstoreId = obj.webstoreId;
|
|
570
|
-
const path_webstoreId = path + '.webstoreId';
|
|
571
|
-
if (typeof obj_webstoreId !== 'string') {
|
|
572
|
-
return new TypeError('Expected "string" but received "' + typeof obj_webstoreId + '" (at "' + path_webstoreId + '")');
|
|
573
|
-
}
|
|
574
|
-
})();
|
|
575
|
-
return v_error === undefined ? null : v_error;
|
|
576
|
-
}
|
|
577
|
-
const RepresentationType$3 = 'MappingOutputRepresentation';
|
|
578
|
-
function keyBuilder$8(luvio, config) {
|
|
579
|
-
return keyPrefix + '::' + RepresentationType$3 + ':' + config.id;
|
|
580
|
-
}
|
|
581
|
-
function keyBuilderFromType$1(luvio, object) {
|
|
582
|
-
const keyParams = {
|
|
583
|
-
id: object.id
|
|
584
|
-
};
|
|
585
|
-
return keyBuilder$8(luvio, keyParams);
|
|
586
|
-
}
|
|
587
|
-
function normalize$3(input, existing, path, luvio, store, timestamp) {
|
|
588
|
-
return input;
|
|
589
|
-
}
|
|
590
|
-
const select$a = function MappingOutputRepresentationSelect() {
|
|
591
|
-
return {
|
|
592
|
-
kind: 'Fragment',
|
|
593
|
-
version: VERSION$5,
|
|
594
|
-
private: [],
|
|
595
|
-
selections: [
|
|
596
|
-
{
|
|
597
|
-
name: 'epn',
|
|
598
|
-
kind: 'Scalar'
|
|
599
|
-
},
|
|
600
|
-
{
|
|
601
|
-
name: 'id',
|
|
602
|
-
kind: 'Scalar'
|
|
603
|
-
},
|
|
604
|
-
{
|
|
605
|
-
name: 'providerName',
|
|
606
|
-
kind: 'Scalar'
|
|
607
|
-
},
|
|
608
|
-
{
|
|
609
|
-
name: 'webstoreId',
|
|
610
|
-
kind: 'Scalar'
|
|
611
|
-
}
|
|
612
|
-
]
|
|
613
|
-
};
|
|
614
|
-
};
|
|
615
|
-
function equals$5(existing, incoming) {
|
|
616
|
-
const existing_epn = existing.epn;
|
|
617
|
-
const incoming_epn = incoming.epn;
|
|
618
|
-
if (!(existing_epn === incoming_epn)) {
|
|
619
|
-
return false;
|
|
620
|
-
}
|
|
621
|
-
const existing_id = existing.id;
|
|
622
|
-
const incoming_id = incoming.id;
|
|
623
|
-
if (!(existing_id === incoming_id)) {
|
|
624
|
-
return false;
|
|
625
|
-
}
|
|
626
|
-
const existing_providerName = existing.providerName;
|
|
627
|
-
const incoming_providerName = incoming.providerName;
|
|
628
|
-
if (!(existing_providerName === incoming_providerName)) {
|
|
629
|
-
return false;
|
|
630
|
-
}
|
|
631
|
-
const existing_webstoreId = existing.webstoreId;
|
|
632
|
-
const incoming_webstoreId = incoming.webstoreId;
|
|
633
|
-
if (!(existing_webstoreId === incoming_webstoreId)) {
|
|
634
|
-
return false;
|
|
635
|
-
}
|
|
636
|
-
return true;
|
|
637
|
-
}
|
|
638
|
-
const ingest$3 = function MappingOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
639
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
640
|
-
const validateError = validate$5(input);
|
|
641
|
-
if (validateError !== null) {
|
|
642
|
-
throw validateError;
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
const key = keyBuilderFromType$1(luvio, input);
|
|
646
|
-
const existingRecord = store.readEntry(key);
|
|
647
|
-
const ttlToUse = TTL$3;
|
|
648
|
-
let incomingRecord = normalize$3(input, store.readEntry(key), {
|
|
649
|
-
fullPath: key,
|
|
650
|
-
parent: path.parent,
|
|
651
|
-
propertyName: path.propertyName,
|
|
652
|
-
ttl: ttlToUse
|
|
653
|
-
});
|
|
654
|
-
if (existingRecord === undefined || equals$5(existingRecord, incomingRecord) === false) {
|
|
655
|
-
luvio.storePublish(key, incomingRecord);
|
|
656
|
-
}
|
|
657
|
-
{
|
|
658
|
-
const storeMetadataParams = {
|
|
659
|
-
ttl: ttlToUse,
|
|
660
|
-
namespace: "extensions",
|
|
661
|
-
version: VERSION$5,
|
|
662
|
-
representationName: RepresentationType$3,
|
|
663
|
-
};
|
|
664
|
-
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
665
|
-
}
|
|
666
|
-
return createLink(key);
|
|
667
|
-
};
|
|
668
|
-
function getTypeCacheKeys$3(luvio, input, fullPathFactory) {
|
|
669
|
-
const rootKeySet = new StoreKeyMap();
|
|
670
|
-
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
671
|
-
const rootKey = keyBuilderFromType$1(luvio, input);
|
|
672
|
-
rootKeySet.set(rootKey, {
|
|
673
|
-
namespace: keyPrefix,
|
|
674
|
-
representationName: RepresentationType$3,
|
|
675
|
-
mergeable: false
|
|
676
|
-
});
|
|
677
|
-
return rootKeySet;
|
|
678
|
-
}
|
|
679
|
-
const notifyUpdateAvailableFactory = (luvio) => {
|
|
680
|
-
return function notifyMappingUpdateAvailable(configs) {
|
|
681
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
682
|
-
const requiredKeyParams = ['id'];
|
|
683
|
-
configs.forEach(config => {
|
|
684
|
-
if (false === requiredKeyParams.every(req => req in config)) {
|
|
685
|
-
throw new Error(`one of the configs did not contain all required parameters: ${JSONStringify(ObjectKeys(config))}`);
|
|
686
|
-
}
|
|
687
|
-
});
|
|
688
|
-
}
|
|
689
|
-
const keys = configs.map(c => keyBuilder$8(luvio, c));
|
|
690
|
-
return luvio.notifyStoreUpdateAvailable(keys);
|
|
691
|
-
};
|
|
547
|
+
const TTL$3 = 60000;
|
|
548
|
+
const VERSION$5 = "cef52859122e69e7f8552d6d2fbf67f8";
|
|
549
|
+
function validate$5(obj, path = 'MappingOutputRepresentation') {
|
|
550
|
+
const v_error = (() => {
|
|
551
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
552
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
553
|
+
}
|
|
554
|
+
const obj_epn = obj.epn;
|
|
555
|
+
const path_epn = path + '.epn';
|
|
556
|
+
if (typeof obj_epn !== 'string') {
|
|
557
|
+
return new TypeError('Expected "string" but received "' + typeof obj_epn + '" (at "' + path_epn + '")');
|
|
558
|
+
}
|
|
559
|
+
const obj_id = obj.id;
|
|
560
|
+
const path_id = path + '.id';
|
|
561
|
+
if (typeof obj_id !== 'string') {
|
|
562
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
563
|
+
}
|
|
564
|
+
const obj_providerName = obj.providerName;
|
|
565
|
+
const path_providerName = path + '.providerName';
|
|
566
|
+
if (typeof obj_providerName !== 'string') {
|
|
567
|
+
return new TypeError('Expected "string" but received "' + typeof obj_providerName + '" (at "' + path_providerName + '")');
|
|
568
|
+
}
|
|
569
|
+
const obj_webstoreId = obj.webstoreId;
|
|
570
|
+
const path_webstoreId = path + '.webstoreId';
|
|
571
|
+
if (typeof obj_webstoreId !== 'string') {
|
|
572
|
+
return new TypeError('Expected "string" but received "' + typeof obj_webstoreId + '" (at "' + path_webstoreId + '")');
|
|
573
|
+
}
|
|
574
|
+
})();
|
|
575
|
+
return v_error === undefined ? null : v_error;
|
|
576
|
+
}
|
|
577
|
+
const RepresentationType$3 = 'MappingOutputRepresentation';
|
|
578
|
+
function keyBuilder$8(luvio, config) {
|
|
579
|
+
return keyPrefix + '::' + RepresentationType$3 + ':' + config.id;
|
|
580
|
+
}
|
|
581
|
+
function keyBuilderFromType$1(luvio, object) {
|
|
582
|
+
const keyParams = {
|
|
583
|
+
id: object.id
|
|
584
|
+
};
|
|
585
|
+
return keyBuilder$8(luvio, keyParams);
|
|
586
|
+
}
|
|
587
|
+
function normalize$3(input, existing, path, luvio, store, timestamp) {
|
|
588
|
+
return input;
|
|
589
|
+
}
|
|
590
|
+
const select$a = function MappingOutputRepresentationSelect() {
|
|
591
|
+
return {
|
|
592
|
+
kind: 'Fragment',
|
|
593
|
+
version: VERSION$5,
|
|
594
|
+
private: [],
|
|
595
|
+
selections: [
|
|
596
|
+
{
|
|
597
|
+
name: 'epn',
|
|
598
|
+
kind: 'Scalar'
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
name: 'id',
|
|
602
|
+
kind: 'Scalar'
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
name: 'providerName',
|
|
606
|
+
kind: 'Scalar'
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
name: 'webstoreId',
|
|
610
|
+
kind: 'Scalar'
|
|
611
|
+
}
|
|
612
|
+
]
|
|
613
|
+
};
|
|
614
|
+
};
|
|
615
|
+
function equals$5(existing, incoming) {
|
|
616
|
+
const existing_epn = existing.epn;
|
|
617
|
+
const incoming_epn = incoming.epn;
|
|
618
|
+
if (!(existing_epn === incoming_epn)) {
|
|
619
|
+
return false;
|
|
620
|
+
}
|
|
621
|
+
const existing_id = existing.id;
|
|
622
|
+
const incoming_id = incoming.id;
|
|
623
|
+
if (!(existing_id === incoming_id)) {
|
|
624
|
+
return false;
|
|
625
|
+
}
|
|
626
|
+
const existing_providerName = existing.providerName;
|
|
627
|
+
const incoming_providerName = incoming.providerName;
|
|
628
|
+
if (!(existing_providerName === incoming_providerName)) {
|
|
629
|
+
return false;
|
|
630
|
+
}
|
|
631
|
+
const existing_webstoreId = existing.webstoreId;
|
|
632
|
+
const incoming_webstoreId = incoming.webstoreId;
|
|
633
|
+
if (!(existing_webstoreId === incoming_webstoreId)) {
|
|
634
|
+
return false;
|
|
635
|
+
}
|
|
636
|
+
return true;
|
|
637
|
+
}
|
|
638
|
+
const ingest$3 = function MappingOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
639
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
640
|
+
const validateError = validate$5(input);
|
|
641
|
+
if (validateError !== null) {
|
|
642
|
+
throw validateError;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
const key = keyBuilderFromType$1(luvio, input);
|
|
646
|
+
const existingRecord = store.readEntry(key);
|
|
647
|
+
const ttlToUse = TTL$3;
|
|
648
|
+
let incomingRecord = normalize$3(input, store.readEntry(key), {
|
|
649
|
+
fullPath: key,
|
|
650
|
+
parent: path.parent,
|
|
651
|
+
propertyName: path.propertyName,
|
|
652
|
+
ttl: ttlToUse
|
|
653
|
+
});
|
|
654
|
+
if (existingRecord === undefined || equals$5(existingRecord, incomingRecord) === false) {
|
|
655
|
+
luvio.storePublish(key, incomingRecord);
|
|
656
|
+
}
|
|
657
|
+
{
|
|
658
|
+
const storeMetadataParams = {
|
|
659
|
+
ttl: ttlToUse,
|
|
660
|
+
namespace: "extensions",
|
|
661
|
+
version: VERSION$5,
|
|
662
|
+
representationName: RepresentationType$3,
|
|
663
|
+
};
|
|
664
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
665
|
+
}
|
|
666
|
+
return createLink(key);
|
|
667
|
+
};
|
|
668
|
+
function getTypeCacheKeys$3(luvio, input, fullPathFactory) {
|
|
669
|
+
const rootKeySet = new StoreKeyMap();
|
|
670
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
671
|
+
const rootKey = keyBuilderFromType$1(luvio, input);
|
|
672
|
+
rootKeySet.set(rootKey, {
|
|
673
|
+
namespace: keyPrefix,
|
|
674
|
+
representationName: RepresentationType$3,
|
|
675
|
+
mergeable: false
|
|
676
|
+
});
|
|
677
|
+
return rootKeySet;
|
|
678
|
+
}
|
|
679
|
+
const notifyUpdateAvailableFactory = (luvio) => {
|
|
680
|
+
return function notifyMappingUpdateAvailable(configs) {
|
|
681
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
682
|
+
const requiredKeyParams = ['id'];
|
|
683
|
+
configs.forEach(config => {
|
|
684
|
+
if (false === requiredKeyParams.every(req => req in config)) {
|
|
685
|
+
throw new Error(`one of the configs did not contain all required parameters: ${JSONStringify(ObjectKeys(config))}`);
|
|
686
|
+
}
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
const keys = configs.map(c => keyBuilder$8(luvio, c));
|
|
690
|
+
return luvio.notifyStoreUpdateAvailable(keys);
|
|
691
|
+
};
|
|
692
692
|
};
|
|
693
693
|
|
|
694
|
-
const TTL$2 = 60000;
|
|
695
|
-
const VERSION$4 = "7aeadbbc38a3c6a4adff51c98906ed3e";
|
|
696
|
-
function validate$4(obj, path = 'MappingOutputCollectionRepresentation') {
|
|
697
|
-
const v_error = (() => {
|
|
698
|
-
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
699
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
700
|
-
}
|
|
701
|
-
const obj_count = obj.count;
|
|
702
|
-
const path_count = path + '.count';
|
|
703
|
-
if (typeof obj_count !== 'number' || (typeof obj_count === 'number' && Math.floor(obj_count) !== obj_count)) {
|
|
704
|
-
return new TypeError('Expected "integer" but received "' + typeof obj_count + '" (at "' + path_count + '")');
|
|
705
|
-
}
|
|
706
|
-
const obj_items = obj.items;
|
|
707
|
-
const path_items = path + '.items';
|
|
708
|
-
if (!ArrayIsArray(obj_items)) {
|
|
709
|
-
return new TypeError('Expected "array" but received "' + typeof obj_items + '" (at "' + path_items + '")');
|
|
710
|
-
}
|
|
711
|
-
for (let i = 0; i < obj_items.length; i++) {
|
|
712
|
-
const obj_items_item = obj_items[i];
|
|
713
|
-
const path_items_item = path_items + '[' + i + ']';
|
|
714
|
-
if (typeof obj_items_item !== 'object') {
|
|
715
|
-
return new TypeError('Expected "object" but received "' + typeof obj_items_item + '" (at "' + path_items_item + '")');
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
})();
|
|
719
|
-
return v_error === undefined ? null : v_error;
|
|
720
|
-
}
|
|
721
|
-
const RepresentationType$2 = 'MappingOutputCollectionRepresentation';
|
|
722
|
-
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
723
|
-
const input_items = input.items;
|
|
724
|
-
const input_items_id = path.fullPath + '__items';
|
|
725
|
-
for (let i = 0; i < input_items.length; i++) {
|
|
726
|
-
const input_items_item = input_items[i];
|
|
727
|
-
let input_items_item_id = input_items_id + '__' + i;
|
|
728
|
-
input_items[i] = ingest$3(input_items_item, {
|
|
729
|
-
fullPath: input_items_item_id,
|
|
730
|
-
propertyName: i,
|
|
731
|
-
parent: {
|
|
732
|
-
data: input,
|
|
733
|
-
key: path.fullPath,
|
|
734
|
-
existing: existing,
|
|
735
|
-
},
|
|
736
|
-
ttl: path.ttl
|
|
737
|
-
}, luvio, store);
|
|
738
|
-
}
|
|
739
|
-
return input;
|
|
740
|
-
}
|
|
741
|
-
const select$9 = function MappingOutputCollectionRepresentationSelect() {
|
|
742
|
-
return {
|
|
743
|
-
kind: 'Fragment',
|
|
744
|
-
version: VERSION$4,
|
|
745
|
-
private: [],
|
|
746
|
-
selections: [
|
|
747
|
-
{
|
|
748
|
-
name: 'count',
|
|
749
|
-
kind: 'Scalar'
|
|
750
|
-
},
|
|
751
|
-
{
|
|
752
|
-
name: 'items',
|
|
753
|
-
kind: 'Link',
|
|
754
|
-
plural: true,
|
|
755
|
-
fragment: select$a()
|
|
756
|
-
}
|
|
757
|
-
]
|
|
758
|
-
};
|
|
759
|
-
};
|
|
760
|
-
function equals$4(existing, incoming) {
|
|
761
|
-
const existing_count = existing.count;
|
|
762
|
-
const incoming_count = incoming.count;
|
|
763
|
-
if (!(existing_count === incoming_count)) {
|
|
764
|
-
return false;
|
|
765
|
-
}
|
|
766
|
-
const existing_items = existing.items;
|
|
767
|
-
const incoming_items = incoming.items;
|
|
768
|
-
const equals_items_items = equalsArray(existing_items, incoming_items, (existing_items_item, incoming_items_item) => {
|
|
769
|
-
if (!(existing_items_item.__ref === incoming_items_item.__ref)) {
|
|
770
|
-
return false;
|
|
771
|
-
}
|
|
772
|
-
});
|
|
773
|
-
if (equals_items_items === false) {
|
|
774
|
-
return false;
|
|
775
|
-
}
|
|
776
|
-
return true;
|
|
777
|
-
}
|
|
778
|
-
const ingest$2 = function MappingOutputCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
779
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
780
|
-
const validateError = validate$4(input);
|
|
781
|
-
if (validateError !== null) {
|
|
782
|
-
throw validateError;
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
const key = path.fullPath;
|
|
786
|
-
const existingRecord = store.readEntry(key);
|
|
787
|
-
const ttlToUse = TTL$2;
|
|
788
|
-
let incomingRecord = normalize$2(input, store.readEntry(key), {
|
|
789
|
-
fullPath: key,
|
|
790
|
-
parent: path.parent,
|
|
791
|
-
propertyName: path.propertyName,
|
|
792
|
-
ttl: ttlToUse
|
|
793
|
-
}, luvio, store);
|
|
794
|
-
if (existingRecord === undefined || equals$4(existingRecord, incomingRecord) === false) {
|
|
795
|
-
luvio.storePublish(key, incomingRecord);
|
|
796
|
-
}
|
|
797
|
-
{
|
|
798
|
-
const storeMetadataParams = {
|
|
799
|
-
ttl: ttlToUse,
|
|
800
|
-
namespace: "extensions",
|
|
801
|
-
version: VERSION$4,
|
|
802
|
-
representationName: RepresentationType$2,
|
|
803
|
-
};
|
|
804
|
-
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
805
|
-
}
|
|
806
|
-
return createLink(key);
|
|
807
|
-
};
|
|
808
|
-
function getTypeCacheKeys$2(luvio, input, fullPathFactory) {
|
|
809
|
-
const rootKeySet = new StoreKeyMap();
|
|
810
|
-
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
811
|
-
const rootKey = fullPathFactory();
|
|
812
|
-
rootKeySet.set(rootKey, {
|
|
813
|
-
namespace: keyPrefix,
|
|
814
|
-
representationName: RepresentationType$2,
|
|
815
|
-
mergeable: false
|
|
816
|
-
});
|
|
817
|
-
const input_items_length = input.items.length;
|
|
818
|
-
for (let i = 0; i < input_items_length; i++) {
|
|
819
|
-
rootKeySet.merge(getTypeCacheKeys$3(luvio, input.items[i]));
|
|
820
|
-
}
|
|
821
|
-
return rootKeySet;
|
|
694
|
+
const TTL$2 = 60000;
|
|
695
|
+
const VERSION$4 = "7aeadbbc38a3c6a4adff51c98906ed3e";
|
|
696
|
+
function validate$4(obj, path = 'MappingOutputCollectionRepresentation') {
|
|
697
|
+
const v_error = (() => {
|
|
698
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
699
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
700
|
+
}
|
|
701
|
+
const obj_count = obj.count;
|
|
702
|
+
const path_count = path + '.count';
|
|
703
|
+
if (typeof obj_count !== 'number' || (typeof obj_count === 'number' && Math.floor(obj_count) !== obj_count)) {
|
|
704
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_count + '" (at "' + path_count + '")');
|
|
705
|
+
}
|
|
706
|
+
const obj_items = obj.items;
|
|
707
|
+
const path_items = path + '.items';
|
|
708
|
+
if (!ArrayIsArray(obj_items)) {
|
|
709
|
+
return new TypeError('Expected "array" but received "' + typeof obj_items + '" (at "' + path_items + '")');
|
|
710
|
+
}
|
|
711
|
+
for (let i = 0; i < obj_items.length; i++) {
|
|
712
|
+
const obj_items_item = obj_items[i];
|
|
713
|
+
const path_items_item = path_items + '[' + i + ']';
|
|
714
|
+
if (typeof obj_items_item !== 'object') {
|
|
715
|
+
return new TypeError('Expected "object" but received "' + typeof obj_items_item + '" (at "' + path_items_item + '")');
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
})();
|
|
719
|
+
return v_error === undefined ? null : v_error;
|
|
720
|
+
}
|
|
721
|
+
const RepresentationType$2 = 'MappingOutputCollectionRepresentation';
|
|
722
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
723
|
+
const input_items = input.items;
|
|
724
|
+
const input_items_id = path.fullPath + '__items';
|
|
725
|
+
for (let i = 0; i < input_items.length; i++) {
|
|
726
|
+
const input_items_item = input_items[i];
|
|
727
|
+
let input_items_item_id = input_items_id + '__' + i;
|
|
728
|
+
input_items[i] = ingest$3(input_items_item, {
|
|
729
|
+
fullPath: input_items_item_id,
|
|
730
|
+
propertyName: i,
|
|
731
|
+
parent: {
|
|
732
|
+
data: input,
|
|
733
|
+
key: path.fullPath,
|
|
734
|
+
existing: existing,
|
|
735
|
+
},
|
|
736
|
+
ttl: path.ttl
|
|
737
|
+
}, luvio, store);
|
|
738
|
+
}
|
|
739
|
+
return input;
|
|
740
|
+
}
|
|
741
|
+
const select$9 = function MappingOutputCollectionRepresentationSelect() {
|
|
742
|
+
return {
|
|
743
|
+
kind: 'Fragment',
|
|
744
|
+
version: VERSION$4,
|
|
745
|
+
private: [],
|
|
746
|
+
selections: [
|
|
747
|
+
{
|
|
748
|
+
name: 'count',
|
|
749
|
+
kind: 'Scalar'
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
name: 'items',
|
|
753
|
+
kind: 'Link',
|
|
754
|
+
plural: true,
|
|
755
|
+
fragment: select$a()
|
|
756
|
+
}
|
|
757
|
+
]
|
|
758
|
+
};
|
|
759
|
+
};
|
|
760
|
+
function equals$4(existing, incoming) {
|
|
761
|
+
const existing_count = existing.count;
|
|
762
|
+
const incoming_count = incoming.count;
|
|
763
|
+
if (!(existing_count === incoming_count)) {
|
|
764
|
+
return false;
|
|
765
|
+
}
|
|
766
|
+
const existing_items = existing.items;
|
|
767
|
+
const incoming_items = incoming.items;
|
|
768
|
+
const equals_items_items = equalsArray(existing_items, incoming_items, (existing_items_item, incoming_items_item) => {
|
|
769
|
+
if (!(existing_items_item.__ref === incoming_items_item.__ref)) {
|
|
770
|
+
return false;
|
|
771
|
+
}
|
|
772
|
+
});
|
|
773
|
+
if (equals_items_items === false) {
|
|
774
|
+
return false;
|
|
775
|
+
}
|
|
776
|
+
return true;
|
|
777
|
+
}
|
|
778
|
+
const ingest$2 = function MappingOutputCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
779
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
780
|
+
const validateError = validate$4(input);
|
|
781
|
+
if (validateError !== null) {
|
|
782
|
+
throw validateError;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
const key = path.fullPath;
|
|
786
|
+
const existingRecord = store.readEntry(key);
|
|
787
|
+
const ttlToUse = TTL$2;
|
|
788
|
+
let incomingRecord = normalize$2(input, store.readEntry(key), {
|
|
789
|
+
fullPath: key,
|
|
790
|
+
parent: path.parent,
|
|
791
|
+
propertyName: path.propertyName,
|
|
792
|
+
ttl: ttlToUse
|
|
793
|
+
}, luvio, store);
|
|
794
|
+
if (existingRecord === undefined || equals$4(existingRecord, incomingRecord) === false) {
|
|
795
|
+
luvio.storePublish(key, incomingRecord);
|
|
796
|
+
}
|
|
797
|
+
{
|
|
798
|
+
const storeMetadataParams = {
|
|
799
|
+
ttl: ttlToUse,
|
|
800
|
+
namespace: "extensions",
|
|
801
|
+
version: VERSION$4,
|
|
802
|
+
representationName: RepresentationType$2,
|
|
803
|
+
};
|
|
804
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
805
|
+
}
|
|
806
|
+
return createLink(key);
|
|
807
|
+
};
|
|
808
|
+
function getTypeCacheKeys$2(luvio, input, fullPathFactory) {
|
|
809
|
+
const rootKeySet = new StoreKeyMap();
|
|
810
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
811
|
+
const rootKey = fullPathFactory();
|
|
812
|
+
rootKeySet.set(rootKey, {
|
|
813
|
+
namespace: keyPrefix,
|
|
814
|
+
representationName: RepresentationType$2,
|
|
815
|
+
mergeable: false
|
|
816
|
+
});
|
|
817
|
+
const input_items_length = input.items.length;
|
|
818
|
+
for (let i = 0; i < input_items_length; i++) {
|
|
819
|
+
rootKeySet.merge(getTypeCacheKeys$3(luvio, input.items[i]));
|
|
820
|
+
}
|
|
821
|
+
return rootKeySet;
|
|
822
822
|
}
|
|
823
823
|
|
|
824
|
-
function select$8(luvio, params) {
|
|
825
|
-
return select$9();
|
|
826
|
-
}
|
|
827
|
-
function keyBuilder$7(luvio, params) {
|
|
828
|
-
return keyPrefix + '::MappingOutputCollectionRepresentation:(' + 'epn:' + params.queryParams.epn + ',' + 'webstoreId:' + params.queryParams.webstoreId + ')';
|
|
829
|
-
}
|
|
830
|
-
function getResponseCacheKeys$5(luvio, resourceParams, response) {
|
|
831
|
-
return getTypeCacheKeys$2(luvio, response, () => keyBuilder$7(luvio, resourceParams));
|
|
832
|
-
}
|
|
833
|
-
function ingestSuccess$4(luvio, resourceParams, response, snapshotRefresh) {
|
|
834
|
-
const { body } = response;
|
|
835
|
-
const key = keyBuilder$7(luvio, resourceParams);
|
|
836
|
-
luvio.storeIngest(key, ingest$2, body);
|
|
837
|
-
const snapshot = luvio.storeLookup({
|
|
838
|
-
recordId: key,
|
|
839
|
-
node: select$8(),
|
|
840
|
-
variables: {},
|
|
841
|
-
}, snapshotRefresh);
|
|
842
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
843
|
-
if (snapshot.state !== 'Fulfilled') {
|
|
844
|
-
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
return snapshot;
|
|
848
|
-
}
|
|
849
|
-
function ingestError$2(luvio, params, error, snapshotRefresh) {
|
|
850
|
-
const key = keyBuilder$7(luvio, params);
|
|
851
|
-
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
852
|
-
const storeMetadataParams = {
|
|
853
|
-
ttl: TTL$2,
|
|
854
|
-
namespace: keyPrefix,
|
|
855
|
-
version: VERSION$4,
|
|
856
|
-
representationName: RepresentationType$2
|
|
857
|
-
};
|
|
858
|
-
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
859
|
-
return errorSnapshot;
|
|
860
|
-
}
|
|
861
|
-
function createResourceRequest$5(config) {
|
|
862
|
-
const headers = {};
|
|
863
|
-
return {
|
|
864
|
-
baseUri: '/services/data/v58.0',
|
|
865
|
-
basePath: '/commerce/extension/mappings',
|
|
866
|
-
method: 'get',
|
|
867
|
-
body: null,
|
|
868
|
-
urlParams: {},
|
|
869
|
-
queryParams: config.queryParams,
|
|
870
|
-
headers,
|
|
871
|
-
priority: 'normal',
|
|
872
|
-
};
|
|
824
|
+
function select$8(luvio, params) {
|
|
825
|
+
return select$9();
|
|
826
|
+
}
|
|
827
|
+
function keyBuilder$7(luvio, params) {
|
|
828
|
+
return keyPrefix + '::MappingOutputCollectionRepresentation:(' + 'epn:' + params.queryParams.epn + ',' + 'webstoreId:' + params.queryParams.webstoreId + ')';
|
|
829
|
+
}
|
|
830
|
+
function getResponseCacheKeys$5(luvio, resourceParams, response) {
|
|
831
|
+
return getTypeCacheKeys$2(luvio, response, () => keyBuilder$7(luvio, resourceParams));
|
|
832
|
+
}
|
|
833
|
+
function ingestSuccess$4(luvio, resourceParams, response, snapshotRefresh) {
|
|
834
|
+
const { body } = response;
|
|
835
|
+
const key = keyBuilder$7(luvio, resourceParams);
|
|
836
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
837
|
+
const snapshot = luvio.storeLookup({
|
|
838
|
+
recordId: key,
|
|
839
|
+
node: select$8(),
|
|
840
|
+
variables: {},
|
|
841
|
+
}, snapshotRefresh);
|
|
842
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
843
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
844
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
return snapshot;
|
|
848
|
+
}
|
|
849
|
+
function ingestError$2(luvio, params, error, snapshotRefresh) {
|
|
850
|
+
const key = keyBuilder$7(luvio, params);
|
|
851
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
852
|
+
const storeMetadataParams = {
|
|
853
|
+
ttl: TTL$2,
|
|
854
|
+
namespace: keyPrefix,
|
|
855
|
+
version: VERSION$4,
|
|
856
|
+
representationName: RepresentationType$2
|
|
857
|
+
};
|
|
858
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
859
|
+
return errorSnapshot;
|
|
860
|
+
}
|
|
861
|
+
function createResourceRequest$5(config) {
|
|
862
|
+
const headers = {};
|
|
863
|
+
return {
|
|
864
|
+
baseUri: '/services/data/v58.0',
|
|
865
|
+
basePath: '/commerce/extension/mappings',
|
|
866
|
+
method: 'get',
|
|
867
|
+
body: null,
|
|
868
|
+
urlParams: {},
|
|
869
|
+
queryParams: config.queryParams,
|
|
870
|
+
headers,
|
|
871
|
+
priority: 'normal',
|
|
872
|
+
};
|
|
873
873
|
}
|
|
874
874
|
|
|
875
|
-
const getMappings_ConfigPropertyNames = {
|
|
876
|
-
displayName: 'getMappings',
|
|
877
|
-
parameters: {
|
|
878
|
-
required: [],
|
|
879
|
-
optional: ['epn', 'webstoreId']
|
|
880
|
-
}
|
|
881
|
-
};
|
|
882
|
-
function createResourceParams$5(config) {
|
|
883
|
-
const resourceParams = {
|
|
884
|
-
queryParams: {
|
|
885
|
-
epn: config.epn, webstoreId: config.webstoreId
|
|
886
|
-
}
|
|
887
|
-
};
|
|
888
|
-
return resourceParams;
|
|
889
|
-
}
|
|
890
|
-
function keyBuilder$6(luvio, config) {
|
|
891
|
-
const resourceParams = createResourceParams$5(config);
|
|
892
|
-
return keyBuilder$7(luvio, resourceParams);
|
|
893
|
-
}
|
|
894
|
-
function typeCheckConfig$5(untrustedConfig) {
|
|
895
|
-
const config = {};
|
|
896
|
-
const untrustedConfig_epn = untrustedConfig.epn;
|
|
897
|
-
if (typeof untrustedConfig_epn === 'string') {
|
|
898
|
-
config.epn = untrustedConfig_epn;
|
|
899
|
-
}
|
|
900
|
-
const untrustedConfig_webstoreId = untrustedConfig.webstoreId;
|
|
901
|
-
if (typeof untrustedConfig_webstoreId === 'string') {
|
|
902
|
-
config.webstoreId = untrustedConfig_webstoreId;
|
|
903
|
-
}
|
|
904
|
-
return config;
|
|
905
|
-
}
|
|
906
|
-
function validateAdapterConfig$5(untrustedConfig, configPropertyNames) {
|
|
907
|
-
if (!untrustedIsObject(untrustedConfig)) {
|
|
908
|
-
return null;
|
|
909
|
-
}
|
|
910
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
911
|
-
validateConfig(untrustedConfig, configPropertyNames);
|
|
912
|
-
}
|
|
913
|
-
const config = typeCheckConfig$5(untrustedConfig);
|
|
914
|
-
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
915
|
-
return null;
|
|
916
|
-
}
|
|
917
|
-
return config;
|
|
918
|
-
}
|
|
919
|
-
function adapterFragment$2(luvio, config) {
|
|
920
|
-
createResourceParams$5(config);
|
|
921
|
-
return select$8();
|
|
922
|
-
}
|
|
923
|
-
function onFetchResponseSuccess$2(luvio, config, resourceParams, response) {
|
|
924
|
-
const snapshot = ingestSuccess$4(luvio, resourceParams, response, {
|
|
925
|
-
config,
|
|
926
|
-
resolve: () => buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions)
|
|
927
|
-
});
|
|
928
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
929
|
-
}
|
|
930
|
-
function onFetchResponseError$2(luvio, config, resourceParams, response) {
|
|
931
|
-
const snapshot = ingestError$2(luvio, resourceParams, response, {
|
|
932
|
-
config,
|
|
933
|
-
resolve: () => buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions)
|
|
934
|
-
});
|
|
935
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
936
|
-
}
|
|
937
|
-
function buildNetworkSnapshot$5(luvio, config, options) {
|
|
938
|
-
const resourceParams = createResourceParams$5(config);
|
|
939
|
-
const request = createResourceRequest$5(resourceParams);
|
|
940
|
-
return luvio.dispatchResourceRequest(request, options)
|
|
941
|
-
.then((response) => {
|
|
942
|
-
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$2(luvio, config, resourceParams, response), () => getResponseCacheKeys$5(luvio, resourceParams, response.body));
|
|
943
|
-
}, (response) => {
|
|
944
|
-
return luvio.handleErrorResponse(() => onFetchResponseError$2(luvio, config, resourceParams, response));
|
|
945
|
-
});
|
|
946
|
-
}
|
|
947
|
-
function buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext) {
|
|
948
|
-
const { luvio, config } = context;
|
|
949
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
950
|
-
const dispatchOptions = {
|
|
951
|
-
resourceRequestContext: {
|
|
952
|
-
requestCorrelator,
|
|
953
|
-
luvioRequestMethod: undefined,
|
|
954
|
-
},
|
|
955
|
-
eventObservers
|
|
956
|
-
};
|
|
957
|
-
if (networkPriority !== 'normal') {
|
|
958
|
-
dispatchOptions.overrides = {
|
|
959
|
-
priority: networkPriority
|
|
960
|
-
};
|
|
961
|
-
}
|
|
962
|
-
return buildNetworkSnapshot$5(luvio, config, dispatchOptions);
|
|
963
|
-
}
|
|
964
|
-
function buildCachedSnapshotCachePolicy$2(context, storeLookup) {
|
|
965
|
-
const { luvio, config } = context;
|
|
966
|
-
const selector = {
|
|
967
|
-
recordId: keyBuilder$6(luvio, config),
|
|
968
|
-
node: adapterFragment$2(luvio, config),
|
|
969
|
-
variables: {},
|
|
970
|
-
};
|
|
971
|
-
const cacheSnapshot = storeLookup(selector, {
|
|
972
|
-
config,
|
|
973
|
-
resolve: () => buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions)
|
|
974
|
-
});
|
|
975
|
-
return cacheSnapshot;
|
|
976
|
-
}
|
|
977
|
-
const getMappingsAdapterFactory = (luvio) => function extensions__getMappings(untrustedConfig, requestContext) {
|
|
978
|
-
const config = validateAdapterConfig$5(untrustedConfig, getMappings_ConfigPropertyNames);
|
|
979
|
-
// Invalid or incomplete config
|
|
980
|
-
if (config === null) {
|
|
981
|
-
return null;
|
|
982
|
-
}
|
|
983
|
-
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
984
|
-
buildCachedSnapshotCachePolicy$2, buildNetworkSnapshotCachePolicy$2);
|
|
875
|
+
const getMappings_ConfigPropertyNames = {
|
|
876
|
+
displayName: 'getMappings',
|
|
877
|
+
parameters: {
|
|
878
|
+
required: [],
|
|
879
|
+
optional: ['epn', 'webstoreId']
|
|
880
|
+
}
|
|
881
|
+
};
|
|
882
|
+
function createResourceParams$5(config) {
|
|
883
|
+
const resourceParams = {
|
|
884
|
+
queryParams: {
|
|
885
|
+
epn: config.epn, webstoreId: config.webstoreId
|
|
886
|
+
}
|
|
887
|
+
};
|
|
888
|
+
return resourceParams;
|
|
889
|
+
}
|
|
890
|
+
function keyBuilder$6(luvio, config) {
|
|
891
|
+
const resourceParams = createResourceParams$5(config);
|
|
892
|
+
return keyBuilder$7(luvio, resourceParams);
|
|
893
|
+
}
|
|
894
|
+
function typeCheckConfig$5(untrustedConfig) {
|
|
895
|
+
const config = {};
|
|
896
|
+
const untrustedConfig_epn = untrustedConfig.epn;
|
|
897
|
+
if (typeof untrustedConfig_epn === 'string') {
|
|
898
|
+
config.epn = untrustedConfig_epn;
|
|
899
|
+
}
|
|
900
|
+
const untrustedConfig_webstoreId = untrustedConfig.webstoreId;
|
|
901
|
+
if (typeof untrustedConfig_webstoreId === 'string') {
|
|
902
|
+
config.webstoreId = untrustedConfig_webstoreId;
|
|
903
|
+
}
|
|
904
|
+
return config;
|
|
905
|
+
}
|
|
906
|
+
function validateAdapterConfig$5(untrustedConfig, configPropertyNames) {
|
|
907
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
908
|
+
return null;
|
|
909
|
+
}
|
|
910
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
911
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
912
|
+
}
|
|
913
|
+
const config = typeCheckConfig$5(untrustedConfig);
|
|
914
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
915
|
+
return null;
|
|
916
|
+
}
|
|
917
|
+
return config;
|
|
918
|
+
}
|
|
919
|
+
function adapterFragment$2(luvio, config) {
|
|
920
|
+
createResourceParams$5(config);
|
|
921
|
+
return select$8();
|
|
922
|
+
}
|
|
923
|
+
function onFetchResponseSuccess$2(luvio, config, resourceParams, response) {
|
|
924
|
+
const snapshot = ingestSuccess$4(luvio, resourceParams, response, {
|
|
925
|
+
config,
|
|
926
|
+
resolve: () => buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions)
|
|
927
|
+
});
|
|
928
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
929
|
+
}
|
|
930
|
+
function onFetchResponseError$2(luvio, config, resourceParams, response) {
|
|
931
|
+
const snapshot = ingestError$2(luvio, resourceParams, response, {
|
|
932
|
+
config,
|
|
933
|
+
resolve: () => buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions)
|
|
934
|
+
});
|
|
935
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
936
|
+
}
|
|
937
|
+
function buildNetworkSnapshot$5(luvio, config, options) {
|
|
938
|
+
const resourceParams = createResourceParams$5(config);
|
|
939
|
+
const request = createResourceRequest$5(resourceParams);
|
|
940
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
941
|
+
.then((response) => {
|
|
942
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$2(luvio, config, resourceParams, response), () => getResponseCacheKeys$5(luvio, resourceParams, response.body));
|
|
943
|
+
}, (response) => {
|
|
944
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$2(luvio, config, resourceParams, response));
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
function buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext) {
|
|
948
|
+
const { luvio, config } = context;
|
|
949
|
+
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
950
|
+
const dispatchOptions = {
|
|
951
|
+
resourceRequestContext: {
|
|
952
|
+
requestCorrelator,
|
|
953
|
+
luvioRequestMethod: undefined,
|
|
954
|
+
},
|
|
955
|
+
eventObservers
|
|
956
|
+
};
|
|
957
|
+
if (networkPriority !== 'normal') {
|
|
958
|
+
dispatchOptions.overrides = {
|
|
959
|
+
priority: networkPriority
|
|
960
|
+
};
|
|
961
|
+
}
|
|
962
|
+
return buildNetworkSnapshot$5(luvio, config, dispatchOptions);
|
|
963
|
+
}
|
|
964
|
+
function buildCachedSnapshotCachePolicy$2(context, storeLookup) {
|
|
965
|
+
const { luvio, config } = context;
|
|
966
|
+
const selector = {
|
|
967
|
+
recordId: keyBuilder$6(luvio, config),
|
|
968
|
+
node: adapterFragment$2(luvio, config),
|
|
969
|
+
variables: {},
|
|
970
|
+
};
|
|
971
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
972
|
+
config,
|
|
973
|
+
resolve: () => buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions)
|
|
974
|
+
});
|
|
975
|
+
return cacheSnapshot;
|
|
976
|
+
}
|
|
977
|
+
const getMappingsAdapterFactory = (luvio) => function extensions__getMappings(untrustedConfig, requestContext) {
|
|
978
|
+
const config = validateAdapterConfig$5(untrustedConfig, getMappings_ConfigPropertyNames);
|
|
979
|
+
// Invalid or incomplete config
|
|
980
|
+
if (config === null) {
|
|
981
|
+
return null;
|
|
982
|
+
}
|
|
983
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
984
|
+
buildCachedSnapshotCachePolicy$2, buildNetworkSnapshotCachePolicy$2);
|
|
985
985
|
};
|
|
986
986
|
|
|
987
|
-
function select$7(luvio, params) {
|
|
988
|
-
return select$a();
|
|
989
|
-
}
|
|
990
|
-
function getResponseCacheKeys$4(luvio, resourceParams, response) {
|
|
991
|
-
return getTypeCacheKeys$3(luvio, response);
|
|
992
|
-
}
|
|
993
|
-
function ingestSuccess$3(luvio, resourceParams, response) {
|
|
994
|
-
const { body } = response;
|
|
995
|
-
const key = keyBuilderFromType$1(luvio, body);
|
|
996
|
-
luvio.storeIngest(key, ingest$3, body);
|
|
997
|
-
const snapshot = luvio.storeLookup({
|
|
998
|
-
recordId: key,
|
|
999
|
-
node: select$7(),
|
|
1000
|
-
variables: {},
|
|
1001
|
-
});
|
|
1002
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1003
|
-
if (snapshot.state !== 'Fulfilled') {
|
|
1004
|
-
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
return snapshot;
|
|
1008
|
-
}
|
|
1009
|
-
function createResourceRequest$4(config) {
|
|
1010
|
-
const headers = {};
|
|
1011
|
-
return {
|
|
1012
|
-
baseUri: '/services/data/v58.0',
|
|
1013
|
-
basePath: '/commerce/extension/mappings',
|
|
1014
|
-
method: 'post',
|
|
1015
|
-
body: config.body,
|
|
1016
|
-
urlParams: {},
|
|
1017
|
-
queryParams: {},
|
|
1018
|
-
headers,
|
|
1019
|
-
priority: 'normal',
|
|
1020
|
-
};
|
|
987
|
+
function select$7(luvio, params) {
|
|
988
|
+
return select$a();
|
|
989
|
+
}
|
|
990
|
+
function getResponseCacheKeys$4(luvio, resourceParams, response) {
|
|
991
|
+
return getTypeCacheKeys$3(luvio, response);
|
|
992
|
+
}
|
|
993
|
+
function ingestSuccess$3(luvio, resourceParams, response) {
|
|
994
|
+
const { body } = response;
|
|
995
|
+
const key = keyBuilderFromType$1(luvio, body);
|
|
996
|
+
luvio.storeIngest(key, ingest$3, body);
|
|
997
|
+
const snapshot = luvio.storeLookup({
|
|
998
|
+
recordId: key,
|
|
999
|
+
node: select$7(),
|
|
1000
|
+
variables: {},
|
|
1001
|
+
});
|
|
1002
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1003
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1004
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
return snapshot;
|
|
1008
|
+
}
|
|
1009
|
+
function createResourceRequest$4(config) {
|
|
1010
|
+
const headers = {};
|
|
1011
|
+
return {
|
|
1012
|
+
baseUri: '/services/data/v58.0',
|
|
1013
|
+
basePath: '/commerce/extension/mappings',
|
|
1014
|
+
method: 'post',
|
|
1015
|
+
body: config.body,
|
|
1016
|
+
urlParams: {},
|
|
1017
|
+
queryParams: {},
|
|
1018
|
+
headers,
|
|
1019
|
+
priority: 'normal',
|
|
1020
|
+
};
|
|
1021
1021
|
}
|
|
1022
1022
|
|
|
1023
|
-
const createMapping_ConfigPropertyNames = {
|
|
1024
|
-
displayName: 'createMapping',
|
|
1025
|
-
parameters: {
|
|
1026
|
-
required: ['epn', 'providerName', 'webstoreId'],
|
|
1027
|
-
optional: ['id']
|
|
1028
|
-
}
|
|
1029
|
-
};
|
|
1030
|
-
function createResourceParams$4(config) {
|
|
1031
|
-
const resourceParams = {
|
|
1032
|
-
body: {
|
|
1033
|
-
epn: config.epn, providerName: config.providerName, webstoreId: config.webstoreId
|
|
1034
|
-
}
|
|
1035
|
-
};
|
|
1036
|
-
if (config['id'] !== undefined) {
|
|
1037
|
-
resourceParams.body['id'] = config['id'];
|
|
1038
|
-
}
|
|
1039
|
-
return resourceParams;
|
|
1040
|
-
}
|
|
1041
|
-
function typeCheckConfig$4(untrustedConfig) {
|
|
1042
|
-
const config = {};
|
|
1043
|
-
const untrustedConfig_epn = untrustedConfig.epn;
|
|
1044
|
-
if (typeof untrustedConfig_epn === 'string') {
|
|
1045
|
-
config.epn = untrustedConfig_epn;
|
|
1046
|
-
}
|
|
1047
|
-
const untrustedConfig_id = untrustedConfig.id;
|
|
1048
|
-
if (typeof untrustedConfig_id === 'string') {
|
|
1049
|
-
config.id = untrustedConfig_id;
|
|
1050
|
-
}
|
|
1051
|
-
const untrustedConfig_providerName = untrustedConfig.providerName;
|
|
1052
|
-
if (typeof untrustedConfig_providerName === 'string') {
|
|
1053
|
-
config.providerName = untrustedConfig_providerName;
|
|
1054
|
-
}
|
|
1055
|
-
const untrustedConfig_webstoreId = untrustedConfig.webstoreId;
|
|
1056
|
-
if (typeof untrustedConfig_webstoreId === 'string') {
|
|
1057
|
-
config.webstoreId = untrustedConfig_webstoreId;
|
|
1058
|
-
}
|
|
1059
|
-
return config;
|
|
1060
|
-
}
|
|
1061
|
-
function validateAdapterConfig$4(untrustedConfig, configPropertyNames) {
|
|
1062
|
-
if (!untrustedIsObject(untrustedConfig)) {
|
|
1063
|
-
return null;
|
|
1064
|
-
}
|
|
1065
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1066
|
-
validateConfig(untrustedConfig, configPropertyNames);
|
|
1067
|
-
}
|
|
1068
|
-
const config = typeCheckConfig$4(untrustedConfig);
|
|
1069
|
-
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1070
|
-
return null;
|
|
1071
|
-
}
|
|
1072
|
-
return config;
|
|
1073
|
-
}
|
|
1074
|
-
function buildNetworkSnapshot$4(luvio, config, options) {
|
|
1075
|
-
const resourceParams = createResourceParams$4(config);
|
|
1076
|
-
const request = createResourceRequest$4(resourceParams);
|
|
1077
|
-
return luvio.dispatchResourceRequest(request, options)
|
|
1078
|
-
.then((response) => {
|
|
1079
|
-
return luvio.handleSuccessResponse(() => {
|
|
1080
|
-
const snapshot = ingestSuccess$3(luvio, resourceParams, response);
|
|
1081
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
1082
|
-
}, () => getResponseCacheKeys$4(luvio, resourceParams, response.body));
|
|
1083
|
-
}, (response) => {
|
|
1084
|
-
deepFreeze(response);
|
|
1085
|
-
throw response;
|
|
1086
|
-
});
|
|
1087
|
-
}
|
|
1088
|
-
const createMappingAdapterFactory = (luvio) => {
|
|
1089
|
-
return function createMapping(untrustedConfig) {
|
|
1090
|
-
const config = validateAdapterConfig$4(untrustedConfig, createMapping_ConfigPropertyNames);
|
|
1091
|
-
// Invalid or incomplete config
|
|
1092
|
-
if (config === null) {
|
|
1093
|
-
throw new Error('Invalid config for "createMapping"');
|
|
1094
|
-
}
|
|
1095
|
-
return buildNetworkSnapshot$4(luvio, config);
|
|
1096
|
-
};
|
|
1023
|
+
const createMapping_ConfigPropertyNames = {
|
|
1024
|
+
displayName: 'createMapping',
|
|
1025
|
+
parameters: {
|
|
1026
|
+
required: ['epn', 'providerName', 'webstoreId'],
|
|
1027
|
+
optional: ['id']
|
|
1028
|
+
}
|
|
1029
|
+
};
|
|
1030
|
+
function createResourceParams$4(config) {
|
|
1031
|
+
const resourceParams = {
|
|
1032
|
+
body: {
|
|
1033
|
+
epn: config.epn, providerName: config.providerName, webstoreId: config.webstoreId
|
|
1034
|
+
}
|
|
1035
|
+
};
|
|
1036
|
+
if (config['id'] !== undefined) {
|
|
1037
|
+
resourceParams.body['id'] = config['id'];
|
|
1038
|
+
}
|
|
1039
|
+
return resourceParams;
|
|
1040
|
+
}
|
|
1041
|
+
function typeCheckConfig$4(untrustedConfig) {
|
|
1042
|
+
const config = {};
|
|
1043
|
+
const untrustedConfig_epn = untrustedConfig.epn;
|
|
1044
|
+
if (typeof untrustedConfig_epn === 'string') {
|
|
1045
|
+
config.epn = untrustedConfig_epn;
|
|
1046
|
+
}
|
|
1047
|
+
const untrustedConfig_id = untrustedConfig.id;
|
|
1048
|
+
if (typeof untrustedConfig_id === 'string') {
|
|
1049
|
+
config.id = untrustedConfig_id;
|
|
1050
|
+
}
|
|
1051
|
+
const untrustedConfig_providerName = untrustedConfig.providerName;
|
|
1052
|
+
if (typeof untrustedConfig_providerName === 'string') {
|
|
1053
|
+
config.providerName = untrustedConfig_providerName;
|
|
1054
|
+
}
|
|
1055
|
+
const untrustedConfig_webstoreId = untrustedConfig.webstoreId;
|
|
1056
|
+
if (typeof untrustedConfig_webstoreId === 'string') {
|
|
1057
|
+
config.webstoreId = untrustedConfig_webstoreId;
|
|
1058
|
+
}
|
|
1059
|
+
return config;
|
|
1060
|
+
}
|
|
1061
|
+
function validateAdapterConfig$4(untrustedConfig, configPropertyNames) {
|
|
1062
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1063
|
+
return null;
|
|
1064
|
+
}
|
|
1065
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1066
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1067
|
+
}
|
|
1068
|
+
const config = typeCheckConfig$4(untrustedConfig);
|
|
1069
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1070
|
+
return null;
|
|
1071
|
+
}
|
|
1072
|
+
return config;
|
|
1073
|
+
}
|
|
1074
|
+
function buildNetworkSnapshot$4(luvio, config, options) {
|
|
1075
|
+
const resourceParams = createResourceParams$4(config);
|
|
1076
|
+
const request = createResourceRequest$4(resourceParams);
|
|
1077
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1078
|
+
.then((response) => {
|
|
1079
|
+
return luvio.handleSuccessResponse(() => {
|
|
1080
|
+
const snapshot = ingestSuccess$3(luvio, resourceParams, response);
|
|
1081
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1082
|
+
}, () => getResponseCacheKeys$4(luvio, resourceParams, response.body));
|
|
1083
|
+
}, (response) => {
|
|
1084
|
+
deepFreeze(response);
|
|
1085
|
+
throw response;
|
|
1086
|
+
});
|
|
1087
|
+
}
|
|
1088
|
+
const createMappingAdapterFactory = (luvio) => {
|
|
1089
|
+
return function createMapping(untrustedConfig) {
|
|
1090
|
+
const config = validateAdapterConfig$4(untrustedConfig, createMapping_ConfigPropertyNames);
|
|
1091
|
+
// Invalid or incomplete config
|
|
1092
|
+
if (config === null) {
|
|
1093
|
+
throw new Error('Invalid config for "createMapping"');
|
|
1094
|
+
}
|
|
1095
|
+
return buildNetworkSnapshot$4(luvio, config);
|
|
1096
|
+
};
|
|
1097
1097
|
};
|
|
1098
1098
|
|
|
1099
|
-
function keyBuilder$5(luvio, params) {
|
|
1100
|
-
return keyBuilder$8(luvio, {
|
|
1101
|
-
id: params.urlParams.mappingId
|
|
1102
|
-
});
|
|
1103
|
-
}
|
|
1104
|
-
function getResponseCacheKeys$3(luvio, resourceParams) {
|
|
1105
|
-
const key = keyBuilder$5(luvio, resourceParams);
|
|
1106
|
-
const cacheKeyMap = new StoreKeyMap();
|
|
1107
|
-
cacheKeyMap.set(key, {
|
|
1108
|
-
namespace: keyPrefix,
|
|
1109
|
-
representationName: RepresentationType$3,
|
|
1110
|
-
mergeable: false
|
|
1111
|
-
});
|
|
1112
|
-
return cacheKeyMap;
|
|
1113
|
-
}
|
|
1114
|
-
function evictSuccess(luvio, resourceParams) {
|
|
1115
|
-
const key = keyBuilder$5(luvio, resourceParams);
|
|
1116
|
-
luvio.storeEvict(key);
|
|
1117
|
-
}
|
|
1118
|
-
function createResourceRequest$3(config) {
|
|
1119
|
-
const headers = {};
|
|
1120
|
-
return {
|
|
1121
|
-
baseUri: '/services/data/v58.0',
|
|
1122
|
-
basePath: '/commerce/extension/mappings/' + config.urlParams.mappingId + '',
|
|
1123
|
-
method: 'delete',
|
|
1124
|
-
body: null,
|
|
1125
|
-
urlParams: config.urlParams,
|
|
1126
|
-
queryParams: {},
|
|
1127
|
-
headers,
|
|
1128
|
-
priority: 'normal',
|
|
1129
|
-
};
|
|
1099
|
+
function keyBuilder$5(luvio, params) {
|
|
1100
|
+
return keyBuilder$8(luvio, {
|
|
1101
|
+
id: params.urlParams.mappingId
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1104
|
+
function getResponseCacheKeys$3(luvio, resourceParams) {
|
|
1105
|
+
const key = keyBuilder$5(luvio, resourceParams);
|
|
1106
|
+
const cacheKeyMap = new StoreKeyMap();
|
|
1107
|
+
cacheKeyMap.set(key, {
|
|
1108
|
+
namespace: keyPrefix,
|
|
1109
|
+
representationName: RepresentationType$3,
|
|
1110
|
+
mergeable: false
|
|
1111
|
+
});
|
|
1112
|
+
return cacheKeyMap;
|
|
1113
|
+
}
|
|
1114
|
+
function evictSuccess(luvio, resourceParams) {
|
|
1115
|
+
const key = keyBuilder$5(luvio, resourceParams);
|
|
1116
|
+
luvio.storeEvict(key);
|
|
1117
|
+
}
|
|
1118
|
+
function createResourceRequest$3(config) {
|
|
1119
|
+
const headers = {};
|
|
1120
|
+
return {
|
|
1121
|
+
baseUri: '/services/data/v58.0',
|
|
1122
|
+
basePath: '/commerce/extension/mappings/' + config.urlParams.mappingId + '',
|
|
1123
|
+
method: 'delete',
|
|
1124
|
+
body: null,
|
|
1125
|
+
urlParams: config.urlParams,
|
|
1126
|
+
queryParams: {},
|
|
1127
|
+
headers,
|
|
1128
|
+
priority: 'normal',
|
|
1129
|
+
};
|
|
1130
1130
|
}
|
|
1131
1131
|
|
|
1132
|
-
const adapterName = 'deleteMapping';
|
|
1133
|
-
const deleteMapping_ConfigPropertyNames = {
|
|
1134
|
-
displayName: 'deleteMapping',
|
|
1135
|
-
parameters: {
|
|
1136
|
-
required: ['mappingId'],
|
|
1137
|
-
optional: []
|
|
1138
|
-
}
|
|
1139
|
-
};
|
|
1140
|
-
function createResourceParams$3(config) {
|
|
1141
|
-
const resourceParams = {
|
|
1142
|
-
urlParams: {
|
|
1143
|
-
mappingId: config.mappingId
|
|
1144
|
-
}
|
|
1145
|
-
};
|
|
1146
|
-
return resourceParams;
|
|
1147
|
-
}
|
|
1148
|
-
function typeCheckConfig$3(untrustedConfig) {
|
|
1149
|
-
const config = {};
|
|
1150
|
-
const untrustedConfig_mappingId = untrustedConfig.mappingId;
|
|
1151
|
-
if (typeof untrustedConfig_mappingId === 'string') {
|
|
1152
|
-
config.mappingId = untrustedConfig_mappingId;
|
|
1153
|
-
}
|
|
1154
|
-
return config;
|
|
1155
|
-
}
|
|
1156
|
-
function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
|
|
1157
|
-
if (!untrustedIsObject(untrustedConfig)) {
|
|
1158
|
-
return null;
|
|
1159
|
-
}
|
|
1160
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1161
|
-
validateConfig(untrustedConfig, configPropertyNames);
|
|
1162
|
-
}
|
|
1163
|
-
const config = typeCheckConfig$3(untrustedConfig);
|
|
1164
|
-
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1165
|
-
return null;
|
|
1166
|
-
}
|
|
1167
|
-
return config;
|
|
1168
|
-
}
|
|
1169
|
-
function buildNetworkSnapshot$3(luvio, config, options) {
|
|
1170
|
-
const resourceParams = createResourceParams$3(config);
|
|
1171
|
-
const request = createResourceRequest$3(resourceParams);
|
|
1172
|
-
return luvio.dispatchResourceRequest(request, options)
|
|
1173
|
-
.then(() => {
|
|
1174
|
-
return luvio.handleSuccessResponse(() => {
|
|
1175
|
-
evictSuccess(luvio, resourceParams);
|
|
1176
|
-
return luvio.storeBroadcast();
|
|
1177
|
-
}, () => getResponseCacheKeys$3(luvio, resourceParams));
|
|
1178
|
-
}, (response) => {
|
|
1179
|
-
deepFreeze(response);
|
|
1180
|
-
throw response;
|
|
1181
|
-
});
|
|
1182
|
-
}
|
|
1183
|
-
const deleteMappingAdapterFactory = (luvio) => {
|
|
1184
|
-
return function extensionsdeleteMapping(untrustedConfig) {
|
|
1185
|
-
const config = validateAdapterConfig$3(untrustedConfig, deleteMapping_ConfigPropertyNames);
|
|
1186
|
-
// Invalid or incomplete config
|
|
1187
|
-
if (config === null) {
|
|
1188
|
-
throw new Error(`Invalid config for "${adapterName}"`);
|
|
1189
|
-
}
|
|
1190
|
-
return buildNetworkSnapshot$3(luvio, config);
|
|
1191
|
-
};
|
|
1132
|
+
const adapterName = 'deleteMapping';
|
|
1133
|
+
const deleteMapping_ConfigPropertyNames = {
|
|
1134
|
+
displayName: 'deleteMapping',
|
|
1135
|
+
parameters: {
|
|
1136
|
+
required: ['mappingId'],
|
|
1137
|
+
optional: []
|
|
1138
|
+
}
|
|
1139
|
+
};
|
|
1140
|
+
function createResourceParams$3(config) {
|
|
1141
|
+
const resourceParams = {
|
|
1142
|
+
urlParams: {
|
|
1143
|
+
mappingId: config.mappingId
|
|
1144
|
+
}
|
|
1145
|
+
};
|
|
1146
|
+
return resourceParams;
|
|
1147
|
+
}
|
|
1148
|
+
function typeCheckConfig$3(untrustedConfig) {
|
|
1149
|
+
const config = {};
|
|
1150
|
+
const untrustedConfig_mappingId = untrustedConfig.mappingId;
|
|
1151
|
+
if (typeof untrustedConfig_mappingId === 'string') {
|
|
1152
|
+
config.mappingId = untrustedConfig_mappingId;
|
|
1153
|
+
}
|
|
1154
|
+
return config;
|
|
1155
|
+
}
|
|
1156
|
+
function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
|
|
1157
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1158
|
+
return null;
|
|
1159
|
+
}
|
|
1160
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1161
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1162
|
+
}
|
|
1163
|
+
const config = typeCheckConfig$3(untrustedConfig);
|
|
1164
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1165
|
+
return null;
|
|
1166
|
+
}
|
|
1167
|
+
return config;
|
|
1168
|
+
}
|
|
1169
|
+
function buildNetworkSnapshot$3(luvio, config, options) {
|
|
1170
|
+
const resourceParams = createResourceParams$3(config);
|
|
1171
|
+
const request = createResourceRequest$3(resourceParams);
|
|
1172
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1173
|
+
.then(() => {
|
|
1174
|
+
return luvio.handleSuccessResponse(() => {
|
|
1175
|
+
evictSuccess(luvio, resourceParams);
|
|
1176
|
+
return luvio.storeBroadcast();
|
|
1177
|
+
}, () => getResponseCacheKeys$3(luvio, resourceParams));
|
|
1178
|
+
}, (response) => {
|
|
1179
|
+
deepFreeze(response);
|
|
1180
|
+
throw response;
|
|
1181
|
+
});
|
|
1182
|
+
}
|
|
1183
|
+
const deleteMappingAdapterFactory = (luvio) => {
|
|
1184
|
+
return function extensionsdeleteMapping(untrustedConfig) {
|
|
1185
|
+
const config = validateAdapterConfig$3(untrustedConfig, deleteMapping_ConfigPropertyNames);
|
|
1186
|
+
// Invalid or incomplete config
|
|
1187
|
+
if (config === null) {
|
|
1188
|
+
throw new Error(`Invalid config for "${adapterName}"`);
|
|
1189
|
+
}
|
|
1190
|
+
return buildNetworkSnapshot$3(luvio, config);
|
|
1191
|
+
};
|
|
1192
1192
|
};
|
|
1193
1193
|
|
|
1194
|
-
function select$6(luvio, params) {
|
|
1195
|
-
return select$a();
|
|
1196
|
-
}
|
|
1197
|
-
function keyBuilder$4(luvio, params) {
|
|
1198
|
-
return keyBuilder$8(luvio, {
|
|
1199
|
-
id: params.urlParams.mappingId
|
|
1200
|
-
});
|
|
1201
|
-
}
|
|
1202
|
-
function getResponseCacheKeys$2(luvio, resourceParams, response) {
|
|
1203
|
-
return getTypeCacheKeys$3(luvio, response);
|
|
1204
|
-
}
|
|
1205
|
-
function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
|
|
1206
|
-
const { body } = response;
|
|
1207
|
-
const key = keyBuilder$4(luvio, resourceParams);
|
|
1208
|
-
luvio.storeIngest(key, ingest$3, body);
|
|
1209
|
-
const snapshot = luvio.storeLookup({
|
|
1210
|
-
recordId: key,
|
|
1211
|
-
node: select$6(),
|
|
1212
|
-
variables: {},
|
|
1213
|
-
}, snapshotRefresh);
|
|
1214
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1215
|
-
if (snapshot.state !== 'Fulfilled') {
|
|
1216
|
-
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
return snapshot;
|
|
1220
|
-
}
|
|
1221
|
-
function ingestError$1(luvio, params, error, snapshotRefresh) {
|
|
1222
|
-
const key = keyBuilder$4(luvio, params);
|
|
1223
|
-
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1224
|
-
const storeMetadataParams = {
|
|
1225
|
-
ttl: TTL$3,
|
|
1226
|
-
namespace: keyPrefix,
|
|
1227
|
-
version: VERSION$5,
|
|
1228
|
-
representationName: RepresentationType$3
|
|
1229
|
-
};
|
|
1230
|
-
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
1231
|
-
return errorSnapshot;
|
|
1232
|
-
}
|
|
1233
|
-
function createResourceRequest$2(config) {
|
|
1234
|
-
const headers = {};
|
|
1235
|
-
return {
|
|
1236
|
-
baseUri: '/services/data/v58.0',
|
|
1237
|
-
basePath: '/commerce/extension/mappings/' + config.urlParams.mappingId + '',
|
|
1238
|
-
method: 'get',
|
|
1239
|
-
body: null,
|
|
1240
|
-
urlParams: config.urlParams,
|
|
1241
|
-
queryParams: {},
|
|
1242
|
-
headers,
|
|
1243
|
-
priority: 'normal',
|
|
1244
|
-
};
|
|
1194
|
+
function select$6(luvio, params) {
|
|
1195
|
+
return select$a();
|
|
1196
|
+
}
|
|
1197
|
+
function keyBuilder$4(luvio, params) {
|
|
1198
|
+
return keyBuilder$8(luvio, {
|
|
1199
|
+
id: params.urlParams.mappingId
|
|
1200
|
+
});
|
|
1201
|
+
}
|
|
1202
|
+
function getResponseCacheKeys$2(luvio, resourceParams, response) {
|
|
1203
|
+
return getTypeCacheKeys$3(luvio, response);
|
|
1204
|
+
}
|
|
1205
|
+
function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
|
|
1206
|
+
const { body } = response;
|
|
1207
|
+
const key = keyBuilder$4(luvio, resourceParams);
|
|
1208
|
+
luvio.storeIngest(key, ingest$3, body);
|
|
1209
|
+
const snapshot = luvio.storeLookup({
|
|
1210
|
+
recordId: key,
|
|
1211
|
+
node: select$6(),
|
|
1212
|
+
variables: {},
|
|
1213
|
+
}, snapshotRefresh);
|
|
1214
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1215
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1216
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
return snapshot;
|
|
1220
|
+
}
|
|
1221
|
+
function ingestError$1(luvio, params, error, snapshotRefresh) {
|
|
1222
|
+
const key = keyBuilder$4(luvio, params);
|
|
1223
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1224
|
+
const storeMetadataParams = {
|
|
1225
|
+
ttl: TTL$3,
|
|
1226
|
+
namespace: keyPrefix,
|
|
1227
|
+
version: VERSION$5,
|
|
1228
|
+
representationName: RepresentationType$3
|
|
1229
|
+
};
|
|
1230
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
1231
|
+
return errorSnapshot;
|
|
1232
|
+
}
|
|
1233
|
+
function createResourceRequest$2(config) {
|
|
1234
|
+
const headers = {};
|
|
1235
|
+
return {
|
|
1236
|
+
baseUri: '/services/data/v58.0',
|
|
1237
|
+
basePath: '/commerce/extension/mappings/' + config.urlParams.mappingId + '',
|
|
1238
|
+
method: 'get',
|
|
1239
|
+
body: null,
|
|
1240
|
+
urlParams: config.urlParams,
|
|
1241
|
+
queryParams: {},
|
|
1242
|
+
headers,
|
|
1243
|
+
priority: 'normal',
|
|
1244
|
+
};
|
|
1245
1245
|
}
|
|
1246
1246
|
|
|
1247
|
-
const getMapping_ConfigPropertyNames = {
|
|
1248
|
-
displayName: 'getMapping',
|
|
1249
|
-
parameters: {
|
|
1250
|
-
required: ['mappingId'],
|
|
1251
|
-
optional: []
|
|
1252
|
-
}
|
|
1253
|
-
};
|
|
1254
|
-
function createResourceParams$2(config) {
|
|
1255
|
-
const resourceParams = {
|
|
1256
|
-
urlParams: {
|
|
1257
|
-
mappingId: config.mappingId
|
|
1258
|
-
}
|
|
1259
|
-
};
|
|
1260
|
-
return resourceParams;
|
|
1261
|
-
}
|
|
1262
|
-
function keyBuilder$3(luvio, config) {
|
|
1263
|
-
const resourceParams = createResourceParams$2(config);
|
|
1264
|
-
return keyBuilder$4(luvio, resourceParams);
|
|
1265
|
-
}
|
|
1266
|
-
function typeCheckConfig$2(untrustedConfig) {
|
|
1267
|
-
const config = {};
|
|
1268
|
-
const untrustedConfig_mappingId = untrustedConfig.mappingId;
|
|
1269
|
-
if (typeof untrustedConfig_mappingId === 'string') {
|
|
1270
|
-
config.mappingId = untrustedConfig_mappingId;
|
|
1271
|
-
}
|
|
1272
|
-
return config;
|
|
1273
|
-
}
|
|
1274
|
-
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
1275
|
-
if (!untrustedIsObject(untrustedConfig)) {
|
|
1276
|
-
return null;
|
|
1277
|
-
}
|
|
1278
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1279
|
-
validateConfig(untrustedConfig, configPropertyNames);
|
|
1280
|
-
}
|
|
1281
|
-
const config = typeCheckConfig$2(untrustedConfig);
|
|
1282
|
-
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1283
|
-
return null;
|
|
1284
|
-
}
|
|
1285
|
-
return config;
|
|
1286
|
-
}
|
|
1287
|
-
function adapterFragment$1(luvio, config) {
|
|
1288
|
-
createResourceParams$2(config);
|
|
1289
|
-
return select$6();
|
|
1290
|
-
}
|
|
1291
|
-
function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
|
|
1292
|
-
const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
|
|
1293
|
-
config,
|
|
1294
|
-
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1295
|
-
});
|
|
1296
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
1297
|
-
}
|
|
1298
|
-
function onFetchResponseError$1(luvio, config, resourceParams, response) {
|
|
1299
|
-
const snapshot = ingestError$1(luvio, resourceParams, response, {
|
|
1300
|
-
config,
|
|
1301
|
-
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1302
|
-
});
|
|
1303
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
1304
|
-
}
|
|
1305
|
-
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
1306
|
-
const resourceParams = createResourceParams$2(config);
|
|
1307
|
-
const request = createResourceRequest$2(resourceParams);
|
|
1308
|
-
return luvio.dispatchResourceRequest(request, options)
|
|
1309
|
-
.then((response) => {
|
|
1310
|
-
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => getResponseCacheKeys$2(luvio, resourceParams, response.body));
|
|
1311
|
-
}, (response) => {
|
|
1312
|
-
return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
|
|
1313
|
-
});
|
|
1314
|
-
}
|
|
1315
|
-
function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
|
|
1316
|
-
const { luvio, config } = context;
|
|
1317
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
1318
|
-
const dispatchOptions = {
|
|
1319
|
-
resourceRequestContext: {
|
|
1320
|
-
requestCorrelator,
|
|
1321
|
-
luvioRequestMethod: undefined,
|
|
1322
|
-
},
|
|
1323
|
-
eventObservers
|
|
1324
|
-
};
|
|
1325
|
-
if (networkPriority !== 'normal') {
|
|
1326
|
-
dispatchOptions.overrides = {
|
|
1327
|
-
priority: networkPriority
|
|
1328
|
-
};
|
|
1329
|
-
}
|
|
1330
|
-
return buildNetworkSnapshot$2(luvio, config, dispatchOptions);
|
|
1331
|
-
}
|
|
1332
|
-
function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
|
|
1333
|
-
const { luvio, config } = context;
|
|
1334
|
-
const selector = {
|
|
1335
|
-
recordId: keyBuilder$3(luvio, config),
|
|
1336
|
-
node: adapterFragment$1(luvio, config),
|
|
1337
|
-
variables: {},
|
|
1338
|
-
};
|
|
1339
|
-
const cacheSnapshot = storeLookup(selector, {
|
|
1340
|
-
config,
|
|
1341
|
-
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1342
|
-
});
|
|
1343
|
-
return cacheSnapshot;
|
|
1344
|
-
}
|
|
1345
|
-
const getMappingAdapterFactory = (luvio) => function extensions__getMapping(untrustedConfig, requestContext) {
|
|
1346
|
-
const config = validateAdapterConfig$2(untrustedConfig, getMapping_ConfigPropertyNames);
|
|
1347
|
-
// Invalid or incomplete config
|
|
1348
|
-
if (config === null) {
|
|
1349
|
-
return null;
|
|
1350
|
-
}
|
|
1351
|
-
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1352
|
-
buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
|
|
1247
|
+
const getMapping_ConfigPropertyNames = {
|
|
1248
|
+
displayName: 'getMapping',
|
|
1249
|
+
parameters: {
|
|
1250
|
+
required: ['mappingId'],
|
|
1251
|
+
optional: []
|
|
1252
|
+
}
|
|
1253
|
+
};
|
|
1254
|
+
function createResourceParams$2(config) {
|
|
1255
|
+
const resourceParams = {
|
|
1256
|
+
urlParams: {
|
|
1257
|
+
mappingId: config.mappingId
|
|
1258
|
+
}
|
|
1259
|
+
};
|
|
1260
|
+
return resourceParams;
|
|
1261
|
+
}
|
|
1262
|
+
function keyBuilder$3(luvio, config) {
|
|
1263
|
+
const resourceParams = createResourceParams$2(config);
|
|
1264
|
+
return keyBuilder$4(luvio, resourceParams);
|
|
1265
|
+
}
|
|
1266
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
1267
|
+
const config = {};
|
|
1268
|
+
const untrustedConfig_mappingId = untrustedConfig.mappingId;
|
|
1269
|
+
if (typeof untrustedConfig_mappingId === 'string') {
|
|
1270
|
+
config.mappingId = untrustedConfig_mappingId;
|
|
1271
|
+
}
|
|
1272
|
+
return config;
|
|
1273
|
+
}
|
|
1274
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
1275
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1276
|
+
return null;
|
|
1277
|
+
}
|
|
1278
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1279
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1280
|
+
}
|
|
1281
|
+
const config = typeCheckConfig$2(untrustedConfig);
|
|
1282
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1283
|
+
return null;
|
|
1284
|
+
}
|
|
1285
|
+
return config;
|
|
1286
|
+
}
|
|
1287
|
+
function adapterFragment$1(luvio, config) {
|
|
1288
|
+
createResourceParams$2(config);
|
|
1289
|
+
return select$6();
|
|
1290
|
+
}
|
|
1291
|
+
function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
|
|
1292
|
+
const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
|
|
1293
|
+
config,
|
|
1294
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1295
|
+
});
|
|
1296
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1297
|
+
}
|
|
1298
|
+
function onFetchResponseError$1(luvio, config, resourceParams, response) {
|
|
1299
|
+
const snapshot = ingestError$1(luvio, resourceParams, response, {
|
|
1300
|
+
config,
|
|
1301
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1302
|
+
});
|
|
1303
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1304
|
+
}
|
|
1305
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
1306
|
+
const resourceParams = createResourceParams$2(config);
|
|
1307
|
+
const request = createResourceRequest$2(resourceParams);
|
|
1308
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1309
|
+
.then((response) => {
|
|
1310
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => getResponseCacheKeys$2(luvio, resourceParams, response.body));
|
|
1311
|
+
}, (response) => {
|
|
1312
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
|
|
1313
|
+
});
|
|
1314
|
+
}
|
|
1315
|
+
function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
|
|
1316
|
+
const { luvio, config } = context;
|
|
1317
|
+
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
1318
|
+
const dispatchOptions = {
|
|
1319
|
+
resourceRequestContext: {
|
|
1320
|
+
requestCorrelator,
|
|
1321
|
+
luvioRequestMethod: undefined,
|
|
1322
|
+
},
|
|
1323
|
+
eventObservers
|
|
1324
|
+
};
|
|
1325
|
+
if (networkPriority !== 'normal') {
|
|
1326
|
+
dispatchOptions.overrides = {
|
|
1327
|
+
priority: networkPriority
|
|
1328
|
+
};
|
|
1329
|
+
}
|
|
1330
|
+
return buildNetworkSnapshot$2(luvio, config, dispatchOptions);
|
|
1331
|
+
}
|
|
1332
|
+
function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
|
|
1333
|
+
const { luvio, config } = context;
|
|
1334
|
+
const selector = {
|
|
1335
|
+
recordId: keyBuilder$3(luvio, config),
|
|
1336
|
+
node: adapterFragment$1(luvio, config),
|
|
1337
|
+
variables: {},
|
|
1338
|
+
};
|
|
1339
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
1340
|
+
config,
|
|
1341
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1342
|
+
});
|
|
1343
|
+
return cacheSnapshot;
|
|
1344
|
+
}
|
|
1345
|
+
const getMappingAdapterFactory = (luvio) => function extensions__getMapping(untrustedConfig, requestContext) {
|
|
1346
|
+
const config = validateAdapterConfig$2(untrustedConfig, getMapping_ConfigPropertyNames);
|
|
1347
|
+
// Invalid or incomplete config
|
|
1348
|
+
if (config === null) {
|
|
1349
|
+
return null;
|
|
1350
|
+
}
|
|
1351
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1352
|
+
buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
|
|
1353
1353
|
};
|
|
1354
1354
|
|
|
1355
|
-
function select$5(luvio, params) {
|
|
1356
|
-
return select$a();
|
|
1357
|
-
}
|
|
1358
|
-
function getResponseCacheKeys$1(luvio, resourceParams, response) {
|
|
1359
|
-
return getTypeCacheKeys$3(luvio, response);
|
|
1360
|
-
}
|
|
1361
|
-
function ingestSuccess$1(luvio, resourceParams, response) {
|
|
1362
|
-
const { body } = response;
|
|
1363
|
-
const key = keyBuilderFromType$1(luvio, body);
|
|
1364
|
-
luvio.storeIngest(key, ingest$3, body);
|
|
1365
|
-
const snapshot = luvio.storeLookup({
|
|
1366
|
-
recordId: key,
|
|
1367
|
-
node: select$5(),
|
|
1368
|
-
variables: {},
|
|
1369
|
-
});
|
|
1370
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1371
|
-
if (snapshot.state !== 'Fulfilled') {
|
|
1372
|
-
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1373
|
-
}
|
|
1374
|
-
}
|
|
1375
|
-
return snapshot;
|
|
1376
|
-
}
|
|
1377
|
-
function createResourceRequest$1(config) {
|
|
1378
|
-
const headers = {};
|
|
1379
|
-
return {
|
|
1380
|
-
baseUri: '/services/data/v58.0',
|
|
1381
|
-
basePath: '/commerce/extension/mappings/' + config.urlParams.mappingId + '',
|
|
1382
|
-
method: 'put',
|
|
1383
|
-
body: config.body,
|
|
1384
|
-
urlParams: config.urlParams,
|
|
1385
|
-
queryParams: {},
|
|
1386
|
-
headers,
|
|
1387
|
-
priority: 'normal',
|
|
1388
|
-
};
|
|
1355
|
+
function select$5(luvio, params) {
|
|
1356
|
+
return select$a();
|
|
1357
|
+
}
|
|
1358
|
+
function getResponseCacheKeys$1(luvio, resourceParams, response) {
|
|
1359
|
+
return getTypeCacheKeys$3(luvio, response);
|
|
1360
|
+
}
|
|
1361
|
+
function ingestSuccess$1(luvio, resourceParams, response) {
|
|
1362
|
+
const { body } = response;
|
|
1363
|
+
const key = keyBuilderFromType$1(luvio, body);
|
|
1364
|
+
luvio.storeIngest(key, ingest$3, body);
|
|
1365
|
+
const snapshot = luvio.storeLookup({
|
|
1366
|
+
recordId: key,
|
|
1367
|
+
node: select$5(),
|
|
1368
|
+
variables: {},
|
|
1369
|
+
});
|
|
1370
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1371
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1372
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
return snapshot;
|
|
1376
|
+
}
|
|
1377
|
+
function createResourceRequest$1(config) {
|
|
1378
|
+
const headers = {};
|
|
1379
|
+
return {
|
|
1380
|
+
baseUri: '/services/data/v58.0',
|
|
1381
|
+
basePath: '/commerce/extension/mappings/' + config.urlParams.mappingId + '',
|
|
1382
|
+
method: 'put',
|
|
1383
|
+
body: config.body,
|
|
1384
|
+
urlParams: config.urlParams,
|
|
1385
|
+
queryParams: {},
|
|
1386
|
+
headers,
|
|
1387
|
+
priority: 'normal',
|
|
1388
|
+
};
|
|
1389
1389
|
}
|
|
1390
1390
|
|
|
1391
|
-
const updateMapping_ConfigPropertyNames = {
|
|
1392
|
-
displayName: 'updateMapping',
|
|
1393
|
-
parameters: {
|
|
1394
|
-
required: ['mappingId', 'epn', 'providerName', 'webstoreId'],
|
|
1395
|
-
optional: ['id']
|
|
1396
|
-
}
|
|
1397
|
-
};
|
|
1398
|
-
function createResourceParams$1(config) {
|
|
1399
|
-
const resourceParams = {
|
|
1400
|
-
urlParams: {
|
|
1401
|
-
mappingId: config.mappingId
|
|
1402
|
-
},
|
|
1403
|
-
body: {
|
|
1404
|
-
epn: config.epn, providerName: config.providerName, webstoreId: config.webstoreId
|
|
1405
|
-
}
|
|
1406
|
-
};
|
|
1407
|
-
if (config['id'] !== undefined) {
|
|
1408
|
-
resourceParams.body['id'] = config['id'];
|
|
1409
|
-
}
|
|
1410
|
-
return resourceParams;
|
|
1411
|
-
}
|
|
1412
|
-
function typeCheckConfig$1(untrustedConfig) {
|
|
1413
|
-
const config = {};
|
|
1414
|
-
const untrustedConfig_mappingId = untrustedConfig.mappingId;
|
|
1415
|
-
if (typeof untrustedConfig_mappingId === 'string') {
|
|
1416
|
-
config.mappingId = untrustedConfig_mappingId;
|
|
1417
|
-
}
|
|
1418
|
-
const untrustedConfig_epn = untrustedConfig.epn;
|
|
1419
|
-
if (typeof untrustedConfig_epn === 'string') {
|
|
1420
|
-
config.epn = untrustedConfig_epn;
|
|
1421
|
-
}
|
|
1422
|
-
const untrustedConfig_id = untrustedConfig.id;
|
|
1423
|
-
if (typeof untrustedConfig_id === 'string') {
|
|
1424
|
-
config.id = untrustedConfig_id;
|
|
1425
|
-
}
|
|
1426
|
-
const untrustedConfig_providerName = untrustedConfig.providerName;
|
|
1427
|
-
if (typeof untrustedConfig_providerName === 'string') {
|
|
1428
|
-
config.providerName = untrustedConfig_providerName;
|
|
1429
|
-
}
|
|
1430
|
-
const untrustedConfig_webstoreId = untrustedConfig.webstoreId;
|
|
1431
|
-
if (typeof untrustedConfig_webstoreId === 'string') {
|
|
1432
|
-
config.webstoreId = untrustedConfig_webstoreId;
|
|
1433
|
-
}
|
|
1434
|
-
return config;
|
|
1435
|
-
}
|
|
1436
|
-
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
1437
|
-
if (!untrustedIsObject(untrustedConfig)) {
|
|
1438
|
-
return null;
|
|
1439
|
-
}
|
|
1440
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1441
|
-
validateConfig(untrustedConfig, configPropertyNames);
|
|
1442
|
-
}
|
|
1443
|
-
const config = typeCheckConfig$1(untrustedConfig);
|
|
1444
|
-
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1445
|
-
return null;
|
|
1446
|
-
}
|
|
1447
|
-
return config;
|
|
1448
|
-
}
|
|
1449
|
-
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
1450
|
-
const resourceParams = createResourceParams$1(config);
|
|
1451
|
-
const request = createResourceRequest$1(resourceParams);
|
|
1452
|
-
return luvio.dispatchResourceRequest(request, options)
|
|
1453
|
-
.then((response) => {
|
|
1454
|
-
return luvio.handleSuccessResponse(() => {
|
|
1455
|
-
const snapshot = ingestSuccess$1(luvio, resourceParams, response);
|
|
1456
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
1457
|
-
}, () => getResponseCacheKeys$1(luvio, resourceParams, response.body));
|
|
1458
|
-
}, (response) => {
|
|
1459
|
-
deepFreeze(response);
|
|
1460
|
-
throw response;
|
|
1461
|
-
});
|
|
1462
|
-
}
|
|
1463
|
-
const updateMappingAdapterFactory = (luvio) => {
|
|
1464
|
-
return function updateMapping(untrustedConfig) {
|
|
1465
|
-
const config = validateAdapterConfig$1(untrustedConfig, updateMapping_ConfigPropertyNames);
|
|
1466
|
-
// Invalid or incomplete config
|
|
1467
|
-
if (config === null) {
|
|
1468
|
-
throw new Error('Invalid config for "updateMapping"');
|
|
1469
|
-
}
|
|
1470
|
-
return buildNetworkSnapshot$1(luvio, config);
|
|
1471
|
-
};
|
|
1391
|
+
const updateMapping_ConfigPropertyNames = {
|
|
1392
|
+
displayName: 'updateMapping',
|
|
1393
|
+
parameters: {
|
|
1394
|
+
required: ['mappingId', 'epn', 'providerName', 'webstoreId'],
|
|
1395
|
+
optional: ['id']
|
|
1396
|
+
}
|
|
1397
|
+
};
|
|
1398
|
+
function createResourceParams$1(config) {
|
|
1399
|
+
const resourceParams = {
|
|
1400
|
+
urlParams: {
|
|
1401
|
+
mappingId: config.mappingId
|
|
1402
|
+
},
|
|
1403
|
+
body: {
|
|
1404
|
+
epn: config.epn, providerName: config.providerName, webstoreId: config.webstoreId
|
|
1405
|
+
}
|
|
1406
|
+
};
|
|
1407
|
+
if (config['id'] !== undefined) {
|
|
1408
|
+
resourceParams.body['id'] = config['id'];
|
|
1409
|
+
}
|
|
1410
|
+
return resourceParams;
|
|
1411
|
+
}
|
|
1412
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
1413
|
+
const config = {};
|
|
1414
|
+
const untrustedConfig_mappingId = untrustedConfig.mappingId;
|
|
1415
|
+
if (typeof untrustedConfig_mappingId === 'string') {
|
|
1416
|
+
config.mappingId = untrustedConfig_mappingId;
|
|
1417
|
+
}
|
|
1418
|
+
const untrustedConfig_epn = untrustedConfig.epn;
|
|
1419
|
+
if (typeof untrustedConfig_epn === 'string') {
|
|
1420
|
+
config.epn = untrustedConfig_epn;
|
|
1421
|
+
}
|
|
1422
|
+
const untrustedConfig_id = untrustedConfig.id;
|
|
1423
|
+
if (typeof untrustedConfig_id === 'string') {
|
|
1424
|
+
config.id = untrustedConfig_id;
|
|
1425
|
+
}
|
|
1426
|
+
const untrustedConfig_providerName = untrustedConfig.providerName;
|
|
1427
|
+
if (typeof untrustedConfig_providerName === 'string') {
|
|
1428
|
+
config.providerName = untrustedConfig_providerName;
|
|
1429
|
+
}
|
|
1430
|
+
const untrustedConfig_webstoreId = untrustedConfig.webstoreId;
|
|
1431
|
+
if (typeof untrustedConfig_webstoreId === 'string') {
|
|
1432
|
+
config.webstoreId = untrustedConfig_webstoreId;
|
|
1433
|
+
}
|
|
1434
|
+
return config;
|
|
1435
|
+
}
|
|
1436
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
1437
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1438
|
+
return null;
|
|
1439
|
+
}
|
|
1440
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1441
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1442
|
+
}
|
|
1443
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
1444
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1445
|
+
return null;
|
|
1446
|
+
}
|
|
1447
|
+
return config;
|
|
1448
|
+
}
|
|
1449
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
1450
|
+
const resourceParams = createResourceParams$1(config);
|
|
1451
|
+
const request = createResourceRequest$1(resourceParams);
|
|
1452
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1453
|
+
.then((response) => {
|
|
1454
|
+
return luvio.handleSuccessResponse(() => {
|
|
1455
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response);
|
|
1456
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1457
|
+
}, () => getResponseCacheKeys$1(luvio, resourceParams, response.body));
|
|
1458
|
+
}, (response) => {
|
|
1459
|
+
deepFreeze(response);
|
|
1460
|
+
throw response;
|
|
1461
|
+
});
|
|
1462
|
+
}
|
|
1463
|
+
const updateMappingAdapterFactory = (luvio) => {
|
|
1464
|
+
return function updateMapping(untrustedConfig) {
|
|
1465
|
+
const config = validateAdapterConfig$1(untrustedConfig, updateMapping_ConfigPropertyNames);
|
|
1466
|
+
// Invalid or incomplete config
|
|
1467
|
+
if (config === null) {
|
|
1468
|
+
throw new Error('Invalid config for "updateMapping"');
|
|
1469
|
+
}
|
|
1470
|
+
return buildNetworkSnapshot$1(luvio, config);
|
|
1471
|
+
};
|
|
1472
1472
|
};
|
|
1473
1473
|
|
|
1474
|
-
const VERSION$3 = "bed780ad418f5f02446c1b0f9d165e5d";
|
|
1475
|
-
function validate$3(obj, path = 'ApexClassOutputRepresentation') {
|
|
1476
|
-
const v_error = (() => {
|
|
1477
|
-
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1478
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1479
|
-
}
|
|
1480
|
-
const obj_classId = obj.classId;
|
|
1481
|
-
const path_classId = path + '.classId';
|
|
1482
|
-
if (typeof obj_classId !== 'string') {
|
|
1483
|
-
return new TypeError('Expected "string" but received "' + typeof obj_classId + '" (at "' + path_classId + '")');
|
|
1484
|
-
}
|
|
1485
|
-
const obj_className = obj.className;
|
|
1486
|
-
const path_className = path + '.className';
|
|
1487
|
-
if (typeof obj_className !== 'string') {
|
|
1488
|
-
return new TypeError('Expected "string" but received "' + typeof obj_className + '" (at "' + path_className + '")');
|
|
1489
|
-
}
|
|
1490
|
-
const obj_namespace = obj.namespace;
|
|
1491
|
-
const path_namespace = path + '.namespace';
|
|
1492
|
-
if (typeof obj_namespace !== 'string') {
|
|
1493
|
-
return new TypeError('Expected "string" but received "' + typeof obj_namespace + '" (at "' + path_namespace + '")');
|
|
1494
|
-
}
|
|
1495
|
-
const obj_version = obj.version;
|
|
1496
|
-
const path_version = path + '.version';
|
|
1497
|
-
if (typeof obj_version !== 'string') {
|
|
1498
|
-
return new TypeError('Expected "string" but received "' + typeof obj_version + '" (at "' + path_version + '")');
|
|
1499
|
-
}
|
|
1500
|
-
})();
|
|
1501
|
-
return v_error === undefined ? null : v_error;
|
|
1502
|
-
}
|
|
1503
|
-
const select$4 = function ApexClassOutputRepresentationSelect() {
|
|
1504
|
-
return {
|
|
1505
|
-
kind: 'Fragment',
|
|
1506
|
-
version: VERSION$3,
|
|
1507
|
-
private: [],
|
|
1508
|
-
selections: [
|
|
1509
|
-
{
|
|
1510
|
-
name: 'classId',
|
|
1511
|
-
kind: 'Scalar'
|
|
1512
|
-
},
|
|
1513
|
-
{
|
|
1514
|
-
name: 'className',
|
|
1515
|
-
kind: 'Scalar'
|
|
1516
|
-
},
|
|
1517
|
-
{
|
|
1518
|
-
name: 'namespace',
|
|
1519
|
-
kind: 'Scalar'
|
|
1520
|
-
},
|
|
1521
|
-
{
|
|
1522
|
-
name: 'version',
|
|
1523
|
-
kind: 'Scalar'
|
|
1524
|
-
}
|
|
1525
|
-
]
|
|
1526
|
-
};
|
|
1527
|
-
};
|
|
1528
|
-
function equals$3(existing, incoming) {
|
|
1529
|
-
const existing_classId = existing.classId;
|
|
1530
|
-
const incoming_classId = incoming.classId;
|
|
1531
|
-
if (!(existing_classId === incoming_classId)) {
|
|
1532
|
-
return false;
|
|
1533
|
-
}
|
|
1534
|
-
const existing_className = existing.className;
|
|
1535
|
-
const incoming_className = incoming.className;
|
|
1536
|
-
if (!(existing_className === incoming_className)) {
|
|
1537
|
-
return false;
|
|
1538
|
-
}
|
|
1539
|
-
const existing_namespace = existing.namespace;
|
|
1540
|
-
const incoming_namespace = incoming.namespace;
|
|
1541
|
-
if (!(existing_namespace === incoming_namespace)) {
|
|
1542
|
-
return false;
|
|
1543
|
-
}
|
|
1544
|
-
const existing_version = existing.version;
|
|
1545
|
-
const incoming_version = incoming.version;
|
|
1546
|
-
if (!(existing_version === incoming_version)) {
|
|
1547
|
-
return false;
|
|
1548
|
-
}
|
|
1549
|
-
return true;
|
|
1474
|
+
const VERSION$3 = "bed780ad418f5f02446c1b0f9d165e5d";
|
|
1475
|
+
function validate$3(obj, path = 'ApexClassOutputRepresentation') {
|
|
1476
|
+
const v_error = (() => {
|
|
1477
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1478
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1479
|
+
}
|
|
1480
|
+
const obj_classId = obj.classId;
|
|
1481
|
+
const path_classId = path + '.classId';
|
|
1482
|
+
if (typeof obj_classId !== 'string') {
|
|
1483
|
+
return new TypeError('Expected "string" but received "' + typeof obj_classId + '" (at "' + path_classId + '")');
|
|
1484
|
+
}
|
|
1485
|
+
const obj_className = obj.className;
|
|
1486
|
+
const path_className = path + '.className';
|
|
1487
|
+
if (typeof obj_className !== 'string') {
|
|
1488
|
+
return new TypeError('Expected "string" but received "' + typeof obj_className + '" (at "' + path_className + '")');
|
|
1489
|
+
}
|
|
1490
|
+
const obj_namespace = obj.namespace;
|
|
1491
|
+
const path_namespace = path + '.namespace';
|
|
1492
|
+
if (typeof obj_namespace !== 'string') {
|
|
1493
|
+
return new TypeError('Expected "string" but received "' + typeof obj_namespace + '" (at "' + path_namespace + '")');
|
|
1494
|
+
}
|
|
1495
|
+
const obj_version = obj.version;
|
|
1496
|
+
const path_version = path + '.version';
|
|
1497
|
+
if (typeof obj_version !== 'string') {
|
|
1498
|
+
return new TypeError('Expected "string" but received "' + typeof obj_version + '" (at "' + path_version + '")');
|
|
1499
|
+
}
|
|
1500
|
+
})();
|
|
1501
|
+
return v_error === undefined ? null : v_error;
|
|
1502
|
+
}
|
|
1503
|
+
const select$4 = function ApexClassOutputRepresentationSelect() {
|
|
1504
|
+
return {
|
|
1505
|
+
kind: 'Fragment',
|
|
1506
|
+
version: VERSION$3,
|
|
1507
|
+
private: [],
|
|
1508
|
+
selections: [
|
|
1509
|
+
{
|
|
1510
|
+
name: 'classId',
|
|
1511
|
+
kind: 'Scalar'
|
|
1512
|
+
},
|
|
1513
|
+
{
|
|
1514
|
+
name: 'className',
|
|
1515
|
+
kind: 'Scalar'
|
|
1516
|
+
},
|
|
1517
|
+
{
|
|
1518
|
+
name: 'namespace',
|
|
1519
|
+
kind: 'Scalar'
|
|
1520
|
+
},
|
|
1521
|
+
{
|
|
1522
|
+
name: 'version',
|
|
1523
|
+
kind: 'Scalar'
|
|
1524
|
+
}
|
|
1525
|
+
]
|
|
1526
|
+
};
|
|
1527
|
+
};
|
|
1528
|
+
function equals$3(existing, incoming) {
|
|
1529
|
+
const existing_classId = existing.classId;
|
|
1530
|
+
const incoming_classId = incoming.classId;
|
|
1531
|
+
if (!(existing_classId === incoming_classId)) {
|
|
1532
|
+
return false;
|
|
1533
|
+
}
|
|
1534
|
+
const existing_className = existing.className;
|
|
1535
|
+
const incoming_className = incoming.className;
|
|
1536
|
+
if (!(existing_className === incoming_className)) {
|
|
1537
|
+
return false;
|
|
1538
|
+
}
|
|
1539
|
+
const existing_namespace = existing.namespace;
|
|
1540
|
+
const incoming_namespace = incoming.namespace;
|
|
1541
|
+
if (!(existing_namespace === incoming_namespace)) {
|
|
1542
|
+
return false;
|
|
1543
|
+
}
|
|
1544
|
+
const existing_version = existing.version;
|
|
1545
|
+
const incoming_version = incoming.version;
|
|
1546
|
+
if (!(existing_version === incoming_version)) {
|
|
1547
|
+
return false;
|
|
1548
|
+
}
|
|
1549
|
+
return true;
|
|
1550
1550
|
}
|
|
1551
1551
|
|
|
1552
|
-
const VERSION$2 = "5d74820ea8d6cfbe4e56d4a37b7cdb77";
|
|
1553
|
-
function validate$2(obj, path = 'EffectiveMappingRepresentation') {
|
|
1554
|
-
const v_error = (() => {
|
|
1555
|
-
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1556
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1557
|
-
}
|
|
1558
|
-
const obj_webstoreId = obj.webstoreId;
|
|
1559
|
-
const path_webstoreId = path + '.webstoreId';
|
|
1560
|
-
if (typeof obj_webstoreId !== 'string') {
|
|
1561
|
-
return new TypeError('Expected "string" but received "' + typeof obj_webstoreId + '" (at "' + path_webstoreId + '")');
|
|
1562
|
-
}
|
|
1563
|
-
})();
|
|
1564
|
-
return v_error === undefined ? null : v_error;
|
|
1565
|
-
}
|
|
1566
|
-
const select$3 = function EffectiveMappingRepresentationSelect() {
|
|
1567
|
-
return {
|
|
1568
|
-
kind: 'Fragment',
|
|
1569
|
-
version: VERSION$2,
|
|
1570
|
-
private: [],
|
|
1571
|
-
selections: [
|
|
1572
|
-
{
|
|
1573
|
-
name: 'webstoreId',
|
|
1574
|
-
kind: 'Scalar'
|
|
1575
|
-
}
|
|
1576
|
-
]
|
|
1577
|
-
};
|
|
1578
|
-
};
|
|
1579
|
-
function equals$2(existing, incoming) {
|
|
1580
|
-
const existing_webstoreId = existing.webstoreId;
|
|
1581
|
-
const incoming_webstoreId = incoming.webstoreId;
|
|
1582
|
-
if (!(existing_webstoreId === incoming_webstoreId)) {
|
|
1583
|
-
return false;
|
|
1584
|
-
}
|
|
1585
|
-
return true;
|
|
1552
|
+
const VERSION$2 = "5d74820ea8d6cfbe4e56d4a37b7cdb77";
|
|
1553
|
+
function validate$2(obj, path = 'EffectiveMappingRepresentation') {
|
|
1554
|
+
const v_error = (() => {
|
|
1555
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1556
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1557
|
+
}
|
|
1558
|
+
const obj_webstoreId = obj.webstoreId;
|
|
1559
|
+
const path_webstoreId = path + '.webstoreId';
|
|
1560
|
+
if (typeof obj_webstoreId !== 'string') {
|
|
1561
|
+
return new TypeError('Expected "string" but received "' + typeof obj_webstoreId + '" (at "' + path_webstoreId + '")');
|
|
1562
|
+
}
|
|
1563
|
+
})();
|
|
1564
|
+
return v_error === undefined ? null : v_error;
|
|
1565
|
+
}
|
|
1566
|
+
const select$3 = function EffectiveMappingRepresentationSelect() {
|
|
1567
|
+
return {
|
|
1568
|
+
kind: 'Fragment',
|
|
1569
|
+
version: VERSION$2,
|
|
1570
|
+
private: [],
|
|
1571
|
+
selections: [
|
|
1572
|
+
{
|
|
1573
|
+
name: 'webstoreId',
|
|
1574
|
+
kind: 'Scalar'
|
|
1575
|
+
}
|
|
1576
|
+
]
|
|
1577
|
+
};
|
|
1578
|
+
};
|
|
1579
|
+
function equals$2(existing, incoming) {
|
|
1580
|
+
const existing_webstoreId = existing.webstoreId;
|
|
1581
|
+
const incoming_webstoreId = incoming.webstoreId;
|
|
1582
|
+
if (!(existing_webstoreId === incoming_webstoreId)) {
|
|
1583
|
+
return false;
|
|
1584
|
+
}
|
|
1585
|
+
return true;
|
|
1586
1586
|
}
|
|
1587
1587
|
|
|
1588
|
-
const TTL$1 = 60000;
|
|
1589
|
-
const VERSION$1 = "9e92dd6efb0ca494bcd06a4ad326b6a0";
|
|
1590
|
-
function validate$1(obj, path = 'ProviderOutputRepresentation') {
|
|
1591
|
-
const v_error = (() => {
|
|
1592
|
-
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1593
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1594
|
-
}
|
|
1595
|
-
const obj_apexClass = obj.apexClass;
|
|
1596
|
-
const path_apexClass = path + '.apexClass';
|
|
1597
|
-
const referencepath_apexClassValidationError = validate$3(obj_apexClass, path_apexClass);
|
|
1598
|
-
if (referencepath_apexClassValidationError !== null) {
|
|
1599
|
-
let message = 'Object doesn\'t match ApexClassOutputRepresentation (at "' + path_apexClass + '")\n';
|
|
1600
|
-
message += referencepath_apexClassValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1601
|
-
return new TypeError(message);
|
|
1602
|
-
}
|
|
1603
|
-
const obj_effectiveMappings = obj.effectiveMappings;
|
|
1604
|
-
const path_effectiveMappings = path + '.effectiveMappings';
|
|
1605
|
-
if (!ArrayIsArray(obj_effectiveMappings)) {
|
|
1606
|
-
return new TypeError('Expected "array" but received "' + typeof obj_effectiveMappings + '" (at "' + path_effectiveMappings + '")');
|
|
1607
|
-
}
|
|
1608
|
-
for (let i = 0; i < obj_effectiveMappings.length; i++) {
|
|
1609
|
-
const obj_effectiveMappings_item = obj_effectiveMappings[i];
|
|
1610
|
-
const path_effectiveMappings_item = path_effectiveMappings + '[' + i + ']';
|
|
1611
|
-
const referencepath_effectiveMappings_itemValidationError = validate$2(obj_effectiveMappings_item, path_effectiveMappings_item);
|
|
1612
|
-
if (referencepath_effectiveMappings_itemValidationError !== null) {
|
|
1613
|
-
let message = 'Object doesn\'t match EffectiveMappingRepresentation (at "' + path_effectiveMappings_item + '")\n';
|
|
1614
|
-
message += referencepath_effectiveMappings_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1615
|
-
return new TypeError(message);
|
|
1616
|
-
}
|
|
1617
|
-
}
|
|
1618
|
-
const obj_epn = obj.epn;
|
|
1619
|
-
const path_epn = path + '.epn';
|
|
1620
|
-
if (typeof obj_epn !== 'string') {
|
|
1621
|
-
return new TypeError('Expected "string" but received "' + typeof obj_epn + '" (at "' + path_epn + '")');
|
|
1622
|
-
}
|
|
1623
|
-
const obj_name = obj.name;
|
|
1624
|
-
const path_name = path + '.name';
|
|
1625
|
-
if (typeof obj_name !== 'string') {
|
|
1626
|
-
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
1627
|
-
}
|
|
1628
|
-
const obj_type = obj.type;
|
|
1629
|
-
const path_type = path + '.type';
|
|
1630
|
-
if (typeof obj_type !== 'string') {
|
|
1631
|
-
return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
|
|
1632
|
-
}
|
|
1633
|
-
})();
|
|
1634
|
-
return v_error === undefined ? null : v_error;
|
|
1635
|
-
}
|
|
1636
|
-
const RepresentationType$1 = 'ProviderOutputRepresentation';
|
|
1637
|
-
function keyBuilder$2(luvio, config) {
|
|
1638
|
-
return keyPrefix + '::' + RepresentationType$1 + ':' + config.name;
|
|
1639
|
-
}
|
|
1640
|
-
function keyBuilderFromType(luvio, object) {
|
|
1641
|
-
const keyParams = {
|
|
1642
|
-
name: object.name
|
|
1643
|
-
};
|
|
1644
|
-
return keyBuilder$2(luvio, keyParams);
|
|
1645
|
-
}
|
|
1646
|
-
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
1647
|
-
return input;
|
|
1648
|
-
}
|
|
1649
|
-
const select$2 = function ProviderOutputRepresentationSelect() {
|
|
1650
|
-
const { selections: ApexClassOutputRepresentation__selections, opaque: ApexClassOutputRepresentation__opaque, } = select$4();
|
|
1651
|
-
const { selections: EffectiveMappingRepresentation__selections, opaque: EffectiveMappingRepresentation__opaque, } = select$3();
|
|
1652
|
-
return {
|
|
1653
|
-
kind: 'Fragment',
|
|
1654
|
-
version: VERSION$1,
|
|
1655
|
-
private: [],
|
|
1656
|
-
selections: [
|
|
1657
|
-
{
|
|
1658
|
-
name: 'apexClass',
|
|
1659
|
-
kind: 'Object',
|
|
1660
|
-
selections: ApexClassOutputRepresentation__selections
|
|
1661
|
-
},
|
|
1662
|
-
{
|
|
1663
|
-
name: 'effectiveMappings',
|
|
1664
|
-
kind: 'Object',
|
|
1665
|
-
plural: true,
|
|
1666
|
-
selections: EffectiveMappingRepresentation__selections
|
|
1667
|
-
},
|
|
1668
|
-
{
|
|
1669
|
-
name: 'epn',
|
|
1670
|
-
kind: 'Scalar'
|
|
1671
|
-
},
|
|
1672
|
-
{
|
|
1673
|
-
name: 'name',
|
|
1674
|
-
kind: 'Scalar'
|
|
1675
|
-
},
|
|
1676
|
-
{
|
|
1677
|
-
name: 'type',
|
|
1678
|
-
kind: 'Scalar'
|
|
1679
|
-
}
|
|
1680
|
-
]
|
|
1681
|
-
};
|
|
1682
|
-
};
|
|
1683
|
-
function equals$1(existing, incoming) {
|
|
1684
|
-
const existing_epn = existing.epn;
|
|
1685
|
-
const incoming_epn = incoming.epn;
|
|
1686
|
-
if (!(existing_epn === incoming_epn)) {
|
|
1687
|
-
return false;
|
|
1688
|
-
}
|
|
1689
|
-
const existing_name = existing.name;
|
|
1690
|
-
const incoming_name = incoming.name;
|
|
1691
|
-
if (!(existing_name === incoming_name)) {
|
|
1692
|
-
return false;
|
|
1693
|
-
}
|
|
1694
|
-
const existing_type = existing.type;
|
|
1695
|
-
const incoming_type = incoming.type;
|
|
1696
|
-
if (!(existing_type === incoming_type)) {
|
|
1697
|
-
return false;
|
|
1698
|
-
}
|
|
1699
|
-
const existing_apexClass = existing.apexClass;
|
|
1700
|
-
const incoming_apexClass = incoming.apexClass;
|
|
1701
|
-
if (!(equals$3(existing_apexClass, incoming_apexClass))) {
|
|
1702
|
-
return false;
|
|
1703
|
-
}
|
|
1704
|
-
const existing_effectiveMappings = existing.effectiveMappings;
|
|
1705
|
-
const incoming_effectiveMappings = incoming.effectiveMappings;
|
|
1706
|
-
const equals_effectiveMappings_items = equalsArray(existing_effectiveMappings, incoming_effectiveMappings, (existing_effectiveMappings_item, incoming_effectiveMappings_item) => {
|
|
1707
|
-
if (!(equals$2(existing_effectiveMappings_item, incoming_effectiveMappings_item))) {
|
|
1708
|
-
return false;
|
|
1709
|
-
}
|
|
1710
|
-
});
|
|
1711
|
-
if (equals_effectiveMappings_items === false) {
|
|
1712
|
-
return false;
|
|
1713
|
-
}
|
|
1714
|
-
return true;
|
|
1715
|
-
}
|
|
1716
|
-
const ingest$1 = function ProviderOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1717
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1718
|
-
const validateError = validate$1(input);
|
|
1719
|
-
if (validateError !== null) {
|
|
1720
|
-
throw validateError;
|
|
1721
|
-
}
|
|
1722
|
-
}
|
|
1723
|
-
const key = keyBuilderFromType(luvio, input);
|
|
1724
|
-
const existingRecord = store.readEntry(key);
|
|
1725
|
-
const ttlToUse = TTL$1;
|
|
1726
|
-
let incomingRecord = normalize$1(input, store.readEntry(key), {
|
|
1727
|
-
fullPath: key,
|
|
1728
|
-
parent: path.parent,
|
|
1729
|
-
propertyName: path.propertyName,
|
|
1730
|
-
ttl: ttlToUse
|
|
1731
|
-
});
|
|
1732
|
-
if (existingRecord === undefined || equals$1(existingRecord, incomingRecord) === false) {
|
|
1733
|
-
luvio.storePublish(key, incomingRecord);
|
|
1734
|
-
}
|
|
1735
|
-
{
|
|
1736
|
-
const storeMetadataParams = {
|
|
1737
|
-
ttl: ttlToUse,
|
|
1738
|
-
namespace: "extensions",
|
|
1739
|
-
version: VERSION$1,
|
|
1740
|
-
representationName: RepresentationType$1,
|
|
1741
|
-
};
|
|
1742
|
-
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
1743
|
-
}
|
|
1744
|
-
return createLink(key);
|
|
1745
|
-
};
|
|
1746
|
-
function getTypeCacheKeys$1(luvio, input, fullPathFactory) {
|
|
1747
|
-
const rootKeySet = new StoreKeyMap();
|
|
1748
|
-
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1749
|
-
const rootKey = keyBuilderFromType(luvio, input);
|
|
1750
|
-
rootKeySet.set(rootKey, {
|
|
1751
|
-
namespace: keyPrefix,
|
|
1752
|
-
representationName: RepresentationType$1,
|
|
1753
|
-
mergeable: false
|
|
1754
|
-
});
|
|
1755
|
-
return rootKeySet;
|
|
1588
|
+
const TTL$1 = 60000;
|
|
1589
|
+
const VERSION$1 = "9e92dd6efb0ca494bcd06a4ad326b6a0";
|
|
1590
|
+
function validate$1(obj, path = 'ProviderOutputRepresentation') {
|
|
1591
|
+
const v_error = (() => {
|
|
1592
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1593
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1594
|
+
}
|
|
1595
|
+
const obj_apexClass = obj.apexClass;
|
|
1596
|
+
const path_apexClass = path + '.apexClass';
|
|
1597
|
+
const referencepath_apexClassValidationError = validate$3(obj_apexClass, path_apexClass);
|
|
1598
|
+
if (referencepath_apexClassValidationError !== null) {
|
|
1599
|
+
let message = 'Object doesn\'t match ApexClassOutputRepresentation (at "' + path_apexClass + '")\n';
|
|
1600
|
+
message += referencepath_apexClassValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1601
|
+
return new TypeError(message);
|
|
1602
|
+
}
|
|
1603
|
+
const obj_effectiveMappings = obj.effectiveMappings;
|
|
1604
|
+
const path_effectiveMappings = path + '.effectiveMappings';
|
|
1605
|
+
if (!ArrayIsArray(obj_effectiveMappings)) {
|
|
1606
|
+
return new TypeError('Expected "array" but received "' + typeof obj_effectiveMappings + '" (at "' + path_effectiveMappings + '")');
|
|
1607
|
+
}
|
|
1608
|
+
for (let i = 0; i < obj_effectiveMappings.length; i++) {
|
|
1609
|
+
const obj_effectiveMappings_item = obj_effectiveMappings[i];
|
|
1610
|
+
const path_effectiveMappings_item = path_effectiveMappings + '[' + i + ']';
|
|
1611
|
+
const referencepath_effectiveMappings_itemValidationError = validate$2(obj_effectiveMappings_item, path_effectiveMappings_item);
|
|
1612
|
+
if (referencepath_effectiveMappings_itemValidationError !== null) {
|
|
1613
|
+
let message = 'Object doesn\'t match EffectiveMappingRepresentation (at "' + path_effectiveMappings_item + '")\n';
|
|
1614
|
+
message += referencepath_effectiveMappings_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1615
|
+
return new TypeError(message);
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
const obj_epn = obj.epn;
|
|
1619
|
+
const path_epn = path + '.epn';
|
|
1620
|
+
if (typeof obj_epn !== 'string') {
|
|
1621
|
+
return new TypeError('Expected "string" but received "' + typeof obj_epn + '" (at "' + path_epn + '")');
|
|
1622
|
+
}
|
|
1623
|
+
const obj_name = obj.name;
|
|
1624
|
+
const path_name = path + '.name';
|
|
1625
|
+
if (typeof obj_name !== 'string') {
|
|
1626
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
1627
|
+
}
|
|
1628
|
+
const obj_type = obj.type;
|
|
1629
|
+
const path_type = path + '.type';
|
|
1630
|
+
if (typeof obj_type !== 'string') {
|
|
1631
|
+
return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
|
|
1632
|
+
}
|
|
1633
|
+
})();
|
|
1634
|
+
return v_error === undefined ? null : v_error;
|
|
1635
|
+
}
|
|
1636
|
+
const RepresentationType$1 = 'ProviderOutputRepresentation';
|
|
1637
|
+
function keyBuilder$2(luvio, config) {
|
|
1638
|
+
return keyPrefix + '::' + RepresentationType$1 + ':' + config.name;
|
|
1639
|
+
}
|
|
1640
|
+
function keyBuilderFromType(luvio, object) {
|
|
1641
|
+
const keyParams = {
|
|
1642
|
+
name: object.name
|
|
1643
|
+
};
|
|
1644
|
+
return keyBuilder$2(luvio, keyParams);
|
|
1645
|
+
}
|
|
1646
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
1647
|
+
return input;
|
|
1648
|
+
}
|
|
1649
|
+
const select$2 = function ProviderOutputRepresentationSelect() {
|
|
1650
|
+
const { selections: ApexClassOutputRepresentation__selections, opaque: ApexClassOutputRepresentation__opaque, } = select$4();
|
|
1651
|
+
const { selections: EffectiveMappingRepresentation__selections, opaque: EffectiveMappingRepresentation__opaque, } = select$3();
|
|
1652
|
+
return {
|
|
1653
|
+
kind: 'Fragment',
|
|
1654
|
+
version: VERSION$1,
|
|
1655
|
+
private: [],
|
|
1656
|
+
selections: [
|
|
1657
|
+
{
|
|
1658
|
+
name: 'apexClass',
|
|
1659
|
+
kind: 'Object',
|
|
1660
|
+
selections: ApexClassOutputRepresentation__selections
|
|
1661
|
+
},
|
|
1662
|
+
{
|
|
1663
|
+
name: 'effectiveMappings',
|
|
1664
|
+
kind: 'Object',
|
|
1665
|
+
plural: true,
|
|
1666
|
+
selections: EffectiveMappingRepresentation__selections
|
|
1667
|
+
},
|
|
1668
|
+
{
|
|
1669
|
+
name: 'epn',
|
|
1670
|
+
kind: 'Scalar'
|
|
1671
|
+
},
|
|
1672
|
+
{
|
|
1673
|
+
name: 'name',
|
|
1674
|
+
kind: 'Scalar'
|
|
1675
|
+
},
|
|
1676
|
+
{
|
|
1677
|
+
name: 'type',
|
|
1678
|
+
kind: 'Scalar'
|
|
1679
|
+
}
|
|
1680
|
+
]
|
|
1681
|
+
};
|
|
1682
|
+
};
|
|
1683
|
+
function equals$1(existing, incoming) {
|
|
1684
|
+
const existing_epn = existing.epn;
|
|
1685
|
+
const incoming_epn = incoming.epn;
|
|
1686
|
+
if (!(existing_epn === incoming_epn)) {
|
|
1687
|
+
return false;
|
|
1688
|
+
}
|
|
1689
|
+
const existing_name = existing.name;
|
|
1690
|
+
const incoming_name = incoming.name;
|
|
1691
|
+
if (!(existing_name === incoming_name)) {
|
|
1692
|
+
return false;
|
|
1693
|
+
}
|
|
1694
|
+
const existing_type = existing.type;
|
|
1695
|
+
const incoming_type = incoming.type;
|
|
1696
|
+
if (!(existing_type === incoming_type)) {
|
|
1697
|
+
return false;
|
|
1698
|
+
}
|
|
1699
|
+
const existing_apexClass = existing.apexClass;
|
|
1700
|
+
const incoming_apexClass = incoming.apexClass;
|
|
1701
|
+
if (!(equals$3(existing_apexClass, incoming_apexClass))) {
|
|
1702
|
+
return false;
|
|
1703
|
+
}
|
|
1704
|
+
const existing_effectiveMappings = existing.effectiveMappings;
|
|
1705
|
+
const incoming_effectiveMappings = incoming.effectiveMappings;
|
|
1706
|
+
const equals_effectiveMappings_items = equalsArray(existing_effectiveMappings, incoming_effectiveMappings, (existing_effectiveMappings_item, incoming_effectiveMappings_item) => {
|
|
1707
|
+
if (!(equals$2(existing_effectiveMappings_item, incoming_effectiveMappings_item))) {
|
|
1708
|
+
return false;
|
|
1709
|
+
}
|
|
1710
|
+
});
|
|
1711
|
+
if (equals_effectiveMappings_items === false) {
|
|
1712
|
+
return false;
|
|
1713
|
+
}
|
|
1714
|
+
return true;
|
|
1715
|
+
}
|
|
1716
|
+
const ingest$1 = function ProviderOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1717
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1718
|
+
const validateError = validate$1(input);
|
|
1719
|
+
if (validateError !== null) {
|
|
1720
|
+
throw validateError;
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
const key = keyBuilderFromType(luvio, input);
|
|
1724
|
+
const existingRecord = store.readEntry(key);
|
|
1725
|
+
const ttlToUse = TTL$1;
|
|
1726
|
+
let incomingRecord = normalize$1(input, store.readEntry(key), {
|
|
1727
|
+
fullPath: key,
|
|
1728
|
+
parent: path.parent,
|
|
1729
|
+
propertyName: path.propertyName,
|
|
1730
|
+
ttl: ttlToUse
|
|
1731
|
+
});
|
|
1732
|
+
if (existingRecord === undefined || equals$1(existingRecord, incomingRecord) === false) {
|
|
1733
|
+
luvio.storePublish(key, incomingRecord);
|
|
1734
|
+
}
|
|
1735
|
+
{
|
|
1736
|
+
const storeMetadataParams = {
|
|
1737
|
+
ttl: ttlToUse,
|
|
1738
|
+
namespace: "extensions",
|
|
1739
|
+
version: VERSION$1,
|
|
1740
|
+
representationName: RepresentationType$1,
|
|
1741
|
+
};
|
|
1742
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
1743
|
+
}
|
|
1744
|
+
return createLink(key);
|
|
1745
|
+
};
|
|
1746
|
+
function getTypeCacheKeys$1(luvio, input, fullPathFactory) {
|
|
1747
|
+
const rootKeySet = new StoreKeyMap();
|
|
1748
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1749
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
1750
|
+
rootKeySet.set(rootKey, {
|
|
1751
|
+
namespace: keyPrefix,
|
|
1752
|
+
representationName: RepresentationType$1,
|
|
1753
|
+
mergeable: false
|
|
1754
|
+
});
|
|
1755
|
+
return rootKeySet;
|
|
1756
1756
|
}
|
|
1757
1757
|
|
|
1758
|
-
const TTL = 60000;
|
|
1759
|
-
const VERSION = "d9978417e0efd08a87aa592d226979e1";
|
|
1760
|
-
function validate(obj, path = 'ProviderOutputCollectionRepresentation') {
|
|
1761
|
-
const v_error = (() => {
|
|
1762
|
-
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1763
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1764
|
-
}
|
|
1765
|
-
const obj_count = obj.count;
|
|
1766
|
-
const path_count = path + '.count';
|
|
1767
|
-
if (typeof obj_count !== 'number' || (typeof obj_count === 'number' && Math.floor(obj_count) !== obj_count)) {
|
|
1768
|
-
return new TypeError('Expected "integer" but received "' + typeof obj_count + '" (at "' + path_count + '")');
|
|
1769
|
-
}
|
|
1770
|
-
const obj_items = obj.items;
|
|
1771
|
-
const path_items = path + '.items';
|
|
1772
|
-
if (!ArrayIsArray(obj_items)) {
|
|
1773
|
-
return new TypeError('Expected "array" but received "' + typeof obj_items + '" (at "' + path_items + '")');
|
|
1774
|
-
}
|
|
1775
|
-
for (let i = 0; i < obj_items.length; i++) {
|
|
1776
|
-
const obj_items_item = obj_items[i];
|
|
1777
|
-
const path_items_item = path_items + '[' + i + ']';
|
|
1778
|
-
if (typeof obj_items_item !== 'object') {
|
|
1779
|
-
return new TypeError('Expected "object" but received "' + typeof obj_items_item + '" (at "' + path_items_item + '")');
|
|
1780
|
-
}
|
|
1781
|
-
}
|
|
1782
|
-
})();
|
|
1783
|
-
return v_error === undefined ? null : v_error;
|
|
1784
|
-
}
|
|
1785
|
-
const RepresentationType = 'ProviderOutputCollectionRepresentation';
|
|
1786
|
-
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
1787
|
-
const input_items = input.items;
|
|
1788
|
-
const input_items_id = path.fullPath + '__items';
|
|
1789
|
-
for (let i = 0; i < input_items.length; i++) {
|
|
1790
|
-
const input_items_item = input_items[i];
|
|
1791
|
-
let input_items_item_id = input_items_id + '__' + i;
|
|
1792
|
-
input_items[i] = ingest$1(input_items_item, {
|
|
1793
|
-
fullPath: input_items_item_id,
|
|
1794
|
-
propertyName: i,
|
|
1795
|
-
parent: {
|
|
1796
|
-
data: input,
|
|
1797
|
-
key: path.fullPath,
|
|
1798
|
-
existing: existing,
|
|
1799
|
-
},
|
|
1800
|
-
ttl: path.ttl
|
|
1801
|
-
}, luvio, store);
|
|
1802
|
-
}
|
|
1803
|
-
return input;
|
|
1804
|
-
}
|
|
1805
|
-
const select$1 = function ProviderOutputCollectionRepresentationSelect() {
|
|
1806
|
-
return {
|
|
1807
|
-
kind: 'Fragment',
|
|
1808
|
-
version: VERSION,
|
|
1809
|
-
private: [],
|
|
1810
|
-
selections: [
|
|
1811
|
-
{
|
|
1812
|
-
name: 'count',
|
|
1813
|
-
kind: 'Scalar'
|
|
1814
|
-
},
|
|
1815
|
-
{
|
|
1816
|
-
name: 'items',
|
|
1817
|
-
kind: 'Link',
|
|
1818
|
-
plural: true,
|
|
1819
|
-
fragment: select$2()
|
|
1820
|
-
}
|
|
1821
|
-
]
|
|
1822
|
-
};
|
|
1823
|
-
};
|
|
1824
|
-
function equals(existing, incoming) {
|
|
1825
|
-
const existing_count = existing.count;
|
|
1826
|
-
const incoming_count = incoming.count;
|
|
1827
|
-
if (!(existing_count === incoming_count)) {
|
|
1828
|
-
return false;
|
|
1829
|
-
}
|
|
1830
|
-
const existing_items = existing.items;
|
|
1831
|
-
const incoming_items = incoming.items;
|
|
1832
|
-
const equals_items_items = equalsArray(existing_items, incoming_items, (existing_items_item, incoming_items_item) => {
|
|
1833
|
-
if (!(existing_items_item.__ref === incoming_items_item.__ref)) {
|
|
1834
|
-
return false;
|
|
1835
|
-
}
|
|
1836
|
-
});
|
|
1837
|
-
if (equals_items_items === false) {
|
|
1838
|
-
return false;
|
|
1839
|
-
}
|
|
1840
|
-
return true;
|
|
1841
|
-
}
|
|
1842
|
-
const ingest = function ProviderOutputCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1843
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1844
|
-
const validateError = validate(input);
|
|
1845
|
-
if (validateError !== null) {
|
|
1846
|
-
throw validateError;
|
|
1847
|
-
}
|
|
1848
|
-
}
|
|
1849
|
-
const key = path.fullPath;
|
|
1850
|
-
const existingRecord = store.readEntry(key);
|
|
1851
|
-
const ttlToUse = TTL;
|
|
1852
|
-
let incomingRecord = normalize(input, store.readEntry(key), {
|
|
1853
|
-
fullPath: key,
|
|
1854
|
-
parent: path.parent,
|
|
1855
|
-
propertyName: path.propertyName,
|
|
1856
|
-
ttl: ttlToUse
|
|
1857
|
-
}, luvio, store);
|
|
1858
|
-
if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
|
|
1859
|
-
luvio.storePublish(key, incomingRecord);
|
|
1860
|
-
}
|
|
1861
|
-
{
|
|
1862
|
-
const storeMetadataParams = {
|
|
1863
|
-
ttl: ttlToUse,
|
|
1864
|
-
namespace: "extensions",
|
|
1865
|
-
version: VERSION,
|
|
1866
|
-
representationName: RepresentationType,
|
|
1867
|
-
};
|
|
1868
|
-
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
1869
|
-
}
|
|
1870
|
-
return createLink(key);
|
|
1871
|
-
};
|
|
1872
|
-
function getTypeCacheKeys(luvio, input, fullPathFactory) {
|
|
1873
|
-
const rootKeySet = new StoreKeyMap();
|
|
1874
|
-
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1875
|
-
const rootKey = fullPathFactory();
|
|
1876
|
-
rootKeySet.set(rootKey, {
|
|
1877
|
-
namespace: keyPrefix,
|
|
1878
|
-
representationName: RepresentationType,
|
|
1879
|
-
mergeable: false
|
|
1880
|
-
});
|
|
1881
|
-
const input_items_length = input.items.length;
|
|
1882
|
-
for (let i = 0; i < input_items_length; i++) {
|
|
1883
|
-
rootKeySet.merge(getTypeCacheKeys$1(luvio, input.items[i]));
|
|
1884
|
-
}
|
|
1885
|
-
return rootKeySet;
|
|
1758
|
+
const TTL = 60000;
|
|
1759
|
+
const VERSION = "d9978417e0efd08a87aa592d226979e1";
|
|
1760
|
+
function validate(obj, path = 'ProviderOutputCollectionRepresentation') {
|
|
1761
|
+
const v_error = (() => {
|
|
1762
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1763
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1764
|
+
}
|
|
1765
|
+
const obj_count = obj.count;
|
|
1766
|
+
const path_count = path + '.count';
|
|
1767
|
+
if (typeof obj_count !== 'number' || (typeof obj_count === 'number' && Math.floor(obj_count) !== obj_count)) {
|
|
1768
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_count + '" (at "' + path_count + '")');
|
|
1769
|
+
}
|
|
1770
|
+
const obj_items = obj.items;
|
|
1771
|
+
const path_items = path + '.items';
|
|
1772
|
+
if (!ArrayIsArray(obj_items)) {
|
|
1773
|
+
return new TypeError('Expected "array" but received "' + typeof obj_items + '" (at "' + path_items + '")');
|
|
1774
|
+
}
|
|
1775
|
+
for (let i = 0; i < obj_items.length; i++) {
|
|
1776
|
+
const obj_items_item = obj_items[i];
|
|
1777
|
+
const path_items_item = path_items + '[' + i + ']';
|
|
1778
|
+
if (typeof obj_items_item !== 'object') {
|
|
1779
|
+
return new TypeError('Expected "object" but received "' + typeof obj_items_item + '" (at "' + path_items_item + '")');
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
})();
|
|
1783
|
+
return v_error === undefined ? null : v_error;
|
|
1784
|
+
}
|
|
1785
|
+
const RepresentationType = 'ProviderOutputCollectionRepresentation';
|
|
1786
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
1787
|
+
const input_items = input.items;
|
|
1788
|
+
const input_items_id = path.fullPath + '__items';
|
|
1789
|
+
for (let i = 0; i < input_items.length; i++) {
|
|
1790
|
+
const input_items_item = input_items[i];
|
|
1791
|
+
let input_items_item_id = input_items_id + '__' + i;
|
|
1792
|
+
input_items[i] = ingest$1(input_items_item, {
|
|
1793
|
+
fullPath: input_items_item_id,
|
|
1794
|
+
propertyName: i,
|
|
1795
|
+
parent: {
|
|
1796
|
+
data: input,
|
|
1797
|
+
key: path.fullPath,
|
|
1798
|
+
existing: existing,
|
|
1799
|
+
},
|
|
1800
|
+
ttl: path.ttl
|
|
1801
|
+
}, luvio, store);
|
|
1802
|
+
}
|
|
1803
|
+
return input;
|
|
1804
|
+
}
|
|
1805
|
+
const select$1 = function ProviderOutputCollectionRepresentationSelect() {
|
|
1806
|
+
return {
|
|
1807
|
+
kind: 'Fragment',
|
|
1808
|
+
version: VERSION,
|
|
1809
|
+
private: [],
|
|
1810
|
+
selections: [
|
|
1811
|
+
{
|
|
1812
|
+
name: 'count',
|
|
1813
|
+
kind: 'Scalar'
|
|
1814
|
+
},
|
|
1815
|
+
{
|
|
1816
|
+
name: 'items',
|
|
1817
|
+
kind: 'Link',
|
|
1818
|
+
plural: true,
|
|
1819
|
+
fragment: select$2()
|
|
1820
|
+
}
|
|
1821
|
+
]
|
|
1822
|
+
};
|
|
1823
|
+
};
|
|
1824
|
+
function equals(existing, incoming) {
|
|
1825
|
+
const existing_count = existing.count;
|
|
1826
|
+
const incoming_count = incoming.count;
|
|
1827
|
+
if (!(existing_count === incoming_count)) {
|
|
1828
|
+
return false;
|
|
1829
|
+
}
|
|
1830
|
+
const existing_items = existing.items;
|
|
1831
|
+
const incoming_items = incoming.items;
|
|
1832
|
+
const equals_items_items = equalsArray(existing_items, incoming_items, (existing_items_item, incoming_items_item) => {
|
|
1833
|
+
if (!(existing_items_item.__ref === incoming_items_item.__ref)) {
|
|
1834
|
+
return false;
|
|
1835
|
+
}
|
|
1836
|
+
});
|
|
1837
|
+
if (equals_items_items === false) {
|
|
1838
|
+
return false;
|
|
1839
|
+
}
|
|
1840
|
+
return true;
|
|
1841
|
+
}
|
|
1842
|
+
const ingest = function ProviderOutputCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1843
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1844
|
+
const validateError = validate(input);
|
|
1845
|
+
if (validateError !== null) {
|
|
1846
|
+
throw validateError;
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
const key = path.fullPath;
|
|
1850
|
+
const existingRecord = store.readEntry(key);
|
|
1851
|
+
const ttlToUse = TTL;
|
|
1852
|
+
let incomingRecord = normalize(input, store.readEntry(key), {
|
|
1853
|
+
fullPath: key,
|
|
1854
|
+
parent: path.parent,
|
|
1855
|
+
propertyName: path.propertyName,
|
|
1856
|
+
ttl: ttlToUse
|
|
1857
|
+
}, luvio, store);
|
|
1858
|
+
if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
|
|
1859
|
+
luvio.storePublish(key, incomingRecord);
|
|
1860
|
+
}
|
|
1861
|
+
{
|
|
1862
|
+
const storeMetadataParams = {
|
|
1863
|
+
ttl: ttlToUse,
|
|
1864
|
+
namespace: "extensions",
|
|
1865
|
+
version: VERSION,
|
|
1866
|
+
representationName: RepresentationType,
|
|
1867
|
+
};
|
|
1868
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
1869
|
+
}
|
|
1870
|
+
return createLink(key);
|
|
1871
|
+
};
|
|
1872
|
+
function getTypeCacheKeys(luvio, input, fullPathFactory) {
|
|
1873
|
+
const rootKeySet = new StoreKeyMap();
|
|
1874
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1875
|
+
const rootKey = fullPathFactory();
|
|
1876
|
+
rootKeySet.set(rootKey, {
|
|
1877
|
+
namespace: keyPrefix,
|
|
1878
|
+
representationName: RepresentationType,
|
|
1879
|
+
mergeable: false
|
|
1880
|
+
});
|
|
1881
|
+
const input_items_length = input.items.length;
|
|
1882
|
+
for (let i = 0; i < input_items_length; i++) {
|
|
1883
|
+
rootKeySet.merge(getTypeCacheKeys$1(luvio, input.items[i]));
|
|
1884
|
+
}
|
|
1885
|
+
return rootKeySet;
|
|
1886
1886
|
}
|
|
1887
1887
|
|
|
1888
|
-
function select(luvio, params) {
|
|
1889
|
-
return select$1();
|
|
1890
|
-
}
|
|
1891
|
-
function keyBuilder$1(luvio, params) {
|
|
1892
|
-
return keyPrefix + '::ProviderOutputCollectionRepresentation:(' + 'effectiveMappingsWebstoreId:' + params.queryParams.effectiveMappingsWebstoreId + ',' + 'epn:' + params.queryParams.epn + ')';
|
|
1893
|
-
}
|
|
1894
|
-
function getResponseCacheKeys(luvio, resourceParams, response) {
|
|
1895
|
-
return getTypeCacheKeys(luvio, response, () => keyBuilder$1(luvio, resourceParams));
|
|
1896
|
-
}
|
|
1897
|
-
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
1898
|
-
const { body } = response;
|
|
1899
|
-
const key = keyBuilder$1(luvio, resourceParams);
|
|
1900
|
-
luvio.storeIngest(key, ingest, body);
|
|
1901
|
-
const snapshot = luvio.storeLookup({
|
|
1902
|
-
recordId: key,
|
|
1903
|
-
node: select(),
|
|
1904
|
-
variables: {},
|
|
1905
|
-
}, snapshotRefresh);
|
|
1906
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1907
|
-
if (snapshot.state !== 'Fulfilled') {
|
|
1908
|
-
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1909
|
-
}
|
|
1910
|
-
}
|
|
1911
|
-
return snapshot;
|
|
1912
|
-
}
|
|
1913
|
-
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
1914
|
-
const key = keyBuilder$1(luvio, params);
|
|
1915
|
-
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1916
|
-
const storeMetadataParams = {
|
|
1917
|
-
ttl: TTL,
|
|
1918
|
-
namespace: keyPrefix,
|
|
1919
|
-
version: VERSION,
|
|
1920
|
-
representationName: RepresentationType
|
|
1921
|
-
};
|
|
1922
|
-
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
1923
|
-
return errorSnapshot;
|
|
1924
|
-
}
|
|
1925
|
-
function createResourceRequest(config) {
|
|
1926
|
-
const headers = {};
|
|
1927
|
-
return {
|
|
1928
|
-
baseUri: '/services/data/v58.0',
|
|
1929
|
-
basePath: '/commerce/extension/providers',
|
|
1930
|
-
method: 'get',
|
|
1931
|
-
body: null,
|
|
1932
|
-
urlParams: {},
|
|
1933
|
-
queryParams: config.queryParams,
|
|
1934
|
-
headers,
|
|
1935
|
-
priority: 'normal',
|
|
1936
|
-
};
|
|
1888
|
+
function select(luvio, params) {
|
|
1889
|
+
return select$1();
|
|
1890
|
+
}
|
|
1891
|
+
function keyBuilder$1(luvio, params) {
|
|
1892
|
+
return keyPrefix + '::ProviderOutputCollectionRepresentation:(' + 'effectiveMappingsWebstoreId:' + params.queryParams.effectiveMappingsWebstoreId + ',' + 'epn:' + params.queryParams.epn + ')';
|
|
1893
|
+
}
|
|
1894
|
+
function getResponseCacheKeys(luvio, resourceParams, response) {
|
|
1895
|
+
return getTypeCacheKeys(luvio, response, () => keyBuilder$1(luvio, resourceParams));
|
|
1896
|
+
}
|
|
1897
|
+
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
1898
|
+
const { body } = response;
|
|
1899
|
+
const key = keyBuilder$1(luvio, resourceParams);
|
|
1900
|
+
luvio.storeIngest(key, ingest, body);
|
|
1901
|
+
const snapshot = luvio.storeLookup({
|
|
1902
|
+
recordId: key,
|
|
1903
|
+
node: select(),
|
|
1904
|
+
variables: {},
|
|
1905
|
+
}, snapshotRefresh);
|
|
1906
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1907
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1908
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
return snapshot;
|
|
1912
|
+
}
|
|
1913
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
1914
|
+
const key = keyBuilder$1(luvio, params);
|
|
1915
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1916
|
+
const storeMetadataParams = {
|
|
1917
|
+
ttl: TTL,
|
|
1918
|
+
namespace: keyPrefix,
|
|
1919
|
+
version: VERSION,
|
|
1920
|
+
representationName: RepresentationType
|
|
1921
|
+
};
|
|
1922
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
1923
|
+
return errorSnapshot;
|
|
1924
|
+
}
|
|
1925
|
+
function createResourceRequest(config) {
|
|
1926
|
+
const headers = {};
|
|
1927
|
+
return {
|
|
1928
|
+
baseUri: '/services/data/v58.0',
|
|
1929
|
+
basePath: '/commerce/extension/providers',
|
|
1930
|
+
method: 'get',
|
|
1931
|
+
body: null,
|
|
1932
|
+
urlParams: {},
|
|
1933
|
+
queryParams: config.queryParams,
|
|
1934
|
+
headers,
|
|
1935
|
+
priority: 'normal',
|
|
1936
|
+
};
|
|
1937
1937
|
}
|
|
1938
1938
|
|
|
1939
|
-
const getProviders_ConfigPropertyNames = {
|
|
1940
|
-
displayName: 'getProviders',
|
|
1941
|
-
parameters: {
|
|
1942
|
-
required: [],
|
|
1943
|
-
optional: ['effectiveMappingsWebstoreId', 'epn']
|
|
1944
|
-
}
|
|
1945
|
-
};
|
|
1946
|
-
function createResourceParams(config) {
|
|
1947
|
-
const resourceParams = {
|
|
1948
|
-
queryParams: {
|
|
1949
|
-
effectiveMappingsWebstoreId: config.effectiveMappingsWebstoreId, epn: config.epn
|
|
1950
|
-
}
|
|
1951
|
-
};
|
|
1952
|
-
return resourceParams;
|
|
1953
|
-
}
|
|
1954
|
-
function keyBuilder(luvio, config) {
|
|
1955
|
-
const resourceParams = createResourceParams(config);
|
|
1956
|
-
return keyBuilder$1(luvio, resourceParams);
|
|
1957
|
-
}
|
|
1958
|
-
function typeCheckConfig(untrustedConfig) {
|
|
1959
|
-
const config = {};
|
|
1960
|
-
const untrustedConfig_effectiveMappingsWebstoreId = untrustedConfig.effectiveMappingsWebstoreId;
|
|
1961
|
-
if (typeof untrustedConfig_effectiveMappingsWebstoreId === 'string') {
|
|
1962
|
-
config.effectiveMappingsWebstoreId = untrustedConfig_effectiveMappingsWebstoreId;
|
|
1963
|
-
}
|
|
1964
|
-
const untrustedConfig_epn = untrustedConfig.epn;
|
|
1965
|
-
if (typeof untrustedConfig_epn === 'string') {
|
|
1966
|
-
config.epn = untrustedConfig_epn;
|
|
1967
|
-
}
|
|
1968
|
-
return config;
|
|
1969
|
-
}
|
|
1970
|
-
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
1971
|
-
if (!untrustedIsObject(untrustedConfig)) {
|
|
1972
|
-
return null;
|
|
1973
|
-
}
|
|
1974
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1975
|
-
validateConfig(untrustedConfig, configPropertyNames);
|
|
1976
|
-
}
|
|
1977
|
-
const config = typeCheckConfig(untrustedConfig);
|
|
1978
|
-
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1979
|
-
return null;
|
|
1980
|
-
}
|
|
1981
|
-
return config;
|
|
1982
|
-
}
|
|
1983
|
-
function adapterFragment(luvio, config) {
|
|
1984
|
-
createResourceParams(config);
|
|
1985
|
-
return select();
|
|
1986
|
-
}
|
|
1987
|
-
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
1988
|
-
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
1989
|
-
config,
|
|
1990
|
-
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1991
|
-
});
|
|
1992
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
1993
|
-
}
|
|
1994
|
-
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
1995
|
-
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
1996
|
-
config,
|
|
1997
|
-
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1998
|
-
});
|
|
1999
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
2000
|
-
}
|
|
2001
|
-
function buildNetworkSnapshot(luvio, config, options) {
|
|
2002
|
-
const resourceParams = createResourceParams(config);
|
|
2003
|
-
const request = createResourceRequest(resourceParams);
|
|
2004
|
-
return luvio.dispatchResourceRequest(request, options)
|
|
2005
|
-
.then((response) => {
|
|
2006
|
-
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys(luvio, resourceParams, response.body));
|
|
2007
|
-
}, (response) => {
|
|
2008
|
-
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
2009
|
-
});
|
|
2010
|
-
}
|
|
2011
|
-
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
2012
|
-
const { luvio, config } = context;
|
|
2013
|
-
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
2014
|
-
const dispatchOptions = {
|
|
2015
|
-
resourceRequestContext: {
|
|
2016
|
-
requestCorrelator,
|
|
2017
|
-
luvioRequestMethod: undefined,
|
|
2018
|
-
},
|
|
2019
|
-
eventObservers
|
|
2020
|
-
};
|
|
2021
|
-
if (networkPriority !== 'normal') {
|
|
2022
|
-
dispatchOptions.overrides = {
|
|
2023
|
-
priority: networkPriority
|
|
2024
|
-
};
|
|
2025
|
-
}
|
|
2026
|
-
return buildNetworkSnapshot(luvio, config, dispatchOptions);
|
|
2027
|
-
}
|
|
2028
|
-
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
2029
|
-
const { luvio, config } = context;
|
|
2030
|
-
const selector = {
|
|
2031
|
-
recordId: keyBuilder(luvio, config),
|
|
2032
|
-
node: adapterFragment(luvio, config),
|
|
2033
|
-
variables: {},
|
|
2034
|
-
};
|
|
2035
|
-
const cacheSnapshot = storeLookup(selector, {
|
|
2036
|
-
config,
|
|
2037
|
-
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
2038
|
-
});
|
|
2039
|
-
return cacheSnapshot;
|
|
2040
|
-
}
|
|
2041
|
-
const getProvidersAdapterFactory = (luvio) => function extensions__getProviders(untrustedConfig, requestContext) {
|
|
2042
|
-
const config = validateAdapterConfig(untrustedConfig, getProviders_ConfigPropertyNames);
|
|
2043
|
-
// Invalid or incomplete config
|
|
2044
|
-
if (config === null) {
|
|
2045
|
-
return null;
|
|
2046
|
-
}
|
|
2047
|
-
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
2048
|
-
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
1939
|
+
const getProviders_ConfigPropertyNames = {
|
|
1940
|
+
displayName: 'getProviders',
|
|
1941
|
+
parameters: {
|
|
1942
|
+
required: [],
|
|
1943
|
+
optional: ['effectiveMappingsWebstoreId', 'epn']
|
|
1944
|
+
}
|
|
1945
|
+
};
|
|
1946
|
+
function createResourceParams(config) {
|
|
1947
|
+
const resourceParams = {
|
|
1948
|
+
queryParams: {
|
|
1949
|
+
effectiveMappingsWebstoreId: config.effectiveMappingsWebstoreId, epn: config.epn
|
|
1950
|
+
}
|
|
1951
|
+
};
|
|
1952
|
+
return resourceParams;
|
|
1953
|
+
}
|
|
1954
|
+
function keyBuilder(luvio, config) {
|
|
1955
|
+
const resourceParams = createResourceParams(config);
|
|
1956
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
1957
|
+
}
|
|
1958
|
+
function typeCheckConfig(untrustedConfig) {
|
|
1959
|
+
const config = {};
|
|
1960
|
+
const untrustedConfig_effectiveMappingsWebstoreId = untrustedConfig.effectiveMappingsWebstoreId;
|
|
1961
|
+
if (typeof untrustedConfig_effectiveMappingsWebstoreId === 'string') {
|
|
1962
|
+
config.effectiveMappingsWebstoreId = untrustedConfig_effectiveMappingsWebstoreId;
|
|
1963
|
+
}
|
|
1964
|
+
const untrustedConfig_epn = untrustedConfig.epn;
|
|
1965
|
+
if (typeof untrustedConfig_epn === 'string') {
|
|
1966
|
+
config.epn = untrustedConfig_epn;
|
|
1967
|
+
}
|
|
1968
|
+
return config;
|
|
1969
|
+
}
|
|
1970
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
1971
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1972
|
+
return null;
|
|
1973
|
+
}
|
|
1974
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1975
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1976
|
+
}
|
|
1977
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
1978
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1979
|
+
return null;
|
|
1980
|
+
}
|
|
1981
|
+
return config;
|
|
1982
|
+
}
|
|
1983
|
+
function adapterFragment(luvio, config) {
|
|
1984
|
+
createResourceParams(config);
|
|
1985
|
+
return select();
|
|
1986
|
+
}
|
|
1987
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
1988
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
1989
|
+
config,
|
|
1990
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1991
|
+
});
|
|
1992
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1993
|
+
}
|
|
1994
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
1995
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
1996
|
+
config,
|
|
1997
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1998
|
+
});
|
|
1999
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
2000
|
+
}
|
|
2001
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
2002
|
+
const resourceParams = createResourceParams(config);
|
|
2003
|
+
const request = createResourceRequest(resourceParams);
|
|
2004
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
2005
|
+
.then((response) => {
|
|
2006
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys(luvio, resourceParams, response.body));
|
|
2007
|
+
}, (response) => {
|
|
2008
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
2009
|
+
});
|
|
2010
|
+
}
|
|
2011
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
2012
|
+
const { luvio, config } = context;
|
|
2013
|
+
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
2014
|
+
const dispatchOptions = {
|
|
2015
|
+
resourceRequestContext: {
|
|
2016
|
+
requestCorrelator,
|
|
2017
|
+
luvioRequestMethod: undefined,
|
|
2018
|
+
},
|
|
2019
|
+
eventObservers
|
|
2020
|
+
};
|
|
2021
|
+
if (networkPriority !== 'normal') {
|
|
2022
|
+
dispatchOptions.overrides = {
|
|
2023
|
+
priority: networkPriority
|
|
2024
|
+
};
|
|
2025
|
+
}
|
|
2026
|
+
return buildNetworkSnapshot(luvio, config, dispatchOptions);
|
|
2027
|
+
}
|
|
2028
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
2029
|
+
const { luvio, config } = context;
|
|
2030
|
+
const selector = {
|
|
2031
|
+
recordId: keyBuilder(luvio, config),
|
|
2032
|
+
node: adapterFragment(luvio, config),
|
|
2033
|
+
variables: {},
|
|
2034
|
+
};
|
|
2035
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
2036
|
+
config,
|
|
2037
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
2038
|
+
});
|
|
2039
|
+
return cacheSnapshot;
|
|
2040
|
+
}
|
|
2041
|
+
const getProvidersAdapterFactory = (luvio) => function extensions__getProviders(untrustedConfig, requestContext) {
|
|
2042
|
+
const config = validateAdapterConfig(untrustedConfig, getProviders_ConfigPropertyNames);
|
|
2043
|
+
// Invalid or incomplete config
|
|
2044
|
+
if (config === null) {
|
|
2045
|
+
return null;
|
|
2046
|
+
}
|
|
2047
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
2048
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
2049
2049
|
};
|
|
2050
2050
|
|
|
2051
2051
|
export { createMappingAdapterFactory, deleteMappingAdapterFactory, getExtensionsAdapterFactory, getMappingAdapterFactory, getMappingsAdapterFactory, getProvidersAdapterFactory, notifyUpdateAvailableFactory as notifyMappingUpdateAvailableFactory, updateMappingAdapterFactory };
|