@lingk/sync 1.1.8 → 1.1.10

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
@@ -5538,7 +5538,7 @@ module.exports =
5538
5538
  f = Math.floor(Math.log(a) / Math.log(c));return parseFloat((a / Math.pow(c, f)).toFixed(d)) + " " + e[f];
5539
5539
  }
5540
5540
 
5541
- var extensionBlacklist = ['xls', 'xml', 'zip', 'tar', 'gz'];
5541
+ var extensionBlacklist = ['xls', 'xlsx', 'xml', 'zip', 'tar', 'gz'];
5542
5542
 
5543
5543
  var FlatFile = function (_Component) {
5544
5544
  _inherits(FlatFile, _Component);
@@ -5744,7 +5744,7 @@ module.exports =
5744
5744
  fileSchema = _props.fileSchema,
5745
5745
  inputs = _props.inputs;
5746
5746
 
5747
- var files = fileSchema && fileSchema.resources;
5747
+ var fileSchemas = fileSchema;
5748
5748
  var Button = inputs.Button;
5749
5749
  var Spinner = inputs.Spinner;
5750
5750
  var hasFile = meta && meta.length > 0;
@@ -5769,100 +5769,113 @@ module.exports =
5769
5769
  )
5770
5770
  )
5771
5771
  ),
5772
- hasFile && _react2.default.createElement(
5773
- 'aside',
5774
- { style: { marginLeft: 30, display: 'inline-block' } },
5775
- _react2.default.createElement(
5776
- 'div',
5772
+ _react2.default.createElement(
5773
+ 'div',
5774
+ { style: { marginLeft: 30, display: 'inline-block', verticalAlign: 'top',
5775
+ maxWidth: '60%' } },
5776
+ hasFile && _react2.default.createElement(
5777
+ 'aside',
5777
5778
  null,
5778
5779
  _react2.default.createElement(
5779
- 'h3',
5780
- { style: { marginTop: 10, display: 'inline-block', verticalAlign: 'top' } },
5781
- 'Dropped files'
5782
- ),
5783
- _react2.default.createElement(
5784
- Button,
5785
- {
5786
- type: 'brand',
5787
- onClick: this.upload,
5788
- style: { marginTop: 4, marginLeft: 20, verticalAlign: 'top', height: 36 },
5789
- disabled: uploading },
5790
- _react2.default.createElement(
5791
- 'span',
5792
- { style: { display: 'inline-block', verticalAlign: 'top', marginTop: 3 } },
5793
- 'Upload'
5794
- ),
5795
- '\xA0\xA0',
5796
- _react2.default.createElement(UploadIcon, null)
5797
- ),
5798
- uploading && _react2.default.createElement(
5799
5780
  'div',
5800
- { style: { paddingLeft: 12, paddingTop: 12, display: 'inline-block' } },
5801
- _react2.default.createElement(Spinner, null)
5802
- )
5803
- ),
5804
- _react2.default.createElement(
5805
- 'ul',
5806
- { style: { padding: 0 } },
5807
- meta.map(function (f, i) {
5808
- return _react2.default.createElement(
5809
- 'li',
5810
- { key: i, style: { listStyle: 'none' } },
5811
- f.name,
5812
- ' - ',
5813
- formatBytes(f.byteSize)
5814
- );
5815
- })
5816
- )
5817
- ),
5818
- !uploading && !hasFile && files && files.length > 0 && _react2.default.createElement(
5819
- 'div',
5820
- { style: {
5821
- marginLeft: 20, display: 'inline-block', marginTop: 13, verticalAlign: 'top'
5822
- } },
5823
- _react2.default.createElement(
5824
- 'div',
5825
- { style: { marginBottom: 4 } },
5826
- _react2.default.createElement(
5827
- 'strong',
5828
- { style: { marginRight: 5 } },
5829
- files && files.length
5830
- ),
5831
- _react2.default.createElement(
5832
- 'strong',
5833
5781
  null,
5834
- 'file' + (files.length === 1 ? '' : 's') + ' uploaded on '
5782
+ _react2.default.createElement(
5783
+ 'h3',
5784
+ { style: { marginTop: 10, display: 'inline-block', verticalAlign: 'top' } },
5785
+ 'Dropped files'
5786
+ ),
5787
+ _react2.default.createElement(
5788
+ Button,
5789
+ {
5790
+ type: 'brand',
5791
+ onClick: this.upload,
5792
+ style: { marginTop: 4, marginLeft: 20, verticalAlign: 'top', height: 36 },
5793
+ disabled: uploading },
5794
+ _react2.default.createElement(
5795
+ 'span',
5796
+ { style: { display: 'inline-block', verticalAlign: 'top', marginTop: 3 } },
5797
+ 'Upload'
5798
+ ),
5799
+ '\xA0\xA0',
5800
+ _react2.default.createElement(UploadIcon, null)
5801
+ ),
5802
+ uploading && _react2.default.createElement(
5803
+ 'div',
5804
+ { style: { paddingLeft: 12, paddingTop: 12, display: 'inline-block' } },
5805
+ _react2.default.createElement(Spinner, null)
5806
+ )
5835
5807
  ),
5836
5808
  _react2.default.createElement(
5837
- 'strong',
5838
- null,
5839
- (0, _moment2.default)(fileSchema.uploadedTime).format('MMM Do Y, h:mm a')
5809
+ 'ul',
5810
+ { style: { padding: 0 } },
5811
+ meta.map(function (f, i) {
5812
+ return _react2.default.createElement(
5813
+ 'li',
5814
+ { key: i, style: { listStyle: 'none' } },
5815
+ f.name,
5816
+ ' - ',
5817
+ formatBytes(f.byteSize)
5818
+ );
5819
+ })
5840
5820
  )
5841
5821
  ),
5842
- _react2.default.createElement(
5843
- 'ul',
5844
- { style: { padding: 0 } },
5845
- files.map(function (f, i) {
5822
+ fileSchemas && fileSchemas.length > 0 && _react2.default.createElement(
5823
+ 'div',
5824
+ { style: {
5825
+ display: 'inline-block', marginTop: 13, verticalAlign: 'top'
5826
+ } },
5827
+ fileSchemas.map(function (fs) {
5828
+ var files = fs.resources;
5846
5829
  return _react2.default.createElement(
5847
- 'li',
5848
- { key: i, style: { listStyle: 'none' } },
5830
+ 'div',
5831
+ { key: fs.schemaGuid },
5849
5832
  _react2.default.createElement(
5850
- 'a',
5851
- { onClick: function onClick(e) {
5852
- return _this2.downloadFile(e, f);
5853
- } },
5854
- f.name
5833
+ 'div',
5834
+ { style: { marginBottom: 4 } },
5835
+ _react2.default.createElement(
5836
+ 'strong',
5837
+ null,
5838
+ (files && files.length) + ' file' + (files.length === 1 ? '' : 's')
5839
+ ),
5840
+ _react2.default.createElement(
5841
+ 'span',
5842
+ null,
5843
+ ' uploaded on '
5844
+ ),
5845
+ _react2.default.createElement(
5846
+ 'strong',
5847
+ null,
5848
+ (0, _moment2.default)(fs.uploadedTime).format('MMM Do Y, h:mm a')
5849
+ )
5855
5850
  ),
5856
5851
  _react2.default.createElement(
5857
- 'span',
5858
- null,
5859
- ' - ',
5860
- formatBytes(f.byteSize)
5852
+ 'ul',
5853
+ { style: { padding: 0 } },
5854
+ files.map(function (f, i) {
5855
+ return _react2.default.createElement(
5856
+ 'li',
5857
+ { key: i, style: { listStyle: 'none' } },
5858
+ _react2.default.createElement(
5859
+ 'a',
5860
+ { onClick: function onClick(e) {
5861
+ return _this2.downloadFile(e, f);
5862
+ } },
5863
+ f.name
5864
+ ),
5865
+ _react2.default.createElement(
5866
+ 'span',
5867
+ null,
5868
+ ' - ',
5869
+ formatBytes(f.byteSize)
5870
+ )
5871
+ );
5872
+ })
5861
5873
  )
5862
5874
  );
5863
5875
  })
5864
5876
  )
5865
- )
5877
+ ),
5878
+ ' '
5866
5879
  );
5867
5880
  }
5868
5881
  }]);
@@ -50584,6 +50597,7 @@ module.exports =
50584
50597
  metadataApi = providerConfig.metadataApi,
50585
50598
  credentialType = providerConfig.credentialType;
50586
50599
 
50600
+ var isFlatFile = credentialType === 'FlatFile';
50587
50601
  if (!metadataEndpoint) {
50588
50602
  return function () {
50589
50603
  return Promise.resolve();
@@ -50598,9 +50612,9 @@ module.exports =
50598
50612
  metadataEndpoint = 'adaptermetadata?url=' + endpoint;
50599
50613
  isAdapter = true;
50600
50614
  }
50601
- if (metadataEndpoint === 'fileschema') {
50602
- metadataEndpoint = 'fileschema?schemaGuid=' + schemaGuid;
50603
- }
50615
+ /*if(metadataEndpoint==='fileschema'){ // CHANGE FLAT FILE TO ALL IN ENV
50616
+ metadataEndpoint = `fileschema?schemaGuid=${schemaGuid}`
50617
+ }*/
50604
50618
  if (metadataEndpoint === 'schema/swagger/moodle' && creds.swaggerUrl) {
50605
50619
  metadataEndpoint = 'schema/swagger/moodle?swaggerUrl=' + creds.swaggerUrl;
50606
50620
  }
@@ -50617,8 +50631,7 @@ module.exports =
50617
50631
  }
50618
50632
  });
50619
50633
  } else {
50620
- if (isOauth || isAdapter || providerType === 'Ethos') {
50621
- // USE ONLY ENVS!!!
50634
+ if (isOauth || isAdapter || isFlatFile || providerType === 'Ethos') {
50622
50635
  return api.get(tenantId + '/' + appId + '/environments/' + envName + '/' + metadataEndpoint + (extraQuery || ''), {
50623
50636
  endpoint: config[metadataApi]
50624
50637
  });
@@ -50649,7 +50662,7 @@ module.exports =
50649
50662
  type: types.FINISH_WIZARD_ENV_CHECK,
50650
50663
  data: { metadata: { resources: metadata }, mode: mode, code: '200 OK', providerType: providerType }
50651
50664
  });
50652
- return metadata;
50665
+ return d.guids;
50653
50666
  });
50654
50667
  }).catch(function (err) {
50655
50668
  console.log(err);
@@ -55398,7 +55411,7 @@ module.exports =
55398
55411
  _this2.setState(_defineProperty({}, mode + 'EnvChecking', false));
55399
55412
  // set meta for File Schema step if needed
55400
55413
  // set defaults of filename and delimiter
55401
- var isSFTP = metadata && metadata.providerType.toLowerCase() === 'sftp';
55414
+ var isSFTP = metadata && metadata.providerType && metadata.providerType.toLowerCase() === 'sftp';
55402
55415
  if (isSFTP) {
55403
55416
  (function () {
55404
55417
  var savedFileSchema = [];
@@ -55420,7 +55433,7 @@ module.exports =
55420
55433
  })();
55421
55434
  }
55422
55435
 
55423
- var isFlat = metadata && metadata.providerType.toLowerCase() === 'flatfile';
55436
+ var isFlat = metadata && metadata[0] && metadata[0].providerType && metadata[0].providerType.toLowerCase() === 'flatfile';
55424
55437
  if (isFlat) {
55425
55438
  change(mode + 'FileSchema', metadata);
55426
55439
  }
@@ -55521,6 +55534,8 @@ module.exports =
55521
55534
  }, {
55522
55535
  key: 'setCsvFields',
55523
55536
  value: function setCsvFields(metadata, contents, mode, providerType) {
55537
+ var _this4 = this;
55538
+
55524
55539
  var _props7 = this.props,
55525
55540
  tenantId = _props7.tenantId,
55526
55541
  accountId = _props7.accountId,
@@ -55528,16 +55543,13 @@ module.exports =
55528
55543
  accountKey = _props7.accountKey,
55529
55544
  wizard = _props7.wizard,
55530
55545
  actions = _props7.actions,
55531
- formValues = _props7.formValues,
55532
- change = _props7.change;
55546
+ formValues = _props7.formValues;
55533
55547
 
55534
55548
  var meta = wizard[mode + 'Metadata'] || [];
55535
55549
  meta = meta.concat(metadata);
55536
- return actions.setCsvFields(tenantId, accountId, tenantKey, accountKey, meta, contents, mode, providerType, mode === 'source', formValues['environmentId']).then(function () {
55537
- change(mode + 'FileSchema', {
55538
- uploadedTime: new Date().getTime(),
55539
- resources: metadata
55540
- });
55550
+ return actions.setCsvFields(tenantId, accountId, tenantKey, accountKey, meta, contents, mode, providerType, mode === 'source', formValues['environmentId']).then(function (d) {
55551
+ // get the new list of files
55552
+ return _this4.check(mode, null, d, null, '');
55541
55553
  });
55542
55554
  }
55543
55555
  }, {
@@ -55572,7 +55584,7 @@ module.exports =
55572
55584
  }, {
55573
55585
  key: 'render',
55574
55586
  value: function render() {
55575
- var _this4 = this;
55587
+ var _this5 = this;
55576
55588
 
55577
55589
  var _props9 = this.props,
55578
55590
  inputs = _props9.inputs,
@@ -55639,16 +55651,16 @@ module.exports =
55639
55651
  _react2.default.createElement('br', null),
55640
55652
  modes.map(function (m) {
55641
55653
  var isSelected = step[m + 'Provider'] === selectedProvider;
55642
- var checking = _this4.state[m + 'EnvChecking'];
55654
+ var checking = _this5.state[m + 'EnvChecking'];
55643
55655
  var adapterSecret = wizard.savedCredentials && wizard.savedCredentials[m + 'AdapterSecret'] && wizard.savedCredentials[m + 'AdapterSecret'].credentials;
55644
- var customSettings = _this4.createCustomSettings(m);
55656
+ var customSettings = _this5.createCustomSettings(m);
55645
55657
  return _react2.default.createElement(
55646
55658
  'div',
55647
55659
  { key: m, className: 'env-section' },
55648
55660
  _react2.default.createElement(
55649
55661
  'div',
55650
55662
  { onClick: function onClick() {
55651
- return _this4.selectProvider(step[m + 'Provider']);
55663
+ return _this5.selectProvider(step[m + 'Provider']);
55652
55664
  },
55653
55665
  className: 'env-section-header' },
55654
55666
  _react2.default.createElement(EnvCheckIcons, { wizard: wizard, inputs: inputs, mode: m, checking: checking,
@@ -55663,7 +55675,7 @@ module.exports =
55663
55675
  'div',
55664
55676
  { className: 'env-inspect-button',
55665
55677
  onClick: function onClick() {
55666
- return _this4.setState({ showResources: m });
55678
+ return _this5.setState({ showResources: m });
55667
55679
  } },
55668
55680
  _react2.default.createElement(
55669
55681
  'span',
@@ -55692,29 +55704,29 @@ module.exports =
55692
55704
  _react2.default.createElement(
55693
55705
  _credSections2.default,
55694
55706
  { config: step[m + 'Config'], checking: checking,
55695
- wizard: wizard, getOauthUrl: _this4.getOauthUrl.bind(_this4),
55707
+ wizard: wizard, getOauthUrl: _this5.getOauthUrl.bind(_this5),
55696
55708
  formValues: formValues, inputs: inputs,
55697
55709
  generateNewAdapterSecret: function generateNewAdapterSecret() {
55698
- return _this4.generateNewAdapterSecret(m);
55710
+ return _this5.generateNewAdapterSecret(m);
55699
55711
  },
55700
- seeFields: _this4.seeFields.bind(_this4),
55712
+ seeFields: _this5.seeFields.bind(_this5),
55701
55713
  fileSchema: formValues[m + 'FileSchema'],
55702
55714
  check: function check(actualCreds, extraQuery) {
55703
- _this4.check(m, null, actualCreds, null, extraQuery);
55715
+ _this5.check(m, null, actualCreds, null, extraQuery);
55704
55716
  }, change: change,
55705
55717
  tenantKey: tenantKey, accountKey: accountKey,
55706
55718
  setCsvFields: function setCsvFields(meta, contents, providerType) {
55707
- return _this4.setCsvFields(meta, contents, m, providerType);
55719
+ return _this5.setCsvFields(meta, contents, m, providerType);
55708
55720
  },
55709
- downloadFileFromAws: _this4.downloadFileFromAws,
55721
+ downloadFileFromAws: _this5.downloadFileFromAws,
55710
55722
  clearCsvFields: function clearCsvFields() {
55711
- return _this4.clearCsvFields(m);
55723
+ return _this5.clearCsvFields(m);
55712
55724
  },
55713
55725
  creds: formValues[m + 'Credentials'],
55714
55726
  envCheckResult: wizard[m + 'CheckResult'],
55715
55727
  adapterSecret: adapterSecret,
55716
55728
  checkOauthCreds: function checkOauthCreds(phase) {
55717
- return _this4.checkOauthCreds(phase, m);
55729
+ return _this5.checkOauthCreds(phase, m);
55718
55730
  } },
55719
55731
  _react2.default.isValidElement(customSettings) ? _react2.default.cloneElement(customSettings) : null
55720
55732
  )
@@ -55726,7 +55738,7 @@ module.exports =
55726
55738
  ),
55727
55739
  this.state.showResources && _react2.default.createElement(PreviewModal, {
55728
55740
  onHide: function onHide() {
55729
- return _this4.setState({ showResources: null });
55741
+ return _this5.setState({ showResources: null });
55730
55742
  },
55731
55743
  mode: this.state.showResources, wizard: wizard,
55732
55744
  step: step, inputs: inputs,
@@ -55758,7 +55770,7 @@ module.exports =
55758
55770
 
55759
55771
  var Modal = inputs.Modal;
55760
55772
  var config = step[mode + 'Config'];
55761
-
55773
+ console.log(wizard[mode + 'Metadata']);
55762
55774
  var POSTS = wizard[mode + 'Metadata'] && wizard[mode + 'Metadata'].filter(function (m) {
55763
55775
  return m.method === 'POST' || m.method === 'PUT';
55764
55776
  });
@@ -55897,12 +55909,12 @@ module.exports =
55897
55909
  function CustomSalesforceSettings() {
55898
55910
  _classCallCheck(this, CustomSalesforceSettings);
55899
55911
 
55900
- var _this5 = _possibleConstructorReturn(this, (CustomSalesforceSettings.__proto__ || Object.getPrototypeOf(CustomSalesforceSettings)).call(this));
55912
+ var _this6 = _possibleConstructorReturn(this, (CustomSalesforceSettings.__proto__ || Object.getPrototypeOf(CustomSalesforceSettings)).call(this));
55901
55913
 
55902
- _this5.state = {
55914
+ _this6.state = {
55903
55915
  custom: false
55904
55916
  };
55905
- return _this5;
55917
+ return _this6;
55906
55918
  }
55907
55919
 
55908
55920
  _createClass(CustomSalesforceSettings, [{
@@ -55917,7 +55929,7 @@ module.exports =
55917
55929
  }, {
55918
55930
  key: 'render',
55919
55931
  value: function render() {
55920
- var _this6 = this;
55932
+ var _this7 = this;
55921
55933
 
55922
55934
  var inputs = this.props.inputs;
55923
55935
  var Radio = inputs.Radio;
@@ -55933,7 +55945,7 @@ module.exports =
55933
55945
  ),
55934
55946
  _react2.default.createElement('br', null),
55935
55947
  _react2.default.createElement(Radio, { onChange: function onChange() {
55936
- return _this6.setState({ custom: false });
55948
+ return _this7.setState({ custom: false });
55937
55949
  },
55938
55950
  label: 'Default Batch Size (10,000)',
55939
55951
  checked: this.state.custom === false,
@@ -55941,7 +55953,7 @@ module.exports =
55941
55953
  }),
55942
55954
  _react2.default.createElement('br', null),
55943
55955
  _react2.default.createElement(Radio, { onChange: function onChange() {
55944
- return _this6.setState({ custom: true });
55956
+ return _this7.setState({ custom: true });
55945
55957
  },
55946
55958
  label: 'Custom Batch Size',
55947
55959
  checked: this.state.custom === true,
@@ -56591,9 +56603,9 @@ module.exports =
56591
56603
  _react2.default.createElement(
56592
56604
  'div',
56593
56605
  { className: 'labelz', style: { fontSize: '14px', marginBottom: 5 } },
56594
- fileSchema && fileSchema.resources && fileSchema.fileSchema.length > 0 ? 'Available Files:' : 'No available files. Please upload files to your SFTP server and click Check Connection in the Environments step.'
56606
+ fileSchema && fileSchema.resources && fileSchema.resources.length > 0 ? 'Available Files:' : 'No available files. Please upload files to your SFTP server and click Check Connection in the Environments step.'
56595
56607
  ),
56596
- fileSchema && fileSchema.resources && fileSchema.fileSchema.length > 0 && _react2.default.createElement(FileTable, {
56608
+ fileSchema && fileSchema.resources && fileSchema.resources.length > 0 && _react2.default.createElement(FileTable, {
56597
56609
  files: fileSchema.resources, inputs: inputs, mode: step.mode,
56598
56610
  removeFile: this.removeFile
56599
56611
  }),
@@ -59284,18 +59296,24 @@ module.exports =
59284
59296
  environmentId: String(formValues['environmentId'])
59285
59297
  }, formValues['batchSize'] && { batchSize: formValues['batchSize'] }, formValues['includeSystemResources'] && { includeSystemResources: formValues['includeSystemResources'] ? 'true' : 'false' });
59286
59298
  // saving schemas for SFTP, so there does not have to be a file on server to reload wizard
59287
- var sourceFileSchema = {
59288
- resources: formValues['sourceFileSchema'],
59289
- name: title + ' Schema',
59290
- providerType: wizardConfig.source.type,
59291
- isSource: true
59292
- };
59293
- var destinationFileSchema = {
59294
- resources: formValues['destinationFileSchema'],
59295
- name: title + ' Schema',
59296
- providerType: wizardConfig.destination.type,
59297
- isSource: false
59298
- };
59299
+ var sourceFileSchema = {};
59300
+ var destinationFileSchema = {};
59301
+ if (formValues['sourceFileSchema'] && wizardConfig.source.type.toLowerCase() === 'sftp') {
59302
+ sourceFileSchema = {
59303
+ resources: formValues['sourceFileSchema'].resources,
59304
+ name: title + ' Schema',
59305
+ providerType: wizardConfig.source.type,
59306
+ isSource: true
59307
+ };
59308
+ }
59309
+ if (formValues['destinationFileSchema'] && wizardConfig.destination.type.toLowerCase() === 'sftp') {
59310
+ destinationFileSchema = {
59311
+ resources: formValues['destinationFileSchema'].resources,
59312
+ name: title + ' Schema',
59313
+ providerType: wizardConfig.destination.type,
59314
+ isSource: false
59315
+ };
59316
+ }
59299
59317
  return { title: title, envName: envName, envId: envId, bundles: bundles, mappings: mappings, typeId: typeId, typeGuid: typeGuid, configuration: configuration, deployment: deployment, sourceFileSchema: sourceFileSchema, destinationFileSchema: destinationFileSchema };
59300
59318
  }
59301
59319
  var form = crunch(formValues, this.props.wizardConfig, this.props.wizard);