🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat: add azure storage provider support (#4386)
Steffen Schmitz0ce5ddcd0072
diff --git a/.env.dev-azure.example b/.env.dev-azure.examplenew file mode 100644index 0000000000..a82ad144ad--- /dev/null+++ b/.env.dev-azure.example@@ -0,0 +1,92 @@+# When adding additional environment variables, the schema in "/src/env.mjs"+# should be updated accordingly.++# Prisma+# https://www.prisma.io/docs/reference/database-reference/connection-urls#env+DIRECT_URL="postgresql://postgres:postgres@localhost:5432/postgres"+DATABASE_URL="postgresql://postgres:postgres@localhost:5432/postgres"++# Clickhouse+CLICKHOUSE_MIGRATION_URL="clickhouse://localhost:9000"+CLICKHOUSE_URL="http://localhost:8123"+CLICKHOUSE_USER="clickhouse"+CLICKHOUSE_PASSWORD="clickhouse"+CLICKHOUSE_MIGRATION_CLUSTER_DISABLED="true"++# Next Auth+# You can generate a new secret on the command line with:+# openssl rand -base64 32+# https://next-auth.js.org/configuration/options#secret+# NEXTAUTH_SECRET=""+NEXTAUTH_URL="http://localhost:3000"+NEXTAUTH_SECRET="secret"++# Langfuse Cloud Environment+NEXT_PUBLIC_LANGFUSE_CLOUD_REGION="DEV"++# Langfuse experimental features+LANGFUSE_ENABLE_EXPERIMENTAL_FEATURES="true"++# Salt for API key hashing+SALT="salt"++EMAIL_FROM_ADDRESS="" # Defines the email address to use as the from address.+SMTP_CONNECTION_URL="" # Defines the connection url for smtp server.++# DON'T PANIC: The Azurite Secrets are well-known and meant to be hard-coded+# S3 storage+S3_ENDPOINT=http://localhost:10000/devstoreaccount1+S3_ACCESS_KEY_ID=devstoreaccount1+S3_SECRET_ACCESS_KEY=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==+S3_BUCKET_NAME=langfuse+S3_REGION=auto+## Necessary for minio compatibility+S3_FORCE_PATH_STYLE=true++# S3 Media Upload LOCAL+LANGFUSE_S3_MEDIA_UPLOAD_ENABLED=true+LANGFUSE_S3_MEDIA_UPLOAD_BUCKET=langfuse+LANGFUSE_S3_MEDIA_UPLOAD_ACCESS_KEY_ID=devstoreaccount1+LANGFUSE_S3_MEDIA_UPLOAD_SECRET_ACCESS_KEY=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==+LANGFUSE_S3_MEDIA_UPLOAD_REGION=auto+LANGFUSE_S3_MEDIA_UPLOAD_ENDPOINT=http://localhost:10000/devstoreaccount1+## Necessary for minio compatibility+LANGFUSE_S3_MEDIA_UPLOAD_FORCE_PATH_STYLE=true+LANGFUSE_S3_MEDIA_UPLOAD_PREFIX=media/++# S3 Event Bucket Upload+## Set to true to test uploading all events to S3+LANGFUSE_S3_EVENT_UPLOAD_ENABLED=true+LANGFUSE_S3_EVENT_UPLOAD_BUCKET=langfuse+LANGFUSE_S3_EVENT_UPLOAD_ACCESS_KEY_ID=devstoreaccount1+LANGFUSE_S3_EVENT_UPLOAD_SECRET_ACCESS_KEY=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==+LANGFUSE_S3_EVENT_UPLOAD_REGION=auto+LANGFUSE_S3_EVENT_UPLOAD_ENDPOINT=http://localhost:10000/devstoreaccount1+## Necessary for minio compatibility+LANGFUSE_S3_EVENT_UPLOAD_FORCE_PATH_STYLE=true+LANGFUSE_S3_EVENT_UPLOAD_PREFIX=events/++LANGFUSE_USE_AZURE_BLOB=true++# Set during docker build of application+# Used to disable environment verification at build time+# DOCKER_BUILD=1++REDIS_HOST="127.0.0.1"+REDIS_PORT=6379+REDIS_AUTH="myredissecret"++# openssl rand -hex 32 used only here+ENCRYPTION_KEY=0000000000000000000000000000000000000000000000000000000000000000++# speeds up local development by not executing init scripts on server startup+NEXT_PUBLIC_LANGFUSE_RUN_NEXT_INIT="false"++LANGFUSE_READ_FROM_POSTGRES_ONLY=false+LANGFUSE_RETURN_FROM_CLICKHOUSE=true+LANGFUSE_READ_DASHBOARDS_FROM_CLICKHOUSE=true+LANGFUSE_READ_FROM_CLICKHOUSE_ONLY=true++LANGFUSE_ASYNC_INGESTION_PROCESSING="true"+LANGFUSE_ASYNC_CLICKHOUSE_INGESTION_PROCESSING="true"diff --git a/.env.dev.example b/.env.dev.exampleindex 6fe7640cf5..c535aff19d 100644--- a/.env.dev.example+++ b/.env.dev.example@@ -43,7 +43,7 @@ S3_REGION=us-east-1## Necessary for minio compatibilityS3_FORCE_PATH_STYLE=true-# # S3 Media Upload LOCAL+# S3 Media Upload LOCALLANGFUSE_S3_MEDIA_UPLOAD_ENABLED=trueLANGFUSE_S3_MEDIA_UPLOAD_BUCKET=langfuseLANGFUSE_S3_MEDIA_UPLOAD_ACCESS_KEY_ID=miniodiff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.ymlindex 828709bb6b..ed9b025d2e 100644--- a/.github/workflows/pipeline.yml+++ b/.github/workflows/pipeline.yml@@ -137,11 +137,12 @@ jobs:tests-web-async:timeout-minutes: 20runs-on: ubuntu-latest- name: tests-web-async (node${{ matrix.node-version }}, pg${{ matrix.postgres-version }})+ name: tests-web-async (node${{ matrix.node-version }}, pg${{ matrix.postgres-version }}, mode${{ matrix.blob-provider }})strategy:matrix:node-version: [20]postgres-version: [12, 15]+ blob-provider: ["", "-azure"]steps:- name: Set Swap Spaceuses: pierotofy/set-swap-space@master@@ -172,11 +173,11 @@ jobs:pnpm install- name: Load default envrun: |- cp .env.dev.example .env- grep -v -e '^S3_BUCKET_NAME=' -e '^REDIS_HOST=' -e '^NEXT_PUBLIC_LANGFUSE_RUN_NEXT_INIT=' .env.dev.example > .env+ cp .env.dev${{ matrix.blob-provider }}.example .env+ grep -v -e '^S3_BUCKET_NAME=' -e '^REDIS_HOST=' -e '^NEXT_PUBLIC_LANGFUSE_RUN_NEXT_INIT=' .env.dev${{ matrix.blob-provider }}.example > .env- name: Run + migraterun: |- docker compose -f docker-compose.dev.yml up -d+ docker compose -f docker-compose.dev${{ matrix.blob-provider }}.yml up -dsleep 5 # Wait for PostgreSQL to accept connectionsdocker compose psenv:@@ -205,11 +206,12 @@ jobs:tests-worker:timeout-minutes: 20runs-on: ubuntu-latest- name: tests-worker (node${{ matrix.node-version }}, pg${{ matrix.postgres-version }})+ name: tests-worker (node${{ matrix.node-version }}, pg${{ matrix.postgres-version }}, mode${{ matrix.blob-provider }})strategy:matrix:node-version: [20]postgres-version: [12, 15]+ blob-provider: ["", "-azure"]steps:- name: Set Swap Spaceuses: pierotofy/set-swap-space@master@@ -240,12 +242,12 @@ jobs:which migrate- name: Load default envrun: |- cp .env.dev.example .env- cp .env.dev.example web/.env- cp .env.dev.example worker/.env+ cp .env.dev${{ matrix.blob-provider }}.example .env+ cp .env.dev${{ matrix.blob-provider }}.example web/.env+ cp .env.dev${{ matrix.blob-provider }}.example worker/.env- name: Run + migraterun: |- docker compose -f docker-compose.dev.yml up -d+ docker compose -f docker-compose.dev${{ matrix.blob-provider }}.yml up -dsleep 5 # Wait for PostgreSQL to accept connectionsdocker compose ps- name: Ensure no unhealthy statusdiff --git a/.gitignore b/.gitignoreindex 844f5793ce..304f641e78 100644--- a/.gitignore+++ b/.gitignore@@ -37,6 +37,7 @@ yarn-error.log*# do not commit any .env files to git, except for the .env.example file. https://create.t3.gg/en/usage/env-variables#using-environment-variables.env*!.env.dev.example+!.env.dev-azure.example!.env.local.example!.env.prod.example!.env.dev.legacy.examplediff --git a/docker-compose.dev-azure.yml b/docker-compose.dev-azure.ymlnew file mode 100644index 0000000000..553c121343--- /dev/null+++ b/docker-compose.dev-azure.yml@@ -0,0 +1,63 @@+services:+ clickhouse:+ image: clickhouse/clickhouse-server+ user: "101:101"+ container_name: clickhouse+ hostname: clickhouse+ environment:+ CLICKHOUSE_DB: default+ CLICKHOUSE_USER: clickhouse+ CLICKHOUSE_PASSWORD: clickhouse+ volumes:+ - langfuse_clickhouse_data:/var/lib/clickhouse+ - langfuse_clickhouse_logs:/var/log/clickhouse-server+ ports:+ - "8123:8123"+ - "9000:9000"+ depends_on:+ - postgres++ azurite:+ image: mcr.microsoft.com/azure-storage/azurite+ container_name: azurite+ command: azurite-blob --blobHost 0.0.0.0+ ports:+ - "10000:10000"+ volumes:+ - langfuse_azurite_data:/data++ redis:+ image: redis:7.2.4+ restart: always+ command: >+ --requirepass ${REDIS_AUTH:-myredissecret}+ ports:+ - 6379:6379++ postgres:+ image: postgres:${POSTGRES_VERSION:-latest}+ restart: always+ healthcheck:+ test: ["CMD-SHELL", "pg_isready -U postgres"]+ interval: 3s+ timeout: 3s+ retries: 10+ command: ["postgres", "-c", "log_statement=all"]+ environment:+ - POSTGRES_USER=postgres+ - POSTGRES_PASSWORD=postgres+ - POSTGRES_DB=postgres+ ports:+ - 5432:5432+ volumes:+ - langfuse_postgres_data:/var/lib/postgresql/data++volumes:+ langfuse_postgres_data:+ driver: local+ langfuse_clickhouse_data:+ driver: local+ langfuse_clickhouse_logs:+ driver: local+ langfuse_azurite_data:+ driver: localdiff --git a/packages/shared/package.json b/packages/shared/package.jsonindex 45f2357811..30cf42e4b9 100644--- a/packages/shared/package.json+++ b/packages/shared/package.json@@ -59,6 +59,7 @@"@aws-sdk/client-s3": "^3.675.0","@aws-sdk/lib-storage": "^3.675.0","@aws-sdk/s3-request-presigner": "^3.679.0",+ "@azure/storage-blob": "^12.26.0","@clickhouse/client": "^1.4.0","@langchain/anthropic": "^0.3.8","@langchain/aws": "^0.1.2",diff --git a/packages/shared/src/env.ts b/packages/shared/src/env.tsindex 490e3ce7c4..c6befbb1ff 100644--- a/packages/shared/src/env.ts+++ b/packages/shared/src/env.ts@@ -58,6 +58,7 @@ const EnvSchema = z.object({LANGFUSE_S3_EVENT_UPLOAD_FORCE_PATH_STYLE: z.enum(["true", "false"]).default("false"),+ LANGFUSE_USE_AZURE_BLOB: z.enum(["true", "false"]).default("false"),});export const env = EnvSchema.parse(removeEmptyEnvVariables(process.env));diff --git a/packages/shared/src/server/index.ts b/packages/shared/src/server/index.tsindex 9ac9b87423..c8243239ad 100644--- a/packages/shared/src/server/index.ts+++ b/packages/shared/src/server/index.ts@@ -1,4 +1,4 @@-export * from "./services/S3StorageService";+export * from "./services/StorageService";export * from "./services/email/organizationInvitation/sendMembershipInvitationEmail";export * from "./services/email/batchExportSuccess/sendBatchExportSuccessEmail";export * from "./services/email/passwordReset/sendResetPasswordVerificationRequest";diff --git a/packages/shared/src/server/ingestion/processEventBatch.ts b/packages/shared/src/server/ingestion/processEventBatch.tsindex b5bd714b17..8429bcca38 100644--- a/packages/shared/src/server/ingestion/processEventBatch.ts+++ b/packages/shared/src/server/ingestion/processEventBatch.ts@@ -22,8 +22,11 @@ import { LegacyIngestionEventType, QueueJobs } from "../queues";import { IngestionQueue } from "../redis/ingestionQueue";import { LegacyIngestionQueue } from "../redis/legacyIngestion";import { redis } from "../redis/redis";-import { S3StorageService } from "../services/S3StorageService";import { handleBatch } from "./legacy";+import {+ StorageService,+ StorageServiceFactory,+} from "../services/StorageService";import { getProcessorForEvent } from "./legacy/EventProcessor";import { eventTypes, ingestionEvent, IngestionEventType } from "./types";@@ -32,11 +35,11 @@ export type TokenCountDelegate = (p: {text: unknown;}) => number | undefined;-let s3StorageServiceClient: S3StorageService;+let s3StorageServiceClient: StorageService;-const getS3StorageServiceClient = (bucketName: string): S3StorageService => {+const getS3StorageServiceClient = (bucketName: string): StorageService => {if (!s3StorageServiceClient) {- s3StorageServiceClient = new S3StorageService({+ s3StorageServiceClient = StorageServiceFactory.getInstance({bucketName,accessKeyId: env.LANGFUSE_S3_EVENT_UPLOAD_ACCESS_KEY_ID,secretAccessKey: env.LANGFUSE_S3_EVENT_UPLOAD_SECRET_ACCESS_KEY,diff --git a/packages/shared/src/server/repositories/clickhouse.ts b/packages/shared/src/server/repositories/clickhouse.tsindex 7ddcc8a976..9d137c1da2 100644--- a/packages/shared/src/server/repositories/clickhouse.ts+++ b/packages/shared/src/server/repositories/clickhouse.ts@@ -5,16 +5,19 @@ import {} from "../clickhouse/client";import { logger } from "../logger";import { instrumentAsync } from "../instrumentation";-import { S3StorageService } from "../services/S3StorageService";+import {+ StorageService,+ StorageServiceFactory,+} from "../services/StorageService";import { randomUUID } from "crypto";import { getClickhouseEntityType } from "../clickhouse/schemaUtils";import { NodeClickHouseClientConfigOptions } from "@clickhouse/client/dist/config";-let s3StorageServiceClient: S3StorageService;+let s3StorageServiceClient: StorageService;-const getS3StorageServiceClient = (bucketName: string): S3StorageService => {+const getS3StorageServiceClient = (bucketName: string): StorageService => {if (!s3StorageServiceClient) {- s3StorageServiceClient = new S3StorageService({+ s3StorageServiceClient = StorageServiceFactory.getInstance({bucketName,accessKeyId: env.LANGFUSE_S3_EVENT_UPLOAD_ACCESS_KEY_ID,secretAccessKey: env.LANGFUSE_S3_EVENT_UPLOAD_SECRET_ACCESS_KEY,diff --git a/packages/shared/src/server/services/S3StorageService.ts b/packages/shared/src/server/services/S3StorageService.tsdeleted file mode 100644index 05494225fa..0000000000--- a/packages/shared/src/server/services/S3StorageService.ts+++ /dev/null@@ -1,172 +0,0 @@-import type { Readable } from "stream";-import {- GetObjectCommand,- ListObjectsV2Command,- PutObjectCommand,- S3Client,-} from "@aws-sdk/client-s3";-import { Upload } from "@aws-sdk/lib-storage";-import { getSignedUrl } from "@aws-sdk/s3-request-presigner";-import { logger } from "../logger";--type UploadFile = {- fileName: string;- fileType: string;- data: Readable | string;- expiresInSeconds: number;-};--export class S3StorageService {- private client: S3Client;- private bucketName: string;-- constructor(params: {- accessKeyId: string | undefined;- secretAccessKey: string | undefined;- bucketName: string;- endpoint: string | undefined;- region: string | undefined;- forcePathStyle: boolean;- }) {- // Use accessKeyId and secretAccessKey if provided or fallback to default credentials- const { accessKeyId, secretAccessKey } = params;- const credentials =- accessKeyId !== undefined && secretAccessKey !== undefined- ? {- accessKeyId,- secretAccessKey,- }- : undefined;-- this.client = new S3Client({- credentials,- endpoint: params.endpoint,- region: params.region,- forcePathStyle: params.forcePathStyle,- });- this.bucketName = params.bucketName;- }-- public async uploadFile({- fileName,- fileType,- data,- expiresInSeconds,- }: UploadFile): Promise<{ signedUrl: string }> {- try {- await new Upload({- client: this.client,- params: {- Bucket: this.bucketName,- Key: fileName,- Body: data,- ContentType: fileType,- },- }).done();-- const signedUrl = await this.getSignedUrl(fileName, expiresInSeconds);-- return { signedUrl };- } catch (err) {- logger.error(`Failed to upload file to ${fileName}`, err);- throw new Error("Failed to upload to S3 or generate signed URL");- }- }-- public async uploadJson(path: string, body: Record<string, unknown>[]) {- const putCommand = new PutObjectCommand({- Bucket: this.bucketName,- Key: path,- Body: JSON.stringify(body),- ContentType: "application/json",- });-- try {- await this.client.send(putCommand);- } catch (err) {- logger.error(`Failed to upload JSON to S3 ${path}`, err);- throw Error("Failed to upload JSON to S3");- }- }-- public async download(path: string): Promise<string> {- const getCommand = new GetObjectCommand({- Bucket: this.bucketName,- Key: path,- });-- try {- const response = await this.client.send(getCommand);- return (await response.Body?.transformToString()) ?? "";- } catch (err) {- logger.error(`Failed to download file from S3 ${path}`, err);- throw Error("Failed to download file from S3");- }- }-- public async listFiles(prefix: string): Promise<string[]> {- const listCommand = new ListObjectsV2Command({- Bucket: this.bucketName,- Prefix: prefix,- });-- try {- const response = await this.client.send(listCommand);- return (- response.Contents?.flatMap((file) => (file.Key ? [file.Key] : [])) ?? []- );- } catch (err) {- logger.error(`Failed to list files from S3 ${prefix}`, err);- throw Error("Failed to list files from S3");- }- }-- public async getSignedUrl(- fileName: string,- ttlSeconds: number,- asAttachment: boolean = true,- ): Promise<string> {- try {- return await getSignedUrl(- this.client,- new GetObjectCommand({- Bucket: this.bucketName,- Key: fileName,- ResponseContentDisposition: asAttachment- ? `attachment; filename="${fileName}"`- : undefined,- }),- { expiresIn: ttlSeconds },- );- } catch (err) {- logger.error(`Failed to generate presigned URL for ${fileName}`, err);- throw Error("Failed to generate signed URL");- }- }-- public async getSignedUploadUrl(params: {- path: string;- ttlSeconds: number;- sha256Hash: string;- contentType: string;- contentLength: number;- }): Promise<string> {- const { path, ttlSeconds, contentType, contentLength, sha256Hash } = params;-- return await getSignedUrl(- this.client,- new PutObjectCommand({- Bucket: this.bucketName,- Key: path,- ContentType: contentType,- ChecksumSHA256: sha256Hash,- ContentLength: contentLength,- }),- {- expiresIn: ttlSeconds,- signableHeaders: new Set(["content-type", "content-length"]),- unhoistableHeaders: new Set(["x-amz-checksum-sha256"]),- },- );- }-}diff --git a/packages/shared/src/server/services/StorageService.ts b/packages/shared/src/server/services/StorageService.tsnew file mode 100644index 0000000000..bea6d90e6e--- /dev/null+++ b/packages/shared/src/server/services/StorageService.ts@@ -0,0 +1,432 @@+import { Readable } from "stream";+import {+ GetObjectCommand,+ ListObjectsV2Command,+ PutObjectCommand,+ S3Client,+} from "@aws-sdk/client-s3";+import { Upload } from "@aws-sdk/lib-storage";+import { getSignedUrl } from "@aws-sdk/s3-request-presigner";+import {+ BlobSASPermissions,+ BlobServiceClient,+ ContainerClient,+ StorageSharedKeyCredential,+} from "@azure/storage-blob";+import { logger } from "../logger";+import { env } from "../../env";++type UploadFile = {+ fileName: string;+ fileType: string;+ data: Readable | string;+ expiresInSeconds: number;+};++export interface StorageService {+ uploadFile(params: UploadFile): Promise<{ signedUrl: string }>;++ uploadJson(path: string, body: Record<string, unknown>[]): Promise<void>;++ download(path: string): Promise<string>;++ listFiles(prefix: string): Promise<string[]>;++ getSignedUrl(+ fileName: string,+ ttlSeconds: number,+ asAttachment?: boolean,+ ): Promise<string>;++ getSignedUploadUrl(params: {+ path: string;+ ttlSeconds: number;+ sha256Hash: string;+ contentType: string;+ contentLength: number;+ }): Promise<string>;+}++export class StorageServiceFactory {+ public static getInstance(params: {+ accessKeyId: string | undefined;+ secretAccessKey: string | undefined;+ bucketName: string;+ endpoint: string | undefined;+ region: string | undefined;+ forcePathStyle: boolean;+ }): StorageService {+ if (env.LANGFUSE_USE_AZURE_BLOB === "true") {+ return new AzureBlobStorageService(params);+ }+ return new S3StorageService(params);+ }+}++class AzureBlobStorageService implements StorageService {+ private client: ContainerClient;+ private container: string;++ constructor(params: {+ accessKeyId: string | undefined;+ secretAccessKey: string | undefined;+ bucketName: string;+ endpoint: string | undefined;+ region: string | undefined;+ forcePathStyle: boolean;+ }) {+ const { accessKeyId, secretAccessKey, endpoint } = params;+ if (!accessKeyId || !secretAccessKey || !endpoint) {+ throw new Error(+ `Endpoint, account and account key must be configured to use Azure Blob Storage`,+ );+ }++ const sharedKeyCredential = new StorageSharedKeyCredential(+ accessKeyId,+ secretAccessKey,+ );+ const blobServiceClient = new BlobServiceClient(+ endpoint,+ sharedKeyCredential,+ );+ this.container = params.bucketName;+ this.client = blobServiceClient.getContainerClient(this.container);+ }++ private async createContainerIfNotExists(): Promise<void> {+ try {+ await this.client.createIfNotExists();+ } catch (err) {+ logger.error(+ `Failed to create Azure Blob Storage container ${this.container}`,+ err,+ );+ throw Error("Failed to create Azure Blob Storage container ");+ }+ }++ public async uploadFile(params: UploadFile): Promise<{ signedUrl: string }> {+ const { fileName, data, expiresInSeconds } = params;+ try {+ await this.createContainerIfNotExists();++ const blockBlobClient = this.client.getBlockBlobClient(fileName);++ if (typeof data === "string") {+ await blockBlobClient.upload(data, data.length);+ } else if (data instanceof Readable) {+ let offset = 0;+ const blockIds = [];+ for await (const chunk of data) {+ const blockId = Buffer.from(`block-${offset}`).toString("base64");+ const bufferChunk = Buffer.isBuffer(chunk)+ ? chunk+ : Buffer.from(chunk);++ await blockBlobClient.stageBlock(+ blockId,+ bufferChunk,+ bufferChunk.length,+ );+ blockIds.push(blockId);++ offset += bufferChunk.length;+ }++ await blockBlobClient.commitBlockList(blockIds);+ } else {+ throw new Error("Unsupported data type. Must be Readable or string.");+ }++ return {+ signedUrl: await this.getSignedUrl(fileName, expiresInSeconds, false),+ };+ } catch (err) {+ logger.error(+ `Failed to upload file to Azure Blob Storage ${fileName}`,+ err,+ );+ throw Error("Failed to upload file to Azure Blob Storage");+ }+ }++ public async uploadJson(+ path: string,+ body: Record<string, unknown>[],+ ): Promise<void> {+ await this.createContainerIfNotExists();++ const blockBlobClient = this.client.getBlockBlobClient(path);+ const content = JSON.stringify(body);+ try {+ await blockBlobClient.upload(content, content.length);+ } catch (err) {+ logger.error(`Failed to upload JSON to Azure Blob Storage ${path}`, err);+ throw Error("Failed to upload JSON to Azure Blob Storage");+ }+ }++ private async streamToString(+ readableStream: NodeJS.ReadableStream,+ ): Promise<string> {+ return new Promise((resolve, reject) => {+ const chunks: string[] = [];+ readableStream.on("data", (data) => {+ chunks.push(data.toString());+ });+ readableStream.on("end", () => {+ resolve(chunks.join(""));+ });+ readableStream.on("error", reject);+ });+ }++ public async download(path: string): Promise<string> {+ try {+ await this.createContainerIfNotExists();++ const blobClient = this.client.getBlobClient(path);+ const downloadResponse = await blobClient.download();+ if (!downloadResponse.readableStreamBody) {+ throw Error("No stream body available");+ }+ return this.streamToString(downloadResponse.readableStreamBody);+ } catch (err) {+ logger.error(+ `Failed to download file from Azure Blob Storage ${path}`,+ err,+ );+ throw Error("Failed to download file from Azure Blob Storage");+ }+ }++ public async listFiles(prefix: string): Promise<string[]> {+ try {+ await this.createContainerIfNotExists();++ const result = await this.client.listBlobsFlat({ prefix });+ const files = [];+ for await (const blob of result) {+ if (blob.name.startsWith(prefix)) {+ files.push(blob.name);+ }+ }+ return files;+ } catch (err) {+ logger.error(+ `Failed to list files from Azure Blob Storage ${prefix}`,+ err,+ );+ throw Error("Failed to list files from Azure Blob Storage");+ }+ }++ public async getSignedUrl(+ fileName: string,+ ttlSeconds: number,+ asAttachment?: boolean,+ ): Promise<string> {+ try {+ await this.createContainerIfNotExists();++ const blockBlobClient = this.client.getBlockBlobClient(fileName);+ return blockBlobClient.generateSasUrl({+ permissions: BlobSASPermissions.parse("r"),+ expiresOn: new Date(Date.now() + ttlSeconds * 1000),+ contentDisposition: asAttachment+ ? `attachment; filename="${fileName}"`+ : undefined,+ });+ } catch (err) {+ logger.error(+ `Failed to generate presigned URL for Azure Blob Storage ${fileName}`,+ err,+ );+ throw Error("Failed to generate presigned URL for Azure Blob Storage");+ }+ }++ public async getSignedUploadUrl(params: {+ path: string;+ ttlSeconds: number;+ sha256Hash: string;+ contentType: string;+ contentLength: number;+ }): Promise<string> {+ const { path, ttlSeconds, contentType } = params;+ try {+ await this.createContainerIfNotExists();++ const blockBlobClient = this.client.getBlockBlobClient(path);+ return blockBlobClient.generateSasUrl({+ permissions: BlobSASPermissions.parse("w"),+ expiresOn: new Date(Date.now() + ttlSeconds * 1000),+ contentType: contentType,+ });+ } catch (err) {+ logger.error(+ `Failed to generate presigned upload URL for Azure Blob Storage ${path}`,+ err,+ );+ throw Error(+ "Failed to generate presigned upload URL for Azure Blob Storage",+ );+ }+ }+}++class S3StorageService implements StorageService {+ private client: S3Client;+ private bucketName: string;++ constructor(params: {+ accessKeyId: string | undefined;+ secretAccessKey: string | undefined;+ bucketName: string;+ endpoint: string | undefined;+ region: string | undefined;+ forcePathStyle: boolean;+ }) {+ // Use accessKeyId and secretAccessKey if provided or fallback to default credentials+ const { accessKeyId, secretAccessKey } = params;+ const credentials =+ accessKeyId !== undefined && secretAccessKey !== undefined+ ? {+ accessKeyId,+ secretAccessKey,+ }+ : undefined;++ this.client = new S3Client({+ credentials,+ endpoint: params.endpoint,+ region: params.region,+ forcePathStyle: params.forcePathStyle,+ });+ this.bucketName = params.bucketName;+ }++ public async uploadFile({+ fileName,+ fileType,+ data,+ expiresInSeconds,+ }: UploadFile): Promise<{ signedUrl: string }> {+ try {+ await new Upload({+ client: this.client,+ params: {+ Bucket: this.bucketName,+ Key: fileName,+ Body: data,+ ContentType: fileType,+ },+ }).done();++ const signedUrl = await this.getSignedUrl(fileName, expiresInSeconds);++ return { signedUrl };+ } catch (err) {+ logger.error(`Failed to upload file to ${fileName}`, err);+ throw new Error("Failed to upload to S3 or generate signed URL");+ }+ }++ public async uploadJson(path: string, body: Record<string, unknown>[]) {+ const putCommand = new PutObjectCommand({+ Bucket: this.bucketName,+ Key: path,+ Body: JSON.stringify(body),+ ContentType: "application/json",+ });++ try {+ await this.client.send(putCommand);+ } catch (err) {+ logger.error(`Failed to upload JSON to S3 ${path}`, err);+ throw Error("Failed to upload JSON to S3");+ }+ }++ public async download(path: string): Promise<string> {+ const getCommand = new GetObjectCommand({+ Bucket: this.bucketName,+ Key: path,+ });++ try {+ const response = await this.client.send(getCommand);+ return (await response.Body?.transformToString()) ?? "";+ } catch (err) {+ logger.error(`Failed to download file from S3 ${path}`, err);+ throw Error("Failed to download file from S3");+ }+ }++ public async listFiles(prefix: string): Promise<string[]> {+ const listCommand = new ListObjectsV2Command({+ Bucket: this.bucketName,+ Prefix: prefix,+ });++ try {+ const response = await this.client.send(listCommand);+ return (+ response.Contents?.flatMap((file) => (file.Key ? [file.Key] : [])) ?? []+ );+ } catch (err) {+ logger.error(`Failed to list files from S3 ${prefix}`, err);+ throw Error("Failed to list files from S3");+ }+ }++ public async getSignedUrl(+ fileName: string,+ ttlSeconds: number,+ asAttachment: boolean = true,+ ): Promise<string> {+ try {+ return await getSignedUrl(+ this.client,+ new GetObjectCommand({+ Bucket: this.bucketName,+ Key: fileName,+ ResponseContentDisposition: asAttachment+ ? `attachment; filename="${fileName}"`+ : undefined,+ }),+ { expiresIn: ttlSeconds },+ );+ } catch (err) {+ logger.error(`Failed to generate presigned URL for ${fileName}`, err);+ throw Error("Failed to generate signed URL");+ }+ }++ public async getSignedUploadUrl(params: {+ path: string;+ ttlSeconds: number;+ sha256Hash: string;+ contentType: string;+ contentLength: number;+ }): Promise<string> {+ const { path, ttlSeconds, contentType, contentLength, sha256Hash } = params;++ return await getSignedUrl(+ this.client,+ new PutObjectCommand({+ Bucket: this.bucketName,+ Key: path,+ ContentType: contentType,+ ChecksumSHA256: sha256Hash,+ ContentLength: contentLength,+ }),+ {+ expiresIn: ttlSeconds,+ signableHeaders: new Set(["content-type", "content-length"]),+ unhoistableHeaders: new Set(["x-amz-checksum-sha256"]),+ },+ );+ }+}diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 26da7ef1b3..17d0f8a5f6 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -101,7 +101,7 @@ importers:version: 7.12.0([email protected])([email protected])'@vercel/style-guide':specifier: ^6.0.0- version: 6.0.0(@next/[email protected])([email protected])([email protected](@types/[email protected])([email protected]))([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected]([email protected]))([email protected]))+ version: 6.0.0(@next/[email protected])([email protected])([email protected](@types/[email protected])([email protected]))([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected](@types/[email protected])([email protected]))([email protected]))eslint-config-next:specifier: ^14.2.15version: 14.2.15([email protected])([email protected])@@ -137,6 +137,9 @@ importers:'@aws-sdk/s3-request-presigner':specifier: ^3.679.0version: 3.679.0+ '@azure/storage-blob':+ specifier: ^12.26.0+ version: 12.26.0'@clickhouse/client':specifier: ^1.4.0version: 1.4.0@@ -296,7 +299,7 @@ importers:version: 5.4.5vitest:specifier: ^2.1.2- version: 2.1.2(@types/[email protected])([email protected])([email protected]([email protected]))([email protected])+ version: 2.1.2(@types/[email protected])([email protected])([email protected](@types/[email protected])([email protected]))([email protected])web:dependencies:@@ -691,7 +694,7 @@ importers:'@testing-library/jest-dom':specifier: ^6.4.6- version: 6.4.6(@jest/[email protected])(@types/[email protected])([email protected](@types/[email protected])([email protected])([email protected](@types/[email protected])([email protected])))([email protected](@types/[email protected])([email protected])([email protected]([email protected]))([email protected]))+ version: 6.4.6(@jest/[email protected])(@types/[email protected])([email protected](@types/[email protected])([email protected])([email protected](@types/[email protected])([email protected])))([email protected](@types/[email protected])([email protected])([email protected](@types/[email protected])([email protected]))([email protected]))'@testing-library/react':specifier: ^15.0.7@@ -940,8 +943,8 @@ importers:specifier: ^0.16.8version: 0.16.8([email protected])([email protected])msw:- specifier: ^2.4.9- version: 2.4.9([email protected])+ specifier: ^2.6.5+ version: 2.6.5(@types/[email protected])([email protected])nodemon:specifier: ^3.1.7version: 3.1.7@@ -962,7 +965,7 @@ importers:version: 5.4.5vitest:specifier: ^2.1.2- version: 2.1.2(@types/[email protected])([email protected])([email protected]([email protected]))([email protected])+ version: 2.1.2(@types/[email protected])([email protected])([email protected](@types/[email protected])([email protected]))([email protected])packages:@@ -1323,6 +1326,54 @@ packages:resolution: {integrity: sha512-ikLkXn0igUpnJu2mCZjklvmcDGWT9OaLRv3JyC/cRkTaaSrblPjPM7KKsltxdMTLQ+v7fjCN0TsJpxphMfaOPA==}engines: {node: '>=16.0.0'}+ '@azure/[email protected]':+ resolution: {integrity: sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA==}+ engines: {node: '>=18.0.0'}++ '@azure/[email protected]':+ resolution: {integrity: sha512-FPwHpZywuyasDSLMqJ6fhbOK3TqUdviZNF8OqRGA4W5Ewib2lEEZ+pBsYcBa88B2NGO/SEnYPGhyBqNlE8ilSw==}+ engines: {node: '>=18.0.0'}++ '@azure/[email protected]':+ resolution: {integrity: sha512-kRdry/rav3fUKHl/aDLd/pDLcB+4pOFwPPTVEExuMyaI5r+JBbMWqRbCY1pn5BniDaU3lRxO9eaQ1AmSMehl/w==}+ engines: {node: '>=18.0.0'}++ '@azure/[email protected]':+ resolution: {integrity: sha512-5MnV1yqzZwgNLLjlizsU3QqOeQChkIXw781Fwh1xdAqJR5AA32IUaq6xv1BICJvfbHoa+JYcaij2HFkhLbNTJQ==}+ engines: {node: '>=18.0.0'}++ '@azure/[email protected]':+ resolution: {integrity: sha512-0YIpccoX8m/k00O7mDDMdJpbr6mf1yWo2dfmxt5A8XVZVVMz2SSKaEbMCeJRvgQ0IaSlqhjT47p4hVIRRy90xw==}+ engines: {node: '>=18.0.0'}++ '@azure/[email protected]':+ resolution: {integrity: sha512-YKWi9YuCU04B55h25cnOYZHxXYtEvQEbKST5vqRga7hWY9ydd3FZHdeQF8pyh+acWZvppw13M/LMGx0LABUVMA==}+ engines: {node: '>=18.0.0'}++ '@azure/[email protected]':+ resolution: {integrity: sha512-QSoGUp4Eq/gohEFNJaUOwTN7BCc2nHTjjbm75JT0aD7W65PWM1H/tItz0GsABn22uaKyGxiMhWQLt2r+FGU89Q==}+ engines: {node: '>=18.0.0'}++ '@azure/[email protected]':+ resolution: {integrity: sha512-UKTiEJPkWcESPYJz3X5uKRYyOcJD+4nYph+KpfdPRnQJVrZfk0KJgdnaAWKfhsBBtAf/D58Az4AvCJEmWgIBAg==}+ engines: {node: '>=18.0.0'}++ '@azure/[email protected]':+ resolution: {integrity: sha512-DxOSLua+NdpWoSqULhjDyAZTXFdP/LKkqtYuxxz1SCN289zk3OG8UOpnCQAz/tygyACBtWp/BoO72ptK7msY8g==}+ engines: {node: '>=18.0.0'}++ '@azure/[email protected]':+ resolution: {integrity: sha512-J4FYAqakGXcbfeZjwjMzjNcpcH4E+JtEBv+xcV1yL0Ydn/6wbQfeFKTCHh9wttAi0lmajHw7yBbHPRG+YHckZQ==}+ engines: {node: '>=18.0.0'}++ '@azure/[email protected]':+ resolution: {integrity: sha512-4IXXzcCdLdlXuCG+8UKEwLA1T1NHqUfanhXYHiQTn+6sfWCZXduqbtXDGceg3Ce5QxTGo7EqmbV6Bi+aqKuClQ==}+ engines: {node: '>=18.0.0'}++ '@azure/[email protected]':+ resolution: {integrity: sha512-SriLPKezypIsiZ+TtlFfE46uuBIap2HeaQVS78e1P7rz5OSbq0rsd52WE1mC5f7vAeLiXqv7I7oRhL3WFZEw3Q==}+ engines: {node: '>=18.0.0'}+'@babel/[email protected]':resolution: {integrity: sha512-y5+tLQyV8pg3fsiln67BVLD1P13Eg4lh5RW9mF0zUuvLrv9uIQ4MCL+CRT+FTsBlBjcIan6PGsLcBN0m3ClUyQ==}engines: {node: '>=6.9.0'}@@ -1559,8 +1610,8 @@ packages:'@braintree/[email protected]':resolution: {integrity: sha512-o+UlMLt49RvtCASlOMW0AkHnabN9wR9rwCCherxO0yG4Npy34GkvrAqdXQvrhNs+jh+gkK8gB8Lf05qL/O7KWg==}- '@bundled-es-modules/[email protected]':- resolution: {integrity: sha512-Or6YHg/kamKHpxULAdSqhGqnWFneIXu1NKvvfBBzKGwpVsYuFIQ5aBPHDnnoR3ghW1nvSkALd+EF9iMtY7Vjxw==}+ '@bundled-es-modules/[email protected]':+ resolution: {integrity: sha512-8o+5fRPLNbjbdGRRmJj3h6Hh1AQJf2dk3qQ/5ZFb+PXkRNiSoMGGUKlsgLfrxneb72axVJyIYji64E2+nNfYyw==}'@bundled-es-modules/[email protected]':resolution: {integrity: sha512-yn7BklA5acgcBr+7w064fGV+SGIFySjCKpqjcWgBAIfrAkY+4GQTJJHQMeT3V/sgz23VTEVV8TtOmkvJAhFVfg==}@@ -2177,21 +2228,29 @@ packages:'@iconify/[email protected]':resolution: {integrity: sha512-jP9h6v/g0BIZx0p7XGJJVtkVnydtbgTgt9mVNcGDYwaa7UhdHdI9dvoq+gKj9sijMSJKxUPEG2JyjsgXjxL7Kw==}- '@inquirer/[email protected]':- resolution: {integrity: sha512-Mj4TU29g6Uy+37UtpA8UpEOI2icBfpCwSW1QDtfx60wRhUy90s/kHPif2OXSSvuwDQT1lhAYRWUfkNf9Tecxvg==}+ '@inquirer/[email protected]':+ resolution: {integrity: sha512-KJLUHOaKnNCYzwVbryj3TNBxyZIrr56fR5N45v6K9IPrbT6B7DcudBMfylkV1A8PUdJE15mybkEQyp2/ZUpxUA==}engines: {node: '>=18'}+ peerDependencies:+ '@types/node': '>=18'- '@inquirer/[email protected]':- resolution: {integrity: sha512-kfx0SU9nWgGe1f03ao/uXc85SFH1v2w3vQVH7QDGjKxdtJz+7vPitFtG++BTyJMYyYgH8MpXigutcXJeiQwVRw==}+ '@inquirer/[email protected]':+ resolution: {integrity: sha512-I+ETk2AL+yAVbvuKx5AJpQmoaWhpiTFOg/UJb7ZkMAK4blmtG8ATh5ct+T/8xNld0CZG/2UhtkdMwpgvld92XQ==}engines: {node: '>=18'}'@inquirer/[email protected]':resolution: {integrity: sha512-ErXXzENMH5pJt5/ssXV0DfWUZqly8nGzf0UcBV9xTnP+KyffE2mqyxIMBrZ8ijQck2nU0TQm40EQB53YreyWHw==}engines: {node: '>=18'}- '@inquirer/[email protected]':- resolution: {integrity: sha512-Pe3PFccjPVJV1vtlfVvm9OnlbxqdnP5QcscFEFEnK5quChf1ufZtM0r8mR5ToWHMxZOh0s8o/qp9ANGRTo/DAw==}+ '@inquirer/[email protected]':+ resolution: {integrity: sha512-tKd+jsmhq21AP1LhexC0pPwsCxEhGgAkg28byjJAd+xhmIs8LUX8JbUc3vBf3PhLxWiB5EvyBE5X7JSPAqMAqg==}+ engines: {node: '>=18'}++ '@inquirer/[email protected]':+ resolution: {integrity: sha512-+ksJMIy92sOAiAccGpcKZUc3bYO07cADnscIxHBknEm3uNts3movSmBofc1908BNy5edKscxYeAdaX1NXkHS6A==}engines: {node: '>=18'}+ peerDependencies:+ '@types/node': '>=18''@ioredis/[email protected]':resolution: {integrity: sha512-Sx1pU8EM64o2BrqNpEO1CNLtKQwyhuXuqyfH7oGKCk+1a33d2r5saW8zNwm3j6BTExtjrv2BxTgzzkMwts6vGg==}@@ -2430,8 +2489,8 @@ packages:cpu: [x64]os: [win32]- '@mswjs/[email protected]':- resolution: {integrity: sha512-SSnyl/4ni/2ViHKkiZb8eajA/eN1DNFaHjhGiLUdZvDz6PKF4COSf/17xqSz64nOo2Ia29SA6B2KNCsyCbVmaQ==}+ '@mswjs/[email protected]':+ resolution: {integrity: sha512-SvE+tSpcX884RJrPCskXxoS965Ky/pYABDEhWW6oeSRhpUDLrS5nTvT5n1LLSDVDYvty4imVmXsy+3/ROVuknA==}engines: {node: '>=18'}'@mui/[email protected]':@@ -4798,9 +4857,6 @@ packages:'@types/[email protected]':resolution: {integrity: sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==}- '@types/[email protected]':- resolution: {integrity: sha512-CPM9nzrCPPJHQNA9keH9CVkVI+WR5kMa+7XEs5jcGQ0VoAGnLv242w8lIVgwAEfmE4oufJRaTc9PNLQl0ioAow==}-'@types/[email protected]':resolution: {integrity: sha512-DSLCOXhkvfS5WNNPbfn2KdICAmk8lLc+/PNvnPnF7gOdMZCxopXduqv0OQ13y/yA/zXTSikZZqVgybUxOEg6YQ==}@@ -4912,9 +4968,6 @@ packages:'@types/[email protected]':resolution: {integrity: sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA==}- '@types/[email protected]':- resolution: {integrity: sha512-ltIpx+kM7g/MLRZfkbL7EsCEjfzCcScLpkg37eXEtx5kmrAKBkTJwd1GIAjDSL8wTpM6Hzn5YO4pSb91BEwu1g==}-'@types/[email protected]':resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==}@@ -5971,6 +6024,10 @@ packages:resolution: {integrity: sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==}engines: {node: '>= 0.6'}+ resolution: {integrity: sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==}+ engines: {node: '>= 0.6'}+resolution: {integrity: sha512-yCEafptTtb4bk7GLEQoM8KVJpxAfdBJYaXyzQEgQQQgYrZiDp8SJmGKlYza6CYjEDNstAdNdKA3UuoULlEbS6w==}engines: {node: '>=12.13'}@@ -8827,8 +8884,8 @@ packages:resolution: {integrity: sha512-r5VRLv9qouXuLiIBrLpl2d5ZvPt8svdQTl5/vMvE4nzDMyEX4sgW5yWhuBBj5UmgwOTWj8CIdSXn5sAfsHAWIQ==}- resolution: {integrity: sha512-1m8xccT6ipN4PTqLinPwmzhxQREuxaEJYdx4nIbggxP8aM7r1e71vE7RtOUSQoAm1LydjGfZKy7370XD/tsuYg==}+ resolution: {integrity: sha512-PnlnTpUlOrj441kYQzzFhzMzMCGFT6a2jKUBG7zSpLkYS5oh8Arrbc0dL8/rNAtxaoBy0EVs2mFqj2qdmWK7lQ==}engines: {node: '>=18'}hasBin: truepeerDependencies:@@ -8845,6 +8902,10 @@ packages:resolution: {integrity: sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==}engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}+ resolution: {integrity: sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA==}+ engines: {node: ^18.17.0 || >=20.5.0}+resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==}@@ -10885,8 +10946,8 @@ packages:resolution: {integrity: sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==}engines: {node: '>=12.20'}- resolution: {integrity: sha512-+suCYpfJLAe4OXS6+PPXjW3urOS4IoP9waSiLuXfLgqZODKw/aWwASvzqE886wA0kQgGy0mIWyhd87VpqIy6Xg==}+ resolution: {integrity: sha512-3IMSWgP7C5KSQqmo1wjhKrwsvXAtF33jO3QY+Uy++ia7hqvgSK6iXbbg5PbDBc1P2ZbNEDgejOrN4YooXvhwCw==}engines: {node: '>=16'}@@ -11410,6 +11471,10 @@ packages:resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}engines: {node: '>=10'}+ resolution: {integrity: sha512-cYVsTjKl8b+FrnidjibDWskAv7UKOfcwaVZdp/it9n1s9fU3IkgDbhdIRKCW4JDsAlECJY0ytoVPT3sK6kideA==}+ engines: {node: '>=18'}+resolution: {integrity: sha512-9qv4rlDiopXg4E69k+vMHjNN63YFMe9sZMrdlvKnCjlCRWeCBswPPMPUfx+ipsAWq1LXHe70RcbaHdJJpS6hyQ==}engines: {node: '>= 10'}@@ -12638,6 +12703,96 @@ snapshots:'@smithy/types': 3.5.0tslib: 2.6.3+ '@azure/[email protected]':+ dependencies:+ tslib: 2.6.3++ '@azure/[email protected]':+ dependencies:+ '@azure/abort-controller': 2.1.2+ '@azure/core-util': 1.11.0+ tslib: 2.6.3++ '@azure/[email protected]':+ dependencies:+ '@azure/abort-controller': 2.1.2+ '@azure/core-auth': 1.9.0+ '@azure/core-rest-pipeline': 1.18.0+ '@azure/core-tracing': 1.2.0+ '@azure/core-util': 1.11.0+ '@azure/logger': 1.1.4+ tslib: 2.6.3+ transitivePeerDependencies:+ - supports-color++ '@azure/[email protected]':+ dependencies:+ '@azure/abort-controller': 2.1.2+ '@azure/core-client': 1.9.2+ '@azure/core-rest-pipeline': 1.18.0+ transitivePeerDependencies:+ - supports-color++ '@azure/[email protected]':+ dependencies:+ '@azure/abort-controller': 2.1.2+ '@azure/core-util': 1.11.0+ '@azure/logger': 1.1.4+ tslib: 2.6.3++ '@azure/[email protected]':+ dependencies:+ tslib: 2.6.3++ '@azure/[email protected]':+ dependencies:+ '@azure/abort-controller': 2.1.2+ '@azure/core-auth': 1.9.0+ '@azure/core-tracing': 1.2.0+ '@azure/core-util': 1.11.0+ '@azure/logger': 1.1.4+ http-proxy-agent: 7.0.2+ https-proxy-agent: 7.0.4+ tslib: 2.6.3+ transitivePeerDependencies:+ - supports-color++ '@azure/[email protected]':+ dependencies:+ tslib: 2.6.3++ '@azure/[email protected]':+ dependencies:+ '@azure/abort-controller': 2.1.2+ tslib: 2.6.3++ '@azure/[email protected]':+ dependencies:+ fast-xml-parser: 4.5.0+ tslib: 2.6.3++ '@azure/[email protected]':+ dependencies:+ tslib: 2.6.3++ '@azure/[email protected]':+ dependencies:+ '@azure/abort-controller': 2.1.2+ '@azure/core-auth': 1.9.0+ '@azure/core-client': 1.9.2+ '@azure/core-http-compat': 2.1.2+ '@azure/core-lro': 2.7.2+ '@azure/core-paging': 1.6.2+ '@azure/core-rest-pipeline': 1.18.0+ '@azure/core-tracing': 1.2.0+ '@azure/core-util': 1.11.0+ '@azure/core-xml': 1.4.4+ '@azure/logger': 1.1.4+ events: 3.3.0+ tslib: 2.6.3+ transitivePeerDependencies:+ - supports-color+'@babel/[email protected]':dependencies:'@babel/highlight': 7.24.5@@ -12927,9 +13082,9 @@ snapshots:'@braintree/[email protected]': {}- '@bundled-es-modules/[email protected]':+ '@bundled-es-modules/[email protected]':dependencies:- cookie: 0.5.0+ cookie: 0.7.2'@bundled-es-modules/[email protected]':dependencies:@@ -13520,30 +13675,87 @@ snapshots:transitivePeerDependencies:- supports-color- '@inquirer/[email protected]':+ '@inquirer/[email protected](@types/[email protected])':dependencies:- '@inquirer/core': 8.1.0- '@inquirer/type': 1.3.1+ '@inquirer/core': 10.1.0(@types/[email protected])+ '@inquirer/type': 3.0.1(@types/[email protected])+ '@types/node': 20.10.5+ optional: true- '@inquirer/[email protected]':+ '@inquirer/[email protected](@types/[email protected])':dependencies:- '@inquirer/figures': 1.0.3- '@inquirer/type': 1.3.1- '@types/mute-stream': 0.0.4+ '@inquirer/core': 10.1.0(@types/[email protected])+ '@inquirer/type': 3.0.1(@types/[email protected])+ '@types/node': 20.11.29++ '@inquirer/[email protected](@types/[email protected])':+ dependencies:+ '@inquirer/core': 10.1.0(@types/[email protected])+ '@inquirer/type': 3.0.1(@types/[email protected])'@types/node': 20.14.8- '@types/wrap-ansi': 3.0.0+ optional: true++ '@inquirer/[email protected](@types/[email protected])':+ dependencies:+ '@inquirer/figures': 1.0.8+ '@inquirer/type': 3.0.1(@types/[email protected])ansi-escapes: 4.3.2- chalk: 4.1.2- cli-spinners: 2.9.2cli-width: 4.1.0- mute-stream: 1.0.0+ mute-stream: 2.0.0signal-exit: 4.1.0strip-ansi: 6.0.1wrap-ansi: 6.2.0+ yoctocolors-cjs: 2.1.2+ transitivePeerDependencies:+ - '@types/node'+ optional: true++ '@inquirer/[email protected](@types/[email protected])':+ dependencies:+ '@inquirer/figures': 1.0.8+ '@inquirer/type': 3.0.1(@types/[email protected])+ ansi-escapes: 4.3.2+ cli-width: 4.1.0+ mute-stream: 2.0.0+ signal-exit: 4.1.0+ strip-ansi: 6.0.1+ wrap-ansi: 6.2.0+ yoctocolors-cjs: 2.1.2+ transitivePeerDependencies:+ - '@types/node'++ '@inquirer/[email protected](@types/[email protected])':+ dependencies:+ '@inquirer/figures': 1.0.8+ '@inquirer/type': 3.0.1(@types/[email protected])+ ansi-escapes: 4.3.2+ cli-width: 4.1.0+ mute-stream: 2.0.0+ signal-exit: 4.1.0+ strip-ansi: 6.0.1+ wrap-ansi: 6.2.0+ yoctocolors-cjs: 2.1.2+ transitivePeerDependencies:+ - '@types/node'+ optional: true'@inquirer/[email protected]': {}- '@inquirer/[email protected]': {}+ '@inquirer/[email protected]': {}++ '@inquirer/[email protected](@types/[email protected])':+ dependencies:+ '@types/node': 20.10.5+ optional: true++ '@inquirer/[email protected](@types/[email protected])':+ dependencies:+ '@types/node': 20.11.29++ '@inquirer/[email protected](@types/[email protected])':+ dependencies:+ '@types/node': 20.14.8+ optional: true'@ioredis/[email protected]': {}@@ -13929,7 +14141,7 @@ snapshots:'@msgpackr-extract/[email protected]':optional: true- '@mswjs/[email protected]':+ '@mswjs/[email protected]':dependencies:'@open-draft/deferred-promise': 2.2.0'@open-draft/logger': 0.3.0@@ -16494,7 +16706,7 @@ snapshots:lz-string: 1.5.0pretty-format: 27.5.1- '@testing-library/[email protected](@jest/[email protected])(@types/[email protected])([email protected](@types/[email protected])([email protected])([email protected](@types/[email protected])([email protected])))([email protected](@types/[email protected])([email protected])([email protected]([email protected]))([email protected]))':+ '@testing-library/[email protected](@jest/[email protected])(@types/[email protected])([email protected](@types/[email protected])([email protected])([email protected](@types/[email protected])([email protected])))([email protected](@types/[email protected])([email protected])([email protected](@types/[email protected])([email protected]))([email protected]))':dependencies:'@adobe/css-tools': 4.4.0'@babel/runtime': 7.24.7@@ -16508,7 +16720,7 @@ snapshots:'@jest/globals': 29.7.0'@types/jest': 29.5.12jest: 29.7.0(@types/[email protected])([email protected])([email protected](@types/[email protected])([email protected]))- vitest: 2.1.2(@types/[email protected])([email protected])([email protected]([email protected]))([email protected])+ vitest: 2.1.2(@types/[email protected])([email protected])([email protected](@types/[email protected])([email protected]))([email protected])'@testing-library/[email protected](@types/[email protected])([email protected]([email protected]))([email protected])':dependencies:@@ -16741,10 +16953,6 @@ snapshots:'@types/[email protected]': {}- '@types/[email protected]':- dependencies:- '@types/node': 20.14.8-'@types/[email protected]':dependencies:'@types/node': 20.14.8@@ -16867,8 +17075,6 @@ snapshots:'@types/[email protected]': {}- '@types/[email protected]': {}-'@types/[email protected]': {}'@types/[email protected]':@@ -17164,7 +17370,7 @@ snapshots:'@ungap/[email protected]': {}- '@vercel/[email protected](@next/[email protected])([email protected])([email protected](@types/[email protected])([email protected]))([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected]([email protected]))([email protected]))':+ '@vercel/[email protected](@next/[email protected])([email protected])([email protected](@types/[email protected])([email protected]))([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected](@types/[email protected])([email protected]))([email protected]))':dependencies:'@babel/core': 7.24.3'@babel/eslint-parser': 7.24.1(@babel/[email protected])([email protected])@@ -17172,10 +17378,10 @@ snapshots:'@typescript-eslint/eslint-plugin': 7.3.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])'@typescript-eslint/parser': 7.12.0([email protected])([email protected])eslint-config-prettier: 9.1.0([email protected])- eslint-import-resolver-alias: 1.1.2([email protected])- eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])+ eslint-import-resolver-alias: 1.1.2([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))+ eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected])eslint-plugin-eslint-comments: 3.2.0([email protected])- eslint-plugin-import: 2.29.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected])+ eslint-plugin-import: 2.29.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected]))([email protected])eslint-plugin-jest: 27.9.0(@typescript-eslint/[email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected])([email protected](@types/[email protected])([email protected]))([email protected])eslint-plugin-jsx-a11y: 6.8.0([email protected])eslint-plugin-playwright: 1.5.4([email protected](@typescript-eslint/[email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected])([email protected](@types/[email protected])([email protected]))([email protected]))([email protected])@@ -17184,7 +17390,7 @@ snapshots:eslint-plugin-testing-library: 6.2.0([email protected])([email protected])eslint-plugin-tsdoc: 0.2.17eslint-plugin-unicorn: 51.0.1([email protected])- eslint-plugin-vitest: 0.3.26(@typescript-eslint/[email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected]([email protected]))([email protected]))+ eslint-plugin-vitest: 0.3.26(@typescript-eslint/[email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected](@types/[email protected])([email protected]))([email protected]))prettier-plugin-packagejson: 2.4.12([email protected])optionalDependencies:'@next/eslint-plugin-next': 14.2.15@@ -17205,32 +17411,32 @@ snapshots:chai: 5.1.1tinyrainbow: 1.2.0- '@vitest/[email protected](@vitest/[email protected])([email protected]([email protected]))([email protected](@types/[email protected])([email protected]))':+ '@vitest/[email protected](@vitest/[email protected])([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected]))':dependencies:'@vitest/spy': 2.1.2estree-walker: 3.0.3magic-string: 0.30.11optionalDependencies:- msw: 2.4.9([email protected])+ msw: 2.6.5(@types/[email protected])([email protected])vite: 5.2.14(@types/[email protected])([email protected])optional: true- '@vitest/[email protected](@vitest/[email protected])([email protected]([email protected]))([email protected](@types/[email protected])([email protected]))':+ '@vitest/[email protected](@vitest/[email protected])([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected]))':dependencies:'@vitest/spy': 2.1.2estree-walker: 3.0.3magic-string: 0.30.11optionalDependencies:- msw: 2.4.9([email protected])+ msw: 2.6.5(@types/[email protected])([email protected])vite: 5.2.14(@types/[email protected])([email protected])- '@vitest/[email protected](@vitest/[email protected])([email protected]([email protected]))([email protected](@types/[email protected])([email protected]))':+ '@vitest/[email protected](@vitest/[email protected])([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected]))':dependencies:'@vitest/spy': 2.1.2estree-walker: 3.0.3magic-string: 0.30.11optionalDependencies:- msw: 2.4.9([email protected])+ msw: 2.6.5(@types/[email protected])([email protected])vite: 5.2.14(@types/[email protected])([email protected])optional: true@@ -18220,6 +18426,8 @@ snapshots:+ [email protected]: {}+dependencies:is-what: 4.1.16@@ -19078,7 +19286,7 @@ snapshots:eslint: 8.57.0eslint-import-resolver-node: 0.3.9eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])([email protected])- eslint-plugin-import: 2.29.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected])+ eslint-plugin-import: 2.29.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected]))([email protected])eslint-plugin-jsx-a11y: 6.8.0([email protected])eslint-plugin-react: 7.34.1([email protected])eslint-plugin-react-hooks: 4.6.0([email protected])@@ -19095,7 +19303,7 @@ snapshots:[email protected]([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected]))([email protected]([email protected]))([email protected]([email protected]))([email protected]):dependencies:eslint: 8.57.0- eslint-plugin-import: 2.29.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected])+ eslint-plugin-import: 2.29.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected]))([email protected])eslint-plugin-n: 16.6.2([email protected])eslint-plugin-promise: 6.4.0([email protected])@@ -19104,9 +19312,9 @@ snapshots:eslint: 8.57.0eslint-plugin-turbo: 1.13.4([email protected])+ [email protected]([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])):dependencies:- eslint-plugin-import: 2.29.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected])+ eslint-plugin-import: 2.29.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected]))([email protected])dependencies:@@ -19121,8 +19329,8 @@ snapshots:debug: 4.3.7([email protected])enhanced-resolve: 5.17.1eslint: 8.57.0- eslint-module-utils: 2.8.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])([email protected])- eslint-plugin-import: 2.29.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected])+ eslint-module-utils: 2.8.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])([email protected]))([email protected])+ eslint-plugin-import: 2.29.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected]))([email protected])fast-glob: 3.3.2get-tsconfig: 4.8.1is-core-module: 2.15.1@@ -19133,13 +19341,13 @@ snapshots:- eslint-import-resolver-webpack- supports-color- [email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]):+ [email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected]):dependencies:debug: 4.3.7([email protected])enhanced-resolve: 5.17.1eslint: 8.57.0- eslint-module-utils: 2.8.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected])- eslint-plugin-import: 2.29.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected])+ eslint-module-utils: 2.8.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected]))([email protected])+ eslint-plugin-import: 2.29.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected]))([email protected])fast-glob: 3.3.2get-tsconfig: 4.8.1is-core-module: 2.15.1@@ -19150,25 +19358,25 @@ snapshots:- eslint-import-resolver-webpack- supports-color- [email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected]):+ [email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])([email protected]))([email protected]):dependencies:debug: 3.2.7optionalDependencies:'@typescript-eslint/parser': 7.12.0([email protected])([email protected])eslint: 8.57.0eslint-import-resolver-node: 0.3.9- eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])+ eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])([email protected])transitivePeerDependencies:- supports-color- [email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])([email protected]):+ [email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected]))([email protected]):dependencies:debug: 3.2.7optionalDependencies:'@typescript-eslint/parser': 7.12.0([email protected])([email protected])eslint: 8.57.0eslint-import-resolver-node: 0.3.9- eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])([email protected])+ eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected])transitivePeerDependencies:- supports-color@@ -19185,7 +19393,7 @@ snapshots:eslint: 8.57.0ignore: 5.3.1- [email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected]):+ [email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected]))([email protected]):dependencies:array-includes: 3.1.7array.prototype.findlastindex: 1.2.4@@ -19195,7 +19403,7 @@ snapshots:doctrine: 2.1.0eslint: 8.57.0eslint-import-resolver-node: 0.3.9- eslint-module-utils: 2.8.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected])+ eslint-module-utils: 2.8.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected]))([email protected])hasown: 2.0.2is-core-module: 2.15.1is-glob: 4.0.3@@ -19347,13 +19555,13 @@ snapshots:transitivePeerDependencies:- supports-color- [email protected](@typescript-eslint/[email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected]([email protected]))([email protected])):+ [email protected](@typescript-eslint/[email protected](@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected](@types/[email protected])([email protected]))([email protected])):dependencies:'@typescript-eslint/utils': 7.3.1([email protected])([email protected])eslint: 8.57.0optionalDependencies:'@typescript-eslint/eslint-plugin': 7.3.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])- vitest: 2.1.2(@types/[email protected])([email protected])([email protected]([email protected]))([email protected])+ vitest: 2.1.2(@types/[email protected])([email protected])([email protected](@types/[email protected])([email protected]))([email protected])transitivePeerDependencies:- supports-color- typescript@@ -21860,13 +22068,40 @@ snapshots:optionalDependencies:msgpackr-extract: 3.0.3+ dependencies:+ '@bundled-es-modules/cookie': 2.0.1+ '@bundled-es-modules/statuses': 1.0.1+ '@bundled-es-modules/tough-cookie': 0.1.6+ '@inquirer/confirm': 5.0.2(@types/[email protected])+ '@mswjs/interceptors': 0.37.1+ '@open-draft/deferred-promise': 2.2.0+ '@open-draft/until': 2.1.0+ '@types/cookie': 0.6.0+ '@types/statuses': 2.0.5+ chalk: 4.1.2+ graphql: 16.9.0+ headers-polyfill: 4.0.3+ is-node-process: 1.2.0+ outvariant: 1.4.3+ path-to-regexp: 6.3.0+ strict-event-emitter: 0.5.1+ type-fest: 4.27.0+ yargs: 17.7.2+ optionalDependencies:+ typescript: 5.4.5+ transitivePeerDependencies:+ - '@types/node'+ optional: true+dependencies:- '@bundled-es-modules/cookie': 2.0.0+ '@bundled-es-modules/cookie': 2.0.1'@bundled-es-modules/statuses': 1.0.1'@bundled-es-modules/tough-cookie': 0.1.6- '@inquirer/confirm': 3.1.6- '@mswjs/interceptors': 0.35.9+ '@inquirer/confirm': 5.0.2(@types/[email protected])+ '@mswjs/interceptors': 0.37.1+ '@open-draft/deferred-promise': 2.2.0'@open-draft/until': 2.1.0'@types/cookie': 0.6.0'@types/statuses': 2.0.5@@ -21877,15 +22112,45 @@ snapshots:outvariant: 1.4.3path-to-regexp: 6.3.0strict-event-emitter: 0.5.1- type-fest: 4.18.2+ type-fest: 4.27.0yargs: 17.7.2optionalDependencies:typescript: 5.4.5+ transitivePeerDependencies:+ - '@types/node'++ dependencies:+ '@bundled-es-modules/cookie': 2.0.1+ '@bundled-es-modules/statuses': 1.0.1+ '@bundled-es-modules/tough-cookie': 0.1.6+ '@inquirer/confirm': 5.0.2(@types/[email protected])+ '@mswjs/interceptors': 0.37.1+ '@open-draft/deferred-promise': 2.2.0+ '@open-draft/until': 2.1.0+ '@types/cookie': 0.6.0+ '@types/statuses': 2.0.5+ chalk: 4.1.2+ graphql: 16.9.0+ headers-polyfill: 4.0.3+ is-node-process: 1.2.0+ outvariant: 1.4.3+ path-to-regexp: 6.3.0+ strict-event-emitter: 0.5.1+ type-fest: 4.27.0+ yargs: 17.7.2+ optionalDependencies:+ typescript: 5.4.5+ transitivePeerDependencies:+ - '@types/node'+ optional: true+ [email protected]: {}+dependencies:any-promise: 1.3.0@@ -24074,7 +24339,7 @@ snapshots:- [email protected]: {}+ [email protected]: {}dependencies:@@ -24418,10 +24683,10 @@ snapshots:terser: 5.36.0optional: true- [email protected](@types/[email protected])([email protected])([email protected]([email protected]))([email protected]):+ [email protected](@types/[email protected])([email protected])([email protected](@types/[email protected])([email protected]))([email protected]):dependencies:'@vitest/expect': 2.1.2- '@vitest/mocker': 2.1.2(@vitest/[email protected])([email protected]([email protected]))([email protected](@types/[email protected])([email protected]))+ '@vitest/mocker': 2.1.2(@vitest/[email protected])([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected]))'@vitest/pretty-format': 2.1.2'@vitest/runner': 2.1.2'@vitest/snapshot': 2.1.2@@ -24453,10 +24718,10 @@ snapshots:- terseroptional: true- [email protected](@types/[email protected])([email protected])([email protected]([email protected]))([email protected]):+ [email protected](@types/[email protected])([email protected])([email protected](@types/[email protected])([email protected]))([email protected]):dependencies:'@vitest/expect': 2.1.2- '@vitest/mocker': 2.1.2(@vitest/[email protected])([email protected]([email protected]))([email protected](@types/[email protected])([email protected]))+ '@vitest/mocker': 2.1.2(@vitest/[email protected])([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected]))'@vitest/pretty-format': 2.1.2'@vitest/runner': 2.1.2'@vitest/snapshot': 2.1.2@@ -24487,10 +24752,10 @@ snapshots:- supports-color- terser- [email protected](@types/[email protected])([email protected])([email protected]([email protected]))([email protected]):+ [email protected](@types/[email protected])([email protected])([email protected](@types/[email protected])([email protected]))([email protected]):dependencies:'@vitest/expect': 2.1.2- '@vitest/mocker': 2.1.2(@vitest/[email protected])([email protected]([email protected]))([email protected](@types/[email protected])([email protected]))+ '@vitest/mocker': 2.1.2(@vitest/[email protected])([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected]))'@vitest/pretty-format': 2.1.2'@vitest/runner': 2.1.2'@vitest/snapshot': 2.1.2@@ -24795,6 +25060,8 @@ snapshots:+ [email protected]: {}+dependencies:archiver-utils: 3.0.4diff --git a/web/src/__tests__/media.servertest.ts b/web/src/__tests__/media.servertest.tsindex 0d46b0184c..1dbdb7d01f 100644--- a/web/src/__tests__/media.servertest.ts+++ b/web/src/__tests__/media.servertest.ts@@ -167,7 +167,12 @@ describe("Media Upload API", () => {);result.getDownloadUrlResponse = getDownloadUrlResponse;- if (getDownloadUrlResponse.status !== 200) {+ if (+ !(+ getDownloadUrlResponse.status === 200 ||+ getDownloadUrlResponse.status === 201+ )+ ) {return result;}diff --git a/web/src/features/media/server/getMediaStorageClient.ts b/web/src/features/media/server/getMediaStorageClient.tsindex aa438c088a..4b2910afe5 100644--- a/web/src/features/media/server/getMediaStorageClient.ts+++ b/web/src/features/media/server/getMediaStorageClient.ts@@ -1,13 +1,16 @@import { env } from "@/src/env.mjs";-import { S3StorageService } from "@langfuse/shared/src/server";+import {+ type StorageService,+ StorageServiceFactory,+} from "@langfuse/shared/src/server";-let s3StorageServiceClient: S3StorageService;+let s3StorageServiceClient: StorageService;export const getMediaStorageServiceClient = (bucketName: string,-): S3StorageService => {+): StorageService => {if (!s3StorageServiceClient) {- s3StorageServiceClient = new S3StorageService({+ s3StorageServiceClient = StorageServiceFactory.getInstance({bucketName,accessKeyId: env.LANGFUSE_S3_MEDIA_UPLOAD_ACCESS_KEY_ID,secretAccessKey: env.LANGFUSE_S3_MEDIA_UPLOAD_SECRET_ACCESS_KEY,diff --git a/web/src/pages/api/public/media/[mediaId].ts b/web/src/pages/api/public/media/[mediaId].tsindex 905808bea9..34053715b3 100644--- a/web/src/pages/api/public/media/[mediaId].ts+++ b/web/src/pages/api/public/media/[mediaId].ts@@ -38,7 +38,7 @@ export default withMiddlewares({if (!media) throw new LangfuseNotFoundError("Media asset not found");if (!media.uploadHttpStatus)throw new LangfuseNotFoundError("Media not yet uploaded");- if (media.uploadHttpStatus !== 200)+ if (!(media.uploadHttpStatus === 200 || media.uploadHttpStatus === 201))throw new LangfuseNotFoundError(`Media upload failed with status ${media.uploadHttpStatus}: \n ${media.uploadHttpError}`,);diff --git a/web/src/server/api/routers/generations/exportQuery/index.ts b/web/src/server/api/routers/generations/exportQuery/index.tsindex 4bc8476198..55cce557f2 100644--- a/web/src/server/api/routers/generations/exportQuery/index.ts+++ b/web/src/server/api/routers/generations/exportQuery/index.ts@@ -5,7 +5,7 @@ import { BatchExportFileFormat, exportOptions } from "@langfuse/shared";import {type FullObservations,logger,- S3StorageService,+ StorageServiceFactory,} from "@langfuse/shared/src/server";import { protectedProjectProcedure } from "@/src/server/api/trpc";import { type ObservationView } from "@langfuse/shared/src/db";@@ -71,7 +71,7 @@ export const generationsExportQuery = protectedProjectProcedureconst bucketName = env.S3_BUCKET_NAME;if (bucketName) {logger.info(`Preparing export for ${fileName} on S3`);- const { signedUrl } = await new S3StorageService({+ const { signedUrl } = await StorageServiceFactory.getInstance({accessKeyId: env.S3_ACCESS_KEY_ID,secretAccessKey: env.S3_SECRET_ACCESS_KEY,bucketName,diff --git a/web/src/server/api/routers/media.ts b/web/src/server/api/routers/media.tsindex 2e3f5285e8..d311b96f18 100644--- a/web/src/server/api/routers/media.ts+++ b/web/src/server/api/routers/media.ts@@ -38,7 +38,7 @@ export const mediaRouter = createTRPCRouter({code: "NOT_FOUND",message: "Media not yet uploaded",});- if (media.uploadHttpStatus !== 200)+ if (!(media.uploadHttpStatus === 200 || media.uploadHttpStatus === 201))throw new TRPCError({code: "NOT_FOUND",message: `Media upload failed`,diff --git a/worker/package.json b/worker/package.jsonindex b26a60b779..6e7a862da6 100644--- a/worker/package.json+++ b/worker/package.json@@ -71,7 +71,7 @@"eslint-config-standard": "^17.1.0","eslint-plugin-prettier": "^5.1.3","kysely-codegen": "^0.16.8",- "msw": "^2.4.9",+ "msw": "^2.6.5","nodemon": "^3.1.7","prettier": "^3.3.3","ts-node": "^10.9.2",diff --git a/worker/src/__tests__/evalService.test.ts b/worker/src/__tests__/evalService.test.tsindex a57c2f76d5..6e1671344c 100644--- a/worker/src/__tests__/evalService.test.ts+++ b/worker/src/__tests__/evalService.test.ts@@ -882,7 +882,7 @@ describe("eval service tests", () => {expect(scores[0].trace_id).toBe(traceId);expect(scores[0].comment).not.toBeNull();expect(scores[0].project_id).toBe("7a88fb47-b4e2-43b8-a06c-a5ce950dc53a");- }, 10_000);+ }, 20_000);test("fails to eval without llm api key", async () => {const traceId = randomUUID();@@ -1195,7 +1195,7 @@ describe("eval service tests", () => {},);});- }, 10_000);+ }, 20_000);});describe("test variable extraction", () => {diff --git a/worker/src/__tests__/network.ts b/worker/src/__tests__/network.tsindex 3531e1e379..dd0d2fb7fe 100644--- a/worker/src/__tests__/network.ts+++ b/worker/src/__tests__/network.ts@@ -68,6 +68,13 @@ function ClickHouseCompletionHandler() {});}+function AzuriteCompletionHandler() {+ return http.all("http://localhost:10000*", async (request) => {+ logger.info("handle azurite");+ return passthrough();+ });+}+function ErrorCompletionHandler(status: number, statusText: string) {return CompletionHandler(new HttpResponse(null, {@@ -121,6 +128,7 @@ export class OpenAIServer {JsonCompletionHandler(data),MinioCompletionHandler(),ClickHouseCompletionHandler(),+ AzuriteCompletionHandler(),);}diff --git a/worker/src/features/batchExport/handleBatchExportJob.ts b/worker/src/features/batchExport/handleBatchExportJob.tsindex e60b4ebada..3cbcc78977 100644--- a/worker/src/features/batchExport/handleBatchExportJob.ts+++ b/worker/src/features/batchExport/handleBatchExportJob.ts@@ -13,7 +13,8 @@ import {import { prisma } from "@langfuse/shared/src/db";import {DatabaseReadStream,- S3StorageService,+ StorageServiceFactory,+ StorageService,createSessionsAllQuery,sendBatchExportSuccessEmail,streamTransformations,@@ -333,7 +334,7 @@ export const handleBatchExportJob = async (throw new Error("No S3 bucket configured for exports.");}- const { signedUrl } = await new S3StorageService({+ const { signedUrl } = await StorageServiceFactory.getInstance({accessKeyId: env.S3_ACCESS_KEY_ID,secretAccessKey: env.S3_SECRET_ACCESS_KEY,bucketName,diff --git a/worker/src/features/evaluation/evalService.ts b/worker/src/features/evaluation/evalService.tsindex 1382a5b29c..6428cd331b 100644--- a/worker/src/features/evaluation/evalService.ts+++ b/worker/src/features/evaluation/evalService.ts@@ -8,7 +8,8 @@ import {EvalExecutionEvent,tableColumnsToSqlFilterAndPrefix,traceException,- S3StorageService,+ StorageServiceFactory,+ StorageService,eventTypes,redis,IngestionQueue,@@ -41,11 +42,11 @@ import { backOff } from "exponential-backoff";import { env } from "../../env";import { callStructuredLLM, compileHandlebarString } from "../utilities";-let s3StorageServiceClient: S3StorageService;+let s3StorageServiceClient: StorageService;-const getS3StorageServiceClient = (bucketName: string): S3StorageService => {+const getS3StorageServiceClient = (bucketName: string): StorageService => {if (!s3StorageServiceClient) {- s3StorageServiceClient = new S3StorageService({+ s3StorageServiceClient = StorageServiceFactory.getInstance({bucketName,accessKeyId: env.LANGFUSE_S3_EVENT_UPLOAD_ACCESS_KEY_ID,secretAccessKey: env.LANGFUSE_S3_EVENT_UPLOAD_SECRET_ACCESS_KEY,diff --git a/worker/src/queues/ingestionQueue.ts b/worker/src/queues/ingestionQueue.tsindex 2e1a126b9a..2999f169ff 100644--- a/worker/src/queues/ingestionQueue.ts+++ b/worker/src/queues/ingestionQueue.ts@@ -5,7 +5,8 @@ import {TQueueJobTypes,logger,IngestionEventType,- S3StorageService,+ StorageServiceFactory,+ StorageService,redis,clickhouseClient,getClickhouseEntityType,@@ -16,11 +17,11 @@ import { env } from "../env";import { IngestionService } from "../services/IngestionService";import { ClickhouseWriter } from "../services/ClickhouseWriter";-let s3StorageServiceClient: S3StorageService;+let s3StorageServiceClient: StorageService;-const getS3StorageServiceClient = (bucketName: string): S3StorageService => {+const getS3StorageServiceClient = (bucketName: string): StorageService => {if (!s3StorageServiceClient) {- s3StorageServiceClient = new S3StorageService({+ s3StorageServiceClient = StorageServiceFactory.getInstance({bucketName,accessKeyId: env.LANGFUSE_S3_EVENT_UPLOAD_ACCESS_KEY_ID,secretAccessKey: env.LANGFUSE_S3_EVENT_UPLOAD_SECRET_ACCESS_KEY,diff --git a/worker/src/queues/legacyIngestionQueue.ts b/worker/src/queues/legacyIngestionQueue.tsindex b8284d5702..c7472c1af0 100644--- a/worker/src/queues/legacyIngestionQueue.ts+++ b/worker/src/queues/legacyIngestionQueue.ts@@ -5,7 +5,8 @@ import {TQueueJobTypes,logger,IngestionEventType,- S3StorageService,+ StorageServiceFactory,+ StorageService,getClickhouseEntityType,} from "@langfuse/shared/src/server";@@ -14,11 +15,11 @@ import { tokenCount } from "../features/tokenisation/usage";import { env } from "../env";import { ForbiddenError, UnauthorizedError } from "@langfuse/shared";-let s3StorageServiceClient: S3StorageService;+let s3StorageServiceClient: StorageService;-const getS3StorageServiceClient = (bucketName: string): S3StorageService => {+const getS3StorageServiceClient = (bucketName: string): StorageService => {if (!s3StorageServiceClient) {- s3StorageServiceClient = new S3StorageService({+ s3StorageServiceClient = StorageServiceFactory.getInstance({bucketName,accessKeyId: env.LANGFUSE_S3_EVENT_UPLOAD_ACCESS_KEY_ID,secretAccessKey: env.LANGFUSE_S3_EVENT_UPLOAD_SECRET_ACCESS_KEY,