@btravstack/storage / s3
s3
Classes
StorageConfig
Defined in: packages/storage/src/s3.ts:22
What the graph bound from the environment for the S3 adapter.
Extends
PortInstance<"StorageConfig", {accessKeyId:string;bucket:string;endpoint:string;region:string;secretAccessKey:string; }>
Constructors
Constructor
new StorageConfig(): StorageConfig;Defined in: packages/di/dist/index.d.mts:16
Returns
Inherited from
Port("StorageConfig")<{
readonly endpoint: string;
readonly region: string;
readonly bucket: string;
readonly accessKeyId: string;
readonly secretAccessKey: string;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
[ID] | readonly | "StorageConfig" | Port("StorageConfig").[ID] | packages/di/dist/index.d.mts:12 |
[SERVICE] | readonly | object | Port("StorageConfig").[SERVICE] | packages/di/dist/index.d.mts:13 |
[SERVICE].accessKeyId | readonly | string | - | packages/storage/src/s3.ts:26 |
[SERVICE].bucket | readonly | string | - | packages/storage/src/s3.ts:25 |
[SERVICE].endpoint | readonly | string | - | packages/storage/src/s3.ts:23 |
[SERVICE].region | readonly | string | - | packages/storage/src/s3.ts:24 |
[SERVICE].secretAccessKey | readonly | string | - | packages/storage/src/s3.ts:27 |
portId | readonly | "StorageConfig" | Port("StorageConfig").portId | packages/di/dist/index.d.mts:17 |
Variables
s3Schema
const s3Schema: ConfigSchema<Readonly<Record<string, string | undefined>>, {
accessKeyId: string;
bucket: string;
endpoint: string;
region: string;
secretAccessKey: string;
}>;Defined in: packages/storage/src/s3.ts:39
The five variables an S3-compatible store needs, and no sixth.
STORAGE_S3_ENDPOINT is required rather than defaulted to AWS: every store this port exists for has one, and a default pointing at Amazon would be a surprising bill. Path-style addressing is not configurable, it is simply on — every self-hosted store requires it and AWS accepts it, so it is a value that never changes.
Functions
s3Storage()
function s3Storage(): Module<StorageBackend, ConfigInvalid, Env | Scope>;Defined in: packages/storage/src/s3.ts:143
The S3 adapter: one client, built with the scope and destroyed with it, and StorageBackend over it. Its two AWS SDK peers are optional and reached only through this subpath, so an application composing the memory adapter installs neither.
Returns
Module<StorageBackend, ConfigInvalid, Env | Scope>
s3StorageBackend()
function s3StorageBackend(client, bucket): StorageService;Defined in: packages/storage/src/s3.ts:77
The adapter's service over a client and a bucket. A delete of a key nobody stored answers Ok, which is S3's own idempotent behaviour rather than a fiction layered over it.
Parameters
| Parameter | Type |
|---|---|
client | S3Client |
bucket | string |