@rex0220/kintone-sql-tools 3.27.0 → 3.29.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.
@@ -95,7 +95,7 @@
95
95
  "format": "esm"
96
96
  },
97
97
  "src/core/dmlGuard.ts": {
98
- "bytes": 8488,
98
+ "bytes": 9379,
99
99
  "imports": [
100
100
  {
101
101
  "path": "src/types/ast.ts",
@@ -232,8 +232,19 @@
232
232
  ],
233
233
  "format": "esm"
234
234
  },
235
+ "src/core/optimization/relativeDateFullScanExactPlan.ts": {
236
+ "bytes": 7609,
237
+ "imports": [
238
+ {
239
+ "path": "src/core/relativeDateFunction.ts",
240
+ "kind": "import-statement",
241
+ "original": "../relativeDateFunction"
242
+ }
243
+ ],
244
+ "format": "esm"
245
+ },
235
246
  "src/core/klikeValidation.ts": {
236
- "bytes": 11325,
247
+ "bytes": 12296,
237
248
  "imports": [
238
249
  {
239
250
  "path": "src/converter/selectToKintone.ts",
@@ -255,6 +266,11 @@
255
266
  "kind": "import-statement",
256
267
  "original": "./optimization/klikePushdownPlan"
257
268
  },
269
+ {
270
+ "path": "src/core/optimization/relativeDateFullScanExactPlan.ts",
271
+ "kind": "import-statement",
272
+ "original": "./optimization/relativeDateFullScanExactPlan"
273
+ },
258
274
  {
259
275
  "path": "src/core/applyPatchScope.ts",
260
276
  "kind": "import-statement",
@@ -755,7 +771,7 @@
755
771
  "format": "esm"
756
772
  },
757
773
  "src/core/optimization/joinPredicatePushdown.ts": {
758
- "bytes": 19803,
774
+ "bytes": 40818,
759
775
  "imports": [
760
776
  {
761
777
  "path": "src/types/ast.ts",
@@ -777,6 +793,16 @@
777
793
  "kind": "import-statement",
778
794
  "original": "../like"
779
795
  },
796
+ {
797
+ "path": "src/core/relativeDateFunction.ts",
798
+ "kind": "import-statement",
799
+ "original": "../relativeDateFunction"
800
+ },
801
+ {
802
+ "path": "src/core/optimization/relativeDateFullScanExactPlan.ts",
803
+ "kind": "import-statement",
804
+ "original": "./relativeDateFullScanExactPlan"
805
+ },
780
806
  {
781
807
  "path": "src/core/optimization/whereCapability.ts",
782
808
  "kind": "import-statement",
@@ -915,19 +941,8 @@
915
941
  "imports": [],
916
942
  "format": "esm"
917
943
  },
918
- "src/core/optimization/relativeDateFullScanExactPlan.ts": {
919
- "bytes": 7609,
920
- "imports": [
921
- {
922
- "path": "src/core/relativeDateFunction.ts",
923
- "kind": "import-statement",
924
- "original": "../relativeDateFunction"
925
- }
926
- ],
927
- "format": "esm"
928
- },
929
944
  "src/core/optimization/relativeDatePushdownGuard.ts": {
930
- "bytes": 21189,
945
+ "bytes": 22959,
931
946
  "imports": [
932
947
  {
933
948
  "path": "src/converter/selectToKintone.ts",
@@ -953,6 +968,11 @@
953
968
  "path": "src/core/optimization/relativeDateFullScanExactPlan.ts",
954
969
  "kind": "import-statement",
955
970
  "original": "./relativeDateFullScanExactPlan"
971
+ },
972
+ {
973
+ "path": "src/core/optimization/joinPredicatePushdown.ts",
974
+ "kind": "import-statement",
975
+ "original": "./joinPredicatePushdown"
956
976
  }
957
977
  ],
958
978
  "format": "esm"
@@ -1141,7 +1161,7 @@
1141
1161
  "format": "esm"
1142
1162
  },
1143
1163
  "src/execute.ts": {
1144
- "bytes": 446249,
1164
+ "bytes": 454115,
1145
1165
  "imports": [
1146
1166
  {
1147
1167
  "path": "src/lexer/lexer.ts",
@@ -1477,7 +1497,7 @@
1477
1497
  "format": "esm"
1478
1498
  },
1479
1499
  "src/engine-library/errors.ts": {
1480
- "bytes": 3031,
1500
+ "bytes": 3714,
1481
1501
  "imports": [
1482
1502
  {
1483
1503
  "path": "src/api/fetchAll.ts",
@@ -1603,10 +1623,21 @@
1603
1623
  "format": "esm"
1604
1624
  },
1605
1625
  "src/engine-library/options.ts": {
1606
- "bytes": 3253,
1626
+ "bytes": 5024,
1607
1627
  "imports": [],
1608
1628
  "format": "esm"
1609
1629
  },
1630
+ "src/engine-library/resultMapping.ts": {
1631
+ "bytes": 1867,
1632
+ "imports": [
1633
+ {
1634
+ "path": "src/execute.ts",
1635
+ "kind": "import-statement",
1636
+ "original": "../execute"
1637
+ }
1638
+ ],
1639
+ "format": "esm"
1640
+ },
1610
1641
  "src/core/sql.ts": {
1611
1642
  "bytes": 858,
1612
1643
  "imports": [
@@ -1628,14 +1659,29 @@
1628
1659
  ],
1629
1660
  "format": "esm"
1630
1661
  },
1662
+ "src/core/applyGuard.ts": {
1663
+ "bytes": 638,
1664
+ "imports": [],
1665
+ "format": "esm"
1666
+ },
1631
1667
  "src/engine-library/statementGuard.ts": {
1632
- "bytes": 3420,
1668
+ "bytes": 4597,
1633
1669
  "imports": [
1634
1670
  {
1635
1671
  "path": "src/core/sql.ts",
1636
1672
  "kind": "import-statement",
1637
1673
  "original": "../core/sql"
1638
1674
  },
1675
+ {
1676
+ "path": "src/core/applyGuard.ts",
1677
+ "kind": "import-statement",
1678
+ "original": "../core/applyGuard"
1679
+ },
1680
+ {
1681
+ "path": "src/core/dmlGuard.ts",
1682
+ "kind": "import-statement",
1683
+ "original": "../core/dmlGuard"
1684
+ },
1639
1685
  {
1640
1686
  "path": "src/core/klikeValidation.ts",
1641
1687
  "kind": "import-statement",
@@ -1649,8 +1695,49 @@
1649
1695
  ],
1650
1696
  "format": "esm"
1651
1697
  },
1698
+ "src/engine-library/batch.ts": {
1699
+ "bytes": 3529,
1700
+ "imports": [
1701
+ {
1702
+ "path": "src/execute.ts",
1703
+ "kind": "import-statement",
1704
+ "original": "../execute"
1705
+ },
1706
+ {
1707
+ "path": "src/engine-library/errors.ts",
1708
+ "kind": "import-statement",
1709
+ "original": "./errors"
1710
+ },
1711
+ {
1712
+ "path": "src/engine-library/cursorScope.ts",
1713
+ "kind": "import-statement",
1714
+ "original": "./cursorScope"
1715
+ },
1716
+ {
1717
+ "path": "src/engine-library/options.ts",
1718
+ "kind": "import-statement",
1719
+ "original": "./options"
1720
+ },
1721
+ {
1722
+ "path": "src/engine-library/readonlyClient.ts",
1723
+ "kind": "import-statement",
1724
+ "original": "./readonlyClient"
1725
+ },
1726
+ {
1727
+ "path": "src/engine-library/resultMapping.ts",
1728
+ "kind": "import-statement",
1729
+ "original": "./resultMapping"
1730
+ },
1731
+ {
1732
+ "path": "src/engine-library/statementGuard.ts",
1733
+ "kind": "import-statement",
1734
+ "original": "./statementGuard"
1735
+ }
1736
+ ],
1737
+ "format": "esm"
1738
+ },
1652
1739
  "src/engine-library/query.ts": {
1653
- "bytes": 3614,
1740
+ "bytes": 2547,
1654
1741
  "imports": [
1655
1742
  {
1656
1743
  "path": "src/execute.ts",
@@ -1677,6 +1764,11 @@
1677
1764
  "kind": "import-statement",
1678
1765
  "original": "./readonlyClient"
1679
1766
  },
1767
+ {
1768
+ "path": "src/engine-library/resultMapping.ts",
1769
+ "kind": "import-statement",
1770
+ "original": "./resultMapping"
1771
+ },
1680
1772
  {
1681
1773
  "path": "src/engine-library/statementGuard.ts",
1682
1774
  "kind": "import-statement",
@@ -1686,7 +1778,7 @@
1686
1778
  "format": "esm"
1687
1779
  },
1688
1780
  "src/engine-library/index.ts": {
1689
- "bytes": 985,
1781
+ "bytes": 1101,
1690
1782
  "imports": [
1691
1783
  {
1692
1784
  "path": "src/engine-library/errors.ts",
@@ -1698,6 +1790,11 @@
1698
1790
  "kind": "import-statement",
1699
1791
  "original": "./browserClient"
1700
1792
  },
1793
+ {
1794
+ "path": "src/engine-library/batch.ts",
1795
+ "kind": "import-statement",
1796
+ "original": "./batch"
1797
+ },
1701
1798
  {
1702
1799
  "path": "src/engine-library/query.ts",
1703
1800
  "kind": "import-statement",
@@ -1707,12 +1804,12 @@
1707
1804
  "format": "esm"
1708
1805
  },
1709
1806
  "src/engine-library/versionRegistry.ts": {
1710
- "bytes": 2952,
1807
+ "bytes": 3002,
1711
1808
  "imports": [],
1712
1809
  "format": "esm"
1713
1810
  },
1714
1811
  "src/engine-library/umd.ts": {
1715
- "bytes": 509,
1812
+ "bytes": 529,
1716
1813
  "imports": [
1717
1814
  {
1718
1815
  "path": "src/engine-library/index.ts",
@@ -1750,7 +1847,7 @@
1750
1847
  "bytesInOutput": 139
1751
1848
  },
1752
1849
  "src/core/grouping.ts": {
1753
- "bytesInOutput": 1281
1850
+ "bytesInOutput": 1284
1754
1851
  },
1755
1852
  "src/core/aggregateExpression.ts": {
1756
1853
  "bytesInOutput": 2592
@@ -1762,7 +1859,7 @@
1762
1859
  "bytesInOutput": 92192
1763
1860
  },
1764
1861
  "src/core/dmlGuard.ts": {
1765
- "bytesInOutput": 1881
1862
+ "bytesInOutput": 2857
1766
1863
  },
1767
1864
  "src/core/applyPatchScope.ts": {
1768
1865
  "bytesInOutput": 12612
@@ -1777,7 +1874,7 @@
1777
1874
  "bytesInOutput": 5075
1778
1875
  },
1779
1876
  "src/converter/selectToKintone.ts": {
1780
- "bytesInOutput": 8913
1877
+ "bytesInOutput": 8915
1781
1878
  },
1782
1879
  "src/core/cteInlining.ts": {
1783
1880
  "bytesInOutput": 1224
@@ -1788,14 +1885,20 @@
1788
1885
  "src/core/optimization/klikePushdownPlan.ts": {
1789
1886
  "bytesInOutput": 1363
1790
1887
  },
1888
+ "src/core/optimization/relativeDateFullScanExactPlan.ts": {
1889
+ "bytesInOutput": 2474
1890
+ },
1791
1891
  "src/core/klikeValidation.ts": {
1792
- "bytesInOutput": 5843
1892
+ "bytesInOutput": 6076
1793
1893
  },
1794
1894
  "src/engine/groupingRowMeta.ts": {
1795
1895
  "bytesInOutput": 559
1796
1896
  },
1797
1897
  "src/core/groupingValidation.ts": {
1798
- "bytesInOutput": 5173
1898
+ "bytesInOutput": 5175
1899
+ },
1900
+ "src/core/batch.ts": {
1901
+ "bytesInOutput": 5499
1799
1902
  },
1800
1903
  "src/core/fieldSemantics.ts": {
1801
1904
  "bytesInOutput": 1368
@@ -1807,7 +1910,7 @@
1807
1910
  "bytesInOutput": 11162
1808
1911
  },
1809
1912
  "src/engine/evalWhere.ts": {
1810
- "bytesInOutput": 5516
1913
+ "bytesInOutput": 5752
1811
1914
  },
1812
1915
  "src/core/dmlCustomCheck.ts": {
1813
1916
  "bytesInOutput": 1250
@@ -1860,11 +1963,14 @@
1860
1963
  "src/core/applyUpsertExecutePrepared.ts": {
1861
1964
  "bytesInOutput": 1487
1862
1965
  },
1966
+ "src/core/batchVariables.ts": {
1967
+ "bytesInOutput": 667
1968
+ },
1863
1969
  "src/core/outerJoinSearchAbortGuard.ts": {
1864
1970
  "bytesInOutput": 366
1865
1971
  },
1866
1972
  "src/core/explainMetadata.ts": {
1867
- "bytesInOutput": 626
1973
+ "bytesInOutput": 627
1868
1974
  },
1869
1975
  "src/core/optimization/sharedPlanner.ts": {
1870
1976
  "bytesInOutput": 339
@@ -1873,7 +1979,7 @@
1873
1979
  "bytesInOutput": 9013
1874
1980
  },
1875
1981
  "src/core/optimization/joinPredicatePushdown.ts": {
1876
- "bytesInOutput": 6428
1982
+ "bytesInOutput": 13814
1877
1983
  },
1878
1984
  "src/core/optimization/applyParentSelectionPlan.ts": {
1879
1985
  "bytesInOutput": 246
@@ -1900,7 +2006,7 @@
1900
2006
  "bytesInOutput": 2656
1901
2007
  },
1902
2008
  "src/engine/process.ts": {
1903
- "bytesInOutput": 19953
2009
+ "bytesInOutput": 19954
1904
2010
  },
1905
2011
  "src/converter/subtableAdapter.ts": {
1906
2012
  "bytesInOutput": 643
@@ -1908,11 +2014,8 @@
1908
2014
  "src/core/dmlPrevalidation.ts": {
1909
2015
  "bytesInOutput": 1136
1910
2016
  },
1911
- "src/core/optimization/relativeDateFullScanExactPlan.ts": {
1912
- "bytesInOutput": 2474
1913
- },
1914
2017
  "src/core/optimization/relativeDatePushdownGuard.ts": {
1915
- "bytesInOutput": 5813
2018
+ "bytesInOutput": 6253
1916
2019
  },
1917
2020
  "src/core/optimization/relativeDatePrefilterPlan.ts": {
1918
2021
  "bytesInOutput": 4827
@@ -1963,10 +2066,10 @@
1963
2066
  "bytesInOutput": 412
1964
2067
  },
1965
2068
  "src/execute.ts": {
1966
- "bytesInOutput": 160291
2069
+ "bytesInOutput": 173320
1967
2070
  },
1968
2071
  "src/engine-library/errors.ts": {
1969
- "bytesInOutput": 1116
2072
+ "bytesInOutput": 1306
1970
2073
  },
1971
2074
  "src/api/cursorLeaseManager.ts": {
1972
2075
  "bytesInOutput": 1777
@@ -1993,16 +2096,25 @@
1993
2096
  "bytesInOutput": 766
1994
2097
  },
1995
2098
  "src/engine-library/options.ts": {
1996
- "bytesInOutput": 1584
2099
+ "bytesInOutput": 2212
2100
+ },
2101
+ "src/engine-library/resultMapping.ts": {
2102
+ "bytesInOutput": 777
1997
2103
  },
1998
2104
  "src/core/sql.ts": {
1999
- "bytesInOutput": 84
2105
+ "bytesInOutput": 186
2106
+ },
2107
+ "src/core/applyGuard.ts": {
2108
+ "bytesInOutput": 236
2000
2109
  },
2001
2110
  "src/engine-library/statementGuard.ts": {
2002
- "bytesInOutput": 1082
2111
+ "bytesInOutput": 1704
2112
+ },
2113
+ "src/engine-library/batch.ts": {
2114
+ "bytesInOutput": 896
2003
2115
  },
2004
2116
  "src/engine-library/query.ts": {
2005
- "bytesInOutput": 1231
2117
+ "bytesInOutput": 603
2006
2118
  },
2007
2119
  "src/engine-library/index.ts": {
2008
2120
  "bytesInOutput": 16
@@ -2011,10 +2123,10 @@
2011
2123
  "bytesInOutput": 1000
2012
2124
  },
2013
2125
  "src/engine-library/umd.ts": {
2014
- "bytesInOutput": 115
2126
+ "bytesInOutput": 127
2015
2127
  }
2016
2128
  },
2017
- "bytes": 493295
2129
+ "bytes": 524605
2018
2130
  }
2019
2131
  }
2020
2132
  }
@@ -69,6 +69,33 @@ export interface RunQueryOptions {
69
69
  fetchParallel?: number;
70
70
  cursorMaxActive?: number;
71
71
  }
72
+ /**
73
+ * Options for one read-only runBatch invocation.
74
+ *
75
+ * Temporary tables and variables exist only for that invocation. A batch is
76
+ * fail-closed: any failed statement makes runBatch throw instead of returning
77
+ * a partial BatchResult.
78
+ */
79
+ export interface RunBatchOptions {
80
+ client: ReadonlyKintoneClient;
81
+ maxRecords?: number;
82
+ onLimitReached?: "error" | "truncate";
83
+ fetchParallel?: number;
84
+ cursorMaxActive?: number;
85
+ /**
86
+ * DECLARE されたバッチ変数へ渡す文字列値。
87
+ * キーは @ を付けず、大文字小文字を区別しない。SET 変数には注入できない。
88
+ */
89
+ variables?: Readonly<Record<string, string>>;
90
+ /**
91
+ * CREATE TEMP TABLE 1 表あたりの実体化行数上限(既定 10,000)。
92
+ * 超過は onLimitReached: "truncate" でも常に error となる。
93
+ *
94
+ * 一時テーブルは利用者アプリのプロセス内メモリに runBatch 呼び出し単位で実体化される。
95
+ * 同時に存在できるのは最大 16 表で、DROP TEMP TABLE により解放された枠は同じバッチ内で再利用できる。
96
+ */
97
+ tempTableMaxRows?: number;
98
+ }
72
99
  export interface QueryColumn {
73
100
  name: string;
74
101
  valueType: "string";
@@ -91,8 +118,54 @@ export interface QueryResult {
91
118
  columns: readonly QueryColumn[];
92
119
  rowCount: number;
93
120
  warnings: readonly string[];
121
+ /** Present only for an existing-record VALIDATE query. */
122
+ validateStats?: {
123
+ errorRecords: number;
124
+ errorCount: number;
125
+ };
94
126
  metrics: QueryMetrics;
95
127
  }
128
+ /** Named now so a future DML VALIDATE ONLY result can extend this union additively. */
129
+ export type BatchResultItem = QueryResult;
130
+ export interface BatchStatementInfo {
131
+ /** Zero-based statement index in the submitted batch. */
132
+ readonly index: number;
133
+ /** Parser statement type, such as SELECT or CREATE_TEMP_TABLE. */
134
+ readonly type: string;
135
+ /**
136
+ * Successful BatchResult values contain successful statements only.
137
+ * A statement error makes runBatch throw instead of returning this DTO.
138
+ */
139
+ readonly status: "success" | "error" | "skipped";
140
+ readonly tempTable?: string;
141
+ readonly rowCount?: number;
142
+ readonly resultIndex?: number;
143
+ readonly error?: {
144
+ readonly code: string;
145
+ readonly message: string;
146
+ };
147
+ readonly skippedReason?: string;
148
+ }
149
+ /**
150
+ * Successful read-only batch result.
151
+ *
152
+ * There is intentionally no `ok` field: if any statement fails, runBatch
153
+ * throws KsqlEngineError and returns no partial results. The error identifies
154
+ * the failed statement through statementIndex and statementType.
155
+ */
156
+ export interface BatchResult {
157
+ readonly type: "batch";
158
+ readonly batch: true;
159
+ readonly statementCount: number;
160
+ readonly statements: readonly BatchStatementInfo[];
161
+ /**
162
+ * Row-returning statement results.
163
+ * Every metrics object is the same batch-wide aggregate, not a per-statement
164
+ * measurement; do not use it to attribute cost to an individual statement.
165
+ */
166
+ readonly results: readonly BatchResultItem[];
167
+ readonly warnings: readonly string[];
168
+ }
96
169
  export interface ExplainResult {
97
170
  type: "explain";
98
171
  lines: readonly string[];
@@ -1,3 +1,11 @@
1
1
  import type { ExplainResult, QueryResult, RunQueryOptions } from "./publicTypes";
2
+ /**
3
+ * Executes one row-returning read-only statement: SELECT, WITH, UNION,
4
+ * SHOW APPS, DESCRIBE, or existing-record VALIDATE.
5
+ */
2
6
  export declare function runQuery(sql: string, options: RunQueryOptions): Promise<QueryResult>;
7
+ /**
8
+ * Explains one SELECT, WITH, or UNION query without reading records.
9
+ * CREATE TEMP TABLE is not accepted; explain its source SELECT instead.
10
+ */
3
11
  export declare function explainQuery(sql: string, options: Omit<RunQueryOptions, "onLimitReached">): Promise<ExplainResult>;