@sqlrooms/room-config 0.17.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/LICENSE.md +9 -0
- package/README.md +124 -0
- package/dist/BaseRoomConfig.d.ts +408 -0
- package/dist/BaseRoomConfig.d.ts.map +1 -0
- package/dist/BaseRoomConfig.js +16 -0
- package/dist/BaseRoomConfig.js.map +1 -0
- package/dist/DataSource.d.ts +558 -0
- package/dist/DataSource.d.ts.map +1 -0
- package/dist/DataSource.js +83 -0
- package/dist/DataSource.js.map +1 -0
- package/dist/LayoutConfig.d.ts +64 -0
- package/dist/LayoutConfig.d.ts.map +1 -0
- package/dist/LayoutConfig.js +35 -0
- package/dist/LayoutConfig.js.map +1 -0
- package/dist/LoadOptions.d.ts +333 -0
- package/dist/LoadOptions.d.ts.map +1 -0
- package/dist/LoadOptions.js +83 -0
- package/dist/LoadOptions.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/package.json +34 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Main view room panel key */
|
|
3
|
+
export declare const MAIN_VIEW = "main";
|
|
4
|
+
export declare const LayoutTypes: z.ZodEnum<["mosaic"]>;
|
|
5
|
+
export type LayoutTypes = z.infer<typeof MosaicLayoutDirection>;
|
|
6
|
+
export declare const MosaicLayoutDirection: z.ZodEnum<["row", "column"]>;
|
|
7
|
+
export type MosaicLayoutDirection = z.infer<typeof MosaicLayoutDirection>;
|
|
8
|
+
declare const BaseMosaicLayoutParent: z.ZodObject<{
|
|
9
|
+
direction: z.ZodEnum<["row", "column"]>;
|
|
10
|
+
splitPercentage: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
direction: "row" | "column";
|
|
13
|
+
splitPercentage?: number | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
direction: "row" | "column";
|
|
16
|
+
splitPercentage?: number | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const MosaicLayoutParent: z.ZodType<MosaicLayoutParent>;
|
|
19
|
+
export type MosaicLayoutParent = z.infer<typeof BaseMosaicLayoutParent> & {
|
|
20
|
+
first: MosaicLayoutNode;
|
|
21
|
+
second: MosaicLayoutNode;
|
|
22
|
+
};
|
|
23
|
+
export declare function isMosaicLayoutParent(node: MosaicLayoutNode | null | undefined): node is MosaicLayoutParent;
|
|
24
|
+
export declare const MosaicLayoutNodeKey: z.ZodString;
|
|
25
|
+
export type MosaicLayoutNodeKey = z.infer<typeof MosaicLayoutNodeKey>;
|
|
26
|
+
export type MosaicLayoutNode = z.infer<typeof MosaicLayoutNode>;
|
|
27
|
+
export declare const MosaicLayoutNode: z.ZodUnion<[z.ZodString, z.ZodType<MosaicLayoutParent, z.ZodTypeDef, MosaicLayoutParent>]>;
|
|
28
|
+
export declare const MosaicLayoutConfig: z.ZodObject<{
|
|
29
|
+
type: z.ZodLiteral<"mosaic">;
|
|
30
|
+
nodes: z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodType<MosaicLayoutParent, z.ZodTypeDef, MosaicLayoutParent>]>>;
|
|
31
|
+
pinned: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
32
|
+
fixed: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
type: "mosaic";
|
|
35
|
+
nodes: string | MosaicLayoutParent | null;
|
|
36
|
+
pinned?: string[] | undefined;
|
|
37
|
+
fixed?: string[] | undefined;
|
|
38
|
+
}, {
|
|
39
|
+
type: "mosaic";
|
|
40
|
+
nodes: string | MosaicLayoutParent | null;
|
|
41
|
+
pinned?: string[] | undefined;
|
|
42
|
+
fixed?: string[] | undefined;
|
|
43
|
+
}>;
|
|
44
|
+
export type MosaicLayoutConfig = z.infer<typeof MosaicLayoutConfig>;
|
|
45
|
+
export declare const LayoutConfig: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
46
|
+
type: z.ZodLiteral<"mosaic">;
|
|
47
|
+
nodes: z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodType<MosaicLayoutParent, z.ZodTypeDef, MosaicLayoutParent>]>>;
|
|
48
|
+
pinned: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
49
|
+
fixed: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
50
|
+
}, "strip", z.ZodTypeAny, {
|
|
51
|
+
type: "mosaic";
|
|
52
|
+
nodes: string | MosaicLayoutParent | null;
|
|
53
|
+
pinned?: string[] | undefined;
|
|
54
|
+
fixed?: string[] | undefined;
|
|
55
|
+
}, {
|
|
56
|
+
type: "mosaic";
|
|
57
|
+
nodes: string | MosaicLayoutParent | null;
|
|
58
|
+
pinned?: string[] | undefined;
|
|
59
|
+
fixed?: string[] | undefined;
|
|
60
|
+
}>]>;
|
|
61
|
+
export declare const DEFAULT_MOSAIC_LAYOUT: MosaicLayoutConfig;
|
|
62
|
+
export type LayoutConfig = z.infer<typeof LayoutConfig>;
|
|
63
|
+
export default LayoutConfig;
|
|
64
|
+
//# sourceMappingURL=LayoutConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LayoutConfig.d.ts","sourceRoot":"","sources":["../src/LayoutConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,+BAA+B;AAC/B,eAAO,MAAM,SAAS,SAAS,CAAC;AAEhC,eAAO,MAAM,WAAW,uBAAqB,CAAC;AAC9C,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEhE,eAAO,MAAM,qBAAqB,8BAA4B,CAAC;AAC/D,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E,QAAA,MAAM,sBAAsB;;;;;;;;;EAG1B,CAAC;AAGH,eAAO,MAAM,kBAAkB,EAAE,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAIzD,CAAC;AACL,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,GAAG;IACxE,KAAK,EAAE,gBAAgB,CAAC;IACxB,MAAM,EAAE,gBAAgB,CAAC;CAC1B,CAAC;AAEF,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,GACxC,IAAI,IAAI,kBAAkB,CAE5B;AAED,eAAO,MAAM,mBAAmB,aAAa,CAAC;AAC9C,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEtE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAChE,eAAO,MAAM,gBAAgB,4FAG3B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;EAK7B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;IAAqD,CAAC;AAE/E,eAAO,MAAM,qBAAqB,EAAE,kBAGnC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Main view room panel key */
|
|
3
|
+
export const MAIN_VIEW = 'main';
|
|
4
|
+
export const LayoutTypes = z.enum(['mosaic']);
|
|
5
|
+
export const MosaicLayoutDirection = z.enum(['row', 'column']);
|
|
6
|
+
const BaseMosaicLayoutParent = z.object({
|
|
7
|
+
direction: MosaicLayoutDirection,
|
|
8
|
+
splitPercentage: z.number().optional(),
|
|
9
|
+
});
|
|
10
|
+
// See https://zod.dev/?id=recursive-types
|
|
11
|
+
export const MosaicLayoutParent = BaseMosaicLayoutParent.extend({
|
|
12
|
+
first: z.lazy(() => MosaicLayoutNode),
|
|
13
|
+
second: z.lazy(() => MosaicLayoutNode),
|
|
14
|
+
});
|
|
15
|
+
export function isMosaicLayoutParent(node) {
|
|
16
|
+
return typeof node !== 'string';
|
|
17
|
+
}
|
|
18
|
+
export const MosaicLayoutNodeKey = z.string();
|
|
19
|
+
export const MosaicLayoutNode = z.union([
|
|
20
|
+
MosaicLayoutNodeKey,
|
|
21
|
+
MosaicLayoutParent,
|
|
22
|
+
]);
|
|
23
|
+
export const MosaicLayoutConfig = z.object({
|
|
24
|
+
type: z.literal(LayoutTypes.enum.mosaic),
|
|
25
|
+
nodes: MosaicLayoutNode.nullable(),
|
|
26
|
+
pinned: z.array(MosaicLayoutNodeKey).optional(),
|
|
27
|
+
fixed: z.array(MosaicLayoutNodeKey).optional(),
|
|
28
|
+
});
|
|
29
|
+
export const LayoutConfig = z.discriminatedUnion('type', [MosaicLayoutConfig]);
|
|
30
|
+
export const DEFAULT_MOSAIC_LAYOUT = {
|
|
31
|
+
type: LayoutTypes.enum.mosaic,
|
|
32
|
+
nodes: MAIN_VIEW,
|
|
33
|
+
};
|
|
34
|
+
export default LayoutConfig;
|
|
35
|
+
//# sourceMappingURL=LayoutConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LayoutConfig.js","sourceRoot":"","sources":["../src/LayoutConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,+BAA+B;AAC/B,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC;AAEhC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,C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CAAC,kBAAkB,CAAC,CAAC,CAAC;AAE/E,MAAM,CAAC,MAAM,qBAAqB,GAAuB;IACvD,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM;IAC7B,KAAK,EAAE,SAAS;CACjB,CAAC;AAIF,eAAe,YAAY,CAAC","sourcesContent":["import {z} from 'zod';\n\n/** Main view room panel key */\nexport const MAIN_VIEW = 'main';\n\nexport const LayoutTypes = z.enum(['mosaic']);\nexport type LayoutTypes = z.infer<typeof MosaicLayoutDirection>;\n\nexport const MosaicLayoutDirection = z.enum(['row', 'column']);\nexport type MosaicLayoutDirection = z.infer<typeof MosaicLayoutDirection>;\n\nconst BaseMosaicLayoutParent = z.object({\n direction: MosaicLayoutDirection,\n splitPercentage: z.number().optional(),\n});\n\n// See https://zod.dev/?id=recursive-types\nexport const MosaicLayoutParent: z.ZodType<MosaicLayoutParent> =\n BaseMosaicLayoutParent.extend({\n first: z.lazy(() => MosaicLayoutNode),\n second: z.lazy(() => MosaicLayoutNode),\n });\nexport type MosaicLayoutParent = z.infer<typeof BaseMosaicLayoutParent> & {\n first: MosaicLayoutNode;\n second: MosaicLayoutNode;\n};\n\nexport function isMosaicLayoutParent(\n node: MosaicLayoutNode | null | undefined,\n): node is MosaicLayoutParent {\n return typeof node !== 'string';\n}\n\nexport const MosaicLayoutNodeKey = z.string();\nexport type MosaicLayoutNodeKey = z.infer<typeof MosaicLayoutNodeKey>;\n\nexport type MosaicLayoutNode = z.infer<typeof MosaicLayoutNode>;\nexport const MosaicLayoutNode = z.union([\n MosaicLayoutNodeKey,\n MosaicLayoutParent,\n]);\n\nexport const MosaicLayoutConfig = z.object({\n type: z.literal(LayoutTypes.enum.mosaic),\n nodes: MosaicLayoutNode.nullable(),\n pinned: z.array(MosaicLayoutNodeKey).optional(),\n fixed: z.array(MosaicLayoutNodeKey).optional(),\n});\nexport type MosaicLayoutConfig = z.infer<typeof MosaicLayoutConfig>;\n\nexport const LayoutConfig = z.discriminatedUnion('type', [MosaicLayoutConfig]);\n\nexport const DEFAULT_MOSAIC_LAYOUT: MosaicLayoutConfig = {\n type: LayoutTypes.enum.mosaic,\n nodes: MAIN_VIEW,\n};\n\nexport type LayoutConfig = z.infer<typeof LayoutConfig>;\n\nexport default LayoutConfig;\n"]}
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Enum representing supported file loading methods
|
|
4
|
+
* @enum {string}
|
|
5
|
+
*/
|
|
6
|
+
export declare const LoadFile: z.ZodEnum<["read_json", "read_ndjson", "read_parquet", "read_csv", "auto", "st_read"]>;
|
|
7
|
+
export type LoadFile = z.infer<typeof LoadFile>;
|
|
8
|
+
/**
|
|
9
|
+
* Standard options for loading data files
|
|
10
|
+
* @interface StandardLoadOptions
|
|
11
|
+
*/
|
|
12
|
+
export declare const StandardLoadOptions: z.ZodObject<{
|
|
13
|
+
/** Schema to load the table into */
|
|
14
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
15
|
+
/** Columns to select, defaults to ['*'] */
|
|
16
|
+
select: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
17
|
+
/** WHERE clause filter condition */
|
|
18
|
+
where: z.ZodOptional<z.ZodString>;
|
|
19
|
+
/** Whether to create as a view */
|
|
20
|
+
view: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
/** Whether to create as a temporary table */
|
|
22
|
+
temp: z.ZodOptional<z.ZodBoolean>;
|
|
23
|
+
/** Whether to replace existing table */
|
|
24
|
+
replace: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
+
}, "strip", z.ZodUnknown, z.objectOutputType<{
|
|
26
|
+
/** Schema to load the table into */
|
|
27
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
28
|
+
/** Columns to select, defaults to ['*'] */
|
|
29
|
+
select: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
30
|
+
/** WHERE clause filter condition */
|
|
31
|
+
where: z.ZodOptional<z.ZodString>;
|
|
32
|
+
/** Whether to create as a view */
|
|
33
|
+
view: z.ZodOptional<z.ZodBoolean>;
|
|
34
|
+
/** Whether to create as a temporary table */
|
|
35
|
+
temp: z.ZodOptional<z.ZodBoolean>;
|
|
36
|
+
/** Whether to replace existing table */
|
|
37
|
+
replace: z.ZodOptional<z.ZodBoolean>;
|
|
38
|
+
}, z.ZodUnknown, "strip">, z.objectInputType<{
|
|
39
|
+
/** Schema to load the table into */
|
|
40
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
41
|
+
/** Columns to select, defaults to ['*'] */
|
|
42
|
+
select: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
43
|
+
/** WHERE clause filter condition */
|
|
44
|
+
where: z.ZodOptional<z.ZodString>;
|
|
45
|
+
/** Whether to create as a view */
|
|
46
|
+
view: z.ZodOptional<z.ZodBoolean>;
|
|
47
|
+
/** Whether to create as a temporary table */
|
|
48
|
+
temp: z.ZodOptional<z.ZodBoolean>;
|
|
49
|
+
/** Whether to replace existing table */
|
|
50
|
+
replace: z.ZodOptional<z.ZodBoolean>;
|
|
51
|
+
}, z.ZodUnknown, "strip">>;
|
|
52
|
+
export type StandardLoadOptions = z.infer<typeof StandardLoadOptions>;
|
|
53
|
+
/**
|
|
54
|
+
* Extended options specifically for spatial data loading
|
|
55
|
+
* Includes all standard options plus spatial-specific parameters
|
|
56
|
+
* @interface SpatialLoadOptions
|
|
57
|
+
* @extends {StandardLoadOptions}
|
|
58
|
+
*/
|
|
59
|
+
export declare const SpatialLoadOptions: z.ZodObject<{
|
|
60
|
+
/** Schema to load the table into */
|
|
61
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
62
|
+
/** Columns to select, defaults to ['*'] */
|
|
63
|
+
select: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
64
|
+
/** WHERE clause filter condition */
|
|
65
|
+
where: z.ZodOptional<z.ZodString>;
|
|
66
|
+
/** Whether to create as a view */
|
|
67
|
+
view: z.ZodOptional<z.ZodBoolean>;
|
|
68
|
+
/** Whether to create as a temporary table */
|
|
69
|
+
temp: z.ZodOptional<z.ZodBoolean>;
|
|
70
|
+
/** Whether to replace existing table */
|
|
71
|
+
replace: z.ZodOptional<z.ZodBoolean>;
|
|
72
|
+
} & {
|
|
73
|
+
/** Additional options for spatial data loading */
|
|
74
|
+
options: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
|
|
75
|
+
}, "strip", z.ZodUnknown, z.objectOutputType<{
|
|
76
|
+
/** Schema to load the table into */
|
|
77
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
78
|
+
/** Columns to select, defaults to ['*'] */
|
|
79
|
+
select: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
80
|
+
/** WHERE clause filter condition */
|
|
81
|
+
where: z.ZodOptional<z.ZodString>;
|
|
82
|
+
/** Whether to create as a view */
|
|
83
|
+
view: z.ZodOptional<z.ZodBoolean>;
|
|
84
|
+
/** Whether to create as a temporary table */
|
|
85
|
+
temp: z.ZodOptional<z.ZodBoolean>;
|
|
86
|
+
/** Whether to replace existing table */
|
|
87
|
+
replace: z.ZodOptional<z.ZodBoolean>;
|
|
88
|
+
} & {
|
|
89
|
+
/** Additional options for spatial data loading */
|
|
90
|
+
options: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
|
|
91
|
+
}, z.ZodUnknown, "strip">, z.objectInputType<{
|
|
92
|
+
/** Schema to load the table into */
|
|
93
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
94
|
+
/** Columns to select, defaults to ['*'] */
|
|
95
|
+
select: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
96
|
+
/** WHERE clause filter condition */
|
|
97
|
+
where: z.ZodOptional<z.ZodString>;
|
|
98
|
+
/** Whether to create as a view */
|
|
99
|
+
view: z.ZodOptional<z.ZodBoolean>;
|
|
100
|
+
/** Whether to create as a temporary table */
|
|
101
|
+
temp: z.ZodOptional<z.ZodBoolean>;
|
|
102
|
+
/** Whether to replace existing table */
|
|
103
|
+
replace: z.ZodOptional<z.ZodBoolean>;
|
|
104
|
+
} & {
|
|
105
|
+
/** Additional options for spatial data loading */
|
|
106
|
+
options: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
|
|
107
|
+
}, z.ZodUnknown, "strip">>;
|
|
108
|
+
export type SpatialLoadOptions = z.infer<typeof SpatialLoadOptions>;
|
|
109
|
+
/**
|
|
110
|
+
* Options specific to spatial file loading with st_read method
|
|
111
|
+
* @interface SpatialLoadFileOptions
|
|
112
|
+
* @extends {SpatialLoadOptions}
|
|
113
|
+
*/
|
|
114
|
+
export declare const SpatialLoadFileOptions: z.ZodObject<{
|
|
115
|
+
/** Schema to load the table into */
|
|
116
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
117
|
+
/** Columns to select, defaults to ['*'] */
|
|
118
|
+
select: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
119
|
+
/** WHERE clause filter condition */
|
|
120
|
+
where: z.ZodOptional<z.ZodString>;
|
|
121
|
+
/** Whether to create as a view */
|
|
122
|
+
view: z.ZodOptional<z.ZodBoolean>;
|
|
123
|
+
/** Whether to create as a temporary table */
|
|
124
|
+
temp: z.ZodOptional<z.ZodBoolean>;
|
|
125
|
+
/** Whether to replace existing table */
|
|
126
|
+
replace: z.ZodOptional<z.ZodBoolean>;
|
|
127
|
+
} & {
|
|
128
|
+
/** Additional options for spatial data loading */
|
|
129
|
+
options: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
|
|
130
|
+
} & {
|
|
131
|
+
method: z.ZodLiteral<"st_read">;
|
|
132
|
+
}, "strip", z.ZodUnknown, z.objectOutputType<{
|
|
133
|
+
/** Schema to load the table into */
|
|
134
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
135
|
+
/** Columns to select, defaults to ['*'] */
|
|
136
|
+
select: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
137
|
+
/** WHERE clause filter condition */
|
|
138
|
+
where: z.ZodOptional<z.ZodString>;
|
|
139
|
+
/** Whether to create as a view */
|
|
140
|
+
view: z.ZodOptional<z.ZodBoolean>;
|
|
141
|
+
/** Whether to create as a temporary table */
|
|
142
|
+
temp: z.ZodOptional<z.ZodBoolean>;
|
|
143
|
+
/** Whether to replace existing table */
|
|
144
|
+
replace: z.ZodOptional<z.ZodBoolean>;
|
|
145
|
+
} & {
|
|
146
|
+
/** Additional options for spatial data loading */
|
|
147
|
+
options: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
|
|
148
|
+
} & {
|
|
149
|
+
method: z.ZodLiteral<"st_read">;
|
|
150
|
+
}, z.ZodUnknown, "strip">, z.objectInputType<{
|
|
151
|
+
/** Schema to load the table into */
|
|
152
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
153
|
+
/** Columns to select, defaults to ['*'] */
|
|
154
|
+
select: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
155
|
+
/** WHERE clause filter condition */
|
|
156
|
+
where: z.ZodOptional<z.ZodString>;
|
|
157
|
+
/** Whether to create as a view */
|
|
158
|
+
view: z.ZodOptional<z.ZodBoolean>;
|
|
159
|
+
/** Whether to create as a temporary table */
|
|
160
|
+
temp: z.ZodOptional<z.ZodBoolean>;
|
|
161
|
+
/** Whether to replace existing table */
|
|
162
|
+
replace: z.ZodOptional<z.ZodBoolean>;
|
|
163
|
+
} & {
|
|
164
|
+
/** Additional options for spatial data loading */
|
|
165
|
+
options: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
|
|
166
|
+
} & {
|
|
167
|
+
method: z.ZodLiteral<"st_read">;
|
|
168
|
+
}, z.ZodUnknown, "strip">>;
|
|
169
|
+
export type SpatialLoadFileOptions = z.infer<typeof SpatialLoadFileOptions>;
|
|
170
|
+
/**
|
|
171
|
+
* Type guard to check if options are spatial load file options
|
|
172
|
+
* @param {LoadFileOptions} options - The options to check
|
|
173
|
+
* @returns {boolean} True if options are spatial load file options
|
|
174
|
+
*/
|
|
175
|
+
export declare const isSpatialLoadFileOptions: (options: LoadFileOptions) => options is SpatialLoadFileOptions;
|
|
176
|
+
/**
|
|
177
|
+
* Standard file loading options excluding spatial methods
|
|
178
|
+
* @interface StandardLoadFileOptions
|
|
179
|
+
* @extends {StandardLoadOptions}
|
|
180
|
+
*/
|
|
181
|
+
export declare const StandardLoadFileOptions: z.ZodObject<{
|
|
182
|
+
/** Schema to load the table into */
|
|
183
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
184
|
+
/** Columns to select, defaults to ['*'] */
|
|
185
|
+
select: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
186
|
+
/** WHERE clause filter condition */
|
|
187
|
+
where: z.ZodOptional<z.ZodString>;
|
|
188
|
+
/** Whether to create as a view */
|
|
189
|
+
view: z.ZodOptional<z.ZodBoolean>;
|
|
190
|
+
/** Whether to create as a temporary table */
|
|
191
|
+
temp: z.ZodOptional<z.ZodBoolean>;
|
|
192
|
+
/** Whether to replace existing table */
|
|
193
|
+
replace: z.ZodOptional<z.ZodBoolean>;
|
|
194
|
+
} & {
|
|
195
|
+
method: z.ZodEnum<["read_json", "read_ndjson", "read_parquet", "read_csv", "auto"]>;
|
|
196
|
+
}, "strip", z.ZodUnknown, z.objectOutputType<{
|
|
197
|
+
/** Schema to load the table into */
|
|
198
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
199
|
+
/** Columns to select, defaults to ['*'] */
|
|
200
|
+
select: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
201
|
+
/** WHERE clause filter condition */
|
|
202
|
+
where: z.ZodOptional<z.ZodString>;
|
|
203
|
+
/** Whether to create as a view */
|
|
204
|
+
view: z.ZodOptional<z.ZodBoolean>;
|
|
205
|
+
/** Whether to create as a temporary table */
|
|
206
|
+
temp: z.ZodOptional<z.ZodBoolean>;
|
|
207
|
+
/** Whether to replace existing table */
|
|
208
|
+
replace: z.ZodOptional<z.ZodBoolean>;
|
|
209
|
+
} & {
|
|
210
|
+
method: z.ZodEnum<["read_json", "read_ndjson", "read_parquet", "read_csv", "auto"]>;
|
|
211
|
+
}, z.ZodUnknown, "strip">, z.objectInputType<{
|
|
212
|
+
/** Schema to load the table into */
|
|
213
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
214
|
+
/** Columns to select, defaults to ['*'] */
|
|
215
|
+
select: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
216
|
+
/** WHERE clause filter condition */
|
|
217
|
+
where: z.ZodOptional<z.ZodString>;
|
|
218
|
+
/** Whether to create as a view */
|
|
219
|
+
view: z.ZodOptional<z.ZodBoolean>;
|
|
220
|
+
/** Whether to create as a temporary table */
|
|
221
|
+
temp: z.ZodOptional<z.ZodBoolean>;
|
|
222
|
+
/** Whether to replace existing table */
|
|
223
|
+
replace: z.ZodOptional<z.ZodBoolean>;
|
|
224
|
+
} & {
|
|
225
|
+
method: z.ZodEnum<["read_json", "read_ndjson", "read_parquet", "read_csv", "auto"]>;
|
|
226
|
+
}, z.ZodUnknown, "strip">>;
|
|
227
|
+
export type StandardLoadFileOptions = z.infer<typeof StandardLoadFileOptions>;
|
|
228
|
+
/**
|
|
229
|
+
* Union type of all possible file loading options
|
|
230
|
+
* Discriminated union based on the 'method' field
|
|
231
|
+
*/
|
|
232
|
+
export declare const LoadFileOptions: z.ZodDiscriminatedUnion<"method", [z.ZodObject<{
|
|
233
|
+
/** Schema to load the table into */
|
|
234
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
235
|
+
/** Columns to select, defaults to ['*'] */
|
|
236
|
+
select: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
237
|
+
/** WHERE clause filter condition */
|
|
238
|
+
where: z.ZodOptional<z.ZodString>;
|
|
239
|
+
/** Whether to create as a view */
|
|
240
|
+
view: z.ZodOptional<z.ZodBoolean>;
|
|
241
|
+
/** Whether to create as a temporary table */
|
|
242
|
+
temp: z.ZodOptional<z.ZodBoolean>;
|
|
243
|
+
/** Whether to replace existing table */
|
|
244
|
+
replace: z.ZodOptional<z.ZodBoolean>;
|
|
245
|
+
} & {
|
|
246
|
+
method: z.ZodEnum<["read_json", "read_ndjson", "read_parquet", "read_csv", "auto"]>;
|
|
247
|
+
}, "strip", z.ZodUnknown, z.objectOutputType<{
|
|
248
|
+
/** Schema to load the table into */
|
|
249
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
250
|
+
/** Columns to select, defaults to ['*'] */
|
|
251
|
+
select: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
252
|
+
/** WHERE clause filter condition */
|
|
253
|
+
where: z.ZodOptional<z.ZodString>;
|
|
254
|
+
/** Whether to create as a view */
|
|
255
|
+
view: z.ZodOptional<z.ZodBoolean>;
|
|
256
|
+
/** Whether to create as a temporary table */
|
|
257
|
+
temp: z.ZodOptional<z.ZodBoolean>;
|
|
258
|
+
/** Whether to replace existing table */
|
|
259
|
+
replace: z.ZodOptional<z.ZodBoolean>;
|
|
260
|
+
} & {
|
|
261
|
+
method: z.ZodEnum<["read_json", "read_ndjson", "read_parquet", "read_csv", "auto"]>;
|
|
262
|
+
}, z.ZodUnknown, "strip">, z.objectInputType<{
|
|
263
|
+
/** Schema to load the table into */
|
|
264
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
265
|
+
/** Columns to select, defaults to ['*'] */
|
|
266
|
+
select: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
267
|
+
/** WHERE clause filter condition */
|
|
268
|
+
where: z.ZodOptional<z.ZodString>;
|
|
269
|
+
/** Whether to create as a view */
|
|
270
|
+
view: z.ZodOptional<z.ZodBoolean>;
|
|
271
|
+
/** Whether to create as a temporary table */
|
|
272
|
+
temp: z.ZodOptional<z.ZodBoolean>;
|
|
273
|
+
/** Whether to replace existing table */
|
|
274
|
+
replace: z.ZodOptional<z.ZodBoolean>;
|
|
275
|
+
} & {
|
|
276
|
+
method: z.ZodEnum<["read_json", "read_ndjson", "read_parquet", "read_csv", "auto"]>;
|
|
277
|
+
}, z.ZodUnknown, "strip">>, z.ZodObject<{
|
|
278
|
+
/** Schema to load the table into */
|
|
279
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
280
|
+
/** Columns to select, defaults to ['*'] */
|
|
281
|
+
select: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
282
|
+
/** WHERE clause filter condition */
|
|
283
|
+
where: z.ZodOptional<z.ZodString>;
|
|
284
|
+
/** Whether to create as a view */
|
|
285
|
+
view: z.ZodOptional<z.ZodBoolean>;
|
|
286
|
+
/** Whether to create as a temporary table */
|
|
287
|
+
temp: z.ZodOptional<z.ZodBoolean>;
|
|
288
|
+
/** Whether to replace existing table */
|
|
289
|
+
replace: z.ZodOptional<z.ZodBoolean>;
|
|
290
|
+
} & {
|
|
291
|
+
/** Additional options for spatial data loading */
|
|
292
|
+
options: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
|
|
293
|
+
} & {
|
|
294
|
+
method: z.ZodLiteral<"st_read">;
|
|
295
|
+
}, "strip", z.ZodUnknown, z.objectOutputType<{
|
|
296
|
+
/** Schema to load the table into */
|
|
297
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
298
|
+
/** Columns to select, defaults to ['*'] */
|
|
299
|
+
select: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
300
|
+
/** WHERE clause filter condition */
|
|
301
|
+
where: z.ZodOptional<z.ZodString>;
|
|
302
|
+
/** Whether to create as a view */
|
|
303
|
+
view: z.ZodOptional<z.ZodBoolean>;
|
|
304
|
+
/** Whether to create as a temporary table */
|
|
305
|
+
temp: z.ZodOptional<z.ZodBoolean>;
|
|
306
|
+
/** Whether to replace existing table */
|
|
307
|
+
replace: z.ZodOptional<z.ZodBoolean>;
|
|
308
|
+
} & {
|
|
309
|
+
/** Additional options for spatial data loading */
|
|
310
|
+
options: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
|
|
311
|
+
} & {
|
|
312
|
+
method: z.ZodLiteral<"st_read">;
|
|
313
|
+
}, z.ZodUnknown, "strip">, z.objectInputType<{
|
|
314
|
+
/** Schema to load the table into */
|
|
315
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
316
|
+
/** Columns to select, defaults to ['*'] */
|
|
317
|
+
select: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
318
|
+
/** WHERE clause filter condition */
|
|
319
|
+
where: z.ZodOptional<z.ZodString>;
|
|
320
|
+
/** Whether to create as a view */
|
|
321
|
+
view: z.ZodOptional<z.ZodBoolean>;
|
|
322
|
+
/** Whether to create as a temporary table */
|
|
323
|
+
temp: z.ZodOptional<z.ZodBoolean>;
|
|
324
|
+
/** Whether to replace existing table */
|
|
325
|
+
replace: z.ZodOptional<z.ZodBoolean>;
|
|
326
|
+
} & {
|
|
327
|
+
/** Additional options for spatial data loading */
|
|
328
|
+
options: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
|
|
329
|
+
} & {
|
|
330
|
+
method: z.ZodLiteral<"st_read">;
|
|
331
|
+
}, z.ZodUnknown, "strip">>]>;
|
|
332
|
+
export type LoadFileOptions = z.infer<typeof LoadFileOptions>;
|
|
333
|
+
//# sourceMappingURL=LoadOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadOptions.d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;;;;IAVxC,oCAAoC;;IAEpC,2CAA2C;;IAE3C,oCAAoC;;IAEpC,kCAAkC;;IAElC,6CAA6C;;IAE7C,wCAAwC;;;;;IAVxC,oCAAoC;;IAEpC,2CAA2C;;IAE3C,oCAAoC;;IAEpC,kCAAkC;;IAElC,6CAA6C;;IAE7C,wCAAwC;;;IAkB1C,kDAAkD;;;;;IA5BhD,oCAAoC;;IAEpC,2CAA2C;;IAE3C,oCAAoC;;IAEpC,kCAAkC;;IAElC,6CAA6C;;IAE7C,wCAAwC;;;IAkB1C,kDAAkD;;;;;IA5BhD,oCAAoC;;IAEpC,2CAA2C;;IAE3C,oCAAoC;;IAEpC,kCAAkC;;IAElC,6CAA6C;;IAE7C,wCAAwC;;;IAkB1C,kDAAkD;;;;4BA6ClD,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Enum representing supported file loading methods
|
|
4
|
+
* @enum {string}
|
|
5
|
+
*/
|
|
6
|
+
export const LoadFile = z.enum([
|
|
7
|
+
'read_json', // Read JSON files
|
|
8
|
+
'read_ndjson', // Read NDJSON (Newline Delimited JSON) files
|
|
9
|
+
'read_parquet', // Read Parquet files
|
|
10
|
+
'read_csv', // Read CSV files
|
|
11
|
+
'auto', // Auto-detect file format
|
|
12
|
+
'st_read', // Read spatial data files
|
|
13
|
+
]);
|
|
14
|
+
/**
|
|
15
|
+
* Standard options for loading data files
|
|
16
|
+
* @interface StandardLoadOptions
|
|
17
|
+
*/
|
|
18
|
+
export const StandardLoadOptions = z
|
|
19
|
+
.object({
|
|
20
|
+
/** Schema to load the table into */
|
|
21
|
+
schema: z.string().optional(),
|
|
22
|
+
/** Columns to select, defaults to ['*'] */
|
|
23
|
+
select: z.array(z.string()).optional(),
|
|
24
|
+
/** WHERE clause filter condition */
|
|
25
|
+
where: z.string().optional(),
|
|
26
|
+
/** Whether to create as a view */
|
|
27
|
+
view: z.boolean().optional(),
|
|
28
|
+
/** Whether to create as a temporary table */
|
|
29
|
+
temp: z.boolean().optional(),
|
|
30
|
+
/** Whether to replace existing table */
|
|
31
|
+
replace: z.boolean().optional(),
|
|
32
|
+
})
|
|
33
|
+
// The catchall allows for additional file-specific options that vary by file format:
|
|
34
|
+
// - CSV: delimiter, header, quote, escape, etc.
|
|
35
|
+
// - JSON: format, auto_detect, etc.
|
|
36
|
+
// - Parquet: specific parquet options
|
|
37
|
+
// These are passed through to the underlying DuckDB read functions
|
|
38
|
+
.catchall(z.unknown());
|
|
39
|
+
/**
|
|
40
|
+
* Extended options specifically for spatial data loading
|
|
41
|
+
* Includes all standard options plus spatial-specific parameters
|
|
42
|
+
* @interface SpatialLoadOptions
|
|
43
|
+
* @extends {StandardLoadOptions}
|
|
44
|
+
*/
|
|
45
|
+
export const SpatialLoadOptions = StandardLoadOptions.extend({
|
|
46
|
+
/** Additional options for spatial data loading */
|
|
47
|
+
options: z
|
|
48
|
+
.union([z.array(z.string()), z.string(), z.record(z.unknown())])
|
|
49
|
+
.optional(),
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* Options specific to spatial file loading with st_read method
|
|
53
|
+
* @interface SpatialLoadFileOptions
|
|
54
|
+
* @extends {SpatialLoadOptions}
|
|
55
|
+
*/
|
|
56
|
+
export const SpatialLoadFileOptions = SpatialLoadOptions.extend({
|
|
57
|
+
method: z.literal('st_read'),
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* Type guard to check if options are spatial load file options
|
|
61
|
+
* @param {LoadFileOptions} options - The options to check
|
|
62
|
+
* @returns {boolean} True if options are spatial load file options
|
|
63
|
+
*/
|
|
64
|
+
export const isSpatialLoadFileOptions = (options) => {
|
|
65
|
+
return options.method === 'st_read';
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Standard file loading options excluding spatial methods
|
|
69
|
+
* @interface StandardLoadFileOptions
|
|
70
|
+
* @extends {StandardLoadOptions}
|
|
71
|
+
*/
|
|
72
|
+
export const StandardLoadFileOptions = StandardLoadOptions.extend({
|
|
73
|
+
method: LoadFile.exclude(['st_read']),
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* Union type of all possible file loading options
|
|
77
|
+
* Discriminated union based on the 'method' field
|
|
78
|
+
*/
|
|
79
|
+
export const LoadFileOptions = z.discriminatedUnion('method', [
|
|
80
|
+
StandardLoadFileOptions,
|
|
81
|
+
SpatialLoadFileOptions,
|
|
82
|
+
]);
|
|
83
|
+
//# sourceMappingURL=LoadOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadOptions.js","sourceRoot":"","sources":["../src/LoadOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC;IAC7B,WAAW,EAAE,kBAAkB;IAC/B,aAAa,EAAE,6CAA6C;IAC5D,cAAc,EAAE,qBAAqB;IACrC,UAAU,EAAE,iBAAiB;IAC7B,MAAM,EAAE,0BAA0B;IAClC,SAAS,EAAE,0BAA0B;CACtC,CAAC,CAAC;AAGH;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC;KACjC,MAAM,CAAC;IACN,oCAAoC;IACpC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,2CAA2C;IAC3C,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACtC,oCAAoC;IACpC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,kCAAkC;IAClC,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC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Content":["import {z} from 'zod';\n\n/**\n * Enum representing supported file loading methods\n * @enum {string}\n */\nexport const LoadFile = z.enum([\n 'read_json', // Read JSON files\n 'read_ndjson', // Read NDJSON (Newline Delimited JSON) files\n 'read_parquet', // Read Parquet files\n 'read_csv', // Read CSV files\n 'auto', // Auto-detect file format\n 'st_read', // Read spatial data files\n]);\nexport type LoadFile = z.infer<typeof LoadFile>;\n\n/**\n * Standard options for loading data files\n * @interface StandardLoadOptions\n */\nexport const StandardLoadOptions = z\n .object({\n /** Schema to load the table into */\n schema: z.string().optional(),\n /** Columns to select, defaults to ['*'] */\n select: z.array(z.string()).optional(),\n /** WHERE clause filter condition */\n where: z.string().optional(),\n /** Whether to create as a view */\n view: z.boolean().optional(),\n /** Whether to create as a temporary table */\n temp: z.boolean().optional(),\n /** Whether to replace existing table */\n replace: z.boolean().optional(),\n })\n // The catchall allows for additional file-specific options that vary by file format:\n // - CSV: delimiter, header, quote, escape, etc.\n // - JSON: format, auto_detect, etc.\n // - Parquet: specific parquet options\n // These are passed through to the underlying DuckDB read functions\n .catchall(z.unknown());\nexport type StandardLoadOptions = z.infer<typeof StandardLoadOptions>;\n\n/**\n * Extended options specifically for spatial data loading\n * Includes all standard options plus spatial-specific parameters\n * @interface SpatialLoadOptions\n * @extends {StandardLoadOptions}\n */\nexport const SpatialLoadOptions = StandardLoadOptions.extend({\n /** Additional options for spatial data loading */\n options: z\n .union([z.array(z.string()), z.string(), z.record(z.unknown())])\n .optional(),\n});\nexport type SpatialLoadOptions = z.infer<typeof SpatialLoadOptions>;\n\n/**\n * Options specific to spatial file loading with st_read method\n * @interface SpatialLoadFileOptions\n * @extends {SpatialLoadOptions}\n */\nexport const SpatialLoadFileOptions = SpatialLoadOptions.extend({\n method: z.literal('st_read'),\n});\nexport type SpatialLoadFileOptions = z.infer<typeof SpatialLoadFileOptions>;\n\n/**\n * Type guard to check if options are spatial load file options\n * @param {LoadFileOptions} options - The options to check\n * @returns {boolean} True if options are spatial load file options\n */\nexport const isSpatialLoadFileOptions = (\n options: LoadFileOptions,\n): options is SpatialLoadFileOptions => {\n return options.method === 'st_read';\n};\n\n/**\n * Standard file loading options excluding spatial methods\n * @interface StandardLoadFileOptions\n * @extends {StandardLoadOptions}\n */\nexport const StandardLoadFileOptions = StandardLoadOptions.extend({\n method: LoadFile.exclude(['st_read']),\n});\nexport type StandardLoadFileOptions = z.infer<typeof StandardLoadFileOptions>;\n\n/**\n * Union type of all possible file loading options\n * Discriminated union based on the 'method' field\n */\nexport const LoadFileOptions = z.discriminatedUnion('method', [\n StandardLoadFileOptions,\n SpatialLoadFileOptions,\n]);\nexport type LoadFileOptions = z.infer<typeof LoadFileOptions>;\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC","sourcesContent":["/**\n * {@include ../README.md}\n * @packageDocumentation\n */\n\nexport * from './BaseRoomConfig';\nexport * from './LayoutConfig';\nexport * from './DataSource';\nexport * from './LoadOptions';\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sqlrooms/room-config",
|
|
3
|
+
"version": "0.17.0",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"author": "Ilya Boyandin <ilya@boyandin.me>",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/sqlrooms/sqlrooms.git"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"zod": "^3.25.57"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"react": ">=18"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"dev": "tsc -w",
|
|
28
|
+
"build": "tsc",
|
|
29
|
+
"lint": "eslint .",
|
|
30
|
+
"typecheck": "tsc --noEmit",
|
|
31
|
+
"typedoc": "typedoc"
|
|
32
|
+
},
|
|
33
|
+
"gitHead": "1f2a306da771481e2c89d8bfbd0507772167b1b5"
|
|
34
|
+
}
|