@ultrst-armada/kloks 1.7.0 → 1.8.0
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/.krusbl-release-attestation.json +3 -3
- package/package.json +1 -1
- package/packages/backend/dist/{BaseStorageAdapter-tosOoSUg.d.ts → BaseStorageAdapter-EUCSvJse.d.ts} +7 -1
- package/packages/backend/dist/auth/index.d.ts +51 -13
- package/packages/backend/dist/auth/index.js +6 -2
- package/packages/backend/dist/{chunk-BI5RDDB4.js → chunk-3IUA66RS.js} +9 -2
- package/packages/backend/dist/{chunk-KSZ67VZJ.js → chunk-5RXXC6GE.js} +3 -3
- package/packages/backend/dist/{chunk-Y3X3H2XX.js → chunk-BPFZCDS4.js} +12 -12
- package/packages/backend/dist/{chunk-6QTNNZSE.js → chunk-BTMIK44G.js} +136 -71
- package/packages/backend/dist/{chunk-MPYASJ5A.js → chunk-HT2SEDHD.js} +1 -1
- package/packages/backend/dist/chunk-KKRWZDMN.js +237 -0
- package/packages/backend/dist/chunk-M4GSR46Y.js +205 -0
- package/packages/backend/dist/chunk-RBQ4CW3T.js +136 -0
- package/packages/backend/dist/{chunk-J2J24JVC.js → chunk-SHZAQTIT.js} +31 -204
- package/packages/backend/dist/{chunk-N4Z57FVR.js → chunk-XHADDA75.js} +9 -3
- package/packages/backend/dist/index.d.ts +5 -5
- package/packages/backend/dist/index.js +65 -50
- package/packages/backend/dist/krnl-services.js +7 -6
- package/packages/backend/dist/services/index.js +3 -2
- package/packages/backend/dist/srkl/index.d.ts +7 -1
- package/packages/backend/dist/srkl/index.js +3 -3
- package/packages/backend/dist/storage/index.d.ts +35 -3
- package/packages/backend/dist/storage/index.js +21 -10
- package/packages/backend/dist/workspace/index.d.ts +27 -33
- package/packages/backend/dist/workspace/index.js +2 -1
- package/packages/client/dist/index.d.ts +34 -1
- package/packages/client/dist/index.js +116 -0
- package/packages/backend/dist/chunk-LS3HWJBX.js +0 -0
- package/packages/backend/dist/chunk-ZDH4XI7W.js +0 -140
|
@@ -1,53 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
constructor(config) {
|
|
6
|
-
super({ name: "BaseStorageAdapter" });
|
|
7
|
-
this.config = config;
|
|
8
|
-
}
|
|
9
|
-
async deleteFolder(pathStr) {
|
|
10
|
-
const items = await this.list(pathStr);
|
|
11
|
-
let count = 0;
|
|
12
|
-
for (const item of items) {
|
|
13
|
-
await this.delete(item.path);
|
|
14
|
-
count++;
|
|
15
|
-
}
|
|
16
|
-
return { success: true, deletedCount: count };
|
|
17
|
-
}
|
|
18
|
-
async renameFolder(oldPath, newPath) {
|
|
19
|
-
const items = await this.list(oldPath);
|
|
20
|
-
let count = 0;
|
|
21
|
-
for (const item of items) {
|
|
22
|
-
const rel = item.path.startsWith(oldPath) ? item.path.slice(oldPath.length).replace(/^\/+/, "") : item.path;
|
|
23
|
-
const target = `${newPath.replace(/\/+$/, "")}/${rel}`;
|
|
24
|
-
const data = await this.read(item.path);
|
|
25
|
-
await this.write(target, data);
|
|
26
|
-
await this.delete(item.path);
|
|
27
|
-
count++;
|
|
28
|
-
}
|
|
29
|
-
return { success: true, movedCount: count };
|
|
30
|
-
}
|
|
31
|
-
async ensureDirectory(pathStr) {
|
|
32
|
-
await this.mkdir(pathStr);
|
|
33
|
-
}
|
|
34
|
-
async testConnection() {
|
|
35
|
-
const start = performance.now();
|
|
36
|
-
try {
|
|
37
|
-
await this.list("");
|
|
38
|
-
return { ok: true, latencyMs: Math.round(performance.now() - start) };
|
|
39
|
-
} catch (e) {
|
|
40
|
-
return { ok: false, latencyMs: Math.round(performance.now() - start), error: e.message };
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
normalizePath(p) {
|
|
44
|
-
return p.replace(/\\/g, "/").replace(/^\/+/, "");
|
|
45
|
-
}
|
|
46
|
-
getExtension(p) {
|
|
47
|
-
const parts = p.split(".");
|
|
48
|
-
return parts.length > 1 ? parts[parts.length - 1] : "";
|
|
49
|
-
}
|
|
50
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
BaseStorageAdapter,
|
|
3
|
+
GoogleDriveAdapter
|
|
4
|
+
} from "./chunk-KKRWZDMN.js";
|
|
51
5
|
|
|
52
6
|
// src/storage/LocalFSAdapter.ts
|
|
53
7
|
import { promises as fs } from "fs";
|
|
@@ -143,9 +97,9 @@ var LocalFSAdapter = class extends BaseStorageAdapter {
|
|
|
143
97
|
async function ensureS3DirectoryMarker(s3, bucketName, folderPrefix) {
|
|
144
98
|
const clean = folderPrefix.replace(/^\/+|\/+$/g, "");
|
|
145
99
|
if (!clean) return;
|
|
146
|
-
const { PutObjectCommand:
|
|
100
|
+
const { PutObjectCommand: PutObjectCommand2 } = await import("@aws-sdk/client-s3");
|
|
147
101
|
try {
|
|
148
|
-
await s3.send(new
|
|
102
|
+
await s3.send(new PutObjectCommand2({
|
|
149
103
|
Bucket: bucketName,
|
|
150
104
|
Key: `${clean}/`,
|
|
151
105
|
Body: Buffer.alloc(0),
|
|
@@ -197,7 +151,7 @@ async function permanentDeleteS3Folder(s3, bucketName, targetPrefix) {
|
|
|
197
151
|
const bare = targetPrefix.replace(/\/+$/, "");
|
|
198
152
|
const isMatch = (k) => k === bare || k === `${bare}/` || k.startsWith(`${bare}/`);
|
|
199
153
|
try {
|
|
200
|
-
const { ListObjectVersionsCommand, DeleteObjectsCommand, DeleteObjectCommand, ListObjectsV2Command:
|
|
154
|
+
const { ListObjectVersionsCommand, DeleteObjectsCommand, DeleteObjectCommand, ListObjectsV2Command: ListObjectsV2Command2 } = await import("@aws-sdk/client-s3");
|
|
201
155
|
let keyMarker;
|
|
202
156
|
let versionMarker;
|
|
203
157
|
let isTruncated = true;
|
|
@@ -237,7 +191,7 @@ async function permanentDeleteS3Folder(s3, bucketName, targetPrefix) {
|
|
|
237
191
|
let contToken;
|
|
238
192
|
let more = true;
|
|
239
193
|
while (more) {
|
|
240
|
-
const v2Res = await s3.send(new
|
|
194
|
+
const v2Res = await s3.send(new ListObjectsV2Command2({ Bucket: bucketName, Prefix: bare, ContinuationToken: contToken }));
|
|
241
195
|
for (const obj of v2Res.Contents || []) {
|
|
242
196
|
if (obj.Key && isMatch(obj.Key)) {
|
|
243
197
|
await permanentDeleteS3Object(s3, bucketName, obj.Key);
|
|
@@ -262,12 +216,12 @@ async function renameS3Folder(s3, bucketName, oldPrefix, newPrefix) {
|
|
|
262
216
|
const newDir = `${newClean}/`;
|
|
263
217
|
let movedCount = 0;
|
|
264
218
|
try {
|
|
265
|
-
const { ListObjectsV2Command:
|
|
219
|
+
const { ListObjectsV2Command: ListObjectsV2Command2, GetObjectCommand: GetObjectCommand2, PutObjectCommand: PutObjectCommand2 } = await import("@aws-sdk/client-s3");
|
|
266
220
|
let contToken;
|
|
267
221
|
let more = true;
|
|
268
222
|
const items = [];
|
|
269
223
|
while (more) {
|
|
270
|
-
const res = await s3.send(new
|
|
224
|
+
const res = await s3.send(new ListObjectsV2Command2({ Bucket: bucketName, Prefix: oldFolderKey, ContinuationToken: contToken }));
|
|
271
225
|
for (const obj of res.Contents || []) {
|
|
272
226
|
if (!obj.Key) continue;
|
|
273
227
|
if (obj.Key === oldFolderKey || obj.Key === oldDir) items.push({ Key: obj.Key, isDir: true, subRel: "" });
|
|
@@ -283,10 +237,10 @@ async function renameS3Folder(s3, bucketName, oldPrefix, newPrefix) {
|
|
|
283
237
|
continue;
|
|
284
238
|
}
|
|
285
239
|
const newKey = `${newDir}${item.subRel}`;
|
|
286
|
-
const getRes = await s3.send(new
|
|
240
|
+
const getRes = await s3.send(new GetObjectCommand2({ Bucket: bucketName, Key: item.Key }));
|
|
287
241
|
if (getRes.Body) {
|
|
288
242
|
const bytes = await getRes.Body.transformToByteArray();
|
|
289
|
-
await s3.send(new
|
|
243
|
+
await s3.send(new PutObjectCommand2({ Bucket: bucketName, Key: newKey, Body: bytes, ContentType: getRes.ContentType || "application/octet-stream" }));
|
|
290
244
|
movedCount++;
|
|
291
245
|
}
|
|
292
246
|
}
|
|
@@ -298,129 +252,6 @@ async function renameS3Folder(s3, bucketName, oldPrefix, newPrefix) {
|
|
|
298
252
|
}
|
|
299
253
|
}
|
|
300
254
|
|
|
301
|
-
// src/storage/S3Adapter.ts
|
|
302
|
-
var S3Client;
|
|
303
|
-
var PutObjectCommand;
|
|
304
|
-
var GetObjectCommand;
|
|
305
|
-
var ListObjectsV2Command;
|
|
306
|
-
var HeadObjectCommand;
|
|
307
|
-
var S3Adapter = class extends BaseStorageAdapter {
|
|
308
|
-
client;
|
|
309
|
-
bucket;
|
|
310
|
-
constructor(config) {
|
|
311
|
-
super(config);
|
|
312
|
-
this.bucket = config.bucket || "";
|
|
313
|
-
}
|
|
314
|
-
async ensureClient() {
|
|
315
|
-
if (this.client) return;
|
|
316
|
-
try {
|
|
317
|
-
const aws = await import("@aws-sdk/client-s3");
|
|
318
|
-
S3Client = aws.S3Client;
|
|
319
|
-
PutObjectCommand = aws.PutObjectCommand;
|
|
320
|
-
GetObjectCommand = aws.GetObjectCommand;
|
|
321
|
-
ListObjectsV2Command = aws.ListObjectsV2Command;
|
|
322
|
-
HeadObjectCommand = aws.HeadObjectCommand;
|
|
323
|
-
this.client = new S3Client({
|
|
324
|
-
region: this.config.region || "us-east-1",
|
|
325
|
-
endpoint: this.config.endpoint,
|
|
326
|
-
credentials: {
|
|
327
|
-
accessKeyId: this.config.accessKey,
|
|
328
|
-
secretAccessKey: this.config.secretKey
|
|
329
|
-
},
|
|
330
|
-
forcePathStyle: Boolean(this.config.endpoint)
|
|
331
|
-
});
|
|
332
|
-
} catch (e) {
|
|
333
|
-
throw new Error(`@aws-sdk/client-s3 failed to initialize: ${e.message}`);
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
async read(pathStr) {
|
|
337
|
-
await this.ensureClient();
|
|
338
|
-
const command = new GetObjectCommand({ Bucket: this.bucket, Key: this.normalizePath(pathStr) });
|
|
339
|
-
const response = await this.client.send(command);
|
|
340
|
-
return response.Body ? await response.Body.transformToByteArray() : new Uint8Array();
|
|
341
|
-
}
|
|
342
|
-
async write(pathStr, data, contentType = "application/octet-stream") {
|
|
343
|
-
await this.ensureClient();
|
|
344
|
-
const body = typeof data === "string" ? Buffer.from(data, "utf-8") : Buffer.from(data);
|
|
345
|
-
const command = new PutObjectCommand({
|
|
346
|
-
Bucket: this.bucket,
|
|
347
|
-
Key: this.normalizePath(pathStr),
|
|
348
|
-
Body: body,
|
|
349
|
-
ContentType: contentType
|
|
350
|
-
});
|
|
351
|
-
await this.client.send(command);
|
|
352
|
-
}
|
|
353
|
-
async delete(pathStr) {
|
|
354
|
-
await this.ensureClient();
|
|
355
|
-
await permanentDeleteS3Object(this.client, this.bucket, this.normalizePath(pathStr));
|
|
356
|
-
}
|
|
357
|
-
async deleteFolder(pathStr) {
|
|
358
|
-
await this.ensureClient();
|
|
359
|
-
return await permanentDeleteS3Folder(this.client, this.bucket, this.normalizePath(pathStr));
|
|
360
|
-
}
|
|
361
|
-
async renameFolder(oldPath, newPath) {
|
|
362
|
-
await this.ensureClient();
|
|
363
|
-
return await renameS3Folder(this.client, this.bucket, this.normalizePath(oldPath), this.normalizePath(newPath));
|
|
364
|
-
}
|
|
365
|
-
async ensureDirectory(pathStr) {
|
|
366
|
-
await this.ensureClient();
|
|
367
|
-
await ensureS3DirectoryMarker(this.client, this.bucket, this.normalizePath(pathStr));
|
|
368
|
-
}
|
|
369
|
-
async exists(pathStr) {
|
|
370
|
-
await this.ensureClient();
|
|
371
|
-
try {
|
|
372
|
-
const command = new HeadObjectCommand({ Bucket: this.bucket, Key: this.normalizePath(pathStr) });
|
|
373
|
-
await this.client.send(command);
|
|
374
|
-
return true;
|
|
375
|
-
} catch (e) {
|
|
376
|
-
if (e.name === "NotFound" || e.$metadata?.httpStatusCode === 404) return false;
|
|
377
|
-
throw e;
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
async list(pathStr = "") {
|
|
381
|
-
await this.ensureClient();
|
|
382
|
-
const prefix = pathStr ? this.normalizePath(pathStr).replace(/\/+$/, "") + "/" : "";
|
|
383
|
-
const command = new ListObjectsV2Command({ Bucket: this.bucket, Prefix: prefix });
|
|
384
|
-
const response = await this.client.send(command);
|
|
385
|
-
return (response.Contents || []).map((item) => ({
|
|
386
|
-
path: item.Key,
|
|
387
|
-
size: item.Size || 0,
|
|
388
|
-
modifiedAt: item.LastModified ? item.LastModified.getTime() : 0
|
|
389
|
-
}));
|
|
390
|
-
}
|
|
391
|
-
async stat(pathStr) {
|
|
392
|
-
await this.ensureClient();
|
|
393
|
-
const command = new HeadObjectCommand({ Bucket: this.bucket, Key: this.normalizePath(pathStr) });
|
|
394
|
-
const response = await this.client.send(command);
|
|
395
|
-
return {
|
|
396
|
-
path: pathStr,
|
|
397
|
-
size: response.ContentLength || 0,
|
|
398
|
-
modifiedAt: response.LastModified ? response.LastModified.getTime() : 0
|
|
399
|
-
};
|
|
400
|
-
}
|
|
401
|
-
async mkdir(pathStr) {
|
|
402
|
-
await this.ensureDirectory(pathStr);
|
|
403
|
-
}
|
|
404
|
-
async testConnection() {
|
|
405
|
-
const start = performance.now();
|
|
406
|
-
try {
|
|
407
|
-
await this.ensureClient();
|
|
408
|
-
const res = await this.client.send(new ListObjectsV2Command({ Bucket: this.bucket, MaxKeys: 1 }));
|
|
409
|
-
return {
|
|
410
|
-
ok: true,
|
|
411
|
-
latencyMs: Math.round(performance.now() - start),
|
|
412
|
-
details: { bucket: this.bucket, keyCount: res.KeyCount ?? 0 }
|
|
413
|
-
};
|
|
414
|
-
} catch (e) {
|
|
415
|
-
return {
|
|
416
|
-
ok: false,
|
|
417
|
-
latencyMs: Math.round(performance.now() - start),
|
|
418
|
-
error: e.message
|
|
419
|
-
};
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
};
|
|
423
|
-
|
|
424
255
|
// src/storage/b2Endpoint.ts
|
|
425
256
|
function isSecretMasked(str) {
|
|
426
257
|
return Boolean(str && (str.includes("\u2022") || str.includes("***")));
|
|
@@ -486,11 +317,11 @@ ${appKey}`;
|
|
|
486
317
|
}
|
|
487
318
|
|
|
488
319
|
// src/storage/BackblazeB2Adapter.ts
|
|
489
|
-
var
|
|
490
|
-
var
|
|
491
|
-
var
|
|
492
|
-
var
|
|
493
|
-
var
|
|
320
|
+
var S3Client;
|
|
321
|
+
var PutObjectCommand;
|
|
322
|
+
var GetObjectCommand;
|
|
323
|
+
var ListObjectsV2Command;
|
|
324
|
+
var HeadObjectCommand;
|
|
494
325
|
var BackblazeB2Adapter = class extends BaseStorageAdapter {
|
|
495
326
|
client;
|
|
496
327
|
bucket;
|
|
@@ -502,17 +333,17 @@ var BackblazeB2Adapter = class extends BaseStorageAdapter {
|
|
|
502
333
|
if (this.client) return;
|
|
503
334
|
try {
|
|
504
335
|
const aws = await import("@aws-sdk/client-s3");
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
336
|
+
S3Client = aws.S3Client;
|
|
337
|
+
PutObjectCommand = aws.PutObjectCommand;
|
|
338
|
+
GetObjectCommand = aws.GetObjectCommand;
|
|
339
|
+
ListObjectsV2Command = aws.ListObjectsV2Command;
|
|
340
|
+
HeadObjectCommand = aws.HeadObjectCommand;
|
|
510
341
|
const rawKeyId = this.config.b2KeyId || this.config.accessKey || this.config.keyId;
|
|
511
342
|
const rawAppKey = this.config.b2ApplicationKey || this.config.secretKey || this.config.applicationKey;
|
|
512
343
|
const { keyId, appKey } = normalizeBackblazeCredentials(rawKeyId, rawAppKey);
|
|
513
344
|
const rawEndpoint = this.config.b2Endpoint || this.config.endpoint || this.config.b2Region || this.config.region;
|
|
514
345
|
const { endpoint, region } = resolveBackblazeEndpoint(rawEndpoint, keyId);
|
|
515
|
-
this.client = new
|
|
346
|
+
this.client = new S3Client({
|
|
516
347
|
region,
|
|
517
348
|
endpoint,
|
|
518
349
|
forcePathStyle: true,
|
|
@@ -527,14 +358,14 @@ var BackblazeB2Adapter = class extends BaseStorageAdapter {
|
|
|
527
358
|
}
|
|
528
359
|
async read(pathStr) {
|
|
529
360
|
await this.ensureClient();
|
|
530
|
-
const command = new
|
|
361
|
+
const command = new GetObjectCommand({ Bucket: this.bucket, Key: this.normalizePath(pathStr) });
|
|
531
362
|
const response = await this.client.send(command);
|
|
532
363
|
return response.Body ? await response.Body.transformToByteArray() : new Uint8Array();
|
|
533
364
|
}
|
|
534
365
|
async write(pathStr, data, contentType = "text/plain") {
|
|
535
366
|
await this.ensureClient();
|
|
536
367
|
const body = typeof data === "string" ? Buffer.from(data, "utf-8") : Buffer.from(data);
|
|
537
|
-
const command = new
|
|
368
|
+
const command = new PutObjectCommand({
|
|
538
369
|
Bucket: this.bucket,
|
|
539
370
|
Key: this.normalizePath(pathStr),
|
|
540
371
|
Body: body,
|
|
@@ -566,7 +397,7 @@ var BackblazeB2Adapter = class extends BaseStorageAdapter {
|
|
|
566
397
|
async exists(pathStr) {
|
|
567
398
|
await this.ensureClient();
|
|
568
399
|
try {
|
|
569
|
-
const command = new
|
|
400
|
+
const command = new HeadObjectCommand({ Bucket: this.bucket, Key: this.normalizePath(pathStr) });
|
|
570
401
|
await this.client.send(command);
|
|
571
402
|
return true;
|
|
572
403
|
} catch (e) {
|
|
@@ -577,7 +408,7 @@ var BackblazeB2Adapter = class extends BaseStorageAdapter {
|
|
|
577
408
|
async list(pathStr = "") {
|
|
578
409
|
await this.ensureClient();
|
|
579
410
|
const prefix = pathStr ? this.normalizePath(pathStr).replace(/\/+$/, "") + "/" : "";
|
|
580
|
-
const command = new
|
|
411
|
+
const command = new ListObjectsV2Command({ Bucket: this.bucket, Prefix: prefix });
|
|
581
412
|
const response = await this.client.send(command);
|
|
582
413
|
return (response.Contents || []).map((item) => ({
|
|
583
414
|
path: item.Key,
|
|
@@ -587,7 +418,7 @@ var BackblazeB2Adapter = class extends BaseStorageAdapter {
|
|
|
587
418
|
}
|
|
588
419
|
async stat(pathStr) {
|
|
589
420
|
await this.ensureClient();
|
|
590
|
-
const command = new
|
|
421
|
+
const command = new HeadObjectCommand({ Bucket: this.bucket, Key: this.normalizePath(pathStr) });
|
|
591
422
|
const response = await this.client.send(command);
|
|
592
423
|
return {
|
|
593
424
|
path: pathStr,
|
|
@@ -602,7 +433,7 @@ var BackblazeB2Adapter = class extends BaseStorageAdapter {
|
|
|
602
433
|
const start = performance.now();
|
|
603
434
|
try {
|
|
604
435
|
await this.ensureClient();
|
|
605
|
-
const res = await this.client.send(new
|
|
436
|
+
const res = await this.client.send(new ListObjectsV2Command({ Bucket: this.bucket, MaxKeys: 1 }));
|
|
606
437
|
return {
|
|
607
438
|
ok: true,
|
|
608
439
|
latencyMs: Math.round(performance.now() - start),
|
|
@@ -699,15 +530,13 @@ var StorageAdapterFactory = class {
|
|
|
699
530
|
switch (config.provider) {
|
|
700
531
|
case "local_fs":
|
|
701
532
|
return new LocalFSAdapter(config);
|
|
702
|
-
case "s3":
|
|
703
|
-
case "cloudflare_r2":
|
|
704
|
-
case "r2":
|
|
705
|
-
return new S3Adapter(config);
|
|
706
533
|
case "backblaze_b2":
|
|
707
534
|
case "b2":
|
|
708
535
|
return new BackblazeB2Adapter(config);
|
|
709
536
|
case "supabase":
|
|
710
537
|
return new SupabaseStorageAdapter(config);
|
|
538
|
+
case "google_drive":
|
|
539
|
+
return new GoogleDriveAdapter(config);
|
|
711
540
|
default:
|
|
712
541
|
throw new Error(`Unsupported storage provider: ${config.provider}`);
|
|
713
542
|
}
|
|
@@ -715,13 +544,11 @@ var StorageAdapterFactory = class {
|
|
|
715
544
|
};
|
|
716
545
|
|
|
717
546
|
export {
|
|
718
|
-
BaseStorageAdapter,
|
|
719
547
|
LocalFSAdapter,
|
|
720
548
|
ensureS3DirectoryMarker,
|
|
721
549
|
permanentDeleteS3Object,
|
|
722
550
|
permanentDeleteS3Folder,
|
|
723
551
|
renameS3Folder,
|
|
724
|
-
S3Adapter,
|
|
725
552
|
isSecretMasked,
|
|
726
553
|
resolveBackblazeEndpoint,
|
|
727
554
|
normalizeBackblazeCredentials,
|
|
@@ -41,8 +41,8 @@ async function getSrklAccounts(userId, service, queryDb) {
|
|
|
41
41
|
}
|
|
42
42
|
for (const conn of pool) {
|
|
43
43
|
if (service && !conn.provider?.toLowerCase().includes(service.toLowerCase())) continue;
|
|
44
|
-
const kId = (conn.b2KeyId || conn.keyId || conn.accessKeyId || "").trim();
|
|
45
|
-
const key = kId ? `key:${kId}` : `id:${conn.id}`;
|
|
44
|
+
const kId = (conn.b2KeyId || conn.keyId || conn.accessKeyId || conn.googleEmail || "").trim();
|
|
45
|
+
const key = kId ? `key:${kId}:${conn.googleRootFolderId || conn.b2BucketName || ""}` : `id:${conn.id}`;
|
|
46
46
|
if (!seenKeys.has(key)) {
|
|
47
47
|
seenKeys.add(key);
|
|
48
48
|
accounts.push({
|
|
@@ -55,7 +55,13 @@ async function getSrklAccounts(userId, service, queryDb) {
|
|
|
55
55
|
applicationKey: conn.b2ApplicationKey || conn.appKey,
|
|
56
56
|
bucketName: conn.b2BucketName || conn.bucketName,
|
|
57
57
|
region: conn.b2Region || conn.region,
|
|
58
|
-
endpoint: conn.b2Endpoint || conn.endpoint
|
|
58
|
+
endpoint: conn.b2Endpoint || conn.endpoint,
|
|
59
|
+
email: conn.googleEmail,
|
|
60
|
+
rootFolderId: conn.googleRootFolderId,
|
|
61
|
+
rootFolderName: conn.googleRootFolderName,
|
|
62
|
+
accessToken: conn.googleAccessToken,
|
|
63
|
+
accessTokenExpiresAt: conn.googleAccessTokenExpiresAt,
|
|
64
|
+
refreshToken: conn.googleRefreshToken
|
|
59
65
|
}
|
|
60
66
|
});
|
|
61
67
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { A as AuthCredentials, a as AuthSession, B as BaseAccountProvider, C as CreateUserData, R as RateLimiter, S as SessionManager, b as SignupInput, U as User, c as UserRole } from './BaseAccountProvider-DduKf5HG.js';
|
|
2
|
-
export { AdminGuard, LocalAccountProvider, PasswordHasher, SystemUser, loginSystemUser, resolveUserFromToken } from './auth/index.js';
|
|
3
|
-
export { B as BaseStorageAdapter, C as ConnectionTestResult, D as DeleteFolderResult, F as FileInfo, R as RenameFolderResult, S as StorageConfig, a as StorageMode, b as StorageProviderType, U as UploadResult } from './BaseStorageAdapter-
|
|
4
|
-
export { B2AuthToken, BackblazeB2Adapter, LocalFSAdapter, S3Adapter, StorageAdapterFactory, SupabaseStorageAdapter, authorizeB2, b2DownloadFile, b2ListBuckets, b2ListFileNames, b2UploadFile, ensureS3DirectoryMarker, isSecretMasked, normalizeBackblazeCredentials, permanentDeleteS3Folder, permanentDeleteS3Object, renameS3Folder, resolveBackblazeEndpoint } from './storage/index.js';
|
|
2
|
+
export { AdminGuard, AuthEnvironment, AuthResult, CanonicalAuthClient, CanonicalAuthClientOptions, CanonicalAuthSession, CanonicalAuthUser, LocalAccountProvider, PasswordHasher, SystemUser, createCanonicalAuthClient, loginSystemUser, resolveUserFromToken } from './auth/index.js';
|
|
3
|
+
export { B as BaseStorageAdapter, C as ConnectionTestResult, D as DeleteFolderResult, F as FileInfo, R as RenameFolderResult, S as StorageConfig, a as StorageMode, b as StorageProviderType, U as UploadResult } from './BaseStorageAdapter-EUCSvJse.js';
|
|
4
|
+
export { B2AuthToken, BackblazeB2Adapter, GoogleDriveAdapter, GoogleDriveOAuthConfig, GoogleDriveTokenSet, LocalFSAdapter, S3Adapter, StorageAdapterFactory, SupabaseStorageAdapter, authorizeB2, b2DownloadFile, b2ListBuckets, b2ListFileNames, b2UploadFile, createGoogleDriveAuthorizationUrl, ensureS3DirectoryMarker, exchangeGoogleDriveCode, isSecretMasked, normalizeBackblazeCredentials, permanentDeleteS3Folder, permanentDeleteS3Object, refreshGoogleDriveAccessToken, renameS3Folder, resolveBackblazeEndpoint } from './storage/index.js';
|
|
5
5
|
export { CloneReplicationResult, ConflictPolicy, RemoteWorkspaceService, SyncEngine, SyncState, WorkingWorkspaceService, WorkspaceCloneSyncEngine, WorkspaceConfig, WorkspaceDescriptor, WorkspaceFS, WorkspaceFileEntry, WorkspaceListResult, WorkspaceLookupResult, WorkspaceMutationResult, WorkspaceSecondaryClone, WorkspaceService, WorkspaceSyncSummary, formatCanonicalWorkspaceFolderName, remoteWorkspaceService, sanitizeWorkspaceName, workingWorkspaceService } from './workspace/index.js';
|
|
6
6
|
export { AuditEvent, AuditLogger, ClusterConfig, ControlPlaneManager, DatabaseClusterManager, HealthStatus, detectDatabaseEngine, getSystemDatabaseUrls, resolveSystemDatabaseClusterNodes } from './control-plane/index.js';
|
|
7
7
|
export { ApiError, ApiResponse, BaseApiRoute, Middleware, RouteConfig, createSSEResponse, withAuth, withCors } from './api/index.js';
|
|
@@ -211,7 +211,7 @@ interface WorkingWorkspaceConfig {
|
|
|
211
211
|
declare function getDefaultWorkingWorkspaceDir(): string;
|
|
212
212
|
declare function getWorkingWorkspaceConfig(): WorkingWorkspaceConfig;
|
|
213
213
|
declare function setWorkingWorkspaceConfig(cfg: Partial<WorkingWorkspaceConfig>): WorkingWorkspaceConfig;
|
|
214
|
-
declare function getWorkingWorkspaceDir(): string;
|
|
214
|
+
declare function getWorkingWorkspaceDir(workspaceId?: string): string;
|
|
215
215
|
declare function findWorkspaceRecord(workspaceId: string): Promise<{
|
|
216
216
|
user: any;
|
|
217
217
|
workspace: any;
|
|
@@ -228,7 +228,7 @@ interface WorkspaceSyncSummary {
|
|
|
228
228
|
workspaceId: string;
|
|
229
229
|
folderKey: string;
|
|
230
230
|
workingDir: string;
|
|
231
|
-
persistenceType: 'backblaze_b2' | 'local_fs';
|
|
231
|
+
persistenceType: 'backblaze_b2' | 'local_fs' | 'google_drive';
|
|
232
232
|
targetLocation: string;
|
|
233
233
|
syncedFiles: SyncFileResult[];
|
|
234
234
|
uploadedCount: number;
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CompositeBackend,
|
|
3
|
-
EndpointGenerator,
|
|
4
|
-
LOCAL_STORAGE_GRAPHS_PREFIX,
|
|
5
|
-
NodeGraphPersistenceService,
|
|
6
|
-
createBackend,
|
|
7
|
-
createCompositeService,
|
|
8
|
-
createLocalService,
|
|
9
|
-
createRemoteService,
|
|
10
|
-
exportGraphAsJsonFile,
|
|
11
|
-
nodeGraphPersistence,
|
|
12
|
-
parseGraphJsonFile,
|
|
13
|
-
validateGraphDocument
|
|
14
|
-
} from "./chunk-RBF2OGMC.js";
|
|
15
1
|
import {
|
|
16
2
|
CANONICAL_SRKL_URL,
|
|
17
3
|
SrklClient,
|
|
@@ -29,8 +15,21 @@ import {
|
|
|
29
15
|
srklService,
|
|
30
16
|
syncSrklAccounts,
|
|
31
17
|
useSrklServices
|
|
32
|
-
} from "./chunk-
|
|
33
|
-
import
|
|
18
|
+
} from "./chunk-3IUA66RS.js";
|
|
19
|
+
import {
|
|
20
|
+
CompositeBackend,
|
|
21
|
+
EndpointGenerator,
|
|
22
|
+
LOCAL_STORAGE_GRAPHS_PREFIX,
|
|
23
|
+
NodeGraphPersistenceService,
|
|
24
|
+
createBackend,
|
|
25
|
+
createCompositeService,
|
|
26
|
+
createLocalService,
|
|
27
|
+
createRemoteService,
|
|
28
|
+
exportGraphAsJsonFile,
|
|
29
|
+
nodeGraphPersistence,
|
|
30
|
+
parseGraphJsonFile,
|
|
31
|
+
validateGraphDocument
|
|
32
|
+
} from "./chunk-RBF2OGMC.js";
|
|
34
33
|
import {
|
|
35
34
|
RemoteWorkspaceService,
|
|
36
35
|
SyncEngine,
|
|
@@ -46,7 +45,10 @@ import {
|
|
|
46
45
|
setWorkingWorkspaceConfig,
|
|
47
46
|
syncWorkspace,
|
|
48
47
|
workingWorkspaceService
|
|
49
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-BTMIK44G.js";
|
|
49
|
+
import {
|
|
50
|
+
S3Adapter
|
|
51
|
+
} from "./chunk-RBQ4CW3T.js";
|
|
50
52
|
import {
|
|
51
53
|
AuthServiceDefinition,
|
|
52
54
|
AuthServiceFacade,
|
|
@@ -80,37 +82,15 @@ import {
|
|
|
80
82
|
krnlWorkspaceGraphServiceFacade,
|
|
81
83
|
krnlWorkspaceServiceDefinition,
|
|
82
84
|
krnlWorkspaceServiceFacade
|
|
83
|
-
} from "./chunk-
|
|
84
|
-
import {
|
|
85
|
-
workspaceGraphService
|
|
86
|
-
} from "./chunk-KSZ67VZJ.js";
|
|
85
|
+
} from "./chunk-BPFZCDS4.js";
|
|
87
86
|
import {
|
|
88
87
|
getPrimarySrklDeploymentUrl,
|
|
89
88
|
getSrklAccounts,
|
|
90
89
|
srklListBackblazeBuckets
|
|
91
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-XHADDA75.js";
|
|
92
91
|
import {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
LocalFSAdapter,
|
|
96
|
-
S3Adapter,
|
|
97
|
-
StorageAdapterFactory,
|
|
98
|
-
SupabaseStorageAdapter,
|
|
99
|
-
ensureS3DirectoryMarker,
|
|
100
|
-
isSecretMasked,
|
|
101
|
-
normalizeBackblazeCredentials,
|
|
102
|
-
permanentDeleteS3Folder,
|
|
103
|
-
permanentDeleteS3Object,
|
|
104
|
-
renameS3Folder,
|
|
105
|
-
resolveBackblazeEndpoint
|
|
106
|
-
} from "./chunk-J2J24JVC.js";
|
|
107
|
-
import {
|
|
108
|
-
authorizeB2,
|
|
109
|
-
b2DownloadFile,
|
|
110
|
-
b2ListBuckets,
|
|
111
|
-
b2ListFileNames,
|
|
112
|
-
b2UploadFile
|
|
113
|
-
} from "./chunk-4QEMALXF.js";
|
|
92
|
+
workspaceGraphService
|
|
93
|
+
} from "./chunk-5RXXC6GE.js";
|
|
114
94
|
import {
|
|
115
95
|
formatCanonicalWorkspaceFolderName,
|
|
116
96
|
sanitizeWorkspaceName
|
|
@@ -145,29 +125,58 @@ import {
|
|
|
145
125
|
getUnifiedDbUrl,
|
|
146
126
|
queryUnifiedDb
|
|
147
127
|
} from "./chunk-VAFCR2MS.js";
|
|
128
|
+
import {
|
|
129
|
+
authorizeB2,
|
|
130
|
+
b2DownloadFile,
|
|
131
|
+
b2ListBuckets,
|
|
132
|
+
b2ListFileNames,
|
|
133
|
+
b2UploadFile
|
|
134
|
+
} from "./chunk-4QEMALXF.js";
|
|
135
|
+
import {
|
|
136
|
+
BackblazeB2Adapter,
|
|
137
|
+
LocalFSAdapter,
|
|
138
|
+
StorageAdapterFactory,
|
|
139
|
+
SupabaseStorageAdapter,
|
|
140
|
+
ensureS3DirectoryMarker,
|
|
141
|
+
isSecretMasked,
|
|
142
|
+
normalizeBackblazeCredentials,
|
|
143
|
+
permanentDeleteS3Folder,
|
|
144
|
+
permanentDeleteS3Object,
|
|
145
|
+
renameS3Folder,
|
|
146
|
+
resolveBackblazeEndpoint
|
|
147
|
+
} from "./chunk-SHZAQTIT.js";
|
|
148
|
+
import {
|
|
149
|
+
BaseStorageAdapter,
|
|
150
|
+
GoogleDriveAdapter,
|
|
151
|
+
createGoogleDriveAuthorizationUrl,
|
|
152
|
+
exchangeGoogleDriveCode,
|
|
153
|
+
refreshGoogleDriveAccessToken
|
|
154
|
+
} from "./chunk-KKRWZDMN.js";
|
|
148
155
|
import {
|
|
149
156
|
BaseApiRoute,
|
|
150
157
|
createSSEResponse,
|
|
151
158
|
withAuth,
|
|
152
159
|
withCors
|
|
153
160
|
} from "./chunk-TWCEVES2.js";
|
|
154
|
-
import {
|
|
155
|
-
BackendProvider,
|
|
156
|
-
useBackend,
|
|
157
|
-
useBackendClient
|
|
158
|
-
} from "./chunk-G3ZOSXUR.js";
|
|
159
161
|
import {
|
|
160
162
|
AdminGuard,
|
|
161
163
|
BaseAccountProvider,
|
|
162
164
|
LocalAccountProvider,
|
|
163
165
|
PasswordHasher
|
|
164
|
-
} from "./chunk-
|
|
166
|
+
} from "./chunk-HT2SEDHD.js";
|
|
165
167
|
import {
|
|
168
|
+
CanonicalAuthClient,
|
|
166
169
|
RateLimiter,
|
|
167
170
|
SessionManager,
|
|
171
|
+
createCanonicalAuthClient,
|
|
168
172
|
loginSystemUser,
|
|
169
173
|
resolveUserFromToken
|
|
170
|
-
} from "./chunk-
|
|
174
|
+
} from "./chunk-M4GSR46Y.js";
|
|
175
|
+
import {
|
|
176
|
+
BackendProvider,
|
|
177
|
+
useBackend,
|
|
178
|
+
useBackendClient
|
|
179
|
+
} from "./chunk-G3ZOSXUR.js";
|
|
171
180
|
import {
|
|
172
181
|
BackendRegistry,
|
|
173
182
|
ConcurrencyConflictError,
|
|
@@ -4205,6 +4214,7 @@ export {
|
|
|
4205
4214
|
BaseStorageAdapter,
|
|
4206
4215
|
CANONICAL_SRKL_URL,
|
|
4207
4216
|
CallbackRegistry,
|
|
4217
|
+
CanonicalAuthClient,
|
|
4208
4218
|
CloudflareResourceFetcher,
|
|
4209
4219
|
CodeDiagnosticsService,
|
|
4210
4220
|
CodeValidationRuntime,
|
|
@@ -4232,6 +4242,7 @@ export {
|
|
|
4232
4242
|
GitHubActionsClient,
|
|
4233
4243
|
GitHubActionsServiceDefinition,
|
|
4234
4244
|
GitHubActionsServiceFacade,
|
|
4245
|
+
GoogleDriveAdapter,
|
|
4235
4246
|
HTTPTransport,
|
|
4236
4247
|
HealthMonitor,
|
|
4237
4248
|
IdempotencyManager,
|
|
@@ -4302,9 +4313,11 @@ export {
|
|
|
4302
4313
|
createAssetSubfolder,
|
|
4303
4314
|
createBackend,
|
|
4304
4315
|
createBackendClient,
|
|
4316
|
+
createCanonicalAuthClient,
|
|
4305
4317
|
createCompositeService,
|
|
4306
4318
|
createCredential,
|
|
4307
4319
|
createEmptyContract,
|
|
4320
|
+
createGoogleDriveAuthorizationUrl,
|
|
4308
4321
|
createGraphAssetFolder,
|
|
4309
4322
|
createGraphAssetFolder as createGraphAssetSubfolder,
|
|
4310
4323
|
createGraphPackage,
|
|
@@ -4338,6 +4351,7 @@ export {
|
|
|
4338
4351
|
ensureProjectsRoot,
|
|
4339
4352
|
ensureS3DirectoryMarker,
|
|
4340
4353
|
ensureWorkspaceStructure,
|
|
4354
|
+
exchangeGoogleDriveCode,
|
|
4341
4355
|
exportEncryptedCredentials,
|
|
4342
4356
|
exportGraphAsJsonFile,
|
|
4343
4357
|
fetchCloudflareData,
|
|
@@ -4421,6 +4435,7 @@ export {
|
|
|
4421
4435
|
queryUnifiedDb,
|
|
4422
4436
|
readWorkspaceFile,
|
|
4423
4437
|
recordExecution,
|
|
4438
|
+
refreshGoogleDriveAccessToken,
|
|
4424
4439
|
remoteWorkspaceService,
|
|
4425
4440
|
removeGraphDependency,
|
|
4426
4441
|
renameAppInWorkspaceData,
|
|
@@ -31,15 +31,16 @@ import {
|
|
|
31
31
|
krnlWorkspaceGraphServiceFacade,
|
|
32
32
|
krnlWorkspaceServiceDefinition,
|
|
33
33
|
krnlWorkspaceServiceFacade
|
|
34
|
-
} from "./chunk-
|
|
35
|
-
import "./chunk-
|
|
36
|
-
import "./chunk-
|
|
37
|
-
import "./chunk-J2J24JVC.js";
|
|
38
|
-
import "./chunk-4QEMALXF.js";
|
|
34
|
+
} from "./chunk-BPFZCDS4.js";
|
|
35
|
+
import "./chunk-XHADDA75.js";
|
|
36
|
+
import "./chunk-5RXXC6GE.js";
|
|
39
37
|
import "./chunk-FZKBTF34.js";
|
|
40
38
|
import "./chunk-6K75XXFD.js";
|
|
41
39
|
import "./chunk-VAFCR2MS.js";
|
|
42
|
-
import "./chunk-
|
|
40
|
+
import "./chunk-4QEMALXF.js";
|
|
41
|
+
import "./chunk-SHZAQTIT.js";
|
|
42
|
+
import "./chunk-KKRWZDMN.js";
|
|
43
|
+
import "./chunk-M4GSR46Y.js";
|
|
43
44
|
import "./chunk-TY32TUNI.js";
|
|
44
45
|
export {
|
|
45
46
|
AuthServiceDefinition,
|
|
@@ -14,10 +14,11 @@ import {
|
|
|
14
14
|
} from "../chunk-RBF2OGMC.js";
|
|
15
15
|
import {
|
|
16
16
|
workspaceGraphService
|
|
17
|
-
} from "../chunk-
|
|
18
|
-
import "../chunk-J2J24JVC.js";
|
|
17
|
+
} from "../chunk-5RXXC6GE.js";
|
|
19
18
|
import "../chunk-6K75XXFD.js";
|
|
20
19
|
import "../chunk-VAFCR2MS.js";
|
|
20
|
+
import "../chunk-SHZAQTIT.js";
|
|
21
|
+
import "../chunk-KKRWZDMN.js";
|
|
21
22
|
import "../chunk-TY32TUNI.js";
|
|
22
23
|
export {
|
|
23
24
|
CompositeBackend,
|
|
@@ -80,7 +80,7 @@ interface AppServiceDeclaration {
|
|
|
80
80
|
}
|
|
81
81
|
interface AdaptedStorageConnection {
|
|
82
82
|
id: string;
|
|
83
|
-
provider: 'backblaze_b2' | 'aws_s3' | 'local_fs';
|
|
83
|
+
provider: 'backblaze_b2' | 'aws_s3' | 'google_drive' | 'local_fs';
|
|
84
84
|
label: string;
|
|
85
85
|
role?: 'primary' | 'redundant_clone';
|
|
86
86
|
enabled?: boolean;
|
|
@@ -95,6 +95,12 @@ interface AdaptedStorageConnection {
|
|
|
95
95
|
s3BucketName?: string;
|
|
96
96
|
s3Region?: string;
|
|
97
97
|
s3Endpoint?: string;
|
|
98
|
+
googleEmail?: string;
|
|
99
|
+
googleRootFolderId?: string;
|
|
100
|
+
googleRootFolderName?: string;
|
|
101
|
+
googleAccessToken?: string;
|
|
102
|
+
googleAccessTokenExpiresAt?: number;
|
|
103
|
+
googleRefreshToken?: string;
|
|
98
104
|
}
|
|
99
105
|
interface KeyMaterial {
|
|
100
106
|
secretHex: string;
|