@effect/sql-sqlite-react-native 4.0.0-rc.112 → 4.0.0-rc.113
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 +24 -9
- package/CLAUDE.md +24 -9
- package/ai-docs/package.json +2 -2
- package/ai-docs/src/01_effect/01_basics/02_effect-fn.ts +18 -5
- package/ai-docs/src/01_effect/01_basics/index.md +5 -3
- package/ai-docs/src/01_effect/03_services/20_layer-composition.ts +1 -1
- package/ai-docs/src/01_effect/03_services/20_layer-unwrap.ts +2 -2
- package/ai-docs/src/01_effect/05_resources/10_acquire-release.ts +2 -2
- package/ai-docs/src/03_stream/30_encoding.ts +5 -7
- package/ai-docs/src/08_observability/10_logging.ts +1 -1
- package/ai-docs/src/70_cli/10_basics.ts +7 -7
- package/ai-docs/src/71_ai/10_language-model.ts +2 -2
- package/ai-docs/src/71_ai/20_tools.ts +1 -1
- package/ai-docs/src/71_ai/30_chat.ts +1 -1
- package/dist/SqliteClient.d.ts.map +1 -1
- package/dist/SqliteClient.js +3 -3
- package/dist/SqliteClient.js.map +1 -1
- package/package.json +4 -4
- package/src/SqliteClient.ts +15 -8
package/AGENTS.md
CHANGED
|
@@ -11,9 +11,11 @@ purposes. In practice, you would not include these comments in your code.
|
|
|
11
11
|
|
|
12
12
|
## Writing `Effect` code
|
|
13
13
|
|
|
14
|
-
Prefer
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
Prefer `Effect.gen` for inline Effect code. For reusable functions, prefer
|
|
15
|
+
`Effect.fn("name")` when tracing is useful and `Effect.fnUntraced` when it is not,
|
|
16
|
+
particularly in library implementations and hot paths. Avoid functions that only
|
|
17
|
+
wrap and return `Effect.gen`. Attach additional behaviour with combinators; this
|
|
18
|
+
style is more readable and easier to maintain than using combinators alone.
|
|
17
19
|
|
|
18
20
|
### Using Effect.gen
|
|
19
21
|
|
|
@@ -46,13 +48,16 @@ export class FileProcessingError extends Schema.TaggedError<FileProcessingError>
|
|
|
46
48
|
}) {}
|
|
47
49
|
```
|
|
48
50
|
|
|
49
|
-
### Using Effect.fn
|
|
51
|
+
### Using Effect.fn and Effect.fnUntraced
|
|
50
52
|
|
|
51
|
-
When writing functions that return an Effect, use `Effect.fn`
|
|
52
|
-
generator syntax.
|
|
53
|
+
When writing reusable functions that return an Effect, use `Effect.fn` or
|
|
54
|
+
`Effect.fnUntraced` to use the generator syntax.
|
|
53
55
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
Use `Effect.fn("name")` when the function should create a tracing span. Prefer
|
|
57
|
+
`Effect.fnUntraced` when tracing is not needed, particularly for library
|
|
58
|
+
implementations and hot paths.
|
|
59
|
+
|
|
60
|
+
**Avoid creating functions that only wrap and return an `Effect.gen`**.
|
|
56
61
|
|
|
57
62
|
```ts
|
|
58
63
|
import { Effect, Schema } from "effect"
|
|
@@ -80,6 +85,16 @@ export const effectFunction = Effect.fn("effectFunction")(
|
|
|
80
85
|
})
|
|
81
86
|
)
|
|
82
87
|
|
|
88
|
+
// Effect.fnUntraced avoids tracing and stack-frame capture while still reusing
|
|
89
|
+
// the generator body. This is preferred for library functions that do not
|
|
90
|
+
// represent a useful tracing boundary.
|
|
91
|
+
export const validateBatchSize = Effect.fnUntraced(function*(size: number): Effect.fn.Return<number, SomeError> {
|
|
92
|
+
if (!Number.isInteger(size) || size <= 0) {
|
|
93
|
+
return yield* new SomeError({ message: "Batch size must be a positive integer" })
|
|
94
|
+
}
|
|
95
|
+
return size
|
|
96
|
+
})
|
|
97
|
+
|
|
83
98
|
// Use Schema.TaggedError to define a custom error
|
|
84
99
|
export class SomeError extends Schema.TaggedError<SomeError>()("SomeError", {
|
|
85
100
|
message: Schema.String
|
|
@@ -247,7 +262,7 @@ They let you model finite or infinite data sources.
|
|
|
247
262
|
- `NodeStream.fromReadable` for Node.js readable streams
|
|
248
263
|
- **[Consuming and transforming streams](./ai-docs/src/03_stream/20_consuming-streams.ts)**: How to transform and consume streams using operators like `map`, `flatMap`, `filter`, `mapEffect`, and various `run*` methods.
|
|
249
264
|
- **[Decoding and encoding streams](./ai-docs/src/03_stream/30_encoding.ts)**:
|
|
250
|
-
Use `Stream.pipeThroughChannel` with the `Ndjson`
|
|
265
|
+
Use `Stream.pipeThroughChannel` with the `Ndjson` and `SchemaBinary` modules to
|
|
251
266
|
decode and encode streams of structured data.
|
|
252
267
|
|
|
253
268
|
## Integrating Effect into existing applications
|
package/CLAUDE.md
CHANGED
|
@@ -11,9 +11,11 @@ purposes. In practice, you would not include these comments in your code.
|
|
|
11
11
|
|
|
12
12
|
## Writing `Effect` code
|
|
13
13
|
|
|
14
|
-
Prefer
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
Prefer `Effect.gen` for inline Effect code. For reusable functions, prefer
|
|
15
|
+
`Effect.fn("name")` when tracing is useful and `Effect.fnUntraced` when it is not,
|
|
16
|
+
particularly in library implementations and hot paths. Avoid functions that only
|
|
17
|
+
wrap and return `Effect.gen`. Attach additional behaviour with combinators; this
|
|
18
|
+
style is more readable and easier to maintain than using combinators alone.
|
|
17
19
|
|
|
18
20
|
### Using Effect.gen
|
|
19
21
|
|
|
@@ -46,13 +48,16 @@ export class FileProcessingError extends Schema.TaggedError<FileProcessingError>
|
|
|
46
48
|
}) {}
|
|
47
49
|
```
|
|
48
50
|
|
|
49
|
-
### Using Effect.fn
|
|
51
|
+
### Using Effect.fn and Effect.fnUntraced
|
|
50
52
|
|
|
51
|
-
When writing functions that return an Effect, use `Effect.fn`
|
|
52
|
-
generator syntax.
|
|
53
|
+
When writing reusable functions that return an Effect, use `Effect.fn` or
|
|
54
|
+
`Effect.fnUntraced` to use the generator syntax.
|
|
53
55
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
Use `Effect.fn("name")` when the function should create a tracing span. Prefer
|
|
57
|
+
`Effect.fnUntraced` when tracing is not needed, particularly for library
|
|
58
|
+
implementations and hot paths.
|
|
59
|
+
|
|
60
|
+
**Avoid creating functions that only wrap and return an `Effect.gen`**.
|
|
56
61
|
|
|
57
62
|
```ts
|
|
58
63
|
import { Effect, Schema } from "effect"
|
|
@@ -80,6 +85,16 @@ export const effectFunction = Effect.fn("effectFunction")(
|
|
|
80
85
|
})
|
|
81
86
|
)
|
|
82
87
|
|
|
88
|
+
// Effect.fnUntraced avoids tracing and stack-frame capture while still reusing
|
|
89
|
+
// the generator body. This is preferred for library functions that do not
|
|
90
|
+
// represent a useful tracing boundary.
|
|
91
|
+
export const validateBatchSize = Effect.fnUntraced(function*(size: number): Effect.fn.Return<number, SomeError> {
|
|
92
|
+
if (!Number.isInteger(size) || size <= 0) {
|
|
93
|
+
return yield* new SomeError({ message: "Batch size must be a positive integer" })
|
|
94
|
+
}
|
|
95
|
+
return size
|
|
96
|
+
})
|
|
97
|
+
|
|
83
98
|
// Use Schema.TaggedError to define a custom error
|
|
84
99
|
export class SomeError extends Schema.TaggedError<SomeError>()("SomeError", {
|
|
85
100
|
message: Schema.String
|
|
@@ -247,7 +262,7 @@ They let you model finite or infinite data sources.
|
|
|
247
262
|
- `NodeStream.fromReadable` for Node.js readable streams
|
|
248
263
|
- **[Consuming and transforming streams](./ai-docs/src/03_stream/20_consuming-streams.ts)**: How to transform and consume streams using operators like `map`, `flatMap`, `filter`, `mapEffect`, and various `run*` methods.
|
|
249
264
|
- **[Decoding and encoding streams](./ai-docs/src/03_stream/30_encoding.ts)**:
|
|
250
|
-
Use `Stream.pipeThroughChannel` with the `Ndjson`
|
|
265
|
+
Use `Stream.pipeThroughChannel` with the `Ndjson` and `SchemaBinary` modules to
|
|
251
266
|
decode and encode streams of structured data.
|
|
252
267
|
|
|
253
268
|
## Integrating Effect into existing applications
|
package/ai-docs/package.json
CHANGED
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"@effect/sql-sqlite-wasm": "workspace:*",
|
|
28
28
|
"@effect/vitest": "workspace:*",
|
|
29
29
|
"effect": "workspace:*",
|
|
30
|
-
"hono": "^4.13.
|
|
31
|
-
"nodemailer": "^
|
|
30
|
+
"hono": "^4.13.7",
|
|
31
|
+
"nodemailer": "^10.0.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/nodemailer": "^8.0.1"
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @title Using Effect.fn
|
|
2
|
+
* @title Using Effect.fn and Effect.fnUntraced
|
|
3
3
|
*
|
|
4
|
-
* When writing functions that return an Effect, use `Effect.fn`
|
|
5
|
-
* generator syntax.
|
|
4
|
+
* When writing reusable functions that return an Effect, use `Effect.fn` or
|
|
5
|
+
* `Effect.fnUntraced` to use the generator syntax.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* Use `Effect.fn("name")` when the function should create a tracing span. Prefer
|
|
8
|
+
* `Effect.fnUntraced` when tracing is not needed, particularly for library
|
|
9
|
+
* implementations and hot paths.
|
|
10
|
+
*
|
|
11
|
+
* **Avoid creating functions that only wrap and return an `Effect.gen`**.
|
|
9
12
|
*/
|
|
10
13
|
|
|
11
14
|
import { Effect, Schema } from "effect"
|
|
@@ -33,6 +36,16 @@ export const effectFunction = Effect.fn("effectFunction")(
|
|
|
33
36
|
})
|
|
34
37
|
)
|
|
35
38
|
|
|
39
|
+
// Effect.fnUntraced avoids tracing and stack-frame capture while still reusing
|
|
40
|
+
// the generator body. This is preferred for library functions that do not
|
|
41
|
+
// represent a useful tracing boundary.
|
|
42
|
+
export const validateBatchSize = Effect.fnUntraced(function*(size: number): Effect.fn.Return<number, SomeError> {
|
|
43
|
+
if (!Number.isInteger(size) || size <= 0) {
|
|
44
|
+
return yield* new SomeError({ message: "Batch size must be a positive integer" })
|
|
45
|
+
}
|
|
46
|
+
return size
|
|
47
|
+
})
|
|
48
|
+
|
|
36
49
|
// Use Schema.TaggedError to define a custom error
|
|
37
50
|
export class SomeError extends Schema.TaggedError<SomeError>()("SomeError", {
|
|
38
51
|
message: Schema.String
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
## Writing `Effect` code
|
|
2
2
|
|
|
3
|
-
Prefer
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Prefer `Effect.gen` for inline Effect code. For reusable functions, prefer
|
|
4
|
+
`Effect.fn("name")` when tracing is useful and `Effect.fnUntraced` when it is not,
|
|
5
|
+
particularly in library implementations and hot paths. Avoid functions that only
|
|
6
|
+
wrap and return `Effect.gen`. Attach additional behaviour with combinators; this
|
|
7
|
+
style is more readable and easier to maintain than using combinators alone.
|
|
@@ -14,7 +14,7 @@ export const SqlClientLayer: Layer.Layer<
|
|
|
14
14
|
PgClient.PgClient | SqlClient.SqlClient,
|
|
15
15
|
Config.ConfigError | SqlError.SqlError
|
|
16
16
|
> = PgClient.layerConfig({
|
|
17
|
-
url: Config.
|
|
17
|
+
url: Config.Redacted("DATABASE_URL")
|
|
18
18
|
})
|
|
19
19
|
|
|
20
20
|
export class UserRespositoryError extends Schema.TaggedError<UserRespositoryError>()("UserRespositoryError", {
|
|
@@ -51,7 +51,7 @@ export class MessageStore extends Context.Service<MessageStore, {
|
|
|
51
51
|
static readonly layer = Layer.unwrap(
|
|
52
52
|
Effect.gen(function*() {
|
|
53
53
|
// Read config inside an Effect, then choose which concrete layer to use.
|
|
54
|
-
const useInMemory = yield* Config.
|
|
54
|
+
const useInMemory = yield* Config.Boolean("MESSAGE_STORE_IN_MEMORY").pipe(
|
|
55
55
|
Config.withDefault(false)
|
|
56
56
|
)
|
|
57
57
|
|
|
@@ -59,7 +59,7 @@ export class MessageStore extends Context.Service<MessageStore, {
|
|
|
59
59
|
return MessageStore.layerInMemory
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
const remoteUrl = yield* Config.
|
|
62
|
+
const remoteUrl = yield* Config.URL("MESSAGE_STORE_URL")
|
|
63
63
|
return MessageStore.layerRemote(remoteUrl)
|
|
64
64
|
})
|
|
65
65
|
)
|
|
@@ -22,8 +22,8 @@ export class Smtp extends Context.Service<Smtp, {
|
|
|
22
22
|
static readonly layer = Layer.effect(
|
|
23
23
|
Smtp,
|
|
24
24
|
Effect.gen(function*() {
|
|
25
|
-
const user = yield* Config.
|
|
26
|
-
const pass = yield* Config.
|
|
25
|
+
const user = yield* Config.String("SMTP_USER")
|
|
26
|
+
const pass = yield* Config.Redacted("SMTP_PASS")
|
|
27
27
|
|
|
28
28
|
// Use `Effect.acquireRelease` to manage the lifecycle of the SMTP
|
|
29
29
|
// transporter.
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @title Decoding and encoding streams
|
|
3
3
|
*
|
|
4
|
-
* Use `Stream.pipeThroughChannel` with the `Ndjson`
|
|
4
|
+
* Use `Stream.pipeThroughChannel` with the `Ndjson` and `SchemaBinary` modules to
|
|
5
5
|
* decode and encode streams of structured data.
|
|
6
6
|
*/
|
|
7
7
|
import { DateTime, Schema, Stream } from "effect"
|
|
8
|
-
import {
|
|
8
|
+
import { Ndjson, SchemaBinary } from "effect/unstable/encoding"
|
|
9
9
|
|
|
10
|
-
//
|
|
11
|
-
|
|
12
|
-
// `Msgpack.encode()`, etc.).
|
|
13
|
-
export const msgpackDecoder = Msgpack.decodeSchema(Schema.Struct({
|
|
10
|
+
// SchemaBinary derives a framed binary decoder directly from a schema.
|
|
11
|
+
export const schemaBinaryDecoder = SchemaBinary.decode(Schema.Struct({
|
|
14
12
|
id: Schema.Int,
|
|
15
13
|
name: Schema.String
|
|
16
|
-
}))
|
|
14
|
+
}))()
|
|
17
15
|
|
|
18
16
|
// ---------------------------------------------------------------------------
|
|
19
17
|
// Domain
|
|
@@ -41,7 +41,7 @@ export const AppLoggerLayer = Logger.layer([appLogger]).pipe(
|
|
|
41
41
|
// Create a logger layer that uses the default logger for development, and the
|
|
42
42
|
// custom logger for production
|
|
43
43
|
export const LoggerLayer = Layer.unwrap(Effect.gen(function*() {
|
|
44
|
-
const env = yield* Config.
|
|
44
|
+
const env = yield* Config.String("NODE_ENV").pipe(Config.withDefault("development"))
|
|
45
45
|
if (env === "production") {
|
|
46
46
|
return AppLoggerLayer
|
|
47
47
|
}
|
|
@@ -10,7 +10,7 @@ import { Argument, Command, Flag } from "effect/unstable/cli"
|
|
|
10
10
|
|
|
11
11
|
// You can define flags outside of commands and reuse them across multiple
|
|
12
12
|
// commands.
|
|
13
|
-
const workspace = Flag.
|
|
13
|
+
const workspace = Flag.String("workspace").pipe(
|
|
14
14
|
Flag.withAlias("w"),
|
|
15
15
|
Flag.withDescription("Workspace to operate on"),
|
|
16
16
|
Flag.withDefault("personal")
|
|
@@ -21,7 +21,7 @@ const workspace = Flag.string("workspace").pipe(
|
|
|
21
21
|
const tasks = Command.make("tasks").pipe(
|
|
22
22
|
Command.withSharedFlags({
|
|
23
23
|
workspace,
|
|
24
|
-
verbose: Flag.
|
|
24
|
+
verbose: Flag.Boolean("verbose").pipe(
|
|
25
25
|
Flag.withAlias("v"),
|
|
26
26
|
Flag.withDescription("Print diagnostic output"),
|
|
27
27
|
Flag.withDefault(false)
|
|
@@ -41,17 +41,17 @@ const Email = Schema.String.pipe(
|
|
|
41
41
|
const create = Command.make(
|
|
42
42
|
"create",
|
|
43
43
|
{
|
|
44
|
-
title: Argument.
|
|
44
|
+
title: Argument.String("title").pipe(
|
|
45
45
|
Argument.withDescription("Task title"),
|
|
46
46
|
// Reject empty titles at parse time, so the handler only ever sees
|
|
47
47
|
// valid input
|
|
48
48
|
Argument.withSchema(Schema.NonEmptyString)
|
|
49
49
|
),
|
|
50
|
-
priority: Flag.
|
|
50
|
+
priority: Flag.Literals("priority", ["low", "normal", "high"]).pipe(
|
|
51
51
|
Flag.withDescription("Priority for the new task"),
|
|
52
52
|
Flag.withDefault("normal")
|
|
53
53
|
),
|
|
54
|
-
assignee: Flag.
|
|
54
|
+
assignee: Flag.String("assignee").pipe(
|
|
55
55
|
Flag.withDescription("Email address of the person to assign"),
|
|
56
56
|
Flag.withSchema(Email),
|
|
57
57
|
Flag.optional
|
|
@@ -88,11 +88,11 @@ const create = Command.make(
|
|
|
88
88
|
const list = Command.make(
|
|
89
89
|
"list",
|
|
90
90
|
{
|
|
91
|
-
status: Flag.
|
|
91
|
+
status: Flag.Literals("status", ["open", "done", "all"]).pipe(
|
|
92
92
|
Flag.withDescription("Filter tasks by status"),
|
|
93
93
|
Flag.withDefault("open")
|
|
94
94
|
),
|
|
95
|
-
json: Flag.
|
|
95
|
+
json: Flag.Boolean("json").pipe(
|
|
96
96
|
Flag.withDescription("Print machine-readable output"),
|
|
97
97
|
Flag.withDefault(false)
|
|
98
98
|
)
|
|
@@ -13,7 +13,7 @@ import { LaunchPlan } from "./fixtures/domain/LaunchPlan.ts"
|
|
|
13
13
|
|
|
14
14
|
// You can use Config to create ai clients
|
|
15
15
|
const AnthropicClientLayer = AnthropicClient.layerConfig({
|
|
16
|
-
apiKey: Config.
|
|
16
|
+
apiKey: Config.Redacted("ANTHROPIC_API_KEY")
|
|
17
17
|
}).pipe(
|
|
18
18
|
// Providers typically require an HttpClient, but you can choose which one to
|
|
19
19
|
// use.
|
|
@@ -21,7 +21,7 @@ const AnthropicClientLayer = AnthropicClient.layerConfig({
|
|
|
21
21
|
)
|
|
22
22
|
|
|
23
23
|
const OpenAiClientLayer = OpenAiClient.layerConfig({
|
|
24
|
-
apiKey: Config.
|
|
24
|
+
apiKey: Config.Redacted("OPENAI_API_KEY")
|
|
25
25
|
}).pipe(
|
|
26
26
|
Layer.provide(FetchHttpClient.layer)
|
|
27
27
|
)
|
|
@@ -101,7 +101,7 @@ const ProductToolkitLayer = ProductToolkit.toLayer(Effect.gen(function*() {
|
|
|
101
101
|
|
|
102
102
|
// Provider setup (same pattern as the language-model example).
|
|
103
103
|
const OpenAiClientLayer = OpenAiClient.layerConfig({
|
|
104
|
-
apiKey: Config.
|
|
104
|
+
apiKey: Config.Redacted("OPENAI_API_KEY")
|
|
105
105
|
}).pipe(Layer.provide(FetchHttpClient.layer))
|
|
106
106
|
|
|
107
107
|
export class ProductAssistantError extends Schema.TaggedError<ProductAssistantError>()(
|
|
@@ -14,7 +14,7 @@ import { FetchHttpClient } from "effect/unstable/http"
|
|
|
14
14
|
// ---------------------------------------------------------------------------
|
|
15
15
|
|
|
16
16
|
const OpenAiClientLayer = OpenAiClient.layerConfig({
|
|
17
|
-
apiKey: Config.
|
|
17
|
+
apiKey: Config.Redacted("OPENAI_API_KEY")
|
|
18
18
|
}).pipe(Layer.provide(FetchHttpClient.layer))
|
|
19
19
|
|
|
20
20
|
// ---------------------------------------------------------------------------
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SqliteClient.d.ts","sourceRoot":"","sources":["../src/SqliteClient.ts"],"names":[],"mappings":"AAcA,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;AAsBvD;;;;;GAKG;AACH,eAAO,MAAM,MAAM,EAAE,MAAwD,CAAA;AAE7E;;;;;GAKG;AACH,MAAM,MAAM,MAAM,GAAG,+CAA+C,CAAA;AAEpE;;;;;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;;;;;GAKG;AACH,eAAO,MAAM,YAAY,6CAAgF,CAAA;AAEzG;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAA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J;;;;;GAKG;AACH,eAAO,MAAM,WAAW,WACd,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,WACR,kBAAkB,KACzB,KAAK,CAAC,KAAK,CAAC,YAAY,GAAG,MAAM,CAAC,SAAS,CAML,CAAA"}
|
package/dist/SqliteClient.js
CHANGED
|
@@ -105,15 +105,15 @@ export const make = options => Effect.gen(function* () {
|
|
|
105
105
|
});
|
|
106
106
|
const runValues = (sql, params = []) => Effect.withFiber(fiber => {
|
|
107
107
|
if (fiber.getRef(AsyncQuery)) {
|
|
108
|
-
return Effect.tryPromise({
|
|
108
|
+
return Effect.map(Effect.tryPromise({
|
|
109
109
|
try: () => db.executeRaw(sql, params),
|
|
110
110
|
catch: cause => new SqlError({
|
|
111
111
|
reason: classifyError(cause, "Failed to execute statement (async)", "execute")
|
|
112
112
|
})
|
|
113
|
-
});
|
|
113
|
+
}), result => result.rawRows);
|
|
114
114
|
}
|
|
115
115
|
return Effect.try({
|
|
116
|
-
try: () => db.executeRawSync(sql, params),
|
|
116
|
+
try: () => db.executeRawSync(sql, params).rawRows,
|
|
117
117
|
catch: cause => new SqlError({
|
|
118
118
|
reason: classifyError(cause, "Failed to execute statement", "execute")
|
|
119
119
|
})
|
package/dist/SqliteClient.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SqliteClient.js","names":[],"sources":["../src/SqliteClient.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;AAaA,OAAO,KAAK,MAAM,MAAM,2BAA2B;AACnD,OAAO,KAAK,MAAM,MAAM,eAAe;AACvC,OAAO,KAAK,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe;AACvC,OAAO,KAAK,KAAK,MAAM,cAA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,CAAC,CACtC,CAAC,CACL,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect/sql-sqlite-react-native",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.113",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "A SQLite toolkit for Effect",
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"provenance": true
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@op-engineering/op-sqlite": "^18.
|
|
51
|
-
"effect": "^4.0.0-rc.
|
|
50
|
+
"@op-engineering/op-sqlite": "^18.2.0",
|
|
51
|
+
"effect": "^4.0.0-rc.113"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@op-engineering/op-sqlite": ">=17.1.2 <18.0.0",
|
|
55
|
-
"effect": "^4.0.0-rc.
|
|
55
|
+
"effect": "^4.0.0-rc.113"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"codegen": "effect-utils codegen",
|
package/src/SqliteClient.ts
CHANGED
|
@@ -180,14 +180,17 @@ export const make = (
|
|
|
180
180
|
) =>
|
|
181
181
|
Effect.withFiber<Array<any>, SqlError>((fiber) => {
|
|
182
182
|
if (fiber.getRef(AsyncQuery)) {
|
|
183
|
-
return Effect.
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
183
|
+
return Effect.map(
|
|
184
|
+
Effect.tryPromise({
|
|
185
|
+
try: () => db.executeRaw(sql, params as Array<any>),
|
|
186
|
+
catch: (cause) =>
|
|
187
|
+
new SqlError({ reason: classifyError(cause, "Failed to execute statement (async)", "execute") })
|
|
188
|
+
}),
|
|
189
|
+
(result) => result.rawRows
|
|
190
|
+
)
|
|
188
191
|
}
|
|
189
192
|
return Effect.try({
|
|
190
|
-
try: () => db.executeRawSync(sql, params as Array<any>),
|
|
193
|
+
try: () => db.executeRawSync(sql, params as Array<any>).rawRows,
|
|
191
194
|
catch: (cause) => new SqlError({ reason: classifyError(cause, "Failed to execute statement", "execute") })
|
|
192
195
|
})
|
|
193
196
|
})
|
|
@@ -336,12 +339,12 @@ interface DB {
|
|
|
336
339
|
* Same as `execute` except the results are not returned in objects but rather in arrays with just the values and not the keys
|
|
337
340
|
* It will be faster since a lot of repeated work is skipped and only the values you care about are returned
|
|
338
341
|
*/
|
|
339
|
-
executeRaw: (query: string, params?: Array<any>) => Promise<
|
|
342
|
+
executeRaw: (query: string, params?: Array<any>) => Promise<RawQueryResult>
|
|
340
343
|
/**
|
|
341
344
|
* Same as `executeRaw` but it will block the JS thread and therefore your UI and should be used with caution
|
|
342
345
|
* It will return an array of arrays with just the values and not the keys
|
|
343
346
|
*/
|
|
344
|
-
executeRawSync: (query: string, params?: Array<any>) =>
|
|
347
|
+
executeRawSync: (query: string, params?: Array<any>) => RawQueryResult
|
|
345
348
|
/**
|
|
346
349
|
* Get's the absolute path to the db file. Useful for debugging on local builds and for attaching the DB from users devices
|
|
347
350
|
*/
|
|
@@ -368,6 +371,10 @@ interface DB {
|
|
|
368
371
|
sync: () => void
|
|
369
372
|
}
|
|
370
373
|
|
|
374
|
+
interface RawQueryResult {
|
|
375
|
+
rawRows: Array<Array<any>>
|
|
376
|
+
}
|
|
377
|
+
|
|
371
378
|
interface QueryResult {
|
|
372
379
|
insertId?: number
|
|
373
380
|
rowsAffected: number
|