@voltro/plugin-storage 0.71.1 → 0.72.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +383 -0
- package/THIRD-PARTY-NOTICES.md +29 -1
- package/dist/index.d.ts +85 -1
- package/dist/index.js +858 -505
- package/dist/types.d.ts +13 -0
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -318,6 +318,49 @@ export declare interface ListRefsResult {
|
|
|
318
318
|
readonly nextOffset: number | null;
|
|
319
319
|
}
|
|
320
320
|
|
|
321
|
+
/** DataStore-backed metadata boundary, intentionally no provider access. The
|
|
322
|
+
* service must use reserve -> provider.put -> confirm and retain failed intents. */
|
|
323
|
+
export declare const makeStorageObjectMetadata: (store: DataStore) => {
|
|
324
|
+
/** The put intent a reference was written under, if it was written through an operation at all. */
|
|
325
|
+
intent: (refId: string) => Promise<{
|
|
326
|
+
identity: {
|
|
327
|
+
readonly tenantId: string | null;
|
|
328
|
+
readonly bucket: string;
|
|
329
|
+
readonly fingerprint: string;
|
|
330
|
+
readonly checksum: string;
|
|
331
|
+
readonly operationId: string;
|
|
332
|
+
readonly logicalKey: string;
|
|
333
|
+
};
|
|
334
|
+
ref: StorageRef;
|
|
335
|
+
} | undefined>;
|
|
336
|
+
reserve: (identity: StorageObjectIdentity, proposed: StorageRef, quota?: StorageQuota) => Promise<{
|
|
337
|
+
ref: StorageRef;
|
|
338
|
+
ready: boolean;
|
|
339
|
+
}>;
|
|
340
|
+
confirm: (identity: StorageObjectIdentity) => Promise<StorageRef>;
|
|
341
|
+
beginDelete: (refId: string, tenantId?: string | null) => Promise<{
|
|
342
|
+
operation: {
|
|
343
|
+
readonly id: string;
|
|
344
|
+
readonly key: string;
|
|
345
|
+
readonly fingerprint: string;
|
|
346
|
+
readonly generation: string;
|
|
347
|
+
readonly state: "ready" | "reserved" | "deleting" | "deleted";
|
|
348
|
+
readonly refId: string;
|
|
349
|
+
readonly objectId: string;
|
|
350
|
+
readonly deleteKey: string | null;
|
|
351
|
+
};
|
|
352
|
+
identity: {
|
|
353
|
+
readonly tenantId: string | null;
|
|
354
|
+
readonly bucket: string;
|
|
355
|
+
readonly fingerprint: string;
|
|
356
|
+
readonly checksum: string;
|
|
357
|
+
readonly operationId: string;
|
|
358
|
+
readonly logicalKey: string;
|
|
359
|
+
};
|
|
360
|
+
}>;
|
|
361
|
+
confirmDelete: (identity: StorageObjectIdentity) => Promise<boolean>;
|
|
362
|
+
};
|
|
363
|
+
|
|
321
364
|
export declare const memoryGrantStore: () => GrantStore;
|
|
322
365
|
|
|
323
366
|
export declare const memoryProvider: (instance?: string) => StorageProvider;
|
|
@@ -400,6 +443,17 @@ export declare interface PutInput {
|
|
|
400
443
|
readonly derivedFrom?: string;
|
|
401
444
|
/** Derivative label — `'rendition'` / `'poster'` (internal). */
|
|
402
445
|
readonly kind?: string;
|
|
446
|
+
/**
|
|
447
|
+
* The RESUMABLE identity of this put. Two calls with the same `operationId`
|
|
448
|
+
* (a retry after a network failure, two replicas completing the same job)
|
|
449
|
+
* resolve to ONE reference: the second finds the first's reservation and
|
|
450
|
+
* returns its ref, or finishes what the first left half-done. Without it a
|
|
451
|
+
* put is a fresh object every time — and a retried put beside its winner
|
|
452
|
+
* left a second reference on the same key whose bytes outlived the winner's
|
|
453
|
+
* delete. Any stable string the caller owns (a job id, a message id).
|
|
454
|
+
* Needs a bound data store; the in-memory ref store cannot hold intents.
|
|
455
|
+
*/
|
|
456
|
+
readonly operationId?: string;
|
|
403
457
|
}
|
|
404
458
|
|
|
405
459
|
/**
|
|
@@ -643,7 +697,7 @@ export declare type StorageGuard = (ctx: {
|
|
|
643
697
|
*/
|
|
644
698
|
export declare const storageInstanceName: (options?: StoragePluginOptions) => string;
|
|
645
699
|
|
|
646
|
-
declare interface StorageObjectIdentity {
|
|
700
|
+
export declare interface StorageObjectIdentity {
|
|
647
701
|
readonly tenantId: string | null;
|
|
648
702
|
readonly bucket: string;
|
|
649
703
|
readonly operationId: string;
|
|
@@ -655,6 +709,29 @@ declare interface StorageObjectIdentity {
|
|
|
655
709
|
readonly logicalKey: string;
|
|
656
710
|
}
|
|
657
711
|
|
|
712
|
+
/** Internal persistence substrate. Service wiring must commit quota and refs in
|
|
713
|
+
* the same transaction as these transitions; never run provider I/O here. */
|
|
714
|
+
export declare const storageObjectLifecycleTables: ( Table<"_voltro_storage_operation_locks", FieldDefinitions<{
|
|
715
|
+
readonly id: ColumnBuilder<string, "text", boolean>;
|
|
716
|
+
readonly nonce: ColumnBuilder<string, "text", boolean>;
|
|
717
|
+
}>, false, never> | Table<"_voltro_storage_object_heads", FieldDefinitions<{
|
|
718
|
+
readonly id: ColumnBuilder<string, "text", boolean>;
|
|
719
|
+
readonly generation: ColumnBuilder<string, "text", boolean>;
|
|
720
|
+
readonly key: ColumnBuilder<string, "text", boolean>;
|
|
721
|
+
readonly reservations: ColumnBuilder<number, "integer", boolean>;
|
|
722
|
+
}>, false, never> | Table<"_voltro_storage_operations", FieldDefinitions<{
|
|
723
|
+
readonly id: ColumnBuilder<string, "text", boolean>;
|
|
724
|
+
readonly objectId: ColumnBuilder<string, "text", boolean>;
|
|
725
|
+
readonly fingerprint: ColumnBuilder<string, "text", boolean>;
|
|
726
|
+
readonly generation: ColumnBuilder<string, "text", boolean>;
|
|
727
|
+
readonly key: ColumnBuilder<string, "text", boolean>;
|
|
728
|
+
readonly refId: ColumnBuilder<string, "text", boolean>;
|
|
729
|
+
readonly state: ColumnBuilder<string, "text", boolean>;
|
|
730
|
+
readonly deleteKey: ColumnBuilder<string | null, "text", boolean>;
|
|
731
|
+
}>, false, never>)[];
|
|
732
|
+
|
|
733
|
+
export declare type StorageObjectMetadata = ReturnType<typeof makeStorageObjectMetadata>;
|
|
734
|
+
|
|
658
735
|
export declare const storagePlugin: (options?: StoragePluginOptions) => VoltroPlugin;
|
|
659
736
|
|
|
660
737
|
export declare interface StoragePluginOptions {
|
|
@@ -1007,6 +1084,11 @@ export declare interface StorageServiceOptions {
|
|
|
1007
1084
|
* the cap — and refunded if the write fails. Exceeding it fails with
|
|
1008
1085
|
* `StorageRejected` (reason `'quota-exceeded'`) before any bytes land. */
|
|
1009
1086
|
readonly quota?: StorageQuota;
|
|
1087
|
+
/** The durable object-operation boundary a `put` with an `operationId` and
|
|
1088
|
+
* the matching `delete` go through. Read at call time: the plugin binds it
|
|
1089
|
+
* once the app's data store exists, and `undefined` before that means an
|
|
1090
|
+
* `operationId` put is refused rather than silently made non-resumable. */
|
|
1091
|
+
readonly objects?: () => StorageObjectMetadata | undefined;
|
|
1010
1092
|
}
|
|
1011
1093
|
|
|
1012
1094
|
/** The service handlers consume: `const storage = yield* StorageService`. */
|
|
@@ -1129,6 +1211,8 @@ export declare interface StorageServiceShape {
|
|
|
1129
1211
|
readonly abortSignal?: AbortSignal;
|
|
1130
1212
|
readonly contentType?: string;
|
|
1131
1213
|
readonly tenantId?: string | null;
|
|
1214
|
+
/** The resumable identity of this ingest — see `PutInput.operationId`. */
|
|
1215
|
+
readonly operationId?: string;
|
|
1132
1216
|
readonly ownerId?: string | null;
|
|
1133
1217
|
readonly visibility?: StorageVisibility;
|
|
1134
1218
|
readonly key?: string;
|