@jskit-ai/workspaces-core 0.1.20 → 0.1.21
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.descriptor.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default Object.freeze({
|
|
2
2
|
packageVersion: 1,
|
|
3
3
|
packageId: "@jskit-ai/workspaces-core",
|
|
4
|
-
version: "0.1.
|
|
4
|
+
version: "0.1.21",
|
|
5
5
|
kind: "runtime",
|
|
6
6
|
description: "Workspace tenancy runtime plus HTTP routes, role catalog, and workspace config scaffolding.",
|
|
7
7
|
dependsOn: [
|
|
@@ -38,7 +38,9 @@ export default Object.freeze({
|
|
|
38
38
|
}
|
|
39
39
|
],
|
|
40
40
|
containerTokens: {
|
|
41
|
-
server: [
|
|
41
|
+
server: [
|
|
42
|
+
"workspaces.server.scope-support"
|
|
43
|
+
],
|
|
42
44
|
client: []
|
|
43
45
|
}
|
|
44
46
|
},
|
|
@@ -110,7 +112,7 @@ export default Object.freeze({
|
|
|
110
112
|
mutations: {
|
|
111
113
|
dependencies: {
|
|
112
114
|
runtime: {
|
|
113
|
-
"@jskit-ai/users-core": "0.1.
|
|
115
|
+
"@jskit-ai/users-core": "0.1.55"
|
|
114
116
|
},
|
|
115
117
|
dev: {}
|
|
116
118
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jskit-ai/workspaces-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "node --test"
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
"./server/WorkspacesCoreServiceProvider": "./src/server/WorkspacesCoreServiceProvider.js",
|
|
10
10
|
"./server/validators/routeParamsValidator": "./src/server/common/validators/routeParamsValidator.js",
|
|
11
|
-
"./server/support/resolveWorkspace": "./src/server/support/resolveWorkspace.js",
|
|
12
11
|
"./server/support/workspaceRouteInput": "./src/server/support/workspaceRouteInput.js",
|
|
13
12
|
"./shared/settings": "./src/shared/settings.js",
|
|
14
13
|
"./shared/tenancyProfile": "./src/shared/tenancyProfile.js",
|
|
@@ -19,11 +18,11 @@
|
|
|
19
18
|
},
|
|
20
19
|
"dependencies": {
|
|
21
20
|
"@fastify/type-provider-typebox": "^6.1.0",
|
|
22
|
-
"@jskit-ai/auth-core": "0.1.
|
|
23
|
-
"@jskit-ai/database-runtime": "0.1.
|
|
24
|
-
"@jskit-ai/http-runtime": "0.1.
|
|
25
|
-
"@jskit-ai/kernel": "0.1.
|
|
26
|
-
"@jskit-ai/users-core": "0.1.
|
|
21
|
+
"@jskit-ai/auth-core": "0.1.44",
|
|
22
|
+
"@jskit-ai/database-runtime": "0.1.45",
|
|
23
|
+
"@jskit-ai/http-runtime": "0.1.44",
|
|
24
|
+
"@jskit-ai/kernel": "0.1.45",
|
|
25
|
+
"@jskit-ai/users-core": "0.1.55",
|
|
27
26
|
"typebox": "^1.0.81"
|
|
28
27
|
}
|
|
29
28
|
}
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
registerWorkspaceActionSurfaceSources,
|
|
15
15
|
resolveWorkspaceSurfaceIdsFromAppConfig
|
|
16
16
|
} from "./support/workspaceActionSurfaces.js";
|
|
17
|
+
import { createWorkspaceServerScopeSupport } from "./support/workspaceServerScopeSupport.js";
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
function registerWorkspaceCore(app) {
|
|
@@ -57,6 +58,7 @@ function registerWorkspaceCore(app) {
|
|
|
57
58
|
tenancyProfile
|
|
58
59
|
}).enabled;
|
|
59
60
|
});
|
|
61
|
+
app.singleton("workspaces.server.scope-support", () => createWorkspaceServerScopeSupport());
|
|
60
62
|
|
|
61
63
|
registerProfileSyncLifecycleContributor(app, "workspaces.core.profileSyncLifecycleContributor", (scope) => {
|
|
62
64
|
const workspaceService = scope.make("workspaces.service");
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { workspaceSlugParamsValidator } from "../common/validators/routeParamsValidator.js";
|
|
2
|
+
import { buildWorkspaceInputFromRouteParams } from "./workspaceRouteInput.js";
|
|
3
|
+
import { resolveWorkspace } from "./resolveWorkspace.js";
|
|
4
|
+
|
|
5
|
+
function createWorkspaceServerScopeSupport() {
|
|
6
|
+
return Object.freeze({
|
|
7
|
+
available: true,
|
|
8
|
+
paramsValidator: workspaceSlugParamsValidator,
|
|
9
|
+
buildInputFromRouteParams(params = {}) {
|
|
10
|
+
return buildWorkspaceInputFromRouteParams(params);
|
|
11
|
+
},
|
|
12
|
+
resolveWorkspace(context = {}, input = {}) {
|
|
13
|
+
return resolveWorkspace(context, input);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { createWorkspaceServerScopeSupport };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
import { createWorkspaceServerScopeSupport } from "../src/server/support/workspaceServerScopeSupport.js";
|
|
4
|
+
import { registerWorkspaceCore } from "../src/server/registerWorkspaceCore.js";
|
|
5
|
+
|
|
6
|
+
test("workspace server scope support exposes the canonical workspace helper surface", () => {
|
|
7
|
+
const support = createWorkspaceServerScopeSupport();
|
|
8
|
+
|
|
9
|
+
assert.equal(support.available, true);
|
|
10
|
+
assert.equal(typeof support.paramsValidator?.normalize, "function");
|
|
11
|
+
assert.deepEqual(support.buildInputFromRouteParams({ workspaceSlug: " ACME " }), {
|
|
12
|
+
workspaceSlug: "acme"
|
|
13
|
+
});
|
|
14
|
+
assert.deepEqual(
|
|
15
|
+
support.resolveWorkspace(
|
|
16
|
+
{
|
|
17
|
+
requestMeta: {
|
|
18
|
+
resolvedWorkspaceContext: {
|
|
19
|
+
workspace: {
|
|
20
|
+
id: 7,
|
|
21
|
+
slug: "acme"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
{}
|
|
27
|
+
),
|
|
28
|
+
{
|
|
29
|
+
id: 7,
|
|
30
|
+
slug: "acme"
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test("registerWorkspaceCore registers the workspace server scope support token", () => {
|
|
36
|
+
const singletons = new Map();
|
|
37
|
+
const app = {
|
|
38
|
+
singleton(token, factory) {
|
|
39
|
+
singletons.set(token, factory);
|
|
40
|
+
return this;
|
|
41
|
+
},
|
|
42
|
+
tag() {
|
|
43
|
+
return this;
|
|
44
|
+
},
|
|
45
|
+
has() {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
registerWorkspaceCore(app);
|
|
51
|
+
|
|
52
|
+
assert.equal(singletons.has("workspaces.server.scope-support"), true);
|
|
53
|
+
const support = singletons.get("workspaces.server.scope-support")();
|
|
54
|
+
assert.equal(support.available, true);
|
|
55
|
+
assert.equal(typeof support.buildInputFromRouteParams, "function");
|
|
56
|
+
assert.equal(typeof support.resolveWorkspace, "function");
|
|
57
|
+
});
|