@lingk/sync 1.1.41 → 1.1.43

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
@@ -7244,7 +7244,7 @@ module.exports =
7244
7244
 
7245
7245
  // all credential fields are filled
7246
7246
 
7247
- var credsDisabledCheck = config && config.credentials.some(function (c) {
7247
+ var credsDisabledCheck = config && config.credentials && config.credentials.some(function (c) {
7248
7248
  var formCreds = creds;
7249
7249
  return !Object.keys(formCreds).includes(c.split(' ').join(''));
7250
7250
  });
@@ -55684,10 +55684,10 @@ module.exports =
55684
55684
 
55685
55685
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
55686
55686
 
55687
- function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
55688
-
55689
55687
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
55690
55688
 
55689
+ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
55690
+
55691
55691
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
55692
55692
 
55693
55693
  function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
@@ -55702,15 +55702,50 @@ module.exports =
55702
55702
 
55703
55703
  var _this = _possibleConstructorReturn(this, (EnvStep.__proto__ || Object.getPrototypeOf(EnvStep)).call(this));
55704
55704
 
55705
- _this.checkOauthCreds = function (phase, mode) {
55705
+ _this.updateFileSchema = function (mode, config, metadata) {
55706
+ if (!metadata) return;
55706
55707
  var _this$props = _this.props,
55707
- actions = _this$props.actions,
55708
- tenantId = _this$props.tenantId,
55709
- accountId = _this$props.accountId,
55710
55708
  formValues = _this$props.formValues,
55711
- step = _this$props.step,
55712
- wizard = _this$props.wizard,
55713
55709
  change = _this$props.change;
55710
+ // set meta for File Schema step if needed
55711
+ // set defaults of filename and delimiter
55712
+
55713
+ var isSFTP = config.type === 'SFTP';
55714
+ if (isSFTP) {
55715
+ (function () {
55716
+ var savedFileSchema = [];
55717
+ if (_this.props.formValues[mode + 'FileSchema']) {
55718
+ savedFileSchema = [].concat(_toConsumableArray(formValues[mode + 'FileSchema']));
55719
+ }
55720
+ var fileSchema = metadata.resources && metadata.resources.map(function (r) {
55721
+ var existing = savedFileSchema.find(function (rsc) {
55722
+ return r.name === rsc.name && r.type === rsc.type;
55723
+ });
55724
+ if (existing) return existing;
55725
+ return Object.assign({}, r, {
55726
+ filePattern: r.name,
55727
+ delimiter: ','
55728
+ });
55729
+ });
55730
+ change(mode + 'FileSchema', fileSchema);
55731
+ })();
55732
+ }
55733
+
55734
+ var isFlat = config.type === 'LocalFile';
55735
+ if (isFlat) {
55736
+ change(mode + 'FileSchema', metadata);
55737
+ }
55738
+ };
55739
+
55740
+ _this.checkOauthCreds = function (phase, mode) {
55741
+ var _this$props2 = _this.props,
55742
+ actions = _this$props2.actions,
55743
+ tenantId = _this$props2.tenantId,
55744
+ accountId = _this$props2.accountId,
55745
+ formValues = _this$props2.formValues,
55746
+ step = _this$props2.step,
55747
+ wizard = _this$props2.wizard,
55748
+ change = _this$props2.change;
55714
55749
 
55715
55750
  var config = step[mode + 'Config'];
55716
55751
  var env = wizard.environments.find(function (e) {
@@ -55735,22 +55770,22 @@ module.exports =
55735
55770
  };
55736
55771
 
55737
55772
  _this.generateNewAdapterSecret = function (mode) {
55738
- var _this$props2 = _this.props,
55739
- actions = _this$props2.actions,
55740
- tenantId = _this$props2.tenantId,
55741
- accountId = _this$props2.accountId,
55742
- formValues = _this$props2.formValues;
55773
+ var _this$props3 = _this.props,
55774
+ actions = _this$props3.actions,
55775
+ tenantId = _this$props3.tenantId,
55776
+ accountId = _this$props3.accountId,
55777
+ formValues = _this$props3.formValues;
55743
55778
 
55744
55779
  var envName = formValues['environment'];
55745
55780
  actions.generateNewAdapterSecret(tenantId, accountId, envName, mode);
55746
55781
  };
55747
55782
 
55748
55783
  _this.deleteFlatFile = function (fileName, mode) {
55749
- var _this$props3 = _this.props,
55750
- tenantId = _this$props3.tenantId,
55751
- accountId = _this$props3.accountId,
55752
- actions = _this$props3.actions,
55753
- formValues = _this$props3.formValues;
55784
+ var _this$props4 = _this.props,
55785
+ tenantId = _this$props4.tenantId,
55786
+ accountId = _this$props4.accountId,
55787
+ actions = _this$props4.actions,
55788
+ formValues = _this$props4.formValues;
55754
55789
 
55755
55790
  return actions.deleteFlatFile(tenantId, accountId, formValues['environmentId'], fileName).then(function () {
55756
55791
  var isReload = true;
@@ -55759,13 +55794,13 @@ module.exports =
55759
55794
  };
55760
55795
 
55761
55796
  _this.downloadFileFromAws = function (file) {
55762
- var _this$props4 = _this.props,
55763
- tenantId = _this$props4.tenantId,
55764
- accountId = _this$props4.accountId,
55765
- tenantKey = _this$props4.tenantKey,
55766
- accountKey = _this$props4.accountKey,
55767
- actions = _this$props4.actions,
55768
- formValues = _this$props4.formValues;
55797
+ var _this$props5 = _this.props,
55798
+ tenantId = _this$props5.tenantId,
55799
+ accountId = _this$props5.accountId,
55800
+ tenantKey = _this$props5.tenantKey,
55801
+ accountKey = _this$props5.accountKey,
55802
+ actions = _this$props5.actions,
55803
+ formValues = _this$props5.formValues;
55769
55804
 
55770
55805
  return actions.downloadFileFromAws(tenantId, accountId, tenantKey, accountKey, formValues['environmentId'], file);
55771
55806
  };
@@ -55816,25 +55851,34 @@ module.exports =
55816
55851
  }, {
55817
55852
  key: 'componentDidMount',
55818
55853
  value: function componentDidMount() {
55819
- var wizard = this.props.wizard;
55854
+ var _this2 = this;
55855
+
55856
+ var _props3 = this.props,
55857
+ wizard = _props3.wizard,
55858
+ step = _props3.step;
55820
55859
 
55821
55860
  if (wizard.environments && wizard.environments.length === 1) {
55822
55861
  this.selectEnvironment(null, null, wizard.environments[0]);
55823
55862
  }
55863
+ // IF SAVED CONFIG, LOAD UP FLAT FILES INTO ENV
55864
+ var modes = ['source', 'destination'];
55865
+ modes.forEach(function (mode) {
55866
+ _this2.updateFileSchema(mode, step[mode + 'Config'], wizard[mode + 'Metadata']);
55867
+ });
55824
55868
  }
55825
55869
  }, {
55826
55870
  key: 'check',
55827
55871
  value: function check(mode, environment, actualCreds, isReload, extraQuery) {
55828
- var _this2 = this;
55872
+ var _this3 = this;
55829
55873
 
55830
- var _props3 = this.props,
55831
- actions = _props3.actions,
55832
- tenantId = _props3.tenantId,
55833
- accountId = _props3.accountId,
55834
- formValues = _props3.formValues,
55835
- step = _props3.step,
55836
- change = _props3.change,
55837
- wizard = _props3.wizard;
55874
+ var _props4 = this.props,
55875
+ actions = _props4.actions,
55876
+ tenantId = _props4.tenantId,
55877
+ accountId = _props4.accountId,
55878
+ formValues = _props4.formValues,
55879
+ step = _props4.step,
55880
+ change = _props4.change,
55881
+ wizard = _props4.wizard;
55838
55882
 
55839
55883
  var config = step[mode + 'Config'];
55840
55884
  var credentials = actualCreds;
@@ -55852,46 +55896,19 @@ module.exports =
55852
55896
  change(mode + 'Credentials', credentials);
55853
55897
  this.setState(_defineProperty({}, mode + 'EnvChecking', true));
55854
55898
  actions.callGetMetadata(tenantId, accountId, mode, step[mode + 'Provider'], config, endpoint || '_blank', step.isFramework, credentials, env, isReload, null, extraQuery).then(function (metadata) {
55855
- _this2.setState(_defineProperty({}, mode + 'EnvChecking', false));
55856
- // set meta for File Schema step if needed
55857
- // set defaults of filename and delimiter
55858
- var isSFTP = config.type === 'SFTP';
55859
-
55860
- if (isSFTP) {
55861
- (function () {
55862
- var savedFileSchema = [];
55863
- if (_this2.props.formValues[mode + 'FileSchema']) {
55864
- savedFileSchema = [].concat(_toConsumableArray(formValues[mode + 'FileSchema']));
55865
- }
55866
- var fileSchema = metadata.resources && metadata.resources.map(function (r) {
55867
- var existing = savedFileSchema.find(function (rsc) {
55868
- return r.name === rsc.name && r.type === rsc.type;
55869
- });
55870
- if (existing) return existing;
55871
- return Object.assign({}, r, {
55872
- filePattern: r.name,
55873
- delimiter: ','
55874
- });
55875
- });
55876
- change(mode + 'FileSchema', fileSchema);
55877
- })();
55878
- }
55879
-
55880
- var isFlat = config.type === 'LocalFile';
55881
- if (isFlat) {
55882
- change(mode + 'FileSchema', metadata);
55883
- }
55899
+ _this3.setState(_defineProperty({}, mode + 'EnvChecking', false));
55900
+ _this3.updateFileSchema(mode, config, metadata);
55884
55901
  });
55885
55902
  }
55886
55903
  }, {
55887
55904
  key: 'getOauthUrl',
55888
55905
  value: function getOauthUrl(type, mode) {
55889
- var _props4 = this.props,
55890
- actions = _props4.actions,
55891
- tenantId = _props4.tenantId,
55892
- accountId = _props4.accountId,
55893
- step = _props4.step,
55894
- formValues = _props4.formValues;
55906
+ var _props5 = this.props,
55907
+ actions = _props5.actions,
55908
+ tenantId = _props5.tenantId,
55909
+ accountId = _props5.accountId,
55910
+ step = _props5.step,
55911
+ formValues = _props5.formValues;
55895
55912
 
55896
55913
  var envName = formValues['environment'];
55897
55914
  actions.getOauthUrl(tenantId, accountId, step.typeGuid, type, mode, envName);
@@ -55899,9 +55916,9 @@ module.exports =
55899
55916
  }, {
55900
55917
  key: 'clickDirection',
55901
55918
  value: function clickDirection() {
55902
- var _props5 = this.props,
55903
- change = _props5.change,
55904
- nav = _props5.nav;
55919
+ var _props6 = this.props,
55920
+ change = _props6.change,
55921
+ nav = _props6.nav;
55905
55922
 
55906
55923
  change('resourceGroups', []);
55907
55924
  change('scenario', null);
@@ -55928,15 +55945,15 @@ module.exports =
55928
55945
  }, {
55929
55946
  key: 'tryGetCredentialAndCheck',
55930
55947
  value: function tryGetCredentialAndCheck(env) {
55931
- var _this3 = this;
55948
+ var _this4 = this;
55932
55949
 
55933
- var _props6 = this.props,
55934
- step = _props6.step,
55935
- actions = _props6.actions,
55936
- tenantId = _props6.tenantId,
55937
- accountId = _props6.accountId,
55938
- change = _props6.change,
55939
- formValues = _props6.formValues;
55950
+ var _props7 = this.props,
55951
+ step = _props7.step,
55952
+ actions = _props7.actions,
55953
+ tenantId = _props7.tenantId,
55954
+ accountId = _props7.accountId,
55955
+ change = _props7.change,
55956
+ formValues = _props7.formValues;
55940
55957
 
55941
55958
  var modes = ['source', 'destination'];
55942
55959
  change('sourceCredentials', { rootUrl: 'https://' });
@@ -55961,9 +55978,9 @@ module.exports =
55961
55978
  if (formValues.includeSystemResources && wiz[m].type === 'Salesforce') {
55962
55979
  extraQuery = '?all=true';
55963
55980
  }
55964
- _this3.check(m, env, modeCreds, isReload, extraQuery);
55981
+ _this4.check(m, env, modeCreds, isReload, extraQuery);
55965
55982
  } else {
55966
- _this3.setState(_defineProperty({}, m + 'EnvChecking', false));
55983
+ _this4.setState(_defineProperty({}, m + 'EnvChecking', false));
55967
55984
  }
55968
55985
  } else {
55969
55986
  // adapter secret if exists
@@ -55977,22 +55994,22 @@ module.exports =
55977
55994
  }, {
55978
55995
  key: 'setCsvFields',
55979
55996
  value: function setCsvFields(meta, contents, mode, providerType) {
55980
- var _this4 = this;
55997
+ var _this5 = this;
55981
55998
 
55982
- var _props7 = this.props,
55983
- tenantId = _props7.tenantId,
55984
- accountId = _props7.accountId,
55985
- tenantKey = _props7.tenantKey,
55986
- accountKey = _props7.accountKey,
55987
- actions = _props7.actions,
55988
- formValues = _props7.formValues;
55999
+ var _props8 = this.props,
56000
+ tenantId = _props8.tenantId,
56001
+ accountId = _props8.accountId,
56002
+ tenantKey = _props8.tenantKey,
56003
+ accountKey = _props8.accountKey,
56004
+ actions = _props8.actions,
56005
+ formValues = _props8.formValues;
55989
56006
  //let meta = wizard[`${mode}Metadata`] || []
55990
56007
  //meta = meta.concat(metadata)
55991
56008
 
55992
56009
  return actions.setCsvFields(tenantId, accountId, tenantKey, accountKey, meta, contents, mode, providerType, mode === 'source', formValues['environmentId']).then(function (d) {
55993
56010
  // get the new list of files
55994
56011
  var isReload = true; // skip post creds
55995
- return _this4.check(mode, null, d, isReload, '');
56012
+ return _this5.check(mode, null, d, isReload, '');
55996
56013
  });
55997
56014
  }
55998
56015
  }, {
@@ -56003,11 +56020,11 @@ module.exports =
56003
56020
  }, {
56004
56021
  key: 'createCustomSettings',
56005
56022
  value: function createCustomSettings(mode) {
56006
- var _props8 = this.props,
56007
- wizard = _props8.wizard,
56008
- step = _props8.step,
56009
- inputs = _props8.inputs,
56010
- formValues = _props8.formValues;
56023
+ var _props9 = this.props,
56024
+ wizard = _props9.wizard,
56025
+ step = _props9.step,
56026
+ inputs = _props9.inputs,
56027
+ formValues = _props9.formValues;
56011
56028
 
56012
56029
  var config = step[mode + 'Config'];
56013
56030
  var customSettings = null;
@@ -56027,19 +56044,19 @@ module.exports =
56027
56044
  }, {
56028
56045
  key: 'render',
56029
56046
  value: function render() {
56030
- var _this5 = this;
56047
+ var _this6 = this;
56031
56048
 
56032
- var _props9 = this.props,
56033
- inputs = _props9.inputs,
56034
- step = _props9.step,
56035
- handleSubmit = _props9.handleSubmit,
56036
- nav = _props9.nav,
56037
- reset = _props9.reset,
56038
- wizard = _props9.wizard,
56039
- formValues = _props9.formValues,
56040
- tenantKey = _props9.tenantKey,
56041
- accountKey = _props9.accountKey,
56042
- change = _props9.change;
56049
+ var _props10 = this.props,
56050
+ inputs = _props10.inputs,
56051
+ step = _props10.step,
56052
+ handleSubmit = _props10.handleSubmit,
56053
+ nav = _props10.nav,
56054
+ reset = _props10.reset,
56055
+ wizard = _props10.wizard,
56056
+ formValues = _props10.formValues,
56057
+ tenantKey = _props10.tenantKey,
56058
+ accountKey = _props10.accountKey,
56059
+ change = _props10.change;
56043
56060
 
56044
56061
  var modes = ['source', 'destination'];
56045
56062
  var selectedProvider = this.state.selectedProvider;
@@ -56093,16 +56110,16 @@ module.exports =
56093
56110
  _react2.default.createElement('br', null),
56094
56111
  modes.map(function (m) {
56095
56112
  var isSelected = step[m + 'Provider'] === selectedProvider;
56096
- var checking = _this5.state[m + 'EnvChecking'];
56113
+ var checking = _this6.state[m + 'EnvChecking'];
56097
56114
  var adapterSecret = wizard.savedCredentials && wizard.savedCredentials[m + 'AdapterSecret'] && wizard.savedCredentials[m + 'AdapterSecret'].credentials;
56098
- var customSettings = _this5.createCustomSettings(m);
56115
+ var customSettings = _this6.createCustomSettings(m);
56099
56116
  return _react2.default.createElement(
56100
56117
  'div',
56101
56118
  { key: m, className: 'env-section' },
56102
56119
  _react2.default.createElement(
56103
56120
  'div',
56104
56121
  { onClick: function onClick() {
56105
- return _this5.selectProvider(step[m + 'Provider']);
56122
+ return _this6.selectProvider(step[m + 'Provider']);
56106
56123
  },
56107
56124
  className: 'env-section-header' },
56108
56125
  _react2.default.createElement(EnvCheckIcons, { wizard: wizard, inputs: inputs, mode: m, checking: checking, isSelected: isSelected }),
@@ -56116,7 +56133,7 @@ module.exports =
56116
56133
  'div',
56117
56134
  { className: 'env-inspect-button',
56118
56135
  onClick: function onClick() {
56119
- return _this5.setState({ showResources: m });
56136
+ return _this6.setState({ showResources: m });
56120
56137
  } },
56121
56138
  _react2.default.createElement(
56122
56139
  'span',
@@ -56145,32 +56162,32 @@ module.exports =
56145
56162
  _react2.default.createElement(
56146
56163
  _credSections2.default,
56147
56164
  { config: step[m + 'Config'], checking: checking,
56148
- wizard: wizard, getOauthUrl: _this5.getOauthUrl.bind(_this5),
56165
+ wizard: wizard, getOauthUrl: _this6.getOauthUrl.bind(_this6),
56149
56166
  formValues: formValues, inputs: inputs,
56150
56167
  generateNewAdapterSecret: function generateNewAdapterSecret() {
56151
- return _this5.generateNewAdapterSecret(m);
56168
+ return _this6.generateNewAdapterSecret(m);
56152
56169
  },
56153
- seeFields: _this5.seeFields.bind(_this5),
56170
+ seeFields: _this6.seeFields.bind(_this6),
56154
56171
  fileSchema: formValues[m + 'FileSchema'],
56155
56172
  check: function check(actualCreds, extraQuery) {
56156
- _this5.check(m, null, actualCreds, null, extraQuery);
56173
+ _this6.check(m, null, actualCreds, null, extraQuery);
56157
56174
  }, change: change,
56158
56175
  tenantKey: tenantKey, accountKey: accountKey,
56159
56176
  setCsvFields: function setCsvFields(meta, contents, providerType) {
56160
- return _this5.setCsvFields(meta, contents, m, providerType);
56177
+ return _this6.setCsvFields(meta, contents, m, providerType);
56161
56178
  },
56162
- downloadFileFromAws: _this5.downloadFileFromAws,
56179
+ downloadFileFromAws: _this6.downloadFileFromAws,
56163
56180
  clearCsvFields: function clearCsvFields() {
56164
- return _this5.clearCsvFields(m);
56181
+ return _this6.clearCsvFields(m);
56165
56182
  },
56166
56183
  creds: formValues[m + 'Credentials'],
56167
56184
  envCheckResult: wizard[m + 'CheckResult'],
56168
56185
  adapterSecret: adapterSecret,
56169
56186
  deleteFlatFile: function deleteFlatFile(fileName) {
56170
- return _this5.deleteFlatFile(fileName, m);
56187
+ return _this6.deleteFlatFile(fileName, m);
56171
56188
  },
56172
56189
  checkOauthCreds: function checkOauthCreds(phase) {
56173
- return _this5.checkOauthCreds(phase, m);
56190
+ return _this6.checkOauthCreds(phase, m);
56174
56191
  } },
56175
56192
  _react2.default.isValidElement(customSettings) ? _react2.default.cloneElement(customSettings) : null
56176
56193
  )
@@ -56182,7 +56199,7 @@ module.exports =
56182
56199
  ),
56183
56200
  this.state.showResources && _react2.default.createElement(PreviewModal, {
56184
56201
  onHide: function onHide() {
56185
- return _this5.setState({ showResources: null });
56202
+ return _this6.setState({ showResources: null });
56186
56203
  },
56187
56204
  mode: this.state.showResources, wizard: wizard,
56188
56205
  step: step, inputs: inputs,
@@ -56355,12 +56372,12 @@ module.exports =
56355
56372
  function CustomSalesforceSettings() {
56356
56373
  _classCallCheck(this, CustomSalesforceSettings);
56357
56374
 
56358
- var _this6 = _possibleConstructorReturn(this, (CustomSalesforceSettings.__proto__ || Object.getPrototypeOf(CustomSalesforceSettings)).call(this));
56375
+ var _this7 = _possibleConstructorReturn(this, (CustomSalesforceSettings.__proto__ || Object.getPrototypeOf(CustomSalesforceSettings)).call(this));
56359
56376
 
56360
- _this6.state = {
56377
+ _this7.state = {
56361
56378
  custom: false
56362
56379
  };
56363
- return _this6;
56380
+ return _this7;
56364
56381
  }
56365
56382
 
56366
56383
  _createClass(CustomSalesforceSettings, [{
@@ -56375,7 +56392,7 @@ module.exports =
56375
56392
  }, {
56376
56393
  key: 'render',
56377
56394
  value: function render() {
56378
- var _this7 = this;
56395
+ var _this8 = this;
56379
56396
 
56380
56397
  var inputs = this.props.inputs;
56381
56398
  var Radio = inputs.Radio;
@@ -56391,7 +56408,7 @@ module.exports =
56391
56408
  ),
56392
56409
  _react2.default.createElement('br', null),
56393
56410
  _react2.default.createElement(Radio, { onChange: function onChange() {
56394
- return _this7.setState({ custom: false });
56411
+ return _this8.setState({ custom: false });
56395
56412
  },
56396
56413
  label: 'Default Batch Size (10,000)',
56397
56414
  checked: this.state.custom === false,
@@ -56399,7 +56416,7 @@ module.exports =
56399
56416
  }),
56400
56417
  _react2.default.createElement('br', null),
56401
56418
  _react2.default.createElement(Radio, { onChange: function onChange() {
56402
- return _this7.setState({ custom: true });
56419
+ return _this8.setState({ custom: true });
56403
56420
  },
56404
56421
  label: 'Custom Batch Size',
56405
56422
  checked: this.state.custom === true,