@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,227 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Metadata = void 0;
4
+ const mj_global_1 = require("mj_global");
5
+ /**
6
+ * Class used to access a wide array of MemberJunction metadata, to instantiate derived classes of BaseEntity for record access and manipulation and more. This class uses a provider model where different providers transparently plug-in to implement the functionality needed based on where the code is running. The provider in use is generally not of any importance to users of the class and code can be written indepdenent of tier/provider.
7
+ */
8
+ class Metadata {
9
+ static get Provider() {
10
+ const g = mj_global_1.MJGlobal.Instance.GetGlobalObjectStore();
11
+ if (g)
12
+ return g[Metadata._globalProviderKey];
13
+ else
14
+ throw new Error('No global object store, so we cant get the static provider');
15
+ }
16
+ static set Provider(value) {
17
+ const g = mj_global_1.MJGlobal.Instance.GetGlobalObjectStore();
18
+ if (g)
19
+ g[Metadata._globalProviderKey] = value;
20
+ else
21
+ throw new Error('No global object store, so we cant set the static provider');
22
+ }
23
+ /**
24
+ * Forces a refresh of all cached metadata.
25
+ * @returns
26
+ */
27
+ async Refresh() {
28
+ return await Metadata.Provider.Refresh();
29
+ }
30
+ get Applications() {
31
+ return Metadata.Provider.Applications;
32
+ }
33
+ get Entities() {
34
+ return Metadata.Provider.Entities;
35
+ }
36
+ /**
37
+ * Returns the current user, if known. In some execution environments, mainly on server tiers like in a node.js environment, there won't be a "current user" known to Metadata since the Metadata instance is shared across all requests. In this situation you should determine the current user from the server context where you get the user payload and find the user from the UserCache.
38
+ */
39
+ get CurrentUser() {
40
+ return Metadata.Provider.CurrentUser;
41
+ }
42
+ get Roles() {
43
+ return Metadata.Provider.Roles;
44
+ }
45
+ get AuditLogTypes() {
46
+ return Metadata.Provider.AuditLogTypes;
47
+ }
48
+ get Authorizations() {
49
+ return Metadata.Provider.Authorizations;
50
+ }
51
+ /**
52
+ * Helper function to return an Entity Name from a given Entity ID.
53
+ * @param entityName
54
+ * @returns
55
+ */
56
+ EntityIDFromName(entityName) {
57
+ let entity = this.Entities.find(e => e.Name == entityName);
58
+ if (entity != null)
59
+ return entity.ID;
60
+ else
61
+ throw new Error(`Entity ${entityName} not found`);
62
+ }
63
+ /**
64
+ * Helper function to return an Entity Name from an Entity ID
65
+ * @param entityID
66
+ * @returns
67
+ */
68
+ EntityNameFromID(entityID) {
69
+ let entity = this.Entities.find(e => e.ID == entityID);
70
+ if (entity != null)
71
+ return entity.Name;
72
+ else
73
+ throw new Error(`Entity ID: ${entityID} not found`);
74
+ }
75
+ /**
76
+ * Returns true if the combination of userId/entityName/recordId has a favorite status on (meaning the user has marked the record as a "favorite" for easy access)
77
+ * @param userId
78
+ * @param entityName
79
+ * @param recordId
80
+ * @returns
81
+ */
82
+ async GetRecordFavoriteStatus(userId, entityName, recordId) {
83
+ return await Metadata.Provider.GetRecordFavoriteStatus(userId, entityName, recordId);
84
+ }
85
+ /**
86
+ * Sets the favorite status for a given user for a specific entityName/recordId
87
+ * @param userId
88
+ * @param entityName
89
+ * @param recordId
90
+ * @param isFavorite
91
+ * @param contextUser
92
+ */
93
+ async SetRecordFavoriteStatus(userId, entityName, recordId, isFavorite, contextUser = null) {
94
+ await Metadata.Provider.SetRecordFavoriteStatus(userId, entityName, recordId, isFavorite, contextUser);
95
+ }
96
+ /**
97
+ * Returns a newly created instance of a sub-class of BaseEntity. The subclass depends on the class registrations for the
98
+ * requested entity. The class registrations are managed by the MJGlobal ClassFactory component.
99
+ * @param entityName - The name of the entity to create an instance of
100
+ * @param contextUser - The user to use for context. If null, the current user is used. This is mainly used on the server side, for browser based applications generally the context will be known
101
+ * @returns - a newly created instance of a sub-class of BaseEntity. Remember you still to call Load() or NewRecord() to get going from there.
102
+ */
103
+ async GetEntityObject(entityName, contextUser = null) {
104
+ return await Metadata.Provider.GetEntityObject(entityName, contextUser);
105
+ }
106
+ /**
107
+ * Returns the Name of the specific recordId for a given entityName. This is done by
108
+ * looking for the IsNameField within the EntityFields collection for a given entity.
109
+ * If no IsNameField is found, but a field called "Name" exists, that value is returned. Otherwise null returned
110
+ * @param entityName
111
+ * @param recordId
112
+ * @returns the name of the record
113
+ */
114
+ async GetEntityRecordName(entityName, recordId) {
115
+ return await Metadata.Provider.GetEntityRecordName(entityName, recordId);
116
+ }
117
+ /**
118
+ * Returns one or more record names using the same logic as GetEntityRecordName, but for multiple records at once - more efficient to use this method if you need to get multiple record names at once
119
+ * @param info
120
+ * @returns an array of EntityRecordNameResult objects
121
+ */
122
+ async GetEntityRecordNames(info) {
123
+ return await Metadata.Provider.GetEntityRecordNames(info);
124
+ }
125
+ /**
126
+ * Creates a new TransactionGroup which can be used to bundle multiple database changes for BaseEntity derived classes to be processed as a single database transaction
127
+ * @returns
128
+ */
129
+ async CreateTransactionGroup() {
130
+ return await Metadata.Provider.CreateTransactionGroup();
131
+ }
132
+ /**
133
+ * Saves all the in-memory metadata to be updated in the local persistent storage method (which varies by provider). This generally shouldn't need to be called externally but is available to force an update to local storage as desired.
134
+ */
135
+ SaveLocalMetadataToStorage() {
136
+ Metadata.Provider.SaveLocalMetadataToStorage();
137
+ }
138
+ /**
139
+ * Returns the local storage provider. This is used to store metadata locally on the client.
140
+ * @returns - the local storage provider
141
+ * @remarks - Use this for storing any type of data on the client. The Provider implements the storage mechanism which is persistent whenever possible, but in some cases purely in memory if local persistence is not available. Keep in mind that you must ensure that keys are unique so prefix all of your keys with something unique to avoid collisions.
142
+ */
143
+ get LocalStorageProvider() {
144
+ return Metadata.Provider.LocalStorageProvider;
145
+ }
146
+ /**
147
+ * Retrieves the date status information for a dataset and all its items from the server. This method will match the datasetName and itemFilters to the server's dataset and item filters to determine a match
148
+ * @param datasetName
149
+ * @param itemFilters
150
+ */
151
+ async GetDatasetStatusByName(datasetName, itemFilters) {
152
+ return Metadata.Provider.GetDatasetStatusByName(datasetName, itemFilters);
153
+ }
154
+ /**
155
+ * Always retrieves data from the server - this method does NOT check cache. To use cached local values if available, call GetAndCacheDatasetByName() instead
156
+ * @param datasetName
157
+ * @param itemFilters
158
+ */
159
+ async GetDatasetByName(datasetName, itemFilters) {
160
+ return Metadata.Provider.GetDatasetByName(datasetName, itemFilters);
161
+ }
162
+ /**
163
+ * Gets a database by name, if required, and caches it in a format available to the client (e.g. IndexedDB, LocalStorage, File, etc). The cache method is Provider specific
164
+ * If itemFilters are provided, the combination of datasetName and the filters are used to determine a match in the cache
165
+ * @param datasetName
166
+ * @param itemFilters
167
+ */
168
+ async GetAndCacheDatasetByName(datasetName, itemFilters) {
169
+ return Metadata.Provider.GetAndCacheDatasetByName(datasetName, itemFilters);
170
+ }
171
+ /**
172
+ * This routine checks to see if the local cache version of a given datasetName/itemFilters combination is up to date with the server or not
173
+ * @param datasetName
174
+ * @param itemFilters
175
+ * @returns
176
+ */
177
+ async IsDatasetCacheUpToDate(datasetName, itemFilters) {
178
+ return Metadata.Provider.IsDatasetCacheUpToDate(datasetName, itemFilters);
179
+ }
180
+ /**
181
+ * This routine gets the local cached version of a given datasetName/itemFilters combination, it does NOT check the server status first.
182
+ * @param datasetName
183
+ * @param itemFilters
184
+ * @returns
185
+ */
186
+ async GetCachedDataset(datasetName, itemFilters) {
187
+ return Metadata.Provider.GetCachedDataset(datasetName, itemFilters);
188
+ }
189
+ /**
190
+ * Stores a dataset in the local cache. If itemFilters are provided, the combination of datasetName and the filters are used to build a key and determine a match in the cache
191
+ * @param datasetName
192
+ * @param itemFilters
193
+ * @param dataset
194
+ */
195
+ async CacheDataset(datasetName, itemFilters, dataset) {
196
+ return Metadata.Provider.CacheDataset(datasetName, itemFilters, dataset);
197
+ }
198
+ /**
199
+ * Determines if a given datasetName/itemFilters combination is cached locally or not
200
+ * @param datasetName
201
+ * @param itemFilters
202
+ * @returns
203
+ */
204
+ async IsDatasetCached(datasetName, itemFilters) {
205
+ return Metadata.Provider.IsDatasetCached(datasetName, itemFilters);
206
+ }
207
+ /**
208
+ * Creates a key for the given datasetName and itemFilters combination
209
+ * @param datasetName
210
+ * @param itemFilters
211
+ * @returns
212
+ */
213
+ GetDatasetCacheKey(datasetName, itemFilters) {
214
+ return Metadata.Provider.GetDatasetCacheKey(datasetName, itemFilters);
215
+ }
216
+ /**
217
+ * If the specified datasetName is cached, this method will clear the cache. If itemFilters are provided, the combination of datasetName and the filters are used to determine a match in the cache
218
+ * @param datasetName
219
+ * @param itemFilters
220
+ */
221
+ async ClearDatasetCache(datasetName, itemFilters) {
222
+ return Metadata.Provider.ClearDatasetCache(datasetName, itemFilters);
223
+ }
224
+ }
225
+ Metadata._globalProviderKey = 'MJ_MetadataProvider';
226
+ exports.Metadata = Metadata;
227
+ //# sourceMappingURL=metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../src/generic/metadata.ts"],"names":[],"mappings":";;;AAMA,yCAAqC;AAErC;;GAEG;AACH,MAAa,QAAQ;IAEV,MAAM,KAAK,QAAQ;QACtB,MAAM,CAAC,GAAG,oBAAQ,CAAC,QAAQ,CAAC,oBAAoB,EAAE,CAAC;QACnD,IAAI,CAAC;YACD,OAAO,CAAC,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;;YAEtC,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;IACtF,CAAC;IACM,MAAM,KAAK,QAAQ,CAAC,KAAwB;QAC/C,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G;IACI,KAAK,CAAC,eAAe,CAAC,WAAmB,EAAE,WAAqC;QACnF,OAAO,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IACvE,CAAC;IAED;;;;;OAKG;IACI,kBAAkB,CAAC,WAAmB,EAAE,WAAqC;QAChF,OAAO,QAAQ,CAAC,QAAQ,CAAC,kBAAkB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAC1E,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,iBAAiB,CAAC,WAAmB,EAAE,WAAqC;QACrF,OAAO,QAAQ,CAAC,QAAQ,CAAC,iBAAiB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IACzE,CAAC;;AAjPc,2BAAkB,GAAW,qBAAqB,CAAC;AADzD,4BAAQ"}
@@ -0,0 +1,134 @@
1
+ import { BaseEntity } from "./baseEntity";
2
+ import { EntityInfo } from "./entityInfo";
3
+ import { IMetadataProvider, ProviderConfigDataBase, MetadataInfo, ILocalStorageProvider, DatasetResultType, DatasetStatusResultType, DatasetItemFilterType, EntityRecordNameInput, EntityRecordNameResult } from "./interfaces";
4
+ import { ApplicationInfo } from "../generic/applicationInfo";
5
+ import { AuditLogTypeInfo, AuthorizationInfo, RoleInfo, RowLevelSecurityFilterInfo, UserInfo } from "./securityInfo";
6
+ import { TransactionGroupBase } from "./transactionGroup";
7
+ export type AllMetadata = {
8
+ AllEntities: EntityInfo[];
9
+ AllApplications: ApplicationInfo[];
10
+ CurrentUser: UserInfo;
11
+ AllRoles: RoleInfo[];
12
+ AllRowLevelSecurityFilters: RowLevelSecurityFilterInfo[];
13
+ AllAuditLogTypes: AuditLogTypeInfo[];
14
+ AllAuthorizations: AuthorizationInfo[];
15
+ };
16
+ export declare abstract class ProviderBase implements IMetadataProvider {
17
+ private _ConfigData;
18
+ private _latestLocalMetadataTimestamps;
19
+ private _latestRemoteMetadataTimestamps;
20
+ private _entities;
21
+ private _applications;
22
+ private _currentUser;
23
+ private _roles;
24
+ private _rowLevelSecurityFilters;
25
+ private _auditLogTypes;
26
+ private _authorizations;
27
+ private _refresh;
28
+ /******** ABSTRACT SECTION ****************************************************************** */
29
+ protected abstract AllowRefresh(): boolean;
30
+ abstract GetEntityRecordName(entityName: string, recordId: number): Promise<string>;
31
+ abstract GetEntityRecordNames(info: EntityRecordNameInput[]): Promise<EntityRecordNameResult[]>;
32
+ abstract GetRecordFavoriteStatus(userId: number, entityName: string, recordId: number): Promise<boolean>;
33
+ abstract SetRecordFavoriteStatus(userId: number, entityName: string, recordId: number, isFavorite: boolean, contextUser: UserInfo): Promise<void>;
34
+ /******** END - ABSTRACT SECTION ****************************************************************** */
35
+ Config(data: ProviderConfigDataBase): Promise<boolean>;
36
+ protected BuildDatasetFilterFromConfig(): DatasetItemFilterType[];
37
+ protected static _mjMetadataDatasetName: string;
38
+ protected GetAllMetadata(): Promise<AllMetadata>;
39
+ protected abstract GetCurrentUser(): Promise<UserInfo>;
40
+ protected PostProcessEntityMetadata(entities: any[], fields: any[], fieldValues: any[], permissions: any[], relationships: any[]): any[];
41
+ get ConfigData(): ProviderConfigDataBase;
42
+ get Entities(): EntityInfo[];
43
+ get Applications(): ApplicationInfo[];
44
+ get CurrentUser(): UserInfo;
45
+ get Roles(): RoleInfo[];
46
+ get RowLevelSecurityFilters(): RowLevelSecurityFilterInfo[];
47
+ get AuditLogTypes(): AuditLogTypeInfo[];
48
+ get Authorizations(): AuthorizationInfo[];
49
+ Refresh(): Promise<boolean>;
50
+ IsRefreshNeeded(): Promise<boolean>;
51
+ RefreshIfNeeded(): Promise<boolean>;
52
+ GetEntityObject(entityName: string, contextUser?: UserInfo): Promise<BaseEntity>;
53
+ /**
54
+ * Always retrieves data from the server - this method does NOT check cache. To use cached local values if available, call GetAndCacheDatasetByName() instead
55
+ * @param datasetName
56
+ * @param itemFilters
57
+ */
58
+ abstract GetDatasetByName(datasetName: string, itemFilters?: DatasetItemFilterType[]): Promise<DatasetResultType>;
59
+ /**
60
+ * Retrieves the date status information for a dataset and all its items from the server. This method will match the datasetName and itemFilters to the server's dataset and item filters to determine a match
61
+ * @param datasetName
62
+ * @param itemFilters
63
+ */
64
+ abstract GetDatasetStatusByName(datasetName: string, itemFilters?: DatasetItemFilterType[]): Promise<DatasetStatusResultType>;
65
+ /**
66
+ * Gets a database by name, if required, and caches it in a format available to the client (e.g. IndexedDB, LocalStorage, File, etc). The cache method is Provider specific
67
+ * If itemFilters are provided, the combination of datasetName and the filters are used to determine a match in the cache
68
+ * @param datasetName
69
+ * @param itemFilters
70
+ */
71
+ GetAndCacheDatasetByName(datasetName: string, itemFilters?: DatasetItemFilterType[]): Promise<DatasetResultType>;
72
+ /**
73
+ * This routine checks to see if the local cache version of a given datasetName/itemFilters combination is up to date with the server or not
74
+ * @param datasetName
75
+ * @param itemFilters
76
+ * @returns
77
+ */
78
+ IsDatasetCacheUpToDate(datasetName: string, itemFilters?: DatasetItemFilterType[]): Promise<boolean>;
79
+ /**
80
+ * This routine gets the local cached version of a given datasetName/itemFilters combination, it does NOT check the server status first and does not fall back on the server if there isn't a local cache version of this dataset/itemFilters combination
81
+ * @param datasetName
82
+ * @param itemFilters
83
+ * @returns
84
+ */
85
+ GetCachedDataset(datasetName: string, itemFilters?: DatasetItemFilterType[]): Promise<DatasetResultType>;
86
+ /**
87
+ * Stores a dataset in the local cache. If itemFilters are provided, the combination of datasetName and the filters are used to build a key and determine a match in the cache
88
+ * @param datasetName
89
+ * @param itemFilters
90
+ * @param dataset
91
+ */
92
+ CacheDataset(datasetName: string, itemFilters: DatasetItemFilterType[], dataset: DatasetResultType): Promise<void>;
93
+ /**
94
+ * Determines if a given datasetName/itemFilters combination is cached locally or not
95
+ * @param datasetName
96
+ * @param itemFilters
97
+ * @returns
98
+ */
99
+ IsDatasetCached(datasetName: string, itemFilters?: DatasetItemFilterType[]): Promise<boolean>;
100
+ /**
101
+ * Creates a key for the given datasetName and itemFilters combination
102
+ * @param datasetName
103
+ * @param itemFilters
104
+ * @returns
105
+ */
106
+ GetDatasetCacheKey(datasetName: string, itemFilters?: DatasetItemFilterType[]): string;
107
+ protected ConvertItemFiltersToUniqueKey(itemFilters: DatasetItemFilterType[]): string;
108
+ /**
109
+ * If the specified datasetName is cached, this method will clear the cache. If itemFilters are provided, the combination of datasetName and the filters are used to determine a match in the cache
110
+ * @param datasetName
111
+ * @param itemFilters
112
+ */
113
+ ClearDatasetCache(datasetName: string, itemFilters?: DatasetItemFilterType[]): Promise<void>;
114
+ abstract CreateTransactionGroup(): Promise<TransactionGroupBase>;
115
+ get LatestRemoteMetadata(): MetadataInfo[];
116
+ get LatestLocalMetadata(): MetadataInfo[];
117
+ protected GetLatestMetadataUpdates(): Promise<MetadataInfo[]>;
118
+ RefreshRemoteMetadataTimestamps(): Promise<boolean>;
119
+ LocalMetadataObsolete(type?: string): boolean;
120
+ protected UpdateLocalMetadata(res: AllMetadata): void;
121
+ abstract get LocalStorageProvider(): ILocalStorageProvider;
122
+ protected LoadLocalMetadataFromStorage(): Promise<void>;
123
+ private static localStorageRootKey;
124
+ private static localStorageTimestampsKey;
125
+ private static localStorageEntitiesKey;
126
+ private static localStorageApplicationsKey;
127
+ private static localStorageCurrentUserKey;
128
+ private static localStorageRolesKey;
129
+ private static localStorageRowLevelSecurityFiltersKey;
130
+ private static localStorageAuditLogTypesKey;
131
+ private static localStorageAuthorizationsKey;
132
+ SaveLocalMetadataToStorage(): Promise<void>;
133
+ protected abstract get Metadata(): IMetadataProvider;
134
+ }