@settlemint/sdk-minio
Version:
MinIO integration module for SettleMint SDK, providing S3-compatible object storage capabilities
57 lines (53 loc) • 1.92 kB
TypeScript
import { Client } from 'minio';
import { z } from 'zod';
/**
* Schema for validating server client options for the Portal client.
* Extends the ClientOptionsSchema with additional server-specific fields.
*/
declare const ServerClientOptionsSchema: z.ZodObject<z.objectUtil.extendShape<{
/** The URL of the MinIO instance to connect to */
instance: z.ZodString;
}, {
/** The access token used to authenticate with the SettleMint platform */
accessToken: z.ZodString;
/** The MinIO access key used to authenticate with the MinIO server */
accessKey: z.ZodString;
/** The MinIO secret key used to authenticate with the MinIO server */
secretKey: z.ZodString;
}>, "strip", z.ZodTypeAny, {
instance: string;
accessToken: string;
accessKey: string;
secretKey: string;
}, {
instance: string;
accessToken: string;
accessKey: string;
secretKey: string;
}>;
/**
* Type definition for server client options derived from the ServerClientOptionsSchema.
*/
type ServerClientOptions = z.infer<typeof ServerClientOptionsSchema>;
/**
* Creates a MinIO client for server-side use with authentication.
*
* @param options - The server client options for configuring the MinIO client
* @returns An object containing the initialized MinIO client
* @throws Will throw an error if not called on the server or if the options fail validation
*
* @example
* import { createServerMinioClient } from "@settlemint/sdk-minio";
*
* const { client } = createServerMinioClient({
* instance: process.env.SETTLEMINT_MINIO_ENDPOINT!,
* accessToken: process.env.SETTLEMINT_ACCESS_TOKEN!,
* accessKey: process.env.SETTLEMINT_MINIO_ACCESS_KEY!,
* secretKey: process.env.SETTLEMINT_MINIO_SECRET_KEY!
* });
* client.listBuckets();
*/
declare function createServerMinioClient(options: ServerClientOptions): {
client: Client;
};
export { createServerMinioClient };