@plaidev/karte-action-sdk 1.1.199-28181334.2aca4feb → 1.1.199-28181545.5e6123f1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1332,40 +1332,37 @@ function request(url, data, cb) {
1332
1332
  });
1333
1333
  }
1334
1334
  /** @internal */
1335
- const loadActionTableRow = async (config, data, api_key, endpoint) => {
1336
- return new Promise((resolve, reject) => {
1337
- const key = data[config.query.key] ?? null;
1338
- if (key == null) {
1339
- console.warn('key is not found. key: ', config.query.key);
1340
- return reject('key is not found.');
1341
- }
1342
- return collection$1({ endpoint, api_key, table: config.query.table_name }).get(key, (err, data) => err ? reject(err) : resolve(data));
1343
- });
1344
- };
1335
+ const loadActionTableRow = async (config, data, api_key, endpoint) => new Promise((resolve, reject) => {
1336
+ const key = data[config.query.key] ?? null;
1337
+ if (key == null) {
1338
+ console.warn('key is not found. key: ', config.query.key);
1339
+ return reject('key is not found.');
1340
+ }
1341
+ return collection$1({ endpoint, api_key, table: config.query.table_name }).get(key, (err, data) => err ? reject(err) : resolve(data));
1342
+ });
1345
1343
  /** @internal */
1346
- const loadActionTableRows = async (config, data, api_key, endpoint) => {
1347
- return new Promise((resolve, reject) => {
1348
- const keys = config.query.key.map(key => data[key] ?? null);
1349
- if (keys.some(key => key == null)) {
1350
- keys.filter(key => key == null).forEach(key => console.warn('key is not found. key: ', key));
1351
- return reject('key is not found.');
1352
- }
1353
- return collection$1({ endpoint, api_key, table: config.query.table_name }).get(config.query.key, (err, data) => (err ? reject(err) : resolve(data)));
1354
- });
1355
- };
1344
+ const loadActionTableRows = async (config, data, api_key, endpoint) => new Promise((resolve, reject) => {
1345
+ if (config.query.key == null) {
1346
+ console.warn('key is not defined.');
1347
+ return reject('key is not defined.');
1348
+ }
1349
+ const originalKeys = Array.isArray(config.query.key) ? config.query.key : [config.query.key];
1350
+ const keys = originalKeys.map(key => data[key] ?? null);
1351
+ if (keys.some(key => key == null)) {
1352
+ keys.forEach((key, i) => key == null && console.warn('key is not found. key: ', config.query.key[i]));
1353
+ return reject('key is not found.');
1354
+ }
1355
+ return collection$1({ endpoint, api_key, table: config.query.table_name }).get(keys, (err, data) => (err ? reject(err) : resolve(data)));
1356
+ });
1356
1357
  /** @internal */
1357
- const loadActionTableQuery = async (config, data, api_key, endpoint) => {
1358
- return new Promise((resolve, reject) => {
1359
- const params = config.query.params.map(param => data[param] ?? null);
1360
- if (params.some(param => param == null)) {
1361
- params
1362
- .filter(param => param == null)
1363
- .forEach(param => console.warn('key is not found. param: ', param));
1364
- return reject('key is not found.');
1365
- }
1366
- return collection$1({ endpoint, api_key, table: config.query.table_name }).getByQuery(config.query.query_name, config.query.params, null, (err, data) => (err ? reject(err) : resolve(data)));
1367
- });
1368
- };
1358
+ const loadActionTableQuery = async (config, data, api_key, endpoint) => new Promise((resolve, reject) => {
1359
+ const params = config.query.params?.map(param => data[param] ?? null);
1360
+ if (params.some(param => param == null)) {
1361
+ params.forEach((param, i) => param == null && console.warn('key is not found. param: ', config.query.params[i]));
1362
+ return reject('key is not found.');
1363
+ }
1364
+ return collection$1({ endpoint, api_key, table: config.query.table_name }).getByQuery(config.query.query_name, params, null, (err, data) => (err ? reject(err) : resolve(data)));
1365
+ });
1369
1366
  /** @internal */
1370
1367
  const loadActionTable = async (config, data, api_key, endpoint) => {
1371
1368
  console.debug('[debug] loadActionTable', isPreview(), api_key, endpoint, JSON.stringify(config));
package/dist/index.es.js CHANGED
@@ -1355,40 +1355,37 @@ function request(url, data, cb) {
1355
1355
  });
1356
1356
  }
1357
1357
  /** @internal */
1358
- const loadActionTableRow = async (config, data, api_key, endpoint) => {
1359
- return new Promise((resolve, reject) => {
1360
- const key = data[config.query.key] ?? null;
1361
- if (key == null) {
1362
- console.warn('key is not found. key: ', config.query.key);
1363
- return reject('key is not found.');
1364
- }
1365
- return collection$1({ endpoint, api_key, table: config.query.table_name }).get(key, (err, data) => err ? reject(err) : resolve(data));
1366
- });
1367
- };
1358
+ const loadActionTableRow = async (config, data, api_key, endpoint) => new Promise((resolve, reject) => {
1359
+ const key = data[config.query.key] ?? null;
1360
+ if (key == null) {
1361
+ console.warn('key is not found. key: ', config.query.key);
1362
+ return reject('key is not found.');
1363
+ }
1364
+ return collection$1({ endpoint, api_key, table: config.query.table_name }).get(key, (err, data) => err ? reject(err) : resolve(data));
1365
+ });
1368
1366
  /** @internal */
1369
- const loadActionTableRows = async (config, data, api_key, endpoint) => {
1370
- return new Promise((resolve, reject) => {
1371
- const keys = config.query.key.map(key => data[key] ?? null);
1372
- if (keys.some(key => key == null)) {
1373
- keys.filter(key => key == null).forEach(key => console.warn('key is not found. key: ', key));
1374
- return reject('key is not found.');
1375
- }
1376
- return collection$1({ endpoint, api_key, table: config.query.table_name }).get(config.query.key, (err, data) => (err ? reject(err) : resolve(data)));
1377
- });
1378
- };
1367
+ const loadActionTableRows = async (config, data, api_key, endpoint) => new Promise((resolve, reject) => {
1368
+ if (config.query.key == null) {
1369
+ console.warn('key is not defined.');
1370
+ return reject('key is not defined.');
1371
+ }
1372
+ const originalKeys = Array.isArray(config.query.key) ? config.query.key : [config.query.key];
1373
+ const keys = originalKeys.map(key => data[key] ?? null);
1374
+ if (keys.some(key => key == null)) {
1375
+ keys.forEach((key, i) => key == null && console.warn('key is not found. key: ', config.query.key[i]));
1376
+ return reject('key is not found.');
1377
+ }
1378
+ return collection$1({ endpoint, api_key, table: config.query.table_name }).get(keys, (err, data) => (err ? reject(err) : resolve(data)));
1379
+ });
1379
1380
  /** @internal */
1380
- const loadActionTableQuery = async (config, data, api_key, endpoint) => {
1381
- return new Promise((resolve, reject) => {
1382
- const params = config.query.params.map(param => data[param] ?? null);
1383
- if (params.some(param => param == null)) {
1384
- params
1385
- .filter(param => param == null)
1386
- .forEach(param => console.warn('key is not found. param: ', param));
1387
- return reject('key is not found.');
1388
- }
1389
- return collection$1({ endpoint, api_key, table: config.query.table_name }).getByQuery(config.query.query_name, config.query.params, null, (err, data) => (err ? reject(err) : resolve(data)));
1390
- });
1391
- };
1381
+ const loadActionTableQuery = async (config, data, api_key, endpoint) => new Promise((resolve, reject) => {
1382
+ const params = config.query.params?.map(param => data[param] ?? null);
1383
+ if (params.some(param => param == null)) {
1384
+ params.forEach((param, i) => param == null && console.warn('key is not found. param: ', config.query.params[i]));
1385
+ return reject('key is not found.');
1386
+ }
1387
+ return collection$1({ endpoint, api_key, table: config.query.table_name }).getByQuery(config.query.query_name, params, null, (err, data) => (err ? reject(err) : resolve(data)));
1388
+ });
1392
1389
  /** @internal */
1393
1390
  const loadActionTable = async (config, data, api_key, endpoint) => {
1394
1391
  console.debug('[debug] loadActionTable', isPreview(), api_key, endpoint, JSON.stringify(config));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaidev/karte-action-sdk",
3
- "version": "1.1.199-28181334.2aca4feb",
3
+ "version": "1.1.199-28181545.5e6123f1",
4
4
  "author": "Plaid Inc.",
5
5
  "license": "Apache-2.0",
6
6
  "module": "./dist/index.es.js",