web-sqlite-js 1.0.10 → 1.1.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/README.md CHANGED
@@ -66,7 +66,7 @@ For quick demos or plain HTML pages you can load the prebuilt module directly:
66
66
 
67
67
  ```html
68
68
  <script type="module">
69
- import openDB from "https://cdn.jsdelivr.net/npm/web-sqlite-js@1.0.10/dist/index.js";
69
+ import openDB from "https://cdn.jsdelivr.net/npm/web-sqlite-js@1.0.9/dist/index.js";
70
70
  // ...
71
71
  </script>
72
72
  ```
package/dist/index.d.ts CHANGED
@@ -21,8 +21,21 @@ declare interface DBInterface {
21
21
  transaction<T>(fn: transactionCallback<T>): Promise<T>;
22
22
  /** Close the database and release resources. */
23
23
  close(): Promise<void>;
24
+ /** Dev tooling APIs for release testing. */
25
+ devTool: DevTool;
24
26
  }
25
27
 
28
+ declare type DevTool = {
29
+ /**
30
+ * Create a new dev version using migration and seed SQL.
31
+ */
32
+ release(input: ReleaseConfig): Promise<void>;
33
+ /**
34
+ * Roll back to a target version and remove dev versions above it.
35
+ */
36
+ rollback(version: string): Promise<void>;
37
+ };
38
+
26
39
  /**
27
40
  * Metadata returned for non-query statements.
28
41
  * @property changes Number of rows changed by last operation (may be bigint on some builds).
@@ -34,14 +47,41 @@ declare type ExecResult = {
34
47
  };
35
48
 
36
49
  /**
37
- * PUBLIC API (Client End)
38
- * Opens a SQLite database connection.
50
+ * Opens a SQLite database connection with release-versioning support.
51
+ *
52
+ * @param filename - The base database name (directory is created in OPFS).
53
+ * @param options - Optional release configuration and debug flag.
54
+ * @returns A DBInterface for the latest active version.
55
+ *
56
+ * @throws Error if the filename is invalid, release config is invalid,
57
+ * or an archived release hash does not match.
39
58
  */
40
- declare const openDB: (filename: string, options?: WorkerOpenDBOptions) => Promise<DBInterface>;
59
+ declare const openDB: (filename: string, options?: OpenDBOptions) => Promise<DBInterface>;
41
60
  export default openDB;
42
- export { openDB as open }
43
61
  export { openDB }
44
62
 
63
+ /**
64
+ * Options for opening a database.
65
+ */
66
+ declare type OpenDBOptions = {
67
+ /** Immutable release history configuration. */
68
+ releases?: ReleaseConfig[];
69
+ /** Enable SQL timing logs in the worker. */
70
+ debug?: boolean;
71
+ };
72
+
73
+ /**
74
+ * Release configuration entry for versioned migrations.
75
+ */
76
+ declare type ReleaseConfig = {
77
+ /** Semantic version string "x.x.x" (no leading zeros). */
78
+ version: string;
79
+ /** Migration SQL to apply for this version. */
80
+ migrationSQL: string;
81
+ /** Optional seed SQL to apply after migration. */
82
+ seedSQL?: string | null;
83
+ };
84
+
45
85
  /** A bindable parameter collection: positional or named. */
46
86
  declare type SQLParams = SqlValue[] | Record<string, SqlValue>;
47
87
 
@@ -52,8 +92,4 @@ declare type SqlValue = null | number | string | boolean | bigint | Uint8Array |
52
92
 
53
93
  declare type transactionCallback<T> = (db: Pick<DBInterface, "exec" | "query">) => Promise<T>;
54
94
 
55
- declare type WorkerOpenDBOptions = {
56
- debug?: boolean;
57
- };
58
-
59
95
  export { }