import HTTPS from 'node:https'; import { S3Client } from '@aws-sdk/client-s3'; import type { CreatableProviderEventData, CreatableProviderParams, S3ConnectionConfig } from '@xyo-network/xl1-sdk/protocol-sdk'; import { AbstractCreatableProvider } from '@xyo-network/xl1-sdk/protocol-sdk'; import { z } from 'zod'; import type { RestContentEncoding } from './encoding.ts'; /** * Serializable options shared by every S3-backed provider, read from the materialized * `config.options` (`providerBindings..options`). Unknown keys are ignored so * subclasses can layer their own option schemas over the same record. */ export declare const S3ProviderOptionsZod: z.ZodObject<{ contentEncoding: z.ZodDefault>; }, z.core.$strip>; /** Shared serializable options for S3-backed providers. */ export type S3ProviderOptions = z.infer; /** The bound `s3` connection materialized for an S3 provider. */ export interface NamedS3Connection { /** The `s3` connection profile this provider targets. */ config: S3ConnectionConfig; /** Name of the connection — the sharing key for the runtime client handle. */ name: string; } /** * HTTPS agent trusting the PEM CA bundle at `caFile` in addition to nothing else — the * bundle replaces (not extends) the default trust store, matching how a dedicated * local-dev/self-signed endpoint is expected to be pinned. */ export declare function httpsAgentForCaFile(caFile: string): HTTPS.Agent; /** Builds an S3 client for an `s3` connection profile (Cloudflare R2 aware). */ export declare function s3ClientForConnection(connection: S3ConnectionConfig): S3Client; /** Finalized files never change once written. */ export declare const IMMUTABLE_CACHE_CONTROL = "public, max-age=31536000, immutable"; /** * The head pointer is rewritten as the chain advances, and readers act on it at once: the * mempool decides what is still pending from it and indexers bound their ceilings by it. A * one-second TTL still absorbs bursts of reads of a hot object, while keeping a cached head at * most about a second old. There is deliberately no `stale-while-revalidate`: it lets a cache * keep answering with the previous head after it has changed. Used for the chain-state head, * the index watermarks, and the other mutable pointers. */ export declare const MUTABLE_CACHE_CONTROL = "public, max-age=1"; /** * Manifests are mostly-static layout descriptors that change only when the layout evolves; * a short TTL lets a new layout propagate within minutes without per-request revalidation. */ export declare const MANIFEST_CACHE_CONTROL = "public, max-age=300"; /** * Base for providers targeting S3-compatible storage. The target bucket, key prefix, and * client all come from the bound `s3` connection: bucket/prefix are read from its config, * and the client is shared per connection name via the context connection-handle cache * (tests pre-seed the cache with a stub client under `s3:`). * * Bodies are pre-compressed at write time and stored with the matching Content-Encoding * plus application/json, so HTTP clients decompress transparently — keys keep their * `.json` extension. Reads decode the stored Content-Encoding back to JSON. */ export declare abstract class AbstractS3Provider extends AbstractCreatableProvider { protected _resolvedClient?: S3Client; protected _s3Connection?: NamedS3Connection; private _s3Options?; /** Returns the target bucket from the bound `s3` connection. */ get bucket(): string; /** Returns the shared connection-scoped S3 client. */ get client(): S3Client; /** Returns the configured publication encoding, defaulting to Brotli. */ get contentEncoding(): RestContentEncoding; /** Returns the object-key prefix from the bound `s3` connection. */ get prefix(): string; /** Public HTTP/CDN base URL for anonymous reads of the bound bucket, when configured. */ get readUrl(): string | undefined; /** Shared S3 options parsed once from the materialized provider options. */ protected get s3Options(): S3ProviderOptions; /** Creates the provider instance after its dependencies and configuration have resolved. */ createHandler(): Promise; /** Reads and decodes a stored JSON file, or undefined when the key does not exist. */ protected getJson(path: string): Promise; /** True when the key exists, checked without fetching the body. */ protected hasJson(path: string): Promise; protected putJson(path: string, json: string, cacheControl: string): Promise; /** The `s3` connection this provider targets — the materialized binding, enforced as `s3`. */ protected s3Binding(): NamedS3Connection; } //# sourceMappingURL=AbstractS3Provider.d.ts.map