@powerhousedao/reactor-attachments 6.1.0 → 6.2.0-dev.1

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,23 @@
1
+ import { A as ReserveAttachmentOptions, B as SizeMismatch, C as AttachmentMetadata, D as AttachmentUploadResult, E as AttachmentTransportConfig, F as AttachmentNotFound, I as AttachmentPending, L as HashMismatch, M as TransportResponse, N as UploadFirstReserveAttachmentOptions, O as HashFirstReserveAttachmentOptions, P as AttachmentAlreadyExists, R as InvalidAttachmentRef, S as AttachmentHeader, T as AttachmentStatus, V as UploadTooLarge, _ as IAttachmentTransport, a as RemoteAttachmentUpload, b as IAttachmentUploadFactory, c as SwitchboardAttachmentTransport, d as createRef, f as parseRef, g as IAttachmentStore, h as IAttachmentService, i as RemoteAttachmentUploadFactory, j as TransportFetchResult, k as Reservation, l as SwitchboardTransportConfig, m as IAttachmentReader, n as createRemoteAttachmentService, o as RemoteReservationStore, p as AttachmentService, r as RemoteAttachmentStore, s as SwitchboardClientConfig, t as NullAttachmentTransport, u as ParsedRef, v as IAttachmentTransportFactory, w as AttachmentResponse, x as IReservationStore, y as IAttachmentUpload, z as ReservationNotFound } from "./null-attachment-transport-BBhQIk5A.js";
2
+ import { AttachmentHash, AttachmentRef } from "@powerhousedao/reactor";
3
+
4
+ //#region src/client.d.ts
5
+ type PreprocessResult = {
6
+ ref: AttachmentRef;
7
+ hash: AttachmentHash;
8
+ sizeBytes: number;
9
+ options: HashFirstReserveAttachmentOptions;
10
+ data: ReadableStream<Uint8Array>;
11
+ stream: () => ReadableStream<Uint8Array>;
12
+ };
13
+ interface IAttachmentClient {
14
+ preprocess(file: Blob, opts?: {
15
+ fileName?: string;
16
+ mimeType?: string;
17
+ }): Promise<PreprocessResult>;
18
+ reserve(options: HashFirstReserveAttachmentOptions, send: (handle: IAttachmentUpload) => Promise<AttachmentUploadResult>): Promise<AttachmentUploadResult>;
19
+ }
20
+ declare function createAttachmentClient(service: IAttachmentService): IAttachmentClient;
21
+ //#endregion
22
+ export { AttachmentAlreadyExists, type AttachmentHeader, type AttachmentMetadata, AttachmentNotFound, AttachmentPending, type AttachmentResponse, AttachmentService, type AttachmentStatus, type AttachmentTransportConfig, type AttachmentUploadResult, type HashFirstReserveAttachmentOptions, HashMismatch, IAttachmentClient, type IAttachmentReader, type IAttachmentService, type IAttachmentStore, type IAttachmentTransport, type IAttachmentTransportFactory, type IAttachmentUpload, type IAttachmentUploadFactory, type IReservationStore, InvalidAttachmentRef, NullAttachmentTransport, type ParsedRef, PreprocessResult, RemoteAttachmentStore, RemoteAttachmentUpload, RemoteAttachmentUploadFactory, RemoteReservationStore, type Reservation, ReservationNotFound, type ReserveAttachmentOptions, SizeMismatch, SwitchboardAttachmentTransport, type SwitchboardClientConfig, type SwitchboardTransportConfig, type TransportFetchResult, type TransportResponse, type UploadFirstReserveAttachmentOptions, UploadTooLarge, createAttachmentClient, createRef, createRemoteAttachmentService, parseRef };
23
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","names":[],"sources":["../src/client.ts"],"mappings":";;;;KA0DY,gBAAA;EACV,GAAA,EAAK,aAAA;EACL,IAAA,EAAM,cAAA;EACN,SAAA;EACA,OAAA,EAAS,iCAAA;EACT,IAAA,EAAM,cAAA,CAAe,UAAA;EACrB,MAAA,QAAc,cAAA,CAAe,UAAA;AAAA;AAAA,UAGd,iBAAA;EACf,UAAA,CACE,IAAA,EAAM,IAAA,EACN,IAAA;IAAS,QAAA;IAAmB,QAAA;EAAA,IAC3B,OAAA,CAAQ,gBAAA;EACX,OAAA,CACE,OAAA,EAAS,iCAAA,EACT,IAAA,GAAO,MAAA,EAAQ,iBAAA,KAAsB,OAAA,CAAQ,sBAAA,IAC5C,OAAA,CAAQ,sBAAA;AAAA;AAAA,iBA2DG,sBAAA,CACd,OAAA,EAAS,kBAAA,GACR,iBAAA"}
package/dist/client.js ADDED
@@ -0,0 +1,61 @@
1
+ import { _ as SizeMismatch, a as RemoteAttachmentUpload, c as AttachmentService, d as AttachmentAlreadyExists, f as AttachmentNotFound, g as ReservationNotFound, h as InvalidAttachmentRef, i as RemoteAttachmentUploadFactory, l as createRef, m as HashMismatch, n as createRemoteAttachmentService, o as RemoteReservationStore, p as AttachmentPending, r as RemoteAttachmentStore, s as SwitchboardAttachmentTransport, t as NullAttachmentTransport, u as parseRef, v as UploadTooLarge } from "./null-attachment-transport-Drx03s02.js";
2
+ //#region src/client.ts
3
+ function streamFromBuffer(buf) {
4
+ return new ReadableStream({ start(controller) {
5
+ controller.enqueue(buf);
6
+ controller.close();
7
+ } });
8
+ }
9
+ var AttachmentClientImpl = class {
10
+ constructor(service) {
11
+ this.service = service;
12
+ }
13
+ async preprocess(file, opts) {
14
+ const buf = await file.arrayBuffer();
15
+ const bytes = new Uint8Array(buf);
16
+ const digest = await globalThis.crypto.subtle.digest("SHA-256", bytes);
17
+ const hash = Array.from(new Uint8Array(digest)).map((b) => b.toString(16).padStart(2, "0")).join("");
18
+ const ref = createRef(hash);
19
+ const sizeBytes = file.size;
20
+ const options = {
21
+ mimeType: opts?.mimeType ?? file.type,
22
+ fileName: opts?.fileName ?? (file instanceof File ? file.name : "attachment"),
23
+ clientHash: hash,
24
+ sizeBytes
25
+ };
26
+ const data = streamFromBuffer(bytes);
27
+ const stream = () => streamFromBuffer(bytes);
28
+ return {
29
+ ref,
30
+ hash,
31
+ sizeBytes,
32
+ options,
33
+ data,
34
+ stream
35
+ };
36
+ }
37
+ async reserve(options, send) {
38
+ let handle;
39
+ try {
40
+ handle = await this.service.reserve(options);
41
+ } catch (err) {
42
+ if (err instanceof AttachmentAlreadyExists) {
43
+ const header = await this.service.stat(err.ref);
44
+ return {
45
+ hash: err.hash,
46
+ ref: err.ref,
47
+ header
48
+ };
49
+ }
50
+ throw err;
51
+ }
52
+ return send(handle);
53
+ }
54
+ };
55
+ function createAttachmentClient(service) {
56
+ return new AttachmentClientImpl(service);
57
+ }
58
+ //#endregion
59
+ export { AttachmentAlreadyExists, AttachmentNotFound, AttachmentPending, AttachmentService, HashMismatch, InvalidAttachmentRef, NullAttachmentTransport, RemoteAttachmentStore, RemoteAttachmentUpload, RemoteAttachmentUploadFactory, RemoteReservationStore, ReservationNotFound, SizeMismatch, SwitchboardAttachmentTransport, UploadTooLarge, createAttachmentClient, createRef, createRemoteAttachmentService, parseRef };
60
+
61
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","names":[],"sources":["../src/client.ts"],"sourcesContent":["import type { AttachmentHash, AttachmentRef } from \"@powerhousedao/reactor\";\nimport { AttachmentAlreadyExists } from \"./errors.js\";\nimport type { IAttachmentService, IAttachmentUpload } from \"./interfaces.js\";\nimport { createRef } from \"./ref.js\";\nimport type {\n AttachmentUploadResult,\n HashFirstReserveAttachmentOptions,\n} from \"./types.js\";\n\nexport { AttachmentService } from \"./attachment-service.js\";\nexport {\n AttachmentAlreadyExists,\n AttachmentNotFound,\n AttachmentPending,\n HashMismatch,\n InvalidAttachmentRef,\n ReservationNotFound,\n SizeMismatch,\n UploadTooLarge,\n} from \"./errors.js\";\nexport type {\n IAttachmentReader,\n IAttachmentService,\n IAttachmentStore,\n IAttachmentTransport,\n IAttachmentTransportFactory,\n IAttachmentUpload,\n IAttachmentUploadFactory,\n IReservationStore,\n} from \"./interfaces.js\";\nexport { parseRef, createRef } from \"./ref.js\";\nexport type { ParsedRef } from \"./ref.js\";\nexport type {\n AttachmentHeader,\n AttachmentMetadata,\n AttachmentResponse,\n AttachmentStatus,\n AttachmentTransportConfig,\n AttachmentUploadResult,\n HashFirstReserveAttachmentOptions,\n UploadFirstReserveAttachmentOptions,\n Reservation,\n ReserveAttachmentOptions,\n TransportFetchResult,\n TransportResponse,\n} from \"./types.js\";\nexport {\n SwitchboardAttachmentTransport,\n type SwitchboardTransportConfig,\n RemoteReservationStore,\n type SwitchboardClientConfig,\n RemoteAttachmentUpload,\n RemoteAttachmentUploadFactory,\n RemoteAttachmentStore,\n createRemoteAttachmentService,\n} from \"./switchboard/index.js\";\nexport { NullAttachmentTransport } from \"./null-attachment-transport.js\";\n\nexport type PreprocessResult = {\n ref: AttachmentRef;\n hash: AttachmentHash;\n sizeBytes: number;\n options: HashFirstReserveAttachmentOptions;\n data: ReadableStream<Uint8Array>;\n stream: () => ReadableStream<Uint8Array>;\n};\n\nexport interface IAttachmentClient {\n preprocess(\n file: Blob,\n opts?: { fileName?: string; mimeType?: string },\n ): Promise<PreprocessResult>;\n reserve(\n options: HashFirstReserveAttachmentOptions,\n send: (handle: IAttachmentUpload) => Promise<AttachmentUploadResult>,\n ): Promise<AttachmentUploadResult>;\n}\n\nfunction streamFromBuffer(buf: Uint8Array): ReadableStream<Uint8Array> {\n return new ReadableStream({\n start(controller) {\n controller.enqueue(buf);\n controller.close();\n },\n });\n}\n\nclass AttachmentClientImpl implements IAttachmentClient {\n constructor(private readonly service: IAttachmentService) {}\n\n async preprocess(\n file: Blob,\n opts?: { fileName?: string; mimeType?: string },\n ): Promise<PreprocessResult> {\n const buf = await file.arrayBuffer();\n const bytes = new Uint8Array(buf);\n const digest = await globalThis.crypto.subtle.digest(\"SHA-256\", bytes);\n const hash = Array.from(new Uint8Array(digest))\n .map((b) => b.toString(16).padStart(2, \"0\"))\n .join(\"\") as AttachmentHash;\n const ref = createRef(hash);\n const sizeBytes = file.size;\n const mimeType = opts?.mimeType ?? file.type;\n const fileName =\n opts?.fileName ?? (file instanceof File ? file.name : \"attachment\");\n const options: HashFirstReserveAttachmentOptions = {\n mimeType,\n fileName,\n clientHash: hash,\n sizeBytes,\n };\n const data = streamFromBuffer(bytes);\n const stream = (): ReadableStream<Uint8Array> => streamFromBuffer(bytes);\n return { ref, hash, sizeBytes, options, data, stream };\n }\n\n async reserve(\n options: HashFirstReserveAttachmentOptions,\n send: (handle: IAttachmentUpload) => Promise<AttachmentUploadResult>,\n ): Promise<AttachmentUploadResult> {\n let handle: IAttachmentUpload;\n try {\n handle = await this.service.reserve(options);\n } catch (err) {\n if (err instanceof AttachmentAlreadyExists) {\n const header = await this.service.stat(err.ref);\n return { hash: err.hash, ref: err.ref, header };\n }\n throw err;\n }\n return send(handle);\n }\n}\n\nexport function createAttachmentClient(\n service: IAttachmentService,\n): IAttachmentClient {\n return new AttachmentClientImpl(service);\n}\n"],"mappings":";;AA8EA,SAAS,iBAAiB,KAA6C;AACrE,QAAO,IAAI,eAAe,EACxB,MAAM,YAAY;AAChB,aAAW,QAAQ,IAAI;AACvB,aAAW,OAAO;IAErB,CAAC;;AAGJ,IAAM,uBAAN,MAAwD;CACtD,YAAY,SAA8C;AAA7B,OAAA,UAAA;;CAE7B,MAAM,WACJ,MACA,MAC2B;EAC3B,MAAM,MAAM,MAAM,KAAK,aAAa;EACpC,MAAM,QAAQ,IAAI,WAAW,IAAI;EACjC,MAAM,SAAS,MAAM,WAAW,OAAO,OAAO,OAAO,WAAW,MAAM;EACtE,MAAM,OAAO,MAAM,KAAK,IAAI,WAAW,OAAO,CAAC,CAC5C,KAAK,MAAM,EAAE,SAAS,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,CAC3C,KAAK,GAAG;EACX,MAAM,MAAM,UAAU,KAAK;EAC3B,MAAM,YAAY,KAAK;EAIvB,MAAM,UAA6C;GACjD,UAJe,MAAM,YAAY,KAAK;GAKtC,UAHA,MAAM,aAAa,gBAAgB,OAAO,KAAK,OAAO;GAItD,YAAY;GACZ;GACD;EACD,MAAM,OAAO,iBAAiB,MAAM;EACpC,MAAM,eAA2C,iBAAiB,MAAM;AACxE,SAAO;GAAE;GAAK;GAAM;GAAW;GAAS;GAAM;GAAQ;;CAGxD,MAAM,QACJ,SACA,MACiC;EACjC,IAAI;AACJ,MAAI;AACF,YAAS,MAAM,KAAK,QAAQ,QAAQ,QAAQ;WACrC,KAAK;AACZ,OAAI,eAAe,yBAAyB;IAC1C,MAAM,SAAS,MAAM,KAAK,QAAQ,KAAK,IAAI,IAAI;AAC/C,WAAO;KAAE,MAAM,IAAI;KAAM,KAAK,IAAI;KAAK;KAAQ;;AAEjD,SAAM;;AAER,SAAO,KAAK,OAAO;;;AAIvB,SAAgB,uBACd,SACmB;AACnB,QAAO,IAAI,qBAAqB,QAAQ"}
package/dist/index.d.ts CHANGED
@@ -1,352 +1,7 @@
1
+ import { A as ReserveAttachmentOptions, B as SizeMismatch, C as AttachmentMetadata, D as AttachmentUploadResult, E as AttachmentTransportConfig, F as AttachmentNotFound, I as AttachmentPending, L as HashMismatch, M as TransportResponse, N as UploadFirstReserveAttachmentOptions, O as HashFirstReserveAttachmentOptions, P as AttachmentAlreadyExists, R as InvalidAttachmentRef, S as AttachmentHeader, T as AttachmentStatus, V as UploadTooLarge, _ as IAttachmentTransport, a as RemoteAttachmentUpload, b as IAttachmentUploadFactory, c as SwitchboardAttachmentTransport, d as createRef, f as parseRef, g as IAttachmentStore, h as IAttachmentService, i as RemoteAttachmentUploadFactory, j as TransportFetchResult, k as Reservation, l as SwitchboardTransportConfig, m as IAttachmentReader, n as createRemoteAttachmentService, o as RemoteReservationStore, p as AttachmentService, r as RemoteAttachmentStore, s as SwitchboardClientConfig, t as NullAttachmentTransport, u as ParsedRef, v as IAttachmentTransportFactory, w as AttachmentResponse, x as IReservationStore, y as IAttachmentUpload, z as ReservationNotFound } from "./null-attachment-transport-BBhQIk5A.js";
1
2
  import { Kysely } from "kysely";
2
- import { AttachmentHash, AttachmentRef, JwtHandler } from "@powerhousedao/reactor";
3
+ import { AttachmentHash, AttachmentRef } from "@powerhousedao/reactor";
3
4
 
4
- //#region src/errors.d.ts
5
- /**
6
- * Thrown when an attachment ref or hash is not known to the store.
7
- */
8
- declare class AttachmentNotFound extends Error {
9
- constructor(identifier: string);
10
- }
11
- /**
12
- * Thrown when a reservation ID is not found in the reservation store.
13
- */
14
- declare class ReservationNotFound extends Error {
15
- constructor(reservationId: string);
16
- }
17
- /**
18
- * Thrown when an attachment ref string does not match the expected format.
19
- */
20
- declare class InvalidAttachmentRef extends Error {
21
- constructor(ref: string);
22
- }
23
- //#endregion
24
- //#region src/types.d.ts
25
- /**
26
- * Status of attachment data in the local store.
27
- */
28
- type AttachmentStatus = "available" | "evicted";
29
- /**
30
- * Metadata about an attachment. Only exists after data is stored
31
- * (via upload.send for client uploads, or put for sync).
32
- */
33
- type AttachmentHeader = {
34
- hash: AttachmentHash;
35
- mimeType: string;
36
- fileName: string;
37
- sizeBytes: number;
38
- extension: string | null;
39
- status: AttachmentStatus;
40
- source: "local" | "sync";
41
- createdAtUtc: string;
42
- lastAccessedAtUtc: string;
43
- };
44
- /**
45
- * Metadata provided alongside attachment data during sync, and returned
46
- * via the switchboard's `Attachment-Metadata` header on GET/HEAD.
47
- * `createdAtUtc` is the original upload time, propagated from the source
48
- * so that the receiving store preserves it instead of synthesizing the
49
- * fetch time. `lastAccessedAtUtc` is the source reactor's most recent
50
- * access time; it is optional because not every producer (e.g. a fresh
51
- * `put` from a transport) tracks access yet. Receiving stores that
52
- * persist locally (LRU concerns) reset it on every read regardless.
53
- *
54
- * Reliability note: `lastAccessedAtUtc` arriving over the wire is
55
- * best-effort. When the producer omits it, the consumer (see
56
- * `RemoteAttachmentStore` / `SwitchboardAttachmentTransport`) coalesces
57
- * with `createdAtUtc`, so the field can silently equal `createdAtUtc`
58
- * even on a server that has never been read. Do NOT use the wire value
59
- * for LRU eviction or staleness decisions on remote data; always read
60
- * the field from the local store after persistence, where the receiving
61
- * store is the authority.
62
- */
63
- type AttachmentMetadata = {
64
- mimeType: string;
65
- fileName: string;
66
- sizeBytes: number;
67
- extension: string | null;
68
- createdAtUtc: string;
69
- lastAccessedAtUtc?: string;
70
- };
71
- /**
72
- * Options provided when reserving an attachment slot.
73
- */
74
- type ReserveAttachmentOptions = {
75
- mimeType: string;
76
- fileName: string;
77
- extension?: string | null;
78
- };
79
- /**
80
- * Result of uploading attachment data through a handle.
81
- */
82
- type AttachmentUploadResult = {
83
- hash: AttachmentHash;
84
- ref: AttachmentRef;
85
- header: AttachmentHeader;
86
- };
87
- /**
88
- * Response when retrieving attachment data from the local store.
89
- */
90
- type AttachmentResponse = {
91
- header: AttachmentHeader;
92
- body: ReadableStream<Uint8Array>;
93
- };
94
- /**
95
- * Response when fetching attachment data from a remote transport.
96
- * Lighter than AttachmentResponse -- a remote peer cannot meaningfully
97
- * populate status or source, which are local reactor concerns.
98
- * The store assigns those fields when it calls put() on receipt.
99
- */
100
- type TransportResponse = {
101
- hash: AttachmentHash;
102
- metadata: AttachmentMetadata;
103
- body: ReadableStream<Uint8Array>;
104
- };
105
- /**
106
- * Configuration for creating an attachment transport instance.
107
- */
108
- type AttachmentTransportConfig = {
109
- type: string;
110
- parameters: Record<string, unknown>;
111
- };
112
- /**
113
- * A reservation for an in-progress attachment upload.
114
- * Created by reserve(), deleted when upload.send() completes or
115
- * once expiresAtUtc has passed and a sweep runs.
116
- */
117
- type Reservation = {
118
- reservationId: string;
119
- mimeType: string;
120
- fileName: string;
121
- extension: string | null;
122
- createdAtUtc: string;
123
- expiresAtUtc: string;
124
- };
125
- //#endregion
126
- //#region src/interfaces.d.ts
127
- /**
128
- * Client-facing interface for uploading, querying, and retrieving attachments.
129
- * This is what applications (editors, Connect, CLI tools) interact with.
130
- */
131
- interface IAttachmentService {
132
- /**
133
- * Reserve a new attachment slot and return an upload handle.
134
- *
135
- * The handle abstracts the transport -- the caller streams data
136
- * through it without knowing whether bytes flow via HTTP, S3,
137
- * or any other mechanism.
138
- */
139
- reserve(options: ReserveAttachmentOptions): Promise<IAttachmentUpload>;
140
- /**
141
- * Get attachment metadata by ref.
142
- *
143
- * @throws AttachmentNotFound if the ref is unknown.
144
- */
145
- stat(ref: AttachmentRef): Promise<AttachmentHeader>;
146
- /**
147
- * Retrieve attachment data.
148
- *
149
- * Always succeeds for any known ref. The underlying store handles
150
- * re-fetching evicted data from the transport transparently.
151
- */
152
- get(ref: AttachmentRef, signal?: AbortSignal): Promise<AttachmentResponse>;
153
- }
154
- /**
155
- * Upload handle returned by reserve(). Encapsulates all transport-specific
156
- * concerns (URLs, credentials, streaming protocols) behind a single send() method.
157
- */
158
- interface IAttachmentUpload {
159
- /**
160
- * Unique identifier for this reservation.
161
- */
162
- reservationId: string;
163
- /**
164
- * Stream attachment data through this handle.
165
- *
166
- * The handle manages the full upload lifecycle internally:
167
- * writing bytes to the backing store, computing or verifying
168
- * the content hash, creating the attachment record, and
169
- * cleaning up the reservation.
170
- *
171
- * Dedup: if an attachment with the same content hash already
172
- * exists, send() returns the existing ref. Content-addressed
173
- * storage means identical uploads converge on the same hash.
174
- *
175
- * @returns The content hash, ref, and header for the uploaded attachment.
176
- */
177
- send(data: ReadableStream<Uint8Array>): Promise<AttachmentUploadResult>;
178
- }
179
- /**
180
- * Read-only subset of IAttachmentStore.
181
- *
182
- * Adapters that cannot safely support the local-only write/GC surface
183
- * (remote stores, forwarding caches) implement this narrow interface
184
- * instead of stub-rejecting unsupported methods. Consumers that only
185
- * need to query metadata or stream attachment bytes can take this type
186
- * to make their dependency requirements explicit.
187
- */
188
- interface IAttachmentReader {
189
- /**
190
- * Get attachment metadata without streaming body data.
191
- * Does NOT update lastAccessedAtUtc -- this is a metadata check,
192
- * not a data access.
193
- *
194
- * @throws AttachmentNotFound if the hash is unknown.
195
- */
196
- stat(hash: AttachmentHash): Promise<AttachmentHeader>;
197
- /**
198
- * Retrieve attachment header and data stream by hash.
199
- * Updates lastAccessedAtUtc on access.
200
- *
201
- * If the data has been evicted, re-fetches it from the transport,
202
- * restores it locally via put(), and returns the data. This makes
203
- * eviction transparent to callers -- get() always succeeds for
204
- * any known hash.
205
- *
206
- * @throws AttachmentNotFound if the hash is unknown (no metadata
207
- * record exists).
208
- */
209
- get(hash: AttachmentHash, signal?: AbortSignal): Promise<AttachmentResponse>;
210
- }
211
- /**
212
- * Reactor-facing interface for managing local attachment data.
213
- * The IAttachmentTransport calls put when it receives data from a remote.
214
- * The store notifies its configured transport when new data arrives,
215
- * forming a bidirectional store-transport pair.
216
- */
217
- interface IAttachmentStore extends IAttachmentReader {
218
- /**
219
- * Check whether attachment data is available locally.
220
- * Returns true if the bytes can be served from this reactor's store
221
- * without a transport round-trip. Does not trigger a remote fetch.
222
- */
223
- has(hash: AttachmentHash): Promise<boolean>;
224
- /**
225
- * Store attachment data received from a remote (during sync or re-fetch).
226
- * Called by IAttachmentTransport implementations during sync, and
227
- * internally by get() when restoring evicted data.
228
- *
229
- * Behavior depends on existing state:
230
- * - No existing row: INSERT with source='sync', status='available'.
231
- * - Existing row with status='evicted': restore data, set status
232
- * to 'available'.
233
- * - Existing row with status='available': no-op (dedup).
234
- */
235
- put(hash: AttachmentHash, metadata: AttachmentMetadata, data: ReadableStream<Uint8Array>): Promise<void>;
236
- /**
237
- * Evict attachment data to reclaim storage.
238
- *
239
- * Removes the local bytes and sets status to 'evicted'. The
240
- * metadata record is retained so the hash is still known. If the
241
- * data is needed again, the service fetches it via the transport.
242
- *
243
- * Eviction must not destroy data while a get() stream is in
244
- * flight. Implementations must skip hashes with active readers
245
- * (e.g. via a refcount or lease) and revisit them on the next
246
- * GC pass.
247
- *
248
- * On immutable backends, this unpins/stops serving rather
249
- * than deleting.
250
- */
251
- evict(hash: AttachmentHash): Promise<void>;
252
- /**
253
- * Get the total storage used by locally available attachment data.
254
- * Used by the GC policy to decide when to evict.
255
- */
256
- storageUsed(): Promise<number>;
257
- }
258
- /**
259
- * Transport for moving attachment data between reactors.
260
- *
261
- * Forms a bidirectional pair with IAttachmentStore. The store calls
262
- * announce/push when new data arrives locally. The transport calls
263
- * store.put() when data arrives from a remote.
264
- */
265
- interface IAttachmentTransport {
266
- /**
267
- * Fetch attachment data by hash from a remote source.
268
- *
269
- * The transport resolves the hash to a data source (server endpoint,
270
- * S3 presigned URL, etc.) and returns a stream.
271
- *
272
- * @param hash - Content hash of the attachment
273
- * @param signal - Abort signal for cancellation
274
- * @returns The attachment data with metadata, or null if not available.
275
- * Returns TransportResponse (not AttachmentResponse) because
276
- * remote peers cannot populate local concerns like status/source.
277
- */
278
- fetch(hash: AttachmentHash, signal?: AbortSignal): Promise<TransportResponse | null>;
279
- /**
280
- * Announce that this reactor has attachment data available.
281
- *
282
- * For server-centric transports, this may be a no-op (the server
283
- * already has the data after upload).
284
- */
285
- announce(hash: AttachmentHash): Promise<void>;
286
- /**
287
- * Push attachment data to a specific remote.
288
- *
289
- * Used for eager replication strategies where the source reactor
290
- * pushes data to known peers rather than waiting for pull requests.
291
- *
292
- * @param hash - Content hash of the attachment
293
- * @param remote - Target remote identifier
294
- * @param data - The attachment data stream
295
- */
296
- push(hash: AttachmentHash, remote: string, data: ReadableStream<Uint8Array>): Promise<void>;
297
- }
298
- /**
299
- * Factory for creating attachment transport instances.
300
- * Mirrors IChannelFactory for operation sync.
301
- */
302
- interface IAttachmentTransportFactory {
303
- instance(config: AttachmentTransportConfig): IAttachmentTransport;
304
- }
305
- /**
306
- * Store for managing attachment reservations.
307
- * Reservations are transient records tracking in-progress uploads.
308
- */
309
- interface IReservationStore {
310
- create(options: ReserveAttachmentOptions): Promise<Reservation>;
311
- get(reservationId: string): Promise<Reservation>;
312
- delete(reservationId: string): Promise<void>;
313
- /**
314
- * Delete reservations whose expires_at_utc is at or before `now`.
315
- * Returns the number of rows deleted.
316
- *
317
- * Reservations are not auto-swept; consumers should call this on a
318
- * cron / interval to clean up rows left behind by aborted uploads.
319
- */
320
- deleteExpired(now?: Date): Promise<number>;
321
- }
322
- /**
323
- * Factory for creating transport-specific upload handles.
324
- * The service calls this during reserve() to create a handle
325
- * that knows how to stream bytes to the appropriate backend.
326
- */
327
- interface IAttachmentUploadFactory {
328
- createUpload(reservationId: string, options: ReserveAttachmentOptions): IAttachmentUpload;
329
- }
330
- //#endregion
331
- //#region src/attachment-service.d.ts
332
- declare class AttachmentService implements IAttachmentService {
333
- private readonly store;
334
- private readonly reservations;
335
- private readonly uploadFactory;
336
- constructor(store: IAttachmentReader, reservations: IReservationStore, uploadFactory: IAttachmentUploadFactory);
337
- reserve(options: ReserveAttachmentOptions): Promise<IAttachmentUpload>;
338
- stat(ref: AttachmentRef): Promise<AttachmentHeader>;
339
- get(ref: AttachmentRef, signal?: AbortSignal): Promise<AttachmentResponse>;
340
- }
341
- //#endregion
342
- //#region src/ref.d.ts
343
- type ParsedRef = {
344
- version: number;
345
- hash: AttachmentHash;
346
- };
347
- declare function parseRef(ref: AttachmentRef): ParsedRef;
348
- declare function createRef(hash: AttachmentHash, version?: number): AttachmentRef;
349
- //#endregion
350
5
  //#region src/storage/kysely/types.d.ts
351
6
  interface AttachmentTable {
352
7
  hash: string;
@@ -368,6 +23,8 @@ interface AttachmentReservationTable {
368
23
  created_at_utc: string;
369
24
  expires_at_utc: string;
370
25
  deleted_at_utc: string | null;
26
+ client_hash: string | null;
27
+ size_bytes: number | null;
371
28
  }
372
29
  interface AttachmentDatabase {
373
30
  attachment: AttachmentTable;
@@ -387,12 +44,14 @@ declare class KyselyAttachmentStore implements IAttachmentStore {
387
44
  put(hash: AttachmentHash, metadata: AttachmentMetadata, data: ReadableStream<Uint8Array>): Promise<void>;
388
45
  evict(hash: AttachmentHash): Promise<void>;
389
46
  storageUsed(): Promise<number>;
47
+ private findPendingReservation;
390
48
  private acquireReader;
391
49
  private releaseReader;
392
50
  private hasActiveReaders;
393
51
  }
394
52
  //#endregion
395
53
  //#region src/storage/kysely/reservation-store.d.ts
54
+ declare const DEFAULT_RESERVATION_TTL_MS: number;
396
55
  declare class KyselyReservationStore implements IReservationStore {
397
56
  private readonly db;
398
57
  private readonly ttlMs;
@@ -414,13 +73,15 @@ declare function runAttachmentMigrations(db: Kysely<any>, schema?: string): Prom
414
73
  //#endregion
415
74
  //#region src/direct/direct-attachment-upload.d.ts
416
75
  declare class DirectAttachmentUpload implements IAttachmentUpload {
417
- private readonly options;
76
+ private readonly reservation;
418
77
  private readonly db;
419
78
  private readonly basePath;
420
79
  private readonly reservations;
421
80
  private readonly maxBytes?;
422
81
  readonly reservationId: string;
423
- constructor(reservationId: string, options: ReserveAttachmentOptions, db: Kysely<AttachmentDatabase>, basePath: string, reservations: IReservationStore, maxBytes?: number | undefined);
82
+ readonly ref: AttachmentRef | null;
83
+ readonly expiresAtUtc: string;
84
+ constructor(reservation: Reservation, db: Kysely<AttachmentDatabase>, basePath: string, reservations: IReservationStore, maxBytes?: number | undefined);
424
85
  send(data: ReadableStream<Uint8Array>): Promise<AttachmentUploadResult>;
425
86
  }
426
87
  //#endregion
@@ -431,84 +92,7 @@ declare class DirectAttachmentUploadFactory implements IAttachmentUploadFactory
431
92
  private readonly reservations;
432
93
  private readonly maxBytes?;
433
94
  constructor(db: Kysely<AttachmentDatabase>, basePath: string, reservations: IReservationStore, maxBytes?: number | undefined);
434
- createUpload(reservationId: string, options: ReserveAttachmentOptions): IAttachmentUpload;
435
- }
436
- //#endregion
437
- //#region src/switchboard/switchboard-attachment-transport.d.ts
438
- type SwitchboardTransportConfig = {
439
- remoteUrl: string;
440
- jwtHandler?: JwtHandler;
441
- fetchFn?: typeof fetch;
442
- };
443
- declare class SwitchboardAttachmentTransport implements IAttachmentTransport {
444
- private readonly remoteUrl;
445
- private readonly jwtHandler?;
446
- private readonly fetchFn;
447
- constructor(config: SwitchboardTransportConfig);
448
- fetch(hash: AttachmentHash, signal?: AbortSignal): Promise<TransportResponse | null>;
449
- announce(_hash: AttachmentHash): Promise<void>;
450
- push(hash: AttachmentHash, remote: string, data: ReadableStream<Uint8Array>): Promise<void>;
451
- private parseMetadataHeaders;
452
- }
453
- //#endregion
454
- //#region src/switchboard/remote-reservation-store.d.ts
455
- type SwitchboardClientConfig = {
456
- remoteUrl: string;
457
- jwtHandler?: JwtHandler;
458
- fetchFn?: typeof fetch;
459
- };
460
- declare class RemoteReservationStore implements IReservationStore {
461
- private readonly remoteUrl;
462
- private readonly jwtHandler?;
463
- private readonly fetchFn;
464
- constructor(config: SwitchboardClientConfig);
465
- create(options: ReserveAttachmentOptions): Promise<Reservation>;
466
- get(reservationId: string): Promise<Reservation>;
467
- delete(reservationId: string): Promise<void>;
468
- deleteExpired(): Promise<number>;
469
- }
470
- //#endregion
471
- //#region src/switchboard/remote-attachment-upload.d.ts
472
- declare class RemoteAttachmentUpload implements IAttachmentUpload {
473
- readonly reservationId: string;
474
- private readonly remoteUrl;
475
- private readonly jwtHandler?;
476
- private readonly fetchFn;
477
- private readonly options;
478
- constructor(reservationId: string, options: ReserveAttachmentOptions, config: SwitchboardClientConfig);
479
- send(data: ReadableStream<Uint8Array>): Promise<AttachmentUploadResult>;
480
- }
481
- //#endregion
482
- //#region src/switchboard/remote-attachment-upload-factory.d.ts
483
- declare class RemoteAttachmentUploadFactory implements IAttachmentUploadFactory {
484
- private readonly config;
485
- constructor(config: SwitchboardClientConfig);
486
- createUpload(reservationId: string, options: ReserveAttachmentOptions): IAttachmentUpload;
487
- }
488
- //#endregion
489
- //#region src/switchboard/remote-attachment-store.d.ts
490
- declare class RemoteAttachmentStore implements IAttachmentReader {
491
- private readonly remoteUrl;
492
- private readonly jwtHandler?;
493
- private readonly fetchFn;
494
- constructor(config: SwitchboardClientConfig);
495
- stat(hash: AttachmentHash): Promise<AttachmentHeader>;
496
- get(hash: AttachmentHash, signal?: AbortSignal): Promise<AttachmentResponse>;
497
- private fetchAttachment;
498
- }
499
- //#endregion
500
- //#region src/switchboard/create-remote-attachment-service.d.ts
501
- declare function createRemoteAttachmentService(config: SwitchboardClientConfig): IAttachmentService;
502
- //#endregion
503
- //#region src/null-attachment-transport.d.ts
504
- /**
505
- * No-op transport for deployments without remote sync.
506
- * fetch() always returns null, announce() and push() are no-ops.
507
- */
508
- declare class NullAttachmentTransport implements IAttachmentTransport {
509
- fetch(): Promise<TransportResponse | null>;
510
- announce(): Promise<void>;
511
- push(): Promise<void>;
95
+ createUpload(reservation: Reservation): IAttachmentUpload;
512
96
  }
513
97
  //#endregion
514
98
  //#region src/attachment-builder.d.ts
@@ -516,7 +100,8 @@ type AttachmentBuildResult = {
516
100
  service: AttachmentService;
517
101
  store: KyselyAttachmentStore;
518
102
  reservations: KyselyReservationStore;
519
- uploadFactory: IAttachmentUploadFactory;
103
+ uploadFactory: IAttachmentUploadFactory; /** Stops the reservation sweep timer, if one was configured via withReservationSweepMs(). */
104
+ destroy: () => void;
520
105
  };
521
106
  declare class AttachmentBuilder {
522
107
  private readonly db;
@@ -524,12 +109,22 @@ declare class AttachmentBuilder {
524
109
  private transport;
525
110
  private customUploadFactory?;
526
111
  private maxUploadBytes?;
112
+ private reservationSweepMs?;
527
113
  constructor(db: Kysely<any>, storagePath: string);
528
114
  withTransport(transport: IAttachmentTransport): this;
529
115
  withUploadFactory(factory: IAttachmentUploadFactory): this;
530
116
  withMaxUploadBytes(maxBytes: number): this;
117
+ /**
118
+ * Configure a recurring sweep that deletes expired reservations.
119
+ * The sweep calls reservations.deleteExpired() on the given interval.
120
+ * When set, the built result's destroy() clears the timer.
121
+ * Without this option no sweep runs -- deleteExpired() is never called
122
+ * automatically. Call withReservationSweepMs in production to prevent
123
+ * expired reservation rows from accumulating indefinitely.
124
+ */
125
+ withReservationSweepMs(intervalMs: number): this;
531
126
  build(): Promise<AttachmentBuildResult>;
532
127
  }
533
128
  //#endregion
534
- export { ATTACHMENT_SCHEMA, type AttachmentBuildResult, AttachmentBuilder, type AttachmentDatabase, type AttachmentHeader, type AttachmentMetadata, AttachmentNotFound, type AttachmentResponse, AttachmentService, type AttachmentStatus, type AttachmentTransportConfig, type AttachmentUploadResult, DirectAttachmentUpload, DirectAttachmentUploadFactory, type IAttachmentService, type IAttachmentStore, type IAttachmentTransport, type IAttachmentTransportFactory, type IAttachmentUpload, type IAttachmentUploadFactory, type IReservationStore, InvalidAttachmentRef, KyselyAttachmentStore, KyselyReservationStore, NullAttachmentTransport, type ParsedRef, RemoteAttachmentStore, RemoteAttachmentUpload, RemoteAttachmentUploadFactory, RemoteReservationStore, type Reservation, ReservationNotFound, type ReserveAttachmentOptions, SwitchboardAttachmentTransport, type SwitchboardClientConfig, type SwitchboardTransportConfig, type TransportResponse, createRef, createRemoteAttachmentService, parseRef, runAttachmentMigrations };
129
+ export { ATTACHMENT_SCHEMA, AttachmentAlreadyExists, type AttachmentBuildResult, AttachmentBuilder, type AttachmentDatabase, type AttachmentHeader, type AttachmentMetadata, AttachmentNotFound, AttachmentPending, type AttachmentResponse, AttachmentService, type AttachmentStatus, type AttachmentTransportConfig, type AttachmentUploadResult, DEFAULT_RESERVATION_TTL_MS, DirectAttachmentUpload, DirectAttachmentUploadFactory, type HashFirstReserveAttachmentOptions, HashMismatch, type IAttachmentReader, type IAttachmentService, type IAttachmentStore, type IAttachmentTransport, type IAttachmentTransportFactory, type IAttachmentUpload, type IAttachmentUploadFactory, type IReservationStore, InvalidAttachmentRef, KyselyAttachmentStore, KyselyReservationStore, NullAttachmentTransport, type ParsedRef, RemoteAttachmentStore, RemoteAttachmentUpload, RemoteAttachmentUploadFactory, RemoteReservationStore, type Reservation, ReservationNotFound, type ReserveAttachmentOptions, SizeMismatch, SwitchboardAttachmentTransport, type SwitchboardClientConfig, type SwitchboardTransportConfig, type TransportFetchResult, type TransportResponse, type UploadFirstReserveAttachmentOptions, UploadTooLarge, createRef, createRemoteAttachmentService, parseRef, runAttachmentMigrations };
535
130
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/errors.ts","../src/types.ts","../src/interfaces.ts","../src/attachment-service.ts","../src/ref.ts","../src/storage/kysely/types.ts","../src/storage/kysely/attachment-store.ts","../src/storage/kysely/reservation-store.ts","../src/storage/migrations/migrator.ts","../src/direct/direct-attachment-upload.ts","../src/direct/direct-attachment-upload-factory.ts","../src/switchboard/switchboard-attachment-transport.ts","../src/switchboard/remote-reservation-store.ts","../src/switchboard/remote-attachment-upload.ts","../src/switchboard/remote-attachment-upload-factory.ts","../src/switchboard/remote-attachment-store.ts","../src/switchboard/create-remote-attachment-service.ts","../src/null-attachment-transport.ts","../src/attachment-builder.ts"],"mappings":";;;;;;;cAGa,kBAAA,SAA2B,KAAA;cAC1B,UAAA;AAAA;;;;cASD,mBAA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AAQ,qBAAA;AAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/storage/kysely/types.ts","../src/storage/kysely/attachment-store.ts","../src/storage/kysely/reservation-store.ts","../src/storage/migrations/migrator.ts","../src/direct/direct-attachment-upload.ts","../src/direct/direct-attachment-upload-factory.ts","../src/attachment-builder.ts"],"mappings":";;;;;UAEiB,eAAA;EACf,IAAA;EACA,SAAA;EACA,SAAA;EACA,UAAA;EACA,SAAA;EACA,MAAA;EACA,YAAA;EACA,MAAA;EACA,cAAA;EACA,oBAAA;AAAA;AAAA,UAGe,0BAAA;EACf,cAAA;EACA,SAAA;EACA,SAAA;EACA,SAAA;EACA,cAAA;EACA,cAAA;EACA,cAAA;EACA,WAAA;EACA,UAAA;AAAA;AAAA,UAGe,kBAAA;EACf,UAAA,EAAY,eAAA;EACZ,sBAAA,EAAwB,0BAAA;AAAA;;;cC4Cb,qBAAA,YAAiC,gBAAA;EAAA,iBAIzB,EAAA;EAAA,iBACA,SAAA;EAAA,iBACA,QAAA;EAAA,iBALF,aAAA;cAGE,EAAA,EAAI,MAAA,CAAO,kBAAA,GACX,SAAA,EAAW,oBAAA,EACX,QAAA;EAGb,IAAA,CAAK,IAAA,EAAM,cAAA,GAAiB,OAAA,CAAQ,gBAAA;EAgCpC,GAAA,CAAI,IAAA,EAAM,cAAA,GAAiB,OAAA;EAU3B,GAAA,CACJ,IAAA,EAAM,cAAA,EACN,MAAA,GAAS,WAAA,GACR,OAAA,CAAQ,kBAAA;EA+DL,GAAA,CACJ,IAAA,EAAM,cAAA,EACN,QAAA,EAAU,kBAAA,EACV,IAAA,EAAM,cAAA,CAAe,UAAA,IACpB,OAAA;EAiDG,KAAA,CAAM,IAAA,EAAM,cAAA,GAAiB,OAAA;EAyB7B,WAAA,CAAA,GAAe,OAAA;EAAA,QAYP,sBAAA;EAAA,QAyCN,aAAA;EAAA,QAIA,aAAA;EAAA,QASA,gBAAA;AAAA;;;cCvUG,0BAAA;AAAA,cAeA,sBA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