@memberjunction/core-entities-server 6.3.0-edge.1 → 6.3.0-edge.3
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 +13 -0
- 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/ArtifactSecurityHookHelpers.d.ts.map +1 -1
- package/dist/custom/ArtifactSecurityHookHelpers.js +50 -0
- package/dist/custom/ArtifactSecurityHookHelpers.js.map +1 -1
- 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/GraphConceptReadSecurityHook.d.ts +75 -0
- package/dist/custom/GraphConceptReadSecurityHook.d.ts.map +1 -0
- package/dist/custom/GraphConceptReadSecurityHook.js +574 -0
- package/dist/custom/GraphConceptReadSecurityHook.js.map +1 -0
- package/dist/custom/GraphRecordChangesReadSecurityHook.d.ts +45 -0
- package/dist/custom/GraphRecordChangesReadSecurityHook.d.ts.map +1 -0
- package/dist/custom/GraphRecordChangesReadSecurityHook.js +744 -0
- package/dist/custom/GraphRecordChangesReadSecurityHook.js.map +1 -0
- package/dist/custom/MJAIAgentActionEntityServer.server.d.ts +13 -0
- package/dist/custom/MJAIAgentActionEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJAIAgentActionEntityServer.server.js +52 -0
- package/dist/custom/MJAIAgentActionEntityServer.server.js.map +1 -0
- package/dist/custom/MJAIAgentCategoryEntityServer.server.d.ts +30 -0
- package/dist/custom/MJAIAgentCategoryEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJAIAgentCategoryEntityServer.server.js +127 -0
- package/dist/custom/MJAIAgentCategoryEntityServer.server.js.map +1 -0
- package/dist/custom/MJAIAgentClientToolEntityServer.server.d.ts +12 -0
- package/dist/custom/MJAIAgentClientToolEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJAIAgentClientToolEntityServer.server.js +46 -0
- package/dist/custom/MJAIAgentClientToolEntityServer.server.js.map +1 -0
- package/dist/custom/MJAIAgentEntityServer.server.d.ts +185 -33
- package/dist/custom/MJAIAgentEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJAIAgentEntityServer.server.js +2232 -42
- package/dist/custom/MJAIAgentEntityServer.server.js.map +1 -1
- package/dist/custom/MJAIAgentModalityEntityServer.server.d.ts +13 -0
- package/dist/custom/MJAIAgentModalityEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJAIAgentModalityEntityServer.server.js +52 -0
- package/dist/custom/MJAIAgentModalityEntityServer.server.js.map +1 -0
- package/dist/custom/MJAIAgentNoteEntityServer.server.d.ts +64 -8
- package/dist/custom/MJAIAgentNoteEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJAIAgentNoteEntityServer.server.js +263 -9
- package/dist/custom/MJAIAgentNoteEntityServer.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 +95 -0
- package/dist/custom/MJAIAgentPersonaEntityServer.server.js.map +1 -0
- package/dist/custom/MJAIAgentRelationshipEntityServer.server.d.ts +5 -2
- package/dist/custom/MJAIAgentRelationshipEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJAIAgentRelationshipEntityServer.server.js +25 -2
- package/dist/custom/MJAIAgentRelationshipEntityServer.server.js.map +1 -1
- package/dist/custom/MJAIAgentSkillEntityServer.server.d.ts +12 -0
- package/dist/custom/MJAIAgentSkillEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJAIAgentSkillEntityServer.server.js +46 -0
- package/dist/custom/MJAIAgentSkillEntityServer.server.js.map +1 -0
- package/dist/custom/MJAIAgentStepTypeEntityServer.server.d.ts +28 -0
- package/dist/custom/MJAIAgentStepTypeEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJAIAgentStepTypeEntityServer.server.js +117 -0
- package/dist/custom/MJAIAgentStepTypeEntityServer.server.js.map +1 -0
- package/dist/custom/MJAIAgentTypeEntityServer.server.d.ts +34 -0
- package/dist/custom/MJAIAgentTypeEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJAIAgentTypeEntityServer.server.js +231 -0
- package/dist/custom/MJAIAgentTypeEntityServer.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/MJActionEntityServer.server.d.ts +37 -0
- package/dist/custom/MJActionEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJActionEntityServer.server.js +208 -3
- package/dist/custom/MJActionEntityServer.server.js.map +1 -1
- package/dist/custom/MJComponentEntityServer.server.d.ts +6 -0
- package/dist/custom/MJComponentEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJComponentEntityServer.server.js +20 -2
- package/dist/custom/MJComponentEntityServer.server.js.map +1 -1
- package/dist/custom/MJContentSourceEntityServer.server.d.ts +28 -0
- package/dist/custom/MJContentSourceEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJContentSourceEntityServer.server.js +73 -0
- package/dist/custom/MJContentSourceEntityServer.server.js.map +1 -0
- package/dist/custom/MJContentSourceTypeEntityServer.server.d.ts +25 -0
- package/dist/custom/MJContentSourceTypeEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJContentSourceTypeEntityServer.server.js +73 -0
- package/dist/custom/MJContentSourceTypeEntityServer.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 +5 -26
- package/dist/custom/MJConversationEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJConversationEntityServer.server.js +236 -8
- package/dist/custom/MJConversationEntityServer.server.js.map +1 -1
- package/dist/custom/MJDashboardEntityServer.server.d.ts +6 -0
- package/dist/custom/MJDashboardEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJDashboardEntityServer.server.js +24 -2
- package/dist/custom/MJDashboardEntityServer.server.js.map +1 -1
- package/dist/custom/MJGraphConceptEntityServer.server.d.ts +244 -0
- package/dist/custom/MJGraphConceptEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJGraphConceptEntityServer.server.js +746 -0
- package/dist/custom/MJGraphConceptEntityServer.server.js.map +1 -0
- package/dist/custom/MJGraphEdgeEntityServer.server.d.ts +52 -11
- package/dist/custom/MJGraphEdgeEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJGraphEdgeEntityServer.server.js +269 -37
- package/dist/custom/MJGraphEdgeEntityServer.server.js.map +1 -1
- package/dist/custom/MJGraphEntityServer.server.d.ts +58 -0
- package/dist/custom/MJGraphEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJGraphEntityServer.server.js +357 -0
- package/dist/custom/MJGraphEntityServer.server.js.map +1 -0
- package/dist/custom/MJGraphLinkEntityServer.server.d.ts +98 -0
- package/dist/custom/MJGraphLinkEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJGraphLinkEntityServer.server.js +375 -0
- package/dist/custom/MJGraphLinkEntityServer.server.js.map +1 -0
- package/dist/custom/MJGraphPermissionEntityServer.server.d.ts +29 -0
- package/dist/custom/MJGraphPermissionEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJGraphPermissionEntityServer.server.js +141 -0
- package/dist/custom/MJGraphPermissionEntityServer.server.js.map +1 -0
- package/dist/custom/MJListDetailEntityServer.server.d.ts +4 -4
- package/dist/custom/MJListDetailEntityServer.server.js +4 -4
- package/dist/custom/MJListEntityServer.server.d.ts +2 -1
- package/dist/custom/MJListEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJListEntityServer.server.js +5 -2
- 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/MJQueryEntityServer.server.d.ts +81 -0
- package/dist/custom/MJQueryEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJQueryEntityServer.server.js +194 -4
- package/dist/custom/MJQueryEntityServer.server.js.map +1 -1
- package/dist/custom/MJQueryParameterEntityServer.server.d.ts +37 -0
- package/dist/custom/MJQueryParameterEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJQueryParameterEntityServer.server.js +160 -0
- package/dist/custom/MJQueryParameterEntityServer.server.js.map +1 -0
- package/dist/custom/MJQuerySQLEntityServer.server.d.ts +36 -1
- package/dist/custom/MJQuerySQLEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJQuerySQLEntityServer.server.js +138 -7
- 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/MJRowLevelSecurityFilterEntityServer.server.d.ts +1 -1
- package/dist/custom/MJRowLevelSecurityFilterEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJRowLevelSecurityFilterEntityServer.server.js +8 -5
- package/dist/custom/MJRowLevelSecurityFilterEntityServer.server.js.map +1 -1
- package/dist/custom/MJUserRoleEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJUserRoleEntityServer.server.js +9 -0
- package/dist/custom/MJUserRoleEntityServer.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 +9 -0
- package/dist/custom/MJUserViewEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJUserViewEntityServer.server.js +59 -3
- package/dist/custom/MJUserViewEntityServer.server.js.map +1 -1
- package/dist/custom/agentRelationalGrantGuard.d.ts +73 -0
- package/dist/custom/agentRelationalGrantGuard.d.ts.map +1 -0
- package/dist/custom/agentRelationalGrantGuard.js +375 -0
- package/dist/custom/agentRelationalGrantGuard.js.map +1 -0
- package/dist/custom/approvalStamp.d.ts +86 -6
- package/dist/custom/approvalStamp.d.ts.map +1 -1
- package/dist/custom/approvalStamp.js +119 -15
- package/dist/custom/approvalStamp.js.map +1 -1
- package/dist/custom/canon/CanonFingerprintRecorderServer.d.ts +20 -0
- package/dist/custom/canon/CanonFingerprintRecorderServer.d.ts.map +1 -0
- package/dist/custom/canon/CanonFingerprintRecorderServer.js +148 -0
- package/dist/custom/canon/CanonFingerprintRecorderServer.js.map +1 -0
- package/dist/custom/canon/index.d.ts +2 -0
- package/dist/custom/canon/index.d.ts.map +1 -0
- package/dist/custom/canon/index.js +2 -0
- package/dist/custom/canon/index.js.map +1 -0
- package/dist/custom/graph/GraphFindPathServerOperation.d.ts +26 -0
- package/dist/custom/graph/GraphFindPathServerOperation.d.ts.map +1 -0
- package/dist/custom/graph/GraphFindPathServerOperation.js +117 -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/graphPermissionGuard.d.ts +69 -0
- package/dist/custom/graphPermissionGuard.d.ts.map +1 -0
- package/dist/custom/graphPermissionGuard.js +229 -0
- package/dist/custom/graphPermissionGuard.js.map +1 -0
- package/dist/custom/graphRlsCacheInvalidation.d.ts +38 -0
- package/dist/custom/graphRlsCacheInvalidation.d.ts.map +1 -0
- package/dist/custom/graphRlsCacheInvalidation.js +111 -0
- package/dist/custom/graphRlsCacheInvalidation.js.map +1 -0
- package/dist/custom/queryParentFingerprint.d.ts +36 -0
- package/dist/custom/queryParentFingerprint.d.ts.map +1 -0
- package/dist/custom/queryParentFingerprint.js +159 -0
- package/dist/custom/queryParentFingerprint.js.map +1 -0
- package/dist/custom/queryParentSaveChain.d.ts +5 -0
- package/dist/custom/queryParentSaveChain.d.ts.map +1 -0
- package/dist/custom/queryParentSaveChain.js +25 -0
- package/dist/custom/queryParentSaveChain.js.map +1 -0
- package/dist/custom/seededMetadataPush.d.ts +7 -0
- package/dist/custom/seededMetadataPush.d.ts.map +1 -0
- package/dist/custom/seededMetadataPush.js +23 -0
- package/dist/custom/seededMetadataPush.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +31 -31
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { BaseEntity } from '@memberjunction/core';
|
|
8
|
+
import { EscapeSQLString, RegisterClass } from '@memberjunction/global';
|
|
9
|
+
import { MJMLOutputBindingEntity } from '@memberjunction/core-entities';
|
|
10
|
+
import { RegistrySchemas, SemanticsRules } from '@memberjunction/predictive-studio-core';
|
|
11
|
+
import { VersionedRowGuard } from './MJMLPredictionUnitEntityServer.server.js';
|
|
12
|
+
/**
|
|
13
|
+
* `MJ: ML Output Bindings` (PR 4 §5.1, S9.5): how one surface shows a model's output. A save whose row breaks the
|
|
14
|
+
* model's `OutputSemantics` is refused: `ValidateAsync()` reads the model through the entity's own provider and checks
|
|
15
|
+
* THIS row alone with `SemanticsRules.CheckRow` (the lifecycle gate's pre-publication check covers the whole set of a
|
|
16
|
+
* model's rows), each mismatch on the field at fault. The rule is Core's; this class only calls it.
|
|
17
|
+
*/
|
|
18
|
+
let MJMLOutputBindingEntityServer = class MJMLOutputBindingEntityServer extends MJMLOutputBindingEntity {
|
|
19
|
+
/**
|
|
20
|
+
* The base checks, then this row's surface against the model's semantics. A provider that is not a metadata
|
|
21
|
+
* provider, a model that is missing or unreadable, and semantics that do not parse are each refused on `ModelID`.
|
|
22
|
+
*/
|
|
23
|
+
async ValidateAsync() {
|
|
24
|
+
const result = await super.ValidateAsync();
|
|
25
|
+
const provider = this.ProviderToUse;
|
|
26
|
+
if (!VersionedRowGuard.IsMetadataProvider(provider)) {
|
|
27
|
+
VersionedRowGuard.Fail(result, 'ModelID', "the entity's provider is not a metadata provider, so ML Model's OutputSemantics cannot be read to check the binding");
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
30
|
+
const semantics = await this.readSemantics(result, provider);
|
|
31
|
+
if (semantics === null)
|
|
32
|
+
return result;
|
|
33
|
+
for (const m of SemanticsRules.CheckRow(semantics, this))
|
|
34
|
+
VersionedRowGuard.Fail(result, m.Field, m.Message);
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
/** The model's parsed semantics; null when they could not be had, the reason recorded on `result` against `ModelID`. */
|
|
38
|
+
async readSemantics(result, provider) {
|
|
39
|
+
const filter = `ID='${EscapeSQLString(this.ModelID)}'`; // pk-filter-ok: MJ: ML Models is an MJ core entity keyed by ID
|
|
40
|
+
const read = await VersionedRowGuard.ReadOneRow(provider, 'MJ: ML Models', filter, this.ActiveUser, ['ID', 'OutputSemantics']);
|
|
41
|
+
if (read.Error !== null) {
|
|
42
|
+
VersionedRowGuard.Fail(result, 'ModelID', `Reading ML Model ${this.ModelID} failed: ${read.Error}`);
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
if (read.Row === null) {
|
|
46
|
+
VersionedRowGuard.Fail(result, 'ModelID', `ML Model ${this.ModelID} does not exist, so the binding cannot be checked against its semantics`);
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
const parsed = RegistrySchemas.ParseOutputSemantics(read.Row.OutputSemantics);
|
|
50
|
+
if (parsed.Ok === false) {
|
|
51
|
+
VersionedRowGuard.Fail(result, 'ModelID', `ML Model ${this.ModelID}'s OutputSemantics does not parse: ${parsed.Errors.join('; ')}`);
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
return parsed.Value;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
MJMLOutputBindingEntityServer = __decorate([
|
|
58
|
+
RegisterClass(BaseEntity, 'MJ: ML Output Bindings')
|
|
59
|
+
], MJMLOutputBindingEntityServer);
|
|
60
|
+
export { MJMLOutputBindingEntityServer };
|
|
61
|
+
//# sourceMappingURL=MJMLOutputBindingEntityServer.server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MJMLOutputBindingEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJMLOutputBindingEntityServer.server.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAiD,MAAM,sBAAsB,CAAC;AACjG,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAwB,MAAM,+BAA+B,CAAC;AAC9F,OAAO,EAAE,eAAe,EAAE,cAAc,EAAwB,MAAM,wCAAwC,CAAC;AAC/G,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAK5E;;;;;GAKG;AAEI,IAAM,6BAA6B,GA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AAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,IAAI,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC;YACtB,iBAAiB,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,YAAY,IAAI,CAAC,OAAO,yEAAyE,CAAC,CAAC;YAC7I,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,MAAM,GAAG,eAAe,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;QAC9E,IAAI,MAAM,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;YACxB,iBAAiB,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,YAAY,IAAI,CAAC,OAAO,sCAAsC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACpI,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,MAAM,CAAC,KAAK,CAAC;IACtB,CAAC;CACF,CAAA;AArCY,6BAA6B;IADzC,aAAa,CAAC,UAAU,EAAE,wBAAwB,CAAC;GACvC,6BAA6B,CAqCzC"}
|
|
@@ -72,10 +72,10 @@ export declare class VersionedRowGuard {
|
|
|
72
72
|
/** Records a failure on `field` and marks the result failed. */
|
|
73
73
|
static Fail(result: ValidationResult, field: string, message: string): void;
|
|
74
74
|
/**
|
|
75
|
-
* The first row of `entityName` matching `filter`, as a plain row (nothing is mutated)
|
|
76
|
-
* its error, so it is never reported as an absent row.
|
|
75
|
+
* The first row of `entityName` matching `filter`, as a plain row (nothing is mutated); only `fields` when given. A
|
|
76
|
+
* failed read is returned as its error, so it is never reported as an absent row.
|
|
77
77
|
*/
|
|
78
|
-
static ReadOneRow<TRow>(provider: IMetadataProvider, entityName: string, filter: string, user: UserInfo | undefined): Promise<RowRead<TRow>>;
|
|
78
|
+
static ReadOneRow<TRow>(provider: IMetadataProvider, entityName: string, filter: string, user: UserInfo | undefined, fields?: readonly (keyof TRow & string)[]): Promise<RowRead<TRow>>;
|
|
79
79
|
/** Version `version` of a lineage, read with {@link ReadOneRow}. */
|
|
80
80
|
static LoadVersion<TRow>(provider: IMetadataProvider, entityName: string, lineageRootID: string, version: number, user: UserInfo | undefined): Promise<RowRead<TRow>>;
|
|
81
81
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MJMLPredictionUnitEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJMLPredictionUnitEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAkF,KAAK,iBAAiB,EAAE,KAAK,mBAAmB,EAAE,KAAK,iBAAiB,EAAE,KAAK,QAAQ,EAAE,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAElP,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAkB,KAAK,WAAW,EAAuD,MAAM,wCAAwC,CAAC;AAE/I,0FAA0F;AAC1F,MAAM,WAAW,OAAO,CAAC,IAAI;IAC3B,oEAAoE;IACpE,QAAQ,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B,mDAAmD;IACnD,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,uIAAuI;AACvI,MAAM,WAAW,mBAAmB,CAAC,IAAI,SAAS;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,KAAK;IAC9E,wFAAwF;IACxF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,6CAA6C;IAC7C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,wDAAwD;IACxD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,uDAAuD;IACvD,QAAQ,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3D,kCAAkC;IAClC,QAAQ,CAAC,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AC,IAAI,CAAC,CAAC;IAIlL;;;OAGG;WACiB,eAAe,CAAC,IAAI,SAAS;QAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,KAAK,EAC7E,MAAM,EAAE,gBAAgB,EAAE,CAAC,EAAE,mBAAmB,CAAC,IAAI,EAAE,KAAK,CAAC,GAC5D,OAAO,CAAC;QAAE,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;KAAE,GAAG,IAAI,GAAG,SAAS,CAAC;IAoB3E;;;OAGG;WACW,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,MAAM,EAAE,GAAG,gBAAgB;CAUvK;AAED;;;;GAIG;AACH,qBACa,8BAA+B,SAAQ,wBAAwB;IAC1E,2FAA2F;WAC7E,4BAA4B,CAAC,GAAG,EAAE,wBAAwB,GAAG,SAAS,MAAM,EAAE;IAK5F,uHAAuH;WACzG,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM;IAI9E,+HAA+H;IACzG,IAAI,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IAKzD,QAAQ,IAAI,gBAAgB;IAI5C,IAAoB,0BAA0B,IAAI,OAAO,CAExD;IAED;;;OAGG;IACmB,aAAa,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAkBhE,0GAA0G;IAC1G,OAAO,CAAC,qBAAqB;IAQ7B;;;OAGG;YACW,iBAAiB;CAahC"}
|
|
@@ -80,11 +80,11 @@ export class VersionedRowGuard {
|
|
|
80
80
|
result.Errors.push(new ValidationErrorInfo(field, message, null, ValidationErrorType.Failure));
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
|
-
* The first row of `entityName` matching `filter`, as a plain row (nothing is mutated)
|
|
84
|
-
* its error, so it is never reported as an absent row.
|
|
83
|
+
* The first row of `entityName` matching `filter`, as a plain row (nothing is mutated); only `fields` when given. A
|
|
84
|
+
* failed read is returned as its error, so it is never reported as an absent row.
|
|
85
85
|
*/
|
|
86
|
-
static async ReadOneRow(provider, entityName, filter, user) {
|
|
87
|
-
const r = await RunView.FromMetadataProvider(provider).RunView({ EntityName: entityName, ExtraFilter: filter, ResultType: 'simple' }, user);
|
|
86
|
+
static async ReadOneRow(provider, entityName, filter, user, fields) {
|
|
87
|
+
const r = await RunView.FromMetadataProvider(provider).RunView({ EntityName: entityName, ExtraFilter: filter, ...(fields ? { Fields: [...fields] } : {}), ResultType: 'simple' }, user);
|
|
88
88
|
return r.Success ? { Row: r.Results[0] || null, Error: null } : { Row: null, Error: r.ErrorMessage || 'unknown error' };
|
|
89
89
|
}
|
|
90
90
|
/** Version `version` of a lineage, read with {@link ReadOneRow}. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MJMLPredictionUnitEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJMLPredictionUnitEntityServer.server.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAkH,MAAM,sBAAsB,CAAC;AAClP,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,cAAc,EAAyE,MAAM,wCAAwC,CAAC;AAwB/I;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,iBAAiB;IAC5B;;;;OAIG;IACI,MAAM,CAAC,4BAA4B,CAAC,UAAkB,EAAE,OAAgB,EAAE,WAA8B,EAAE,UAAmB;QAClI,IAAI,CAAC,OAAO,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;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IAAI,cAAc,IAAI,CAAC,IAAI,OAAO,CAAC,CAAC,YAAY,KAAK,UAAU,IAAI,UAAU,IAAI,CAAC,CAAC;IAC/F,CAAC;IAED,gEAAgE;IACzD,MAAM,CAAC,IAAI,CAAC,MAAwB,EAAE,KAAa,EAAE,OAAe;QACzE,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC;QACvB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC;IACjG,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAO,QAA2B,EAAE,UAAkB,EAAE,MAAc,EAAE,IAA0B;
|
|
1
|
+
{"version":3,"file":"MJMLPredictionUnitEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJMLPredictionUnitEntityServer.server.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAkH,MAAM,sBAAsB,CAAC;AAClP,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,cAAc,EAAyE,MAAM,wCAAwC,CAAC;AAwB/I;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,iBAAiB;IAC5B;;;;OAIG;IACI,MAAM,CAAC,4BAA4B,CAAC,UAAkB,EAAE,OAAgB,EAAE,WAA8B,EAAE,UAAmB;QAClI,IAAI,CAAC,OAAO,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QACtD,OAAO,UAAU;YACf,CAAC,CAAC,GAAG,UAAU,iCAAiC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,sGAAsG;YAC5K,CAAC,C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EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO;YAClF,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,iBAAiB,CAAC,WAAW,CAAwB,QAAQ,EAAE,yBAAyB,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC;YAC1J,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,cAAc,CAAC,sBAAsB,CAAC,GAAG,CAAC;SAC3D,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ;YAAE,OAAO;QACtB,MAAM,OAAO,GAAG,cAAc,CAAC,sBAAsB,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC3E,MAAM,QAAQ,GAAG,gCAA8B,CAAC,oBAAoB,CAAC,QAAQ,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACzG,IAAI,IAAI,CAAC,YAAY,KAAK,QAAQ,EAAE,CAAC;YACnC,iBAAiB,CAAC,IAAI,CAAC,MAAM,EAAE,cAAc,EAAE,wBAAwB,QAAQ,4BAA4B,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,gBAAgB,iBAAiB,IAAI,CAAC,OAAO,GAAG,CAAC,EAAE,CAAC,CAAC;QACxL,CAAC;IACH,CAAC;CACF,CAAA;AA1EY,8BAA8B;IAD1C,aAAa,CAAC,UAAU,EAAE,yBAAyB,CAAC;GACxC,8BAA8B,CA0E1C"}
|
|
@@ -66,6 +66,66 @@ export declare class MJQueryEntityServer extends MJQueryEntityExtended {
|
|
|
66
66
|
/** Re-embeds when the embedded text changed, or when the stored vector came from a model other than the default local one. */
|
|
67
67
|
private refreshEmbeddingAsync;
|
|
68
68
|
Save(options?: EntitySaveOptions): Promise<boolean>;
|
|
69
|
+
/**
|
|
70
|
+
* Whether a save of this query is running in the current async call chain: the caller is that
|
|
71
|
+
* save's own work (its extraction writing the dialect and parameter rows, before it stamps the
|
|
72
|
+
* fingerprints), so a row saved then needs no stamp of its own. False for every other request,
|
|
73
|
+
* even while the same query is being saved there (Finding 74).
|
|
74
|
+
*/
|
|
75
|
+
static IsSaveInProgress(queryID: string): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Re-stamps `DefinitionFingerprint` from the definition as now stored. For a dialect row saved
|
|
78
|
+
* or deleted on its own, after this query's save: a metadata push writes a query's
|
|
79
|
+
* `relatedEntities` rows after the query, so the save's own stamp did not see them. Approval is
|
|
80
|
+
* untouched; only a save can approve.
|
|
81
|
+
*/
|
|
82
|
+
RestampDefinitionFingerprintAsync(): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* D55: records the fingerprint of this query when it is Approved with none on record (see
|
|
85
|
+
* `RecordMissingApprovedFingerprintAsync`), from the definition as stored: the query row and its
|
|
86
|
+
* dialect and parameter rows. Writes the row directly, without the extraction and approval rules in
|
|
87
|
+
* {@link Save}.
|
|
88
|
+
*/
|
|
89
|
+
RecordMissingApprovedFingerprintAsync(): Promise<boolean>;
|
|
90
|
+
private saveOnServerAsync;
|
|
91
|
+
/**
|
|
92
|
+
* Whether this save changes the stored definition, or may: its SQL, template flag or external
|
|
93
|
+
* source differ from the stored row, or it will run extraction (Finding 70). Extraction can
|
|
94
|
+
* rewrite the parameter and dialect rows the fingerprint covers, and their own hooks are skipped
|
|
95
|
+
* while this save is in progress, so a save that extracts counts as a change even when the SQL
|
|
96
|
+
* is the same.
|
|
97
|
+
*/
|
|
98
|
+
private hasDefinitionChangeAgainstStored;
|
|
99
|
+
/** Whether this save writes declared child rows (see {@link PrepareDeclaredChildrenAsync}); reads nothing. */
|
|
100
|
+
private declaresChildRows;
|
|
101
|
+
/**
|
|
102
|
+
* Who may approve a query: a holder of the `Queries: Approve` authorization (or an Owner). Anyone
|
|
103
|
+
* the role permissions let save a query can still save it as a draft.
|
|
104
|
+
*/
|
|
105
|
+
private get approverRule();
|
|
106
|
+
/**
|
|
107
|
+
* Refuses a save that sets `CacheValidationSQL` to text, unless the user this save runs as may
|
|
108
|
+
* approve queries. A client's cache check runs that SQL as written, with none of the checks the
|
|
109
|
+
* query's own SQL goes through, so writing it takes the same trust as approving. Clearing it is
|
|
110
|
+
* always allowed. A save with no context user is not checked, like the fingerprint stamp.
|
|
111
|
+
*/
|
|
112
|
+
private assertMayWriteValidationSQL;
|
|
113
|
+
/**
|
|
114
|
+
* Who owns the query. A new query is owned by the user saving it: one who does not hold
|
|
115
|
+
* `Queries: Approve` always owns what they create, and a holder may name another owner. An
|
|
116
|
+
* existing query's owner changes only for a holder. A save with no context user is not
|
|
117
|
+
* checked, like the approval rules.
|
|
118
|
+
*/
|
|
119
|
+
private applyOwnerRules;
|
|
120
|
+
/**
|
|
121
|
+
* Saves a change to an Approved query's definition (its SQL, template flag or external source)
|
|
122
|
+
* as Pending when the user saving it does not hold `Queries: Approve`. The approval named the
|
|
123
|
+
* definition a holder approved; a new one needs a holder too. Until then every surface that lists
|
|
124
|
+
* Approved queries stops offering it, not only the runs that check the fingerprint. A change to
|
|
125
|
+
* the name, category or `Reusable` flag does the same, because other Approved queries compose
|
|
126
|
+
* this one by its path (see `QUERY_COMPOSITION_FIELD_NAMES`).
|
|
127
|
+
*/
|
|
128
|
+
private returnEditedApprovalToPending;
|
|
69
129
|
/** Whether this object saves through a network (client) provider rather than to a database. */
|
|
70
130
|
private get savesOverNetwork();
|
|
71
131
|
/**
|
|
@@ -134,11 +194,32 @@ export declare class MJQueryEntityServer extends MJQueryEntityExtended {
|
|
|
134
194
|
* each refresh. On an approving save it also goes in `ApprovedFingerprint`; until that write
|
|
135
195
|
* lands the approval is not current, so a failure here fails closed. Nothing is written when
|
|
136
196
|
* neither value changed.
|
|
197
|
+
*
|
|
198
|
+
* The stamp is a second save, an update, so it is skipped for a user who may create queries but
|
|
199
|
+
* not update them (the UI role saving a draft). That user cannot approve, so only
|
|
200
|
+
* `DefinitionFingerprint` is lost, and it is left null: a list linked to the query computes the
|
|
201
|
+
* fingerprint live and treats a null stored one as unchanged.
|
|
137
202
|
*/
|
|
138
203
|
private stampFingerprintsAsync;
|
|
204
|
+
/** Whether the user this save runs as may update queries; true when there is no such user. */
|
|
205
|
+
private contextUserCanUpdate;
|
|
139
206
|
/** This query's dialect and parameter rows as stored, bypassing every cache. */
|
|
140
207
|
private loadDefinitionRowsAsync;
|
|
141
208
|
Delete(options?: EntitySaveOptions): Promise<boolean>;
|
|
209
|
+
/**
|
|
210
|
+
* Whether deleting this query would change records the deleting user does not own, when that
|
|
211
|
+
* user does not hold `Queries: Approve`. `spDeleteQuery` deletes the dependency rows of every
|
|
212
|
+
* query that composes this one and unlinks every list sourced from it, so a user who may delete
|
|
213
|
+
* only their own queries is refused when another query composes it or another user's list is
|
|
214
|
+
* sourced from it. Their own list sourced from it does not stop the delete (that is the cleanup
|
|
215
|
+
* of a list's unused draft). A delete with no context user is not checked, like the approval rules.
|
|
216
|
+
*
|
|
217
|
+
* The rows are read as the system user: the deleting user's own row filters may hide another
|
|
218
|
+
* user's list, and only a yes/no leaves this method.
|
|
219
|
+
*/
|
|
220
|
+
private deleteWouldChangeOthersRecordsAsync;
|
|
221
|
+
/** The result entry for a refused delete, carrying the reason. */
|
|
222
|
+
private deleteRefusalResult;
|
|
142
223
|
/**
|
|
143
224
|
* The platform the query is extracted for: the platform of the provider this entity saves
|
|
144
225
|
* through, so two providers on different platforms in one process each extract for their own.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MJQueryEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJQueryEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,iBAAiB,EAOjB,qBAAqB,EAExB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAMH,qBAAqB,
|
|
1
|
+
{"version":3,"file":"MJQueryEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJQueryEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,iBAAiB,EAOj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,gHAAgH;YAClG,4BAA4B;IAS1C;;;OAGG;YACW,oBAAoB;YAWpB,qBAAqB;IAUnC;;;;OAIG;YACW,oBAAoB;IAalC,uGAAuG;IACvG,OAAO,CAAC,YAAY;YAMN,uBAAuB;IAUrC,mGAAmG;IACnG,OAAO,CAAC,sBAAsB;IAK9B;;;;;;;OAOG;IACH,OAAO,CAAC,oBAAoB;IAS5B;;;;;;;OAOG;IACU,eAAe,CAAC,gBAAgB,UAAQ,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAU3F;;;;OAIG;IACU,6BAA6B,IAAI,OAAO,CAAC,qBAAqB,CAAC;IAI5E;;;OAGG;IACU,mBAAmB,CAAC,UAAU,EAAE,qBAAqB,EAAE,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAM7I;;;;;;;;;;;OAWG;IACU,iBAAiB,CAAC,UAAU,EAAE,qBAAqB,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAiBxH;;OAEG;YACW,sBAAsB;IAsBpC;;;OAGG;YACW,wBAAwB;IAiCtC;;OAEG;YACW,sBAAsB;IA4BpC;;OAEG;YACW,oBAAoB;CAsCrC"}
|
|
@@ -5,13 +5,14 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { BaseEntity, BaseEntityResult, DatabaseProviderBase, LogError, ProviderBase, ProviderType, } from "@memberjunction/core";
|
|
8
|
-
import { ComputeQueryFingerprintAsync, MJQueryEntityExtended, QueryEngine, } from "@memberjunction/core-entities";
|
|
8
|
+
import { ComputeQueryFingerprintAsync, MJQueryEntityExtended, QueryEngine, QUERY_APPROVAL_REFUSAL, QUERY_COMPOSITION_FIELD_NAMES, QUERY_DEFINITION_FIELD_NAMES, QUERY_DELETE_IN_USE_REFUSAL, QUERY_OWNER_REFUSAL, QUERY_VALIDATION_SQL_REFUSAL, UserCanApproveQueries, } from "@memberjunction/core-entities";
|
|
9
9
|
import { EscapeSQLString, Float32VectorToBase64, RegisterClass, MJGlobal, UUIDsEqual } from "@memberjunction/global";
|
|
10
|
+
import { IsQueryParentSaveInChain, RunAsQueryParentSave } from "./queryParentSaveChain.js";
|
|
10
11
|
import { GenericDatabaseProvider, UserCache } from "@memberjunction/generic-database-provider";
|
|
11
12
|
import { CompositionFullPath } from "@memberjunction/sql-parser";
|
|
12
13
|
import { EmbedTextLocalHelper, IsLocalEmbeddingStaleHelper } from "./util.js";
|
|
13
14
|
import { CleanupQueryData, ConvertTSQLToPostgreSQL, CollectDeclaredQueryChildren, HasDeclaredQueryChildren, FindReplacedRows, QueueReplacedRowDeletion, QueryChildNameKey, QueryEntityKey, NO_DECLARED_QUERY_CHILDREN, ComputeQueryExtraction, WriteExtractedChildRows, ApplyFieldFacts, RunDescriptionPass, SQLUsesTemplate, ReadCompositionTargetsAsync, MergeCompositionCandidates, } from "./query-extraction/index.js";
|
|
14
|
-
import { ApplyApprovalRulesAsync, ApprovalRefusalResult } from "./approvalStamp.js";
|
|
15
|
+
import { ApplyApprovalRulesAsync, ApprovalRefusalResult, AssertStoredColumnsPresent, RecordMissingApprovedFingerprintAsync } from "./approvalStamp.js";
|
|
15
16
|
/** Whether `provider` can read views and create entity objects, which is all extraction's writes need. */
|
|
16
17
|
function IsExtractionProvider(provider) {
|
|
17
18
|
if (provider === null || typeof provider !== 'object')
|
|
@@ -133,10 +134,54 @@ let MJQueryEntityServer = class MJQueryEntityServer extends MJQueryEntityExtende
|
|
|
133
134
|
// child rows twice, the second time from the client.
|
|
134
135
|
if (this.savesOverNetwork)
|
|
135
136
|
return super.Save(options);
|
|
137
|
+
// Finding 74: the marker rides this save's own call chain (see queryParentSaveChain.ts).
|
|
138
|
+
return RunAsQueryParentSave(this.ID, () => this.saveOnServerAsync(options));
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Whether a save of this query is running in the current async call chain: the caller is that
|
|
142
|
+
* save's own work (its extraction writing the dialect and parameter rows, before it stamps the
|
|
143
|
+
* fingerprints), so a row saved then needs no stamp of its own. False for every other request,
|
|
144
|
+
* even while the same query is being saved there (Finding 74).
|
|
145
|
+
*/
|
|
146
|
+
static IsSaveInProgress(queryID) {
|
|
147
|
+
return IsQueryParentSaveInChain(queryID);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Re-stamps `DefinitionFingerprint` from the definition as now stored. For a dialect row saved
|
|
151
|
+
* or deleted on its own, after this query's save: a metadata push writes a query's
|
|
152
|
+
* `relatedEntities` rows after the query, so the save's own stamp did not see them. Approval is
|
|
153
|
+
* untouched; only a save can approve.
|
|
154
|
+
*/
|
|
155
|
+
async RestampDefinitionFingerprintAsync() {
|
|
156
|
+
await this.stampFingerprintsAsync(undefined, false);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* D55: records the fingerprint of this query when it is Approved with none on record (see
|
|
160
|
+
* `RecordMissingApprovedFingerprintAsync`), from the definition as stored: the query row and its
|
|
161
|
+
* dialect and parameter rows. Writes the row directly, without the extraction and approval rules in
|
|
162
|
+
* {@link Save}.
|
|
163
|
+
*/
|
|
164
|
+
async RecordMissingApprovedFingerprintAsync() {
|
|
165
|
+
return RecordMissingApprovedFingerprintAsync(this, 'Status', async () => ComputeQueryFingerprintAsync(this, await this.loadDefinitionRowsAsync()), (writeOptions) => super.Save(writeOptions));
|
|
166
|
+
}
|
|
167
|
+
async saveOnServerAsync(options) {
|
|
136
168
|
let approving;
|
|
137
169
|
try {
|
|
170
|
+
if (!options?.ReplayOnly) {
|
|
171
|
+
this.assertMayWriteValidationSQL();
|
|
172
|
+
this.applyOwnerRules();
|
|
173
|
+
this.returnEditedApprovalToPending();
|
|
174
|
+
}
|
|
138
175
|
// Approving is a server act; a ReplayOnly save writes nothing, so it has nothing to stamp.
|
|
139
|
-
approving = !options?.ReplayOnly && await ApplyApprovalRulesAsync(this, 'Status', this.Status
|
|
176
|
+
approving = !options?.ReplayOnly && await ApplyApprovalRulesAsync(this, 'Status', this.Status, this.approverRule, {
|
|
177
|
+
StoredFields: ['SQL', 'UsesTemplate', 'ExternalDataSourceID'],
|
|
178
|
+
HasDefinitionChange: (stored) => this.hasDefinitionChangeAgainstStored(stored, options),
|
|
179
|
+
ComputeStoredFingerprint: async (stored) => ComputeQueryFingerprintAsync({
|
|
180
|
+
SQL: stored.SQL ?? null,
|
|
181
|
+
UsesTemplate: Boolean(stored.UsesTemplate),
|
|
182
|
+
ExternalDataSourceID: stored.ExternalDataSourceID ?? null,
|
|
183
|
+
}, await this.loadDefinitionRowsAsync()),
|
|
184
|
+
});
|
|
140
185
|
}
|
|
141
186
|
catch (e) {
|
|
142
187
|
this.RegisterResultHistoryEntry(ApprovalRefusalResult(this, e));
|
|
@@ -157,6 +202,99 @@ let MJQueryEntityServer = class MJQueryEntityServer extends MJQueryEntityExtende
|
|
|
157
202
|
this.refreshing = false;
|
|
158
203
|
}
|
|
159
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* Whether this save changes the stored definition, or may: its SQL, template flag or external
|
|
207
|
+
* source differ from the stored row, or it will run extraction (Finding 70). Extraction can
|
|
208
|
+
* rewrite the parameter and dialect rows the fingerprint covers, and their own hooks are skipped
|
|
209
|
+
* while this save is in progress, so a save that extracts counts as a change even when the SQL
|
|
210
|
+
* is the same.
|
|
211
|
+
*/
|
|
212
|
+
hasDefinitionChangeAgainstStored(stored, options) {
|
|
213
|
+
return ((this.SQL ?? '') !== (stored.SQL ?? '') ||
|
|
214
|
+
Boolean(this.UsesTemplate) !== Boolean(stored.UsesTemplate) ||
|
|
215
|
+
!UUIDsEqual(this.ExternalDataSourceID, stored.ExternalDataSourceID) ||
|
|
216
|
+
this.GetFieldByName('SQL')?.Dirty === true ||
|
|
217
|
+
(this.DeclaredParameters?.Items?.length ?? 0) > 0 ||
|
|
218
|
+
this.ExtractionOverride === 'Force' ||
|
|
219
|
+
this.planExtraction(options, this.declaresChildRows(options)).Run);
|
|
220
|
+
}
|
|
221
|
+
/** Whether this save writes declared child rows (see {@link PrepareDeclaredChildrenAsync}); reads nothing. */
|
|
222
|
+
declaresChildRows(options) {
|
|
223
|
+
if (options?.ReplayOnly || options?.SkipRelatedCollections) {
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
return HasDeclaredQueryChildren(CollectDeclaredQueryChildren({
|
|
227
|
+
Parameters: this.DeclaredParameters,
|
|
228
|
+
Fields: this.DeclaredFields,
|
|
229
|
+
Entities: this.DeclaredEntities,
|
|
230
|
+
}));
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Who may approve a query: a holder of the `Queries: Approve` authorization (or an Owner). Anyone
|
|
234
|
+
* the role permissions let save a query can still save it as a draft.
|
|
235
|
+
*/
|
|
236
|
+
get approverRule() {
|
|
237
|
+
return {
|
|
238
|
+
CanApprove: (user) => UserCanApproveQueries(user, this.extractionProvider),
|
|
239
|
+
Refusal: QUERY_APPROVAL_REFUSAL,
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Refuses a save that sets `CacheValidationSQL` to text, unless the user this save runs as may
|
|
244
|
+
* approve queries. A client's cache check runs that SQL as written, with none of the checks the
|
|
245
|
+
* query's own SQL goes through, so writing it takes the same trust as approving. Clearing it is
|
|
246
|
+
* always allowed. A save with no context user is not checked, like the fingerprint stamp.
|
|
247
|
+
*/
|
|
248
|
+
assertMayWriteValidationSQL() {
|
|
249
|
+
// A new record writes every field it carries, so only a saved one can leave it unchanged.
|
|
250
|
+
if (!this.CacheValidationSQL?.trim() || (this.IsSaved && !this.FieldIsDirty('CacheValidationSQL')))
|
|
251
|
+
return;
|
|
252
|
+
const user = this.ContextCurrentUser;
|
|
253
|
+
if (user && !UserCanApproveQueries(user, this.extractionProvider)) {
|
|
254
|
+
throw new Error(QUERY_VALIDATION_SQL_REFUSAL);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Who owns the query. A new query is owned by the user saving it: one who does not hold
|
|
259
|
+
* `Queries: Approve` always owns what they create, and a holder may name another owner. An
|
|
260
|
+
* existing query's owner changes only for a holder. A save with no context user is not
|
|
261
|
+
* checked, like the approval rules.
|
|
262
|
+
*/
|
|
263
|
+
applyOwnerRules() {
|
|
264
|
+
const user = this.ContextCurrentUser;
|
|
265
|
+
if (!user)
|
|
266
|
+
return;
|
|
267
|
+
const canApprove = () => UserCanApproveQueries(user, this.extractionProvider);
|
|
268
|
+
if (!this.IsSaved) {
|
|
269
|
+
if (!this.OwnerUserID || (!UUIDsEqual(this.OwnerUserID, user.ID) && !canApprove()))
|
|
270
|
+
this.OwnerUserID = user.ID;
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
if (this.FieldIsDirty('OwnerUserID') && !canApprove()) {
|
|
274
|
+
throw new Error(QUERY_OWNER_REFUSAL);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Saves a change to an Approved query's definition (its SQL, template flag or external source)
|
|
279
|
+
* as Pending when the user saving it does not hold `Queries: Approve`. The approval named the
|
|
280
|
+
* definition a holder approved; a new one needs a holder too. Until then every surface that lists
|
|
281
|
+
* Approved queries stops offering it, not only the runs that check the fingerprint. A change to
|
|
282
|
+
* the name, category or `Reusable` flag does the same, because other Approved queries compose
|
|
283
|
+
* this one by its path (see `QUERY_COMPOSITION_FIELD_NAMES`).
|
|
284
|
+
*/
|
|
285
|
+
returnEditedApprovalToPending() {
|
|
286
|
+
if (!this.IsSaved || this.Status !== 'Approved')
|
|
287
|
+
return;
|
|
288
|
+
if (this.GetFieldByName('Status').OldValue !== 'Approved')
|
|
289
|
+
return;
|
|
290
|
+
const edited = [...QUERY_DEFINITION_FIELD_NAMES, ...QUERY_COMPOSITION_FIELD_NAMES];
|
|
291
|
+
if (!edited.some(name => this.FieldIsDirty(name)))
|
|
292
|
+
return;
|
|
293
|
+
const user = this.ContextCurrentUser;
|
|
294
|
+
if (!user || UserCanApproveQueries(user, this.extractionProvider))
|
|
295
|
+
return;
|
|
296
|
+
this.Status = 'Pending';
|
|
297
|
+
}
|
|
160
298
|
/** Whether this object saves through a network (client) provider rather than to a database. */
|
|
161
299
|
get savesOverNetwork() {
|
|
162
300
|
const provider = this.ProviderToUse;
|
|
@@ -334,6 +472,11 @@ let MJQueryEntityServer = class MJQueryEntityServer extends MJQueryEntityExtende
|
|
|
334
472
|
* each refresh. On an approving save it also goes in `ApprovedFingerprint`; until that write
|
|
335
473
|
* lands the approval is not current, so a failure here fails closed. Nothing is written when
|
|
336
474
|
* neither value changed.
|
|
475
|
+
*
|
|
476
|
+
* The stamp is a second save, an update, so it is skipped for a user who may create queries but
|
|
477
|
+
* not update them (the UI role saving a draft). That user cannot approve, so only
|
|
478
|
+
* `DefinitionFingerprint` is lost, and it is left null: a list linked to the query computes the
|
|
479
|
+
* fingerprint live and treats a null stored one as unchanged.
|
|
337
480
|
*/
|
|
338
481
|
async stampFingerprintsAsync(options, approving) {
|
|
339
482
|
try {
|
|
@@ -343,6 +486,8 @@ let MJQueryEntityServer = class MJQueryEntityServer extends MJQueryEntityExtende
|
|
|
343
486
|
this.ApprovedFingerprint = fingerprint;
|
|
344
487
|
if (!this.Dirty)
|
|
345
488
|
return;
|
|
489
|
+
if (!approving && !this.contextUserCanUpdate())
|
|
490
|
+
return;
|
|
346
491
|
if (!await super.Save(options)) {
|
|
347
492
|
LogError(`[MJQueryEntityServer] Query "${this.Name}" saved, but its fingerprint was not: ${this.LatestResult?.CompleteMessage}`);
|
|
348
493
|
}
|
|
@@ -351,20 +496,34 @@ let MJQueryEntityServer = class MJQueryEntityServer extends MJQueryEntityExtende
|
|
|
351
496
|
LogError(`[MJQueryEntityServer] Query "${this.Name}" saved, but its fingerprint could not be computed: ${e instanceof Error ? e.message : String(e)}`);
|
|
352
497
|
}
|
|
353
498
|
}
|
|
499
|
+
/** Whether the user this save runs as may update queries; true when there is no such user. */
|
|
500
|
+
contextUserCanUpdate() {
|
|
501
|
+
const user = this.ContextCurrentUser;
|
|
502
|
+
return !user || this.EntityInfo.GetUserPermisions(user)?.CanUpdate === true;
|
|
503
|
+
}
|
|
354
504
|
/** This query's dialect and parameter rows as stored, bypassing every cache. */
|
|
355
505
|
async loadDefinitionRowsAsync() {
|
|
356
506
|
const filter = `QueryID='${EscapeSQLString(this.ID)}'`;
|
|
357
507
|
const [sqls, parameters] = await this.RunViewProviderToUse.RunViews([
|
|
358
508
|
{ EntityName: 'MJ: Query SQLs', ExtraFilter: filter, Fields: ['SQLDialectID', 'SQL'], ResultType: 'simple', BypassCache: true },
|
|
359
509
|
{ EntityName: 'MJ: Query Parameters', ExtraFilter: filter, Fields: ['Name', 'Type', 'IsRequired', 'ValidationFilters', 'IsServerSet'], ResultType: 'simple', BypassCache: true },
|
|
360
|
-
], this.
|
|
510
|
+
], this.extractionUser);
|
|
361
511
|
if (!sqls?.Success || !parameters?.Success) {
|
|
362
512
|
throw new Error(`could not read the query's definition rows: ${sqls?.ErrorMessage || parameters?.ErrorMessage}`);
|
|
363
513
|
}
|
|
514
|
+
// A column field security dropped would change the fingerprint without a definition change.
|
|
515
|
+
for (const row of sqls.Results)
|
|
516
|
+
AssertStoredColumnsPresent(row, ['SQLDialectID', 'SQL'], `dialect rows of query ${this.ID}`);
|
|
517
|
+
for (const row of parameters.Results)
|
|
518
|
+
AssertStoredColumnsPresent(row, ['Name', 'Type', 'IsRequired', 'ValidationFilters', 'IsServerSet'], `parameter rows of query ${this.ID}`);
|
|
364
519
|
return { SQLs: sqls.Results, Parameters: parameters.Results };
|
|
365
520
|
}
|
|
366
521
|
async Delete(options) {
|
|
367
522
|
try {
|
|
523
|
+
if (!options?.ReplayOnly && await this.deleteWouldChangeOthersRecordsAsync()) {
|
|
524
|
+
this.RegisterResultHistoryEntry(this.deleteRefusalResult(QUERY_DELETE_IN_USE_REFUSAL));
|
|
525
|
+
return false;
|
|
526
|
+
}
|
|
368
527
|
return await super.Delete(options);
|
|
369
528
|
}
|
|
370
529
|
catch (e) {
|
|
@@ -373,6 +532,37 @@ let MJQueryEntityServer = class MJQueryEntityServer extends MJQueryEntityExtende
|
|
|
373
532
|
return false;
|
|
374
533
|
}
|
|
375
534
|
}
|
|
535
|
+
/**
|
|
536
|
+
* Whether deleting this query would change records the deleting user does not own, when that
|
|
537
|
+
* user does not hold `Queries: Approve`. `spDeleteQuery` deletes the dependency rows of every
|
|
538
|
+
* query that composes this one and unlinks every list sourced from it, so a user who may delete
|
|
539
|
+
* only their own queries is refused when another query composes it or another user's list is
|
|
540
|
+
* sourced from it. Their own list sourced from it does not stop the delete (that is the cleanup
|
|
541
|
+
* of a list's unused draft). A delete with no context user is not checked, like the approval rules.
|
|
542
|
+
*
|
|
543
|
+
* The rows are read as the system user: the deleting user's own row filters may hide another
|
|
544
|
+
* user's list, and only a yes/no leaves this method.
|
|
545
|
+
*/
|
|
546
|
+
async deleteWouldChangeOthersRecordsAsync() {
|
|
547
|
+
const user = this.ContextCurrentUser;
|
|
548
|
+
if (!user || UserCanApproveQueries(user, this.extractionProvider))
|
|
549
|
+
return false;
|
|
550
|
+
const id = EscapeSQLString(this.ID);
|
|
551
|
+
const [dependents, lists] = await this.RunViewProviderToUse.RunViews([
|
|
552
|
+
{ EntityName: 'MJ: Query Dependencies', ExtraFilter: `DependsOnQueryID='${id}' AND QueryID<>'${id}'`, Fields: ['ID'], MaxRows: 1, ResultType: 'simple', BypassCache: true },
|
|
553
|
+
{ EntityName: 'MJ: Lists', ExtraFilter: `SourceQueryID='${id}' AND UserID<>'${EscapeSQLString(user.ID)}'`, Fields: ['ID'], MaxRows: 1, ResultType: 'simple', BypassCache: true },
|
|
554
|
+
], UserCache.Instance?.GetSystemUser?.() ?? user);
|
|
555
|
+
if (!dependents?.Success || !lists?.Success) {
|
|
556
|
+
throw new Error(`could not check what uses the query: ${dependents?.ErrorMessage || lists?.ErrorMessage}`);
|
|
557
|
+
}
|
|
558
|
+
return dependents.Results.length > 0 || lists.Results.length > 0;
|
|
559
|
+
}
|
|
560
|
+
/** The result entry for a refused delete, carrying the reason. */
|
|
561
|
+
deleteRefusalResult(reason) {
|
|
562
|
+
const result = this.refusalResult(reason);
|
|
563
|
+
result.Type = 'delete';
|
|
564
|
+
return result;
|
|
565
|
+
}
|
|
376
566
|
// ─── Extraction ──────────────────────────────────────────────────────────────
|
|
377
567
|
/**
|
|
378
568
|
* The platform the query is extracted for: the platform of the provider this entity saves
|