@finos/legend-application 3.0.2 → 4.0.1
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 +2 -2
- package/lib/application/LegendApplication.d.ts.map +1 -1
- package/lib/application/LegendApplication.js +4 -4
- package/lib/application/LegendApplication.js.map +1 -1
- package/lib/application/LegendApplicationPluginManager.d.ts +3 -3
- package/lib/application/LegendApplicationPluginManager.d.ts.map +1 -1
- package/lib/components/ActionAlert.d.ts +1 -1
- package/lib/components/ActionAlert.js +3 -3
- package/lib/components/ActionAlert.js.map +1 -1
- package/lib/components/ApplicationStoreProvider.d.ts +3 -3
- package/lib/components/ApplicationStoreProvider.d.ts.map +1 -1
- package/lib/components/ApplicationStoreProvider.js +2 -2
- package/lib/components/ApplicationStoreProvider.js.map +1 -1
- package/lib/components/ApplicationStoreProviderTestUtils.d.ts +5 -5
- package/lib/components/ApplicationStoreProviderTestUtils.d.ts.map +1 -1
- package/lib/components/ApplicationStoreProviderTestUtils.js +5 -4
- package/lib/components/ApplicationStoreProviderTestUtils.js.map +1 -1
- package/lib/components/ApplicationTestID.js +1 -1
- package/lib/components/ApplicationTestID.js.map +1 -1
- package/lib/components/BasicValueSpecificationEditor.d.ts +44 -0
- package/lib/components/BasicValueSpecificationEditor.d.ts.map +1 -0
- package/lib/components/BasicValueSpecificationEditor.js +276 -0
- package/lib/components/BasicValueSpecificationEditor.js.map +1 -0
- package/lib/components/BlockingAlert.d.ts +1 -1
- package/lib/components/BlockingAlert.js +1 -1
- package/lib/components/BlockingAlert.js.map +1 -1
- package/lib/components/CustomDatePicker.d.ts +38 -0
- package/lib/components/CustomDatePicker.d.ts.map +1 -0
- package/lib/components/CustomDatePicker.js +592 -0
- package/lib/components/CustomDatePicker.js.map +1 -0
- package/lib/components/DocumentationLink.d.ts +1 -1
- package/lib/components/DocumentationLink.js +2 -2
- package/lib/components/DocumentationLink.js.map +1 -1
- package/lib/components/LambdaEditor.d.ts +2 -2
- package/lib/components/LambdaEditor.d.ts.map +1 -1
- package/lib/components/LambdaEditor.js +3 -3
- package/lib/components/LambdaEditor.js.map +1 -1
- package/lib/components/LambdaParameterValuesEditor.d.ts +25 -0
- package/lib/components/LambdaParameterValuesEditor.d.ts.map +1 -0
- package/lib/components/LambdaParameterValuesEditor.js +52 -0
- package/lib/components/LambdaParameterValuesEditor.js.map +1 -0
- package/lib/components/LegendApplicationComponentFrameworkProvider.d.ts +1 -1
- package/lib/components/LegendApplicationComponentFrameworkProvider.js +3 -3
- package/lib/components/LegendApplicationComponentFrameworkProvider.js.map +1 -1
- package/lib/components/LegendApplicationNavigationContextServiceUtils.d.ts +32 -0
- package/lib/components/LegendApplicationNavigationContextServiceUtils.d.ts.map +1 -0
- package/lib/components/LegendApplicationNavigationContextServiceUtils.js +57 -0
- package/lib/components/LegendApplicationNavigationContextServiceUtils.js.map +1 -0
- package/lib/components/NotificationManager.d.ts +1 -1
- package/lib/components/NotificationManager.js +2 -2
- package/lib/components/NotificationManager.js.map +1 -1
- package/lib/components/TextInputEditor.d.ts +2 -2
- package/lib/components/TextInputEditor.d.ts.map +1 -1
- package/lib/components/TextInputEditor.js +2 -2
- package/lib/components/TextInputEditor.js.map +1 -1
- package/lib/components/{AppHeader.d.ts → VirtualAssistant.d.ts} +5 -5
- package/lib/components/VirtualAssistant.d.ts.map +1 -0
- package/lib/components/VirtualAssistant.js +171 -0
- package/lib/components/VirtualAssistant.js.map +1 -0
- package/lib/components/WebApplicationNavigatorProvider.d.ts +2 -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/components/WebApplicationNavigatorProviderTestUtils.d.ts +2 -2
- package/lib/components/WebApplicationNavigatorProviderTestUtils.d.ts.map +1 -1
- package/lib/components/WebApplicationNavigatorProviderTestUtils.js +3 -2
- package/lib/components/WebApplicationNavigatorProviderTestUtils.js.map +1 -1
- package/lib/const.js +2 -2
- package/lib/const.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +30 -22
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +32 -22
- package/lib/index.js.map +1 -1
- package/lib/stores/ApplicationEvent.d.ts +9 -7
- package/lib/stores/ApplicationEvent.d.ts.map +1 -1
- package/lib/stores/ApplicationEvent.js +10 -8
- package/lib/stores/ApplicationEvent.js.map +1 -1
- package/lib/stores/ApplicationStore.d.ts +16 -10
- package/lib/stores/ApplicationStore.d.ts.map +1 -1
- package/lib/stores/ApplicationStore.js +28 -23
- package/lib/stores/ApplicationStore.js.map +1 -1
- package/lib/stores/ApplicationStoreTestUtils.d.ts +3 -3
- package/lib/stores/ApplicationStoreTestUtils.d.ts.map +1 -1
- package/lib/stores/ApplicationStoreTestUtils.js +2 -2
- package/lib/stores/ApplicationStoreTestUtils.js.map +1 -1
- package/lib/stores/ApplicationTelemetry.d.ts +1 -1
- package/lib/stores/ApplicationTelemetry.d.ts.map +1 -1
- package/lib/stores/ApplicationTelemetry.js +2 -2
- package/lib/stores/ApplicationTelemetry.js.map +1 -1
- package/lib/stores/CJS__Fuse.cjs +35 -0
- package/lib/stores/CJS__Fuse.cjs.map +1 -0
- package/lib/stores/CJS__Fuse.d.cts +28 -0
- package/lib/stores/CJS__Fuse.d.cts.map +1 -0
- package/lib/stores/LambdaEditorState.d.ts +1 -1
- package/lib/stores/LambdaEditorState.d.ts.map +1 -1
- package/lib/stores/LambdaEditorState.js +2 -2
- package/lib/stores/LambdaEditorState.js.map +1 -1
- package/lib/stores/LambdaParameterState.d.ts +59 -0
- package/lib/stores/LambdaParameterState.d.ts.map +1 -0
- package/lib/stores/LambdaParameterState.js +184 -0
- package/lib/stores/LambdaParameterState.js.map +1 -0
- package/lib/stores/LegendApplicationAssistantService.d.ts +63 -0
- package/lib/stores/LegendApplicationAssistantService.d.ts.map +1 -0
- package/lib/stores/LegendApplicationAssistantService.js +167 -0
- package/lib/stores/LegendApplicationAssistantService.js.map +1 -0
- package/lib/stores/LegendApplicationConfig.d.ts +5 -4
- package/lib/stores/LegendApplicationConfig.d.ts.map +1 -1
- package/lib/stores/LegendApplicationConfig.js +8 -3
- package/lib/stores/LegendApplicationConfig.js.map +1 -1
- package/lib/stores/LegendApplicationDocumentationService.d.ts +70 -0
- package/lib/stores/LegendApplicationDocumentationService.d.ts.map +1 -0
- package/lib/stores/LegendApplicationDocumentationService.js +152 -0
- package/lib/stores/LegendApplicationDocumentationService.js.map +1 -0
- package/lib/stores/LegendApplicationEventService.d.ts +22 -0
- package/lib/stores/LegendApplicationEventService.d.ts.map +1 -0
- package/lib/stores/LegendApplicationEventService.js +25 -0
- package/lib/stores/LegendApplicationEventService.js.map +1 -0
- package/lib/stores/LegendApplicationNavigationContextService.d.ts +74 -0
- package/lib/stores/LegendApplicationNavigationContextService.d.ts.map +1 -0
- package/lib/stores/LegendApplicationNavigationContextService.js +118 -0
- package/lib/stores/LegendApplicationNavigationContextService.js.map +1 -0
- package/lib/stores/LegendApplicationPlugin.d.ts +6 -2
- package/lib/stores/LegendApplicationPlugin.d.ts.map +1 -1
- package/lib/stores/LegendApplicationPlugin.js.map +1 -1
- package/lib/stores/PureLanguageSupport.d.ts.map +1 -1
- package/lib/stores/PureLanguageSupport.js +8 -2
- package/lib/stores/PureLanguageSupport.js.map +1 -1
- package/lib/stores/ValueSpecificationModifierHelper.d.ts +27 -0
- package/lib/stores/ValueSpecificationModifierHelper.d.ts.map +1 -0
- package/lib/stores/ValueSpecificationModifierHelper.js +49 -0
- package/lib/stores/ValueSpecificationModifierHelper.js.map +1 -0
- package/package.json +26 -20
- package/src/application/LegendApplication.tsx +6 -6
- package/src/application/LegendApplicationPluginManager.tsx +3 -3
- package/src/components/ActionAlert.tsx +3 -3
- package/src/components/ApplicationStoreProvider.tsx +4 -4
- package/src/components/ApplicationStoreProviderTestUtils.tsx +7 -6
- package/src/components/BasicValueSpecificationEditor.tsx +703 -0
- package/src/components/BlockingAlert.tsx +1 -1
- package/src/components/CustomDatePicker.tsx +1235 -0
- package/src/components/DocumentationLink.tsx +2 -2
- package/src/components/LambdaEditor.tsx +4 -4
- package/src/components/LambdaParameterValuesEditor.tsx +114 -0
- package/src/components/LegendApplicationComponentFrameworkProvider.tsx +3 -3
- package/src/components/LegendApplicationNavigationContextServiceUtils.tsx +63 -0
- package/src/components/NotificationManager.tsx +2 -2
- package/src/components/TextInputEditor.tsx +2 -2
- package/src/components/VirtualAssistant.tsx +600 -0
- package/src/components/WebApplicationNavigatorProvider.tsx +1 -1
- package/src/components/WebApplicationNavigatorProviderTestUtils.tsx +3 -2
- package/src/index.ts +39 -28
- package/src/stores/ApplicationEvent.ts +11 -7
- package/src/stores/ApplicationStore.ts +31 -29
- package/src/stores/ApplicationStoreTestUtils.ts +4 -4
- package/src/stores/ApplicationTelemetry.ts +2 -2
- package/src/stores/CJS__Fuse.cts +28 -0
- package/src/stores/LambdaEditorState.ts +5 -5
- package/src/stores/LambdaParameterState.ts +314 -0
- package/src/stores/LegendApplicationAssistantService.ts +218 -0
- package/src/stores/LegendApplicationConfig.ts +20 -6
- package/src/stores/LegendApplicationDocumentationService.ts +276 -0
- package/src/stores/LegendApplicationEventService.ts +32 -0
- package/src/stores/LegendApplicationNavigationContextService.ts +131 -0
- package/src/stores/LegendApplicationPlugin.ts +10 -2
- package/src/stores/PureLanguageSupport.ts +8 -2
- package/src/stores/ValueSpecificationModifierHelper.ts +104 -0
- package/tsconfig.json +18 -12
- package/lib/components/AppHeader.d.ts.map +0 -1
- package/lib/components/AppHeader.js +0 -26
- package/lib/components/AppHeader.js.map +0 -1
- package/lib/stores/LegendApplicationDocumentationRegistry.d.ts +0 -36
- package/lib/stores/LegendApplicationDocumentationRegistry.d.ts.map +0 -1
- package/lib/stores/LegendApplicationDocumentationRegistry.js +0 -47
- package/lib/stores/LegendApplicationDocumentationRegistry.js.map +0 -1
- package/src/components/AppHeader.tsx +0 -49
- package/src/stores/LegendApplicationDocumentationRegistry.ts +0 -81
package/src/index.ts
CHANGED
|
@@ -14,31 +14,42 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
export * from './const';
|
|
18
|
-
|
|
19
|
-
export * from './application/LegendApplicationPluginManager';
|
|
20
|
-
export * from './application/LegendApplication';
|
|
21
|
-
|
|
22
|
-
export * from './components/ApplicationStoreProvider';
|
|
23
|
-
export * from './components/WebApplicationNavigatorProvider';
|
|
24
|
-
export * from './components/LegendApplicationComponentFrameworkProvider';
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
export * from './components/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export * from './components/
|
|
33
|
-
|
|
34
|
-
export * from './
|
|
35
|
-
export * from './
|
|
36
|
-
export * from './
|
|
37
|
-
export * from './
|
|
38
|
-
export
|
|
39
|
-
|
|
40
|
-
export * from './stores/
|
|
41
|
-
export * from './stores/
|
|
42
|
-
export * from './stores/
|
|
43
|
-
|
|
44
|
-
export
|
|
17
|
+
export * from './const.js';
|
|
18
|
+
|
|
19
|
+
export * from './application/LegendApplicationPluginManager.js';
|
|
20
|
+
export * from './application/LegendApplication.js';
|
|
21
|
+
|
|
22
|
+
export * from './components/ApplicationStoreProvider.js';
|
|
23
|
+
export * from './components/WebApplicationNavigatorProvider.js';
|
|
24
|
+
export * from './components/LegendApplicationComponentFrameworkProvider.js';
|
|
25
|
+
export * from './components/LegendApplicationNavigationContextServiceUtils.js';
|
|
26
|
+
|
|
27
|
+
export * from './components/ApplicationStoreProviderTestUtils.js';
|
|
28
|
+
export * from './components/WebApplicationNavigatorProviderTestUtils.js';
|
|
29
|
+
|
|
30
|
+
// TODO: consider moving this to `LegendApplicationComponentFrameworkProvider`
|
|
31
|
+
// once we think we can add virtual assistant support for all apps
|
|
32
|
+
export * from './components/VirtualAssistant.js';
|
|
33
|
+
|
|
34
|
+
export * from './components/DocumentationLink.js';
|
|
35
|
+
export * from './components/TextInputEditor.js';
|
|
36
|
+
export * from './components/LambdaEditor.js';
|
|
37
|
+
export * from './components/BasicValueSpecificationEditor.js';
|
|
38
|
+
export * from './components/LambdaParameterValuesEditor.js';
|
|
39
|
+
|
|
40
|
+
export * from './stores/ApplicationStore.js';
|
|
41
|
+
export * from './stores/ApplicationTelemetry.js';
|
|
42
|
+
export * from './stores/ApplicationEvent.js';
|
|
43
|
+
export * from './stores/LegendApplicationConfig.js';
|
|
44
|
+
export { WebApplicationNavigator } from './stores/WebApplicationNavigator.js';
|
|
45
|
+
export { LambdaEditorState } from './stores/LambdaEditorState.js';
|
|
46
|
+
export * from './stores/PackageableElementOption.js';
|
|
47
|
+
export * from './stores/LegendApplicationDocumentationService.js';
|
|
48
|
+
export * from './stores/LegendApplicationEventService.js';
|
|
49
|
+
export * from './stores/LegendApplicationAssistantService.js';
|
|
50
|
+
export * from './stores/LegendApplicationNavigationContextService.js';
|
|
51
|
+
export * from './stores/LegendApplicationPlugin.js';
|
|
52
|
+
|
|
53
|
+
export * from './stores/ApplicationStoreTestUtils.js';
|
|
54
|
+
export * from './stores/ValueSpecificationModifierHelper.js';
|
|
55
|
+
export * from './stores/LambdaParameterState.js';
|
|
@@ -15,13 +15,17 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
export enum APPLICATION_EVENT {
|
|
18
|
-
TEXT_EDITOR_FONT_LOADED = '
|
|
19
|
-
APPLICATION_SETUP_FAILURE = '
|
|
18
|
+
TEXT_EDITOR_FONT_LOADED = 'application.load.font.success',
|
|
19
|
+
APPLICATION_SETUP_FAILURE = 'application.setup.failure',
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
APPLICATION_CONFIGURATION_FAILURE = '
|
|
23
|
-
ILLEGAL_APPLICATION_STATE_OCCURRED = 'ILLEGAL_APPLICATION_STATE_OCCURRED',
|
|
24
|
-
APPLICATION_LOADED = 'APPLICATION_LOADED',
|
|
21
|
+
ILLEGAL_APPLICATION_STATE_OCCURRED = 'application.error.illegal-state',
|
|
22
|
+
APPLICATION_CONFIGURATION_FAILURE = 'application.configuration.failure',
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
APPLICATION_DOCUMTENTION_LOAD_SKIPPED = 'application.load.documentation.skipped',
|
|
25
|
+
APPLICATION_CONTEXTUAL_DOCUMTENTION_LOAD_SKIPPED = 'application.load.contextual-documentation.skipped',
|
|
26
|
+
|
|
27
|
+
APPLICATION_LOADED = 'application.load.success',
|
|
28
|
+
APPLICATION_LOAD_FAILURE = 'application.load.failure',
|
|
29
|
+
|
|
30
|
+
DEVELOPMENT_ISSUE = 'development.issue',
|
|
27
31
|
}
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
|
|
17
17
|
import {
|
|
18
18
|
type SuperGenericFunction,
|
|
19
|
-
EventNotifierService,
|
|
20
19
|
TracerService,
|
|
21
20
|
TelemetryService,
|
|
22
21
|
assertTrue,
|
|
@@ -27,11 +26,14 @@ import {
|
|
|
27
26
|
ApplicationError,
|
|
28
27
|
} from '@finos/legend-shared';
|
|
29
28
|
import { makeAutoObservable, action } from 'mobx';
|
|
30
|
-
import { APPLICATION_EVENT } from './ApplicationEvent';
|
|
31
|
-
import type { LegendApplicationConfig } from './LegendApplicationConfig';
|
|
32
|
-
import type { WebApplicationNavigator } from './WebApplicationNavigator';
|
|
33
|
-
import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager';
|
|
34
|
-
import {
|
|
29
|
+
import { APPLICATION_EVENT } from './ApplicationEvent.js';
|
|
30
|
+
import type { LegendApplicationConfig } from './LegendApplicationConfig.js';
|
|
31
|
+
import type { WebApplicationNavigator } from './WebApplicationNavigator.js';
|
|
32
|
+
import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager.js';
|
|
33
|
+
import { LegendApplicationDocumentationService } from './LegendApplicationDocumentationService.js';
|
|
34
|
+
import { LegendApplicationAssistantService } from './LegendApplicationAssistantService.js';
|
|
35
|
+
import { LegendApplicationEventService } from './LegendApplicationEventService.js';
|
|
36
|
+
import { LegendApplicationNavigationContextService } from './LegendApplicationNavigationContextService.js';
|
|
35
37
|
|
|
36
38
|
export enum ActionAlertType {
|
|
37
39
|
STANDARD = 'STANDARD',
|
|
@@ -101,17 +103,29 @@ export class Notification {
|
|
|
101
103
|
}
|
|
102
104
|
|
|
103
105
|
export class ApplicationStore<T extends LegendApplicationConfig> {
|
|
106
|
+
pluginManager: LegendApplicationPluginManager;
|
|
107
|
+
config: T;
|
|
108
|
+
|
|
109
|
+
// navigation
|
|
104
110
|
navigator: WebApplicationNavigator;
|
|
111
|
+
navigationContextService: LegendApplicationNavigationContextService;
|
|
112
|
+
|
|
113
|
+
// TODO: refactor this to `NotificationService` including notifications and alerts
|
|
105
114
|
notification?: Notification | undefined;
|
|
106
115
|
blockingAlertInfo?: BlockingAlertInfo | undefined;
|
|
107
116
|
actionAlertInfo?: ActionAlertInfo | undefined;
|
|
108
|
-
config: T;
|
|
109
|
-
docRegistry: LegendApplicationDocumentationRegistry;
|
|
110
117
|
|
|
118
|
+
// TODO: consider renaming this to `LogService`
|
|
111
119
|
log: Log = new Log();
|
|
120
|
+
|
|
121
|
+
// documentation & help
|
|
122
|
+
documentationService: LegendApplicationDocumentationService;
|
|
123
|
+
assistantService: LegendApplicationAssistantService;
|
|
124
|
+
|
|
125
|
+
// communication
|
|
126
|
+
eventService = new LegendApplicationEventService();
|
|
112
127
|
telemetryService = new TelemetryService();
|
|
113
128
|
tracerService = new TracerService();
|
|
114
|
-
eventNotifierService = new EventNotifierService();
|
|
115
129
|
|
|
116
130
|
constructor(
|
|
117
131
|
config: T,
|
|
@@ -121,7 +135,7 @@ export class ApplicationStore<T extends LegendApplicationConfig> {
|
|
|
121
135
|
makeAutoObservable(this, {
|
|
122
136
|
navigator: false,
|
|
123
137
|
setBlockingAlert: action,
|
|
124
|
-
|
|
138
|
+
setActionAlertInfo: action,
|
|
125
139
|
setNotification: action,
|
|
126
140
|
notify: action,
|
|
127
141
|
notifySuccess: action,
|
|
@@ -132,29 +146,17 @@ export class ApplicationStore<T extends LegendApplicationConfig> {
|
|
|
132
146
|
|
|
133
147
|
this.config = config;
|
|
134
148
|
this.navigator = navigator;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
.getApplicationPlugins()
|
|
141
|
-
.flatMap(
|
|
142
|
-
(plugin) => plugin.getExtraKeyedDocumentationEntries?.() ?? [],
|
|
143
|
-
),
|
|
144
|
-
// entries from config will override entries specified natively
|
|
145
|
-
...config.documentationKeyedEntries,
|
|
146
|
-
].forEach((entry) =>
|
|
147
|
-
this.docRegistry.registerEntry(entry.key, entry.content),
|
|
148
|
-
);
|
|
149
|
-
this.docRegistry.url = this.config.documentationUrl;
|
|
150
|
-
|
|
151
|
-
// Register plugins
|
|
149
|
+
this.pluginManager = pluginManager;
|
|
150
|
+
this.navigationContextService =
|
|
151
|
+
new LegendApplicationNavigationContextService();
|
|
152
|
+
this.documentationService = new LegendApplicationDocumentationService(this);
|
|
153
|
+
this.assistantService = new LegendApplicationAssistantService(this);
|
|
152
154
|
this.log.registerPlugins(pluginManager.getLoggerPlugins());
|
|
153
155
|
this.telemetryService.registerPlugins(
|
|
154
156
|
pluginManager.getTelemetryServicePlugins(),
|
|
155
157
|
);
|
|
156
158
|
this.tracerService.registerPlugins(pluginManager.getTracerServicePlugins());
|
|
157
|
-
this.
|
|
159
|
+
this.eventService.registerEventNotifierPlugins(
|
|
158
160
|
pluginManager.getEventNotifierPlugins(),
|
|
159
161
|
);
|
|
160
162
|
}
|
|
@@ -163,7 +165,7 @@ export class ApplicationStore<T extends LegendApplicationConfig> {
|
|
|
163
165
|
this.blockingAlertInfo = alertInfo;
|
|
164
166
|
}
|
|
165
167
|
|
|
166
|
-
|
|
168
|
+
setActionAlertInfo(alertInfo: ActionAlertInfo | undefined): void {
|
|
167
169
|
if (this.actionAlertInfo && alertInfo) {
|
|
168
170
|
this.notifyIllegalState(
|
|
169
171
|
'Action alert is stacked: new alert is invoked while another one is being displayed',
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { ApplicationStore } from './ApplicationStore';
|
|
17
|
+
import { ApplicationStore } from './ApplicationStore.js';
|
|
18
18
|
import { createBrowserHistory } from 'history';
|
|
19
|
-
import { WebApplicationNavigator } from './WebApplicationNavigator';
|
|
20
|
-
import type { LegendApplicationConfig } from './LegendApplicationConfig';
|
|
21
|
-
import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager';
|
|
19
|
+
import { WebApplicationNavigator } from './WebApplicationNavigator.js';
|
|
20
|
+
import type { LegendApplicationConfig } from './LegendApplicationConfig.js';
|
|
21
|
+
import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager.js';
|
|
22
22
|
|
|
23
23
|
export const TEST_DATA__applicationVersion = {
|
|
24
24
|
buildTime: '2001-01-01T00:00:00-0000',
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import type { TelemetryService } from '@finos/legend-shared';
|
|
18
|
-
import { APPLICATION_EVENT } from './ApplicationEvent';
|
|
18
|
+
import { APPLICATION_EVENT } from './ApplicationEvent.js';
|
|
19
19
|
|
|
20
20
|
type ApplicationLoaded_TelemetryData = {
|
|
21
21
|
browser: {
|
|
@@ -28,7 +28,7 @@ type ApplicationLoaded_TelemetryData = {
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
export class ApplicationTelemetry {
|
|
31
|
-
static
|
|
31
|
+
static logEvent_AppInitialized(
|
|
32
32
|
telemetryService: TelemetryService,
|
|
33
33
|
data: ApplicationLoaded_TelemetryData,
|
|
34
34
|
): void {
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
/**
|
|
18
|
+
* Previously, these exports rely on ES module interop to expose `default` export
|
|
19
|
+
* properly. But since we use `ESM` for Typescript resolution now, we lose this
|
|
20
|
+
* so we have to workaround by importing these and re-export them from CJS
|
|
21
|
+
*
|
|
22
|
+
* TODO: remove these when the package properly work with Typescript's nodenext
|
|
23
|
+
* module resolution
|
|
24
|
+
*
|
|
25
|
+
* @workaround ESM
|
|
26
|
+
* See https://github.com/microsoft/TypeScript/issues/49298
|
|
27
|
+
*/
|
|
28
|
+
export { default as Fuse } from 'fuse.js';
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
* editing _something_ but allows user to edit via text.
|
|
28
28
|
*/
|
|
29
29
|
export abstract class LambdaEditorState {
|
|
30
|
-
uuid = uuid();
|
|
30
|
+
readonly uuid = uuid();
|
|
31
31
|
lambdaPrefix: string;
|
|
32
32
|
lambdaString: string; // value shown in lambda editor which can be edited
|
|
33
33
|
parserError?: ParserError | undefined;
|
|
@@ -71,8 +71,8 @@ export abstract class LambdaEditorState {
|
|
|
71
71
|
setCompilationError(compilationError: CompilationError | undefined): void {
|
|
72
72
|
// account for the lambda prefix offset in source information
|
|
73
73
|
if (compilationError?.sourceInformation) {
|
|
74
|
-
compilationError.
|
|
75
|
-
|
|
74
|
+
compilationError.sourceInformation = this.processSourceInformation(
|
|
75
|
+
compilationError.sourceInformation,
|
|
76
76
|
);
|
|
77
77
|
}
|
|
78
78
|
this.compilationError = compilationError;
|
|
@@ -81,8 +81,8 @@ export abstract class LambdaEditorState {
|
|
|
81
81
|
setParserError(parserError: ParserError | undefined): void {
|
|
82
82
|
// account for the lambda prefix offset in source information
|
|
83
83
|
if (parserError?.sourceInformation) {
|
|
84
|
-
parserError.
|
|
85
|
-
|
|
84
|
+
parserError.sourceInformation = this.processSourceInformation(
|
|
85
|
+
parserError.sourceInformation,
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
88
|
this.parserError = parserError;
|
|
@@ -0,0 +1,314 @@
|
|
|
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 {
|
|
18
|
+
type InstanceValue,
|
|
19
|
+
type Multiplicity,
|
|
20
|
+
type ObserverContext,
|
|
21
|
+
type Type,
|
|
22
|
+
type ValueSpecification,
|
|
23
|
+
type PureModel,
|
|
24
|
+
CollectionInstanceValue,
|
|
25
|
+
Enumeration,
|
|
26
|
+
EnumValueExplicitReference,
|
|
27
|
+
EnumValueInstanceValue,
|
|
28
|
+
GenericType,
|
|
29
|
+
GenericTypeExplicitReference,
|
|
30
|
+
getEnumValue,
|
|
31
|
+
observe_ValueSpecification,
|
|
32
|
+
observe_VariableExpression,
|
|
33
|
+
PrimitiveInstanceValue,
|
|
34
|
+
PrimitiveType,
|
|
35
|
+
PRIMITIVE_TYPE,
|
|
36
|
+
VariableExpression,
|
|
37
|
+
LambdaFunction,
|
|
38
|
+
TYPICAL_MULTIPLICITY_TYPE,
|
|
39
|
+
CORE_PURE_PATH,
|
|
40
|
+
FunctionType,
|
|
41
|
+
SimpleFunctionExpression,
|
|
42
|
+
SUPPORTED_FUNCTIONS,
|
|
43
|
+
extractElementNameFromPath,
|
|
44
|
+
} from '@finos/legend-graph';
|
|
45
|
+
import {
|
|
46
|
+
addUniqueEntry,
|
|
47
|
+
deleteEntry,
|
|
48
|
+
IllegalStateError,
|
|
49
|
+
isNonNullable,
|
|
50
|
+
Randomizer,
|
|
51
|
+
uuid,
|
|
52
|
+
} from '@finos/legend-shared';
|
|
53
|
+
import { makeObservable, observable, action } from 'mobx';
|
|
54
|
+
import {
|
|
55
|
+
genericType_setRawType,
|
|
56
|
+
multiplicity_setLowerBound,
|
|
57
|
+
multiplicity_setUpperBound,
|
|
58
|
+
} from './ValueSpecificationModifierHelper.js';
|
|
59
|
+
import { format, addDays } from 'date-fns';
|
|
60
|
+
import { DATE_FORMAT, DATE_TIME_FORMAT } from '../const.js';
|
|
61
|
+
|
|
62
|
+
export enum PARAMETER_SUBMIT_ACTION {
|
|
63
|
+
EXECUTE = 'EXECUTE',
|
|
64
|
+
EXPORT = 'EXPORT',
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export const createMockEnumerationProperty = (
|
|
68
|
+
enumeration: Enumeration,
|
|
69
|
+
): string =>
|
|
70
|
+
new Randomizer().getRandomItemInCollection(enumeration.values)?.name ?? '';
|
|
71
|
+
|
|
72
|
+
const createMockPrimitiveProperty = (
|
|
73
|
+
primitiveType: PrimitiveType,
|
|
74
|
+
propertyName: string,
|
|
75
|
+
): string | number | boolean => {
|
|
76
|
+
const randomizer = new Randomizer();
|
|
77
|
+
switch (primitiveType.name) {
|
|
78
|
+
case PRIMITIVE_TYPE.BOOLEAN:
|
|
79
|
+
return randomizer.getRandomItemInCollection([true, false]) ?? true;
|
|
80
|
+
case PRIMITIVE_TYPE.FLOAT:
|
|
81
|
+
return randomizer.getRandomFloat();
|
|
82
|
+
case PRIMITIVE_TYPE.DECIMAL:
|
|
83
|
+
return randomizer.getRandomDouble();
|
|
84
|
+
case PRIMITIVE_TYPE.NUMBER:
|
|
85
|
+
case PRIMITIVE_TYPE.INTEGER:
|
|
86
|
+
return randomizer.getRandomWholeNumber(100);
|
|
87
|
+
// NOTE that `Date` is the umbrella type that comprises `StrictDate` and `DateTime`, but for simplicity, we will generate `Date` as `StrictDate`
|
|
88
|
+
case PRIMITIVE_TYPE.DATE:
|
|
89
|
+
case PRIMITIVE_TYPE.STRICTDATE:
|
|
90
|
+
return format(
|
|
91
|
+
randomizer.getRandomDate(
|
|
92
|
+
new Date(Date.now()),
|
|
93
|
+
addDays(Date.now(), 100),
|
|
94
|
+
),
|
|
95
|
+
DATE_FORMAT,
|
|
96
|
+
);
|
|
97
|
+
case PRIMITIVE_TYPE.DATETIME:
|
|
98
|
+
return format(
|
|
99
|
+
randomizer.getRandomDate(
|
|
100
|
+
new Date(Date.now()),
|
|
101
|
+
addDays(Date.now(), 100),
|
|
102
|
+
),
|
|
103
|
+
DATE_TIME_FORMAT,
|
|
104
|
+
);
|
|
105
|
+
case PRIMITIVE_TYPE.STRING:
|
|
106
|
+
default:
|
|
107
|
+
return `${propertyName} ${randomizer.getRandomWholeNumber(100)}`;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export const buildParametersLetLambdaFunc = (
|
|
112
|
+
graph: PureModel,
|
|
113
|
+
lambdaParametersStates: LambdaParameterState[],
|
|
114
|
+
): LambdaFunction => {
|
|
115
|
+
const multiplicityOne = graph.getTypicalMultiplicity(
|
|
116
|
+
TYPICAL_MULTIPLICITY_TYPE.ONE,
|
|
117
|
+
);
|
|
118
|
+
const typeString = graph.getPrimitiveType(PRIMITIVE_TYPE.STRING);
|
|
119
|
+
const typeAny = graph.getType(CORE_PURE_PATH.ANY);
|
|
120
|
+
const letlambdaFunction = new LambdaFunction(
|
|
121
|
+
new FunctionType(typeAny, multiplicityOne),
|
|
122
|
+
);
|
|
123
|
+
letlambdaFunction.expressionSequence = lambdaParametersStates
|
|
124
|
+
.map((queryParamState) => {
|
|
125
|
+
if (queryParamState.value) {
|
|
126
|
+
const letFunc = new SimpleFunctionExpression(
|
|
127
|
+
extractElementNameFromPath(SUPPORTED_FUNCTIONS.LET),
|
|
128
|
+
multiplicityOne,
|
|
129
|
+
);
|
|
130
|
+
const letVar = new PrimitiveInstanceValue(
|
|
131
|
+
GenericTypeExplicitReference.create(new GenericType(typeString)),
|
|
132
|
+
multiplicityOne,
|
|
133
|
+
);
|
|
134
|
+
letVar.values = [queryParamState.variableName];
|
|
135
|
+
letFunc.parametersValues.push(letVar);
|
|
136
|
+
letFunc.parametersValues.push(queryParamState.value);
|
|
137
|
+
return letFunc;
|
|
138
|
+
}
|
|
139
|
+
return undefined;
|
|
140
|
+
})
|
|
141
|
+
.filter(isNonNullable);
|
|
142
|
+
return letlambdaFunction;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export class LambdaParameterState {
|
|
146
|
+
readonly uuid = uuid();
|
|
147
|
+
readonly parameter: VariableExpression;
|
|
148
|
+
observableContext: ObserverContext;
|
|
149
|
+
value: ValueSpecification | undefined;
|
|
150
|
+
|
|
151
|
+
constructor(
|
|
152
|
+
variableExpression: VariableExpression,
|
|
153
|
+
observableContext: ObserverContext,
|
|
154
|
+
) {
|
|
155
|
+
makeObservable(this, {
|
|
156
|
+
value: observable,
|
|
157
|
+
setValue: action,
|
|
158
|
+
mockParameterValue: action,
|
|
159
|
+
});
|
|
160
|
+
this.observableContext = observableContext;
|
|
161
|
+
this.parameter = observe_VariableExpression(variableExpression);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
mockParameterValue(): void {
|
|
165
|
+
this.setValue(
|
|
166
|
+
this.generateMockValues(
|
|
167
|
+
this.parameter.genericType?.value.rawType,
|
|
168
|
+
this.parameter.multiplicity,
|
|
169
|
+
),
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
private generateMockValues(
|
|
174
|
+
varType: Type | undefined,
|
|
175
|
+
multiplicity: Multiplicity,
|
|
176
|
+
): InstanceValue | undefined {
|
|
177
|
+
if ((!multiplicity.upperBound || multiplicity.upperBound > 1) && varType) {
|
|
178
|
+
return new CollectionInstanceValue(
|
|
179
|
+
multiplicity,
|
|
180
|
+
GenericTypeExplicitReference.create(new GenericType(varType)),
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
if (varType instanceof PrimitiveType) {
|
|
184
|
+
const primitiveInst = new PrimitiveInstanceValue(
|
|
185
|
+
GenericTypeExplicitReference.create(new GenericType(varType)),
|
|
186
|
+
multiplicity,
|
|
187
|
+
);
|
|
188
|
+
primitiveInst.values = [
|
|
189
|
+
createMockPrimitiveProperty(
|
|
190
|
+
varType,
|
|
191
|
+
this.parameter.name === '' ? 'myVar' : this.parameter.name,
|
|
192
|
+
),
|
|
193
|
+
];
|
|
194
|
+
return primitiveInst;
|
|
195
|
+
} else if (varType instanceof Enumeration) {
|
|
196
|
+
const enumValueInstance = new EnumValueInstanceValue(
|
|
197
|
+
GenericTypeExplicitReference.create(new GenericType(varType)),
|
|
198
|
+
multiplicity,
|
|
199
|
+
);
|
|
200
|
+
const mock = createMockEnumerationProperty(varType);
|
|
201
|
+
if (mock !== '') {
|
|
202
|
+
enumValueInstance.values = [
|
|
203
|
+
EnumValueExplicitReference.create(getEnumValue(varType, mock)),
|
|
204
|
+
];
|
|
205
|
+
}
|
|
206
|
+
return enumValueInstance;
|
|
207
|
+
}
|
|
208
|
+
return undefined;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
setValue(value: ValueSpecification | undefined): void {
|
|
212
|
+
if (value instanceof VariableExpression) {
|
|
213
|
+
throw new IllegalStateError(
|
|
214
|
+
'Can not assign a parameter to another parameter',
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
this.value = value
|
|
218
|
+
? observe_ValueSpecification(value, this.observableContext)
|
|
219
|
+
: undefined;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
changeVariableType(type: Type): void {
|
|
223
|
+
if (type !== this.variableType) {
|
|
224
|
+
const genricType = this.parameter.genericType?.value;
|
|
225
|
+
if (genricType) {
|
|
226
|
+
genericType_setRawType(genricType, type);
|
|
227
|
+
}
|
|
228
|
+
this.mockParameterValue();
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
changeMultiplicity(
|
|
233
|
+
lowerBound: number,
|
|
234
|
+
uppderBound: number | undefined,
|
|
235
|
+
): void {
|
|
236
|
+
const current = this.parameter.multiplicity;
|
|
237
|
+
if (
|
|
238
|
+
current.lowerBound !== lowerBound ||
|
|
239
|
+
current.upperBound !== uppderBound
|
|
240
|
+
) {
|
|
241
|
+
multiplicity_setLowerBound(current, lowerBound);
|
|
242
|
+
multiplicity_setUpperBound(current, uppderBound);
|
|
243
|
+
this.mockParameterValue();
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
get variableName(): string {
|
|
248
|
+
return this.parameter.name;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
get variableType(): Type | undefined {
|
|
252
|
+
return this.parameter.genericType?.value.rawType;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export class ParameterInstanceValuesEditorState {
|
|
257
|
+
showModal = false;
|
|
258
|
+
submitAction:
|
|
259
|
+
| {
|
|
260
|
+
handler: () => Promise<void>;
|
|
261
|
+
label: string;
|
|
262
|
+
}
|
|
263
|
+
| undefined;
|
|
264
|
+
|
|
265
|
+
constructor() {
|
|
266
|
+
makeObservable(this, {
|
|
267
|
+
showModal: observable,
|
|
268
|
+
submitAction: observable,
|
|
269
|
+
setShowModal: action,
|
|
270
|
+
open: action,
|
|
271
|
+
setSubmitAction: action,
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
setShowModal(val: boolean): void {
|
|
276
|
+
this.showModal = val;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
setSubmitAction(
|
|
280
|
+
val:
|
|
281
|
+
| {
|
|
282
|
+
handler: () => Promise<void>;
|
|
283
|
+
label: string;
|
|
284
|
+
}
|
|
285
|
+
| undefined,
|
|
286
|
+
): void {
|
|
287
|
+
this.submitAction = val;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
open(handler: () => Promise<void>, label: string): void {
|
|
291
|
+
this.setSubmitAction({ handler, label });
|
|
292
|
+
this.setShowModal(true);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
close(): void {
|
|
296
|
+
this.setSubmitAction(undefined);
|
|
297
|
+
this.setShowModal(false);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
export class LambdaParametersState {
|
|
301
|
+
parameterStates: LambdaParameterState[] = [];
|
|
302
|
+
parameterValuesEditorState = new ParameterInstanceValuesEditorState();
|
|
303
|
+
|
|
304
|
+
addParameter(val: LambdaParameterState): void {
|
|
305
|
+
addUniqueEntry(this.parameterStates, val);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
removeParameter(val: LambdaParameterState): void {
|
|
309
|
+
deleteEntry(this.parameterStates, val);
|
|
310
|
+
}
|
|
311
|
+
setParameters(val: LambdaParameterState[]): void {
|
|
312
|
+
this.parameterStates = val;
|
|
313
|
+
}
|
|
314
|
+
}
|