@lingk/sync 0.2.3 → 0.2.5
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/build/credentialSections.js +32 -20
- package/build/credentialSections.js.map +1 -1
- package/build/lightning.js +90 -90
- package/build/lightning.js.map +1 -1
- package/build/lightningStyles.js.map +1 -1
- package/build/lingk.js +30 -30
- package/build/lingk.js.map +1 -1
- package/build/lingkStyles.js.map +1 -1
- package/build/loadData.js +323 -0
- package/build/loadData.js.map +1 -0
- package/build/main.js +1113 -1162
- package/build/main.js.map +1 -1
- package/build/metadataFunctions.js +2 -2
- package/build/metadataFunctions.js.map +1 -1
- package/build/reducer.js +6 -6
- package/build/reducer.js.map +1 -1
- package/build/saveData.js +339 -0
- package/build/saveData.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
module.exports =
|
|
2
|
+
/******/ (function(modules) { // webpackBootstrap
|
|
3
|
+
/******/ // The module cache
|
|
4
|
+
/******/ var installedModules = {};
|
|
5
|
+
/******/
|
|
6
|
+
/******/ // The require function
|
|
7
|
+
/******/ function __webpack_require__(moduleId) {
|
|
8
|
+
/******/
|
|
9
|
+
/******/ // Check if module is in cache
|
|
10
|
+
/******/ if(installedModules[moduleId])
|
|
11
|
+
/******/ return installedModules[moduleId].exports;
|
|
12
|
+
/******/
|
|
13
|
+
/******/ // Create a new module (and put it into the cache)
|
|
14
|
+
/******/ var module = installedModules[moduleId] = {
|
|
15
|
+
/******/ exports: {},
|
|
16
|
+
/******/ id: moduleId,
|
|
17
|
+
/******/ loaded: false
|
|
18
|
+
/******/ };
|
|
19
|
+
/******/
|
|
20
|
+
/******/ // Execute the module function
|
|
21
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
22
|
+
/******/
|
|
23
|
+
/******/ // Flag the module as loaded
|
|
24
|
+
/******/ module.loaded = true;
|
|
25
|
+
/******/
|
|
26
|
+
/******/ // Return the exports of the module
|
|
27
|
+
/******/ return module.exports;
|
|
28
|
+
/******/ }
|
|
29
|
+
/******/
|
|
30
|
+
/******/
|
|
31
|
+
/******/ // expose the modules object (__webpack_modules__)
|
|
32
|
+
/******/ __webpack_require__.m = modules;
|
|
33
|
+
/******/
|
|
34
|
+
/******/ // expose the module cache
|
|
35
|
+
/******/ __webpack_require__.c = installedModules;
|
|
36
|
+
/******/
|
|
37
|
+
/******/ // __webpack_public_path__
|
|
38
|
+
/******/ __webpack_require__.p = "";
|
|
39
|
+
/******/
|
|
40
|
+
/******/ // Load entry module and return exports
|
|
41
|
+
/******/ return __webpack_require__(0);
|
|
42
|
+
/******/ })
|
|
43
|
+
/************************************************************************/
|
|
44
|
+
/******/ ({
|
|
45
|
+
|
|
46
|
+
/***/ 0:
|
|
47
|
+
/***/ function(module, exports, __webpack_require__) {
|
|
48
|
+
|
|
49
|
+
module.exports = __webpack_require__(28);
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
/***/ },
|
|
53
|
+
|
|
54
|
+
/***/ 28:
|
|
55
|
+
/***/ function(module, exports) {
|
|
56
|
+
|
|
57
|
+
'use strict';
|
|
58
|
+
|
|
59
|
+
Object.defineProperty(exports, "__esModule", {
|
|
60
|
+
value: true
|
|
61
|
+
});
|
|
62
|
+
/**************************
|
|
63
|
+
|
|
64
|
+
Saves data from the Redux-Form and converts it to apiNames, which are used
|
|
65
|
+
to generate the recipe and are stored in our DB.
|
|
66
|
+
|
|
67
|
+
Runs when user click "submit"
|
|
68
|
+
|
|
69
|
+
If a new dropdown with fields is added to the UI, it must be added to this function as well
|
|
70
|
+
|
|
71
|
+
sP = sourceProvider
|
|
72
|
+
tM = targetMetadata
|
|
73
|
+
**************************/
|
|
74
|
+
|
|
75
|
+
function saveData(resourceGroups, sP, tP, sM, tM, sourceEndpoint, isReverse) {
|
|
76
|
+
|
|
77
|
+
// switch providers and metadatas if the wizard is reverse
|
|
78
|
+
var sourceProvider = sP;
|
|
79
|
+
var targetProvider = tP;
|
|
80
|
+
var sourceMetadata = sM;
|
|
81
|
+
var targetMetadata = tM;
|
|
82
|
+
if (isReverse) {
|
|
83
|
+
sourceProvider = tP;
|
|
84
|
+
targetProvider = sP;
|
|
85
|
+
sourceMetadata = tM;
|
|
86
|
+
targetMetadata = sM;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
var bundles = resourceGroups || [];
|
|
90
|
+
var mappings = [];
|
|
91
|
+
var endpoints = {};
|
|
92
|
+
bundles && bundles.forEach(function (group, index) {
|
|
93
|
+
// first get target resource
|
|
94
|
+
var destinationResource = targetMetadata ? targetMetadata.find(function (rsc) {
|
|
95
|
+
return rsc.name === group.name;
|
|
96
|
+
}) : group;
|
|
97
|
+
group.name = destinationResource.type;
|
|
98
|
+
group.resourceLabel = destinationResource.name;
|
|
99
|
+
group.provider = targetProvider.toLowerCase();
|
|
100
|
+
if (destinationResource.recordTypeId) {
|
|
101
|
+
group.recordTypeId = destinationResource.recordTypeId;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// destination Keys (for de-duplication in the Connect modal)
|
|
105
|
+
if (!group.customExternalKeys && group.lingkSourceKey) {
|
|
106
|
+
group.sourceKeys = [group.lingkSourceKey];
|
|
107
|
+
group.sourceKeysObjects = [group.lingkSourceKeyObject];
|
|
108
|
+
group.sourceKeysParents = [group.lingkSourceKeyParents];
|
|
109
|
+
group.destinationKeys = ['Lingk_External_Id__c'];
|
|
110
|
+
} else {
|
|
111
|
+
(function () {
|
|
112
|
+
var destinationKeys = [];
|
|
113
|
+
if (group.destinationKeys) {
|
|
114
|
+
group.destinationKeys.forEach(function (dk) {
|
|
115
|
+
if (destinationResource && destinationResource.properties && destinationResource.properties.find(function (prop) {
|
|
116
|
+
return prop.label === dk;
|
|
117
|
+
})) {
|
|
118
|
+
destinationKeys.push(destinationResource.properties.find(function (prop) {
|
|
119
|
+
return prop.label === dk;
|
|
120
|
+
}).name);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
group.destinationKeys = destinationKeys;
|
|
125
|
+
})();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// get resource + name of sourceKeys
|
|
129
|
+
var sourceKeys = [];
|
|
130
|
+
var sourceKeysObjects = [];
|
|
131
|
+
var sourceKeysParents = [];
|
|
132
|
+
group.sourceKeys && group.sourceKeys.forEach(function (sk, i) {
|
|
133
|
+
var sourceKeyResourceProvider = group.resources.find(function (r) {
|
|
134
|
+
return r.name === group.sourceKeysObjects[i];
|
|
135
|
+
}).provider;
|
|
136
|
+
var dataSourceMetadata = sourceKeyResourceProvider === targetProvider ? targetMetadata : sourceMetadata;
|
|
137
|
+
var sourceResource = dataSourceMetadata.find(function (metaRsc) {
|
|
138
|
+
return metaRsc.name === group.sourceKeysObjects[i];
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
if (sourceResource) {
|
|
142
|
+
|
|
143
|
+
var nestedSourceKey = findNestedProp(sk, group.sourceKeysParents && group.sourceKeysParents[i], sourceResource);
|
|
144
|
+
sourceKeys.push(nestedSourceKey.property);
|
|
145
|
+
sourceKeysParents.push(JSON.stringify(nestedSourceKey.parentsArray));
|
|
146
|
+
sourceKeysObjects.push(sourceResource.type);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
group.sourceKeys = sourceKeys;
|
|
150
|
+
group.sourceKeysObjects = sourceKeysObjects;
|
|
151
|
+
group.sourceKeysParents = sourceKeysParents;
|
|
152
|
+
|
|
153
|
+
// MAPPINGS
|
|
154
|
+
if (group.mappings) {
|
|
155
|
+
group.mappings.forEach(function (singleMapping) {
|
|
156
|
+
// get mapping source resource (check both metadatas)
|
|
157
|
+
var dataSourceMetadata = singleMapping.dataSourceIsDestinationEntity ? targetMetadata : sourceMetadata;
|
|
158
|
+
if (isReverse) {
|
|
159
|
+
dataSourceMetadata = singleMapping.dataSourceIsDestinationEntity ? sourceMetadata : targetMetadata;
|
|
160
|
+
}
|
|
161
|
+
var sourceResource = dataSourceMetadata.find(function (rsc) {
|
|
162
|
+
return rsc.name === singleMapping.resourceFromName;
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
// get mapping source property
|
|
166
|
+
var nestedSourceProp = findNestedProp(singleMapping.propertyFromName, singleMapping.propertyFromParents, sourceResource);
|
|
167
|
+
//get mapping destination property
|
|
168
|
+
var destinationProperty = destinationResource && destinationResource.properties && destinationResource.properties.find(function (prop) {
|
|
169
|
+
return prop.label === singleMapping.propertyToName;
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
//dont save transformation that are just "none"
|
|
173
|
+
if (singleMapping.transformations && singleMapping.transformations.length > 0) {
|
|
174
|
+
singleMapping.transformations.forEach(function (trans, index) {
|
|
175
|
+
if (trans.type === 'none') {
|
|
176
|
+
singleMapping.transformations.splice(index, 1);
|
|
177
|
+
}
|
|
178
|
+
if (trans.type === 'concat') {
|
|
179
|
+
var r;
|
|
180
|
+
|
|
181
|
+
(function () {
|
|
182
|
+
var s = trans.args[1].split('->');
|
|
183
|
+
|
|
184
|
+
var transConcatSourceResourceProvider = group.resources.find(function (r) {
|
|
185
|
+
return r.name === s[0];
|
|
186
|
+
}).provider.toLowerCase();
|
|
187
|
+
var transConcatSourceMetadata = transConcatSourceResourceProvider === targetProvider.toLowerCase() ? targetMetadata : sourceMetadata;
|
|
188
|
+
var transConcatSourceResource = transConcatSourceMetadata.find(function (rsc) {
|
|
189
|
+
return rsc.name === s[0];
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
var nestedFields = s[1].split('.');
|
|
193
|
+
var field = nestedFields[nestedFields.length - 1];
|
|
194
|
+
nestedFields.pop();
|
|
195
|
+
var transSourceApiNames = findNestedProp(field, nestedFields, transConcatSourceResource);
|
|
196
|
+
r = transConcatSourceResourceProvider + '->' + transConcatSourceResource.type + '->';
|
|
197
|
+
|
|
198
|
+
transSourceApiNames.parentsArray.forEach(function (p) {
|
|
199
|
+
return r += p + '.';
|
|
200
|
+
});
|
|
201
|
+
r += transSourceApiNames.property;
|
|
202
|
+
trans.args[1] = r;
|
|
203
|
+
})();
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (sourceResource && nestedSourceProp.property && destinationResource && destinationProperty) {
|
|
209
|
+
mappings = mappings.concat(Object.assign({ // add to mappings obj
|
|
210
|
+
resourceFromLabel: singleMapping.dataSourceIsDestinationEntity ? sourceResource.type + '_' + targetProvider.toLowerCase() : sourceResource.type + '_' + sourceProvider.toLowerCase(),
|
|
211
|
+
resourceFromName: sourceResource.type,
|
|
212
|
+
propertyFromName: nestedSourceProp.property
|
|
213
|
+
}, nestedSourceProp.parentsArray && nestedSourceProp.parentsArray.length > 0 && { propertyFromParents: nestedSourceProp.parentsArray }, {
|
|
214
|
+
resourceToName: destinationResource.type,
|
|
215
|
+
propertyToName: destinationProperty.name,
|
|
216
|
+
bundleIndex: index
|
|
217
|
+
}, singleMapping.isExternalKeyMapping && { isExternalKeyMapping: true }, singleMapping.dataSourceIsDestinationEntity && { isDestinationResource: true }, singleMapping.isUnique && { isUnique: true }, singleMapping.transformations && singleMapping.transformations.length > 0 && !singleMapping.transformations.every(function (t) {
|
|
218
|
+
return t.type === 'none';
|
|
219
|
+
}) && { transformations: singleMapping.transformations }));
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
delete group.mappings; // remove the mapping obj from a resourceGroup
|
|
223
|
+
if (group.lingkSourceKey) delete group.lingkSourceKey;
|
|
224
|
+
if (group.lingkSourceKeyObject) delete group.lingkSourceKeyObject;
|
|
225
|
+
if (group.lingkSourceKeyParents) delete group.lingkSourceKeyParents;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// BUNDLES
|
|
229
|
+
if (group.resources) {
|
|
230
|
+
group.resources = group.resources.map(function (rsc, rscIndex) {
|
|
231
|
+
//get resource source (check both metadatas)
|
|
232
|
+
var dataSourceMetadata = rsc.provider.toLowerCase() === targetProvider.toLowerCase() ? targetMetadata : sourceMetadata;
|
|
233
|
+
var sourceResource = dataSourceMetadata.find(function (metaRsc) {
|
|
234
|
+
return metaRsc.name === rsc.name;
|
|
235
|
+
});
|
|
236
|
+
// via parameter, dont change because its already "type"
|
|
237
|
+
var nestedJoinKey = { property: rsc.joinKeyName };
|
|
238
|
+
var joinKeyResource = rsc.joinKeyResource;
|
|
239
|
+
// is from a same resource (not via parameters)
|
|
240
|
+
if (sourceResource && sourceResource.name === rsc.joinKeyResource) {
|
|
241
|
+
nestedJoinKey = findNestedProp(rsc.joinKeyName, rsc.joinKeyParents, sourceResource);
|
|
242
|
+
joinKeyResource = sourceResource.type;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
//make endpoint
|
|
246
|
+
var suffix = sourceResource && sourceResource.endpointSuffix;
|
|
247
|
+
if (suffix) {
|
|
248
|
+
endpoints['url_' + sourceResource.type + '_' + sourceProvider] = '' + sourceEndpoint + (suffix[0] === '/' ? '' : '/') + suffix;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
//get first resource in bundle (for primaryKeyName)
|
|
252
|
+
var primaryDataSourceMetadata = group.resources[0].provider.toLowerCase() === targetProvider.toLowerCase() ? targetMetadata : sourceMetadata;
|
|
253
|
+
var primarySourceResource = primaryDataSourceMetadata.find(function (metaRsc) {
|
|
254
|
+
return metaRsc.name === group.resources[0].name;
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
// via parameter, dont change because its already "type"
|
|
258
|
+
var nestedPrimaryKey = { property: rsc.primaryKeyName };
|
|
259
|
+
var primaryKeyResource = rsc.primaryKeyResource;
|
|
260
|
+
// is from a same resource (not via parameters)
|
|
261
|
+
if (primarySourceResource && primarySourceResource.name === rsc.primaryKeyResource) {
|
|
262
|
+
nestedPrimaryKey = findNestedProp(rsc.primaryKeyName, rsc.primaryKeyParents, primarySourceResource);
|
|
263
|
+
primaryKeyResource = primarySourceResource.type;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
var rscParentProvider = null;
|
|
267
|
+
if (rsc.parentNameAndProvider) {
|
|
268
|
+
var provArray = rsc.parentNameAndProvider.split('_');
|
|
269
|
+
rscParentProvider = provArray[provArray.length - 1];
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (sourceResource) {
|
|
273
|
+
return Object.assign({
|
|
274
|
+
resourceName: sourceResource.type,
|
|
275
|
+
resourceLabel: sourceResource.name,
|
|
276
|
+
resourceNameAndProvider: sourceResource.type + '_' + rsc.provider.toLowerCase(),
|
|
277
|
+
joinKeyName: nestedJoinKey.property,
|
|
278
|
+
joinKeyResource: joinKeyResource
|
|
279
|
+
}, nestedJoinKey.parentsArray && nestedJoinKey.parentsArray.length > 0 && { joinKeyParents: nestedJoinKey.parentsArray }, {
|
|
280
|
+
primaryKeyName: nestedPrimaryKey.property,
|
|
281
|
+
primaryKeyResource: primaryKeyResource
|
|
282
|
+
}, nestedPrimaryKey.parentsArray && nestedPrimaryKey.parentsArray.length > 0 && { primaryKeyParents: nestedPrimaryKey.parentsArray }, {
|
|
283
|
+
provider: rsc.provider.toLowerCase() + 'Reader',
|
|
284
|
+
joinType: rsc.joinType
|
|
285
|
+
}, rsc.recordTypeId && { recordTypeId: rsc.recordTypeId }, rsc.parameterFilters && { parameterFilters: rsc.parameterFilters.filter(function (pf) {
|
|
286
|
+
return pf.val;
|
|
287
|
+
}) }, {
|
|
288
|
+
level: rsc.level || (rscIndex === 0 ? 0 : 1)
|
|
289
|
+
}, primaryKeyResource && rscParentProvider && { parentNameAndProvider: primaryKeyResource + '_' + rscParentProvider.toLowerCase() });
|
|
290
|
+
} else return null;
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
}); //end for each bundle
|
|
294
|
+
return { bundles: bundles, mappings: mappings, endpoints: endpoints };
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
function findNestedProp(prop, parents, rsc) {
|
|
298
|
+
var property = '';
|
|
299
|
+
var parentsArray = [];
|
|
300
|
+
if (parents && parents.length > 0) {
|
|
301
|
+
(function () {
|
|
302
|
+
var nestedRsc = rsc;
|
|
303
|
+
var tempParentsArray = [];
|
|
304
|
+
parents.forEach(function (pk) {
|
|
305
|
+
if (nestedRsc.properties && nestedRsc.properties.find(function (p) {
|
|
306
|
+
return p.label === pk;
|
|
307
|
+
})) {
|
|
308
|
+
var pkProp = nestedRsc.properties.find(function (p) {
|
|
309
|
+
return p.label === pk;
|
|
310
|
+
});
|
|
311
|
+
tempParentsArray.push(pkProp.name);
|
|
312
|
+
nestedRsc = pkProp.object;
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
parentsArray = tempParentsArray;
|
|
316
|
+
if (nestedRsc.properties && nestedRsc.properties.find(function (p) {
|
|
317
|
+
return p.label === prop;
|
|
318
|
+
})) {
|
|
319
|
+
property = nestedRsc.properties.find(function (p) {
|
|
320
|
+
return p.label === prop;
|
|
321
|
+
}).name;
|
|
322
|
+
}
|
|
323
|
+
})();
|
|
324
|
+
} else {
|
|
325
|
+
property = prop && rsc && rsc.properties && rsc.properties.find(function (p) {
|
|
326
|
+
return p.label === prop;
|
|
327
|
+
}) && rsc.properties.find(function (p) {
|
|
328
|
+
return p.label === prop;
|
|
329
|
+
}).name;
|
|
330
|
+
}
|
|
331
|
+
return { property: property, parentsArray: parentsArray };
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
exports.default = saveData;
|
|
335
|
+
|
|
336
|
+
/***/ }
|
|
337
|
+
|
|
338
|
+
/******/ });
|
|
339
|
+
//# sourceMappingURL=saveData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["webpack:///webpack/bootstrap 13c2e76a2137ab533bf9?ba93******","webpack:///./src/lib/wizard/stepTypes/utils/saveData.js?b963"],"names":["saveData","resourceGroups","sP","tP","sM","tM","sourceEndpoint","isReverse","sourceProvider","targetProvider","sourceMetadata","targetMetadata","bundles","mappings","endpoints","forEach","group","index","destinationResource","find","rsc","name","type","resourceLabel","provider","toLowerCase","recordTypeId","customExternalKeys","lingkSourceKey","sourceKeys","sourceKeysObjects","lingkSourceKeyObject","sourceKeysParents","lingkSourceKeyParents","destinationKeys","properties","prop","label","dk","push","sk","i","sourceKeyResourceProvider","resources","r","dataSourceMetadata","sourceResource","metaRsc","nestedSourceKey","findNestedProp","property","JSON","stringify","parentsArray","singleMapping","dataSourceIsDestinationEntity","resourceFromName","nestedSourceProp","propertyFromName","propertyFromParents","destinationProperty","propertyToName","transformations","length","trans","splice","s","args","split","transConcatSourceResourceProvider","transConcatSourceMetadata","transConcatSourceResource","nestedFields","field","pop","transSourceApiNames","p","concat","resourceFromLabel","resourceToName","bundleIndex","isExternalKeyMapping","isDestinationResource","isUnique","every","t","map","rscIndex","nestedJoinKey","joinKeyName","joinKeyResource","joinKeyParents","suffix","endpointSuffix","primaryDataSourceMetadata","primarySourceResource","nestedPrimaryKey","primaryKeyName","primaryKeyResource","primaryKeyParents","rscParentProvider","parentNameAndProvider","provArray","resourceName","resourceNameAndProvider","joinType","parameterFilters","filter","pf","val","level","parents","nestedRsc","tempParentsArray","pk","pkProp","object"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;;;;ACtCA;;;;;;;;;;;;;AAaA,UAASA,QAAT,CAAkBC,cAAlB,EAAkCC,EAAlC,EAAsCC,EAAtC,EAA0CC,EAA1C,EAA8CC,EAA9C,EAAkDC,cAAlD,EAAkEC,SAAlE,EAA4E;;AAE1E;AACA,OAAIC,iBAAiBN,EAArB;AACA,OAAIO,iBAAiBN,EAArB;AACA,OAAIO,iBAAiBN,EAArB;AACA,OAAIO,iBAAiBN,EAArB;AACA,OAAGE,SAAH,EAAa;AACXC,sBAAiBL,EAAjB;AACAM,sBAAiBP,EAAjB;AACAQ,sBAAiBL,EAAjB;AACAM,sBAAiBP,EAAjB;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GAAhB;AACA,WAAM6F,mBAAmB,EAAzB;AACAF,eAAQhG,OAAR,CAAgB,cAAI;AAClB,aAAGiG,UAAU7E,UAAV,IACD6E,UAAU7E,UAAV,CAAqBhB,IAArB,CAA0B;AAAA,kBAAKyD,EAAEvC,KAAF,KAAU6E,EAAf;AAAA,UAA1B,CADF,EAC+C;AAC3C,eAAMC,SAASH,UAAU7E,UAAV,CAAqBhB,IAArB,CAA0B;AAAA,oBAAKyD,EAAEvC,KAAF,KAAU6E,EAAf;AAAA,YAA1B,CAAf;AACAD,4BAAiB1E,IAAjB,CAAsB4E,OAAO9F,IAA7B;AACA2F,uBAAYG,OAAOC,MAAnB;AACH;AACF,QAPD;AAQA/D,sBAAe4D,gBAAf;AACA,WAAGD,UAAU7E,UAAV,IACD6E,UAAU7E,UAAV,CAAqBhB,IAArB,CAA0B;AAAA,gBAAKyD,EAAEvC,KAAF,KAAUD,IAAf;AAAA,QAA1B,CADF,EACiD;AAC7Cc,oBAAW8D,UAAU7E,UAAV,CACRhB,IADQ,CACH;AAAA,kBAAKyD,EAAEvC,KAAF,KAAUD,IAAf;AAAA,UADG,EACkBf,IAD7B;AAEH;AAhB4B;AAiB9B,IAjBD,MAiBO;AACL6B,gBAAWd,QAAQhB,GAAR,IAAeA,IAAIe,UAAnB,IACTf,IAAIe,UAAJ,CAAehB,IAAf,CAAoB;AAAA,cAAKyD,EAAEvC,KAAF,KAAUD,IAAf;AAAA,MAApB,CADS,IAEThB,IAAIe,UAAJ,CAAehB,IAAf,CAAoB;AAAA,cAAKyD,EAAEvC,KAAF,KAAUD,IAAf;AAAA,MAApB,EAAyCf,IAF3C;AAGD;AACD,UAAO,EAAC6B,kBAAD,EAAUG,0BAAV,EAAP;AACD;;mBAEcrD,Q","file":"saveData.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 13c2e76a2137ab533bf9","/**************************\n\nSaves data from the Redux-Form and converts it to apiNames, which are used \nto generate the recipe and are stored in our DB.\n\nRuns when user click \"submit\"\n\nIf a new dropdown with fields is added to the UI, it must be added to this function as well\n\nsP = sourceProvider\ntM = targetMetadata\n**************************/\n\nfunction saveData(resourceGroups, sP, tP, sM, tM, sourceEndpoint, isReverse){\n\n // switch providers and metadatas if the wizard is reverse\n let sourceProvider = sP\n let targetProvider = tP\n let sourceMetadata = sM\n let targetMetadata = tM\n if(isReverse){\n sourceProvider = tP\n targetProvider = sP\n sourceMetadata = tM\n targetMetadata = sM\n }\n\n const bundles = resourceGroups || []\n let mappings = []\n let endpoints = {}\n bundles && bundles.forEach((group, index)=>{\n // first get target resource\n const destinationResource = targetMetadata ? \n targetMetadata.find(rsc => rsc.name===group.name) : \n group\n group.name = destinationResource.type\n group.resourceLabel = destinationResource.name\n group.provider = targetProvider.toLowerCase()\n if(destinationResource.recordTypeId){\n group.recordTypeId = destinationResource.recordTypeId\n }\n\n // destination Keys (for de-duplication in the Connect modal)\n if(!group.customExternalKeys && group.lingkSourceKey){\n group.sourceKeys=[group.lingkSourceKey]\n group.sourceKeysObjects=[group.lingkSourceKeyObject]\n group.sourceKeysParents=[group.lingkSourceKeyParents]\n group.destinationKeys=['Lingk_External_Id__c']\n } else {\n const destinationKeys = []\n if(group.destinationKeys){\n group.destinationKeys.forEach(dk=>{\n if(destinationResource && destinationResource.properties && \n destinationResource.properties.find(prop => prop.label===dk)){\n destinationKeys.push(\n destinationResource.properties.find(prop => prop.label===dk).name\n )\n }\n })\n }\n group.destinationKeys = destinationKeys\n }\n\n // get resource + name of sourceKeys\n const sourceKeys = []\n const sourceKeysObjects = []\n const sourceKeysParents = []\n group.sourceKeys && group.sourceKeys.forEach((sk,i)=>{\n const sourceKeyResourceProvider = group.resources.find(r => r.name===group.sourceKeysObjects[i]).provider\n const dataSourceMetadata = sourceKeyResourceProvider===\n targetProvider ? targetMetadata : sourceMetadata\n const sourceResource = dataSourceMetadata.find(metaRsc => metaRsc.name===group.sourceKeysObjects[i])\n \n if(sourceResource){\n\n const nestedSourceKey = findNestedProp(\n sk, group.sourceKeysParents && group.sourceKeysParents[i], sourceResource\n )\n sourceKeys.push(nestedSourceKey.property)\n sourceKeysParents.push(JSON.stringify(nestedSourceKey.parentsArray))\n sourceKeysObjects.push(sourceResource.type)\n\n }\n })\n group.sourceKeys = sourceKeys\n group.sourceKeysObjects = sourceKeysObjects\n group.sourceKeysParents = sourceKeysParents\n\n // MAPPINGS\n if(group.mappings){\n group.mappings.forEach((singleMapping)=>{\n // get mapping source resource (check both metadatas)\n let dataSourceMetadata = singleMapping.dataSourceIsDestinationEntity ?\n targetMetadata : sourceMetadata\n if(isReverse){\n dataSourceMetadata = singleMapping.dataSourceIsDestinationEntity ?\n sourceMetadata : targetMetadata\n }\n const sourceResource = dataSourceMetadata.find(rsc => rsc.name===singleMapping.resourceFromName)\n\n // get mapping source property\n const nestedSourceProp = findNestedProp(\n singleMapping.propertyFromName, singleMapping.propertyFromParents, sourceResource\n )\n //get mapping destination property\n const destinationProperty = destinationResource && destinationResource.properties && \n destinationResource.properties.find(prop => prop.label===singleMapping.propertyToName)\n\n //dont save transformation that are just \"none\"\n if(singleMapping.transformations && singleMapping.transformations.length > 0){\n singleMapping.transformations.forEach((trans, index)=>{\n if(trans.type==='none'){\n singleMapping.transformations.splice(index,1)\n }\n if(trans.type==='concat'){\n const s = trans.args[1].split('->')\n \n const transConcatSourceResourceProvider = group.resources.find(r => \n r.name===s[0]).provider.toLowerCase()\n const transConcatSourceMetadata = transConcatSourceResourceProvider===\n targetProvider.toLowerCase() ? targetMetadata : sourceMetadata\n const transConcatSourceResource = transConcatSourceMetadata.find(rsc => \n rsc.name===s[0])\n\n const nestedFields = s[1].split('.')\n const field = nestedFields[nestedFields.length-1]\n nestedFields.pop()\n const transSourceApiNames = findNestedProp(\n field, nestedFields, transConcatSourceResource\n )\n var r = `${transConcatSourceResourceProvider}->${transConcatSourceResource.type}->`\n transSourceApiNames.parentsArray.forEach(p=>r+=`${p}.`)\n r += transSourceApiNames.property\n trans.args[1] = r\n }\n })\n }\n\n if(sourceResource && nestedSourceProp.property && \n destinationResource && destinationProperty) {\n mappings = mappings.concat({ // add to mappings obj\n resourceFromLabel: singleMapping.dataSourceIsDestinationEntity ?\n `${sourceResource.type}_${targetProvider.toLowerCase()}` : \n `${sourceResource.type}_${sourceProvider.toLowerCase()}`,\n resourceFromName: sourceResource.type,\n propertyFromName: nestedSourceProp.property,\n ...(nestedSourceProp.parentsArray && nestedSourceProp.parentsArray.length>0) && \n {propertyFromParents: nestedSourceProp.parentsArray},\n resourceToName: destinationResource.type,\n propertyToName: destinationProperty.name,\n bundleIndex: index,\n ...singleMapping.isExternalKeyMapping && {isExternalKeyMapping: true},\n ...singleMapping.dataSourceIsDestinationEntity && {isDestinationResource: true},\n ...singleMapping.isUnique && {isUnique: true},\n ...singleMapping.transformations && singleMapping.transformations.length > 0 &&\n !singleMapping.transformations.every(t=>t.type==='none') &&\n {transformations: singleMapping.transformations}\n })\n }\n })\n delete group.mappings // remove the mapping obj from a resourceGroup\n if (group.lingkSourceKey) delete group.lingkSourceKey\n if (group.lingkSourceKeyObject) delete group.lingkSourceKeyObject\n if (group.lingkSourceKeyParents) delete group.lingkSourceKeyParents\n }\n\n // BUNDLES\n if(group.resources){\n group.resources = group.resources.map((rsc, rscIndex)=>{\n //get resource source (check both metadatas)\n const dataSourceMetadata = rsc.provider.toLowerCase()===targetProvider.toLowerCase() ? targetMetadata : sourceMetadata\n const sourceResource = dataSourceMetadata.find(metaRsc => metaRsc.name===rsc.name)\n // via parameter, dont change because its already \"type\"\n let nestedJoinKey = {property: rsc.joinKeyName}\n let joinKeyResource = rsc.joinKeyResource\n // is from a same resource (not via parameters)\n if(sourceResource && sourceResource.name===rsc.joinKeyResource){\n nestedJoinKey = findNestedProp(\n rsc.joinKeyName, rsc.joinKeyParents, sourceResource\n )\n joinKeyResource = sourceResource.type\n }\n\n //make endpoint\n const suffix = sourceResource && sourceResource.endpointSuffix\n if(suffix){\n endpoints[`url_${sourceResource.type}_${sourceProvider}`] = \n `${sourceEndpoint}${suffix[0]==='/'?'':'/'}${suffix}`\n }\n\n //get first resource in bundle (for primaryKeyName)\n const primaryDataSourceMetadata = group.resources[0].provider.toLowerCase()===\n targetProvider.toLowerCase() ? targetMetadata : sourceMetadata\n const primarySourceResource = primaryDataSourceMetadata.find(metaRsc => metaRsc.name===group.resources[0].name)\n\n // via parameter, dont change because its already \"type\"\n let nestedPrimaryKey = {property: rsc.primaryKeyName}\n let primaryKeyResource = rsc.primaryKeyResource\n // is from a same resource (not via parameters)\n if(primarySourceResource && primarySourceResource.name===rsc.primaryKeyResource){\n nestedPrimaryKey = findNestedProp(\n rsc.primaryKeyName, rsc.primaryKeyParents, primarySourceResource\n )\n primaryKeyResource = primarySourceResource.type\n }\n\n let rscParentProvider = null\n if(rsc.parentNameAndProvider){\n const provArray = rsc.parentNameAndProvider.split('_')\n rscParentProvider = provArray[provArray.length-1]\n }\n\n if(sourceResource){\n return {\n resourceName: sourceResource.type,\n resourceLabel: sourceResource.name,\n resourceNameAndProvider: sourceResource.type + '_' + rsc.provider.toLowerCase(),\n joinKeyName: nestedJoinKey.property,\n joinKeyResource,\n ...(nestedJoinKey.parentsArray && nestedJoinKey.parentsArray.length>0) && \n {joinKeyParents: nestedJoinKey.parentsArray},\n primaryKeyName: nestedPrimaryKey.property,\n primaryKeyResource,\n ...(nestedPrimaryKey.parentsArray && nestedPrimaryKey.parentsArray.length>0) && \n {primaryKeyParents: nestedPrimaryKey.parentsArray},\n provider: rsc.provider.toLowerCase() + 'Reader',\n joinType: rsc.joinType,\n ...rsc.recordTypeId && {recordTypeId: rsc.recordTypeId},\n ...rsc.parameterFilters && {parameterFilters: rsc.parameterFilters\n .filter(pf=>pf.val)},\n level: rsc.level || (rscIndex===0 ? 0 : 1),\n ...primaryKeyResource && rscParentProvider && \n {parentNameAndProvider: `${primaryKeyResource}_${rscParentProvider.toLowerCase()}`}\n }\n } else return null\n })\n }\n \n })//end for each bundle\n return {bundles, mappings, endpoints}\n}\n\nfunction findNestedProp(prop, parents, rsc) {\n let property = ''\n let parentsArray = []\n if(parents && parents.length>0){\n let nestedRsc = rsc\n const tempParentsArray = []\n parents.forEach(pk=>{\n if(nestedRsc.properties && \n nestedRsc.properties.find(p => p.label===pk)){\n const pkProp = nestedRsc.properties.find(p => p.label===pk)\n tempParentsArray.push(pkProp.name)\n nestedRsc = pkProp.object\n }\n })\n parentsArray = tempParentsArray\n if(nestedRsc.properties && \n nestedRsc.properties.find(p => p.label===prop)){\n property = nestedRsc.properties\n .find(p => p.label===prop).name\n }\n } else {\n property = prop && rsc && rsc.properties && \n rsc.properties.find(p => p.label===prop) &&\n rsc.properties.find(p => p.label===prop).name\n }\n return {property,parentsArray}\n}\n\nexport default saveData\n\n\n\n// WEBPACK FOOTER //\n// ./src/lib/wizard/stepTypes/utils/saveData.js"],"sourceRoot":""}
|