@powerhousedao/reactor-attachments 6.2.3-dev.24 → 6.2.3-dev.26
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/client.d.ts +51 -36
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +20 -4
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +45 -40
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +52 -25
- package/dist/index.js.map +1 -1
- package/dist/{null-attachment-transport-CMrO_ZKA.d.ts → null-attachment-transport-BkM6rq4R.d.ts} +30 -18
- package/dist/null-attachment-transport-BkM6rq4R.d.ts.map +1 -0
- package/dist/{null-attachment-transport-CrsUafCi.js → null-attachment-transport-D53Rz9lE.js} +20 -13
- package/dist/null-attachment-transport-D53Rz9lE.js.map +1 -0
- package/package.json +5 -5
- package/dist/null-attachment-transport-CMrO_ZKA.d.ts.map +0 -1
- package/dist/null-attachment-transport-CrsUafCi.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import * as kysely from "kysely";
|
|
1
|
+
import { $ as AttachmentNotFound, A as IReservationStore, B as AttachmentStatOptions, C as IAttachmentReader, D as IAttachmentTransportFactory, E as IAttachmentTransport, G as AttachmentUploadTarget, H as AttachmentTargetHeaders, I as AttachmentHeader, J as ReserveAttachmentOptions, K as HashFirstReserveAttachmentOptions, L as AttachmentMetadata, M as AttachmentBackendKind, N as AttachmentDownloadOptions, O as IAttachmentUpload, P as AttachmentDownloadTarget, Q as AttachmentAlreadyExists, R as AttachmentResponse, S as IAttachmentBackend, T as IAttachmentStore, U as AttachmentTransportConfig, V as AttachmentStatus, W as AttachmentUploadResult, X as TransportResponse, Y as TransportFetchResult, Z as UploadFirstReserveAttachmentOptions, _ as createRef, a as RemoteAttachmentUpload, at as ReservationNotFound, b as parseAttachmentDownloadTarget, c as XhrUploadTransportOptions, d as AttachmentUploadResponse, et as AttachmentPending, f as AttachmentUploadTransport, g as ParsedRef, h as SwitchboardTransportConfig, i as RemoteAttachmentUploadFactory, it as InvalidAttachmentRef, j as AttachmentBackendHealth, k as IAttachmentUploadFactory, l as createXhrUploadTransport, m as SwitchboardAttachmentTransport, n as createRemoteAttachmentService, nt as AttachmentTransferStage, o as RemoteReservationStore, ot as SizeMismatch, p as createFetchUploadTransport, q as Reservation, r as RemoteAttachmentStore, rt as HashMismatch, s as SwitchboardClientConfig, st as UploadTooLarge, t as NullAttachmentTransport, tt as AttachmentTransferError, u as AttachmentUploadRequest, v as parseRef, w as IAttachmentService, x as parseAttachmentUploadTarget, y as AttachmentService, z as AttachmentSendOptions } from "./null-attachment-transport-BkM6rq4R.js";
|
|
3
2
|
import { Kysely, Transaction } from "kysely";
|
|
4
3
|
import { AttachmentHash, AttachmentRef, BaseReadModel, DocumentViewDatabase, IConsistencyTracker, IDocumentModelRegistry, IOperationIndex, IWriteCache } from "@powerhousedao/reactor";
|
|
5
4
|
import { Action, DocumentModelModule, OperationWithContext } from "@powerhousedao/shared/document-model";
|
|
6
|
-
|
|
7
5
|
//#region src/storage/kysely/types.d.ts
|
|
8
6
|
interface AttachmentTable {
|
|
9
7
|
hash: string;
|
|
@@ -34,7 +32,7 @@ interface AttachmentDatabase {
|
|
|
34
32
|
}
|
|
35
33
|
//#endregion
|
|
36
34
|
//#region src/storage/kysely/attachment-store.d.ts
|
|
37
|
-
declare class KyselyAttachmentStore implements IAttachmentStore {
|
|
35
|
+
export declare class KyselyAttachmentStore implements IAttachmentStore {
|
|
38
36
|
private readonly db;
|
|
39
37
|
private readonly transport;
|
|
40
38
|
private readonly basePath;
|
|
@@ -42,10 +40,11 @@ declare class KyselyAttachmentStore implements IAttachmentStore {
|
|
|
42
40
|
constructor(db: Kysely<AttachmentDatabase>, transport: IAttachmentTransport, basePath: string);
|
|
43
41
|
stat(hash: AttachmentHash): Promise<AttachmentHeader>;
|
|
44
42
|
has(hash: AttachmentHash): Promise<boolean>;
|
|
45
|
-
get(hash: AttachmentHash, signal?: AbortSignal): Promise<AttachmentResponse>;
|
|
43
|
+
get(hash: AttachmentHash, signal?: AbortSignal, documentId?: string): Promise<AttachmentResponse>;
|
|
46
44
|
put(hash: AttachmentHash, metadata: AttachmentMetadata, data: ReadableStream<Uint8Array>): Promise<void>;
|
|
47
45
|
evict(hash: AttachmentHash): Promise<void>;
|
|
48
46
|
storageUsed(): Promise<number>;
|
|
47
|
+
private fetchRemote;
|
|
49
48
|
private findPendingReservation;
|
|
50
49
|
private acquireReader;
|
|
51
50
|
private releaseReader;
|
|
@@ -53,8 +52,8 @@ declare class KyselyAttachmentStore implements IAttachmentStore {
|
|
|
53
52
|
}
|
|
54
53
|
//#endregion
|
|
55
54
|
//#region src/storage/kysely/reservation-store.d.ts
|
|
56
|
-
declare const DEFAULT_RESERVATION_TTL_MS: number;
|
|
57
|
-
declare class KyselyReservationStore implements IReservationStore {
|
|
55
|
+
export declare const DEFAULT_RESERVATION_TTL_MS: number;
|
|
56
|
+
export declare class KyselyReservationStore implements IReservationStore {
|
|
58
57
|
private readonly db;
|
|
59
58
|
private readonly ttlMs;
|
|
60
59
|
constructor(db: Kysely<AttachmentDatabase>, ttlMs?: number);
|
|
@@ -65,16 +64,16 @@ declare class KyselyReservationStore implements IReservationStore {
|
|
|
65
64
|
}
|
|
66
65
|
//#endregion
|
|
67
66
|
//#region src/storage/migrations/migrator.d.ts
|
|
68
|
-
declare const ATTACHMENT_SCHEMA = "attachments";
|
|
67
|
+
export declare const ATTACHMENT_SCHEMA = "attachments";
|
|
69
68
|
interface MigrationResult {
|
|
70
69
|
success: boolean;
|
|
71
70
|
migrationsExecuted: string[];
|
|
72
71
|
error?: Error;
|
|
73
72
|
}
|
|
74
|
-
declare function runAttachmentMigrations(db: Kysely<any>, schema?: string): Promise<MigrationResult>;
|
|
73
|
+
export declare function runAttachmentMigrations(db: Kysely<any>, schema?: string): Promise<MigrationResult>;
|
|
75
74
|
//#endregion
|
|
76
75
|
//#region src/direct/direct-attachment-upload.d.ts
|
|
77
|
-
declare class DirectAttachmentUpload implements IAttachmentUpload {
|
|
76
|
+
export declare class DirectAttachmentUpload implements IAttachmentUpload {
|
|
78
77
|
private readonly reservation;
|
|
79
78
|
private readonly db;
|
|
80
79
|
private readonly basePath;
|
|
@@ -88,7 +87,7 @@ declare class DirectAttachmentUpload implements IAttachmentUpload {
|
|
|
88
87
|
}
|
|
89
88
|
//#endregion
|
|
90
89
|
//#region src/direct/direct-attachment-upload-factory.d.ts
|
|
91
|
-
declare class DirectAttachmentUploadFactory implements IAttachmentUploadFactory {
|
|
90
|
+
export declare class DirectAttachmentUploadFactory implements IAttachmentUploadFactory {
|
|
92
91
|
private readonly db;
|
|
93
92
|
private readonly basePath;
|
|
94
93
|
private readonly reservations;
|
|
@@ -108,7 +107,7 @@ type FilesystemAttachmentBackendConfig = {
|
|
|
108
107
|
* at the server edge, while this adapter validates that a filesystem backend
|
|
109
108
|
* can never accidentally return a direct-provider target.
|
|
110
109
|
*/
|
|
111
|
-
declare class FilesystemAttachmentBackend implements IAttachmentBackend {
|
|
110
|
+
export declare class FilesystemAttachmentBackend implements IAttachmentBackend {
|
|
112
111
|
private readonly store;
|
|
113
112
|
private readonly config;
|
|
114
113
|
readonly kind: "filesystem";
|
|
@@ -124,11 +123,13 @@ type AttachmentBuildResult = {
|
|
|
124
123
|
service: AttachmentService;
|
|
125
124
|
store: KyselyAttachmentStore;
|
|
126
125
|
reservations: KyselyReservationStore;
|
|
127
|
-
uploadFactory: IAttachmentUploadFactory;
|
|
128
|
-
|
|
126
|
+
uploadFactory: IAttachmentUploadFactory;
|
|
127
|
+
/** Selected direct-transfer backend, when startup configured one. */
|
|
128
|
+
backend?: IAttachmentBackend;
|
|
129
|
+
/** Stops the reservation sweep timer, if one was configured via withReservationSweepMs(). */
|
|
129
130
|
destroy: () => void;
|
|
130
131
|
};
|
|
131
|
-
declare class AttachmentBuilder {
|
|
132
|
+
export declare class AttachmentBuilder {
|
|
132
133
|
private readonly db;
|
|
133
134
|
private readonly storagePath;
|
|
134
135
|
private transport;
|
|
@@ -162,7 +163,7 @@ interface IAttachmentSchemaCompiler {
|
|
|
162
163
|
}
|
|
163
164
|
//#endregion
|
|
164
165
|
//#region src/reference-index/attachment-schema-compiler.d.ts
|
|
165
|
-
declare class AttachmentSchemaCompiler implements IAttachmentSchemaCompiler {
|
|
166
|
+
export declare class AttachmentSchemaCompiler implements IAttachmentSchemaCompiler {
|
|
166
167
|
private readonly cache;
|
|
167
168
|
forModuleAction(module: DocumentModelModule, actionType: string): CompiledAttachmentExtractor;
|
|
168
169
|
}
|
|
@@ -178,6 +179,8 @@ interface AttachmentReferenceInput {
|
|
|
178
179
|
}
|
|
179
180
|
interface IAttachmentReferenceReader {
|
|
180
181
|
hasReference(documentId: string, ref: AttachmentRef): Promise<boolean>;
|
|
182
|
+
/** The scopes whose operations reference the attachment; empty when none. */
|
|
183
|
+
referencingScopes(documentId: string, ref: AttachmentRef): Promise<string[]>;
|
|
181
184
|
}
|
|
182
185
|
interface IAttachmentReferenceWriter {
|
|
183
186
|
addReferences(references: readonly AttachmentReferenceInput[]): Promise<void>;
|
|
@@ -187,14 +190,14 @@ interface IAttachmentReferenceWriter {
|
|
|
187
190
|
type AttachmentReferenceIndexBuildResult = {
|
|
188
191
|
store: IAttachmentReferenceReader & IAttachmentReferenceWriter;
|
|
189
192
|
};
|
|
190
|
-
declare class AttachmentReferenceIndexBuilder {
|
|
193
|
+
export declare class AttachmentReferenceIndexBuilder {
|
|
191
194
|
private readonly db;
|
|
192
195
|
constructor(db: Kysely<unknown>);
|
|
193
196
|
build(): Promise<AttachmentReferenceIndexBuildResult>;
|
|
194
197
|
}
|
|
195
198
|
//#endregion
|
|
196
199
|
//#region src/read-models/attachment-reference/attachment-reference-read-model.d.ts
|
|
197
|
-
declare const ATTACHMENT_REFERENCE_READ_MODEL_ID = "attachment-reference-read-model";
|
|
200
|
+
export declare const ATTACHMENT_REFERENCE_READ_MODEL_ID = "attachment-reference-read-model";
|
|
198
201
|
/**
|
|
199
202
|
* Indexes attachment references in chunks.
|
|
200
203
|
*
|
|
@@ -204,7 +207,7 @@ declare const ATTACHMENT_REFERENCE_READ_MODEL_ID = "attachment-reference-read-mo
|
|
|
204
207
|
* new. Batches here are the largest in the system, which is what chunking is
|
|
205
208
|
* for.
|
|
206
209
|
*/
|
|
207
|
-
declare class AttachmentReferenceReadModel extends BaseReadModel {
|
|
210
|
+
export declare class AttachmentReferenceReadModel extends BaseReadModel {
|
|
208
211
|
private readonly documentModelRegistry;
|
|
209
212
|
private readonly schemaCompiler;
|
|
210
213
|
private readonly referenceWriter;
|
|
@@ -272,31 +275,32 @@ interface AttachmentReferenceDatabase {
|
|
|
272
275
|
}
|
|
273
276
|
//#endregion
|
|
274
277
|
//#region src/read-models/attachment-reference/kysely-attachment-reference-store.d.ts
|
|
275
|
-
declare class KyselyAttachmentReferenceStore implements IAttachmentReferenceReader, IAttachmentReferenceWriter {
|
|
278
|
+
export declare class KyselyAttachmentReferenceStore implements IAttachmentReferenceReader, IAttachmentReferenceWriter {
|
|
276
279
|
private readonly db;
|
|
277
280
|
constructor(db: Kysely<AttachmentReferenceDatabase>);
|
|
278
281
|
hasReference(documentId: string, ref: AttachmentRef): Promise<boolean>;
|
|
282
|
+
referencingScopes(documentId: string, ref: AttachmentRef): Promise<string[]>;
|
|
279
283
|
addReferences(references: readonly AttachmentReferenceInput[]): Promise<void>;
|
|
280
284
|
}
|
|
281
285
|
//#endregion
|
|
282
286
|
//#region src/read-models/attachment-reference/storage/migrations/migrator.d.ts
|
|
283
|
-
declare const ATTACHMENT_REFERENCE_SCHEMA = "attachment_reference_read_model";
|
|
284
|
-
declare const ATTACHMENT_REFERENCE_MIGRATION_TABLE = "kysely_migration_attachment_reference_read_model";
|
|
285
|
-
declare const ATTACHMENT_REFERENCE_MIGRATION_LOCK_TABLE = "kysely_migration_attachment_reference_read_model_lock";
|
|
287
|
+
export declare const ATTACHMENT_REFERENCE_SCHEMA = "attachment_reference_read_model";
|
|
288
|
+
export declare const ATTACHMENT_REFERENCE_MIGRATION_TABLE = "kysely_migration_attachment_reference_read_model";
|
|
289
|
+
export declare const ATTACHMENT_REFERENCE_MIGRATION_LOCK_TABLE = "kysely_migration_attachment_reference_read_model_lock";
|
|
286
290
|
interface AttachmentReferenceMigrationResult {
|
|
287
291
|
success: boolean;
|
|
288
292
|
migrationsExecuted: string[];
|
|
289
293
|
error?: Error;
|
|
290
294
|
}
|
|
291
|
-
declare function runAttachmentReferenceMigrations(db: Kysely<unknown>, schema?: string): Promise<AttachmentReferenceMigrationResult>;
|
|
292
|
-
declare function rollbackAttachmentReferenceMigration(db: Kysely<unknown>, schema?: string): Promise<AttachmentReferenceMigrationResult>;
|
|
293
|
-
declare function getAttachmentReferenceMigrationStatus(db: Kysely<unknown>, schema?: string): Promise<readonly kysely.MigrationInfo[]>;
|
|
295
|
+
export declare function runAttachmentReferenceMigrations(db: Kysely<unknown>, schema?: string): Promise<AttachmentReferenceMigrationResult>;
|
|
296
|
+
export declare function rollbackAttachmentReferenceMigration(db: Kysely<unknown>, schema?: string): Promise<AttachmentReferenceMigrationResult>;
|
|
297
|
+
export declare function getAttachmentReferenceMigrationStatus(db: Kysely<unknown>, schema?: string): Promise<readonly import("kysely").MigrationInfo[]>;
|
|
294
298
|
//#endregion
|
|
295
299
|
//#region src/storage/s3/config.d.ts
|
|
296
|
-
declare const DEFAULT_S3_ATTACHMENT_PREFIX = "attachments";
|
|
297
|
-
declare const DEFAULT_S3_UPLOAD_TTL_SECONDS = 900;
|
|
298
|
-
declare const DEFAULT_S3_DOWNLOAD_TTL_SECONDS = 300;
|
|
299
|
-
declare const MAX_S3_PRESIGN_TTL_SECONDS = 604800;
|
|
300
|
+
export declare const DEFAULT_S3_ATTACHMENT_PREFIX = "attachments";
|
|
301
|
+
export declare const DEFAULT_S3_UPLOAD_TTL_SECONDS = 900;
|
|
302
|
+
export declare const DEFAULT_S3_DOWNLOAD_TTL_SECONDS = 300;
|
|
303
|
+
export declare const MAX_S3_PRESIGN_TTL_SECONDS = 604800;
|
|
300
304
|
type S3AttachmentConfig = {
|
|
301
305
|
endpoint: string;
|
|
302
306
|
region: string;
|
|
@@ -315,12 +319,12 @@ type AttachmentStorageConfig = {
|
|
|
315
319
|
s3: S3AttachmentConfig;
|
|
316
320
|
};
|
|
317
321
|
type Environment = Readonly<Record<string, string | undefined>>;
|
|
318
|
-
declare function normalizeS3AttachmentPrefix(prefix: string): string;
|
|
319
|
-
declare function parseAttachmentStorageConfig(env?: Environment): AttachmentStorageConfig;
|
|
322
|
+
export declare function normalizeS3AttachmentPrefix(prefix: string): string;
|
|
323
|
+
export declare function parseAttachmentStorageConfig(env?: Environment): AttachmentStorageConfig;
|
|
320
324
|
//#endregion
|
|
321
325
|
//#region src/storage/s3/keying.d.ts
|
|
322
|
-
declare function deriveS3AttachmentKey(hash: string, prefix: string): string;
|
|
323
|
-
declare function sha256HexToBase64(hash: string): string;
|
|
326
|
+
export declare function deriveS3AttachmentKey(hash: string, prefix: string): string;
|
|
327
|
+
export declare function sha256HexToBase64(hash: string): string;
|
|
324
328
|
//#endregion
|
|
325
329
|
//#region src/storage/s3/primitives.d.ts
|
|
326
330
|
interface S3CommandClient {
|
|
@@ -332,7 +336,7 @@ type Dependencies = {
|
|
|
332
336
|
presign?: S3Presigner;
|
|
333
337
|
now?: () => Date;
|
|
334
338
|
};
|
|
335
|
-
declare class S3AttachmentPrimitives {
|
|
339
|
+
export declare class S3AttachmentPrimitives {
|
|
336
340
|
readonly config: S3AttachmentConfig;
|
|
337
341
|
readonly client: S3CommandClient;
|
|
338
342
|
readonly presign: S3Presigner;
|
|
@@ -345,7 +349,7 @@ declare class S3AttachmentPrimitives {
|
|
|
345
349
|
createUploadTarget(hash: string, mimeType: string, ttlSeconds?: number): Promise<AttachmentUploadTarget>;
|
|
346
350
|
createDownloadTarget(hash: string, ttlSeconds?: number): Promise<AttachmentDownloadTarget>;
|
|
347
351
|
}
|
|
348
|
-
declare function createS3AttachmentPrimitives(config: S3AttachmentConfig, dependencies?: Dependencies): S3AttachmentPrimitives;
|
|
352
|
+
export declare function createS3AttachmentPrimitives(config: S3AttachmentConfig, dependencies?: Dependencies): S3AttachmentPrimitives;
|
|
349
353
|
//#endregion
|
|
350
354
|
//#region src/storage/s3/backend.d.ts
|
|
351
355
|
type S3AttachmentBackendDependencies = {
|
|
@@ -356,7 +360,7 @@ type S3AttachmentBackendDependencies = {
|
|
|
356
360
|
downloadTtlSeconds?: number;
|
|
357
361
|
};
|
|
358
362
|
/** Server-only S3 capability. Callers complete authorization before download. */
|
|
359
|
-
declare class S3AttachmentBackend implements IAttachmentBackend {
|
|
363
|
+
export declare class S3AttachmentBackend implements IAttachmentBackend {
|
|
360
364
|
private readonly db;
|
|
361
365
|
readonly config: S3AttachmentConfig;
|
|
362
366
|
readonly kind: "s3";
|
|
@@ -370,12 +374,13 @@ declare class S3AttachmentBackend implements IAttachmentBackend {
|
|
|
370
374
|
exists(hash: AttachmentHash): Promise<boolean>;
|
|
371
375
|
health(): Promise<AttachmentBackendHealth>;
|
|
372
376
|
}
|
|
373
|
-
declare function createS3AttachmentBackend(db: Kysely<AttachmentDatabase>, config: S3AttachmentConfig, dependencies?: S3AttachmentBackendDependencies): S3AttachmentBackend;
|
|
377
|
+
export declare function createS3AttachmentBackend(db: Kysely<AttachmentDatabase>, config: S3AttachmentConfig, dependencies?: S3AttachmentBackendDependencies): S3AttachmentBackend;
|
|
374
378
|
//#endregion
|
|
375
379
|
//#region src/storage/s3/upload-factory.d.ts
|
|
376
|
-
declare class S3AttachmentUploadFactory implements IAttachmentUploadFactory {
|
|
380
|
+
export declare class S3AttachmentUploadFactory implements IAttachmentUploadFactory {
|
|
377
381
|
createUpload(reservation: Reservation): IAttachmentUpload;
|
|
378
382
|
}
|
|
379
383
|
//#endregion
|
|
380
|
-
export {
|
|
384
|
+
export { AttachmentAlreadyExists, type AttachmentBackendHealth, type AttachmentBackendKind, type AttachmentBuildResult, type AttachmentDatabase, type AttachmentDownloadOptions, type AttachmentDownloadTarget, type AttachmentHeader, type AttachmentMetadata, AttachmentNotFound, AttachmentPending, type AttachmentReferenceIndexBuildResult, type AttachmentReferenceInput, type AttachmentReferenceMigrationResult, type AttachmentResponse, type AttachmentSendOptions, AttachmentService, type AttachmentStatOptions, type AttachmentStatus, type AttachmentStorageConfig, type AttachmentTargetHeaders, AttachmentTransferError, type AttachmentTransferStage, type AttachmentTransportConfig, type AttachmentUploadRequest, type AttachmentUploadResponse, type AttachmentUploadResult, type AttachmentUploadTarget, type AttachmentUploadTransport, type CompiledAttachmentExtractor, type FilesystemAttachmentBackendConfig, type HashFirstReserveAttachmentOptions, HashMismatch, type IAttachmentBackend, type IAttachmentReader, type IAttachmentReferenceReader, type IAttachmentReferenceWriter, type IAttachmentSchemaCompiler, type IAttachmentService, type IAttachmentStore, type IAttachmentTransport, type IAttachmentTransportFactory, type IAttachmentUpload, type IAttachmentUploadFactory, type IReservationStore, InvalidAttachmentRef, NullAttachmentTransport, type ParsedRef, RemoteAttachmentStore, RemoteAttachmentUpload, RemoteAttachmentUploadFactory, RemoteReservationStore, type Reservation, ReservationNotFound, type ReserveAttachmentOptions, type S3AttachmentBackendDependencies, type S3AttachmentConfig, type S3CommandClient, type S3Presigner, SizeMismatch, SwitchboardAttachmentTransport, type SwitchboardClientConfig, type SwitchboardTransportConfig, type TransportFetchResult, type TransportResponse, type UploadFirstReserveAttachmentOptions, UploadTooLarge, type XhrUploadTransportOptions, createFetchUploadTransport, createRef, createRemoteAttachmentService, createXhrUploadTransport, parseAttachmentDownloadTarget, parseAttachmentUploadTarget, parseRef };
|
|
385
|
+
export {};
|
|
381
386
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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/direct/filesystem-attachment-backend.ts","../src/attachment-builder.ts","../src/reference-index/types.ts","../src/reference-index/attachment-schema-compiler.ts","../src/read-models/attachment-reference/types.ts","../src/read-models/attachment-reference/index-builder.ts","../src/read-models/attachment-reference/attachment-reference-read-model.ts","../src/read-models/attachment-reference/storage/types.ts","../src/read-models/attachment-reference/kysely-attachment-reference-store.ts","../src/read-models/attachment-reference/storage/migrations/migrator.ts","../src/storage/s3/config.ts","../src/storage/s3/keying.ts","../src/storage/s3/primitives.ts","../src/storage/s3/backend.ts","../src/storage/s3/upload-factory.ts"],"mappings":"
|
|
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/direct/filesystem-attachment-backend.ts","../src/attachment-builder.ts","../src/reference-index/types.ts","../src/reference-index/attachment-schema-compiler.ts","../src/read-models/attachment-reference/types.ts","../src/read-models/attachment-reference/index-builder.ts","../src/read-models/attachment-reference/attachment-reference-read-model.ts","../src/read-models/attachment-reference/storage/types.ts","../src/read-models/attachment-reference/kysely-attachment-reference-store.ts","../src/read-models/attachment-reference/storage/migrations/migrator.ts","../src/storage/s3/config.ts","../src/storage/s3/keying.ts","../src/storage/s3/primitives.ts","../src/storage/s3/backend.ts","../src/storage/s3/upload-factory.ts"],"mappings":"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"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as UploadTooLarge, S as SizeMismatch, _ as AttachmentPending, a as RemoteAttachmentUpload, b as InvalidAttachmentRef, c as createFetchUploadTransport, d as createRef, f as parseRef, g as AttachmentNotFound, h as AttachmentAlreadyExists, i as RemoteAttachmentUploadFactory, l as SwitchboardAttachmentTransport, m as parseAttachmentUploadTarget, n as createRemoteAttachmentService, o as RemoteReservationStore, p as parseAttachmentDownloadTarget, r as RemoteAttachmentStore, s as createXhrUploadTransport, t as NullAttachmentTransport, u as AttachmentService, v as AttachmentTransferError, x as ReservationNotFound, y as HashMismatch } from "./null-attachment-transport-
|
|
1
|
+
import { C as UploadTooLarge, S as SizeMismatch, _ as AttachmentPending, a as RemoteAttachmentUpload, b as InvalidAttachmentRef, c as createFetchUploadTransport, d as createRef, f as parseRef, g as AttachmentNotFound, h as AttachmentAlreadyExists, i as RemoteAttachmentUploadFactory, l as SwitchboardAttachmentTransport, m as parseAttachmentUploadTarget, n as createRemoteAttachmentService, o as RemoteReservationStore, p as parseAttachmentDownloadTarget, r as RemoteAttachmentStore, s as createXhrUploadTransport, t as NullAttachmentTransport, u as AttachmentService, v as AttachmentTransferError, x as ReservationNotFound, y as HashMismatch } from "./null-attachment-transport-D53Rz9lE.js";
|
|
2
2
|
import { dirname, join } from "node:path";
|
|
3
3
|
import { Migrator, sql } from "kysely";
|
|
4
4
|
import { mkdir, rename, rm } from "node:fs/promises";
|
|
@@ -262,6 +262,9 @@ function wrapStreamWithCleanup(source, cleanup) {
|
|
|
262
262
|
});
|
|
263
263
|
}
|
|
264
264
|
var KyselyAttachmentStore = class {
|
|
265
|
+
db;
|
|
266
|
+
transport;
|
|
267
|
+
basePath;
|
|
265
268
|
activeReaders = /* @__PURE__ */ new Map();
|
|
266
269
|
constructor(db, transport, basePath) {
|
|
267
270
|
this.db = db;
|
|
@@ -290,18 +293,10 @@ var KyselyAttachmentStore = class {
|
|
|
290
293
|
async has(hash) {
|
|
291
294
|
return (await this.db.selectFrom("attachment").select("status").where("hash", "=", hash).executeTakeFirst())?.status === "available";
|
|
292
295
|
}
|
|
293
|
-
async get(hash, signal) {
|
|
296
|
+
async get(hash, signal, documentId) {
|
|
294
297
|
const row = await this.db.selectFrom("attachment").selectAll().where("hash", "=", hash).executeTakeFirst();
|
|
295
298
|
if (row) {
|
|
296
|
-
if (row.status === "evicted")
|
|
297
|
-
const remote = await this.transport.fetch(hash, signal);
|
|
298
|
-
if (remote.kind === "data") {
|
|
299
|
-
await this.put(hash, remote.response.metadata, remote.response.body);
|
|
300
|
-
return this.get(hash, signal);
|
|
301
|
-
}
|
|
302
|
-
if (remote.kind === "pending") throw new AttachmentPending(hash, remote.expiresAtUtc);
|
|
303
|
-
throw new AttachmentNotFound(hash);
|
|
304
|
-
}
|
|
299
|
+
if (row.status === "evicted") return this.fetchRemote(hash, signal, documentId);
|
|
305
300
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
306
301
|
await this.db.updateTable("attachment").set({ last_accessed_at_utc: now }).where("hash", "=", hash).execute();
|
|
307
302
|
const header = rowToHeader$1(row);
|
|
@@ -319,13 +314,7 @@ var KyselyAttachmentStore = class {
|
|
|
319
314
|
fileName: pending.file_name,
|
|
320
315
|
sizeBytes: pending.size_bytes
|
|
321
316
|
});
|
|
322
|
-
|
|
323
|
-
if (remote.kind === "data") {
|
|
324
|
-
await this.put(hash, remote.response.metadata, remote.response.body);
|
|
325
|
-
return this.get(hash, signal);
|
|
326
|
-
}
|
|
327
|
-
if (remote.kind === "pending") throw new AttachmentPending(hash, remote.expiresAtUtc);
|
|
328
|
-
throw new AttachmentNotFound(hash);
|
|
317
|
+
return this.fetchRemote(hash, signal, documentId);
|
|
329
318
|
}
|
|
330
319
|
async put(hash, metadata, data) {
|
|
331
320
|
const existing = await this.db.selectFrom("attachment").select(["hash", "status"]).where("hash", "=", hash).executeTakeFirst();
|
|
@@ -365,6 +354,16 @@ var KyselyAttachmentStore = class {
|
|
|
365
354
|
const result = await this.db.selectFrom("attachment").select(sql`COALESCE(SUM(size_bytes), 0)`.as("total")).where("status", "=", "available").executeTakeFirst();
|
|
366
355
|
return Number(result?.total ?? 0);
|
|
367
356
|
}
|
|
357
|
+
async fetchRemote(hash, signal, documentId) {
|
|
358
|
+
if (documentId === void 0) throw new AttachmentNotFound(hash);
|
|
359
|
+
const remote = await this.transport.fetch(hash, documentId, signal);
|
|
360
|
+
if (remote.kind === "data") {
|
|
361
|
+
await this.put(hash, remote.response.metadata, remote.response.body);
|
|
362
|
+
return this.get(hash, signal);
|
|
363
|
+
}
|
|
364
|
+
if (remote.kind === "pending") throw new AttachmentPending(hash, remote.expiresAtUtc);
|
|
365
|
+
throw new AttachmentNotFound(hash);
|
|
366
|
+
}
|
|
368
367
|
async findPendingReservation(hash, now) {
|
|
369
368
|
const row = await this.db.selectFrom("attachment_reservation as r").leftJoin("attachment as a", "a.hash", "r.client_hash").select([
|
|
370
369
|
"r.mime_type",
|
|
@@ -398,7 +397,7 @@ var KyselyAttachmentStore = class {
|
|
|
398
397
|
};
|
|
399
398
|
//#endregion
|
|
400
399
|
//#region src/storage/kysely/reservation-store.ts
|
|
401
|
-
const DEFAULT_RESERVATION_TTL_MS =
|
|
400
|
+
const DEFAULT_RESERVATION_TTL_MS = 864e5;
|
|
402
401
|
function rowToReservation(row) {
|
|
403
402
|
return {
|
|
404
403
|
reservationId: row.reservation_id,
|
|
@@ -412,6 +411,7 @@ function rowToReservation(row) {
|
|
|
412
411
|
};
|
|
413
412
|
}
|
|
414
413
|
var KyselyReservationStore = class {
|
|
414
|
+
db;
|
|
415
415
|
ttlMs;
|
|
416
416
|
constructor(db, ttlMs = DEFAULT_RESERVATION_TTL_MS) {
|
|
417
417
|
this.db = db;
|
|
@@ -601,6 +601,11 @@ function rowToHeader(row) {
|
|
|
601
601
|
};
|
|
602
602
|
}
|
|
603
603
|
var DirectAttachmentUpload = class {
|
|
604
|
+
reservation;
|
|
605
|
+
db;
|
|
606
|
+
basePath;
|
|
607
|
+
reservations;
|
|
608
|
+
maxBytes;
|
|
604
609
|
reservationId;
|
|
605
610
|
ref;
|
|
606
611
|
expiresAtUtc;
|
|
@@ -670,6 +675,10 @@ var DirectAttachmentUpload = class {
|
|
|
670
675
|
//#endregion
|
|
671
676
|
//#region src/direct/direct-attachment-upload-factory.ts
|
|
672
677
|
var DirectAttachmentUploadFactory = class {
|
|
678
|
+
db;
|
|
679
|
+
basePath;
|
|
680
|
+
reservations;
|
|
681
|
+
maxBytes;
|
|
673
682
|
constructor(db, basePath, reservations, maxBytes) {
|
|
674
683
|
this.db = db;
|
|
675
684
|
this.basePath = basePath;
|
|
@@ -688,6 +697,8 @@ var DirectAttachmentUploadFactory = class {
|
|
|
688
697
|
* can never accidentally return a direct-provider target.
|
|
689
698
|
*/
|
|
690
699
|
var FilesystemAttachmentBackend = class {
|
|
700
|
+
store;
|
|
701
|
+
config;
|
|
691
702
|
kind = "filesystem";
|
|
692
703
|
constructor(store, config) {
|
|
693
704
|
this.store = store;
|
|
@@ -739,6 +750,8 @@ var S3AttachmentUploadFactory = class {
|
|
|
739
750
|
//#endregion
|
|
740
751
|
//#region src/attachment-builder.ts
|
|
741
752
|
var AttachmentBuilder = class {
|
|
753
|
+
db;
|
|
754
|
+
storagePath;
|
|
742
755
|
transport = new NullAttachmentTransport();
|
|
743
756
|
customUploadFactory;
|
|
744
757
|
maxUploadBytes;
|
|
@@ -811,7 +824,7 @@ var AttachmentBuilder = class {
|
|
|
811
824
|
//#endregion
|
|
812
825
|
//#region src/reference-index/attachment-schema-compiler.ts
|
|
813
826
|
const ATTACHMENT_REF_TYPE = "AttachmentRef";
|
|
814
|
-
const CODEGEN_SCALAR_NAMES = new Set([
|
|
827
|
+
const CODEGEN_SCALAR_NAMES = /* @__PURE__ */ new Set([
|
|
815
828
|
"Unknown",
|
|
816
829
|
"DateTime",
|
|
817
830
|
"Address",
|
|
@@ -859,11 +872,12 @@ function buildEffectiveSchema(specification, context) {
|
|
|
859
872
|
const stateSchemas = Object.values(specification.state).map((state) => state.schema);
|
|
860
873
|
const operationSchemas = specification.modules.flatMap((moduleSpecification) => moduleSpecification.operations.flatMap((operation) => operation.schema === null ? [] : [operation.schema]));
|
|
861
874
|
try {
|
|
862
|
-
|
|
875
|
+
const document = parse([
|
|
863
876
|
...scalarSchemas,
|
|
864
877
|
...stateSchemas,
|
|
865
878
|
...operationSchemas
|
|
866
|
-
].filter(Boolean).join("\n\n"))
|
|
879
|
+
].filter(Boolean).join("\n\n"));
|
|
880
|
+
return buildASTSchema(dedupeTypeDefinitions(document));
|
|
867
881
|
} catch {
|
|
868
882
|
throw compilationError(context, "the effective GraphQL schema is invalid");
|
|
869
883
|
}
|
|
@@ -1001,6 +1015,8 @@ function extractValue(plan, value, path, context, refs, seenRefs, activeObjects)
|
|
|
1001
1015
|
}
|
|
1002
1016
|
}
|
|
1003
1017
|
var SchemaCompiledAttachmentExtractor = class {
|
|
1018
|
+
context;
|
|
1019
|
+
rootPlan;
|
|
1004
1020
|
constructor(context, rootPlan) {
|
|
1005
1021
|
this.context = context;
|
|
1006
1022
|
this.rootPlan = rootPlan;
|
|
@@ -1063,12 +1079,16 @@ var AttachmentSchemaCompiler = class {
|
|
|
1063
1079
|
//#endregion
|
|
1064
1080
|
//#region src/read-models/attachment-reference/kysely-attachment-reference-store.ts
|
|
1065
1081
|
var KyselyAttachmentReferenceStore = class {
|
|
1082
|
+
db;
|
|
1066
1083
|
constructor(db) {
|
|
1067
1084
|
this.db = db;
|
|
1068
1085
|
}
|
|
1069
1086
|
async hasReference(documentId, ref) {
|
|
1070
1087
|
return await this.db.selectFrom("attachment_reference").select("document_id").where("document_id", "=", documentId).where("attachment_ref", "=", ref).executeTakeFirst() !== void 0;
|
|
1071
1088
|
}
|
|
1089
|
+
async referencingScopes(documentId, ref) {
|
|
1090
|
+
return (await this.db.selectFrom("attachment_reference").select("scope").distinct().where("document_id", "=", documentId).where("attachment_ref", "=", ref).execute()).map((row) => row.scope);
|
|
1091
|
+
}
|
|
1072
1092
|
async addReferences(references) {
|
|
1073
1093
|
if (references.length === 0) return;
|
|
1074
1094
|
await this.db.insertInto("attachment_reference").values(references.map((reference) => ({
|
|
@@ -1160,6 +1180,7 @@ async function getAttachmentReferenceMigrationStatus(db, schema = ATTACHMENT_REF
|
|
|
1160
1180
|
//#endregion
|
|
1161
1181
|
//#region src/read-models/attachment-reference/index-builder.ts
|
|
1162
1182
|
var AttachmentReferenceIndexBuilder = class {
|
|
1183
|
+
db;
|
|
1163
1184
|
constructor(db) {
|
|
1164
1185
|
this.db = db;
|
|
1165
1186
|
}
|
|
@@ -1182,6 +1203,9 @@ const ATTACHMENT_REFERENCE_READ_MODEL_ID = "attachment-reference-read-model";
|
|
|
1182
1203
|
* for.
|
|
1183
1204
|
*/
|
|
1184
1205
|
var AttachmentReferenceReadModel = class extends BaseReadModel {
|
|
1206
|
+
documentModelRegistry;
|
|
1207
|
+
schemaCompiler;
|
|
1208
|
+
referenceWriter;
|
|
1185
1209
|
indexingQueue = Promise.resolve();
|
|
1186
1210
|
checkpointTarget;
|
|
1187
1211
|
/**
|
|
@@ -1351,7 +1375,7 @@ function required(env, name) {
|
|
|
1351
1375
|
if (value.trim() !== value) throw new Error(`${name} must not have leading or trailing whitespace`);
|
|
1352
1376
|
return value;
|
|
1353
1377
|
}
|
|
1354
|
-
const LOOPBACK_HOSTNAMES = new Set([
|
|
1378
|
+
const LOOPBACK_HOSTNAMES = /* @__PURE__ */ new Set([
|
|
1355
1379
|
"127.0.0.1",
|
|
1356
1380
|
"localhost",
|
|
1357
1381
|
"[::1]"
|
|
@@ -1433,9 +1457,10 @@ function sha256HexToBase64(hash) {
|
|
|
1433
1457
|
//#region src/storage/s3/primitives.ts
|
|
1434
1458
|
const defaultPresigner = (client, command, expiresInSeconds) => getSignedUrl(client, command, {
|
|
1435
1459
|
expiresIn: expiresInSeconds,
|
|
1436
|
-
unhoistableHeaders: new Set(["x-amz-checksum-sha256"])
|
|
1460
|
+
unhoistableHeaders: /* @__PURE__ */ new Set(["x-amz-checksum-sha256"])
|
|
1437
1461
|
});
|
|
1438
1462
|
var S3AttachmentPrimitives = class {
|
|
1463
|
+
config;
|
|
1439
1464
|
client;
|
|
1440
1465
|
presign;
|
|
1441
1466
|
now;
|
|
@@ -1506,7 +1531,7 @@ function createS3AttachmentPrimitives(config, dependencies = {}) {
|
|
|
1506
1531
|
//#endregion
|
|
1507
1532
|
//#region src/storage/s3/backend.ts
|
|
1508
1533
|
const READINESS_PROBE_HASH = "0".repeat(64);
|
|
1509
|
-
const OBJECT_NOT_FOUND_NAMES = new Set([
|
|
1534
|
+
const OBJECT_NOT_FOUND_NAMES = /* @__PURE__ */ new Set([
|
|
1510
1535
|
"NotFound",
|
|
1511
1536
|
"NoSuchKey",
|
|
1512
1537
|
"NoSuchObject"
|
|
@@ -1524,6 +1549,8 @@ function requireHashFirstReservation(reservation) {
|
|
|
1524
1549
|
}
|
|
1525
1550
|
/** Server-only S3 capability. Callers complete authorization before download. */
|
|
1526
1551
|
var S3AttachmentBackend = class {
|
|
1552
|
+
db;
|
|
1553
|
+
config;
|
|
1527
1554
|
kind = "s3";
|
|
1528
1555
|
primitives;
|
|
1529
1556
|
now;
|