@effect/sql-sqlite-react-native 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/SqliteClient.d.ts +3 -3
- package/dist/SqliteClient.js +2 -2
- package/dist/SqliteMigrator.d.ts +2 -2
- package/dist/SqliteMigrator.js +2 -2
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/SqliteClient.ts +3 -11
- package/src/SqliteMigrator.ts +2 -2
- package/src/index.ts +33 -0
package/dist/SqliteClient.d.ts
CHANGED
|
@@ -8,14 +8,14 @@ import * as Client from "effect/unstable/sql/SqlClient";
|
|
|
8
8
|
/**
|
|
9
9
|
* Runtime identifier attached to SQLite React Native client values.
|
|
10
10
|
*
|
|
11
|
-
* @category type
|
|
11
|
+
* @category type IDs
|
|
12
12
|
* @since 4.0.0
|
|
13
13
|
*/
|
|
14
14
|
export declare const TypeId: TypeId;
|
|
15
15
|
/**
|
|
16
16
|
* Type-level identifier for SQLite React Native client values.
|
|
17
17
|
*
|
|
18
|
-
* @category type
|
|
18
|
+
* @category type IDs
|
|
19
19
|
* @since 4.0.0
|
|
20
20
|
*/
|
|
21
21
|
export type TypeId = "~@effect/sql-sqlite-react-native/SqliteClient";
|
|
@@ -69,7 +69,7 @@ export declare const withAsyncQuery: <R, E, A>(effect: Effect.Effect<A, E, R>) =
|
|
|
69
69
|
/**
|
|
70
70
|
* Creates a scoped React Native SQLite client from the supplied configuration, using a single serialized connection and honoring `AsyncQuery` for query execution.
|
|
71
71
|
*
|
|
72
|
-
* @category
|
|
72
|
+
* @category constructors
|
|
73
73
|
* @since 4.0.0
|
|
74
74
|
*/
|
|
75
75
|
export declare const make: (options: SqliteClientConfig) => Effect.Effect<SqliteClient, never, Scope.Scope | Reactivity.Reactivity>;
|
package/dist/SqliteClient.js
CHANGED
|
@@ -38,7 +38,7 @@ const classifyError = (cause, message, operation) => classifySqliteError(cause,
|
|
|
38
38
|
/**
|
|
39
39
|
* Runtime identifier attached to SQLite React Native client values.
|
|
40
40
|
*
|
|
41
|
-
* @category type
|
|
41
|
+
* @category type IDs
|
|
42
42
|
* @since 4.0.0
|
|
43
43
|
*/
|
|
44
44
|
export const TypeId = "~@effect/sql-sqlite-react-native/SqliteClient";
|
|
@@ -68,7 +68,7 @@ export const withAsyncQuery = effect => Effect.provideService(effect, AsyncQuery
|
|
|
68
68
|
/**
|
|
69
69
|
* Creates a scoped React Native SQLite client from the supplied configuration, using a single serialized connection and honoring `AsyncQuery` for query execution.
|
|
70
70
|
*
|
|
71
|
-
* @category
|
|
71
|
+
* @category constructors
|
|
72
72
|
* @since 4.0.0
|
|
73
73
|
*/
|
|
74
74
|
export const make = options => Effect.gen(function* () {
|
package/dist/SqliteMigrator.d.ts
CHANGED
|
@@ -31,14 +31,14 @@ export * from "effect/unstable/sql/Migrator";
|
|
|
31
31
|
/**
|
|
32
32
|
* Runs SQL migrations for a React Native SQLite database using the shared `Migrator` implementation and the current `SqlClient`.
|
|
33
33
|
*
|
|
34
|
-
* @category
|
|
34
|
+
* @category constructors
|
|
35
35
|
* @since 4.0.0
|
|
36
36
|
*/
|
|
37
37
|
export declare const run: <R>(options: Migrator.MigratorOptions<R>) => Effect.Effect<ReadonlyArray<readonly [id: number, name: string]>, SqlError | Migrator.MigrationError, Client.SqlClient | R>;
|
|
38
38
|
/**
|
|
39
39
|
* Creates a layer that runs the configured React Native SQLite migrations during layer construction and provides no services.
|
|
40
40
|
*
|
|
41
|
-
* @category
|
|
41
|
+
* @category constructors
|
|
42
42
|
* @since 4.0.0
|
|
43
43
|
*/
|
|
44
44
|
export declare const layer: <R>(options: Migrator.MigratorOptions<R>) => Layer.Layer<never, SqlError | Migrator.MigrationError, R | Client.SqlClient>;
|
package/dist/SqliteMigrator.js
CHANGED
|
@@ -7,14 +7,14 @@ export * from "effect/unstable/sql/Migrator";
|
|
|
7
7
|
/**
|
|
8
8
|
* Runs SQL migrations for a React Native SQLite database using the shared `Migrator` implementation and the current `SqlClient`.
|
|
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 React Native SQLite migrations during layer construction and provides no services.
|
|
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,43 @@
|
|
|
2
2
|
* @since 4.0.0
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
+
* Provides a React Native SQLite `SqlClient` backed by `@op-engineering/op-sqlite`.
|
|
6
|
+
*
|
|
7
|
+
* Use this module to open an on-device SQLite database, expose it as both the
|
|
8
|
+
* React Native-specific `SqliteClient` and the generic Effect `SqlClient`, and
|
|
9
|
+
* run application queries, migrations, and transactional reads or writes from
|
|
10
|
+
* Effect services and layers.
|
|
11
|
+
*
|
|
12
|
+
* The client uses one serialized connection. Regular queries and transactions
|
|
13
|
+
* share that handle, and a transaction holds it for the lifetime of its scope,
|
|
14
|
+
* so keep mobile transactions short and wrap multi-statement writes in a
|
|
15
|
+
* transaction to avoid partial updates. By default statements use the driver's
|
|
16
|
+
* synchronous API, which can block the JavaScript thread; `withAsyncQuery`
|
|
17
|
+
* switches a fiber to the asynchronous driver API when UI responsiveness is more
|
|
18
|
+
* important than sync execution.
|
|
19
|
+
*
|
|
5
20
|
* @since 4.0.0
|
|
6
21
|
*/
|
|
7
22
|
export * as SqliteClient from "./SqliteClient.ts";
|
|
8
23
|
/**
|
|
24
|
+
* Utilities for applying Effect SQL migrations to React Native SQLite databases.
|
|
25
|
+
*
|
|
26
|
+
* This module re-exports the shared `Migrator` loaders and error types, then
|
|
27
|
+
* provides `run` and `layer` helpers that execute ordered migrations through the
|
|
28
|
+
* current React Native SQLite `SqlClient`. Use it when a mobile app needs to
|
|
29
|
+
* bring its on-device database schema up to date during startup, before opening
|
|
30
|
+
* repositories or sync services, or in integration tests that create app-local
|
|
31
|
+
* database files.
|
|
32
|
+
*
|
|
33
|
+
* React Native SQLite databases are scoped by the client configuration, so the
|
|
34
|
+
* migrator should be run with the same `filename`, `location`, and encryption
|
|
35
|
+
* key as the rest of the application. Migrations run through the package's
|
|
36
|
+
* single serialized connection; by default statements use the synchronous
|
|
37
|
+
* driver API and can block the JS thread, so long migration sets may want to run
|
|
38
|
+
* under `SqliteClient.withAsyncQuery`. Mobile upgrades can be interrupted by app
|
|
39
|
+
* suspension or process death, so keep migrations transaction-aware and avoid
|
|
40
|
+
* assuming a fresh database on every launch.
|
|
41
|
+
*
|
|
9
42
|
* @since 4.0.0
|
|
10
43
|
*/
|
|
11
44
|
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;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA;AAEjD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -3,10 +3,43 @@
|
|
|
3
3
|
*/
|
|
4
4
|
// @barrel: Auto-generated exports. Do not edit manually.
|
|
5
5
|
/**
|
|
6
|
+
* Provides a React Native SQLite `SqlClient` backed by `@op-engineering/op-sqlite`.
|
|
7
|
+
*
|
|
8
|
+
* Use this module to open an on-device SQLite database, expose it as both the
|
|
9
|
+
* React Native-specific `SqliteClient` and the generic Effect `SqlClient`, and
|
|
10
|
+
* run application queries, migrations, and transactional reads or writes from
|
|
11
|
+
* Effect services and layers.
|
|
12
|
+
*
|
|
13
|
+
* The client uses one serialized connection. Regular queries and transactions
|
|
14
|
+
* share that handle, and a transaction holds it for the lifetime of its scope,
|
|
15
|
+
* so keep mobile transactions short and wrap multi-statement writes in a
|
|
16
|
+
* transaction to avoid partial updates. By default statements use the driver's
|
|
17
|
+
* synchronous API, which can block the JavaScript thread; `withAsyncQuery`
|
|
18
|
+
* switches a fiber to the asynchronous driver API when UI responsiveness is more
|
|
19
|
+
* important than sync execution.
|
|
20
|
+
*
|
|
6
21
|
* @since 4.0.0
|
|
7
22
|
*/
|
|
8
23
|
export * as SqliteClient from "./SqliteClient.js";
|
|
9
24
|
/**
|
|
25
|
+
* Utilities for applying Effect SQL migrations to React Native SQLite databases.
|
|
26
|
+
*
|
|
27
|
+
* This module re-exports the shared `Migrator` loaders and error types, then
|
|
28
|
+
* provides `run` and `layer` helpers that execute ordered migrations through the
|
|
29
|
+
* current React Native SQLite `SqlClient`. Use it when a mobile app needs to
|
|
30
|
+
* bring its on-device database schema up to date during startup, before opening
|
|
31
|
+
* repositories or sync services, or in integration tests that create app-local
|
|
32
|
+
* database files.
|
|
33
|
+
*
|
|
34
|
+
* React Native SQLite databases are scoped by the client configuration, so the
|
|
35
|
+
* migrator should be run with the same `filename`, `location`, and encryption
|
|
36
|
+
* key as the rest of the application. Migrations run through the package's
|
|
37
|
+
* single serialized connection; by default statements use the synchronous
|
|
38
|
+
* driver API and can block the JS thread, so long migration sets may want to run
|
|
39
|
+
* under `SqliteClient.withAsyncQuery`. Mobile upgrades can be interrupted by app
|
|
40
|
+
* suspension or process death, so keep migrations transaction-aware and avoid
|
|
41
|
+
* assuming a fresh database on every launch.
|
|
42
|
+
*
|
|
10
43
|
* @since 4.0.0
|
|
11
44
|
*/
|
|
12
45
|
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;;;;;;;;;;;;;;;;;;AAkBA,OAAO,KAAKA,YAAY,MAAM,mBAAmB;AAEjD;;;;;;;;;;;;;;;;;;;;;AAqBA,OAAO,KAAKC,cAAc,MAAM,qBAAqB","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect/sql-sqlite-react-native",
|
|
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 SQLite toolkit for Effect",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@op-engineering/op-sqlite": "15.2.12",
|
|
47
|
-
"effect": "^4.0.0-beta.
|
|
47
|
+
"effect": "^4.0.0-beta.68"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@op-engineering/op-sqlite": "15.0.4",
|
|
51
|
-
"effect": "^4.0.0-beta.
|
|
51
|
+
"effect": "^4.0.0-beta.68"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
54
|
"codegen": "effect-utils codegen",
|
package/src/SqliteClient.ts
CHANGED
|
@@ -40,7 +40,7 @@ const classifyError = (cause: unknown, message: string, operation: string) =>
|
|
|
40
40
|
/**
|
|
41
41
|
* Runtime identifier attached to SQLite React Native client values.
|
|
42
42
|
*
|
|
43
|
-
* @category type
|
|
43
|
+
* @category type IDs
|
|
44
44
|
* @since 4.0.0
|
|
45
45
|
*/
|
|
46
46
|
export const TypeId: TypeId = "~@effect/sql-sqlite-react-native/SqliteClient"
|
|
@@ -48,7 +48,7 @@ export const TypeId: TypeId = "~@effect/sql-sqlite-react-native/SqliteClient"
|
|
|
48
48
|
/**
|
|
49
49
|
* Type-level identifier for SQLite React Native client values.
|
|
50
50
|
*
|
|
51
|
-
* @category type
|
|
51
|
+
* @category type IDs
|
|
52
52
|
* @since 4.0.0
|
|
53
53
|
*/
|
|
54
54
|
export type TypeId = "~@effect/sql-sqlite-react-native/SqliteClient"
|
|
@@ -115,7 +115,7 @@ interface SqliteConnection extends Connection {}
|
|
|
115
115
|
/**
|
|
116
116
|
* Creates a scoped React Native SQLite client from the supplied configuration, using a single serialized connection and honoring `AsyncQuery` for query execution.
|
|
117
117
|
*
|
|
118
|
-
* @category
|
|
118
|
+
* @category constructors
|
|
119
119
|
* @since 4.0.0
|
|
120
120
|
*/
|
|
121
121
|
export const make = (
|
|
@@ -280,10 +280,6 @@ interface DB {
|
|
|
280
280
|
*
|
|
281
281
|
* If you are writing to the database YOU SHOULD BE USING TRANSACTIONS!
|
|
282
282
|
* Transactions protect you from partial writes and ensure that your data is always in a consistent state
|
|
283
|
-
*
|
|
284
|
-
* @param query
|
|
285
|
-
* @param params
|
|
286
|
-
* @returns QueryResult
|
|
287
283
|
*/
|
|
288
284
|
executeSync: (query: string, params?: Array<any>) => QueryResult
|
|
289
285
|
/**
|
|
@@ -301,10 +297,6 @@ interface DB {
|
|
|
301
297
|
* Transactions protect you from partial writes and ensure that your data is always in a consistent state
|
|
302
298
|
*
|
|
303
299
|
* If you need a large amount of queries ran as fast as possible you should be using `executeBatch`, `executeRaw`, `loadFile` or `executeWithHostObjects`
|
|
304
|
-
*
|
|
305
|
-
* @param query string of your SQL query
|
|
306
|
-
* @param params a list of parameters to bind to the query, if any
|
|
307
|
-
* @returns Promise<QueryResult> with the result of the query
|
|
308
300
|
*/
|
|
309
301
|
execute: (query: string, params?: Array<any>) => Promise<QueryResult>
|
|
310
302
|
/**
|
package/src/SqliteMigrator.ts
CHANGED
|
@@ -33,7 +33,7 @@ export * from "effect/unstable/sql/Migrator"
|
|
|
33
33
|
/**
|
|
34
34
|
* Runs SQL migrations for a React Native SQLite database using the shared `Migrator` implementation and the current `SqlClient`.
|
|
35
35
|
*
|
|
36
|
-
* @category
|
|
36
|
+
* @category constructors
|
|
37
37
|
* @since 4.0.0
|
|
38
38
|
*/
|
|
39
39
|
export const run: <R>(
|
|
@@ -47,7 +47,7 @@ export const run: <R>(
|
|
|
47
47
|
/**
|
|
48
48
|
* Creates a layer that runs the configured React Native SQLite migrations during layer construction and provides no services.
|
|
49
49
|
*
|
|
50
|
-
* @category
|
|
50
|
+
* @category constructors
|
|
51
51
|
* @since 4.0.0
|
|
52
52
|
*/
|
|
53
53
|
export const layer = <R>(
|
package/src/index.ts
CHANGED
|
@@ -5,11 +5,44 @@
|
|
|
5
5
|
// @barrel: Auto-generated exports. Do not edit manually.
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
+
* Provides a React Native SQLite `SqlClient` backed by `@op-engineering/op-sqlite`.
|
|
9
|
+
*
|
|
10
|
+
* Use this module to open an on-device SQLite database, expose it as both the
|
|
11
|
+
* React Native-specific `SqliteClient` and the generic Effect `SqlClient`, and
|
|
12
|
+
* run application queries, migrations, and transactional reads or writes from
|
|
13
|
+
* Effect services and layers.
|
|
14
|
+
*
|
|
15
|
+
* The client uses one serialized connection. Regular queries and transactions
|
|
16
|
+
* share that handle, and a transaction holds it for the lifetime of its scope,
|
|
17
|
+
* so keep mobile transactions short and wrap multi-statement writes in a
|
|
18
|
+
* transaction to avoid partial updates. By default statements use the driver's
|
|
19
|
+
* synchronous API, which can block the JavaScript thread; `withAsyncQuery`
|
|
20
|
+
* switches a fiber to the asynchronous driver API when UI responsiveness is more
|
|
21
|
+
* important than sync execution.
|
|
22
|
+
*
|
|
8
23
|
* @since 4.0.0
|
|
9
24
|
*/
|
|
10
25
|
export * as SqliteClient from "./SqliteClient.ts"
|
|
11
26
|
|
|
12
27
|
/**
|
|
28
|
+
* Utilities for applying Effect SQL migrations to React Native SQLite databases.
|
|
29
|
+
*
|
|
30
|
+
* This module re-exports the shared `Migrator` loaders and error types, then
|
|
31
|
+
* provides `run` and `layer` helpers that execute ordered migrations through the
|
|
32
|
+
* current React Native SQLite `SqlClient`. Use it when a mobile app needs to
|
|
33
|
+
* bring its on-device database schema up to date during startup, before opening
|
|
34
|
+
* repositories or sync services, or in integration tests that create app-local
|
|
35
|
+
* database files.
|
|
36
|
+
*
|
|
37
|
+
* React Native SQLite databases are scoped by the client configuration, so the
|
|
38
|
+
* migrator should be run with the same `filename`, `location`, and encryption
|
|
39
|
+
* key as the rest of the application. Migrations run through the package's
|
|
40
|
+
* single serialized connection; by default statements use the synchronous
|
|
41
|
+
* driver API and can block the JS thread, so long migration sets may want to run
|
|
42
|
+
* under `SqliteClient.withAsyncQuery`. Mobile upgrades can be interrupted by app
|
|
43
|
+
* suspension or process death, so keep migrations transaction-aware and avoid
|
|
44
|
+
* assuming a fresh database on every launch.
|
|
45
|
+
*
|
|
13
46
|
* @since 4.0.0
|
|
14
47
|
*/
|
|
15
48
|
export * as SqliteMigrator from "./SqliteMigrator.ts"
|