@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.
Files changed (254) hide show
  1. package/out/automate/engine/index.js +1 -1
  2. package/out/automate/engine/index.js.map +1 -1
  3. package/out/common/BaseNode.d.ts +4 -4
  4. package/out/common/BaseNode.js +45 -41
  5. package/out/common/BaseNode.js.map +1 -1
  6. package/out/concepts/App__.d.ts +17 -0
  7. package/out/concepts/App__.js +54 -12
  8. package/out/concepts/App__.js.map +1 -1
  9. package/out/concepts/Argument__.js +2 -2
  10. package/out/concepts/Argument__.js.map +1 -1
  11. package/out/concepts/BinaryExpression__.js +8 -6
  12. package/out/concepts/BinaryExpression__.js.map +1 -1
  13. package/out/concepts/BindAttribute__.d.ts +21 -21
  14. package/out/concepts/BindAttribute__.js +4 -3
  15. package/out/concepts/BindAttribute__.js.map +1 -1
  16. package/out/concepts/BindDirective__.d.ts +3 -3
  17. package/out/concepts/BindDirective__.js +22 -2
  18. package/out/concepts/BindDirective__.js.map +1 -1
  19. package/out/concepts/BindEvent__.d.ts +9 -8
  20. package/out/concepts/BindEvent__.js +17 -7
  21. package/out/concepts/BindEvent__.js.map +1 -1
  22. package/out/concepts/CallFunction__.js +10 -5
  23. package/out/concepts/CallFunction__.js.map +1 -1
  24. package/out/concepts/CallInterface__.js +11 -1
  25. package/out/concepts/CallInterface__.js.map +1 -1
  26. package/out/concepts/CallLogic__.d.ts +1 -0
  27. package/out/concepts/CallLogic__.js +17 -7
  28. package/out/concepts/CallLogic__.js.map +1 -1
  29. package/out/concepts/CallQueryComponent__.d.ts +0 -1
  30. package/out/concepts/CallQueryComponent__.js +5 -8
  31. package/out/concepts/CallQueryComponent__.js.map +1 -1
  32. package/out/concepts/Comment__.js +6 -2
  33. package/out/concepts/Comment__.js.map +1 -1
  34. package/out/concepts/ConfigGroup__.js +1 -1
  35. package/out/concepts/ConfigGroup__.js.map +1 -1
  36. package/out/concepts/ConfigProperty__.js +1 -1
  37. package/out/concepts/ConfigProperty__.js.map +1 -1
  38. package/out/concepts/Configuration__.js +1 -1
  39. package/out/concepts/Configuration__.js.map +1 -1
  40. package/out/concepts/Destination__.js +10 -7
  41. package/out/concepts/Destination__.js.map +1 -1
  42. package/out/concepts/EntityProperty__.d.ts +3 -0
  43. package/out/concepts/EntityProperty__.js +38 -0
  44. package/out/concepts/EntityProperty__.js.map +1 -1
  45. package/out/concepts/Entity__.d.ts +34 -31
  46. package/out/concepts/Entity__.js +29 -12
  47. package/out/concepts/Entity__.js.map +1 -1
  48. package/out/concepts/Enum__.js +1 -1
  49. package/out/concepts/Enum__.js.map +1 -1
  50. package/out/concepts/Event__.js +1 -1
  51. package/out/concepts/Event__.js.map +1 -1
  52. package/out/concepts/ForEachStatement__.js +8 -12
  53. package/out/concepts/ForEachStatement__.js.map +1 -1
  54. package/out/concepts/Function__.js +4 -4
  55. package/out/concepts/Function__.js.map +1 -1
  56. package/out/concepts/Identifier__.js +13 -7
  57. package/out/concepts/Identifier__.js.map +1 -1
  58. package/out/concepts/IfStatement__.js +2 -2
  59. package/out/concepts/IfStatement__.js.map +1 -1
  60. package/out/concepts/InterfaceParam__.d.ts +2 -0
  61. package/out/concepts/InterfaceParam__.js +10 -0
  62. package/out/concepts/InterfaceParam__.js.map +1 -1
  63. package/out/concepts/Interface__.js +3 -3
  64. package/out/concepts/Interface__.js.map +1 -1
  65. package/out/concepts/LogicItem__.d.ts +1 -0
  66. package/out/concepts/LogicItem__.js +14 -0
  67. package/out/concepts/LogicItem__.js.map +1 -1
  68. package/out/concepts/Logic__.d.ts +1 -0
  69. package/out/concepts/Logic__.js +16 -11
  70. package/out/concepts/Logic__.js.map +1 -1
  71. package/out/concepts/Module__.js +8 -8
  72. package/out/concepts/Module__.js.map +1 -1
  73. package/out/concepts/Namespace__.js +12 -12
  74. package/out/concepts/Namespace__.js.map +1 -1
  75. package/out/concepts/Param__.d.ts +1 -0
  76. package/out/concepts/Param__.js +3 -0
  77. package/out/concepts/Param__.js.map +1 -1
  78. package/out/concepts/ProcessComponent__.js +2 -2
  79. package/out/concepts/ProcessComponent__.js.map +1 -1
  80. package/out/concepts/ProcessElement__.js +5 -5
  81. package/out/concepts/ProcessElement__.js.map +1 -1
  82. package/out/concepts/ProcessOutcome__.js +1 -1
  83. package/out/concepts/ProcessOutcome__.js.map +1 -1
  84. package/out/concepts/Process__.js +4 -4
  85. package/out/concepts/Process__.js.map +1 -1
  86. package/out/concepts/QueryFromExpression__.js +1 -1
  87. package/out/concepts/QueryFromExpression__.js.map +1 -1
  88. package/out/concepts/QueryJoinExpression__.js +2 -2
  89. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  90. package/out/concepts/QuerySelectExpression__.js +1 -1
  91. package/out/concepts/QuerySelectExpression__.js.map +1 -1
  92. package/out/concepts/Return__.d.ts +1 -0
  93. package/out/concepts/Return__.js +6 -3
  94. package/out/concepts/Return__.js.map +1 -1
  95. package/out/concepts/StringLiteral__.d.ts +1 -1
  96. package/out/concepts/StringLiteral__.js +2 -2
  97. package/out/concepts/StringLiteral__.js.map +1 -1
  98. package/out/concepts/StructureProperty__.d.ts +3 -6
  99. package/out/concepts/StructureProperty__.js +38 -32
  100. package/out/concepts/StructureProperty__.js.map +1 -1
  101. package/out/concepts/Structure__.js +3 -3
  102. package/out/concepts/Structure__.js.map +1 -1
  103. package/out/concepts/SwitchCase__.js +3 -3
  104. package/out/concepts/SwitchCase__.js.map +1 -1
  105. package/out/concepts/SwitchStatement__.js +1 -1
  106. package/out/concepts/SwitchStatement__.js.map +1 -1
  107. package/out/concepts/TypeAnnotation__.js +10 -2
  108. package/out/concepts/TypeAnnotation__.js.map +1 -1
  109. package/out/concepts/UnaryExpression__.js +1 -1
  110. package/out/concepts/UnaryExpression__.js.map +1 -1
  111. package/out/concepts/ValidationRule__.d.ts +1 -0
  112. package/out/concepts/ValidationRule__.js +27 -1
  113. package/out/concepts/ValidationRule__.js.map +1 -1
  114. package/out/concepts/Variable__.d.ts +1 -0
  115. package/out/concepts/Variable__.js +6 -3
  116. package/out/concepts/Variable__.js.map +1 -1
  117. package/out/concepts/ViewComponent__.js +5 -5
  118. package/out/concepts/ViewComponent__.js.map +1 -1
  119. package/out/concepts/ViewElement__.d.ts +63 -60
  120. package/out/concepts/ViewElement__.js +123 -88
  121. package/out/concepts/ViewElement__.js.map +1 -1
  122. package/out/concepts/View__.d.ts +4 -0
  123. package/out/concepts/View__.js +26 -10
  124. package/out/concepts/View__.js.map +1 -1
  125. package/out/concepts/WhileStatement__.js +1 -1
  126. package/out/concepts/WhileStatement__.js.map +1 -1
  127. package/out/concepts/basics/stdlib/index.js +3 -1
  128. package/out/concepts/basics/stdlib/index.js.map +1 -1
  129. package/out/concepts/basics/stdlib/nasl.auth.d.ts +3 -0
  130. package/out/concepts/basics/stdlib/nasl.auth.js +39 -0
  131. package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -0
  132. package/out/concepts/basics/stdlib/nasl.browser copy.d.ts +3 -0
  133. package/out/concepts/basics/stdlib/nasl.browser copy.js +70 -0
  134. package/out/concepts/basics/stdlib/nasl.browser copy.js.map +1 -0
  135. package/out/concepts/basics/stdlib/nasl.browser.js +6 -35
  136. package/out/concepts/basics/stdlib/nasl.browser.js.map +1 -1
  137. package/out/concepts/basics/stdlib/nasl.configuration.d.ts +3 -0
  138. package/out/concepts/basics/stdlib/nasl.configuration.js +25 -0
  139. package/out/concepts/basics/stdlib/nasl.configuration.js.map +1 -0
  140. package/out/concepts/basics/stdlib/nasl.util.js +0 -29
  141. package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
  142. package/out/enums/KEYWORDS.js +1 -0
  143. package/out/enums/KEYWORDS.js.map +1 -1
  144. package/out/generator/genBundleFiles.js +98 -72
  145. package/out/generator/genBundleFiles.js.map +1 -1
  146. package/out/server/createUiTs.d.ts +1 -0
  147. package/out/server/createUiTs.js +15 -1
  148. package/out/server/createUiTs.js.map +1 -1
  149. package/out/server/getLogics.js +27 -45
  150. package/out/server/getLogics.js.map +1 -1
  151. package/out/server/getMemberIdentifier.js +3 -3
  152. package/out/server/getMemberIdentifier.js.map +1 -1
  153. package/out/server/getProcesses.d.ts +1 -1
  154. package/out/server/getProcesses.js +2 -2
  155. package/out/server/getProcesses.js.map +1 -1
  156. package/out/server/naslServer.d.ts +1 -3
  157. package/out/server/naslServer.js +73 -57
  158. package/out/server/naslServer.js.map +1 -1
  159. package/out/server/translator.d.ts +0 -3
  160. package/out/server/translator.js +16 -7
  161. package/out/server/translator.js.map +1 -1
  162. package/out/service/storage/init.js +21 -12
  163. package/out/service/storage/init.js.map +1 -1
  164. package/out/templator/genCreateBlock.js +3 -3
  165. package/out/templator/genCreateBlock.js.map +1 -1
  166. package/out/templator/genCurdEditMultipleKeyBlock.js +6 -10
  167. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  168. package/out/templator/genCurdMultipleKeyBlock.js +2 -2
  169. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  170. package/out/templator/genGetBlock.js +1 -1
  171. package/out/templator/genGetBlock.js.map +1 -1
  172. package/out/templator/genQueryComponent.d.ts +2 -0
  173. package/out/templator/genQueryComponent.js +1 -0
  174. package/out/templator/genQueryComponent.js.map +1 -1
  175. package/out/templator/genUpdateBlock.js +5 -5
  176. package/out/templator/genUpdateBlock.js.map +1 -1
  177. package/out/templator/utils.d.ts +3 -1
  178. package/out/templator/utils.js +2 -1
  179. package/out/templator/utils.js.map +1 -1
  180. package/package.json +1 -1
  181. package/src/automate/engine/index.js +1 -1
  182. package/src/common/BaseNode.ts +46 -42
  183. package/src/concepts/App__.ts +54 -12
  184. package/src/concepts/Argument__.ts +3 -2
  185. package/src/concepts/BinaryExpression__.ts +8 -6
  186. package/src/concepts/BindAttribute__.ts +26 -32
  187. package/src/concepts/BindDirective__.ts +24 -9
  188. package/src/concepts/BindEvent__.ts +25 -29
  189. package/src/concepts/CallFunction__.ts +11 -6
  190. package/src/concepts/CallInterface__.ts +11 -1
  191. package/src/concepts/CallLogic__.ts +21 -40
  192. package/src/concepts/CallQueryComponent__.ts +6 -10
  193. package/src/concepts/Comment__.ts +6 -2
  194. package/src/concepts/ConfigGroup__.ts +1 -1
  195. package/src/concepts/ConfigProperty__.ts +1 -1
  196. package/src/concepts/Configuration__.ts +1 -1
  197. package/src/concepts/Destination__.ts +9 -7
  198. package/src/concepts/EntityProperty__.ts +36 -0
  199. package/src/concepts/Entity__.ts +63 -50
  200. package/src/concepts/Enum__.ts +1 -1
  201. package/src/concepts/Event__.ts +1 -1
  202. package/src/concepts/ForEachStatement__.ts +8 -13
  203. package/src/concepts/Function__.ts +4 -4
  204. package/src/concepts/Identifier__.ts +15 -18
  205. package/src/concepts/IfStatement__.ts +2 -2
  206. package/src/concepts/InterfaceParam__.ts +11 -0
  207. package/src/concepts/Interface__.ts +3 -3
  208. package/src/concepts/LogicItem__.ts +15 -0
  209. package/src/concepts/Logic__.ts +34 -50
  210. package/src/concepts/Module__.ts +8 -8
  211. package/src/concepts/Namespace__.ts +12 -12
  212. package/src/concepts/Param__.ts +3 -0
  213. package/src/concepts/ProcessComponent__.ts +2 -2
  214. package/src/concepts/ProcessElement__.ts +5 -5
  215. package/src/concepts/ProcessOutcome__.ts +1 -1
  216. package/src/concepts/Process__.ts +4 -4
  217. package/src/concepts/QueryFromExpression__.ts +1 -1
  218. package/src/concepts/QueryJoinExpression__.ts +2 -2
  219. package/src/concepts/QuerySelectExpression__.ts +1 -1
  220. package/src/concepts/Return__.ts +6 -3
  221. package/src/concepts/StringLiteral__.ts +2 -2
  222. package/src/concepts/StructureProperty__.ts +36 -29
  223. package/src/concepts/Structure__.ts +3 -3
  224. package/src/concepts/SwitchCase__.ts +3 -3
  225. package/src/concepts/SwitchStatement__.ts +1 -1
  226. package/src/concepts/TypeAnnotation__.ts +8 -2
  227. package/src/concepts/UnaryExpression__.ts +1 -1
  228. package/src/concepts/ValidationRule__.ts +24 -1
  229. package/src/concepts/Variable__.ts +6 -3
  230. package/src/concepts/ViewComponent__.ts +5 -5
  231. package/src/concepts/ViewElement__.ts +183 -147
  232. package/src/concepts/View__.ts +30 -32
  233. package/src/concepts/WhileStatement__.ts +1 -1
  234. package/src/concepts/basics/stdlib/index.ts +3 -1
  235. package/src/concepts/basics/stdlib/nasl.auth.ts +35 -0
  236. package/src/concepts/basics/stdlib/nasl.browser.ts +7 -41
  237. package/src/concepts/basics/stdlib/nasl.configuration.ts +21 -0
  238. package/src/concepts/basics/stdlib/nasl.util.ts +0 -29
  239. package/src/enums/KEYWORDS.ts +1 -0
  240. package/src/generator/genBundleFiles.ts +102 -74
  241. package/src/server/createUiTs.ts +18 -3
  242. package/src/server/getLogics.ts +29 -47
  243. package/src/server/getMemberIdentifier.ts +3 -3
  244. package/src/server/getProcesses.ts +2 -2
  245. package/src/server/naslServer.ts +84 -62
  246. package/src/server/translator.ts +18 -6
  247. package/src/service/storage/init.ts +20 -13
  248. package/src/templator/genCreateBlock.ts +3 -3
  249. package/src/templator/genCurdEditMultipleKeyBlock.ts +22 -23
  250. package/src/templator/genCurdMultipleKeyBlock.ts +2 -2
  251. package/src/templator/genGetBlock.ts +1 -1
  252. package/src/templator/genQueryComponent.ts +1 -0
  253. package/src/templator/genUpdateBlock.ts +5 -6
  254. 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
- compileComponent(page.rootRoute);
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
- // if (config.env === 'dev') {
324
- // // 加载资源js
325
- // // const targetUrl = `${location.origin}/empty?url=${config.lowcodeDomain}&appid=${config.appid}`;
326
- // const domain = config.lowcodeDomain.slice(5);
327
- // const targetUrl = `${location.origin}/empty?url=${domain}&appid=${config.appid}`;
328
- // // const targetUrl = `http://defaulttenant.fafdafd.lcap.ha.dev.com:3000?url=${domain}&appid=${config.appid}`;
329
- // const str = `
330
- // if(!document.querySelector("iframe[name='iframeEmpty']")){
331
- // var el = document.createElement('iframe');
332
- // el.setAttribute('src', "${targetUrl}");
333
- // el.setAttribute('name', 'iframeEmpty');
334
- // el.setAttribute('width', 0);
335
- // el.setAttribute('height', 0);
336
- // el.style.borderWidth = 0
337
- // el.style.display= "block"
338
- // document.getElementsByTagName('body')[0].appendChild(el);
339
- // document.domain = '${domain}'
340
- // var _div = document.createElement('div');
341
- // _div.classList = "div-load"
342
- // _div.innerHTML = "<div>代码发布中</div><div class='loading-container'></div>"
343
- // document.getElementsByTagName('body')[0].appendChild(_div);
344
- // window.showLoading = function(){
345
- // document.querySelector(".div-load").style.display ="flex"
346
- // }
347
- // window.hideLoading = function(){
348
- // document.querySelector(".div-load").style.display ="none"
349
- // }
350
- // var style = document.createElement('style');
351
- // style.innerHTML=\`.loading-container{
352
- // width: 20px;
353
- // height: 20px;
354
- // margin-left: 20px;
355
- // animation: loading-animation 0.8s infinite linear;
356
- // display: inline-block;
357
- // border: 2px solid #f3f3f3;
358
- // border-top: 2px solid rgb(109, 108, 108);
359
- // border-radius: 50%;
360
- // }
361
- // .div-load{
362
- // display: flex;
363
- // align-items: center;
364
- // justify-content: center;
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
- // debugger;
391
- // const outputs: { [name: string]: string } = {};
392
- // const outputs =
393
- const bundlePath = `${config.USER_STATIC_URL}/${config.tenant}/${app.id}/${config.env}/bundle.${genHash(content)}.js`;
394
- // outputs[bundlePath] = content;
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
  }
@@ -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, params: any[]}) => {
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
  }
@@ -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.browser`,
125
- title: '系统',
126
- logics: [
127
- new Logic({
128
- name: 'requestFullscreen',
129
- params: [],
130
- body: [],
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 Logic({
133
- name: 'exitFullscreen',
134
- params: [],
135
- body: [],
134
+ new Namespace({
135
+ name: 'category',
136
+ path: `auth`,
137
+ title: '认证与权限',
138
+ logics: stdlibNamespace.findChild('auth').logics,
139
+ expanded: true,
136
140
  }),
137
- new Logic({
138
- name: 'hasAuth',
139
- params: [
140
- new Param({
141
- name: 'authPath',
142
- typeAnnotation: TypeAnnotation.createPrimitive('String'),
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?: string) {
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.browser',
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: '全局变量', children: globalVariable, expanded: true, icon: 'category' },
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;