@rex0220/kintone-sql-tools 3.68.0 → 3.70.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/README.md +38 -0
- package/dist-cli/ksql.js +330 -64
- package/dist-engine/index.cjs +16 -16
- package/dist-engine/index.mjs +16 -16
- package/dist-engine/ksql-engine.umd.js +16 -16
- package/dist-engine/meta/bundle-baseline.json +10 -10
- package/dist-engine/meta/cjs.json +100 -43
- package/dist-engine/meta/esm.json +100 -43
- package/dist-engine/meta/umd.json +100 -43
- package/dist-flow/flow-library/errors.d.ts +6 -0
- package/dist-flow/flow-library/index.d.ts +13 -0
- package/dist-flow/flow-library/publicTypes.d.ts +271 -0
- package/dist-flow/flow-library/writableClient.d.ts +2 -0
- package/dist-flow/index.cjs +18 -0
- package/dist-flow/index.mjs +18 -0
- package/dist-flow/meta/cjs.json +2346 -0
- package/dist-flow/meta/esm.json +2357 -0
- package/dist-flow/types/ast.d.ts +881 -0
- package/dist-mcp/ksql-mcp.js +686 -162
- package/dist-mcpb/ksql-mcp.mcpb +0 -0
- package/package.json +12 -3
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"format": "esm"
|
|
12
12
|
},
|
|
13
13
|
"src/types/ast.ts": {
|
|
14
|
-
"bytes":
|
|
14
|
+
"bytes": 38224,
|
|
15
15
|
"imports": [
|
|
16
16
|
{
|
|
17
17
|
"path": "src/core/exactDecimal.ts",
|
|
@@ -420,8 +420,13 @@
|
|
|
420
420
|
],
|
|
421
421
|
"format": "esm"
|
|
422
422
|
},
|
|
423
|
+
"src/core/asOfClock.ts": {
|
|
424
|
+
"bytes": 2891,
|
|
425
|
+
"imports": [],
|
|
426
|
+
"format": "esm"
|
|
427
|
+
},
|
|
423
428
|
"src/core/batch.ts": {
|
|
424
|
-
"bytes":
|
|
429
|
+
"bytes": 21010,
|
|
425
430
|
"imports": [
|
|
426
431
|
{
|
|
427
432
|
"path": "src/core/dmlGuard.ts",
|
|
@@ -452,6 +457,11 @@
|
|
|
452
457
|
"path": "src/core/groupingValidation.ts",
|
|
453
458
|
"kind": "import-statement",
|
|
454
459
|
"original": "./groupingValidation"
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
"path": "src/core/asOfClock.ts",
|
|
463
|
+
"kind": "import-statement",
|
|
464
|
+
"original": "./asOfClock"
|
|
455
465
|
}
|
|
456
466
|
],
|
|
457
467
|
"format": "esm"
|
|
@@ -473,7 +483,7 @@
|
|
|
473
483
|
"format": "esm"
|
|
474
484
|
},
|
|
475
485
|
"src/parser/parser.ts": {
|
|
476
|
-
"bytes":
|
|
486
|
+
"bytes": 217567,
|
|
477
487
|
"imports": [
|
|
478
488
|
{
|
|
479
489
|
"path": "src/lexer/tokens.ts",
|
|
@@ -490,6 +500,11 @@
|
|
|
490
500
|
"kind": "import-statement",
|
|
491
501
|
"original": "../core/grouping"
|
|
492
502
|
},
|
|
503
|
+
{
|
|
504
|
+
"path": "src/core/asOfClock.ts",
|
|
505
|
+
"kind": "import-statement",
|
|
506
|
+
"original": "../core/asOfClock"
|
|
507
|
+
},
|
|
493
508
|
{
|
|
494
509
|
"path": "src/core/aggregateExpression.ts",
|
|
495
510
|
"kind": "import-statement",
|
|
@@ -1144,7 +1159,7 @@
|
|
|
1144
1159
|
"format": "esm"
|
|
1145
1160
|
},
|
|
1146
1161
|
"src/core/diagnostics.ts": {
|
|
1147
|
-
"bytes":
|
|
1162
|
+
"bytes": 1804,
|
|
1148
1163
|
"imports": [],
|
|
1149
1164
|
"format": "esm"
|
|
1150
1165
|
},
|
|
@@ -1159,6 +1174,53 @@
|
|
|
1159
1174
|
],
|
|
1160
1175
|
"format": "esm"
|
|
1161
1176
|
},
|
|
1177
|
+
"src/core/sql.ts": {
|
|
1178
|
+
"bytes": 1991,
|
|
1179
|
+
"imports": [
|
|
1180
|
+
{
|
|
1181
|
+
"path": "src/lexer/lexer.ts",
|
|
1182
|
+
"kind": "import-statement",
|
|
1183
|
+
"original": "../lexer/lexer"
|
|
1184
|
+
},
|
|
1185
|
+
{
|
|
1186
|
+
"path": "src/parser/parser.ts",
|
|
1187
|
+
"kind": "import-statement",
|
|
1188
|
+
"original": "../parser/parser"
|
|
1189
|
+
},
|
|
1190
|
+
{
|
|
1191
|
+
"path": "src/core/scriptHeader.ts",
|
|
1192
|
+
"kind": "import-statement",
|
|
1193
|
+
"original": "./scriptHeader"
|
|
1194
|
+
},
|
|
1195
|
+
{
|
|
1196
|
+
"path": "src/core/statementValidation.ts",
|
|
1197
|
+
"kind": "import-statement",
|
|
1198
|
+
"original": "./statementValidation"
|
|
1199
|
+
}
|
|
1200
|
+
],
|
|
1201
|
+
"format": "esm"
|
|
1202
|
+
},
|
|
1203
|
+
"src/core/dialect1Validation.ts": {
|
|
1204
|
+
"bytes": 6720,
|
|
1205
|
+
"imports": [
|
|
1206
|
+
{
|
|
1207
|
+
"path": "src/core/relativeDateFunction.ts",
|
|
1208
|
+
"kind": "import-statement",
|
|
1209
|
+
"original": "./relativeDateFunction"
|
|
1210
|
+
},
|
|
1211
|
+
{
|
|
1212
|
+
"path": "src/core/optimization/relativeDateFullScanExactPlan.ts",
|
|
1213
|
+
"kind": "import-statement",
|
|
1214
|
+
"original": "./optimization/relativeDateFullScanExactPlan"
|
|
1215
|
+
},
|
|
1216
|
+
{
|
|
1217
|
+
"path": "src/core/diagnostics.ts",
|
|
1218
|
+
"kind": "import-statement",
|
|
1219
|
+
"original": "./diagnostics"
|
|
1220
|
+
}
|
|
1221
|
+
],
|
|
1222
|
+
"format": "esm"
|
|
1223
|
+
},
|
|
1162
1224
|
"src/core/dmlPrevalidation.ts": {
|
|
1163
1225
|
"bytes": 3780,
|
|
1164
1226
|
"imports": [],
|
|
@@ -1384,7 +1446,7 @@
|
|
|
1384
1446
|
"format": "esm"
|
|
1385
1447
|
},
|
|
1386
1448
|
"src/execute.ts": {
|
|
1387
|
-
"bytes":
|
|
1449
|
+
"bytes": 593690,
|
|
1388
1450
|
"imports": [
|
|
1389
1451
|
{
|
|
1390
1452
|
"path": "src/lexer/lexer.ts",
|
|
@@ -1647,9 +1709,19 @@
|
|
|
1647
1709
|
"original": "./engine/evalFunc"
|
|
1648
1710
|
},
|
|
1649
1711
|
{
|
|
1650
|
-
"path": "src/core/
|
|
1712
|
+
"path": "src/core/sql.ts",
|
|
1651
1713
|
"kind": "import-statement",
|
|
1652
|
-
"original": "./core/
|
|
1714
|
+
"original": "./core/sql"
|
|
1715
|
+
},
|
|
1716
|
+
{
|
|
1717
|
+
"path": "src/core/asOfClock.ts",
|
|
1718
|
+
"kind": "import-statement",
|
|
1719
|
+
"original": "./core/asOfClock"
|
|
1720
|
+
},
|
|
1721
|
+
{
|
|
1722
|
+
"path": "src/core/dialect1Validation.ts",
|
|
1723
|
+
"kind": "import-statement",
|
|
1724
|
+
"original": "./core/dialect1Validation"
|
|
1653
1725
|
},
|
|
1654
1726
|
{
|
|
1655
1727
|
"path": "src/core/dmlValidationCandidates.ts",
|
|
@@ -1938,27 +2010,6 @@
|
|
|
1938
2010
|
],
|
|
1939
2011
|
"format": "esm"
|
|
1940
2012
|
},
|
|
1941
|
-
"src/core/sql.ts": {
|
|
1942
|
-
"bytes": 867,
|
|
1943
|
-
"imports": [
|
|
1944
|
-
{
|
|
1945
|
-
"path": "src/lexer/lexer.ts",
|
|
1946
|
-
"kind": "import-statement",
|
|
1947
|
-
"original": "../lexer/lexer"
|
|
1948
|
-
},
|
|
1949
|
-
{
|
|
1950
|
-
"path": "src/parser/parser.ts",
|
|
1951
|
-
"kind": "import-statement",
|
|
1952
|
-
"original": "../parser/parser"
|
|
1953
|
-
},
|
|
1954
|
-
{
|
|
1955
|
-
"path": "src/core/statementValidation.ts",
|
|
1956
|
-
"kind": "import-statement",
|
|
1957
|
-
"original": "./statementValidation"
|
|
1958
|
-
}
|
|
1959
|
-
],
|
|
1960
|
-
"format": "esm"
|
|
1961
|
-
},
|
|
1962
2013
|
"src/core/applyGuard.ts": {
|
|
1963
2014
|
"bytes": 638,
|
|
1964
2015
|
"imports": [],
|
|
@@ -2151,10 +2202,10 @@
|
|
|
2151
2202
|
"bytesInOutput": 303
|
|
2152
2203
|
},
|
|
2153
2204
|
"src/core/grouping.ts": {
|
|
2154
|
-
"bytesInOutput":
|
|
2205
|
+
"bytesInOutput": 1280
|
|
2155
2206
|
},
|
|
2156
2207
|
"src/core/dmlGuard.ts": {
|
|
2157
|
-
"bytesInOutput":
|
|
2208
|
+
"bytesInOutput": 3460
|
|
2158
2209
|
},
|
|
2159
2210
|
"src/core/relativeDateFunction.ts": {
|
|
2160
2211
|
"bytesInOutput": 451
|
|
@@ -2184,13 +2235,13 @@
|
|
|
2184
2235
|
"bytesInOutput": 3124
|
|
2185
2236
|
},
|
|
2186
2237
|
"src/core/aggregateDependencyValidation.ts": {
|
|
2187
|
-
"bytesInOutput":
|
|
2238
|
+
"bytesInOutput": 8228
|
|
2188
2239
|
},
|
|
2189
2240
|
"src/core/groupingValidation.ts": {
|
|
2190
|
-
"bytesInOutput":
|
|
2241
|
+
"bytesInOutput": 3811
|
|
2191
2242
|
},
|
|
2192
2243
|
"src/converter/selectToKintone.ts": {
|
|
2193
|
-
"bytesInOutput":
|
|
2244
|
+
"bytesInOutput": 10148
|
|
2194
2245
|
},
|
|
2195
2246
|
"src/core/cteInlining.ts": {
|
|
2196
2247
|
"bytesInOutput": 1224
|
|
@@ -2234,8 +2285,11 @@
|
|
|
2234
2285
|
"src/core/statementValidation.ts": {
|
|
2235
2286
|
"bytesInOutput": 239
|
|
2236
2287
|
},
|
|
2288
|
+
"src/core/asOfClock.ts": {
|
|
2289
|
+
"bytesInOutput": 1162
|
|
2290
|
+
},
|
|
2237
2291
|
"src/core/batch.ts": {
|
|
2238
|
-
"bytesInOutput":
|
|
2292
|
+
"bytesInOutput": 6386
|
|
2239
2293
|
},
|
|
2240
2294
|
"src/lexer/tokens.ts": {
|
|
2241
2295
|
"bytesInOutput": 2328
|
|
@@ -2244,7 +2298,7 @@
|
|
|
2244
2298
|
"bytesInOutput": 5906
|
|
2245
2299
|
},
|
|
2246
2300
|
"src/parser/parser.ts": {
|
|
2247
|
-
"bytesInOutput":
|
|
2301
|
+
"bytesInOutput": 128344
|
|
2248
2302
|
},
|
|
2249
2303
|
"src/core/scalarCompare.ts": {
|
|
2250
2304
|
"bytesInOutput": 2804
|
|
@@ -2322,7 +2376,7 @@
|
|
|
2322
2376
|
"bytesInOutput": 122
|
|
2323
2377
|
},
|
|
2324
2378
|
"src/core/explainMetadata.ts": {
|
|
2325
|
-
"bytesInOutput":
|
|
2379
|
+
"bytesInOutput": 627
|
|
2326
2380
|
},
|
|
2327
2381
|
"src/core/optimization/sharedPlanner.ts": {
|
|
2328
2382
|
"bytesInOutput": 339
|
|
@@ -2352,17 +2406,23 @@
|
|
|
2352
2406
|
"bytesInOutput": 1223
|
|
2353
2407
|
},
|
|
2354
2408
|
"src/engine/process.ts": {
|
|
2355
|
-
"bytesInOutput":
|
|
2409
|
+
"bytesInOutput": 27972
|
|
2356
2410
|
},
|
|
2357
2411
|
"src/converter/subtableAdapter.ts": {
|
|
2358
2412
|
"bytesInOutput": 643
|
|
2359
2413
|
},
|
|
2360
2414
|
"src/core/diagnostics.ts": {
|
|
2361
|
-
"bytesInOutput":
|
|
2415
|
+
"bytesInOutput": 755
|
|
2362
2416
|
},
|
|
2363
2417
|
"src/core/scriptHeader.ts": {
|
|
2364
2418
|
"bytesInOutput": 1831
|
|
2365
2419
|
},
|
|
2420
|
+
"src/core/sql.ts": {
|
|
2421
|
+
"bytesInOutput": 492
|
|
2422
|
+
},
|
|
2423
|
+
"src/core/dialect1Validation.ts": {
|
|
2424
|
+
"bytesInOutput": 3025
|
|
2425
|
+
},
|
|
2366
2426
|
"src/core/dmlPrevalidation.ts": {
|
|
2367
2427
|
"bytesInOutput": 1136
|
|
2368
2428
|
},
|
|
@@ -2418,7 +2478,7 @@
|
|
|
2418
2478
|
"bytesInOutput": 412
|
|
2419
2479
|
},
|
|
2420
2480
|
"src/execute.ts": {
|
|
2421
|
-
"bytesInOutput":
|
|
2481
|
+
"bytesInOutput": 235779
|
|
2422
2482
|
},
|
|
2423
2483
|
"src/engine-library/errors.ts": {
|
|
2424
2484
|
"bytesInOutput": 1441
|
|
@@ -2462,9 +2522,6 @@
|
|
|
2462
2522
|
"src/engine-library/resultMapping.ts": {
|
|
2463
2523
|
"bytesInOutput": 903
|
|
2464
2524
|
},
|
|
2465
|
-
"src/core/sql.ts": {
|
|
2466
|
-
"bytesInOutput": 186
|
|
2467
|
-
},
|
|
2468
2525
|
"src/core/applyGuard.ts": {
|
|
2469
2526
|
"bytesInOutput": 236
|
|
2470
2527
|
},
|
|
@@ -2487,7 +2544,7 @@
|
|
|
2487
2544
|
"bytesInOutput": 127
|
|
2488
2545
|
}
|
|
2489
2546
|
},
|
|
2490
|
-
"bytes":
|
|
2547
|
+
"bytes": 680623
|
|
2491
2548
|
}
|
|
2492
2549
|
}
|
|
2493
2550
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createKintoneClient } from "./writableClient";
|
|
2
|
+
import { KsqlFlowError } from "./errors";
|
|
3
|
+
import type { CreateExecutionContextOptions, Diagnostic, ExecutionContext, ExplainScriptOptions, ExplainScriptResult, ParseScriptOptions, ParseScriptResult, Statement, StatementResult, ValidateScriptOptions } from "./publicTypes";
|
|
4
|
+
export declare const version: string;
|
|
5
|
+
export declare function parseScript(source: string, opts?: ParseScriptOptions): ParseScriptResult;
|
|
6
|
+
export declare function validateScript(source: string, opts?: ValidateScriptOptions): Promise<Diagnostic[]>;
|
|
7
|
+
export declare function explainScript(source: string, opts: ExplainScriptOptions): Promise<ExplainScriptResult>;
|
|
8
|
+
export declare function createExecutionContext(opts: CreateExecutionContextOptions): ExecutionContext;
|
|
9
|
+
export declare function executeStatement(statement: Statement, context: ExecutionContext): Promise<StatementResult>;
|
|
10
|
+
export declare function disposeExecutionContext(context: ExecutionContext): Promise<void>;
|
|
11
|
+
export { isDmlResult } from "./publicTypes";
|
|
12
|
+
export { createKintoneClient, KsqlFlowError };
|
|
13
|
+
export type { CreateExecutionContextOptions, CreateKintoneClientConfig, Diagnostic, DiagnosticCode, ExecutionContext, ExplainScriptOptions, ExplainScriptResult, FieldInfo, FlowChunkWrittenInfo, FlowDeleteResult, FlowDmlResult, FlowInsertResult, FlowKintoneClient, FlowUpdateResult, FlowUpsertResult, ParseScriptOptions, ParseScriptResult, SchemaResolver, ScriptHeaderMeta, Statement, StatementResult, StatementResultKind, ValidateScriptOptions, } from "./publicTypes";
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import type { Statement } from "../types/ast";
|
|
2
|
+
export type { Statement };
|
|
3
|
+
export type DiagnosticCode = "KSQL1001" | "KSQL1002" | "KSQL1003" | "KSQL1004" | "KSQL1005" | "KSQL1006" | "KSQL1101" | "KSQL1201" | "KSQL1202" | "KSQL1203" | "KSQL1301" | "KSQL1302" | "KSQL1303" | "KSQL1304" | "KSQL1305" | "KSQL1306";
|
|
4
|
+
export interface Diagnostic {
|
|
5
|
+
severity: "error" | "warning";
|
|
6
|
+
code: DiagnosticCode;
|
|
7
|
+
message: string;
|
|
8
|
+
line: number;
|
|
9
|
+
column: number;
|
|
10
|
+
statementIndex?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface ScriptHeaderMeta {
|
|
13
|
+
name: string | null;
|
|
14
|
+
dependsOn: string[];
|
|
15
|
+
timeout: number | null;
|
|
16
|
+
dialect: 0 | 1;
|
|
17
|
+
}
|
|
18
|
+
export interface FieldInfo {
|
|
19
|
+
code: string;
|
|
20
|
+
label: string;
|
|
21
|
+
fieldType: string;
|
|
22
|
+
optionOrder?: Record<string, number>;
|
|
23
|
+
sortKind?: "number" | "string";
|
|
24
|
+
required?: boolean;
|
|
25
|
+
minValue?: string;
|
|
26
|
+
maxValue?: string;
|
|
27
|
+
minLength?: string;
|
|
28
|
+
maxLength?: string;
|
|
29
|
+
defaultValue?: unknown;
|
|
30
|
+
hasLookup?: boolean;
|
|
31
|
+
isLookupCopyTarget?: boolean;
|
|
32
|
+
isUnique?: boolean;
|
|
33
|
+
isCalculated?: boolean;
|
|
34
|
+
inSubtable?: boolean;
|
|
35
|
+
writable?: boolean;
|
|
36
|
+
subtableCode?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface KintoneRecordValue {
|
|
39
|
+
value: string | string[] | Array<{
|
|
40
|
+
code: string;
|
|
41
|
+
}>;
|
|
42
|
+
}
|
|
43
|
+
export type KintoneRecord = Record<string, KintoneRecordValue>;
|
|
44
|
+
export interface FlowKintoneClient {
|
|
45
|
+
getRecords(params: {
|
|
46
|
+
app: number;
|
|
47
|
+
query: string;
|
|
48
|
+
fields: string[];
|
|
49
|
+
totalCount?: boolean;
|
|
50
|
+
}): Promise<{
|
|
51
|
+
records: KintoneRecord[];
|
|
52
|
+
totalCount?: string;
|
|
53
|
+
searchAborted?: boolean;
|
|
54
|
+
}>;
|
|
55
|
+
openCursor(params: {
|
|
56
|
+
app: number;
|
|
57
|
+
fields?: string[];
|
|
58
|
+
query: string;
|
|
59
|
+
size: 500;
|
|
60
|
+
}): Promise<{
|
|
61
|
+
readonly totalCount: number;
|
|
62
|
+
nextPage(): Promise<{
|
|
63
|
+
records: KintoneRecord[];
|
|
64
|
+
next: boolean;
|
|
65
|
+
}>;
|
|
66
|
+
close(): Promise<void>;
|
|
67
|
+
}>;
|
|
68
|
+
postRecords(params: {
|
|
69
|
+
app: number;
|
|
70
|
+
records: KintoneRecord[];
|
|
71
|
+
}): Promise<{
|
|
72
|
+
ids: string[];
|
|
73
|
+
}>;
|
|
74
|
+
putRecords(params: {
|
|
75
|
+
app: number;
|
|
76
|
+
records: Array<{
|
|
77
|
+
id: number;
|
|
78
|
+
revision?: number;
|
|
79
|
+
record: KintoneRecord;
|
|
80
|
+
}>;
|
|
81
|
+
}): Promise<void>;
|
|
82
|
+
deleteRecords(params: {
|
|
83
|
+
app: number;
|
|
84
|
+
ids: number[];
|
|
85
|
+
}): Promise<void>;
|
|
86
|
+
getApps(): Promise<Array<{
|
|
87
|
+
appId: number;
|
|
88
|
+
name: string;
|
|
89
|
+
description: string;
|
|
90
|
+
}>>;
|
|
91
|
+
getFields(appId: number): Promise<FieldInfo[]>;
|
|
92
|
+
getNumberPrecision(appId: number): Promise<{
|
|
93
|
+
digits: number;
|
|
94
|
+
decimalPlaces: number;
|
|
95
|
+
roundingMode: "HALF_EVEN" | "UP" | "DOWN";
|
|
96
|
+
}>;
|
|
97
|
+
getProcessStatuses(appId: number): Promise<{
|
|
98
|
+
enable: boolean;
|
|
99
|
+
states: Array<{
|
|
100
|
+
name: string;
|
|
101
|
+
index: number;
|
|
102
|
+
}> | null;
|
|
103
|
+
}>;
|
|
104
|
+
}
|
|
105
|
+
export type SchemaResolver = (appId: number) => readonly FieldInfo[] | Promise<readonly FieldInfo[]>;
|
|
106
|
+
export interface ParseScriptOptions {
|
|
107
|
+
apps?: Readonly<Record<string, number>>;
|
|
108
|
+
}
|
|
109
|
+
export interface ParseScriptResult {
|
|
110
|
+
meta: ScriptHeaderMeta;
|
|
111
|
+
statements: Statement[];
|
|
112
|
+
statementRanges: Array<{
|
|
113
|
+
start: number;
|
|
114
|
+
end: number;
|
|
115
|
+
}>;
|
|
116
|
+
diagnostics: Diagnostic[];
|
|
117
|
+
}
|
|
118
|
+
export interface ValidateScriptOptions extends ParseScriptOptions {
|
|
119
|
+
strict?: boolean;
|
|
120
|
+
schema?: SchemaResolver;
|
|
121
|
+
client?: Pick<FlowKintoneClient, "getFields">;
|
|
122
|
+
}
|
|
123
|
+
export interface ExplainScriptOptions extends ParseScriptOptions {
|
|
124
|
+
client: FlowKintoneClient;
|
|
125
|
+
variables?: Readonly<Record<string, string>>;
|
|
126
|
+
/** dialect 1 の @ 付き時刻関数が共有する explain 呼出し単位の基準時刻。 */
|
|
127
|
+
asOf?: Date;
|
|
128
|
+
/** @TODAY() などの暦日境界に使う IANA timezone。省略時はホスト timezone。 */
|
|
129
|
+
timezone?: string;
|
|
130
|
+
maxRecords?: number;
|
|
131
|
+
cursorMaxActive?: number;
|
|
132
|
+
dmlMaxRows?: number;
|
|
133
|
+
dmlMaxSubtableRows?: number;
|
|
134
|
+
resolveMetadata?: boolean;
|
|
135
|
+
recursiveCteMaxDepth?: number;
|
|
136
|
+
recursiveCteMaxRows?: number;
|
|
137
|
+
recursiveCteMaxExpansions?: number;
|
|
138
|
+
}
|
|
139
|
+
export interface ExplainScriptResult {
|
|
140
|
+
statementCount: number;
|
|
141
|
+
statements: Array<{
|
|
142
|
+
index: number;
|
|
143
|
+
type: string;
|
|
144
|
+
plan: string[];
|
|
145
|
+
}>;
|
|
146
|
+
}
|
|
147
|
+
export interface CreateExecutionContextOptions extends ParseScriptOptions {
|
|
148
|
+
client: FlowKintoneClient;
|
|
149
|
+
script?: string;
|
|
150
|
+
statements?: readonly Statement[];
|
|
151
|
+
meta?: ScriptHeaderMeta;
|
|
152
|
+
variables?: Readonly<Record<string, string>>;
|
|
153
|
+
maxRecords?: number;
|
|
154
|
+
recursiveCteMaxDepth?: number;
|
|
155
|
+
recursiveCteMaxRows?: number;
|
|
156
|
+
recursiveCteMaxExpansions?: number;
|
|
157
|
+
onLimitReached?: "error" | "truncate";
|
|
158
|
+
fetchParallel?: number;
|
|
159
|
+
cacheContext?: string;
|
|
160
|
+
cursorMaxActive?: number;
|
|
161
|
+
dmlMaxRows?: number;
|
|
162
|
+
dmlMaxSubtableRows?: number;
|
|
163
|
+
tempTableMaxRows?: number;
|
|
164
|
+
timeoutMs?: number;
|
|
165
|
+
asOf?: Date;
|
|
166
|
+
timezone?: string;
|
|
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;
|
|
185
|
+
}
|
|
186
|
+
declare const executionContextBrand: unique symbol;
|
|
187
|
+
/** Opaque, sequential-only statement execution handle. */
|
|
188
|
+
export interface ExecutionContext {
|
|
189
|
+
readonly [executionContextBrand]: true;
|
|
190
|
+
}
|
|
191
|
+
export interface StatementError {
|
|
192
|
+
code: string;
|
|
193
|
+
message: string;
|
|
194
|
+
readonly cause?: unknown;
|
|
195
|
+
}
|
|
196
|
+
export interface ExecutionMetrics {
|
|
197
|
+
getCalls: number;
|
|
198
|
+
postCalls: number;
|
|
199
|
+
putCalls: number;
|
|
200
|
+
deleteCalls: number;
|
|
201
|
+
fieldCalls: number;
|
|
202
|
+
numberPrecisionCalls: number;
|
|
203
|
+
appsCalls: number;
|
|
204
|
+
processStatusCalls: number;
|
|
205
|
+
cursorCreateCalls: number;
|
|
206
|
+
cursorGetCalls: number;
|
|
207
|
+
cursorDeleteCalls: number;
|
|
208
|
+
cursorRecordsScanned: number;
|
|
209
|
+
cursorActiveCurrent: number;
|
|
210
|
+
cursorActivePeak: number;
|
|
211
|
+
cursorCleanupFailures: number;
|
|
212
|
+
cursorCreateOutcomeUnknown: number;
|
|
213
|
+
cursorQuarantinedCurrent: number;
|
|
214
|
+
fetchedRows: number;
|
|
215
|
+
limitReached: boolean;
|
|
216
|
+
limitReachedApps: number[];
|
|
217
|
+
elapsedMs: number;
|
|
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;
|
|
243
|
+
export type StatementResultKind = "STATEMENT" | "ASSERT_PASSED" | "ASSERT_WARNING" | "ASSERT_VIOLATION" | "EXIT_NO_DATA";
|
|
244
|
+
export interface StatementResult {
|
|
245
|
+
index: number;
|
|
246
|
+
type: string;
|
|
247
|
+
status: "success" | "error" | "skipped";
|
|
248
|
+
kind: StatementResultKind;
|
|
249
|
+
result?: unknown;
|
|
250
|
+
tempTable?: string;
|
|
251
|
+
rowCount?: number;
|
|
252
|
+
error?: StatementError;
|
|
253
|
+
skippedReason?: string;
|
|
254
|
+
/** コンテキスト開始から当該文終了時までの累積 deep-copy スナップショット。文単位値は前回との差分で求める。 */
|
|
255
|
+
metrics: ExecutionMetrics;
|
|
256
|
+
}
|
|
257
|
+
export interface CreateKintoneClientConfig {
|
|
258
|
+
baseUrl: string;
|
|
259
|
+
guestSpaceId?: number;
|
|
260
|
+
auth: {
|
|
261
|
+
type: "apiToken";
|
|
262
|
+
apiToken: string | ((appId: number) => string);
|
|
263
|
+
} | {
|
|
264
|
+
type: "password";
|
|
265
|
+
username: string;
|
|
266
|
+
password: string;
|
|
267
|
+
};
|
|
268
|
+
fetch?: typeof globalThis.fetch;
|
|
269
|
+
timeoutMs?: number;
|
|
270
|
+
cursorMaxActive?: number;
|
|
271
|
+
}
|