@plaidev/karte-action-sdk 1.1.206-28204054.f9403484 → 1.1.206-28211870.7ae67847
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/dist/hydrate/index.es.js +68 -5
- package/dist/index.es.js +68 -5
- package/package.json +1 -1
package/dist/hydrate/index.es.js
CHANGED
@@ -1333,12 +1333,33 @@ function request(url, data, cb) {
|
|
1333
1333
|
}
|
1334
1334
|
/** @internal */
|
1335
1335
|
const loadActionTableRow = async (config, data, api_key, endpoint) => new Promise((resolve, reject) => {
|
1336
|
+
const defaultValue = config.query.default_value ?? null;
|
1336
1337
|
const key = data[config.query.key] ?? null;
|
1337
1338
|
if (key == null) {
|
1338
1339
|
console.warn('key is not found. key: ', config.query.key);
|
1340
|
+
if (defaultValue != null) {
|
1341
|
+
return resolve(defaultValue);
|
1342
|
+
}
|
1339
1343
|
return reject('key is not found.');
|
1340
1344
|
}
|
1341
|
-
return collection$1({ endpoint, api_key, table: config.query.table_name }).get(key, (err, data) =>
|
1345
|
+
return collection$1({ endpoint, api_key, table: config.query.table_name }).get(key, (err, 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]);
|
1357
|
+
}
|
1358
|
+
if (defaultValue != null) {
|
1359
|
+
return resolve(defaultValue);
|
1360
|
+
}
|
1361
|
+
return resolve(data);
|
1362
|
+
});
|
1342
1363
|
});
|
1343
1364
|
/** @internal */
|
1344
1365
|
const loadActionTableRows = async (config, data, api_key, endpoint) => new Promise((resolve, reject) => {
|
@@ -1346,21 +1367,42 @@ const loadActionTableRows = async (config, data, api_key, endpoint) => new Promi
|
|
1346
1367
|
console.warn('key is not defined.');
|
1347
1368
|
return reject('key is not defined.');
|
1348
1369
|
}
|
1370
|
+
const defaultValue = config.query.default_value ?? null;
|
1349
1371
|
const keys = [];
|
1350
1372
|
let hasError = false;
|
1351
1373
|
const originalKeys = Array.isArray(config.query.key) ? config.query.key : [config.query.key];
|
1352
1374
|
originalKeys.forEach(key => {
|
1353
1375
|
const d = data[key];
|
1354
|
-
if (d == null) {
|
1376
|
+
if (d == null || d === '') {
|
1355
1377
|
console.warn('key is not found. key: ', key);
|
1356
1378
|
hasError = true;
|
1357
1379
|
}
|
1358
1380
|
keys.push(d);
|
1359
1381
|
});
|
1360
1382
|
if (hasError) {
|
1383
|
+
if (defaultValue != null) {
|
1384
|
+
return resolve(defaultValue);
|
1385
|
+
}
|
1361
1386
|
return reject('key is not found.');
|
1362
1387
|
}
|
1363
|
-
return collection$1({ endpoint, api_key, table: config.query.table_name }).get(keys, (err, data) =>
|
1388
|
+
return collection$1({ endpoint, api_key, table: config.query.table_name }).get(keys, (err, 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);
|
1400
|
+
}
|
1401
|
+
if (defaultValue != null) {
|
1402
|
+
return resolve(defaultValue);
|
1403
|
+
}
|
1404
|
+
return resolve(data);
|
1405
|
+
});
|
1364
1406
|
});
|
1365
1407
|
/** @internal */
|
1366
1408
|
const loadActionTableQuery = async (config, data, api_key, endpoint) => new Promise((resolve, reject) => {
|
@@ -1368,20 +1410,41 @@ const loadActionTableQuery = async (config, data, api_key, endpoint) => new Prom
|
|
1368
1410
|
console.warn('key is not defined.');
|
1369
1411
|
return reject('key is not defined.');
|
1370
1412
|
}
|
1413
|
+
const defaultValue = config.query.default_value ?? null;
|
1371
1414
|
const params = {};
|
1372
1415
|
let hasError = false;
|
1373
1416
|
Object.entries(config.query.params).forEach(([key, param]) => {
|
1374
1417
|
const d = data[param];
|
1375
|
-
if (d == null) {
|
1418
|
+
if (d == null || d === '') {
|
1376
1419
|
console.warn('key is not found. param: ', param);
|
1377
1420
|
hasError = true;
|
1378
1421
|
}
|
1379
1422
|
params[key] = d;
|
1380
1423
|
});
|
1381
1424
|
if (hasError) {
|
1425
|
+
if (defaultValue != null) {
|
1426
|
+
return resolve(defaultValue);
|
1427
|
+
}
|
1382
1428
|
return reject('key is not found.');
|
1383
1429
|
}
|
1384
|
-
return collection$1({ endpoint, api_key, table: config.query.table_name }).getByQuery(config.query.query_name, params, null, (err, data) =>
|
1430
|
+
return collection$1({ endpoint, api_key, table: config.query.table_name }).getByQuery(config.query.query_name, params, null, (err, 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);
|
1442
|
+
}
|
1443
|
+
if (defaultValue != null) {
|
1444
|
+
return resolve(defaultValue);
|
1445
|
+
}
|
1446
|
+
return resolve(data);
|
1447
|
+
});
|
1385
1448
|
});
|
1386
1449
|
/** @internal */
|
1387
1450
|
const loadActionTable = async (config, data, api_key, endpoint) => {
|
package/dist/index.es.js
CHANGED
@@ -1356,12 +1356,33 @@ function request(url, data, cb) {
|
|
1356
1356
|
}
|
1357
1357
|
/** @internal */
|
1358
1358
|
const loadActionTableRow = async (config, data, api_key, endpoint) => new Promise((resolve, reject) => {
|
1359
|
+
const defaultValue = config.query.default_value ?? null;
|
1359
1360
|
const key = data[config.query.key] ?? null;
|
1360
1361
|
if (key == null) {
|
1361
1362
|
console.warn('key is not found. key: ', config.query.key);
|
1363
|
+
if (defaultValue != null) {
|
1364
|
+
return resolve(defaultValue);
|
1365
|
+
}
|
1362
1366
|
return reject('key is not found.');
|
1363
1367
|
}
|
1364
|
-
return collection$1({ endpoint, api_key, table: config.query.table_name }).get(key, (err, data) =>
|
1368
|
+
return collection$1({ endpoint, api_key, table: config.query.table_name }).get(key, (err, 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]);
|
1380
|
+
}
|
1381
|
+
if (defaultValue != null) {
|
1382
|
+
return resolve(defaultValue);
|
1383
|
+
}
|
1384
|
+
return resolve(data);
|
1385
|
+
});
|
1365
1386
|
});
|
1366
1387
|
/** @internal */
|
1367
1388
|
const loadActionTableRows = async (config, data, api_key, endpoint) => new Promise((resolve, reject) => {
|
@@ -1369,21 +1390,42 @@ const loadActionTableRows = async (config, data, api_key, endpoint) => new Promi
|
|
1369
1390
|
console.warn('key is not defined.');
|
1370
1391
|
return reject('key is not defined.');
|
1371
1392
|
}
|
1393
|
+
const defaultValue = config.query.default_value ?? null;
|
1372
1394
|
const keys = [];
|
1373
1395
|
let hasError = false;
|
1374
1396
|
const originalKeys = Array.isArray(config.query.key) ? config.query.key : [config.query.key];
|
1375
1397
|
originalKeys.forEach(key => {
|
1376
1398
|
const d = data[key];
|
1377
|
-
if (d == null) {
|
1399
|
+
if (d == null || d === '') {
|
1378
1400
|
console.warn('key is not found. key: ', key);
|
1379
1401
|
hasError = true;
|
1380
1402
|
}
|
1381
1403
|
keys.push(d);
|
1382
1404
|
});
|
1383
1405
|
if (hasError) {
|
1406
|
+
if (defaultValue != null) {
|
1407
|
+
return resolve(defaultValue);
|
1408
|
+
}
|
1384
1409
|
return reject('key is not found.');
|
1385
1410
|
}
|
1386
|
-
return collection$1({ endpoint, api_key, table: config.query.table_name }).get(keys, (err, data) =>
|
1411
|
+
return collection$1({ endpoint, api_key, table: config.query.table_name }).get(keys, (err, 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);
|
1423
|
+
}
|
1424
|
+
if (defaultValue != null) {
|
1425
|
+
return resolve(defaultValue);
|
1426
|
+
}
|
1427
|
+
return resolve(data);
|
1428
|
+
});
|
1387
1429
|
});
|
1388
1430
|
/** @internal */
|
1389
1431
|
const loadActionTableQuery = async (config, data, api_key, endpoint) => new Promise((resolve, reject) => {
|
@@ -1391,20 +1433,41 @@ const loadActionTableQuery = async (config, data, api_key, endpoint) => new Prom
|
|
1391
1433
|
console.warn('key is not defined.');
|
1392
1434
|
return reject('key is not defined.');
|
1393
1435
|
}
|
1436
|
+
const defaultValue = config.query.default_value ?? null;
|
1394
1437
|
const params = {};
|
1395
1438
|
let hasError = false;
|
1396
1439
|
Object.entries(config.query.params).forEach(([key, param]) => {
|
1397
1440
|
const d = data[param];
|
1398
|
-
if (d == null) {
|
1441
|
+
if (d == null || d === '') {
|
1399
1442
|
console.warn('key is not found. param: ', param);
|
1400
1443
|
hasError = true;
|
1401
1444
|
}
|
1402
1445
|
params[key] = d;
|
1403
1446
|
});
|
1404
1447
|
if (hasError) {
|
1448
|
+
if (defaultValue != null) {
|
1449
|
+
return resolve(defaultValue);
|
1450
|
+
}
|
1405
1451
|
return reject('key is not found.');
|
1406
1452
|
}
|
1407
|
-
return collection$1({ endpoint, api_key, table: config.query.table_name }).getByQuery(config.query.query_name, params, null, (err, data) =>
|
1453
|
+
return collection$1({ endpoint, api_key, table: config.query.table_name }).getByQuery(config.query.query_name, params, null, (err, 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);
|
1465
|
+
}
|
1466
|
+
if (defaultValue != null) {
|
1467
|
+
return resolve(defaultValue);
|
1468
|
+
}
|
1469
|
+
return resolve(data);
|
1470
|
+
});
|
1408
1471
|
});
|
1409
1472
|
/** @internal */
|
1410
1473
|
const loadActionTable = async (config, data, api_key, endpoint) => {
|