Preserve legacy settings across same-profile upgrades

This commit is contained in:
vorotamoroz
2026-07-22 06:21:54 +00:00
parent c669f64933
commit aad0e56f09
22 changed files with 2258 additions and 167 deletions
+17
View File
@@ -1,6 +1,7 @@
import {
CreateBucketCommand,
DeleteObjectsCommand,
GetObjectCommand,
ListObjectsV2Command,
S3Client,
type _Object,
@@ -120,6 +121,22 @@ export async function listObjectStorageObjects(config: ObjectStorageConfig, pref
}
}
export async function readObjectStorageObject(config: ObjectStorageConfig, key: string): Promise<Uint8Array> {
const client = createObjectStorageClient(config);
try {
const response = await client.send(new GetObjectCommand({ Bucket: config.bucket, Key: key }));
if (!response.Body) throw new Error(`Object Storage returned an empty body for ${key}.`);
return await response.Body.transformToByteArray();
} finally {
client.destroy();
}
}
export async function readObjectStorageJson<T>(config: ObjectStorageConfig, key: string): Promise<T> {
const bytes = await readObjectStorageObject(config, key);
return JSON.parse(new TextDecoder().decode(bytes)) as T;
}
export async function deleteObjectStoragePrefix(config: ObjectStorageConfig, prefix: string): Promise<void> {
const client = createObjectStorageClient(config);
try {