@memberjunction/core-entities-server 6.3.0-edge.1 → 6.3.0-edge.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/README.md +13 -0
  2. package/dist/custom/AgentChannelConversationDriver.server.d.ts +87 -0
  3. package/dist/custom/AgentChannelConversationDriver.server.d.ts.map +1 -0
  4. package/dist/custom/AgentChannelConversationDriver.server.js +216 -0
  5. package/dist/custom/AgentChannelConversationDriver.server.js.map +1 -0
  6. package/dist/custom/ArtifactSecurityHookHelpers.d.ts.map +1 -1
  7. package/dist/custom/ArtifactSecurityHookHelpers.js +50 -0
  8. package/dist/custom/ArtifactSecurityHookHelpers.js.map +1 -1
  9. package/dist/custom/AudienceNamedPersonAgentRequestService.d.ts +25 -0
  10. package/dist/custom/AudienceNamedPersonAgentRequestService.d.ts.map +1 -0
  11. package/dist/custom/AudienceNamedPersonAgentRequestService.js +304 -0
  12. package/dist/custom/AudienceNamedPersonAgentRequestService.js.map +1 -0
  13. package/dist/custom/ConversationDetailWritePermissionProvider.d.ts +113 -0
  14. package/dist/custom/ConversationDetailWritePermissionProvider.d.ts.map +1 -0
  15. package/dist/custom/ConversationDetailWritePermissionProvider.js +200 -0
  16. package/dist/custom/ConversationDetailWritePermissionProvider.js.map +1 -0
  17. package/dist/custom/ConversationReadSecurityHook.d.ts +61 -0
  18. package/dist/custom/ConversationReadSecurityHook.d.ts.map +1 -0
  19. package/dist/custom/ConversationReadSecurityHook.js +587 -0
  20. package/dist/custom/ConversationReadSecurityHook.js.map +1 -0
  21. package/dist/custom/GraphConceptReadSecurityHook.d.ts +75 -0
  22. package/dist/custom/GraphConceptReadSecurityHook.d.ts.map +1 -0
  23. package/dist/custom/GraphConceptReadSecurityHook.js +574 -0
  24. package/dist/custom/GraphConceptReadSecurityHook.js.map +1 -0
  25. package/dist/custom/GraphRecordChangesReadSecurityHook.d.ts +45 -0
  26. package/dist/custom/GraphRecordChangesReadSecurityHook.d.ts.map +1 -0
  27. package/dist/custom/GraphRecordChangesReadSecurityHook.js +744 -0
  28. package/dist/custom/GraphRecordChangesReadSecurityHook.js.map +1 -0
  29. package/dist/custom/MJAIAgentActionEntityServer.server.d.ts +13 -0
  30. package/dist/custom/MJAIAgentActionEntityServer.server.d.ts.map +1 -0
  31. package/dist/custom/MJAIAgentActionEntityServer.server.js +52 -0
  32. package/dist/custom/MJAIAgentActionEntityServer.server.js.map +1 -0
  33. package/dist/custom/MJAIAgentCategoryEntityServer.server.d.ts +30 -0
  34. package/dist/custom/MJAIAgentCategoryEntityServer.server.d.ts.map +1 -0
  35. package/dist/custom/MJAIAgentCategoryEntityServer.server.js +127 -0
  36. package/dist/custom/MJAIAgentCategoryEntityServer.server.js.map +1 -0
  37. package/dist/custom/MJAIAgentClientToolEntityServer.server.d.ts +12 -0
  38. package/dist/custom/MJAIAgentClientToolEntityServer.server.d.ts.map +1 -0
  39. package/dist/custom/MJAIAgentClientToolEntityServer.server.js +46 -0
  40. package/dist/custom/MJAIAgentClientToolEntityServer.server.js.map +1 -0
  41. package/dist/custom/MJAIAgentEntityServer.server.d.ts +185 -33
  42. package/dist/custom/MJAIAgentEntityServer.server.d.ts.map +1 -1
  43. package/dist/custom/MJAIAgentEntityServer.server.js +2232 -42
  44. package/dist/custom/MJAIAgentEntityServer.server.js.map +1 -1
  45. package/dist/custom/MJAIAgentModalityEntityServer.server.d.ts +13 -0
  46. package/dist/custom/MJAIAgentModalityEntityServer.server.d.ts.map +1 -0
  47. package/dist/custom/MJAIAgentModalityEntityServer.server.js +52 -0
  48. package/dist/custom/MJAIAgentModalityEntityServer.server.js.map +1 -0
  49. package/dist/custom/MJAIAgentNoteEntityServer.server.d.ts +64 -8
  50. package/dist/custom/MJAIAgentNoteEntityServer.server.d.ts.map +1 -1
  51. package/dist/custom/MJAIAgentNoteEntityServer.server.js +263 -9
  52. package/dist/custom/MJAIAgentNoteEntityServer.server.js.map +1 -1
  53. package/dist/custom/MJAIAgentPersonaEntityServer.server.d.ts +23 -0
  54. package/dist/custom/MJAIAgentPersonaEntityServer.server.d.ts.map +1 -0
  55. package/dist/custom/MJAIAgentPersonaEntityServer.server.js +95 -0
  56. package/dist/custom/MJAIAgentPersonaEntityServer.server.js.map +1 -0
  57. package/dist/custom/MJAIAgentRelationshipEntityServer.server.d.ts +5 -2
  58. package/dist/custom/MJAIAgentRelationshipEntityServer.server.d.ts.map +1 -1
  59. package/dist/custom/MJAIAgentRelationshipEntityServer.server.js +25 -2
  60. package/dist/custom/MJAIAgentRelationshipEntityServer.server.js.map +1 -1
  61. package/dist/custom/MJAIAgentSkillEntityServer.server.d.ts +12 -0
  62. package/dist/custom/MJAIAgentSkillEntityServer.server.d.ts.map +1 -0
  63. package/dist/custom/MJAIAgentSkillEntityServer.server.js +46 -0
  64. package/dist/custom/MJAIAgentSkillEntityServer.server.js.map +1 -0
  65. package/dist/custom/MJAIAgentStepTypeEntityServer.server.d.ts +28 -0
  66. package/dist/custom/MJAIAgentStepTypeEntityServer.server.d.ts.map +1 -0
  67. package/dist/custom/MJAIAgentStepTypeEntityServer.server.js +117 -0
  68. package/dist/custom/MJAIAgentStepTypeEntityServer.server.js.map +1 -0
  69. package/dist/custom/MJAIAgentTypeEntityServer.server.d.ts +34 -0
  70. package/dist/custom/MJAIAgentTypeEntityServer.server.d.ts.map +1 -0
  71. package/dist/custom/MJAIAgentTypeEntityServer.server.js +231 -0
  72. package/dist/custom/MJAIAgentTypeEntityServer.server.js.map +1 -0
  73. package/dist/custom/MJAIAgentUserPolicyEntityServer.server.d.ts +24 -13
  74. package/dist/custom/MJAIAgentUserPolicyEntityServer.server.d.ts.map +1 -1
  75. package/dist/custom/MJAIAgentUserPolicyEntityServer.server.js +167 -24
  76. package/dist/custom/MJAIAgentUserPolicyEntityServer.server.js.map +1 -1
  77. package/dist/custom/MJActionEntityServer.server.d.ts +37 -0
  78. package/dist/custom/MJActionEntityServer.server.d.ts.map +1 -1
  79. package/dist/custom/MJActionEntityServer.server.js +208 -3
  80. package/dist/custom/MJActionEntityServer.server.js.map +1 -1
  81. package/dist/custom/MJComponentEntityServer.server.d.ts +6 -0
  82. package/dist/custom/MJComponentEntityServer.server.d.ts.map +1 -1
  83. package/dist/custom/MJComponentEntityServer.server.js +20 -2
  84. package/dist/custom/MJComponentEntityServer.server.js.map +1 -1
  85. package/dist/custom/MJContentSourceEntityServer.server.d.ts +28 -0
  86. package/dist/custom/MJContentSourceEntityServer.server.d.ts.map +1 -0
  87. package/dist/custom/MJContentSourceEntityServer.server.js +73 -0
  88. package/dist/custom/MJContentSourceEntityServer.server.js.map +1 -0
  89. package/dist/custom/MJContentSourceTypeEntityServer.server.d.ts +25 -0
  90. package/dist/custom/MJContentSourceTypeEntityServer.server.d.ts.map +1 -0
  91. package/dist/custom/MJContentSourceTypeEntityServer.server.js +73 -0
  92. package/dist/custom/MJContentSourceTypeEntityServer.server.js.map +1 -0
  93. package/dist/custom/MJConversationDetailEntityServer.server.d.ts +27 -2
  94. package/dist/custom/MJConversationDetailEntityServer.server.d.ts.map +1 -1
  95. package/dist/custom/MJConversationDetailEntityServer.server.js +300 -4
  96. package/dist/custom/MJConversationDetailEntityServer.server.js.map +1 -1
  97. package/dist/custom/MJConversationEntityServer.server.d.ts +5 -26
  98. package/dist/custom/MJConversationEntityServer.server.d.ts.map +1 -1
  99. package/dist/custom/MJConversationEntityServer.server.js +236 -8
  100. package/dist/custom/MJConversationEntityServer.server.js.map +1 -1
  101. package/dist/custom/MJDashboardEntityServer.server.d.ts +6 -0
  102. package/dist/custom/MJDashboardEntityServer.server.d.ts.map +1 -1
  103. package/dist/custom/MJDashboardEntityServer.server.js +24 -2
  104. package/dist/custom/MJDashboardEntityServer.server.js.map +1 -1
  105. package/dist/custom/MJGraphConceptEntityServer.server.d.ts +244 -0
  106. package/dist/custom/MJGraphConceptEntityServer.server.d.ts.map +1 -0
  107. package/dist/custom/MJGraphConceptEntityServer.server.js +746 -0
  108. package/dist/custom/MJGraphConceptEntityServer.server.js.map +1 -0
  109. package/dist/custom/MJGraphEdgeEntityServer.server.d.ts +52 -11
  110. package/dist/custom/MJGraphEdgeEntityServer.server.d.ts.map +1 -1
  111. package/dist/custom/MJGraphEdgeEntityServer.server.js +269 -37
  112. package/dist/custom/MJGraphEdgeEntityServer.server.js.map +1 -1
  113. package/dist/custom/MJGraphEntityServer.server.d.ts +58 -0
  114. package/dist/custom/MJGraphEntityServer.server.d.ts.map +1 -0
  115. package/dist/custom/MJGraphEntityServer.server.js +357 -0
  116. package/dist/custom/MJGraphEntityServer.server.js.map +1 -0
  117. package/dist/custom/MJGraphLinkEntityServer.server.d.ts +98 -0
  118. package/dist/custom/MJGraphLinkEntityServer.server.d.ts.map +1 -0
  119. package/dist/custom/MJGraphLinkEntityServer.server.js +375 -0
  120. package/dist/custom/MJGraphLinkEntityServer.server.js.map +1 -0
  121. package/dist/custom/MJGraphPermissionEntityServer.server.d.ts +29 -0
  122. package/dist/custom/MJGraphPermissionEntityServer.server.d.ts.map +1 -0
  123. package/dist/custom/MJGraphPermissionEntityServer.server.js +141 -0
  124. package/dist/custom/MJGraphPermissionEntityServer.server.js.map +1 -0
  125. package/dist/custom/MJListDetailEntityServer.server.d.ts +4 -4
  126. package/dist/custom/MJListDetailEntityServer.server.js +4 -4
  127. package/dist/custom/MJListEntityServer.server.d.ts +2 -1
  128. package/dist/custom/MJListEntityServer.server.d.ts.map +1 -1
  129. package/dist/custom/MJListEntityServer.server.js +5 -2
  130. package/dist/custom/MJListEntityServer.server.js.map +1 -1
  131. package/dist/custom/MJMLModelPublishRecordEntityServer.server.d.ts +31 -0
  132. package/dist/custom/MJMLModelPublishRecordEntityServer.server.d.ts.map +1 -0
  133. package/dist/custom/MJMLModelPublishRecordEntityServer.server.js +68 -0
  134. package/dist/custom/MJMLModelPublishRecordEntityServer.server.js.map +1 -0
  135. package/dist/custom/MJMLModelScoringBindingEntityServer.server.d.ts +78 -0
  136. package/dist/custom/MJMLModelScoringBindingEntityServer.server.d.ts.map +1 -0
  137. package/dist/custom/MJMLModelScoringBindingEntityServer.server.js +273 -0
  138. package/dist/custom/MJMLModelScoringBindingEntityServer.server.js.map +1 -0
  139. package/dist/custom/MJMLOutputBindingEntityServer.server.d.ts +18 -0
  140. package/dist/custom/MJMLOutputBindingEntityServer.server.d.ts.map +1 -0
  141. package/dist/custom/MJMLOutputBindingEntityServer.server.js +61 -0
  142. package/dist/custom/MJMLOutputBindingEntityServer.server.js.map +1 -0
  143. package/dist/custom/MJMLPredictionUnitEntityServer.server.d.ts +3 -3
  144. package/dist/custom/MJMLPredictionUnitEntityServer.server.d.ts.map +1 -1
  145. package/dist/custom/MJMLPredictionUnitEntityServer.server.js +4 -4
  146. package/dist/custom/MJMLPredictionUnitEntityServer.server.js.map +1 -1
  147. package/dist/custom/MJQueryEntityServer.server.d.ts +81 -0
  148. package/dist/custom/MJQueryEntityServer.server.d.ts.map +1 -1
  149. package/dist/custom/MJQueryEntityServer.server.js +194 -4
  150. package/dist/custom/MJQueryEntityServer.server.js.map +1 -1
  151. package/dist/custom/MJQueryParameterEntityServer.server.d.ts +37 -0
  152. package/dist/custom/MJQueryParameterEntityServer.server.d.ts.map +1 -0
  153. package/dist/custom/MJQueryParameterEntityServer.server.js +160 -0
  154. package/dist/custom/MJQueryParameterEntityServer.server.js.map +1 -0
  155. package/dist/custom/MJQuerySQLEntityServer.server.d.ts +36 -1
  156. package/dist/custom/MJQuerySQLEntityServer.server.d.ts.map +1 -1
  157. package/dist/custom/MJQuerySQLEntityServer.server.js +138 -7
  158. package/dist/custom/MJQuerySQLEntityServer.server.js.map +1 -1
  159. package/dist/custom/MJResourcePermissionEntityServer.server.d.ts +28 -0
  160. package/dist/custom/MJResourcePermissionEntityServer.server.d.ts.map +1 -0
  161. package/dist/custom/MJResourcePermissionEntityServer.server.js +206 -0
  162. package/dist/custom/MJResourcePermissionEntityServer.server.js.map +1 -0
  163. package/dist/custom/MJRowLevelSecurityFilterEntityServer.server.d.ts +1 -1
  164. package/dist/custom/MJRowLevelSecurityFilterEntityServer.server.d.ts.map +1 -1
  165. package/dist/custom/MJRowLevelSecurityFilterEntityServer.server.js +8 -5
  166. package/dist/custom/MJRowLevelSecurityFilterEntityServer.server.js.map +1 -1
  167. package/dist/custom/MJUserRoleEntityServer.server.d.ts.map +1 -1
  168. package/dist/custom/MJUserRoleEntityServer.server.js +9 -0
  169. package/dist/custom/MJUserRoleEntityServer.server.js.map +1 -1
  170. package/dist/custom/MJUserRoutineEntityServer.server.d.ts +23 -0
  171. package/dist/custom/MJUserRoutineEntityServer.server.d.ts.map +1 -1
  172. package/dist/custom/MJUserRoutineEntityServer.server.js +320 -3
  173. package/dist/custom/MJUserRoutineEntityServer.server.js.map +1 -1
  174. package/dist/custom/MJUserViewEntityServer.server.d.ts +9 -0
  175. package/dist/custom/MJUserViewEntityServer.server.d.ts.map +1 -1
  176. package/dist/custom/MJUserViewEntityServer.server.js +59 -3
  177. package/dist/custom/MJUserViewEntityServer.server.js.map +1 -1
  178. package/dist/custom/agentRelationalGrantGuard.d.ts +73 -0
  179. package/dist/custom/agentRelationalGrantGuard.d.ts.map +1 -0
  180. package/dist/custom/agentRelationalGrantGuard.js +375 -0
  181. package/dist/custom/agentRelationalGrantGuard.js.map +1 -0
  182. package/dist/custom/approvalStamp.d.ts +86 -6
  183. package/dist/custom/approvalStamp.d.ts.map +1 -1
  184. package/dist/custom/approvalStamp.js +119 -15
  185. package/dist/custom/approvalStamp.js.map +1 -1
  186. package/dist/custom/canon/CanonFingerprintRecorderServer.d.ts +20 -0
  187. package/dist/custom/canon/CanonFingerprintRecorderServer.d.ts.map +1 -0
  188. package/dist/custom/canon/CanonFingerprintRecorderServer.js +148 -0
  189. package/dist/custom/canon/CanonFingerprintRecorderServer.js.map +1 -0
  190. package/dist/custom/canon/index.d.ts +2 -0
  191. package/dist/custom/canon/index.d.ts.map +1 -0
  192. package/dist/custom/canon/index.js +2 -0
  193. package/dist/custom/canon/index.js.map +1 -0
  194. package/dist/custom/graph/GraphFindPathServerOperation.d.ts +26 -0
  195. package/dist/custom/graph/GraphFindPathServerOperation.d.ts.map +1 -0
  196. package/dist/custom/graph/GraphFindPathServerOperation.js +117 -0
  197. package/dist/custom/graph/GraphFindPathServerOperation.js.map +1 -0
  198. package/dist/custom/graph/index.d.ts +2 -0
  199. package/dist/custom/graph/index.d.ts.map +1 -0
  200. package/dist/custom/graph/index.js +2 -0
  201. package/dist/custom/graph/index.js.map +1 -0
  202. package/dist/custom/graphPermissionGuard.d.ts +69 -0
  203. package/dist/custom/graphPermissionGuard.d.ts.map +1 -0
  204. package/dist/custom/graphPermissionGuard.js +229 -0
  205. package/dist/custom/graphPermissionGuard.js.map +1 -0
  206. package/dist/custom/graphRlsCacheInvalidation.d.ts +38 -0
  207. package/dist/custom/graphRlsCacheInvalidation.d.ts.map +1 -0
  208. package/dist/custom/graphRlsCacheInvalidation.js +111 -0
  209. package/dist/custom/graphRlsCacheInvalidation.js.map +1 -0
  210. package/dist/custom/queryParentFingerprint.d.ts +36 -0
  211. package/dist/custom/queryParentFingerprint.d.ts.map +1 -0
  212. package/dist/custom/queryParentFingerprint.js +159 -0
  213. package/dist/custom/queryParentFingerprint.js.map +1 -0
  214. package/dist/custom/queryParentSaveChain.d.ts +5 -0
  215. package/dist/custom/queryParentSaveChain.d.ts.map +1 -0
  216. package/dist/custom/queryParentSaveChain.js +25 -0
  217. package/dist/custom/queryParentSaveChain.js.map +1 -0
  218. package/dist/custom/seededMetadataPush.d.ts +7 -0
  219. package/dist/custom/seededMetadataPush.d.ts.map +1 -0
  220. package/dist/custom/seededMetadataPush.js +23 -0
  221. package/dist/custom/seededMetadataPush.js.map +1 -0
  222. package/dist/index.d.ts +30 -0
  223. package/dist/index.d.ts.map +1 -1
  224. package/dist/index.js +30 -0
  225. package/dist/index.js.map +1 -1
  226. package/dist/tsconfig.tsbuildinfo +1 -1
  227. package/package.json +31 -31
@@ -0,0 +1,73 @@
1
+ import { BaseEntity, ValidationErrorInfo } from '@memberjunction/core';
2
+ import { MJAIAgentRelationshipEntity } from '@memberjunction/core-entities';
3
+ export type AgentRelationalGrantKind = 'Action' | 'Sub-Agent Relationship' | 'Skill' | 'Client Tool' | 'Modality';
4
+ export interface RelationalGrantAgentRow {
5
+ ID: string;
6
+ Name?: string | null;
7
+ BaseAgentID?: string | null;
8
+ ParentID?: string | null;
9
+ Configuration?: string | null;
10
+ Status?: string | null;
11
+ }
12
+ export interface RelationalGrantValidationInput {
13
+ Kind: AgentRelationalGrantKind;
14
+ FieldName: string;
15
+ TargetAgentID: string;
16
+ GrantTargetID: string;
17
+ /** Whether this row grants/enables access (false = veto/disable, which is always allowed). */
18
+ IsActiveGrant: boolean;
19
+ AllAgents: ReadonlyArray<RelationalGrantAgentRow>;
20
+ /** Existing join rows across the ancestor chain (root..parent), already filtered to relevant direction if Modality. */
21
+ AncestorJoinRows: ReadonlyArray<{
22
+ AgentID: string;
23
+ GrantTargetID: string;
24
+ IsActiveGrant: boolean;
25
+ MaxExecutionsPerRun?: number | null;
26
+ MinExecutionsPerRun?: number | null;
27
+ ResultExpirationTurns?: number | null;
28
+ MessageMode?: MJAIAgentRelationshipEntity['MessageMode'] | null;
29
+ MaxMessages?: number | null;
30
+ SubAgentContextPaths?: string | null;
31
+ MaxSizeBytes?: number | null;
32
+ MaxCountPerMessage?: number | null;
33
+ }>;
34
+ /** Optional per-item bounds on the row being saved (validated against inherited bounds). */
35
+ TargetBounds?: {
36
+ MaxExecutionsPerRun?: number | null;
37
+ MinExecutionsPerRun?: number | null;
38
+ ResultExpirationTurns?: number | null;
39
+ MessageMode?: MJAIAgentRelationshipEntity['MessageMode'] | null;
40
+ MaxMessages?: number | null;
41
+ SubAgentContextPaths?: string | null;
42
+ MaxSizeBytes?: number | null;
43
+ MaxCountPerMessage?: number | null;
44
+ };
45
+ }
46
+ /**
47
+ * Pure validation core enforcing that derived agents (`BaseAgentID != null`) whose
48
+ * `Configuration.allowWidenFromBase !== true` CANNOT attach net-new active relational grants
49
+ * (`Actions`, `Relationships`, `Skills`, `ClientTools`, `Modalities`) or loosen inherited
50
+ * per-grant ceilings. Vetoes (`IsActiveGrant === false`) are always permitted.
51
+ */
52
+ export declare function ValidateDerivedAgentRelationalGrant(input: RelationalGrantValidationInput): ValidationErrorInfo[];
53
+ /**
54
+ * Returns true when `entity` has a live `IRunViewProvider` (always true in production MJServer;
55
+ * false in lightweight unit-test mocks that only stub `ProviderToUse.GetEntityObject`).
56
+ */
57
+ export declare function HasRelationalGrantGuardProvider(entity: BaseEntity): boolean;
58
+ /**
59
+ * Live DB loader + validator invoked from the 5 `MJAIAgent*EntityServer.ValidateAsync()` hooks.
60
+ * Short-circuits immediately (zero extra queries) for vetoes (`!isActiveGrant`) or when the target
61
+ * agent is a root agent (`BaseAgentID == null`) or opts into `Configuration.allowWidenFromBase === true`.
62
+ */
63
+ export declare function ValidateDerivedAgentRelationalGrantLive(entity: BaseEntity, args: {
64
+ Kind: AgentRelationalGrantKind;
65
+ EntityName: 'MJ: AI Agent Actions' | 'MJ: AI Agent Relationships' | 'MJ: AI Agent Skills' | 'MJ: AI Agent Client Tools' | 'MJ: AI Agent Modalities';
66
+ FieldName: string;
67
+ AgentID: string | null | undefined;
68
+ GrantTargetID: string | null | undefined;
69
+ IsActiveGrant: boolean;
70
+ ModalityDirection?: 'Input' | 'Output';
71
+ TargetBounds?: RelationalGrantValidationInput['TargetBounds'];
72
+ }): Promise<ValidationErrorInfo[]>;
73
+ //# sourceMappingURL=agentRelationalGrantGuard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentRelationalGrantGuard.d.ts","sourceRoot":"","sources":["../../src/custom/agentRelationalGrantGuard.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,UAAU,EAGV,mBAAmB,EAEtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAKH,2BAA2B,EAE9B,MAAM,+BAA+B,CAAC;AASvC,MAAM,MAAM,wBAAwB,GAC9B,QAAQ,GACR,wBAAwB,GACxB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enFromBase, IsPayloadPathSetWithinAncestor, MAX_AGENT_INHERITANCE_DEPTH, } from '@memberjunction/ai-core-plus';
3
+ import { EscapeSQLString, IndexByUUID, NormalizeUUID, UUIDsEqual, UUIDSet } from '@memberjunction/global';
4
+ function parseJsonStringArray(raw) {
5
+ if (!raw || raw.trim().length === 0) {
6
+ return null;
7
+ }
8
+ try {
9
+ const parsed = JSON.parse(raw);
10
+ if (Array.isArray(parsed) && parsed.every((item) => typeof item === 'string')) {
11
+ return parsed;
12
+ }
13
+ }
14
+ catch {
15
+ return null;
16
+ }
17
+ return null;
18
+ }
19
+ /**
20
+ * Pure validation core enforcing that derived agents (`BaseAgentID != null`) whose
21
+ * `Configuration.allowWidenFromBase !== true` CANNOT attach net-new active relational grants
22
+ * (`Actions`, `Relationships`, `Skills`, `ClientTools`, `Modalities`) or loosen inherited
23
+ * per-grant ceilings. Vetoes (`IsActiveGrant === false`) are always permitted.
24
+ */
25
+ export function ValidateDerivedAgentRelationalGrant(input) {
26
+ if (!input.IsActiveGrant) {
27
+ return [];
28
+ }
29
+ if (!input.TargetAgentID || !input.GrantTargetID) {
30
+ return [];
31
+ }
32
+ const agentsById = IndexByUUID(input.AllAgents);
33
+ const targetAgent = agentsById.Get(input.TargetAgentID);
34
+ if (!targetAgent || !targetAgent.BaseAgentID) {
35
+ return [];
36
+ }
37
+ if (DoesAgentAllowWidenFromBase(targetAgent.Configuration)) {
38
+ return [];
39
+ }
40
+ // Walk ancestor chain (root -> immediate baseAgent)
41
+ const ancestorsBottomUp = [];
42
+ const visited = new UUIDSet([targetAgent.ID]);
43
+ let cursorId = targetAgent.BaseAgentID;
44
+ let hops = 0;
45
+ while (cursorId && hops < MAX_AGENT_INHERITANCE_DEPTH) {
46
+ if (visited.Has(cursorId)) {
47
+ break;
48
+ }
49
+ visited.Add(cursorId);
50
+ const parent = agentsById.Get(cursorId);
51
+ if (!parent) {
52
+ break;
53
+ }
54
+ ancestorsBottomUp.push(parent);
55
+ cursorId = parent.BaseAgentID;
56
+ hops++;
57
+ }
58
+ if (ancestorsBottomUp.length === 0) {
59
+ return [];
60
+ }
61
+ const ancestors = ancestorsBottomUp.reverse();
62
+ const baseName = ancestors[ancestors.length - 1].Name ?? targetAgent.BaseAgentID;
63
+ const agentName = targetAgent.Name ?? targetAgent.ID;
64
+ // Fold effective inherited grants across ancestors (root -> baseAgent) using rebase-aware rules
65
+ const rowsByAgent = new Map();
66
+ for (const row of input.AncestorJoinRows) {
67
+ const key = NormalizeUUID(row.AgentID);
68
+ const list = rowsByAgent.get(key) ?? [];
69
+ list.push(row);
70
+ rowsByAgent.set(key, list);
71
+ }
72
+ const effectiveMap = new Map();
73
+ const minNullable = (a, b) => {
74
+ if (typeof b !== 'number' || !Number.isFinite(b))
75
+ return a;
76
+ return a === null ? b : Math.min(a, b);
77
+ };
78
+ const maxNullable = (a, b) => {
79
+ if (typeof b !== 'number' || !Number.isFinite(b))
80
+ return a;
81
+ return a === null ? b : Math.max(a, b);
82
+ };
83
+ for (let idx = 0; idx < ancestors.length; idx++) {
84
+ const anc = ancestors[idx];
85
+ const isRoot = idx === 0;
86
+ const canWiden = idx > 0 && DoesAgentAllowWidenFromBase(anc.Configuration);
87
+ // For Sub-Agent Relationship, include structural ParentID children of ancestor
88
+ if (input.Kind === 'Sub-Agent Relationship' && (isRoot || canWiden)) {
89
+ for (const candidate of input.AllAgents) {
90
+ if (candidate.ParentID && UUIDsEqual(candidate.ParentID, anc.ID)) {
91
+ const normId = NormalizeUUID(candidate.ID);
92
+ if (!effectiveMap.has(normId)) {
93
+ effectiveMap.set(normId, {
94
+ MaxExecutionsPerRun: null,
95
+ MinExecutionsPerRun: null,
96
+ ResultExpirationTurns: null,
97
+ MessageMode: null,
98
+ MaxMessages: null,
99
+ SubAgentContextPaths: null,
100
+ MaxSizeBytes: null,
101
+ MaxCountPerMessage: null,
102
+ });
103
+ }
104
+ }
105
+ }
106
+ }
107
+ const rows = rowsByAgent.get(NormalizeUUID(anc.ID)) ?? [];
108
+ for (const row of rows) {
109
+ const normGrantId = NormalizeUUID(row.GrantTargetID);
110
+ if (!row.IsActiveGrant) {
111
+ effectiveMap.delete(normGrantId);
112
+ continue;
113
+ }
114
+ const prev = effectiveMap.get(normGrantId);
115
+ if (!prev) {
116
+ if (isRoot || canWiden) {
117
+ effectiveMap.set(normGrantId, {
118
+ MaxExecutionsPerRun: row.MaxExecutionsPerRun ?? null,
119
+ MinExecutionsPerRun: row.MinExecutionsPerRun ?? null,
120
+ ResultExpirationTurns: row.ResultExpirationTurns ?? null,
121
+ MessageMode: row.MessageMode ?? null,
122
+ MaxMessages: row.MaxMessages ?? null,
123
+ SubAgentContextPaths: parseJsonStringArray(row.SubAgentContextPaths),
124
+ MaxSizeBytes: row.MaxSizeBytes ?? null,
125
+ MaxCountPerMessage: row.MaxCountPerMessage ?? null,
126
+ });
127
+ }
128
+ continue;
129
+ }
130
+ if (canWiden) {
131
+ effectiveMap.set(normGrantId, {
132
+ MaxExecutionsPerRun: row.MaxExecutionsPerRun ?? prev.MaxExecutionsPerRun,
133
+ MinExecutionsPerRun: row.MinExecutionsPerRun ?? prev.MinExecutionsPerRun,
134
+ ResultExpirationTurns: row.ResultExpirationTurns ?? prev.ResultExpirationTurns,
135
+ MessageMode: row.MessageMode ?? prev.MessageMode,
136
+ MaxMessages: row.MaxMessages ?? prev.MaxMessages,
137
+ SubAgentContextPaths: parseJsonStringArray(row.SubAgentContextPaths) ?? prev.SubAgentContextPaths,
138
+ MaxSizeBytes: row.MaxSizeBytes ?? prev.MaxSizeBytes,
139
+ MaxCountPerMessage: row.MaxCountPerMessage ?? prev.MaxCountPerMessage,
140
+ });
141
+ }
142
+ else {
143
+ const nextMode = row.MessageMode ?? null;
144
+ const narrowedMode = prev.MessageMode != null && nextMode != null
145
+ ? AGENT_MESSAGE_MODE_RANK[nextMode] < AGENT_MESSAGE_MODE_RANK[prev.MessageMode]
146
+ ? nextMode
147
+ : prev.MessageMode
148
+ : nextMode ?? prev.MessageMode;
149
+ effectiveMap.set(normGrantId, {
150
+ MaxExecutionsPerRun: minNullable(prev.MaxExecutionsPerRun, row.MaxExecutionsPerRun),
151
+ MinExecutionsPerRun: maxNullable(prev.MinExecutionsPerRun, row.MinExecutionsPerRun),
152
+ ResultExpirationTurns: minNullable(prev.ResultExpirationTurns, row.ResultExpirationTurns),
153
+ MessageMode: narrowedMode,
154
+ MaxMessages: minNullable(prev.MaxMessages, row.MaxMessages),
155
+ SubAgentContextPaths: parseJsonStringArray(row.SubAgentContextPaths) ?? prev.SubAgentContextPaths,
156
+ MaxSizeBytes: minNullable(prev.MaxSizeBytes, row.MaxSizeBytes),
157
+ MaxCountPerMessage: minNullable(prev.MaxCountPerMessage, row.MaxCountPerMessage),
158
+ });
159
+ }
160
+ }
161
+ }
162
+ const normTargetGrant = NormalizeUUID(input.GrantTargetID);
163
+ const inherited = effectiveMap.get(normTargetGrant);
164
+ if (!inherited) {
165
+ return [
166
+ new ValidationErrorInfo(input.FieldName, `Derived agent '${agentName}' cannot add net-new ${input.Kind} grant '${input.GrantTargetID}' not inherited from base agent '${baseName}'. Set Configuration.allowWidenFromBase = true (Admin only) if intentional.`, input.GrantTargetID, ValidationErrorType.Failure),
167
+ ];
168
+ }
169
+ const errors = [];
170
+ const bounds = input.TargetBounds;
171
+ if (bounds) {
172
+ if (inherited.MaxExecutionsPerRun !== null &&
173
+ typeof bounds.MaxExecutionsPerRun === 'number' &&
174
+ bounds.MaxExecutionsPerRun > inherited.MaxExecutionsPerRun) {
175
+ errors.push(new ValidationErrorInfo('MaxExecutionsPerRun', `Derived agent cannot widen MaxExecutionsPerRun (${bounds.MaxExecutionsPerRun}) beyond base agent '${baseName}' (${inherited.MaxExecutionsPerRun}). Set Configuration.allowWidenFromBase = true (Admin only) if intentional.`, bounds.MaxExecutionsPerRun, ValidationErrorType.Failure));
176
+ }
177
+ if (inherited.MinExecutionsPerRun !== null &&
178
+ typeof bounds.MinExecutionsPerRun === 'number' &&
179
+ bounds.MinExecutionsPerRun < inherited.MinExecutionsPerRun) {
180
+ errors.push(new ValidationErrorInfo('MinExecutionsPerRun', `Derived agent cannot lower MinExecutionsPerRun (${bounds.MinExecutionsPerRun}) below base agent '${baseName}' (${inherited.MinExecutionsPerRun}). Set Configuration.allowWidenFromBase = true (Admin only) if intentional.`, bounds.MinExecutionsPerRun, ValidationErrorType.Failure));
181
+ }
182
+ if (inherited.ResultExpirationTurns !== null &&
183
+ typeof bounds.ResultExpirationTurns === 'number' &&
184
+ bounds.ResultExpirationTurns > inherited.ResultExpirationTurns) {
185
+ errors.push(new ValidationErrorInfo('ResultExpirationTurns', `Derived agent cannot widen ResultExpirationTurns (${bounds.ResultExpirationTurns}) beyond base agent '${baseName}' (${inherited.ResultExpirationTurns}). Set Configuration.allowWidenFromBase = true (Admin only) if intentional.`, bounds.ResultExpirationTurns, ValidationErrorType.Failure));
186
+ }
187
+ if (inherited.MessageMode != null &&
188
+ bounds.MessageMode != null &&
189
+ AGENT_MESSAGE_MODE_RANK[bounds.MessageMode] > AGENT_MESSAGE_MODE_RANK[inherited.MessageMode]) {
190
+ errors.push(new ValidationErrorInfo('MessageMode', `Derived agent cannot widen MessageMode ('${bounds.MessageMode}') beyond base agent '${baseName}' ('${inherited.MessageMode}'). Set Configuration.allowWidenFromBase = true (Admin only) if intentional.`, bounds.MessageMode, ValidationErrorType.Failure));
191
+ }
192
+ if (inherited.MaxMessages !== null &&
193
+ typeof bounds.MaxMessages === 'number' &&
194
+ bounds.MaxMessages > inherited.MaxMessages) {
195
+ errors.push(new ValidationErrorInfo('MaxMessages', `Derived agent cannot widen MaxMessages (${bounds.MaxMessages}) beyond base agent '${baseName}' (${inherited.MaxMessages}). Set Configuration.allowWidenFromBase = true (Admin only) if intentional.`, bounds.MaxMessages, ValidationErrorType.Failure));
196
+ }
197
+ if (inherited.SubAgentContextPaths !== null && bounds.SubAgentContextPaths != null) {
198
+ const childPaths = parseJsonStringArray(bounds.SubAgentContextPaths);
199
+ if (!IsPayloadPathSetWithinAncestor(inherited.SubAgentContextPaths, childPaths)) {
200
+ errors.push(new ValidationErrorInfo('SubAgentContextPaths', `Derived agent cannot widen SubAgentContextPaths beyond base agent '${baseName}'. Set Configuration.allowWidenFromBase = true (Admin only) if intentional.`, bounds.SubAgentContextPaths, ValidationErrorType.Failure));
201
+ }
202
+ }
203
+ if (inherited.MaxSizeBytes !== null &&
204
+ typeof bounds.MaxSizeBytes === 'number' &&
205
+ bounds.MaxSizeBytes > inherited.MaxSizeBytes) {
206
+ errors.push(new ValidationErrorInfo('MaxSizeBytes', `Derived agent cannot widen MaxSizeBytes (${bounds.MaxSizeBytes}) beyond base agent '${baseName}' (${inherited.MaxSizeBytes}). Set Configuration.allowWidenFromBase = true (Admin only) if intentional.`, bounds.MaxSizeBytes, ValidationErrorType.Failure));
207
+ }
208
+ if (inherited.MaxCountPerMessage !== null &&
209
+ typeof bounds.MaxCountPerMessage === 'number' &&
210
+ bounds.MaxCountPerMessage > inherited.MaxCountPerMessage) {
211
+ errors.push(new ValidationErrorInfo('MaxCountPerMessage', `Derived agent cannot widen MaxCountPerMessage (${bounds.MaxCountPerMessage}) beyond base agent '${baseName}' (${inherited.MaxCountPerMessage}). Set Configuration.allowWidenFromBase = true (Admin only) if intentional.`, bounds.MaxCountPerMessage, ValidationErrorType.Failure));
212
+ }
213
+ }
214
+ return errors;
215
+ }
216
+ /**
217
+ * Returns true when `entity` has a live `IRunViewProvider` (always true in production MJServer;
218
+ * false in lightweight unit-test mocks that only stub `ProviderToUse.GetEntityObject`).
219
+ */
220
+ export function HasRelationalGrantGuardProvider(entity) {
221
+ const rvProvider = entity.RunViewProviderToUse;
222
+ return Boolean(rvProvider && typeof rvProvider.RunView === 'function');
223
+ }
224
+ /**
225
+ * Live DB loader + validator invoked from the 5 `MJAIAgent*EntityServer.ValidateAsync()` hooks.
226
+ * Short-circuits immediately (zero extra queries) for vetoes (`!isActiveGrant`) or when the target
227
+ * agent is a root agent (`BaseAgentID == null`) or opts into `Configuration.allowWidenFromBase === true`.
228
+ */
229
+ export async function ValidateDerivedAgentRelationalGrantLive(entity, args) {
230
+ if (!args.IsActiveGrant || !args.AgentID || !args.GrantTargetID) {
231
+ return [];
232
+ }
233
+ const rvProvider = entity.RunViewProviderToUse;
234
+ if (!rvProvider || typeof rvProvider.RunView !== 'function') {
235
+ return [];
236
+ }
237
+ const rv = new RunView(rvProvider);
238
+ const mdProvider = entity.ProviderToUse;
239
+ const agentEntityInfo = mdProvider?.EntityByName?.('MJ: AI Agents');
240
+ const requestedAgentFields = ['ID', 'Name', 'BaseAgentID', 'ParentID', 'Configuration', 'Status'];
241
+ const agentFields = agentEntityInfo
242
+ ? requestedAgentFields.filter((f) => Boolean(agentEntityInfo.FieldByName(f)))
243
+ : requestedAgentFields;
244
+ // Fast path: load the target agent first; root agents and allowWidenFromBase agents return immediately
245
+ const targetRes = await rv.RunView({
246
+ EntityName: 'MJ: AI Agents',
247
+ ExtraFilter: `ID='${EscapeSQLString(args.AgentID)}'`,
248
+ Fields: agentFields,
249
+ ResultType: 'simple',
250
+ }, entity.ContextCurrentUser);
251
+ if (!targetRes.Success || targetRes.Results.length === 0) {
252
+ return [];
253
+ }
254
+ const targetRow = targetRes.Results[0];
255
+ if (!targetRow.BaseAgentID || DoesAgentAllowWidenFromBase(targetRow.Configuration)) {
256
+ return [];
257
+ }
258
+ // Load all agents to trace ancestors (and structural ParentID children for Relationships)
259
+ const allAgentsRes = await rv.RunView({
260
+ EntityName: 'MJ: AI Agents',
261
+ Fields: agentFields,
262
+ ResultType: 'simple',
263
+ }, entity.ContextCurrentUser);
264
+ if (!allAgentsRes.Success) {
265
+ return [
266
+ new ValidationErrorInfo(args.FieldName, `Fail-closed: unable to verify ${args.Kind} inheritance bounds (${allAgentsRes.ErrorMessage ?? 'query failed'}).`, args.GrantTargetID, ValidationErrorType.Failure),
267
+ ];
268
+ }
269
+ // Collect ancestor IDs to query join rows cleanly
270
+ const agentsById = IndexByUUID(allAgentsRes.Results);
271
+ const ancestorIds = [];
272
+ const seen = new UUIDSet([targetRow.ID]);
273
+ let curId = targetRow.BaseAgentID;
274
+ let hops = 0;
275
+ while (curId && hops < MAX_AGENT_INHERITANCE_DEPTH) {
276
+ if (seen.Has(curId))
277
+ break;
278
+ seen.Add(curId);
279
+ const p = agentsById.Get(curId);
280
+ if (!p)
281
+ break;
282
+ ancestorIds.push(p.ID);
283
+ curId = p.BaseAgentID;
284
+ hops++;
285
+ }
286
+ if (ancestorIds.length === 0) {
287
+ return [];
288
+ }
289
+ const inClause = ancestorIds.map((id) => `'${EscapeSQLString(id)}'`).join(',');
290
+ const directionFilter = args.EntityName === 'MJ: AI Agent Modalities' && args.ModalityDirection
291
+ ? ` AND Direction='${EscapeSQLString(args.ModalityDirection)}'`
292
+ : '';
293
+ const joinRes = await rv.RunView({
294
+ EntityName: args.EntityName,
295
+ ExtraFilter: `AgentID IN (${inClause})${directionFilter}`,
296
+ ResultType: 'simple',
297
+ }, entity.ContextCurrentUser);
298
+ if (!joinRes.Success) {
299
+ return [
300
+ new ValidationErrorInfo(args.FieldName, `Fail-closed: unable to verify ancestor ${args.Kind} grants (${joinRes.ErrorMessage ?? 'query failed'}).`, args.GrantTargetID, ValidationErrorType.Failure),
301
+ ];
302
+ }
303
+ const ancestorJoinRows = [];
304
+ for (const raw of joinRes.Results) {
305
+ if (args.EntityName === 'MJ: AI Agent Actions') {
306
+ const row = raw;
307
+ if (!row.AgentID || !row.ActionID)
308
+ continue;
309
+ ancestorJoinRows.push({
310
+ AgentID: row.AgentID,
311
+ GrantTargetID: row.ActionID,
312
+ IsActiveGrant: row.Status === 'Active',
313
+ MaxExecutionsPerRun: row.MaxExecutionsPerRun,
314
+ MinExecutionsPerRun: row.MinExecutionsPerRun,
315
+ ResultExpirationTurns: row.ResultExpirationTurns,
316
+ });
317
+ }
318
+ else if (args.EntityName === 'MJ: AI Agent Relationships') {
319
+ const row = raw;
320
+ if (!row.AgentID || !row.SubAgentID)
321
+ continue;
322
+ ancestorJoinRows.push({
323
+ AgentID: row.AgentID,
324
+ GrantTargetID: row.SubAgentID,
325
+ IsActiveGrant: row.Status === 'Active',
326
+ MessageMode: row.MessageMode,
327
+ MaxMessages: row.MaxMessages,
328
+ SubAgentContextPaths: row.SubAgentContextPaths,
329
+ });
330
+ }
331
+ else if (args.EntityName === 'MJ: AI Agent Skills') {
332
+ const row = raw;
333
+ if (!row.AgentID || !row.SkillID)
334
+ continue;
335
+ ancestorJoinRows.push({
336
+ AgentID: row.AgentID,
337
+ GrantTargetID: row.SkillID,
338
+ IsActiveGrant: row.Status === 'Active',
339
+ });
340
+ }
341
+ else if (args.EntityName === 'MJ: AI Agent Client Tools') {
342
+ const row = raw;
343
+ if (!row.AgentID || !row.ClientToolDefinitionID)
344
+ continue;
345
+ ancestorJoinRows.push({
346
+ AgentID: row.AgentID,
347
+ GrantTargetID: row.ClientToolDefinitionID,
348
+ IsActiveGrant: true,
349
+ });
350
+ }
351
+ else if (args.EntityName === 'MJ: AI Agent Modalities') {
352
+ const row = raw;
353
+ if (!row.AgentID || !row.ModalityID)
354
+ continue;
355
+ ancestorJoinRows.push({
356
+ AgentID: row.AgentID,
357
+ GrantTargetID: row.ModalityID,
358
+ IsActiveGrant: row.IsAllowed !== false,
359
+ MaxSizeBytes: row.MaxSizeBytes,
360
+ MaxCountPerMessage: row.MaxCountPerMessage,
361
+ });
362
+ }
363
+ }
364
+ return ValidateDerivedAgentRelationalGrant({
365
+ Kind: args.Kind,
366
+ FieldName: args.FieldName,
367
+ TargetAgentID: args.AgentID,
368
+ GrantTargetID: args.GrantTargetID,
369
+ IsActiveGrant: args.IsActiveGrant,
370
+ AllAgents: allAgentsRes.Results,
371
+ AncestorJoinRows: ancestorJoinRows,
372
+ TargetBounds: args.TargetBounds,
373
+ });
374
+ }
375
+ //# sourceMappingURL=agentRelationalGrantGuard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentRelationalGrantGuard.js","sourceRoot":"","sources":["../../src/custom/agentRelationalGrantGuard.ts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record's status to Approved records the context
5
5
  * user as the approver, the time, and — once the definition is stored — the fingerprint of that
6
6
  * definition (`approvals.ts` in `@memberjunction/core-entities`). Values a client sends for those
7
- * three columns are never stored. Who may approve is whoever may update the record today.
7
+ * three columns are never stored. Who may approve is whoever may update the record, unless the
8
+ * caller passes an {@link ApproverRule} that narrows it (queries need the `Queries: Approve`
9
+ * authorization).
8
10
  */
9
- import { BaseEntity, BaseEntityResult } from '@memberjunction/core';
11
+ import { BaseEntity, BaseEntityResult, EntitySaveOptions } from '@memberjunction/core';
12
+ import type { UserInfo } from '@memberjunction/core';
10
13
  /** The approval columns every approvable entity carries. */
11
14
  export interface ApprovalColumns {
12
15
  ApprovedByUserID: string | null;
13
16
  ApprovedAt: Date | null;
14
17
  ApprovedFingerprint: string | null;
15
18
  }
19
+ /**
20
+ * Who may approve, when that is narrower than whoever may update the record: a check of the
21
+ * approving user, and the refusal a save gets when the check fails.
22
+ */
23
+ export interface ApproverRule {
24
+ CanApprove: (user: UserInfo) => boolean;
25
+ Refusal: string;
26
+ }
16
27
  /** The status column that carries the approval: `Status` on queries, `ApprovalStatus` on the others. */
17
28
  export type ApprovalStatusField = 'Status' | 'ApprovalStatus';
29
+ /** The stored approval, as the database holds it. */
30
+ export type StoredApprovalRow = Partial<Record<ApprovalStatusField, string | null>> & {
31
+ ApprovedByUserID: string | null;
32
+ ApprovedAt: Date | string | null;
33
+ ApprovedFingerprint: string | null;
34
+ };
35
+ /**
36
+ * D55 / Finding 62: options allowing {@link ApplyApprovalRulesAsync} to detect a non-approving
37
+ * definition edit against a stored `Approved` row lacking an `ApprovedFingerprint`, and record the
38
+ * pre-write stored definition's marked fingerprint before the edit is persisted so the edited row
39
+ * evaluates `Stale`.
40
+ */
41
+ export interface PreEditFingerprintOptions<TStored extends StoredApprovalRow = StoredApprovalRow> {
42
+ /** Extra definition/deriving columns to read alongside the approval columns from the database. */
43
+ readonly StoredFields: ReadonlyArray<Extract<keyof TStored, string>>;
44
+ /** True when the save changes or will derive/mutate any definition field compared to `stored`. */
45
+ readonly HasDefinitionChange: (stored: TStored) => boolean;
46
+ /** Computes the fingerprint of the pre-write stored definition from `stored` (and any child rows). */
47
+ readonly ComputeStoredFingerprint: (stored: TStored) => Promise<string>;
48
+ }
18
49
  /**
19
50
  * Applies the approval rules to a record about to be saved, and says whether this save approves it.
20
51
  *
@@ -24,14 +55,63 @@ export type ApprovalStatusField = 'Status' | 'ApprovalStatus';
24
55
  * - On any other save the three columns keep their stored values (none on a create), so values a
25
56
  * client sent are ignored. Moving away from Approved clears nothing: the approval stays as history
26
57
  * and stops being current because the status is no longer Approved.
58
+ * - Finding 62 (D55): on a non-approving save that changes a definition field of an `Approved`
59
+ * stored row with no fingerprint on record, first computes the marked fingerprint of the stored
60
+ * pre-write definition read from the database so the edited row evaluates `Stale`. Not inside a
61
+ * metadata push (`IsMetadataPushInProgress`): pushed content is seeded, not edited.
62
+ * - Finding 70: the stored row is read as the system user, and a row missing a requested column
63
+ * (field security drops denied columns silently) refuses the save instead of reading as "none".
27
64
  *
28
65
  * The stored values are read from the database rather than the record's old values, which a client
29
66
  * can supply on an update.
30
67
  *
68
+ * - With an `approverRule`, a save that would approve is refused unless the context user passes it.
69
+ * Only approving is checked: saving a draft, or editing a record already Approved, is left to the
70
+ * role permissions.
71
+ *
31
72
  * @returns true when this save approves the record
32
- * @throws when the stored row cannot be read, or when approving with no context user
73
+ * @throws when the stored row cannot be read, when approving with no context user, or when the
74
+ * context user fails the `approverRule`
75
+ */
76
+ export declare function ApplyApprovalRulesAsync<TStored extends StoredApprovalRow = StoredApprovalRow>(record: BaseEntity & ApprovalColumns, statusField: ApprovalStatusField, newStatus: string | null, approverRule?: ApproverRule, preEditOptions?: PreEditFingerprintOptions<TStored>): Promise<boolean>;
77
+ /**
78
+ * D55: records the fingerprint of an item that is Approved with none on record, taking the definition
79
+ * as it is stored now as the approved one and marking the value as recorded after the fact.
80
+ *
81
+ * Only for an unedited, stored row, and only inside {@link CANON_RECORD_APPROVED_FINGERPRINT_OPERATION}
82
+ * (a client save never reaches it). The stored row is read again first, so an item approved since, or
83
+ * recorded by another evaluation, is left alone. The approver and the approval time are not touched,
84
+ * so the write is not a new approval. `computeFingerprint` works from the record's stored definition;
85
+ * `writeRow` writes the row without the server class's own approval rules, with the options given.
86
+ *
87
+ * Finding 74: the write is conditional. Between the read and the write, a client's child edit can
88
+ * record the pre-edit fingerprint and then change the definition this computation reads. The save
89
+ * therefore runs the provider's locked concurrency check against a baseline of "no fingerprint"
90
+ * (`RecordedFingerprintWriteOptions`): it reads the stored `ApprovedFingerprint` under the save's own
91
+ * row lock and refuses the write when one is on record by then, so a recorded value is never replaced.
92
+ *
93
+ * @returns true when the fingerprint was written
94
+ */
95
+ export declare function RecordMissingApprovedFingerprintAsync(record: BaseEntity & ApprovalColumns, statusField: ApprovalStatusField, computeFingerprint: () => Promise<string>, writeRow: (options: EntitySaveOptions) => Promise<boolean>): Promise<boolean>;
96
+ /**
97
+ * Save options for the D55 recording write (Finding 74): the provider's locked concurrency check in
98
+ * `'enforce'` mode, with the baseline that no fingerprint is on record. The save reads the stored
99
+ * `ApprovedFingerprint` under its own row lock and is refused when a fingerprint was recorded after
100
+ * this recording read the row.
101
+ */
102
+ export declare function RecordedFingerprintWriteOptions(): EntitySaveOptions;
103
+ /** A failed save (or delete) result for an operation refused before anything was written. */
104
+ export declare function ApprovalRefusalResult(record: BaseEntity, error: unknown, type?: BaseEntityResult['Type']): BaseEntityResult;
105
+ /**
106
+ * The user a stored approval or definition row is read as: the system user, so field security never
107
+ * narrows the row (Finding 70); the given user only when no system user is loaded, in which case
108
+ * {@link AssertStoredColumnsPresent} refuses a narrowed row.
109
+ */
110
+ export declare function StoredRowReadUser(fallback: UserInfo | undefined): UserInfo | undefined;
111
+ /**
112
+ * Throws when a stored row read with a field list lacks one of the requested columns. Field security
113
+ * drops a denied column from the row silently, and a missing `ApprovedFingerprint` would then read as
114
+ * "none on record" (Finding 70): a row that could not be read in full is never taken as read.
33
115
  */
34
- export declare function ApplyApprovalRulesAsync(record: BaseEntity & ApprovalColumns, statusField: ApprovalStatusField, newStatus: string | null): Promise<boolean>;
35
- /** A failed save result for a save refused before anything was written. */
36
- export declare function ApprovalRefusalResult(record: BaseEntity, error: unknown): BaseEntityResult;
116
+ export declare function AssertStoredColumnsPresent(row: object, fields: ReadonlyArray<string>, what: string): void;
37
117
  //# sourceMappingURL=approvalStamp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"approvalStamp.d.ts","sourceRoot":"","sources":["../../src/custom/approvalStamp.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAEpE,4DAA4D;AAC5D,MAAM,WAAW,eAAe;IAC5B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC;AAED,wGAAwG;AACxG,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,gBAAgB,CAAC;AAS9D;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,uBAAuB,CACzC,MAAM,EAAE,UAAU,GAAG,eAAe,EACpC,WAAW,EAAE,mBAAmB,EAChC,SAAS,EAAE,MAAM,GAAG,IAAI,GACzB,OAAO,CAAC,OAAO,CAAC,CAgBlB;AAED,2EAA2E;AAC3E,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAQ1F"}
1
+ {"version":3,"file":"approvalStamp.d.ts","sourceRoot":"","sources":["../../src/custom/approvalStamp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,iBAAiB,EAA+B,MAAM,sBAAsB,CAAC;AACpH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CA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