@salesforce/lds-adapters-cdp-document-processing 1.355.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/cdp-document-processing.js +1671 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/createIdpConfiguration.d.ts +23 -0
- package/dist/es/es2018/types/src/generated/adapters/deleteIdpConfiguration.d.ts +14 -0
- package/dist/es/es2018/types/src/generated/adapters/extractDataUsingIdpConfiguration.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/adapters/getIdpConfiguration.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/adapters/getIdpConfigurations.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/adapters/getIdpGlobalConfig.d.ts +26 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +6 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +12 -0
- package/dist/es/es2018/types/src/generated/resources/deleteSsotDocumentProcessingConfigurationsByIdOrApiName.d.ts +12 -0
- package/dist/es/es2018/types/src/generated/resources/getSsotDocumentProcessingConfigurations.d.ts +19 -0
- package/dist/es/es2018/types/src/generated/resources/getSsotDocumentProcessingConfigurationsByIdOrApiName.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/resources/getSsotDocumentProcessingGlobalConfig.d.ts +12 -0
- package/dist/es/es2018/types/src/generated/resources/postSsotDocumentProcessingActionsExtractData.d.ts +19 -0
- package/dist/es/es2018/types/src/generated/resources/postSsotDocumentProcessingConfigurations.d.ts +20 -0
- package/dist/es/es2018/types/src/generated/types/CdpAssetBaseRepresentation.d.ts +49 -0
- package/dist/es/es2018/types/src/generated/types/CdpPaginatedResponseBaseRepresentation.d.ts +35 -0
- package/dist/es/es2018/types/src/generated/types/CdpUserRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/IdpConfigurationBaseRepresentation.d.ts +47 -0
- package/dist/es/es2018/types/src/generated/types/IdpConfigurationDetailsRepresentation.d.ts +41 -0
- package/dist/es/es2018/types/src/generated/types/IdpConfigurationInputRepresentation.d.ts +52 -0
- package/dist/es/es2018/types/src/generated/types/IdpConfigurationRepresentation.d.ts +26 -0
- package/dist/es/es2018/types/src/generated/types/IdpConfigurationsCollectionRepresentation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/IdpContentTypeRepresentation.d.ts +38 -0
- package/dist/es/es2018/types/src/generated/types/IdpExtractDataInputRepresentation.d.ts +40 -0
- package/dist/es/es2018/types/src/generated/types/IdpExtractedDataRepresentation.d.ts +39 -0
- package/dist/es/es2018/types/src/generated/types/IdpExtractedFileDataRepresenation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/IdpFileConfigRepresentation.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/types/IdpGlobalConfigRepresentation.d.ts +37 -0
- package/dist/es/es2018/types/src/generated/types/IdpSupportedModelRepresentation.d.ts +41 -0
- package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
- package/package.json +68 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +1798 -0
- package/src/raml/api.raml +377 -0
- package/src/raml/luvio.raml +90 -0
|
@@ -0,0 +1,1671 @@
|
|
|
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, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$4, typeCheckConfig as typeCheckConfig$6, StoreKeyMap, createResourceParams as createResourceParams$6 } from '@luvio/engine';
|
|
8
|
+
|
|
9
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
10
|
+
const { keys: ObjectKeys, create: ObjectCreate } = 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(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 snapshotRefreshOptions = {
|
|
45
|
+
overrides: {
|
|
46
|
+
headers: {
|
|
47
|
+
'Cache-Control': 'no-cache',
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
|
|
52
|
+
return {
|
|
53
|
+
name,
|
|
54
|
+
required,
|
|
55
|
+
resourceType,
|
|
56
|
+
typeCheckShape,
|
|
57
|
+
isArrayShape,
|
|
58
|
+
coerceFn,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function buildAdapterValidationConfig(displayName, paramsMeta) {
|
|
62
|
+
const required = paramsMeta.filter(p => p.required).map(p => p.name);
|
|
63
|
+
const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
|
|
64
|
+
return {
|
|
65
|
+
displayName,
|
|
66
|
+
parameters: {
|
|
67
|
+
required,
|
|
68
|
+
optional,
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const keyPrefix = 'document-processing';
|
|
73
|
+
|
|
74
|
+
const { isArray: ArrayIsArray } = Array;
|
|
75
|
+
const { stringify: JSONStringify } = JSON;
|
|
76
|
+
function equalsArray(a, b, equalsItem) {
|
|
77
|
+
const aLength = a.length;
|
|
78
|
+
const bLength = b.length;
|
|
79
|
+
if (aLength !== bLength) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
for (let i = 0; i < aLength; i++) {
|
|
83
|
+
if (equalsItem(a[i], b[i]) === false) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
function createLink(ref) {
|
|
90
|
+
return {
|
|
91
|
+
__ref: serializeStructuredKey(ref),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const TTL$4 = 500;
|
|
96
|
+
function validate$a(obj, path = 'CdpPaginatedResponseBaseRepresentation') {
|
|
97
|
+
const v_error = (() => {
|
|
98
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
99
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
100
|
+
}
|
|
101
|
+
const obj_currentPageUrl = obj.currentPageUrl;
|
|
102
|
+
const path_currentPageUrl = path + '.currentPageUrl';
|
|
103
|
+
let obj_currentPageUrl_union0 = null;
|
|
104
|
+
const obj_currentPageUrl_union0_error = (() => {
|
|
105
|
+
if (typeof obj_currentPageUrl !== 'string') {
|
|
106
|
+
return new TypeError('Expected "string" but received "' + typeof obj_currentPageUrl + '" (at "' + path_currentPageUrl + '")');
|
|
107
|
+
}
|
|
108
|
+
})();
|
|
109
|
+
if (obj_currentPageUrl_union0_error != null) {
|
|
110
|
+
obj_currentPageUrl_union0 = obj_currentPageUrl_union0_error.message;
|
|
111
|
+
}
|
|
112
|
+
let obj_currentPageUrl_union1 = null;
|
|
113
|
+
const obj_currentPageUrl_union1_error = (() => {
|
|
114
|
+
if (obj_currentPageUrl !== null) {
|
|
115
|
+
return new TypeError('Expected "null" but received "' + typeof obj_currentPageUrl + '" (at "' + path_currentPageUrl + '")');
|
|
116
|
+
}
|
|
117
|
+
})();
|
|
118
|
+
if (obj_currentPageUrl_union1_error != null) {
|
|
119
|
+
obj_currentPageUrl_union1 = obj_currentPageUrl_union1_error.message;
|
|
120
|
+
}
|
|
121
|
+
if (obj_currentPageUrl_union0 && obj_currentPageUrl_union1) {
|
|
122
|
+
let message = 'Object doesn\'t match union (at "' + path_currentPageUrl + '")';
|
|
123
|
+
message += '\n' + obj_currentPageUrl_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
124
|
+
message += '\n' + obj_currentPageUrl_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
125
|
+
return new TypeError(message);
|
|
126
|
+
}
|
|
127
|
+
const obj_nextPageUrl = obj.nextPageUrl;
|
|
128
|
+
const path_nextPageUrl = path + '.nextPageUrl';
|
|
129
|
+
let obj_nextPageUrl_union0 = null;
|
|
130
|
+
const obj_nextPageUrl_union0_error = (() => {
|
|
131
|
+
if (typeof obj_nextPageUrl !== 'string') {
|
|
132
|
+
return new TypeError('Expected "string" but received "' + typeof obj_nextPageUrl + '" (at "' + path_nextPageUrl + '")');
|
|
133
|
+
}
|
|
134
|
+
})();
|
|
135
|
+
if (obj_nextPageUrl_union0_error != null) {
|
|
136
|
+
obj_nextPageUrl_union0 = obj_nextPageUrl_union0_error.message;
|
|
137
|
+
}
|
|
138
|
+
let obj_nextPageUrl_union1 = null;
|
|
139
|
+
const obj_nextPageUrl_union1_error = (() => {
|
|
140
|
+
if (obj_nextPageUrl !== null) {
|
|
141
|
+
return new TypeError('Expected "null" but received "' + typeof obj_nextPageUrl + '" (at "' + path_nextPageUrl + '")');
|
|
142
|
+
}
|
|
143
|
+
})();
|
|
144
|
+
if (obj_nextPageUrl_union1_error != null) {
|
|
145
|
+
obj_nextPageUrl_union1 = obj_nextPageUrl_union1_error.message;
|
|
146
|
+
}
|
|
147
|
+
if (obj_nextPageUrl_union0 && obj_nextPageUrl_union1) {
|
|
148
|
+
let message = 'Object doesn\'t match union (at "' + path_nextPageUrl + '")';
|
|
149
|
+
message += '\n' + obj_nextPageUrl_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
150
|
+
message += '\n' + obj_nextPageUrl_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
151
|
+
return new TypeError(message);
|
|
152
|
+
}
|
|
153
|
+
const obj_totalSize = obj.totalSize;
|
|
154
|
+
const path_totalSize = path + '.totalSize';
|
|
155
|
+
if (typeof obj_totalSize !== 'number' || (typeof obj_totalSize === 'number' && Math.floor(obj_totalSize) !== obj_totalSize)) {
|
|
156
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_totalSize + '" (at "' + path_totalSize + '")');
|
|
157
|
+
}
|
|
158
|
+
})();
|
|
159
|
+
return v_error === undefined ? null : v_error;
|
|
160
|
+
}
|
|
161
|
+
function equals$8(existing, incoming) {
|
|
162
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function validate$9(obj, path = 'CdpAssetBaseRepresentation') {
|
|
169
|
+
const v_error = (() => {
|
|
170
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
171
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
172
|
+
}
|
|
173
|
+
const obj_createdBy = obj.createdBy;
|
|
174
|
+
const path_createdBy = path + '.createdBy';
|
|
175
|
+
if (obj_createdBy === undefined) {
|
|
176
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_createdBy + '" (at "' + path_createdBy + '")');
|
|
177
|
+
}
|
|
178
|
+
const obj_createdDate = obj.createdDate;
|
|
179
|
+
const path_createdDate = path + '.createdDate';
|
|
180
|
+
if (typeof obj_createdDate !== 'string') {
|
|
181
|
+
return new TypeError('Expected "string" but received "' + typeof obj_createdDate + '" (at "' + path_createdDate + '")');
|
|
182
|
+
}
|
|
183
|
+
const obj_id = obj.id;
|
|
184
|
+
const path_id = path + '.id';
|
|
185
|
+
if (typeof obj_id !== 'string') {
|
|
186
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
187
|
+
}
|
|
188
|
+
const obj_label = obj.label;
|
|
189
|
+
const path_label = path + '.label';
|
|
190
|
+
if (typeof obj_label !== 'string') {
|
|
191
|
+
return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
192
|
+
}
|
|
193
|
+
const obj_lastModifiedBy = obj.lastModifiedBy;
|
|
194
|
+
const path_lastModifiedBy = path + '.lastModifiedBy';
|
|
195
|
+
if (obj_lastModifiedBy === undefined) {
|
|
196
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_lastModifiedBy + '" (at "' + path_lastModifiedBy + '")');
|
|
197
|
+
}
|
|
198
|
+
const obj_lastModifiedDate = obj.lastModifiedDate;
|
|
199
|
+
const path_lastModifiedDate = path + '.lastModifiedDate';
|
|
200
|
+
if (typeof obj_lastModifiedDate !== 'string') {
|
|
201
|
+
return new TypeError('Expected "string" but received "' + typeof obj_lastModifiedDate + '" (at "' + path_lastModifiedDate + '")');
|
|
202
|
+
}
|
|
203
|
+
const obj_name = obj.name;
|
|
204
|
+
const path_name = path + '.name';
|
|
205
|
+
if (typeof obj_name !== 'string') {
|
|
206
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
207
|
+
}
|
|
208
|
+
const obj_url = obj.url;
|
|
209
|
+
const path_url = path + '.url';
|
|
210
|
+
if (obj_url === undefined) {
|
|
211
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_url + '" (at "' + path_url + '")');
|
|
212
|
+
}
|
|
213
|
+
})();
|
|
214
|
+
return v_error === undefined ? null : v_error;
|
|
215
|
+
}
|
|
216
|
+
function equals$7(existing, incoming) {
|
|
217
|
+
const existing_createdDate = existing.createdDate;
|
|
218
|
+
const incoming_createdDate = incoming.createdDate;
|
|
219
|
+
if (!(existing_createdDate === incoming_createdDate)) {
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
222
|
+
const existing_id = existing.id;
|
|
223
|
+
const incoming_id = incoming.id;
|
|
224
|
+
if (!(existing_id === incoming_id)) {
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
const existing_label = existing.label;
|
|
228
|
+
const incoming_label = incoming.label;
|
|
229
|
+
if (!(existing_label === incoming_label)) {
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
const existing_lastModifiedDate = existing.lastModifiedDate;
|
|
233
|
+
const incoming_lastModifiedDate = incoming.lastModifiedDate;
|
|
234
|
+
if (!(existing_lastModifiedDate === incoming_lastModifiedDate)) {
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
const existing_name = existing.name;
|
|
238
|
+
const incoming_name = incoming.name;
|
|
239
|
+
if (!(existing_name === incoming_name)) {
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
const existing_createdBy = existing.createdBy;
|
|
243
|
+
const incoming_createdBy = incoming.createdBy;
|
|
244
|
+
if (JSONStringify(incoming_createdBy) !== JSONStringify(existing_createdBy)) {
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
const existing_lastModifiedBy = existing.lastModifiedBy;
|
|
248
|
+
const incoming_lastModifiedBy = incoming.lastModifiedBy;
|
|
249
|
+
if (JSONStringify(incoming_lastModifiedBy) !== JSONStringify(existing_lastModifiedBy)) {
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
const existing_url = existing.url;
|
|
253
|
+
const incoming_url = incoming.url;
|
|
254
|
+
if (JSONStringify(incoming_url) !== JSONStringify(existing_url)) {
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
return true;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function validate$8(obj, path = 'IdpConfigurationBaseRepresentation') {
|
|
261
|
+
const validateCdpAssetBaseRepresentation_validateError = validate$9(obj, path);
|
|
262
|
+
if (validateCdpAssetBaseRepresentation_validateError !== null) {
|
|
263
|
+
return validateCdpAssetBaseRepresentation_validateError;
|
|
264
|
+
}
|
|
265
|
+
const v_error = (() => {
|
|
266
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
267
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
268
|
+
}
|
|
269
|
+
const obj_activationStatus = obj.activationStatus;
|
|
270
|
+
const path_activationStatus = path + '.activationStatus';
|
|
271
|
+
if (typeof obj_activationStatus !== 'string') {
|
|
272
|
+
return new TypeError('Expected "string" but received "' + typeof obj_activationStatus + '" (at "' + path_activationStatus + '")');
|
|
273
|
+
}
|
|
274
|
+
const obj_dataspace = obj.dataspace;
|
|
275
|
+
const path_dataspace = path + '.dataspace';
|
|
276
|
+
if (obj_dataspace === undefined) {
|
|
277
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_dataspace + '" (at "' + path_dataspace + '")');
|
|
278
|
+
}
|
|
279
|
+
const obj_description = obj.description;
|
|
280
|
+
const path_description = path + '.description';
|
|
281
|
+
let obj_description_union0 = null;
|
|
282
|
+
const obj_description_union0_error = (() => {
|
|
283
|
+
if (typeof obj_description !== 'string') {
|
|
284
|
+
return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
|
|
285
|
+
}
|
|
286
|
+
})();
|
|
287
|
+
if (obj_description_union0_error != null) {
|
|
288
|
+
obj_description_union0 = obj_description_union0_error.message;
|
|
289
|
+
}
|
|
290
|
+
let obj_description_union1 = null;
|
|
291
|
+
const obj_description_union1_error = (() => {
|
|
292
|
+
if (obj_description !== null) {
|
|
293
|
+
return new TypeError('Expected "null" but received "' + typeof obj_description + '" (at "' + path_description + '")');
|
|
294
|
+
}
|
|
295
|
+
})();
|
|
296
|
+
if (obj_description_union1_error != null) {
|
|
297
|
+
obj_description_union1 = obj_description_union1_error.message;
|
|
298
|
+
}
|
|
299
|
+
if (obj_description_union0 && obj_description_union1) {
|
|
300
|
+
let message = 'Object doesn\'t match union (at "' + path_description + '")';
|
|
301
|
+
message += '\n' + obj_description_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
302
|
+
message += '\n' + obj_description_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
303
|
+
return new TypeError(message);
|
|
304
|
+
}
|
|
305
|
+
const obj_mlModel = obj.mlModel;
|
|
306
|
+
const path_mlModel = path + '.mlModel';
|
|
307
|
+
if (typeof obj_mlModel !== 'string') {
|
|
308
|
+
return new TypeError('Expected "string" but received "' + typeof obj_mlModel + '" (at "' + path_mlModel + '")');
|
|
309
|
+
}
|
|
310
|
+
const obj_runtimeStatus = obj.runtimeStatus;
|
|
311
|
+
const path_runtimeStatus = path + '.runtimeStatus';
|
|
312
|
+
if (typeof obj_runtimeStatus !== 'string') {
|
|
313
|
+
return new TypeError('Expected "string" but received "' + typeof obj_runtimeStatus + '" (at "' + path_runtimeStatus + '")');
|
|
314
|
+
}
|
|
315
|
+
const obj_status = obj.status;
|
|
316
|
+
const path_status = path + '.status';
|
|
317
|
+
if (typeof obj_status !== 'string') {
|
|
318
|
+
return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
|
|
319
|
+
}
|
|
320
|
+
const obj_version = obj.version;
|
|
321
|
+
const path_version = path + '.version';
|
|
322
|
+
if (typeof obj_version !== 'string') {
|
|
323
|
+
return new TypeError('Expected "string" but received "' + typeof obj_version + '" (at "' + path_version + '")');
|
|
324
|
+
}
|
|
325
|
+
})();
|
|
326
|
+
return v_error === undefined ? null : v_error;
|
|
327
|
+
}
|
|
328
|
+
function equals$6(existing, incoming) {
|
|
329
|
+
if (equals$7(existing, incoming) === false) {
|
|
330
|
+
return false;
|
|
331
|
+
}
|
|
332
|
+
const existing_activationStatus = existing.activationStatus;
|
|
333
|
+
const incoming_activationStatus = incoming.activationStatus;
|
|
334
|
+
if (!(existing_activationStatus === incoming_activationStatus)) {
|
|
335
|
+
return false;
|
|
336
|
+
}
|
|
337
|
+
const existing_mlModel = existing.mlModel;
|
|
338
|
+
const incoming_mlModel = incoming.mlModel;
|
|
339
|
+
if (!(existing_mlModel === incoming_mlModel)) {
|
|
340
|
+
return false;
|
|
341
|
+
}
|
|
342
|
+
const existing_runtimeStatus = existing.runtimeStatus;
|
|
343
|
+
const incoming_runtimeStatus = incoming.runtimeStatus;
|
|
344
|
+
if (!(existing_runtimeStatus === incoming_runtimeStatus)) {
|
|
345
|
+
return false;
|
|
346
|
+
}
|
|
347
|
+
const existing_status = existing.status;
|
|
348
|
+
const incoming_status = incoming.status;
|
|
349
|
+
if (!(existing_status === incoming_status)) {
|
|
350
|
+
return false;
|
|
351
|
+
}
|
|
352
|
+
const existing_version = existing.version;
|
|
353
|
+
const incoming_version = incoming.version;
|
|
354
|
+
if (!(existing_version === incoming_version)) {
|
|
355
|
+
return false;
|
|
356
|
+
}
|
|
357
|
+
const existing_dataspace = existing.dataspace;
|
|
358
|
+
const incoming_dataspace = incoming.dataspace;
|
|
359
|
+
if (JSONStringify(incoming_dataspace) !== JSONStringify(existing_dataspace)) {
|
|
360
|
+
return false;
|
|
361
|
+
}
|
|
362
|
+
const existing_description = existing.description;
|
|
363
|
+
const incoming_description = incoming.description;
|
|
364
|
+
if (!(existing_description === incoming_description)) {
|
|
365
|
+
return false;
|
|
366
|
+
}
|
|
367
|
+
return true;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
function validate$7(obj, path = 'IdpConfigurationRepresentation') {
|
|
371
|
+
const validateIdpConfigurationBaseRepresentation_validateError = validate$8(obj, path);
|
|
372
|
+
if (validateIdpConfigurationBaseRepresentation_validateError !== null) {
|
|
373
|
+
return validateIdpConfigurationBaseRepresentation_validateError;
|
|
374
|
+
}
|
|
375
|
+
const v_error = (() => {
|
|
376
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
377
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
378
|
+
}
|
|
379
|
+
})();
|
|
380
|
+
return v_error === undefined ? null : v_error;
|
|
381
|
+
}
|
|
382
|
+
function equals$5(existing, incoming) {
|
|
383
|
+
if (equals$6(existing, incoming) === false) {
|
|
384
|
+
return false;
|
|
385
|
+
}
|
|
386
|
+
return true;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
const TTL$3 = 500;
|
|
390
|
+
const VERSION$4 = "def7e7ee61e636c86d017097ba5ad643";
|
|
391
|
+
function validate$6(obj, path = 'IdpConfigurationsCollectionRepresentation') {
|
|
392
|
+
const validateCdpPaginatedResponseBaseRepresentation_validateError = validate$a(obj, path);
|
|
393
|
+
if (validateCdpPaginatedResponseBaseRepresentation_validateError !== null) {
|
|
394
|
+
return validateCdpPaginatedResponseBaseRepresentation_validateError;
|
|
395
|
+
}
|
|
396
|
+
const v_error = (() => {
|
|
397
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
398
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
399
|
+
}
|
|
400
|
+
const obj_configurations = obj.configurations;
|
|
401
|
+
const path_configurations = path + '.configurations';
|
|
402
|
+
if (!ArrayIsArray(obj_configurations)) {
|
|
403
|
+
return new TypeError('Expected "array" but received "' + typeof obj_configurations + '" (at "' + path_configurations + '")');
|
|
404
|
+
}
|
|
405
|
+
for (let i = 0; i < obj_configurations.length; i++) {
|
|
406
|
+
const obj_configurations_item = obj_configurations[i];
|
|
407
|
+
const path_configurations_item = path_configurations + '[' + i + ']';
|
|
408
|
+
const referencepath_configurations_itemValidationError = validate$7(obj_configurations_item, path_configurations_item);
|
|
409
|
+
if (referencepath_configurations_itemValidationError !== null) {
|
|
410
|
+
let message = 'Object doesn\'t match IdpConfigurationRepresentation (at "' + path_configurations_item + '")\n';
|
|
411
|
+
message += referencepath_configurations_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
412
|
+
return new TypeError(message);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
})();
|
|
416
|
+
return v_error === undefined ? null : v_error;
|
|
417
|
+
}
|
|
418
|
+
const RepresentationType$4 = 'IdpConfigurationsCollectionRepresentation';
|
|
419
|
+
function normalize$4(input, existing, path, luvio, store, timestamp) {
|
|
420
|
+
return input;
|
|
421
|
+
}
|
|
422
|
+
const select$9 = function IdpConfigurationsCollectionRepresentationSelect() {
|
|
423
|
+
return {
|
|
424
|
+
kind: 'Fragment',
|
|
425
|
+
version: VERSION$4,
|
|
426
|
+
private: [],
|
|
427
|
+
opaque: true
|
|
428
|
+
};
|
|
429
|
+
};
|
|
430
|
+
function equals$4(existing, incoming) {
|
|
431
|
+
if (equals$8(existing, incoming) === false) {
|
|
432
|
+
return false;
|
|
433
|
+
}
|
|
434
|
+
const existing_configurations = existing.configurations;
|
|
435
|
+
const incoming_configurations = incoming.configurations;
|
|
436
|
+
const equals_configurations_items = equalsArray(existing_configurations, incoming_configurations, (existing_configurations_item, incoming_configurations_item) => {
|
|
437
|
+
if (!(equals$5(existing_configurations_item, incoming_configurations_item))) {
|
|
438
|
+
return false;
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
if (equals_configurations_items === false) {
|
|
442
|
+
return false;
|
|
443
|
+
}
|
|
444
|
+
return true;
|
|
445
|
+
}
|
|
446
|
+
const ingest$4 = function IdpConfigurationsCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
447
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
448
|
+
const validateError = validate$6(input);
|
|
449
|
+
if (validateError !== null) {
|
|
450
|
+
throw validateError;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
const key = path.fullPath;
|
|
454
|
+
const ttlToUse = TTL$4;
|
|
455
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$4, "document-processing", VERSION$4, RepresentationType$4, equals$4);
|
|
456
|
+
return createLink(key);
|
|
457
|
+
};
|
|
458
|
+
function getTypeCacheKeys$4(rootKeySet, luvio, input, fullPathFactory) {
|
|
459
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
460
|
+
const rootKey = fullPathFactory();
|
|
461
|
+
rootKeySet.set(rootKey, {
|
|
462
|
+
namespace: keyPrefix,
|
|
463
|
+
representationName: RepresentationType$4,
|
|
464
|
+
mergeable: false
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
function select$8(luvio, params) {
|
|
469
|
+
return select$9();
|
|
470
|
+
}
|
|
471
|
+
function keyBuilder$9(luvio, params) {
|
|
472
|
+
return keyPrefix + '::IdpConfigurationsCollectionRepresentation:(' + 'activationStatus:' + params.queryParams.activationStatus + ',' + 'limit:' + params.queryParams.limit + ',' + 'offset:' + params.queryParams.offset + ',' + 'orderBy:' + params.queryParams.orderBy + ',' + 'search:' + params.queryParams.search + ')';
|
|
473
|
+
}
|
|
474
|
+
function getResponseCacheKeys$5(storeKeyMap, luvio, resourceParams, response) {
|
|
475
|
+
getTypeCacheKeys$4(storeKeyMap, luvio, response, () => keyBuilder$9(luvio, resourceParams));
|
|
476
|
+
}
|
|
477
|
+
function ingestSuccess$4(luvio, resourceParams, response, snapshotRefresh) {
|
|
478
|
+
const { body } = response;
|
|
479
|
+
const key = keyBuilder$9(luvio, resourceParams);
|
|
480
|
+
luvio.storeIngest(key, ingest$4, body);
|
|
481
|
+
const snapshot = luvio.storeLookup({
|
|
482
|
+
recordId: key,
|
|
483
|
+
node: select$8(),
|
|
484
|
+
variables: {},
|
|
485
|
+
}, snapshotRefresh);
|
|
486
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
487
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
488
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
deepFreeze(snapshot.data);
|
|
492
|
+
return snapshot;
|
|
493
|
+
}
|
|
494
|
+
function ingestError$3(luvio, params, error, snapshotRefresh) {
|
|
495
|
+
const key = keyBuilder$9(luvio, params);
|
|
496
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
497
|
+
const storeMetadataParams = {
|
|
498
|
+
ttl: TTL$3,
|
|
499
|
+
namespace: keyPrefix,
|
|
500
|
+
version: VERSION$4,
|
|
501
|
+
representationName: RepresentationType$4
|
|
502
|
+
};
|
|
503
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
504
|
+
return errorSnapshot;
|
|
505
|
+
}
|
|
506
|
+
function createResourceRequest$5(config) {
|
|
507
|
+
const headers = {};
|
|
508
|
+
return {
|
|
509
|
+
baseUri: '/services/data/v64.0',
|
|
510
|
+
basePath: '/ssot/document-processing/configurations',
|
|
511
|
+
method: 'get',
|
|
512
|
+
body: null,
|
|
513
|
+
urlParams: {},
|
|
514
|
+
queryParams: config.queryParams,
|
|
515
|
+
headers,
|
|
516
|
+
priority: 'normal',
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
const adapterName$5 = 'getIdpConfigurations';
|
|
521
|
+
const getIdpConfigurations_ConfigPropertyMetadata = [
|
|
522
|
+
generateParamConfigMetadata('activationStatus', false, 1 /* QueryParameter */, 0 /* String */),
|
|
523
|
+
generateParamConfigMetadata('limit', false, 1 /* QueryParameter */, 3 /* Integer */),
|
|
524
|
+
generateParamConfigMetadata('offset', false, 1 /* QueryParameter */, 3 /* Integer */),
|
|
525
|
+
generateParamConfigMetadata('orderBy', false, 1 /* QueryParameter */, 0 /* String */),
|
|
526
|
+
generateParamConfigMetadata('search', false, 1 /* QueryParameter */, 0 /* String */),
|
|
527
|
+
];
|
|
528
|
+
const getIdpConfigurations_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$5, getIdpConfigurations_ConfigPropertyMetadata);
|
|
529
|
+
const createResourceParams$5 = /*#__PURE__*/ createResourceParams$6(getIdpConfigurations_ConfigPropertyMetadata);
|
|
530
|
+
function keyBuilder$8(luvio, config) {
|
|
531
|
+
const resourceParams = createResourceParams$5(config);
|
|
532
|
+
return keyBuilder$9(luvio, resourceParams);
|
|
533
|
+
}
|
|
534
|
+
function typeCheckConfig$5(untrustedConfig) {
|
|
535
|
+
const config = {};
|
|
536
|
+
typeCheckConfig$6(untrustedConfig, config, getIdpConfigurations_ConfigPropertyMetadata);
|
|
537
|
+
return config;
|
|
538
|
+
}
|
|
539
|
+
function validateAdapterConfig$5(untrustedConfig, configPropertyNames) {
|
|
540
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
541
|
+
return null;
|
|
542
|
+
}
|
|
543
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
544
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
545
|
+
}
|
|
546
|
+
const config = typeCheckConfig$5(untrustedConfig);
|
|
547
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
548
|
+
return null;
|
|
549
|
+
}
|
|
550
|
+
return config;
|
|
551
|
+
}
|
|
552
|
+
function adapterFragment$3(luvio, config) {
|
|
553
|
+
createResourceParams$5(config);
|
|
554
|
+
return select$8();
|
|
555
|
+
}
|
|
556
|
+
function onFetchResponseSuccess$3(luvio, config, resourceParams, response) {
|
|
557
|
+
const snapshot = ingestSuccess$4(luvio, resourceParams, response, {
|
|
558
|
+
config,
|
|
559
|
+
resolve: () => buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions)
|
|
560
|
+
});
|
|
561
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
562
|
+
}
|
|
563
|
+
function onFetchResponseError$3(luvio, config, resourceParams, response) {
|
|
564
|
+
const snapshot = ingestError$3(luvio, resourceParams, response, {
|
|
565
|
+
config,
|
|
566
|
+
resolve: () => buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions)
|
|
567
|
+
});
|
|
568
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
569
|
+
}
|
|
570
|
+
function buildNetworkSnapshot$5(luvio, config, options) {
|
|
571
|
+
const resourceParams = createResourceParams$5(config);
|
|
572
|
+
const request = createResourceRequest$5(resourceParams);
|
|
573
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
574
|
+
.then((response) => {
|
|
575
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$3(luvio, config, resourceParams, response), () => {
|
|
576
|
+
const cache = new StoreKeyMap();
|
|
577
|
+
getResponseCacheKeys$5(cache, luvio, resourceParams, response.body);
|
|
578
|
+
return cache;
|
|
579
|
+
});
|
|
580
|
+
}, (response) => {
|
|
581
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$3(luvio, config, resourceParams, response));
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
function buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext) {
|
|
585
|
+
return buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext, buildNetworkSnapshot$5, undefined, false);
|
|
586
|
+
}
|
|
587
|
+
function buildCachedSnapshotCachePolicy$3(context, storeLookup) {
|
|
588
|
+
const { luvio, config } = context;
|
|
589
|
+
const selector = {
|
|
590
|
+
recordId: keyBuilder$8(luvio, config),
|
|
591
|
+
node: adapterFragment$3(luvio, config),
|
|
592
|
+
variables: {},
|
|
593
|
+
};
|
|
594
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
595
|
+
config,
|
|
596
|
+
resolve: () => buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions)
|
|
597
|
+
});
|
|
598
|
+
return cacheSnapshot;
|
|
599
|
+
}
|
|
600
|
+
const getIdpConfigurationsAdapterFactory = (luvio) => function documentProcessing__getIdpConfigurations(untrustedConfig, requestContext) {
|
|
601
|
+
const config = validateAdapterConfig$5(untrustedConfig, getIdpConfigurations_ConfigPropertyNames);
|
|
602
|
+
// Invalid or incomplete config
|
|
603
|
+
if (config === null) {
|
|
604
|
+
return null;
|
|
605
|
+
}
|
|
606
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
607
|
+
buildCachedSnapshotCachePolicy$3, buildNetworkSnapshotCachePolicy$3);
|
|
608
|
+
};
|
|
609
|
+
|
|
610
|
+
const TTL$2 = 500;
|
|
611
|
+
const VERSION$3 = "673ad526d1c602ea355962b1db5ce9d8";
|
|
612
|
+
function validate$5(obj, path = 'IdpConfigurationDetailsRepresentation') {
|
|
613
|
+
const v_error = (() => {
|
|
614
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
615
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
616
|
+
}
|
|
617
|
+
const obj_name = obj.name;
|
|
618
|
+
const path_name = path + '.name';
|
|
619
|
+
if (typeof obj_name !== 'string') {
|
|
620
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
621
|
+
}
|
|
622
|
+
const obj_schemaConfig = obj.schemaConfig;
|
|
623
|
+
const path_schemaConfig = path + '.schemaConfig';
|
|
624
|
+
let obj_schemaConfig_union0 = null;
|
|
625
|
+
const obj_schemaConfig_union0_error = (() => {
|
|
626
|
+
if (typeof obj_schemaConfig !== 'string') {
|
|
627
|
+
return new TypeError('Expected "string" but received "' + typeof obj_schemaConfig + '" (at "' + path_schemaConfig + '")');
|
|
628
|
+
}
|
|
629
|
+
})();
|
|
630
|
+
if (obj_schemaConfig_union0_error != null) {
|
|
631
|
+
obj_schemaConfig_union0 = obj_schemaConfig_union0_error.message;
|
|
632
|
+
}
|
|
633
|
+
let obj_schemaConfig_union1 = null;
|
|
634
|
+
const obj_schemaConfig_union1_error = (() => {
|
|
635
|
+
if (obj_schemaConfig !== null) {
|
|
636
|
+
return new TypeError('Expected "null" but received "' + typeof obj_schemaConfig + '" (at "' + path_schemaConfig + '")');
|
|
637
|
+
}
|
|
638
|
+
})();
|
|
639
|
+
if (obj_schemaConfig_union1_error != null) {
|
|
640
|
+
obj_schemaConfig_union1 = obj_schemaConfig_union1_error.message;
|
|
641
|
+
}
|
|
642
|
+
if (obj_schemaConfig_union0 && obj_schemaConfig_union1) {
|
|
643
|
+
let message = 'Object doesn\'t match union (at "' + path_schemaConfig + '")';
|
|
644
|
+
message += '\n' + obj_schemaConfig_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
645
|
+
message += '\n' + obj_schemaConfig_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
646
|
+
return new TypeError(message);
|
|
647
|
+
}
|
|
648
|
+
})();
|
|
649
|
+
return v_error === undefined ? null : v_error;
|
|
650
|
+
}
|
|
651
|
+
const RepresentationType$3 = 'IdpConfigurationDetailsRepresentation';
|
|
652
|
+
function keyBuilder$7(luvio, config) {
|
|
653
|
+
return keyPrefix + '::' + RepresentationType$3 + ':' + config.name;
|
|
654
|
+
}
|
|
655
|
+
function keyBuilderFromType(luvio, object) {
|
|
656
|
+
const keyParams = {
|
|
657
|
+
name: object.name
|
|
658
|
+
};
|
|
659
|
+
return keyBuilder$7(luvio, keyParams);
|
|
660
|
+
}
|
|
661
|
+
function normalize$3(input, existing, path, luvio, store, timestamp) {
|
|
662
|
+
return input;
|
|
663
|
+
}
|
|
664
|
+
const select$7 = function IdpConfigurationDetailsRepresentationSelect() {
|
|
665
|
+
return {
|
|
666
|
+
kind: 'Fragment',
|
|
667
|
+
version: VERSION$3,
|
|
668
|
+
private: [],
|
|
669
|
+
selections: [
|
|
670
|
+
{
|
|
671
|
+
name: 'name',
|
|
672
|
+
kind: 'Scalar'
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
name: 'schemaConfig',
|
|
676
|
+
kind: 'Scalar'
|
|
677
|
+
}
|
|
678
|
+
]
|
|
679
|
+
};
|
|
680
|
+
};
|
|
681
|
+
function equals$3(existing, incoming) {
|
|
682
|
+
const existing_name = existing.name;
|
|
683
|
+
const incoming_name = incoming.name;
|
|
684
|
+
if (!(existing_name === incoming_name)) {
|
|
685
|
+
return false;
|
|
686
|
+
}
|
|
687
|
+
const existing_schemaConfig = existing.schemaConfig;
|
|
688
|
+
const incoming_schemaConfig = incoming.schemaConfig;
|
|
689
|
+
if (!(existing_schemaConfig === incoming_schemaConfig)) {
|
|
690
|
+
return false;
|
|
691
|
+
}
|
|
692
|
+
return true;
|
|
693
|
+
}
|
|
694
|
+
const ingest$3 = function IdpConfigurationDetailsRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
695
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
696
|
+
const validateError = validate$5(input);
|
|
697
|
+
if (validateError !== null) {
|
|
698
|
+
throw validateError;
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
const key = keyBuilderFromType(luvio, input);
|
|
702
|
+
const ttlToUse = TTL$2;
|
|
703
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$3, "document-processing", VERSION$3, RepresentationType$3, equals$3);
|
|
704
|
+
return createLink(key);
|
|
705
|
+
};
|
|
706
|
+
function getTypeCacheKeys$3(rootKeySet, luvio, input, fullPathFactory) {
|
|
707
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
708
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
709
|
+
rootKeySet.set(rootKey, {
|
|
710
|
+
namespace: keyPrefix,
|
|
711
|
+
representationName: RepresentationType$3,
|
|
712
|
+
mergeable: false
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
function select$6(luvio, params) {
|
|
717
|
+
return select$7();
|
|
718
|
+
}
|
|
719
|
+
function getResponseCacheKeys$4(storeKeyMap, luvio, resourceParams, response) {
|
|
720
|
+
getTypeCacheKeys$3(storeKeyMap, luvio, response);
|
|
721
|
+
}
|
|
722
|
+
function ingestSuccess$3(luvio, resourceParams, response) {
|
|
723
|
+
const { body } = response;
|
|
724
|
+
const key = keyBuilderFromType(luvio, body);
|
|
725
|
+
luvio.storeIngest(key, ingest$3, body);
|
|
726
|
+
const snapshot = luvio.storeLookup({
|
|
727
|
+
recordId: key,
|
|
728
|
+
node: select$6(),
|
|
729
|
+
variables: {},
|
|
730
|
+
});
|
|
731
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
732
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
733
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
deepFreeze(snapshot.data);
|
|
737
|
+
return snapshot;
|
|
738
|
+
}
|
|
739
|
+
function createResourceRequest$4(config) {
|
|
740
|
+
const headers = {};
|
|
741
|
+
return {
|
|
742
|
+
baseUri: '/services/data/v64.0',
|
|
743
|
+
basePath: '/ssot/document-processing/configurations',
|
|
744
|
+
method: 'post',
|
|
745
|
+
body: config.body,
|
|
746
|
+
urlParams: {},
|
|
747
|
+
queryParams: {},
|
|
748
|
+
headers,
|
|
749
|
+
priority: 'normal',
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
const adapterName$4 = 'createIdpConfiguration';
|
|
754
|
+
const createIdpConfiguration_ConfigPropertyMetadata = [
|
|
755
|
+
generateParamConfigMetadata('activationStatus', true, 2 /* Body */, 0 /* String */),
|
|
756
|
+
generateParamConfigMetadata('description', true, 2 /* Body */, 0 /* String */),
|
|
757
|
+
generateParamConfigMetadata('fileConfig', true, 2 /* Body */, 4 /* Unsupported */),
|
|
758
|
+
generateParamConfigMetadata('label', true, 2 /* Body */, 0 /* String */),
|
|
759
|
+
generateParamConfigMetadata('mlModel', true, 2 /* Body */, 0 /* String */),
|
|
760
|
+
generateParamConfigMetadata('name', true, 2 /* Body */, 0 /* String */),
|
|
761
|
+
generateParamConfigMetadata('schemaConfig', true, 2 /* Body */, 0 /* String */),
|
|
762
|
+
];
|
|
763
|
+
const createIdpConfiguration_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$4, createIdpConfiguration_ConfigPropertyMetadata);
|
|
764
|
+
const createResourceParams$4 = /*#__PURE__*/ createResourceParams$6(createIdpConfiguration_ConfigPropertyMetadata);
|
|
765
|
+
function typeCheckConfig$4(untrustedConfig) {
|
|
766
|
+
const config = {};
|
|
767
|
+
typeCheckConfig$6(untrustedConfig, config, createIdpConfiguration_ConfigPropertyMetadata);
|
|
768
|
+
const untrustedConfig_fileConfig = untrustedConfig.fileConfig;
|
|
769
|
+
if (untrustedIsObject(untrustedConfig_fileConfig)) {
|
|
770
|
+
const untrustedConfig_fileConfig_object = {};
|
|
771
|
+
const untrustedConfig_fileConfig_fileTypes = untrustedConfig_fileConfig.fileTypes;
|
|
772
|
+
if (ArrayIsArray$1(untrustedConfig_fileConfig_fileTypes)) {
|
|
773
|
+
const untrustedConfig_fileConfig_fileTypes_array = [];
|
|
774
|
+
for (let i = 0, arrayLength = untrustedConfig_fileConfig_fileTypes.length; i < arrayLength; i++) {
|
|
775
|
+
const untrustedConfig_fileConfig_fileTypes_item = untrustedConfig_fileConfig_fileTypes[i];
|
|
776
|
+
if (typeof untrustedConfig_fileConfig_fileTypes_item === 'string') {
|
|
777
|
+
untrustedConfig_fileConfig_fileTypes_array.push(untrustedConfig_fileConfig_fileTypes_item);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
untrustedConfig_fileConfig_object.fileTypes = untrustedConfig_fileConfig_fileTypes_array;
|
|
781
|
+
}
|
|
782
|
+
if (untrustedConfig_fileConfig_object !== undefined && Object.keys(untrustedConfig_fileConfig_object).length >= 0) {
|
|
783
|
+
config.fileConfig = untrustedConfig_fileConfig_object;
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
return config;
|
|
787
|
+
}
|
|
788
|
+
function validateAdapterConfig$4(untrustedConfig, configPropertyNames) {
|
|
789
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
790
|
+
return null;
|
|
791
|
+
}
|
|
792
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
793
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
794
|
+
}
|
|
795
|
+
const config = typeCheckConfig$4(untrustedConfig);
|
|
796
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
797
|
+
return null;
|
|
798
|
+
}
|
|
799
|
+
return config;
|
|
800
|
+
}
|
|
801
|
+
function buildNetworkSnapshot$4(luvio, config, options) {
|
|
802
|
+
const resourceParams = createResourceParams$4(config);
|
|
803
|
+
const request = createResourceRequest$4(resourceParams);
|
|
804
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
805
|
+
.then((response) => {
|
|
806
|
+
return luvio.handleSuccessResponse(() => {
|
|
807
|
+
const snapshot = ingestSuccess$3(luvio, resourceParams, response);
|
|
808
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
809
|
+
}, () => {
|
|
810
|
+
const cache = new StoreKeyMap();
|
|
811
|
+
getResponseCacheKeys$4(cache, luvio, resourceParams, response.body);
|
|
812
|
+
return cache;
|
|
813
|
+
});
|
|
814
|
+
}, (response) => {
|
|
815
|
+
deepFreeze(response);
|
|
816
|
+
throw response;
|
|
817
|
+
});
|
|
818
|
+
}
|
|
819
|
+
const createIdpConfigurationAdapterFactory = (luvio) => {
|
|
820
|
+
return function createIdpConfiguration(untrustedConfig) {
|
|
821
|
+
const config = validateAdapterConfig$4(untrustedConfig, createIdpConfiguration_ConfigPropertyNames);
|
|
822
|
+
// Invalid or incomplete config
|
|
823
|
+
if (config === null) {
|
|
824
|
+
throw new Error('Invalid config for "createIdpConfiguration"');
|
|
825
|
+
}
|
|
826
|
+
return buildNetworkSnapshot$4(luvio, config);
|
|
827
|
+
};
|
|
828
|
+
};
|
|
829
|
+
|
|
830
|
+
function keyBuilder$6(luvio, params) {
|
|
831
|
+
return keyBuilder$7(luvio, {
|
|
832
|
+
name: params.urlParams.idOrApiName
|
|
833
|
+
});
|
|
834
|
+
}
|
|
835
|
+
function getResponseCacheKeys$3(cacheKeyMap, luvio, resourceParams) {
|
|
836
|
+
const key = keyBuilder$6(luvio, resourceParams);
|
|
837
|
+
cacheKeyMap.set(key, {
|
|
838
|
+
namespace: keyPrefix,
|
|
839
|
+
representationName: RepresentationType$3,
|
|
840
|
+
mergeable: false
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
function evictSuccess(luvio, resourceParams) {
|
|
844
|
+
const key = keyBuilder$6(luvio, resourceParams);
|
|
845
|
+
luvio.storeEvict(key);
|
|
846
|
+
}
|
|
847
|
+
function createResourceRequest$3(config) {
|
|
848
|
+
const headers = {};
|
|
849
|
+
return {
|
|
850
|
+
baseUri: '/services/data/v64.0',
|
|
851
|
+
basePath: '/ssot/document-processing/configurations/' + config.urlParams.idOrApiName + '',
|
|
852
|
+
method: 'delete',
|
|
853
|
+
body: null,
|
|
854
|
+
urlParams: config.urlParams,
|
|
855
|
+
queryParams: {},
|
|
856
|
+
headers,
|
|
857
|
+
priority: 'normal',
|
|
858
|
+
};
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
const adapterName$3 = 'deleteIdpConfiguration';
|
|
862
|
+
const deleteIdpConfiguration_ConfigPropertyMetadata = [
|
|
863
|
+
generateParamConfigMetadata('idOrApiName', true, 0 /* UrlParameter */, 0 /* String */),
|
|
864
|
+
];
|
|
865
|
+
const deleteIdpConfiguration_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, deleteIdpConfiguration_ConfigPropertyMetadata);
|
|
866
|
+
const createResourceParams$3 = /*#__PURE__*/ createResourceParams$6(deleteIdpConfiguration_ConfigPropertyMetadata);
|
|
867
|
+
function typeCheckConfig$3(untrustedConfig) {
|
|
868
|
+
const config = {};
|
|
869
|
+
typeCheckConfig$6(untrustedConfig, config, deleteIdpConfiguration_ConfigPropertyMetadata);
|
|
870
|
+
return config;
|
|
871
|
+
}
|
|
872
|
+
function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
|
|
873
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
874
|
+
return null;
|
|
875
|
+
}
|
|
876
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
877
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
878
|
+
}
|
|
879
|
+
const config = typeCheckConfig$3(untrustedConfig);
|
|
880
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
881
|
+
return null;
|
|
882
|
+
}
|
|
883
|
+
return config;
|
|
884
|
+
}
|
|
885
|
+
function buildNetworkSnapshot$3(luvio, config, options) {
|
|
886
|
+
const resourceParams = createResourceParams$3(config);
|
|
887
|
+
const request = createResourceRequest$3(resourceParams);
|
|
888
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
889
|
+
.then(() => {
|
|
890
|
+
return luvio.handleSuccessResponse(() => {
|
|
891
|
+
evictSuccess(luvio, resourceParams);
|
|
892
|
+
return luvio.storeBroadcast();
|
|
893
|
+
}, () => {
|
|
894
|
+
const cache = new StoreKeyMap();
|
|
895
|
+
getResponseCacheKeys$3(cache, luvio, resourceParams);
|
|
896
|
+
return cache;
|
|
897
|
+
});
|
|
898
|
+
}, (response) => {
|
|
899
|
+
deepFreeze(response);
|
|
900
|
+
throw response;
|
|
901
|
+
});
|
|
902
|
+
}
|
|
903
|
+
const deleteIdpConfigurationAdapterFactory = (luvio) => {
|
|
904
|
+
return function documentProcessingdeleteIdpConfiguration(untrustedConfig) {
|
|
905
|
+
const config = validateAdapterConfig$3(untrustedConfig, deleteIdpConfiguration_ConfigPropertyNames);
|
|
906
|
+
// Invalid or incomplete config
|
|
907
|
+
if (config === null) {
|
|
908
|
+
throw new Error(`Invalid config for "${adapterName$3}"`);
|
|
909
|
+
}
|
|
910
|
+
return buildNetworkSnapshot$3(luvio, config);
|
|
911
|
+
};
|
|
912
|
+
};
|
|
913
|
+
|
|
914
|
+
function select$5(luvio, params) {
|
|
915
|
+
return select$7();
|
|
916
|
+
}
|
|
917
|
+
function keyBuilder$5(luvio, params) {
|
|
918
|
+
return keyBuilder$7(luvio, {
|
|
919
|
+
name: params.urlParams.idOrApiName
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
|
|
923
|
+
getTypeCacheKeys$3(storeKeyMap, luvio, response);
|
|
924
|
+
}
|
|
925
|
+
function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
|
|
926
|
+
const { body } = response;
|
|
927
|
+
const key = keyBuilder$5(luvio, resourceParams);
|
|
928
|
+
luvio.storeIngest(key, ingest$3, body);
|
|
929
|
+
const snapshot = luvio.storeLookup({
|
|
930
|
+
recordId: key,
|
|
931
|
+
node: select$5(),
|
|
932
|
+
variables: {},
|
|
933
|
+
}, snapshotRefresh);
|
|
934
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
935
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
936
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
deepFreeze(snapshot.data);
|
|
940
|
+
return snapshot;
|
|
941
|
+
}
|
|
942
|
+
function ingestError$2(luvio, params, error, snapshotRefresh) {
|
|
943
|
+
const key = keyBuilder$5(luvio, params);
|
|
944
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
945
|
+
const storeMetadataParams = {
|
|
946
|
+
ttl: TTL$2,
|
|
947
|
+
namespace: keyPrefix,
|
|
948
|
+
version: VERSION$3,
|
|
949
|
+
representationName: RepresentationType$3
|
|
950
|
+
};
|
|
951
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
952
|
+
return errorSnapshot;
|
|
953
|
+
}
|
|
954
|
+
function createResourceRequest$2(config) {
|
|
955
|
+
const headers = {};
|
|
956
|
+
return {
|
|
957
|
+
baseUri: '/services/data/v64.0',
|
|
958
|
+
basePath: '/ssot/document-processing/configurations/' + config.urlParams.idOrApiName + '',
|
|
959
|
+
method: 'get',
|
|
960
|
+
body: null,
|
|
961
|
+
urlParams: config.urlParams,
|
|
962
|
+
queryParams: {},
|
|
963
|
+
headers,
|
|
964
|
+
priority: 'normal',
|
|
965
|
+
};
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
const adapterName$2 = 'getIdpConfiguration';
|
|
969
|
+
const getIdpConfiguration_ConfigPropertyMetadata = [
|
|
970
|
+
generateParamConfigMetadata('idOrApiName', true, 0 /* UrlParameter */, 0 /* String */),
|
|
971
|
+
];
|
|
972
|
+
const getIdpConfiguration_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getIdpConfiguration_ConfigPropertyMetadata);
|
|
973
|
+
const createResourceParams$2 = /*#__PURE__*/ createResourceParams$6(getIdpConfiguration_ConfigPropertyMetadata);
|
|
974
|
+
function keyBuilder$4(luvio, config) {
|
|
975
|
+
const resourceParams = createResourceParams$2(config);
|
|
976
|
+
return keyBuilder$5(luvio, resourceParams);
|
|
977
|
+
}
|
|
978
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
979
|
+
const config = {};
|
|
980
|
+
typeCheckConfig$6(untrustedConfig, config, getIdpConfiguration_ConfigPropertyMetadata);
|
|
981
|
+
return config;
|
|
982
|
+
}
|
|
983
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
984
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
985
|
+
return null;
|
|
986
|
+
}
|
|
987
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
988
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
989
|
+
}
|
|
990
|
+
const config = typeCheckConfig$2(untrustedConfig);
|
|
991
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
992
|
+
return null;
|
|
993
|
+
}
|
|
994
|
+
return config;
|
|
995
|
+
}
|
|
996
|
+
function adapterFragment$2(luvio, config) {
|
|
997
|
+
createResourceParams$2(config);
|
|
998
|
+
return select$5();
|
|
999
|
+
}
|
|
1000
|
+
function onFetchResponseSuccess$2(luvio, config, resourceParams, response) {
|
|
1001
|
+
const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
|
|
1002
|
+
config,
|
|
1003
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1004
|
+
});
|
|
1005
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1006
|
+
}
|
|
1007
|
+
function onFetchResponseError$2(luvio, config, resourceParams, response) {
|
|
1008
|
+
const snapshot = ingestError$2(luvio, resourceParams, response, {
|
|
1009
|
+
config,
|
|
1010
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1011
|
+
});
|
|
1012
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1013
|
+
}
|
|
1014
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
1015
|
+
const resourceParams = createResourceParams$2(config);
|
|
1016
|
+
const request = createResourceRequest$2(resourceParams);
|
|
1017
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1018
|
+
.then((response) => {
|
|
1019
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$2(luvio, config, resourceParams, response), () => {
|
|
1020
|
+
const cache = new StoreKeyMap();
|
|
1021
|
+
getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
|
|
1022
|
+
return cache;
|
|
1023
|
+
});
|
|
1024
|
+
}, (response) => {
|
|
1025
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$2(luvio, config, resourceParams, response));
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
function buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext) {
|
|
1029
|
+
return buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, undefined, false);
|
|
1030
|
+
}
|
|
1031
|
+
function buildCachedSnapshotCachePolicy$2(context, storeLookup) {
|
|
1032
|
+
const { luvio, config } = context;
|
|
1033
|
+
const selector = {
|
|
1034
|
+
recordId: keyBuilder$4(luvio, config),
|
|
1035
|
+
node: adapterFragment$2(luvio, config),
|
|
1036
|
+
variables: {},
|
|
1037
|
+
};
|
|
1038
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
1039
|
+
config,
|
|
1040
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1041
|
+
});
|
|
1042
|
+
return cacheSnapshot;
|
|
1043
|
+
}
|
|
1044
|
+
const getIdpConfigurationAdapterFactory = (luvio) => function documentProcessing__getIdpConfiguration(untrustedConfig, requestContext) {
|
|
1045
|
+
const config = validateAdapterConfig$2(untrustedConfig, getIdpConfiguration_ConfigPropertyNames);
|
|
1046
|
+
// Invalid or incomplete config
|
|
1047
|
+
if (config === null) {
|
|
1048
|
+
return null;
|
|
1049
|
+
}
|
|
1050
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1051
|
+
buildCachedSnapshotCachePolicy$2, buildNetworkSnapshotCachePolicy$2);
|
|
1052
|
+
};
|
|
1053
|
+
|
|
1054
|
+
function validate$4(obj, path = 'IdpContentTypeRepresentation') {
|
|
1055
|
+
const v_error = (() => {
|
|
1056
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1057
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1058
|
+
}
|
|
1059
|
+
const obj_isDefault = obj.isDefault;
|
|
1060
|
+
const path_isDefault = path + '.isDefault';
|
|
1061
|
+
if (typeof obj_isDefault !== 'boolean') {
|
|
1062
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isDefault + '" (at "' + path_isDefault + '")');
|
|
1063
|
+
}
|
|
1064
|
+
const obj_label = obj.label;
|
|
1065
|
+
const path_label = path + '.label';
|
|
1066
|
+
if (typeof obj_label !== 'string') {
|
|
1067
|
+
return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
1068
|
+
}
|
|
1069
|
+
const obj_maxFileSizeInMB = obj.maxFileSizeInMB;
|
|
1070
|
+
const path_maxFileSizeInMB = path + '.maxFileSizeInMB';
|
|
1071
|
+
if (typeof obj_maxFileSizeInMB !== 'number' || (typeof obj_maxFileSizeInMB === 'number' && Math.floor(obj_maxFileSizeInMB) !== obj_maxFileSizeInMB)) {
|
|
1072
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_maxFileSizeInMB + '" (at "' + path_maxFileSizeInMB + '")');
|
|
1073
|
+
}
|
|
1074
|
+
const obj_type = obj.type;
|
|
1075
|
+
const path_type = path + '.type';
|
|
1076
|
+
if (typeof obj_type !== 'string') {
|
|
1077
|
+
return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
|
|
1078
|
+
}
|
|
1079
|
+
})();
|
|
1080
|
+
return v_error === undefined ? null : v_error;
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
function validate$3(obj, path = 'IdpSupportedModelRepresentation') {
|
|
1084
|
+
const v_error = (() => {
|
|
1085
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1086
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1087
|
+
}
|
|
1088
|
+
const obj_id = obj.id;
|
|
1089
|
+
const path_id = path + '.id';
|
|
1090
|
+
if (typeof obj_id !== 'string') {
|
|
1091
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
1092
|
+
}
|
|
1093
|
+
const obj_isDefault = obj.isDefault;
|
|
1094
|
+
const path_isDefault = path + '.isDefault';
|
|
1095
|
+
if (typeof obj_isDefault !== 'boolean') {
|
|
1096
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isDefault + '" (at "' + path_isDefault + '")');
|
|
1097
|
+
}
|
|
1098
|
+
const obj_label = obj.label;
|
|
1099
|
+
const path_label = path + '.label';
|
|
1100
|
+
if (typeof obj_label !== 'string') {
|
|
1101
|
+
return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
1102
|
+
}
|
|
1103
|
+
const obj_provider = obj.provider;
|
|
1104
|
+
const path_provider = path + '.provider';
|
|
1105
|
+
if (typeof obj_provider !== 'string') {
|
|
1106
|
+
return new TypeError('Expected "string" but received "' + typeof obj_provider + '" (at "' + path_provider + '")');
|
|
1107
|
+
}
|
|
1108
|
+
const obj_status = obj.status;
|
|
1109
|
+
const path_status = path + '.status';
|
|
1110
|
+
if (typeof obj_status !== 'string') {
|
|
1111
|
+
return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
|
|
1112
|
+
}
|
|
1113
|
+
})();
|
|
1114
|
+
return v_error === undefined ? null : v_error;
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
const TTL$1 = 500;
|
|
1118
|
+
const VERSION$2 = "bdf0262770f9e912af6b77a807f4d804";
|
|
1119
|
+
function validate$2(obj, path = 'IdpGlobalConfigRepresentation') {
|
|
1120
|
+
const v_error = (() => {
|
|
1121
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1122
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1123
|
+
}
|
|
1124
|
+
const obj_supportedContentTypes = obj.supportedContentTypes;
|
|
1125
|
+
const path_supportedContentTypes = path + '.supportedContentTypes';
|
|
1126
|
+
if (!ArrayIsArray(obj_supportedContentTypes)) {
|
|
1127
|
+
return new TypeError('Expected "array" but received "' + typeof obj_supportedContentTypes + '" (at "' + path_supportedContentTypes + '")');
|
|
1128
|
+
}
|
|
1129
|
+
for (let i = 0; i < obj_supportedContentTypes.length; i++) {
|
|
1130
|
+
const obj_supportedContentTypes_item = obj_supportedContentTypes[i];
|
|
1131
|
+
const path_supportedContentTypes_item = path_supportedContentTypes + '[' + i + ']';
|
|
1132
|
+
const referencepath_supportedContentTypes_itemValidationError = validate$4(obj_supportedContentTypes_item, path_supportedContentTypes_item);
|
|
1133
|
+
if (referencepath_supportedContentTypes_itemValidationError !== null) {
|
|
1134
|
+
let message = 'Object doesn\'t match IdpContentTypeRepresentation (at "' + path_supportedContentTypes_item + '")\n';
|
|
1135
|
+
message += referencepath_supportedContentTypes_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1136
|
+
return new TypeError(message);
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
const obj_supportedModels = obj.supportedModels;
|
|
1140
|
+
const path_supportedModels = path + '.supportedModels';
|
|
1141
|
+
if (!ArrayIsArray(obj_supportedModels)) {
|
|
1142
|
+
return new TypeError('Expected "array" but received "' + typeof obj_supportedModels + '" (at "' + path_supportedModels + '")');
|
|
1143
|
+
}
|
|
1144
|
+
for (let i = 0; i < obj_supportedModels.length; i++) {
|
|
1145
|
+
const obj_supportedModels_item = obj_supportedModels[i];
|
|
1146
|
+
const path_supportedModels_item = path_supportedModels + '[' + i + ']';
|
|
1147
|
+
const referencepath_supportedModels_itemValidationError = validate$3(obj_supportedModels_item, path_supportedModels_item);
|
|
1148
|
+
if (referencepath_supportedModels_itemValidationError !== null) {
|
|
1149
|
+
let message = 'Object doesn\'t match IdpSupportedModelRepresentation (at "' + path_supportedModels_item + '")\n';
|
|
1150
|
+
message += referencepath_supportedModels_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1151
|
+
return new TypeError(message);
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
const obj_version = obj.version;
|
|
1155
|
+
const path_version = path + '.version';
|
|
1156
|
+
if (typeof obj_version !== 'string') {
|
|
1157
|
+
return new TypeError('Expected "string" but received "' + typeof obj_version + '" (at "' + path_version + '")');
|
|
1158
|
+
}
|
|
1159
|
+
})();
|
|
1160
|
+
return v_error === undefined ? null : v_error;
|
|
1161
|
+
}
|
|
1162
|
+
const RepresentationType$2 = 'IdpGlobalConfigRepresentation';
|
|
1163
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
1164
|
+
return input;
|
|
1165
|
+
}
|
|
1166
|
+
const select$4 = function IdpGlobalConfigRepresentationSelect() {
|
|
1167
|
+
return {
|
|
1168
|
+
kind: 'Fragment',
|
|
1169
|
+
version: VERSION$2,
|
|
1170
|
+
private: [],
|
|
1171
|
+
opaque: true
|
|
1172
|
+
};
|
|
1173
|
+
};
|
|
1174
|
+
function equals$2(existing, incoming) {
|
|
1175
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
1176
|
+
return false;
|
|
1177
|
+
}
|
|
1178
|
+
return true;
|
|
1179
|
+
}
|
|
1180
|
+
const ingest$2 = function IdpGlobalConfigRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1181
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1182
|
+
const validateError = validate$2(input);
|
|
1183
|
+
if (validateError !== null) {
|
|
1184
|
+
throw validateError;
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
const key = path.fullPath;
|
|
1188
|
+
const ttlToUse = TTL$1;
|
|
1189
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "document-processing", VERSION$2, RepresentationType$2, equals$2);
|
|
1190
|
+
return createLink(key);
|
|
1191
|
+
};
|
|
1192
|
+
function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
|
|
1193
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1194
|
+
const rootKey = fullPathFactory();
|
|
1195
|
+
rootKeySet.set(rootKey, {
|
|
1196
|
+
namespace: keyPrefix,
|
|
1197
|
+
representationName: RepresentationType$2,
|
|
1198
|
+
mergeable: false
|
|
1199
|
+
});
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
function select$3(luvio, params) {
|
|
1203
|
+
return select$4();
|
|
1204
|
+
}
|
|
1205
|
+
function keyBuilder$3(luvio, params) {
|
|
1206
|
+
return keyPrefix + '::IdpGlobalConfigRepresentation:(' + ')';
|
|
1207
|
+
}
|
|
1208
|
+
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
1209
|
+
getTypeCacheKeys$2(storeKeyMap, luvio, response, () => keyBuilder$3());
|
|
1210
|
+
}
|
|
1211
|
+
function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
|
|
1212
|
+
const { body } = response;
|
|
1213
|
+
const key = keyBuilder$3();
|
|
1214
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
1215
|
+
const snapshot = luvio.storeLookup({
|
|
1216
|
+
recordId: key,
|
|
1217
|
+
node: select$3(),
|
|
1218
|
+
variables: {},
|
|
1219
|
+
}, snapshotRefresh);
|
|
1220
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1221
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1222
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
deepFreeze(snapshot.data);
|
|
1226
|
+
return snapshot;
|
|
1227
|
+
}
|
|
1228
|
+
function ingestError$1(luvio, params, error, snapshotRefresh) {
|
|
1229
|
+
const key = keyBuilder$3();
|
|
1230
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1231
|
+
const storeMetadataParams = {
|
|
1232
|
+
ttl: TTL$1,
|
|
1233
|
+
namespace: keyPrefix,
|
|
1234
|
+
version: VERSION$2,
|
|
1235
|
+
representationName: RepresentationType$2
|
|
1236
|
+
};
|
|
1237
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
1238
|
+
return errorSnapshot;
|
|
1239
|
+
}
|
|
1240
|
+
function createResourceRequest$1(config) {
|
|
1241
|
+
const headers = {};
|
|
1242
|
+
return {
|
|
1243
|
+
baseUri: '/services/data/v64.0',
|
|
1244
|
+
basePath: '/ssot/document-processing/global-config',
|
|
1245
|
+
method: 'get',
|
|
1246
|
+
body: null,
|
|
1247
|
+
urlParams: {},
|
|
1248
|
+
queryParams: {},
|
|
1249
|
+
headers,
|
|
1250
|
+
priority: 'normal',
|
|
1251
|
+
};
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
const adapterName$1 = 'getIdpGlobalConfig';
|
|
1255
|
+
const getIdpGlobalConfig_ConfigPropertyMetadata = [];
|
|
1256
|
+
const getIdpGlobalConfig_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getIdpGlobalConfig_ConfigPropertyMetadata);
|
|
1257
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$6(getIdpGlobalConfig_ConfigPropertyMetadata);
|
|
1258
|
+
function keyBuilder$2(luvio, config) {
|
|
1259
|
+
createResourceParams$1(config);
|
|
1260
|
+
return keyBuilder$3();
|
|
1261
|
+
}
|
|
1262
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
1263
|
+
const config = {};
|
|
1264
|
+
return config;
|
|
1265
|
+
}
|
|
1266
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
1267
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1268
|
+
return null;
|
|
1269
|
+
}
|
|
1270
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1271
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1272
|
+
}
|
|
1273
|
+
const config = typeCheckConfig$1();
|
|
1274
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1275
|
+
return null;
|
|
1276
|
+
}
|
|
1277
|
+
return config;
|
|
1278
|
+
}
|
|
1279
|
+
function adapterFragment$1(luvio, config) {
|
|
1280
|
+
createResourceParams$1(config);
|
|
1281
|
+
return select$3();
|
|
1282
|
+
}
|
|
1283
|
+
function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
|
|
1284
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
|
|
1285
|
+
config,
|
|
1286
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
1287
|
+
});
|
|
1288
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1289
|
+
}
|
|
1290
|
+
function onFetchResponseError$1(luvio, config, resourceParams, response) {
|
|
1291
|
+
const snapshot = ingestError$1(luvio, resourceParams, response, {
|
|
1292
|
+
config,
|
|
1293
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
1294
|
+
});
|
|
1295
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1296
|
+
}
|
|
1297
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
1298
|
+
const resourceParams = createResourceParams$1(config);
|
|
1299
|
+
const request = createResourceRequest$1();
|
|
1300
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1301
|
+
.then((response) => {
|
|
1302
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
|
|
1303
|
+
const cache = new StoreKeyMap();
|
|
1304
|
+
getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
|
|
1305
|
+
return cache;
|
|
1306
|
+
});
|
|
1307
|
+
}, (response) => {
|
|
1308
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
|
|
1309
|
+
});
|
|
1310
|
+
}
|
|
1311
|
+
function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
|
|
1312
|
+
return buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
|
|
1313
|
+
}
|
|
1314
|
+
function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
|
|
1315
|
+
const { luvio, config } = context;
|
|
1316
|
+
const selector = {
|
|
1317
|
+
recordId: keyBuilder$2(luvio, config),
|
|
1318
|
+
node: adapterFragment$1(luvio, config),
|
|
1319
|
+
variables: {},
|
|
1320
|
+
};
|
|
1321
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
1322
|
+
config,
|
|
1323
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
1324
|
+
});
|
|
1325
|
+
return cacheSnapshot;
|
|
1326
|
+
}
|
|
1327
|
+
const getIdpGlobalConfigAdapterFactory = (luvio) => function documentProcessing__getIdpGlobalConfig(untrustedConfig, requestContext) {
|
|
1328
|
+
const config = validateAdapterConfig$1(untrustedConfig, getIdpGlobalConfig_ConfigPropertyNames);
|
|
1329
|
+
// Invalid or incomplete config
|
|
1330
|
+
if (config === null) {
|
|
1331
|
+
return null;
|
|
1332
|
+
}
|
|
1333
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1334
|
+
buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
|
|
1335
|
+
};
|
|
1336
|
+
|
|
1337
|
+
const VERSION$1 = "fd5a71c6b42febaf6ada5e5a2c32c8f6";
|
|
1338
|
+
function validate$1(obj, path = 'IdpExtractedFileDataRepresenation') {
|
|
1339
|
+
const v_error = (() => {
|
|
1340
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1341
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1342
|
+
}
|
|
1343
|
+
const obj_data = obj.data;
|
|
1344
|
+
const path_data = path + '.data';
|
|
1345
|
+
if (typeof obj_data !== 'string') {
|
|
1346
|
+
return new TypeError('Expected "string" but received "' + typeof obj_data + '" (at "' + path_data + '")');
|
|
1347
|
+
}
|
|
1348
|
+
const obj_error = obj.error;
|
|
1349
|
+
const path_error = path + '.error';
|
|
1350
|
+
let obj_error_union0 = null;
|
|
1351
|
+
const obj_error_union0_error = (() => {
|
|
1352
|
+
if (typeof obj_error !== 'string') {
|
|
1353
|
+
return new TypeError('Expected "string" but received "' + typeof obj_error + '" (at "' + path_error + '")');
|
|
1354
|
+
}
|
|
1355
|
+
})();
|
|
1356
|
+
if (obj_error_union0_error != null) {
|
|
1357
|
+
obj_error_union0 = obj_error_union0_error.message;
|
|
1358
|
+
}
|
|
1359
|
+
let obj_error_union1 = null;
|
|
1360
|
+
const obj_error_union1_error = (() => {
|
|
1361
|
+
if (obj_error !== null) {
|
|
1362
|
+
return new TypeError('Expected "null" but received "' + typeof obj_error + '" (at "' + path_error + '")');
|
|
1363
|
+
}
|
|
1364
|
+
})();
|
|
1365
|
+
if (obj_error_union1_error != null) {
|
|
1366
|
+
obj_error_union1 = obj_error_union1_error.message;
|
|
1367
|
+
}
|
|
1368
|
+
if (obj_error_union0 && obj_error_union1) {
|
|
1369
|
+
let message = 'Object doesn\'t match union (at "' + path_error + '")';
|
|
1370
|
+
message += '\n' + obj_error_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
1371
|
+
message += '\n' + obj_error_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
1372
|
+
return new TypeError(message);
|
|
1373
|
+
}
|
|
1374
|
+
})();
|
|
1375
|
+
return v_error === undefined ? null : v_error;
|
|
1376
|
+
}
|
|
1377
|
+
const RepresentationType$1 = 'IdpExtractedFileDataRepresenation';
|
|
1378
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
1379
|
+
return input;
|
|
1380
|
+
}
|
|
1381
|
+
const select$2 = function IdpExtractedFileDataRepresenationSelect() {
|
|
1382
|
+
return {
|
|
1383
|
+
kind: 'Fragment',
|
|
1384
|
+
version: VERSION$1,
|
|
1385
|
+
private: [],
|
|
1386
|
+
opaque: true
|
|
1387
|
+
};
|
|
1388
|
+
};
|
|
1389
|
+
function equals$1(existing, incoming) {
|
|
1390
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
1391
|
+
return false;
|
|
1392
|
+
}
|
|
1393
|
+
return true;
|
|
1394
|
+
}
|
|
1395
|
+
const ingest$1 = function IdpExtractedFileDataRepresenationIngest(input, path, luvio, store, timestamp) {
|
|
1396
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1397
|
+
const validateError = validate$1(input);
|
|
1398
|
+
if (validateError !== null) {
|
|
1399
|
+
throw validateError;
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
const key = path.fullPath;
|
|
1403
|
+
const ttlToUse = path.ttl;
|
|
1404
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "document-processing", VERSION$1, RepresentationType$1, equals$1);
|
|
1405
|
+
return createLink(key);
|
|
1406
|
+
};
|
|
1407
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
1408
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1409
|
+
const rootKey = fullPathFactory();
|
|
1410
|
+
rootKeySet.set(rootKey, {
|
|
1411
|
+
namespace: keyPrefix,
|
|
1412
|
+
representationName: RepresentationType$1,
|
|
1413
|
+
mergeable: false
|
|
1414
|
+
});
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
const TTL = 1200000;
|
|
1418
|
+
const VERSION = "b84ee34ba86306d907f22040f581479c";
|
|
1419
|
+
function validate(obj, path = 'IdpExtractedDataRepresentation') {
|
|
1420
|
+
const v_error = (() => {
|
|
1421
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1422
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1423
|
+
}
|
|
1424
|
+
const obj_data = obj.data;
|
|
1425
|
+
const path_data = path + '.data';
|
|
1426
|
+
if (!ArrayIsArray(obj_data)) {
|
|
1427
|
+
return new TypeError('Expected "array" but received "' + typeof obj_data + '" (at "' + path_data + '")');
|
|
1428
|
+
}
|
|
1429
|
+
for (let i = 0; i < obj_data.length; i++) {
|
|
1430
|
+
const obj_data_item = obj_data[i];
|
|
1431
|
+
const path_data_item = path_data + '[' + i + ']';
|
|
1432
|
+
if (typeof obj_data_item !== 'object') {
|
|
1433
|
+
return new TypeError('Expected "object" but received "' + typeof obj_data_item + '" (at "' + path_data_item + '")');
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
})();
|
|
1437
|
+
return v_error === undefined ? null : v_error;
|
|
1438
|
+
}
|
|
1439
|
+
const RepresentationType = 'IdpExtractedDataRepresentation';
|
|
1440
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
1441
|
+
const input_data = input.data;
|
|
1442
|
+
const input_data_id = path.fullPath + '__data';
|
|
1443
|
+
for (let i = 0; i < input_data.length; i++) {
|
|
1444
|
+
const input_data_item = input_data[i];
|
|
1445
|
+
let input_data_item_id = input_data_id + '__' + i;
|
|
1446
|
+
input_data[i] = ingest$1(input_data_item, {
|
|
1447
|
+
fullPath: input_data_item_id,
|
|
1448
|
+
propertyName: i,
|
|
1449
|
+
parent: {
|
|
1450
|
+
data: input,
|
|
1451
|
+
key: path.fullPath,
|
|
1452
|
+
existing: existing,
|
|
1453
|
+
},
|
|
1454
|
+
ttl: path.ttl
|
|
1455
|
+
}, luvio, store, timestamp);
|
|
1456
|
+
}
|
|
1457
|
+
return input;
|
|
1458
|
+
}
|
|
1459
|
+
const select$1 = function IdpExtractedDataRepresentationSelect() {
|
|
1460
|
+
return {
|
|
1461
|
+
kind: 'Fragment',
|
|
1462
|
+
version: VERSION,
|
|
1463
|
+
private: [],
|
|
1464
|
+
selections: [
|
|
1465
|
+
{
|
|
1466
|
+
name: 'data',
|
|
1467
|
+
kind: 'Link',
|
|
1468
|
+
plural: true,
|
|
1469
|
+
fragment: select$2()
|
|
1470
|
+
}
|
|
1471
|
+
]
|
|
1472
|
+
};
|
|
1473
|
+
};
|
|
1474
|
+
function equals(existing, incoming) {
|
|
1475
|
+
const existing_data = existing.data;
|
|
1476
|
+
const incoming_data = incoming.data;
|
|
1477
|
+
const equals_data_items = equalsArray(existing_data, incoming_data, (existing_data_item, incoming_data_item) => {
|
|
1478
|
+
if (!(existing_data_item.__ref === incoming_data_item.__ref)) {
|
|
1479
|
+
return false;
|
|
1480
|
+
}
|
|
1481
|
+
});
|
|
1482
|
+
if (equals_data_items === false) {
|
|
1483
|
+
return false;
|
|
1484
|
+
}
|
|
1485
|
+
return true;
|
|
1486
|
+
}
|
|
1487
|
+
const ingest = function IdpExtractedDataRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1488
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1489
|
+
const validateError = validate(input);
|
|
1490
|
+
if (validateError !== null) {
|
|
1491
|
+
throw validateError;
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
const key = path.fullPath;
|
|
1495
|
+
const ttlToUse = TTL;
|
|
1496
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "document-processing", VERSION, RepresentationType, equals);
|
|
1497
|
+
return createLink(key);
|
|
1498
|
+
};
|
|
1499
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
1500
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1501
|
+
const rootKey = fullPathFactory();
|
|
1502
|
+
rootKeySet.set(rootKey, {
|
|
1503
|
+
namespace: keyPrefix,
|
|
1504
|
+
representationName: RepresentationType,
|
|
1505
|
+
mergeable: false
|
|
1506
|
+
});
|
|
1507
|
+
const input_data_length = input.data.length;
|
|
1508
|
+
for (let i = 0; i < input_data_length; i++) {
|
|
1509
|
+
getTypeCacheKeys$1(rootKeySet, luvio, input.data[i], () => '');
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
function select(luvio, params) {
|
|
1514
|
+
return select$1();
|
|
1515
|
+
}
|
|
1516
|
+
function keyBuilder$1(luvio, params) {
|
|
1517
|
+
return keyPrefix + '::IdpExtractedDataRepresentation:(' + '[' + params.body.files.map(element => 'files.fileId:' + element.fileId).join(',') + ']' + '::' + 'mlModel:' + params.body.mlModel + '::' + 'schemaConfig:' + params.body.schemaConfig + ')';
|
|
1518
|
+
}
|
|
1519
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
1520
|
+
getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$1(luvio, resourceParams));
|
|
1521
|
+
}
|
|
1522
|
+
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
1523
|
+
const { body } = response;
|
|
1524
|
+
const key = keyBuilder$1(luvio, resourceParams);
|
|
1525
|
+
luvio.storeIngest(key, ingest, body);
|
|
1526
|
+
const snapshot = luvio.storeLookup({
|
|
1527
|
+
recordId: key,
|
|
1528
|
+
node: select(),
|
|
1529
|
+
variables: {},
|
|
1530
|
+
}, snapshotRefresh);
|
|
1531
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1532
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1533
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
deepFreeze(snapshot.data);
|
|
1537
|
+
return snapshot;
|
|
1538
|
+
}
|
|
1539
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
1540
|
+
const key = keyBuilder$1(luvio, params);
|
|
1541
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1542
|
+
const storeMetadataParams = {
|
|
1543
|
+
ttl: TTL,
|
|
1544
|
+
namespace: keyPrefix,
|
|
1545
|
+
version: VERSION,
|
|
1546
|
+
representationName: RepresentationType
|
|
1547
|
+
};
|
|
1548
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
1549
|
+
return errorSnapshot;
|
|
1550
|
+
}
|
|
1551
|
+
function createResourceRequest(config) {
|
|
1552
|
+
const headers = {};
|
|
1553
|
+
return {
|
|
1554
|
+
baseUri: '/services/data/v64.0',
|
|
1555
|
+
basePath: '/ssot/document-processing/actions/extract-data',
|
|
1556
|
+
method: 'post',
|
|
1557
|
+
body: config.body,
|
|
1558
|
+
urlParams: {},
|
|
1559
|
+
queryParams: {},
|
|
1560
|
+
headers,
|
|
1561
|
+
priority: 'normal',
|
|
1562
|
+
};
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
const adapterName = 'extractDataUsingIdpConfiguration';
|
|
1566
|
+
const extractDataUsingIdpConfiguration_ConfigPropertyMetadata = [
|
|
1567
|
+
generateParamConfigMetadata('files', true, 2 /* Body */, 4 /* Unsupported */, true),
|
|
1568
|
+
generateParamConfigMetadata('mlModel', true, 2 /* Body */, 0 /* String */),
|
|
1569
|
+
generateParamConfigMetadata('schemaConfig', true, 2 /* Body */, 0 /* String */),
|
|
1570
|
+
];
|
|
1571
|
+
const extractDataUsingIdpConfiguration_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, extractDataUsingIdpConfiguration_ConfigPropertyMetadata);
|
|
1572
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$6(extractDataUsingIdpConfiguration_ConfigPropertyMetadata);
|
|
1573
|
+
function keyBuilder(luvio, config) {
|
|
1574
|
+
const resourceParams = createResourceParams(config);
|
|
1575
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
1576
|
+
}
|
|
1577
|
+
function typeCheckConfig(untrustedConfig) {
|
|
1578
|
+
const config = {};
|
|
1579
|
+
typeCheckConfig$6(untrustedConfig, config, extractDataUsingIdpConfiguration_ConfigPropertyMetadata);
|
|
1580
|
+
const untrustedConfig_files = untrustedConfig.files;
|
|
1581
|
+
if (ArrayIsArray$1(untrustedConfig_files)) {
|
|
1582
|
+
const untrustedConfig_files_array = [];
|
|
1583
|
+
for (let i = 0, arrayLength = untrustedConfig_files.length; i < arrayLength; i++) {
|
|
1584
|
+
const untrustedConfig_files_item = untrustedConfig_files[i];
|
|
1585
|
+
if (untrustedIsObject(untrustedConfig_files_item)) {
|
|
1586
|
+
const untrustedConfig_files_item_object = {};
|
|
1587
|
+
const untrustedConfig_files_item_fileId = untrustedConfig_files_item.fileId;
|
|
1588
|
+
if (typeof untrustedConfig_files_item_fileId === 'string') {
|
|
1589
|
+
untrustedConfig_files_item_object.fileId = untrustedConfig_files_item_fileId;
|
|
1590
|
+
}
|
|
1591
|
+
if (untrustedConfig_files_item_object !== undefined && Object.keys(untrustedConfig_files_item_object).length >= 0) {
|
|
1592
|
+
untrustedConfig_files_array.push(untrustedConfig_files_item_object);
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
config.files = untrustedConfig_files_array;
|
|
1597
|
+
}
|
|
1598
|
+
return config;
|
|
1599
|
+
}
|
|
1600
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
1601
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1602
|
+
return null;
|
|
1603
|
+
}
|
|
1604
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1605
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1606
|
+
}
|
|
1607
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
1608
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1609
|
+
return null;
|
|
1610
|
+
}
|
|
1611
|
+
return config;
|
|
1612
|
+
}
|
|
1613
|
+
function adapterFragment(luvio, config) {
|
|
1614
|
+
createResourceParams(config);
|
|
1615
|
+
return select();
|
|
1616
|
+
}
|
|
1617
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
1618
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
1619
|
+
config,
|
|
1620
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1621
|
+
});
|
|
1622
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1623
|
+
}
|
|
1624
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
1625
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
1626
|
+
config,
|
|
1627
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1628
|
+
});
|
|
1629
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1630
|
+
}
|
|
1631
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
1632
|
+
const resourceParams = createResourceParams(config);
|
|
1633
|
+
const request = createResourceRequest(resourceParams);
|
|
1634
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1635
|
+
.then((response) => {
|
|
1636
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
1637
|
+
const cache = new StoreKeyMap();
|
|
1638
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
1639
|
+
return cache;
|
|
1640
|
+
});
|
|
1641
|
+
}, (response) => {
|
|
1642
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
1643
|
+
});
|
|
1644
|
+
}
|
|
1645
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
1646
|
+
return buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext, buildNetworkSnapshot, 'get', false);
|
|
1647
|
+
}
|
|
1648
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
1649
|
+
const { luvio, config } = context;
|
|
1650
|
+
const selector = {
|
|
1651
|
+
recordId: keyBuilder(luvio, config),
|
|
1652
|
+
node: adapterFragment(luvio, config),
|
|
1653
|
+
variables: {},
|
|
1654
|
+
};
|
|
1655
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
1656
|
+
config,
|
|
1657
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1658
|
+
});
|
|
1659
|
+
return cacheSnapshot;
|
|
1660
|
+
}
|
|
1661
|
+
const extractDataUsingIdpConfigurationAdapterFactory = (luvio) => function documentProcessing__extractDataUsingIdpConfiguration(untrustedConfig, requestContext) {
|
|
1662
|
+
const config = validateAdapterConfig(untrustedConfig, extractDataUsingIdpConfiguration_ConfigPropertyNames);
|
|
1663
|
+
// Invalid or incomplete config
|
|
1664
|
+
if (config === null) {
|
|
1665
|
+
return null;
|
|
1666
|
+
}
|
|
1667
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1668
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
1669
|
+
};
|
|
1670
|
+
|
|
1671
|
+
export { createIdpConfigurationAdapterFactory, deleteIdpConfigurationAdapterFactory, extractDataUsingIdpConfigurationAdapterFactory, getIdpConfigurationAdapterFactory, getIdpConfigurationsAdapterFactory, getIdpGlobalConfigAdapterFactory };
|