@memberjunction/core-entities-server 6.3.0-edge.0 → 6.3.0-edge.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/custom/AgentChannelConversationDriver.server.d.ts +87 -0
- package/dist/custom/AgentChannelConversationDriver.server.d.ts.map +1 -0
- package/dist/custom/AgentChannelConversationDriver.server.js +216 -0
- package/dist/custom/AgentChannelConversationDriver.server.js.map +1 -0
- package/dist/custom/AnchoredConversationReadSecurityHook.d.ts +1 -0
- package/dist/custom/AnchoredConversationReadSecurityHook.d.ts.map +1 -1
- package/dist/custom/AnchoredConversationReadSecurityHook.js +23 -10
- 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/AudienceNamedPersonAgentRequestService.d.ts +25 -0
- package/dist/custom/AudienceNamedPersonAgentRequestService.d.ts.map +1 -0
- package/dist/custom/AudienceNamedPersonAgentRequestService.js +304 -0
- package/dist/custom/AudienceNamedPersonAgentRequestService.js.map +1 -0
- package/dist/custom/ConversationDetailWritePermissionProvider.d.ts +113 -0
- package/dist/custom/ConversationDetailWritePermissionProvider.d.ts.map +1 -0
- package/dist/custom/ConversationDetailWritePermissionProvider.js +200 -0
- package/dist/custom/ConversationDetailWritePermissionProvider.js.map +1 -0
- package/dist/custom/ConversationReadSecurityHook.d.ts +61 -0
- package/dist/custom/ConversationReadSecurityHook.d.ts.map +1 -0
- package/dist/custom/ConversationReadSecurityHook.js +587 -0
- package/dist/custom/ConversationReadSecurityHook.js.map +1 -0
- package/dist/custom/MJAIAgentEntityServer.server.d.ts +80 -34
- package/dist/custom/MJAIAgentEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJAIAgentEntityServer.server.js +383 -43
- package/dist/custom/MJAIAgentEntityServer.server.js.map +1 -1
- package/dist/custom/MJAIAgentPersonaEntityServer.server.d.ts +23 -0
- package/dist/custom/MJAIAgentPersonaEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJAIAgentPersonaEntityServer.server.js +93 -0
- package/dist/custom/MJAIAgentPersonaEntityServer.server.js.map +1 -0
- package/dist/custom/MJAIAgentUserPolicyEntityServer.server.d.ts +24 -13
- package/dist/custom/MJAIAgentUserPolicyEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJAIAgentUserPolicyEntityServer.server.js +167 -24
- 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/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/MJConversationDetailEntityServer.server.d.ts +27 -2
- package/dist/custom/MJConversationDetailEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJConversationDetailEntityServer.server.js +300 -4
- package/dist/custom/MJConversationDetailEntityServer.server.js.map +1 -1
- package/dist/custom/MJConversationEntityServer.server.d.ts +6 -20
- package/dist/custom/MJConversationEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJConversationEntityServer.server.js +293 -16
- 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/MJGraphConceptEntityServer.server.d.ts +92 -0
- package/dist/custom/MJGraphConceptEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJGraphConceptEntityServer.server.js +203 -0
- package/dist/custom/MJGraphConceptEntityServer.server.js.map +1 -0
- package/dist/custom/MJGraphEdgeEntityServer.server.d.ts +16 -2
- package/dist/custom/MJGraphEdgeEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJGraphEdgeEntityServer.server.js +26 -4
- package/dist/custom/MJGraphEdgeEntityServer.server.js.map +1 -1
- 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/MJMLModelPublishRecordEntityServer.server.d.ts +31 -0
- package/dist/custom/MJMLModelPublishRecordEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJMLModelPublishRecordEntityServer.server.js +68 -0
- package/dist/custom/MJMLModelPublishRecordEntityServer.server.js.map +1 -0
- package/dist/custom/MJMLModelScoringBindingEntityServer.server.d.ts +78 -0
- package/dist/custom/MJMLModelScoringBindingEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJMLModelScoringBindingEntityServer.server.js +273 -0
- package/dist/custom/MJMLModelScoringBindingEntityServer.server.js.map +1 -0
- package/dist/custom/MJMLOutputBindingEntityServer.server.d.ts +18 -0
- package/dist/custom/MJMLOutputBindingEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJMLOutputBindingEntityServer.server.js +61 -0
- package/dist/custom/MJMLOutputBindingEntityServer.server.js.map +1 -0
- package/dist/custom/MJMLPredictionUnitEntityServer.server.d.ts +3 -3
- package/dist/custom/MJMLPredictionUnitEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJMLPredictionUnitEntityServer.server.js +4 -4
- package/dist/custom/MJMLPredictionUnitEntityServer.server.js.map +1 -1
- 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 +41 -4
- package/dist/custom/MJQueryEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJQueryEntityServer.server.js +99 -14
- package/dist/custom/MJQueryEntityServer.server.js.map +1 -1
- package/dist/custom/MJQuerySQLEntityServer.server.d.ts +13 -1
- package/dist/custom/MJQuerySQLEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJQuerySQLEntityServer.server.js +37 -3
- package/dist/custom/MJQuerySQLEntityServer.server.js.map +1 -1
- package/dist/custom/MJResourcePermissionEntityServer.server.d.ts +28 -0
- package/dist/custom/MJResourcePermissionEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJResourcePermissionEntityServer.server.js +206 -0
- package/dist/custom/MJResourcePermissionEntityServer.server.js.map +1 -0
- 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/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/MJUserRoutineEntityServer.server.d.ts +23 -0
- package/dist/custom/MJUserRoutineEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJUserRoutineEntityServer.server.js +320 -3
- package/dist/custom/MJUserRoutineEntityServer.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/approvalStamp.d.ts +19 -3
- package/dist/custom/approvalStamp.d.ts.map +1 -1
- package/dist/custom/approvalStamp.js +13 -3
- package/dist/custom/approvalStamp.js.map +1 -1
- 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/graph/GraphFindPathServerOperation.d.ts +24 -0
- package/dist/custom/graph/GraphFindPathServerOperation.d.ts.map +1 -0
- package/dist/custom/graph/GraphFindPathServerOperation.js +88 -0
- package/dist/custom/graph/GraphFindPathServerOperation.js.map +1 -0
- package/dist/custom/graph/index.d.ts +2 -0
- package/dist/custom/graph/index.d.ts.map +1 -0
- package/dist/custom/graph/index.js +2 -0
- package/dist/custom/graph/index.js.map +1 -0
- 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/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +31 -30
|
@@ -4,35 +4,133 @@ 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, BaseEntityResult } from '@memberjunction/core';
|
|
8
|
-
import { RegisterClass } from '@memberjunction/global';
|
|
7
|
+
import { BaseEntity, BaseEntityResult, LogError, ValidationErrorInfo, ValidationErrorType, } from '@memberjunction/core';
|
|
8
|
+
import { RegisterClass, UUIDsEqual } from '@memberjunction/global';
|
|
9
9
|
import { MJListEntityExtended } from '@memberjunction/core-entities';
|
|
10
|
+
import { ListOperations } from '@memberjunction/lists';
|
|
11
|
+
import { ListRefreshRoutine } from './list-refresh/ListRefreshRoutine.js';
|
|
12
|
+
/** The fields that say which source a list refreshes from. Changing any of them re-links the list. */
|
|
13
|
+
const SOURCE_IDENTITY_FIELDS = ['SourceViewID', 'SourceQueryID', 'SourceQueryKeyField'];
|
|
14
|
+
/** The fields the list's refresh routine follows. */
|
|
15
|
+
const ROUTINE_FIELDS = ['AutoRefresh', 'Name', 'UserID', 'SourceViewID', 'SourceQueryID'];
|
|
10
16
|
/**
|
|
11
|
-
* Server-side Lists entity.
|
|
12
|
-
* if they own it, UNLESS they hold the Developer or Integration role (who may delete any List). The
|
|
13
|
-
* rule itself lives once in {@link MJListEntityExtended.UserCanDelete} and is shared with the UI.
|
|
17
|
+
* Server-side Lists entity.
|
|
14
18
|
*
|
|
15
|
-
*
|
|
16
|
-
* role
|
|
17
|
-
*
|
|
18
|
-
* permissions can't express row-level
|
|
19
|
-
*
|
|
20
|
-
*
|
|
19
|
+
* **Delete.** A user may delete a List only if they own it, unless they hold the Developer or
|
|
20
|
+
* Integration role. The rule lives once in {@link MJListEntityExtended.UserCanDelete} and is shared
|
|
21
|
+
* with the UI. The `EntityPermission` migration grants the UI role entity-wide Delete on Lists, and
|
|
22
|
+
* this override narrows it to owner-or-privileged, since entity permissions can't express row-level
|
|
23
|
+
* ownership. The list's refresh routine is deleted after the list.
|
|
24
|
+
*
|
|
25
|
+
* **Source and refresh.** Only the list's owner may link it to a source query or view, or turn on
|
|
26
|
+
* Refresh automatically. Linking an existing list to a new source fills it from that source right
|
|
27
|
+
* away, adding records only. Turning Refresh automatically on creates (or re-enables) a User Routine
|
|
28
|
+
* that runs "Refresh List From Source" on the Lists app's default schedule; turning it off disables
|
|
29
|
+
* the routine. Both happen after the save and never fail it: the list is valid and already saved,
|
|
30
|
+
* so an error is logged instead.
|
|
21
31
|
*/
|
|
22
32
|
let MJListEntityServer = class MJListEntityServer extends MJListEntityExtended {
|
|
33
|
+
Validate() {
|
|
34
|
+
const result = super.Validate();
|
|
35
|
+
if (this.SourceQueryID && !this.SourceQueryKeyField?.trim()) {
|
|
36
|
+
result.Errors.push(new ValidationErrorInfo('SourceQueryKeyField', 'A list refreshed from a query needs SourceQueryKeyField: the query column that holds the record key.', this.SourceQueryKeyField, ValidationErrorType.Failure));
|
|
37
|
+
}
|
|
38
|
+
result.Success = result.Success && result.Errors.length === 0;
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
async Save(options) {
|
|
42
|
+
if (options?.ReplayOnly)
|
|
43
|
+
return super.Save(options);
|
|
44
|
+
// Read before the save, which resets every dirty flag.
|
|
45
|
+
const isNew = !this.IsSaved;
|
|
46
|
+
const sourceRelinked = this.anyFieldDirty(SOURCE_IDENTITY_FIELDS) && this.hasSource;
|
|
47
|
+
const reconcileRoutine = (isNew && this.AutoRefresh) || (!isNew && this.anyFieldDirty(ROUTINE_FIELDS));
|
|
48
|
+
const refusal = this.ownerOnlyRefusal(sourceRelinked || (this.AutoRefresh && this.anyFieldDirty(['AutoRefresh'])));
|
|
49
|
+
if (refusal) {
|
|
50
|
+
this.RegisterResultHistoryEntry(refusal);
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
// A new source has not been approved by anyone yet: its first refresh takes its fingerprint.
|
|
54
|
+
if (sourceRelinked)
|
|
55
|
+
this.SourceFingerprint = null;
|
|
56
|
+
if (!(await super.Save(options)))
|
|
57
|
+
return false;
|
|
58
|
+
if (reconcileRoutine)
|
|
59
|
+
await this.reconcileRoutineSafely(options);
|
|
60
|
+
// A list created with a source was filled by whatever created it (MaterializeFromView does).
|
|
61
|
+
if (sourceRelinked && !isNew)
|
|
62
|
+
await this.fillFromSourceSafely();
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
23
65
|
async Delete(options) {
|
|
24
66
|
if (!MJListEntityExtended.UserCanDelete(this.UserID, this.ContextCurrentUser)) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
result.Success = false;
|
|
28
|
-
result.Type = 'delete';
|
|
29
|
-
result.Message = 'You do not have permission to delete this List. Only the List owner, ' +
|
|
30
|
-
'or a user in the Developer or Integration role, may delete it.';
|
|
31
|
-
result.EndedAt = new Date();
|
|
32
|
-
this.RegisterResultHistoryEntry(result);
|
|
67
|
+
this.RegisterResultHistoryEntry(this.refusalResult('delete', 'You do not have permission to delete this List. Only the List owner, ' +
|
|
68
|
+
'or a user in the Developer or Integration role, may delete it.'));
|
|
33
69
|
return false;
|
|
34
70
|
}
|
|
35
|
-
|
|
71
|
+
const routineID = this.RefreshRoutineID;
|
|
72
|
+
if (!(await super.Delete(options)))
|
|
73
|
+
return false;
|
|
74
|
+
// The list's foreign key points at the routine, so the routine goes after the list.
|
|
75
|
+
if (routineID) {
|
|
76
|
+
await this.runSafely('routine delete', () => this.routine().DeleteAsync(routineID));
|
|
77
|
+
}
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
get hasSource() {
|
|
81
|
+
return !!this.SourceViewID || !!this.SourceQueryID;
|
|
82
|
+
}
|
|
83
|
+
/** Refuses a save that links a source or turns on Refresh automatically, unless the saving user owns the list. */
|
|
84
|
+
ownerOnlyRefusal(ownerOnlyChange) {
|
|
85
|
+
if (!ownerOnlyChange)
|
|
86
|
+
return null;
|
|
87
|
+
const user = this.ContextCurrentUser;
|
|
88
|
+
if (user && UUIDsEqual(user.ID, this.UserID))
|
|
89
|
+
return null;
|
|
90
|
+
return this.refusalResult('update', 'Only the owner of this List can link it to a source or turn on Refresh automatically.');
|
|
91
|
+
}
|
|
92
|
+
async reconcileRoutineSafely(options) {
|
|
93
|
+
await this.runSafely('refresh routine', async () => {
|
|
94
|
+
const routineID = await this.routine().ReconcileAsync(this);
|
|
95
|
+
if (routineID && !UUIDsEqual(routineID, this.RefreshRoutineID)) {
|
|
96
|
+
this.RefreshRoutineID = routineID;
|
|
97
|
+
if (!(await super.Save(options))) {
|
|
98
|
+
throw new Error(`could not store the routine ID: ${this.LatestResult?.CompleteMessage ?? 'unknown error'}`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/** Fills the list from its newly linked source, adding records only. */
|
|
104
|
+
async fillFromSourceSafely() {
|
|
105
|
+
await this.runSafely('fill from new source', async () => {
|
|
106
|
+
const result = await new ListOperations(this.ContextCurrentUser, this.ProviderToUse)
|
|
107
|
+
.RefreshFromSource(this.ID, 'Additive', { ConfirmDrops: false });
|
|
108
|
+
if (!result.Success)
|
|
109
|
+
throw new Error(`${result.ResultCode}: ${result.Message}`);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
async runSafely(label, work) {
|
|
113
|
+
try {
|
|
114
|
+
await work();
|
|
115
|
+
}
|
|
116
|
+
catch (e) {
|
|
117
|
+
LogError(`MJListEntityServer: ${label} failed for list '${this.Name}' (${this.ID}): ${e instanceof Error ? e.message : String(e)}`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
routine() {
|
|
121
|
+
return new ListRefreshRoutine(this.ProviderToUse, this.ContextCurrentUser);
|
|
122
|
+
}
|
|
123
|
+
anyFieldDirty(fields) {
|
|
124
|
+
return fields.some((f) => this.GetFieldByName(f)?.Dirty ?? false);
|
|
125
|
+
}
|
|
126
|
+
refusalResult(type, message) {
|
|
127
|
+
const result = new BaseEntityResult();
|
|
128
|
+
result.StartedAt = new Date();
|
|
129
|
+
result.Success = false;
|
|
130
|
+
result.Type = type;
|
|
131
|
+
result.Message = message;
|
|
132
|
+
result.EndedAt = new Date();
|
|
133
|
+
return result;
|
|
36
134
|
}
|
|
37
135
|
};
|
|
38
136
|
MJListEntityServer = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MJListEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJListEntityServer.server.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"MJListEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJListEntityServer.server.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACH,UAAU,EACV,gBAAgB,EAIhB,QAAQ,EACR,mBAAmB,EACnB,mBAAmB,GAEtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAEvE,sGAAsG;AACtG,MAAM,sBAAsB,GAAG,CAAC,cAAc,EAAE,eAAe,EAAE,qBAAqB,CAAU,CAAC;AAEjG,qDAAqD;AACrD,MAAM,cAAc,GAAG,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe,CAAU,CAAC;AAEnG;;;;;;;;;;;;;;;GAeG;AAEI,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,oBAAoB;IACxC,QAAQ;QACpB,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;QAChC,IAAI,IAAI,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,IAAI,EAAE,EAAE,CAAC;YAC1D,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,mBAAmB,CACtC,qBAAqB,EACrB,sGAAsG,EACtG,IAAI,CAAC,mBAAmB,EACxB,mBAAmB,CAAC,OAAO,CAC9B,CAAC,CAAC;QACP,CAAC;QACD,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;QAC9D,OAAO,MAAM,CAAC;IAClB,CAAC;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EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAC/G,CAAC;IAEO,aAAa,CAAC,MAAyB;QAC3C,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,KAAK,CAAC,CAAC;IACtE,CAAC;IAEO,aAAa,CAAC,IAAyB,EAAE,OAAe;QAC5D,MAAM,MAAM,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACtC,MAAM,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;QAC9B,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC;QACvB,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;QACnB,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;QACzB,MAAM,CAAC,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC;QAC5B,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ,CAAA;AAjHY,kBAAkB;IAD9B,aAAa,CAAC,UAAU,EAAE,WAAW,CAAC;GAC1B,kBAAkB,CAiH9B"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type EntityDeleteOptions, type EntitySaveOptions, type ValidationResult } from '@memberjunction/core';
|
|
2
|
+
import { MJMLModelPublishRecordEntity } from '@memberjunction/core-entities';
|
|
3
|
+
/**
|
|
4
|
+
* `MJ: ML Model Publish Records` (PR 4 §5.1, D-029): the ledger of sign-offs, applied publishes and refused publish
|
|
5
|
+
* attempts. Rows are immutable once saved: `Validate()` refuses any change to a saved row, and a `ReplayOnly` save of a
|
|
6
|
+
* saved row (which skips `Validate()`) is refused in `Save()`, so neither write path can rewrite the audit trail. The
|
|
7
|
+
* one exception is `spDeleteEntityWithCoreDependencies`, which clears `SignOffID`, `ReplacesModelID` and
|
|
8
|
+
* `TrainingRunID` on surviving rows when the row they name is deleted with its entity (D4-73); it runs in SQL and never
|
|
9
|
+
* reaches this class.
|
|
10
|
+
*
|
|
11
|
+
* The ledger is also append-only for creates and deletes (review item 1 of PR #6517): the Predictive Studio Engine's
|
|
12
|
+
* `PredictiveStudioPublishRecordGuard` (`PreSave` and `PreDelete` hooks, registered in every process that loads the
|
|
13
|
+
* Engine, MJAPI among them) refuses a new row its writer did not authorise and any delete. A `ReplayOnly` delete skips
|
|
14
|
+
* `PreDelete` hooks yet still deletes the row, so this class refuses it.
|
|
15
|
+
*/
|
|
16
|
+
export declare class MJMLModelPublishRecordEntityServer extends MJMLModelPublishRecordEntity {
|
|
17
|
+
/** The refusal of a change to a saved publish record, naming the changed fields; null for a new row or no change. Pure. */
|
|
18
|
+
static GetPublishRecordUpdateProblem(isSaved: boolean, dirtyFields: readonly string[]): string | null;
|
|
19
|
+
/**
|
|
20
|
+
* The generated field validation, plus the ledger rule: a saved record with any changed field is refused, naming the
|
|
21
|
+
* fields (a new record, and a saved one with no change, pass).
|
|
22
|
+
*/
|
|
23
|
+
Validate(): ValidationResult;
|
|
24
|
+
/** A `ReplayOnly` save of a saved record is refused: it skips {@link Validate}, which refuses the update, but still writes. */
|
|
25
|
+
Save(options?: EntitySaveOptions): Promise<boolean>;
|
|
26
|
+
/** The refusal of a `ReplayOnly` delete; null for any other delete (the Engine's `PreDelete` hook decides those). Pure. */
|
|
27
|
+
static GetReplayOnlyDeleteProblem(options: EntityDeleteOptions | undefined): string | null;
|
|
28
|
+
/** A `ReplayOnly` delete is refused ({@link GetReplayOnlyDeleteProblem}); any other delete goes to the base. */
|
|
29
|
+
Delete(options?: EntityDeleteOptions): Promise<boolean>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=MJMLModelPublishRecordEntityServer.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MJMLModelPublishRecordEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJMLModelPublishRecordEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,mBAAmB,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE3H,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAI7E;;;;;;;;;;;;GAYG;AACH,qBACa,kCAAmC,SAAQ,4BAA4B;IAClF,2HAA2H;WAC7G,6BAA6B,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI;IAK5G;;;OAGG;IACa,QAAQ,IAAI,gBAAgB;IAQ5C,+HAA+H;IACzG,IAAI,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IAIzE,2HAA2H;WAC7G,0BAA0B,CAAC,OAAO,EAAE,mBAAmB,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI;IAKjG,gHAAgH;IAC1F,MAAM,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC;CAM9E"}
|
|
@@ -0,0 +1,68 @@
|
|
|
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 MJMLModelPublishRecordEntityServer_1;
|
|
8
|
+
import { BaseEntity } from '@memberjunction/core';
|
|
9
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
10
|
+
import { MJMLModelPublishRecordEntity } from '@memberjunction/core-entities';
|
|
11
|
+
import { FormScopeRefusalResult } from './FormScopeGuard.js';
|
|
12
|
+
import { VersionedRowGuard } from './MJMLPredictionUnitEntityServer.server.js';
|
|
13
|
+
/**
|
|
14
|
+
* `MJ: ML Model Publish Records` (PR 4 §5.1, D-029): the ledger of sign-offs, applied publishes and refused publish
|
|
15
|
+
* attempts. Rows are immutable once saved: `Validate()` refuses any change to a saved row, and a `ReplayOnly` save of a
|
|
16
|
+
* saved row (which skips `Validate()`) is refused in `Save()`, so neither write path can rewrite the audit trail. The
|
|
17
|
+
* one exception is `spDeleteEntityWithCoreDependencies`, which clears `SignOffID`, `ReplacesModelID` and
|
|
18
|
+
* `TrainingRunID` on surviving rows when the row they name is deleted with its entity (D4-73); it runs in SQL and never
|
|
19
|
+
* reaches this class.
|
|
20
|
+
*
|
|
21
|
+
* The ledger is also append-only for creates and deletes (review item 1 of PR #6517): the Predictive Studio Engine's
|
|
22
|
+
* `PredictiveStudioPublishRecordGuard` (`PreSave` and `PreDelete` hooks, registered in every process that loads the
|
|
23
|
+
* Engine, MJAPI among them) refuses a new row its writer did not authorise and any delete. A `ReplayOnly` delete skips
|
|
24
|
+
* `PreDelete` hooks yet still deletes the row, so this class refuses it.
|
|
25
|
+
*/
|
|
26
|
+
let MJMLModelPublishRecordEntityServer = MJMLModelPublishRecordEntityServer_1 = class MJMLModelPublishRecordEntityServer extends MJMLModelPublishRecordEntity {
|
|
27
|
+
/** The refusal of a change to a saved publish record, naming the changed fields; null for a new row or no change. Pure. */
|
|
28
|
+
static GetPublishRecordUpdateProblem(isSaved, dirtyFields) {
|
|
29
|
+
if (!isSaved || dirtyFields.length === 0)
|
|
30
|
+
return null;
|
|
31
|
+
return `MJ: ML Model Publish Records rows are immutable once saved (publish records are immutable): ${dirtyFields.join(', ')} cannot be changed. Write a new record instead.`;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The generated field validation, plus the ledger rule: a saved record with any changed field is refused, naming the
|
|
35
|
+
* fields (a new record, and a saved one with no change, pass).
|
|
36
|
+
*/
|
|
37
|
+
Validate() {
|
|
38
|
+
const result = super.Validate();
|
|
39
|
+
const dirty = this.Fields.filter((f) => f.Dirty).map((f) => f.Name);
|
|
40
|
+
const problem = MJMLModelPublishRecordEntityServer_1.GetPublishRecordUpdateProblem(this.IsSaved, dirty);
|
|
41
|
+
if (problem !== null)
|
|
42
|
+
VersionedRowGuard.Fail(result, dirty[0], problem);
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
/** A `ReplayOnly` save of a saved record is refused: it skips {@link Validate}, which refuses the update, but still writes. */
|
|
46
|
+
async Save(options) {
|
|
47
|
+
return VersionedRowGuard.SaveRefusingSavedRowReplay(this, options, () => super.Save(options));
|
|
48
|
+
}
|
|
49
|
+
/** The refusal of a `ReplayOnly` delete; null for any other delete (the Engine's `PreDelete` hook decides those). Pure. */
|
|
50
|
+
static GetReplayOnlyDeleteProblem(options) {
|
|
51
|
+
if (options?.ReplayOnly !== true)
|
|
52
|
+
return null;
|
|
53
|
+
return 'MJ: ML Model Publish Records rows are append-only: a ReplayOnly delete is refused, because ReplayOnly skips the PreDelete hooks that refuse a delete but still deletes the row.';
|
|
54
|
+
}
|
|
55
|
+
/** A `ReplayOnly` delete is refused ({@link GetReplayOnlyDeleteProblem}); any other delete goes to the base. */
|
|
56
|
+
async Delete(options) {
|
|
57
|
+
const problem = MJMLModelPublishRecordEntityServer_1.GetReplayOnlyDeleteProblem(options);
|
|
58
|
+
if (problem === null)
|
|
59
|
+
return super.Delete(options);
|
|
60
|
+
this.RegisterResultHistoryEntry(FormScopeRefusalResult('delete', problem));
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
MJMLModelPublishRecordEntityServer = MJMLModelPublishRecordEntityServer_1 = __decorate([
|
|
65
|
+
RegisterClass(BaseEntity, 'MJ: ML Model Publish Records')
|
|
66
|
+
], MJMLModelPublishRecordEntityServer);
|
|
67
|
+
export { MJMLModelPublishRecordEntityServer };
|
|
68
|
+
//# sourceMappingURL=MJMLModelPublishRecordEntityServer.server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MJMLModelPublishRecordEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJMLModelPublishRecordEntityServer.server.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,UAAU,EAA2E,MAAM,sBAAsB,CAAC;AAC3H,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAE5E;;;;;;;;;;;;GAYG;AAEI,IAAM,kCAAkC,0CAAxC,MAAM,kCAAmC,SAAQ,4BAA4B;IAClF,2HAA2H;IACpH,MAAM,CAAC,6BAA6B,CAAC,OAAgB,EAAE,WAA8B;QAC1F,IAAI,CAAC,OAAO,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QACtD,OAAO,+FAA+F,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,iDAAiD,CAAC;IAChL,CAAC;IAED;;;OAGG;IACa,QAAQ;QACtB,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;QAChC,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACpE,MAAM,OAAO,GAAG,oCAAkC,CAAC,6BAA6B,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACtG,IAAI,OAAO,KAAK,IAAI;YAAE,iBAAiB,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;QACxE,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,+HAA+H;IAC/G,KAAK,CAAC,IAAI,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;IAED,2HAA2H;IACpH,MAAM,CAAC,0BAA0B,CAAC,OAAwC;QAC/E,IAAI,OAAO,EAAE,UAAU,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;QAC9C,OAAO,iLAAiL,CAAC;IAC3L,CAAC;IAED,gHAAgH;IAChG,KAAK,CAAC,MAAM,CAAC,OAA6B;QACxD,MAAM,OAAO,GAAG,oCAAkC,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC;QACvF,IAAI,OAAO,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACnD,IAAI,CAAC,0BAA0B,CAAC,sBAAsB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;QAC3E,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAA;AArCY,kCAAkC;IAD9C,aAAa,CAAC,UAAU,EAAE,8BAA8B,CAAC;GAC7C,kCAAkC,CAqC9C"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { type EntityDeleteOptions, type ValidationResult } from '@memberjunction/core';
|
|
2
|
+
import { MJMLModelScoringBindingEntity, type MJMLModelEntity } from '@memberjunction/core-entities';
|
|
3
|
+
/** A parsed `TargetColumnSource`: the member of the scored result it names, and the class for `$.Probabilities.<class>`. */
|
|
4
|
+
export type CopySourceRef = {
|
|
5
|
+
readonly Member: 'Value' | 'Class' | 'AdverseProbability';
|
|
6
|
+
} | {
|
|
7
|
+
readonly Member: 'Probabilities';
|
|
8
|
+
readonly ClassName: string;
|
|
9
|
+
};
|
|
10
|
+
/** What the copy-source check knows of the pipeline's model output: classification or not, and the class order when known. */
|
|
11
|
+
interface OutputKind {
|
|
12
|
+
readonly IsClassification: boolean;
|
|
13
|
+
readonly ClassOrder: readonly string[] | null;
|
|
14
|
+
/** Where the kind was read from, for the refusal text. */
|
|
15
|
+
readonly From: string;
|
|
16
|
+
}
|
|
17
|
+
/** The model columns the copy-source check reads. */
|
|
18
|
+
type PublishedModelRow = Pick<MJMLModelEntity, 'ID' | 'OutputSemantics' | 'ProblemType'>;
|
|
19
|
+
/**
|
|
20
|
+
* `MJ: ML Model Scoring Bindings`: a binding defines one prediction feature of a target entity, scored with its training
|
|
21
|
+
* pipeline's Published model. A save is refused, one structured error per rule, when the pipeline, feature name, target
|
|
22
|
+
* entity or view authorization is missing; when the feature name is already used on the target entity by another binding
|
|
23
|
+
* or by a Feature Pipeline's output (the long-format Feature Value key would mix them); when the target column is not an
|
|
24
|
+
* updatable field of the target entity; and when the column has no copy source, or a source that does not parse or that
|
|
25
|
+
* the pipeline's model output cannot give; and when the target entity is not the entity the pipeline's models score
|
|
26
|
+
* (its Prediction Unit's row entity, else its target entity: D4-168), since every scoring run of such a binding would
|
|
27
|
+
* be refused `scope-entity-mismatch`. A delete is refused unless the binding is withdrawn and no Feature Value names
|
|
28
|
+
* it. Every read goes through the entity's own provider.
|
|
29
|
+
*/
|
|
30
|
+
export declare class MJMLModelScoringBindingEntityServer extends MJMLModelScoringBindingEntity {
|
|
31
|
+
/** The base checks, then the binding's own rules. */
|
|
32
|
+
ValidateAsync(): Promise<ValidationResult>;
|
|
33
|
+
/** Refused with "Withdraw the binding first" unless the binding is withdrawn and no Feature Value row names it. */
|
|
34
|
+
Delete(options?: EntityDeleteOptions): Promise<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* Parses a `TargetColumnSource`: `$.Value`, `$.Class`, `$.AdverseProbability` or `$.Probabilities.<class>`. Pure.
|
|
37
|
+
*
|
|
38
|
+
* @returns the reference, or null when the text is none of those
|
|
39
|
+
*/
|
|
40
|
+
static ParseCopySource(text: string): CopySourceRef | null;
|
|
41
|
+
/**
|
|
42
|
+
* The problem with copying `ref` from a model whose output is `kind`, or null when the output gives it. Pure.
|
|
43
|
+
*/
|
|
44
|
+
static CopySourceProblem(ref: CopySourceRef, kind: OutputKind): string | null;
|
|
45
|
+
/** One error per required field the base checks did not already name. */
|
|
46
|
+
private checkRequired;
|
|
47
|
+
/** The feature name is unique on the target entity among bindings and is not a Feature Pipeline output there. */
|
|
48
|
+
private checkFeatureName;
|
|
49
|
+
/**
|
|
50
|
+
* The target entity is the entity the pipeline's models score: the row entity of its Prediction Unit when it names
|
|
51
|
+
* one, else its `TargetEntityID` (D4-168). Compared by entity ID.
|
|
52
|
+
*/
|
|
53
|
+
private checkScoringEntity;
|
|
54
|
+
/** The entity `pipeline`'s models score; null when it cannot be told, the reason recorded on `result`. */
|
|
55
|
+
private static scoringEntity;
|
|
56
|
+
/**
|
|
57
|
+
* The output names a Feature Pipeline's spec declares (`Outputs[].Name`); none for a configuration that does not parse.
|
|
58
|
+
* Pure.
|
|
59
|
+
*/
|
|
60
|
+
static OutputNames(configuration: string | null): string[];
|
|
61
|
+
/** The target column is an existing, updatable field of the target entity. */
|
|
62
|
+
private checkTargetColumn;
|
|
63
|
+
/** A target column has a copy source that parses and that the pipeline's model output can give. */
|
|
64
|
+
private checkCopySource;
|
|
65
|
+
/**
|
|
66
|
+
* What the pipeline's model output is: from its newest Published model's `OutputSemantics` (or its `ProblemType` when
|
|
67
|
+
* it has none), else from the pipeline's `ProblemType`. Null when it could not be read, the reason on `result`.
|
|
68
|
+
*/
|
|
69
|
+
private readOutputKind;
|
|
70
|
+
/** A Published model's output kind: its semantics' task when they parse, else its `ProblemType`. Pure. */
|
|
71
|
+
static ModelOutputKind(model: PublishedModelRow): OutputKind;
|
|
72
|
+
/** Why the binding may not be deleted now, or null when it may. */
|
|
73
|
+
private deleteRefusal;
|
|
74
|
+
/** Every row of `entityName` matching `filter`, as plain rows; a failed read is returned as its error. */
|
|
75
|
+
private static readRows;
|
|
76
|
+
}
|
|
77
|
+
export {};
|
|
78
|
+
//# sourceMappingURL=MJMLModelScoringBindingEntityServer.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MJMLModelScoringBindingEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJMLModelScoringBindingEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,mBAAmB,EAA0D,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAEpK,OAAO,EACL,6BAA6B,EAA6B,KAAK,eAAe,EAC/E,MAAM,+BAA+B,CAAC;AAQvC,4HAA4H;AAC5H,MAAM,MAAM,aAAa,GACrB;IAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,GAAG,oBAAoB,CAAA;CAAE,GAC7D;IAAE,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAErE,8HAA8H;AAC9H,UAAU,UAAU;IAClB,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAC;IAC9C,0DAA0D;IAC1D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,qDAAqD;AACrD,KAAK,iBAAiB,GAAG,IAAI,CAAC,eAAe,EAAE,IAAI,GAAG,iBAAiB,GAAG,aAAa,CAAC,CAAC;AAsBzF;;;;;;;;;;GAUG;AACH,qBACa,mCAAoC,SAAQ,6BAA6B;IACpF,qDAAqD;IAC/B,aAAa,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAkBhE,mHAAmH;IAC7F,MAAM,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC;IAS7E;;;;OAIG;WACW,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI;IAUjE;;OAEG;WACW,iBAAiB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