@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/LICENSE.txt ADDED
@@ -0,0 +1,82 @@
1
+ Terms of Use
2
+
3
+ Copyright 2022 Salesforce, Inc. All rights reserved.
4
+
5
+ These Terms of Use govern the download, installation, and/or use of this
6
+ software provided by Salesforce, Inc. ("Salesforce") (the "Software"), were
7
+ last updated on April 15, 2022, and constitute a legally binding
8
+ agreement between you and Salesforce. If you do not agree to these Terms of
9
+ Use, do not install or use the Software.
10
+
11
+ Salesforce grants you a worldwide, non-exclusive, no-charge, royalty-free
12
+ copyright license to reproduce, prepare derivative works of, publicly
13
+ display, publicly perform, sublicense, and distribute the Software and
14
+ derivative works subject to these Terms. These Terms shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ Subject to the limited rights expressly granted hereunder, Salesforce
18
+ reserves all rights, title, and interest in and to all intellectual
19
+ property subsisting in the Software. No rights are granted to you hereunder
20
+ other than as expressly set forth herein. Users residing in countries on
21
+ the United States Office of Foreign Assets Control sanction list, or which
22
+ are otherwise subject to a US export embargo, may not use the Software.
23
+
24
+ Implementation of the Software may require development work, for which you
25
+ are responsible. The Software may contain bugs, errors and
26
+ incompatibilities and is made available on an AS IS basis without support,
27
+ updates, or service level commitments.
28
+
29
+ Salesforce reserves the right at any time to modify, suspend, or
30
+ discontinue, the Software (or any part thereof) with or without notice. You
31
+ agree that Salesforce shall not be liable to you or to any third party for
32
+ any modification, suspension, or discontinuance.
33
+
34
+ You agree to defend Salesforce against any claim, demand, suit or
35
+ proceeding made or brought against Salesforce by a third party arising out
36
+ of or accruing from (a) your use of the Software, and (b) any application
37
+ you develop with the Software that infringes any copyright, trademark,
38
+ trade secret, trade dress, patent, or other intellectual property right of
39
+ any person or defames any person or violates their rights of publicity or
40
+ privacy (each a "Claim Against Salesforce"), and will indemnify Salesforce
41
+ from any damages, attorney fees, and costs finally awarded against
42
+ Salesforce as a result of, or for any amounts paid by Salesforce under a
43
+ settlement approved by you in writing of, a Claim Against Salesforce,
44
+ provided Salesforce (x) promptly gives you written notice of the Claim
45
+ Against Salesforce, (y) gives you sole control of the defense and
46
+ settlement of the Claim Against Salesforce (except that you may not settle
47
+ any Claim Against Salesforce unless it unconditionally releases Salesforce
48
+ of all liability), and (z) gives you all reasonable assistance, at your
49
+ expense.
50
+
51
+ WITHOUT LIMITING THE GENERALITY OF THE FOREGOING, THE SOFTWARE IS NOT
52
+ SUPPORTED AND IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
53
+ IMPLIED. IN NO EVENT SHALL SALESFORCE HAVE ANY LIABILITY FOR ANY DAMAGES,
54
+ INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, SPECIAL, INCIDENTAL,
55
+ PUNITIVE, OR CONSEQUENTIAL DAMAGES, OR DAMAGES BASED ON LOST PROFITS, DATA,
56
+ OR USE, IN CONNECTION WITH THE SOFTWARE, HOWEVER CAUSED AND WHETHER IN
57
+ CONTRACT, TORT, OR UNDER ANY OTHER THEORY OF LIABILITY, WHETHER OR NOT YOU
58
+ HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
59
+
60
+ These Terms of Use shall be governed exclusively by the internal laws of
61
+ the State of California, without regard to its conflicts of laws
62
+ rules. Each party hereby consents to the exclusive jurisdiction of the
63
+ state and federal courts located in San Francisco County, California to
64
+ adjudicate any dispute arising out of or relating to these Terms of Use and
65
+ the download, installation, and/or use of the Software. Except as expressly
66
+ stated herein, these Terms of Use constitute the entire agreement between
67
+ the parties, and supersede all prior and contemporaneous agreements,
68
+ proposals, or representations, written or oral, concerning their subject
69
+ matter. No modification, amendment, or waiver of any provision of these
70
+ Terms of Use shall be effective unless it is by an update to these Terms of
71
+ Use that Salesforce makes available, or is in writing and signed by the
72
+ party against whom the modification, amendment, or waiver is to be
73
+ asserted.
74
+
75
+ Data Privacy: Salesforce may collect, process, and store device,
76
+ system, and other information related to your use of the Software. This
77
+ information includes, but is not limited to, IP address, user metrics, and
78
+ other data ("Usage Data"). Salesforce may use Usage Data for analytics,
79
+ product development, and marketing purposes. You acknowledge that files
80
+ generated in conjunction with the Software may contain sensitive or
81
+ confidential data, and you are solely responsible for anonymizing and
82
+ protecting such data.
@@ -0,0 +1,531 @@
1
+ /**
2
+ * Copyright (c) 2022, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+
7
+ import { serializeStructuredKey, StoreKeyMap } from '@luvio/engine';
8
+
9
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
+ const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = Object;
11
+ const { isArray: ArrayIsArray$1 } = Array;
12
+ /**
13
+ * Validates an adapter config is well-formed.
14
+ * @param config The config to validate.
15
+ * @param adapter The adapter validation configuration.
16
+ * @param oneOf The keys the config must contain at least one of.
17
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
18
+ */
19
+ function validateConfig(config, adapter, oneOf) {
20
+ const { displayName } = adapter;
21
+ const { required, optional, unsupported } = adapter.parameters;
22
+ if (config === undefined ||
23
+ required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
24
+ throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
25
+ }
26
+ if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
27
+ throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
28
+ }
29
+ if (unsupported !== undefined &&
30
+ unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
31
+ throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
32
+ }
33
+ const supported = required.concat(optional);
34
+ if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
35
+ throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
36
+ }
37
+ }
38
+ function untrustedIsObject(untrusted) {
39
+ return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
40
+ }
41
+ function areRequiredParametersPresent(config, configPropertyNames) {
42
+ return configPropertyNames.parameters.required.every(req => req in config);
43
+ }
44
+ const keyPrefix = 'featurevalidation';
45
+
46
+ const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
47
+ const { isArray: ArrayIsArray } = Array;
48
+ function equalsArray(a, b, equalsItem) {
49
+ const aLength = a.length;
50
+ const bLength = b.length;
51
+ if (aLength !== bLength) {
52
+ return false;
53
+ }
54
+ for (let i = 0; i < aLength; i++) {
55
+ if (equalsItem(a[i], b[i]) === false) {
56
+ return false;
57
+ }
58
+ }
59
+ return true;
60
+ }
61
+ function deepFreeze(value) {
62
+ // No need to freeze primitives
63
+ if (typeof value !== 'object' || value === null) {
64
+ return;
65
+ }
66
+ if (ArrayIsArray(value)) {
67
+ for (let i = 0, len = value.length; i < len; i += 1) {
68
+ deepFreeze(value[i]);
69
+ }
70
+ }
71
+ else {
72
+ const keys = ObjectKeys(value);
73
+ for (let i = 0, len = keys.length; i < len; i += 1) {
74
+ deepFreeze(value[keys[i]]);
75
+ }
76
+ }
77
+ ObjectFreeze(value);
78
+ }
79
+ function createLink(ref) {
80
+ return {
81
+ __ref: serializeStructuredKey(ref),
82
+ };
83
+ }
84
+
85
+ function validate$3(obj, path = 'FeatureValidationInputRepresentation') {
86
+ const v_error = (() => {
87
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
88
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
89
+ }
90
+ const obj_featureValidationInputDetails = obj.featureValidationInputDetails;
91
+ const path_featureValidationInputDetails = path + '.featureValidationInputDetails';
92
+ if (!ArrayIsArray(obj_featureValidationInputDetails)) {
93
+ return new TypeError('Expected "array" but received "' + typeof obj_featureValidationInputDetails + '" (at "' + path_featureValidationInputDetails + '")');
94
+ }
95
+ for (let i = 0; i < obj_featureValidationInputDetails.length; i++) {
96
+ const obj_featureValidationInputDetails_item = obj_featureValidationInputDetails[i];
97
+ const path_featureValidationInputDetails_item = path_featureValidationInputDetails + '[' + i + ']';
98
+ if (typeof obj_featureValidationInputDetails_item !== 'object' || ArrayIsArray(obj_featureValidationInputDetails_item) || obj_featureValidationInputDetails_item === null) {
99
+ return new TypeError('Expected "object" but received "' + typeof obj_featureValidationInputDetails_item + '" (at "' + path_featureValidationInputDetails_item + '")');
100
+ }
101
+ }
102
+ const obj_useCase = obj.useCase;
103
+ const path_useCase = path + '.useCase';
104
+ if (typeof obj_useCase !== 'string') {
105
+ return new TypeError('Expected "string" but received "' + typeof obj_useCase + '" (at "' + path_useCase + '")');
106
+ }
107
+ })();
108
+ return v_error === undefined ? null : v_error;
109
+ }
110
+
111
+ const VERSION$2 = "631aec0cb3216fffb314c3734733f29b";
112
+ function validate$2(obj, path = 'FeatureValidationFieldValuesRepresentation') {
113
+ const v_error = (() => {
114
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
115
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
116
+ }
117
+ const obj_fieldName = obj.fieldName;
118
+ const path_fieldName = path + '.fieldName';
119
+ if (typeof obj_fieldName !== 'string') {
120
+ return new TypeError('Expected "string" but received "' + typeof obj_fieldName + '" (at "' + path_fieldName + '")');
121
+ }
122
+ const obj_fieldValue = obj.fieldValue;
123
+ const path_fieldValue = path + '.fieldValue';
124
+ if (typeof obj_fieldValue !== 'string') {
125
+ return new TypeError('Expected "string" but received "' + typeof obj_fieldValue + '" (at "' + path_fieldValue + '")');
126
+ }
127
+ const obj_message = obj.message;
128
+ const path_message = path + '.message';
129
+ if (typeof obj_message !== 'string') {
130
+ return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
131
+ }
132
+ const obj_required = obj.required;
133
+ const path_required = path + '.required';
134
+ if (typeof obj_required !== 'boolean') {
135
+ return new TypeError('Expected "boolean" but received "' + typeof obj_required + '" (at "' + path_required + '")');
136
+ }
137
+ })();
138
+ return v_error === undefined ? null : v_error;
139
+ }
140
+ const select$3 = function FeatureValidationFieldValuesRepresentationSelect() {
141
+ return {
142
+ kind: 'Fragment',
143
+ version: VERSION$2,
144
+ private: [],
145
+ selections: [
146
+ {
147
+ name: 'fieldName',
148
+ kind: 'Scalar'
149
+ },
150
+ {
151
+ name: 'fieldValue',
152
+ kind: 'Scalar'
153
+ },
154
+ {
155
+ name: 'message',
156
+ kind: 'Scalar'
157
+ },
158
+ {
159
+ name: 'required',
160
+ kind: 'Scalar'
161
+ }
162
+ ]
163
+ };
164
+ };
165
+ function equals$2(existing, incoming) {
166
+ const existing_required = existing.required;
167
+ const incoming_required = incoming.required;
168
+ if (!(existing_required === incoming_required)) {
169
+ return false;
170
+ }
171
+ const existing_fieldName = existing.fieldName;
172
+ const incoming_fieldName = incoming.fieldName;
173
+ if (!(existing_fieldName === incoming_fieldName)) {
174
+ return false;
175
+ }
176
+ const existing_fieldValue = existing.fieldValue;
177
+ const incoming_fieldValue = incoming.fieldValue;
178
+ if (!(existing_fieldValue === incoming_fieldValue)) {
179
+ return false;
180
+ }
181
+ const existing_message = existing.message;
182
+ const incoming_message = incoming.message;
183
+ if (!(existing_message === incoming_message)) {
184
+ return false;
185
+ }
186
+ return true;
187
+ }
188
+
189
+ const VERSION$1 = "b2421cf8b77991983bf69e64a9fa0236";
190
+ function validate$1(obj, path = 'FeatureValidationOutputDetailsRepresentation') {
191
+ const v_error = (() => {
192
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
193
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
194
+ }
195
+ const obj_bpoName = obj.bpoName;
196
+ const path_bpoName = path + '.bpoName';
197
+ if (typeof obj_bpoName !== 'string') {
198
+ return new TypeError('Expected "string" but received "' + typeof obj_bpoName + '" (at "' + path_bpoName + '")');
199
+ }
200
+ const obj_bpoRecordId = obj.bpoRecordId;
201
+ const path_bpoRecordId = path + '.bpoRecordId';
202
+ if (typeof obj_bpoRecordId !== 'string') {
203
+ return new TypeError('Expected "string" but received "' + typeof obj_bpoRecordId + '" (at "' + path_bpoRecordId + '")');
204
+ }
205
+ const obj_featureValidationFieldValues = obj.featureValidationFieldValues;
206
+ const path_featureValidationFieldValues = path + '.featureValidationFieldValues';
207
+ if (!ArrayIsArray(obj_featureValidationFieldValues)) {
208
+ return new TypeError('Expected "array" but received "' + typeof obj_featureValidationFieldValues + '" (at "' + path_featureValidationFieldValues + '")');
209
+ }
210
+ for (let i = 0; i < obj_featureValidationFieldValues.length; i++) {
211
+ const obj_featureValidationFieldValues_item = obj_featureValidationFieldValues[i];
212
+ const path_featureValidationFieldValues_item = path_featureValidationFieldValues + '[' + i + ']';
213
+ const referencepath_featureValidationFieldValues_itemValidationError = validate$2(obj_featureValidationFieldValues_item, path_featureValidationFieldValues_item);
214
+ if (referencepath_featureValidationFieldValues_itemValidationError !== null) {
215
+ let message = 'Object doesn\'t match FeatureValidationFieldValuesRepresentation (at "' + path_featureValidationFieldValues_item + '")\n';
216
+ message += referencepath_featureValidationFieldValues_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
217
+ return new TypeError(message);
218
+ }
219
+ }
220
+ const obj_message = obj.message;
221
+ const path_message = path + '.message';
222
+ if (typeof obj_message !== 'string') {
223
+ return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
224
+ }
225
+ })();
226
+ return v_error === undefined ? null : v_error;
227
+ }
228
+ const select$2 = function FeatureValidationOutputDetailsRepresentationSelect() {
229
+ const { selections: FeatureValidationFieldValuesRepresentation__selections, opaque: FeatureValidationFieldValuesRepresentation__opaque, } = select$3();
230
+ return {
231
+ kind: 'Fragment',
232
+ version: VERSION$1,
233
+ private: [],
234
+ selections: [
235
+ {
236
+ name: 'bpoName',
237
+ kind: 'Scalar'
238
+ },
239
+ {
240
+ name: 'bpoRecordId',
241
+ kind: 'Scalar'
242
+ },
243
+ {
244
+ name: 'featureValidationFieldValues',
245
+ kind: 'Object',
246
+ plural: true,
247
+ selections: FeatureValidationFieldValuesRepresentation__selections
248
+ },
249
+ {
250
+ name: 'message',
251
+ kind: 'Scalar'
252
+ }
253
+ ]
254
+ };
255
+ };
256
+ function equals$1(existing, incoming) {
257
+ const existing_bpoName = existing.bpoName;
258
+ const incoming_bpoName = incoming.bpoName;
259
+ if (!(existing_bpoName === incoming_bpoName)) {
260
+ return false;
261
+ }
262
+ const existing_bpoRecordId = existing.bpoRecordId;
263
+ const incoming_bpoRecordId = incoming.bpoRecordId;
264
+ if (!(existing_bpoRecordId === incoming_bpoRecordId)) {
265
+ return false;
266
+ }
267
+ const existing_message = existing.message;
268
+ const incoming_message = incoming.message;
269
+ if (!(existing_message === incoming_message)) {
270
+ return false;
271
+ }
272
+ const existing_featureValidationFieldValues = existing.featureValidationFieldValues;
273
+ const incoming_featureValidationFieldValues = incoming.featureValidationFieldValues;
274
+ const equals_featureValidationFieldValues_items = equalsArray(existing_featureValidationFieldValues, incoming_featureValidationFieldValues, (existing_featureValidationFieldValues_item, incoming_featureValidationFieldValues_item) => {
275
+ if (!(equals$2(existing_featureValidationFieldValues_item, incoming_featureValidationFieldValues_item))) {
276
+ return false;
277
+ }
278
+ });
279
+ if (equals_featureValidationFieldValues_items === false) {
280
+ return false;
281
+ }
282
+ return true;
283
+ }
284
+
285
+ const TTL = 300;
286
+ const VERSION = "cca11a8e3ab8424bcce64057aad4f46d";
287
+ function validate(obj, path = 'FeatureValidationOutputRepresentation') {
288
+ const v_error = (() => {
289
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
290
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
291
+ }
292
+ if (obj.errorMessage !== undefined) {
293
+ const obj_errorMessage = obj.errorMessage;
294
+ const path_errorMessage = path + '.errorMessage';
295
+ if (typeof obj_errorMessage !== 'string') {
296
+ return new TypeError('Expected "string" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
297
+ }
298
+ }
299
+ const obj_featureValidationOutputDetails = obj.featureValidationOutputDetails;
300
+ const path_featureValidationOutputDetails = path + '.featureValidationOutputDetails';
301
+ if (!ArrayIsArray(obj_featureValidationOutputDetails)) {
302
+ return new TypeError('Expected "array" but received "' + typeof obj_featureValidationOutputDetails + '" (at "' + path_featureValidationOutputDetails + '")');
303
+ }
304
+ for (let i = 0; i < obj_featureValidationOutputDetails.length; i++) {
305
+ const obj_featureValidationOutputDetails_item = obj_featureValidationOutputDetails[i];
306
+ const path_featureValidationOutputDetails_item = path_featureValidationOutputDetails + '[' + i + ']';
307
+ const referencepath_featureValidationOutputDetails_itemValidationError = validate$1(obj_featureValidationOutputDetails_item, path_featureValidationOutputDetails_item);
308
+ if (referencepath_featureValidationOutputDetails_itemValidationError !== null) {
309
+ let message = 'Object doesn\'t match FeatureValidationOutputDetailsRepresentation (at "' + path_featureValidationOutputDetails_item + '")\n';
310
+ message += referencepath_featureValidationOutputDetails_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
311
+ return new TypeError(message);
312
+ }
313
+ }
314
+ const obj_isSuccess = obj.isSuccess;
315
+ const path_isSuccess = path + '.isSuccess';
316
+ if (typeof obj_isSuccess !== 'boolean') {
317
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
318
+ }
319
+ })();
320
+ return v_error === undefined ? null : v_error;
321
+ }
322
+ const RepresentationType = 'FeatureValidationOutputRepresentation';
323
+ function keyBuilder(luvio, config) {
324
+ return keyPrefix + '::' + RepresentationType + ':' + config.isSuccess;
325
+ }
326
+ function keyBuilderFromType(luvio, object) {
327
+ const keyParams = {
328
+ isSuccess: object.isSuccess
329
+ };
330
+ return keyBuilder(luvio, keyParams);
331
+ }
332
+ function normalize(input, existing, path, luvio, store, timestamp) {
333
+ return input;
334
+ }
335
+ const select$1 = function FeatureValidationOutputRepresentationSelect() {
336
+ const { selections: FeatureValidationOutputDetailsRepresentation__selections, opaque: FeatureValidationOutputDetailsRepresentation__opaque, } = select$2();
337
+ return {
338
+ kind: 'Fragment',
339
+ version: VERSION,
340
+ private: [],
341
+ selections: [
342
+ {
343
+ name: 'errorMessage',
344
+ kind: 'Scalar',
345
+ required: false
346
+ },
347
+ {
348
+ name: 'featureValidationOutputDetails',
349
+ kind: 'Object',
350
+ plural: true,
351
+ selections: FeatureValidationOutputDetailsRepresentation__selections
352
+ },
353
+ {
354
+ name: 'isSuccess',
355
+ kind: 'Scalar'
356
+ }
357
+ ]
358
+ };
359
+ };
360
+ function equals(existing, incoming) {
361
+ const existing_isSuccess = existing.isSuccess;
362
+ const incoming_isSuccess = incoming.isSuccess;
363
+ if (!(existing_isSuccess === incoming_isSuccess)) {
364
+ return false;
365
+ }
366
+ const existing_errorMessage = existing.errorMessage;
367
+ const incoming_errorMessage = incoming.errorMessage;
368
+ // if at least one of these optionals is defined
369
+ if (existing_errorMessage !== undefined || incoming_errorMessage !== undefined) {
370
+ // if one of these is not defined we know the other is defined and therefore
371
+ // not equal
372
+ if (existing_errorMessage === undefined || incoming_errorMessage === undefined) {
373
+ return false;
374
+ }
375
+ if (!(existing_errorMessage === incoming_errorMessage)) {
376
+ return false;
377
+ }
378
+ }
379
+ const existing_featureValidationOutputDetails = existing.featureValidationOutputDetails;
380
+ const incoming_featureValidationOutputDetails = incoming.featureValidationOutputDetails;
381
+ const equals_featureValidationOutputDetails_items = equalsArray(existing_featureValidationOutputDetails, incoming_featureValidationOutputDetails, (existing_featureValidationOutputDetails_item, incoming_featureValidationOutputDetails_item) => {
382
+ if (!(equals$1(existing_featureValidationOutputDetails_item, incoming_featureValidationOutputDetails_item))) {
383
+ return false;
384
+ }
385
+ });
386
+ if (equals_featureValidationOutputDetails_items === false) {
387
+ return false;
388
+ }
389
+ return true;
390
+ }
391
+ const ingest = function FeatureValidationOutputRepresentationIngest(input, path, luvio, store, timestamp) {
392
+ if (process.env.NODE_ENV !== 'production') {
393
+ const validateError = validate(input);
394
+ if (validateError !== null) {
395
+ throw validateError;
396
+ }
397
+ }
398
+ const key = keyBuilderFromType(luvio, input);
399
+ const existingRecord = store.readEntry(key);
400
+ const ttlToUse = TTL;
401
+ let incomingRecord = normalize(input, store.readEntry(key), {
402
+ fullPath: key,
403
+ parent: path.parent,
404
+ propertyName: path.propertyName,
405
+ ttl: ttlToUse
406
+ });
407
+ if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
408
+ luvio.storePublish(key, incomingRecord);
409
+ }
410
+ {
411
+ const storeMetadataParams = {
412
+ ttl: ttlToUse,
413
+ namespace: "featurevalidation",
414
+ version: VERSION,
415
+ representationName: RepresentationType,
416
+ };
417
+ luvio.publishStoreMetadata(key, storeMetadataParams);
418
+ }
419
+ return createLink(key);
420
+ };
421
+ function getTypeCacheKeys(luvio, input, fullPathFactory) {
422
+ const rootKeySet = new StoreKeyMap();
423
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
424
+ const rootKey = keyBuilderFromType(luvio, input);
425
+ rootKeySet.set(rootKey, {
426
+ namespace: keyPrefix,
427
+ representationName: RepresentationType,
428
+ mergeable: false
429
+ });
430
+ return rootKeySet;
431
+ }
432
+
433
+ function select(luvio, params) {
434
+ return select$1();
435
+ }
436
+ function getResponseCacheKeys(luvio, resourceParams, response) {
437
+ return getTypeCacheKeys(luvio, response);
438
+ }
439
+ function ingestSuccess(luvio, resourceParams, response) {
440
+ const { body } = response;
441
+ const key = keyBuilderFromType(luvio, body);
442
+ luvio.storeIngest(key, ingest, body);
443
+ const snapshot = luvio.storeLookup({
444
+ recordId: key,
445
+ node: select(),
446
+ variables: {},
447
+ });
448
+ if (process.env.NODE_ENV !== 'production') {
449
+ if (snapshot.state !== 'Fulfilled') {
450
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
451
+ }
452
+ }
453
+ return snapshot;
454
+ }
455
+ function createResourceRequest(config) {
456
+ const headers = {};
457
+ return {
458
+ baseUri: '/services/data/v58.0',
459
+ basePath: '/connect/industries/feature-validation',
460
+ method: 'post',
461
+ body: config.body,
462
+ urlParams: {},
463
+ queryParams: {},
464
+ headers,
465
+ priority: 'normal',
466
+ };
467
+ }
468
+
469
+ const featureValidation_ConfigPropertyNames = {
470
+ displayName: 'featureValidation',
471
+ parameters: {
472
+ required: ['FeatureValidationData'],
473
+ optional: []
474
+ }
475
+ };
476
+ function createResourceParams(config) {
477
+ const resourceParams = {
478
+ body: {
479
+ FeatureValidationData: config.FeatureValidationData
480
+ }
481
+ };
482
+ return resourceParams;
483
+ }
484
+ function typeCheckConfig(untrustedConfig) {
485
+ const config = {};
486
+ const untrustedConfig_FeatureValidationData = untrustedConfig.FeatureValidationData;
487
+ const referenceFeatureValidationInputRepresentationValidationError = validate$3(untrustedConfig_FeatureValidationData);
488
+ if (referenceFeatureValidationInputRepresentationValidationError === null) {
489
+ config.FeatureValidationData = untrustedConfig_FeatureValidationData;
490
+ }
491
+ return config;
492
+ }
493
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
494
+ if (!untrustedIsObject(untrustedConfig)) {
495
+ return null;
496
+ }
497
+ if (process.env.NODE_ENV !== 'production') {
498
+ validateConfig(untrustedConfig, configPropertyNames);
499
+ }
500
+ const config = typeCheckConfig(untrustedConfig);
501
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
502
+ return null;
503
+ }
504
+ return config;
505
+ }
506
+ function buildNetworkSnapshot(luvio, config, options) {
507
+ const resourceParams = createResourceParams(config);
508
+ const request = createResourceRequest(resourceParams);
509
+ return luvio.dispatchResourceRequest(request, options)
510
+ .then((response) => {
511
+ return luvio.handleSuccessResponse(() => {
512
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
513
+ return luvio.storeBroadcast().then(() => snapshot);
514
+ }, () => getResponseCacheKeys(luvio, resourceParams, response.body));
515
+ }, (response) => {
516
+ deepFreeze(response);
517
+ throw response;
518
+ });
519
+ }
520
+ const featureValidationAdapterFactory = (luvio) => {
521
+ return function featureValidation(untrustedConfig) {
522
+ const config = validateAdapterConfig(untrustedConfig, featureValidation_ConfigPropertyNames);
523
+ // Invalid or incomplete config
524
+ if (config === null) {
525
+ throw new Error('Invalid config for "featureValidation"');
526
+ }
527
+ return buildNetworkSnapshot(luvio, config);
528
+ };
529
+ };
530
+
531
+ export { featureValidationAdapterFactory };
@@ -0,0 +1,66 @@
1
+ import { Adapter as $64$luvio_engine_Adapter, Snapshot as $64$luvio_engine_Snapshot, UnfulfilledSnapshot as $64$luvio_engine_UnfulfilledSnapshot } from '@luvio/engine';
2
+ export declare const ObjectPrototypeHasOwnProperty: (v: PropertyKey) => boolean;
3
+ declare const ObjectKeys: {
4
+ (o: object): string[];
5
+ (o: {}): string[];
6
+ }, ObjectFreeze: {
7
+ <T extends Function>(f: T): T;
8
+ <T_1 extends {
9
+ [idx: string]: object | U | null | undefined;
10
+ }, U extends string | number | bigint | boolean | symbol>(o: T_1): Readonly<T_1>;
11
+ <T_2>(o: T_2): Readonly<T_2>;
12
+ }, ObjectCreate: {
13
+ (o: object | null): any;
14
+ (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any;
15
+ };
16
+ export { ObjectFreeze, ObjectCreate, ObjectKeys };
17
+ export declare const ArrayIsArray: (arg: any) => arg is any[];
18
+ export declare const ArrayPrototypePush: (...items: any[]) => number;
19
+ export interface AdapterValidationConfig {
20
+ displayName: string;
21
+ parameters: {
22
+ required: string[];
23
+ optional: string[];
24
+ unsupported?: string[];
25
+ };
26
+ }
27
+ /**
28
+ * Validates an adapter config is well-formed.
29
+ * @param config The config to validate.
30
+ * @param adapter The adapter validation configuration.
31
+ * @param oneOf The keys the config must contain at least one of.
32
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
33
+ */
34
+ export declare function validateConfig<T>(config: Untrusted<T>, adapter: AdapterValidationConfig, oneOf?: string[]): void;
35
+ export declare function untrustedIsObject<Base>(untrusted: unknown): untrusted is Untrusted<Base>;
36
+ export type UncoercedConfiguration<Base, Options extends {
37
+ [key in keyof Base]?: any;
38
+ }> = {
39
+ [Key in keyof Base]?: Base[Key] | Options[Key];
40
+ };
41
+ export type Untrusted<Base> = Partial<Base>;
42
+ export declare function areRequiredParametersPresent<T>(config: any, configPropertyNames: AdapterValidationConfig): config is T;
43
+ export declare function refreshable<C, D, R>(adapter: $64$luvio_engine_Adapter<C, D>, resolve: (config: unknown) => Promise<$64$luvio_engine_Snapshot<R>>): $64$luvio_engine_Adapter<C, D>;
44
+ export declare const SNAPSHOT_STATE_FULFILLED = "Fulfilled";
45
+ export declare const SNAPSHOT_STATE_UNFULFILLED = "Unfulfilled";
46
+ export declare const snapshotRefreshOptions: {
47
+ overrides: {
48
+ headers: {
49
+ 'Cache-Control': string;
50
+ };
51
+ };
52
+ };
53
+ /**
54
+ * A deterministic JSON stringify implementation. Heavily adapted from https://github.com/epoberezkin/fast-json-stable-stringify.
55
+ * This is needed because insertion order for JSON.stringify(object) affects output:
56
+ * JSON.stringify({a: 1, b: 2})
57
+ * "{"a":1,"b":2}"
58
+ * JSON.stringify({b: 2, a: 1})
59
+ * "{"b":2,"a":1}"
60
+ * @param data Data to be JSON-stringified.
61
+ * @returns JSON.stringified value with consistent ordering of keys.
62
+ */
63
+ export declare function stableJSONStringify(node: any): string | undefined;
64
+ export declare function getFetchResponseStatusText(status: number): string;
65
+ export declare function isUnfulfilledSnapshot<T, U>(snapshot: $64$luvio_engine_Snapshot<T, U>): snapshot is $64$luvio_engine_UnfulfilledSnapshot<T, U>;
66
+ export declare const keyPrefix = "featurevalidation";