@finos/legend-application 0.2.2 → 1.0.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 (49) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/lib/application/LegendApplication.d.ts +23 -11
  3. package/lib/application/LegendApplication.d.ts.map +1 -1
  4. package/lib/application/LegendApplication.js +28 -14
  5. package/lib/application/LegendApplication.js.map +1 -1
  6. package/lib/application/LegendApplicationPluginManager.d.ts +32 -0
  7. package/lib/application/LegendApplicationPluginManager.d.ts.map +1 -0
  8. package/lib/application/LegendApplicationPluginManager.js +47 -0
  9. package/lib/application/LegendApplicationPluginManager.js.map +1 -0
  10. package/lib/components/ApplicationStoreProvider.d.ts +3 -5
  11. package/lib/components/ApplicationStoreProvider.d.ts.map +1 -1
  12. package/lib/components/ApplicationStoreProvider.js +4 -2
  13. package/lib/components/ApplicationStoreProvider.js.map +1 -1
  14. package/lib/components/ApplicationStoreProviderTestUtils.d.ts +4 -2
  15. package/lib/components/ApplicationStoreProviderTestUtils.d.ts.map +1 -1
  16. package/lib/components/ApplicationStoreProviderTestUtils.js +3 -4
  17. package/lib/components/ApplicationStoreProviderTestUtils.js.map +1 -1
  18. package/lib/index.css +2 -2
  19. package/lib/index.css.map +1 -1
  20. package/lib/index.d.ts +1 -1
  21. package/lib/index.d.ts.map +1 -1
  22. package/lib/index.js +1 -1
  23. package/lib/index.js.map +1 -1
  24. package/lib/stores/ApplicationStore.d.ts +8 -3
  25. package/lib/stores/ApplicationStore.d.ts.map +1 -1
  26. package/lib/stores/ApplicationStore.js +11 -4
  27. package/lib/stores/ApplicationStore.js.map +1 -1
  28. package/lib/stores/ApplicationStoreTestUtils.d.ts +2 -1
  29. package/lib/stores/ApplicationStoreTestUtils.d.ts.map +1 -1
  30. package/lib/stores/ApplicationStoreTestUtils.js +1 -2
  31. package/lib/stores/ApplicationStoreTestUtils.js.map +1 -1
  32. package/lib/stores/WebApplicationNavigator.d.ts +7 -0
  33. package/lib/stores/WebApplicationNavigator.d.ts.map +1 -1
  34. package/lib/stores/WebApplicationNavigator.js.map +1 -1
  35. package/package.json +9 -9
  36. package/src/application/LegendApplication.tsx +57 -27
  37. package/src/application/LegendApplicationPluginManager.tsx +73 -0
  38. package/src/components/ApplicationStoreProvider.tsx +6 -7
  39. package/src/components/ApplicationStoreProviderTestUtils.tsx +6 -7
  40. package/src/index.ts +1 -2
  41. package/src/stores/ApplicationStore.ts +26 -4
  42. package/src/stores/ApplicationStoreTestUtils.ts +3 -2
  43. package/src/stores/WebApplicationNavigator.ts +7 -0
  44. package/tsconfig.json +1 -1
  45. package/lib/network/TelemetryEvent.d.ts +0 -19
  46. package/lib/network/TelemetryEvent.d.ts.map +0 -1
  47. package/lib/network/TelemetryEvent.js +0 -20
  48. package/lib/network/TelemetryEvent.js.map +0 -1
  49. package/src/network/TelemetryEvent.ts +0 -19
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { assertTrue, LogEvent, assertErrorThrown, isString, ApplicationError, } from '@finos/legend-shared';
16
+ import { EventNotifierService, TracerService, TelemetryService, assertTrue, Log, LogEvent, assertErrorThrown, isString, ApplicationError, } from '@finos/legend-shared';
17
17
  import { makeAutoObservable, action } from 'mobx';
18
18
  import { APPLICATION_LOG_EVENT } from './ApplicationLogEvent';
19
19
  export var ActionAlertType;
@@ -52,11 +52,14 @@ export class Notification {
52
52
  export class ApplicationStore {
53
53
  navigator;
54
54
  notification;
55
- log;
56
55
  blockingAlertInfo;
57
56
  actionAlertInfo;
58
57
  config;
59
- constructor(config, navigator, log) {
58
+ log = new Log();
59
+ telemetryService = new TelemetryService();
60
+ tracerService = new TracerService();
61
+ eventNotifierService = new EventNotifierService();
62
+ constructor(config, navigator, pluginManager) {
60
63
  makeAutoObservable(this, {
61
64
  navigator: false,
62
65
  setBlockingAlert: action,
@@ -70,7 +73,11 @@ export class ApplicationStore {
70
73
  });
71
74
  this.config = config;
72
75
  this.navigator = navigator;
73
- this.log = log;
76
+ // Register plugins
77
+ this.log.registerPlugins(pluginManager.getLoggerPlugins());
78
+ this.telemetryService.registerPlugins(pluginManager.getTelemetryServicePlugins());
79
+ this.tracerService.registerPlugins(pluginManager.getTracerServicePlugins());
80
+ this.eventNotifierService.registerPlugins(pluginManager.getEventNotifierPlugins());
74
81
  }
75
82
  setBlockingAlert(alertInfo) {
76
83
  this.blockingAlertInfo = alertInfo;
@@ -1 +1 @@
1
- {"version":3,"file":"ApplicationStore.js","sourceRoot":"","sources":["../../src/stores/ApplicationStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EACL,UAAU,EACV,QAAQ,EACR,iBAAiB,EACjB,QAAQ,EACR,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAI9D,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,wCAAqB,CAAA;IACrB,sCAAmB,CAAA;AACrB,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AAED,MAAM,CAAN,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC/B,8CAAqB,CAAA;IACrB,sEAA6C,CAAA;IAC7C,4CAAmB,CAAA;AACrB,CAAC,EAJW,qBAAqB,KAArB,qBAAqB,QAIhC;AAuBD,MAAM,CAAC,MAAM,8BAA8B,GAAG,IAAI,CAAC,CAAC,KAAK;AACzD,MAAM,CAAC,MAAM,oCAAoC,GAAG,KAAK,CAAC,CAAC,KAAK;AAEhE,MAAM,CAAN,IAAY,oBAMX;AAND,WAAY,oBAAoB;IAC9B,qDAA6B,CAAA;IAC7B,uCAAe,CAAA;IACf,2CAAmB,CAAA;IACnB,2CAAmB,CAAA;IACnB,qCAAa,CAAA;AACf,CAAC,EANW,oBAAoB,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C,CAAC;aACzB;oBAAS;gBACR,OAAO,CAAC,MAAM,EAAE,CAAC;aAClB;YACD,OAAO;SACR;QACD,IAAI,CAAC,WAAW,CAAC,kDAAkD,CAAC,CAAC;IACvE,CAAC;IAED,wBAAwB,CAAC,WAAmB;QAC1C,IAAI,CAAC,aAAa,CAAC,wBAAwB,WAAW,EAAE,CAAC,CAAC;IAC5D,CAAC;CACF"}
@@ -15,10 +15,11 @@
15
15
  */
16
16
  import { ApplicationStore } from './ApplicationStore';
17
17
  import type { LegendApplicationConfig } from './ApplicationConfig';
18
+ import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager';
18
19
  export declare const TEST_DATA__applicationVersion: {
19
20
  buildTime: string;
20
21
  version: string;
21
22
  commitSHA: string;
22
23
  };
23
- export declare const TEST__getTestApplicationStore: <T extends LegendApplicationConfig>(config: T) => ApplicationStore<T>;
24
+ export declare const TEST__getTestApplicationStore: <T extends LegendApplicationConfig>(config: T, pluginManager: LegendApplicationPluginManager) => ApplicationStore<T>;
24
25
  //# sourceMappingURL=ApplicationStoreTestUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ApplicationStoreTestUtils.d.ts","sourceRoot":"","sources":["../../src/stores/ApplicationStoreTestUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEnE,eAAO,MAAM,6BAA6B;;;;CAIzC,CAAC;AAEF,eAAO,MAAM,6BAA6B,uEASvC,CAAC"}
1
+ {"version":3,"file":"ApplicationStoreTestUtils.d.ts","sourceRoot":"","sources":["../../src/stores/ApplicationStoreTestUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,+CAA+C,CAAC;AAEpG,eAAO,MAAM,6BAA6B;;;;CAIzC,CAAC;AAEF,eAAO,MAAM,6BAA6B,gEAIzB,8BAA8B,wBAM5C,CAAC"}
@@ -16,11 +16,10 @@
16
16
  import { ApplicationStore } from './ApplicationStore';
17
17
  import { createBrowserHistory } from 'history';
18
18
  import { WebApplicationNavigator } from './WebApplicationNavigator';
19
- import { Log } from '@finos/legend-shared';
20
19
  export const TEST_DATA__applicationVersion = {
21
20
  buildTime: '2001-01-01T00:00:00-0000',
22
21
  version: 'test-version',
23
22
  commitSHA: 'test-commit-id',
24
23
  };
25
- export const TEST__getTestApplicationStore = (config) => new ApplicationStore(config, new WebApplicationNavigator(createBrowserHistory()), new Log());
24
+ export const TEST__getTestApplicationStore = (config, pluginManager) => new ApplicationStore(config, new WebApplicationNavigator(createBrowserHistory()), pluginManager);
26
25
  //# sourceMappingURL=ApplicationStoreTestUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ApplicationStoreTestUtils.js","sourceRoot":"","sources":["../../src/stores/ApplicationStoreTestUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAG3C,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,SAAS,EAAE,0BAA0B;IACrC,OAAO,EAAE,cAAc;IACvB,SAAS,EAAE,gBAAgB;CAC5B,CAAC;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAG3C,MAAS,EACY,EAAE,CACvB,IAAI,gBAAgB,CAClB,MAAM,EACN,IAAI,uBAAuB,CAAC,oBAAoB,EAAE,CAAC,EACnD,IAAI,GAAG,EAAE,CACV,CAAC"}
1
+ {"version":3,"file":"ApplicationStoreTestUtils.js","sourceRoot":"","sources":["../../src/stores/ApplicationStoreTestUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAIpE,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,SAAS,EAAE,0BAA0B;IACrC,OAAO,EAAE,cAAc;IACvB,SAAS,EAAE,gBAAgB;CAC5B,CAAC;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAG3C,MAAS,EACT,aAA6C,EACxB,EAAE,CACvB,IAAI,gBAAgB,CAClB,MAAM,EACN,IAAI,uBAAuB,CAAC,oBAAoB,EAAE,CAAC,EACnD,aAAa,CACd,CAAC"}
@@ -31,6 +31,13 @@ import type { History } from 'history';
31
31
  *
32
32
  * As such, instead, we should design a more generic concept `Location` to pass around.
33
33
  * We would need to flesh out the details, but this is the rough idea.
34
+ *
35
+ * Another thought is that we should also genericize Router so it handles more than just
36
+ * URLs. If we make `router` and `navigator` work together, we can potentially genericize
37
+ * application navigation
38
+ *
39
+ * However, this depends on how and when we move to another platform, like `electron` for example
40
+ * See https://github.com/finos/legend-studio/issues/718
34
41
  */
35
42
  interface ApplicationNavigator<T> {
36
43
  reload(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"WebApplicationNavigator.d.ts","sourceRoot":"","sources":["../../src/stores/WebApplicationNavigator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGvC;;;;;;;;;;;;;;;;;GAiBG;AACH,UAAU,oBAAoB,CAAC,CAAC;IAC9B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C,CAAC;IACvC,CAAC;IAED,kBAAkB;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;IACnC,CAAC;IAED,sBAAsB;QACpB,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC;IAC3C,CAAC;IAED,gBAAgB,CAAC,YAAoB;QACnC,OAAO,CACL,MAAM,CAAC,QAAQ,CAAC,MAAM;YACtB,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CACvD,CAAC;IACJ,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finos/legend-application",
3
- "version": "0.2.2",
3
+ "version": "1.0.0",
4
4
  "description": "Legend application core",
5
5
  "keywords": [
6
6
  "legend",
@@ -38,17 +38,17 @@
38
38
  "test:watch": "jest --watch"
39
39
  },
40
40
  "dependencies": {
41
- "@finos/legend-art": "0.1.2",
42
- "@finos/legend-graph": "0.2.5",
43
- "@finos/legend-shared": "0.0.9",
41
+ "@finos/legend-art": "0.2.0",
42
+ "@finos/legend-graph": "0.3.0",
43
+ "@finos/legend-shared": "1.0.0",
44
44
  "@material-ui/core": "4.12.3",
45
45
  "@testing-library/react": "12.1.2",
46
46
  "@types/css-font-loading-module": "0.0.7",
47
- "@types/react": "17.0.36",
47
+ "@types/react": "17.0.37",
48
48
  "@types/react-dom": "17.0.11",
49
49
  "@types/react-router-dom": "5.3.2",
50
50
  "history": "5.1.0",
51
- "mobx": "6.3.7",
51
+ "mobx": "6.3.8",
52
52
  "mobx-react-lite": "3.2.2",
53
53
  "monaco-editor": "0.30.1",
54
54
  "react": "17.0.2",
@@ -60,14 +60,14 @@
60
60
  "serializr": "2.0.5"
61
61
  },
62
62
  "devDependencies": {
63
- "@finos/legend-dev-utils": "0.2.1",
63
+ "@finos/legend-dev-utils": "0.3.0",
64
64
  "@testing-library/dom": "8.11.1",
65
65
  "cross-env": "7.0.3",
66
66
  "eslint": "8.3.0",
67
- "jest": "27.3.1",
67
+ "jest": "27.4.3",
68
68
  "npm-run-all": "4.1.5",
69
69
  "rimraf": "3.0.2",
70
- "sass": "1.43.4",
70
+ "sass": "1.44.0",
71
71
  "typescript": "4.5.2"
72
72
  },
73
73
  "peerDependencies": {
@@ -34,16 +34,10 @@ import type {
34
34
  LegendApplicationConfigurationData,
35
35
  LegendApplicationVersionData,
36
36
  } from '../stores/ApplicationConfig';
37
- import type {
38
- AbstractPlugin,
39
- AbstractPluginManager,
40
- AbstractPreset,
41
- Logger,
42
- } from '@finos/legend-shared';
37
+ import type { AbstractPlugin, AbstractPreset } from '@finos/legend-shared';
43
38
  import {
44
39
  assertErrorThrown,
45
40
  LogEvent,
46
- Log,
47
41
  guaranteeNonEmptyString,
48
42
  assertNonNullable,
49
43
  NetworkClient,
@@ -51,6 +45,46 @@ import {
51
45
  import { APPLICATION_LOG_EVENT } from '../stores/ApplicationLogEvent';
52
46
  import { configureComponents } from '@finos/legend-art';
53
47
  import type { GraphPluginManager } from '@finos/legend-graph';
48
+ import type { LegendApplicationPluginManager } from './LegendApplicationPluginManager';
49
+
50
+ export abstract class LegendApplicationLogger {
51
+ abstract debug(event: LogEvent, ...data: unknown[]): void;
52
+ abstract info(event: LogEvent, ...data: unknown[]): void;
53
+ abstract warn(event: LogEvent, ...data: unknown[]): void;
54
+ abstract error(event: LogEvent, ...data: unknown[]): void;
55
+ }
56
+
57
+ const { debug, info, warn, error } = console;
58
+
59
+ export class LegendApplicationWebConsole extends LegendApplicationLogger {
60
+ debug(event: LogEvent, ...data: unknown[]): void {
61
+ debug(
62
+ `[${event.timestamp}] ${event.name} ${data.length ? ':' : ''}`,
63
+ ...data,
64
+ );
65
+ }
66
+
67
+ info(event: LogEvent, ...data: unknown[]): void {
68
+ info(
69
+ `[${event.timestamp}] ${event.name} ${data.length ? ':' : ''}`,
70
+ ...data,
71
+ );
72
+ }
73
+
74
+ warn(event: LogEvent, ...data: unknown[]): void {
75
+ warn(
76
+ `[${event.timestamp}] ${event.name} ${data.length ? ':' : ''}`,
77
+ ...data,
78
+ );
79
+ }
80
+
81
+ error(event: LogEvent, ...data: unknown[]): void {
82
+ error(
83
+ `[${event.timestamp}] ${event.name} ${data.length ? ':' : ''}`,
84
+ ...data,
85
+ );
86
+ }
87
+ }
54
88
 
55
89
  export const setupTextEdtiorAPI = (pluginManager: GraphPluginManager): void => {
56
90
  // Register Pure as a language in `monaco-editor`
@@ -78,7 +112,7 @@ export const setupTextEdtiorAPI = (pluginManager: GraphPluginManager): void => {
78
112
  // See https://sgom.es/posts/2020-06-15-everything-you-never-wanted-to-know-about-side-effects/
79
113
  export const setupLegendApplicationUILibrary = async (
80
114
  pluginManager: GraphPluginManager,
81
- log: Log,
115
+ logger: LegendApplicationLogger,
82
116
  ): Promise<void> => {
83
117
  setupTextEdtiorAPI(pluginManager);
84
118
 
@@ -92,19 +126,19 @@ export const setupLegendApplicationUILibrary = async (
92
126
  .then(() => {
93
127
  if (document.fonts.check(`1em ${MONOSPACED_FONT_FAMILY}`)) {
94
128
  monacoEditorAPI.remeasureFonts();
95
- log.info(
129
+ logger.info(
96
130
  LogEvent.create(APPLICATION_LOG_EVENT.TEXT_EDITOR_FONT_LOADED),
97
131
  `Monospaced font '${MONOSPACED_FONT_FAMILY}' has been loaded`,
98
132
  );
99
133
  } else {
100
- log.error(
134
+ logger.error(
101
135
  LogEvent.create(APPLICATION_LOG_EVENT.APPLICATION_SETUP_FAILURE),
102
136
  fontLoadFailureErrorMessage,
103
137
  );
104
138
  }
105
139
  })
106
140
  .catch(() =>
107
- log.error(
141
+ logger.error(
108
142
  LogEvent.create(APPLICATION_LOG_EVENT.APPLICATION_SETUP_FAILURE),
109
143
  fontLoadFailureErrorMessage,
110
144
  ),
@@ -121,34 +155,35 @@ export const setupLegendApplicationUILibrary = async (
121
155
 
122
156
  export abstract class LegendApplication {
123
157
  protected config!: LegendApplicationConfig;
158
+ protected logger!: LegendApplicationLogger;
124
159
 
125
- protected pluginManager: AbstractPluginManager;
160
+ protected pluginManager: LegendApplicationPluginManager;
126
161
  protected basePresets: AbstractPreset[] = [];
127
162
  protected basePlugins: AbstractPlugin[] = [];
128
163
 
129
- protected log = new Log();
130
164
  protected baseUrl!: string;
131
165
  protected pluginRegister?:
132
166
  | ((
133
- pluginManager: AbstractPluginManager,
167
+ pluginManager: LegendApplicationPluginManager,
134
168
  config: LegendApplicationConfig,
135
169
  ) => void)
136
170
  | undefined;
137
171
  protected _isConfigured = false;
138
172
 
139
- protected constructor(pluginManager: AbstractPluginManager) {
173
+ protected constructor(pluginManager: LegendApplicationPluginManager) {
140
174
  this.pluginManager = pluginManager;
175
+ this.logger = new LegendApplicationWebConsole();
141
176
  }
142
177
 
143
178
  setup(options: {
144
179
  /** Base URL of the application. e.g. /studio/, /query/ */
145
180
  baseUrl: string;
146
181
  /**
147
- * Provide an alternative mechanism to register plugins and presets which is more flexible
148
- * by allowing configuring specific plugin or preset.
182
+ * Provide an alternative mechanism to register and configure plugins and presets
183
+ * which is more flexible by allowing configuring specific plugin or preset.
149
184
  */
150
185
  pluginRegister?: (
151
- pluginManager: AbstractPluginManager,
186
+ pluginManager: LegendApplicationPluginManager,
152
187
  config: LegendApplicationConfig,
153
188
  ) => void;
154
189
  }): LegendApplication {
@@ -181,11 +216,6 @@ export abstract class LegendApplication {
181
216
  return this;
182
217
  }
183
218
 
184
- withLoggers(loggers: Logger[]): LegendApplication {
185
- loggers.forEach((logger) => this.log.registerLogger(logger));
186
- return this;
187
- }
188
-
189
219
  async fetchApplicationConfiguration(
190
220
  baseUrl: string,
191
221
  ): Promise<[LegendApplicationConfig, Record<PropertyKey, object>]> {
@@ -197,7 +227,7 @@ export abstract class LegendApplication {
197
227
  );
198
228
  } catch (error) {
199
229
  assertErrorThrown(error);
200
- this.log.error(
230
+ this.logger.error(
201
231
  LogEvent.create(
202
232
  APPLICATION_LOG_EVENT.APPLICATION_CONFIGURATION_FAILURE,
203
233
  ),
@@ -215,7 +245,7 @@ export abstract class LegendApplication {
215
245
  );
216
246
  } catch (error) {
217
247
  assertErrorThrown(error);
218
- this.log.error(
248
+ this.logger.error(
219
249
  LogEvent.create(
220
250
  APPLICATION_LOG_EVENT.APPLICATION_CONFIGURATION_FAILURE,
221
251
  ),
@@ -255,13 +285,13 @@ export abstract class LegendApplication {
255
285
 
256
286
  await this.loadApplication();
257
287
 
258
- this.log.info(
288
+ this.logger.info(
259
289
  LogEvent.create(APPLICATION_LOG_EVENT.APPLICATION_LOADED),
260
290
  'Legend application loaded',
261
291
  );
262
292
  } catch (error) {
263
293
  assertErrorThrown(error);
264
- this.log.error(
294
+ this.logger.error(
265
295
  LogEvent.create(APPLICATION_LOG_EVENT.APPLICATION_FAILURE),
266
296
  'Failed to load Legend application',
267
297
  );
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import type {
18
+ EventNotifierPlugin,
19
+ EventNotifierServicePluginManager,
20
+ LoggerPlugin,
21
+ LoggerPluginManager,
22
+ TelemetryServicePlugin,
23
+ TelemetryServicePluginManager,
24
+ TracerServicePlugin,
25
+ TracerServicePluginManager,
26
+ } from '@finos/legend-shared';
27
+ import { AbstractPluginManager } from '@finos/legend-shared';
28
+
29
+ export class LegendApplicationPluginManager
30
+ extends AbstractPluginManager
31
+ implements
32
+ LoggerPluginManager,
33
+ TelemetryServicePluginManager,
34
+ TracerServicePluginManager,
35
+ EventNotifierServicePluginManager
36
+ {
37
+ protected loggerPlugins: LoggerPlugin[] = [];
38
+ protected telemetryServicePlugins: TelemetryServicePlugin[] = [];
39
+ protected tracerServicePlugins: TracerServicePlugin<unknown>[] = [];
40
+ protected eventNotifierPlugins: EventNotifierPlugin[] = [];
41
+
42
+ registerLoggerPlugin(plugin: LoggerPlugin): void {
43
+ this.loggerPlugins.push(plugin);
44
+ }
45
+
46
+ registerTelemetryServicePlugin(plugin: TelemetryServicePlugin): void {
47
+ this.telemetryServicePlugins.push(plugin);
48
+ }
49
+
50
+ registerTracerServicePlugin(plugin: TracerServicePlugin<unknown>): void {
51
+ this.tracerServicePlugins.push(plugin);
52
+ }
53
+
54
+ registerEventNotifierPlugin(plugin: EventNotifierPlugin): void {
55
+ this.eventNotifierPlugins.push(plugin);
56
+ }
57
+
58
+ getLoggerPlugins(): LoggerPlugin[] {
59
+ return [...this.loggerPlugins];
60
+ }
61
+
62
+ getTelemetryServicePlugins(): TelemetryServicePlugin[] {
63
+ return [...this.telemetryServicePlugins];
64
+ }
65
+
66
+ getTracerServicePlugins(): TracerServicePlugin<unknown>[] {
67
+ return [...this.tracerServicePlugins];
68
+ }
69
+
70
+ getEventNotifierPlugins(): EventNotifierPlugin[] {
71
+ return [...this.eventNotifierPlugins];
72
+ }
73
+ }
@@ -18,9 +18,9 @@ import { createContext, useContext } from 'react';
18
18
  import { useLocalObservable } from 'mobx-react-lite';
19
19
  import { ApplicationStore } from '../stores/ApplicationStore';
20
20
  import type { LegendApplicationConfig } from '../stores/ApplicationConfig';
21
- import type { Log } from '@finos/legend-shared';
22
21
  import { guaranteeNonNullable } from '@finos/legend-shared';
23
- import type { WebApplicationNavigator } from '../stores/WebApplicationNavigator';
22
+ import { useWebApplicationNavigator } from './WebApplicationNavigatorProvider';
23
+ import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager';
24
24
 
25
25
  const ApplicationStoreContext = createContext<
26
26
  ApplicationStore<LegendApplicationConfig> | undefined
@@ -29,16 +29,15 @@ const ApplicationStoreContext = createContext<
29
29
  export const ApplicationStoreProvider = <T extends LegendApplicationConfig>({
30
30
  children,
31
31
  config,
32
- navigator,
33
- log,
32
+ pluginManager,
34
33
  }: {
35
34
  children: React.ReactNode;
36
35
  config: T;
37
- navigator: WebApplicationNavigator;
38
- log: Log;
36
+ pluginManager: LegendApplicationPluginManager;
39
37
  }): React.ReactElement => {
38
+ const navigator = useWebApplicationNavigator();
40
39
  const applicationStore = useLocalObservable(
41
- () => new ApplicationStore(config, navigator, log),
40
+ () => new ApplicationStore(config, navigator, pluginManager),
42
41
  );
43
42
  return (
44
43
  <ApplicationStoreContext.Provider value={applicationStore}>
@@ -19,20 +19,18 @@ import { ApplicationStore } from '../stores/ApplicationStore';
19
19
  import { WebApplicationNavigator } from '../stores/WebApplicationNavigator';
20
20
  import type { LegendApplicationConfig } from '../stores/ApplicationConfig';
21
21
  import { ApplicationStoreProvider } from './ApplicationStoreProvider';
22
- import { Log } from '@finos/legend-shared';
22
+ import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager';
23
23
 
24
24
  export const TEST__ApplicationStoreProvider = ({
25
25
  children,
26
26
  config,
27
+ pluginManager,
27
28
  }: {
28
29
  children: React.ReactNode;
29
30
  config: LegendApplicationConfig;
31
+ pluginManager: LegendApplicationPluginManager;
30
32
  }): React.ReactElement => (
31
- <ApplicationStoreProvider
32
- config={config}
33
- navigator={new WebApplicationNavigator(createMemoryHistory())}
34
- log={new Log()}
35
- >
33
+ <ApplicationStoreProvider config={config} pluginManager={pluginManager}>
36
34
  {children}
37
35
  </ApplicationStoreProvider>
38
36
  );
@@ -41,6 +39,7 @@ export const TEST__provideMockedApplicationStore = <
41
39
  T extends LegendApplicationConfig,
42
40
  >(
43
41
  config: T,
42
+ pluginManager: LegendApplicationPluginManager,
44
43
  customization?: {
45
44
  mock?: ApplicationStore<T>;
46
45
  navigator?: WebApplicationNavigator;
@@ -52,7 +51,7 @@ export const TEST__provideMockedApplicationStore = <
52
51
  config,
53
52
  customization?.navigator ??
54
53
  new WebApplicationNavigator(createMemoryHistory()),
55
- new Log(),
54
+ pluginManager,
56
55
  );
57
56
  const MockedApplicationStoreProvider = require('./ApplicationStoreProvider'); // eslint-disable-line @typescript-eslint/no-unsafe-assignment
58
57
  MockedApplicationStoreProvider.useApplicationStore = jest.fn();
package/src/index.ts CHANGED
@@ -16,6 +16,7 @@
16
16
 
17
17
  export * from './const';
18
18
 
19
+ export * from './application/LegendApplicationPluginManager';
19
20
  export * from './application/LegendApplication';
20
21
 
21
22
  export * from './components/ApplicationStoreProvider';
@@ -41,5 +42,3 @@ export * from './stores/PackageableElementOption';
41
42
  export { GRAMMAR_ELEMENT_TYPE_LABEL } from './stores/PureLanguageSupport';
42
43
 
43
44
  export * from './stores/ApplicationStoreTestUtils';
44
-
45
- export * from './network/TelemetryEvent';
@@ -14,9 +14,13 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import type { Log, SuperGenericFunction } from '@finos/legend-shared';
17
+ import type { SuperGenericFunction } from '@finos/legend-shared';
18
18
  import {
19
+ EventNotifierService,
20
+ TracerService,
21
+ TelemetryService,
19
22
  assertTrue,
23
+ Log,
20
24
  LogEvent,
21
25
  assertErrorThrown,
22
26
  isString,
@@ -26,6 +30,7 @@ import { makeAutoObservable, action } from 'mobx';
26
30
  import { APPLICATION_LOG_EVENT } from './ApplicationLogEvent';
27
31
  import type { LegendApplicationConfig } from './ApplicationConfig';
28
32
  import type { WebApplicationNavigator } from './WebApplicationNavigator';
33
+ import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager';
29
34
 
30
35
  export enum ActionAlertType {
31
36
  STANDARD = 'STANDARD',
@@ -97,12 +102,20 @@ export class Notification {
97
102
  export class ApplicationStore<T extends LegendApplicationConfig> {
98
103
  navigator: WebApplicationNavigator;
99
104
  notification?: Notification | undefined;
100
- log: Log;
101
105
  blockingAlertInfo?: BlockingAlertInfo | undefined;
102
106
  actionAlertInfo?: ActionAlertInfo | undefined;
103
107
  config: T;
104
108
 
105
- constructor(config: T, navigator: WebApplicationNavigator, log: Log) {
109
+ log: Log = new Log();
110
+ telemetryService = new TelemetryService();
111
+ tracerService = new TracerService();
112
+ eventNotifierService = new EventNotifierService();
113
+
114
+ constructor(
115
+ config: T,
116
+ navigator: WebApplicationNavigator,
117
+ pluginManager: LegendApplicationPluginManager,
118
+ ) {
106
119
  makeAutoObservable(this, {
107
120
  navigator: false,
108
121
  setBlockingAlert: action,
@@ -117,7 +130,16 @@ export class ApplicationStore<T extends LegendApplicationConfig> {
117
130
 
118
131
  this.config = config;
119
132
  this.navigator = navigator;
120
- this.log = log;
133
+
134
+ // Register plugins
135
+ this.log.registerPlugins(pluginManager.getLoggerPlugins());
136
+ this.telemetryService.registerPlugins(
137
+ pluginManager.getTelemetryServicePlugins(),
138
+ );
139
+ this.tracerService.registerPlugins(pluginManager.getTracerServicePlugins());
140
+ this.eventNotifierService.registerPlugins(
141
+ pluginManager.getEventNotifierPlugins(),
142
+ );
121
143
  }
122
144
 
123
145
  setBlockingAlert(alertInfo: BlockingAlertInfo | undefined): void {
@@ -17,8 +17,8 @@
17
17
  import { ApplicationStore } from './ApplicationStore';
18
18
  import { createBrowserHistory } from 'history';
19
19
  import { WebApplicationNavigator } from './WebApplicationNavigator';
20
- import { Log } from '@finos/legend-shared';
21
20
  import type { LegendApplicationConfig } from './ApplicationConfig';
21
+ import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager';
22
22
 
23
23
  export const TEST_DATA__applicationVersion = {
24
24
  buildTime: '2001-01-01T00:00:00-0000',
@@ -30,9 +30,10 @@ export const TEST__getTestApplicationStore = <
30
30
  T extends LegendApplicationConfig,
31
31
  >(
32
32
  config: T,
33
+ pluginManager: LegendApplicationPluginManager,
33
34
  ): ApplicationStore<T> =>
34
35
  new ApplicationStore(
35
36
  config,
36
37
  new WebApplicationNavigator(createBrowserHistory()),
37
- new Log(),
38
+ pluginManager,
38
39
  );
@@ -34,6 +34,13 @@ import { guaranteeNonNullable } from '@finos/legend-shared';
34
34
  *
35
35
  * As such, instead, we should design a more generic concept `Location` to pass around.
36
36
  * We would need to flesh out the details, but this is the rough idea.
37
+ *
38
+ * Another thought is that we should also genericize Router so it handles more than just
39
+ * URLs. If we make `router` and `navigator` work together, we can potentially genericize
40
+ * application navigation
41
+ *
42
+ * However, this depends on how and when we move to another platform, like `electron` for example
43
+ * See https://github.com/finos/legend-studio/issues/718
37
44
  */
38
45
  interface ApplicationNavigator<T> {
39
46
  reload(): void;
package/tsconfig.json CHANGED
@@ -34,7 +34,6 @@
34
34
  "./src/const.ts",
35
35
  "./src/index.ts",
36
36
  "./src/components/ApplicationTestID.ts",
37
- "./src/network/TelemetryEvent.ts",
38
37
  "./src/stores/ApplicationConfig.ts",
39
38
  "./src/stores/ApplicationLogEvent.ts",
40
39
  "./src/stores/ApplicationStore.ts",
@@ -44,6 +43,7 @@
44
43
  "./src/stores/PureLanguageSupport.ts",
45
44
  "./src/stores/WebApplicationNavigator.ts",
46
45
  "./src/application/LegendApplication.tsx",
46
+ "./src/application/LegendApplicationPluginManager.tsx",
47
47
  "./src/components/ActionAlert.tsx",
48
48
  "./src/components/AppHeader.tsx",
49
49
  "./src/components/ApplicationBackdrop.tsx",