@lucern/graph-primitives 1.0.18 → 1.0.19
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 +3 -3
- package/dist/epistemicBeliefs.core.js.map +1 -1
- package/dist/epistemicBeliefs.internal.js +3 -3
- package/dist/epistemicBeliefs.internal.js.map +1 -1
- package/dist/epistemicBeliefs.js +61 -7
- 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 +3 -3
- package/dist/epistemicBeliefs.topicAnchor.js.map +1 -1
- package/dist/epistemicEdges.helpers.d.ts +1 -1
- package/dist/index.js +61 -7
- package/dist/index.js.map +1 -1
- package/dist/proof-attestation.json +1 -1
- package/package.json +4 -4
|
@@ -15,7 +15,7 @@ declare const subjectiveOpinionValidator: convex_values.VObject<{
|
|
|
15
15
|
u: convex_values.VFloat64<number, "required">;
|
|
16
16
|
a: convex_values.VFloat64<number, "required">;
|
|
17
17
|
}, "required", "b" | "d" | "u" | "a">;
|
|
18
|
-
declare const edgeTypeValidator: convex_values.VUnion<"supports" | "informs" | "depends_on" | "derived_from" | "contains" | "tests" | "based_on_belief" | "based_on_question" | "blocked_by_contradiction" | "informed_by_theme" | "works_at" | "invested_in" | "competes_with" | "participates_in" | "founded_by" | "evaluates" | "performs" | "function_in" | "impacts" | "raised_from" | "mentioned_in" | "perspective_on" | "supersedes" | "responds_to" | "belongs_to" | "relates_to_thesis" | "plays_theme" | "contradicts" | "
|
|
18
|
+
declare const edgeTypeValidator: convex_values.VUnion<"supports" | "informs" | "depends_on" | "derived_from" | "contains" | "tests" | "based_on_belief" | "based_on_question" | "blocked_by_contradiction" | "informed_by_theme" | "works_at" | "invested_in" | "competes_with" | "participates_in" | "founded_by" | "evaluates" | "performs" | "function_in" | "impacts" | "raised_from" | "mentioned_in" | "perspective_on" | "supersedes" | "responds_to" | "belongs_to" | "relates_to_thesis" | "plays_theme" | "contradicts" | "prerequisite_for" | "parallel_to" | "corroborates" | "extends" | "same_source_as" | "same_theme_as" | "qualifies" | "explores" | "scoped_by" | "same_as" | "assumes" | "would_predict" | "analogous_to" | "independent_of" | "counterfactual_of" | "cascade_to" | "mutually_exclusive" | "correlates_with" | "amplifies" | "precondition_for" | "in_tension_with" | "cascade_from" | "falsified_by" | "exclusive_with" | "collapses_if" | "strengthened_by" | "weakened_by" | "alternative_to" | "subsumes" | "validated_by" | "required_for" | "blocks", [convex_values.VLiteral<"based_on_belief", "required">, convex_values.VLiteral<"based_on_question", "required">, convex_values.VLiteral<"blocked_by_contradiction", "required">, convex_values.VLiteral<"informed_by_theme", "required">, convex_values.VLiteral<"derived_from", "required">, convex_values.VLiteral<"responds_to", "required">, convex_values.VLiteral<"informs", "required">, convex_values.VLiteral<"tests", "required">, convex_values.VLiteral<"explores", "required">, convex_values.VLiteral<"qualifies", "required">, convex_values.VLiteral<"relates_to_thesis", "required">, convex_values.VLiteral<"belongs_to", "required">, convex_values.VLiteral<"plays_theme", "required">, convex_values.VLiteral<"scoped_by", "required">, convex_values.VLiteral<"evaluates", "required">, convex_values.VLiteral<"perspective_on", "required">, convex_values.VLiteral<"works_at", "required">, convex_values.VLiteral<"mentioned_in", "required">, convex_values.VLiteral<"founded_by", "required">, convex_values.VLiteral<"participates_in", "required">, convex_values.VLiteral<"performs", "required">, convex_values.VLiteral<"function_in", "required">, convex_values.VLiteral<"impacts", "required">, convex_values.VLiteral<"invested_in", "required">, convex_values.VLiteral<"raised_from", "required">, convex_values.VLiteral<"supersedes", "required">, convex_values.VLiteral<"same_as", "required">, convex_values.VLiteral<"depends_on", "required">, convex_values.VLiteral<"supports", "required">, convex_values.VLiteral<"contains", "required">, convex_values.VLiteral<"counterfactual_of", "required">, convex_values.VLiteral<"cascade_to", "required">, convex_values.VLiteral<"cascade_from", "required">, convex_values.VLiteral<"mutually_exclusive", "required">, convex_values.VLiteral<"correlates_with", "required">, convex_values.VLiteral<"amplifies", "required">, convex_values.VLiteral<"precondition_for", "required">, convex_values.VLiteral<"in_tension_with", "required">, convex_values.VLiteral<"falsified_by", "required">, convex_values.VLiteral<"exclusive_with", "required">, convex_values.VLiteral<"contradicts", "required">, convex_values.VLiteral<"collapses_if", "required">, convex_values.VLiteral<"strengthened_by", "required">, convex_values.VLiteral<"weakened_by", "required">, convex_values.VLiteral<"alternative_to", "required">, convex_values.VLiteral<"subsumes", "required">, convex_values.VLiteral<"validated_by", "required">, convex_values.VLiteral<"required_for", "required">, convex_values.VLiteral<"blocks", "required">, convex_values.VLiteral<"prerequisite_for", "required">, convex_values.VLiteral<"parallel_to", "required">, convex_values.VLiteral<"corroborates", "required">, convex_values.VLiteral<"extends", "required">, convex_values.VLiteral<"same_source_as", "required">, convex_values.VLiteral<"same_theme_as", "required">, convex_values.VLiteral<"assumes", "required">, convex_values.VLiteral<"would_predict", "required">, convex_values.VLiteral<"analogous_to", "required">, convex_values.VLiteral<"independent_of", "required">, convex_values.VLiteral<"competes_with", "required">], "required", never>;
|
|
19
19
|
declare function buildEdgeStatusSuccessResult(): EdgeStatusResult;
|
|
20
20
|
declare function buildEdgeNotFoundResult(): EdgeStatusResult;
|
|
21
21
|
declare function buildEdgeMirrorSkippedResult(): EdgeStatusResult;
|
package/dist/index.js
CHANGED
|
@@ -2562,7 +2562,7 @@ function scopeFromTopicAnchor(topicNode) {
|
|
|
2562
2562
|
}
|
|
2563
2563
|
async function createRequiredBeliefTopicEdge(ctx, args) {
|
|
2564
2564
|
const topicGlobalId = args.topicNode.globalId;
|
|
2565
|
-
const edgeGlobalId = `edge:${args.beliefGlobalId}:${topicGlobalId}:
|
|
2565
|
+
const edgeGlobalId = `edge:${args.beliefGlobalId}:${topicGlobalId}:belongs_to`;
|
|
2566
2566
|
const now = Date.now();
|
|
2567
2567
|
const existing = await ctx.db.query("epistemicEdges").withIndex("by_globalId", (q) => q.eq("globalId", edgeGlobalId)).first();
|
|
2568
2568
|
if (!existing) {
|
|
@@ -2572,7 +2572,7 @@ async function createRequiredBeliefTopicEdge(ctx, args) {
|
|
|
2572
2572
|
toNodeId: String(args.topicNode._id),
|
|
2573
2573
|
sourceGlobalId: args.beliefGlobalId,
|
|
2574
2574
|
targetGlobalId: topicGlobalId,
|
|
2575
|
-
edgeType: "
|
|
2575
|
+
edgeType: "belongs_to",
|
|
2576
2576
|
weight: 1,
|
|
2577
2577
|
confidence: 1,
|
|
2578
2578
|
context: "Belief creation topic anchor invariant.",
|
|
@@ -2596,7 +2596,7 @@ async function createRequiredBeliefTopicEdge(ctx, args) {
|
|
|
2596
2596
|
globalId: edgeGlobalId,
|
|
2597
2597
|
fromGlobalId: args.beliefGlobalId,
|
|
2598
2598
|
toGlobalId: topicGlobalId,
|
|
2599
|
-
edgeType: "
|
|
2599
|
+
edgeType: "belongs_to",
|
|
2600
2600
|
weight: 1,
|
|
2601
2601
|
confidence: 1,
|
|
2602
2602
|
context: "Belief creation topic anchor invariant.",
|
|
@@ -4156,6 +4156,39 @@ var getWithEvidence = query({
|
|
|
4156
4156
|
};
|
|
4157
4157
|
}
|
|
4158
4158
|
});
|
|
4159
|
+
async function collectRelationshipNodeRefs(ctx, nodeId) {
|
|
4160
|
+
const refs = /* @__PURE__ */ new Set([String(nodeId)]);
|
|
4161
|
+
const node = await ctx.db.get(nodeId);
|
|
4162
|
+
const globalId = typeof node?.globalId === "string" ? node.globalId.trim() : "";
|
|
4163
|
+
if (globalId.length > 0) {
|
|
4164
|
+
refs.add(globalId);
|
|
4165
|
+
}
|
|
4166
|
+
return [...refs];
|
|
4167
|
+
}
|
|
4168
|
+
function endpointMatches(q, fields, refs) {
|
|
4169
|
+
return q.or(
|
|
4170
|
+
...fields.flatMap(
|
|
4171
|
+
(field) => refs.map((ref) => q.eq(q.field(field), ref))
|
|
4172
|
+
)
|
|
4173
|
+
);
|
|
4174
|
+
}
|
|
4175
|
+
async function resolveRelationshipEndpoint(ctx, endpointId, globalEndpointId) {
|
|
4176
|
+
const candidates = [endpointId, globalEndpointId].map((value) => typeof value === "string" ? value.trim() : "").filter((value, index, values) => value.length > 0 && values.indexOf(value) === index);
|
|
4177
|
+
for (const candidate of candidates) {
|
|
4178
|
+
try {
|
|
4179
|
+
const direct = await ctx.db.get(candidate);
|
|
4180
|
+
if (direct) {
|
|
4181
|
+
return direct;
|
|
4182
|
+
}
|
|
4183
|
+
} catch {
|
|
4184
|
+
}
|
|
4185
|
+
const byGlobalId = await ctx.db.query("epistemicNodes").withIndex("by_globalId", (q) => q.eq("globalId", candidate)).first();
|
|
4186
|
+
if (byGlobalId) {
|
|
4187
|
+
return byGlobalId;
|
|
4188
|
+
}
|
|
4189
|
+
}
|
|
4190
|
+
return null;
|
|
4191
|
+
}
|
|
4159
4192
|
var getRelationships = query({
|
|
4160
4193
|
args: {
|
|
4161
4194
|
nodeId: v.id("epistemicNodes"),
|
|
@@ -4170,17 +4203,38 @@ var getRelationships = query({
|
|
|
4170
4203
|
incoming: [],
|
|
4171
4204
|
outgoing: []
|
|
4172
4205
|
};
|
|
4206
|
+
const nodeRefs = await collectRelationshipNodeRefs(ctx, args.nodeId);
|
|
4173
4207
|
if (direction === "in" || direction === "both") {
|
|
4174
|
-
const inEdges = await ctx.db.query("epistemicEdges").filter(
|
|
4208
|
+
const inEdges = await ctx.db.query("epistemicEdges").filter(
|
|
4209
|
+
(q) => endpointMatches(
|
|
4210
|
+
q,
|
|
4211
|
+
["toNodeId", "targetGlobalId", "toGlobalId", "toUuid"],
|
|
4212
|
+
nodeRefs
|
|
4213
|
+
)
|
|
4214
|
+
).collect();
|
|
4175
4215
|
for (const edge of inEdges) {
|
|
4176
|
-
const sourceNode = await
|
|
4216
|
+
const sourceNode = await resolveRelationshipEndpoint(
|
|
4217
|
+
ctx,
|
|
4218
|
+
edge.fromNodeId,
|
|
4219
|
+
edge.sourceGlobalId ?? edge.fromGlobalId ?? edge.fromUuid
|
|
4220
|
+
);
|
|
4177
4221
|
results.incoming.push({ edge, node: sourceNode });
|
|
4178
4222
|
}
|
|
4179
4223
|
}
|
|
4180
4224
|
if (direction === "out" || direction === "both") {
|
|
4181
|
-
const outEdges = await ctx.db.query("epistemicEdges").filter(
|
|
4225
|
+
const outEdges = await ctx.db.query("epistemicEdges").filter(
|
|
4226
|
+
(q) => endpointMatches(
|
|
4227
|
+
q,
|
|
4228
|
+
["fromNodeId", "sourceGlobalId", "fromGlobalId", "fromUuid"],
|
|
4229
|
+
nodeRefs
|
|
4230
|
+
)
|
|
4231
|
+
).collect();
|
|
4182
4232
|
for (const edge of outEdges) {
|
|
4183
|
-
const targetNode =
|
|
4233
|
+
const targetNode = await resolveRelationshipEndpoint(
|
|
4234
|
+
ctx,
|
|
4235
|
+
edge.toNodeId,
|
|
4236
|
+
edge.targetGlobalId ?? edge.toGlobalId ?? edge.toUuid
|
|
4237
|
+
);
|
|
4184
4238
|
results.outgoing.push({ edge, node: targetNode });
|
|
4185
4239
|
}
|
|
4186
4240
|
}
|