@memberjunction/core-entities 6.2.0-edge.4 → 6.2.0-edge.6

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 (60) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/custom/ConversationWriteAccess.d.ts +5 -0
  3. package/dist/custom/ConversationWriteAccess.d.ts.map +1 -1
  4. package/dist/custom/ConversationWriteAccess.js +6 -6
  5. package/dist/custom/ConversationWriteAccess.js.map +1 -1
  6. package/dist/custom/MJConversationDetailEntityExtended.d.ts +70 -4
  7. package/dist/custom/MJConversationDetailEntityExtended.d.ts.map +1 -1
  8. package/dist/custom/MJConversationDetailEntityExtended.js +268 -28
  9. package/dist/custom/MJConversationDetailEntityExtended.js.map +1 -1
  10. package/dist/custom/MJQueryEntityExtended.d.ts +37 -1
  11. package/dist/custom/MJQueryEntityExtended.d.ts.map +1 -1
  12. package/dist/custom/MJQueryEntityExtended.js +92 -5
  13. package/dist/custom/MJQueryEntityExtended.js.map +1 -1
  14. package/dist/custom/MJThemeEntityExtended.d.ts +13 -0
  15. package/dist/custom/MJThemeEntityExtended.d.ts.map +1 -0
  16. package/dist/custom/MJThemeEntityExtended.js +37 -0
  17. package/dist/custom/MJThemeEntityExtended.js.map +1 -0
  18. package/dist/custom/MJUserViewEntityExtended.d.ts +39 -4
  19. package/dist/custom/MJUserViewEntityExtended.d.ts.map +1 -1
  20. package/dist/custom/MJUserViewEntityExtended.js +111 -18
  21. package/dist/custom/MJUserViewEntityExtended.js.map +1 -1
  22. package/dist/custom/approvals.d.ts +55 -0
  23. package/dist/custom/approvals.d.ts.map +1 -0
  24. package/dist/custom/approvals.js +120 -0
  25. package/dist/custom/approvals.js.map +1 -0
  26. package/dist/engines/InstanceConfigEngine.d.ts.map +1 -1
  27. package/dist/engines/InstanceConfigEngine.js +13 -3
  28. package/dist/engines/InstanceConfigEngine.js.map +1 -1
  29. package/dist/engines/PermissionEngine.d.ts +5 -4
  30. package/dist/engines/PermissionEngine.d.ts.map +1 -1
  31. package/dist/engines/PermissionEngine.js +7 -5
  32. package/dist/engines/PermissionEngine.js.map +1 -1
  33. package/dist/engines/QueryEngine.d.ts +81 -6
  34. package/dist/engines/QueryEngine.d.ts.map +1 -1
  35. package/dist/engines/QueryEngine.js +283 -4
  36. package/dist/engines/QueryEngine.js.map +1 -1
  37. package/dist/engines/UserInfoEngine.d.ts +48 -2
  38. package/dist/engines/UserInfoEngine.d.ts.map +1 -1
  39. package/dist/engines/UserInfoEngine.js +65 -8
  40. package/dist/engines/UserInfoEngine.js.map +1 -1
  41. package/dist/engines/conversations.d.ts +19 -1
  42. package/dist/engines/conversations.d.ts.map +1 -1
  43. package/dist/engines/conversations.js +125 -22
  44. package/dist/engines/conversations.js.map +1 -1
  45. package/dist/engines/knowledgeHubMetadata.d.ts +8 -3
  46. package/dist/engines/knowledgeHubMetadata.d.ts.map +1 -1
  47. package/dist/engines/knowledgeHubMetadata.js +19 -2
  48. package/dist/engines/knowledgeHubMetadata.js.map +1 -1
  49. package/dist/generated/entities/__mj.d.ts +4142 -111
  50. package/dist/generated/entities/__mj.d.ts.map +1 -1
  51. package/dist/generated/entities/__mj.js +5895 -262
  52. package/dist/generated/entities/__mj.js.map +1 -1
  53. package/dist/generated/remote_operations.d.ts +17 -5
  54. package/dist/generated/remote_operations.d.ts.map +1 -1
  55. package/dist/generated/remote_operations.js.map +1 -1
  56. package/dist/index.d.ts +2 -0
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +2 -0
  59. package/dist/index.js.map +1 -1
  60. package/package.json +6 -5
@@ -4,8 +4,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { BaseEntity } from "@memberjunction/core";
8
- import { RegisterClass, UUIDsEqual } from "@memberjunction/global";
7
+ import { BaseEntity, FieldSecuritySQLGate } from "@memberjunction/core";
8
+ import { IndexByUUID, RegisterClass, UUIDsEqual } from "@memberjunction/global";
9
9
  import { MJQueryEntity } from "../generated/entity_subclasses.js";
10
10
  import { QueryEngine } from "../engines/QueryEngine.js";
11
11
  /**
@@ -131,6 +131,29 @@ let MJQueryEntityExtended = class MJQueryEntityExtended extends MJQueryEntity {
131
131
  if (!this.UserHasRunPermissions(user)) {
132
132
  return { canRun: false, deniedEntities: [] };
133
133
  }
134
+ const deniedEntities = [];
135
+ const queryEntities = this.QueryEntities;
136
+ const md = this.ProviderToUse;
137
+ // Step 1b: Any referenced AlternateBaseView that is disabled or missing cannot execute
138
+ // regardless of whether the query has explicit QueryPermissions (stored-procedure semantics
139
+ // do not re-enable a disabled SQL view whose SELECT grant was revoked).
140
+ if (queryEntities && queryEntities.length > 0) {
141
+ for (const qe of queryEntities) {
142
+ if (!qe.AlternateBaseViewID)
143
+ continue;
144
+ const entityInfo = md.EntityByID(qe.EntityID);
145
+ if (!entityInfo)
146
+ continue;
147
+ const abv = IndexByUUID(entityInfo.AlternateBaseViews ?? []).Get(qe.AlternateBaseViewID);
148
+ if (!abv || !abv.IsUsable) {
149
+ const label = abv?.Name ?? qe.AlternateBaseView ?? qe.AlternateBaseViewID;
150
+ deniedEntities.push(`${entityInfo.Name} (AlternateBaseView '${label}' is unavailable)`);
151
+ }
152
+ }
153
+ if (deniedEntities.length > 0) {
154
+ return { canRun: false, deniedEntities };
155
+ }
156
+ }
134
157
  // Step 2: Explicit Query Permissions override entity checks for this query
135
158
  // and all its dependencies (stored-procedure semantics)
136
159
  const permissions = this.QueryPermissions;
@@ -138,10 +161,7 @@ let MJQueryEntityExtended = class MJQueryEntityExtended extends MJQueryEntity {
138
161
  return { canRun: true, deniedEntities: [] };
139
162
  }
140
163
  // Step 3: No explicit permissions — check entity read access
141
- const deniedEntities = [];
142
- const queryEntities = this.QueryEntities;
143
164
  if (queryEntities && queryEntities.length > 0) {
144
- const md = this.ProviderToUse;
145
165
  for (const qe of queryEntities) {
146
166
  const entityInfo = md.EntityByID(qe.EntityID);
147
167
  if (!entityInfo)
@@ -169,6 +189,73 @@ let MJQueryEntityExtended = class MJQueryEntityExtended extends MJQueryEntity {
169
189
  }
170
190
  return { canRun: deniedEntities.length === 0, deniedEntities };
171
191
  }
192
+ /**
193
+ * SECURITY — the run-time half of {@link UserCanRun}: the checks that need the SQL a run will
194
+ * actually execute, after composition and template rendering. Call it with that SQL in addition
195
+ * to {@link UserCanRun}, never instead of it.
196
+ *
197
+ * 1. A query with `MJ: Query Permissions` rows is authorized by its role list alone: a user who
198
+ * holds one of those roles may run it whatever it reads (stored-procedure semantics), and one
199
+ * who holds none may not.
200
+ * 2. Otherwise every entity whose base view or base table the SQL reads as a relation must be
201
+ * readable by the user ({@link FieldSecuritySQLGate.RelationEntities}). These come from the
202
+ * SQL, so a query whose `QueryEntities` rows are missing or stale is still checked. SQL that
203
+ * cannot be read is refused for a user who cannot read every entity in the catalog.
204
+ * 3. The SQL must not reference a field the user is denied anywhere it could leak one: the
205
+ * select list, WHERE, JOIN, GROUP BY, ORDER BY or HAVING, inside expressions and aggregates
206
+ * included. A whole-row construct (`SELECT *`, `alias.*`) over an entity the user is denied a
207
+ * field on, and SQL that cannot be read, are refused too ({@link FieldSecuritySQLGate.FindViolation}).
208
+ * So is a relation that is not a CTE or a catalog entity's base view or base table (a custom
209
+ * view, synonym, table-valued function, temp table or cross-database name), whose reads
210
+ * cannot be checked. A user denied no field on any entity is not scanned.
211
+ *
212
+ * The result never names a denied field, so a refusal says only that the query cannot be run.
213
+ * `QueryFields` metadata plays no part: it is documentation, not a security source.
214
+ *
215
+ * @param user The user the query runs for
216
+ * @param renderedSQL The SQL the run will execute
217
+ * @param catalog Every entity the executing provider knows
218
+ * @param dialect The database dialect the SQL runs under
219
+ */
220
+ UserCanRunRenderedSQL(user, renderedSQL, catalog, dialect) {
221
+ const permissions = this.QueryPermissions;
222
+ if (permissions && permissions.length > 0) {
223
+ return { canRun: this.UserHasRunPermissions(user), deniedEntities: [] };
224
+ }
225
+ const read = FieldSecuritySQLGate.RelationEntities(renderedSQL, catalog, dialect);
226
+ if (read === null && catalog.some(e => !e.GetUserPermisions(user)?.CanRead)) {
227
+ const unreadable = { Kind: 'Unresolvable', Reference: 'the SQL could not be read', Entity: null };
228
+ return { canRun: false, deniedEntities: [], fieldSecurityViolation: unreadable };
229
+ }
230
+ const deniedEntities = (read ?? []).filter(e => !e.GetUserPermisions(user)?.CanRead).map(e => e.Name);
231
+ if (deniedEntities.length > 0) {
232
+ return { canRun: false, deniedEntities };
233
+ }
234
+ const violation = FieldSecuritySQLGate.FindViolation(renderedSQL, {
235
+ User: user,
236
+ Dialect: dialect,
237
+ Catalog: catalog,
238
+ ReadEntities: [...this.declaredEntities(catalog), ...(read ?? [])],
239
+ RefuseUnknownRelations: true,
240
+ });
241
+ return violation
242
+ ? { canRun: false, deniedEntities: [], fieldSecurityViolation: violation }
243
+ : { canRun: true, deniedEntities: [] };
244
+ }
245
+ /** The catalog entities this query's `QueryEntities` rows name; stale rows are left out. */
246
+ declaredEntities(catalog) {
247
+ const queryEntities = this.QueryEntities ?? [];
248
+ if (queryEntities.length === 0)
249
+ return [];
250
+ const byID = IndexByUUID(catalog);
251
+ const declared = [];
252
+ for (const qe of queryEntities) {
253
+ const entity = byID.Get(qe.EntityID);
254
+ if (entity)
255
+ declared.push(entity);
256
+ }
257
+ return declared;
258
+ }
172
259
  // ─── Status Checks ──────────────────────────────────────────────────────────
173
260
  /** Whether this query has been formally approved for production use */
174
261
  get IsApproved() {
@@ -1 +1 @@
1
- {"version":3,"file":"MJQueryEntityExtended.js","sourceRoot":"","sources":["../../src/custom/MJQueryEntityExtended.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAiD,MAAM,sBAAsB,CAAC;AACjG,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAA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AmB,EAAE,IAAI;iBAC5B,CAAC;YACN,CAAC;YACD,KAAK,GAAG,GAAG,CAAC,QAAQ,CAAC;QACzB,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ,CAAA;AApWY,qBAAqB;IADjC,aAAa,CAAC,UAAU,EAAE,aAAa,CAAC;GAC5B,qBAAqB,CAoWjC"}
@@ -0,0 +1,13 @@
1
+ import { type ValidationResult } from '@memberjunction/core';
2
+ import { MJThemeEntity } from '../generated/entity_subclasses.js';
3
+ /**
4
+ * `MJ: Themes`: refuses a sign-in page design (`LoginScreen`, `LoginScreenDraft`) the login screen cannot
5
+ * draw safely. Runs on both tiers, so Login Studio hears the reason before the request leaves the browser.
6
+ * Only a column this save changes is checked, so a theme whose stored design predates a stricter contract
7
+ * can still be renamed or recolored.
8
+ */
9
+ export declare class MJThemeEntityExtended extends MJThemeEntity {
10
+ Validate(): ValidationResult;
11
+ private checkLoginDesign;
12
+ }
13
+ //# sourceMappingURL=MJThemeEntityExtended.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MJThemeEntityExtended.d.ts","sourceRoot":"","sources":["../../src/custom/MJThemeEntityExtended.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwD,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAGnH,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D;;;;;GAKG;AACH,qBACa,qBAAsB,SAAQ,aAAa;IACpC,QAAQ,IAAI,gBAAgB;IAQ5C,OAAO,CAAC,gBAAgB;CAM3B"}
@@ -0,0 +1,37 @@
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, ValidationErrorInfo, ValidationErrorType } from '@memberjunction/core';
8
+ import { RegisterClass } from '@memberjunction/global';
9
+ import { StoredLoginDesignProblems } from '@memberjunction/theme-engine';
10
+ import { MJThemeEntity } from '../generated/entity_subclasses.js';
11
+ /**
12
+ * `MJ: Themes`: refuses a sign-in page design (`LoginScreen`, `LoginScreenDraft`) the login screen cannot
13
+ * draw safely. Runs on both tiers, so Login Studio hears the reason before the request leaves the browser.
14
+ * Only a column this save changes is checked, so a theme whose stored design predates a stricter contract
15
+ * can still be renamed or recolored.
16
+ */
17
+ let MJThemeEntityExtended = class MJThemeEntityExtended extends MJThemeEntity {
18
+ Validate() {
19
+ const result = super.Validate();
20
+ this.checkLoginDesign(result, 'LoginScreen', this.LoginScreen);
21
+ this.checkLoginDesign(result, 'LoginScreenDraft', this.LoginScreenDraft);
22
+ result.Success = result.Errors.every((e) => e.Type !== ValidationErrorType.Failure);
23
+ return result;
24
+ }
25
+ checkLoginDesign(result, field, value) {
26
+ if (!this.GetFieldByName(field)?.Dirty)
27
+ return;
28
+ for (const problem of StoredLoginDesignProblems(value)) {
29
+ result.Errors.push(new ValidationErrorInfo(field, problem, null, ValidationErrorType.Failure));
30
+ }
31
+ }
32
+ };
33
+ MJThemeEntityExtended = __decorate([
34
+ RegisterClass(BaseEntity, 'MJ: Themes')
35
+ ], MJThemeEntityExtended);
36
+ export { MJThemeEntityExtended };
37
+ //# sourceMappingURL=MJThemeEntityExtended.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MJThemeEntityExtended.js","sourceRoot":"","sources":["../../src/custom/MJThemeEntityExtended.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,mBAAmB,EAAyB,MAAM,sBAAsB,CAAC;AACnH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D;;;;;GAKG;AAEI,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,aAAa;IACpC,QAAQ;QACpB,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;QAChC,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAC/D,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,kBAAkB,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACzE,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,mBAAmB,CAAC,OAAO,CAAC,CAAC;QACpF,OAAO,MAAM,CAAC;IAClB,CAAC;IAEO,gBAAgB,CAAC,MAAwB,EAAE,KAAyC,EAAE,KAAoB;QAC9G,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,KAAK;YAAE,OAAO;QAC/C,KAAK,MAAM,OAAO,IAAI,yBAAyB,CAAC,KAAK,CAAC,EAAE,CAAC;YACrD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC;QACnG,CAAC;IACL,CAAC;CACJ,CAAA;AAfY,qBAAqB;IADjC,aAAa,CAAC,UAAU,EAAE,YAAY,CAAC;GAC3B,qBAAqB,CAejC"}
@@ -1,4 +1,4 @@
1
- import { BaseInfo, EntityInfo, EntityFieldInfo, UserInfo, EntitySaveOptions } from "@memberjunction/core";
1
+ import { BaseInfo, EntityInfo, EntityFieldInfo, UserInfo, EntitySaveOptions, ValidationResult } from "@memberjunction/core";
2
2
  import { MJUserViewEntity, MJUserViewEntity_IColumnFormat as ColumnFormat, MJUserViewEntity_IGridSortSetting as ViewGridSortSetting, MJUserViewEntity_IGridColumnSetting as ViewGridColumnSetting, MJUserViewEntity_IGridAggregatesConfig as ViewGridAggregatesConfig, MJUserViewEntity_IGridAggregateDisplay as ViewGridAggregateDisplay, MJUserViewEntity_IDisplayState as ViewDisplayState, MJUserViewEntity_ITimelineState as ViewTimelineState } from "../generated/entity_subclasses.js";
3
3
  export declare class MJUserViewEntityExtended extends MJUserViewEntity {
4
4
  private _ViewEntityInfo;
@@ -57,6 +57,16 @@ export declare class MJUserViewEntityExtended extends MJUserViewEntity {
57
57
  * @param config The timeline configuration to set
58
58
  */
59
59
  setTimelineConfig(config: ViewTimelineState): void;
60
+ /**
61
+ * Semantic `Name` of the alternate base view (`MJ: Entity Alternate Base Views.Name`)
62
+ * pinned in `DisplayState.alternateBaseView`, or `null` when this view reads from the
63
+ * entity's canonical `BaseView`.
64
+ */
65
+ get AlternateBaseView(): string | null;
66
+ /**
67
+ * Updates or clears the pinned `alternateBaseView` in `DisplayState`.
68
+ */
69
+ set AlternateBaseView(value: string | null);
60
70
  /**
61
71
  * Check if a specific view mode is enabled.
62
72
  * By default, all modes are enabled unless explicitly disabled.
@@ -114,6 +124,13 @@ export declare class MJUserViewEntityExtended extends MJUserViewEntity {
114
124
  Load(ID: string, EntityRelationshipsToLoad?: string[]): Promise<boolean>;
115
125
  Delete(): Promise<boolean>;
116
126
  Save(options?: EntitySaveOptions): Promise<boolean>;
127
+ /**
128
+ * Adds the checks on the view's declared `Properties`: unique, non-empty names; a known type; a
129
+ * target field of the view's entity with an operator that suits the type; and each default valid
130
+ * for the type. A view with no properties validates exactly as before.
131
+ */
132
+ Validate(): ValidationResult;
133
+ private validateProperties;
117
134
  SetDefaultsFromEntity(e: EntityInfo): Promise<void>;
118
135
  NewRecord(): boolean;
119
136
  /**
@@ -140,6 +157,23 @@ export declare class MJUserViewEntityExtended extends MJUserViewEntity {
140
157
  * infrastructure will be enabled from the UpdateWhereClause() method.
141
158
  */
142
159
  protected get SmartFilterImplemented(): boolean;
160
+ /**
161
+ * True when no Smart Filter WHERE clause has been generated. Null and blank are the same state: the
162
+ * server's generator can return '' (or a model's whitespace), and `WhereClause = SmartFilterWhereClause`
163
+ * then makes the view return EVERY row.
164
+ */
165
+ private get smartFilterWhereClauseBlank();
166
+ /**
167
+ * True when the view has a Smart Filter to apply (enabled, with a prompt) but no clause. A re-save of the same
168
+ * prompt leaves no field dirty, so without this Save() would never retry, and the view would return every row
169
+ * until someone edited the prompt. With it, the view's next save regenerates the clause.
170
+ */
171
+ private get smartFilterPending();
172
+ /**
173
+ * True when `DisplayState.alternateBaseView` changed compared to the persisted `DisplayState` OldValue.
174
+ * Used to re-evaluate SmartFilterWhereClause against the new base view context on Save.
175
+ */
176
+ private get alternateBaseViewDirty();
143
177
  Set(FieldName: string, Value: any): void;
144
178
  /**
145
179
  * Create a where clause for SQL from the structured filter state JSON information
@@ -188,10 +222,11 @@ export declare class MJUserViewEntityExtended extends MJUserViewEntity {
188
222
  }]
189
223
  }`;
190
224
  */
225
+ static GenerateWhereClauseFromFilterState(FilterState: string | Record<string, unknown>, entityInfo: EntityInfo): string;
191
226
  protected GenerateWhereClause(FilterState: string, entityInfo: EntityInfo): string;
192
- private wrapQuotes;
193
- private convertFilterToSQL;
194
- private processFilterGroup;
227
+ private static wrapQuotesStatic;
228
+ private static convertFilterToSQLStatic;
229
+ private static processFilterGroupStatic;
195
230
  }
196
231
  export declare class ViewInfo {
197
232
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"MJUserViewEntityExtended.d.ts","sourceRoot":"","sources":["../../src/custom/MJUserViewEntityExtended.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,QAAQ,EAAE,UAAU,EAAE,eAAe,EAAU,QAAQ,EAAE,iBAAiB,EAA4G,MAAM,sBAAsB,CAAC;AAClP,OAAO,EACH,gBAAgB,EAChB,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,QAAQ,GAAE,GAAU;CAOpC;AAED;;;GAGG;AACH,qBAAa,aAAa;IACtB,qDAAqD;IACrD,YAAY,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACrC,gEAAgE;IAChE,cAAc,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACzC,6CAA6C;IAC7C,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,uDAAuD;IACvD,UAAU,CAAC,EAAE,wBAAwB,CAAC;CACzC;AAED;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,wBAAwB,CAWxE,CAAC"}
@@ -4,11 +4,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
+ var MJUserViewEntityExtended_1;
7
8
  import { RegisterClass, UUIDsEqual } from "@memberjunction/global";
8
- import { Metadata, BaseEntity, BaseInfo, RunView, EntityFieldTSType, EntityPermissionType, BaseEntityResult, ParseFilterField } from "@memberjunction/core";
9
+ import { Metadata, BaseEntity, BaseInfo, RunView, EntityFieldTSType, EntityPermissionType, BaseEntityResult, ParseFilterField, ExtractAlternateBaseViewFromDisplayState, ValidationErrorInfo, ValidationErrorType, ValidateUserViewProperties } from "@memberjunction/core";
9
10
  import { MJUserViewEntity, } from "../generated/entity_subclasses.js";
10
11
  import { ResourcePermissionEngine } from "./ResourcePermissions/ResourcePermissionEngine.js";
11
- let MJUserViewEntityExtended = class MJUserViewEntityExtended extends MJUserViewEntity {
12
+ let MJUserViewEntityExtended = MJUserViewEntityExtended_1 = class MJUserViewEntityExtended extends MJUserViewEntity {
12
13
  constructor() {
13
14
  super(...arguments);
14
15
  this._ViewEntityInfo = null; // case-violation-ok-legacy-back-compat: reached by bracket access outside the declaring class, where a same-named key on an unrelated object is indistinguishable
@@ -173,6 +174,32 @@ let MJUserViewEntityExtended = class MJUserViewEntityExtended extends MJUserView
173
174
  current.timeline = config;
174
175
  this.setDisplayState(current);
175
176
  }
177
+ /**
178
+ * Semantic `Name` of the alternate base view (`MJ: Entity Alternate Base Views.Name`)
179
+ * pinned in `DisplayState.alternateBaseView`, or `null` when this view reads from the
180
+ * entity's canonical `BaseView`.
181
+ */
182
+ get AlternateBaseView() {
183
+ const parsed = this.ParsedDisplayState;
184
+ const raw = parsed?.alternateBaseView ?? parsed?.AlternateBaseView;
185
+ const val = typeof raw === 'string' ? raw.trim() : undefined;
186
+ return val && val.length > 0 ? val : null;
187
+ }
188
+ /**
189
+ * Updates or clears the pinned `alternateBaseView` in `DisplayState`.
190
+ */
191
+ set AlternateBaseView(value) {
192
+ const trimmed = value?.trim() || undefined;
193
+ const current = this.ParsedDisplayState || { defaultMode: 'grid' };
194
+ delete current.AlternateBaseView;
195
+ if (trimmed) {
196
+ current.alternateBaseView = trimmed;
197
+ }
198
+ else {
199
+ delete current.alternateBaseView;
200
+ }
201
+ this.setDisplayState(current);
202
+ }
176
203
  /**
177
204
  * Check if a specific view mode is enabled.
178
205
  * By default, all modes are enabled unless explicitly disabled.
@@ -399,6 +426,8 @@ let MJUserViewEntityExtended = class MJUserViewEntityExtended extends MJUserView
399
426
  const smartFilterPromptField = this.Fields.find(c => c.Name.toLowerCase() == 'smartfilterprompt');
400
427
  if (!this.IsSaved ||
401
428
  options?.IgnoreDirtyState ||
429
+ this.smartFilterPending ||
430
+ (Boolean(this.SmartFilterEnabled) && this.alternateBaseViewDirty) ||
402
431
  filterStateField?.Dirty ||
403
432
  smartFilterEnabledField?.Dirty ||
404
433
  smartFilterPromptField?.Dirty) {
@@ -424,6 +453,33 @@ let MJUserViewEntityExtended = class MJUserViewEntityExtended extends MJUserView
424
453
  return false;
425
454
  }
426
455
  }
456
+ /**
457
+ * Adds the checks on the view's declared `Properties`: unique, non-empty names; a known type; a
458
+ * target field of the view's entity with an operator that suits the type; and each default valid
459
+ * for the type. A view with no properties validates exactly as before.
460
+ */
461
+ Validate() {
462
+ const result = super.Validate();
463
+ this.validateProperties(result);
464
+ result.Success = result.Success && result.Errors.length === 0;
465
+ return result;
466
+ }
467
+ validateProperties(result) {
468
+ if (this.Properties == null || this.Properties.trim().length === 0) {
469
+ return;
470
+ }
471
+ let problems;
472
+ try {
473
+ const fieldNames = this.ViewEntityInfo?.Fields.map(f => f.Name) ?? [];
474
+ problems = ValidateUserViewProperties(JSON.parse(this.Properties), fieldNames);
475
+ }
476
+ catch {
477
+ problems = ['Properties must be valid JSON.'];
478
+ }
479
+ for (const problem of problems) {
480
+ result.Errors.push(new ValidationErrorInfo('Properties', problem, this.Properties, ValidationErrorType.Failure));
481
+ }
482
+ }
427
483
  async SetDefaultsFromEntity(e) {
428
484
  this.EntityID = e.ID;
429
485
  const newGridState = new ViewGridState();
@@ -482,7 +538,7 @@ let MJUserViewEntityExtended = class MJUserViewEntityExtended extends MJUserView
482
538
  return;
483
539
  // if we get here, we need to update the WhereClause, first check to see if we have a Smart Filter or not
484
540
  if (this.SmartFilterEnabled && (this.SmartFilterEnabled === true || this.SmartFilterEnabled === 1) &&
485
- this.SmartFilterPrompt && this.SmartFilterPrompt.length > 0) {
541
+ this.SmartFilterPrompt && this.SmartFilterPrompt.trim().length > 0) {
486
542
  if (this.SmartFilterImplemented) {
487
543
  // The following block of code is only intended to execute when we're in an execution context where the
488
544
  // lowest level sub-class supports SmartFilter WHere Clause generation, which is determined by the class
@@ -492,9 +548,9 @@ let MJUserViewEntityExtended = class MJUserViewEntityExtended extends MJUserView
492
548
  // if the SmartFilterPrompt has changed, then we need to update the SmartFilterWhereClause using AI
493
549
  // otherwise, we don't need to do anything other than just use the SmartFilterWhereClause as it is.
494
550
  // A new record (IsSaved === false — see the note in Save() on why the ID can't be used for this) or a
495
- // record that has never had its SmartFilterWhereClause generated also needs the AI pass.
551
+ // record whose SmartFilterWhereClause is missing or blank (see smartFilterWhereClauseBlank) also needs the AI pass.
496
552
  const smartFilterPromptDirty = this.Fields.find(c => c.Name.toLowerCase() == 'smartfilterprompt')?.Dirty === true;
497
- if (!this.IsSaved || ignoreDirtyState || smartFilterPromptDirty || this.SmartFilterWhereClause == null) {
553
+ if (!this.IsSaved || ignoreDirtyState || smartFilterPromptDirty || this.alternateBaseViewDirty || this.smartFilterWhereClauseBlank) {
498
554
  // the prompt has changed (or is newly populated, either way it is dirty) so use the AI to figure this out
499
555
  const result = await this.GenerateSmartFilterWhereClause(this.SmartFilterPrompt, this.ViewEntityInfo);
500
556
  this.SmartFilterWhereClause = result.whereClause;
@@ -510,6 +566,10 @@ let MJUserViewEntityExtended = class MJUserViewEntityExtended extends MJUserView
510
566
  }
511
567
  }
512
568
  else {
569
+ if (this.IsSaved && (!this.SmartFilterPrompt || this.SmartFilterPrompt.trim().length === 0)) {
570
+ this.SmartFilterWhereClause = '';
571
+ this.SmartFilterExplanation = '';
572
+ }
513
573
  const compiled = this.GenerateWhereClause(this.FilterState, this.ViewEntityInfo);
514
574
  // On a brand-new record an empty FilterState is just the NewRecord() seed. Callers that build a view
515
575
  // programmatically (view.NewRecord(); view.WhereClause = '...'; await view.Save()) rely on that clause
@@ -535,6 +595,35 @@ let MJUserViewEntityExtended = class MJUserViewEntityExtended extends MJUserView
535
595
  get SmartFilterImplemented() {
536
596
  return false; // stub function returns false. Sub-Class will do this.
537
597
  }
598
+ /**
599
+ * True when no Smart Filter WHERE clause has been generated. Null and blank are the same state: the
600
+ * server's generator can return '' (or a model's whitespace), and `WhereClause = SmartFilterWhereClause`
601
+ * then makes the view return EVERY row.
602
+ */
603
+ get smartFilterWhereClauseBlank() {
604
+ return (this.SmartFilterWhereClause ?? '').trim().length === 0;
605
+ }
606
+ /**
607
+ * True when the view has a Smart Filter to apply (enabled, with a prompt) but no clause. A re-save of the same
608
+ * prompt leaves no field dirty, so without this Save() would never retry, and the view would return every row
609
+ * until someone edited the prompt. With it, the view's next save regenerates the clause.
610
+ */
611
+ get smartFilterPending() {
612
+ const hasPrompt = (this.SmartFilterPrompt ?? '').trim().length > 0;
613
+ return !!this.SmartFilterEnabled && hasPrompt && this.smartFilterWhereClauseBlank;
614
+ }
615
+ /**
616
+ * True when `DisplayState.alternateBaseView` changed compared to the persisted `DisplayState` OldValue.
617
+ * Used to re-evaluate SmartFilterWhereClause against the new base view context on Save.
618
+ */
619
+ get alternateBaseViewDirty() {
620
+ const displayStateField = this.Fields.find(c => c.Name.toLowerCase() === 'displaystate');
621
+ if (!displayStateField?.Dirty) {
622
+ return false;
623
+ }
624
+ const oldVal = ExtractAlternateBaseViewFromDisplayState(typeof displayStateField.OldValue === 'string' ? displayStateField.OldValue : null);
625
+ return (oldVal ?? null) !== (this.AlternateBaseView ?? null);
626
+ }
538
627
  Set(FieldName, Value) {
539
628
  // call the superclass first and set the value internally there
540
629
  super.Set(FieldName, Value);
@@ -595,13 +684,17 @@ let MJUserViewEntityExtended = class MJUserViewEntityExtended extends MJUserView
595
684
  }]
596
685
  }`;
597
686
  */
687
+ static GenerateWhereClauseFromFilterState(FilterState, entityInfo) {
688
+ const parsed = typeof FilterState === 'string' ? JSON.parse(FilterState) : FilterState;
689
+ return MJUserViewEntityExtended_1.processFilterGroupStatic(parsed, entityInfo);
690
+ }
598
691
  GenerateWhereClause(FilterState, entityInfo) {
599
- return this.processFilterGroup(JSON.parse(FilterState), entityInfo);
692
+ return MJUserViewEntityExtended_1.GenerateWhereClauseFromFilterState(FilterState, entityInfo);
600
693
  }
601
- wrapQuotes(value, needQuotes) {
694
+ static wrapQuotesStatic(value, needQuotes) {
602
695
  return needQuotes ? `'${value}'` : value;
603
696
  }
604
- convertFilterToSQL(field, operator, value, entity) {
697
+ static convertFilterToSQLStatic(field, operator, value, entity) {
605
698
  let op = '';
606
699
  const f = entity.Fields.find((f) => f.Name.trim().toLowerCase() === field.trim().toLowerCase());
607
700
  if (!f)
@@ -621,22 +714,22 @@ let MJUserViewEntityExtended = class MJUserViewEntityExtended extends MJUserView
621
714
  }
622
715
  switch (operator) {
623
716
  case 'eq':
624
- op = '= ' + this.wrapQuotes(newValue, f.NeedsQuotes);
717
+ op = '= ' + MJUserViewEntityExtended_1.wrapQuotesStatic(newValue, f.NeedsQuotes);
625
718
  break;
626
719
  case 'neq':
627
- op = '<> ' + this.wrapQuotes(newValue, f.NeedsQuotes);
720
+ op = '<> ' + MJUserViewEntityExtended_1.wrapQuotesStatic(newValue, f.NeedsQuotes);
628
721
  break;
629
722
  case 'gt':
630
- op = '> ' + this.wrapQuotes(newValue, f.NeedsQuotes);
723
+ op = '> ' + MJUserViewEntityExtended_1.wrapQuotesStatic(newValue, f.NeedsQuotes);
631
724
  break;
632
725
  case 'gte':
633
- op = '>= ' + this.wrapQuotes(newValue, f.NeedsQuotes);
726
+ op = '>= ' + MJUserViewEntityExtended_1.wrapQuotesStatic(newValue, f.NeedsQuotes);
634
727
  break;
635
728
  case 'lt':
636
- op = '< ' + this.wrapQuotes(newValue, f.NeedsQuotes);
729
+ op = '< ' + MJUserViewEntityExtended_1.wrapQuotesStatic(newValue, f.NeedsQuotes);
637
730
  break;
638
731
  case 'lte':
639
- op = '<= ' + this.wrapQuotes(newValue, f.NeedsQuotes);
732
+ op = '<= ' + MJUserViewEntityExtended_1.wrapQuotesStatic(newValue, f.NeedsQuotes);
640
733
  break;
641
734
  case 'startswith':
642
735
  op = `LIKE '${newValue}%'`;
@@ -661,7 +754,7 @@ let MJUserViewEntityExtended = class MJUserViewEntityExtended extends MJUserView
661
754
  }
662
755
  return `[${field}] ${op}`;
663
756
  }
664
- processFilterGroup(filterGroup, entity) {
757
+ static processFilterGroupStatic(filterGroup, entity) {
665
758
  // each filter has two properties, logic and filters
666
759
  // logic is either 'and' or 'or' and is what we use to determine the SQL logic operator
667
760
  // filters is an array of filters, each filter has a field, operator, and value,
@@ -676,20 +769,20 @@ let MJUserViewEntityExtended = class MJUserViewEntityExtended extends MJUserView
676
769
  // if an individual filter has a "logic" property, it's a group and we need to process it with parenthesis and recurisely
677
770
  if (filter.logic && filter.logic.length > 0) {
678
771
  // this is a group, we process it with parenthesis
679
- whereClause += `(${this.processFilterGroup(filter, entity)})`;
772
+ whereClause += `(${MJUserViewEntityExtended_1.processFilterGroupStatic(filter, entity)})`;
680
773
  }
681
774
  else {
682
775
  // Dotted names (`Organizations.Type`) are the multi-entity encoding.
683
776
  // Views are one table — use the field part. Bare names stay as they are.
684
777
  const stored = String(filter.field ?? '');
685
778
  const column = ParseFilterField(stored).Name;
686
- whereClause += `(${this.convertFilterToSQL(column, filter.operator, filter.value, entity)})`;
779
+ whereClause += `(${MJUserViewEntityExtended_1.convertFilterToSQLStatic(column, filter.operator, filter.value, entity)})`;
687
780
  }
688
781
  }
689
782
  return whereClause;
690
783
  }
691
784
  };
692
- MJUserViewEntityExtended = __decorate([
785
+ MJUserViewEntityExtended = MJUserViewEntityExtended_1 = __decorate([
693
786
  RegisterClass(BaseEntity, 'MJ: User Views')
694
787
  ], MJUserViewEntityExtended);
695
788
  export { MJUserViewEntityExtended };