@plaidev/karte-action-sdk 1.1.206-28211793.cd4e1282 → 1.1.206-28211870.7ae67847

Sign up to get free protection for your applications and to get access to all the features.
@@ -1343,13 +1343,22 @@ const loadActionTableRow = async (config, data, api_key, endpoint) => new Promis
1343
1343
  return reject('key is not found.');
1344
1344
  }
1345
1345
  return collection$1({ endpoint, api_key, table: config.query.table_name }).get(key, (err, data) => {
1346
- if (!err) {
1347
- resolve(data);
1346
+ if (err) {
1347
+ if (defaultValue != null) {
1348
+ return resolve(defaultValue);
1349
+ }
1350
+ return reject(err);
1351
+ }
1352
+ if (!Array.isArray(data)) {
1353
+ return resolve(data);
1354
+ }
1355
+ if (data.length !== 0) {
1356
+ return resolve(data[0]);
1348
1357
  }
1349
1358
  if (defaultValue != null) {
1350
- resolve(defaultValue);
1359
+ return resolve(defaultValue);
1351
1360
  }
1352
- reject(err);
1361
+ return resolve(data);
1353
1362
  });
1354
1363
  });
1355
1364
  /** @internal */
@@ -1377,13 +1386,22 @@ const loadActionTableRows = async (config, data, api_key, endpoint) => new Promi
1377
1386
  return reject('key is not found.');
1378
1387
  }
1379
1388
  return collection$1({ endpoint, api_key, table: config.query.table_name }).get(keys, (err, data) => {
1380
- if (!err) {
1381
- resolve(data);
1389
+ if (err) {
1390
+ if (defaultValue != null) {
1391
+ return resolve(defaultValue);
1392
+ }
1393
+ return reject(err);
1394
+ }
1395
+ if (!Array.isArray(data)) {
1396
+ return resolve([data]);
1397
+ }
1398
+ if (data.length !== 0) {
1399
+ return resolve(data);
1382
1400
  }
1383
1401
  if (defaultValue != null) {
1384
- resolve(defaultValue);
1402
+ return resolve(defaultValue);
1385
1403
  }
1386
- reject(err);
1404
+ return resolve(data);
1387
1405
  });
1388
1406
  });
1389
1407
  /** @internal */
@@ -1410,13 +1428,22 @@ const loadActionTableQuery = async (config, data, api_key, endpoint) => new Prom
1410
1428
  return reject('key is not found.');
1411
1429
  }
1412
1430
  return collection$1({ endpoint, api_key, table: config.query.table_name }).getByQuery(config.query.query_name, params, null, (err, data) => {
1413
- if (!err) {
1414
- resolve(data);
1431
+ if (err) {
1432
+ if (defaultValue != null) {
1433
+ return resolve(defaultValue);
1434
+ }
1435
+ return reject(err);
1436
+ }
1437
+ if (!Array.isArray(data)) {
1438
+ return resolve([data]);
1439
+ }
1440
+ if (data.length !== 0) {
1441
+ return resolve(data);
1415
1442
  }
1416
1443
  if (defaultValue != null) {
1417
- resolve(defaultValue);
1444
+ return resolve(defaultValue);
1418
1445
  }
1419
- reject(err);
1446
+ return resolve(data);
1420
1447
  });
1421
1448
  });
1422
1449
  /** @internal */
package/dist/index.es.js CHANGED
@@ -1366,13 +1366,22 @@ const loadActionTableRow = async (config, data, api_key, endpoint) => new Promis
1366
1366
  return reject('key is not found.');
1367
1367
  }
1368
1368
  return collection$1({ endpoint, api_key, table: config.query.table_name }).get(key, (err, data) => {
1369
- if (!err) {
1370
- resolve(data);
1369
+ if (err) {
1370
+ if (defaultValue != null) {
1371
+ return resolve(defaultValue);
1372
+ }
1373
+ return reject(err);
1374
+ }
1375
+ if (!Array.isArray(data)) {
1376
+ return resolve(data);
1377
+ }
1378
+ if (data.length !== 0) {
1379
+ return resolve(data[0]);
1371
1380
  }
1372
1381
  if (defaultValue != null) {
1373
- resolve(defaultValue);
1382
+ return resolve(defaultValue);
1374
1383
  }
1375
- reject(err);
1384
+ return resolve(data);
1376
1385
  });
1377
1386
  });
1378
1387
  /** @internal */
@@ -1400,13 +1409,22 @@ const loadActionTableRows = async (config, data, api_key, endpoint) => new Promi
1400
1409
  return reject('key is not found.');
1401
1410
  }
1402
1411
  return collection$1({ endpoint, api_key, table: config.query.table_name }).get(keys, (err, data) => {
1403
- if (!err) {
1404
- resolve(data);
1412
+ if (err) {
1413
+ if (defaultValue != null) {
1414
+ return resolve(defaultValue);
1415
+ }
1416
+ return reject(err);
1417
+ }
1418
+ if (!Array.isArray(data)) {
1419
+ return resolve([data]);
1420
+ }
1421
+ if (data.length !== 0) {
1422
+ return resolve(data);
1405
1423
  }
1406
1424
  if (defaultValue != null) {
1407
- resolve(defaultValue);
1425
+ return resolve(defaultValue);
1408
1426
  }
1409
- reject(err);
1427
+ return resolve(data);
1410
1428
  });
1411
1429
  });
1412
1430
  /** @internal */
@@ -1433,13 +1451,22 @@ const loadActionTableQuery = async (config, data, api_key, endpoint) => new Prom
1433
1451
  return reject('key is not found.');
1434
1452
  }
1435
1453
  return collection$1({ endpoint, api_key, table: config.query.table_name }).getByQuery(config.query.query_name, params, null, (err, data) => {
1436
- if (!err) {
1437
- resolve(data);
1454
+ if (err) {
1455
+ if (defaultValue != null) {
1456
+ return resolve(defaultValue);
1457
+ }
1458
+ return reject(err);
1459
+ }
1460
+ if (!Array.isArray(data)) {
1461
+ return resolve([data]);
1462
+ }
1463
+ if (data.length !== 0) {
1464
+ return resolve(data);
1438
1465
  }
1439
1466
  if (defaultValue != null) {
1440
- resolve(defaultValue);
1467
+ return resolve(defaultValue);
1441
1468
  }
1442
- reject(err);
1469
+ return resolve(data);
1443
1470
  });
1444
1471
  });
1445
1472
  /** @internal */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaidev/karte-action-sdk",
3
- "version": "1.1.206-28211793.cd4e1282",
3
+ "version": "1.1.206-28211870.7ae67847",
4
4
  "author": "Plaid Inc.",
5
5
  "license": "Apache-2.0",
6
6
  "module": "./dist/index.es.js",