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