@lcap/nasl 2.22.1 → 2.22.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.
- package/out/breakpoint/generator/AfterStartNode.d.ts +7 -0
- package/out/breakpoint/generator/AfterStartNode.js +27 -0
- package/out/breakpoint/generator/AfterStartNode.js.map +1 -0
- package/out/breakpoint/generator/BeforeEndNode.d.ts +7 -0
- package/out/breakpoint/generator/BeforeEndNode.js +27 -0
- package/out/breakpoint/generator/BeforeEndNode.js.map +1 -0
- package/out/breakpoint/generator/BreakpointNode.d.ts +14 -0
- package/out/breakpoint/generator/BreakpointNode.js +200 -0
- package/out/breakpoint/generator/BreakpointNode.js.map +1 -0
- package/out/breakpoint/generator/index.d.ts +4 -0
- package/out/breakpoint/generator/index.js +98 -0
- package/out/breakpoint/generator/index.js.map +1 -0
- package/out/breakpoint/index.d.ts +3 -0
- package/out/breakpoint/index.js +20 -0
- package/out/breakpoint/index.js.map +1 -0
- package/out/breakpoint/shared/constants.d.ts +31 -0
- package/out/breakpoint/shared/constants.js +89 -0
- package/out/breakpoint/shared/constants.js.map +1 -0
- package/out/breakpoint/shared/index.d.ts +3 -0
- package/out/breakpoint/shared/index.js +33 -0
- package/out/breakpoint/shared/index.js.map +1 -0
- package/out/breakpoint/shared/operations.d.ts +10 -0
- package/out/breakpoint/shared/operations.js +25 -0
- package/out/breakpoint/shared/operations.js.map +1 -0
- package/out/breakpoint/shared/socket.d.ts +47 -0
- package/out/breakpoint/shared/socket.js +210 -0
- package/out/breakpoint/shared/socket.js.map +1 -0
- package/out/breakpoint/shared/utils.d.ts +23 -0
- package/out/breakpoint/shared/utils.js +165 -0
- package/out/breakpoint/shared/utils.js.map +1 -0
- package/out/breakpoint/store/core.d.ts +32 -0
- package/out/breakpoint/store/core.js +388 -0
- package/out/breakpoint/store/core.js.map +1 -0
- package/out/breakpoint/store/dock.d.ts +1 -0
- package/out/breakpoint/store/dock.js +127 -0
- package/out/breakpoint/store/dock.js.map +1 -0
- package/out/breakpoint/store/index.d.ts +2 -0
- package/out/breakpoint/store/index.js +19 -0
- package/out/breakpoint/store/index.js.map +1 -0
- package/out/common/asyncFuncMap.d.ts +2 -0
- package/out/common/asyncFuncMap.js +16 -0
- package/out/common/asyncFuncMap.js.map +1 -0
- package/out/concepts/AnonymousFunction__.js +1 -1
- package/out/concepts/AnonymousFunction__.js.map +1 -1
- package/out/concepts/AuthInterface__.d.ts +37 -0
- package/out/concepts/AuthInterface__.js +141 -0
- package/out/concepts/AuthInterface__.js.map +1 -0
- package/out/concepts/AuthLogicForCallInterface__.d.ts +138 -0
- package/out/concepts/AuthLogicForCallInterface__.js +493 -0
- package/out/concepts/AuthLogicForCallInterface__.js.map +1 -0
- package/out/concepts/AuthLogic__.d.ts +66 -0
- package/out/concepts/AuthLogic__.js +206 -0
- package/out/concepts/AuthLogic__.js.map +1 -0
- package/out/concepts/BackendVariable__.d.ts +137 -0
- package/out/concepts/BackendVariable__.js +422 -0
- package/out/concepts/BackendVariable__.js.map +1 -0
- package/out/concepts/Backend__.d.ts +134 -0
- package/out/concepts/Backend__.js +274 -0
- package/out/concepts/Backend__.js.map +1 -0
- package/out/concepts/CallAuthInterface__.d.ts +126 -0
- package/out/concepts/CallAuthInterface__.js +408 -0
- package/out/concepts/CallAuthInterface__.js.map +1 -0
- package/out/concepts/Destination__.js +6 -4
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/FrontendVariable__.d.ts +21 -0
- package/out/concepts/FrontendVariable__.js +64 -0
- package/out/concepts/FrontendVariable__.js.map +1 -0
- package/out/concepts/Match__.js +25 -6
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/OverriddenLogic__.d.ts +643 -0
- package/out/concepts/OverriddenLogic__.js +1602 -0
- package/out/concepts/OverriddenLogic__.js.map +1 -0
- package/out/concepts/Param__.js +1 -1
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.http.d.ts +7 -0
- package/out/concepts/basics/stdlib/nasl.http.js +167 -0
- package/out/concepts/basics/stdlib/nasl.http.js.map +1 -0
- package/out/server/naslServer.js +4 -0
- package/out/server/naslServer.js.map +1 -1
- package/out/service/creator/errHandles.js +5 -0
- package/out/service/creator/errHandles.js.map +1 -1
- package/out/templator/genCreateBlock.js +2 -1
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +6 -3
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +4 -2
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.js +2 -1
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +2 -1
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/package.json +2 -2
- package/src/concepts/AnonymousFunction__.ts +1 -1
- package/src/concepts/Destination__.ts +7 -5
- package/src/concepts/Match__.ts +24 -6
- package/src/concepts/Param__.ts +1 -1
- package/src/concepts/dist/App__.js +2204 -0
- package/src/concepts/dist/CallLogic__.js +1149 -0
- package/src/concepts/dist/Destination__.js +756 -0
- package/src/concepts/dist/Logic__.js +1612 -0
- package/src/concepts/dist/Match__.js +768 -0
- package/src/concepts/dist/MsgTriggerEvent__.js +245 -0
- package/src/concepts/dist/OqlQueryComponent__.js +377 -0
- package/src/concepts/dist/Param__.js +1 -1
- package/src/generator/dist/genBundleFiles.js +15 -4
- package/src/generator/dist/genReleaseBody.js +501 -0
- package/src/server/dist/naslServer.js +25 -6
- package/src/server/naslServer.ts +4 -0
- package/src/service/creator/errHandles.js +8 -3
- package/src/service/storage/dist/init.js +34 -32
- package/src/templator/genCreateBlock.ts +2 -1
- package/src/templator/genCurdEditMultipleKeyBlock.ts +6 -3
- package/src/templator/genCurdMultipleKeyBlock.ts +4 -2
- package/src/templator/genEditTableBlock.ts +2 -1
- package/src/templator/genUpdateBlock.ts +2 -1
- package/test/examples/qzbusiness.json +1 -98265
|
@@ -0,0 +1,1612 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
extendStatics(d, b);
|
|
11
|
+
function __() { this.constructor = d; }
|
|
12
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
var __assign = (this && this.__assign) || function () {
|
|
16
|
+
__assign = Object.assign || function(t) {
|
|
17
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
18
|
+
s = arguments[i];
|
|
19
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
20
|
+
t[p] = s[p];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
return __assign.apply(this, arguments);
|
|
25
|
+
};
|
|
26
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
27
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
28
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
29
|
+
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;
|
|
30
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
31
|
+
};
|
|
32
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
33
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
34
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
35
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
36
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
37
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
38
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
42
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
43
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
44
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
45
|
+
function step(op) {
|
|
46
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
47
|
+
while (_) try {
|
|
48
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
49
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
50
|
+
switch (op[0]) {
|
|
51
|
+
case 0: case 1: t = op; break;
|
|
52
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
53
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
54
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
55
|
+
default:
|
|
56
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
57
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
58
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
59
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
60
|
+
if (t[2]) _.ops.pop();
|
|
61
|
+
_.trys.pop(); continue;
|
|
62
|
+
}
|
|
63
|
+
op = body.call(thisArg, _);
|
|
64
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
65
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
exports.__esModule = true;
|
|
69
|
+
exports.Logic = void 0;
|
|
70
|
+
var FrontendLibrary__1 = require("./FrontendLibrary__");
|
|
71
|
+
var translator_1 = require("../translator");
|
|
72
|
+
var Namespace__1 = require("./Namespace__");
|
|
73
|
+
var CallQueryComponent__1 = require("./CallQueryComponent__");
|
|
74
|
+
var Assignment__1 = require("./Assignment__");
|
|
75
|
+
var Identifier__1 = require("./Identifier__");
|
|
76
|
+
var BindEvent__1 = require("./BindEvent__");
|
|
77
|
+
var BatchAssignment__1 = require("./BatchAssignment__");
|
|
78
|
+
var OqlQueryComponent__1 = require("./OqlQueryComponent__");
|
|
79
|
+
var TypeAnnotation__1 = require("./TypeAnnotation__");
|
|
80
|
+
var CallInterface__1 = require("./CallInterface__");
|
|
81
|
+
var CallLogic__1 = require("./CallLogic__");
|
|
82
|
+
var decorators_1 = require("../decorators");
|
|
83
|
+
var utils = require("../utils");
|
|
84
|
+
var BaseNode_1 = require("../common/BaseNode");
|
|
85
|
+
var classMap_1 = require("../common/classMap");
|
|
86
|
+
var Transactional__1 = require("./Transactional__");
|
|
87
|
+
var TypeParam__1 = require("./TypeParam__");
|
|
88
|
+
var Param__1 = require("./Param__");
|
|
89
|
+
var Return__1 = require("./Return__");
|
|
90
|
+
var Variable__1 = require("./Variable__");
|
|
91
|
+
var LogicItem__1 = require("./LogicItem__");
|
|
92
|
+
var Process__1 = require("./Process__");
|
|
93
|
+
/**
|
|
94
|
+
* 逻辑
|
|
95
|
+
*/
|
|
96
|
+
var Logic = /** @class */ (function (_super) {
|
|
97
|
+
__extends(Logic, _super);
|
|
98
|
+
/**
|
|
99
|
+
* @param source 需要合并的部分参数
|
|
100
|
+
*/
|
|
101
|
+
function Logic(source) {
|
|
102
|
+
var _this = this;
|
|
103
|
+
source = Object.assign({}, Logic_1.getDefaultOptions(), source);
|
|
104
|
+
_this = _super.call(this, source) || this;
|
|
105
|
+
/**
|
|
106
|
+
* 产品概念
|
|
107
|
+
*/
|
|
108
|
+
_this.concept = 'Logic';
|
|
109
|
+
/**
|
|
110
|
+
* 逻辑名称
|
|
111
|
+
*/
|
|
112
|
+
_this.name = undefined;
|
|
113
|
+
/**
|
|
114
|
+
* 逻辑描述
|
|
115
|
+
*/
|
|
116
|
+
_this.description = undefined;
|
|
117
|
+
/**
|
|
118
|
+
* triggerType
|
|
119
|
+
*/
|
|
120
|
+
_this.triggerType = undefined;
|
|
121
|
+
/**
|
|
122
|
+
* cron
|
|
123
|
+
*/
|
|
124
|
+
_this.cron = undefined;
|
|
125
|
+
/**
|
|
126
|
+
* 事务
|
|
127
|
+
*/
|
|
128
|
+
_this.transactional = undefined;
|
|
129
|
+
/**
|
|
130
|
+
* 编译器信息
|
|
131
|
+
*/
|
|
132
|
+
_this.compilerInfoMap = undefined;
|
|
133
|
+
/**
|
|
134
|
+
* 类型参数列表
|
|
135
|
+
*/
|
|
136
|
+
_this.typeParams = null;
|
|
137
|
+
/**
|
|
138
|
+
* 输入参数列表
|
|
139
|
+
*/
|
|
140
|
+
_this.params = [];
|
|
141
|
+
/**
|
|
142
|
+
* 输出参数列表
|
|
143
|
+
*/
|
|
144
|
+
_this.returns = [];
|
|
145
|
+
/**
|
|
146
|
+
* 变量列表
|
|
147
|
+
*/
|
|
148
|
+
_this.variables = [];
|
|
149
|
+
/**
|
|
150
|
+
* 逻辑项列表
|
|
151
|
+
*/
|
|
152
|
+
_this.body = [];
|
|
153
|
+
/**
|
|
154
|
+
* 逻辑项列表
|
|
155
|
+
*/
|
|
156
|
+
_this.playground = [];
|
|
157
|
+
// 是不是内部有错误
|
|
158
|
+
_this.haveError = false;
|
|
159
|
+
// 是否body为空
|
|
160
|
+
_this.isSmpty = false;
|
|
161
|
+
// 虚拟输入参数列表
|
|
162
|
+
_this.virtualParams = [];
|
|
163
|
+
_super.prototype.subConstructor.call(_this, source);
|
|
164
|
+
return _this;
|
|
165
|
+
}
|
|
166
|
+
Logic_1 = Logic;
|
|
167
|
+
Object.defineProperty(Logic.prototype, "module", {
|
|
168
|
+
/**
|
|
169
|
+
* 祖先 Module
|
|
170
|
+
*/
|
|
171
|
+
get: function () {
|
|
172
|
+
return this.getAncestor('Module');
|
|
173
|
+
},
|
|
174
|
+
enumerable: false,
|
|
175
|
+
configurable: true
|
|
176
|
+
});
|
|
177
|
+
Object.defineProperty(Logic.prototype, "app", {
|
|
178
|
+
/**
|
|
179
|
+
* 祖先 App
|
|
180
|
+
*/
|
|
181
|
+
get: function () {
|
|
182
|
+
return this.getAncestor('App');
|
|
183
|
+
},
|
|
184
|
+
enumerable: false,
|
|
185
|
+
configurable: true
|
|
186
|
+
});
|
|
187
|
+
Object.defineProperty(Logic.prototype, "view", {
|
|
188
|
+
/**
|
|
189
|
+
* 祖先 View
|
|
190
|
+
*/
|
|
191
|
+
get: function () {
|
|
192
|
+
return this.getAncestor('View');
|
|
193
|
+
},
|
|
194
|
+
enumerable: false,
|
|
195
|
+
configurable: true
|
|
196
|
+
});
|
|
197
|
+
Object.defineProperty(Logic.prototype, "frontend", {
|
|
198
|
+
/**
|
|
199
|
+
* 祖先 Frontend
|
|
200
|
+
*/
|
|
201
|
+
get: function () {
|
|
202
|
+
return this.getAncestor('Frontend');
|
|
203
|
+
},
|
|
204
|
+
enumerable: false,
|
|
205
|
+
configurable: true
|
|
206
|
+
});
|
|
207
|
+
Object.defineProperty(Logic.prototype, "processElement", {
|
|
208
|
+
/**
|
|
209
|
+
* 祖先 ProcessElement
|
|
210
|
+
*/
|
|
211
|
+
get: function () {
|
|
212
|
+
return this.getAncestor('ProcessElement');
|
|
213
|
+
},
|
|
214
|
+
enumerable: false,
|
|
215
|
+
configurable: true
|
|
216
|
+
});
|
|
217
|
+
Object.defineProperty(Logic.prototype, "process", {
|
|
218
|
+
/**
|
|
219
|
+
* 祖先 Process
|
|
220
|
+
*/
|
|
221
|
+
get: function () {
|
|
222
|
+
return this.getAncestor('Process');
|
|
223
|
+
},
|
|
224
|
+
enumerable: false,
|
|
225
|
+
configurable: true
|
|
226
|
+
});
|
|
227
|
+
Logic.prototype.getClassName = function () {
|
|
228
|
+
return 'Logic';
|
|
229
|
+
};
|
|
230
|
+
Logic.from = function (source, parentNode, parentKey) {
|
|
231
|
+
return _super.from.call(this, source, parentNode, parentKey);
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* 从父级删除该节点
|
|
235
|
+
* @internal
|
|
236
|
+
*/
|
|
237
|
+
Logic.prototype._delete = function () {
|
|
238
|
+
var _a, _b;
|
|
239
|
+
var params = null;
|
|
240
|
+
if (this.parentNode) {
|
|
241
|
+
params = (_b = (_a = this.parentNode) === null || _a === void 0 ? void 0 : _a.__removeLogic) === null || _b === void 0 ? void 0 : _b.call(_a, this);
|
|
242
|
+
}
|
|
243
|
+
return params;
|
|
244
|
+
};
|
|
245
|
+
/**
|
|
246
|
+
* 设置逻辑名称
|
|
247
|
+
*/
|
|
248
|
+
Logic.prototype.setName = function (name) {
|
|
249
|
+
var object = {
|
|
250
|
+
name: name
|
|
251
|
+
};
|
|
252
|
+
this.update(__assign(__assign({}, object), { field: 'name' }));
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* 设置逻辑描述
|
|
256
|
+
*/
|
|
257
|
+
Logic.prototype.setDescription = function (description) {
|
|
258
|
+
var object = {
|
|
259
|
+
description: description
|
|
260
|
+
};
|
|
261
|
+
this.update(__assign({}, object));
|
|
262
|
+
};
|
|
263
|
+
/**
|
|
264
|
+
* 设置triggerType
|
|
265
|
+
*/
|
|
266
|
+
Logic.prototype.setTriggerType = function (triggerType) {
|
|
267
|
+
var object = {
|
|
268
|
+
triggerType: triggerType
|
|
269
|
+
};
|
|
270
|
+
this.update(__assign({}, object));
|
|
271
|
+
};
|
|
272
|
+
/**
|
|
273
|
+
* 设置cron
|
|
274
|
+
*/
|
|
275
|
+
Logic.prototype.setCron = function (cron) {
|
|
276
|
+
var object = {
|
|
277
|
+
cron: cron
|
|
278
|
+
};
|
|
279
|
+
this.update(__assign({}, object));
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* 设置事务
|
|
283
|
+
*/
|
|
284
|
+
Logic.prototype.setTransactional = function (transactional) {
|
|
285
|
+
transactional._delete();
|
|
286
|
+
var relationOptions = { parentNode: this, parentKey: 'transactional' };
|
|
287
|
+
Object.assign(transactional, relationOptions);
|
|
288
|
+
var object = {
|
|
289
|
+
transactional: transactional
|
|
290
|
+
};
|
|
291
|
+
this.update(__assign({}, object));
|
|
292
|
+
};
|
|
293
|
+
Logic.prototype.getTypeParamExistingNames = function (excludedList) {
|
|
294
|
+
if (excludedList === void 0) { excludedList = []; }
|
|
295
|
+
var excludedSet = new Set(excludedList);
|
|
296
|
+
return (this.typeParams || []).filter(function (item) { return !excludedSet.has(item); }).map(function (item) { return item.name; });
|
|
297
|
+
};
|
|
298
|
+
Logic.prototype.getTypeParamUniqueName = function (name) {
|
|
299
|
+
if (name === void 0) { name = 'typeParam1'; }
|
|
300
|
+
return utils.unique(name, this.getTypeParamExistingNames(), undefined, false);
|
|
301
|
+
};
|
|
302
|
+
Logic.prototype._insertTypeParamAt = function (options, index) {
|
|
303
|
+
var typeParamOptions = {};
|
|
304
|
+
var relationOptions = { parentNode: this, parentKey: 'typeParams' };
|
|
305
|
+
var typeParam;
|
|
306
|
+
if (!options) {
|
|
307
|
+
typeParam = TypeParam__1["default"].from(__assign(__assign({}, typeParamOptions), { name: this.getTypeParamUniqueName() }), this, 'typeParams');
|
|
308
|
+
}
|
|
309
|
+
else if (typeof options === 'string') {
|
|
310
|
+
typeParam = TypeParam__1["default"].from(__assign(__assign({}, typeParamOptions), { name: options }), this, 'typeParams');
|
|
311
|
+
}
|
|
312
|
+
else if (options instanceof TypeParam__1["default"]) {
|
|
313
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
314
|
+
typeParam = options;
|
|
315
|
+
Object.assign(typeParam, relationOptions);
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
typeParam = TypeParam__1["default"].from(__assign(__assign({}, typeParamOptions), options), this, 'typeParams');
|
|
319
|
+
}
|
|
320
|
+
this.typeParams.splice(index, 0, typeParam);
|
|
321
|
+
return typeParam;
|
|
322
|
+
};
|
|
323
|
+
Logic.prototype.insertTypeParamAt = function (options, index) {
|
|
324
|
+
var node = this._insertTypeParamAt(options, index);
|
|
325
|
+
node.create({
|
|
326
|
+
index: index,
|
|
327
|
+
parentNode: this,
|
|
328
|
+
parentKey: 'typeParams'
|
|
329
|
+
});
|
|
330
|
+
return node;
|
|
331
|
+
};
|
|
332
|
+
Logic.prototype._addTypeParam = function (options) {
|
|
333
|
+
var index = this.typeParams.length;
|
|
334
|
+
return this._insertTypeParamAt(options, index);
|
|
335
|
+
};
|
|
336
|
+
Logic.prototype.addTypeParam = function (options) {
|
|
337
|
+
var node = this._addTypeParam(options);
|
|
338
|
+
var index = this.typeParams.indexOf(node);
|
|
339
|
+
node.create({
|
|
340
|
+
index: index,
|
|
341
|
+
parentNode: this,
|
|
342
|
+
parentKey: 'typeParams'
|
|
343
|
+
});
|
|
344
|
+
return node;
|
|
345
|
+
};
|
|
346
|
+
Logic.prototype.getParamUniqueName = function (name) {
|
|
347
|
+
if (name === void 0) { name = 'param1'; }
|
|
348
|
+
return utils.unique(name, this.getVarExistingNames(), undefined, false);
|
|
349
|
+
};
|
|
350
|
+
Logic.prototype._insertParamAt = function (options, index) {
|
|
351
|
+
var paramOptions = {};
|
|
352
|
+
var relationOptions = { parentNode: this, parentKey: 'params' };
|
|
353
|
+
var param;
|
|
354
|
+
if (!options) {
|
|
355
|
+
param = Param__1["default"].from(__assign(__assign({}, paramOptions), { name: this.getParamUniqueName() }), this, 'params');
|
|
356
|
+
}
|
|
357
|
+
else if (typeof options === 'string') {
|
|
358
|
+
param = Param__1["default"].from(__assign(__assign({}, paramOptions), { name: options }), this, 'params');
|
|
359
|
+
}
|
|
360
|
+
else if (options instanceof Param__1["default"]) {
|
|
361
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
362
|
+
param = options;
|
|
363
|
+
Object.assign(param, relationOptions);
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
param = Param__1["default"].from(__assign(__assign({}, paramOptions), options), this, 'params');
|
|
367
|
+
}
|
|
368
|
+
this.params.splice(index, 0, param);
|
|
369
|
+
return param;
|
|
370
|
+
};
|
|
371
|
+
Logic.prototype.insertParamAt = function (options, index) {
|
|
372
|
+
var node = this._insertParamAt(options, index);
|
|
373
|
+
node.create({
|
|
374
|
+
index: index,
|
|
375
|
+
parentNode: this,
|
|
376
|
+
parentKey: 'params'
|
|
377
|
+
});
|
|
378
|
+
return node;
|
|
379
|
+
};
|
|
380
|
+
Logic.prototype._addParam = function (options) {
|
|
381
|
+
var index = this.params.length;
|
|
382
|
+
return this._insertParamAt(options, index);
|
|
383
|
+
};
|
|
384
|
+
Logic.prototype.addParam = function (options) {
|
|
385
|
+
var node = this._addParam(options);
|
|
386
|
+
var index = this.params.indexOf(node);
|
|
387
|
+
node.create({
|
|
388
|
+
index: index,
|
|
389
|
+
parentNode: this,
|
|
390
|
+
parentKey: 'params'
|
|
391
|
+
});
|
|
392
|
+
return node;
|
|
393
|
+
};
|
|
394
|
+
Logic.prototype.getReturnUniqueName = function (name) {
|
|
395
|
+
if (name === void 0) { name = 'result'; }
|
|
396
|
+
return utils.unique(name, this.getVarExistingNames(), undefined, false);
|
|
397
|
+
};
|
|
398
|
+
Logic.prototype._insertReturnAt = function (options, index) {
|
|
399
|
+
var retOptions = {};
|
|
400
|
+
var relationOptions = { parentNode: this, parentKey: 'returns' };
|
|
401
|
+
var ret;
|
|
402
|
+
if (!options) {
|
|
403
|
+
ret = Return__1["default"].from(__assign(__assign({}, retOptions), { name: this.getReturnUniqueName() }), this, 'returns');
|
|
404
|
+
}
|
|
405
|
+
else if (typeof options === 'string') {
|
|
406
|
+
ret = Return__1["default"].from(__assign(__assign({}, retOptions), { name: options }), this, 'returns');
|
|
407
|
+
}
|
|
408
|
+
else if (options instanceof Return__1["default"]) {
|
|
409
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
410
|
+
ret = options;
|
|
411
|
+
Object.assign(ret, relationOptions);
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
ret = Return__1["default"].from(__assign(__assign({}, retOptions), options), this, 'returns');
|
|
415
|
+
}
|
|
416
|
+
this.returns.splice(index, 0, ret);
|
|
417
|
+
return ret;
|
|
418
|
+
};
|
|
419
|
+
Logic.prototype.insertReturnAt = function (options, index) {
|
|
420
|
+
var node = this._insertReturnAt(options, index);
|
|
421
|
+
node.create({
|
|
422
|
+
index: index,
|
|
423
|
+
parentNode: this,
|
|
424
|
+
parentKey: 'returns'
|
|
425
|
+
});
|
|
426
|
+
return node;
|
|
427
|
+
};
|
|
428
|
+
Logic.prototype._addReturn = function (options) {
|
|
429
|
+
var index = this.returns.length;
|
|
430
|
+
return this._insertReturnAt(options, index);
|
|
431
|
+
};
|
|
432
|
+
Logic.prototype.addReturn = function (options) {
|
|
433
|
+
var node = this._addReturn(options);
|
|
434
|
+
var index = this.returns.indexOf(node);
|
|
435
|
+
node.create({
|
|
436
|
+
index: index,
|
|
437
|
+
parentNode: this,
|
|
438
|
+
parentKey: 'returns'
|
|
439
|
+
});
|
|
440
|
+
return node;
|
|
441
|
+
};
|
|
442
|
+
Logic.prototype.getVariableUniqueName = function (name) {
|
|
443
|
+
if (name === void 0) { name = 'variable1'; }
|
|
444
|
+
return utils.unique(name, this.getVarExistingNames(), undefined, false);
|
|
445
|
+
};
|
|
446
|
+
Logic.prototype._insertVariableAt = function (options, index) {
|
|
447
|
+
var variableOptions = {};
|
|
448
|
+
var relationOptions = { parentNode: this, parentKey: 'variables' };
|
|
449
|
+
var variable;
|
|
450
|
+
if (!options) {
|
|
451
|
+
variable = Variable__1["default"].from(__assign(__assign({}, variableOptions), { name: this.getVariableUniqueName() }), this, 'variables');
|
|
452
|
+
}
|
|
453
|
+
else if (typeof options === 'string') {
|
|
454
|
+
variable = Variable__1["default"].from(__assign(__assign({}, variableOptions), { name: options }), this, 'variables');
|
|
455
|
+
}
|
|
456
|
+
else if (options instanceof Variable__1["default"]) {
|
|
457
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
458
|
+
variable = options;
|
|
459
|
+
Object.assign(variable, relationOptions);
|
|
460
|
+
}
|
|
461
|
+
else {
|
|
462
|
+
variable = Variable__1["default"].from(__assign(__assign({}, variableOptions), options), this, 'variables');
|
|
463
|
+
}
|
|
464
|
+
this.variables.splice(index, 0, variable);
|
|
465
|
+
return variable;
|
|
466
|
+
};
|
|
467
|
+
Logic.prototype.insertVariableAt = function (options, index) {
|
|
468
|
+
var node = this._insertVariableAt(options, index);
|
|
469
|
+
node.create({
|
|
470
|
+
index: index,
|
|
471
|
+
parentNode: this,
|
|
472
|
+
parentKey: 'variables'
|
|
473
|
+
});
|
|
474
|
+
return node;
|
|
475
|
+
};
|
|
476
|
+
Logic.prototype._addVariable = function (options) {
|
|
477
|
+
var index = this.variables.length;
|
|
478
|
+
return this._insertVariableAt(options, index);
|
|
479
|
+
};
|
|
480
|
+
Logic.prototype.addVariable = function (options) {
|
|
481
|
+
var node = this._addVariable(options);
|
|
482
|
+
var index = this.variables.indexOf(node);
|
|
483
|
+
node.create({
|
|
484
|
+
index: index,
|
|
485
|
+
parentNode: this,
|
|
486
|
+
parentKey: 'variables'
|
|
487
|
+
});
|
|
488
|
+
return node;
|
|
489
|
+
};
|
|
490
|
+
Logic.prototype._insertItemInBodyAt = function (options, index) {
|
|
491
|
+
var logicItemOptions = {};
|
|
492
|
+
var relationOptions = { parentNode: this, parentKey: 'body' };
|
|
493
|
+
var logicItem;
|
|
494
|
+
if (options instanceof LogicItem__1["default"]) {
|
|
495
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
496
|
+
logicItem = options;
|
|
497
|
+
Object.assign(logicItem, relationOptions);
|
|
498
|
+
}
|
|
499
|
+
else {
|
|
500
|
+
logicItem = LogicItem__1["default"].from(__assign(__assign({}, logicItemOptions), options), this, 'body');
|
|
501
|
+
}
|
|
502
|
+
this.body.splice(index, 0, logicItem);
|
|
503
|
+
return logicItem;
|
|
504
|
+
};
|
|
505
|
+
Logic.prototype.insertItemInBodyAt = function (options, index) {
|
|
506
|
+
var node = this._insertItemInBodyAt(options, index);
|
|
507
|
+
node.create({
|
|
508
|
+
index: index,
|
|
509
|
+
parentNode: this,
|
|
510
|
+
parentKey: 'body'
|
|
511
|
+
});
|
|
512
|
+
return node;
|
|
513
|
+
};
|
|
514
|
+
Logic.prototype._addItemInBody = function (options) {
|
|
515
|
+
var index = this.body.length;
|
|
516
|
+
return this._insertItemInBodyAt(options, index);
|
|
517
|
+
};
|
|
518
|
+
Logic.prototype.addItemInBody = function (options) {
|
|
519
|
+
var node = this._addItemInBody(options);
|
|
520
|
+
var index = this.body.indexOf(node);
|
|
521
|
+
node.create({
|
|
522
|
+
index: index,
|
|
523
|
+
parentNode: this,
|
|
524
|
+
parentKey: 'body'
|
|
525
|
+
});
|
|
526
|
+
return node;
|
|
527
|
+
};
|
|
528
|
+
Logic.prototype._insertItemInPlaygroundAt = function (options, index) {
|
|
529
|
+
var logicItemOptions = {};
|
|
530
|
+
var relationOptions = { parentNode: this, parentKey: 'playground' };
|
|
531
|
+
var logicItem;
|
|
532
|
+
if (options instanceof LogicItem__1["default"]) {
|
|
533
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
534
|
+
logicItem = options;
|
|
535
|
+
Object.assign(logicItem, relationOptions);
|
|
536
|
+
}
|
|
537
|
+
else {
|
|
538
|
+
logicItem = LogicItem__1["default"].from(__assign(__assign({}, logicItemOptions), options), this, 'playground');
|
|
539
|
+
}
|
|
540
|
+
this.playground.splice(index, 0, logicItem);
|
|
541
|
+
return logicItem;
|
|
542
|
+
};
|
|
543
|
+
Logic.prototype.insertItemInPlaygroundAt = function (options, index) {
|
|
544
|
+
var node = this._insertItemInPlaygroundAt(options, index);
|
|
545
|
+
node.create({
|
|
546
|
+
index: index,
|
|
547
|
+
parentNode: this,
|
|
548
|
+
parentKey: 'playground'
|
|
549
|
+
});
|
|
550
|
+
return node;
|
|
551
|
+
};
|
|
552
|
+
Logic.prototype._addItemInPlayground = function (options) {
|
|
553
|
+
var index = this.playground.length;
|
|
554
|
+
return this._insertItemInPlaygroundAt(options, index);
|
|
555
|
+
};
|
|
556
|
+
Logic.prototype.addItemInPlayground = function (options) {
|
|
557
|
+
var node = this._addItemInPlayground(options);
|
|
558
|
+
var index = this.playground.indexOf(node);
|
|
559
|
+
node.create({
|
|
560
|
+
index: index,
|
|
561
|
+
parentNode: this,
|
|
562
|
+
parentKey: 'playground'
|
|
563
|
+
});
|
|
564
|
+
return node;
|
|
565
|
+
};
|
|
566
|
+
Logic.prototype.removeTransactional = function (options) {
|
|
567
|
+
var transactional;
|
|
568
|
+
if (typeof options === 'string') {
|
|
569
|
+
transactional = this.transactional;
|
|
570
|
+
if (!transactional) {
|
|
571
|
+
throw new Error('找不到事务 ' + options);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
else {
|
|
575
|
+
transactional = options;
|
|
576
|
+
}
|
|
577
|
+
return transactional["delete"]();
|
|
578
|
+
};
|
|
579
|
+
Logic.prototype.__removeTransactional = function (transactional) {
|
|
580
|
+
var parentKey = transactional.parentKey;
|
|
581
|
+
var params = {
|
|
582
|
+
parentNode: this,
|
|
583
|
+
parentKey: parentKey,
|
|
584
|
+
index: -1,
|
|
585
|
+
object: null,
|
|
586
|
+
oldObject: transactional
|
|
587
|
+
};
|
|
588
|
+
if (parentKey) {
|
|
589
|
+
params.parentKey = parentKey;
|
|
590
|
+
if (Array.isArray(this[parentKey])) {
|
|
591
|
+
var index = this[parentKey].indexOf(transactional);
|
|
592
|
+
~index && this[parentKey].splice(index, 1);
|
|
593
|
+
params.index = index;
|
|
594
|
+
}
|
|
595
|
+
else if (this[parentKey] === transactional) {
|
|
596
|
+
params.index = 0;
|
|
597
|
+
this[parentKey] = undefined;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
return params;
|
|
601
|
+
};
|
|
602
|
+
Logic.prototype.removeTypeParam = function (options) {
|
|
603
|
+
var typeParam;
|
|
604
|
+
if (typeof options === 'string') {
|
|
605
|
+
typeParam = this.typeParams.find(function (item) { return item.name === options; });
|
|
606
|
+
if (!typeParam) {
|
|
607
|
+
throw new Error('找不到类型参数 ' + options);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
else {
|
|
611
|
+
typeParam = options;
|
|
612
|
+
}
|
|
613
|
+
return typeParam["delete"]();
|
|
614
|
+
};
|
|
615
|
+
Logic.prototype.__removeTypeParam = function (typeParam) {
|
|
616
|
+
var parentKey = typeParam.parentKey;
|
|
617
|
+
var params = {
|
|
618
|
+
parentNode: this,
|
|
619
|
+
parentKey: parentKey,
|
|
620
|
+
index: -1,
|
|
621
|
+
object: null,
|
|
622
|
+
oldObject: typeParam
|
|
623
|
+
};
|
|
624
|
+
if (parentKey) {
|
|
625
|
+
params.parentKey = parentKey;
|
|
626
|
+
if (Array.isArray(this[parentKey])) {
|
|
627
|
+
var index = this[parentKey].indexOf(typeParam);
|
|
628
|
+
~index && this[parentKey].splice(index, 1);
|
|
629
|
+
params.index = index;
|
|
630
|
+
}
|
|
631
|
+
else if (this[parentKey] === typeParam) {
|
|
632
|
+
params.index = 0;
|
|
633
|
+
this[parentKey] = undefined;
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
return params;
|
|
637
|
+
};
|
|
638
|
+
Logic.prototype.removeParam = function (options) {
|
|
639
|
+
var param;
|
|
640
|
+
if (typeof options === 'string') {
|
|
641
|
+
param = this.params.find(function (item) { return item.name === options; });
|
|
642
|
+
if (!param) {
|
|
643
|
+
throw new Error('找不到输入参数 ' + options);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
else {
|
|
647
|
+
param = options;
|
|
648
|
+
}
|
|
649
|
+
return param["delete"]();
|
|
650
|
+
};
|
|
651
|
+
Logic.prototype.__removeParam = function (param) {
|
|
652
|
+
var parentKey = param.parentKey;
|
|
653
|
+
var params = {
|
|
654
|
+
parentNode: this,
|
|
655
|
+
parentKey: parentKey,
|
|
656
|
+
index: -1,
|
|
657
|
+
object: null,
|
|
658
|
+
oldObject: param
|
|
659
|
+
};
|
|
660
|
+
if (parentKey) {
|
|
661
|
+
params.parentKey = parentKey;
|
|
662
|
+
if (Array.isArray(this[parentKey])) {
|
|
663
|
+
var index = this[parentKey].indexOf(param);
|
|
664
|
+
~index && this[parentKey].splice(index, 1);
|
|
665
|
+
params.index = index;
|
|
666
|
+
}
|
|
667
|
+
else if (this[parentKey] === param) {
|
|
668
|
+
params.index = 0;
|
|
669
|
+
this[parentKey] = undefined;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
return params;
|
|
673
|
+
};
|
|
674
|
+
Logic.prototype.removeReturn = function (options) {
|
|
675
|
+
var ret;
|
|
676
|
+
if (typeof options === 'string') {
|
|
677
|
+
ret = this.returns.find(function (item) { return item.name === options; });
|
|
678
|
+
if (!ret) {
|
|
679
|
+
throw new Error('找不到输出参数 ' + options);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
else {
|
|
683
|
+
ret = options;
|
|
684
|
+
}
|
|
685
|
+
return ret["delete"]();
|
|
686
|
+
};
|
|
687
|
+
Logic.prototype.__removeReturn = function (ret) {
|
|
688
|
+
var parentKey = ret.parentKey;
|
|
689
|
+
var params = {
|
|
690
|
+
parentNode: this,
|
|
691
|
+
parentKey: parentKey,
|
|
692
|
+
index: -1,
|
|
693
|
+
object: null,
|
|
694
|
+
oldObject: ret
|
|
695
|
+
};
|
|
696
|
+
if (parentKey) {
|
|
697
|
+
params.parentKey = parentKey;
|
|
698
|
+
if (Array.isArray(this[parentKey])) {
|
|
699
|
+
var index = this[parentKey].indexOf(ret);
|
|
700
|
+
~index && this[parentKey].splice(index, 1);
|
|
701
|
+
params.index = index;
|
|
702
|
+
}
|
|
703
|
+
else if (this[parentKey] === ret) {
|
|
704
|
+
params.index = 0;
|
|
705
|
+
this[parentKey] = undefined;
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
return params;
|
|
709
|
+
};
|
|
710
|
+
Logic.prototype.removeVariable = function (options) {
|
|
711
|
+
var variable;
|
|
712
|
+
if (typeof options === 'string') {
|
|
713
|
+
variable = this.variables.find(function (item) { return item.name === options; });
|
|
714
|
+
if (!variable) {
|
|
715
|
+
throw new Error('找不到变量 ' + options);
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
else {
|
|
719
|
+
variable = options;
|
|
720
|
+
}
|
|
721
|
+
return variable["delete"]();
|
|
722
|
+
};
|
|
723
|
+
Logic.prototype.__removeVariable = function (variable) {
|
|
724
|
+
var parentKey = variable.parentKey;
|
|
725
|
+
var params = {
|
|
726
|
+
parentNode: this,
|
|
727
|
+
parentKey: parentKey,
|
|
728
|
+
index: -1,
|
|
729
|
+
object: null,
|
|
730
|
+
oldObject: variable
|
|
731
|
+
};
|
|
732
|
+
if (parentKey) {
|
|
733
|
+
params.parentKey = parentKey;
|
|
734
|
+
if (Array.isArray(this[parentKey])) {
|
|
735
|
+
var index = this[parentKey].indexOf(variable);
|
|
736
|
+
~index && this[parentKey].splice(index, 1);
|
|
737
|
+
params.index = index;
|
|
738
|
+
}
|
|
739
|
+
else if (this[parentKey] === variable) {
|
|
740
|
+
params.index = 0;
|
|
741
|
+
this[parentKey] = undefined;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
return params;
|
|
745
|
+
};
|
|
746
|
+
Logic.prototype.removeItemInBody = function (options) {
|
|
747
|
+
var logicItem = options;
|
|
748
|
+
return logicItem["delete"]();
|
|
749
|
+
};
|
|
750
|
+
Logic.prototype.removeItemInPlayground = function (options) {
|
|
751
|
+
var logicItem = options;
|
|
752
|
+
return logicItem["delete"]();
|
|
753
|
+
};
|
|
754
|
+
Logic.prototype.__removeLogicItem = function (logicItem) {
|
|
755
|
+
var parentKey = logicItem.parentKey;
|
|
756
|
+
var params = {
|
|
757
|
+
parentNode: this,
|
|
758
|
+
parentKey: parentKey,
|
|
759
|
+
index: -1,
|
|
760
|
+
object: null,
|
|
761
|
+
oldObject: logicItem
|
|
762
|
+
};
|
|
763
|
+
if (parentKey) {
|
|
764
|
+
params.parentKey = parentKey;
|
|
765
|
+
if (Array.isArray(this[parentKey])) {
|
|
766
|
+
var index = this[parentKey].indexOf(logicItem);
|
|
767
|
+
~index && this[parentKey].splice(index, 1);
|
|
768
|
+
params.index = index;
|
|
769
|
+
}
|
|
770
|
+
else if (this[parentKey] === logicItem) {
|
|
771
|
+
params.index = 0;
|
|
772
|
+
this[parentKey] = undefined;
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
return params;
|
|
776
|
+
};
|
|
777
|
+
Object.defineProperty(Logic.prototype, "calleewholeKey", {
|
|
778
|
+
//================================================================================
|
|
779
|
+
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
780
|
+
// 自动生成的代码已结束。下面可以手动编写。
|
|
781
|
+
//================================================================================
|
|
782
|
+
// 用于calllogic树中定位是那个logic,回显
|
|
783
|
+
get: function () {
|
|
784
|
+
return this.getNamespace() + '.' + this.name;
|
|
785
|
+
},
|
|
786
|
+
enumerable: false,
|
|
787
|
+
configurable: true
|
|
788
|
+
});
|
|
789
|
+
// 设置定时任务
|
|
790
|
+
Logic.prototype.setCronAndTriggerType = function (cron, triggerType) {
|
|
791
|
+
var object = {
|
|
792
|
+
cron: cron,
|
|
793
|
+
triggerType: triggerType
|
|
794
|
+
};
|
|
795
|
+
this.update(__assign({}, object));
|
|
796
|
+
};
|
|
797
|
+
/**
|
|
798
|
+
* 创建的时候 打开事务 通过开关设置数据库事务
|
|
799
|
+
*/
|
|
800
|
+
Logic.prototype.openTransactional = function (flag) {
|
|
801
|
+
if (flag) {
|
|
802
|
+
var transactional = new Transactional__1["default"]({
|
|
803
|
+
enabled: flag
|
|
804
|
+
});
|
|
805
|
+
transactional._delete();
|
|
806
|
+
var relationOptions = { parentNode: this, parentKey: 'transactional' };
|
|
807
|
+
Object.assign(transactional, relationOptions);
|
|
808
|
+
this.transactional = transactional;
|
|
809
|
+
}
|
|
810
|
+
};
|
|
811
|
+
Logic.prototype.findLogicItemByConcept = function (concept) {
|
|
812
|
+
var result;
|
|
813
|
+
utils.traverse(function (current) {
|
|
814
|
+
if (current.node.concept === concept)
|
|
815
|
+
return (result = current.node);
|
|
816
|
+
}, { node: this }, {
|
|
817
|
+
mode: 'anyObject',
|
|
818
|
+
excludedKeySet: this.JSON_EXCLUDED_KEYS
|
|
819
|
+
});
|
|
820
|
+
return result;
|
|
821
|
+
};
|
|
822
|
+
Logic.prototype.onChange = function ($event) {
|
|
823
|
+
this.emit('change', $event);
|
|
824
|
+
};
|
|
825
|
+
Logic.prototype.getVarExistingNames = function (excludedList) {
|
|
826
|
+
if (excludedList === void 0) { excludedList = []; }
|
|
827
|
+
var excludedSet = new Set(excludedList);
|
|
828
|
+
var varList = [];
|
|
829
|
+
if (Array.isArray(this.params)) {
|
|
830
|
+
varList.push.apply(varList, this.params);
|
|
831
|
+
}
|
|
832
|
+
if (Array.isArray(this.returns)) {
|
|
833
|
+
varList.push.apply(varList, this.returns);
|
|
834
|
+
}
|
|
835
|
+
if (Array.isArray(this.variables)) {
|
|
836
|
+
varList.push.apply(varList, this.variables);
|
|
837
|
+
}
|
|
838
|
+
if (this.view) {
|
|
839
|
+
if (Array.isArray(this.view.params)) {
|
|
840
|
+
varList.push.apply(varList, this.view.params);
|
|
841
|
+
}
|
|
842
|
+
if (Array.isArray(this.view.variables)) {
|
|
843
|
+
varList.push.apply(varList, this.view.variables);
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
this.traverseChildren(function (el) {
|
|
847
|
+
var _a, _b, _c, _d;
|
|
848
|
+
if ((el === null || el === void 0 ? void 0 : el.concept) === 'ForEachStatement') {
|
|
849
|
+
if ((_a = el) === null || _a === void 0 ? void 0 : _a.item) {
|
|
850
|
+
varList.push((_b = el) === null || _b === void 0 ? void 0 : _b.item);
|
|
851
|
+
}
|
|
852
|
+
if ((_c = el) === null || _c === void 0 ? void 0 : _c.index) {
|
|
853
|
+
varList.push((_d = el) === null || _d === void 0 ? void 0 : _d.index);
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
});
|
|
857
|
+
return varList.filter(function (item) { return !excludedSet.has(item); }).map(function (item) { return item === null || item === void 0 ? void 0 : item.name; });
|
|
858
|
+
};
|
|
859
|
+
Logic.prototype.toJSContent = function (code, state) {
|
|
860
|
+
// params
|
|
861
|
+
if (Array.isArray(this.params)) {
|
|
862
|
+
this.params.forEach(function (param) {
|
|
863
|
+
code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 1) + '';
|
|
864
|
+
code += param.toJS(translator_1.shiftState(state, code, { inline: true }));
|
|
865
|
+
code += ';\n';
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
// variables
|
|
869
|
+
if (Array.isArray(this.variables)) {
|
|
870
|
+
this.variables.forEach(function (variable) {
|
|
871
|
+
code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 1) + 'let ';
|
|
872
|
+
code += variable.toJS(translator_1.shiftState(state, code, { inline: true }));
|
|
873
|
+
code += ';\n';
|
|
874
|
+
});
|
|
875
|
+
}
|
|
876
|
+
// returns
|
|
877
|
+
if (Array.isArray(this.returns)) {
|
|
878
|
+
this.returns.forEach(function (ret) {
|
|
879
|
+
code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 1) + 'let ';
|
|
880
|
+
code += ret.toJS(translator_1.shiftState(state, code, { inline: true }));
|
|
881
|
+
code += ';\n';
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
if (Array.isArray(this.body)) {
|
|
885
|
+
this.body.forEach(function (item) {
|
|
886
|
+
code += item.toJS && item.toJS(translator_1.shiftState(state, code, { tabSize: ((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 1 }));
|
|
887
|
+
code += '\n';
|
|
888
|
+
});
|
|
889
|
+
}
|
|
890
|
+
return code;
|
|
891
|
+
};
|
|
892
|
+
Logic.prototype.toJS = function (state, type) {
|
|
893
|
+
var _this = this;
|
|
894
|
+
var _a;
|
|
895
|
+
var code = '';
|
|
896
|
+
if (type === 'IIFE') {
|
|
897
|
+
code += "await (async () => {\n";
|
|
898
|
+
code = this.toJSContent(code, state);
|
|
899
|
+
code += translator_1.indent((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + '})();\n';
|
|
900
|
+
return code;
|
|
901
|
+
}
|
|
902
|
+
code += "async " + this.name + " (";
|
|
903
|
+
if ((_a = this.params) === null || _a === void 0 ? void 0 : _a.length) {
|
|
904
|
+
this.params.forEach(function (param, index) {
|
|
905
|
+
code += param.name;
|
|
906
|
+
if (index !== _this.params.length - 1)
|
|
907
|
+
code += ', ';
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
code += ') {\n';
|
|
911
|
+
code = this.toJSContent(code, state);
|
|
912
|
+
code += translator_1.indent((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + '}\n';
|
|
913
|
+
return code;
|
|
914
|
+
};
|
|
915
|
+
Logic.prototype.toProcessService = function () {
|
|
916
|
+
return {
|
|
917
|
+
config: {
|
|
918
|
+
serviceType: 'micro'
|
|
919
|
+
},
|
|
920
|
+
url: {
|
|
921
|
+
method: 'POST',
|
|
922
|
+
path: this.getPath()
|
|
923
|
+
}
|
|
924
|
+
};
|
|
925
|
+
};
|
|
926
|
+
Logic.prototype.toService = function () {
|
|
927
|
+
var parentNode = this.parentNode;
|
|
928
|
+
var _a = parentNode || {}, concept = _a.concept, entityName = _a.name;
|
|
929
|
+
var logicName = this.name;
|
|
930
|
+
var serviceType = 'micro';
|
|
931
|
+
var method = 'POST';
|
|
932
|
+
var path = "/api/lcplogics/" + logicName;
|
|
933
|
+
if (concept === 'Module') {
|
|
934
|
+
path = "/api/" + entityName.replace('-', '_') + "/" + logicName;
|
|
935
|
+
}
|
|
936
|
+
else if (concept === 'Namespace') {
|
|
937
|
+
serviceType = 'entity';
|
|
938
|
+
var entityPath = entityName.replace(/[A-Z]/g, function (char, index) {
|
|
939
|
+
var lowerChar = char.toLowerCase();
|
|
940
|
+
return index === 0 ? lowerChar : "-" + lowerChar;
|
|
941
|
+
});
|
|
942
|
+
var dataSource = parentNode.getAncestor('DataSource');
|
|
943
|
+
// 默认数据源不动,其他数据源需要拼接数据源信息
|
|
944
|
+
if (dataSource && dataSource.name !== 'defaultDS') {
|
|
945
|
+
entityPath = dataSource.name + '/' + entityPath;
|
|
946
|
+
}
|
|
947
|
+
path = "/api/" + entityPath;
|
|
948
|
+
switch (this.name) {
|
|
949
|
+
case 'get':
|
|
950
|
+
method = 'GET';
|
|
951
|
+
path = "/api/" + entityPath;
|
|
952
|
+
break;
|
|
953
|
+
case 'create':
|
|
954
|
+
method = 'POST';
|
|
955
|
+
break;
|
|
956
|
+
case 'update':
|
|
957
|
+
method = 'PUT';
|
|
958
|
+
break;
|
|
959
|
+
case 'delete':
|
|
960
|
+
method = 'DELETE';
|
|
961
|
+
path = "/api/" + entityPath;
|
|
962
|
+
break;
|
|
963
|
+
case 'createOrUpdate':
|
|
964
|
+
method = 'POST';
|
|
965
|
+
path = "/api/" + entityPath + "/createOrUpdate";
|
|
966
|
+
break;
|
|
967
|
+
case 'updateBy':
|
|
968
|
+
method = 'PUT';
|
|
969
|
+
path = "/api/" + entityPath + "/by";
|
|
970
|
+
break;
|
|
971
|
+
case 'deleteBy':
|
|
972
|
+
method = 'DELETE';
|
|
973
|
+
path = "/api/" + entityPath + "/by";
|
|
974
|
+
break;
|
|
975
|
+
case 'batchCreate':
|
|
976
|
+
method = 'POST';
|
|
977
|
+
path = "/api/" + entityPath + "/batch";
|
|
978
|
+
break;
|
|
979
|
+
case 'batchUpdate':
|
|
980
|
+
method = 'PUT';
|
|
981
|
+
path = "/api/" + entityPath + "/batch";
|
|
982
|
+
break;
|
|
983
|
+
case 'batchDelete':
|
|
984
|
+
method = 'DELETE';
|
|
985
|
+
path = "/api/" + entityPath + "/batch";
|
|
986
|
+
break;
|
|
987
|
+
case 'import':
|
|
988
|
+
method = 'POST';
|
|
989
|
+
path = "/api/" + entityPath + "/import";
|
|
990
|
+
break;
|
|
991
|
+
default:
|
|
992
|
+
break;
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
return {
|
|
996
|
+
config: {
|
|
997
|
+
serviceType: serviceType
|
|
998
|
+
},
|
|
999
|
+
url: {
|
|
1000
|
+
method: method,
|
|
1001
|
+
path: path
|
|
1002
|
+
}
|
|
1003
|
+
};
|
|
1004
|
+
};
|
|
1005
|
+
Logic.prototype.toEmbeddedTSInProcess = function (state, prependCode, noName, prefix) {
|
|
1006
|
+
var _this = this;
|
|
1007
|
+
var code = '';
|
|
1008
|
+
if (!prefix)
|
|
1009
|
+
code += (noName ? '' : this.name + ":") + " function(";
|
|
1010
|
+
else
|
|
1011
|
+
code += "function " + this.name + "("; //加空格会导致无法查询到引用
|
|
1012
|
+
this.params.forEach(function (param, index) {
|
|
1013
|
+
code += param.toEmbeddedTS(translator_1.shiftState(state, code, { inline: true }));
|
|
1014
|
+
if (index !== _this.params.length - 1)
|
|
1015
|
+
code += ', ';
|
|
1016
|
+
});
|
|
1017
|
+
code += ") {\n";
|
|
1018
|
+
code += prependCode || '';
|
|
1019
|
+
code += '\n';
|
|
1020
|
+
this.variables.forEach(function (variable) {
|
|
1021
|
+
code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 1) + 'let ';
|
|
1022
|
+
code += variable.toEmbeddedTS(translator_1.shiftState(state, code, { inline: true }));
|
|
1023
|
+
code += ';\n';
|
|
1024
|
+
});
|
|
1025
|
+
this.returns.forEach(function (ret) {
|
|
1026
|
+
code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 1) + 'let ';
|
|
1027
|
+
code += ret.toEmbeddedTS(translator_1.shiftState(state, code, { inline: true }));
|
|
1028
|
+
code += ';\n';
|
|
1029
|
+
});
|
|
1030
|
+
if (!this.body.length && this.returns.length) {
|
|
1031
|
+
code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 1) + ("return " + this.returns[0].name + ";\n");
|
|
1032
|
+
}
|
|
1033
|
+
else {
|
|
1034
|
+
if (this.parentNode.type === 'ExclusiveGateway') {
|
|
1035
|
+
if (this.body.length <= 1) {
|
|
1036
|
+
code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 1);
|
|
1037
|
+
code += 'const __LogicEmpty: any = null;';
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
else if (this.body.length <= 2 && !(this.parentNode instanceof Namespace__1["default"]) && !(this.parentNode instanceof Process__1["default"])) {
|
|
1041
|
+
code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 1);
|
|
1042
|
+
code += translator_1.indent((state === null || state === void 0 ? void 0 : state.tabSize) || 0 + 4) + 'const __LogicEmpty: any = null;';
|
|
1043
|
+
}
|
|
1044
|
+
this.body.forEach(function (item) {
|
|
1045
|
+
code += item.toEmbeddedTS && item.toEmbeddedTS(translator_1.shiftState(state, code, { tabSize: ((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 1 }));
|
|
1046
|
+
code += ';\n';
|
|
1047
|
+
});
|
|
1048
|
+
}
|
|
1049
|
+
// 在body渲染完成之后把其余的节点放到下面
|
|
1050
|
+
this.playground.forEach(function (item) {
|
|
1051
|
+
code += item.toEmbeddedTS(translator_1.shiftState(state, code, { tabSize: ((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 1 }));
|
|
1052
|
+
code += '\n';
|
|
1053
|
+
});
|
|
1054
|
+
code += translator_1.indent((state === null || state === void 0 ? void 0 : state.tabSize) || 0 + 4) + '}';
|
|
1055
|
+
code += '\n';
|
|
1056
|
+
return code;
|
|
1057
|
+
};
|
|
1058
|
+
Logic.prototype.toEmbeddedTSNoExport = function (state) {
|
|
1059
|
+
return this.toEmbeddedTS(state, 'noExport');
|
|
1060
|
+
};
|
|
1061
|
+
Logic.prototype.toEmbeddedTS = function (state, prefix) {
|
|
1062
|
+
var _this = this;
|
|
1063
|
+
var _a, _b;
|
|
1064
|
+
// 如果传了不要前缀那就为空, 要不用传进来的,要是都没有就默认导出
|
|
1065
|
+
var code = '';
|
|
1066
|
+
if (!prefix) {
|
|
1067
|
+
code += "export function " + this.name;
|
|
1068
|
+
}
|
|
1069
|
+
else if (prefix === 'noExport') {
|
|
1070
|
+
code += "function " + this.name;
|
|
1071
|
+
}
|
|
1072
|
+
else if (prefix === 'inObject') {
|
|
1073
|
+
code += "" + this.name;
|
|
1074
|
+
}
|
|
1075
|
+
if ((_a = this.typeParams) === null || _a === void 0 ? void 0 : _a.length) {
|
|
1076
|
+
code += '<';
|
|
1077
|
+
this.typeParams.forEach(function (typeParam, typeParamIndex) {
|
|
1078
|
+
code += typeParam.toEmbeddedTS(translator_1.shiftState(state, code, { inline: true }));
|
|
1079
|
+
if (typeParamIndex !== _this.typeParams.length - 1)
|
|
1080
|
+
code += ', ';
|
|
1081
|
+
});
|
|
1082
|
+
code += '>';
|
|
1083
|
+
}
|
|
1084
|
+
// 有参数长度
|
|
1085
|
+
if (this.params.length) {
|
|
1086
|
+
code += '(';
|
|
1087
|
+
this.params.forEach(function (param, index) {
|
|
1088
|
+
code += param.toEmbeddedTS(translator_1.shiftState(state, code));
|
|
1089
|
+
if (index !== _this.params.length - 1)
|
|
1090
|
+
code += ', ';
|
|
1091
|
+
});
|
|
1092
|
+
code += ')';
|
|
1093
|
+
}
|
|
1094
|
+
else {
|
|
1095
|
+
// 没有参数的
|
|
1096
|
+
code += '()';
|
|
1097
|
+
}
|
|
1098
|
+
// 需要类型推导的局部变量/返回值需要调整申明顺序
|
|
1099
|
+
var advanceMap = new Map();
|
|
1100
|
+
var needGetSourceMapOqlList = [];
|
|
1101
|
+
this.traverseChildren(function (el) {
|
|
1102
|
+
var _a, _b, _c;
|
|
1103
|
+
if (el && (el instanceof BatchAssignment__1["default"] || (el instanceof Assignment__1["default"] && ((_a = el.left) === null || _a === void 0 ? void 0 : _a.name)))) {
|
|
1104
|
+
if (el instanceof Assignment__1["default"]) {
|
|
1105
|
+
var advanceVar = (_b = _this.variables) === null || _b === void 0 ? void 0 : _b.find(function (variable) { var _a; return !variable.typeAnnotation && (((_a = el.left) === null || _a === void 0 ? void 0 : _a.name) === variable.name); });
|
|
1106
|
+
if (advanceVar && !advanceMap.get(advanceVar)) {
|
|
1107
|
+
advanceMap.set(advanceVar, el);
|
|
1108
|
+
}
|
|
1109
|
+
var advanceRn = (_c = _this.returns) === null || _c === void 0 ? void 0 : _c.find(function (ret) { var _a; return !ret.typeAnnotation && ((_a = el.left) === null || _a === void 0 ? void 0 : _a.name) === ret.name; });
|
|
1110
|
+
if (advanceRn && !advanceMap.get(advanceRn)) {
|
|
1111
|
+
advanceMap.set(advanceRn, el);
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
else if (el instanceof BatchAssignment__1["default"]) {
|
|
1115
|
+
el.assignmentLines.forEach(function (_a) {
|
|
1116
|
+
var _b, _c, _d;
|
|
1117
|
+
var leftIndex = _a.leftIndex;
|
|
1118
|
+
var leftCode = leftIndex.length === 1 ? el.left.expression.toEmbeddedTS(translator_1.shiftState(state, code, { inline: true })) : (_b = el.left.members[leftIndex[1]]) === null || _b === void 0 ? void 0 : _b.toEmbeddedTS(translator_1.shiftState(state, code, { inline: true }));
|
|
1119
|
+
var advanceVar = (_c = _this.variables) === null || _c === void 0 ? void 0 : _c.find(function (variable) { return !variable.typeAnnotation && (leftCode === variable.name); });
|
|
1120
|
+
if (advanceVar && !advanceMap.get(advanceVar)) {
|
|
1121
|
+
advanceMap.set(advanceVar, el);
|
|
1122
|
+
}
|
|
1123
|
+
var advanceRn = (_d = _this.returns) === null || _d === void 0 ? void 0 : _d.find(function (ret) { return !ret.typeAnnotation && leftCode === ret.name; });
|
|
1124
|
+
if (advanceRn && !advanceMap.get(advanceRn)) {
|
|
1125
|
+
advanceMap.set(advanceRn, el);
|
|
1126
|
+
}
|
|
1127
|
+
});
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
// 如果有sql查询组件就需要把他们存起来
|
|
1131
|
+
if (el instanceof OqlQueryComponent__1["default"]) {
|
|
1132
|
+
if (!el.codeSourceMap) {
|
|
1133
|
+
needGetSourceMapOqlList.push(el.requestEmbeddedTS());
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
});
|
|
1137
|
+
if (needGetSourceMapOqlList.length) {
|
|
1138
|
+
//Promise.all(needGetSourceMapOqlList).then(() => {
|
|
1139
|
+
// // 触发一下更新重新生成代码
|
|
1140
|
+
// (this.app as any)?.naslServer?.embeddedTSEmitter.emit('change', {
|
|
1141
|
+
// value: [
|
|
1142
|
+
// {
|
|
1143
|
+
// originEvent: {
|
|
1144
|
+
// action: 'update',
|
|
1145
|
+
// target: this,
|
|
1146
|
+
// },
|
|
1147
|
+
// },
|
|
1148
|
+
// ],
|
|
1149
|
+
// });
|
|
1150
|
+
//});
|
|
1151
|
+
}
|
|
1152
|
+
// 兼容 return 没有类型情况
|
|
1153
|
+
if (this.returns.length && this.returns[0].typeAnnotation) {
|
|
1154
|
+
code += ': ';
|
|
1155
|
+
code += (_b = this.returns[0].typeAnnotation) === null || _b === void 0 ? void 0 : _b.toEmbeddedTS(translator_1.shiftState(state, code, { inline: true }));
|
|
1156
|
+
}
|
|
1157
|
+
code += '{\n';
|
|
1158
|
+
// 用于虚拟节点的查找引用
|
|
1159
|
+
this.virtualParams
|
|
1160
|
+
&& Array.isArray(this.virtualParams)
|
|
1161
|
+
&& this.virtualParams.forEach(function (param) {
|
|
1162
|
+
code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 1);
|
|
1163
|
+
code += param.toEmbeddedNameTS(translator_1.shiftState(state, code, { inline: true }));
|
|
1164
|
+
code += '\n';
|
|
1165
|
+
});
|
|
1166
|
+
this.variables.forEach(function (variable) {
|
|
1167
|
+
if (!advanceMap.get(variable)) {
|
|
1168
|
+
code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 1) + 'let ';
|
|
1169
|
+
code += variable.toEmbeddedTS(translator_1.shiftState(state, code, { inline: true }));
|
|
1170
|
+
code += ';\n';
|
|
1171
|
+
}
|
|
1172
|
+
});
|
|
1173
|
+
this.returns.forEach(function (ret) {
|
|
1174
|
+
if (!advanceMap.get(ret)) {
|
|
1175
|
+
code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 1) + 'let ';
|
|
1176
|
+
code += ret.toEmbeddedTS(translator_1.shiftState(state, code, { inline: true }));
|
|
1177
|
+
code += ';\n';
|
|
1178
|
+
}
|
|
1179
|
+
});
|
|
1180
|
+
advanceMap.forEach(function (assignment, node) {
|
|
1181
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1182
|
+
code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 1) + '// @ts-ignore\n';
|
|
1183
|
+
code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 1) + 'let ';
|
|
1184
|
+
code += node.toEmbeddedTS(translator_1.shiftState(state, code, { inline: true }));
|
|
1185
|
+
if (assignment instanceof BatchAssignment__1["default"]) {
|
|
1186
|
+
assignment.assignmentLines.forEach(function (_a) {
|
|
1187
|
+
var _b, _c, _d, _e;
|
|
1188
|
+
var leftIndex = _a.leftIndex, rightIndex = _a.rightIndex;
|
|
1189
|
+
var leftCode = leftIndex.length === 1 ? assignment.left.expression.toEmbeddedTS(translator_1.shiftState(state, code, { inline: true })) : (_b = assignment.left.members[leftIndex[1]]) === null || _b === void 0 ? void 0 : _b.toEmbeddedTS(translator_1.shiftState(state, code, { inline: true }));
|
|
1190
|
+
if (leftCode === node.name) {
|
|
1191
|
+
var rightNode = rightIndex.length === 1 ? (_c = assignment.rights[rightIndex[0]]) === null || _c === void 0 ? void 0 : _c.expression : (_d = assignment.rights[rightIndex[0]]) === null || _d === void 0 ? void 0 : _d.members[rightIndex[1]];
|
|
1192
|
+
// 当右边有明确类型时,直接使用其类型。旧版本数据查询不能直接使用其 typeAnnotation
|
|
1193
|
+
if ((rightNode === null || rightNode === void 0 ? void 0 : rightNode.typeAnnotation) && !(rightNode instanceof CallQueryComponent__1["default"] && !rightNode.isAutoInfer())) {
|
|
1194
|
+
code += ': ';
|
|
1195
|
+
code += ((_e = rightNode.typeAnnotation) === null || _e === void 0 ? void 0 : _e.toEmbeddedTS(translator_1.shiftState(state, code, { inline: true }))) || 'null';
|
|
1196
|
+
}
|
|
1197
|
+
else {
|
|
1198
|
+
code += ' = ';
|
|
1199
|
+
var rightCode = rightNode === null || rightNode === void 0 ? void 0 : rightNode.toEmbeddedTS(translator_1.shiftState(state, code, { inline: true }));
|
|
1200
|
+
code += _this.getRightCode(rightCode, assignment, rightNode);
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
});
|
|
1204
|
+
}
|
|
1205
|
+
else if (['NewList', 'NewMap'].includes((_a = assignment.right) === null || _a === void 0 ? void 0 : _a.concept) && !((_b = assignment.right) === null || _b === void 0 ? void 0 : _b.typeAnnotation)) {
|
|
1206
|
+
var rightNode = assignment.right;
|
|
1207
|
+
code += ' = ';
|
|
1208
|
+
code += rightNode.getInitCode(translator_1.shiftState(state, code, { inline: true }));
|
|
1209
|
+
}
|
|
1210
|
+
else if (((_c = assignment.right) === null || _c === void 0 ? void 0 : _c.concept) === 'NewComposite' && ((_e = (_d = assignment.right) === null || _d === void 0 ? void 0 : _d.typeAnnotation) === null || _e === void 0 ? void 0 : _e.typeKind) === 'anonymousStructure') {
|
|
1211
|
+
var rightNode = assignment.right;
|
|
1212
|
+
code += ' = ';
|
|
1213
|
+
code += rightNode.getInitCode(translator_1.shiftState(state, code, { inline: true }));
|
|
1214
|
+
}
|
|
1215
|
+
else {
|
|
1216
|
+
var rightNode = assignment.right;
|
|
1217
|
+
// 当右边有明确类型时,直接使用其类型。旧版本数据查询不能直接使用其 typeAnnotation
|
|
1218
|
+
if ((rightNode === null || rightNode === void 0 ? void 0 : rightNode.typeAnnotation) && !(rightNode instanceof CallQueryComponent__1["default"] && !rightNode.isAutoInfer())) {
|
|
1219
|
+
code += ': ';
|
|
1220
|
+
code += ((_f = rightNode.typeAnnotation) === null || _f === void 0 ? void 0 : _f.toEmbeddedTS(translator_1.shiftState(state, code, { inline: true }))) || 'null';
|
|
1221
|
+
}
|
|
1222
|
+
else {
|
|
1223
|
+
code += ' = ';
|
|
1224
|
+
var rightCode = '';
|
|
1225
|
+
// 因为右侧枚举要赋值就得new 一下;
|
|
1226
|
+
if (rightNode && rightNode instanceof Identifier__1["default"] && rightNode.namespace && rightNode.namespace.endsWith('enums')) {
|
|
1227
|
+
rightCode += 'new ';
|
|
1228
|
+
}
|
|
1229
|
+
rightCode += rightNode && rightNode.toEmbeddedTS ? rightNode.toEmbeddedTS(translator_1.shiftState(state, code, { inline: true })) : '__RIGHT__';
|
|
1230
|
+
code += _this.getRightCode(rightCode, assignment, rightNode);
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
code += ';\n';
|
|
1234
|
+
});
|
|
1235
|
+
if (!this.body.length && this.returns.length) {
|
|
1236
|
+
code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 1) + ("return " + this.returns[0].name + ";\n");
|
|
1237
|
+
}
|
|
1238
|
+
else {
|
|
1239
|
+
// 如果长度小于2 并且不是虚拟节点就 加 报错,
|
|
1240
|
+
if (this.body.length <= 2 && !(this.parentNode instanceof Namespace__1["default"])) {
|
|
1241
|
+
if (this.body.length && this.body[0].concept === 'JavaLogic') {
|
|
1242
|
+
code += '';
|
|
1243
|
+
}
|
|
1244
|
+
else {
|
|
1245
|
+
code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 1);
|
|
1246
|
+
code += 'const __LogicEmpty: any = null;';
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
this.body.forEach(function (item) {
|
|
1250
|
+
code += item.toEmbeddedTS && item.toEmbeddedTS(translator_1.shiftState(state, code, { tabSize: ((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 1 }));
|
|
1251
|
+
code += ';\n';
|
|
1252
|
+
});
|
|
1253
|
+
}
|
|
1254
|
+
// 在body渲染完成之后把其余的节点放到下面
|
|
1255
|
+
this.playground.forEach(function (item) {
|
|
1256
|
+
code += item.toEmbeddedTS(translator_1.shiftState(state, code, { tabSize: ((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 1 }));
|
|
1257
|
+
code += ';\n';
|
|
1258
|
+
});
|
|
1259
|
+
code += translator_1.indent((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + '}';
|
|
1260
|
+
if (prefix === 'inObject') {
|
|
1261
|
+
code += ",";
|
|
1262
|
+
}
|
|
1263
|
+
code += '\n';
|
|
1264
|
+
return code;
|
|
1265
|
+
};
|
|
1266
|
+
Logic.prototype.getRightCode = function (code, assignment, rightNode) {
|
|
1267
|
+
code = code.replaceAll('\n', ' ');
|
|
1268
|
+
if (assignment instanceof Assignment__1["default"] && !assignment.right)
|
|
1269
|
+
return code;
|
|
1270
|
+
// 调用接口,参数替换成 null
|
|
1271
|
+
if (rightNode instanceof CallInterface__1["default"]) {
|
|
1272
|
+
var _interface = rightNode.getModuleInterface()._interface;
|
|
1273
|
+
return _interface ? rightNode.tsCalleeKey + "(" + _interface.params.map(function () { return 'null'; }).join(',') + ")" : null;
|
|
1274
|
+
}
|
|
1275
|
+
// 调用全局逻辑,参数替换成 null
|
|
1276
|
+
if (rightNode instanceof CallLogic__1["default"] && rightNode.calleeNamespace === 'app.logics') {
|
|
1277
|
+
var calleeName_1 = rightNode === null || rightNode === void 0 ? void 0 : rightNode.calleeName;
|
|
1278
|
+
var calleeLogic = this.app.logics.find(function (l) { return l.name === calleeName_1; });
|
|
1279
|
+
return calleeLogic ? "app.logics." + calleeName_1 + "(" + calleeLogic.params.map(function () { return 'null'; }).join(',') + ")" : null;
|
|
1280
|
+
}
|
|
1281
|
+
// ForEachStatement 内部变量需要替换处理,如 item、index
|
|
1282
|
+
var forEachStatement = assignment.getAncestor('ForEachStatement');
|
|
1283
|
+
if (forEachStatement) {
|
|
1284
|
+
code = this.handleForEachCode(code, forEachStatement);
|
|
1285
|
+
}
|
|
1286
|
+
// Match 需要针对分支缩小类型范围
|
|
1287
|
+
var matchCase = assignment.getAncestor('MatchCase');
|
|
1288
|
+
if (matchCase) {
|
|
1289
|
+
code = this.handleMatchCaseCode(code, matchCase);
|
|
1290
|
+
}
|
|
1291
|
+
return code;
|
|
1292
|
+
};
|
|
1293
|
+
Logic.prototype.handleReplaceCode = function (code, variable, replaceCode) {
|
|
1294
|
+
return code.replace(/\S+/g, function ($1) {
|
|
1295
|
+
if ($1 === variable + ",")
|
|
1296
|
+
return replaceCode + ",";
|
|
1297
|
+
if ($1 === variable)
|
|
1298
|
+
return replaceCode;
|
|
1299
|
+
var fnCode = $1;
|
|
1300
|
+
if ($1.startsWith(variable + "."))
|
|
1301
|
+
fnCode = $1.replaceAll(variable + ".", replaceCode + ".");
|
|
1302
|
+
if ($1.startsWith(variable + ","))
|
|
1303
|
+
fnCode = $1.replaceAll(variable + ",", replaceCode + ",");
|
|
1304
|
+
if ($1.includes("(" + variable + ","))
|
|
1305
|
+
fnCode = $1.replaceAll("(" + variable + ",", "(" + replaceCode + ",");
|
|
1306
|
+
if ($1.includes("(" + variable + "."))
|
|
1307
|
+
fnCode = $1.replaceAll("(" + variable + ".", "(" + replaceCode + ".");
|
|
1308
|
+
if ($1.includes("(" + variable + ")"))
|
|
1309
|
+
fnCode = $1.replaceAll("(" + variable + ")", "(" + replaceCode + ")");
|
|
1310
|
+
if ($1.includes("," + variable + ","))
|
|
1311
|
+
fnCode = $1.replaceAll("," + variable + ",", "," + replaceCode + ",");
|
|
1312
|
+
if ($1.includes("," + variable + "."))
|
|
1313
|
+
fnCode = $1.replaceAll("," + variable + ".", "," + replaceCode + ".");
|
|
1314
|
+
if ($1.includes("," + variable + ")"))
|
|
1315
|
+
fnCode = $1.replaceAll("," + variable + ")", "," + replaceCode + ")");
|
|
1316
|
+
return fnCode;
|
|
1317
|
+
});
|
|
1318
|
+
};
|
|
1319
|
+
Logic.prototype.handleForEachCode = function (code, forEachStatement) {
|
|
1320
|
+
var item = forEachStatement.item, index = forEachStatement.index, each = forEachStatement.each;
|
|
1321
|
+
if (code.includes(item.name)) {
|
|
1322
|
+
var eachTSCode = each.toEmbeddedTS();
|
|
1323
|
+
code = this.handleReplaceCode(code, item.name, eachTSCode === '__IDENTIFIER__' ? eachTSCode : eachTSCode + ".__get(0)");
|
|
1324
|
+
}
|
|
1325
|
+
if (code.includes(index.name))
|
|
1326
|
+
code = this.handleReplaceCode(code, index.name, 'new nasl.core.Long(0)');
|
|
1327
|
+
var parentForEachStatement = forEachStatement.getAncestor('ForEachStatement');
|
|
1328
|
+
if (parentForEachStatement) {
|
|
1329
|
+
this.handleForEachCode(code, parentForEachStatement);
|
|
1330
|
+
}
|
|
1331
|
+
return code;
|
|
1332
|
+
};
|
|
1333
|
+
Logic.prototype.handleMatchCaseCode = function (code, matchCase) {
|
|
1334
|
+
var match = matchCase.getAncestor('Match');
|
|
1335
|
+
var expressionTsCode = match.expression.toEmbeddedTS();
|
|
1336
|
+
if (code.includes(expressionTsCode)) {
|
|
1337
|
+
var typeCode_1 = '';
|
|
1338
|
+
matchCase.patterns.forEach(function (pattern, index) {
|
|
1339
|
+
if (pattern instanceof TypeAnnotation__1["default"]) {
|
|
1340
|
+
if (index === 0) {
|
|
1341
|
+
typeCode_1 += pattern.toEmbeddedTS();
|
|
1342
|
+
}
|
|
1343
|
+
else {
|
|
1344
|
+
typeCode_1 += '|';
|
|
1345
|
+
typeCode_1 += pattern.toEmbeddedTS();
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
});
|
|
1349
|
+
if (typeCode_1) {
|
|
1350
|
+
code = this.handleReplaceCode(code, expressionTsCode, "(" + expressionTsCode + " as " + typeCode_1 + ")");
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
var parentMatchCase = match.getAncestor('MatchCase');
|
|
1354
|
+
if (parentMatchCase) {
|
|
1355
|
+
code = this.handleMatchCaseCode(code, parentMatchCase);
|
|
1356
|
+
}
|
|
1357
|
+
return code;
|
|
1358
|
+
};
|
|
1359
|
+
Logic.prototype.getNamespace = function () {
|
|
1360
|
+
var _a;
|
|
1361
|
+
if (this.parentNode) {
|
|
1362
|
+
var parentNamespace = (_a = this.parentNode) === null || _a === void 0 ? void 0 : _a.getNamespace();
|
|
1363
|
+
var parentName = this.parentNode.name;
|
|
1364
|
+
var arr = [parentNamespace];
|
|
1365
|
+
if (this.parentNode.concept !== 'App' && parentName) {
|
|
1366
|
+
arr.push(parentName);
|
|
1367
|
+
}
|
|
1368
|
+
var namespace = arr.join('.');
|
|
1369
|
+
if (!['nasl.ui', 'nasl.utils', 'nasl.util', 'nasl.browser', 'nasl.auth', 'nasl.configuration', 'nasl.process', 'nasl.logging', 'nasl.io'].includes(namespace)
|
|
1370
|
+
&& !namespace.includes('.logics')) {
|
|
1371
|
+
namespace = namespace + ".logics";
|
|
1372
|
+
}
|
|
1373
|
+
return namespace;
|
|
1374
|
+
}
|
|
1375
|
+
else
|
|
1376
|
+
throw new Error('无法获取命名空间,请设置 parentNode!');
|
|
1377
|
+
};
|
|
1378
|
+
Logic.prototype.getTsNamespace = function () {
|
|
1379
|
+
var _a;
|
|
1380
|
+
if (this.parentNode) {
|
|
1381
|
+
var parentNamespace = (_a = this.parentNode) === null || _a === void 0 ? void 0 : _a.getTsNamespace();
|
|
1382
|
+
var parentName = this.parentNode.tsName || this.parentNode.name;
|
|
1383
|
+
var arr = [parentNamespace];
|
|
1384
|
+
if (this.parentNode.concept !== 'App' && parentName) {
|
|
1385
|
+
arr.push(parentName);
|
|
1386
|
+
}
|
|
1387
|
+
var namespace = arr.join('.');
|
|
1388
|
+
if (!['nasl.ui', 'nasl.utils', 'nasl.util', 'nasl.browser', 'nasl.auth', 'nasl.configuration', 'nasl.process', 'nasl.logging', 'nasl.io'].includes(namespace)
|
|
1389
|
+
&& !namespace.includes('.logics')) {
|
|
1390
|
+
namespace = namespace + ".logics";
|
|
1391
|
+
}
|
|
1392
|
+
return namespace;
|
|
1393
|
+
}
|
|
1394
|
+
else
|
|
1395
|
+
throw new Error('无法获取命名空间,请设置 parentNode!');
|
|
1396
|
+
};
|
|
1397
|
+
/**
|
|
1398
|
+
* 生成宿主语言的文件路径
|
|
1399
|
+
* @param name 一般不用传,用于 rename
|
|
1400
|
+
*/
|
|
1401
|
+
Logic.prototype.getEmbeddedFilePath = function (name) {
|
|
1402
|
+
if (name === void 0) { name = this.name; }
|
|
1403
|
+
var _path = this.module ? "/" + this.module.parentKey + "/" + this.module.name : '';
|
|
1404
|
+
if (this.parentNode instanceof FrontendLibrary__1.FrontendLibrary) {
|
|
1405
|
+
_path += "/frontends/" + this.parentNode.type;
|
|
1406
|
+
}
|
|
1407
|
+
return "/embedded/" + this.app.name + _path + "/logics/" + name + ".ts";
|
|
1408
|
+
};
|
|
1409
|
+
Logic.prototype.toEmbeddedTSFile = function () {
|
|
1410
|
+
var code = "namespace " + this.getTsNamespace() + " {\n";
|
|
1411
|
+
var state = translator_1.createCompilerState(code, { tabSize: 1 });
|
|
1412
|
+
try {
|
|
1413
|
+
code += this.toEmbeddedTS(state);
|
|
1414
|
+
}
|
|
1415
|
+
catch (err) {
|
|
1416
|
+
console.log(err, '有问题翻译失败');
|
|
1417
|
+
code += '';
|
|
1418
|
+
console.log(err);
|
|
1419
|
+
}
|
|
1420
|
+
code += '}\n';
|
|
1421
|
+
return {
|
|
1422
|
+
code: code,
|
|
1423
|
+
filePath: this.getEmbeddedFilePath(),
|
|
1424
|
+
sourceMap: state.sourceMap
|
|
1425
|
+
};
|
|
1426
|
+
};
|
|
1427
|
+
Logic.getDefaultOptions = function () {
|
|
1428
|
+
return {
|
|
1429
|
+
body: [
|
|
1430
|
+
{
|
|
1431
|
+
concept: 'Start',
|
|
1432
|
+
label: '开始',
|
|
1433
|
+
kind: 'Statement',
|
|
1434
|
+
type: 'Start'
|
|
1435
|
+
},
|
|
1436
|
+
{
|
|
1437
|
+
concept: 'End',
|
|
1438
|
+
label: '结束',
|
|
1439
|
+
kind: 'Statement',
|
|
1440
|
+
type: 'End'
|
|
1441
|
+
},
|
|
1442
|
+
]
|
|
1443
|
+
};
|
|
1444
|
+
};
|
|
1445
|
+
Logic.prototype.saveStructureOfCallQueryComponents = function (root) {
|
|
1446
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1447
|
+
var set, _i, set_1, node;
|
|
1448
|
+
return __generator(this, function (_a) {
|
|
1449
|
+
if (!root)
|
|
1450
|
+
root = this;
|
|
1451
|
+
set = new Set();
|
|
1452
|
+
utils.traverse(function (_a) {
|
|
1453
|
+
var node = _a.node;
|
|
1454
|
+
if (node instanceof CallQueryComponent__1["default"]) {
|
|
1455
|
+
set.add(node);
|
|
1456
|
+
}
|
|
1457
|
+
}, { node: root }, {
|
|
1458
|
+
mode: 'anyObject',
|
|
1459
|
+
excludedKeySet: new Set(['parentNode', '__assignment__'])
|
|
1460
|
+
});
|
|
1461
|
+
for (_i = 0, set_1 = set; _i < set_1.length; _i++) {
|
|
1462
|
+
node = set_1[_i];
|
|
1463
|
+
node.saveStructure();
|
|
1464
|
+
}
|
|
1465
|
+
return [2 /*return*/];
|
|
1466
|
+
});
|
|
1467
|
+
});
|
|
1468
|
+
};
|
|
1469
|
+
// 通过开关设置数据库事务
|
|
1470
|
+
Logic.prototype.setTransactionEnabled = function (flag) {
|
|
1471
|
+
this.setTransactional(new Transactional__1["default"]({
|
|
1472
|
+
enabled: flag
|
|
1473
|
+
}));
|
|
1474
|
+
};
|
|
1475
|
+
Logic.prototype["delete"] = function () {
|
|
1476
|
+
var _a, _b;
|
|
1477
|
+
var actionMsg = '删除逻辑项';
|
|
1478
|
+
if (this.name)
|
|
1479
|
+
actionMsg += "\u201C" + this.name + "\u201D";
|
|
1480
|
+
(_a = this.app) === null || _a === void 0 ? void 0 : _a.emit('collect:start', {
|
|
1481
|
+
actionMsg: actionMsg
|
|
1482
|
+
});
|
|
1483
|
+
_super.prototype["delete"].call(this);
|
|
1484
|
+
this.traverseChildren(function (el) {
|
|
1485
|
+
if ((el === null || el === void 0 ? void 0 : el.concept) === 'CallQueryComponent')
|
|
1486
|
+
el.removeStructure();
|
|
1487
|
+
});
|
|
1488
|
+
(_b = this.app) === null || _b === void 0 ? void 0 : _b.emit('collect:end');
|
|
1489
|
+
};
|
|
1490
|
+
Object.defineProperty(Logic.prototype, "pathName", {
|
|
1491
|
+
get: function () {
|
|
1492
|
+
if (this.view) {
|
|
1493
|
+
return this.getEventLogicName('chinese');
|
|
1494
|
+
}
|
|
1495
|
+
var nameMap = {
|
|
1496
|
+
OnProcessStart: '流程开始时',
|
|
1497
|
+
OnTasksCreate: '任务创建时',
|
|
1498
|
+
OnTasksOpen: '任务打开时',
|
|
1499
|
+
OnTasksClose: '任务关闭时',
|
|
1500
|
+
OnCreate: '用户任务创建时',
|
|
1501
|
+
OnOpen: '用户任务打开时',
|
|
1502
|
+
OnClose: '用户任务关闭时'
|
|
1503
|
+
};
|
|
1504
|
+
var pathName = [this.name];
|
|
1505
|
+
var parentNode = this.parentNode;
|
|
1506
|
+
while (parentNode && parentNode.concept !== 'Process') {
|
|
1507
|
+
var name = nameMap[parentNode.name] || parentNode.name;
|
|
1508
|
+
pathName.unshift(name);
|
|
1509
|
+
parentNode = parentNode.parentNode;
|
|
1510
|
+
}
|
|
1511
|
+
return pathName.join('-');
|
|
1512
|
+
},
|
|
1513
|
+
enumerable: false,
|
|
1514
|
+
configurable: true
|
|
1515
|
+
});
|
|
1516
|
+
// 获取bindEvent下的logic的名称
|
|
1517
|
+
Logic.prototype.getEventLogicName = function (type) {
|
|
1518
|
+
if (this.parentNode instanceof BindEvent__1["default"]) {
|
|
1519
|
+
if (type === 'chinese') {
|
|
1520
|
+
var bindEvent = this.parentNode;
|
|
1521
|
+
var bindChineseName = bindEvent.getPageViewEventChineseName();
|
|
1522
|
+
return bindChineseName + "-" + this.name;
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
return this.name;
|
|
1526
|
+
};
|
|
1527
|
+
Object.defineProperty(Logic.prototype, "getLogicBelongTo", {
|
|
1528
|
+
get: function () {
|
|
1529
|
+
var _a = this.calleewholeKey.split('.'), belongTo = _a[1];
|
|
1530
|
+
return belongTo;
|
|
1531
|
+
},
|
|
1532
|
+
enumerable: false,
|
|
1533
|
+
configurable: true
|
|
1534
|
+
});
|
|
1535
|
+
// 校验logic的返回值是不是有error类型
|
|
1536
|
+
Logic.checkLogicReturnTypeHasError = function (logic) {
|
|
1537
|
+
var _a, _b, _c;
|
|
1538
|
+
var findHasError = false;
|
|
1539
|
+
if (!logic) {
|
|
1540
|
+
return findHasError;
|
|
1541
|
+
}
|
|
1542
|
+
if (((_a = logic.returns) === null || _a === void 0 ? void 0 : _a.length) && ((_b = logic.returns[0]) === null || _b === void 0 ? void 0 : _b.typeAnnotation)) {
|
|
1543
|
+
// 如果新导入的logic还有Error类型
|
|
1544
|
+
var logicType = logic.returns[0].typeAnnotation;
|
|
1545
|
+
if (logicType.typeNamespace === 'nasl.ui' && logicType.typeName === 'Error') {
|
|
1546
|
+
findHasError = true;
|
|
1547
|
+
}
|
|
1548
|
+
else if (logicType.typeNamespace === 'nasl.core' && logicType.typeKind === 'union') {
|
|
1549
|
+
// 如果 logic 有 returns 而且,也有typeArguments的长度
|
|
1550
|
+
findHasError = Boolean((_c = logicType.typeArguments) === null || _c === void 0 ? void 0 : _c.find(function (item) { return ((item === null || item === void 0 ? void 0 : item.typeNamespace) === 'nasl.ui' && (item === null || item === void 0 ? void 0 : item.typeName) === 'Error'); }));
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
return findHasError;
|
|
1554
|
+
};
|
|
1555
|
+
var Logic_1;
|
|
1556
|
+
__decorate([
|
|
1557
|
+
decorators_1.property()
|
|
1558
|
+
], Logic.prototype, "concept");
|
|
1559
|
+
__decorate([
|
|
1560
|
+
decorators_1.property()
|
|
1561
|
+
], Logic.prototype, "name");
|
|
1562
|
+
__decorate([
|
|
1563
|
+
decorators_1.property()
|
|
1564
|
+
], Logic.prototype, "description");
|
|
1565
|
+
__decorate([
|
|
1566
|
+
decorators_1.property()
|
|
1567
|
+
], Logic.prototype, "triggerType");
|
|
1568
|
+
__decorate([
|
|
1569
|
+
decorators_1.property()
|
|
1570
|
+
], Logic.prototype, "cron");
|
|
1571
|
+
__decorate([
|
|
1572
|
+
decorators_1.property('Transactional')
|
|
1573
|
+
], Logic.prototype, "transactional");
|
|
1574
|
+
__decorate([
|
|
1575
|
+
decorators_1.property()
|
|
1576
|
+
], Logic.prototype, "compilerInfoMap");
|
|
1577
|
+
__decorate([
|
|
1578
|
+
decorators_1.property('TypeParam')
|
|
1579
|
+
], Logic.prototype, "typeParams");
|
|
1580
|
+
__decorate([
|
|
1581
|
+
decorators_1.property('Param')
|
|
1582
|
+
], Logic.prototype, "params");
|
|
1583
|
+
__decorate([
|
|
1584
|
+
decorators_1.property('Return')
|
|
1585
|
+
], Logic.prototype, "returns");
|
|
1586
|
+
__decorate([
|
|
1587
|
+
decorators_1.property('Variable')
|
|
1588
|
+
], Logic.prototype, "variables");
|
|
1589
|
+
__decorate([
|
|
1590
|
+
decorators_1.property('LogicItem')
|
|
1591
|
+
], Logic.prototype, "body");
|
|
1592
|
+
__decorate([
|
|
1593
|
+
decorators_1.property('LogicItem')
|
|
1594
|
+
], Logic.prototype, "playground");
|
|
1595
|
+
__decorate([
|
|
1596
|
+
translator_1.withSourceMap()
|
|
1597
|
+
], Logic.prototype, "toEmbeddedTSInProcess");
|
|
1598
|
+
__decorate([
|
|
1599
|
+
translator_1.withSourceMap()
|
|
1600
|
+
], Logic.prototype, "toEmbeddedTS");
|
|
1601
|
+
Logic = Logic_1 = __decorate([
|
|
1602
|
+
decorators_1.concept('逻辑')
|
|
1603
|
+
], Logic);
|
|
1604
|
+
return Logic;
|
|
1605
|
+
}(BaseNode_1["default"]));
|
|
1606
|
+
exports.Logic = Logic;
|
|
1607
|
+
classMap_1["default"].Logic = Logic;
|
|
1608
|
+
exports["default"] = Logic;
|
|
1609
|
+
//================================================================================
|
|
1610
|
+
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
1611
|
+
// 自动生成的代码已结束。下面可以手动编写。
|
|
1612
|
+
//================================================================================
|