@lingk/sync 0.0.70 → 0.0.71

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/main.js CHANGED
@@ -16923,6 +16923,8 @@ module.exports =
16923
16923
  value: true
16924
16924
  });
16925
16925
  exports.callCheckConnection = callCheckConnection;
16926
+ exports.createLingkExternalIds = createLingkExternalIds;
16927
+ exports.callTest = callTest;
16926
16928
  exports.callAddCustomField = callAddCustomField;
16927
16929
  exports.callGetScenario = callGetScenario;
16928
16930
  exports.callPreviewIntegration = callPreviewIntegration;
@@ -16988,6 +16990,53 @@ module.exports =
16988
16990
  };
16989
16991
  }
16990
16992
 
16993
+ function createLingkExternalIds(bundles, destinationMetadata) {
16994
+ return function (dispatch, getState, api) {
16995
+
16996
+ var externalIdlessObjects = [];
16997
+ bundles.forEach(function (b) {
16998
+ if (!b.customExternalKeys) {
16999
+ var rsc = destinationMetadata.find(function (r) {
17000
+ return r.type === b.name;
17001
+ });
17002
+ var externalIdProp = rsc.properties && rsc.properties.find(function (p) {
17003
+ return p.name === 'lingk__Lingk_External_Id__c';
17004
+ });
17005
+ // only add to the array if Lingk External Id does not already exist
17006
+ if (!externalIdProp) {
17007
+ externalIdlessObjects.push({
17008
+ objectType: b.name,
17009
+ fieldName: 'lingk__Lingk_External_Id__c',
17010
+ fieldLabel: 'Lingk External Id'
17011
+ });
17012
+ }
17013
+ }
17014
+ });
17015
+
17016
+ return Promise.all(externalIdlessObjects.map(function (o) {
17017
+ return callTest(1); // this will be callAddCustomField
17018
+ })).then(function (r) {
17019
+ return r;
17020
+ });
17021
+ };
17022
+ }
17023
+
17024
+ // "asyncFunction" will be the actual js remote function in salesforce
17025
+ function asyncFunction(v, callback) {
17026
+ setTimeout(function () {
17027
+ return callback(v * 2);
17028
+ }, 1000);
17029
+ }
17030
+
17031
+ // callAddCustomField will look like this actually
17032
+ function callTest(v, completedCallback) {
17033
+ return new Promise(function (resolve) {
17034
+ return asyncFunction(v, function (r) {
17035
+ return resolve(r * 2);
17036
+ });
17037
+ });
17038
+ }
17039
+
16991
17040
  function callAddCustomField(objectType, fieldName, fieldLabel, completedCallback) {
16992
17041
  return function (dispatch, getState, api) {
16993
17042
  var _getState2 = getState(),
@@ -16998,8 +17047,8 @@ module.exports =
16998
17047
  return api.get('transformer/versions/1606/latest', {
16999
17048
  endpoint: TRANS_API_URL
17000
17049
  }).then(function (res) {
17001
- console.log(res);
17002
17050
  completedCallback();
17051
+ return res;
17003
17052
  });
17004
17053
  };
17005
17054
  }
@@ -17128,26 +17177,33 @@ module.exports =
17128
17177
 
17129
17178
  function submitWizardData(tenantId, appId, bundles, mappings, configuration, title, deployment, typeGuid, onGenerate, onFinish, destinationMetadata) {
17130
17179
  return function (dispatch) {
17131
- dispatch(callPostBundles(tenantId, appId, bundles)).then(function (bundlePack) {
17132
- dispatch(callPostMapping(tenantId, appId, mappings)).then(function (map) {
17133
- dispatch(callPostProductizedIntegration(tenantId, appId, map.schemaMappingGuid, bundlePack.bundlePackGuid, configuration, title, typeGuid)).then(function (pi) {
17134
- if (map.mappings && map.mappings.length > 0 && deployment) {
17135
- dispatch(callGenerateRecipe(tenantId, appId, typeGuid, title, pi.productizedIntegrationGuid, map.schemaMappingGuid, destinationMetadata)).then(function (generatedRecipe) {
17136
- onGenerate();
17137
- if (deployment) {
17138
- if (deployment.type === 'once') {
17139
- dispatch(callDeployTrigger(generatedRecipe, pi.productizedIntegrationGuid, map.schemaMappingGuid)); //deploy anyway, so user can schedule later
17140
- dispatch(callExecuteTransformer(generatedRecipe.Id)).then(function (response) {
17141
- dispatch(callLookupLogData(response.externalExecutionId, 0, onFinish, generatedRecipe, pi.productizedIntegrationGuid, map.schemaMappingGuid));
17142
- });
17143
- } else {
17144
- dispatch(callSaveTrigger(deployment, onFinish, generatedRecipe, pi.productizedIntegrationGuiduid, map.schemaMappingGuiduid));
17145
- }
17146
- }
17147
- });
17148
- } // end if
17180
+
17181
+ /*dispatch(createLingkExternalIds(bundles, destinationMetadata))
17182
+ .then(res=>{
17183
+ console.log(res)
17184
+ return dispatch(callAddCustomField('', '', '', ()=>{}))
17185
+ })
17186
+ .then(res2=>console.log('res2',res2))*/
17187
+ var map = {};
17188
+ return Promise.all([dispatch(callPostBundles(tenantId, appId, bundles)), dispatch(callPostMapping(tenantId, appId, mappings))]).then(function (r) {
17189
+ map = r[1];
17190
+ return dispatch(callPostProductizedIntegration(tenantId, appId, map.schemaMappingGuid, r[0].bundlePackGuid, configuration, title, typeGuid));
17191
+ }).then(function (pi) {
17192
+ if (map.mappings && map.mappings.length > 0 && deployment) {
17193
+ dispatch(callGenerateRecipe(tenantId, appId, typeGuid, title, pi.productizedIntegrationGuid, map.schemaMappingGuid, destinationMetadata)).then(function (generatedRecipe) {
17194
+ onGenerate();
17195
+ if (deployment) {
17196
+ if (deployment.type === 'once') {
17197
+ dispatch(callDeployTrigger(generatedRecipe, pi.productizedIntegrationGuid, map.schemaMappingGuid)); //deploy anyway, so user can schedule later
17198
+ dispatch(callExecuteTransformer(generatedRecipe.Id)).then(function (response) {
17199
+ dispatch(callLookupLogData(response.externalExecutionId, 0, onFinish, generatedRecipe, pi.productizedIntegrationGuid, map.schemaMappingGuid));
17200
+ });
17201
+ } else {
17202
+ dispatch(callSaveTrigger(deployment, onFinish, generatedRecipe, pi.productizedIntegrationGuiduid, map.schemaMappingGuiduid));
17203
+ }
17204
+ }
17149
17205
  });
17150
- });
17206
+ } // end if mappings && deployment
17151
17207
  });
17152
17208
  };
17153
17209
  }
@@ -20241,7 +20297,7 @@ module.exports =
20241
20297
  }
20242
20298
  }, {
20243
20299
  key: 'onSelectDestinationField',
20244
- value: function onSelectDestinationField(group, field) {
20300
+ value: function onSelectDestinationField(group, field, format) {
20245
20301
  var _props2 = this.props,
20246
20302
  change = _props2.change,
20247
20303
  formValues = _props2.formValues,
@@ -20258,6 +20314,12 @@ module.exports =
20258
20314
  return m.propertyToName === field && m.isExternalKeyMapping;
20259
20315
  })) return;
20260
20316
 
20317
+ var transform = 'none';
20318
+ if (format) {
20319
+ if (format === 'date-time') {
20320
+ transform = 'date';
20321
+ }
20322
+ }
20261
20323
  //cant map multiple to same destination field
20262
20324
  rscGroup.mappings = rscGroup.mappings && rscGroup.mappings.filter(function (m) {
20263
20325
  return m.propertyToName !== field;
@@ -20267,7 +20329,7 @@ module.exports =
20267
20329
  resourceToName: group,
20268
20330
  propertyFromName: this.state.selectedField,
20269
20331
  propertyToName: field,
20270
- transformations: [{ type: 'none' }],
20332
+ transformations: [{ type: transform }],
20271
20333
  dataSourceIsDestinationEntity: selectedEntity.isDestinationEntity
20272
20334
  });
20273
20335
  change('resourceGroups', resourceGroups);
@@ -20478,7 +20540,7 @@ module.exports =
20478
20540
  fontWeight: mappings && Object.keys(mappings).includes(field.label) ? 'bold' : 'normal',
20479
20541
  color: mappings && Object.keys(mappings).includes(field.label) ? '#16325c' : selectedField ? 'black' : 'grey'
20480
20542
  }, onClick: function onClick() {
20481
- return _this4.onSelectDestinationField(group.name, field.label);
20543
+ return _this4.onSelectDestinationField(group.name, field.label, field.format);
20482
20544
  } },
20483
20545
  field.label
20484
20546
  );
@@ -20648,7 +20710,23 @@ module.exports =
20648
20710
  { fill: '#000000', height: '19', viewBox: '0 0 24 24', width: '24', xmlns: 'http://www.w3.org/2000/svg' },
20649
20711
  _react2.default.createElement('path', { d: 'M16 17.01V10h-2v7.01h-3L15 21l4-3.99h-3zM9 3L5 6.99h3V14h2V6.99h3L9 3z' }),
20650
20712
  _react2.default.createElement('path', { d: 'M0 0h24v24H0z', fill: 'none' })
20713
+ ),
20714
+ lookup: _react2.default.createElement(
20715
+ 'svg',
20716
+ { fill: '#000000', height: '19', viewBox: '0 0 24 24', width: '24', xmlns: 'http://www.w3.org/2000/svg' },
20717
+ _react2.default.createElement(
20718
+ 'defs',
20719
+ null,
20720
+ _react2.default.createElement('path', { d: 'M24 24H0V0h24v24z', id: 'a' })
20721
+ ),
20722
+ _react2.default.createElement(
20723
+ 'clipPath',
20724
+ { id: 'b' },
20725
+ _react2.default.createElement('use', { overflow: 'visible', href: '#a' })
20726
+ ),
20727
+ _react2.default.createElement('path', { clipPath: 'url(#b)', d: 'M2.5 4v3h5v12h3V7h5V4h-13zm19 5h-9v3h3v7h3v-7h3V9z' })
20651
20728
  )
20729
+
20652
20730
  };
20653
20731
 
20654
20732
  return _react2.default.createElement(
@@ -20873,9 +20951,9 @@ module.exports =
20873
20951
  var selectedEntity = selectedEntities[resourceGroupIndex] || { name: '' };
20874
20952
 
20875
20953
  var filteredDestinationSchema = destinationSchema.filter(function (rsc) {
20876
- return resourceGroups.find(function (g) {
20877
- return g.name === rsc.name && group && group.name !== rsc.name;
20878
- }) ? true : false;
20954
+ return resourceGroups.find(function (g, i) {
20955
+ return i < resourceGroupIndex && g.name === rsc.name && group && group.name !== rsc.name ? true : false;
20956
+ });
20879
20957
  });
20880
20958
 
20881
20959
  return _react2.default.createElement(
@@ -21152,7 +21230,8 @@ module.exports =
21152
21230
  _this.transformOptions = {
21153
21231
  'none': 'None',
21154
21232
  'trim': 'Trim Field',
21155
- 'date': 'Date Format'
21233
+ 'date': 'Date Format',
21234
+ 'lookup': 'Lookup Table'
21156
21235
  };
21157
21236
  _this.dataTypes = ['String', 'Number', 'Date', 'Boolean'];
21158
21237
  _this.dateFormats = {
@@ -21162,34 +21241,94 @@ module.exports =
21162
21241
  'Full': "Wednesday March 25 2015"
21163
21242
  };
21164
21243
  _this.changeTrimCount = _this.changeTrimCount.bind(_this);
21244
+ _this.changeLookupTableSource = _this.changeLookupTableSource.bind(_this);
21245
+ _this.changeLookupTableDestination = _this.changeLookupTableDestination.bind(_this);
21246
+ _this.pasteIntoLookupTable = _this.pasteIntoLookupTable.bind(_this);
21165
21247
  return _this;
21166
21248
  }
21167
21249
 
21168
21250
  _createClass(TransformModal, [{
21169
- key: 'changeTrimCount',
21170
- value: function changeTrimCount(e, v, mappingIndex) {
21251
+ key: 'pasteIntoLookupTable',
21252
+ value: function pasteIntoLookupTable(e, i, mappingIndex) {
21253
+ var _this2 = this;
21254
+
21171
21255
  var _props = this.props,
21172
21256
  change = _props.change,
21173
21257
  resourceGroups = _props.resourceGroups,
21174
21258
  resourceGroupIndex = _props.resourceGroupIndex;
21175
21259
 
21260
+ e.clipboardData.items[0].getAsString(function (txt) {
21261
+ if (txt) {
21262
+ (function () {
21263
+ var columns = txt.split('\n');
21264
+ var groups = [].concat(_toConsumableArray(resourceGroups));
21265
+ var trans = resourceGroups[resourceGroupIndex].mappings[mappingIndex].transformations[0];
21266
+ columns.forEach(function (c, idx) {
21267
+ var rows = c.split('\t');
21268
+ trans.args[i * 2 + idx * 2] = rows[0];
21269
+ trans.args[i * 2 + idx * 2 + 1] = rows[1];
21270
+ });
21271
+ change('resourceGroups', groups);
21272
+ _this2.forceUpdate();
21273
+ })();
21274
+ }
21275
+ });
21276
+ }
21277
+ }, {
21278
+ key: 'changeTrimCount',
21279
+ value: function changeTrimCount(e, v, mappingIndex) {
21280
+ var _props2 = this.props,
21281
+ change = _props2.change,
21282
+ resourceGroups = _props2.resourceGroups,
21283
+ resourceGroupIndex = _props2.resourceGroupIndex;
21284
+
21176
21285
  var groups = [].concat(_toConsumableArray(resourceGroups));
21177
21286
  var trans = resourceGroups[resourceGroupIndex].mappings[mappingIndex].transformations[0];
21178
21287
  trans.args = ["0", v];
21179
21288
  change('resourceGroups', groups);
21180
21289
  }
21290
+ }, {
21291
+ key: 'changeLookupTableSource',
21292
+ value: function changeLookupTableSource(v, i, mappingIndex) {
21293
+ var _props3 = this.props,
21294
+ change = _props3.change,
21295
+ resourceGroups = _props3.resourceGroups,
21296
+ resourceGroupIndex = _props3.resourceGroupIndex;
21297
+
21298
+ var groups = [].concat(_toConsumableArray(resourceGroups));
21299
+ var trans = resourceGroups[resourceGroupIndex].mappings[mappingIndex].transformations[0];
21300
+ trans.args = trans.args || [];
21301
+ trans.args[i * 2] = v;
21302
+ change('resourceGroups', groups);
21303
+ this.forceUpdate();
21304
+ }
21305
+ }, {
21306
+ key: 'changeLookupTableDestination',
21307
+ value: function changeLookupTableDestination(v, i, mappingIndex) {
21308
+ var _props4 = this.props,
21309
+ change = _props4.change,
21310
+ resourceGroups = _props4.resourceGroups,
21311
+ resourceGroupIndex = _props4.resourceGroupIndex;
21312
+
21313
+ var groups = [].concat(_toConsumableArray(resourceGroups));
21314
+ var trans = resourceGroups[resourceGroupIndex].mappings[mappingIndex].transformations[0];
21315
+ trans.args = trans.args || [];
21316
+ trans.args[i * 2 + 1] = v;
21317
+ change('resourceGroups', groups);
21318
+ this.forceUpdate();
21319
+ }
21181
21320
  }, {
21182
21321
  key: 'render',
21183
21322
  value: function render() {
21184
- var _this2 = this;
21323
+ var _this3 = this;
21185
21324
 
21186
- var _props2 = this.props,
21187
- inputs = _props2.inputs,
21188
- opened = _props2.opened,
21189
- mapping = _props2.mapping,
21190
- hideModal = _props2.hideModal,
21191
- resourceGroups = _props2.resourceGroups,
21192
- resourceGroupIndex = _props2.resourceGroupIndex;
21325
+ var _props5 = this.props,
21326
+ inputs = _props5.inputs,
21327
+ opened = _props5.opened,
21328
+ mapping = _props5.mapping,
21329
+ hideModal = _props5.hideModal,
21330
+ resourceGroups = _props5.resourceGroups,
21331
+ resourceGroupIndex = _props5.resourceGroupIndex;
21193
21332
 
21194
21333
  var Modal = inputs.Modal;
21195
21334
  var Input = inputs.Input;
@@ -21207,7 +21346,21 @@ module.exports =
21207
21346
 
21208
21347
  var transformation = updatedMapping.transformations && updatedMapping.transformations[0];
21209
21348
  var transformSelected = transformation && transformation.type || 'none';
21210
- var transformArgs = transformation && transformation.args || [];
21349
+ var transformArgs = transformation && transformation.args || [''];
21350
+
21351
+ // create an array of arrays (pairs) for lookup args
21352
+ var lookupArgs = [];
21353
+ if (transformSelected === 'lookup') {
21354
+ transformArgs.forEach(function (a, i) {
21355
+ if (i % 2 === 0) {
21356
+ lookupArgs.push([a, transformArgs[i + 1] || '']);
21357
+ }
21358
+ });
21359
+ var lastLookupPair = lookupArgs[lookupArgs.length - 1];
21360
+ if (lastLookupPair[0] && lastLookupPair[1]) {
21361
+ lookupArgs.push(['', '']);
21362
+ }
21363
+ }
21211
21364
 
21212
21365
  return _react2.default.createElement(
21213
21366
  Modal,
@@ -21242,9 +21395,9 @@ module.exports =
21242
21395
  return _react2.default.createElement(
21243
21396
  'div',
21244
21397
  { key: type, onClick: function onClick() {
21245
- return _this2.setState({ dataTypeSelected: type });
21398
+ return _this3.setState({ dataTypeSelected: type });
21246
21399
  },
21247
- className: _this2.state.dataTypeSelected === type ? "transform-data-type transform-data-type-sel" : "transform-data-type"
21400
+ className: _this3.state.dataTypeSelected === type ? "transform-data-type transform-data-type-sel" : "transform-data-type"
21248
21401
  },
21249
21402
  type
21250
21403
  );
@@ -21259,7 +21412,7 @@ module.exports =
21259
21412
  'Limit final field length:'
21260
21413
  ),
21261
21414
  _react2.default.createElement(Input, { style: { width: 132 }, label: 'Character Count', onChange: function onChange(e, v) {
21262
- return _this2.changeTrimCount(e, v, mappingIndex);
21415
+ return _this3.changeTrimCount(e, v, mappingIndex);
21263
21416
  },
21264
21417
  defaultValue: transformArgs[1] || '' })
21265
21418
  ),
@@ -21275,9 +21428,9 @@ module.exports =
21275
21428
  return _react2.default.createElement(
21276
21429
  'div',
21277
21430
  { key: i, onClick: function onClick() {
21278
- return _this2.setState({ dateFormatSelected: format });
21431
+ return _this3.setState({ dateFormatSelected: format });
21279
21432
  },
21280
- className: _this2.state.dateFormatSelected === format ? "transform-data-type transform-data-type-sel" : "transform-data-type"
21433
+ className: _this3.state.dateFormatSelected === format ? "transform-data-type transform-data-type-sel" : "transform-data-type"
21281
21434
  },
21282
21435
  format
21283
21436
  );
@@ -21290,15 +21443,37 @@ module.exports =
21290
21443
  this.dateFormats[this.state.dateFormatSelected]
21291
21444
  )
21292
21445
  ),
21293
- transformSelected === 'Lookup Table' && _react2.default.createElement(
21446
+ transformSelected === 'lookup' && _react2.default.createElement(
21294
21447
  'div',
21295
21448
  null,
21296
21449
  _react2.default.createElement(
21297
21450
  'div',
21298
21451
  { style: { marginBottom: 8 } },
21299
- 'Convert field name:'
21452
+ 'Convert field values:'
21300
21453
  ),
21301
- _react2.default.createElement(Input, { style: { width: 150 }, label: 'Field Name' })
21454
+ lookupArgs.map(function (argPair, i) {
21455
+ return _react2.default.createElement(
21456
+ 'div',
21457
+ { key: i, style: { marginBottom: 6 } },
21458
+ _react2.default.createElement(Input, { style: { width: 132 }, onPaste: function onPaste(e) {
21459
+ return _this3.pasteIntoLookupTable(e, i, mappingIndex);
21460
+ },
21461
+ onChange: function onChange(e, v) {
21462
+ return _this3.changeLookupTableSource(v, i, mappingIndex);
21463
+ },
21464
+ value: argPair[0] || '', placeholder: 'Source Value' }),
21465
+ _react2.default.createElement(
21466
+ 'span',
21467
+ null,
21468
+ '\xA0\xA0\u2192\xA0\xA0'
21469
+ ),
21470
+ _react2.default.createElement(Input, { style: { width: 132 },
21471
+ onChange: function onChange(e, v) {
21472
+ return _this3.changeLookupTableDestination(v, i, mappingIndex);
21473
+ },
21474
+ value: argPair[1] || '', placeholder: 'Target Value' })
21475
+ );
21476
+ })
21302
21477
  )
21303
21478
  )
21304
21479
  )
@@ -21804,7 +21979,7 @@ module.exports =
21804
21979
  type: 'Salesforce',
21805
21980
  name: 'Salesforce',
21806
21981
  env: false,
21807
- customizable: true,
21982
+ customizable: false,
21808
21983
  customStep: false
21809
21984
  },
21810
21985
  deployment: ['once', 'daily', 'repeating'],