@lingk/sync 1.1.8 → 1.1.9

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