@lingk/sync 1.1.49 → 1.1.51

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/saveData.js DELETED
@@ -1,369 +0,0 @@
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__(54);
50
-
51
-
52
- /***/ },
53
-
54
- /***/ 54:
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, 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
-
92
- bundles && bundles.forEach(function (group, index) {
93
-
94
- // first get target resource
95
- var destinationResource = targetMetadata ? targetMetadata.find(function (rsc) {
96
- return rsc.name === group.name;
97
- }) : group;
98
- group.name = destinationResource.type;
99
- group.resourceLabel = destinationResource.name;
100
- group.provider = targetProvider.toLowerCase();
101
- /*if(destinationResource.recordTypeId){
102
- group.recordTypeId = destinationResource.recordTypeId
103
- }*/
104
-
105
- // destination Keys (for de-duplication in the Connect modal)
106
- if (!group.customExternalKeys && group.lingkSourceKey) {
107
- group.sourceKeys = [group.lingkSourceKey];
108
- group.sourceKeysObjects = [group.lingkSourceKeyObject];
109
- group.sourceKeysParents = [group.lingkSourceKeyParents];
110
- group.destinationKeys = ['Lingk_External_Id__c'];
111
- } else {
112
- var destinationKeys = [];
113
- var destinationKeysParents = [];
114
- if (group.destinationKeys) {
115
- group.destinationKeys.forEach(function (dk, i) {
116
- /*if(destinationResource && destinationResource.properties &&
117
- destinationResource.properties.find(prop => prop.label===dk)){
118
- destinationKeys.push(
119
- destinationResource.properties.find(prop => prop.label===dk).name
120
- )
121
- }*/
122
- var nestedDestinationKey = findNestedProp(dk, group.destinationKeysParents && group.destinationKeysParents[i], destinationResource);
123
- if (nestedDestinationKey.property) {
124
- destinationKeys.push(nestedDestinationKey.property);
125
- destinationKeysParents.push(JSON.stringify(nestedDestinationKey.parentsArray));
126
- }
127
- });
128
- }
129
- group.destinationKeys = destinationKeys;
130
- group.destinationKeysParents = destinationKeysParents;
131
- }
132
-
133
- // get resource + name of sourceKeys
134
- var sourceKeys = [];
135
- var sourceKeysObjects = [];
136
- var sourceKeysParents = [];
137
- group.sourceKeys && group.sourceKeys.forEach(function (sk, i) {
138
- var sourceKeyResourceProvider = group.resources.find(function (r) {
139
- return r.name === group.sourceKeysObjects[i];
140
- }).provider;
141
- var dataSourceMetadata = sourceKeyResourceProvider.toLowerCase() === targetProvider.toLowerCase() ? targetMetadata : sourceMetadata;
142
- var sourceResource = dataSourceMetadata.find(function (metaRsc) {
143
- return metaRsc.name === group.sourceKeysObjects[i];
144
- });
145
-
146
- if (sourceResource) {
147
- var nestedSourceKey = findNestedProp(sk, group.sourceKeysParents && group.sourceKeysParents[i], sourceResource);
148
- if (nestedSourceKey.property) {
149
- sourceKeys.push(nestedSourceKey.property);
150
- sourceKeysParents.push(JSON.stringify(nestedSourceKey.parentsArray));
151
- sourceKeysObjects.push(sourceResource.type);
152
- }
153
- }
154
- });
155
- group.sourceKeys = sourceKeys;
156
- group.sourceKeysObjects = sourceKeysObjects;
157
- group.sourceKeysParents = sourceKeysParents;
158
-
159
- // MAPPINGS
160
- if (group.mappings) {
161
- group.mappings.forEach(function (singleMapping) {
162
- // get mapping source resource (check both metadatas)
163
- var dataSourceMetadata = singleMapping.dataSourceIsDestinationEntity ? targetMetadata : sourceMetadata;
164
- if (isReverse) {
165
- dataSourceMetadata = singleMapping.dataSourceIsDestinationEntity ? sourceMetadata : targetMetadata;
166
- }
167
- var sourceResource = dataSourceMetadata.find(function (rsc) {
168
- return rsc.name === singleMapping.resourceFromName;
169
- });
170
- // get mapping source property
171
- var nestedSourceProp = findNestedProp(singleMapping.propertyFromName, singleMapping.propertyFromParents, sourceResource);
172
-
173
- //get mapping destination property
174
- var nestedDestinationProp = findNestedProp(singleMapping.propertyToName, singleMapping.propertyToParents, destinationResource);
175
-
176
- //dont save transformation that are just "none"
177
- if (singleMapping.transformations && singleMapping.transformations.length > 0) {
178
- singleMapping.transformations.forEach(function (trans, index) {
179
- if (trans.type === 'none') {
180
- singleMapping.transformations.splice(index, 1);
181
- }
182
- if (trans.type === 'concat') {
183
- var s = trans.args[1].split('->');
184
-
185
- var transConcatSourceResourceProvider = group.resources.find(function (r) {
186
- return r.name === s[0];
187
- }).provider.toLowerCase();
188
- var transConcatSourceMetadata = transConcatSourceResourceProvider === targetProvider.toLowerCase() ? targetMetadata : sourceMetadata;
189
- var transConcatSourceResource = transConcatSourceMetadata.find(function (rsc) {
190
- return rsc.name === s[0];
191
- });
192
-
193
- var nestedFields = s[1].split('.');
194
- var field = nestedFields[nestedFields.length - 1];
195
- nestedFields.pop();
196
- var transSourceApiNames = findNestedProp(field, nestedFields, transConcatSourceResource);
197
- var r = transConcatSourceResourceProvider + '->' + transConcatSourceResource.type + '->';
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
- if (sourceResource && nestedSourceProp.property && destinationResource && nestedDestinationProp.property) {
208
- mappings = mappings.concat(Object.assign({ // add to mappings obj
209
- resourceFromNameAndProvider: singleMapping.dataSourceIsDestinationEntity ? sourceResource.type + '_' + targetProvider.toLowerCase() : sourceResource.type + '_' + sourceProvider.toLowerCase(),
210
- resourceFromName: sourceResource.type,
211
- resourceFromLabel: sourceResource.name,
212
- propertyFromName: nestedSourceProp.property,
213
- propertyFromLabel: nestedSourceProp.__property
214
- }, nestedSourceProp.parentsArray && nestedSourceProp.parentsArray.length > 0 && { propertyFromParents: nestedSourceProp.parentsArray }, {
215
- resourceToName: destinationResource.type,
216
- resourceToLabel: destinationResource.name,
217
- propertyToName: nestedDestinationProp.property,
218
- propertyToLabel: nestedDestinationProp.__property
219
- }, nestedDestinationProp.parentsArray && nestedDestinationProp.parentsArray.length > 0 && { propertyToParents: nestedDestinationProp.parentsArray }, {
220
- bundleIndex: index
221
- }, singleMapping.isExternalKeyMapping && { isExternalKeyMapping: true }, singleMapping.dataSourceIsDestinationEntity && { isDestinationResource: true }, singleMapping.isUnique && { isUnique: true }, singleMapping.transformations && singleMapping.transformations.length > 0 && !singleMapping.transformations.every(function (t) {
222
- return t.type === 'none';
223
- }) && { transformations: singleMapping.transformations }));
224
- }
225
- });
226
- delete group.mappings; // remove the mapping obj from a resourceGroup
227
- if (group.lingkSourceKey) delete group.lingkSourceKey;
228
- if (group.lingkSourceKeyObject) delete group.lingkSourceKeyObject;
229
- if (group.lingkSourceKeyParents) {
230
- delete group.lingkSourceKeyParents;
231
- delete group.destinationKeysParents;
232
- }
233
- }
234
-
235
- // BUNDLES
236
- if (group.resources) {
237
- group.resources = group.resources.map(function (rsc, rscIndex) {
238
- //get resource source (check both metadatas)
239
- var dataSourceMetadata = rsc.provider.toLowerCase() === targetProvider.toLowerCase() ? targetMetadata : sourceMetadata;
240
- var sourceResource = dataSourceMetadata.find(function (metaRsc) {
241
- return metaRsc.name === rsc.name;
242
- });
243
- // via parameter, dont change because its already "type"
244
- var nestedJoinKey = { property: rsc.joinKeyName };
245
- var joinKeyResource = rsc.joinKeyResource;
246
- var joinKeyIsParameter = false;
247
- if (sourceResource && rsc.joinKeyResource) {
248
- // is from a same resource (not via parameters)
249
- if (sourceResource.name === rsc.joinKeyResource) {
250
- nestedJoinKey = findNestedProp(rsc.joinKeyName, rsc.joinKeyParents, sourceResource);
251
- joinKeyResource = sourceResource.type;
252
- } else {
253
- joinKeyIsParameter = true;
254
- }
255
- }
256
-
257
- //make endpoint
258
- /*const suffix = sourceResource && sourceResource.endpointSuffix
259
- if(suffix){
260
- endpoints[`url_${sourceResource.type}_${sourceProvider}`] =
261
- `${sourceEndpoint}${suffix[0]==='/'?'':'/'}${suffix}`
262
- }*/
263
-
264
- //get first resource in bundle (for primaryKeyName)
265
- var nestedPrimaryKey = {};
266
- var primaryKeyResource = null;
267
- var primaryResourceProvider = null;
268
- var primaryKeyIsParameter = false;
269
- if (rsc.parentNameAndProvider) {
270
- var primaryResourceProviderLast_Index = rsc.parentNameAndProvider.lastIndexOf('_');
271
- primaryResourceProvider = rsc.parentNameAndProvider.substr(primaryResourceProviderLast_Index + 1, rsc.parentNameAndProvider.length);
272
- var primaryResourceName = rsc.parentNameAndProvider.substr(0, primaryResourceProviderLast_Index);
273
- var primaryDataSourceMetadata = primaryResourceProvider.toLowerCase() === targetProvider.toLowerCase() ? targetMetadata : sourceMetadata;
274
- var primarySourceResource = primaryDataSourceMetadata.find(function (metaRsc) {
275
- return metaRsc.name === rsc.primaryKeyResource;
276
- });
277
-
278
- if (primarySourceResource) {
279
- if (primaryResourceName === rsc.primaryKeyResource) {
280
- nestedPrimaryKey = findNestedProp(rsc.primaryKeyName, rsc.primaryKeyParents, primarySourceResource);
281
- primaryKeyResource = primarySourceResource.type;
282
- } else {
283
- // is from a different resource (parameter)
284
- primaryKeyIsParameter = true;
285
- nestedPrimaryKey = { property: rsc.primaryKeyName };
286
- primaryKeyResource = rsc.primaryKeyResource;
287
- }
288
- }
289
- }
290
-
291
- if (sourceResource) {
292
- return {
293
- resourceName: sourceResource.type,
294
- resourceLabel: sourceResource.name,
295
- resourceNameAndProvider: sourceResource.type + '_' + rsc.provider.toLowerCase(),
296
- joinKeyName: nestedJoinKey.property,
297
- joinKeyResource: joinKeyResource,
298
- joinKeyParents: nestedJoinKey.parentsArray && nestedJoinKey.parentsArray.length > 0 ? nestedJoinKey.parentsArray : [],
299
- joinKeyIsParameter: joinKeyIsParameter,
300
- primaryKeyName: nestedPrimaryKey.property,
301
- primaryKeyResource: primaryKeyResource,
302
- primaryKeyParents: nestedPrimaryKey.parentsArray && nestedPrimaryKey.parentsArray.length > 0 ? nestedPrimaryKey.parentsArray : [],
303
- primaryKeyIsParameter: primaryKeyIsParameter,
304
- provider: rsc.provider.toLowerCase() + 'Reader',
305
- joinType: rsc.joinType,
306
- parameterFilters: rsc.parameterFilters ? rsc.parameterFilters.filter(function (pf) {
307
- return pf.val;
308
- }) : [],
309
- level: rsc.level || (rscIndex === 0 ? 0 : 1),
310
- // THIS ONE IS ACTUALLY PARENT LABEL AND PROVIDER!
311
- // So we know what Account to join to (if they have the same Name)
312
- parentNameAndProvider: rsc.parentNameAndProvider
313
- };
314
- } else return null;
315
- });
316
- }
317
- }); //end for each bundle
318
- return { bundles: bundles, mappings: mappings };
319
- }
320
-
321
- function findNestedProp(prop, parents, rsc) {
322
- var property = '';
323
- var __property = '';
324
- var parentsArray = [];
325
- if (parents && parents.length > 0) {
326
- var nestedRsc = rsc;
327
- var tempParentsArray = [];
328
- parents.forEach(function (pk) {
329
- if (nestedRsc.properties && nestedRsc.properties.find(function (p) {
330
- return p.label === pk;
331
- })) {
332
- var pkProp = nestedRsc.properties.find(function (p) {
333
- return p.label === pk;
334
- });
335
- tempParentsArray.push(pkProp.name);
336
- nestedRsc = pkProp.object;
337
- }
338
- });
339
- parentsArray = tempParentsArray;
340
- if (nestedRsc.properties && nestedRsc.properties.find(function (p) {
341
- return p.label === prop;
342
- })) {
343
- var theProp = nestedRsc.properties.find(function (p) {
344
- return p.label === prop;
345
- });
346
- property = theProp.name;
347
- __property = theProp.label;
348
- }
349
- } else {
350
- if (prop === 'Lingk External Id') {
351
- property = 'Lingk_External_Id__c';
352
- __property = prop;
353
- } else {
354
- var _theProp = prop && rsc && rsc.properties && rsc.properties.find(function (p) {
355
- return p.label === prop;
356
- });
357
- property = _theProp.name;
358
- __property = _theProp.label;
359
- }
360
- }
361
- return { property: property, parentsArray: parentsArray, __property: __property };
362
- }
363
-
364
- exports.default = saveData;
365
-
366
- /***/ }
367
-
368
- /******/ });
369
- //# sourceMappingURL=saveData.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap 98069d81b39d41c0199b?b070*******","webpack:///./src/lib/wizard/stepTypes/utils/saveData.js?b963"],"names":["saveData","resourceGroups","sP","tP","sM","tM","isReverse","sourceProvider","targetProvider","sourceMetadata","targetMetadata","bundles","mappings","forEach","group","index","destinationResource","find","rsc","name","type","resourceLabel","provider","toLowerCase","customExternalKeys","lingkSourceKey","sourceKeys","sourceKeysObjects","lingkSourceKeyObject","sourceKeysParents","lingkSourceKeyParents","destinationKeys","destinationKeysParents","dk","i","nestedDestinationKey","findNestedProp","property","push","JSON","stringify","parentsArray","sk","sourceKeyResourceProvider","resources","r","dataSourceMetadata","sourceResource","metaRsc","nestedSourceKey","singleMapping","dataSourceIsDestinationEntity","resourceFromName","nestedSourceProp","propertyFromName","propertyFromParents","nestedDestinationProp","propertyToName","propertyToParents","transformations","length","trans","splice","s","args","split","transConcatSourceResourceProvider","transConcatSourceMetadata","transConcatSourceResource","nestedFields","field","pop","transSourceApiNames","p","concat","resourceFromNameAndProvider","resourceFromLabel","propertyFromLabel","__property","resourceToName","resourceToLabel","propertyToLabel","bundleIndex","isExternalKeyMapping","isDestinationResource","isUnique","every","t","map","rscIndex","nestedJoinKey","joinKeyName","joinKeyResource","joinKeyIsParameter","joinKeyParents","nestedPrimaryKey","primaryKeyResource","primaryResourceProvider","primaryKeyIsParameter","parentNameAndProvider","primaryResourceProviderLast_Index","lastIndexOf","substr","primaryResourceName","primaryDataSourceMetadata","primarySourceResource","primaryKeyName","primaryKeyParents","resourceName","resourceNameAndProvider","joinType","parameterFilters","filter","pf","val","level","prop","parents","nestedRsc","tempParentsArray","properties","label","pk","pkProp","object","theProp"],"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,SAAlD,EAA4D;;AAE1D;AACA,OAAIC,iBAAiBL,EAArB;AACA,OAAIM,iBAAi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J,KAArB;AACH;AACF,IAjBD,MAiBO;AACL,SAAGL,SAAO,mBAAV,EAA+B;AAC7B/E,kBAAS,sBAAT;AACAyC,oBAAasC,IAAb;AACD,MAHD,MAGO;AACL,WAAMS,WAAUT,QAAQlG,GAAR,IAAeA,IAAIsG,UAAnB,IAAiCtG,IAAIsG,UAAJ,CAAevG,IAAf,CAAoB;AAAA,gBAAKwD,EAAEgD,KAAF,KAAUL,IAAf;AAAA,QAApB,CAAjD;AACA/E,kBAAWwF,SAAQ1G,IAAnB;AACA2D,oBAAa+C,SAAQJ,KAArB;AACD;AACF;AACD,UAAO,EAACpF,kBAAD,EAAUI,0BAAV,EAAuBqC,sBAAvB,EAAP;AACD;;mBAEc9E,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 98069d81b39d41c0199b","/**************************\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, 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\n bundles && bundles.forEach((group, index)=>{\n\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 const destinationKeysParents = []\n if(group.destinationKeys){\n group.destinationKeys.forEach((dk,i)=>{\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 const nestedDestinationKey = findNestedProp(\n dk, group.destinationKeysParents && group.destinationKeysParents[i], destinationResource\n )\n if(nestedDestinationKey.property){\n destinationKeys.push(nestedDestinationKey.property)\n destinationKeysParents.push(JSON.stringify(nestedDestinationKey.parentsArray))\n }\n })\n }\n group.destinationKeys = destinationKeys\n group.destinationKeysParents = destinationKeysParents\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.toLowerCase()===\n targetProvider.toLowerCase() ? targetMetadata : sourceMetadata\n const sourceResource = dataSourceMetadata.find(metaRsc => metaRsc.name===group.sourceKeysObjects[i])\n \n if(sourceResource){\n const nestedSourceKey = findNestedProp(\n sk, group.sourceKeysParents && group.sourceKeysParents[i], sourceResource\n )\n if(nestedSourceKey.property){\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\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 // get mapping source property\n const nestedSourceProp = findNestedProp(\n singleMapping.propertyFromName, singleMapping.propertyFromParents, sourceResource\n )\n\n //get mapping destination property\n const nestedDestinationProp = findNestedProp(\n singleMapping.propertyToName, singleMapping.propertyToParents, destinationResource\n )\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 && nestedDestinationProp.property) {\n mappings = mappings.concat({ // add to mappings obj\n resourceFromNameAndProvider: singleMapping.dataSourceIsDestinationEntity ?\n `${sourceResource.type}_${targetProvider.toLowerCase()}` : \n `${sourceResource.type}_${sourceProvider.toLowerCase()}`,\n resourceFromName: sourceResource.type,\n resourceFromLabel: sourceResource.name,\n propertyFromName: nestedSourceProp.property,\n propertyFromLabel: nestedSourceProp.__property,\n ...(nestedSourceProp.parentsArray && nestedSourceProp.parentsArray.length>0) && \n {propertyFromParents: nestedSourceProp.parentsArray},\n resourceToName: destinationResource.type,\n resourceToLabel: destinationResource.name,\n propertyToName: nestedDestinationProp.property,\n propertyToLabel: nestedDestinationProp.__property,\n ...(nestedDestinationProp.parentsArray && \n nestedDestinationProp.parentsArray.length>0) && \n {propertyToParents: nestedDestinationProp.parentsArray},\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) {\n delete group.lingkSourceKeyParents\n delete group.destinationKeysParents\n }\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 let joinKeyIsParameter = false\n if(sourceResource && rsc.joinKeyResource){\n // is from a same resource (not via parameters)\n if(sourceResource.name===rsc.joinKeyResource) {\n nestedJoinKey = findNestedProp(\n rsc.joinKeyName, rsc.joinKeyParents, sourceResource\n )\n joinKeyResource = sourceResource.type\n } else {\n joinKeyIsParameter = true\n }\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 let nestedPrimaryKey = {}\n let primaryKeyResource = null\n let primaryResourceProvider = null\n let primaryKeyIsParameter = false\n if(rsc.parentNameAndProvider){\n const primaryResourceProviderLast_Index = rsc.parentNameAndProvider.lastIndexOf('_')\n primaryResourceProvider = rsc.parentNameAndProvider\n .substr(primaryResourceProviderLast_Index+1, rsc.parentNameAndProvider.length)\n const primaryResourceName = rsc.parentNameAndProvider\n .substr(0, primaryResourceProviderLast_Index)\n const primaryDataSourceMetadata = primaryResourceProvider.toLowerCase()===\n targetProvider.toLowerCase() ? targetMetadata : sourceMetadata\n const primarySourceResource = primaryDataSourceMetadata.find(metaRsc => metaRsc.name===rsc.primaryKeyResource)\n\n if(primarySourceResource){\n if(primaryResourceName===rsc.primaryKeyResource){\n nestedPrimaryKey = findNestedProp(\n rsc.primaryKeyName, rsc.primaryKeyParents, primarySourceResource\n )\n primaryKeyResource = primarySourceResource.type\n } else {\n // is from a different resource (parameter)\n primaryKeyIsParameter = true\n nestedPrimaryKey = {property: rsc.primaryKeyName}\n primaryKeyResource = rsc.primaryKeyResource\n }\n }\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 joinKeyParents: nestedJoinKey.parentsArray && nestedJoinKey.parentsArray.length>0 ? \n nestedJoinKey.parentsArray : [],\n joinKeyIsParameter,\n primaryKeyName: nestedPrimaryKey.property,\n primaryKeyResource,\n primaryKeyParents : nestedPrimaryKey.parentsArray && nestedPrimaryKey.parentsArray.length>0 ? nestedPrimaryKey.parentsArray : [],\n primaryKeyIsParameter,\n provider: rsc.provider.toLowerCase() + 'Reader',\n joinType: rsc.joinType,\n parameterFilters: rsc.parameterFilters ? rsc.parameterFilters.filter(pf=>pf.val) : [],\n level: rsc.level || (rscIndex===0 ? 0 : 1),\n // THIS ONE IS ACTUALLY PARENT LABEL AND PROVIDER!\n // So we know what Account to join to (if they have the same Name)\n parentNameAndProvider: rsc.parentNameAndProvider\n }\n } else return null\n })\n }\n \n })//end for each bundle\n return {bundles, mappings}\n}\n\nfunction findNestedProp(prop, parents, rsc) {\n let property = ''\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 && nestedRsc.properties.find(p => p.label===prop)){\n const theProp = nestedRsc.properties.find(p => p.label===prop)\n property = theProp.name\n __property = theProp.label\n }\n } else {\n if(prop==='Lingk External Id') {\n property='Lingk_External_Id__c'\n __property = prop\n } else {\n const theProp = prop && rsc && rsc.properties && rsc.properties.find(p => p.label===prop)\n property = theProp.name\n __property = theProp.label\n }\n }\n return {property,parentsArray,__property}\n}\n\nexport default saveData\n\n\n\n// WEBPACK FOOTER //\n// ./src/lib/wizard/stepTypes/utils/saveData.js"],"sourceRoot":""}