@memberjunction/core-entities 2.132.0 → 2.133.0

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.
@@ -0,0 +1,244 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserViewEngine = void 0;
4
+ const core_1 = require("@memberjunction/core");
5
+ /**
6
+ * UserViewEngine is a singleton engine that provides centralized access to User Views.
7
+ * It caches all views and provides efficient lookup methods for retrieving views by various criteria.
8
+ *
9
+ * This engine consolidates view loading into a single batched operation, improving performance
10
+ * and enabling local caching for faster subsequent access.
11
+ *
12
+ * Usage:
13
+ * ```typescript
14
+ * // Initialize the engine on-demand before first use
15
+ * await UserViewEngine.Instance.Config(false);
16
+ *
17
+ * // Then access views
18
+ * const myViews = engine.GetViewsForCurrentUser();
19
+ * const entityViews = engine.GetViewsForEntity('entityId');
20
+ * const view = engine.GetViewById('viewId');
21
+ * ```
22
+ *
23
+ * Note: This engine is NOT auto-started at application startup. You must call Config() before use.
24
+ * Views are cached globally. Use the filtering methods to get views for specific users or entities.
25
+ */
26
+ class UserViewEngine extends core_1.BaseEngine {
27
+ constructor() {
28
+ super(...arguments);
29
+ // Private storage for view data
30
+ this._views = [];
31
+ // Track the user ID for filtering purposes
32
+ this._contextUserId = null;
33
+ }
34
+ /**
35
+ * Returns the global instance of the class. This is a singleton class, so there is only one instance of it in the application.
36
+ * Do not directly create new instances of it, always use this method to get the instance.
37
+ */
38
+ static get Instance() {
39
+ return super.getInstance();
40
+ }
41
+ /**
42
+ * Configures the engine by loading all User Views from the database.
43
+ * Views are cached locally for performance.
44
+ *
45
+ * @param forceRefresh - If true, forces a refresh from the server even if data is cached
46
+ * @param contextUser - The user context (required for server-side, auto-detected on client)
47
+ * @param provider - Optional custom metadata provider
48
+ */
49
+ async Config(forceRefresh, contextUser, provider) {
50
+ const md = new core_1.Metadata();
51
+ const userId = contextUser?.ID || md.CurrentUser?.ID;
52
+ // Store the context user ID for filtering
53
+ this._contextUserId = userId || null;
54
+ const configs = [
55
+ {
56
+ Type: 'entity',
57
+ EntityName: 'User Views',
58
+ PropertyName: '_views',
59
+ CacheLocal: true
60
+ }
61
+ ];
62
+ await super.Load(configs, provider, forceRefresh, contextUser);
63
+ }
64
+ // ========================================================================
65
+ // PUBLIC ACCESSORS - ALL VIEWS
66
+ // ========================================================================
67
+ /**
68
+ * Get all views in the cache (unfiltered)
69
+ */
70
+ get AllViews() {
71
+ return this._views || [];
72
+ }
73
+ /**
74
+ * Get a view by its ID
75
+ * @param viewId - The view ID to find
76
+ * @returns The view entity or undefined if not found
77
+ */
78
+ GetViewById(viewId) {
79
+ return this.AllViews.find(v => v.ID === viewId);
80
+ }
81
+ /**
82
+ * Get a view by its name
83
+ * @param viewName - The view name to find
84
+ * @returns The view entity or undefined if not found
85
+ */
86
+ GetViewByName(viewName) {
87
+ return this.AllViews.find(v => v.Name.toLowerCase() === viewName.toLowerCase());
88
+ }
89
+ // ========================================================================
90
+ // FILTERED ACCESSORS - BY ENTITY
91
+ // ========================================================================
92
+ /**
93
+ * Get all views for a specific entity
94
+ * @param entityId - The entity ID to filter by
95
+ * @returns Array of views for the entity
96
+ */
97
+ GetViewsForEntity(entityId) {
98
+ return this.AllViews
99
+ .filter(v => v.EntityID === entityId)
100
+ .sort((a, b) => a.Name.localeCompare(b.Name));
101
+ }
102
+ /**
103
+ * Get all views for a specific entity by entity name
104
+ * @param entityName - The entity name to filter by
105
+ * @returns Array of views for the entity
106
+ */
107
+ GetViewsForEntityByName(entityName) {
108
+ const md = new core_1.Metadata();
109
+ const entity = md.Entities.find(e => e.Name.toLowerCase() === entityName.toLowerCase());
110
+ if (!entity)
111
+ return [];
112
+ return this.GetViewsForEntity(entity.ID);
113
+ }
114
+ // ========================================================================
115
+ // FILTERED ACCESSORS - BY USER
116
+ // ========================================================================
117
+ /**
118
+ * Get all views owned by the current user (based on context user)
119
+ * @returns Array of views owned by the current user
120
+ */
121
+ GetViewsForCurrentUser() {
122
+ if (!this._contextUserId)
123
+ return [];
124
+ return this.GetViewsForUser(this._contextUserId);
125
+ }
126
+ /**
127
+ * Get all views owned by a specific user
128
+ * @param userId - The user ID to filter by
129
+ * @returns Array of views owned by the user
130
+ */
131
+ GetViewsForUser(userId) {
132
+ return this.AllViews
133
+ .filter(v => v.UserID === userId)
134
+ .sort((a, b) => a.Name.localeCompare(b.Name));
135
+ }
136
+ /**
137
+ * Get all shared views (views marked as shared that the user doesn't own)
138
+ * @returns Array of shared views
139
+ */
140
+ GetSharedViews() {
141
+ return this.AllViews
142
+ .filter(v => v.IsShared && v.UserID !== this._contextUserId)
143
+ .sort((a, b) => a.Name.localeCompare(b.Name));
144
+ }
145
+ /**
146
+ * Get all views accessible to the current user for a specific entity
147
+ * (includes owned views and shared views)
148
+ * @param entityId - The entity ID to filter by
149
+ * @returns Array of accessible views for the entity
150
+ */
151
+ GetAccessibleViewsForEntity(entityId) {
152
+ if (!this._contextUserId) {
153
+ // No user context - return all views for entity
154
+ return this.GetViewsForEntity(entityId);
155
+ }
156
+ return this.AllViews
157
+ .filter(v => v.EntityID === entityId &&
158
+ (v.UserID === this._contextUserId || v.IsShared))
159
+ .filter(v => v.UserCanView) // Respect permission checks
160
+ .sort((a, b) => {
161
+ // Sort: owned first, then by name
162
+ const aOwned = a.UserID === this._contextUserId;
163
+ const bOwned = b.UserID === this._contextUserId;
164
+ if (aOwned && !bOwned)
165
+ return -1;
166
+ if (!aOwned && bOwned)
167
+ return 1;
168
+ return a.Name.localeCompare(b.Name);
169
+ });
170
+ }
171
+ // ========================================================================
172
+ // FILTERED ACCESSORS - COMBINED
173
+ // ========================================================================
174
+ /**
175
+ * Get views for a specific entity owned by the current user
176
+ * @param entityId - The entity ID to filter by
177
+ * @returns Array of views for the entity owned by the current user
178
+ */
179
+ GetMyViewsForEntity(entityId) {
180
+ if (!this._contextUserId)
181
+ return [];
182
+ return this.AllViews
183
+ .filter(v => v.EntityID === entityId && v.UserID === this._contextUserId)
184
+ .sort((a, b) => a.Name.localeCompare(b.Name));
185
+ }
186
+ /**
187
+ * Get shared views for a specific entity (not owned by current user)
188
+ * @param entityId - The entity ID to filter by
189
+ * @returns Array of shared views for the entity
190
+ */
191
+ GetSharedViewsForEntity(entityId) {
192
+ return this.AllViews
193
+ .filter(v => v.EntityID === entityId &&
194
+ v.IsShared &&
195
+ v.UserID !== this._contextUserId)
196
+ .filter(v => v.UserCanView)
197
+ .sort((a, b) => a.Name.localeCompare(b.Name));
198
+ }
199
+ /**
200
+ * Get the default view for an entity for the current user
201
+ * @param entityId - The entity ID to find default view for
202
+ * @returns The default view or undefined if none exists
203
+ */
204
+ GetDefaultViewForEntity(entityId) {
205
+ const myViews = this.GetMyViewsForEntity(entityId);
206
+ return myViews.find(v => v.IsDefault);
207
+ }
208
+ // ========================================================================
209
+ // UTILITY METHODS
210
+ // ========================================================================
211
+ /**
212
+ * Check if a view exists by ID
213
+ * @param viewId - The view ID to check
214
+ * @returns True if the view exists
215
+ */
216
+ ViewExists(viewId) {
217
+ return this.GetViewById(viewId) !== undefined;
218
+ }
219
+ /**
220
+ * Check if a view with the given name exists for an entity
221
+ * @param entityId - The entity ID
222
+ * @param viewName - The view name to check
223
+ * @returns True if a view with that name exists for the entity
224
+ */
225
+ ViewNameExistsForEntity(entityId, viewName) {
226
+ return this.AllViews.some(v => v.EntityID === entityId &&
227
+ v.Name.toLowerCase() === viewName.toLowerCase());
228
+ }
229
+ /**
230
+ * Force refresh the view cache
231
+ * Useful after creating, updating, or deleting a view
232
+ */
233
+ async RefreshCache(contextUser, provider) {
234
+ await this.Config(true, contextUser, provider);
235
+ }
236
+ /**
237
+ * Get the current context user ID
238
+ */
239
+ get ContextUserId() {
240
+ return this._contextUserId;
241
+ }
242
+ }
243
+ exports.UserViewEngine = UserViewEngine;
244
+ //# sourceMappingURL=UserViewEngine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserViewEngine.js","sourceRoot":"","sources":["../../src/engines/UserViewEngine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AC3E,kBAAkB;IAClB,2EAA2E;IAE3E;;;;OAIG;IACI,UAAU,CAAC,MAAc;QAC5B,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,SAAS,CAAC;IAClD,CAAC;IAED;;;;;OAKG;IACI,uBAAuB,CAAC,QAAgB,EAAE,QAAgB;QAC7D,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAC1B,CAAC,CAAC,QAAQ,KAAK,QAAQ;YACvB,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,QAAQ,CAAC,WAAW,EAAE,CAClD,CAAC;IACN,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,YAAY,CAAC,WAAsB,EAAE,QAA4B;QAC1E,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,IAAW,aAAa;QACpB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;CACJ;AAlPD,wCAkPC"}
@@ -8064,6 +8064,85 @@ export declare const EnvironmentSchema: z.ZodObject<{
8064
8064
  Settings?: string;
8065
8065
  }>;
8066
8066
  export type EnvironmentEntityType = z.infer<typeof EnvironmentSchema>;
8067
+ /**
8068
+ * zod schema definition for the entity MJ: List Invitations
8069
+ */
8070
+ export declare const ListInvitationSchema: z.ZodObject<{
8071
+ ID: z.ZodString;
8072
+ ListID: z.ZodString;
8073
+ Email: z.ZodString;
8074
+ Role: z.ZodUnion<[z.ZodLiteral<"Editor">, z.ZodLiteral<"Viewer">]>;
8075
+ Token: z.ZodString;
8076
+ ExpiresAt: z.ZodDate;
8077
+ CreatedByUserID: z.ZodString;
8078
+ Status: z.ZodUnion<[z.ZodLiteral<"Accepted">, z.ZodLiteral<"Expired">, z.ZodLiteral<"Pending">, z.ZodLiteral<"Revoked">]>;
8079
+ __mj_CreatedAt: z.ZodDate;
8080
+ __mj_UpdatedAt: z.ZodDate;
8081
+ List: z.ZodString;
8082
+ CreatedByUser: z.ZodString;
8083
+ }, "strip", z.ZodTypeAny, {
8084
+ ID?: string;
8085
+ __mj_CreatedAt?: Date;
8086
+ __mj_UpdatedAt?: Date;
8087
+ Status?: "Pending" | "Revoked" | "Expired" | "Accepted";
8088
+ Role?: "Editor" | "Viewer";
8089
+ Email?: string;
8090
+ List?: string;
8091
+ ListID?: string;
8092
+ ExpiresAt?: Date;
8093
+ Token?: string;
8094
+ CreatedByUserID?: string;
8095
+ CreatedByUser?: string;
8096
+ }, {
8097
+ ID?: string;
8098
+ __mj_CreatedAt?: Date;
8099
+ __mj_UpdatedAt?: Date;
8100
+ Status?: "Pending" | "Revoked" | "Expired" | "Accepted";
8101
+ Role?: "Editor" | "Viewer";
8102
+ Email?: string;
8103
+ List?: string;
8104
+ ListID?: string;
8105
+ ExpiresAt?: Date;
8106
+ Token?: string;
8107
+ CreatedByUserID?: string;
8108
+ CreatedByUser?: string;
8109
+ }>;
8110
+ export type ListInvitationEntityType = z.infer<typeof ListInvitationSchema>;
8111
+ /**
8112
+ * zod schema definition for the entity MJ: List Shares
8113
+ */
8114
+ export declare const ListShareSchema: z.ZodObject<{
8115
+ ID: z.ZodString;
8116
+ ListID: z.ZodString;
8117
+ UserID: z.ZodString;
8118
+ Role: z.ZodUnion<[z.ZodLiteral<"Editor">, z.ZodLiteral<"Viewer">]>;
8119
+ Status: z.ZodUnion<[z.ZodLiteral<"Active">, z.ZodLiteral<"Pending">]>;
8120
+ __mj_CreatedAt: z.ZodDate;
8121
+ __mj_UpdatedAt: z.ZodDate;
8122
+ List: z.ZodString;
8123
+ User: z.ZodString;
8124
+ }, "strip", z.ZodTypeAny, {
8125
+ ID?: string;
8126
+ __mj_CreatedAt?: Date;
8127
+ __mj_UpdatedAt?: Date;
8128
+ Status?: "Active" | "Pending";
8129
+ UserID?: string;
8130
+ User?: string;
8131
+ Role?: "Editor" | "Viewer";
8132
+ List?: string;
8133
+ ListID?: string;
8134
+ }, {
8135
+ ID?: string;
8136
+ __mj_CreatedAt?: Date;
8137
+ __mj_UpdatedAt?: Date;
8138
+ Status?: "Active" | "Pending";
8139
+ UserID?: string;
8140
+ User?: string;
8141
+ Role?: "Editor" | "Viewer";
8142
+ List?: string;
8143
+ ListID?: string;
8144
+ }>;
8145
+ export type ListShareEntityType = z.infer<typeof ListShareSchema>;
8067
8146
  /**
8068
8147
  * zod schema definition for the entity MJ: Projects
8069
8148
  */
@@ -8136,9 +8215,9 @@ export declare const PublicLinkSchema: z.ZodObject<{
8136
8215
  User?: string;
8137
8216
  IsActive?: boolean;
8138
8217
  ExpiresAt?: Date;
8218
+ Token?: string;
8139
8219
  ResourceType?: "Conversation" | "Artifact" | "Collection";
8140
8220
  ResourceID?: string;
8141
- Token?: string;
8142
8221
  PasswordHash?: string;
8143
8222
  MaxViews?: number;
8144
8223
  CurrentViews?: number;
@@ -8150,9 +8229,9 @@ export declare const PublicLinkSchema: z.ZodObject<{
8150
8229
  User?: string;
8151
8230
  IsActive?: boolean;
8152
8231
  ExpiresAt?: Date;
8232
+ Token?: string;
8153
8233
  ResourceType?: "Conversation" | "Artifact" | "Collection";
8154
8234
  ResourceID?: string;
8155
- Token?: string;
8156
8235
  PasswordHash?: string;
8157
8236
  MaxViews?: number;
8158
8237
  CurrentViews?: number;
@@ -10348,15 +10427,15 @@ export declare const ScheduledActionSchema: z.ZodObject<{
10348
10427
  Description?: string;
10349
10428
  Status?: "Active" | "Disabled" | "Pending" | "Expired";
10350
10429
  Type?: "Custom" | "Daily" | "Monthly" | "Weekly" | "Yearly";
10430
+ CreatedByUserID?: string;
10431
+ CreatedByUser?: string;
10351
10432
  CronExpression?: string;
10352
10433
  Timezone?: string;
10353
- CreatedByUserID?: string;
10354
10434
  IntervalDays?: number;
10355
10435
  DayOfWeek?: string;
10356
10436
  DayOfMonth?: number;
10357
10437
  Month?: string;
10358
10438
  CustomCronExpression?: string;
10359
- CreatedByUser?: string;
10360
10439
  }, {
10361
10440
  ID?: string;
10362
10441
  ActionID?: string;
@@ -10367,15 +10446,15 @@ export declare const ScheduledActionSchema: z.ZodObject<{
10367
10446
  Description?: string;
10368
10447
  Status?: "Active" | "Disabled" | "Pending" | "Expired";
10369
10448
  Type?: "Custom" | "Daily" | "Monthly" | "Weekly" | "Yearly";
10449
+ CreatedByUserID?: string;
10450
+ CreatedByUser?: string;
10370
10451
  CronExpression?: string;
10371
10452
  Timezone?: string;
10372
- CreatedByUserID?: string;
10373
10453
  IntervalDays?: number;
10374
10454
  DayOfWeek?: string;
10375
10455
  DayOfMonth?: number;
10376
10456
  Month?: string;
10377
10457
  CustomCronExpression?: string;
10378
- CreatedByUser?: string;
10379
10458
  }>;
10380
10459
  export type ScheduledActionEntityType = z.infer<typeof ScheduledActionSchema>;
10381
10460
  /**
@@ -34543,6 +34622,238 @@ export declare class EnvironmentEntity extends BaseEntity<EnvironmentEntityType>
34543
34622
  */
34544
34623
  get __mj_UpdatedAt(): Date;
34545
34624
  }
34625
+ /**
34626
+ * MJ: List Invitations - strongly typed entity sub-class
34627
+ * * Schema: __mj
34628
+ * * Base Table: ListInvitation
34629
+ * * Base View: vwListInvitations
34630
+ * * @description Tracks pending invitations for users to access lists, including external users via email.
34631
+ * * Primary Key: ID
34632
+ * @extends {BaseEntity}
34633
+ * @class
34634
+ * @public
34635
+ */
34636
+ export declare class ListInvitationEntity extends BaseEntity<ListInvitationEntityType> {
34637
+ /**
34638
+ * Loads the MJ: List Invitations record from the database
34639
+ * @param ID: string - primary key value to load the MJ: List Invitations record.
34640
+ * @param EntityRelationshipsToLoad - (optional) the relationships to load
34641
+ * @returns {Promise<boolean>} - true if successful, false otherwise
34642
+ * @public
34643
+ * @async
34644
+ * @memberof ListInvitationEntity
34645
+ * @method
34646
+ * @override
34647
+ */
34648
+ Load(ID: string, EntityRelationshipsToLoad?: string[]): Promise<boolean>;
34649
+ /**
34650
+ * * Field Name: ID
34651
+ * * Display Name: ID
34652
+ * * SQL Data Type: uniqueidentifier
34653
+ * * Default Value: newsequentialid()
34654
+ * * Description: Unique identifier for the invitation.
34655
+ */
34656
+ get ID(): string;
34657
+ set ID(value: string);
34658
+ /**
34659
+ * * Field Name: ListID
34660
+ * * Display Name: List
34661
+ * * SQL Data Type: uniqueidentifier
34662
+ * * Related Entity/Foreign Key: Lists (vwLists.ID)
34663
+ * * Description: The list the user is being invited to.
34664
+ */
34665
+ get ListID(): string;
34666
+ set ListID(value: string);
34667
+ /**
34668
+ * * Field Name: Email
34669
+ * * Display Name: Email Address
34670
+ * * SQL Data Type: nvarchar(255)
34671
+ * * Description: Email address of the invitee.
34672
+ */
34673
+ get Email(): string;
34674
+ set Email(value: string);
34675
+ /**
34676
+ * * Field Name: Role
34677
+ * * Display Name: Role
34678
+ * * SQL Data Type: nvarchar(50)
34679
+ * * Value List Type: List
34680
+ * * Possible Values
34681
+ * * Editor
34682
+ * * Viewer
34683
+ * * Description: The role to be assigned upon acceptance (Editor or Viewer).
34684
+ */
34685
+ get Role(): 'Editor' | 'Viewer';
34686
+ set Role(value: 'Editor' | 'Viewer');
34687
+ /**
34688
+ * * Field Name: Token
34689
+ * * Display Name: Token
34690
+ * * SQL Data Type: nvarchar(100)
34691
+ * * Description: Security token for validating the invitation.
34692
+ */
34693
+ get Token(): string;
34694
+ set Token(value: string);
34695
+ /**
34696
+ * * Field Name: ExpiresAt
34697
+ * * Display Name: Expires At
34698
+ * * SQL Data Type: datetime
34699
+ * * Description: When the invitation expires.
34700
+ */
34701
+ get ExpiresAt(): Date;
34702
+ set ExpiresAt(value: Date);
34703
+ /**
34704
+ * * Field Name: CreatedByUserID
34705
+ * * Display Name: Created By User ID
34706
+ * * SQL Data Type: uniqueidentifier
34707
+ * * Related Entity/Foreign Key: Users (vwUsers.ID)
34708
+ * * Description: The user who created the invitation.
34709
+ */
34710
+ get CreatedByUserID(): string;
34711
+ set CreatedByUserID(value: string);
34712
+ /**
34713
+ * * Field Name: Status
34714
+ * * Display Name: Status
34715
+ * * SQL Data Type: nvarchar(20)
34716
+ * * Default Value: Pending
34717
+ * * Value List Type: List
34718
+ * * Possible Values
34719
+ * * Accepted
34720
+ * * Expired
34721
+ * * Pending
34722
+ * * Revoked
34723
+ * * Description: Status of the invitation (Pending, Accepted, Expired, Revoked).
34724
+ */
34725
+ get Status(): 'Accepted' | 'Expired' | 'Pending' | 'Revoked';
34726
+ set Status(value: 'Accepted' | 'Expired' | 'Pending' | 'Revoked');
34727
+ /**
34728
+ * * Field Name: __mj_CreatedAt
34729
+ * * Display Name: Created At
34730
+ * * SQL Data Type: datetimeoffset
34731
+ * * Default Value: getutcdate()
34732
+ */
34733
+ get __mj_CreatedAt(): Date;
34734
+ /**
34735
+ * * Field Name: __mj_UpdatedAt
34736
+ * * Display Name: Updated At
34737
+ * * SQL Data Type: datetimeoffset
34738
+ * * Default Value: getutcdate()
34739
+ */
34740
+ get __mj_UpdatedAt(): Date;
34741
+ /**
34742
+ * * Field Name: List
34743
+ * * Display Name: List Name
34744
+ * * SQL Data Type: nvarchar(100)
34745
+ */
34746
+ get List(): string;
34747
+ /**
34748
+ * * Field Name: CreatedByUser
34749
+ * * Display Name: Created By User
34750
+ * * SQL Data Type: nvarchar(100)
34751
+ */
34752
+ get CreatedByUser(): string;
34753
+ }
34754
+ /**
34755
+ * MJ: List Shares - strongly typed entity sub-class
34756
+ * * Schema: __mj
34757
+ * * Base Table: ListShare
34758
+ * * Base View: vwListShares
34759
+ * * @description Manages user access and permissions for shared lists.
34760
+ * * Primary Key: ID
34761
+ * @extends {BaseEntity}
34762
+ * @class
34763
+ * @public
34764
+ */
34765
+ export declare class ListShareEntity extends BaseEntity<ListShareEntityType> {
34766
+ /**
34767
+ * Loads the MJ: List Shares record from the database
34768
+ * @param ID: string - primary key value to load the MJ: List Shares record.
34769
+ * @param EntityRelationshipsToLoad - (optional) the relationships to load
34770
+ * @returns {Promise<boolean>} - true if successful, false otherwise
34771
+ * @public
34772
+ * @async
34773
+ * @memberof ListShareEntity
34774
+ * @method
34775
+ * @override
34776
+ */
34777
+ Load(ID: string, EntityRelationshipsToLoad?: string[]): Promise<boolean>;
34778
+ /**
34779
+ * * Field Name: ID
34780
+ * * Display Name: ID
34781
+ * * SQL Data Type: uniqueidentifier
34782
+ * * Default Value: newsequentialid()
34783
+ * * Description: Unique identifier for the share record.
34784
+ */
34785
+ get ID(): string;
34786
+ set ID(value: string);
34787
+ /**
34788
+ * * Field Name: ListID
34789
+ * * Display Name: List
34790
+ * * SQL Data Type: uniqueidentifier
34791
+ * * Related Entity/Foreign Key: Lists (vwLists.ID)
34792
+ * * Description: The list being shared.
34793
+ */
34794
+ get ListID(): string;
34795
+ set ListID(value: string);
34796
+ /**
34797
+ * * Field Name: UserID
34798
+ * * Display Name: User
34799
+ * * SQL Data Type: uniqueidentifier
34800
+ * * Related Entity/Foreign Key: Users (vwUsers.ID)
34801
+ * * Description: The user receiving access to the list.
34802
+ */
34803
+ get UserID(): string;
34804
+ set UserID(value: string);
34805
+ /**
34806
+ * * Field Name: Role
34807
+ * * Display Name: Role
34808
+ * * SQL Data Type: nvarchar(50)
34809
+ * * Value List Type: List
34810
+ * * Possible Values
34811
+ * * Editor
34812
+ * * Viewer
34813
+ * * Description: The permission level granted (Editor or Viewer).
34814
+ */
34815
+ get Role(): 'Editor' | 'Viewer';
34816
+ set Role(value: 'Editor' | 'Viewer');
34817
+ /**
34818
+ * * Field Name: Status
34819
+ * * Display Name: Status
34820
+ * * SQL Data Type: nvarchar(20)
34821
+ * * Default Value: Active
34822
+ * * Value List Type: List
34823
+ * * Possible Values
34824
+ * * Active
34825
+ * * Pending
34826
+ * * Description: Current status of the share (Active or Pending).
34827
+ */
34828
+ get Status(): 'Active' | 'Pending';
34829
+ set Status(value: 'Active' | 'Pending');
34830
+ /**
34831
+ * * Field Name: __mj_CreatedAt
34832
+ * * Display Name: Created At
34833
+ * * SQL Data Type: datetimeoffset
34834
+ * * Default Value: getutcdate()
34835
+ */
34836
+ get __mj_CreatedAt(): Date;
34837
+ /**
34838
+ * * Field Name: __mj_UpdatedAt
34839
+ * * Display Name: Updated At
34840
+ * * SQL Data Type: datetimeoffset
34841
+ * * Default Value: getutcdate()
34842
+ */
34843
+ get __mj_UpdatedAt(): Date;
34844
+ /**
34845
+ * * Field Name: List
34846
+ * * Display Name: List Name
34847
+ * * SQL Data Type: nvarchar(100)
34848
+ */
34849
+ get List(): string;
34850
+ /**
34851
+ * * Field Name: User
34852
+ * * Display Name: User Name
34853
+ * * SQL Data Type: nvarchar(100)
34854
+ */
34855
+ get User(): string;
34856
+ }
34546
34857
  /**
34547
34858
  * MJ: Projects - strongly typed entity sub-class
34548
34859
  * * Schema: __mj