@rex0220/kintone-sql-tools 3.69.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.
@@ -1,11 +1,11 @@
1
1
  {
2
- "generatedAt": "2026-08-21T12:27:30.712Z",
2
+ "generatedAt": "2026-08-21T22:20:59.339Z",
3
3
  "baseline": "B66 Phase1 initial measured values; no arbitrary size ceiling",
4
4
  "bundles": {
5
5
  "index.cjs": {
6
6
  "inputCount": 115,
7
- "minifiedBytes": 679936,
8
- "gzipBytes": 185593,
7
+ "minifiedBytes": 680354,
8
+ "gzipBytes": 185838,
9
9
  "forbidden": {
10
10
  "mcp-instructions": [],
11
11
  "src-mcp": [],
@@ -24,8 +24,8 @@
24
24
  },
25
25
  "index.mjs": {
26
26
  "inputCount": 115,
27
- "minifiedBytes": 679391,
28
- "gzipBytes": 185273,
27
+ "minifiedBytes": 679809,
28
+ "gzipBytes": 185514,
29
29
  "forbidden": {
30
30
  "mcp-instructions": [],
31
31
  "src-mcp": [],
@@ -44,8 +44,8 @@
44
44
  },
45
45
  "ksql-engine.umd.js": {
46
46
  "inputCount": 117,
47
- "minifiedBytes": 680415,
48
- "gzipBytes": 185617,
47
+ "minifiedBytes": 680833,
48
+ "gzipBytes": 185830,
49
49
  "forbidden": {
50
50
  "mcp-instructions": [],
51
51
  "src-mcp": [],
@@ -1446,7 +1446,7 @@
1446
1446
  "format": "esm"
1447
1447
  },
1448
1448
  "src/execute.ts": {
1449
- "bytes": 590529,
1449
+ "bytes": 611305,
1450
1450
  "imports": [
1451
1451
  {
1452
1452
  "path": "src/lexer/lexer.ts",
@@ -2460,7 +2460,7 @@
2460
2460
  "bytesInOutput": 412
2461
2461
  },
2462
2462
  "src/execute.ts": {
2463
- "bytesInOutput": 235571
2463
+ "bytesInOutput": 235989
2464
2464
  },
2465
2465
  "src/engine-library/errors.ts": {
2466
2466
  "bytesInOutput": 1441
@@ -2517,7 +2517,7 @@
2517
2517
  "bytesInOutput": 1406
2518
2518
  }
2519
2519
  },
2520
- "bytes": 679936
2520
+ "bytes": 680354
2521
2521
  }
2522
2522
  }
2523
2523
  }
@@ -1446,7 +1446,7 @@
1446
1446
  "format": "esm"
1447
1447
  },
1448
1448
  "src/execute.ts": {
1449
- "bytes": 590529,
1449
+ "bytes": 611305,
1450
1450
  "imports": [
1451
1451
  {
1452
1452
  "path": "src/lexer/lexer.ts",
@@ -2464,7 +2464,7 @@
2464
2464
  "bytesInOutput": 412
2465
2465
  },
2466
2466
  "src/execute.ts": {
2467
- "bytesInOutput": 235571
2467
+ "bytesInOutput": 235989
2468
2468
  },
2469
2469
  "src/engine-library/errors.ts": {
2470
2470
  "bytesInOutput": 1441
@@ -2524,7 +2524,7 @@
2524
2524
  "bytesInOutput": 16
2525
2525
  }
2526
2526
  },
2527
- "bytes": 679391
2527
+ "bytes": 679809
2528
2528
  }
2529
2529
  }
2530
2530
  }
@@ -1446,7 +1446,7 @@
1446
1446
  "format": "esm"
1447
1447
  },
1448
1448
  "src/execute.ts": {
1449
- "bytes": 590529,
1449
+ "bytes": 611305,
1450
1450
  "imports": [
1451
1451
  {
1452
1452
  "path": "src/lexer/lexer.ts",
@@ -2478,7 +2478,7 @@
2478
2478
  "bytesInOutput": 412
2479
2479
  },
2480
2480
  "src/execute.ts": {
2481
- "bytesInOutput": 235571
2481
+ "bytesInOutput": 235989
2482
2482
  },
2483
2483
  "src/engine-library/errors.ts": {
2484
2484
  "bytesInOutput": 1441
@@ -2544,7 +2544,7 @@
2544
2544
  "bytesInOutput": 127
2545
2545
  }
2546
2546
  },
2547
- "bytes": 680415
2547
+ "bytes": 680833
2548
2548
  }
2549
2549
  }
2550
2550
  }
@@ -1,12 +1,14 @@
1
1
  import { createKintoneClient } from "./writableClient";
2
2
  import { KsqlFlowError } from "./errors";
3
- import type { CreateExecutionContextOptions, Diagnostic, ExecutionContext, ExplainScriptOptions, ExplainScriptResult, ParseScriptOptions, ParseScriptResult, Statement, StatementResult, ValidateScriptOptions } from "./publicTypes";
3
+ import type { CreateExecutionContextOptions, Diagnostic, ExecutionContext, ExplainScriptOptions, ExplainScriptResult, ParseScriptOptions, ParseScriptResult, PreviewResult, PreviewStatementOptions, Statement, StatementResult, ValidateScriptOptions } from "./publicTypes";
4
4
  export declare const version: string;
5
5
  export declare function parseScript(source: string, opts?: ParseScriptOptions): ParseScriptResult;
6
6
  export declare function validateScript(source: string, opts?: ValidateScriptOptions): Promise<Diagnostic[]>;
7
7
  export declare function explainScript(source: string, opts: ExplainScriptOptions): Promise<ExplainScriptResult>;
8
8
  export declare function createExecutionContext(opts: CreateExecutionContextOptions): ExecutionContext;
9
+ export declare function previewStatement(statement: Statement, context: ExecutionContext, opts?: PreviewStatementOptions): Promise<PreviewResult>;
9
10
  export declare function executeStatement(statement: Statement, context: ExecutionContext): Promise<StatementResult>;
10
11
  export declare function disposeExecutionContext(context: ExecutionContext): Promise<void>;
12
+ export { isDmlResult } from "./publicTypes";
11
13
  export { createKintoneClient, KsqlFlowError };
12
- export type { CreateExecutionContextOptions, CreateKintoneClientConfig, Diagnostic, DiagnosticCode, ExecutionContext, ExplainScriptOptions, ExplainScriptResult, FieldInfo, FlowKintoneClient, ParseScriptOptions, ParseScriptResult, SchemaResolver, ScriptHeaderMeta, Statement, StatementResult, StatementResultKind, ValidateScriptOptions, } from "./publicTypes";
14
+ export type { CreateExecutionContextOptions, CreateKintoneClientConfig, Diagnostic, DiagnosticCode, ExecutionContext, ExplainScriptOptions, ExplainScriptResult, FieldInfo, FlowChunkWrittenInfo, FlowDeleteResult, FlowDmlResult, FlowInsertResult, FlowKintoneClient, FlowUpdateResult, FlowUpsertResult, ParseScriptOptions, ParseScriptResult, PreviewResult, PreviewSample, PreviewStatementOptions, SchemaResolver, ScriptHeaderMeta, Statement, StatementResult, StatementResultKind, ValidateScriptOptions, } from "./publicTypes";
@@ -123,6 +123,10 @@ export interface ValidateScriptOptions extends ParseScriptOptions {
123
123
  export interface ExplainScriptOptions extends ParseScriptOptions {
124
124
  client: FlowKintoneClient;
125
125
  variables?: Readonly<Record<string, string>>;
126
+ /** dialect 1 の @ 付き時刻関数が共有する explain 呼出し単位の基準時刻。 */
127
+ asOf?: Date;
128
+ /** @TODAY() などの暦日境界に使う IANA timezone。省略時はホスト timezone。 */
129
+ timezone?: string;
126
130
  maxRecords?: number;
127
131
  cursorMaxActive?: number;
128
132
  dmlMaxRows?: number;
@@ -161,6 +165,23 @@ export interface CreateExecutionContextOptions extends ParseScriptOptions {
161
165
  asOf?: Date;
162
166
  timezone?: string;
163
167
  continueOnError?: boolean;
168
+ /**
169
+ * 書込 API の各成功直後に await される。順序は現在の書込順であり、キー順は保証しない。
170
+ * コールバックが throw した場合、その文は error になるが、通知対象チャンクは書込済み。
171
+ */
172
+ onChunkWritten?: (info: FlowChunkWrittenInfo) => void | Promise<void>;
173
+ }
174
+ export interface FlowChunkWrittenInfo {
175
+ /** バッチ内の文 index(0 始まり)。 */
176
+ statementIndex: number;
177
+ /** 書込 API に渡される物理アプリ ID(LAPP は解決済み)。 */
178
+ appId: number;
179
+ operation: "INSERT" | "UPDATE" | "DELETE";
180
+ records: number;
181
+ /** その文で成功した書込 API リクエストの index(0 始まり)。 */
182
+ chunkIndex: number;
183
+ /** 単一キー UPSERT でキー値を payload から特定できる場合のみ設定される。 */
184
+ lastKeyValue?: string;
164
185
  }
165
186
  declare const executionContextBrand: unique symbol;
166
187
  /** Opaque, sequential-only statement execution handle. */
@@ -195,6 +216,30 @@ export interface ExecutionMetrics {
195
216
  limitReachedApps: number[];
196
217
  elapsedMs: number;
197
218
  }
219
+ export interface FlowInsertResult {
220
+ type: "INSERT";
221
+ createdIds: string[][];
222
+ insertedCount: number;
223
+ }
224
+ export interface FlowUpdateResult {
225
+ type: "UPDATE";
226
+ updatedCount: number;
227
+ }
228
+ export interface FlowDeleteResult {
229
+ type: "DELETE";
230
+ deletedCount: number;
231
+ }
232
+ export interface FlowUpsertResult {
233
+ type: "UPSERT";
234
+ insertedCount: number;
235
+ updatedCount: number;
236
+ }
237
+ /**
238
+ * /flow が安定契約とする通常 DML 結果。
239
+ * 実体に APPLY / IMPORT 系の任意フィールドが載っていても、それらはこの契約の対象外。
240
+ */
241
+ export type FlowDmlResult = FlowInsertResult | FlowUpdateResult | FlowDeleteResult | FlowUpsertResult;
242
+ export declare function isDmlResult(result: unknown): result is FlowDmlResult;
198
243
  export type StatementResultKind = "STATEMENT" | "ASSERT_PASSED" | "ASSERT_WARNING" | "ASSERT_VIOLATION" | "EXIT_NO_DATA";
199
244
  export interface StatementResult {
200
245
  index: number;
@@ -206,8 +251,39 @@ export interface StatementResult {
206
251
  rowCount?: number;
207
252
  error?: StatementError;
208
253
  skippedReason?: string;
254
+ /** コンテキスト開始から当該文終了時までの累積 deep-copy スナップショット。文単位値は前回との差分で求める。 */
209
255
  metrics: ExecutionMetrics;
210
256
  }
257
+ export interface PreviewStatementOptions {
258
+ /** Number of write-order samples to return. Defaults to 5. */
259
+ maxSamples?: number;
260
+ }
261
+ export interface PreviewSample {
262
+ kind: "insert" | "update" | "delete";
263
+ /** UPSERT key, or the kintone record ID for DELETE. */
264
+ key?: string;
265
+ /** Current values of assignment target fields only. */
266
+ before?: Record<string, string>;
267
+ /** Values that the DML statement would write. */
268
+ after?: Record<string, string>;
269
+ }
270
+ export interface PreviewResult {
271
+ kind: "PREVIEW";
272
+ operation: "INSERT" | "UPDATE" | "DELETE" | "UPSERT";
273
+ /** Physical kintone app ID after logical-app routing. */
274
+ appId: number;
275
+ counts: {
276
+ insert: number;
277
+ update: number;
278
+ delete: number;
279
+ };
280
+ /** First maxSamples entries in actual write order. */
281
+ samples: PreviewSample[];
282
+ /** Record-read API calls consumed by this preview. */
283
+ reads: number;
284
+ /** Estimated 100-record write API calls for an ordinary execution. */
285
+ estimatedWrites: number;
286
+ }
211
287
  export interface CreateKintoneClientConfig {
212
288
  baseUrl: string;
213
289
  guestSpaceId?: number;