@salesforce/lds-adapters-industries-featurevalidation 1.124.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-featurevalidation.js +518 -0
- package/dist/types/src/generated/adapters/adapter-utils.d.ts +66 -0
- package/dist/types/src/generated/adapters/featureValidation.d.ts +15 -0
- package/dist/types/src/generated/artifacts/main.d.ts +1 -0
- package/dist/types/src/generated/artifacts/sfdc.d.ts +2 -0
- package/dist/types/src/generated/resources/postConnectIndustriesFeatureValidation.d.ts +13 -0
- package/dist/types/src/generated/types/FeatureValidationFieldValuesRepresentation.d.ts +38 -0
- package/dist/types/src/generated/types/FeatureValidationInputDetailsRepresentation.d.ts +34 -0
- package/dist/types/src/generated/types/FeatureValidationInputRepresentation.d.ts +32 -0
- package/dist/types/src/generated/types/FeatureValidationOutputDetailsRepresentation.d.ts +39 -0
- package/dist/types/src/generated/types/FeatureValidationOutputRepresentation.d.ts +46 -0
- package/dist/types/src/generated/types/type-utils.d.ts +39 -0
- package/dist/umd/es2018/industries-featurevalidation.js +526 -0
- package/dist/umd/es5/industries-featurevalidation.js +529 -0
- package/package.json +67 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +545 -0
- package/src/raml/api.raml +127 -0
- package/src/raml/luvio.raml +17 -0
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
(function (global, factory) {
|
|
8
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@luvio/engine')) :
|
|
9
|
+
typeof define === 'function' && define.amd ? define(['exports', '@luvio/engine'], factory) :
|
|
10
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.industriesFeaturevalidation = {}, global.engine));
|
|
11
|
+
})(this, (function (exports, engine) { 'use strict';
|
|
12
|
+
|
|
13
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
14
|
+
const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = Object;
|
|
15
|
+
const { isArray: ArrayIsArray$1 } = Array;
|
|
16
|
+
/**
|
|
17
|
+
* Validates an adapter config is well-formed.
|
|
18
|
+
* @param config The config to validate.
|
|
19
|
+
* @param adapter The adapter validation configuration.
|
|
20
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
21
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
22
|
+
*/
|
|
23
|
+
function validateConfig(config, adapter, oneOf) {
|
|
24
|
+
const { displayName } = adapter;
|
|
25
|
+
const { required, optional, unsupported } = adapter.parameters;
|
|
26
|
+
if (config === undefined ||
|
|
27
|
+
required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
28
|
+
throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
|
|
29
|
+
}
|
|
30
|
+
if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
31
|
+
throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
|
|
32
|
+
}
|
|
33
|
+
if (unsupported !== undefined &&
|
|
34
|
+
unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
|
|
35
|
+
throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
|
|
36
|
+
}
|
|
37
|
+
const supported = required.concat(optional);
|
|
38
|
+
if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
|
|
39
|
+
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function untrustedIsObject(untrusted) {
|
|
43
|
+
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
|
|
44
|
+
}
|
|
45
|
+
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
46
|
+
return configPropertyNames.parameters.required.every(req => req in config);
|
|
47
|
+
}
|
|
48
|
+
const keyPrefix = 'featurevalidation';
|
|
49
|
+
|
|
50
|
+
const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
|
|
51
|
+
const { isArray: ArrayIsArray } = Array;
|
|
52
|
+
function equalsArray(a, b, equalsItem) {
|
|
53
|
+
const aLength = a.length;
|
|
54
|
+
const bLength = b.length;
|
|
55
|
+
if (aLength !== bLength) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
for (let i = 0; i < aLength; i++) {
|
|
59
|
+
if (equalsItem(a[i], b[i]) === false) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
function deepFreeze(value) {
|
|
66
|
+
// No need to freeze primitives
|
|
67
|
+
if (typeof value !== 'object' || value === null) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (ArrayIsArray(value)) {
|
|
71
|
+
for (let i = 0, len = value.length; i < len; i += 1) {
|
|
72
|
+
deepFreeze(value[i]);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
const keys = ObjectKeys(value);
|
|
77
|
+
for (let i = 0, len = keys.length; i < len; i += 1) {
|
|
78
|
+
deepFreeze(value[keys[i]]);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
ObjectFreeze(value);
|
|
82
|
+
}
|
|
83
|
+
function createLink(ref) {
|
|
84
|
+
return {
|
|
85
|
+
__ref: engine.serializeStructuredKey(ref),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const VERSION$2 = "631aec0cb3216fffb314c3734733f29b";
|
|
90
|
+
function validate$2(obj, path = 'FeatureValidationFieldValuesRepresentation') {
|
|
91
|
+
const v_error = (() => {
|
|
92
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
93
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
94
|
+
}
|
|
95
|
+
const obj_fieldName = obj.fieldName;
|
|
96
|
+
const path_fieldName = path + '.fieldName';
|
|
97
|
+
if (typeof obj_fieldName !== 'string') {
|
|
98
|
+
return new TypeError('Expected "string" but received "' + typeof obj_fieldName + '" (at "' + path_fieldName + '")');
|
|
99
|
+
}
|
|
100
|
+
const obj_fieldValue = obj.fieldValue;
|
|
101
|
+
const path_fieldValue = path + '.fieldValue';
|
|
102
|
+
if (typeof obj_fieldValue !== 'string') {
|
|
103
|
+
return new TypeError('Expected "string" but received "' + typeof obj_fieldValue + '" (at "' + path_fieldValue + '")');
|
|
104
|
+
}
|
|
105
|
+
const obj_message = obj.message;
|
|
106
|
+
const path_message = path + '.message';
|
|
107
|
+
if (typeof obj_message !== 'string') {
|
|
108
|
+
return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
|
|
109
|
+
}
|
|
110
|
+
const obj_required = obj.required;
|
|
111
|
+
const path_required = path + '.required';
|
|
112
|
+
if (typeof obj_required !== 'boolean') {
|
|
113
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_required + '" (at "' + path_required + '")');
|
|
114
|
+
}
|
|
115
|
+
})();
|
|
116
|
+
return v_error === undefined ? null : v_error;
|
|
117
|
+
}
|
|
118
|
+
const select$3 = function FeatureValidationFieldValuesRepresentationSelect() {
|
|
119
|
+
return {
|
|
120
|
+
kind: 'Fragment',
|
|
121
|
+
version: VERSION$2,
|
|
122
|
+
private: [],
|
|
123
|
+
selections: [
|
|
124
|
+
{
|
|
125
|
+
name: 'fieldName',
|
|
126
|
+
kind: 'Scalar'
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: 'fieldValue',
|
|
130
|
+
kind: 'Scalar'
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: 'message',
|
|
134
|
+
kind: 'Scalar'
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: 'required',
|
|
138
|
+
kind: 'Scalar'
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
function equals$2(existing, incoming) {
|
|
144
|
+
const existing_required = existing.required;
|
|
145
|
+
const incoming_required = incoming.required;
|
|
146
|
+
if (!(existing_required === incoming_required)) {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
const existing_fieldName = existing.fieldName;
|
|
150
|
+
const incoming_fieldName = incoming.fieldName;
|
|
151
|
+
if (!(existing_fieldName === incoming_fieldName)) {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
const existing_fieldValue = existing.fieldValue;
|
|
155
|
+
const incoming_fieldValue = incoming.fieldValue;
|
|
156
|
+
if (!(existing_fieldValue === incoming_fieldValue)) {
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
const existing_message = existing.message;
|
|
160
|
+
const incoming_message = incoming.message;
|
|
161
|
+
if (!(existing_message === incoming_message)) {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const VERSION$1 = "b2421cf8b77991983bf69e64a9fa0236";
|
|
168
|
+
function validate$1(obj, path = 'FeatureValidationOutputDetailsRepresentation') {
|
|
169
|
+
const v_error = (() => {
|
|
170
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
171
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
172
|
+
}
|
|
173
|
+
const obj_bpoName = obj.bpoName;
|
|
174
|
+
const path_bpoName = path + '.bpoName';
|
|
175
|
+
if (typeof obj_bpoName !== 'string') {
|
|
176
|
+
return new TypeError('Expected "string" but received "' + typeof obj_bpoName + '" (at "' + path_bpoName + '")');
|
|
177
|
+
}
|
|
178
|
+
const obj_bpoRecordId = obj.bpoRecordId;
|
|
179
|
+
const path_bpoRecordId = path + '.bpoRecordId';
|
|
180
|
+
if (typeof obj_bpoRecordId !== 'string') {
|
|
181
|
+
return new TypeError('Expected "string" but received "' + typeof obj_bpoRecordId + '" (at "' + path_bpoRecordId + '")');
|
|
182
|
+
}
|
|
183
|
+
const obj_featureValidationFieldValues = obj.featureValidationFieldValues;
|
|
184
|
+
const path_featureValidationFieldValues = path + '.featureValidationFieldValues';
|
|
185
|
+
if (!ArrayIsArray(obj_featureValidationFieldValues)) {
|
|
186
|
+
return new TypeError('Expected "array" but received "' + typeof obj_featureValidationFieldValues + '" (at "' + path_featureValidationFieldValues + '")');
|
|
187
|
+
}
|
|
188
|
+
for (let i = 0; i < obj_featureValidationFieldValues.length; i++) {
|
|
189
|
+
const obj_featureValidationFieldValues_item = obj_featureValidationFieldValues[i];
|
|
190
|
+
const path_featureValidationFieldValues_item = path_featureValidationFieldValues + '[' + i + ']';
|
|
191
|
+
const referencepath_featureValidationFieldValues_itemValidationError = validate$2(obj_featureValidationFieldValues_item, path_featureValidationFieldValues_item);
|
|
192
|
+
if (referencepath_featureValidationFieldValues_itemValidationError !== null) {
|
|
193
|
+
let message = 'Object doesn\'t match FeatureValidationFieldValuesRepresentation (at "' + path_featureValidationFieldValues_item + '")\n';
|
|
194
|
+
message += referencepath_featureValidationFieldValues_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
195
|
+
return new TypeError(message);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
const obj_message = obj.message;
|
|
199
|
+
const path_message = path + '.message';
|
|
200
|
+
if (typeof obj_message !== 'string') {
|
|
201
|
+
return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
|
|
202
|
+
}
|
|
203
|
+
})();
|
|
204
|
+
return v_error === undefined ? null : v_error;
|
|
205
|
+
}
|
|
206
|
+
const select$2 = function FeatureValidationOutputDetailsRepresentationSelect() {
|
|
207
|
+
const { selections: FeatureValidationFieldValuesRepresentation__selections, opaque: FeatureValidationFieldValuesRepresentation__opaque, } = select$3();
|
|
208
|
+
return {
|
|
209
|
+
kind: 'Fragment',
|
|
210
|
+
version: VERSION$1,
|
|
211
|
+
private: [],
|
|
212
|
+
selections: [
|
|
213
|
+
{
|
|
214
|
+
name: 'bpoName',
|
|
215
|
+
kind: 'Scalar'
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
name: 'bpoRecordId',
|
|
219
|
+
kind: 'Scalar'
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
name: 'featureValidationFieldValues',
|
|
223
|
+
kind: 'Object',
|
|
224
|
+
plural: true,
|
|
225
|
+
selections: FeatureValidationFieldValuesRepresentation__selections
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
name: 'message',
|
|
229
|
+
kind: 'Scalar'
|
|
230
|
+
}
|
|
231
|
+
]
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
function equals$1(existing, incoming) {
|
|
235
|
+
const existing_bpoName = existing.bpoName;
|
|
236
|
+
const incoming_bpoName = incoming.bpoName;
|
|
237
|
+
if (!(existing_bpoName === incoming_bpoName)) {
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
const existing_bpoRecordId = existing.bpoRecordId;
|
|
241
|
+
const incoming_bpoRecordId = incoming.bpoRecordId;
|
|
242
|
+
if (!(existing_bpoRecordId === incoming_bpoRecordId)) {
|
|
243
|
+
return false;
|
|
244
|
+
}
|
|
245
|
+
const existing_message = existing.message;
|
|
246
|
+
const incoming_message = incoming.message;
|
|
247
|
+
if (!(existing_message === incoming_message)) {
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
const existing_featureValidationFieldValues = existing.featureValidationFieldValues;
|
|
251
|
+
const incoming_featureValidationFieldValues = incoming.featureValidationFieldValues;
|
|
252
|
+
const equals_featureValidationFieldValues_items = equalsArray(existing_featureValidationFieldValues, incoming_featureValidationFieldValues, (existing_featureValidationFieldValues_item, incoming_featureValidationFieldValues_item) => {
|
|
253
|
+
if (!(equals$2(existing_featureValidationFieldValues_item, incoming_featureValidationFieldValues_item))) {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
if (equals_featureValidationFieldValues_items === false) {
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
const TTL = 300;
|
|
264
|
+
const VERSION = "cca11a8e3ab8424bcce64057aad4f46d";
|
|
265
|
+
function validate(obj, path = 'FeatureValidationOutputRepresentation') {
|
|
266
|
+
const v_error = (() => {
|
|
267
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
268
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
269
|
+
}
|
|
270
|
+
if (obj.errorMessage !== undefined) {
|
|
271
|
+
const obj_errorMessage = obj.errorMessage;
|
|
272
|
+
const path_errorMessage = path + '.errorMessage';
|
|
273
|
+
if (typeof obj_errorMessage !== 'string') {
|
|
274
|
+
return new TypeError('Expected "string" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
const obj_featureValidationOutputDetails = obj.featureValidationOutputDetails;
|
|
278
|
+
const path_featureValidationOutputDetails = path + '.featureValidationOutputDetails';
|
|
279
|
+
if (!ArrayIsArray(obj_featureValidationOutputDetails)) {
|
|
280
|
+
return new TypeError('Expected "array" but received "' + typeof obj_featureValidationOutputDetails + '" (at "' + path_featureValidationOutputDetails + '")');
|
|
281
|
+
}
|
|
282
|
+
for (let i = 0; i < obj_featureValidationOutputDetails.length; i++) {
|
|
283
|
+
const obj_featureValidationOutputDetails_item = obj_featureValidationOutputDetails[i];
|
|
284
|
+
const path_featureValidationOutputDetails_item = path_featureValidationOutputDetails + '[' + i + ']';
|
|
285
|
+
const referencepath_featureValidationOutputDetails_itemValidationError = validate$1(obj_featureValidationOutputDetails_item, path_featureValidationOutputDetails_item);
|
|
286
|
+
if (referencepath_featureValidationOutputDetails_itemValidationError !== null) {
|
|
287
|
+
let message = 'Object doesn\'t match FeatureValidationOutputDetailsRepresentation (at "' + path_featureValidationOutputDetails_item + '")\n';
|
|
288
|
+
message += referencepath_featureValidationOutputDetails_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
289
|
+
return new TypeError(message);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
const obj_isSuccess = obj.isSuccess;
|
|
293
|
+
const path_isSuccess = path + '.isSuccess';
|
|
294
|
+
if (typeof obj_isSuccess !== 'boolean') {
|
|
295
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
|
|
296
|
+
}
|
|
297
|
+
})();
|
|
298
|
+
return v_error === undefined ? null : v_error;
|
|
299
|
+
}
|
|
300
|
+
const RepresentationType = 'FeatureValidationOutputRepresentation';
|
|
301
|
+
function keyBuilder(luvio, config) {
|
|
302
|
+
return keyPrefix + '::' + RepresentationType + ':' + config.isSuccess;
|
|
303
|
+
}
|
|
304
|
+
function keyBuilderFromType(luvio, object) {
|
|
305
|
+
const keyParams = {
|
|
306
|
+
isSuccess: object.isSuccess
|
|
307
|
+
};
|
|
308
|
+
return keyBuilder(luvio, keyParams);
|
|
309
|
+
}
|
|
310
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
311
|
+
return input;
|
|
312
|
+
}
|
|
313
|
+
const select$1 = function FeatureValidationOutputRepresentationSelect() {
|
|
314
|
+
const { selections: FeatureValidationOutputDetailsRepresentation__selections, opaque: FeatureValidationOutputDetailsRepresentation__opaque, } = select$2();
|
|
315
|
+
return {
|
|
316
|
+
kind: 'Fragment',
|
|
317
|
+
version: VERSION,
|
|
318
|
+
private: [],
|
|
319
|
+
selections: [
|
|
320
|
+
{
|
|
321
|
+
name: 'errorMessage',
|
|
322
|
+
kind: 'Scalar',
|
|
323
|
+
required: false
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
name: 'featureValidationOutputDetails',
|
|
327
|
+
kind: 'Object',
|
|
328
|
+
plural: true,
|
|
329
|
+
selections: FeatureValidationOutputDetailsRepresentation__selections
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
name: 'isSuccess',
|
|
333
|
+
kind: 'Scalar'
|
|
334
|
+
}
|
|
335
|
+
]
|
|
336
|
+
};
|
|
337
|
+
};
|
|
338
|
+
function equals(existing, incoming) {
|
|
339
|
+
const existing_isSuccess = existing.isSuccess;
|
|
340
|
+
const incoming_isSuccess = incoming.isSuccess;
|
|
341
|
+
if (!(existing_isSuccess === incoming_isSuccess)) {
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
344
|
+
const existing_errorMessage = existing.errorMessage;
|
|
345
|
+
const incoming_errorMessage = incoming.errorMessage;
|
|
346
|
+
// if at least one of these optionals is defined
|
|
347
|
+
if (existing_errorMessage !== undefined || incoming_errorMessage !== undefined) {
|
|
348
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
349
|
+
// not equal
|
|
350
|
+
if (existing_errorMessage === undefined || incoming_errorMessage === undefined) {
|
|
351
|
+
return false;
|
|
352
|
+
}
|
|
353
|
+
if (!(existing_errorMessage === incoming_errorMessage)) {
|
|
354
|
+
return false;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
const existing_featureValidationOutputDetails = existing.featureValidationOutputDetails;
|
|
358
|
+
const incoming_featureValidationOutputDetails = incoming.featureValidationOutputDetails;
|
|
359
|
+
const equals_featureValidationOutputDetails_items = equalsArray(existing_featureValidationOutputDetails, incoming_featureValidationOutputDetails, (existing_featureValidationOutputDetails_item, incoming_featureValidationOutputDetails_item) => {
|
|
360
|
+
if (!(equals$1(existing_featureValidationOutputDetails_item, incoming_featureValidationOutputDetails_item))) {
|
|
361
|
+
return false;
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
if (equals_featureValidationOutputDetails_items === false) {
|
|
365
|
+
return false;
|
|
366
|
+
}
|
|
367
|
+
return true;
|
|
368
|
+
}
|
|
369
|
+
const ingest = function FeatureValidationOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
370
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
371
|
+
const validateError = validate(input);
|
|
372
|
+
if (validateError !== null) {
|
|
373
|
+
throw validateError;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
const key = keyBuilderFromType(luvio, input);
|
|
377
|
+
const existingRecord = store.readEntry(key);
|
|
378
|
+
const ttlToUse = TTL;
|
|
379
|
+
let incomingRecord = normalize(input, store.readEntry(key), {
|
|
380
|
+
fullPath: key,
|
|
381
|
+
parent: path.parent,
|
|
382
|
+
propertyName: path.propertyName,
|
|
383
|
+
ttl: ttlToUse
|
|
384
|
+
});
|
|
385
|
+
if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
|
|
386
|
+
luvio.storePublish(key, incomingRecord);
|
|
387
|
+
}
|
|
388
|
+
{
|
|
389
|
+
const storeMetadataParams = {
|
|
390
|
+
ttl: ttlToUse,
|
|
391
|
+
namespace: "featurevalidation",
|
|
392
|
+
version: VERSION,
|
|
393
|
+
representationName: RepresentationType,
|
|
394
|
+
};
|
|
395
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
396
|
+
}
|
|
397
|
+
return createLink(key);
|
|
398
|
+
};
|
|
399
|
+
function getTypeCacheKeys(luvio, input, fullPathFactory) {
|
|
400
|
+
const rootKeySet = new engine.StoreKeyMap();
|
|
401
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
402
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
403
|
+
rootKeySet.set(rootKey, {
|
|
404
|
+
namespace: keyPrefix,
|
|
405
|
+
representationName: RepresentationType,
|
|
406
|
+
mergeable: false
|
|
407
|
+
});
|
|
408
|
+
return rootKeySet;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
function select(luvio, params) {
|
|
412
|
+
return select$1();
|
|
413
|
+
}
|
|
414
|
+
function getResponseCacheKeys(luvio, resourceParams, response) {
|
|
415
|
+
return getTypeCacheKeys(luvio, response);
|
|
416
|
+
}
|
|
417
|
+
function ingestSuccess(luvio, resourceParams, response) {
|
|
418
|
+
const { body } = response;
|
|
419
|
+
const key = keyBuilderFromType(luvio, body);
|
|
420
|
+
luvio.storeIngest(key, ingest, body);
|
|
421
|
+
const snapshot = luvio.storeLookup({
|
|
422
|
+
recordId: key,
|
|
423
|
+
node: select(),
|
|
424
|
+
variables: {},
|
|
425
|
+
});
|
|
426
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
427
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
428
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
return snapshot;
|
|
432
|
+
}
|
|
433
|
+
function createResourceRequest(config) {
|
|
434
|
+
const headers = {};
|
|
435
|
+
return {
|
|
436
|
+
baseUri: '/services/data/v58.0',
|
|
437
|
+
basePath: '/connect/industries/feature-validation',
|
|
438
|
+
method: 'post',
|
|
439
|
+
body: config.body,
|
|
440
|
+
urlParams: {},
|
|
441
|
+
queryParams: {},
|
|
442
|
+
headers,
|
|
443
|
+
priority: 'normal',
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
const featureValidation_ConfigPropertyNames = {
|
|
448
|
+
displayName: 'featureValidation',
|
|
449
|
+
parameters: {
|
|
450
|
+
required: ['featureValidationInputDetails', 'useCase'],
|
|
451
|
+
optional: []
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
function createResourceParams(config) {
|
|
455
|
+
const resourceParams = {
|
|
456
|
+
body: {
|
|
457
|
+
featureValidationInputDetails: config.featureValidationInputDetails, useCase: config.useCase
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
return resourceParams;
|
|
461
|
+
}
|
|
462
|
+
function typeCheckConfig(untrustedConfig) {
|
|
463
|
+
const config = {};
|
|
464
|
+
const untrustedConfig_featureValidationInputDetails = untrustedConfig.featureValidationInputDetails;
|
|
465
|
+
if (ArrayIsArray$1(untrustedConfig_featureValidationInputDetails)) {
|
|
466
|
+
const untrustedConfig_featureValidationInputDetails_array = [];
|
|
467
|
+
for (let i = 0, arrayLength = untrustedConfig_featureValidationInputDetails.length; i < arrayLength; i++) {
|
|
468
|
+
const untrustedConfig_featureValidationInputDetails_item = untrustedConfig_featureValidationInputDetails[i];
|
|
469
|
+
if (untrustedIsObject(untrustedConfig_featureValidationInputDetails_item)) {
|
|
470
|
+
const untrustedConfig_featureValidationInputDetails_item_object = {};
|
|
471
|
+
if (untrustedConfig_featureValidationInputDetails_item_object !== undefined && Object.keys(untrustedConfig_featureValidationInputDetails_item_object).length >= 0) {
|
|
472
|
+
untrustedConfig_featureValidationInputDetails_array.push(untrustedConfig_featureValidationInputDetails_item_object);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
config.featureValidationInputDetails = untrustedConfig_featureValidationInputDetails_array;
|
|
477
|
+
}
|
|
478
|
+
const untrustedConfig_useCase = untrustedConfig.useCase;
|
|
479
|
+
if (typeof untrustedConfig_useCase === 'string') {
|
|
480
|
+
config.useCase = untrustedConfig_useCase;
|
|
481
|
+
}
|
|
482
|
+
return config;
|
|
483
|
+
}
|
|
484
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
485
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
486
|
+
return null;
|
|
487
|
+
}
|
|
488
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
489
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
490
|
+
}
|
|
491
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
492
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
493
|
+
return null;
|
|
494
|
+
}
|
|
495
|
+
return config;
|
|
496
|
+
}
|
|
497
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
498
|
+
const resourceParams = createResourceParams(config);
|
|
499
|
+
const request = createResourceRequest(resourceParams);
|
|
500
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
501
|
+
.then((response) => {
|
|
502
|
+
return luvio.handleSuccessResponse(() => {
|
|
503
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
504
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
505
|
+
}, () => getResponseCacheKeys(luvio, resourceParams, response.body));
|
|
506
|
+
}, (response) => {
|
|
507
|
+
deepFreeze(response);
|
|
508
|
+
throw response;
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
const featureValidationAdapterFactory = (luvio) => {
|
|
512
|
+
return function featureValidation(untrustedConfig) {
|
|
513
|
+
const config = validateAdapterConfig(untrustedConfig, featureValidation_ConfigPropertyNames);
|
|
514
|
+
// Invalid or incomplete config
|
|
515
|
+
if (config === null) {
|
|
516
|
+
throw new Error('Invalid config for "featureValidation"');
|
|
517
|
+
}
|
|
518
|
+
return buildNetworkSnapshot(luvio, config);
|
|
519
|
+
};
|
|
520
|
+
};
|
|
521
|
+
|
|
522
|
+
exports.featureValidationAdapterFactory = featureValidationAdapterFactory;
|
|
523
|
+
|
|
524
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
525
|
+
|
|
526
|
+
}));
|