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