@lucern/graph-primitives 1.0.18 → 1.0.20
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 +24 -7
- package/dist/epistemicBeliefs.core.js.map +1 -1
- package/dist/epistemicBeliefs.internal.js +24 -7
- package/dist/epistemicBeliefs.internal.js.map +1 -1
- package/dist/epistemicBeliefs.js +82 -11
- package/dist/epistemicBeliefs.js.map +1 -1
- package/dist/epistemicBeliefs.links.js +58 -4
- package/dist/epistemicBeliefs.links.js.map +1 -1
- package/dist/epistemicBeliefs.topicAnchor.js +24 -6
- package/dist/epistemicBeliefs.topicAnchor.js.map +1 -1
- package/dist/epistemicEdges.helpers.d.ts +1 -1
- package/dist/index.js +90 -19
- package/dist/index.js.map +1 -1
- package/dist/proof-attestation.json +1 -1
- package/package.json +4 -4
|
@@ -4,7 +4,7 @@ import { listAudienceRegistryRows } from '@lucern/access-control/audienceRegistr
|
|
|
4
4
|
import { assertSchemaEnumValue } from '@lucern/contracts/schema-helpers/enumValidation';
|
|
5
5
|
import { permissiveReturn } from '@lucern/contracts/schema-helpers/validators';
|
|
6
6
|
import { componentsGeneric, anyApi, internalQueryGeneric, internalMutationGeneric } from 'convex/server';
|
|
7
|
-
import { generateGlobalId } from '@lucern/contracts/ids';
|
|
7
|
+
import { generateGlobalId, generateUuidV7 } from '@lucern/contracts/ids';
|
|
8
8
|
import { isNodeType, getLayerForNodeType } from '@lucern/contracts/schema-helpers/spine/tables/epistemicNodes';
|
|
9
9
|
import { normalizeTupleContradictionPolicy, confidenceFromSL } from '@lucern/confidence';
|
|
10
10
|
import '@lucern/access-control/access';
|
|
@@ -301,9 +301,16 @@ function scopeFromTopicAnchor(topicNode) {
|
|
|
301
301
|
}
|
|
302
302
|
async function createRequiredBeliefTopicEdge(ctx, args) {
|
|
303
303
|
const topicGlobalId = args.topicNode.globalId;
|
|
304
|
-
const edgeGlobalId = `edge:${args.beliefGlobalId}:${topicGlobalId}:scoped_by`;
|
|
305
304
|
const now = Date.now();
|
|
306
|
-
const
|
|
305
|
+
const existingEdges = await ctx.db.query("epistemicEdges").withIndex(
|
|
306
|
+
"by_from_to",
|
|
307
|
+
(q) => q.eq("fromNodeId", String(args.beliefNodeId)).eq(
|
|
308
|
+
"toNodeId",
|
|
309
|
+
String(args.topicNode._id)
|
|
310
|
+
)
|
|
311
|
+
).collect();
|
|
312
|
+
const existing = existingEdges.find((edge) => edge.edgeType === "belongs_to");
|
|
313
|
+
const edgeGlobalId = cleanString(existing?.globalId) ?? generateUuidV7();
|
|
307
314
|
if (!existing) {
|
|
308
315
|
await ctx.db.insert("epistemicEdges", {
|
|
309
316
|
globalId: edgeGlobalId,
|
|
@@ -311,13 +318,18 @@ async function createRequiredBeliefTopicEdge(ctx, args) {
|
|
|
311
318
|
toNodeId: String(args.topicNode._id),
|
|
312
319
|
sourceGlobalId: args.beliefGlobalId,
|
|
313
320
|
targetGlobalId: topicGlobalId,
|
|
314
|
-
edgeType: "
|
|
321
|
+
edgeType: "belongs_to",
|
|
315
322
|
weight: 1,
|
|
316
323
|
confidence: 1,
|
|
317
324
|
context: "Belief creation topic anchor invariant.",
|
|
318
325
|
reasoningMethod: "implicit",
|
|
319
326
|
derivationType: "topic_scope_invariant",
|
|
320
|
-
metadata: {
|
|
327
|
+
metadata: {
|
|
328
|
+
invariant: "belief.topic_edge_required",
|
|
329
|
+
edgeUuid: edgeGlobalId,
|
|
330
|
+
fromUuid: args.beliefGlobalId,
|
|
331
|
+
toUuid: topicGlobalId
|
|
332
|
+
},
|
|
321
333
|
createdBy: args.createdBy,
|
|
322
334
|
createdAt: now,
|
|
323
335
|
updatedAt: now,
|
|
@@ -335,7 +347,7 @@ async function createRequiredBeliefTopicEdge(ctx, args) {
|
|
|
335
347
|
globalId: edgeGlobalId,
|
|
336
348
|
fromGlobalId: args.beliefGlobalId,
|
|
337
349
|
toGlobalId: topicGlobalId,
|
|
338
|
-
edgeType: "
|
|
350
|
+
edgeType: "belongs_to",
|
|
339
351
|
weight: 1,
|
|
340
352
|
confidence: 1,
|
|
341
353
|
context: "Belief creation topic anchor invariant.",
|
|
@@ -346,7 +358,12 @@ async function createRequiredBeliefTopicEdge(ctx, args) {
|
|
|
346
358
|
toNodeType: "topic",
|
|
347
359
|
fromLayer: "L3",
|
|
348
360
|
toLayer: args.topicNode.epistemicLayer ?? "ontological",
|
|
349
|
-
metadata: {
|
|
361
|
+
metadata: {
|
|
362
|
+
invariant: "belief.topic_edge_required",
|
|
363
|
+
edgeUuid: edgeGlobalId,
|
|
364
|
+
fromUuid: args.beliefGlobalId,
|
|
365
|
+
toUuid: topicGlobalId
|
|
366
|
+
}
|
|
350
367
|
});
|
|
351
368
|
}
|
|
352
369
|
function normalizeScopeValue2(value) {
|