@memberjunction/core 0.9.163 → 0.9.165

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.
@@ -149,8 +149,8 @@ export declare abstract class BaseEntity {
149
149
  InnerLoad(PrimaryKeyValues: PrimaryKeyValue[], EntityRelationshipsToLoad?: string[]): Promise<boolean>;
150
150
  protected ValidatePrimaryKeyArray(PrimaryKeyValues: PrimaryKeyValue[]): void;
151
151
  /**
152
- * This method is meant to be used only in situations where you are sure that the data you are loading is current in the database. The Dirty flags and other internal state will assume what is loading from
153
- * the object is equivalent to what is in the database. Generally speaking, you should use Load() instead of this method. The main use case(s) where this makes sense are:
152
+ * This method is meant to be used only in situations where you are sure that the data you are loading is current in the database. MAKE SURE YOU ARE PASSING IN ALL FIELDS.
153
+ * The Dirty flags and other internal state will assume what is loading from the data parameter you pass in is equivalent to what is in the database. Generally speaking, you should use Load() instead of this method. The main use case(s) where this makes sense are:
154
154
  * (1) On the server if you are pulling data you know is fresh from say the result of another DB operation
155
155
  * (2) If on any tier you run a fresh RunView result, that gives you data from the database, you can then instantiate objects via Metadata.GetEntityObject() and then use this with the result from the RunView call
156
156
  * *** Note: for the #2 use case, when you call the RunView Object RunView() method with the ResultType='entity_object', you'll get an array of BaseEntity-derived objects instead of simple objects, that functionality utilizes this method
@@ -561,8 +561,8 @@ class BaseEntity {
561
561
  }
562
562
  }
563
563
  /**
564
- * This method is meant to be used only in situations where you are sure that the data you are loading is current in the database. The Dirty flags and other internal state will assume what is loading from
565
- * the object is equivalent to what is in the database. Generally speaking, you should use Load() instead of this method. The main use case(s) where this makes sense are:
564
+ * This method is meant to be used only in situations where you are sure that the data you are loading is current in the database. MAKE SURE YOU ARE PASSING IN ALL FIELDS.
565
+ * The Dirty flags and other internal state will assume what is loading from the data parameter you pass in is equivalent to what is in the database. Generally speaking, you should use Load() instead of this method. The main use case(s) where this makes sense are:
566
566
  * (1) On the server if you are pulling data you know is fresh from say the result of another DB operation
567
567
  * (2) If on any tier you run a fresh RunView result, that gives you data from the database, you can then instantiate objects via Metadata.GetEntityObject() and then use this with the result from the RunView call
568
568
  * *** Note: for the #2 use case, when you call the RunView Object RunView() method with the ResultType='entity_object', you'll get an array of BaseEntity-derived objects instead of simple objects, that functionality utilizes this method
@@ -0,0 +1,59 @@
1
+ import { BaseInfo } from '../generic/baseInfo';
2
+ import { EntityFieldInfo, EntityInfo } from '../generic/entityInfo';
3
+ import { IMetadataProvider } from '../generic/interfaces';
4
+ export declare class ViewColumnInfo extends BaseInfo {
5
+ ID: number;
6
+ Name: string;
7
+ DisplayName: string;
8
+ hidden: boolean;
9
+ width?: number;
10
+ orderIndex?: number;
11
+ EntityField: EntityFieldInfo;
12
+ constructor(initData?: any);
13
+ }
14
+ export declare const ViewFilterLogicInfo: {
15
+ readonly And: "And";
16
+ readonly Or: "Or";
17
+ };
18
+ export type ViewFilterLogicInfo = typeof ViewFilterLogicInfo[keyof typeof ViewFilterLogicInfo];
19
+ export declare class ViewFilterInfo extends BaseInfo {
20
+ logicOperator: ViewFilterLogicInfo;
21
+ field: string;
22
+ operator: string;
23
+ value: string;
24
+ filters: ViewFilterInfo[];
25
+ constructor(initData?: any);
26
+ }
27
+ export declare class ViewGridState {
28
+ sortSettings?: any;
29
+ columnSettings?: any;
30
+ filter?: any;
31
+ }
32
+ export declare class ViewInfo extends BaseInfo {
33
+ UserID: number;
34
+ EntityID: number;
35
+ Name: string;
36
+ Description: string;
37
+ CategoryID: number;
38
+ IsShared: boolean;
39
+ IsDefault: boolean;
40
+ GridState: string;
41
+ FilterState: string;
42
+ CustomFilterState: string;
43
+ WhereClause: string;
44
+ CustomWhereClause: string;
45
+ CreatedAt: Date;
46
+ UpdatedAt: Date;
47
+ UserName: string;
48
+ UserType: string;
49
+ Entity: string;
50
+ EntityBaseView: string;
51
+ private _Filter;
52
+ get Filter(): ViewFilterInfo[];
53
+ private _Columns;
54
+ get Columns(): ViewColumnInfo[];
55
+ private _EntityInfo;
56
+ get EntityInfo(): EntityInfo;
57
+ InitFromData(md: IMetadataProvider, initData: any): void;
58
+ constructor(md: IMetadataProvider, initData?: any);
59
+ }
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ViewInfo = exports.ViewGridState = exports.ViewFilterInfo = exports.ViewFilterLogicInfo = exports.ViewColumnInfo = void 0;
4
+ const baseInfo_1 = require("../generic/baseInfo");
5
+ const logging_1 = require("../generic/logging");
6
+ class ViewColumnInfo extends baseInfo_1.BaseInfo {
7
+ constructor(initData = null) {
8
+ super();
9
+ this.ID = null;
10
+ this.Name = null;
11
+ this.DisplayName = null;
12
+ this.hidden = null;
13
+ this.width = null;
14
+ this.orderIndex = null;
15
+ this.EntityField = null;
16
+ this.copyInitData(initData);
17
+ }
18
+ }
19
+ exports.ViewColumnInfo = ViewColumnInfo;
20
+ exports.ViewFilterLogicInfo = {
21
+ And: 'And',
22
+ Or: 'Or',
23
+ };
24
+ class ViewFilterInfo extends baseInfo_1.BaseInfo {
25
+ constructor(initData = null) {
26
+ super();
27
+ this.logicOperator = null;
28
+ this.field = null;
29
+ this.operator = null;
30
+ this.value = null;
31
+ this.filters = [];
32
+ this.copyInitData(initData);
33
+ if (initData && initData.logic) {
34
+ this.logicOperator = initData.logic.trim().toLowerCase() == 'and' ? exports.ViewFilterLogicInfo.And : exports.ViewFilterLogicInfo.Or;
35
+ }
36
+ if (initData && initData.filters) {
37
+ this.filters = initData.filters.map(f => new ViewFilterInfo(f));
38
+ }
39
+ }
40
+ }
41
+ exports.ViewFilterInfo = ViewFilterInfo;
42
+ class ViewGridState {
43
+ }
44
+ exports.ViewGridState = ViewGridState;
45
+ class ViewInfo extends baseInfo_1.BaseInfo {
46
+ get Filter() {
47
+ return this._Filter;
48
+ }
49
+ get Columns() {
50
+ return this._Columns;
51
+ }
52
+ get EntityInfo() {
53
+ return this._EntityInfo;
54
+ }
55
+ InitFromData(md, initData) {
56
+ try {
57
+ if (initData) {
58
+ this.copyInitData(initData);
59
+ if (initData.EntityID) {
60
+ const mdEntities = md.Entities;
61
+ const match = mdEntities.find(e => e.ID == initData.EntityID);
62
+ if (match)
63
+ this._EntityInfo = match;
64
+ }
65
+ else if (initData._EntityInfo)
66
+ this._EntityInfo = initData._EntityInfo;
67
+ // set up the filters and the columns
68
+ if (initData.GridState) {
69
+ const gridState = JSON.parse(initData.GridState);
70
+ if (gridState && gridState.columnSettings) {
71
+ this._Columns = gridState.columnSettings.map(c => {
72
+ // find the entity field and put it in place inside the View Metadata for easy access
73
+ if (c) {
74
+ // check to make sure the current item is non-null to ensure metadata isn't messed up
75
+ const field = this._EntityInfo.Fields.find(f => f.Name.trim().toLowerCase() == c.Name.trim().toLowerCase());
76
+ return new ViewColumnInfo({ ...c, EntityField: field });
77
+ }
78
+ else {
79
+ (0, logging_1.LogError)('null column setting found in view grid state for columns - ViewID: ' + initData.ID);
80
+ }
81
+ });
82
+ }
83
+ }
84
+ if (initData.FilterState) {
85
+ this._Filter = [new ViewFilterInfo(JSON.parse(initData.FilterState))];
86
+ }
87
+ }
88
+ }
89
+ catch (e) {
90
+ (0, logging_1.LogError)(e);
91
+ throw e;
92
+ }
93
+ }
94
+ constructor(md, initData = null) {
95
+ super();
96
+ this.UserID = null;
97
+ this.EntityID = null;
98
+ this.Name = null;
99
+ this.Description = null;
100
+ this.CategoryID = null;
101
+ this.IsShared = null;
102
+ this.IsDefault = null;
103
+ this.GridState = null;
104
+ this.FilterState = null;
105
+ this.CustomFilterState = null;
106
+ this.WhereClause = null;
107
+ this.CustomWhereClause = null;
108
+ this.CreatedAt = null;
109
+ this.UpdatedAt = null;
110
+ this.UserName = null;
111
+ this.UserType = null;
112
+ this.Entity = null;
113
+ this.EntityBaseView = null;
114
+ this._Filter = [];
115
+ this._Columns = [];
116
+ this._EntityInfo = null;
117
+ this.InitFromData(md, initData);
118
+ }
119
+ }
120
+ exports.ViewInfo = ViewInfo;
121
+ //# sourceMappingURL=viewInfo.js.map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AW,GAAW,IAAI,CAAA;QAC1B,sBAAiB,GAAW,IAAI,CAAA;QAChC,cAAS,GAAS,IAAI,CAAA;QACtB,cAAS,GAAS,IAAI,CAAA;QACtB,aAAQ,GAAW,IAAI,CAAA;QACvB,aAAQ,GAAW,IAAI,CAAA;QACvB,WAAM,GAAW,IAAI,CAAA;QACrB,mBAAc,GAAW,IAAI,CAAA;QAErB,YAAO,GAAqB,EAAE,CAAA;QAK9B,aAAQ,GAAqB,EAAE,CAAA;QAK/B,gBAAW,GAAe,IAAI,CAAA;QAgDlC,IAAI,CAAC,YAAY,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;IACpC,CAAC;CACJ;AAhFD,4BAgFC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/core",
3
- "version": "0.9.163",
3
+ "version": "0.9.165",
4
4
  "description": "MemberJunction: Core Library including Metadata, Application, Entity Retrieval and Manipulation, and Utilities",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",