@effect/sql-sqlite-node 4.0.0-beta.70 → 4.0.0-beta.71
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/dist/SqliteClient.d.ts.map +1 -1
- package/dist/SqliteClient.js +38 -11
- package/dist/SqliteClient.js.map +1 -1
- package/dist/SqliteMigrator.d.ts +28 -10
- package/dist/SqliteMigrator.d.ts.map +1 -1
- package/dist/SqliteMigrator.js.map +1 -1
- package/dist/index.d.ts +0 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -29
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/SqliteClient.ts +38 -11
- package/src/SqliteMigrator.ts +27 -9
- package/src/index.ts +0 -29
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SqliteClient.d.ts","sourceRoot":"","sources":["../src/SqliteClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SqliteClient.d.ts","sourceRoot":"","sources":["../src/SqliteClient.ts"],"names":[],"mappings":"AA8CA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAGrC,OAAO,KAAK,UAAU,MAAM,uCAAuC,CAAA;AACnE,OAAO,KAAK,MAAM,MAAM,+BAA+B,CAAA;AAEvD,OAAO,EAAuB,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AAQ5E;;;;;GAKG;AACH,eAAO,MAAM,MAAM,EAAE,MAAgD,CAAA;AAErE;;;;;GAKG;AACH,MAAM,MAAM,MAAM,GAAG,uCAAuC,CAAA;AAE5D;;;;;GAKG;AACH,MAAM,WAAW,YAAa,SAAQ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SAAS,CAAA;IACrE,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,SAAS,CAAA;CACrE;AAQD;;;;;GAKG;AACH,eAAO,MAAM,IAAI,GACf,SAAS,kBAAkB,KAC1B,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,UAAU,CA6JrE,CAAA;AAEJ;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GACtB,QAAQ,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,KACtC,KAAK,CAAC,KAAK,CAAC,YAAY,GAAG,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,WAAW,CAUzB,CAAA;AAEzC;;;;;GAKG;AACH,eAAO,MAAM,KAAK,GAChB,QAAQ,kBAAkB,KACzB,KAAK,CAAC,KAAK,CAAC,YAAY,GAAG,MAAM,CAAC,SAAS,CAML,CAAA"}
|
package/dist/SqliteClient.js
CHANGED
|
@@ -1,17 +1,44 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Node.js SQLite
|
|
2
|
+
* Node.js SQLite driver for Effect SQL, backed by `better-sqlite3`.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* Use this module to provide a scoped {@link SqliteClient} for file-backed or
|
|
5
|
+
* in-memory SQLite databases in Node.js. The provided layers install both the
|
|
6
|
+
* SQLite-specific service and the generic `SqlClient`, making the module useful
|
|
7
|
+
* for local applications, tests, migrations, development tools, and embedded
|
|
8
|
+
* persistence that need Effect SQL query compilation with SQLite-specific
|
|
9
|
+
* operations.
|
|
9
10
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* ## Mental model
|
|
12
|
+
*
|
|
13
|
+
* Each client owns one scoped `better-sqlite3` database handle and serializes
|
|
14
|
+
* all SQL access through it. Because `better-sqlite3` executes statements
|
|
15
|
+
* synchronously, a long-running query or transaction holds the serialized
|
|
16
|
+
* connection until it completes. Prepared statements are cached by SQL text and
|
|
17
|
+
* result-name transforms are applied after rows are read.
|
|
18
|
+
*
|
|
19
|
+
* The service adds Node SQLite capabilities on top of the generic `SqlClient`:
|
|
20
|
+
* database export, file backup, and native extension loading.
|
|
21
|
+
*
|
|
22
|
+
* ## Common tasks
|
|
23
|
+
*
|
|
24
|
+
* - Use {@link layer} with a concrete filename and options.
|
|
25
|
+
* - Use {@link layerConfig} when the filename or flags should come from
|
|
26
|
+
* `Config`.
|
|
27
|
+
* - Use {@link make} inside a custom scoped layer when you need to manage the
|
|
28
|
+
* client lifecycle directly.
|
|
29
|
+
* - Use `client.export`, `client.backup`, or `client.loadExtension` for
|
|
30
|
+
* operations that are specific to this Node SQLite driver.
|
|
31
|
+
*
|
|
32
|
+
* ## Gotchas
|
|
33
|
+
*
|
|
34
|
+
* WAL mode is enabled by default. Set `disableWAL` for read-only databases or
|
|
35
|
+
* when the database file or directory cannot be updated with SQLite WAL side
|
|
36
|
+
* files. Separate database handles or processes can still contend for SQLite
|
|
37
|
+
* write locks even though access through one client is serialized.
|
|
38
|
+
*
|
|
39
|
+
* Safe integer handling follows the generic `SqlClient` fiber-local setting.
|
|
40
|
+
* `executeStream` is not implemented for this driver, and SQLite does not
|
|
41
|
+
* support `updateValues`.
|
|
15
42
|
*
|
|
16
43
|
* @since 4.0.0
|
|
17
44
|
*/
|
package/dist/SqliteClient.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SqliteClient.js","names":["Sqlite","Cache","Config","Context","Duration","Effect","Fiber","identity","Layer","Scope","Semaphore","Stream","Reactivity","Client","classifySqliteError","SqlError","Statement","ATTR_DB_SYSTEM_NAME","classifyError","cause","message","operation","TypeId","SqliteClient","Service","make","options","gen","compiler","makeCompilerSqlite","transformQueryNames","transformRows","transformResultNames","defaultTransforms","array","undefined","makeConnection","scope","db","filename","readonly","addFinalizer","sync","close","disableWAL","pragma","prepareCache","capacity","prepareCacheSize","timeToLive","prepareCacheTTL","minutes","lookup","sql","try","prepare","catch","reason","runStatement","statement","params","raw","withFiber","fiber","get","context","SafeIntegers","safeIntegers","reader","succeed","all","result","run","fail","flatMap","s","runValues","acquireUseRelease","execute","map","executeRaw","executeValues","executeUnprepared","effect","executeStream","_sql","_params","die","export","serialize","backup","destination","tryPromise","loadExtension","path","semaphore","connection","acquirer","withPermits","transactionAcquirer","uninterruptibleMask","restore","getCurrent","getUnsafe","as","tap","take","release","Object","assign","spanAttributes","entries","config","_","layerConfig","effectContext","unwrap","pipe","client","add","SqlClient","provide","layer"],"sources":["../src/SqliteClient.ts"],"sourcesContent":[null],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"SqliteClient.js","names":["Sqlite","Cache","Config","Context","Duration","Effect","Fiber","identity","Layer","Scope","Semaphore","Stream","Reactivity","Client","classifySqliteError","SqlError","Statement","ATTR_DB_SYSTEM_NAME","classifyError","cause","message","operation","TypeId","SqliteClient","Service","make","options","gen","compiler","makeCompilerSqlite","transformQueryNames","transformRows","transformResultNames","defaultTransforms","array","undefined","makeConnection","scope","db","filename","readonly","addFinalizer","sync","close","disableWAL","pragma","prepareCache","capacity","prepareCacheSize","timeToLive","prepareCacheTTL","minutes","lookup","sql","try","prepare","catch","reason","runStatement","statement","params","raw","withFiber","fiber","get","context","SafeIntegers","safeIntegers","reader","succeed","all","result","run","fail","flatMap","s","runValues","acquireUseRelease","execute","map","executeRaw","executeValues","executeUnprepared","effect","executeStream","_sql","_params","die","export","serialize","backup","destination","tryPromise","loadExtension","path","semaphore","connection","acquirer","withPermits","transactionAcquirer","uninterruptibleMask","restore","getCurrent","getUnsafe","as","tap","take","release","Object","assign","spanAttributes","entries","config","_","layerConfig","effectContext","unwrap","pipe","client","add","SqlClient","provide","layer"],"sources":["../src/SqliteClient.ts"],"sourcesCont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AAM,CAACkH,MAAM,CAACJ,MAAM,CAAC,CAACK,IAAI,CACxBhH,MAAM,CAACqE,OAAO,CAACjD,IAAI,CAAC,EACpBpB,MAAM,CAAC0E,GAAG,CAAEuC,MAAM,IAChBnH,OAAO,CAACsB,IAAI,CAACF,YAAY,EAAE+F,MAAM,CAAC,CAACD,IAAI,CACrClH,OAAO,CAACoH,GAAG,CAAC1G,MAAM,CAAC2G,SAAS,EAAEF,MAAM,CAAC,CACtC,CACF,CACF,CACF,CAACD,IAAI,CAAC7G,KAAK,CAACiH,OAAO,CAAC7G,UAAU,CAAC8G,KAAK,CAAC,CAAC;AAEzC;;;;;;AAMA,OAAO,MAAMA,KAAK,GAChBV,MAA0B,IAE1BxG,KAAK,CAAC2G,aAAa,CACjB9G,MAAM,CAAC0E,GAAG,CAACtD,IAAI,CAACuF,MAAM,CAAC,EAAGM,MAAM,IAC9BnH,OAAO,CAACsB,IAAI,CAACF,YAAY,EAAE+F,MAAM,CAAC,CAACD,IAAI,CACrClH,OAAO,CAACoH,GAAG,CAAC1G,MAAM,CAAC2G,SAAS,EAAEF,MAAM,CAAC,CACtC,CAAC,CACL,CAACD,IAAI,CAAC7G,KAAK,CAACiH,OAAO,CAAC7G,UAAU,CAAC8G,KAAK,CAAC,CAAC","ignoreList":[]}
|
package/dist/SqliteMigrator.d.ts
CHANGED
|
@@ -1,16 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Migration runner for Node.js SQLite databases managed by Effect SQL.
|
|
3
3
|
*
|
|
4
4
|
* This module re-exports the shared `Migrator` loaders and error types, then
|
|
5
|
-
* provides
|
|
6
|
-
* current SQLite `SqlClient`.
|
|
7
|
-
* tests that create temporary database files, or in layer graphs
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
5
|
+
* provides {@link run} and {@link layer} adapters that execute ordered
|
|
6
|
+
* migrations through the current SQLite `SqlClient`. Use it during application
|
|
7
|
+
* startup, in tests that create temporary database files, or in layer graphs
|
|
8
|
+
* that must prepare a file-backed SQLite schema before dependent services are
|
|
9
|
+
* acquired.
|
|
10
|
+
*
|
|
11
|
+
* ## Mental model
|
|
12
|
+
*
|
|
13
|
+
* Migrations are loaded using the shared `<id>_<name>` file or record-key
|
|
14
|
+
* convention. Applied migrations are recorded in `effect_sql_migrations` by
|
|
15
|
+
* default, and only migrations with an id greater than the latest recorded id
|
|
16
|
+
* are executed. {@link layer} runs the same migration effect during layer
|
|
17
|
+
* construction and provides no services of its own.
|
|
18
|
+
*
|
|
19
|
+
* ## Common tasks
|
|
20
|
+
*
|
|
21
|
+
* - Use {@link run} when startup code should decide where migration execution
|
|
22
|
+
* fits in the application workflow.
|
|
23
|
+
* - Use {@link layer} when a layer graph should block dependent services until
|
|
24
|
+
* the SQLite schema is up to date.
|
|
25
|
+
* - Use the re-exported shared `Migrator` loaders for file-system migrations or
|
|
26
|
+
* in-memory migration records.
|
|
27
|
+
*
|
|
28
|
+
* ## Gotchas
|
|
29
|
+
*
|
|
30
|
+
* Every client involved in startup should point at the same SQLite filename so
|
|
31
|
+
* the recorded migration ids describe the database being used. Concurrent
|
|
14
32
|
* writers can surface SQLite lock timeout errors, and this adapter does not
|
|
15
33
|
* currently write SQLite schema dumps for `schemaDirectory`.
|
|
16
34
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SqliteMigrator.d.ts","sourceRoot":"","sources":["../src/SqliteMigrator.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"SqliteMigrator.d.ts","sourceRoot":"","sources":["../src/SqliteMigrator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,QAAQ,MAAM,8BAA8B,CAAA;AACxD,OAAO,KAAK,KAAK,MAAM,MAAM,+BAA+B,CAAA;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AAE5D;;GAEG;AACH,cAAc,8BAA8B,CAAA;AAE5C;;;;;GAKG;AACH,eAAO,MAAM,GAAG,EAAE,CAAC,EAAE,GAAG,KAAK,EAC3B,OAAO,EAAE,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,KAClC,MAAM,CAAC,MAAM,CAChB,aAAa,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,EAClD,QAAQ,CAAC,cAAc,GAAG,QAAQ,EAClC,MAAM,CAAC,SAAS,GAAG,EAAE,CA2CrB,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,EACrB,SAAS,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,KACnC,KAAK,CAAC,KAAK,CACZ,KAAK,EACL,QAAQ,CAAC,cAAc,GAAG,QAAQ,EAClC,MAAM,CAAC,SAAS,GAAG,CAAC,CACgB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SqliteMigrator.js","names":["Layer","Migrator","run","make","layer","options","effectDiscard"],"sources":["../src/SqliteMigrator.ts"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"file":"SqliteMigrator.js","names":["Layer","Migrator","run","make","layer","options","effectDiscard"],"sources":["../src/SqliteMigrator.ts"],"sourcesContent":[null],"mappings":"AAqCA,OAAO,KAAKA,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,QAAQ,MAAM,8BAA8B;AAIxD;;;AAGA,cAAc,8BAA8B;AAE5C;;;;;;AAMA,OAAO,MAAMC,GAAG,gBAMZD,QAAQ,CAACE,IAAI,CAAC;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AAAA,CACD,CAAC;AAEF;;;;;;AAMA,OAAO,MAAMC,KAAK,GAChBC,OAAoC,IAKjCL,KAAK,CAACM,aAAa,CAACJ,GAAG,CAACG,OAAO,CAAC,CAAC","ignoreList":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,39 +2,10 @@
|
|
|
2
2
|
* @since 4.0.0
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
-
* Node.js SQLite client implementation for Effect SQL, backed by `better-sqlite3`.
|
|
6
|
-
*
|
|
7
|
-
* This module exposes constructors and layers for providing both the SQLite-specific `SqliteClient`
|
|
8
|
-
* service and the generic `SqlClient` service. It is intended for file-backed or in-memory SQLite
|
|
9
|
-
* databases in Node applications, local development tools, tests, migrations, and embedded
|
|
10
|
-
* persistence use cases that need Effect SQL query compilation plus SQLite-specific operations such
|
|
11
|
-
* as exporting a database, creating backups, or loading native SQLite extensions.
|
|
12
|
-
*
|
|
13
|
-
* Each client owns one scoped `better-sqlite3` connection and serializes access through it. WAL mode
|
|
14
|
-
* is enabled by default, so set `disableWAL` when opening read-only databases or when the database
|
|
15
|
-
* location cannot change journal mode. Prepared statements are cached by SQL text, safe integer
|
|
16
|
-
* handling follows the `SqlClient` fiber-local setting, `executeStream` is not implemented, and
|
|
17
|
-
* SQLite does not support `updateValues`.
|
|
18
|
-
*
|
|
19
5
|
* @since 4.0.0
|
|
20
6
|
*/
|
|
21
7
|
export * as SqliteClient from "./SqliteClient.ts";
|
|
22
8
|
/**
|
|
23
|
-
* Utilities for applying Effect SQL migrations to Node.js SQLite databases.
|
|
24
|
-
*
|
|
25
|
-
* This module re-exports the shared `Migrator` loaders and error types, then
|
|
26
|
-
* provides `run` and `layer` helpers for applying ordered migrations through the
|
|
27
|
-
* current SQLite `SqlClient`. It is typically used at application startup, in
|
|
28
|
-
* tests that create temporary database files, or in layer graphs that must
|
|
29
|
-
* ensure a file-backed SQLite schema exists before dependent services start.
|
|
30
|
-
*
|
|
31
|
-
* Migrations are recorded in `effect_sql_migrations` by default and are loaded
|
|
32
|
-
* using the shared `<id>_<name>` file or record-key convention. Only migrations
|
|
33
|
-
* with an id greater than the latest recorded id are applied, so every client
|
|
34
|
-
* involved in startup should point at the same SQLite filename. Concurrent
|
|
35
|
-
* writers can surface SQLite lock timeout errors, and this adapter does not
|
|
36
|
-
* currently write SQLite schema dumps for `schemaDirectory`.
|
|
37
|
-
*
|
|
38
9
|
* @since 4.0.0
|
|
39
10
|
*/
|
|
40
11
|
export * as SqliteMigrator from "./SqliteMigrator.ts";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;GAEG;AACH,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA;AAEjD;;GAEG;AACH,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -3,39 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
// @barrel: Auto-generated exports. Do not edit manually.
|
|
5
5
|
/**
|
|
6
|
-
* Node.js SQLite client implementation for Effect SQL, backed by `better-sqlite3`.
|
|
7
|
-
*
|
|
8
|
-
* This module exposes constructors and layers for providing both the SQLite-specific `SqliteClient`
|
|
9
|
-
* service and the generic `SqlClient` service. It is intended for file-backed or in-memory SQLite
|
|
10
|
-
* databases in Node applications, local development tools, tests, migrations, and embedded
|
|
11
|
-
* persistence use cases that need Effect SQL query compilation plus SQLite-specific operations such
|
|
12
|
-
* as exporting a database, creating backups, or loading native SQLite extensions.
|
|
13
|
-
*
|
|
14
|
-
* Each client owns one scoped `better-sqlite3` connection and serializes access through it. WAL mode
|
|
15
|
-
* is enabled by default, so set `disableWAL` when opening read-only databases or when the database
|
|
16
|
-
* location cannot change journal mode. Prepared statements are cached by SQL text, safe integer
|
|
17
|
-
* handling follows the `SqlClient` fiber-local setting, `executeStream` is not implemented, and
|
|
18
|
-
* SQLite does not support `updateValues`.
|
|
19
|
-
*
|
|
20
6
|
* @since 4.0.0
|
|
21
7
|
*/
|
|
22
8
|
export * as SqliteClient from "./SqliteClient.js";
|
|
23
9
|
/**
|
|
24
|
-
* Utilities for applying Effect SQL migrations to Node.js SQLite databases.
|
|
25
|
-
*
|
|
26
|
-
* This module re-exports the shared `Migrator` loaders and error types, then
|
|
27
|
-
* provides `run` and `layer` helpers for applying ordered migrations through the
|
|
28
|
-
* current SQLite `SqlClient`. It is typically used at application startup, in
|
|
29
|
-
* tests that create temporary database files, or in layer graphs that must
|
|
30
|
-
* ensure a file-backed SQLite schema exists before dependent services start.
|
|
31
|
-
*
|
|
32
|
-
* Migrations are recorded in `effect_sql_migrations` by default and are loaded
|
|
33
|
-
* using the shared `<id>_<name>` file or record-key convention. Only migrations
|
|
34
|
-
* with an id greater than the latest recorded id are applied, so every client
|
|
35
|
-
* involved in startup should point at the same SQLite filename. Concurrent
|
|
36
|
-
* writers can surface SQLite lock timeout errors, and this adapter does not
|
|
37
|
-
* currently write SQLite schema dumps for `schemaDirectory`.
|
|
38
|
-
*
|
|
39
10
|
* @since 4.0.0
|
|
40
11
|
*/
|
|
41
12
|
export * as SqliteMigrator from "./SqliteMigrator.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["SqliteClient","SqliteMigrator"],"sources":["../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAIA;AAEA
|
|
1
|
+
{"version":3,"file":"index.js","names":["SqliteClient","SqliteMigrator"],"sources":["../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAIA;AAEA;;;AAGA,OAAO,KAAKA,YAAY,MAAM,mBAAmB;AAEjD;;;AAGA,OAAO,KAAKC,cAAc,MAAM,qBAAqB","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect/sql-sqlite-node",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.71",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "A SQLite toolkit for Effect",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/better-sqlite3": "^7.6.13",
|
|
47
|
-
"effect": "^4.0.0-beta.
|
|
48
|
-
"
|
|
47
|
+
"@effect/platform-node": "^4.0.0-beta.71",
|
|
48
|
+
"effect": "^4.0.0-beta.71"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"effect": "^4.0.0-beta.
|
|
51
|
+
"effect": "^4.0.0-beta.71"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"better-sqlite3": "^12.9.0"
|
package/src/SqliteClient.ts
CHANGED
|
@@ -1,17 +1,44 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Node.js SQLite
|
|
2
|
+
* Node.js SQLite driver for Effect SQL, backed by `better-sqlite3`.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* Use this module to provide a scoped {@link SqliteClient} for file-backed or
|
|
5
|
+
* in-memory SQLite databases in Node.js. The provided layers install both the
|
|
6
|
+
* SQLite-specific service and the generic `SqlClient`, making the module useful
|
|
7
|
+
* for local applications, tests, migrations, development tools, and embedded
|
|
8
|
+
* persistence that need Effect SQL query compilation with SQLite-specific
|
|
9
|
+
* operations.
|
|
9
10
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* ## Mental model
|
|
12
|
+
*
|
|
13
|
+
* Each client owns one scoped `better-sqlite3` database handle and serializes
|
|
14
|
+
* all SQL access through it. Because `better-sqlite3` executes statements
|
|
15
|
+
* synchronously, a long-running query or transaction holds the serialized
|
|
16
|
+
* connection until it completes. Prepared statements are cached by SQL text and
|
|
17
|
+
* result-name transforms are applied after rows are read.
|
|
18
|
+
*
|
|
19
|
+
* The service adds Node SQLite capabilities on top of the generic `SqlClient`:
|
|
20
|
+
* database export, file backup, and native extension loading.
|
|
21
|
+
*
|
|
22
|
+
* ## Common tasks
|
|
23
|
+
*
|
|
24
|
+
* - Use {@link layer} with a concrete filename and options.
|
|
25
|
+
* - Use {@link layerConfig} when the filename or flags should come from
|
|
26
|
+
* `Config`.
|
|
27
|
+
* - Use {@link make} inside a custom scoped layer when you need to manage the
|
|
28
|
+
* client lifecycle directly.
|
|
29
|
+
* - Use `client.export`, `client.backup`, or `client.loadExtension` for
|
|
30
|
+
* operations that are specific to this Node SQLite driver.
|
|
31
|
+
*
|
|
32
|
+
* ## Gotchas
|
|
33
|
+
*
|
|
34
|
+
* WAL mode is enabled by default. Set `disableWAL` for read-only databases or
|
|
35
|
+
* when the database file or directory cannot be updated with SQLite WAL side
|
|
36
|
+
* files. Separate database handles or processes can still contend for SQLite
|
|
37
|
+
* write locks even though access through one client is serialized.
|
|
38
|
+
*
|
|
39
|
+
* Safe integer handling follows the generic `SqlClient` fiber-local setting.
|
|
40
|
+
* `executeStream` is not implemented for this driver, and SQLite does not
|
|
41
|
+
* support `updateValues`.
|
|
15
42
|
*
|
|
16
43
|
* @since 4.0.0
|
|
17
44
|
*/
|
package/src/SqliteMigrator.ts
CHANGED
|
@@ -1,16 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Migration runner for Node.js SQLite databases managed by Effect SQL.
|
|
3
3
|
*
|
|
4
4
|
* This module re-exports the shared `Migrator` loaders and error types, then
|
|
5
|
-
* provides
|
|
6
|
-
* current SQLite `SqlClient`.
|
|
7
|
-
* tests that create temporary database files, or in layer graphs
|
|
8
|
-
*
|
|
5
|
+
* provides {@link run} and {@link layer} adapters that execute ordered
|
|
6
|
+
* migrations through the current SQLite `SqlClient`. Use it during application
|
|
7
|
+
* startup, in tests that create temporary database files, or in layer graphs
|
|
8
|
+
* that must prepare a file-backed SQLite schema before dependent services are
|
|
9
|
+
* acquired.
|
|
9
10
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* ## Mental model
|
|
12
|
+
*
|
|
13
|
+
* Migrations are loaded using the shared `<id>_<name>` file or record-key
|
|
14
|
+
* convention. Applied migrations are recorded in `effect_sql_migrations` by
|
|
15
|
+
* default, and only migrations with an id greater than the latest recorded id
|
|
16
|
+
* are executed. {@link layer} runs the same migration effect during layer
|
|
17
|
+
* construction and provides no services of its own.
|
|
18
|
+
*
|
|
19
|
+
* ## Common tasks
|
|
20
|
+
*
|
|
21
|
+
* - Use {@link run} when startup code should decide where migration execution
|
|
22
|
+
* fits in the application workflow.
|
|
23
|
+
* - Use {@link layer} when a layer graph should block dependent services until
|
|
24
|
+
* the SQLite schema is up to date.
|
|
25
|
+
* - Use the re-exported shared `Migrator` loaders for file-system migrations or
|
|
26
|
+
* in-memory migration records.
|
|
27
|
+
*
|
|
28
|
+
* ## Gotchas
|
|
29
|
+
*
|
|
30
|
+
* Every client involved in startup should point at the same SQLite filename so
|
|
31
|
+
* the recorded migration ids describe the database being used. Concurrent
|
|
14
32
|
* writers can surface SQLite lock timeout errors, and this adapter does not
|
|
15
33
|
* currently write SQLite schema dumps for `schemaDirectory`.
|
|
16
34
|
*
|
package/src/index.ts
CHANGED
|
@@ -5,40 +5,11 @@
|
|
|
5
5
|
// @barrel: Auto-generated exports. Do not edit manually.
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Node.js SQLite client implementation for Effect SQL, backed by `better-sqlite3`.
|
|
9
|
-
*
|
|
10
|
-
* This module exposes constructors and layers for providing both the SQLite-specific `SqliteClient`
|
|
11
|
-
* service and the generic `SqlClient` service. It is intended for file-backed or in-memory SQLite
|
|
12
|
-
* databases in Node applications, local development tools, tests, migrations, and embedded
|
|
13
|
-
* persistence use cases that need Effect SQL query compilation plus SQLite-specific operations such
|
|
14
|
-
* as exporting a database, creating backups, or loading native SQLite extensions.
|
|
15
|
-
*
|
|
16
|
-
* Each client owns one scoped `better-sqlite3` connection and serializes access through it. WAL mode
|
|
17
|
-
* is enabled by default, so set `disableWAL` when opening read-only databases or when the database
|
|
18
|
-
* location cannot change journal mode. Prepared statements are cached by SQL text, safe integer
|
|
19
|
-
* handling follows the `SqlClient` fiber-local setting, `executeStream` is not implemented, and
|
|
20
|
-
* SQLite does not support `updateValues`.
|
|
21
|
-
*
|
|
22
8
|
* @since 4.0.0
|
|
23
9
|
*/
|
|
24
10
|
export * as SqliteClient from "./SqliteClient.ts"
|
|
25
11
|
|
|
26
12
|
/**
|
|
27
|
-
* Utilities for applying Effect SQL migrations to Node.js SQLite databases.
|
|
28
|
-
*
|
|
29
|
-
* This module re-exports the shared `Migrator` loaders and error types, then
|
|
30
|
-
* provides `run` and `layer` helpers for applying ordered migrations through the
|
|
31
|
-
* current SQLite `SqlClient`. It is typically used at application startup, in
|
|
32
|
-
* tests that create temporary database files, or in layer graphs that must
|
|
33
|
-
* ensure a file-backed SQLite schema exists before dependent services start.
|
|
34
|
-
*
|
|
35
|
-
* Migrations are recorded in `effect_sql_migrations` by default and are loaded
|
|
36
|
-
* using the shared `<id>_<name>` file or record-key convention. Only migrations
|
|
37
|
-
* with an id greater than the latest recorded id are applied, so every client
|
|
38
|
-
* involved in startup should point at the same SQLite filename. Concurrent
|
|
39
|
-
* writers can surface SQLite lock timeout errors, and this adapter does not
|
|
40
|
-
* currently write SQLite schema dumps for `schemaDirectory`.
|
|
41
|
-
*
|
|
42
13
|
* @since 4.0.0
|
|
43
14
|
*/
|
|
44
15
|
export * as SqliteMigrator from "./SqliteMigrator.ts"
|