@memberjunction/core-entities-server 6.2.2 → 6.3.0-edge.1
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/README.md +19 -0
- package/dist/custom/AnchoredConversationReadSecurityHook.d.ts +1 -14
- package/dist/custom/AnchoredConversationReadSecurityHook.d.ts.map +1 -1
- package/dist/custom/AnchoredConversationReadSecurityHook.js +43 -5
- package/dist/custom/AnchoredConversationReadSecurityHook.js.map +1 -1
- package/dist/custom/ArtifactSecurityHookHelpers.d.ts +223 -0
- package/dist/custom/ArtifactSecurityHookHelpers.d.ts.map +1 -0
- package/dist/custom/ArtifactSecurityHookHelpers.js +1402 -0
- package/dist/custom/ArtifactSecurityHookHelpers.js.map +1 -0
- package/dist/custom/ConversationAndCommentDrivers.d.ts +82 -0
- package/dist/custom/ConversationAndCommentDrivers.d.ts.map +1 -0
- package/dist/custom/ConversationAndCommentDrivers.js +543 -0
- package/dist/custom/ConversationAndCommentDrivers.js.map +1 -0
- package/dist/custom/FieldSuggestionRecordChangeHook.d.ts +17 -0
- package/dist/custom/FieldSuggestionRecordChangeHook.d.ts.map +1 -0
- package/dist/custom/FieldSuggestionRecordChangeHook.js +142 -0
- package/dist/custom/FieldSuggestionRecordChangeHook.js.map +1 -0
- package/dist/custom/MJAIAgentUserPolicyEntityServer.server.d.ts +11 -0
- package/dist/custom/MJAIAgentUserPolicyEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJAIAgentUserPolicyEntityServer.server.js +41 -0
- package/dist/custom/MJAIAgentUserPolicyEntityServer.server.js.map +1 -1
- package/dist/custom/MJAIBridgeAgentIdentityEntityServer.server.js +2 -2
- package/dist/custom/MJAIBridgeAgentIdentityEntityServer.server.js.map +1 -1
- package/dist/custom/MJAIPromptRunEntityServer.server.d.ts +21 -0
- package/dist/custom/MJAIPromptRunEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJAIPromptRunEntityServer.server.js +76 -5
- package/dist/custom/MJAIPromptRunEntityServer.server.js.map +1 -1
- package/dist/custom/MJArtifactEntityServer.server.d.ts +38 -0
- package/dist/custom/MJArtifactEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJArtifactEntityServer.server.js +436 -0
- package/dist/custom/MJArtifactEntityServer.server.js.map +1 -0
- package/dist/custom/MJArtifactGuestShareLinkEntityServer.server.d.ts +32 -0
- package/dist/custom/MJArtifactGuestShareLinkEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJArtifactGuestShareLinkEntityServer.server.js +434 -0
- package/dist/custom/MJArtifactGuestShareLinkEntityServer.server.js.map +1 -0
- package/dist/custom/MJArtifactPermissionEntityServer.server.d.ts +18 -0
- package/dist/custom/MJArtifactPermissionEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJArtifactPermissionEntityServer.server.js +194 -0
- package/dist/custom/MJArtifactPermissionEntityServer.server.js.map +1 -0
- package/dist/custom/MJArtifactVersionAttributeEntityServer.server.d.ts +22 -0
- package/dist/custom/MJArtifactVersionAttributeEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJArtifactVersionAttributeEntityServer.server.js +312 -0
- package/dist/custom/MJArtifactVersionAttributeEntityServer.server.js.map +1 -0
- package/dist/custom/MJArtifactVersionEntityServer.server.d.ts +76 -12
- package/dist/custom/MJArtifactVersionEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJArtifactVersionEntityServer.server.js +934 -55
- package/dist/custom/MJArtifactVersionEntityServer.server.js.map +1 -1
- package/dist/custom/MJArtifactWorkingStateEntityServer.server.d.ts +42 -0
- package/dist/custom/MJArtifactWorkingStateEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJArtifactWorkingStateEntityServer.server.js +547 -0
- package/dist/custom/MJArtifactWorkingStateEntityServer.server.js.map +1 -0
- package/dist/custom/MJCollectionArtifactEntityServer.server.d.ts +36 -0
- package/dist/custom/MJCollectionArtifactEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJCollectionArtifactEntityServer.server.js +533 -0
- package/dist/custom/MJCollectionArtifactEntityServer.server.js.map +1 -0
- package/dist/custom/MJCollectionEntityServer.server.d.ts +23 -0
- package/dist/custom/MJCollectionEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJCollectionEntityServer.server.js +555 -0
- package/dist/custom/MJCollectionEntityServer.server.js.map +1 -0
- package/dist/custom/MJCollectionPermissionEntityServer.server.d.ts +18 -0
- package/dist/custom/MJCollectionPermissionEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJCollectionPermissionEntityServer.server.js +196 -0
- package/dist/custom/MJCollectionPermissionEntityServer.server.js.map +1 -0
- package/dist/custom/MJCommentEntityServer.server.d.ts +19 -0
- package/dist/custom/MJCommentEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJCommentEntityServer.server.js +137 -0
- package/dist/custom/MJCommentEntityServer.server.js.map +1 -0
- package/dist/custom/MJConversationEntityServer.server.d.ts +11 -4
- package/dist/custom/MJConversationEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJConversationEntityServer.server.js +75 -11
- package/dist/custom/MJConversationEntityServer.server.js.map +1 -1
- package/dist/custom/MJEntityEntityServer.server.d.ts +9 -0
- package/dist/custom/MJEntityEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJEntityEntityServer.server.js +31 -2
- package/dist/custom/MJEntityEntityServer.server.js.map +1 -1
- package/dist/custom/MJFieldSuggestionEntityServer.server.d.ts +29 -0
- package/dist/custom/MJFieldSuggestionEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJFieldSuggestionEntityServer.server.js +249 -0
- package/dist/custom/MJFieldSuggestionEntityServer.server.js.map +1 -0
- package/dist/custom/MJGraphEdgeEntityServer.server.d.ts +197 -0
- package/dist/custom/MJGraphEdgeEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJGraphEdgeEntityServer.server.js +459 -0
- package/dist/custom/MJGraphEdgeEntityServer.server.js.map +1 -0
- package/dist/custom/MJGraphEdgeProviderEntityServer.server.d.ts +22 -0
- package/dist/custom/MJGraphEdgeProviderEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJGraphEdgeProviderEntityServer.server.js +85 -0
- package/dist/custom/MJGraphEdgeProviderEntityServer.server.js.map +1 -0
- package/dist/custom/MJGraphEdgeTypeEntityServer.server.d.ts +21 -0
- package/dist/custom/MJGraphEdgeTypeEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJGraphEdgeTypeEntityServer.server.js +88 -0
- package/dist/custom/MJGraphEdgeTypeEntityServer.server.js.map +1 -0
- package/dist/custom/MJListEntityServer.server.d.ts +26 -10
- package/dist/custom/MJListEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJListEntityServer.server.js +118 -20
- package/dist/custom/MJListEntityServer.server.js.map +1 -1
- package/dist/custom/MJMLEvaluationProtocolEntityServer.server.d.ts +39 -0
- package/dist/custom/MJMLEvaluationProtocolEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJMLEvaluationProtocolEntityServer.server.js +124 -0
- package/dist/custom/MJMLEvaluationProtocolEntityServer.server.js.map +1 -0
- package/dist/custom/MJMLPredictionUnitEntityServer.server.d.ts +124 -0
- package/dist/custom/MJMLPredictionUnitEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJMLPredictionUnitEntityServer.server.js +214 -0
- package/dist/custom/MJMLPredictionUnitEntityServer.server.js.map +1 -0
- package/dist/custom/MJMLTrainingPipelineEntityServer.server.d.ts +101 -1
- package/dist/custom/MJMLTrainingPipelineEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJMLTrainingPipelineEntityServer.server.js +266 -12
- package/dist/custom/MJMLTrainingPipelineEntityServer.server.js.map +1 -1
- package/dist/custom/MJMLTrainingSnapshotEntityServer.server.d.ts +14 -0
- package/dist/custom/MJMLTrainingSnapshotEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJMLTrainingSnapshotEntityServer.server.js +42 -0
- package/dist/custom/MJMLTrainingSnapshotEntityServer.server.js.map +1 -0
- package/dist/custom/MJProjectEntityServer.server.d.ts +28 -2
- package/dist/custom/MJProjectEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJProjectEntityServer.server.js +115 -2
- package/dist/custom/MJProjectEntityServer.server.js.map +1 -1
- package/dist/custom/MJQueryEntityServer.server.d.ts +10 -6
- package/dist/custom/MJQueryEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJQueryEntityServer.server.js +27 -16
- package/dist/custom/MJQueryEntityServer.server.js.map +1 -1
- package/dist/custom/MJScheduledJobEntityServer.server.d.ts +27 -0
- package/dist/custom/MJScheduledJobEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJScheduledJobEntityServer.server.js +56 -0
- package/dist/custom/MJScheduledJobEntityServer.server.js.map +1 -0
- package/dist/custom/MJScopedNotificationConfigEntityServer.server.d.ts +15 -0
- package/dist/custom/MJScopedNotificationConfigEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJScopedNotificationConfigEntityServer.server.js +48 -0
- package/dist/custom/MJScopedNotificationConfigEntityServer.server.js.map +1 -0
- package/dist/custom/MJTagEntityServer.server.d.ts +11 -1
- package/dist/custom/MJTagEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJTagEntityServer.server.js +28 -3
- package/dist/custom/MJTagEntityServer.server.js.map +1 -1
- package/dist/custom/MJTaskDependencyEntityServer.server.d.ts +24 -0
- package/dist/custom/MJTaskDependencyEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJTaskDependencyEntityServer.server.js +75 -0
- package/dist/custom/MJTaskDependencyEntityServer.server.js.map +1 -0
- package/dist/custom/MJTaskEntityServer.server.d.ts +148 -0
- package/dist/custom/MJTaskEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJTaskEntityServer.server.js +413 -0
- package/dist/custom/MJTaskEntityServer.server.js.map +1 -0
- package/dist/custom/MJUserEntityServer.server.d.ts +2 -1
- package/dist/custom/MJUserEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJUserEntityServer.server.js +2 -1
- package/dist/custom/MJUserEntityServer.server.js.map +1 -1
- package/dist/custom/MJUserViewEntityServer.server.d.ts +8 -2
- package/dist/custom/MJUserViewEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJUserViewEntityServer.server.js +25 -12
- package/dist/custom/MJUserViewEntityServer.server.js.map +1 -1
- package/dist/custom/RestrictedFieldCommentClassifier.d.ts +9 -3
- package/dist/custom/RestrictedFieldCommentClassifier.d.ts.map +1 -1
- package/dist/custom/RestrictedFieldCommentClassifier.js +91 -15
- package/dist/custom/RestrictedFieldCommentClassifier.js.map +1 -1
- package/dist/custom/RestrictedFieldDecision.d.ts +121 -0
- package/dist/custom/RestrictedFieldDecision.d.ts.map +1 -0
- package/dist/custom/RestrictedFieldDecision.js +168 -0
- package/dist/custom/RestrictedFieldDecision.js.map +1 -0
- package/dist/custom/SpreadsheetWorkerEntry.d.ts +25 -0
- package/dist/custom/SpreadsheetWorkerEntry.d.ts.map +1 -0
- package/dist/custom/SpreadsheetWorkerEntry.js +37 -0
- package/dist/custom/SpreadsheetWorkerEntry.js.map +1 -0
- package/dist/custom/SpreadsheetWorkerRunner.d.ts +45 -0
- package/dist/custom/SpreadsheetWorkerRunner.d.ts.map +1 -0
- package/dist/custom/SpreadsheetWorkerRunner.js +243 -0
- package/dist/custom/SpreadsheetWorkerRunner.js.map +1 -0
- package/dist/custom/fieldPermissionDelta.d.ts +15 -1
- package/dist/custom/fieldPermissionDelta.d.ts.map +1 -1
- package/dist/custom/fieldPermissionDelta.js +28 -7
- package/dist/custom/fieldPermissionDelta.js.map +1 -1
- package/dist/custom/fieldPermissionReconciler.d.ts +4 -1
- package/dist/custom/fieldPermissionReconciler.d.ts.map +1 -1
- package/dist/custom/fieldPermissionReconciler.js +4 -2
- package/dist/custom/fieldPermissionReconciler.js.map +1 -1
- package/dist/custom/list-refresh/ListRefreshRoutine.d.ts +40 -0
- package/dist/custom/list-refresh/ListRefreshRoutine.d.ts.map +1 -0
- package/dist/custom/list-refresh/ListRefreshRoutine.js +114 -0
- package/dist/custom/list-refresh/ListRefreshRoutine.js.map +1 -0
- package/dist/custom/query-extraction/childRowWriter.d.ts +2 -2
- package/dist/custom/query-extraction/childRowWriter.d.ts.map +1 -1
- package/dist/custom/query-extraction/childRowWriter.js +7 -2
- package/dist/custom/query-extraction/childRowWriter.js.map +1 -1
- package/dist/custom/query-extraction/describeFacts.d.ts +2 -0
- package/dist/custom/query-extraction/describeFacts.d.ts.map +1 -1
- package/dist/custom/query-extraction/describeFacts.js +17 -10
- package/dist/custom/query-extraction/describeFacts.js.map +1 -1
- package/dist/custom/query-extraction/descriptionPass.d.ts.map +1 -1
- package/dist/custom/query-extraction/descriptionPass.js +4 -1
- package/dist/custom/query-extraction/descriptionPass.js.map +1 -1
- package/dist/custom/query-extraction/extractQuery.js +5 -3
- package/dist/custom/query-extraction/extractQuery.js.map +1 -1
- package/dist/custom/query-extraction/extractionTypes.d.ts +5 -0
- package/dist/custom/query-extraction/extractionTypes.d.ts.map +1 -1
- package/dist/custom/sessionConfigGuard.d.ts +7 -0
- package/dist/custom/sessionConfigGuard.d.ts.map +1 -1
- package/dist/custom/sessionConfigGuard.js +13 -1
- package/dist/custom/sessionConfigGuard.js.map +1 -1
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +31 -30
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { BaseEntity, BaseEntityResult, RunView, ServerOperationScopeManager, ValidationErrorInfo, ValidationErrorType, } from '@memberjunction/core';
|
|
8
|
+
import { EscapeSQLString, RegisterClass, UUIDsEqual } from '@memberjunction/global';
|
|
9
|
+
import { EvaluateAuthorizationChecks, FormatGraphNodeKey, GRAPH_PIPELINE_EDGE_APPROVAL_OPERATION, GraphEngine, IsGraphDataProvider, MJGraphEdgeEntity, } from '@memberjunction/core-entities';
|
|
10
|
+
/** Maximum character length permitted for `SourceRecordID` and `TargetRecordID`. */
|
|
11
|
+
export const MAX_GRAPH_EDGE_RECORD_ID_LENGTH = 400;
|
|
12
|
+
/** Named authorization required for every approval decision on `MJ: Graph Edges` (see {@link EvaluateGraphEdgeApproval}). */
|
|
13
|
+
export const GRAPH_APPROVE_EDGES_AUTHORIZATION = 'Graph: Approve Edges';
|
|
14
|
+
const GRAPH_EDGES_ENTITY_NAME = 'MJ: Graph Edges';
|
|
15
|
+
/**
|
|
16
|
+
* Canonicalize endpoints for an undirected edge (`IsDirected === false`) so the lower
|
|
17
|
+
* `<entityID>|<recordID>` key always occupies the `Source*` columns.
|
|
18
|
+
*/
|
|
19
|
+
export function CanonicalizeUndirectedEdgeEndpoints(sourceEntityID, sourceRecordID, targetEntityID, targetRecordID) {
|
|
20
|
+
const sourceKey = FormatGraphNodeKey(sourceEntityID, sourceRecordID);
|
|
21
|
+
const targetKey = FormatGraphNodeKey(targetEntityID, targetRecordID);
|
|
22
|
+
if (sourceKey > targetKey) {
|
|
23
|
+
return {
|
|
24
|
+
SourceEntityID: targetEntityID,
|
|
25
|
+
SourceRecordID: targetRecordID,
|
|
26
|
+
TargetEntityID: sourceEntityID,
|
|
27
|
+
TargetRecordID: sourceRecordID,
|
|
28
|
+
Swapped: true,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
SourceEntityID: sourceEntityID,
|
|
33
|
+
SourceRecordID: sourceRecordID,
|
|
34
|
+
TargetEntityID: targetEntityID,
|
|
35
|
+
TargetRecordID: targetRecordID,
|
|
36
|
+
Swapped: false,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Pure invariant check for a `MJ: Graph Edges` record (Phase G1.3):
|
|
41
|
+
* 1. No self-loop (`SourceEntityID === TargetEntityID` and `SourceRecordID === TargetRecordID`).
|
|
42
|
+
* 2. `SourceRecordID` and `TargetRecordID` are non-empty and at most 400 characters.
|
|
43
|
+
* 3. `EdgeTypeID` resolves to an edge type with `AllowStored === true` (refuses provider-only types)
|
|
44
|
+
* that belongs to the edge's `GraphID` or is global (`GraphID === null`).
|
|
45
|
+
* 4. `SourceEntityID` and `TargetEntityID` satisfy `GraphEngine.ValidateEdgeEndpoint` constraints.
|
|
46
|
+
*
|
|
47
|
+
* Who may create an edge that starts `Approved` is not an invariant of the row: it is the approval
|
|
48
|
+
* gate's decision ({@link EvaluateGraphEdgeApproval}), and it applies to every `Origin`.
|
|
49
|
+
*/
|
|
50
|
+
export function ValidateGraphEdgeInvariants(input, edgeType, validateEndpoint = (edgeTypeId, side, entityId) => GraphEngine.Instance.ValidateEdgeEndpoint(edgeTypeId, side, entityId)) {
|
|
51
|
+
const errors = [];
|
|
52
|
+
const srcRec = input.SourceRecordID ?? '';
|
|
53
|
+
const tgtRec = input.TargetRecordID ?? '';
|
|
54
|
+
if (srcRec.trim().length === 0) {
|
|
55
|
+
errors.push(new ValidationErrorInfo('SourceRecordID', 'SourceRecordID cannot be empty.', input.SourceRecordID, ValidationErrorType.Failure));
|
|
56
|
+
}
|
|
57
|
+
else if (srcRec.length > MAX_GRAPH_EDGE_RECORD_ID_LENGTH) {
|
|
58
|
+
errors.push(new ValidationErrorInfo('SourceRecordID', `SourceRecordID cannot exceed ${MAX_GRAPH_EDGE_RECORD_ID_LENGTH} characters (got ${srcRec.length}).`, input.SourceRecordID, ValidationErrorType.Failure));
|
|
59
|
+
}
|
|
60
|
+
if (tgtRec.trim().length === 0) {
|
|
61
|
+
errors.push(new ValidationErrorInfo('TargetRecordID', 'TargetRecordID cannot be empty.', input.TargetRecordID, ValidationErrorType.Failure));
|
|
62
|
+
}
|
|
63
|
+
else if (tgtRec.length > MAX_GRAPH_EDGE_RECORD_ID_LENGTH) {
|
|
64
|
+
errors.push(new ValidationErrorInfo('TargetRecordID', `TargetRecordID cannot exceed ${MAX_GRAPH_EDGE_RECORD_ID_LENGTH} characters (got ${tgtRec.length}).`, input.TargetRecordID, ValidationErrorType.Failure));
|
|
65
|
+
}
|
|
66
|
+
if (input.SourceEntityID &&
|
|
67
|
+
input.TargetEntityID &&
|
|
68
|
+
srcRec.trim().length > 0 &&
|
|
69
|
+
UUIDsEqual(input.SourceEntityID, input.TargetEntityID) &&
|
|
70
|
+
srcRec.trim().toLowerCase() === tgtRec.trim().toLowerCase()) {
|
|
71
|
+
errors.push(new ValidationErrorInfo('SourceRecordID', 'Graph edge cannot connect a node to itself (self-loop is not allowed).', input.SourceRecordID, ValidationErrorType.Failure));
|
|
72
|
+
}
|
|
73
|
+
if (edgeType) {
|
|
74
|
+
if (!edgeType.AllowStored) {
|
|
75
|
+
errors.push(new ValidationErrorInfo('EdgeTypeID', `Edge type "${edgeType.Name}" is provider-only (AllowStored = false) and cannot be persisted in MJ: Graph Edges.`, input.EdgeTypeID, ValidationErrorType.Failure));
|
|
76
|
+
}
|
|
77
|
+
if (edgeType.GraphID != null && input.GraphID != null && !UUIDsEqual(edgeType.GraphID, input.GraphID)) {
|
|
78
|
+
errors.push(new ValidationErrorInfo('EdgeTypeID', `Edge type "${edgeType.Name}" is scoped to a different graph and cannot be used in graph "${input.GraphID}".`, input.EdgeTypeID, ValidationErrorType.Failure));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (input.EdgeTypeID && input.SourceEntityID) {
|
|
82
|
+
if (!validateEndpoint(input.EdgeTypeID, 'Source', input.SourceEntityID)) {
|
|
83
|
+
errors.push(new ValidationErrorInfo('SourceEntityID', `Entity "${input.SourceEntityID}" is not permitted as a Source endpoint for edge type "${edgeType?.Name ?? input.EdgeTypeID}".`, input.SourceEntityID, ValidationErrorType.Failure));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (input.EdgeTypeID && input.TargetEntityID) {
|
|
87
|
+
if (!validateEndpoint(input.EdgeTypeID, 'Target', input.TargetEntityID)) {
|
|
88
|
+
errors.push(new ValidationErrorInfo('TargetEntityID', `Entity "${input.TargetEntityID}" is not permitted as a Target endpoint for edge type "${edgeType?.Name ?? input.EdgeTypeID}".`, input.TargetEntityID, ValidationErrorType.Failure));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return errors;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* True when saving these values is an approval decision that `Graph: Approve Edges` must authorize:
|
|
95
|
+
* - creating an edge that does not start out `Proposed` or `Rejected`, whatever its `Origin`. A null `Status` counts:
|
|
96
|
+
* `spCreateGraphEdge` stores the column default, `Approved`;
|
|
97
|
+
* - changing `Status` to `Approved` or `Rejected`, or away from `Approved` or `Rejected` (a review decision, or undoing one);
|
|
98
|
+
* - changing what an `Approved` edge connects (`IdentityChanged`) or says (`ContentChanged`).
|
|
99
|
+
*/
|
|
100
|
+
export function GraphEdgeSaveNeedsApproval(input) {
|
|
101
|
+
if (!input.IsSaved) {
|
|
102
|
+
return input.NextStatus !== 'Proposed' && input.NextStatus !== 'Rejected';
|
|
103
|
+
}
|
|
104
|
+
const statusChanged = input.PreviousStatus !== input.NextStatus;
|
|
105
|
+
const reviewed = input.PreviousStatus === 'Approved' || input.PreviousStatus === 'Rejected';
|
|
106
|
+
if (statusChanged && (input.NextStatus === 'Approved' || input.NextStatus === 'Rejected' || reviewed)) {
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
return input.NextStatus === 'Approved' && (input.IdentityChanged || input.ContentChanged);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* True when this save is the Content Pipeline creating an `Inferred` edge its content source's
|
|
113
|
+
* `GraphOverlay` policy approves: a create, `Origin = 'Inferred'`, `Status = 'Approved'`, inside the
|
|
114
|
+
* {@link GRAPH_PIPELINE_EDGE_APPROVAL_OPERATION} scope. Nothing else (a `Declared` edge, a status
|
|
115
|
+
* change, a re-pointed or edited edge) is covered by the pipeline's policy.
|
|
116
|
+
*/
|
|
117
|
+
export function IsPipelinePolicyApprovedCreate(input) {
|
|
118
|
+
return input.InPipelineApprovalScope && !input.IsSaved && input.Origin === 'Inferred' && input.NextStatus === 'Approved';
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Pure fail-closed gate for approval decisions on `MJ: Graph Edges` (see {@link GraphEdgeSaveNeedsApproval}).
|
|
122
|
+
*
|
|
123
|
+
* The caller must hold `Graph: Approve Edges` (or an ancestor) through `EvaluateAuthorizationChecks`,
|
|
124
|
+
* MJ's role-based evaluation, whatever the edge's `Origin`. There is no bypass for any user type: an
|
|
125
|
+
* authorization that is not seeded, an empty authorization list, or a missing caller all deny,
|
|
126
|
+
* because each of them means nobody has been granted the right.
|
|
127
|
+
*
|
|
128
|
+
* The one exception is {@link IsPipelinePolicyApprovedCreate}. The Content Pipeline `Graph` stage
|
|
129
|
+
* (`EntityGraphOverlayStore.UpsertEdges`) saves as the run's user: the scheduler's user, whoever ran
|
|
130
|
+
* the Record Process on demand, or whoever uploaded the document, most of whom hold no
|
|
131
|
+
* `Graph: Approve Edges`. Its `Approved` status is not that user's decision but the content source's
|
|
132
|
+
* configured `GraphOverlay.ConceptTaxonomyMode`, so tying it to the run user would break `auto-grow`
|
|
133
|
+
* for every run but a developer's. The stage therefore saves inside a server operation scope instead,
|
|
134
|
+
* which no API caller can enter (see {@link GRAPH_PIPELINE_EDGE_APPROVAL_OPERATION}). Such an edge is
|
|
135
|
+
* not stamped as reviewed: no person reviewed it.
|
|
136
|
+
*/
|
|
137
|
+
export function EvaluateGraphEdgeApproval(input) {
|
|
138
|
+
if (!GraphEdgeSaveNeedsApproval(input) || IsPipelinePolicyApprovedCreate(input)) {
|
|
139
|
+
return { Error: null, ShouldStampReview: false };
|
|
140
|
+
}
|
|
141
|
+
const denial = ApproveEdgesDenialReason(input.User, input.Authorizations);
|
|
142
|
+
if (denial) {
|
|
143
|
+
return { Error: approvalError(denial, input.NextStatus), ShouldStampReview: false };
|
|
144
|
+
}
|
|
145
|
+
return { Error: null, ShouldStampReview: true };
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Why `user` may not exercise `Graph: Approve Edges`, or `null` when it may. Fail closed: a missing
|
|
149
|
+
* caller, an unseeded authorization and an empty authorization list all deny.
|
|
150
|
+
*/
|
|
151
|
+
export function ApproveEdgesDenialReason(user, authorizations) {
|
|
152
|
+
if (!user) {
|
|
153
|
+
return `requires an authenticated caller with "${GRAPH_APPROVE_EDGES_AUTHORIZATION}"`;
|
|
154
|
+
}
|
|
155
|
+
const [check] = EvaluateAuthorizationChecks([GRAPH_APPROVE_EDGES_AUTHORIZATION], user, authorizations ?? []);
|
|
156
|
+
if (!check || check.Unknown) {
|
|
157
|
+
return `requires "${GRAPH_APPROVE_EDGES_AUTHORIZATION}", which is not configured in this system`;
|
|
158
|
+
}
|
|
159
|
+
if (!check.Allowed) {
|
|
160
|
+
return `requires "${GRAPH_APPROVE_EDGES_AUTHORIZATION}", which the caller does not hold`;
|
|
161
|
+
}
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* The refusal for deleting an edge whose stored `Status` is `storedStatus`, or `null` when allowed.
|
|
166
|
+
* Removing an `Approved` edge undoes a review decision, so it needs `Graph: Approve Edges`; a
|
|
167
|
+
* `Proposed` or `Rejected` edge may be deleted by anyone the entity permissions allow.
|
|
168
|
+
*/
|
|
169
|
+
export function GraphEdgeDeleteRefusal(storedStatus, user, authorizations) {
|
|
170
|
+
if (storedStatus !== 'Approved') {
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
const denial = ApproveEdgesDenialReason(user, authorizations);
|
|
174
|
+
return denial ? `Deleting an approved graph edge is a review decision and ${denial}.` : null;
|
|
175
|
+
}
|
|
176
|
+
/** `Attributes` keys the server writes when an edge is approved or rejected; a caller never sets them. */
|
|
177
|
+
export const GRAPH_EDGE_REVIEW_ATTRIBUTE_KEYS = ['ReviewedByUserID', 'ReviewedAt'];
|
|
178
|
+
/**
|
|
179
|
+
* The first review-stamp key ({@link GRAPH_EDGE_REVIEW_ATTRIBUTE_KEYS}) whose value differs between
|
|
180
|
+
* the stored and the new `Attributes` JSON, or `null`. A save that is not itself a stamped review
|
|
181
|
+
* decision may not add, change or remove one: the stamp would otherwise be forgeable.
|
|
182
|
+
*/
|
|
183
|
+
export function FindReviewStampChange(storedAttributes, nextAttributes) {
|
|
184
|
+
const stored = parseAttributeObject(storedAttributes);
|
|
185
|
+
const next = parseAttributeObject(nextAttributes);
|
|
186
|
+
for (const key of GRAPH_EDGE_REVIEW_ATTRIBUTE_KEYS) {
|
|
187
|
+
if (JSON.stringify(stored[key]) !== JSON.stringify(next[key])) {
|
|
188
|
+
return key;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
function parseAttributeObject(raw) {
|
|
194
|
+
if (!raw || raw.trim().length === 0) {
|
|
195
|
+
return {};
|
|
196
|
+
}
|
|
197
|
+
try {
|
|
198
|
+
const parsed = JSON.parse(raw);
|
|
199
|
+
return typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed) ? { ...parsed } : {};
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
return {};
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* True while the current async call chain is inside a {@link GRAPH_PIPELINE_EDGE_APPROVAL_OPERATION}
|
|
207
|
+
* server operation scope bound to `user` (`ServerOperationScopeManager.IsOperationActive`). Frames
|
|
208
|
+
* outside the innermost client CRUD boundary are masked, so a GraphQL, REST or transaction-group save
|
|
209
|
+
* never sees one.
|
|
210
|
+
*/
|
|
211
|
+
export function IsInGraphPipelineApprovalScope(user) {
|
|
212
|
+
if (!user) {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
return ServerOperationScopeManager.Instance.IsOperationActive([GRAPH_PIPELINE_EDGE_APPROVAL_OPERATION], GRAPH_EDGES_ENTITY_NAME, user);
|
|
216
|
+
}
|
|
217
|
+
function approvalError(reason, nextStatus) {
|
|
218
|
+
return new ValidationErrorInfo('Status', `Saving this graph edge as "${nextStatus ?? ''}" is an approval decision and ${reason}. ` +
|
|
219
|
+
'Save it as "Proposed" for a reviewer instead.', nextStatus, ValidationErrorType.Failure);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Batched `RunViews` (`ResultType: 'count_only'`) existence check for `Source` and `Target` endpoint
|
|
223
|
+
* records, run as `user` so an endpoint the caller cannot read (entity permission or row-level
|
|
224
|
+
* security) is refused exactly like one that does not exist.
|
|
225
|
+
*
|
|
226
|
+
* Fails closed: an endpoint entity missing from metadata, a failed read, or an exception is a
|
|
227
|
+
* validation error, never a silent pass.
|
|
228
|
+
*/
|
|
229
|
+
export async function CheckGraphEdgeEndpointsExist(input, provider, user) {
|
|
230
|
+
if (!user) {
|
|
231
|
+
return [endpointError('SourceRecordID', 'Graph edge endpoints can only be checked for an authenticated caller.', input.SourceRecordID)];
|
|
232
|
+
}
|
|
233
|
+
const errors = [];
|
|
234
|
+
const checks = [];
|
|
235
|
+
const addCheck = (field, entityId, recordId) => {
|
|
236
|
+
const trimmedId = recordId?.trim();
|
|
237
|
+
if (!entityId || !trimmedId) {
|
|
238
|
+
return; // emptiness is reported by ValidateGraphEdgeInvariants
|
|
239
|
+
}
|
|
240
|
+
const entityInfo = provider.EntityByID(entityId);
|
|
241
|
+
const pkName = entityInfo?.FirstPrimaryKey?.Name; // first-pk-ok: Graph edge endpoint record existence check uses FirstPrimaryKey
|
|
242
|
+
if (!entityInfo || !pkName) {
|
|
243
|
+
errors.push(endpointError(field, `Endpoint entity "${entityId}" is not a known entity.`, entityId));
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
checks.push({
|
|
247
|
+
Field: field,
|
|
248
|
+
EntityName: entityInfo.Name,
|
|
249
|
+
RecordID: trimmedId,
|
|
250
|
+
Param: {
|
|
251
|
+
EntityName: entityInfo.Name,
|
|
252
|
+
ExtraFilter: `[${pkName}] = '${EscapeSQLString(trimmedId)}'`,
|
|
253
|
+
ResultType: 'count_only',
|
|
254
|
+
},
|
|
255
|
+
});
|
|
256
|
+
};
|
|
257
|
+
addCheck('SourceRecordID', input.SourceEntityID, input.SourceRecordID);
|
|
258
|
+
addCheck('TargetRecordID', input.TargetEntityID, input.TargetRecordID);
|
|
259
|
+
if (checks.length === 0) {
|
|
260
|
+
return errors;
|
|
261
|
+
}
|
|
262
|
+
try {
|
|
263
|
+
const results = await RunView.FromMetadataProvider(provider).RunViews(checks.map((c) => c.Param), user);
|
|
264
|
+
for (let i = 0; i < checks.length; i++) {
|
|
265
|
+
const check = checks[i];
|
|
266
|
+
const res = results[i];
|
|
267
|
+
if (!res?.Success) {
|
|
268
|
+
errors.push(endpointError(check.Field, `Could not verify endpoint record "${check.RecordID}" in entity "${check.EntityName}": ${res?.ErrorMessage ?? 'no result'}.`, check.RecordID));
|
|
269
|
+
}
|
|
270
|
+
else if (res.TotalRowCount === 0) {
|
|
271
|
+
errors.push(endpointError(check.Field, `Endpoint record "${check.RecordID}" in entity "${check.EntityName}" does not exist or is not readable by the caller.`, check.RecordID));
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
catch (err) {
|
|
276
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
277
|
+
errors.push(endpointError('SourceRecordID', `Could not verify graph edge endpoints: ${msg}`, input.SourceRecordID));
|
|
278
|
+
}
|
|
279
|
+
return errors;
|
|
280
|
+
}
|
|
281
|
+
function endpointError(field, message, value) {
|
|
282
|
+
return new ValidationErrorInfo(field, message, value, ValidationErrorType.Failure);
|
|
283
|
+
}
|
|
284
|
+
/** Columns whose change on an `Approved` edge re-approves a different edge. */
|
|
285
|
+
const IDENTITY_FIELDS = ['GraphID', 'EdgeTypeID', 'SourceEntityID', 'SourceRecordID', 'TargetEntityID', 'TargetRecordID'];
|
|
286
|
+
/** Columns whose change on an `Approved` edge re-approves different content. */
|
|
287
|
+
const CONTENT_FIELDS = ['Description', 'Weight', 'Origin', 'Attributes', 'Confidence'];
|
|
288
|
+
/**
|
|
289
|
+
* Server-side `MJ: Graph Edges` entity enforcing Phase G1.3 write-time invariants:
|
|
290
|
+
* - No self-loops
|
|
291
|
+
* - Record ID length <= 400 chars
|
|
292
|
+
* - Refuses an `EdgeTypeID` that is unknown, provider-only (`AllowStored = false`) or scoped to another graph
|
|
293
|
+
* - Enforces `MJ: Graph Edge Type Endpoints` source/target entity constraints via `GraphEngine.Instance.ValidateEdgeEndpoint`
|
|
294
|
+
* - Canonicalizes undirected (`IsDirected = false`) edge endpoint orientation (lower `<entityID>|<recordID>` key first)
|
|
295
|
+
* - Requires `Graph: Approve Edges` for every approval decision, whatever the `Origin`, including creating
|
|
296
|
+
* an edge that starts `Approved` and editing or deleting an `Approved` edge ({@link EvaluateGraphEdgeApproval},
|
|
297
|
+
* {@link GraphEdgeDeleteRefusal}), and stamps `ReviewedByUserID` / `ReviewedAt` into `Attributes`; the
|
|
298
|
+
* Content Pipeline's policy-approved `Inferred` edges are the one exception ({@link IsPipelinePolicyApprovedCreate})
|
|
299
|
+
* - Refuses any other save that sets, changes or removes that review stamp ({@link FindReviewStampChange})
|
|
300
|
+
* - Verifies `Source` and `Target` endpoint records exist, as the caller, via batched `RunViews` (`count_only`)
|
|
301
|
+
*
|
|
302
|
+
* Every check fails closed: graph metadata that cannot be loaded is a validation error, not a pass.
|
|
303
|
+
*/
|
|
304
|
+
let MJGraphEdgeEntityServer = class MJGraphEdgeEntityServer extends MJGraphEdgeEntity {
|
|
305
|
+
get DefaultSkipAsyncValidation() {
|
|
306
|
+
return false;
|
|
307
|
+
}
|
|
308
|
+
async ValidateAsync() {
|
|
309
|
+
const result = await super.ValidateAsync();
|
|
310
|
+
if (!result.Success) {
|
|
311
|
+
return result;
|
|
312
|
+
}
|
|
313
|
+
const provider = this.ProviderToUse;
|
|
314
|
+
if (!IsGraphDataProvider(provider)) {
|
|
315
|
+
return this.fail(result, new ValidationErrorInfo('EdgeTypeID', 'Graph edges can only be validated against a metadata provider.', this.EdgeTypeID, ValidationErrorType.Failure));
|
|
316
|
+
}
|
|
317
|
+
const engineError = await this.ensureGraphEngine(provider);
|
|
318
|
+
if (engineError) {
|
|
319
|
+
return this.fail(result, engineError);
|
|
320
|
+
}
|
|
321
|
+
const edgeType = this.resolveEdgeType(this.EdgeTypeID);
|
|
322
|
+
this.canonicalizeUndirectedEndpoints(edgeType);
|
|
323
|
+
const errors = ValidateGraphEdgeInvariants({
|
|
324
|
+
GraphID: this.GraphID,
|
|
325
|
+
EdgeTypeID: this.EdgeTypeID,
|
|
326
|
+
SourceEntityID: this.SourceEntityID,
|
|
327
|
+
SourceRecordID: this.SourceRecordID,
|
|
328
|
+
TargetEntityID: this.TargetEntityID,
|
|
329
|
+
TargetRecordID: this.TargetRecordID,
|
|
330
|
+
}, edgeType);
|
|
331
|
+
if (this.EdgeTypeID && !edgeType) {
|
|
332
|
+
errors.push(new ValidationErrorInfo('EdgeTypeID', `Edge type "${this.EdgeTypeID}" is not a known graph edge type.`, this.EdgeTypeID, ValidationErrorType.Failure));
|
|
333
|
+
}
|
|
334
|
+
const approval = EvaluateGraphEdgeApproval({
|
|
335
|
+
IsSaved: this.IsSaved,
|
|
336
|
+
Origin: this.Origin,
|
|
337
|
+
PreviousStatus: this.previousStatus(),
|
|
338
|
+
NextStatus: this.Status,
|
|
339
|
+
IdentityChanged: this.IsSaved && IDENTITY_FIELDS.some((f) => this.GetFieldByName(f)?.Dirty === true),
|
|
340
|
+
ContentChanged: this.IsSaved && CONTENT_FIELDS.some((f) => this.GetFieldByName(f)?.Dirty === true),
|
|
341
|
+
User: this.ContextCurrentUser,
|
|
342
|
+
Authorizations: provider.Authorizations,
|
|
343
|
+
InPipelineApprovalScope: IsInGraphPipelineApprovalScope(this.ContextCurrentUser),
|
|
344
|
+
});
|
|
345
|
+
if (approval.Error) {
|
|
346
|
+
errors.push(approval.Error);
|
|
347
|
+
}
|
|
348
|
+
else if (approval.ShouldStampReview && this.ContextCurrentUser?.ID) {
|
|
349
|
+
this.stampReview(this.ContextCurrentUser.ID);
|
|
350
|
+
}
|
|
351
|
+
else {
|
|
352
|
+
const forgedKey = FindReviewStampChange(this.storedAttributes(), this.Attributes);
|
|
353
|
+
if (forgedKey) {
|
|
354
|
+
errors.push(new ValidationErrorInfo('Attributes', `"${forgedKey}" in Attributes is recorded by the server when an edge is reviewed; it cannot be set, changed or removed.`, this.Attributes, ValidationErrorType.Failure));
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
if (errors.length === 0 && this.endpointsDirty()) {
|
|
358
|
+
errors.push(...(await CheckGraphEdgeEndpointsExist({
|
|
359
|
+
SourceEntityID: this.SourceEntityID,
|
|
360
|
+
SourceRecordID: this.SourceRecordID,
|
|
361
|
+
TargetEntityID: this.TargetEntityID,
|
|
362
|
+
TargetRecordID: this.TargetRecordID,
|
|
363
|
+
}, provider, this.ContextCurrentUser)));
|
|
364
|
+
}
|
|
365
|
+
if (errors.length > 0) {
|
|
366
|
+
result.Errors.push(...errors);
|
|
367
|
+
result.Success = false;
|
|
368
|
+
}
|
|
369
|
+
return result;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Makes sure `GraphEngine` has its edge types and endpoint constraints. `Config` is a no-op once
|
|
373
|
+
* loaded; on a server `BaseEngine` loads it as the system user, so the shared cache never takes
|
|
374
|
+
* this caller's scope. A failure is returned as an error: validating against an empty cache
|
|
375
|
+
* would skip the edge-type checks.
|
|
376
|
+
*/
|
|
377
|
+
async ensureGraphEngine(provider) {
|
|
378
|
+
try {
|
|
379
|
+
await GraphEngine.Instance.Config(false, this.ContextCurrentUser, provider);
|
|
380
|
+
return GraphEngine.Instance.Loaded
|
|
381
|
+
? null
|
|
382
|
+
: new ValidationErrorInfo('EdgeTypeID', 'Graph metadata could not be loaded to validate this edge.', this.EdgeTypeID, ValidationErrorType.Failure);
|
|
383
|
+
}
|
|
384
|
+
catch (err) {
|
|
385
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
386
|
+
return new ValidationErrorInfo('EdgeTypeID', `Graph metadata could not be loaded to validate this edge: ${msg}`, this.EdgeTypeID, ValidationErrorType.Failure);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
canonicalizeUndirectedEndpoints(edgeType) {
|
|
390
|
+
if (!edgeType || edgeType.IsDirected || !this.SourceEntityID || !this.TargetEntityID || !this.SourceRecordID || !this.TargetRecordID) {
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
const canonical = CanonicalizeUndirectedEdgeEndpoints(this.SourceEntityID, this.SourceRecordID, this.TargetEntityID, this.TargetRecordID);
|
|
394
|
+
if (canonical.Swapped) {
|
|
395
|
+
this.SourceEntityID = canonical.SourceEntityID;
|
|
396
|
+
this.SourceRecordID = canonical.SourceRecordID;
|
|
397
|
+
this.TargetEntityID = canonical.TargetEntityID;
|
|
398
|
+
this.TargetRecordID = canonical.TargetRecordID;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Refuses deleting an `Approved` edge without `Graph: Approve Edges` ({@link GraphEdgeDeleteRefusal}).
|
|
403
|
+
* The delete path loads the stored row first, so `Status` is the stored value.
|
|
404
|
+
*/
|
|
405
|
+
async Delete(options) {
|
|
406
|
+
const provider = this.ProviderToUse;
|
|
407
|
+
const authorizations = IsGraphDataProvider(provider) ? provider.Authorizations : undefined;
|
|
408
|
+
const refusal = GraphEdgeDeleteRefusal(this.previousStatus() ?? this.Status, this.ContextCurrentUser, authorizations);
|
|
409
|
+
if (refusal) {
|
|
410
|
+
const result = new BaseEntityResult();
|
|
411
|
+
result.Success = false;
|
|
412
|
+
result.Type = 'delete';
|
|
413
|
+
result.Message = refusal;
|
|
414
|
+
result.StartedAt = new Date();
|
|
415
|
+
result.EndedAt = new Date();
|
|
416
|
+
this.RegisterResultHistoryEntry(result);
|
|
417
|
+
return false;
|
|
418
|
+
}
|
|
419
|
+
return super.Delete(options);
|
|
420
|
+
}
|
|
421
|
+
/** The stored `Attributes` before this save; `null` for a create. */
|
|
422
|
+
storedAttributes() {
|
|
423
|
+
if (!this.IsSaved) {
|
|
424
|
+
return null;
|
|
425
|
+
}
|
|
426
|
+
const oldValue = this.GetFieldByName('Attributes')?.OldValue;
|
|
427
|
+
return typeof oldValue === 'string' ? oldValue : null;
|
|
428
|
+
}
|
|
429
|
+
previousStatus() {
|
|
430
|
+
const oldValue = this.GetFieldByName('Status')?.OldValue;
|
|
431
|
+
return oldValue === 'Approved' || oldValue === 'Proposed' || oldValue === 'Rejected' ? oldValue : null;
|
|
432
|
+
}
|
|
433
|
+
stampReview(userId) {
|
|
434
|
+
const attrObj = parseAttributeObject(this.Attributes);
|
|
435
|
+
attrObj['ReviewedByUserID'] = userId;
|
|
436
|
+
attrObj['ReviewedAt'] = new Date().toISOString();
|
|
437
|
+
this.Attributes = JSON.stringify(attrObj);
|
|
438
|
+
}
|
|
439
|
+
endpointsDirty() {
|
|
440
|
+
return (!this.IsSaved ||
|
|
441
|
+
['SourceEntityID', 'SourceRecordID', 'TargetEntityID', 'TargetRecordID'].some((f) => this.GetFieldByName(f)?.Dirty === true));
|
|
442
|
+
}
|
|
443
|
+
fail(result, error) {
|
|
444
|
+
result.Errors.push(error);
|
|
445
|
+
result.Success = false;
|
|
446
|
+
return result;
|
|
447
|
+
}
|
|
448
|
+
resolveEdgeType(edgeTypeId) {
|
|
449
|
+
if (!edgeTypeId) {
|
|
450
|
+
return undefined;
|
|
451
|
+
}
|
|
452
|
+
return GraphEngine.Instance.EdgeTypes.find((et) => UUIDsEqual(et.ID, edgeTypeId));
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
MJGraphEdgeEntityServer = __decorate([
|
|
456
|
+
RegisterClass(BaseEntity, 'MJ: Graph Edges')
|
|
457
|
+
], MJGraphEdgeEntityServer);
|
|
458
|
+
export { MJGraphEdgeEntityServer };
|
|
459
|
+
//# sourceMappingURL=MJGraphEdgeEntityServer.server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MJGraphEdgeEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJGraphEdgeEntityServer.server.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAEH,UAAU,EACV,gBAAgB,EAGhB,OAAO,EAEP,2BAA2B,EAE3B,mBAAmB,EACnB,mBAAmB,GAEtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,EACH,2BAA2B,EAC3B,kBAAkB,EAClB,sCAAsC,EACtC,WAAW,EACX,mBAAmB,EACnB,iBAAiB,GAGpB,MAAM,+BAA+B,CAAC;AAEvC,oFAAoF;AACpF,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,CAAC;AAEnD,6HAA6H;AAC7H,MAAM,CAAC,MAAM,iCAAiC,GAAG,sBAAsB,CAAC;AAExE,MAAM,uBAAuB,GAAG,iBAAiB,CAAC;AAyBlD;;;GAGG;AACH,MAAM,UAAU,mCAAmC,CAC/C,cAAsB,EACtB,cAAsB,EACtB,cAAsB,EACtB,cAAsB;IAEtB,MAAM,SAAS,GAAG,kBAAkB,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;IACrE,MAAM,SAAS,GAAG,kBAAkB,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;IACrE,IAAI,SAAS,GAAG,SAAS,EAAE,CAAC;QACxB,OAAO;YACH,cAAc,EAAE,cAAc;YAC9B,cAAc,EAAE,cAAc;YAC9B,cAAc,EAAE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AAC;QACrB,CAAC;QACD,OAAO,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC;IACtF,CAAC;CACJ,CAAA;AArLY,uBAAuB;IADnC,aAAa,CAAC,UAAU,EAAE,iBAAiB,CAAC;GAChC,uBAAuB,CAqLnC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ValidationErrorInfo, ValidationResult } from '@memberjunction/core';
|
|
2
|
+
import { MJGraphEdgeProviderEntity } from '@memberjunction/core-entities';
|
|
3
|
+
/**
|
|
4
|
+
* Pure invariant check for `MJGraphEdgeProviderEntity.DriverClass`:
|
|
5
|
+
* must be non-blank and registered on `MJGlobal.Instance.ClassFactory` under `BaseGraphEdgeProvider`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function ValidateGraphEdgeProviderDriverClass(driverClass: string | null | undefined, isDriverRegistered?: (driverKey: string) => boolean): ValidationErrorInfo | null;
|
|
8
|
+
/**
|
|
9
|
+
* Pure invariant check for `MJGraphEdgeProviderEntity.Configuration`:
|
|
10
|
+
* when present and non-empty, must be a valid JSON object.
|
|
11
|
+
*/
|
|
12
|
+
export declare function ValidateGraphEdgeProviderConfigurationJson(rawConfiguration: string | null | undefined): ValidationErrorInfo | null;
|
|
13
|
+
/**
|
|
14
|
+
* Server-side `MJ: Graph Edge Providers` entity enforcing that:
|
|
15
|
+
* 1. `DriverClass` is registered in `ClassFactory` under `BaseGraphEdgeProvider`
|
|
16
|
+
* 2. `Configuration` (when non-empty) parses as a valid JSON object
|
|
17
|
+
*/
|
|
18
|
+
export declare class MJGraphEdgeProviderEntityServer extends MJGraphEdgeProviderEntity {
|
|
19
|
+
get DefaultSkipAsyncValidation(): boolean;
|
|
20
|
+
ValidateAsync(): Promise<ValidationResult>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=MJGraphEdgeProviderEntityServer.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MJGraphEdgeProviderEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJGraphEdgeProviderEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,mBAAmB,EAAuB,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE9G,OAAO,EAAyB,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAEjG;;;GAGG;AACH,wBAAgB,oCAAoC,CAChD,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACtC,kBAAkB,GAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OACiD,GAC7F,mBAAmB,GAAG,IAAI,CAsB5B;AAED;;;GAGG;AACH,wBAAgB,0CAA0C,CACtD,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC5C,mBAAmB,GAAG,IAAI,CAyB5B;AAED;;;;GAIG;AACH,qBACa,+BAAgC,SAAQ,yBAAyB;IAC1E,IAAoB,0BAA0B,IAAI,OAAO,CAExD;IAEqB,aAAa,IAAI,OAAO,CAAC,gBAAgB,CAAC;CA0BnE"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { BaseEntity, ValidationErrorInfo, ValidationErrorType } from '@memberjunction/core';
|
|
8
|
+
import { MJGlobal, RegisterClass } from '@memberjunction/global';
|
|
9
|
+
import { BaseGraphEdgeProvider, MJGraphEdgeProviderEntity } from '@memberjunction/core-entities';
|
|
10
|
+
/**
|
|
11
|
+
* Pure invariant check for `MJGraphEdgeProviderEntity.DriverClass`:
|
|
12
|
+
* must be non-blank and registered on `MJGlobal.Instance.ClassFactory` under `BaseGraphEdgeProvider`.
|
|
13
|
+
*/
|
|
14
|
+
export function ValidateGraphEdgeProviderDriverClass(driverClass, isDriverRegistered = (driverKey) => MJGlobal.Instance.ClassFactory.GetRegistration(BaseGraphEdgeProvider, driverKey) != null) {
|
|
15
|
+
if (driverClass == null) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const trimmed = driverClass.trim();
|
|
19
|
+
if (trimmed.length === 0) {
|
|
20
|
+
return new ValidationErrorInfo('DriverClass', 'DriverClass cannot be blank — it must name a registered BaseGraphEdgeProvider subclass.', driverClass, ValidationErrorType.Failure);
|
|
21
|
+
}
|
|
22
|
+
if (!isDriverRegistered(trimmed)) {
|
|
23
|
+
return new ValidationErrorInfo('DriverClass', `DriverClass "${trimmed}" is not registered under BaseGraphEdgeProvider in ClassFactory.`, driverClass, ValidationErrorType.Failure);
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Pure invariant check for `MJGraphEdgeProviderEntity.Configuration`:
|
|
29
|
+
* when present and non-empty, must be a valid JSON object.
|
|
30
|
+
*/
|
|
31
|
+
export function ValidateGraphEdgeProviderConfigurationJson(rawConfiguration) {
|
|
32
|
+
if (rawConfiguration == null || rawConfiguration.trim().length === 0) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
let parsed;
|
|
36
|
+
try {
|
|
37
|
+
parsed = JSON.parse(rawConfiguration);
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return new ValidationErrorInfo('Configuration', 'Configuration is not valid JSON.', rawConfiguration, ValidationErrorType.Failure);
|
|
41
|
+
}
|
|
42
|
+
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
43
|
+
const kind = parsed === null ? 'null' : Array.isArray(parsed) ? 'array' : typeof parsed;
|
|
44
|
+
return new ValidationErrorInfo('Configuration', `Configuration must be a JSON object (got ${kind}).`, rawConfiguration, ValidationErrorType.Failure);
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Server-side `MJ: Graph Edge Providers` entity enforcing that:
|
|
50
|
+
* 1. `DriverClass` is registered in `ClassFactory` under `BaseGraphEdgeProvider`
|
|
51
|
+
* 2. `Configuration` (when non-empty) parses as a valid JSON object
|
|
52
|
+
*/
|
|
53
|
+
let MJGraphEdgeProviderEntityServer = class MJGraphEdgeProviderEntityServer extends MJGraphEdgeProviderEntity {
|
|
54
|
+
get DefaultSkipAsyncValidation() {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
async ValidateAsync() {
|
|
58
|
+
const result = await super.ValidateAsync();
|
|
59
|
+
if (!result.Success) {
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
const driverDirty = this.GetFieldByName('DriverClass')?.Dirty ?? false;
|
|
63
|
+
if (!this.IsSaved || driverDirty) {
|
|
64
|
+
const driverError = ValidateGraphEdgeProviderDriverClass(this.DriverClass);
|
|
65
|
+
if (driverError) {
|
|
66
|
+
result.Errors.push(driverError);
|
|
67
|
+
result.Success = false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const configDirty = this.GetFieldByName('Configuration')?.Dirty ?? false;
|
|
71
|
+
if (!this.IsSaved || configDirty) {
|
|
72
|
+
const configError = ValidateGraphEdgeProviderConfigurationJson(this.Configuration);
|
|
73
|
+
if (configError) {
|
|
74
|
+
result.Errors.push(configError);
|
|
75
|
+
result.Success = false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return result;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
MJGraphEdgeProviderEntityServer = __decorate([
|
|
82
|
+
RegisterClass(BaseEntity, 'MJ: Graph Edge Providers')
|
|
83
|
+
], MJGraphEdgeProviderEntityServer);
|
|
84
|
+
export { MJGraphEdgeProviderEntityServer };
|
|
85
|
+
//# sourceMappingURL=MJGraphEdgeProviderEntityServer.server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MJGraphEdgeProviderEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJGraphEdgeProviderEntityServer.server.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,mBAAmB,EAAoB,MAAM,sBAAsB,CAAC;AAC9G,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAEjG;;;GAGG;AACH,MAAM,UAAU,oCAAoC,CAChD,WAAsC,EACtC,qBAAqD,CAAC,SAAS,EAAE,EAAE,CAC/D,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,eAAe,CAAC,qBAAqB,EAAE,SAAS,CAAC,IAAI,IAAI;IAE5F,IAAI,WAAW,IAAI,IAAI,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC;IACnC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,IAAI,mBAAmB,CAC1B,aAAa,EACb,yFAAyF,EACzF,WAAW,EACX,mBAAmB,CAAC,OAAO,CAC9B,CAAC;IACN,CAAC;IACD,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC;QAC/B,OAAO,IAAI,mBAAmB,CAC1B,aAAa,EACb,gBAAgB,OAAO,kEAAkE,EACzF,WAAW,EACX,mBAAmB,CAAC,OAAO,CAC9B,CAAC;IACN,CAAC;IACD,OAAO,I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AAM,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,KAAK,IAAI,KAAK,CAAC;QACvE,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,WAAW,EAAE,CAAC;YAC/B,MAAM,WAAW,GAAG,oCAAoC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC3E,IAAI,WAAW,EAAE,CAAC;gBACd,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;gBAChC,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC;YAC3B,CAAC;QACL,CAAC;QAED,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,KAAK,IAAI,KAAK,CAAC;QACzE,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,WAAW,EAAE,CAAC;YAC/B,MAAM,WAAW,GAAG,0CAA0C,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YACnF,IAAI,WAAW,EAAE,CAAC;gBACd,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;gBAChC,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC;YAC3B,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ,CAAA;AA/BY,+BAA+B;IAD3C,aAAa,CAAC,UAAU,EAAE,0BAA0B,CAAC;GACzC,+BAA+B,CA+B3C"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ValidationErrorInfo, ValidationResult } from '@memberjunction/core';
|
|
2
|
+
import { MJGraphEdgeTypeEntity } from '@memberjunction/core-entities';
|
|
3
|
+
/**
|
|
4
|
+
* Pure invariant check for `MJ: Graph Edge Types` `(GraphID, Name)` uniqueness,
|
|
5
|
+
* including global (`GraphID === null`) edge types.
|
|
6
|
+
*/
|
|
7
|
+
export declare function ValidateGraphEdgeTypeUniqueness(candidate: {
|
|
8
|
+
readonly ID: string | null | undefined;
|
|
9
|
+
readonly GraphID: string | null | undefined;
|
|
10
|
+
readonly Name: string | null | undefined;
|
|
11
|
+
}, existingEdgeTypes: readonly Pick<MJGraphEdgeTypeEntity, 'ID' | 'GraphID' | 'Name'>[]): ValidationErrorInfo | null;
|
|
12
|
+
/**
|
|
13
|
+
* Server-side `MJ: Graph Edge Types` entity enforcing `(GraphID, Name)` uniqueness
|
|
14
|
+
* across both graph-scoped and global (`GraphID === null`) edge types.
|
|
15
|
+
*/
|
|
16
|
+
export declare class MJGraphEdgeTypeEntityServer extends MJGraphEdgeTypeEntity {
|
|
17
|
+
get DefaultSkipAsyncValidation(): boolean;
|
|
18
|
+
ValidateAsync(): Promise<ValidationResult>;
|
|
19
|
+
private fail;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=MJGraphEdgeTypeEntityServer.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MJGraphEdgeTypeEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJGraphEdgeTypeEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,mBAAmB,EAEnB,gBAAgB,EACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAoC,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAExG;;;GAGG;AACH,wBAAgB,+BAA+B,CAC3C,SAAS,EAAE;IACP,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CAC5C,EACD,iBAAiB,EAAE,SAAS,IAAI,CAAC,qBAAqB,EAAE,IAAI,GAAG,SAAS,GAAG,MAAM,CAAC,EAAE,GACrF,mBAAmB,GAAG,IAAI,CA8B5B;AAED;;;GAGG;AACH,qBACa,2BAA4B,SAAQ,qBAAqB;IAClE,IAAoB,0BAA0B,IAAI,OAAO,CAExD;IAEqB,aAAa,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAwChE,OAAO,CAAC,IAAI;CAKf"}
|