@lcap/nasl 2.22.0-beta.5 → 3.0.0-beta.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 (304) hide show
  1. package/README.md +13 -0
  2. package/docs/classes/Module.html +15 -15
  3. package/docs/classes/Namespace.html +15 -15
  4. package/docs/classes/ViewComponent.html +19 -19
  5. package/out/automate/engine/utils.js +4 -0
  6. package/out/automate/engine/utils.js.map +1 -1
  7. package/out/breakpoint/generator/AfterStartNode.d.ts +7 -0
  8. package/out/breakpoint/generator/AfterStartNode.js +27 -0
  9. package/out/breakpoint/generator/AfterStartNode.js.map +1 -0
  10. package/out/breakpoint/generator/BeforeEndNode.d.ts +7 -0
  11. package/out/breakpoint/generator/BeforeEndNode.js +27 -0
  12. package/out/breakpoint/generator/BeforeEndNode.js.map +1 -0
  13. package/out/breakpoint/generator/BreakpointNode.d.ts +14 -0
  14. package/out/breakpoint/generator/BreakpointNode.js +166 -0
  15. package/out/breakpoint/generator/BreakpointNode.js.map +1 -0
  16. package/out/breakpoint/generator/index.d.ts +4 -0
  17. package/out/breakpoint/generator/index.js +98 -0
  18. package/out/breakpoint/generator/index.js.map +1 -0
  19. package/out/breakpoint/index.d.ts +3 -0
  20. package/out/breakpoint/index.js +20 -0
  21. package/out/breakpoint/index.js.map +1 -0
  22. package/out/breakpoint/shared/constants.d.ts +30 -0
  23. package/out/breakpoint/shared/constants.js +87 -0
  24. package/out/breakpoint/shared/constants.js.map +1 -0
  25. package/out/breakpoint/shared/index.d.ts +3 -0
  26. package/out/breakpoint/shared/index.js +33 -0
  27. package/out/breakpoint/shared/index.js.map +1 -0
  28. package/out/breakpoint/shared/operations.d.ts +10 -0
  29. package/out/breakpoint/shared/operations.js +25 -0
  30. package/out/breakpoint/shared/operations.js.map +1 -0
  31. package/out/breakpoint/shared/socket.d.ts +47 -0
  32. package/out/breakpoint/shared/socket.js +210 -0
  33. package/out/breakpoint/shared/socket.js.map +1 -0
  34. package/out/breakpoint/shared/utils.d.ts +20 -0
  35. package/out/breakpoint/shared/utils.js +133 -0
  36. package/out/breakpoint/shared/utils.js.map +1 -0
  37. package/out/breakpoint/store/core.d.ts +30 -0
  38. package/out/breakpoint/store/core.js +341 -0
  39. package/out/breakpoint/store/core.js.map +1 -0
  40. package/out/breakpoint/store/dock.d.ts +1 -0
  41. package/out/breakpoint/store/dock.js +127 -0
  42. package/out/breakpoint/store/dock.js.map +1 -0
  43. package/out/breakpoint/store/index.d.ts +2 -0
  44. package/out/breakpoint/store/index.js +19 -0
  45. package/out/breakpoint/store/index.js.map +1 -0
  46. package/out/common/BaseNode.d.ts +8 -0
  47. package/out/common/BaseNode.js +19 -0
  48. package/out/common/BaseNode.js.map +1 -1
  49. package/out/concepts/App__.d.ts +365 -16
  50. package/out/concepts/App__.js +431 -10
  51. package/out/concepts/App__.js.map +1 -1
  52. package/out/concepts/Assignment__.js +1 -1
  53. package/out/concepts/Assignment__.js.map +1 -1
  54. package/out/concepts/AuthInterface__.d.ts +37 -0
  55. package/out/concepts/AuthInterface__.js +141 -0
  56. package/out/concepts/AuthInterface__.js.map +1 -0
  57. package/out/concepts/AuthLogicForCallInterface__.d.ts +138 -0
  58. package/out/concepts/AuthLogicForCallInterface__.js +493 -0
  59. package/out/concepts/AuthLogicForCallInterface__.js.map +1 -0
  60. package/out/concepts/AuthLogic__.d.ts +66 -0
  61. package/out/concepts/AuthLogic__.js +206 -0
  62. package/out/concepts/AuthLogic__.js.map +1 -0
  63. package/out/concepts/BackendVariable__.d.ts +137 -0
  64. package/out/concepts/BackendVariable__.js +422 -0
  65. package/out/concepts/BackendVariable__.js.map +1 -0
  66. package/out/concepts/Backend__.d.ts +134 -0
  67. package/out/concepts/Backend__.js +274 -0
  68. package/out/concepts/Backend__.js.map +1 -0
  69. package/out/concepts/BindAttribute__.d.ts +1 -1
  70. package/out/concepts/BindAttribute__.js +3 -1
  71. package/out/concepts/BindAttribute__.js.map +1 -1
  72. package/out/concepts/BindEvent__.d.ts +12 -0
  73. package/out/concepts/BindEvent__.js +68 -0
  74. package/out/concepts/BindEvent__.js.map +1 -1
  75. package/out/concepts/CallAuthInterface__.d.ts +126 -0
  76. package/out/concepts/CallAuthInterface__.js +408 -0
  77. package/out/concepts/CallAuthInterface__.js.map +1 -0
  78. package/out/concepts/CallInterface__.d.ts +6 -1
  79. package/out/concepts/CallInterface__.js +9 -1
  80. package/out/concepts/CallInterface__.js.map +1 -1
  81. package/out/concepts/CallLogic__.js +3 -1
  82. package/out/concepts/CallLogic__.js.map +1 -1
  83. package/out/concepts/CallQueryComponent__.js +9 -7
  84. package/out/concepts/CallQueryComponent__.js.map +1 -1
  85. package/out/concepts/Destination__.js +1 -1
  86. package/out/concepts/Destination__.js.map +1 -1
  87. package/out/concepts/End__.js +29 -2
  88. package/out/concepts/End__.js.map +1 -1
  89. package/out/concepts/EntityProperty__.js.map +1 -1
  90. package/out/concepts/Entity__.d.ts +1 -2
  91. package/out/concepts/Entity__.js +1 -31
  92. package/out/concepts/Entity__.js.map +1 -1
  93. package/out/concepts/ForEachStatement__.js +9 -4
  94. package/out/concepts/ForEachStatement__.js.map +1 -1
  95. package/out/concepts/FrontendLibrary__.d.ts +29 -29
  96. package/out/concepts/FrontendLibrary__.js +2 -2
  97. package/out/concepts/FrontendVariable__.d.ts +21 -0
  98. package/out/concepts/FrontendVariable__.js +64 -0
  99. package/out/concepts/FrontendVariable__.js.map +1 -0
  100. package/out/concepts/Frontend__.d.ts +151 -47
  101. package/out/concepts/Frontend__.js +188 -32
  102. package/out/concepts/Frontend__.js.map +1 -1
  103. package/out/concepts/Function__.js +1 -1
  104. package/out/concepts/Function__.js.map +1 -1
  105. package/out/concepts/Identifier__.js +1 -1
  106. package/out/concepts/Identifier__.js.map +1 -1
  107. package/out/concepts/Interface__.d.ts +1 -1
  108. package/out/concepts/Interface__.js.map +1 -1
  109. package/out/concepts/LogicItem__.d.ts +18 -3
  110. package/out/concepts/LogicItem__.js +22 -4
  111. package/out/concepts/LogicItem__.js.map +1 -1
  112. package/out/concepts/Logic__.d.ts +14 -9
  113. package/out/concepts/Logic__.js +43 -5
  114. package/out/concepts/Logic__.js.map +1 -1
  115. package/out/concepts/Module__.js.map +1 -1
  116. package/out/concepts/Namespace__.d.ts +29 -29
  117. package/out/concepts/Namespace__.js +2 -2
  118. package/out/concepts/NewComposite__.js +2 -2
  119. package/out/concepts/NewComposite__.js.map +1 -1
  120. package/out/concepts/OverriddenLogic__.d.ts +643 -0
  121. package/out/concepts/OverriddenLogic__.js +1602 -0
  122. package/out/concepts/OverriddenLogic__.js.map +1 -0
  123. package/out/concepts/Param__.d.ts +6 -0
  124. package/out/concepts/Param__.js +10 -0
  125. package/out/concepts/Param__.js.map +1 -1
  126. package/out/concepts/QueryFieldExpression__.d.ts +2 -0
  127. package/out/concepts/QueryFieldExpression__.js +9 -0
  128. package/out/concepts/QueryFieldExpression__.js.map +1 -1
  129. package/out/concepts/QuerySelectExpression__.d.ts +2 -2
  130. package/out/concepts/QuerySelectExpression__.js +2 -2
  131. package/out/concepts/QuerySelectExpression__.js.map +1 -1
  132. package/out/concepts/TypeAnnotation__.js +6 -6
  133. package/out/concepts/TypeAnnotation__.js.map +1 -1
  134. package/out/concepts/Variable__.d.ts +10 -0
  135. package/out/concepts/Variable__.js +12 -0
  136. package/out/concepts/Variable__.js.map +1 -1
  137. package/out/concepts/ViewComponent__.d.ts +33 -33
  138. package/out/concepts/ViewComponent__.js +7 -7
  139. package/out/concepts/ViewElement__.d.ts +6 -0
  140. package/out/concepts/ViewElement__.js +104 -1
  141. package/out/concepts/ViewElement__.js.map +1 -1
  142. package/out/concepts/View__.js +2 -2
  143. package/out/concepts/View__.js.map +1 -1
  144. package/out/concepts/basics/stdlib/index.js +2 -1
  145. package/out/concepts/basics/stdlib/index.js.map +1 -1
  146. package/out/concepts/basics/stdlib/nasl.auth.js +24 -0
  147. package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -1
  148. package/out/concepts/basics/stdlib/nasl.http.d.ts +7 -0
  149. package/out/concepts/basics/stdlib/nasl.http.js +167 -0
  150. package/out/concepts/basics/stdlib/nasl.http.js.map +1 -0
  151. package/out/concepts/basics/stdlib/nasl.process.js +68 -0
  152. package/out/concepts/basics/stdlib/nasl.process.js.map +1 -1
  153. package/out/concepts/basics/stdlib/nasl.ui.js +4 -19
  154. package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
  155. package/out/concepts/basics/stdlib/nasl.util.js +83 -17
  156. package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
  157. package/out/concepts/basics/types/index.d.ts +1 -0
  158. package/out/concepts/basics/types/index.js +4 -1
  159. package/out/concepts/basics/types/index.js.map +1 -1
  160. package/out/concepts/index__.d.ts +8 -0
  161. package/out/concepts/index__.js +8 -0
  162. package/out/concepts/index__.js.map +1 -1
  163. package/out/enums/KEYWORDS.js +0 -1
  164. package/out/enums/KEYWORDS.js.map +1 -1
  165. package/out/generator/genBundleFiles.d.ts +1 -0
  166. package/out/generator/genBundleFiles.js +27 -0
  167. package/out/generator/genBundleFiles.js.map +1 -1
  168. package/out/generator/genMetaData.d.ts +4 -1
  169. package/out/generator/genMetaData.js +14 -0
  170. package/out/generator/genMetaData.js.map +1 -1
  171. package/out/generator/genReleaseBody.d.ts +2 -1
  172. package/out/generator/genReleaseBody.js +2 -1
  173. package/out/generator/genReleaseBody.js.map +1 -1
  174. package/out/index.d.ts +2 -1
  175. package/out/index.js +3 -1
  176. package/out/index.js.map +1 -1
  177. package/out/server/extendBaseNode.js +16 -4
  178. package/out/server/extendBaseNode.js.map +1 -1
  179. package/out/server/formatTsUtils.d.ts +2 -1
  180. package/out/server/formatTsUtils.js +39 -4
  181. package/out/server/formatTsUtils.js.map +1 -1
  182. package/out/server/getExtensionModules.d.ts +2 -2
  183. package/out/server/getExtensionModules.js +16 -2
  184. package/out/server/getExtensionModules.js.map +1 -1
  185. package/out/server/getLogics.js +5 -5
  186. package/out/server/getLogics.js.map +1 -1
  187. package/out/server/getMemberIdentifier.d.ts +1 -0
  188. package/out/server/getMemberIdentifier.js +34 -7
  189. package/out/server/getMemberIdentifier.js.map +1 -1
  190. package/out/server/naslServer.d.ts +64 -64
  191. package/out/server/naslServer.js +249 -121
  192. package/out/server/naslServer.js.map +1 -1
  193. package/out/server/naslStdlibMap.js +2 -0
  194. package/out/server/naslStdlibMap.js.map +1 -1
  195. package/out/server/translator.d.ts +1 -0
  196. package/out/server/translator.js +67 -2
  197. package/out/server/translator.js.map +1 -1
  198. package/out/service/defaultErrorMessage.json +1 -0
  199. package/out/service/storage/api.d.ts +10 -1
  200. package/out/service/storage/api.js +6 -0
  201. package/out/service/storage/api.js.map +1 -1
  202. package/out/service/storage/init.d.ts +4 -0
  203. package/out/service/storage/init.js +55 -35
  204. package/out/service/storage/init.js.map +1 -1
  205. package/out/service/storage/service.d.ts +3 -0
  206. package/out/service/storage/service.js +14 -0
  207. package/out/service/storage/service.js.map +1 -1
  208. package/out/utils/sortTsString.d.ts +1 -0
  209. package/out/utils/sortTsString.js +36 -0
  210. package/out/utils/sortTsString.js.map +1 -0
  211. package/out/utils/traverse.js +2 -2
  212. package/out/utils/traverse.js.map +1 -1
  213. package/package.json +7 -2
  214. package/sandbox/stdlib/nasl.auth.ts +8 -4
  215. package/sandbox/stdlib/nasl.core.d.ts +206 -0
  216. package/sandbox/stdlib/nasl.core.js +1 -0
  217. package/sandbox/stdlib/nasl.core.js.map +1 -0
  218. package/sandbox/stdlib/nasl.http.ts +35 -0
  219. package/sandbox/stdlib/nasl.process.ts +13 -0
  220. package/sandbox/stdlib/nasl.ui.ts +0 -5
  221. package/src/automate/engine/utils.js +4 -1
  222. package/src/breakpoint/generator/AfterStartNode.ts +27 -0
  223. package/src/breakpoint/generator/BeforeEndNode.ts +27 -0
  224. package/src/breakpoint/generator/BreakpointNode.ts +228 -0
  225. package/src/breakpoint/generator/index.ts +114 -0
  226. package/src/breakpoint/index.ts +3 -0
  227. package/src/breakpoint/shared/constants.ts +95 -0
  228. package/src/breakpoint/shared/index.ts +3 -0
  229. package/src/breakpoint/shared/operations.ts +25 -0
  230. package/src/breakpoint/shared/socket.ts +326 -0
  231. package/src/breakpoint/shared/utils.ts +195 -0
  232. package/src/breakpoint/store/core.ts +411 -0
  233. package/src/breakpoint/store/dock.ts +166 -0
  234. package/src/breakpoint/store/index.ts +2 -0
  235. package/src/breakpoint/types/index.d.ts +19 -0
  236. package/src/common/BaseNode.ts +19 -1
  237. package/src/concepts/App__.ts +828 -26
  238. package/src/concepts/Assignment__.ts +1 -1
  239. package/src/concepts/AuthInterface__.ts +148 -0
  240. package/src/concepts/AuthLogicForCallInterface__.ts +573 -0
  241. package/src/concepts/AuthLogic__.ts +225 -0
  242. package/src/concepts/BackendVariable__.ts +466 -0
  243. package/src/concepts/Backend__.ts +347 -0
  244. package/src/concepts/BindAttribute__.ts +4 -3
  245. package/src/concepts/BindEvent__.ts +71 -2
  246. package/src/concepts/CallAuthInterface__.ts +490 -0
  247. package/src/concepts/CallInterface__.ts +10 -2
  248. package/src/concepts/CallLogic__.ts +3 -1
  249. package/src/concepts/CallQueryComponent__.ts +67 -7
  250. package/src/concepts/Destination__.ts +19 -1
  251. package/src/concepts/End__.ts +31 -3
  252. package/src/concepts/EntityProperty__.ts +6 -0
  253. package/src/concepts/Entity__.ts +8 -31
  254. package/src/concepts/ForEachStatement__.ts +9 -4
  255. package/src/concepts/FrontendLibrary__.ts +30 -30
  256. package/src/concepts/FrontendVariable__.ts +76 -0
  257. package/src/concepts/Frontend__.ts +352 -89
  258. package/src/concepts/Function__.ts +1 -1
  259. package/src/concepts/Identifier__.ts +5 -5
  260. package/src/concepts/Interface__.ts +1 -1
  261. package/src/concepts/LogicItem__.ts +26 -6
  262. package/src/concepts/Logic__.ts +86 -8
  263. package/src/concepts/Module__.ts +32 -2
  264. package/src/concepts/Namespace__.ts +30 -30
  265. package/src/concepts/NewComposite__.ts +2 -3
  266. package/src/concepts/OverriddenLogic__.ts +2165 -0
  267. package/src/concepts/Param__.ts +13 -3
  268. package/src/concepts/QueryFieldExpression__.ts +18 -0
  269. package/src/concepts/QuerySelectExpression__.ts +11 -3
  270. package/src/concepts/TypeAnnotation__.ts +45 -6
  271. package/src/concepts/Variable__.ts +14 -0
  272. package/src/concepts/ViewComponent__.ts +35 -35
  273. package/src/concepts/ViewElement__.ts +104 -1
  274. package/src/concepts/View__.ts +24 -2
  275. package/src/concepts/basics/stdlib/index.ts +2 -1
  276. package/src/concepts/basics/stdlib/nasl.auth.ts +24 -0
  277. package/src/concepts/basics/stdlib/nasl.http.ts +166 -0
  278. package/src/concepts/basics/stdlib/nasl.process.ts +68 -0
  279. package/src/concepts/basics/stdlib/nasl.ui.ts +4 -19
  280. package/src/concepts/basics/stdlib/nasl.util.ts +83 -17
  281. package/src/concepts/basics/types/index.ts +5 -4
  282. package/src/concepts/index__.ts +8 -0
  283. package/src/enums/KEYWORDS.ts +0 -1
  284. package/src/generator/genBundleFiles.ts +36 -2
  285. package/src/generator/genMetaData.ts +16 -1
  286. package/src/generator/genReleaseBody.ts +4 -1
  287. package/src/index.ts +2 -1
  288. package/src/server/extendBaseNode.ts +18 -7
  289. package/src/server/formatTsUtils.ts +37 -5
  290. package/src/server/getExtensionModules.ts +18 -3
  291. package/src/server/getLogics.ts +6 -6
  292. package/src/server/getMemberIdentifier.ts +35 -9
  293. package/src/server/naslServer.ts +250 -124
  294. package/src/server/naslStdlibMap.ts +2 -0
  295. package/src/server/translator.ts +67 -1
  296. package/src/service/defaultErrorMessage.json +1 -0
  297. package/src/service/storage/api.js +7 -1
  298. package/src/service/storage/init.ts +66 -35
  299. package/src/service/storage/service.ts +18 -2
  300. package/src/utils/sortTsString.ts +32 -0
  301. package/src/utils/traverse.ts +2 -2
  302. package/test/examples/app-simple.json +73635 -0
  303. package/ts-worker/lib/tsserver.js +3 -3
  304. package/ts-worker/package.json +1 -1
@@ -34,13 +34,18 @@ import DataSource from './DataSource__';
34
34
  import Structure from './Structure__';
35
35
  import Enum from './Enum__';
36
36
  import Logic from './Logic__';
37
+ import OverriddenLogic from './OverriddenLogic__';
37
38
  import Interface from './Interface__';
39
+ import AuthInterface from './AuthInterface__';
38
40
  import Frontend from './Frontend__';
41
+ import Backend from './Backend__';
39
42
  import Process from './Process__';
40
43
  import Role from './Role__';
41
44
  import Configuration from './Configuration__';
42
45
  import Module from './Module__';
43
46
  import Integration from './Integration__';
47
+ import AuthLogic from './AuthLogic__';
48
+ import AuthLogicForCallInterface from './AuthLogicForCallInterface__';
44
49
 
45
50
  /**
46
51
  * 应用
@@ -132,10 +137,16 @@ export class App extends BaseNode {
132
137
  logics: Array<Logic> = [];
133
138
 
134
139
  /**
135
- * 接口列表
140
+ * 逻辑列表
141
+ */
142
+ @property('OverriddenLogic')
143
+ overriddenLogics: Array<OverriddenLogic> = [];
144
+
145
+ /**
146
+ * interfaces
136
147
  */
137
- @property('Interface')
138
- interfaces: Array<Interface> = [];
148
+ @property('Interface | AuthInterface')
149
+ interfaces: Array<Interface | AuthInterface> = [];
139
150
 
140
151
  /**
141
152
  * 端列表
@@ -143,6 +154,12 @@ export class App extends BaseNode {
143
154
  @property('Frontend')
144
155
  frontends: Array<Frontend> = [];
145
156
 
157
+ /**
158
+ * 后端
159
+ */
160
+ @property('Backend')
161
+ backend: Backend = new Backend();
162
+
146
163
  /**
147
164
  * 流程列表
148
165
  */
@@ -179,6 +196,18 @@ export class App extends BaseNode {
179
196
  @property('Integration')
180
197
  integration: Integration = undefined;
181
198
 
199
+ /**
200
+ * 暴露接口的接口鉴权
201
+ */
202
+ @property('AuthLogic')
203
+ authLogics: Array<AuthLogic> = [];
204
+
205
+ /**
206
+ * 调用接口的鉴权模板
207
+ */
208
+ @property('AuthLogicForCallInterface')
209
+ authLogicsForCallInterface: Array<AuthLogicForCallInterface> = [];
210
+
182
211
  /**
183
212
  * @param source 需要合并的部分参数
184
213
  */
@@ -781,6 +810,280 @@ export class App extends BaseNode {
781
810
  return node;
782
811
  }
783
812
 
813
+ /**
814
+ * 插入开放接口的鉴权逻辑
815
+ * @internal
816
+ * @param name 开放接口的鉴权逻辑名称,如果不填会自动生成一个唯一名称
817
+ */
818
+ _insertAuthLogicInAuthLogicsAt(name: string, index: number): AuthLogic;
819
+
820
+ /**
821
+ * 插入开放接口的鉴权逻辑
822
+ * @internal
823
+ * @param authLogicOptions 开放接口的鉴权逻辑参数
824
+ */
825
+ _insertAuthLogicInAuthLogicsAt(authLogicOptions: Partial<AuthLogic>, index: number): AuthLogic;
826
+
827
+ /**
828
+ * 插入开放接口的鉴权逻辑
829
+ * @internal
830
+ * @param authLogic 已有的开放接口的鉴权逻辑实例
831
+ */
832
+ _insertAuthLogicInAuthLogicsAt(authLogic: AuthLogic, index: number): AuthLogic;
833
+
834
+ _insertAuthLogicInAuthLogicsAt(options: string | Partial<AuthLogic> | AuthLogic, index: number) {
835
+ const authLogicOptions: any = {};
836
+ const relationOptions = { parentNode: this, parentKey: 'authLogics' };
837
+ let authLogic: AuthLogic;
838
+ if (!options) {
839
+ authLogic = AuthLogic.from({
840
+ ...authLogicOptions,
841
+ name: this.getAuthLogicUniqueName(),
842
+ }, this, 'authLogics');
843
+ } else if (typeof options === 'string') {
844
+ authLogic = AuthLogic.from({
845
+ ...authLogicOptions,
846
+ name: options,
847
+ }, this, 'authLogics');
848
+ } else if (options instanceof AuthLogic) {
849
+ options.ensureDelete(); // 同一实例不支持多处存在
850
+ authLogic = options;
851
+ Object.assign(authLogic, relationOptions);
852
+ } else {
853
+ authLogic = AuthLogic.from({
854
+ ...authLogicOptions,
855
+ ...options,
856
+ }, this, 'authLogics');
857
+ }
858
+ this.authLogics.splice(index, 0, authLogic);
859
+ return authLogic;
860
+ }
861
+
862
+ /**
863
+ * 插入开放接口的鉴权逻辑
864
+ * @param name 开放接口的鉴权逻辑名称,如果不填会自动生成一个唯一名称
865
+ */
866
+ insertAuthLogicInAuthLogicsAt(name: string, index: number): AuthLogic;
867
+
868
+ /**
869
+ * 插入开放接口的鉴权逻辑
870
+ * @param authLogicOptions 开放接口的鉴权逻辑参数
871
+ */
872
+ insertAuthLogicInAuthLogicsAt(authLogicOptions: Partial<AuthLogic>, index: number): AuthLogic;
873
+
874
+ /**
875
+ * 插入开放接口的鉴权逻辑
876
+ * @param authLogic 已有的开放接口的鉴权逻辑实例
877
+ */
878
+ insertAuthLogicInAuthLogicsAt(authLogic: AuthLogic, index: number): AuthLogic;
879
+
880
+ insertAuthLogicInAuthLogicsAt(options: string | Partial<AuthLogic> | AuthLogic, index: number) {
881
+ const node = this._insertAuthLogicInAuthLogicsAt(options as any, index);
882
+ node.create({
883
+ index,
884
+ parentNode: this,
885
+ parentKey: 'authLogics',
886
+ });
887
+ return node;
888
+ }
889
+
890
+ /**
891
+ * 添加开放接口的鉴权逻辑
892
+ * @internal
893
+ * @param name 开放接口的鉴权逻辑名称,如果不填会自动生成一个唯一名称
894
+ */
895
+ _addAuthLogicInAuthLogics(name?: string): AuthLogic;
896
+
897
+ /**
898
+ * 添加开放接口的鉴权逻辑
899
+ * @internal
900
+ * @param authLogicOptions 开放接口的鉴权逻辑参数
901
+ */
902
+ _addAuthLogicInAuthLogics(authLogicOptions: Partial<AuthLogic>): AuthLogic;
903
+
904
+ /**
905
+ * 添加开放接口的鉴权逻辑
906
+ * @internal
907
+ * @param authLogic 已有的开放接口的鉴权逻辑实例
908
+ */
909
+ _addAuthLogicInAuthLogics(authLogic: AuthLogic): AuthLogic;
910
+
911
+ _addAuthLogicInAuthLogics(options?: string | Partial<AuthLogic> | AuthLogic) {
912
+ const index = this.authLogics.length;
913
+ return this._insertAuthLogicInAuthLogicsAt(options as any, index);
914
+ }
915
+
916
+ /**
917
+ * 添加开放接口的鉴权逻辑
918
+ * @internal
919
+ * @param name 开放接口的鉴权逻辑名称,如果不填会自动生成一个唯一名称
920
+ */
921
+ addAuthLogicInAuthLogics(name?: string): AuthLogic;
922
+
923
+ /**
924
+ * 添加开放接口的鉴权逻辑
925
+ * @param authLogicOptions 开放接口的鉴权逻辑参数
926
+ */
927
+ addAuthLogicInAuthLogics(authLogicOptions: Partial<AuthLogic>): AuthLogic;
928
+
929
+ /**
930
+ * 添加开放接口的鉴权逻辑
931
+ * @param authLogic 已有的开放接口的鉴权逻辑实例
932
+ */
933
+ addAuthLogicInAuthLogics(authLogic: AuthLogic): AuthLogic;
934
+
935
+ addAuthLogicInAuthLogics(options?: string | Partial<AuthLogic> | AuthLogic) {
936
+ const node = this._addAuthLogicInAuthLogics(options as any);
937
+ const index = this.authLogics.indexOf(node);
938
+ node.create({
939
+ index,
940
+ parentNode: this,
941
+ parentKey: 'authLogics',
942
+ });
943
+ return node;
944
+ }
945
+
946
+ getOverriddenLogicExistingNames(excludedList: Array<OverriddenLogic> = []) {
947
+ const excludedSet = new Set(excludedList);
948
+ return ((this.overriddenLogics as OverriddenLogic[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
949
+ }
950
+ getOverriddenLogicUniqueName(name = 'overriddenLogic1') {
951
+ return utils.unique(name, this.getOverriddenLogicExistingNames(), undefined, true);
952
+ }
953
+
954
+ /**
955
+ * 插入逻辑
956
+ * @internal
957
+ * @param name 逻辑名称,如果不填会自动生成一个唯一名称
958
+ */
959
+ _insertOverriddenLogicAt(name: string, index: number): OverriddenLogic;
960
+
961
+ /**
962
+ * 插入逻辑
963
+ * @internal
964
+ * @param overriddenLogicOptions 逻辑参数
965
+ */
966
+ _insertOverriddenLogicAt(overriddenLogicOptions: Partial<OverriddenLogic>, index: number): OverriddenLogic;
967
+
968
+ /**
969
+ * 插入逻辑
970
+ * @internal
971
+ * @param overriddenLogic 已有的逻辑实例
972
+ */
973
+ _insertOverriddenLogicAt(overriddenLogic: OverriddenLogic, index: number): OverriddenLogic;
974
+
975
+ _insertOverriddenLogicAt(options: string | Partial<OverriddenLogic> | OverriddenLogic, index: number) {
976
+ const overriddenLogicOptions: any = {};
977
+ const relationOptions = { parentNode: this, parentKey: 'overriddenLogics' };
978
+ let overriddenLogic: OverriddenLogic;
979
+ if (!options) {
980
+ overriddenLogic = OverriddenLogic.from({
981
+ ...overriddenLogicOptions,
982
+ name: this.getOverriddenLogicUniqueName(),
983
+ }, this, 'overriddenLogics');
984
+ } else if (typeof options === 'string') {
985
+ overriddenLogic = OverriddenLogic.from({
986
+ ...overriddenLogicOptions,
987
+ name: options,
988
+ }, this, 'overriddenLogics');
989
+ } else if (options instanceof OverriddenLogic) {
990
+ options.ensureDelete(); // 同一实例不支持多处存在
991
+ overriddenLogic = options;
992
+ Object.assign(overriddenLogic, relationOptions);
993
+ } else {
994
+ overriddenLogic = OverriddenLogic.from({
995
+ ...overriddenLogicOptions,
996
+ ...options,
997
+ }, this, 'overriddenLogics');
998
+ }
999
+ this.overriddenLogics.splice(index, 0, overriddenLogic);
1000
+ return overriddenLogic;
1001
+ }
1002
+
1003
+ /**
1004
+ * 插入逻辑
1005
+ * @param name 逻辑名称,如果不填会自动生成一个唯一名称
1006
+ */
1007
+ insertOverriddenLogicAt(name: string, index: number): OverriddenLogic;
1008
+
1009
+ /**
1010
+ * 插入逻辑
1011
+ * @param overriddenLogicOptions 逻辑参数
1012
+ */
1013
+ insertOverriddenLogicAt(overriddenLogicOptions: Partial<OverriddenLogic>, index: number): OverriddenLogic;
1014
+
1015
+ /**
1016
+ * 插入逻辑
1017
+ * @param overriddenLogic 已有的逻辑实例
1018
+ */
1019
+ insertOverriddenLogicAt(overriddenLogic: OverriddenLogic, index: number): OverriddenLogic;
1020
+
1021
+ insertOverriddenLogicAt(options: string | Partial<OverriddenLogic> | OverriddenLogic, index: number) {
1022
+ const node = this._insertOverriddenLogicAt(options as any, index);
1023
+ node.create({
1024
+ index,
1025
+ parentNode: this,
1026
+ parentKey: 'overriddenLogics',
1027
+ });
1028
+ return node;
1029
+ }
1030
+
1031
+ /**
1032
+ * 添加逻辑
1033
+ * @internal
1034
+ * @param name 逻辑名称,如果不填会自动生成一个唯一名称
1035
+ */
1036
+ _addOverriddenLogic(name?: string): OverriddenLogic;
1037
+
1038
+ /**
1039
+ * 添加逻辑
1040
+ * @internal
1041
+ * @param overriddenLogicOptions 逻辑参数
1042
+ */
1043
+ _addOverriddenLogic(overriddenLogicOptions: Partial<OverriddenLogic>): OverriddenLogic;
1044
+
1045
+ /**
1046
+ * 添加逻辑
1047
+ * @internal
1048
+ * @param overriddenLogic 已有的逻辑实例
1049
+ */
1050
+ _addOverriddenLogic(overriddenLogic: OverriddenLogic): OverriddenLogic;
1051
+
1052
+ _addOverriddenLogic(options?: string | Partial<OverriddenLogic> | OverriddenLogic) {
1053
+ const index = 0;
1054
+ return this._insertOverriddenLogicAt(options as any, index);
1055
+ }
1056
+
1057
+ /**
1058
+ * 添加逻辑
1059
+ * @internal
1060
+ * @param name 逻辑名称,如果不填会自动生成一个唯一名称
1061
+ */
1062
+ addOverriddenLogic(name?: string): OverriddenLogic;
1063
+
1064
+ /**
1065
+ * 添加逻辑
1066
+ * @param overriddenLogicOptions 逻辑参数
1067
+ */
1068
+ addOverriddenLogic(overriddenLogicOptions: Partial<OverriddenLogic>): OverriddenLogic;
1069
+
1070
+ /**
1071
+ * 添加逻辑
1072
+ * @param overriddenLogic 已有的逻辑实例
1073
+ */
1074
+ addOverriddenLogic(overriddenLogic: OverriddenLogic): OverriddenLogic;
1075
+
1076
+ addOverriddenLogic(options?: string | Partial<OverriddenLogic> | OverriddenLogic) {
1077
+ const node = this._addOverriddenLogic(options as any);
1078
+ const index = this.overriddenLogics.indexOf(node);
1079
+ node.create({
1080
+ index,
1081
+ parentNode: this,
1082
+ parentKey: 'overriddenLogics',
1083
+ });
1084
+ return node;
1085
+ }
1086
+
784
1087
  getInterfaceExistingNames(excludedList: Array<Interface> = []) {
785
1088
  const excludedSet = new Set(excludedList);
786
1089
  return ((this.interfaces as Interface[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
@@ -794,23 +1097,23 @@ export class App extends BaseNode {
794
1097
  * @internal
795
1098
  * @param name 接口名称,如果不填会自动生成一个唯一名称
796
1099
  */
797
- _insertInterfaceAt(name: string, index: number): Interface;
1100
+ _insertInterfaceInInterfacesAt(name: string, index: number): Interface;
798
1101
 
799
1102
  /**
800
1103
  * 插入接口
801
1104
  * @internal
802
1105
  * @param itfaceOptions 接口参数
803
1106
  */
804
- _insertInterfaceAt(itfaceOptions: Partial<Interface>, index: number): Interface;
1107
+ _insertInterfaceInInterfacesAt(itfaceOptions: Partial<Interface>, index: number): Interface;
805
1108
 
806
1109
  /**
807
1110
  * 插入接口
808
1111
  * @internal
809
1112
  * @param itface 已有的接口实例
810
1113
  */
811
- _insertInterfaceAt(itface: Interface, index: number): Interface;
1114
+ _insertInterfaceInInterfacesAt(itface: Interface, index: number): Interface;
812
1115
 
813
- _insertInterfaceAt(options: string | Partial<Interface> | Interface, index: number) {
1116
+ _insertInterfaceInInterfacesAt(options: string | Partial<Interface> | Interface, index: number) {
814
1117
  const itfaceOptions: any = {};
815
1118
  const relationOptions = { parentNode: this, parentKey: 'interfaces' };
816
1119
  let itface: Interface;
@@ -842,22 +1145,155 @@ export class App extends BaseNode {
842
1145
  * 插入接口
843
1146
  * @param name 接口名称,如果不填会自动生成一个唯一名称
844
1147
  */
845
- insertInterfaceAt(name: string, index: number): Interface;
1148
+ insertInterfaceInInterfacesAt(name: string, index: number): Interface;
1149
+
1150
+ /**
1151
+ * 插入接口
1152
+ * @param itfaceOptions 接口参数
1153
+ */
1154
+ insertInterfaceInInterfacesAt(itfaceOptions: Partial<Interface>, index: number): Interface;
1155
+
1156
+ /**
1157
+ * 插入接口
1158
+ * @param itface 已有的接口实例
1159
+ */
1160
+ insertInterfaceInInterfacesAt(itface: Interface, index: number): Interface;
1161
+
1162
+ insertInterfaceInInterfacesAt(options: string | Partial<Interface> | Interface, index: number) {
1163
+ const node = this._insertInterfaceInInterfacesAt(options as any, index);
1164
+ node.create({
1165
+ index,
1166
+ parentNode: this,
1167
+ parentKey: 'interfaces',
1168
+ });
1169
+ return node;
1170
+ }
1171
+
1172
+ /**
1173
+ * 添加接口
1174
+ * @internal
1175
+ * @param name 接口名称,如果不填会自动生成一个唯一名称
1176
+ */
1177
+ _addInterfaceInInterfaces(name?: string): Interface;
1178
+
1179
+ /**
1180
+ * 添加接口
1181
+ * @internal
1182
+ * @param itfaceOptions 接口参数
1183
+ */
1184
+ _addInterfaceInInterfaces(itfaceOptions: Partial<Interface>): Interface;
1185
+
1186
+ /**
1187
+ * 添加接口
1188
+ * @internal
1189
+ * @param itface 已有的接口实例
1190
+ */
1191
+ _addInterfaceInInterfaces(itface: Interface): Interface;
1192
+
1193
+ _addInterfaceInInterfaces(options?: string | Partial<Interface> | Interface) {
1194
+ const index = 0;
1195
+ return this._insertInterfaceInInterfacesAt(options as any, index);
1196
+ }
1197
+
1198
+ /**
1199
+ * 添加接口
1200
+ * @internal
1201
+ * @param name 接口名称,如果不填会自动生成一个唯一名称
1202
+ */
1203
+ addInterfaceInInterfaces(name?: string): Interface;
1204
+
1205
+ /**
1206
+ * 添加接口
1207
+ * @param itfaceOptions 接口参数
1208
+ */
1209
+ addInterfaceInInterfaces(itfaceOptions: Partial<Interface>): Interface;
1210
+
1211
+ /**
1212
+ * 添加接口
1213
+ * @param itface 已有的接口实例
1214
+ */
1215
+ addInterfaceInInterfaces(itface: Interface): Interface;
1216
+
1217
+ addInterfaceInInterfaces(options?: string | Partial<Interface> | Interface) {
1218
+ const node = this._addInterfaceInInterfaces(options as any);
1219
+ const index = this.interfaces.indexOf(node);
1220
+ node.create({
1221
+ index,
1222
+ parentNode: this,
1223
+ parentKey: 'interfaces',
1224
+ });
1225
+ return node;
1226
+ }
1227
+
1228
+ /**
1229
+ * 插入接口
1230
+ * @internal
1231
+ * @param name 接口名称,如果不填会自动生成一个唯一名称
1232
+ */
1233
+ _insertAuthInterfaceInInterfacesAt(name: string, index: number): AuthInterface;
1234
+
1235
+ /**
1236
+ * 插入接口
1237
+ * @internal
1238
+ * @param itfaceOptions 接口参数
1239
+ */
1240
+ _insertAuthInterfaceInInterfacesAt(itfaceOptions: Partial<AuthInterface>, index: number): AuthInterface;
1241
+
1242
+ /**
1243
+ * 插入接口
1244
+ * @internal
1245
+ * @param itface 已有的接口实例
1246
+ */
1247
+ _insertAuthInterfaceInInterfacesAt(itface: AuthInterface, index: number): AuthInterface;
1248
+
1249
+ _insertAuthInterfaceInInterfacesAt(options: string | Partial<AuthInterface> | AuthInterface, index: number) {
1250
+ const itfaceOptions: any = {};
1251
+ const relationOptions = { parentNode: this, parentKey: 'interfaces' };
1252
+ let itface: AuthInterface;
1253
+ if (!options) {
1254
+ itface = AuthInterface.from({
1255
+ ...itfaceOptions,
1256
+ name: this.getAuthInterfaceUniqueName(),
1257
+ }, this, 'interfaces');
1258
+ } else if (typeof options === 'string') {
1259
+ itface = AuthInterface.from({
1260
+ ...itfaceOptions,
1261
+ name: options,
1262
+ }, this, 'interfaces');
1263
+ } else if (options instanceof AuthInterface) {
1264
+ options.ensureDelete(); // 同一实例不支持多处存在
1265
+ itface = options;
1266
+ Object.assign(itface, relationOptions);
1267
+ } else {
1268
+ itface = AuthInterface.from({
1269
+ ...itfaceOptions,
1270
+ ...options,
1271
+ }, this, 'interfaces');
1272
+ }
1273
+ this.interfaces.splice(index, 0, itface);
1274
+ return itface;
1275
+ }
1276
+
1277
+ /**
1278
+ * 插入接口
1279
+ * @param name 接口名称,如果不填会自动生成一个唯一名称
1280
+ */
1281
+ insertAuthInterfaceInInterfacesAt(name: string, index: number): AuthInterface;
846
1282
 
847
1283
  /**
848
1284
  * 插入接口
849
1285
  * @param itfaceOptions 接口参数
850
1286
  */
851
- insertInterfaceAt(itfaceOptions: Partial<Interface>, index: number): Interface;
1287
+ insertAuthInterfaceInInterfacesAt(itfaceOptions: Partial<AuthInterface>, index: number): AuthInterface;
852
1288
 
853
1289
  /**
854
1290
  * 插入接口
855
1291
  * @param itface 已有的接口实例
856
1292
  */
857
- insertInterfaceAt(itface: Interface, index: number): Interface;
1293
+ insertAuthInterfaceInInterfacesAt(itface: AuthInterface, index: number): AuthInterface;
858
1294
 
859
- insertInterfaceAt(options: string | Partial<Interface> | Interface, index: number) {
860
- const node = this._insertInterfaceAt(options as any, index);
1295
+ insertAuthInterfaceInInterfacesAt(options: string | Partial<AuthInterface> | AuthInterface, index: number) {
1296
+ const node = this._insertAuthInterfaceInInterfacesAt(options as any, index);
861
1297
  node.create({
862
1298
  index,
863
1299
  parentNode: this,
@@ -871,25 +1307,25 @@ export class App extends BaseNode {
871
1307
  * @internal
872
1308
  * @param name 接口名称,如果不填会自动生成一个唯一名称
873
1309
  */
874
- _addInterface(name?: string): Interface;
1310
+ _addAuthInterfaceInInterfaces(name?: string): AuthInterface;
875
1311
 
876
1312
  /**
877
1313
  * 添加接口
878
1314
  * @internal
879
1315
  * @param itfaceOptions 接口参数
880
1316
  */
881
- _addInterface(itfaceOptions: Partial<Interface>): Interface;
1317
+ _addAuthInterfaceInInterfaces(itfaceOptions: Partial<AuthInterface>): AuthInterface;
882
1318
 
883
1319
  /**
884
1320
  * 添加接口
885
1321
  * @internal
886
1322
  * @param itface 已有的接口实例
887
1323
  */
888
- _addInterface(itface: Interface): Interface;
1324
+ _addAuthInterfaceInInterfaces(itface: AuthInterface): AuthInterface;
889
1325
 
890
- _addInterface(options?: string | Partial<Interface> | Interface) {
1326
+ _addAuthInterfaceInInterfaces(options?: string | Partial<AuthInterface> | AuthInterface) {
891
1327
  const index = 0;
892
- return this._insertInterfaceAt(options as any, index);
1328
+ return this._insertAuthInterfaceInInterfacesAt(options as any, index);
893
1329
  }
894
1330
 
895
1331
  /**
@@ -897,22 +1333,22 @@ export class App extends BaseNode {
897
1333
  * @internal
898
1334
  * @param name 接口名称,如果不填会自动生成一个唯一名称
899
1335
  */
900
- addInterface(name?: string): Interface;
1336
+ addAuthInterfaceInInterfaces(name?: string): AuthInterface;
901
1337
 
902
1338
  /**
903
1339
  * 添加接口
904
1340
  * @param itfaceOptions 接口参数
905
1341
  */
906
- addInterface(itfaceOptions: Partial<Interface>): Interface;
1342
+ addAuthInterfaceInInterfaces(itfaceOptions: Partial<AuthInterface>): AuthInterface;
907
1343
 
908
1344
  /**
909
1345
  * 添加接口
910
1346
  * @param itface 已有的接口实例
911
1347
  */
912
- addInterface(itface: Interface): Interface;
1348
+ addAuthInterfaceInInterfaces(itface: AuthInterface): AuthInterface;
913
1349
 
914
- addInterface(options?: string | Partial<Interface> | Interface) {
915
- const node = this._addInterface(options as any);
1350
+ addAuthInterfaceInInterfaces(options?: string | Partial<AuthInterface> | AuthInterface) {
1351
+ const node = this._addAuthInterfaceInInterfaces(options as any);
916
1352
  const index = this.interfaces.indexOf(node);
917
1353
  node.create({
918
1354
  index,
@@ -1619,6 +2055,147 @@ export class App extends BaseNode {
1619
2055
  return node;
1620
2056
  }
1621
2057
 
2058
+ getAuthLogicForCallInterfaceExistingNames(excludedList: Array<AuthLogicForCallInterface> = []) {
2059
+ const excludedSet = new Set(excludedList);
2060
+ return ((this.authLogicsForCallInterface as AuthLogicForCallInterface[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
2061
+ }
2062
+ getAuthLogicForCallInterfaceUniqueName(name = 'authLogicForCallInterface1') {
2063
+ return utils.unique(name, this.getAuthLogicForCallInterfaceExistingNames(), undefined, false);
2064
+ }
2065
+
2066
+ /**
2067
+ * 插入调用的鉴权逻辑
2068
+ * @internal
2069
+ * @param name 调用的鉴权逻辑名称,如果不填会自动生成一个唯一名称
2070
+ */
2071
+ _insertAuthLogicForCallInterfaceAt(name: string, index: number): AuthLogicForCallInterface;
2072
+
2073
+ /**
2074
+ * 插入调用的鉴权逻辑
2075
+ * @internal
2076
+ * @param authLogicForCallInterfaceOptions 调用的鉴权逻辑参数
2077
+ */
2078
+ _insertAuthLogicForCallInterfaceAt(authLogicForCallInterfaceOptions: Partial<AuthLogicForCallInterface>, index: number): AuthLogicForCallInterface;
2079
+
2080
+ /**
2081
+ * 插入调用的鉴权逻辑
2082
+ * @internal
2083
+ * @param authLogicForCallInterface 已有的调用的鉴权逻辑实例
2084
+ */
2085
+ _insertAuthLogicForCallInterfaceAt(authLogicForCallInterface: AuthLogicForCallInterface, index: number): AuthLogicForCallInterface;
2086
+
2087
+ _insertAuthLogicForCallInterfaceAt(options: string | Partial<AuthLogicForCallInterface> | AuthLogicForCallInterface, index: number) {
2088
+ const authLogicForCallInterfaceOptions: any = {};
2089
+ const relationOptions = { parentNode: this, parentKey: 'authLogicsForCallInterface' };
2090
+ let authLogicForCallInterface: AuthLogicForCallInterface;
2091
+ if (!options) {
2092
+ authLogicForCallInterface = AuthLogicForCallInterface.from({
2093
+ ...authLogicForCallInterfaceOptions,
2094
+ name: this.getAuthLogicForCallInterfaceUniqueName(),
2095
+ }, this, 'authLogicsForCallInterface');
2096
+ } else if (typeof options === 'string') {
2097
+ authLogicForCallInterface = AuthLogicForCallInterface.from({
2098
+ ...authLogicForCallInterfaceOptions,
2099
+ name: options,
2100
+ }, this, 'authLogicsForCallInterface');
2101
+ } else if (options instanceof AuthLogicForCallInterface) {
2102
+ options.ensureDelete(); // 同一实例不支持多处存在
2103
+ authLogicForCallInterface = options;
2104
+ Object.assign(authLogicForCallInterface, relationOptions);
2105
+ } else {
2106
+ authLogicForCallInterface = AuthLogicForCallInterface.from({
2107
+ ...authLogicForCallInterfaceOptions,
2108
+ ...options,
2109
+ }, this, 'authLogicsForCallInterface');
2110
+ }
2111
+ this.authLogicsForCallInterface.splice(index, 0, authLogicForCallInterface);
2112
+ return authLogicForCallInterface;
2113
+ }
2114
+
2115
+ /**
2116
+ * 插入调用的鉴权逻辑
2117
+ * @param name 调用的鉴权逻辑名称,如果不填会自动生成一个唯一名称
2118
+ */
2119
+ insertAuthLogicForCallInterfaceAt(name: string, index: number): AuthLogicForCallInterface;
2120
+
2121
+ /**
2122
+ * 插入调用的鉴权逻辑
2123
+ * @param authLogicForCallInterfaceOptions 调用的鉴权逻辑参数
2124
+ */
2125
+ insertAuthLogicForCallInterfaceAt(authLogicForCallInterfaceOptions: Partial<AuthLogicForCallInterface>, index: number): AuthLogicForCallInterface;
2126
+
2127
+ /**
2128
+ * 插入调用的鉴权逻辑
2129
+ * @param authLogicForCallInterface 已有的调用的鉴权逻辑实例
2130
+ */
2131
+ insertAuthLogicForCallInterfaceAt(authLogicForCallInterface: AuthLogicForCallInterface, index: number): AuthLogicForCallInterface;
2132
+
2133
+ insertAuthLogicForCallInterfaceAt(options: string | Partial<AuthLogicForCallInterface> | AuthLogicForCallInterface, index: number) {
2134
+ const node = this._insertAuthLogicForCallInterfaceAt(options as any, index);
2135
+ node.create({
2136
+ index,
2137
+ parentNode: this,
2138
+ parentKey: 'authLogicsForCallInterface',
2139
+ });
2140
+ return node;
2141
+ }
2142
+
2143
+ /**
2144
+ * 添加调用的鉴权逻辑
2145
+ * @internal
2146
+ * @param name 调用的鉴权逻辑名称,如果不填会自动生成一个唯一名称
2147
+ */
2148
+ _addAuthLogicForCallInterface(name?: string): AuthLogicForCallInterface;
2149
+
2150
+ /**
2151
+ * 添加调用的鉴权逻辑
2152
+ * @internal
2153
+ * @param authLogicForCallInterfaceOptions 调用的鉴权逻辑参数
2154
+ */
2155
+ _addAuthLogicForCallInterface(authLogicForCallInterfaceOptions: Partial<AuthLogicForCallInterface>): AuthLogicForCallInterface;
2156
+
2157
+ /**
2158
+ * 添加调用的鉴权逻辑
2159
+ * @internal
2160
+ * @param authLogicForCallInterface 已有的调用的鉴权逻辑实例
2161
+ */
2162
+ _addAuthLogicForCallInterface(authLogicForCallInterface: AuthLogicForCallInterface): AuthLogicForCallInterface;
2163
+
2164
+ _addAuthLogicForCallInterface(options?: string | Partial<AuthLogicForCallInterface> | AuthLogicForCallInterface) {
2165
+ const index = this.authLogicsForCallInterface.length;
2166
+ return this._insertAuthLogicForCallInterfaceAt(options as any, index);
2167
+ }
2168
+
2169
+ /**
2170
+ * 添加调用的鉴权逻辑
2171
+ * @internal
2172
+ * @param name 调用的鉴权逻辑名称,如果不填会自动生成一个唯一名称
2173
+ */
2174
+ addAuthLogicForCallInterface(name?: string): AuthLogicForCallInterface;
2175
+
2176
+ /**
2177
+ * 添加调用的鉴权逻辑
2178
+ * @param authLogicForCallInterfaceOptions 调用的鉴权逻辑参数
2179
+ */
2180
+ addAuthLogicForCallInterface(authLogicForCallInterfaceOptions: Partial<AuthLogicForCallInterface>): AuthLogicForCallInterface;
2181
+
2182
+ /**
2183
+ * 添加调用的鉴权逻辑
2184
+ * @param authLogicForCallInterface 已有的调用的鉴权逻辑实例
2185
+ */
2186
+ addAuthLogicForCallInterface(authLogicForCallInterface: AuthLogicForCallInterface): AuthLogicForCallInterface;
2187
+
2188
+ addAuthLogicForCallInterface(options?: string | Partial<AuthLogicForCallInterface> | AuthLogicForCallInterface) {
2189
+ const node = this._addAuthLogicForCallInterface(options as any);
2190
+ const index = this.authLogicsForCallInterface.indexOf(node);
2191
+ node.create({
2192
+ index,
2193
+ parentNode: this,
2194
+ parentKey: 'authLogicsForCallInterface',
2195
+ });
2196
+ return node;
2197
+ }
2198
+
1622
2199
  /**
1623
2200
  * 删除数据源
1624
2201
  * @param name 数据源名称
@@ -1788,6 +2365,31 @@ export class App extends BaseNode {
1788
2365
  return logic.delete();
1789
2366
  }
1790
2367
 
2368
+ /**
2369
+ * 删除开放接口的鉴权逻辑
2370
+ * @param name 开放接口的鉴权逻辑名称
2371
+ */
2372
+ removeAuthLogicInAuthLogics(name: string): void;
2373
+
2374
+ /**
2375
+ * 删除开放接口的鉴权逻辑
2376
+ * @param authLogic 已有的开放接口的鉴权逻辑实例
2377
+ */
2378
+ removeAuthLogicInAuthLogics(authLogic: AuthLogic): void;
2379
+
2380
+ removeAuthLogicInAuthLogics(options: string | AuthLogic) {
2381
+ let authLogic: AuthLogic;
2382
+ if (typeof options === 'string') {
2383
+ authLogic = (this.authLogics as AuthLogic[]).find((item) => item.name === options);
2384
+ if (!authLogic) {
2385
+ throw new Error('找不到开放接口的鉴权逻辑 ' + options);
2386
+ }
2387
+ } else {
2388
+ authLogic = options;
2389
+ }
2390
+ return authLogic.delete();
2391
+ }
2392
+
1791
2393
  __removeLogic(logic: Logic) {
1792
2394
  const parentKey = logic.parentKey;
1793
2395
  const params: Params = {
@@ -1811,19 +2413,67 @@ export class App extends BaseNode {
1811
2413
  return params;
1812
2414
  }
1813
2415
 
2416
+ /**
2417
+ * 删除逻辑
2418
+ * @param name 逻辑名称
2419
+ */
2420
+ removeOverriddenLogic(name: string): void;
2421
+
2422
+ /**
2423
+ * 删除逻辑
2424
+ * @param overriddenLogic 已有的逻辑实例
2425
+ */
2426
+ removeOverriddenLogic(overriddenLogic: OverriddenLogic): void;
2427
+
2428
+ removeOverriddenLogic(options: string | OverriddenLogic) {
2429
+ let overriddenLogic: OverriddenLogic;
2430
+ if (typeof options === 'string') {
2431
+ overriddenLogic = (this.overriddenLogics as OverriddenLogic[]).find((item) => item.name === options);
2432
+ if (!overriddenLogic) {
2433
+ throw new Error('找不到逻辑 ' + options);
2434
+ }
2435
+ } else {
2436
+ overriddenLogic = options;
2437
+ }
2438
+ return overriddenLogic.delete();
2439
+ }
2440
+
2441
+ __removeOverriddenLogic(overriddenLogic: OverriddenLogic) {
2442
+ const parentKey = overriddenLogic.parentKey;
2443
+ const params: Params = {
2444
+ parentNode: this,
2445
+ parentKey,
2446
+ index: -1,
2447
+ object: null,
2448
+ oldObject: overriddenLogic,
2449
+ };
2450
+ if (parentKey) {
2451
+ params.parentKey = parentKey;
2452
+ if (Array.isArray((this as any)[parentKey])) {
2453
+ const index = (this as any)[parentKey].indexOf(overriddenLogic);
2454
+ ~index && (this as any)[parentKey].splice(index, 1);
2455
+ params.index = index;
2456
+ } else if ((this as any)[parentKey] === overriddenLogic) {
2457
+ params.index = 0;
2458
+ (this as any)[parentKey] = undefined;
2459
+ }
2460
+ }
2461
+ return params;
2462
+ }
2463
+
1814
2464
  /**
1815
2465
  * 删除接口
1816
2466
  * @param name 接口名称
1817
2467
  */
1818
- removeInterface(name: string): void;
2468
+ removeInterfaceInInterfaces(name: string): void;
1819
2469
 
1820
2470
  /**
1821
2471
  * 删除接口
1822
2472
  * @param itface 已有的接口实例
1823
2473
  */
1824
- removeInterface(itface: Interface): void;
2474
+ removeInterfaceInInterfaces(itface: Interface): void;
1825
2475
 
1826
- removeInterface(options: string | Interface) {
2476
+ removeInterfaceInInterfaces(options: string | Interface) {
1827
2477
  let itface: Interface;
1828
2478
  if (typeof options === 'string') {
1829
2479
  itface = (this.interfaces as Interface[]).find((item) => item.name === options);
@@ -1836,6 +2486,31 @@ export class App extends BaseNode {
1836
2486
  return itface.delete();
1837
2487
  }
1838
2488
 
2489
+ /**
2490
+ * 删除接口
2491
+ * @param name 接口名称
2492
+ */
2493
+ removeAuthInterfaceInInterfaces(name: string): void;
2494
+
2495
+ /**
2496
+ * 删除接口
2497
+ * @param itface 已有的接口实例
2498
+ */
2499
+ removeAuthInterfaceInInterfaces(itface: AuthInterface): void;
2500
+
2501
+ removeAuthInterfaceInInterfaces(options: string | AuthInterface) {
2502
+ let itface: AuthInterface;
2503
+ if (typeof options === 'string') {
2504
+ itface = (this.interfaces as AuthInterface[]).find((item) => item.name === options);
2505
+ if (!itface) {
2506
+ throw new Error('找不到接口 ' + options);
2507
+ }
2508
+ } else {
2509
+ itface = options;
2510
+ }
2511
+ return itface.delete();
2512
+ }
2513
+
1839
2514
  __removeInterface(itface: Interface) {
1840
2515
  const parentKey = itface.parentKey;
1841
2516
  const params: Params = {
@@ -1907,6 +2582,54 @@ export class App extends BaseNode {
1907
2582
  return params;
1908
2583
  }
1909
2584
 
2585
+ /**
2586
+ * 删除后端
2587
+ * @param name 后端名称
2588
+ */
2589
+ removeBackend(name: string): void;
2590
+
2591
+ /**
2592
+ * 删除后端
2593
+ * @param backend 已有的后端实例
2594
+ */
2595
+ removeBackend(backend: Backend): void;
2596
+
2597
+ removeBackend(options: string | Backend) {
2598
+ let backend: Backend;
2599
+ if (typeof options === 'string') {
2600
+ backend = this.backend;
2601
+ if (!backend) {
2602
+ throw new Error('找不到后端 ' + options);
2603
+ }
2604
+ } else {
2605
+ backend = options;
2606
+ }
2607
+ return backend.delete();
2608
+ }
2609
+
2610
+ __removeBackend(backend: Backend) {
2611
+ const parentKey = backend.parentKey;
2612
+ const params: Params = {
2613
+ parentNode: this,
2614
+ parentKey,
2615
+ index: -1,
2616
+ object: null,
2617
+ oldObject: backend,
2618
+ };
2619
+ if (parentKey) {
2620
+ params.parentKey = parentKey;
2621
+ if (Array.isArray((this as any)[parentKey])) {
2622
+ const index = (this as any)[parentKey].indexOf(backend);
2623
+ ~index && (this as any)[parentKey].splice(index, 1);
2624
+ params.index = index;
2625
+ } else if ((this as any)[parentKey] === backend) {
2626
+ params.index = 0;
2627
+ (this as any)[parentKey] = undefined;
2628
+ }
2629
+ }
2630
+ return params;
2631
+ }
2632
+
1910
2633
  /**
1911
2634
  * 删除流程
1912
2635
  * @param name 流程名称
@@ -2172,6 +2895,54 @@ export class App extends BaseNode {
2172
2895
  return params;
2173
2896
  }
2174
2897
 
2898
+ /**
2899
+ * 删除调用的鉴权逻辑
2900
+ * @param name 调用的鉴权逻辑名称
2901
+ */
2902
+ removeAuthLogicForCallInterface(name: string): void;
2903
+
2904
+ /**
2905
+ * 删除调用的鉴权逻辑
2906
+ * @param authLogicForCallInterface 已有的调用的鉴权逻辑实例
2907
+ */
2908
+ removeAuthLogicForCallInterface(authLogicForCallInterface: AuthLogicForCallInterface): void;
2909
+
2910
+ removeAuthLogicForCallInterface(options: string | AuthLogicForCallInterface) {
2911
+ let authLogicForCallInterface: AuthLogicForCallInterface;
2912
+ if (typeof options === 'string') {
2913
+ authLogicForCallInterface = (this.authLogicsForCallInterface as AuthLogicForCallInterface[]).find((item) => item.name === options);
2914
+ if (!authLogicForCallInterface) {
2915
+ throw new Error('找不到调用的鉴权逻辑 ' + options);
2916
+ }
2917
+ } else {
2918
+ authLogicForCallInterface = options;
2919
+ }
2920
+ return authLogicForCallInterface.delete();
2921
+ }
2922
+
2923
+ __removeAuthLogic(authLogic: AuthLogic) {
2924
+ const parentKey = authLogic.parentKey;
2925
+ const params: Params = {
2926
+ parentNode: this,
2927
+ parentKey,
2928
+ index: -1,
2929
+ object: null,
2930
+ oldObject: authLogic,
2931
+ };
2932
+ if (parentKey) {
2933
+ params.parentKey = parentKey;
2934
+ if (Array.isArray((this as any)[parentKey])) {
2935
+ const index = (this as any)[parentKey].indexOf(authLogic);
2936
+ ~index && (this as any)[parentKey].splice(index, 1);
2937
+ params.index = index;
2938
+ } else if ((this as any)[parentKey] === authLogic) {
2939
+ params.index = 0;
2940
+ (this as any)[parentKey] = undefined;
2941
+ }
2942
+ }
2943
+ return params;
2944
+ }
2945
+
2175
2946
  //================================================================================
2176
2947
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
2177
2948
  // 自动生成的代码已结束。下面可以手动编写。
@@ -2426,7 +3197,26 @@ export class App extends BaseNode {
2426
3197
  // 同名的依赖库 只启用第一个
2427
3198
  // (options as Module).enable = hasSameVersion;
2428
3199
  }
3200
+ // 导入依赖库的时候如果有logic 且logic 可以被覆写 需要在app overideLogic 新增一个
3201
+ // 但是导入局部模板的时候已经手动新增了 这里就不需要了
3202
+ // 当依赖库被删除 的时候同样要删除 overideLogic
3203
+ // 支持局部模板导出导入overideLogic
3204
+ // 只复制 depLogic 输入输出参数
2429
3205
  const node = this.addModuleInDependencies(options as any);
3206
+
3207
+ if (node?.logics && node?.logics.length > 0) {
3208
+ node.logics.forEach((logic) => {
3209
+ if (logic?.overridable) {
3210
+ const existing = this.overriddenLogics.find((ol) => ol.name === logic.name);
3211
+ !existing && this.addOverriddenLogic({
3212
+ name: logic.name,
3213
+ overriddenModule: node.name,
3214
+ returns: logic.returns.map((r) => r.toJSON()),
3215
+ params: logic.params.map((r) => r.toJSON()),
3216
+ });
3217
+ }
3218
+ });
3219
+ }
2430
3220
  // 启用的依赖库才创建数据源
2431
3221
  // if (node.enable && node.dataSources) {
2432
3222
  if (node.dataSources) {
@@ -2662,7 +3452,7 @@ export class App extends BaseNode {
2662
3452
  getJavaLogicUniqueName(name = 'javalogic1') {
2663
3453
  return utils.unique(name, this.getLogicExistingNames(), undefined, true);
2664
3454
  }
2665
-
3455
+
2666
3456
  getJavaLogicClassUniqueName(name = 'Javalogic1') {
2667
3457
  return utils.unique(name, this.getLogicExistingNames(), undefined, true) + 'Service';
2668
3458
  }
@@ -2706,6 +3496,18 @@ export class App extends BaseNode {
2706
3496
  }
2707
3497
  __databaseTypeMap: any = {};
2708
3498
 
3499
+ getAuthLogicExistingNames(excludedList: Array<AuthLogic> = []) {
3500
+ const excludedSet = new Set(excludedList);
3501
+ return ((this.authLogics as AuthLogic[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
3502
+ }
3503
+ getAuthLogicUniqueName(name = 'authentication1') {
3504
+ return utils.unique(name, this.getAuthLogicExistingNames(), undefined, true);
3505
+ }
3506
+
3507
+ getAuthInterfaceUniqueName(name = 'authInterface1') {
3508
+ // never used
3509
+ }
3510
+
2709
3511
  //================================================================================
2710
3512
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
2711
3513
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓