@lingk/sync 1.0.72 → 1.0.73

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
@@ -17236,13 +17236,13 @@ module.exports =
17236
17236
  value: true
17237
17237
  });
17238
17238
  exports.callGetMetadata = callGetMetadata;
17239
+ exports.tryCheckConnection = tryCheckConnection;
17240
+ exports.callGetProviderMetadata = callGetProviderMetadata;
17239
17241
  exports.setCsvFields = setCsvFields;
17240
17242
  exports.removeFileResourceFromMetadata = removeFileResourceFromMetadata;
17241
17243
  exports.clearCsvFields = clearCsvFields;
17242
17244
  exports.uploadFilesToS3 = uploadFilesToS3;
17243
17245
  exports.singleFileToS3 = singleFileToS3;
17244
- exports.tryCheckConnection = tryCheckConnection;
17245
- exports.callGetProviderMetadata = callGetProviderMetadata;
17246
17246
  exports.getOauthUrl = getOauthUrl;
17247
17247
  exports.generateNewAdapterSecret = generateNewAdapterSecret;
17248
17248
  exports.createLingkExternalIds = createLingkExternalIds;
@@ -17310,9 +17310,7 @@ module.exports =
17310
17310
  // isReload means that the "Check Connection" button was NOT clicked
17311
17311
  function callGetMetadata(tenantId, appId, mode, providerType, providerConfig, endpoint, isFramework, creds, environment, isReload, fileSchemaGuid, extraQuery) {
17312
17312
  var metadata = null;
17313
- var metadataEndpoint = providerConfig.metadataEndpoint,
17314
- metadataApi = providerConfig.metadataApi,
17315
- credentialType = providerConfig.credentialType;
17313
+ var credentialType = providerConfig.credentialType;
17316
17314
 
17317
17315
  var isOauth = credentialType === 'SalesforceAuthCode';
17318
17316
  return function (dispatch) {
@@ -17328,11 +17326,12 @@ module.exports =
17328
17326
  if (fileSchemaGuid) {
17329
17327
  schemaGuid = fileSchemaGuid; // for SFTP guid is in wiz config
17330
17328
  }
17331
- // let resFromCheckConnection = null
17332
- // if(r && r.schema){ // currently only for SFTP check connection
17333
- // resFromCheckConnection = r.schema // skip callGetProviderMetadata network call
17334
- // }
17335
- return dispatch(callGetProviderMetadata(tenantId, appId, providerConfig, mode, providerType, endpoint, isOauth, environment.name, schemaGuid, creds, extraQuery));
17329
+ var resFromCheckConnection = null;
17330
+ if (r && r.schema) {
17331
+ // currently only for SFTP check connection
17332
+ resFromCheckConnection = r.schema; // skip callGetProviderMetadata network call
17333
+ }
17334
+ return dispatch(callGetProviderMetadata(tenantId, appId, providerConfig, mode, providerType, endpoint, isOauth, environment.name, schemaGuid, creds, extraQuery, resFromCheckConnection));
17336
17335
  }).then(function (m) {
17337
17336
  metadata = m;
17338
17337
  var isIntro = endpoint === '_blank';
@@ -17355,11 +17354,88 @@ module.exports =
17355
17354
  };
17356
17355
  }
17357
17356
 
17358
- function setCsvFields(tenantId, appId, tenantKey, appKey, metadata, contents, mode, providerType, isSource, envId) {
17359
- var d = null;
17357
+ function tryCheckConnection(tenantId, appId, providerType, providerConfig, isFramework, creds, fileSchemaGuid) {
17360
17358
  return function (dispatch, getState, api) {
17359
+ var credentialType = providerConfig.credentialType;
17360
+
17361
+ var isOauth = credentialType === 'SalesforceAuthCode';
17362
+ var isAdapter = credentialType === 'LingkAdapter';
17363
+ //const isEthos = credentialType==='Ethos'
17364
+
17361
17365
  var _getState = getState(),
17362
17366
  config = _getState.config;
17367
+ // if demo creds are entered, skip this
17368
+ // ADD: OR IF adaptermetadata SKIP THIS
17369
+
17370
+
17371
+ if (!isOauth && !isAdapter && !isDemoCreds(creds, providerType) && !fileSchemaGuid) {
17372
+ return api.post(tenantId + '/' + appId + '/testconnection/' + providerType.toLowerCase(), {
17373
+ endpoint: config.TRANS_API_URL,
17374
+ data: {
17375
+ credentialType: credentialType,
17376
+ credentialsJson: creds,
17377
+ providerLabel: providerType
17378
+ }
17379
+ });
17380
+ } else return Promise.resolve(null);
17381
+ };
17382
+ }
17383
+
17384
+ function callGetProviderMetadata(tenantId, appId, providerConfig, mode, providerType, endpoint, isOauth, envName, schemaGuid, creds, extraQuery, resFromCheckConnection) {
17385
+ // urlSuffix for getMetadata. If checkConnection returns meta, skip this one
17386
+ var metadataEndpoint = providerConfig.metadataEndpoint,
17387
+ metadataApi = providerConfig.metadataApi,
17388
+ credentialType = providerConfig.credentialType;
17389
+
17390
+ if (!metadataEndpoint || resFromCheckConnection) {
17391
+ return function () {
17392
+ return Promise.resolve(resFromCheckConnection);
17393
+ };
17394
+ }
17395
+ return function (dispatch, getState, api) {
17396
+ var _getState2 = getState(),
17397
+ config = _getState2.config;
17398
+
17399
+ var isAdapter = false;
17400
+ if (metadataEndpoint === 'adaptermetadata') {
17401
+ metadataEndpoint = 'adaptermetadata?url=' + endpoint;
17402
+ isAdapter = true;
17403
+ }
17404
+ if (metadataEndpoint === 'fileschema') {
17405
+ metadataEndpoint = 'fileschema?schemaGuid=' + schemaGuid;
17406
+ }
17407
+ if (metadataEndpoint === 'schema/swagger/moodle' && creds.swaggerUrl) {
17408
+ metadataEndpoint = 'schema/swagger/moodle?swaggerUrl=' + creds.swaggerUrl;
17409
+ }
17410
+ if (metadataApi === 'TEST_CONN_API_URL') {
17411
+ return api.post(tenantId + '/' + appId + '/' + metadataEndpoint, {
17412
+ endpoint: config[metadataApi],
17413
+ data: {
17414
+ credentialType: credentialType,
17415
+ credentialsJson: creds,
17416
+ providerLabel: providerType
17417
+ }
17418
+ });
17419
+ } else {
17420
+ if (isOauth || isAdapter || providerType === 'Ethos') {
17421
+ // USE ONLY ENVS!!!
17422
+ return api.get(tenantId + '/' + appId + '/environments/' + envName + '/' + metadataEndpoint + (extraQuery || ''), {
17423
+ endpoint: config[metadataApi]
17424
+ });
17425
+ } else {
17426
+ return api.get(tenantId + '/' + appId + '/' + metadataEndpoint + (extraQuery || ''), {
17427
+ endpoint: config[metadataApi]
17428
+ });
17429
+ }
17430
+ }
17431
+ };
17432
+ }
17433
+
17434
+ function setCsvFields(tenantId, appId, tenantKey, appKey, metadata, contents, mode, providerType, isSource, envId) {
17435
+ var d = null;
17436
+ return function (dispatch, getState, api) {
17437
+ var _getState3 = getState(),
17438
+ config = _getState3.config;
17363
17439
 
17364
17440
  return api.post(tenantId + '/' + appId + '/uploadpolicy', {
17365
17441
  endpoint: config.TRANS_API_URL,
@@ -17382,8 +17458,8 @@ module.exports =
17382
17458
 
17383
17459
  function removeFileResourceFromMetadata(mode, r, providerType) {
17384
17460
  return function (dispatch, getState, api) {
17385
- var _getState2 = getState(),
17386
- wizard = _getState2.wizard;
17461
+ var _getState4 = getState(),
17462
+ wizard = _getState4.wizard;
17387
17463
 
17388
17464
  var metadata = [].concat(_toConsumableArray(wizard[mode + 'Metadata']));
17389
17465
  var i = metadata.findIndex(function (rsc) {
@@ -17470,83 +17546,6 @@ module.exports =
17470
17546
  } else return false;
17471
17547
  }
17472
17548
 
17473
- function tryCheckConnection(tenantId, appId, providerType, providerConfig, isFramework, creds, fileSchemaGuid) {
17474
- return function (dispatch, getState, api) {
17475
- var credentialType = providerConfig.credentialType;
17476
-
17477
- var isOauth = credentialType === 'SalesforceAuthCode';
17478
- var isAdapter = credentialType === 'LingkAdapter';
17479
- //const isEthos = credentialType==='Ethos'
17480
-
17481
- var _getState3 = getState(),
17482
- config = _getState3.config;
17483
- // if demo creds are entered, skip this
17484
- // ADD: OR IF adaptermetadata SKIP THIS
17485
-
17486
-
17487
- if (!isOauth && !isAdapter && !isDemoCreds(creds, providerType) && !fileSchemaGuid) {
17488
- return api.post(tenantId + '/' + appId + '/testconnection/' + providerType.toLowerCase(), {
17489
- endpoint: config.TRANS_API_URL,
17490
- data: {
17491
- credentialType: credentialType,
17492
- credentialsJson: creds,
17493
- providerLabel: providerType
17494
- }
17495
- });
17496
- } else return Promise.resolve(null);
17497
- };
17498
- }
17499
-
17500
- function callGetProviderMetadata(tenantId, appId, providerConfig, mode, providerType, endpoint, isOauth, envName, schemaGuid, creds, extraQuery) {
17501
- // urlSuffix for getMetadata. If checkConnection returns meta, skip this one
17502
- var metadataEndpoint = providerConfig.metadataEndpoint,
17503
- metadataApi = providerConfig.metadataApi,
17504
- credentialType = providerConfig.credentialType;
17505
-
17506
- if (!metadataEndpoint) {
17507
- return function () {
17508
- return Promise.resolve(null);
17509
- };
17510
- }
17511
- return function (dispatch, getState, api) {
17512
- var _getState4 = getState(),
17513
- config = _getState4.config;
17514
-
17515
- var isAdapter = false;
17516
- if (metadataEndpoint === 'adaptermetadata') {
17517
- metadataEndpoint = 'adaptermetadata?url=' + endpoint;
17518
- isAdapter = true;
17519
- }
17520
- if (metadataEndpoint === 'fileschema') {
17521
- metadataEndpoint = 'fileschema?schemaGuid=' + schemaGuid;
17522
- }
17523
- if (metadataEndpoint === 'schema/swagger/moodle' && creds.swaggerUrl) {
17524
- metadataEndpoint = 'schema/swagger/moodle?swaggerUrl=' + creds.swaggerUrl;
17525
- }
17526
- if (metadataApi === 'TEST_CONN_API_URL') {
17527
- return api.post(tenantId + '/' + appId + '/' + metadataEndpoint, {
17528
- endpoint: config[metadataApi],
17529
- data: {
17530
- credentialType: credentialType,
17531
- credentialsJson: creds,
17532
- providerLabel: providerType
17533
- }
17534
- });
17535
- } else {
17536
- if (isOauth || isAdapter || providerType === 'Ethos') {
17537
- // USE ONLY ENVS!!!
17538
- return api.get(tenantId + '/' + appId + '/environments/' + envName + '/' + metadataEndpoint + (extraQuery || ''), {
17539
- endpoint: config[metadataApi]
17540
- });
17541
- } else {
17542
- return api.get(tenantId + '/' + appId + '/' + metadataEndpoint + (extraQuery || ''), {
17543
- endpoint: config[metadataApi]
17544
- });
17545
- }
17546
- }
17547
- };
17548
- }
17549
-
17550
17549
  function getOauthUrl(tenantId, appId, typeGuid, orgType, mode, envName) {
17551
17550
  return function (dispatch, getState, api) {
17552
17551
  dispatch({