@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.
- package/CHANGELOG.md +16 -0
- package/lib/application/LegendApplication.d.ts +23 -11
- package/lib/application/LegendApplication.d.ts.map +1 -1
- package/lib/application/LegendApplication.js +28 -14
- package/lib/application/LegendApplication.js.map +1 -1
- package/lib/application/LegendApplicationPluginManager.d.ts +32 -0
- package/lib/application/LegendApplicationPluginManager.d.ts.map +1 -0
- package/lib/application/LegendApplicationPluginManager.js +47 -0
- package/lib/application/LegendApplicationPluginManager.js.map +1 -0
- package/lib/components/ApplicationStoreProvider.d.ts +3 -5
- package/lib/components/ApplicationStoreProvider.d.ts.map +1 -1
- package/lib/components/ApplicationStoreProvider.js +4 -2
- package/lib/components/ApplicationStoreProvider.js.map +1 -1
- package/lib/components/ApplicationStoreProviderTestUtils.d.ts +6 -3
- package/lib/components/ApplicationStoreProviderTestUtils.d.ts.map +1 -1
- package/lib/components/ApplicationStoreProviderTestUtils.js +3 -4
- package/lib/components/ApplicationStoreProviderTestUtils.js.map +1 -1
- package/lib/components/WebApplicationNavigatorProvider.d.ts +3 -2
- package/lib/components/WebApplicationNavigatorProvider.d.ts.map +1 -1
- package/lib/components/WebApplicationNavigatorProvider.js +1 -1
- package/lib/components/WebApplicationNavigatorProvider.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/stores/ApplicationStore.d.ts +8 -3
- package/lib/stores/ApplicationStore.d.ts.map +1 -1
- package/lib/stores/ApplicationStore.js +11 -4
- package/lib/stores/ApplicationStore.js.map +1 -1
- package/lib/stores/ApplicationStoreTestUtils.d.ts +2 -1
- package/lib/stores/ApplicationStoreTestUtils.d.ts.map +1 -1
- package/lib/stores/ApplicationStoreTestUtils.js +1 -2
- package/lib/stores/ApplicationStoreTestUtils.js.map +1 -1
- package/lib/stores/WebApplicationNavigator.d.ts +7 -0
- package/lib/stores/WebApplicationNavigator.d.ts.map +1 -1
- package/lib/stores/WebApplicationNavigator.js.map +1 -1
- package/package.json +12 -12
- package/src/application/LegendApplication.tsx +57 -27
- package/src/application/LegendApplicationPluginManager.tsx +73 -0
- package/src/components/ApplicationStoreProvider.tsx +6 -7
- package/src/components/ApplicationStoreProviderTestUtils.tsx +7 -12
- package/src/components/WebApplicationNavigatorProvider.tsx +2 -4
- package/src/index.ts +1 -2
- package/src/stores/ApplicationStore.ts +26 -4
- package/src/stores/ApplicationStoreTestUtils.ts +3 -2
- package/src/stores/WebApplicationNavigator.ts +7 -0
- package/tsconfig.json +1 -1
- package/lib/network/TelemetryEvent.d.ts +0 -19
- package/lib/network/TelemetryEvent.d.ts.map +0 -1
- package/lib/network/TelemetryEvent.js +0 -20
- package/lib/network/TelemetryEvent.js.map +0 -1
- package/src/network/TelemetryEvent.ts +0 -19
|
@@ -14,9 +14,11 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
/// <reference types="react" />
|
|
17
|
-
import type {
|
|
17
|
+
import type { SuperGenericFunction } from '@finos/legend-shared';
|
|
18
|
+
import { EventNotifierService, TracerService, TelemetryService, Log } from '@finos/legend-shared';
|
|
18
19
|
import type { LegendApplicationConfig } from './ApplicationConfig';
|
|
19
20
|
import type { WebApplicationNavigator } from './WebApplicationNavigator';
|
|
21
|
+
import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager';
|
|
20
22
|
export declare enum ActionAlertType {
|
|
21
23
|
STANDARD = "STANDARD",
|
|
22
24
|
CAUTION = "CAUTION"
|
|
@@ -68,11 +70,14 @@ export declare class Notification {
|
|
|
68
70
|
export declare class ApplicationStore<T extends LegendApplicationConfig> {
|
|
69
71
|
navigator: WebApplicationNavigator;
|
|
70
72
|
notification?: Notification | undefined;
|
|
71
|
-
log: Log;
|
|
72
73
|
blockingAlertInfo?: BlockingAlertInfo | undefined;
|
|
73
74
|
actionAlertInfo?: ActionAlertInfo | undefined;
|
|
74
75
|
config: T;
|
|
75
|
-
|
|
76
|
+
log: Log;
|
|
77
|
+
telemetryService: TelemetryService;
|
|
78
|
+
tracerService: TracerService;
|
|
79
|
+
eventNotifierService: EventNotifierService;
|
|
80
|
+
constructor(config: T, navigator: WebApplicationNavigator, pluginManager: LegendApplicationPluginManager);
|
|
76
81
|
setBlockingAlert(alertInfo: BlockingAlertInfo | undefined): void;
|
|
77
82
|
setActionAltertInfo(alertInfo: ActionAlertInfo | undefined): void;
|
|
78
83
|
setNotification(notification: Notification | undefined): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApplicationStore.d.ts","sourceRoot":"","sources":["../../src/stores/ApplicationStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ApplicationStore.d.ts","sourceRoot":"","sources":["../../src/stores/ApplicationStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAEhB,GAAG,EAKJ,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,+CAA+C,CAAC;AAEpG,oBAAY,eAAe;IACzB,QAAQ,aAAa;IACrB,OAAO,YAAY;CACpB;AAED,oBAAY,qBAAqB;IAC/B,QAAQ,aAAa;IACrB,oBAAoB,yBAAyB;IAC7C,OAAO,YAAY;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,M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BAA0B,UAAW,KAAK,KAAG,IAAI,CAO/C;IAEF;;OAEG;IACH,mBAAmB,aACN,MAAM,QAAQ,IAAI,CAAC,KAAG,CAAC,MAAM,QAAQ,IAAI,CAAC,CAAC,CAEF;IAEhD,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA8BtD,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAGpD"}
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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;
|
|
1
|
+
{"version":3,"file":"ApplicationStore.js","sourceRoot":"","sources":["../../src/stores/ApplicationStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,GAAG,EACH,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;AAK9D,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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AC,CAAC;YACH,OAAO;SACR;QACD,oFAAoF;QACpF,IAAI,QAAQ,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE;YAC1C,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YACnD,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;YAChC,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC;YAC5B,QAAQ,CAAC,eAAe,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YAC9C,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;YACrB,OAAO,CAAC,MAAM,EAAE,CAAC;YACjB,IAAI;gBACF,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;aAC9B;YAAC,OAAO,KAAK,EAAE;gBACd,iBAAiB,CAAC,KAAK,CAAC,CAAC;gBACzB,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,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;
|
|
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()),
|
|
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;
|
|
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 generalize Router so it handles more than just
|
|
36
|
+
* URLs. If we make `router` and `navigator` work together, we can potentially generalize
|
|
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
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,UAAU,oBAAoB,CAAC,CAAC;IAC9B,MAAM,IAAI,IAAI,CAAC;IACf,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAG,IAAI,CAAC;IACxB,MAAM,CAAC,QAAQ,EAAE,CAAC,GAAG,IAAI,CAAC;IAC1B,aAAa,CAAC,QAAQ,EAAE,CAAC,GAAG,IAAI,CAAC;IACjC,kBAAkB,IAAI,CAAC,CAAC;IACxB,sBAAsB,IAAI,CAAC,CAAC;IAC5B,gBAAgB,CAAC,YAAY,EAAE,CAAC,GAAG,CAAC,CAAC;CACtC;AAED,qBAAa,uBAAwB,YAAW,oBAAoB,CAAC,MAAM,CAAC;IAC1E,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAU;IAErC,OAAO,KAAK,MAAM,GAKjB;gBAEW,gBAAgB,EAAE,OAAO;IAIrC,MAAM,IAAI,IAAI;IAId,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAI5B,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAI9B,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAIrC,kBAAkB,IAAI,MAAM;IAI5B,sBAAsB,IAAI,MAAM;IAIhC,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;CAM/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebApplicationNavigator.js","sourceRoot":"","sources":["../../src/stores/WebApplicationNavigator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"WebApplicationNavigator.js","sourceRoot":"","sources":["../../src/stores/WebApplicationNavigator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAqC5D,MAAM,OAAO,uBAAuB;IACjB,UAAU,CAAU;IAErC,IAAY,MAAM;QAChB,OAAO,oBAAoB,CACzB,MAAM,EACN,uDAAuD,CACxD,CAAC;IACJ,CAAC;IAED,YAAY,gBAAyB;QACnC,IAAI,CAAC,UAAU,GAAG,gBAAgB,CAAC;IACrC,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;IAChC,CAAC;IAED,IAAI,CAAC,QAAgB;QACnB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,QAAgB;QACrB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC;IACvC,CAAC;IAED,aAAa,CAAC,QAAgB;QAC5B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,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.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Legend application core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"legend",
|
|
@@ -38,19 +38,19 @@
|
|
|
38
38
|
"test:watch": "jest --watch"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@finos/legend-art": "0.
|
|
42
|
-
"@finos/legend-graph": "0.
|
|
43
|
-
"@finos/legend-shared": "
|
|
41
|
+
"@finos/legend-art": "0.2.3",
|
|
42
|
+
"@finos/legend-graph": "0.4.1",
|
|
43
|
+
"@finos/legend-shared": "1.0.2",
|
|
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.
|
|
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.
|
|
51
|
+
"mobx": "6.3.9",
|
|
52
52
|
"mobx-react-lite": "3.2.2",
|
|
53
|
-
"monaco-editor": "0.
|
|
53
|
+
"monaco-editor": "0.31.1",
|
|
54
54
|
"react": "17.0.2",
|
|
55
55
|
"react-dom": "17.0.2",
|
|
56
56
|
"react-icons": "4.3.1",
|
|
@@ -60,15 +60,15 @@
|
|
|
60
60
|
"serializr": "2.0.5"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@finos/legend-dev-utils": "0.
|
|
63
|
+
"@finos/legend-dev-utils": "0.3.3",
|
|
64
64
|
"@testing-library/dom": "8.11.1",
|
|
65
65
|
"cross-env": "7.0.3",
|
|
66
|
-
"eslint": "8.
|
|
67
|
-
"jest": "27.
|
|
66
|
+
"eslint": "8.4.1",
|
|
67
|
+
"jest": "27.4.5",
|
|
68
68
|
"npm-run-all": "4.1.5",
|
|
69
69
|
"rimraf": "3.0.2",
|
|
70
|
-
"sass": "1.
|
|
71
|
-
"typescript": "4.5.
|
|
70
|
+
"sass": "1.45.0",
|
|
71
|
+
"typescript": "4.5.4"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
74
|
"react": "^17.0.0"
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
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:
|
|
167
|
+
pluginManager: LegendApplicationPluginManager,
|
|
134
168
|
config: LegendApplicationConfig,
|
|
135
169
|
) => void)
|
|
136
170
|
| undefined;
|
|
137
171
|
protected _isConfigured = false;
|
|
138
172
|
|
|
139
|
-
protected constructor(pluginManager:
|
|
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
|
|
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:
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
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
|
-
|
|
33
|
-
log,
|
|
32
|
+
pluginManager,
|
|
34
33
|
}: {
|
|
35
34
|
children: React.ReactNode;
|
|
36
35
|
config: T;
|
|
37
|
-
|
|
38
|
-
log: Log;
|
|
36
|
+
pluginManager: LegendApplicationPluginManager;
|
|
39
37
|
}): React.ReactElement => {
|
|
38
|
+
const navigator = useWebApplicationNavigator();
|
|
40
39
|
const applicationStore = useLocalObservable(
|
|
41
|
-
() => new ApplicationStore(config, navigator,
|
|
40
|
+
() => new ApplicationStore(config, navigator, pluginManager),
|
|
42
41
|
);
|
|
43
42
|
return (
|
|
44
43
|
<ApplicationStoreContext.Provider value={applicationStore}>
|
|
@@ -19,20 +19,14 @@ 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 {
|
|
22
|
+
import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager';
|
|
23
23
|
|
|
24
|
-
export const TEST__ApplicationStoreProvider
|
|
25
|
-
children,
|
|
26
|
-
config,
|
|
27
|
-
}: {
|
|
24
|
+
export const TEST__ApplicationStoreProvider: React.FC<{
|
|
28
25
|
children: React.ReactNode;
|
|
29
26
|
config: LegendApplicationConfig;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
navigator={new WebApplicationNavigator(createMemoryHistory())}
|
|
34
|
-
log={new Log()}
|
|
35
|
-
>
|
|
27
|
+
pluginManager: LegendApplicationPluginManager;
|
|
28
|
+
}> = ({ children, config, pluginManager }) => (
|
|
29
|
+
<ApplicationStoreProvider config={config} pluginManager={pluginManager}>
|
|
36
30
|
{children}
|
|
37
31
|
</ApplicationStoreProvider>
|
|
38
32
|
);
|
|
@@ -41,6 +35,7 @@ export const TEST__provideMockedApplicationStore = <
|
|
|
41
35
|
T extends LegendApplicationConfig,
|
|
42
36
|
>(
|
|
43
37
|
config: T,
|
|
38
|
+
pluginManager: LegendApplicationPluginManager,
|
|
44
39
|
customization?: {
|
|
45
40
|
mock?: ApplicationStore<T>;
|
|
46
41
|
navigator?: WebApplicationNavigator;
|
|
@@ -52,7 +47,7 @@ export const TEST__provideMockedApplicationStore = <
|
|
|
52
47
|
config,
|
|
53
48
|
customization?.navigator ??
|
|
54
49
|
new WebApplicationNavigator(createMemoryHistory()),
|
|
55
|
-
|
|
50
|
+
pluginManager,
|
|
56
51
|
);
|
|
57
52
|
const MockedApplicationStoreProvider = require('./ApplicationStoreProvider'); // eslint-disable-line @typescript-eslint/no-unsafe-assignment
|
|
58
53
|
MockedApplicationStoreProvider.useApplicationStore = jest.fn();
|
|
@@ -25,11 +25,9 @@ const WebApplicationNavigatorContext = createContext<
|
|
|
25
25
|
WebApplicationNavigator | undefined
|
|
26
26
|
>(undefined);
|
|
27
27
|
|
|
28
|
-
export const WebApplicationNavigatorProvider
|
|
29
|
-
children,
|
|
30
|
-
}: {
|
|
28
|
+
export const WebApplicationNavigatorProvider: React.FC<{
|
|
31
29
|
children: React.ReactNode;
|
|
32
|
-
})
|
|
30
|
+
}> = ({ children }) => {
|
|
33
31
|
const history = useHistory() as History;
|
|
34
32
|
const navigator = useLocalObservable(
|
|
35
33
|
() => new WebApplicationNavigator(history),
|
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';
|