@rex0220/kintone-sql-tools 3.18.0 → 3.20.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.
@@ -0,0 +1,98 @@
1
+ export interface ReadonlyKintoneFieldValue {
2
+ readonly value: unknown;
3
+ }
4
+ export type ReadonlyKintoneRecord = Readonly<Record<string, ReadonlyKintoneFieldValue>>;
5
+ export interface ReadonlyGetRecordsParams {
6
+ app: number;
7
+ query: string;
8
+ fields: string[];
9
+ }
10
+ export interface ReadonlyGetRecordsResult {
11
+ records: ReadonlyKintoneRecord[];
12
+ searchAborted?: boolean;
13
+ }
14
+ export interface ReadonlyCursorOpenParams {
15
+ app: number;
16
+ fields?: string[];
17
+ query: string;
18
+ size: 500;
19
+ }
20
+ export interface ReadonlyCursorPage {
21
+ records: ReadonlyKintoneRecord[];
22
+ next: boolean;
23
+ }
24
+ export interface ReadonlyCursorHandle {
25
+ readonly totalCount: number;
26
+ nextPage(): Promise<ReadonlyCursorPage>;
27
+ close(): Promise<void>;
28
+ }
29
+ export interface ReadonlyAppInfo {
30
+ appId: number;
31
+ name: string;
32
+ description: string;
33
+ }
34
+ export interface ReadonlyFieldInfo {
35
+ code: string;
36
+ label: string;
37
+ fieldType: string;
38
+ optionOrder?: Record<string, number>;
39
+ sortKind?: "number" | "string";
40
+ inSubtable?: boolean;
41
+ subtableCode?: string;
42
+ }
43
+ export type ReadonlyNumberRoundingMode = "HALF_EVEN" | "UP" | "DOWN";
44
+ export interface ReadonlyNumberPrecision {
45
+ digits: number;
46
+ decimalPlaces: number;
47
+ roundingMode: ReadonlyNumberRoundingMode;
48
+ }
49
+ export interface ReadonlyProcessStatusState {
50
+ readonly name: string;
51
+ readonly index: number;
52
+ }
53
+ export interface ReadonlyProcessStatuses {
54
+ enable: boolean;
55
+ states: ReadonlyProcessStatusState[] | null;
56
+ }
57
+ export interface ReadonlyKintoneClient {
58
+ getRecords(params: ReadonlyGetRecordsParams): Promise<ReadonlyGetRecordsResult>;
59
+ openCursor(params: ReadonlyCursorOpenParams): Promise<ReadonlyCursorHandle>;
60
+ getApps(): Promise<readonly ReadonlyAppInfo[]>;
61
+ getFields(appId: number): Promise<readonly ReadonlyFieldInfo[]>;
62
+ getNumberPrecision(appId: number): Promise<ReadonlyNumberPrecision>;
63
+ getProcessStatuses(appId: number): Promise<ReadonlyProcessStatuses>;
64
+ }
65
+ export interface RunQueryOptions {
66
+ client: ReadonlyKintoneClient;
67
+ maxRecords?: number;
68
+ onLimitReached?: "error" | "truncate";
69
+ fetchParallel?: number;
70
+ cursorMaxActive?: number;
71
+ }
72
+ export interface QueryColumn {
73
+ name: string;
74
+ valueType: "string";
75
+ }
76
+ export interface QueryMetrics {
77
+ recordGetCalls: number;
78
+ fetchedRows: number;
79
+ elapsedMs: number;
80
+ cursorRecordsScanned: number;
81
+ }
82
+ export interface QueryResult {
83
+ type: "query";
84
+ rows: readonly Readonly<Record<string, string>>[];
85
+ columns: readonly QueryColumn[];
86
+ rowCount: number;
87
+ warnings: readonly string[];
88
+ metrics: QueryMetrics;
89
+ }
90
+ export interface ExplainResult {
91
+ type: "explain";
92
+ lines: readonly string[];
93
+ text: string;
94
+ metrics: QueryMetrics;
95
+ }
96
+ export interface CreateReadonlyKintoneClientOptions {
97
+ cursorMaxActive?: number;
98
+ }
@@ -0,0 +1,3 @@
1
+ import type { ExplainResult, QueryResult, RunQueryOptions } from "./publicTypes";
2
+ export declare function runQuery(sql: string, options: RunQueryOptions): Promise<QueryResult>;
3
+ export declare function explainQuery(sql: string, options: Omit<RunQueryOptions, "onLimitReached">): Promise<ExplainResult>;