@lcap/nasl 1.0.0-alpha.13 → 1.0.0-alpha.14
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/out/automate/engine/index.js +1 -1
- package/out/automate/engine/index.js.map +1 -1
- package/out/common/BaseNode.d.ts +4 -4
- package/out/common/BaseNode.js +45 -41
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/App__.d.ts +17 -0
- package/out/concepts/App__.js +54 -12
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.js +2 -2
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/BinaryExpression__.js +8 -6
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +21 -21
- package/out/concepts/BindAttribute__.js +4 -3
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.d.ts +3 -3
- package/out/concepts/BindDirective__.js +22 -2
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.d.ts +9 -8
- package/out/concepts/BindEvent__.js +17 -7
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/CallFunction__.js +10 -5
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.js +11 -1
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +1 -0
- package/out/concepts/CallLogic__.js +17 -7
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts +0 -1
- package/out/concepts/CallQueryComponent__.js +5 -8
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.js +6 -2
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/ConfigGroup__.js +1 -1
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigProperty__.js +1 -1
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.js +1 -1
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/Destination__.js +10 -7
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +3 -0
- package/out/concepts/EntityProperty__.js +38 -0
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +34 -31
- package/out/concepts/Entity__.js +29 -12
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/Enum__.js +1 -1
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/Event__.js +1 -1
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/ForEachStatement__.js +8 -12
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/Function__.js +4 -4
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.js +13 -7
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.js +2 -2
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/InterfaceParam__.d.ts +2 -0
- package/out/concepts/InterfaceParam__.js +10 -0
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.js +3 -3
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/LogicItem__.d.ts +1 -0
- package/out/concepts/LogicItem__.js +14 -0
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +1 -0
- package/out/concepts/Logic__.js +16 -11
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/Module__.js +8 -8
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/Namespace__.js +12 -12
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/Param__.d.ts +1 -0
- package/out/concepts/Param__.js +3 -0
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessComponent__.js +2 -2
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.js +5 -5
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessOutcome__.js +1 -1
- package/out/concepts/ProcessOutcome__.js.map +1 -1
- package/out/concepts/Process__.js +4 -4
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.js +1 -1
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.js +2 -2
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.js +1 -1
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Return__.d.ts +1 -0
- package/out/concepts/Return__.js +6 -3
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/StringLiteral__.d.ts +1 -1
- package/out/concepts/StringLiteral__.js +2 -2
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.d.ts +3 -6
- package/out/concepts/StructureProperty__.js +38 -32
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.js +3 -3
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.js +3 -3
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.js +1 -1
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.js +10 -2
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/UnaryExpression__.js +1 -1
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/ValidationRule__.d.ts +1 -0
- package/out/concepts/ValidationRule__.js +27 -1
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.d.ts +1 -0
- package/out/concepts/Variable__.js +6 -3
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewComponent__.js +5 -5
- package/out/concepts/ViewComponent__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +63 -60
- package/out/concepts/ViewElement__.js +123 -88
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +4 -0
- package/out/concepts/View__.js +26 -10
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.js +1 -1
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/basics/stdlib/index.js +3 -1
- package/out/concepts/basics/stdlib/index.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.auth.d.ts +3 -0
- package/out/concepts/basics/stdlib/nasl.auth.js +39 -0
- package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.browser copy.d.ts +3 -0
- package/out/concepts/basics/stdlib/nasl.browser copy.js +70 -0
- package/out/concepts/basics/stdlib/nasl.browser copy.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.browser.js +6 -35
- package/out/concepts/basics/stdlib/nasl.browser.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.configuration.d.ts +3 -0
- package/out/concepts/basics/stdlib/nasl.configuration.js +25 -0
- package/out/concepts/basics/stdlib/nasl.configuration.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.util.js +0 -29
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/enums/KEYWORDS.js +1 -0
- package/out/enums/KEYWORDS.js.map +1 -1
- package/out/generator/genBundleFiles.js +98 -72
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/server/createUiTs.d.ts +1 -0
- package/out/server/createUiTs.js +15 -1
- package/out/server/createUiTs.js.map +1 -1
- package/out/server/getLogics.js +27 -45
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.js +3 -3
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/getProcesses.d.ts +1 -1
- package/out/server/getProcesses.js +2 -2
- package/out/server/getProcesses.js.map +1 -1
- package/out/server/naslServer.d.ts +1 -3
- package/out/server/naslServer.js +73 -57
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.d.ts +0 -3
- package/out/server/translator.js +16 -7
- package/out/server/translator.js.map +1 -1
- package/out/service/storage/init.js +21 -12
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCreateBlock.js +3 -3
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +6 -10
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +2 -2
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genGetBlock.js +1 -1
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genQueryComponent.d.ts +2 -0
- package/out/templator/genQueryComponent.js +1 -0
- package/out/templator/genQueryComponent.js.map +1 -1
- package/out/templator/genUpdateBlock.js +5 -5
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/utils.d.ts +3 -1
- package/out/templator/utils.js +2 -1
- package/out/templator/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/automate/engine/index.js +1 -1
- package/src/common/BaseNode.ts +46 -42
- package/src/concepts/App__.ts +54 -12
- package/src/concepts/Argument__.ts +3 -2
- package/src/concepts/BinaryExpression__.ts +8 -6
- package/src/concepts/BindAttribute__.ts +26 -32
- package/src/concepts/BindDirective__.ts +24 -9
- package/src/concepts/BindEvent__.ts +25 -29
- package/src/concepts/CallFunction__.ts +11 -6
- package/src/concepts/CallInterface__.ts +11 -1
- package/src/concepts/CallLogic__.ts +21 -40
- package/src/concepts/CallQueryComponent__.ts +6 -10
- package/src/concepts/Comment__.ts +6 -2
- package/src/concepts/ConfigGroup__.ts +1 -1
- package/src/concepts/ConfigProperty__.ts +1 -1
- package/src/concepts/Configuration__.ts +1 -1
- package/src/concepts/Destination__.ts +9 -7
- package/src/concepts/EntityProperty__.ts +36 -0
- package/src/concepts/Entity__.ts +63 -50
- package/src/concepts/Enum__.ts +1 -1
- package/src/concepts/Event__.ts +1 -1
- package/src/concepts/ForEachStatement__.ts +8 -13
- package/src/concepts/Function__.ts +4 -4
- package/src/concepts/Identifier__.ts +15 -18
- package/src/concepts/IfStatement__.ts +2 -2
- package/src/concepts/InterfaceParam__.ts +11 -0
- package/src/concepts/Interface__.ts +3 -3
- package/src/concepts/LogicItem__.ts +15 -0
- package/src/concepts/Logic__.ts +34 -50
- package/src/concepts/Module__.ts +8 -8
- package/src/concepts/Namespace__.ts +12 -12
- package/src/concepts/Param__.ts +3 -0
- package/src/concepts/ProcessComponent__.ts +2 -2
- package/src/concepts/ProcessElement__.ts +5 -5
- package/src/concepts/ProcessOutcome__.ts +1 -1
- package/src/concepts/Process__.ts +4 -4
- package/src/concepts/QueryFromExpression__.ts +1 -1
- package/src/concepts/QueryJoinExpression__.ts +2 -2
- package/src/concepts/QuerySelectExpression__.ts +1 -1
- package/src/concepts/Return__.ts +6 -3
- package/src/concepts/StringLiteral__.ts +2 -2
- package/src/concepts/StructureProperty__.ts +36 -29
- package/src/concepts/Structure__.ts +3 -3
- package/src/concepts/SwitchCase__.ts +3 -3
- package/src/concepts/SwitchStatement__.ts +1 -1
- package/src/concepts/TypeAnnotation__.ts +8 -2
- package/src/concepts/UnaryExpression__.ts +1 -1
- package/src/concepts/ValidationRule__.ts +24 -1
- package/src/concepts/Variable__.ts +6 -3
- package/src/concepts/ViewComponent__.ts +5 -5
- package/src/concepts/ViewElement__.ts +183 -147
- package/src/concepts/View__.ts +30 -32
- package/src/concepts/WhileStatement__.ts +1 -1
- package/src/concepts/basics/stdlib/index.ts +3 -1
- package/src/concepts/basics/stdlib/nasl.auth.ts +35 -0
- package/src/concepts/basics/stdlib/nasl.browser.ts +7 -41
- package/src/concepts/basics/stdlib/nasl.configuration.ts +21 -0
- package/src/concepts/basics/stdlib/nasl.util.ts +0 -29
- package/src/enums/KEYWORDS.ts +1 -0
- package/src/generator/genBundleFiles.ts +102 -74
- package/src/server/createUiTs.ts +18 -3
- package/src/server/getLogics.ts +29 -47
- package/src/server/getMemberIdentifier.ts +3 -3
- package/src/server/getProcesses.ts +2 -2
- package/src/server/naslServer.ts +84 -62
- package/src/server/translator.ts +18 -6
- package/src/service/storage/init.ts +20 -13
- package/src/templator/genCreateBlock.ts +3 -3
- package/src/templator/genCurdEditMultipleKeyBlock.ts +22 -23
- package/src/templator/genCurdMultipleKeyBlock.ts +2 -2
- package/src/templator/genGetBlock.ts +1 -1
- package/src/templator/genQueryComponent.ts +1 -0
- package/src/templator/genUpdateBlock.ts +5 -6
- package/src/templator/utils.ts +2 -1
|
@@ -255,7 +255,7 @@ export async function genBundleFiles(app: App,
|
|
|
255
255
|
});
|
|
256
256
|
|
|
257
257
|
const data = JSON5.stringify({
|
|
258
|
-
pages,
|
|
258
|
+
// pages,
|
|
259
259
|
metaData: {
|
|
260
260
|
dataTypesMap,
|
|
261
261
|
enumsMap,
|
|
@@ -270,6 +270,7 @@ export async function genBundleFiles(app: App,
|
|
|
270
270
|
env: config.env,
|
|
271
271
|
indexName,
|
|
272
272
|
}, null, 4);
|
|
273
|
+
|
|
273
274
|
const assetsInfo = app.genAllAssetsInfo(config.STATIC_URL);
|
|
274
275
|
// console.log(assetsInfo);
|
|
275
276
|
// debugger;
|
|
@@ -297,15 +298,46 @@ export async function genBundleFiles(app: App,
|
|
|
297
298
|
}
|
|
298
299
|
}`;
|
|
299
300
|
|
|
301
|
+
function routeToString(route: Route): string {
|
|
302
|
+
return `{
|
|
303
|
+
path: '${route.path}',
|
|
304
|
+
component: (function(){
|
|
305
|
+
var componentOptions = ${route.component.script ? '(function(){\n' + route.component.script.trim().replace(/export default |module\.exports +=/, 'return ') + '\n})()' : '{}'};
|
|
306
|
+
Object.assign(componentOptions, {
|
|
307
|
+
template: \`${route.component.template.replace(/[`$]/g, (m) => '\\' + m)}\`,
|
|
308
|
+
});
|
|
309
|
+
return componentOptions;
|
|
310
|
+
// return window.Vue.extend(componentOptions);
|
|
311
|
+
})(),
|
|
312
|
+
children: [
|
|
313
|
+
${route.children.map(routeToString).join(',\n')}
|
|
314
|
+
],
|
|
315
|
+
}`;
|
|
316
|
+
}
|
|
317
|
+
|
|
300
318
|
content += `
|
|
301
319
|
var data = ${data};
|
|
320
|
+
data.pages = {
|
|
321
|
+
${Object.keys(pages)
|
|
322
|
+
.map((pageName) => {
|
|
323
|
+
const page = pages[pageName];
|
|
324
|
+
const rootRoute = page.rootRoute;
|
|
325
|
+
delete page.rootRoute;
|
|
326
|
+
|
|
327
|
+
let pageJSON = JSON5.stringify(page, null, 4);
|
|
328
|
+
pageJSON = pageJSON.slice(0, -1) + `\nrootRoute: ${routeToString(rootRoute)} }`;
|
|
329
|
+
|
|
330
|
+
return `${pageName}: ${pageJSON},`;
|
|
331
|
+
})
|
|
332
|
+
.join('\n')}
|
|
333
|
+
};
|
|
302
334
|
var pageName = window.pageName;
|
|
303
335
|
if(!pageName){
|
|
304
336
|
pageName = data.indexName;
|
|
305
337
|
}
|
|
306
338
|
var page = data.pages[pageName];
|
|
307
339
|
page.router.noLogin = noLogin;
|
|
308
|
-
|
|
340
|
+
|
|
309
341
|
if(appVM){
|
|
310
342
|
appVM=null
|
|
311
343
|
}
|
|
@@ -320,79 +352,76 @@ export async function genBundleFiles(app: App,
|
|
|
320
352
|
window.appVM = appVM;
|
|
321
353
|
})();`;
|
|
322
354
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
// position: fixed;
|
|
366
|
-
// top:0;
|
|
367
|
-
// width:100vw;
|
|
368
|
-
// height:60px;
|
|
369
|
-
// background:red;
|
|
370
|
-
// opacity: 1;
|
|
371
|
-
// color: #f3f3f3;
|
|
372
|
-
// font-weight: 600;
|
|
373
|
-
// display:none;
|
|
374
|
-
// }
|
|
375
|
-
|
|
376
|
-
// @keyframes loading-animation{
|
|
377
|
-
// 0% {
|
|
378
|
-
// transform: rotate(0deg);
|
|
379
|
-
// }
|
|
380
|
-
// 100% {
|
|
381
|
-
// transform: rotate(360deg);
|
|
382
|
-
// }
|
|
383
|
-
// }\`
|
|
384
|
-
// document.getElementsByTagName('body')[0].appendChild(style);
|
|
385
|
-
// }
|
|
386
|
-
// `;
|
|
387
|
-
// content += str;
|
|
388
|
-
// }
|
|
355
|
+
if (config.env === 'dev') {
|
|
356
|
+
// 加载资源js
|
|
357
|
+
const domain = config.lowcodeDomain.slice(5);
|
|
358
|
+
const targetUrl = `${location.origin}/empty?url=${domain}&appid=${config.appid}`;
|
|
359
|
+
const str = `
|
|
360
|
+
if(!document.querySelector("iframe[name='iframeEmpty']")){
|
|
361
|
+
var el = document.createElement('iframe');
|
|
362
|
+
el.setAttribute('src', "${targetUrl}");
|
|
363
|
+
el.setAttribute('name', 'iframeEmpty');
|
|
364
|
+
el.setAttribute('width', 0);
|
|
365
|
+
el.setAttribute('height', 0);
|
|
366
|
+
el.style.borderWidth = 0
|
|
367
|
+
el.style.display= "block"
|
|
368
|
+
document.getElementsByTagName('body')[0].appendChild(el);
|
|
369
|
+
document.domain = '${domain}'
|
|
370
|
+
var _div = document.createElement('div');
|
|
371
|
+
_div.classList = "div-load"
|
|
372
|
+
_div.innerHTML = "<div class='loading-container'></div><div>正在更新最新发布内容...</div>"
|
|
373
|
+
document.getElementsByTagName('body')[0].appendChild(_div);
|
|
374
|
+
window.showLoading = function(){
|
|
375
|
+
document.querySelector(".div-load").style.display ="flex"
|
|
376
|
+
}
|
|
377
|
+
window.hideLoading = function(){
|
|
378
|
+
document.querySelector(".div-load").style.display ="none"
|
|
379
|
+
}
|
|
380
|
+
var style = document.createElement('style');
|
|
381
|
+
style.innerHTML=\`.div-load{
|
|
382
|
+
width: 208px;
|
|
383
|
+
height: 40px;
|
|
384
|
+
background: rgba(48, 48, 48, 0.8);
|
|
385
|
+
box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.1);
|
|
386
|
+
border-radius: 4px;
|
|
387
|
+
position: fixed;
|
|
388
|
+
top: 120px;
|
|
389
|
+
left: 50%;
|
|
390
|
+
margin-left: -104px;
|
|
391
|
+
color: #FFFFFF;
|
|
392
|
+
font-size: 14px;
|
|
393
|
+
display: none;
|
|
394
|
+
justify-content: center;
|
|
395
|
+
align-items: center;
|
|
396
|
+
}
|
|
389
397
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
398
|
+
.loading-container{
|
|
399
|
+
width: 12px;
|
|
400
|
+
height: 12px;
|
|
401
|
+
margin-right: 10px;
|
|
402
|
+
animation: loading-animation 0.8s infinite linear;
|
|
403
|
+
border: 2px solid #f3f3f3;
|
|
404
|
+
border-top: 2px solid rgb(109, 108, 108);
|
|
405
|
+
border-right: 2px solid rgb(109, 108, 108);
|
|
406
|
+
border-bottom: 2px solid rgb(109, 108, 108);
|
|
407
|
+
border-radius: 50%;
|
|
408
|
+
}
|
|
395
409
|
|
|
410
|
+
@keyframes loading-animation{
|
|
411
|
+
0% {
|
|
412
|
+
transform: rotate(0deg);
|
|
413
|
+
}
|
|
414
|
+
100% {
|
|
415
|
+
transform: rotate(360deg);
|
|
416
|
+
}
|
|
417
|
+
}\`
|
|
418
|
+
document.getElementsByTagName('body')[0].appendChild(style);
|
|
419
|
+
}
|
|
420
|
+
`;
|
|
421
|
+
content += str;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
const bundlePath = `${config.USER_STATIC_URL}/${config.tenant}/${app.id}/${config.env}/bundle.${genHash(content)}.js`;
|
|
396
425
|
const assetsContent = `(function() {
|
|
397
426
|
LazyLoad.js(${JSON5.stringify(assetsInfo.basic.js.concat(assetsInfo.custom.js).concat([bundlePath]))});
|
|
398
427
|
LazyLoad.css(${JSON5.stringify(assetsInfo.basic.css.concat(assetsInfo.custom.css))});
|
|
@@ -409,6 +438,5 @@ export async function genBundleFiles(app: App,
|
|
|
409
438
|
content: assetsContent,
|
|
410
439
|
},
|
|
411
440
|
];
|
|
412
|
-
// outputs[`${config.USER_STATIC_URL}/${config.tenant}/${app.id}/${config.env}/client.js`] = assetsContent;
|
|
413
441
|
return outputs;
|
|
414
442
|
}
|
package/src/server/createUiTs.ts
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
import { Logic, TypeAnnotation, Param, LogicItem, NumericLiteral, BooleanLiteral, StringLiteral, Identifier, MemberExpression } from '..';
|
|
2
2
|
|
|
3
|
+
const naslStdlibMap: any = {
|
|
4
|
+
'nasl.core.ts': require('!!raw-loader!../../../file-storage/data/stdlib/nasl.core.ts').default,
|
|
5
|
+
'nasl.collection.ts': require('!!raw-loader!../../../file-storage/data/stdlib/nasl.collection.ts').default,
|
|
6
|
+
'nasl.interface.ts': require('!!raw-loader!../../../file-storage/data/stdlib/nasl.interface.ts').default,
|
|
7
|
+
'nasl.util.ts': require('!!raw-loader!../../../file-storage/data/stdlib/nasl.util.ts').default,
|
|
8
|
+
'nasl.ui.ts': require('!!raw-loader!../../../file-storage/data/stdlib/nasl.ui.ts').default,
|
|
9
|
+
'nasl.browser.ts': require('!!raw-loader!../../../file-storage/data/stdlib/nasl.browser.ts').default,
|
|
10
|
+
'nasl.auth.ts': require('!!raw-loader!../../../file-storage/data/stdlib/nasl.auth.ts').default,
|
|
11
|
+
'nasl.configuration.ts': require('!!raw-loader!../../../file-storage/data/stdlib/nasl.configuration.ts').default,
|
|
12
|
+
'nasl.langUtil.ts': require('!!raw-loader!../../../file-storage/data/stdlib/nasl.langUtil.ts').default,
|
|
13
|
+
'nasl.annotation.ts': require('!!raw-loader!../../../file-storage/data/stdlib/nasl.annotation.ts').default,
|
|
14
|
+
'nasl.validation.ts': require('!!raw-loader!../../../file-storage/data/stdlib/nasl.validation.ts').default,
|
|
15
|
+
};
|
|
16
|
+
|
|
3
17
|
export default function formatUiTs(allComponent: any) {
|
|
4
18
|
const indent = (tabSize: number) => ' '.repeat(tabSize * 2);
|
|
5
19
|
|
|
6
|
-
const toHump = (name: string) => name ? name.replace(/\-(\w)/g, (all, letter) => letter.toUpperCase()) : '';
|
|
20
|
+
const toHump = (name: string) => (name ? name.replace(/\-(\w)/g, (all, letter) => letter.toUpperCase()) : '');
|
|
7
21
|
|
|
8
22
|
const toNaslType = (type: string) => {
|
|
9
23
|
if (type === 'number')
|
|
@@ -17,7 +31,7 @@ export default function formatUiTs(allComponent: any) {
|
|
|
17
31
|
else
|
|
18
32
|
return type;
|
|
19
33
|
};
|
|
20
|
-
const createDefault = (param: any):LogicItem => {
|
|
34
|
+
const createDefault = (param: any): LogicItem => {
|
|
21
35
|
const defaultValue = param.default;
|
|
22
36
|
if (defaultValue) {
|
|
23
37
|
if (typeof defaultValue === 'number') {
|
|
@@ -31,7 +45,7 @@ export default function formatUiTs(allComponent: any) {
|
|
|
31
45
|
}
|
|
32
46
|
return null;
|
|
33
47
|
};
|
|
34
|
-
const creatMethodLogic = (method: {name: string
|
|
48
|
+
const creatMethodLogic = (method: { name: string; params: any[] }) => {
|
|
35
49
|
const { name, params } = method;
|
|
36
50
|
const logic = new Logic({
|
|
37
51
|
name,
|
|
@@ -175,5 +189,6 @@ export default function formatUiTs(allComponent: any) {
|
|
|
175
189
|
return {
|
|
176
190
|
code: value,
|
|
177
191
|
elementsLogic,
|
|
192
|
+
naslStdlibMap,
|
|
178
193
|
};
|
|
179
194
|
}
|
package/src/server/getLogics.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CallLogic, BindEvent, App, Namespace, Entity, BaseNode, Logic, Param, TypeAnnotation, Return, Process, ViewElement } from '..';
|
|
1
|
+
import { CallLogic, BindEvent, App, Namespace, Entity, BaseNode, Logic, Param, TypeAnnotation, Return, Process, ViewElement, stdlibNamespace } from '..';
|
|
2
2
|
import { process2LogicNamespace } from './process2LogicNamespace';
|
|
3
3
|
import { moduleToLogicNamesapce } from './getExtensionModules';
|
|
4
4
|
import naslServer from './naslServer';
|
|
@@ -31,7 +31,7 @@ function iterator(tree: FakeNode | FakeProcessNode, searchContent: string, fakeN
|
|
|
31
31
|
}
|
|
32
32
|
if (tree.logics) {
|
|
33
33
|
tree.logics.forEach((l) => {
|
|
34
|
-
const exist = l.name.includes(searchContent);
|
|
34
|
+
const exist = l.name.toLowerCase().includes(searchContent);
|
|
35
35
|
if (exist) {
|
|
36
36
|
fakeNode.logics.push(l);
|
|
37
37
|
}
|
|
@@ -100,7 +100,7 @@ export async function getLogics(node: CallLogic | BindEvent, needAllLogic: boole
|
|
|
100
100
|
if (Array.isArray(eleLogis) && eleLogis.length) {
|
|
101
101
|
const viewElement = new Namespace({
|
|
102
102
|
title: toHump(item.name),
|
|
103
|
-
logics: eleLogis,
|
|
103
|
+
logics: eleLogis.map((item: Logic) => Logic.from(item)),
|
|
104
104
|
path: `elements.${toHump(item.name)}.logics`,
|
|
105
105
|
originConcept: 'ViewElement',
|
|
106
106
|
});
|
|
@@ -121,63 +121,45 @@ export async function getLogics(node: CallLogic | BindEvent, needAllLogic: boole
|
|
|
121
121
|
|
|
122
122
|
const systemTree = new Namespace({
|
|
123
123
|
name: 'category',
|
|
124
|
-
path: `nasl
|
|
125
|
-
title: '
|
|
126
|
-
|
|
127
|
-
new
|
|
128
|
-
name: '
|
|
129
|
-
|
|
130
|
-
|
|
124
|
+
path: `nasl`,
|
|
125
|
+
title: '系统逻辑',
|
|
126
|
+
children: [
|
|
127
|
+
new Namespace({
|
|
128
|
+
name: 'category',
|
|
129
|
+
path: `browser`,
|
|
130
|
+
title: '浏览器',
|
|
131
|
+
logics: stdlibNamespace.findChild('browser').logics,
|
|
132
|
+
expanded: true,
|
|
131
133
|
}),
|
|
132
|
-
new
|
|
133
|
-
name: '
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
new Namespace({
|
|
135
|
+
name: 'category',
|
|
136
|
+
path: `auth`,
|
|
137
|
+
title: '认证与权限',
|
|
138
|
+
logics: stdlibNamespace.findChild('auth').logics,
|
|
139
|
+
expanded: true,
|
|
136
140
|
}),
|
|
137
|
-
new
|
|
138
|
-
name: '
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
required: true,
|
|
144
|
-
}),
|
|
145
|
-
],
|
|
146
|
-
body: [],
|
|
147
|
-
}),
|
|
148
|
-
new Logic({
|
|
149
|
-
name: 'getDistance',
|
|
150
|
-
params: [
|
|
151
|
-
new Param({
|
|
152
|
-
name: 'Point1',
|
|
153
|
-
typeAnnotation: TypeAnnotation.createPrimitive('String'),
|
|
154
|
-
required: true,
|
|
155
|
-
}),
|
|
156
|
-
new Param({
|
|
157
|
-
name: 'Point2',
|
|
158
|
-
typeAnnotation: TypeAnnotation.createPrimitive('String'),
|
|
159
|
-
required: true,
|
|
160
|
-
}),
|
|
161
|
-
],
|
|
162
|
-
body: [],
|
|
163
|
-
}),
|
|
164
|
-
new Logic({
|
|
165
|
-
name: 'logOut',
|
|
166
|
-
params: [],
|
|
167
|
-
body: [],
|
|
141
|
+
new Namespace({
|
|
142
|
+
name: 'category',
|
|
143
|
+
path: `configuration`,
|
|
144
|
+
title: '配置',
|
|
145
|
+
logics: stdlibNamespace.findChild('configuration').logics,
|
|
146
|
+
expanded: true,
|
|
168
147
|
}),
|
|
169
148
|
],
|
|
149
|
+
expanded: true,
|
|
170
150
|
});
|
|
171
|
-
systemTree.expanded = true;
|
|
172
151
|
|
|
152
|
+
systemTree.expanded = true;
|
|
153
|
+
systemTree.children.forEach((child) => (child.expanded = true));
|
|
173
154
|
result.push(systemTree);
|
|
174
155
|
}
|
|
175
156
|
return result;
|
|
176
157
|
}
|
|
177
158
|
}
|
|
178
159
|
|
|
179
|
-
export function iteratorTree(treeList: {}[], filterText
|
|
160
|
+
export function iteratorTree(treeList: {}[], filterText: string = '') {
|
|
180
161
|
const result: {}[] = [];
|
|
162
|
+
filterText = filterText.toLowerCase();
|
|
181
163
|
treeList.forEach((item) => {
|
|
182
164
|
const fakeNode = {};
|
|
183
165
|
iterator(item, filterText, fakeNode);
|
|
@@ -248,7 +248,7 @@ function formatGlobalVariable() {
|
|
|
248
248
|
};
|
|
249
249
|
const userInfoIdentifier = new Identifier({
|
|
250
250
|
name: 'userInfo',
|
|
251
|
-
namespace: 'nasl.
|
|
251
|
+
namespace: 'nasl.auth',
|
|
252
252
|
});
|
|
253
253
|
const userCompletionProperty = new CompletionProperty({
|
|
254
254
|
name: 'userInfo',
|
|
@@ -340,7 +340,7 @@ export async function getMemberIdentifier(node: BaseNode) {
|
|
|
340
340
|
completionData = formatVariableData(nextCompletion, node);
|
|
341
341
|
}
|
|
342
342
|
let globalVariable: CompletionProperty[] = [];
|
|
343
|
-
//
|
|
343
|
+
// 公共变量修改
|
|
344
344
|
if ((node as any).view) {
|
|
345
345
|
globalVariable = formatGlobalVariable();
|
|
346
346
|
}
|
|
@@ -349,7 +349,7 @@ export async function getMemberIdentifier(node: BaseNode) {
|
|
|
349
349
|
{ name: '字面量', children: literals, expanded: true, icon: 'category' },
|
|
350
350
|
{ name: '枚举', children: newEnums, expanded: true, icon: 'category' },
|
|
351
351
|
{ name: '变量', children: completionData, expanded: true, icon: 'category' },
|
|
352
|
-
{ name: '
|
|
352
|
+
{ name: '公共变量', children: globalVariable, expanded: true, icon: 'category' },
|
|
353
353
|
|
|
354
354
|
// { name: '流程变量', children: [] },
|
|
355
355
|
];
|
|
@@ -248,7 +248,7 @@ export function getPreviousUserTask(node: ProcessElement) {
|
|
|
248
248
|
return elements;
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
-
export function getProcessVariableSuggestions(node: Logic): CompletionProperty {
|
|
251
|
+
export function getProcessVariableSuggestions(node: Logic, abandonConstant: boolean = false): CompletionProperty {
|
|
252
252
|
if (!node.processElement) {
|
|
253
253
|
return;
|
|
254
254
|
}
|
|
@@ -263,7 +263,7 @@ export function getProcessVariableSuggestions(node: Logic): CompletionProperty {
|
|
|
263
263
|
noFurther: true,
|
|
264
264
|
children: [
|
|
265
265
|
...us.returns.map(genCompletionProperty([process.name, us.name])),
|
|
266
|
-
...us.constants.map(genCompletionProperty([process.name, us.name])),
|
|
266
|
+
...(abandonConstant ? [] : us.constants.map(genCompletionProperty([process.name, us.name]))),
|
|
267
267
|
],
|
|
268
268
|
});
|
|
269
269
|
cp.icon = us.type;
|