@lcap/nasl 2.22.0-beta.5 → 3.0.0-beta.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/README.md +13 -0
- package/docs/classes/Module.html +15 -15
- package/docs/classes/Namespace.html +15 -15
- package/docs/classes/ViewComponent.html +19 -19
- package/out/automate/engine/utils.js +4 -0
- package/out/automate/engine/utils.js.map +1 -1
- package/out/breakpoint/generator/AfterStartNode.d.ts +7 -0
- package/out/breakpoint/generator/AfterStartNode.js +27 -0
- package/out/breakpoint/generator/AfterStartNode.js.map +1 -0
- package/out/breakpoint/generator/BeforeEndNode.d.ts +7 -0
- package/out/breakpoint/generator/BeforeEndNode.js +27 -0
- package/out/breakpoint/generator/BeforeEndNode.js.map +1 -0
- package/out/breakpoint/generator/BreakpointNode.d.ts +14 -0
- package/out/breakpoint/generator/BreakpointNode.js +166 -0
- package/out/breakpoint/generator/BreakpointNode.js.map +1 -0
- package/out/breakpoint/generator/index.d.ts +4 -0
- package/out/breakpoint/generator/index.js +98 -0
- package/out/breakpoint/generator/index.js.map +1 -0
- package/out/breakpoint/index.d.ts +3 -0
- package/out/breakpoint/index.js +20 -0
- package/out/breakpoint/index.js.map +1 -0
- package/out/breakpoint/shared/constants.d.ts +30 -0
- package/out/breakpoint/shared/constants.js +87 -0
- package/out/breakpoint/shared/constants.js.map +1 -0
- package/out/breakpoint/shared/index.d.ts +3 -0
- package/out/breakpoint/shared/index.js +33 -0
- package/out/breakpoint/shared/index.js.map +1 -0
- package/out/breakpoint/shared/operations.d.ts +10 -0
- package/out/breakpoint/shared/operations.js +25 -0
- package/out/breakpoint/shared/operations.js.map +1 -0
- package/out/breakpoint/shared/socket.d.ts +47 -0
- package/out/breakpoint/shared/socket.js +210 -0
- package/out/breakpoint/shared/socket.js.map +1 -0
- package/out/breakpoint/shared/utils.d.ts +20 -0
- package/out/breakpoint/shared/utils.js +133 -0
- package/out/breakpoint/shared/utils.js.map +1 -0
- package/out/breakpoint/store/core.d.ts +30 -0
- package/out/breakpoint/store/core.js +341 -0
- package/out/breakpoint/store/core.js.map +1 -0
- package/out/breakpoint/store/dock.d.ts +1 -0
- package/out/breakpoint/store/dock.js +127 -0
- package/out/breakpoint/store/dock.js.map +1 -0
- package/out/breakpoint/store/index.d.ts +2 -0
- package/out/breakpoint/store/index.js +19 -0
- package/out/breakpoint/store/index.js.map +1 -0
- package/out/common/BaseNode.d.ts +8 -0
- package/out/common/BaseNode.js +19 -0
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/App__.d.ts +365 -16
- package/out/concepts/App__.js +431 -10
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Assignment__.js +1 -1
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/AuthInterface__.d.ts +37 -0
- package/out/concepts/AuthInterface__.js +141 -0
- package/out/concepts/AuthInterface__.js.map +1 -0
- package/out/concepts/AuthLogicForCallInterface__.d.ts +138 -0
- package/out/concepts/AuthLogicForCallInterface__.js +493 -0
- package/out/concepts/AuthLogicForCallInterface__.js.map +1 -0
- package/out/concepts/AuthLogic__.d.ts +66 -0
- package/out/concepts/AuthLogic__.js +206 -0
- package/out/concepts/AuthLogic__.js.map +1 -0
- package/out/concepts/BackendVariable__.d.ts +137 -0
- package/out/concepts/BackendVariable__.js +422 -0
- package/out/concepts/BackendVariable__.js.map +1 -0
- package/out/concepts/Backend__.d.ts +134 -0
- package/out/concepts/Backend__.js +274 -0
- package/out/concepts/Backend__.js.map +1 -0
- package/out/concepts/BindAttribute__.d.ts +1 -1
- package/out/concepts/BindAttribute__.js +3 -1
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindEvent__.d.ts +12 -0
- package/out/concepts/BindEvent__.js +68 -0
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/CallAuthInterface__.d.ts +126 -0
- package/out/concepts/CallAuthInterface__.js +408 -0
- package/out/concepts/CallAuthInterface__.js.map +1 -0
- package/out/concepts/CallInterface__.d.ts +6 -1
- package/out/concepts/CallInterface__.js +9 -1
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.js +3 -1
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.js +9 -7
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Destination__.js +1 -1
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.js +29 -2
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +1 -2
- package/out/concepts/Entity__.js +1 -31
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/ForEachStatement__.js +9 -4
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/FrontendLibrary__.d.ts +29 -29
- package/out/concepts/FrontendLibrary__.js +2 -2
- package/out/concepts/FrontendVariable__.d.ts +21 -0
- package/out/concepts/FrontendVariable__.js +64 -0
- package/out/concepts/FrontendVariable__.js.map +1 -0
- package/out/concepts/Frontend__.d.ts +151 -47
- package/out/concepts/Frontend__.js +188 -32
- package/out/concepts/Frontend__.js.map +1 -1
- package/out/concepts/Function__.js +1 -1
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.js +1 -1
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/Interface__.d.ts +1 -1
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/LogicItem__.d.ts +18 -3
- package/out/concepts/LogicItem__.js +22 -4
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +14 -9
- package/out/concepts/Logic__.js +43 -5
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/Namespace__.d.ts +29 -29
- package/out/concepts/Namespace__.js +2 -2
- package/out/concepts/NewComposite__.js +2 -2
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/OverriddenLogic__.d.ts +643 -0
- package/out/concepts/OverriddenLogic__.js +1602 -0
- package/out/concepts/OverriddenLogic__.js.map +1 -0
- package/out/concepts/Param__.d.ts +6 -0
- package/out/concepts/Param__.js +10 -0
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/QueryFieldExpression__.d.ts +2 -0
- package/out/concepts/QueryFieldExpression__.js +9 -0
- package/out/concepts/QueryFieldExpression__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.d.ts +2 -2
- package/out/concepts/QuerySelectExpression__.js +2 -2
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.js +6 -6
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/Variable__.d.ts +10 -0
- package/out/concepts/Variable__.js +12 -0
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewComponent__.d.ts +33 -33
- package/out/concepts/ViewComponent__.js +7 -7
- package/out/concepts/ViewElement__.d.ts +6 -0
- package/out/concepts/ViewElement__.js +104 -1
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.js +2 -2
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/basics/stdlib/index.js +2 -1
- package/out/concepts/basics/stdlib/index.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.auth.js +24 -0
- package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.http.d.ts +7 -0
- package/out/concepts/basics/stdlib/nasl.http.js +167 -0
- package/out/concepts/basics/stdlib/nasl.http.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.process.js +68 -0
- package/out/concepts/basics/stdlib/nasl.process.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.ui.js +4 -19
- package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.util.js +83 -17
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/concepts/basics/types/index.d.ts +1 -0
- package/out/concepts/basics/types/index.js +4 -1
- package/out/concepts/basics/types/index.js.map +1 -1
- package/out/concepts/index__.d.ts +8 -0
- package/out/concepts/index__.js +8 -0
- package/out/concepts/index__.js.map +1 -1
- package/out/enums/KEYWORDS.js +0 -1
- package/out/enums/KEYWORDS.js.map +1 -1
- package/out/generator/genBundleFiles.d.ts +1 -0
- package/out/generator/genBundleFiles.js +27 -0
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genMetaData.d.ts +4 -1
- package/out/generator/genMetaData.js +14 -0
- package/out/generator/genMetaData.js.map +1 -1
- package/out/generator/genReleaseBody.d.ts +2 -1
- package/out/generator/genReleaseBody.js +2 -1
- package/out/generator/genReleaseBody.js.map +1 -1
- package/out/index.d.ts +2 -1
- package/out/index.js +3 -1
- package/out/index.js.map +1 -1
- package/out/server/extendBaseNode.js +16 -4
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/formatTsUtils.d.ts +2 -1
- package/out/server/formatTsUtils.js +39 -4
- package/out/server/formatTsUtils.js.map +1 -1
- package/out/server/getExtensionModules.d.ts +2 -2
- package/out/server/getExtensionModules.js +16 -2
- package/out/server/getExtensionModules.js.map +1 -1
- package/out/server/getLogics.js +5 -5
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.d.ts +1 -0
- package/out/server/getMemberIdentifier.js +34 -7
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/naslServer.d.ts +64 -64
- package/out/server/naslServer.js +249 -121
- package/out/server/naslServer.js.map +1 -1
- package/out/server/naslStdlibMap.js +2 -0
- package/out/server/naslStdlibMap.js.map +1 -1
- package/out/server/translator.d.ts +1 -0
- package/out/server/translator.js +67 -2
- package/out/server/translator.js.map +1 -1
- package/out/service/defaultErrorMessage.json +1 -0
- package/out/service/storage/api.d.ts +10 -1
- package/out/service/storage/api.js +6 -0
- package/out/service/storage/api.js.map +1 -1
- package/out/service/storage/init.d.ts +4 -0
- package/out/service/storage/init.js +55 -35
- package/out/service/storage/init.js.map +1 -1
- package/out/service/storage/service.d.ts +3 -0
- package/out/service/storage/service.js +14 -0
- package/out/service/storage/service.js.map +1 -1
- package/out/utils/sortTsString.d.ts +1 -0
- package/out/utils/sortTsString.js +36 -0
- package/out/utils/sortTsString.js.map +1 -0
- package/out/utils/traverse.js +2 -2
- package/out/utils/traverse.js.map +1 -1
- package/package.json +7 -2
- package/sandbox/stdlib/nasl.auth.ts +8 -4
- package/sandbox/stdlib/nasl.core.d.ts +206 -0
- package/sandbox/stdlib/nasl.core.js +1 -0
- package/sandbox/stdlib/nasl.core.js.map +1 -0
- package/sandbox/stdlib/nasl.http.ts +35 -0
- package/sandbox/stdlib/nasl.process.ts +13 -0
- package/sandbox/stdlib/nasl.ui.ts +0 -5
- package/src/automate/engine/utils.js +4 -1
- package/src/breakpoint/generator/AfterStartNode.ts +27 -0
- package/src/breakpoint/generator/BeforeEndNode.ts +27 -0
- package/src/breakpoint/generator/BreakpointNode.ts +228 -0
- package/src/breakpoint/generator/index.ts +114 -0
- package/src/breakpoint/index.ts +3 -0
- package/src/breakpoint/shared/constants.ts +95 -0
- package/src/breakpoint/shared/index.ts +3 -0
- package/src/breakpoint/shared/operations.ts +25 -0
- package/src/breakpoint/shared/socket.ts +326 -0
- package/src/breakpoint/shared/utils.ts +195 -0
- package/src/breakpoint/store/core.ts +411 -0
- package/src/breakpoint/store/dock.ts +166 -0
- package/src/breakpoint/store/index.ts +2 -0
- package/src/breakpoint/types/index.d.ts +19 -0
- package/src/common/BaseNode.ts +19 -1
- package/src/concepts/App__.ts +828 -26
- package/src/concepts/Assignment__.ts +1 -1
- package/src/concepts/AuthInterface__.ts +148 -0
- package/src/concepts/AuthLogicForCallInterface__.ts +573 -0
- package/src/concepts/AuthLogic__.ts +225 -0
- package/src/concepts/BackendVariable__.ts +466 -0
- package/src/concepts/Backend__.ts +347 -0
- package/src/concepts/BindAttribute__.ts +4 -3
- package/src/concepts/BindEvent__.ts +71 -2
- package/src/concepts/CallAuthInterface__.ts +490 -0
- package/src/concepts/CallInterface__.ts +10 -2
- package/src/concepts/CallLogic__.ts +3 -1
- package/src/concepts/CallQueryComponent__.ts +67 -7
- package/src/concepts/Destination__.ts +19 -1
- package/src/concepts/End__.ts +31 -3
- package/src/concepts/EntityProperty__.ts +6 -0
- package/src/concepts/Entity__.ts +8 -31
- package/src/concepts/ForEachStatement__.ts +9 -4
- package/src/concepts/FrontendLibrary__.ts +30 -30
- package/src/concepts/FrontendVariable__.ts +76 -0
- package/src/concepts/Frontend__.ts +352 -89
- package/src/concepts/Function__.ts +1 -1
- package/src/concepts/Identifier__.ts +5 -5
- package/src/concepts/Interface__.ts +1 -1
- package/src/concepts/LogicItem__.ts +26 -6
- package/src/concepts/Logic__.ts +86 -8
- package/src/concepts/Module__.ts +32 -2
- package/src/concepts/Namespace__.ts +30 -30
- package/src/concepts/NewComposite__.ts +2 -3
- package/src/concepts/OverriddenLogic__.ts +2165 -0
- package/src/concepts/Param__.ts +13 -3
- package/src/concepts/QueryFieldExpression__.ts +18 -0
- package/src/concepts/QuerySelectExpression__.ts +11 -3
- package/src/concepts/TypeAnnotation__.ts +45 -6
- package/src/concepts/Variable__.ts +14 -0
- package/src/concepts/ViewComponent__.ts +35 -35
- package/src/concepts/ViewElement__.ts +104 -1
- package/src/concepts/View__.ts +24 -2
- package/src/concepts/basics/stdlib/index.ts +2 -1
- package/src/concepts/basics/stdlib/nasl.auth.ts +24 -0
- package/src/concepts/basics/stdlib/nasl.http.ts +166 -0
- package/src/concepts/basics/stdlib/nasl.process.ts +68 -0
- package/src/concepts/basics/stdlib/nasl.ui.ts +4 -19
- package/src/concepts/basics/stdlib/nasl.util.ts +83 -17
- package/src/concepts/basics/types/index.ts +5 -4
- package/src/concepts/index__.ts +8 -0
- package/src/enums/KEYWORDS.ts +0 -1
- package/src/generator/genBundleFiles.ts +36 -2
- package/src/generator/genMetaData.ts +16 -1
- package/src/generator/genReleaseBody.ts +4 -1
- package/src/index.ts +2 -1
- package/src/server/extendBaseNode.ts +18 -7
- package/src/server/formatTsUtils.ts +37 -5
- package/src/server/getExtensionModules.ts +18 -3
- package/src/server/getLogics.ts +6 -6
- package/src/server/getMemberIdentifier.ts +35 -9
- package/src/server/naslServer.ts +250 -124
- package/src/server/naslStdlibMap.ts +2 -0
- package/src/server/translator.ts +67 -1
- package/src/service/defaultErrorMessage.json +1 -0
- package/src/service/storage/api.js +7 -1
- package/src/service/storage/init.ts +66 -35
- package/src/service/storage/service.ts +18 -2
- package/src/utils/sortTsString.ts +32 -0
- package/src/utils/traverse.ts +2 -2
- package/test/examples/app-simple.json +73635 -0
- package/ts-worker/lib/tsserver.js +3 -3
- package/ts-worker/package.json +1 -1
package/src/concepts/index__.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './App__';
|
|
|
2
2
|
export * from './Module__';
|
|
3
3
|
export * from './Namespace__';
|
|
4
4
|
export * from './Frontend__';
|
|
5
|
+
export * from './Backend__';
|
|
5
6
|
export * from './Integration__';
|
|
6
7
|
export * from './MicroApp__';
|
|
7
8
|
export * from './TypeAnnotation__';
|
|
@@ -28,9 +29,14 @@ export * from './Event__';
|
|
|
28
29
|
export * from './Slot__';
|
|
29
30
|
export * from './Theme__';
|
|
30
31
|
export * from './Logic__';
|
|
32
|
+
export * from './AuthLogic__';
|
|
33
|
+
export * from './AuthLogicForCallInterface__';
|
|
34
|
+
export * from './OverriddenLogic__';
|
|
31
35
|
export * from './Param__';
|
|
32
36
|
export * from './Return__';
|
|
33
37
|
export * from './Variable__';
|
|
38
|
+
export * from './BackendVariable__';
|
|
39
|
+
export * from './FrontendVariable__';
|
|
34
40
|
export * from './Constant__';
|
|
35
41
|
export * from './LogicItem__';
|
|
36
42
|
export * from './Function__';
|
|
@@ -105,3 +111,5 @@ export * from './SelectMembers__';
|
|
|
105
111
|
export * from './AssignmentLine__';
|
|
106
112
|
export * from './FrontendLibrary__';
|
|
107
113
|
export * from './ViewBlock__';
|
|
114
|
+
export * from './AuthInterface__';
|
|
115
|
+
export * from './CallAuthInterface__';
|
package/src/enums/KEYWORDS.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { genBreakpoints, clearBreakpoints } from '../breakpoint';
|
|
2
|
+
|
|
1
3
|
import { App, Module, View, Frontend } from '../concepts';
|
|
2
4
|
import * as utils from '../utils';
|
|
3
5
|
import { genHash, RawOptions } from '.';
|
|
@@ -18,6 +20,7 @@ export interface Route {
|
|
|
18
20
|
interface Config {
|
|
19
21
|
tenant: string;
|
|
20
22
|
env: string;
|
|
23
|
+
debug: boolean;
|
|
21
24
|
nuimsDomain: string;
|
|
22
25
|
STATIC_URL: string;
|
|
23
26
|
USER_STATIC_URL: string;
|
|
@@ -48,6 +51,9 @@ export function genBundleFiles(app: App, frontend: Frontend,
|
|
|
48
51
|
const componentMap: {
|
|
49
52
|
[name: string]: RawOptions;
|
|
50
53
|
} = {};
|
|
54
|
+
|
|
55
|
+
config?.debug && genBreakpoints(app);
|
|
56
|
+
|
|
51
57
|
utils.traverse((current) => {
|
|
52
58
|
if (current.node.toVueOptions)
|
|
53
59
|
componentMap[current.node.id] = current.node.toVueOptions();
|
|
@@ -57,6 +63,8 @@ export function genBundleFiles(app: App, frontend: Frontend,
|
|
|
57
63
|
} as View,
|
|
58
64
|
});
|
|
59
65
|
|
|
66
|
+
config?.debug && clearBreakpoints(app);
|
|
67
|
+
|
|
60
68
|
/**
|
|
61
69
|
* vue.config.js page options
|
|
62
70
|
*/
|
|
@@ -206,6 +214,7 @@ export function genBundleFiles(app: App, frontend: Frontend,
|
|
|
206
214
|
|
|
207
215
|
const platformConfig = JSON5.stringify({
|
|
208
216
|
appConfig: {
|
|
217
|
+
id: app.id,
|
|
209
218
|
project: app.name,
|
|
210
219
|
domainName: app.name,
|
|
211
220
|
nuimsDomain: fnNuimsDomain,
|
|
@@ -263,6 +272,27 @@ export function genBundleFiles(app: App, frontend: Frontend,
|
|
|
263
272
|
}`;
|
|
264
273
|
}
|
|
265
274
|
|
|
275
|
+
if (frontend.globalScaleEnabled) {
|
|
276
|
+
content += `{
|
|
277
|
+
const body = document.body;
|
|
278
|
+
const rootElement = document.documentElement;
|
|
279
|
+
|
|
280
|
+
function scalePage() {
|
|
281
|
+
const windowWidth = window.innerWidth;
|
|
282
|
+
const baseWidth = ${frontend.canvasWidth};
|
|
283
|
+
const scale = windowWidth / baseWidth;
|
|
284
|
+
body.style.transform = \`scale(\${scale})\`;
|
|
285
|
+
body.style.transformOrigin = '0 0';
|
|
286
|
+
body.style.width = baseWidth + 'px';
|
|
287
|
+
rootElement.style.height = '100vh';
|
|
288
|
+
rootElement.style.overflow = 'auto';
|
|
289
|
+
rootElement.style.setProperty('--scrollbar-size', 0);
|
|
290
|
+
}
|
|
291
|
+
window.addEventListener('resize', scalePage);
|
|
292
|
+
scalePage()
|
|
293
|
+
}`;
|
|
294
|
+
}
|
|
295
|
+
|
|
266
296
|
content += `
|
|
267
297
|
var customNames = ${customNames};
|
|
268
298
|
for(var i=0;i<customNames.length;i++){
|
|
@@ -375,9 +405,13 @@ export function genBundleFiles(app: App, frontend: Frontend,
|
|
|
375
405
|
bundleMinPath = `${baseUrl}${frontend.basePath}/bundle.${genHash(content)}.min.js`;
|
|
376
406
|
}
|
|
377
407
|
const otherJsList = (frontend as any)?.appletsConfig?.enable ? ['//res.wx.qq.com/open/js/jweixin-1.3.2.js'] : [];
|
|
378
|
-
|
|
408
|
+
|
|
379
409
|
const microAppIntegration = integrateMicroApp(frontend);
|
|
380
|
-
|
|
410
|
+
|
|
411
|
+
if (config?.debug) {
|
|
412
|
+
otherJsList.push(`${config.STATIC_URL}/packages/@lcap/breakpoint-client@1.0.0/dist/index.js?time=${Date.now()}`);
|
|
413
|
+
}
|
|
414
|
+
|
|
381
415
|
const assetsContent = `(function() {
|
|
382
416
|
const loadAssets = () => {
|
|
383
417
|
LazyLoad.js(${JSON5.stringify(assetsInfo.basic.js.concat(assetsInfo.custom.js, otherJsList).concat([bundleMinPath]))});
|
|
@@ -94,11 +94,15 @@ export function genMetaData(app: App, frontend: Frontend) {
|
|
|
94
94
|
[id: string]: BaseNode;
|
|
95
95
|
} = {};
|
|
96
96
|
const frontendVariables = frontend.variables;
|
|
97
|
+
const frontendEvents = frontend.bindEvents;
|
|
98
|
+
const frontendEventsMap: { [id: string]: string } = {};
|
|
99
|
+
|
|
97
100
|
const enumsMap: {
|
|
98
101
|
[name: string]: {
|
|
99
102
|
[label: string]: string;
|
|
100
103
|
};
|
|
101
104
|
} = {};
|
|
105
|
+
|
|
102
106
|
const logicsMap: {
|
|
103
107
|
[id: string]: {
|
|
104
108
|
config: {
|
|
@@ -243,6 +247,12 @@ export function genMetaData(app: App, frontend: Frontend) {
|
|
|
243
247
|
collectTypeAnnotation(typeAnnotation);
|
|
244
248
|
});
|
|
245
249
|
}
|
|
250
|
+
if (Array.isArray(frontendEvents)) {
|
|
251
|
+
frontendEvents.forEach((item) => {
|
|
252
|
+
const typeAnnotation = (item as any)?.typeAnnotation || item.__TypeAnnotation;
|
|
253
|
+
collectTypeAnnotation(typeAnnotation);
|
|
254
|
+
});
|
|
255
|
+
}
|
|
246
256
|
|
|
247
257
|
function collectTypeAnnotation(typeAnnotation: any) {
|
|
248
258
|
if (typeAnnotation) {
|
|
@@ -263,8 +273,13 @@ export function genMetaData(app: App, frontend: Frontend) {
|
|
|
263
273
|
}
|
|
264
274
|
}
|
|
265
275
|
}
|
|
266
|
-
|
|
276
|
+
frontendEvents.forEach((logic) => {
|
|
277
|
+
const name = logic.getViewEventName();
|
|
278
|
+
const fn = (logic as any).toFunction();
|
|
279
|
+
frontendEventsMap[name] = fn;
|
|
280
|
+
});
|
|
267
281
|
return {
|
|
282
|
+
frontendEvents: frontendEventsMap,
|
|
268
283
|
frontendVariables,
|
|
269
284
|
dataTypesMap,
|
|
270
285
|
enumsMap,
|
|
@@ -5,14 +5,16 @@ import * as utils from '../utils';
|
|
|
5
5
|
|
|
6
6
|
export async function genReleaseBody(app: App, {
|
|
7
7
|
env,
|
|
8
|
+
debug,
|
|
8
9
|
replicas,
|
|
9
10
|
realRelease,
|
|
10
11
|
appInfo,
|
|
11
12
|
staticUrl,
|
|
12
13
|
frontends = [],
|
|
13
|
-
logPublishFunc = () => {},
|
|
14
|
+
logPublishFunc = () => { },
|
|
14
15
|
}: {
|
|
15
16
|
env: string,
|
|
17
|
+
debug: boolean,
|
|
16
18
|
replicas: number,
|
|
17
19
|
realRelease: boolean,
|
|
18
20
|
appInfo: {
|
|
@@ -79,6 +81,7 @@ export async function genReleaseBody(app: App, {
|
|
|
79
81
|
logPublishFunc(`[代码] "[${app.title}]" 生成页面代码:开始`);
|
|
80
82
|
files = genFrontendBundleFiles(app, frontends, Object.assign({}, appInfo, {
|
|
81
83
|
env,
|
|
84
|
+
debug,
|
|
82
85
|
appid: app.id,
|
|
83
86
|
devDnsAddr: (app as any).devDnsAddr,
|
|
84
87
|
miniEnable: (app as any).miniEnable,
|
package/src/index.ts
CHANGED
|
@@ -8,7 +8,8 @@ export * as genBlock from './templator';
|
|
|
8
8
|
export * as utils from './utils';
|
|
9
9
|
export * from './config';
|
|
10
10
|
export * from './eventBus';
|
|
11
|
-
export
|
|
11
|
+
export * as breakpoint from './breakpoint';
|
|
12
|
+
export { loadApp, loadAppSync, handleApp, batchAction, batchQuery, mountDatabaseTypes } from './service/storage/init';
|
|
12
13
|
export { createService } from './service/creator';
|
|
13
14
|
export * from './manager/stepRecorder';
|
|
14
15
|
import './automate/engine';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FileNode, NaslServer } from './naslServer';
|
|
2
2
|
import * as tsProtocol from 'typescript/lib/protocol';
|
|
3
3
|
import { MinRange } from './translator';
|
|
4
|
-
import { BaseNode, CallLogic, Destination, EnumItem, Interface, Logic, Param, Process, Role, Structure, View, ViewElement, Frontend, TypeAnnotation, StructureProperty, App } from '../concepts';
|
|
4
|
+
import { BaseNode, CallLogic, Destination, EnumItem, Interface, Logic, Param, Process, Role, Structure, View, ViewElement, Frontend, TypeAnnotation, StructureProperty, App, AuthInterface, CallAuthInterface } from '../concepts';
|
|
5
5
|
import { EventPayload, invokeCommand, registerCommand } from '../common';
|
|
6
6
|
import { getNodeByNodeCallee, getNaslNodeByNodeCallee } from '../automate/engine/utils';
|
|
7
7
|
|
|
@@ -99,6 +99,9 @@ BaseNode.prototype.changeName = async function changeName(newValue: string, upda
|
|
|
99
99
|
* @returns 找到的引用
|
|
100
100
|
*/
|
|
101
101
|
const res = naslServer._renamePrepare(this, refsList, newValue);
|
|
102
|
+
// 针对外部接口的鉴权方式,sourceMap 定位仅仅 定位到 CallAuthInterfacer
|
|
103
|
+
// 因此这里需要保存this来做上下文判断
|
|
104
|
+
const _this = this;
|
|
102
105
|
if (res.length <= 1) {
|
|
103
106
|
if (this.concept === 'enumItem') {
|
|
104
107
|
(this as any).setValue(newValue);
|
|
@@ -118,7 +121,15 @@ BaseNode.prototype.changeName = async function changeName(newValue: string, upda
|
|
|
118
121
|
// 如果有指定的修改方法,就用那个,没有就修改名字
|
|
119
122
|
item.setTypeMethods ? itemNode[item.setTypeMethods](item.newValue) : itemNode.setName?.(item.newValue);
|
|
120
123
|
} else {
|
|
121
|
-
|
|
124
|
+
if (_this.concept === 'AuthLogicForCallInterface' && itemNode.concept === 'CallAuthInterface') {
|
|
125
|
+
const { calleewholeKey } = itemNode;
|
|
126
|
+
const targetItf: AuthInterface = getNodeByNodeCallee(App, calleewholeKey);
|
|
127
|
+
targetItf.setAuthLogic(newValue);
|
|
128
|
+
// FIXME
|
|
129
|
+
// itemNode
|
|
130
|
+
} else {
|
|
131
|
+
item.setTypeMethods ? itemNode[item.setTypeMethods](newValue) : itemNode.setName?.(newValue);
|
|
132
|
+
}
|
|
122
133
|
}
|
|
123
134
|
});
|
|
124
135
|
// 结束修改 ,批量操作
|
|
@@ -186,7 +197,7 @@ BaseNode.prototype.prepareDelete = async function prepareDelete() {
|
|
|
186
197
|
};
|
|
187
198
|
let callback = null;
|
|
188
199
|
if (refsList.length <= 1 || (node instanceof Param && node.parentNode instanceof Logic && refsList.length <= 2)) {
|
|
189
|
-
//
|
|
200
|
+
// 平台类型直接删除然后return
|
|
190
201
|
if (node instanceof ViewElement) {
|
|
191
202
|
this.delete();
|
|
192
203
|
return;
|
|
@@ -279,7 +290,7 @@ BaseNode.prototype.prepareDelete = async function prepareDelete() {
|
|
|
279
290
|
* 调用方是 调用逻辑或者跳转页面, 去删除对应位置的内容
|
|
280
291
|
* 如果是跳转页面,因为流程下的特殊翻译,需要过滤下 非页面下的参数修改,查找到页面跳转
|
|
281
292
|
*/
|
|
282
|
-
if (minRange.node instanceof CallLogic || (node.parentNode instanceof View && minRange.node instanceof Destination)) {
|
|
293
|
+
if (minRange.node instanceof CallLogic || (node.parentNode instanceof View && minRange.node instanceof Destination) || minRange.node instanceof CallAuthInterface) {
|
|
283
294
|
minRange.node.deleteCalleeArg(Index);
|
|
284
295
|
}
|
|
285
296
|
}
|
|
@@ -388,7 +399,7 @@ BaseNode.prototype.addParamsPrepare = async function addParamsPrepare(needAdd =
|
|
|
388
399
|
/**
|
|
389
400
|
* 在原型上增加方法来调用
|
|
390
401
|
*/
|
|
391
|
-
BaseNode.prototype.getCurrentTypeAnnotation = async function getCurrentTypeAnnotation(outTime
|
|
402
|
+
BaseNode.prototype.getCurrentTypeAnnotation = async function getCurrentTypeAnnotation(outTime?: number) {
|
|
392
403
|
try {
|
|
393
404
|
/**
|
|
394
405
|
* 查找这个节点是不是有依赖
|
|
@@ -418,7 +429,7 @@ BaseNode.prototype.getSelectRef = function getSelectRef(newTypeAnnotation: TypeA
|
|
|
418
429
|
const parentNode = this;
|
|
419
430
|
let completionChildren: any;
|
|
420
431
|
if (typeKind === 'reference') {
|
|
421
|
-
if (typeNamespace === 'nasl.ui' || typeNamespace === 'nasl.process' || typeNamespace === 'nasl.auth') {
|
|
432
|
+
if (typeNamespace === 'nasl.ui' || typeNamespace === 'nasl.process' || typeNamespace === 'nasl.auth' || typeNamespace === 'nasl.http') {
|
|
422
433
|
const node = newNode(getNaslNodeByNodeCallee(typeNamespace, typeName), parentNode, needNewStructure);
|
|
423
434
|
const properties = (node as Structure)?.properties || [];
|
|
424
435
|
completionChildren = properties;
|
|
@@ -459,4 +470,4 @@ BaseNode.prototype.getSelectRef = function getSelectRef(newTypeAnnotation: TypeA
|
|
|
459
470
|
} catch (err) {
|
|
460
471
|
console.log(err);
|
|
461
472
|
}
|
|
462
|
-
}
|
|
473
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseNode, Identifier, TypeAnnotation, StructureProperty, Entity, Structure, EntityProperty, Param, MemberExpression, CompletionProperty, Variable, Return, Logic, ConfigProperty, App } from '..';
|
|
1
|
+
import { BaseNode, Identifier, TypeAnnotation, StructureProperty, Entity, AuthLogic, BackendVariable, Structure, EntityProperty, Param, MemberExpression, CompletionProperty, Variable, Return, Logic, ConfigProperty, AuthLogicForCallInterface, App } from '..';
|
|
2
2
|
import { getNaslNodeByNodeCallee } from '../automate/engine/utils';
|
|
3
3
|
|
|
4
4
|
interface variableItem {
|
|
@@ -522,7 +522,7 @@ function getNodeTypeVariableData(nodeType: any, item: any, node: BaseNode) {
|
|
|
522
522
|
completionData.icon = getNodeiconFromLogic(completionData, node);
|
|
523
523
|
return completionData;
|
|
524
524
|
}
|
|
525
|
-
function recursionProperty(structureTypeAnnotation: TypeAnnotation, parentCompletion: CompletionProperty, node: BaseNode, typeKeyMap:
|
|
525
|
+
function recursionProperty(structureTypeAnnotation: TypeAnnotation, parentCompletion: CompletionProperty, node: BaseNode, typeKeyMap: Map<string, number>) {
|
|
526
526
|
const app = (node.rootNode) as App;
|
|
527
527
|
let structure;
|
|
528
528
|
if (structureTypeAnnotation.typeArguments) {
|
|
@@ -670,7 +670,7 @@ export function formatVariableData(data: unknown | variableItem[], node: BaseNod
|
|
|
670
670
|
|
|
671
671
|
// 从logic获取节点的icon
|
|
672
672
|
function getNodeiconFromLogic(completionProperty: CompletionProperty, node: BaseNode): string {
|
|
673
|
-
const logic = (node as Param).logic;
|
|
673
|
+
const logic = (node as Param).logic || (node as Param).AuthLogic || (node as Param).AuthLogicForCallInterface;
|
|
674
674
|
const view = (node as Param).view;
|
|
675
675
|
if (view) {
|
|
676
676
|
const { params } = view;
|
|
@@ -679,8 +679,19 @@ function getNodeiconFromLogic(completionProperty: CompletionProperty, node: Base
|
|
|
679
679
|
}
|
|
680
680
|
if (logic) {
|
|
681
681
|
const { params, returns } = logic;
|
|
682
|
-
if (
|
|
683
|
-
|
|
682
|
+
if (logic instanceof AuthLogicForCallInterface) {
|
|
683
|
+
const { authParams } = logic;
|
|
684
|
+
if (authParams.find((item) => item.name === completionProperty.name))
|
|
685
|
+
return 'api-auth-params';
|
|
686
|
+
if (params.find((item) => item.name === completionProperty.name))
|
|
687
|
+
return 'api-auth-params';
|
|
688
|
+
} else if (logic instanceof AuthLogic) {
|
|
689
|
+
if (params.find((item) => item.name === completionProperty.name))
|
|
690
|
+
return 'api-auth-params';
|
|
691
|
+
} else {
|
|
692
|
+
if (params.find((item) => item.name === completionProperty.name))
|
|
693
|
+
return 'param';
|
|
694
|
+
}
|
|
684
695
|
|
|
685
696
|
if (returns.find((item) => item.name === completionProperty.name))
|
|
686
697
|
return 'return';
|
|
@@ -731,7 +742,28 @@ function sortFirstVariableData(result: CompletionProperty[], node: BaseNode) {
|
|
|
731
742
|
newResult.push(...result);
|
|
732
743
|
return newResult;
|
|
733
744
|
}
|
|
745
|
+
export function formatBackendVariables(variables: Array<BackendVariable>) {
|
|
746
|
+
const result = variables.map((itemNode) => {
|
|
747
|
+
const namespace = itemNode.getNamespace();
|
|
748
|
+
const newItem: any = {
|
|
749
|
+
name: itemNode.name,
|
|
750
|
+
value: itemNode.name,
|
|
751
|
+
expression: new Identifier({
|
|
752
|
+
name: itemNode.name,
|
|
753
|
+
namespace,
|
|
754
|
+
}),
|
|
755
|
+
};
|
|
756
|
+
const noChildType = isNoChildType(itemNode.typeAnnotation.typeKey);
|
|
734
757
|
|
|
758
|
+
if (!noChildType) {
|
|
759
|
+
nextFindTypeChild(itemNode.typeAnnotation.typeKey, newItem, itemNode);
|
|
760
|
+
}
|
|
761
|
+
const completionProperty = new CompletionProperty(newItem);
|
|
762
|
+
completionProperty.icon = 'backendVariable';
|
|
763
|
+
return completionProperty;
|
|
764
|
+
});
|
|
765
|
+
return result;
|
|
766
|
+
}
|
|
735
767
|
export function formatFrontEndVariables(frontEndVariables: Array<Variable>) {
|
|
736
768
|
const result = frontEndVariables.map((itemNode) => {
|
|
737
769
|
const namespace = itemNode.getNamespace();
|
|
@@ -1,12 +1,27 @@
|
|
|
1
|
-
import { App, Module, Namespace } from '..';
|
|
1
|
+
import { App, Module, Namespace, OverriddenLogic, Logic } from '..';
|
|
2
2
|
export function getExtensionModules(app: App) {
|
|
3
3
|
return app.dependencies;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
export function moduleToLogicNamesapce(m: Module) {
|
|
6
|
+
export function moduleToLogicNamesapce(m: Module, overriddenLogics: Array<OverriddenLogic>) {
|
|
7
|
+
let logics = m.logics;
|
|
8
|
+
if (overriddenLogics?.length) {
|
|
9
|
+
const oLs = overriddenLogics?.length && overriddenLogics?.filter((ol) => ol.overriddenModule === m.name && !ol.getIsEmptyLogic) || [];
|
|
10
|
+
logics = m.logics.filter((l) => {
|
|
11
|
+
const ol = overriddenLogics?.length && overriddenLogics?.find((ol) => ol.overriddenModule === m.name && ol.name === l.name);
|
|
12
|
+
return !l.overridable || (l.overridable && ol && ol.getIsEmptyLogic);
|
|
13
|
+
});
|
|
14
|
+
if (oLs && oLs.length > 0) {
|
|
15
|
+
// 三种状态 1不可覆写 2可覆写未覆写 3 可覆写已覆写
|
|
16
|
+
// 此处展示 1 2 是原始接口 3 是覆写logic
|
|
17
|
+
// FIXME
|
|
18
|
+
logics = logics.concat(oLs as unknown as Array<Logic>);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
7
22
|
const ns = new Namespace({
|
|
8
23
|
name: m.name,
|
|
9
|
-
logics
|
|
24
|
+
logics,
|
|
10
25
|
});
|
|
11
26
|
ns.path = `app.${m.name}.logics`;
|
|
12
27
|
ns.expanded = true;
|
package/src/server/getLogics.ts
CHANGED
|
@@ -77,7 +77,7 @@ function javaLogicDataSourceLogics(logics: Logic[]) {
|
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
export async function getLogics(node: CallLogic | BindEvent| Identifier | Logic, needAllLogic: boolean = true) {
|
|
80
|
+
export async function getLogics(node: CallLogic | BindEvent | Identifier | Logic, needAllLogic: boolean = true) {
|
|
81
81
|
const app = node?.rootNode as App;
|
|
82
82
|
if (node.concept === 'CallLogic' || node.concept === 'BindEvent' || node.concept === 'Logic') {
|
|
83
83
|
const result = [];
|
|
@@ -105,7 +105,7 @@ export async function getLogics(node: CallLogic | BindEvent| Identifier | Logic,
|
|
|
105
105
|
return pItem;
|
|
106
106
|
});
|
|
107
107
|
const dependencies = app.dependencies;//.filter((d) => d.enable);
|
|
108
|
-
const extensions = dependencies.map(moduleToLogicNamesapce).filter((item) => item.logics && item.logics.length);
|
|
108
|
+
const extensions = app.dependencies.map((dep) => moduleToLogicNamesapce(dep, app.overriddenLogics)).filter((item) => item.logics && item.logics.length);
|
|
109
109
|
const dependEntityNs: Namespace[] = [];
|
|
110
110
|
dependencies.forEach((dep) => {
|
|
111
111
|
(dep.dataSources || []).forEach((dataSource) => {
|
|
@@ -124,7 +124,7 @@ export async function getLogics(node: CallLogic | BindEvent| Identifier | Logic,
|
|
|
124
124
|
const tree = new Namespace({
|
|
125
125
|
name: 'category',
|
|
126
126
|
path: `${app.getNamespace()}.logics`,
|
|
127
|
-
title: '
|
|
127
|
+
title: '服务端逻辑',
|
|
128
128
|
logics: javaLogicDataSourceLogics(app.logics).globalLogics,
|
|
129
129
|
children: [
|
|
130
130
|
...nc,
|
|
@@ -282,7 +282,7 @@ export async function getLogics(node: CallLogic | BindEvent| Identifier | Logic,
|
|
|
282
282
|
systemTree.children.forEach((child) => (child.expanded = false));
|
|
283
283
|
result.push(systemTree);
|
|
284
284
|
} else {
|
|
285
|
-
//
|
|
285
|
+
// 增加服务端逻辑中的系统逻辑
|
|
286
286
|
const systemTree = new Namespace({
|
|
287
287
|
name: 'category',
|
|
288
288
|
path: `nasl`,
|
|
@@ -315,11 +315,11 @@ export async function getLogics(node: CallLogic | BindEvent| Identifier | Logic,
|
|
|
315
315
|
}
|
|
316
316
|
return result;
|
|
317
317
|
} else if (node.concept === 'Identifier') {
|
|
318
|
-
const extensions = app.dependencies.map(moduleToLogicNamesapce).filter((item) => item.logics && item.logics.length);
|
|
318
|
+
const extensions = app.dependencies.map((dep) => moduleToLogicNamesapce(dep, app.overriddenLogics)).filter((item) => item.logics && item.logics.length);
|
|
319
319
|
const tree = new Namespace({
|
|
320
320
|
name: 'category`',
|
|
321
321
|
path: `${app.getNamespace()}.logics`,
|
|
322
|
-
title: '
|
|
322
|
+
title: '服务端逻辑',
|
|
323
323
|
logics: app.logics,
|
|
324
324
|
children: [...extensions],
|
|
325
325
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseNode, CompletionProperty, App, Variable, Identifier, MemberExpression, Enum, NullLiteral, BooleanLiteral, Param, BindAttribute, LogicItem, TypeAnnotation, StructureProperty, Entity, Structure, EntityProperty, Frontend, View } from '..';
|
|
2
|
-
import { formatVariableData, formatFrontEndVariables, formatConfigProperties } from './formatTsUtils';
|
|
1
|
+
import { BaseNode, CompletionProperty, App, Variable, BackendVariable, Identifier, MemberExpression, Enum, NullLiteral, BooleanLiteral, Param, BindAttribute, LogicItem, TypeAnnotation, StructureProperty, Entity, Structure, EntityProperty, Frontend, View } from '..';
|
|
2
|
+
import { formatVariableData, formatFrontEndVariables, formatConfigProperties, formatBackendVariables } from './formatTsUtils';
|
|
3
3
|
|
|
4
4
|
// 简单实现一版本的格式化nums
|
|
5
5
|
export function formatEnums(enums: Array<Enum>) {
|
|
@@ -32,6 +32,7 @@ export function formatEnums(enums: Array<Enum>) {
|
|
|
32
32
|
});
|
|
33
33
|
return result;
|
|
34
34
|
}
|
|
35
|
+
|
|
35
36
|
type LiteralDefination = {
|
|
36
37
|
name: string;
|
|
37
38
|
value: string;
|
|
@@ -80,7 +81,8 @@ function formatGlobalVariable() {
|
|
|
80
81
|
value: 'userInfo',
|
|
81
82
|
children: [
|
|
82
83
|
{ name: 'Status', value: 'userInfo.Status' },
|
|
83
|
-
{
|
|
84
|
+
{
|
|
85
|
+
name: 'UserInfoExtend',
|
|
84
86
|
value: 'userInfo.UserInfoExtend',
|
|
85
87
|
children: [
|
|
86
88
|
{ name: 'Company', value: 'userInfo.UserInfoExtend.Company' },
|
|
@@ -93,7 +95,8 @@ function formatGlobalVariable() {
|
|
|
93
95
|
{ name: 'Position', value: 'userInfo.UserInfoExtend.Position' },
|
|
94
96
|
{ name: 'Department', value: 'userInfo.UserInfoExtend.Department' },
|
|
95
97
|
{ name: 'EmployeeId', value: 'userInfo.UserInfoExtend.EmployeeId' },
|
|
96
|
-
]
|
|
98
|
+
],
|
|
99
|
+
},
|
|
97
100
|
{ name: 'UserName', value: 'userInfo.UserName' },
|
|
98
101
|
{ name: 'Email', value: 'userInfo.Email' },
|
|
99
102
|
{ name: 'UserId', value: 'userInfo.UserId' },
|
|
@@ -198,12 +201,16 @@ export async function getMemberIdentifier(node: BaseNode) {
|
|
|
198
201
|
{ name: '枚举', children: newEnums, expanded: false, icon: 'category' },
|
|
199
202
|
{ name: '变量', children: completionData, expanded: true, icon: 'category' },
|
|
200
203
|
{ name: '公共变量', children: globalVariable, expanded: false, icon: 'category' },
|
|
204
|
+
// { name: '服务端全局变量', children: BackEndglobalVariable, expanded: false, icon: 'category' },
|
|
201
205
|
// { name: '流程变量', children: [] },
|
|
202
206
|
];
|
|
203
|
-
if ((node as Identifier).view) {
|
|
207
|
+
if ((node as Identifier).view || (node as Identifier).frontend) {
|
|
204
208
|
// 获取前端全局变量
|
|
205
|
-
const frontEndVariable = getFrontEndVariablesIdentifier((node as Identifier).view);
|
|
209
|
+
const frontEndVariable = getFrontEndVariablesIdentifier((node as Identifier).view || (node as Identifier).frontend);
|
|
206
210
|
result.push({ name: '前端全局变量', children: frontEndVariable, expanded: true, icon: 'category' });
|
|
211
|
+
} else if (!(node as Identifier).frontend) { // 端事件里既不能调用前端变量 也不能调用后端变量
|
|
212
|
+
const BackEndglobalVariable = getBackendVariablesIdentifier(node);
|
|
213
|
+
result.push({ name: '服务端全局变量', children: BackEndglobalVariable, expanded: true, icon: 'category' });
|
|
207
214
|
}
|
|
208
215
|
getCurrentLogic(node, result);
|
|
209
216
|
return result;
|
|
@@ -211,7 +218,7 @@ export async function getMemberIdentifier(node: BaseNode) {
|
|
|
211
218
|
}
|
|
212
219
|
|
|
213
220
|
export function getFrontEndVariablesIdentifier(node: BaseNode) {
|
|
214
|
-
const frontend = (node as View).frontend as Frontend;
|
|
221
|
+
const frontend = (node as View).frontend as Frontend || node as Frontend;
|
|
215
222
|
const frontEndVariables = frontend?.variables;
|
|
216
223
|
const newFrontEndVariables = frontEndVariables ? formatFrontEndVariables(frontEndVariables) : [];
|
|
217
224
|
return newFrontEndVariables;
|
|
@@ -239,24 +246,43 @@ export function getEnumsIdentifier(node: BaseNode): CompletionProperty[] {
|
|
|
239
246
|
});
|
|
240
247
|
return newEnums.concat(extensionEnums);
|
|
241
248
|
}
|
|
249
|
+
// 获取后端全局变量
|
|
250
|
+
export function getBackendVariablesIdentifier(node: BaseNode): CompletionProperty[] {
|
|
251
|
+
const app = node.rootNode as App;
|
|
252
|
+
const variables = app?.backend.variables;
|
|
253
|
+
const newvariables = variables ? formatBackendVariables(variables) : [];
|
|
242
254
|
|
|
255
|
+
return newvariables;
|
|
256
|
+
}
|
|
243
257
|
// 获取变量
|
|
244
258
|
export async function getVariableIdentifier(node: BaseNode): Promise<CompletionProperty[]> {
|
|
245
259
|
let completionData: CompletionProperty[] = [new CompletionProperty({})];
|
|
246
260
|
// 只获取第一层内容
|
|
247
261
|
const app = node.getAncestor('App');
|
|
248
262
|
const naslServer = (app as any).naslServer;
|
|
249
|
-
|
|
263
|
+
let nextCompletion = await naslServer.getFieldKeySelectCompletion(node, '');
|
|
264
|
+
const logic = node.getAncestor('AuthLogicForCallInterface');
|
|
265
|
+
if (logic) {
|
|
266
|
+
// 祖先节点是 AuthLogicForCallInterface 时,需要过滤掉 api 以及 ${logicName}Result 两个内置参数
|
|
267
|
+
const filterList = ['api', `${logic.name}Result`];
|
|
268
|
+
nextCompletion = nextCompletion?.filter((item: any) => {
|
|
269
|
+
if (item?.text) {
|
|
270
|
+
return filterList.findIndex((str) => str === item.text) === -1;
|
|
271
|
+
}
|
|
272
|
+
return true;
|
|
273
|
+
});
|
|
274
|
+
}
|
|
250
275
|
completionData = formatVariableData(nextCompletion, node);
|
|
251
276
|
return completionData;
|
|
252
277
|
}
|
|
253
278
|
|
|
254
279
|
// 获取公共变量
|
|
255
|
-
export async function getGlobalVariableIdentifier(node: BaseNode):Promise<CompletionProperty[]> {
|
|
280
|
+
export async function getGlobalVariableIdentifier(node: BaseNode): Promise<CompletionProperty[]> {
|
|
256
281
|
let globalVariable: CompletionProperty[] = [];
|
|
257
282
|
// 公共变量修改
|
|
258
283
|
if ((node as any).view) {
|
|
259
284
|
globalVariable = formatGlobalVariable();
|
|
285
|
+
// globalVariable = [];
|
|
260
286
|
}
|
|
261
287
|
return globalVariable;
|
|
262
288
|
}
|