@lucern/graph-primitives 1.0.29 → 1.0.30
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/{beliefDecay-DZ6tkLYq.d.ts → beliefDecay-BmkEk5OJ.d.ts} +3 -3
- package/dist/beliefDecay.d.ts +1 -1
- package/dist/beliefDecay.js +448 -314
- package/dist/beliefDecay.js.map +1 -1
- package/dist/{beliefEvidenceLinks-CWOXxxJg.d.ts → beliefEvidenceLinks-BzfjON_6.d.ts} +13 -13
- package/dist/beliefEvidenceLinks.d.ts +1 -1
- package/dist/beliefEvidenceLinks.js +843 -624
- package/dist/beliefEvidenceLinks.js.map +1 -1
- package/dist/beliefEvidenceLinks.operational.d.ts +7 -5
- package/dist/beliefEvidenceLinks.operational.js +91 -18
- package/dist/beliefEvidenceLinks.operational.js.map +1 -1
- package/dist/beliefLifecycle.js.map +1 -1
- package/dist/confidencePropagationDispatch.d.ts +28 -27
- package/dist/confidencePropagationDispatch.js +157 -99
- package/dist/confidencePropagationDispatch.js.map +1 -1
- package/dist/{contradictions-51VLsESq.d.ts → contradictions-BATPuZTL.d.ts} +10 -10
- package/dist/contradictions.d.ts +1 -1
- package/dist/contradictions.js +395 -225
- package/dist/contradictions.js.map +1 -1
- package/dist/convex.d.ts +65 -30
- package/dist/convex.js +7 -3
- package/dist/convex.js.map +1 -1
- package/dist/debug.js.map +1 -1
- package/dist/edgeValidation.js +293 -85
- package/dist/edgeValidation.js.map +1 -1
- package/dist/edges/contains.d.ts +1 -1
- package/dist/edges/contains.js.map +1 -1
- package/dist/edges/contradicts.d.ts +1 -1
- package/dist/edges/contradicts.js.map +1 -1
- package/dist/edges/{dependsOn.d.ts → depends-on.d.ts} +1 -1
- package/dist/edges/{dependsOn.js → depends-on.js} +4 -4
- package/dist/edges/depends-on.js.map +1 -0
- package/dist/edges/{derivedFrom.d.ts → derived-from.d.ts} +1 -1
- package/dist/edges/{derivedFrom.js → derived-from.js} +3 -3
- package/dist/edges/derived-from.js.map +1 -0
- package/dist/edges/elaborates.d.ts +1 -1
- package/dist/edges/elaborates.js.map +1 -1
- package/dist/edges/index.d.ts +7 -3
- package/dist/edges/index.js +7 -4
- package/dist/edges/index.js.map +1 -1
- package/dist/edges/informs.d.ts +1 -1
- package/dist/edges/informs.js.map +1 -1
- package/dist/edges/{propagationTypes.d.ts → propagation-types.d.ts} +14 -14
- package/dist/edges/{propagationTypes.js → propagation-types.js} +3 -3
- package/dist/edges/propagation-types.js.map +1 -0
- package/dist/edges/refutes.d.ts +1 -1
- package/dist/edges/refutes.js.map +1 -1
- package/dist/edges/supports.d.ts +1 -1
- package/dist/edges/supports.js.map +1 -1
- package/dist/edges/tests.d.ts +1 -1
- package/dist/edges/tests.js.map +1 -1
- package/dist/edges/utils.d.ts +1 -1
- package/dist/edges/utils.js.map +1 -1
- package/dist/embeddingTrigger.d.ts +14 -6
- package/dist/embeddingTrigger.js +11 -14
- package/dist/embeddingTrigger.js.map +1 -1
- package/dist/{entityBridge-DMaKooYn.d.ts → entityBridge-BhVDM3pc.d.ts} +5 -5
- package/dist/entityBridge.d.ts +1 -1
- package/dist/entityBridge.js +602 -225
- package/dist/entityBridge.js.map +1 -1
- package/dist/entityCanonicalMatch.d.ts +14 -12
- package/dist/entityCanonicalMatch.js.map +1 -1
- package/dist/{entityLifecycle-CvgSK5FV.d.ts → entityLifecycle-BsfCz9pS.d.ts} +5 -9
- package/dist/entityLifecycle.d.ts +1 -1
- package/dist/entityLifecycle.js +854 -480
- package/dist/entityLifecycle.js.map +1 -1
- package/dist/{entityValidation-KLZ_Xl2D.d.ts → entityValidation-B1yNEHJx.d.ts} +7 -6
- package/dist/entityValidation.d.ts +3 -1
- package/dist/entityValidation.js +60 -8
- package/dist/entityValidation.js.map +1 -1
- package/dist/{epistemicAnswers-C5ib4z6_.d.ts → epistemicAnswers-f47YMu9U.d.ts} +6 -6
- package/dist/epistemicAnswers.d.ts +1 -1
- package/dist/epistemicAnswers.js +587 -545
- package/dist/epistemicAnswers.js.map +1 -1
- package/dist/epistemicBeliefs.admin.d.ts +8 -8
- package/dist/epistemicBeliefs.admin.js +365 -166
- package/dist/epistemicBeliefs.admin.js.map +1 -1
- package/dist/epistemicBeliefs.backfills.d.ts +8 -8
- package/dist/epistemicBeliefs.backfills.js +655 -289
- package/dist/epistemicBeliefs.backfills.js.map +1 -1
- package/dist/epistemicBeliefs.confidence.d.ts +19 -15
- package/dist/epistemicBeliefs.confidence.js +633 -386
- package/dist/epistemicBeliefs.confidence.js.map +1 -1
- package/dist/epistemicBeliefs.core.d.ts +6 -6
- package/dist/epistemicBeliefs.core.js +717 -371
- package/dist/epistemicBeliefs.core.js.map +1 -1
- package/dist/epistemicBeliefs.d.ts +11 -9
- package/dist/epistemicBeliefs.forkEvidence.d.ts +2 -0
- package/dist/epistemicBeliefs.forkEvidence.js +8 -8
- package/dist/epistemicBeliefs.forkEvidence.js.map +1 -1
- package/dist/epistemicBeliefs.helpers.d.ts +68 -49
- package/dist/epistemicBeliefs.helpers.js +358 -211
- package/dist/epistemicBeliefs.helpers.js.map +1 -1
- package/dist/epistemicBeliefs.internal.d.ts +5 -5
- package/dist/epistemicBeliefs.internal.js +1248 -1026
- package/dist/epistemicBeliefs.internal.js.map +1 -1
- package/dist/epistemicBeliefs.js +4942 -3590
- package/dist/epistemicBeliefs.js.map +1 -1
- package/dist/epistemicBeliefs.lifecycle.d.ts +5 -5
- package/dist/epistemicBeliefs.lifecycle.js +1138 -781
- package/dist/epistemicBeliefs.lifecycle.js.map +1 -1
- package/dist/epistemicBeliefs.links.d.ts +7 -7
- package/dist/epistemicBeliefs.links.js +404 -267
- package/dist/epistemicBeliefs.links.js.map +1 -1
- package/dist/epistemicBeliefs.queries.d.ts +4 -4
- package/dist/epistemicBeliefs.queries.js +175 -20
- package/dist/epistemicBeliefs.queries.js.map +1 -1
- package/dist/epistemicBeliefs.topicAnchor.d.ts +6 -4
- package/dist/epistemicBeliefs.topicAnchor.js +12 -5
- package/dist/epistemicBeliefs.topicAnchor.js.map +1 -1
- package/dist/epistemicContracts.d.ts +28 -3
- package/dist/epistemicContracts.evaluators.d.ts +2 -0
- package/dist/epistemicContracts.evaluators.js +1062 -576
- package/dist/epistemicContracts.evaluators.js.map +1 -1
- package/dist/epistemicContracts.handlers.d.ts +15 -32
- package/dist/epistemicContracts.handlers.js +1829 -1351
- package/dist/epistemicContracts.handlers.js.map +1 -1
- package/dist/epistemicContracts.js +1131 -636
- package/dist/epistemicContracts.js.map +1 -1
- package/dist/epistemicContracts.metrics.d.ts +2 -0
- package/dist/epistemicContracts.metrics.js +375 -158
- package/dist/epistemicContracts.metrics.js.map +1 -1
- package/dist/epistemicContracts.types.d.ts +87 -81
- package/dist/epistemicEdgeCreation.d.ts +2 -0
- package/dist/epistemicEdgeCreation.js +87 -16
- package/dist/epistemicEdgeCreation.js.map +1 -1
- package/dist/{epistemicEdges-BF-cn4i3.d.ts → epistemicEdges-BGBh0QSP.d.ts} +4 -7
- package/dist/epistemicEdges.d.ts +6 -5
- package/dist/epistemicEdges.handlers.d.ts +3 -3
- package/dist/epistemicEdges.handlers.js +129 -24
- package/dist/epistemicEdges.handlers.js.map +1 -1
- package/dist/epistemicEdges.helpers.d.ts +6 -4
- package/dist/epistemicEdges.helpers.js +37 -2
- package/dist/epistemicEdges.helpers.js.map +1 -1
- package/dist/epistemicEdges.js +1966 -1202
- package/dist/epistemicEdges.js.map +1 -1
- package/dist/epistemicEdges.mutations.d.ts +7 -7
- package/dist/epistemicEdges.mutations.js +956 -579
- package/dist/epistemicEdges.mutations.js.map +1 -1
- package/dist/epistemicEdges.queries.d.ts +16 -16
- package/dist/epistemicEdges.queries.js +639 -367
- package/dist/epistemicEdges.queries.js.map +1 -1
- package/dist/epistemicEdges.types.d.ts +10 -8
- package/dist/epistemicEvidence.d.ts +4 -1
- package/dist/epistemicEvidence.js +933 -532
- package/dist/epistemicEvidence.js.map +1 -1
- package/dist/epistemicEvidenceHelpers.d.ts +26 -10
- package/dist/epistemicEvidenceHelpers.js +239 -200
- package/dist/epistemicEvidenceHelpers.js.map +1 -1
- package/dist/epistemicEvidenceMutations.d.ts +8 -8
- package/dist/epistemicEvidenceMutations.js +840 -692
- package/dist/epistemicEvidenceMutations.js.map +1 -1
- package/dist/epistemicEvidenceQueries.d.ts +8 -8
- package/dist/epistemicEvidenceQueries.js +514 -238
- package/dist/epistemicEvidenceQueries.js.map +1 -1
- package/dist/epistemicHelpers.d.ts +4 -2
- package/dist/epistemicHelpers.js +308 -134
- package/dist/epistemicHelpers.js.map +1 -1
- package/dist/epistemicInsert.d.ts +16 -4
- package/dist/epistemicInsert.js +6 -3
- package/dist/epistemicInsert.js.map +1 -1
- package/dist/epistemicLayerRules.d.ts +10 -8
- package/dist/epistemicLayerRules.js +1 -5
- package/dist/epistemicLayerRules.js.map +1 -1
- package/dist/{epistemicLinking-CfE00tHJ.d.ts → epistemicLinking-CsCDv2cN.d.ts} +3 -3
- package/dist/epistemicLinking.d.ts +1 -1
- package/dist/epistemicLinking.js +177 -100
- package/dist/epistemicLinking.js.map +1 -1
- package/dist/epistemicNodeCreation.d.ts +2 -0
- package/dist/epistemicNodeCreation.js +203 -40
- package/dist/epistemicNodeCreation.js.map +1 -1
- package/dist/{epistemicNodes-BCQxpYx_.d.ts → epistemicNodes-CokAgBHg.d.ts} +3 -3
- package/dist/epistemicNodes.d.ts +3 -3
- package/dist/epistemicNodes.helpers.d.ts +24 -15
- package/dist/epistemicNodes.helpers.js.map +1 -1
- package/dist/epistemicNodes.internal.d.ts +6 -6
- package/dist/epistemicNodes.internal.js +389 -319
- package/dist/epistemicNodes.internal.js.map +1 -1
- package/dist/epistemicNodes.js +700 -504
- package/dist/epistemicNodes.js.map +1 -1
- package/dist/epistemicNodes.mutations.d.ts +6 -6
- package/dist/epistemicNodes.mutations.js +560 -463
- package/dist/epistemicNodes.mutations.js.map +1 -1
- package/dist/epistemicNodes.queries.d.ts +8 -8
- package/dist/epistemicNodes.queries.js +311 -314
- package/dist/epistemicNodes.queries.js.map +1 -1
- package/dist/epistemicNodes.validators.d.ts +2 -2
- package/dist/epistemicNodes.validators.js.map +1 -1
- package/dist/epistemicQuestions.conviction.d.ts +8 -8
- package/dist/epistemicQuestions.conviction.js +665 -484
- package/dist/epistemicQuestions.conviction.js.map +1 -1
- package/dist/epistemicQuestions.create.d.ts +4 -4
- package/dist/epistemicQuestions.create.js +640 -612
- package/dist/epistemicQuestions.create.js.map +1 -1
- package/dist/epistemicQuestions.d.ts +8 -5
- package/dist/epistemicQuestions.evidence.d.ts +2 -2
- package/dist/epistemicQuestions.evidence.js +475 -383
- package/dist/epistemicQuestions.evidence.js.map +1 -1
- package/dist/epistemicQuestions.helpers.d.ts +125 -24
- package/dist/epistemicQuestions.helpers.js +240 -209
- package/dist/epistemicQuestions.helpers.js.map +1 -1
- package/dist/epistemicQuestions.js +3474 -2823
- package/dist/epistemicQuestions.js.map +1 -1
- package/dist/epistemicQuestions.lifecycle.d.ts +2 -2
- package/dist/epistemicQuestions.lifecycle.js +607 -546
- package/dist/epistemicQuestions.lifecycle.js.map +1 -1
- package/dist/epistemicQuestions.queries.d.ts +12 -7
- package/dist/epistemicQuestions.queries.js +305 -244
- package/dist/epistemicQuestions.queries.js.map +1 -1
- package/dist/epistemicQuestions.sprint.d.ts +2 -2
- package/dist/epistemicQuestions.sprint.js +600 -394
- package/dist/epistemicQuestions.sprint.js.map +1 -1
- package/dist/epistemicQuestions.tail.d.ts +6 -6
- package/dist/epistemicQuestions.tail.js +572 -433
- package/dist/epistemicQuestions.tail.js.map +1 -1
- package/dist/{epistemicSources-dlKj58Jp.d.ts → epistemicSources-DQtaEkWs.d.ts} +4 -4
- package/dist/epistemicSources.d.ts +1 -1
- package/dist/epistemicSources.js +351 -311
- package/dist/epistemicSources.js.map +1 -1
- package/dist/evaluators/index.d.ts +8 -6
- package/dist/evaluators/index.js +399 -167
- package/dist/evaluators/index.js.map +1 -1
- package/dist/evaluators/lint-checker-evaluator.d.ts +16 -0
- package/dist/evaluators/{lintCheckerEvaluator.js → lint-checker-evaluator.js} +10 -5
- package/dist/evaluators/lint-checker-evaluator.js.map +1 -0
- package/dist/evaluators/{sentryCheckerEvaluator.d.ts → sentry-checker-evaluator.d.ts} +7 -2
- package/dist/evaluators/{sentryCheckerEvaluator.js → sentry-checker-evaluator.js} +3 -3
- package/dist/evaluators/sentry-checker-evaluator.js.map +1 -0
- package/dist/evaluators/shared.d.ts +2 -2
- package/dist/evaluators/shared.js +3 -1
- package/dist/evaluators/shared.js.map +1 -1
- package/dist/evaluators/{testRunnerEvaluator.d.ts → test-runner-evaluator.d.ts} +6 -1
- package/dist/evaluators/{testRunnerEvaluator.js → test-runner-evaluator.js} +6 -4
- package/dist/evaluators/test-runner-evaluator.js.map +1 -0
- package/dist/evaluators/tsc-checker-evaluator.d.ts +16 -0
- package/dist/evaluators/{tscCheckerEvaluator.js → tsc-checker-evaluator.js} +10 -5
- package/dist/evaluators/tsc-checker-evaluator.js.map +1 -0
- package/dist/graphTypes.js +6 -2
- package/dist/graphTypes.js.map +1 -1
- package/dist/helpers.d.ts +2 -0
- package/dist/helpers.js +313 -93
- package/dist/helpers.js.map +1 -1
- package/dist/{index-C-Kyd7hD.d.ts → index-DZxyC9Pb.d.ts} +7 -6
- package/dist/index.d.ts +86 -83
- package/dist/index.js +16914 -11760
- package/dist/index.js.map +1 -1
- package/dist/invariantEnforcement.d.ts +3 -3
- package/dist/invariantEnforcement.js.map +1 -1
- package/dist/logicalRoleInference.d.ts +2 -0
- package/dist/logicalRoleInference.js +1 -1
- package/dist/logicalRoleInference.js.map +1 -1
- package/dist/matcherFeedbackUtils.d.ts +2 -2
- package/dist/matcherFeedbackUtils.js.map +1 -1
- package/dist/{ontology-matching-C6rrz2VP.d.ts → ontology-matching-C-mYFrir.d.ts} +16 -16
- package/dist/ontology-matching.d.ts +1 -1
- package/dist/{ontologyApproval-CFYmqKmk.d.ts → ontologyApproval-BVt0feJi.d.ts} +10 -10
- package/dist/ontologyApproval.d.ts +1 -1
- package/dist/ontologyApproval.js +7 -1
- package/dist/ontologyApproval.js.map +1 -1
- package/dist/ontologyDefinitions.d.ts +14 -24
- package/dist/ontologyDefinitions.js +269 -34
- package/dist/ontologyDefinitions.js.map +1 -1
- package/dist/ontologyHelpers.d.ts +13 -13
- package/dist/ontologyHelpers.js.map +1 -1
- package/dist/{ontologyRegistry-B67rPJ16.d.ts → ontologyRegistry-CljS-ENv.d.ts} +2 -2
- package/dist/ontologyRegistry.d.ts +1 -1
- package/dist/ontologyRegistry.js +34 -6
- package/dist/ontologyRegistry.js.map +1 -1
- package/dist/{projectionReconciliation-jww2fBI0.d.ts → projectionReconciliation-DnrSgHSQ.d.ts} +4 -4
- package/dist/projectionReconciliation.d.ts +1 -1
- package/dist/projectionReconciliation.js +57 -10
- package/dist/projectionReconciliation.js.map +1 -1
- package/dist/{projectionStaleness-CmdbpjVK.d.ts → projectionStaleness-C8ImQ2zP.d.ts} +17 -17
- package/dist/projectionStaleness.d.ts +1 -1
- package/dist/projectionStaleness.js +8 -2
- package/dist/projectionStaleness.js.map +1 -1
- package/dist/proof-attestation.json +1 -1
- package/dist/{questionEvidenceLinks-DFlyPpAj.d.ts → questionEvidenceLinks-_nPRa-LY.d.ts} +10 -10
- package/dist/questionEvidenceLinks.d.ts +1 -1
- package/dist/questionEvidenceLinks.js +564 -347
- package/dist/questionEvidenceLinks.js.map +1 -1
- package/dist/{resolverTypes-CC8Ea2E2.d.ts → resolverTypes-BOXPxLET.d.ts} +8 -7
- package/dist/resolverTypes.d.ts +4 -2
- package/dist/{resolvers-Br1a6eLV.d.ts → resolvers-B1TIBmRO.d.ts} +3 -1
- package/dist/resolvers.d.ts +5 -3
- package/dist/resolvers.js +121 -77
- package/dist/resolvers.js.map +1 -1
- package/dist/scopeResolverCompat.d.ts +10 -7
- package/dist/scopeResolverCompat.js +106 -123
- package/dist/scopeResolverCompat.js.map +1 -1
- package/dist/{text-matching-DNg4M5Wd.d.ts → text-matching-DzFooju6.d.ts} +7 -7
- package/dist/text-matching.d.ts +1 -1
- package/dist/topicOntologyResolver.d.ts +22 -21
- package/dist/topicOntologyResolver.js +54 -32
- package/dist/topicOntologyResolver.js.map +1 -1
- package/dist/topicProjectOverlay.d.ts +30 -20
- package/dist/topicProjectOverlay.js +120 -76
- package/dist/topicProjectOverlay.js.map +1 -1
- package/dist/{topicScope-7zhyeGl7.d.ts → topicScope-DJVa0mLa.d.ts} +22 -7
- package/dist/topicScope.d.ts +3 -1
- package/dist/topicScope.js +104 -119
- package/dist/topicScope.js.map +1 -1
- package/dist/workflowBridge.d.ts +26 -15
- package/dist/workflowBridge.js +140 -144
- package/dist/workflowBridge.js.map +1 -1
- package/dist/workspaceIsolation.d.ts +14 -12
- package/dist/workspaceIsolation.js +108 -122
- package/dist/workspaceIsolation.js.map +1 -1
- package/package.json +4 -4
- package/dist/edges/dependsOn.js.map +0 -1
- package/dist/edges/derivedFrom.js.map +0 -1
- package/dist/edges/propagationTypes.js.map +0 -1
- package/dist/evaluators/lintCheckerEvaluator.d.ts +0 -11
- package/dist/evaluators/lintCheckerEvaluator.js.map +0 -1
- package/dist/evaluators/sentryCheckerEvaluator.js.map +0 -1
- package/dist/evaluators/testRunnerEvaluator.js.map +0 -1
- package/dist/evaluators/tscCheckerEvaluator.d.ts +0 -11
- package/dist/evaluators/tscCheckerEvaluator.js.map +0 -1
- package/dist/{epistemicQuestions-bwHd2FWE.d.ts → epistemicQuestions-Do1fhYm5.d.ts} +4 -4
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { v } from 'convex/values';
|
|
2
1
|
import { getCurrentUserId } from '@lucern/access-control/auth';
|
|
3
2
|
import { permissiveReturn } from '@lucern/contracts/schema-helpers/validators';
|
|
3
|
+
import { v } from 'convex/values';
|
|
4
|
+
import { unsafeConvexAnyApi } from '@lucern/contracts/convex/unsafeAnyApi';
|
|
4
5
|
import { componentsGeneric, queryGeneric, mutationGeneric } from 'convex/server';
|
|
5
6
|
|
|
6
7
|
// src/ontologyDefinitions.ts
|
|
8
|
+
unsafeConvexAnyApi(
|
|
9
|
+
"graph-primitives top-level module bundle lacks a committed Convex _generated/api surface"
|
|
10
|
+
);
|
|
7
11
|
componentsGeneric();
|
|
8
12
|
var mutation = mutationGeneric;
|
|
9
13
|
var query = queryGeneric;
|
|
@@ -69,6 +73,211 @@ async function requireAuth(ctx) {
|
|
|
69
73
|
}
|
|
70
74
|
return userId;
|
|
71
75
|
}
|
|
76
|
+
function isRecord(value) {
|
|
77
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
78
|
+
}
|
|
79
|
+
function rowFieldError(context, fieldName) {
|
|
80
|
+
return new Error(`${context} has invalid or missing ${fieldName}.`);
|
|
81
|
+
}
|
|
82
|
+
function readRequiredString(row, fieldName, context) {
|
|
83
|
+
const value = row[fieldName];
|
|
84
|
+
if (typeof value !== "string") {
|
|
85
|
+
throw rowFieldError(context, fieldName);
|
|
86
|
+
}
|
|
87
|
+
return value;
|
|
88
|
+
}
|
|
89
|
+
function readOptionalString(row, fieldName, context) {
|
|
90
|
+
const value = row[fieldName];
|
|
91
|
+
if (value === void 0) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (typeof value !== "string") {
|
|
95
|
+
throw rowFieldError(context, fieldName);
|
|
96
|
+
}
|
|
97
|
+
return value;
|
|
98
|
+
}
|
|
99
|
+
function readRequiredNumber(row, fieldName, context) {
|
|
100
|
+
const value = row[fieldName];
|
|
101
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
102
|
+
throw rowFieldError(context, fieldName);
|
|
103
|
+
}
|
|
104
|
+
return value;
|
|
105
|
+
}
|
|
106
|
+
function readOptionalNumber(row, fieldName, context) {
|
|
107
|
+
const value = row[fieldName];
|
|
108
|
+
if (value === void 0) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
112
|
+
throw rowFieldError(context, fieldName);
|
|
113
|
+
}
|
|
114
|
+
return value;
|
|
115
|
+
}
|
|
116
|
+
function readRequiredId(row, fieldName, context) {
|
|
117
|
+
return readRequiredString(row, fieldName, context);
|
|
118
|
+
}
|
|
119
|
+
function readOptionalId(row, fieldName, context) {
|
|
120
|
+
const value = readOptionalString(row, fieldName, context);
|
|
121
|
+
return value;
|
|
122
|
+
}
|
|
123
|
+
function readStringArray(value, context) {
|
|
124
|
+
if (value === void 0) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (!(Array.isArray(value) && value.every((item) => typeof item === "string"))) {
|
|
128
|
+
throw new Error(`${context} must be an array of strings.`);
|
|
129
|
+
}
|
|
130
|
+
return value;
|
|
131
|
+
}
|
|
132
|
+
function readEntitySubtype(value, context) {
|
|
133
|
+
if (!isRecord(value)) {
|
|
134
|
+
throw new Error(`${context} must be an object.`);
|
|
135
|
+
}
|
|
136
|
+
const description = readOptionalString(value, "description", context);
|
|
137
|
+
return {
|
|
138
|
+
...description === void 0 ? {} : { description },
|
|
139
|
+
label: readRequiredString(value, "label", context),
|
|
140
|
+
value: readRequiredString(value, "value", context)
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function readEntityTypeEntry(value, context) {
|
|
144
|
+
if (!isRecord(value)) {
|
|
145
|
+
throw new Error(`${context} must be an object.`);
|
|
146
|
+
}
|
|
147
|
+
const description = readOptionalString(value, "description", context);
|
|
148
|
+
const subtypesValue = value.subtypes;
|
|
149
|
+
let subtypes;
|
|
150
|
+
if (subtypesValue !== void 0) {
|
|
151
|
+
if (!Array.isArray(subtypesValue)) {
|
|
152
|
+
throw rowFieldError(context, "subtypes");
|
|
153
|
+
}
|
|
154
|
+
subtypes = subtypesValue.map(
|
|
155
|
+
(subtype, index) => readEntitySubtype(subtype, `${context}.subtypes[${index}]`)
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
return {
|
|
159
|
+
...description === void 0 ? {} : { description },
|
|
160
|
+
...value.schema === void 0 ? {} : { schema: value.schema },
|
|
161
|
+
...subtypes === void 0 ? {} : { subtypes },
|
|
162
|
+
label: readRequiredString(value, "label", context),
|
|
163
|
+
value: readRequiredString(value, "value", context)
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
function readEntityTypeEntries(value, context) {
|
|
167
|
+
if (!Array.isArray(value)) {
|
|
168
|
+
throw rowFieldError(context, "entityTypes");
|
|
169
|
+
}
|
|
170
|
+
return value.map(
|
|
171
|
+
(entry, index) => readEntityTypeEntry(entry, `${context}.entityTypes[${index}]`)
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
function readEdgeTypeEntry(value, context) {
|
|
175
|
+
if (!isRecord(value)) {
|
|
176
|
+
throw new Error(`${context} must be an object.`);
|
|
177
|
+
}
|
|
178
|
+
const constraintSeverity = readOptionalString(
|
|
179
|
+
value,
|
|
180
|
+
"constraintSeverity",
|
|
181
|
+
context
|
|
182
|
+
);
|
|
183
|
+
if (constraintSeverity !== void 0 && constraintSeverity !== "warn" && constraintSeverity !== "info") {
|
|
184
|
+
throw rowFieldError(context, "constraintSeverity");
|
|
185
|
+
}
|
|
186
|
+
const description = readOptionalString(value, "description", context);
|
|
187
|
+
const sourceTypes = readStringArray(
|
|
188
|
+
value.sourceTypes,
|
|
189
|
+
`${context}.sourceTypes`
|
|
190
|
+
);
|
|
191
|
+
const targetTypes = readStringArray(
|
|
192
|
+
value.targetTypes,
|
|
193
|
+
`${context}.targetTypes`
|
|
194
|
+
);
|
|
195
|
+
return {
|
|
196
|
+
...constraintSeverity === void 0 ? {} : { constraintSeverity },
|
|
197
|
+
...description === void 0 ? {} : { description },
|
|
198
|
+
...sourceTypes === void 0 ? {} : { sourceTypes },
|
|
199
|
+
...targetTypes === void 0 ? {} : { targetTypes },
|
|
200
|
+
label: readRequiredString(value, "label", context),
|
|
201
|
+
value: readRequiredString(value, "value", context)
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
function readEdgeTypeEntries(value, context) {
|
|
205
|
+
if (!Array.isArray(value)) {
|
|
206
|
+
throw rowFieldError(context, "edgeTypes");
|
|
207
|
+
}
|
|
208
|
+
return value.map(
|
|
209
|
+
(entry, index) => readEdgeTypeEntry(entry, `${context}.edgeTypes[${index}]`)
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
function readOntologyDefinitionStatus(value, context) {
|
|
213
|
+
if (value !== "draft" && value !== "active" && value !== "deprecated" && value !== "archived") {
|
|
214
|
+
throw rowFieldError(context, "status");
|
|
215
|
+
}
|
|
216
|
+
return value;
|
|
217
|
+
}
|
|
218
|
+
function readOntologyDefinitionDoc(value, context = "ontology definition row") {
|
|
219
|
+
if (value === null) {
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
if (!isRecord(value)) {
|
|
223
|
+
throw new Error(`${context} must be an object.`);
|
|
224
|
+
}
|
|
225
|
+
return {
|
|
226
|
+
_id: readRequiredId(value, "_id", context),
|
|
227
|
+
createdAt: readRequiredNumber(value, "createdAt", context),
|
|
228
|
+
createdBy: readRequiredString(value, "createdBy", context),
|
|
229
|
+
description: readOptionalString(value, "description", context),
|
|
230
|
+
name: readRequiredString(value, "name", context),
|
|
231
|
+
ontologyKey: readRequiredString(value, "ontologyKey", context),
|
|
232
|
+
parentOntologyId: readOptionalId(value, "parentOntologyId", context),
|
|
233
|
+
status: readOntologyDefinitionStatus(value.status, context),
|
|
234
|
+
tenantId: readOptionalString(value, "tenantId", context),
|
|
235
|
+
tier: readOntologyTier(value.tier, context),
|
|
236
|
+
updatedAt: readRequiredNumber(value, "updatedAt", context)
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
function readOntologyTier(value, context) {
|
|
240
|
+
if (value !== "platform" && value !== "pack" && value !== "tenant") {
|
|
241
|
+
throw rowFieldError(context, "tier");
|
|
242
|
+
}
|
|
243
|
+
return value;
|
|
244
|
+
}
|
|
245
|
+
function readOntologyVersionStatus(value, context) {
|
|
246
|
+
if (value !== "draft" && value !== "published" && value !== "deprecated") {
|
|
247
|
+
throw rowFieldError(context, "status");
|
|
248
|
+
}
|
|
249
|
+
return value;
|
|
250
|
+
}
|
|
251
|
+
function readOntologyVersionDoc(value, context = "ontology version row") {
|
|
252
|
+
if (value === null) {
|
|
253
|
+
return null;
|
|
254
|
+
}
|
|
255
|
+
if (!isRecord(value)) {
|
|
256
|
+
throw new Error(`${context} must be an object.`);
|
|
257
|
+
}
|
|
258
|
+
return {
|
|
259
|
+
_id: readRequiredId(value, "_id", context),
|
|
260
|
+
createdAt: readRequiredNumber(value, "createdAt", context),
|
|
261
|
+
edgeTypes: readEdgeTypeEntries(value.edgeTypes, context),
|
|
262
|
+
entityTypes: readEntityTypeEntries(value.entityTypes, context),
|
|
263
|
+
ontologyId: readRequiredId(value, "ontologyId", context),
|
|
264
|
+
ontologyKey: readRequiredString(value, "ontologyKey", context),
|
|
265
|
+
publishedAt: readOptionalNumber(value, "publishedAt", context),
|
|
266
|
+
publishedBy: readOptionalString(value, "publishedBy", context),
|
|
267
|
+
releaseNotes: readOptionalString(value, "releaseNotes", context),
|
|
268
|
+
status: readOntologyVersionStatus(value.status, context),
|
|
269
|
+
version: readRequiredString(value, "version", context)
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
function readOntologyVersionDocs(values, context) {
|
|
273
|
+
return values.map((value, index) => {
|
|
274
|
+
const doc = readOntologyVersionDoc(value, `${context}[${index}]`);
|
|
275
|
+
if (!doc) {
|
|
276
|
+
throw new Error(`${context}[${index}] is unexpectedly null.`);
|
|
277
|
+
}
|
|
278
|
+
return doc;
|
|
279
|
+
});
|
|
280
|
+
}
|
|
72
281
|
async function logAudit(ctx, args) {
|
|
73
282
|
await ctx.db.insert("epistemicAudit", {
|
|
74
283
|
entityType: args.entityType,
|
|
@@ -84,9 +293,7 @@ async function logAudit(ctx, args) {
|
|
|
84
293
|
var getOntologyDefinition = query({
|
|
85
294
|
args: { id: v.id("ontologyDefinitions") },
|
|
86
295
|
returns: permissiveReturn,
|
|
87
|
-
handler: async (ctx, args) =>
|
|
88
|
-
return await ctx.db.get(args.id);
|
|
89
|
-
}
|
|
296
|
+
handler: async (ctx, args) => await ctx.db.get(args.id)
|
|
90
297
|
});
|
|
91
298
|
var getOntologyDefinitionByKey = query({
|
|
92
299
|
args: {
|
|
@@ -151,12 +358,10 @@ var getOntologyVersion = query({
|
|
|
151
358
|
version: v.string()
|
|
152
359
|
},
|
|
153
360
|
returns: permissiveReturn,
|
|
154
|
-
handler: async (ctx, args) =>
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
).first();
|
|
159
|
-
}
|
|
361
|
+
handler: async (ctx, args) => await ctx.db.query("ontologyVersions").withIndex(
|
|
362
|
+
"by_ontologyKey_version",
|
|
363
|
+
(q) => q.eq("ontologyKey", args.ontologyKey).eq("version", args.version)
|
|
364
|
+
).first()
|
|
160
365
|
});
|
|
161
366
|
var listOntologyVersions = query({
|
|
162
367
|
args: {
|
|
@@ -171,10 +376,13 @@ var listOntologyVersions = query({
|
|
|
171
376
|
},
|
|
172
377
|
returns: permissiveReturn,
|
|
173
378
|
handler: async (ctx, args) => {
|
|
174
|
-
const all =
|
|
175
|
-
"
|
|
176
|
-
|
|
177
|
-
|
|
379
|
+
const all = readOntologyVersionDocs(
|
|
380
|
+
await ctx.db.query("ontologyVersions").withIndex(
|
|
381
|
+
"by_ontologyId",
|
|
382
|
+
(q) => q.eq("ontologyId", args.ontologyId)
|
|
383
|
+
).collect(),
|
|
384
|
+
"listOntologyVersions.ontologyVersions"
|
|
385
|
+
);
|
|
178
386
|
if (args.status) {
|
|
179
387
|
return all.filter(
|
|
180
388
|
(versionDoc) => versionDoc.status === args.status
|
|
@@ -187,10 +395,13 @@ var getPublishedVersion = query({
|
|
|
187
395
|
args: { ontologyId: v.id("ontologyDefinitions") },
|
|
188
396
|
returns: permissiveReturn,
|
|
189
397
|
handler: async (ctx, args) => {
|
|
190
|
-
const published =
|
|
191
|
-
"
|
|
192
|
-
|
|
193
|
-
|
|
398
|
+
const published = readOntologyVersionDocs(
|
|
399
|
+
await ctx.db.query("ontologyVersions").withIndex(
|
|
400
|
+
"by_ontologyId",
|
|
401
|
+
(q) => q.eq("ontologyId", args.ontologyId)
|
|
402
|
+
).collect(),
|
|
403
|
+
"getPublishedVersion.ontologyVersions"
|
|
404
|
+
);
|
|
194
405
|
const publishedOnly = published.filter(
|
|
195
406
|
(versionDoc) => versionDoc.status === "published"
|
|
196
407
|
);
|
|
@@ -212,23 +423,28 @@ var resolveEffectiveOntology = query({
|
|
|
212
423
|
let currentId = args.ontologyId;
|
|
213
424
|
for (let depth = 0; depth < MAX_DEPTH && currentId; depth++) {
|
|
214
425
|
const ontologyId = currentId;
|
|
215
|
-
const def =
|
|
426
|
+
const def = readOntologyDefinitionDoc(
|
|
427
|
+
await ctx.db.get(ontologyId),
|
|
428
|
+
"resolveEffectiveOntology.definition"
|
|
429
|
+
);
|
|
216
430
|
if (!def) {
|
|
217
431
|
break;
|
|
218
432
|
}
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
433
|
+
const versions = readOntologyVersionDocs(
|
|
434
|
+
await ctx.db.query("ontologyVersions").withIndex(
|
|
435
|
+
"by_ontologyId",
|
|
436
|
+
(q) => q.eq("ontologyId", ontologyId)
|
|
437
|
+
).collect(),
|
|
438
|
+
"resolveEffectiveOntology.ontologyVersions"
|
|
439
|
+
);
|
|
224
440
|
const published = versions.filter((ver) => ver.status === "published").sort(
|
|
225
441
|
(a, b) => (b.publishedAt ?? 0) - (a.publishedAt ?? 0)
|
|
226
442
|
);
|
|
227
443
|
chain.unshift({
|
|
228
|
-
def
|
|
444
|
+
def,
|
|
229
445
|
version: published[0] ?? null
|
|
230
446
|
});
|
|
231
|
-
currentId =
|
|
447
|
+
currentId = def.parentOntologyId;
|
|
232
448
|
}
|
|
233
449
|
if (chain.length === 0) {
|
|
234
450
|
return null;
|
|
@@ -332,7 +548,10 @@ var updateOntologyDefinition = mutation({
|
|
|
332
548
|
returns: permissiveReturn,
|
|
333
549
|
handler: async (ctx, args) => {
|
|
334
550
|
const userId = await requireAuth(ctx);
|
|
335
|
-
const def =
|
|
551
|
+
const def = readOntologyDefinitionDoc(
|
|
552
|
+
await ctx.db.get(args.id),
|
|
553
|
+
"updateOntologyDefinition.definition"
|
|
554
|
+
);
|
|
336
555
|
if (!def) {
|
|
337
556
|
throw new Error("Ontology definition not found.");
|
|
338
557
|
}
|
|
@@ -371,7 +590,10 @@ var archiveOntologyDefinition = mutation({
|
|
|
371
590
|
returns: permissiveReturn,
|
|
372
591
|
handler: async (ctx, args) => {
|
|
373
592
|
const userId = await requireAuth(ctx);
|
|
374
|
-
const def =
|
|
593
|
+
const def = readOntologyDefinitionDoc(
|
|
594
|
+
await ctx.db.get(args.id),
|
|
595
|
+
"archiveOntologyDefinition.definition"
|
|
596
|
+
);
|
|
375
597
|
if (!def) {
|
|
376
598
|
throw new Error("Ontology definition not found.");
|
|
377
599
|
}
|
|
@@ -433,8 +655,9 @@ var createOntologyVersion = mutation({
|
|
|
433
655
|
`Invalid version string "${args.version}". Must be in X.Y.Z format.`
|
|
434
656
|
);
|
|
435
657
|
}
|
|
436
|
-
const def =
|
|
437
|
-
args.ontologyId
|
|
658
|
+
const def = readOntologyDefinitionDoc(
|
|
659
|
+
await ctx.db.get(args.ontologyId),
|
|
660
|
+
"createOntologyVersion.definition"
|
|
438
661
|
);
|
|
439
662
|
if (!def) {
|
|
440
663
|
throw new Error("Ontology definition not found.");
|
|
@@ -519,7 +742,10 @@ var updateDraftVersion = mutation({
|
|
|
519
742
|
returns: permissiveReturn,
|
|
520
743
|
handler: async (ctx, args) => {
|
|
521
744
|
const userId = await requireAuth(ctx);
|
|
522
|
-
const ver =
|
|
745
|
+
const ver = readOntologyVersionDoc(
|
|
746
|
+
await ctx.db.get(args.id),
|
|
747
|
+
"updateDraftVersion.version"
|
|
748
|
+
);
|
|
523
749
|
if (!ver) {
|
|
524
750
|
throw new Error("Ontology version not found.");
|
|
525
751
|
}
|
|
@@ -558,7 +784,10 @@ var publishOntologyVersion = mutation({
|
|
|
558
784
|
returns: permissiveReturn,
|
|
559
785
|
handler: async (ctx, args) => {
|
|
560
786
|
const userId = await requireAuth(ctx);
|
|
561
|
-
const ver =
|
|
787
|
+
const ver = readOntologyVersionDoc(
|
|
788
|
+
await ctx.db.get(args.id),
|
|
789
|
+
"publishOntologyVersion.version"
|
|
790
|
+
);
|
|
562
791
|
if (!ver) {
|
|
563
792
|
throw new Error("Ontology version not found.");
|
|
564
793
|
}
|
|
@@ -578,7 +807,10 @@ var publishOntologyVersion = mutation({
|
|
|
578
807
|
publishedBy: userId,
|
|
579
808
|
publishedAt: now
|
|
580
809
|
});
|
|
581
|
-
const def =
|
|
810
|
+
const def = readOntologyDefinitionDoc(
|
|
811
|
+
await ctx.db.get(ver.ontologyId),
|
|
812
|
+
"publishOntologyVersion.definition"
|
|
813
|
+
);
|
|
582
814
|
if (def && def.status === "draft") {
|
|
583
815
|
await ctx.db.patch(ver.ontologyId, {
|
|
584
816
|
status: "active",
|
|
@@ -604,7 +836,10 @@ var deprecateOntologyVersion = mutation({
|
|
|
604
836
|
returns: permissiveReturn,
|
|
605
837
|
handler: async (ctx, args) => {
|
|
606
838
|
const userId = await requireAuth(ctx);
|
|
607
|
-
const ver =
|
|
839
|
+
const ver = readOntologyVersionDoc(
|
|
840
|
+
await ctx.db.get(args.id),
|
|
841
|
+
"deprecateOntologyVersion.version"
|
|
842
|
+
);
|
|
608
843
|
if (!ver) {
|
|
609
844
|
throw new Error("Ontology version not found.");
|
|
610
845
|
}
|