@sqlrooms/cells 0.29.0-rc.1
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/LICENSE.md +9 -0
- package/README.md +32 -0
- package/dist/cellsSlice.d.ts +3 -0
- package/dist/cellsSlice.d.ts.map +1 -0
- package/dist/cellsSlice.js +602 -0
- package/dist/cellsSlice.js.map +1 -0
- package/dist/components/DeleteSheetModal.d.ts +9 -0
- package/dist/components/DeleteSheetModal.d.ts.map +1 -0
- package/dist/components/DeleteSheetModal.js +6 -0
- package/dist/components/DeleteSheetModal.js.map +1 -0
- package/dist/components/Input/ConfigPanel/DropdownConfig.d.ts +2 -0
- package/dist/components/Input/ConfigPanel/DropdownConfig.d.ts.map +1 -0
- package/dist/components/Input/ConfigPanel/DropdownConfig.js +44 -0
- package/dist/components/Input/ConfigPanel/DropdownConfig.js.map +1 -0
- package/dist/components/Input/ConfigPanel/InputConfigPanel.d.ts +11 -0
- package/dist/components/Input/ConfigPanel/InputConfigPanel.d.ts.map +1 -0
- package/dist/components/Input/ConfigPanel/InputConfigPanel.js +65 -0
- package/dist/components/Input/ConfigPanel/InputConfigPanel.js.map +1 -0
- package/dist/components/Input/ConfigPanel/SliderConfig.d.ts +2 -0
- package/dist/components/Input/ConfigPanel/SliderConfig.d.ts.map +1 -0
- package/dist/components/Input/ConfigPanel/SliderConfig.js +19 -0
- package/dist/components/Input/ConfigPanel/SliderConfig.js.map +1 -0
- package/dist/components/Input/ConfigPanel/TextConfig.d.ts +2 -0
- package/dist/components/Input/ConfigPanel/TextConfig.d.ts.map +1 -0
- package/dist/components/Input/ConfigPanel/TextConfig.js +8 -0
- package/dist/components/Input/ConfigPanel/TextConfig.js.map +1 -0
- package/dist/components/Input/helpers.d.ts +3 -0
- package/dist/components/Input/helpers.d.ts.map +1 -0
- package/dist/components/Input/helpers.js +28 -0
- package/dist/components/Input/helpers.js.map +1 -0
- package/dist/components/InputCellContent.d.ts +9 -0
- package/dist/components/InputCellContent.d.ts.map +1 -0
- package/dist/components/InputCellContent.js +38 -0
- package/dist/components/InputCellContent.js.map +1 -0
- package/dist/components/SheetsTabBar.d.ts +6 -0
- package/dist/components/SheetsTabBar.d.ts.map +1 -0
- package/dist/components/SheetsTabBar.js +57 -0
- package/dist/components/SheetsTabBar.js.map +1 -0
- package/dist/components/SqlCellContent.d.ts +9 -0
- package/dist/components/SqlCellContent.d.ts.map +1 -0
- package/dist/components/SqlCellContent.js +222 -0
- package/dist/components/SqlCellContent.js.map +1 -0
- package/dist/components/SqlCellRunButton.d.ts +17 -0
- package/dist/components/SqlCellRunButton.d.ts.map +1 -0
- package/dist/components/SqlCellRunButton.js +11 -0
- package/dist/components/SqlCellRunButton.js.map +1 -0
- package/dist/components/TextCellContent.d.ts +9 -0
- package/dist/components/TextCellContent.d.ts.map +1 -0
- package/dist/components/TextCellContent.js +27 -0
- package/dist/components/TextCellContent.js.map +1 -0
- package/dist/components/VegaCellContent.d.ts +9 -0
- package/dist/components/VegaCellContent.d.ts.map +1 -0
- package/dist/components/VegaCellContent.js +66 -0
- package/dist/components/VegaCellContent.js.map +1 -0
- package/dist/components/VegaConfigPanel.d.ts +8 -0
- package/dist/components/VegaConfigPanel.d.ts.map +1 -0
- package/dist/components/VegaConfigPanel.js +72 -0
- package/dist/components/VegaConfigPanel.js.map +1 -0
- package/dist/dagUtils.d.ts +20 -0
- package/dist/dagUtils.d.ts.map +1 -0
- package/dist/dagUtils.js +233 -0
- package/dist/dagUtils.js.map +1 -0
- package/dist/defaultCellRegistry.d.ts +3 -0
- package/dist/defaultCellRegistry.d.ts.map +1 -0
- package/dist/defaultCellRegistry.js +177 -0
- package/dist/defaultCellRegistry.js.map +1 -0
- package/dist/execution.d.ts +9 -0
- package/dist/execution.d.ts.map +1 -0
- package/dist/execution.js +195 -0
- package/dist/execution.js.map +1 -0
- package/dist/helpers.d.ts +45 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.js +124 -0
- package/dist/helpers.js.map +1 -0
- package/dist/hooks.d.ts +11 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +9 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/resultRelationPolicy.d.ts +74 -0
- package/dist/resultRelationPolicy.d.ts.map +1 -0
- package/dist/resultRelationPolicy.js +74 -0
- package/dist/resultRelationPolicy.js.map +1 -0
- package/dist/sqlHelpers.d.ts +41 -0
- package/dist/sqlHelpers.d.ts.map +1 -0
- package/dist/sqlHelpers.js +190 -0
- package/dist/sqlHelpers.js.map +1 -0
- package/dist/types.d.ts +501 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +144 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +17 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +35 -0
- package/dist/utils.js.map +1 -0
- package/package.json +57 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
import type { DbSliceState } from '@sqlrooms/db';
|
|
2
|
+
import type { BaseRoomStoreState } from '@sqlrooms/room-store';
|
|
3
|
+
import type * as arrow from 'apache-arrow';
|
|
4
|
+
import type React from 'react';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
/** Cell types */
|
|
7
|
+
export type BuiltInCellType = 'sql' | 'text' | 'vega' | 'input';
|
|
8
|
+
export type CellType = BuiltInCellType | (string & {});
|
|
9
|
+
export declare const CellType: z.ZodString;
|
|
10
|
+
/** Input Cell types */
|
|
11
|
+
export declare const InputTypes: z.ZodEnum<{
|
|
12
|
+
text: "text";
|
|
13
|
+
slider: "slider";
|
|
14
|
+
dropdown: "dropdown";
|
|
15
|
+
}>;
|
|
16
|
+
export type InputTypes = z.infer<typeof InputTypes>;
|
|
17
|
+
export declare const InputText: z.ZodObject<{
|
|
18
|
+
kind: z.ZodLiteral<"text">;
|
|
19
|
+
varName: z.ZodString;
|
|
20
|
+
value: z.ZodDefault<z.ZodString>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
export type InputText = z.infer<typeof InputText>;
|
|
23
|
+
export declare const InputSlider: z.ZodObject<{
|
|
24
|
+
kind: z.ZodLiteral<"slider">;
|
|
25
|
+
varName: z.ZodString;
|
|
26
|
+
min: z.ZodDefault<z.ZodNumber>;
|
|
27
|
+
max: z.ZodDefault<z.ZodNumber>;
|
|
28
|
+
step: z.ZodDefault<z.ZodNumber>;
|
|
29
|
+
value: z.ZodDefault<z.ZodNumber>;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
export type InputSlider = z.infer<typeof InputSlider>;
|
|
32
|
+
export declare const InputDropdown: z.ZodObject<{
|
|
33
|
+
kind: z.ZodLiteral<"dropdown">;
|
|
34
|
+
varName: z.ZodString;
|
|
35
|
+
options: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
36
|
+
value: z.ZodDefault<z.ZodString>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
export type InputDropdown = z.infer<typeof InputDropdown>;
|
|
39
|
+
export declare const InputUnion: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
40
|
+
kind: z.ZodLiteral<"text">;
|
|
41
|
+
varName: z.ZodString;
|
|
42
|
+
value: z.ZodDefault<z.ZodString>;
|
|
43
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
44
|
+
kind: z.ZodLiteral<"slider">;
|
|
45
|
+
varName: z.ZodString;
|
|
46
|
+
min: z.ZodDefault<z.ZodNumber>;
|
|
47
|
+
max: z.ZodDefault<z.ZodNumber>;
|
|
48
|
+
step: z.ZodDefault<z.ZodNumber>;
|
|
49
|
+
value: z.ZodDefault<z.ZodNumber>;
|
|
50
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
51
|
+
kind: z.ZodLiteral<"dropdown">;
|
|
52
|
+
varName: z.ZodString;
|
|
53
|
+
options: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
54
|
+
value: z.ZodDefault<z.ZodString>;
|
|
55
|
+
}, z.core.$strip>], "kind">;
|
|
56
|
+
export type InputUnion = z.infer<typeof InputUnion>;
|
|
57
|
+
/** SQL Cell */
|
|
58
|
+
export declare const SqlCellData: z.ZodObject<{
|
|
59
|
+
title: z.ZodDefault<z.ZodString>;
|
|
60
|
+
sql: z.ZodDefault<z.ZodString>;
|
|
61
|
+
resultName: z.ZodOptional<z.ZodString>;
|
|
62
|
+
connectorId: z.ZodOptional<z.ZodString>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
export type SqlCellData = z.infer<typeof SqlCellData>;
|
|
65
|
+
/** Text Cell */
|
|
66
|
+
export declare const TextCellData: z.ZodObject<{
|
|
67
|
+
title: z.ZodDefault<z.ZodString>;
|
|
68
|
+
text: z.ZodDefault<z.ZodString>;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
export type TextCellData = z.infer<typeof TextCellData>;
|
|
71
|
+
/** Vega Cell */
|
|
72
|
+
export declare const VegaCellData: z.ZodObject<{
|
|
73
|
+
title: z.ZodDefault<z.ZodString>;
|
|
74
|
+
sqlId: z.ZodOptional<z.ZodString>;
|
|
75
|
+
sql: z.ZodOptional<z.ZodString>;
|
|
76
|
+
vegaSpec: z.ZodOptional<z.ZodAny>;
|
|
77
|
+
}, z.core.$strip>;
|
|
78
|
+
export type VegaCellData = z.infer<typeof VegaCellData>;
|
|
79
|
+
/** Input Cell Data */
|
|
80
|
+
export declare const InputCellData: z.ZodObject<{
|
|
81
|
+
title: z.ZodDefault<z.ZodString>;
|
|
82
|
+
input: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
83
|
+
kind: z.ZodLiteral<"text">;
|
|
84
|
+
varName: z.ZodString;
|
|
85
|
+
value: z.ZodDefault<z.ZodString>;
|
|
86
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
87
|
+
kind: z.ZodLiteral<"slider">;
|
|
88
|
+
varName: z.ZodString;
|
|
89
|
+
min: z.ZodDefault<z.ZodNumber>;
|
|
90
|
+
max: z.ZodDefault<z.ZodNumber>;
|
|
91
|
+
step: z.ZodDefault<z.ZodNumber>;
|
|
92
|
+
value: z.ZodDefault<z.ZodNumber>;
|
|
93
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
94
|
+
kind: z.ZodLiteral<"dropdown">;
|
|
95
|
+
varName: z.ZodString;
|
|
96
|
+
options: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
97
|
+
value: z.ZodDefault<z.ZodString>;
|
|
98
|
+
}, z.core.$strip>], "kind">;
|
|
99
|
+
}, z.core.$strip>;
|
|
100
|
+
export type InputCellData = z.infer<typeof InputCellData>;
|
|
101
|
+
/** Unified Cell Data */
|
|
102
|
+
export declare const CellData: z.ZodObject<{
|
|
103
|
+
type: z.ZodString;
|
|
104
|
+
data: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
105
|
+
}, z.core.$strip>;
|
|
106
|
+
export type CellData = {
|
|
107
|
+
type: CellType;
|
|
108
|
+
data: Record<string, any>;
|
|
109
|
+
};
|
|
110
|
+
export declare const SqlCell: z.ZodObject<{
|
|
111
|
+
id: z.ZodString;
|
|
112
|
+
type: z.ZodLiteral<"sql">;
|
|
113
|
+
data: z.ZodObject<{
|
|
114
|
+
title: z.ZodDefault<z.ZodString>;
|
|
115
|
+
sql: z.ZodDefault<z.ZodString>;
|
|
116
|
+
resultName: z.ZodOptional<z.ZodString>;
|
|
117
|
+
connectorId: z.ZodOptional<z.ZodString>;
|
|
118
|
+
}, z.core.$strip>;
|
|
119
|
+
}, z.core.$strip>;
|
|
120
|
+
export type SqlCell = z.infer<typeof SqlCell>;
|
|
121
|
+
export declare const TextCell: z.ZodObject<{
|
|
122
|
+
id: z.ZodString;
|
|
123
|
+
type: z.ZodLiteral<"text">;
|
|
124
|
+
data: z.ZodObject<{
|
|
125
|
+
title: z.ZodDefault<z.ZodString>;
|
|
126
|
+
text: z.ZodDefault<z.ZodString>;
|
|
127
|
+
}, z.core.$strip>;
|
|
128
|
+
}, z.core.$strip>;
|
|
129
|
+
export type TextCell = z.infer<typeof TextCell>;
|
|
130
|
+
export declare const VegaCell: z.ZodObject<{
|
|
131
|
+
id: z.ZodString;
|
|
132
|
+
type: z.ZodLiteral<"vega">;
|
|
133
|
+
data: z.ZodObject<{
|
|
134
|
+
title: z.ZodDefault<z.ZodString>;
|
|
135
|
+
sqlId: z.ZodOptional<z.ZodString>;
|
|
136
|
+
sql: z.ZodOptional<z.ZodString>;
|
|
137
|
+
vegaSpec: z.ZodOptional<z.ZodAny>;
|
|
138
|
+
}, z.core.$strip>;
|
|
139
|
+
}, z.core.$strip>;
|
|
140
|
+
export type VegaCell = z.infer<typeof VegaCell>;
|
|
141
|
+
export declare const InputCell: z.ZodObject<{
|
|
142
|
+
id: z.ZodString;
|
|
143
|
+
type: z.ZodLiteral<"input">;
|
|
144
|
+
data: z.ZodObject<{
|
|
145
|
+
title: z.ZodDefault<z.ZodString>;
|
|
146
|
+
input: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
147
|
+
kind: z.ZodLiteral<"text">;
|
|
148
|
+
varName: z.ZodString;
|
|
149
|
+
value: z.ZodDefault<z.ZodString>;
|
|
150
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
151
|
+
kind: z.ZodLiteral<"slider">;
|
|
152
|
+
varName: z.ZodString;
|
|
153
|
+
min: z.ZodDefault<z.ZodNumber>;
|
|
154
|
+
max: z.ZodDefault<z.ZodNumber>;
|
|
155
|
+
step: z.ZodDefault<z.ZodNumber>;
|
|
156
|
+
value: z.ZodDefault<z.ZodNumber>;
|
|
157
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
158
|
+
kind: z.ZodLiteral<"dropdown">;
|
|
159
|
+
varName: z.ZodString;
|
|
160
|
+
options: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
161
|
+
value: z.ZodDefault<z.ZodString>;
|
|
162
|
+
}, z.core.$strip>], "kind">;
|
|
163
|
+
}, z.core.$strip>;
|
|
164
|
+
}, z.core.$strip>;
|
|
165
|
+
export type InputCell = z.infer<typeof InputCell>;
|
|
166
|
+
export declare const SqlCellSchema: z.ZodObject<{
|
|
167
|
+
id: z.ZodString;
|
|
168
|
+
type: z.ZodLiteral<"sql">;
|
|
169
|
+
data: z.ZodObject<{
|
|
170
|
+
title: z.ZodDefault<z.ZodString>;
|
|
171
|
+
sql: z.ZodDefault<z.ZodString>;
|
|
172
|
+
resultName: z.ZodOptional<z.ZodString>;
|
|
173
|
+
connectorId: z.ZodOptional<z.ZodString>;
|
|
174
|
+
}, z.core.$strip>;
|
|
175
|
+
}, z.core.$strip>;
|
|
176
|
+
export declare const TextCellSchema: z.ZodObject<{
|
|
177
|
+
id: z.ZodString;
|
|
178
|
+
type: z.ZodLiteral<"text">;
|
|
179
|
+
data: z.ZodObject<{
|
|
180
|
+
title: z.ZodDefault<z.ZodString>;
|
|
181
|
+
text: z.ZodDefault<z.ZodString>;
|
|
182
|
+
}, z.core.$strip>;
|
|
183
|
+
}, z.core.$strip>;
|
|
184
|
+
export declare const VegaCellSchema: z.ZodObject<{
|
|
185
|
+
id: z.ZodString;
|
|
186
|
+
type: z.ZodLiteral<"vega">;
|
|
187
|
+
data: z.ZodObject<{
|
|
188
|
+
title: z.ZodDefault<z.ZodString>;
|
|
189
|
+
sqlId: z.ZodOptional<z.ZodString>;
|
|
190
|
+
sql: z.ZodOptional<z.ZodString>;
|
|
191
|
+
vegaSpec: z.ZodOptional<z.ZodAny>;
|
|
192
|
+
}, z.core.$strip>;
|
|
193
|
+
}, z.core.$strip>;
|
|
194
|
+
export declare const InputCellSchema: z.ZodObject<{
|
|
195
|
+
id: z.ZodString;
|
|
196
|
+
type: z.ZodLiteral<"input">;
|
|
197
|
+
data: z.ZodObject<{
|
|
198
|
+
title: z.ZodDefault<z.ZodString>;
|
|
199
|
+
input: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
200
|
+
kind: z.ZodLiteral<"text">;
|
|
201
|
+
varName: z.ZodString;
|
|
202
|
+
value: z.ZodDefault<z.ZodString>;
|
|
203
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
204
|
+
kind: z.ZodLiteral<"slider">;
|
|
205
|
+
varName: z.ZodString;
|
|
206
|
+
min: z.ZodDefault<z.ZodNumber>;
|
|
207
|
+
max: z.ZodDefault<z.ZodNumber>;
|
|
208
|
+
step: z.ZodDefault<z.ZodNumber>;
|
|
209
|
+
value: z.ZodDefault<z.ZodNumber>;
|
|
210
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
211
|
+
kind: z.ZodLiteral<"dropdown">;
|
|
212
|
+
varName: z.ZodString;
|
|
213
|
+
options: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
214
|
+
value: z.ZodDefault<z.ZodString>;
|
|
215
|
+
}, z.core.$strip>], "kind">;
|
|
216
|
+
}, z.core.$strip>;
|
|
217
|
+
}, z.core.$strip>;
|
|
218
|
+
/** Canonical Cell */
|
|
219
|
+
export declare const Cell: z.ZodObject<{
|
|
220
|
+
id: z.ZodString;
|
|
221
|
+
type: z.ZodString;
|
|
222
|
+
data: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
223
|
+
}, z.core.$strip>;
|
|
224
|
+
export type Cell = {
|
|
225
|
+
id: string;
|
|
226
|
+
type: CellType;
|
|
227
|
+
data: Record<string, any>;
|
|
228
|
+
};
|
|
229
|
+
/** Unified Cell Registry */
|
|
230
|
+
export type CellContainerProps = {
|
|
231
|
+
header?: React.ReactNode;
|
|
232
|
+
content: React.ReactNode;
|
|
233
|
+
footer?: React.ReactNode;
|
|
234
|
+
};
|
|
235
|
+
/** Type for SQL AST parsing function from DuckDB slice */
|
|
236
|
+
export type SqlSelectToJsonFn = (sql: string) => Promise<{
|
|
237
|
+
error: boolean;
|
|
238
|
+
error_type?: string;
|
|
239
|
+
statements?: unknown[];
|
|
240
|
+
}>;
|
|
241
|
+
export type CellRegistryItem<TCell extends Cell = Cell> = {
|
|
242
|
+
type: string;
|
|
243
|
+
title: string;
|
|
244
|
+
createCell: (id: string) => TCell;
|
|
245
|
+
renderCell: (props: {
|
|
246
|
+
id: string;
|
|
247
|
+
cell: TCell;
|
|
248
|
+
renderContainer: (props: CellContainerProps) => React.ReactElement;
|
|
249
|
+
}) => React.ReactElement;
|
|
250
|
+
/** Find dependencies for DAG using AST-enabled async resolution. */
|
|
251
|
+
findDependencies: (args: {
|
|
252
|
+
cell: TCell;
|
|
253
|
+
cells: Record<string, Cell>;
|
|
254
|
+
sheetId: string;
|
|
255
|
+
sqlSelectToJson: SqlSelectToJsonFn;
|
|
256
|
+
}) => Promise<string[]>;
|
|
257
|
+
/** Optional: custom execution logic (defaults to SQL execution for sql type) */
|
|
258
|
+
runCell?: (args: {
|
|
259
|
+
id: string;
|
|
260
|
+
opts?: {
|
|
261
|
+
cascade?: boolean;
|
|
262
|
+
schemaName?: string;
|
|
263
|
+
};
|
|
264
|
+
get: () => CellsRootState;
|
|
265
|
+
set: (updater: (state: CellsRootState) => CellsRootState) => void;
|
|
266
|
+
}) => Promise<void>;
|
|
267
|
+
/** Optional: rename the result view when resultName changes */
|
|
268
|
+
renameResult?: (args: {
|
|
269
|
+
id: string;
|
|
270
|
+
oldResultView: string;
|
|
271
|
+
get: () => CellsRootState;
|
|
272
|
+
set: (updater: (state: CellsRootState) => CellsRootState) => void;
|
|
273
|
+
}) => Promise<void>;
|
|
274
|
+
};
|
|
275
|
+
export type CellRegistry = Record<string, CellRegistryItem<any>>;
|
|
276
|
+
/** Sheet and Edge types */
|
|
277
|
+
export declare const SheetType: z.ZodEnum<{
|
|
278
|
+
notebook: "notebook";
|
|
279
|
+
canvas: "canvas";
|
|
280
|
+
app: "app";
|
|
281
|
+
}>;
|
|
282
|
+
export type SheetType = z.infer<typeof SheetType>;
|
|
283
|
+
export declare const EdgeKind: z.ZodEnum<{
|
|
284
|
+
dependency: "dependency";
|
|
285
|
+
manual: "manual";
|
|
286
|
+
}>;
|
|
287
|
+
export type EdgeKind = z.infer<typeof EdgeKind>;
|
|
288
|
+
export declare const Edge: z.ZodObject<{
|
|
289
|
+
id: z.ZodString;
|
|
290
|
+
source: z.ZodString;
|
|
291
|
+
target: z.ZodString;
|
|
292
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
293
|
+
dependency: "dependency";
|
|
294
|
+
manual: "manual";
|
|
295
|
+
}>>;
|
|
296
|
+
}, z.core.$strip>;
|
|
297
|
+
export type Edge = z.infer<typeof Edge>;
|
|
298
|
+
export declare const SheetGraphCache: z.ZodObject<{
|
|
299
|
+
dependencies: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
300
|
+
dependents: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
301
|
+
contentHashByCell: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
302
|
+
}, z.core.$strip>;
|
|
303
|
+
export type SheetGraphCache = z.infer<typeof SheetGraphCache>;
|
|
304
|
+
export declare const Sheet: z.ZodObject<{
|
|
305
|
+
id: z.ZodString;
|
|
306
|
+
type: z.ZodEnum<{
|
|
307
|
+
notebook: "notebook";
|
|
308
|
+
canvas: "canvas";
|
|
309
|
+
app: "app";
|
|
310
|
+
}>;
|
|
311
|
+
title: z.ZodString;
|
|
312
|
+
schemaName: z.ZodOptional<z.ZodString>;
|
|
313
|
+
cellIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
314
|
+
edges: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
315
|
+
id: z.ZodString;
|
|
316
|
+
source: z.ZodString;
|
|
317
|
+
target: z.ZodString;
|
|
318
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
319
|
+
dependency: "dependency";
|
|
320
|
+
manual: "manual";
|
|
321
|
+
}>>;
|
|
322
|
+
}, z.core.$strip>>>;
|
|
323
|
+
graphCache: z.ZodOptional<z.ZodObject<{
|
|
324
|
+
dependencies: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
325
|
+
dependents: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
326
|
+
contentHashByCell: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
327
|
+
}, z.core.$strip>>;
|
|
328
|
+
}, z.core.$strip>;
|
|
329
|
+
export type Sheet = z.infer<typeof Sheet>;
|
|
330
|
+
/** Cell Status */
|
|
331
|
+
export declare const SqlCellStatus: z.ZodObject<{
|
|
332
|
+
type: z.ZodLiteral<"sql">;
|
|
333
|
+
status: z.ZodEnum<{
|
|
334
|
+
success: "success";
|
|
335
|
+
idle: "idle";
|
|
336
|
+
running: "running";
|
|
337
|
+
cancel: "cancel";
|
|
338
|
+
error: "error";
|
|
339
|
+
}>;
|
|
340
|
+
lastError: z.ZodOptional<z.ZodString>;
|
|
341
|
+
referencedTables: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
342
|
+
resultName: z.ZodOptional<z.ZodString>;
|
|
343
|
+
resultView: z.ZodOptional<z.ZodString>;
|
|
344
|
+
resultRelationType: z.ZodOptional<z.ZodEnum<{
|
|
345
|
+
view: "view";
|
|
346
|
+
table: "table";
|
|
347
|
+
}>>;
|
|
348
|
+
lastRunTime: z.ZodOptional<z.ZodNumber>;
|
|
349
|
+
}, z.core.$strip>;
|
|
350
|
+
export type SqlCellStatus = z.infer<typeof SqlCellStatus>;
|
|
351
|
+
export declare const OtherCellStatus: z.ZodObject<{
|
|
352
|
+
type: z.ZodLiteral<"other">;
|
|
353
|
+
}, z.core.$strip>;
|
|
354
|
+
export type OtherCellStatus = z.infer<typeof OtherCellStatus>;
|
|
355
|
+
export declare const CellStatus: z.ZodUnion<readonly [z.ZodObject<{
|
|
356
|
+
type: z.ZodLiteral<"sql">;
|
|
357
|
+
status: z.ZodEnum<{
|
|
358
|
+
success: "success";
|
|
359
|
+
idle: "idle";
|
|
360
|
+
running: "running";
|
|
361
|
+
cancel: "cancel";
|
|
362
|
+
error: "error";
|
|
363
|
+
}>;
|
|
364
|
+
lastError: z.ZodOptional<z.ZodString>;
|
|
365
|
+
referencedTables: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
366
|
+
resultName: z.ZodOptional<z.ZodString>;
|
|
367
|
+
resultView: z.ZodOptional<z.ZodString>;
|
|
368
|
+
resultRelationType: z.ZodOptional<z.ZodEnum<{
|
|
369
|
+
view: "view";
|
|
370
|
+
table: "table";
|
|
371
|
+
}>>;
|
|
372
|
+
lastRunTime: z.ZodOptional<z.ZodNumber>;
|
|
373
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
374
|
+
type: z.ZodLiteral<"other">;
|
|
375
|
+
}, z.core.$strip>]>;
|
|
376
|
+
export type CellStatus = z.infer<typeof CellStatus>;
|
|
377
|
+
/** SQL execution results */
|
|
378
|
+
export type SqlRunResult = {
|
|
379
|
+
resultName?: string;
|
|
380
|
+
referencedTables?: string[];
|
|
381
|
+
lastRunTime?: number;
|
|
382
|
+
};
|
|
383
|
+
export type SqlRunCallbacks = {
|
|
384
|
+
onStart?: () => void;
|
|
385
|
+
onSuccess?: (result: SqlRunResult) => void;
|
|
386
|
+
onError?: (message: string) => void;
|
|
387
|
+
onFinally?: () => void;
|
|
388
|
+
};
|
|
389
|
+
export type SqlRenderInput = {
|
|
390
|
+
varName: string;
|
|
391
|
+
value: string | number;
|
|
392
|
+
};
|
|
393
|
+
export type SqlDependencyOptions = {
|
|
394
|
+
inputTypes?: string[];
|
|
395
|
+
sqlTypes?: string[];
|
|
396
|
+
};
|
|
397
|
+
export type SqlCellRunStatus = {
|
|
398
|
+
state: 'idle' | 'running' | 'success' | 'cancel' | 'error';
|
|
399
|
+
message?: string;
|
|
400
|
+
resultName?: string;
|
|
401
|
+
} | undefined;
|
|
402
|
+
export declare const CellsSliceConfig: z.ZodObject<{
|
|
403
|
+
data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
404
|
+
id: z.ZodString;
|
|
405
|
+
type: z.ZodString;
|
|
406
|
+
data: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
407
|
+
}, z.core.$strip>>>;
|
|
408
|
+
sheets: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
409
|
+
id: z.ZodString;
|
|
410
|
+
type: z.ZodEnum<{
|
|
411
|
+
notebook: "notebook";
|
|
412
|
+
canvas: "canvas";
|
|
413
|
+
app: "app";
|
|
414
|
+
}>;
|
|
415
|
+
title: z.ZodString;
|
|
416
|
+
schemaName: z.ZodOptional<z.ZodString>;
|
|
417
|
+
cellIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
418
|
+
edges: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
419
|
+
id: z.ZodString;
|
|
420
|
+
source: z.ZodString;
|
|
421
|
+
target: z.ZodString;
|
|
422
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
423
|
+
dependency: "dependency";
|
|
424
|
+
manual: "manual";
|
|
425
|
+
}>>;
|
|
426
|
+
}, z.core.$strip>>>;
|
|
427
|
+
graphCache: z.ZodOptional<z.ZodObject<{
|
|
428
|
+
dependencies: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
429
|
+
dependents: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
430
|
+
contentHashByCell: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
431
|
+
}, z.core.$strip>>;
|
|
432
|
+
}, z.core.$strip>>>;
|
|
433
|
+
sheetOrder: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
434
|
+
currentSheetId: z.ZodOptional<z.ZodString>;
|
|
435
|
+
}, z.core.$strip>;
|
|
436
|
+
export type CellsSliceConfig = z.infer<typeof CellsSliceConfig>;
|
|
437
|
+
export type CellsSliceOptions = {
|
|
438
|
+
config?: Partial<CellsSliceConfig>;
|
|
439
|
+
cellRegistry: CellRegistry;
|
|
440
|
+
supportedSheetTypes?: SheetType[];
|
|
441
|
+
};
|
|
442
|
+
/** Data stored for a cell's query result */
|
|
443
|
+
export type CellResultData = {
|
|
444
|
+
arrowTable: arrow.Table;
|
|
445
|
+
totalRows: number;
|
|
446
|
+
};
|
|
447
|
+
export type CellsSliceState = {
|
|
448
|
+
cells: {
|
|
449
|
+
config: CellsSliceConfig;
|
|
450
|
+
status: Record<string, CellStatus>;
|
|
451
|
+
activeAbortControllers: Record<string, AbortController>;
|
|
452
|
+
cellRegistry: CellRegistry;
|
|
453
|
+
supportedSheetTypes: SheetType[];
|
|
454
|
+
/** Monotonic counter per cell, incremented when a new execution result arrives. Used to trigger pagination reset and re-render. */
|
|
455
|
+
resultVersion: Record<string, number>;
|
|
456
|
+
/** Monotonic counter per cell, incremented when a pagination/sorting fetch completes. Used to trigger re-render without resetting pagination. */
|
|
457
|
+
pageVersion: Record<string, number>;
|
|
458
|
+
addCell: (sheetId: string, cell: Cell, index?: number) => Promise<void>;
|
|
459
|
+
removeCell: (id: string) => void;
|
|
460
|
+
updateCell: (id: string, updater: (cell: Cell) => Cell, opts?: {
|
|
461
|
+
cascade?: boolean;
|
|
462
|
+
}) => Promise<void>;
|
|
463
|
+
addSheet: (title?: string, type?: SheetType) => string;
|
|
464
|
+
removeSheet: (sheetId: string) => void;
|
|
465
|
+
closeSheet: (sheetId: string) => void;
|
|
466
|
+
openSheet: (sheetId: string) => void;
|
|
467
|
+
setSheetOrder: (sheetOrder: string[]) => void;
|
|
468
|
+
renameSheet: (sheetId: string, title: string) => void;
|
|
469
|
+
setCurrentSheet: (sheetId: string) => void;
|
|
470
|
+
addEdge: (sheetId: string, edge: Omit<Edge, 'id'>) => void;
|
|
471
|
+
removeEdge: (sheetId: string, edgeId: string) => void;
|
|
472
|
+
updateEdgesFromSql: (sheetId: string, cellId: string) => Promise<void>;
|
|
473
|
+
runCell: (id: string, opts?: {
|
|
474
|
+
cascade?: boolean;
|
|
475
|
+
schemaName?: string;
|
|
476
|
+
}) => Promise<void>;
|
|
477
|
+
cancelCell: (id: string) => void;
|
|
478
|
+
invalidateCellStatus: (id: string) => void;
|
|
479
|
+
setCellResult: (id: string, data: CellResultData) => void;
|
|
480
|
+
setCellResultPage: (id: string, data: CellResultData) => void;
|
|
481
|
+
getCellResult: (id: string) => CellResultData | undefined;
|
|
482
|
+
clearCellResult: (id: string) => void;
|
|
483
|
+
fetchCellResultPage: (id: string, pagination: {
|
|
484
|
+
pageIndex: number;
|
|
485
|
+
pageSize: number;
|
|
486
|
+
}, sorting?: {
|
|
487
|
+
id: string;
|
|
488
|
+
desc: boolean;
|
|
489
|
+
}[]) => Promise<void>;
|
|
490
|
+
getDownstream: (sheetId: string, sourceCellId: string) => string[];
|
|
491
|
+
getRootCells: (sheetId: string) => string[];
|
|
492
|
+
runAllCellsCascade: (sheetId: string) => Promise<void>;
|
|
493
|
+
runDownstreamCascade: (sheetId: string, sourceCellId: string) => Promise<void>;
|
|
494
|
+
};
|
|
495
|
+
};
|
|
496
|
+
export type CellsRootState = BaseRoomStoreState & DbSliceState & CellsSliceState;
|
|
497
|
+
export declare function isSqlCell(cell: Cell): cell is SqlCell;
|
|
498
|
+
export declare function isTextCell(cell: Cell): cell is TextCell;
|
|
499
|
+
export declare function isVegaCell(cell: Cell): cell is VegaCell;
|
|
500
|
+
export declare function isInputCell(cell: Cell): cell is InputCell;
|
|
501
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,iBAA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AAE,IAAI,GAAG,IAAI,IAAI,QAAQ,CAEvD;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,SAAS,CAEzD"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const CellType = z.string();
|
|
3
|
+
/** Input Cell types */
|
|
4
|
+
export const InputTypes = z.enum(['text', 'slider', 'dropdown']);
|
|
5
|
+
export const InputText = z.object({
|
|
6
|
+
kind: z.literal(InputTypes.enum.text),
|
|
7
|
+
varName: z.string(),
|
|
8
|
+
value: z.string().default(''),
|
|
9
|
+
});
|
|
10
|
+
export const InputSlider = z.object({
|
|
11
|
+
kind: z.literal(InputTypes.enum.slider),
|
|
12
|
+
varName: z.string(),
|
|
13
|
+
min: z.number().default(0),
|
|
14
|
+
max: z.number().default(100),
|
|
15
|
+
step: z.number().default(1),
|
|
16
|
+
value: z.number().default(0),
|
|
17
|
+
});
|
|
18
|
+
export const InputDropdown = z.object({
|
|
19
|
+
kind: z.literal(InputTypes.enum.dropdown),
|
|
20
|
+
varName: z.string(),
|
|
21
|
+
options: z.array(z.string()).default([]),
|
|
22
|
+
value: z.string().default(''),
|
|
23
|
+
});
|
|
24
|
+
export const InputUnion = z.discriminatedUnion('kind', [
|
|
25
|
+
InputText,
|
|
26
|
+
InputSlider,
|
|
27
|
+
InputDropdown,
|
|
28
|
+
]);
|
|
29
|
+
/** SQL Cell */
|
|
30
|
+
export const SqlCellData = z.object({
|
|
31
|
+
title: z.string().default('Untitled'),
|
|
32
|
+
sql: z.string().default(''),
|
|
33
|
+
resultName: z.string().optional(), // SQL-friendly identifier for the result view
|
|
34
|
+
connectorId: z.string().optional(),
|
|
35
|
+
});
|
|
36
|
+
/** Text Cell */
|
|
37
|
+
export const TextCellData = z.object({
|
|
38
|
+
title: z.string().default('Text'),
|
|
39
|
+
text: z.string().default(''),
|
|
40
|
+
});
|
|
41
|
+
/** Vega Cell */
|
|
42
|
+
export const VegaCellData = z.object({
|
|
43
|
+
title: z.string().default('Chart'),
|
|
44
|
+
sqlId: z.string().optional(), // In notebook, it links to another cell. In canvas, it might be the same.
|
|
45
|
+
sql: z.string().optional(), // In canvas, it often has its own SQL.
|
|
46
|
+
vegaSpec: z.any().optional(),
|
|
47
|
+
});
|
|
48
|
+
/** Input Cell Data */
|
|
49
|
+
export const InputCellData = z.object({
|
|
50
|
+
title: z.string().default('Input'),
|
|
51
|
+
input: InputUnion,
|
|
52
|
+
});
|
|
53
|
+
/** Unified Cell Data */
|
|
54
|
+
export const CellData = z.object({
|
|
55
|
+
type: CellType,
|
|
56
|
+
data: z.record(z.string(), z.any()),
|
|
57
|
+
});
|
|
58
|
+
export const SqlCell = z.object({
|
|
59
|
+
id: z.string(),
|
|
60
|
+
type: z.literal('sql'),
|
|
61
|
+
data: SqlCellData,
|
|
62
|
+
});
|
|
63
|
+
export const TextCell = z.object({
|
|
64
|
+
id: z.string(),
|
|
65
|
+
type: z.literal('text'),
|
|
66
|
+
data: TextCellData,
|
|
67
|
+
});
|
|
68
|
+
export const VegaCell = z.object({
|
|
69
|
+
id: z.string(),
|
|
70
|
+
type: z.literal('vega'),
|
|
71
|
+
data: VegaCellData,
|
|
72
|
+
});
|
|
73
|
+
export const InputCell = z.object({
|
|
74
|
+
id: z.string(),
|
|
75
|
+
type: z.literal('input'),
|
|
76
|
+
data: InputCellData,
|
|
77
|
+
});
|
|
78
|
+
export const SqlCellSchema = SqlCell;
|
|
79
|
+
export const TextCellSchema = TextCell;
|
|
80
|
+
export const VegaCellSchema = VegaCell;
|
|
81
|
+
export const InputCellSchema = InputCell;
|
|
82
|
+
/** Canonical Cell */
|
|
83
|
+
export const Cell = z.object({
|
|
84
|
+
id: z.string(),
|
|
85
|
+
type: CellType,
|
|
86
|
+
data: z.record(z.string(), z.any()),
|
|
87
|
+
});
|
|
88
|
+
/** Sheet and Edge types */
|
|
89
|
+
export const SheetType = z.enum(['notebook', 'canvas', 'app']);
|
|
90
|
+
export const EdgeKind = z.enum(['dependency', 'manual']);
|
|
91
|
+
export const Edge = z.object({
|
|
92
|
+
id: z.string(),
|
|
93
|
+
source: z.string(), // cellId
|
|
94
|
+
target: z.string(), // cellId
|
|
95
|
+
kind: EdgeKind.optional(),
|
|
96
|
+
});
|
|
97
|
+
export const SheetGraphCache = z.object({
|
|
98
|
+
dependencies: z.record(z.string(), z.array(z.string())).default({}),
|
|
99
|
+
dependents: z.record(z.string(), z.array(z.string())).default({}),
|
|
100
|
+
contentHashByCell: z.record(z.string(), z.string()).optional(),
|
|
101
|
+
});
|
|
102
|
+
export const Sheet = z.object({
|
|
103
|
+
id: z.string(),
|
|
104
|
+
type: SheetType,
|
|
105
|
+
title: z.string(),
|
|
106
|
+
schemaName: z.string().optional(),
|
|
107
|
+
cellIds: z.array(z.string()).default([]), // Which cells belong to this sheet
|
|
108
|
+
edges: z.array(Edge).default([]), // Dependencies
|
|
109
|
+
graphCache: SheetGraphCache.optional(),
|
|
110
|
+
});
|
|
111
|
+
/** Cell Status */
|
|
112
|
+
export const SqlCellStatus = z.object({
|
|
113
|
+
type: z.literal('sql'),
|
|
114
|
+
status: z.enum(['idle', 'running', 'success', 'cancel', 'error']),
|
|
115
|
+
lastError: z.string().optional(),
|
|
116
|
+
referencedTables: z.array(z.string()).default([]),
|
|
117
|
+
resultName: z.string().optional(),
|
|
118
|
+
resultView: z.string().optional(),
|
|
119
|
+
resultRelationType: z.enum(['view', 'table']).optional(),
|
|
120
|
+
lastRunTime: z.number().optional(),
|
|
121
|
+
});
|
|
122
|
+
export const OtherCellStatus = z.object({
|
|
123
|
+
type: z.literal('other'),
|
|
124
|
+
});
|
|
125
|
+
export const CellStatus = z.union([SqlCellStatus, OtherCellStatus]);
|
|
126
|
+
export const CellsSliceConfig = z.object({
|
|
127
|
+
data: z.record(z.string(), Cell).default({}),
|
|
128
|
+
sheets: z.record(z.string(), Sheet).default({}),
|
|
129
|
+
sheetOrder: z.array(z.string()).default([]),
|
|
130
|
+
currentSheetId: z.string().optional(),
|
|
131
|
+
});
|
|
132
|
+
export function isSqlCell(cell) {
|
|
133
|
+
return cell.type === 'sql';
|
|
134
|
+
}
|
|
135
|
+
export function isTextCell(cell) {
|
|
136
|
+
return cell.type === 'text';
|
|
137
|
+
}
|
|
138
|
+
export function isVegaCell(cell) {
|
|
139
|
+
return cell.type === 'vega';
|
|
140
|
+
}
|
|
141
|
+
export function isInputCell(cell) {
|
|
142
|
+
return cell.type === 'input';
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=types.js.map
|