@rex0220/kintone-sql-tools 3.70.0 → 3.71.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.
@@ -1492,7 +1492,7 @@
1492
1492
  "format": "esm"
1493
1493
  },
1494
1494
  "src/execute.ts": {
1495
- "bytes": 593690,
1495
+ "bytes": 611305,
1496
1496
  "imports": [
1497
1497
  {
1498
1498
  "path": "src/lexer/lexer.ts",
@@ -1961,12 +1961,12 @@
1961
1961
  "format": "esm"
1962
1962
  },
1963
1963
  "src/flow-library/publicTypes.ts": {
1964
- "bytes": 8442,
1964
+ "bytes": 9414,
1965
1965
  "imports": [],
1966
1966
  "format": "esm"
1967
1967
  },
1968
1968
  "src/flow-library/index.ts": {
1969
- "bytes": 9925,
1969
+ "bytes": 13419,
1970
1970
  "imports": [
1971
1971
  {
1972
1972
  "path": "src/core/diagnostics.ts",
@@ -2019,7 +2019,7 @@
2019
2019
  "entryPoint": "src/flow-library/index.ts",
2020
2020
  "inputs": {
2021
2021
  "src/flow-library/index.ts": {
2022
- "bytesInOutput": 3749
2022
+ "bytesInOutput": 5776
2023
2023
  },
2024
2024
  "src/core/diagnostics.ts": {
2025
2025
  "bytesInOutput": 755
@@ -2313,7 +2313,7 @@
2313
2313
  "bytesInOutput": 412
2314
2314
  },
2315
2315
  "src/execute.ts": {
2316
- "bytesInOutput": 236422
2316
+ "bytesInOutput": 243455
2317
2317
  },
2318
2318
  "src/api/cursorLeaseManager.ts": {
2319
2319
  "bytesInOutput": 1777
@@ -2340,7 +2340,7 @@
2340
2340
  "bytesInOutput": 442
2341
2341
  }
2342
2342
  },
2343
- "bytes": 673938
2343
+ "bytes": 683015
2344
2344
  }
2345
2345
  }
2346
2346
  }
@@ -1492,7 +1492,7 @@
1492
1492
  "format": "esm"
1493
1493
  },
1494
1494
  "src/execute.ts": {
1495
- "bytes": 593690,
1495
+ "bytes": 611305,
1496
1496
  "imports": [
1497
1497
  {
1498
1498
  "path": "src/lexer/lexer.ts",
@@ -1961,12 +1961,12 @@
1961
1961
  "format": "esm"
1962
1962
  },
1963
1963
  "src/flow-library/publicTypes.ts": {
1964
- "bytes": 8442,
1964
+ "bytes": 9414,
1965
1965
  "imports": [],
1966
1966
  "format": "esm"
1967
1967
  },
1968
1968
  "src/flow-library/index.ts": {
1969
- "bytes": 9925,
1969
+ "bytes": 13419,
1970
1970
  "imports": [
1971
1971
  {
1972
1972
  "path": "src/core/diagnostics.ts",
@@ -2024,6 +2024,7 @@
2024
2024
  "explainScript",
2025
2025
  "isDmlResult",
2026
2026
  "parseScript",
2027
+ "previewStatement",
2027
2028
  "validateScript",
2028
2029
  "version"
2029
2030
  ],
@@ -2321,7 +2322,7 @@
2321
2322
  "bytesInOutput": 412
2322
2323
  },
2323
2324
  "src/execute.ts": {
2324
- "bytesInOutput": 236422
2325
+ "bytesInOutput": 243455
2325
2326
  },
2326
2327
  "src/api/cursorLeaseManager.ts": {
2327
2328
  "bytesInOutput": 1777
@@ -2348,10 +2349,10 @@
2348
2349
  "bytesInOutput": 442
2349
2350
  },
2350
2351
  "src/flow-library/index.ts": {
2351
- "bytesInOutput": 3479
2352
+ "bytesInOutput": 5482
2352
2353
  }
2353
2354
  },
2354
- "bytes": 673310
2355
+ "bytes": 682369
2355
2356
  }
2356
2357
  }
2357
2358
  }
@@ -29765,7 +29765,7 @@ var import_docsResourceBuilder = __toESM(require_docsResourceBuilder());
29765
29765
 
29766
29766
  // src/mcp/serverVersion.ts
29767
29767
  init_define_KSQL_DOCS();
29768
- var SERVER_VERSION = true ? "3.70.0" : "0.0.0-dev";
29768
+ var SERVER_VERSION = true ? "3.71.0" : "0.0.0-dev";
29769
29769
 
29770
29770
  // src/mcp/docsResources.ts
29771
29771
  function loadFromRepoDocs() {
@@ -52869,11 +52869,16 @@ function lookupUpsertTarget(index, keyParts) {
52869
52869
  if (!index.numericKey.some(Boolean)) return void 0;
52870
52870
  return index.normalized.get(upsertNormalizedKey(keyParts, index.numericKey));
52871
52871
  }
52872
- async function resolveUpsertTargets(appId, keyFields, rowKeyValues, client, options, fieldTypes) {
52872
+ async function resolveUpsertTargets(appId, keyFields, rowKeyValues, client, options, fieldTypes, previewFields) {
52873
52873
  const maxRecords2 = options.maxRecords ?? 1e4;
52874
52874
  const parallel = options.fetchParallel ?? 1;
52875
52875
  const numericKey = keyFields.map((f) => fieldTypes.get(f) === "NUMBER");
52876
- const index = { raw: /* @__PURE__ */ new Map(), normalized: /* @__PURE__ */ new Map(), numericKey };
52876
+ const index = {
52877
+ raw: /* @__PURE__ */ new Map(),
52878
+ normalized: /* @__PURE__ */ new Map(),
52879
+ numericKey,
52880
+ ...previewFields ? { snapshots: /* @__PURE__ */ new Map() } : {}
52881
+ };
52877
52882
  const setMax = (map2, key, id) => {
52878
52883
  const cur = map2.get(key);
52879
52884
  if (cur === void 0 || id > cur) map2.set(key, id);
@@ -52894,20 +52899,26 @@ async function resolveUpsertTargets(appId, keyFields, rowKeyValues, client, opti
52894
52899
  if (parts.some((p) => p === "")) perRowKeys.push(parts);
52895
52900
  else batchFirstKeys.add(parts[0]);
52896
52901
  }
52897
- const fields = ["$id", ...keyFields];
52902
+ const fields = previewFields ? [.../* @__PURE__ */ new Set(["$id", ...keyFields, ...previewFields])] : ["$id", ...keyFields];
52898
52903
  for (const chunk3 of splitChunks([...batchFirstKeys], UPSERT_IN_CHUNK_SIZE)) {
52899
52904
  const query = `${keyFields[0]} in (${chunk3.map(sqlQuote).join(",")})`;
52900
52905
  const records = await fetchAll(client.getRecords, appId, query, fields, { maxRecords: maxRecords2, parallel });
52901
52906
  for (const rec of records) {
52902
52907
  const id = Number(rec["$id"]?.value);
52903
52908
  if (!Number.isFinite(id)) continue;
52909
+ index.snapshots?.set(id, rec);
52904
52910
  addRecordToIndex(keyFields.map((f) => toScalarText(rec[f]?.value)), id);
52905
52911
  }
52906
52912
  }
52907
52913
  for (const parts of perRowKeys) {
52908
52914
  const query = keyFields.map((f, i) => `${f} = ${sqlQuote(parts[i])}`).join(" and ");
52909
- const existing = await fetchAll(client.getRecords, appId, query, ["$id"], { maxRecords: maxRecords2, parallel });
52915
+ const perRowFields = previewFields ? [.../* @__PURE__ */ new Set(["$id", ...previewFields])] : ["$id"];
52916
+ const existing = await fetchAll(client.getRecords, appId, query, perRowFields, { maxRecords: maxRecords2, parallel });
52910
52917
  if (existing.length === 0) continue;
52918
+ for (const rec of existing) {
52919
+ const id = Number(rec["$id"]?.value);
52920
+ if (Number.isFinite(id)) index.snapshots?.set(id, rec);
52921
+ }
52911
52922
  addRecordToIndex(parts, maxRecordId(existing));
52912
52923
  }
52913
52924
  return index;
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rex0220/kintone-sql-tools",
3
- "version": "3.70.0",
3
+ "version": "3.71.0",
4
4
  "description": "kintone SQL plugin, CLI, and MCP tools (ksql)",
5
5
  "publishConfig": {
6
6
  "access": "public"