@lucern/graph-primitives 1.0.19 → 1.0.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/dist/epistemicBeliefs.core.js +22 -5
- package/dist/epistemicBeliefs.core.js.map +1 -1
- package/dist/epistemicBeliefs.internal.js +22 -5
- package/dist/epistemicBeliefs.internal.js.map +1 -1
- package/dist/epistemicBeliefs.js +22 -5
- package/dist/epistemicBeliefs.js.map +1 -1
- package/dist/epistemicBeliefs.topicAnchor.js +22 -4
- package/dist/epistemicBeliefs.topicAnchor.js.map +1 -1
- package/dist/index.js +30 -13
- package/dist/index.js.map +1 -1
- package/dist/proof-attestation.json +1 -1
- package/package.json +4 -4
|
@@ -7,7 +7,7 @@ import { normalizeTupleContradictionPolicy, createInheritedContractRecord, confi
|
|
|
7
7
|
import '@lucern/access-control/audience';
|
|
8
8
|
import { getCurrentUserId } from '@lucern/access-control/auth';
|
|
9
9
|
import { isNodeType, getLayerForNodeType } from '@lucern/contracts/schema-helpers/spine/tables/epistemicNodes';
|
|
10
|
-
import { generateGlobalId } from '@lucern/contracts/ids';
|
|
10
|
+
import { generateGlobalId, generateUuidV7 } from '@lucern/contracts/ids';
|
|
11
11
|
|
|
12
12
|
// src/epistemicBeliefs.core.ts
|
|
13
13
|
|
|
@@ -1071,9 +1071,16 @@ function scopeFromTopicAnchor(topicNode) {
|
|
|
1071
1071
|
}
|
|
1072
1072
|
async function createRequiredBeliefTopicEdge(ctx, args) {
|
|
1073
1073
|
const topicGlobalId = args.topicNode.globalId;
|
|
1074
|
-
const edgeGlobalId = `edge:${args.beliefGlobalId}:${topicGlobalId}:belongs_to`;
|
|
1075
1074
|
const now = Date.now();
|
|
1076
|
-
const
|
|
1075
|
+
const existingEdges = await ctx.db.query("epistemicEdges").withIndex(
|
|
1076
|
+
"by_from_to",
|
|
1077
|
+
(q) => q.eq("fromNodeId", String(args.beliefNodeId)).eq(
|
|
1078
|
+
"toNodeId",
|
|
1079
|
+
String(args.topicNode._id)
|
|
1080
|
+
)
|
|
1081
|
+
).collect();
|
|
1082
|
+
const existing = existingEdges.find((edge) => edge.edgeType === "belongs_to");
|
|
1083
|
+
const edgeGlobalId = cleanString(existing?.globalId) ?? generateUuidV7();
|
|
1077
1084
|
if (!existing) {
|
|
1078
1085
|
await ctx.db.insert("epistemicEdges", {
|
|
1079
1086
|
globalId: edgeGlobalId,
|
|
@@ -1087,7 +1094,12 @@ async function createRequiredBeliefTopicEdge(ctx, args) {
|
|
|
1087
1094
|
context: "Belief creation topic anchor invariant.",
|
|
1088
1095
|
reasoningMethod: "implicit",
|
|
1089
1096
|
derivationType: "topic_scope_invariant",
|
|
1090
|
-
metadata: {
|
|
1097
|
+
metadata: {
|
|
1098
|
+
invariant: "belief.topic_edge_required",
|
|
1099
|
+
edgeUuid: edgeGlobalId,
|
|
1100
|
+
fromUuid: args.beliefGlobalId,
|
|
1101
|
+
toUuid: topicGlobalId
|
|
1102
|
+
},
|
|
1091
1103
|
createdBy: args.createdBy,
|
|
1092
1104
|
createdAt: now,
|
|
1093
1105
|
updatedAt: now,
|
|
@@ -1116,7 +1128,12 @@ async function createRequiredBeliefTopicEdge(ctx, args) {
|
|
|
1116
1128
|
toNodeType: "topic",
|
|
1117
1129
|
fromLayer: "L3",
|
|
1118
1130
|
toLayer: args.topicNode.epistemicLayer ?? "ontological",
|
|
1119
|
-
metadata: {
|
|
1131
|
+
metadata: {
|
|
1132
|
+
invariant: "belief.topic_edge_required",
|
|
1133
|
+
edgeUuid: edgeGlobalId,
|
|
1134
|
+
fromUuid: args.beliefGlobalId,
|
|
1135
|
+
toUuid: topicGlobalId
|
|
1136
|
+
}
|
|
1120
1137
|
});
|
|
1121
1138
|
}
|
|
1122
1139
|
|