@rolexjs/core 1.5.0-dev-20260309143737 → 1.5.0-dev-20260309145703
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/dist/index.js +33 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2831,6 +2831,38 @@ var sovereignPermissions = [
|
|
|
2831
2831
|
p4("society.dissolve", "dissolve")
|
|
2832
2832
|
];
|
|
2833
2833
|
|
|
2834
|
+
// src/projection.ts
|
|
2835
|
+
var compactRelations = /* @__PURE__ */ new Set([
|
|
2836
|
+
"crowned",
|
|
2837
|
+
"belong",
|
|
2838
|
+
"appointment",
|
|
2839
|
+
"administer",
|
|
2840
|
+
"maintained-by",
|
|
2841
|
+
"own"
|
|
2842
|
+
]);
|
|
2843
|
+
function compact(state) {
|
|
2844
|
+
const { children, links, ...node } = state;
|
|
2845
|
+
return node;
|
|
2846
|
+
}
|
|
2847
|
+
function compactState(state) {
|
|
2848
|
+
const children = state.children?.map((c) => compactState(c));
|
|
2849
|
+
const compactedLinks = state.links?.map(
|
|
2850
|
+
(l) => compactRelations.has(l.relation) ? { ...l, target: compact(l.target) } : { ...l, target: compactLinkedTarget(l.target) }
|
|
2851
|
+
);
|
|
2852
|
+
return {
|
|
2853
|
+
...state,
|
|
2854
|
+
...children ? { children } : {},
|
|
2855
|
+
...compactedLinks ? { links: compactedLinks } : {}
|
|
2856
|
+
};
|
|
2857
|
+
}
|
|
2858
|
+
function compactLinkedTarget(state) {
|
|
2859
|
+
const children = state.children?.map((c) => compactLinkedTarget(c));
|
|
2860
|
+
return {
|
|
2861
|
+
...state,
|
|
2862
|
+
...children ? { children } : {}
|
|
2863
|
+
};
|
|
2864
|
+
}
|
|
2865
|
+
|
|
2834
2866
|
// src/rolex-service.ts
|
|
2835
2867
|
var RoleXService = class _RoleXService {
|
|
2836
2868
|
rt;
|
|
@@ -2870,7 +2902,7 @@ var RoleXService = class _RoleXService {
|
|
|
2870
2902
|
}
|
|
2871
2903
|
async init() {
|
|
2872
2904
|
const originalProject = this.rt.project.bind(this.rt);
|
|
2873
|
-
this.rt.project = async (node) => this.permissions.enrich(await originalProject(node));
|
|
2905
|
+
this.rt.project = async (node) => this.permissions.enrich(compactState(await originalProject(node)));
|
|
2874
2906
|
const roots = await this.rt.roots();
|
|
2875
2907
|
this.society = roots.find((r) => r.name === "society") ?? await this.rt.create(null, society);
|
|
2876
2908
|
const societyState = await this.rt.project(this.society);
|