@effect/sql-libsql 4.0.0-beta.67 → 4.0.0-beta.68
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/LibsqlClient.d.ts +3 -3
- package/dist/LibsqlClient.js +2 -2
- package/dist/LibsqlMigrator.d.ts +2 -2
- package/dist/LibsqlMigrator.js +2 -2
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/LibsqlClient.ts +3 -3
- package/src/LibsqlMigrator.ts +2 -2
- package/src/index.ts +37 -0
package/dist/LibsqlClient.d.ts
CHANGED
|
@@ -30,14 +30,14 @@ import * as Client from "effect/unstable/sql/SqlClient";
|
|
|
30
30
|
/**
|
|
31
31
|
* Runtime type identifier used to mark `LibsqlClient` values.
|
|
32
32
|
*
|
|
33
|
-
* @category type
|
|
33
|
+
* @category type IDs
|
|
34
34
|
* @since 4.0.0
|
|
35
35
|
*/
|
|
36
36
|
export declare const TypeId: TypeId;
|
|
37
37
|
/**
|
|
38
38
|
* Type-level identifier used to mark `LibsqlClient` values.
|
|
39
39
|
*
|
|
40
|
-
* @category type
|
|
40
|
+
* @category type IDs
|
|
41
41
|
* @since 4.0.0
|
|
42
42
|
*/
|
|
43
43
|
export type TypeId = "~@effect/sql-libsql/LibsqlClient";
|
|
@@ -140,7 +140,7 @@ export declare namespace LibsqlClientConfig {
|
|
|
140
140
|
/**
|
|
141
141
|
* Creates a scoped libSQL SQL client with transaction support. When given connection options it creates and closes the SDK client; when given `liveClient`, the caller retains ownership.
|
|
142
142
|
*
|
|
143
|
-
* @category
|
|
143
|
+
* @category constructors
|
|
144
144
|
* @since 4.0.0
|
|
145
145
|
*/
|
|
146
146
|
export declare const make: (options: LibsqlClientConfig) => Effect.Effect<LibsqlClient, never, Scope.Scope | Reactivity.Reactivity>;
|
package/dist/LibsqlClient.js
CHANGED
|
@@ -40,7 +40,7 @@ const classifyError = (cause, message, operation) => classifySqliteError(cause,
|
|
|
40
40
|
/**
|
|
41
41
|
* Runtime type identifier used to mark `LibsqlClient` values.
|
|
42
42
|
*
|
|
43
|
-
* @category type
|
|
43
|
+
* @category type IDs
|
|
44
44
|
* @since 4.0.0
|
|
45
45
|
*/
|
|
46
46
|
export const TypeId = "~@effect/sql-libsql/LibsqlClient";
|
|
@@ -55,7 +55,7 @@ const LibsqlTransaction = /*#__PURE__*/Context.Service("@effect/sql-libsql/Libsq
|
|
|
55
55
|
/**
|
|
56
56
|
* Creates a scoped libSQL SQL client with transaction support. When given connection options it creates and closes the SDK client; when given `liveClient`, the caller retains ownership.
|
|
57
57
|
*
|
|
58
|
-
* @category
|
|
58
|
+
* @category constructors
|
|
59
59
|
* @since 4.0.0
|
|
60
60
|
*/
|
|
61
61
|
export const make = options => Effect.gen(function* () {
|
package/dist/LibsqlMigrator.d.ts
CHANGED
|
@@ -33,14 +33,14 @@ export * from "effect/unstable/sql/Migrator";
|
|
|
33
33
|
/**
|
|
34
34
|
* Runs SQL migrations using the configured `SqlClient`, returning the migrations that were applied.
|
|
35
35
|
*
|
|
36
|
-
* @category
|
|
36
|
+
* @category constructors
|
|
37
37
|
* @since 4.0.0
|
|
38
38
|
*/
|
|
39
39
|
export declare const run: <R2 = never>(options: Migrator.MigratorOptions<R2>) => Effect.Effect<ReadonlyArray<readonly [id: number, name: string]>, Migrator.MigrationError | SqlError, Client.SqlClient | R2>;
|
|
40
40
|
/**
|
|
41
41
|
* Creates a layer that runs the configured SQL migrations during layer construction.
|
|
42
42
|
*
|
|
43
|
-
* @category
|
|
43
|
+
* @category constructors
|
|
44
44
|
* @since 4.0.0
|
|
45
45
|
*/
|
|
46
46
|
export declare const layer: <R>(options: Migrator.MigratorOptions<R>) => Layer.Layer<never, Migrator.MigrationError | SqlError, Client.SqlClient | R>;
|
package/dist/LibsqlMigrator.js
CHANGED
|
@@ -7,14 +7,14 @@ export * from "effect/unstable/sql/Migrator";
|
|
|
7
7
|
/**
|
|
8
8
|
* Runs SQL migrations using the configured `SqlClient`, returning the migrations that were applied.
|
|
9
9
|
*
|
|
10
|
-
* @category
|
|
10
|
+
* @category constructors
|
|
11
11
|
* @since 4.0.0
|
|
12
12
|
*/
|
|
13
13
|
export const run = /*#__PURE__*/Migrator.make({});
|
|
14
14
|
/**
|
|
15
15
|
* Creates a layer that runs the configured SQL migrations during layer construction.
|
|
16
16
|
*
|
|
17
|
-
* @category
|
|
17
|
+
* @category constructors
|
|
18
18
|
* @since 4.0.0
|
|
19
19
|
*/
|
|
20
20
|
export const layer = options => Layer.effectDiscard(run(options));
|
package/dist/index.d.ts
CHANGED
|
@@ -2,10 +2,47 @@
|
|
|
2
2
|
* @since 4.0.0
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
+
* libSQL client implementation for Effect SQL, backed by `@libsql/client`.
|
|
6
|
+
*
|
|
7
|
+
* This module creates or wraps a libSQL SDK client and exposes it as both the
|
|
8
|
+
* libSQL-specific `LibsqlClient` service and the generic Effect `SqlClient`.
|
|
9
|
+
* Use it for Turso-hosted libSQL databases, local `file:` databases, embedded
|
|
10
|
+
* replicas configured with `syncUrl`, migrations, tests, and application code
|
|
11
|
+
* that wants SQLite-compatible SQL through Effect services and layers.
|
|
12
|
+
*
|
|
13
|
+
* When connection options are supplied the SDK client is scoped and closed by
|
|
14
|
+
* the layer; when `liveClient` is supplied ownership stays with the caller.
|
|
15
|
+
* Top-level `withTransaction` blocks open a libSQL write transaction, nested
|
|
16
|
+
* transactions use SQLite savepoints, and only statements run through the same
|
|
17
|
+
* Effect client participate in that transaction. Keep Turso or remote libSQL
|
|
18
|
+
* transactions short, because the transaction holds the client reservation
|
|
19
|
+
* until commit or rollback; direct SDK calls made outside this service are not
|
|
20
|
+
* coordinated with Effect SQL transactions. Row streaming is not implemented.
|
|
21
|
+
*
|
|
5
22
|
* @since 4.0.0
|
|
6
23
|
*/
|
|
7
24
|
export * as LibsqlClient from "./LibsqlClient.ts";
|
|
8
25
|
/**
|
|
26
|
+
* Utilities for applying Effect SQL migrations to libSQL and Turso databases.
|
|
27
|
+
*
|
|
28
|
+
* This module re-exports the shared `Migrator` loaders and error types, then
|
|
29
|
+
* provides `run` and `layer` helpers for applying ordered migrations through the
|
|
30
|
+
* current libSQL-backed `SqlClient`. It is typically used at application
|
|
31
|
+
* startup, in deployment or setup scripts for Turso databases, in tests that
|
|
32
|
+
* create temporary `file:` databases, or in layer graphs that must ensure the
|
|
33
|
+
* schema exists before dependent services are acquired.
|
|
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. Because libSQL
|
|
37
|
+
* uses SQLite-compatible SQL, migrations should avoid dialect features that are
|
|
38
|
+
* not supported by libSQL or the configured Turso deployment. Remote Turso
|
|
39
|
+
* databases, local `file:` databases, and embedded replicas can each observe
|
|
40
|
+
* different state until replication has caught up, so run schema-changing
|
|
41
|
+
* migrations against the intended writer and wait for replicas to sync before
|
|
42
|
+
* serving code that depends on the new schema. Concurrent migrators rely on the
|
|
43
|
+
* migrations table primary key to detect races, and this adapter does not
|
|
44
|
+
* currently write schema dumps for `schemaDirectory`.
|
|
45
|
+
*
|
|
9
46
|
* @since 4.0.0
|
|
10
47
|
*/
|
|
11
48
|
export * as LibsqlMigrator from "./LibsqlMigrator.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;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA;AAEjD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -3,10 +3,47 @@
|
|
|
3
3
|
*/
|
|
4
4
|
// @barrel: Auto-generated exports. Do not edit manually.
|
|
5
5
|
/**
|
|
6
|
+
* libSQL client implementation for Effect SQL, backed by `@libsql/client`.
|
|
7
|
+
*
|
|
8
|
+
* This module creates or wraps a libSQL SDK client and exposes it as both the
|
|
9
|
+
* libSQL-specific `LibsqlClient` service and the generic Effect `SqlClient`.
|
|
10
|
+
* Use it for Turso-hosted libSQL databases, local `file:` databases, embedded
|
|
11
|
+
* replicas configured with `syncUrl`, migrations, tests, and application code
|
|
12
|
+
* that wants SQLite-compatible SQL through Effect services and layers.
|
|
13
|
+
*
|
|
14
|
+
* When connection options are supplied the SDK client is scoped and closed by
|
|
15
|
+
* the layer; when `liveClient` is supplied ownership stays with the caller.
|
|
16
|
+
* Top-level `withTransaction` blocks open a libSQL write transaction, nested
|
|
17
|
+
* transactions use SQLite savepoints, and only statements run through the same
|
|
18
|
+
* Effect client participate in that transaction. Keep Turso or remote libSQL
|
|
19
|
+
* transactions short, because the transaction holds the client reservation
|
|
20
|
+
* until commit or rollback; direct SDK calls made outside this service are not
|
|
21
|
+
* coordinated with Effect SQL transactions. Row streaming is not implemented.
|
|
22
|
+
*
|
|
6
23
|
* @since 4.0.0
|
|
7
24
|
*/
|
|
8
25
|
export * as LibsqlClient from "./LibsqlClient.js";
|
|
9
26
|
/**
|
|
27
|
+
* Utilities for applying Effect SQL migrations to libSQL and Turso 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 libSQL-backed `SqlClient`. It is typically used at application
|
|
32
|
+
* startup, in deployment or setup scripts for Turso databases, in tests that
|
|
33
|
+
* create temporary `file:` databases, or in layer graphs that must ensure the
|
|
34
|
+
* schema exists before dependent services are acquired.
|
|
35
|
+
*
|
|
36
|
+
* Migrations are recorded in `effect_sql_migrations` by default and are loaded
|
|
37
|
+
* using the shared `<id>_<name>` file or record-key convention. Because libSQL
|
|
38
|
+
* uses SQLite-compatible SQL, migrations should avoid dialect features that are
|
|
39
|
+
* not supported by libSQL or the configured Turso deployment. Remote Turso
|
|
40
|
+
* databases, local `file:` databases, and embedded replicas can each observe
|
|
41
|
+
* different state until replication has caught up, so run schema-changing
|
|
42
|
+
* migrations against the intended writer and wait for replicas to sync before
|
|
43
|
+
* serving code that depends on the new schema. Concurrent migrators rely on the
|
|
44
|
+
* migrations table primary key to detect races, and this adapter does not
|
|
45
|
+
* currently write schema dumps for `schemaDirectory`.
|
|
46
|
+
*
|
|
10
47
|
* @since 4.0.0
|
|
11
48
|
*/
|
|
12
49
|
export * as LibsqlMigrator from "./LibsqlMigrator.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["LibsqlClient","LibsqlMigrator"],"sources":["../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAIA;AAEA
|
|
1
|
+
{"version":3,"file":"index.js","names":["LibsqlClient","LibsqlMigrator"],"sources":["../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAIA;AAEA;;;;;;;;;;;;;;;;;;;;AAoBA,OAAO,KAAKA,YAAY,MAAM,mBAAmB;AAEjD;;;;;;;;;;;;;;;;;;;;;;;AAuBA,OAAO,KAAKC,cAAc,MAAM,qBAAqB","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect/sql-libsql",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.68",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "A libSQL toolkit for Effect",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"testcontainers": "^11.14.0",
|
|
49
|
-
"effect": "^4.0.0-beta.
|
|
49
|
+
"effect": "^4.0.0-beta.68"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"effect": "^4.0.0-beta.
|
|
52
|
+
"effect": "^4.0.0-beta.68"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@libsql/client": "^0.17.3"
|
package/src/LibsqlClient.ts
CHANGED
|
@@ -42,7 +42,7 @@ const classifyError = (cause: unknown, message: string, operation: string) =>
|
|
|
42
42
|
/**
|
|
43
43
|
* Runtime type identifier used to mark `LibsqlClient` values.
|
|
44
44
|
*
|
|
45
|
-
* @category type
|
|
45
|
+
* @category type IDs
|
|
46
46
|
* @since 4.0.0
|
|
47
47
|
*/
|
|
48
48
|
export const TypeId: TypeId = "~@effect/sql-libsql/LibsqlClient"
|
|
@@ -50,7 +50,7 @@ export const TypeId: TypeId = "~@effect/sql-libsql/LibsqlClient"
|
|
|
50
50
|
/**
|
|
51
51
|
* Type-level identifier used to mark `LibsqlClient` values.
|
|
52
52
|
*
|
|
53
|
-
* @category type
|
|
53
|
+
* @category type IDs
|
|
54
54
|
* @since 4.0.0
|
|
55
55
|
*/
|
|
56
56
|
export type TypeId = "~@effect/sql-libsql/LibsqlClient"
|
|
@@ -170,7 +170,7 @@ interface LibsqlConnection extends Connection {
|
|
|
170
170
|
/**
|
|
171
171
|
* Creates a scoped libSQL SQL client with transaction support. When given connection options it creates and closes the SDK client; when given `liveClient`, the caller retains ownership.
|
|
172
172
|
*
|
|
173
|
-
* @category
|
|
173
|
+
* @category constructors
|
|
174
174
|
* @since 4.0.0
|
|
175
175
|
*/
|
|
176
176
|
export const make = (
|
package/src/LibsqlMigrator.ts
CHANGED
|
@@ -35,7 +35,7 @@ export * from "effect/unstable/sql/Migrator"
|
|
|
35
35
|
/**
|
|
36
36
|
* Runs SQL migrations using the configured `SqlClient`, returning the migrations that were applied.
|
|
37
37
|
*
|
|
38
|
-
* @category
|
|
38
|
+
* @category constructors
|
|
39
39
|
* @since 4.0.0
|
|
40
40
|
*/
|
|
41
41
|
export const run: <R2 = never>(
|
|
@@ -49,7 +49,7 @@ export const run: <R2 = never>(
|
|
|
49
49
|
/**
|
|
50
50
|
* Creates a layer that runs the configured SQL migrations during layer construction.
|
|
51
51
|
*
|
|
52
|
-
* @category
|
|
52
|
+
* @category constructors
|
|
53
53
|
* @since 4.0.0
|
|
54
54
|
*/
|
|
55
55
|
export const layer = <R>(
|
package/src/index.ts
CHANGED
|
@@ -5,11 +5,48 @@
|
|
|
5
5
|
// @barrel: Auto-generated exports. Do not edit manually.
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
+
* libSQL client implementation for Effect SQL, backed by `@libsql/client`.
|
|
9
|
+
*
|
|
10
|
+
* This module creates or wraps a libSQL SDK client and exposes it as both the
|
|
11
|
+
* libSQL-specific `LibsqlClient` service and the generic Effect `SqlClient`.
|
|
12
|
+
* Use it for Turso-hosted libSQL databases, local `file:` databases, embedded
|
|
13
|
+
* replicas configured with `syncUrl`, migrations, tests, and application code
|
|
14
|
+
* that wants SQLite-compatible SQL through Effect services and layers.
|
|
15
|
+
*
|
|
16
|
+
* When connection options are supplied the SDK client is scoped and closed by
|
|
17
|
+
* the layer; when `liveClient` is supplied ownership stays with the caller.
|
|
18
|
+
* Top-level `withTransaction` blocks open a libSQL write transaction, nested
|
|
19
|
+
* transactions use SQLite savepoints, and only statements run through the same
|
|
20
|
+
* Effect client participate in that transaction. Keep Turso or remote libSQL
|
|
21
|
+
* transactions short, because the transaction holds the client reservation
|
|
22
|
+
* until commit or rollback; direct SDK calls made outside this service are not
|
|
23
|
+
* coordinated with Effect SQL transactions. Row streaming is not implemented.
|
|
24
|
+
*
|
|
8
25
|
* @since 4.0.0
|
|
9
26
|
*/
|
|
10
27
|
export * as LibsqlClient from "./LibsqlClient.ts"
|
|
11
28
|
|
|
12
29
|
/**
|
|
30
|
+
* Utilities for applying Effect SQL migrations to libSQL and Turso databases.
|
|
31
|
+
*
|
|
32
|
+
* This module re-exports the shared `Migrator` loaders and error types, then
|
|
33
|
+
* provides `run` and `layer` helpers for applying ordered migrations through the
|
|
34
|
+
* current libSQL-backed `SqlClient`. It is typically used at application
|
|
35
|
+
* startup, in deployment or setup scripts for Turso databases, in tests that
|
|
36
|
+
* create temporary `file:` databases, or in layer graphs that must ensure the
|
|
37
|
+
* schema exists before dependent services are acquired.
|
|
38
|
+
*
|
|
39
|
+
* Migrations are recorded in `effect_sql_migrations` by default and are loaded
|
|
40
|
+
* using the shared `<id>_<name>` file or record-key convention. Because libSQL
|
|
41
|
+
* uses SQLite-compatible SQL, migrations should avoid dialect features that are
|
|
42
|
+
* not supported by libSQL or the configured Turso deployment. Remote Turso
|
|
43
|
+
* databases, local `file:` databases, and embedded replicas can each observe
|
|
44
|
+
* different state until replication has caught up, so run schema-changing
|
|
45
|
+
* migrations against the intended writer and wait for replicas to sync before
|
|
46
|
+
* serving code that depends on the new schema. Concurrent migrators rely on the
|
|
47
|
+
* migrations table primary key to detect races, and this adapter does not
|
|
48
|
+
* currently write schema dumps for `schemaDirectory`.
|
|
49
|
+
*
|
|
13
50
|
* @since 4.0.0
|
|
14
51
|
*/
|
|
15
52
|
export * as LibsqlMigrator from "./LibsqlMigrator.ts"
|