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