@salesforce/lds-adapters-industries-data-processing-engine 0.1.0-dev1
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-data-processing-engine.js +454 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/generateMappingSuggestions.d.ts +17 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +1 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +2 -0
- package/dist/es/es2018/types/src/generated/resources/postConnectIndustriesDataProcessingEngineWritebackMappingSuggestions.d.ts +14 -0
- package/dist/es/es2018/types/src/generated/types/FieldDetailsInputRepresentation.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/types/FieldsDataInputRepresentation.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/types/MappingSuggestionOutputRepresentation.d.ts +32 -0
- package/dist/es/es2018/types/src/generated/types/TargetFieldOutputRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/WritebackSuggestionInputRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/WritebackSuggestionMetadataOutputRepresentation.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/types/WritebackSuggestionOutputRepresentation.d.ts +42 -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 +482 -0
- package/src/raml/api.raml +116 -0
- package/src/raml/luvio.raml +18 -0
package/sfdc/index.js
ADDED
|
@@ -0,0 +1,482 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* ATTENTION!
|
|
9
|
+
* THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
|
|
10
|
+
* If you would like to contribute to LDS, please follow the steps outlined in the git repo.
|
|
11
|
+
* Any changes made to this file in p4 will be automatically overwritten.
|
|
12
|
+
* *******************************************************************************************
|
|
13
|
+
*/
|
|
14
|
+
/* proxy-compat-disable */
|
|
15
|
+
import { withDefaultLuvio } from 'force/ldsEngine';
|
|
16
|
+
import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$1, typeCheckConfig as typeCheckConfig$1 } from 'force/luvioEngine';
|
|
17
|
+
|
|
18
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
19
|
+
const { keys: ObjectKeys, create: ObjectCreate } = Object;
|
|
20
|
+
const { isArray: ArrayIsArray$1 } = Array;
|
|
21
|
+
/**
|
|
22
|
+
* Validates an adapter config is well-formed.
|
|
23
|
+
* @param config The config to validate.
|
|
24
|
+
* @param adapter The adapter validation configuration.
|
|
25
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
26
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
27
|
+
*/
|
|
28
|
+
function validateConfig(config, adapter, oneOf) {
|
|
29
|
+
const { displayName } = adapter;
|
|
30
|
+
const { required, optional, unsupported } = adapter.parameters;
|
|
31
|
+
if (config === undefined ||
|
|
32
|
+
required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
33
|
+
throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
|
|
34
|
+
}
|
|
35
|
+
if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
36
|
+
throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
|
|
37
|
+
}
|
|
38
|
+
if (unsupported !== undefined &&
|
|
39
|
+
unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
|
|
40
|
+
throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
|
|
41
|
+
}
|
|
42
|
+
const supported = required.concat(optional);
|
|
43
|
+
if (ObjectKeys(config).some(key => !supported.includes(key))) {
|
|
44
|
+
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function untrustedIsObject(untrusted) {
|
|
48
|
+
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
|
|
49
|
+
}
|
|
50
|
+
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
51
|
+
return configPropertyNames.parameters.required.every(req => req in config);
|
|
52
|
+
}
|
|
53
|
+
function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
|
|
54
|
+
return {
|
|
55
|
+
name,
|
|
56
|
+
required,
|
|
57
|
+
resourceType,
|
|
58
|
+
typeCheckShape,
|
|
59
|
+
isArrayShape,
|
|
60
|
+
coerceFn,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function buildAdapterValidationConfig(displayName, paramsMeta) {
|
|
64
|
+
const required = paramsMeta.filter(p => p.required).map(p => p.name);
|
|
65
|
+
const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
|
|
66
|
+
return {
|
|
67
|
+
displayName,
|
|
68
|
+
parameters: {
|
|
69
|
+
required,
|
|
70
|
+
optional,
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
const keyPrefix = 'data-processing-engine';
|
|
75
|
+
|
|
76
|
+
const { isArray: ArrayIsArray } = Array;
|
|
77
|
+
function equalsArray(a, b, equalsItem) {
|
|
78
|
+
const aLength = a.length;
|
|
79
|
+
const bLength = b.length;
|
|
80
|
+
if (aLength !== bLength) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
for (let i = 0; i < aLength; i++) {
|
|
84
|
+
if (equalsItem(a[i], b[i]) === false) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
function createLink(ref) {
|
|
91
|
+
return {
|
|
92
|
+
__ref: serializeStructuredKey(ref),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const VERSION$3 = "6e8414bbd871d95b4bb093b7da259091";
|
|
97
|
+
function validate$3(obj, path = 'WritebackSuggestionMetadataOutputRepresentation') {
|
|
98
|
+
const v_error = (() => {
|
|
99
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
100
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
101
|
+
}
|
|
102
|
+
const obj_generationId = obj.generationId;
|
|
103
|
+
const path_generationId = path + '.generationId';
|
|
104
|
+
if (typeof obj_generationId !== 'string') {
|
|
105
|
+
return new TypeError('Expected "string" but received "' + typeof obj_generationId + '" (at "' + path_generationId + '")');
|
|
106
|
+
}
|
|
107
|
+
})();
|
|
108
|
+
return v_error === undefined ? null : v_error;
|
|
109
|
+
}
|
|
110
|
+
const select$4 = function WritebackSuggestionMetadataOutputRepresentationSelect() {
|
|
111
|
+
return {
|
|
112
|
+
kind: 'Fragment',
|
|
113
|
+
version: VERSION$3,
|
|
114
|
+
private: [],
|
|
115
|
+
selections: [
|
|
116
|
+
{
|
|
117
|
+
name: 'generationId',
|
|
118
|
+
kind: 'Scalar'
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
function equals$3(existing, incoming) {
|
|
124
|
+
const existing_generationId = existing.generationId;
|
|
125
|
+
const incoming_generationId = incoming.generationId;
|
|
126
|
+
if (!(existing_generationId === incoming_generationId)) {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const VERSION$2 = "8f1160d49995b9f2c5baa4c775e203a6";
|
|
133
|
+
function validate$2(obj, path = 'TargetFieldOutputRepresentation') {
|
|
134
|
+
const v_error = (() => {
|
|
135
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
136
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
137
|
+
}
|
|
138
|
+
const obj_confidence = obj.confidence;
|
|
139
|
+
const path_confidence = path + '.confidence';
|
|
140
|
+
if (typeof obj_confidence !== 'string') {
|
|
141
|
+
return new TypeError('Expected "string" but received "' + typeof obj_confidence + '" (at "' + path_confidence + '")');
|
|
142
|
+
}
|
|
143
|
+
const obj_fieldName = obj.fieldName;
|
|
144
|
+
const path_fieldName = path + '.fieldName';
|
|
145
|
+
if (typeof obj_fieldName !== 'string') {
|
|
146
|
+
return new TypeError('Expected "string" but received "' + typeof obj_fieldName + '" (at "' + path_fieldName + '")');
|
|
147
|
+
}
|
|
148
|
+
obj.percent;
|
|
149
|
+
})();
|
|
150
|
+
return v_error === undefined ? null : v_error;
|
|
151
|
+
}
|
|
152
|
+
const select$3 = function TargetFieldOutputRepresentationSelect() {
|
|
153
|
+
return {
|
|
154
|
+
kind: 'Fragment',
|
|
155
|
+
version: VERSION$2,
|
|
156
|
+
private: [],
|
|
157
|
+
selections: [
|
|
158
|
+
{
|
|
159
|
+
name: 'confidence',
|
|
160
|
+
kind: 'Scalar'
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: 'fieldName',
|
|
164
|
+
kind: 'Scalar'
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
name: 'percent',
|
|
168
|
+
kind: 'Scalar'
|
|
169
|
+
}
|
|
170
|
+
]
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
function equals$2(existing, incoming) {
|
|
174
|
+
const existing_confidence = existing.confidence;
|
|
175
|
+
const incoming_confidence = incoming.confidence;
|
|
176
|
+
if (!(existing_confidence === incoming_confidence)) {
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
const existing_fieldName = existing.fieldName;
|
|
180
|
+
const incoming_fieldName = incoming.fieldName;
|
|
181
|
+
if (!(existing_fieldName === incoming_fieldName)) {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
const existing_percent = existing.percent;
|
|
185
|
+
const incoming_percent = incoming.percent;
|
|
186
|
+
if (!(existing_percent === incoming_percent)) {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const VERSION$1 = "7dee26f6959116c39fc624103953ffa7";
|
|
193
|
+
function validate$1(obj, path = 'MappingSuggestionOutputRepresentation') {
|
|
194
|
+
const v_error = (() => {
|
|
195
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
196
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
197
|
+
}
|
|
198
|
+
const obj_sourceFieldName = obj.sourceFieldName;
|
|
199
|
+
const path_sourceFieldName = path + '.sourceFieldName';
|
|
200
|
+
if (typeof obj_sourceFieldName !== 'string') {
|
|
201
|
+
return new TypeError('Expected "string" but received "' + typeof obj_sourceFieldName + '" (at "' + path_sourceFieldName + '")');
|
|
202
|
+
}
|
|
203
|
+
const obj_targetField = obj.targetField;
|
|
204
|
+
const path_targetField = path + '.targetField';
|
|
205
|
+
if (!ArrayIsArray(obj_targetField)) {
|
|
206
|
+
return new TypeError('Expected "array" but received "' + typeof obj_targetField + '" (at "' + path_targetField + '")');
|
|
207
|
+
}
|
|
208
|
+
for (let i = 0; i < obj_targetField.length; i++) {
|
|
209
|
+
const obj_targetField_item = obj_targetField[i];
|
|
210
|
+
const path_targetField_item = path_targetField + '[' + i + ']';
|
|
211
|
+
const referencepath_targetField_itemValidationError = validate$2(obj_targetField_item, path_targetField_item);
|
|
212
|
+
if (referencepath_targetField_itemValidationError !== null) {
|
|
213
|
+
let message = 'Object doesn\'t match TargetFieldOutputRepresentation (at "' + path_targetField_item + '")\n';
|
|
214
|
+
message += referencepath_targetField_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
215
|
+
return new TypeError(message);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
})();
|
|
219
|
+
return v_error === undefined ? null : v_error;
|
|
220
|
+
}
|
|
221
|
+
const select$2 = function MappingSuggestionOutputRepresentationSelect() {
|
|
222
|
+
const { selections: TargetFieldOutputRepresentation__selections, opaque: TargetFieldOutputRepresentation__opaque, } = select$3();
|
|
223
|
+
return {
|
|
224
|
+
kind: 'Fragment',
|
|
225
|
+
version: VERSION$1,
|
|
226
|
+
private: [],
|
|
227
|
+
selections: [
|
|
228
|
+
{
|
|
229
|
+
name: 'sourceFieldName',
|
|
230
|
+
kind: 'Scalar'
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
name: 'targetField',
|
|
234
|
+
kind: 'Object',
|
|
235
|
+
plural: true,
|
|
236
|
+
selections: TargetFieldOutputRepresentation__selections
|
|
237
|
+
}
|
|
238
|
+
]
|
|
239
|
+
};
|
|
240
|
+
};
|
|
241
|
+
function equals$1(existing, incoming) {
|
|
242
|
+
const existing_sourceFieldName = existing.sourceFieldName;
|
|
243
|
+
const incoming_sourceFieldName = incoming.sourceFieldName;
|
|
244
|
+
if (!(existing_sourceFieldName === incoming_sourceFieldName)) {
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
const existing_targetField = existing.targetField;
|
|
248
|
+
const incoming_targetField = incoming.targetField;
|
|
249
|
+
const equals_targetField_items = equalsArray(existing_targetField, incoming_targetField, (existing_targetField_item, incoming_targetField_item) => {
|
|
250
|
+
if (!(equals$2(existing_targetField_item, incoming_targetField_item))) {
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
if (equals_targetField_items === false) {
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
return true;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const VERSION = "bd4959a9a554d32599665f66f825848b";
|
|
261
|
+
function validate(obj, path = 'WritebackSuggestionOutputRepresentation') {
|
|
262
|
+
const v_error = (() => {
|
|
263
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
264
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
265
|
+
}
|
|
266
|
+
const obj_metadata = obj.metadata;
|
|
267
|
+
const path_metadata = path + '.metadata';
|
|
268
|
+
const referencepath_metadataValidationError = validate$3(obj_metadata, path_metadata);
|
|
269
|
+
if (referencepath_metadataValidationError !== null) {
|
|
270
|
+
let message = 'Object doesn\'t match WritebackSuggestionMetadataOutputRepresentation (at "' + path_metadata + '")\n';
|
|
271
|
+
message += referencepath_metadataValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
272
|
+
return new TypeError(message);
|
|
273
|
+
}
|
|
274
|
+
const obj_suggestions = obj.suggestions;
|
|
275
|
+
const path_suggestions = path + '.suggestions';
|
|
276
|
+
if (!ArrayIsArray(obj_suggestions)) {
|
|
277
|
+
return new TypeError('Expected "array" but received "' + typeof obj_suggestions + '" (at "' + path_suggestions + '")');
|
|
278
|
+
}
|
|
279
|
+
for (let i = 0; i < obj_suggestions.length; i++) {
|
|
280
|
+
const obj_suggestions_item = obj_suggestions[i];
|
|
281
|
+
const path_suggestions_item = path_suggestions + '[' + i + ']';
|
|
282
|
+
const referencepath_suggestions_itemValidationError = validate$1(obj_suggestions_item, path_suggestions_item);
|
|
283
|
+
if (referencepath_suggestions_itemValidationError !== null) {
|
|
284
|
+
let message = 'Object doesn\'t match MappingSuggestionOutputRepresentation (at "' + path_suggestions_item + '")\n';
|
|
285
|
+
message += referencepath_suggestions_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
286
|
+
return new TypeError(message);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
})();
|
|
290
|
+
return v_error === undefined ? null : v_error;
|
|
291
|
+
}
|
|
292
|
+
const RepresentationType = 'WritebackSuggestionOutputRepresentation';
|
|
293
|
+
function keyBuilder(luvio, config) {
|
|
294
|
+
return keyPrefix + '::' + RepresentationType + ':' + config.generationId;
|
|
295
|
+
}
|
|
296
|
+
function keyBuilderFromType(luvio, object) {
|
|
297
|
+
const keyParams = {
|
|
298
|
+
generationId: object.metadata.generationId
|
|
299
|
+
};
|
|
300
|
+
return keyBuilder(luvio, keyParams);
|
|
301
|
+
}
|
|
302
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
303
|
+
return input;
|
|
304
|
+
}
|
|
305
|
+
const select$1 = function WritebackSuggestionOutputRepresentationSelect() {
|
|
306
|
+
const { selections: WritebackSuggestionMetadataOutputRepresentation__selections, opaque: WritebackSuggestionMetadataOutputRepresentation__opaque, } = select$4();
|
|
307
|
+
const { selections: MappingSuggestionOutputRepresentation__selections, opaque: MappingSuggestionOutputRepresentation__opaque, } = select$2();
|
|
308
|
+
return {
|
|
309
|
+
kind: 'Fragment',
|
|
310
|
+
version: VERSION,
|
|
311
|
+
private: [],
|
|
312
|
+
selections: [
|
|
313
|
+
{
|
|
314
|
+
name: 'metadata',
|
|
315
|
+
kind: 'Object',
|
|
316
|
+
selections: WritebackSuggestionMetadataOutputRepresentation__selections
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
name: 'suggestions',
|
|
320
|
+
kind: 'Object',
|
|
321
|
+
plural: true,
|
|
322
|
+
selections: MappingSuggestionOutputRepresentation__selections
|
|
323
|
+
}
|
|
324
|
+
]
|
|
325
|
+
};
|
|
326
|
+
};
|
|
327
|
+
function equals(existing, incoming) {
|
|
328
|
+
const existing_metadata = existing.metadata;
|
|
329
|
+
const incoming_metadata = incoming.metadata;
|
|
330
|
+
if (!(equals$3(existing_metadata, incoming_metadata))) {
|
|
331
|
+
return false;
|
|
332
|
+
}
|
|
333
|
+
const existing_suggestions = existing.suggestions;
|
|
334
|
+
const incoming_suggestions = incoming.suggestions;
|
|
335
|
+
const equals_suggestions_items = equalsArray(existing_suggestions, incoming_suggestions, (existing_suggestions_item, incoming_suggestions_item) => {
|
|
336
|
+
if (!(equals$1(existing_suggestions_item, incoming_suggestions_item))) {
|
|
337
|
+
return false;
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
if (equals_suggestions_items === false) {
|
|
341
|
+
return false;
|
|
342
|
+
}
|
|
343
|
+
return true;
|
|
344
|
+
}
|
|
345
|
+
const ingest = function WritebackSuggestionOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
346
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
347
|
+
const validateError = validate(input);
|
|
348
|
+
if (validateError !== null) {
|
|
349
|
+
throw validateError;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
const key = keyBuilderFromType(luvio, input);
|
|
353
|
+
const ttlToUse = path.ttl !== undefined ? path.ttl : 360000;
|
|
354
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "data-processing-engine", VERSION, RepresentationType, equals);
|
|
355
|
+
return createLink(key);
|
|
356
|
+
};
|
|
357
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
358
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
359
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
360
|
+
rootKeySet.set(rootKey, {
|
|
361
|
+
namespace: keyPrefix,
|
|
362
|
+
representationName: RepresentationType,
|
|
363
|
+
mergeable: false
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function select(luvio, params) {
|
|
368
|
+
return select$1();
|
|
369
|
+
}
|
|
370
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
371
|
+
getTypeCacheKeys(storeKeyMap, luvio, response);
|
|
372
|
+
}
|
|
373
|
+
function ingestSuccess(luvio, resourceParams, response) {
|
|
374
|
+
const { body } = response;
|
|
375
|
+
const key = keyBuilderFromType(luvio, body);
|
|
376
|
+
luvio.storeIngest(key, ingest, body);
|
|
377
|
+
const snapshot = luvio.storeLookup({
|
|
378
|
+
recordId: key,
|
|
379
|
+
node: select(),
|
|
380
|
+
variables: {},
|
|
381
|
+
});
|
|
382
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
383
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
384
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
deepFreeze(snapshot.data);
|
|
388
|
+
return snapshot;
|
|
389
|
+
}
|
|
390
|
+
function createResourceRequest(config) {
|
|
391
|
+
const headers = {};
|
|
392
|
+
return {
|
|
393
|
+
baseUri: '/services/data/v66.0',
|
|
394
|
+
basePath: '/connect/industries/data-processing-engine/writeback-mapping-suggestions',
|
|
395
|
+
method: 'post',
|
|
396
|
+
body: config.body,
|
|
397
|
+
urlParams: {},
|
|
398
|
+
queryParams: {},
|
|
399
|
+
headers,
|
|
400
|
+
priority: 'normal',
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
const adapterName = 'generateMappingSuggestions';
|
|
405
|
+
const generateMappingSuggestions_ConfigPropertyMetadata = [
|
|
406
|
+
generateParamConfigMetadata('datasource', true, 2 /* Body */, 4 /* Unsupported */),
|
|
407
|
+
generateParamConfigMetadata('processType', true, 2 /* Body */, 0 /* String */),
|
|
408
|
+
generateParamConfigMetadata('target', true, 2 /* Body */, 4 /* Unsupported */),
|
|
409
|
+
];
|
|
410
|
+
const generateMappingSuggestions_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, generateMappingSuggestions_ConfigPropertyMetadata);
|
|
411
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$1(generateMappingSuggestions_ConfigPropertyMetadata);
|
|
412
|
+
function typeCheckConfig(untrustedConfig) {
|
|
413
|
+
const config = {};
|
|
414
|
+
typeCheckConfig$1(untrustedConfig, config, generateMappingSuggestions_ConfigPropertyMetadata);
|
|
415
|
+
const untrustedConfig_datasource = untrustedConfig.datasource;
|
|
416
|
+
config.datasource = untrustedConfig_datasource;
|
|
417
|
+
const untrustedConfig_target = untrustedConfig.target;
|
|
418
|
+
config.target = untrustedConfig_target;
|
|
419
|
+
return config;
|
|
420
|
+
}
|
|
421
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
422
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
423
|
+
return null;
|
|
424
|
+
}
|
|
425
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
426
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
427
|
+
}
|
|
428
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
429
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
430
|
+
return null;
|
|
431
|
+
}
|
|
432
|
+
return config;
|
|
433
|
+
}
|
|
434
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
435
|
+
const resourceParams = createResourceParams(config);
|
|
436
|
+
const request = createResourceRequest(resourceParams);
|
|
437
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
438
|
+
.then((response) => {
|
|
439
|
+
return luvio.handleSuccessResponse(() => {
|
|
440
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
441
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
442
|
+
}, () => {
|
|
443
|
+
const cache = new StoreKeyMap();
|
|
444
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
445
|
+
return cache;
|
|
446
|
+
});
|
|
447
|
+
}, (response) => {
|
|
448
|
+
deepFreeze(response);
|
|
449
|
+
throw response;
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
const generateMappingSuggestionsAdapterFactory = (luvio) => {
|
|
453
|
+
return function generateMappingSuggestions(untrustedConfig) {
|
|
454
|
+
const config = validateAdapterConfig(untrustedConfig, generateMappingSuggestions_ConfigPropertyNames);
|
|
455
|
+
// Invalid or incomplete config
|
|
456
|
+
if (config === null) {
|
|
457
|
+
throw new Error('Invalid config for "generateMappingSuggestions"');
|
|
458
|
+
}
|
|
459
|
+
return buildNetworkSnapshot(luvio, config);
|
|
460
|
+
};
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
let generateMappingSuggestions;
|
|
464
|
+
// Notify Update Available
|
|
465
|
+
function bindExportsTo(luvio) {
|
|
466
|
+
// LDS Adapters
|
|
467
|
+
function unwrapSnapshotData(factory) {
|
|
468
|
+
const adapter = factory(luvio);
|
|
469
|
+
return (config) => adapter(config).then((snapshot) => snapshot.data);
|
|
470
|
+
}
|
|
471
|
+
return {
|
|
472
|
+
generateMappingSuggestions: unwrapSnapshotData(generateMappingSuggestionsAdapterFactory),
|
|
473
|
+
// Imperative GET Adapters
|
|
474
|
+
// Notify Update Availables
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
withDefaultLuvio((luvio) => {
|
|
478
|
+
({ generateMappingSuggestions } = bindExportsTo(luvio));
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
export { generateMappingSuggestions };
|
|
482
|
+
// version: 0.1.0-dev1-c978a7b010
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
#%RAML 1.0
|
|
2
|
+
securedBy:
|
|
3
|
+
- OAuth2
|
|
4
|
+
title: Salesforce Connect API
|
|
5
|
+
version: '63.0'
|
|
6
|
+
mediaType: application/json
|
|
7
|
+
protocols:
|
|
8
|
+
- https
|
|
9
|
+
baseUri: /services/data/v66.0
|
|
10
|
+
securitySchemes:
|
|
11
|
+
OAuth2:
|
|
12
|
+
type: OAuth 2.0
|
|
13
|
+
settings:
|
|
14
|
+
authorizationUri: https://example.com/oauth/authorize
|
|
15
|
+
accessTokenUri: ''
|
|
16
|
+
authorizationGrants:
|
|
17
|
+
- implicit
|
|
18
|
+
annotationTypes:
|
|
19
|
+
oas-readOnly:
|
|
20
|
+
type: boolean
|
|
21
|
+
allowedTargets: TypeDeclaration
|
|
22
|
+
oas-collectionFormat:
|
|
23
|
+
type: string
|
|
24
|
+
oas-body-name:
|
|
25
|
+
type: string
|
|
26
|
+
allowedTargets: TypeDeclaration
|
|
27
|
+
types:
|
|
28
|
+
FieldDetailsInputRepresentation:
|
|
29
|
+
description: An Input Representation of the field details for writeback mapping
|
|
30
|
+
suggestions
|
|
31
|
+
type: object
|
|
32
|
+
properties:
|
|
33
|
+
name:
|
|
34
|
+
description: Name of the Field
|
|
35
|
+
type: string
|
|
36
|
+
FieldsDataInputRepresentation:
|
|
37
|
+
description: An Input Representation of the fields for writeback mapping suggestions
|
|
38
|
+
type: object
|
|
39
|
+
properties:
|
|
40
|
+
fields:
|
|
41
|
+
description: Field data for Writeback suggestion input
|
|
42
|
+
type: array
|
|
43
|
+
items:
|
|
44
|
+
type: FieldDetailsInputRepresentation
|
|
45
|
+
MappingSuggestionOutputRepresentation:
|
|
46
|
+
description: Output Representation for mapping suggestion
|
|
47
|
+
type: object
|
|
48
|
+
properties:
|
|
49
|
+
sourceFieldName:
|
|
50
|
+
description: Name of the Source field in mapping suggestion
|
|
51
|
+
type: string
|
|
52
|
+
targetField:
|
|
53
|
+
description: Target field of the mapping suggestions
|
|
54
|
+
type: array
|
|
55
|
+
items:
|
|
56
|
+
type: TargetFieldOutputRepresentation
|
|
57
|
+
TargetFieldOutputRepresentation:
|
|
58
|
+
description: Output Representation for mapping suggestions target field
|
|
59
|
+
type: object
|
|
60
|
+
properties:
|
|
61
|
+
confidence:
|
|
62
|
+
description: Confidence level of the mapping suggestions
|
|
63
|
+
type: string
|
|
64
|
+
fieldName:
|
|
65
|
+
description: Name of the target field in mapping suggestion
|
|
66
|
+
type: string
|
|
67
|
+
percent:
|
|
68
|
+
description: Confidence in percentage of the mapping suggestions
|
|
69
|
+
format: double
|
|
70
|
+
type: number
|
|
71
|
+
WritebackSuggestionInputRepresentation:
|
|
72
|
+
description: An Input Representation for writeback mapping suggestions
|
|
73
|
+
type: object
|
|
74
|
+
properties:
|
|
75
|
+
datasource:
|
|
76
|
+
description: Datasource fields for Writeback suggestion input
|
|
77
|
+
type: any
|
|
78
|
+
processType:
|
|
79
|
+
description: ProcessType of the DPE definition
|
|
80
|
+
type: string
|
|
81
|
+
target:
|
|
82
|
+
description: Target fields for Writeback suggestion input
|
|
83
|
+
type: any
|
|
84
|
+
WritebackSuggestionMetadataOutputRepresentation:
|
|
85
|
+
description: Output Representation for writeback mapping suggestions metadata
|
|
86
|
+
type: object
|
|
87
|
+
properties:
|
|
88
|
+
generationId:
|
|
89
|
+
description: Generation id of the LLM response used for feedback
|
|
90
|
+
type: string
|
|
91
|
+
WritebackSuggestionOutputRepresentation:
|
|
92
|
+
description: Output Representation for writeback mapping suggestions
|
|
93
|
+
type: object
|
|
94
|
+
properties:
|
|
95
|
+
metadata:
|
|
96
|
+
description: Metadata about generated writeback mapping suggestions
|
|
97
|
+
type: WritebackSuggestionMetadataOutputRepresentation
|
|
98
|
+
suggestions:
|
|
99
|
+
description: Generated writeback mapping suggestions
|
|
100
|
+
type: array
|
|
101
|
+
items:
|
|
102
|
+
type: MappingSuggestionOutputRepresentation
|
|
103
|
+
/connect/industries/data-processing-engine/writeback-mapping-suggestions:
|
|
104
|
+
post:
|
|
105
|
+
displayName: postDPEWritebackMapping
|
|
106
|
+
description: Generate mapping suggestions
|
|
107
|
+
responses:
|
|
108
|
+
'200':
|
|
109
|
+
description: Success
|
|
110
|
+
body:
|
|
111
|
+
application/json:
|
|
112
|
+
type: WritebackSuggestionOutputRepresentation
|
|
113
|
+
body:
|
|
114
|
+
application/json:
|
|
115
|
+
type: WritebackSuggestionInputRepresentation
|
|
116
|
+
(oas-body-name): mappingSuggestionInput
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#%RAML 1.0 Overlay
|
|
2
|
+
extends: ./api.raml
|
|
3
|
+
|
|
4
|
+
uses:
|
|
5
|
+
luvio: luvio://annotations.raml
|
|
6
|
+
|
|
7
|
+
(luvio.keyPrefix): 'data-processing-engine'
|
|
8
|
+
(luvio.ttl): 360000
|
|
9
|
+
|
|
10
|
+
types:
|
|
11
|
+
WritebackSuggestionOutputRepresentation:
|
|
12
|
+
(luvio.key):
|
|
13
|
+
generationId: metadata.generationId
|
|
14
|
+
|
|
15
|
+
/connect/industries/data-processing-engine/writeback-mapping-suggestions:
|
|
16
|
+
post:
|
|
17
|
+
(luvio.adapter):
|
|
18
|
+
name: generateMappingSuggestions
|