@voltro/plugin-storage 0.84.0 → 0.86.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 +1215 -0
- package/README.md +50 -0
- package/THIRD-PARTY-NOTICES.md +91 -365
- package/dist/access.js +47 -0
- package/dist/assetRef.js +13 -0
- package/dist/avatar.js +39 -0
- package/dist/constraints.js +93 -0
- package/dist/derivatives.js +30 -0
- package/dist/env.js +156 -0
- package/dist/grant.js +112 -0
- package/dist/index.d.ts +175 -65
- package/dist/index.js +620 -3072
- package/dist/ingest.js +81 -0
- package/dist/ingestPolicy.js +1 -0
- package/dist/metadataError.js +19 -0
- package/dist/objectLifecycle.js +209 -0
- package/dist/objectMetadata.js +150 -0
- package/dist/objectWriter.js +58 -0
- package/dist/pathDurability.js +16 -0
- package/dist/providers.js +493 -0
- package/dist/referenceCatalogue.js +31 -0
- package/dist/rpc.d.ts +212 -166
- package/dist/rpc.js +63 -40
- package/dist/scanners.js +46 -0
- package/dist/service.js +1084 -0
- package/dist/storageNamespaces.js +56 -0
- package/dist/storageNumbers.js +13 -0
- package/dist/storageObjectNamespaces.js +194 -0
- package/dist/storageReferenceInstances.js +52 -0
- package/dist/streamBridge.js +30 -0
- package/dist/table.js +53 -0
- package/dist/transcodeVideo.js +53 -0
- package/dist/transform.js +90 -0
- package/dist/transformCache.js +31 -0
- package/dist/types.d.ts +31 -45
- package/dist/types.js +5 -1
- package/package.json +6 -6
package/dist/types.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { Context } from 'effect';
|
|
2
2
|
import { Effect } from 'effect';
|
|
3
3
|
import { Schema } from 'effect';
|
|
4
|
+
import { StorageAccessPolicy } from '@voltro/protocol';
|
|
5
|
+
import { StorageAccessRule } from '@voltro/protocol';
|
|
4
6
|
import { Stream } from 'effect';
|
|
5
7
|
import { Subject } from '@voltro/protocol';
|
|
8
|
+
import { YieldableError } from 'effect/Cause';
|
|
6
9
|
|
|
7
|
-
export declare type AccessPolicy =
|
|
10
|
+
export declare type AccessPolicy = StorageAccessPolicy;
|
|
8
11
|
|
|
9
12
|
/**
|
|
10
13
|
* One access rule. A rule GRANTS when EVERY present condition is satisfied
|
|
@@ -12,24 +15,7 @@ export declare type AccessPolicy = ReadonlyArray<AccessRule>;
|
|
|
12
15
|
* grants (OR). An empty policy on a private object means owner-only (the
|
|
13
16
|
* implicit owner check always applies).
|
|
14
17
|
*/
|
|
15
|
-
export declare
|
|
16
|
-
/** `subject.id === ref.ownerId`. */
|
|
17
|
-
readonly owner?: boolean;
|
|
18
|
-
/** `subject.metadata.roles` intersects these. */
|
|
19
|
-
readonly roles?: ReadonlyArray<string>;
|
|
20
|
-
/** resolved groups (default `subject.metadata.groups`) intersect these. */
|
|
21
|
-
readonly groups?: ReadonlyArray<string>;
|
|
22
|
-
/** `subject.scopes` intersects these. */
|
|
23
|
-
readonly scopes?: ReadonlyArray<string>;
|
|
24
|
-
/** `subject.tenantId === ref.tenantId`. */
|
|
25
|
-
readonly tenant?: boolean;
|
|
26
|
-
/** subject is any authenticated api-key. */
|
|
27
|
-
readonly apiKey?: boolean;
|
|
28
|
-
/** a correct password was supplied (checked at mint, against passwordHash). */
|
|
29
|
-
readonly password?: boolean;
|
|
30
|
-
/** a named custom guard (`options.guards[name]`) returns true. */
|
|
31
|
-
readonly guard?: string;
|
|
32
|
-
}
|
|
18
|
+
export declare type AccessRule = StorageAccessRule;
|
|
33
19
|
|
|
34
20
|
/**
|
|
35
21
|
* A lazy stream of bytes — the streaming counterpart to {@link StoredObject}'s
|
|
@@ -178,12 +164,10 @@ export declare interface Rendition {
|
|
|
178
164
|
export declare class StorageAccessDenied extends StorageAccessDenied_base {
|
|
179
165
|
}
|
|
180
166
|
|
|
181
|
-
declare const StorageAccessDenied_base: Schema.
|
|
182
|
-
readonly
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
reason: typeof Schema.String;
|
|
186
|
-
}>;
|
|
167
|
+
declare const StorageAccessDenied_base: Schema.Class<StorageAccessDenied, Schema.TaggedStruct<"StorageAccessDenied", {
|
|
168
|
+
readonly refId: Schema.String;
|
|
169
|
+
readonly reason: Schema.String;
|
|
170
|
+
}>, YieldableError>;
|
|
187
171
|
|
|
188
172
|
/**
|
|
189
173
|
* Storage failure. `transient` drives retry — `true` for 429 / 5xx /
|
|
@@ -193,14 +177,12 @@ declare const StorageAccessDenied_base: Schema.TaggedErrorClass<StorageAccessDen
|
|
|
193
177
|
export declare class StorageError extends StorageError_base {
|
|
194
178
|
}
|
|
195
179
|
|
|
196
|
-
declare const StorageError_base: Schema.
|
|
197
|
-
readonly
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
status: Schema.optional<typeof Schema.Number>;
|
|
203
|
-
}>;
|
|
180
|
+
declare const StorageError_base: Schema.Class<StorageError, Schema.TaggedStruct<"StorageError", {
|
|
181
|
+
readonly provider: Schema.String;
|
|
182
|
+
readonly message: Schema.String;
|
|
183
|
+
readonly transient: Schema.Boolean;
|
|
184
|
+
readonly status: Schema.optional<Schema.Number>;
|
|
185
|
+
}>, YieldableError>;
|
|
204
186
|
|
|
205
187
|
/** A persisted, explicit share of one object with one principal. */
|
|
206
188
|
export declare interface StorageGrant {
|
|
@@ -226,6 +208,8 @@ export declare type StorageGuard = (ctx: {
|
|
|
226
208
|
* access policy.
|
|
227
209
|
*/
|
|
228
210
|
export declare interface StorageProvider {
|
|
211
|
+
/** Stable physical object-key namespace; exclude credentials and plugin aliases. */
|
|
212
|
+
readonly objectNamespace: Effect.Effect<string, StorageError>;
|
|
229
213
|
/**
|
|
230
214
|
* Where a FILESYSTEM provider writes. Absent for every other provider.
|
|
231
215
|
*
|
|
@@ -356,15 +340,14 @@ export declare interface StorageRef {
|
|
|
356
340
|
/** An upload was rejected by a constraint (size / content-type / magic-byte
|
|
357
341
|
* mismatch). `reason` is a stable code; `detail` is human-readable. */
|
|
358
342
|
export declare class StorageRejected extends StorageRejected_base {
|
|
343
|
+
get message(): string;
|
|
359
344
|
}
|
|
360
345
|
|
|
361
|
-
declare const StorageRejected_base: Schema.
|
|
362
|
-
readonly _tag: Schema.tag<"StorageRejected">;
|
|
363
|
-
} & {
|
|
346
|
+
declare const StorageRejected_base: Schema.Class<StorageRejected, Schema.TaggedStruct<"StorageRejected", {
|
|
364
347
|
/** `'too-large' | 'content-type-not-allowed' | 'content-mismatch'` */
|
|
365
|
-
reason:
|
|
366
|
-
detail:
|
|
367
|
-
}>;
|
|
348
|
+
readonly reason: Schema.String;
|
|
349
|
+
readonly detail: Schema.String;
|
|
350
|
+
}>, YieldableError>;
|
|
368
351
|
|
|
369
352
|
/** Scans bytes before they're stored. Return `{ clean:false, threat }` to
|
|
370
353
|
* reject the upload (fails with `StorageScanRejected`, nothing is stored). */
|
|
@@ -378,11 +361,9 @@ export declare type StorageScanner = (input: {
|
|
|
378
361
|
export declare class StorageScanRejected extends StorageScanRejected_base {
|
|
379
362
|
}
|
|
380
363
|
|
|
381
|
-
declare const StorageScanRejected_base: Schema.
|
|
382
|
-
readonly
|
|
383
|
-
}
|
|
384
|
-
threat: typeof Schema.String;
|
|
385
|
-
}>;
|
|
364
|
+
declare const StorageScanRejected_base: Schema.Class<StorageScanRejected, Schema.TaggedStruct<"StorageScanRejected", {
|
|
365
|
+
readonly threat: Schema.String;
|
|
366
|
+
}>, YieldableError>;
|
|
386
367
|
|
|
387
368
|
export declare interface StorageScanResult {
|
|
388
369
|
readonly clean: boolean;
|
|
@@ -393,10 +374,12 @@ export declare interface StorageScanResult {
|
|
|
393
374
|
export declare class StorageService extends StorageService_base {
|
|
394
375
|
}
|
|
395
376
|
|
|
396
|
-
declare const StorageService_base: Context.
|
|
377
|
+
declare const StorageService_base: Context.ServiceClass<StorageService, "@voltro/plugin-storage/StorageService", StorageServiceShape>;
|
|
397
378
|
|
|
398
379
|
/** The service handlers consume: `const storage = yield* StorageService`. */
|
|
399
380
|
export declare interface StorageServiceShape {
|
|
381
|
+
/** Opaque destination binding for manually signed upload-family credentials. */
|
|
382
|
+
readonly uploadTicketScope: () => Effect.Effect<string, StorageError>;
|
|
400
383
|
/** Store bytes. The result is the ref plus this call's `outcome`. */
|
|
401
384
|
readonly put: (input: PutInput) => Effect.Effect<StoredRef, StorageError | StorageRejected | StorageScanRejected>;
|
|
402
385
|
/** Fetch an object's bytes by id. Enforces the tenant guard ONLY — it does
|
|
@@ -583,6 +566,7 @@ export declare interface StorageServiceShape {
|
|
|
583
566
|
readonly tenantId?: string | null;
|
|
584
567
|
readonly ownerId?: string | null;
|
|
585
568
|
readonly visibility?: StorageVisibility;
|
|
569
|
+
readonly access?: AccessPolicy;
|
|
586
570
|
readonly folder?: string;
|
|
587
571
|
readonly tags?: ReadonlyArray<string>;
|
|
588
572
|
readonly alt?: string;
|
|
@@ -616,6 +600,7 @@ export declare interface StorageServiceShape {
|
|
|
616
600
|
readonly tenantId?: string | null;
|
|
617
601
|
readonly ownerId?: string | null;
|
|
618
602
|
readonly visibility?: StorageVisibility;
|
|
603
|
+
readonly access?: AccessPolicy;
|
|
619
604
|
readonly folder?: string;
|
|
620
605
|
readonly tags?: ReadonlyArray<string>;
|
|
621
606
|
readonly alt?: string;
|
|
@@ -665,6 +650,7 @@ export declare interface StorageServiceShape {
|
|
|
665
650
|
readonly tenantId?: string | null;
|
|
666
651
|
readonly ownerId?: string | null;
|
|
667
652
|
readonly visibility?: StorageVisibility;
|
|
653
|
+
readonly access?: AccessPolicy;
|
|
668
654
|
readonly folder?: string;
|
|
669
655
|
readonly tags?: ReadonlyArray<string>;
|
|
670
656
|
readonly alt?: string;
|
package/dist/types.js
CHANGED
|
@@ -11,6 +11,10 @@ var n = class extends t.TaggedError()("StorageError", {
|
|
|
11
11
|
}) {}, i = class extends t.TaggedError()("StorageRejected", {
|
|
12
12
|
reason: t.String,
|
|
13
13
|
detail: t.String
|
|
14
|
-
}) {
|
|
14
|
+
}) {
|
|
15
|
+
get message() {
|
|
16
|
+
return this.detail;
|
|
17
|
+
}
|
|
18
|
+
}, a = class extends t.TaggedError()("StorageScanRejected", { threat: t.String }) {}, o = class extends e.Service()("@voltro/plugin-storage/StorageService") {};
|
|
15
19
|
//#endregion
|
|
16
20
|
export { r as StorageAccessDenied, n as StorageError, i as StorageRejected, a as StorageScanRejected, o as StorageService };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voltro/plugin-storage",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.86.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,10 +43,10 @@
|
|
|
43
43
|
"node": ">=24.0.0"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@voltro/database": "0.
|
|
47
|
-
"@voltro/env": "0.
|
|
48
|
-
"@voltro/protocol": "0.
|
|
49
|
-
"@voltro/runtime": "0.
|
|
46
|
+
"@voltro/database": "0.86.0",
|
|
47
|
+
"@voltro/env": "0.86.0",
|
|
48
|
+
"@voltro/protocol": "0.86.0",
|
|
49
|
+
"@voltro/runtime": "0.86.0"
|
|
50
50
|
},
|
|
51
51
|
"optionalDependencies": {
|
|
52
52
|
"@aws-sdk/client-s3": "^3.1134.0",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"sharp": "^0.35.5"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"effect": "
|
|
59
|
+
"effect": "4.0.1"
|
|
60
60
|
},
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|