@lingk/sync 1.1.15 → 1.1.17

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.
@@ -3648,7 +3648,7 @@ module.exports =
3648
3648
  f = Math.floor(Math.log(a) / Math.log(c));return parseFloat((a / Math.pow(c, f)).toFixed(d)) + " " + e[f];
3649
3649
  }
3650
3650
 
3651
- var extensionBlacklist = ['jsonl', 'xml', 'zip', 'tar', 'gz'];
3651
+ var extensionBlacklist = ['xml', 'zip', 'tar', 'gz'];
3652
3652
 
3653
3653
  var FlatFile = function (_Component) {
3654
3654
  _inherits(FlatFile, _Component);
@@ -3697,6 +3697,11 @@ module.exports =
3697
3697
  }
3698
3698
  };
3699
3699
 
3700
+ _this.parseJsonLines = function (content) {
3701
+ var firstLine = content.substring(0, content.indexOf('\n'));
3702
+ return '[' + firstLine + ']';
3703
+ };
3704
+
3700
3705
  _this.parseCSV = function (file, csv) {
3701
3706
  return new Promise(function (resolve, reject) {
3702
3707
  _papaparse2.default.parse(csv || file, {
@@ -3734,7 +3739,6 @@ module.exports =
3734
3739
  var blacklisted = extensionBlacklist.includes(extension);
3735
3740
  if (!blacklisted) {
3736
3741
  (function () {
3737
-
3738
3742
  var isXLS = extension === 'xlsx' || extension === 'xls';
3739
3743
 
3740
3744
  var reader = new FileReader();
@@ -3779,8 +3783,12 @@ module.exports =
3779
3783
  _this.props.onDrop();
3780
3784
  }
3781
3785
  });
3782
- } else if (extension === 'json') {
3783
- var fileMeta = _this.parseJsonFile(data, file);
3786
+ } else if (extension === 'json' || extension === 'jsonl') {
3787
+ var d = data;
3788
+ if (extension === 'jsonl') {
3789
+ d = _this.parseJsonLines(data);
3790
+ }
3791
+ var fileMeta = _this.parseJsonFile(d, file);
3784
3792
  if (fileMeta) {
3785
3793
  meta = meta.concat(fileMeta);
3786
3794
  counter += 1;
@@ -3837,12 +3845,19 @@ module.exports =
3837
3845
  _this.props.downloadFileFromAws(file);
3838
3846
  };
3839
3847
 
3848
+ _this.deleteFileFile = function (fileName) {
3849
+ _this.setState({ isDeletingFile: fileName });
3850
+ _this.props.deleteFileFile(fileName);
3851
+ };
3852
+
3840
3853
  _this.state = {
3841
3854
  meta: [],
3842
3855
  fileContents: [],
3843
3856
  uploading: false,
3844
3857
  dropError: null,
3845
- sortFileTableBy: 'uploadedTime' };
3858
+ sortFileTableBy: 'uploadedTime', // name, byteSize, uploadedTime
3859
+ isDeletingFile: null
3860
+ };
3846
3861
  return _this;
3847
3862
  }
3848
3863
 
@@ -3855,7 +3870,8 @@ module.exports =
3855
3870
  meta = _state.meta,
3856
3871
  uploading = _state.uploading,
3857
3872
  dropError = _state.dropError,
3858
- sortFileTableBy = _state.sortFileTableBy;
3873
+ sortFileTableBy = _state.sortFileTableBy,
3874
+ isDeletingFile = _state.isDeletingFile;
3859
3875
  var inputs = this.props.inputs;
3860
3876
 
3861
3877
  var Button = inputs.Button;
@@ -4042,6 +4058,19 @@ module.exports =
4042
4058
  'td',
4043
4059
  null,
4044
4060
  (0, _moment2.default)(file.uploadedTime).format('MMM Do, h:mm a')
4061
+ ),
4062
+ _react2.default.createElement(
4063
+ 'td',
4064
+ null,
4065
+ !(isDeletingFile === file.name) && _react2.default.createElement(
4066
+ 'svg',
4067
+ { style: { width: 18, height: 18 },
4068
+ onClick: function onClick() {
4069
+ return _this2.deleteFileFile(file.name);
4070
+ },
4071
+ className: 'delete-flat-file', viewBox: '0 0 60 60' },
4072
+ _react2.default.createElement('path', { d: 'M 15.674663,15.572746 L 44.587629,44.485711 M 45.118838,15.420972 L 15.522889,45.016920' })
4073
+ )
4045
4074
  )
4046
4075
  );
4047
4076
  })
@@ -4370,7 +4399,8 @@ module.exports =
4370
4399
  clearCsvFields = _props.clearCsvFields,
4371
4400
  formValues = _props.formValues,
4372
4401
  change = _props.change,
4373
- downloadFileFromAws = _props.downloadFileFromAws;
4402
+ downloadFileFromAws = _props.downloadFileFromAws,
4403
+ deleteFileFile = _props.deleteFileFile;
4374
4404
 
4375
4405
 
4376
4406
  var Button = inputs.Button;
@@ -4422,7 +4452,8 @@ module.exports =
4422
4452
  checking: checking, setCsvFields: setCsvFields,
4423
4453
  providerType: providerType, inputs: inputs,
4424
4454
  accountKey: accountKey, tenantKey: tenantKey,
4425
- onDrop: clearCsvFields, downloadFileFromAws: downloadFileFromAws
4455
+ onDrop: clearCsvFields, downloadFileFromAws: downloadFileFromAws,
4456
+ deleteFileFile: deleteFileFile
4426
4457
  }) : isGoogle ? _react2.default.createElement(_google2.default, { config: config, creds: creds, onChange: this.onChange,
4427
4458
  credsDisabledCheck: credsDisabledCheck, inputs: inputs,
4428
4459
  onCheck: check