@salesforce/lds-adapters-industries-guardrail 1.316.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-guardrail.js +943 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/getIndustriesGuardrail.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/adapters/getIndustriesGuardrails.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/adapters/postValidateGuardrail.d.ts +14 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +3 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +6 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectIndustriesGuardrail.d.ts +17 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectIndustriesGuardrails.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/resources/postConnectIndustriesGuardrailValidate.d.ts +9 -0
- package/dist/es/es2018/types/src/generated/types/GuardrailDetailRepresentation.d.ts +50 -0
- package/dist/es/es2018/types/src/generated/types/IndustriesGuardrailInputRepresentation.d.ts +38 -0
- package/dist/es/es2018/types/src/generated/types/IndustriesGuardrailListRepresentation.d.ts +39 -0
- package/dist/es/es2018/types/src/generated/types/IndustriesGuardrailRepresentation.d.ts +39 -0
- package/dist/es/es2018/types/src/generated/types/MessageRepresentation.d.ts +35 -0
- package/dist/es/es2018/types/src/generated/types/ValidationMessageRepresentation.d.ts +45 -0
- package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
- package/package.json +66 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +1000 -0
- package/src/raml/api.raml +155 -0
- package/src/raml/luvio.raml +46 -0
|
@@ -0,0 +1,943 @@
|
|
|
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$3, StoreKeyMap, createResourceParams as createResourceParams$3 } 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 = 'Guardrail';
|
|
73
|
+
|
|
74
|
+
const { isArray: ArrayIsArray } = Array;
|
|
75
|
+
function equalsArray(a, b, equalsItem) {
|
|
76
|
+
const aLength = a.length;
|
|
77
|
+
const bLength = b.length;
|
|
78
|
+
if (aLength !== bLength) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
for (let i = 0; i < aLength; i++) {
|
|
82
|
+
if (equalsItem(a[i], b[i]) === false) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
function createLink(ref) {
|
|
89
|
+
return {
|
|
90
|
+
__ref: serializeStructuredKey(ref),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const VERSION$4 = "a1acf0d83a1b62fc32e4b546fc4efa95";
|
|
95
|
+
function validate$4(obj, path = 'MessageRepresentation') {
|
|
96
|
+
const v_error = (() => {
|
|
97
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
98
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
99
|
+
}
|
|
100
|
+
const obj_code = obj.code;
|
|
101
|
+
const path_code = path + '.code';
|
|
102
|
+
if (typeof obj_code !== 'string') {
|
|
103
|
+
return new TypeError('Expected "string" but received "' + typeof obj_code + '" (at "' + path_code + '")');
|
|
104
|
+
}
|
|
105
|
+
const obj_exceptionmessage = obj.exceptionmessage;
|
|
106
|
+
const path_exceptionmessage = path + '.exceptionmessage';
|
|
107
|
+
if (typeof obj_exceptionmessage !== 'string') {
|
|
108
|
+
return new TypeError('Expected "string" but received "' + typeof obj_exceptionmessage + '" (at "' + path_exceptionmessage + '")');
|
|
109
|
+
}
|
|
110
|
+
const obj_type = obj.type;
|
|
111
|
+
const path_type = path + '.type';
|
|
112
|
+
if (typeof obj_type !== 'string') {
|
|
113
|
+
return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
|
|
114
|
+
}
|
|
115
|
+
})();
|
|
116
|
+
return v_error === undefined ? null : v_error;
|
|
117
|
+
}
|
|
118
|
+
const select$7 = function MessageRepresentationSelect() {
|
|
119
|
+
return {
|
|
120
|
+
kind: 'Fragment',
|
|
121
|
+
version: VERSION$4,
|
|
122
|
+
private: [],
|
|
123
|
+
selections: [
|
|
124
|
+
{
|
|
125
|
+
name: 'code',
|
|
126
|
+
kind: 'Scalar'
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: 'exceptionmessage',
|
|
130
|
+
kind: 'Scalar'
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: 'type',
|
|
134
|
+
kind: 'Scalar'
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
function equals$4(existing, incoming) {
|
|
140
|
+
const existing_code = existing.code;
|
|
141
|
+
const incoming_code = incoming.code;
|
|
142
|
+
if (!(existing_code === incoming_code)) {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
const existing_exceptionmessage = existing.exceptionmessage;
|
|
146
|
+
const incoming_exceptionmessage = incoming.exceptionmessage;
|
|
147
|
+
if (!(existing_exceptionmessage === incoming_exceptionmessage)) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
const existing_type = existing.type;
|
|
151
|
+
const incoming_type = incoming.type;
|
|
152
|
+
if (!(existing_type === incoming_type)) {
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const TTL$3 = 60000;
|
|
159
|
+
const VERSION$3 = "07e24b92bd05c260032c4a19832828da";
|
|
160
|
+
function validate$3(obj, path = 'GuardrailDetailRepresentation') {
|
|
161
|
+
const v_error = (() => {
|
|
162
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
163
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
164
|
+
}
|
|
165
|
+
const obj_guardRailMaxValue = obj.guardRailMaxValue;
|
|
166
|
+
const path_guardRailMaxValue = path + '.guardRailMaxValue';
|
|
167
|
+
if (typeof obj_guardRailMaxValue !== 'string') {
|
|
168
|
+
return new TypeError('Expected "string" but received "' + typeof obj_guardRailMaxValue + '" (at "' + path_guardRailMaxValue + '")');
|
|
169
|
+
}
|
|
170
|
+
const obj_guardRailMinValue = obj.guardRailMinValue;
|
|
171
|
+
const path_guardRailMinValue = path + '.guardRailMinValue';
|
|
172
|
+
if (typeof obj_guardRailMinValue !== 'string') {
|
|
173
|
+
return new TypeError('Expected "string" but received "' + typeof obj_guardRailMinValue + '" (at "' + path_guardRailMinValue + '")');
|
|
174
|
+
}
|
|
175
|
+
const obj_guardRailName = obj.guardRailName;
|
|
176
|
+
const path_guardRailName = path + '.guardRailName';
|
|
177
|
+
if (typeof obj_guardRailName !== 'string') {
|
|
178
|
+
return new TypeError('Expected "string" but received "' + typeof obj_guardRailName + '" (at "' + path_guardRailName + '")');
|
|
179
|
+
}
|
|
180
|
+
const obj_guardRailRestrictionType = obj.guardRailRestrictionType;
|
|
181
|
+
const path_guardRailRestrictionType = path + '.guardRailRestrictionType';
|
|
182
|
+
if (typeof obj_guardRailRestrictionType !== 'string') {
|
|
183
|
+
return new TypeError('Expected "string" but received "' + typeof obj_guardRailRestrictionType + '" (at "' + path_guardRailRestrictionType + '")');
|
|
184
|
+
}
|
|
185
|
+
const obj_message = obj.message;
|
|
186
|
+
const path_message = path + '.message';
|
|
187
|
+
const referencepath_messageValidationError = validate$4(obj_message, path_message);
|
|
188
|
+
if (referencepath_messageValidationError !== null) {
|
|
189
|
+
let message = 'Object doesn\'t match MessageRepresentation (at "' + path_message + '")\n';
|
|
190
|
+
message += referencepath_messageValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
191
|
+
return new TypeError(message);
|
|
192
|
+
}
|
|
193
|
+
})();
|
|
194
|
+
return v_error === undefined ? null : v_error;
|
|
195
|
+
}
|
|
196
|
+
const RepresentationType$3 = 'GuardrailDetailRepresentation';
|
|
197
|
+
function keyBuilder$5(luvio, config) {
|
|
198
|
+
return keyPrefix + '::' + RepresentationType$3 + ':' + config.guardRailName;
|
|
199
|
+
}
|
|
200
|
+
function keyBuilderFromType$1(luvio, object) {
|
|
201
|
+
const keyParams = {
|
|
202
|
+
guardRailName: object.guardRailName
|
|
203
|
+
};
|
|
204
|
+
return keyBuilder$5(luvio, keyParams);
|
|
205
|
+
}
|
|
206
|
+
function normalize$3(input, existing, path, luvio, store, timestamp) {
|
|
207
|
+
return input;
|
|
208
|
+
}
|
|
209
|
+
const select$6 = function GuardrailDetailRepresentationSelect() {
|
|
210
|
+
const { selections: MessageRepresentation__selections, opaque: MessageRepresentation__opaque, } = select$7();
|
|
211
|
+
return {
|
|
212
|
+
kind: 'Fragment',
|
|
213
|
+
version: VERSION$3,
|
|
214
|
+
private: [],
|
|
215
|
+
selections: [
|
|
216
|
+
{
|
|
217
|
+
name: 'guardRailMaxValue',
|
|
218
|
+
kind: 'Scalar'
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
name: 'guardRailMinValue',
|
|
222
|
+
kind: 'Scalar'
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
name: 'guardRailName',
|
|
226
|
+
kind: 'Scalar'
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
name: 'guardRailRestrictionType',
|
|
230
|
+
kind: 'Scalar'
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
name: 'message',
|
|
234
|
+
kind: 'Object',
|
|
235
|
+
selections: MessageRepresentation__selections
|
|
236
|
+
}
|
|
237
|
+
]
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
function equals$3(existing, incoming) {
|
|
241
|
+
const existing_guardRailMaxValue = existing.guardRailMaxValue;
|
|
242
|
+
const incoming_guardRailMaxValue = incoming.guardRailMaxValue;
|
|
243
|
+
if (!(existing_guardRailMaxValue === incoming_guardRailMaxValue)) {
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
246
|
+
const existing_guardRailMinValue = existing.guardRailMinValue;
|
|
247
|
+
const incoming_guardRailMinValue = incoming.guardRailMinValue;
|
|
248
|
+
if (!(existing_guardRailMinValue === incoming_guardRailMinValue)) {
|
|
249
|
+
return false;
|
|
250
|
+
}
|
|
251
|
+
const existing_guardRailName = existing.guardRailName;
|
|
252
|
+
const incoming_guardRailName = incoming.guardRailName;
|
|
253
|
+
if (!(existing_guardRailName === incoming_guardRailName)) {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
const existing_guardRailRestrictionType = existing.guardRailRestrictionType;
|
|
257
|
+
const incoming_guardRailRestrictionType = incoming.guardRailRestrictionType;
|
|
258
|
+
if (!(existing_guardRailRestrictionType === incoming_guardRailRestrictionType)) {
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
const existing_message = existing.message;
|
|
262
|
+
const incoming_message = incoming.message;
|
|
263
|
+
if (!(equals$4(existing_message, incoming_message))) {
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
return true;
|
|
267
|
+
}
|
|
268
|
+
const ingest$3 = function GuardrailDetailRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
269
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
270
|
+
const validateError = validate$3(input);
|
|
271
|
+
if (validateError !== null) {
|
|
272
|
+
throw validateError;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
const key = keyBuilderFromType$1(luvio, input);
|
|
276
|
+
const ttlToUse = TTL$3;
|
|
277
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$3, "Guardrail", VERSION$3, RepresentationType$3, equals$3);
|
|
278
|
+
return createLink(key);
|
|
279
|
+
};
|
|
280
|
+
function getTypeCacheKeys$3(rootKeySet, luvio, input, fullPathFactory) {
|
|
281
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
282
|
+
const rootKey = keyBuilderFromType$1(luvio, input);
|
|
283
|
+
rootKeySet.set(rootKey, {
|
|
284
|
+
namespace: keyPrefix,
|
|
285
|
+
representationName: RepresentationType$3,
|
|
286
|
+
mergeable: false
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const TTL$2 = 60000;
|
|
291
|
+
const VERSION$2 = "59c734462982ee5ac130c47f27d71244";
|
|
292
|
+
function validate$2(obj, path = 'IndustriesGuardrailRepresentation') {
|
|
293
|
+
const v_error = (() => {
|
|
294
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
295
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
296
|
+
}
|
|
297
|
+
const obj_industriesGuardrail = obj.industriesGuardrail;
|
|
298
|
+
const path_industriesGuardrail = path + '.industriesGuardrail';
|
|
299
|
+
if (typeof obj_industriesGuardrail !== 'object') {
|
|
300
|
+
return new TypeError('Expected "object" but received "' + typeof obj_industriesGuardrail + '" (at "' + path_industriesGuardrail + '")');
|
|
301
|
+
}
|
|
302
|
+
})();
|
|
303
|
+
return v_error === undefined ? null : v_error;
|
|
304
|
+
}
|
|
305
|
+
const RepresentationType$2 = 'IndustriesGuardrailRepresentation';
|
|
306
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
307
|
+
const input_industriesGuardrail = input.industriesGuardrail;
|
|
308
|
+
const input_industriesGuardrail_id = path.fullPath + '__industriesGuardrail';
|
|
309
|
+
input.industriesGuardrail = ingest$3(input_industriesGuardrail, {
|
|
310
|
+
fullPath: input_industriesGuardrail_id,
|
|
311
|
+
propertyName: 'industriesGuardrail',
|
|
312
|
+
parent: {
|
|
313
|
+
data: input,
|
|
314
|
+
key: path.fullPath,
|
|
315
|
+
existing: existing,
|
|
316
|
+
},
|
|
317
|
+
ttl: path.ttl
|
|
318
|
+
}, luvio, store, timestamp);
|
|
319
|
+
return input;
|
|
320
|
+
}
|
|
321
|
+
const select$5 = function IndustriesGuardrailRepresentationSelect() {
|
|
322
|
+
return {
|
|
323
|
+
kind: 'Fragment',
|
|
324
|
+
version: VERSION$2,
|
|
325
|
+
private: [],
|
|
326
|
+
selections: [
|
|
327
|
+
{
|
|
328
|
+
name: 'industriesGuardrail',
|
|
329
|
+
kind: 'Link',
|
|
330
|
+
fragment: select$6()
|
|
331
|
+
}
|
|
332
|
+
]
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
function equals$2(existing, incoming) {
|
|
336
|
+
const existing_industriesGuardrail = existing.industriesGuardrail;
|
|
337
|
+
const incoming_industriesGuardrail = incoming.industriesGuardrail;
|
|
338
|
+
if (!(existing_industriesGuardrail.__ref === incoming_industriesGuardrail.__ref)) {
|
|
339
|
+
return false;
|
|
340
|
+
}
|
|
341
|
+
return true;
|
|
342
|
+
}
|
|
343
|
+
const ingest$2 = function IndustriesGuardrailRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
344
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
345
|
+
const validateError = validate$2(input);
|
|
346
|
+
if (validateError !== null) {
|
|
347
|
+
throw validateError;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
const key = path.fullPath;
|
|
351
|
+
const ttlToUse = TTL$2;
|
|
352
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "Guardrail", VERSION$2, RepresentationType$2, equals$2);
|
|
353
|
+
return createLink(key);
|
|
354
|
+
};
|
|
355
|
+
function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
|
|
356
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
357
|
+
const rootKey = fullPathFactory();
|
|
358
|
+
rootKeySet.set(rootKey, {
|
|
359
|
+
namespace: keyPrefix,
|
|
360
|
+
representationName: RepresentationType$2,
|
|
361
|
+
mergeable: false
|
|
362
|
+
});
|
|
363
|
+
getTypeCacheKeys$3(rootKeySet, luvio, input.industriesGuardrail);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
function select$4(luvio, params) {
|
|
367
|
+
return select$5();
|
|
368
|
+
}
|
|
369
|
+
function keyBuilder$4(luvio, params) {
|
|
370
|
+
return keyPrefix + '::IndustriesGuardrailRepresentation:(' + 'component:' + params.queryParams.component + ',' + 'name:' + params.queryParams.name + ',' + 'product:' + params.queryParams.product + ')';
|
|
371
|
+
}
|
|
372
|
+
function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
|
|
373
|
+
getTypeCacheKeys$2(storeKeyMap, luvio, response, () => keyBuilder$4(luvio, resourceParams));
|
|
374
|
+
}
|
|
375
|
+
function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
|
|
376
|
+
const { body } = response;
|
|
377
|
+
const key = keyBuilder$4(luvio, resourceParams);
|
|
378
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
379
|
+
const snapshot = luvio.storeLookup({
|
|
380
|
+
recordId: key,
|
|
381
|
+
node: select$4(),
|
|
382
|
+
variables: {},
|
|
383
|
+
}, snapshotRefresh);
|
|
384
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
385
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
386
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
deepFreeze(snapshot.data);
|
|
390
|
+
return snapshot;
|
|
391
|
+
}
|
|
392
|
+
function ingestError$1(luvio, params, error, snapshotRefresh) {
|
|
393
|
+
const key = keyBuilder$4(luvio, params);
|
|
394
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
395
|
+
const storeMetadataParams = {
|
|
396
|
+
ttl: TTL$2,
|
|
397
|
+
namespace: keyPrefix,
|
|
398
|
+
version: VERSION$2,
|
|
399
|
+
representationName: RepresentationType$2
|
|
400
|
+
};
|
|
401
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
402
|
+
return errorSnapshot;
|
|
403
|
+
}
|
|
404
|
+
function createResourceRequest$2(config) {
|
|
405
|
+
const headers = {};
|
|
406
|
+
return {
|
|
407
|
+
baseUri: '/services/data/v63.0',
|
|
408
|
+
basePath: '/connect/industries/guardrail',
|
|
409
|
+
method: 'get',
|
|
410
|
+
body: null,
|
|
411
|
+
urlParams: {},
|
|
412
|
+
queryParams: config.queryParams,
|
|
413
|
+
headers,
|
|
414
|
+
priority: 'normal',
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
const adapterName$2 = 'getIndustriesGuardrail';
|
|
419
|
+
const getIndustriesGuardrail_ConfigPropertyMetadata = [
|
|
420
|
+
generateParamConfigMetadata('component', false, 1 /* QueryParameter */, 0 /* String */),
|
|
421
|
+
generateParamConfigMetadata('name', false, 1 /* QueryParameter */, 0 /* String */),
|
|
422
|
+
generateParamConfigMetadata('product', false, 1 /* QueryParameter */, 0 /* String */),
|
|
423
|
+
];
|
|
424
|
+
const getIndustriesGuardrail_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getIndustriesGuardrail_ConfigPropertyMetadata);
|
|
425
|
+
const createResourceParams$2 = /*#__PURE__*/ createResourceParams$3(getIndustriesGuardrail_ConfigPropertyMetadata);
|
|
426
|
+
function keyBuilder$3(luvio, config) {
|
|
427
|
+
const resourceParams = createResourceParams$2(config);
|
|
428
|
+
return keyBuilder$4(luvio, resourceParams);
|
|
429
|
+
}
|
|
430
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
431
|
+
const config = {};
|
|
432
|
+
typeCheckConfig$3(untrustedConfig, config, getIndustriesGuardrail_ConfigPropertyMetadata);
|
|
433
|
+
return config;
|
|
434
|
+
}
|
|
435
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
436
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
437
|
+
return null;
|
|
438
|
+
}
|
|
439
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
440
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
441
|
+
}
|
|
442
|
+
const config = typeCheckConfig$2(untrustedConfig);
|
|
443
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
444
|
+
return null;
|
|
445
|
+
}
|
|
446
|
+
return config;
|
|
447
|
+
}
|
|
448
|
+
function adapterFragment$1(luvio, config) {
|
|
449
|
+
createResourceParams$2(config);
|
|
450
|
+
return select$4();
|
|
451
|
+
}
|
|
452
|
+
function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
|
|
453
|
+
const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
|
|
454
|
+
config,
|
|
455
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
456
|
+
});
|
|
457
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
458
|
+
}
|
|
459
|
+
function onFetchResponseError$1(luvio, config, resourceParams, response) {
|
|
460
|
+
const snapshot = ingestError$1(luvio, resourceParams, response, {
|
|
461
|
+
config,
|
|
462
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
463
|
+
});
|
|
464
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
465
|
+
}
|
|
466
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
467
|
+
const resourceParams = createResourceParams$2(config);
|
|
468
|
+
const request = createResourceRequest$2(resourceParams);
|
|
469
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
470
|
+
.then((response) => {
|
|
471
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
|
|
472
|
+
const cache = new StoreKeyMap();
|
|
473
|
+
getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
|
|
474
|
+
return cache;
|
|
475
|
+
});
|
|
476
|
+
}, (response) => {
|
|
477
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
|
|
481
|
+
return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, undefined, false);
|
|
482
|
+
}
|
|
483
|
+
function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
|
|
484
|
+
const { luvio, config } = context;
|
|
485
|
+
const selector = {
|
|
486
|
+
recordId: keyBuilder$3(luvio, config),
|
|
487
|
+
node: adapterFragment$1(luvio, config),
|
|
488
|
+
variables: {},
|
|
489
|
+
};
|
|
490
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
491
|
+
config,
|
|
492
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
493
|
+
});
|
|
494
|
+
return cacheSnapshot;
|
|
495
|
+
}
|
|
496
|
+
const getIndustriesGuardrailAdapterFactory = (luvio) => function Guardrail__getIndustriesGuardrail(untrustedConfig, requestContext) {
|
|
497
|
+
const config = validateAdapterConfig$2(untrustedConfig, getIndustriesGuardrail_ConfigPropertyNames);
|
|
498
|
+
// Invalid or incomplete config
|
|
499
|
+
if (config === null) {
|
|
500
|
+
return null;
|
|
501
|
+
}
|
|
502
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
503
|
+
buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
|
|
504
|
+
};
|
|
505
|
+
|
|
506
|
+
const TTL$1 = 60000;
|
|
507
|
+
const VERSION$1 = "5cfade0dbffa50ea18bd23547286f851";
|
|
508
|
+
function validate$1(obj, path = 'ValidationMessageRepresentation') {
|
|
509
|
+
const v_error = (() => {
|
|
510
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
511
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
512
|
+
}
|
|
513
|
+
const obj_guardrailValue = obj.guardrailValue;
|
|
514
|
+
const path_guardrailValue = path + '.guardrailValue';
|
|
515
|
+
if (typeof obj_guardrailValue !== 'string') {
|
|
516
|
+
return new TypeError('Expected "string" but received "' + typeof obj_guardrailValue + '" (at "' + path_guardrailValue + '")');
|
|
517
|
+
}
|
|
518
|
+
if (obj.message !== undefined) {
|
|
519
|
+
const obj_message = obj.message;
|
|
520
|
+
const path_message = path + '.message';
|
|
521
|
+
const referencepath_messageValidationError = validate$4(obj_message, path_message);
|
|
522
|
+
if (referencepath_messageValidationError !== null) {
|
|
523
|
+
let message = 'Object doesn\'t match MessageRepresentation (at "' + path_message + '")\n';
|
|
524
|
+
message += referencepath_messageValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
525
|
+
return new TypeError(message);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
const obj_status = obj.status;
|
|
529
|
+
const path_status = path + '.status';
|
|
530
|
+
if (typeof obj_status !== 'string') {
|
|
531
|
+
return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
|
|
532
|
+
}
|
|
533
|
+
})();
|
|
534
|
+
return v_error === undefined ? null : v_error;
|
|
535
|
+
}
|
|
536
|
+
const RepresentationType$1 = 'ValidationMessageRepresentation';
|
|
537
|
+
function keyBuilder$2(luvio, config) {
|
|
538
|
+
return keyPrefix + '::' + RepresentationType$1 + ':' + config.guardrailValue;
|
|
539
|
+
}
|
|
540
|
+
function keyBuilderFromType(luvio, object) {
|
|
541
|
+
const keyParams = {
|
|
542
|
+
guardrailValue: object.guardrailValue
|
|
543
|
+
};
|
|
544
|
+
return keyBuilder$2(luvio, keyParams);
|
|
545
|
+
}
|
|
546
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
547
|
+
return input;
|
|
548
|
+
}
|
|
549
|
+
const select$3 = function ValidationMessageRepresentationSelect() {
|
|
550
|
+
const { selections: MessageRepresentation__selections, opaque: MessageRepresentation__opaque, } = select$7();
|
|
551
|
+
return {
|
|
552
|
+
kind: 'Fragment',
|
|
553
|
+
version: VERSION$1,
|
|
554
|
+
private: [],
|
|
555
|
+
selections: [
|
|
556
|
+
{
|
|
557
|
+
name: 'guardrailValue',
|
|
558
|
+
kind: 'Scalar'
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
name: 'message',
|
|
562
|
+
kind: 'Object',
|
|
563
|
+
selections: MessageRepresentation__selections,
|
|
564
|
+
required: false
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
name: 'status',
|
|
568
|
+
kind: 'Scalar'
|
|
569
|
+
}
|
|
570
|
+
]
|
|
571
|
+
};
|
|
572
|
+
};
|
|
573
|
+
function equals$1(existing, incoming) {
|
|
574
|
+
const existing_guardrailValue = existing.guardrailValue;
|
|
575
|
+
const incoming_guardrailValue = incoming.guardrailValue;
|
|
576
|
+
if (!(existing_guardrailValue === incoming_guardrailValue)) {
|
|
577
|
+
return false;
|
|
578
|
+
}
|
|
579
|
+
const existing_status = existing.status;
|
|
580
|
+
const incoming_status = incoming.status;
|
|
581
|
+
if (!(existing_status === incoming_status)) {
|
|
582
|
+
return false;
|
|
583
|
+
}
|
|
584
|
+
const existing_message = existing.message;
|
|
585
|
+
const incoming_message = incoming.message;
|
|
586
|
+
// if at least one of these optionals is defined
|
|
587
|
+
if (existing_message !== undefined || incoming_message !== undefined) {
|
|
588
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
589
|
+
// not equal
|
|
590
|
+
if (existing_message === undefined || incoming_message === undefined) {
|
|
591
|
+
return false;
|
|
592
|
+
}
|
|
593
|
+
if (!(equals$4(existing_message, incoming_message))) {
|
|
594
|
+
return false;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
return true;
|
|
598
|
+
}
|
|
599
|
+
const ingest$1 = function ValidationMessageRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
600
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
601
|
+
const validateError = validate$1(input);
|
|
602
|
+
if (validateError !== null) {
|
|
603
|
+
throw validateError;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
const key = keyBuilderFromType(luvio, input);
|
|
607
|
+
const ttlToUse = TTL$1;
|
|
608
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "Guardrail", VERSION$1, RepresentationType$1, equals$1);
|
|
609
|
+
return createLink(key);
|
|
610
|
+
};
|
|
611
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
612
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
613
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
614
|
+
rootKeySet.set(rootKey, {
|
|
615
|
+
namespace: keyPrefix,
|
|
616
|
+
representationName: RepresentationType$1,
|
|
617
|
+
mergeable: false
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
function select$2(luvio, params) {
|
|
622
|
+
return select$3();
|
|
623
|
+
}
|
|
624
|
+
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
625
|
+
getTypeCacheKeys$1(storeKeyMap, luvio, response);
|
|
626
|
+
}
|
|
627
|
+
function ingestSuccess$1(luvio, resourceParams, response) {
|
|
628
|
+
const { body } = response;
|
|
629
|
+
const key = keyBuilderFromType(luvio, body);
|
|
630
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
631
|
+
const snapshot = luvio.storeLookup({
|
|
632
|
+
recordId: key,
|
|
633
|
+
node: select$2(),
|
|
634
|
+
variables: {},
|
|
635
|
+
});
|
|
636
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
637
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
638
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
deepFreeze(snapshot.data);
|
|
642
|
+
return snapshot;
|
|
643
|
+
}
|
|
644
|
+
function createResourceRequest$1(config) {
|
|
645
|
+
const headers = {};
|
|
646
|
+
return {
|
|
647
|
+
baseUri: '/services/data/v63.0',
|
|
648
|
+
basePath: '/connect/industries/guardrail/validate',
|
|
649
|
+
method: 'post',
|
|
650
|
+
body: null,
|
|
651
|
+
urlParams: {},
|
|
652
|
+
queryParams: {},
|
|
653
|
+
headers,
|
|
654
|
+
priority: 'normal',
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
const adapterName$1 = 'postValidateGuardrail';
|
|
659
|
+
const postValidateGuardrail_ConfigPropertyMetadata = [];
|
|
660
|
+
const postValidateGuardrail_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, postValidateGuardrail_ConfigPropertyMetadata);
|
|
661
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(postValidateGuardrail_ConfigPropertyMetadata);
|
|
662
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
663
|
+
const config = {};
|
|
664
|
+
return config;
|
|
665
|
+
}
|
|
666
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
667
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
668
|
+
return null;
|
|
669
|
+
}
|
|
670
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
671
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
672
|
+
}
|
|
673
|
+
const config = typeCheckConfig$1();
|
|
674
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
675
|
+
return null;
|
|
676
|
+
}
|
|
677
|
+
return config;
|
|
678
|
+
}
|
|
679
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
680
|
+
const resourceParams = createResourceParams$1(config);
|
|
681
|
+
const request = createResourceRequest$1();
|
|
682
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
683
|
+
.then((response) => {
|
|
684
|
+
return luvio.handleSuccessResponse(() => {
|
|
685
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response);
|
|
686
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
687
|
+
}, () => {
|
|
688
|
+
const cache = new StoreKeyMap();
|
|
689
|
+
getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
|
|
690
|
+
return cache;
|
|
691
|
+
});
|
|
692
|
+
}, (response) => {
|
|
693
|
+
deepFreeze(response);
|
|
694
|
+
throw response;
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
const postValidateGuardrailAdapterFactory = (luvio) => {
|
|
698
|
+
return function postValidateGuardrail(untrustedConfig) {
|
|
699
|
+
const config = validateAdapterConfig$1(untrustedConfig, postValidateGuardrail_ConfigPropertyNames);
|
|
700
|
+
// Invalid or incomplete config
|
|
701
|
+
if (config === null) {
|
|
702
|
+
throw new Error('Invalid config for "postValidateGuardrail"');
|
|
703
|
+
}
|
|
704
|
+
return buildNetworkSnapshot$1(luvio, config);
|
|
705
|
+
};
|
|
706
|
+
};
|
|
707
|
+
|
|
708
|
+
const TTL = 60000;
|
|
709
|
+
const VERSION = "4a95ebefec5a82dc9ceb57f67d95359a";
|
|
710
|
+
function validate(obj, path = 'IndustriesGuardrailListRepresentation') {
|
|
711
|
+
const v_error = (() => {
|
|
712
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
713
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
714
|
+
}
|
|
715
|
+
const obj_industriesGuardrailList = obj.industriesGuardrailList;
|
|
716
|
+
const path_industriesGuardrailList = path + '.industriesGuardrailList';
|
|
717
|
+
if (!ArrayIsArray(obj_industriesGuardrailList)) {
|
|
718
|
+
return new TypeError('Expected "array" but received "' + typeof obj_industriesGuardrailList + '" (at "' + path_industriesGuardrailList + '")');
|
|
719
|
+
}
|
|
720
|
+
for (let i = 0; i < obj_industriesGuardrailList.length; i++) {
|
|
721
|
+
const obj_industriesGuardrailList_item = obj_industriesGuardrailList[i];
|
|
722
|
+
const path_industriesGuardrailList_item = path_industriesGuardrailList + '[' + i + ']';
|
|
723
|
+
if (typeof obj_industriesGuardrailList_item !== 'object') {
|
|
724
|
+
return new TypeError('Expected "object" but received "' + typeof obj_industriesGuardrailList_item + '" (at "' + path_industriesGuardrailList_item + '")');
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
})();
|
|
728
|
+
return v_error === undefined ? null : v_error;
|
|
729
|
+
}
|
|
730
|
+
const RepresentationType = 'IndustriesGuardrailListRepresentation';
|
|
731
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
732
|
+
const input_industriesGuardrailList = input.industriesGuardrailList;
|
|
733
|
+
const input_industriesGuardrailList_id = path.fullPath + '__industriesGuardrailList';
|
|
734
|
+
for (let i = 0; i < input_industriesGuardrailList.length; i++) {
|
|
735
|
+
const input_industriesGuardrailList_item = input_industriesGuardrailList[i];
|
|
736
|
+
let input_industriesGuardrailList_item_id = input_industriesGuardrailList_id + '__' + i;
|
|
737
|
+
input_industriesGuardrailList[i] = ingest$3(input_industriesGuardrailList_item, {
|
|
738
|
+
fullPath: input_industriesGuardrailList_item_id,
|
|
739
|
+
propertyName: i,
|
|
740
|
+
parent: {
|
|
741
|
+
data: input,
|
|
742
|
+
key: path.fullPath,
|
|
743
|
+
existing: existing,
|
|
744
|
+
},
|
|
745
|
+
ttl: path.ttl
|
|
746
|
+
}, luvio, store, timestamp);
|
|
747
|
+
}
|
|
748
|
+
return input;
|
|
749
|
+
}
|
|
750
|
+
const select$1 = function IndustriesGuardrailListRepresentationSelect() {
|
|
751
|
+
return {
|
|
752
|
+
kind: 'Fragment',
|
|
753
|
+
version: VERSION,
|
|
754
|
+
private: [],
|
|
755
|
+
selections: [
|
|
756
|
+
{
|
|
757
|
+
name: 'industriesGuardrailList',
|
|
758
|
+
kind: 'Link',
|
|
759
|
+
plural: true,
|
|
760
|
+
fragment: select$6()
|
|
761
|
+
}
|
|
762
|
+
]
|
|
763
|
+
};
|
|
764
|
+
};
|
|
765
|
+
function equals(existing, incoming) {
|
|
766
|
+
const existing_industriesGuardrailList = existing.industriesGuardrailList;
|
|
767
|
+
const incoming_industriesGuardrailList = incoming.industriesGuardrailList;
|
|
768
|
+
const equals_industriesGuardrailList_items = equalsArray(existing_industriesGuardrailList, incoming_industriesGuardrailList, (existing_industriesGuardrailList_item, incoming_industriesGuardrailList_item) => {
|
|
769
|
+
if (!(existing_industriesGuardrailList_item.__ref === incoming_industriesGuardrailList_item.__ref)) {
|
|
770
|
+
return false;
|
|
771
|
+
}
|
|
772
|
+
});
|
|
773
|
+
if (equals_industriesGuardrailList_items === false) {
|
|
774
|
+
return false;
|
|
775
|
+
}
|
|
776
|
+
return true;
|
|
777
|
+
}
|
|
778
|
+
const ingest = function IndustriesGuardrailListRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
779
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
780
|
+
const validateError = validate(input);
|
|
781
|
+
if (validateError !== null) {
|
|
782
|
+
throw validateError;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
const key = path.fullPath;
|
|
786
|
+
const ttlToUse = TTL;
|
|
787
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "Guardrail", VERSION, RepresentationType, equals);
|
|
788
|
+
return createLink(key);
|
|
789
|
+
};
|
|
790
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
791
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
792
|
+
const rootKey = fullPathFactory();
|
|
793
|
+
rootKeySet.set(rootKey, {
|
|
794
|
+
namespace: keyPrefix,
|
|
795
|
+
representationName: RepresentationType,
|
|
796
|
+
mergeable: false
|
|
797
|
+
});
|
|
798
|
+
const input_industriesGuardrailList_length = input.industriesGuardrailList.length;
|
|
799
|
+
for (let i = 0; i < input_industriesGuardrailList_length; i++) {
|
|
800
|
+
getTypeCacheKeys$3(rootKeySet, luvio, input.industriesGuardrailList[i]);
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
function select(luvio, params) {
|
|
805
|
+
return select$1();
|
|
806
|
+
}
|
|
807
|
+
function keyBuilder$1(luvio, params) {
|
|
808
|
+
return keyPrefix + '::IndustriesGuardrailListRepresentation:(' + 'component:' + params.queryParams.component + ',' + 'product:' + params.queryParams.product + ')';
|
|
809
|
+
}
|
|
810
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
811
|
+
getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$1(luvio, resourceParams));
|
|
812
|
+
}
|
|
813
|
+
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
814
|
+
const { body } = response;
|
|
815
|
+
const key = keyBuilder$1(luvio, resourceParams);
|
|
816
|
+
luvio.storeIngest(key, ingest, body);
|
|
817
|
+
const snapshot = luvio.storeLookup({
|
|
818
|
+
recordId: key,
|
|
819
|
+
node: select(),
|
|
820
|
+
variables: {},
|
|
821
|
+
}, snapshotRefresh);
|
|
822
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
823
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
824
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
deepFreeze(snapshot.data);
|
|
828
|
+
return snapshot;
|
|
829
|
+
}
|
|
830
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
831
|
+
const key = keyBuilder$1(luvio, params);
|
|
832
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
833
|
+
const storeMetadataParams = {
|
|
834
|
+
ttl: TTL,
|
|
835
|
+
namespace: keyPrefix,
|
|
836
|
+
version: VERSION,
|
|
837
|
+
representationName: RepresentationType
|
|
838
|
+
};
|
|
839
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
840
|
+
return errorSnapshot;
|
|
841
|
+
}
|
|
842
|
+
function createResourceRequest(config) {
|
|
843
|
+
const headers = {};
|
|
844
|
+
return {
|
|
845
|
+
baseUri: '/services/data/v63.0',
|
|
846
|
+
basePath: '/connect/industries/guardrails',
|
|
847
|
+
method: 'get',
|
|
848
|
+
body: null,
|
|
849
|
+
urlParams: {},
|
|
850
|
+
queryParams: config.queryParams,
|
|
851
|
+
headers,
|
|
852
|
+
priority: 'normal',
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
const adapterName = 'getIndustriesGuardrails';
|
|
857
|
+
const getIndustriesGuardrails_ConfigPropertyMetadata = [
|
|
858
|
+
generateParamConfigMetadata('component', false, 1 /* QueryParameter */, 0 /* String */),
|
|
859
|
+
generateParamConfigMetadata('product', false, 1 /* QueryParameter */, 0 /* String */),
|
|
860
|
+
];
|
|
861
|
+
const getIndustriesGuardrails_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getIndustriesGuardrails_ConfigPropertyMetadata);
|
|
862
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$3(getIndustriesGuardrails_ConfigPropertyMetadata);
|
|
863
|
+
function keyBuilder(luvio, config) {
|
|
864
|
+
const resourceParams = createResourceParams(config);
|
|
865
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
866
|
+
}
|
|
867
|
+
function typeCheckConfig(untrustedConfig) {
|
|
868
|
+
const config = {};
|
|
869
|
+
typeCheckConfig$3(untrustedConfig, config, getIndustriesGuardrails_ConfigPropertyMetadata);
|
|
870
|
+
return config;
|
|
871
|
+
}
|
|
872
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
873
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
874
|
+
return null;
|
|
875
|
+
}
|
|
876
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
877
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
878
|
+
}
|
|
879
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
880
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
881
|
+
return null;
|
|
882
|
+
}
|
|
883
|
+
return config;
|
|
884
|
+
}
|
|
885
|
+
function adapterFragment(luvio, config) {
|
|
886
|
+
createResourceParams(config);
|
|
887
|
+
return select();
|
|
888
|
+
}
|
|
889
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
890
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
891
|
+
config,
|
|
892
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
893
|
+
});
|
|
894
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
895
|
+
}
|
|
896
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
897
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
898
|
+
config,
|
|
899
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
900
|
+
});
|
|
901
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
902
|
+
}
|
|
903
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
904
|
+
const resourceParams = createResourceParams(config);
|
|
905
|
+
const request = createResourceRequest(resourceParams);
|
|
906
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
907
|
+
.then((response) => {
|
|
908
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
909
|
+
const cache = new StoreKeyMap();
|
|
910
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
911
|
+
return cache;
|
|
912
|
+
});
|
|
913
|
+
}, (response) => {
|
|
914
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
915
|
+
});
|
|
916
|
+
}
|
|
917
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
918
|
+
return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
|
|
919
|
+
}
|
|
920
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
921
|
+
const { luvio, config } = context;
|
|
922
|
+
const selector = {
|
|
923
|
+
recordId: keyBuilder(luvio, config),
|
|
924
|
+
node: adapterFragment(luvio, config),
|
|
925
|
+
variables: {},
|
|
926
|
+
};
|
|
927
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
928
|
+
config,
|
|
929
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
930
|
+
});
|
|
931
|
+
return cacheSnapshot;
|
|
932
|
+
}
|
|
933
|
+
const getIndustriesGuardrailsAdapterFactory = (luvio) => function Guardrail__getIndustriesGuardrails(untrustedConfig, requestContext) {
|
|
934
|
+
const config = validateAdapterConfig(untrustedConfig, getIndustriesGuardrails_ConfigPropertyNames);
|
|
935
|
+
// Invalid or incomplete config
|
|
936
|
+
if (config === null) {
|
|
937
|
+
return null;
|
|
938
|
+
}
|
|
939
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
940
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
941
|
+
};
|
|
942
|
+
|
|
943
|
+
export { getIndustriesGuardrailAdapterFactory, getIndustriesGuardrailsAdapterFactory, postValidateGuardrailAdapterFactory };
|