Skip to content

@btravstack/storage


@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
ts
new StorageConfig(): StorageConfig;

Defined in: packages/di/dist/index.d.mts:16

Returns

StorageConfig

Inherited from
ts
Port("StorageConfig")<{
  readonly endpoint: string;
  readonly region: string;
  readonly bucket: string;
  readonly accessKeyId: string;
  readonly secretAccessKey: string;
}>.constructor

Properties

PropertyModifierTypeInherited fromDefined in
[ID]readonly"StorageConfig"Port("StorageConfig").[ID]packages/di/dist/index.d.mts:12
[SERVICE]readonlyobjectPort("StorageConfig").[SERVICE]packages/di/dist/index.d.mts:13
[SERVICE].accessKeyIdreadonlystring-packages/storage/src/s3.ts:26
[SERVICE].bucketreadonlystring-packages/storage/src/s3.ts:25
[SERVICE].endpointreadonlystring-packages/storage/src/s3.ts:23
[SERVICE].regionreadonlystring-packages/storage/src/s3.ts:24
[SERVICE].secretAccessKeyreadonlystring-packages/storage/src/s3.ts:27
portIdreadonly"StorageConfig"Port("StorageConfig").portIdpackages/di/dist/index.d.mts:17

Variables

s3Schema

ts
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()

ts
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()

ts
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

ParameterType
clientS3Client
bucketstring

Returns

StorageService

Released under the MIT License.