@lcap/nasl 2.14.0 → 2.15.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.
Files changed (172) hide show
  1. package/out/automate/engine/index.js +2 -2
  2. package/out/automate/engine/index.js.map +1 -1
  3. package/out/automate/engine/viewCache.js +5 -5
  4. package/out/automate/engine/viewCache.js.map +1 -1
  5. package/out/common/BaseNode.js +3 -1
  6. package/out/common/BaseNode.js.map +1 -1
  7. package/out/concepts/AnonymousFunction__.d.ts +170 -0
  8. package/out/concepts/AnonymousFunction__.js +439 -0
  9. package/out/concepts/AnonymousFunction__.js.map +1 -0
  10. package/out/concepts/App__.js +7 -1
  11. package/out/concepts/App__.js.map +1 -1
  12. package/out/concepts/Assignee__.js +1 -1
  13. package/out/concepts/Assignee__.js.map +1 -1
  14. package/out/concepts/AssignmentLine__.d.ts +40 -0
  15. package/out/concepts/AssignmentLine__.js +109 -0
  16. package/out/concepts/AssignmentLine__.js.map +1 -0
  17. package/out/concepts/BatchAssignment__.d.ts +248 -0
  18. package/out/concepts/BatchAssignment__.js +742 -0
  19. package/out/concepts/BatchAssignment__.js.map +1 -0
  20. package/out/concepts/BindAttribute__.js +2 -0
  21. package/out/concepts/BindAttribute__.js.map +1 -1
  22. package/out/concepts/BindEvent__.js +9 -4
  23. package/out/concepts/BindEvent__.js.map +1 -1
  24. package/out/concepts/BindStyle__.d.ts +126 -0
  25. package/out/concepts/BindStyle__.js +233 -0
  26. package/out/concepts/BindStyle__.js.map +1 -0
  27. package/out/concepts/CallLogic__.js +3 -4
  28. package/out/concepts/CallLogic__.js.map +1 -1
  29. package/out/concepts/CallQueryComponent__.d.ts +1 -1
  30. package/out/concepts/ConstructArgument__.d.ts +40 -0
  31. package/out/concepts/ConstructArgument__.js +108 -0
  32. package/out/concepts/ConstructArgument__.js.map +1 -0
  33. package/out/concepts/Construct__.d.ts +189 -0
  34. package/out/concepts/Construct__.js +340 -0
  35. package/out/concepts/Construct__.js.map +1 -0
  36. package/out/concepts/EnumItem__.js +1 -1
  37. package/out/concepts/EnumItem__.js.map +1 -1
  38. package/out/concepts/Interface__.d.ts +1 -0
  39. package/out/concepts/Interface__.js +58 -0
  40. package/out/concepts/Interface__.js.map +1 -1
  41. package/out/concepts/Logic__.js +3 -3
  42. package/out/concepts/Logic__.js.map +1 -1
  43. package/out/concepts/MatchCase__.d.ts +256 -0
  44. package/out/concepts/MatchCase__.js +584 -0
  45. package/out/concepts/MatchCase__.js.map +1 -0
  46. package/out/concepts/Match__.d.ts +117 -0
  47. package/out/concepts/Match__.js +434 -0
  48. package/out/concepts/Match__.js.map +1 -0
  49. package/out/concepts/OqlQueryComponent__.d.ts +73 -0
  50. package/out/concepts/OqlQueryComponent__.js +395 -0
  51. package/out/concepts/OqlQueryComponent__.js.map +1 -0
  52. package/out/concepts/ProcessElement__.d.ts +2 -2
  53. package/out/concepts/ProcessElement__.js +30 -21
  54. package/out/concepts/ProcessElement__.js.map +1 -1
  55. package/out/concepts/Process__.d.ts +81 -0
  56. package/out/concepts/Process__.js +98 -2
  57. package/out/concepts/Process__.js.map +1 -1
  58. package/out/concepts/SelectMembers__.d.ts +141 -0
  59. package/out/concepts/SelectMembers__.js +290 -0
  60. package/out/concepts/SelectMembers__.js.map +1 -0
  61. package/out/concepts/SqlQueryComponent__.d.ts +4 -0
  62. package/out/concepts/SqlQueryComponent__.js +144 -2
  63. package/out/concepts/SqlQueryComponent__.js.map +1 -1
  64. package/out/concepts/Variable__.js +0 -1
  65. package/out/concepts/Variable__.js.map +1 -1
  66. package/out/concepts/ViewElement__.js +10 -1
  67. package/out/concepts/ViewElement__.js.map +1 -1
  68. package/out/concepts/View__.js +4 -1
  69. package/out/concepts/View__.js.map +1 -1
  70. package/out/concepts/basics/stdlib/index.js +2 -1
  71. package/out/concepts/basics/stdlib/index.js.map +1 -1
  72. package/out/concepts/basics/stdlib/nasl.auth.js +26 -0
  73. package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -1
  74. package/out/concepts/basics/stdlib/nasl.process.js +98 -0
  75. package/out/concepts/basics/stdlib/nasl.process.js.map +1 -1
  76. package/out/concepts/basics/stdlib/nasl.ui.js +54 -0
  77. package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
  78. package/out/concepts/basics/stdlib/nasl.util.js +2 -2
  79. package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
  80. package/out/concepts/basics/stdlib/nasl.validation.js +4 -0
  81. package/out/concepts/basics/stdlib/nasl.validation.js.map +1 -1
  82. package/out/enums/KEYWORDS.js +1 -0
  83. package/out/enums/KEYWORDS.js.map +1 -1
  84. package/out/generator/genBundleFiles.d.ts +1 -0
  85. package/out/generator/genBundleFiles.js +2 -0
  86. package/out/generator/genBundleFiles.js.map +1 -1
  87. package/out/server/extendBaseNode.js +32 -4
  88. package/out/server/extendBaseNode.js.map +1 -1
  89. package/out/server/getLogics.js +42 -14
  90. package/out/server/getLogics.js.map +1 -1
  91. package/out/server/getProcesses.d.ts +2 -2
  92. package/out/server/getProcesses.js +47 -21
  93. package/out/server/getProcesses.js.map +1 -1
  94. package/out/server/naslServer.js +46 -19
  95. package/out/server/naslServer.js.map +1 -1
  96. package/out/server/naslStdlibMap.js +1 -0
  97. package/out/server/naslStdlibMap.js.map +1 -1
  98. package/out/server/process2LogicNamespace.js +25 -21
  99. package/out/server/process2LogicNamespace.js.map +1 -1
  100. package/out/server/translator.js +35 -8
  101. package/out/server/translator.js.map +1 -1
  102. package/out/service/logic/api.d.ts +9 -0
  103. package/out/service/logic/api.js +11 -0
  104. package/out/service/logic/api.js.map +1 -0
  105. package/out/service/logic/index.d.ts +2 -0
  106. package/out/service/logic/index.js +10 -0
  107. package/out/service/logic/index.js.map +1 -0
  108. package/out/service/storage/init.js +18 -6
  109. package/out/service/storage/init.js.map +1 -1
  110. package/out/templator/genCreateBlock.js +1 -1
  111. package/out/templator/genCreateBlock.js.map +1 -1
  112. package/out/templator/genCurdEditMultipleKeyBlock.js +4 -5
  113. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  114. package/out/templator/genCurdMultipleKeyBlock.js +4 -4
  115. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  116. package/out/templator/genEditTableBlock.js +5 -3
  117. package/out/templator/genEditTableBlock.js.map +1 -1
  118. package/out/templator/genGetBlock.js +3 -2
  119. package/out/templator/genGetBlock.js.map +1 -1
  120. package/out/templator/genTableBlock.js +4 -2
  121. package/out/templator/genTableBlock.js.map +1 -1
  122. package/out/templator/genUpdateBlock.js +1 -1
  123. package/out/templator/genUpdateBlock.js.map +1 -1
  124. package/out/templator/sql-parser/index.d.ts +1 -0
  125. package/out/templator/sql-parser/index.js +228 -0
  126. package/out/templator/sql-parser/index.js.map +1 -0
  127. package/out/templator/sql-parser/parser.js +26664 -0
  128. package/out/templator/sql-parser/parser.js.map +1 -0
  129. package/package.json +1 -1
  130. package/src/automate/engine/index.js +1 -1
  131. package/src/automate/engine/viewCache.js +23 -23
  132. package/src/automate/template/myProcess.js +12295 -0
  133. package/src/common/BaseNode.ts +5 -1
  134. package/src/concepts/App__.ts +8 -1
  135. package/src/concepts/Assignee__.ts +1 -1
  136. package/src/concepts/BindAttribute__.ts +3 -1
  137. package/src/concepts/BindEvent__.ts +8 -4
  138. package/src/concepts/CallLogic__.ts +3 -4
  139. package/src/concepts/EnumItem__.ts +1 -1
  140. package/src/concepts/Interface__.ts +66 -7
  141. package/src/concepts/Logic__.ts +3 -3
  142. package/src/concepts/ProcessElement__.ts +34 -24
  143. package/src/concepts/Process__.ts +98 -2
  144. package/src/concepts/SqlQueryComponent__.ts +143 -2
  145. package/src/concepts/Variable__.ts +0 -1
  146. package/src/concepts/ViewElement__.ts +12 -20
  147. package/src/concepts/View__.ts +4 -1
  148. package/src/concepts/basics/stdlib/index.ts +2 -1
  149. package/src/concepts/basics/stdlib/nasl.auth.ts +25 -0
  150. package/src/concepts/basics/stdlib/nasl.io.ts +48 -0
  151. package/src/concepts/basics/stdlib/nasl.process.ts +98 -0
  152. package/src/concepts/basics/stdlib/nasl.ui.ts +54 -0
  153. package/src/concepts/basics/stdlib/nasl.util.ts +2 -2
  154. package/src/concepts/basics/stdlib/nasl.validation.ts +4 -0
  155. package/src/enums/KEYWORDS.ts +1 -0
  156. package/src/generator/genBundleFiles.ts +3 -0
  157. package/src/server/extendBaseNode.ts +31 -4
  158. package/src/server/getLogics.ts +43 -14
  159. package/src/server/getProcesses.ts +47 -21
  160. package/src/server/naslServer.ts +44 -21
  161. package/src/server/naslStdlibMap.ts +1 -0
  162. package/src/server/process2LogicNamespace.ts +27 -21
  163. package/src/server/translator.ts +35 -8
  164. package/src/service/storage/init.ts +18 -6
  165. package/src/templator/genCreateBlock.ts +1 -1
  166. package/src/templator/genCurdEditMultipleKeyBlock.ts +4 -7
  167. package/src/templator/genCurdMultipleKeyBlock.ts +4 -4
  168. package/src/templator/genEditTableBlock.ts +5 -3
  169. package/src/templator/genGetBlock.ts +3 -2
  170. package/src/templator/genTableBlock.ts +4 -2
  171. package/src/templator/genUpdateBlock.ts +1 -1
  172. package/src/automate/template/process.js +0 -11810
@@ -1,4 +1,7 @@
1
1
  import { TranslatorState, shiftState, withSourceMap, indent } from '../translator';
2
+ import { getNodeByNodeCallee, getNaslNodeByNodeCallee } from '../automate/engine/utils';
3
+ import StructureProperty from './StructureProperty__';
4
+
2
5
  //================================================================================
3
6
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
4
7
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -151,6 +154,142 @@ export class SqlQueryComponent extends LogicItem {
151
154
  });
152
155
  }
153
156
 
157
+ getVariableTs(state?: TranslatorState) {
158
+ const str = this.code;
159
+ const variables = [];
160
+ let code = '';
161
+ let temp: any;
162
+ const re = /(\#|\$)\{(.+?)\}/g;
163
+ while (temp = re.exec(str)) {
164
+ variables.push(temp[2]);
165
+ }
166
+ variables.forEach((variable: String) => {
167
+ const content = variable.replaceAll(' ', '');
168
+ code += indent((state?.tabSize || 0) + 2);
169
+ code += content + ';\n';
170
+ });
171
+ return code;
172
+ }
173
+
174
+ getTypeBanError() {
175
+ let sqlTypeBan = false;
176
+ if (this.typeAnnotation) {
177
+ const getSqlTypeBan = (typeAnnotation: TypeAnnotation) => {
178
+ const ref = this.getSelectRef(typeAnnotation);
179
+ if (ref?.length) {
180
+ ref.forEach((item: StructureProperty) => {
181
+ // 如果有类型但是类型不是基本类型,就需要打开开关,注入变量
182
+ if (item?.typeAnnotation && item.typeAnnotation.typeNamespace !== 'nasl.core' && !(item.typeAnnotation.typeNamespace.endsWith('.enums'))) {
183
+ sqlTypeBan = true;
184
+ }
185
+ });
186
+ }
187
+ };
188
+ if (this.typeAnnotation.typeArguments?.length) {
189
+ // list 就去校验一下内部的类型
190
+ if (this.typeAnnotation.typeName === 'List') {
191
+ this.typeAnnotation.typeArguments.forEach((item) => {
192
+ getSqlTypeBan(item);
193
+ });
194
+ } else {
195
+ // 别的都不放开
196
+ sqlTypeBan = true;
197
+ }
198
+ } else {
199
+ getSqlTypeBan(this.typeAnnotation);
200
+ }
201
+ }
202
+ return sqlTypeBan;
203
+ }
204
+ getQueryComponentTsCode(state?: TranslatorState):string {
205
+ let tsCode = '';
206
+ // let sqlParser: null | any = null;
207
+ // let sqlParserErr: null | any = null;
208
+
209
+ if (!this.code)
210
+ return tsCode;
211
+ /**
212
+ * 处理变量,因为解析code,因为sql中不支持
213
+ * #{变量}这种写法
214
+ * 而且不支持a.b.c这种写法保留前两个,翻译的时候补上去
215
+ * 如果是多个.链接的变量就转换成nasl变量,让他可以翻译,等后面在把值换回来
216
+ */
217
+
218
+ /**
219
+ try {
220
+ const newCode = this.code.replace(/\#|\$\{(.+?)\}/g, (value, content) => {
221
+ console.log(content)
222
+ const len = content.split('.').length;
223
+ console.log(len, content, content.split('.'), content, content.split('.').length)
224
+ if (len > 2) {
225
+ return '__NASL__SQL__' + content.replaceAll('.', '_');
226
+ }
227
+ return content;
228
+ });
229
+ console.log(newCode);
230
+ // 生成对应的sqlts 和 产生sourceMap对应
231
+ sqlParser = SQLParser(newCode || '', 0, this.dataSource);
232
+ } catch (err) {
233
+ sqlParserErr = err;
234
+ }
235
+ console.log(sqlParser, sqlParserErr);
236
+ if (sqlParserErr) {
237
+ tsCode += '__SQL_GRAMMAR_ERROR__';
238
+ } else if (sqlParser) {
239
+ // 解析内部变量,先看是不是未知变量
240
+ // 使用 tableList 和 columnList
241
+ tsCode += this.getContentVariable(sqlParser, state);
242
+ }
243
+ */
244
+
245
+ try {
246
+ tsCode += this.getVariableTs(state);
247
+ } catch (err) {
248
+ console.log(err);
249
+ }
250
+ return tsCode;
251
+ }
252
+
253
+ getSelectRef(newTypeAnnotation: TypeAnnotation) {
254
+ try {
255
+ const { typeName, typeKind, typeNamespace } = newTypeAnnotation || this.typeAnnotation;
256
+ let completionChildren;
257
+ if (typeKind === 'reference') {
258
+ if (typeNamespace === 'nasl.ui' || typeNamespace === 'nasl.process') {
259
+ const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
260
+ const properties = node.properties || [];
261
+ completionChildren = properties;
262
+ } else if (typeNamespace.endsWith('.enums')) {
263
+ completionChildren = undefined;
264
+ } else {
265
+ const node = getNodeByNodeCallee(this.app, typeNamespace + '.' + typeName);
266
+ const properties = node.properties || [];
267
+ completionChildren = properties;
268
+ }
269
+ } else if (typeKind === 'generic') {
270
+ // if (typeNamespace === 'nasl.collection' || typeNamespace === 'nasl.ui' || typeNamespace === 'nasl.interface') {
271
+ // }
272
+ const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
273
+ const properties = [...node.properties] || [];
274
+ for (let i = 0; i < properties.length; i++) {
275
+ const item = properties[i];
276
+ if (item?.typeAnnotation?.typeKind === 'typeParam') {
277
+ const newItem = StructureProperty.from(item.toJSON());
278
+ newItem.typeAnnotation = this?.typeAnnotation?.typeArguments[0];
279
+ newItem.parentNode = this;
280
+ properties[i] = newItem;
281
+ }
282
+ }
283
+ completionChildren = properties;
284
+ } else {
285
+ completionChildren = undefined;
286
+ }
287
+ return completionChildren;
288
+ } catch (err) {
289
+ console.log(err);
290
+ }
291
+ }
292
+
154
293
  @withSourceMap()
155
294
  toEmbeddedTS(state?: TranslatorState): string {
156
295
  let code;
@@ -164,11 +303,13 @@ export class SqlQueryComponent extends LogicItem {
164
303
  // app.dataSources.defaultDS;
165
304
  if (this.dataSource) {
166
305
  code += indent((state?.tabSize || 0) + 1);
167
- code += `const dataSource = app.dataSources.${this.dataSource};`;
306
+ code += `const dataSource = app.dataSources.${this.dataSource};\n`;
168
307
  }
308
+ // 生成内部的ts内容
309
+ code += this.getQueryComponentTsCode(state);
169
310
  code += '\n';
170
311
  code += indent((state?.tabSize || 0) + 1) + 'return;\n';
171
- code += indent((state?.tabSize || 0)) + '})();\n';
312
+ code += indent((state?.tabSize || 0)) + '})()';
172
313
  return code;
173
314
  }
174
315
 
@@ -238,7 +238,6 @@ export class Variable extends BaseNode {
238
238
  code += ': ';
239
239
  code += this.typeAnnotation.toEmbeddedTS(shiftState(state, code));
240
240
  }
241
- code += ';';
242
241
  return code;
243
242
  }
244
243
 
@@ -301,8 +301,6 @@ export class ViewElement extends BaseNode {
301
301
  super.subConstructor(source);
302
302
  }
303
303
 
304
-
305
-
306
304
  /**
307
305
  * 从父级删除该节点
308
306
  * @internal
@@ -351,7 +349,7 @@ export class ViewElement extends BaseNode {
351
349
  });
352
350
  }
353
351
 
354
- getBindAttributeExistingNames(excludedList: Array<BindAttribute> = []) {
352
+ getBindAttributeExistingNames(excludedList: Array<BindAttribute> = []) {
355
353
  const excludedSet = new Set(excludedList);
356
354
  return (this.bindAttrs || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
357
355
  }
@@ -492,7 +490,6 @@ export class ViewElement extends BaseNode {
492
490
  return node;
493
491
  }
494
492
 
495
-
496
493
  getBindEventExistingNames(excludedList: Array<BindEvent> = []) {
497
494
  const excludedSet = new Set(excludedList);
498
495
  return (this.bindEvents || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
@@ -634,7 +631,6 @@ export class ViewElement extends BaseNode {
634
631
  return node;
635
632
  }
636
633
 
637
-
638
634
  getBindDirectiveExistingNames(excludedList: Array<BindDirective> = []) {
639
635
  const excludedSet = new Set(excludedList);
640
636
  return (this.bindDirectives || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
@@ -776,11 +772,6 @@ export class ViewElement extends BaseNode {
776
772
  return node;
777
773
  }
778
774
 
779
-
780
-
781
-
782
-
783
-
784
775
  /**
785
776
  * 插入页面元素
786
777
  * @internal
@@ -914,9 +905,6 @@ export class ViewElement extends BaseNode {
914
905
  return node;
915
906
  }
916
907
 
917
-
918
-
919
-
920
908
  /**
921
909
  * 删除元素绑定属性
922
910
  * @param name 元素绑定属性名称
@@ -965,8 +953,6 @@ export class ViewElement extends BaseNode {
965
953
  return params;
966
954
  }
967
955
 
968
-
969
-
970
956
  /**
971
957
  * 删除元素绑定事件
972
958
  * @param name 元素绑定事件名称
@@ -1015,8 +1001,6 @@ export class ViewElement extends BaseNode {
1015
1001
  return params;
1016
1002
  }
1017
1003
 
1018
-
1019
-
1020
1004
  /**
1021
1005
  * 删除元素指令
1022
1006
  * @param name 元素指令名称
@@ -1065,8 +1049,6 @@ export class ViewElement extends BaseNode {
1065
1049
  return params;
1066
1050
  }
1067
1051
 
1068
-
1069
-
1070
1052
  /**
1071
1053
  * 删除页面元素
1072
1054
  * @param name 页面元素名称
@@ -1715,7 +1697,9 @@ export class ViewElement extends BaseNode {
1715
1697
  const emptySlot = api && api.slots && api.slots.find((slot) => slot.name === 'default' && slot['empty-background']);
1716
1698
  const hasSupport = api && api.slots && api.slots.some((slot) => slot.support);
1717
1699
  if (emptySlot || hasSupport) {
1718
- let childEmpty = !el.children.length;
1700
+ // 有些限制的组件如侧边栏分组有title插槽但要限制子元素放入
1701
+ const validChildren = el.children.filter((elem) => !(elem.tag === 'template' && elem.slotTarget !== 'default'));
1702
+ let childEmpty = !validChildren.length;
1719
1703
  const defaultSlot = el.children.find((elem) => elem.tag === 'template' && elem.slotTarget === 'default');
1720
1704
  if (defaultSlot) {
1721
1705
  childEmpty = !defaultSlot.children.length;
@@ -1803,6 +1787,14 @@ export class ViewElement extends BaseNode {
1803
1787
  });
1804
1788
  newOptions.getExtraParts(this).forEach((part) => parts.push(part));
1805
1789
 
1790
+ if (['u-modal', 'u-drawer'].includes(this.tag)) {
1791
+ this.children.forEach((citem) => {
1792
+ if (citem.tag === 'template' && !citem.children.length) {
1793
+ parts.push(`:is-${citem.slotTarget}-slot-empty=true`);
1794
+ }
1795
+ });
1796
+ }
1797
+
1806
1798
  let partsLength = 0;
1807
1799
  let partsString = '';
1808
1800
  parts.forEach((part) => {
@@ -1431,8 +1431,11 @@ export class View extends BaseNode {
1431
1431
  });
1432
1432
  }
1433
1433
 
1434
+ // 获取当前页面的所有组件的名字
1434
1435
  getViewElementExistingNames(excludedList: Array<ViewElement> = []) {
1435
- const excludedSet = new Set(excludedList);
1436
+ if (!this.existingViewElement.size) {
1437
+ this.collectExistingViewElementName();
1438
+ }
1436
1439
  return Array.from(this.existingViewElement);
1437
1440
  }
1438
1441
 
@@ -13,11 +13,12 @@ import naslBrowser from './nasl.browser';
13
13
  import naslAuth from './nasl.auth';
14
14
  import naslConfiguration from './nasl.configuration';
15
15
  import naslLogging from './nasl.logging';
16
+ import naslIo from './nasl.io';
16
17
 
17
18
  export { reference2TypeAnnotationList } from './reference2TypeAnnotationList';
18
19
  export const stdlibNamespace = new Namespace({
19
20
  name: 'nasl',
20
21
  path: 'nasl',
21
- children: [naslCore, naslCollection, naslInterface, naslUi, naslUtil, naslProcess, naslValidation, naslBrowser, naslAuth, naslConfiguration, naslLogging],
22
+ children: [naslCore, naslCollection, naslInterface, naslUi, naslUtil, naslProcess, naslValidation, naslBrowser, naslAuth, naslConfiguration, naslLogging, naslIo],
22
23
  });
23
24
  export default stdlibNamespace;
@@ -42,5 +42,30 @@ export default new Namespace({
42
42
  ],
43
43
  returns: [],
44
44
  }),
45
+ new Logic({
46
+ name: 'getProcessStartBy',
47
+ params: [
48
+ new Param({
49
+ name: 'userNameFilter',
50
+ typeAnnotation: TypeAnnotation.createPrimitive('String'),
51
+ }),
52
+ new Param({
53
+ name: 'limit',
54
+ typeAnnotation: TypeAnnotation.createPrimitive('Long'),
55
+ }),
56
+ new Param({
57
+ name: 'offset',
58
+ typeAnnotation: TypeAnnotation.createPrimitive('Long'),
59
+ }),
60
+ ],
61
+ returns: [
62
+ new Return({
63
+ name: 'result',
64
+ typeAnnotation: TypeAnnotation.createGeneric('List', {
65
+ typeArguments: [TypeAnnotation.createTypeParam('T')],
66
+ }),
67
+ }),
68
+ ],
69
+ }),
45
70
  ],
46
71
  });
@@ -0,0 +1,48 @@
1
+ import Namespace from '../../Namespace__';
2
+ import Param from '../../Param__';
3
+ import Return from '../../Return__';
4
+ import Logic from '../../Logic__';
5
+ import TypeAnnotation from '../../TypeAnnotation__';
6
+ import StringLiteral from '../../StringLiteral__';
7
+
8
+ export default new Namespace({
9
+ name: 'io',
10
+ logics: [
11
+ new Logic({
12
+ name: 'downloadFile',
13
+ params: [
14
+ new Param({
15
+ name: 'url',
16
+ typeAnnotation: TypeAnnotation.createPrimitive('String'),
17
+ required: true,
18
+ }),
19
+ new Param({
20
+ name: 'fileName',
21
+ typeAnnotation: TypeAnnotation.createPrimitive('String'),
22
+ defaultExpression: new StringLiteral({ value: '' }),
23
+ required: false,
24
+ }),
25
+ ],
26
+ body: [],
27
+ }),
28
+ new Logic({
29
+ name: 'downloadFiles',
30
+ params: [
31
+ new Param({
32
+ name: 'urlList',
33
+ typeAnnotation: TypeAnnotation.createGeneric('List', {
34
+ typeArguments: [TypeAnnotation.createTypeParam('T')],
35
+ }),
36
+ required: true,
37
+ }),
38
+ new Param({
39
+ name: 'fileName',
40
+ typeAnnotation: TypeAnnotation.createPrimitive('String'),
41
+ defaultExpression: new StringLiteral({ value: '' }),
42
+ required: false,
43
+ }),
44
+ ],
45
+ body: [],
46
+ }),
47
+ ],
48
+ });
@@ -16,6 +16,7 @@ import { reference2TypeAnnotationList } from './reference2TypeAnnotationList';
16
16
  const logics = [
17
17
  new Logic({
18
18
  name: 'getProcessDefinitionList',
19
+ description: '获取流程定义列表',
19
20
  params: [],
20
21
  returns: [
21
22
  new Return({
@@ -27,6 +28,7 @@ const logics = [
27
28
  }),
28
29
  new Logic({
29
30
  name: 'getProcessDefinition',
31
+ description: '获取流程定义的详情,如流程标题',
30
32
  params: [
31
33
  new Param({
32
34
  name: 'name',
@@ -42,6 +44,7 @@ const logics = [
42
44
  }),
43
45
  new Logic({
44
46
  name: 'getProcessInstance',
47
+ description: '获取流程详情,如发起人、时间',
45
48
  params: [
46
49
  new Param({
47
50
  name: 'processId',
@@ -57,6 +60,7 @@ const logics = [
57
60
  }),
58
61
  new Logic({
59
62
  name: 'getProcessInstanceList',
63
+ description: '获取流程列表',
60
64
  params: [
61
65
  new Param({
62
66
  name: 'processId',
@@ -118,6 +122,7 @@ const logics = [
118
122
  }),
119
123
  new Logic({
120
124
  name: 'getTaskDefinitionList',
125
+ description: '获取任务定义列表',
121
126
  params: [
122
127
  new Param({
123
128
  name: 'processDefName',
@@ -135,6 +140,7 @@ const logics = [
135
140
  }),
136
141
  new Logic({
137
142
  name: 'getTaskDefinition',
143
+ description: '获取任务定义的详情,如任务标题',
138
144
  params: [
139
145
  new Param({
140
146
  name: 'name',
@@ -154,6 +160,7 @@ const logics = [
154
160
  }),
155
161
  new Logic({
156
162
  name: 'getTaskInstance',
163
+ description: '获取任务详情,如状态、完成人',
157
164
  params: [
158
165
  new Param({
159
166
  name: 'taskId',
@@ -169,6 +176,7 @@ const logics = [
169
176
  }),
170
177
  new Logic({
171
178
  name: 'getTaskInstanceList',
179
+ description: '获取流程任务列表',
172
180
  params: [
173
181
  new Param({
174
182
  name: 'taskId',
@@ -243,6 +251,7 @@ const logics = [
243
251
  }),
244
252
  new Logic({
245
253
  name: 'claimTaskInstance',
254
+ description: '认领流程任务',
246
255
  params: [
247
256
  new Param({
248
257
  name: 'taskId',
@@ -262,6 +271,7 @@ const logics = [
262
271
  }),
263
272
  new Logic({
264
273
  name: 'unclaimTaskInstance',
274
+ description: '取消认领流程任务',
265
275
  params: [
266
276
  new Param({
267
277
  name: 'taskId',
@@ -277,6 +287,7 @@ const logics = [
277
287
  }),
278
288
  new Logic({
279
289
  name: 'getTaskDestinationUrl',
290
+ description: '获取任务审批页跳转链接',
280
291
  params: [
281
292
  new Param({
282
293
  name: 'taskId',
@@ -290,6 +301,76 @@ const logics = [
290
301
  }),
291
302
  ],
292
303
  }),
304
+ new Logic({
305
+ name: 'transferTaskInstance',
306
+ description: '将任务审批人转交给其他人',
307
+ params: [
308
+ new Param({
309
+ name: 'taskId',
310
+ typeAnnotation: TypeAnnotation.createPrimitive('String'),
311
+ }),
312
+ new Param({
313
+ name: 'userName',
314
+ typeAnnotation: TypeAnnotation.createPrimitive('String'),
315
+ }),
316
+ ],
317
+ returns: [
318
+ new Return({
319
+ name: 'result',
320
+ typeAnnotation: TypeAnnotation.createTypeParam('T'),
321
+ }),
322
+ ],
323
+ }),
324
+ new Logic({
325
+ name: 'withdrawProcessInstance',
326
+ description: '撤回流程,仅发起人可撤回',
327
+ params: [
328
+ new Param({
329
+ name: 'processId',
330
+ typeAnnotation: TypeAnnotation.createPrimitive('String'),
331
+ }),
332
+ ],
333
+ returns: [
334
+ new Return({
335
+ name: 'result',
336
+ typeAnnotation: TypeAnnotation.createTypeParam('T'),
337
+ }),
338
+ ],
339
+ }),
340
+ new Logic({
341
+ name: 'endProcessInstance',
342
+ description: '结束流程,仅发起人可结束',
343
+ params: [
344
+ new Param({
345
+ name: 'processId',
346
+ typeAnnotation: TypeAnnotation.createTypeParam('T'),
347
+ }),
348
+ ],
349
+ returns: [
350
+ new Return({
351
+ name: 'result',
352
+ typeAnnotation: TypeAnnotation.createPrimitive('String'),
353
+ }),
354
+ ],
355
+ }),
356
+ new Logic({
357
+ name: 'getRejectableTaskDefinitionList',
358
+ description: '获取可驳回的任务定义列表',
359
+ params: [
360
+ new Param({
361
+ name: 'taskId',
362
+ typeAnnotation: TypeAnnotation.createPrimitive('String'),
363
+ }),
364
+ ],
365
+ returns: [
366
+ new Return({
367
+ name: 'result',
368
+ typeAnnotation: TypeAnnotation.createGeneric('List', {
369
+ typeArguments: [TypeAnnotation.createTypeParam('T')],
370
+ }),
371
+ }),
372
+ ],
373
+ }),
293
374
  ];
294
375
 
295
376
  export const processStructures = [
@@ -413,6 +494,23 @@ export const processStructures = [
413
494
  }),
414
495
  ],
415
496
  }),
497
+ new Structure({
498
+ name: 'LCAPOperateProcessResult',
499
+ properties: [
500
+ new StructureProperty({
501
+ name: 'success',
502
+ typeAnnotation: TypeAnnotation.createPrimitive('Boolean'),
503
+ }),
504
+ new StructureProperty({
505
+ name: 'failMessage',
506
+ typeAnnotation: TypeAnnotation.createPrimitive('String'),
507
+ }),
508
+ new StructureProperty({
509
+ name: 'code',
510
+ typeAnnotation: TypeAnnotation.createPrimitive('String'),
511
+ }),
512
+ ],
513
+ }),
416
514
  ];
417
515
 
418
516
  export const processTypeList: Array<TypeAnnotation> = reference2TypeAnnotationList(processStructures, 'nasl.process');
@@ -821,6 +821,60 @@ export const uiStructures = [
821
821
  }),
822
822
  ],
823
823
  }),
824
+ new Structure({
825
+ name: 'SelectData',
826
+ typeParams: [
827
+ new TypeParam({
828
+ name: 'T',
829
+ }),
830
+ ],
831
+ properties: [
832
+ new StructureProperty({
833
+ name: 'parent',
834
+ typeAnnotation: TypeAnnotation.createTypeParam('T'),
835
+ }),
836
+ new StructureProperty({
837
+ name: 'item',
838
+ typeAnnotation: TypeAnnotation.createTypeParam('T'),
839
+ }),
840
+ new StructureProperty({
841
+ name: 'path',
842
+ typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
843
+ }),
844
+ ],
845
+ }),
846
+ new Structure({
847
+ name: 'DragAndDropEvent',
848
+ typeParams: [
849
+ new TypeParam({
850
+ name: 'T',
851
+ }),
852
+ ],
853
+ properties: [
854
+ new StructureProperty({
855
+ name: 'source',
856
+ typeAnnotation: TypeAnnotation.createReference('SelectData', {
857
+ typeNamespace: 'nasl.ui',
858
+ }),
859
+ }),
860
+ new StructureProperty({
861
+ name: 'target',
862
+ typeAnnotation: TypeAnnotation.createReference('SelectData', {
863
+ typeNamespace: 'nasl.ui',
864
+ }),
865
+ }),
866
+ new StructureProperty({
867
+ name: 'position',
868
+ typeAnnotation: TypeAnnotation.createPrimitive('String'),
869
+ }),
870
+ new StructureProperty({
871
+ name: 'list',
872
+ typeAnnotation: TypeAnnotation.createGeneric('List', {
873
+ typeArguments: [TypeAnnotation.createTypeParam('T')],
874
+ }),
875
+ }),
876
+ ],
877
+ }),
824
878
  ];
825
879
 
826
880
  export const uiTypeList: Array<TypeAnnotation> = reference2TypeAnnotationList(uiStructures, 'nasl.ui');
@@ -104,7 +104,7 @@ export default new Namespace({
104
104
 
105
105
  new Param({
106
106
  name: 'ignoreCase',
107
- description: '计算类型。如选择天数,则计算前两个参数的天数差值。',
107
+ description: '是否忽略大小写',
108
108
  defaultExpression: new BooleanLiteral({ value: 'true' }),
109
109
  options: [
110
110
  { text: 'true', value: 'true' },
@@ -132,7 +132,7 @@ export default new Namespace({
132
132
  }),
133
133
  new Param({
134
134
  name: 'ignoreCase',
135
- description: '计算类型。如选择天数,则计算前两个参数的天数差值。',
135
+ description: '是否忽略大小写',
136
136
  defaultExpression: new BooleanLiteral({ value: 'false' }),
137
137
  options: [
138
138
  { text: 'true', value: 'true' },
@@ -348,6 +348,10 @@ export default new Namespace({
348
348
  ...[
349
349
  'boolean',
350
350
  'array',
351
+ 'function',
352
+ 'object',
353
+ 'plainObject',
354
+ '^az09-_$',
351
355
  'alpha',
352
356
  'alphaNum',
353
357
  'alphaDash',
@@ -23,6 +23,7 @@ export const KEYWORDS = [
23
23
  'catch',
24
24
  'char',
25
25
  'class',
26
+ 'code',
26
27
  'collection',
27
28
  'com',
28
29
  'component',