@voltro/plugin-storage 0.71.1 → 0.73.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.
@@ -5,7 +5,7 @@ property of its respective copyright holders and is used under the terms of
5
5
  its license. This file is provided for attribution; it grants no rights in
6
6
  @voltro/plugin-storage itself, which is proprietary (see LICENSE).
7
7
 
8
- Generated from the resolved runtime dependency closure (118 packages).
8
+ Generated from the resolved runtime dependency closure (119 packages).
9
9
 
10
10
  ---
11
11
 
@@ -3928,6 +3928,34 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3928
3928
  SOFTWARE.
3929
3929
  ```
3930
3930
 
3931
+ ## @effect/experimental@0.61.1
3932
+
3933
+ License: MIT
3934
+
3935
+ ```
3936
+ MIT License
3937
+
3938
+ Copyright (c) 2023-present The Contributors
3939
+
3940
+ Permission is hereby granted, free of charge, to any person obtaining a copy
3941
+ of this software and associated documentation files (the "Software"), to deal
3942
+ in the Software without restriction, including without limitation the rights
3943
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3944
+ copies of the Software, and to permit persons to whom the Software is
3945
+ furnished to do so, subject to the following conditions:
3946
+
3947
+ The above copyright notice and this permission notice shall be included in all
3948
+ copies or substantial portions of the Software.
3949
+
3950
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3951
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3952
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3953
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3954
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3955
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3956
+ SOFTWARE.
3957
+ ```
3958
+
3931
3959
  ## @effect/platform-node@0.108.1
3932
3960
 
3933
3961
  License: MIT
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;