@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
|
@@ -4,10 +4,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
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
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
import {
|
|
7
|
+
var MJMLTrainingPipelineEntityServer_1;
|
|
8
|
+
import { BaseEntity, LogStatus, ValidationErrorInfo, ValidationErrorType } from '@memberjunction/core';
|
|
9
|
+
import { EscapeSQLString, IsValidUUID, RegisterClass, UUIDsEqual } from '@memberjunction/global';
|
|
9
10
|
import { MJMLTrainingPipelineEntity } from '@memberjunction/core-entities';
|
|
10
|
-
import {
|
|
11
|
+
import { VersionedRowGuard } from './MJMLPredictionUnitEntityServer.server.js';
|
|
12
|
+
import { EvaluationProtocol, EvaluationProtocolRules, JsonParse, PredictionUnit, TaskTypeRules, validateLeakageGuard, DOMINANCE_THRESHOLD_DEFAULT, } from '@memberjunction/predictive-studio-core';
|
|
11
13
|
/**
|
|
12
14
|
* Server-side ML Training Pipeline entity. Its job is to make the leakage guard
|
|
13
15
|
* impossible to disarm by accident.
|
|
@@ -24,8 +26,14 @@ import { validateLeakageGuard, DOMINANCE_THRESHOLD_DEFAULT, } from '@memberjunct
|
|
|
24
26
|
* no real column, reaches the database. The rules themselves live in
|
|
25
27
|
* `@memberjunction/predictive-studio-core` so the editor can apply the identical
|
|
26
28
|
* checks at input time without the two ever drifting apart.
|
|
29
|
+
*
|
|
30
|
+
* It also checks the bound Prediction Unit and Evaluation Protocol (each bound ID is a well-formed ID of a row that
|
|
31
|
+
* exists and parses; the unit's rules apply only when a unit is bound) and holds a protocol rebind to the guard-field
|
|
32
|
+
* rule ({@link GetProtocolRebindProblem}). The reads run as the user the save is attributed to; see
|
|
33
|
+
* {@link VersionedRowGuard} for why that is `ActiveUser`.
|
|
27
34
|
*/
|
|
28
35
|
let MJMLTrainingPipelineEntityServer = class MJMLTrainingPipelineEntityServer extends MJMLTrainingPipelineEntity {
|
|
36
|
+
static { MJMLTrainingPipelineEntityServer_1 = this; }
|
|
29
37
|
get DefaultSkipAsyncValidation() {
|
|
30
38
|
return false;
|
|
31
39
|
}
|
|
@@ -33,17 +41,47 @@ let MJMLTrainingPipelineEntityServer = class MJMLTrainingPipelineEntityServer ex
|
|
|
33
41
|
const result = await super.ValidateAsync();
|
|
34
42
|
if (!result.Success)
|
|
35
43
|
return result;
|
|
36
|
-
|
|
37
|
-
|
|
44
|
+
await this.runLeakageGuardCheck(result);
|
|
45
|
+
if (this.needsUnitProtocolCheck())
|
|
46
|
+
await this.checkBindings(result);
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The bound unit and protocol checks, then the rebind check against the protocol they read (a rebind changes
|
|
51
|
+
* `EvaluationProtocolID`, so it always comes with these checks, and the new protocol is read once).
|
|
52
|
+
*/
|
|
53
|
+
async checkBindings(result) {
|
|
54
|
+
if (!this.PredictionUnitID && !this.EvaluationProtocolID)
|
|
55
|
+
return;
|
|
56
|
+
const provider = this.ProviderToUse;
|
|
57
|
+
if (!VersionedRowGuard.IsMetadataProvider(provider)) {
|
|
58
|
+
LogStatus(`MJMLTrainingPipelineEntityServer: the provider is not a metadata provider, so the Prediction Unit, Evaluation Protocol and protocol rebind checks were skipped for pipeline "${this.Name}"`);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const boundProtocol = await this.checkUnitAndProtocol(result, provider);
|
|
62
|
+
if (boundProtocol !== null)
|
|
63
|
+
await this.checkProtocolRebind(result, provider, boundProtocol);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Fast-path: the guard can only become newly unsound when the guard itself,
|
|
67
|
+
* or the sources its entries are checked against, are being changed.
|
|
68
|
+
*/
|
|
69
|
+
async runLeakageGuardCheck(result) {
|
|
38
70
|
if (!this.needsLeakageGuardCheck())
|
|
39
|
-
return
|
|
71
|
+
return;
|
|
40
72
|
const guard = this.parseLeakageGuard(result);
|
|
41
73
|
if (guard === null)
|
|
42
|
-
return
|
|
74
|
+
return; // parse failure already recorded
|
|
43
75
|
const context = this.buildValidationContext();
|
|
44
76
|
const issues = validateLeakageGuard(guard, context);
|
|
45
77
|
this.applyIssues(result, issues);
|
|
46
|
-
|
|
78
|
+
}
|
|
79
|
+
/** Whether the unit and protocol (and a protocol rebind) need re-checking: on insert, or when any column they read changes. */
|
|
80
|
+
needsUnitProtocolCheck() {
|
|
81
|
+
if (!this.IsSaved)
|
|
82
|
+
return true;
|
|
83
|
+
return ['PredictionUnitID', 'EvaluationProtocolID', 'TargetEntityID', 'ProblemType', 'TargetVariable']
|
|
84
|
+
.some((name) => this.GetFieldByName(name)?.Dirty === true);
|
|
47
85
|
}
|
|
48
86
|
/**
|
|
49
87
|
* Whether the leakage guard needs re-checking on this save. It does on insert,
|
|
@@ -67,7 +105,7 @@ let MJMLTrainingPipelineEntityServer = class MJMLTrainingPipelineEntityServer ex
|
|
|
67
105
|
*/
|
|
68
106
|
parseLeakageGuard(result) {
|
|
69
107
|
const raw = this.LeakageGuard;
|
|
70
|
-
if (raw
|
|
108
|
+
if ((raw === null || raw === undefined) || raw.trim().length === 0) {
|
|
71
109
|
return { DenyFields: [], SingleFeatureDominanceThreshold: DOMINANCE_THRESHOLD_DEFAULT };
|
|
72
110
|
}
|
|
73
111
|
try {
|
|
@@ -100,7 +138,8 @@ let MJMLTrainingPipelineEntityServer = class MJMLTrainingPipelineEntityServer ex
|
|
|
100
138
|
*/
|
|
101
139
|
buildValidationContext() {
|
|
102
140
|
const bindings = this.parseSourceBindings();
|
|
103
|
-
const
|
|
141
|
+
const dataProvider = this.ProviderToUse;
|
|
142
|
+
const provider = VersionedRowGuard.IsMetadataProvider(dataProvider) ? dataProvider : undefined;
|
|
104
143
|
const columns = [];
|
|
105
144
|
let fullyResolved = true;
|
|
106
145
|
const targetEntity = this.TargetEntityID ? provider?.EntityByID(this.TargetEntityID) : undefined;
|
|
@@ -135,7 +174,7 @@ let MJMLTrainingPipelineEntityServer = class MJMLTrainingPipelineEntityServer ex
|
|
|
135
174
|
/** Parse the `SourceBindings` JSON column, tolerating null/blank/garbage. */
|
|
136
175
|
parseSourceBindings() {
|
|
137
176
|
const raw = this.SourceBindings;
|
|
138
|
-
if (raw
|
|
177
|
+
if ((raw === null || raw === undefined) || raw.trim().length === 0)
|
|
139
178
|
return [];
|
|
140
179
|
try {
|
|
141
180
|
const parsed = JSON.parse(raw);
|
|
@@ -149,6 +188,221 @@ let MJMLTrainingPipelineEntityServer = class MJMLTrainingPipelineEntityServer ex
|
|
|
149
188
|
return [];
|
|
150
189
|
}
|
|
151
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* A pipeline that names a unit must agree with it: the legacy TargetEntityID/ProblemType/TargetVariable are derived
|
|
193
|
+
* from the unit. Pure.
|
|
194
|
+
*/
|
|
195
|
+
static GetPipelineUnitProblems(pipeline, unit) {
|
|
196
|
+
const problems = [];
|
|
197
|
+
const taskJson = JsonParse.ParseJsonText(unit.TaskType, 'TaskType');
|
|
198
|
+
const task = taskJson.Ok === true ? TaskTypeRules.ParseTaskType(taskJson.Value) : null;
|
|
199
|
+
const taskKind = task !== null && task.Ok === true ? task.Value.kind : null;
|
|
200
|
+
if (!UUIDsEqual(pipeline.TargetEntityID, unit.RowEntityID)) {
|
|
201
|
+
problems.push(`TargetEntityID must be the unit's row entity (${unit.RowEntityID}) when PredictionUnitID is set`);
|
|
202
|
+
}
|
|
203
|
+
// One derivation of the legacy value (TaskTypeRules), shared with every writer of ProblemType.
|
|
204
|
+
const expectedProblemType = task !== null && task.Ok === true ? TaskTypeRules.LegacyProblemTypeForTask(task.Value) : 'regression';
|
|
205
|
+
if (pipeline.ProblemType !== expectedProblemType)
|
|
206
|
+
problems.push(`ProblemType must be ${expectedProblemType} for a ${taskKind || 'unknown'} unit`);
|
|
207
|
+
if (pipeline.TargetVariable !== unit.DescribedLabel)
|
|
208
|
+
problems.push(`TargetVariable must read "${unit.DescribedLabel}" (the unit's outcome rule)`);
|
|
209
|
+
return problems;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Why the bound protocol cannot be used with the unit: the protocol rules that need a unit (the primary score's
|
|
213
|
+
* family is the unit's task, the holdout kind fits the unit, lags and windows and blocked-time gaps cover the
|
|
214
|
+
* horizon, grouping keys are the unit's, a grouped unit's inner folds group (`inner-validation-ungrouped`), a grouped
|
|
215
|
+
* non-forecast unit's intervals are cluster-bootstrap (`intervals-not-clustered`), and what a forecast can be
|
|
216
|
+
* evaluated with), each as its sentence; or why
|
|
217
|
+
* the protocol row does not parse. Empty when the protocol fits. Pure.
|
|
218
|
+
*/
|
|
219
|
+
static GetProtocolUnitProblems(protocol, unit) {
|
|
220
|
+
const parsed = EvaluationProtocol.ParseEvaluationProtocolRow(protocol);
|
|
221
|
+
if (parsed.Ok === false)
|
|
222
|
+
return [MJMLTrainingPipelineEntityServer_1.unparseableProtocol(protocol, parsed.Errors)];
|
|
223
|
+
return EvaluationProtocolRules.ValidateProtocolForUnit(parsed.Value, unit).map((r) => EvaluationProtocolRules.DescribeProtocolRefusal(r));
|
|
224
|
+
}
|
|
225
|
+
/** The refusal for a protocol row that does not parse. */
|
|
226
|
+
static unparseableProtocol(protocol, errors) {
|
|
227
|
+
return `Evaluation Protocol ${protocol.ID} does not parse: ${errors.join('; ')}`;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* The bound unit and protocol: each bound ID must be a well-formed ID of a row that is read and exists, and a bound
|
|
231
|
+
* protocol must parse, with or without a unit. With a unit, the unit must parse, the legacy columns must agree with
|
|
232
|
+
* it and the protocol must fit it. Returns the bound protocol row when it was read and parses (the rebind check
|
|
233
|
+
* compares it), else null; every refusal is recorded on `result`.
|
|
234
|
+
*/
|
|
235
|
+
async checkUnitAndProtocol(result, provider) {
|
|
236
|
+
const unitID = this.PredictionUnitID;
|
|
237
|
+
const protocolID = this.EvaluationProtocolID;
|
|
238
|
+
if (!this.boundIDsWellFormed(result, unitID, protocolID))
|
|
239
|
+
return null;
|
|
240
|
+
const { Unit: unitRead, Protocol: protocolRead } = await this.loadUnitAndProtocol(provider, unitID, protocolID);
|
|
241
|
+
const unitRow = unitRead === null ? null : this.readRowOrFail(result, 'PredictionUnitID', `Prediction Unit ${unitID}`, unitRead);
|
|
242
|
+
if (unitRead !== null && !unitRow)
|
|
243
|
+
return null;
|
|
244
|
+
const protocol = protocolRead === null ? null : this.readRowOrFail(result, 'EvaluationProtocolID', `Evaluation Protocol ${protocolID}`, protocolRead);
|
|
245
|
+
if (protocolRead !== null && !protocol)
|
|
246
|
+
return null;
|
|
247
|
+
const unit = unitRow === null ? null : this.checkUnitRow(result, provider, unitRow);
|
|
248
|
+
if (protocol === null || !this.protocolParses(result, protocol))
|
|
249
|
+
return null;
|
|
250
|
+
if (unit !== null) {
|
|
251
|
+
for (const problem of MJMLTrainingPipelineEntityServer_1.GetProtocolUnitProblems(protocol, unit)) {
|
|
252
|
+
VersionedRowGuard.Fail(result, 'EvaluationProtocolID', problem);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return protocol;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Whether every bound ID is a well-formed ID; each malformed one is recorded. Checked before reading, so a malformed
|
|
259
|
+
* ID is refused in words rather than surfacing as the database's conversion error.
|
|
260
|
+
*/
|
|
261
|
+
boundIDsWellFormed(result, unitID, protocolID) {
|
|
262
|
+
const bound = [['PredictionUnitID', unitID], ['EvaluationProtocolID', protocolID]];
|
|
263
|
+
const malformed = bound.filter(([, id]) => !!id && !IsValidUUID(id));
|
|
264
|
+
for (const [field, id] of malformed)
|
|
265
|
+
VersionedRowGuard.Fail(result, field, `${field} "${id}" is not a valid ID`);
|
|
266
|
+
return malformed.length === 0;
|
|
267
|
+
}
|
|
268
|
+
/** The bound unit's parsed form, with the legacy columns' disagreements recorded; null (recorded) when it does not parse. */
|
|
269
|
+
checkUnitRow(result, provider, unitRow) {
|
|
270
|
+
const spec = PredictionUnit.ParsePredictionUnitRow(unitRow);
|
|
271
|
+
if (spec.Ok === false) {
|
|
272
|
+
VersionedRowGuard.Fail(result, 'PredictionUnitID', `Prediction Unit ${this.PredictionUnitID} does not parse: ${spec.Errors.join('; ')}`);
|
|
273
|
+
return null;
|
|
274
|
+
}
|
|
275
|
+
const rowEntityName = PredictionUnit.UnitRowEntityName(spec.Value.rows);
|
|
276
|
+
const facts = {
|
|
277
|
+
TaskType: unitRow.TaskType,
|
|
278
|
+
RowEntityID: provider.EntityByName(rowEntityName)?.ID || `(unknown entity ${rowEntityName})`,
|
|
279
|
+
DescribedLabel: PredictionUnit.DescribeLabelRule(spec.Value),
|
|
280
|
+
};
|
|
281
|
+
for (const problem of MJMLTrainingPipelineEntityServer_1.GetPipelineUnitProblems(this, facts)) {
|
|
282
|
+
VersionedRowGuard.Fail(result, 'PredictionUnitID', problem);
|
|
283
|
+
}
|
|
284
|
+
return spec.Value;
|
|
285
|
+
}
|
|
286
|
+
/** Whether the bound protocol row parses; the refusal is recorded when it does not. */
|
|
287
|
+
protocolParses(result, protocol) {
|
|
288
|
+
const parsed = EvaluationProtocol.ParseEvaluationProtocolRow(protocol);
|
|
289
|
+
if (parsed.Ok === false)
|
|
290
|
+
VersionedRowGuard.Fail(result, 'EvaluationProtocolID', MJMLTrainingPipelineEntityServer_1.unparseableProtocol(protocol, parsed.Errors));
|
|
291
|
+
return parsed.Ok === true;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Reads the bound unit row and the bound protocol row (every column of each, for the parsers), in parallel, as
|
|
295
|
+
* plain rows (nothing is mutated), each only when bound. A failed read carries its error, so it is never reported as
|
|
296
|
+
* "not found".
|
|
297
|
+
*/
|
|
298
|
+
async loadUnitAndProtocol(provider, unitID, protocolID) {
|
|
299
|
+
const user = this.ActiveUser;
|
|
300
|
+
const [unit, protocol] = await Promise.all([
|
|
301
|
+
unitID
|
|
302
|
+
? VersionedRowGuard.ReadOneRow(provider, 'MJ: ML Prediction Units', `ID='${EscapeSQLString(unitID)}'`, user)
|
|
303
|
+
: null,
|
|
304
|
+
protocolID
|
|
305
|
+
? VersionedRowGuard.ReadOneRow(provider, 'MJ: ML Evaluation Protocols', `ID='${EscapeSQLString(protocolID)}'`, user)
|
|
306
|
+
: null,
|
|
307
|
+
]);
|
|
308
|
+
return { Unit: unit, Protocol: protocol };
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Moving a saved pipeline from one protocol to another changes the guard fields it trains under without saving a
|
|
312
|
+
* version of the bound lineage, so the move is held to the guard-field rule ({@link GetProtocolRebindProblem}).
|
|
313
|
+
* `to` is the new protocol as {@link checkUnitAndProtocol} read and parsed it; the previous one is read here.
|
|
314
|
+
*
|
|
315
|
+
* Two moves pass this check by construction (owner flag vvv): an agent acting through its human user's session
|
|
316
|
+
* saves as that user, so it is indistinguishable from the user here; and an unbind to no protocol followed by a
|
|
317
|
+
* bind is two saves, neither of which moves from one protocol to another.
|
|
318
|
+
*/
|
|
319
|
+
async checkProtocolRebind(result, provider, to) {
|
|
320
|
+
if (!this.IsSaved)
|
|
321
|
+
return;
|
|
322
|
+
const field = this.GetFieldByName('EvaluationProtocolID');
|
|
323
|
+
const fromID = field?.Dirty === true ? field.OldValue : null;
|
|
324
|
+
if (!fromID || UUIDsEqual(fromID, this.EvaluationProtocolID))
|
|
325
|
+
return;
|
|
326
|
+
const user = this.ActiveUser;
|
|
327
|
+
const fromRead = await VersionedRowGuard.ReadOneRow(provider, 'MJ: ML Evaluation Protocols', `ID='${EscapeSQLString(fromID)}'`, user);
|
|
328
|
+
const from = this.readRowOrFail(result, 'EvaluationProtocolID', `Evaluation Protocol ${fromID}`, fromRead);
|
|
329
|
+
if (!from)
|
|
330
|
+
return;
|
|
331
|
+
const problem = MJMLTrainingPipelineEntityServer_1.GetProtocolRebindProblem(from, to, MJMLTrainingPipelineEntityServer_1.RebindingActor(user));
|
|
332
|
+
if (problem !== null)
|
|
333
|
+
VersionedRowGuard.Fail(result, 'EvaluationProtocolID', problem);
|
|
334
|
+
}
|
|
335
|
+
/** The `system` component named for a rebind saved with no user. */
|
|
336
|
+
static { this.NO_USER_COMPONENT = 'ML Training Pipeline save with no user'; }
|
|
337
|
+
/**
|
|
338
|
+
* Who performs a rebind: the user the save is attributed to, as a `human` actor; with no user, a `system` actor. An
|
|
339
|
+
* agent acting through its human user's session is that user here (owner flag vvv). Pure.
|
|
340
|
+
*/
|
|
341
|
+
static RebindingActor(user) {
|
|
342
|
+
return user ? { kind: 'human', userId: user.ID } : { kind: 'system', component: MJMLTrainingPipelineEntityServer_1.NO_USER_COMPONENT };
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Why a pipeline may not move from protocol `from` to protocol `to`; null when it may. Pure.
|
|
346
|
+
*
|
|
347
|
+
* - A forward move within one lineage (`to.Version > from.Version`) is allowed: each later version's own save
|
|
348
|
+
* checked its guard-field change against the version before it.
|
|
349
|
+
* - A backward move within one lineage (a downgrade) and any move to another lineage, when the guard fields differ
|
|
350
|
+
* ({@link EvaluationProtocolRules.ChangedGuardFields}), is allowed only when both `to`'s author and the rebinding
|
|
351
|
+
* actor may change guard fields under `from`'s `GuardFieldsEditableBy`
|
|
352
|
+
* ({@link EvaluationProtocolRules.MayEditGuardFields}). The author alone is not enough: it is who wrote `to`, not
|
|
353
|
+
* who is moving the pipeline onto it.
|
|
354
|
+
* - Either row not parsing is a refusal.
|
|
355
|
+
*
|
|
356
|
+
* @param rebinder who performs the move ({@link RebindingActor})
|
|
357
|
+
*/
|
|
358
|
+
static GetProtocolRebindProblem(from, to, rebinder) {
|
|
359
|
+
const previous = EvaluationProtocol.ParseEvaluationProtocolRow(from);
|
|
360
|
+
if (previous.Ok === false)
|
|
361
|
+
return MJMLTrainingPipelineEntityServer_1.unparseableProtocol(from, previous.Errors);
|
|
362
|
+
const next = EvaluationProtocol.ParseEvaluationProtocolRow(to);
|
|
363
|
+
if (next.Ok === false)
|
|
364
|
+
return MJMLTrainingPipelineEntityServer_1.unparseableProtocol(to, next.Errors);
|
|
365
|
+
const sameLineage = UUIDsEqual(from.LineageRootID, to.LineageRootID);
|
|
366
|
+
if (sameLineage && to.Version > from.Version)
|
|
367
|
+
return null;
|
|
368
|
+
const changed = EvaluationProtocolRules.ChangedGuardFields(previous.Value, next.Value);
|
|
369
|
+
if (changed.length === 0)
|
|
370
|
+
return null;
|
|
371
|
+
const setting = previous.Value.guardFieldsEditableBy;
|
|
372
|
+
const refused = [
|
|
373
|
+
...(EvaluationProtocolRules.MayEditGuardFields(next.Value.authoredBy, setting) ? [] : [`the target protocol's author (${next.Value.authoredBy.kind})`]),
|
|
374
|
+
...(EvaluationProtocolRules.MayEditGuardFields(rebinder, setting) ? [] : [`the rebinding actor (${MJMLTrainingPipelineEntityServer_1.describeActor(rebinder)})`]),
|
|
375
|
+
];
|
|
376
|
+
if (refused.length === 0)
|
|
377
|
+
return null;
|
|
378
|
+
const move = sameLineage ? `a downgrade from version ${from.Version} to version ${to.Version} of the same lineage` : 'another lineage';
|
|
379
|
+
return `Binding Evaluation Protocol ${to.ID} in place of ${from.ID} (${move}) changes the guard fields ${changed.join(', ')}, ` +
|
|
380
|
+
`which ${from.ID}'s GuardFieldsEditableBy "${setting}" lets ${MJMLTrainingPipelineEntityServer_1.describeEditors(setting)} change; ` +
|
|
381
|
+
`refused for ${refused.join(' and ')}.`;
|
|
382
|
+
}
|
|
383
|
+
/** Who may change guard fields under a setting, in words (the rule is {@link EvaluationProtocolRules.MayEditGuardFields}). */
|
|
384
|
+
static describeEditors(setting) {
|
|
385
|
+
return setting === 'non-agent' ? 'any author but an agent tool call' : 'only a user';
|
|
386
|
+
}
|
|
387
|
+
/** An actor in a refusal: its kind, and the user or component it names. */
|
|
388
|
+
static describeActor(actor) {
|
|
389
|
+
switch (actor.kind) {
|
|
390
|
+
case 'human': return `user ${actor.userId}`;
|
|
391
|
+
case 'system': return `system: ${actor.component}`;
|
|
392
|
+
case 'agent': return `agent run ${actor.agentRunId}`;
|
|
393
|
+
case 'scheduled-job': return `scheduled job run ${actor.scheduledJobRunId}`;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
/** The row a read returned; null with "Reading … failed" or "… was not found" recorded on `field`. */
|
|
397
|
+
readRowOrFail(result, field, what, read) {
|
|
398
|
+
if (read.Error !== null) {
|
|
399
|
+
VersionedRowGuard.Fail(result, field, `Reading ${what} failed: ${read.Error}`);
|
|
400
|
+
return null;
|
|
401
|
+
}
|
|
402
|
+
if (!read.Row)
|
|
403
|
+
VersionedRowGuard.Fail(result, field, `${what} was not found`);
|
|
404
|
+
return read.Row;
|
|
405
|
+
}
|
|
152
406
|
/** Fold guard issues into the entity's ValidationResult. */
|
|
153
407
|
applyIssues(result, issues) {
|
|
154
408
|
for (const issue of issues) {
|
|
@@ -160,7 +414,7 @@ let MJMLTrainingPipelineEntityServer = class MJMLTrainingPipelineEntityServer ex
|
|
|
160
414
|
}
|
|
161
415
|
}
|
|
162
416
|
};
|
|
163
|
-
MJMLTrainingPipelineEntityServer = __decorate([
|
|
417
|
+
MJMLTrainingPipelineEntityServer = MJMLTrainingPipelineEntityServer_1 = __decorate([
|
|
164
418
|
RegisterClass(BaseEntity, 'MJ: ML Training Pipelines')
|
|
165
419
|
], MJMLTrainingPipelineEntityServer);
|
|
166
420
|
export { MJMLTrainingPipelineEntityServer };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MJMLTrainingPipelineEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJMLTrainingPipelineEntityServer.server.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAiC,mBAAmB,EAAE,mBAAmB,EAAoB,MAAM,sBAAsB,CAAC;AAC7I,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EACH,oBAAoB,EACpB,2BAA2B,GAK9B,MAAM,wCAAwC,CAAC;AAEhD;;;;;;;;;;;;;;;;GAgBG;AAEI,IAAM,gCAAgC,GAAtC,MAAM,gCAAiC,SAAQ,0BAA0B;IAE5E,IAAoB,0BAA0B;QAC1C,OAAO,KAAK,CAAC;IACjB,CAAC;IAEe,KAAK,CAAC,aAAa;QAC/B,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,aAAa,EAAE,CAAC;QAC3C,IAAI,CAAC,MAAM,CAAC,OAAO;YAAE,OAAO,MAAM,CAAC;QAEnC,4EAA4E;Q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ACL,CAAC;IAED,4DAA4D;IACpD,WAAW,CAAC,MAAwB,EAAE,MAA2B;QACrE,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YACzB,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC;YACtG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,mBAAmB,CAAC,cAAc,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;YAC9F,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC/B,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC;YAC3B,CAAC;QACL,CAAC;IACL,CAAC;CACJ,CAAA;AArJY,gCAAgC;IAD5C,aAAa,CAAC,UAAU,EAAE,2BAA2B,CAAC;GAC1C,gCAAgC,CAqJ5C;;AAED;;;GAGG;AACH,MAAM,UAAU,oCAAoC;IAChD,QAAQ;AACZ,CAAC"}
|
|
1
|
+
{"version":3,"file":"MJMLTrainingPipelineEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJMLTrainingPipelineEntityServer.server.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,UAAU,EAAsD,SAAS,EAAY,mBAAmB,EAAE,mBAAmB,EAAoB,MAAM,sBAAsB,CAAC;AACvL,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAgB,MAAM,yCAAyC,CAAC;AAC1F,OAAO,EACH,kBAAkB,EAClB,uBAAuB,EACvB,SAAS,EACT,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,2BAA2B,GAU9B,MAAM,wCAAwC,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type EntitySaveOptions, type ValidationResult } from '@memberjunction/core';
|
|
2
|
+
import { MJMLTrainingSnapshotEntity } from '@memberjunction/core-entities';
|
|
3
|
+
/** The snapshot columns the row check reads: the read-complete flag and the five content hashes. */
|
|
4
|
+
export type SnapshotHashFields = Pick<MJMLTrainingSnapshotEntity, 'ReadComplete' | 'ContentHash' | 'MatrixSha256' | 'RowManifestSha256' | 'ProvenanceSha256' | 'FeatureSchemaHash'>;
|
|
5
|
+
/** `MJ: ML Training Snapshots`: written once by the snapshot builder, never updated, by an ordinary save or by a `ReplayOnly` one. */
|
|
6
|
+
export declare class MJMLTrainingSnapshotEntityServer extends MJMLTrainingSnapshotEntity {
|
|
7
|
+
private static readonly SHA256_HEX;
|
|
8
|
+
/** A snapshot exists only for a complete read and carries five well-formed hashes. Pure. */
|
|
9
|
+
static GetTrainingSnapshotRowProblems(row: SnapshotHashFields): string[];
|
|
10
|
+
Validate(): ValidationResult;
|
|
11
|
+
/** A `ReplayOnly` save of a saved snapshot is refused: it skips {@link Validate}, which refuses the update, but still writes. */
|
|
12
|
+
Save(options?: EntitySaveOptions): Promise<boolean>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=MJMLTrainingSnapshotEntityServer.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MJMLTrainingSnapshotEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJMLTrainingSnapshotEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAEjG,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAG3E,oGAAoG;AACpG,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,0BAA0B,EAAE,cAAc,GAAG,aAAa,GAAG,cAAc,GAAG,mBAAmB,GAAG,kBAAkB,GAAG,mBAAmB,CAAC,CAAC;AAEpL,sIAAsI;AACtI,qBACa,gCAAiC,SAAQ,0BAA0B;IAC9E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAoB;IAEtD,4FAA4F;WAC9E,8BAA8B,CAAC,GAAG,EAAE,kBAAkB,GAAG,MAAM,EAAE;IAY/D,QAAQ,IAAI,gBAAgB;IAI5C,iIAAiI;IAC3G,IAAI,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;CAG1E"}
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
var MJMLTrainingSnapshotEntityServer_1;
|
|
8
|
+
import { BaseEntity } from '@memberjunction/core';
|
|
9
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
10
|
+
import { MJMLTrainingSnapshotEntity } from '@memberjunction/core-entities';
|
|
11
|
+
import { VersionedRowGuard } from './MJMLPredictionUnitEntityServer.server.js';
|
|
12
|
+
/** `MJ: ML Training Snapshots`: written once by the snapshot builder, never updated, by an ordinary save or by a `ReplayOnly` one. */
|
|
13
|
+
let MJMLTrainingSnapshotEntityServer = class MJMLTrainingSnapshotEntityServer extends MJMLTrainingSnapshotEntity {
|
|
14
|
+
static { MJMLTrainingSnapshotEntityServer_1 = this; }
|
|
15
|
+
static { this.SHA256_HEX = /^[0-9a-f]{64}$/; }
|
|
16
|
+
/** A snapshot exists only for a complete read and carries five well-formed hashes. Pure. */
|
|
17
|
+
static GetTrainingSnapshotRowProblems(row) {
|
|
18
|
+
const problems = [];
|
|
19
|
+
if (row.ReadComplete !== true)
|
|
20
|
+
problems.push('ReadComplete must be true: a snapshot exists only for a complete read');
|
|
21
|
+
for (const [name, value] of [
|
|
22
|
+
['ContentHash', row.ContentHash], ['MatrixSha256', row.MatrixSha256], ['RowManifestSha256', row.RowManifestSha256],
|
|
23
|
+
['ProvenanceSha256', row.ProvenanceSha256], ['FeatureSchemaHash', row.FeatureSchemaHash],
|
|
24
|
+
]) {
|
|
25
|
+
if (!MJMLTrainingSnapshotEntityServer_1.SHA256_HEX.test(value))
|
|
26
|
+
problems.push(`${name} must be 64 lower-case hex characters`);
|
|
27
|
+
}
|
|
28
|
+
return problems;
|
|
29
|
+
}
|
|
30
|
+
Validate() {
|
|
31
|
+
return VersionedRowGuard.AddProblems(this, super.Validate(), 'ContentHash', 'ContentHash', () => MJMLTrainingSnapshotEntityServer_1.GetTrainingSnapshotRowProblems(this));
|
|
32
|
+
}
|
|
33
|
+
/** A `ReplayOnly` save of a saved snapshot is refused: it skips {@link Validate}, which refuses the update, but still writes. */
|
|
34
|
+
async Save(options) {
|
|
35
|
+
return VersionedRowGuard.SaveRefusingSavedRowReplay(this, options, () => super.Save(options));
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
MJMLTrainingSnapshotEntityServer = MJMLTrainingSnapshotEntityServer_1 = __decorate([
|
|
39
|
+
RegisterClass(BaseEntity, 'MJ: ML Training Snapshots')
|
|
40
|
+
], MJMLTrainingSnapshotEntityServer);
|
|
41
|
+
export { MJMLTrainingSnapshotEntityServer };
|
|
42
|
+
//# sourceMappingURL=MJMLTrainingSnapshotEntityServer.server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MJMLTrainingSnapshotEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJMLTrainingSnapshotEntityServer.server.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,UAAU,EAAiD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I,CAAC,OAA2B;QACpD,OAAO,iBAAiB,CAAC,0BAA0B,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAChG,CAAC;;AAvBU,gCAAgC;IAD5C,aAAa,CAAC,UAAU,EAAE,2BAA2B,CAAC;GAC1C,gCAAgC,CAwB5C"}
|
|
@@ -1,14 +1,40 @@
|
|
|
1
|
-
import { ValidationResult } from '@memberjunction/core';
|
|
1
|
+
import { EntityDeleteOptions, ValidationResult } from '@memberjunction/core';
|
|
2
2
|
import { MJProjectEntityExtended } from '@memberjunction/core-entities';
|
|
3
3
|
/**
|
|
4
4
|
* Server-side `MJ: Projects` (conversation folder) entity.
|
|
5
5
|
*
|
|
6
6
|
* Keeps a folder's owner and place in its owner's hands: see {@link checkFolderOwnerOnlyChange}. Uses the
|
|
7
7
|
* synchronous `Validate()` so the rule runs on every save, like `MJConversationEntityServer`. `ValidateAsync()`
|
|
8
|
-
* refuses a parent that would make the folder its own ancestor.
|
|
8
|
+
* refuses a parent that would make the folder its own ancestor. `Delete()` empties the folder first, for a caller
|
|
9
|
+
* who may delete it but cannot reach everything inside it: see {@link Delete}.
|
|
9
10
|
*/
|
|
10
11
|
export declare class MJProjectEntityServer extends MJProjectEntityExtended {
|
|
11
12
|
Validate(): ValidationResult;
|
|
13
|
+
/**
|
|
14
|
+
* Deletes the folder after moving what it holds out of it, in one transaction.
|
|
15
|
+
*
|
|
16
|
+
* `Project.ParentID` and `Conversation.ProjectID` are RESTRICT foreign keys, so a folder that still holds a
|
|
17
|
+
* subfolder or a conversation cannot be deleted. The client (`ConversationEngine.DeleteProject`) moves the rows
|
|
18
|
+
* it can change first, but a user whose folder writes are row-filtered (the UI role: own folders only) cannot
|
|
19
|
+
* change another user's subfolder or conversation inside their Shared folder, so the delete would fail on the
|
|
20
|
+
* foreign key. When the caller may delete this folder (the Delete permission and its row-level filter both
|
|
21
|
+
* pass), its direct subfolders move up to its parent and its conversations leave it, written as the system user,
|
|
22
|
+
* in the same transaction as the delete. A caller who may not delete it gets the provider's refusal as before,
|
|
23
|
+
* with nothing moved. A delete that already runs in a transaction group is left to that group.
|
|
24
|
+
*/
|
|
25
|
+
Delete(options?: EntityDeleteOptions): Promise<boolean>;
|
|
26
|
+
/**
|
|
27
|
+
* True when the caller holds Delete on folders and this folder passes their Delete row-level filter. Checked
|
|
28
|
+
* here, before anything moves, because the provider checks only the folder itself and only after the before-delete
|
|
29
|
+
* hooks. Reads as the system user, with the caller's own filter as the condition.
|
|
30
|
+
*/
|
|
31
|
+
private callerMayDelete;
|
|
32
|
+
/** The IDs of the folder's direct subfolders and conversations, read as the system user; a message on failure. */
|
|
33
|
+
private readContents;
|
|
34
|
+
/** Queues the moves and this delete in one transaction group and submits it. */
|
|
35
|
+
private deleteWithContentsMoved;
|
|
36
|
+
/** Records a refused delete so the caller reads the reason from `LatestResult`. */
|
|
37
|
+
private refuseDelete;
|
|
12
38
|
ValidateAsync(): Promise<ValidationResult>;
|
|
13
39
|
/**
|
|
14
40
|
* Refuses a `ParentID` that makes the folder its own ancestor. The sidebar builds the tree from the top, so a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MJProjectEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJProjectEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"MJProjectEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJProjectEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,mBAAmB,EAOnB,gBAAgB,EAEnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAA2D,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAIjI;;;;;;;GAOG;AACH,qBACa,qBAAsB,SAAQ,uBAAuB;IAC9C,QAAQ,IAAI,gBAAgB;IAU5C;;;;;;;;;;;OAWG;IACmB,MAAM,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC;IAmB7E;;;;OAIG;YACW,eAAe;IAe7B,kHAAkH;YACpG,YAAY;IAmB1B,gFAAgF;YAClE,uBAAuB;IA0CrC,mFAAmF;IACnF,OAAO,CAAC,YAAY;IAWE,aAAa,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAUhE;;;;;OAKG;YACW,gBAAgB;CA6BjC"}
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
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
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { BaseEntity, RunView, ValidationErrorInfo, ValidationErrorType, WellKnownUserSource } from '@memberjunction/core';
|
|
7
|
+
import { BaseEntity, BaseEntityResult, EntityPermissionType, RunView, ValidationErrorInfo, ValidationErrorType, WellKnownUserSource } from '@memberjunction/core';
|
|
8
8
|
import { EscapeSQLString, RegisterClass, UUIDsEqual } from '@memberjunction/global';
|
|
9
9
|
import { MAX_BRANCH_DEPTH, MJProjectEntityExtended } from '@memberjunction/core-entities';
|
|
10
10
|
import { UserCache } from '@memberjunction/generic-database-provider';
|
|
@@ -14,7 +14,8 @@ import { IsSetByTransactionVariable } from './anonymousOwnershipKeyGuard.js';
|
|
|
14
14
|
*
|
|
15
15
|
* Keeps a folder's owner and place in its owner's hands: see {@link checkFolderOwnerOnlyChange}. Uses the
|
|
16
16
|
* synchronous `Validate()` so the rule runs on every save, like `MJConversationEntityServer`. `ValidateAsync()`
|
|
17
|
-
* refuses a parent that would make the folder its own ancestor.
|
|
17
|
+
* refuses a parent that would make the folder its own ancestor. `Delete()` empties the folder first, for a caller
|
|
18
|
+
* who may delete it but cannot reach everything inside it: see {@link Delete}.
|
|
18
19
|
*/
|
|
19
20
|
let MJProjectEntityServer = class MJProjectEntityServer extends MJProjectEntityExtended {
|
|
20
21
|
Validate() {
|
|
@@ -26,6 +27,118 @@ let MJProjectEntityServer = class MJProjectEntityServer extends MJProjectEntityE
|
|
|
26
27
|
}
|
|
27
28
|
return result;
|
|
28
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Deletes the folder after moving what it holds out of it, in one transaction.
|
|
32
|
+
*
|
|
33
|
+
* `Project.ParentID` and `Conversation.ProjectID` are RESTRICT foreign keys, so a folder that still holds a
|
|
34
|
+
* subfolder or a conversation cannot be deleted. The client (`ConversationEngine.DeleteProject`) moves the rows
|
|
35
|
+
* it can change first, but a user whose folder writes are row-filtered (the UI role: own folders only) cannot
|
|
36
|
+
* change another user's subfolder or conversation inside their Shared folder, so the delete would fail on the
|
|
37
|
+
* foreign key. When the caller may delete this folder (the Delete permission and its row-level filter both
|
|
38
|
+
* pass), its direct subfolders move up to its parent and its conversations leave it, written as the system user,
|
|
39
|
+
* in the same transaction as the delete. A caller who may not delete it gets the provider's refusal as before,
|
|
40
|
+
* with nothing moved. A delete that already runs in a transaction group is left to that group.
|
|
41
|
+
*/
|
|
42
|
+
async Delete(options) {
|
|
43
|
+
const user = this.ContextCurrentUser;
|
|
44
|
+
const systemUser = UserCache.Instance.GetSystemUser();
|
|
45
|
+
if (!user || !systemUser || !this.IsSaved || this.TransactionGroup || options?.ReplayOnly) {
|
|
46
|
+
return super.Delete(options);
|
|
47
|
+
}
|
|
48
|
+
if (!(await this.callerMayDelete(user, systemUser))) {
|
|
49
|
+
return super.Delete(options);
|
|
50
|
+
}
|
|
51
|
+
const contents = await this.readContents(systemUser);
|
|
52
|
+
if (typeof contents === 'string') {
|
|
53
|
+
return this.refuseDelete(contents);
|
|
54
|
+
}
|
|
55
|
+
if (contents.FolderIDs.length === 0 && contents.ConversationIDs.length === 0) {
|
|
56
|
+
return super.Delete(options);
|
|
57
|
+
}
|
|
58
|
+
return this.deleteWithContentsMoved(contents, systemUser, options);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* True when the caller holds Delete on folders and this folder passes their Delete row-level filter. Checked
|
|
62
|
+
* here, before anything moves, because the provider checks only the folder itself and only after the before-delete
|
|
63
|
+
* hooks. Reads as the system user, with the caller's own filter as the condition.
|
|
64
|
+
*/
|
|
65
|
+
async callerMayDelete(user, systemUser) {
|
|
66
|
+
if (!this.EntityInfo.GetUserPermisions(user).CanDelete) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
const filter = this.EntityInfo.GetEffectiveRowFilterWhereClause(user, EntityPermissionType.Delete, '');
|
|
70
|
+
if (!filter) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
const read = await new RunView(this.RunViewProviderToUse).RunView({ EntityName: 'MJ: Projects', ExtraFilter: `ID='${EscapeSQLString(this.ID)}' AND (${filter})`, Fields: ['ID'], ResultType: 'simple' }, systemUser);
|
|
74
|
+
return read.Success && read.Results.length > 0;
|
|
75
|
+
}
|
|
76
|
+
/** The IDs of the folder's direct subfolders and conversations, read as the system user; a message on failure. */
|
|
77
|
+
async readContents(systemUser) {
|
|
78
|
+
const rv = new RunView(this.RunViewProviderToUse);
|
|
79
|
+
const id = EscapeSQLString(this.ID);
|
|
80
|
+
const [folders, conversations] = await rv.RunViews([
|
|
81
|
+
{ EntityName: 'MJ: Projects', ExtraFilter: `ParentID='${id}'`, Fields: ['ID'], ResultType: 'simple' },
|
|
82
|
+
{ EntityName: 'MJ: Conversations', ExtraFilter: `ProjectID='${id}'`, Fields: ['ID'], ResultType: 'simple' },
|
|
83
|
+
], systemUser);
|
|
84
|
+
if (!folders?.Success || !conversations?.Success) {
|
|
85
|
+
return `Could not read what the folder holds: ${folders?.ErrorMessage || conversations?.ErrorMessage || 'unknown error'}`;
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
FolderIDs: folders.Results.map((r) => r.ID),
|
|
89
|
+
ConversationIDs: conversations.Results.map((r) => r.ID),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/** Queues the moves and this delete in one transaction group and submits it. */
|
|
93
|
+
async deleteWithContentsMoved(contents, systemUser, options) {
|
|
94
|
+
const md = this.ProviderToUse;
|
|
95
|
+
const group = await md.CreateTransactionGroup();
|
|
96
|
+
const newParentId = this.ParentID ?? null;
|
|
97
|
+
for (const folderId of contents.FolderIDs) {
|
|
98
|
+
const child = await md.GetEntityObject('MJ: Projects', systemUser);
|
|
99
|
+
if (!(await child.Load(folderId))) {
|
|
100
|
+
return this.refuseDelete('Could not load a subfolder to move it out of the folder.');
|
|
101
|
+
}
|
|
102
|
+
child.ParentID = newParentId;
|
|
103
|
+
child.TransactionGroup = group;
|
|
104
|
+
if (!(await child.Save())) {
|
|
105
|
+
return this.refuseDelete(child.LatestResult?.CompleteMessage || 'Could not move a subfolder out of the folder.');
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
for (const conversationId of contents.ConversationIDs) {
|
|
109
|
+
const conversation = await md.GetEntityObject('MJ: Conversations', systemUser);
|
|
110
|
+
if (!(await conversation.Load(conversationId))) {
|
|
111
|
+
return this.refuseDelete('Could not load a conversation to take it out of the folder.');
|
|
112
|
+
}
|
|
113
|
+
conversation.ProjectID = null;
|
|
114
|
+
conversation.TransactionGroup = group;
|
|
115
|
+
if (!(await conversation.Save())) {
|
|
116
|
+
return this.refuseDelete(conversation.LatestResult?.CompleteMessage || 'Could not take a conversation out of the folder.');
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
this.TransactionGroup = group;
|
|
120
|
+
try {
|
|
121
|
+
if (!(await super.Delete(options))) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
const submitted = await group.Submit();
|
|
125
|
+
return submitted && this.LatestResult?.Success !== false;
|
|
126
|
+
}
|
|
127
|
+
finally {
|
|
128
|
+
this.TransactionGroup = null;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/** Records a refused delete so the caller reads the reason from `LatestResult`. */
|
|
132
|
+
refuseDelete(message) {
|
|
133
|
+
const result = new BaseEntityResult();
|
|
134
|
+
result.StartedAt = new Date();
|
|
135
|
+
result.Type = 'delete';
|
|
136
|
+
result.Success = false;
|
|
137
|
+
result.Message = message;
|
|
138
|
+
result.EndedAt = new Date();
|
|
139
|
+
this.RegisterResultHistoryEntry(result);
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
29
142
|
async ValidateAsync() {
|
|
30
143
|
const result = await super.ValidateAsync();
|
|
31
144
|
const violation = await this.checkParentCycle();
|