effect 4.0.0-beta.26 → 4.0.0-beta.28
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/Cause.d.ts +1 -1
- package/dist/ConfigProvider.d.ts +1 -1
- package/dist/Cron.d.ts +1 -1
- package/dist/Data.d.ts +3 -3
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js +2 -2
- package/dist/Data.js.map +1 -1
- package/dist/Effect.d.ts +331 -206
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +113 -72
- package/dist/Effect.js.map +1 -1
- package/dist/Encoding.d.ts +1 -1
- package/dist/ErrorReporter.d.ts +2 -4
- package/dist/ErrorReporter.d.ts.map +1 -1
- package/dist/ErrorReporter.js +1 -3
- package/dist/ErrorReporter.js.map +1 -1
- package/dist/Exit.d.ts +24 -12
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js +8 -4
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +1 -0
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js.map +1 -1
- package/dist/Graph.d.ts +1 -1
- package/dist/Layer.d.ts +112 -117
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +43 -44
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +4 -4
- package/dist/LayerMap.js +3 -3
- package/dist/ManagedRuntime.d.ts +1 -1
- package/dist/ManagedRuntime.js +1 -1
- package/dist/Metric.d.ts +2 -4
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +2 -4
- package/dist/Metric.js.map +1 -1
- package/dist/PlatformError.d.ts +2 -2
- package/dist/References.d.ts +6 -1
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +6 -1
- package/dist/References.js.map +1 -1
- package/dist/RequestResolver.d.ts +19 -19
- package/dist/RequestResolver.js +10 -10
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Schedule.d.ts +144 -82
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +58 -32
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +9 -0
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +11 -0
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +3 -1
- package/dist/Schema.js.map +1 -1
- package/dist/Stdio.d.ts +6 -2
- package/dist/Stdio.d.ts.map +1 -1
- package/dist/Stdio.js +2 -2
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +8 -4
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +8 -4
- package/dist/Stream.js.map +1 -1
- package/dist/Types.d.ts +1 -22
- package/dist/Types.d.ts.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/internal/effect.js +3 -1
- package/dist/internal/effect.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +12 -28
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +4 -18
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +20 -1
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +8 -0
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +65 -12
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +159 -45
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +1 -1
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +4 -11
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/internal/codec-transformer.js +0 -5
- package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +4 -4
- package/dist/unstable/cli/CliError.js +4 -4
- package/dist/unstable/cli/Primitive.d.ts +1 -1
- package/dist/unstable/cli/Primitive.js +1 -1
- package/dist/unstable/cli/Prompt.js +31 -0
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +5 -5
- package/dist/unstable/cluster/Reply.d.ts +3 -3
- package/dist/unstable/encoding/Msgpack.d.ts +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts +1 -1
- package/dist/unstable/encoding/Sse.d.ts +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +1 -1
- package/dist/unstable/http/Cookies.d.ts +45 -1
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +22 -0
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +16 -0
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +11 -0
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +1 -1
- package/dist/unstable/http/HttpClientError.d.ts +7 -7
- package/dist/unstable/http/HttpClientRequest.d.ts +5 -0
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +21 -17
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +7 -0
- package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
- package/dist/unstable/http/HttpEffect.js +6 -0
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +6 -6
- package/dist/unstable/http/HttpServerRequest.d.ts +11 -0
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +291 -1
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +47 -1
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +227 -0
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +69 -0
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -0
- package/dist/unstable/http/HttpStaticServer.js +353 -0
- package/dist/unstable/http/HttpStaticServer.js.map +1 -0
- package/dist/unstable/http/Multipart.d.ts +1 -1
- package/dist/unstable/http/UrlParams.d.ts +1 -1
- package/dist/unstable/http/index.d.ts +4 -0
- package/dist/unstable/http/index.d.ts.map +1 -1
- package/dist/unstable/http/index.js +4 -0
- package/dist/unstable/http/index.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +5 -0
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +1 -0
- package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +1 -1
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +4 -10
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +4 -6
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +39 -9
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +8 -8
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +46 -20
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +1 -1
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +5 -5
- package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +2 -2
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/Utils.js +1 -1
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +21 -0
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +15 -0
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/socket/SocketServer.d.ts +3 -3
- package/dist/unstable/sql/Migrator.d.ts +1 -1
- package/dist/unstable/sql/SqlResolver.js +2 -2
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +1 -1
- package/package.json +1 -1
- package/src/Cause.ts +1 -1
- package/src/Data.ts +3 -4
- package/src/Effect.ts +331 -206
- package/src/ErrorReporter.ts +2 -4
- package/src/Exit.ts +24 -12
- package/src/Fiber.ts +1 -0
- package/src/Layer.ts +112 -117
- package/src/LayerMap.ts +4 -4
- package/src/ManagedRuntime.ts +1 -1
- package/src/Metric.ts +2 -4
- package/src/References.ts +6 -1
- package/src/RequestResolver.ts +20 -20
- package/src/Schedule.ts +144 -82
- package/src/Scheduler.ts +12 -0
- package/src/Schema.ts +3 -1
- package/src/Stdio.ts +8 -4
- package/src/Stream.ts +8 -4
- package/src/Types.ts +1 -23
- package/src/index.ts +5 -3
- package/src/internal/effect.ts +3 -0
- package/src/unstable/ai/LanguageModel.ts +16 -37
- package/src/unstable/ai/McpSchema.ts +14 -0
- package/src/unstable/ai/McpServer.ts +224 -53
- package/src/unstable/ai/Toolkit.ts +5 -14
- package/src/unstable/ai/internal/codec-transformer.ts +0 -7
- package/src/unstable/cli/CliError.ts +4 -4
- package/src/unstable/cli/Primitive.ts +1 -1
- package/src/unstable/cli/Prompt.ts +27 -0
- package/src/unstable/http/Cookies.ts +84 -0
- package/src/unstable/http/Headers.ts +34 -0
- package/src/unstable/http/HttpClientRequest.ts +21 -17
- package/src/unstable/http/HttpEffect.ts +8 -0
- package/src/unstable/http/HttpServerRequest.ts +388 -1
- package/src/unstable/http/HttpServerResponse.ts +328 -1
- package/src/unstable/http/HttpStaticServer.ts +456 -0
- package/src/unstable/http/index.ts +5 -0
- package/src/unstable/httpapi/HttpApiBuilder.ts +3 -0
- package/src/unstable/httpapi/HttpApiGroup.ts +1 -0
- package/src/unstable/reactivity/Atom.ts +20 -26
- package/src/unstable/reactivity/AtomHttpApi.ts +45 -11
- package/src/unstable/reactivity/AtomRpc.ts +48 -17
- package/src/unstable/rpc/Rpc.ts +1 -3
- package/src/unstable/rpc/RpcMiddleware.ts +12 -6
- package/src/unstable/rpc/RpcServer.ts +2 -2
- package/src/unstable/rpc/Utils.ts +1 -1
- package/src/unstable/schema/Model.ts +31 -0
- package/src/unstable/sql/SqlResolver.ts +2 -2
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as Duration from "../../Duration.ts"
|
|
5
5
|
import * as Effect from "../../Effect.ts"
|
|
6
|
+
import * as Hash from "../../Hash.ts"
|
|
6
7
|
import * as Layer from "../../Layer.ts"
|
|
7
8
|
import type { ReadonlyRecord } from "../../Record.ts"
|
|
9
|
+
import * as Schema from "../../Schema.ts"
|
|
8
10
|
import type { Scope } from "../../Scope.ts"
|
|
9
11
|
import * as ServiceMap from "../../ServiceMap.ts"
|
|
10
12
|
import * as Stream from "../../Stream.ts"
|
|
@@ -12,11 +14,11 @@ import type { Mutable, NoInfer } from "../../Types.ts"
|
|
|
12
14
|
import * as Headers from "../http/Headers.ts"
|
|
13
15
|
import type * as Rpc from "../rpc/Rpc.ts"
|
|
14
16
|
import * as RpcClient from "../rpc/RpcClient.ts"
|
|
15
|
-
import
|
|
17
|
+
import { RpcClientError } from "../rpc/RpcClientError.ts"
|
|
16
18
|
import type * as RpcGroup from "../rpc/RpcGroup.ts"
|
|
17
19
|
import type { RequestId } from "../rpc/RpcMessage.ts"
|
|
18
20
|
import * as RpcSchema from "../rpc/RpcSchema.ts"
|
|
19
|
-
import
|
|
21
|
+
import * as AsyncResult from "./AsyncResult.ts"
|
|
20
22
|
import * as Atom from "./Atom.ts"
|
|
21
23
|
import * as Reactivity from "./Reactivity.ts"
|
|
22
24
|
|
|
@@ -24,7 +26,7 @@ import * as Reactivity from "./Reactivity.ts"
|
|
|
24
26
|
* @since 4.0.0
|
|
25
27
|
* @category Models
|
|
26
28
|
*/
|
|
27
|
-
export interface AtomRpcClient<Self, Id extends string, Rpcs extends Rpc.Any
|
|
29
|
+
export interface AtomRpcClient<Self, Id extends string, Rpcs extends Rpc.Any> extends
|
|
28
30
|
ServiceMap.Service<
|
|
29
31
|
Self,
|
|
30
32
|
RpcClient.RpcClient.Flat<Rpcs, RpcClientError>
|
|
@@ -35,8 +37,8 @@ export interface AtomRpcClient<Self, Id extends string, Rpcs extends Rpc.Any, E>
|
|
|
35
37
|
RpcClient.RpcClient.Flat<Rpcs, RpcClientError>
|
|
36
38
|
>
|
|
37
39
|
|
|
38
|
-
readonly layer: Layer.Layer<Self
|
|
39
|
-
readonly runtime: Atom.AtomRuntime<Self
|
|
40
|
+
readonly layer: Layer.Layer<Self>
|
|
41
|
+
readonly runtime: Atom.AtomRuntime<Self>
|
|
40
42
|
|
|
41
43
|
readonly mutation: <Tag extends Rpc.Tag<Rpcs>>(
|
|
42
44
|
arg: Tag
|
|
@@ -58,7 +60,7 @@ export interface AtomRpcClient<Self, Id extends string, Rpcs extends Rpc.Any, E>
|
|
|
58
60
|
readonly headers?: Headers.Input | undefined
|
|
59
61
|
},
|
|
60
62
|
_Success["Type"],
|
|
61
|
-
_Error["Type"] |
|
|
63
|
+
_Error["Type"] | RpcClientError | _Middleware["error"]["Type"]
|
|
62
64
|
>
|
|
63
65
|
: never
|
|
64
66
|
|
|
@@ -82,14 +84,14 @@ export interface AtomRpcClient<Self, Id extends string, Rpcs extends Rpc.Any, E>
|
|
|
82
84
|
> ? [_Success] extends [RpcSchema.Stream<infer _A, infer _E>] ? Atom.Writable<
|
|
83
85
|
Atom.PullResult<
|
|
84
86
|
_A["Type"],
|
|
85
|
-
_E["Type"] | _Error["Type"] |
|
|
87
|
+
_E["Type"] | _Error["Type"] | RpcClientError | _Middleware["error"]["Type"]
|
|
86
88
|
>,
|
|
87
89
|
void
|
|
88
90
|
>
|
|
89
91
|
: Atom.Atom<
|
|
90
92
|
AsyncResult.AsyncResult<
|
|
91
93
|
_Success["Type"],
|
|
92
|
-
_Error["Type"] |
|
|
94
|
+
_Error["Type"] | RpcClientError | _Middleware["error"]["Type"]
|
|
93
95
|
>
|
|
94
96
|
>
|
|
95
97
|
: never
|
|
@@ -132,8 +134,8 @@ export const Service = <Self>() =>
|
|
|
132
134
|
| undefined
|
|
133
135
|
readonly runtime?: Atom.RuntimeFactory | undefined
|
|
134
136
|
}
|
|
135
|
-
): AtomRpcClient<Self, Id, Rpcs
|
|
136
|
-
const self: Mutable<AtomRpcClient<Self, Id, Rpcs
|
|
137
|
+
): AtomRpcClient<Self, Id, Rpcs> => {
|
|
138
|
+
const self: Mutable<AtomRpcClient<Self, Id, Rpcs>> = ServiceMap.Service<
|
|
137
139
|
Self,
|
|
138
140
|
RpcClient.RpcClient.Flat<Rpcs, RpcClientError>
|
|
139
141
|
>()(id) as any
|
|
@@ -149,12 +151,13 @@ export const Service = <Self>() =>
|
|
|
149
151
|
never,
|
|
150
152
|
RM
|
|
151
153
|
>)
|
|
152
|
-
).pipe(Layer.provide(options.protocol))
|
|
154
|
+
).pipe(Layer.provide(Layer.orDie(options.protocol)))
|
|
153
155
|
const runtimeFactory = options.runtime ?? Atom.runtime
|
|
154
156
|
self.runtime = runtimeFactory(self.layer)
|
|
155
157
|
|
|
156
|
-
self.mutation = Atom.family(<Tag extends Rpc.Tag<Rpcs>>(tag: Tag) =>
|
|
157
|
-
|
|
158
|
+
self.mutation = Atom.family(<Tag extends Rpc.Tag<Rpcs>>(tag: Tag) => {
|
|
159
|
+
const rpc = options.group.requests.get(tag)! as any as Rpc.AnyWithProps
|
|
160
|
+
return self.runtime.fn<{
|
|
158
161
|
readonly payload: Rpc.PayloadConstructor<Rpc.ExtractTag<Rpcs, Tag>>
|
|
159
162
|
readonly reactivityKeys?:
|
|
160
163
|
| ReadonlyArray<unknown>
|
|
@@ -169,13 +172,23 @@ export const Service = <Self>() =>
|
|
|
169
172
|
? Reactivity.mutation(effect, reactivityKeys)
|
|
170
173
|
: effect
|
|
171
174
|
}) as any
|
|
175
|
+
).pipe(
|
|
176
|
+
Atom.serializable({
|
|
177
|
+
key: `AtomRpc:mutation:${tag}`,
|
|
178
|
+
schema: AsyncResult.Schema({
|
|
179
|
+
success: rpc.successSchema,
|
|
180
|
+
error: makeErrorSchema(rpc)
|
|
181
|
+
}) as any
|
|
182
|
+
})
|
|
172
183
|
)
|
|
173
|
-
) as any
|
|
184
|
+
}) as any
|
|
174
185
|
|
|
175
186
|
const queryFamily = Atom.family(
|
|
176
|
-
(
|
|
187
|
+
(key: QueryKey) => {
|
|
188
|
+
const { headers, payload, reactivityKeys, tag, timeToLive } = key
|
|
177
189
|
const rpc = options.group.requests.get(tag)! as any as Rpc.AnyWithProps
|
|
178
|
-
|
|
190
|
+
const isStream = RpcSchema.isStreamSchema(rpc.successSchema)
|
|
191
|
+
let atom = isStream
|
|
179
192
|
? self.runtime.pull(
|
|
180
193
|
Stream.unwrap(
|
|
181
194
|
self.use((client) =>
|
|
@@ -188,6 +201,15 @@ export const Service = <Self>() =>
|
|
|
188
201
|
: self.runtime.atom(
|
|
189
202
|
self.use((client) => client(tag, payload, { headers } as any)) as any
|
|
190
203
|
)
|
|
204
|
+
if (!isStream) {
|
|
205
|
+
atom = Atom.serializable(atom, {
|
|
206
|
+
key: makeSerializableKey(key),
|
|
207
|
+
schema: AsyncResult.Schema({
|
|
208
|
+
success: rpc.successSchema,
|
|
209
|
+
error: makeErrorSchema(rpc)
|
|
210
|
+
}) as any
|
|
211
|
+
})
|
|
212
|
+
}
|
|
191
213
|
if (timeToLive) {
|
|
192
214
|
atom = Duration.isFinite(timeToLive)
|
|
193
215
|
? Atom.setIdleTTL(atom, timeToLive)
|
|
@@ -223,7 +245,7 @@ export const Service = <Self>() =>
|
|
|
223
245
|
: undefined
|
|
224
246
|
}) as any
|
|
225
247
|
|
|
226
|
-
return self as AtomRpcClient<Self, Id, Rpcs
|
|
248
|
+
return self as AtomRpcClient<Self, Id, Rpcs>
|
|
227
249
|
}
|
|
228
250
|
|
|
229
251
|
interface QueryKey {
|
|
@@ -236,3 +258,12 @@ interface QueryKey {
|
|
|
236
258
|
| undefined
|
|
237
259
|
timeToLive?: Duration.Duration | undefined
|
|
238
260
|
}
|
|
261
|
+
|
|
262
|
+
const makeErrorSchema = (rpc: Rpc.AnyWithProps): Schema.Top =>
|
|
263
|
+
Schema.Union([
|
|
264
|
+
rpc.errorSchema,
|
|
265
|
+
...Array.from(rpc.middlewares, (middleware) => middleware.error),
|
|
266
|
+
RpcClientError
|
|
267
|
+
])
|
|
268
|
+
|
|
269
|
+
const makeSerializableKey = (key: QueryKey): string => `AtomRpc:${key.tag}:${Hash.hash(key)}`
|
package/src/unstable/rpc/Rpc.ts
CHANGED
|
@@ -406,9 +406,7 @@ export type MiddlewareClient<R> = R extends Rpc<
|
|
|
406
406
|
infer _Error,
|
|
407
407
|
infer _Middleware,
|
|
408
408
|
infer _Requires
|
|
409
|
-
> ?
|
|
410
|
-
_Middleware extends { readonly requiredForClient: true }
|
|
411
|
-
? RpcMiddleware.ForClient<ServiceMap.Service.Identifier<_Middleware>>
|
|
409
|
+
> ? _Middleware extends { readonly requiredForClient: true } ? RpcMiddleware.ForClient<_Middleware["Identifier"]>
|
|
412
410
|
: never
|
|
413
411
|
: never
|
|
414
412
|
|
|
@@ -109,7 +109,8 @@ export interface ServiceClass<
|
|
|
109
109
|
Provides,
|
|
110
110
|
E extends Schema.Top,
|
|
111
111
|
ClientError,
|
|
112
|
-
Requires
|
|
112
|
+
Requires,
|
|
113
|
+
RequiredForClient extends boolean
|
|
113
114
|
> extends ServiceMap.Service<Self, RpcMiddleware<Provides, E["Type"], Requires>> {
|
|
114
115
|
new(_: never): ServiceMap.ServiceClass.Shape<Name, RpcMiddleware<Provides, E["Type"], Requires>> & {
|
|
115
116
|
readonly [TypeId]: {
|
|
@@ -121,7 +122,7 @@ export interface ServiceClass<
|
|
|
121
122
|
}
|
|
122
123
|
readonly [TypeId]: typeof TypeId
|
|
123
124
|
readonly error: E
|
|
124
|
-
readonly requiredForClient:
|
|
125
|
+
readonly requiredForClient: RequiredForClient
|
|
125
126
|
readonly "~ClientError": ClientError
|
|
126
127
|
}
|
|
127
128
|
|
|
@@ -201,16 +202,20 @@ export const Service = <
|
|
|
201
202
|
requires?: any
|
|
202
203
|
provides?: any
|
|
203
204
|
clientError?: any
|
|
204
|
-
} = {
|
|
205
|
+
} = {
|
|
206
|
+
requires: never
|
|
207
|
+
provides: never
|
|
208
|
+
clientError: never
|
|
209
|
+
}
|
|
205
210
|
>(): <
|
|
206
211
|
const Name extends string,
|
|
207
212
|
Error extends Schema.Top = Schema.Never,
|
|
208
|
-
RequiredForClient extends boolean = false
|
|
213
|
+
const RequiredForClient extends boolean = false
|
|
209
214
|
>(
|
|
210
215
|
id: Name,
|
|
211
216
|
options?: {
|
|
212
217
|
readonly error?: Error | undefined
|
|
213
|
-
readonly requiredForClient
|
|
218
|
+
readonly requiredForClient?: RequiredForClient | undefined
|
|
214
219
|
} | undefined
|
|
215
220
|
) => ServiceClass<
|
|
216
221
|
Self,
|
|
@@ -218,7 +223,8 @@ export const Service = <
|
|
|
218
223
|
"provides" extends keyof Config ? Config["provides"] : never,
|
|
219
224
|
Error,
|
|
220
225
|
"clientError" extends keyof Config ? Config["clientError"] : never,
|
|
221
|
-
"requires" extends keyof Config ? Config["requires"] : never
|
|
226
|
+
"requires" extends keyof Config ? Config["requires"] : never,
|
|
227
|
+
RequiredForClient
|
|
222
228
|
> =>
|
|
223
229
|
(
|
|
224
230
|
id: string,
|
|
@@ -305,7 +305,7 @@ export const makeNoSerialization: <Rpcs extends Rpc.Any>(
|
|
|
305
305
|
effect = concurrencySemaphore.withPermits(1)(effect)
|
|
306
306
|
}
|
|
307
307
|
const serviceMap = new Map(entry.services.mapUnsafe)
|
|
308
|
-
|
|
308
|
+
requestFiber.services.mapUnsafe.forEach((value, key) => serviceMap.set(key, value))
|
|
309
309
|
serviceMap.set(Scope.Scope.key, scope)
|
|
310
310
|
const runFork = Effect.runForkWith(ServiceMap.makeUnsafe(serviceMap))
|
|
311
311
|
const fiber = trackFiber(
|
|
@@ -1181,7 +1181,7 @@ export const makeProtocolStdio = Effect.gen(function*() {
|
|
|
1181
1181
|
)
|
|
1182
1182
|
|
|
1183
1183
|
yield* Stream.fromQueue(queue).pipe(
|
|
1184
|
-
Stream.run(stdio.stdout),
|
|
1184
|
+
Stream.run(stdio.stdout()),
|
|
1185
1185
|
Effect.retry(Schedule.spaced(500)),
|
|
1186
1186
|
Effect.forkScoped
|
|
1187
1187
|
)
|
|
@@ -301,6 +301,37 @@ export const FieldOption: <Field extends VariantSchema.Field<any> | Schema.Top>(
|
|
|
301
301
|
jsonUpdate: optionalOption
|
|
302
302
|
}) as any
|
|
303
303
|
|
|
304
|
+
/**
|
|
305
|
+
* @since 4.0.0
|
|
306
|
+
* @category booleans
|
|
307
|
+
*/
|
|
308
|
+
export interface BooleanSqlite extends
|
|
309
|
+
VariantSchema.Field<{
|
|
310
|
+
readonly select: Schema.BooleanFromBit
|
|
311
|
+
readonly insert: Schema.BooleanFromBit
|
|
312
|
+
readonly update: Schema.BooleanFromBit
|
|
313
|
+
readonly json: Schema.Boolean
|
|
314
|
+
readonly jsonCreate: Schema.Boolean
|
|
315
|
+
readonly jsonUpdate: Schema.Boolean
|
|
316
|
+
}>
|
|
317
|
+
{}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* A schema for sqlite booleans that are represented as `0 | 1` in database
|
|
321
|
+
* variants and `boolean` in JSON variants.
|
|
322
|
+
*
|
|
323
|
+
* @since 4.0.0
|
|
324
|
+
* @category booleans
|
|
325
|
+
*/
|
|
326
|
+
export const BooleanSqlite: BooleanSqlite = Field({
|
|
327
|
+
select: Schema.BooleanFromBit,
|
|
328
|
+
insert: Schema.BooleanFromBit,
|
|
329
|
+
update: Schema.BooleanFromBit,
|
|
330
|
+
json: Schema.Boolean,
|
|
331
|
+
jsonCreate: Schema.Boolean,
|
|
332
|
+
jsonUpdate: Schema.Boolean
|
|
333
|
+
})
|
|
334
|
+
|
|
304
335
|
/**
|
|
305
336
|
* @since 4.0.0
|
|
306
337
|
* @category date & time
|
|
@@ -57,9 +57,9 @@ export const request: {
|
|
|
57
57
|
} = function() {
|
|
58
58
|
if (arguments.length === 1) {
|
|
59
59
|
const resolver = arguments[0]
|
|
60
|
-
return (payload: any) => Effect.request(SqlRequest(payload),
|
|
60
|
+
return (payload: any) => Effect.request(SqlRequest(payload), resolver)
|
|
61
61
|
}
|
|
62
|
-
return Effect.request(SqlRequest(arguments[0]),
|
|
62
|
+
return Effect.request(SqlRequest(arguments[0]), arguments[1])
|
|
63
63
|
} as any
|
|
64
64
|
|
|
65
65
|
/**
|