@brett_lamy/ui 3.0.0 → 4.0.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.
@@ -0,0 +1,102 @@
1
+ import { LocalStreams } from './append-stream';
2
+ export interface DurableStreamsConfig {
3
+ /** The server's base, e.g. `https://abc123.rivet.run/durable-streams`. Streams live at `<url>/v1/stream/<name>`. */
4
+ url: string;
5
+ /** Sent with every request: `{ Authorization: 'Bearer …' }`. */
6
+ headers?: Record<string, string>;
7
+ /** Put every stream under this prefix (a namespace per user or app). */
8
+ prefix?: string;
9
+ /** For tests, or a custom transport. Default: the global `fetch`. */
10
+ fetch?: typeof fetch;
11
+ }
12
+ export interface ProducerWrite {
13
+ id: string;
14
+ epoch: number;
15
+ seq: number;
16
+ }
17
+ export declare class DurableStreamsClient {
18
+ private cfg;
19
+ constructor(cfg: DurableStreamsConfig);
20
+ private url;
21
+ private request;
22
+ /** Create the stream (JSON mode) if it isn't there. */
23
+ create(name: string): Promise<void>;
24
+ /** Append records as one write. A write whose producer sequence the server has already seen counts as done. */
25
+ append(name: string, records: unknown[], producer?: ProducerWrite): Promise<void>;
26
+ /** Everything from `offset` (`-1`: the start) to the end as it stands. */
27
+ read<T = unknown>(name: string, offset?: string): Promise<{
28
+ items: T[];
29
+ next: string;
30
+ }>;
31
+ /** Follow the stream from `offset`: `onItems` gets each batch as it arrives, until `signal` aborts. */
32
+ tail<T = unknown>(name: string, offset: string, onItems: (items: T[], next: string) => void, signal: AbortSignal): Promise<void>;
33
+ }
34
+ export interface CloudSettings {
35
+ enabled: boolean;
36
+ url: string;
37
+ /** A bearer token, sent as `Authorization: Bearer …`. */
38
+ token: string;
39
+ /** Put this device's streams under this prefix on the server. */
40
+ prefix: string;
41
+ }
42
+ export interface CloudStatus {
43
+ state: 'off' | 'idle' | 'syncing' | 'offline' | 'error';
44
+ /** Records written here that the server hasn't acknowledged. */
45
+ pending: number;
46
+ lastSyncAt?: number;
47
+ error?: string;
48
+ }
49
+ export declare function loadCloudSettings(): CloudSettings;
50
+ /** An id for this browser, stable across sessions, that marks its writes. */
51
+ export declare function deviceId(): string;
52
+ /**
53
+ * Mirrors local streams to a Durable Streams server while enabled, and keeps a read-through copy of the streams named
54
+ * in `pull` (other devices' work) up to date. Progress is a small cursor per stream per server, kept in localStorage:
55
+ * the streams themselves are never modified.
56
+ */
57
+ export declare class CloudSync {
58
+ private local;
59
+ private pull;
60
+ private transport;
61
+ private settings;
62
+ private status;
63
+ private listeners;
64
+ private stopLocal?;
65
+ private timer?;
66
+ private running;
67
+ private failures;
68
+ private abort?;
69
+ /** The latest contents of each `pull` stream on the server. */
70
+ private pulled;
71
+ constructor(local: LocalStreams, pull?: string[], transport?: {
72
+ fetch?: typeof fetch;
73
+ });
74
+ subscribe: (cb: () => void) => () => void;
75
+ getStatus: () => CloudStatus;
76
+ getSettings: () => CloudSettings;
77
+ private set;
78
+ private client;
79
+ private cursorKey;
80
+ private cursor;
81
+ private saveCursor;
82
+ /** Save settings and start or stop syncing to match. */
83
+ configure(next: Partial<CloudSettings>): void;
84
+ /** Begin syncing if the settings say to. Safe to call again. */
85
+ start(): void;
86
+ stop(): void;
87
+ /** Records of a `pull` stream as the server has them (empty until the first read, or with sync off). */
88
+ pulledRecords<T>(name: string): T[];
89
+ /** Read a whole stream from the server (for one this device doesn't hold). */
90
+ readRemote<T>(name: string): Promise<T[]>;
91
+ private schedule;
92
+ private run;
93
+ private pending;
94
+ /** Keep the `pull` streams' server copies current, live. */
95
+ private followPulled;
96
+ }
97
+ /** The sync engine's status and settings, live. */
98
+ export declare function useCloud(cloud: CloudSync): {
99
+ status: CloudStatus;
100
+ settings: CloudSettings;
101
+ };
102
+ //# sourceMappingURL=durable-streams.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"durable-streams.d.ts","sourceRoot":"","sources":["../../src/lib/durable-streams.ts"],"names":[],"mappings":"AAEA,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,iBAAi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,CAAC,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC;IAQtC,gEAAgE;IAChE,KAAK;IAcL,IAAI;IAUJ,wGAAwG;IACxG,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,EAAE;IAInC,8EAA8E;IACxE,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAK/C,OAAO,CAAC,QAAQ;YAMF,GAAG;IAkCjB,OAAO,CAAC,OAAO;IAIf,4DAA4D;IAC5D,OAAO,CAAC,YAAY;CAoBrB;AAED,mDAAmD;AACnD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,QAAQ,EAAE,aAAa,CAAA;CAAE,CAI3F"}
@@ -0,0 +1,280 @@
1
+ "use client";
2
+ import { storage as e } from "./append-stream.js";
3
+ import { useSyncExternalStore as t } from "react";
4
+ //#region src/lib/durable-streams.ts
5
+ var n = class {
6
+ cfg;
7
+ constructor(e) {
8
+ this.cfg = e;
9
+ }
10
+ url(e, t = "") {
11
+ return `${this.cfg.url.replace(/\/+$/, "")}/v1/stream/${encodeURIComponent((this.cfg.prefix ?? "") + e)}${t}`;
12
+ }
13
+ request(e, t = {}) {
14
+ return (this.cfg.fetch ?? fetch)(e, {
15
+ ...t,
16
+ headers: {
17
+ ...this.cfg.headers,
18
+ ...t.headers
19
+ }
20
+ });
21
+ }
22
+ async create(e) {
23
+ let t = await this.request(this.url(e), {
24
+ method: "PUT",
25
+ headers: { "Content-Type": "application/json" }
26
+ });
27
+ if (!t.ok && t.status !== 409) throw Error(`create ${e}: ${t.status}`);
28
+ }
29
+ async append(e, t, n) {
30
+ let r = () => this.request(this.url(e), {
31
+ method: "POST",
32
+ headers: {
33
+ "Content-Type": "application/json",
34
+ ...n ? {
35
+ "Producer-Id": n.id,
36
+ "Producer-Epoch": String(n.epoch),
37
+ "Producer-Seq": String(n.seq)
38
+ } : null
39
+ },
40
+ body: JSON.stringify(t)
41
+ }), i = await r();
42
+ if (i.status === 404 && (await this.create(e), i = await r()), i.ok) return;
43
+ let a = Number(i.headers.get("Producer-Expected-Seq"));
44
+ if (!(i.status === 409 && n && Number.isFinite(a) && i.headers.has("Producer-Expected-Seq") && a > n.seq)) throw Error(`append ${e}: ${i.status}`);
45
+ }
46
+ async read(e, t = "-1") {
47
+ let n = [], r = t;
48
+ for (;;) {
49
+ let t = await this.request(this.url(e, `?offset=${encodeURIComponent(r)}`));
50
+ if (t.status === 404) return {
51
+ items: n,
52
+ next: r
53
+ };
54
+ if (!t.ok) throw Error(`read ${e}: ${t.status}`);
55
+ let i = t.status === 204 ? "" : await t.text();
56
+ i && n.push(...JSON.parse(i));
57
+ let a = t.headers.get("Stream-Next-Offset");
58
+ if (t.headers.get("Stream-Up-To-Date") === "true" || !a || a === r) return {
59
+ items: n,
60
+ next: a ?? r
61
+ };
62
+ r = a;
63
+ }
64
+ }
65
+ async tail(e, t, n, r) {
66
+ let i = t;
67
+ for (; !r.aborted;) {
68
+ let t = await this.request(this.url(e, `?offset=${encodeURIComponent(i)}&live=long-poll`), { signal: r });
69
+ if (t.status === 404) {
70
+ await new Promise((e) => setTimeout(e, 3e3));
71
+ continue;
72
+ }
73
+ if (!t.ok) throw Error(`tail ${e}: ${t.status}`);
74
+ let a = t.status === 204 ? "" : await t.text();
75
+ i = t.headers.get("Stream-Next-Offset") ?? i, a && n(JSON.parse(a), i);
76
+ }
77
+ }
78
+ }, r = "bl-cloud:settings", i = "bl-cloud:cursor:", a = "bl-cloud:device", o = 400, s = {
79
+ enabled: !1,
80
+ url: "",
81
+ token: "",
82
+ prefix: ""
83
+ };
84
+ function c() {
85
+ try {
86
+ return {
87
+ ...s,
88
+ ...JSON.parse(e()?.getItem(r) ?? "{}")
89
+ };
90
+ } catch {
91
+ return s;
92
+ }
93
+ }
94
+ function l() {
95
+ let t = e(), n = t?.getItem(a);
96
+ if (!n) {
97
+ n = `d${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
98
+ try {
99
+ t?.setItem(a, n);
100
+ } catch {}
101
+ }
102
+ return n;
103
+ }
104
+ var u = class {
105
+ local;
106
+ pull;
107
+ transport;
108
+ settings = c();
109
+ status = {
110
+ state: "off",
111
+ pending: 0
112
+ };
113
+ listeners = /* @__PURE__ */ new Set();
114
+ stopLocal;
115
+ timer;
116
+ running = !1;
117
+ failures = 0;
118
+ abort;
119
+ pulled = /* @__PURE__ */ new Map();
120
+ constructor(e, t = [], n = {}) {
121
+ this.local = e, this.pull = t, this.transport = n;
122
+ }
123
+ subscribe = (e) => (this.listeners.add(e), () => {
124
+ this.listeners.delete(e);
125
+ });
126
+ getStatus = () => this.status;
127
+ getSettings = () => this.settings;
128
+ set(e) {
129
+ this.status = {
130
+ ...this.status,
131
+ ...e
132
+ }, this.listeners.forEach((e) => e());
133
+ }
134
+ client() {
135
+ let e = this.settings;
136
+ return !e.enabled || !e.url.trim() ? null : new n({
137
+ url: e.url.trim(),
138
+ prefix: e.prefix.trim() ? `${e.prefix.trim().replace(/\/+$/, "")}.` : void 0,
139
+ headers: e.token.trim() ? { Authorization: `Bearer ${e.token.trim()}` } : void 0,
140
+ fetch: this.transport.fetch
141
+ });
142
+ }
143
+ cursorKey(e) {
144
+ return `${i}${encodeURIComponent(`${this.settings.url}|${this.settings.prefix}`)}:${encodeURIComponent(e)}`;
145
+ }
146
+ cursor(t) {
147
+ try {
148
+ return {
149
+ records: 0,
150
+ batches: 0,
151
+ ...JSON.parse(e()?.getItem(this.cursorKey(t)) ?? "{}")
152
+ };
153
+ } catch {
154
+ return {
155
+ records: 0,
156
+ batches: 0
157
+ };
158
+ }
159
+ }
160
+ saveCursor(t, n) {
161
+ try {
162
+ e()?.setItem(this.cursorKey(t), JSON.stringify(n));
163
+ } catch {}
164
+ }
165
+ configure(t) {
166
+ this.settings = {
167
+ ...this.settings,
168
+ ...t
169
+ };
170
+ try {
171
+ e()?.setItem(r, JSON.stringify(this.settings));
172
+ } catch {}
173
+ this.stop(), this.start(), this.listeners.forEach((e) => e());
174
+ }
175
+ start() {
176
+ if (this.stopLocal || !this.client()) {
177
+ this.client() || this.set({
178
+ state: "off",
179
+ pending: 0,
180
+ error: void 0
181
+ });
182
+ return;
183
+ }
184
+ this.stopLocal = this.local.subscribe(() => this.schedule());
185
+ let e = () => this.schedule(0), t = () => this.set({ state: "offline" });
186
+ addEventListener("online", e), addEventListener("offline", t);
187
+ let n = this.stopLocal;
188
+ this.stopLocal = () => {
189
+ n(), removeEventListener("online", e), removeEventListener("offline", t);
190
+ }, this.set({
191
+ state: navigator.onLine === !1 ? "offline" : "idle",
192
+ error: void 0
193
+ }), this.schedule(0), this.followPulled();
194
+ }
195
+ stop() {
196
+ this.stopLocal?.(), this.stopLocal = void 0, clearTimeout(this.timer), this.abort?.abort(), this.abort = void 0, this.pulled.clear(), this.set({
197
+ state: "off",
198
+ pending: 0,
199
+ error: void 0
200
+ });
201
+ }
202
+ pulledRecords(e) {
203
+ return this.pulled.get(e) ?? [];
204
+ }
205
+ async readRemote(e) {
206
+ let t = this.client();
207
+ return t ? (await t.read(e)).items : [];
208
+ }
209
+ schedule(e = 500) {
210
+ this.client() && (clearTimeout(this.timer), this.timer = setTimeout(() => void this.run(), e));
211
+ }
212
+ async run() {
213
+ let e = this.client();
214
+ if (!(!e || this.running)) {
215
+ if (navigator.onLine === !1) {
216
+ this.set({ state: "offline" });
217
+ return;
218
+ }
219
+ this.running = !0, this.set({ state: "syncing" });
220
+ try {
221
+ let t = l();
222
+ for (let n of this.local.names()) {
223
+ let r = this.cursor(n), i = this.local.length(n);
224
+ if (!(r.records >= i)) for (r.records === 0 && r.batches === 0 && await e.create(n); r.records < i;) {
225
+ let i = await this.local.read(n, r.records, r.records + o);
226
+ if (!i.length) break;
227
+ await e.append(n, i, {
228
+ id: t,
229
+ epoch: 0,
230
+ seq: r.batches
231
+ }), r.records += i.length, r.batches += 1, this.saveCursor(n, r), this.set({ pending: this.pending() });
232
+ }
233
+ }
234
+ this.failures = 0, this.set({
235
+ state: "idle",
236
+ pending: this.pending(),
237
+ lastSyncAt: Date.now(),
238
+ error: void 0
239
+ });
240
+ } catch (e) {
241
+ this.failures++, this.set({
242
+ state: "error",
243
+ pending: this.pending(),
244
+ error: e instanceof Error ? e.message : String(e)
245
+ }), this.schedule(Math.min(6e4, 1e3 * 2 ** this.failures));
246
+ } finally {
247
+ this.running = !1;
248
+ }
249
+ }
250
+ }
251
+ pending() {
252
+ return this.local.names().reduce((e, t) => e + Math.max(0, this.local.length(t) - this.cursor(t).records), 0);
253
+ }
254
+ followPulled() {
255
+ let e = this.client();
256
+ if (!e || !this.pull.length) return;
257
+ let t = this.abort = new AbortController();
258
+ for (let n of this.pull) (async () => {
259
+ try {
260
+ let { items: r, next: i } = await e.read(n);
261
+ this.pulled.set(n, r), this.listeners.forEach((e) => e()), await e.tail(n, i, (e) => {
262
+ this.pulled.set(n, [...this.pulled.get(n) ?? [], ...e]), this.listeners.forEach((e) => e());
263
+ }, t.signal);
264
+ } catch (e) {
265
+ t.signal.aborted || this.set({
266
+ state: "error",
267
+ error: e instanceof Error ? e.message : String(e)
268
+ });
269
+ }
270
+ })();
271
+ }
272
+ };
273
+ function d(e) {
274
+ return {
275
+ status: t(e.subscribe, e.getStatus, e.getStatus),
276
+ settings: t(e.subscribe, e.getSettings, e.getSettings)
277
+ };
278
+ }
279
+ //#endregion
280
+ export { u as CloudSync, n as DurableStreamsClient, l as deviceId, c as loadCloudSettings, d as useCloud };
@@ -0,0 +1,87 @@
1
+ import { eventWithTime } from 'rrweb';
2
+ import { CloudSync, CloudSettings, CloudStatus } from './durable-streams';
3
+ export type RecordedEvent = eventWithTime;
4
+ /** The records of the `sessions` index stream. */
5
+ export type IndexRecord = {
6
+ t: 'start';
7
+ id: string;
8
+ at: number;
9
+ url: string;
10
+ title: string;
11
+ width: number;
12
+ height: number;
13
+ device: string;
14
+ } | {
15
+ t: 'end';
16
+ id: string;
17
+ at: number;
18
+ events: number;
19
+ truncated?: boolean;
20
+ } | {
21
+ t: 'delete';
22
+ id: string;
23
+ at: number;
24
+ };
25
+ export interface SessionInfo {
26
+ id: string;
27
+ startedAt: number;
28
+ /** When it ended, if it ended cleanly. */
29
+ endedAt?: number;
30
+ /** Events recorded so far (here) or in total (from the `end` record, for a session held only in the cloud). */
31
+ events?: number;
32
+ url: string;
33
+ title: string;
34
+ width: number;
35
+ height: number;
36
+ /** Which browser recorded it. */
37
+ device: string;
38
+ /** Being recorded right now, by this tab. */
39
+ live: boolean;
40
+ /** Its events are in this browser. */
41
+ local: boolean;
42
+ /** Storage ran out and the recording stopped early. */
43
+ truncated?: boolean;
44
+ }
45
+ export interface SessionRecordingOptions {
46
+ /** Elements with this class are recorded as empty placeholders. Default `rr-block`. */
47
+ blockClass?: string;
48
+ /** Elements with this class don't record input events. Default `rr-ignore`. */
49
+ ignoreClass?: string;
50
+ /** Replace typed text with asterisks. Default true. */
51
+ maskAllInputs?: boolean;
52
+ /** How many sessions' events to keep in this browser; the oldest go first. Default 30. */
53
+ maxSessions?: number;
54
+ /** How often buffered events are written, in ms. Default 1500. */
55
+ flushMs?: number;
56
+ }
57
+ /** Mirrors the session streams to a Durable Streams server (Rivet) when enabled; see `CloudSync`. */
58
+ export declare const sessionCloud: CloudSync;
59
+ /** Every session, newest first, kept current while one records or another device syncs. */
60
+ export declare function useSessions(): SessionInfo[];
61
+ /** The session this tab is recording, if any. */
62
+ export declare function currentSessionId(): string | null;
63
+ /** A session's events, in order. A session still recording reads as far as it has got. */
64
+ export declare function readSession(id: string): Promise<RecordedEvent[]>;
65
+ /** Delete a session: its events leave this browser, and a `delete` record joins the index so every device agrees. */
66
+ export declare function deleteSession(id: string): Promise<void>;
67
+ /** Delete every session but the one recording now. */
68
+ export declare function clearSessions(): Promise<void>;
69
+ /** What this browser's streams occupy, in characters, against a typical 5M-character localStorage quota. */
70
+ export declare function storageUsage(): {
71
+ used: number;
72
+ quota: number;
73
+ };
74
+ /** The cloud's status and settings, live. */
75
+ export declare function useSessionCloud(): {
76
+ status: CloudStatus;
77
+ settings: CloudSettings;
78
+ configure: (s: Partial<CloudSettings>) => void;
79
+ };
80
+ /** Start recording this page as a new session; returns the function that ends it. Calls share one recording. */
81
+ export declare function startSessionRecording(options?: SessionRecordingOptions): () => void;
82
+ /** Record this page for as long as the component is mounted: one new session per mount (not per re-render). The cloud,
83
+ if switched on, syncs meanwhile. */
84
+ export declare function useSessionRecording({ enabled, ...options }?: SessionRecordingOptions & {
85
+ enabled?: boolean;
86
+ }): void;
87
+ //# sourceMappingURL=session-recorder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-recorder.d.ts","sourceRoot":"","sources":["../../src/lib/session-recorder.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAsB,KAAK,aAAa,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAkBxG,MAAM,MAAM,aAAa,GAAG,aAAa,CAAC;AAE1C,kDAAkD;AAClD,MAAM,MAAM,WAAW,GACnB;IAAE,CAAC,EAAE,OAAO,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACjH;IAAE,CAAC,EAAE,KAAK,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GACzE;IAAE,CAAC,EAAE,QAAQ,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA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