@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/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,518 @@
|
|
|
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
|
+
const VERSION$2 = "631aec0cb3216fffb314c3734733f29b";
|
|
86
|
+
function validate$2(obj, path = 'FeatureValidationFieldValuesRepresentation') {
|
|
87
|
+
const v_error = (() => {
|
|
88
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
89
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
90
|
+
}
|
|
91
|
+
const obj_fieldName = obj.fieldName;
|
|
92
|
+
const path_fieldName = path + '.fieldName';
|
|
93
|
+
if (typeof obj_fieldName !== 'string') {
|
|
94
|
+
return new TypeError('Expected "string" but received "' + typeof obj_fieldName + '" (at "' + path_fieldName + '")');
|
|
95
|
+
}
|
|
96
|
+
const obj_fieldValue = obj.fieldValue;
|
|
97
|
+
const path_fieldValue = path + '.fieldValue';
|
|
98
|
+
if (typeof obj_fieldValue !== 'string') {
|
|
99
|
+
return new TypeError('Expected "string" but received "' + typeof obj_fieldValue + '" (at "' + path_fieldValue + '")');
|
|
100
|
+
}
|
|
101
|
+
const obj_message = obj.message;
|
|
102
|
+
const path_message = path + '.message';
|
|
103
|
+
if (typeof obj_message !== 'string') {
|
|
104
|
+
return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
|
|
105
|
+
}
|
|
106
|
+
const obj_required = obj.required;
|
|
107
|
+
const path_required = path + '.required';
|
|
108
|
+
if (typeof obj_required !== 'boolean') {
|
|
109
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_required + '" (at "' + path_required + '")');
|
|
110
|
+
}
|
|
111
|
+
})();
|
|
112
|
+
return v_error === undefined ? null : v_error;
|
|
113
|
+
}
|
|
114
|
+
const select$3 = function FeatureValidationFieldValuesRepresentationSelect() {
|
|
115
|
+
return {
|
|
116
|
+
kind: 'Fragment',
|
|
117
|
+
version: VERSION$2,
|
|
118
|
+
private: [],
|
|
119
|
+
selections: [
|
|
120
|
+
{
|
|
121
|
+
name: 'fieldName',
|
|
122
|
+
kind: 'Scalar'
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: 'fieldValue',
|
|
126
|
+
kind: 'Scalar'
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: 'message',
|
|
130
|
+
kind: 'Scalar'
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: 'required',
|
|
134
|
+
kind: 'Scalar'
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
function equals$2(existing, incoming) {
|
|
140
|
+
const existing_required = existing.required;
|
|
141
|
+
const incoming_required = incoming.required;
|
|
142
|
+
if (!(existing_required === incoming_required)) {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
const existing_fieldName = existing.fieldName;
|
|
146
|
+
const incoming_fieldName = incoming.fieldName;
|
|
147
|
+
if (!(existing_fieldName === incoming_fieldName)) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
const existing_fieldValue = existing.fieldValue;
|
|
151
|
+
const incoming_fieldValue = incoming.fieldValue;
|
|
152
|
+
if (!(existing_fieldValue === incoming_fieldValue)) {
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
const existing_message = existing.message;
|
|
156
|
+
const incoming_message = incoming.message;
|
|
157
|
+
if (!(existing_message === incoming_message)) {
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const VERSION$1 = "b2421cf8b77991983bf69e64a9fa0236";
|
|
164
|
+
function validate$1(obj, path = 'FeatureValidationOutputDetailsRepresentation') {
|
|
165
|
+
const v_error = (() => {
|
|
166
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
167
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
168
|
+
}
|
|
169
|
+
const obj_bpoName = obj.bpoName;
|
|
170
|
+
const path_bpoName = path + '.bpoName';
|
|
171
|
+
if (typeof obj_bpoName !== 'string') {
|
|
172
|
+
return new TypeError('Expected "string" but received "' + typeof obj_bpoName + '" (at "' + path_bpoName + '")');
|
|
173
|
+
}
|
|
174
|
+
const obj_bpoRecordId = obj.bpoRecordId;
|
|
175
|
+
const path_bpoRecordId = path + '.bpoRecordId';
|
|
176
|
+
if (typeof obj_bpoRecordId !== 'string') {
|
|
177
|
+
return new TypeError('Expected "string" but received "' + typeof obj_bpoRecordId + '" (at "' + path_bpoRecordId + '")');
|
|
178
|
+
}
|
|
179
|
+
const obj_featureValidationFieldValues = obj.featureValidationFieldValues;
|
|
180
|
+
const path_featureValidationFieldValues = path + '.featureValidationFieldValues';
|
|
181
|
+
if (!ArrayIsArray(obj_featureValidationFieldValues)) {
|
|
182
|
+
return new TypeError('Expected "array" but received "' + typeof obj_featureValidationFieldValues + '" (at "' + path_featureValidationFieldValues + '")');
|
|
183
|
+
}
|
|
184
|
+
for (let i = 0; i < obj_featureValidationFieldValues.length; i++) {
|
|
185
|
+
const obj_featureValidationFieldValues_item = obj_featureValidationFieldValues[i];
|
|
186
|
+
const path_featureValidationFieldValues_item = path_featureValidationFieldValues + '[' + i + ']';
|
|
187
|
+
const referencepath_featureValidationFieldValues_itemValidationError = validate$2(obj_featureValidationFieldValues_item, path_featureValidationFieldValues_item);
|
|
188
|
+
if (referencepath_featureValidationFieldValues_itemValidationError !== null) {
|
|
189
|
+
let message = 'Object doesn\'t match FeatureValidationFieldValuesRepresentation (at "' + path_featureValidationFieldValues_item + '")\n';
|
|
190
|
+
message += referencepath_featureValidationFieldValues_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
191
|
+
return new TypeError(message);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
const obj_message = obj.message;
|
|
195
|
+
const path_message = path + '.message';
|
|
196
|
+
if (typeof obj_message !== 'string') {
|
|
197
|
+
return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
|
|
198
|
+
}
|
|
199
|
+
})();
|
|
200
|
+
return v_error === undefined ? null : v_error;
|
|
201
|
+
}
|
|
202
|
+
const select$2 = function FeatureValidationOutputDetailsRepresentationSelect() {
|
|
203
|
+
const { selections: FeatureValidationFieldValuesRepresentation__selections, opaque: FeatureValidationFieldValuesRepresentation__opaque, } = select$3();
|
|
204
|
+
return {
|
|
205
|
+
kind: 'Fragment',
|
|
206
|
+
version: VERSION$1,
|
|
207
|
+
private: [],
|
|
208
|
+
selections: [
|
|
209
|
+
{
|
|
210
|
+
name: 'bpoName',
|
|
211
|
+
kind: 'Scalar'
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
name: 'bpoRecordId',
|
|
215
|
+
kind: 'Scalar'
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
name: 'featureValidationFieldValues',
|
|
219
|
+
kind: 'Object',
|
|
220
|
+
plural: true,
|
|
221
|
+
selections: FeatureValidationFieldValuesRepresentation__selections
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
name: 'message',
|
|
225
|
+
kind: 'Scalar'
|
|
226
|
+
}
|
|
227
|
+
]
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
function equals$1(existing, incoming) {
|
|
231
|
+
const existing_bpoName = existing.bpoName;
|
|
232
|
+
const incoming_bpoName = incoming.bpoName;
|
|
233
|
+
if (!(existing_bpoName === incoming_bpoName)) {
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
const existing_bpoRecordId = existing.bpoRecordId;
|
|
237
|
+
const incoming_bpoRecordId = incoming.bpoRecordId;
|
|
238
|
+
if (!(existing_bpoRecordId === incoming_bpoRecordId)) {
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
const existing_message = existing.message;
|
|
242
|
+
const incoming_message = incoming.message;
|
|
243
|
+
if (!(existing_message === incoming_message)) {
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
246
|
+
const existing_featureValidationFieldValues = existing.featureValidationFieldValues;
|
|
247
|
+
const incoming_featureValidationFieldValues = incoming.featureValidationFieldValues;
|
|
248
|
+
const equals_featureValidationFieldValues_items = equalsArray(existing_featureValidationFieldValues, incoming_featureValidationFieldValues, (existing_featureValidationFieldValues_item, incoming_featureValidationFieldValues_item) => {
|
|
249
|
+
if (!(equals$2(existing_featureValidationFieldValues_item, incoming_featureValidationFieldValues_item))) {
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
if (equals_featureValidationFieldValues_items === false) {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
return true;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const TTL = 300;
|
|
260
|
+
const VERSION = "cca11a8e3ab8424bcce64057aad4f46d";
|
|
261
|
+
function validate(obj, path = 'FeatureValidationOutputRepresentation') {
|
|
262
|
+
const v_error = (() => {
|
|
263
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
264
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
265
|
+
}
|
|
266
|
+
if (obj.errorMessage !== undefined) {
|
|
267
|
+
const obj_errorMessage = obj.errorMessage;
|
|
268
|
+
const path_errorMessage = path + '.errorMessage';
|
|
269
|
+
if (typeof obj_errorMessage !== 'string') {
|
|
270
|
+
return new TypeError('Expected "string" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
const obj_featureValidationOutputDetails = obj.featureValidationOutputDetails;
|
|
274
|
+
const path_featureValidationOutputDetails = path + '.featureValidationOutputDetails';
|
|
275
|
+
if (!ArrayIsArray(obj_featureValidationOutputDetails)) {
|
|
276
|
+
return new TypeError('Expected "array" but received "' + typeof obj_featureValidationOutputDetails + '" (at "' + path_featureValidationOutputDetails + '")');
|
|
277
|
+
}
|
|
278
|
+
for (let i = 0; i < obj_featureValidationOutputDetails.length; i++) {
|
|
279
|
+
const obj_featureValidationOutputDetails_item = obj_featureValidationOutputDetails[i];
|
|
280
|
+
const path_featureValidationOutputDetails_item = path_featureValidationOutputDetails + '[' + i + ']';
|
|
281
|
+
const referencepath_featureValidationOutputDetails_itemValidationError = validate$1(obj_featureValidationOutputDetails_item, path_featureValidationOutputDetails_item);
|
|
282
|
+
if (referencepath_featureValidationOutputDetails_itemValidationError !== null) {
|
|
283
|
+
let message = 'Object doesn\'t match FeatureValidationOutputDetailsRepresentation (at "' + path_featureValidationOutputDetails_item + '")\n';
|
|
284
|
+
message += referencepath_featureValidationOutputDetails_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
285
|
+
return new TypeError(message);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
const obj_isSuccess = obj.isSuccess;
|
|
289
|
+
const path_isSuccess = path + '.isSuccess';
|
|
290
|
+
if (typeof obj_isSuccess !== 'boolean') {
|
|
291
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
|
|
292
|
+
}
|
|
293
|
+
})();
|
|
294
|
+
return v_error === undefined ? null : v_error;
|
|
295
|
+
}
|
|
296
|
+
const RepresentationType = 'FeatureValidationOutputRepresentation';
|
|
297
|
+
function keyBuilder(luvio, config) {
|
|
298
|
+
return keyPrefix + '::' + RepresentationType + ':' + config.isSuccess;
|
|
299
|
+
}
|
|
300
|
+
function keyBuilderFromType(luvio, object) {
|
|
301
|
+
const keyParams = {
|
|
302
|
+
isSuccess: object.isSuccess
|
|
303
|
+
};
|
|
304
|
+
return keyBuilder(luvio, keyParams);
|
|
305
|
+
}
|
|
306
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
307
|
+
return input;
|
|
308
|
+
}
|
|
309
|
+
const select$1 = function FeatureValidationOutputRepresentationSelect() {
|
|
310
|
+
const { selections: FeatureValidationOutputDetailsRepresentation__selections, opaque: FeatureValidationOutputDetailsRepresentation__opaque, } = select$2();
|
|
311
|
+
return {
|
|
312
|
+
kind: 'Fragment',
|
|
313
|
+
version: VERSION,
|
|
314
|
+
private: [],
|
|
315
|
+
selections: [
|
|
316
|
+
{
|
|
317
|
+
name: 'errorMessage',
|
|
318
|
+
kind: 'Scalar',
|
|
319
|
+
required: false
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
name: 'featureValidationOutputDetails',
|
|
323
|
+
kind: 'Object',
|
|
324
|
+
plural: true,
|
|
325
|
+
selections: FeatureValidationOutputDetailsRepresentation__selections
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
name: 'isSuccess',
|
|
329
|
+
kind: 'Scalar'
|
|
330
|
+
}
|
|
331
|
+
]
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
function equals(existing, incoming) {
|
|
335
|
+
const existing_isSuccess = existing.isSuccess;
|
|
336
|
+
const incoming_isSuccess = incoming.isSuccess;
|
|
337
|
+
if (!(existing_isSuccess === incoming_isSuccess)) {
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
340
|
+
const existing_errorMessage = existing.errorMessage;
|
|
341
|
+
const incoming_errorMessage = incoming.errorMessage;
|
|
342
|
+
// if at least one of these optionals is defined
|
|
343
|
+
if (existing_errorMessage !== undefined || incoming_errorMessage !== undefined) {
|
|
344
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
345
|
+
// not equal
|
|
346
|
+
if (existing_errorMessage === undefined || incoming_errorMessage === undefined) {
|
|
347
|
+
return false;
|
|
348
|
+
}
|
|
349
|
+
if (!(existing_errorMessage === incoming_errorMessage)) {
|
|
350
|
+
return false;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
const existing_featureValidationOutputDetails = existing.featureValidationOutputDetails;
|
|
354
|
+
const incoming_featureValidationOutputDetails = incoming.featureValidationOutputDetails;
|
|
355
|
+
const equals_featureValidationOutputDetails_items = equalsArray(existing_featureValidationOutputDetails, incoming_featureValidationOutputDetails, (existing_featureValidationOutputDetails_item, incoming_featureValidationOutputDetails_item) => {
|
|
356
|
+
if (!(equals$1(existing_featureValidationOutputDetails_item, incoming_featureValidationOutputDetails_item))) {
|
|
357
|
+
return false;
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
if (equals_featureValidationOutputDetails_items === false) {
|
|
361
|
+
return false;
|
|
362
|
+
}
|
|
363
|
+
return true;
|
|
364
|
+
}
|
|
365
|
+
const ingest = function FeatureValidationOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
366
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
367
|
+
const validateError = validate(input);
|
|
368
|
+
if (validateError !== null) {
|
|
369
|
+
throw validateError;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
const key = keyBuilderFromType(luvio, input);
|
|
373
|
+
const existingRecord = store.readEntry(key);
|
|
374
|
+
const ttlToUse = TTL;
|
|
375
|
+
let incomingRecord = normalize(input, store.readEntry(key), {
|
|
376
|
+
fullPath: key,
|
|
377
|
+
parent: path.parent,
|
|
378
|
+
propertyName: path.propertyName,
|
|
379
|
+
ttl: ttlToUse
|
|
380
|
+
});
|
|
381
|
+
if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
|
|
382
|
+
luvio.storePublish(key, incomingRecord);
|
|
383
|
+
}
|
|
384
|
+
{
|
|
385
|
+
const storeMetadataParams = {
|
|
386
|
+
ttl: ttlToUse,
|
|
387
|
+
namespace: "featurevalidation",
|
|
388
|
+
version: VERSION,
|
|
389
|
+
representationName: RepresentationType,
|
|
390
|
+
};
|
|
391
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
392
|
+
}
|
|
393
|
+
return createLink(key);
|
|
394
|
+
};
|
|
395
|
+
function getTypeCacheKeys(luvio, input, fullPathFactory) {
|
|
396
|
+
const rootKeySet = new StoreKeyMap();
|
|
397
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
398
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
399
|
+
rootKeySet.set(rootKey, {
|
|
400
|
+
namespace: keyPrefix,
|
|
401
|
+
representationName: RepresentationType,
|
|
402
|
+
mergeable: false
|
|
403
|
+
});
|
|
404
|
+
return rootKeySet;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
function select(luvio, params) {
|
|
408
|
+
return select$1();
|
|
409
|
+
}
|
|
410
|
+
function getResponseCacheKeys(luvio, resourceParams, response) {
|
|
411
|
+
return getTypeCacheKeys(luvio, response);
|
|
412
|
+
}
|
|
413
|
+
function ingestSuccess(luvio, resourceParams, response) {
|
|
414
|
+
const { body } = response;
|
|
415
|
+
const key = keyBuilderFromType(luvio, body);
|
|
416
|
+
luvio.storeIngest(key, ingest, body);
|
|
417
|
+
const snapshot = luvio.storeLookup({
|
|
418
|
+
recordId: key,
|
|
419
|
+
node: select(),
|
|
420
|
+
variables: {},
|
|
421
|
+
});
|
|
422
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
423
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
424
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
return snapshot;
|
|
428
|
+
}
|
|
429
|
+
function createResourceRequest(config) {
|
|
430
|
+
const headers = {};
|
|
431
|
+
return {
|
|
432
|
+
baseUri: '/services/data/v58.0',
|
|
433
|
+
basePath: '/connect/industries/feature-validation',
|
|
434
|
+
method: 'post',
|
|
435
|
+
body: config.body,
|
|
436
|
+
urlParams: {},
|
|
437
|
+
queryParams: {},
|
|
438
|
+
headers,
|
|
439
|
+
priority: 'normal',
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
const featureValidation_ConfigPropertyNames = {
|
|
444
|
+
displayName: 'featureValidation',
|
|
445
|
+
parameters: {
|
|
446
|
+
required: ['featureValidationInputDetails', 'useCase'],
|
|
447
|
+
optional: []
|
|
448
|
+
}
|
|
449
|
+
};
|
|
450
|
+
function createResourceParams(config) {
|
|
451
|
+
const resourceParams = {
|
|
452
|
+
body: {
|
|
453
|
+
featureValidationInputDetails: config.featureValidationInputDetails, useCase: config.useCase
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
return resourceParams;
|
|
457
|
+
}
|
|
458
|
+
function typeCheckConfig(untrustedConfig) {
|
|
459
|
+
const config = {};
|
|
460
|
+
const untrustedConfig_featureValidationInputDetails = untrustedConfig.featureValidationInputDetails;
|
|
461
|
+
if (ArrayIsArray$1(untrustedConfig_featureValidationInputDetails)) {
|
|
462
|
+
const untrustedConfig_featureValidationInputDetails_array = [];
|
|
463
|
+
for (let i = 0, arrayLength = untrustedConfig_featureValidationInputDetails.length; i < arrayLength; i++) {
|
|
464
|
+
const untrustedConfig_featureValidationInputDetails_item = untrustedConfig_featureValidationInputDetails[i];
|
|
465
|
+
if (untrustedIsObject(untrustedConfig_featureValidationInputDetails_item)) {
|
|
466
|
+
const untrustedConfig_featureValidationInputDetails_item_object = {};
|
|
467
|
+
if (untrustedConfig_featureValidationInputDetails_item_object !== undefined && Object.keys(untrustedConfig_featureValidationInputDetails_item_object).length >= 0) {
|
|
468
|
+
untrustedConfig_featureValidationInputDetails_array.push(untrustedConfig_featureValidationInputDetails_item_object);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
config.featureValidationInputDetails = untrustedConfig_featureValidationInputDetails_array;
|
|
473
|
+
}
|
|
474
|
+
const untrustedConfig_useCase = untrustedConfig.useCase;
|
|
475
|
+
if (typeof untrustedConfig_useCase === 'string') {
|
|
476
|
+
config.useCase = untrustedConfig_useCase;
|
|
477
|
+
}
|
|
478
|
+
return config;
|
|
479
|
+
}
|
|
480
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
481
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
482
|
+
return null;
|
|
483
|
+
}
|
|
484
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
485
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
486
|
+
}
|
|
487
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
488
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
489
|
+
return null;
|
|
490
|
+
}
|
|
491
|
+
return config;
|
|
492
|
+
}
|
|
493
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
494
|
+
const resourceParams = createResourceParams(config);
|
|
495
|
+
const request = createResourceRequest(resourceParams);
|
|
496
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
497
|
+
.then((response) => {
|
|
498
|
+
return luvio.handleSuccessResponse(() => {
|
|
499
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
500
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
501
|
+
}, () => getResponseCacheKeys(luvio, resourceParams, response.body));
|
|
502
|
+
}, (response) => {
|
|
503
|
+
deepFreeze(response);
|
|
504
|
+
throw response;
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
const featureValidationAdapterFactory = (luvio) => {
|
|
508
|
+
return function featureValidation(untrustedConfig) {
|
|
509
|
+
const config = validateAdapterConfig(untrustedConfig, featureValidation_ConfigPropertyNames);
|
|
510
|
+
// Invalid or incomplete config
|
|
511
|
+
if (config === null) {
|
|
512
|
+
throw new Error('Invalid config for "featureValidation"');
|
|
513
|
+
}
|
|
514
|
+
return buildNetworkSnapshot(luvio, config);
|
|
515
|
+
};
|
|
516
|
+
};
|
|
517
|
+
|
|
518
|
+
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";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AdapterValidationConfig as adapter$45$utils_AdapterValidationConfig, Untrusted as adapter$45$utils_Untrusted } from './adapter-utils';
|
|
2
|
+
import { ResourceRequestConfig as resources_postConnectIndustriesFeatureValidation_ResourceRequestConfig } from '../resources/postConnectIndustriesFeatureValidation';
|
|
3
|
+
import { Luvio as $64$luvio_engine_Luvio, DispatchResourceRequestContext as $64$luvio_engine_DispatchResourceRequestContext, AdapterFactory as $64$luvio_engine_AdapterFactory } from '@luvio/engine';
|
|
4
|
+
import { FeatureValidationOutputRepresentation as types_FeatureValidationOutputRepresentation_FeatureValidationOutputRepresentation } from '../types/FeatureValidationOutputRepresentation';
|
|
5
|
+
export declare const adapterName = "featureValidation";
|
|
6
|
+
export declare const featureValidation_ConfigPropertyNames: adapter$45$utils_AdapterValidationConfig;
|
|
7
|
+
export interface FeatureValidationConfig {
|
|
8
|
+
featureValidationInputDetails: Array<{}>;
|
|
9
|
+
useCase: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function createResourceParams(config: FeatureValidationConfig): resources_postConnectIndustriesFeatureValidation_ResourceRequestConfig;
|
|
12
|
+
export declare function typeCheckConfig(untrustedConfig: adapter$45$utils_Untrusted<FeatureValidationConfig>): adapter$45$utils_Untrusted<FeatureValidationConfig>;
|
|
13
|
+
export declare function validateAdapterConfig(untrustedConfig: unknown, configPropertyNames: adapter$45$utils_AdapterValidationConfig): FeatureValidationConfig | null;
|
|
14
|
+
export declare function buildNetworkSnapshot(luvio: $64$luvio_engine_Luvio, config: FeatureValidationConfig, options?: $64$luvio_engine_DispatchResourceRequestContext): Promise<import("@luvio/engine").FulfilledSnapshot<types_FeatureValidationOutputRepresentation_FeatureValidationOutputRepresentation, {}> | import("@luvio/engine").StaleSnapshot<types_FeatureValidationOutputRepresentation_FeatureValidationOutputRepresentation, {}> | import("@luvio/engine").PendingSnapshot<types_FeatureValidationOutputRepresentation_FeatureValidationOutputRepresentation, any>>;
|
|
15
|
+
export declare const featureValidationAdapterFactory: $64$luvio_engine_AdapterFactory<FeatureValidationConfig, types_FeatureValidationOutputRepresentation_FeatureValidationOutputRepresentation>;
|