@salesforce/lds-adapters-industries-featurevalidation 0.131.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/sfdc/index.js ADDED
@@ -0,0 +1,558 @@
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
+ function validate$3(obj, path = 'FeatureValidationInputRepresentation') {
95
+ const v_error = (() => {
96
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
97
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
98
+ }
99
+ const obj_featureValidationInputDetails = obj.featureValidationInputDetails;
100
+ const path_featureValidationInputDetails = path + '.featureValidationInputDetails';
101
+ if (!ArrayIsArray(obj_featureValidationInputDetails)) {
102
+ return new TypeError('Expected "array" but received "' + typeof obj_featureValidationInputDetails + '" (at "' + path_featureValidationInputDetails + '")');
103
+ }
104
+ for (let i = 0; i < obj_featureValidationInputDetails.length; i++) {
105
+ const obj_featureValidationInputDetails_item = obj_featureValidationInputDetails[i];
106
+ const path_featureValidationInputDetails_item = path_featureValidationInputDetails + '[' + i + ']';
107
+ if (typeof obj_featureValidationInputDetails_item !== 'object' || ArrayIsArray(obj_featureValidationInputDetails_item) || obj_featureValidationInputDetails_item === null) {
108
+ return new TypeError('Expected "object" but received "' + typeof obj_featureValidationInputDetails_item + '" (at "' + path_featureValidationInputDetails_item + '")');
109
+ }
110
+ }
111
+ const obj_useCase = obj.useCase;
112
+ const path_useCase = path + '.useCase';
113
+ if (typeof obj_useCase !== 'string') {
114
+ return new TypeError('Expected "string" but received "' + typeof obj_useCase + '" (at "' + path_useCase + '")');
115
+ }
116
+ })();
117
+ return v_error === undefined ? null : v_error;
118
+ }
119
+
120
+ const VERSION$2 = "631aec0cb3216fffb314c3734733f29b";
121
+ function validate$2(obj, path = 'FeatureValidationFieldValuesRepresentation') {
122
+ const v_error = (() => {
123
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
124
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
125
+ }
126
+ const obj_fieldName = obj.fieldName;
127
+ const path_fieldName = path + '.fieldName';
128
+ if (typeof obj_fieldName !== 'string') {
129
+ return new TypeError('Expected "string" but received "' + typeof obj_fieldName + '" (at "' + path_fieldName + '")');
130
+ }
131
+ const obj_fieldValue = obj.fieldValue;
132
+ const path_fieldValue = path + '.fieldValue';
133
+ if (typeof obj_fieldValue !== 'string') {
134
+ return new TypeError('Expected "string" but received "' + typeof obj_fieldValue + '" (at "' + path_fieldValue + '")');
135
+ }
136
+ const obj_message = obj.message;
137
+ const path_message = path + '.message';
138
+ if (typeof obj_message !== 'string') {
139
+ return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
140
+ }
141
+ const obj_required = obj.required;
142
+ const path_required = path + '.required';
143
+ if (typeof obj_required !== 'boolean') {
144
+ return new TypeError('Expected "boolean" but received "' + typeof obj_required + '" (at "' + path_required + '")');
145
+ }
146
+ })();
147
+ return v_error === undefined ? null : v_error;
148
+ }
149
+ const select$3 = function FeatureValidationFieldValuesRepresentationSelect() {
150
+ return {
151
+ kind: 'Fragment',
152
+ version: VERSION$2,
153
+ private: [],
154
+ selections: [
155
+ {
156
+ name: 'fieldName',
157
+ kind: 'Scalar'
158
+ },
159
+ {
160
+ name: 'fieldValue',
161
+ kind: 'Scalar'
162
+ },
163
+ {
164
+ name: 'message',
165
+ kind: 'Scalar'
166
+ },
167
+ {
168
+ name: 'required',
169
+ kind: 'Scalar'
170
+ }
171
+ ]
172
+ };
173
+ };
174
+ function equals$2(existing, incoming) {
175
+ const existing_required = existing.required;
176
+ const incoming_required = incoming.required;
177
+ if (!(existing_required === incoming_required)) {
178
+ return false;
179
+ }
180
+ const existing_fieldName = existing.fieldName;
181
+ const incoming_fieldName = incoming.fieldName;
182
+ if (!(existing_fieldName === incoming_fieldName)) {
183
+ return false;
184
+ }
185
+ const existing_fieldValue = existing.fieldValue;
186
+ const incoming_fieldValue = incoming.fieldValue;
187
+ if (!(existing_fieldValue === incoming_fieldValue)) {
188
+ return false;
189
+ }
190
+ const existing_message = existing.message;
191
+ const incoming_message = incoming.message;
192
+ if (!(existing_message === incoming_message)) {
193
+ return false;
194
+ }
195
+ return true;
196
+ }
197
+
198
+ const VERSION$1 = "b2421cf8b77991983bf69e64a9fa0236";
199
+ function validate$1(obj, path = 'FeatureValidationOutputDetailsRepresentation') {
200
+ const v_error = (() => {
201
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
202
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
203
+ }
204
+ const obj_bpoName = obj.bpoName;
205
+ const path_bpoName = path + '.bpoName';
206
+ if (typeof obj_bpoName !== 'string') {
207
+ return new TypeError('Expected "string" but received "' + typeof obj_bpoName + '" (at "' + path_bpoName + '")');
208
+ }
209
+ const obj_bpoRecordId = obj.bpoRecordId;
210
+ const path_bpoRecordId = path + '.bpoRecordId';
211
+ if (typeof obj_bpoRecordId !== 'string') {
212
+ return new TypeError('Expected "string" but received "' + typeof obj_bpoRecordId + '" (at "' + path_bpoRecordId + '")');
213
+ }
214
+ const obj_featureValidationFieldValues = obj.featureValidationFieldValues;
215
+ const path_featureValidationFieldValues = path + '.featureValidationFieldValues';
216
+ if (!ArrayIsArray(obj_featureValidationFieldValues)) {
217
+ return new TypeError('Expected "array" but received "' + typeof obj_featureValidationFieldValues + '" (at "' + path_featureValidationFieldValues + '")');
218
+ }
219
+ for (let i = 0; i < obj_featureValidationFieldValues.length; i++) {
220
+ const obj_featureValidationFieldValues_item = obj_featureValidationFieldValues[i];
221
+ const path_featureValidationFieldValues_item = path_featureValidationFieldValues + '[' + i + ']';
222
+ const referencepath_featureValidationFieldValues_itemValidationError = validate$2(obj_featureValidationFieldValues_item, path_featureValidationFieldValues_item);
223
+ if (referencepath_featureValidationFieldValues_itemValidationError !== null) {
224
+ let message = 'Object doesn\'t match FeatureValidationFieldValuesRepresentation (at "' + path_featureValidationFieldValues_item + '")\n';
225
+ message += referencepath_featureValidationFieldValues_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
226
+ return new TypeError(message);
227
+ }
228
+ }
229
+ const obj_message = obj.message;
230
+ const path_message = path + '.message';
231
+ if (typeof obj_message !== 'string') {
232
+ return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
233
+ }
234
+ })();
235
+ return v_error === undefined ? null : v_error;
236
+ }
237
+ const select$2 = function FeatureValidationOutputDetailsRepresentationSelect() {
238
+ const { selections: FeatureValidationFieldValuesRepresentation__selections, opaque: FeatureValidationFieldValuesRepresentation__opaque, } = select$3();
239
+ return {
240
+ kind: 'Fragment',
241
+ version: VERSION$1,
242
+ private: [],
243
+ selections: [
244
+ {
245
+ name: 'bpoName',
246
+ kind: 'Scalar'
247
+ },
248
+ {
249
+ name: 'bpoRecordId',
250
+ kind: 'Scalar'
251
+ },
252
+ {
253
+ name: 'featureValidationFieldValues',
254
+ kind: 'Object',
255
+ plural: true,
256
+ selections: FeatureValidationFieldValuesRepresentation__selections
257
+ },
258
+ {
259
+ name: 'message',
260
+ kind: 'Scalar'
261
+ }
262
+ ]
263
+ };
264
+ };
265
+ function equals$1(existing, incoming) {
266
+ const existing_bpoName = existing.bpoName;
267
+ const incoming_bpoName = incoming.bpoName;
268
+ if (!(existing_bpoName === incoming_bpoName)) {
269
+ return false;
270
+ }
271
+ const existing_bpoRecordId = existing.bpoRecordId;
272
+ const incoming_bpoRecordId = incoming.bpoRecordId;
273
+ if (!(existing_bpoRecordId === incoming_bpoRecordId)) {
274
+ return false;
275
+ }
276
+ const existing_message = existing.message;
277
+ const incoming_message = incoming.message;
278
+ if (!(existing_message === incoming_message)) {
279
+ return false;
280
+ }
281
+ const existing_featureValidationFieldValues = existing.featureValidationFieldValues;
282
+ const incoming_featureValidationFieldValues = incoming.featureValidationFieldValues;
283
+ const equals_featureValidationFieldValues_items = equalsArray(existing_featureValidationFieldValues, incoming_featureValidationFieldValues, (existing_featureValidationFieldValues_item, incoming_featureValidationFieldValues_item) => {
284
+ if (!(equals$2(existing_featureValidationFieldValues_item, incoming_featureValidationFieldValues_item))) {
285
+ return false;
286
+ }
287
+ });
288
+ if (equals_featureValidationFieldValues_items === false) {
289
+ return false;
290
+ }
291
+ return true;
292
+ }
293
+
294
+ const TTL = 300;
295
+ const VERSION = "cca11a8e3ab8424bcce64057aad4f46d";
296
+ function validate(obj, path = 'FeatureValidationOutputRepresentation') {
297
+ const v_error = (() => {
298
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
299
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
300
+ }
301
+ if (obj.errorMessage !== undefined) {
302
+ const obj_errorMessage = obj.errorMessage;
303
+ const path_errorMessage = path + '.errorMessage';
304
+ if (typeof obj_errorMessage !== 'string') {
305
+ return new TypeError('Expected "string" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
306
+ }
307
+ }
308
+ const obj_featureValidationOutputDetails = obj.featureValidationOutputDetails;
309
+ const path_featureValidationOutputDetails = path + '.featureValidationOutputDetails';
310
+ if (!ArrayIsArray(obj_featureValidationOutputDetails)) {
311
+ return new TypeError('Expected "array" but received "' + typeof obj_featureValidationOutputDetails + '" (at "' + path_featureValidationOutputDetails + '")');
312
+ }
313
+ for (let i = 0; i < obj_featureValidationOutputDetails.length; i++) {
314
+ const obj_featureValidationOutputDetails_item = obj_featureValidationOutputDetails[i];
315
+ const path_featureValidationOutputDetails_item = path_featureValidationOutputDetails + '[' + i + ']';
316
+ const referencepath_featureValidationOutputDetails_itemValidationError = validate$1(obj_featureValidationOutputDetails_item, path_featureValidationOutputDetails_item);
317
+ if (referencepath_featureValidationOutputDetails_itemValidationError !== null) {
318
+ let message = 'Object doesn\'t match FeatureValidationOutputDetailsRepresentation (at "' + path_featureValidationOutputDetails_item + '")\n';
319
+ message += referencepath_featureValidationOutputDetails_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
320
+ return new TypeError(message);
321
+ }
322
+ }
323
+ const obj_isSuccess = obj.isSuccess;
324
+ const path_isSuccess = path + '.isSuccess';
325
+ if (typeof obj_isSuccess !== 'boolean') {
326
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
327
+ }
328
+ })();
329
+ return v_error === undefined ? null : v_error;
330
+ }
331
+ const RepresentationType = 'FeatureValidationOutputRepresentation';
332
+ function keyBuilder(luvio, config) {
333
+ return keyPrefix + '::' + RepresentationType + ':' + config.isSuccess;
334
+ }
335
+ function keyBuilderFromType(luvio, object) {
336
+ const keyParams = {
337
+ isSuccess: object.isSuccess
338
+ };
339
+ return keyBuilder(luvio, keyParams);
340
+ }
341
+ function normalize(input, existing, path, luvio, store, timestamp) {
342
+ return input;
343
+ }
344
+ const select$1 = function FeatureValidationOutputRepresentationSelect() {
345
+ const { selections: FeatureValidationOutputDetailsRepresentation__selections, opaque: FeatureValidationOutputDetailsRepresentation__opaque, } = select$2();
346
+ return {
347
+ kind: 'Fragment',
348
+ version: VERSION,
349
+ private: [],
350
+ selections: [
351
+ {
352
+ name: 'errorMessage',
353
+ kind: 'Scalar',
354
+ required: false
355
+ },
356
+ {
357
+ name: 'featureValidationOutputDetails',
358
+ kind: 'Object',
359
+ plural: true,
360
+ selections: FeatureValidationOutputDetailsRepresentation__selections
361
+ },
362
+ {
363
+ name: 'isSuccess',
364
+ kind: 'Scalar'
365
+ }
366
+ ]
367
+ };
368
+ };
369
+ function equals(existing, incoming) {
370
+ const existing_isSuccess = existing.isSuccess;
371
+ const incoming_isSuccess = incoming.isSuccess;
372
+ if (!(existing_isSuccess === incoming_isSuccess)) {
373
+ return false;
374
+ }
375
+ const existing_errorMessage = existing.errorMessage;
376
+ const incoming_errorMessage = incoming.errorMessage;
377
+ // if at least one of these optionals is defined
378
+ if (existing_errorMessage !== undefined || incoming_errorMessage !== undefined) {
379
+ // if one of these is not defined we know the other is defined and therefore
380
+ // not equal
381
+ if (existing_errorMessage === undefined || incoming_errorMessage === undefined) {
382
+ return false;
383
+ }
384
+ if (!(existing_errorMessage === incoming_errorMessage)) {
385
+ return false;
386
+ }
387
+ }
388
+ const existing_featureValidationOutputDetails = existing.featureValidationOutputDetails;
389
+ const incoming_featureValidationOutputDetails = incoming.featureValidationOutputDetails;
390
+ const equals_featureValidationOutputDetails_items = equalsArray(existing_featureValidationOutputDetails, incoming_featureValidationOutputDetails, (existing_featureValidationOutputDetails_item, incoming_featureValidationOutputDetails_item) => {
391
+ if (!(equals$1(existing_featureValidationOutputDetails_item, incoming_featureValidationOutputDetails_item))) {
392
+ return false;
393
+ }
394
+ });
395
+ if (equals_featureValidationOutputDetails_items === false) {
396
+ return false;
397
+ }
398
+ return true;
399
+ }
400
+ const ingest = function FeatureValidationOutputRepresentationIngest(input, path, luvio, store, timestamp) {
401
+ if (process.env.NODE_ENV !== 'production') {
402
+ const validateError = validate(input);
403
+ if (validateError !== null) {
404
+ throw validateError;
405
+ }
406
+ }
407
+ const key = keyBuilderFromType(luvio, input);
408
+ const existingRecord = store.readEntry(key);
409
+ const ttlToUse = TTL;
410
+ let incomingRecord = normalize(input, store.readEntry(key), {
411
+ fullPath: key,
412
+ parent: path.parent,
413
+ propertyName: path.propertyName,
414
+ ttl: ttlToUse
415
+ });
416
+ if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
417
+ luvio.storePublish(key, incomingRecord);
418
+ }
419
+ {
420
+ const storeMetadataParams = {
421
+ ttl: ttlToUse,
422
+ namespace: "featurevalidation",
423
+ version: VERSION,
424
+ representationName: RepresentationType,
425
+ };
426
+ luvio.publishStoreMetadata(key, storeMetadataParams);
427
+ }
428
+ return createLink(key);
429
+ };
430
+ function getTypeCacheKeys(luvio, input, fullPathFactory) {
431
+ const rootKeySet = new StoreKeyMap();
432
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
433
+ const rootKey = keyBuilderFromType(luvio, input);
434
+ rootKeySet.set(rootKey, {
435
+ namespace: keyPrefix,
436
+ representationName: RepresentationType,
437
+ mergeable: false
438
+ });
439
+ return rootKeySet;
440
+ }
441
+
442
+ function select(luvio, params) {
443
+ return select$1();
444
+ }
445
+ function getResponseCacheKeys(luvio, resourceParams, response) {
446
+ return getTypeCacheKeys(luvio, response);
447
+ }
448
+ function ingestSuccess(luvio, resourceParams, response) {
449
+ const { body } = response;
450
+ const key = keyBuilderFromType(luvio, body);
451
+ luvio.storeIngest(key, ingest, body);
452
+ const snapshot = luvio.storeLookup({
453
+ recordId: key,
454
+ node: select(),
455
+ variables: {},
456
+ });
457
+ if (process.env.NODE_ENV !== 'production') {
458
+ if (snapshot.state !== 'Fulfilled') {
459
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
460
+ }
461
+ }
462
+ return snapshot;
463
+ }
464
+ function createResourceRequest(config) {
465
+ const headers = {};
466
+ return {
467
+ baseUri: '/services/data/v58.0',
468
+ basePath: '/connect/industries/feature-validation',
469
+ method: 'post',
470
+ body: config.body,
471
+ urlParams: {},
472
+ queryParams: {},
473
+ headers,
474
+ priority: 'normal',
475
+ };
476
+ }
477
+
478
+ const featureValidation_ConfigPropertyNames = {
479
+ displayName: 'featureValidation',
480
+ parameters: {
481
+ required: ['FeatureValidationData'],
482
+ optional: []
483
+ }
484
+ };
485
+ function createResourceParams(config) {
486
+ const resourceParams = {
487
+ body: {
488
+ FeatureValidationData: config.FeatureValidationData
489
+ }
490
+ };
491
+ return resourceParams;
492
+ }
493
+ function typeCheckConfig(untrustedConfig) {
494
+ const config = {};
495
+ const untrustedConfig_FeatureValidationData = untrustedConfig.FeatureValidationData;
496
+ const referenceFeatureValidationInputRepresentationValidationError = validate$3(untrustedConfig_FeatureValidationData);
497
+ if (referenceFeatureValidationInputRepresentationValidationError === null) {
498
+ config.FeatureValidationData = untrustedConfig_FeatureValidationData;
499
+ }
500
+ return config;
501
+ }
502
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
503
+ if (!untrustedIsObject(untrustedConfig)) {
504
+ return null;
505
+ }
506
+ if (process.env.NODE_ENV !== 'production') {
507
+ validateConfig(untrustedConfig, configPropertyNames);
508
+ }
509
+ const config = typeCheckConfig(untrustedConfig);
510
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
511
+ return null;
512
+ }
513
+ return config;
514
+ }
515
+ function buildNetworkSnapshot(luvio, config, options) {
516
+ const resourceParams = createResourceParams(config);
517
+ const request = createResourceRequest(resourceParams);
518
+ return luvio.dispatchResourceRequest(request, options)
519
+ .then((response) => {
520
+ return luvio.handleSuccessResponse(() => {
521
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
522
+ return luvio.storeBroadcast().then(() => snapshot);
523
+ }, () => getResponseCacheKeys(luvio, resourceParams, response.body));
524
+ }, (response) => {
525
+ deepFreeze(response);
526
+ throw response;
527
+ });
528
+ }
529
+ const featureValidationAdapterFactory = (luvio) => {
530
+ return function featureValidation(untrustedConfig) {
531
+ const config = validateAdapterConfig(untrustedConfig, featureValidation_ConfigPropertyNames);
532
+ // Invalid or incomplete config
533
+ if (config === null) {
534
+ throw new Error('Invalid config for "featureValidation"');
535
+ }
536
+ return buildNetworkSnapshot(luvio, config);
537
+ };
538
+ };
539
+
540
+ let featureValidation;
541
+ function bindExportsTo(luvio) {
542
+ function unwrapSnapshotData(factory) {
543
+ const adapter = factory(luvio);
544
+ return (config) => adapter(config).then(snapshot => snapshot.data);
545
+ }
546
+ return {
547
+ featureValidation: unwrapSnapshotData(featureValidationAdapterFactory),
548
+ // Imperative GET Adapters
549
+ };
550
+ }
551
+ withDefaultLuvio((luvio) => {
552
+ ({
553
+ featureValidation,
554
+ } = bindExportsTo(luvio));
555
+ });
556
+
557
+ export { featureValidation };
558
+ // version: 0.131.0-c1ec5b7de
@@ -0,0 +1,135 @@
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
+ # TODO [W-9807143]: Hand rolled due to issue in Generated RAML Gaps (https://salesforce.quip.com/NxVhAkxL6RTW#dGQACAxyxIv)
74
+ FeatureValidationWrapperInputRepresentation:
75
+ description: wrapper of FeatureValidationInputRepresentation
76
+ type: object
77
+ properties:
78
+ FeatureValidationData:
79
+ description: Input representation for FeatureValidationInputRepresentation
80
+ type: FeatureValidationInputRepresentation
81
+ FeatureValidationOutputDetailsRepresentation:
82
+ description: Holds BPO name, bpoRecordId, select fields from the bpo and related
83
+ error message.
84
+ type: object
85
+ properties:
86
+ bpoName:
87
+ description: BPO name
88
+ type: string
89
+ bpoRecordId:
90
+ description: BPO record id
91
+ type: string
92
+ featureValidationFieldValues:
93
+ description: Select fields that were validated as part of use-case implementation.
94
+ type: array
95
+ items:
96
+ type: FeatureValidationFieldValuesRepresentation
97
+ message:
98
+ description: 'Message related to the bpo. Example: Invalid record Id.'
99
+ type: string
100
+ FeatureValidationOutputRepresentation:
101
+ description: FeatureValidation output.
102
+ type: object
103
+ properties:
104
+ errorMessage:
105
+ description: Get FeatureValidation error messages
106
+ type: string
107
+ required: false
108
+ featureValidationOutputDetails:
109
+ description: Holds BPO name, bpoRecordId, select fields from the bpo and related
110
+ error message.
111
+ type: array
112
+ items:
113
+ type: FeatureValidationOutputDetailsRepresentation
114
+ isSuccess:
115
+ description: Get FeatureValidation success flag
116
+ type: boolean
117
+ /connect:
118
+ /industries:
119
+ /feature-validation:
120
+ post:
121
+ displayName: postFeatureValidation
122
+ description: |-
123
+ Run a feature validation to validate data setup for a given use-case and respective record Ids. Supported use cases are @ FeatureValidationUseCaseEnum.
124
+ To add new usecase, add your implementation to this post method and FeatureValidationUseCaseEnum. Populate FeatureValidationOutputRepresentation with the validated BPOs.
125
+ responses:
126
+ '200':
127
+ description: Success
128
+ body:
129
+ application/json:
130
+ type: FeatureValidationOutputRepresentation
131
+ body:
132
+ application/json:
133
+ type: FeatureValidationWrapperInputRepresentation
134
+ # TODO [W-12609182]: Hand Rolled Change that removed 'required: false' since the 'required' property is not allowed in RAML 1.0
135
+ (oas-body-name): FeatureValidationData