@memberjunction/core 0.9.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.
Files changed (55) hide show
  1. package/dist/generic/applicationInfo.d.ts +26 -0
  2. package/dist/generic/applicationInfo.js +57 -0
  3. package/dist/generic/applicationInfo.js.map +1 -0
  4. package/dist/generic/baseEntity.d.ts +88 -0
  5. package/dist/generic/baseEntity.js +450 -0
  6. package/dist/generic/baseEntity.js.map +1 -0
  7. package/dist/generic/baseInfo.d.ts +8 -0
  8. package/dist/generic/baseInfo.js +38 -0
  9. package/dist/generic/baseInfo.js.map +1 -0
  10. package/dist/generic/entityInfo.d.ts +340 -0
  11. package/dist/generic/entityInfo.js +647 -0
  12. package/dist/generic/entityInfo.js.map +1 -0
  13. package/dist/generic/interfaces.d.ts +235 -0
  14. package/dist/generic/interfaces.js +51 -0
  15. package/dist/generic/interfaces.js.map +1 -0
  16. package/dist/generic/logging.d.ts +4 -0
  17. package/dist/generic/logging.js +69 -0
  18. package/dist/generic/logging.js.map +1 -0
  19. package/dist/generic/metadata.d.ts +155 -0
  20. package/dist/generic/metadata.js +227 -0
  21. package/dist/generic/metadata.js.map +1 -0
  22. package/dist/generic/providerBase.d.ts +134 -0
  23. package/dist/generic/providerBase.js +517 -0
  24. package/dist/generic/providerBase.js.map +1 -0
  25. package/dist/generic/runReport.d.ts +11 -0
  26. package/dist/generic/runReport.js +27 -0
  27. package/dist/generic/runReport.js.map +1 -0
  28. package/dist/generic/runView.d.ts +106 -0
  29. package/dist/generic/runView.js +36 -0
  30. package/dist/generic/runView.js.map +1 -0
  31. package/dist/generic/securityInfo.d.ts +99 -0
  32. package/dist/generic/securityInfo.js +195 -0
  33. package/dist/generic/securityInfo.js.map +1 -0
  34. package/dist/generic/transactionGroup.d.ts +24 -0
  35. package/dist/generic/transactionGroup.js +79 -0
  36. package/dist/generic/transactionGroup.js.map +1 -0
  37. package/dist/generic/util.d.ts +4 -0
  38. package/dist/generic/util.js +100 -0
  39. package/dist/generic/util.js.map +1 -0
  40. package/dist/generic/viewInfo.d.ts +57 -0
  41. package/dist/generic/viewInfo.js +121 -0
  42. package/dist/generic/viewInfo.js.map +1 -0
  43. package/dist/index.d.ts +15 -0
  44. package/dist/index.js +80 -0
  45. package/dist/index.js.map +1 -0
  46. package/dist/views/UserViewEntityBase.d.ts +171 -0
  47. package/dist/views/UserViewEntityBase.js +466 -0
  48. package/dist/views/UserViewEntityBase.js.map +1 -0
  49. package/dist/views/runView.d.ts +106 -0
  50. package/dist/views/runView.js +36 -0
  51. package/dist/views/runView.js.map +1 -0
  52. package/dist/views/viewInfo.d.ts +0 -0
  53. package/dist/views/viewInfo.js +118 -0
  54. package/dist/views/viewInfo.js.map +1 -0
  55. package/package.json +24 -0
@@ -0,0 +1,647 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ValidationResult = exports.ValidationErrorInfo = exports.ValidationErrorType = exports.EntityInfo = exports.EntityFieldInfo = exports.GeneratedFormSectionType = exports.EntityFieldValueInfo = exports.EntityFieldValueListType = exports.EntityFieldTSType = exports.EntityPermissionInfo = exports.EntityUserPermissionInfo = exports.EntityPermissionType = exports.EntityRelationshipInfo = exports.RecordChange = exports.RecordChangeStatus = void 0;
4
+ const baseInfo_1 = require("./baseInfo");
5
+ const metadata_1 = require("./metadata");
6
+ const util_1 = require("./util");
7
+ const logging_1 = require("./logging");
8
+ /**
9
+ * The possible status values for a record change
10
+ */
11
+ var RecordChangeStatus;
12
+ (function (RecordChangeStatus) {
13
+ RecordChangeStatus[RecordChangeStatus["Pending"] = 1] = "Pending";
14
+ RecordChangeStatus[RecordChangeStatus["Complete"] = 2] = "Complete";
15
+ RecordChangeStatus[RecordChangeStatus["Error"] = 3] = "Error";
16
+ })(RecordChangeStatus = exports.RecordChangeStatus || (exports.RecordChangeStatus = {}));
17
+ /**
18
+ * Record Change object has information on a change to a record in the Record Changes entity
19
+ */
20
+ class RecordChange extends baseInfo_1.BaseInfo {
21
+ get StatusValue() {
22
+ return RecordChangeStatus[this.Status?.trim()];
23
+ }
24
+ get Changes() {
25
+ return JSON.parse(this.ChangesJSON);
26
+ }
27
+ get FullRecord() {
28
+ return JSON.parse(this.FullRecordJSON);
29
+ }
30
+ constructor(initData) {
31
+ super();
32
+ this.EntityID = null;
33
+ this.RecordID = null;
34
+ this.ChangedAt = null;
35
+ this.ChangesJSON = null;
36
+ this.ChangesDescription = null;
37
+ this.FullRecordJSON = null;
38
+ this.Status = null;
39
+ this.copyInitData(initData);
40
+ }
41
+ }
42
+ exports.RecordChange = RecordChange;
43
+ /**
44
+ * Information about the Entity Relationship between the Entity and the Related Entity - this class
45
+ * maps to information in the Entity Relationships metadata entity.
46
+ */
47
+ class EntityRelationshipInfo extends baseInfo_1.BaseInfo {
48
+ constructor(initData) {
49
+ super();
50
+ this.EntityID = null;
51
+ this.RelatedEntityID = null;
52
+ this.BundleInAPI = null;
53
+ this.IncludeInParentAllQuery = null;
54
+ this.Type = null;
55
+ this.EntityKeyField = null;
56
+ this.RelatedEntityJoinField = null;
57
+ this.JoinView = null;
58
+ this.JoinEntityJoinField = null;
59
+ this.JoinEntityInverseJoinField = null;
60
+ this.DisplayInForm = null;
61
+ this.DisplayName = null;
62
+ this.DisplayUserViewGUID = null;
63
+ this.CreatedAt = null;
64
+ this.UpdatedAt = null;
65
+ // virtual fields - returned by the database VIEW
66
+ this.Entity = null;
67
+ this.EntityBaseTable = null;
68
+ this.EntityBaseView = null;
69
+ this.RelatedEntity = null;
70
+ this.RelatedEntityBaseTable = null;
71
+ this.RelatedEntityBaseView = null;
72
+ this.RelatedEntityCodeName = null;
73
+ this.RelatedEntityClassName = null;
74
+ this.RelatedEntityBaseTableCodeName = null;
75
+ this.copyInitData(initData);
76
+ }
77
+ }
78
+ exports.EntityRelationshipInfo = EntityRelationshipInfo;
79
+ var EntityPermissionType;
80
+ (function (EntityPermissionType) {
81
+ EntityPermissionType[EntityPermissionType["Read"] = 1] = "Read";
82
+ EntityPermissionType[EntityPermissionType["Create"] = 2] = "Create";
83
+ EntityPermissionType[EntityPermissionType["Update"] = 3] = "Update";
84
+ EntityPermissionType[EntityPermissionType["Delete"] = 4] = "Delete";
85
+ })(EntityPermissionType = exports.EntityPermissionType || (exports.EntityPermissionType = {}));
86
+ class EntityUserPermissionInfo {
87
+ }
88
+ exports.EntityUserPermissionInfo = EntityUserPermissionInfo;
89
+ class EntityPermissionInfo extends baseInfo_1.BaseInfo {
90
+ get CreateRLSFilterObject() {
91
+ return this.RLSFilter(EntityPermissionType.Create);
92
+ }
93
+ get ReadRLSFilterObject() {
94
+ return this.RLSFilter(EntityPermissionType.Read);
95
+ }
96
+ get UpdateRLSFilterObject() {
97
+ return this.RLSFilter(EntityPermissionType.Update);
98
+ }
99
+ get DeleteRLSFilterObject() {
100
+ return this.RLSFilter(EntityPermissionType.Delete);
101
+ }
102
+ RLSFilter(type) {
103
+ let fID = 0;
104
+ switch (type) {
105
+ case EntityPermissionType.Read:
106
+ fID = this.ReadRLSFilterID;
107
+ break;
108
+ case EntityPermissionType.Create:
109
+ fID = this.CreateRLSFilterID;
110
+ break;
111
+ case EntityPermissionType.Update:
112
+ fID = this.UpdateRLSFilterID;
113
+ break;
114
+ case EntityPermissionType.Delete:
115
+ fID = this.DeleteRLSFilterID;
116
+ break;
117
+ }
118
+ if (fID > 0)
119
+ return metadata_1.Metadata.Provider.RowLevelSecurityFilters.find(f => f.ID === fID);
120
+ }
121
+ constructor(initData) {
122
+ super();
123
+ this.EntityID = null;
124
+ this.RoleName = null;
125
+ this.CanCreate = null;
126
+ this.CanRead = null;
127
+ this.CanUpdate = null;
128
+ this.CanDelete = null;
129
+ this.ReadRLSFilterID = null;
130
+ this.CreateRLSFilterID = null;
131
+ this.UpdateRLSFilterID = null;
132
+ this.DeleteRLSFilterID = null;
133
+ this.CreatedAt = null;
134
+ this.UpdatedAt = null;
135
+ // virtual fields - returned by the database VIEW
136
+ this.Entity = null;
137
+ this.RoleSQLName = null;
138
+ this.ReadRLSFilter = null;
139
+ this.CreateRLSFilter = null;
140
+ this.UpdateRLSFilter = null;
141
+ this.DeleteRLSFilter = null;
142
+ this.copyInitData(initData);
143
+ }
144
+ }
145
+ exports.EntityPermissionInfo = EntityPermissionInfo;
146
+ var EntityFieldTSType;
147
+ (function (EntityFieldTSType) {
148
+ EntityFieldTSType[EntityFieldTSType["String"] = 1] = "String";
149
+ EntityFieldTSType[EntityFieldTSType["Number"] = 2] = "Number";
150
+ EntityFieldTSType[EntityFieldTSType["Date"] = 3] = "Date";
151
+ EntityFieldTSType[EntityFieldTSType["Boolean"] = 4] = "Boolean";
152
+ })(EntityFieldTSType = exports.EntityFieldTSType || (exports.EntityFieldTSType = {}));
153
+ var EntityFieldValueListType;
154
+ (function (EntityFieldValueListType) {
155
+ EntityFieldValueListType[EntityFieldValueListType["None"] = 0] = "None";
156
+ EntityFieldValueListType[EntityFieldValueListType["List"] = 1] = "List";
157
+ EntityFieldValueListType[EntityFieldValueListType["ListOrUserEntry"] = 2] = "ListOrUserEntry";
158
+ })(EntityFieldValueListType = exports.EntityFieldValueListType || (exports.EntityFieldValueListType = {}));
159
+ class EntityFieldValueInfo extends baseInfo_1.BaseInfo {
160
+ constructor(initData) {
161
+ super();
162
+ this.EntityID = null;
163
+ this.EntityFieldName = null;
164
+ this.Sequence = null;
165
+ this.Value = null;
166
+ this.Code = null;
167
+ this.Description = null;
168
+ this.CreatedAt = null;
169
+ this.UpdatedAt = null;
170
+ this.copyInitData(initData);
171
+ }
172
+ }
173
+ exports.EntityFieldValueInfo = EntityFieldValueInfo;
174
+ var GeneratedFormSectionType;
175
+ (function (GeneratedFormSectionType) {
176
+ GeneratedFormSectionType[GeneratedFormSectionType["Top"] = 0] = "Top";
177
+ GeneratedFormSectionType[GeneratedFormSectionType["Details"] = 1] = "Details";
178
+ GeneratedFormSectionType[GeneratedFormSectionType["Category"] = 2] = "Category";
179
+ })(GeneratedFormSectionType = exports.GeneratedFormSectionType || (exports.GeneratedFormSectionType = {}));
180
+ /**
181
+ * Field information within an entity - object models data from the Entity Fields entity in the metadata
182
+ */
183
+ class EntityFieldInfo extends baseInfo_1.BaseInfo {
184
+ get EntityFieldValues() {
185
+ return this._EntityFieldValues;
186
+ }
187
+ /**
188
+ * Returns the ValueListType using the EntityFieldValueListType enum.
189
+ */
190
+ get ValueListTypeEnum() {
191
+ if (this.ValueListType == null)
192
+ return EntityFieldValueListType.None;
193
+ else {
194
+ // iterate through list of possibilities from enum and compare lcase
195
+ for (let enumMember in EntityFieldValueListType) {
196
+ if (typeof EntityFieldValueListType[enumMember] === 'string' &&
197
+ enumMember.toLowerCase().trim() === this.ValueListType.toLowerCase().trim()) {
198
+ return EntityFieldValueListType[enumMember];
199
+ }
200
+ }
201
+ }
202
+ }
203
+ get GeneratedFormSectionType() {
204
+ return GeneratedFormSectionType[this.GeneratedFormSection];
205
+ }
206
+ /**
207
+ * Provides the TypeScript type for a given Entity Field. This is useful to map
208
+ * a wide array of database types to a narrower set of TypeScript types.
209
+ */
210
+ get TSType() {
211
+ switch ((0, util_1.TypeScriptTypeFromSQLType)(this.Type).toLowerCase()) {
212
+ case "number":
213
+ return EntityFieldTSType.Number;
214
+ case "boolean":
215
+ return EntityFieldTSType.Boolean;
216
+ case "date":
217
+ return EntityFieldTSType.Date;
218
+ default:
219
+ return EntityFieldTSType.String;
220
+ }
221
+ }
222
+ /**
223
+ * Returns a string with the full SQL data type that combines, as appropriate, Type, Length, Precision and Scale where these attributes are relevant to the Type
224
+ */
225
+ get SQLFullType() {
226
+ return (0, util_1.SQLFullType)(this.Type, this.Length, this.Precision, this.Scale);
227
+ }
228
+ get MaxLength() {
229
+ return (0, util_1.SQLMaxLength)(this.Type, this.Length);
230
+ }
231
+ get ReadOnly() {
232
+ return !this.AllowUpdateAPI || this.Name.toLowerCase() === 'id' || this.Type.toLowerCase() === 'uniqueidentifier';
233
+ }
234
+ /**
235
+ * Returns the DisplayName if it exists, otherwise returns the Name.
236
+ */
237
+ get DisplayNameOrName() {
238
+ return this.DisplayName ? this.DisplayName : this.Name;
239
+ }
240
+ FormatValue(value, decimals = 2, currency = 'USD') {
241
+ return (0, util_1.FormatValue)(this.Type, value, decimals, currency);
242
+ }
243
+ constructor(initData = null) {
244
+ super();
245
+ /**
246
+ * Foreign key to the Entities entity.
247
+ */
248
+ this.EntityID = null;
249
+ /**
250
+ * The sequence of the field within the entity, typically the intended display order
251
+ */
252
+ this.Sequence = null;
253
+ this.Name = null;
254
+ /**
255
+ * Optional property that provides the display name for the field, if null, use the Name property.
256
+ * The DisplayNameOrName() method is a helper function that does this for you with a single method call.
257
+ */
258
+ this.DisplayName = null;
259
+ this.Description = null;
260
+ this.Category = null;
261
+ this.Type = null;
262
+ this.Length = null;
263
+ this.Precision = null;
264
+ this.Scale = null;
265
+ this.AllowsNull = null;
266
+ this.DefaultValue = null;
267
+ this.AutoIncrement = null;
268
+ this.ValueListType = null;
269
+ this.ExtendedType = null;
270
+ this.DefaultInView = null;
271
+ this.ViewCellTemplate = null;
272
+ this.DefaultColumnWidth = null;
273
+ this.AllowUpdateAPI = null;
274
+ this.AllowUpdateInView = null;
275
+ this.IncludeInUserSearchAPI = null;
276
+ this.FullTextSearchEnabled = false;
277
+ this.UserSearchParamFormatAPI = null;
278
+ this.IncludeInGeneratedForm = null;
279
+ this.GeneratedFormSection = null;
280
+ this.IsVirtual = null;
281
+ this.IsNameField = null;
282
+ this.RelatedEntityID = null;
283
+ this.RelatedEntityFieldName = null;
284
+ this.IncludeRelatedEntityNameFieldInBaseView = null;
285
+ this.RelatedEntityNameFieldMap = null;
286
+ this.CreatedAt = null;
287
+ this.UpdatedAt = null;
288
+ // virtual fields - returned by the database VIEW
289
+ this.Entity = null;
290
+ this.SchemaName = null;
291
+ this.BaseTable = null;
292
+ this.BaseView = null;
293
+ this.EntityCodeName = null;
294
+ this.EntityClassName = null;
295
+ this.RelatedEntity = null;
296
+ this.RelatedEntitySchemaName = null;
297
+ this.RelatedEntityBaseTable = null;
298
+ this.RelatedEntityBaseView = null;
299
+ this.RelatedEntityCodeName = null;
300
+ this.RelatedEntityClassName = null;
301
+ if (initData) {
302
+ this.copyInitData(initData);
303
+ // do some special handling to create class instances instead of just data objects
304
+ // copy the Entity Field Values
305
+ this._EntityFieldValues = [];
306
+ const efv = initData.EntityFieldValues || initData._EntityFieldValues;
307
+ if (efv) {
308
+ for (let j = 0; j < efv.length; j++) {
309
+ this._EntityFieldValues.push(new EntityFieldValueInfo(efv[j]));
310
+ }
311
+ }
312
+ }
313
+ }
314
+ }
315
+ exports.EntityFieldInfo = EntityFieldInfo;
316
+ /**
317
+ * Metadata about an entity
318
+ */
319
+ class EntityInfo extends baseInfo_1.BaseInfo {
320
+ get Fields() {
321
+ return this._Fields;
322
+ }
323
+ get RelatedEntities() {
324
+ return this._RelatedEntities;
325
+ }
326
+ get Permissions() {
327
+ return this._Permissions;
328
+ }
329
+ /**
330
+ * Returns the EntityField object for the Field that has IsNameField set to true. If multiple fields have IsNameField on, the function will return the first field (by sequence) that matches. If no fields match, null is returned
331
+ */
332
+ get NameField() {
333
+ for (let j = 0; j < this.Fields.length; j++) {
334
+ const ef = this.Fields[j];
335
+ if (ef.IsNameField)
336
+ return ef;
337
+ }
338
+ return null;
339
+ }
340
+ /**
341
+ * Returns the Permissions for this entity for a given user, based on the roles the user is part of
342
+ * @param user
343
+ * @returns
344
+ */
345
+ GetUserPermisions(user) {
346
+ try {
347
+ const permissionList = [];
348
+ for (let j = 0; j < this.Permissions.length; j++) {
349
+ const ep = this.Permissions[j];
350
+ const roleMatch = user.UserRoles.find((r) => r.RoleName.trim().toLowerCase() === ep.RoleName.trim().toLowerCase());
351
+ if (roleMatch) // user has this role
352
+ permissionList.push(ep);
353
+ }
354
+ // now that we have matched any number of EntityPermissions to the current user, aggregate the permissions
355
+ const userPermission = new EntityUserPermissionInfo();
356
+ userPermission.CanCreate = false;
357
+ userPermission.CanDelete = false;
358
+ userPermission.CanRead = false;
359
+ userPermission.CanUpdate = false;
360
+ for (let j = 0; j < permissionList.length; j++) {
361
+ const ep = permissionList[j];
362
+ userPermission.CanCreate = userPermission.CanCreate || ep.CanCreate;
363
+ userPermission.CanRead = userPermission.CanRead || ep.CanRead;
364
+ userPermission.CanUpdate = userPermission.CanUpdate || ep.CanUpdate;
365
+ userPermission.CanDelete = userPermission.CanDelete || ep.CanDelete;
366
+ }
367
+ userPermission.Entity = this;
368
+ userPermission.User = user;
369
+ return userPermission;
370
+ }
371
+ catch (err) {
372
+ console.log(err);
373
+ return null;
374
+ }
375
+ }
376
+ /**
377
+ * Determines if a given user, for a given permission type, is exempt from RowLevelSecurity or not
378
+ * @param user
379
+ * @param type
380
+ * @returns
381
+ */
382
+ UserExemptFromRowLevelSecurity(user, type) {
383
+ for (let j = 0; j < this.Permissions.length; j++) {
384
+ const ep = this.Permissions[j];
385
+ const roleMatch = user.UserRoles.find((r) => r.RoleName.trim().toLowerCase() === ep.RoleName.trim().toLowerCase());
386
+ if (roleMatch) { // user has this role
387
+ switch (type) {
388
+ case EntityPermissionType.Create:
389
+ if (!ep.CreateRLSFilterID)
390
+ return true;
391
+ break;
392
+ case EntityPermissionType.Read:
393
+ if (!ep.ReadRLSFilterID)
394
+ return true;
395
+ break;
396
+ case EntityPermissionType.Update:
397
+ if (!ep.UpdateRLSFilterID)
398
+ return true;
399
+ break;
400
+ case EntityPermissionType.Delete:
401
+ if (!ep.DeleteRLSFilterID)
402
+ return true;
403
+ break;
404
+ }
405
+ }
406
+ }
407
+ return false; // if we get here, the user is NOT exempt from RLS for this Permission Type
408
+ }
409
+ /**
410
+ * Returns RLS security info attributes for a given user and permission type
411
+ * @param user
412
+ * @param type
413
+ * @returns
414
+ */
415
+ GetUserRowLevelSecurityInfo(user, type) {
416
+ const rlsList = [];
417
+ for (let j = 0; j < this.Permissions.length; j++) {
418
+ const ep = this.Permissions[j];
419
+ const roleMatch = user.UserRoles.find((r) => r.RoleName.trim().toLowerCase() === ep.RoleName.trim().toLowerCase());
420
+ if (roleMatch) { // user has this role
421
+ let matchObject = null;
422
+ switch (type) {
423
+ case EntityPermissionType.Create:
424
+ if (ep.CreateRLSFilterID)
425
+ matchObject = ep.CreateRLSFilterObject;
426
+ break;
427
+ case EntityPermissionType.Read:
428
+ if (ep.ReadRLSFilterID)
429
+ matchObject = ep.ReadRLSFilterObject;
430
+ break;
431
+ case EntityPermissionType.Update:
432
+ if (ep.UpdateRLSFilterID)
433
+ matchObject = ep.UpdateRLSFilterObject;
434
+ break;
435
+ case EntityPermissionType.Delete:
436
+ if (ep.DeleteRLSFilterID)
437
+ matchObject = ep.DeleteRLSFilterObject;
438
+ break;
439
+ }
440
+ if (matchObject) {
441
+ // we have a match, so add it to the list if it isn't already there
442
+ const existingMatch = rlsList.find((r) => r.ID === matchObject.ID);
443
+ if (!existingMatch)
444
+ rlsList.push(matchObject);
445
+ }
446
+ }
447
+ }
448
+ return rlsList;
449
+ }
450
+ /**
451
+ * Generates a where clause for SQL filtering for a given entity for a given user and permission type. If there is no RLS for a given entity or the user is exempt from RLS for the entity, a blank string is returned.
452
+ * @param user
453
+ * @param type
454
+ * @param returnPrefix
455
+ * @returns
456
+ */
457
+ GetUserRowLevelSecurityWhereClause(user, type, returnPrefix) {
458
+ const userRLS = this.GetUserRowLevelSecurityInfo(user, type);
459
+ if (userRLS && userRLS.length > 0) {
460
+ // userRLS has all of the objects that apply to this user. The user is NOT exempt from RLS, so we need to OR together all of the RLS object filters
461
+ let sRLSSQL = '';
462
+ userRLS.forEach((rls) => {
463
+ if (sRLSSQL.length > 0)
464
+ sRLSSQL += ' OR ';
465
+ sRLSSQL += `(${rls.MarkupFilterText(user)})`;
466
+ });
467
+ return sRLSSQL.length > 0 ? `${returnPrefix && returnPrefix.length > 0 ? returnPrefix + ' ' : ''}${sRLSSQL}` : '';
468
+ }
469
+ else
470
+ return '';
471
+ }
472
+ /**
473
+ * Returns a RunViewParams object that is setup to filter the related entity for the provided record
474
+ * @param record
475
+ * @param relationship
476
+ * @param filter
477
+ * @returns
478
+ */
479
+ static BuildRelationshipViewParams(record, relationship, filter) {
480
+ const params = {};
481
+ const keyValue = (relationship.EntityKeyField && relationship.EntityKeyField.length > 0 ? record.Get(relationship.EntityKeyField) : record.ID);
482
+ if (relationship.Type.trim().toLowerCase() === 'one to many') {
483
+ // one to many
484
+ params.ExtraFilter = relationship.RelatedEntityJoinField + ' = ' + keyValue;
485
+ }
486
+ else {
487
+ // many to many
488
+ params.ExtraFilter = `${relationship.RelatedEntityJoinField} IN (SELECT ${relationship.JoinEntityInverseJoinField} FROM ${relationship.JoinView} WHERE ${relationship.JoinEntityJoinField} = ${keyValue})`;
489
+ }
490
+ if (filter && filter.length > 0)
491
+ params.ExtraFilter = `(${params.ExtraFilter}) AND (${filter})`; // caller provided their own filter, so AND it in with the relationship filter we have here
492
+ if (relationship.DisplayUserViewGUID && relationship.DisplayUserViewGUID.length > 0) {
493
+ // we have been given a specific view to run, use it
494
+ params.ViewName = relationship.DisplayUserViewGUID;
495
+ }
496
+ else {
497
+ // no view specified, so specify the entity instead
498
+ params.EntityName = relationship.RelatedEntity;
499
+ }
500
+ return params;
501
+ }
502
+ constructor(initData = null) {
503
+ super();
504
+ /**
505
+ * Reserved for future use
506
+ */
507
+ this.ParentID = null;
508
+ /**
509
+ * Unique name of the entity
510
+ */
511
+ this.Name = null;
512
+ this.Description = null;
513
+ this.BaseTable = null;
514
+ this.BaseView = null;
515
+ this.BaseViewGenerated = null;
516
+ this.SchemaName = null;
517
+ this.VirtualEntity = null;
518
+ this.TrackRecordChanges = null;
519
+ this.AuditRecordAccess = null;
520
+ this.AuditViewRuns = null;
521
+ this.IncludeInAPI = false;
522
+ this.AllowAllRowsAPI = false;
523
+ this.AllowUpdateAPI = false;
524
+ this.AllowCreateAPI = false;
525
+ this.AllowDeleteAPI = false;
526
+ this.CustomResolverAPI = false;
527
+ this.AllowUserSearchAPI = false;
528
+ this.FullTextSearchEnabled = false;
529
+ this.FullTextCatalog = null;
530
+ this.FullTextCatalogGenerated = true;
531
+ this.FullTextIndex = null;
532
+ this.FullTextIndexGenerated = true;
533
+ this.FullTextSearchFunction = null;
534
+ this.FullTextSearchFunctionGenerated = true;
535
+ this.UserViewMaxRows = null;
536
+ this.spCreate = null;
537
+ this.spUpdate = null;
538
+ this.spDelete = null;
539
+ this.spCreateGenerated = null;
540
+ this.spUpdateGenerated = null;
541
+ this.spDeleteGenerated = null;
542
+ this.CascadeDeletes = null;
543
+ this.UserFormGenerated = null;
544
+ this.EntityObjectSubclassName = null;
545
+ this.EntityObjectSubclassImport = null;
546
+ this.CreatedAt = null;
547
+ this.UpdatedAt = null;
548
+ // virtual fields - returned by the database VIEW
549
+ /**
550
+ * CodeName is a unique name that can be used for various programatic purposes, singular version of the entity name but modified from entity name in some cases to remove whitespace and prefix with _ in the event that the entity name begins with a number or other non-alpha character
551
+ */
552
+ this.CodeName = null;
553
+ this.ClassName = null;
554
+ this.BaseTableCodeName = null;
555
+ this.ParentEntity = null;
556
+ this.ParentBaseTable = null;
557
+ this.ParentBaseView = null;
558
+ this._hasIdField = false;
559
+ this._virtualCount = 0;
560
+ this._manyToManyCount = 0;
561
+ this._oneToManyCount = 0;
562
+ this._floatCount = 0;
563
+ if (initData) {
564
+ this.copyInitData(initData);
565
+ // do some special handling to create class instances instead of just data objects
566
+ // copy the Entity Fields
567
+ this._Fields = [];
568
+ const ef = initData.EntityFields || initData._Fields;
569
+ if (ef) {
570
+ for (let j = 0; j < ef.length; j++) {
571
+ this._Fields.push(new EntityFieldInfo(ef[j]));
572
+ }
573
+ }
574
+ // copy the Entity Permissions
575
+ this._Permissions = [];
576
+ const ep = initData.EntityPermissions || initData._Permissions;
577
+ if (ep) {
578
+ for (let j = 0; j < ep.length; j++) {
579
+ this._Permissions.push(new EntityPermissionInfo(ep[j]));
580
+ }
581
+ }
582
+ // copy the Related Entities
583
+ this._RelatedEntities = [];
584
+ const er = initData.EntityRelationships || initData._RelatedEntities;
585
+ if (er) {
586
+ for (let j = 0; j < er.length; j++) {
587
+ this._RelatedEntities.push(new EntityRelationshipInfo(er[j]));
588
+ }
589
+ }
590
+ this.prepareSpecialFields();
591
+ }
592
+ }
593
+ prepareSpecialFields() {
594
+ try {
595
+ let virtualCount = 0;
596
+ let manyToManyCount = 0;
597
+ let oneToManyCount = 0;
598
+ let floatCount = 0;
599
+ let hasIdField = false;
600
+ for (let j = 0; j < this.Fields.length; ++j) {
601
+ const f = this.Fields[j];
602
+ if (f.Name.trim().toUpperCase() === 'ID')
603
+ hasIdField = true;
604
+ virtualCount += f.IsVirtual ? 1 : 0;
605
+ floatCount += f.IsFloat ? 1 : 0;
606
+ }
607
+ this._hasIdField = hasIdField;
608
+ this._floatCount = floatCount;
609
+ this._virtualCount = virtualCount;
610
+ // now see if there are any relationships and count the one to many and many to many
611
+ for (let j = 0; j < this.RelatedEntities.length; ++j) {
612
+ const r = this.RelatedEntities[j];
613
+ if (r.Type.trim().toUpperCase() === 'ONE TO MANY')
614
+ oneToManyCount++;
615
+ else
616
+ manyToManyCount++;
617
+ }
618
+ this._manyToManyCount = manyToManyCount;
619
+ this._oneToManyCount = oneToManyCount;
620
+ }
621
+ catch (e) {
622
+ (0, logging_1.LogError)(e);
623
+ }
624
+ }
625
+ }
626
+ exports.EntityInfo = EntityInfo;
627
+ var ValidationErrorType;
628
+ (function (ValidationErrorType) {
629
+ ValidationErrorType[ValidationErrorType["Failure"] = 0] = "Failure";
630
+ ValidationErrorType[ValidationErrorType["Warning"] = 1] = "Warning";
631
+ })(ValidationErrorType = exports.ValidationErrorType || (exports.ValidationErrorType = {}));
632
+ class ValidationErrorInfo {
633
+ constructor(Source, Message, Value, Type = ValidationErrorType.Failure) {
634
+ this.Source = Source;
635
+ this.Message = Message;
636
+ this.Value = Value;
637
+ this.Type = Type;
638
+ }
639
+ }
640
+ exports.ValidationErrorInfo = ValidationErrorInfo;
641
+ class ValidationResult {
642
+ constructor() {
643
+ this.Errors = [];
644
+ }
645
+ }
646
+ exports.ValidationResult = ValidationResult;
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