@lcap/nasl 0.3.12-beta.2 → 0.3.13-beta

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 (41) hide show
  1. package/out/service/create/index.js +2 -2
  2. package/out/service/create/index.js.map +1 -1
  3. package/out/types/app/App.js +11 -2
  4. package/out/types/app/App.js.map +1 -1
  5. package/out/types/app/Service.js +36 -1
  6. package/out/types/app/Service.js.map +1 -1
  7. package/out/types/data/Entity.d.ts +8 -0
  8. package/out/types/data/Entity.js +15 -0
  9. package/out/types/data/Entity.js.map +1 -1
  10. package/out/types/data/dataTypes.d.ts +1 -1
  11. package/out/types/data/dataTypes.js +23 -6
  12. package/out/types/data/dataTypes.js.map +1 -1
  13. package/out/types/data/genBlock/builtInFunctions.json +15 -0
  14. package/out/types/data/genericTypes.d.ts +1 -1
  15. package/out/types/data/genericTypes.js +6 -2
  16. package/out/types/data/genericTypes.js.map +1 -1
  17. package/out/types/data/systemTypes.js +73 -0
  18. package/out/types/data/systemTypes.js.map +1 -1
  19. package/out/types/logic/translator.js +1 -1
  20. package/out/types/logic/translator.js.map +1 -1
  21. package/out/types/page/Page.js +7 -0
  22. package/out/types/page/Page.js.map +1 -1
  23. package/out/types/page/View.js +21 -0
  24. package/out/types/page/View.js.map +1 -1
  25. package/out/types/typeCheck.js +7 -2
  26. package/out/types/typeCheck.js.map +1 -1
  27. package/package.json +2 -1
  28. package/src/service/config/api.js +32 -0
  29. package/src/service/config/index.js +6 -0
  30. package/src/service/create/index.js +2 -2
  31. package/src/types/app/App.ts +13 -3
  32. package/src/types/app/Service.ts +36 -1
  33. package/src/types/data/Entity.ts +14 -0
  34. package/src/types/data/dataTypes.ts +26 -6
  35. package/src/types/data/genBlock/builtInFunctions.json +17 -2
  36. package/src/types/data/genericTypes.ts +6 -2
  37. package/src/types/data/systemTypes.ts +73 -0
  38. package/src/types/logic/translator.js +1 -1
  39. package/src/types/page/Page.ts +7 -0
  40. package/src/types/page/View.ts +22 -0
  41. package/src/types/typeCheck.ts +10 -5
@@ -24,6 +24,7 @@ export const systemTypeList = [
24
24
  { kind: 'systemType', text: 'UploadErrorEvent', value: '#/systemTypes/UploadErrorEvent' },
25
25
  { kind: 'systemType', text: 'SortEvent', value: '#/systemTypes/SortEvent' },
26
26
  { kind: 'systemType', text: 'PoiInfo', value: '#/systemTypes/PoiInfo' },
27
+ { kind: 'systemType', text: 'File', value: '#/systemTypes/File' },
27
28
  ];
28
29
 
29
30
  export const systemTypeMap: { [name: string]: ObjectSchema } = {
@@ -417,6 +418,27 @@ export const systemTypeMap: { [name: string]: ObjectSchema } = {
417
418
  description: '选择项相关对象',
418
419
  isLeaf: true,
419
420
  },
421
+ {
422
+ type: 'genericType',
423
+ typeKey: '#/genericTypes/List',
424
+ typeInstantiation: {
425
+ typeName: 'List',
426
+ typeParams: [
427
+ {
428
+ type: 'typeParam',
429
+ typeParamName: 'T',
430
+ typeParamValue: {
431
+ typeKey: '#/basicTypes/String',
432
+ type: 'string',
433
+ format: '',
434
+ },
435
+ },
436
+ ],
437
+ },
438
+ name: 'items',
439
+ description: '所有选中项相关对象的数组',
440
+ isLeaf: true,
441
+ },
420
442
  {
421
443
  typeKey: '#/basicTypes/String',
422
444
  type: 'string',
@@ -1311,6 +1333,27 @@ export const systemTypeMap: { [name: string]: ObjectSchema } = {
1311
1333
  description: '选择项相关对象',
1312
1334
  isLeaf: true,
1313
1335
  },
1336
+ {
1337
+ type: 'genericType',
1338
+ typeKey: '#/genericTypes/List',
1339
+ typeInstantiation: {
1340
+ typeName: 'List',
1341
+ typeParams: [
1342
+ {
1343
+ type: 'typeParam',
1344
+ typeParamName: 'T',
1345
+ typeParamValue: {
1346
+ typeKey: '#/basicTypes/String',
1347
+ type: 'string',
1348
+ format: '',
1349
+ },
1350
+ },
1351
+ ],
1352
+ },
1353
+ name: 'items',
1354
+ description: '所有选中项相关对象的数组',
1355
+ isLeaf: true,
1356
+ },
1314
1357
  ],
1315
1358
  },
1316
1359
  '#/systemTypes/UploadEvent': {
@@ -1559,4 +1602,34 @@ export const systemTypeMap: { [name: string]: ObjectSchema } = {
1559
1602
  },
1560
1603
  ],
1561
1604
  },
1605
+ '#/systemTypes/File': {
1606
+ name: 'File',
1607
+ type: 'object',
1608
+ propertyList: [
1609
+ {
1610
+ typeKey: '#/basicTypes/String',
1611
+ type: 'string',
1612
+ format: '',
1613
+ name: 'name',
1614
+ description: '文件名称',
1615
+ isLeaf: true,
1616
+ },
1617
+ {
1618
+ typeKey: '#/basicTypes/Integer',
1619
+ type: 'integer',
1620
+ format: 'int',
1621
+ name: 'size',
1622
+ description: '文件大小',
1623
+ isLeaf: true,
1624
+ },
1625
+ {
1626
+ typeKey: '#/basicTypes/String',
1627
+ type: 'string',
1628
+ format: '',
1629
+ name: 'type',
1630
+ description: '文件类型',
1631
+ isLeaf: true,
1632
+ },
1633
+ ],
1634
+ },
1562
1635
  };
@@ -608,7 +608,7 @@ export default function (source) {
608
608
  if (node.calleeCode === 'Split') {
609
609
  // Bug-34789: 参考 url 转义规则对 ' 转义
610
610
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent
611
- params = params.map((param) => (param.replace(/(?<=').*(?=')/, (s) => s.replace(/'/g, '%27'))));
611
+ params = params.map((param) => (param.replace(/'(.*)'/, (match, p1) => `'${p1.replace(/'/g, '%27')}'`)));
612
612
  if (params.find((param) => param.includes('%27')))
613
613
  return `this.$utils['${node.calleeCode}'](${params.join(',')}).map((item) => item.replace(/%27/g, "'"))`;
614
614
  }
@@ -107,6 +107,9 @@ export class Page extends Vertex {
107
107
  path: {
108
108
  id: this.id,
109
109
  },
110
+ headers: {
111
+ 'request-lcpAppId': this.service.appId,
112
+ },
110
113
  });
111
114
  this.assign(result);
112
115
 
@@ -174,6 +177,7 @@ export class Page extends Vertex {
174
177
  appId: config.defaultApp?.id,
175
178
  operationAction: actionOptions?.actionName || 'Page.create',
176
179
  operationDesc: actionOptions?.actionDesc || `添加页面"${this.name}${this.title ? `(${this.title})` : ''}"`,
180
+ 'request-lcpAppId': this.service.appId,
177
181
  },
178
182
  body,
179
183
  }).catch(catchFn());
@@ -233,6 +237,7 @@ export class Page extends Vertex {
233
237
  appId: config.defaultApp?.id,
234
238
  operationAction: actionOptions?.actionName || 'Page.create',
235
239
  operationDesc: actionOptions?.actionDesc || `添加页面"${this.name}${this.title ? `(${this.title})` : ''}"`,
240
+ 'request-lcpAppId': this.service.appId,
236
241
  },
237
242
  body,
238
243
  });
@@ -268,6 +273,7 @@ export class Page extends Vertex {
268
273
  appId: config.defaultApp?.id,
269
274
  operationAction: actionOptions?.actionName || 'Page.delete',
270
275
  operationDesc: actionOptions?.actionDesc || `删除页面"${this.name}${this.title ? `(${this.title})` : ''}"`,
276
+ 'request-lcpAppId': this.service.appId,
271
277
  },
272
278
  path: {
273
279
  id: this.id,
@@ -295,6 +301,7 @@ export class Page extends Vertex {
295
301
  appId: config.defaultApp?.id,
296
302
  operationAction: actionOptions?.actionName || 'Page.delete',
297
303
  operationDesc: actionOptions?.actionDesc || `修改页面"${this.name}${this.title ? `(${this.title})` : ''}"`,
304
+ 'request-lcpAppId': this.service.appId,
298
305
  },
299
306
  body,
300
307
  }).catch(catchFn());
@@ -189,6 +189,7 @@ export class View extends Block {
189
189
  if (this.contentPromise)
190
190
  return this.contentPromise;
191
191
 
192
+
192
193
  return this.contentPromise = (async () => {
193
194
  try {
194
195
  const result: View = await viewService.load({
@@ -198,6 +199,9 @@ export class View extends Block {
198
199
  query: {
199
200
  enableCache,
200
201
  },
202
+ headers: {
203
+ 'request-lcpAppId': this.page.service.appId, // generator调用时需要appId headers
204
+ },
201
205
  });
202
206
 
203
207
  const $def = result.$def;
@@ -237,6 +241,9 @@ export class View extends Block {
237
241
  enableCache,
238
242
  },
239
243
  config: { noErrorTip: true },
244
+ headers: {
245
+ 'request-lcpAppId': this.page.service.appId,
246
+ },
240
247
  });
241
248
  const oldLogics = this.$def.logics;
242
249
  Object.assign(result, {
@@ -357,6 +364,9 @@ export class View extends Block {
357
364
  appId: config.defaultApp?.id,
358
365
  operationAction: actionOptions?.actionName || 'View.create',
359
366
  operationDesc: actionOptions?.actionDesc || `添加子页面"${this.name}${this.title ? `(${this.title})` : ''}"`,
367
+ headers: {
368
+ 'request-lcpAppId': this.page.service.appId,
369
+ },
360
370
  },
361
371
  body,
362
372
  }).catch(catchFn());
@@ -411,6 +421,9 @@ export class View extends Block {
411
421
  appId: config.defaultApp?.id,
412
422
  operationAction: actionOptions?.actionName || 'View.create',
413
423
  operationDesc: actionOptions?.actionDesc || `添加子页面"${this.name}${this.title ? `(${this.title})` : ''}"`,
424
+ headers: {
425
+ 'request-lcpAppId': this.page.service.appId,
426
+ },
414
427
  },
415
428
  body,
416
429
  });
@@ -445,6 +458,9 @@ export class View extends Block {
445
458
  appId: config.defaultApp?.id,
446
459
  operationAction: actionOptions?.actionName || 'View.delete',
447
460
  operationDesc: actionOptions?.actionDesc || `删除子页面"${this.name}${this.title ? `(${this.title})` : ''}"`,
461
+ headers: {
462
+ 'request-lcpAppId': this.page.service.appId,
463
+ },
448
464
  },
449
465
  path: {
450
466
  id: this.id,
@@ -479,6 +495,9 @@ export class View extends Block {
479
495
  appId: config.defaultApp?.id,
480
496
  operationAction: actionOptions?.actionName || 'View.update',
481
497
  operationDesc: actionOptions?.actionDesc || `修改子页面"${this.name}${this.title ? `(${this.title})` : ''}"`,
498
+ headers: {
499
+ 'request-lcpAppId': this.page.service.appId,
500
+ },
482
501
  },
483
502
  body,
484
503
  }).catch(catchFn());
@@ -960,6 +979,9 @@ export class View extends Block {
960
979
  appId: config.defaultApp?.id,
961
980
  operationAction: 'View.mergeBlock',
962
981
  operationDesc: '根据实体自动生成组件和逻辑',
982
+ headers: {
983
+ 'request-lcpAppId': this.page.service.appId,
984
+ },
963
985
  },
964
986
  });
965
987
 
@@ -25,14 +25,19 @@ export default {
25
25
  push(record: TypeCheckRecord) {
26
26
  const pos = this.deleteOwn(record.id);
27
27
 
28
- if(record.typeCheckNote?.message?.filter)
28
+ if (record.typeCheckNote?.message?.filter)
29
29
  record.typeCheckNote.message = record.typeCheckNote.message.filter((item) => !!item);
30
30
 
31
- if(!record.typeCheckNote || record.typeCheckNote.status === 'success'
32
- || (record.typeCheckNote && record.typeCheckNote.message && record.typeCheckNote.message.length === 0))
31
+ if (!record.typeCheckNote || record.typeCheckNote.status === 'success')
33
32
  return;
33
+ // typeCheckNote.message 不存在时,视为误报
34
+ if (record.typeCheckNote && record.typeCheckNote.status !== 'success'
35
+ && (!record.typeCheckNote.message || record.typeCheckNote.message.length === 0)) {
36
+ console.error('typeCheckNote 异常数据', record);
37
+ return;
38
+ }
34
39
 
35
- if(pos === -1)
40
+ if (pos === -1)
36
41
  this.records.unshift(record);
37
42
  else
38
43
  this.records.splice(pos, 0, record);
@@ -106,4 +111,4 @@ export default {
106
111
  }
107
112
  }
108
113
  },
109
- };
114
+ };