import { S3Resource } from './s3/s3.ts'; import type { RegisteredCommand } from '@struktoai/mirage-core/commands/config'; import type { RegisteredOp } from '@struktoai/mirage-core/ops/registry'; import { z } from '@struktoai/mirage-core/resource/secrets'; import type { ConfigOf, RedactedConfig } from '@struktoai/mirage-core/resource/secrets'; import type { S3Config, S3ConfigRedacted } from './s3/config.ts'; /** * Shared shape for the S3-compatible providers. * * Every alias is the same credentials plus one endpoint rule, so the * fields, the zod schema that drives redaction, the snake_case mapping and * the conversion to S3Config live here once. A provider declares only its * endpoint rule and whatever it genuinely adds. Mirrors Python's * `mirage/resource/s3_alias.py`. * * Only `bucket` and whatever the endpoint genuinely needs are required. * Credentials are optional because `S3Config` leaves them optional too, so * omitting them falls through to the usual AWS resolution order: `profile`, * then the `AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY` environment * variables, then the shared credentials file, then an instance role. * `sessionToken` and `profile` live here rather than on the one provider * that first needed them, so every alias accepts them. */ export interface S3AliasConfig { bucket: string; accessKeyId?: string; secretAccessKey?: string; sessionToken?: string; profile?: string; region?: string; endpoint?: string; forcePathStyle?: boolean; keyPrefix?: string; timeoutMs?: number; proxy?: string; } declare const ALIAS_SCHEMA: z.ZodObject<{ region: z.ZodString; endpoint: z.ZodString; bucket: z.ZodString; accessKeyId: z.ZodOptional; secretAccessKey: z.ZodOptional; sessionToken: z.ZodOptional; profile: z.ZodOptional; forcePathStyle: z.ZodOptional; keyPrefix: z.ZodOptional; timeoutMs: z.ZodOptional; proxy: z.ZodOptional; }, z.core.$strip>; export type S3AliasConfigRedacted = RedactedConfig, 'accessKeyId' | 'secretAccessKey' | 'sessionToken' | 'proxy'>; export interface Alias { toS3Config: (config: C) => S3Config; redact: (config: C) => R; normalize: (input: Record) => C; } /** * A provider whose endpoint is derived from its (required) region. * * `forcePathStyle` stays absent from the S3Config when the caller did not * ask for it, which is what the hand-written providers did and what the * S3 client treats as virtual-hosted style. */ export declare function makeRegionAlias(endpointFor: (config: C) => string): Alias & { resolvedEndpoint: (config: C) => string; }; /** * A self-hosted gateway reachable only at a caller-supplied endpoint. * * ceph, minio and seaweedfs have no public region to derive from, so the * region and path-style defaults are materialized rather than omitted. */ export declare function makeFixedAlias(): Alias; /** * The snapshot state of an S3-compatible alias: its own kind and its own * redacted config, not the `s3` kind and S3 config it delegates to. */ export interface S3AliasResourceState { type: string; config: TRedacted; } /** * The shared body of every S3-compatible provider resource (MinIO, Ceph, * R2, Wasabi, ...). Each is an {@link S3Resource} reached through a * provider-shaped config, so all it owns is its `kind`, that config, and * ops/commands retagged from `s3` onto the kind. A subclass supplies its * prompt as a plain field and hands the varying pieces to `super`. * * `toS3Config` and `redact` arrive as functions rather than as an * {@link Alias}: the four providers whose region or endpoint rule fits * neither {@link makeRegionAlias} nor {@link makeFixedAlias} write their * own pair, so the resource layer takes the two functions every provider * has either way. Mirrors python `S3AliasResource` in * `mirage/resource/s3_alias.py`. */ export declare abstract class S3AliasResource extends S3Resource { readonly kind: string; readonly aliasConfig: TConfig; private readonly aliasOps; private readonly aliasCommands; private readonly redactAlias; protected constructor(kind: string, config: TConfig, s3Config: S3Config, redact: (config: TConfig) => TRedacted); ops(): readonly RegisteredOp[]; commands(): readonly RegisteredCommand[]; getState(): Promise>; loadState(_state: S3AliasResourceState): Promise; } export {}; //# sourceMappingURL=s3_alias.d.ts.map