@finos/legend-application 0.2.1 → 1.0.3

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 (54) hide show
  1. package/CHANGELOG.md +16 -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 +6 -3
  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/components/WebApplicationNavigatorProvider.d.ts +3 -2
  19. package/lib/components/WebApplicationNavigatorProvider.d.ts.map +1 -1
  20. package/lib/components/WebApplicationNavigatorProvider.js +1 -1
  21. package/lib/components/WebApplicationNavigatorProvider.js.map +1 -1
  22. package/lib/index.css +2 -2
  23. package/lib/index.css.map +1 -1
  24. package/lib/index.d.ts +1 -1
  25. package/lib/index.d.ts.map +1 -1
  26. package/lib/index.js +1 -1
  27. package/lib/index.js.map +1 -1
  28. package/lib/stores/ApplicationStore.d.ts +8 -3
  29. package/lib/stores/ApplicationStore.d.ts.map +1 -1
  30. package/lib/stores/ApplicationStore.js +11 -4
  31. package/lib/stores/ApplicationStore.js.map +1 -1
  32. package/lib/stores/ApplicationStoreTestUtils.d.ts +2 -1
  33. package/lib/stores/ApplicationStoreTestUtils.d.ts.map +1 -1
  34. package/lib/stores/ApplicationStoreTestUtils.js +1 -2
  35. package/lib/stores/ApplicationStoreTestUtils.js.map +1 -1
  36. package/lib/stores/WebApplicationNavigator.d.ts +7 -0
  37. package/lib/stores/WebApplicationNavigator.d.ts.map +1 -1
  38. package/lib/stores/WebApplicationNavigator.js.map +1 -1
  39. package/package.json +12 -12
  40. package/src/application/LegendApplication.tsx +57 -27
  41. package/src/application/LegendApplicationPluginManager.tsx +73 -0
  42. package/src/components/ApplicationStoreProvider.tsx +6 -7
  43. package/src/components/ApplicationStoreProviderTestUtils.tsx +7 -12
  44. package/src/components/WebApplicationNavigatorProvider.tsx +2 -4
  45. package/src/index.ts +1 -2
  46. package/src/stores/ApplicationStore.ts +26 -4
  47. package/src/stores/ApplicationStoreTestUtils.ts +3 -2
  48. package/src/stores/WebApplicationNavigator.ts +7 -0
  49. package/tsconfig.json +1 -1
  50. package/lib/network/TelemetryEvent.d.ts +0 -19
  51. package/lib/network/TelemetryEvent.d.ts.map +0 -1
  52. package/lib/network/TelemetryEvent.js +0 -20
  53. package/lib/network/TelemetryEvent.js.map +0 -1
  54. package/src/network/TelemetryEvent.ts +0 -19
@@ -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 generalize Router so it handles more than just
39
+ * URLs. If we make `router` and `navigator` work together, we can potentially generalize
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",
@@ -1,19 +0,0 @@
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
- export declare enum CORE_TELEMETRY_EVENT {
17
- APPLICATION_LOADED = "Application loaded"
18
- }
19
- //# sourceMappingURL=TelemetryEvent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TelemetryEvent.d.ts","sourceRoot":"","sources":["../../src/network/TelemetryEvent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,oBAAY,oBAAoB;IAC9B,kBAAkB,uBAAuB;CAC1C"}
@@ -1,20 +0,0 @@
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
- export var CORE_TELEMETRY_EVENT;
17
- (function (CORE_TELEMETRY_EVENT) {
18
- CORE_TELEMETRY_EVENT["APPLICATION_LOADED"] = "Application loaded";
19
- })(CORE_TELEMETRY_EVENT || (CORE_TELEMETRY_EVENT = {}));
20
- //# sourceMappingURL=TelemetryEvent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TelemetryEvent.js","sourceRoot":"","sources":["../../src/network/TelemetryEvent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,CAAN,IAAY,oBAEX;AAFD,WAAY,oBAAoB;IAC9B,iEAAyC,CAAA;AAC3C,CAAC,EAFW,oBAAoB,KAApB,oBAAoB,QAE/B"}
@@ -1,19 +0,0 @@
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
- export enum CORE_TELEMETRY_EVENT {
18
- APPLICATION_LOADED = 'Application loaded',
19
- }