@effect/sql-sqlite-do 4.0.0-beta.78 → 4.0.0-beta.79
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 +6 -30
- package/dist/SqliteClient.d.ts.map +1 -1
- package/dist/SqliteClient.js.map +1 -1
- package/dist/SqliteMigrator.d.ts +6 -19
- package/dist/SqliteMigrator.d.ts.map +1 -1
- package/dist/SqliteMigrator.js.map +1 -1
- package/package.json +3 -3
- package/src/SqliteClient.ts +6 -30
- package/src/SqliteMigrator.ts +6 -19
package/dist/SqliteClient.d.ts
CHANGED
|
@@ -1,35 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Effect SQL
|
|
2
|
+
* Connects Effect SQL to SQLite storage inside Cloudflare Durable Objects.
|
|
3
3
|
*
|
|
4
|
-
* This module
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* **Mental model**
|
|
11
|
-
*
|
|
12
|
-
* Durable Object storage is scoped to one object id. Each object instance has
|
|
13
|
-
* its own database, and {@link make} wraps the same `SqlStorage` handle that
|
|
14
|
-
* the object uses for normal reads and writes. Effect SQL access is serialized
|
|
15
|
-
* through one connection; a transaction keeps that permit for the lifetime of
|
|
16
|
-
* its scope.
|
|
17
|
-
*
|
|
18
|
-
* **Common tasks**
|
|
19
|
-
*
|
|
20
|
-
* Use {@link layer} when the Durable Object constructor already has a concrete
|
|
21
|
-
* `SqlStorage` handle. Use {@link layerConfig} when the handle and transform
|
|
22
|
-
* options should be supplied through Effect `Config`. Keep using generic
|
|
23
|
-
* `SqlClient` APIs for ordinary SQL, and depend on {@link SqliteClient} when
|
|
24
|
-
* code needs the Durable Object-specific service identity.
|
|
25
|
-
*
|
|
26
|
-
* **Gotchas**
|
|
27
|
-
*
|
|
28
|
-
* Keep transactions short and avoid suspending them across unrelated work,
|
|
29
|
-
* because all access through one client waits on the same serialized
|
|
30
|
-
* connection. `SqlStorage.exec` returns SQLite blob values as `ArrayBuffer`,
|
|
31
|
-
* which this client normalizes to `Uint8Array`. SQLite does not support
|
|
32
|
-
* `updateValues`.
|
|
4
|
+
* This module wraps a Durable Object `SqlStorage` handle and exposes it as both
|
|
5
|
+
* `SqliteClient` and the generic Effect SQL client. It serializes access,
|
|
6
|
+
* supports normal and streaming queries, converts returned `ArrayBuffer` values
|
|
7
|
+
* to `Uint8Array`, and provides layers for wiring the client into an Effect
|
|
8
|
+
* application. `updateValues` is not supported by this driver.
|
|
33
9
|
*
|
|
34
10
|
* @since 4.0.0
|
|
35
11
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SqliteClient.d.ts","sourceRoot":"","sources":["../src/SqliteClient.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"SqliteClient.d.ts","sourceRoot":"","sources":["../src/SqliteClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,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;AAUvD;;;;;GAKG;AACH,eAAO,MAAM,MAAM,EAAE,MAA8C,CAAA;AAEnE;;;;;GAKG;AACH,MAAM,MAAM,MAAM,GAAG,qCAAqC,CAAA;AAE1D;;;;;GAKG;AACH,MAAM,WAAW,YAAa,SAAQ,MAAM,CAAC,SAAS;IACpD,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAA;IAEnC,8BAA8B;IAC9B,QAAQ,CAAC,YAAY,EAAE,KAAK,CAAA;CAC7B;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,6CAAsE,CAAA;AAE/F;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,EAAE,UAAU,CAAA;IACvB,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;IAE7D,QAAQ,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,SAAS,CAAA;IACrE,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,SAAS,CAAA;CACrE;AAED;;;;;GAKG;AACH,eAAO,MAAM,IAAI,GACf,SAAS,kBAAkB,KAC1B,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,UAAU,CAmHrE,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.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SqliteClient.js","names":["Config","Context","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","db","runIterator","sql","params","cursor","exec","columns","columnNames","result","raw","obj","i","length","value","ArrayBuffer","Uint8Array","runStatement","try","Array","from","catch","reason","runValues","row","execute","map","executeRaw","executeValues","executeUnprepared","executeStream","suspend","iterator","fromIteratorSucceed","pipe","mapArray","chunk","semaphore","connection","acquirer","withPermits","succeed","transactionAcquirer","uninterruptibleMask","restore","fiber","getCurrent","scope","getUnsafe","context","as","tap","take","addFinalizer","release","Object","assign","spanAttributes","entries","config","layerConfig","effectContext","unwrap","flatMap","client","add","SqlClient","provide","layer"],"sources":["../src/SqliteClient.ts"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"file":"SqliteClient.js","names":["Config","Context","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","db","runIterator","sql","params","cursor","exec","columns","columnNames","result","raw","obj","i","length","value","ArrayBuffer","Uint8Array","runStatement","try","Array","from","catch","reason","runValues","row","execute","map","executeRaw","executeValues","executeUnprepared","executeStream","suspend","iterator","fromIteratorSucceed","pipe","mapArray","chunk","semaphore","connection","acquirer","withPermits","succeed","transactionAcquirer","uninterruptibleMask","restore","fiber","getCurrent","scope","getUnsafe","context","as","tap","take","addFinalizer","release","Object","assign","spanAttributes","entries","config","layerConfig","effectContext","unwrap","flatMap","client","add","SqlClient","provide","layer"],"sources":["../src/SqliteClient.ts"],"sourcesContent":[null],"mappings":"AAYA,OAAO,KAAKA,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAKC,MAAM,MAAM,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;IACE,CAACT,MAAM,GAAGA,MAAgB;IAC1ByE,MAAM,EAAErE;GACT,CACF;AACH,CAAC,CAAC;AAEJ;;;;;;AAMA,OAAO,MAAMsE,WAAW,GACtBD,MAAuC,IAEvCvF,KAAK,CAACyF,aAAa,CACjB9F,MAAM,CAAC+F,MAAM,CAACH,MAAM,CAAC,CAACzB,IAAI,CACxBjE,MAAM,CAAC8F,OAAO,CAAC1E,IAAI,CAAC,EACpBpB,MAAM,CAACyD,GAAG,CAAEsC,MAAM,IAChBhG,OAAO,CAACqB,IAAI,CAACF,YAAY,EAAE6E,MAAM,CAAC,CAAC9B,IAAI,CACrClE,OAAO,CAACiG,GAAG,CAACxF,MAAM,CAACyF,SAAS,EAAEF,MAAM,CAAC,CACtC,CACF,CACF,CACF,CAAC9B,IAAI,CAAC9D,KAAK,CAAC+F,OAAO,CAAC3F,UAAU,CAAC4F,KAAK,CAAC,CAAC;AAEzC;;;;;;AAMA,OAAO,MAAMA,KAAK,GAChBT,MAA0B,IAE1BvF,KAAK,CAACyF,aAAa,CACjB5F,MAAM,CAACyD,GAAG,CAACrC,IAAI,CAACsE,MAAM,CAAC,EAAGK,MAAM,IAC9BhG,OAAO,CAACqB,IAAI,CAACF,YAAY,EAAE6E,MAAM,CAAC,CAAC9B,IAAI,CACrClE,OAAO,CAACiG,GAAG,CAACxF,MAAM,CAACyF,SAAS,EAAEF,MAAM,CAAC,CACtC,CAAC,CACL,CAAC9B,IAAI,CAAC9D,KAAK,CAAC+F,OAAO,CAAC3F,UAAU,CAAC4F,KAAK,CAAC,CAAC","ignoreList":[]}
|
package/dist/SqliteMigrator.d.ts
CHANGED
|
@@ -1,24 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Runs database migrations for Durable Object SQLite storage that uses Effect
|
|
3
|
+
* SQL.
|
|
3
4
|
*
|
|
4
|
-
* This module re-exports the shared
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* repositories or request handlers use the object storage, or in tests that
|
|
9
|
-
* exercise Durable Object persistence.
|
|
10
|
-
*
|
|
11
|
-
* Migrations are recorded in `effect_sql_migrations` by default and are loaded
|
|
12
|
-
* using the shared `<id>_<name>` file or record-key convention. The underlying
|
|
13
|
-
* storage is scoped to a Durable Object id, so running migrations for one object
|
|
14
|
-
* does not update any other object instance; run the migrator against the same
|
|
15
|
-
* `SqlStorage` handle that the object uses for normal queries. These SQL
|
|
16
|
-
* migrations are separate from Cloudflare's Durable Object class migrations, and
|
|
17
|
-
* the Durable Object must already be configured with SQLite storage before this
|
|
18
|
-
* module can apply schema changes. Repeated startup runs are expected and are
|
|
19
|
-
* guarded by the migrations table, but request handling should wait until the
|
|
20
|
-
* migration layer has finished. This adapter does not currently write SQLite
|
|
21
|
-
* schema dumps for `schemaDirectory`.
|
|
5
|
+
* This module re-exports the shared migration loaders and errors, then provides
|
|
6
|
+
* `run` and `layer` helpers that apply pending migration files with the current
|
|
7
|
+
* `SqlClient`. The SQL client supplies the Durable Object storage connection;
|
|
8
|
+
* this module only handles migration execution.
|
|
22
9
|
*
|
|
23
10
|
* @since 4.0.0
|
|
24
11
|
*/
|
|
@@ -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;;;;;;;;;;GAUG;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,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,EAAE,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,KAC7D,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,CACF,CAAA;AAErB;;;;;GAKG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,EACrB,SAAS,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,KACnC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,QAAQ,CAAC,cAAc,GAAG,QAAQ,EAAE,MAAM,CAAC,SAAS,GAAG,CAAC,CAAsC,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":"AAYA,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,EAAE,CAAC;AAErB;;;;;;AAMA,OAAO,MAAMC,KAAK,GAChBC,OAAoC,IAC6CL,KAAK,CAACM,aAAa,CAACJ,GAAG,CAACG,OAAO,CAAC,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect/sql-sqlite-do",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.79",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "A SQLite toolkit for Effect",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@cloudflare/workers-types": "^4.20260511.1",
|
|
47
|
-
"effect": "^4.0.0-beta.
|
|
47
|
+
"effect": "^4.0.0-beta.79"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"effect": "^4.0.0-beta.
|
|
50
|
+
"effect": "^4.0.0-beta.79"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"codegen": "effect-utils codegen",
|
package/src/SqliteClient.ts
CHANGED
|
@@ -1,35 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Effect SQL
|
|
2
|
+
* Connects Effect SQL to SQLite storage inside Cloudflare Durable Objects.
|
|
3
3
|
*
|
|
4
|
-
* This module
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* **Mental model**
|
|
11
|
-
*
|
|
12
|
-
* Durable Object storage is scoped to one object id. Each object instance has
|
|
13
|
-
* its own database, and {@link make} wraps the same `SqlStorage` handle that
|
|
14
|
-
* the object uses for normal reads and writes. Effect SQL access is serialized
|
|
15
|
-
* through one connection; a transaction keeps that permit for the lifetime of
|
|
16
|
-
* its scope.
|
|
17
|
-
*
|
|
18
|
-
* **Common tasks**
|
|
19
|
-
*
|
|
20
|
-
* Use {@link layer} when the Durable Object constructor already has a concrete
|
|
21
|
-
* `SqlStorage` handle. Use {@link layerConfig} when the handle and transform
|
|
22
|
-
* options should be supplied through Effect `Config`. Keep using generic
|
|
23
|
-
* `SqlClient` APIs for ordinary SQL, and depend on {@link SqliteClient} when
|
|
24
|
-
* code needs the Durable Object-specific service identity.
|
|
25
|
-
*
|
|
26
|
-
* **Gotchas**
|
|
27
|
-
*
|
|
28
|
-
* Keep transactions short and avoid suspending them across unrelated work,
|
|
29
|
-
* because all access through one client waits on the same serialized
|
|
30
|
-
* connection. `SqlStorage.exec` returns SQLite blob values as `ArrayBuffer`,
|
|
31
|
-
* which this client normalizes to `Uint8Array`. SQLite does not support
|
|
32
|
-
* `updateValues`.
|
|
4
|
+
* This module wraps a Durable Object `SqlStorage` handle and exposes it as both
|
|
5
|
+
* `SqliteClient` and the generic Effect SQL client. It serializes access,
|
|
6
|
+
* supports normal and streaming queries, converts returned `ArrayBuffer` values
|
|
7
|
+
* to `Uint8Array`, and provides layers for wiring the client into an Effect
|
|
8
|
+
* application. `updateValues` is not supported by this driver.
|
|
33
9
|
*
|
|
34
10
|
* @since 4.0.0
|
|
35
11
|
*/
|
package/src/SqliteMigrator.ts
CHANGED
|
@@ -1,24 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Runs database migrations for Durable Object SQLite storage that uses Effect
|
|
3
|
+
* SQL.
|
|
3
4
|
*
|
|
4
|
-
* This module re-exports the shared
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* repositories or request handlers use the object storage, or in tests that
|
|
9
|
-
* exercise Durable Object persistence.
|
|
10
|
-
*
|
|
11
|
-
* Migrations are recorded in `effect_sql_migrations` by default and are loaded
|
|
12
|
-
* using the shared `<id>_<name>` file or record-key convention. The underlying
|
|
13
|
-
* storage is scoped to a Durable Object id, so running migrations for one object
|
|
14
|
-
* does not update any other object instance; run the migrator against the same
|
|
15
|
-
* `SqlStorage` handle that the object uses for normal queries. These SQL
|
|
16
|
-
* migrations are separate from Cloudflare's Durable Object class migrations, and
|
|
17
|
-
* the Durable Object must already be configured with SQLite storage before this
|
|
18
|
-
* module can apply schema changes. Repeated startup runs are expected and are
|
|
19
|
-
* guarded by the migrations table, but request handling should wait until the
|
|
20
|
-
* migration layer has finished. This adapter does not currently write SQLite
|
|
21
|
-
* schema dumps for `schemaDirectory`.
|
|
5
|
+
* This module re-exports the shared migration loaders and errors, then provides
|
|
6
|
+
* `run` and `layer` helpers that apply pending migration files with the current
|
|
7
|
+
* `SqlClient`. The SQL client supplies the Durable Object storage connection;
|
|
8
|
+
* this module only handles migration execution.
|
|
22
9
|
*
|
|
23
10
|
* @since 4.0.0
|
|
24
11
|
*/
|