@firtoz/drizzle-sqlite-wasm 1.0.5 → 1.1.2

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.
Files changed (85) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +9 -1
  3. package/dist/chunk-6LNYKOKR.js +24 -0
  4. package/dist/chunk-6LNYKOKR.js.map +1 -0
  5. package/dist/chunk-7JJHY44Q.js +19 -0
  6. package/dist/chunk-7JJHY44Q.js.map +1 -0
  7. package/dist/chunk-AEYHRJVN.js +130 -0
  8. package/dist/chunk-AEYHRJVN.js.map +1 -0
  9. package/dist/chunk-AGMKOHXO.js +238 -0
  10. package/dist/chunk-AGMKOHXO.js.map +1 -0
  11. package/dist/chunk-BJDPMGFF.js +87 -0
  12. package/dist/chunk-BJDPMGFF.js.map +1 -0
  13. package/dist/chunk-BZVMUTJ7.js +49 -0
  14. package/dist/chunk-BZVMUTJ7.js.map +1 -0
  15. package/dist/chunk-FIVEPVOM.js +43 -0
  16. package/dist/chunk-FIVEPVOM.js.map +1 -0
  17. package/dist/chunk-FRONXNEA.js +123 -0
  18. package/dist/chunk-FRONXNEA.js.map +1 -0
  19. package/dist/chunk-GVUNHU6J.js +85 -0
  20. package/dist/chunk-GVUNHU6J.js.map +1 -0
  21. package/dist/chunk-H2F2HZ2A.js +22 -0
  22. package/dist/chunk-H2F2HZ2A.js.map +1 -0
  23. package/dist/chunk-NSPVPJKE.js +117 -0
  24. package/dist/chunk-NSPVPJKE.js.map +1 -0
  25. package/dist/chunk-TZP4AIBR.js +22 -0
  26. package/dist/chunk-TZP4AIBR.js.map +1 -0
  27. package/dist/chunk-WFFFP6DB.js +124 -0
  28. package/dist/chunk-WFFFP6DB.js.map +1 -0
  29. package/dist/collections/sqlite-collection.d.ts +40 -0
  30. package/dist/collections/sqlite-collection.js +3 -0
  31. package/dist/collections/sqlite-collection.js.map +1 -0
  32. package/dist/collections/synced-sqlite-collection.d.ts +19 -0
  33. package/dist/collections/synced-sqlite-collection.js +4 -0
  34. package/dist/collections/synced-sqlite-collection.js.map +1 -0
  35. package/dist/collections/websocket-collection.d.ts +18 -0
  36. package/dist/collections/websocket-collection.js +185 -0
  37. package/dist/collections/websocket-collection.js.map +1 -0
  38. package/dist/context/DrizzleSqliteProvider.d.ts +50 -0
  39. package/dist/context/DrizzleSqliteProvider.js +11 -0
  40. package/dist/context/DrizzleSqliteProvider.js.map +1 -0
  41. package/dist/context/useDrizzleSqlite.d.ts +23 -0
  42. package/dist/context/useDrizzleSqlite.js +12 -0
  43. package/dist/context/useDrizzleSqlite.js.map +1 -0
  44. package/dist/drizzle/direct.d.ts +8 -0
  45. package/dist/drizzle/direct.js +4 -0
  46. package/dist/drizzle/direct.js.map +1 -0
  47. package/dist/drizzle/handle-callback.d.ts +15 -0
  48. package/dist/drizzle/handle-callback.js +3 -0
  49. package/dist/drizzle/handle-callback.js.map +1 -0
  50. package/dist/drizzle/worker.d.ts +15 -0
  51. package/dist/drizzle/worker.js +3 -0
  52. package/dist/drizzle/worker.js.map +1 -0
  53. package/dist/hooks/useDrizzleSqliteDb.d.ts +24 -0
  54. package/dist/hooks/useDrizzleSqliteDb.js +9 -0
  55. package/dist/hooks/useDrizzleSqliteDb.js.map +1 -0
  56. package/dist/index.d.ts +25 -0
  57. package/dist/index.js +16 -0
  58. package/dist/index.js.map +1 -0
  59. package/dist/migration/migrator.d.ts +7 -0
  60. package/dist/migration/migrator.js +3 -0
  61. package/dist/migration/migrator.js.map +1 -0
  62. package/dist/types.d.ts +6 -0
  63. package/dist/types.js +3 -0
  64. package/dist/types.js.map +1 -0
  65. package/dist/worker/client.d.ts +12 -0
  66. package/dist/worker/client.js +3 -0
  67. package/dist/worker/client.js.map +1 -0
  68. package/dist/worker/global-manager.d.ts +36 -0
  69. package/dist/worker/global-manager.js +6 -0
  70. package/dist/worker/global-manager.js.map +1 -0
  71. package/dist/worker/manager.d.ts +71 -0
  72. package/dist/worker/manager.js +5 -0
  73. package/dist/worker/manager.js.map +1 -0
  74. package/dist/worker/schema.d.ts +125 -0
  75. package/dist/worker/schema.js +4 -0
  76. package/dist/worker/schema.js.map +1 -0
  77. package/dist/worker/sqlite-open-options.d.ts +45 -0
  78. package/dist/worker/sqlite-open-options.js +3 -0
  79. package/dist/worker/sqlite-open-options.js.map +1 -0
  80. package/dist/worker/sqlite.worker.d.ts +2 -0
  81. package/dist/worker/sqlite.worker.js +196 -0
  82. package/dist/worker/sqlite.worker.js.map +1 -0
  83. package/package.json +27 -27
  84. package/src/collections/sqlite-collection.ts +4 -4
  85. package/src/hooks/useDrizzleSqliteDb.ts +2 -2
@@ -0,0 +1,24 @@
1
+ import * as drizzle_orm_sqlite_proxy from 'drizzle-orm/sqlite-proxy';
2
+ import { DurableSqliteMigrationConfig } from '../migration/migrator.js';
3
+ import { ISqliteWorkerClient } from '../worker/manager.js';
4
+ import { SQLInterceptor } from '@firtoz/drizzle-utils';
5
+ import { SqliteWasmWorkerOpenOptions } from '../worker/sqlite-open-options.js';
6
+ import 'drizzle-orm/durable-sqlite/migrator';
7
+ import '@firtoz/worker-helper/WorkerClient';
8
+ import '../worker/schema.js';
9
+ import 'zod';
10
+
11
+ declare const useDrizzleSqliteDb: <TSchema extends Record<string, unknown>>(WorkerConstructor: new () => Worker, dbName: string, schema: TSchema, migrations: DurableSqliteMigrationConfig, debug?: boolean,
12
+ /** Optional interceptor to log ALL SQL queries (including direct Drizzle queries) */
13
+ interceptor?: SQLInterceptor,
14
+ /**
15
+ * Pragmas applied when the worker first opens this `dbName` in the session.
16
+ * Ignored if that database was already started (same global worker + dbName).
17
+ */
18
+ workerOpenOptions?: SqliteWasmWorkerOpenOptions) => {
19
+ drizzle: drizzle_orm_sqlite_proxy.SqliteRemoteDatabase<TSchema>;
20
+ readyPromise: Promise<void>;
21
+ sqliteClient: ISqliteWorkerClient | null;
22
+ };
23
+
24
+ export { useDrizzleSqliteDb };
@@ -0,0 +1,9 @@
1
+ export { useDrizzleSqliteDb } from '../chunk-WFFFP6DB.js';
2
+ import '../chunk-NSPVPJKE.js';
3
+ import '../chunk-FIVEPVOM.js';
4
+ import '../chunk-AGMKOHXO.js';
5
+ import '../chunk-GVUNHU6J.js';
6
+ import '../chunk-6LNYKOKR.js';
7
+ import '../chunk-FRONXNEA.js';
8
+ //# sourceMappingURL=useDrizzleSqliteDb.js.map
9
+ //# sourceMappingURL=useDrizzleSqliteDb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"useDrizzleSqliteDb.js"}
@@ -0,0 +1,25 @@
1
+ export { drizzleSqliteWasm } from './drizzle/direct.js';
2
+ export { SqliteCollectionConfig, sqliteCollectionOptions as drizzleCollectionOptions } from './collections/sqlite-collection.js';
3
+ export { createSyncedSqliteCollection } from './collections/synced-sqlite-collection.js';
4
+ export { Branded, IdOf, InsertSchema, SQLInterceptor, SQLOperation, SelectSchema, TableId, makeId, syncableTable } from '@firtoz/drizzle-utils';
5
+ export { useDrizzleSqliteDb } from './hooks/useDrizzleSqliteDb.js';
6
+ export { DrizzleSqliteContext, DrizzleSqliteContextValue, DrizzleSqliteProvider, useSqliteCollection } from './context/DrizzleSqliteProvider.js';
7
+ export { UseDrizzleSqliteReturn, useDrizzleSqlite } from './context/useDrizzleSqlite.js';
8
+ export { getSqliteWorkerManager, initializeSqliteWorker, isSqliteWorkerInitialized, resetSqliteWorkerManager } from './worker/global-manager.js';
9
+ export { DbInstance, ISqliteWorkerClient, SqliteWorkerManager } from './worker/manager.js';
10
+ export { SqliteWasmJournalMode, SqliteWasmJournalModeSchema, SqliteWasmSynchronousMode, SqliteWasmSynchronousModeSchema, SqliteWasmWorkerOpenOptions, SqliteWasmWorkerOpenOptionsSchema } from './worker/sqlite-open-options.js';
11
+ export { DurableSqliteMigrationConfig, customSqliteMigrate } from './migration/migrator.js';
12
+ import 'drizzle-orm/sqlite-proxy';
13
+ import './types.js';
14
+ import '@sqlite.org/sqlite-wasm';
15
+ import 'drizzle-orm';
16
+ import '@tanstack/db';
17
+ import 'drizzle-orm/sqlite-core';
18
+ import '@firtoz/db-helpers';
19
+ import '@firtoz/collection-sync';
20
+ import 'react/jsx-runtime';
21
+ import 'react';
22
+ import '@firtoz/worker-helper/WorkerClient';
23
+ import './worker/schema.js';
24
+ import 'zod';
25
+ import 'drizzle-orm/durable-sqlite/migrator';
package/dist/index.js ADDED
@@ -0,0 +1,16 @@
1
+ export { createSyncedSqliteCollection } from './chunk-7JJHY44Q.js';
2
+ export { useDrizzleSqlite } from './chunk-H2F2HZ2A.js';
3
+ export { DrizzleSqliteContext, DrizzleSqliteProvider, useSqliteCollection } from './chunk-AEYHRJVN.js';
4
+ export { useDrizzleSqliteDb } from './chunk-WFFFP6DB.js';
5
+ export { customSqliteMigrate } from './chunk-NSPVPJKE.js';
6
+ export { getSqliteWorkerManager, initializeSqliteWorker, isSqliteWorkerInitialized, resetSqliteWorkerManager } from './chunk-FIVEPVOM.js';
7
+ export { DbInstance, SqliteWorkerManager } from './chunk-AGMKOHXO.js';
8
+ import './chunk-GVUNHU6J.js';
9
+ export { SqliteWasmJournalModeSchema, SqliteWasmSynchronousModeSchema, SqliteWasmWorkerOpenOptionsSchema } from './chunk-6LNYKOKR.js';
10
+ export { sqliteCollectionOptions as drizzleCollectionOptions } from './chunk-BZVMUTJ7.js';
11
+ export { drizzleSqliteWasm } from './chunk-TZP4AIBR.js';
12
+ import './chunk-BJDPMGFF.js';
13
+ import './chunk-FRONXNEA.js';
14
+ export { makeId, syncableTable } from '@firtoz/drizzle-utils';
15
+ //# sourceMappingURL=index.js.map
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js","sourcesContent":[]}
@@ -0,0 +1,7 @@
1
+ import { SqliteRemoteDatabase } from 'drizzle-orm/sqlite-proxy';
2
+ import { migrate } from 'drizzle-orm/durable-sqlite/migrator';
3
+
4
+ type DurableSqliteMigrationConfig = Parameters<typeof migrate>[1];
5
+ declare function customSqliteMigrate<TSchema extends Record<string, unknown>>(db: SqliteRemoteDatabase<TSchema>, config: DurableSqliteMigrationConfig, debug?: boolean): Promise<void>;
6
+
7
+ export { type DurableSqliteMigrationConfig, customSqliteMigrate };
@@ -0,0 +1,3 @@
1
+ export { customSqliteMigrate } from '../chunk-NSPVPJKE.js';
2
+ //# sourceMappingURL=migrator.js.map
3
+ //# sourceMappingURL=migrator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"migrator.js"}
@@ -0,0 +1,6 @@
1
+ import init from '@sqlite.org/sqlite-wasm';
2
+
3
+ type Sqlite3Static = Awaited<ReturnType<typeof init>>;
4
+ type Database = InstanceType<Sqlite3Static["oo1"]["DB"]>;
5
+
6
+ export type { Database, Sqlite3Static };
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+
2
+ //# sourceMappingURL=types.js.map
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"types.js"}
@@ -0,0 +1,12 @@
1
+ import { SqliteWorkerRemoteCallbackClientMessage } from './schema.js';
2
+ import 'zod';
3
+
4
+ interface ISqliteWorkerClient {
5
+ performRemoteCallback: (data: Omit<SqliteWorkerRemoteCallbackClientMessage, "type" | "id" | "dbId">, resolve: (value: {
6
+ rows: unknown[];
7
+ }) => void, reject: (error: Error) => void) => void;
8
+ onStarted: (callback: () => void) => void;
9
+ terminate: () => void;
10
+ }
11
+
12
+ export type { ISqliteWorkerClient };
@@ -0,0 +1,3 @@
1
+
2
+ //# sourceMappingURL=client.js.map
3
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"client.js"}
@@ -0,0 +1,36 @@
1
+ import { SqliteWorkerManager } from './manager.js';
2
+ import '@firtoz/worker-helper/WorkerClient';
3
+ import './sqlite-open-options.js';
4
+ import 'zod';
5
+ import './schema.js';
6
+
7
+ /**
8
+ * Initialize the global SQLite worker manager.
9
+ * Should be called once, early in your app (e.g., in entry.client.tsx).
10
+ * Subsequent calls return the same manager instance.
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * // In entry.client.tsx
15
+ * import { initializeSqliteWorker } from "@firtoz/drizzle-sqlite-wasm";
16
+ * import SqliteWorker from "@firtoz/drizzle-sqlite-wasm/worker/sqlite.worker?worker";
17
+ *
18
+ * initializeSqliteWorker(SqliteWorker);
19
+ * ```
20
+ */
21
+ declare function initializeSqliteWorker(WorkerConstructor: new () => Worker, debug?: boolean): Promise<SqliteWorkerManager>;
22
+ /**
23
+ * Get the global SQLite worker manager.
24
+ * Throws an error if not initialized.
25
+ */
26
+ declare function getSqliteWorkerManager(): SqliteWorkerManager;
27
+ /**
28
+ * Check if the global manager has been initialized
29
+ */
30
+ declare function isSqliteWorkerInitialized(): boolean;
31
+ /**
32
+ * Reset the global manager (mainly for testing)
33
+ */
34
+ declare function resetSqliteWorkerManager(): void;
35
+
36
+ export { getSqliteWorkerManager, initializeSqliteWorker, isSqliteWorkerInitialized, resetSqliteWorkerManager };
@@ -0,0 +1,6 @@
1
+ export { getSqliteWorkerManager, initializeSqliteWorker, isSqliteWorkerInitialized, resetSqliteWorkerManager } from '../chunk-FIVEPVOM.js';
2
+ import '../chunk-AGMKOHXO.js';
3
+ import '../chunk-GVUNHU6J.js';
4
+ import '../chunk-6LNYKOKR.js';
5
+ //# sourceMappingURL=global-manager.js.map
6
+ //# sourceMappingURL=global-manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"global-manager.js"}
@@ -0,0 +1,71 @@
1
+ import { WorkerClient } from '@firtoz/worker-helper/WorkerClient';
2
+ import { SqliteWasmWorkerOpenOptions } from './sqlite-open-options.js';
3
+ import { SqliteWorkerRemoteCallbackClientMessage, SqliteWorkerClientMessage, SqliteWorkerServerMessage, DbId } from './schema.js';
4
+ import 'zod';
5
+
6
+ interface ISqliteWorkerClient {
7
+ performRemoteCallback: (data: Omit<SqliteWorkerRemoteCallbackClientMessage, "type" | "id" | "dbId">, resolve: (value: {
8
+ rows: unknown[];
9
+ }) => void, reject: (error: Error) => void) => void;
10
+ checkpoint: () => Promise<void>;
11
+ onStarted: (callback: () => void) => void;
12
+ terminate: () => void;
13
+ }
14
+ /**
15
+ * Per-database instance that can perform operations on a specific database
16
+ */
17
+ declare class DbInstance implements ISqliteWorkerClient {
18
+ private readonly manager;
19
+ readonly dbName: string;
20
+ private readonly debug;
21
+ private dbId;
22
+ private startedCallbacks;
23
+ private isStarted;
24
+ constructor(manager: SqliteWorkerManager, dbName: string, debug?: boolean);
25
+ /**
26
+ * Internal method called by manager when database is started
27
+ */
28
+ _setStarted(dbId: DbId): void;
29
+ performRemoteCallback(data: Omit<SqliteWorkerRemoteCallbackClientMessage, "type" | "id" | "dbId">, resolve: (value: {
30
+ rows: unknown[];
31
+ }) => void, reject: (error: Error) => void): void;
32
+ checkpoint(): Promise<void>;
33
+ onStarted(callback: () => void): void;
34
+ terminate(): void;
35
+ }
36
+ /**
37
+ * Main worker manager that can create multiple database instances
38
+ */
39
+ declare class SqliteWorkerManager extends WorkerClient<SqliteWorkerClientMessage, SqliteWorkerServerMessage> {
40
+ private readonly debug;
41
+ private readonly remoteCallbacks;
42
+ private readonly checkpointCallbacks;
43
+ private readyResolve?;
44
+ private readyReject?;
45
+ private readonly readyPromise;
46
+ private isReady;
47
+ private readonly dbInstances;
48
+ private readonly pendingStarts;
49
+ constructor(worker: Worker, debug?: boolean);
50
+ /**
51
+ * Promise that resolves when the worker sends its first Ready message
52
+ */
53
+ get ready(): Promise<void>;
54
+ private onMessage;
55
+ /**
56
+ * Get or create a database instance
57
+ */
58
+ getDbInstance(dbName: string, openOptions?: SqliteWasmWorkerOpenOptions): Promise<DbInstance>;
59
+ /**
60
+ * Internal method for db instances to perform remote callbacks
61
+ */
62
+ performRemoteCallback(dbId: DbId, data: Omit<SqliteWorkerRemoteCallbackClientMessage, "type" | "id" | "dbId">, resolve: (value: {
63
+ rows: unknown[];
64
+ }) => void, reject: (error: Error) => void): void;
65
+ /**
66
+ * Internal method for db instances to checkpoint the database
67
+ */
68
+ checkpoint(dbId: DbId, resolve: () => void, reject: (error: Error) => void): void;
69
+ }
70
+
71
+ export { DbInstance, type ISqliteWorkerClient, SqliteWorkerManager };
@@ -0,0 +1,5 @@
1
+ export { DbInstance, SqliteWorkerManager } from '../chunk-AGMKOHXO.js';
2
+ import '../chunk-GVUNHU6J.js';
3
+ import '../chunk-6LNYKOKR.js';
4
+ //# sourceMappingURL=manager.js.map
5
+ //# sourceMappingURL=manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"manager.js"}
@@ -0,0 +1,125 @@
1
+ import z from 'zod';
2
+
3
+ declare const RemoteCallbackIdSchema: z.core.$ZodBranded<z.ZodString, "remote-callback-id", "out">;
4
+ type RemoteCallbackId = z.infer<typeof RemoteCallbackIdSchema>;
5
+ declare const DbIdSchema: z.core.$ZodBranded<z.ZodString, "db-id", "out">;
6
+ type DbId = z.infer<typeof DbIdSchema>;
7
+ declare const StartRequestIdSchema: z.core.$ZodBranded<z.ZodString, "start-request-id", "out">;
8
+ type StartRequestId = z.infer<typeof StartRequestIdSchema>;
9
+ declare const CheckpointIdSchema: z.core.$ZodBranded<z.ZodString, "checkpoint-id", "out">;
10
+ type CheckpointId = z.infer<typeof CheckpointIdSchema>;
11
+ declare enum SqliteWorkerClientMessageType {
12
+ Start = "start",
13
+ RemoteCallbackRequest = "remote-callback-request",
14
+ Checkpoint = "checkpoint"
15
+ }
16
+ declare enum SqliteWorkerServerMessageType {
17
+ Ready = "ready",
18
+ Started = "started",
19
+ RemoteCallbackResponse = "remote-callback-response",
20
+ RemoteCallbackError = "remote-callback-error",
21
+ CheckpointComplete = "checkpoint-complete",
22
+ CheckpointError = "checkpoint-error"
23
+ }
24
+ declare const RemoteCallbackRequestSchema: z.ZodObject<{
25
+ type: z.ZodLiteral<SqliteWorkerClientMessageType.RemoteCallbackRequest>;
26
+ id: z.core.$ZodBranded<z.ZodString, "remote-callback-id", "out">;
27
+ dbId: z.core.$ZodBranded<z.ZodString, "db-id", "out">;
28
+ sql: z.ZodString;
29
+ params: z.ZodArray<z.ZodAny>;
30
+ method: z.ZodEnum<{
31
+ run: "run";
32
+ all: "all";
33
+ values: "values";
34
+ get: "get";
35
+ }>;
36
+ }, z.core.$strip>;
37
+ type SqliteWorkerRemoteCallbackClientMessage = z.infer<typeof RemoteCallbackRequestSchema>;
38
+ declare const CheckpointRequestSchema: z.ZodObject<{
39
+ type: z.ZodLiteral<SqliteWorkerClientMessageType.Checkpoint>;
40
+ id: z.core.$ZodBranded<z.ZodString, "checkpoint-id", "out">;
41
+ dbId: z.core.$ZodBranded<z.ZodString, "db-id", "out">;
42
+ }, z.core.$strip>;
43
+ type CheckpointRequest = z.infer<typeof CheckpointRequestSchema>;
44
+ declare const SqliteWorkerClientMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
45
+ type: z.ZodLiteral<SqliteWorkerClientMessageType.Start>;
46
+ requestId: z.core.$ZodBranded<z.ZodString, "start-request-id", "out">;
47
+ dbName: z.ZodString;
48
+ openOptions: z.ZodOptional<z.ZodObject<{
49
+ synchronous: z.ZodOptional<z.ZodEnum<{
50
+ OFF: "OFF";
51
+ NORMAL: "NORMAL";
52
+ FULL: "FULL";
53
+ EXTRA: "EXTRA";
54
+ }>>;
55
+ journalMode: z.ZodOptional<z.ZodEnum<{
56
+ OFF: "OFF";
57
+ WAL: "WAL";
58
+ DELETE: "DELETE";
59
+ TRUNCATE: "TRUNCATE";
60
+ MEMORY: "MEMORY";
61
+ }>>;
62
+ }, z.core.$strict>>;
63
+ }, z.core.$strip>, z.ZodObject<{
64
+ type: z.ZodLiteral<SqliteWorkerClientMessageType.RemoteCallbackRequest>;
65
+ id: z.core.$ZodBranded<z.ZodString, "remote-callback-id", "out">;
66
+ dbId: z.core.$ZodBranded<z.ZodString, "db-id", "out">;
67
+ sql: z.ZodString;
68
+ params: z.ZodArray<z.ZodAny>;
69
+ method: z.ZodEnum<{
70
+ run: "run";
71
+ all: "all";
72
+ values: "values";
73
+ get: "get";
74
+ }>;
75
+ }, z.core.$strip>, z.ZodObject<{
76
+ type: z.ZodLiteral<SqliteWorkerClientMessageType.Checkpoint>;
77
+ id: z.core.$ZodBranded<z.ZodString, "checkpoint-id", "out">;
78
+ dbId: z.core.$ZodBranded<z.ZodString, "db-id", "out">;
79
+ }, z.core.$strip>], "type">;
80
+ declare const RemoteCallbackResponseSchema: z.ZodObject<{
81
+ type: z.ZodLiteral<SqliteWorkerServerMessageType.RemoteCallbackResponse>;
82
+ id: z.core.$ZodBranded<z.ZodString, "remote-callback-id", "out">;
83
+ rows: z.ZodArray<z.ZodAny>;
84
+ }, z.core.$strip>;
85
+ declare const RemoteCallbackErrorServerMessageSchema: z.ZodObject<{
86
+ type: z.ZodLiteral<SqliteWorkerServerMessageType.RemoteCallbackError>;
87
+ id: z.core.$ZodBranded<z.ZodString, "remote-callback-id", "out">;
88
+ error: z.ZodString;
89
+ }, z.core.$strip>;
90
+ declare const CheckpointCompleteSchema: z.ZodObject<{
91
+ type: z.ZodLiteral<SqliteWorkerServerMessageType.CheckpointComplete>;
92
+ id: z.core.$ZodBranded<z.ZodString, "checkpoint-id", "out">;
93
+ }, z.core.$strip>;
94
+ declare const CheckpointErrorSchema: z.ZodObject<{
95
+ type: z.ZodLiteral<SqliteWorkerServerMessageType.CheckpointError>;
96
+ id: z.core.$ZodBranded<z.ZodString, "checkpoint-id", "out">;
97
+ error: z.ZodString;
98
+ }, z.core.$strip>;
99
+ declare const sqliteWorkerServerMessage: z.ZodDiscriminatedUnion<[z.ZodObject<{
100
+ type: z.ZodLiteral<SqliteWorkerServerMessageType.Ready>;
101
+ }, z.core.$strip>, z.ZodObject<{
102
+ type: z.ZodLiteral<SqliteWorkerServerMessageType.Started>;
103
+ requestId: z.core.$ZodBranded<z.ZodString, "start-request-id", "out">;
104
+ dbId: z.core.$ZodBranded<z.ZodString, "db-id", "out">;
105
+ }, z.core.$strip>, z.ZodObject<{
106
+ type: z.ZodLiteral<SqliteWorkerServerMessageType.RemoteCallbackResponse>;
107
+ id: z.core.$ZodBranded<z.ZodString, "remote-callback-id", "out">;
108
+ rows: z.ZodArray<z.ZodAny>;
109
+ }, z.core.$strip>, z.ZodObject<{
110
+ type: z.ZodLiteral<SqliteWorkerServerMessageType.RemoteCallbackError>;
111
+ id: z.core.$ZodBranded<z.ZodString, "remote-callback-id", "out">;
112
+ error: z.ZodString;
113
+ }, z.core.$strip>, z.ZodObject<{
114
+ type: z.ZodLiteral<SqliteWorkerServerMessageType.CheckpointComplete>;
115
+ id: z.core.$ZodBranded<z.ZodString, "checkpoint-id", "out">;
116
+ }, z.core.$strip>, z.ZodObject<{
117
+ type: z.ZodLiteral<SqliteWorkerServerMessageType.CheckpointError>;
118
+ id: z.core.$ZodBranded<z.ZodString, "checkpoint-id", "out">;
119
+ error: z.ZodString;
120
+ }, z.core.$strip>], "type">;
121
+ type SqliteWorkerClientMessage = z.infer<typeof SqliteWorkerClientMessageSchema>;
122
+ type SqliteWorkerServerMessage = z.infer<typeof sqliteWorkerServerMessage>;
123
+ type SqliteClientRemoteCallbackServerMessage = z.infer<typeof RemoteCallbackResponseSchema>;
124
+
125
+ export { CheckpointCompleteSchema, CheckpointErrorSchema, type CheckpointId, CheckpointIdSchema, type CheckpointRequest, CheckpointRequestSchema, type DbId, DbIdSchema, RemoteCallbackErrorServerMessageSchema, type RemoteCallbackId, RemoteCallbackIdSchema, RemoteCallbackRequestSchema, RemoteCallbackResponseSchema, type SqliteClientRemoteCallbackServerMessage, type SqliteWorkerClientMessage, SqliteWorkerClientMessageSchema, SqliteWorkerClientMessageType, type SqliteWorkerRemoteCallbackClientMessage, type SqliteWorkerServerMessage, SqliteWorkerServerMessageType, type StartRequestId, StartRequestIdSchema, sqliteWorkerServerMessage };
@@ -0,0 +1,4 @@
1
+ export { CheckpointCompleteSchema, CheckpointErrorSchema, CheckpointIdSchema, CheckpointRequestSchema, DbIdSchema, RemoteCallbackErrorServerMessageSchema, RemoteCallbackIdSchema, RemoteCallbackRequestSchema, RemoteCallbackResponseSchema, SqliteWorkerClientMessageSchema, SqliteWorkerClientMessageType, SqliteWorkerServerMessageType, StartRequestIdSchema, sqliteWorkerServerMessage } from '../chunk-GVUNHU6J.js';
2
+ import '../chunk-6LNYKOKR.js';
3
+ //# sourceMappingURL=schema.js.map
4
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"schema.js"}
@@ -0,0 +1,45 @@
1
+ import z from 'zod';
2
+
3
+ /**
4
+ * SQLite `PRAGMA synchronous` levels (see SQLite docs). Default worker behavior
5
+ * remains `FULL` for maximum durability with OPFS; `NORMAL` is often much faster
6
+ * for interactive UIs at the cost of a narrower crash window.
7
+ */
8
+ declare const SqliteWasmSynchronousModeSchema: z.ZodEnum<{
9
+ OFF: "OFF";
10
+ NORMAL: "NORMAL";
11
+ FULL: "FULL";
12
+ EXTRA: "EXTRA";
13
+ }>;
14
+ type SqliteWasmSynchronousMode = z.infer<typeof SqliteWasmSynchronousModeSchema>;
15
+ /**
16
+ * SQLite `PRAGMA journal_mode` values the worker will pass through as
17
+ * `PRAGMA journal_mode=<value>;` (uppercase).
18
+ */
19
+ declare const SqliteWasmJournalModeSchema: z.ZodEnum<{
20
+ OFF: "OFF";
21
+ WAL: "WAL";
22
+ DELETE: "DELETE";
23
+ TRUNCATE: "TRUNCATE";
24
+ MEMORY: "MEMORY";
25
+ }>;
26
+ type SqliteWasmJournalMode = z.infer<typeof SqliteWasmJournalModeSchema>;
27
+ /** Options applied once when the worker opens a database file (OPFS or transient). */
28
+ declare const SqliteWasmWorkerOpenOptionsSchema: z.ZodObject<{
29
+ synchronous: z.ZodOptional<z.ZodEnum<{
30
+ OFF: "OFF";
31
+ NORMAL: "NORMAL";
32
+ FULL: "FULL";
33
+ EXTRA: "EXTRA";
34
+ }>>;
35
+ journalMode: z.ZodOptional<z.ZodEnum<{
36
+ OFF: "OFF";
37
+ WAL: "WAL";
38
+ DELETE: "DELETE";
39
+ TRUNCATE: "TRUNCATE";
40
+ MEMORY: "MEMORY";
41
+ }>>;
42
+ }, z.core.$strict>;
43
+ type SqliteWasmWorkerOpenOptions = z.infer<typeof SqliteWasmWorkerOpenOptionsSchema>;
44
+
45
+ export { type SqliteWasmJournalMode, SqliteWasmJournalModeSchema, type SqliteWasmSynchronousMode, SqliteWasmSynchronousModeSchema, type SqliteWasmWorkerOpenOptions, SqliteWasmWorkerOpenOptionsSchema };
@@ -0,0 +1,3 @@
1
+ export { SqliteWasmJournalModeSchema, SqliteWasmSynchronousModeSchema, SqliteWasmWorkerOpenOptionsSchema } from '../chunk-6LNYKOKR.js';
2
+ //# sourceMappingURL=sqlite-open-options.js.map
3
+ //# sourceMappingURL=sqlite-open-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"sqlite-open-options.js"}
@@ -0,0 +1,2 @@
1
+
2
+ export { }