UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

59 lines • 3.3 kB
// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. ========= // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ========= Copyright 2026 @ Strukto.AI All Rights Reserved. ========= import { z } from 'zod'; import { timeoutShape } from "../../core/api/config.js"; import * as kp from "../../utils/key_prefix.js"; import { secretSchema, secretStr } from "../secrets.js"; export const S3Config = z.object({ bucket: z.string().describe('Name of the bucket to mount.'), region: z .string() .optional() .describe("AWS region requests are signed for and sent to. Unset leaves it to the AWS SDK's environment variables and profile."), endpoint: z .string() .optional() .describe("Endpoint URL of an S3-compatible server. Unset, the node mount uses `AWS_ENDPOINT_URL_S3` or `AWS_ENDPOINT_URL` when set, else AWS's endpoint for `region`; an endpoint set only in an AWS profile is not read."), accessKeyId: secretStr() .optional() .describe('Access key ID; set it with `secretAccessKey`. Unset uses the AWS SDK credential chain.'), secretAccessKey: secretStr().optional().describe('Secret access key paired with `accessKeyId`.'), sessionToken: secretStr() .optional() .describe('Session token for temporary credentials, sent with the access key pair.'), forcePathStyle: z .boolean() .optional() .describe('Address the bucket in the URL path (`<endpoint>/<bucket>/<key>`) instead of as a subdomain of the endpoint.'), ...timeoutShape, presignedUrlProvider: secretSchema(z.custom((value) => typeof value === 'function')) .optional() .describe('Function `(path, operation, options)` that returns a signed URL for each S3 operation. When set, the mount fetches those URLs and needs no credentials.'), httpAgentProvider: secretSchema(z.custom((value) => typeof value === 'function')) .optional() .describe('Function that returns the `httpAgent` and `httpsAgent` for one S3 client, called once per client. The node mount builds it from `proxy` when that is set.'), defaultContentType: z .string() .optional() .describe('`Content-Type` stored with every object the mount writes. Unset sends none, so the store applies its own default; a write through `presignedUrlProvider` sends `application/octet-stream`.'), keyPrefix: z .string() .optional() .describe('Key prefix inside the bucket that the mount treats as its root; keys outside it are not visible. Leading slashes are dropped and a trailing `/` is added.'), }); export function normalizeKeyPrefix(v) { const out = kp.normalize(v); return out === '' ? undefined : out; } //# sourceMappingURL=config.js.map