reflectdb 0.1.2 → 0.2.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/README.md +483 -17
- package/dist/cjs/client/index.cjs +0 -1
- package/dist/cjs/client/storage/indexeddb.cjs +0 -1
- package/dist/cjs/core/index.cjs +0 -1
- package/dist/cjs/htmx/index.cjs +1720 -0
- package/dist/cjs/htmx/index.d.cts +760 -0
- package/dist/cjs/react/index.cjs +0 -1
- package/dist/cjs/server/drizzle.cjs +15 -4
- package/dist/cjs/server/ephemeral/index.cjs +0 -1
- package/dist/cjs/server/ephemeral/redis.cjs +0 -1
- package/dist/cjs/server/index.cjs +34 -13
- package/dist/cjs/server/index.d.cts +14 -0
- package/dist/cjs/server/storage/object/index.cjs +2284 -0
- package/dist/cjs/server/storage/object/index.d.cts +578 -0
- package/dist/cjs/svelte/index.cjs +0 -1
- package/dist/cjs/transport/bun-ws.cjs +0 -1
- package/dist/cjs/transport/polling.cjs +0 -1
- package/dist/cjs/transport/sse.cjs +52 -2
- package/dist/cjs/transport/sse.d.cts +34 -0
- package/dist/cjs/transport/ws.cjs +0 -1
- package/dist/cjs/vanilla/index.cjs +0 -1
- package/dist/client/index.js +1 -1
- package/dist/client/storage/indexeddb.js +1 -1
- package/dist/core/index.js +1 -1
- package/dist/htmx/index.d.ts +760 -0
- package/dist/htmx/index.js +297 -0
- package/dist/react/index.js +1 -1
- package/dist/server/drizzle.js +3 -2
- package/dist/server/ephemeral/index.js +1 -1
- package/dist/server/ephemeral/redis.js +1 -1
- package/dist/server/index.d.ts +14 -0
- package/dist/server/index.js +19 -6
- package/dist/server/storage/object/index.d.ts +578 -0
- package/dist/server/storage/object/index.js +2232 -0
- package/dist/shared/{esm-z1xse19c.js → esm-5ahpq25j.js} +4 -4
- package/dist/shared/esm-dcs8qa5n.js +263 -0
- package/dist/shared/esm-f11s9zpb.js +15 -0
- package/dist/shared/esm-g5h4a88j.js +9 -0
- package/dist/shared/{esm-ck88h30s.js → esm-xtkhzxg2.js} +1 -1
- package/dist/svelte/index.js +1 -1
- package/dist/transport/bun-ws.js +1 -1
- package/dist/transport/polling.js +1 -1
- package/dist/transport/sse.d.ts +34 -0
- package/dist/transport/sse.js +53 -2
- package/dist/transport/ws.js +1 -1
- package/dist/vanilla/index.js +5 -261
- package/package.json +26 -3
- package/dist/shared/esm-k7kedp3y.js +0 -4
|
@@ -189,17 +189,51 @@ interface SseServerConfig {
|
|
|
189
189
|
* Default: 1 MB.
|
|
190
190
|
*/
|
|
191
191
|
maxMessageBytes?: number;
|
|
192
|
+
/**
|
|
193
|
+
* Return replies from the POST that produced them instead of assuming they
|
|
194
|
+
* can be streamed.
|
|
195
|
+
*
|
|
196
|
+
* Normally SSE is server→client only: a client POSTs a message and every
|
|
197
|
+
* reply — `hello_ack`, snapshots, op acks — comes back down the held stream.
|
|
198
|
+
* That works only while the POST and the stream are handled by the SAME
|
|
199
|
+
* process. On a serverless platform (Vercel, Lambda, Workers) they are two
|
|
200
|
+
* separate invocations, so those replies would be enqueued onto a stream the
|
|
201
|
+
* POST's process does not have, and the client would hang at the handshake.
|
|
202
|
+
*
|
|
203
|
+
* With this set, `collectReplies` runs a message and hands back what it
|
|
204
|
+
* produced so the HTTP handler can put it in the POST response body. The
|
|
205
|
+
* stream is then only used for what it is actually good at: pushing OTHER
|
|
206
|
+
* clients' changes. Pair it with `serverless: true` on the client transport.
|
|
207
|
+
*
|
|
208
|
+
* Off by default — a single-process server should keep streaming everything,
|
|
209
|
+
* and turning this on there would deliver each reply twice.
|
|
210
|
+
*/
|
|
211
|
+
serverless?: boolean;
|
|
192
212
|
}
|
|
193
213
|
declare function createSseServerTransport(cfg?: SseServerConfig): ServerTransport & {
|
|
194
214
|
handleSubscribe(clientId: string, controller: ReadableStreamDefaultController, lastEventId?: string): void;
|
|
195
215
|
handleMessage(clientId: string, message: ClientMessage): void;
|
|
196
216
|
handleDisconnect(clientId: string): void;
|
|
197
217
|
createEventStream(clientId: string, lastEventId?: string): ReadableStream;
|
|
218
|
+
collectReplies(clientId: string, message: ClientMessage, settle?: () => Promise<void>): Promise<ServerMessage[]>;
|
|
198
219
|
};
|
|
199
220
|
interface SseClientConfig {
|
|
200
221
|
eventUrl: string;
|
|
201
222
|
messageUrl: string;
|
|
202
223
|
headers?: Record<string, string>;
|
|
224
|
+
/**
|
|
225
|
+
* Read replies out of the POST response instead of waiting for them on the
|
|
226
|
+
* stream. Must match `serverless: true` on the server transport.
|
|
227
|
+
*
|
|
228
|
+
* Needed wherever the POST and the event stream are handled by different
|
|
229
|
+
* processes — Vercel, Lambda, Workers. There, replies to a POST are produced
|
|
230
|
+
* by a process that does not own this client's stream, so they can never be
|
|
231
|
+
* streamed and the handshake never completes.
|
|
232
|
+
*
|
|
233
|
+
* Leave it off for a single-process server: replies stream normally there,
|
|
234
|
+
* and turning it on would deliver every one of them twice.
|
|
235
|
+
*/
|
|
236
|
+
serverless?: boolean;
|
|
203
237
|
}
|
|
204
238
|
declare function createSseClientTransport(config: SseClientConfig): ClientTransport;
|
|
205
239
|
export { SseClientConfig, SseServerConfig, createSseClientTransport, createSseServerTransport };
|
package/dist/client/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "../shared/esm-8qbr4y0d.js";
|
|
7
7
|
import"../shared/esm-rw7jjtrv.js";
|
|
8
8
|
import"../shared/esm-3tkwvysa.js";
|
|
9
|
-
import"../shared/esm-
|
|
9
|
+
import"../shared/esm-g5h4a88j.js";
|
|
10
10
|
// src/client/storage/memory.ts
|
|
11
11
|
function createMemoryStorage() {
|
|
12
12
|
const rows = new Map;
|
package/dist/core/index.js
CHANGED