@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,466 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.ViewGridState = exports.ViewSortInfo = exports.ViewSortDirectionInfo = exports.ViewFilterInfo = exports.ViewFilterLogicInfo = exports.ViewColumnInfo = exports.ViewInfo = exports.UserViewEntityBase = void 0;
10
+ const mj_global_1 = require("mj_global");
11
+ const metadata_1 = require("../generic/metadata");
12
+ const baseEntity_1 = require("../generic/baseEntity");
13
+ const baseInfo_1 = require("../generic/baseInfo");
14
+ const runView_1 = require("./runView");
15
+ let UserViewEntityBase = class UserViewEntityBase extends baseEntity_1.BaseEntity {
16
+ constructor() {
17
+ super(...arguments);
18
+ this._ViewEntityInfo = null;
19
+ }
20
+ /**
21
+ * This is a read-only property that returns the filters for this view. This information
22
+ * is persisted in a JSON format in the FilterState column of the UserViewEntity table. To access
23
+ * the filters easily, use this property.
24
+ * @readonly
25
+ * @type {ViewFilterInfo[]}
26
+ * @memberof UserViewEntitySubclass
27
+ */
28
+ get Filter() {
29
+ if (this.FilterState) {
30
+ return [new ViewFilterInfo(JSON.parse(this.FilterState))];
31
+ }
32
+ else
33
+ return [];
34
+ }
35
+ /**
36
+ * This is a read-only property that returns the columns for this view. This information
37
+ * is persisted in a JSON format in the GridState column of the UserViewEntity table. To access
38
+ * the columns easily, use this property.
39
+ */
40
+ get Columns() {
41
+ // now, we need to do some post-processing once we've loaded the raw data so that our
42
+ // columns and filters are set up correctly
43
+ if (this.GridState) {
44
+ const gridState = JSON.parse(this.GridState);
45
+ if (gridState && gridState.columnSettings) {
46
+ const columns = gridState.columnSettings.map(c => {
47
+ // find the entity field and put it in place inside the View Metadata for easy access
48
+ if (c) {
49
+ // check to make sure the current item is non-null to ensure metadata isn't messed up
50
+ const field = this._ViewEntityInfo.Fields.find(f => f.Name.trim().toLowerCase() == c.Name.trim().toLowerCase());
51
+ return new ViewColumnInfo({ ...c, EntityField: field });
52
+ }
53
+ else {
54
+ console.log('null column setting found in view grid state for columns - ViewID: ' + this.ID);
55
+ }
56
+ });
57
+ return columns;
58
+ }
59
+ }
60
+ // if we get here, we don't have column info, return an empty array
61
+ return [];
62
+ }
63
+ /**
64
+ * The entity info for the entity that this view is based on
65
+ * @readonly
66
+ * @type {EntityInfo}
67
+ * @memberof UserViewEntitySubclass
68
+ */
69
+ get ViewEntityInfo() {
70
+ return this._ViewEntityInfo;
71
+ }
72
+ get ViewSortInfo() {
73
+ if (this.SortState) {
74
+ const sortTemp = JSON.parse(this.SortState);
75
+ if (sortTemp && sortTemp.length > 0)
76
+ return sortTemp.map(s => new ViewSortInfo(s));
77
+ }
78
+ // if we get here return a blank array
79
+ return [];
80
+ }
81
+ get OrderByClause() {
82
+ if (this.ViewSortInfo && this.ViewSortInfo.length > 0) {
83
+ return this.ViewSortInfo.map(s => s.field + (s.direction === ViewSortDirectionInfo.Asc ? '' : ' DESC')).join(', ');
84
+ }
85
+ else
86
+ return '';
87
+ }
88
+ LoadFromData(data) {
89
+ // in this case we need to make sure we ge the _ViewEntityInfo property set up correctly
90
+ if (data && data.EntityID) {
91
+ const md = new metadata_1.Metadata();
92
+ const match = md.Entities.find(e => e.ID == data.EntityID);
93
+ if (match) {
94
+ this._ViewEntityInfo = match;
95
+ }
96
+ else {
97
+ throw new Error('Unable to find entity info for entity ID: ' + data.EntityID);
98
+ }
99
+ }
100
+ return super.LoadFromData(data);
101
+ }
102
+ async Load(ID, EntityRelationshipsToLoad) {
103
+ // first load up the view info, use the superclass to do this
104
+ const result = await super.Load(ID, EntityRelationshipsToLoad);
105
+ if (result) {
106
+ const md = new metadata_1.Metadata();
107
+ // first, cache a copy of the entity info for the entity that is used in this view
108
+ const match = md.Entities.find(e => e.ID == this.EntityID);
109
+ if (match)
110
+ this._ViewEntityInfo = match;
111
+ else
112
+ throw new Error('Unable to find entity info for entity ID: ' + this.EntityID);
113
+ }
114
+ return result;
115
+ }
116
+ async Save(options) {
117
+ // we want to preprocess the Save() call because we need to regenerate the WhereClause in some situations
118
+ if (options?.IgnoreDirtyState ||
119
+ this.Fields.find(c => c.Name.toLowerCase() == 'filterstate')?.Dirty) {
120
+ // either we're ignoring dirty state or the filter state is dirty, so we need to update the where clause
121
+ this.UpdateWhereClause();
122
+ }
123
+ // now just call our superclass to do the actual save()
124
+ return super.Save(options);
125
+ }
126
+ async SetDefaultsFromEntity(e) {
127
+ this.EntityID = e.ID;
128
+ const newGridState = new ViewGridState();
129
+ newGridState.columnSettings = [];
130
+ e.Fields.filter(f => f.DefaultInView).forEach(f => {
131
+ newGridState.columnSettings.push({
132
+ ID: f.ID,
133
+ DisplayName: f.DisplayName,
134
+ Name: f.Name,
135
+ hidden: false,
136
+ width: f.DefaultColumnWidth,
137
+ orderIndex: newGridState.columnSettings.length
138
+ });
139
+ });
140
+ this.GridState = JSON.stringify(newGridState); // default columns for a view are the ones with DefaultInView turned on
141
+ }
142
+ NewRecord() {
143
+ const result = super.NewRecord();
144
+ if (result) {
145
+ if (this.ContextCurrentUser) {
146
+ this.UserID = this.ContextCurrentUser.ID;
147
+ }
148
+ else {
149
+ const md = new metadata_1.Metadata();
150
+ if (md.CurrentUser)
151
+ this.UserID = md.CurrentUser.ID;
152
+ else
153
+ throw new Error('Unable to determine current user for new view record');
154
+ }
155
+ this.Name = '';
156
+ this.IsShared = false;
157
+ this.IsDefault = false;
158
+ this.WhereClause = '';
159
+ this.Description = '';
160
+ this.FilterState = JSON.stringify({ "logic": "and", "filters": [] }); // blank default for filter
161
+ this.GridState = JSON.stringify({}); // blank object initially
162
+ this.CustomFilterState = false;
163
+ this.CustomWhereClause = false;
164
+ }
165
+ return result;
166
+ }
167
+ /**
168
+ * This method is used to update the view's filter state. It will update the FilterState column by calling GenerateWhereClause().
169
+ * It does not save anything. You still call .Save() to save the record as desired. If you want to get the new WhereClause based on the FilterState but not
170
+ * update the FilterState column, call GenerateWhereClause() directly.
171
+ */
172
+ UpdateWhereClause() {
173
+ this.WhereClause = this.GenerateWhereClause(this.FilterState, this.ViewEntityInfo);
174
+ }
175
+ Set(FieldName, Value) {
176
+ // call the superclass first and set the value internally there
177
+ super.Set(FieldName, Value);
178
+ if (FieldName.toLowerCase() == 'entityid') {
179
+ // we're updating the entityID, need to upate the _ViewEntityInfo property so it is always in sync
180
+ const md = new metadata_1.Metadata();
181
+ const match = md.Entities.find(e => e.ID == Value);
182
+ if (match)
183
+ this._ViewEntityInfo = match;
184
+ else
185
+ throw new Error('Unable to find entity info for entity ID: ' + Value);
186
+ }
187
+ }
188
+ /**
189
+ * Create a where clause for SQL from the structured filter state JSON information
190
+ * @param FilterState A string containing a valid Filter State JSON string - this uses the format that the Kendo Filter component uses which is generic and can be used anywhere
191
+ * with/without kendo
192
+ * @param EntityInfo The entity info for the entity that the UserView is based on
193
+ * @returns a string that represents a valid SQL WHERE clause
194
+ * @memberof UserViewEntitySubclass
195
+ * @example Example Filter State JSON below
196
+ FilterState = `{
197
+ "logic": "or",
198
+ "filters": [{
199
+ "field": "Name",
200
+ "operator": "startswith",
201
+ "value": "A"
202
+ }, {
203
+ "logic": "or",
204
+ "filters": [{
205
+ "field": "TotalRevenue",
206
+ "operator": "gt",
207
+ "value": 10000000
208
+ }, {
209
+ "field": "NumberEmployees",
210
+ "operator": "gte",
211
+ "value": 25
212
+ }, {
213
+ "field": "InformationTechnologyExpense",
214
+ "operator": "gte",
215
+ "value": 500000
216
+ }, {
217
+ "logic": "and",
218
+ "filters": [{
219
+ "field": "City",
220
+ "operator": "eq",
221
+ "value": "Chicago"
222
+ }, {
223
+ "field": "ActivityCount",
224
+ "operator": "gte",
225
+ "value": 5
226
+ }]
227
+ }]
228
+ }, {
229
+ "field": "LatestActivityDate",
230
+ "operator": "gte",
231
+ "value": "2023-01-01T06:00:00.000Z"
232
+ }]
233
+ }`;
234
+ */
235
+ GenerateWhereClause(FilterState, entityInfo) {
236
+ return this.processFilterGroup(JSON.parse(FilterState), entityInfo);
237
+ }
238
+ wrapQuotes(value, needQuotes) {
239
+ return needQuotes ? `'${value}'` : value;
240
+ }
241
+ convertFilterToSQL(field, operator, value, entity) {
242
+ let op = '';
243
+ let bNeedsQuotes = false;
244
+ const f = entity.Fields.find((f) => f.Name.trim().toLowerCase() === field.trim().toLowerCase());
245
+ if (!f)
246
+ throw new Error('Unable to find field ' + field + ' in entity ' + entity.Name);
247
+ switch (f.Type.toLowerCase().trim()) {
248
+ case 'nvarchar':
249
+ case 'char':
250
+ case 'varchar':
251
+ case 'text':
252
+ case 'ntext':
253
+ case 'date':
254
+ case 'datetime':
255
+ case 'datetimeoffset':
256
+ case 'time':
257
+ case 'guid':
258
+ case 'uniqueidentifier':
259
+ bNeedsQuotes = true;
260
+ break;
261
+ // all other cases do not need quotes
262
+ }
263
+ switch (operator) {
264
+ case 'eq':
265
+ op = '= ' + this.wrapQuotes(value, bNeedsQuotes);
266
+ break;
267
+ case 'neq':
268
+ op = '<> ' + this.wrapQuotes(value, bNeedsQuotes);
269
+ break;
270
+ case 'gt':
271
+ op = '> ' + this.wrapQuotes(value, bNeedsQuotes);
272
+ break;
273
+ case 'gte':
274
+ op = '>= ' + this.wrapQuotes(value, bNeedsQuotes);
275
+ break;
276
+ case 'lt':
277
+ op = '< ' + this.wrapQuotes(value, bNeedsQuotes);
278
+ break;
279
+ case 'lte':
280
+ op = '<= ' + this.wrapQuotes(value, bNeedsQuotes);
281
+ break;
282
+ case 'startswith':
283
+ op = `LIKE '${value}%'`;
284
+ break;
285
+ case 'endswith':
286
+ op = `LIKE '%${value}'`;
287
+ break;
288
+ case 'contains':
289
+ op = `LIKE '%${value}%'`;
290
+ break;
291
+ case 'doesnotcontain':
292
+ op = `NOT LIKE '%${value}%'`;
293
+ break;
294
+ case 'isnull':
295
+ case 'isempty':
296
+ op = 'IS NULL';
297
+ break;
298
+ case 'isnotnull':
299
+ case 'isnotempty':
300
+ op = 'IS NOT NULL';
301
+ break;
302
+ }
303
+ return `[${field}] ${op}`;
304
+ }
305
+ processFilterGroup(filterGroup, entity) {
306
+ // each filter has two properties, logic and filters
307
+ // logic is either 'and' or 'or' and is what we use to determine the SQL logic operator
308
+ // filters is an array of filters, each filter has a field, operator, and value,
309
+ let whereClause = '';
310
+ let bFirst = true;
311
+ const logic = filterGroup.logic.toUpperCase();
312
+ for (const filter of filterGroup.filters) {
313
+ if (!bFirst)
314
+ whereClause += ` ${logic} `;
315
+ else
316
+ bFirst = false;
317
+ // if an individual filter has a "logic" property, it's a group and we need to process it with parenthesis and recurisely
318
+ if (filter.logic && filter.logic.length > 0) {
319
+ // this is a group, we process it with parenthesis
320
+ whereClause += `(${this.processFilterGroup(filter, entity)})`;
321
+ }
322
+ else {
323
+ // this is an individual filter, easy to process
324
+ whereClause += `(${this.convertFilterToSQL(filter.field, filter.operator, filter.value, entity)})`;
325
+ }
326
+ }
327
+ return whereClause;
328
+ }
329
+ };
330
+ UserViewEntityBase = __decorate([
331
+ (0, mj_global_1.RegisterClass)(baseEntity_1.BaseEntity, 'User Views', -1) // -1 priority because we want the generated UserViewEntity class to be used ahead of this and it gets generated with a priority of 0 by default
332
+ ], UserViewEntityBase);
333
+ exports.UserViewEntityBase = UserViewEntityBase;
334
+ class ViewInfo {
335
+ /**
336
+ * Returns a list of views for the specified user. If no user is specified, the current user is used.
337
+ * @param contextUser optional, the user to use for context when loading the view
338
+ * @param entityId optional, the entity ID to filter the views by, if not provided, there is no filter on EntityID and all views for the user are returned
339
+ * @returns an array of UserViewEntityBase objects
340
+ * @memberof ViewInfo
341
+ * @static
342
+ * @async
343
+ */
344
+ static async GetViewsForUser(entityId, contextUser) {
345
+ const rv = new runView_1.RunView();
346
+ const md = new metadata_1.Metadata();
347
+ const result = await rv.RunView({
348
+ EntityName: 'User Views',
349
+ ExtraFilter: `UserID = ${contextUser ? contextUser.ID : md.CurrentUser.ID}
350
+ ${entityId ? ` AND EntityID = ${entityId}` : ''}`
351
+ });
352
+ const rd = result?.Results;
353
+ if (result && result.Success && rd)
354
+ return rd;
355
+ }
356
+ /**
357
+ * Returns a view ID for a given viewName
358
+ * @param viewName Name of the view to lookup the ID for
359
+ * @returns the ID of the User View record that matches the provided name, if found
360
+ */
361
+ static async GetViewID(viewName) {
362
+ const rv = new runView_1.RunView();
363
+ const result = await rv.RunView({ EntityName: 'User Views', ExtraFilter: `Name = '${viewName}'` });
364
+ const rd = result?.Results;
365
+ if (result && result.Success && rd && rd.length > 0) {
366
+ return rd[0].ID;
367
+ }
368
+ else {
369
+ throw new Error('Unable to find view with name: ' + viewName);
370
+ }
371
+ }
372
+ /**
373
+ * Loads a new entity object for User Views for the specified viewId and returns it if successful.
374
+ * @param viewId record ID for the view to load
375
+ * @param contextUser optional, the user to use for context when loading the view
376
+ * @returns UserViewEntityBase (or a subclass of it)
377
+ * @throws Error if the view cannot be loaded
378
+ * @memberof ViewInfo
379
+ * @static
380
+ * @async
381
+ */
382
+ static async GetViewEntity(viewId, contextUser) {
383
+ const md = new metadata_1.Metadata();
384
+ const view = await md.GetEntityObject('User Views', contextUser);
385
+ if (await view.Load(viewId))
386
+ return view;
387
+ else
388
+ throw new Error('Unable to load view with ID: ' + viewId);
389
+ }
390
+ /**
391
+ * Loads a new entity object for User Views for the specified viewName and returns it if successful.
392
+ * @param viewName name for the view to load
393
+ * @param contextUser optional, the user to use for context when loading the view
394
+ * @returns UserViewEntityBase (or a subclass of it)
395
+ * @throws Error if the view cannot be loaded
396
+ * @memberof ViewInfo
397
+ * @static
398
+ * @async
399
+ */
400
+ static async GetViewEntityByName(viewName, contextUser) {
401
+ const viewId = await ViewInfo.GetViewID(viewName);
402
+ if (viewId)
403
+ return await ViewInfo.GetViewEntity(viewId, contextUser);
404
+ else
405
+ throw new Error('Unable to find view with name: ' + viewName);
406
+ }
407
+ }
408
+ exports.ViewInfo = ViewInfo;
409
+ class ViewColumnInfo extends baseInfo_1.BaseInfo {
410
+ constructor(initData = null) {
411
+ super();
412
+ this.ID = null;
413
+ this.Name = null;
414
+ this.DisplayName = null;
415
+ this.hidden = null;
416
+ this.width = null;
417
+ this.orderIndex = null;
418
+ this.EntityField = null;
419
+ this.copyInitData(initData);
420
+ }
421
+ }
422
+ exports.ViewColumnInfo = ViewColumnInfo;
423
+ var ViewFilterLogicInfo;
424
+ (function (ViewFilterLogicInfo) {
425
+ ViewFilterLogicInfo[ViewFilterLogicInfo["And"] = 1] = "And";
426
+ ViewFilterLogicInfo[ViewFilterLogicInfo["Or"] = 2] = "Or";
427
+ })(ViewFilterLogicInfo = exports.ViewFilterLogicInfo || (exports.ViewFilterLogicInfo = {}));
428
+ class ViewFilterInfo extends baseInfo_1.BaseInfo {
429
+ constructor(initData = null) {
430
+ super();
431
+ this.logicOperator = null;
432
+ this.field = null;
433
+ this.operator = null;
434
+ this.value = null;
435
+ this.filters = [];
436
+ this.copyInitData(initData);
437
+ if (initData && initData.logic) {
438
+ this.logicOperator = initData.logic.trim().toLowerCase() == 'and' ? ViewFilterLogicInfo.And : ViewFilterLogicInfo.Or;
439
+ }
440
+ if (initData && initData.filters) {
441
+ this.filters = initData.filters.map(f => new ViewFilterInfo(f));
442
+ }
443
+ }
444
+ }
445
+ exports.ViewFilterInfo = ViewFilterInfo;
446
+ var ViewSortDirectionInfo;
447
+ (function (ViewSortDirectionInfo) {
448
+ ViewSortDirectionInfo[ViewSortDirectionInfo["Asc"] = 1] = "Asc";
449
+ ViewSortDirectionInfo[ViewSortDirectionInfo["Desc"] = 2] = "Desc";
450
+ })(ViewSortDirectionInfo = exports.ViewSortDirectionInfo || (exports.ViewSortDirectionInfo = {}));
451
+ class ViewSortInfo extends baseInfo_1.BaseInfo {
452
+ constructor(initData = null) {
453
+ super();
454
+ this.field = null;
455
+ this.direction = null;
456
+ this.copyInitData(initData);
457
+ if (initData && initData.dir && typeof initData.dir == 'string') {
458
+ this.direction = initData.dir.trim().toLowerCase() == 'asc' ? ViewSortDirectionInfo.Asc : ViewSortDirectionInfo.Desc;
459
+ }
460
+ }
461
+ }
462
+ exports.ViewSortInfo = ViewSortInfo;
463
+ class ViewGridState {
464
+ }
465
+ exports.ViewGridState = ViewGridState;
466
+ //# sourceMappingURL=UserViewEntityBase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserViewEntityBase.js","sourceRoot":"","sources":["../../src/views/UserViewEntityBase.ts"],"names":[],"mappings":";;;;;;;;;AAAA,yCAA0C;AAC1C,kDAA+C;AAC/C,sDAAmD;AACnD,kDAA+C;AAE/C,uCAAoC;AAMpC,IAAa,kBAAkB,GAA/B,MAAa,kBAAmB,SAAQ,uBAAU;IAAlD;;QACY,oBAAe,GAAe,IAAI,CAAA;IAuV9C,CAAC;IArVG;;;;;;;OAOG;IACH,IAAW,MAAM;QACb,IAAI,IAAI,CAAC,WAAW,EAAE;YAClB,OAAO,CAAC,IAAI,cAAc,C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qB,KAArB,6BAAqB,QAGhC;AACD,MAAa,YAAa,SAAQ,mBAAQ;IAItC,YAAa,WAAgB,IAAI;QAC7B,KAAK,EAAE,CAAA;QAJX,UAAK,GAAW,IAAI,CAAA;QACpB,cAAS,GAA0B,IAAI,CAAA;QAInC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAA;QAC3B,IAAI,QAAQ,IAAI,QAAQ,CAAC,GAAG,IAAI,OAAO,QAAQ,CAAC,GAAG,IAAI,QAAQ,EAAE;YAC7D,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,IAAI,KAAK,CAAC,CAAC,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,CAAC,qBAAqB,CAAC,IAAI,CAAA;SACvH;IACL,CAAC;CACJ;AAXD,oCAWC;AAGD,MAAa,aAAa;CAIzB;AAJD,sCAIC"}
@@ -0,0 +1,106 @@
1
+ import { IRunViewProvider, RunViewResult } from '../generic/interfaces';
2
+ import { UserInfo } from '../generic/securityInfo';
3
+ import { BaseEntity } from '../generic/baseEntity';
4
+ /**
5
+ * Parameters for running either a stored or dynamic view.
6
+ * A stored view is a view that is saved in the database and can be run either by ID or Name.
7
+ * A dynamic view is one that is not stored in the database and you provide parameters to return data as
8
+ * desired programatically.
9
+ */
10
+ export type RunViewParams = {
11
+ /**
12
+ * optional - ID of the UserView record to run, if provided, ViewName is ignored
13
+ */
14
+ ViewID?: number;
15
+ /**
16
+ * optional - Name of the UserView record to run, if you are using this, make sure to use a naming convention
17
+ * so that your view names are unique. For example use a prefix like __Entity_View_ etc so that you're
18
+ * likely to have a single result. If more than one view is available that matches a provided view name an
19
+ * exception will be thrown.
20
+ */
21
+ ViewName?: string;
22
+ /**
23
+ * optional - this is the loaded instance of the BaseEntity (UserViewEntityComplete or a subclass of it).
24
+ * This is the preferred parameter to use IF you already have a view entity object loaded up in your code
25
+ * becuase by passing this in, the RunView() method doesn't have to lookup all the metadata for the view and it is faster.
26
+ * If you provide ViewEntity, ViewID/ViewName are ignored.
27
+ */
28
+ ViewEntity?: BaseEntity;
29
+ /**
30
+ * optional - this is only used if ViewID/ViewName/ViewEntity are not provided, it is used for
31
+ * Dynamic Views in combination with the optional ExtraFilter
32
+ */
33
+ EntityName?: string;
34
+ /**
35
+ * An optional SQL WHERE clause that you can add to the existing filters on a stored view. For dynamic views, you can either
36
+ * run a view without a filter (if the entity definition allows it with AllowAllRowsAPI=1) or filter with any valid SQL WHERE clause.
37
+ */
38
+ ExtraFilter?: string;
39
+ /**
40
+ * An optional SQL ORDER BY clause that you can use for dynamic views, as well as to OVERRIDE the stored view's sorting order.
41
+ */
42
+ OrderBy?: string;
43
+ /**
44
+ * An optional array of field names that you want returned. The RunView() function will always return ID so you don't need to ask for that. If you leave this null then
45
+ * for a dynamic view all fields are returned, and for stored views, the fields stored in it view configuration are returned.
46
+ */
47
+ Fields?: string[];
48
+ /**
49
+ * optional - string that represents a user "search" - typically from a text search option in a UI somewhere. This field is then used in the view filtering to search whichever fields are configured to be included in search in the Entity Fields definition.
50
+ * Search String is combined with the stored view filters as well as ExtraFilter with an AND.
51
+ */
52
+ UserSearchString?: string;
53
+ /**
54
+ * optional - if provided, records that were returned in the specified UserViewRunID will NOT be allowed in the result set.
55
+ * This is useful if you want to run a particular view over time and exclude a specific prior run's resulting data set. If you
56
+ * want to exclude ALL data returned from ALL prior runs, use the ExcludeDataFromAllPriorViewRuns property instead.
57
+ */
58
+ ExcludeUserViewRunID?: number;
59
+ /**
60
+ * optional - if set to true, the resulting data will filter out ANY records that were ever returned by this view, when the SaveViewResults property was set to true.
61
+ * This is useful if you want to run a particular view over time and make sure the results returned each time are new to the view.
62
+ */
63
+ ExcludeDataFromAllPriorViewRuns?: boolean;
64
+ /**
65
+ * optional - if you are providing the optional ExcludeUserViewRunID property, you can also optionally provide
66
+ * this filter which will negate the specific list of record IDs that are excluded by the ExcludeUserViewRunID property.
67
+ * This can be useful if you want to ensure a certain class of data is always allowed into your view and not filtered out
68
+ * by a prior view run.
69
+ *
70
+ */
71
+ OverrideExcludeFilter?: string;
72
+ /**
73
+ * optional - if set to true, the LIST OF ID values from the view run will be stored in the User View Runs entity and the
74
+ * newly created UserViewRun.ID value will be returned in the RunViewResult that the RunView() function sends back to ya.
75
+ */
76
+ SaveViewResults?: boolean;
77
+ /**
78
+ * optional - if set to true, if there IS any UserViewMaxRows property set for the entity in question, it will be IGNORED. This is useful in scenarios where you
79
+ * want to programmatically run a view and get ALL the data back, regardless of the MaxRows setting on the entity.
80
+ */
81
+ IgnoreMaxRows?: boolean;
82
+ /**
83
+ * optional - if set to true, the view run will ALWAYS be logged to the Audit Log, regardless of the entity's property settings for logging view runs.
84
+ */
85
+ ForceAuditLog?: boolean;
86
+ /**
87
+ * optional - if provided and either ForceAuditLog is set, or the entity's property settings for logging view runs are set to true, this will be used as the Audit Log Description.
88
+ */
89
+ AuditLogDescription?: string;
90
+ };
91
+ /**
92
+ * Class for runnings views in a generic, tier-independent manner - uses a provider model for
93
+ * implementation transparently from the viewpoint of the consumer of the class.
94
+ */
95
+ export declare class RunView {
96
+ /**
97
+ * Runs a view based on the provided parameters, see documentation for RunViewParams for more
98
+ * @param params
99
+ * @param contextUser if provided, this user is used for permissions and logging. For server based calls, this is generally required because there is no "Current User" since this object is shared across all requests.
100
+ * @returns
101
+ */
102
+ RunView(params: RunViewParams, contextUser?: UserInfo): Promise<RunViewResult>;
103
+ private static _globalProviderKey;
104
+ static get Provider(): IRunViewProvider;
105
+ static set Provider(value: IRunViewProvider);
106
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RunView = void 0;
4
+ const mj_global_1 = require("mj_global");
5
+ /**
6
+ * Class for runnings views in a generic, tier-independent manner - uses a provider model for
7
+ * implementation transparently from the viewpoint of the consumer of the class.
8
+ */
9
+ class RunView {
10
+ /**
11
+ * Runs a view based on the provided parameters, see documentation for RunViewParams for more
12
+ * @param params
13
+ * @param contextUser if provided, this user is used for permissions and logging. For server based calls, this is generally required because there is no "Current User" since this object is shared across all requests.
14
+ * @returns
15
+ */
16
+ async RunView(params, contextUser) {
17
+ return RunView.Provider.RunView(params, contextUser);
18
+ }
19
+ static get Provider() {
20
+ const g = mj_global_1.MJGlobal.Instance.GetGlobalObjectStore();
21
+ if (g)
22
+ return g[RunView._globalProviderKey];
23
+ else
24
+ throw new Error('No global object store, so we cant get the static provider');
25
+ }
26
+ static set Provider(value) {
27
+ const g = mj_global_1.MJGlobal.Instance.GetGlobalObjectStore();
28
+ if (g)
29
+ g[RunView._globalProviderKey] = value;
30
+ else
31
+ throw new Error('No global object store, so we cant set the static provider');
32
+ }
33
+ }
34
+ RunView._globalProviderKey = 'MJ_RunViewProvider';
35
+ exports.RunView = RunView;
36
+ //# sourceMappingURL=runView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runView.js","sourceRoot":"","sources":["../../src/views/runView.ts"],"names":[],"mappings":";;;AAAA,yCAAqC;AA6FrC;;;GAGG;AACH,MAAa,OAAO;IAChB;;;;;OAKG;IACI,KAAK,CAAC,OAAO,CAAC,MAAqB,EAAE,WAAsB;QAC9D,OAAO,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACzD,CAAC;IAGM,MAAM,KAAK,QAAQ;QACtB,MAAM,CAAC,GAAG,oBAAQ,CAAC,QAAQ,CAAC,oBAAoB,EAAE,CAAC;QACnD,IAAI,CAAC;YACD,OAAO,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;;YAErC,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;IACtF,CAAC;IACM,MAAM,KAAK,QAAQ,CAAC,KAAuB;QAC9C,MAAM,CAAC,GAAG,oBAAQ,CAAC,QAAQ,CAAC,oBAAoB,EAAE,CAAC;QACnD,IAAI,CAAC;YACD,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,GAAG,KAAK,CAAC;;YAEtC,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;IACtF,CAAC;;AAdc,0BAAkB,GAAW,oBAAoB,CAAC;AAXxD,0BAAO"}
File without changes