@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,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseInfo = void 0;
4
+ class BaseInfo {
5
+ constructor() {
6
+ /**
7
+ * Primary Key
8
+ */
9
+ this.ID = null;
10
+ }
11
+ copyInitData(initData) {
12
+ if (initData) {
13
+ // copy the properties from the init data to the new class instance we are constructing
14
+ const keys = Object.keys(initData);
15
+ const thisKeys = Object.keys(this);
16
+ for (let j = 0; j < keys.length; j++) {
17
+ // make sure it is one of our keys, we don't want to create NEW fields
18
+ if (thisKeys.indexOf(keys[j]) >= 0) {
19
+ if (keys[j].trim().toLowerCase() === 'defaultvalue' && initData[keys[j]])
20
+ // strip parens from default value from the DB, if they exist, for example defaults might be ((1)) or (getdate())
21
+ this[keys[j]] = this.stripContainingParens(initData[keys[j]]);
22
+ else
23
+ this[keys[j]] = initData[keys[j]];
24
+ }
25
+ }
26
+ }
27
+ }
28
+ stripContainingParens(value) {
29
+ if (value.startsWith('(') && value.endsWith(')')) {
30
+ // recursive call so if we have ((0)) we keep stripping parens until we get to inner value
31
+ // could be something like (getdate()) in which case we'll only strip the SYMMENTRIC parens
32
+ return this.stripContainingParens(value.substring(1, value.length - 1));
33
+ }
34
+ return value;
35
+ }
36
+ }
37
+ exports.BaseInfo = BaseInfo;
38
+ //# sourceMappingURL=baseInfo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseInfo.js","sourceRoot":"","sources":["../../src/generic/baseInfo.ts"],"names":[],"mappings":";;;AAAA,MAAsB,QAAQ;IAA9B;QACI;;WAEG;QACH,OAAE,GAAW,IAAI,CAAA;IA4BrB,CAAC;IA1Ba,YAAY,CAAC,QAAa;QAChC,IAAI,QAAQ,EAAE;YACV,uFAAuF;YACvF,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACnC,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAClC,sEAAsE;gBACtE,IAAI,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE;oBAChC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,cAAc,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;wBACpE,qIAAqI;wBACrI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;;wBAE9D,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;iBACzC;aACJ;SACJ;IACL,CAAC;IAES,qBAAqB,CAAC,KAAa;QACzC,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YAC9C,0FAA0F;YAC1F,2FAA2F;YAC3F,OAAO,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;SAC3E;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AAhCD,4BAgCC"}
@@ -0,0 +1,340 @@
1
+ import { BaseInfo } from "./baseInfo";
2
+ import { RunViewParams } from "../views/runView";
3
+ import { BaseEntity } from "./baseEntity";
4
+ import { RowLevelSecurityFilterInfo, UserInfo } from "./securityInfo";
5
+ /**
6
+ * The possible status values for a record change
7
+ */
8
+ export declare enum RecordChangeStatus {
9
+ Pending = 1,
10
+ Complete = 2,
11
+ Error = 3
12
+ }
13
+ /**
14
+ * Record Change object has information on a change to a record in the Record Changes entity
15
+ */
16
+ export declare class RecordChange extends BaseInfo {
17
+ EntityID: number;
18
+ RecordID: number;
19
+ ChangedAt: Date;
20
+ ChangesJSON: string;
21
+ ChangesDescription: string;
22
+ FullRecordJSON: string;
23
+ Status: string;
24
+ get StatusValue(): RecordChangeStatus;
25
+ get Changes(): any;
26
+ get FullRecord(): any;
27
+ constructor(initData: any);
28
+ }
29
+ /**
30
+ * Information about the Entity Relationship between the Entity and the Related Entity - this class
31
+ * maps to information in the Entity Relationships metadata entity.
32
+ */
33
+ export declare class EntityRelationshipInfo extends BaseInfo {
34
+ EntityID: number;
35
+ RelatedEntityID: number;
36
+ BundleInAPI: boolean;
37
+ IncludeInParentAllQuery: boolean;
38
+ Type: string;
39
+ EntityKeyField: string;
40
+ RelatedEntityJoinField: string;
41
+ JoinView: string;
42
+ JoinEntityJoinField: string;
43
+ JoinEntityInverseJoinField: string;
44
+ DisplayInForm: boolean;
45
+ DisplayName: string;
46
+ DisplayUserViewGUID: string;
47
+ CreatedAt: Date;
48
+ UpdatedAt: Date;
49
+ Entity: string;
50
+ EntityBaseTable: string;
51
+ EntityBaseView: string;
52
+ RelatedEntity: string;
53
+ RelatedEntityBaseTable: string;
54
+ RelatedEntityBaseView: string;
55
+ RelatedEntityCodeName: string;
56
+ RelatedEntityClassName: string;
57
+ RelatedEntityBaseTableCodeName: string;
58
+ constructor(initData: any);
59
+ }
60
+ export declare enum EntityPermissionType {
61
+ Read = 1,
62
+ Create = 2,
63
+ Update = 3,
64
+ Delete = 4
65
+ }
66
+ export declare class EntityUserPermissionInfo {
67
+ Entity: EntityInfo;
68
+ User: UserInfo;
69
+ CanCreate: boolean;
70
+ CanRead: boolean;
71
+ CanUpdate: boolean;
72
+ CanDelete: boolean;
73
+ }
74
+ export declare class EntityPermissionInfo extends BaseInfo {
75
+ EntityID: number;
76
+ RoleName: string;
77
+ CanCreate: boolean;
78
+ CanRead: boolean;
79
+ CanUpdate: boolean;
80
+ CanDelete: boolean;
81
+ ReadRLSFilterID: number;
82
+ CreateRLSFilterID: number;
83
+ UpdateRLSFilterID: number;
84
+ DeleteRLSFilterID: number;
85
+ CreatedAt: Date;
86
+ UpdatedAt: Date;
87
+ Entity: string;
88
+ RoleSQLName: string;
89
+ ReadRLSFilter: string;
90
+ CreateRLSFilter: string;
91
+ UpdateRLSFilter: string;
92
+ DeleteRLSFilter: string;
93
+ get CreateRLSFilterObject(): RowLevelSecurityFilterInfo;
94
+ get ReadRLSFilterObject(): RowLevelSecurityFilterInfo;
95
+ get UpdateRLSFilterObject(): RowLevelSecurityFilterInfo;
96
+ get DeleteRLSFilterObject(): RowLevelSecurityFilterInfo;
97
+ RLSFilter(type: EntityPermissionType): RowLevelSecurityFilterInfo;
98
+ constructor(initData: any);
99
+ }
100
+ export declare enum EntityFieldTSType {
101
+ String = 1,
102
+ Number = 2,
103
+ Date = 3,
104
+ Boolean = 4
105
+ }
106
+ export declare enum EntityFieldValueListType {
107
+ "None" = 0,
108
+ "List" = 1,
109
+ "ListOrUserEntry" = 2
110
+ }
111
+ export declare class EntityFieldValueInfo extends BaseInfo {
112
+ EntityID: number;
113
+ EntityFieldName: string;
114
+ Sequence: number;
115
+ Value: string;
116
+ Code: string;
117
+ Description: string;
118
+ CreatedAt: Date;
119
+ UpdatedAt: Date;
120
+ constructor(initData: any);
121
+ }
122
+ export declare enum GeneratedFormSectionType {
123
+ Top = 0,
124
+ Details = 1,
125
+ Category = 2
126
+ }
127
+ /**
128
+ * Field information within an entity - object models data from the Entity Fields entity in the metadata
129
+ */
130
+ export declare class EntityFieldInfo extends BaseInfo {
131
+ /**
132
+ * Foreign key to the Entities entity.
133
+ */
134
+ EntityID: number;
135
+ /**
136
+ * The sequence of the field within the entity, typically the intended display order
137
+ */
138
+ Sequence: number;
139
+ Name: string;
140
+ /**
141
+ * Optional property that provides the display name for the field, if null, use the Name property.
142
+ * The DisplayNameOrName() method is a helper function that does this for you with a single method call.
143
+ */
144
+ DisplayName: string;
145
+ Description: string;
146
+ Category: string;
147
+ Type: string;
148
+ Length: number;
149
+ Precision: number;
150
+ Scale: number;
151
+ AllowsNull: boolean;
152
+ DefaultValue: string;
153
+ AutoIncrement: boolean;
154
+ ValueListType: string;
155
+ ExtendedType: string;
156
+ DefaultInView: boolean;
157
+ ViewCellTemplate: string;
158
+ DefaultColumnWidth: number;
159
+ AllowUpdateAPI: boolean;
160
+ AllowUpdateInView: boolean;
161
+ IncludeInUserSearchAPI: boolean;
162
+ FullTextSearchEnabled: boolean;
163
+ UserSearchParamFormatAPI: string;
164
+ IncludeInGeneratedForm: boolean;
165
+ GeneratedFormSection: string;
166
+ IsVirtual: boolean;
167
+ IsNameField: boolean;
168
+ RelatedEntityID: number;
169
+ RelatedEntityFieldName: string;
170
+ IncludeRelatedEntityNameFieldInBaseView: boolean;
171
+ RelatedEntityNameFieldMap: string;
172
+ CreatedAt: Date;
173
+ UpdatedAt: Date;
174
+ Entity: string;
175
+ SchemaName: string;
176
+ BaseTable: string;
177
+ BaseView: string;
178
+ EntityCodeName: string;
179
+ EntityClassName: string;
180
+ RelatedEntity: string;
181
+ RelatedEntitySchemaName: string;
182
+ RelatedEntityBaseTable: string;
183
+ RelatedEntityBaseView: string;
184
+ RelatedEntityCodeName: string;
185
+ RelatedEntityClassName: string;
186
+ IsFloat: boolean;
187
+ _RelatedEntityTableAlias: string;
188
+ _RelatedEntityNameFieldIsVirtual: boolean;
189
+ _EntityFieldValues: EntityFieldValueInfo[];
190
+ _RelatedEntityNameFieldMap: string;
191
+ get EntityFieldValues(): EntityFieldValueInfo[];
192
+ /**
193
+ * Returns the ValueListType using the EntityFieldValueListType enum.
194
+ */
195
+ get ValueListTypeEnum(): EntityFieldValueListType;
196
+ get GeneratedFormSectionType(): GeneratedFormSectionType;
197
+ /**
198
+ * Provides the TypeScript type for a given Entity Field. This is useful to map
199
+ * a wide array of database types to a narrower set of TypeScript types.
200
+ */
201
+ get TSType(): EntityFieldTSType;
202
+ /**
203
+ * 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
204
+ */
205
+ get SQLFullType(): string;
206
+ get MaxLength(): number;
207
+ get ReadOnly(): boolean;
208
+ /**
209
+ * Returns the DisplayName if it exists, otherwise returns the Name.
210
+ */
211
+ get DisplayNameOrName(): string;
212
+ FormatValue(value: any, decimals?: number, currency?: string): string;
213
+ constructor(initData?: any);
214
+ }
215
+ /**
216
+ * Metadata about an entity
217
+ */
218
+ export declare class EntityInfo extends BaseInfo {
219
+ /**
220
+ * Reserved for future use
221
+ */
222
+ ParentID: number;
223
+ /**
224
+ * Unique name of the entity
225
+ */
226
+ Name: string;
227
+ Description: string;
228
+ BaseTable: string;
229
+ BaseView: string;
230
+ BaseViewGenerated: boolean;
231
+ SchemaName: string;
232
+ VirtualEntity: boolean;
233
+ TrackRecordChanges: boolean;
234
+ AuditRecordAccess: boolean;
235
+ AuditViewRuns: boolean;
236
+ IncludeInAPI: boolean;
237
+ AllowAllRowsAPI: boolean;
238
+ AllowUpdateAPI: boolean;
239
+ AllowCreateAPI: boolean;
240
+ AllowDeleteAPI: boolean;
241
+ CustomResolverAPI: boolean;
242
+ AllowUserSearchAPI: boolean;
243
+ FullTextSearchEnabled: boolean;
244
+ FullTextCatalog: string;
245
+ FullTextCatalogGenerated: boolean;
246
+ FullTextIndex: string;
247
+ FullTextIndexGenerated: boolean;
248
+ FullTextSearchFunction: string;
249
+ FullTextSearchFunctionGenerated: boolean;
250
+ UserViewMaxRows: number;
251
+ spCreate: string;
252
+ spUpdate: string;
253
+ spDelete: string;
254
+ spCreateGenerated: boolean;
255
+ spUpdateGenerated: boolean;
256
+ spDeleteGenerated: boolean;
257
+ CascadeDeletes: boolean;
258
+ UserFormGenerated: boolean;
259
+ EntityObjectSubclassName: string;
260
+ EntityObjectSubclassImport: string;
261
+ CreatedAt: Date;
262
+ UpdatedAt: Date;
263
+ /**
264
+ * 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
265
+ */
266
+ CodeName: string;
267
+ ClassName: string;
268
+ BaseTableCodeName: string;
269
+ ParentEntity: number;
270
+ ParentBaseTable: string;
271
+ ParentBaseView: string;
272
+ private _Fields;
273
+ private _RelatedEntities;
274
+ private _Permissions;
275
+ _hasIdField: boolean;
276
+ _virtualCount: number;
277
+ _manyToManyCount: number;
278
+ _oneToManyCount: number;
279
+ _floatCount: number;
280
+ get Fields(): EntityFieldInfo[];
281
+ get RelatedEntities(): EntityRelationshipInfo[];
282
+ get Permissions(): EntityPermissionInfo[];
283
+ /**
284
+ * 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
285
+ */
286
+ get NameField(): EntityFieldInfo | null;
287
+ /**
288
+ * Returns the Permissions for this entity for a given user, based on the roles the user is part of
289
+ * @param user
290
+ * @returns
291
+ */
292
+ GetUserPermisions(user: UserInfo): EntityUserPermissionInfo;
293
+ /**
294
+ * Determines if a given user, for a given permission type, is exempt from RowLevelSecurity or not
295
+ * @param user
296
+ * @param type
297
+ * @returns
298
+ */
299
+ UserExemptFromRowLevelSecurity(user: UserInfo, type: EntityPermissionType): boolean;
300
+ /**
301
+ * Returns RLS security info attributes for a given user and permission type
302
+ * @param user
303
+ * @param type
304
+ * @returns
305
+ */
306
+ GetUserRowLevelSecurityInfo(user: UserInfo, type: EntityPermissionType): RowLevelSecurityFilterInfo[];
307
+ /**
308
+ * 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.
309
+ * @param user
310
+ * @param type
311
+ * @param returnPrefix
312
+ * @returns
313
+ */
314
+ GetUserRowLevelSecurityWhereClause(user: UserInfo, type: EntityPermissionType, returnPrefix: string): string;
315
+ /**
316
+ * Returns a RunViewParams object that is setup to filter the related entity for the provided record
317
+ * @param record
318
+ * @param relationship
319
+ * @param filter
320
+ * @returns
321
+ */
322
+ static BuildRelationshipViewParams(record: BaseEntity, relationship: EntityRelationshipInfo, filter?: string): RunViewParams;
323
+ constructor(initData?: any);
324
+ private prepareSpecialFields;
325
+ }
326
+ export declare enum ValidationErrorType {
327
+ Failure = 0,
328
+ Warning = 1
329
+ }
330
+ export declare class ValidationErrorInfo {
331
+ Source: string;
332
+ Message: string;
333
+ Value: string;
334
+ Type: ValidationErrorType;
335
+ constructor(Source: string, Message: string, Value: string, Type?: ValidationErrorType);
336
+ }
337
+ export declare class ValidationResult {
338
+ Success: boolean;
339
+ Errors: ValidationErrorInfo[];
340
+ }