@salesforce/lds-adapters-industries-contextrules 0.1.0-dev1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +82 -0
- package/dist/es/es2018/industries-contextrules.js +1155 -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/getUsageTypeDetail.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 +6 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +12 -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/getConnectContextRulesUsageTypesByUsageType.d.ts +16 -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/UsageSubtypeOutputRepresentation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/UsageTypeOutputRepresentation.d.ts +45 -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 +1317 -0
- package/src/raml/api.raml +221 -0
- package/src/raml/luvio.raml +57 -0
package/sfdc/index.js
ADDED
|
@@ -0,0 +1,1317 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* ATTENTION!
|
|
9
|
+
* THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
|
|
10
|
+
* If you would like to contribute to LDS, please follow the steps outlined in the git repo.
|
|
11
|
+
* Any changes made to this file in p4 will be automatically overwritten.
|
|
12
|
+
* *******************************************************************************************
|
|
13
|
+
*/
|
|
14
|
+
/* proxy-compat-disable */
|
|
15
|
+
import { createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstructor, createImperativeAdapter } from 'force/ldsBindings';
|
|
16
|
+
import { withDefaultLuvio } from 'force/ldsEngine';
|
|
17
|
+
import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$6, typeCheckConfig as typeCheckConfig$6, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$3 } from 'force/luvioEngine';
|
|
18
|
+
|
|
19
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
20
|
+
const { keys: ObjectKeys, create: ObjectCreate } = Object;
|
|
21
|
+
const { isArray: ArrayIsArray$1 } = Array;
|
|
22
|
+
/**
|
|
23
|
+
* Validates an adapter config is well-formed.
|
|
24
|
+
* @param config The config to validate.
|
|
25
|
+
* @param adapter The adapter validation configuration.
|
|
26
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
27
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
28
|
+
*/
|
|
29
|
+
function validateConfig(config, adapter, oneOf) {
|
|
30
|
+
const { displayName } = adapter;
|
|
31
|
+
const { required, optional, unsupported } = adapter.parameters;
|
|
32
|
+
if (config === undefined ||
|
|
33
|
+
required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
34
|
+
throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
|
|
35
|
+
}
|
|
36
|
+
if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
37
|
+
throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
|
|
38
|
+
}
|
|
39
|
+
if (unsupported !== undefined &&
|
|
40
|
+
unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
|
|
41
|
+
throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
|
|
42
|
+
}
|
|
43
|
+
const supported = required.concat(optional);
|
|
44
|
+
if (ObjectKeys(config).some(key => !supported.includes(key))) {
|
|
45
|
+
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function untrustedIsObject(untrusted) {
|
|
49
|
+
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
|
|
50
|
+
}
|
|
51
|
+
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
52
|
+
return configPropertyNames.parameters.required.every(req => req in config);
|
|
53
|
+
}
|
|
54
|
+
const snapshotRefreshOptions = {
|
|
55
|
+
overrides: {
|
|
56
|
+
headers: {
|
|
57
|
+
'Cache-Control': 'no-cache',
|
|
58
|
+
},
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
|
|
62
|
+
return {
|
|
63
|
+
name,
|
|
64
|
+
required,
|
|
65
|
+
resourceType,
|
|
66
|
+
typeCheckShape,
|
|
67
|
+
isArrayShape,
|
|
68
|
+
coerceFn,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function buildAdapterValidationConfig(displayName, paramsMeta) {
|
|
72
|
+
const required = paramsMeta.filter(p => p.required).map(p => p.name);
|
|
73
|
+
const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
|
|
74
|
+
return {
|
|
75
|
+
displayName,
|
|
76
|
+
parameters: {
|
|
77
|
+
required,
|
|
78
|
+
optional,
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const keyPrefix = 'contextrules';
|
|
83
|
+
|
|
84
|
+
const { isArray: ArrayIsArray } = Array;
|
|
85
|
+
const { stringify: JSONStringify } = JSON;
|
|
86
|
+
function createLink(ref) {
|
|
87
|
+
return {
|
|
88
|
+
__ref: serializeStructuredKey(ref),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function validate$5(obj, path = 'RuleLibraryTagMappingsListWrapperRepresentation') {
|
|
93
|
+
const v_error = (() => {
|
|
94
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
95
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
96
|
+
}
|
|
97
|
+
const obj_ruleLibraryTagMappingInputList = obj.ruleLibraryTagMappingInputList;
|
|
98
|
+
const path_ruleLibraryTagMappingInputList = path + '.ruleLibraryTagMappingInputList';
|
|
99
|
+
if (!ArrayIsArray(obj_ruleLibraryTagMappingInputList)) {
|
|
100
|
+
return new TypeError('Expected "array" but received "' + typeof obj_ruleLibraryTagMappingInputList + '" (at "' + path_ruleLibraryTagMappingInputList + '")');
|
|
101
|
+
}
|
|
102
|
+
for (let i = 0; i < obj_ruleLibraryTagMappingInputList.length; i++) {
|
|
103
|
+
const obj_ruleLibraryTagMappingInputList_item = obj_ruleLibraryTagMappingInputList[i];
|
|
104
|
+
const path_ruleLibraryTagMappingInputList_item = path_ruleLibraryTagMappingInputList + '[' + i + ']';
|
|
105
|
+
if (obj_ruleLibraryTagMappingInputList_item === undefined) {
|
|
106
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_ruleLibraryTagMappingInputList_item + '" (at "' + path_ruleLibraryTagMappingInputList_item + '")');
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
})();
|
|
110
|
+
return v_error === undefined ? null : v_error;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const TTL$3 = 1000;
|
|
114
|
+
const VERSION$3 = "7dab3fcadff55a173b214b22d1670519";
|
|
115
|
+
function validate$4(obj, path = 'RuleLibraryTagMappingsCreateUpdateOutputRepresentation') {
|
|
116
|
+
const v_error = (() => {
|
|
117
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
118
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
119
|
+
}
|
|
120
|
+
const obj_ids = obj.ids;
|
|
121
|
+
const path_ids = path + '.ids';
|
|
122
|
+
if (!ArrayIsArray(obj_ids)) {
|
|
123
|
+
return new TypeError('Expected "array" but received "' + typeof obj_ids + '" (at "' + path_ids + '")');
|
|
124
|
+
}
|
|
125
|
+
for (let i = 0; i < obj_ids.length; i++) {
|
|
126
|
+
const obj_ids_item = obj_ids[i];
|
|
127
|
+
const path_ids_item = path_ids + '[' + i + ']';
|
|
128
|
+
if (typeof obj_ids_item !== 'string') {
|
|
129
|
+
return new TypeError('Expected "string" but received "' + typeof obj_ids_item + '" (at "' + path_ids_item + '")');
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
})();
|
|
133
|
+
return v_error === undefined ? null : v_error;
|
|
134
|
+
}
|
|
135
|
+
const RepresentationType$3 = 'RuleLibraryTagMappingsCreateUpdateOutputRepresentation';
|
|
136
|
+
function keyBuilder$9(luvio, config) {
|
|
137
|
+
return keyPrefix + '::' + RepresentationType$3 + ':' + '[' + config.id.join(',') + ']';
|
|
138
|
+
}
|
|
139
|
+
function keyBuilderFromType$2(luvio, object) {
|
|
140
|
+
const keyParams = {
|
|
141
|
+
id: object.ids
|
|
142
|
+
};
|
|
143
|
+
return keyBuilder$9(luvio, keyParams);
|
|
144
|
+
}
|
|
145
|
+
function normalize$3(input, existing, path, luvio, store, timestamp) {
|
|
146
|
+
return input;
|
|
147
|
+
}
|
|
148
|
+
const select$8 = function RuleLibraryTagMappingsCreateUpdateOutputRepresentationSelect() {
|
|
149
|
+
return {
|
|
150
|
+
kind: 'Fragment',
|
|
151
|
+
version: VERSION$3,
|
|
152
|
+
private: [],
|
|
153
|
+
opaque: true
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
function equals$3(existing, incoming) {
|
|
157
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
const ingest$3 = function RuleLibraryTagMappingsCreateUpdateOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
163
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
164
|
+
const validateError = validate$4(input);
|
|
165
|
+
if (validateError !== null) {
|
|
166
|
+
throw validateError;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const key = keyBuilderFromType$2(luvio, input);
|
|
170
|
+
const ttlToUse = TTL$3;
|
|
171
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$3, "contextrules", VERSION$3, RepresentationType$3, equals$3);
|
|
172
|
+
return createLink(key);
|
|
173
|
+
};
|
|
174
|
+
function getTypeCacheKeys$3(rootKeySet, luvio, input, fullPathFactory) {
|
|
175
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
176
|
+
const rootKey = keyBuilderFromType$2(luvio, input);
|
|
177
|
+
rootKeySet.set(rootKey, {
|
|
178
|
+
namespace: keyPrefix,
|
|
179
|
+
representationName: RepresentationType$3,
|
|
180
|
+
mergeable: false
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function select$7(luvio, params) {
|
|
185
|
+
return select$8();
|
|
186
|
+
}
|
|
187
|
+
function getResponseCacheKeys$5(storeKeyMap, luvio, resourceParams, response) {
|
|
188
|
+
getTypeCacheKeys$3(storeKeyMap, luvio, response);
|
|
189
|
+
}
|
|
190
|
+
function ingestSuccess$4(luvio, resourceParams, response) {
|
|
191
|
+
const { body } = response;
|
|
192
|
+
const key = keyBuilderFromType$2(luvio, body);
|
|
193
|
+
luvio.storeIngest(key, ingest$3, body);
|
|
194
|
+
const snapshot = luvio.storeLookup({
|
|
195
|
+
recordId: key,
|
|
196
|
+
node: select$7(),
|
|
197
|
+
variables: {},
|
|
198
|
+
});
|
|
199
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
200
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
201
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
deepFreeze(snapshot.data);
|
|
205
|
+
return snapshot;
|
|
206
|
+
}
|
|
207
|
+
function createResourceRequest$5(config) {
|
|
208
|
+
const headers = {};
|
|
209
|
+
return {
|
|
210
|
+
baseUri: '/services/data/v66.0',
|
|
211
|
+
basePath: '/connect/context-rules/context-tag-mappings/rule-library-api-name/' + config.urlParams.ruleLibraryApiName + '/version-number/' + config.urlParams.versionNumber + '',
|
|
212
|
+
method: 'post',
|
|
213
|
+
body: config.body,
|
|
214
|
+
urlParams: config.urlParams,
|
|
215
|
+
queryParams: {},
|
|
216
|
+
headers,
|
|
217
|
+
priority: 'normal',
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const adapterName$5 = 'createContextTagMapping';
|
|
222
|
+
const createContextTagMapping_ConfigPropertyMetadata = [
|
|
223
|
+
generateParamConfigMetadata('ruleLibraryApiName', true, 0 /* UrlParameter */, 0 /* String */),
|
|
224
|
+
generateParamConfigMetadata('versionNumber', true, 0 /* UrlParameter */, 0 /* String */),
|
|
225
|
+
generateParamConfigMetadata('contextTagMappings', true, 2 /* Body */, 4 /* Unsupported */),
|
|
226
|
+
];
|
|
227
|
+
const createContextTagMapping_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$5, createContextTagMapping_ConfigPropertyMetadata);
|
|
228
|
+
const createResourceParams$5 = /*#__PURE__*/ createResourceParams$6(createContextTagMapping_ConfigPropertyMetadata);
|
|
229
|
+
function typeCheckConfig$5(untrustedConfig) {
|
|
230
|
+
const config = {};
|
|
231
|
+
typeCheckConfig$6(untrustedConfig, config, createContextTagMapping_ConfigPropertyMetadata);
|
|
232
|
+
const untrustedConfig_contextTagMappings = untrustedConfig.contextTagMappings;
|
|
233
|
+
const referenceRuleLibraryTagMappingsListWrapperRepresentationValidationError = validate$5(untrustedConfig_contextTagMappings);
|
|
234
|
+
if (referenceRuleLibraryTagMappingsListWrapperRepresentationValidationError === null) {
|
|
235
|
+
config.contextTagMappings = untrustedConfig_contextTagMappings;
|
|
236
|
+
}
|
|
237
|
+
return config;
|
|
238
|
+
}
|
|
239
|
+
function validateAdapterConfig$5(untrustedConfig, configPropertyNames) {
|
|
240
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
241
|
+
return null;
|
|
242
|
+
}
|
|
243
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
244
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
245
|
+
}
|
|
246
|
+
const config = typeCheckConfig$5(untrustedConfig);
|
|
247
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
248
|
+
return null;
|
|
249
|
+
}
|
|
250
|
+
return config;
|
|
251
|
+
}
|
|
252
|
+
function buildNetworkSnapshot$5(luvio, config, options) {
|
|
253
|
+
const resourceParams = createResourceParams$5(config);
|
|
254
|
+
const request = createResourceRequest$5(resourceParams);
|
|
255
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
256
|
+
.then((response) => {
|
|
257
|
+
return luvio.handleSuccessResponse(() => {
|
|
258
|
+
const snapshot = ingestSuccess$4(luvio, resourceParams, response);
|
|
259
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
260
|
+
}, () => {
|
|
261
|
+
const cache = new StoreKeyMap();
|
|
262
|
+
getResponseCacheKeys$5(cache, luvio, resourceParams, response.body);
|
|
263
|
+
return cache;
|
|
264
|
+
});
|
|
265
|
+
}, (response) => {
|
|
266
|
+
deepFreeze(response);
|
|
267
|
+
throw response;
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
const createContextTagMappingAdapterFactory = (luvio) => {
|
|
271
|
+
return function createContextTagMapping(untrustedConfig) {
|
|
272
|
+
const config = validateAdapterConfig$5(untrustedConfig, createContextTagMapping_ConfigPropertyNames);
|
|
273
|
+
// Invalid or incomplete config
|
|
274
|
+
if (config === null) {
|
|
275
|
+
throw new Error('Invalid config for "createContextTagMapping"');
|
|
276
|
+
}
|
|
277
|
+
return buildNetworkSnapshot$5(luvio, config);
|
|
278
|
+
};
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
const TTL$2 = 1000;
|
|
282
|
+
const VERSION$2 = "4b7bef672f4996c31c5a042959681437";
|
|
283
|
+
function validate$3(obj, path = 'RuleLibraryTagMappingsReadOutputRepresentation') {
|
|
284
|
+
const v_error = (() => {
|
|
285
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
286
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
287
|
+
}
|
|
288
|
+
const obj_id = obj.id;
|
|
289
|
+
const path_id = path + '.id';
|
|
290
|
+
if (typeof obj_id !== 'string') {
|
|
291
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
292
|
+
}
|
|
293
|
+
const obj_mappingName = obj.mappingName;
|
|
294
|
+
const path_mappingName = path + '.mappingName';
|
|
295
|
+
if (typeof obj_mappingName !== 'string') {
|
|
296
|
+
return new TypeError('Expected "string" but received "' + typeof obj_mappingName + '" (at "' + path_mappingName + '")');
|
|
297
|
+
}
|
|
298
|
+
const obj_ruleLibraryApiName = obj.ruleLibraryApiName;
|
|
299
|
+
const path_ruleLibraryApiName = path + '.ruleLibraryApiName';
|
|
300
|
+
if (typeof obj_ruleLibraryApiName !== 'string') {
|
|
301
|
+
return new TypeError('Expected "string" but received "' + typeof obj_ruleLibraryApiName + '" (at "' + path_ruleLibraryApiName + '")');
|
|
302
|
+
}
|
|
303
|
+
if (obj.sequenceNumber !== undefined) {
|
|
304
|
+
const obj_sequenceNumber = obj.sequenceNumber;
|
|
305
|
+
const path_sequenceNumber = path + '.sequenceNumber';
|
|
306
|
+
if (typeof obj_sequenceNumber !== 'number' || (typeof obj_sequenceNumber === 'number' && Math.floor(obj_sequenceNumber) !== obj_sequenceNumber)) {
|
|
307
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_sequenceNumber + '" (at "' + path_sequenceNumber + '")');
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
const obj_tagName = obj.tagName;
|
|
311
|
+
const path_tagName = path + '.tagName';
|
|
312
|
+
if (typeof obj_tagName !== 'string') {
|
|
313
|
+
return new TypeError('Expected "string" but received "' + typeof obj_tagName + '" (at "' + path_tagName + '")');
|
|
314
|
+
}
|
|
315
|
+
if (obj.usageSubtype !== undefined) {
|
|
316
|
+
const obj_usageSubtype = obj.usageSubtype;
|
|
317
|
+
const path_usageSubtype = path + '.usageSubtype';
|
|
318
|
+
if (typeof obj_usageSubtype !== 'string') {
|
|
319
|
+
return new TypeError('Expected "string" but received "' + typeof obj_usageSubtype + '" (at "' + path_usageSubtype + '")');
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
const obj_versionNumber = obj.versionNumber;
|
|
323
|
+
const path_versionNumber = path + '.versionNumber';
|
|
324
|
+
if (typeof obj_versionNumber !== 'number' || (typeof obj_versionNumber === 'number' && Math.floor(obj_versionNumber) !== obj_versionNumber)) {
|
|
325
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_versionNumber + '" (at "' + path_versionNumber + '")');
|
|
326
|
+
}
|
|
327
|
+
})();
|
|
328
|
+
return v_error === undefined ? null : v_error;
|
|
329
|
+
}
|
|
330
|
+
const RepresentationType$2 = 'RuleLibraryTagMappingsReadOutputRepresentation';
|
|
331
|
+
function keyBuilder$8(luvio, config) {
|
|
332
|
+
return keyPrefix + '::' + RepresentationType$2 + ':' + config.id;
|
|
333
|
+
}
|
|
334
|
+
function keyBuilderFromType$1(luvio, object) {
|
|
335
|
+
const keyParams = {
|
|
336
|
+
id: object.mappingName
|
|
337
|
+
};
|
|
338
|
+
return keyBuilder$8(luvio, keyParams);
|
|
339
|
+
}
|
|
340
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
341
|
+
return input;
|
|
342
|
+
}
|
|
343
|
+
const select$6 = function RuleLibraryTagMappingsReadOutputRepresentationSelect() {
|
|
344
|
+
return {
|
|
345
|
+
kind: 'Fragment',
|
|
346
|
+
version: VERSION$2,
|
|
347
|
+
private: [],
|
|
348
|
+
opaque: true
|
|
349
|
+
};
|
|
350
|
+
};
|
|
351
|
+
function equals$2(existing, incoming) {
|
|
352
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
353
|
+
return false;
|
|
354
|
+
}
|
|
355
|
+
return true;
|
|
356
|
+
}
|
|
357
|
+
const ingest$2 = function RuleLibraryTagMappingsReadOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
358
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
359
|
+
const validateError = validate$3(input);
|
|
360
|
+
if (validateError !== null) {
|
|
361
|
+
throw validateError;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
const key = keyBuilderFromType$1(luvio, input);
|
|
365
|
+
const ttlToUse = TTL$2;
|
|
366
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "contextrules", VERSION$2, RepresentationType$2, equals$2);
|
|
367
|
+
return createLink(key);
|
|
368
|
+
};
|
|
369
|
+
function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
|
|
370
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
371
|
+
const rootKey = keyBuilderFromType$1(luvio, input);
|
|
372
|
+
rootKeySet.set(rootKey, {
|
|
373
|
+
namespace: keyPrefix,
|
|
374
|
+
representationName: RepresentationType$2,
|
|
375
|
+
mergeable: false
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
function keyBuilder$7(luvio, params) {
|
|
380
|
+
return keyBuilder$8(luvio, {
|
|
381
|
+
id: params.urlParams.mappingName
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
function getResponseCacheKeys$4(cacheKeyMap, luvio, resourceParams) {
|
|
385
|
+
const key = keyBuilder$7(luvio, resourceParams);
|
|
386
|
+
cacheKeyMap.set(key, {
|
|
387
|
+
namespace: keyPrefix,
|
|
388
|
+
representationName: RepresentationType$2,
|
|
389
|
+
mergeable: false
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
function evictSuccess(luvio, resourceParams) {
|
|
393
|
+
const key = keyBuilder$7(luvio, resourceParams);
|
|
394
|
+
luvio.storeEvict(key);
|
|
395
|
+
}
|
|
396
|
+
function createResourceRequest$4(config) {
|
|
397
|
+
const headers = {};
|
|
398
|
+
return {
|
|
399
|
+
baseUri: '/services/data/v66.0',
|
|
400
|
+
basePath: '/connect/context-rules/context-tag-mappings/rule-library-api-name/' + config.urlParams.ruleLibraryApiName + '/version-number/' + config.urlParams.versionNumber + '/mapping-name/' + config.urlParams.mappingName + '',
|
|
401
|
+
method: 'delete',
|
|
402
|
+
body: null,
|
|
403
|
+
urlParams: config.urlParams,
|
|
404
|
+
queryParams: {},
|
|
405
|
+
headers,
|
|
406
|
+
priority: 'normal',
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
const adapterName$4 = 'deleteContextTagMapping';
|
|
411
|
+
const deleteContextTagMapping_ConfigPropertyMetadata = [
|
|
412
|
+
generateParamConfigMetadata('mappingName', true, 0 /* UrlParameter */, 0 /* String */),
|
|
413
|
+
generateParamConfigMetadata('ruleLibraryApiName', true, 0 /* UrlParameter */, 0 /* String */),
|
|
414
|
+
generateParamConfigMetadata('versionNumber', true, 0 /* UrlParameter */, 0 /* String */),
|
|
415
|
+
];
|
|
416
|
+
const deleteContextTagMapping_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$4, deleteContextTagMapping_ConfigPropertyMetadata);
|
|
417
|
+
const createResourceParams$4 = /*#__PURE__*/ createResourceParams$6(deleteContextTagMapping_ConfigPropertyMetadata);
|
|
418
|
+
function typeCheckConfig$4(untrustedConfig) {
|
|
419
|
+
const config = {};
|
|
420
|
+
typeCheckConfig$6(untrustedConfig, config, deleteContextTagMapping_ConfigPropertyMetadata);
|
|
421
|
+
return config;
|
|
422
|
+
}
|
|
423
|
+
function validateAdapterConfig$4(untrustedConfig, configPropertyNames) {
|
|
424
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
425
|
+
return null;
|
|
426
|
+
}
|
|
427
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
428
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
429
|
+
}
|
|
430
|
+
const config = typeCheckConfig$4(untrustedConfig);
|
|
431
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
432
|
+
return null;
|
|
433
|
+
}
|
|
434
|
+
return config;
|
|
435
|
+
}
|
|
436
|
+
function buildNetworkSnapshot$4(luvio, config, options) {
|
|
437
|
+
const resourceParams = createResourceParams$4(config);
|
|
438
|
+
const request = createResourceRequest$4(resourceParams);
|
|
439
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
440
|
+
.then(() => {
|
|
441
|
+
return luvio.handleSuccessResponse(() => {
|
|
442
|
+
evictSuccess(luvio, resourceParams);
|
|
443
|
+
return luvio.storeBroadcast();
|
|
444
|
+
}, () => {
|
|
445
|
+
const cache = new StoreKeyMap();
|
|
446
|
+
getResponseCacheKeys$4(cache, luvio, resourceParams);
|
|
447
|
+
return cache;
|
|
448
|
+
});
|
|
449
|
+
}, (response) => {
|
|
450
|
+
deepFreeze(response);
|
|
451
|
+
throw response;
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
const deleteContextTagMappingAdapterFactory = (luvio) => {
|
|
455
|
+
return function contextrulesdeleteContextTagMapping(untrustedConfig) {
|
|
456
|
+
const config = validateAdapterConfig$4(untrustedConfig, deleteContextTagMapping_ConfigPropertyNames);
|
|
457
|
+
// Invalid or incomplete config
|
|
458
|
+
if (config === null) {
|
|
459
|
+
throw new Error(`Invalid config for "${adapterName$4}"`);
|
|
460
|
+
}
|
|
461
|
+
return buildNetworkSnapshot$4(luvio, config);
|
|
462
|
+
};
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
function select$5(luvio, params) {
|
|
466
|
+
return select$6();
|
|
467
|
+
}
|
|
468
|
+
function keyBuilder$6(luvio, params) {
|
|
469
|
+
return keyBuilder$8(luvio, {
|
|
470
|
+
id: params.urlParams.mappingName
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
|
|
474
|
+
getTypeCacheKeys$2(storeKeyMap, luvio, response);
|
|
475
|
+
}
|
|
476
|
+
function ingestSuccess$3(luvio, resourceParams, response, snapshotRefresh) {
|
|
477
|
+
const { body } = response;
|
|
478
|
+
const key = keyBuilder$6(luvio, resourceParams);
|
|
479
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
480
|
+
const snapshot = luvio.storeLookup({
|
|
481
|
+
recordId: key,
|
|
482
|
+
node: select$5(),
|
|
483
|
+
variables: {},
|
|
484
|
+
}, snapshotRefresh);
|
|
485
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
486
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
487
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
deepFreeze(snapshot.data);
|
|
491
|
+
return snapshot;
|
|
492
|
+
}
|
|
493
|
+
function ingestError$2(luvio, params, error, snapshotRefresh) {
|
|
494
|
+
const key = keyBuilder$6(luvio, params);
|
|
495
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
496
|
+
const storeMetadataParams = {
|
|
497
|
+
ttl: TTL$2,
|
|
498
|
+
namespace: keyPrefix,
|
|
499
|
+
version: VERSION$2,
|
|
500
|
+
representationName: RepresentationType$2
|
|
501
|
+
};
|
|
502
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
503
|
+
return errorSnapshot;
|
|
504
|
+
}
|
|
505
|
+
function createResourceRequest$3(config) {
|
|
506
|
+
const headers = {};
|
|
507
|
+
return {
|
|
508
|
+
baseUri: '/services/data/v66.0',
|
|
509
|
+
basePath: '/connect/context-rules/context-tag-mappings/rule-library-api-name/' + config.urlParams.ruleLibraryApiName + '/version-number/' + config.urlParams.versionNumber + '/mapping-name/' + config.urlParams.mappingName + '',
|
|
510
|
+
method: 'get',
|
|
511
|
+
body: null,
|
|
512
|
+
urlParams: config.urlParams,
|
|
513
|
+
queryParams: {},
|
|
514
|
+
headers,
|
|
515
|
+
priority: 'normal',
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
function createResourceRequestFromRepresentation$1(representation) {
|
|
519
|
+
const config = {
|
|
520
|
+
urlParams: {},
|
|
521
|
+
};
|
|
522
|
+
config.urlParams.mappingName = representation.mappingName;
|
|
523
|
+
return createResourceRequest$3(config);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
const adapterName$3 = 'getContextTagMapping';
|
|
527
|
+
const getContextTagMapping_ConfigPropertyMetadata = [
|
|
528
|
+
generateParamConfigMetadata('mappingName', true, 0 /* UrlParameter */, 0 /* String */),
|
|
529
|
+
generateParamConfigMetadata('ruleLibraryApiName', true, 0 /* UrlParameter */, 0 /* String */),
|
|
530
|
+
generateParamConfigMetadata('versionNumber', true, 0 /* UrlParameter */, 0 /* String */),
|
|
531
|
+
];
|
|
532
|
+
const getContextTagMapping_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, getContextTagMapping_ConfigPropertyMetadata);
|
|
533
|
+
const createResourceParams$3 = /*#__PURE__*/ createResourceParams$6(getContextTagMapping_ConfigPropertyMetadata);
|
|
534
|
+
function keyBuilder$5(luvio, config) {
|
|
535
|
+
const resourceParams = createResourceParams$3(config);
|
|
536
|
+
return keyBuilder$6(luvio, resourceParams);
|
|
537
|
+
}
|
|
538
|
+
function typeCheckConfig$3(untrustedConfig) {
|
|
539
|
+
const config = {};
|
|
540
|
+
typeCheckConfig$6(untrustedConfig, config, getContextTagMapping_ConfigPropertyMetadata);
|
|
541
|
+
return config;
|
|
542
|
+
}
|
|
543
|
+
function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
|
|
544
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
545
|
+
return null;
|
|
546
|
+
}
|
|
547
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
548
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
549
|
+
}
|
|
550
|
+
const config = typeCheckConfig$3(untrustedConfig);
|
|
551
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
552
|
+
return null;
|
|
553
|
+
}
|
|
554
|
+
return config;
|
|
555
|
+
}
|
|
556
|
+
function adapterFragment$2(luvio, config) {
|
|
557
|
+
createResourceParams$3(config);
|
|
558
|
+
return select$5();
|
|
559
|
+
}
|
|
560
|
+
function onFetchResponseSuccess$2(luvio, config, resourceParams, response) {
|
|
561
|
+
const snapshot = ingestSuccess$3(luvio, resourceParams, response, {
|
|
562
|
+
config,
|
|
563
|
+
resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
|
|
564
|
+
});
|
|
565
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
566
|
+
}
|
|
567
|
+
function onFetchResponseError$2(luvio, config, resourceParams, response) {
|
|
568
|
+
const snapshot = ingestError$2(luvio, resourceParams, response, {
|
|
569
|
+
config,
|
|
570
|
+
resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
|
|
571
|
+
});
|
|
572
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
573
|
+
}
|
|
574
|
+
function buildNetworkSnapshot$3(luvio, config, options) {
|
|
575
|
+
const resourceParams = createResourceParams$3(config);
|
|
576
|
+
const request = createResourceRequest$3(resourceParams);
|
|
577
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
578
|
+
.then((response) => {
|
|
579
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$2(luvio, config, resourceParams, response), () => {
|
|
580
|
+
const cache = new StoreKeyMap();
|
|
581
|
+
getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
|
|
582
|
+
return cache;
|
|
583
|
+
});
|
|
584
|
+
}, (response) => {
|
|
585
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$2(luvio, config, resourceParams, response));
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
function buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext) {
|
|
589
|
+
return buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext, buildNetworkSnapshot$3, undefined, false);
|
|
590
|
+
}
|
|
591
|
+
function buildCachedSnapshotCachePolicy$2(context, storeLookup) {
|
|
592
|
+
const { luvio, config } = context;
|
|
593
|
+
const selector = {
|
|
594
|
+
recordId: keyBuilder$5(luvio, config),
|
|
595
|
+
node: adapterFragment$2(luvio, config),
|
|
596
|
+
variables: {},
|
|
597
|
+
};
|
|
598
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
599
|
+
config,
|
|
600
|
+
resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
|
|
601
|
+
});
|
|
602
|
+
return cacheSnapshot;
|
|
603
|
+
}
|
|
604
|
+
const getContextTagMappingAdapterFactory = (luvio) => function contextrules__getContextTagMapping(untrustedConfig, requestContext) {
|
|
605
|
+
const config = validateAdapterConfig$3(untrustedConfig, getContextTagMapping_ConfigPropertyNames);
|
|
606
|
+
// Invalid or incomplete config
|
|
607
|
+
if (config === null) {
|
|
608
|
+
return null;
|
|
609
|
+
}
|
|
610
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
611
|
+
buildCachedSnapshotCachePolicy$2, buildNetworkSnapshotCachePolicy$2);
|
|
612
|
+
};
|
|
613
|
+
const notifyChangeFactory$1 = (luvio, options) => {
|
|
614
|
+
return function getConnectContextRulesContextTagMappingsRuleLibraryApiNameVersionNumberMappingNameByMappingNameAndRuleLibraryApiNameAndVersionNumberNotifyChange(configs) {
|
|
615
|
+
const keys = configs.map(c => keyBuilder$8(luvio, c));
|
|
616
|
+
luvio.getNotifyChangeStoreEntries(keys).then(entries => {
|
|
617
|
+
for (let i = 0, len = entries.length; i < len; i++) {
|
|
618
|
+
const { key, record: val } = entries[i];
|
|
619
|
+
const refreshRequest = createResourceRequestFromRepresentation$1(val);
|
|
620
|
+
luvio.dispatchResourceRequest(refreshRequest, options)
|
|
621
|
+
.then((response) => {
|
|
622
|
+
return luvio.handleSuccessResponse(() => {
|
|
623
|
+
const { body } = response;
|
|
624
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
625
|
+
return luvio.storeBroadcast();
|
|
626
|
+
}, () => {
|
|
627
|
+
const cache = new StoreKeyMap();
|
|
628
|
+
getTypeCacheKeys$2(cache, luvio, response.body);
|
|
629
|
+
return cache;
|
|
630
|
+
});
|
|
631
|
+
}, (error) => {
|
|
632
|
+
return luvio.handleErrorResponse(() => {
|
|
633
|
+
const errorSnapshot = luvio.errorSnapshot(error);
|
|
634
|
+
luvio.storeIngestError(key, errorSnapshot, {
|
|
635
|
+
ttl: TTL$2,
|
|
636
|
+
namespace: keyPrefix,
|
|
637
|
+
version: VERSION$2,
|
|
638
|
+
representationName: RepresentationType$2
|
|
639
|
+
});
|
|
640
|
+
return luvio.storeBroadcast().then(() => errorSnapshot);
|
|
641
|
+
});
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
});
|
|
645
|
+
};
|
|
646
|
+
};
|
|
647
|
+
|
|
648
|
+
const TTL$1 = 1000;
|
|
649
|
+
const VERSION$1 = "3839d94c828e170861b071d1d1fe5292";
|
|
650
|
+
function validate$2(obj, path = 'RuleLibraryTagMappingsReadOutputRepresentationList') {
|
|
651
|
+
const v_error = (() => {
|
|
652
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
653
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
654
|
+
}
|
|
655
|
+
const obj_ruleLibraryTagMappings = obj.ruleLibraryTagMappings;
|
|
656
|
+
const path_ruleLibraryTagMappings = path + '.ruleLibraryTagMappings';
|
|
657
|
+
if (!ArrayIsArray(obj_ruleLibraryTagMappings)) {
|
|
658
|
+
return new TypeError('Expected "array" but received "' + typeof obj_ruleLibraryTagMappings + '" (at "' + path_ruleLibraryTagMappings + '")');
|
|
659
|
+
}
|
|
660
|
+
for (let i = 0; i < obj_ruleLibraryTagMappings.length; i++) {
|
|
661
|
+
const obj_ruleLibraryTagMappings_item = obj_ruleLibraryTagMappings[i];
|
|
662
|
+
const path_ruleLibraryTagMappings_item = path_ruleLibraryTagMappings + '[' + i + ']';
|
|
663
|
+
const referencepath_ruleLibraryTagMappings_itemValidationError = validate$3(obj_ruleLibraryTagMappings_item, path_ruleLibraryTagMappings_item);
|
|
664
|
+
if (referencepath_ruleLibraryTagMappings_itemValidationError !== null) {
|
|
665
|
+
let message = 'Object doesn\'t match RuleLibraryTagMappingsReadOutputRepresentation (at "' + path_ruleLibraryTagMappings_item + '")\n';
|
|
666
|
+
message += referencepath_ruleLibraryTagMappings_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
667
|
+
return new TypeError(message);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
})();
|
|
671
|
+
return v_error === undefined ? null : v_error;
|
|
672
|
+
}
|
|
673
|
+
const RepresentationType$1 = 'RuleLibraryTagMappingsReadOutputRepresentationList';
|
|
674
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
675
|
+
return input;
|
|
676
|
+
}
|
|
677
|
+
const select$4 = function RuleLibraryTagMappingsReadOutputRepresentationListSelect() {
|
|
678
|
+
return {
|
|
679
|
+
kind: 'Fragment',
|
|
680
|
+
version: VERSION$1,
|
|
681
|
+
private: [],
|
|
682
|
+
opaque: true
|
|
683
|
+
};
|
|
684
|
+
};
|
|
685
|
+
function equals$1(existing, incoming) {
|
|
686
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
687
|
+
return false;
|
|
688
|
+
}
|
|
689
|
+
return true;
|
|
690
|
+
}
|
|
691
|
+
const ingest$1 = function RuleLibraryTagMappingsReadOutputRepresentationListIngest(input, path, luvio, store, timestamp) {
|
|
692
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
693
|
+
const validateError = validate$2(input);
|
|
694
|
+
if (validateError !== null) {
|
|
695
|
+
throw validateError;
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
const key = path.fullPath;
|
|
699
|
+
const ttlToUse = TTL$1;
|
|
700
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "contextrules", VERSION$1, RepresentationType$1, equals$1);
|
|
701
|
+
return createLink(key);
|
|
702
|
+
};
|
|
703
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
704
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
705
|
+
const rootKey = fullPathFactory();
|
|
706
|
+
rootKeySet.set(rootKey, {
|
|
707
|
+
namespace: keyPrefix,
|
|
708
|
+
representationName: RepresentationType$1,
|
|
709
|
+
mergeable: false
|
|
710
|
+
});
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
function select$3(luvio, params) {
|
|
714
|
+
return select$4();
|
|
715
|
+
}
|
|
716
|
+
function keyBuilder$4(luvio, params) {
|
|
717
|
+
return keyPrefix + '::RuleLibraryTagMappingsReadOutputRepresentationList:(' + 'ruleLibraryApiName:' + params.urlParams.ruleLibraryApiName + ',' + 'versionNumber:' + params.urlParams.versionNumber + ')';
|
|
718
|
+
}
|
|
719
|
+
function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
|
|
720
|
+
getTypeCacheKeys$1(storeKeyMap, luvio, response, () => keyBuilder$4(luvio, resourceParams));
|
|
721
|
+
}
|
|
722
|
+
function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
|
|
723
|
+
const { body } = response;
|
|
724
|
+
const key = keyBuilder$4(luvio, resourceParams);
|
|
725
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
726
|
+
const snapshot = luvio.storeLookup({
|
|
727
|
+
recordId: key,
|
|
728
|
+
node: select$3(),
|
|
729
|
+
variables: {},
|
|
730
|
+
}, snapshotRefresh);
|
|
731
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
732
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
733
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
deepFreeze(snapshot.data);
|
|
737
|
+
return snapshot;
|
|
738
|
+
}
|
|
739
|
+
function ingestError$1(luvio, params, error, snapshotRefresh) {
|
|
740
|
+
const key = keyBuilder$4(luvio, params);
|
|
741
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
742
|
+
const storeMetadataParams = {
|
|
743
|
+
ttl: TTL$1,
|
|
744
|
+
namespace: keyPrefix,
|
|
745
|
+
version: VERSION$1,
|
|
746
|
+
representationName: RepresentationType$1
|
|
747
|
+
};
|
|
748
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
749
|
+
return errorSnapshot;
|
|
750
|
+
}
|
|
751
|
+
function createResourceRequest$2(config) {
|
|
752
|
+
const headers = {};
|
|
753
|
+
return {
|
|
754
|
+
baseUri: '/services/data/v66.0',
|
|
755
|
+
basePath: '/connect/context-rules/context-tag-mappings/rule-library-api-name/' + config.urlParams.ruleLibraryApiName + '/version-number/' + config.urlParams.versionNumber + '',
|
|
756
|
+
method: 'get',
|
|
757
|
+
body: null,
|
|
758
|
+
urlParams: config.urlParams,
|
|
759
|
+
queryParams: {},
|
|
760
|
+
headers,
|
|
761
|
+
priority: 'normal',
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
const adapterName$2 = 'getContextTagMappings';
|
|
766
|
+
const getContextTagMappings_ConfigPropertyMetadata = [
|
|
767
|
+
generateParamConfigMetadata('ruleLibraryApiName', true, 0 /* UrlParameter */, 0 /* String */),
|
|
768
|
+
generateParamConfigMetadata('versionNumber', true, 0 /* UrlParameter */, 0 /* String */),
|
|
769
|
+
];
|
|
770
|
+
const getContextTagMappings_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getContextTagMappings_ConfigPropertyMetadata);
|
|
771
|
+
const createResourceParams$2 = /*#__PURE__*/ createResourceParams$6(getContextTagMappings_ConfigPropertyMetadata);
|
|
772
|
+
function keyBuilder$3(luvio, config) {
|
|
773
|
+
const resourceParams = createResourceParams$2(config);
|
|
774
|
+
return keyBuilder$4(luvio, resourceParams);
|
|
775
|
+
}
|
|
776
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
777
|
+
const config = {};
|
|
778
|
+
typeCheckConfig$6(untrustedConfig, config, getContextTagMappings_ConfigPropertyMetadata);
|
|
779
|
+
return config;
|
|
780
|
+
}
|
|
781
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
782
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
783
|
+
return null;
|
|
784
|
+
}
|
|
785
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
786
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
787
|
+
}
|
|
788
|
+
const config = typeCheckConfig$2(untrustedConfig);
|
|
789
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
790
|
+
return null;
|
|
791
|
+
}
|
|
792
|
+
return config;
|
|
793
|
+
}
|
|
794
|
+
function adapterFragment$1(luvio, config) {
|
|
795
|
+
createResourceParams$2(config);
|
|
796
|
+
return select$3();
|
|
797
|
+
}
|
|
798
|
+
function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
|
|
799
|
+
const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
|
|
800
|
+
config,
|
|
801
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
802
|
+
});
|
|
803
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
804
|
+
}
|
|
805
|
+
function onFetchResponseError$1(luvio, config, resourceParams, response) {
|
|
806
|
+
const snapshot = ingestError$1(luvio, resourceParams, response, {
|
|
807
|
+
config,
|
|
808
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
809
|
+
});
|
|
810
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
811
|
+
}
|
|
812
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
813
|
+
const resourceParams = createResourceParams$2(config);
|
|
814
|
+
const request = createResourceRequest$2(resourceParams);
|
|
815
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
816
|
+
.then((response) => {
|
|
817
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
|
|
818
|
+
const cache = new StoreKeyMap();
|
|
819
|
+
getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
|
|
820
|
+
return cache;
|
|
821
|
+
});
|
|
822
|
+
}, (response) => {
|
|
823
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
|
|
824
|
+
});
|
|
825
|
+
}
|
|
826
|
+
function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
|
|
827
|
+
return buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, undefined, false);
|
|
828
|
+
}
|
|
829
|
+
function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
|
|
830
|
+
const { luvio, config } = context;
|
|
831
|
+
const selector = {
|
|
832
|
+
recordId: keyBuilder$3(luvio, config),
|
|
833
|
+
node: adapterFragment$1(luvio, config),
|
|
834
|
+
variables: {},
|
|
835
|
+
};
|
|
836
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
837
|
+
config,
|
|
838
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
839
|
+
});
|
|
840
|
+
return cacheSnapshot;
|
|
841
|
+
}
|
|
842
|
+
const getContextTagMappingsAdapterFactory = (luvio) => function contextrules__getContextTagMappings(untrustedConfig, requestContext) {
|
|
843
|
+
const config = validateAdapterConfig$2(untrustedConfig, getContextTagMappings_ConfigPropertyNames);
|
|
844
|
+
// Invalid or incomplete config
|
|
845
|
+
if (config === null) {
|
|
846
|
+
return null;
|
|
847
|
+
}
|
|
848
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
849
|
+
buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
|
|
850
|
+
};
|
|
851
|
+
|
|
852
|
+
function validate$1(obj, path = 'UsageSubtypeOutputRepresentation') {
|
|
853
|
+
const v_error = (() => {
|
|
854
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
855
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
856
|
+
}
|
|
857
|
+
const obj_subtypeMappingNames = obj.subtypeMappingNames;
|
|
858
|
+
const path_subtypeMappingNames = path + '.subtypeMappingNames';
|
|
859
|
+
if (!ArrayIsArray(obj_subtypeMappingNames)) {
|
|
860
|
+
return new TypeError('Expected "array" but received "' + typeof obj_subtypeMappingNames + '" (at "' + path_subtypeMappingNames + '")');
|
|
861
|
+
}
|
|
862
|
+
for (let i = 0; i < obj_subtypeMappingNames.length; i++) {
|
|
863
|
+
const obj_subtypeMappingNames_item = obj_subtypeMappingNames[i];
|
|
864
|
+
const path_subtypeMappingNames_item = path_subtypeMappingNames + '[' + i + ']';
|
|
865
|
+
if (typeof obj_subtypeMappingNames_item !== 'string') {
|
|
866
|
+
return new TypeError('Expected "string" but received "' + typeof obj_subtypeMappingNames_item + '" (at "' + path_subtypeMappingNames_item + '")');
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
const obj_usageSubtype = obj.usageSubtype;
|
|
870
|
+
const path_usageSubtype = path + '.usageSubtype';
|
|
871
|
+
if (typeof obj_usageSubtype !== 'string') {
|
|
872
|
+
return new TypeError('Expected "string" but received "' + typeof obj_usageSubtype + '" (at "' + path_usageSubtype + '")');
|
|
873
|
+
}
|
|
874
|
+
})();
|
|
875
|
+
return v_error === undefined ? null : v_error;
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
const TTL = 1000;
|
|
879
|
+
const VERSION = "19586883f36a2f3e5aa88a8708d670b4";
|
|
880
|
+
function validate(obj, path = 'UsageTypeOutputRepresentation') {
|
|
881
|
+
const v_error = (() => {
|
|
882
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
883
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
884
|
+
}
|
|
885
|
+
const obj_mappingNames = obj.mappingNames;
|
|
886
|
+
const path_mappingNames = path + '.mappingNames';
|
|
887
|
+
if (!ArrayIsArray(obj_mappingNames)) {
|
|
888
|
+
return new TypeError('Expected "array" but received "' + typeof obj_mappingNames + '" (at "' + path_mappingNames + '")');
|
|
889
|
+
}
|
|
890
|
+
for (let i = 0; i < obj_mappingNames.length; i++) {
|
|
891
|
+
const obj_mappingNames_item = obj_mappingNames[i];
|
|
892
|
+
const path_mappingNames_item = path_mappingNames + '[' + i + ']';
|
|
893
|
+
if (typeof obj_mappingNames_item !== 'string') {
|
|
894
|
+
return new TypeError('Expected "string" but received "' + typeof obj_mappingNames_item + '" (at "' + path_mappingNames_item + '")');
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
const obj_usageSubtypes = obj.usageSubtypes;
|
|
898
|
+
const path_usageSubtypes = path + '.usageSubtypes';
|
|
899
|
+
if (!ArrayIsArray(obj_usageSubtypes)) {
|
|
900
|
+
return new TypeError('Expected "array" but received "' + typeof obj_usageSubtypes + '" (at "' + path_usageSubtypes + '")');
|
|
901
|
+
}
|
|
902
|
+
for (let i = 0; i < obj_usageSubtypes.length; i++) {
|
|
903
|
+
const obj_usageSubtypes_item = obj_usageSubtypes[i];
|
|
904
|
+
const path_usageSubtypes_item = path_usageSubtypes + '[' + i + ']';
|
|
905
|
+
const referencepath_usageSubtypes_itemValidationError = validate$1(obj_usageSubtypes_item, path_usageSubtypes_item);
|
|
906
|
+
if (referencepath_usageSubtypes_itemValidationError !== null) {
|
|
907
|
+
let message = 'Object doesn\'t match UsageSubtypeOutputRepresentation (at "' + path_usageSubtypes_item + '")\n';
|
|
908
|
+
message += referencepath_usageSubtypes_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
909
|
+
return new TypeError(message);
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
const obj_usageType = obj.usageType;
|
|
913
|
+
const path_usageType = path + '.usageType';
|
|
914
|
+
if (typeof obj_usageType !== 'string') {
|
|
915
|
+
return new TypeError('Expected "string" but received "' + typeof obj_usageType + '" (at "' + path_usageType + '")');
|
|
916
|
+
}
|
|
917
|
+
})();
|
|
918
|
+
return v_error === undefined ? null : v_error;
|
|
919
|
+
}
|
|
920
|
+
const RepresentationType = 'UsageTypeOutputRepresentation';
|
|
921
|
+
function keyBuilder$2(luvio, config) {
|
|
922
|
+
return keyPrefix + '::' + RepresentationType + ':' + config.id;
|
|
923
|
+
}
|
|
924
|
+
function keyBuilderFromType(luvio, object) {
|
|
925
|
+
const keyParams = {
|
|
926
|
+
id: object.usageType
|
|
927
|
+
};
|
|
928
|
+
return keyBuilder$2(luvio, keyParams);
|
|
929
|
+
}
|
|
930
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
931
|
+
return input;
|
|
932
|
+
}
|
|
933
|
+
const select$2 = function UsageTypeOutputRepresentationSelect() {
|
|
934
|
+
return {
|
|
935
|
+
kind: 'Fragment',
|
|
936
|
+
version: VERSION,
|
|
937
|
+
private: [],
|
|
938
|
+
opaque: true
|
|
939
|
+
};
|
|
940
|
+
};
|
|
941
|
+
function equals(existing, incoming) {
|
|
942
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
943
|
+
return false;
|
|
944
|
+
}
|
|
945
|
+
return true;
|
|
946
|
+
}
|
|
947
|
+
const ingest = function UsageTypeOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
948
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
949
|
+
const validateError = validate(input);
|
|
950
|
+
if (validateError !== null) {
|
|
951
|
+
throw validateError;
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
const key = keyBuilderFromType(luvio, input);
|
|
955
|
+
const ttlToUse = TTL;
|
|
956
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "contextrules", VERSION, RepresentationType, equals);
|
|
957
|
+
return createLink(key);
|
|
958
|
+
};
|
|
959
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
960
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
961
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
962
|
+
rootKeySet.set(rootKey, {
|
|
963
|
+
namespace: keyPrefix,
|
|
964
|
+
representationName: RepresentationType,
|
|
965
|
+
mergeable: false
|
|
966
|
+
});
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
function select$1(luvio, params) {
|
|
970
|
+
return select$2();
|
|
971
|
+
}
|
|
972
|
+
function keyBuilder$1(luvio, params) {
|
|
973
|
+
return keyBuilder$2(luvio, {
|
|
974
|
+
id: params.urlParams.usageType
|
|
975
|
+
});
|
|
976
|
+
}
|
|
977
|
+
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
978
|
+
getTypeCacheKeys(storeKeyMap, luvio, response);
|
|
979
|
+
}
|
|
980
|
+
function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
|
|
981
|
+
const { body } = response;
|
|
982
|
+
const key = keyBuilder$1(luvio, resourceParams);
|
|
983
|
+
luvio.storeIngest(key, ingest, body);
|
|
984
|
+
const snapshot = luvio.storeLookup({
|
|
985
|
+
recordId: key,
|
|
986
|
+
node: select$1(),
|
|
987
|
+
variables: {},
|
|
988
|
+
}, snapshotRefresh);
|
|
989
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
990
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
991
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
deepFreeze(snapshot.data);
|
|
995
|
+
return snapshot;
|
|
996
|
+
}
|
|
997
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
998
|
+
const key = keyBuilder$1(luvio, params);
|
|
999
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1000
|
+
const storeMetadataParams = {
|
|
1001
|
+
ttl: TTL,
|
|
1002
|
+
namespace: keyPrefix,
|
|
1003
|
+
version: VERSION,
|
|
1004
|
+
representationName: RepresentationType
|
|
1005
|
+
};
|
|
1006
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
1007
|
+
return errorSnapshot;
|
|
1008
|
+
}
|
|
1009
|
+
function createResourceRequest$1(config) {
|
|
1010
|
+
const headers = {};
|
|
1011
|
+
return {
|
|
1012
|
+
baseUri: '/services/data/v66.0',
|
|
1013
|
+
basePath: '/connect/context-rules/usage-types/' + config.urlParams.usageType + '',
|
|
1014
|
+
method: 'get',
|
|
1015
|
+
body: null,
|
|
1016
|
+
urlParams: config.urlParams,
|
|
1017
|
+
queryParams: {},
|
|
1018
|
+
headers,
|
|
1019
|
+
priority: 'normal',
|
|
1020
|
+
};
|
|
1021
|
+
}
|
|
1022
|
+
function createResourceRequestFromRepresentation(representation) {
|
|
1023
|
+
const config = {
|
|
1024
|
+
urlParams: {},
|
|
1025
|
+
};
|
|
1026
|
+
config.urlParams.usageType = representation.usageType;
|
|
1027
|
+
return createResourceRequest$1(config);
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
const adapterName$1 = 'getUsageTypeDetail';
|
|
1031
|
+
const getUsageTypeDetail_ConfigPropertyMetadata = [
|
|
1032
|
+
generateParamConfigMetadata('usageType', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1033
|
+
];
|
|
1034
|
+
const getUsageTypeDetail_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getUsageTypeDetail_ConfigPropertyMetadata);
|
|
1035
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$6(getUsageTypeDetail_ConfigPropertyMetadata);
|
|
1036
|
+
function keyBuilder(luvio, config) {
|
|
1037
|
+
const resourceParams = createResourceParams$1(config);
|
|
1038
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
1039
|
+
}
|
|
1040
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
1041
|
+
const config = {};
|
|
1042
|
+
typeCheckConfig$6(untrustedConfig, config, getUsageTypeDetail_ConfigPropertyMetadata);
|
|
1043
|
+
return config;
|
|
1044
|
+
}
|
|
1045
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
1046
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1047
|
+
return null;
|
|
1048
|
+
}
|
|
1049
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1050
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1051
|
+
}
|
|
1052
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
1053
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1054
|
+
return null;
|
|
1055
|
+
}
|
|
1056
|
+
return config;
|
|
1057
|
+
}
|
|
1058
|
+
function adapterFragment(luvio, config) {
|
|
1059
|
+
createResourceParams$1(config);
|
|
1060
|
+
return select$1();
|
|
1061
|
+
}
|
|
1062
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
1063
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
|
|
1064
|
+
config,
|
|
1065
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
1066
|
+
});
|
|
1067
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1068
|
+
}
|
|
1069
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
1070
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
1071
|
+
config,
|
|
1072
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
1073
|
+
});
|
|
1074
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1075
|
+
}
|
|
1076
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
1077
|
+
const resourceParams = createResourceParams$1(config);
|
|
1078
|
+
const request = createResourceRequest$1(resourceParams);
|
|
1079
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1080
|
+
.then((response) => {
|
|
1081
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
1082
|
+
const cache = new StoreKeyMap();
|
|
1083
|
+
getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
|
|
1084
|
+
return cache;
|
|
1085
|
+
});
|
|
1086
|
+
}, (response) => {
|
|
1087
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
1088
|
+
});
|
|
1089
|
+
}
|
|
1090
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
1091
|
+
return buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
|
|
1092
|
+
}
|
|
1093
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
1094
|
+
const { luvio, config } = context;
|
|
1095
|
+
const selector = {
|
|
1096
|
+
recordId: keyBuilder(luvio, config),
|
|
1097
|
+
node: adapterFragment(luvio, config),
|
|
1098
|
+
variables: {},
|
|
1099
|
+
};
|
|
1100
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
1101
|
+
config,
|
|
1102
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
1103
|
+
});
|
|
1104
|
+
return cacheSnapshot;
|
|
1105
|
+
}
|
|
1106
|
+
const getUsageTypeDetailAdapterFactory = (luvio) => function contextrules__getUsageTypeDetail(untrustedConfig, requestContext) {
|
|
1107
|
+
const config = validateAdapterConfig$1(untrustedConfig, getUsageTypeDetail_ConfigPropertyNames);
|
|
1108
|
+
// Invalid or incomplete config
|
|
1109
|
+
if (config === null) {
|
|
1110
|
+
return null;
|
|
1111
|
+
}
|
|
1112
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1113
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
1114
|
+
};
|
|
1115
|
+
const notifyChangeFactory = (luvio, options) => {
|
|
1116
|
+
return function getConnectContextRulesUsageTypesByUsageTypeNotifyChange(configs) {
|
|
1117
|
+
const keys = configs.map(c => keyBuilder$2(luvio, c));
|
|
1118
|
+
luvio.getNotifyChangeStoreEntries(keys).then(entries => {
|
|
1119
|
+
for (let i = 0, len = entries.length; i < len; i++) {
|
|
1120
|
+
const { key, record: val } = entries[i];
|
|
1121
|
+
const refreshRequest = createResourceRequestFromRepresentation(val);
|
|
1122
|
+
luvio.dispatchResourceRequest(refreshRequest, options)
|
|
1123
|
+
.then((response) => {
|
|
1124
|
+
return luvio.handleSuccessResponse(() => {
|
|
1125
|
+
const { body } = response;
|
|
1126
|
+
luvio.storeIngest(key, ingest, body);
|
|
1127
|
+
return luvio.storeBroadcast();
|
|
1128
|
+
}, () => {
|
|
1129
|
+
const cache = new StoreKeyMap();
|
|
1130
|
+
getTypeCacheKeys(cache, luvio, response.body);
|
|
1131
|
+
return cache;
|
|
1132
|
+
});
|
|
1133
|
+
}, (error) => {
|
|
1134
|
+
return luvio.handleErrorResponse(() => {
|
|
1135
|
+
const errorSnapshot = luvio.errorSnapshot(error);
|
|
1136
|
+
luvio.storeIngestError(key, errorSnapshot, {
|
|
1137
|
+
ttl: TTL,
|
|
1138
|
+
namespace: keyPrefix,
|
|
1139
|
+
version: VERSION,
|
|
1140
|
+
representationName: RepresentationType
|
|
1141
|
+
});
|
|
1142
|
+
return luvio.storeBroadcast().then(() => errorSnapshot);
|
|
1143
|
+
});
|
|
1144
|
+
});
|
|
1145
|
+
}
|
|
1146
|
+
});
|
|
1147
|
+
};
|
|
1148
|
+
};
|
|
1149
|
+
|
|
1150
|
+
function select(luvio, params) {
|
|
1151
|
+
return select$8();
|
|
1152
|
+
}
|
|
1153
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
1154
|
+
getTypeCacheKeys$3(storeKeyMap, luvio, response);
|
|
1155
|
+
}
|
|
1156
|
+
function ingestSuccess(luvio, resourceParams, response) {
|
|
1157
|
+
const { body } = response;
|
|
1158
|
+
const key = keyBuilderFromType$2(luvio, body);
|
|
1159
|
+
luvio.storeIngest(key, ingest$3, body);
|
|
1160
|
+
const snapshot = luvio.storeLookup({
|
|
1161
|
+
recordId: key,
|
|
1162
|
+
node: select(),
|
|
1163
|
+
variables: {},
|
|
1164
|
+
});
|
|
1165
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1166
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1167
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
deepFreeze(snapshot.data);
|
|
1171
|
+
return snapshot;
|
|
1172
|
+
}
|
|
1173
|
+
function createResourceRequest(config) {
|
|
1174
|
+
const headers = {};
|
|
1175
|
+
return {
|
|
1176
|
+
baseUri: '/services/data/v66.0',
|
|
1177
|
+
basePath: '/connect/context-rules/context-tag-mappings/rule-library-api-name/' + config.urlParams.ruleLibraryApiName + '/version-number/' + config.urlParams.versionNumber + '',
|
|
1178
|
+
method: 'patch',
|
|
1179
|
+
body: config.body,
|
|
1180
|
+
urlParams: config.urlParams,
|
|
1181
|
+
queryParams: {},
|
|
1182
|
+
headers,
|
|
1183
|
+
priority: 'normal',
|
|
1184
|
+
};
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
const adapterName = 'updateContextTagMapping';
|
|
1188
|
+
const updateContextTagMapping_ConfigPropertyMetadata = [
|
|
1189
|
+
generateParamConfigMetadata('ruleLibraryApiName', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1190
|
+
generateParamConfigMetadata('versionNumber', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1191
|
+
generateParamConfigMetadata('contextTagMappings', true, 2 /* Body */, 4 /* Unsupported */),
|
|
1192
|
+
];
|
|
1193
|
+
const updateContextTagMapping_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, updateContextTagMapping_ConfigPropertyMetadata);
|
|
1194
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$6(updateContextTagMapping_ConfigPropertyMetadata);
|
|
1195
|
+
function typeCheckConfig(untrustedConfig) {
|
|
1196
|
+
const config = {};
|
|
1197
|
+
typeCheckConfig$6(untrustedConfig, config, updateContextTagMapping_ConfigPropertyMetadata);
|
|
1198
|
+
const untrustedConfig_contextTagMappings = untrustedConfig.contextTagMappings;
|
|
1199
|
+
const referenceRuleLibraryTagMappingsListWrapperRepresentationValidationError = validate$5(untrustedConfig_contextTagMappings);
|
|
1200
|
+
if (referenceRuleLibraryTagMappingsListWrapperRepresentationValidationError === null) {
|
|
1201
|
+
config.contextTagMappings = untrustedConfig_contextTagMappings;
|
|
1202
|
+
}
|
|
1203
|
+
return config;
|
|
1204
|
+
}
|
|
1205
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
1206
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1207
|
+
return null;
|
|
1208
|
+
}
|
|
1209
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1210
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1211
|
+
}
|
|
1212
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
1213
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1214
|
+
return null;
|
|
1215
|
+
}
|
|
1216
|
+
return config;
|
|
1217
|
+
}
|
|
1218
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
1219
|
+
const resourceParams = createResourceParams(config);
|
|
1220
|
+
const request = createResourceRequest(resourceParams);
|
|
1221
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1222
|
+
.then((response) => {
|
|
1223
|
+
return luvio.handleSuccessResponse(() => {
|
|
1224
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
1225
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1226
|
+
}, () => {
|
|
1227
|
+
const cache = new StoreKeyMap();
|
|
1228
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
1229
|
+
return cache;
|
|
1230
|
+
});
|
|
1231
|
+
}, (response) => {
|
|
1232
|
+
deepFreeze(response);
|
|
1233
|
+
throw response;
|
|
1234
|
+
});
|
|
1235
|
+
}
|
|
1236
|
+
const updateContextTagMappingAdapterFactory = (luvio) => {
|
|
1237
|
+
return function updateContextTagMapping(untrustedConfig) {
|
|
1238
|
+
const config = validateAdapterConfig(untrustedConfig, updateContextTagMapping_ConfigPropertyNames);
|
|
1239
|
+
// Invalid or incomplete config
|
|
1240
|
+
if (config === null) {
|
|
1241
|
+
throw new Error('Invalid config for "updateContextTagMapping"');
|
|
1242
|
+
}
|
|
1243
|
+
return buildNetworkSnapshot(luvio, config);
|
|
1244
|
+
};
|
|
1245
|
+
};
|
|
1246
|
+
|
|
1247
|
+
let createContextTagMapping;
|
|
1248
|
+
let deleteContextTagMapping;
|
|
1249
|
+
let getContextTagMapping;
|
|
1250
|
+
let getContextTagMappingNotifyChange;
|
|
1251
|
+
let getContextTagMappings;
|
|
1252
|
+
let getUsageTypeDetail;
|
|
1253
|
+
let getUsageTypeDetailNotifyChange;
|
|
1254
|
+
let updateContextTagMapping;
|
|
1255
|
+
// Imperative GET Adapters
|
|
1256
|
+
let getContextTagMapping_imperative;
|
|
1257
|
+
let getContextTagMappings_imperative;
|
|
1258
|
+
let getUsageTypeDetail_imperative;
|
|
1259
|
+
const getContextTagMappingMetadata = {
|
|
1260
|
+
apiFamily: 'contextrules',
|
|
1261
|
+
name: 'getContextTagMapping',
|
|
1262
|
+
ttl: 1000,
|
|
1263
|
+
};
|
|
1264
|
+
const getContextTagMappingsMetadata = {
|
|
1265
|
+
apiFamily: 'contextrules',
|
|
1266
|
+
name: 'getContextTagMappings',
|
|
1267
|
+
ttl: 1000,
|
|
1268
|
+
};
|
|
1269
|
+
const getUsageTypeDetailMetadata = {
|
|
1270
|
+
apiFamily: 'contextrules',
|
|
1271
|
+
name: 'getUsageTypeDetail',
|
|
1272
|
+
ttl: 1000,
|
|
1273
|
+
};
|
|
1274
|
+
// Notify Update Available
|
|
1275
|
+
function bindExportsTo(luvio) {
|
|
1276
|
+
// LDS Adapters
|
|
1277
|
+
const getContextTagMapping_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getContextTagMapping', getContextTagMappingAdapterFactory), getContextTagMappingMetadata);
|
|
1278
|
+
const getContextTagMappings_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getContextTagMappings', getContextTagMappingsAdapterFactory), getContextTagMappingsMetadata);
|
|
1279
|
+
const getUsageTypeDetail_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getUsageTypeDetail', getUsageTypeDetailAdapterFactory), getUsageTypeDetailMetadata);
|
|
1280
|
+
function unwrapSnapshotData(factory) {
|
|
1281
|
+
const adapter = factory(luvio);
|
|
1282
|
+
return (config) => adapter(config).then((snapshot) => snapshot.data);
|
|
1283
|
+
}
|
|
1284
|
+
return {
|
|
1285
|
+
createContextTagMapping: unwrapSnapshotData(createContextTagMappingAdapterFactory),
|
|
1286
|
+
deleteContextTagMapping: createLDSAdapter(luvio, adapterName$4, deleteContextTagMappingAdapterFactory),
|
|
1287
|
+
getContextTagMapping: createWireAdapterConstructor(luvio, getContextTagMapping_ldsAdapter, getContextTagMappingMetadata),
|
|
1288
|
+
getContextTagMappingNotifyChange: createLDSAdapter(luvio, 'getContextTagMappingNotifyChange', notifyChangeFactory$1),
|
|
1289
|
+
getContextTagMappings: createWireAdapterConstructor(luvio, getContextTagMappings_ldsAdapter, getContextTagMappingsMetadata),
|
|
1290
|
+
getUsageTypeDetail: createWireAdapterConstructor(luvio, getUsageTypeDetail_ldsAdapter, getUsageTypeDetailMetadata),
|
|
1291
|
+
getUsageTypeDetailNotifyChange: createLDSAdapter(luvio, 'getUsageTypeDetailNotifyChange', notifyChangeFactory),
|
|
1292
|
+
updateContextTagMapping: unwrapSnapshotData(updateContextTagMappingAdapterFactory),
|
|
1293
|
+
// Imperative GET Adapters
|
|
1294
|
+
getContextTagMapping_imperative: createImperativeAdapter(luvio, getContextTagMapping_ldsAdapter, getContextTagMappingMetadata),
|
|
1295
|
+
getContextTagMappings_imperative: createImperativeAdapter(luvio, getContextTagMappings_ldsAdapter, getContextTagMappingsMetadata),
|
|
1296
|
+
getUsageTypeDetail_imperative: createImperativeAdapter(luvio, getUsageTypeDetail_ldsAdapter, getUsageTypeDetailMetadata),
|
|
1297
|
+
// Notify Update Availables
|
|
1298
|
+
};
|
|
1299
|
+
}
|
|
1300
|
+
withDefaultLuvio((luvio) => {
|
|
1301
|
+
({
|
|
1302
|
+
createContextTagMapping,
|
|
1303
|
+
deleteContextTagMapping,
|
|
1304
|
+
getContextTagMapping,
|
|
1305
|
+
getContextTagMappingNotifyChange,
|
|
1306
|
+
getContextTagMappings,
|
|
1307
|
+
getUsageTypeDetail,
|
|
1308
|
+
getUsageTypeDetailNotifyChange,
|
|
1309
|
+
updateContextTagMapping,
|
|
1310
|
+
getContextTagMapping_imperative,
|
|
1311
|
+
getContextTagMappings_imperative,
|
|
1312
|
+
getUsageTypeDetail_imperative,
|
|
1313
|
+
} = bindExportsTo(luvio));
|
|
1314
|
+
});
|
|
1315
|
+
|
|
1316
|
+
export { createContextTagMapping, deleteContextTagMapping, getContextTagMapping, getContextTagMappingNotifyChange, getContextTagMapping_imperative, getContextTagMappings, getContextTagMappings_imperative, getUsageTypeDetail, getUsageTypeDetailNotifyChange, getUsageTypeDetail_imperative, updateContextTagMapping };
|
|
1317
|
+
// version: 0.1.0-dev1-c978a7b010
|