@jskit-ai/workspaces-web 0.2.6 → 0.2.8
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 +8 -8
- package/src/client/lib/bootstrap.js +3 -2
- package/src/client/runtime/bootstrapPlacementRuntime.js +14 -7
- package/src/client/runtime/bootstrapPlacementRuntimeHelpers.js +0 -8
- package/test/bootstrapPlacementRuntime.test.js +10 -8
- package/test/workspaceScopeSupport.test.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jskit-ai/workspaces-web",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "node --test --test-concurrency=1"
|
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
"./locales/en.json": "./locales/en.json"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@jskit-ai/users-core": "0.2.
|
|
20
|
-
"@jskit-ai/workspaces-core": "0.2.
|
|
19
|
+
"@jskit-ai/users-core": "0.2.5",
|
|
20
|
+
"@jskit-ai/workspaces-core": "0.2.5",
|
|
21
21
|
"@mdi/js": "^7.4.47"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@jskit-ai/auth-web": "0.2.
|
|
25
|
-
"@jskit-ai/http-web": "0.2.
|
|
26
|
-
"@jskit-ai/kernel": "0.2.
|
|
27
|
-
"@jskit-ai/shell-web": "0.2.
|
|
28
|
-
"@jskit-ai/users-web": "0.2.
|
|
24
|
+
"@jskit-ai/auth-web": "0.2.5",
|
|
25
|
+
"@jskit-ai/http-web": "0.2.8",
|
|
26
|
+
"@jskit-ai/kernel": "0.2.4",
|
|
27
|
+
"@jskit-ai/shell-web": "0.2.4",
|
|
28
|
+
"@jskit-ai/users-web": "0.2.8",
|
|
29
29
|
"@tanstack/vue-query": "^5.90.5",
|
|
30
30
|
"vue": "^3.5.13",
|
|
31
31
|
"vue-router": "^5.0.4",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { normalizeLowerText, normalizeText } from "@jskit-ai/kernel/shared/support/normalize";
|
|
2
2
|
import { normalizeRecordId } from "@jskit-ai/kernel/shared/support/normalize";
|
|
3
|
+
import { BOOTSTRAP_PATH } from "@jskit-ai/kernel/shared/surface/paths";
|
|
3
4
|
|
|
4
5
|
function normalizeWorkspaceSlug(value = "") {
|
|
5
6
|
return normalizeLowerText(value);
|
|
@@ -48,13 +49,13 @@ function findWorkspaceBySlug(entries = [], workspaceSlug = "") {
|
|
|
48
49
|
function buildBootstrapApiPath(workspaceSlug = "") {
|
|
49
50
|
const normalizedWorkspaceSlug = normalizeWorkspaceSlug(workspaceSlug);
|
|
50
51
|
if (!normalizedWorkspaceSlug) {
|
|
51
|
-
return
|
|
52
|
+
return BOOTSTRAP_PATH;
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
const params = new URLSearchParams({
|
|
55
56
|
workspaceSlug: normalizedWorkspaceSlug
|
|
56
57
|
});
|
|
57
|
-
return
|
|
58
|
+
return `${BOOTSTRAP_PATH}?${params.toString()}`;
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
export { buildBootstrapApiPath, findWorkspaceBySlug, normalizeWorkspaceEntry, normalizeWorkspaceList };
|
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
} from "./bootstrapPlacementRuntimeConstants.js";
|
|
22
22
|
import {
|
|
23
23
|
countPendingInvites,
|
|
24
|
-
createProviderLogger,
|
|
25
24
|
normalizeWorkspaceBootstrapStatus,
|
|
26
25
|
normalizeWorkspaceSlugKey,
|
|
27
26
|
resolveRequestedWorkspaceBootstrapStatus,
|
|
@@ -29,14 +28,23 @@ import {
|
|
|
29
28
|
} from "./bootstrapPlacementRuntimeHelpers.js";
|
|
30
29
|
import { resolveErrorStatusCode } from "../support/runtimeNormalization.js";
|
|
31
30
|
|
|
31
|
+
/**
|
|
32
|
+
* @param {object} options
|
|
33
|
+
* @param {any} options.bootstrapRuntime
|
|
34
|
+
* @param {any} options.placementRuntime
|
|
35
|
+
* @param {any} [options.realtime]
|
|
36
|
+
* @param {any} [options.router]
|
|
37
|
+
* @param {any} [options.vueApp]
|
|
38
|
+
* @param {import("@jskit-ai/kernel/server/types").RuntimeLogger} options.logger
|
|
39
|
+
*/
|
|
32
40
|
function createBootstrapPlacementRuntime({
|
|
33
41
|
bootstrapRuntime,
|
|
34
42
|
placementRuntime,
|
|
35
43
|
realtime = null,
|
|
36
44
|
router = null,
|
|
37
45
|
vueApp = null,
|
|
38
|
-
logger
|
|
39
|
-
}
|
|
46
|
+
logger
|
|
47
|
+
}) {
|
|
40
48
|
if (!placementRuntime || typeof placementRuntime.getContext !== "function") {
|
|
41
49
|
throw new Error("createBootstrapPlacementRuntime requires shell-web placement runtime.");
|
|
42
50
|
}
|
|
@@ -44,7 +52,6 @@ function createBootstrapPlacementRuntime({
|
|
|
44
52
|
throw new Error("createBootstrapPlacementRuntime requires shell-web bootstrap runtime.");
|
|
45
53
|
}
|
|
46
54
|
|
|
47
|
-
const runtimeLogger = createProviderLogger(logger);
|
|
48
55
|
let vuetifyThemeController = resolveVuetifyThemeController(vueApp);
|
|
49
56
|
const socket = realtime?.socket || null;
|
|
50
57
|
const cleanup = [];
|
|
@@ -200,7 +207,7 @@ function createBootstrapPlacementRuntime({
|
|
|
200
207
|
setVuetifyThemeName(themeController, nextThemeName);
|
|
201
208
|
persistBootstrapThemePreference(payload);
|
|
202
209
|
} catch (error) {
|
|
203
|
-
|
|
210
|
+
logger.warn(
|
|
204
211
|
{
|
|
205
212
|
reason,
|
|
206
213
|
error: String(error?.message || error || "unknown error")
|
|
@@ -246,7 +253,7 @@ function createBootstrapPlacementRuntime({
|
|
|
246
253
|
const workspaceTheme = resolveWorkspaceThemeForCurrentRoute();
|
|
247
254
|
setVuetifyPrimaryColorOverride(themeController, workspaceTheme);
|
|
248
255
|
} catch (error) {
|
|
249
|
-
|
|
256
|
+
logger.warn(
|
|
250
257
|
{
|
|
251
258
|
reason,
|
|
252
259
|
error: String(error?.message || error || "unknown error")
|
|
@@ -372,7 +379,7 @@ function createBootstrapPlacementRuntime({
|
|
|
372
379
|
setWorkspaceBootstrapStatus(requested.workspaceSlug, WORKSPACE_BOOTSTRAP_STATUS_ERROR, normalizedSource);
|
|
373
380
|
}
|
|
374
381
|
|
|
375
|
-
|
|
382
|
+
logger.warn(
|
|
376
383
|
{
|
|
377
384
|
reason,
|
|
378
385
|
error: String(error?.message || error || "unknown error")
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createProviderLogger as createSharedProviderLogger
|
|
3
|
-
} from "@jskit-ai/kernel/shared/support/providerLogger";
|
|
4
1
|
import {
|
|
5
2
|
resolveRuntimePathname,
|
|
6
3
|
resolveSurfaceIdFromPlacementPathname
|
|
@@ -14,10 +11,6 @@ import {
|
|
|
14
11
|
} from "../support/runtimeNormalization.js";
|
|
15
12
|
import { WORKSPACE_BOOTSTRAP_STATUSES } from "./bootstrapPlacementRuntimeConstants.js";
|
|
16
13
|
|
|
17
|
-
function createProviderLogger(logger) {
|
|
18
|
-
return createSharedProviderLogger(logger);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
14
|
function resolveRouteState(placementRuntime, router) {
|
|
22
15
|
const context = placementRuntime.getContext();
|
|
23
16
|
const path = resolveRuntimePathname(router?.currentRoute?.value?.path);
|
|
@@ -134,7 +127,6 @@ async function fetchBootstrapPayload(workspaceSlug = "") {
|
|
|
134
127
|
|
|
135
128
|
export {
|
|
136
129
|
countPendingInvites,
|
|
137
|
-
createProviderLogger,
|
|
138
130
|
fetchBootstrapPayload,
|
|
139
131
|
isGuardDenied,
|
|
140
132
|
normalizeSearch,
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
WORKSPACE_BOOTSTRAP_STATUS_UNAUTHENTICATED,
|
|
11
11
|
createBootstrapPlacementRuntime
|
|
12
12
|
} from "../src/client/runtime/bootstrapPlacementRuntime.js";
|
|
13
|
+
import { silentLogger } from "@jskit-ai/kernel/shared/support/silentLogger";
|
|
13
14
|
|
|
14
15
|
const SHELL_GUARD_EVALUATOR_KEY = "__JSKIT_WEB_SHELL_GUARD_EVALUATOR__";
|
|
15
16
|
|
|
@@ -196,7 +197,8 @@ function createTestRuntime({
|
|
|
196
197
|
bootstrapRuntime,
|
|
197
198
|
realtime: socket ? { socket } : null,
|
|
198
199
|
router,
|
|
199
|
-
vueApp
|
|
200
|
+
vueApp,
|
|
201
|
+
logger: silentLogger
|
|
200
202
|
});
|
|
201
203
|
}
|
|
202
204
|
|
|
@@ -608,12 +610,12 @@ test("bootstrap placement runtime tracks status per workspace slug across route
|
|
|
608
610
|
|
|
609
611
|
test("bootstrap placement runtime uses requestedWorkspace status and keeps global workspace list on inaccessible slug", async () => {
|
|
610
612
|
const placementRuntime = createPlacementRuntimeStub();
|
|
611
|
-
const router = createRouterStub("/w/
|
|
613
|
+
const router = createRouterStub("/w/tony");
|
|
612
614
|
const runtime = createTestRuntime({ placementRuntime, router });
|
|
613
615
|
|
|
614
616
|
await runtime.initialize();
|
|
615
617
|
await runtime.applyBootstrapPayload({
|
|
616
|
-
request: createBootstrapRequest("/w/
|
|
618
|
+
request: createBootstrapRequest("/w/tony", "tony"),
|
|
617
619
|
payload: {
|
|
618
620
|
session: {
|
|
619
621
|
authenticated: true,
|
|
@@ -626,9 +628,9 @@ test("bootstrap placement runtime uses requestedWorkspace status and keeps globa
|
|
|
626
628
|
effectiveUrl: ""
|
|
627
629
|
}
|
|
628
630
|
},
|
|
629
|
-
workspaces: [{ id: "3", slug: "
|
|
631
|
+
workspaces: [{ id: "3", slug: "chiara", name: "Chiara Workspace" }],
|
|
630
632
|
requestedWorkspace: {
|
|
631
|
-
slug: "
|
|
633
|
+
slug: "tony",
|
|
632
634
|
status: "forbidden"
|
|
633
635
|
},
|
|
634
636
|
permissions: []
|
|
@@ -636,12 +638,12 @@ test("bootstrap placement runtime uses requestedWorkspace status and keeps globa
|
|
|
636
638
|
});
|
|
637
639
|
|
|
638
640
|
const context = placementRuntime.getContext();
|
|
639
|
-
assert.equal(runtime.getWorkspaceBootstrapStatus("
|
|
640
|
-
assert.equal(context.workspaceBootstrapStatuses?.
|
|
641
|
+
assert.equal(runtime.getWorkspaceBootstrapStatus("tony"), WORKSPACE_BOOTSTRAP_STATUS_FORBIDDEN);
|
|
642
|
+
assert.equal(context.workspaceBootstrapStatuses?.tony, WORKSPACE_BOOTSTRAP_STATUS_FORBIDDEN);
|
|
641
643
|
assert.equal(context.workspace, null);
|
|
642
644
|
assert.equal(Array.isArray(context.workspaces), true);
|
|
643
645
|
assert.equal(context.workspaces.length, 1);
|
|
644
|
-
assert.equal(context.workspaces[0]?.slug, "
|
|
646
|
+
assert.equal(context.workspaces[0]?.slug, "chiara");
|
|
645
647
|
});
|
|
646
648
|
|
|
647
649
|
test("bootstrap placement runtime uses requestedWorkspace=not_found without forcing forbidden fallback", async () => {
|
|
@@ -54,10 +54,10 @@ test("workspace scope support exposes the shared route-scope reader", () => {
|
|
|
54
54
|
}
|
|
55
55
|
}),
|
|
56
56
|
currentSurfaceId: computed(() => "app"),
|
|
57
|
-
routePath: computed(() => "/w/
|
|
57
|
+
routePath: computed(() => "/w/harbor")
|
|
58
58
|
}),
|
|
59
59
|
{
|
|
60
|
-
workspaceSlug: "
|
|
60
|
+
workspaceSlug: "harbor"
|
|
61
61
|
}
|
|
62
62
|
);
|
|
63
63
|
});
|