@voltro/plugin-storage 0.73.0 → 0.75.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/dist/types.d.ts CHANGED
@@ -136,8 +136,29 @@ export declare interface PutInput {
136
136
  * Needs a bound data store; the in-memory ref store cannot hold intents.
137
137
  */
138
138
  readonly operationId?: string;
139
+ /**
140
+ * This caller's CLAIM on the operation's object, any stable string the
141
+ * caller owns (an attempt id, a replica id). Two callers completing the same
142
+ * `operationId` share one ref; each holds its own claim, registered when it
143
+ * receives the ref. `delete(id, { claim })` releases only that claim and the
144
+ * object goes with the LAST one — so a caller that fails and cleans up what
145
+ * it put cannot delete the file another caller already kept. The same claim
146
+ * repeated is one claim. Requires `operationId`; refused otherwise
147
+ * (`StorageRejected`, `'claim-without-operation'`).
148
+ */
149
+ readonly claim?: string;
139
150
  }
140
151
 
152
+ /**
153
+ * What a `put` did to its object. A plain put is always `'created'`. With an
154
+ * `operationId`: `'created'` reserved the operation, `'resumed'` found it
155
+ * half-done and finished the write, `'joined'` found it finished and took its
156
+ * ref. Informational — ownership is the `claim`, not the outcome: "only clean
157
+ * up what I created" deletes a joiner's kept file whenever the creator is the
158
+ * caller that fails.
159
+ */
160
+ export declare type PutOutcome = 'created' | 'resumed' | 'joined';
161
+
141
162
  /** One derived output a `Transcoder` produces from a source asset. Each becomes
142
163
  * a normal storage ref linked back to the original via `derivedFrom`. */
143
164
  export declare interface Rendition {
@@ -372,7 +393,8 @@ declare const StorageService_base: Context.TagClass<StorageService, "@voltro/plu
372
393
 
373
394
  /** The service handlers consume: `const storage = yield* StorageService`. */
374
395
  export declare interface StorageServiceShape {
375
- readonly put: (input: PutInput) => Effect.Effect<StorageRef, StorageError | StorageRejected | StorageScanRejected>;
396
+ /** Store bytes. The result is the ref plus this call's `outcome`. */
397
+ readonly put: (input: PutInput) => Effect.Effect<StoredRef, StorageError | StorageRejected | StorageScanRejected>;
376
398
  /** Fetch an object's bytes by id. Enforces the tenant guard ONLY — it does
377
399
  * NOT run the access policy / grant check. Use this for trusted server-side
378
400
  * reads where the caller has already authorized the access; to deliver a
@@ -426,8 +448,15 @@ export declare interface StorageServiceShape {
426
448
  readonly ref: StorageRef;
427
449
  readonly totalSize: number;
428
450
  }, StorageError>;
451
+ /** Delete an object. Without a `claim` this is the WHOLE object, whatever
452
+ * claims it holds. With one, only that claim is released, and the object
453
+ * is deleted when it was the last (`PutInput.claim`). A claim that is not
454
+ * held, or named on a ref that was not written through an operation, is a
455
+ * `StorageError` with status 409 — nothing is deleted. Releasing a claim
456
+ * twice is a no-op. */
429
457
  readonly delete: (id: string, opts?: {
430
458
  readonly tenantId?: string | null;
459
+ readonly claim?: string;
431
460
  }) => Effect.Effect<void, StorageError>;
432
461
  /** Run the access check for `subject`, then return a URL that delivers
433
462
  * the bytes: a public/CDN URL, a presigned GET (s3/minio), or an app
@@ -628,6 +657,13 @@ export declare interface StoredObject {
628
657
  readonly contentType: string;
629
658
  }
630
659
 
660
+ /** What `put` returns: the stored ref, plus what this call did to it. The
661
+ * `outcome` is a fact about the CALL, not the row — it is never persisted and
662
+ * a ref read back from the store does not carry it. */
663
+ export declare type StoredRef = StorageRef & {
664
+ readonly outcome: PutOutcome;
665
+ };
666
+
631
667
  /** A streamed read from a provider — the object as a {@link ByteStream} plus
632
668
  * its content type and, when the backend reports it up front, its size. */
633
669
  export declare interface StoredStream {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltro/plugin-storage",
3
- "version": "0.73.0",
3
+ "version": "0.75.0",
4
4
  "description": "File-storage plugin — one StorageProvider contract, switchable backends (S3 / MinIO / Azure / filesystem / memory / database). Public (CDN-direct) + private (access policy + per-object grants) objects, upload constraints, virus-scan hook, on-the-fly image transforms.",
5
5
  "keywords": [
6
6
  "voltro",
@@ -43,9 +43,9 @@
43
43
  "node": ">=24.0.0"
44
44
  },
45
45
  "dependencies": {
46
- "@voltro/database": "0.73.0",
47
- "@voltro/env": "0.73.0",
48
- "@voltro/protocol": "0.73.0"
46
+ "@voltro/database": "0.75.0",
47
+ "@voltro/env": "0.75.0",
48
+ "@voltro/protocol": "0.75.0"
49
49
  },
50
50
  "optionalDependencies": {
51
51
  "@aws-sdk/client-s3": "^3.1126.0",