@ultrst-armada/kloks 1.17.0 → 1.18.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/{chunk-VKSGYMAH.js → chunk-47IVAXPJ.js} +1 -1
- package/packages/backend/dist/{chunk-BTMIK44G.js → chunk-6DNGLKAV.js} +1 -1
- package/packages/backend/dist/{chunk-T26VJ22Y.js → chunk-LCRK2QSY.js} +2 -2
- package/packages/backend/dist/{chunk-6K75XXFD.js → chunk-VN2YMZJO.js} +35 -25
- package/packages/backend/dist/index.d.ts +3 -3
- package/packages/backend/dist/index.js +4 -4
- package/packages/backend/dist/krnl-services.js +3 -3
- package/packages/backend/dist/services/index.js +2 -2
- package/packages/backend/dist/workspace/index.js +2 -2
- package/packages/state-graph/dist/index.js +14 -14
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": 1,
|
|
3
3
|
"packageName": "@ultrst-armada/kloks",
|
|
4
|
-
"version": "1.
|
|
5
|
-
"sourceCommit": "
|
|
4
|
+
"version": "1.18.0",
|
|
5
|
+
"sourceCommit": "68e60d5bca11dc544cc0e3368ec5a4aa948fcab2",
|
|
6
6
|
"releaseWorkflow": "npm Release",
|
|
7
|
-
"workflowRunId": "
|
|
7
|
+
"workflowRunId": "40854825295"
|
|
8
8
|
}
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "./chunk-WTBAG4AV.js";
|
|
18
18
|
import {
|
|
19
19
|
workspaceGraphService
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-47IVAXPJ.js";
|
|
21
21
|
import {
|
|
22
22
|
StorageAdapterFactory
|
|
23
23
|
} from "./chunk-SHZAQTIT.js";
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
findUserWorkspace,
|
|
28
28
|
getWorkspaces,
|
|
29
29
|
updateWorkspace
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-VN2YMZJO.js";
|
|
31
31
|
import {
|
|
32
32
|
queryUnifiedDb
|
|
33
33
|
} from "./chunk-VAFCR2MS.js";
|
|
@@ -353,15 +353,23 @@ async function renameAppInWorkspaceData(userId, workspaceId, appId, newName, env
|
|
|
353
353
|
}
|
|
354
354
|
|
|
355
355
|
// src/core/workspaceCore.ts
|
|
356
|
+
function workspaceAppId(env) {
|
|
357
|
+
const value = String(env?.WORKSPACE_APP_ID ?? "depm").trim().toLowerCase();
|
|
358
|
+
return value || "depm";
|
|
359
|
+
}
|
|
360
|
+
function appProfile(profiles, appId) {
|
|
361
|
+
if (!profiles[appId] || typeof profiles[appId] !== "object") profiles[appId] = {};
|
|
362
|
+
return profiles[appId];
|
|
363
|
+
}
|
|
356
364
|
async function findUserWorkspace(workspaceId, env) {
|
|
357
365
|
const res = await queryUnifiedDb(`SELECT id, email, username, app_profiles FROM "ultrst-users"`, [], env);
|
|
358
366
|
for (const user of res.rows) {
|
|
359
367
|
const profiles = typeof user.app_profiles === "string" ? JSON.parse(user.app_profiles) : user.app_profiles || {};
|
|
360
|
-
const
|
|
361
|
-
const workspaces = Array.isArray(
|
|
368
|
+
const app = appProfile(profiles, workspaceAppId(env));
|
|
369
|
+
const workspaces = Array.isArray(app.workspaces) ? app.workspaces : [];
|
|
362
370
|
const ws = workspaces.find((w) => w.id === workspaceId);
|
|
363
371
|
if (ws) {
|
|
364
|
-
const conns =
|
|
372
|
+
const conns = app.storage_connections || profiles.srkl?.storage_connections || profiles.docustack?.storage_connections || [];
|
|
365
373
|
const conn = conns.find((c) => c.id === ws.storageConnectionId) || conns.find((c) => c.role === "primary") || conns[0] || null;
|
|
366
374
|
return { user, workspace: ws, connection: conn };
|
|
367
375
|
}
|
|
@@ -378,10 +386,10 @@ async function getWorkspaces(userId, env) {
|
|
|
378
386
|
return { success: true, workspaces: [], activeWorkspaceId: null, storage_connections: [] };
|
|
379
387
|
}
|
|
380
388
|
const profiles = typeof userRow.app_profiles === "string" ? JSON.parse(userRow.app_profiles) : userRow.app_profiles || {};
|
|
381
|
-
const
|
|
382
|
-
const workspaces = Array.isArray(
|
|
383
|
-
const activeWorkspaceId =
|
|
384
|
-
const conns =
|
|
389
|
+
const app = appProfile(profiles, workspaceAppId(env));
|
|
390
|
+
const workspaces = Array.isArray(app.workspaces) ? app.workspaces : [];
|
|
391
|
+
const activeWorkspaceId = app.activeWorkspaceId || null;
|
|
392
|
+
const conns = app.storage_connections?.length ? app.storage_connections : profiles.srkl?.storage_connections || [];
|
|
385
393
|
return { success: true, workspaces, activeWorkspaceId, storage_connections: conns };
|
|
386
394
|
}
|
|
387
395
|
async function createWorkspace(userId, wsData, env) {
|
|
@@ -389,12 +397,13 @@ async function createWorkspace(userId, wsData, env) {
|
|
|
389
397
|
const user = uRes.rows[0];
|
|
390
398
|
if (!user) throw new Error("User account not found.");
|
|
391
399
|
const profiles = typeof user.app_profiles === "string" ? JSON.parse(user.app_profiles) : user.app_profiles || {};
|
|
392
|
-
|
|
393
|
-
const workspaces = Array.isArray(
|
|
400
|
+
const app = appProfile(profiles, workspaceAppId(env));
|
|
401
|
+
const workspaces = Array.isArray(app.workspaces) ? app.workspaces : [];
|
|
402
|
+
const appId = workspaceAppId(env);
|
|
394
403
|
const wsName = (wsData.name || "New Workspace").trim();
|
|
395
|
-
const wsId = wsData.id || `ws
|
|
404
|
+
const wsId = wsData.id || `ws-${appId}-${Date.now()}`;
|
|
396
405
|
const userName = user.username || user.name || "user";
|
|
397
|
-
const folderKey = `
|
|
406
|
+
const folderKey = `ultrst_${appId}_${userName.toLowerCase().replace(/[^a-z0-9]/g, "_")}_${wsName.toLowerCase().replace(/[^a-z0-9]/g, "_")}`;
|
|
398
407
|
const newWs = {
|
|
399
408
|
...wsData,
|
|
400
409
|
id: wsId,
|
|
@@ -403,13 +412,13 @@ async function createWorkspace(userId, wsData, env) {
|
|
|
403
412
|
localFolderKey: folderKey,
|
|
404
413
|
workspacePath: `./${folderKey}`,
|
|
405
414
|
storageProvider: wsData.storageProvider || "backblaze_b2",
|
|
406
|
-
b2BucketName: wsData.b2BucketName ||
|
|
415
|
+
b2BucketName: wsData.b2BucketName || void 0,
|
|
407
416
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
408
417
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
409
418
|
};
|
|
410
419
|
workspaces.push(newWs);
|
|
411
|
-
|
|
412
|
-
|
|
420
|
+
app.workspaces = workspaces;
|
|
421
|
+
app.activeWorkspaceId = wsId;
|
|
413
422
|
await queryUnifiedDb(`UPDATE "ultrst-users" SET app_profiles = $1, updated_at = NOW() WHERE id = $2`, [JSON.stringify(profiles), user.id], env);
|
|
414
423
|
const conn = resolveWorkspaceConnection(profiles, newWs);
|
|
415
424
|
await syncWorkspaceCreateToBucket(newWs, conn, env);
|
|
@@ -420,14 +429,14 @@ async function updateWorkspace(userId, params, env) {
|
|
|
420
429
|
const user = uRes.rows[0];
|
|
421
430
|
if (!user) throw new Error("User not found.");
|
|
422
431
|
const profiles = typeof user.app_profiles === "string" ? JSON.parse(user.app_profiles) : user.app_profiles || {};
|
|
423
|
-
|
|
424
|
-
const workspaces = Array.isArray(
|
|
432
|
+
const app = appProfile(profiles, workspaceAppId(env));
|
|
433
|
+
const workspaces = Array.isArray(app.workspaces) ? app.workspaces : [];
|
|
425
434
|
const { action, workspaceId, updates } = params;
|
|
426
435
|
const targetId = workspaceId || updates?.id;
|
|
427
436
|
const match = workspaces.find((w) => w.id === targetId);
|
|
428
437
|
if (!match) throw new Error("Workspace not found.");
|
|
429
438
|
if (action === "switch") {
|
|
430
|
-
|
|
439
|
+
app.activeWorkspaceId = targetId;
|
|
431
440
|
} else {
|
|
432
441
|
const safeUpdates = { ...updates || params };
|
|
433
442
|
delete safeUpdates.storageProvider;
|
|
@@ -452,21 +461,22 @@ async function deleteWorkspace(userId, wsId, env) {
|
|
|
452
461
|
const user = uRes.rows[0];
|
|
453
462
|
if (!user) throw new Error("User not found.");
|
|
454
463
|
const profiles = typeof user.app_profiles === "string" ? JSON.parse(user.app_profiles) : user.app_profiles || {};
|
|
455
|
-
|
|
456
|
-
|
|
464
|
+
const app = appProfile(profiles, workspaceAppId(env));
|
|
465
|
+
if (!app.workspaces) return { success: true, workspaces: [] };
|
|
466
|
+
const targetWs = app.workspaces.find((w) => w.id === wsId);
|
|
457
467
|
const conn = targetWs ? resolveWorkspaceConnection(profiles, targetWs) : null;
|
|
458
|
-
|
|
459
|
-
if (
|
|
460
|
-
|
|
468
|
+
app.workspaces = app.workspaces.filter((w) => w.id !== wsId);
|
|
469
|
+
if (app.activeWorkspaceId === wsId) {
|
|
470
|
+
app.activeWorkspaceId = app.workspaces[0]?.id || null;
|
|
461
471
|
}
|
|
462
|
-
if (
|
|
463
|
-
delete
|
|
472
|
+
if (app.workspace_data?.[wsId]) {
|
|
473
|
+
delete app.workspace_data[wsId];
|
|
464
474
|
}
|
|
465
475
|
await queryUnifiedDb(`UPDATE "ultrst-users" SET app_profiles = $1, updated_at = NOW() WHERE id = $2`, [JSON.stringify(profiles), user.id], env);
|
|
466
476
|
if (targetWs && conn) {
|
|
467
477
|
await syncWorkspaceDeleteToBucket(targetWs, conn, env);
|
|
468
478
|
}
|
|
469
|
-
return { success: true, workspaces:
|
|
479
|
+
return { success: true, workspaces: app.workspaces };
|
|
470
480
|
}
|
|
471
481
|
|
|
472
482
|
// src/core/workspaceStorageDetailsCore.ts
|
|
@@ -666,19 +666,19 @@ declare function findUserWorkspace(workspaceId: string, env?: Record<string, unk
|
|
|
666
666
|
}>;
|
|
667
667
|
declare function getWorkspaces(userId?: string, env?: Record<string, unknown>): Promise<{
|
|
668
668
|
success: boolean;
|
|
669
|
-
workspaces: any;
|
|
669
|
+
workspaces: any[];
|
|
670
670
|
activeWorkspaceId: any;
|
|
671
671
|
storage_connections: any;
|
|
672
672
|
}>;
|
|
673
673
|
declare function createWorkspace(userId: string, wsData: any, env?: Record<string, unknown>): Promise<{
|
|
674
674
|
success: boolean;
|
|
675
675
|
workspace: any;
|
|
676
|
-
workspaces: any;
|
|
676
|
+
workspaces: any[];
|
|
677
677
|
}>;
|
|
678
678
|
declare function updateWorkspace(userId: string, params: any, env?: Record<string, unknown>): Promise<{
|
|
679
679
|
success: boolean;
|
|
680
680
|
workspace: any;
|
|
681
|
-
workspaces: any;
|
|
681
|
+
workspaces: any[];
|
|
682
682
|
}>;
|
|
683
683
|
declare function deleteWorkspace(userId: string, wsId: string, env?: Record<string, unknown>): Promise<{
|
|
684
684
|
success: boolean;
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
setWorkingWorkspaceConfig,
|
|
35
35
|
syncWorkspace,
|
|
36
36
|
workingWorkspaceService
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-6DNGLKAV.js";
|
|
38
38
|
import {
|
|
39
39
|
validateToolInput
|
|
40
40
|
} from "./chunk-6GQNYRD6.js";
|
|
@@ -178,7 +178,7 @@ import {
|
|
|
178
178
|
krnlWorkspaceGraphServiceFacade,
|
|
179
179
|
krnlWorkspaceServiceDefinition,
|
|
180
180
|
krnlWorkspaceServiceFacade
|
|
181
|
-
} from "./chunk-
|
|
181
|
+
} from "./chunk-LCRK2QSY.js";
|
|
182
182
|
import {
|
|
183
183
|
getPrimarySrklDeploymentUrl,
|
|
184
184
|
getSrklAccounts,
|
|
@@ -205,7 +205,7 @@ import {
|
|
|
205
205
|
} from "./chunk-WTBAG4AV.js";
|
|
206
206
|
import {
|
|
207
207
|
workspaceGraphService
|
|
208
|
-
} from "./chunk-
|
|
208
|
+
} from "./chunk-47IVAXPJ.js";
|
|
209
209
|
import {
|
|
210
210
|
BackblazeB2Adapter,
|
|
211
211
|
LocalFSAdapter,
|
|
@@ -240,7 +240,7 @@ import {
|
|
|
240
240
|
syncWorkspaceDeleteToBucket,
|
|
241
241
|
updateWorkspace,
|
|
242
242
|
writeWorkspaceFile
|
|
243
|
-
} from "./chunk-
|
|
243
|
+
} from "./chunk-VN2YMZJO.js";
|
|
244
244
|
import {
|
|
245
245
|
b2DeleteFileVersion,
|
|
246
246
|
b2DeleteFolder,
|
|
@@ -31,14 +31,14 @@ import {
|
|
|
31
31
|
krnlWorkspaceGraphServiceFacade,
|
|
32
32
|
krnlWorkspaceServiceDefinition,
|
|
33
33
|
krnlWorkspaceServiceFacade
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-LCRK2QSY.js";
|
|
35
35
|
import "./chunk-XHADDA75.js";
|
|
36
36
|
import "./chunk-4QEMALXF.js";
|
|
37
37
|
import "./chunk-FZKBTF34.js";
|
|
38
38
|
import "./chunk-WTBAG4AV.js";
|
|
39
|
-
import "./chunk-
|
|
39
|
+
import "./chunk-47IVAXPJ.js";
|
|
40
40
|
import "./chunk-SHZAQTIT.js";
|
|
41
|
-
import "./chunk-
|
|
41
|
+
import "./chunk-VN2YMZJO.js";
|
|
42
42
|
import "./chunk-VAFCR2MS.js";
|
|
43
43
|
import "./chunk-KKRWZDMN.js";
|
|
44
44
|
import "./chunk-TY32TUNI.js";
|
|
@@ -14,9 +14,9 @@ import {
|
|
|
14
14
|
} from "../chunk-RBF2OGMC.js";
|
|
15
15
|
import {
|
|
16
16
|
workspaceGraphService
|
|
17
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-47IVAXPJ.js";
|
|
18
18
|
import "../chunk-SHZAQTIT.js";
|
|
19
|
-
import "../chunk-
|
|
19
|
+
import "../chunk-VN2YMZJO.js";
|
|
20
20
|
import "../chunk-VAFCR2MS.js";
|
|
21
21
|
import "../chunk-KKRWZDMN.js";
|
|
22
22
|
import "../chunk-TY32TUNI.js";
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
WorkspaceFS,
|
|
7
7
|
remoteWorkspaceService,
|
|
8
8
|
workingWorkspaceService
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-6DNGLKAV.js";
|
|
10
10
|
import {
|
|
11
11
|
formatCanonicalWorkspaceFolderName,
|
|
12
12
|
sanitizeWorkspaceName
|
|
13
13
|
} from "../chunk-FZKBTF34.js";
|
|
14
|
-
import "../chunk-
|
|
14
|
+
import "../chunk-VN2YMZJO.js";
|
|
15
15
|
import "../chunk-VAFCR2MS.js";
|
|
16
16
|
import "../chunk-KKRWZDMN.js";
|
|
17
17
|
export {
|
|
@@ -16,6 +16,20 @@ import {
|
|
|
16
16
|
useSkipoBind,
|
|
17
17
|
useSkipoState
|
|
18
18
|
} from "./chunk-EW4ACSZB.js";
|
|
19
|
+
import {
|
|
20
|
+
CommandApi,
|
|
21
|
+
GhostStore,
|
|
22
|
+
GraphStore
|
|
23
|
+
} from "./chunk-4UVGXFEM.js";
|
|
24
|
+
import {
|
|
25
|
+
BaseGraph,
|
|
26
|
+
BaseNode,
|
|
27
|
+
BaseViewWindow,
|
|
28
|
+
CustomGraph,
|
|
29
|
+
CustomNode,
|
|
30
|
+
CustomViewWindow,
|
|
31
|
+
DEFAULT_GRAPH_SETTINGS
|
|
32
|
+
} from "./chunk-KG6QYS26.js";
|
|
19
33
|
import {
|
|
20
34
|
AttractionEngine,
|
|
21
35
|
GhostInferenceEngine,
|
|
@@ -31,20 +45,6 @@ import {
|
|
|
31
45
|
WireTypeRegistry,
|
|
32
46
|
initializeDefaultGraphRules
|
|
33
47
|
} from "./chunk-TZOL3RN7.js";
|
|
34
|
-
import {
|
|
35
|
-
CommandApi,
|
|
36
|
-
GhostStore,
|
|
37
|
-
GraphStore
|
|
38
|
-
} from "./chunk-4UVGXFEM.js";
|
|
39
|
-
import {
|
|
40
|
-
BaseGraph,
|
|
41
|
-
BaseNode,
|
|
42
|
-
BaseViewWindow,
|
|
43
|
-
CustomGraph,
|
|
44
|
-
CustomNode,
|
|
45
|
-
CustomViewWindow,
|
|
46
|
-
DEFAULT_GRAPH_SETTINGS
|
|
47
|
-
} from "./chunk-KG6QYS26.js";
|
|
48
48
|
import {
|
|
49
49
|
AutoSolidify,
|
|
50
50
|
SpatialEngine,
|