@plaidev/karte-action-sdk 1.1.199-28181545.5e6123f1 → 1.1.200-28181618.eebdb2a1

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.
@@ -257,7 +257,9 @@ type ActionTableQueryRequestConfig = VariableQuery & {
257
257
  query: {
258
258
  table_name: string;
259
259
  query_name: string;
260
- params?: ActionTableQueryParams;
260
+ params?: {
261
+ [key: string]: string;
262
+ };
261
263
  default_value?: Array<ActionTableResult>;
262
264
  };
263
265
  preview_value?: Array<ActionTableResult>;
@@ -1711,7 +1713,9 @@ declare namespace widget {
1711
1713
  query: {
1712
1714
  table_name: string;
1713
1715
  query_name: string;
1714
- params?: ActionTableQueryParams;
1716
+ params?: {
1717
+ [key: string]: string;
1718
+ };
1715
1719
  default_value?: Array<ActionTableResult>;
1716
1720
  };
1717
1721
  preview_value?: Array<ActionTableResult>;
@@ -1346,19 +1346,39 @@ const loadActionTableRows = async (config, data, api_key, endpoint) => new Promi
1346
1346
  console.warn('key is not defined.');
1347
1347
  return reject('key is not defined.');
1348
1348
  }
1349
+ const keys = [];
1350
+ let hasError = false;
1349
1351
  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]));
1352
+ originalKeys.forEach(key => {
1353
+ const d = data[key];
1354
+ if (d == null) {
1355
+ console.warn('key is not found. key: ', key);
1356
+ hasError = true;
1357
+ }
1358
+ keys.push(d);
1359
+ });
1360
+ if (hasError) {
1353
1361
  return reject('key is not found.');
1354
1362
  }
1355
1363
  return collection$1({ endpoint, api_key, table: config.query.table_name }).get(keys, (err, data) => (err ? reject(err) : resolve(data)));
1356
1364
  });
1357
1365
  /** @internal */
1358
1366
  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]));
1367
+ if (config.query.params == null) {
1368
+ console.warn('key is not defined.');
1369
+ return reject('key is not defined.');
1370
+ }
1371
+ const params = {};
1372
+ let hasError = false;
1373
+ Object.entries(config.query.params).forEach(([key, param]) => {
1374
+ const d = data[param];
1375
+ if (d == null) {
1376
+ console.warn('key is not found. param: ', param);
1377
+ hasError = true;
1378
+ }
1379
+ params[key] = d;
1380
+ });
1381
+ if (hasError) {
1362
1382
  return reject('key is not found.');
1363
1383
  }
1364
1384
  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)));
@@ -257,7 +257,9 @@ type ActionTableQueryRequestConfig = VariableQuery & {
257
257
  query: {
258
258
  table_name: string;
259
259
  query_name: string;
260
- params?: ActionTableQueryParams;
260
+ params?: {
261
+ [key: string]: string;
262
+ };
261
263
  default_value?: Array<ActionTableResult>;
262
264
  };
263
265
  preview_value?: Array<ActionTableResult>;
@@ -1711,7 +1713,9 @@ declare namespace widget {
1711
1713
  query: {
1712
1714
  table_name: string;
1713
1715
  query_name: string;
1714
- params?: ActionTableQueryParams;
1716
+ params?: {
1717
+ [key: string]: string;
1718
+ };
1715
1719
  default_value?: Array<ActionTableResult>;
1716
1720
  };
1717
1721
  preview_value?: Array<ActionTableResult>;
package/dist/index.es.js CHANGED
@@ -1369,19 +1369,39 @@ const loadActionTableRows = async (config, data, api_key, endpoint) => new Promi
1369
1369
  console.warn('key is not defined.');
1370
1370
  return reject('key is not defined.');
1371
1371
  }
1372
+ const keys = [];
1373
+ let hasError = false;
1372
1374
  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]));
1375
+ originalKeys.forEach(key => {
1376
+ const d = data[key];
1377
+ if (d == null) {
1378
+ console.warn('key is not found. key: ', key);
1379
+ hasError = true;
1380
+ }
1381
+ keys.push(d);
1382
+ });
1383
+ if (hasError) {
1376
1384
  return reject('key is not found.');
1377
1385
  }
1378
1386
  return collection$1({ endpoint, api_key, table: config.query.table_name }).get(keys, (err, data) => (err ? reject(err) : resolve(data)));
1379
1387
  });
1380
1388
  /** @internal */
1381
1389
  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]));
1390
+ if (config.query.params == null) {
1391
+ console.warn('key is not defined.');
1392
+ return reject('key is not defined.');
1393
+ }
1394
+ const params = {};
1395
+ let hasError = false;
1396
+ Object.entries(config.query.params).forEach(([key, param]) => {
1397
+ const d = data[param];
1398
+ if (d == null) {
1399
+ console.warn('key is not found. param: ', param);
1400
+ hasError = true;
1401
+ }
1402
+ params[key] = d;
1403
+ });
1404
+ if (hasError) {
1385
1405
  return reject('key is not found.');
1386
1406
  }
1387
1407
  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)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaidev/karte-action-sdk",
3
- "version": "1.1.199-28181545.5e6123f1",
3
+ "version": "1.1.200-28181618.eebdb2a1",
4
4
  "author": "Plaid Inc.",
5
5
  "license": "Apache-2.0",
6
6
  "module": "./dist/index.es.js",