@jskit-ai/kernel 0.1.31 → 0.1.33
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 +1 -1
- package/server/http/lib/kernel.test.js +5 -5
- package/server/runtime/entityChangeEvents.js +5 -5
- package/server/runtime/entityChangeEvents.test.js +5 -5
- package/server/runtime/serviceAuthorization.test.js +1 -1
- package/server/support/index.js +10 -0
- package/server/support/pageTargets.js +684 -0
- package/server/support/pageTargets.test.js +326 -0
- package/shared/support/normalize.js +31 -1
- package/shared/support/normalize.test.js +21 -2
- package/shared/support/visibility.js +1 -1
- package/shared/support/visibility.test.js +5 -5
- package/shared/validators/cursorPaginationQueryValidator.js +3 -4
- package/shared/validators/cursorPaginationQueryValidator.test.js +2 -3
- package/shared/validators/index.js +11 -1
- package/shared/validators/recordIdParamsValidator.js +47 -9
- package/shared/validators/recordIdParamsValidator.test.js +7 -4
package/package.json
CHANGED
|
@@ -236,7 +236,7 @@ test("registerRoutes attaches visibilityContext from route visibility resolvers"
|
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
return {
|
|
239
|
-
|
|
239
|
+
userId: context?.actor?.id,
|
|
240
240
|
requiresActorScope: true
|
|
241
241
|
};
|
|
242
242
|
}
|
|
@@ -281,7 +281,7 @@ test("registerRoutes attaches visibilityContext from route visibility resolvers"
|
|
|
281
281
|
scopeKind: null,
|
|
282
282
|
requiresActorScope: true,
|
|
283
283
|
scopeOwnerId: null,
|
|
284
|
-
|
|
284
|
+
userId: "23"
|
|
285
285
|
});
|
|
286
286
|
assert.deepEqual(observed[0].context.requestMeta.visibilityContext, observed[0].context.visibilityContext);
|
|
287
287
|
assert.equal(observed[0].context.requestMeta.routeVisibility, "user");
|
|
@@ -309,7 +309,7 @@ test("registerRoutes keeps actor scope requirement for core user visibility with
|
|
|
309
309
|
}
|
|
310
310
|
|
|
311
311
|
return {
|
|
312
|
-
|
|
312
|
+
userId: context?.actor?.id
|
|
313
313
|
};
|
|
314
314
|
}
|
|
315
315
|
}));
|
|
@@ -353,7 +353,7 @@ test("registerRoutes keeps actor scope requirement for core user visibility with
|
|
|
353
353
|
scopeKind: null,
|
|
354
354
|
requiresActorScope: true,
|
|
355
355
|
scopeOwnerId: null,
|
|
356
|
-
|
|
356
|
+
userId: "23"
|
|
357
357
|
});
|
|
358
358
|
assert.equal(observed[0].context.requestMeta.routeVisibility, "user");
|
|
359
359
|
});
|
|
@@ -399,7 +399,7 @@ test("registerRoutes does not infer actor scope from non-core route visibility t
|
|
|
399
399
|
scopeKind: null,
|
|
400
400
|
requiresActorScope: false,
|
|
401
401
|
scopeOwnerId: null,
|
|
402
|
-
|
|
402
|
+
userId: null
|
|
403
403
|
});
|
|
404
404
|
assert.equal(observed[0].context.requestMeta.routeVisibility, "workspace_user");
|
|
405
405
|
});
|
|
@@ -43,10 +43,10 @@ function resolveVisibilityScope(visibilityContext = {}, runtimeContext = {}) {
|
|
|
43
43
|
const visibility = normalizeText(visibilityContext.visibility).toLowerCase();
|
|
44
44
|
const scopeKind = normalizeText(visibilityContext.scopeKind || visibility).toLowerCase();
|
|
45
45
|
const scopeOwnerId = normalizeOpaqueId(visibilityContext.scopeOwnerId);
|
|
46
|
-
const
|
|
46
|
+
const userId = normalizeOpaqueId(visibilityContext.userId);
|
|
47
47
|
const requiresActorScope = visibilityContext.requiresActorScope === true;
|
|
48
48
|
|
|
49
|
-
if (requiresActorScope &&
|
|
49
|
+
if (requiresActorScope && userId == null) {
|
|
50
50
|
return null;
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -57,7 +57,7 @@ function resolveVisibilityScope(visibilityContext = {}, runtimeContext = {}) {
|
|
|
57
57
|
};
|
|
58
58
|
if (requiresActorScope) {
|
|
59
59
|
scope.scopeId = scopeOwnerId;
|
|
60
|
-
scope.userId =
|
|
60
|
+
scope.userId = userId;
|
|
61
61
|
}
|
|
62
62
|
return scope;
|
|
63
63
|
}
|
|
@@ -72,10 +72,10 @@ function resolveVisibilityScope(visibilityContext = {}, runtimeContext = {}) {
|
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
if (scopeKind === "user" &&
|
|
75
|
+
if (scopeKind === "user" && userId != null) {
|
|
76
76
|
return {
|
|
77
77
|
kind: "user",
|
|
78
|
-
id:
|
|
78
|
+
id: userId
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
81
|
|
|
@@ -33,9 +33,9 @@ test("entity change publisher emits normalized event payload", async () => {
|
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
assert.equal(payload?.operation, "created");
|
|
36
|
-
assert.equal(payload?.entityId, 5);
|
|
37
|
-
assert.deepEqual(payload?.scope, { kind: "scope", id: 23 });
|
|
38
|
-
assert.equal(payload?.actorId, 17);
|
|
36
|
+
assert.equal(payload?.entityId, "5");
|
|
37
|
+
assert.deepEqual(payload?.scope, { kind: "scope", id: "23" });
|
|
38
|
+
assert.equal(payload?.actorId, "17");
|
|
39
39
|
assert.equal(payload?.commandId, "cmd-1");
|
|
40
40
|
assert.equal(payload?.sourceClientId, "client-a");
|
|
41
41
|
assert.equal(payload?.meta?.service?.token, "crud.customers");
|
|
@@ -111,7 +111,7 @@ test("entity change publisher infers scoped owner from service context when visi
|
|
|
111
111
|
}
|
|
112
112
|
);
|
|
113
113
|
|
|
114
|
-
assert.deepEqual(payload?.scope, { kind: "workspace", id: 23 });
|
|
114
|
+
assert.deepEqual(payload?.scope, { kind: "workspace", id: "23" });
|
|
115
115
|
assert.equal(published.length, 1);
|
|
116
116
|
});
|
|
117
117
|
|
|
@@ -133,7 +133,7 @@ test("entity change publisher supports opaque actor and scope identifiers", asyn
|
|
|
133
133
|
visibilityContext: {
|
|
134
134
|
scopeKind: "workspace_user",
|
|
135
135
|
scopeOwnerId: "workspace_23",
|
|
136
|
-
|
|
136
|
+
userId: "user_17",
|
|
137
137
|
requiresActorScope: true
|
|
138
138
|
}
|
|
139
139
|
}
|
package/server/support/index.js
CHANGED
|
@@ -2,6 +2,16 @@ export { symlinkSafeRequire } from "./symlinkSafeRequire.js";
|
|
|
2
2
|
export { resolveAppConfig } from "./appConfig.js";
|
|
3
3
|
export { loadAppConfigFromModuleUrl } from "./appConfigFiles.js";
|
|
4
4
|
export { resolveRequiredAppRoot, toPosixPath } from "./path.js";
|
|
5
|
+
export {
|
|
6
|
+
DEFAULT_PAGE_LINK_COMPONENT_TOKEN,
|
|
7
|
+
DEFAULT_SUBPAGE_LINK_COMPONENT_TOKEN,
|
|
8
|
+
normalizePagesRelativeTargetFile,
|
|
9
|
+
normalizePagesRelativeTargetRoot,
|
|
10
|
+
resolvePageTargetDetails,
|
|
11
|
+
deriveDefaultSubpagesHost,
|
|
12
|
+
resolveNearestParentSubpagesHost,
|
|
13
|
+
resolvePageLinkTargetDetails
|
|
14
|
+
} from "./pageTargets.js";
|
|
5
15
|
export {
|
|
6
16
|
discoverShellOutletTargetsFromApp,
|
|
7
17
|
resolveShellOutletPlacementTargetFromApp
|