@salesforce/lds-adapters-industries-filebased-dataimport 1.247.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-filebased-dataimport.js +1219 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/getFileBasedDataImports.d.ts +26 -0
- package/dist/es/es2018/types/src/generated/adapters/getGetCsvPreview.d.ts +30 -0
- package/dist/es/es2018/types/src/generated/adapters/startAdvanceImport.d.ts +18 -0
- package/dist/es/es2018/types/src/generated/adapters/startSimpleImport.d.ts +18 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +4 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +7 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectIndustriesFileBasedDataImports.d.ts +12 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectIndustriesFileBasedDataImportsPreviewByFileBasedImportId.d.ts +20 -0
- package/dist/es/es2018/types/src/generated/resources/postConnectIndustriesFileBasedDataImportsAdvanceImport.d.ts +15 -0
- package/dist/es/es2018/types/src/generated/resources/postConnectIndustriesFileBasedDataImportsSimpleImport.d.ts +15 -0
- package/dist/es/es2018/types/src/generated/types/CsvPreviewOutputRepresentation.d.ts +32 -0
- package/dist/es/es2018/types/src/generated/types/FieldConfigurationInputRepresentation.d.ts +40 -0
- package/dist/es/es2018/types/src/generated/types/FileBasedDataImportByUserResultRepresentation.d.ts +33 -0
- package/dist/es/es2018/types/src/generated/types/FileBasedDataImportRepresentation.d.ts +55 -0
- package/dist/es/es2018/types/src/generated/types/FileImportInputRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/FileImportOutputRepresentation.d.ts +41 -0
- package/dist/es/es2018/types/src/generated/types/ImportOperationInputRepresentation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/ImportOptionsInputRepresentation.d.ts +39 -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 +1269 -0
- package/src/raml/api.raml +252 -0
- package/src/raml/luvio.raml +50 -0
|
@@ -0,0 +1,1219 @@
|
|
|
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$2, StoreKeyMap, createResourceParams as createResourceParams$4, typeCheckConfig as typeCheckConfig$4 } 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 = 'fileBased-dataimport';
|
|
73
|
+
|
|
74
|
+
const { isArray: ArrayIsArray } = Array;
|
|
75
|
+
function equalsArray(a, b, equalsItem) {
|
|
76
|
+
const aLength = a.length;
|
|
77
|
+
const bLength = b.length;
|
|
78
|
+
if (aLength !== bLength) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
for (let i = 0; i < aLength; i++) {
|
|
82
|
+
if (equalsItem(a[i], b[i]) === false) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
function createLink(ref) {
|
|
89
|
+
return {
|
|
90
|
+
__ref: serializeStructuredKey(ref),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const VERSION$3 = "603264989f33f5176bf362db81791a82";
|
|
95
|
+
function validate$6(obj, path = 'FileBasedDataImportRepresentation') {
|
|
96
|
+
const v_error = (() => {
|
|
97
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
98
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
99
|
+
}
|
|
100
|
+
if (obj.failedRecordsCount !== undefined) {
|
|
101
|
+
const obj_failedRecordsCount = obj.failedRecordsCount;
|
|
102
|
+
const path_failedRecordsCount = path + '.failedRecordsCount';
|
|
103
|
+
if (typeof obj_failedRecordsCount !== 'number' || (typeof obj_failedRecordsCount === 'number' && Math.floor(obj_failedRecordsCount) !== obj_failedRecordsCount)) {
|
|
104
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_failedRecordsCount + '" (at "' + path_failedRecordsCount + '")');
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (obj.fileBasedImportType !== undefined) {
|
|
108
|
+
const obj_fileBasedImportType = obj.fileBasedImportType;
|
|
109
|
+
const path_fileBasedImportType = path + '.fileBasedImportType';
|
|
110
|
+
if (typeof obj_fileBasedImportType !== 'string') {
|
|
111
|
+
return new TypeError('Expected "string" but received "' + typeof obj_fileBasedImportType + '" (at "' + path_fileBasedImportType + '")');
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (obj.importOperationType !== undefined) {
|
|
115
|
+
const obj_importOperationType = obj.importOperationType;
|
|
116
|
+
const path_importOperationType = path + '.importOperationType';
|
|
117
|
+
if (typeof obj_importOperationType !== 'string') {
|
|
118
|
+
return new TypeError('Expected "string" but received "' + typeof obj_importOperationType + '" (at "' + path_importOperationType + '")');
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (obj.jobIdentifier !== undefined) {
|
|
122
|
+
const obj_jobIdentifier = obj.jobIdentifier;
|
|
123
|
+
const path_jobIdentifier = path + '.jobIdentifier';
|
|
124
|
+
if (typeof obj_jobIdentifier !== 'string') {
|
|
125
|
+
return new TypeError('Expected "string" but received "' + typeof obj_jobIdentifier + '" (at "' + path_jobIdentifier + '")');
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
const obj_sourceContentDocument = obj.sourceContentDocument;
|
|
129
|
+
const path_sourceContentDocument = path + '.sourceContentDocument';
|
|
130
|
+
if (typeof obj_sourceContentDocument !== 'string') {
|
|
131
|
+
return new TypeError('Expected "string" but received "' + typeof obj_sourceContentDocument + '" (at "' + path_sourceContentDocument + '")');
|
|
132
|
+
}
|
|
133
|
+
const obj_status = obj.status;
|
|
134
|
+
const path_status = path + '.status';
|
|
135
|
+
if (typeof obj_status !== 'string') {
|
|
136
|
+
return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
|
|
137
|
+
}
|
|
138
|
+
if (obj.statusReason !== undefined) {
|
|
139
|
+
const obj_statusReason = obj.statusReason;
|
|
140
|
+
const path_statusReason = path + '.statusReason';
|
|
141
|
+
if (typeof obj_statusReason !== 'string') {
|
|
142
|
+
return new TypeError('Expected "string" but received "' + typeof obj_statusReason + '" (at "' + path_statusReason + '")');
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (obj.successRecordsCount !== undefined) {
|
|
146
|
+
const obj_successRecordsCount = obj.successRecordsCount;
|
|
147
|
+
const path_successRecordsCount = path + '.successRecordsCount';
|
|
148
|
+
if (typeof obj_successRecordsCount !== 'number' || (typeof obj_successRecordsCount === 'number' && Math.floor(obj_successRecordsCount) !== obj_successRecordsCount)) {
|
|
149
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_successRecordsCount + '" (at "' + path_successRecordsCount + '")');
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (obj.targetContext !== undefined) {
|
|
153
|
+
const obj_targetContext = obj.targetContext;
|
|
154
|
+
const path_targetContext = path + '.targetContext';
|
|
155
|
+
if (typeof obj_targetContext !== 'string') {
|
|
156
|
+
return new TypeError('Expected "string" but received "' + typeof obj_targetContext + '" (at "' + path_targetContext + '")');
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (obj.unprocessedRecordsCount !== undefined) {
|
|
160
|
+
const obj_unprocessedRecordsCount = obj.unprocessedRecordsCount;
|
|
161
|
+
const path_unprocessedRecordsCount = path + '.unprocessedRecordsCount';
|
|
162
|
+
if (typeof obj_unprocessedRecordsCount !== 'number' || (typeof obj_unprocessedRecordsCount === 'number' && Math.floor(obj_unprocessedRecordsCount) !== obj_unprocessedRecordsCount)) {
|
|
163
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_unprocessedRecordsCount + '" (at "' + path_unprocessedRecordsCount + '")');
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
})();
|
|
167
|
+
return v_error === undefined ? null : v_error;
|
|
168
|
+
}
|
|
169
|
+
const select$7 = function FileBasedDataImportRepresentationSelect() {
|
|
170
|
+
return {
|
|
171
|
+
kind: 'Fragment',
|
|
172
|
+
version: VERSION$3,
|
|
173
|
+
private: [],
|
|
174
|
+
selections: [
|
|
175
|
+
{
|
|
176
|
+
name: 'failedRecordsCount',
|
|
177
|
+
kind: 'Scalar',
|
|
178
|
+
required: false
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
name: 'fileBasedImportType',
|
|
182
|
+
kind: 'Scalar',
|
|
183
|
+
required: false
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
name: 'importOperationType',
|
|
187
|
+
kind: 'Scalar',
|
|
188
|
+
required: false
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
name: 'jobIdentifier',
|
|
192
|
+
kind: 'Scalar',
|
|
193
|
+
required: false
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: 'sourceContentDocument',
|
|
197
|
+
kind: 'Scalar'
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
name: 'status',
|
|
201
|
+
kind: 'Scalar'
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: 'statusReason',
|
|
205
|
+
kind: 'Scalar',
|
|
206
|
+
required: false
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
name: 'successRecordsCount',
|
|
210
|
+
kind: 'Scalar',
|
|
211
|
+
required: false
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
name: 'targetContext',
|
|
215
|
+
kind: 'Scalar',
|
|
216
|
+
required: false
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
name: 'unprocessedRecordsCount',
|
|
220
|
+
kind: 'Scalar',
|
|
221
|
+
required: false
|
|
222
|
+
}
|
|
223
|
+
]
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
function equals$3(existing, incoming) {
|
|
227
|
+
const existing_failedRecordsCount = existing.failedRecordsCount;
|
|
228
|
+
const incoming_failedRecordsCount = incoming.failedRecordsCount;
|
|
229
|
+
// if at least one of these optionals is defined
|
|
230
|
+
if (existing_failedRecordsCount !== undefined || incoming_failedRecordsCount !== undefined) {
|
|
231
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
232
|
+
// not equal
|
|
233
|
+
if (existing_failedRecordsCount === undefined || incoming_failedRecordsCount === undefined) {
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
if (!(existing_failedRecordsCount === incoming_failedRecordsCount)) {
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
const existing_successRecordsCount = existing.successRecordsCount;
|
|
241
|
+
const incoming_successRecordsCount = incoming.successRecordsCount;
|
|
242
|
+
// if at least one of these optionals is defined
|
|
243
|
+
if (existing_successRecordsCount !== undefined || incoming_successRecordsCount !== undefined) {
|
|
244
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
245
|
+
// not equal
|
|
246
|
+
if (existing_successRecordsCount === undefined || incoming_successRecordsCount === undefined) {
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
if (!(existing_successRecordsCount === incoming_successRecordsCount)) {
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
const existing_unprocessedRecordsCount = existing.unprocessedRecordsCount;
|
|
254
|
+
const incoming_unprocessedRecordsCount = incoming.unprocessedRecordsCount;
|
|
255
|
+
// if at least one of these optionals is defined
|
|
256
|
+
if (existing_unprocessedRecordsCount !== undefined || incoming_unprocessedRecordsCount !== undefined) {
|
|
257
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
258
|
+
// not equal
|
|
259
|
+
if (existing_unprocessedRecordsCount === undefined || incoming_unprocessedRecordsCount === undefined) {
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
262
|
+
if (!(existing_unprocessedRecordsCount === incoming_unprocessedRecordsCount)) {
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
const existing_fileBasedImportType = existing.fileBasedImportType;
|
|
267
|
+
const incoming_fileBasedImportType = incoming.fileBasedImportType;
|
|
268
|
+
// if at least one of these optionals is defined
|
|
269
|
+
if (existing_fileBasedImportType !== undefined || incoming_fileBasedImportType !== undefined) {
|
|
270
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
271
|
+
// not equal
|
|
272
|
+
if (existing_fileBasedImportType === undefined || incoming_fileBasedImportType === undefined) {
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
if (!(existing_fileBasedImportType === incoming_fileBasedImportType)) {
|
|
276
|
+
return false;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
const existing_importOperationType = existing.importOperationType;
|
|
280
|
+
const incoming_importOperationType = incoming.importOperationType;
|
|
281
|
+
// if at least one of these optionals is defined
|
|
282
|
+
if (existing_importOperationType !== undefined || incoming_importOperationType !== undefined) {
|
|
283
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
284
|
+
// not equal
|
|
285
|
+
if (existing_importOperationType === undefined || incoming_importOperationType === undefined) {
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
if (!(existing_importOperationType === incoming_importOperationType)) {
|
|
289
|
+
return false;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
const existing_jobIdentifier = existing.jobIdentifier;
|
|
293
|
+
const incoming_jobIdentifier = incoming.jobIdentifier;
|
|
294
|
+
// if at least one of these optionals is defined
|
|
295
|
+
if (existing_jobIdentifier !== undefined || incoming_jobIdentifier !== undefined) {
|
|
296
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
297
|
+
// not equal
|
|
298
|
+
if (existing_jobIdentifier === undefined || incoming_jobIdentifier === undefined) {
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
if (!(existing_jobIdentifier === incoming_jobIdentifier)) {
|
|
302
|
+
return false;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
const existing_sourceContentDocument = existing.sourceContentDocument;
|
|
306
|
+
const incoming_sourceContentDocument = incoming.sourceContentDocument;
|
|
307
|
+
if (!(existing_sourceContentDocument === incoming_sourceContentDocument)) {
|
|
308
|
+
return false;
|
|
309
|
+
}
|
|
310
|
+
const existing_status = existing.status;
|
|
311
|
+
const incoming_status = incoming.status;
|
|
312
|
+
if (!(existing_status === incoming_status)) {
|
|
313
|
+
return false;
|
|
314
|
+
}
|
|
315
|
+
const existing_statusReason = existing.statusReason;
|
|
316
|
+
const incoming_statusReason = incoming.statusReason;
|
|
317
|
+
// if at least one of these optionals is defined
|
|
318
|
+
if (existing_statusReason !== undefined || incoming_statusReason !== undefined) {
|
|
319
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
320
|
+
// not equal
|
|
321
|
+
if (existing_statusReason === undefined || incoming_statusReason === undefined) {
|
|
322
|
+
return false;
|
|
323
|
+
}
|
|
324
|
+
if (!(existing_statusReason === incoming_statusReason)) {
|
|
325
|
+
return false;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
const existing_targetContext = existing.targetContext;
|
|
329
|
+
const incoming_targetContext = incoming.targetContext;
|
|
330
|
+
// if at least one of these optionals is defined
|
|
331
|
+
if (existing_targetContext !== undefined || incoming_targetContext !== undefined) {
|
|
332
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
333
|
+
// not equal
|
|
334
|
+
if (existing_targetContext === undefined || incoming_targetContext === undefined) {
|
|
335
|
+
return false;
|
|
336
|
+
}
|
|
337
|
+
if (!(existing_targetContext === incoming_targetContext)) {
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
return true;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
const TTL$2 = 0;
|
|
345
|
+
const VERSION$2 = "5991ee5ca7b2257295bf92976098c9d5";
|
|
346
|
+
function validate$5(obj, path = 'FileBasedDataImportByUserResultRepresentation') {
|
|
347
|
+
const v_error = (() => {
|
|
348
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
349
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
350
|
+
}
|
|
351
|
+
const obj_fileBasedDataImportRepresentations = obj.fileBasedDataImportRepresentations;
|
|
352
|
+
const path_fileBasedDataImportRepresentations = path + '.fileBasedDataImportRepresentations';
|
|
353
|
+
if (!ArrayIsArray(obj_fileBasedDataImportRepresentations)) {
|
|
354
|
+
return new TypeError('Expected "array" but received "' + typeof obj_fileBasedDataImportRepresentations + '" (at "' + path_fileBasedDataImportRepresentations + '")');
|
|
355
|
+
}
|
|
356
|
+
for (let i = 0; i < obj_fileBasedDataImportRepresentations.length; i++) {
|
|
357
|
+
const obj_fileBasedDataImportRepresentations_item = obj_fileBasedDataImportRepresentations[i];
|
|
358
|
+
const path_fileBasedDataImportRepresentations_item = path_fileBasedDataImportRepresentations + '[' + i + ']';
|
|
359
|
+
const referencepath_fileBasedDataImportRepresentations_itemValidationError = validate$6(obj_fileBasedDataImportRepresentations_item, path_fileBasedDataImportRepresentations_item);
|
|
360
|
+
if (referencepath_fileBasedDataImportRepresentations_itemValidationError !== null) {
|
|
361
|
+
let message = 'Object doesn\'t match FileBasedDataImportRepresentation (at "' + path_fileBasedDataImportRepresentations_item + '")\n';
|
|
362
|
+
message += referencepath_fileBasedDataImportRepresentations_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
363
|
+
return new TypeError(message);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
const obj_isAdminUser = obj.isAdminUser;
|
|
367
|
+
const path_isAdminUser = path + '.isAdminUser';
|
|
368
|
+
if (typeof obj_isAdminUser !== 'boolean') {
|
|
369
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isAdminUser + '" (at "' + path_isAdminUser + '")');
|
|
370
|
+
}
|
|
371
|
+
})();
|
|
372
|
+
return v_error === undefined ? null : v_error;
|
|
373
|
+
}
|
|
374
|
+
const RepresentationType$2 = 'FileBasedDataImportByUserResultRepresentation';
|
|
375
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
376
|
+
return input;
|
|
377
|
+
}
|
|
378
|
+
const select$6 = function FileBasedDataImportByUserResultRepresentationSelect() {
|
|
379
|
+
const { selections: FileBasedDataImportRepresentation__selections, opaque: FileBasedDataImportRepresentation__opaque, } = select$7();
|
|
380
|
+
return {
|
|
381
|
+
kind: 'Fragment',
|
|
382
|
+
version: VERSION$2,
|
|
383
|
+
private: [],
|
|
384
|
+
selections: [
|
|
385
|
+
{
|
|
386
|
+
name: 'fileBasedDataImportRepresentations',
|
|
387
|
+
kind: 'Object',
|
|
388
|
+
plural: true,
|
|
389
|
+
selections: FileBasedDataImportRepresentation__selections
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
name: 'isAdminUser',
|
|
393
|
+
kind: 'Scalar'
|
|
394
|
+
}
|
|
395
|
+
]
|
|
396
|
+
};
|
|
397
|
+
};
|
|
398
|
+
function equals$2(existing, incoming) {
|
|
399
|
+
const existing_isAdminUser = existing.isAdminUser;
|
|
400
|
+
const incoming_isAdminUser = incoming.isAdminUser;
|
|
401
|
+
if (!(existing_isAdminUser === incoming_isAdminUser)) {
|
|
402
|
+
return false;
|
|
403
|
+
}
|
|
404
|
+
const existing_fileBasedDataImportRepresentations = existing.fileBasedDataImportRepresentations;
|
|
405
|
+
const incoming_fileBasedDataImportRepresentations = incoming.fileBasedDataImportRepresentations;
|
|
406
|
+
const equals_fileBasedDataImportRepresentations_items = equalsArray(existing_fileBasedDataImportRepresentations, incoming_fileBasedDataImportRepresentations, (existing_fileBasedDataImportRepresentations_item, incoming_fileBasedDataImportRepresentations_item) => {
|
|
407
|
+
if (!(equals$3(existing_fileBasedDataImportRepresentations_item, incoming_fileBasedDataImportRepresentations_item))) {
|
|
408
|
+
return false;
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
if (equals_fileBasedDataImportRepresentations_items === false) {
|
|
412
|
+
return false;
|
|
413
|
+
}
|
|
414
|
+
return true;
|
|
415
|
+
}
|
|
416
|
+
const ingest$2 = function FileBasedDataImportByUserResultRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
417
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
418
|
+
const validateError = validate$5(input);
|
|
419
|
+
if (validateError !== null) {
|
|
420
|
+
throw validateError;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
const key = path.fullPath;
|
|
424
|
+
const ttlToUse = TTL$2;
|
|
425
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "fileBased-dataimport", VERSION$2, RepresentationType$2, equals$2);
|
|
426
|
+
return createLink(key);
|
|
427
|
+
};
|
|
428
|
+
function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
|
|
429
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
430
|
+
const rootKey = fullPathFactory();
|
|
431
|
+
rootKeySet.set(rootKey, {
|
|
432
|
+
namespace: keyPrefix,
|
|
433
|
+
representationName: RepresentationType$2,
|
|
434
|
+
mergeable: false
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
function select$5(luvio, params) {
|
|
439
|
+
return select$6();
|
|
440
|
+
}
|
|
441
|
+
function keyBuilder$4(luvio, params) {
|
|
442
|
+
return keyPrefix + '::FileBasedDataImportByUserResultRepresentation:(' + ')';
|
|
443
|
+
}
|
|
444
|
+
function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
|
|
445
|
+
getTypeCacheKeys$2(storeKeyMap, luvio, response, () => keyBuilder$4());
|
|
446
|
+
}
|
|
447
|
+
function ingestSuccess$3(luvio, resourceParams, response, snapshotRefresh) {
|
|
448
|
+
const { body } = response;
|
|
449
|
+
const key = keyBuilder$4();
|
|
450
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
451
|
+
const snapshot = luvio.storeLookup({
|
|
452
|
+
recordId: key,
|
|
453
|
+
node: select$5(),
|
|
454
|
+
variables: {},
|
|
455
|
+
}, snapshotRefresh);
|
|
456
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
457
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
458
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
deepFreeze(snapshot.data);
|
|
462
|
+
return snapshot;
|
|
463
|
+
}
|
|
464
|
+
function ingestError$1(luvio, params, error, snapshotRefresh) {
|
|
465
|
+
const key = keyBuilder$4();
|
|
466
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
467
|
+
luvio.storeIngestError(key, errorSnapshot);
|
|
468
|
+
return errorSnapshot;
|
|
469
|
+
}
|
|
470
|
+
function createResourceRequest$3(config) {
|
|
471
|
+
const headers = {};
|
|
472
|
+
return {
|
|
473
|
+
baseUri: '/services/data/v60.0',
|
|
474
|
+
basePath: '/connect/industries/fileBasedDataImports',
|
|
475
|
+
method: 'get',
|
|
476
|
+
body: null,
|
|
477
|
+
urlParams: {},
|
|
478
|
+
queryParams: {},
|
|
479
|
+
headers,
|
|
480
|
+
priority: 'normal',
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
const adapterName$3 = 'getFileBasedDataImports';
|
|
485
|
+
const getFileBasedDataImports_ConfigPropertyMetadata = [];
|
|
486
|
+
const getFileBasedDataImports_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, getFileBasedDataImports_ConfigPropertyMetadata);
|
|
487
|
+
const createResourceParams$3 = /*#__PURE__*/ createResourceParams$4(getFileBasedDataImports_ConfigPropertyMetadata);
|
|
488
|
+
function keyBuilder$3(luvio, config) {
|
|
489
|
+
createResourceParams$3(config);
|
|
490
|
+
return keyBuilder$4();
|
|
491
|
+
}
|
|
492
|
+
function typeCheckConfig$3(untrustedConfig) {
|
|
493
|
+
const config = {};
|
|
494
|
+
return config;
|
|
495
|
+
}
|
|
496
|
+
function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
|
|
497
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
498
|
+
return null;
|
|
499
|
+
}
|
|
500
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
501
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
502
|
+
}
|
|
503
|
+
const config = typeCheckConfig$3();
|
|
504
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
505
|
+
return null;
|
|
506
|
+
}
|
|
507
|
+
return config;
|
|
508
|
+
}
|
|
509
|
+
function adapterFragment$1(luvio, config) {
|
|
510
|
+
createResourceParams$3(config);
|
|
511
|
+
return select$5();
|
|
512
|
+
}
|
|
513
|
+
function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
|
|
514
|
+
const snapshot = ingestSuccess$3(luvio, resourceParams, response, {
|
|
515
|
+
config,
|
|
516
|
+
resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
|
|
517
|
+
});
|
|
518
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
519
|
+
}
|
|
520
|
+
function onFetchResponseError$1(luvio, config, resourceParams, response) {
|
|
521
|
+
const snapshot = ingestError$1(luvio, resourceParams, response, {
|
|
522
|
+
config,
|
|
523
|
+
resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
|
|
524
|
+
});
|
|
525
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
526
|
+
}
|
|
527
|
+
function buildNetworkSnapshot$3(luvio, config, options) {
|
|
528
|
+
const resourceParams = createResourceParams$3(config);
|
|
529
|
+
const request = createResourceRequest$3();
|
|
530
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
531
|
+
.then((response) => {
|
|
532
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
|
|
533
|
+
const cache = new StoreKeyMap();
|
|
534
|
+
getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
|
|
535
|
+
return cache;
|
|
536
|
+
});
|
|
537
|
+
}, (response) => {
|
|
538
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
|
|
542
|
+
return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$3, undefined, false);
|
|
543
|
+
}
|
|
544
|
+
function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
|
|
545
|
+
const { luvio, config } = context;
|
|
546
|
+
const selector = {
|
|
547
|
+
recordId: keyBuilder$3(luvio, config),
|
|
548
|
+
node: adapterFragment$1(luvio, config),
|
|
549
|
+
variables: {},
|
|
550
|
+
};
|
|
551
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
552
|
+
config,
|
|
553
|
+
resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
|
|
554
|
+
});
|
|
555
|
+
return cacheSnapshot;
|
|
556
|
+
}
|
|
557
|
+
const getFileBasedDataImportsAdapterFactory = (luvio) => function fileBasedDataimport__getFileBasedDataImports(untrustedConfig, requestContext) {
|
|
558
|
+
const config = validateAdapterConfig$3(untrustedConfig, getFileBasedDataImports_ConfigPropertyNames);
|
|
559
|
+
// Invalid or incomplete config
|
|
560
|
+
if (config === null) {
|
|
561
|
+
return null;
|
|
562
|
+
}
|
|
563
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
564
|
+
buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
|
|
565
|
+
};
|
|
566
|
+
|
|
567
|
+
function validate$4(obj, path = 'FieldConfigurationInputRepresentation') {
|
|
568
|
+
const v_error = (() => {
|
|
569
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
570
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
571
|
+
}
|
|
572
|
+
if (obj.isLookupRelationship !== undefined) {
|
|
573
|
+
const obj_isLookupRelationship = obj.isLookupRelationship;
|
|
574
|
+
const path_isLookupRelationship = path + '.isLookupRelationship';
|
|
575
|
+
if (typeof obj_isLookupRelationship !== 'boolean') {
|
|
576
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isLookupRelationship + '" (at "' + path_isLookupRelationship + '")');
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
if (obj.relatedFieldName !== undefined) {
|
|
580
|
+
const obj_relatedFieldName = obj.relatedFieldName;
|
|
581
|
+
const path_relatedFieldName = path + '.relatedFieldName';
|
|
582
|
+
if (typeof obj_relatedFieldName !== 'string') {
|
|
583
|
+
return new TypeError('Expected "string" but received "' + typeof obj_relatedFieldName + '" (at "' + path_relatedFieldName + '")');
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
if (obj.relatedObjectName !== undefined) {
|
|
587
|
+
const obj_relatedObjectName = obj.relatedObjectName;
|
|
588
|
+
const path_relatedObjectName = path + '.relatedObjectName';
|
|
589
|
+
if (typeof obj_relatedObjectName !== 'string') {
|
|
590
|
+
return new TypeError('Expected "string" but received "' + typeof obj_relatedObjectName + '" (at "' + path_relatedObjectName + '")');
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
if (obj.sourceColumnName !== undefined) {
|
|
594
|
+
const obj_sourceColumnName = obj.sourceColumnName;
|
|
595
|
+
const path_sourceColumnName = path + '.sourceColumnName';
|
|
596
|
+
if (typeof obj_sourceColumnName !== 'string') {
|
|
597
|
+
return new TypeError('Expected "string" but received "' + typeof obj_sourceColumnName + '" (at "' + path_sourceColumnName + '")');
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
if (obj.targetFieldName !== undefined) {
|
|
601
|
+
const obj_targetFieldName = obj.targetFieldName;
|
|
602
|
+
const path_targetFieldName = path + '.targetFieldName';
|
|
603
|
+
if (typeof obj_targetFieldName !== 'string') {
|
|
604
|
+
return new TypeError('Expected "string" but received "' + typeof obj_targetFieldName + '" (at "' + path_targetFieldName + '")');
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
})();
|
|
608
|
+
return v_error === undefined ? null : v_error;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
function validate$3(obj, path = 'ImportOperationInputRepresentation') {
|
|
612
|
+
const v_error = (() => {
|
|
613
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
614
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
615
|
+
}
|
|
616
|
+
if (obj.operationType !== undefined) {
|
|
617
|
+
const obj_operationType = obj.operationType;
|
|
618
|
+
const path_operationType = path + '.operationType';
|
|
619
|
+
if (typeof obj_operationType !== 'string') {
|
|
620
|
+
return new TypeError('Expected "string" but received "' + typeof obj_operationType + '" (at "' + path_operationType + '")');
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
if (obj.uniqueFields !== undefined) {
|
|
624
|
+
const obj_uniqueFields = obj.uniqueFields;
|
|
625
|
+
const path_uniqueFields = path + '.uniqueFields';
|
|
626
|
+
if (!ArrayIsArray(obj_uniqueFields)) {
|
|
627
|
+
return new TypeError('Expected "array" but received "' + typeof obj_uniqueFields + '" (at "' + path_uniqueFields + '")');
|
|
628
|
+
}
|
|
629
|
+
for (let i = 0; i < obj_uniqueFields.length; i++) {
|
|
630
|
+
const obj_uniqueFields_item = obj_uniqueFields[i];
|
|
631
|
+
const path_uniqueFields_item = path_uniqueFields + '[' + i + ']';
|
|
632
|
+
if (typeof obj_uniqueFields_item !== 'string') {
|
|
633
|
+
return new TypeError('Expected "string" but received "' + typeof obj_uniqueFields_item + '" (at "' + path_uniqueFields_item + '")');
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
})();
|
|
638
|
+
return v_error === undefined ? null : v_error;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
function validate$2(obj, path = 'ImportOptionsInputRepresentation') {
|
|
642
|
+
const v_error = (() => {
|
|
643
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
644
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
645
|
+
}
|
|
646
|
+
if (obj.delimiter !== undefined) {
|
|
647
|
+
const obj_delimiter = obj.delimiter;
|
|
648
|
+
const path_delimiter = path + '.delimiter';
|
|
649
|
+
if (typeof obj_delimiter !== 'string') {
|
|
650
|
+
return new TypeError('Expected "string" but received "' + typeof obj_delimiter + '" (at "' + path_delimiter + '")');
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
if (obj.eol !== undefined) {
|
|
654
|
+
const obj_eol = obj.eol;
|
|
655
|
+
const path_eol = path + '.eol';
|
|
656
|
+
if (typeof obj_eol !== 'string') {
|
|
657
|
+
return new TypeError('Expected "string" but received "' + typeof obj_eol + '" (at "' + path_eol + '")');
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
if (obj.fieldConfigurations !== undefined) {
|
|
661
|
+
const obj_fieldConfigurations = obj.fieldConfigurations;
|
|
662
|
+
const path_fieldConfigurations = path + '.fieldConfigurations';
|
|
663
|
+
if (!ArrayIsArray(obj_fieldConfigurations)) {
|
|
664
|
+
return new TypeError('Expected "array" but received "' + typeof obj_fieldConfigurations + '" (at "' + path_fieldConfigurations + '")');
|
|
665
|
+
}
|
|
666
|
+
for (let i = 0; i < obj_fieldConfigurations.length; i++) {
|
|
667
|
+
const obj_fieldConfigurations_item = obj_fieldConfigurations[i];
|
|
668
|
+
const path_fieldConfigurations_item = path_fieldConfigurations + '[' + i + ']';
|
|
669
|
+
const referencepath_fieldConfigurations_itemValidationError = validate$4(obj_fieldConfigurations_item, path_fieldConfigurations_item);
|
|
670
|
+
if (referencepath_fieldConfigurations_itemValidationError !== null) {
|
|
671
|
+
let message = 'Object doesn\'t match FieldConfigurationInputRepresentation (at "' + path_fieldConfigurations_item + '")\n';
|
|
672
|
+
message += referencepath_fieldConfigurations_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
673
|
+
return new TypeError(message);
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
if (obj.operation !== undefined) {
|
|
678
|
+
const obj_operation = obj.operation;
|
|
679
|
+
const path_operation = path + '.operation';
|
|
680
|
+
const referencepath_operationValidationError = validate$3(obj_operation, path_operation);
|
|
681
|
+
if (referencepath_operationValidationError !== null) {
|
|
682
|
+
let message = 'Object doesn\'t match ImportOperationInputRepresentation (at "' + path_operation + '")\n';
|
|
683
|
+
message += referencepath_operationValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
684
|
+
return new TypeError(message);
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
})();
|
|
688
|
+
return v_error === undefined ? null : v_error;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
const TTL$1 = 0;
|
|
692
|
+
const VERSION$1 = "0f74d1482de21ff21d94491b9f9b869a";
|
|
693
|
+
function validate$1(obj, path = 'FileImportOutputRepresentation') {
|
|
694
|
+
const v_error = (() => {
|
|
695
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
696
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
697
|
+
}
|
|
698
|
+
const obj_statusCode = obj.statusCode;
|
|
699
|
+
const path_statusCode = path + '.statusCode';
|
|
700
|
+
if (typeof obj_statusCode !== 'string') {
|
|
701
|
+
return new TypeError('Expected "string" but received "' + typeof obj_statusCode + '" (at "' + path_statusCode + '")');
|
|
702
|
+
}
|
|
703
|
+
const obj_statusMessage = obj.statusMessage;
|
|
704
|
+
const path_statusMessage = path + '.statusMessage';
|
|
705
|
+
if (typeof obj_statusMessage !== 'string') {
|
|
706
|
+
return new TypeError('Expected "string" but received "' + typeof obj_statusMessage + '" (at "' + path_statusMessage + '")');
|
|
707
|
+
}
|
|
708
|
+
})();
|
|
709
|
+
return v_error === undefined ? null : v_error;
|
|
710
|
+
}
|
|
711
|
+
const RepresentationType$1 = 'FileImportOutputRepresentation';
|
|
712
|
+
function keyBuilder$2(luvio, config) {
|
|
713
|
+
return keyPrefix + '::' + RepresentationType$1 + ':' + config.statusCode;
|
|
714
|
+
}
|
|
715
|
+
function keyBuilderFromType(luvio, object) {
|
|
716
|
+
const keyParams = {
|
|
717
|
+
statusCode: object.statusCode
|
|
718
|
+
};
|
|
719
|
+
return keyBuilder$2(luvio, keyParams);
|
|
720
|
+
}
|
|
721
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
722
|
+
return input;
|
|
723
|
+
}
|
|
724
|
+
const select$4 = function FileImportOutputRepresentationSelect() {
|
|
725
|
+
return {
|
|
726
|
+
kind: 'Fragment',
|
|
727
|
+
version: VERSION$1,
|
|
728
|
+
private: [],
|
|
729
|
+
selections: [
|
|
730
|
+
{
|
|
731
|
+
name: 'statusCode',
|
|
732
|
+
kind: 'Scalar'
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
name: 'statusMessage',
|
|
736
|
+
kind: 'Scalar'
|
|
737
|
+
}
|
|
738
|
+
]
|
|
739
|
+
};
|
|
740
|
+
};
|
|
741
|
+
function equals$1(existing, incoming) {
|
|
742
|
+
const existing_statusCode = existing.statusCode;
|
|
743
|
+
const incoming_statusCode = incoming.statusCode;
|
|
744
|
+
if (!(existing_statusCode === incoming_statusCode)) {
|
|
745
|
+
return false;
|
|
746
|
+
}
|
|
747
|
+
const existing_statusMessage = existing.statusMessage;
|
|
748
|
+
const incoming_statusMessage = incoming.statusMessage;
|
|
749
|
+
if (!(existing_statusMessage === incoming_statusMessage)) {
|
|
750
|
+
return false;
|
|
751
|
+
}
|
|
752
|
+
return true;
|
|
753
|
+
}
|
|
754
|
+
const ingest$1 = function FileImportOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
755
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
756
|
+
const validateError = validate$1(input);
|
|
757
|
+
if (validateError !== null) {
|
|
758
|
+
throw validateError;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
const key = keyBuilderFromType(luvio, input);
|
|
762
|
+
const ttlToUse = TTL$1;
|
|
763
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "fileBased-dataimport", VERSION$1, RepresentationType$1, equals$1);
|
|
764
|
+
return createLink(key);
|
|
765
|
+
};
|
|
766
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
767
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
768
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
769
|
+
rootKeySet.set(rootKey, {
|
|
770
|
+
namespace: keyPrefix,
|
|
771
|
+
representationName: RepresentationType$1,
|
|
772
|
+
mergeable: false
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
function select$3(luvio, params) {
|
|
777
|
+
return select$4();
|
|
778
|
+
}
|
|
779
|
+
function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
|
|
780
|
+
getTypeCacheKeys$1(storeKeyMap, luvio, response);
|
|
781
|
+
}
|
|
782
|
+
function ingestSuccess$2(luvio, resourceParams, response) {
|
|
783
|
+
const { body } = response;
|
|
784
|
+
const key = keyBuilderFromType(luvio, body);
|
|
785
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
786
|
+
const snapshot = luvio.storeLookup({
|
|
787
|
+
recordId: key,
|
|
788
|
+
node: select$3(),
|
|
789
|
+
variables: {},
|
|
790
|
+
});
|
|
791
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
792
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
793
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
deepFreeze(snapshot.data);
|
|
797
|
+
return snapshot;
|
|
798
|
+
}
|
|
799
|
+
function createResourceRequest$2(config) {
|
|
800
|
+
const headers = {};
|
|
801
|
+
return {
|
|
802
|
+
baseUri: '/services/data/v60.0',
|
|
803
|
+
basePath: '/connect/industries/fileBasedDataImports/advanceImport',
|
|
804
|
+
method: 'post',
|
|
805
|
+
body: config.body,
|
|
806
|
+
urlParams: {},
|
|
807
|
+
queryParams: {},
|
|
808
|
+
headers,
|
|
809
|
+
priority: 'normal',
|
|
810
|
+
};
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
const adapterName$2 = 'startAdvanceImport';
|
|
814
|
+
const startAdvanceImport_ConfigPropertyMetadata = [
|
|
815
|
+
generateParamConfigMetadata('importReferenceId', true, 2 /* Body */, 0 /* String */),
|
|
816
|
+
generateParamConfigMetadata('options', false, 2 /* Body */, 4 /* Unsupported */),
|
|
817
|
+
generateParamConfigMetadata('targetContext', true, 2 /* Body */, 0 /* String */),
|
|
818
|
+
];
|
|
819
|
+
const startAdvanceImport_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, startAdvanceImport_ConfigPropertyMetadata);
|
|
820
|
+
const createResourceParams$2 = /*#__PURE__*/ createResourceParams$4(startAdvanceImport_ConfigPropertyMetadata);
|
|
821
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
822
|
+
const config = {};
|
|
823
|
+
typeCheckConfig$4(untrustedConfig, config, startAdvanceImport_ConfigPropertyMetadata);
|
|
824
|
+
const untrustedConfig_options = untrustedConfig.options;
|
|
825
|
+
const referenceImportOptionsInputRepresentationValidationError = validate$2(untrustedConfig_options);
|
|
826
|
+
if (referenceImportOptionsInputRepresentationValidationError === null) {
|
|
827
|
+
config.options = untrustedConfig_options;
|
|
828
|
+
}
|
|
829
|
+
return config;
|
|
830
|
+
}
|
|
831
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
832
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
833
|
+
return null;
|
|
834
|
+
}
|
|
835
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
836
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
837
|
+
}
|
|
838
|
+
const config = typeCheckConfig$2(untrustedConfig);
|
|
839
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
840
|
+
return null;
|
|
841
|
+
}
|
|
842
|
+
return config;
|
|
843
|
+
}
|
|
844
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
845
|
+
const resourceParams = createResourceParams$2(config);
|
|
846
|
+
const request = createResourceRequest$2(resourceParams);
|
|
847
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
848
|
+
.then((response) => {
|
|
849
|
+
return luvio.handleSuccessResponse(() => {
|
|
850
|
+
const snapshot = ingestSuccess$2(luvio, resourceParams, response);
|
|
851
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
852
|
+
}, () => {
|
|
853
|
+
const cache = new StoreKeyMap();
|
|
854
|
+
getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
|
|
855
|
+
return cache;
|
|
856
|
+
});
|
|
857
|
+
}, (response) => {
|
|
858
|
+
deepFreeze(response);
|
|
859
|
+
throw response;
|
|
860
|
+
});
|
|
861
|
+
}
|
|
862
|
+
const startAdvanceImportAdapterFactory = (luvio) => {
|
|
863
|
+
return function startAdvanceImport(untrustedConfig) {
|
|
864
|
+
const config = validateAdapterConfig$2(untrustedConfig, startAdvanceImport_ConfigPropertyNames);
|
|
865
|
+
// Invalid or incomplete config
|
|
866
|
+
if (config === null) {
|
|
867
|
+
throw new Error('Invalid config for "startAdvanceImport"');
|
|
868
|
+
}
|
|
869
|
+
return buildNetworkSnapshot$2(luvio, config);
|
|
870
|
+
};
|
|
871
|
+
};
|
|
872
|
+
|
|
873
|
+
function select$2(luvio, params) {
|
|
874
|
+
return select$4();
|
|
875
|
+
}
|
|
876
|
+
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
877
|
+
getTypeCacheKeys$1(storeKeyMap, luvio, response);
|
|
878
|
+
}
|
|
879
|
+
function ingestSuccess$1(luvio, resourceParams, response) {
|
|
880
|
+
const { body } = response;
|
|
881
|
+
const key = keyBuilderFromType(luvio, body);
|
|
882
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
883
|
+
const snapshot = luvio.storeLookup({
|
|
884
|
+
recordId: key,
|
|
885
|
+
node: select$2(),
|
|
886
|
+
variables: {},
|
|
887
|
+
});
|
|
888
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
889
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
890
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
deepFreeze(snapshot.data);
|
|
894
|
+
return snapshot;
|
|
895
|
+
}
|
|
896
|
+
function createResourceRequest$1(config) {
|
|
897
|
+
const headers = {};
|
|
898
|
+
return {
|
|
899
|
+
baseUri: '/services/data/v60.0',
|
|
900
|
+
basePath: '/connect/industries/fileBasedDataImports/simpleImport',
|
|
901
|
+
method: 'post',
|
|
902
|
+
body: config.body,
|
|
903
|
+
urlParams: {},
|
|
904
|
+
queryParams: {},
|
|
905
|
+
headers,
|
|
906
|
+
priority: 'normal',
|
|
907
|
+
};
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
const adapterName$1 = 'startSimpleImport';
|
|
911
|
+
const startSimpleImport_ConfigPropertyMetadata = [
|
|
912
|
+
generateParamConfigMetadata('importReferenceId', true, 2 /* Body */, 0 /* String */),
|
|
913
|
+
generateParamConfigMetadata('options', false, 2 /* Body */, 4 /* Unsupported */),
|
|
914
|
+
generateParamConfigMetadata('targetContext', true, 2 /* Body */, 0 /* String */),
|
|
915
|
+
];
|
|
916
|
+
const startSimpleImport_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, startSimpleImport_ConfigPropertyMetadata);
|
|
917
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$4(startSimpleImport_ConfigPropertyMetadata);
|
|
918
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
919
|
+
const config = {};
|
|
920
|
+
typeCheckConfig$4(untrustedConfig, config, startSimpleImport_ConfigPropertyMetadata);
|
|
921
|
+
const untrustedConfig_options = untrustedConfig.options;
|
|
922
|
+
const referenceImportOptionsInputRepresentationValidationError = validate$2(untrustedConfig_options);
|
|
923
|
+
if (referenceImportOptionsInputRepresentationValidationError === null) {
|
|
924
|
+
config.options = untrustedConfig_options;
|
|
925
|
+
}
|
|
926
|
+
return config;
|
|
927
|
+
}
|
|
928
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
929
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
930
|
+
return null;
|
|
931
|
+
}
|
|
932
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
933
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
934
|
+
}
|
|
935
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
936
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
937
|
+
return null;
|
|
938
|
+
}
|
|
939
|
+
return config;
|
|
940
|
+
}
|
|
941
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
942
|
+
const resourceParams = createResourceParams$1(config);
|
|
943
|
+
const request = createResourceRequest$1(resourceParams);
|
|
944
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
945
|
+
.then((response) => {
|
|
946
|
+
return luvio.handleSuccessResponse(() => {
|
|
947
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response);
|
|
948
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
949
|
+
}, () => {
|
|
950
|
+
const cache = new StoreKeyMap();
|
|
951
|
+
getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
|
|
952
|
+
return cache;
|
|
953
|
+
});
|
|
954
|
+
}, (response) => {
|
|
955
|
+
deepFreeze(response);
|
|
956
|
+
throw response;
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
const startSimpleImportAdapterFactory = (luvio) => {
|
|
960
|
+
return function startSimpleImport(untrustedConfig) {
|
|
961
|
+
const config = validateAdapterConfig$1(untrustedConfig, startSimpleImport_ConfigPropertyNames);
|
|
962
|
+
// Invalid or incomplete config
|
|
963
|
+
if (config === null) {
|
|
964
|
+
throw new Error('Invalid config for "startSimpleImport"');
|
|
965
|
+
}
|
|
966
|
+
return buildNetworkSnapshot$1(luvio, config);
|
|
967
|
+
};
|
|
968
|
+
};
|
|
969
|
+
|
|
970
|
+
const TTL = 0;
|
|
971
|
+
const VERSION = "e9c4694d64f76de38156297711f3a09c";
|
|
972
|
+
function validate(obj, path = 'CsvPreviewOutputRepresentation') {
|
|
973
|
+
const v_error = (() => {
|
|
974
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
975
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
976
|
+
}
|
|
977
|
+
const obj_headers = obj.headers;
|
|
978
|
+
const path_headers = path + '.headers';
|
|
979
|
+
if (!ArrayIsArray(obj_headers)) {
|
|
980
|
+
return new TypeError('Expected "array" but received "' + typeof obj_headers + '" (at "' + path_headers + '")');
|
|
981
|
+
}
|
|
982
|
+
for (let i = 0; i < obj_headers.length; i++) {
|
|
983
|
+
const obj_headers_item = obj_headers[i];
|
|
984
|
+
const path_headers_item = path_headers + '[' + i + ']';
|
|
985
|
+
if (typeof obj_headers_item !== 'string') {
|
|
986
|
+
return new TypeError('Expected "string" but received "' + typeof obj_headers_item + '" (at "' + path_headers_item + '")');
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
const obj_rows = obj.rows;
|
|
990
|
+
const path_rows = path + '.rows';
|
|
991
|
+
if (!ArrayIsArray(obj_rows)) {
|
|
992
|
+
return new TypeError('Expected "array" but received "' + typeof obj_rows + '" (at "' + path_rows + '")');
|
|
993
|
+
}
|
|
994
|
+
for (let i = 0; i < obj_rows.length; i++) {
|
|
995
|
+
const obj_rows_item = obj_rows[i];
|
|
996
|
+
const path_rows_item = path_rows + '[' + i + ']';
|
|
997
|
+
if (!ArrayIsArray(obj_rows_item)) {
|
|
998
|
+
return new TypeError('Expected "array" but received "' + typeof obj_rows_item + '" (at "' + path_rows_item + '")');
|
|
999
|
+
}
|
|
1000
|
+
for (let i = 0; i < obj_rows_item.length; i++) {
|
|
1001
|
+
const obj_rows_item_item = obj_rows_item[i];
|
|
1002
|
+
const path_rows_item_item = path_rows_item + '[' + i + ']';
|
|
1003
|
+
if (typeof obj_rows_item_item !== 'string') {
|
|
1004
|
+
return new TypeError('Expected "string" but received "' + typeof obj_rows_item_item + '" (at "' + path_rows_item_item + '")');
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
})();
|
|
1009
|
+
return v_error === undefined ? null : v_error;
|
|
1010
|
+
}
|
|
1011
|
+
const RepresentationType = 'CsvPreviewOutputRepresentation';
|
|
1012
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
1013
|
+
return input;
|
|
1014
|
+
}
|
|
1015
|
+
const select$1 = function CsvPreviewOutputRepresentationSelect() {
|
|
1016
|
+
return {
|
|
1017
|
+
kind: 'Fragment',
|
|
1018
|
+
version: VERSION,
|
|
1019
|
+
private: [],
|
|
1020
|
+
selections: [
|
|
1021
|
+
{
|
|
1022
|
+
name: 'headers',
|
|
1023
|
+
kind: 'Scalar',
|
|
1024
|
+
plural: true
|
|
1025
|
+
},
|
|
1026
|
+
{
|
|
1027
|
+
name: 'rows',
|
|
1028
|
+
kind: 'Scalar',
|
|
1029
|
+
plural: true
|
|
1030
|
+
}
|
|
1031
|
+
]
|
|
1032
|
+
};
|
|
1033
|
+
};
|
|
1034
|
+
function equals(existing, incoming) {
|
|
1035
|
+
const existing_headers = existing.headers;
|
|
1036
|
+
const incoming_headers = incoming.headers;
|
|
1037
|
+
const equals_headers_items = equalsArray(existing_headers, incoming_headers, (existing_headers_item, incoming_headers_item) => {
|
|
1038
|
+
if (!(existing_headers_item === incoming_headers_item)) {
|
|
1039
|
+
return false;
|
|
1040
|
+
}
|
|
1041
|
+
});
|
|
1042
|
+
if (equals_headers_items === false) {
|
|
1043
|
+
return false;
|
|
1044
|
+
}
|
|
1045
|
+
const existing_rows = existing.rows;
|
|
1046
|
+
const incoming_rows = incoming.rows;
|
|
1047
|
+
const equals_rows_items = equalsArray(existing_rows, incoming_rows, (existing_rows_item, incoming_rows_item) => {
|
|
1048
|
+
const equals_rows_items_items = equalsArray(existing_rows_item, incoming_rows_item, (existing_rows_item_item, incoming_rows_item_item) => {
|
|
1049
|
+
if (!(existing_rows_item_item === incoming_rows_item_item)) {
|
|
1050
|
+
return false;
|
|
1051
|
+
}
|
|
1052
|
+
});
|
|
1053
|
+
if (equals_rows_items_items === false) {
|
|
1054
|
+
return false;
|
|
1055
|
+
}
|
|
1056
|
+
});
|
|
1057
|
+
if (equals_rows_items === false) {
|
|
1058
|
+
return false;
|
|
1059
|
+
}
|
|
1060
|
+
return true;
|
|
1061
|
+
}
|
|
1062
|
+
const ingest = function CsvPreviewOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1063
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1064
|
+
const validateError = validate(input);
|
|
1065
|
+
if (validateError !== null) {
|
|
1066
|
+
throw validateError;
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
const key = path.fullPath;
|
|
1070
|
+
const ttlToUse = TTL;
|
|
1071
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "fileBased-dataimport", VERSION, RepresentationType, equals);
|
|
1072
|
+
return createLink(key);
|
|
1073
|
+
};
|
|
1074
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
1075
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1076
|
+
const rootKey = fullPathFactory();
|
|
1077
|
+
rootKeySet.set(rootKey, {
|
|
1078
|
+
namespace: keyPrefix,
|
|
1079
|
+
representationName: RepresentationType,
|
|
1080
|
+
mergeable: false
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
function select(luvio, params) {
|
|
1085
|
+
return select$1();
|
|
1086
|
+
}
|
|
1087
|
+
function keyBuilder$1(luvio, params) {
|
|
1088
|
+
return keyPrefix + '::CsvPreviewOutputRepresentation:(' + 'delimiter:' + params.queryParams.delimiter + ',' + 'endOfLine:' + params.queryParams.endOfLine + ',' + 'numberOfRows:' + params.queryParams.numberOfRows + ',' + 'fileBasedImportId:' + params.urlParams.fileBasedImportId + ')';
|
|
1089
|
+
}
|
|
1090
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
1091
|
+
getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$1(luvio, resourceParams));
|
|
1092
|
+
}
|
|
1093
|
+
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
1094
|
+
const { body } = response;
|
|
1095
|
+
const key = keyBuilder$1(luvio, resourceParams);
|
|
1096
|
+
luvio.storeIngest(key, ingest, body);
|
|
1097
|
+
const snapshot = luvio.storeLookup({
|
|
1098
|
+
recordId: key,
|
|
1099
|
+
node: select(),
|
|
1100
|
+
variables: {},
|
|
1101
|
+
}, snapshotRefresh);
|
|
1102
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1103
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1104
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
deepFreeze(snapshot.data);
|
|
1108
|
+
return snapshot;
|
|
1109
|
+
}
|
|
1110
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
1111
|
+
const key = keyBuilder$1(luvio, params);
|
|
1112
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1113
|
+
luvio.storeIngestError(key, errorSnapshot);
|
|
1114
|
+
return errorSnapshot;
|
|
1115
|
+
}
|
|
1116
|
+
function createResourceRequest(config) {
|
|
1117
|
+
const headers = {};
|
|
1118
|
+
return {
|
|
1119
|
+
baseUri: '/services/data/v60.0',
|
|
1120
|
+
basePath: '/connect/industries/fileBasedDataImports/' + config.urlParams.fileBasedImportId + '/preview',
|
|
1121
|
+
method: 'get',
|
|
1122
|
+
body: null,
|
|
1123
|
+
urlParams: config.urlParams,
|
|
1124
|
+
queryParams: config.queryParams,
|
|
1125
|
+
headers,
|
|
1126
|
+
priority: 'normal',
|
|
1127
|
+
};
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
const adapterName = 'getGetCsvPreview';
|
|
1131
|
+
const getGetCsvPreview_ConfigPropertyMetadata = [
|
|
1132
|
+
generateParamConfigMetadata('fileBasedImportId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1133
|
+
generateParamConfigMetadata('delimiter', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1134
|
+
generateParamConfigMetadata('endOfLine', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1135
|
+
generateParamConfigMetadata('numberOfRows', false, 1 /* QueryParameter */, 3 /* Integer */),
|
|
1136
|
+
];
|
|
1137
|
+
const getGetCsvPreview_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getGetCsvPreview_ConfigPropertyMetadata);
|
|
1138
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$4(getGetCsvPreview_ConfigPropertyMetadata);
|
|
1139
|
+
function keyBuilder(luvio, config) {
|
|
1140
|
+
const resourceParams = createResourceParams(config);
|
|
1141
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
1142
|
+
}
|
|
1143
|
+
function typeCheckConfig(untrustedConfig) {
|
|
1144
|
+
const config = {};
|
|
1145
|
+
typeCheckConfig$4(untrustedConfig, config, getGetCsvPreview_ConfigPropertyMetadata);
|
|
1146
|
+
return config;
|
|
1147
|
+
}
|
|
1148
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
1149
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1150
|
+
return null;
|
|
1151
|
+
}
|
|
1152
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1153
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1154
|
+
}
|
|
1155
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
1156
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1157
|
+
return null;
|
|
1158
|
+
}
|
|
1159
|
+
return config;
|
|
1160
|
+
}
|
|
1161
|
+
function adapterFragment(luvio, config) {
|
|
1162
|
+
createResourceParams(config);
|
|
1163
|
+
return select();
|
|
1164
|
+
}
|
|
1165
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
1166
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
1167
|
+
config,
|
|
1168
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1169
|
+
});
|
|
1170
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1171
|
+
}
|
|
1172
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
1173
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
1174
|
+
config,
|
|
1175
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1176
|
+
});
|
|
1177
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1178
|
+
}
|
|
1179
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
1180
|
+
const resourceParams = createResourceParams(config);
|
|
1181
|
+
const request = createResourceRequest(resourceParams);
|
|
1182
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1183
|
+
.then((response) => {
|
|
1184
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
1185
|
+
const cache = new StoreKeyMap();
|
|
1186
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
1187
|
+
return cache;
|
|
1188
|
+
});
|
|
1189
|
+
}, (response) => {
|
|
1190
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
1193
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
1194
|
+
return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
|
|
1195
|
+
}
|
|
1196
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
1197
|
+
const { luvio, config } = context;
|
|
1198
|
+
const selector = {
|
|
1199
|
+
recordId: keyBuilder(luvio, config),
|
|
1200
|
+
node: adapterFragment(luvio, config),
|
|
1201
|
+
variables: {},
|
|
1202
|
+
};
|
|
1203
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
1204
|
+
config,
|
|
1205
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1206
|
+
});
|
|
1207
|
+
return cacheSnapshot;
|
|
1208
|
+
}
|
|
1209
|
+
const getGetCsvPreviewAdapterFactory = (luvio) => function fileBasedDataimport__getGetCsvPreview(untrustedConfig, requestContext) {
|
|
1210
|
+
const config = validateAdapterConfig(untrustedConfig, getGetCsvPreview_ConfigPropertyNames);
|
|
1211
|
+
// Invalid or incomplete config
|
|
1212
|
+
if (config === null) {
|
|
1213
|
+
return null;
|
|
1214
|
+
}
|
|
1215
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1216
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
1217
|
+
};
|
|
1218
|
+
|
|
1219
|
+
export { getFileBasedDataImportsAdapterFactory, getGetCsvPreviewAdapterFactory, startAdvanceImportAdapterFactory, startSimpleImportAdapterFactory };
|