@edgestore/server
Version: 
Upload files with ease from React/Next.js
68 lines • 2.54 kB
TypeScript
import { type MaybePromise, type Provider, type RequestUploadParams } from '@edgestore/shared';
type ProviderUploadedFileInfo = RequestUploadParams['fileInfo'];
export type AWSOverwritePathFnArgs = {
    esBucketName: string;
    fileInfo: ProviderUploadedFileInfo;
    defaultAccessPath: string;
};
export type AWSOverwritePathFn = (args: AWSOverwritePathFnArgs) => MaybePromise<string>;
export type AWSProviderOptions = {
    /**
     * Access key for AWS credentials.
     * Can also be set via the `ES_AWS_ACCESS_KEY_ID` environment variable.
     *
     * If unset, the SDK will attempt to use the default credentials provider chain.
     */
    accessKeyId?: string;
    /**
     * Secret access key for AWS credentials.
     * Can also be set via the `ES_AWS_SECRET_ACCESS_KEY` environment variable.
     *
     * If unset, the SDK will attempt to use the default credentials provider chain.
     */
    secretAccessKey?: string;
    /**
     * AWS region to use.
     * Can also be set via the `ES_AWS_REGION` environment variable.
     */
    region?: string;
    /**
     * Name of the S3 bucket to use.
     * Can also be set via the `ES_AWS_BUCKET_NAME` environment variable.
     */
    bucketName?: string;
    /**
     * Custom endpoint for S3-compatible storage providers (e.g., MinIO).
     * Can also be set via the `ES_AWS_ENDPOINT` environment variable.
     */
    endpoint?: string;
    /**
     * Force path style for S3-compatible storage providers.
     * Can also be set via the `ES_AWS_FORCE_PATH_STYLE` environment variable.
     * Defaults to false for AWS S3, but should be true for most S3-compatible providers.
     */
    forcePathStyle?: boolean;
    /**
     * Base URL to use for accessing files.
     * Only needed if you are using a custom domain or cloudfront.
     *
     * It can also be set via the `EDGE_STORE_BASE_URL` environment variable.
     */
    baseUrl?: string;
    /**
     * Secret to use for encrypting JWT tokens.
     * Can be generated with `openssl rand -base64 32`.
     *
     * It can also be set via the `EDGE_STORE_JWT_SECRET` environment variable.
     */
    jwtSecret?: string;
    /**
     * Optional function to overwrite the S3 key (object path) for uploads.
     * This function receives the EdgeStore bucket name, fileInfo and the default S3 key
     * and should return the desired S3 key string.
     */
    overwritePath?: AWSOverwritePathFn;
};
export declare function AWSProvider(options?: AWSProviderOptions): Provider;
export {};
//# sourceMappingURL=index.d.ts.map