@livestore/common-cf 0.4.0 → 0.5.0-dev.0
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/.tsbuildinfo +1 -1
- package/dist/declare/cf-declare.d.ts +1 -21
- package/dist/declare/cf-declare.d.ts.map +1 -1
- package/dist/do-rpc/client.d.ts.map +1 -1
- package/dist/do-rpc/client.js +17 -27
- package/dist/do-rpc/client.js.map +1 -1
- package/dist/do-rpc/client.test.d.ts +2 -0
- package/dist/do-rpc/client.test.d.ts.map +1 -0
- package/dist/do-rpc/client.test.js +99 -0
- package/dist/do-rpc/client.test.js.map +1 -0
- package/dist/do-rpc/rpc.test.js +25 -57
- package/dist/do-rpc/rpc.test.js.map +1 -1
- package/dist/do-rpc/server.d.ts +9 -4
- package/dist/do-rpc/server.d.ts.map +1 -1
- package/dist/do-rpc/server.js +84 -43
- package/dist/do-rpc/server.js.map +1 -1
- package/dist/do-rpc/test-fixtures/rpc-schema.d.ts +27 -27
- package/dist/do-rpc/test-fixtures/rpc-schema.js +11 -11
- package/dist/do-rpc/test-fixtures/worker.d.ts.map +1 -1
- package/dist/do-rpc/test-fixtures/worker.js +9 -9
- package/dist/do-rpc/test-fixtures/worker.js.map +1 -1
- package/dist/ws-rpc/test-fixtures/rpc-schema.d.ts +27 -27
- package/dist/ws-rpc/test-fixtures/rpc-schema.js +9 -9
- package/dist/ws-rpc/ws-rpc-server.d.ts +6 -5
- package/dist/ws-rpc/ws-rpc-server.d.ts.map +1 -1
- package/dist/ws-rpc/ws-rpc-server.js +17 -17
- package/dist/ws-rpc/ws-rpc-server.js.map +1 -1
- package/dist/ws-rpc/ws-rpc.test.js +27 -59
- package/dist/ws-rpc/ws-rpc.test.js.map +1 -1
- package/package.json +11 -20
- package/src/declare/cf-declare.ts +1 -1
- package/src/do-rpc/client.test.ts +122 -0
- package/src/do-rpc/client.ts +21 -31
- package/src/do-rpc/rpc.test.ts +29 -59
- package/src/do-rpc/server.ts +119 -54
- package/src/do-rpc/test-fixtures/rpc-schema.ts +11 -11
- package/src/do-rpc/test-fixtures/worker.ts +9 -12
- package/src/ws-rpc/test-fixtures/rpc-schema.ts +9 -9
- package/src/ws-rpc/ws-rpc-server.ts +37 -28
- package/src/ws-rpc/ws-rpc.test.ts +31 -61
package/dist/do-rpc/server.js
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Effect, Exit, Headers, Option, Rpc, RpcMessage, RpcSchema, RpcSerialization, Result, Schema, SchemaIssue, Stream, } from '@livestore/utils/effect';
|
|
2
|
+
/**
|
|
3
|
+
* The erased dynamic RPC schemas (`Rpc.exitSchema(...) as Schema.Top`, `rpc.payloadSchema`) are
|
|
4
|
+
* plain data — they need NO decoding/encoding services. `Schema.Top` types those service channels
|
|
5
|
+
* as `unknown`, which surfaces as `unknown` in the requirements channel of `encode/decodeUnknownEffect`
|
|
6
|
+
* (anyUnknownInErrorContext / TS377030). Assert the true `never` services in ONE place.
|
|
7
|
+
*
|
|
8
|
+
* TODO(effect): revisit if a cleaner/idiomatic API lands — https://github.com/Effect-TS/effect/issues/6489
|
|
9
|
+
*/
|
|
10
|
+
const erasedJsonCodec = (schema) =>
|
|
11
|
+
// oxlint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- erased RPC data schemas require no codec services
|
|
12
|
+
Schema.toCodecJson(schema);
|
|
2
13
|
/**
|
|
3
14
|
* Construct a Durable Object RPC handler from an `RpcGroup`.
|
|
4
15
|
* This is the DO equivalent of `RpcServer.toWebHandler`.
|
|
5
16
|
*/
|
|
6
17
|
export const toDurableObjectHandler = (group, options) => (serializedPayload) => Effect.gen(function* () {
|
|
7
|
-
const parser = RpcSerialization.msgPack.
|
|
18
|
+
const parser = RpcSerialization.msgPack.makeUnsafe();
|
|
8
19
|
// Decode incoming requests - client sends array of requests
|
|
9
20
|
const decoded = parser.decode(serializedPayload);
|
|
10
21
|
// Handle potential nested array from client serialization
|
|
@@ -28,41 +39,60 @@ export const toDurableObjectHandler = (group, options) => (serializedPayload) =>
|
|
|
28
39
|
if (request._tag !== 'Request') {
|
|
29
40
|
continue;
|
|
30
41
|
}
|
|
42
|
+
const requestId = RpcMessage.RequestId(request.id);
|
|
31
43
|
// Find the RPC handler
|
|
32
44
|
// oxlint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- RpcGroup.requests map returns Rpc.Any; narrowing to AnyWithProps for property access
|
|
33
45
|
const rpc = group.requests.get(request.tag);
|
|
34
|
-
// oxlint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- context.
|
|
35
|
-
const entry = context.
|
|
46
|
+
// oxlint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- context.mapUnsafe dynamic lookup; type safety ensured by RpcGroup registration
|
|
47
|
+
const entry = context.mapUnsafe.get(rpc.key);
|
|
36
48
|
if (rpc == null || entry == null) {
|
|
37
49
|
responses.push({
|
|
38
50
|
_tag: 'Exit',
|
|
39
|
-
requestId
|
|
51
|
+
requestId,
|
|
40
52
|
exit: Exit.die(`Unknown request tag: ${request.tag}`),
|
|
41
53
|
});
|
|
42
54
|
continue;
|
|
43
55
|
}
|
|
56
|
+
const payloadResult = yield* Schema.decodeUnknownEffect(erasedJsonCodec(rpc.payloadSchema))(request.payload).pipe(Effect.provideContext(entry.context), Effect.result);
|
|
57
|
+
if (Result.isFailure(payloadResult) === true) {
|
|
58
|
+
// Request payloads are encoded with the JSON codec by Effect's RPC client. Decode them
|
|
59
|
+
// before dispatch so JSON-only representations such as `null` become their schema values.
|
|
60
|
+
// oxlint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- Rpc.exitSchema requires AnyWithProps; type narrowing already done above
|
|
61
|
+
const exitSchema = Rpc.exitSchema(rpc);
|
|
62
|
+
const rawExit = Exit.die(SchemaIssue.makeFormatterDefault()(payloadResult.failure.issue));
|
|
63
|
+
const encodedExit = yield* Schema.encodeUnknownEffect(erasedJsonCodec(exitSchema))(rawExit).pipe(Effect.provideContext(entry.context));
|
|
64
|
+
responses.push({
|
|
65
|
+
_tag: 'Exit',
|
|
66
|
+
requestId,
|
|
67
|
+
exit: encodedExit,
|
|
68
|
+
});
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
const payload = payloadResult.success;
|
|
44
72
|
// Check if this is a streaming RPC
|
|
45
|
-
// oxlint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- Rpc.Handler doesn't expose successSchema publicly; see https://github.com/Effect-TS/effect/issues/6064
|
|
46
73
|
const isStream = RpcSchema.isStreamSchema(rpc.successSchema);
|
|
47
74
|
// For streaming RPCs with only one request, return ReadableStream directly
|
|
48
75
|
if (isStream === true && requests.length === 1) {
|
|
49
|
-
return yield* createStreamingResponse(rpc, entry,
|
|
76
|
+
return yield* createStreamingResponse(rpc, entry, requestId, payload, parser, options.layer);
|
|
50
77
|
}
|
|
51
78
|
// Execute the handler
|
|
52
79
|
const result = yield* Effect.gen(function* () {
|
|
53
|
-
const handlerResult = entry.handler(
|
|
54
|
-
|
|
80
|
+
const handlerResult = entry.handler(payload, {
|
|
81
|
+
client: new Rpc.ServerClient(0), // TODO: add proper clientId if needed
|
|
82
|
+
requestId,
|
|
55
83
|
headers: Headers.fromInput({
|
|
56
|
-
'x-rpc-request-id':
|
|
84
|
+
'x-rpc-request-id': requestId.toString(),
|
|
57
85
|
}),
|
|
86
|
+
rpc,
|
|
58
87
|
});
|
|
88
|
+
const effectOrStream = Rpc.isWrapper(handlerResult) === true ? handlerResult.value : handlerResult;
|
|
59
89
|
let value;
|
|
60
|
-
if (Effect.isEffect(
|
|
90
|
+
if (Effect.isEffect(effectOrStream) === true) {
|
|
61
91
|
// @effect-diagnostics-next-line anyUnknownInErrorContext:off -- `Rpc.Handler.handler` returns `Effect<any, any>` due to dynamic dispatch
|
|
62
|
-
value = yield*
|
|
92
|
+
value = yield* effectOrStream;
|
|
63
93
|
}
|
|
64
94
|
else {
|
|
65
|
-
value =
|
|
95
|
+
value = effectOrStream;
|
|
66
96
|
}
|
|
67
97
|
// Get the exit schema for this RPC
|
|
68
98
|
// oxlint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- Rpc.exitSchema requires AnyWithProps; type narrowing already done above
|
|
@@ -71,7 +101,7 @@ export const toDurableObjectHandler = (group, options) => (serializedPayload) =>
|
|
|
71
101
|
if (exitSchema !== undefined) {
|
|
72
102
|
// Use schema encoding for proper serialization
|
|
73
103
|
const rawExit = Exit.succeed(value);
|
|
74
|
-
encodedExit = yield* Schema.
|
|
104
|
+
encodedExit = yield* Schema.encodeUnknownEffect(erasedJsonCodec(exitSchema))(rawExit);
|
|
75
105
|
}
|
|
76
106
|
else {
|
|
77
107
|
// Fallback to direct exit
|
|
@@ -79,10 +109,10 @@ export const toDurableObjectHandler = (group, options) => (serializedPayload) =>
|
|
|
79
109
|
}
|
|
80
110
|
return {
|
|
81
111
|
_tag: 'Exit',
|
|
82
|
-
requestId
|
|
112
|
+
requestId,
|
|
83
113
|
exit: encodedExit,
|
|
84
114
|
};
|
|
85
|
-
}).pipe(Effect.
|
|
115
|
+
}).pipe(Effect.catchCause((cause) => {
|
|
86
116
|
// Get the exit schema for this RPC
|
|
87
117
|
// oxlint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- Rpc.exitSchema requires AnyWithProps; type narrowing already done above
|
|
88
118
|
const exitSchema = Rpc.exitSchema(rpc);
|
|
@@ -91,7 +121,7 @@ export const toDurableObjectHandler = (group, options) => (serializedPayload) =>
|
|
|
91
121
|
if (exitSchema !== undefined) {
|
|
92
122
|
// Use schema encoding for proper serialization
|
|
93
123
|
const rawExit = Exit.failCause(cause);
|
|
94
|
-
encodedExit = yield* Schema.
|
|
124
|
+
encodedExit = yield* Schema.encodeUnknownEffect(erasedJsonCodec(exitSchema))(rawExit);
|
|
95
125
|
}
|
|
96
126
|
else {
|
|
97
127
|
// Fallback to direct exit
|
|
@@ -99,7 +129,7 @@ export const toDurableObjectHandler = (group, options) => (serializedPayload) =>
|
|
|
99
129
|
}
|
|
100
130
|
return {
|
|
101
131
|
_tag: 'Exit',
|
|
102
|
-
requestId
|
|
132
|
+
requestId,
|
|
103
133
|
exit: encodedExit,
|
|
104
134
|
};
|
|
105
135
|
});
|
|
@@ -111,7 +141,7 @@ export const toDurableObjectHandler = (group, options) => (serializedPayload) =>
|
|
|
111
141
|
return encoded;
|
|
112
142
|
}).pipe(Effect.provide(options.layer), Effect.scoped, Effect.orDie);
|
|
113
143
|
/** Out-of-band RPC stream response emission back to the caller DO */
|
|
114
|
-
export const emitStreamResponse = Effect.fn('do-rpc/emitStreamResponse')(function* ({ callerContext, env, requestId, values, }) {
|
|
144
|
+
export const emitStreamResponse = Effect.fn('do-rpc/emitStreamResponse')(function* ({ callerContext, env, requestId, storeId, values, }) {
|
|
115
145
|
// oxlint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- CF worker env bindings are typed as Record<string, any>; narrowing to known DO namespace
|
|
116
146
|
const clientDoNamespace = env[callerContext.bindingName];
|
|
117
147
|
if (clientDoNamespace === undefined) {
|
|
@@ -119,45 +149,56 @@ export const emitStreamResponse = Effect.fn('do-rpc/emitStreamResponse')(functio
|
|
|
119
149
|
}
|
|
120
150
|
const clientDo = clientDoNamespace.get(clientDoNamespace.idFromString(callerContext.durableObjectId));
|
|
121
151
|
const res = { _tag: 'Chunk', requestId, values };
|
|
122
|
-
|
|
152
|
+
const parser = RpcSerialization.msgPack.makeUnsafe();
|
|
153
|
+
// Native Cloudflare RPC rejects schema values with custom prototypes. Keep the callback
|
|
154
|
+
// boundary clone-safe by sending the already-encoded Effect RPC message as bytes.
|
|
155
|
+
// oxlint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- msgPack parser.encode returns unknown; the encoded result is a byte payload
|
|
156
|
+
const serializedRes = parser.encode(res);
|
|
157
|
+
yield* Effect.tryPromise(() => clientDo.syncUpdateRpc(serializedRes, storeId));
|
|
123
158
|
});
|
|
124
159
|
/**
|
|
125
160
|
* Creates a ReadableStream response for streaming RPCs.
|
|
126
161
|
* This converts an Effect Stream into a ReadableStream of serialized RPC messages.
|
|
127
162
|
*/
|
|
128
|
-
const createStreamingResponse = (rpc, entry,
|
|
163
|
+
const createStreamingResponse = (rpc, entry, requestId, payload, parser, layer) => Effect.gen(function* () {
|
|
129
164
|
// Execute the handler to get the stream
|
|
130
|
-
const handlerResult = entry.handler(
|
|
131
|
-
|
|
165
|
+
const handlerResult = entry.handler(payload, {
|
|
166
|
+
client: new Rpc.ServerClient(0), // TODO: add proper clientId if needed
|
|
167
|
+
requestId,
|
|
132
168
|
headers: Headers.fromInput({
|
|
133
|
-
'x-rpc-request-id':
|
|
169
|
+
'x-rpc-request-id': requestId.toString(),
|
|
134
170
|
}),
|
|
171
|
+
rpc,
|
|
135
172
|
});
|
|
136
|
-
|
|
137
|
-
const stream =
|
|
173
|
+
const effectOrStream = Rpc.isWrapper(handlerResult) === true ? handlerResult.value : handlerResult;
|
|
174
|
+
const stream =
|
|
175
|
+
// @effect-diagnostics-next-line anyUnknownInErrorContext:off -- `Rpc.Handler.handler` returns `Effect<any, any>` due to dynamic dispatch; orDie converts the error to a defect handled by the downstream catchCause
|
|
176
|
+
Effect.isEffect(effectOrStream) === true ? yield* Effect.orDie(effectOrStream) : effectOrStream;
|
|
138
177
|
// Get the stream schemas for proper chunk-level encoding
|
|
139
178
|
// oxlint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- Rpc.Handler doesn't expose successSchema publicly; see https://github.com/Effect-TS/effect/issues/6064
|
|
140
|
-
const streamSchemas = RpcSchema.
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
179
|
+
const streamSchemas = RpcSchema.isStreamSchema(rpc.successSchema) === true
|
|
180
|
+
? Option.some({
|
|
181
|
+
success: rpc.successSchema.success,
|
|
182
|
+
error: rpc.successSchema.error,
|
|
183
|
+
})
|
|
184
|
+
: Option.none();
|
|
185
|
+
const arrayEncoder = Option.isSome(streamSchemas) === true
|
|
186
|
+
? Schema.encodeUnknownEffect(Schema.toCodecJson(Schema.Array(streamSchemas.value.success)))
|
|
187
|
+
: Schema.encodeUnknownEffect(Schema.toCodecJson(Schema.Array(Schema.Any)));
|
|
146
188
|
// Convert stream to ReadableStream
|
|
147
189
|
const readableStream = new ReadableStream({
|
|
148
190
|
start(controller) {
|
|
149
191
|
// Run the stream and send chunks + final exit
|
|
150
192
|
const runStream = Effect.gen(function* () {
|
|
151
193
|
// Process stream chunks - let chunk encoder handle Effect objects properly
|
|
152
|
-
yield* Stream.
|
|
153
|
-
|
|
154
|
-
if (chunkArray.length === 0)
|
|
194
|
+
yield* Stream.runForEachArray(stream, (array) => Effect.gen(function* () {
|
|
195
|
+
if (array.length === 0)
|
|
155
196
|
return;
|
|
156
197
|
// Encode the chunk using the proper chunk encoder (like official RPC)
|
|
157
|
-
const encodedValues = yield*
|
|
198
|
+
const encodedValues = yield* arrayEncoder(array);
|
|
158
199
|
const chunkMessage = {
|
|
159
200
|
_tag: 'Chunk',
|
|
160
|
-
requestId
|
|
201
|
+
requestId,
|
|
161
202
|
values: encodedValues,
|
|
162
203
|
};
|
|
163
204
|
// oxlint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- msgPack parser.encode returns unknown; cast to expected wire format
|
|
@@ -168,25 +209,25 @@ const createStreamingResponse = (rpc, entry, request, parser, layer) => Effect.g
|
|
|
168
209
|
const rawExit = Exit.void;
|
|
169
210
|
// oxlint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- Rpc.exitSchema requires AnyWithProps; type narrowing already done above
|
|
170
211
|
const exitSchema = Rpc.exitSchema(rpc);
|
|
171
|
-
const encodedExit = yield* Schema.
|
|
212
|
+
const encodedExit = yield* Schema.encodeUnknownEffect(erasedJsonCodec(exitSchema))(rawExit);
|
|
172
213
|
const exitMessage = {
|
|
173
214
|
_tag: 'Exit',
|
|
174
|
-
requestId
|
|
215
|
+
requestId,
|
|
175
216
|
exit: encodedExit,
|
|
176
217
|
};
|
|
177
218
|
// oxlint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- msgPack parser.encode returns unknown; cast to expected wire format
|
|
178
219
|
const exitSerialized = parser.encode([exitMessage]);
|
|
179
220
|
controller.enqueue(exitSerialized);
|
|
180
221
|
controller.close();
|
|
181
|
-
}).pipe(Effect.
|
|
222
|
+
}).pipe(Effect.catchCause((cause) => Effect.gen(function* () {
|
|
182
223
|
// Send error exit with proper schema encoding
|
|
183
224
|
const rawExit = Exit.failCause(cause);
|
|
184
225
|
// oxlint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- Rpc.exitSchema requires AnyWithProps; type narrowing already done above
|
|
185
226
|
const exitSchema = Rpc.exitSchema(rpc);
|
|
186
|
-
const encodedExit = yield* Schema.
|
|
227
|
+
const encodedExit = yield* Schema.encodeUnknownEffect(erasedJsonCodec(exitSchema))(rawExit);
|
|
187
228
|
const exitMessage = {
|
|
188
229
|
_tag: 'Exit',
|
|
189
|
-
requestId
|
|
230
|
+
requestId,
|
|
190
231
|
exit: encodedExit,
|
|
191
232
|
};
|
|
192
233
|
// oxlint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- msgPack parser.encode returns unknown; cast to expected wire format
|
|
@@ -195,7 +236,7 @@ const createStreamingResponse = (rpc, entry, request, parser, layer) => Effect.g
|
|
|
195
236
|
controller.close();
|
|
196
237
|
})));
|
|
197
238
|
// Run the stream processing
|
|
198
|
-
runStream.pipe(Effect.provide(layer), Effect.scoped, Effect.tapCauseLogPretty, Effect.runPromise);
|
|
239
|
+
runStream.pipe(Effect.provide(layer), Effect.scoped, Effect.tapCauseLogPretty, (_) => _, Effect.runPromise);
|
|
199
240
|
},
|
|
200
241
|
// oxlint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- bridging standard Web API ReadableStream to Cloudflare Worker ReadableStream type
|
|
201
242
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/do-rpc/server.ts"],"names":[],"mappings":"AAAA,OA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ACT,IAAI,EAAE,WAAW;iBAClB,CAAA;gBAED,8IAA8I;gBAC9I,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAA4B,CAAA;gBAC9E,UAAU,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;gBAClC,UAAU,CAAC,KAAK,EAAE,CAAA;YACpB,CAAC,CAAC,CACH,CACF,CAAA;YAED,4BAA4B;YAC5B,SAAS,CAAC,IAAI,CACZ,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EACrB,MAAM,CAAC,MAAM,EACb,MAAM,CAAC,iBAAiB,EACxB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAwB,EAC/B,MAAM,CAAC,UAAU,CAClB,CAAA;QACH,CAAC;QACD,4JAA4J;KAC7J,CAAkC,CAAA;IAEnC,kFAAkF;IAElF,OAAO,cAAc,CAAA;AACvB,CAAC,CAAC,CAAA"}
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import { Rpc, RpcGroup, Schema } from '@livestore/utils/effect';
|
|
2
2
|
declare const TestRpcs_base: RpcGroup.RpcGroup<Rpc.Rpc<"Ping", Schema.Struct<{
|
|
3
|
-
message:
|
|
3
|
+
readonly message: Schema.String;
|
|
4
4
|
}>, Schema.Struct<{
|
|
5
|
-
response:
|
|
6
|
-
}>,
|
|
7
|
-
text:
|
|
5
|
+
readonly response: Schema.String;
|
|
6
|
+
}>, Schema.Never, never, never> | Rpc.Rpc<"Echo", Schema.Struct<{
|
|
7
|
+
readonly text: Schema.String;
|
|
8
8
|
}>, Schema.Struct<{
|
|
9
|
-
echo:
|
|
10
|
-
}>,
|
|
11
|
-
a:
|
|
12
|
-
b:
|
|
9
|
+
readonly echo: Schema.String;
|
|
10
|
+
}>, Schema.Never, never, never> | Rpc.Rpc<"Add", Schema.Struct<{
|
|
11
|
+
readonly a: Schema.Finite;
|
|
12
|
+
readonly b: Schema.Finite;
|
|
13
13
|
}>, Schema.Struct<{
|
|
14
|
-
result:
|
|
15
|
-
}>,
|
|
16
|
-
message:
|
|
14
|
+
readonly result: Schema.Finite;
|
|
15
|
+
}>, Schema.Never, never, never> | Rpc.Rpc<"Defect", Schema.Struct<{
|
|
16
|
+
readonly message: Schema.String;
|
|
17
17
|
}>, Schema.Struct<{
|
|
18
|
-
never:
|
|
19
|
-
}>,
|
|
20
|
-
message:
|
|
18
|
+
readonly never: Schema.String;
|
|
19
|
+
}>, Schema.Never, never, never> | Rpc.Rpc<"Fail", Schema.Struct<{
|
|
20
|
+
readonly message: Schema.String;
|
|
21
21
|
}>, Schema.Struct<{
|
|
22
|
-
never:
|
|
23
|
-
}>,
|
|
24
|
-
maybeNumber: Schema.Option<
|
|
25
|
-
}>,
|
|
26
|
-
count:
|
|
27
|
-
errorAfter:
|
|
28
|
-
}>, import("
|
|
29
|
-
count:
|
|
30
|
-
defectAfter:
|
|
31
|
-
}>, import("
|
|
32
|
-
delay:
|
|
33
|
-
interruptAfterCount:
|
|
34
|
-
}>, import("
|
|
22
|
+
readonly never: Schema.String;
|
|
23
|
+
}>, Schema.String, never, never> | Rpc.Rpc<"Stream", Schema.Struct<{}>, import("effect/unstable/rpc/RpcSchema").Stream<Schema.Struct<{
|
|
24
|
+
readonly maybeNumber: Schema.Option<Schema.Finite>;
|
|
25
|
+
}>, Schema.Never>, Schema.Never, never, never> | Rpc.Rpc<"StreamError", Schema.Struct<{
|
|
26
|
+
readonly count: Schema.Finite;
|
|
27
|
+
readonly errorAfter: Schema.Finite;
|
|
28
|
+
}>, import("effect/unstable/rpc/RpcSchema").Stream<Schema.Finite, Schema.String>, Schema.Never, never, never> | Rpc.Rpc<"StreamDefect", Schema.Struct<{
|
|
29
|
+
readonly count: Schema.Finite;
|
|
30
|
+
readonly defectAfter: Schema.Finite;
|
|
31
|
+
}>, import("effect/unstable/rpc/RpcSchema").Stream<Schema.Finite, Schema.Never>, Schema.Never, never, never> | Rpc.Rpc<"StreamInterruptible", Schema.Struct<{
|
|
32
|
+
readonly delay: Schema.Finite;
|
|
33
|
+
readonly interruptAfterCount: Schema.Finite;
|
|
34
|
+
}>, import("effect/unstable/rpc/RpcSchema").Stream<Schema.Finite, Schema.Never>, Schema.Never, never, never> | Rpc.Rpc<"StreamBugScenarioDoServer", Schema.Struct<{}>, import("effect/unstable/rpc/RpcSchema").Stream<Schema.Finite, Schema.Never>, Schema.Never, never, never> | Rpc.Rpc<"StreamBugScenarioDoClient", Schema.Struct<{}>, Schema.Finite, Schema.Never, never, never>>;
|
|
35
35
|
export declare class TestRpcs extends TestRpcs_base {
|
|
36
36
|
}
|
|
37
37
|
export type TestRpcsI = RpcGroup.Rpcs<typeof TestRpcs>;
|
|
@@ -6,8 +6,8 @@ export class TestRpcs extends RpcGroup.make(Rpc.make('Ping', {
|
|
|
6
6
|
payload: Schema.Struct({ text: Schema.String }),
|
|
7
7
|
success: Schema.Struct({ echo: Schema.String }),
|
|
8
8
|
}), Rpc.make('Add', {
|
|
9
|
-
payload: Schema.Struct({ a: Schema.
|
|
10
|
-
success: Schema.Struct({ result: Schema.
|
|
9
|
+
payload: Schema.Struct({ a: Schema.Finite, b: Schema.Finite }),
|
|
10
|
+
success: Schema.Struct({ result: Schema.Finite }),
|
|
11
11
|
}), Rpc.make('Defect', {
|
|
12
12
|
payload: Schema.Struct({ message: Schema.String }),
|
|
13
13
|
success: Schema.Struct({ never: Schema.String }),
|
|
@@ -18,29 +18,29 @@ export class TestRpcs extends RpcGroup.make(Rpc.make('Ping', {
|
|
|
18
18
|
}), Rpc.make('Stream', {
|
|
19
19
|
payload: Schema.Struct({}),
|
|
20
20
|
success: Schema.Struct({
|
|
21
|
-
maybeNumber: Schema.Option(Schema.
|
|
21
|
+
maybeNumber: Schema.Option(Schema.Finite),
|
|
22
22
|
}),
|
|
23
23
|
stream: true,
|
|
24
24
|
}), Rpc.make('StreamError', {
|
|
25
|
-
payload: Schema.Struct({ count: Schema.
|
|
26
|
-
success: Schema.
|
|
25
|
+
payload: Schema.Struct({ count: Schema.Finite, errorAfter: Schema.Finite }),
|
|
26
|
+
success: Schema.Finite,
|
|
27
27
|
error: Schema.String,
|
|
28
28
|
stream: true,
|
|
29
29
|
}), Rpc.make('StreamDefect', {
|
|
30
|
-
payload: Schema.Struct({ count: Schema.
|
|
31
|
-
success: Schema.
|
|
30
|
+
payload: Schema.Struct({ count: Schema.Finite, defectAfter: Schema.Finite }),
|
|
31
|
+
success: Schema.Finite,
|
|
32
32
|
stream: true,
|
|
33
33
|
}), Rpc.make('StreamInterruptible', {
|
|
34
|
-
payload: Schema.Struct({ delay: Schema.
|
|
35
|
-
success: Schema.
|
|
34
|
+
payload: Schema.Struct({ delay: Schema.Finite, interruptAfterCount: Schema.Finite }),
|
|
35
|
+
success: Schema.Finite,
|
|
36
36
|
stream: true,
|
|
37
37
|
}), Rpc.make('StreamBugScenarioDoServer', {
|
|
38
38
|
payload: Schema.Struct({}),
|
|
39
|
-
success: Schema.
|
|
39
|
+
success: Schema.Finite,
|
|
40
40
|
stream: true,
|
|
41
41
|
}), Rpc.make('StreamBugScenarioDoClient', {
|
|
42
42
|
payload: Schema.Struct({}),
|
|
43
|
-
success: Schema.
|
|
43
|
+
success: Schema.Finite,
|
|
44
44
|
})) {
|
|
45
45
|
}
|
|
46
46
|
//# sourceMappingURL=rpc-schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../../src/do-rpc/test-fixtures/worker.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAiBlD,MAAM,WAAW,GAAG;IAClB,WAAW,EAAE,sBAAsB,CAAC,oBAAoB,CAAC,CAAA;CAC1D;AAED,qBAAa,oBAAqB,SAAQ,aAAa;IAC5C,sBAAsB,EAA6B,KAAK,CAAA;IAE3D,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;CA4C9C;;mBAGsB,OAAO,OAAO,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC;;AAD5D,
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../../src/do-rpc/test-fixtures/worker.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAiBlD,MAAM,WAAW,GAAG;IAClB,WAAW,EAAE,sBAAsB,CAAC,oBAAoB,CAAC,CAAA;CAC1D;AAED,qBAAa,oBAAqB,SAAQ,aAAa;IAC5C,sBAAsB,EAA6B,KAAK,CAAA;IAE3D,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;CA4C9C;;mBAGsB,OAAO,OAAO,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC;;AAD5D,wBAuEC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="@cloudflare/workers-types" />
|
|
2
2
|
import { DurableObject } from 'cloudflare:workers';
|
|
3
3
|
import { layerProtocolDurableObject, toDurableObjectHandler } from '@livestore/common-cf';
|
|
4
|
-
import { Effect,
|
|
4
|
+
import { Effect, HttpEffect, Layer, Option, RpcClient, RpcSerialization, RpcServer, Schedule, Stream, } from '@livestore/utils/effect';
|
|
5
5
|
import { TestRpcs } from "./rpc-schema.js";
|
|
6
6
|
export class TestRpcDurableObject extends DurableObject {
|
|
7
7
|
__DURABLE_OBJECT_BRAND = 'TestRpcDurableObject';
|
|
@@ -32,7 +32,7 @@ export default {
|
|
|
32
32
|
try {
|
|
33
33
|
const url = new URL(request.url);
|
|
34
34
|
// Handle HTTP RPC endpoint
|
|
35
|
-
if (url.pathname === '/rpc') {
|
|
35
|
+
if (url.pathname === '/rpc/') {
|
|
36
36
|
// Get the test server DO instance
|
|
37
37
|
const doId = env.TEST_RPC_DO.idFromName('test-server');
|
|
38
38
|
const serverDO = env.TEST_RPC_DO.get(doId);
|
|
@@ -56,16 +56,16 @@ export default {
|
|
|
56
56
|
StreamBugScenarioDoServer: () => Stream.die('never called'),
|
|
57
57
|
StreamBugScenarioDoClient: (msg) => doRpcClient.StreamBugScenarioDoServer(msg).pipe(Stream.tap(() => Effect.fail('doh')),
|
|
58
58
|
// observed behaviour: `log1` is still logged
|
|
59
|
-
Stream.
|
|
59
|
+
Stream.tapCause((cause) => Effect.log('log1', cause)), Stream.mapError((cause) => cause.toString()),
|
|
60
60
|
// observed behaviour: after this error mapping `log2` is never logged
|
|
61
|
-
Stream.
|
|
61
|
+
Stream.tapCause((cause) => Effect.log('log2', cause)), Stream.tapLogWithLabel('stream'), Stream.runCount, Effect.orDie,
|
|
62
62
|
// observed behaviour: `log3` is also never logged
|
|
63
|
-
Effect.
|
|
64
|
-
}).pipe(Layer.provideMerge(
|
|
65
|
-
// Create the HTTP RPC
|
|
66
|
-
const
|
|
63
|
+
Effect.tapCause((cause) => Effect.log('log3', cause))),
|
|
64
|
+
}).pipe(Layer.provideMerge(RpcSerialization.layerJson));
|
|
65
|
+
// Create the HTTP RPC effect
|
|
66
|
+
const httpEffect = yield* RpcServer.toHttpEffect(TestRpcs).pipe(Effect.provide(handlersLayer));
|
|
67
67
|
// Run the app and convert to web handler
|
|
68
|
-
const webHandler =
|
|
68
|
+
const webHandler = HttpEffect.toWebHandler(httpEffect);
|
|
69
69
|
return yield* Effect.promise(() => webHandler(request));
|
|
70
70
|
}).pipe(Effect.tapCauseLogPretty, Effect.scoped, Effect.withSpan('@livestore/common-cf/do-rpc/test-fixtures/worker:fetch'),
|
|
71
71
|
// Effect.provide(ProtocolLive),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../src/do-rpc/test-fixtures/worker.ts"],"names":[],"mappings":"AAAA,mDAAmD;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,OAAO,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AACzF,OAAO,EACL,MAAM,EACN,
|
|
1
|
+
{"version":3,"file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
|
2
2
|
declare const TestRpcs_base: RpcGroup.RpcGroup<Rpc.Rpc<"Ping", Schema.Struct<{
|
|
3
|
-
message:
|
|
3
|
+
readonly message: Schema.String;
|
|
4
4
|
}>, Schema.Struct<{
|
|
5
|
-
response:
|
|
6
|
-
}>,
|
|
7
|
-
text:
|
|
5
|
+
readonly response: Schema.String;
|
|
6
|
+
}>, Schema.Never, never, never> | Rpc.Rpc<"Echo", Schema.Struct<{
|
|
7
|
+
readonly text: Schema.String;
|
|
8
8
|
}>, Schema.Struct<{
|
|
9
|
-
echo:
|
|
10
|
-
}>,
|
|
11
|
-
a:
|
|
12
|
-
b:
|
|
9
|
+
readonly echo: Schema.String;
|
|
10
|
+
}>, Schema.Never, never, never> | Rpc.Rpc<"Add", Schema.Struct<{
|
|
11
|
+
readonly a: Schema.Finite;
|
|
12
|
+
readonly b: Schema.Finite;
|
|
13
13
|
}>, Schema.Struct<{
|
|
14
|
-
result:
|
|
15
|
-
}>,
|
|
16
|
-
message:
|
|
14
|
+
readonly result: Schema.Finite;
|
|
15
|
+
}>, Schema.Never, never, never> | Rpc.Rpc<"Defect", Schema.Struct<{
|
|
16
|
+
readonly message: Schema.String;
|
|
17
17
|
}>, Schema.Struct<{
|
|
18
|
-
never:
|
|
19
|
-
}>,
|
|
20
|
-
message:
|
|
18
|
+
readonly never: Schema.String;
|
|
19
|
+
}>, Schema.Never, never, never> | Rpc.Rpc<"Fail", Schema.Struct<{
|
|
20
|
+
readonly message: Schema.String;
|
|
21
21
|
}>, Schema.Struct<{
|
|
22
|
-
never:
|
|
23
|
-
}>,
|
|
24
|
-
maybeNumber: Schema.Option<
|
|
25
|
-
}>,
|
|
26
|
-
count:
|
|
27
|
-
errorAfter:
|
|
28
|
-
}>, import("
|
|
29
|
-
count:
|
|
30
|
-
defectAfter:
|
|
31
|
-
}>, import("
|
|
32
|
-
delay:
|
|
33
|
-
interruptAfterCount:
|
|
34
|
-
}>, import("
|
|
22
|
+
readonly never: Schema.String;
|
|
23
|
+
}>, Schema.String, never, never> | Rpc.Rpc<"Stream", Schema.Struct<{}>, import("effect/unstable/rpc/RpcSchema").Stream<Schema.Struct<{
|
|
24
|
+
readonly maybeNumber: Schema.Option<Schema.Finite>;
|
|
25
|
+
}>, Schema.Never>, Schema.Never, never, never> | Rpc.Rpc<"StreamError", Schema.Struct<{
|
|
26
|
+
readonly count: Schema.Finite;
|
|
27
|
+
readonly errorAfter: Schema.Finite;
|
|
28
|
+
}>, import("effect/unstable/rpc/RpcSchema").Stream<Schema.Finite, Schema.String>, Schema.Never, never, never> | Rpc.Rpc<"StreamDefect", Schema.Struct<{
|
|
29
|
+
readonly count: Schema.Finite;
|
|
30
|
+
readonly defectAfter: Schema.Finite;
|
|
31
|
+
}>, import("effect/unstable/rpc/RpcSchema").Stream<Schema.Finite, Schema.Never>, Schema.Never, never, never> | Rpc.Rpc<"StreamInterruptible", Schema.Struct<{
|
|
32
|
+
readonly delay: Schema.Finite;
|
|
33
|
+
readonly interruptAfterCount: Schema.Finite;
|
|
34
|
+
}>, import("effect/unstable/rpc/RpcSchema").Stream<Schema.Finite, Schema.Never>, Schema.Never, never, never>>;
|
|
35
35
|
export declare class TestRpcs extends TestRpcs_base {
|
|
36
36
|
}
|
|
37
37
|
export type TestRpcsI = RpcGroup.Rpcs<typeof TestRpcs>;
|
|
@@ -6,8 +6,8 @@ export class TestRpcs extends RpcGroup.make(Rpc.make('Ping', {
|
|
|
6
6
|
payload: Schema.Struct({ text: Schema.String }),
|
|
7
7
|
success: Schema.Struct({ echo: Schema.String }),
|
|
8
8
|
}), Rpc.make('Add', {
|
|
9
|
-
payload: Schema.Struct({ a: Schema.
|
|
10
|
-
success: Schema.Struct({ result: Schema.
|
|
9
|
+
payload: Schema.Struct({ a: Schema.Finite, b: Schema.Finite }),
|
|
10
|
+
success: Schema.Struct({ result: Schema.Finite }),
|
|
11
11
|
}), Rpc.make('Defect', {
|
|
12
12
|
payload: Schema.Struct({ message: Schema.String }),
|
|
13
13
|
success: Schema.Struct({ never: Schema.String }),
|
|
@@ -18,21 +18,21 @@ export class TestRpcs extends RpcGroup.make(Rpc.make('Ping', {
|
|
|
18
18
|
}), Rpc.make('Stream', {
|
|
19
19
|
payload: Schema.Struct({}),
|
|
20
20
|
success: Schema.Struct({
|
|
21
|
-
maybeNumber: Schema.Option(Schema.
|
|
21
|
+
maybeNumber: Schema.Option(Schema.Finite),
|
|
22
22
|
}),
|
|
23
23
|
stream: true,
|
|
24
24
|
}), Rpc.make('StreamError', {
|
|
25
|
-
payload: Schema.Struct({ count: Schema.
|
|
26
|
-
success: Schema.
|
|
25
|
+
payload: Schema.Struct({ count: Schema.Finite, errorAfter: Schema.Finite }),
|
|
26
|
+
success: Schema.Finite,
|
|
27
27
|
error: Schema.String,
|
|
28
28
|
stream: true,
|
|
29
29
|
}), Rpc.make('StreamDefect', {
|
|
30
|
-
payload: Schema.Struct({ count: Schema.
|
|
31
|
-
success: Schema.
|
|
30
|
+
payload: Schema.Struct({ count: Schema.Finite, defectAfter: Schema.Finite }),
|
|
31
|
+
success: Schema.Finite,
|
|
32
32
|
stream: true,
|
|
33
33
|
}), Rpc.make('StreamInterruptible', {
|
|
34
|
-
payload: Schema.Struct({ delay: Schema.
|
|
35
|
-
success: Schema.
|
|
34
|
+
payload: Schema.Struct({ delay: Schema.Finite, interruptAfterCount: Schema.Finite }),
|
|
35
|
+
success: Schema.Finite,
|
|
36
36
|
stream: true,
|
|
37
37
|
})) {
|
|
38
38
|
}
|