@salesforce/lds-adapters-industries-contextrules 1.285.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +82 -0
- package/dist/es/es2018/industries-contextrules.js +898 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/createContextTagMapping.d.ts +18 -0
- package/dist/es/es2018/types/src/generated/adapters/deleteContextTagMapping.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/adapters/getContextTagMapping.d.ts +30 -0
- package/dist/es/es2018/types/src/generated/adapters/getContextTagMappings.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/adapters/updateContextTagMapping.d.ts +18 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +5 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +9 -0
- package/dist/es/es2018/types/src/generated/resources/deleteConnectContextRulesContextTagMappingsRuleLibraryApiNameVersionNumberMappingNameByMappingNameAndRuleLibraryApiNameAndVersionNumber.d.ts +14 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectContextRulesContextTagMappingsRuleLibraryApiNameVersionNumberByRuleLibraryApiNameAndVersionNumber.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectContextRulesContextTagMappingsRuleLibraryApiNameVersionNumberMappingNameByMappingNameAndRuleLibraryApiNameAndVersionNumber.d.ts +18 -0
- package/dist/es/es2018/types/src/generated/resources/patchConnectContextRulesContextTagMappingsRuleLibraryApiNameVersionNumberByRuleLibraryApiNameAndVersionNumber.d.ts +17 -0
- package/dist/es/es2018/types/src/generated/resources/postConnectContextRulesContextTagMappingsRuleLibraryApiNameVersionNumberByRuleLibraryApiNameAndVersionNumber.d.ts +17 -0
- package/dist/es/es2018/types/src/generated/types/RuleLibraryTagMappingsCreateUpdateOutputRepresentation.d.ts +38 -0
- package/dist/es/es2018/types/src/generated/types/RuleLibraryTagMappingsInputRepresentation.d.ts +37 -0
- package/dist/es/es2018/types/src/generated/types/RuleLibraryTagMappingsListWrapperRepresentation.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/types/RuleLibraryTagMappingsOverallInputRepresentation.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/types/RuleLibraryTagMappingsReadOutputRepresentation.d.ts +56 -0
- package/dist/es/es2018/types/src/generated/types/RuleLibraryTagMappingsReadOutputRepresentationList.d.ts +30 -0
- package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
- package/package.json +67 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +1004 -0
- package/src/raml/api.raml +178 -0
- package/src/raml/luvio.raml +46 -0
|
@@ -0,0 +1,898 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$2, typeCheckConfig as typeCheckConfig$5, StoreKeyMap, createResourceParams as createResourceParams$5 } from '@luvio/engine';
|
|
8
|
+
|
|
9
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
10
|
+
const { keys: ObjectKeys, create: ObjectCreate } = Object;
|
|
11
|
+
const { isArray: ArrayIsArray$1 } = Array;
|
|
12
|
+
/**
|
|
13
|
+
* Validates an adapter config is well-formed.
|
|
14
|
+
* @param config The config to validate.
|
|
15
|
+
* @param adapter The adapter validation configuration.
|
|
16
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
17
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
18
|
+
*/
|
|
19
|
+
function validateConfig(config, adapter, oneOf) {
|
|
20
|
+
const { displayName } = adapter;
|
|
21
|
+
const { required, optional, unsupported } = adapter.parameters;
|
|
22
|
+
if (config === undefined ||
|
|
23
|
+
required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
24
|
+
throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
|
|
25
|
+
}
|
|
26
|
+
if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
27
|
+
throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
|
|
28
|
+
}
|
|
29
|
+
if (unsupported !== undefined &&
|
|
30
|
+
unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
|
|
31
|
+
throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
|
|
32
|
+
}
|
|
33
|
+
const supported = required.concat(optional);
|
|
34
|
+
if (ObjectKeys(config).some(key => !supported.includes(key))) {
|
|
35
|
+
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function untrustedIsObject(untrusted) {
|
|
39
|
+
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
|
|
40
|
+
}
|
|
41
|
+
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
42
|
+
return configPropertyNames.parameters.required.every(req => req in config);
|
|
43
|
+
}
|
|
44
|
+
const snapshotRefreshOptions = {
|
|
45
|
+
overrides: {
|
|
46
|
+
headers: {
|
|
47
|
+
'Cache-Control': 'no-cache',
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
|
|
52
|
+
return {
|
|
53
|
+
name,
|
|
54
|
+
required,
|
|
55
|
+
resourceType,
|
|
56
|
+
typeCheckShape,
|
|
57
|
+
isArrayShape,
|
|
58
|
+
coerceFn,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function buildAdapterValidationConfig(displayName, paramsMeta) {
|
|
62
|
+
const required = paramsMeta.filter(p => p.required).map(p => p.name);
|
|
63
|
+
const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
|
|
64
|
+
return {
|
|
65
|
+
displayName,
|
|
66
|
+
parameters: {
|
|
67
|
+
required,
|
|
68
|
+
optional,
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const keyPrefix = 'contextrules';
|
|
73
|
+
|
|
74
|
+
const { isArray: ArrayIsArray } = Array;
|
|
75
|
+
const { stringify: JSONStringify } = JSON;
|
|
76
|
+
function createLink(ref) {
|
|
77
|
+
return {
|
|
78
|
+
__ref: serializeStructuredKey(ref),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const TTL$2 = 1000;
|
|
83
|
+
const VERSION$2 = "4b7bef672f4996c31c5a042959681437";
|
|
84
|
+
function validate$3(obj, path = 'RuleLibraryTagMappingsReadOutputRepresentation') {
|
|
85
|
+
const v_error = (() => {
|
|
86
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
87
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
88
|
+
}
|
|
89
|
+
const obj_id = obj.id;
|
|
90
|
+
const path_id = path + '.id';
|
|
91
|
+
if (typeof obj_id !== 'string') {
|
|
92
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
93
|
+
}
|
|
94
|
+
const obj_mappingName = obj.mappingName;
|
|
95
|
+
const path_mappingName = path + '.mappingName';
|
|
96
|
+
if (typeof obj_mappingName !== 'string') {
|
|
97
|
+
return new TypeError('Expected "string" but received "' + typeof obj_mappingName + '" (at "' + path_mappingName + '")');
|
|
98
|
+
}
|
|
99
|
+
const obj_ruleLibraryApiName = obj.ruleLibraryApiName;
|
|
100
|
+
const path_ruleLibraryApiName = path + '.ruleLibraryApiName';
|
|
101
|
+
if (typeof obj_ruleLibraryApiName !== 'string') {
|
|
102
|
+
return new TypeError('Expected "string" but received "' + typeof obj_ruleLibraryApiName + '" (at "' + path_ruleLibraryApiName + '")');
|
|
103
|
+
}
|
|
104
|
+
if (obj.sequenceNumber !== undefined) {
|
|
105
|
+
const obj_sequenceNumber = obj.sequenceNumber;
|
|
106
|
+
const path_sequenceNumber = path + '.sequenceNumber';
|
|
107
|
+
if (typeof obj_sequenceNumber !== 'number' || (typeof obj_sequenceNumber === 'number' && Math.floor(obj_sequenceNumber) !== obj_sequenceNumber)) {
|
|
108
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_sequenceNumber + '" (at "' + path_sequenceNumber + '")');
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const obj_tagName = obj.tagName;
|
|
112
|
+
const path_tagName = path + '.tagName';
|
|
113
|
+
if (typeof obj_tagName !== 'string') {
|
|
114
|
+
return new TypeError('Expected "string" but received "' + typeof obj_tagName + '" (at "' + path_tagName + '")');
|
|
115
|
+
}
|
|
116
|
+
if (obj.usageSubtype !== undefined) {
|
|
117
|
+
const obj_usageSubtype = obj.usageSubtype;
|
|
118
|
+
const path_usageSubtype = path + '.usageSubtype';
|
|
119
|
+
if (typeof obj_usageSubtype !== 'string') {
|
|
120
|
+
return new TypeError('Expected "string" but received "' + typeof obj_usageSubtype + '" (at "' + path_usageSubtype + '")');
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const obj_versionNumber = obj.versionNumber;
|
|
124
|
+
const path_versionNumber = path + '.versionNumber';
|
|
125
|
+
if (typeof obj_versionNumber !== 'number' || (typeof obj_versionNumber === 'number' && Math.floor(obj_versionNumber) !== obj_versionNumber)) {
|
|
126
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_versionNumber + '" (at "' + path_versionNumber + '")');
|
|
127
|
+
}
|
|
128
|
+
})();
|
|
129
|
+
return v_error === undefined ? null : v_error;
|
|
130
|
+
}
|
|
131
|
+
const RepresentationType$2 = 'RuleLibraryTagMappingsReadOutputRepresentation';
|
|
132
|
+
function keyBuilder$6(luvio, config) {
|
|
133
|
+
return keyPrefix + '::' + RepresentationType$2 + ':' + config.id;
|
|
134
|
+
}
|
|
135
|
+
function keyBuilderFromType$1(luvio, object) {
|
|
136
|
+
const keyParams = {
|
|
137
|
+
id: object.mappingName
|
|
138
|
+
};
|
|
139
|
+
return keyBuilder$6(luvio, keyParams);
|
|
140
|
+
}
|
|
141
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
142
|
+
return input;
|
|
143
|
+
}
|
|
144
|
+
const select$6 = function RuleLibraryTagMappingsReadOutputRepresentationSelect() {
|
|
145
|
+
return {
|
|
146
|
+
kind: 'Fragment',
|
|
147
|
+
version: VERSION$2,
|
|
148
|
+
private: [],
|
|
149
|
+
opaque: true
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
function equals$2(existing, incoming) {
|
|
153
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
const ingest$2 = function RuleLibraryTagMappingsReadOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
159
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
160
|
+
const validateError = validate$3(input);
|
|
161
|
+
if (validateError !== null) {
|
|
162
|
+
throw validateError;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
const key = keyBuilderFromType$1(luvio, input);
|
|
166
|
+
const ttlToUse = TTL$2;
|
|
167
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "contextrules", VERSION$2, RepresentationType$2, equals$2);
|
|
168
|
+
return createLink(key);
|
|
169
|
+
};
|
|
170
|
+
function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
|
|
171
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
172
|
+
const rootKey = keyBuilderFromType$1(luvio, input);
|
|
173
|
+
rootKeySet.set(rootKey, {
|
|
174
|
+
namespace: keyPrefix,
|
|
175
|
+
representationName: RepresentationType$2,
|
|
176
|
+
mergeable: false
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const TTL$1 = 1000;
|
|
181
|
+
const VERSION$1 = "3839d94c828e170861b071d1d1fe5292";
|
|
182
|
+
function validate$2(obj, path = 'RuleLibraryTagMappingsReadOutputRepresentationList') {
|
|
183
|
+
const v_error = (() => {
|
|
184
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
185
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
186
|
+
}
|
|
187
|
+
const obj_ruleLibraryTagMappings = obj.ruleLibraryTagMappings;
|
|
188
|
+
const path_ruleLibraryTagMappings = path + '.ruleLibraryTagMappings';
|
|
189
|
+
if (!ArrayIsArray(obj_ruleLibraryTagMappings)) {
|
|
190
|
+
return new TypeError('Expected "array" but received "' + typeof obj_ruleLibraryTagMappings + '" (at "' + path_ruleLibraryTagMappings + '")');
|
|
191
|
+
}
|
|
192
|
+
for (let i = 0; i < obj_ruleLibraryTagMappings.length; i++) {
|
|
193
|
+
const obj_ruleLibraryTagMappings_item = obj_ruleLibraryTagMappings[i];
|
|
194
|
+
const path_ruleLibraryTagMappings_item = path_ruleLibraryTagMappings + '[' + i + ']';
|
|
195
|
+
const referencepath_ruleLibraryTagMappings_itemValidationError = validate$3(obj_ruleLibraryTagMappings_item, path_ruleLibraryTagMappings_item);
|
|
196
|
+
if (referencepath_ruleLibraryTagMappings_itemValidationError !== null) {
|
|
197
|
+
let message = 'Object doesn\'t match RuleLibraryTagMappingsReadOutputRepresentation (at "' + path_ruleLibraryTagMappings_item + '")\n';
|
|
198
|
+
message += referencepath_ruleLibraryTagMappings_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
199
|
+
return new TypeError(message);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
})();
|
|
203
|
+
return v_error === undefined ? null : v_error;
|
|
204
|
+
}
|
|
205
|
+
const RepresentationType$1 = 'RuleLibraryTagMappingsReadOutputRepresentationList';
|
|
206
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
207
|
+
return input;
|
|
208
|
+
}
|
|
209
|
+
const select$5 = function RuleLibraryTagMappingsReadOutputRepresentationListSelect() {
|
|
210
|
+
return {
|
|
211
|
+
kind: 'Fragment',
|
|
212
|
+
version: VERSION$1,
|
|
213
|
+
private: [],
|
|
214
|
+
opaque: true
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
function equals$1(existing, incoming) {
|
|
218
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
return true;
|
|
222
|
+
}
|
|
223
|
+
const ingest$1 = function RuleLibraryTagMappingsReadOutputRepresentationListIngest(input, path, luvio, store, timestamp) {
|
|
224
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
225
|
+
const validateError = validate$2(input);
|
|
226
|
+
if (validateError !== null) {
|
|
227
|
+
throw validateError;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
const key = path.fullPath;
|
|
231
|
+
const ttlToUse = TTL$1;
|
|
232
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "contextrules", VERSION$1, RepresentationType$1, equals$1);
|
|
233
|
+
return createLink(key);
|
|
234
|
+
};
|
|
235
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
236
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
237
|
+
const rootKey = fullPathFactory();
|
|
238
|
+
rootKeySet.set(rootKey, {
|
|
239
|
+
namespace: keyPrefix,
|
|
240
|
+
representationName: RepresentationType$1,
|
|
241
|
+
mergeable: false
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function select$4(luvio, params) {
|
|
246
|
+
return select$5();
|
|
247
|
+
}
|
|
248
|
+
function keyBuilder$5(luvio, params) {
|
|
249
|
+
return keyPrefix + '::RuleLibraryTagMappingsReadOutputRepresentationList:(' + 'ruleLibraryApiName:' + params.urlParams.ruleLibraryApiName + ',' + 'versionNumber:' + params.urlParams.versionNumber + ')';
|
|
250
|
+
}
|
|
251
|
+
function getResponseCacheKeys$4(storeKeyMap, luvio, resourceParams, response) {
|
|
252
|
+
getTypeCacheKeys$1(storeKeyMap, luvio, response, () => keyBuilder$5(luvio, resourceParams));
|
|
253
|
+
}
|
|
254
|
+
function ingestSuccess$3(luvio, resourceParams, response, snapshotRefresh) {
|
|
255
|
+
const { body } = response;
|
|
256
|
+
const key = keyBuilder$5(luvio, resourceParams);
|
|
257
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
258
|
+
const snapshot = luvio.storeLookup({
|
|
259
|
+
recordId: key,
|
|
260
|
+
node: select$4(),
|
|
261
|
+
variables: {},
|
|
262
|
+
}, snapshotRefresh);
|
|
263
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
264
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
265
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
deepFreeze(snapshot.data);
|
|
269
|
+
return snapshot;
|
|
270
|
+
}
|
|
271
|
+
function ingestError$1(luvio, params, error, snapshotRefresh) {
|
|
272
|
+
const key = keyBuilder$5(luvio, params);
|
|
273
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
274
|
+
const storeMetadataParams = {
|
|
275
|
+
ttl: TTL$1,
|
|
276
|
+
namespace: keyPrefix,
|
|
277
|
+
version: VERSION$1,
|
|
278
|
+
representationName: RepresentationType$1
|
|
279
|
+
};
|
|
280
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
281
|
+
return errorSnapshot;
|
|
282
|
+
}
|
|
283
|
+
function createResourceRequest$4(config) {
|
|
284
|
+
const headers = {};
|
|
285
|
+
return {
|
|
286
|
+
baseUri: '/services/data/v61.0',
|
|
287
|
+
basePath: '/connect/context-rules/context-tag-mappings/rule-library-api-name/' + config.urlParams.ruleLibraryApiName + '/version-number/' + config.urlParams.versionNumber + '',
|
|
288
|
+
method: 'get',
|
|
289
|
+
body: null,
|
|
290
|
+
urlParams: config.urlParams,
|
|
291
|
+
queryParams: {},
|
|
292
|
+
headers,
|
|
293
|
+
priority: 'normal',
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const adapterName$4 = 'getContextTagMappings';
|
|
298
|
+
const getContextTagMappings_ConfigPropertyMetadata = [
|
|
299
|
+
generateParamConfigMetadata('ruleLibraryApiName', true, 0 /* UrlParameter */, 0 /* String */),
|
|
300
|
+
generateParamConfigMetadata('versionNumber', true, 0 /* UrlParameter */, 0 /* String */),
|
|
301
|
+
];
|
|
302
|
+
const getContextTagMappings_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$4, getContextTagMappings_ConfigPropertyMetadata);
|
|
303
|
+
const createResourceParams$4 = /*#__PURE__*/ createResourceParams$5(getContextTagMappings_ConfigPropertyMetadata);
|
|
304
|
+
function keyBuilder$4(luvio, config) {
|
|
305
|
+
const resourceParams = createResourceParams$4(config);
|
|
306
|
+
return keyBuilder$5(luvio, resourceParams);
|
|
307
|
+
}
|
|
308
|
+
function typeCheckConfig$4(untrustedConfig) {
|
|
309
|
+
const config = {};
|
|
310
|
+
typeCheckConfig$5(untrustedConfig, config, getContextTagMappings_ConfigPropertyMetadata);
|
|
311
|
+
return config;
|
|
312
|
+
}
|
|
313
|
+
function validateAdapterConfig$4(untrustedConfig, configPropertyNames) {
|
|
314
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
317
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
318
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
319
|
+
}
|
|
320
|
+
const config = typeCheckConfig$4(untrustedConfig);
|
|
321
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
322
|
+
return null;
|
|
323
|
+
}
|
|
324
|
+
return config;
|
|
325
|
+
}
|
|
326
|
+
function adapterFragment$1(luvio, config) {
|
|
327
|
+
createResourceParams$4(config);
|
|
328
|
+
return select$4();
|
|
329
|
+
}
|
|
330
|
+
function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
|
|
331
|
+
const snapshot = ingestSuccess$3(luvio, resourceParams, response, {
|
|
332
|
+
config,
|
|
333
|
+
resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
|
|
334
|
+
});
|
|
335
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
336
|
+
}
|
|
337
|
+
function onFetchResponseError$1(luvio, config, resourceParams, response) {
|
|
338
|
+
const snapshot = ingestError$1(luvio, resourceParams, response, {
|
|
339
|
+
config,
|
|
340
|
+
resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
|
|
341
|
+
});
|
|
342
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
343
|
+
}
|
|
344
|
+
function buildNetworkSnapshot$4(luvio, config, options) {
|
|
345
|
+
const resourceParams = createResourceParams$4(config);
|
|
346
|
+
const request = createResourceRequest$4(resourceParams);
|
|
347
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
348
|
+
.then((response) => {
|
|
349
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
|
|
350
|
+
const cache = new StoreKeyMap();
|
|
351
|
+
getResponseCacheKeys$4(cache, luvio, resourceParams, response.body);
|
|
352
|
+
return cache;
|
|
353
|
+
});
|
|
354
|
+
}, (response) => {
|
|
355
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
|
|
359
|
+
return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$4, undefined, false);
|
|
360
|
+
}
|
|
361
|
+
function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
|
|
362
|
+
const { luvio, config } = context;
|
|
363
|
+
const selector = {
|
|
364
|
+
recordId: keyBuilder$4(luvio, config),
|
|
365
|
+
node: adapterFragment$1(luvio, config),
|
|
366
|
+
variables: {},
|
|
367
|
+
};
|
|
368
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
369
|
+
config,
|
|
370
|
+
resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
|
|
371
|
+
});
|
|
372
|
+
return cacheSnapshot;
|
|
373
|
+
}
|
|
374
|
+
const getContextTagMappingsAdapterFactory = (luvio) => function contextrules__getContextTagMappings(untrustedConfig, requestContext) {
|
|
375
|
+
const config = validateAdapterConfig$4(untrustedConfig, getContextTagMappings_ConfigPropertyNames);
|
|
376
|
+
// Invalid or incomplete config
|
|
377
|
+
if (config === null) {
|
|
378
|
+
return null;
|
|
379
|
+
}
|
|
380
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
381
|
+
buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
function validate$1(obj, path = 'RuleLibraryTagMappingsListWrapperRepresentation') {
|
|
385
|
+
const v_error = (() => {
|
|
386
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
387
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
388
|
+
}
|
|
389
|
+
const obj_ruleLibraryTagMappingInputList = obj.ruleLibraryTagMappingInputList;
|
|
390
|
+
const path_ruleLibraryTagMappingInputList = path + '.ruleLibraryTagMappingInputList';
|
|
391
|
+
if (!ArrayIsArray(obj_ruleLibraryTagMappingInputList)) {
|
|
392
|
+
return new TypeError('Expected "array" but received "' + typeof obj_ruleLibraryTagMappingInputList + '" (at "' + path_ruleLibraryTagMappingInputList + '")');
|
|
393
|
+
}
|
|
394
|
+
for (let i = 0; i < obj_ruleLibraryTagMappingInputList.length; i++) {
|
|
395
|
+
const obj_ruleLibraryTagMappingInputList_item = obj_ruleLibraryTagMappingInputList[i];
|
|
396
|
+
const path_ruleLibraryTagMappingInputList_item = path_ruleLibraryTagMappingInputList + '[' + i + ']';
|
|
397
|
+
if (obj_ruleLibraryTagMappingInputList_item === undefined) {
|
|
398
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_ruleLibraryTagMappingInputList_item + '" (at "' + path_ruleLibraryTagMappingInputList_item + '")');
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
})();
|
|
402
|
+
return v_error === undefined ? null : v_error;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
const TTL = 1000;
|
|
406
|
+
const VERSION = "7dab3fcadff55a173b214b22d1670519";
|
|
407
|
+
function validate(obj, path = 'RuleLibraryTagMappingsCreateUpdateOutputRepresentation') {
|
|
408
|
+
const v_error = (() => {
|
|
409
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
410
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
411
|
+
}
|
|
412
|
+
const obj_ids = obj.ids;
|
|
413
|
+
const path_ids = path + '.ids';
|
|
414
|
+
if (!ArrayIsArray(obj_ids)) {
|
|
415
|
+
return new TypeError('Expected "array" but received "' + typeof obj_ids + '" (at "' + path_ids + '")');
|
|
416
|
+
}
|
|
417
|
+
for (let i = 0; i < obj_ids.length; i++) {
|
|
418
|
+
const obj_ids_item = obj_ids[i];
|
|
419
|
+
const path_ids_item = path_ids + '[' + i + ']';
|
|
420
|
+
if (typeof obj_ids_item !== 'string') {
|
|
421
|
+
return new TypeError('Expected "string" but received "' + typeof obj_ids_item + '" (at "' + path_ids_item + '")');
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
})();
|
|
425
|
+
return v_error === undefined ? null : v_error;
|
|
426
|
+
}
|
|
427
|
+
const RepresentationType = 'RuleLibraryTagMappingsCreateUpdateOutputRepresentation';
|
|
428
|
+
function keyBuilder$3(luvio, config) {
|
|
429
|
+
return keyPrefix + '::' + RepresentationType + ':' + '[' + config.id.join(',') + ']';
|
|
430
|
+
}
|
|
431
|
+
function keyBuilderFromType(luvio, object) {
|
|
432
|
+
const keyParams = {
|
|
433
|
+
id: object.ids
|
|
434
|
+
};
|
|
435
|
+
return keyBuilder$3(luvio, keyParams);
|
|
436
|
+
}
|
|
437
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
438
|
+
return input;
|
|
439
|
+
}
|
|
440
|
+
const select$3 = function RuleLibraryTagMappingsCreateUpdateOutputRepresentationSelect() {
|
|
441
|
+
return {
|
|
442
|
+
kind: 'Fragment',
|
|
443
|
+
version: VERSION,
|
|
444
|
+
private: [],
|
|
445
|
+
opaque: true
|
|
446
|
+
};
|
|
447
|
+
};
|
|
448
|
+
function equals(existing, incoming) {
|
|
449
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
450
|
+
return false;
|
|
451
|
+
}
|
|
452
|
+
return true;
|
|
453
|
+
}
|
|
454
|
+
const ingest = function RuleLibraryTagMappingsCreateUpdateOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
455
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
456
|
+
const validateError = validate(input);
|
|
457
|
+
if (validateError !== null) {
|
|
458
|
+
throw validateError;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
const key = keyBuilderFromType(luvio, input);
|
|
462
|
+
const ttlToUse = TTL;
|
|
463
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "contextrules", VERSION, RepresentationType, equals);
|
|
464
|
+
return createLink(key);
|
|
465
|
+
};
|
|
466
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
467
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
468
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
469
|
+
rootKeySet.set(rootKey, {
|
|
470
|
+
namespace: keyPrefix,
|
|
471
|
+
representationName: RepresentationType,
|
|
472
|
+
mergeable: false
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
function select$2(luvio, params) {
|
|
477
|
+
return select$3();
|
|
478
|
+
}
|
|
479
|
+
function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
|
|
480
|
+
getTypeCacheKeys(storeKeyMap, luvio, response);
|
|
481
|
+
}
|
|
482
|
+
function ingestSuccess$2(luvio, resourceParams, response) {
|
|
483
|
+
const { body } = response;
|
|
484
|
+
const key = keyBuilderFromType(luvio, body);
|
|
485
|
+
luvio.storeIngest(key, ingest, body);
|
|
486
|
+
const snapshot = luvio.storeLookup({
|
|
487
|
+
recordId: key,
|
|
488
|
+
node: select$2(),
|
|
489
|
+
variables: {},
|
|
490
|
+
});
|
|
491
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
492
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
493
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
deepFreeze(snapshot.data);
|
|
497
|
+
return snapshot;
|
|
498
|
+
}
|
|
499
|
+
function createResourceRequest$3(config) {
|
|
500
|
+
const headers = {};
|
|
501
|
+
return {
|
|
502
|
+
baseUri: '/services/data/v61.0',
|
|
503
|
+
basePath: '/connect/context-rules/context-tag-mappings/rule-library-api-name/' + config.urlParams.ruleLibraryApiName + '/version-number/' + config.urlParams.versionNumber + '',
|
|
504
|
+
method: 'patch',
|
|
505
|
+
body: config.body,
|
|
506
|
+
urlParams: config.urlParams,
|
|
507
|
+
queryParams: {},
|
|
508
|
+
headers,
|
|
509
|
+
priority: 'normal',
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
const adapterName$3 = 'updateContextTagMapping';
|
|
514
|
+
const updateContextTagMapping_ConfigPropertyMetadata = [
|
|
515
|
+
generateParamConfigMetadata('ruleLibraryApiName', true, 0 /* UrlParameter */, 0 /* String */),
|
|
516
|
+
generateParamConfigMetadata('versionNumber', true, 0 /* UrlParameter */, 0 /* String */),
|
|
517
|
+
generateParamConfigMetadata('contextTagMappings', true, 2 /* Body */, 4 /* Unsupported */),
|
|
518
|
+
];
|
|
519
|
+
const updateContextTagMapping_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, updateContextTagMapping_ConfigPropertyMetadata);
|
|
520
|
+
const createResourceParams$3 = /*#__PURE__*/ createResourceParams$5(updateContextTagMapping_ConfigPropertyMetadata);
|
|
521
|
+
function typeCheckConfig$3(untrustedConfig) {
|
|
522
|
+
const config = {};
|
|
523
|
+
typeCheckConfig$5(untrustedConfig, config, updateContextTagMapping_ConfigPropertyMetadata);
|
|
524
|
+
const untrustedConfig_contextTagMappings = untrustedConfig.contextTagMappings;
|
|
525
|
+
const referenceRuleLibraryTagMappingsListWrapperRepresentationValidationError = validate$1(untrustedConfig_contextTagMappings);
|
|
526
|
+
if (referenceRuleLibraryTagMappingsListWrapperRepresentationValidationError === null) {
|
|
527
|
+
config.contextTagMappings = untrustedConfig_contextTagMappings;
|
|
528
|
+
}
|
|
529
|
+
return config;
|
|
530
|
+
}
|
|
531
|
+
function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
|
|
532
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
533
|
+
return null;
|
|
534
|
+
}
|
|
535
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
536
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
537
|
+
}
|
|
538
|
+
const config = typeCheckConfig$3(untrustedConfig);
|
|
539
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
540
|
+
return null;
|
|
541
|
+
}
|
|
542
|
+
return config;
|
|
543
|
+
}
|
|
544
|
+
function buildNetworkSnapshot$3(luvio, config, options) {
|
|
545
|
+
const resourceParams = createResourceParams$3(config);
|
|
546
|
+
const request = createResourceRequest$3(resourceParams);
|
|
547
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
548
|
+
.then((response) => {
|
|
549
|
+
return luvio.handleSuccessResponse(() => {
|
|
550
|
+
const snapshot = ingestSuccess$2(luvio, resourceParams, response);
|
|
551
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
552
|
+
}, () => {
|
|
553
|
+
const cache = new StoreKeyMap();
|
|
554
|
+
getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
|
|
555
|
+
return cache;
|
|
556
|
+
});
|
|
557
|
+
}, (response) => {
|
|
558
|
+
deepFreeze(response);
|
|
559
|
+
throw response;
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
const updateContextTagMappingAdapterFactory = (luvio) => {
|
|
563
|
+
return function updateContextTagMapping(untrustedConfig) {
|
|
564
|
+
const config = validateAdapterConfig$3(untrustedConfig, updateContextTagMapping_ConfigPropertyNames);
|
|
565
|
+
// Invalid or incomplete config
|
|
566
|
+
if (config === null) {
|
|
567
|
+
throw new Error('Invalid config for "updateContextTagMapping"');
|
|
568
|
+
}
|
|
569
|
+
return buildNetworkSnapshot$3(luvio, config);
|
|
570
|
+
};
|
|
571
|
+
};
|
|
572
|
+
|
|
573
|
+
function select$1(luvio, params) {
|
|
574
|
+
return select$3();
|
|
575
|
+
}
|
|
576
|
+
function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
|
|
577
|
+
getTypeCacheKeys(storeKeyMap, luvio, response);
|
|
578
|
+
}
|
|
579
|
+
function ingestSuccess$1(luvio, resourceParams, response) {
|
|
580
|
+
const { body } = response;
|
|
581
|
+
const key = keyBuilderFromType(luvio, body);
|
|
582
|
+
luvio.storeIngest(key, ingest, body);
|
|
583
|
+
const snapshot = luvio.storeLookup({
|
|
584
|
+
recordId: key,
|
|
585
|
+
node: select$1(),
|
|
586
|
+
variables: {},
|
|
587
|
+
});
|
|
588
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
589
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
590
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
deepFreeze(snapshot.data);
|
|
594
|
+
return snapshot;
|
|
595
|
+
}
|
|
596
|
+
function createResourceRequest$2(config) {
|
|
597
|
+
const headers = {};
|
|
598
|
+
return {
|
|
599
|
+
baseUri: '/services/data/v61.0',
|
|
600
|
+
basePath: '/connect/context-rules/context-tag-mappings/rule-library-api-name/' + config.urlParams.ruleLibraryApiName + '/version-number/' + config.urlParams.versionNumber + '',
|
|
601
|
+
method: 'post',
|
|
602
|
+
body: config.body,
|
|
603
|
+
urlParams: config.urlParams,
|
|
604
|
+
queryParams: {},
|
|
605
|
+
headers,
|
|
606
|
+
priority: 'normal',
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
const adapterName$2 = 'createContextTagMapping';
|
|
611
|
+
const createContextTagMapping_ConfigPropertyMetadata = [
|
|
612
|
+
generateParamConfigMetadata('ruleLibraryApiName', true, 0 /* UrlParameter */, 0 /* String */),
|
|
613
|
+
generateParamConfigMetadata('versionNumber', true, 0 /* UrlParameter */, 0 /* String */),
|
|
614
|
+
generateParamConfigMetadata('contextTagMappings', true, 2 /* Body */, 4 /* Unsupported */),
|
|
615
|
+
];
|
|
616
|
+
const createContextTagMapping_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, createContextTagMapping_ConfigPropertyMetadata);
|
|
617
|
+
const createResourceParams$2 = /*#__PURE__*/ createResourceParams$5(createContextTagMapping_ConfigPropertyMetadata);
|
|
618
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
619
|
+
const config = {};
|
|
620
|
+
typeCheckConfig$5(untrustedConfig, config, createContextTagMapping_ConfigPropertyMetadata);
|
|
621
|
+
const untrustedConfig_contextTagMappings = untrustedConfig.contextTagMappings;
|
|
622
|
+
const referenceRuleLibraryTagMappingsListWrapperRepresentationValidationError = validate$1(untrustedConfig_contextTagMappings);
|
|
623
|
+
if (referenceRuleLibraryTagMappingsListWrapperRepresentationValidationError === null) {
|
|
624
|
+
config.contextTagMappings = untrustedConfig_contextTagMappings;
|
|
625
|
+
}
|
|
626
|
+
return config;
|
|
627
|
+
}
|
|
628
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
629
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
630
|
+
return null;
|
|
631
|
+
}
|
|
632
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
633
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
634
|
+
}
|
|
635
|
+
const config = typeCheckConfig$2(untrustedConfig);
|
|
636
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
637
|
+
return null;
|
|
638
|
+
}
|
|
639
|
+
return config;
|
|
640
|
+
}
|
|
641
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
642
|
+
const resourceParams = createResourceParams$2(config);
|
|
643
|
+
const request = createResourceRequest$2(resourceParams);
|
|
644
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
645
|
+
.then((response) => {
|
|
646
|
+
return luvio.handleSuccessResponse(() => {
|
|
647
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response);
|
|
648
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
649
|
+
}, () => {
|
|
650
|
+
const cache = new StoreKeyMap();
|
|
651
|
+
getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
|
|
652
|
+
return cache;
|
|
653
|
+
});
|
|
654
|
+
}, (response) => {
|
|
655
|
+
deepFreeze(response);
|
|
656
|
+
throw response;
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
const createContextTagMappingAdapterFactory = (luvio) => {
|
|
660
|
+
return function createContextTagMapping(untrustedConfig) {
|
|
661
|
+
const config = validateAdapterConfig$2(untrustedConfig, createContextTagMapping_ConfigPropertyNames);
|
|
662
|
+
// Invalid or incomplete config
|
|
663
|
+
if (config === null) {
|
|
664
|
+
throw new Error('Invalid config for "createContextTagMapping"');
|
|
665
|
+
}
|
|
666
|
+
return buildNetworkSnapshot$2(luvio, config);
|
|
667
|
+
};
|
|
668
|
+
};
|
|
669
|
+
|
|
670
|
+
function keyBuilder$2(luvio, params) {
|
|
671
|
+
return keyBuilder$6(luvio, {
|
|
672
|
+
id: params.urlParams.mappingName
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
function getResponseCacheKeys$1(cacheKeyMap, luvio, resourceParams) {
|
|
676
|
+
const key = keyBuilder$2(luvio, resourceParams);
|
|
677
|
+
cacheKeyMap.set(key, {
|
|
678
|
+
namespace: keyPrefix,
|
|
679
|
+
representationName: RepresentationType$2,
|
|
680
|
+
mergeable: false
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
function evictSuccess(luvio, resourceParams) {
|
|
684
|
+
const key = keyBuilder$2(luvio, resourceParams);
|
|
685
|
+
luvio.storeEvict(key);
|
|
686
|
+
}
|
|
687
|
+
function createResourceRequest$1(config) {
|
|
688
|
+
const headers = {};
|
|
689
|
+
return {
|
|
690
|
+
baseUri: '/services/data/v61.0',
|
|
691
|
+
basePath: '/connect/context-rules/context-tag-mappings/rule-library-api-name/' + config.urlParams.ruleLibraryApiName + '/version-number/' + config.urlParams.versionNumber + '/mapping-name/' + config.urlParams.mappingName + '',
|
|
692
|
+
method: 'delete',
|
|
693
|
+
body: null,
|
|
694
|
+
urlParams: config.urlParams,
|
|
695
|
+
queryParams: {},
|
|
696
|
+
headers,
|
|
697
|
+
priority: 'normal',
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
const adapterName$1 = 'deleteContextTagMapping';
|
|
702
|
+
const deleteContextTagMapping_ConfigPropertyMetadata = [
|
|
703
|
+
generateParamConfigMetadata('mappingName', true, 0 /* UrlParameter */, 0 /* String */),
|
|
704
|
+
generateParamConfigMetadata('ruleLibraryApiName', true, 0 /* UrlParameter */, 0 /* String */),
|
|
705
|
+
generateParamConfigMetadata('versionNumber', true, 0 /* UrlParameter */, 0 /* String */),
|
|
706
|
+
];
|
|
707
|
+
const deleteContextTagMapping_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, deleteContextTagMapping_ConfigPropertyMetadata);
|
|
708
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$5(deleteContextTagMapping_ConfigPropertyMetadata);
|
|
709
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
710
|
+
const config = {};
|
|
711
|
+
typeCheckConfig$5(untrustedConfig, config, deleteContextTagMapping_ConfigPropertyMetadata);
|
|
712
|
+
return config;
|
|
713
|
+
}
|
|
714
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
715
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
716
|
+
return null;
|
|
717
|
+
}
|
|
718
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
719
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
720
|
+
}
|
|
721
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
722
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
723
|
+
return null;
|
|
724
|
+
}
|
|
725
|
+
return config;
|
|
726
|
+
}
|
|
727
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
728
|
+
const resourceParams = createResourceParams$1(config);
|
|
729
|
+
const request = createResourceRequest$1(resourceParams);
|
|
730
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
731
|
+
.then(() => {
|
|
732
|
+
return luvio.handleSuccessResponse(() => {
|
|
733
|
+
evictSuccess(luvio, resourceParams);
|
|
734
|
+
return luvio.storeBroadcast();
|
|
735
|
+
}, () => {
|
|
736
|
+
const cache = new StoreKeyMap();
|
|
737
|
+
getResponseCacheKeys$1(cache, luvio, resourceParams);
|
|
738
|
+
return cache;
|
|
739
|
+
});
|
|
740
|
+
}, (response) => {
|
|
741
|
+
deepFreeze(response);
|
|
742
|
+
throw response;
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
const deleteContextTagMappingAdapterFactory = (luvio) => {
|
|
746
|
+
return function contextrulesdeleteContextTagMapping(untrustedConfig) {
|
|
747
|
+
const config = validateAdapterConfig$1(untrustedConfig, deleteContextTagMapping_ConfigPropertyNames);
|
|
748
|
+
// Invalid or incomplete config
|
|
749
|
+
if (config === null) {
|
|
750
|
+
throw new Error(`Invalid config for "${adapterName$1}"`);
|
|
751
|
+
}
|
|
752
|
+
return buildNetworkSnapshot$1(luvio, config);
|
|
753
|
+
};
|
|
754
|
+
};
|
|
755
|
+
|
|
756
|
+
function select(luvio, params) {
|
|
757
|
+
return select$6();
|
|
758
|
+
}
|
|
759
|
+
function keyBuilder$1(luvio, params) {
|
|
760
|
+
return keyBuilder$6(luvio, {
|
|
761
|
+
id: params.urlParams.mappingName
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
765
|
+
getTypeCacheKeys$2(storeKeyMap, luvio, response);
|
|
766
|
+
}
|
|
767
|
+
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
768
|
+
const { body } = response;
|
|
769
|
+
const key = keyBuilder$1(luvio, resourceParams);
|
|
770
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
771
|
+
const snapshot = luvio.storeLookup({
|
|
772
|
+
recordId: key,
|
|
773
|
+
node: select(),
|
|
774
|
+
variables: {},
|
|
775
|
+
}, snapshotRefresh);
|
|
776
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
777
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
778
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
deepFreeze(snapshot.data);
|
|
782
|
+
return snapshot;
|
|
783
|
+
}
|
|
784
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
785
|
+
const key = keyBuilder$1(luvio, params);
|
|
786
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
787
|
+
const storeMetadataParams = {
|
|
788
|
+
ttl: TTL$2,
|
|
789
|
+
namespace: keyPrefix,
|
|
790
|
+
version: VERSION$2,
|
|
791
|
+
representationName: RepresentationType$2
|
|
792
|
+
};
|
|
793
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
794
|
+
return errorSnapshot;
|
|
795
|
+
}
|
|
796
|
+
function createResourceRequest(config) {
|
|
797
|
+
const headers = {};
|
|
798
|
+
return {
|
|
799
|
+
baseUri: '/services/data/v61.0',
|
|
800
|
+
basePath: '/connect/context-rules/context-tag-mappings/rule-library-api-name/' + config.urlParams.ruleLibraryApiName + '/version-number/' + config.urlParams.versionNumber + '/mapping-name/' + config.urlParams.mappingName + '',
|
|
801
|
+
method: 'get',
|
|
802
|
+
body: null,
|
|
803
|
+
urlParams: config.urlParams,
|
|
804
|
+
queryParams: {},
|
|
805
|
+
headers,
|
|
806
|
+
priority: 'normal',
|
|
807
|
+
};
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
const adapterName = 'getContextTagMapping';
|
|
811
|
+
const getContextTagMapping_ConfigPropertyMetadata = [
|
|
812
|
+
generateParamConfigMetadata('mappingName', true, 0 /* UrlParameter */, 0 /* String */),
|
|
813
|
+
generateParamConfigMetadata('ruleLibraryApiName', true, 0 /* UrlParameter */, 0 /* String */),
|
|
814
|
+
generateParamConfigMetadata('versionNumber', true, 0 /* UrlParameter */, 0 /* String */),
|
|
815
|
+
];
|
|
816
|
+
const getContextTagMapping_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getContextTagMapping_ConfigPropertyMetadata);
|
|
817
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$5(getContextTagMapping_ConfigPropertyMetadata);
|
|
818
|
+
function keyBuilder(luvio, config) {
|
|
819
|
+
const resourceParams = createResourceParams(config);
|
|
820
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
821
|
+
}
|
|
822
|
+
function typeCheckConfig(untrustedConfig) {
|
|
823
|
+
const config = {};
|
|
824
|
+
typeCheckConfig$5(untrustedConfig, config, getContextTagMapping_ConfigPropertyMetadata);
|
|
825
|
+
return config;
|
|
826
|
+
}
|
|
827
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
828
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
829
|
+
return null;
|
|
830
|
+
}
|
|
831
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
832
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
833
|
+
}
|
|
834
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
835
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
836
|
+
return null;
|
|
837
|
+
}
|
|
838
|
+
return config;
|
|
839
|
+
}
|
|
840
|
+
function adapterFragment(luvio, config) {
|
|
841
|
+
createResourceParams(config);
|
|
842
|
+
return select();
|
|
843
|
+
}
|
|
844
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
845
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
846
|
+
config,
|
|
847
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
848
|
+
});
|
|
849
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
850
|
+
}
|
|
851
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
852
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
853
|
+
config,
|
|
854
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
855
|
+
});
|
|
856
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
857
|
+
}
|
|
858
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
859
|
+
const resourceParams = createResourceParams(config);
|
|
860
|
+
const request = createResourceRequest(resourceParams);
|
|
861
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
862
|
+
.then((response) => {
|
|
863
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
864
|
+
const cache = new StoreKeyMap();
|
|
865
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
866
|
+
return cache;
|
|
867
|
+
});
|
|
868
|
+
}, (response) => {
|
|
869
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
873
|
+
return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
|
|
874
|
+
}
|
|
875
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
876
|
+
const { luvio, config } = context;
|
|
877
|
+
const selector = {
|
|
878
|
+
recordId: keyBuilder(luvio, config),
|
|
879
|
+
node: adapterFragment(luvio, config),
|
|
880
|
+
variables: {},
|
|
881
|
+
};
|
|
882
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
883
|
+
config,
|
|
884
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
885
|
+
});
|
|
886
|
+
return cacheSnapshot;
|
|
887
|
+
}
|
|
888
|
+
const getContextTagMappingAdapterFactory = (luvio) => function contextrules__getContextTagMapping(untrustedConfig, requestContext) {
|
|
889
|
+
const config = validateAdapterConfig(untrustedConfig, getContextTagMapping_ConfigPropertyNames);
|
|
890
|
+
// Invalid or incomplete config
|
|
891
|
+
if (config === null) {
|
|
892
|
+
return null;
|
|
893
|
+
}
|
|
894
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
895
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
896
|
+
};
|
|
897
|
+
|
|
898
|
+
export { createContextTagMappingAdapterFactory, deleteContextTagMappingAdapterFactory, getContextTagMappingAdapterFactory, getContextTagMappingsAdapterFactory, updateContextTagMappingAdapterFactory };
|