@effect/sql-sqlite-react-native 4.0.0-beta.98 → 4.0.0-rc.108
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/AGENTS.md +381 -0
- package/CLAUDE.md +381 -0
- package/README.md +10 -3
- package/ai-docs/README.md +44 -0
- package/ai-docs/package.json +36 -0
- package/ai-docs/src/01_effect/01_basics/01_effect-gen.ts +30 -0
- package/ai-docs/src/01_effect/01_basics/02_effect-fn.ts +39 -0
- package/ai-docs/src/01_effect/01_basics/10_creating-effects.ts +74 -0
- package/ai-docs/src/01_effect/01_basics/index.md +5 -0
- package/ai-docs/src/01_effect/02_schema/10_schema-basics.ts +43 -0
- package/ai-docs/src/01_effect/02_schema/index.md +7 -0
- package/ai-docs/src/01_effect/03_services/01_service.ts +45 -0
- package/ai-docs/src/01_effect/03_services/10_reference.ts +10 -0
- package/ai-docs/src/01_effect/03_services/20_layer-composition.ts +70 -0
- package/ai-docs/src/01_effect/03_services/20_layer-unwrap.ts +66 -0
- package/ai-docs/src/01_effect/03_services/index.md +5 -0
- package/ai-docs/src/01_effect/04_errors/01_error-handling.ts +30 -0
- package/ai-docs/src/01_effect/04_errors/10_catch-tags.ts +24 -0
- package/ai-docs/src/01_effect/04_errors/20_reason-errors.ts +64 -0
- package/ai-docs/src/01_effect/04_errors/index.md +1 -0
- package/ai-docs/src/01_effect/05_resources/10_acquire-release.ts +105 -0
- package/ai-docs/src/01_effect/05_resources/20_layer-side-effects.ts +31 -0
- package/ai-docs/src/01_effect/05_resources/30_layer-map.ts +86 -0
- package/ai-docs/src/01_effect/05_resources/index.md +3 -0
- package/ai-docs/src/01_effect/06_running/10_run-main.ts +30 -0
- package/ai-docs/src/01_effect/06_running/20_layer-launch.ts +27 -0
- package/ai-docs/src/01_effect/06_running/index.md +1 -0
- package/ai-docs/src/01_effect/07_pubsub/10_pubsub.ts +56 -0
- package/ai-docs/src/01_effect/07_pubsub/index.md +3 -0
- package/ai-docs/src/03_stream/10_creating-streams.ts +103 -0
- package/ai-docs/src/03_stream/20_consuming-streams.ts +137 -0
- package/ai-docs/src/03_stream/30_encoding.ts +165 -0
- package/ai-docs/src/03_stream/index.md +4 -0
- package/ai-docs/src/04_integration/10_managed-runtime.ts +129 -0
- package/ai-docs/src/04_integration/index.md +5 -0
- package/ai-docs/src/05_batching/10_request-resolver.ts +89 -0
- package/ai-docs/src/05_batching/index.md +3 -0
- package/ai-docs/src/06_schedule/10_schedules.ts +110 -0
- package/ai-docs/src/06_schedule/index.md +3 -0
- package/ai-docs/src/07_datetime/10_creating-and-formatting.ts +30 -0
- package/ai-docs/src/07_datetime/20_time-zones.ts +44 -0
- package/ai-docs/src/07_datetime/index.md +5 -0
- package/ai-docs/src/08_observability/10_logging.ts +66 -0
- package/ai-docs/src/08_observability/20_otlp-tracing.ts +95 -0
- package/ai-docs/src/08_observability/index.md +7 -0
- package/ai-docs/src/09_testing/10_effect-tests.ts +55 -0
- package/ai-docs/src/09_testing/20_layer-tests.ts +138 -0
- package/ai-docs/src/09_testing/index.md +1 -0
- package/ai-docs/src/10_predicate/01_basics.ts +14 -0
- package/ai-docs/src/10_predicate/index.md +9 -0
- package/ai-docs/src/50_http-client/10_basics.ts +102 -0
- package/ai-docs/src/50_http-client/index.md +3 -0
- package/ai-docs/src/51_http-server/10_basics.ts +116 -0
- package/ai-docs/src/51_http-server/fixtures/api/Api.ts +14 -0
- package/ai-docs/src/51_http-server/fixtures/api/Authorization.ts +36 -0
- package/ai-docs/src/51_http-server/fixtures/api/System.ts +10 -0
- package/ai-docs/src/51_http-server/fixtures/api/Users.ts +91 -0
- package/ai-docs/src/51_http-server/fixtures/domain/User.ts +12 -0
- package/ai-docs/src/51_http-server/fixtures/domain/UserErrors.ts +22 -0
- package/ai-docs/src/51_http-server/fixtures/server/Authorization.ts +36 -0
- package/ai-docs/src/51_http-server/fixtures/server/Users/http.ts +71 -0
- package/ai-docs/src/51_http-server/fixtures/server/Users.ts +62 -0
- package/ai-docs/src/51_http-server/index.md +3 -0
- package/ai-docs/src/60_child-process/10_working-with-child-processes.ts +117 -0
- package/ai-docs/src/60_child-process/index.md +3 -0
- package/ai-docs/src/70_cli/10_basics.ts +136 -0
- package/ai-docs/src/70_cli/index.md +5 -0
- package/ai-docs/src/71_ai/10_language-model.ts +156 -0
- package/ai-docs/src/71_ai/20_tools.ts +226 -0
- package/ai-docs/src/71_ai/30_chat.ts +158 -0
- package/ai-docs/src/71_ai/fixtures/domain/LaunchPlan.ts +9 -0
- package/ai-docs/src/71_ai/index.md +5 -0
- package/ai-docs/src/80_cluster/10_entities.ts +97 -0
- package/ai-docs/src/80_cluster/index.md +4 -0
- package/ai-docs/src/index.md +10 -0
- package/ai-docs/tsconfig.json +24 -0
- package/dist/SqliteClient.d.ts +3 -3
- package/dist/SqliteClient.d.ts.map +1 -1
- package/dist/SqliteClient.js +23 -10
- package/dist/SqliteClient.js.map +1 -1
- package/dist/SqliteMigrator.d.ts +2 -2
- package/dist/SqliteMigrator.js +2 -2
- package/dist/SqliteMigrator.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +13 -11
- package/src/SqliteClient.ts +26 -12
- package/src/SqliteMigrator.ts +2 -2
package/src/SqliteClient.ts
CHANGED
|
@@ -51,7 +51,7 @@ export type TypeId = "~@effect/sql-sqlite-react-native/SqliteClient"
|
|
|
51
51
|
/**
|
|
52
52
|
* React Native SQLite client service interface, extending `SqlClient` with its configuration and marking `updateValues` as unsupported for SQLite.
|
|
53
53
|
*
|
|
54
|
-
* @category
|
|
54
|
+
* @category services
|
|
55
55
|
* @since 4.0.0
|
|
56
56
|
*/
|
|
57
57
|
export interface SqliteClient extends Client.SqlClient {
|
|
@@ -93,7 +93,7 @@ export interface SqliteClientConfig {
|
|
|
93
93
|
* Use to switch React Native SQLite query execution to the asynchronous driver
|
|
94
94
|
* API for a scoped effect.
|
|
95
95
|
*
|
|
96
|
-
* @category
|
|
96
|
+
* @category services
|
|
97
97
|
* @since 4.0.0
|
|
98
98
|
*/
|
|
99
99
|
export const AsyncQuery = Context.Reference<boolean>(
|
|
@@ -104,7 +104,7 @@ export const AsyncQuery = Context.Reference<boolean>(
|
|
|
104
104
|
/**
|
|
105
105
|
* Runs an effect with `AsyncQuery` enabled, causing React Native SQLite queries in that effect to use the asynchronous driver API.
|
|
106
106
|
*
|
|
107
|
-
* @category
|
|
107
|
+
* @category providing services
|
|
108
108
|
* @since 4.0.0
|
|
109
109
|
*/
|
|
110
110
|
export const withAsyncQuery = <R, E, A>(effect: Effect.Effect<A, E, R>) =>
|
|
@@ -143,8 +143,7 @@ export const make = (
|
|
|
143
143
|
|
|
144
144
|
const run = (
|
|
145
145
|
sql: string,
|
|
146
|
-
params: ReadonlyArray<unknown> = []
|
|
147
|
-
values = false
|
|
146
|
+
params: ReadonlyArray<unknown> = []
|
|
148
147
|
) =>
|
|
149
148
|
Effect.withFiber<Array<any>, SqlError>((fiber) => {
|
|
150
149
|
if (fiber.getRef(AsyncQuery)) {
|
|
@@ -154,14 +153,29 @@ export const make = (
|
|
|
154
153
|
catch: (cause) =>
|
|
155
154
|
new SqlError({ reason: classifyError(cause, "Failed to execute statement (async)", "execute") })
|
|
156
155
|
}),
|
|
157
|
-
(result) =>
|
|
156
|
+
(result) => result.rows
|
|
158
157
|
)
|
|
159
158
|
}
|
|
160
159
|
return Effect.try({
|
|
161
|
-
try: () =>
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
160
|
+
try: () => db.executeSync(sql, params as Array<any>).rows,
|
|
161
|
+
catch: (cause) => new SqlError({ reason: classifyError(cause, "Failed to execute statement", "execute") })
|
|
162
|
+
})
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
const runValues = (
|
|
166
|
+
sql: string,
|
|
167
|
+
params: ReadonlyArray<unknown> = []
|
|
168
|
+
) =>
|
|
169
|
+
Effect.withFiber<Array<any>, SqlError>((fiber) => {
|
|
170
|
+
if (fiber.getRef(AsyncQuery)) {
|
|
171
|
+
return Effect.tryPromise({
|
|
172
|
+
try: () => db.executeRaw(sql, params as Array<any>),
|
|
173
|
+
catch: (cause) =>
|
|
174
|
+
new SqlError({ reason: classifyError(cause, "Failed to execute statement (async)", "execute") })
|
|
175
|
+
})
|
|
176
|
+
}
|
|
177
|
+
return Effect.try({
|
|
178
|
+
try: () => db.executeRawSync(sql, params as Array<any>),
|
|
165
179
|
catch: (cause) => new SqlError({ reason: classifyError(cause, "Failed to execute statement", "execute") })
|
|
166
180
|
})
|
|
167
181
|
})
|
|
@@ -176,10 +190,10 @@ export const make = (
|
|
|
176
190
|
return run(sql, params)
|
|
177
191
|
},
|
|
178
192
|
executeValues(sql, params) {
|
|
179
|
-
return
|
|
193
|
+
return runValues(sql, params)
|
|
180
194
|
},
|
|
181
195
|
executeValuesUnprepared(sql, params) {
|
|
182
|
-
return
|
|
196
|
+
return runValues(sql, params)
|
|
183
197
|
},
|
|
184
198
|
executeUnprepared(sql, params, transformRows) {
|
|
185
199
|
return this.execute(sql, params, transformRows)
|
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 running
|
|
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 layers
|
|
51
51
|
* @since 4.0.0
|
|
52
52
|
*/
|
|
53
53
|
export const layer = <R>(
|