@effect/sql-sqlite-react-native 4.0.0-beta.66 → 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.
@@ -6,18 +6,24 @@ import * as Scope from "effect/Scope";
6
6
  import * as Reactivity from "effect/unstable/reactivity/Reactivity";
7
7
  import * as Client from "effect/unstable/sql/SqlClient";
8
8
  /**
9
- * @category type ids
10
- * @since 1.0.0
9
+ * Runtime identifier attached to SQLite React Native client values.
10
+ *
11
+ * @category type IDs
12
+ * @since 4.0.0
11
13
  */
12
14
  export declare const TypeId: TypeId;
13
15
  /**
14
- * @category type ids
15
- * @since 1.0.0
16
+ * Type-level identifier for SQLite React Native client values.
17
+ *
18
+ * @category type IDs
19
+ * @since 4.0.0
16
20
  */
17
21
  export type TypeId = "~@effect/sql-sqlite-react-native/SqliteClient";
18
22
  /**
23
+ * React Native SQLite client service interface, extending `SqlClient` with its configuration and marking `updateValues` as unsupported for SQLite.
24
+ *
19
25
  * @category models
20
- * @since 1.0.0
26
+ * @since 4.0.0
21
27
  */
22
28
  export interface SqliteClient extends Client.SqlClient {
23
29
  readonly [TypeId]: TypeId;
@@ -26,13 +32,17 @@ export interface SqliteClient extends Client.SqlClient {
26
32
  readonly updateValues: never;
27
33
  }
28
34
  /**
35
+ * Context service tag for the React Native SQLite client.
36
+ *
29
37
  * @category tags
30
- * @since 1.0.0
38
+ * @since 4.0.0
31
39
  */
32
40
  export declare const SqliteClient: Context.Service<SqliteClient, SqliteClient>;
33
41
  /**
42
+ * Configuration for a React Native SQLite client, including the database filename, optional location and encryption key, span attributes, and query/result name transforms.
43
+ *
34
44
  * @category models
35
- * @since 1.0.0
45
+ * @since 4.0.0
36
46
  */
37
47
  export interface SqliteClientConfig {
38
48
  readonly filename: string;
@@ -43,28 +53,38 @@ export interface SqliteClientConfig {
43
53
  readonly transformQueryNames?: ((str: string) => string) | undefined;
44
54
  }
45
55
  /**
56
+ * Fiber-local flag that makes the React Native SQLite client run queries through the asynchronous `execute` API instead of `executeSync`.
57
+ *
46
58
  * @category fiber refs
47
- * @since 1.0.0
59
+ * @since 4.0.0
48
60
  */
49
61
  export declare const AsyncQuery: Context.Reference<boolean>;
50
62
  /**
63
+ * Runs an effect with `AsyncQuery` enabled, causing React Native SQLite queries in that effect to use the asynchronous driver API.
64
+ *
51
65
  * @category fiber refs
52
- * @since 1.0.0
66
+ * @since 4.0.0
53
67
  */
54
68
  export declare const withAsyncQuery: <R, E, A>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, never>>;
55
69
  /**
56
- * @category constructor
57
- * @since 1.0.0
70
+ * Creates a scoped React Native SQLite client from the supplied configuration, using a single serialized connection and honoring `AsyncQuery` for query execution.
71
+ *
72
+ * @category constructors
73
+ * @since 4.0.0
58
74
  */
59
75
  export declare const make: (options: SqliteClientConfig) => Effect.Effect<SqliteClient, never, Scope.Scope | Reactivity.Reactivity>;
60
76
  /**
77
+ * Builds a layer from an Effect `Config` value, providing both the React Native `SqliteClient` service and the generic `SqlClient` service.
78
+ *
61
79
  * @category layers
62
- * @since 1.0.0
80
+ * @since 4.0.0
63
81
  */
64
82
  export declare const layerConfig: (config: Config.Wrap<SqliteClientConfig>) => Layer.Layer<SqliteClient | Client.SqlClient, Config.ConfigError>;
65
83
  /**
84
+ * Builds a layer from a React Native SQLite client configuration, providing both `SqliteClient` and the generic `SqlClient` service.
85
+ *
66
86
  * @category layers
67
- * @since 1.0.0
87
+ * @since 4.0.0
68
88
  */
69
89
  export declare const layer: (config: SqliteClientConfig) => Layer.Layer<SqliteClient | Client.SqlClient>;
70
90
  //# sourceMappingURL=SqliteClient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SqliteClient.d.ts","sourceRoot":"","sources":["../src/SqliteClient.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KA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WAAW,CAUzB,CAAA;AAEzC;;;;;GAKG;AACH,eAAO,MAAM,KAAK,GAChB,QAAQ,kBAAkB,KACzB,KAAK,CAAC,KAAK,CAAC,YAAY,GAAG,MAAM,CAAC,SAAS,CAML,CAAA"}
@@ -1,5 +1,20 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * Provides a React Native SQLite `SqlClient` backed by `@op-engineering/op-sqlite`.
3
+ *
4
+ * Use this module to open an on-device SQLite database, expose it as both the
5
+ * React Native-specific `SqliteClient` and the generic Effect `SqlClient`, and
6
+ * run application queries, migrations, and transactional reads or writes from
7
+ * Effect services and layers.
8
+ *
9
+ * The client uses one serialized connection. Regular queries and transactions
10
+ * share that handle, and a transaction holds it for the lifetime of its scope,
11
+ * so keep mobile transactions short and wrap multi-statement writes in a
12
+ * transaction to avoid partial updates. By default statements use the driver's
13
+ * synchronous API, which can block the JavaScript thread; `withAsyncQuery`
14
+ * switches a fiber to the asynchronous driver API when UI responsiveness is more
15
+ * important than sync execution.
16
+ *
17
+ * @since 4.0.0
3
18
  */
4
19
  import * as Sqlite from "@op-engineering/op-sqlite";
5
20
  import * as Config from "effect/Config";
@@ -21,30 +36,40 @@ const classifyError = (cause, message, operation) => classifySqliteError(cause,
21
36
  operation
22
37
  });
23
38
  /**
24
- * @category type ids
25
- * @since 1.0.0
39
+ * Runtime identifier attached to SQLite React Native client values.
40
+ *
41
+ * @category type IDs
42
+ * @since 4.0.0
26
43
  */
27
44
  export const TypeId = "~@effect/sql-sqlite-react-native/SqliteClient";
28
45
  /**
46
+ * Context service tag for the React Native SQLite client.
47
+ *
29
48
  * @category tags
30
- * @since 1.0.0
49
+ * @since 4.0.0
31
50
  */
32
51
  export const SqliteClient = /*#__PURE__*/Context.Service("@effect/sql-sqlite-react-native/SqliteClient");
33
52
  /**
53
+ * Fiber-local flag that makes the React Native SQLite client run queries through the asynchronous `execute` API instead of `executeSync`.
54
+ *
34
55
  * @category fiber refs
35
- * @since 1.0.0
56
+ * @since 4.0.0
36
57
  */
37
58
  export const AsyncQuery = /*#__PURE__*/Context.Reference("@effect/sql-sqlite-react-native/Client/asyncQuery", {
38
59
  defaultValue: constFalse
39
60
  });
40
61
  /**
62
+ * Runs an effect with `AsyncQuery` enabled, causing React Native SQLite queries in that effect to use the asynchronous driver API.
63
+ *
41
64
  * @category fiber refs
42
- * @since 1.0.0
65
+ * @since 4.0.0
43
66
  */
44
67
  export const withAsyncQuery = effect => Effect.provideService(effect, AsyncQuery, true);
45
68
  /**
46
- * @category constructor
47
- * @since 1.0.0
69
+ * Creates a scoped React Native SQLite client from the supplied configuration, using a single serialized connection and honoring `AsyncQuery` for query execution.
70
+ *
71
+ * @category constructors
72
+ * @since 4.0.0
48
73
  */
49
74
  export const make = options => Effect.gen(function* () {
50
75
  const clientOptions = {
@@ -118,13 +143,17 @@ export const make = options => Effect.gen(function* () {
118
143
  });
119
144
  });
120
145
  /**
146
+ * Builds a layer from an Effect `Config` value, providing both the React Native `SqliteClient` service and the generic `SqlClient` service.
147
+ *
121
148
  * @category layers
122
- * @since 1.0.0
149
+ * @since 4.0.0
123
150
  */
124
151
  export const layerConfig = config => Layer.effectContext(Config.unwrap(config).pipe(Effect.flatMap(make), Effect.map(client => Context.make(SqliteClient, client).pipe(Context.add(Client.SqlClient, client))))).pipe(Layer.provide(Reactivity.layer));
125
152
  /**
153
+ * Builds a layer from a React Native SQLite client configuration, providing both `SqliteClient` and the generic `SqlClient` service.
154
+ *
126
155
  * @category layers
127
- * @since 1.0.0
156
+ * @since 4.0.0
128
157
  */
129
158
  export const layer = config => Layer.effectContext(Effect.map(make(config), client => Context.make(SqliteClient, client).pipe(Context.add(Client.SqlClient, client)))).pipe(Layer.provide(Reactivity.layer));
130
159
  //# sourceMappingURL=SqliteClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SqliteClient.js","names":["Sqlite","Config","Context","Effect","Fiber","constFalse","identity","Layer","Scope","Semaphore","Stream","Reactivity","Client","classifySqliteError","SqlError","Statement","ATTR_DB_SYSTEM_NAME","classifyError","cause","message","operation","TypeId","SqliteClient","Service","AsyncQuery","Reference","defaultValue","withAsyncQuery","effect","provideService","make","options","gen","clientOptions","name","filename","location","encryptionKey","compiler","makeCompilerSqlite","transformQueryNames","transformRows","transformResultNames","defaultTransforms","array","undefined","makeConnection","db","open","addFinalizer","sync","close","run","sql","params","values","withFiber","fiber","getRef","map","tryPromise","try","execute","catch","reason","result","rawRows","rows","executeSync","executeRaw","executeValues","executeUnprepared","executeStream","die","semaphore","connection","acquirer","withPermits","succeed","transactionAcquirer","uninterruptibleMask","restore","getCurrent","scope","getUnsafe","context","as","tap","take","release","Object","assign","spanAttributes","entries","config","layerConfig","effectContext","unwrap","pipe","flatMap","client","add","SqlClient","provide","layer"],"sources":["../src/SqliteClient.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAGA,OAAO,KAAKA,MAAM,MAAM,2BAA2B;AACnD,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,SAASC,UAAU,EAAEC,QAAQ,QAAQ,iBAAiB;AACtD,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,SAAS,MAAM,kBAAkB;AAC7C,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,UAAU,MAAM,uCAAuC;AACnE,OAAO,KAAKC,MAAM,MAAM,+BAA+B;AAEvD,SAASC,mBAAmB,EAAEC,QAAQ,QAAQ,8BAA8B;AAC5E,OAAO,KAAKC,SAAS,MAAM,+BAA+B;AAE1D,MAAMC,mBAAmB,GAAG,gBAAgB;AAE5C,MAAMC,aAAa,GAAGA,CAACC,KAAc,EAAEC,OAAe,EAAEC,SAAiB,KACvEP,mBAAmB,CAACK,KAAK,EAAE;EAAEC,OAAO;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6F,KAAK,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"SqliteClient.js","names":["Sqlite","Config","Context","Effect","Fiber","constFalse","identity","Layer","Scope","Semaphore","Stream","Reactivity","Client","classifySqliteError","SqlError","Statement","ATTR_DB_SYSTEM_NAME","classifyError","cause","message","operation","TypeId","SqliteClient","Service","AsyncQuery","Reference","defaultValue","withAsyncQuery","effect","provideService","make","options","gen","clientOptions","name","filename","location","encryptionKey","compiler","makeCompilerSqlite","transformQueryNames","transformRows","transformResultNames","defaultTransforms","array","undefined","makeConnection","db","open","addFinalizer","sync","close","run","sql","params","values","withFiber","fiber","getRef","map","tryPromise","try","execute","catch","reason","result","rawRows","rows","executeSync","executeRaw","executeValues","executeUnprepared","executeStream","die","semaphore","connection","acquirer","withPermits","succeed","transactionAcquirer","uninterruptibleMask","restore","getCurrent","scope","getUnsafe","context","as","tap","take","release","Object","assign","spanAttributes","entries","config","layerConfig","effectContext","unwrap","pipe","flatMap","client","add","SqlClient","provide","layer"],"sources":["../src/SqliteClient.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;AAkBA,OAAO,KAAKA,MAAM,MAAM,2BAA2B;AACnD,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,SAASC,UAAU,EAAEC,QAAQ,QAAQ,iBAAiB;AACtD,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,SAAS,MAAM,kBAAkB;AAC7C,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,UAAU,MAAM,uCAAuC;AACnE,OAAO,KAAKC,MAAM,MAAM,+BAA+B;AAEvD,SAASC,mBAAmB,EAAEC,QAAQ,QAAQ,8BAA8B;AAC5E,OAAO,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AAI,CAACR,YAAY,EAAE8E,MAAM,CAAC,CAACF,IAAI,CACrChG,OAAO,CAACmG,GAAG,CAACzF,MAAM,CAAC0F,SAAS,EAAEF,MAAM,CAAC,CACtC,CAAC,CACL,CAACF,IAAI,CAAC3F,KAAK,CAACgG,OAAO,CAAC5F,UAAU,CAAC6F,KAAK,CAAC,CAAC","ignoreList":[]}
@@ -1,5 +1,23 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * Utilities for applying Effect SQL migrations to React Native SQLite databases.
3
+ *
4
+ * This module re-exports the shared `Migrator` loaders and error types, then
5
+ * provides `run` and `layer` helpers that execute ordered migrations through the
6
+ * current React Native SQLite `SqlClient`. Use it when a mobile app needs to
7
+ * bring its on-device database schema up to date during startup, before opening
8
+ * repositories or sync services, or in integration tests that create app-local
9
+ * database files.
10
+ *
11
+ * React Native SQLite databases are scoped by the client configuration, so the
12
+ * migrator should be run with the same `filename`, `location`, and encryption
13
+ * key as the rest of the application. Migrations run through the package's
14
+ * single serialized connection; by default statements use the synchronous
15
+ * driver API and can block the JS thread, so long migration sets may want to run
16
+ * under `SqliteClient.withAsyncQuery`. Mobile upgrades can be interrupted by app
17
+ * suspension or process death, so keep migrations transaction-aware and avoid
18
+ * assuming a fresh database on every launch.
19
+ *
20
+ * @since 4.0.0
3
21
  */
4
22
  import type * as Effect from "effect/Effect";
5
23
  import * as Layer from "effect/Layer";
@@ -7,17 +25,21 @@ import * as Migrator from "effect/unstable/sql/Migrator";
7
25
  import type * as Client from "effect/unstable/sql/SqlClient";
8
26
  import type { SqlError } from "effect/unstable/sql/SqlError";
9
27
  /**
10
- * @since 1.0.0
28
+ * @since 4.0.0
11
29
  */
12
30
  export * from "effect/unstable/sql/Migrator";
13
31
  /**
14
- * @category constructor
15
- * @since 1.0.0
32
+ * Runs SQL migrations for a React Native SQLite database using the shared `Migrator` implementation and the current `SqlClient`.
33
+ *
34
+ * @category constructors
35
+ * @since 4.0.0
16
36
  */
17
37
  export declare const run: <R>(options: Migrator.MigratorOptions<R>) => Effect.Effect<ReadonlyArray<readonly [id: number, name: string]>, SqlError | Migrator.MigrationError, Client.SqlClient | R>;
18
38
  /**
19
- * @category constructor
20
- * @since 1.0.0
39
+ * Creates a layer that runs the configured React Native SQLite migrations during layer construction and provides no services.
40
+ *
41
+ * @category constructors
42
+ * @since 4.0.0
21
43
  */
22
44
  export declare const layer: <R>(options: Migrator.MigratorOptions<R>) => Layer.Layer<never, SqlError | Migrator.MigrationError, R | Client.SqlClient>;
23
45
  //# sourceMappingURL=SqliteMigrator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SqliteMigrator.d.ts","sourceRoot":"","sources":["../src/SqliteMigrator.ts"],"names":[],"mappings":"AAAA;;GAEG;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;;;GAGG;AACH,eAAO,MAAM,GAAG,EAAE,CAAC,CAAC,EAClB,OAAO,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,KACjC,MAAM,CAAC,MAAM,CAChB,aAAa,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,EAClD,QAAQ,GAAG,QAAQ,CAAC,cAAc,EAClC,MAAM,CAAC,SAAS,GAAG,CAAC,CACD,CAAA;AAErB;;;GAGG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,EACrB,SAAS,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,KACnC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,QAAQ,GAAG,QAAQ,CAAC,cAAc,EAAE,CAAC,GAAG,MAAM,CAAC,SAAS,CAAsC,CAAA"}
1
+ {"version":3,"file":"SqliteMigrator.d.ts","sourceRoot":"","sources":["../src/SqliteMigrator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;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,CAAC,EAClB,OAAO,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,KACjC,MAAM,CAAC,MAAM,CAChB,aAAa,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,EAClD,QAAQ,GAAG,QAAQ,CAAC,cAAc,EAClC,MAAM,CAAC,SAAS,GAAG,CAAC,CACD,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,GAAG,QAAQ,CAAC,cAAc,EAAE,CAAC,GAAG,MAAM,CAAC,SAAS,CAAsC,CAAA"}
@@ -1,17 +1,21 @@
1
1
  import * as Layer from "effect/Layer";
2
2
  import * as Migrator from "effect/unstable/sql/Migrator";
3
3
  /**
4
- * @since 1.0.0
4
+ * @since 4.0.0
5
5
  */
6
6
  export * from "effect/unstable/sql/Migrator";
7
7
  /**
8
- * @category constructor
9
- * @since 1.0.0
8
+ * Runs SQL migrations for a React Native SQLite database using the shared `Migrator` implementation and the current `SqlClient`.
9
+ *
10
+ * @category constructors
11
+ * @since 4.0.0
10
12
  */
11
13
  export const run = /*#__PURE__*/Migrator.make({});
12
14
  /**
13
- * @category constructor
14
- * @since 1.0.0
15
+ * Creates a layer that runs the configured React Native SQLite migrations during layer construction and provides no services.
16
+ *
17
+ * @category constructors
18
+ * @since 4.0.0
15
19
  */
16
20
  export const layer = options => Layer.effectDiscard(run(options));
17
21
  //# sourceMappingURL=SqliteMigrator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SqliteMigrator.js","names":["Layer","Migrator","run","make","layer","options","effectDiscard"],"sources":["../src/SqliteMigrator.ts"],"sourcesContent":[null],"mappings":"AAIA,OAAO,KAAKA,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,QAAQ,MAAM,8BAA8B;AAIxD;;;AAGA,cAAc,8BAA8B;AAE5C;;;;AAIA,OAAO,MAAMC,GAAG,gBAMZD,QAAQ,CAACE,IAAI,CAAC,EAAE,CAAC;AAErB;;;;AAIA,OAAO,MAAMC,KAAK,GAChBC,OAAoC,IAC6CL,KAAK,CAACM,aAAa,CAACJ,GAAG,CAACG,OAAO,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"SqliteMigrator.js","names":["Layer","Migrator","run","make","layer","options","effectDiscard"],"sources":["../src/SqliteMigrator.ts"],"sourcesContent":[null],"mappings":"AAsBA,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/dist/index.d.ts CHANGED
@@ -1,12 +1,45 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * @since 4.0.0
3
3
  */
4
4
  /**
5
- * @since 1.0.0
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
+ *
20
+ * @since 4.0.0
6
21
  */
7
22
  export * as SqliteClient from "./SqliteClient.ts";
8
23
  /**
9
- * @since 1.0.0
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
+ *
42
+ * @since 4.0.0
10
43
  */
11
44
  export * as SqliteMigrator from "./SqliteMigrator.ts";
12
45
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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"}
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
@@ -1,13 +1,46 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * @since 4.0.0
3
3
  */
4
4
  // @barrel: Auto-generated exports. Do not edit manually.
5
5
  /**
6
- * @since 1.0.0
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
+ *
21
+ * @since 4.0.0
7
22
  */
8
23
  export * as SqliteClient from "./SqliteClient.js";
9
24
  /**
10
- * @since 1.0.0
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
+ *
43
+ * @since 4.0.0
11
44
  */
12
45
  export * as SqliteMigrator from "./SqliteMigrator.js";
13
46
  //# sourceMappingURL=index.js.map
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;;;AAGA,OAAO,KAAKA,YAAY,MAAM,mBAAmB;AAEjD;;;AAGA,OAAO,KAAKC,cAAc,MAAM,qBAAqB","ignoreList":[]}
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.66",
3
+ "version": "4.0.0-beta.68",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "A SQLite toolkit for Effect",
@@ -43,12 +43,12 @@
43
43
  "provenance": true
44
44
  },
45
45
  "devDependencies": {
46
- "@op-engineering/op-sqlite": "15.2.11",
47
- "effect": "^4.0.0-beta.66"
46
+ "@op-engineering/op-sqlite": "15.2.12",
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.66"
51
+ "effect": "^4.0.0-beta.68"
52
52
  },
53
53
  "scripts": {
54
54
  "codegen": "effect-utils codegen",
@@ -1,5 +1,20 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * Provides a React Native SQLite `SqlClient` backed by `@op-engineering/op-sqlite`.
3
+ *
4
+ * Use this module to open an on-device SQLite database, expose it as both the
5
+ * React Native-specific `SqliteClient` and the generic Effect `SqlClient`, and
6
+ * run application queries, migrations, and transactional reads or writes from
7
+ * Effect services and layers.
8
+ *
9
+ * The client uses one serialized connection. Regular queries and transactions
10
+ * share that handle, and a transaction holds it for the lifetime of its scope,
11
+ * so keep mobile transactions short and wrap multi-statement writes in a
12
+ * transaction to avoid partial updates. By default statements use the driver's
13
+ * synchronous API, which can block the JavaScript thread; `withAsyncQuery`
14
+ * switches a fiber to the asynchronous driver API when UI responsiveness is more
15
+ * important than sync execution.
16
+ *
17
+ * @since 4.0.0
3
18
  */
4
19
  import * as Sqlite from "@op-engineering/op-sqlite"
5
20
  import * as Config from "effect/Config"
@@ -23,20 +38,26 @@ const classifyError = (cause: unknown, message: string, operation: string) =>
23
38
  classifySqliteError(cause, { message, operation })
24
39
 
25
40
  /**
26
- * @category type ids
27
- * @since 1.0.0
41
+ * Runtime identifier attached to SQLite React Native client values.
42
+ *
43
+ * @category type IDs
44
+ * @since 4.0.0
28
45
  */
29
46
  export const TypeId: TypeId = "~@effect/sql-sqlite-react-native/SqliteClient"
30
47
 
31
48
  /**
32
- * @category type ids
33
- * @since 1.0.0
49
+ * Type-level identifier for SQLite React Native client values.
50
+ *
51
+ * @category type IDs
52
+ * @since 4.0.0
34
53
  */
35
54
  export type TypeId = "~@effect/sql-sqlite-react-native/SqliteClient"
36
55
 
37
56
  /**
57
+ * React Native SQLite client service interface, extending `SqlClient` with its configuration and marking `updateValues` as unsupported for SQLite.
58
+ *
38
59
  * @category models
39
- * @since 1.0.0
60
+ * @since 4.0.0
40
61
  */
41
62
  export interface SqliteClient extends Client.SqlClient {
42
63
  readonly [TypeId]: TypeId
@@ -47,14 +68,18 @@ export interface SqliteClient extends Client.SqlClient {
47
68
  }
48
69
 
49
70
  /**
71
+ * Context service tag for the React Native SQLite client.
72
+ *
50
73
  * @category tags
51
- * @since 1.0.0
74
+ * @since 4.0.0
52
75
  */
53
76
  export const SqliteClient = Context.Service<SqliteClient>("@effect/sql-sqlite-react-native/SqliteClient")
54
77
 
55
78
  /**
79
+ * Configuration for a React Native SQLite client, including the database filename, optional location and encryption key, span attributes, and query/result name transforms.
80
+ *
56
81
  * @category models
57
- * @since 1.0.0
82
+ * @since 4.0.0
58
83
  */
59
84
  export interface SqliteClientConfig {
60
85
  readonly filename: string
@@ -66,8 +91,10 @@ export interface SqliteClientConfig {
66
91
  }
67
92
 
68
93
  /**
94
+ * Fiber-local flag that makes the React Native SQLite client run queries through the asynchronous `execute` API instead of `executeSync`.
95
+ *
69
96
  * @category fiber refs
70
- * @since 1.0.0
97
+ * @since 4.0.0
71
98
  */
72
99
  export const AsyncQuery = Context.Reference<boolean>(
73
100
  "@effect/sql-sqlite-react-native/Client/asyncQuery",
@@ -75,8 +102,10 @@ export const AsyncQuery = Context.Reference<boolean>(
75
102
  )
76
103
 
77
104
  /**
105
+ * Runs an effect with `AsyncQuery` enabled, causing React Native SQLite queries in that effect to use the asynchronous driver API.
106
+ *
78
107
  * @category fiber refs
79
- * @since 1.0.0
108
+ * @since 4.0.0
80
109
  */
81
110
  export const withAsyncQuery = <R, E, A>(effect: Effect.Effect<A, E, R>) =>
82
111
  Effect.provideService(effect, AsyncQuery, true)
@@ -84,8 +113,10 @@ export const withAsyncQuery = <R, E, A>(effect: Effect.Effect<A, E, R>) =>
84
113
  interface SqliteConnection extends Connection {}
85
114
 
86
115
  /**
87
- * @category constructor
88
- * @since 1.0.0
116
+ * Creates a scoped React Native SQLite client from the supplied configuration, using a single serialized connection and honoring `AsyncQuery` for query execution.
117
+ *
118
+ * @category constructors
119
+ * @since 4.0.0
89
120
  */
90
121
  export const make = (
91
122
  options: SqliteClientConfig
@@ -191,8 +222,10 @@ export const make = (
191
222
  })
192
223
 
193
224
  /**
225
+ * Builds a layer from an Effect `Config` value, providing both the React Native `SqliteClient` service and the generic `SqlClient` service.
226
+ *
194
227
  * @category layers
195
- * @since 1.0.0
228
+ * @since 4.0.0
196
229
  */
197
230
  export const layerConfig = (
198
231
  config: Config.Wrap<SqliteClientConfig>
@@ -209,8 +242,10 @@ export const layerConfig = (
209
242
  ).pipe(Layer.provide(Reactivity.layer))
210
243
 
211
244
  /**
245
+ * Builds a layer from a React Native SQLite client configuration, providing both `SqliteClient` and the generic `SqlClient` service.
246
+ *
212
247
  * @category layers
213
- * @since 1.0.0
248
+ * @since 4.0.0
214
249
  */
215
250
  export const layer = (
216
251
  config: SqliteClientConfig
@@ -245,10 +280,6 @@ interface DB {
245
280
  *
246
281
  * If you are writing to the database YOU SHOULD BE USING TRANSACTIONS!
247
282
  * Transactions protect you from partial writes and ensure that your data is always in a consistent state
248
- *
249
- * @param query
250
- * @param params
251
- * @returns QueryResult
252
283
  */
253
284
  executeSync: (query: string, params?: Array<any>) => QueryResult
254
285
  /**
@@ -266,10 +297,6 @@ interface DB {
266
297
  * Transactions protect you from partial writes and ensure that your data is always in a consistent state
267
298
  *
268
299
  * If you need a large amount of queries ran as fast as possible you should be using `executeBatch`, `executeRaw`, `loadFile` or `executeWithHostObjects`
269
- *
270
- * @param query string of your SQL query
271
- * @param params a list of parameters to bind to the query, if any
272
- * @returns Promise<QueryResult> with the result of the query
273
300
  */
274
301
  execute: (query: string, params?: Array<any>) => Promise<QueryResult>
275
302
  /**
@@ -1,5 +1,23 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * Utilities for applying Effect SQL migrations to React Native SQLite databases.
3
+ *
4
+ * This module re-exports the shared `Migrator` loaders and error types, then
5
+ * provides `run` and `layer` helpers that execute ordered migrations through the
6
+ * current React Native SQLite `SqlClient`. Use it when a mobile app needs to
7
+ * bring its on-device database schema up to date during startup, before opening
8
+ * repositories or sync services, or in integration tests that create app-local
9
+ * database files.
10
+ *
11
+ * React Native SQLite databases are scoped by the client configuration, so the
12
+ * migrator should be run with the same `filename`, `location`, and encryption
13
+ * key as the rest of the application. Migrations run through the package's
14
+ * single serialized connection; by default statements use the synchronous
15
+ * driver API and can block the JS thread, so long migration sets may want to run
16
+ * under `SqliteClient.withAsyncQuery`. Mobile upgrades can be interrupted by app
17
+ * suspension or process death, so keep migrations transaction-aware and avoid
18
+ * assuming a fresh database on every launch.
19
+ *
20
+ * @since 4.0.0
3
21
  */
4
22
  import type * as Effect from "effect/Effect"
5
23
  import * as Layer from "effect/Layer"
@@ -8,13 +26,15 @@ import type * as Client from "effect/unstable/sql/SqlClient"
8
26
  import type { SqlError } from "effect/unstable/sql/SqlError"
9
27
 
10
28
  /**
11
- * @since 1.0.0
29
+ * @since 4.0.0
12
30
  */
13
31
  export * from "effect/unstable/sql/Migrator"
14
32
 
15
33
  /**
16
- * @category constructor
17
- * @since 1.0.0
34
+ * Runs SQL migrations for a React Native SQLite database using the shared `Migrator` implementation and the current `SqlClient`.
35
+ *
36
+ * @category constructors
37
+ * @since 4.0.0
18
38
  */
19
39
  export const run: <R>(
20
40
  options: Migrator.MigratorOptions<R>
@@ -25,8 +45,10 @@ export const run: <R>(
25
45
  > = Migrator.make({})
26
46
 
27
47
  /**
28
- * @category constructor
29
- * @since 1.0.0
48
+ * Creates a layer that runs the configured React Native SQLite migrations during layer construction and provides no services.
49
+ *
50
+ * @category constructors
51
+ * @since 4.0.0
30
52
  */
31
53
  export const layer = <R>(
32
54
  options: Migrator.MigratorOptions<R>
package/src/index.ts CHANGED
@@ -1,15 +1,48 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * @since 4.0.0
3
3
  */
4
4
 
5
5
  // @barrel: Auto-generated exports. Do not edit manually.
6
6
 
7
7
  /**
8
- * @since 1.0.0
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
+ *
23
+ * @since 4.0.0
9
24
  */
10
25
  export * as SqliteClient from "./SqliteClient.ts"
11
26
 
12
27
  /**
13
- * @since 1.0.0
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
+ *
46
+ * @since 4.0.0
14
47
  */
15
48
  export * as SqliteMigrator from "./SqliteMigrator.ts"