@lucern/graph-primitives 1.0.32 → 1.0.34

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 CHANGED
@@ -8,9 +8,9 @@ import { canAudienceClassAccess, normalizeAudienceKey, classFromAudienceKey } fr
8
8
  import { getCurrentUserId } from '@lucern/access-control/auth';
9
9
  import { throwStructuredMutationError } from '@lucern/access-control/structuredMutationError';
10
10
  import { isNodeType, getLayerForNodeType } from '@lucern/contracts/schema-helpers/spine/tables/epistemicNodes';
11
+ import { generateUuidV7, generateGlobalId, assertUuidV7Identity, assertStorageEdgeVocabulary, isUuidV7, assertUuidShapedEdgeEndpoint } from '@lucern/contracts/ids';
11
12
  import { assertSchemaEnumValue } from '@lucern/contracts/schema-helpers/enumValidation';
12
13
  import { REASONING_METHODS, assertEdgePolicyAllowed, edgePolicyManifest, EVIDENCE_SOURCE_QUALITY_VALUES, EVIDENCE_METHODOLOGY_VALUES, EVIDENCE_INFORMATION_ASYMMETRY_VALUES } from '@lucern/contracts';
13
- import { generateGlobalId, assertUuidV7Identity, generateUuidV7, assertStorageEdgeVocabulary, isUuidV7, assertUuidShapedEdgeEndpoint } from '@lucern/contracts/ids';
14
14
  import { listAudienceRegistryRows } from '@lucern/access-control/audienceRegistry';
15
15
  import { scoreEntityTypeMatch, scoreEntityConnection, rankEntityTypeMatches, rankEntityConnections } from '@lucern/contracts/v1/ontologies/v1';
16
16
  import { wordTokenize, wordOverlapScore, tokenizeSearchText, tokenOverlapScore, stemToken, scoreLexicalSignals, scoreLexicalSignal, rerankLexicalWindow, rankWindowScore, prepareLexicalQuery, jaccardSimilarity, bigramTokenize } from '@lucern/contracts/text-matching.contract';
@@ -3540,13 +3540,16 @@ var backfillScoredBeliefEdges = internalMutation({
3540
3540
  if (!theme.globalId) {
3541
3541
  continue;
3542
3542
  }
3543
- const edgeGlobalId = `edge-${belief.globalId}-relates_to_thesis-${theme.globalId}`;
3544
- const existing = await ctx.db.query("epistemicEdges").filter((q) => q.eq(q.field("globalId"), edgeGlobalId)).first();
3543
+ const existing = await ctx.db.query("epistemicEdges").withIndex(
3544
+ "by_from_to",
3545
+ (q) => q.eq("fromNodeId", belief.globalId).eq("toNodeId", theme.globalId)
3546
+ ).filter((q) => q.eq(q.field("edgeType"), "relates_to_thesis")).first();
3545
3547
  if (existing) {
3546
3548
  skipped++;
3547
3549
  continue;
3548
3550
  }
3549
3551
  if (!dryRun) {
3552
+ const edgeGlobalId = generateUuidV7();
3550
3553
  await ctx.scheduler.runAfter(0, internal.neo4jEdgeAPI.createEdge, {
3551
3554
  globalId: edgeGlobalId,
3552
3555
  fromGlobalId: belief.globalId,
@@ -4185,7 +4188,7 @@ async function scheduleFirstScoringThemeEdges(ctx, args, node, state) {
4185
4188
  continue;
4186
4189
  }
4187
4190
  await ctx.scheduler.runAfter(0, internal.neo4jEdgeAPI.createEdge, {
4188
- globalId: `edge-${node.globalId}-relates_to_thesis-${theme.globalId}`,
4191
+ globalId: generateUuidV7(),
4189
4192
  fromGlobalId: node.globalId,
4190
4193
  toGlobalId: theme.globalId,
4191
4194
  edgeType: "relates_to_thesis",
@@ -10887,7 +10890,7 @@ var linkEntityToBelief = mutation({
10887
10890
  if (existing && existing.edgeType === effectiveEdgeType) {
10888
10891
  return { edgeId: existing._id, existed: true };
10889
10892
  }
10890
- const globalId = `edge-${effectiveEdgeType}-${fromNodeId}-${toNodeId}-${Date.now()}`;
10893
+ const globalId = generateUuidV7();
10891
10894
  await ctx.scheduler.runAfter(0, internal.neo4jEdgeAPI.createEdge, {
10892
10895
  globalId,
10893
10896
  fromGlobalId,
@@ -24298,10 +24301,10 @@ async function applyOperationalLinkEffects2(ctx, args) {
24298
24301
  if (questionNode && questionNode.nodeType === "question" && evidenceNode && evidenceNode.nodeType === "evidence" && questionNode.globalId && evidenceNode.globalId) {
24299
24302
  const existingEdge = await ctx.db.query("epistemicEdges").withIndex(
24300
24303
  "by_from_to",
24301
- (q) => q.eq("fromNodeId", evidenceNode._id).eq("toNodeId", questionNode._id)
24304
+ (q) => q.eq("fromNodeId", evidenceNode.globalId).eq("toNodeId", questionNode.globalId)
24302
24305
  ).first();
24303
24306
  if (!existingEdge) {
24304
- const globalId = `edge-derived_from-${evidenceNode._id}-${questionNode._id}-${Date.now()}`;
24307
+ const globalId = generateUuidV7();
24305
24308
  await ctx.scheduler.runAfter(0, internal.neo4jEdgeAPI.createEdge, {
24306
24309
  globalId,
24307
24310
  fromGlobalId: evidenceNode.globalId,