Skip to content
RELKIT
Esc
↑↓navigate↵open⌘Jpreview
On this page

S3 API

Generated public TypeScript reference for @relkit/s3.

For configuration and examples, read integrations, local docker, providers.

For a complete workflow, follow upload product images.

Public imports

  • @relkit/s3 — 5 exports
  • @relkit/s3/runtime — 5 exports
  • @relkit/s3/local-recipe — 1 exports

All exported APIs

Names link to their complete contracts. Re-exports share their original contract; legacy exports keep their separate identity. Examples link to the API’s inline sample, a maintained repository usage, or the shared module walkthrough.

API Kind Import from Example
createS3BucketProvider Value @relkit/s3/runtime Source example
localRecipe Value @relkit/s3/local-recipe Source example
runtimeIntegration Value @relkit/s3/runtime Module example
s3 Value @relkit/s3 API example
S3Adapter Type @relkit/s3 Module example
S3Behavior Type @relkit/s3 Module example
S3BucketOptions Type @relkit/s3/runtime Module example
S3BucketProvider Type @relkit/s3/runtime Module example
S3Credentials Type @relkit/s3/runtime Module example
S3CredentialsOptions Type @relkit/s3 Module example
S3Options Type @relkit/s3 Module example

index.ts

“./s3.js” (namespace export)

Re-exports all named exports from the “./s3.js” module.

Signature

export * from "./s3.js";

Source

index.ts

localRecipe

Signature

declare const localRecipe: Readonly<{
  kind: "local-service-recipe";
  protocolVersion: 1;
  integrationId: "s3";
  recipeId: "minio-docker";
  recipeVersion: 1;
  materializerId: "docker";
  image: "ghcr.io/teableio/minio@sha256:a1ea29fa28355559ef137d71fc570e508a214ec84ff8083e39bc5428980b015e";
  command: ReadonlyArray<string>;
  ports: Readonly<{ api: 9000; console: 9001 }>;
  volume: Readonly<{ mountPath: "/data" }>;
  health: Readonly<{
    command: ReadonlyArray<string>;
    intervalMs: 500;
    timeoutMs: 2000;
    retries: 60;
  }>;
  generatedSecrets: Readonly<{
    accessKeyId: Readonly<{ bytes: 12 }>;
    secretAccessKey: Readonly<{ bytes: 24 }>;
  }>;
  environment: Readonly<{
    MINIO_ROOT_USER: Readonly<{ secret: "accessKeyId" }>;
    MINIO_ROOT_PASSWORD: Readonly<{ secret: "secretAccessKey" }>;
  }>;
  outputs: (context: LocalServiceRecipeOutputContext) => Readonly<{
    readonly endpoint: `http://127.0.0.1:${number}`;
    readonly bucketName: "relkit";
    readonly region: "us-east-1";
    readonly accessKeyId: string;
    readonly secretAccessKey: string;
  }>;
  initialize: (context: LocalServiceRecipeOutputContext) => Promise<void>;
}>;

Source

index.ts

“./s3.js” (namespace export)

Re-exports all named exports from the “./s3.js” module.

Signature

export * from "./s3.js";

Source

S3Credentials

Signature

declare const S3Credentials: S3Credentials;

Source

runtimeIntegration

Signature

declare const runtimeIntegration: Readonly<{
  kind: "runtime-integration";
  integrationId: "s3";
  registrations: ReadonlyArray<{
    capability: string;
    adapterId: string;
    protocolVersion: number;
    create: ({ connection, behavior }: RuntimeProviderContext) => { value: S3BucketProvider };
  }>;
}>;

Source

s3-url.ts

endpointFor

Signature

declare const endpointFor: (value: string) => string;

Source

objectUrl

Signature

declare const objectUrl: (
  endpoint: string,
  bucket: string,
  key: string,
  pathStyle: boolean,
) => string;

Source

requiredText

Signature

declare const requiredText: (value: unknown, label: string) => string;

Source

s3-xml.ts

decodeS3Xml

Signature

declare const decodeS3Xml: (value: string) => string;

Source

s3ErrorDetail

Signature

declare const s3ErrorDetail: (body: string) => string | undefined;

Source

s3XmlValue

Signature

declare const s3XmlValue: (xml: string, name: string) => string | undefined;

Source

s3.ts

S3BucketOptions (interface)

Signature

export interface S3BucketOptions {
  readonly endpoint: string;
  readonly bucketName: string;
  readonly region: string;
  readonly credentials?: S3Credentials;
  readonly forcePathStyle?: boolean;
  readonly signedUrlTtlSeconds?: number;
  readonly fetch?: typeof globalThis.fetch;
}

Source

S3BucketProvider (interface)

Signature

export interface S3BucketProvider extends BucketProvider {
  readonly inspector: {
    readonly list: (request: {
      readonly prefix?: string;
      readonly cursor?: string;
      readonly limit: number;
      readonly signal: AbortSignal;
    }) => Promise<{ readonly items: readonly unknown[]; readonly nextCursor?: string }>;
    readonly preview: (request: {
      readonly key: string;
      readonly offset: number;
      readonly limit: number;
      readonly signal: AbortSignal;
    }) => Promise<
      | { readonly bytes: Uint8Array; readonly metadata: unknown; readonly totalBytes: number }
      | undefined
    >;
  };
}

Source

createS3BucketProvider

Signature

declare const createS3BucketProvider: (options: S3BucketOptions) => S3BucketProvider;

Source

signing.ts

S3Credentials (interface)

Signature

export interface S3Credentials {
  readonly accessKeyId: string;
  readonly secretAccessKey: string;
  readonly sessionToken?: string;
}

Source

SignedRequestInit (type alias)

Signature

type SignedRequestInit = Omit<RequestInit, "body"> & {
  readonly body?: string | Uint8Array | null;
};

Source

SignedRequestOptions (interface)

Signature

export interface SignedRequestOptions {
  readonly region: string;
  readonly credentials?: S3Credentials;
  readonly fetch?: typeof globalThis.fetch;
  readonly init?: SignedRequestInit;
}

Source

assertResponse

Signature

declare const assertResponse: (response: Response, operation: string) => Promise<Response>;

Source

presignS3Url

Signature

declare const presignS3Url: (
  url: string,
  method: "GET" | "PUT",
  region: string,
  expiresSeconds: number,
  options?: Pick<SignedRequestOptions, "credentials" | "fetch">,
) => Promise<string>;

Source

signedRequest

Signature

declare const signedRequest: (url: string, options: SignedRequestOptions) => Promise<Response>;

Source

s3.ts

s3

Defines an S3-compatible bucket adapter. Omit connection fields for local or infrastructure use.

Example

import { s3 } from "@relkit/s3";
const assets = s3({
  endpoint: "https://s3.example.com",
  bucketName: "assets",
  region: "us-east-1",
});

Signature

declare const s3: (options?: S3Options) => S3Adapter;

Source

Since v0.2.0

S3Adapter (type alias)

Signature

type S3Adapter = ProviderAdapter<
  typeof bucket,
  "s3",
  ProviderConnectionValues,
  ProviderBehavior<S3Behavior>
>;

Source

S3Behavior (type alias)

Signature

type S3Behavior = Readonly<{
  forcePathStyle: boolean;
  signedUrlTtlSeconds: number;
}>;

Source

S3CredentialsOptions (interface)

Signature

export interface S3CredentialsOptions {
  readonly accessKeyId: SecretReference;
  readonly secretAccessKey: SecretReference;
  readonly sessionToken?: SecretReference;
}

Source

S3Options (interface)

Signature

export interface S3Options {
  readonly endpoint?: string | URL | TextReference | UrlReference;
  readonly bucketName?: string | TextReference;
  readonly region?: string | TextReference;
  readonly credentials?: S3CredentialsOptions;
  readonly forcePathStyle?: boolean;
  readonly signedUrlTtlSeconds?: number;
}

Source