@rex0220/kintone-sql-tools 3.49.0 → 3.50.0

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-cli/ksql.js CHANGED
@@ -19349,6 +19349,13 @@ async function executeFullScanSelect(stmt, client, options, cacheContext, cteCac
19349
19349
  );
19350
19350
  return { type: "SELECT", rows, columns, rowCount: rows.length, warnings: [...warnings] };
19351
19351
  }
19352
+ function assertUnionColumnCount(leftColumns, rightColumns) {
19353
+ if (leftColumns.length === rightColumns.length) return;
19354
+ throw new Error(
19355
+ `ArgumentError: UNION \u306E\u5DE6\u53F3\u3067\u5217\u6570\u304C\u4E00\u81F4\u3057\u307E\u305B\u3093\uFF08\u5DE6 ${leftColumns.length} \u5217 / \u53F3 ${rightColumns.length} \u5217\uFF09\u3002
19356
+ UNION \u306F\u5217\u3092\u4F4D\u7F6E\u3067\u5BFE\u5FDC\u3055\u305B\u308B\u305F\u3081\u3001\u4E21\u8FBA\u306E\u5217\u6570\u3092\u63C3\u3048\u3066\u304F\u3060\u3055\u3044`
19357
+ );
19358
+ }
19352
19359
  async function executeUnion(stmt, client, options, cacheContext, captureColumnMeta = false, forLibraryCapture = false) {
19353
19360
  const completePolicy = buildCompleteInputPolicy(stmt, options, null);
19354
19361
  return withCompleteInputPolicy(completePolicy, async () => {
@@ -19384,6 +19391,7 @@ async function executeUnion(stmt, client, options, cacheContext, captureColumnMe
19384
19391
  ]);
19385
19392
  const leftCols = leftResult.columns;
19386
19393
  const rightCols = rightResult.columns;
19394
+ assertUnionColumnCount(leftCols, rightCols);
19387
19395
  const remappedRight = rightResult.rows.map((row) => {
19388
19396
  const mapped = {};
19389
19397
  leftCols.forEach((col, i) => {
@@ -19471,6 +19479,7 @@ async function executeQueryWithCte(query, client, options, cteCache, cacheContex
19471
19479
  ]);
19472
19480
  const leftCols = leftResult.columns;
19473
19481
  const rightCols = rightResult.columns;
19482
+ assertUnionColumnCount(leftCols, rightCols);
19474
19483
  const remapped = rightResult.rows.map((row) => {
19475
19484
  const mapped = {};
19476
19485
  leftCols.forEach((col, i) => {
@@ -22990,9 +22999,23 @@ async function executeUpsertSelect(stmt, client, options, cacheContext, cteCache
22990
22999
  updatedCount: toUpdate.length
22991
23000
  };
22992
23001
  }
23002
+ var SHOW_APPS_COLUMNS = Object.freeze([
23003
+ "\u30A2\u30D7\u30EAID",
23004
+ "\u30A2\u30D7\u30EA\u540D",
23005
+ "\u8AAC\u660E"
23006
+ ]);
23007
+ var DESCRIBE_COLUMNS = Object.freeze([
23008
+ "\u30D5\u30A3\u30FC\u30EB\u30C9\u30B3\u30FC\u30C9",
23009
+ "\u30E9\u30D9\u30EB",
23010
+ "\u30BF\u30A4\u30D7",
23011
+ "\u30EB\u30C3\u30AF\u30A2\u30C3\u30D7",
23012
+ "\u30B3\u30D4\u30FC\u5143",
23013
+ "\u91CD\u8907\u7981\u6B62",
23014
+ "\u8A08\u7B97\u5F0F"
23015
+ ]);
22993
23016
  async function executeShowApps(client) {
22994
23017
  const apps = await client.getApps();
22995
- const columns = ["\u30A2\u30D7\u30EAID", "\u30A2\u30D7\u30EA\u540D", "\u8AAC\u660E"];
23018
+ const columns = [...SHOW_APPS_COLUMNS];
22996
23019
  const rows = apps.map((a) => ({
22997
23020
  "\u30A2\u30D7\u30EAID": String(a.appId),
22998
23021
  "\u30A2\u30D7\u30EA\u540D": a.name,
@@ -23002,15 +23025,7 @@ async function executeShowApps(client) {
23002
23025
  }
23003
23026
  async function executeDescribe(stmt, client, cacheContext) {
23004
23027
  const fields = await getFieldsCached(stmt.appId, client, cacheContext);
23005
- const columns = [
23006
- "\u30D5\u30A3\u30FC\u30EB\u30C9\u30B3\u30FC\u30C9",
23007
- "\u30E9\u30D9\u30EB",
23008
- "\u30BF\u30A4\u30D7",
23009
- "\u30EB\u30C3\u30AF\u30A2\u30C3\u30D7",
23010
- "\u30B3\u30D4\u30FC\u5143",
23011
- "\u91CD\u8907\u7981\u6B62",
23012
- "\u8A08\u7B97\u5F0F"
23013
- ];
23028
+ const columns = [...DESCRIBE_COLUMNS];
23014
23029
  const rows = fields.map((f) => ({
23015
23030
  "\u30D5\u30A3\u30FC\u30EB\u30C9\u30B3\u30FC\u30C9": f.code,
23016
23031
  "\u30E9\u30D9\u30EB": f.label,