UNPKG

@settlemint/sdk-minio

Version:

MinIO integration module for SettleMint SDK, providing S3-compatible object storage capabilities

63 lines (60 loc) 2.44 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/minio.ts var minio_exports = {}; __export(minio_exports, { createServerMinioClient: () => createServerMinioClient }); module.exports = __toCommonJS(minio_exports); var import_runtime = require("@settlemint/sdk-utils/runtime"); var import_validation2 = require("@settlemint/sdk-utils/validation"); var import_minio = require("minio"); // src/helpers/client-options.schema.ts var import_validation = require("@settlemint/sdk-utils/validation"); var import_zod = require("zod"); var ClientOptionsSchema = import_zod.z.object({ /** The URL of the MinIO instance to connect to */ instance: import_validation.UrlSchema }); var ServerClientOptionsSchema = ClientOptionsSchema.extend({ /** The access token used to authenticate with the SettleMint platform */ accessToken: import_validation.ApplicationAccessTokenSchema, /** The MinIO access key used to authenticate with the MinIO server */ accessKey: import_zod.z.string(), /** The MinIO secret key used to authenticate with the MinIO server */ secretKey: import_zod.z.string() }); // src/minio.ts function createServerMinioClient(options) { (0, import_runtime.ensureServer)(); const validatedOptions = (0, import_validation2.validate)(ServerClientOptionsSchema, options); return { client: new import_minio.Client({ endPoint: new URL(validatedOptions.instance).host, accessKey: validatedOptions.accessKey, secretKey: validatedOptions.secretKey, region: "eu-central-1" }) }; } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { createServerMinioClient }); //# sourceMappingURL=minio.cjs.map