@lcap/nasl 0.3.10-beta.8 → 0.3.10-beta.9

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 (85) hide show
  1. package/out/service/create/errHandles.js +12 -0
  2. package/out/service/create/errHandles.js.map +1 -1
  3. package/out/service/create/index.js +3 -0
  4. package/out/service/create/index.js.map +1 -1
  5. package/out/types/app/App.js +1 -1
  6. package/out/types/app/App.js.map +1 -1
  7. package/out/types/app/History.js +3 -2
  8. package/out/types/app/History.js.map +1 -1
  9. package/out/types/app/Service.d.ts +3 -0
  10. package/out/types/app/Service.js +10 -2
  11. package/out/types/app/Service.js.map +1 -1
  12. package/out/types/data/Entity.d.ts +4 -0
  13. package/out/types/data/Entity.js +8 -0
  14. package/out/types/data/Entity.js.map +1 -1
  15. package/out/types/data/EntityProperty.d.ts +5 -0
  16. package/out/types/data/EntityProperty.js +16 -0
  17. package/out/types/data/EntityProperty.js.map +1 -1
  18. package/out/types/data/genBlock/genCurdEditTableBlock.d.ts +3 -0
  19. package/out/types/data/genBlock/genCurdEditTableBlock.js +578 -0
  20. package/out/types/data/genBlock/genCurdEditTableBlock.js.map +1 -0
  21. package/out/types/data/genBlock/genEditTableBlock.d.ts +234 -0
  22. package/out/types/data/genBlock/genEditTableBlock.js +419 -0
  23. package/out/types/data/genBlock/genEditTableBlock.js.map +1 -0
  24. package/out/types/data/genBlock/genQueryComponent.d.ts +20 -0
  25. package/out/types/data/genBlock/genQueryComponent.js +57 -1
  26. package/out/types/data/genBlock/genQueryComponent.js.map +1 -1
  27. package/out/types/data/genBlock/genTableBlock.js +9 -5
  28. package/out/types/data/genBlock/genTableBlock.js.map +1 -1
  29. package/out/types/data/genBlock/index.d.ts +2 -0
  30. package/out/types/data/genBlock/index.js +2 -0
  31. package/out/types/data/genBlock/index.js.map +1 -1
  32. package/out/types/data/genBlock/utils.d.ts +7 -0
  33. package/out/types/data/genBlock/utils.js +38 -1
  34. package/out/types/data/genBlock/utils.js.map +1 -1
  35. package/out/types/logic/Logic.js +9 -10
  36. package/out/types/logic/Logic.js.map +1 -1
  37. package/out/types/logic/LogicItem.js +5 -7
  38. package/out/types/logic/LogicItem.js.map +1 -1
  39. package/out/types/logic/Param.js +3 -13
  40. package/out/types/logic/Param.js.map +1 -1
  41. package/out/types/logic/Return.js +3 -11
  42. package/out/types/logic/Return.js.map +1 -1
  43. package/out/types/logic/Variable.js +3 -6
  44. package/out/types/logic/Variable.js.map +1 -1
  45. package/out/types/logic/translator.js +1 -1
  46. package/out/types/logic/translator.js.map +1 -1
  47. package/out/types/page/Element.d.ts +6 -0
  48. package/out/types/page/Element.js +26 -2
  49. package/out/types/page/Element.js.map +1 -1
  50. package/out/types/page/Page.d.ts +4 -0
  51. package/out/types/page/Page.js +7 -0
  52. package/out/types/page/Page.js.map +1 -1
  53. package/out/types/page/View.d.ts +9 -0
  54. package/out/types/page/View.js +32 -0
  55. package/out/types/page/View.js.map +1 -1
  56. package/out/types/page/ViewVariable.js +0 -6
  57. package/out/types/page/ViewVariable.js.map +1 -1
  58. package/out/types/utils/index.d.ts +1 -0
  59. package/out/types/utils/index.js +16 -7
  60. package/out/types/utils/index.js.map +1 -1
  61. package/package.json +1 -1
  62. package/src/service/create/errHandles.js +12 -0
  63. package/src/service/create/index.js +4 -0
  64. package/src/types/app/App.ts +1 -1
  65. package/src/types/app/History.ts +3 -2
  66. package/src/types/app/Service.ts +14 -5
  67. package/src/types/data/Entity.ts +7 -0
  68. package/src/types/data/EntityProperty.ts +12 -0
  69. package/src/types/data/genBlock/genCurdEditTableBlock.ts +581 -0
  70. package/src/types/data/genBlock/genEditTableBlock.ts +470 -0
  71. package/src/types/data/genBlock/genQueryComponent.ts +56 -0
  72. package/src/types/data/genBlock/genTableBlock.ts +14 -10
  73. package/src/types/data/genBlock/index.ts +2 -0
  74. package/src/types/data/genBlock/utils.ts +38 -0
  75. package/src/types/logic/Logic.ts +10 -11
  76. package/src/types/logic/LogicItem.ts +7 -10
  77. package/src/types/logic/Param.ts +6 -19
  78. package/src/types/logic/Return.ts +18 -26
  79. package/src/types/logic/Variable.ts +18 -20
  80. package/src/types/logic/translator.js +4 -4
  81. package/src/types/page/Element.ts +27 -2
  82. package/src/types/page/Page.ts +7 -0
  83. package/src/types/page/View.ts +32 -0
  84. package/src/types/page/ViewVariable.ts +13 -19
  85. package/src/types/utils/index.ts +16 -7
@@ -1,8 +1,7 @@
1
1
  import { immutable, excludedInJSON, action } from '../decorators';
2
- import { config, history, utils, LEVEL_ENUM, Vertex, Logic, Variable, View, Schema, ActionOptions } from '..';
3
- import { paramService } from '../../service/logic';
2
+ import { config, utils, Logic, Variable, View, Schema, ActionOptions } from '..';
4
3
  import { viewService } from '../../service/page';
5
- import { convert2RefType, convert2SchemaType } from '../data/dataTypeUtils';
4
+ import { convert2RefType } from '../data/dataTypeUtils';
6
5
  import { getBasicTypeDefaultValue } from '../data/basicTypes';
7
6
  import { schemaService } from '../../service/common';
8
7
  import { catchFn } from './ViewParam';
@@ -43,7 +42,7 @@ export class ViewVariable extends Variable {
43
42
 
44
43
  const body = this.toJSON('', ['ideVersion', 'editable']);
45
44
  body.viewId = this.view.id;
46
- // convert2SchemaType(body.schema);
45
+
47
46
  utils.logger.debug('添加页面局部变量', body);
48
47
  const result: ViewVariable = await viewService.createViewVariable({
49
48
  headers: {
@@ -53,7 +52,6 @@ export class ViewVariable extends Variable {
53
52
  },
54
53
  body,
55
54
  }).catch(catchFn(this.view));
56
- // convert2RefType(result.schema);
57
55
  this.deepPick(result, ['id']);
58
56
  this.assign({ code: this.genCode() });
59
57
 
@@ -74,16 +72,16 @@ export class ViewVariable extends Variable {
74
72
  config.defaultApp?.emit('saving');
75
73
 
76
74
  if (this.id) {
77
- await viewService.deleteViewVariable({
78
- headers: {
79
- appId: config.defaultApp?.id,
80
- operationAction: actionOptions?.actionName || 'ViewVariable.delete',
81
- operationDesc: actionOptions?.actionDesc || `删除页面"${this.view.name}"局部变量"${this.name}"`,
82
- },
83
- query: {
84
- id: this.id,
85
- },
86
- }).catch(catchFn(this.view));
75
+ await viewService.deleteViewVariable({
76
+ headers: {
77
+ appId: config.defaultApp?.id,
78
+ operationAction: actionOptions?.actionName || 'ViewVariable.delete',
79
+ operationDesc: actionOptions?.actionDesc || `删除页面"${this.view.name}"局部变量"${this.name}"`,
80
+ },
81
+ query: {
82
+ id: this.id,
83
+ },
84
+ }).catch(catchFn(this.view));
87
85
  }
88
86
 
89
87
  const { variables } = this.view.$def;
@@ -109,7 +107,6 @@ export class ViewVariable extends Variable {
109
107
  delete body.ideVersion;
110
108
  delete body.editable;
111
109
  body.viewId = this.view.id;
112
- // convert2SchemaType(body.schema);
113
110
  utils.logger.debug('修改页面局部变量', body);
114
111
  const result = await viewService.updateViewVariable({
115
112
  headers: {
@@ -119,8 +116,6 @@ export class ViewVariable extends Variable {
119
116
  },
120
117
  body,
121
118
  }).catch(catchFn(this.view));
122
- // convert2RefType(result.schema);
123
- // this.plainAssign(result);
124
119
 
125
120
  await config.defaultApp?.history.load();
126
121
  config.defaultApp?.emit('saved');
@@ -186,7 +181,6 @@ export class ViewVariable extends Variable {
186
181
  typeInstantiation: undefined,
187
182
  });
188
183
  Object.assign(this.schema, schema);
189
- // if (this.defaultValue)
190
184
  this.assign({ defaultValue: getBasicTypeDefaultValue() });
191
185
  try {
192
186
  await this.update(undefined, {
@@ -4,6 +4,11 @@ export * from './logger';
4
4
 
5
5
  import { traverse } from './traverse';
6
6
  import { isBasicType } from '../';
7
+ import { cloneDeep } from 'lodash';
8
+
9
+ export function getGlobalEnv() {
10
+ return typeof window !== 'undefined' ? (window as any).appInfo.env : (global as any).appInfoEnv;
11
+ }
7
12
 
8
13
  /**
9
14
  * 用 lodash 的 throttle 好像有点问题,先临时做个处理
@@ -58,21 +63,25 @@ export function resolveParameter(params: Array<ParamStruts>): resolvedParameter
58
63
  };
59
64
  let hasBody = false;
60
65
  let hasParam = false;
61
- params.forEach((p) => {
62
- if (p.in === 'body') {
66
+ params.forEach((p) => {
67
+ const pcopy = cloneDeep(p);
68
+ if(!pcopy.required) {
69
+ delete pcopy.defaultValue
70
+ }
71
+ if (pcopy.in === 'body') {
63
72
  hasBody = true;
64
- requestBody.description.name = p.name;
65
- if (!isBasicType(p.schema)) {
66
- requestBody.content['application/json'] = p;
73
+ requestBody.description.name = pcopy.name;
74
+ if (!isBasicType(pcopy.schema)) {
75
+ requestBody.content['application/json'] = pcopy;
67
76
  } else {
68
77
  requestBody.content['application/json'] = {
69
- schema: p.schema,
78
+ schema: pcopy.schema,
70
79
  };
71
80
  }
72
81
  requestBody.required = true;
73
82
  } else {
74
83
  hasParam = true;
75
- parameters[p.name] = p;
84
+ parameters[pcopy.name] = pcopy;
76
85
  }
77
86
  });
78
87
  return {