@mark1russell7/docker-sqlite 0.1.0 → 0.2.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/CHANGELOG.md CHANGED
@@ -1,23 +1,48 @@
1
- # Change history
2
-
3
- ## 0.1.0
4
-
5
- The first version on npm. Before, projects installed the package from GitHub (`github:mark1russell7/docker-sqlite`).
6
-
7
- `@mark1russell7/docker-sqlite` gives Node.js a SQLite database with no native build. It uses sql.js (SQLite compiled to WebAssembly) and adds safe access to database files, queries, migrations, and an optional Docker Compose file for a web UI (sqlite-web).
8
-
9
- ### Functions
10
-
11
- - `withConnection` loads a database file, runs a callback and saves the file. `createConnection` gives a database and a `save` function.
12
- - `query`, `execute` and the other query helpers, with parameters.
13
- - Migrations: `runMigrations`, `getMigrationStatus`, `rollbackMigration` and `createMigration`.
14
- - `docker-compose.yml` starts sqlite-web on `127.0.0.1:8080`.
15
-
16
- ### Corrections
17
-
18
- - Calls for one file run one at a time in a process, and a save writes a temporary file and renames it. Before, 50 concurrent inserts into one file kept 1 row.
19
- - A save happens only when the database changed. Before, each call wrote the file: a read failed on a read-only file, a read wrote an old copy over the rows of another process, and a query of a missing file made an empty file.
20
- - `execute` runs every statement of SQL without parameters, and counts all changes. With parameters, several statements are an error. Before, sql.js ran only the first statement and the call reported success.
21
- - On Windows, two spellings of one path (upper and lower case) share one queue.
22
- - The web UI is published on `127.0.0.1` only, not on every network interface.
23
- - The types of sql.js come from `@types/sql.js`, so the types of the package resolve for its users. Before, a local declaration in `src` was not part of the build.
1
+ # Change history
2
+
3
+ ## 0.2.0
4
+
5
+ ### Breaking changes
6
+
7
+ - The `save` of `createConnection` does not write over a file that changed after the connection loaded it or saved it last. It throws a `DatabaseFileChangedError` and writes nothing. Before, it wrote the old copy of the connection with its change, and the changes of the other connection or process were lost. A program that keeps one connection open while another connection, another process or the web UI writes the same file now gets this error. To continue, close the connection, open a new one and make the change again.
8
+
9
+ ### New
10
+
11
+ - `DatabaseFileChangedError`, with `code: "DATABASE_FILE_CHANGED"` and `dbPath`.
12
+
13
+ ### Corrections
14
+
15
+ - The `save` of `createConnection` runs in the queue of the file, one call at a time with `withConnection` and the other saves of this process. Before, it ran outside the queue. In a `withConnection` callback for the same file, it runs at once, so it cannot wait for itself.
16
+
17
+ ## 0.1.1
18
+
19
+ ### Corrections
20
+
21
+ - `runMigrations` runs each migration and its record in a savepoint. Before, a migration that failed after its first statement kept the changes of those statements and had no record: the next run failed with "table already exists". `rollbackMigration` does the same for a `down` script.
22
+ - A migration whose SQL controls transactions itself (`BEGIN`, `COMMIT`, `VACUUM`, `PRAGMA` and some others) runs as before, without the savepoint. In a transaction, these statements fail or do nothing.
23
+ - `query` gives the column names also for a result with no rows. Before, `columns` was empty for such a result.
24
+ - A save flushes the temporary file to the disk before the rename, so a power loss cannot leave an empty or partial database.
25
+ - Each save has a temporary file with a random name. Before, the name had only the process id and the time in milliseconds, so two saves in one millisecond could write the same file.
26
+ - A save writes the database file directly only when the rename fails because Windows holds the file open (`EPERM`, `EACCES` or `EBUSY`). Before, each error of the rename started this direct write, which is not atomic.
27
+
28
+ ## 0.1.0
29
+
30
+ The first version on npm. Before, projects installed the package from GitHub (`github:mark1russell7/docker-sqlite`).
31
+
32
+ `@mark1russell7/docker-sqlite` gives Node.js a SQLite database with no native build. It uses sql.js (SQLite compiled to WebAssembly) and adds safe access to database files, queries, migrations, and an optional Docker Compose file for a web UI (sqlite-web).
33
+
34
+ ### Functions
35
+
36
+ - `withConnection` loads a database file, runs a callback and saves the file. `createConnection` gives a database and a `save` function.
37
+ - `query`, `execute` and the other query helpers, with parameters.
38
+ - Migrations: `runMigrations`, `getMigrationStatus`, `rollbackMigration` and `createMigration`.
39
+ - `docker-compose.yml` starts sqlite-web on `127.0.0.1:8080`.
40
+
41
+ ### Corrections
42
+
43
+ - Calls for one file run one at a time in a process, and a save writes a temporary file and renames it. Before, 50 concurrent inserts into one file kept 1 row.
44
+ - A save happens only when the database changed. Before, each call wrote the file: a read failed on a read-only file, a read wrote an old copy over the rows of another process, and a query of a missing file made an empty file.
45
+ - `execute` runs every statement of SQL without parameters, and counts all changes. With parameters, several statements are an error. Before, sql.js ran only the first statement and the call reported success.
46
+ - On Windows, two spellings of one path (upper and lower case) share one queue.
47
+ - The web UI is published on `127.0.0.1` only, not on every network interface.
48
+ - The types of sql.js come from `@types/sql.js`, so the types of the package resolve for its users. Before, a local declaration in `src` was not part of the build.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025-2026 Mark Russell
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 Mark Russell
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.