@lcap/nasl 2.22.1 → 2.22.2-beta.2

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 (152) hide show
  1. package/out/breakpoint/generator/AfterStartNode.d.ts +7 -0
  2. package/out/breakpoint/generator/AfterStartNode.js +27 -0
  3. package/out/breakpoint/generator/AfterStartNode.js.map +1 -0
  4. package/out/breakpoint/generator/BeforeEndNode.d.ts +7 -0
  5. package/out/breakpoint/generator/BeforeEndNode.js +27 -0
  6. package/out/breakpoint/generator/BeforeEndNode.js.map +1 -0
  7. package/out/breakpoint/generator/BreakpointNode.d.ts +14 -0
  8. package/out/breakpoint/generator/BreakpointNode.js +200 -0
  9. package/out/breakpoint/generator/BreakpointNode.js.map +1 -0
  10. package/out/breakpoint/generator/index.d.ts +4 -0
  11. package/out/breakpoint/generator/index.js +98 -0
  12. package/out/breakpoint/generator/index.js.map +1 -0
  13. package/out/breakpoint/index.d.ts +3 -0
  14. package/out/breakpoint/index.js +20 -0
  15. package/out/breakpoint/index.js.map +1 -0
  16. package/out/breakpoint/shared/constants.d.ts +31 -0
  17. package/out/breakpoint/shared/constants.js +91 -0
  18. package/out/breakpoint/shared/constants.js.map +1 -0
  19. package/out/breakpoint/shared/index.d.ts +3 -0
  20. package/out/breakpoint/shared/index.js +33 -0
  21. package/out/breakpoint/shared/index.js.map +1 -0
  22. package/out/breakpoint/shared/operations.d.ts +10 -0
  23. package/out/breakpoint/shared/operations.js +25 -0
  24. package/out/breakpoint/shared/operations.js.map +1 -0
  25. package/out/breakpoint/shared/socket.d.ts +47 -0
  26. package/out/breakpoint/shared/socket.js +210 -0
  27. package/out/breakpoint/shared/socket.js.map +1 -0
  28. package/out/breakpoint/shared/utils.d.ts +23 -0
  29. package/out/breakpoint/shared/utils.js +165 -0
  30. package/out/breakpoint/shared/utils.js.map +1 -0
  31. package/out/breakpoint/store/core.d.ts +32 -0
  32. package/out/breakpoint/store/core.js +388 -0
  33. package/out/breakpoint/store/core.js.map +1 -0
  34. package/out/breakpoint/store/dock.d.ts +1 -0
  35. package/out/breakpoint/store/dock.js +127 -0
  36. package/out/breakpoint/store/dock.js.map +1 -0
  37. package/out/breakpoint/store/index.d.ts +2 -0
  38. package/out/breakpoint/store/index.js +19 -0
  39. package/out/breakpoint/store/index.js.map +1 -0
  40. package/out/common/Command.js +1 -1
  41. package/out/common/Command.js.map +1 -1
  42. package/out/common/asyncFuncMap.d.ts +2 -0
  43. package/out/common/asyncFuncMap.js +16 -0
  44. package/out/common/asyncFuncMap.js.map +1 -0
  45. package/out/concepts/AnonymousFunction__.js +11 -9
  46. package/out/concepts/AnonymousFunction__.js.map +1 -1
  47. package/out/concepts/AuthInterface__.d.ts +37 -0
  48. package/out/concepts/AuthInterface__.js +141 -0
  49. package/out/concepts/AuthInterface__.js.map +1 -0
  50. package/out/concepts/AuthLogicForCallInterface__.d.ts +138 -0
  51. package/out/concepts/AuthLogicForCallInterface__.js +493 -0
  52. package/out/concepts/AuthLogicForCallInterface__.js.map +1 -0
  53. package/out/concepts/AuthLogic__.d.ts +66 -0
  54. package/out/concepts/AuthLogic__.js +206 -0
  55. package/out/concepts/AuthLogic__.js.map +1 -0
  56. package/out/concepts/BackendVariable__.d.ts +137 -0
  57. package/out/concepts/BackendVariable__.js +422 -0
  58. package/out/concepts/BackendVariable__.js.map +1 -0
  59. package/out/concepts/Backend__.d.ts +134 -0
  60. package/out/concepts/Backend__.js +274 -0
  61. package/out/concepts/Backend__.js.map +1 -0
  62. package/out/concepts/CallAuthInterface__.d.ts +126 -0
  63. package/out/concepts/CallAuthInterface__.js +408 -0
  64. package/out/concepts/CallAuthInterface__.js.map +1 -0
  65. package/out/concepts/CallConnector__.d.ts +42 -0
  66. package/out/concepts/CallConnector__.js +198 -0
  67. package/out/concepts/CallConnector__.js.map +1 -0
  68. package/out/concepts/ConnectorTrigger__.d.ts +78 -0
  69. package/out/concepts/ConnectorTrigger__.js +155 -0
  70. package/out/concepts/ConnectorTrigger__.js.map +1 -0
  71. package/out/concepts/Connector__.d.ts +464 -0
  72. package/out/concepts/Connector__.js +698 -0
  73. package/out/concepts/Connector__.js.map +1 -0
  74. package/out/concepts/Destination__.js +6 -4
  75. package/out/concepts/Destination__.js.map +1 -1
  76. package/out/concepts/FrontendVariable__.d.ts +21 -0
  77. package/out/concepts/FrontendVariable__.js +64 -0
  78. package/out/concepts/FrontendVariable__.js.map +1 -0
  79. package/out/concepts/Match__.js +25 -6
  80. package/out/concepts/Match__.js.map +1 -1
  81. package/out/concepts/MsgTriggerEvent__.d.ts +137 -0
  82. package/out/concepts/MsgTriggerEvent__.js +228 -0
  83. package/out/concepts/MsgTriggerEvent__.js.map +1 -0
  84. package/out/concepts/MsgTriggerLauncher__.d.ts +118 -0
  85. package/out/concepts/MsgTriggerLauncher__.js +204 -0
  86. package/out/concepts/MsgTriggerLauncher__.js.map +1 -0
  87. package/out/concepts/OverriddenLogic__.d.ts +643 -0
  88. package/out/concepts/OverriddenLogic__.js +1602 -0
  89. package/out/concepts/OverriddenLogic__.js.map +1 -0
  90. package/out/concepts/Param__.js +1 -1
  91. package/out/concepts/Param__.js.map +1 -1
  92. package/out/concepts/StringLiteral__.js +5 -1
  93. package/out/concepts/StringLiteral__.js.map +1 -1
  94. package/out/concepts/TriggerEvent__.d.ts +120 -0
  95. package/out/concepts/TriggerEvent__.js +222 -0
  96. package/out/concepts/TriggerEvent__.js.map +1 -0
  97. package/out/concepts/TriggerLauncher__.d.ts +88 -0
  98. package/out/concepts/TriggerLauncher__.js +235 -0
  99. package/out/concepts/TriggerLauncher__.js.map +1 -0
  100. package/out/concepts/basics/stdlib/nasl.http.d.ts +7 -0
  101. package/out/concepts/basics/stdlib/nasl.http.js +167 -0
  102. package/out/concepts/basics/stdlib/nasl.http.js.map +1 -0
  103. package/out/concepts/types__.d.ts +124 -0
  104. package/out/concepts/types__.js +3 -0
  105. package/out/concepts/types__.js.map +1 -0
  106. package/out/server/getConnector.d.ts +11 -0
  107. package/out/server/getConnector.js +42 -0
  108. package/out/server/getConnector.js.map +1 -0
  109. package/out/server/naslServer.js +55 -0
  110. package/out/server/naslServer.js.map +1 -1
  111. package/out/service/creator/errHandles.js +5 -0
  112. package/out/service/creator/errHandles.js.map +1 -1
  113. package/out/templator/genCreateBlock.js +2 -1
  114. package/out/templator/genCreateBlock.js.map +1 -1
  115. package/out/templator/genCurdEditMultipleKeyBlock.js +6 -3
  116. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  117. package/out/templator/genCurdMultipleKeyBlock.js +4 -2
  118. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  119. package/out/templator/genEditTableBlock.js +2 -1
  120. package/out/templator/genEditTableBlock.js.map +1 -1
  121. package/out/templator/genUpdateBlock.js +2 -1
  122. package/out/templator/genUpdateBlock.js.map +1 -1
  123. package/package.json +2 -2
  124. package/src/common/Command.ts +1 -1
  125. package/src/common/dist/Command.js +39 -0
  126. package/src/concepts/AnonymousFunction__.ts +13 -11
  127. package/src/concepts/Destination__.ts +7 -5
  128. package/src/concepts/Match__.ts +24 -6
  129. package/src/concepts/Param__.ts +1 -1
  130. package/src/concepts/StringLiteral__.ts +5 -1
  131. package/src/concepts/dist/App__.js +2204 -0
  132. package/src/concepts/dist/CallLogic__.js +1149 -0
  133. package/src/concepts/dist/Destination__.js +756 -0
  134. package/src/concepts/dist/Entity__.js +729 -0
  135. package/src/concepts/dist/Logic__.js +1612 -0
  136. package/src/concepts/dist/Match__.js +768 -0
  137. package/src/concepts/dist/MsgTriggerEvent__.js +245 -0
  138. package/src/concepts/dist/OqlQueryComponent__.js +377 -0
  139. package/src/concepts/dist/Param__.js +1 -1
  140. package/src/concepts/dist/StringLiteral__.js +158 -0
  141. package/src/generator/dist/genBundleFiles.js +15 -4
  142. package/src/generator/dist/genReleaseBody.js +501 -0
  143. package/src/server/dist/naslServer.js +76 -6
  144. package/src/server/naslServer.ts +54 -0
  145. package/src/service/creator/errHandles.js +8 -3
  146. package/src/service/storage/dist/init.js +34 -32
  147. package/src/templator/genCreateBlock.ts +2 -1
  148. package/src/templator/genCurdEditMultipleKeyBlock.ts +6 -3
  149. package/src/templator/genCurdMultipleKeyBlock.ts +4 -2
  150. package/src/templator/genEditTableBlock.ts +2 -1
  151. package/src/templator/genUpdateBlock.ts +2 -1
  152. package/test/examples/qzbusiness.json +1 -98265
@@ -0,0 +1,698 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
30
+ };
31
+ var __importDefault = (this && this.__importDefault) || function (mod) {
32
+ return (mod && mod.__esModule) ? mod : { "default": mod };
33
+ };
34
+ var Connector_1;
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Connector = void 0;
37
+ const decorators_1 = require("../decorators");
38
+ const utils = __importStar(require("../utils"));
39
+ const classMap_1 = __importDefault(require("../common/classMap"));
40
+ const Param__1 = __importDefault(require("./Param__"));
41
+ const Logic__1 = __importDefault(require("./Logic__"));
42
+ const ConnectorTrigger__1 = __importDefault(require("./ConnectorTrigger__"));
43
+ const Structure__1 = __importDefault(require("./Structure__"));
44
+ const Module__1 = __importDefault(require("./Module__"));
45
+ /**
46
+ * 连接器
47
+ */
48
+ let Connector = Connector_1 = class Connector extends Module__1.default {
49
+ /**
50
+ * 产品概念
51
+ */
52
+ concept = 'Connector';
53
+ /**
54
+ * 连接器名称
55
+ */
56
+ name = undefined;
57
+ /**
58
+ * connectorKind
59
+ */
60
+ connectorKind = undefined;
61
+ /**
62
+ * 输入参数列表
63
+ */
64
+ properties = [];
65
+ /**
66
+ * 逻辑列表
67
+ */
68
+ logics = [];
69
+ /**
70
+ * 连接器Trigger列表
71
+ */
72
+ triggers = [];
73
+ /**
74
+ * 数据结构列表
75
+ */
76
+ structures = [];
77
+ /**
78
+ * compilerInfoMap
79
+ */
80
+ // @ts-ignore
81
+ compilerInfoMap = undefined;
82
+ /**
83
+ * createLogic
84
+ */
85
+ createLogic = undefined;
86
+ /**
87
+ * testConnectorLogic
88
+ */
89
+ testConnectorLogic = undefined;
90
+ /**
91
+ * 祖先 Module
92
+ */
93
+ get module() {
94
+ return this.getAncestor('Module');
95
+ }
96
+ /**
97
+ * 祖先 App
98
+ */
99
+ get app() {
100
+ return this.getAncestor('App');
101
+ }
102
+ /**
103
+ * 祖先 View
104
+ */
105
+ get view() {
106
+ return this.getAncestor('View');
107
+ }
108
+ /**
109
+ * 祖先 Frontend
110
+ */
111
+ get frontend() {
112
+ return this.getAncestor('Frontend');
113
+ }
114
+ /**
115
+ * 祖先 ProcessElement
116
+ */
117
+ get processElement() {
118
+ return this.getAncestor('ProcessElement');
119
+ }
120
+ /**
121
+ * 祖先 Process
122
+ */
123
+ get process() {
124
+ return this.getAncestor('Process');
125
+ }
126
+ /**
127
+ * @param source 需要合并的部分参数
128
+ */
129
+ constructor(source) {
130
+ source = Object.assign({}, Connector_1.getDefaultOptions(), source);
131
+ super(source);
132
+ super.subConstructor(source);
133
+ }
134
+ getClassName() {
135
+ return 'Connector';
136
+ }
137
+ static from(source, parentNode, parentKey) {
138
+ return super.from(source, parentNode, parentKey);
139
+ }
140
+ /**
141
+ * 设置连接器名称
142
+ */
143
+ setName(name) {
144
+ const object = {
145
+ name,
146
+ };
147
+ this.update({
148
+ ...object,
149
+ field: 'name',
150
+ });
151
+ }
152
+ /**
153
+ * 设置connectorKind
154
+ */
155
+ setConnectorKind(connectorKind) {
156
+ const object = {
157
+ connectorKind,
158
+ };
159
+ this.update({
160
+ ...object,
161
+ });
162
+ }
163
+ /**
164
+ * 设置输入参数列表
165
+ */
166
+ setProperties(properties) {
167
+ const object = {
168
+ properties,
169
+ };
170
+ this.update({
171
+ ...object,
172
+ });
173
+ }
174
+ /**
175
+ * 设置逻辑列表
176
+ */
177
+ setLogics(logics) {
178
+ const object = {
179
+ logics,
180
+ };
181
+ this.update({
182
+ ...object,
183
+ });
184
+ }
185
+ /**
186
+ * 设置连接器Trigger列表
187
+ */
188
+ setTriggers(triggers) {
189
+ const object = {
190
+ triggers,
191
+ };
192
+ this.update({
193
+ ...object,
194
+ });
195
+ }
196
+ /**
197
+ * 设置数据结构列表
198
+ */
199
+ setStructures(structures) {
200
+ const object = {
201
+ structures,
202
+ };
203
+ this.update({
204
+ ...object,
205
+ });
206
+ }
207
+ /**
208
+ * 设置compilerInfoMap
209
+ */
210
+ setCompilerInfoMap(compilerInfoMap) {
211
+ const object = {
212
+ compilerInfoMap,
213
+ };
214
+ this.update({
215
+ ...object,
216
+ });
217
+ }
218
+ /**
219
+ * 设置createLogic
220
+ */
221
+ setCreateLogic(createLogic) {
222
+ const object = {
223
+ createLogic,
224
+ };
225
+ this.update({
226
+ ...object,
227
+ });
228
+ }
229
+ /**
230
+ * 设置testConnectorLogic
231
+ */
232
+ setTestConnectorLogic(testConnectorLogic) {
233
+ const object = {
234
+ testConnectorLogic,
235
+ };
236
+ this.update({
237
+ ...object,
238
+ });
239
+ }
240
+ getParamExistingNames(excludedList = []) {
241
+ const excludedSet = new Set(excludedList);
242
+ return (this.properties || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
243
+ }
244
+ getParamUniqueName(name = 'param1') {
245
+ return utils.unique(name, this.getParamExistingNames(), undefined, false);
246
+ }
247
+ _insertParamAt(options, index) {
248
+ const paramOptions = {};
249
+ const relationOptions = { parentNode: this, parentKey: 'properties' };
250
+ let param;
251
+ if (!options) {
252
+ param = Param__1.default.from({
253
+ ...paramOptions,
254
+ name: this.getParamUniqueName(),
255
+ }, this, 'properties');
256
+ }
257
+ else if (typeof options === 'string') {
258
+ param = Param__1.default.from({
259
+ ...paramOptions,
260
+ name: options,
261
+ }, this, 'properties');
262
+ }
263
+ else if (options instanceof Param__1.default) {
264
+ options.ensureDelete(); // 同一实例不支持多处存在
265
+ param = options;
266
+ Object.assign(param, relationOptions);
267
+ }
268
+ else {
269
+ param = Param__1.default.from({
270
+ ...paramOptions,
271
+ ...options,
272
+ }, this, 'properties');
273
+ }
274
+ this.properties.splice(index, 0, param);
275
+ return param;
276
+ }
277
+ insertParamAt(options, index) {
278
+ const node = this._insertParamAt(options, index);
279
+ node.create({
280
+ index,
281
+ parentNode: this,
282
+ parentKey: 'properties',
283
+ });
284
+ return node;
285
+ }
286
+ _addParam(options) {
287
+ const index = this.properties.length;
288
+ return this._insertParamAt(options, index);
289
+ }
290
+ addParam(options) {
291
+ const node = this._addParam(options);
292
+ const index = this.properties.indexOf(node);
293
+ node.create({
294
+ index,
295
+ parentNode: this,
296
+ parentKey: 'properties',
297
+ });
298
+ return node;
299
+ }
300
+ getLogicExistingNames(excludedList = []) {
301
+ const excludedSet = new Set(excludedList);
302
+ return (this.logics || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
303
+ }
304
+ getLogicUniqueName(name = 'logic1') {
305
+ return utils.unique(name, this.getLogicExistingNames(), undefined, false);
306
+ }
307
+ _insertLogicAt(options, index) {
308
+ const logicOptions = {};
309
+ const relationOptions = { parentNode: this, parentKey: 'logics' };
310
+ let logic;
311
+ if (!options) {
312
+ logic = Logic__1.default.from({
313
+ ...logicOptions,
314
+ name: this.getLogicUniqueName(),
315
+ }, this, 'logics');
316
+ }
317
+ else if (typeof options === 'string') {
318
+ logic = Logic__1.default.from({
319
+ ...logicOptions,
320
+ name: options,
321
+ }, this, 'logics');
322
+ }
323
+ else if (options instanceof Logic__1.default) {
324
+ options.ensureDelete(); // 同一实例不支持多处存在
325
+ logic = options;
326
+ Object.assign(logic, relationOptions);
327
+ }
328
+ else {
329
+ logic = Logic__1.default.from({
330
+ ...logicOptions,
331
+ ...options,
332
+ }, this, 'logics');
333
+ }
334
+ this.logics.splice(index, 0, logic);
335
+ return logic;
336
+ }
337
+ insertLogicAt(options, index) {
338
+ const node = this._insertLogicAt(options, index);
339
+ node.create({
340
+ index,
341
+ parentNode: this,
342
+ parentKey: 'logics',
343
+ });
344
+ return node;
345
+ }
346
+ _addLogic(options) {
347
+ const index = this.logics.length;
348
+ return this._insertLogicAt(options, index);
349
+ }
350
+ addLogic(options) {
351
+ const node = this._addLogic(options);
352
+ const index = this.logics.indexOf(node);
353
+ node.create({
354
+ index,
355
+ parentNode: this,
356
+ parentKey: 'logics',
357
+ });
358
+ return node;
359
+ }
360
+ getConnectorTriggerExistingNames(excludedList = []) {
361
+ const excludedSet = new Set(excludedList);
362
+ return (this.triggers || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
363
+ }
364
+ getConnectorTriggerUniqueName(name = 'connectorTrigger1') {
365
+ return utils.unique(name, this.getConnectorTriggerExistingNames(), undefined, false);
366
+ }
367
+ _insertConnectorTriggerAt(options, index) {
368
+ const connectorTriggerOptions = {};
369
+ const relationOptions = { parentNode: this, parentKey: 'triggers' };
370
+ let connectorTrigger;
371
+ if (!options) {
372
+ connectorTrigger = ConnectorTrigger__1.default.from({
373
+ ...connectorTriggerOptions,
374
+ name: this.getConnectorTriggerUniqueName(),
375
+ }, this, 'triggers');
376
+ }
377
+ else if (typeof options === 'string') {
378
+ connectorTrigger = ConnectorTrigger__1.default.from({
379
+ ...connectorTriggerOptions,
380
+ name: options,
381
+ }, this, 'triggers');
382
+ }
383
+ else if (options instanceof ConnectorTrigger__1.default) {
384
+ options.ensureDelete(); // 同一实例不支持多处存在
385
+ connectorTrigger = options;
386
+ Object.assign(connectorTrigger, relationOptions);
387
+ }
388
+ else {
389
+ connectorTrigger = ConnectorTrigger__1.default.from({
390
+ ...connectorTriggerOptions,
391
+ ...options,
392
+ }, this, 'triggers');
393
+ }
394
+ this.triggers.splice(index, 0, connectorTrigger);
395
+ return connectorTrigger;
396
+ }
397
+ insertConnectorTriggerAt(options, index) {
398
+ const node = this._insertConnectorTriggerAt(options, index);
399
+ node.create({
400
+ index,
401
+ parentNode: this,
402
+ parentKey: 'triggers',
403
+ });
404
+ return node;
405
+ }
406
+ _addConnectorTrigger(options) {
407
+ const index = this.triggers.length;
408
+ return this._insertConnectorTriggerAt(options, index);
409
+ }
410
+ addConnectorTrigger(options) {
411
+ const node = this._addConnectorTrigger(options);
412
+ const index = this.triggers.indexOf(node);
413
+ node.create({
414
+ index,
415
+ parentNode: this,
416
+ parentKey: 'triggers',
417
+ });
418
+ return node;
419
+ }
420
+ getStructureExistingNames(excludedList = []) {
421
+ const excludedSet = new Set(excludedList);
422
+ return (this.structures || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
423
+ }
424
+ getStructureUniqueName(name = 'structure1') {
425
+ return utils.unique(name, this.getStructureExistingNames(), undefined, false);
426
+ }
427
+ _insertStructureAt(options, index) {
428
+ const structureOptions = {};
429
+ const relationOptions = { parentNode: this, parentKey: 'structures' };
430
+ let structure;
431
+ if (!options) {
432
+ structure = Structure__1.default.from({
433
+ ...structureOptions,
434
+ name: this.getStructureUniqueName(),
435
+ }, this, 'structures');
436
+ }
437
+ else if (typeof options === 'string') {
438
+ structure = Structure__1.default.from({
439
+ ...structureOptions,
440
+ name: options,
441
+ }, this, 'structures');
442
+ }
443
+ else if (options instanceof Structure__1.default) {
444
+ options.ensureDelete(); // 同一实例不支持多处存在
445
+ structure = options;
446
+ Object.assign(structure, relationOptions);
447
+ }
448
+ else {
449
+ structure = Structure__1.default.from({
450
+ ...structureOptions,
451
+ ...options,
452
+ }, this, 'structures');
453
+ }
454
+ this.structures.splice(index, 0, structure);
455
+ return structure;
456
+ }
457
+ insertStructureAt(options, index) {
458
+ const node = this._insertStructureAt(options, index);
459
+ node.create({
460
+ index,
461
+ parentNode: this,
462
+ parentKey: 'structures',
463
+ });
464
+ return node;
465
+ }
466
+ _addStructure(options) {
467
+ const index = this.structures.length;
468
+ return this._insertStructureAt(options, index);
469
+ }
470
+ addStructure(options) {
471
+ const node = this._addStructure(options);
472
+ const index = this.structures.indexOf(node);
473
+ node.create({
474
+ index,
475
+ parentNode: this,
476
+ parentKey: 'structures',
477
+ });
478
+ return node;
479
+ }
480
+ removeParam(options) {
481
+ let param;
482
+ if (typeof options === 'string') {
483
+ param = this.properties.find((item) => item.name === options);
484
+ if (!param) {
485
+ throw new Error('找不到输入参数 ' + options);
486
+ }
487
+ }
488
+ else {
489
+ param = options;
490
+ }
491
+ return param.delete();
492
+ }
493
+ __removeParam(param) {
494
+ const parentKey = param.parentKey;
495
+ const params = {
496
+ parentNode: this,
497
+ parentKey,
498
+ index: -1,
499
+ object: null,
500
+ oldObject: param,
501
+ };
502
+ if (parentKey) {
503
+ params.parentKey = parentKey;
504
+ if (Array.isArray(this[parentKey])) {
505
+ const index = this[parentKey].indexOf(param);
506
+ ~index && this[parentKey].splice(index, 1);
507
+ params.index = index;
508
+ }
509
+ else if (this[parentKey] === param) {
510
+ params.index = 0;
511
+ this[parentKey] = undefined;
512
+ }
513
+ }
514
+ return params;
515
+ }
516
+ removeLogicInLogics(options) {
517
+ let logic;
518
+ if (typeof options === 'string') {
519
+ logic = this.logics.find((item) => item.name === options);
520
+ if (!logic) {
521
+ throw new Error('找不到逻辑 ' + options);
522
+ }
523
+ }
524
+ else {
525
+ logic = options;
526
+ }
527
+ return logic.delete();
528
+ }
529
+ removeCreateLogic(options) {
530
+ let createLogic;
531
+ if (typeof options === 'string') {
532
+ createLogic = this.createLogic;
533
+ if (!createLogic) {
534
+ throw new Error('找不到逻辑 ' + options);
535
+ }
536
+ }
537
+ else {
538
+ createLogic = options;
539
+ }
540
+ return createLogic.delete();
541
+ }
542
+ removeTestConnectorLogic(options) {
543
+ let testConnectorLogic;
544
+ if (typeof options === 'string') {
545
+ testConnectorLogic = this.testConnectorLogic;
546
+ if (!testConnectorLogic) {
547
+ throw new Error('找不到逻辑 ' + options);
548
+ }
549
+ }
550
+ else {
551
+ testConnectorLogic = options;
552
+ }
553
+ return testConnectorLogic.delete();
554
+ }
555
+ __removeLogic(logic) {
556
+ const parentKey = logic.parentKey;
557
+ const params = {
558
+ parentNode: this,
559
+ parentKey,
560
+ index: -1,
561
+ object: null,
562
+ oldObject: logic,
563
+ };
564
+ if (parentKey) {
565
+ params.parentKey = parentKey;
566
+ if (Array.isArray(this[parentKey])) {
567
+ const index = this[parentKey].indexOf(logic);
568
+ ~index && this[parentKey].splice(index, 1);
569
+ params.index = index;
570
+ }
571
+ else if (this[parentKey] === logic) {
572
+ params.index = 0;
573
+ this[parentKey] = undefined;
574
+ }
575
+ }
576
+ return params;
577
+ }
578
+ removeConnectorTrigger(options) {
579
+ let connectorTrigger;
580
+ if (typeof options === 'string') {
581
+ connectorTrigger = this.triggers.find((item) => item.name === options);
582
+ if (!connectorTrigger) {
583
+ throw new Error('找不到连接器Trigger ' + options);
584
+ }
585
+ }
586
+ else {
587
+ connectorTrigger = options;
588
+ }
589
+ return connectorTrigger.delete();
590
+ }
591
+ __removeConnectorTrigger(connectorTrigger) {
592
+ const parentKey = connectorTrigger.parentKey;
593
+ const params = {
594
+ parentNode: this,
595
+ parentKey,
596
+ index: -1,
597
+ object: null,
598
+ oldObject: connectorTrigger,
599
+ };
600
+ if (parentKey) {
601
+ params.parentKey = parentKey;
602
+ if (Array.isArray(this[parentKey])) {
603
+ const index = this[parentKey].indexOf(connectorTrigger);
604
+ ~index && this[parentKey].splice(index, 1);
605
+ params.index = index;
606
+ }
607
+ else if (this[parentKey] === connectorTrigger) {
608
+ params.index = 0;
609
+ this[parentKey] = undefined;
610
+ }
611
+ }
612
+ return params;
613
+ }
614
+ removeStructure(options) {
615
+ let structure;
616
+ if (typeof options === 'string') {
617
+ structure = this.structures.find((item) => item.name === options);
618
+ if (!structure) {
619
+ throw new Error('找不到数据结构 ' + options);
620
+ }
621
+ }
622
+ else {
623
+ structure = options;
624
+ }
625
+ return structure.delete();
626
+ }
627
+ __removeStructure(structure) {
628
+ const parentKey = structure.parentKey;
629
+ const params = {
630
+ parentNode: this,
631
+ parentKey,
632
+ index: -1,
633
+ object: null,
634
+ oldObject: structure,
635
+ };
636
+ if (parentKey) {
637
+ params.parentKey = parentKey;
638
+ if (Array.isArray(this[parentKey])) {
639
+ const index = this[parentKey].indexOf(structure);
640
+ ~index && this[parentKey].splice(index, 1);
641
+ params.index = index;
642
+ }
643
+ else if (this[parentKey] === structure) {
644
+ params.index = 0;
645
+ this[parentKey] = undefined;
646
+ }
647
+ }
648
+ return params;
649
+ }
650
+ //================================================================================
651
+ // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
652
+ // 自动生成的代码已结束。下面可以手动编写。
653
+ //================================================================================
654
+ getActions() {
655
+ return this.logics;
656
+ }
657
+ };
658
+ __decorate([
659
+ (0, decorators_1.property)()
660
+ ], Connector.prototype, "concept", void 0);
661
+ __decorate([
662
+ (0, decorators_1.property)()
663
+ ], Connector.prototype, "name", void 0);
664
+ __decorate([
665
+ (0, decorators_1.property)()
666
+ ], Connector.prototype, "connectorKind", void 0);
667
+ __decorate([
668
+ (0, decorators_1.property)('Param')
669
+ ], Connector.prototype, "properties", void 0);
670
+ __decorate([
671
+ (0, decorators_1.property)('Logic')
672
+ ], Connector.prototype, "logics", void 0);
673
+ __decorate([
674
+ (0, decorators_1.property)('ConnectorTrigger')
675
+ ], Connector.prototype, "triggers", void 0);
676
+ __decorate([
677
+ (0, decorators_1.property)('Structure')
678
+ ], Connector.prototype, "structures", void 0);
679
+ __decorate([
680
+ (0, decorators_1.property)()
681
+ ], Connector.prototype, "compilerInfoMap", void 0);
682
+ __decorate([
683
+ (0, decorators_1.property)('Logic')
684
+ ], Connector.prototype, "createLogic", void 0);
685
+ __decorate([
686
+ (0, decorators_1.property)('Logic')
687
+ ], Connector.prototype, "testConnectorLogic", void 0);
688
+ Connector = Connector_1 = __decorate([
689
+ (0, decorators_1.concept)('连接器')
690
+ ], Connector);
691
+ exports.Connector = Connector;
692
+ classMap_1.default.Connector = Connector;
693
+ exports.default = Connector;
694
+ //================================================================================
695
+ // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
696
+ // 自动生成的代码已结束。下面可以手动编写。
697
+ //================================================================================
698
+ //# sourceMappingURL=Connector__.js.map