@memberjunction/global 5.0.0 → 5.2.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 (138) hide show
  1. package/README.md +19 -3
  2. package/dist/DynamicPackageLoader.d.ts +61 -0
  3. package/dist/DynamicPackageLoader.d.ts.map +1 -0
  4. package/dist/DynamicPackageLoader.js +56 -0
  5. package/dist/DynamicPackageLoader.js.map +1 -0
  6. package/dist/SQLExpressionValidator.d.ts +31 -4
  7. package/dist/SQLExpressionValidator.d.ts.map +1 -1
  8. package/dist/SQLExpressionValidator.js +107 -22
  9. package/dist/SQLExpressionValidator.js.map +1 -1
  10. package/dist/__tests__/SQLExpressionValidator.security.test.d.ts +2 -0
  11. package/dist/__tests__/SQLExpressionValidator.security.test.d.ts.map +1 -0
  12. package/dist/__tests__/SQLExpressionValidator.security.test.js +328 -0
  13. package/dist/__tests__/SQLExpressionValidator.security.test.js.map +1 -0
  14. package/dist/__tests__/SQLExpressionValidator.test.d.ts +2 -0
  15. package/dist/__tests__/SQLExpressionValidator.test.d.ts.map +1 -0
  16. package/dist/__tests__/SQLExpressionValidator.test.js +350 -0
  17. package/dist/__tests__/SQLExpressionValidator.test.js.map +1 -0
  18. package/dist/index.d.ts +1 -0
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +1 -0
  21. package/dist/index.js.map +1 -1
  22. package/package.json +1 -1
  23. package/dist/Core.d.ts +0 -29
  24. package/dist/Core.d.ts.map +0 -1
  25. package/dist/Core.js +0 -58
  26. package/dist/Core.js.map +0 -1
  27. package/dist/generic/QueryCache.d.ts +0 -85
  28. package/dist/generic/QueryCache.d.ts.map +0 -1
  29. package/dist/generic/QueryCache.js +0 -198
  30. package/dist/generic/QueryCache.js.map +0 -1
  31. package/dist/generic/QueryCacheConfig.d.ts +0 -72
  32. package/dist/generic/QueryCacheConfig.d.ts.map +0 -1
  33. package/dist/generic/QueryCacheConfig.js +0 -3
  34. package/dist/generic/QueryCacheConfig.js.map +0 -1
  35. package/dist/generic/applicationInfo.d.ts +0 -138
  36. package/dist/generic/applicationInfo.d.ts.map +0 -1
  37. package/dist/generic/applicationInfo.js +0 -177
  38. package/dist/generic/applicationInfo.js.map +0 -1
  39. package/dist/generic/authEvaluator.d.ts +0 -25
  40. package/dist/generic/authEvaluator.d.ts.map +0 -1
  41. package/dist/generic/authEvaluator.js +0 -49
  42. package/dist/generic/authEvaluator.js.map +0 -1
  43. package/dist/generic/authTypes.d.ts +0 -193
  44. package/dist/generic/authTypes.d.ts.map +0 -1
  45. package/dist/generic/authTypes.js +0 -19
  46. package/dist/generic/authTypes.js.map +0 -1
  47. package/dist/generic/baseEngine.d.ts +0 -260
  48. package/dist/generic/baseEngine.d.ts.map +0 -1
  49. package/dist/generic/baseEngine.js +0 -510
  50. package/dist/generic/baseEngine.js.map +0 -1
  51. package/dist/generic/baseEntity.d.ts +0 -691
  52. package/dist/generic/baseEntity.d.ts.map +0 -1
  53. package/dist/generic/baseEntity.js +0 -1688
  54. package/dist/generic/baseEntity.js.map +0 -1
  55. package/dist/generic/baseInfo.d.ts +0 -24
  56. package/dist/generic/baseInfo.d.ts.map +0 -1
  57. package/dist/generic/baseInfo.js +0 -53
  58. package/dist/generic/baseInfo.js.map +0 -1
  59. package/dist/generic/compositeKey.d.ts +0 -206
  60. package/dist/generic/compositeKey.d.ts.map +0 -1
  61. package/dist/generic/compositeKey.js +0 -412
  62. package/dist/generic/compositeKey.js.map +0 -1
  63. package/dist/generic/databaseProviderBase.d.ts +0 -46
  64. package/dist/generic/databaseProviderBase.d.ts.map +0 -1
  65. package/dist/generic/databaseProviderBase.js +0 -14
  66. package/dist/generic/databaseProviderBase.js.map +0 -1
  67. package/dist/generic/entityInfo.d.ts +0 -983
  68. package/dist/generic/entityInfo.d.ts.map +0 -1
  69. package/dist/generic/entityInfo.js +0 -1401
  70. package/dist/generic/entityInfo.js.map +0 -1
  71. package/dist/generic/explorerNavigationItem.d.ts +0 -20
  72. package/dist/generic/explorerNavigationItem.d.ts.map +0 -1
  73. package/dist/generic/explorerNavigationItem.js +0 -29
  74. package/dist/generic/explorerNavigationItem.js.map +0 -1
  75. package/dist/generic/interfaces.d.ts +0 -610
  76. package/dist/generic/interfaces.d.ts.map +0 -1
  77. package/dist/generic/interfaces.js +0 -211
  78. package/dist/generic/interfaces.js.map +0 -1
  79. package/dist/generic/libraryInfo.d.ts +0 -40
  80. package/dist/generic/libraryInfo.d.ts.map +0 -1
  81. package/dist/generic/libraryInfo.js +0 -56
  82. package/dist/generic/libraryInfo.js.map +0 -1
  83. package/dist/generic/logging.d.ts +0 -179
  84. package/dist/generic/logging.d.ts.map +0 -1
  85. package/dist/generic/logging.js +0 -382
  86. package/dist/generic/logging.js.map +0 -1
  87. package/dist/generic/metadata.d.ts +0 -305
  88. package/dist/generic/metadata.d.ts.map +0 -1
  89. package/dist/generic/metadata.js +0 -454
  90. package/dist/generic/metadata.js.map +0 -1
  91. package/dist/generic/metadataUtil.d.ts +0 -8
  92. package/dist/generic/metadataUtil.d.ts.map +0 -1
  93. package/dist/generic/metadataUtil.js +0 -36
  94. package/dist/generic/metadataUtil.js.map +0 -1
  95. package/dist/generic/providerBase.d.ts +0 -546
  96. package/dist/generic/providerBase.d.ts.map +0 -1
  97. package/dist/generic/providerBase.js +0 -999
  98. package/dist/generic/providerBase.js.map +0 -1
  99. package/dist/generic/queryInfo.d.ts +0 -460
  100. package/dist/generic/queryInfo.d.ts.map +0 -1
  101. package/dist/generic/queryInfo.js +0 -633
  102. package/dist/generic/queryInfo.js.map +0 -1
  103. package/dist/generic/querySQLFilters.d.ts +0 -54
  104. package/dist/generic/querySQLFilters.d.ts.map +0 -1
  105. package/dist/generic/querySQLFilters.js +0 -84
  106. package/dist/generic/querySQLFilters.js.map +0 -1
  107. package/dist/generic/runQuery.d.ts +0 -96
  108. package/dist/generic/runQuery.d.ts.map +0 -1
  109. package/dist/generic/runQuery.js +0 -66
  110. package/dist/generic/runQuery.js.map +0 -1
  111. package/dist/generic/runQuerySQLFilterImplementations.d.ts +0 -51
  112. package/dist/generic/runQuerySQLFilterImplementations.d.ts.map +0 -1
  113. package/dist/generic/runQuerySQLFilterImplementations.js +0 -238
  114. package/dist/generic/runQuerySQLFilterImplementations.js.map +0 -1
  115. package/dist/generic/runReport.d.ts +0 -25
  116. package/dist/generic/runReport.d.ts.map +0 -1
  117. package/dist/generic/runReport.js +0 -42
  118. package/dist/generic/runReport.js.map +0 -1
  119. package/dist/generic/securityInfo.d.ts +0 -355
  120. package/dist/generic/securityInfo.d.ts.map +0 -1
  121. package/dist/generic/securityInfo.js +0 -425
  122. package/dist/generic/securityInfo.js.map +0 -1
  123. package/dist/generic/transactionGroup.d.ts +0 -184
  124. package/dist/generic/transactionGroup.d.ts.map +0 -1
  125. package/dist/generic/transactionGroup.js +0 -357
  126. package/dist/generic/transactionGroup.js.map +0 -1
  127. package/dist/generic/util.d.ts +0 -81
  128. package/dist/generic/util.d.ts.map +0 -1
  129. package/dist/generic/util.js +0 -301
  130. package/dist/generic/util.js.map +0 -1
  131. package/dist/views/runView.d.ts +0 -150
  132. package/dist/views/runView.d.ts.map +0 -1
  133. package/dist/views/runView.js +0 -100
  134. package/dist/views/runView.js.map +0 -1
  135. package/dist/views/viewInfo.d.ts +0 -121
  136. package/dist/views/viewInfo.d.ts.map +0 -1
  137. package/dist/views/viewInfo.js +0 -182
  138. package/dist/views/viewInfo.js.map +0 -1
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AuthorizationEvaluator = void 0;
4
- const metadata_1 = require("./metadata.js");
5
- /**
6
- * This class handles the execution of various types of authorization evaluations and contains utility methods as well.
7
- */
8
- class AuthorizationEvaluator {
9
- /**
10
- * Determines if the current user can execute actions under the provided authorization.
11
- * @param auth
12
- * @returns
13
- */
14
- CurrentUserCanExecute(auth) {
15
- const md = new metadata_1.Metadata();
16
- if (!md.CurrentUser)
17
- throw new Error('No current user is set for authorization evaluation');
18
- return this.UserCanExecute(auth, md.CurrentUser);
19
- }
20
- /**
21
- * Determines if a given user can execute actions under the provided authorization.
22
- *
23
- * @param {AuthorizationInfo} auth - The authorization to check for execution rights.
24
- * @param {UserInfo} user - The user to check for execution rights.
25
- * @returns {boolean} True if the user can execute actions under the authorization, otherwise false.
26
- */
27
- UserCanExecute(auth, user) {
28
- return auth.UserCanExecute(user);
29
- }
30
- /**
31
- * Returns an array of authorizations that a given user can execute based on their roles.
32
- */
33
- GetUserAuthorizations(user) {
34
- const md = new metadata_1.Metadata();
35
- const ret = [];
36
- if (user && user.UserRoles) {
37
- for (const a of md.Authorizations) {
38
- // for each system authorization, check to see if any of our roles can execute it
39
- if (a.UserCanExecute(user))
40
- ret.push(a);
41
- }
42
- return ret;
43
- }
44
- else
45
- throw new Error('User must be provided to evaluate authorizations');
46
- }
47
- }
48
- exports.AuthorizationEvaluator = AuthorizationEvaluator;
49
- //# sourceMappingURL=authEvaluator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authEvaluator.js","sourceRoot":"","sources":["../../src/generic/authEvaluator.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AAGtC;;GAEG;AACH,MAAa,sBAAsB;IAC/B;;;;OAIG;IACI,qBAAqB,CAAC,IAAuB;QAChD,MAAM,EAAE,GAAG,IAAI,mBAAQ,EAAE,CAAC;QAC1B,IAAI,CAAC,EAAE,CAAC,WAAW;YACf,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAA;QAE1E,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,CAAA;IACpD,CAAC;IAED;;;;;;OAMG;IACI,cAAc,CAAC,IAAuB,EAAE,IAAc;QACzD,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA;IACpC,CAAC;IAED;;OAEG;IACI,qBAAqB,CAAC,IAAc;QACvC,MAAM,EAAE,GAAG,IAAI,mBAAQ,EAAE,CAAC;QAC1B,MAAM,GAAG,GAAwB,EAAE,CAAA;QACnC,IAAI,IAAI,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACzB,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC,cAAc,EAAE,CAAC;gBAChC,iFAAiF;gBACjF,IAAI,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC;oBACtB,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACpB,CAAC;YACD,OAAO,GAAG,CAAC;QACf,CAAC;;YAEG,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA;IAC3E,CAAC;CACJ;AA1CD,wDA0CC"}
@@ -1,193 +0,0 @@
1
- /**
2
- * Common authentication types shared between frontend and backend authentication systems
3
- * This file provides type definitions used by both JWT validation (backend) and OAuth flows (frontend)
4
- */
5
- /**
6
- * Standard authentication provider types
7
- */
8
- export declare const AUTH_PROVIDER_TYPES: {
9
- readonly MSAL: "msal";
10
- readonly AUTH0: "auth0";
11
- readonly OKTA: "okta";
12
- readonly COGNITO: "cognito";
13
- readonly GOOGLE: "google";
14
- readonly CUSTOM: "custom";
15
- };
16
- /**
17
- * Type for authentication provider identifiers
18
- */
19
- export type AuthProviderType = typeof AUTH_PROVIDER_TYPES[keyof typeof AUTH_PROVIDER_TYPES];
20
- /**
21
- * Base configuration for authentication providers
22
- * Used by both backend (JWT validation) and frontend (OAuth flows)
23
- */
24
- export interface AuthProviderConfig {
25
- /**
26
- * Unique name identifier for this provider instance
27
- */
28
- name: string;
29
- /**
30
- * Type of authentication provider (e.g., 'msal', 'auth0', 'okta')
31
- */
32
- type: AuthProviderType | string;
33
- /**
34
- * OAuth client ID
35
- */
36
- clientId?: string;
37
- /**
38
- * OAuth client secret (backend only, never expose to frontend)
39
- */
40
- clientSecret?: string;
41
- /**
42
- * Provider domain (e.g., 'your-domain.auth0.com')
43
- */
44
- domain?: string;
45
- /**
46
- * Tenant ID for multi-tenant providers (e.g., Azure AD)
47
- */
48
- tenantId?: string;
49
- /**
50
- * Token issuer URL (must match 'iss' claim in JWT)
51
- */
52
- issuer?: string;
53
- /**
54
- * Expected audience for tokens
55
- */
56
- audience?: string;
57
- /**
58
- * JWKS endpoint URL for retrieving signing keys
59
- */
60
- jwksUri?: string;
61
- /**
62
- * OAuth redirect URI for callback after authentication
63
- */
64
- redirectUri?: string;
65
- /**
66
- * OAuth scopes to request
67
- */
68
- scopes?: string[];
69
- /**
70
- * Authority URL for providers that use it (e.g., MSAL)
71
- */
72
- authority?: string;
73
- /**
74
- * Allow provider-specific configuration fields
75
- */
76
- [key: string]: any;
77
- }
78
- /**
79
- * User information extracted from authentication tokens or user profiles
80
- */
81
- export interface AuthUserInfo {
82
- /**
83
- * User's email address
84
- */
85
- email?: string;
86
- /**
87
- * User's first name
88
- */
89
- firstName?: string;
90
- /**
91
- * User's last name
92
- */
93
- lastName?: string;
94
- /**
95
- * User's full display name
96
- */
97
- fullName?: string;
98
- /**
99
- * Preferred username or handle
100
- */
101
- preferredUsername?: string;
102
- /**
103
- * Unique user identifier from the auth provider
104
- */
105
- userId?: string;
106
- /**
107
- * User's roles or groups
108
- */
109
- roles?: string[];
110
- /**
111
- * Additional provider-specific claims
112
- */
113
- [key: string]: any;
114
- }
115
- /**
116
- * Token information structure
117
- */
118
- export interface AuthTokenInfo {
119
- /**
120
- * OAuth access token for API calls
121
- */
122
- accessToken?: string;
123
- /**
124
- * ID token containing user claims
125
- */
126
- idToken?: string;
127
- /**
128
- * Refresh token for obtaining new access tokens
129
- */
130
- refreshToken?: string;
131
- /**
132
- * Token expiration time
133
- */
134
- expiresAt?: Date;
135
- /**
136
- * Token type (usually 'Bearer')
137
- */
138
- tokenType?: string;
139
- }
140
- /**
141
- * JWT payload structure based on standard OIDC claims
142
- */
143
- export interface AuthJwtPayload {
144
- /**
145
- * Subject - unique identifier for the user
146
- */
147
- sub?: string;
148
- /**
149
- * Email address
150
- */
151
- email?: string;
152
- /**
153
- * Given/first name
154
- */
155
- given_name?: string;
156
- /**
157
- * Family/last name
158
- */
159
- family_name?: string;
160
- /**
161
- * Full name
162
- */
163
- name?: string;
164
- /**
165
- * Preferred username
166
- */
167
- preferred_username?: string;
168
- /**
169
- * Token issuer
170
- */
171
- iss?: string;
172
- /**
173
- * Token audience
174
- */
175
- aud?: string | string[];
176
- /**
177
- * Expiration time (seconds since epoch)
178
- */
179
- exp?: number;
180
- /**
181
- * Issued at time (seconds since epoch)
182
- */
183
- iat?: number;
184
- /**
185
- * Not before time (seconds since epoch)
186
- */
187
- nbf?: number;
188
- /**
189
- * Additional claims
190
- */
191
- [key: string]: any;
192
- }
193
- //# sourceMappingURL=authTypes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authTypes.d.ts","sourceRoot":"","sources":["../../src/generic/authTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;CAOtB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,mBAAmB,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAE5F;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,EAAE,gBAAgB,GAAG,MAAM,CAAC;IAEhC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,MAAM,CAAC,EAAE,MA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EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAExB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- /**
3
- * Common authentication types shared between frontend and backend authentication systems
4
- * This file provides type definitions used by both JWT validation (backend) and OAuth flows (frontend)
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.AUTH_PROVIDER_TYPES = void 0;
8
- /**
9
- * Standard authentication provider types
10
- */
11
- exports.AUTH_PROVIDER_TYPES = {
12
- MSAL: 'msal',
13
- AUTH0: 'auth0',
14
- OKTA: 'okta',
15
- COGNITO: 'cognito',
16
- GOOGLE: 'google',
17
- CUSTOM: 'custom'
18
- };
19
- //# sourceMappingURL=authTypes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authTypes.js","sourceRoot":"","sources":["../../src/generic/authTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AACU,QAAA,mBAAmB,GAAG;IACjC,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;CACR,CAAC"}
@@ -1,260 +0,0 @@
1
- import { BehaviorSubject } from 'rxjs';
2
- import { UserInfo } from './securityInfo.js';
3
- import { DatasetItemFilterType, IMetadataProvider, IRunViewProvider, RunViewResult } from './interfaces.js';
4
- import { BaseInfo } from './baseInfo.js';
5
- import { BaseEntityEvent } from './baseEntity.js';
6
- import { MJEvent } from '../interface.js';
7
- import { BaseSingleton } from '../BaseSingleton.js';
8
- /**
9
- * Property configuration for the BaseEngine class to automatically load/set properties on the class.
10
- */
11
- export declare class BaseEnginePropertyConfig extends BaseInfo {
12
- /**
13
- * The type of item to load, either 'entity' or 'dataset', defaults to 'entity'
14
- */
15
- Type: 'entity' | 'dataset';
16
- /**
17
- * The name of the property in the class instance
18
- */
19
- PropertyName: string;
20
- /**
21
- * The entity name to load from the database, required if Type is 'entity'
22
- */
23
- EntityName?: string;
24
- /**
25
- * The dataset name to load from the database, required if Type is 'dataset'
26
- */
27
- DatasetName?: string;
28
- /**
29
- * Optional, filters to apply to the data load, applies only when type is 'entity'. Use DatasetItemFilters for dataset filters.
30
- */
31
- Filter?: string;
32
- /**
33
- * Optional, filters to apply to each item in a dataset, only applies when type is 'dataset' and is optional in those cases.
34
- */
35
- DatasetItemFilters?: DatasetItemFilterType[];
36
- /**
37
- * Optional, only used if Type is 'dataset', specifies how to handle the results of the dataset load. Defaults to 'single_property' if not specified. When set to 'single_property', the entire dataset is set to the property specified by PropertyName.
38
- * When set to 'individual_properties', each item in the dataset is set to a property on the object with the name of the item's key plus the item's Code name.
39
- * For example, if the item's key is 'Demo' and the item's Code name is 'FirstItem', the property set on the object would be 'Demo_FirstItem'.
40
- */
41
- DatasetResultHandling?: 'single_property' | 'individual_properties';
42
- /**
43
- * Optional, order by clause to apply to the data load, only applies when type is 'entity'
44
- */
45
- OrderBy?: string;
46
- /**
47
- * Optional, expiration time in milliseconds
48
- */
49
- Expiration?: number;
50
- /**
51
- * Optional, whether to add the result to the object, defaults to true if not specified
52
- */
53
- AddToObject?: boolean;
54
- /**
55
- * Optional, defaults to true. If set to false, AutoRefresh for this item will be disabled. By default, whenever a BaseEntity event is emitted for a save/delete, if the entity name
56
- * for this config matches the BaseEntity's entity name, the config will be refreshed. If this is set to false, that will not happen. NOTE: This is not a network notification mechanism,
57
- * it only works within the local tier, so for example within a browser application, that brower's engine sub-classes will be updated when changes are made to entities in that application
58
- * environment, and the same is true for MJAPI/Server based environments. If you need network based notification, additional infrastructure will be needed to implement that.
59
- */
60
- AutoRefresh?: boolean;
61
- constructor(init?: Partial<BaseEnginePropertyConfig>);
62
- }
63
- /**
64
- * Abstract base class for any engine-style class which executes work on behalf of a caller typically using a provider-style architecture with plug-ins. This base class
65
- * provides a mechanism for loading metadata from the database and caching it for use by the engine. Subclasses must implement the Config abstract method and within that
66
- * generally it is recommended to call the Load method to load the metadata. Subclasses can also override the AdditionalLoading method to perform additional loading tasks.
67
- */
68
- export declare abstract class BaseEngine<T> extends BaseSingleton<T> {
69
- private _loaded;
70
- private _loadingSubject;
71
- private _contextUser;
72
- private _metadataConfigs;
73
- private _dynamicConfigs;
74
- private _dataMap;
75
- private _expirationTimers;
76
- private _entityEventSubjects;
77
- private _provider;
78
- /**
79
- * While the BaseEngine class is a singleton, normally, it is possible to have multiple instances of the class in an application if the class is used in multiple contexts that have different providers.
80
- */
81
- constructor();
82
- /**
83
- * Returns the metadata provider to use for the engine. If a provider is set via the Config method, that provider will be used, otherwise the default provider will be used.
84
- */
85
- get ProviderToUse(): IMetadataProvider;
86
- /**
87
- * Returns the RunView provider to use for the engine. This is the same underlying object as the @property ProviderTouse, but cast to IRunViewProvider.
88
- * If a provider is set via the Config method, that provider will be used, otherwise the default provider will be used.
89
- */
90
- get RunViewProviderToUse(): IRunViewProvider;
91
- /**
92
- * Returns a COPY of the metadata configs array for the engine. This is a copy so you can't modify the original configs by modifying this array.
93
- */
94
- get Configs(): BaseEnginePropertyConfig[];
95
- /**
96
- * Configures the engine by loading metadata from the database.
97
- */
98
- abstract Config(forceRefresh?: boolean, contextUser?: UserInfo, provider?: IMetadataProvider): any;
99
- /**
100
- * This method should be called by sub-classes to load up their specific metadata requirements. For more complex metadata
101
- * loading or for post-processing of metadata loading done here, overide the AdditionalLoading method to add your logic.
102
- * @param configs
103
- * @param contextUser
104
- * @returns
105
- */
106
- protected Load(configs: Partial<BaseEnginePropertyConfig>[], provider: IMetadataProvider, forceRefresh?: boolean, contextUser?: UserInfo): Promise<void>;
107
- /**********************************************************************
108
- * This section is for handling caching of multiple instances when needed
109
- * We use the primary singleton as the instance to store a cache of instances
110
- * that are tied to specific providers. This is useful when we have multiple
111
- * providers in a given app going to different connections.
112
- *********************************************************************/
113
- private static _providerInstances;
114
- private static get ProviderInstances();
115
- /**
116
- * This method will check for the existence of an instance of this engine class that is tied to a specific provider. If one exists, it will return it, otherwise it will create a new instance
117
- */
118
- static GetProviderInstance<T>(provider: IMetadataProvider, subclassConstructor: new () => BaseEngine<T>): BaseEngine<T>;
119
- /**
120
- * Internal method to set the provider when an engine is loaded
121
- * @param provider
122
- */
123
- protected SetProvider(provider: IMetadataProvider): void;
124
- protected CheckAddToProviderInstances(provider: IMetadataProvider): void;
125
- private _eventListener;
126
- /**
127
- * This method is responsible for registering for MJGlobal events and listening for BaseEntity events where those
128
- * BaseEntity are related to the engine's configuration metadata. The idea is to auto-refresh the releated configs
129
- * when the BaseEntity is updated.
130
- */
131
- protected SetupGlobalEventListener(): Promise<boolean>;
132
- /**
133
- * Subclasses of BaseEngine can override this method to handle individual MJGlobal events. This is typically done to optimize
134
- * the way refreshes are done when a BaseEntity is updated. If you are interested in only BaseEntity events, override
135
- * the HandleIndividualBaseEntityEvent method instead as this method primarily serves to filter all the events we get from MJGlobal
136
- * and only pass on BaseEntity events to HandleIndividualBaseEntityEvent.
137
- * @param event
138
- */
139
- protected HandleIndividualEvent(event: MJEvent): Promise<boolean>;
140
- /**
141
- * This method handles the individual base entity event and just checks to see if it is a delete or save event and if so, debounces it.
142
- * Override this method if you want to have a different handling for the filtering of events that are debounced or if you don't want to debounce
143
- * at all you can do that in an override of this method.
144
- * @param event
145
- */
146
- protected HandleIndividualBaseEntityEvent(event: BaseEntityEvent): Promise<boolean>;
147
- /**
148
- * This method handles the debouncing process, by default using the EntityEventDebounceTime property to set the debounce time. Debouncing is
149
- * done on a per-entity basis, meaning that if the debounce time passes for a specific entity name, the event will be processed. This is done to
150
- * prevent multiple events from being processed in quick succession for a single entity which would cause a lot of wasted processing.
151
- *
152
- * Override this method if you want to change how debouncing time such as having variable debounce times per-entity, etc.
153
- * @param event
154
- * @returns
155
- */
156
- protected DebounceIndividualBaseEntityEvent(event: BaseEntityEvent): Promise<boolean>;
157
- private _entityEventDebounceTime;
158
- /**
159
- * Overridable property to set the debounce time for entity events. Default is 5000 milliseconds (5 seconds).
160
- */
161
- protected get EntityEventDebounceTime(): number;
162
- /**
163
- * This method does the actual work of processing the entity event. It is not directly called from the event handler because we want to first debounce the events
164
- * which also introduces a delay which is usually desirable so that our processing is typically outside of the scope of any transaction processing that would have
165
- * originated the event.
166
- *
167
- * This is the best method to override if you want to change the actual processing of an entity event but do NOT want to modify the debouncing behavior.
168
- */
169
- protected ProcessEntityEvent(event: BaseEntityEvent): Promise<void>;
170
- /**
171
- * Utility method to upgrade an object to a BaseEnginePropertyConfig object.
172
- * @param obj
173
- * @returns
174
- */
175
- protected UpgradeObjectToConfig(obj: any): BaseEnginePropertyConfig;
176
- /**
177
- * Loads the specified metadata configurations.
178
- * @param configs - The metadata configurations to load
179
- * @param contextUser - The context user information
180
- */
181
- protected LoadConfigs(configs: Partial<BaseEnginePropertyConfig>[], contextUser: UserInfo): Promise<void>;
182
- /**
183
- * Loads a single metadata configuration.
184
- * @param config - The metadata configuration to load
185
- * @param contextUser - The context user information
186
- */
187
- protected LoadSingleConfig(config: BaseEnginePropertyConfig, contextUser: UserInfo): Promise<void>;
188
- /**
189
- * Handles the process of loading a single config of type 'entity'.
190
- * @param config
191
- * @param contextUser
192
- */
193
- protected LoadSingleEntityConfig(config: BaseEnginePropertyConfig, contextUser: UserInfo): Promise<void>;
194
- /**
195
- * Handles the result of a single view load.
196
- * @param config
197
- * @param result
198
- */
199
- protected HandleSingleViewResult(config: BaseEnginePropertyConfig, result: RunViewResult): void;
200
- /**
201
- * Handles the process of loading multiple entity configs in a single network call via RunViews()
202
- * @param configs
203
- * @param contextUser
204
- */
205
- protected LoadMultipleEntityConfigs(configs: BaseEnginePropertyConfig[], contextUser: UserInfo): Promise<void>;
206
- /**
207
- * Handles the process of loading a single config of type 'dataset'.
208
- * @param config
209
- * @param contextUser
210
- */
211
- protected LoadSingleDatasetConfig(config: BaseEnginePropertyConfig, contextUser: UserInfo): Promise<void>;
212
- /**
213
- * Sets an expiration timer for a metadata property.
214
- * @param propertyName - The name of the property
215
- * @param expiration - The expiration time in milliseconds
216
- */
217
- private SetExpirationTimer;
218
- /**
219
- * Adds a dynamic metadata configuration at runtime.
220
- * @param config - The metadata configuration to add
221
- * @param contextUser - The context user information
222
- */
223
- AddDynamicConfig(config: BaseEnginePropertyConfig, contextUser?: UserInfo): Promise<void>;
224
- /**
225
- * Removes a dynamic metadata configuration at runtime.
226
- * @param propertyName - The name of the property to remove
227
- */
228
- RemoveDynamicConfig(propertyName: string): void;
229
- /**
230
- * Refreshes a specific item.
231
- * @param propertyName - The name of the property to refresh
232
- */
233
- RefreshItem(propertyName: string): Promise<void>;
234
- /**
235
- * Refreshes all items
236
- */
237
- RefreshAllItems(): Promise<void>;
238
- /**
239
- * Subclasses can override this method to perform additional loading tasks
240
- * @param contextUser
241
- */
242
- protected AdditionalLoading(contextUser?: UserInfo): Promise<void>;
243
- /**
244
- * Returns true if the data has been loaded, false otherwise.
245
- */
246
- get Loaded(): boolean;
247
- /**
248
- * Returns the loading subject. You can call await Config() and after Config() comes back as true that means you're loaded. However you can also directly subscribe to this subject to get updates on the loading status.
249
- */
250
- get LoadingSubject(): BehaviorSubject<boolean>;
251
- /**
252
- * Returns the context user set for the object, this is set via the Config() method.
253
- */
254
- get ContextUser(): UserInfo;
255
- /**
256
- * Helper method for sub-classes to have a single line of code that will make sure the data is loaded before proceeding and will throw an error if not loaded.
257
- */
258
- protected TryThrowIfNotLoaded(): void;
259
- }
260
- //# sourceMappingURL=baseEngine.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"baseEngine.d.ts","sourceRoot":"","sources":["../../src/generic/baseEngine.ts"],"names":[],"mappings":"AAAA,OAAO,E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