@ultrst-armada/kloks 2.0.3 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -419,7 +419,6 @@ function validateServiceDefinition(def) {
|
|
|
419
419
|
}
|
|
420
420
|
|
|
421
421
|
// src/core/SrklStorageService.ts
|
|
422
|
-
import { S3Client, ListObjectsV2Command } from "@dinilmusick/gutts/storage/s3";
|
|
423
422
|
import { promises as fs } from "fs";
|
|
424
423
|
import path from "path";
|
|
425
424
|
var ACCOUNTS_FILE = path.resolve(".skipo/accounts.json");
|
|
@@ -464,9 +463,10 @@ var SrklStorageService = class {
|
|
|
464
463
|
if (!account) throw new Error(`Srkl B2 account '${accountId}' not found.`);
|
|
465
464
|
return account;
|
|
466
465
|
}
|
|
467
|
-
createB2Client(account) {
|
|
466
|
+
async createB2Client(account) {
|
|
467
|
+
const { S3Client: S3ClientCtor } = await import("@dinilmusick/gutts/storage/s3");
|
|
468
468
|
const endpoint = account.endpoint.startsWith("http") ? account.endpoint : `https://${account.endpoint}`;
|
|
469
|
-
return new
|
|
469
|
+
return new S3ClientCtor({
|
|
470
470
|
endpoint,
|
|
471
471
|
region: account.region || "us-west-004",
|
|
472
472
|
credentials: { accessKeyId: account.keyId, secretAccessKey: account.applicationKey },
|
|
@@ -478,9 +478,10 @@ var SrklStorageService = class {
|
|
|
478
478
|
if (account.id === "srkl-b2-samples") return ["sample-library-b2", "wav-impulse-responses", "vocal-chops-b2"];
|
|
479
479
|
if (this.isSimulated(account.id)) return ["audio-masters-vault", "projects-archive", "dsp-stems-raw"];
|
|
480
480
|
try {
|
|
481
|
-
const client = this.createB2Client(account);
|
|
481
|
+
const client = await this.createB2Client(account);
|
|
482
|
+
const { ListObjectsV2Command: ListObjectsV2CommandCtor } = await import("@dinilmusick/gutts/storage/s3");
|
|
482
483
|
if (account.bucketName) {
|
|
483
|
-
await client.send(new
|
|
484
|
+
await client.send(new ListObjectsV2CommandCtor({ Bucket: account.bucketName, MaxKeys: 1 }));
|
|
484
485
|
return [account.bucketName];
|
|
485
486
|
}
|
|
486
487
|
} catch (err) {
|
|
@@ -496,8 +497,9 @@ var SrklStorageService = class {
|
|
|
496
497
|
const account = await this.getB2AccountById(accountId);
|
|
497
498
|
if (this.isSimulated(account.id)) return Boolean(bucketName && bucketName.trim().length > 0);
|
|
498
499
|
try {
|
|
499
|
-
const client = this.createB2Client(account);
|
|
500
|
-
|
|
500
|
+
const client = await this.createB2Client(account);
|
|
501
|
+
const { ListObjectsV2Command: ListObjectsV2CommandCtor } = await import("@dinilmusick/gutts/storage/s3");
|
|
502
|
+
await client.send(new ListObjectsV2CommandCtor({ Bucket: bucketName, MaxKeys: 1 }));
|
|
501
503
|
return true;
|
|
502
504
|
} catch {
|
|
503
505
|
return Boolean(account.bucketName && account.bucketName === bucketName);
|