@finos/legend-application 2.0.13 → 3.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 +0 -1
- package/lib/application/LegendApplication.d.ts.map +1 -1
- package/lib/application/LegendApplication.js +4 -15
- package/lib/application/LegendApplication.js.map +1 -1
- package/lib/application/LegendApplicationPluginManager.d.ts +4 -0
- package/lib/application/LegendApplicationPluginManager.d.ts.map +1 -1
- package/lib/application/LegendApplicationPluginManager.js +7 -0
- package/lib/application/LegendApplicationPluginManager.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/stores/ApplicationStore.d.ts +1 -1
- package/lib/stores/ApplicationStore.d.ts.map +1 -1
- package/lib/stores/ApplicationStore.js +10 -1
- package/lib/stores/ApplicationStore.js.map +1 -1
- package/lib/stores/LegendApplicationConfig.d.ts +4 -9
- package/lib/stores/LegendApplicationConfig.d.ts.map +1 -1
- package/lib/stores/LegendApplicationConfig.js +6 -13
- package/lib/stores/LegendApplicationConfig.js.map +1 -1
- package/lib/stores/LegendApplicationDocumentationRegistry.d.ts +13 -1
- package/lib/stores/LegendApplicationDocumentationRegistry.d.ts.map +1 -1
- package/lib/stores/LegendApplicationDocumentationRegistry.js +18 -0
- package/lib/stores/LegendApplicationDocumentationRegistry.js.map +1 -1
- package/lib/stores/LegendApplicationPlugin.d.ts +24 -0
- package/lib/stores/LegendApplicationPlugin.d.ts.map +1 -0
- package/lib/stores/LegendApplicationPlugin.js +19 -0
- package/lib/stores/LegendApplicationPlugin.js.map +1 -0
- package/lib/stores/PureLanguageSupport.d.ts +2 -33
- package/lib/stores/PureLanguageSupport.d.ts.map +1 -1
- package/lib/stores/PureLanguageSupport.js +86 -74
- package/lib/stores/PureLanguageSupport.js.map +1 -1
- package/package.json +15 -12
- package/src/application/LegendApplication.tsx +4 -36
- package/src/application/LegendApplicationPluginManager.tsx +10 -0
- package/src/index.ts +2 -2
- package/src/stores/ApplicationStore.ts +15 -2
- package/src/stores/LegendApplicationConfig.ts +11 -31
- package/src/stores/LegendApplicationDocumentationRegistry.ts +47 -1
- package/src/stores/LegendApplicationPlugin.ts +25 -0
- package/src/stores/PureLanguageSupport.ts +106 -81
- package/tsconfig.json +1 -0
|
@@ -13,49 +13,29 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
GRAMMAR_ELEMENT_TYPE_LABEL["MEASURE"] = "Measure";
|
|
22
|
-
GRAMMAR_ELEMENT_TYPE_LABEL["ASSOCIATION"] = "Association";
|
|
23
|
-
GRAMMAR_ELEMENT_TYPE_LABEL["FLAT_DATA"] = "FlatData";
|
|
24
|
-
GRAMMAR_ELEMENT_TYPE_LABEL["MAPPING"] = "Mapping";
|
|
25
|
-
GRAMMAR_ELEMENT_TYPE_LABEL["DATABASE"] = "Database";
|
|
26
|
-
GRAMMAR_ELEMENT_TYPE_LABEL["SERVICE_STORE"] = "ServiceStore";
|
|
27
|
-
GRAMMAR_ELEMENT_TYPE_LABEL["FUNCTION"] = "function";
|
|
28
|
-
GRAMMAR_ELEMENT_TYPE_LABEL["SERVICE"] = "Service";
|
|
29
|
-
GRAMMAR_ELEMENT_TYPE_LABEL["RUNTIME"] = "Runtime";
|
|
30
|
-
GRAMMAR_ELEMENT_TYPE_LABEL["CONNECTION"] = "Connection";
|
|
31
|
-
GRAMMAR_ELEMENT_TYPE_LABEL["FILE_GENERATION"] = "FileGeneration";
|
|
32
|
-
GRAMMAR_ELEMENT_TYPE_LABEL["GENERATION_SPECIFICATION"] = "GenerationSpecification";
|
|
33
|
-
GRAMMAR_ELEMENT_TYPE_LABEL["JSON_MODEL_CONNECTION"] = "JsonModelConnection";
|
|
34
|
-
GRAMMAR_ELEMENT_TYPE_LABEL["XML_MODEL_CONNECTION"] = "XmlModelConnection";
|
|
35
|
-
GRAMMAR_ELEMENT_TYPE_LABEL["MODEL_CHAIN_CONNECTION"] = "ModelChainConnection";
|
|
36
|
-
GRAMMAR_ELEMENT_TYPE_LABEL["FLAT_DATA_CONNECTION"] = "FlatDataConnection";
|
|
37
|
-
GRAMMAR_ELEMENT_TYPE_LABEL["RELATIONAL_DATABASE_CONNECTION"] = "RelationalDatabaseConnection";
|
|
38
|
-
})(GRAMMAR_ELEMENT_TYPE_LABEL || (GRAMMAR_ELEMENT_TYPE_LABEL = {}));
|
|
39
|
-
export const theme = {
|
|
16
|
+
/* eslint-disable prefer-named-capture-group */
|
|
17
|
+
import { PARSER_SECTION_MARKER, PURE_ELEMENT_NAME, PURE_CONNECTION_NAME, PURE_PARSER, } from '@finos/legend-graph';
|
|
18
|
+
import { editor as monacoEditorAPI, languages as monacoLanguagesAPI, } from 'monaco-editor';
|
|
19
|
+
import { EDITOR_LANGUAGE, EDITOR_THEME } from '../const';
|
|
20
|
+
const theme = {
|
|
40
21
|
base: 'vs-dark',
|
|
41
22
|
inherit: true,
|
|
42
23
|
colors: {},
|
|
43
24
|
rules: [
|
|
25
|
+
// NOTE: unfortunately, `monaco-editor` only accepts HEX values, not CSS variables
|
|
44
26
|
{ token: 'package', foreground: '808080' },
|
|
45
27
|
{ token: 'parser-marker', foreground: 'c586c0' },
|
|
46
28
|
{ token: 'property', foreground: 'dcdcaa' },
|
|
47
29
|
{ token: 'function', foreground: 'dcdcaa' },
|
|
48
30
|
{ token: 'language-struct', foreground: 'c586c0' },
|
|
49
|
-
|
|
31
|
+
{ token: 'multiplicity', foreground: '2d796b' },
|
|
50
32
|
{ token: 'attribute', foreground: '9cdcfe' },
|
|
51
|
-
{ token: 'cast', foreground: '
|
|
33
|
+
{ token: 'cast', foreground: '569cd6' },
|
|
52
34
|
],
|
|
53
35
|
};
|
|
54
36
|
// Taken from `monaco-languages` configuration for Java in order to do propert brace matching
|
|
55
37
|
// See https://github.com/microsoft/monaco-languages/blob/master/src/java/java.ts
|
|
56
|
-
|
|
57
|
-
// the default separators except `@$`
|
|
58
|
-
wordPattern: /(-?\d*\.\d\w*)|([^`~!#%^&*()-=+[{]}\\\|;:'",\.<>\/\?\s]+)/g,
|
|
38
|
+
const configuration = {
|
|
59
39
|
comments: {
|
|
60
40
|
lineComment: '//',
|
|
61
41
|
blockComment: ['/*', '*/'],
|
|
@@ -94,7 +74,7 @@ export const configuration = {
|
|
|
94
74
|
* The way SQL monarch definition is organized is good and worth learning from
|
|
95
75
|
* See https://github.com/microsoft/monaco-languages/blob/master/src/sql/sql.ts
|
|
96
76
|
*/
|
|
97
|
-
|
|
77
|
+
const generateLanguageMonarch = (extraKeywords, extraParsers) =>
|
|
98
78
|
// TODO: complete syntax-highlighter for core features like constraint, derived properties, etc.
|
|
99
79
|
// TODO: add syntax highlighting for modules/plugins (come up with a plugin mechanism to do this).
|
|
100
80
|
({
|
|
@@ -102,28 +82,47 @@ export const generateLanguageMonarch = (extraKeywords, extraParsers) =>
|
|
|
102
82
|
tokenPostfix: '.pure',
|
|
103
83
|
keywords: [
|
|
104
84
|
...extraKeywords,
|
|
85
|
+
// relational
|
|
86
|
+
'Schema',
|
|
87
|
+
'Table',
|
|
88
|
+
'Join',
|
|
89
|
+
'View',
|
|
90
|
+
'primaryKey',
|
|
91
|
+
'groupBy',
|
|
92
|
+
'mainTable',
|
|
93
|
+
// native
|
|
94
|
+
'let',
|
|
105
95
|
'extends',
|
|
106
|
-
'function',
|
|
107
96
|
'projects',
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
97
|
+
// elements
|
|
98
|
+
PURE_ELEMENT_NAME.CLASS,
|
|
99
|
+
PURE_ELEMENT_NAME.ASSOCIATION,
|
|
100
|
+
PURE_ELEMENT_NAME.ENUMERATION,
|
|
101
|
+
PURE_ELEMENT_NAME.MEASURE,
|
|
102
|
+
PURE_ELEMENT_NAME.PROFILE,
|
|
103
|
+
PURE_ELEMENT_NAME.FUNCTION,
|
|
104
|
+
PURE_ELEMENT_NAME.FLAT_DATA,
|
|
105
|
+
PURE_ELEMENT_NAME.DATABASE,
|
|
106
|
+
PURE_ELEMENT_NAME.MAPPING,
|
|
107
|
+
PURE_ELEMENT_NAME.SERVICE,
|
|
108
|
+
PURE_ELEMENT_NAME.RUNTIME,
|
|
109
|
+
PURE_ELEMENT_NAME.CONNECTION,
|
|
110
|
+
PURE_ELEMENT_NAME.FILE_GENERATION,
|
|
111
|
+
PURE_ELEMENT_NAME.GENERATION_SPECIFICATION,
|
|
112
|
+
PURE_ELEMENT_NAME.DATA_ELEMENT,
|
|
113
|
+
// connections
|
|
114
|
+
PURE_CONNECTION_NAME.JSON_MODEL_CONNECTION,
|
|
115
|
+
PURE_CONNECTION_NAME.MODEL_CHAIN_CONNECTION,
|
|
116
|
+
PURE_CONNECTION_NAME.XML_MODEL_CONNECTION,
|
|
117
|
+
PURE_CONNECTION_NAME.FLAT_DATA_CONNECTION,
|
|
118
|
+
PURE_CONNECTION_NAME.RELATIONAL_DATABASE_CONNECTION,
|
|
119
|
+
// mapping
|
|
120
|
+
'EnumerationMapping',
|
|
121
|
+
'Pure',
|
|
122
|
+
'Relational',
|
|
123
|
+
'AssociationMapping',
|
|
124
|
+
'XStore',
|
|
125
|
+
'AggregationAware',
|
|
127
126
|
],
|
|
128
127
|
operators: [
|
|
129
128
|
'=',
|
|
@@ -149,23 +148,27 @@ export const generateLanguageMonarch = (extraKeywords, extraParsers) =>
|
|
|
149
148
|
'^',
|
|
150
149
|
'%',
|
|
151
150
|
'->',
|
|
151
|
+
'#{',
|
|
152
|
+
'}#',
|
|
153
|
+
'@',
|
|
152
154
|
],
|
|
153
155
|
languageStructs: ['import', 'native', 'if', 'fold'],
|
|
154
156
|
parsers: [
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
157
|
+
PURE_PARSER.PURE,
|
|
158
|
+
PURE_PARSER.CONNECTION,
|
|
159
|
+
PURE_PARSER.RUNTIME,
|
|
160
|
+
PURE_PARSER.MAPPING,
|
|
161
|
+
PURE_PARSER.SERVICE,
|
|
162
|
+
PURE_PARSER.FLATDATA,
|
|
163
|
+
PURE_PARSER.RELATIONAL,
|
|
164
|
+
PURE_PARSER.GENERATION_SPECIFICATION,
|
|
165
|
+
PURE_PARSER.FILE_GENERATION,
|
|
166
|
+
PURE_PARSER.DATA,
|
|
167
|
+
]
|
|
168
|
+
.concat(extraParsers)
|
|
169
|
+
.map((parser) => `${PARSER_SECTION_MARKER}${parser}`),
|
|
167
170
|
// common regular expressions to be used in tokenizer
|
|
168
|
-
symbols: /[
|
|
171
|
+
symbols: /[=><!~?:&|+\-*/^%#@]+/,
|
|
169
172
|
escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
|
|
170
173
|
digits: /\d+(_+\d+)*/,
|
|
171
174
|
octaldigits: /[0-7]+(_+[0-7]+)*/,
|
|
@@ -175,9 +178,6 @@ export const generateLanguageMonarch = (extraKeywords, extraParsers) =>
|
|
|
175
178
|
package: /(?:[\w_]+::)+/,
|
|
176
179
|
tokenizer: {
|
|
177
180
|
root: [
|
|
178
|
-
// multiplicity
|
|
179
|
-
// TODO: this as it can clash with array of numbers
|
|
180
|
-
[/@multiplicity/, 'multiplicity'],
|
|
181
181
|
// packages
|
|
182
182
|
{ include: '@package' },
|
|
183
183
|
// properties
|
|
@@ -186,7 +186,8 @@ export const generateLanguageMonarch = (extraKeywords, extraParsers) =>
|
|
|
186
186
|
{ include: '@function' },
|
|
187
187
|
// parser markers
|
|
188
188
|
[
|
|
189
|
-
|
|
189
|
+
// NOTE: any leading whitespace to the section header is considered invalid syntax
|
|
190
|
+
/^\s*###[\w]+/,
|
|
190
191
|
{
|
|
191
192
|
cases: {
|
|
192
193
|
'@parsers': 'parser-marker',
|
|
@@ -214,7 +215,7 @@ export const generateLanguageMonarch = (extraKeywords, extraParsers) =>
|
|
|
214
215
|
/@symbols/,
|
|
215
216
|
{
|
|
216
217
|
cases: {
|
|
217
|
-
'@operators': '
|
|
218
|
+
'@operators': 'operator',
|
|
218
219
|
'@default': '',
|
|
219
220
|
},
|
|
220
221
|
},
|
|
@@ -250,16 +251,16 @@ export const generateLanguageMonarch = (extraKeywords, extraParsers) =>
|
|
|
250
251
|
[/(@package)(\*)/, ['package', 'tag']],
|
|
251
252
|
[/(@package)([\w_]+)/, ['package', 'type']],
|
|
252
253
|
[
|
|
253
|
-
/(@package)([\w_]+)(@multiplicity)/,
|
|
254
|
-
['package', 'type', 'multiplicity'],
|
|
254
|
+
/(@package)([\w_]+)(\s*)(@multiplicity)/,
|
|
255
|
+
['package', 'type', '', 'multiplicity'],
|
|
255
256
|
],
|
|
256
257
|
[
|
|
257
|
-
/([\w_]+)(\s*:\s*)(@package)([\w_]+)(@multiplicity)/,
|
|
258
|
-
['attribute', '', 'package', 'type', 'multiplicity'],
|
|
258
|
+
/([\w_]+)(\s*:\s*)(@package)([\w_]+)(\s*)(@multiplicity)/,
|
|
259
|
+
['attribute', '', 'package', 'type', '', 'multiplicity'],
|
|
259
260
|
],
|
|
260
261
|
[
|
|
261
|
-
/([\w_]+)(\s
|
|
262
|
-
['
|
|
262
|
+
/(:\s*)([\w_]+)(\s*)(@multiplicity)/,
|
|
263
|
+
['', 'type', '', 'multiplicity'],
|
|
263
264
|
],
|
|
264
265
|
],
|
|
265
266
|
whitespace: [
|
|
@@ -296,4 +297,15 @@ export const generateLanguageMonarch = (extraKeywords, extraParsers) =>
|
|
|
296
297
|
],
|
|
297
298
|
},
|
|
298
299
|
});
|
|
300
|
+
export const setupPureLanguageService = (pluginManager) => {
|
|
301
|
+
// register Pure language in `monaco-editor`
|
|
302
|
+
monacoEditorAPI.defineTheme(EDITOR_THEME.LEGEND, theme);
|
|
303
|
+
monacoLanguagesAPI.register({ id: EDITOR_LANGUAGE.PURE });
|
|
304
|
+
monacoLanguagesAPI.setLanguageConfiguration(EDITOR_LANGUAGE.PURE, configuration);
|
|
305
|
+
monacoLanguagesAPI.setMonarchTokensProvider(EDITOR_LANGUAGE.PURE, generateLanguageMonarch(pluginManager
|
|
306
|
+
.getPureGraphManagerPlugins()
|
|
307
|
+
.flatMap((plugin) => plugin.getExtraPureGrammarKeywords?.() ?? []), pluginManager
|
|
308
|
+
.getPureGraphManagerPlugins()
|
|
309
|
+
.flatMap((plugin) => plugin.getExtraPureGrammarParserNames?.() ?? [])));
|
|
310
|
+
};
|
|
299
311
|
//# sourceMappingURL=PureLanguageSupport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PureLanguageSupport.js","sourceRoot":"","sources":["../../src/stores/PureLanguageSupport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"PureLanguageSupport.js","sourceRoot":"","sources":["../../src/stores/PureLanguageSupport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,+CAA+C;AAC/C,OAAO,EAEL,qBAAqB,EACrB,iBAAiB,EACjB,oBAAoB,EACpB,WAAW,GACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,MAAM,IAAI,eAAe,EACzB,SAAS,IAAI,kBAAkB,GAChC,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAEzD,MAAM,KAAK,GAAyC;IAClD,I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0BAA0B,EAAE;SAC5B,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,8BAA8B,EAAE,EAAE,IAAI,EAAE,CAAC,CACxE,CACF,CAAC;AACJ,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finos/legend-application",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Legend application core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"legend",
|
|
@@ -20,7 +20,10 @@
|
|
|
20
20
|
"license": "Apache-2.0",
|
|
21
21
|
"sideEffects": false,
|
|
22
22
|
"type": "module",
|
|
23
|
-
"
|
|
23
|
+
"exports": {
|
|
24
|
+
".": "./lib/index.js",
|
|
25
|
+
"./lib/index.css": "./lib/index.css"
|
|
26
|
+
},
|
|
24
27
|
"module": "lib/index.js",
|
|
25
28
|
"types": "lib/index.d.ts",
|
|
26
29
|
"scripts": {
|
|
@@ -40,12 +43,12 @@
|
|
|
40
43
|
"test:watch": "jest --watch"
|
|
41
44
|
},
|
|
42
45
|
"dependencies": {
|
|
43
|
-
"@finos/legend-art": "0.
|
|
44
|
-
"@finos/legend-graph": "
|
|
45
|
-
"@finos/legend-shared": "
|
|
46
|
+
"@finos/legend-art": "1.0.0",
|
|
47
|
+
"@finos/legend-graph": "6.0.1",
|
|
48
|
+
"@finos/legend-shared": "2.0.0",
|
|
46
49
|
"@types/css-font-loading-module": "0.0.7",
|
|
47
|
-
"@types/react": "17.0.
|
|
48
|
-
"@types/react-dom": "17.0.
|
|
50
|
+
"@types/react": "17.0.44",
|
|
51
|
+
"@types/react-dom": "17.0.16",
|
|
49
52
|
"@types/react-router-dom": "5.3.2",
|
|
50
53
|
"history": "5.3.0",
|
|
51
54
|
"mobx": "6.5.0",
|
|
@@ -59,14 +62,14 @@
|
|
|
59
62
|
"serializr": "2.0.5"
|
|
60
63
|
},
|
|
61
64
|
"devDependencies": {
|
|
62
|
-
"@finos/legend-dev-utils": "0.
|
|
65
|
+
"@finos/legend-dev-utils": "1.0.0",
|
|
63
66
|
"cross-env": "7.0.3",
|
|
64
|
-
"eslint": "8.
|
|
65
|
-
"jest": "
|
|
67
|
+
"eslint": "8.14.0",
|
|
68
|
+
"jest": "28.0.3",
|
|
66
69
|
"npm-run-all": "4.1.5",
|
|
67
70
|
"rimraf": "3.0.2",
|
|
68
|
-
"sass": "1.
|
|
69
|
-
"typescript": "4.6.
|
|
71
|
+
"sass": "1.51.0",
|
|
72
|
+
"typescript": "4.6.4"
|
|
70
73
|
},
|
|
71
74
|
"peerDependencies": {
|
|
72
75
|
"react": "^17.0.0"
|
|
@@ -15,20 +15,8 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { configure as configureMobx } from 'mobx';
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
languages as monacoLanguagesAPI,
|
|
21
|
-
} from 'monaco-editor';
|
|
22
|
-
import {
|
|
23
|
-
configuration,
|
|
24
|
-
generateLanguageMonarch,
|
|
25
|
-
theme,
|
|
26
|
-
} from '../stores/PureLanguageSupport';
|
|
27
|
-
import {
|
|
28
|
-
EDITOR_THEME,
|
|
29
|
-
EDITOR_LANGUAGE,
|
|
30
|
-
MONOSPACED_FONT_FAMILY,
|
|
31
|
-
} from '../const';
|
|
18
|
+
import { editor as monacoEditorAPI } from 'monaco-editor';
|
|
19
|
+
import { MONOSPACED_FONT_FAMILY } from '../const';
|
|
32
20
|
import type {
|
|
33
21
|
LegendApplicationConfig,
|
|
34
22
|
LegendApplicationConfigurationData,
|
|
@@ -47,6 +35,7 @@ import { APPLICATION_EVENT } from '../stores/ApplicationEvent';
|
|
|
47
35
|
import { configureComponents } from '@finos/legend-art';
|
|
48
36
|
import type { GraphPluginManager } from '@finos/legend-graph';
|
|
49
37
|
import type { LegendApplicationPluginManager } from './LegendApplicationPluginManager';
|
|
38
|
+
import { setupPureLanguageService } from '../stores/PureLanguageSupport';
|
|
50
39
|
|
|
51
40
|
export abstract class LegendApplicationLogger {
|
|
52
41
|
abstract debug(event: LogEvent, ...data: unknown[]): void;
|
|
@@ -89,27 +78,6 @@ export class LegendApplicationWebConsole extends LegendApplicationLogger {
|
|
|
89
78
|
}
|
|
90
79
|
}
|
|
91
80
|
|
|
92
|
-
export const setupTextEdtiorAPI = (pluginManager: GraphPluginManager): void => {
|
|
93
|
-
// Register Pure as a language in `monaco-editor`
|
|
94
|
-
monacoEditorAPI.defineTheme(EDITOR_THEME.LEGEND, theme);
|
|
95
|
-
monacoLanguagesAPI.register({ id: EDITOR_LANGUAGE.PURE });
|
|
96
|
-
monacoLanguagesAPI.setLanguageConfiguration(
|
|
97
|
-
EDITOR_LANGUAGE.PURE,
|
|
98
|
-
configuration,
|
|
99
|
-
);
|
|
100
|
-
monacoLanguagesAPI.setMonarchTokensProvider(
|
|
101
|
-
EDITOR_LANGUAGE.PURE,
|
|
102
|
-
generateLanguageMonarch(
|
|
103
|
-
pluginManager
|
|
104
|
-
.getPureGraphManagerPlugins()
|
|
105
|
-
.flatMap((plugin) => plugin.getExtraPureGrammarKeywords?.() ?? []),
|
|
106
|
-
pluginManager
|
|
107
|
-
.getPureGraphManagerPlugins()
|
|
108
|
-
.flatMap((plugin) => plugin.getExtraPureGrammarParserNames?.() ?? []),
|
|
109
|
-
),
|
|
110
|
-
);
|
|
111
|
-
};
|
|
112
|
-
|
|
113
81
|
// This is not considered side-effect that hinders tree-shaking because the effectful calls
|
|
114
82
|
// are embedded in the function
|
|
115
83
|
// See https://sgom.es/posts/2020-06-15-everything-you-never-wanted-to-know-about-side-effects/
|
|
@@ -117,7 +85,7 @@ export const setupLegendApplicationUILibrary = async (
|
|
|
117
85
|
pluginManager: GraphPluginManager,
|
|
118
86
|
logger: LegendApplicationLogger,
|
|
119
87
|
): Promise<void> => {
|
|
120
|
-
|
|
88
|
+
setupPureLanguageService(pluginManager);
|
|
121
89
|
|
|
122
90
|
/**
|
|
123
91
|
* Since we use a custom fonts for text-editor, we want to make sure the font is loaded before any text-editor is opened
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
type TracerServicePluginManager,
|
|
26
26
|
AbstractPluginManager,
|
|
27
27
|
} from '@finos/legend-shared';
|
|
28
|
+
import type { LegendApplicationPlugin } from '../stores/LegendApplicationPlugin';
|
|
28
29
|
|
|
29
30
|
export class LegendApplicationPluginManager
|
|
30
31
|
extends AbstractPluginManager
|
|
@@ -38,6 +39,7 @@ export class LegendApplicationPluginManager
|
|
|
38
39
|
protected telemetryServicePlugins: TelemetryServicePlugin[] = [];
|
|
39
40
|
protected tracerServicePlugins: TracerServicePlugin<unknown>[] = [];
|
|
40
41
|
protected eventNotifierPlugins: EventNotifierPlugin[] = [];
|
|
42
|
+
protected applicationPlugins: LegendApplicationPlugin[] = [];
|
|
41
43
|
|
|
42
44
|
registerLoggerPlugin(plugin: LoggerPlugin): void {
|
|
43
45
|
this.loggerPlugins.push(plugin);
|
|
@@ -55,6 +57,10 @@ export class LegendApplicationPluginManager
|
|
|
55
57
|
this.eventNotifierPlugins.push(plugin);
|
|
56
58
|
}
|
|
57
59
|
|
|
60
|
+
registerApplicationPlugin(plugin: LegendApplicationPlugin): void {
|
|
61
|
+
this.applicationPlugins.push(plugin);
|
|
62
|
+
}
|
|
63
|
+
|
|
58
64
|
getLoggerPlugins(): LoggerPlugin[] {
|
|
59
65
|
return [...this.loggerPlugins];
|
|
60
66
|
}
|
|
@@ -70,4 +76,8 @@ export class LegendApplicationPluginManager
|
|
|
70
76
|
getEventNotifierPlugins(): EventNotifierPlugin[] {
|
|
71
77
|
return [...this.eventNotifierPlugins];
|
|
72
78
|
}
|
|
79
|
+
|
|
80
|
+
getApplicationPlugins(): LegendApplicationPlugin[] {
|
|
81
|
+
return [...this.applicationPlugins];
|
|
82
|
+
}
|
|
73
83
|
}
|
package/src/index.ts
CHANGED
|
@@ -38,7 +38,7 @@ export * from './stores/LegendApplicationConfig';
|
|
|
38
38
|
export { WebApplicationNavigator } from './stores/WebApplicationNavigator';
|
|
39
39
|
export { LambdaEditorState } from './stores/LambdaEditorState';
|
|
40
40
|
export * from './stores/PackageableElementOption';
|
|
41
|
-
|
|
42
|
-
export
|
|
41
|
+
export * from './stores/LegendApplicationDocumentationRegistry';
|
|
42
|
+
export * from './stores/LegendApplicationPlugin';
|
|
43
43
|
|
|
44
44
|
export * from './stores/ApplicationStoreTestUtils';
|
|
@@ -31,7 +31,7 @@ import { APPLICATION_EVENT } from './ApplicationEvent';
|
|
|
31
31
|
import type { LegendApplicationConfig } from './LegendApplicationConfig';
|
|
32
32
|
import type { WebApplicationNavigator } from './WebApplicationNavigator';
|
|
33
33
|
import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager';
|
|
34
|
-
import
|
|
34
|
+
import { LegendApplicationDocumentationRegistry } from './LegendApplicationDocumentationRegistry';
|
|
35
35
|
|
|
36
36
|
export enum ActionAlertType {
|
|
37
37
|
STANDARD = 'STANDARD',
|
|
@@ -131,9 +131,22 @@ export class ApplicationStore<T extends LegendApplicationConfig> {
|
|
|
131
131
|
});
|
|
132
132
|
|
|
133
133
|
this.config = config;
|
|
134
|
-
this.docRegistry = config.docRegistry;
|
|
135
134
|
this.navigator = navigator;
|
|
136
135
|
|
|
136
|
+
// Documentation
|
|
137
|
+
this.docRegistry = new LegendApplicationDocumentationRegistry();
|
|
138
|
+
[
|
|
139
|
+
...pluginManager
|
|
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
|
+
|
|
137
150
|
// Register plugins
|
|
138
151
|
this.log.registerPlugins(pluginManager.getLoggerPlugins());
|
|
139
152
|
this.telemetryService.registerPlugins(
|
|
@@ -18,10 +18,12 @@ import {
|
|
|
18
18
|
guaranteeNonEmptyString,
|
|
19
19
|
guaranteeNonNullable,
|
|
20
20
|
type PlainObject,
|
|
21
|
-
type MarkdownText,
|
|
22
|
-
deserializeMarkdownText,
|
|
23
21
|
} from '@finos/legend-shared';
|
|
24
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
type LegendApplicationKeyedDocumentationEntry,
|
|
24
|
+
type LegendApplicationDocumentationEntry,
|
|
25
|
+
collectKeyedDocumnetationEntriesFromConfig,
|
|
26
|
+
} from './LegendApplicationDocumentationRegistry';
|
|
25
27
|
|
|
26
28
|
export interface LegendApplicationVersionData {
|
|
27
29
|
buildTime: string;
|
|
@@ -29,26 +31,6 @@ export interface LegendApplicationVersionData {
|
|
|
29
31
|
commitSHA: string;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
|
-
export interface LegendApplicationDocumentationEntry {
|
|
33
|
-
markdownText?: MarkdownText | undefined;
|
|
34
|
-
title?: string | undefined;
|
|
35
|
-
text?: string | undefined;
|
|
36
|
-
url?: string | undefined;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const deserializeDocumentationEntry = (
|
|
40
|
-
val: PlainObject<LegendApplicationDocumentationEntry>,
|
|
41
|
-
): LegendApplicationDocumentationEntry => {
|
|
42
|
-
let markdownText: MarkdownText | undefined;
|
|
43
|
-
if (val.markdownText) {
|
|
44
|
-
markdownText = deserializeMarkdownText(
|
|
45
|
-
val.markdownText as PlainObject<MarkdownText>,
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return { ...val, markdownText };
|
|
50
|
-
};
|
|
51
|
-
|
|
52
34
|
export interface LegendApplicationConfigurationData {
|
|
53
35
|
appName: string;
|
|
54
36
|
env: string;
|
|
@@ -67,7 +49,9 @@ export abstract class LegendApplicationConfig {
|
|
|
67
49
|
readonly baseUrl: string;
|
|
68
50
|
readonly env: string;
|
|
69
51
|
|
|
70
|
-
readonly
|
|
52
|
+
readonly documentationUrl: string | undefined;
|
|
53
|
+
readonly documentationKeyedEntries: LegendApplicationKeyedDocumentationEntry[] =
|
|
54
|
+
[];
|
|
71
55
|
|
|
72
56
|
readonly appVersion: string;
|
|
73
57
|
readonly appVersionBuildTime: string;
|
|
@@ -89,13 +73,9 @@ export abstract class LegendApplicationConfig {
|
|
|
89
73
|
);
|
|
90
74
|
|
|
91
75
|
// Documentation
|
|
92
|
-
this.
|
|
93
|
-
this.
|
|
94
|
-
|
|
95
|
-
this.docRegistry.registerEntry(
|
|
96
|
-
entry[0],
|
|
97
|
-
deserializeDocumentationEntry(entry[1]),
|
|
98
|
-
),
|
|
76
|
+
this.documentationUrl = configData.documentation?.url;
|
|
77
|
+
this.documentationKeyedEntries = collectKeyedDocumnetationEntriesFromConfig(
|
|
78
|
+
configData.documentation?.entries ?? {},
|
|
99
79
|
);
|
|
100
80
|
|
|
101
81
|
// Version
|
|
@@ -14,7 +14,53 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import
|
|
17
|
+
import {
|
|
18
|
+
type MarkdownText,
|
|
19
|
+
type PlainObject,
|
|
20
|
+
deserializeMarkdownText,
|
|
21
|
+
SerializationFactory,
|
|
22
|
+
} from '@finos/legend-shared';
|
|
23
|
+
import {
|
|
24
|
+
createModelSchema,
|
|
25
|
+
custom,
|
|
26
|
+
optional,
|
|
27
|
+
primitive,
|
|
28
|
+
SKIP,
|
|
29
|
+
} from 'serializr';
|
|
30
|
+
|
|
31
|
+
export class LegendApplicationDocumentationEntry {
|
|
32
|
+
markdownText?: MarkdownText | undefined;
|
|
33
|
+
title?: string | undefined;
|
|
34
|
+
text?: string | undefined;
|
|
35
|
+
url?: string | undefined;
|
|
36
|
+
|
|
37
|
+
static readonly serialization = new SerializationFactory(
|
|
38
|
+
createModelSchema(LegendApplicationDocumentationEntry, {
|
|
39
|
+
markdownText: custom(
|
|
40
|
+
() => SKIP,
|
|
41
|
+
(val) => deserializeMarkdownText(val),
|
|
42
|
+
),
|
|
43
|
+
title: optional(primitive()),
|
|
44
|
+
text: optional(primitive()),
|
|
45
|
+
url: optional(primitive()),
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface LegendApplicationKeyedDocumentationEntry {
|
|
51
|
+
key: string;
|
|
52
|
+
content: LegendApplicationDocumentationEntry;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const collectKeyedDocumnetationEntriesFromConfig = (
|
|
56
|
+
rawEntries: Record<string, PlainObject<LegendApplicationDocumentationEntry>>,
|
|
57
|
+
): LegendApplicationKeyedDocumentationEntry[] =>
|
|
58
|
+
Object.entries(rawEntries).map((entry) => ({
|
|
59
|
+
key: entry[0],
|
|
60
|
+
content: LegendApplicationDocumentationEntry.serialization.fromJson(
|
|
61
|
+
entry[1],
|
|
62
|
+
),
|
|
63
|
+
}));
|
|
18
64
|
|
|
19
65
|
export class LegendApplicationDocumentationRegistry {
|
|
20
66
|
url?: string | undefined;
|
|
@@ -0,0 +1,25 @@
|
|
|
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 { AbstractPlugin } from '@finos/legend-shared';
|
|
18
|
+
import type { LegendApplicationKeyedDocumentationEntry } from './LegendApplicationDocumentationRegistry';
|
|
19
|
+
|
|
20
|
+
export abstract class LegendApplicationPlugin extends AbstractPlugin {
|
|
21
|
+
/**
|
|
22
|
+
* Get the list of keyed documentation entries to be added to the documentation registry.
|
|
23
|
+
*/
|
|
24
|
+
getExtraKeyedDocumentationEntries?(): LegendApplicationKeyedDocumentationEntry[];
|
|
25
|
+
}
|