@live-state/sync 0.0.4-beta.1 → 0.0.4-beta.10

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,282 @@
1
+ type LiveTypeMeta = {};
2
+ type MutationType = "set";
3
+ type StorageFieldType = {
4
+ type: string;
5
+ nullable: boolean;
6
+ default?: any;
7
+ unique?: boolean;
8
+ index?: boolean;
9
+ primary?: boolean;
10
+ references?: string;
11
+ };
12
+ declare abstract class LiveType<Value = any, Meta extends LiveTypeMeta = LiveTypeMeta, EncodeInput = Partial<Value> | Value, DecodeInput = {
13
+ value: Value;
14
+ _meta: keyof Meta extends never ? never : Meta;
15
+ }> {
16
+ readonly _value: Value;
17
+ readonly _meta: Meta;
18
+ readonly _encodeInput: EncodeInput;
19
+ readonly _decodeInput: DecodeInput;
20
+ abstract encodeMutation(mutationType: MutationType, input: EncodeInput, timestamp: string): DecodeInput;
21
+ /**
22
+ * Merges the materialized shape with the encoded mutation
23
+ * @param mutationType The type of mutation
24
+ * @param encodedMutation The encoded mutation
25
+ * @param materializedShape The materialized shape
26
+ * @returns A tuple of the new materialized shape and the accepted diff
27
+ */
28
+ abstract mergeMutation(mutationType: MutationType, encodedMutation: DecodeInput, materializedShape?: MaterializedLiveType<LiveType<Value, Meta>>): [MaterializedLiveType<LiveType<Value, Meta>>, DecodeInput | null];
29
+ abstract getStorageFieldType(): StorageFieldType;
30
+ }
31
+ type LiveTypeAny = LiveType<any, LiveTypeMeta, any, any>;
32
+ type InferLiveType<T extends LiveTypeAny> = T["_value"] extends Record<string, LiveTypeAny> ? {
33
+ [K in keyof T["_value"]]: InferLiveType<T["_value"][K]>;
34
+ } : T["_value"];
35
+ type InferIndex<T extends LiveTypeAny> = string;
36
+
37
+ declare class NullableLiveType<T extends LiveTypeAny> extends LiveType<T["_value"] | null, T["_meta"], T["_encodeInput"], T["_decodeInput"]> {
38
+ readonly inner: T;
39
+ constructor(inner: T);
40
+ encodeMutation(mutationType: MutationType, input: T["_value"] | null, timestamp: string): T["_decodeInput"];
41
+ mergeMutation(mutationType: MutationType, encodedMutation: T["_decodeInput"], materializedShape?: MaterializedLiveType<LiveType<T["_value"] | null, T["_meta"], T["_value"] | Partial<T["_value"] | null>, T["_decodeInput"]>> | undefined): [
42
+ MaterializedLiveType<LiveType<T["_value"] | null, T["_meta"], T["_value"] | Partial<T["_value"] | null>, T["_decodeInput"]>>,
43
+ T["_decodeInput"] | null
44
+ ];
45
+ getStorageFieldType(): StorageFieldType;
46
+ }
47
+ type LiveAtomicTypeMeta = {
48
+ timestamp: string | null;
49
+ } & LiveTypeMeta;
50
+ declare class LiveAtomicType<Value, DefaultValue = undefined> extends LiveType<Value, LiveAtomicTypeMeta, Value, {
51
+ value: Value;
52
+ _meta: LiveAtomicTypeMeta;
53
+ }> {
54
+ readonly storageType: string;
55
+ readonly convertFunc?: (value: any) => Value;
56
+ readonly isIndex: boolean;
57
+ readonly isUnique: boolean;
58
+ readonly defaultValue: DefaultValue;
59
+ readonly foreignReference?: string;
60
+ readonly isPrimary: boolean;
61
+ constructor(storageType: string, convertFunc?: (value: any) => Value, index?: boolean, unique?: boolean, defaultValue?: DefaultValue, references?: string, primary?: boolean);
62
+ encodeMutation(mutationType: MutationType, input: Value, timestamp: string): {
63
+ value: Value;
64
+ _meta: LiveAtomicTypeMeta;
65
+ };
66
+ mergeMutation(mutationType: MutationType, encodedMutation: {
67
+ value: Value;
68
+ _meta: LiveAtomicTypeMeta;
69
+ }, materializedShape?: MaterializedLiveType<LiveType<Value, LiveAtomicTypeMeta, Value | Partial<Value>, {
70
+ value: Value;
71
+ _meta: LiveAtomicTypeMeta;
72
+ }>>): [
73
+ MaterializedLiveType<LiveType<Value, LiveAtomicTypeMeta, Value | Partial<Value>, {
74
+ value: Value;
75
+ _meta: LiveAtomicTypeMeta;
76
+ }>>,
77
+ {
78
+ value: Value;
79
+ _meta: LiveAtomicTypeMeta;
80
+ } | null
81
+ ];
82
+ getStorageFieldType(): StorageFieldType;
83
+ unique(): LiveAtomicType<Value, undefined>;
84
+ index(): LiveAtomicType<Value, undefined>;
85
+ default(value: Value): LiveAtomicType<Value, Value>;
86
+ primary(): LiveAtomicType<Value, undefined>;
87
+ nullable(): NullableLiveType<this>;
88
+ }
89
+ declare class LiveNumber extends LiveAtomicType<number> {
90
+ private constructor();
91
+ static create(): LiveNumber;
92
+ }
93
+ declare const number: typeof LiveNumber.create;
94
+ declare class LiveString extends LiveAtomicType<string> {
95
+ private constructor();
96
+ static create(): LiveString;
97
+ static createId(): LiveAtomicType<string, undefined>;
98
+ static createReference(foreignField: `${string}.${string}`): LiveString;
99
+ }
100
+ declare const string: typeof LiveString.create;
101
+ declare const id: typeof LiveString.createId;
102
+ declare const reference: typeof LiveString.createReference;
103
+ declare class LiveBoolean extends LiveAtomicType<boolean> {
104
+ private constructor();
105
+ static create(): LiveBoolean;
106
+ }
107
+ declare const boolean: typeof LiveBoolean.create;
108
+ declare class LiveTimestamp extends LiveAtomicType<Date> {
109
+ private constructor();
110
+ static create(): LiveTimestamp;
111
+ }
112
+ declare const timestamp: typeof LiveTimestamp.create;
113
+
114
+ /** biome-ignore-all lint/complexity/noBannedTypes: false positive */
115
+
116
+ type InferLiveObjectWithoutRelations<T extends LiveObjectAny> = {
117
+ [K in keyof T["fields"]]: InferLiveType<T["fields"][K]>;
118
+ };
119
+ type InferLiveObject<T extends LiveObjectAny, Include extends IncludeClause<T> | undefined = undefined> = InferLiveObjectWithoutRelations<T> & (Include extends IncludeClause<T> ? {
120
+ [K in keyof T["relations"] as Include[K] extends true ? K : never]: T["relations"][K]["type"] extends "one" ? T["fields"][Exclude<T["relations"][K]["relationalColumn"], undefined>] extends NullableLiveType<any> ? InferLiveObject<T["relations"][K]["entity"]> | null : InferLiveObject<T["relations"][K]["entity"]> : InferLiveObject<T["relations"][K]["entity"]>[];
121
+ } : {});
122
+ type InferRelationalColumns<T extends Record<string, RelationAny>> = {
123
+ [K in keyof T as T[K]["type"] extends "many" ? never : T[K]["relationalColumn"]]: T[K]["required"] extends true ? InferIndex<T[K]["entity"]> : InferIndex<T[K]["entity"]> | null;
124
+ };
125
+ type InferLiveObjectWithRelationalIds<T extends LiveObjectAny> = keyof T["relations"] extends string ? InferLiveObjectWithoutRelations<T> & InferRelationalColumns<T["relations"]> : InferLiveObjectWithoutRelations<T>;
126
+ type LiveObjectMutationInput<TSchema extends LiveObjectAny> = Partial<InferLiveObjectWithRelationalIds<TSchema>>;
127
+ declare class LiveObject<TName extends string, TSchema extends Record<string, LiveTypeAny>, TRelations extends Record<string, RelationAny>> extends LiveType<TSchema, LiveTypeMeta, LiveObjectMutationInput<any>, Record<string, MaterializedLiveType<LiveTypeAny>>> {
128
+ readonly name: TName;
129
+ readonly fields: TSchema;
130
+ readonly relations: TRelations;
131
+ constructor(name: TName, fields: TSchema, relations?: TRelations);
132
+ encodeMutation(_mutationType: MutationType, input: LiveObjectMutationInput<this>, timestamp: string): Record<string, any>;
133
+ mergeMutation(mutationType: MutationType, encodedMutations: Record<string, MaterializedLiveType<LiveTypeAny>>, materializedShape?: MaterializedLiveType<this> | undefined): [MaterializedLiveType<this>, Record<string, any> | null];
134
+ setRelations<TRelations extends Record<string, RelationAny>>(relations: TRelations): LiveObject<this["name"], this["fields"], TRelations>;
135
+ getStorageFieldType(): StorageFieldType;
136
+ static create<TName extends string, TSchema extends Record<string, LiveTypeAny>>(name: TName, schema: TSchema): LiveObject<TName, TSchema, never>;
137
+ }
138
+ declare const object: typeof LiveObject.create;
139
+ type LiveObjectAny = LiveObject<string, Record<string, LiveTypeAny>, any>;
140
+ declare class Relation<TEntity extends LiveObjectAny, TSourceEntity extends LiveObjectAny, TType extends "one" | "many", TRelationalColumn extends keyof TSourceEntity["fields"], TForeignColumn extends keyof TEntity["fields"], TRequired extends boolean> extends LiveType<InferIndex<TEntity>, {
141
+ timestamp: string | null;
142
+ } & LiveTypeMeta> {
143
+ readonly entity: TEntity;
144
+ readonly type: TType;
145
+ readonly required: TRequired;
146
+ readonly relationalColumn?: TRelationalColumn;
147
+ readonly foreignColumn?: TForeignColumn;
148
+ readonly sourceEntity: TSourceEntity;
149
+ private constructor();
150
+ encodeMutation(mutationType: MutationType, input: string, timestamp: string): {
151
+ value: string;
152
+ _meta: {
153
+ timestamp: string;
154
+ };
155
+ };
156
+ mergeMutation(mutationType: MutationType, encodedMutation: {
157
+ value: string;
158
+ _meta: {
159
+ timestamp: string;
160
+ };
161
+ }, materializedShape?: MaterializedLiveType<LiveString> | undefined): [
162
+ MaterializedLiveType<LiveString>,
163
+ {
164
+ value: string;
165
+ _meta: {
166
+ timestamp: string;
167
+ };
168
+ } | null
169
+ ];
170
+ getStorageFieldType(): StorageFieldType;
171
+ toJSON(): {
172
+ entityName: string;
173
+ type: TType;
174
+ required: TRequired;
175
+ relationalColumn: TRelationalColumn | undefined;
176
+ foreignColumn: TForeignColumn | undefined;
177
+ };
178
+ static createOneFactory<TOriginEntity extends LiveObjectAny>(): <TEntity extends LiveObjectAny, TColumn extends keyof TOriginEntity["fields"], TRequired extends boolean = false>(entity: TEntity, column: TColumn, required?: TRequired) => Relation<TEntity, TOriginEntity, "one", TColumn, never, TRequired>;
179
+ static createManyFactory<TOriginEntity extends LiveObjectAny>(): <TEntity extends LiveObjectAny, TColumn extends keyof TEntity["fields"], TRequired extends boolean = false>(entity: TEntity, foreignColumn: TColumn, required?: TRequired) => Relation<TEntity, TOriginEntity, "many", never, TColumn, TRequired>;
180
+ }
181
+ type RelationAny = Relation<LiveObjectAny, LiveObjectAny, any, any, any, any>;
182
+ declare const createRelations: <TSourceObject extends LiveObjectAny, TRelations extends Record<string, RelationAny>>(liveObject: TSourceObject, factory: (connectors: {
183
+ one: ReturnType<typeof Relation.createOneFactory<TSourceObject>>;
184
+ many: ReturnType<typeof Relation.createManyFactory<TSourceObject>>;
185
+ }) => TRelations) => RelationsDecl<TSourceObject["name"], TRelations>;
186
+ type MaterializedLiveType<T extends LiveTypeAny> = {
187
+ value: T["_value"] extends Record<string, LiveTypeAny> ? {
188
+ [K in keyof T["_value"]]: MaterializedLiveType<T["_value"][K]>;
189
+ } : T["_value"];
190
+ _meta: T["_meta"];
191
+ };
192
+ declare const inferValue: <T extends LiveTypeAny>(type?: MaterializedLiveType<T>) => InferLiveType<T> | undefined;
193
+ type ExtractObjectValues<T> = T[keyof T];
194
+ type RelationsDecl<TObjectName extends string = string, TRelations extends Record<string, RelationAny> = Record<string, RelationAny>> = {
195
+ $type: "relations";
196
+ objectName: TObjectName;
197
+ relations: TRelations;
198
+ };
199
+ type ParseRelationsFromSchema<TRawSchema extends RawSchema, TObjectName extends string> = ExtractObjectValues<{
200
+ [K in keyof TRawSchema]: TRawSchema[K] extends RelationsDecl<infer TObjectName_, any> ? TObjectName_ extends TObjectName ? {
201
+ [K2 in keyof TRawSchema[K]["relations"]]: Relation<ParseObjectFromSchema<TRawSchema, TRawSchema[K]["relations"][K2]["entity"]["name"]>, TRawSchema[K]["relations"][K2]["sourceEntity"], TRawSchema[K]["relations"][K2]["type"], Exclude<TRawSchema[K]["relations"][K2]["relationalColumn"], undefined>, Exclude<TRawSchema[K]["relations"][K2]["foreignColumn"], undefined>, TRawSchema[K]["relations"][K2]["required"]>;
202
+ } : never : never;
203
+ }>;
204
+ type ParseObjectFromSchema<TRawSchema extends RawSchema, TObjectName extends string> = ExtractObjectValues<{
205
+ [K in keyof TRawSchema]: TRawSchema[K] extends LiveObjectAny ? TRawSchema[K]["name"] extends TObjectName ? LiveObject<TRawSchema[K]["name"], TRawSchema[K]["fields"], ParseRelationsFromSchema<TRawSchema, TRawSchema[K]["name"]>> : never : never;
206
+ }>;
207
+ type RawSchema = Record<string, LiveObjectAny | RelationsDecl>;
208
+ type Schema<TRawSchema extends RawSchema> = {
209
+ [K in keyof TRawSchema as TRawSchema[K] extends LiveObjectAny ? TRawSchema[K]["name"] : never]: TRawSchema[K] extends LiveObjectAny ? ParseObjectFromSchema<TRawSchema, TRawSchema[K]["name"]> : never;
210
+ };
211
+ declare const createSchema: <TRawSchema extends RawSchema>(schema: TRawSchema) => Schema<TRawSchema>;
212
+ type WhereClause<T extends LiveObjectAny> = ({
213
+ [K in keyof T["fields"]]?: InferLiveType<T["fields"][K]> | ({
214
+ $eq?: InferLiveType<T["fields"][K]>;
215
+ $in?: InferLiveType<T["fields"][K]>[];
216
+ $not?: InferLiveType<T["fields"][K]> | {
217
+ $in?: InferLiveType<T["fields"][K]>[];
218
+ $eq?: InferLiveType<T["fields"][K]>;
219
+ };
220
+ } & (Exclude<InferLiveType<T["fields"][K]>, null | undefined> extends number | Date ? {
221
+ $gt?: InferLiveType<T["fields"][K]>;
222
+ $gte?: InferLiveType<T["fields"][K]>;
223
+ $lt?: InferLiveType<T["fields"][K]>;
224
+ $lte?: InferLiveType<T["fields"][K]>;
225
+ } : {}));
226
+ } & {
227
+ [K in keyof T["relations"]]?: WhereClause<T["relations"][K]["entity"]>;
228
+ }) | {
229
+ $and?: WhereClause<T>[];
230
+ $or?: WhereClause<T>[];
231
+ };
232
+ type IncludeClause<T extends LiveObjectAny> = {
233
+ [K in keyof T["relations"]]?: boolean | IncludeClause<T["relations"][K]["entity"]>;
234
+ };
235
+ type GetFieldType<T> = T extends NullableLiveType<any> ? T["inner"] : T;
236
+ type HasDefaultValue<T> = T extends LiveAtomicType<any, undefined> ? false : true;
237
+ type InferInsert<T extends LiveObjectAny> = {
238
+ [K in keyof T["fields"] as HasDefaultValue<GetFieldType<T["fields"][K]>> extends true ? never : K]: InferLiveType<T["fields"][K]>;
239
+ } & {
240
+ [K in keyof T["fields"] as HasDefaultValue<GetFieldType<T["fields"][K]>> extends false ? never : K]?: InferLiveType<T["fields"][K]>;
241
+ };
242
+ type InferUpdate<T extends LiveObjectAny> = Omit<LiveObjectMutationInput<T>, "id">;
243
+
244
+ type Simplify<T> = T extends Record<string, unknown> ? {
245
+ [K in keyof T]: Simplify<T[K]>;
246
+ } : T extends Array<infer U> ? Array<Simplify<U>> : T;
247
+ declare const LogLevel: {
248
+ readonly CRITICAL: 0;
249
+ readonly ERROR: 1;
250
+ readonly WARN: 2;
251
+ readonly INFO: 3;
252
+ readonly DEBUG: 4;
253
+ };
254
+ type LogLevel = (typeof LogLevel)[keyof typeof LogLevel];
255
+ /**
256
+ * Logger configuration options
257
+ */
258
+ interface LoggerOptions {
259
+ /**
260
+ * Minimum log level to display. Anything below this level will be muted.
261
+ * @default LogLevel.INFO
262
+ */
263
+ level?: LogLevel;
264
+ /**
265
+ * Optional prefix to add to all log messages
266
+ */
267
+ prefix?: string;
268
+ }
269
+ declare class Logger {
270
+ private level;
271
+ private prefix;
272
+ constructor(options?: LoggerOptions);
273
+ critical(...args: any[]): void;
274
+ error(...args: any[]): void;
275
+ warn(...args: any[]): void;
276
+ info(...args: any[]): void;
277
+ debug(...args: any[]): void;
278
+ setLevel(level: LogLevel): void;
279
+ getLevel(): LogLevel;
280
+ }
281
+
282
+ export { type MutationType as A, type StorageFieldType as B, LiveType as C, type LiveTypeAny as D, type InferLiveType as E, type InferIndex as F, type InferLiveObjectWithRelationalIds as I, type LiveObjectAny as L, type MaterializedLiveType as M, NullableLiveType as N, Relation as R, type Simplify as S, type WhereClause as W, type Schema as a, type IncludeClause as b, type InferLiveObject as c, type InferInsert as d, type InferUpdate as e, Logger as f, LogLevel as g, type InferLiveObjectWithoutRelations as h, type LiveObjectMutationInput as i, LiveObject as j, createRelations as k, inferValue as l, createSchema as m, LiveAtomicType as n, object as o, LiveNumber as p, number as q, LiveString as r, string as s, id as t, reference as u, LiveBoolean as v, boolean as w, LiveTimestamp as x, timestamp as y, type LiveTypeMeta as z };
@@ -0,0 +1,282 @@
1
+ type LiveTypeMeta = {};
2
+ type MutationType = "set";
3
+ type StorageFieldType = {
4
+ type: string;
5
+ nullable: boolean;
6
+ default?: any;
7
+ unique?: boolean;
8
+ index?: boolean;
9
+ primary?: boolean;
10
+ references?: string;
11
+ };
12
+ declare abstract class LiveType<Value = any, Meta extends LiveTypeMeta = LiveTypeMeta, EncodeInput = Partial<Value> | Value, DecodeInput = {
13
+ value: Value;
14
+ _meta: keyof Meta extends never ? never : Meta;
15
+ }> {
16
+ readonly _value: Value;
17
+ readonly _meta: Meta;
18
+ readonly _encodeInput: EncodeInput;
19
+ readonly _decodeInput: DecodeInput;
20
+ abstract encodeMutation(mutationType: MutationType, input: EncodeInput, timestamp: string): DecodeInput;
21
+ /**
22
+ * Merges the materialized shape with the encoded mutation
23
+ * @param mutationType The type of mutation
24
+ * @param encodedMutation The encoded mutation
25
+ * @param materializedShape The materialized shape
26
+ * @returns A tuple of the new materialized shape and the accepted diff
27
+ */
28
+ abstract mergeMutation(mutationType: MutationType, encodedMutation: DecodeInput, materializedShape?: MaterializedLiveType<LiveType<Value, Meta>>): [MaterializedLiveType<LiveType<Value, Meta>>, DecodeInput | null];
29
+ abstract getStorageFieldType(): StorageFieldType;
30
+ }
31
+ type LiveTypeAny = LiveType<any, LiveTypeMeta, any, any>;
32
+ type InferLiveType<T extends LiveTypeAny> = T["_value"] extends Record<string, LiveTypeAny> ? {
33
+ [K in keyof T["_value"]]: InferLiveType<T["_value"][K]>;
34
+ } : T["_value"];
35
+ type InferIndex<T extends LiveTypeAny> = string;
36
+
37
+ declare class NullableLiveType<T extends LiveTypeAny> extends LiveType<T["_value"] | null, T["_meta"], T["_encodeInput"], T["_decodeInput"]> {
38
+ readonly inner: T;
39
+ constructor(inner: T);
40
+ encodeMutation(mutationType: MutationType, input: T["_value"] | null, timestamp: string): T["_decodeInput"];
41
+ mergeMutation(mutationType: MutationType, encodedMutation: T["_decodeInput"], materializedShape?: MaterializedLiveType<LiveType<T["_value"] | null, T["_meta"], T["_value"] | Partial<T["_value"] | null>, T["_decodeInput"]>> | undefined): [
42
+ MaterializedLiveType<LiveType<T["_value"] | null, T["_meta"], T["_value"] | Partial<T["_value"] | null>, T["_decodeInput"]>>,
43
+ T["_decodeInput"] | null
44
+ ];
45
+ getStorageFieldType(): StorageFieldType;
46
+ }
47
+ type LiveAtomicTypeMeta = {
48
+ timestamp: string | null;
49
+ } & LiveTypeMeta;
50
+ declare class LiveAtomicType<Value, DefaultValue = undefined> extends LiveType<Value, LiveAtomicTypeMeta, Value, {
51
+ value: Value;
52
+ _meta: LiveAtomicTypeMeta;
53
+ }> {
54
+ readonly storageType: string;
55
+ readonly convertFunc?: (value: any) => Value;
56
+ readonly isIndex: boolean;
57
+ readonly isUnique: boolean;
58
+ readonly defaultValue: DefaultValue;
59
+ readonly foreignReference?: string;
60
+ readonly isPrimary: boolean;
61
+ constructor(storageType: string, convertFunc?: (value: any) => Value, index?: boolean, unique?: boolean, defaultValue?: DefaultValue, references?: string, primary?: boolean);
62
+ encodeMutation(mutationType: MutationType, input: Value, timestamp: string): {
63
+ value: Value;
64
+ _meta: LiveAtomicTypeMeta;
65
+ };
66
+ mergeMutation(mutationType: MutationType, encodedMutation: {
67
+ value: Value;
68
+ _meta: LiveAtomicTypeMeta;
69
+ }, materializedShape?: MaterializedLiveType<LiveType<Value, LiveAtomicTypeMeta, Value | Partial<Value>, {
70
+ value: Value;
71
+ _meta: LiveAtomicTypeMeta;
72
+ }>>): [
73
+ MaterializedLiveType<LiveType<Value, LiveAtomicTypeMeta, Value | Partial<Value>, {
74
+ value: Value;
75
+ _meta: LiveAtomicTypeMeta;
76
+ }>>,
77
+ {
78
+ value: Value;
79
+ _meta: LiveAtomicTypeMeta;
80
+ } | null
81
+ ];
82
+ getStorageFieldType(): StorageFieldType;
83
+ unique(): LiveAtomicType<Value, undefined>;
84
+ index(): LiveAtomicType<Value, undefined>;
85
+ default(value: Value): LiveAtomicType<Value, Value>;
86
+ primary(): LiveAtomicType<Value, undefined>;
87
+ nullable(): NullableLiveType<this>;
88
+ }
89
+ declare class LiveNumber extends LiveAtomicType<number> {
90
+ private constructor();
91
+ static create(): LiveNumber;
92
+ }
93
+ declare const number: typeof LiveNumber.create;
94
+ declare class LiveString extends LiveAtomicType<string> {
95
+ private constructor();
96
+ static create(): LiveString;
97
+ static createId(): LiveAtomicType<string, undefined>;
98
+ static createReference(foreignField: `${string}.${string}`): LiveString;
99
+ }
100
+ declare const string: typeof LiveString.create;
101
+ declare const id: typeof LiveString.createId;
102
+ declare const reference: typeof LiveString.createReference;
103
+ declare class LiveBoolean extends LiveAtomicType<boolean> {
104
+ private constructor();
105
+ static create(): LiveBoolean;
106
+ }
107
+ declare const boolean: typeof LiveBoolean.create;
108
+ declare class LiveTimestamp extends LiveAtomicType<Date> {
109
+ private constructor();
110
+ static create(): LiveTimestamp;
111
+ }
112
+ declare const timestamp: typeof LiveTimestamp.create;
113
+
114
+ /** biome-ignore-all lint/complexity/noBannedTypes: false positive */
115
+
116
+ type InferLiveObjectWithoutRelations<T extends LiveObjectAny> = {
117
+ [K in keyof T["fields"]]: InferLiveType<T["fields"][K]>;
118
+ };
119
+ type InferLiveObject<T extends LiveObjectAny, Include extends IncludeClause<T> | undefined = undefined> = InferLiveObjectWithoutRelations<T> & (Include extends IncludeClause<T> ? {
120
+ [K in keyof T["relations"] as Include[K] extends true ? K : never]: T["relations"][K]["type"] extends "one" ? T["fields"][Exclude<T["relations"][K]["relationalColumn"], undefined>] extends NullableLiveType<any> ? InferLiveObject<T["relations"][K]["entity"]> | null : InferLiveObject<T["relations"][K]["entity"]> : InferLiveObject<T["relations"][K]["entity"]>[];
121
+ } : {});
122
+ type InferRelationalColumns<T extends Record<string, RelationAny>> = {
123
+ [K in keyof T as T[K]["type"] extends "many" ? never : T[K]["relationalColumn"]]: T[K]["required"] extends true ? InferIndex<T[K]["entity"]> : InferIndex<T[K]["entity"]> | null;
124
+ };
125
+ type InferLiveObjectWithRelationalIds<T extends LiveObjectAny> = keyof T["relations"] extends string ? InferLiveObjectWithoutRelations<T> & InferRelationalColumns<T["relations"]> : InferLiveObjectWithoutRelations<T>;
126
+ type LiveObjectMutationInput<TSchema extends LiveObjectAny> = Partial<InferLiveObjectWithRelationalIds<TSchema>>;
127
+ declare class LiveObject<TName extends string, TSchema extends Record<string, LiveTypeAny>, TRelations extends Record<string, RelationAny>> extends LiveType<TSchema, LiveTypeMeta, LiveObjectMutationInput<any>, Record<string, MaterializedLiveType<LiveTypeAny>>> {
128
+ readonly name: TName;
129
+ readonly fields: TSchema;
130
+ readonly relations: TRelations;
131
+ constructor(name: TName, fields: TSchema, relations?: TRelations);
132
+ encodeMutation(_mutationType: MutationType, input: LiveObjectMutationInput<this>, timestamp: string): Record<string, any>;
133
+ mergeMutation(mutationType: MutationType, encodedMutations: Record<string, MaterializedLiveType<LiveTypeAny>>, materializedShape?: MaterializedLiveType<this> | undefined): [MaterializedLiveType<this>, Record<string, any> | null];
134
+ setRelations<TRelations extends Record<string, RelationAny>>(relations: TRelations): LiveObject<this["name"], this["fields"], TRelations>;
135
+ getStorageFieldType(): StorageFieldType;
136
+ static create<TName extends string, TSchema extends Record<string, LiveTypeAny>>(name: TName, schema: TSchema): LiveObject<TName, TSchema, never>;
137
+ }
138
+ declare const object: typeof LiveObject.create;
139
+ type LiveObjectAny = LiveObject<string, Record<string, LiveTypeAny>, any>;
140
+ declare class Relation<TEntity extends LiveObjectAny, TSourceEntity extends LiveObjectAny, TType extends "one" | "many", TRelationalColumn extends keyof TSourceEntity["fields"], TForeignColumn extends keyof TEntity["fields"], TRequired extends boolean> extends LiveType<InferIndex<TEntity>, {
141
+ timestamp: string | null;
142
+ } & LiveTypeMeta> {
143
+ readonly entity: TEntity;
144
+ readonly type: TType;
145
+ readonly required: TRequired;
146
+ readonly relationalColumn?: TRelationalColumn;
147
+ readonly foreignColumn?: TForeignColumn;
148
+ readonly sourceEntity: TSourceEntity;
149
+ private constructor();
150
+ encodeMutation(mutationType: MutationType, input: string, timestamp: string): {
151
+ value: string;
152
+ _meta: {
153
+ timestamp: string;
154
+ };
155
+ };
156
+ mergeMutation(mutationType: MutationType, encodedMutation: {
157
+ value: string;
158
+ _meta: {
159
+ timestamp: string;
160
+ };
161
+ }, materializedShape?: MaterializedLiveType<LiveString> | undefined): [
162
+ MaterializedLiveType<LiveString>,
163
+ {
164
+ value: string;
165
+ _meta: {
166
+ timestamp: string;
167
+ };
168
+ } | null
169
+ ];
170
+ getStorageFieldType(): StorageFieldType;
171
+ toJSON(): {
172
+ entityName: string;
173
+ type: TType;
174
+ required: TRequired;
175
+ relationalColumn: TRelationalColumn | undefined;
176
+ foreignColumn: TForeignColumn | undefined;
177
+ };
178
+ static createOneFactory<TOriginEntity extends LiveObjectAny>(): <TEntity extends LiveObjectAny, TColumn extends keyof TOriginEntity["fields"], TRequired extends boolean = false>(entity: TEntity, column: TColumn, required?: TRequired) => Relation<TEntity, TOriginEntity, "one", TColumn, never, TRequired>;
179
+ static createManyFactory<TOriginEntity extends LiveObjectAny>(): <TEntity extends LiveObjectAny, TColumn extends keyof TEntity["fields"], TRequired extends boolean = false>(entity: TEntity, foreignColumn: TColumn, required?: TRequired) => Relation<TEntity, TOriginEntity, "many", never, TColumn, TRequired>;
180
+ }
181
+ type RelationAny = Relation<LiveObjectAny, LiveObjectAny, any, any, any, any>;
182
+ declare const createRelations: <TSourceObject extends LiveObjectAny, TRelations extends Record<string, RelationAny>>(liveObject: TSourceObject, factory: (connectors: {
183
+ one: ReturnType<typeof Relation.createOneFactory<TSourceObject>>;
184
+ many: ReturnType<typeof Relation.createManyFactory<TSourceObject>>;
185
+ }) => TRelations) => RelationsDecl<TSourceObject["name"], TRelations>;
186
+ type MaterializedLiveType<T extends LiveTypeAny> = {
187
+ value: T["_value"] extends Record<string, LiveTypeAny> ? {
188
+ [K in keyof T["_value"]]: MaterializedLiveType<T["_value"][K]>;
189
+ } : T["_value"];
190
+ _meta: T["_meta"];
191
+ };
192
+ declare const inferValue: <T extends LiveTypeAny>(type?: MaterializedLiveType<T>) => InferLiveType<T> | undefined;
193
+ type ExtractObjectValues<T> = T[keyof T];
194
+ type RelationsDecl<TObjectName extends string = string, TRelations extends Record<string, RelationAny> = Record<string, RelationAny>> = {
195
+ $type: "relations";
196
+ objectName: TObjectName;
197
+ relations: TRelations;
198
+ };
199
+ type ParseRelationsFromSchema<TRawSchema extends RawSchema, TObjectName extends string> = ExtractObjectValues<{
200
+ [K in keyof TRawSchema]: TRawSchema[K] extends RelationsDecl<infer TObjectName_, any> ? TObjectName_ extends TObjectName ? {
201
+ [K2 in keyof TRawSchema[K]["relations"]]: Relation<ParseObjectFromSchema<TRawSchema, TRawSchema[K]["relations"][K2]["entity"]["name"]>, TRawSchema[K]["relations"][K2]["sourceEntity"], TRawSchema[K]["relations"][K2]["type"], Exclude<TRawSchema[K]["relations"][K2]["relationalColumn"], undefined>, Exclude<TRawSchema[K]["relations"][K2]["foreignColumn"], undefined>, TRawSchema[K]["relations"][K2]["required"]>;
202
+ } : never : never;
203
+ }>;
204
+ type ParseObjectFromSchema<TRawSchema extends RawSchema, TObjectName extends string> = ExtractObjectValues<{
205
+ [K in keyof TRawSchema]: TRawSchema[K] extends LiveObjectAny ? TRawSchema[K]["name"] extends TObjectName ? LiveObject<TRawSchema[K]["name"], TRawSchema[K]["fields"], ParseRelationsFromSchema<TRawSchema, TRawSchema[K]["name"]>> : never : never;
206
+ }>;
207
+ type RawSchema = Record<string, LiveObjectAny | RelationsDecl>;
208
+ type Schema<TRawSchema extends RawSchema> = {
209
+ [K in keyof TRawSchema as TRawSchema[K] extends LiveObjectAny ? TRawSchema[K]["name"] : never]: TRawSchema[K] extends LiveObjectAny ? ParseObjectFromSchema<TRawSchema, TRawSchema[K]["name"]> : never;
210
+ };
211
+ declare const createSchema: <TRawSchema extends RawSchema>(schema: TRawSchema) => Schema<TRawSchema>;
212
+ type WhereClause<T extends LiveObjectAny> = ({
213
+ [K in keyof T["fields"]]?: InferLiveType<T["fields"][K]> | ({
214
+ $eq?: InferLiveType<T["fields"][K]>;
215
+ $in?: InferLiveType<T["fields"][K]>[];
216
+ $not?: InferLiveType<T["fields"][K]> | {
217
+ $in?: InferLiveType<T["fields"][K]>[];
218
+ $eq?: InferLiveType<T["fields"][K]>;
219
+ };
220
+ } & (Exclude<InferLiveType<T["fields"][K]>, null | undefined> extends number | Date ? {
221
+ $gt?: InferLiveType<T["fields"][K]>;
222
+ $gte?: InferLiveType<T["fields"][K]>;
223
+ $lt?: InferLiveType<T["fields"][K]>;
224
+ $lte?: InferLiveType<T["fields"][K]>;
225
+ } : {}));
226
+ } & {
227
+ [K in keyof T["relations"]]?: WhereClause<T["relations"][K]["entity"]>;
228
+ }) | {
229
+ $and?: WhereClause<T>[];
230
+ $or?: WhereClause<T>[];
231
+ };
232
+ type IncludeClause<T extends LiveObjectAny> = {
233
+ [K in keyof T["relations"]]?: boolean | IncludeClause<T["relations"][K]["entity"]>;
234
+ };
235
+ type GetFieldType<T> = T extends NullableLiveType<any> ? T["inner"] : T;
236
+ type HasDefaultValue<T> = T extends LiveAtomicType<any, undefined> ? false : true;
237
+ type InferInsert<T extends LiveObjectAny> = {
238
+ [K in keyof T["fields"] as HasDefaultValue<GetFieldType<T["fields"][K]>> extends true ? never : K]: InferLiveType<T["fields"][K]>;
239
+ } & {
240
+ [K in keyof T["fields"] as HasDefaultValue<GetFieldType<T["fields"][K]>> extends false ? never : K]?: InferLiveType<T["fields"][K]>;
241
+ };
242
+ type InferUpdate<T extends LiveObjectAny> = Omit<LiveObjectMutationInput<T>, "id">;
243
+
244
+ type Simplify<T> = T extends Record<string, unknown> ? {
245
+ [K in keyof T]: Simplify<T[K]>;
246
+ } : T extends Array<infer U> ? Array<Simplify<U>> : T;
247
+ declare const LogLevel: {
248
+ readonly CRITICAL: 0;
249
+ readonly ERROR: 1;
250
+ readonly WARN: 2;
251
+ readonly INFO: 3;
252
+ readonly DEBUG: 4;
253
+ };
254
+ type LogLevel = (typeof LogLevel)[keyof typeof LogLevel];
255
+ /**
256
+ * Logger configuration options
257
+ */
258
+ interface LoggerOptions {
259
+ /**
260
+ * Minimum log level to display. Anything below this level will be muted.
261
+ * @default LogLevel.INFO
262
+ */
263
+ level?: LogLevel;
264
+ /**
265
+ * Optional prefix to add to all log messages
266
+ */
267
+ prefix?: string;
268
+ }
269
+ declare class Logger {
270
+ private level;
271
+ private prefix;
272
+ constructor(options?: LoggerOptions);
273
+ critical(...args: any[]): void;
274
+ error(...args: any[]): void;
275
+ warn(...args: any[]): void;
276
+ info(...args: any[]): void;
277
+ debug(...args: any[]): void;
278
+ setLevel(level: LogLevel): void;
279
+ getLevel(): LogLevel;
280
+ }
281
+
282
+ export { type MutationType as A, type StorageFieldType as B, LiveType as C, type LiveTypeAny as D, type InferLiveType as E, type InferIndex as F, type InferLiveObjectWithRelationalIds as I, type LiveObjectAny as L, type MaterializedLiveType as M, NullableLiveType as N, Relation as R, type Simplify as S, type WhereClause as W, type Schema as a, type IncludeClause as b, type InferLiveObject as c, type InferInsert as d, type InferUpdate as e, Logger as f, LogLevel as g, type InferLiveObjectWithoutRelations as h, type LiveObjectMutationInput as i, LiveObject as j, createRelations as k, inferValue as l, createSchema as m, LiveAtomicType as n, object as o, LiveNumber as p, number as q, LiveString as r, string as s, id as t, reference as u, LiveBoolean as v, boolean as w, LiveTimestamp as x, timestamp as y, type LiveTypeMeta as z };
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var s=class{_value;_meta;_encodeInput;_decodeInput};var c=class extends s{inner;constructor(e){super(),this.inner=e;}encodeMutation(e,t,n){return this.inner.encodeMutation(e,t,n)}mergeMutation(e,t,n){return this.inner.mergeMutation(e,t,n)}getStorageFieldType(){return {...this.inner.getStorageFieldType(),nullable:true}}},o=class a extends s{storageType;convertFunc;isIndex;isUnique;defaultValue;foreignReference;isPrimary;constructor(e,t,n,r,i,u,y){super(),this.storageType=e,this.convertFunc=t,this.isIndex=n??false,this.isUnique=r??false,this.defaultValue=i,this.foreignReference=u,this.isPrimary=y??false;}encodeMutation(e,t,n){return {value:t,_meta:{timestamp:n}}}mergeMutation(e,t,n){return n&&n._meta.timestamp&&t._meta.timestamp&&n._meta.timestamp.localeCompare(t._meta.timestamp)>=0?[n,null]:[{value:this.convertFunc?this.convertFunc(t.value):t.value,_meta:t._meta},t]}getStorageFieldType(){return {type:this.storageType,nullable:false,index:this.isIndex,unique:this.isUnique,default:this.defaultValue,references:this.foreignReference,primary:this.isPrimary}}unique(){return new a(this.storageType,this.convertFunc,this.isIndex,true,this.defaultValue,this.foreignReference,this.isPrimary)}index(){return new a(this.storageType,this.convertFunc,true,this.isUnique,this.defaultValue,this.foreignReference,this.isPrimary)}default(e){return new a(this.storageType,this.convertFunc,this.isIndex,this.isUnique,e,this.foreignReference,this.isPrimary)}primary(){return new a(this.storageType,this.convertFunc,this.isIndex,this.isUnique,this.defaultValue,this.foreignReference,true)}nullable(){return new c(this)}},p=class a extends o{constructor(){super("integer",e=>Number(e));}static create(){return new a}},g=p.create,l=class a extends o{constructor(e){super("varchar",void 0,void 0,void 0,void 0,e);}static create(){return new a}static createId(){return new a().index().unique().primary()}static createReference(e){return new a(e)}},b=l.create,M=l.createId,I=l.createReference,d=class a extends o{constructor(){super("boolean",e=>typeof e=="string"?e.toLowerCase()==="true":!!e);}static create(){return new a}},O=d.create,m=class a extends o{constructor(){super("timestamp",e=>typeof e=="string"?new Date(e):e);}static create(){return new a}},j=m.create;var v=class a extends s{name;fields;relations;constructor(e,t,n){super(),this.name=e,this.fields=t,this.relations=n??{};}encodeMutation(e,t,n){return Object.fromEntries(Object.entries(t).map(([r,i])=>[r,(this.fields[r]??this.relations[r]).encodeMutation("set",i,n)]))}mergeMutation(e,t,n){let r={};return [{value:{...(n==null?void 0:n.value)??{},...Object.fromEntries(Object.entries(t).map(([i,u])=>{let y=this.fields[i]??this.relations[i];if(!y)return [i,u];let[x,f]=y.mergeMutation(e,u,n==null?void 0:n.value[i]);return f&&(r[i]=f),[i,x]}))}},r]}setRelations(e){return new a(this.name,this.fields,e)}getStorageFieldType(){throw new Error("Method not implemented.")}static create(e,t){return new a(e,t)}},K=v.create,T=class a extends s{entity;type;required;relationalColumn;foreignColumn;sourceEntity;constructor(e,t,n,r,i){super(),this.entity=e,this.type=t,this.required=i??false,this.relationalColumn=n,this.foreignColumn=r;}encodeMutation(e,t,n){if(e!=="set")throw new Error("Mutation type not implemented.");if(this.type==="many")throw new Error("Many not implemented.");return {value:t,_meta:{timestamp:n}}}mergeMutation(e,t,n){if(this.type==="many")throw new Error("Many not implemented.");return n&&n._meta.timestamp&&t._meta.timestamp&&n._meta.timestamp.localeCompare(t._meta.timestamp)>=0?[n,null]:[t,t]}getStorageFieldType(){return {type:"varchar",nullable:!this.required,references:`${this.entity.name}.${String(this.foreignColumn??this.relationalColumn??"id")}`}}toJSON(){return {entityName:this.entity.name,type:this.type,required:this.required,relationalColumn:this.relationalColumn,foreignColumn:this.foreignColumn}}static createOneFactory(){return (e,t,n)=>new a(e,"one",t,void 0,n??false)}static createManyFactory(){return (e,t,n)=>new a(e,"many",void 0,t,n??false)}},A=(a,e)=>({$type:"relations",objectName:a.name,relations:e({one:T.createOneFactory(),many:T.createManyFactory()})}),h=a=>{if(a)return Array.isArray(a.value)?a.value.map(e=>h(e)):typeof a.value!="object"||a.value===null||a.value instanceof Date?a.value:Object.fromEntries(Object.entries(a.value).map(([e,t])=>[e,h(t)]))},_=a=>Object.fromEntries(Object.entries(a).flatMap(([e,t])=>{if(t.$type==="relations")return [];let n=t,r=Object.values(a).find(i=>i.$type==="relations"&&i.objectName===t.name);return r&&(n=n.setRelations(r.relations)),[[n.name,n]]}));exports.LiveBoolean=d;exports.LiveNumber=p;exports.LiveObject=v;exports.LiveString=l;exports.LiveTimestamp=m;exports.LiveType=s;exports.Relation=T;exports.boolean=O;exports.createRelations=A;exports.createSchema=_;exports.id=M;exports.inferValue=h;exports.number=g;exports.object=K;exports.reference=I;exports.string=b;exports.timestamp=j;
1
+ 'use strict';require('js-xxhash');var s=class{_value;_meta;_encodeInput;_decodeInput};var T=class extends s{inner;constructor(e){super(),this.inner=e;}encodeMutation(e,n,t){return this.inner.encodeMutation(e,n,t)}mergeMutation(e,n,t){return this.inner.mergeMutation(e,n,t)}getStorageFieldType(){return {...this.inner.getStorageFieldType(),nullable:true}}},l=class i extends s{storageType;convertFunc;isIndex;isUnique;defaultValue;foreignReference;isPrimary;constructor(e,n,t,a,r,u,y){super(),this.storageType=e,this.convertFunc=n,this.isIndex=t??false,this.isUnique=a??false,this.defaultValue=r,this.foreignReference=u,this.isPrimary=y??false;}encodeMutation(e,n,t){return {value:n,_meta:{timestamp:t}}}mergeMutation(e,n,t){return t&&t._meta.timestamp&&n._meta.timestamp&&t._meta.timestamp.localeCompare(n._meta.timestamp)>=0?[t,null]:[{value:this.convertFunc?this.convertFunc(n.value):n.value,_meta:n._meta},n]}getStorageFieldType(){return {type:this.storageType,nullable:false,index:this.isIndex,unique:this.isUnique,default:this.defaultValue,references:this.foreignReference,primary:this.isPrimary}}unique(){return new i(this.storageType,this.convertFunc,this.isIndex,true,this.defaultValue,this.foreignReference,this.isPrimary)}index(){return new i(this.storageType,this.convertFunc,true,this.isUnique,this.defaultValue,this.foreignReference,this.isPrimary)}default(e){return new i(this.storageType,this.convertFunc,this.isIndex,this.isUnique,e,this.foreignReference,this.isPrimary)}primary(){return new i(this.storageType,this.convertFunc,this.isIndex,this.isUnique,this.defaultValue,this.foreignReference,true)}nullable(){return new T(this)}},p=class i extends l{constructor(){super("integer",e=>Number(e));}static create(){return new i}},b=p.create,o=class i extends l{constructor(e){super("varchar",void 0,void 0,void 0,void 0,e);}static create(){return new i}static createId(){return new i().index().unique().primary()}static createReference(e){return new i(e)}},I=o.create,O=o.createId,A=o.createReference,d=class i extends l{constructor(){super("boolean",e=>typeof e=="string"?e.toLowerCase()==="true":!!e);}static create(){return new i}},M=d.create,f=class i extends l{constructor(){super("timestamp",e=>typeof e=="string"?new Date(e):e);}static create(){return new i}},j=f.create;var v=class i extends s{name;fields;relations;constructor(e,n,t){super(),this.name=e,this.fields=n,this.relations=t??{};}encodeMutation(e,n,t){return Object.fromEntries(Object.entries(n).map(([a,r])=>[a,(this.fields[a]??this.relations[a]).encodeMutation("set",r,t)]))}mergeMutation(e,n,t){let a={};return [{value:{...(t==null?void 0:t.value)??{},...Object.fromEntries(Object.entries(n).map(([r,u])=>{let y=this.fields[r]??this.relations[r];if(!y)return [r,u];let[L,h]=y.mergeMutation(e,u,t==null?void 0:t.value[r]);return h&&(a[r]=h),[r,L]}))}},a]}setRelations(e){return new i(this.name,this.fields,e)}getStorageFieldType(){throw new Error("Method not implemented.")}static create(e,n){return new i(e,n)}},w=v.create,c=class i extends s{entity;type;required;relationalColumn;foreignColumn;sourceEntity;constructor(e,n,t,a,r){super(),this.entity=e,this.type=n,this.required=r??false,this.relationalColumn=t,this.foreignColumn=a;}encodeMutation(e,n,t){if(e!=="set")throw new Error("Mutation type not implemented.");if(this.type==="many")throw new Error("Many not implemented.");return {value:n,_meta:{timestamp:t}}}mergeMutation(e,n,t){if(this.type==="many")throw new Error("Many not implemented.");return t&&t._meta.timestamp&&n._meta.timestamp&&t._meta.timestamp.localeCompare(n._meta.timestamp)>=0?[t,null]:[n,n]}getStorageFieldType(){return {type:"varchar",nullable:!this.required,references:`${this.entity.name}.${String(this.foreignColumn??this.relationalColumn??"id")}`}}toJSON(){return {entityName:this.entity.name,type:this.type,required:this.required,relationalColumn:this.relationalColumn,foreignColumn:this.foreignColumn}}static createOneFactory(){return (e,n,t)=>new i(e,"one",n,void 0,t??false)}static createManyFactory(){return (e,n,t)=>new i(e,"many",void 0,n,t??false)}},V=(i,e)=>({$type:"relations",objectName:i.name,relations:e({one:c.createOneFactory(),many:c.createManyFactory()})}),m=i=>i?Array.isArray(i.value)?i.value.map(n=>m(n)):typeof i.value!="object"||i.value===null||i.value instanceof Date?i.value:Object.fromEntries(Object.entries(i.value).map(([n,t])=>Array.isArray(t)?[n,t.map(a=>m(a))]:[n,m(t)])):void 0,C=i=>Object.fromEntries(Object.entries(i).flatMap(([e,n])=>{if(n.$type==="relations")return [];let t=n,a=Object.values(i).find(r=>r.$type==="relations"&&r.objectName===n.name);return a&&(t=t.setRelations(a.relations)),[[t.name,t]]}));var x={CRITICAL:0,ERROR:1,WARN:2,INFO:3,DEBUG:4};exports.LiveAtomicType=l;exports.LiveBoolean=d;exports.LiveNumber=p;exports.LiveObject=v;exports.LiveString=o;exports.LiveTimestamp=f;exports.LiveType=s;exports.LogLevel=x;exports.NullableLiveType=T;exports.Relation=c;exports.boolean=M;exports.createRelations=V;exports.createSchema=C;exports.id=O;exports.inferValue=m;exports.number=b;exports.object=w;exports.reference=A;exports.string=I;exports.timestamp=j;