@memberjunction/core-entities-server 6.2.0-edge.3 → 6.2.0-edge.5
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/MJAIAgentSessionEntityServer.server.d.ts +47 -0
- package/dist/custom/MJAIAgentSessionEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJAIAgentSessionEntityServer.server.js +101 -0
- package/dist/custom/MJAIAgentSessionEntityServer.server.js.map +1 -0
- package/dist/custom/MJAIPromptRunEntityServer.server.d.ts +32 -1
- package/dist/custom/MJAIPromptRunEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJAIPromptRunEntityServer.server.js +96 -31
- package/dist/custom/MJAIPromptRunEntityServer.server.js.map +1 -1
- package/dist/custom/MJApplicationEntityServer.server.js +5 -3
- package/dist/custom/MJApplicationEntityServer.server.js.map +1 -1
- package/dist/custom/MJArtifactVersionEntityServer.server.js +2 -2
- package/dist/custom/MJArtifactVersionEntityServer.server.js.map +1 -1
- package/dist/custom/MJConversationDetailEntityServer.server.d.ts +16 -3
- package/dist/custom/MJConversationDetailEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJConversationDetailEntityServer.server.js +62 -5
- package/dist/custom/MJConversationDetailEntityServer.server.js.map +1 -1
- package/dist/custom/MJDataContextItemEntityServer.server.d.ts +33 -0
- package/dist/custom/MJDataContextItemEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJDataContextItemEntityServer.server.js +84 -0
- package/dist/custom/MJDataContextItemEntityServer.server.js.map +1 -0
- package/dist/custom/MJFileEntityServer.server.d.ts +45 -0
- package/dist/custom/MJFileEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJFileEntityServer.server.js +101 -0
- package/dist/custom/MJFileEntityServer.server.js.map +1 -0
- package/dist/custom/MJQueryEntityServer.server.d.ts +5 -1
- package/dist/custom/MJQueryEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJQueryEntityServer.server.js +11 -6
- package/dist/custom/MJQueryEntityServer.server.js.map +1 -1
- package/dist/custom/MJQuerySQLEntityServer.server.js +3 -3
- package/dist/custom/MJQuerySQLEntityServer.server.js.map +1 -1
- package/dist/custom/MJRowLevelSecurityFilterEntityServer.server.d.ts +26 -14
- package/dist/custom/MJRowLevelSecurityFilterEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJRowLevelSecurityFilterEntityServer.server.js +57 -32
- package/dist/custom/MJRowLevelSecurityFilterEntityServer.server.js.map +1 -1
- package/dist/custom/MJUserRoutineEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJUserRoutineEntityServer.server.js +12 -3
- package/dist/custom/MJUserRoutineEntityServer.server.js.map +1 -1
- package/dist/custom/MJUserViewEntityServer.server.d.ts +26 -0
- package/dist/custom/MJUserViewEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJUserViewEntityServer.server.js +74 -4
- package/dist/custom/MJUserViewEntityServer.server.js.map +1 -1
- package/dist/custom/MJVectorIndexEntityServer.server.d.ts +96 -7
- package/dist/custom/MJVectorIndexEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJVectorIndexEntityServer.server.js +276 -37
- package/dist/custom/MJVectorIndexEntityServer.server.js.map +1 -1
- package/dist/custom/query-extraction/pipeline.d.ts.map +1 -1
- package/dist/custom/query-extraction/pipeline.js +56 -5
- package/dist/custom/query-extraction/pipeline.js.map +1 -1
- package/dist/custom/query-extraction/types.d.ts +3 -0
- package/dist/custom/query-extraction/types.d.ts.map +1 -1
- package/dist/custom/rowFilterValidation.d.ts +47 -2
- package/dist/custom/rowFilterValidation.d.ts.map +1 -1
- package/dist/custom/rowFilterValidation.js +122 -11
- package/dist/custom/rowFilterValidation.js.map +1 -1
- package/dist/custom/rubrics/versionPublish.d.ts.map +1 -1
- package/dist/custom/rubrics/versionPublish.js +7 -5
- package/dist/custom/rubrics/versionPublish.js.map +1 -1
- package/dist/custom/sessionConfigGuard.d.ts +70 -0
- package/dist/custom/sessionConfigGuard.d.ts.map +1 -0
- package/dist/custom/sessionConfigGuard.js +125 -0
- package/dist/custom/sessionConfigGuard.js.map +1 -0
- package/dist/custom/template-extraction/pipeline.d.ts +6 -1
- package/dist/custom/template-extraction/pipeline.d.ts.map +1 -1
- package/dist/custom/template-extraction/pipeline.js +15 -6
- package/dist/custom/template-extraction/pipeline.js.map +1 -1
- package/dist/custom/template-extraction/types.d.ts +1 -1
- package/dist/custom/template-extraction/types.d.ts.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/package.json +30 -30
|
@@ -4,12 +4,13 @@ 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 } from "@memberjunction/core";
|
|
8
|
-
import { RegisterClass } from "@memberjunction/global";
|
|
7
|
+
import { BaseEntity, BaseEntityResult, LogError, RunView } from "@memberjunction/core";
|
|
8
|
+
import { EscapeSQLString, RegisterClass, UUIDsEqual } from "@memberjunction/global";
|
|
9
9
|
import { MJConversationDetailEntityExtended } from "@memberjunction/core-entities";
|
|
10
10
|
/**
|
|
11
11
|
* Server-side subclass of MJConversationDetailEntity that automatically tracks
|
|
12
|
-
* when the original message content has been modified
|
|
12
|
+
* when the original message content has been modified, and checks the fork of
|
|
13
|
+
* each new message.
|
|
13
14
|
*
|
|
14
15
|
* When a user edits their message after initial creation, the OriginalMessageChanged
|
|
15
16
|
* flag is set to true, allowing the UI to display an "(Edited)" indicator. This is
|
|
@@ -31,18 +32,74 @@ import { MJConversationDetailEntityExtended } from "@memberjunction/core-entitie
|
|
|
31
32
|
* run server-side (`ProviderType === 'Database'`), which is exactly where it was being
|
|
32
33
|
* shadowed out. Inheriting composes the two behaviors instead: this class flags the edit,
|
|
33
34
|
* then delegates to the permission gate via `super.Save`.
|
|
35
|
+
*
|
|
36
|
+
* A new row keeps the `BranchID` its writer set (null is Main). On create, a non-null `BranchID`
|
|
37
|
+
* must name a fork of the same conversation; otherwise `Save` returns `false` with a result
|
|
38
|
+
* entry and nothing is written.
|
|
34
39
|
*/
|
|
35
40
|
let MJConversationDetailEntityServer = class MJConversationDetailEntityServer extends MJConversationDetailEntityExtended {
|
|
36
41
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
42
|
+
* Sets the OriginalMessageChanged flag on a genuine message edit, checks a new row's fork,
|
|
43
|
+
* then calls super.Save(). Returns `false` without saving when the fork check fails.
|
|
39
44
|
*/
|
|
40
45
|
async Save(options) {
|
|
41
46
|
if (this.ShouldFlagOriginalMessageChanged()) {
|
|
42
47
|
this.OriginalMessageChanged = true;
|
|
43
48
|
}
|
|
49
|
+
const problem = await this.CheckBranchOnCreate();
|
|
50
|
+
if (problem) {
|
|
51
|
+
this.recordCreateFailure(problem);
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
44
54
|
return super.Save(options);
|
|
45
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* On create, a non-null BranchID must name a fork of the same conversation. Returns why the save
|
|
58
|
+
* must fail, or null when it may go on. An existing row, a Main row (null BranchID), a row with no
|
|
59
|
+
* ConversationID and a save with no context user are not checked.
|
|
60
|
+
*/
|
|
61
|
+
async CheckBranchOnCreate() {
|
|
62
|
+
if (this.IsSaved || this.BranchID == null || !this.ConversationID) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
const user = this.ContextCurrentUser;
|
|
66
|
+
if (!user) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
const branchId = this.BranchID;
|
|
70
|
+
try {
|
|
71
|
+
const rv = RunView.FromMetadataProvider(this.ProviderToUse);
|
|
72
|
+
const result = await rv.RunView({
|
|
73
|
+
EntityName: 'MJ: Conversation Branches',
|
|
74
|
+
ExtraFilter: `ID='${EscapeSQLString(branchId)}'`,
|
|
75
|
+
Fields: ['ID', 'ConversationID'],
|
|
76
|
+
ResultType: 'simple',
|
|
77
|
+
}, user);
|
|
78
|
+
if (!result.Success) {
|
|
79
|
+
LogError(`MJConversationDetailEntityServer: could not read fork ${branchId}: ${result.ErrorMessage}`);
|
|
80
|
+
return 'Unable to check the fork of this message.';
|
|
81
|
+
}
|
|
82
|
+
const fork = result.Results?.[0];
|
|
83
|
+
if (!fork || !UUIDsEqual(fork.ConversationID, this.ConversationID)) {
|
|
84
|
+
return `Fork ${branchId} does not belong to conversation ${this.ConversationID}.`;
|
|
85
|
+
}
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
LogError(`MJConversationDetailEntityServer: could not read fork ${branchId}: ${error instanceof Error ? error.message : String(error)}`);
|
|
90
|
+
return 'Unable to check the fork of this message.';
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/** Records a failed create in the result history, so callers see why nothing was written. */
|
|
94
|
+
recordCreateFailure(message) {
|
|
95
|
+
const result = new BaseEntityResult();
|
|
96
|
+
result.Success = false;
|
|
97
|
+
result.Type = 'create';
|
|
98
|
+
result.Message = message;
|
|
99
|
+
result.StartedAt = new Date();
|
|
100
|
+
result.EndedAt = new Date();
|
|
101
|
+
this.RegisterResultHistoryEntry(result);
|
|
102
|
+
}
|
|
46
103
|
/**
|
|
47
104
|
* True when this save is a genuine Message EDIT on an existing record — not one of
|
|
48
105
|
* the framework's own Message rewrites:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MJConversationDetailEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJConversationDetailEntityServer.server.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"MJConversationDetailEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJConversationDetailEntityServer.server.ts"],"names":[],"mappings":";;;;;;A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CAAC,0BAA0B,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;;;;;;;OAWG;IACI,gCAAgC;QACnC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAChB,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,MAAM,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QACpD,IAAI,CAAC,YAAY,IAAI,CAAC,YAAY,CAAC,KAAK,IAAI,YAAY,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC9E,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,KAAK,aAAa,EAAE,CAAC;YAChC,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QAClD,IAAI,WAAW,EAAE,KAAK,EAAE,CAAC;YACrB,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ,CAAA;AA9FY,gCAAgC;IAD5C,aAAa,CAAC,UAAU,EAAE,0BAA0B,CAAC;GACzC,gCAAgC,CA8F5C"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { EntitySaveOptions, ValidationResult } from '@memberjunction/core';
|
|
2
|
+
import { MJDataContextItemEntity } from '@memberjunction/core-entities';
|
|
3
|
+
/**
|
|
4
|
+
* Server-side `MJ: Data Context Items` entity. The SQL of a `sql` item runs when its data context is
|
|
5
|
+
* loaded, so only an administrator (Owner-type user) may save an item that is a SQL item or holds SQL
|
|
6
|
+
* text: creating it, changing any of its fields, or moving it to another data context. Other items
|
|
7
|
+
* stay writable as before.
|
|
8
|
+
*
|
|
9
|
+
* The rule reads the item's values, not which fields changed, because this entity does not track
|
|
10
|
+
* record changes and a client's `OldValues___` can decide what looks changed. A non-Owner's save of an
|
|
11
|
+
* existing item whose `Type` or `SQL` was not loaded is refused as well: those columns keep their
|
|
12
|
+
* stored values on save, and the stored item may be a SQL item.
|
|
13
|
+
*/
|
|
14
|
+
export declare class MJDataContextItemEntityServer extends MJDataContextItemEntity {
|
|
15
|
+
private static readonly SQL_WRITE_REFUSED;
|
|
16
|
+
private static readonly SQL_NOT_LOADED_REFUSED;
|
|
17
|
+
/** The columns that decide whether an item holds SQL. */
|
|
18
|
+
private static readonly SQL_COLUMNS;
|
|
19
|
+
Validate(): ValidationResult;
|
|
20
|
+
/** Applies the same rule to a `ReplayOnly` save, which skips `Validate()`. */
|
|
21
|
+
Save(options?: EntitySaveOptions): Promise<boolean>;
|
|
22
|
+
/** Returns why the acting user may not save this item, or null when they may. */
|
|
23
|
+
private saveRefusal;
|
|
24
|
+
/** True when this is an existing item whose `Type` or `SQL` was not loaded. */
|
|
25
|
+
private sqlColumnsNotLoaded;
|
|
26
|
+
/** True when the item, as loaded and changed, is a SQL item or holds SQL text. */
|
|
27
|
+
private holdsSQL;
|
|
28
|
+
/** True when the acting user is an Owner-type user. */
|
|
29
|
+
private callerIsOwner;
|
|
30
|
+
/** Records the refusal so `LatestResult.CompleteMessage` carries it, and returns false. */
|
|
31
|
+
private refuseSave;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=MJDataContextItemEntityServer.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MJDataContextItemEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJDataContextItemEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,iBAAiB,EAAsD,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7J,OAAO,EAAE,uBAAuB,EAA+B,MAAM,+BAA+B,CAAC;AAErG;;;;;;;;;;GAUG;AACH,qBACa,6BAA8B,SAAQ,uBAAuB;IACtE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAC8F;IAEvI,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,sBAAsB,CACuG;IAErJ,yDAAyD;IACzD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAqE;IAExF,QAAQ,IAAI,gBAAgB;IAU5C,8EAA8E;IACxD,IAAI,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IAQzE,iFAAiF;IACjF,OAAO,CAAC,WAAW;IAUnB,+EAA+E;IAC/E,OAAO,CAAC,mBAAmB;IAI3B,kFAAkF;IAClF,OAAO,CAAC,QAAQ;IAIhB,uDAAuD;IACvD,OAAO,CAAC,aAAa;IAKrB,2FAA2F;IAC3F,OAAO,CAAC,UAAU;CAUrB"}
|
|
@@ -0,0 +1,84 @@
|
|
|
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 MJDataContextItemEntityServer_1;
|
|
8
|
+
import { BaseEntity, BaseEntityResult, ValidationErrorInfo, ValidationErrorType } from '@memberjunction/core';
|
|
9
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
10
|
+
import { MJDataContextItemEntity } from '@memberjunction/core-entities';
|
|
11
|
+
/**
|
|
12
|
+
* Server-side `MJ: Data Context Items` entity. The SQL of a `sql` item runs when its data context is
|
|
13
|
+
* loaded, so only an administrator (Owner-type user) may save an item that is a SQL item or holds SQL
|
|
14
|
+
* text: creating it, changing any of its fields, or moving it to another data context. Other items
|
|
15
|
+
* stay writable as before.
|
|
16
|
+
*
|
|
17
|
+
* The rule reads the item's values, not which fields changed, because this entity does not track
|
|
18
|
+
* record changes and a client's `OldValues___` can decide what looks changed. A non-Owner's save of an
|
|
19
|
+
* existing item whose `Type` or `SQL` was not loaded is refused as well: those columns keep their
|
|
20
|
+
* stored values on save, and the stored item may be a SQL item.
|
|
21
|
+
*/
|
|
22
|
+
let MJDataContextItemEntityServer = class MJDataContextItemEntityServer extends MJDataContextItemEntity {
|
|
23
|
+
static { MJDataContextItemEntityServer_1 = this; }
|
|
24
|
+
static { this.SQL_WRITE_REFUSED = 'Only an administrator (Owner-type user) may save a data context item that holds SQL, because that SQL runs against the database.'; }
|
|
25
|
+
static { this.SQL_NOT_LOADED_REFUSED = 'Only an administrator (Owner-type user) may save a data context item whose Type and SQL were not loaded, because the stored item may hold SQL.'; }
|
|
26
|
+
/** The columns that decide whether an item holds SQL. */
|
|
27
|
+
static { this.SQL_COLUMNS = ['Type', 'SQL']; }
|
|
28
|
+
Validate() {
|
|
29
|
+
const result = super.Validate();
|
|
30
|
+
const refusal = this.saveRefusal();
|
|
31
|
+
if (refusal) {
|
|
32
|
+
result.Errors.push(new ValidationErrorInfo('SQL', refusal, this.SQL, ValidationErrorType.Failure));
|
|
33
|
+
}
|
|
34
|
+
result.Success = result.Success && result.Errors.length === 0;
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
/** Applies the same rule to a `ReplayOnly` save, which skips `Validate()`. */
|
|
38
|
+
async Save(options) {
|
|
39
|
+
const refusal = options?.ReplayOnly ? this.saveRefusal() : null;
|
|
40
|
+
if (refusal) {
|
|
41
|
+
return this.refuseSave(refusal);
|
|
42
|
+
}
|
|
43
|
+
return super.Save(options);
|
|
44
|
+
}
|
|
45
|
+
/** Returns why the acting user may not save this item, or null when they may. */
|
|
46
|
+
saveRefusal() {
|
|
47
|
+
if (this.callerIsOwner()) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
if (this.sqlColumnsNotLoaded()) {
|
|
51
|
+
return MJDataContextItemEntityServer_1.SQL_NOT_LOADED_REFUSED;
|
|
52
|
+
}
|
|
53
|
+
return this.holdsSQL() ? MJDataContextItemEntityServer_1.SQL_WRITE_REFUSED : null;
|
|
54
|
+
}
|
|
55
|
+
/** True when this is an existing item whose `Type` or `SQL` was not loaded. */
|
|
56
|
+
sqlColumnsNotLoaded() {
|
|
57
|
+
return this.IsSaved && MJDataContextItemEntityServer_1.SQL_COLUMNS.some((name) => this.GetFieldByName(name)?.NotLoaded === true);
|
|
58
|
+
}
|
|
59
|
+
/** True when the item, as loaded and changed, is a SQL item or holds SQL text. */
|
|
60
|
+
holdsSQL() {
|
|
61
|
+
return this.Type === 'sql' || !!this.SQL?.trim();
|
|
62
|
+
}
|
|
63
|
+
/** True when the acting user is an Owner-type user. */
|
|
64
|
+
callerIsOwner() {
|
|
65
|
+
const caller = this.ActiveUser;
|
|
66
|
+
return caller?.Type?.trim().toLowerCase() === 'owner';
|
|
67
|
+
}
|
|
68
|
+
/** Records the refusal so `LatestResult.CompleteMessage` carries it, and returns false. */
|
|
69
|
+
refuseSave(message) {
|
|
70
|
+
const result = new BaseEntityResult();
|
|
71
|
+
result.Success = false;
|
|
72
|
+
result.Type = this.IsSaved ? 'update' : 'create';
|
|
73
|
+
result.Message = message;
|
|
74
|
+
result.StartedAt = new Date();
|
|
75
|
+
result.EndedAt = new Date();
|
|
76
|
+
this.RegisterResultHistoryEntry(result);
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
MJDataContextItemEntityServer = MJDataContextItemEntityServer_1 = __decorate([
|
|
81
|
+
RegisterClass(BaseEntity, 'MJ: Data Context Items')
|
|
82
|
+
], MJDataContextItemEntityServer);
|
|
83
|
+
export { MJDataContextItemEntityServer };
|
|
84
|
+
//# sourceMappingURL=MJDataContextItemEntityServer.server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MJDataContextItemEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJDataContextItemEntityServer.server.ts"],"names":[],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,GAAG,IAAI,IAAI,EAAE,CAAC;QAC5B,IAAI,CAAC,0BAA0B,CAAC,MAAM,CAAC,CAAC;QACxC,OAAO,KAAK,CAAC;IACjB,CAAC;;AAlEQ,6BAA6B;IADzC,aAAa,CAAC,UAAU,EAAE,wBAAwB,CAAC;GACvC,6BAA6B,CAmEzC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { EntitySaveOptions, ValidationResult } from '@memberjunction/core';
|
|
2
|
+
import { MJFileEntity } from '@memberjunction/core-entities';
|
|
3
|
+
/**
|
|
4
|
+
* Server-side `MJ: Files` entity: once a row exists, WHERE its bytes live is server-owned.
|
|
5
|
+
*
|
|
6
|
+
* `ProviderID` and `ProviderKey` decide which storage provider (and so which account) and which object every
|
|
7
|
+
* file-ID route — `DownloadUrl`, `GetFileContents`, `CreateMediaAccessToken`, `DeleteFile`, the artifact download URL,
|
|
8
|
+
* the agent file handler — reads, signs or deletes. A client that could re-point an existing row could make a row other
|
|
9
|
+
* users trust (an attachment, an artifact's file) serve, or delete, a different object. So a save that changes either
|
|
10
|
+
* field on an existing row is refused, unless trusted server code that chose the new location itself sets
|
|
11
|
+
* {@link AllowStorageLocationChange} first — the same opt-in pattern `MJRubricEvaluationScoreEntityServer` uses for
|
|
12
|
+
* server-computed rows. A GraphQL save never sets it.
|
|
13
|
+
*
|
|
14
|
+
* **What this does not cover — a new row.** A client may still create a row with a `ProviderKey` of its choosing, and
|
|
15
|
+
* `Name` (the object key when `ProviderKey` is empty) is client-writable on every row. Refusing a client-supplied
|
|
16
|
+
* `ProviderKey` on create would break Explorer's direct-upload path, which registers the object it just uploaded through
|
|
17
|
+
* a client save, and would not stop aliasing anyway (`Name` is the fallback key). MJStorage's `UploadFile` sets the field
|
|
18
|
+
* from a package that cannot reach this class. The guarantee for a new row comes from the routes instead: each one
|
|
19
|
+
* resolves the row through the storage gate (`FileStorageEngine.ResolveFileObject`), which requires the caller's access
|
|
20
|
+
* to the account and refuses an object any other `MJ: Files` row tracks when the caller cannot read that row. Closing the
|
|
21
|
+
* create path needs a server-side registration mutation for the direct-upload flow — a follow-up.
|
|
22
|
+
*/
|
|
23
|
+
export declare class MJFileEntityServer extends MJFileEntity {
|
|
24
|
+
/**
|
|
25
|
+
* Set by trusted server code, before `Save()`, when it re-points an existing row to a storage location it chose
|
|
26
|
+
* itself. A client save leaves this false, so a change to `ProviderID` or `ProviderKey` on an existing row is refused.
|
|
27
|
+
*/
|
|
28
|
+
AllowStorageLocationChange: boolean;
|
|
29
|
+
/** Adds the storage-location rule to the generated validation. */
|
|
30
|
+
Validate(): ValidationResult;
|
|
31
|
+
/**
|
|
32
|
+
* Applies the rule to a `ReplayOnly` save too: `ReplayOnly` skips `Validate()` but still writes, so without this the
|
|
33
|
+
* rule would be one save option away from off.
|
|
34
|
+
*/
|
|
35
|
+
Save(options?: EntitySaveOptions): Promise<boolean>;
|
|
36
|
+
/** The location fields this save would change on an existing row without the trusted opt-in. */
|
|
37
|
+
private refusedLocationChanges;
|
|
38
|
+
/** Whether `field` holds a different value from the one loaded (`ProviderID` compared as a UUID). */
|
|
39
|
+
private locationFieldChanged;
|
|
40
|
+
/** Records a refused save on the result history (so `LatestResult.CompleteMessage` carries why) and returns false. */
|
|
41
|
+
private refuse;
|
|
42
|
+
/** The refusal for a client change to a storage-location field. */
|
|
43
|
+
private static locationChangeMessage;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=MJFileEntityServer.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MJFileEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJFileEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,iBAAiB,EAGjB,gBAAgB,EACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAK7D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBACa,kBAAmB,SAAQ,YAAY;IAChD;;;OAGG;IACI,0BAA0B,UAAS;IAE1C,kEAAkE;IAClD,QAAQ,IAAI,gBAAgB;IAc5C;;;OAGG;IACmB,IAAI,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IAQzE,gGAAgG;IAChG,OAAO,CAAC,sBAAsB;IAQ9B,qGAAqG;IACrG,OAAO,CAAC,oBAAoB;IAa5B,sHAAsH;IACtH,OAAO,CAAC,MAAM;IAWd,mEAAmE;IACnE,OAAO,CAAC,MAAM,CAAC,qBAAqB;CAGvC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
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 MJFileEntityServer_1;
|
|
8
|
+
import { BaseEntity, BaseEntityResult, ValidationErrorInfo, ValidationErrorType, } from '@memberjunction/core';
|
|
9
|
+
import { RegisterClass, UUIDsEqual } from '@memberjunction/global';
|
|
10
|
+
import { MJFileEntity } from '@memberjunction/core-entities';
|
|
11
|
+
/**
|
|
12
|
+
* Server-side `MJ: Files` entity: once a row exists, WHERE its bytes live is server-owned.
|
|
13
|
+
*
|
|
14
|
+
* `ProviderID` and `ProviderKey` decide which storage provider (and so which account) and which object every
|
|
15
|
+
* file-ID route — `DownloadUrl`, `GetFileContents`, `CreateMediaAccessToken`, `DeleteFile`, the artifact download URL,
|
|
16
|
+
* the agent file handler — reads, signs or deletes. A client that could re-point an existing row could make a row other
|
|
17
|
+
* users trust (an attachment, an artifact's file) serve, or delete, a different object. So a save that changes either
|
|
18
|
+
* field on an existing row is refused, unless trusted server code that chose the new location itself sets
|
|
19
|
+
* {@link AllowStorageLocationChange} first — the same opt-in pattern `MJRubricEvaluationScoreEntityServer` uses for
|
|
20
|
+
* server-computed rows. A GraphQL save never sets it.
|
|
21
|
+
*
|
|
22
|
+
* **What this does not cover — a new row.** A client may still create a row with a `ProviderKey` of its choosing, and
|
|
23
|
+
* `Name` (the object key when `ProviderKey` is empty) is client-writable on every row. Refusing a client-supplied
|
|
24
|
+
* `ProviderKey` on create would break Explorer's direct-upload path, which registers the object it just uploaded through
|
|
25
|
+
* a client save, and would not stop aliasing anyway (`Name` is the fallback key). MJStorage's `UploadFile` sets the field
|
|
26
|
+
* from a package that cannot reach this class. The guarantee for a new row comes from the routes instead: each one
|
|
27
|
+
* resolves the row through the storage gate (`FileStorageEngine.ResolveFileObject`), which requires the caller's access
|
|
28
|
+
* to the account and refuses an object any other `MJ: Files` row tracks when the caller cannot read that row. Closing the
|
|
29
|
+
* create path needs a server-side registration mutation for the direct-upload flow — a follow-up.
|
|
30
|
+
*/
|
|
31
|
+
let MJFileEntityServer = MJFileEntityServer_1 = class MJFileEntityServer extends MJFileEntity {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
/**
|
|
35
|
+
* Set by trusted server code, before `Save()`, when it re-points an existing row to a storage location it chose
|
|
36
|
+
* itself. A client save leaves this false, so a change to `ProviderID` or `ProviderKey` on an existing row is refused.
|
|
37
|
+
*/
|
|
38
|
+
this.AllowStorageLocationChange = false;
|
|
39
|
+
}
|
|
40
|
+
/** Adds the storage-location rule to the generated validation. */
|
|
41
|
+
Validate() {
|
|
42
|
+
const result = super.Validate();
|
|
43
|
+
for (const field of this.refusedLocationChanges()) {
|
|
44
|
+
result.Errors.push(new ValidationErrorInfo(field, MJFileEntityServer_1.locationChangeMessage(field), this.GetFieldByName(field)?.Value, ValidationErrorType.Failure));
|
|
45
|
+
}
|
|
46
|
+
result.Success = result.Success && result.Errors.length === 0;
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Applies the rule to a `ReplayOnly` save too: `ReplayOnly` skips `Validate()` but still writes, so without this the
|
|
51
|
+
* rule would be one save option away from off.
|
|
52
|
+
*/
|
|
53
|
+
async Save(options) {
|
|
54
|
+
const refused = options?.ReplayOnly ? this.refusedLocationChanges() : [];
|
|
55
|
+
if (refused.length > 0) {
|
|
56
|
+
return this.refuse(MJFileEntityServer_1.locationChangeMessage(refused[0]));
|
|
57
|
+
}
|
|
58
|
+
return super.Save(options);
|
|
59
|
+
}
|
|
60
|
+
/** The location fields this save would change on an existing row without the trusted opt-in. */
|
|
61
|
+
refusedLocationChanges() {
|
|
62
|
+
if (!this.IsSaved || this.AllowStorageLocationChange) {
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
const fields = ['ProviderID', 'ProviderKey'];
|
|
66
|
+
return fields.filter(field => this.locationFieldChanged(field));
|
|
67
|
+
}
|
|
68
|
+
/** Whether `field` holds a different value from the one loaded (`ProviderID` compared as a UUID). */
|
|
69
|
+
locationFieldChanged(field) {
|
|
70
|
+
const info = this.GetFieldByName(field);
|
|
71
|
+
if (!info?.Dirty) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
const before = info.OldValue;
|
|
75
|
+
const after = info.Value;
|
|
76
|
+
if (field === 'ProviderID') {
|
|
77
|
+
return !(before && after ? UUIDsEqual(before, after) : before === after);
|
|
78
|
+
}
|
|
79
|
+
return (before ?? null) !== (after ?? null);
|
|
80
|
+
}
|
|
81
|
+
/** Records a refused save on the result history (so `LatestResult.CompleteMessage` carries why) and returns false. */
|
|
82
|
+
refuse(message) {
|
|
83
|
+
const result = new BaseEntityResult();
|
|
84
|
+
result.Success = false;
|
|
85
|
+
result.Type = 'update';
|
|
86
|
+
result.Message = message;
|
|
87
|
+
result.StartedAt = new Date();
|
|
88
|
+
result.EndedAt = new Date();
|
|
89
|
+
this.RegisterResultHistoryEntry(result);
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
/** The refusal for a client change to a storage-location field. */
|
|
93
|
+
static locationChangeMessage(field) {
|
|
94
|
+
return `${field} cannot be changed on an existing file: where a file's bytes live is set by the server when the file is stored.`;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
MJFileEntityServer = MJFileEntityServer_1 = __decorate([
|
|
98
|
+
RegisterClass(BaseEntity, 'MJ: Files')
|
|
99
|
+
], MJFileEntityServer);
|
|
100
|
+
export { MJFileEntityServer };
|
|
101
|
+
//# sourceMappingURL=MJFileEntityServer.server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MJFileEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJFileEntityServer.server.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EACH,UAAU,EACV,gBAAgB,EAEhB,mBAAmB,EACnB,mBAAmB,GAEtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAK7D;;;;;;;;;;;;;;;;;;;GAmBG;AAEI,IAAM,kBAAkB,0BAAxB,MAAM,kBAAmB,SAAQ,YAAY;IAA7C;;QACH;;;WAGG;QACI,+BAA0B,GAAG,KAAK,CAAC;IAoE9C,CAAC;IAlEG,kEAAkE;IAClD,QAAQ;QACpB,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;QAChC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,sBAAsB,EAAE,EAAE,CAAC;YAChD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,mBAAmB,CACtC,KAAK,EACL,oBAAkB,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAC/C,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,KAAK,EACjC,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AAY,EAAE,CAAC;YACzB,OAAO,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,KAAK,CAAC,CAAC;QAC7E,CAAC;QACD,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,sHAAsH;IAC9G,MAAM,CAAC,OAAe;QAC1B,MAAM,MAAM,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACtC,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC;QACvB,MAAM,CAAC,IAAI,GAAG,QAAQ,CAAC;QACvB,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;QACzB,MAAM,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;QAC9B,MAAM,CAAC,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC;QAC5B,IAAI,CAAC,0BAA0B,CAAC,MAAM,CAAC,CAAC;QACxC,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,mEAAmE;IAC3D,MAAM,CAAC,qBAAqB,CAAC,KAA2B;QAC5D,OAAO,GAAG,KAAK,iHAAiH,CAAC;IACrI,CAAC;CACJ,CAAA;AAzEY,kBAAkB;IAD9B,aAAa,CAAC,UAAU,EAAE,WAAW,CAAC;GAC1B,kBAAkB,CAyE9B"}
|
|
@@ -67,11 +67,15 @@ export declare class MJQueryEntityServer extends MJQueryEntityExtended {
|
|
|
67
67
|
* when a dialect variant matching the current platform is saved — this handles
|
|
68
68
|
* the timing issue where the parent Query is saved before its QuerySQL children
|
|
69
69
|
* exist in the cache.
|
|
70
|
+
*
|
|
71
|
+
* @param skipAIEnrichment Skip the LLM enrichment stage, as `SkipEntityAIActions` does for Save.
|
|
70
72
|
*/
|
|
71
|
-
RerunExtraction(): Promise<void>;
|
|
73
|
+
RerunExtraction(skipAIEnrichment?: boolean): Promise<void>;
|
|
72
74
|
/**
|
|
73
75
|
* Runs the extraction pipeline and saves the UsesTemplate flag.
|
|
74
76
|
* On error, sets UsesTemplate=false and attempts to save so the query remains usable.
|
|
77
|
+
*
|
|
78
|
+
* @param skipAIEnrichment Skip the LLM enrichment stage (the save asked to skip AI actions).
|
|
75
79
|
*/
|
|
76
80
|
private extractAndSyncDataAsync;
|
|
77
81
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MJQueryEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJQueryEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,iBAAiB,EAGjB,qBAAqB,EAExB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAoB,qBAAqB,EAAmC,MAAM,+BAA+B,CAAC;AAazH;;;;GAIG;AACH,qBACa,mBAAoB,SAAQ,qBAAqB;IAC1D;;;yEAGqE;IAC9D,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAI5C;;OAEG;cACsB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAI5F;;;;;;;;;OASG;cACa,0BAA0B,IAAI,OAAO,CAAC,IAAI,CAAC;IA2B3D,gFAAgF;IAChF,OAAO,CAAC,cAAc;IAQP,IAAI,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IAyCnD,MAAM,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IAgBpE;;;OAGG;IACH,OAAO,KAAK,eAAe,GAE1B;IAED;;;;;;;;;;OAUG;IACH,OAAO,CAAC,oBAAoB;IAmB5B;;;;;;;;OAQG;IACH,OAAO,CAAC,4BAA4B;IAgBpC;;;OAGG;IACH,OAAO,CAAC,gBAAgB;
|
|
1
|
+
{"version":3,"file":"MJQueryEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJQueryEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,iBAAiB,EAGjB,qBAAqB,EAExB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAoB,qBAAqB,EAAmC,MAAM,+BAA+B,CAAC;AAazH;;;;GAIG;AACH,qBACa,mBAAoB,SAAQ,qBAAqB;IAC1D;;;yEAGqE;IAC9D,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAI5C;;OAEG;cACsB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAI5F;;;;;;;;;OASG;cACa,0BAA0B,IAAI,OAAO,CAAC,IAAI,CAAC;IA2B3D,gFAAgF;IAChF,OAAO,CAAC,cAAc;IAQP,IAAI,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IAyCnD,MAAM,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IAgBpE;;;OAGG;IACH,OAAO,KAAK,eAAe,GAE1B;IAED;;;;;;;;;;OAUG;IACH,OAAO,CAAC,oBAAoB;IAmB5B;;;;;;;;OAQG;IACH,OAAO,CAAC,4BAA4B;IAgBpC;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAexB;;;;;;;OAOG;IACU,eAAe,CAAC,gBAAgB,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrE;;;;;OAKG;YACW,uBAAuB;IAsBrC;;OAEG;YACW,sBAAsB;IAmBpC;;;OAGG;YACW,wBAAwB;IAiCtC;;OAEG;YACW,sBAAsB;IA4BpC;;OAEG;YACW,oBAAoB;IA4BlC;;OAEG;YACW,6BAA6B;CAgB9C"}
|
|
@@ -91,7 +91,7 @@ let MJQueryEntityServer = class MJQueryEntityServer extends MJQueryEntityExtende
|
|
|
91
91
|
}
|
|
92
92
|
// Extract and sync parameters AFTER saving, outside of any transaction
|
|
93
93
|
if (shouldExtractData && this.SQL && this.SQL.trim().length > 0) {
|
|
94
|
-
await this.extractAndSyncDataAsync();
|
|
94
|
+
await this.extractAndSyncDataAsync(options?.SkipEntityAIActions === true);
|
|
95
95
|
await this.autoConvertDialectsAsync();
|
|
96
96
|
}
|
|
97
97
|
else if (!this.SQL || this.SQL.trim().length === 0) {
|
|
@@ -179,7 +179,7 @@ let MJQueryEntityServer = class MJQueryEntityServer extends MJQueryEntityExtende
|
|
|
179
179
|
* Builds the QuerySyncContext from this entity instance for use by the extraction pipeline.
|
|
180
180
|
* Resolves the SQL to the appropriate dialect variant for the connected database.
|
|
181
181
|
*/
|
|
182
|
-
buildSyncContext() {
|
|
182
|
+
buildSyncContext(skipAIEnrichment = false) {
|
|
183
183
|
return {
|
|
184
184
|
queryID: this.ID,
|
|
185
185
|
queryName: this.Name,
|
|
@@ -190,6 +190,7 @@ let MJQueryEntityServer = class MJQueryEntityServer extends MJQueryEntityExtende
|
|
|
190
190
|
runViewProvider: this.RunViewProviderToUse,
|
|
191
191
|
platform: this.currentPlatform,
|
|
192
192
|
parameterHints: this.ParameterHints,
|
|
193
|
+
SkipAIEnrichment: skipAIEnrichment,
|
|
193
194
|
};
|
|
194
195
|
}
|
|
195
196
|
/**
|
|
@@ -197,17 +198,21 @@ let MJQueryEntityServer = class MJQueryEntityServer extends MJQueryEntityExtende
|
|
|
197
198
|
* when a dialect variant matching the current platform is saved — this handles
|
|
198
199
|
* the timing issue where the parent Query is saved before its QuerySQL children
|
|
199
200
|
* exist in the cache.
|
|
201
|
+
*
|
|
202
|
+
* @param skipAIEnrichment Skip the LLM enrichment stage, as `SkipEntityAIActions` does for Save.
|
|
200
203
|
*/
|
|
201
|
-
async RerunExtraction() {
|
|
202
|
-
await this.extractAndSyncDataAsync();
|
|
204
|
+
async RerunExtraction(skipAIEnrichment = false) {
|
|
205
|
+
await this.extractAndSyncDataAsync(skipAIEnrichment);
|
|
203
206
|
}
|
|
204
207
|
/**
|
|
205
208
|
* Runs the extraction pipeline and saves the UsesTemplate flag.
|
|
206
209
|
* On error, sets UsesTemplate=false and attempts to save so the query remains usable.
|
|
210
|
+
*
|
|
211
|
+
* @param skipAIEnrichment Skip the LLM enrichment stage (the save asked to skip AI actions).
|
|
207
212
|
*/
|
|
208
|
-
async extractAndSyncDataAsync() {
|
|
213
|
+
async extractAndSyncDataAsync(skipAIEnrichment) {
|
|
209
214
|
try {
|
|
210
|
-
const ctx = this.buildSyncContext();
|
|
215
|
+
const ctx = this.buildSyncContext(skipAIEnrichment);
|
|
211
216
|
const pipelineResult = await RunExtractionPipeline(ctx);
|
|
212
217
|
this.UsesTemplate = pipelineResult.UsesTemplate;
|
|
213
218
|
// Save the query again to persist UsesTemplate and any changes from AI processing
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MJQueryEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJQueryEntityServer.server.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACH,UAAU,EAGV,QAAQ,GAGX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAoB,qBAAqB,EAAsB,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACzH,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpG,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACH,qBAAqB,EACrB,gBAAgB,EAChB,uBAAuB,GAC1B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AAErF;;;;GAIG;AAEI,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,qBAAqB;IAO1D,gFAAgF;IAEhF;;OAEG;IACgB,KAAK,CAAC,cAAc,CAAC,WAAmB;QACvD,O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AM,EAAE,CAAC,CAAC;YACpD,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC5B,MAAM,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YACtC,CAAC;QACL,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,OAAO,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,wCAAwC,EAAE,CAAC,CAAC,CAAC;QACjF,CAAC;IACL,CAAC;CACJ,CAAA;AA7XY,mBAAmB;IAD/B,aAAa,CAAC,UAAU,EAAE,aAAa,CAAC;GAC5B,mBAAmB,CA6X/B"}
|
|
@@ -30,7 +30,7 @@ let MJQuerySQLEntityServer = class MJQuerySQLEntityServer extends MJQuerySQLEnti
|
|
|
30
30
|
// current environment's database platform. A SQL Server environment
|
|
31
31
|
// receiving a PostgreSQL variant (or vice versa) should not re-extract.
|
|
32
32
|
try {
|
|
33
|
-
await this.triggerParentExtractionIfDialectMatches();
|
|
33
|
+
await this.triggerParentExtractionIfDialectMatches(options?.SkipEntityAIActions === true);
|
|
34
34
|
}
|
|
35
35
|
catch (e) {
|
|
36
36
|
// Non-fatal — the QuerySQL record saved successfully, extraction
|
|
@@ -49,7 +49,7 @@ let MJQuerySQLEntityServer = class MJQuerySQLEntityServer extends MJQuerySQLEnti
|
|
|
49
49
|
await QueryEngine.Instance.Config(false, this.ContextCurrentUser);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
async triggerParentExtractionIfDialectMatches() {
|
|
52
|
+
async triggerParentExtractionIfDialectMatches(skipAIEnrichment) {
|
|
53
53
|
const currentPlatform = resolveDbPlatformFromEnv() ?? 'sqlserver';
|
|
54
54
|
await this.ensureQueryEngineLoaded();
|
|
55
55
|
if (!this.isDialectForPlatform(currentPlatform)) {
|
|
@@ -65,7 +65,7 @@ let MJQuerySQLEntityServer = class MJQuerySQLEntityServer extends MJQuerySQLEnti
|
|
|
65
65
|
// will find the dialect variant via GetPlatformSQL().
|
|
66
66
|
if (parentQuery.SQL && parentQuery.SQL.trim().length > 0) {
|
|
67
67
|
LogStatus(`[MJQuerySQLEntityServer] Triggering re-extraction on "${parentQuery.Name}" — dialect variant saved for ${currentPlatform}`);
|
|
68
|
-
await parentQuery.RerunExtraction();
|
|
68
|
+
await parentQuery.RerunExtraction(skipAIEnrichment);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MJQuerySQLEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJQuerySQLEntityServer.server.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACH,UAAU,EAGV,QAAQ,EACR,SAAS,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AAGrF;;;;;;;;;;;GAWG;AAEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,gBAAgB;IAC/C,KAAK,CAAC,IAAI,CAAC,OAA2B;QAC3C,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7C,IAAI,CAAC,UAAU,EAAE,CAAC;YACd,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,iEAAiE;QACjE,oEAAoE;QACpE,wEAAwE;QACxE,IAAI,CAAC;YACD,MAAM,IAAI,CAAC,uCAAuC,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"MJQuerySQLEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJQuerySQLEntityServer.server.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACH,UAAU,EAGV,QAAQ,EACR,SAAS,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,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7
7
|
* against the rule's entity when the RULE is saved; without an equivalent
|
|
8
8
|
* check when the FILTER is saved, both are trivially bypassable: attach a
|
|
9
9
|
* valid filter, then edit its text (or acquire a new, different-entity
|
|
10
|
-
* referrer) to reference anything. On a `FilterText` change
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* (fail closed). Check 6 has no single rule to anchor on here (a filter
|
|
16
|
-
* record itself carries no entity binding — see plan §5.1), so it anchors on
|
|
17
|
-
* the first referrer that DOES resolve to an entity and requires every other
|
|
18
|
-
* referrer to agree with it; zero or one resolvable referrer trivially
|
|
19
|
-
* satisfies the invariant.
|
|
10
|
+
* referrer) to reference anything. On a `FilterText` change this subclass
|
|
11
|
+
* re-validates the new text against EVERY current referrer (EntityPermission
|
|
12
|
+
* rows via their four `*RLSFilterID` columns, plus both API scope tables via
|
|
13
|
+
* `RowFilterID`) and rejects if any check fails — including referrers whose
|
|
14
|
+
* entity cannot be resolved (fail closed).
|
|
20
15
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
16
|
+
* Which checks apply depends on who references the filter:
|
|
17
|
+
* - **Any API-key or API-application scope rule** → the strict API-key rules
|
|
18
|
+
* (checks 4 and 6): plain columns of the referrer's entity only, and every
|
|
19
|
+
* referrer must agree on ONE entity. Check 6 has no single rule to anchor on
|
|
20
|
+
* here (a filter record carries no entity binding — see plan §5.1), so it
|
|
21
|
+
* anchors on the first referrer that resolves to an entity.
|
|
22
|
+
* - **Only role permission rows** → a role filter. Role filters legitimately use
|
|
23
|
+
* subqueries (a user's tenant memberships) and are shared across every
|
|
24
|
+
* tenant-scoped entity, so the new text is instead screened for dangerous SQL
|
|
25
|
+
* and compiled against each referencing entity's base view.
|
|
26
|
+
*
|
|
27
|
+
* Either way an invalid filter is rejected at save, where it is diagnosable,
|
|
28
|
+
* rather than failing every read of the entities it scopes with an unexplained
|
|
29
|
+
* SQL error.
|
|
25
30
|
*/
|
|
26
31
|
export declare class MJRowLevelSecurityFilterEntityServer extends MJRowLevelSecurityFilterEntity {
|
|
27
32
|
/** Enable async validation so the referrer re-validation (which queries three tables) runs on Save. */
|
|
28
33
|
get DefaultSkipAsyncValidation(): boolean;
|
|
29
34
|
ValidateAsync(): Promise<ValidationResult>;
|
|
35
|
+
/**
|
|
36
|
+
* The strict API-key rules: check 4 (FilterText's columns must resolve against every
|
|
37
|
+
* referrer's entity) and check 6 (every referrer must agree on the same entity).
|
|
38
|
+
*/
|
|
39
|
+
private validateAsApiKeyFilter;
|
|
40
|
+
/** A role filter: screened, then compiled against every referencing entity's base view. */
|
|
41
|
+
private validateAsRoleFilter;
|
|
30
42
|
}
|
|
31
43
|
//# sourceMappingURL=MJRowLevelSecurityFilterEntityServer.server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MJRowLevelSecurityFilterEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJRowLevelSecurityFilterEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"MJRowLevelSecurityFilterEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJRowLevelSecurityFilterEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuD,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7G,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAW/E;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBACa,oCAAqC,SAAQ,8BAA8B;IACpF,uGAAuG;IACvG,IAAoB,0BAA0B,IAAI,OAAO,CAExD;IAEqB,aAAa,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAgChE;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IAuB9B,2FAA2F;YAC7E,oBAAoB;CAOrC"}
|