@memberjunction/core-entities-server 6.3.0-edge.2 → 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 (171) hide show
  1. package/README.md +13 -0
  2. package/dist/custom/ArtifactSecurityHookHelpers.d.ts.map +1 -1
  3. package/dist/custom/ArtifactSecurityHookHelpers.js +50 -0
  4. package/dist/custom/ArtifactSecurityHookHelpers.js.map +1 -1
  5. package/dist/custom/GraphConceptReadSecurityHook.d.ts +75 -0
  6. package/dist/custom/GraphConceptReadSecurityHook.d.ts.map +1 -0
  7. package/dist/custom/GraphConceptReadSecurityHook.js +574 -0
  8. package/dist/custom/GraphConceptReadSecurityHook.js.map +1 -0
  9. package/dist/custom/GraphRecordChangesReadSecurityHook.d.ts +45 -0
  10. package/dist/custom/GraphRecordChangesReadSecurityHook.d.ts.map +1 -0
  11. package/dist/custom/GraphRecordChangesReadSecurityHook.js +744 -0
  12. package/dist/custom/GraphRecordChangesReadSecurityHook.js.map +1 -0
  13. package/dist/custom/MJAIAgentActionEntityServer.server.d.ts +13 -0
  14. package/dist/custom/MJAIAgentActionEntityServer.server.d.ts.map +1 -0
  15. package/dist/custom/MJAIAgentActionEntityServer.server.js +52 -0
  16. package/dist/custom/MJAIAgentActionEntityServer.server.js.map +1 -0
  17. package/dist/custom/MJAIAgentCategoryEntityServer.server.d.ts +30 -0
  18. package/dist/custom/MJAIAgentCategoryEntityServer.server.d.ts.map +1 -0
  19. package/dist/custom/MJAIAgentCategoryEntityServer.server.js +127 -0
  20. package/dist/custom/MJAIAgentCategoryEntityServer.server.js.map +1 -0
  21. package/dist/custom/MJAIAgentClientToolEntityServer.server.d.ts +12 -0
  22. package/dist/custom/MJAIAgentClientToolEntityServer.server.d.ts.map +1 -0
  23. package/dist/custom/MJAIAgentClientToolEntityServer.server.js +46 -0
  24. package/dist/custom/MJAIAgentClientToolEntityServer.server.js.map +1 -0
  25. package/dist/custom/MJAIAgentEntityServer.server.d.ts +113 -7
  26. package/dist/custom/MJAIAgentEntityServer.server.d.ts.map +1 -1
  27. package/dist/custom/MJAIAgentEntityServer.server.js +1946 -96
  28. package/dist/custom/MJAIAgentEntityServer.server.js.map +1 -1
  29. package/dist/custom/MJAIAgentModalityEntityServer.server.d.ts +13 -0
  30. package/dist/custom/MJAIAgentModalityEntityServer.server.d.ts.map +1 -0
  31. package/dist/custom/MJAIAgentModalityEntityServer.server.js +52 -0
  32. package/dist/custom/MJAIAgentModalityEntityServer.server.js.map +1 -0
  33. package/dist/custom/MJAIAgentNoteEntityServer.server.d.ts +64 -8
  34. package/dist/custom/MJAIAgentNoteEntityServer.server.d.ts.map +1 -1
  35. package/dist/custom/MJAIAgentNoteEntityServer.server.js +263 -9
  36. package/dist/custom/MJAIAgentNoteEntityServer.server.js.map +1 -1
  37. package/dist/custom/MJAIAgentPersonaEntityServer.server.d.ts +2 -2
  38. package/dist/custom/MJAIAgentPersonaEntityServer.server.d.ts.map +1 -1
  39. package/dist/custom/MJAIAgentPersonaEntityServer.server.js +10 -8
  40. package/dist/custom/MJAIAgentPersonaEntityServer.server.js.map +1 -1
  41. package/dist/custom/MJAIAgentRelationshipEntityServer.server.d.ts +5 -2
  42. package/dist/custom/MJAIAgentRelationshipEntityServer.server.d.ts.map +1 -1
  43. package/dist/custom/MJAIAgentRelationshipEntityServer.server.js +25 -2
  44. package/dist/custom/MJAIAgentRelationshipEntityServer.server.js.map +1 -1
  45. package/dist/custom/MJAIAgentSkillEntityServer.server.d.ts +12 -0
  46. package/dist/custom/MJAIAgentSkillEntityServer.server.d.ts.map +1 -0
  47. package/dist/custom/MJAIAgentSkillEntityServer.server.js +46 -0
  48. package/dist/custom/MJAIAgentSkillEntityServer.server.js.map +1 -0
  49. package/dist/custom/MJAIAgentStepTypeEntityServer.server.d.ts +28 -0
  50. package/dist/custom/MJAIAgentStepTypeEntityServer.server.d.ts.map +1 -0
  51. package/dist/custom/MJAIAgentStepTypeEntityServer.server.js +117 -0
  52. package/dist/custom/MJAIAgentStepTypeEntityServer.server.js.map +1 -0
  53. package/dist/custom/MJAIAgentTypeEntityServer.server.d.ts +34 -0
  54. package/dist/custom/MJAIAgentTypeEntityServer.server.d.ts.map +1 -0
  55. package/dist/custom/MJAIAgentTypeEntityServer.server.js +231 -0
  56. package/dist/custom/MJAIAgentTypeEntityServer.server.js.map +1 -0
  57. package/dist/custom/MJActionEntityServer.server.d.ts +37 -0
  58. package/dist/custom/MJActionEntityServer.server.d.ts.map +1 -1
  59. package/dist/custom/MJActionEntityServer.server.js +208 -3
  60. package/dist/custom/MJActionEntityServer.server.js.map +1 -1
  61. package/dist/custom/MJComponentEntityServer.server.d.ts +6 -0
  62. package/dist/custom/MJComponentEntityServer.server.d.ts.map +1 -1
  63. package/dist/custom/MJComponentEntityServer.server.js +20 -2
  64. package/dist/custom/MJComponentEntityServer.server.js.map +1 -1
  65. package/dist/custom/MJContentSourceEntityServer.server.d.ts +28 -0
  66. package/dist/custom/MJContentSourceEntityServer.server.d.ts.map +1 -0
  67. package/dist/custom/MJContentSourceEntityServer.server.js +73 -0
  68. package/dist/custom/MJContentSourceEntityServer.server.js.map +1 -0
  69. package/dist/custom/MJContentSourceTypeEntityServer.server.d.ts +25 -0
  70. package/dist/custom/MJContentSourceTypeEntityServer.server.d.ts.map +1 -0
  71. package/dist/custom/MJContentSourceTypeEntityServer.server.js +73 -0
  72. package/dist/custom/MJContentSourceTypeEntityServer.server.js.map +1 -0
  73. package/dist/custom/MJDashboardEntityServer.server.d.ts +6 -0
  74. package/dist/custom/MJDashboardEntityServer.server.d.ts.map +1 -1
  75. package/dist/custom/MJDashboardEntityServer.server.js +24 -2
  76. package/dist/custom/MJDashboardEntityServer.server.js.map +1 -1
  77. package/dist/custom/MJGraphConceptEntityServer.server.d.ts +175 -23
  78. package/dist/custom/MJGraphConceptEntityServer.server.d.ts.map +1 -1
  79. package/dist/custom/MJGraphConceptEntityServer.server.js +584 -41
  80. package/dist/custom/MJGraphConceptEntityServer.server.js.map +1 -1
  81. package/dist/custom/MJGraphEdgeEntityServer.server.d.ts +38 -11
  82. package/dist/custom/MJGraphEdgeEntityServer.server.d.ts.map +1 -1
  83. package/dist/custom/MJGraphEdgeEntityServer.server.js +249 -39
  84. package/dist/custom/MJGraphEdgeEntityServer.server.js.map +1 -1
  85. package/dist/custom/MJGraphEntityServer.server.d.ts +58 -0
  86. package/dist/custom/MJGraphEntityServer.server.d.ts.map +1 -0
  87. package/dist/custom/MJGraphEntityServer.server.js +357 -0
  88. package/dist/custom/MJGraphEntityServer.server.js.map +1 -0
  89. package/dist/custom/MJGraphLinkEntityServer.server.d.ts +98 -0
  90. package/dist/custom/MJGraphLinkEntityServer.server.d.ts.map +1 -0
  91. package/dist/custom/MJGraphLinkEntityServer.server.js +375 -0
  92. package/dist/custom/MJGraphLinkEntityServer.server.js.map +1 -0
  93. package/dist/custom/MJGraphPermissionEntityServer.server.d.ts +29 -0
  94. package/dist/custom/MJGraphPermissionEntityServer.server.d.ts.map +1 -0
  95. package/dist/custom/MJGraphPermissionEntityServer.server.js +141 -0
  96. package/dist/custom/MJGraphPermissionEntityServer.server.js.map +1 -0
  97. package/dist/custom/MJListDetailEntityServer.server.d.ts +4 -4
  98. package/dist/custom/MJListDetailEntityServer.server.js +4 -4
  99. package/dist/custom/MJListEntityServer.server.d.ts +2 -1
  100. package/dist/custom/MJListEntityServer.server.d.ts.map +1 -1
  101. package/dist/custom/MJListEntityServer.server.js +5 -2
  102. package/dist/custom/MJListEntityServer.server.js.map +1 -1
  103. package/dist/custom/MJQueryEntityServer.server.d.ts +51 -3
  104. package/dist/custom/MJQueryEntityServer.server.d.ts.map +1 -1
  105. package/dist/custom/MJQueryEntityServer.server.js +142 -28
  106. package/dist/custom/MJQueryEntityServer.server.js.map +1 -1
  107. package/dist/custom/MJQueryParameterEntityServer.server.d.ts +37 -0
  108. package/dist/custom/MJQueryParameterEntityServer.server.d.ts.map +1 -0
  109. package/dist/custom/MJQueryParameterEntityServer.server.js +160 -0
  110. package/dist/custom/MJQueryParameterEntityServer.server.js.map +1 -0
  111. package/dist/custom/MJQuerySQLEntityServer.server.d.ts +23 -0
  112. package/dist/custom/MJQuerySQLEntityServer.server.d.ts.map +1 -1
  113. package/dist/custom/MJQuerySQLEntityServer.server.js +106 -9
  114. package/dist/custom/MJQuerySQLEntityServer.server.js.map +1 -1
  115. package/dist/custom/MJRowLevelSecurityFilterEntityServer.server.d.ts +1 -1
  116. package/dist/custom/MJRowLevelSecurityFilterEntityServer.server.d.ts.map +1 -1
  117. package/dist/custom/MJRowLevelSecurityFilterEntityServer.server.js +8 -5
  118. package/dist/custom/MJRowLevelSecurityFilterEntityServer.server.js.map +1 -1
  119. package/dist/custom/MJUserRoleEntityServer.server.d.ts.map +1 -1
  120. package/dist/custom/MJUserRoleEntityServer.server.js +9 -0
  121. package/dist/custom/MJUserRoleEntityServer.server.js.map +1 -1
  122. package/dist/custom/MJUserViewEntityServer.server.d.ts +9 -0
  123. package/dist/custom/MJUserViewEntityServer.server.d.ts.map +1 -1
  124. package/dist/custom/MJUserViewEntityServer.server.js +59 -3
  125. package/dist/custom/MJUserViewEntityServer.server.js.map +1 -1
  126. package/dist/custom/agentRelationalGrantGuard.d.ts +73 -0
  127. package/dist/custom/agentRelationalGrantGuard.d.ts.map +1 -0
  128. package/dist/custom/agentRelationalGrantGuard.js +375 -0
  129. package/dist/custom/agentRelationalGrantGuard.js.map +1 -0
  130. package/dist/custom/approvalStamp.d.ts +68 -4
  131. package/dist/custom/approvalStamp.d.ts.map +1 -1
  132. package/dist/custom/approvalStamp.js +107 -13
  133. package/dist/custom/approvalStamp.js.map +1 -1
  134. package/dist/custom/canon/CanonFingerprintRecorderServer.d.ts +20 -0
  135. package/dist/custom/canon/CanonFingerprintRecorderServer.d.ts.map +1 -0
  136. package/dist/custom/canon/CanonFingerprintRecorderServer.js +148 -0
  137. package/dist/custom/canon/CanonFingerprintRecorderServer.js.map +1 -0
  138. package/dist/custom/canon/index.d.ts +2 -0
  139. package/dist/custom/canon/index.d.ts.map +1 -0
  140. package/dist/custom/canon/index.js +2 -0
  141. package/dist/custom/canon/index.js.map +1 -0
  142. package/dist/custom/graph/GraphFindPathServerOperation.d.ts +7 -5
  143. package/dist/custom/graph/GraphFindPathServerOperation.d.ts.map +1 -1
  144. package/dist/custom/graph/GraphFindPathServerOperation.js +41 -12
  145. package/dist/custom/graph/GraphFindPathServerOperation.js.map +1 -1
  146. package/dist/custom/graphPermissionGuard.d.ts +69 -0
  147. package/dist/custom/graphPermissionGuard.d.ts.map +1 -0
  148. package/dist/custom/graphPermissionGuard.js +229 -0
  149. package/dist/custom/graphPermissionGuard.js.map +1 -0
  150. package/dist/custom/graphRlsCacheInvalidation.d.ts +38 -0
  151. package/dist/custom/graphRlsCacheInvalidation.d.ts.map +1 -0
  152. package/dist/custom/graphRlsCacheInvalidation.js +111 -0
  153. package/dist/custom/graphRlsCacheInvalidation.js.map +1 -0
  154. package/dist/custom/queryParentFingerprint.d.ts +36 -0
  155. package/dist/custom/queryParentFingerprint.d.ts.map +1 -0
  156. package/dist/custom/queryParentFingerprint.js +159 -0
  157. package/dist/custom/queryParentFingerprint.js.map +1 -0
  158. package/dist/custom/queryParentSaveChain.d.ts +5 -0
  159. package/dist/custom/queryParentSaveChain.d.ts.map +1 -0
  160. package/dist/custom/queryParentSaveChain.js +25 -0
  161. package/dist/custom/queryParentSaveChain.js.map +1 -0
  162. package/dist/custom/seededMetadataPush.d.ts +7 -0
  163. package/dist/custom/seededMetadataPush.d.ts.map +1 -0
  164. package/dist/custom/seededMetadataPush.js +23 -0
  165. package/dist/custom/seededMetadataPush.js.map +1 -0
  166. package/dist/index.d.ts +19 -0
  167. package/dist/index.d.ts.map +1 -1
  168. package/dist/index.js +19 -0
  169. package/dist/index.js.map +1 -1
  170. package/dist/tsconfig.tsbuildinfo +1 -1
  171. package/package.json +31 -31
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MJGraphLinkEntityServer.server.d.ts","sourceRoot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AC,gBAAgB,CAAC;IA8C1C,IAAI,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IAsDnD,MAAM,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC;CA0BhF"}
@@ -0,0 +1,375 @@
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, BaseEntityResult, CompositeKey, LogError, RunView, ValidationErrorInfo, ValidationErrorType, } from '@memberjunction/core';
8
+ import { EscapeSQLString, RegisterClass, UUIDSet } from '@memberjunction/global';
9
+ import { GraphAccessPolicyRegistry, GraphEngine, GraphPermissionProvider, MJGraphLinkEntity, NeutralGraphNodeLabel, } from '@memberjunction/core-entities';
10
+ import { IsSetByTransactionVariable } from './anonymousOwnershipKeyGuard.js';
11
+ import { HasDirectUserGraphDeny, IsGraphOwnerUser } from './graphPermissionGuard.js';
12
+ import { IsGraphLinkMetadataProvider } from './graphRlsCacheInvalidation.js';
13
+ export { IsGraphLinkMetadataProvider };
14
+ /** Maximum character length permitted for `MJ: Graph Links.RecordID` (Finding 262). */
15
+ export const MAX_GRAPH_LINK_RECORD_ID_LENGTH = 700;
16
+ /**
17
+ * Neutral refusal message returned whenever a caller lacks graph rights or target-record read
18
+ * rights to create, update, or delete a `MJ: Graph Links` row. Identical whether the graph does
19
+ * not exist, has no grant, is read-only, has an explicit `'None'` deny, or the linked target
20
+ * record does not exist or is unreadable, so callers cannot probe hidden graphs or records (D70).
21
+ */
22
+ export const GRAPH_LINK_ACCESS_DENIED_MESSAGE = 'You do not have permission to create, modify, or remove links on this graph.';
23
+ const GRAPH_ADMIN_ROLE_NAMES = new Set([
24
+ 'system administrator',
25
+ 'administrator',
26
+ 'admin',
27
+ 'administration',
28
+ ]);
29
+ /**
30
+ * Returns true when `user` is an Owner or holds an Administrator role, matching the
31
+ * `UI: Accessible Graphs` and `UI: Accessible Graph Links` RLS predicates.
32
+ */
33
+ export function IsGraphLinkAdminUser(user) {
34
+ if (!user) {
35
+ return false;
36
+ }
37
+ if (user.Type?.trim().toLowerCase() === 'owner') {
38
+ return true;
39
+ }
40
+ return (user.UserRoles ?? []).some((ur) => {
41
+ const name = ur.Role?.trim().toLowerCase();
42
+ return name != null && GRAPH_ADMIN_ROLE_NAMES.has(name);
43
+ });
44
+ }
45
+ /**
46
+ * Pure row-level invariant checks for `MJ: Graph Links`:
47
+ * 1. `RecordID` is non-blank and at most {@link MAX_GRAPH_LINK_RECORD_ID_LENGTH} characters.
48
+ * 2. `EntityID`, when a metadata provider is supplied, resolves to an existing entity.
49
+ * 3. `Metadata`, when non-blank, parses as valid JSON.
50
+ */
51
+ export function ValidateGraphLinkInvariants(input, provider) {
52
+ const errors = [];
53
+ const recordId = input.RecordID ?? '';
54
+ if (recordId.trim().length === 0) {
55
+ errors.push(new ValidationErrorInfo('RecordID', 'RecordID is required and cannot be blank.', input.RecordID, ValidationErrorType.Failure));
56
+ }
57
+ else if (recordId.length > MAX_GRAPH_LINK_RECORD_ID_LENGTH) {
58
+ errors.push(new ValidationErrorInfo('RecordID', `RecordID cannot exceed ${MAX_GRAPH_LINK_RECORD_ID_LENGTH} characters.`, input.RecordID, ValidationErrorType.Failure));
59
+ }
60
+ if (provider && input.EntityID && !provider.EntityByID(input.EntityID)) {
61
+ errors.push(new ValidationErrorInfo('EntityID', `EntityID '${input.EntityID}' does not match a registered entity.`, input.EntityID, ValidationErrorType.Failure));
62
+ }
63
+ if (input.Metadata != null && input.Metadata.trim().length > 0) {
64
+ try {
65
+ JSON.parse(input.Metadata);
66
+ }
67
+ catch {
68
+ errors.push(new ValidationErrorInfo('Metadata', 'Metadata must be valid JSON when provided.', input.Metadata, ValidationErrorType.Failure));
69
+ }
70
+ }
71
+ return errors;
72
+ }
73
+ async function defaultCheckGraphPermission(user, graphId, action, provider) {
74
+ try {
75
+ const permProvider = new GraphPermissionProvider();
76
+ const res = await permProvider.CheckPermission(user, 'Graphs', graphId, action, provider);
77
+ return res.Allowed;
78
+ }
79
+ catch (err) {
80
+ const msg = err instanceof Error ? err.message : String(err);
81
+ LogError(`MJGraphLinkEntityServer: graph permission check failed closed for user '${user.ID}' on graph '${graphId}' (${action}): ${msg}`);
82
+ return false;
83
+ }
84
+ }
85
+ /**
86
+ * Builds the `ExtraFilter` predicate matching `compositeKey` against `entity.PrimaryKeys`
87
+ * (Findings 294, 337, 338). Rejects any non-primary-key field name (`null`), normalizes column
88
+ * names from entity metadata, escapes string values via `EscapeSQLString`, and uses Unicode `N'...'`
89
+ * literals on SQL Server so non-ASCII keys are never coerced.
90
+ */
91
+ export function BuildGraphLinkTargetFilter(entity, compositeKey, platformKey) {
92
+ const pkNameByLower = new Map();
93
+ for (const pk of entity.PrimaryKeys) {
94
+ pkNameByLower.set(pk.Name.trim().toLowerCase(), pk.Name);
95
+ }
96
+ // SQL Server needs N'...' so Unicode keys are never coerced; PostgreSQL also accepts N'...'
97
+ // literals, so defaulting to 'N' when a custom provider omits PlatformKey is safe on both (Finding 349).
98
+ const literalPrefix = platformKey === 'postgresql' ? '' : 'N';
99
+ const predicates = [];
100
+ for (const kv of compositeKey.KeyValuePairs) {
101
+ const canonicalName = pkNameByLower.get(kv.FieldName.trim().toLowerCase());
102
+ if (!canonicalName) {
103
+ return null;
104
+ }
105
+ predicates.push(`[${canonicalName}] = ${literalPrefix}'${EscapeSQLString(String(kv.Value))}'`);
106
+ }
107
+ return predicates.length > 0 ? predicates.join(' AND ') : null;
108
+ }
109
+ /**
110
+ * Verifies in one `RunView` call (`MaxRows: 1`, `ResultType: 'simple'`) that the linked record
111
+ * exists and is readable by `user`. Using `RunView` enforces entity-level Read permissions,
112
+ * Read RLS filters, and PostRunView row-level ACL hooks without invoking subclass Load hooks.
113
+ * When the target entity also has a graph node access policy (e.g. `MJ: AI Agents`, `MJ: AI Skills`
114
+ * whose ACLs live in permission tables rather than RLS), verifies that policy too (Finding 336).
115
+ */
116
+ async function defaultCheckLinkedRecordReadable(entity, compositeKey, user, provider) {
117
+ const platformKey = 'PlatformKey' in provider && typeof provider.PlatformKey === 'string'
118
+ ? provider.PlatformKey
119
+ : undefined;
120
+ const extraFilter = BuildGraphLinkTargetFilter(entity, compositeKey, platformKey);
121
+ if (!extraFilter) {
122
+ return false;
123
+ }
124
+ const res = await RunView.FromMetadataProvider(provider).RunView({
125
+ EntityName: entity.Name,
126
+ ExtraFilter: extraFilter,
127
+ Fields: entity.PrimaryKeys.map((pk) => pk.Name),
128
+ MaxRows: 1,
129
+ ResultType: 'simple',
130
+ }, user);
131
+ if (res.Success !== true) {
132
+ LogError(`MJGraphLinkEntityServer: target readability RunView failed for entity '${entity.Name}' (${entity.ID}): ${res.ErrorMessage ?? 'unknown error'}`);
133
+ return false;
134
+ }
135
+ if (!Array.isArray(res.Results) || res.Results.length !== 1) {
136
+ return false;
137
+ }
138
+ // Finding 336: entities with table-backed node access policies (such as AI Agents and AI Skills)
139
+ // must also pass the caller's graph visibility check so hidden records cannot be linked.
140
+ if (GraphAccessPolicyRegistry.GetNodePolicy(entity.Name)) {
141
+ const recordId = compositeKey.KeyValuePairs.length === 1
142
+ ? String(compositeKey.KeyValuePairs[0].Value)
143
+ : compositeKey.ToConcatenatedString();
144
+ const visible = await GraphEngine.Instance.FilterNodesForUser([{ EntityName: entity.Name, EntityID: entity.ID, RecordID: recordId }], user, undefined, { Provider: provider });
145
+ if (visible.size === 0) {
146
+ return false;
147
+ }
148
+ // Also refuse when the node policy redacted the target (neutral label) so redacted records
149
+ // cannot be linked regardless of whether Description is null or non-null (Finding 336 / Wave 2 Review 18 note #2).
150
+ for (const view of visible.values()) {
151
+ if (view.Label === NeutralGraphNodeLabel(view.EntityName, view.RecordID)) {
152
+ return false;
153
+ }
154
+ }
155
+ }
156
+ return true;
157
+ }
158
+ /**
159
+ * Verifies that `(entityId, recordId)` names a real record that `user` is permitted to read
160
+ * (entity Read permission + Read RLS filter + PostRunView ACL hooks + graph node policy,
161
+ * Findings 294, 333, 336).
162
+ *
163
+ * Parses both scalar and composite `RecordID` values via {@link CompositeKey.FromRecordID}.
164
+ * Every failure (unknown entity, invalid key shape, nonexistent record, unreadable record, or
165
+ * provider error) fails closed with {@link GRAPH_LINK_ACCESS_DENIED_MESSAGE} so callers can never
166
+ * probe whether a hidden record exists, while operational faults are logged via `LogError`.
167
+ */
168
+ export async function VerifyGraphLinkTargetReadable(user, entityId, recordId, provider, checkReadable = defaultCheckLinkedRecordReadable) {
169
+ const trimmedRecordId = recordId?.trim() ?? '';
170
+ if (!user || !user.ID || user.IsActive === false || !provider || !entityId || trimmedRecordId.length === 0) {
171
+ return { Allowed: false, Reason: GRAPH_LINK_ACCESS_DENIED_MESSAGE };
172
+ }
173
+ const targetEntity = provider.EntityByID(entityId);
174
+ if (!targetEntity || targetEntity.PrimaryKeys.length === 0) {
175
+ return { Allowed: false, Reason: GRAPH_LINK_ACCESS_DENIED_MESSAGE };
176
+ }
177
+ let compositeKey;
178
+ try {
179
+ compositeKey = CompositeKey.FromRecordID(targetEntity, trimmedRecordId);
180
+ }
181
+ catch (err) {
182
+ const msg = err instanceof Error ? err.message : String(err);
183
+ LogError(`MJGraphLinkEntityServer: failed parsing RecordID '${trimmedRecordId}' for entity '${targetEntity.Name}' (${targetEntity.ID}): ${msg}`);
184
+ return { Allowed: false, Reason: GRAPH_LINK_ACCESS_DENIED_MESSAGE };
185
+ }
186
+ if (compositeKey.KeyValuePairs.length !== targetEntity.PrimaryKeys.length ||
187
+ compositeKey.KeyValuePairs.some((kv) => kv.Value == null || String(kv.Value).trim().length === 0)) {
188
+ return { Allowed: false, Reason: GRAPH_LINK_ACCESS_DENIED_MESSAGE };
189
+ }
190
+ try {
191
+ const readable = await checkReadable(targetEntity, compositeKey, user, provider);
192
+ if (!readable) {
193
+ return { Allowed: false, Reason: GRAPH_LINK_ACCESS_DENIED_MESSAGE };
194
+ }
195
+ return { Allowed: true };
196
+ }
197
+ catch (err) {
198
+ const msg = err instanceof Error ? err.message : String(err);
199
+ LogError(`MJGraphLinkEntityServer: target readability check threw for entity '${targetEntity.Name}' (${targetEntity.ID}), RecordID '${trimmedRecordId}': ${msg}`);
200
+ return { Allowed: false, Reason: GRAPH_LINK_ACCESS_DENIED_MESSAGE };
201
+ }
202
+ }
203
+ /**
204
+ * Evaluates whether `user` may mutate (create, update, or delete) a `MJ: Graph Links` row
205
+ * referencing `graphIds` (on update where `GraphID` changes, pass BOTH the previous and new
206
+ * `GraphID` so a caller cannot steal a link from an unreadable graph or move one into an
207
+ * unreadable graph).
208
+ *
209
+ * Requires Owner/Admin OR `Use` / `Approve` (`'Execute'`) permission on every referenced graph
210
+ * via `GraphPermissionProvider` (D70 / Finding 265). A caller with no grant, `'None'` deny, or
211
+ * `'Read'`-only access is refused with a neutral message that never reveals graph existence.
212
+ */
213
+ export async function EvaluateGraphLinkWriteAccess(user, graphIds, provider, checkPermission = defaultCheckGraphPermission) {
214
+ if (!user || !user.ID || user.IsActive === false) {
215
+ return { Allowed: false, Reason: GRAPH_LINK_ACCESS_DENIED_MESSAGE };
216
+ }
217
+ const nonEmptyGraphIds = graphIds.filter((id) => typeof id === 'string' && id.trim().length > 0);
218
+ if (nonEmptyGraphIds.length === 0) {
219
+ return { Allowed: false, Reason: GRAPH_LINK_ACCESS_DENIED_MESSAGE };
220
+ }
221
+ if (IsGraphOwnerUser(user)) {
222
+ return { Allowed: true };
223
+ }
224
+ if (IsGraphLinkAdminUser(user)) {
225
+ // A26 / Finding 362: only Owner is exempt from explicit user-direct 'None' denies.
226
+ if (provider && checkPermission === defaultCheckGraphPermission) {
227
+ const checkedAdmin = new UUIDSet();
228
+ for (const graphId of nonEmptyGraphIds) {
229
+ if (checkedAdmin.Has(graphId)) {
230
+ continue;
231
+ }
232
+ checkedAdmin.Add(graphId);
233
+ try {
234
+ if (await HasDirectUserGraphDeny(user, graphId, provider)) {
235
+ return { Allowed: false, Reason: GRAPH_LINK_ACCESS_DENIED_MESSAGE };
236
+ }
237
+ }
238
+ catch (err) {
239
+ LogError(`EvaluateGraphLinkWriteAccess direct-deny check failed for user '${user.ID}': ${err instanceof Error ? err.message : String(err)}`);
240
+ return { Allowed: false, Reason: GRAPH_LINK_ACCESS_DENIED_MESSAGE };
241
+ }
242
+ }
243
+ }
244
+ return { Allowed: true };
245
+ }
246
+ const checked = new UUIDSet();
247
+ for (const graphId of nonEmptyGraphIds) {
248
+ if (checked.Has(graphId)) {
249
+ continue;
250
+ }
251
+ checked.Add(graphId);
252
+ const allowed = await checkPermission(user, graphId, 'Execute', provider);
253
+ if (!allowed) {
254
+ return { Allowed: false, Reason: GRAPH_LINK_ACCESS_DENIED_MESSAGE };
255
+ }
256
+ }
257
+ return { Allowed: true };
258
+ }
259
+ /**
260
+ * Server-side entity class for `MJ: Graph Links` (D70, Findings 265, 294, 295).
261
+ *
262
+ * Enforces:
263
+ * 1. Row invariants (`RecordID` non-blank <= 700 chars, valid `EntityID`, valid JSON `Metadata`).
264
+ * 2. Graph write authorization on `Save()` and `Delete()` via `GraphPermissionProvider`:
265
+ * - Owner/Admin or caller with `Use` / `Approve` (`Execute`) on `GraphID` (and old `GraphID`
266
+ * when reparenting a link) may create, update, or delete links.
267
+ * - Callers with no grant, `'None'` deny, or `'Read'`-only access are refused with a neutral
268
+ * message that never leaks whether the target graph exists.
269
+ * 3. Target-record existence & caller readability on `Save()` (create or `EntityID`/`RecordID`
270
+ * change): verifies in a single `RunView` (`MaxRows: 1`) as `ContextCurrentUser` that the
271
+ * linked record exists and passes Read permissions, Read RLS, and PostRunView ACL hooks.
272
+ * 4. Multi-provider fail-closed: uses `this.ProviderToUse` directly (never falls back to the
273
+ * global metadata provider); refuses writes if `ProviderToUse` is not an `IMetadataProvider`.
274
+ * 5. Read isolation is enforced at the database layer via the `UI: Accessible Graph Links` RLS
275
+ * filter on `MJ: Graph Links`.
276
+ */
277
+ let MJGraphLinkEntityServer = class MJGraphLinkEntityServer extends MJGraphLinkEntity {
278
+ get DefaultSkipAsyncValidation() {
279
+ return false;
280
+ }
281
+ resolveMetadataProvider() {
282
+ return IsGraphLinkMetadataProvider(this.ProviderToUse) ? this.ProviderToUse : null;
283
+ }
284
+ refuseOperation(type, message) {
285
+ const result = new BaseEntityResult();
286
+ result.Success = false;
287
+ result.Type = type;
288
+ result.Message = message;
289
+ result.StartedAt = new Date();
290
+ result.EndedAt = new Date();
291
+ this.RegisterResultHistoryEntry(result);
292
+ return false;
293
+ }
294
+ async ValidateAsync() {
295
+ const result = await super.ValidateAsync();
296
+ if (!result.Success) {
297
+ return result;
298
+ }
299
+ const provider = this.resolveMetadataProvider();
300
+ if (!provider) {
301
+ result.Errors.push(new ValidationErrorInfo('GraphID', GRAPH_LINK_ACCESS_DENIED_MESSAGE, this.GraphID, ValidationErrorType.Failure));
302
+ result.Success = false;
303
+ return result;
304
+ }
305
+ if (IsSetByTransactionVariable(this, ['GraphID'])) {
306
+ result.Errors.push(new ValidationErrorInfo('GraphID', 'GraphID on MJ: Graph Links cannot be bound via transaction variables.', this.GraphID, ValidationErrorType.Failure));
307
+ result.Success = false;
308
+ return result;
309
+ }
310
+ const errors = ValidateGraphLinkInvariants({
311
+ GraphID: this.GraphID,
312
+ EntityID: this.EntityID,
313
+ RecordID: this.RecordID,
314
+ Metadata: this.Metadata,
315
+ }, provider);
316
+ if (errors.length > 0) {
317
+ result.Errors.push(...errors);
318
+ result.Success = false;
319
+ }
320
+ return result;
321
+ }
322
+ async Save(options) {
323
+ const opType = this.IsSaved ? 'update' : 'create';
324
+ if (IsSetByTransactionVariable(this, ['GraphID'])) {
325
+ return this.refuseOperation(opType, 'GraphID on MJ: Graph Links cannot be bound via transaction variables.');
326
+ }
327
+ const provider = this.resolveMetadataProvider();
328
+ if (!provider) {
329
+ return this.refuseOperation(opType, GRAPH_LINK_ACCESS_DENIED_MESSAGE);
330
+ }
331
+ const graphIdsToCheck = [this.GraphID];
332
+ const graphIdField = this.GetFieldByName('GraphID');
333
+ if (this.IsSaved && graphIdField?.Dirty && typeof graphIdField.OldValue === 'string') {
334
+ graphIdsToCheck.push(graphIdField.OldValue);
335
+ }
336
+ const access = await EvaluateGraphLinkWriteAccess(this.ContextCurrentUser, graphIdsToCheck, provider);
337
+ if (!access.Allowed) {
338
+ return this.refuseOperation(opType, access.Reason ?? GRAPH_LINK_ACCESS_DENIED_MESSAGE);
339
+ }
340
+ const entityIdField = this.GetFieldByName('EntityID');
341
+ const recordIdField = this.GetFieldByName('RecordID');
342
+ // Finding 336: also re-check target readability when moving a link to another graph.
343
+ const targetChanged = !this.IsSaved ||
344
+ entityIdField?.Dirty === true ||
345
+ recordIdField?.Dirty === true ||
346
+ graphIdField?.Dirty === true;
347
+ if (targetChanged) {
348
+ const targetCheck = await VerifyGraphLinkTargetReadable(this.ContextCurrentUser, this.EntityID, this.RecordID, provider);
349
+ if (!targetCheck.Allowed) {
350
+ return this.refuseOperation(opType, targetCheck.Reason ?? GRAPH_LINK_ACCESS_DENIED_MESSAGE);
351
+ }
352
+ }
353
+ return super.Save(options);
354
+ }
355
+ async Delete(options) {
356
+ const provider = this.resolveMetadataProvider();
357
+ if (!provider) {
358
+ return this.refuseOperation('delete', GRAPH_LINK_ACCESS_DENIED_MESSAGE);
359
+ }
360
+ const graphIdField = this.GetFieldByName('GraphID');
361
+ const originalGraphId = typeof graphIdField?.OldValue === 'string' && graphIdField.OldValue.trim().length > 0
362
+ ? graphIdField.OldValue
363
+ : this.GraphID;
364
+ const access = await EvaluateGraphLinkWriteAccess(this.ContextCurrentUser, [originalGraphId], provider);
365
+ if (!access.Allowed) {
366
+ return this.refuseOperation('delete', access.Reason ?? GRAPH_LINK_ACCESS_DENIED_MESSAGE);
367
+ }
368
+ return super.Delete(options);
369
+ }
370
+ };
371
+ MJGraphLinkEntityServer = __decorate([
372
+ RegisterClass(BaseEntity, 'MJ: Graph Links')
373
+ ], MJGraphLinkEntityServer);
374
+ export { MJGraphLinkEntityServer };
375
+ //# sourceMappingURL=MJGraphLinkEntityServer.server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MJGraphLinkEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJGraphLinkEntityServer.server.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACH,UAAU,EACV,gBAAgB,EAChB,YAAY,EAKZ,QAAQ,EAER,OAAO,EAEP,mBAAmB,EACnB,mBAAmB,GAEtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EACH,yBAAyB,EACzB,WAAW,EACX,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,GACxB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,2BAA2B,EAAE,CAAC;AAEvC,uFAAuF;AACvF,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gCAAgC,GACzC,8EAA8E,CAAC;AAEnF,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC;IACnC,sBAAsB;IACtB,eAAe;IACf,OAAO;IACP,gBAAgB;CACnB,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAiC;IAClE,IAAI,CAAC,IAAI,EAAE,CAAC;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AO,CAAC,CAAC;IAC/B,CAAC;IAEe,KAAK,CAAC,MAAM,CAAC,OAA6B;QACtD,MAAM,QAAQ,GAAG,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAChD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACZ,OAAO,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,gCAAgC,CAAC,CAAC;QAC5E,CAAC;QAED,MAAM,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QACpD,MAAM,eAAe,GACjB,OAAO,YAAY,EAAE,QAAQ,KAAK,QAAQ,IAAI,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;YACjF,CAAC,CAAC,YAAY,CAAC,QAAQ;YACvB,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;QAEvB,MAAM,MAAM,GAAG,MAAM,4BAA4B,CAC7C,IAAI,CAAC,kBAAkB,EACvB,CAAC,eAAe,CAAC,EACjB,QAAQ,CACX,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YAClB,OAAO,IAAI,CAAC,eAAe,CACvB,QAAQ,EACR,MAAM,CAAC,MAAM,IAAI,gCAAgC,CACpD,CAAC;QACN,CAAC;QAED,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;CACJ,CAAA;AAlJY,uBAAuB;IADnC,aAAa,CAAC,UAAU,EAAE,iBAAiB,CAAC;GAChC,uBAAuB,CAkJnC"}
@@ -0,0 +1,29 @@
1
+ import { EntityDeleteOptions, EntitySaveOptions, ValidationResult } from '@memberjunction/core';
2
+ import { MJGraphPermissionEntity } from '@memberjunction/core-entities';
3
+ import { GRAPH_PERMISSION_DEPENDENT_ENTITIES, InvalidateDependentGraphCaches } from './graphRlsCacheInvalidation.js';
4
+ export { GRAPH_PERMISSION_DEPENDENT_ENTITIES, InvalidateDependentGraphCaches };
5
+ /**
6
+ * Server-side entity class for `MJ: Graph Permissions` (Findings 334, 358, 361, 362, 363).
7
+ *
8
+ * Enforces:
9
+ * 1. Write authorization on `Save()` (including `ReplayOnly`/`SkipAsyncValidation`) and `Delete()`:
10
+ * only `Owner`, the creator-bootstrap scope on a brand-new graph, or a caller who holds
11
+ * `Approve` on EVERY affected graph (both old and new `GraphID` on a move) or global
12
+ * `Graph: Approve Edges` (with no explicit user-direct `'None'` deny) may create, modify, or
13
+ * delete permission rows. Nobody can self-grant or grant above their own level (Finding 358).
14
+ * 2. Refuses transaction-variable-bound `GraphID` or `PermissionLevel` so a `TransactionGroup`
15
+ * cannot retarget or elevate a grant after validation (Finding 361).
16
+ * 3. Invalidates `LocalCacheManager` RunView slots for graph entities whose RLS predicates depend
17
+ * on `GraphPermission` rows strictly after commit (Finding 334).
18
+ */
19
+ export declare class MJGraphPermissionEntityServer extends MJGraphPermissionEntity {
20
+ get DefaultSkipAsyncValidation(): boolean;
21
+ ValidateAsync(): Promise<ValidationResult>;
22
+ Save(options?: EntitySaveOptions): Promise<boolean>;
23
+ Delete(options?: EntityDeleteOptions): Promise<boolean>;
24
+ private resolveProvider;
25
+ private evaluateWriteAuthorizationAsync;
26
+ private evaluateDeleteAuthorizationAsync;
27
+ private refuseOperation;
28
+ }
29
+ //# sourceMappingURL=MJGraphPermissionEntityServer.server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MJGraphPermissionEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJGraphPermissionEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,mBAAmB,EACnB,iBAAiB,EAIjB,gBAAgB,EACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAWxE,OAAO,EAEH,mCAAmC,EACnC,8BAA8B,EAGjC,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,mCAAmC,EAAE,8BAA8B,EAAE,CAAC;AAE/E;;;;;;;;;;;;;GAaG;AACH,qBACa,6BAA8B,SAAQ,uBAAuB;IACtE,IAAoB,0BAA0B,IAAI,OAAO,CAExD;IAEqB,aAAa,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAa1C,IAAI,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IAqBnD,MAAM,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC;IAkB7E,OAAO,CAAC,eAAe;YAIT,+BAA+B;YAiD/B,gCAAgC;IAuC9C,OAAO,CAAC,eAAe;CAU1B"}
@@ -0,0 +1,141 @@
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, BaseEntityResult, ValidationErrorInfo, ValidationErrorType, } from '@memberjunction/core';
8
+ import { RegisterClass } from '@memberjunction/global';
9
+ import { MJGraphPermissionEntity } from '@memberjunction/core-entities';
10
+ import { IsSetByTransactionVariable } from './anonymousOwnershipKeyGuard.js';
11
+ import { ApproveEdgesDenialReason } from './MJGraphEdgeEntityServer.server.js';
12
+ import { CheckGraphApproveAuthorization, CollectAffectedGraphIds, GRAPH_PERMISSION_WRITE_DENIED_MESSAGE, IsGraphCreatorBootstrapScopeActive, IsGraphOwnerUser, ResolveStoredGraphId, } from './graphPermissionGuard.js';
13
+ import { CaptureGraphCacheInvalidationToken, GRAPH_PERMISSION_DEPENDENT_ENTITIES, InvalidateDependentGraphCaches, IsGraphLinkMetadataProvider, ScheduleDependentGraphCacheInvalidation, } from './graphRlsCacheInvalidation.js';
14
+ export { GRAPH_PERMISSION_DEPENDENT_ENTITIES, InvalidateDependentGraphCaches };
15
+ /**
16
+ * Server-side entity class for `MJ: Graph Permissions` (Findings 334, 358, 361, 362, 363).
17
+ *
18
+ * Enforces:
19
+ * 1. Write authorization on `Save()` (including `ReplayOnly`/`SkipAsyncValidation`) and `Delete()`:
20
+ * only `Owner`, the creator-bootstrap scope on a brand-new graph, or a caller who holds
21
+ * `Approve` on EVERY affected graph (both old and new `GraphID` on a move) or global
22
+ * `Graph: Approve Edges` (with no explicit user-direct `'None'` deny) may create, modify, or
23
+ * delete permission rows. Nobody can self-grant or grant above their own level (Finding 358).
24
+ * 2. Refuses transaction-variable-bound `GraphID` or `PermissionLevel` so a `TransactionGroup`
25
+ * cannot retarget or elevate a grant after validation (Finding 361).
26
+ * 3. Invalidates `LocalCacheManager` RunView slots for graph entities whose RLS predicates depend
27
+ * on `GraphPermission` rows strictly after commit (Finding 334).
28
+ */
29
+ let MJGraphPermissionEntityServer = class MJGraphPermissionEntityServer extends MJGraphPermissionEntity {
30
+ get DefaultSkipAsyncValidation() {
31
+ return false;
32
+ }
33
+ async ValidateAsync() {
34
+ const result = await super.ValidateAsync();
35
+ if (!result.Success) {
36
+ return result;
37
+ }
38
+ const err = await this.evaluateWriteAuthorizationAsync();
39
+ if (err) {
40
+ result.Errors.push(err);
41
+ result.Success = false;
42
+ }
43
+ return result;
44
+ }
45
+ async Save(options) {
46
+ const opType = this.IsSaved ? 'update' : 'create';
47
+ if (options?.ReplayOnly || options?.SkipAsyncValidation) {
48
+ const err = await this.evaluateWriteAuthorizationAsync();
49
+ if (err) {
50
+ return this.refuseOperation(opType, err.Message);
51
+ }
52
+ }
53
+ const postCommitToken = CaptureGraphCacheInvalidationToken(this.ProviderToUse);
54
+ const saved = await super.Save(options);
55
+ if (saved) {
56
+ await ScheduleDependentGraphCacheInvalidation(this.ProviderToUse, 'MJGraphPermissionEntityServer', postCommitToken, this.TransactionGroup);
57
+ }
58
+ return saved;
59
+ }
60
+ async Delete(options) {
61
+ const err = await this.evaluateDeleteAuthorizationAsync();
62
+ if (err) {
63
+ return this.refuseOperation('delete', err.Message);
64
+ }
65
+ const postCommitToken = CaptureGraphCacheInvalidationToken(this.ProviderToUse);
66
+ const deleted = await super.Delete(options);
67
+ if (deleted) {
68
+ await ScheduleDependentGraphCacheInvalidation(this.ProviderToUse, 'MJGraphPermissionEntityServer', postCommitToken, this.TransactionGroup);
69
+ }
70
+ return deleted;
71
+ }
72
+ resolveProvider() {
73
+ return IsGraphLinkMetadataProvider(this.ProviderToUse) ? this.ProviderToUse : null;
74
+ }
75
+ async evaluateWriteAuthorizationAsync() {
76
+ if (IsSetByTransactionVariable(this, ['GraphID', 'PermissionLevel'])) {
77
+ return new ValidationErrorInfo('GraphID', 'GraphID and PermissionLevel on MJ: Graph Permissions cannot be bound via transaction variables.', this.GraphID, ValidationErrorType.Failure);
78
+ }
79
+ const user = this.ContextCurrentUser;
80
+ if (!user || !user.ID || user.IsActive === false) {
81
+ return new ValidationErrorInfo('GraphID', GRAPH_PERMISSION_WRITE_DENIED_MESSAGE, null, ValidationErrorType.Failure);
82
+ }
83
+ if (IsGraphOwnerUser(user)) {
84
+ return null;
85
+ }
86
+ // Creator-bootstrap scope: MJGraphEntityServer writing the initial Approve row for the
87
+ // graph's creator inside the same transaction as the new graph (Finding 363 / A27).
88
+ if (!this.IsSaved && IsGraphCreatorBootstrapScopeActive(this.GraphID, user)) {
89
+ return null;
90
+ }
91
+ const provider = this.resolveProvider();
92
+ if (!provider) {
93
+ return new ValidationErrorInfo('GraphID', GRAPH_PERMISSION_WRITE_DENIED_MESSAGE, this.GraphID, ValidationErrorType.Failure);
94
+ }
95
+ const affectedGraphIds = CollectAffectedGraphIds(this);
96
+ const globalDenial = ApproveEdgesDenialReason(user, provider.Authorizations);
97
+ const denial = await CheckGraphApproveAuthorization(user, affectedGraphIds, provider, globalDenial);
98
+ if (denial) {
99
+ return new ValidationErrorInfo('GraphID', `${GRAPH_PERMISSION_WRITE_DENIED_MESSAGE} Managing graph permissions ${denial}.`, this.GraphID, ValidationErrorType.Failure);
100
+ }
101
+ return null;
102
+ }
103
+ async evaluateDeleteAuthorizationAsync() {
104
+ const user = this.ContextCurrentUser;
105
+ if (!user || !user.ID || user.IsActive === false) {
106
+ return new ValidationErrorInfo('GraphID', GRAPH_PERMISSION_WRITE_DENIED_MESSAGE, null, ValidationErrorType.Failure);
107
+ }
108
+ if (IsGraphOwnerUser(user)) {
109
+ return null;
110
+ }
111
+ const provider = this.resolveProvider();
112
+ if (!provider) {
113
+ return new ValidationErrorInfo('GraphID', GRAPH_PERMISSION_WRITE_DENIED_MESSAGE, this.GraphID, ValidationErrorType.Failure);
114
+ }
115
+ const storedGraphId = ResolveStoredGraphId(this);
116
+ if (IsGraphCreatorBootstrapScopeActive(storedGraphId, user)) {
117
+ return null;
118
+ }
119
+ const globalDenial = ApproveEdgesDenialReason(user, provider.Authorizations);
120
+ const denial = await CheckGraphApproveAuthorization(user, [storedGraphId], provider, globalDenial);
121
+ if (denial) {
122
+ return new ValidationErrorInfo('GraphID', `${GRAPH_PERMISSION_WRITE_DENIED_MESSAGE} Managing graph permissions ${denial}.`, storedGraphId, ValidationErrorType.Failure);
123
+ }
124
+ return null;
125
+ }
126
+ refuseOperation(type, message) {
127
+ const result = new BaseEntityResult();
128
+ result.Success = false;
129
+ result.Type = type;
130
+ result.Message = message;
131
+ result.StartedAt = new Date();
132
+ result.EndedAt = new Date();
133
+ this.RegisterResultHistoryEntry(result);
134
+ return false;
135
+ }
136
+ };
137
+ MJGraphPermissionEntityServer = __decorate([
138
+ RegisterClass(BaseEntity, 'MJ: Graph Permissions')
139
+ ], MJGraphPermissionEntityServer);
140
+ export { MJGraphPermissionEntityServer };
141
+ //# sourceMappingURL=MJGraphPermissionEntityServer.server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MJGraphPermissionEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJGraphPermission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AAC,IAAI,EAAE,CAAC,aAAa,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;QACnG,IAAI,MAAM,EAAE,CAAC;YACT,OAAO,IAAI,mBAAmB,CAC1B,SAAS,EACT,GAAG,qCAAqC,+BAA+B,MAAM,GAAG,EAChF,aAAa,EACb,mBAAmB,CAAC,OAAO,CAC9B,CAAC;QACN,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAEO,eAAe,CAAC,IAA8B,EAAE,OAAe;QACnE,MAAM,MAAM,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACtC,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC;QACvB,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;QACnB,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;QACzB,MAAM,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;QAC9B,MAAM,CAAC,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC;QAC5B,IAAI,CAAC,0BAA0B,CAAC,MAAM,CAAC,CAAC;QACxC,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ,CAAA;AA/JY,6BAA6B;IADzC,aAAa,CAAC,UAAU,EAAE,uBAAuB,CAAC;GACtC,6BAA6B,CA+JzC"}
@@ -13,10 +13,10 @@ import { MJListDetailEntityExtended } from '@memberjunction/core-entities';
13
13
  * lists they DON'T own, because a List Detail carries no owner of its own — only a `ListID`.
14
14
  *
15
15
  * The owner is resolved by looking up the parent List's `UserID`. If the parent List can't be found
16
- * (an orphaned detail, or the parent already deleted during list teardown — `spDeleteList` does not
17
- * cascade, so details are removed while the parent still exists in the normal path) the rule
18
- * fails OPEN: there is no owner to protect and the coarse entity permission still applies. Enforcement
19
- * only bites when a parent List genuinely exists and is owned by someone else.
16
+ * (an orphaned detail) the rule fails OPEN: there is no owner to protect and the coarse entity
17
+ * permission still applies. Enforcement only bites when a parent List genuinely exists and is owned
18
+ * by someone else. Deleting a List removes its details in the database (`FK_ListDetail_List` cascades),
19
+ * so that path does not go through this class.
20
20
  */
21
21
  export declare class MJListDetailEntityServer extends MJListDetailEntityExtended {
22
22
  Delete(options?: EntityDeleteOptions): Promise<boolean>;
@@ -20,10 +20,10 @@ import { MJListDetailEntityExtended, MJListEntityExtended } from '@memberjunctio
20
20
  * lists they DON'T own, because a List Detail carries no owner of its own — only a `ListID`.
21
21
  *
22
22
  * The owner is resolved by looking up the parent List's `UserID`. If the parent List can't be found
23
- * (an orphaned detail, or the parent already deleted during list teardown — `spDeleteList` does not
24
- * cascade, so details are removed while the parent still exists in the normal path) the rule
25
- * fails OPEN: there is no owner to protect and the coarse entity permission still applies. Enforcement
26
- * only bites when a parent List genuinely exists and is owned by someone else.
23
+ * (an orphaned detail) the rule fails OPEN: there is no owner to protect and the coarse entity
24
+ * permission still applies. Enforcement only bites when a parent List genuinely exists and is owned
25
+ * by someone else. Deleting a List removes its details in the database (`FK_ListDetail_List` cascades),
26
+ * so that path does not go through this class.
27
27
  */
28
28
  let MJListDetailEntityServer = class MJListDetailEntityServer extends MJListDetailEntityExtended {
29
29
  async Delete(options) {
@@ -7,7 +7,8 @@ import { MJListEntityExtended } from '@memberjunction/core-entities';
7
7
  * Integration role. The rule lives once in {@link MJListEntityExtended.UserCanDelete} and is shared
8
8
  * with the UI. The `EntityPermission` migration grants the UI role entity-wide Delete on Lists, and
9
9
  * this override narrows it to owner-or-privileged, since entity permissions can't express row-level
10
- * ownership. The list's refresh routine is deleted after the list.
10
+ * ownership. The database deletes the list's members with the list, so the cached List Details
11
+ * results are cleared after the delete. The list's refresh routine is deleted after the list.
11
12
  *
12
13
  * **Source and refresh.** Only the list's owner may link it to a source query or view, or turn on
13
14
  * Refresh automatically. Linking an existing list to a new source fills it from that source right