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