@memberjunction/core-entities-server 6.2.0-edge.1 → 6.2.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 +7 -3
- package/dist/custom/FormComponentGuard.d.ts +48 -0
- package/dist/custom/FormComponentGuard.d.ts.map +1 -0
- package/dist/custom/FormComponentGuard.js +236 -0
- package/dist/custom/FormComponentGuard.js.map +1 -0
- package/dist/custom/FormScopeGuard.d.ts +52 -0
- package/dist/custom/FormScopeGuard.d.ts.map +1 -0
- package/dist/custom/FormScopeGuard.js +111 -0
- package/dist/custom/FormScopeGuard.js.map +1 -0
- package/dist/custom/MJAIAgentExampleEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJAIAgentExampleEntityServer.server.js +3 -2
- package/dist/custom/MJAIAgentExampleEntityServer.server.js.map +1 -1
- package/dist/custom/MJAIAgentNoteEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJAIAgentNoteEntityServer.server.js +3 -2
- package/dist/custom/MJAIAgentNoteEntityServer.server.js.map +1 -1
- package/dist/custom/MJActionEntityServer.server.js +1 -1
- package/dist/custom/MJActionEntityServer.server.js.map +1 -1
- package/dist/custom/MJComponentEntityServer.server.d.ts +30 -2
- package/dist/custom/MJComponentEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJComponentEntityServer.server.js +64 -5
- package/dist/custom/MJComponentEntityServer.server.js.map +1 -1
- package/dist/custom/MJDuplicateRunEntityServer.server.d.ts +2 -1
- package/dist/custom/MJDuplicateRunEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJDuplicateRunEntityServer.server.js +2 -2
- package/dist/custom/MJDuplicateRunEntityServer.server.js.map +1 -1
- package/dist/custom/MJEntityFormContributionEntityServer.server.d.ts +37 -0
- package/dist/custom/MJEntityFormContributionEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJEntityFormContributionEntityServer.server.js +89 -0
- package/dist/custom/MJEntityFormContributionEntityServer.server.js.map +1 -0
- package/dist/custom/MJEntityFormOverrideEntityServer.server.d.ts +37 -0
- package/dist/custom/MJEntityFormOverrideEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJEntityFormOverrideEntityServer.server.js +89 -0
- package/dist/custom/MJEntityFormOverrideEntityServer.server.js.map +1 -0
- package/dist/custom/MJInteractionEventEntityServer.server.d.ts +23 -0
- package/dist/custom/MJInteractionEventEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJInteractionEventEntityServer.server.js +70 -0
- package/dist/custom/MJInteractionEventEntityServer.server.js.map +1 -0
- package/dist/custom/MJQueryEntityServer.server.d.ts +9 -1
- package/dist/custom/MJQueryEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJQueryEntityServer.server.js +28 -8
- package/dist/custom/MJQueryEntityServer.server.js.map +1 -1
- package/dist/custom/MJRecordChangeEntityServer.server.d.ts +11 -0
- package/dist/custom/MJRecordChangeEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJRecordChangeEntityServer.server.js +103 -0
- package/dist/custom/MJRecordChangeEntityServer.server.js.map +1 -0
- package/dist/custom/MJRecordProcessEntityServer.server.d.ts +6 -2
- package/dist/custom/MJRecordProcessEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJRecordProcessEntityServer.server.js +6 -2
- package/dist/custom/MJRecordProcessEntityServer.server.js.map +1 -1
- package/dist/custom/MJRemoteOperationEntityServer.server.js +1 -1
- package/dist/custom/MJRemoteOperationEntityServer.server.js.map +1 -1
- package/dist/custom/MJRubricBandEntityServer.server.d.ts +9 -0
- package/dist/custom/MJRubricBandEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJRubricBandEntityServer.server.js +34 -0
- package/dist/custom/MJRubricBandEntityServer.server.js.map +1 -0
- package/dist/custom/MJRubricCriterionEntityServer.server.d.ts +16 -0
- package/dist/custom/MJRubricCriterionEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJRubricCriterionEntityServer.server.js +43 -0
- package/dist/custom/MJRubricCriterionEntityServer.server.js.map +1 -0
- package/dist/custom/MJRubricCriterionLevelEntityServer.server.d.ts +10 -0
- package/dist/custom/MJRubricCriterionLevelEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJRubricCriterionLevelEntityServer.server.js +43 -0
- package/dist/custom/MJRubricCriterionLevelEntityServer.server.js.map +1 -0
- package/dist/custom/MJRubricEvaluationEntityServer.server.d.ts +43 -0
- package/dist/custom/MJRubricEvaluationEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJRubricEvaluationEntityServer.server.js +243 -0
- package/dist/custom/MJRubricEvaluationEntityServer.server.js.map +1 -0
- package/dist/custom/MJRubricEvaluationScoreEntityServer.server.d.ts +26 -0
- package/dist/custom/MJRubricEvaluationScoreEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJRubricEvaluationScoreEntityServer.server.js +49 -0
- package/dist/custom/MJRubricEvaluationScoreEntityServer.server.js.map +1 -0
- package/dist/custom/MJRubricScaleEntityServer.server.d.ts +24 -0
- package/dist/custom/MJRubricScaleEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJRubricScaleEntityServer.server.js +88 -0
- package/dist/custom/MJRubricScaleEntityServer.server.js.map +1 -0
- package/dist/custom/MJRubricScaleLevelEntityServer.server.d.ts +16 -0
- package/dist/custom/MJRubricScaleLevelEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJRubricScaleLevelEntityServer.server.js +80 -0
- package/dist/custom/MJRubricScaleLevelEntityServer.server.js.map +1 -0
- package/dist/custom/MJRubricVersionEntityServer.server.d.ts +46 -0
- package/dist/custom/MJRubricVersionEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJRubricVersionEntityServer.server.js +131 -0
- package/dist/custom/MJRubricVersionEntityServer.server.js.map +1 -0
- package/dist/custom/MJTagEntityServer.server.d.ts +1 -1
- package/dist/custom/MJTagEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJTagEntityServer.server.js +7 -3
- package/dist/custom/MJTagEntityServer.server.js.map +1 -1
- package/dist/custom/MJVectorIndexEntityServer.server.d.ts +2 -1
- package/dist/custom/MJVectorIndexEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJVectorIndexEntityServer.server.js +6 -4
- package/dist/custom/MJVectorIndexEntityServer.server.js.map +1 -1
- package/dist/custom/query-extraction/pipeline.js +1 -1
- package/dist/custom/query-extraction/pipeline.js.map +1 -1
- package/dist/custom/query-extraction/resolve.d.ts +5 -2
- package/dist/custom/query-extraction/resolve.d.ts.map +1 -1
- package/dist/custom/query-extraction/resolve.js +6 -3
- package/dist/custom/query-extraction/resolve.js.map +1 -1
- package/dist/custom/query-extraction/sync.d.ts.map +1 -1
- package/dist/custom/query-extraction/sync.js +4 -2
- package/dist/custom/query-extraction/sync.js.map +1 -1
- package/dist/custom/rubrics/evaluationSubmit.d.ts +95 -0
- package/dist/custom/rubrics/evaluationSubmit.d.ts.map +1 -0
- package/dist/custom/rubrics/evaluationSubmit.js +142 -0
- package/dist/custom/rubrics/evaluationSubmit.js.map +1 -0
- package/dist/custom/rubrics/scaleFreeze.d.ts +21 -0
- package/dist/custom/rubrics/scaleFreeze.d.ts.map +1 -0
- package/dist/custom/rubrics/scaleFreeze.js +30 -0
- package/dist/custom/rubrics/scaleFreeze.js.map +1 -0
- package/dist/custom/rubrics/statusRules.d.ts +13 -0
- package/dist/custom/rubrics/statusRules.d.ts.map +1 -0
- package/dist/custom/rubrics/statusRules.js +57 -0
- package/dist/custom/rubrics/statusRules.js.map +1 -0
- package/dist/custom/rubrics/versionPublish.d.ts +67 -0
- package/dist/custom/rubrics/versionPublish.d.ts.map +1 -0
- package/dist/custom/rubrics/versionPublish.js +222 -0
- package/dist/custom/rubrics/versionPublish.js.map +1 -0
- package/dist/engines/IdentityClaimEngineServer.d.ts +9 -0
- package/dist/engines/IdentityClaimEngineServer.d.ts.map +1 -1
- package/dist/engines/IdentityClaimEngineServer.js +38 -8
- package/dist/engines/IdentityClaimEngineServer.js.map +1 -1
- package/dist/engines/QueryEngineServer.d.ts.map +1 -1
- package/dist/engines/QueryEngineServer.js +15 -16
- package/dist/engines/QueryEngineServer.js.map +1 -1
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -1
- package/package.json +30 -28
|
@@ -0,0 +1,70 @@
|
|
|
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 MJInteractionEventEntityServer_1;
|
|
8
|
+
import { BaseEntity, BaseEntityResult, EntityPermissionType, ValidationErrorInfo, ValidationErrorType, } from '@memberjunction/core';
|
|
9
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
10
|
+
import { MJInteractionEventEntity } from '@memberjunction/core-entities';
|
|
11
|
+
/**
|
|
12
|
+
* Server subclass for `MJ: Interaction Events`.
|
|
13
|
+
*
|
|
14
|
+
* Implements the append-only lifecycle log invariant:
|
|
15
|
+
* Interaction events are strictly append-only. Once an event is inserted,
|
|
16
|
+
* any update or deletion attempt is prohibited to ensure audit trail integrity.
|
|
17
|
+
*/
|
|
18
|
+
let MJInteractionEventEntityServer = class MJInteractionEventEntityServer extends MJInteractionEventEntity {
|
|
19
|
+
static { MJInteractionEventEntityServer_1 = this; }
|
|
20
|
+
static { this.APPEND_ONLY_UPDATE_MESSAGE = 'Interaction Events are append-only: updates are prohibited.'; }
|
|
21
|
+
static { this.APPEND_ONLY_DELETE_MESSAGE = 'Interaction Events are append-only: deletes are prohibited.'; }
|
|
22
|
+
CheckPermissions(type, throwError) {
|
|
23
|
+
if (type === EntityPermissionType.Update || type === EntityPermissionType.Delete) {
|
|
24
|
+
const msg = `Interaction Events are append-only: updates and deletes are prohibited.`;
|
|
25
|
+
if (throwError) {
|
|
26
|
+
throw new Error(msg);
|
|
27
|
+
}
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
return super.CheckPermissions(type, throwError);
|
|
31
|
+
}
|
|
32
|
+
Validate() {
|
|
33
|
+
const result = super.Validate();
|
|
34
|
+
if (this.IsSaved) {
|
|
35
|
+
result.Success = false;
|
|
36
|
+
result.Errors.push(new ValidationErrorInfo('ID', MJInteractionEventEntityServer_1.APPEND_ONLY_UPDATE_MESSAGE, this.ID, ValidationErrorType.Failure));
|
|
37
|
+
}
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
async Save(options) {
|
|
41
|
+
if (this.IsSaved) {
|
|
42
|
+
return this.refuse('update', MJInteractionEventEntityServer_1.APPEND_ONLY_UPDATE_MESSAGE);
|
|
43
|
+
}
|
|
44
|
+
return super.Save(options);
|
|
45
|
+
}
|
|
46
|
+
async Delete(_options) {
|
|
47
|
+
return this.refuse('delete', MJInteractionEventEntityServer_1.APPEND_ONLY_DELETE_MESSAGE);
|
|
48
|
+
}
|
|
49
|
+
refuse(type, message) {
|
|
50
|
+
const result = new BaseEntityResult();
|
|
51
|
+
result.Success = false;
|
|
52
|
+
result.Type = type;
|
|
53
|
+
result.Message = message;
|
|
54
|
+
result.StartedAt = new Date();
|
|
55
|
+
result.EndedAt = new Date();
|
|
56
|
+
this.RegisterResultHistoryEntry(result);
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
MJInteractionEventEntityServer = MJInteractionEventEntityServer_1 = __decorate([
|
|
61
|
+
RegisterClass(BaseEntity, 'MJ: Interaction Events')
|
|
62
|
+
], MJInteractionEventEntityServer);
|
|
63
|
+
export { MJInteractionEventEntityServer };
|
|
64
|
+
/**
|
|
65
|
+
* Loader stub — prevents the class from being tree-shaken out of the bundle.
|
|
66
|
+
*/
|
|
67
|
+
export function LoadMJInteractionEventEntityServer() {
|
|
68
|
+
void MJInteractionEventEntityServer;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=MJInteractionEventEntityServer.server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MJInteractionEventEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJInteractionEventEntityServer.server.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EACH,UAAU,EACV,gBAAgB,EAEhB,oBAAoB,EAEpB,mBAAmB,EACnB,mBAAmB,GAEtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE;;;;;;GAMG;AAEI,IAAM,8BAA8B,GAApC,MAAM,8BAA+B,SAAQ,wBAAwB;;aACjD,+BAA0B,GAAG,6DAA6D,AAAhE,CAAiE;aAC3F,+BAA0B,GAAG,6DAA6D,AAAhE,CAAiE;IAElG,gBAAgB,CAAC,IAA0B,EAAE,UAAmB;QAC5E,IAAI,IAAI,KAAK,oBAAoB,CAAC,MAAM,IAAI,IAAI,KAAK,oBAAoB,CAAC,MAAM,EAAE,CAAC;YAC/E,MAAM,GAAG,GAAG,yEAAyE,CAAC;YACtF,IAAI,UAAU,EAAE,CAAC;gBACb,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;YACzB,CAAC;YACD,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,OAAO,KAAK,CAAC,gBAAgB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACpD,CAAC;IAEe,QAAQ;QACpB,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;QAChC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,MAAM,CAAC,OAAO,GAAG,KAAK,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
|
|
17
17
|
protected EmbedTextLocal(textToEmbed: string): Promise<SimpleEmbeddingResult>;
|
|
18
18
|
/**
|
|
19
19
|
* Generates an embedding from composite text (Name + UserQuestion + Description) for richer semantic search.
|
|
20
|
-
* Stores the vector in EmbeddingVector and
|
|
20
|
+
* Stores the vector in EmbeddingVector (JSON) and EmbeddingVectorBinary (float32 bytes, base64), and the
|
|
21
|
+
* model reference in EmbeddingModelID.
|
|
22
|
+
*
|
|
23
|
+
* Same contract as `MJTagEntityServer`: when no vector comes back — empty text, an empty result or an
|
|
24
|
+
* embedder error — all three columns are cleared, so a query whose text changed never keeps a vector
|
|
25
|
+
* computed from its old text. An embedder error is logged and does not fail the save; the query simply
|
|
26
|
+
* has no semantic match until its next successful embedding.
|
|
21
27
|
*/
|
|
22
28
|
protected GenerateCompositeEmbedding(): Promise<void>;
|
|
29
|
+
/** Clears the stored vector (both forms) and the model it was computed with. */
|
|
30
|
+
private clearEmbedding;
|
|
23
31
|
Save(options?: EntitySaveOptions): Promise<boolean>;
|
|
24
32
|
Delete(options?: EntitySaveOptions): Promise<boolean>;
|
|
25
33
|
/**
|
|
@@ -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
|
|
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;IAcxB;;;;;OAKG;IACU,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAI7C;;;OAGG;YACW,uBAAuB;IAsBrC;;OAEG;YACW,sBAAsB;IAmBpC;;;OAGG;YACW,wBAAwB;IAiCtC;;OAEG;YACW,sBAAsB;IA4BpC;;OAEG;YACW,oBAAoB;IA4BlC;;OAEG;YACW,6BAA6B;CAgB9C"}
|
|
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { BaseEntity, LogError, } from "@memberjunction/core";
|
|
8
8
|
import { MJQueryEntityExtended, QueryEngine } from "@memberjunction/core-entities";
|
|
9
|
-
import { RegisterClass, MJGlobal, UUIDsEqual } from "@memberjunction/global";
|
|
9
|
+
import { Float32VectorToBase64, RegisterClass, MJGlobal, UUIDsEqual } from "@memberjunction/global";
|
|
10
10
|
import { EmbedTextLocalHelper } from "./util.js";
|
|
11
11
|
import { RunExtractionPipeline, CleanupQueryData, ConvertTSQLToPostgreSQL, } from "./query-extraction/index.js";
|
|
12
12
|
import { SQLParser } from "@memberjunction/sql-parser";
|
|
@@ -27,7 +27,13 @@ let MJQueryEntityServer = class MJQueryEntityServer extends MJQueryEntityExtende
|
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Generates an embedding from composite text (Name + UserQuestion + Description) for richer semantic search.
|
|
30
|
-
* Stores the vector in EmbeddingVector and
|
|
30
|
+
* Stores the vector in EmbeddingVector (JSON) and EmbeddingVectorBinary (float32 bytes, base64), and the
|
|
31
|
+
* model reference in EmbeddingModelID.
|
|
32
|
+
*
|
|
33
|
+
* Same contract as `MJTagEntityServer`: when no vector comes back — empty text, an empty result or an
|
|
34
|
+
* embedder error — all three columns are cleared, so a query whose text changed never keeps a vector
|
|
35
|
+
* computed from its old text. An embedder error is logged and does not fail the save; the query simply
|
|
36
|
+
* has no semantic match until its next successful embedding.
|
|
31
37
|
*/
|
|
32
38
|
async GenerateCompositeEmbedding() {
|
|
33
39
|
const parts = [
|
|
@@ -36,16 +42,29 @@ let MJQueryEntityServer = class MJQueryEntityServer extends MJQueryEntityExtende
|
|
|
36
42
|
this.Description || ''
|
|
37
43
|
].filter(p => p.trim().length > 0);
|
|
38
44
|
if (parts.length === 0) {
|
|
39
|
-
this.
|
|
40
|
-
this.EmbeddingModelID = null;
|
|
45
|
+
this.clearEmbedding();
|
|
41
46
|
return;
|
|
42
47
|
}
|
|
43
48
|
const compositeText = parts.join(' | ');
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
try {
|
|
50
|
+
const result = await this.EmbedTextLocal(compositeText);
|
|
51
|
+
if (result?.vector && result.vector.length > 0) {
|
|
52
|
+
this.EmbeddingVector = JSON.stringify(result.vector);
|
|
53
|
+
this.EmbeddingVectorBinary = Float32VectorToBase64(result.vector);
|
|
54
|
+
this.EmbeddingModelID = result.modelID;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
LogError(`[MJQueryEntityServer] Embedding refresh failed for query "${this.Name}": ${error instanceof Error ? error.message : String(error)}`);
|
|
48
60
|
}
|
|
61
|
+
this.clearEmbedding();
|
|
62
|
+
}
|
|
63
|
+
/** Clears the stored vector (both forms) and the model it was computed with. */
|
|
64
|
+
clearEmbedding() {
|
|
65
|
+
this.EmbeddingVector = null;
|
|
66
|
+
this.EmbeddingVectorBinary = null;
|
|
67
|
+
this.EmbeddingModelID = null;
|
|
49
68
|
}
|
|
50
69
|
// ─── Save / Delete Overrides ─────────────────────────────────────────────────
|
|
51
70
|
async Save(options) {
|
|
@@ -62,6 +81,7 @@ let MJQueryEntityServer = class MJQueryEntityServer extends MJQueryEntityExtende
|
|
|
62
81
|
}
|
|
63
82
|
else if (!this.Description || this.Description.trim().length === 0) {
|
|
64
83
|
this.EmbeddingVector = null;
|
|
84
|
+
this.EmbeddingVectorBinary = null;
|
|
65
85
|
this.EmbeddingModelID = null;
|
|
66
86
|
}
|
|
67
87
|
// Save the query first without 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,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,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|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EntityPermissionType } from '@memberjunction/core';
|
|
2
|
+
import { MJRecordChangeEntity } from '@memberjunction/core-entities';
|
|
3
|
+
export declare class MJRecordChangeEntityServer extends MJRecordChangeEntity {
|
|
4
|
+
CheckPermissions(type: EntityPermissionType, throwError: boolean): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* True for a new row with `Source` 'Internal' and `Type` 'Create', in any padding or casing, that a
|
|
7
|
+
* caller is creating. A missing value counts as the database default.
|
|
8
|
+
*/
|
|
9
|
+
private isCallerCreatingInternalRow;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=MJRecordChangeEntityServer.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MJRecordChangeEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJRecordChangeEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,oBAAoB,EAMvB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAqCrE,qBACa,0BAA2B,SAAQ,oBAAoB;IAChD,gBAAgB,CAAC,IAAI,EAAE,oBAAoB,EAAE,UAAU,EAAE,OAAO,GAAG,OAAO;IA8C1F;;;OAGG;IACH,OAAO,CAAC,2BAA2B;CAQtC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
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, EntityFieldInfo, EntityPermissionType, Metadata, AuthorizationEvaluator, } from '@memberjunction/core';
|
|
8
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
9
|
+
import { MJRecordChangeEntity } from '@memberjunction/core-entities';
|
|
10
|
+
/**
|
|
11
|
+
* Server subclass for `MJ: Record Changes`.
|
|
12
|
+
*
|
|
13
|
+
* Implements §10.6 Comments annotation:
|
|
14
|
+
* An update on a Record Change record is permitted ONLY when:
|
|
15
|
+
* 1. The only dirty field being updated is `Comments`.
|
|
16
|
+
* 2. The user holds the `Record Changes: Annotate` authorization (evaluated with ancestors).
|
|
17
|
+
* 3. The entity's own Update permission allows it, as for any other entity. The authorization
|
|
18
|
+
* narrows who may annotate; it doesn't replace the role permission.
|
|
19
|
+
*
|
|
20
|
+
* Any other update is strictly forbidden to protect audit trail integrity.
|
|
21
|
+
*
|
|
22
|
+
* A create with a caller (`ActiveUser` set) of a record change whose `Source` is `Internal` and
|
|
23
|
+
* whose `Type` is `Create` is refused for every caller. A null or undefined `Source` or `Type` counts
|
|
24
|
+
* as `Internal` or `Create`, the defaults the database stores for it. Both are compared trimmed and
|
|
25
|
+
* case-folded, as value-list validation compares them, so `'internal '` or `'create'` is refused too.
|
|
26
|
+
* That is wider than the database CHECK (SQL Server ignores trailing spaces only), which is safe: the
|
|
27
|
+
* extra values refused are ones the database would reject. Those rows are the platform's own record of
|
|
28
|
+
* who created a record, which the database provider writes in SQL alongside each insert; other
|
|
29
|
+
* code trusts them, for example to read who created a component. Other Internal types, such as the
|
|
30
|
+
* `Snapshot` rows `SnapshotBuilder` writes for version labels, are left to the role permission.
|
|
31
|
+
*/
|
|
32
|
+
/** The entity's data provider when it also serves metadata (the server providers do). */
|
|
33
|
+
function asMetadataProvider(provider) {
|
|
34
|
+
return provider && 'Authorizations' in provider && Array.isArray(provider.Authorizations)
|
|
35
|
+
? { Authorizations: provider.Authorizations }
|
|
36
|
+
: undefined;
|
|
37
|
+
}
|
|
38
|
+
/** Authorizations from the entity's own provider, else from the global metadata. */
|
|
39
|
+
function authorizationsOf(provider) {
|
|
40
|
+
const md = asMetadataProvider(provider) ?? new Metadata();
|
|
41
|
+
return md.Authorizations;
|
|
42
|
+
}
|
|
43
|
+
let MJRecordChangeEntityServer = class MJRecordChangeEntityServer extends MJRecordChangeEntity {
|
|
44
|
+
CheckPermissions(type, throwError) {
|
|
45
|
+
if (type === EntityPermissionType.Create && this.isCallerCreatingInternalRow()) {
|
|
46
|
+
const msg = `Record Changes with Source 'Internal' and Type 'Create' are written by the platform and cannot be created through the API.`;
|
|
47
|
+
if (throwError)
|
|
48
|
+
throw new Error(msg);
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
if (type === EntityPermissionType.Update) {
|
|
52
|
+
const u = this.ActiveUser;
|
|
53
|
+
if (!u) {
|
|
54
|
+
throw new Error('No user set - either the context user for the entity object must be set, or the CurrentUser of the provider must be set');
|
|
55
|
+
}
|
|
56
|
+
if (!this.EntityInfo.AllowUpdateAPI) {
|
|
57
|
+
const msg = `Update API is disabled for ${this.EntityInfo.Name}`;
|
|
58
|
+
if (throwError)
|
|
59
|
+
throw new Error(msg);
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
// Only Comments can be modified on an existing RecordChange
|
|
63
|
+
const dirtyFields = this.Fields.filter((f) => f.Dirty);
|
|
64
|
+
const isCommentsOnly = dirtyFields.length === 1 && dirtyFields[0].Name === 'Comments';
|
|
65
|
+
if (!isCommentsOnly) {
|
|
66
|
+
const msg = `Record Changes cannot be modified, except for Comments annotation.`;
|
|
67
|
+
if (throwError)
|
|
68
|
+
throw new Error(msg);
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
// Must hold "Record Changes: Annotate" authorization (evaluated with ancestors)
|
|
72
|
+
const authorizations = authorizationsOf(this.ProviderToUse);
|
|
73
|
+
const auth = authorizations.find((a) => a.Name === 'Record Changes: Annotate');
|
|
74
|
+
const evaluator = new AuthorizationEvaluator();
|
|
75
|
+
const allowed = auth ? evaluator.UserCanExecuteWithAncestors(auth, u, authorizations) : false;
|
|
76
|
+
if (!allowed) {
|
|
77
|
+
if (throwError) {
|
|
78
|
+
this.ThrowPermissionError(u, type, null);
|
|
79
|
+
}
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return super.CheckPermissions(type, throwError);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* True for a new row with `Source` 'Internal' and `Type` 'Create', in any padding or casing, that a
|
|
87
|
+
* caller is creating. A missing value counts as the database default.
|
|
88
|
+
*/
|
|
89
|
+
isCallerCreatingInternalRow() {
|
|
90
|
+
if (this.IsSaved || !this.ActiveUser)
|
|
91
|
+
return false;
|
|
92
|
+
// These defaults mirror the ISNULL defaults in spCreateRecordChange.
|
|
93
|
+
const source = this.Source ?? 'Internal';
|
|
94
|
+
const type = this.Type ?? 'Create';
|
|
95
|
+
return EntityFieldInfo.NormalizeValueListValue(source) === 'internal'
|
|
96
|
+
&& EntityFieldInfo.NormalizeValueListValue(type) === 'create';
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
MJRecordChangeEntityServer = __decorate([
|
|
100
|
+
RegisterClass(BaseEntity, 'MJ: Record Changes')
|
|
101
|
+
], MJRecordChangeEntityServer);
|
|
102
|
+
export { MJRecordChangeEntityServer };
|
|
103
|
+
//# sourceMappingURL=MJRecordChangeEntityServer.server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MJRecordChangeEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJRecordChangeEntityServer.server.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACH,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,QAAQ,EACR,sBAAsB,GAIzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAA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UAAU;YAAE,OAAO,KAAK,CAAC;QACnD,qEAAqE;QACrE,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,UAAU,CAAC;QACzC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,QAAQ,CAAC;QACnC,OAAO,eAAe,CAAC,uBAAuB,CAAC,MAAM,CAAC,KAAK,UAAU;eAC9D,eAAe,CAAC,uBAAuB,CAAC,IAAI,CAAC,KAAK,QAAQ,CAAC;IACtE,CAAC;CACJ,CAAA;AA3DY,0BAA0B;IADtC,aAAa,CAAC,UAAU,EAAE,oBAAoB,CAAC;GACnC,0BAA0B,CA2DtC"}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* @module @memberjunction/core-entities-server
|
|
15
15
|
*/
|
|
16
16
|
import { EntitySaveOptions } from '@memberjunction/core';
|
|
17
|
-
import {
|
|
17
|
+
import { MJRecordProcessEntityExtended } from '@memberjunction/feature-pipelines';
|
|
18
18
|
/** Whether the owned Scheduled Job should be active or disabled, given the process's schedule state. */
|
|
19
19
|
export type ScheduleAction = 'upsert' | 'disable';
|
|
20
20
|
/**
|
|
@@ -63,7 +63,11 @@ export declare function buildScheduledJobFields(p: {
|
|
|
63
63
|
Configuration: string;
|
|
64
64
|
Status: 'Active';
|
|
65
65
|
};
|
|
66
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Extends the shared {@link MJRecordProcessEntityExtended}, so the Feature Pipeline save check in its
|
|
68
|
+
* `Validate()` runs on the server too, ahead of the reconciliation here.
|
|
69
|
+
*/
|
|
70
|
+
export declare class MJRecordProcessEntityServer extends MJRecordProcessEntityExtended {
|
|
67
71
|
/**
|
|
68
72
|
* Persists the record, then (best-effort) reconciles the owned Scheduled Job. Reconciliation
|
|
69
73
|
* runs only when a schedule-relevant field changed (or on first save), and never fails the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MJRecordProcessEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJRecordProcessEntityServer.server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAEH,iBAAiB,EAKpB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"MJRecordProcessEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJRecordProcessEntityServer.server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAEH,iBAAiB,EAKpB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAkBlF,wGAAwG;AACxG,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,SAAS,CAAC;AAElD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,OAAO,CAAC;IAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG,cAAc,CAEnI;AAED,oDAAoD;AACpD,wBAAgB,oBAAoB,CAAC,CAAC,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,OAAO,CAAC;IAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG,cAAc,CAEnI;AAED,kGAAkG;AAClG,wBAAgB,uBAAuB,CAAC,CAAC,EAAE;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;CAC3B,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,QAAQ,CAAA;CAAE,CASzH;AAED,uDAAuD;AACvD,wBAAgB,uBAAuB,CAAC,CAAC,EAAE;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;CAC3B,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,QAAQ,CAAA;CAAE,CAEzH;AAED;;;GAGG;AACH,qBACa,2BAA4B,SAAQ,6BAA6B;IAC1E;;;;OAIG;IACmB,IAAI,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IAmBzE;;;;;;;OAOG;YACW,eAAe;IAW7B,gGAAgG;IAChG,OAAO,CAAC,aAAa;IAIrB,wFAAwF;YAC1E,wBAAwB;IAOtC,oFAAoF;YACtE,qBAAqB;IAcnC,gGAAgG;YAClF,gBAAgB;IAa9B,4FAA4F;YAC9E,YAAY;IAgB1B,yFAAyF;YAC3E,eAAe;IA4B7B,iFAAiF;YACnE,mBAAmB;CAUpC"}
|
|
@@ -21,7 +21,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
21
21
|
};
|
|
22
22
|
import { RegisterClass, SafeJSONParse, UUIDsEqual } from '@memberjunction/global';
|
|
23
23
|
import { BaseEntity, LogError, RunView, } from '@memberjunction/core';
|
|
24
|
-
import {
|
|
24
|
+
import { MJRecordProcessEntityExtended } from '@memberjunction/feature-pipelines';
|
|
25
25
|
import { ReconcileRecordProcessOnChange } from './RecordProcessOnChangeReconciler.js';
|
|
26
26
|
/** The `MJ: Scheduled Job Types.Name` seeded for record-process recurrence (metadata-driven). */
|
|
27
27
|
const RUN_RECORD_PROCESS_JOB_TYPE = 'Run Record Process';
|
|
@@ -62,7 +62,11 @@ export function BuildScheduledJobFields(p) {
|
|
|
62
62
|
export function buildScheduledJobFields(p) {
|
|
63
63
|
return BuildScheduledJobFields(p);
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Extends the shared {@link MJRecordProcessEntityExtended}, so the Feature Pipeline save check in its
|
|
67
|
+
* `Validate()` runs on the server too, ahead of the reconciliation here.
|
|
68
|
+
*/
|
|
69
|
+
let MJRecordProcessEntityServer = class MJRecordProcessEntityServer extends MJRecordProcessEntityExtended {
|
|
66
70
|
/**
|
|
67
71
|
* Persists the record, then (best-effort) reconciles the owned Scheduled Job. Reconciliation
|
|
68
72
|
* runs only when a schedule-relevant field changed (or on first save), and never fails the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MJRecordProcessEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJRecordProcessEntityServer.server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;AAEH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EACH,UAAU,EAGV,QAAQ,EACR,OAAO,GAEV,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"MJRecordProcessEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJRecordProcessEntityServer.server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;AAEH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EACH,UAAU,EAGV,QAAQ,EACR,OAAO,GAEV,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AAEnF,iGAAiG;AACjG,MAAM,2BAA2B,GAAG,o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,QAAQ,CAAC,YAAY,EAAE,eAAe,IAAI,eAAe,EAAE,CAAC,CAAC;QACtJ,CAAC;IACL,CAAC;CACJ,CAAA;AA/IY,2BAA2B;IADvC,aAAa,CAAC,UAAU,EAAE,sBAAsB,CAAC;GACrC,2BAA2B,CA+IvC"}
|
|
@@ -81,7 +81,7 @@ let MJRemoteOperationEntityServer = class MJRemoteOperationEntityServer extends
|
|
|
81
81
|
ShouldRegenerate() {
|
|
82
82
|
return (this.GenerationType === 'AI' &&
|
|
83
83
|
!this.CodeLocked &&
|
|
84
|
-
(this.GetFieldByName('Description').Dirty || !this.IsSaved || this.ForceCodeGeneration));
|
|
84
|
+
(this.GetFieldByName('Description').Dirty || (!this.IsSaved && !this.Code) || this.ForceCodeGeneration));
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
87
|
* Asks the `Generate Remote Operation Code` prompt to author the body of `InternalExecute` from this op's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MJRemoteOperationEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJRemoteOperationEntityServer.server.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAwB,UAAU,EAA0C,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChJ,OAAO,EAAE,uBAAuB,EAAkD,MAAM,+BAA+B,CAAC;AACxH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAwD,MAAM,2BAA2B,CAAC;AAUtH;;;;;;;;;;;GAWG;AAEI,IAAM,6BAA6B,GAAnC,MAAM,6BAA8B,SAAQ,uBAAuB;IAOtE,YAAY,MAAkB,EAAE,WAAuC,IAAI;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ACjC,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,uDAAuD;YACpG,CAAC;YACD,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC,CAAC,+BAA+B;YAEjE,IAAI,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC5B,MAAM,QAAQ,CAAC,iBAAiB,EAAE,CAAC;gBACnC,OAAO,IAAI,CAAC;YAChB,CAAC;YACD,MAAM,QAAQ,CAAC,mBAAmB,EAAE,CAAC;YACrC,OAAO,KAAK,CAAC;QACjB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,MAAM,QAAQ,CAAC,mBAAmB,EAAE,CAAC;YACrC,MAAM,CAAC,CAAC;QACZ,CAAC;IACL,CAAC;IAED,kIAAkI;IACxH,gBAAgB;QACtB,OAAO,CACH,IAAI,CAAC,cAAc,KAAK,IAAI;YAC5B,CAAC,IAAI,CAAC,UAAU;YAChB,CAAC,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,mBAAmB,CAAC,
|
|
1
|
+
{"version":3,"file":"MJRemoteOperationEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJRemoteOperationEntityServer.server.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAwB,UAAU,EAA0C,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChJ,OAAO,EAAE,uBAAuB,EAAkD,MAAM,+BAA+B,CAAC;AACxH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAwD,MAAM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,CAAC,CAAC,CAAC;YACZ,MAAM,CAAC,CAAC;QACZ,CAAC;IACL,CAAC;IAED,yFAAyF;IAC/E,iBAAiB;QACvB,OAAO;YACH,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,EAAE;YACnC,aAAa,EAAE,IAAI,CAAC,aAAa,IAAI,SAAS;YAC9C,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,IAAI,EAAE;YACnD,cAAc,EAAE,IAAI,CAAC,cAAc,IAAI,SAAS;YAChD,oBAAoB,EAAE,IAAI,CAAC,oBAAoB,IAAI,EAAE;YACrD,kBAAkB,EAAE,IAAI,CAAC,wBAAwB,EAAE;SACtD,CAAC;IACN,CAAC;IAED,2HAA2H;IACjH,wBAAwB;QAC9B,OAAO,mBAAmB,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,OAAgC,EAAE,EAAE,CAAC,CAAC;YACrF,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAiC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;SACpH,CAAC,CAAC,CAAC;IACR,CAAC;CACJ,CAAA;AAjIY,6BAA6B;IADzC,aAAa,CAAC,UAAU,EAAE,uBAAuB,CAAC,CAAC,6EAA6E;;qCAQzG,UAAU;GAPrB,6BAA6B,CAiIzC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ValidationResult } from '@memberjunction/core';
|
|
2
|
+
import { MJRubricBandEntity } from '@memberjunction/core-entities';
|
|
3
|
+
/**
|
|
4
|
+
* Bands of a published or retired version cannot be added or changed.
|
|
5
|
+
*/
|
|
6
|
+
export declare class MJRubricBandEntityServer extends MJRubricBandEntity {
|
|
7
|
+
ValidateAsync(): Promise<ValidationResult>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=MJRubricBandEntityServer.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MJRubricBandEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJRubricBandEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAMnE;;GAEG;AACH,qBACa,wBAAyB,SAAQ,kBAAkB;IACtC,aAAa,IAAI,OAAO,CAAC,gBAAgB,CAAC;CAYnE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
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 { MJRubricBandEntity } from '@memberjunction/core-entities';
|
|
9
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
10
|
+
import { DraftChildError, PushFailure } from './rubrics/statusRules.js';
|
|
11
|
+
/**
|
|
12
|
+
* Bands of a published or retired version cannot be added or changed.
|
|
13
|
+
*/
|
|
14
|
+
let MJRubricBandEntityServer = class MJRubricBandEntityServer extends MJRubricBandEntity {
|
|
15
|
+
async ValidateAsync() {
|
|
16
|
+
const result = await super.ValidateAsync();
|
|
17
|
+
const provider = this.ProviderToUse;
|
|
18
|
+
if (!provider?.RunView || !this.RubricVersionID)
|
|
19
|
+
return result;
|
|
20
|
+
const versions = await provider.RunView({ EntityName: 'MJ: Rubric Versions', ExtraFilter: `ID='${this.RubricVersionID}'` }, this.ContextCurrentUser);
|
|
21
|
+
const status = versions.Results?.[0]?.Status ?? null;
|
|
22
|
+
const message = !versions.Success
|
|
23
|
+
? 'Could not confirm this band belongs to a draft version.'
|
|
24
|
+
: DraftChildError('band', status);
|
|
25
|
+
if (message)
|
|
26
|
+
PushFailure(result, 'RubricVersionID', message, this.RubricVersionID);
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
MJRubricBandEntityServer = __decorate([
|
|
31
|
+
RegisterClass(BaseEntity, 'MJ: Rubric Bands')
|
|
32
|
+
], MJRubricBandEntityServer);
|
|
33
|
+
export { MJRubricBandEntityServer };
|
|
34
|
+
//# sourceMappingURL=MJRubricBandEntityServer.server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MJRubricBandEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJRubricBandEntityServer.server.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAyB,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAIxE;;GAEG;AAEI,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,kBAAkB;IAC5C,KAAK,CAAC,aAAa;QAC/B,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,aAAa,EAAE,CAAC;QAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,aAA6C,CAAC;QACpE,IAAI,CAAC,QAAQ,EAAE,OAAO,IAAI,CAAC,IAAI,CAAC,eAAe;YAAE,OAAO,MAAM,CAAC;QAC/D,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,qBAAqB,EAAE,WAAW,EAAE,OAAO,IAAI,CAAC,eAAe,GAAG,EAAE,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;QACrJ,MAAM,MAAM,GAAI,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CAAqC,EAAE,MAAM,IAAI,IAAI,CAAC;QAC1F,MAAM,OAAO,GAAG,CAAC,QAAQ,CAAC,OAAO;YAC7B,CAAC,CAAC,yDAAyD;YAC3D,CAAC,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACtC,IAAI,OAAO;YAAE,WAAW,CAAC,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QACnF,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ,CAAA;AAbY,wBAAwB;IADpC,aAAa,CAAC,UAAU,EAAE,kBAAkB,CAAC;GACjC,wBAAwB,CAapC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ValidationResult } from '@memberjunction/core';
|
|
2
|
+
import { MJRubricCriterionEntity } from '@memberjunction/core-entities';
|
|
3
|
+
import type { RubricVersionSnapshot } from '@memberjunction/rubrics-base';
|
|
4
|
+
/**
|
|
5
|
+
* Checks a criterion against the draft tree it belongs to.
|
|
6
|
+
*
|
|
7
|
+
* Refuses duplicate keys, a missing or cyclic parent, a criterion with no
|
|
8
|
+
* scale, and a gate with no minimum. Publish runs the same check.
|
|
9
|
+
*/
|
|
10
|
+
export declare class MJRubricCriterionEntityServer extends MJRubricCriterionEntity {
|
|
11
|
+
/** The tree errors for this draft. Empty when the tree can be published. */
|
|
12
|
+
TreeErrors(version: RubricVersionSnapshot): string[];
|
|
13
|
+
/** Criteria of a published or retired version cannot be added or changed. */
|
|
14
|
+
ValidateAsync(): Promise<ValidationResult>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=MJRubricCriterionEntityServer.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MJRubricCriterionEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJRubricCriterionEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAExE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAI1E;;;;;GAKG;AACH,qBACa,6BAA8B,SAAQ,uBAAuB;IACtE,4EAA4E;IACrE,UAAU,CAAC,OAAO,EAAE,qBAAqB,GAAG,MAAM,EAAE;IAI3D,6EAA6E;IACvD,aAAa,IAAI,OAAO,CAAC,gBAAgB,CAAC;CAYnE"}
|
|
@@ -0,0 +1,43 @@
|
|
|
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 { MJRubricCriterionEntity } from '@memberjunction/core-entities';
|
|
9
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
10
|
+
import { DraftChildError, PushFailure } from './rubrics/statusRules.js';
|
|
11
|
+
import { ValidateRubricTree } from './rubrics/versionPublish.js';
|
|
12
|
+
/**
|
|
13
|
+
* Checks a criterion against the draft tree it belongs to.
|
|
14
|
+
*
|
|
15
|
+
* Refuses duplicate keys, a missing or cyclic parent, a criterion with no
|
|
16
|
+
* scale, and a gate with no minimum. Publish runs the same check.
|
|
17
|
+
*/
|
|
18
|
+
let MJRubricCriterionEntityServer = class MJRubricCriterionEntityServer extends MJRubricCriterionEntity {
|
|
19
|
+
/** The tree errors for this draft. Empty when the tree can be published. */
|
|
20
|
+
TreeErrors(version) {
|
|
21
|
+
return ValidateRubricTree(version).errors;
|
|
22
|
+
}
|
|
23
|
+
/** Criteria of a published or retired version cannot be added or changed. */
|
|
24
|
+
async ValidateAsync() {
|
|
25
|
+
const result = await super.ValidateAsync();
|
|
26
|
+
const provider = this.ProviderToUse;
|
|
27
|
+
if (!provider?.RunView || !this.RubricVersionID)
|
|
28
|
+
return result;
|
|
29
|
+
const versions = await provider.RunView({ EntityName: 'MJ: Rubric Versions', ExtraFilter: `ID='${this.RubricVersionID}'` }, this.ContextCurrentUser);
|
|
30
|
+
const status = versions.Results?.[0]?.Status ?? null;
|
|
31
|
+
const message = !versions.Success
|
|
32
|
+
? 'Could not confirm this criterion belongs to a draft version.'
|
|
33
|
+
: DraftChildError('criterion', status);
|
|
34
|
+
if (message)
|
|
35
|
+
PushFailure(result, 'RubricVersionID', message, this.RubricVersionID);
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
MJRubricCriterionEntityServer = __decorate([
|
|
40
|
+
RegisterClass(BaseEntity, 'MJ: Rubric Criteria')
|
|
41
|
+
], MJRubricCriterionEntityServer);
|
|
42
|
+
export { MJRubricCriterionEntityServer };
|
|
43
|
+
//# sourceMappingURL=MJRubricCriterionEntityServer.server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MJRubricCriterionEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJRubricCriterionEntityServer.server.ts"],"names":[],"mappings":";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F,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ,CAAA;AAnBY,6BAA6B;IADzC,aAAa,CAAC,UAAU,EAAE,qBAAqB,CAAC;GACpC,6BAA6B,CAmBzC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ValidationResult } from '@memberjunction/core';
|
|
2
|
+
import { MJRubricCriterionLevelEntity } from '@memberjunction/core-entities';
|
|
3
|
+
/**
|
|
4
|
+
* Level descriptors of a published or retired version cannot be added or changed.
|
|
5
|
+
* The parent criterion points at the version.
|
|
6
|
+
*/
|
|
7
|
+
export declare class MJRubricCriterionLevelEntityServer extends MJRubricCriterionLevelEntity {
|
|
8
|
+
ValidateAsync(): Promise<ValidationResult>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=MJRubricCriterionLevelEntityServer.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MJRubricCriterionLevelEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJRubricCriterionLevelEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAM7E;;;GAGG;AACH,qBACa,kCAAmC,SAAQ,4BAA4B;IAC1D,aAAa,IAAI,OAAO,CAAC,gBAAgB,CAAC;CAoBnE"}
|