@finos/legend-application 6.0.2 → 7.0.2
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/lib/application/LegendApplication.d.ts +10 -9
- package/lib/application/LegendApplication.d.ts.map +1 -1
- package/lib/application/LegendApplication.js +2 -2
- package/lib/application/LegendApplication.js.map +1 -1
- package/lib/{stores → application}/LegendApplicationConfig.d.ts +8 -8
- package/lib/application/LegendApplicationConfig.d.ts.map +1 -0
- package/lib/{stores → application}/LegendApplicationConfig.js +2 -2
- package/lib/application/LegendApplicationConfig.js.map +1 -0
- package/lib/application/LegendApplicationPluginManager.d.ts +4 -4
- package/lib/application/LegendApplicationPluginManager.d.ts.map +1 -1
- package/lib/application/LegendApplicationPluginManager.js.map +1 -1
- package/lib/components/ActionAlert.js +2 -2
- package/lib/components/ActionAlert.js.map +1 -1
- package/lib/components/{LegendApplicationNavigationContextServiceUtils.d.ts → ApplicationNavigationContextServiceUtils.d.ts} +14 -2
- package/lib/components/ApplicationNavigationContextServiceUtils.d.ts.map +1 -0
- package/lib/components/{LegendApplicationNavigationContextServiceUtils.js → ApplicationNavigationContextServiceUtils.js} +15 -3
- package/lib/components/ApplicationNavigationContextServiceUtils.js.map +1 -0
- package/lib/components/ApplicationStoreProvider.d.ts +5 -4
- package/lib/components/ApplicationStoreProvider.d.ts.map +1 -1
- package/lib/components/ApplicationStoreProvider.js +1 -1
- package/lib/components/ApplicationStoreProvider.js.map +1 -1
- package/lib/components/ApplicationStoreProviderTestUtils.d.ts +6 -5
- package/lib/components/ApplicationStoreProviderTestUtils.d.ts.map +1 -1
- package/lib/components/ApplicationStoreProviderTestUtils.js.map +1 -1
- package/lib/components/VirtualAssistant.d.ts.map +1 -1
- package/lib/components/VirtualAssistant.js +5 -6
- package/lib/components/VirtualAssistant.js.map +1 -1
- package/lib/components/shared/PackageableElementOptionRenderer.d.ts +1 -1
- package/lib/components/shared/PackageableElementOptionRenderer.d.ts.map +1 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +6 -6
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +6 -6
- package/lib/index.js.map +1 -1
- package/lib/stores/{LegendApplicationNavigationContextService.d.ts → ApplicationNavigationContextService.d.ts} +5 -6
- package/lib/stores/ApplicationNavigationContextService.d.ts.map +1 -0
- package/lib/stores/{LegendApplicationNavigationContextService.js → ApplicationNavigationContextService.js} +2 -2
- package/lib/stores/ApplicationNavigationContextService.js.map +1 -0
- package/lib/stores/ApplicationStore.d.ts +14 -12
- package/lib/stores/ApplicationStore.d.ts.map +1 -1
- package/lib/stores/ApplicationStore.js +8 -9
- package/lib/stores/ApplicationStore.js.map +1 -1
- package/lib/stores/ApplicationStoreTestUtils.d.ts +3 -2
- package/lib/stores/ApplicationStoreTestUtils.d.ts.map +1 -1
- package/lib/stores/ApplicationStoreTestUtils.js.map +1 -1
- package/lib/stores/{LegendApplicationAssistantService.d.ts → AssistantService.d.ts} +8 -9
- package/lib/stores/AssistantService.d.ts.map +1 -0
- package/lib/stores/{LegendApplicationAssistantService.js → AssistantService.js} +2 -2
- package/lib/stores/AssistantService.js.map +1 -0
- package/lib/stores/{LegendApplicationDocumentationService.d.ts → DocumentationService.d.ts} +23 -24
- package/lib/stores/DocumentationService.d.ts.map +1 -0
- package/lib/stores/{LegendApplicationDocumentationService.js → DocumentationService.js} +15 -16
- package/lib/stores/DocumentationService.js.map +1 -0
- package/lib/stores/{LegendApplicationEventService.d.ts → EventService.d.ts} +2 -2
- package/lib/stores/EventService.d.ts.map +1 -0
- package/lib/stores/{LegendApplicationEventService.js → EventService.js} +2 -2
- package/lib/stores/EventService.js.map +1 -0
- package/lib/stores/LegendApplicationPlugin.d.ts +20 -5
- package/lib/stores/LegendApplicationPlugin.d.ts.map +1 -1
- package/lib/stores/LegendApplicationPlugin.js +5 -0
- package/lib/stores/LegendApplicationPlugin.js.map +1 -1
- package/lib/stores/PureLanguageSupport.d.ts +2 -2
- package/lib/stores/PureLanguageSupport.d.ts.map +1 -1
- package/lib/stores/PureLanguageSupport.js.map +1 -1
- package/lib/stores/shared/ExecutionPlanState.d.ts +3 -4
- package/lib/stores/shared/ExecutionPlanState.d.ts.map +1 -1
- package/lib/stores/shared/ExecutionPlanState.js.map +1 -1
- package/lib/stores/shared/PackageableElementOption.d.ts +1 -1
- package/lib/stores/shared/PackageableElementOption.d.ts.map +1 -1
- package/lib/stores/shared/PackageableElementOption.js.map +1 -1
- package/package.json +11 -13
- package/src/application/LegendApplication.tsx +24 -23
- package/src/{stores → application}/LegendApplicationConfig.ts +16 -19
- package/src/application/LegendApplicationPluginManager.tsx +4 -4
- package/src/components/ActionAlert.tsx +2 -2
- package/src/components/{LegendApplicationNavigationContextServiceUtils.tsx → ApplicationNavigationContextServiceUtils.tsx} +14 -2
- package/src/components/ApplicationStoreProvider.tsx +15 -7
- package/src/components/ApplicationStoreProviderTestUtils.tsx +7 -5
- package/src/components/VirtualAssistant.tsx +5 -6
- package/src/components/shared/PackageableElementOptionRenderer.tsx +1 -1
- package/src/index.ts +6 -6
- package/src/stores/{LegendApplicationNavigationContextService.ts → ApplicationNavigationContextService.ts} +4 -5
- package/src/stores/ApplicationStore.ts +26 -16
- package/src/stores/ApplicationStoreTestUtils.ts +5 -3
- package/src/stores/{LegendApplicationAssistantService.ts → AssistantService.ts} +8 -9
- package/src/stores/{LegendApplicationDocumentationService.ts → DocumentationService.ts} +39 -54
- package/src/stores/{LegendApplicationEventService.ts → EventService.ts} +1 -1
- package/src/stores/LegendApplicationPlugin.ts +27 -9
- package/src/stores/PureLanguageSupport.ts +2 -2
- package/src/stores/shared/ExecutionPlanState.ts +3 -4
- package/src/stores/shared/PackageableElementOption.ts +3 -3
- package/tsconfig.json +6 -6
- package/lib/components/LegendApplicationNavigationContextServiceUtils.d.ts.map +0 -1
- package/lib/components/LegendApplicationNavigationContextServiceUtils.js.map +0 -1
- package/lib/stores/LegendApplicationAssistantService.d.ts.map +0 -1
- package/lib/stores/LegendApplicationAssistantService.js.map +0 -1
- package/lib/stores/LegendApplicationConfig.d.ts.map +0 -1
- package/lib/stores/LegendApplicationConfig.js.map +0 -1
- package/lib/stores/LegendApplicationDocumentationService.d.ts.map +0 -1
- package/lib/stores/LegendApplicationDocumentationService.js.map +0 -1
- package/lib/stores/LegendApplicationEventService.d.ts.map +0 -1
- package/lib/stores/LegendApplicationEventService.js.map +0 -1
- package/lib/stores/LegendApplicationNavigationContextService.d.ts.map +0 -1
- package/lib/stores/LegendApplicationNavigationContextService.js.map +0 -1
|
@@ -18,14 +18,15 @@ import { jest } from '@jest/globals';
|
|
|
18
18
|
import { createMemoryHistory } from 'history';
|
|
19
19
|
import { ApplicationStore } from '../stores/ApplicationStore.js';
|
|
20
20
|
import { WebApplicationNavigator } from '../stores/WebApplicationNavigator.js';
|
|
21
|
-
import type { LegendApplicationConfig } from '../
|
|
21
|
+
import type { LegendApplicationConfig } from '../application/LegendApplicationConfig.js';
|
|
22
22
|
import { ApplicationStoreProvider } from './ApplicationStoreProvider.js';
|
|
23
23
|
import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager.js';
|
|
24
|
+
import type { LegendApplicationPlugin } from '../stores/LegendApplicationPlugin.js';
|
|
24
25
|
|
|
25
26
|
export const TEST__ApplicationStoreProvider: React.FC<{
|
|
26
27
|
children: React.ReactNode;
|
|
27
28
|
config: LegendApplicationConfig;
|
|
28
|
-
pluginManager: LegendApplicationPluginManager
|
|
29
|
+
pluginManager: LegendApplicationPluginManager<LegendApplicationPlugin>;
|
|
29
30
|
}> = ({ children, config, pluginManager }) => (
|
|
30
31
|
<ApplicationStoreProvider config={config} pluginManager={pluginManager}>
|
|
31
32
|
{children}
|
|
@@ -34,14 +35,15 @@ export const TEST__ApplicationStoreProvider: React.FC<{
|
|
|
34
35
|
|
|
35
36
|
export const TEST__provideMockedApplicationStore = <
|
|
36
37
|
T extends LegendApplicationConfig,
|
|
38
|
+
V extends LegendApplicationPlugin,
|
|
37
39
|
>(
|
|
38
40
|
config: T,
|
|
39
|
-
pluginManager: LegendApplicationPluginManager
|
|
41
|
+
pluginManager: LegendApplicationPluginManager<V>,
|
|
40
42
|
customization?: {
|
|
41
|
-
mock?: ApplicationStore<T>;
|
|
43
|
+
mock?: ApplicationStore<T, V>;
|
|
42
44
|
navigator?: WebApplicationNavigator;
|
|
43
45
|
},
|
|
44
|
-
): ApplicationStore<T> => {
|
|
46
|
+
): ApplicationStore<T, V> => {
|
|
45
47
|
const value =
|
|
46
48
|
customization?.mock ??
|
|
47
49
|
new ApplicationStore(
|
|
@@ -51,11 +51,11 @@ import { TAB_SIZE } from '../const.js';
|
|
|
51
51
|
import {
|
|
52
52
|
type VirtualAssistantDocumentationEntry,
|
|
53
53
|
VIRTUAL_ASSISTANT_TAB,
|
|
54
|
-
} from '../stores/
|
|
54
|
+
} from '../stores/AssistantService.js';
|
|
55
55
|
import { useApplicationStore } from './ApplicationStoreProvider.js';
|
|
56
56
|
import Draggable from 'react-draggable';
|
|
57
57
|
import { DATE_TIME_FORMAT } from '@finos/legend-graph';
|
|
58
|
-
import { ApplicationTelemetry } from '../
|
|
58
|
+
import { ApplicationTelemetry } from '../stores/ApplicationTelemetry.js';
|
|
59
59
|
|
|
60
60
|
const WIZARD_GREETING = `Bonjour, It's Pierre!`;
|
|
61
61
|
|
|
@@ -293,14 +293,14 @@ const VirtualAssistantSearchPanel = observer(() => {
|
|
|
293
293
|
ContentType.APPLICATION_JSON,
|
|
294
294
|
);
|
|
295
295
|
};
|
|
296
|
-
const
|
|
296
|
+
const downloadContextualDocIndex = (): void => {
|
|
297
297
|
downloadFileUsingDataURI(
|
|
298
298
|
`documentation-registry_${format(
|
|
299
299
|
new Date(Date.now()),
|
|
300
300
|
DATE_TIME_FORMAT,
|
|
301
301
|
)}.json`,
|
|
302
302
|
JSON.stringify(
|
|
303
|
-
applicationStore.documentationService.
|
|
303
|
+
applicationStore.documentationService.publishContextualDocIndex(),
|
|
304
304
|
undefined,
|
|
305
305
|
TAB_SIZE,
|
|
306
306
|
),
|
|
@@ -419,7 +419,7 @@ const VirtualAssistantSearchPanel = observer(() => {
|
|
|
419
419
|
<MenuContentItem onClick={downloadDocRegistry}>
|
|
420
420
|
Download documentation registry
|
|
421
421
|
</MenuContentItem>
|
|
422
|
-
<MenuContentItem onClick={
|
|
422
|
+
<MenuContentItem onClick={downloadContextualDocIndex}>
|
|
423
423
|
Download contextual documentation mapping
|
|
424
424
|
</MenuContentItem>
|
|
425
425
|
</MenuContent>
|
|
@@ -519,7 +519,6 @@ const VirtualAssistantPanel = observer(
|
|
|
519
519
|
if (event.key === 'Tab') {
|
|
520
520
|
event.preventDefault();
|
|
521
521
|
event.stopPropagation();
|
|
522
|
-
return;
|
|
523
522
|
}
|
|
524
523
|
}}
|
|
525
524
|
>
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import type { PackageableElement } from '@finos/legend-graph';
|
|
18
|
-
import type { PackageableElementOption } from '../../
|
|
18
|
+
import type { PackageableElementOption } from '../../stores/shared/PackageableElementOption.js';
|
|
19
19
|
|
|
20
20
|
export const getPackageableElementOptionalFormatter = (props?: {
|
|
21
21
|
darkMode?: boolean;
|
package/src/index.ts
CHANGED
|
@@ -21,7 +21,7 @@ export * from './application/LegendApplication.js';
|
|
|
21
21
|
export * from './components/ApplicationStoreProvider.js';
|
|
22
22
|
export * from './components/WebApplicationNavigatorProvider.js';
|
|
23
23
|
export * from './components/LegendApplicationComponentFrameworkProvider.js';
|
|
24
|
-
export * from './components/
|
|
24
|
+
export * from './components/ApplicationNavigationContextServiceUtils.js';
|
|
25
25
|
export * from './components/ApplicationStoreProviderTestUtils.js';
|
|
26
26
|
export * from './components/WebApplicationNavigatorProviderTestUtils.js';
|
|
27
27
|
// TODO: consider moving this to `LegendApplicationComponentFrameworkProvider`
|
|
@@ -31,12 +31,12 @@ export * from './components/VirtualAssistant.js';
|
|
|
31
31
|
export * from './stores/ApplicationStore.js';
|
|
32
32
|
export * from './stores/ApplicationTelemetry.js';
|
|
33
33
|
export * from './stores/ApplicationEvent.js';
|
|
34
|
-
export * from './
|
|
34
|
+
export * from './application/LegendApplicationConfig.js';
|
|
35
35
|
export { WebApplicationNavigator } from './stores/WebApplicationNavigator.js';
|
|
36
|
-
export * from './stores/
|
|
37
|
-
export * from './stores/
|
|
38
|
-
export * from './stores/
|
|
39
|
-
export * from './stores/
|
|
36
|
+
export * from './stores/DocumentationService.js';
|
|
37
|
+
export * from './stores/EventService.js';
|
|
38
|
+
export * from './stores/AssistantService.js';
|
|
39
|
+
export * from './stores/ApplicationNavigationContextService.js';
|
|
40
40
|
export * from './stores/LegendApplicationPlugin.js';
|
|
41
41
|
|
|
42
42
|
export * from './stores/ApplicationStoreTestUtils.js';
|
|
@@ -16,9 +16,8 @@
|
|
|
16
16
|
|
|
17
17
|
import { IllegalStateError } from '@finos/legend-shared';
|
|
18
18
|
import { action, computed, makeObservable, observable } from 'mobx';
|
|
19
|
-
import type {
|
|
19
|
+
import type { GenericLegendApplicationStore } from './ApplicationStore.js';
|
|
20
20
|
import { ApplicationTelemetry } from './ApplicationTelemetry.js';
|
|
21
|
-
import type { LegendApplicationConfig } from './LegendApplicationConfig.js';
|
|
22
21
|
|
|
23
22
|
/**
|
|
24
23
|
* Context data refers to the area of the application that the user is
|
|
@@ -66,11 +65,11 @@ export class ApplicationNavigationContextData {
|
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
67
|
|
|
69
|
-
export class
|
|
70
|
-
applicationStore:
|
|
68
|
+
export class ApplicationNavigationContextService {
|
|
69
|
+
applicationStore: GenericLegendApplicationStore;
|
|
71
70
|
contextStack: ApplicationNavigationContextData[] = [];
|
|
72
71
|
|
|
73
|
-
constructor(applicationStore:
|
|
72
|
+
constructor(applicationStore: GenericLegendApplicationStore) {
|
|
74
73
|
makeObservable(this, {
|
|
75
74
|
contextStack: observable,
|
|
76
75
|
currentContext: computed,
|
|
@@ -27,13 +27,14 @@ import {
|
|
|
27
27
|
} from '@finos/legend-shared';
|
|
28
28
|
import { makeAutoObservable, action } from 'mobx';
|
|
29
29
|
import { APPLICATION_EVENT } from './ApplicationEvent.js';
|
|
30
|
-
import type { LegendApplicationConfig } from '
|
|
30
|
+
import type { LegendApplicationConfig } from '../application/LegendApplicationConfig.js';
|
|
31
31
|
import type { WebApplicationNavigator } from './WebApplicationNavigator.js';
|
|
32
32
|
import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager.js';
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
33
|
+
import { DocumentationService } from './DocumentationService.js';
|
|
34
|
+
import { AssistantService } from './AssistantService.js';
|
|
35
|
+
import { EventService } from './EventService.js';
|
|
36
|
+
import { ApplicationNavigationContextService } from './ApplicationNavigationContextService.js';
|
|
37
|
+
import type { LegendApplicationPlugin } from './LegendApplicationPlugin.js';
|
|
37
38
|
|
|
38
39
|
export enum ActionAlertType {
|
|
39
40
|
STANDARD = 'STANDARD',
|
|
@@ -102,13 +103,21 @@ export class Notification {
|
|
|
102
103
|
}
|
|
103
104
|
}
|
|
104
105
|
|
|
105
|
-
export
|
|
106
|
-
|
|
106
|
+
export type GenericLegendApplicationStore = ApplicationStore<
|
|
107
|
+
LegendApplicationConfig,
|
|
108
|
+
LegendApplicationPlugin
|
|
109
|
+
>;
|
|
110
|
+
|
|
111
|
+
export class ApplicationStore<
|
|
112
|
+
T extends LegendApplicationConfig,
|
|
113
|
+
V extends LegendApplicationPlugin,
|
|
114
|
+
> {
|
|
115
|
+
pluginManager: LegendApplicationPluginManager<V>;
|
|
107
116
|
config: T;
|
|
108
117
|
|
|
109
118
|
// navigation
|
|
110
119
|
navigator: WebApplicationNavigator;
|
|
111
|
-
navigationContextService:
|
|
120
|
+
navigationContextService: ApplicationNavigationContextService;
|
|
112
121
|
|
|
113
122
|
// TODO: refactor this to `NotificationService` including notifications and alerts
|
|
114
123
|
notification?: Notification | undefined;
|
|
@@ -119,18 +128,18 @@ export class ApplicationStore<T extends LegendApplicationConfig> {
|
|
|
119
128
|
log: Log = new Log();
|
|
120
129
|
|
|
121
130
|
// documentation & help
|
|
122
|
-
documentationService:
|
|
123
|
-
assistantService:
|
|
131
|
+
documentationService: DocumentationService;
|
|
132
|
+
assistantService: AssistantService;
|
|
124
133
|
|
|
125
134
|
// communication
|
|
126
|
-
eventService = new
|
|
135
|
+
eventService = new EventService();
|
|
127
136
|
telemetryService = new TelemetryService();
|
|
128
137
|
tracerService = new TracerService();
|
|
129
138
|
|
|
130
139
|
constructor(
|
|
131
140
|
config: T,
|
|
132
141
|
navigator: WebApplicationNavigator,
|
|
133
|
-
pluginManager: LegendApplicationPluginManager
|
|
142
|
+
pluginManager: LegendApplicationPluginManager<V>,
|
|
134
143
|
) {
|
|
135
144
|
makeAutoObservable(this, {
|
|
136
145
|
navigator: false,
|
|
@@ -150,10 +159,11 @@ export class ApplicationStore<T extends LegendApplicationConfig> {
|
|
|
150
159
|
// NOTE: set the logger first so other loading could use the configured logger
|
|
151
160
|
this.log.registerPlugins(pluginManager.getLoggerPlugins());
|
|
152
161
|
|
|
153
|
-
this.navigationContextService =
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
this.
|
|
162
|
+
this.navigationContextService = new ApplicationNavigationContextService(
|
|
163
|
+
this,
|
|
164
|
+
);
|
|
165
|
+
this.documentationService = new DocumentationService(this);
|
|
166
|
+
this.assistantService = new AssistantService(this);
|
|
157
167
|
this.telemetryService.registerPlugins(
|
|
158
168
|
pluginManager.getTelemetryServicePlugins(),
|
|
159
169
|
);
|
|
@@ -17,8 +17,9 @@
|
|
|
17
17
|
import { ApplicationStore } from './ApplicationStore.js';
|
|
18
18
|
import { createBrowserHistory } from 'history';
|
|
19
19
|
import { WebApplicationNavigator } from './WebApplicationNavigator.js';
|
|
20
|
-
import type { LegendApplicationConfig } from '
|
|
20
|
+
import type { LegendApplicationConfig } from '../application/LegendApplicationConfig.js';
|
|
21
21
|
import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager.js';
|
|
22
|
+
import type { LegendApplicationPlugin } from './LegendApplicationPlugin.js';
|
|
22
23
|
|
|
23
24
|
export const TEST_DATA__applicationVersion = {
|
|
24
25
|
buildTime: '2001-01-01T00:00:00-0000',
|
|
@@ -28,10 +29,11 @@ export const TEST_DATA__applicationVersion = {
|
|
|
28
29
|
|
|
29
30
|
export const TEST__getTestApplicationStore = <
|
|
30
31
|
T extends LegendApplicationConfig,
|
|
32
|
+
V extends LegendApplicationPlugin,
|
|
31
33
|
>(
|
|
32
34
|
config: T,
|
|
33
|
-
pluginManager: LegendApplicationPluginManager
|
|
34
|
-
): ApplicationStore<T> =>
|
|
35
|
+
pluginManager: LegendApplicationPluginManager<V>,
|
|
36
|
+
): ApplicationStore<T, V> =>
|
|
35
37
|
new ApplicationStore(
|
|
36
38
|
config,
|
|
37
39
|
new WebApplicationNavigator(createBrowserHistory()),
|
|
@@ -15,9 +15,8 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { action, makeObservable, observable, computed } from 'mobx';
|
|
18
|
-
import type {
|
|
19
|
-
import type {
|
|
20
|
-
import type { ApplicationStore } from './ApplicationStore.js';
|
|
18
|
+
import type { DocumentationEntry } from './DocumentationService.js';
|
|
19
|
+
import type { GenericLegendApplicationStore } from './ApplicationStore.js';
|
|
21
20
|
import { Fuse } from './CJS__Fuse.cjs';
|
|
22
21
|
import {
|
|
23
22
|
type MarkdownText,
|
|
@@ -40,7 +39,7 @@ export class VirtualAssistantDocumentationEntry {
|
|
|
40
39
|
url?: string | undefined;
|
|
41
40
|
isOpen = false;
|
|
42
41
|
|
|
43
|
-
constructor(docEntry:
|
|
42
|
+
constructor(docEntry: DocumentationEntry) {
|
|
44
43
|
makeObservable(this, {
|
|
45
44
|
isOpen: observable,
|
|
46
45
|
setIsOpen: action,
|
|
@@ -67,7 +66,7 @@ export class VirtualAssistantContextualDocumentationEntry {
|
|
|
67
66
|
|
|
68
67
|
constructor(
|
|
69
68
|
context: string,
|
|
70
|
-
docEntry:
|
|
69
|
+
docEntry: DocumentationEntry,
|
|
71
70
|
related: VirtualAssistantDocumentationEntry[],
|
|
72
71
|
) {
|
|
73
72
|
this.context = context;
|
|
@@ -78,9 +77,9 @@ export class VirtualAssistantContextualDocumentationEntry {
|
|
|
78
77
|
}
|
|
79
78
|
}
|
|
80
79
|
|
|
81
|
-
export class
|
|
82
|
-
readonly applicationStore:
|
|
83
|
-
private readonly searchEngine: Fuse<
|
|
80
|
+
export class AssistantService {
|
|
81
|
+
readonly applicationStore: GenericLegendApplicationStore;
|
|
82
|
+
private readonly searchEngine: Fuse<DocumentationEntry>;
|
|
84
83
|
/**
|
|
85
84
|
* This key is used to allow programmatic re-rendering of the assistant panel
|
|
86
85
|
*/
|
|
@@ -93,7 +92,7 @@ export class LegendApplicationAssistantService {
|
|
|
93
92
|
searchState = ActionState.create().pass();
|
|
94
93
|
searchText = '';
|
|
95
94
|
|
|
96
|
-
constructor(applicationStore:
|
|
95
|
+
constructor(applicationStore: GenericLegendApplicationStore) {
|
|
97
96
|
makeObservable(this, {
|
|
98
97
|
isHidden: observable,
|
|
99
98
|
isOpen: observable,
|
|
@@ -30,10 +30,9 @@ import {
|
|
|
30
30
|
primitive,
|
|
31
31
|
} from 'serializr';
|
|
32
32
|
import { APPLICATION_EVENT } from './ApplicationEvent.js';
|
|
33
|
-
import type {
|
|
34
|
-
import type { LegendApplicationConfig } from './LegendApplicationConfig.js';
|
|
33
|
+
import type { GenericLegendApplicationStore } from './ApplicationStore.js';
|
|
35
34
|
|
|
36
|
-
export type
|
|
35
|
+
export type DocumentationRegistryEntry = {
|
|
37
36
|
url: string;
|
|
38
37
|
/**
|
|
39
38
|
* Sometimes, we don't need to expose an endpoint to get the documentation data
|
|
@@ -51,11 +50,11 @@ export type LegendApplicationDocumentationRegistryEntry = {
|
|
|
51
50
|
simple?: boolean | undefined;
|
|
52
51
|
};
|
|
53
52
|
|
|
54
|
-
export type
|
|
55
|
-
entries: Record<string,
|
|
53
|
+
export type DocumentationRegistryData = {
|
|
54
|
+
entries: Record<string, DocumentationConfigEntry>;
|
|
56
55
|
};
|
|
57
56
|
|
|
58
|
-
export type
|
|
57
|
+
export type DocumentationConfigEntry = {
|
|
59
58
|
markdownText?: MarkdownText | undefined;
|
|
60
59
|
title?: string | undefined;
|
|
61
60
|
text?: string | undefined;
|
|
@@ -63,7 +62,7 @@ export type LegendApplicationDocumentationConfigEntry = {
|
|
|
63
62
|
related?: string[] | undefined;
|
|
64
63
|
};
|
|
65
64
|
|
|
66
|
-
export class
|
|
65
|
+
export class DocumentationEntry {
|
|
67
66
|
readonly _documentationKey!: string;
|
|
68
67
|
|
|
69
68
|
markdownText?: MarkdownText | undefined;
|
|
@@ -73,7 +72,7 @@ export class LegendApplicationDocumentationEntry {
|
|
|
73
72
|
related?: string[] | undefined;
|
|
74
73
|
|
|
75
74
|
static readonly serialization = new SerializationFactory(
|
|
76
|
-
createModelSchema(
|
|
75
|
+
createModelSchema(DocumentationEntry, {
|
|
77
76
|
markdownText: custom(
|
|
78
77
|
(val) => val,
|
|
79
78
|
(val) => (val.value ? val : undefined),
|
|
@@ -86,56 +85,49 @@ export class LegendApplicationDocumentationEntry {
|
|
|
86
85
|
);
|
|
87
86
|
|
|
88
87
|
static create(
|
|
89
|
-
json: PlainObject<
|
|
88
|
+
json: PlainObject<DocumentationEntry>,
|
|
90
89
|
documentationKey: string,
|
|
91
|
-
):
|
|
92
|
-
const entry =
|
|
93
|
-
|
|
94
|
-
(entry as Writable<LegendApplicationDocumentationEntry>)._documentationKey =
|
|
90
|
+
): DocumentationEntry {
|
|
91
|
+
const entry = DocumentationEntry.serialization.fromJson(json);
|
|
92
|
+
(entry as Writable<DocumentationEntry>)._documentationKey =
|
|
95
93
|
documentationKey;
|
|
96
94
|
return entry;
|
|
97
95
|
}
|
|
98
96
|
}
|
|
99
97
|
|
|
100
|
-
export interface
|
|
98
|
+
export interface KeyedDocumentationEntry {
|
|
101
99
|
key: string;
|
|
102
|
-
content:
|
|
100
|
+
content: DocumentationEntry;
|
|
103
101
|
}
|
|
104
102
|
|
|
105
103
|
export const collectKeyedDocumnetationEntriesFromConfig = (
|
|
106
|
-
rawEntries: Record<string,
|
|
107
|
-
):
|
|
104
|
+
rawEntries: Record<string, DocumentationConfigEntry>,
|
|
105
|
+
): KeyedDocumentationEntry[] =>
|
|
108
106
|
Object.entries(rawEntries).map((entry) => ({
|
|
109
107
|
key: entry[0],
|
|
110
|
-
content:
|
|
108
|
+
content: DocumentationEntry.create(entry[1], entry[0]),
|
|
111
109
|
}));
|
|
112
110
|
|
|
113
|
-
export type
|
|
114
|
-
|
|
115
|
-
string
|
|
116
|
-
>;
|
|
117
|
-
export type LegendApplicationContextualDocumentationEntry = {
|
|
111
|
+
export type ContextualDocumentationConfig = Record<string, string>;
|
|
112
|
+
export type ContextualDocumentationEntry = {
|
|
118
113
|
context: string;
|
|
119
114
|
documentationKey: string;
|
|
120
115
|
};
|
|
121
|
-
export const
|
|
122
|
-
|
|
123
|
-
):
|
|
124
|
-
Object.entries(
|
|
116
|
+
export const collectContextualDocumnetationEntries = (
|
|
117
|
+
config: ContextualDocumentationConfig,
|
|
118
|
+
): ContextualDocumentationEntry[] =>
|
|
119
|
+
Object.entries(config).map((entry) => ({
|
|
125
120
|
context: entry[0],
|
|
126
121
|
documentationKey: entry[1],
|
|
127
122
|
}));
|
|
128
123
|
|
|
129
|
-
export class
|
|
124
|
+
export class DocumentationService {
|
|
130
125
|
url?: string | undefined;
|
|
131
126
|
|
|
132
|
-
private docRegistry = new Map<string,
|
|
133
|
-
private
|
|
134
|
-
string,
|
|
135
|
-
LegendApplicationDocumentationEntry
|
|
136
|
-
>();
|
|
127
|
+
private docRegistry = new Map<string, DocumentationEntry>();
|
|
128
|
+
private contextualDocIndex = new Map<string, DocumentationEntry>();
|
|
137
129
|
|
|
138
|
-
constructor(applicationStore:
|
|
130
|
+
constructor(applicationStore: GenericLegendApplicationStore) {
|
|
139
131
|
// set the main documenation site url
|
|
140
132
|
this.url = applicationStore.config.documentationUrl;
|
|
141
133
|
|
|
@@ -221,7 +213,7 @@ export class LegendApplicationDocumentationService {
|
|
|
221
213
|
} else {
|
|
222
214
|
const existingDocEntry = this.getDocEntry(entry.documentationKey);
|
|
223
215
|
if (existingDocEntry) {
|
|
224
|
-
this.
|
|
216
|
+
this.contextualDocIndex.set(entry.context, existingDocEntry);
|
|
225
217
|
}
|
|
226
218
|
}
|
|
227
219
|
});
|
|
@@ -230,12 +222,12 @@ export class LegendApplicationDocumentationService {
|
|
|
230
222
|
applicationStore.config.contextualDocEntries.forEach((entry) => {
|
|
231
223
|
const existingDocEntry = this.getDocEntry(entry.documentationKey);
|
|
232
224
|
if (existingDocEntry) {
|
|
233
|
-
this.
|
|
225
|
+
this.contextualDocIndex.set(entry.context, existingDocEntry);
|
|
234
226
|
}
|
|
235
227
|
});
|
|
236
228
|
}
|
|
237
229
|
|
|
238
|
-
getDocEntry(key: string):
|
|
230
|
+
getDocEntry(key: string): DocumentationEntry | undefined {
|
|
239
231
|
return this.docRegistry.get(key);
|
|
240
232
|
}
|
|
241
233
|
|
|
@@ -243,36 +235,29 @@ export class LegendApplicationDocumentationService {
|
|
|
243
235
|
return this.docRegistry.has(key);
|
|
244
236
|
}
|
|
245
237
|
|
|
246
|
-
getContextualDocEntry(
|
|
247
|
-
key
|
|
248
|
-
): LegendApplicationDocumentationEntry | undefined {
|
|
249
|
-
return this.contextualDocMap.get(key);
|
|
238
|
+
getContextualDocEntry(key: string): DocumentationEntry | undefined {
|
|
239
|
+
return this.contextualDocIndex.get(key);
|
|
250
240
|
}
|
|
251
241
|
|
|
252
242
|
hasContextualDocEntry(key: string): boolean {
|
|
253
|
-
return this.
|
|
243
|
+
return this.contextualDocIndex.has(key);
|
|
254
244
|
}
|
|
255
245
|
|
|
256
|
-
getAllDocEntries():
|
|
246
|
+
getAllDocEntries(): DocumentationEntry[] {
|
|
257
247
|
return Array.from(this.docRegistry.values());
|
|
258
248
|
}
|
|
259
249
|
|
|
260
|
-
publishDocRegistry(): Record<
|
|
261
|
-
string,
|
|
262
|
-
LegendApplicationDocumentationConfigEntry
|
|
263
|
-
> {
|
|
264
|
-
const result: Record<string, LegendApplicationDocumentationConfigEntry> =
|
|
265
|
-
{};
|
|
250
|
+
publishDocRegistry(): Record<string, DocumentationConfigEntry> {
|
|
251
|
+
const result: Record<string, DocumentationConfigEntry> = {};
|
|
266
252
|
this.docRegistry.forEach((value, key) => {
|
|
267
|
-
result[key] =
|
|
268
|
-
LegendApplicationDocumentationEntry.serialization.toJson(value);
|
|
253
|
+
result[key] = DocumentationEntry.serialization.toJson(value);
|
|
269
254
|
});
|
|
270
255
|
return result;
|
|
271
256
|
}
|
|
272
257
|
|
|
273
|
-
|
|
274
|
-
const result:
|
|
275
|
-
this.
|
|
258
|
+
publishContextualDocIndex(): ContextualDocumentationConfig {
|
|
259
|
+
const result: ContextualDocumentationConfig = {};
|
|
260
|
+
this.contextualDocIndex.forEach((value, key) => {
|
|
276
261
|
result[key] = value._documentationKey;
|
|
277
262
|
});
|
|
278
263
|
return result;
|
|
@@ -19,7 +19,7 @@ import type {
|
|
|
19
19
|
EventNotifierPlugin,
|
|
20
20
|
} from '@finos/legend-shared';
|
|
21
21
|
|
|
22
|
-
export class
|
|
22
|
+
export class EventService {
|
|
23
23
|
private notifierPlugins: EventNotifierPlugin[] = [];
|
|
24
24
|
|
|
25
25
|
registerEventNotifierPlugins(plugins: EventNotifierPlugin[]): void {
|
|
@@ -17,15 +17,28 @@
|
|
|
17
17
|
import { AbstractPlugin } from '@finos/legend-shared';
|
|
18
18
|
import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager.js';
|
|
19
19
|
import type {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} from './
|
|
20
|
+
ContextualDocumentationEntry,
|
|
21
|
+
DocumentationRegistryEntry,
|
|
22
|
+
KeyedDocumentationEntry,
|
|
23
|
+
} from './DocumentationService.js';
|
|
24
24
|
|
|
25
|
-
export type LegendApplicationSetup = (
|
|
26
|
-
pluginManager: LegendApplicationPluginManager
|
|
25
|
+
export type LegendApplicationSetup = <T extends LegendApplicationPlugin>(
|
|
26
|
+
pluginManager: LegendApplicationPluginManager<T>,
|
|
27
27
|
) => Promise<void>;
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Prefix URL patterns coming from extensions with `/extensions/`
|
|
31
|
+
* to avoid potential conflicts with main routes.
|
|
32
|
+
*/
|
|
33
|
+
export const generateExtensionUrlPattern = (pattern: string): string =>
|
|
34
|
+
`/extensions/${pattern}`.replace(/^\/extensions\/\//, '/extensions/');
|
|
35
|
+
|
|
36
|
+
export type ApplicationPageEntry = {
|
|
37
|
+
key: string;
|
|
38
|
+
urlPatterns: string[];
|
|
39
|
+
renderer: React.FC | React.ReactElement;
|
|
40
|
+
};
|
|
41
|
+
|
|
29
42
|
export abstract class LegendApplicationPlugin extends AbstractPlugin {
|
|
30
43
|
/**
|
|
31
44
|
* Get the list of setup procedures to be run when booting up the application.
|
|
@@ -34,16 +47,21 @@ export abstract class LegendApplicationPlugin extends AbstractPlugin {
|
|
|
34
47
|
*/
|
|
35
48
|
getExtraApplicationSetups?(): LegendApplicationSetup[];
|
|
36
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Get the list of application page entries to be rendered.
|
|
52
|
+
*/
|
|
53
|
+
getExtraApplicationPageEntries?(): ApplicationPageEntry[];
|
|
54
|
+
|
|
37
55
|
/**
|
|
38
56
|
* Get the list of documentation registry entries from which the application can fetch
|
|
39
57
|
* documentation config data and load the documentation registry
|
|
40
58
|
*/
|
|
41
|
-
getExtraDocumentationRegistryEntries?():
|
|
59
|
+
getExtraDocumentationRegistryEntries?(): DocumentationRegistryEntry[];
|
|
42
60
|
|
|
43
61
|
/**
|
|
44
62
|
* Get the list of keyed documentation entries to be registered with documentation service.
|
|
45
63
|
*/
|
|
46
|
-
getExtraKeyedDocumentationEntries?():
|
|
64
|
+
getExtraKeyedDocumentationEntries?(): KeyedDocumentationEntry[];
|
|
47
65
|
|
|
48
66
|
/**
|
|
49
67
|
* Get the list of documentation keys whose corresponding documentation entry is required
|
|
@@ -55,7 +73,7 @@ export abstract class LegendApplicationPlugin extends AbstractPlugin {
|
|
|
55
73
|
/**
|
|
56
74
|
* Get the list of contextual documentation entries to be registered with documentation service.
|
|
57
75
|
*/
|
|
58
|
-
getExtraContextualDocumentationEntries?():
|
|
76
|
+
getExtraContextualDocumentationEntries?(): ContextualDocumentationEntry[];
|
|
59
77
|
|
|
60
78
|
/**
|
|
61
79
|
* Get the list of application context keys for which the application will log event for
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
/* eslint-disable prefer-named-capture-group */
|
|
18
18
|
import {
|
|
19
|
-
type
|
|
19
|
+
type GraphManagerPluginManager,
|
|
20
20
|
PARSER_SECTION_MARKER,
|
|
21
21
|
PURE_ELEMENT_NAME,
|
|
22
22
|
PURE_CONNECTION_NAME,
|
|
@@ -353,7 +353,7 @@ const generateLanguageMonarch = (
|
|
|
353
353
|
} as monacoLanguagesAPI.IMonarchLanguage);
|
|
354
354
|
|
|
355
355
|
export const setupPureLanguageService = (
|
|
356
|
-
pluginManager:
|
|
356
|
+
pluginManager: GraphManagerPluginManager,
|
|
357
357
|
): void => {
|
|
358
358
|
// register Pure language in `monaco-editor`
|
|
359
359
|
monacoEditorAPI.defineTheme(EDITOR_THEME.LEGEND, theme);
|
|
@@ -21,8 +21,7 @@ import {
|
|
|
21
21
|
ExecutionPlan,
|
|
22
22
|
ExecutionNode,
|
|
23
23
|
} from '@finos/legend-graph';
|
|
24
|
-
import type {
|
|
25
|
-
import type { LegendApplicationConfig } from '../LegendApplicationConfig.js';
|
|
24
|
+
import type { GenericLegendApplicationStore } from '../ApplicationStore.js';
|
|
26
25
|
import type { TreeNodeData } from '@finos/legend-art';
|
|
27
26
|
|
|
28
27
|
export class ExecutionPlanViewTreeNodeData implements TreeNodeData {
|
|
@@ -61,7 +60,7 @@ export enum EXECUTION_PLAN_VIEW_MODE {
|
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
export class ExecutionPlanState {
|
|
64
|
-
applicationStore:
|
|
63
|
+
applicationStore: GenericLegendApplicationStore;
|
|
65
64
|
graphManagerState: GraphManagerState;
|
|
66
65
|
displayDataJson: object = {};
|
|
67
66
|
displayData = '';
|
|
@@ -75,7 +74,7 @@ export class ExecutionPlanState {
|
|
|
75
74
|
debugText?: string | undefined;
|
|
76
75
|
|
|
77
76
|
constructor(
|
|
78
|
-
applicationStore:
|
|
77
|
+
applicationStore: GenericLegendApplicationStore,
|
|
79
78
|
graphManagerState: GraphManagerState,
|
|
80
79
|
) {
|
|
81
80
|
makeObservable(this, {
|
|
@@ -21,9 +21,9 @@ export interface PackageableElementOption<T extends PackageableElement> {
|
|
|
21
21
|
value: T;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export const buildElementOption = (
|
|
25
|
-
element:
|
|
26
|
-
): PackageableElementOption<
|
|
24
|
+
export const buildElementOption = <T extends PackageableElement>(
|
|
25
|
+
element: T,
|
|
26
|
+
): PackageableElementOption<T> => ({
|
|
27
27
|
label: element.name,
|
|
28
28
|
value: element,
|
|
29
29
|
});
|