@finos/legend-application 7.1.0 → 7.1.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/index.css CHANGED
@@ -1,4 +1,4 @@
1
- /** @license @finos/legend-application v7.1.0
1
+ /** @license @finos/legend-application v7.1.1
2
2
  * Copyright (c) 2020-present, Goldman Sachs
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
package/lib/index.d.ts CHANGED
@@ -34,6 +34,7 @@ export * from './stores/AssistantService.js';
34
34
  export * from './stores/ApplicationNavigationContextService.js';
35
35
  export * from './stores/LegendApplicationPlugin.js';
36
36
  export * from './stores/ApplicationStoreTestUtils.js';
37
+ export * from './stores/LegendApplicationSDLCSetupState.js';
37
38
  export * from './components/shared/DocumentationLink.js';
38
39
  export * from './components/shared/TextInputEditor.js';
39
40
  export * from './components/shared/LambdaEditor.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,YAAY,CAAC;AAE3B,cAAc,iDAAiD,CAAC;AAChE,cAAc,oCAAoC,CAAC;AACnD,cAAc,0CAA0C,CAAC;AACzD,cAAc,iDAAiD,CAAC;AAChE,cAAc,6DAA6D,CAAC;AAC5E,cAAc,0DAA0D,CAAC;AACzE,cAAc,mDAAmD,CAAC;AAClE,cAAc,0DAA0D,CAAC;AAGzE,cAAc,kCAAkC,CAAC;AAEjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0CAA0C,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iDAAiD,CAAC;AAChE,cAAc,qCAAqC,CAA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c,yDAAyD,CAAC;AACxE,cAAc,kEAAkE,CAAC;AAEjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,cAAc,6CAA6C,CAAC;AAC5D,cAAc,yCAAyC,CAAC;AACxD,cAAc,qDAAqD,CAAC;AACpE,cAAc,uCAAuC,CAAC"}
package/lib/index.js CHANGED
@@ -36,6 +36,7 @@ export * from './stores/AssistantService.js';
36
36
  export * from './stores/ApplicationNavigationContextService.js';
37
37
  export * from './stores/LegendApplicationPlugin.js';
38
38
  export * from './stores/ApplicationStoreTestUtils.js';
39
+ export * from './stores/LegendApplicationSDLCSetupState.js';
39
40
  // ------------------------------------------- Shared components -------------------------------------------
40
41
  export * from './components/shared/DocumentationLink.js';
41
42
  export * from './components/shared/TextInputEditor.js';
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,YAAY,CAAC;AAE3B,cAAc,iDAAiD,CAAC;AAChE,cAAc,oCAAoC,CAAC;AACnD,cAAc,0CAA0C,CAAC;AACzD,cAAc,iDAAiD,CAAC;AAChE,cAAc,6DAA6D,CAAC;AAC5E,cAAc,0DAA0D,CAAC;AACzE,cAAc,mDAAmD,CAAC;AAClE,cAAc,0DAA0D,CAAC;AACzE,8EAA8E;AAC9E,kEAAkE;AAClE,cAAc,kCAAkC,CAAC;AAEjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0CAA0C,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iDAAiD,CAAC;AAChE,cAAc,qCAAqC,CAAC;AAEpD,cAAc,uCAAuC,CAA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cAAc,oDAAoD,CAAC;AACnE,cAAc,yDAAyD,CAAC;AACxE,cAAc,kEAAkE,CAAC;AAEjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,cAAc,6CAA6C,CAAC;AAC5D,cAAc,yCAAyC,CAAC;AACxD,cAAc,qDAAqD,CAAC;AACpE,cAAc,uCAAuC,CAAC"}
@@ -0,0 +1,30 @@
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
+ import { SDLCServerClient } from '@finos/legend-server-sdlc';
17
+ import { type GeneratorFn } from '@finos/legend-shared';
18
+ import { type GenericLegendApplicationStore } from './ApplicationStore.js';
19
+ export declare class LegendApplicationSDLCSetupState {
20
+ applicationStore: GenericLegendApplicationStore;
21
+ sdlcServerClient: SDLCServerClient;
22
+ isSDLCAuthorized: boolean;
23
+ SDLCServerTermsOfServicesUrlsToView: string[];
24
+ constructor(applicationStore: GenericLegendApplicationStore, sdlcServerClient: SDLCServerClient);
25
+ initializeSDLCServerClient(): GeneratorFn<void>;
26
+ fetchCurrentUser(): GeneratorFn<void>;
27
+ get needsToAcceptSDLCServerTermsOfServices(): boolean;
28
+ dismissSDLCServerTermsOfServicesAlert(): void;
29
+ }
30
+ //# sourceMappingURL=LegendApplicationSDLCSetupState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LegendApplicationSDLCSetupState.d.ts","sourceRoot":"","sources":["../../src/stores/LegendApplicationSDLCSetupState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,gBAAgB,EAAQ,MAAM,2BAA2B,CAAC;AACnE,OAAO,EACL,KAAK,WAAW,EAMjB,MAAM,sBAAsB,CAAC;AAU9B,OAAO,EACL,KAAK,6BAA6B,EAGnC,MAAM,uBAAuB,CAAC;AAE/B,qBAAa,+BAA+B;IAC1C,gBAAgB,EAAE,6BAA6B,CAAC;IAChD,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,gBAAgB,UAAS;IACzB,mCAAmC,EAAE,MAAM,EAAE,CAAM;gBAGjD,gBAAgB,EAAE,6BAA6B,EAC/C,gBAAgB,EAAE,gBAAgB;IAcnC,0BAA0B,IAAI,WAAW,CAAC,IAAI,CAAC;IAyF/C,gBAAgB,IAAI,WAAW,CAAC,IAAI,CAAC;IAgBtC,IAAI,sCAAsC,IAAI,OAAO,CAEpD;IAED,qCAAqC,IAAI,IAAI;CAG9C"}
@@ -0,0 +1,128 @@
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
+ import { SDLCServerClient, User } from '@finos/legend-server-sdlc';
17
+ import { assertErrorThrown, HttpStatus, LogEvent, NetworkClientError, } from '@finos/legend-shared';
18
+ import { action, computed, flow, flowResult, makeObservable, observable, } from 'mobx';
19
+ import { APPLICATION_EVENT } from './ApplicationEvent.js';
20
+ import { ActionAlertActionType, ActionAlertType, } from './ApplicationStore.js';
21
+ export class LegendApplicationSDLCSetupState {
22
+ applicationStore;
23
+ sdlcServerClient;
24
+ isSDLCAuthorized = false;
25
+ SDLCServerTermsOfServicesUrlsToView = [];
26
+ constructor(applicationStore, sdlcServerClient) {
27
+ makeObservable(this, {
28
+ isSDLCAuthorized: observable,
29
+ SDLCServerTermsOfServicesUrlsToView: observable,
30
+ dismissSDLCServerTermsOfServicesAlert: action,
31
+ needsToAcceptSDLCServerTermsOfServices: computed,
32
+ initializeSDLCServerClient: flow,
33
+ fetchCurrentUser: flow,
34
+ });
35
+ this.applicationStore = applicationStore;
36
+ this.sdlcServerClient = sdlcServerClient;
37
+ }
38
+ *initializeSDLCServerClient() {
39
+ try {
40
+ this.isSDLCAuthorized =
41
+ (yield this.sdlcServerClient.isAuthorized());
42
+ if (!this.isSDLCAuthorized) {
43
+ this.applicationStore.navigator.jumpTo(SDLCServerClient.authorizeCallbackUrl(this.sdlcServerClient.baseUrl ?? '', this.applicationStore.navigator.getCurrentLocation()));
44
+ }
45
+ else {
46
+ // Only proceed intialization after passing authorization check
47
+ // check terms of service agreement status
48
+ this.SDLCServerTermsOfServicesUrlsToView =
49
+ (yield this.sdlcServerClient.hasAcceptedTermsOfService());
50
+ if (this.SDLCServerTermsOfServicesUrlsToView.length) {
51
+ this.applicationStore.setActionAlertInfo({
52
+ message: `Please read and accept the SDLC servers' terms of service`,
53
+ prompt: `Click 'Done' when you have accepted all the terms`,
54
+ type: ActionAlertType.CAUTION,
55
+ actions: [
56
+ {
57
+ label: 'See terms of services',
58
+ default: true,
59
+ handler: () => this.SDLCServerTermsOfServicesUrlsToView.forEach((url) => this.applicationStore.navigator.openNewWindow(url)),
60
+ type: ActionAlertActionType.PROCEED,
61
+ },
62
+ {
63
+ label: 'Done',
64
+ type: ActionAlertActionType.PROCEED_WITH_CAUTION,
65
+ handler: () => {
66
+ this.dismissSDLCServerTermsOfServicesAlert();
67
+ this.applicationStore.navigator.reload();
68
+ },
69
+ },
70
+ ],
71
+ });
72
+ }
73
+ // fetch server features config + current user
74
+ yield this.sdlcServerClient.fetchServerFeaturesConfiguration();
75
+ yield flowResult(this.fetchCurrentUser());
76
+ }
77
+ }
78
+ catch (error) {
79
+ assertErrorThrown(error);
80
+ if (
81
+ // eslint-disable-next-line no-process-env
82
+ process.env.NODE_ENV === 'development' &&
83
+ error instanceof NetworkClientError &&
84
+ error.response.status === HttpStatus.UNAUTHORIZED) {
85
+ this.applicationStore.setActionAlertInfo({
86
+ message: 'The first time the application starts in development mode, the developer would need to authenticate using SDLC server. Please do so then manually reload the app',
87
+ type: ActionAlertType.STANDARD,
88
+ actions: [
89
+ {
90
+ label: 'Authenticate using SDLC',
91
+ type: ActionAlertActionType.PROCEED,
92
+ default: true,
93
+ handler: () => {
94
+ this.applicationStore.navigator.openNewWindow(this.sdlcServerClient.currentUserUrl);
95
+ this.applicationStore.setBlockingAlert({
96
+ message: 'Waiting for the developer to authenticate using SDLC server',
97
+ prompt: 'Please manually reload the application after authentication',
98
+ });
99
+ },
100
+ },
101
+ ],
102
+ });
103
+ }
104
+ else {
105
+ this.applicationStore.log.error(LogEvent.create(APPLICATION_EVENT.APPLICATION_SETUP_FAILURE), error);
106
+ this.applicationStore.notifyError(error);
107
+ }
108
+ }
109
+ }
110
+ *fetchCurrentUser() {
111
+ try {
112
+ const currentUser = User.serialization.fromJson((yield this.sdlcServerClient.getCurrentUser()));
113
+ this.sdlcServerClient.setCurrentUser(currentUser);
114
+ }
115
+ catch (error) {
116
+ assertErrorThrown(error);
117
+ this.applicationStore.log.error(LogEvent.create(APPLICATION_EVENT.APPLICATION_SETUP_FAILURE), error);
118
+ this.applicationStore.notifyWarning(error.message);
119
+ }
120
+ }
121
+ get needsToAcceptSDLCServerTermsOfServices() {
122
+ return Boolean(this.SDLCServerTermsOfServicesUrlsToView.length);
123
+ }
124
+ dismissSDLCServerTermsOfServicesAlert() {
125
+ this.SDLCServerTermsOfServicesUrlsToView = [];
126
+ }
127
+ }
128
+ //# sourceMappingURL=LegendApplicationSDLCSetupState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LegendApplicationSDLC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gB,CAAC,GAAG,CAAC,KAAK,CAC7B,QAAQ,CAAC,MAAM,CAAC,iBAAiB,CAAC,yBAAyB,CAAC,EAC5D,KAAK,CACN,CAAC;YACF,IAAI,CAAC,gBAAgB,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;SACpD;IACH,CAAC;IAED,IAAI,sCAAsC;QACxC,OAAO,OAAO,CAAC,IAAI,CAAC,mCAAmC,CAAC,MAAM,CAAC,CAAC;IAClE,CAAC;IAED,qCAAqC;QACnC,IAAI,CAAC,mCAAmC,GAAG,EAAE,CAAC;IAChD,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finos/legend-application",
3
- "version": "7.1.0",
3
+ "version": "7.1.1",
4
4
  "description": "Legend application core",
5
5
  "keywords": [
6
6
  "legend",
@@ -43,9 +43,10 @@
43
43
  "test:watch": "jest --watch"
44
44
  },
45
45
  "dependencies": {
46
- "@finos/legend-art": "3.0.0",
47
- "@finos/legend-graph": "14.0.0",
48
- "@finos/legend-shared": "6.0.0",
46
+ "@finos/legend-art": "3.0.1",
47
+ "@finos/legend-graph": "14.0.1",
48
+ "@finos/legend-server-sdlc": "4.0.8",
49
+ "@finos/legend-shared": "6.0.1",
49
50
  "@types/css-font-loading-module": "0.0.7",
50
51
  "@types/papaparse": "5.3.3",
51
52
  "@types/react": "18.0.17",
@@ -66,7 +67,7 @@
66
67
  "sql-formatter": "9.2.0"
67
68
  },
68
69
  "devDependencies": {
69
- "@finos/legend-dev-utils": "2.0.10",
70
+ "@finos/legend-dev-utils": "2.0.11",
70
71
  "@jest/globals": "28.1.3",
71
72
  "cross-env": "7.0.3",
72
73
  "eslint": "8.22.0",
package/src/index.ts CHANGED
@@ -40,6 +40,7 @@ export * from './stores/ApplicationNavigationContextService.js';
40
40
  export * from './stores/LegendApplicationPlugin.js';
41
41
 
42
42
  export * from './stores/ApplicationStoreTestUtils.js';
43
+ export * from './stores/LegendApplicationSDLCSetupState.js';
43
44
 
44
45
  // ------------------------------------------- Shared components -------------------------------------------
45
46
 
@@ -0,0 +1,175 @@
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 { SDLCServerClient, User } from '@finos/legend-server-sdlc';
18
+ import {
19
+ type GeneratorFn,
20
+ assertErrorThrown,
21
+ HttpStatus,
22
+ LogEvent,
23
+ NetworkClientError,
24
+ type PlainObject,
25
+ } from '@finos/legend-shared';
26
+ import {
27
+ action,
28
+ computed,
29
+ flow,
30
+ flowResult,
31
+ makeObservable,
32
+ observable,
33
+ } from 'mobx';
34
+ import { APPLICATION_EVENT } from './ApplicationEvent.js';
35
+ import {
36
+ type GenericLegendApplicationStore,
37
+ ActionAlertActionType,
38
+ ActionAlertType,
39
+ } from './ApplicationStore.js';
40
+
41
+ export class LegendApplicationSDLCSetupState {
42
+ applicationStore: GenericLegendApplicationStore;
43
+ sdlcServerClient: SDLCServerClient;
44
+ isSDLCAuthorized = false;
45
+ SDLCServerTermsOfServicesUrlsToView: string[] = [];
46
+
47
+ constructor(
48
+ applicationStore: GenericLegendApplicationStore,
49
+ sdlcServerClient: SDLCServerClient,
50
+ ) {
51
+ makeObservable(this, {
52
+ isSDLCAuthorized: observable,
53
+ SDLCServerTermsOfServicesUrlsToView: observable,
54
+ dismissSDLCServerTermsOfServicesAlert: action,
55
+ needsToAcceptSDLCServerTermsOfServices: computed,
56
+ initializeSDLCServerClient: flow,
57
+ fetchCurrentUser: flow,
58
+ });
59
+ this.applicationStore = applicationStore;
60
+ this.sdlcServerClient = sdlcServerClient;
61
+ }
62
+
63
+ *initializeSDLCServerClient(): GeneratorFn<void> {
64
+ try {
65
+ this.isSDLCAuthorized =
66
+ (yield this.sdlcServerClient.isAuthorized()) as boolean;
67
+ if (!this.isSDLCAuthorized) {
68
+ this.applicationStore.navigator.jumpTo(
69
+ SDLCServerClient.authorizeCallbackUrl(
70
+ this.sdlcServerClient.baseUrl ?? '',
71
+ this.applicationStore.navigator.getCurrentLocation(),
72
+ ),
73
+ );
74
+ } else {
75
+ // Only proceed intialization after passing authorization check
76
+
77
+ // check terms of service agreement status
78
+ this.SDLCServerTermsOfServicesUrlsToView =
79
+ (yield this.sdlcServerClient.hasAcceptedTermsOfService()) as string[];
80
+ if (this.SDLCServerTermsOfServicesUrlsToView.length) {
81
+ this.applicationStore.setActionAlertInfo({
82
+ message: `Please read and accept the SDLC servers' terms of service`,
83
+ prompt: `Click 'Done' when you have accepted all the terms`,
84
+ type: ActionAlertType.CAUTION,
85
+ actions: [
86
+ {
87
+ label: 'See terms of services',
88
+ default: true,
89
+ handler: (): void =>
90
+ this.SDLCServerTermsOfServicesUrlsToView.forEach((url) =>
91
+ this.applicationStore.navigator.openNewWindow(url),
92
+ ),
93
+ type: ActionAlertActionType.PROCEED,
94
+ },
95
+ {
96
+ label: 'Done',
97
+ type: ActionAlertActionType.PROCEED_WITH_CAUTION,
98
+ handler: (): void => {
99
+ this.dismissSDLCServerTermsOfServicesAlert();
100
+ this.applicationStore.navigator.reload();
101
+ },
102
+ },
103
+ ],
104
+ });
105
+ }
106
+
107
+ // fetch server features config + current user
108
+ yield this.sdlcServerClient.fetchServerFeaturesConfiguration();
109
+ yield flowResult(this.fetchCurrentUser());
110
+ }
111
+ } catch (error) {
112
+ assertErrorThrown(error);
113
+ if (
114
+ // eslint-disable-next-line no-process-env
115
+ process.env.NODE_ENV === 'development' &&
116
+ error instanceof NetworkClientError &&
117
+ error.response.status === HttpStatus.UNAUTHORIZED
118
+ ) {
119
+ this.applicationStore.setActionAlertInfo({
120
+ message:
121
+ 'The first time the application starts in development mode, the developer would need to authenticate using SDLC server. Please do so then manually reload the app',
122
+ type: ActionAlertType.STANDARD,
123
+ actions: [
124
+ {
125
+ label: 'Authenticate using SDLC',
126
+ type: ActionAlertActionType.PROCEED,
127
+ default: true,
128
+ handler: (): void => {
129
+ this.applicationStore.navigator.openNewWindow(
130
+ this.sdlcServerClient.currentUserUrl,
131
+ );
132
+ this.applicationStore.setBlockingAlert({
133
+ message:
134
+ 'Waiting for the developer to authenticate using SDLC server',
135
+ prompt:
136
+ 'Please manually reload the application after authentication',
137
+ });
138
+ },
139
+ },
140
+ ],
141
+ });
142
+ } else {
143
+ this.applicationStore.log.error(
144
+ LogEvent.create(APPLICATION_EVENT.APPLICATION_SETUP_FAILURE),
145
+ error,
146
+ );
147
+ this.applicationStore.notifyError(error);
148
+ }
149
+ }
150
+ }
151
+
152
+ *fetchCurrentUser(): GeneratorFn<void> {
153
+ try {
154
+ const currentUser = User.serialization.fromJson(
155
+ (yield this.sdlcServerClient.getCurrentUser()) as PlainObject<User>,
156
+ );
157
+ this.sdlcServerClient.setCurrentUser(currentUser);
158
+ } catch (error) {
159
+ assertErrorThrown(error);
160
+ this.applicationStore.log.error(
161
+ LogEvent.create(APPLICATION_EVENT.APPLICATION_SETUP_FAILURE),
162
+ error,
163
+ );
164
+ this.applicationStore.notifyWarning(error.message);
165
+ }
166
+ }
167
+
168
+ get needsToAcceptSDLCServerTermsOfServices(): boolean {
169
+ return Boolean(this.SDLCServerTermsOfServicesUrlsToView.length);
170
+ }
171
+
172
+ dismissSDLCServerTermsOfServicesAlert(): void {
173
+ this.SDLCServerTermsOfServicesUrlsToView = [];
174
+ }
175
+ }
package/tsconfig.json CHANGED
@@ -41,6 +41,7 @@
41
41
  "./src/stores/DocumentationService.ts",
42
42
  "./src/stores/EventService.ts",
43
43
  "./src/stores/LegendApplicationPlugin.ts",
44
+ "./src/stores/LegendApplicationSDLCSetupState.ts",
44
45
  "./src/stores/PureLanguageSupport.ts",
45
46
  "./src/stores/WebApplicationNavigator.ts",
46
47
  "./src/stores/shared/ExecutionPlanState.ts",