@lingk/sync 1.0.61 → 1.0.63

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
@@ -1398,8 +1398,10 @@ module.exports =
1398
1398
  )
1399
1399
  }*/
1400
1400
  var nestedDestinationKey = findNestedProp(dk, group.destinationKeysParents && group.destinationKeysParents[i], destinationResource);
1401
- destinationKeys.push(nestedDestinationKey.property);
1402
- destinationKeysParents.push(JSON.stringify(nestedDestinationKey.parentsArray));
1401
+ if (nestedDestinationKey.property) {
1402
+ destinationKeys.push(nestedDestinationKey.property);
1403
+ destinationKeysParents.push(JSON.stringify(nestedDestinationKey.parentsArray));
1404
+ }
1403
1405
  });
1404
1406
  }
1405
1407
  group.destinationKeys = destinationKeys;
@@ -1422,9 +1424,11 @@ module.exports =
1422
1424
 
1423
1425
  if (sourceResource) {
1424
1426
  var nestedSourceKey = findNestedProp(sk, group.sourceKeysParents && group.sourceKeysParents[i], sourceResource);
1425
- sourceKeys.push(nestedSourceKey.property);
1426
- sourceKeysParents.push(JSON.stringify(nestedSourceKey.parentsArray));
1427
- sourceKeysObjects.push(sourceResource.type);
1427
+ if (nestedSourceKey.property) {
1428
+ sourceKeys.push(nestedSourceKey.property);
1429
+ sourceKeysParents.push(JSON.stringify(nestedSourceKey.parentsArray));
1430
+ sourceKeysObjects.push(sourceResource.type);
1431
+ }
1428
1432
  }
1429
1433
  });
1430
1434
  group.sourceKeys = sourceKeys;
@@ -19374,12 +19378,15 @@ module.exports =
19374
19378
  return m && m.propertyToName === field.label && m.isExternalKeyMapping;
19375
19379
  })) return;
19376
19380
 
19377
- var transform = 'none';
19381
+ var transform = { type: 'none' };
19378
19382
  if (field.format) {
19379
19383
  if (field.format === 'date-time') {
19380
- transform = 'date';
19384
+ transform = { type: 'date' };
19381
19385
  }
19382
19386
  }
19387
+ if (field.type && field.type === 'boolean') {
19388
+ transform = { type: 'bool', args: ['T', 'F'] };
19389
+ }
19383
19390
 
19384
19391
  //cant map multiple to same destination field
19385
19392
  rscGroup.mappings = rscGroup.mappings && rscGroup.mappings.filter(function (m) {
@@ -19396,7 +19403,7 @@ module.exports =
19396
19403
  propertyToName: field.label,
19397
19404
  __propertyToName: field.name,
19398
19405
  propertyToParents: parents,
19399
- transformations: [{ type: transform }],
19406
+ transformations: [transform],
19400
19407
  dataSourceIsDestinationEntity: selectedEntity.isDestinationEntity
19401
19408
  });
19402
19409
  change('resourceGroups', resourceGroups);
@@ -19891,6 +19898,12 @@ module.exports =
19891
19898
  { fill: '#000000', height: '19', viewBox: '0 0 24 24', width: '24', xmlns: 'http://www.w3.org/2000/svg' },
19892
19899
  _react2.default.createElement('path', { d: 'M0 0h24v24H0z', fill: 'none' }),
19893
19900
  _react2.default.createElement('path', { d: 'M12.45 16h2.09L9.43 3H7.57L2.46 16h2.09l1.12-3h5.64l1.14 3zm-6.02-5L8.5 5.48 10.57 11H6.43zm15.16.59l-8.09 8.09L9.83 16l-1.41 1.41 5.09 5.09L23 13l-1.41-1.41z' })
19901
+ ),
19902
+ bool: _react2.default.createElement(
19903
+ 'svg',
19904
+ { fill: '#000000', height: '19', viewBox: '0 0 24 24', width: '24', xmlns: 'http://www.w3.org/2000/svg' },
19905
+ _react2.default.createElement('path', { d: 'M16 17.01V10h-2v7.01h-3L15 21l4-3.99h-3zM9 3L5 6.99h3V14h2V6.99h3L9 3z' }),
19906
+ _react2.default.createElement('path', { d: 'M0 0h24v24H0z', fill: 'none' })
19894
19907
  )
19895
19908
 
19896
19909
  };
@@ -21035,6 +21048,7 @@ module.exports =
21035
21048
  'trim': 'Trim Field',
21036
21049
  'date': 'Date Format',
21037
21050
  'lookup': 'Lookup Table',
21051
+ 'bool': 'Boolean',
21038
21052
  'ifnull': 'Null Check'
21039
21053
  };
21040
21054
  _this.dataTypes = ['String', 'Number', 'Date', 'Boolean'];
@@ -21066,6 +21080,10 @@ module.exports =
21066
21080
  var trans = resourceGroups[resourceGroupIndex].mappings[mappingIndex].transformations[0];
21067
21081
  if (trans.type !== v) {
21068
21082
  trans.args = [''];
21083
+ console.log(v);
21084
+ if (v === 'bool') {
21085
+ trans.args = ['', '', false];
21086
+ }
21069
21087
  }
21070
21088
  change('resourceGroups', groups);
21071
21089
  }
@@ -21176,25 +21194,56 @@ module.exports =
21176
21194
  change('resourceGroups', groups);
21177
21195
  this.forceUpdate();
21178
21196
  }
21197
+ }, {
21198
+ key: 'changeBool',
21199
+ value: function changeBool(v, i, mappingIndex) {
21200
+ var _props8 = this.props,
21201
+ change = _props8.change,
21202
+ resourceGroups = _props8.resourceGroups,
21203
+ resourceGroupIndex = _props8.resourceGroupIndex;
21204
+
21205
+ var groups = [].concat(_toConsumableArray(resourceGroups));
21206
+ var trans = resourceGroups[resourceGroupIndex].mappings[mappingIndex].transformations[0];
21207
+ trans.args = trans.args || [];
21208
+ trans.args[i] = v;
21209
+ change('resourceGroups', groups);
21210
+ this.forceUpdate();
21211
+ }
21212
+ }, {
21213
+ key: 'toggleNullBool',
21214
+ value: function toggleNullBool(v, mappingIndex) {
21215
+ var _props9 = this.props,
21216
+ change = _props9.change,
21217
+ resourceGroups = _props9.resourceGroups,
21218
+ resourceGroupIndex = _props9.resourceGroupIndex;
21219
+
21220
+ var groups = [].concat(_toConsumableArray(resourceGroups));
21221
+ var trans = resourceGroups[resourceGroupIndex].mappings[mappingIndex].transformations[0];
21222
+ trans.args = trans.args || [];
21223
+ trans.args[2] = v === 'true';
21224
+ change('resourceGroups', groups);
21225
+ this.forceUpdate();
21226
+ }
21179
21227
  }, {
21180
21228
  key: 'render',
21181
21229
  value: function render() {
21182
21230
  var _this3 = this;
21183
21231
 
21184
- var _props8 = this.props,
21185
- inputs = _props8.inputs,
21186
- opened = _props8.opened,
21187
- mapping = _props8.mapping,
21188
- hideModal = _props8.hideModal,
21189
- resourceGroups = _props8.resourceGroups,
21190
- resourceGroupIndex = _props8.resourceGroupIndex,
21191
- sourceSchema = _props8.sourceSchema,
21192
- destinationSchema = _props8.destinationSchema,
21193
- step = _props8.step,
21194
- showApiNames = _props8.showApiNames;
21232
+ var _props10 = this.props,
21233
+ inputs = _props10.inputs,
21234
+ opened = _props10.opened,
21235
+ mapping = _props10.mapping,
21236
+ hideModal = _props10.hideModal,
21237
+ resourceGroups = _props10.resourceGroups,
21238
+ resourceGroupIndex = _props10.resourceGroupIndex,
21239
+ sourceSchema = _props10.sourceSchema,
21240
+ destinationSchema = _props10.destinationSchema,
21241
+ step = _props10.step,
21242
+ showApiNames = _props10.showApiNames;
21195
21243
 
21196
21244
  var Modal = inputs.Modal;
21197
21245
  var Input = inputs.Input;
21246
+ var ToggleButtonGroup = inputs.ToggleButtonGroup;
21198
21247
  var groups = [].concat(_toConsumableArray(resourceGroups));
21199
21248
  var group = groups[resourceGroupIndex];
21200
21249
 
@@ -21210,6 +21259,8 @@ module.exports =
21210
21259
  var transformation = updatedMapping.transformations && updatedMapping.transformations[0];
21211
21260
  var transformSelected = transformation && transformation.type || 'none';
21212
21261
  var transformArgs = transformation && transformation.args || [''];
21262
+ console.log(transformArgs);
21263
+
21213
21264
  // create an array of arrays (pairs) for lookup args
21214
21265
  var lookupArgs = [];
21215
21266
  if (transformSelected === 'lookup') {
@@ -21313,7 +21364,7 @@ module.exports =
21313
21364
  { style: { width: 150, display: 'inline-block', marginBottom: 20 } },
21314
21365
  _react2.default.createElement(_reduxForm.Field, { name: 'resourceGroups.' + resourceGroupIndex + '.mappings.' + mappingIndex + '.transformations.0.type',
21315
21366
  component: inputs.rfRadioGroup, label: 'Transformation Type', options: this.transformOptions,
21316
- onClickOption: function onClickOption(v) {
21367
+ onChange: function onChange(v) {
21317
21368
  return _this3.clickRadio(v, mappingIndex);
21318
21369
  } })
21319
21370
  ),
@@ -21410,6 +21461,48 @@ module.exports =
21410
21461
  );
21411
21462
  })
21412
21463
  ),
21464
+ transformSelected === 'bool' && _react2.default.createElement(
21465
+ 'div',
21466
+ null,
21467
+ _react2.default.createElement(
21468
+ 'div',
21469
+ { style: { marginBottom: 8 } },
21470
+ 'Values to map to booleans:'
21471
+ ),
21472
+ ['true', 'false'].map(function (b, i) {
21473
+ return _react2.default.createElement(
21474
+ 'div',
21475
+ { key: i, style: { marginBottom: 6 } },
21476
+ _react2.default.createElement(Input, { style: { width: 132, display: 'inline-block' },
21477
+ onChange: function onChange(e, v) {
21478
+ return _this3.changeBool(v, i, mappingIndex);
21479
+ },
21480
+ value: transformArgs[i] || '', placeholder: b + ' value' }),
21481
+ _react2.default.createElement(
21482
+ 'span',
21483
+ null,
21484
+ '\xA0\xA0\u2192\xA0\xA0'
21485
+ ),
21486
+ _react2.default.createElement(Input, { style: { width: 132, display: 'inline-block' },
21487
+ readOnly: true, value: b })
21488
+ );
21489
+ }),
21490
+ _react2.default.createElement(
21491
+ 'div',
21492
+ { style: { marginTop: 12 } },
21493
+ _react2.default.createElement(
21494
+ 'div',
21495
+ { className: 'labelz' },
21496
+ 'Map null values to:'
21497
+ ),
21498
+ _react2.default.createElement(ToggleButtonGroup, { options: ['false', 'true'],
21499
+ value: transformArgs[2] ? 'true' : 'false', lowercase: true,
21500
+ handleToggle: function handleToggle(e) {
21501
+ return _this3.toggleNullBool(e, mappingIndex);
21502
+ }
21503
+ })
21504
+ )
21505
+ ),
21413
21506
  transformSelected === 'concat' && _react2.default.createElement(
21414
21507
  'div',
21415
21508
  null,