mirror of
https://github.com/bknd-io/bknd/
synced 2026-08-04 00:56:01 +00:00
initial refactor
This commit is contained in:
@@ -7,18 +7,17 @@ import type {
|
||||
PutObjectRequest,
|
||||
} from "@aws-sdk/client-s3";
|
||||
import { AwsClient, isDebug } from "core";
|
||||
import { type Static, isFile, parse, pickHeaders2 } from "core/utils";
|
||||
import { isFile, pickHeaders2 } from "core/utils";
|
||||
import { transform } from "lodash-es";
|
||||
import type { FileBody, FileListObject } from "../../Storage";
|
||||
import { StorageAdapter } from "../../StorageAdapter";
|
||||
import * as tbbox from "@sinclair/typebox";
|
||||
const { Type } = tbbox;
|
||||
import { parse, s } from "core/object/schema";
|
||||
|
||||
export const s3AdapterConfig = Type.Object(
|
||||
export const s3AdapterConfig = s.object(
|
||||
{
|
||||
access_key: Type.String(),
|
||||
secret_access_key: Type.String(),
|
||||
url: Type.String({
|
||||
access_key: s.string(),
|
||||
secret_access_key: s.string(),
|
||||
url: s.string({
|
||||
pattern: "^https?://(?:.*)?[^/.]+$",
|
||||
description: "URL to S3 compatible endpoint without trailing slash",
|
||||
examples: [
|
||||
@@ -33,7 +32,7 @@ export const s3AdapterConfig = Type.Object(
|
||||
},
|
||||
);
|
||||
|
||||
export type S3AdapterConfig = Static<typeof s3AdapterConfig>;
|
||||
export type S3AdapterConfig = s.Static<typeof s3AdapterConfig>;
|
||||
|
||||
export class StorageS3Adapter extends StorageAdapter {
|
||||
readonly #config: S3AdapterConfig;
|
||||
|
||||
Reference in New Issue
Block a user