surreal-zod 0.0.0-alpha.10 → 0.0.0-alpha.12
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/lib/index.d.ts +4 -3
- package/lib/index.js +4 -3
- package/lib/registries.d.ts +7 -0
- package/lib/registries.js +5 -0
- package/lib/surql.d.ts +34 -17
- package/lib/surql.js +661 -265
- package/lib/zod/core.d.ts +262 -0
- package/lib/zod/core.js +10 -0
- package/lib/zod/index.d.ts +2 -0
- package/lib/zod/index.js +2 -0
- package/lib/zod/json-schema.d.ts +89 -0
- package/lib/zod/json-schema.js +629 -0
- package/lib/zod/original.d.ts +2 -0
- package/lib/zod/original.js +177 -0
- package/lib/zod/parse.d.ts +71 -0
- package/lib/zod/parse.js +17 -0
- package/lib/zod/schema.d.ts +1798 -233
- package/lib/zod/schema.js +2255 -278
- package/lib/zod/utils.d.ts +3 -2
- package/lib/zod/utils.js +0 -2
- package/package.json +6 -8
- package/src/index.ts +4 -3
- package/src/registries.ts +9 -0
- package/src/surql.ts +768 -324
- package/src/zod/core.ts +605 -0
- package/src/zod/index.ts +2 -0
- package/src/zod/json-schema.ts +892 -0
- package/src/zod/original.ts +369 -0
- package/src/zod/parse.ts +138 -0
- package/src/zod/schema.ts +7099 -984
- package/src/zod/utils.ts +15 -5
package/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
export {
|
|
3
|
-
export
|
|
1
|
+
import * as z from "./zod";
|
|
2
|
+
export { z };
|
|
3
|
+
export * from "./zod";
|
|
4
|
+
export default z;
|
package/lib/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
export {
|
|
3
|
-
export
|
|
1
|
+
import * as z from "./zod";
|
|
2
|
+
export { z };
|
|
3
|
+
export * from "./zod";
|
|
4
|
+
export default z;
|
package/lib/surql.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { BoundQuery, Table } from "surrealdb";
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
export declare function tableToSurql(table:
|
|
7
|
-
export declare function tableToSurql(table:
|
|
8
|
-
export declare function tableToSurql(table:
|
|
9
|
-
export declare function tableToSurql(table: SurrealZodTable, statement: "structure"): BoundQuery<[TableStructure]>;
|
|
2
|
+
import * as core from "zod/v4/core";
|
|
3
|
+
import * as _schema_ from "./zod/schema";
|
|
4
|
+
import * as _core_ from "./zod/core";
|
|
5
|
+
export declare function tableToSurql(table: _schema_.ZodSurrealTable, statement: "define", defineOptions?: DefineTableOptions): BoundQuery<[undefined]>;
|
|
6
|
+
export declare function tableToSurql(table: _schema_.ZodSurrealTable, statement: "remove", removeOptions?: RemoveTableOptions): BoundQuery<[undefined]>;
|
|
7
|
+
export declare function tableToSurql(table: _schema_.ZodSurrealTable, statement: "info"): BoundQuery<[TableInfo]>;
|
|
8
|
+
export declare function tableToSurql(table: _schema_.ZodSurrealTable, statement: "structure"): BoundQuery<[TableStructure]>;
|
|
10
9
|
export type RemoveTableOptions = {
|
|
11
10
|
/**
|
|
12
11
|
* What to do if the table is missing.
|
|
@@ -16,7 +15,7 @@ export type RemoveTableOptions = {
|
|
|
16
15
|
*/
|
|
17
16
|
missing?: "ignore" | "error";
|
|
18
17
|
};
|
|
19
|
-
export declare function removeTable(table:
|
|
18
|
+
export declare function removeTable(table: _schema_.ZodSurrealTable, options?: RemoveTableOptions): BoundQuery<[undefined]>;
|
|
20
19
|
export interface TableInfo {
|
|
21
20
|
events: Record<string, string>;
|
|
22
21
|
fields: Record<string, string>;
|
|
@@ -24,7 +23,7 @@ export interface TableInfo {
|
|
|
24
23
|
lives: Record<string, string>;
|
|
25
24
|
tables: Record<string, string>;
|
|
26
25
|
}
|
|
27
|
-
export declare function infoTable(table:
|
|
26
|
+
export declare function infoTable(table: _schema_.ZodSurrealTable): BoundQuery<[TableInfo]>;
|
|
28
27
|
export interface TableStructure {
|
|
29
28
|
events: unknown[];
|
|
30
29
|
fields: FieldStructure[];
|
|
@@ -43,15 +42,16 @@ export interface FieldStructure {
|
|
|
43
42
|
readonly: boolean;
|
|
44
43
|
what: string;
|
|
45
44
|
}
|
|
46
|
-
export declare function structureTable(table:
|
|
45
|
+
export declare function structureTable(table: _schema_.ZodSurrealTable): BoundQuery<[TableStructure]>;
|
|
47
46
|
export type DefineTableOptions = {
|
|
48
47
|
exists?: "ignore" | "error" | "overwrite";
|
|
49
48
|
fields?: boolean;
|
|
50
49
|
};
|
|
51
|
-
export declare function defineTable(schema:
|
|
52
|
-
export declare function
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
export declare function defineTable(schema: _schema_.ZodSurrealTable, options?: DefineTableOptions): BoundQuery<[undefined, ...undefined[]]>;
|
|
51
|
+
export declare function isRelationTable(table: unknown): table is _schema_.ZodSurrealTable<string, {
|
|
52
|
+
[K in "in" | "out" | "id"]: _schema_.ZodSurrealdRecordId;
|
|
53
|
+
}, _schema_.SurrealZodTableConfig, "relation">;
|
|
54
|
+
export interface ZodToSurqlOptions<S extends _schema_.ZodSurrealObject> {
|
|
55
55
|
table: string | Table;
|
|
56
56
|
schemafull?: boolean;
|
|
57
57
|
exists?: "ignore" | "error" | "overwrite";
|
|
@@ -62,16 +62,33 @@ export interface ZodToSurqlOptions<S extends z4.$ZodObject> {
|
|
|
62
62
|
export type DefineFieldOptions = {
|
|
63
63
|
exists?: "ignore" | "error" | "overwrite";
|
|
64
64
|
schemafull?: boolean;
|
|
65
|
+
default?: {
|
|
66
|
+
value: BoundQuery;
|
|
67
|
+
always?: boolean;
|
|
68
|
+
prase?: boolean;
|
|
69
|
+
};
|
|
70
|
+
comment?: string;
|
|
71
|
+
readonly?: boolean;
|
|
72
|
+
assert?: BoundQuery;
|
|
73
|
+
value?: BoundQuery;
|
|
65
74
|
};
|
|
75
|
+
export declare function defineField(name: string, table: string, schema: _core_.$ZodSurrealType, options?: DefineFieldOptions): BoundQuery<unknown[]>;
|
|
66
76
|
type ZodSurrealTypeContext = {
|
|
67
77
|
type: Set<string>;
|
|
78
|
+
parents: Set<_core_.$ZodSurrealType>;
|
|
79
|
+
fullParents: Set<_core_.$ZodSurrealType>;
|
|
68
80
|
depth: number;
|
|
69
81
|
children: ZodSurrealChildType[];
|
|
70
82
|
flexible: boolean;
|
|
71
83
|
};
|
|
72
84
|
type ZodSurrealChildType = {
|
|
73
85
|
name: string;
|
|
74
|
-
type:
|
|
86
|
+
type: core.$ZodType;
|
|
87
|
+
};
|
|
88
|
+
export declare function inferSurrealType(type: _core_.$ZodSurrealType, context?: ZodSurrealTypeContext): {
|
|
89
|
+
type: string;
|
|
90
|
+
context: ZodSurrealTypeContext;
|
|
75
91
|
};
|
|
76
|
-
export declare function
|
|
92
|
+
export declare function formatQuery(query: string): string;
|
|
93
|
+
export declare function inlineQueryParameters(query: BoundQuery): string;
|
|
77
94
|
export {};
|