@lcap/nasl 0.3.10 → 0.3.11

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 (194) hide show
  1. package/out/service/app/api.d.ts +1 -15
  2. package/out/service/app/api.js +7 -17
  3. package/out/service/app/api.js.map +1 -1
  4. package/out/service/create/errHandles.js +19 -2
  5. package/out/service/create/errHandles.js.map +1 -1
  6. package/out/service/create/index.js +5 -0
  7. package/out/service/create/index.js.map +1 -1
  8. package/out/service/logic/logic.d.ts +50 -14
  9. package/out/service/logic/logic.js +26 -0
  10. package/out/service/logic/logic.js.map +1 -1
  11. package/out/service/page/element.d.ts +9 -0
  12. package/out/service/page/element.js +6 -0
  13. package/out/service/page/element.js.map +1 -1
  14. package/out/service/permission/api.d.ts +57 -0
  15. package/out/service/permission/api.js +41 -0
  16. package/out/service/permission/api.js.map +1 -0
  17. package/out/service/permission/index.d.ts +2 -0
  18. package/out/service/permission/index.js +17 -0
  19. package/out/service/permission/index.js.map +1 -0
  20. package/out/service/webFile/index.js +5 -0
  21. package/out/service/webFile/index.js.map +1 -1
  22. package/out/types/app/App.d.ts +13 -0
  23. package/out/types/app/App.js +55 -1
  24. package/out/types/app/App.js.map +1 -1
  25. package/out/types/app/History.js +3 -2
  26. package/out/types/app/History.js.map +1 -1
  27. package/out/types/app/Service.d.ts +5 -2
  28. package/out/types/app/Service.js +42 -9
  29. package/out/types/app/Service.js.map +1 -1
  30. package/out/types/cache.d.ts +6 -0
  31. package/out/types/cache.js +54 -0
  32. package/out/types/cache.js.map +1 -0
  33. package/out/types/cacheData.js.map +1 -1
  34. package/out/types/common/Vertex.d.ts +25 -0
  35. package/out/types/common/Vertex.js +42 -1
  36. package/out/types/common/Vertex.js.map +1 -1
  37. package/out/types/data/Entity.d.ts +4 -0
  38. package/out/types/data/Entity.js +9 -0
  39. package/out/types/data/Entity.js.map +1 -1
  40. package/out/types/data/EntityProperty.d.ts +5 -0
  41. package/out/types/data/EntityProperty.js +16 -0
  42. package/out/types/data/EntityProperty.js.map +1 -1
  43. package/out/types/data/Enum.d.ts +5 -0
  44. package/out/types/data/Enum.js +5 -0
  45. package/out/types/data/Enum.js.map +1 -1
  46. package/out/types/data/GlobalLogicNode.js +8 -1
  47. package/out/types/data/GlobalLogicNode.js.map +1 -1
  48. package/out/types/data/Interface.js +5 -3
  49. package/out/types/data/Interface.js.map +1 -1
  50. package/out/types/data/dataTypes.js +1 -1
  51. package/out/types/data/dataTypes.js.map +1 -1
  52. package/out/types/data/genBlock/genCreateBlock.js +5 -5
  53. package/out/types/data/genBlock/genCreateBlock.js.map +1 -1
  54. package/out/types/data/genBlock/genCurdBlock.js +3 -3
  55. package/out/types/data/genBlock/genCurdBlock.js.map +1 -1
  56. package/out/types/data/genBlock/genCurdEditTableBlock.d.ts +3 -0
  57. package/out/types/data/genBlock/genCurdEditTableBlock.js +578 -0
  58. package/out/types/data/genBlock/genCurdEditTableBlock.js.map +1 -0
  59. package/out/types/data/genBlock/genEditTableBlock.d.ts +234 -0
  60. package/out/types/data/genBlock/genEditTableBlock.js +419 -0
  61. package/out/types/data/genBlock/genEditTableBlock.js.map +1 -0
  62. package/out/types/data/genBlock/genEnumSelectBlock.d.ts +1 -1
  63. package/out/types/data/genBlock/genEnumSelectBlock.js +2 -2
  64. package/out/types/data/genBlock/genEnumSelectBlock.js.map +1 -1
  65. package/out/types/data/genBlock/genGridViewBlock.js +12 -1
  66. package/out/types/data/genBlock/genGridViewBlock.js.map +1 -1
  67. package/out/types/data/genBlock/genListViewBlock.js +2 -2
  68. package/out/types/data/genBlock/genQueryComponent.d.ts +20 -0
  69. package/out/types/data/genBlock/genQueryComponent.js +57 -1
  70. package/out/types/data/genBlock/genQueryComponent.js.map +1 -1
  71. package/out/types/data/genBlock/genSelectBlock.js +2 -2
  72. package/out/types/data/genBlock/genTableBlock.js +23 -8
  73. package/out/types/data/genBlock/genTableBlock.js.map +1 -1
  74. package/out/types/data/genBlock/genUpdateBlock.js +5 -5
  75. package/out/types/data/genBlock/genUpdateBlock.js.map +1 -1
  76. package/out/types/data/genBlock/index.d.ts +2 -0
  77. package/out/types/data/genBlock/index.js +2 -0
  78. package/out/types/data/genBlock/index.js.map +1 -1
  79. package/out/types/data/genBlock/utils.d.ts +7 -0
  80. package/out/types/data/genBlock/utils.js +38 -1
  81. package/out/types/data/genBlock/utils.js.map +1 -1
  82. package/out/types/data/systemTypes.js +47 -0
  83. package/out/types/data/systemTypes.js.map +1 -1
  84. package/out/types/enum.d.ts +6 -0
  85. package/out/types/enum.js +11 -0
  86. package/out/types/enum.js.map +1 -0
  87. package/out/types/generator/hotReload.d.ts +2 -0
  88. package/out/types/generator/hotReload.js +12 -1
  89. package/out/types/generator/hotReload.js.map +1 -1
  90. package/out/types/index.d.ts +5 -1
  91. package/out/types/index.js +8 -2
  92. package/out/types/index.js.map +1 -1
  93. package/out/types/logic/Logic.d.ts +32 -0
  94. package/out/types/logic/Logic.js +151 -41
  95. package/out/types/logic/Logic.js.map +1 -1
  96. package/out/types/logic/LogicItem.d.ts +1 -0
  97. package/out/types/logic/LogicItem.js +49 -32
  98. package/out/types/logic/LogicItem.js.map +1 -1
  99. package/out/types/logic/Param.d.ts +1 -0
  100. package/out/types/logic/Param.js +43 -33
  101. package/out/types/logic/Param.js.map +1 -1
  102. package/out/types/logic/Return.js +17 -30
  103. package/out/types/logic/Return.js.map +1 -1
  104. package/out/types/logic/Variable.js +17 -25
  105. package/out/types/logic/Variable.js.map +1 -1
  106. package/out/types/logic/translator.js +39 -10
  107. package/out/types/logic/translator.js.map +1 -1
  108. package/out/types/nuims/Nuims.d.ts +1 -1
  109. package/out/types/nuims/Nuims.js +11 -4
  110. package/out/types/nuims/Nuims.js.map +1 -1
  111. package/out/types/page/Element.d.ts +24 -0
  112. package/out/types/page/Element.js +198 -134
  113. package/out/types/page/Element.js.map +1 -1
  114. package/out/types/page/Event.js.map +1 -1
  115. package/out/types/page/Page.d.ts +5 -0
  116. package/out/types/page/Page.js +66 -27
  117. package/out/types/page/Page.js.map +1 -1
  118. package/out/types/page/View.d.ts +19 -1
  119. package/out/types/page/View.js +150 -40
  120. package/out/types/page/View.js.map +1 -1
  121. package/out/types/page/ViewParam.d.ts +1 -0
  122. package/out/types/page/ViewParam.js +23 -4
  123. package/out/types/page/ViewParam.js.map +1 -1
  124. package/out/types/page/ViewVariable.js +13 -24
  125. package/out/types/page/ViewVariable.js.map +1 -1
  126. package/out/types/permission/Permission.d.ts +41 -0
  127. package/out/types/permission/Permission.js +122 -0
  128. package/out/types/permission/Permission.js.map +1 -0
  129. package/out/types/process/ProcessParam.js +3 -1
  130. package/out/types/process/ProcessParam.js.map +1 -1
  131. package/out/types/utils/index.d.ts +1 -0
  132. package/out/types/utils/index.js +16 -7
  133. package/out/types/utils/index.js.map +1 -1
  134. package/package.json +1 -2
  135. package/src/service/app/api.js +8 -17
  136. package/src/service/create/errHandles.js +18 -2
  137. package/src/service/create/index.js +6 -0
  138. package/src/service/developPermission/api.js +37 -0
  139. package/src/service/developPermission/index.js +13 -0
  140. package/src/service/logic/logic.js +26 -0
  141. package/src/service/page/element.js +6 -0
  142. package/src/service/permission/api.js +38 -0
  143. package/src/service/permission/index.js +13 -0
  144. package/src/service/webFile/index.js +6 -1
  145. package/src/types/app/App.ts +58 -2
  146. package/src/types/app/History.ts +3 -2
  147. package/src/types/app/Service.ts +48 -10
  148. package/src/types/cache.ts +50 -0
  149. package/src/types/cacheData.ts +7 -7
  150. package/src/types/common/Vertex.ts +32 -1
  151. package/src/types/data/Entity.ts +8 -0
  152. package/src/types/data/EntityProperty.ts +12 -0
  153. package/src/types/data/Enum.ts +5 -0
  154. package/src/types/data/GlobalLogicNode.ts +8 -1
  155. package/src/types/data/Interface.ts +4 -3
  156. package/src/types/data/dataTypes.ts +1 -1
  157. package/src/types/data/genBlock/genCreateBlock.ts +5 -5
  158. package/src/types/data/genBlock/genCurdBlock.ts +3 -3
  159. package/src/types/data/genBlock/genCurdEditTableBlock.ts +581 -0
  160. package/src/types/data/genBlock/genEditTableBlock.ts +470 -0
  161. package/src/types/data/genBlock/genEnumSelectBlock.ts +2 -2
  162. package/src/types/data/genBlock/genGridViewBlock.ts +12 -1
  163. package/src/types/data/genBlock/genListViewBlock.ts +2 -2
  164. package/src/types/data/genBlock/genQueryComponent.ts +56 -0
  165. package/src/types/data/genBlock/genSelectBlock.ts +2 -2
  166. package/src/types/data/genBlock/genTableBlock.ts +28 -13
  167. package/src/types/data/genBlock/genUpdateBlock.ts +5 -5
  168. package/src/types/data/genBlock/index.ts +2 -0
  169. package/src/types/data/genBlock/utils.ts +38 -0
  170. package/src/types/data/systemTypes.ts +47 -0
  171. package/src/types/enum.ts +6 -0
  172. package/src/types/generator/hotReload.ts +10 -0
  173. package/src/types/index.ts +5 -1
  174. package/src/types/logic/Logic.ts +148 -39
  175. package/src/types/logic/LogicItem.ts +55 -38
  176. package/src/types/logic/Param.ts +43 -35
  177. package/src/types/logic/Return.ts +21 -34
  178. package/src/types/logic/Variable.ts +21 -27
  179. package/src/types/logic/translator.js +41 -14
  180. package/src/types/logic/translator_backup.js +5 -16
  181. package/src/types/nuims/Nuims.ts +11 -5
  182. package/src/types/page/Element.ts +212 -138
  183. package/src/types/page/Event.ts +0 -3
  184. package/src/types/page/Page.ts +80 -40
  185. package/src/types/page/View.ts +154 -39
  186. package/src/types/page/ViewParam.ts +22 -3
  187. package/src/types/page/ViewVariable.ts +16 -26
  188. package/src/types/page/dist/View.js +727 -0
  189. package/src/types/permission/Permission.ts +112 -0
  190. package/src/types/process/ProcessParam.ts +4 -1
  191. package/src/types/utils/index.ts +16 -7
  192. package/out/test/units/config.spec.d.ts +0 -1
  193. package/out/test/units/config.spec.js +0 -12
  194. package/out/test/units/config.spec.js.map +0 -1
@@ -0,0 +1,112 @@
1
+ import { immutable } from '../decorators';
2
+ import { View, Element } from '..';
3
+ import permissionService from '../../service/permission';
4
+
5
+
6
+ export class Permission {
7
+ /**
8
+ * App Name
9
+ */
10
+ @immutable()
11
+ public readonly domainName: string = undefined;
12
+ /**
13
+ * 上报权限后的资源id
14
+ */
15
+ @immutable()
16
+ public readonly resourceId: string = undefined;
17
+
18
+ /**
19
+ * 应用 id
20
+ */
21
+ @immutable()
22
+ public readonly serviceId: string = undefined;
23
+
24
+ /**
25
+ * view
26
+ */
27
+ @immutable()
28
+ public readonly view: View = undefined;
29
+
30
+ /**
31
+ * element
32
+ */
33
+ @immutable()
34
+ public readonly element: Element = undefined;
35
+
36
+ /**
37
+ * @param source 需要合并的部分参数
38
+ */
39
+ constructor(source?: Partial<Permission>) {
40
+ const { domainName } = source;
41
+ Object.assign(this, source);
42
+ if (!domainName) {
43
+ throw new Error('Permission need domainName!');
44
+ }
45
+ }
46
+
47
+ async createDefaultRoleFromRoleName(roleName: string) {
48
+ if (!roleName)
49
+ return;
50
+ return await permissionService.createRole({
51
+ body: {
52
+ name: roleName,
53
+ serviceId: this.serviceId,
54
+ },
55
+ });
56
+ }
57
+
58
+ async updateRoleName(roleId: string, roleName: string) {
59
+ return await permissionService.updateRole({
60
+ body: {
61
+ id: roleId,
62
+ name: roleName,
63
+ serviceId: this.serviceId,
64
+ }
65
+ })
66
+ }
67
+
68
+ /**
69
+ *
70
+ * @param query {
71
+ * resourceId
72
+ * roleId
73
+ * }
74
+ */
75
+ async attachPermissionResource(query: Object) {
76
+ return await permissionService.attachPermissionResourceAction({ query });
77
+ }
78
+
79
+ async detachPermissionResource(query: Object) {
80
+ return await permissionService.detachPermissionResourceAction({ query });
81
+ }
82
+
83
+ async getInitRoles(resourceId: string) {
84
+ return await permissionService.getRoles({
85
+ query: {
86
+ serviceId: this.serviceId,
87
+ resourceId,
88
+ }
89
+ });
90
+ }
91
+
92
+ async attachDevRole(resourceId: string) {
93
+ const data: any = await this.getInitRoles(resourceId)|| [];
94
+ let roleId;
95
+ data.forEach((item: any) => {
96
+ if (item.name === 'DEV-AdminRole') {
97
+ roleId = item.id;
98
+ }
99
+ })
100
+ // 获取权限树资源Id
101
+ if (roleId) {
102
+ // 默认角色开启
103
+ await this.attachPermissionResource({
104
+ resourceId,
105
+ roleId,
106
+ });
107
+ await this.getInitRoles(resourceId);
108
+ }
109
+ }
110
+ }
111
+
112
+ export default Permission;
@@ -62,10 +62,13 @@ export class ProcessParam extends Param {
62
62
  body,
63
63
  });
64
64
  this.assign(ProcessParam.from(result, this.process));
65
- this.updateInterface();
65
+ await this.updateInterface();
66
66
 
67
67
  await config.defaultApp?.history.load();
68
68
  config.defaultApp?.emit('saved');
69
+
70
+ // 更新所有调用此Logic的LogicItem
71
+ // await this.process.launchProcessInterface.logic.callLogicUpdate();
69
72
  return this;
70
73
  }
71
74
  /**
@@ -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 {
@@ -1 +0,0 @@
1
- export {};
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const chai_1 = require("chai");
4
- const types_1 = require("../../types");
5
- describe('config', () => {
6
- it('login successfully', async () => {
7
- types_1.config.baseURL = 'http://defaulttenant.qa-ci.lcap.group';
8
- const userInfo = await types_1.login('admin', 'Admin@123456');
9
- chai_1.expect(userInfo.UserId).to.equal('28db2e05f7e54c3b90a9e41e5cfe2318');
10
- });
11
- });
12
- //# sourceMappingURL=config.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.spec.js","sourceRoot":"","sources":["../../../src/test/units/config.spec.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAC9B,uCAA4C;AAE5C,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACpB,EAAE,CAAC,oBAAoB,EAAE,KAAK,IAAI,EAAE;QAChC,cAAM,CAAC,OAAO,GAAG,uCAAuC,CAAC;QACzD,MAAM,QAAQ,GAAG,MAAM,aAAK,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QACtD,aAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}