@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,756 @@
|
|
|
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
|
+
exports.__esModule = true;
|
|
33
|
+
exports.Destination = void 0;
|
|
34
|
+
var utils_1 = require("../automate/engine/utils");
|
|
35
|
+
var translator_1 = require("../translator");
|
|
36
|
+
var __1 = require("..");
|
|
37
|
+
var decorators_1 = require("../decorators");
|
|
38
|
+
var utils = require("../utils");
|
|
39
|
+
var classMap_1 = require("../common/classMap");
|
|
40
|
+
var Argument__1 = require("./Argument__");
|
|
41
|
+
var LogicItem__1 = require("./LogicItem__");
|
|
42
|
+
/**
|
|
43
|
+
* 跳转页面
|
|
44
|
+
*/
|
|
45
|
+
var Destination = /** @class */ (function (_super) {
|
|
46
|
+
__extends(Destination, _super);
|
|
47
|
+
/**
|
|
48
|
+
* @param source 需要合并的部分参数
|
|
49
|
+
*/
|
|
50
|
+
function Destination(source) {
|
|
51
|
+
var _this = this;
|
|
52
|
+
source = Object.assign({}, Destination_1.getDefaultOptions(), source);
|
|
53
|
+
_this = _super.call(this, source) || this;
|
|
54
|
+
/**
|
|
55
|
+
* 产品概念
|
|
56
|
+
*/
|
|
57
|
+
_this.concept = 'Destination';
|
|
58
|
+
/**
|
|
59
|
+
* 跳转页面标题
|
|
60
|
+
*/
|
|
61
|
+
_this.label = '跳转页面';
|
|
62
|
+
/**
|
|
63
|
+
* viewNamespace
|
|
64
|
+
*/
|
|
65
|
+
_this.viewNamespace = undefined;
|
|
66
|
+
/**
|
|
67
|
+
* viewName
|
|
68
|
+
*/
|
|
69
|
+
_this.viewName = undefined;
|
|
70
|
+
/**
|
|
71
|
+
* 实际参数
|
|
72
|
+
*/
|
|
73
|
+
_this.arguments = [];
|
|
74
|
+
/**
|
|
75
|
+
* 锚点参数
|
|
76
|
+
*/
|
|
77
|
+
_this.anchor = undefined;
|
|
78
|
+
/**
|
|
79
|
+
* target
|
|
80
|
+
*/
|
|
81
|
+
_this.target = '_self';
|
|
82
|
+
_super.prototype.subConstructor.call(_this, source);
|
|
83
|
+
return _this;
|
|
84
|
+
}
|
|
85
|
+
Destination_1 = Destination;
|
|
86
|
+
Destination.prototype.getClassName = function () {
|
|
87
|
+
return 'Destination';
|
|
88
|
+
};
|
|
89
|
+
Destination.from = function (source, parentNode, parentKey) {
|
|
90
|
+
return _super.from.call(this, source, parentNode, parentKey);
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* 设置viewNamespace
|
|
94
|
+
*/
|
|
95
|
+
Destination.prototype.setViewNamespace = function (viewNamespace) {
|
|
96
|
+
var object = {
|
|
97
|
+
viewNamespace: viewNamespace
|
|
98
|
+
};
|
|
99
|
+
this.update(__assign({}, object));
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* 设置viewName
|
|
103
|
+
*/
|
|
104
|
+
Destination.prototype.setViewName = function (viewName) {
|
|
105
|
+
var object = {
|
|
106
|
+
viewName: viewName
|
|
107
|
+
};
|
|
108
|
+
this.update(__assign({}, object));
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* 设置锚点参数
|
|
112
|
+
*/
|
|
113
|
+
Destination.prototype.setAnchor = function (anchor) {
|
|
114
|
+
anchor._delete();
|
|
115
|
+
var relationOptions = { parentNode: this, parentKey: 'anchor' };
|
|
116
|
+
Object.assign(anchor, relationOptions);
|
|
117
|
+
var object = {
|
|
118
|
+
anchor: anchor
|
|
119
|
+
};
|
|
120
|
+
this.update(__assign({}, object));
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* 设置target
|
|
124
|
+
*/
|
|
125
|
+
Destination.prototype.setTarget = function (target) {
|
|
126
|
+
var object = {
|
|
127
|
+
target: target
|
|
128
|
+
};
|
|
129
|
+
this.update(__assign({}, object));
|
|
130
|
+
};
|
|
131
|
+
Destination.prototype._insertArgumentAt = function (options, index) {
|
|
132
|
+
var argumentOptions = {};
|
|
133
|
+
var relationOptions = { parentNode: this, parentKey: 'arguments' };
|
|
134
|
+
var argument;
|
|
135
|
+
if (options instanceof Argument__1["default"]) {
|
|
136
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
137
|
+
argument = options;
|
|
138
|
+
Object.assign(argument, relationOptions);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
argument = Argument__1["default"].from(__assign(__assign({}, argumentOptions), options), this, 'arguments');
|
|
142
|
+
}
|
|
143
|
+
this.arguments.splice(index, 0, argument);
|
|
144
|
+
return argument;
|
|
145
|
+
};
|
|
146
|
+
Destination.prototype.insertArgumentAt = function (options, index) {
|
|
147
|
+
var node = this._insertArgumentAt(options, index);
|
|
148
|
+
node.create({
|
|
149
|
+
index: index,
|
|
150
|
+
parentNode: this,
|
|
151
|
+
parentKey: 'arguments'
|
|
152
|
+
});
|
|
153
|
+
return node;
|
|
154
|
+
};
|
|
155
|
+
Destination.prototype._addArgument = function (options) {
|
|
156
|
+
var index = this.arguments.length;
|
|
157
|
+
return this._insertArgumentAt(options, index);
|
|
158
|
+
};
|
|
159
|
+
Destination.prototype.addArgument = function (options) {
|
|
160
|
+
var node = this._addArgument(options);
|
|
161
|
+
var index = this.arguments.indexOf(node);
|
|
162
|
+
node.create({
|
|
163
|
+
index: index,
|
|
164
|
+
parentNode: this,
|
|
165
|
+
parentKey: 'arguments'
|
|
166
|
+
});
|
|
167
|
+
return node;
|
|
168
|
+
};
|
|
169
|
+
Destination.prototype.removeArgumentInArguments = function (options) {
|
|
170
|
+
var argument = options;
|
|
171
|
+
return argument["delete"]();
|
|
172
|
+
};
|
|
173
|
+
Destination.prototype.removeAnchor = function (options) {
|
|
174
|
+
var anchor;
|
|
175
|
+
if (typeof options === 'string') {
|
|
176
|
+
anchor = this.anchor;
|
|
177
|
+
if (!anchor) {
|
|
178
|
+
throw new Error('找不到锚点参数 ' + options);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
anchor = options;
|
|
183
|
+
}
|
|
184
|
+
return anchor["delete"]();
|
|
185
|
+
};
|
|
186
|
+
Destination.prototype.__removeLogicItem = function (logicItem) {
|
|
187
|
+
var parentKey = logicItem.parentKey;
|
|
188
|
+
var params = {
|
|
189
|
+
parentNode: this,
|
|
190
|
+
parentKey: parentKey,
|
|
191
|
+
index: -1,
|
|
192
|
+
object: null,
|
|
193
|
+
oldObject: logicItem
|
|
194
|
+
};
|
|
195
|
+
if (parentKey) {
|
|
196
|
+
params.parentKey = parentKey;
|
|
197
|
+
if (Array.isArray(this[parentKey])) {
|
|
198
|
+
var index = this[parentKey].indexOf(logicItem);
|
|
199
|
+
~index && this[parentKey].splice(index, 1);
|
|
200
|
+
params.index = index;
|
|
201
|
+
}
|
|
202
|
+
else if (this[parentKey] === logicItem) {
|
|
203
|
+
params.index = 0;
|
|
204
|
+
this[parentKey] = undefined;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return params;
|
|
208
|
+
};
|
|
209
|
+
Object.defineProperty(Destination.prototype, "tsCalleeNamespace", {
|
|
210
|
+
//================================================================================
|
|
211
|
+
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
212
|
+
// 自动生成的代码已结束。下面可以手动编写。
|
|
213
|
+
//================================================================================
|
|
214
|
+
get: function () {
|
|
215
|
+
if (this.viewNamespace) {
|
|
216
|
+
var tsCalleeNamespace = this.viewNamespace;
|
|
217
|
+
tsCalleeNamespace = tsCalleeNamespace.replace(/\.[0-9]/g, function (m) { return m.replace('.', '.$'); });
|
|
218
|
+
tsCalleeNamespace = tsCalleeNamespace.replace(/-/g, '_');
|
|
219
|
+
return tsCalleeNamespace;
|
|
220
|
+
}
|
|
221
|
+
return '';
|
|
222
|
+
},
|
|
223
|
+
enumerable: false,
|
|
224
|
+
configurable: true
|
|
225
|
+
});
|
|
226
|
+
Object.defineProperty(Destination.prototype, "tsName", {
|
|
227
|
+
get: function () {
|
|
228
|
+
if (this.viewName) {
|
|
229
|
+
var tsName = this.viewName;
|
|
230
|
+
// 匹配所有特殊字符都转为_
|
|
231
|
+
tsName = tsName.replace(/\W/g, '_');
|
|
232
|
+
if (/^\d/.test(tsName)) {
|
|
233
|
+
tsName = '$' + tsName;
|
|
234
|
+
}
|
|
235
|
+
return tsName;
|
|
236
|
+
}
|
|
237
|
+
return '';
|
|
238
|
+
},
|
|
239
|
+
enumerable: false,
|
|
240
|
+
configurable: true
|
|
241
|
+
});
|
|
242
|
+
Destination.prototype.genViewArr = function () {
|
|
243
|
+
var _a;
|
|
244
|
+
var viewArr = ((_a = this.viewNamespace) === null || _a === void 0 ? void 0 : _a.split('.').splice(1).filter(function (item, index) { return index % 2 === 1; })) || [];
|
|
245
|
+
if (this.viewName) {
|
|
246
|
+
viewArr.push(this.viewName);
|
|
247
|
+
}
|
|
248
|
+
// 第一个是端名,需要去掉
|
|
249
|
+
viewArr.shift();
|
|
250
|
+
return viewArr;
|
|
251
|
+
};
|
|
252
|
+
Destination.prototype.toInViewMethod = function () {
|
|
253
|
+
var code = '';
|
|
254
|
+
var viewArr = this.genViewArr();
|
|
255
|
+
if (Array.isArray(viewArr) && viewArr.length) {
|
|
256
|
+
code += "let url = '" + (this.viewNode.frontend.prefixPath ? this.viewNode.frontend.prefixPath : '') + "/" + viewArr.join('/') + "';\n";
|
|
257
|
+
var completeArguments = this.completeArguments;
|
|
258
|
+
if (Array.isArray(completeArguments) && completeArguments.length) {
|
|
259
|
+
var node = this.viewNode;
|
|
260
|
+
var logicParam = [];
|
|
261
|
+
if (node === null || node === void 0 ? void 0 : node.params) {
|
|
262
|
+
logicParam = node.params;
|
|
263
|
+
}
|
|
264
|
+
var logicParamLen_1 = logicParam.length;
|
|
265
|
+
var paramAssigns_1 = [];
|
|
266
|
+
var args_1 = [];
|
|
267
|
+
completeArguments.forEach(function (arg, index) {
|
|
268
|
+
var value = arg === null || arg === void 0 ? void 0 : arg.toJS();
|
|
269
|
+
if (value && index < logicParamLen_1) {
|
|
270
|
+
var paramAssign = "const " + arg.keyword + " = ";
|
|
271
|
+
if (value === 'undefined') {
|
|
272
|
+
paramAssign += "null";
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
paramAssign += value;
|
|
276
|
+
}
|
|
277
|
+
paramAssign += '\n;';
|
|
278
|
+
paramAssigns_1.push(paramAssign);
|
|
279
|
+
var constStr = '${' + arg.keyword + '}';
|
|
280
|
+
args_1.push(arg.keyword + "=" + constStr);
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
code += paramAssigns_1.join(';\n') + "\n";
|
|
284
|
+
code += 'const params = `';
|
|
285
|
+
code += args_1.join('&');
|
|
286
|
+
code += '`;\n';
|
|
287
|
+
code += 'if (params) {\nurl += `?${params}`;\n}\n';
|
|
288
|
+
}
|
|
289
|
+
if (this.anchor) {
|
|
290
|
+
var anchorCode = this.anchor.toJS();
|
|
291
|
+
if (anchorCode) {
|
|
292
|
+
code += "const anchor = " + anchorCode + ";\n";
|
|
293
|
+
code += 'if (anchor) {\nurl += `#${anchor}`;\n}\n';
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
code += 'return url;';
|
|
297
|
+
}
|
|
298
|
+
return "await (async () => {\n try {\n " + code + ";\n } catch(err) {\n console.log(err);\n }\n })();";
|
|
299
|
+
};
|
|
300
|
+
Destination.prototype.toVue = function (options) {
|
|
301
|
+
var _a, _b;
|
|
302
|
+
var url = '`';
|
|
303
|
+
var viewArr = this.genViewArr();
|
|
304
|
+
if (Array.isArray(viewArr) && viewArr.length) {
|
|
305
|
+
url += (((_b = (_a = this.viewNode) === null || _a === void 0 ? void 0 : _a.frontend) === null || _b === void 0 ? void 0 : _b.prefixPath) ? this.viewNode.frontend.prefixPath : '') + "/" + viewArr.join('/');
|
|
306
|
+
var completeArguments = this.completeArguments;
|
|
307
|
+
if (completeArguments.length) {
|
|
308
|
+
var node = this.viewNode;
|
|
309
|
+
var logicParam = [];
|
|
310
|
+
if (node === null || node === void 0 ? void 0 : node.params) {
|
|
311
|
+
logicParam = node.params;
|
|
312
|
+
}
|
|
313
|
+
var logicParamLength_1 = logicParam.length;
|
|
314
|
+
var args = completeArguments.map(function (arg, index) {
|
|
315
|
+
var value = arg === null || arg === void 0 ? void 0 : arg.toVue();
|
|
316
|
+
var argStr = '';
|
|
317
|
+
if (value && index < logicParamLength_1) {
|
|
318
|
+
argStr += arg.keyword + "=" + '${';
|
|
319
|
+
if (value === 'undefined') {
|
|
320
|
+
argStr += "null";
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
argStr += value;
|
|
324
|
+
}
|
|
325
|
+
argStr += '}';
|
|
326
|
+
}
|
|
327
|
+
return argStr;
|
|
328
|
+
}).filter(function (arg) { return !!arg; });
|
|
329
|
+
url += "?" + args.join('&');
|
|
330
|
+
}
|
|
331
|
+
if (this.anchor) {
|
|
332
|
+
var anchor = this.anchor.toVue();
|
|
333
|
+
if (anchor)
|
|
334
|
+
url += "#${" + anchor + "}";
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
url += '`';
|
|
338
|
+
return url;
|
|
339
|
+
};
|
|
340
|
+
Destination.prototype.toUI = function () {
|
|
341
|
+
var _a, _b;
|
|
342
|
+
var url = '';
|
|
343
|
+
var viewArr = this.genViewArr();
|
|
344
|
+
if (Array.isArray(viewArr) && viewArr.length) {
|
|
345
|
+
url += '`';
|
|
346
|
+
// IDE内展示需要屏蔽掉“系统统一路径前缀”
|
|
347
|
+
url += (((_b = (_a = this.viewNode) === null || _a === void 0 ? void 0 : _a.frontend) === null || _b === void 0 ? void 0 : _b.basePath) ? this.viewNode.frontend.basePath : '') + "/" + viewArr.join('/');
|
|
348
|
+
var completeArguments = this.completeArguments;
|
|
349
|
+
if (completeArguments.length) {
|
|
350
|
+
var node = this.viewNode;
|
|
351
|
+
var logicParam = [];
|
|
352
|
+
if (node === null || node === void 0 ? void 0 : node.params) {
|
|
353
|
+
logicParam = node.params;
|
|
354
|
+
}
|
|
355
|
+
var logicParamLength_2 = logicParam.length;
|
|
356
|
+
var args = completeArguments.map(function (arg, index) {
|
|
357
|
+
var value = arg === null || arg === void 0 ? void 0 : arg.toUI();
|
|
358
|
+
var argStr = '';
|
|
359
|
+
if (value && index < logicParamLength_2) {
|
|
360
|
+
argStr += arg.keyword + "=" + '${';
|
|
361
|
+
if (value === 'undefined') {
|
|
362
|
+
argStr += 'null';
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
argStr += value;
|
|
366
|
+
}
|
|
367
|
+
argStr += '}';
|
|
368
|
+
}
|
|
369
|
+
return argStr;
|
|
370
|
+
}).filter(function (arg) { return !!arg; });
|
|
371
|
+
url += "?" + args.join('&');
|
|
372
|
+
}
|
|
373
|
+
if (this.anchor) {
|
|
374
|
+
var anchor = this.anchor.toUI();
|
|
375
|
+
if (anchor)
|
|
376
|
+
url += "#${" + anchor + "}";
|
|
377
|
+
}
|
|
378
|
+
url += '`';
|
|
379
|
+
}
|
|
380
|
+
return url;
|
|
381
|
+
};
|
|
382
|
+
Destination.prototype.toJS = function () {
|
|
383
|
+
var _a, _b;
|
|
384
|
+
var url = '';
|
|
385
|
+
var viewArr = this.genViewArr();
|
|
386
|
+
if (Array.isArray(viewArr) && viewArr.length) {
|
|
387
|
+
url += 'this.$destination(`';
|
|
388
|
+
url += (((_b = (_a = this.viewNode) === null || _a === void 0 ? void 0 : _a.frontend) === null || _b === void 0 ? void 0 : _b.prefixPath) ? this.viewNode.frontend.prefixPath : '') + "/" + viewArr.join('/');
|
|
389
|
+
var completeArguments = this.completeArguments;
|
|
390
|
+
if (completeArguments.length) {
|
|
391
|
+
var node = this.viewNode;
|
|
392
|
+
var logicParam = [];
|
|
393
|
+
if (node === null || node === void 0 ? void 0 : node.params) {
|
|
394
|
+
logicParam = node.params;
|
|
395
|
+
}
|
|
396
|
+
var logicParamLength_3 = logicParam.length;
|
|
397
|
+
var args = completeArguments.map(function (arg, index) {
|
|
398
|
+
var value = arg === null || arg === void 0 ? void 0 : arg.toJS();
|
|
399
|
+
var argStr = '';
|
|
400
|
+
if (value && index < logicParamLength_3) {
|
|
401
|
+
argStr += arg.keyword + "=" + '${';
|
|
402
|
+
if (value === 'undefined') {
|
|
403
|
+
argStr += 'null';
|
|
404
|
+
}
|
|
405
|
+
else {
|
|
406
|
+
argStr += value;
|
|
407
|
+
}
|
|
408
|
+
argStr += '}';
|
|
409
|
+
}
|
|
410
|
+
return argStr;
|
|
411
|
+
}).filter(function (arg) { return !!arg; });
|
|
412
|
+
url += "?" + args.join('&');
|
|
413
|
+
}
|
|
414
|
+
if (this.anchor) {
|
|
415
|
+
var anchor = this.anchor.toJS();
|
|
416
|
+
if (anchor)
|
|
417
|
+
url += "#${" + anchor + "}";
|
|
418
|
+
}
|
|
419
|
+
url += '`,"';
|
|
420
|
+
url += "" + this.target;
|
|
421
|
+
url += '")';
|
|
422
|
+
}
|
|
423
|
+
return url;
|
|
424
|
+
};
|
|
425
|
+
Destination.getDefaultOptions = function () {
|
|
426
|
+
return {
|
|
427
|
+
anchor: {
|
|
428
|
+
concept: 'Anchor'
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
};
|
|
432
|
+
/**
|
|
433
|
+
* 设置view
|
|
434
|
+
*/
|
|
435
|
+
Destination.prototype.setView = function (view) {
|
|
436
|
+
var _this = this;
|
|
437
|
+
var object = {
|
|
438
|
+
viewNamespace: view.getNamespace(),
|
|
439
|
+
viewName: view.name
|
|
440
|
+
};
|
|
441
|
+
var params = view.params.map(function (param) {
|
|
442
|
+
var relationOptions = { parentNode: _this, parentKey: 'arguments' };
|
|
443
|
+
var argument = Argument__1["default"].from({
|
|
444
|
+
keyword: param.name
|
|
445
|
+
}, _this);
|
|
446
|
+
Object.assign(argument, relationOptions);
|
|
447
|
+
return argument;
|
|
448
|
+
});
|
|
449
|
+
this.update(__assign(__assign({}, object), { arguments: params, folded: false }));
|
|
450
|
+
};
|
|
451
|
+
/**
|
|
452
|
+
* 设置view的argument
|
|
453
|
+
*/
|
|
454
|
+
Destination.prototype.addCalleeArg = function (view) {
|
|
455
|
+
var _this = this;
|
|
456
|
+
var newArgs = this.arguments.map(function (argument) {
|
|
457
|
+
return Argument__1["default"].from(__assign({}, argument), _this);
|
|
458
|
+
});
|
|
459
|
+
var relationOptions = { parentNode: this, parentKey: 'arguments' };
|
|
460
|
+
/**
|
|
461
|
+
* 当前两个参数对应上,添加的时候,view会比参数位内容多,就添加一个 argment
|
|
462
|
+
*/
|
|
463
|
+
if (view.params.length >= newArgs.length) {
|
|
464
|
+
view.params.forEach(function (param, index) {
|
|
465
|
+
var arg = newArgs[index];
|
|
466
|
+
if (!arg) {
|
|
467
|
+
var newParam = Argument__1["default"].from({
|
|
468
|
+
keyword: param.name
|
|
469
|
+
}, _this);
|
|
470
|
+
Object.assign(newParam, relationOptions);
|
|
471
|
+
newArgs.push(newParam);
|
|
472
|
+
}
|
|
473
|
+
else {
|
|
474
|
+
arg.keyword = param.name;
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
else {
|
|
479
|
+
/**
|
|
480
|
+
* 当前callview上数量比view参数还多,他就需要找一个arg使他变成可用的参数
|
|
481
|
+
*/
|
|
482
|
+
newArgs.forEach(function (arg, index) {
|
|
483
|
+
var param = view.params[index];
|
|
484
|
+
if (param) {
|
|
485
|
+
arg.keyword = param.name;
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
this.update({
|
|
490
|
+
arguments: newArgs
|
|
491
|
+
});
|
|
492
|
+
};
|
|
493
|
+
Destination.prototype.deleteCalleeArg = function (argIndex) {
|
|
494
|
+
var _a, _b, _c;
|
|
495
|
+
/**
|
|
496
|
+
* 传递过下标来,然后直接移动到最后结束
|
|
497
|
+
* 如果原来就是最后一个位置就不移动了
|
|
498
|
+
*/
|
|
499
|
+
if (typeof argIndex === 'number') {
|
|
500
|
+
if (!((_a = this.arguments[argIndex]) === null || _a === void 0 ? void 0 : _a.expression)) {
|
|
501
|
+
return (_b = this.arguments[argIndex]) === null || _b === void 0 ? void 0 : _b["delete"]();
|
|
502
|
+
}
|
|
503
|
+
if (argIndex !== this.arguments.length - 1) {
|
|
504
|
+
// 如果本身没有值就直接删除
|
|
505
|
+
(_c = this.arguments[argIndex]) === null || _c === void 0 ? void 0 : _c.moveNode({
|
|
506
|
+
sourceNode: this.arguments[this.arguments.length - 1],
|
|
507
|
+
position: 'insertAfter'
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
/**
|
|
513
|
+
* 设置Arguments的KeyWord
|
|
514
|
+
*/
|
|
515
|
+
Destination.prototype.setArgumentsKeyWord = function (options) {
|
|
516
|
+
var findArgument = options.findArgument, newKeyword = options.newKeyword;
|
|
517
|
+
findArgument.setKeyword(newKeyword);
|
|
518
|
+
};
|
|
519
|
+
Object.defineProperty(Destination.prototype, "viewUIPath", {
|
|
520
|
+
get: function () {
|
|
521
|
+
if (!this.viewNamespace) {
|
|
522
|
+
return '';
|
|
523
|
+
}
|
|
524
|
+
var namespaceAttr = this.viewNamespace.split('.');
|
|
525
|
+
namespaceAttr.push(this.viewName);
|
|
526
|
+
var viewNameAttr = [];
|
|
527
|
+
if (Array.isArray(namespaceAttr)) {
|
|
528
|
+
namespaceAttr.forEach(function (item, index) {
|
|
529
|
+
if (item === 'views') {
|
|
530
|
+
viewNameAttr.push(namespaceAttr[index + 1]);
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
if (this.viewNode && this.viewNode.frontend) {
|
|
535
|
+
return this.viewNode.frontend.basePath + "/" + viewNameAttr.join('/');
|
|
536
|
+
}
|
|
537
|
+
return "/" + viewNameAttr.join('/');
|
|
538
|
+
},
|
|
539
|
+
enumerable: false,
|
|
540
|
+
configurable: true
|
|
541
|
+
});
|
|
542
|
+
Object.defineProperty(Destination.prototype, "viewPath", {
|
|
543
|
+
get: function () {
|
|
544
|
+
if (!this.viewNamespace) {
|
|
545
|
+
return '';
|
|
546
|
+
}
|
|
547
|
+
var namespaceAttr = this.viewNamespace.split('.');
|
|
548
|
+
namespaceAttr.push(this.viewName);
|
|
549
|
+
var viewNameAttr = [];
|
|
550
|
+
if (Array.isArray(namespaceAttr)) {
|
|
551
|
+
namespaceAttr.forEach(function (item, index) {
|
|
552
|
+
if (item === 'views') {
|
|
553
|
+
viewNameAttr.push(namespaceAttr[index + 1]);
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
if (this.viewNode) {
|
|
558
|
+
return this.viewNode.frontend.prefixPath + "/" + viewNameAttr.join('/');
|
|
559
|
+
}
|
|
560
|
+
return "/" + viewNameAttr.join('/');
|
|
561
|
+
},
|
|
562
|
+
enumerable: false,
|
|
563
|
+
configurable: true
|
|
564
|
+
});
|
|
565
|
+
Destination.prototype.toEmbeddedTSInProcess = function (state, prependCode) {
|
|
566
|
+
var _a;
|
|
567
|
+
// const tab = indent((state?.tabSize || 0));
|
|
568
|
+
if (this.tsCalleeNamespace && this.tsName) {
|
|
569
|
+
var destinationName = this.parentNode.name.replace('-', '_');
|
|
570
|
+
var code_1 = destinationName + ": function() {\n";
|
|
571
|
+
code_1 += prependCode;
|
|
572
|
+
code_1 += '\n';
|
|
573
|
+
if (this.tsCalleeNamespace && this.viewName) {
|
|
574
|
+
code_1 += this.tsCalleeNamespace + "." + this.viewName + ".$destination({";
|
|
575
|
+
if (Array.isArray(this.arguments)) {
|
|
576
|
+
this.arguments.forEach(function (argument) {
|
|
577
|
+
code_1 += argument.toEmbeddedTS(translator_1.shiftState(state, code_1), false, true) + ', ';
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
code_1 += ((_a = this.anchor) === null || _a === void 0 ? void 0 : _a.toEmbeddedTS(translator_1.shiftState(state, code_1), true)) || '';
|
|
581
|
+
code_1 += "});\n";
|
|
582
|
+
}
|
|
583
|
+
code_1 += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 1) + "}\n";
|
|
584
|
+
return code_1;
|
|
585
|
+
}
|
|
586
|
+
else {
|
|
587
|
+
return 'destinationEmpty(){ const __destinationEmpty__: any = null}';
|
|
588
|
+
}
|
|
589
|
+
};
|
|
590
|
+
Destination.prototype.toEmbeddedTS = function (state) {
|
|
591
|
+
var _a, _b;
|
|
592
|
+
var code = '';
|
|
593
|
+
var node = this.viewNode;
|
|
594
|
+
var logicParam = [];
|
|
595
|
+
if (node === null || node === void 0 ? void 0 : node.params) {
|
|
596
|
+
logicParam = node.params;
|
|
597
|
+
}
|
|
598
|
+
var logicParamLength = logicParam.length;
|
|
599
|
+
if (this.parentNode instanceof __1.BindAttribute) {
|
|
600
|
+
code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 2);
|
|
601
|
+
if (this.tsCalleeNamespace && this.tsName) {
|
|
602
|
+
code += this.tsCalleeNamespace + "." + this.tsName + ".$destination({";
|
|
603
|
+
if (Array.isArray(this.arguments)) {
|
|
604
|
+
this.arguments.forEach(function (argument, index) {
|
|
605
|
+
var oldName = argument.keyword;
|
|
606
|
+
if (index >= logicParamLength) {
|
|
607
|
+
argument.keyword = '__unknown__';
|
|
608
|
+
}
|
|
609
|
+
code += argument.toEmbeddedTS(translator_1.shiftState(state, code), false, true) + ', ';
|
|
610
|
+
argument.keyword = oldName;
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
code += ((_a = this.anchor) === null || _a === void 0 ? void 0 : _a.toEmbeddedTS(translator_1.shiftState(state, code), true)) || '';
|
|
614
|
+
code += "});\n";
|
|
615
|
+
}
|
|
616
|
+
return code;
|
|
617
|
+
}
|
|
618
|
+
else {
|
|
619
|
+
if (this.tsCalleeNamespace && this.tsName) {
|
|
620
|
+
code += this.tsCalleeNamespace + "." + this.tsName + ".$destination({";
|
|
621
|
+
if (Array.isArray(this.arguments)) {
|
|
622
|
+
this.arguments.forEach(function (argument, index) {
|
|
623
|
+
var oldName = argument.keyword;
|
|
624
|
+
if (index >= logicParamLength) {
|
|
625
|
+
argument.keyword = '__unknown__';
|
|
626
|
+
}
|
|
627
|
+
code += argument.toEmbeddedTS(translator_1.shiftState(state, code), false, true) + ', ';
|
|
628
|
+
argument.keyword = oldName;
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
code += ((_b = this.anchor) === null || _b === void 0 ? void 0 : _b.toEmbeddedTS(translator_1.shiftState(state, code), true)) || '';
|
|
632
|
+
code += "});\n";
|
|
633
|
+
}
|
|
634
|
+
else {
|
|
635
|
+
code += '__IDENTIFIER__';
|
|
636
|
+
}
|
|
637
|
+
return code;
|
|
638
|
+
}
|
|
639
|
+
};
|
|
640
|
+
Destination.prototype.toBrief = function () {
|
|
641
|
+
var _a;
|
|
642
|
+
var q = [];
|
|
643
|
+
if ((_a = this.anchor) === null || _a === void 0 ? void 0 : _a.expression) {
|
|
644
|
+
q.push(this.anchor.toBrief());
|
|
645
|
+
}
|
|
646
|
+
return this.arguments.map(function (a) { return a.toBrief(); }).concat(q).join('<br />');
|
|
647
|
+
};
|
|
648
|
+
Destination.prototype.toEmbeddedTSNormalFunction = function (state) {
|
|
649
|
+
var _a;
|
|
650
|
+
var code = "let " + utils.firstLowerCase(this.concept) + " = function() {\n";
|
|
651
|
+
var tab = translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 2);
|
|
652
|
+
if (this.tsCalleeNamespace && this.tsName) {
|
|
653
|
+
code += "" + tab + this.tsCalleeNamespace + "." + this.tsName + ".$destination(";
|
|
654
|
+
if (Array.isArray(this.arguments)) {
|
|
655
|
+
this.arguments.forEach(function (argument) {
|
|
656
|
+
code += argument.toEmbeddedTS(translator_1.shiftState(state, code)) + ', ';
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
code += ((_a = this.anchor) === null || _a === void 0 ? void 0 : _a.toEmbeddedTS(translator_1.shiftState(state, code))) || '';
|
|
660
|
+
code += tab + ");\n";
|
|
661
|
+
}
|
|
662
|
+
code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 1) + "}\n";
|
|
663
|
+
return code;
|
|
664
|
+
};
|
|
665
|
+
Object.defineProperty(Destination.prototype, "viewNode", {
|
|
666
|
+
get: function () {
|
|
667
|
+
if (!this.viewNamespace || !this.viewName)
|
|
668
|
+
return null;
|
|
669
|
+
var nameSpace = this.viewNamespace;
|
|
670
|
+
nameSpace = nameSpace.replaceAll('views', 'children');
|
|
671
|
+
nameSpace = nameSpace.replace('children', 'views');
|
|
672
|
+
return utils_1.getNodeByNodeCallee(this.app, nameSpace + '.' + this.viewName);
|
|
673
|
+
},
|
|
674
|
+
enumerable: false,
|
|
675
|
+
configurable: true
|
|
676
|
+
});
|
|
677
|
+
Object.defineProperty(Destination.prototype, "calleewholeKey", {
|
|
678
|
+
// 用于logic回填
|
|
679
|
+
get: function () {
|
|
680
|
+
return this.viewNamespace + '.' + this.viewName;
|
|
681
|
+
},
|
|
682
|
+
enumerable: false,
|
|
683
|
+
configurable: true
|
|
684
|
+
});
|
|
685
|
+
Object.defineProperty(Destination.prototype, "completeArguments", {
|
|
686
|
+
get: function () {
|
|
687
|
+
var _a;
|
|
688
|
+
var node = this.viewNode;
|
|
689
|
+
var logicParam = new Map();
|
|
690
|
+
var Arguments = [];
|
|
691
|
+
if (node === null || node === void 0 ? void 0 : node.params) {
|
|
692
|
+
node.params.forEach(function (param) {
|
|
693
|
+
logicParam.set(param.name, param);
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
if ((_a = this.arguments) === null || _a === void 0 ? void 0 : _a.length) {
|
|
697
|
+
this.arguments.forEach(function (arg) {
|
|
698
|
+
var param = logicParam.get(arg.keyword);
|
|
699
|
+
// 取到是不是必填放入参数中
|
|
700
|
+
var newArg = Argument__1["default"].from(arg);
|
|
701
|
+
if (param && !newArg.expression) {
|
|
702
|
+
newArg.paramTypeAnnotation = param.typeAnnotation;
|
|
703
|
+
newArg.paramDefaultValue = param.defaultValue;
|
|
704
|
+
newArg.paramRequired = param.required;
|
|
705
|
+
}
|
|
706
|
+
Arguments.push(newArg);
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
return Arguments;
|
|
710
|
+
},
|
|
711
|
+
enumerable: false,
|
|
712
|
+
configurable: true
|
|
713
|
+
});
|
|
714
|
+
var Destination_1;
|
|
715
|
+
__decorate([
|
|
716
|
+
decorators_1.property()
|
|
717
|
+
], Destination.prototype, "concept");
|
|
718
|
+
__decorate([
|
|
719
|
+
decorators_1.property()
|
|
720
|
+
], Destination.prototype, "label");
|
|
721
|
+
__decorate([
|
|
722
|
+
decorators_1.property()
|
|
723
|
+
], Destination.prototype, "viewNamespace");
|
|
724
|
+
__decorate([
|
|
725
|
+
decorators_1.property()
|
|
726
|
+
], Destination.prototype, "viewName");
|
|
727
|
+
__decorate([
|
|
728
|
+
decorators_1.property('Argument')
|
|
729
|
+
], Destination.prototype, "arguments");
|
|
730
|
+
__decorate([
|
|
731
|
+
decorators_1.property('Anchor')
|
|
732
|
+
], Destination.prototype, "anchor");
|
|
733
|
+
__decorate([
|
|
734
|
+
decorators_1.property()
|
|
735
|
+
], Destination.prototype, "target");
|
|
736
|
+
__decorate([
|
|
737
|
+
translator_1.withSourceMap()
|
|
738
|
+
], Destination.prototype, "toEmbeddedTSInProcess");
|
|
739
|
+
__decorate([
|
|
740
|
+
translator_1.withSourceMap()
|
|
741
|
+
], Destination.prototype, "toEmbeddedTS");
|
|
742
|
+
__decorate([
|
|
743
|
+
translator_1.withSourceMap()
|
|
744
|
+
], Destination.prototype, "toEmbeddedTSNormalFunction");
|
|
745
|
+
Destination = Destination_1 = __decorate([
|
|
746
|
+
decorators_1.concept('跳转页面')
|
|
747
|
+
], Destination);
|
|
748
|
+
return Destination;
|
|
749
|
+
}(LogicItem__1["default"]));
|
|
750
|
+
exports.Destination = Destination;
|
|
751
|
+
classMap_1["default"].Destination = Destination;
|
|
752
|
+
exports["default"] = Destination;
|
|
753
|
+
//================================================================================
|
|
754
|
+
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
755
|
+
// 自动生成的代码已结束。下面可以手动编写。
|
|
756
|
+
//================================================================================
|