@lingk/sync 1.0.2 → 1.0.4

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
@@ -1908,6 +1908,8 @@ module.exports =
1908
1908
  value: true
1909
1909
  });
1910
1910
 
1911
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
1912
+
1911
1913
  var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
1912
1914
 
1913
1915
  var _react = __webpack_require__(1);
@@ -1940,6 +1942,13 @@ module.exports =
1940
1942
 
1941
1943
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
1942
1944
 
1945
+ function formatBytes(a, b) {
1946
+ if (0 === a) return "0 Bytes";var c = 1024,
1947
+ d = b || 2,
1948
+ e = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"],
1949
+ f = Math.floor(Math.log(a) / Math.log(c));return parseFloat((a / Math.pow(c, f)).toFixed(d)) + " " + e[f];
1950
+ }
1951
+
1943
1952
  // SKIP ON SERVER-SIDE RENDERING
1944
1953
  var codemirror = null;
1945
1954
  if (typeof window !== 'undefined' && typeof window.navigator !== 'undefined') {
@@ -2011,6 +2020,7 @@ module.exports =
2011
2020
  wizard = _props.wizard,
2012
2021
  adapterSecret = _props.adapterSecret,
2013
2022
  checkOauthCreds = _props.checkOauthCreds,
2023
+ metadata = _props.metadata,
2014
2024
  getOauthUrl = _props.getOauthUrl,
2015
2025
  generateNewAdapterSecret = _props.generateNewAdapterSecret,
2016
2026
  setCsvFields = _props.setCsvFields,
@@ -2035,7 +2045,7 @@ module.exports =
2035
2045
 
2036
2046
  var isOauth = config.credentials && config.credentials.length === 1 && config.credentials[0] === 'Oauth';
2037
2047
 
2038
- var isSFTP = config.credentials && config.credentials.length === 1 && config.credentials[0] === 'SFTP';
2048
+ var isFlatFile = config.credentials && config.credentials.length === 1 && config.credentials[0] === 'FlatFile';
2039
2049
 
2040
2050
  var isGoogle = config.type.startsWith('Google');
2041
2051
 
@@ -2044,22 +2054,23 @@ module.exports =
2044
2054
  return _react2.default.createElement(
2045
2055
  'div',
2046
2056
  { className: 'env-section-body' },
2047
- config.message && !isGoogle && _react2.default.createElement(
2057
+ config.message && !isGoogle && !isFlatFile ? _react2.default.createElement(
2048
2058
  'p',
2049
2059
  null,
2050
2060
  config.message,
2051
2061
  _react2.default.createElement('br', null),
2052
2062
  _react2.default.createElement('br', null)
2053
- ),
2063
+ ) : _react2.default.createElement('div', { style: { height: 13 } }),
2054
2064
  isOauth ? _react2.default.createElement(Oauth, { wizard: wizard, onCheck: check,
2055
2065
  creds: this.props.creds, providerType: providerType,
2056
2066
  onGenerateUrl: function onGenerateUrl(urlType) {
2057
2067
  return getOauthUrl(urlType, providerType);
2058
2068
  },
2059
2069
  checkOauthCreds: checkOauthCreds, envCheckResult: envCheckResult,
2060
- checking: checking, inputs: inputs }) : isSFTP ? _react2.default.createElement(SFTP, { wizard: wizard, onCheck: check,
2070
+ checking: checking, inputs: inputs }) : isFlatFile ? _react2.default.createElement(FlatFile, { wizard: wizard, onCheck: check, metadata: metadata,
2061
2071
  checking: checking, setCsvFields: setCsvFields,
2062
- providerType: providerType }) : isGoogle ? _react2.default.createElement(Google, { config: config, creds: creds, onChange: this.onChange,
2072
+ providerType: providerType, inputs: inputs,
2073
+ accountKey: accountKey, tenantKey: tenantKey }) : isGoogle ? _react2.default.createElement(Google, { config: config, creds: creds, onChange: this.onChange,
2063
2074
  credsDisabledCheck: credsDisabledCheck, inputs: inputs,
2064
2075
  onCheck: check }) : _react2.default.createElement(
2065
2076
  'div',
@@ -2240,64 +2251,100 @@ module.exports =
2240
2251
  );
2241
2252
  };
2242
2253
 
2243
- var SFTP = function (_Component2) {
2244
- _inherits(SFTP, _Component2);
2254
+ var FlatFile = function (_Component2) {
2255
+ _inherits(FlatFile, _Component2);
2245
2256
 
2246
2257
  // react-dropzone
2247
2258
  // papaparse
2248
2259
 
2249
- function SFTP() {
2250
- _classCallCheck(this, SFTP);
2260
+ function FlatFile() {
2261
+ _classCallCheck(this, FlatFile);
2251
2262
 
2252
- var _this3 = _possibleConstructorReturn(this, (SFTP.__proto__ || Object.getPrototypeOf(SFTP)).call(this));
2263
+ var _this3 = _possibleConstructorReturn(this, (FlatFile.__proto__ || Object.getPrototypeOf(FlatFile)).call(this));
2253
2264
 
2254
2265
  _this3.onDrop = function (fs) {
2255
- var _this3$props = _this3.props,
2256
- setCsvFields = _this3$props.setCsvFields,
2257
- providerType = _this3$props.providerType,
2258
- wizard = _this3$props.wizard;
2259
-
2260
- var m = wizard['metadata'] || [];
2261
- var files = [].concat(_toConsumableArray(_this3.state.files));
2266
+ var meta = [].concat(_toConsumableArray(_this3.state.meta));
2262
2267
  var counter = 0;
2268
+ var fileContents = [].concat(_toConsumableArray(_this3.state.fileContents));
2269
+ var contentCounter = 0;
2263
2270
  fs.forEach(function (file) {
2264
2271
  _papaparse2.default.parse(file, {
2265
2272
  header: true,
2273
+ dynamicTyping: true,
2266
2274
  complete: function complete(result) {
2267
- m = m.concat({
2268
- name: file.name.split('.')[0],
2269
- type: file.name.split('.')[0],
2275
+ meta = meta.concat({
2276
+ name: file.name,
2277
+ type: file.name.substr(0, file.name.lastIndexOf('.')).split(' ').join(),
2278
+ byteSize: file.size,
2270
2279
  properties: result.meta.fields.map(function (f) {
2271
2280
  return {
2272
2281
  label: f,
2273
- name: f,
2274
- type: 'string'
2282
+ name: f.split(' ').join(),
2283
+ type: result.data[0] && _typeof(result.data[0][f])
2275
2284
  };
2276
- })
2285
+ }),
2286
+ delimiter: result.meta.delimiter
2277
2287
  });
2278
- files = files.concat(file);
2279
2288
  counter += 1;
2280
2289
  if (counter === fs.length) {
2281
- _this3.setState({ files: files });
2282
- setCsvFields(m, providerType);
2290
+ // after last one is done
2291
+ _this3.setState({ meta: meta });
2283
2292
  }
2284
2293
  }
2285
2294
  });
2295
+ var reader = new FileReader();
2296
+ reader.addEventListener("loadend", function (event) {
2297
+ fileContents = fileContents.concat(event.target.result);
2298
+ contentCounter += 1;
2299
+ if (contentCounter === fs.length) {
2300
+ _this3.setState({ fileContents: fileContents });
2301
+ }
2302
+ });
2303
+ reader.readAsText(file);
2304
+ });
2305
+ };
2306
+
2307
+ _this3.onReject = function () {
2308
+ _this3.setState({ dropError: 'File is too big!' });
2309
+ setTimeout(function () {
2310
+ _this3.setState({ dropError: null });
2311
+ }, 3500);
2312
+ };
2313
+
2314
+ _this3.upload = function () {
2315
+ var _this3$props = _this3.props,
2316
+ setCsvFields = _this3$props.setCsvFields,
2317
+ providerType = _this3$props.providerType;
2318
+
2319
+ _this3.setState({ uploading: true });
2320
+ setCsvFields(_this3.state.meta, _this3.state.fileContents, providerType).then(function () {
2321
+ _this3.setState({ meta: [], uploading: false });
2286
2322
  });
2287
2323
  };
2288
2324
 
2289
2325
  _this3.state = {
2290
- files: []
2326
+ meta: [],
2327
+ fileContents: [],
2328
+ uploading: false,
2329
+ dropError: null
2291
2330
  };
2292
2331
  return _this3;
2293
2332
  }
2294
2333
 
2295
- _createClass(SFTP, [{
2334
+ _createClass(FlatFile, [{
2296
2335
  key: 'render',
2297
2336
  value: function render() {
2298
- var files = this.state.files;
2337
+ var _state = this.state,
2338
+ meta = _state.meta,
2339
+ uploading = _state.uploading,
2340
+ dropError = _state.dropError;
2341
+ var _props2 = this.props,
2342
+ metadata = _props2.metadata,
2343
+ inputs = _props2.inputs;
2299
2344
 
2300
- var hasFile = files && files.length > 0;
2345
+ var Button = inputs.Button;
2346
+ var Spinner = inputs.Spinner;
2347
+ var hasFile = meta && meta.length > 0;
2301
2348
  return _react2.default.createElement(
2302
2349
  'div',
2303
2350
  null,
@@ -2306,12 +2353,16 @@ module.exports =
2306
2353
  { style: { display: 'inline-block' } },
2307
2354
  _react2.default.createElement(
2308
2355
  _reactDropzone2.default,
2309
- { onDrop: this.onDrop,
2310
- className: 'dropzone' },
2311
- _react2.default.createElement(
2356
+ { onDropAccepted: this.onDrop, onDropRejected: this.onReject,
2357
+ className: 'dropzone', maxSize: 1000000 },
2358
+ !dropError ? _react2.default.createElement(
2312
2359
  'p',
2313
2360
  null,
2314
- 'Drop one or more files here, or click to select files to upload.'
2361
+ 'Drop one or more CSV files here, or click to select files to upload.'
2362
+ ) : _react2.default.createElement(
2363
+ 'p',
2364
+ { style: { color: '#c9302c', fontWeight: 'bold' } },
2365
+ dropError
2315
2366
  )
2316
2367
  )
2317
2368
  ),
@@ -2319,21 +2370,76 @@ module.exports =
2319
2370
  'aside',
2320
2371
  { style: { marginLeft: 30, display: 'inline-block' } },
2321
2372
  _react2.default.createElement(
2322
- 'h3',
2323
- { style: { marginTop: 10 } },
2324
- 'Dropped files'
2373
+ 'div',
2374
+ null,
2375
+ _react2.default.createElement(
2376
+ 'h3',
2377
+ { style: { marginTop: 10, display: 'inline-block', verticalAlign: 'top' } },
2378
+ 'Dropped files'
2379
+ ),
2380
+ _react2.default.createElement(
2381
+ Button,
2382
+ {
2383
+ onClick: this.upload,
2384
+ style: { marginTop: 4, marginLeft: 20, verticalAlign: 'top', height: 36 },
2385
+ disabled: uploading },
2386
+ _react2.default.createElement(
2387
+ 'span',
2388
+ { style: { display: 'inline-block', verticalAlign: 'top', marginTop: 3 } },
2389
+ 'Upload'
2390
+ ),
2391
+ '\xA0\xA0',
2392
+ _react2.default.createElement(UploadIcon, null)
2393
+ ),
2394
+ uploading && _react2.default.createElement(
2395
+ 'div',
2396
+ { style: { paddingLeft: 12, paddingTop: 12, display: 'inline-block' } },
2397
+ _react2.default.createElement(Spinner, null)
2398
+ )
2399
+ ),
2400
+ _react2.default.createElement(
2401
+ 'ul',
2402
+ null,
2403
+ meta.map(function (f, i) {
2404
+ return _react2.default.createElement(
2405
+ 'li',
2406
+ { key: i, style: { listStyle: 'none' } },
2407
+ f.name,
2408
+ ' - ',
2409
+ formatBytes(f.byteSize)
2410
+ );
2411
+ })
2412
+ )
2413
+ ),
2414
+ !uploading && !hasFile && metadata && metadata.length > 0 && _react2.default.createElement(
2415
+ 'div',
2416
+ { style: {
2417
+ marginLeft: 20, display: 'inline-block', marginTop: 13, verticalAlign: 'top'
2418
+ } },
2419
+ _react2.default.createElement(
2420
+ 'div',
2421
+ { style: { marginBottom: 4 } },
2422
+ _react2.default.createElement(
2423
+ 'strong',
2424
+ { style: { marginRight: 5 } },
2425
+ metadata && metadata.length
2426
+ ),
2427
+ _react2.default.createElement(
2428
+ 'strong',
2429
+ null,
2430
+ 'file' + (metadata.length === 1 ? '' : 's') + ' uploaded'
2431
+ )
2325
2432
  ),
2326
2433
  _react2.default.createElement(
2327
2434
  'ul',
2328
2435
  null,
2329
- files.map(function (f, i) {
2436
+ metadata.map(function (f, i) {
2330
2437
  return _react2.default.createElement(
2331
2438
  'li',
2332
- { key: i },
2439
+ { key: i, style: { listStyle: 'none' } },
2333
2440
  f.name,
2334
2441
  ' - ',
2335
- f.size,
2336
- ' bytes'
2442
+ formatBytes(f.byteSize)
2337
2443
  );
2338
2444
  })
2339
2445
  )
@@ -2342,9 +2448,18 @@ module.exports =
2342
2448
  }
2343
2449
  }]);
2344
2450
 
2345
- return SFTP;
2451
+ return FlatFile;
2346
2452
  }(_react.Component);
2347
2453
 
2454
+ var UploadIcon = function UploadIcon() {
2455
+ return _react2.default.createElement(
2456
+ 'svg',
2457
+ { fill: '#666', height: '24', viewBox: '0 0 24 24', width: '24' },
2458
+ _react2.default.createElement('path', { d: 'M0 0h24v24H0z', fill: 'none' }),
2459
+ _react2.default.createElement('path', { d: 'M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z' })
2460
+ );
2461
+ };
2462
+
2348
2463
  var Oauth = function (_Component3) {
2349
2464
  _inherits(Oauth, _Component3);
2350
2465
 
@@ -2391,15 +2506,15 @@ module.exports =
2391
2506
  }, {
2392
2507
  key: 'render',
2393
2508
  value: function render() {
2394
- var _props2 = this.props,
2395
- wizard = _props2.wizard,
2396
- onGenerateUrl = _props2.onGenerateUrl,
2397
- onCheck = _props2.onCheck,
2398
- providerType = _props2.providerType,
2399
- checking = _props2.checking,
2400
- creds = _props2.creds,
2401
- inputs = _props2.inputs,
2402
- envCheckResult = _props2.envCheckResult;
2509
+ var _props3 = this.props,
2510
+ wizard = _props3.wizard,
2511
+ onGenerateUrl = _props3.onGenerateUrl,
2512
+ onCheck = _props3.onCheck,
2513
+ providerType = _props3.providerType,
2514
+ checking = _props3.checking,
2515
+ creds = _props3.creds,
2516
+ inputs = _props3.inputs,
2517
+ envCheckResult = _props3.envCheckResult;
2403
2518
 
2404
2519
  var Spinner = inputs.Spinner;
2405
2520
  var Button = inputs.Button;
@@ -2591,13 +2706,13 @@ module.exports =
2591
2706
  value: function render() {
2592
2707
  var _this8 = this;
2593
2708
 
2594
- var _props3 = this.props,
2595
- generateNewAdapterSecret = _props3.generateNewAdapterSecret,
2596
- tenantKey = _props3.tenantKey,
2597
- accountKey = _props3.accountKey,
2598
- providerType = _props3.providerType,
2599
- secret = _props3.secret,
2600
- inputs = _props3.inputs;
2709
+ var _props4 = this.props,
2710
+ generateNewAdapterSecret = _props4.generateNewAdapterSecret,
2711
+ tenantKey = _props4.tenantKey,
2712
+ accountKey = _props4.accountKey,
2713
+ providerType = _props4.providerType,
2714
+ secret = _props4.secret,
2715
+ inputs = _props4.inputs;
2601
2716
 
2602
2717
  var Spinner = inputs.Spinner;
2603
2718
  var Button = inputs.Button;
@@ -16688,6 +16803,8 @@ module.exports =
16688
16803
  });
16689
16804
  exports.callGetMetadata = callGetMetadata;
16690
16805
  exports.setCsvFields = setCsvFields;
16806
+ exports.uploadFilesToS3 = uploadFilesToS3;
16807
+ exports.singleFileToS3 = singleFileToS3;
16691
16808
  exports.tryCheckConnection = tryCheckConnection;
16692
16809
  exports.callGetProviderMetadata = callGetProviderMetadata;
16693
16810
  exports.getOauthUrl = getOauthUrl;
@@ -16735,6 +16852,10 @@ module.exports =
16735
16852
 
16736
16853
  var _moment2 = _interopRequireDefault(_moment);
16737
16854
 
16855
+ var _axios = __webpack_require__(218);
16856
+
16857
+ var _axios2 = _interopRequireDefault(_axios);
16858
+
16738
16859
  var _reduxForm = __webpack_require__(2);
16739
16860
 
16740
16861
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -16752,7 +16873,8 @@ module.exports =
16752
16873
  mode: mode
16753
16874
  });
16754
16875
  return dispatch(tryCheckConnection(tenantId, appId, providerType, credsConfig, isFramework, creds, urlSuffix)).then(function (r) {
16755
- return dispatch(callGetProviderMetadata(tenantId, appId, urlSuffix, apiUrl, mode, providerType, endpoint, isOauth, environment.name));
16876
+ var schemaGuid = creds.schemaGuid; // for flat file schema
16877
+ return dispatch(callGetProviderMetadata(tenantId, appId, urlSuffix, apiUrl, mode, providerType, endpoint, isOauth, environment.name, schemaGuid));
16756
16878
  }).then(function (m) {
16757
16879
  metadata = m;
16758
16880
  var isIntro = endpoint === '_blank';
@@ -16775,11 +16897,74 @@ module.exports =
16775
16897
  };
16776
16898
  }
16777
16899
 
16778
- function setCsvFields(metadata, mode, providerType) {
16779
- return {
16780
- type: types.FINISH_WIZARD_ENV_CHECK,
16781
- data: { metadata: metadata, mode: mode, code: '200 OK', providerType: providerType }
16900
+ function setCsvFields(tenantId, appId, tenantKey, appKey, metadata, contents, mode, providerType, isSource, envId) {
16901
+ var d = null;
16902
+ return function (dispatch, getState, api) {
16903
+ var _getState = getState(),
16904
+ config = _getState.config;
16905
+
16906
+ return api.post(tenantId + '/' + appId + '/fileschema', {
16907
+ endpoint: config.TRANS_API_URL,
16908
+ data: { name: 'flatfile', resources: metadata, providerType: providerType, isSource: isSource }
16909
+ }).then(function (data) {
16910
+ d = data;
16911
+ return dispatch(uploadFilesToS3(tenantKey, appKey, metadata, data, contents));
16912
+ }).then(function () {
16913
+ return dispatch(postCredentials(tenantId, appId, providerType, d.guids, mode, envId)).then(function () {
16914
+ dispatch({
16915
+ type: types.FINISH_WIZARD_ENV_CHECK,
16916
+ data: { metadata: { resources: metadata }, mode: mode, code: '200 OK', providerType: providerType }
16917
+ });
16918
+ });
16919
+ }).catch(function (err) {
16920
+ console.log(err);
16921
+ });
16922
+ };
16923
+ }
16924
+
16925
+ function uploadFilesToS3(tenantKey, appKey, metadata, d, contents) {
16926
+ var args = contents.map(function (fileContent, i) {
16927
+ return { tenantKey: tenantKey, appKey: appKey, fileContent: fileContent, d: d, fileName: metadata[i].name };
16928
+ });
16929
+ return function (dispatch, getState, api) {
16930
+ return Promise.all(args.map(singleFileToS3));
16931
+ };
16932
+ }
16933
+
16934
+ function singleFileToS3(_ref) {
16935
+ var tenantKey = _ref.tenantKey,
16936
+ appKey = _ref.appKey,
16937
+ d = _ref.d,
16938
+ fileContent = _ref.fileContent,
16939
+ fileName = _ref.fileName;
16940
+
16941
+ if (!d.guids.files[fileName]) {
16942
+ return function () {
16943
+ return Promise.resolve(null);
16944
+ };
16945
+ }
16946
+ var p = JSON.parse(atob(d.policy));
16947
+ var pFind = function pFind(s) {
16948
+ return p.conditions.find(function (pf) {
16949
+ return Object.keys(pf).includes(s);
16950
+ })[s];
16782
16951
  };
16952
+ var fd = new FormData();
16953
+ fd.append('key', tenantKey + '/' + appKey + '/' + d.guids.files[fileName]);
16954
+ fd.append('policy', d.policy);
16955
+ fd.append('acl', pFind('acl'));
16956
+ fd.append('success_action_status', pFind('success_action_status'));
16957
+ fd.append('x-amz-credential', pFind('x-amz-credential'));
16958
+ fd.append('x-amz-algorithm', pFind('x-amz-algorithm'));
16959
+ fd.append('x-amz-date', pFind('x-amz-date'));
16960
+ fd.append('x-amz-signature', d.signature);
16961
+ fd.append('file', fileContent);
16962
+ return (0, _axios2.default)({
16963
+ method: 'post',
16964
+ url: 'https://' + pFind('bucket') + '.s3.amazonaws.com/',
16965
+ data: fd,
16966
+ config: { headers: { 'Content-Type': 'multipart/form-data' } }
16967
+ });
16783
16968
  }
16784
16969
 
16785
16970
  // "fake" credentials for demo purposes
@@ -16803,8 +16988,8 @@ module.exports =
16803
16988
  var isOauth = credsConfig && credsConfig[0] === 'Oauth';
16804
16989
  var isAdapter = urlSuffix === 'testconnection' || urlSuffix === 'adaptermetadata';
16805
16990
 
16806
- var _getState = getState(),
16807
- config = _getState.config;
16991
+ var _getState2 = getState(),
16992
+ config = _getState2.config;
16808
16993
  // if demo creds are entered, skip this
16809
16994
  // ADD: OR IF adaptermetadata SKIP THIS
16810
16995
 
@@ -16821,7 +17006,7 @@ module.exports =
16821
17006
  };
16822
17007
  }
16823
17008
 
16824
- function callGetProviderMetadata(tenantId, appId, urlSuffix, apiUrl, mode, providerType, endpoint, isOauth, envName) {
17009
+ function callGetProviderMetadata(tenantId, appId, urlSuffix, apiUrl, mode, providerType, endpoint, isOauth, envName, schemaGuid) {
16825
17010
  if (!urlSuffix) {
16826
17011
  // for new providers that dont have metadata endpoint yet
16827
17012
  return function () {
@@ -16829,9 +17014,9 @@ module.exports =
16829
17014
  };
16830
17015
  }
16831
17016
  return function (dispatch, getState, api) {
16832
- var _getState2 = getState(),
16833
- config = _getState2.config;
16834
- // 'testconnection ' GET route is for adapter only. Should be called 'adaptermetadata'
17017
+ var _getState3 = getState(),
17018
+ config = _getState3.config;
17019
+ // 'testconnection' GET route is for adapter. Should be called 'adaptermetadata'
16835
17020
 
16836
17021
 
16837
17022
  var isAdapter = false;
@@ -16843,6 +17028,9 @@ module.exports =
16843
17028
  urlSuffix = 'adaptermetadata?url=' + endpoint;
16844
17029
  isAdapter = true;
16845
17030
  }
17031
+ if (urlSuffix === 'fileschema') {
17032
+ urlSuffix = 'fileschema?schemaGuid=' + schemaGuid;
17033
+ }
16846
17034
  if (isOauth || isAdapter) {
16847
17035
  // USE ONLY ENVS!!!
16848
17036
  return api.get(tenantId + '/' + appId + '/environments/' + envName + '/' + urlSuffix, {
@@ -16864,8 +17052,8 @@ module.exports =
16864
17052
  mode: mode
16865
17053
  });
16866
17054
 
16867
- var _getState3 = getState(),
16868
- config = _getState3.config;
17055
+ var _getState4 = getState(),
17056
+ config = _getState4.config;
16869
17057
 
16870
17058
  return api.get(tenantId + '/' + appId + '/environments/' + envName + '/oauthurl/' + typeGuid + '/' + orgType, {
16871
17059
  endpoint: config.SF_AGENT_API_URL
@@ -16883,9 +17071,9 @@ module.exports =
16883
17071
 
16884
17072
  function generateNewAdapterSecret(tenantId, accountId, envName, mode) {
16885
17073
  return function (dispatch, getState, api) {
16886
- var _getState4 = getState(),
16887
- config = _getState4.config,
16888
- wizard = _getState4.wizard;
17074
+ var _getState5 = getState(),
17075
+ config = _getState5.config,
17076
+ wizard = _getState5.wizard;
16889
17077
 
16890
17078
  var TRANS_API_URL = config.TRANS_API_URL;
16891
17079
 
@@ -16902,8 +17090,8 @@ module.exports =
16902
17090
 
16903
17091
  function createLingkExternalIds(tenantId, appId, bundles, mappings, metadata, envName) {
16904
17092
  return function (dispatch, getState, api) {
16905
- var _getState5 = getState(),
16906
- config = _getState5.config;
17093
+ var _getState6 = getState(),
17094
+ config = _getState6.config;
16907
17095
 
16908
17096
  var externalIdlessObjects = [];
16909
17097
  // only run for Salesforce
@@ -16941,8 +17129,8 @@ module.exports =
16941
17129
 
16942
17130
  function callAddCustomField(tenantId, appId, objectType, fieldName, completedCallback, envName) {
16943
17131
  return function (dispatch, getState, api) {
16944
- var _getState6 = getState(),
16945
- config = _getState6.config;
17132
+ var _getState7 = getState(),
17133
+ config = _getState7.config;
16946
17134
 
16947
17135
  return api.post(tenantId + '/' + appId + '/environments/' + envName + '/salesforceschema/field', {
16948
17136
  endpoint: config.SF_AGENT_API_URL,
@@ -16994,8 +17182,8 @@ module.exports =
16994
17182
 
16995
17183
  function callGetScenarioList(tenantId, appId, typeGuid) {
16996
17184
  return function (dispatch, getState, api) {
16997
- var _getState7 = getState(),
16998
- config = _getState7.config;
17185
+ var _getState8 = getState(),
17186
+ config = _getState8.config;
16999
17187
 
17000
17188
  return api.get(tenantId + '/' + appId + '/scenarios/' + typeGuid, {
17001
17189
  endpoint: config.TRANS_API_URL
@@ -17005,8 +17193,8 @@ module.exports =
17005
17193
 
17006
17194
  function callCreateScenario(tenantId, appId, data) {
17007
17195
  return function (dispatch, getState, api) {
17008
- var _getState8 = getState(),
17009
- config = _getState8.config;
17196
+ var _getState9 = getState(),
17197
+ config = _getState9.config;
17010
17198
 
17011
17199
  return api.post(tenantId + '/' + appId + '/scenario', {
17012
17200
  endpoint: config.TRANS_API_URL,
@@ -17017,8 +17205,8 @@ module.exports =
17017
17205
 
17018
17206
  function callUpdateScenarioList(tenantId, appId, typeGuid, scenarioIds) {
17019
17207
  return function (dispatch, getState, api) {
17020
- var _getState9 = getState(),
17021
- config = _getState9.config;
17208
+ var _getState10 = getState(),
17209
+ config = _getState10.config;
17022
17210
 
17023
17211
  return api.post(tenantId + '/' + appId + '/scenarios/' + typeGuid, {
17024
17212
  endpoint: config.TRANS_API_URL,
@@ -17031,8 +17219,8 @@ module.exports =
17031
17219
 
17032
17220
  function callPostBundles(tenantId, appId, bundles, onGenerationError) {
17033
17221
  return function (dispatch, getState, api) {
17034
- var _getState10 = getState(),
17035
- config = _getState10.config;
17222
+ var _getState11 = getState(),
17223
+ config = _getState11.config;
17036
17224
 
17037
17225
  var data = { bundles: bundles };
17038
17226
  return api.post(tenantId + '/' + appId + '/bundle', {
@@ -17047,8 +17235,8 @@ module.exports =
17047
17235
 
17048
17236
  function callPostMapping(tenantId, appId, mappings, onGenerationError) {
17049
17237
  return function (dispatch, getState, api) {
17050
- var _getState11 = getState(),
17051
- config = _getState11.config;
17238
+ var _getState12 = getState(),
17239
+ config = _getState12.config;
17052
17240
 
17053
17241
  var data = { mappings: mappings };
17054
17242
  return api.post(tenantId + '/' + appId + '/schemamappings', {
@@ -17063,8 +17251,8 @@ module.exports =
17063
17251
 
17064
17252
  function callPostProductizedIntegration(tenantId, appId, schemaMappingGuid, bundlePackGuid, configuration, title, typeGuid, piGuid, onGenerationError) {
17065
17253
  return function (dispatch, getState, api) {
17066
- var _getState12 = getState(),
17067
- config = _getState12.config;
17254
+ var _getState13 = getState(),
17255
+ config = _getState13.config;
17068
17256
 
17069
17257
  var data = Object.assign({
17070
17258
  schemaMappingGuid: schemaMappingGuid,
@@ -17085,8 +17273,8 @@ module.exports =
17085
17273
 
17086
17274
  function callUpdateProductizedIntegration(tenantId, appId, schemaMappingGuid, bundlePackGuid, configuration, title, typeGuid, piGuid, onGenerationError) {
17087
17275
  return function (dispatch, getState, api) {
17088
- var _getState13 = getState(),
17089
- config = _getState13.config;
17276
+ var _getState14 = getState(),
17277
+ config = _getState14.config;
17090
17278
 
17091
17279
  var data = {
17092
17280
  schemaMappingGuid: schemaMappingGuid,
@@ -17107,8 +17295,8 @@ module.exports =
17107
17295
 
17108
17296
  function callGenerateRecipe(tenantId, appId, typeId, typeGuid, title, piGuid, mappingGuid, sourceMetadata, destinationMetadata, isManagedPackage, onGenerationError, envName, envId) {
17109
17297
  return function (dispatch, getState, api) {
17110
- var _getState14 = getState(),
17111
- config = _getState14.config;
17298
+ var _getState15 = getState(),
17299
+ config = _getState15.config;
17112
17300
 
17113
17301
  return api.post(tenantId + '/' + appId + '/productizedintegrations/' + piGuid + '/generate', {
17114
17302
  endpoint: config.TRANS_API_URL,
@@ -17168,8 +17356,8 @@ module.exports =
17168
17356
 
17169
17357
  function callPostEventContext(data, transBaseId) {
17170
17358
  return function (dispatch, getState, api) {
17171
- var _getState15 = getState(),
17172
- config = _getState15.config;
17359
+ var _getState16 = getState(),
17360
+ config = _getState16.config;
17173
17361
 
17174
17362
  var TRANS_API_URL = config.TRANS_API_URL;
17175
17363
 
@@ -17182,8 +17370,8 @@ module.exports =
17182
17370
 
17183
17371
  function callExecuteTransformer(transId) {
17184
17372
  return function (dispatch, getState, api) {
17185
- var _getState16 = getState(),
17186
- config = _getState16.config;
17373
+ var _getState17 = getState(),
17374
+ config = _getState17.config;
17187
17375
 
17188
17376
  var query = '';
17189
17377
  var d = new Date();
@@ -17203,8 +17391,8 @@ module.exports =
17203
17391
 
17204
17392
  function callLookupLogData(tenantId, externalExecutionId, index, onFinish, generatedRecipe, pi) {
17205
17393
  return function (dispatch, getState, api) {
17206
- var _getState17 = getState(),
17207
- config = _getState17.config;
17394
+ var _getState18 = getState(),
17395
+ config = _getState18.config;
17208
17396
 
17209
17397
  return api.get(tenantId + '/logs/transformers/externalExecutionId/' + externalExecutionId, {
17210
17398
  endpoint: config.TRANS_API_URL
@@ -17248,8 +17436,8 @@ module.exports =
17248
17436
  };
17249
17437
  }
17250
17438
  return function (dispatch, getState, api) {
17251
- var _getState18 = getState(),
17252
- config = _getState18.config;
17439
+ var _getState19 = getState(),
17440
+ config = _getState19.config;
17253
17441
 
17254
17442
  return api.post(tenantId + '/createtrigger', {
17255
17443
  endpoint: config.TRANS_API_URL,
@@ -17287,8 +17475,8 @@ module.exports =
17287
17475
 
17288
17476
  if (piGuid && piGuid !== '_') {
17289
17477
  return function (dispatch, getState, api) {
17290
- var _getState19 = getState(),
17291
- config = _getState19.config;
17478
+ var _getState20 = getState(),
17479
+ config = _getState20.config;
17292
17480
 
17293
17481
  return api.get(tenantId + '/' + accountId + '/productizedintegrations/' + piGuid + '/versions', {
17294
17482
  endpoint: config.TRANS_API_URL
@@ -17358,8 +17546,8 @@ module.exports =
17358
17546
 
17359
17547
  function clearAdapterSecrets() {
17360
17548
  return function (dispatch, getState, api) {
17361
- var _getState20 = getState(),
17362
- wizard = _getState20.wizard;
17549
+ var _getState21 = getState(),
17550
+ wizard = _getState21.wizard;
17363
17551
 
17364
17552
  dispatch({
17365
17553
  type: types.SET_WIZARD_SAVED_CREDENTIALS,
@@ -17373,8 +17561,8 @@ module.exports =
17373
17561
 
17374
17562
  function setLoadedAdapterSecret(cred, mode) {
17375
17563
  return function (dispatch, getState, api) {
17376
- var _getState21 = getState(),
17377
- wizard = _getState21.wizard;
17564
+ var _getState22 = getState(),
17565
+ wizard = _getState22.wizard;
17378
17566
 
17379
17567
  dispatch({
17380
17568
  type: types.SET_WIZARD_SAVED_CREDENTIALS,
@@ -17385,8 +17573,8 @@ module.exports =
17385
17573
 
17386
17574
  function getCredentialForEnvironment(tenantId, appId, credentialType, envName, mode) {
17387
17575
  return function (dispatch, getState, api) {
17388
- var _getState22 = getState(),
17389
- config = _getState22.config;
17576
+ var _getState23 = getState(),
17577
+ config = _getState23.config;
17390
17578
 
17391
17579
  return api.get(tenantId + '/' + appId + '/credentials/' + credentialType + '/' + envName, {
17392
17580
  endpoint: config.TRANS_API_URL
@@ -17436,8 +17624,8 @@ module.exports =
17436
17624
  function callGetBundles(tenantId, accountId, bundlePackGuid) {
17437
17625
  if (bundlePackGuid) {
17438
17626
  return function (dispatch, getState, api) {
17439
- var _getState23 = getState(),
17440
- config = _getState23.config;
17627
+ var _getState24 = getState(),
17628
+ config = _getState24.config;
17441
17629
 
17442
17630
  return api.get(tenantId + '/' + accountId + '/bundle/' + bundlePackGuid, {
17443
17631
  endpoint: config.TRANS_API_URL
@@ -17454,8 +17642,8 @@ module.exports =
17454
17642
  function callGetMapping(tenantId, accountId, mappingGuid) {
17455
17643
  if (mappingGuid) {
17456
17644
  return function (dispatch, getState, api) {
17457
- var _getState24 = getState(),
17458
- config = _getState24.config;
17645
+ var _getState25 = getState(),
17646
+ config = _getState25.config;
17459
17647
 
17460
17648
  return api.get(tenantId + '/' + accountId + '/schemamappings/' + mappingGuid, {
17461
17649
  endpoint: config.TRANS_API_URL
@@ -17476,8 +17664,8 @@ module.exports =
17476
17664
  mode: mode
17477
17665
  });
17478
17666
 
17479
- var _getState25 = getState(),
17480
- config = _getState25.config;
17667
+ var _getState26 = getState(),
17668
+ config = _getState26.config;
17481
17669
 
17482
17670
  return api.post(tenantId + '/' + appId + '/environments/' + envId + '/credentials', {
17483
17671
  endpoint: config.TRANS_API_URL,
@@ -17491,8 +17679,8 @@ module.exports =
17491
17679
 
17492
17680
  function getEnvironments(tenantId, appId) {
17493
17681
  return function (dispatch, getState, api) {
17494
- var _getState26 = getState(),
17495
- config = _getState26.config;
17682
+ var _getState27 = getState(),
17683
+ config = _getState27.config;
17496
17684
 
17497
17685
  return api.get(tenantId + '/' + appId + '/environments', {
17498
17686
  endpoint: config.TRANS_API_URL
@@ -17512,8 +17700,8 @@ module.exports =
17512
17700
 
17513
17701
  function callGetTrigger(transBaseId, envId) {
17514
17702
  return function (dispatch, getState, api) {
17515
- var _getState27 = getState(),
17516
- config = _getState27.config;
17703
+ var _getState28 = getState(),
17704
+ config = _getState28.config;
17517
17705
 
17518
17706
  if (transBaseId) {
17519
17707
  return api.get('gettriggers/' + transBaseId, {
@@ -20688,7 +20876,7 @@ module.exports =
20688
20876
 
20689
20877
  var _moment2 = _interopRequireDefault(_moment);
20690
20878
 
20691
- __webpack_require__(218);
20879
+ __webpack_require__(219);
20692
20880
 
20693
20881
  __webpack_require__(178);
20694
20882
 
@@ -21141,14 +21329,10 @@ module.exports =
21141
21329
  change = _props6.change;
21142
21330
 
21143
21331
  var modes = ['source', 'destination'];
21144
- //const config = step[`${m}Config`]
21145
- //const {credentials} = config
21146
- //dont load creds for oauth, since there are none
21147
21332
  change('sourceCredentials', { rootUrl: 'https://' });
21148
21333
  change('destinationCredentials', { rootUrl: 'https://' });
21149
21334
  this.setState({ sourceEnvChecking: true });
21150
21335
  this.setState({ destinationEnvChecking: true });
21151
- //if(!isOauth){
21152
21336
  var wiz = {
21153
21337
  source: step.sourceConfig,
21154
21338
  destination: step.destinationConfig
@@ -21160,24 +21344,23 @@ module.exports =
21160
21344
  if (resIndex === 0 || resIndex === 1) {
21161
21345
  // main creds
21162
21346
  if (cred && cred.credentialsJson) {
21163
- (function () {
21164
- var modeCreds = {};
21165
- var credentials = wiz[m].credentials;
21166
-
21167
- var isOauth = credentials && credentials.length === 1 && credentials[0] === 'Oauth';
21168
- if (isOauth) {
21169
- modeCreds = cred.credentialsJson;
21170
- } else {
21171
- modeCreds['rootUrl'] = cred.credentialsJson.rootUrl;
21172
- credentials && credentials.length > 0 && credentials.forEach(function (credType) {
21173
- if (cred.credentialsJson[credType]) {
21174
- modeCreds[credType] = cred.credentialsJson[credType];
21175
- }
21176
- });
21177
- }
21178
- change(m + 'Credentials', modeCreds);
21179
- _this3.check(m, env, modeCreds);
21180
- })();
21347
+ var modeCreds = cred.credentialsJson;
21348
+ // WHY DID I HAVE THIS?
21349
+ /*const {credentials} = wiz[m]
21350
+ const isOauth = credentials && credentials.length===1 && credentials[0]==='Oauth'
21351
+ const isFlatFile = credentials && credentials.length===1 && credentials[0]==='FlatFile'
21352
+ if(isOauth || isFlatFile){
21353
+ modeCreds = cred.credentialsJson
21354
+ } else {
21355
+ modeCreds['rootUrl'] = cred.credentialsJson.rootUrl
21356
+ credentials && credentials.length>0 && credentials.forEach(credType=>{
21357
+ if(cred.credentialsJson[credType]){
21358
+ modeCreds[credType] = cred.credentialsJson[credType]
21359
+ }
21360
+ })
21361
+ }*/
21362
+ change(m + 'Credentials', modeCreds);
21363
+ _this3.check(m, env, modeCreds);
21181
21364
  } else {
21182
21365
  _this3.setState(_defineProperty({}, m + 'EnvChecking', false));
21183
21366
  }
@@ -21192,17 +21375,28 @@ module.exports =
21192
21375
  }
21193
21376
  }, {
21194
21377
  key: 'setCsvFields',
21195
- value: function setCsvFields(metadata, mode, providerType) {
21196
- this.props.actions.setCsvFields(metadata, mode, providerType);
21378
+ value: function setCsvFields(metadata, contents, mode, providerType) {
21379
+ var _props7 = this.props,
21380
+ tenantId = _props7.tenantId,
21381
+ accountId = _props7.accountId,
21382
+ tenantKey = _props7.tenantKey,
21383
+ accountKey = _props7.accountKey,
21384
+ wizard = _props7.wizard,
21385
+ actions = _props7.actions,
21386
+ formValues = _props7.formValues;
21387
+
21388
+ var meta = wizard[mode + 'Metadata'] || [];
21389
+ meta = meta.concat(metadata);
21390
+ return actions.setCsvFields(tenantId, accountId, tenantKey, accountKey, meta, contents, mode, providerType, mode === 'source', formValues['environmentId']);
21197
21391
  }
21198
21392
  }, {
21199
21393
  key: 'createCustomSettings',
21200
21394
  value: function createCustomSettings(mode) {
21201
- var _props7 = this.props,
21202
- wizard = _props7.wizard,
21203
- step = _props7.step,
21204
- inputs = _props7.inputs,
21205
- formValues = _props7.formValues;
21395
+ var _props8 = this.props,
21396
+ wizard = _props8.wizard,
21397
+ step = _props8.step,
21398
+ inputs = _props8.inputs,
21399
+ formValues = _props8.formValues;
21206
21400
 
21207
21401
  var config = step[mode + 'Config'];
21208
21402
  var customSettings = null;
@@ -21224,16 +21418,16 @@ module.exports =
21224
21418
  value: function render() {
21225
21419
  var _this4 = this;
21226
21420
 
21227
- var _props8 = this.props,
21228
- inputs = _props8.inputs,
21229
- step = _props8.step,
21230
- handleSubmit = _props8.handleSubmit,
21231
- nav = _props8.nav,
21232
- reset = _props8.reset,
21233
- wizard = _props8.wizard,
21234
- formValues = _props8.formValues,
21235
- tenantKey = _props8.tenantKey,
21236
- accountKey = _props8.accountKey;
21421
+ var _props9 = this.props,
21422
+ inputs = _props9.inputs,
21423
+ step = _props9.step,
21424
+ handleSubmit = _props9.handleSubmit,
21425
+ nav = _props9.nav,
21426
+ reset = _props9.reset,
21427
+ wizard = _props9.wizard,
21428
+ formValues = _props9.formValues,
21429
+ tenantKey = _props9.tenantKey,
21430
+ accountKey = _props9.accountKey;
21237
21431
 
21238
21432
  var modes = ['source', 'destination'];
21239
21433
  var selectedProvider = this.state.selectedProvider;
@@ -21341,11 +21535,14 @@ module.exports =
21341
21535
  return _this4.generateNewAdapterSecret(m);
21342
21536
  },
21343
21537
  seeFields: _this4.seeFields.bind(_this4),
21538
+ metadata: wizard[m + 'Metadata'],
21344
21539
  check: function check(actualCreds) {
21345
21540
  return _this4.check(m, null, actualCreds);
21346
21541
  },
21347
21542
  tenantKey: tenantKey, accountKey: accountKey,
21348
- setCsvFields: _this4.setCsvFields.bind(_this4),
21543
+ setCsvFields: function setCsvFields(meta, contents, providerType) {
21544
+ return _this4.setCsvFields(meta, contents, m, providerType);
21545
+ },
21349
21546
  creds: formValues[m + 'Credentials'],
21350
21547
  envCheckResult: wizard[m + 'CheckResult'],
21351
21548
  adapterSecret: adapterSecret,
@@ -24675,7 +24872,7 @@ module.exports =
24675
24872
 
24676
24873
  var _react2 = _interopRequireDefault(_react);
24677
24874
 
24678
- var _redux = __webpack_require__(219);
24875
+ var _redux = __webpack_require__(220);
24679
24876
 
24680
24877
  var _reactRedux = __webpack_require__(75);
24681
24878
 
@@ -30190,10 +30387,16 @@ module.exports =
30190
30387
  /* 218 */
30191
30388
  /***/ function(module, exports) {
30192
30389
 
30193
- module.exports = require("moment-timezone");
30390
+ module.exports = require("axios");
30194
30391
 
30195
30392
  /***/ },
30196
30393
  /* 219 */
30394
+ /***/ function(module, exports) {
30395
+
30396
+ module.exports = require("moment-timezone");
30397
+
30398
+ /***/ },
30399
+ /* 220 */
30197
30400
  /***/ function(module, exports) {
30198
30401
 
30199
30402
  module.exports = require("redux");