@lcap/nasl 0.3.12 → 0.3.14-beta
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/service/create/index.js +2 -2
- package/out/service/create/index.js.map +1 -1
- package/out/service/logic/logic.d.ts +9 -0
- package/out/service/logic/logic.js +7 -0
- package/out/service/logic/logic.js.map +1 -1
- package/out/types/app/App.js +11 -2
- package/out/types/app/App.js.map +1 -1
- package/out/types/app/Service.js +44 -1
- package/out/types/app/Service.js.map +1 -1
- package/out/types/config.d.ts +1 -0
- package/out/types/config.js +1 -0
- package/out/types/config.js.map +1 -1
- package/out/types/data/Entity.d.ts +8 -0
- package/out/types/data/Entity.js +16 -0
- package/out/types/data/Entity.js.map +1 -1
- package/out/types/data/EntityProperty.d.ts +4 -0
- package/out/types/data/EntityProperty.js +7 -0
- package/out/types/data/EntityProperty.js.map +1 -1
- package/out/types/data/Interface.js +2 -1
- package/out/types/data/Interface.js.map +1 -1
- package/out/types/data/Structure.d.ts +4 -0
- package/out/types/data/Structure.js +12 -0
- package/out/types/data/Structure.js.map +1 -1
- package/out/types/data/dataTypes.d.ts +1 -1
- package/out/types/data/dataTypes.js +23 -6
- package/out/types/data/dataTypes.js.map +1 -1
- package/out/types/data/genBlock/builtInFunctions.json +15 -0
- package/out/types/data/genBlock/genCreateBlock.js +4 -5
- package/out/types/data/genBlock/genCreateBlock.js.map +1 -1
- package/out/types/data/genBlock/genListViewBlock.js +1 -1
- package/out/types/data/genBlock/genListViewBlock.js.map +1 -1
- package/out/types/data/genBlock/genTableBlock.js +2 -2
- package/out/types/data/genBlock/genTableBlock.js.map +1 -1
- package/out/types/data/genBlock/genUpdateBlock.js +4 -5
- package/out/types/data/genBlock/genUpdateBlock.js.map +1 -1
- package/out/types/data/genericTypes.d.ts +1 -1
- package/out/types/data/genericTypes.js +6 -2
- package/out/types/data/genericTypes.js.map +1 -1
- package/out/types/data/systemTypes.js +73 -0
- package/out/types/data/systemTypes.js.map +1 -1
- package/out/types/logic/Logic.d.ts +16 -0
- package/out/types/logic/Logic.js +39 -0
- package/out/types/logic/Logic.js.map +1 -1
- package/out/types/logic/LogicItem.d.ts +2 -2
- package/out/types/logic/LogicItem.js +92 -35
- package/out/types/logic/LogicItem.js.map +1 -1
- package/out/types/logic/translator.js +66 -50
- package/out/types/logic/translator.js.map +1 -1
- package/out/types/page/Element.js +21 -9
- package/out/types/page/Element.js.map +1 -1
- package/out/types/page/Page.js +7 -0
- package/out/types/page/Page.js.map +1 -1
- package/out/types/page/View.js +21 -0
- package/out/types/page/View.js.map +1 -1
- package/out/types/typeCheck.js +12 -2
- package/out/types/typeCheck.js.map +1 -1
- package/package.json +1 -1
- package/src/service/config/api.js +32 -0
- package/src/service/config/index.js +6 -0
- package/src/service/create/index.js +2 -2
- package/src/service/logic/logic.js +7 -0
- package/src/types/app/App.ts +13 -3
- package/src/types/app/Service.ts +44 -1
- package/src/types/config.ts +1 -0
- package/src/types/data/Entity.ts +15 -0
- package/src/types/data/EntityProperty.ts +5 -0
- package/src/types/data/Interface.ts +3 -1
- package/src/types/data/Structure.ts +10 -0
- package/src/types/data/dataTypes.ts +2 -2
- package/src/types/data/genBlock/builtInFunctions.json +17 -2
- package/src/types/data/genBlock/genCreateBlock.ts +4 -5
- package/src/types/data/genBlock/genListViewBlock.ts +1 -1
- package/src/types/data/genBlock/genTableBlock.ts +2 -2
- package/src/types/data/genBlock/genUpdateBlock.ts +4 -6
- package/src/types/data/genericTypes.ts +6 -2
- package/src/types/data/systemTypes.ts +73 -0
- package/src/types/logic/Logic.ts +35 -0
- package/src/types/logic/LogicItem.ts +304 -214
- package/src/types/logic/translator.js +64 -50
- package/src/types/page/Element.ts +20 -9
- package/src/types/page/Page.ts +7 -0
- package/src/types/page/View.ts +22 -0
- package/src/types/typeCheck.ts +16 -5
|
@@ -205,35 +205,42 @@ export default function (source) {
|
|
|
205
205
|
if (node.type === 'CallLogic') {
|
|
206
206
|
if (node.calleeCode.startsWith('callInterface_')) {
|
|
207
207
|
const getParams = (key) => {
|
|
208
|
-
//
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
208
|
+
// 增加参数拼接日志信息
|
|
209
|
+
try {
|
|
210
|
+
// 过滤掉 null 的 param
|
|
211
|
+
const nodeParams = (node.params || []).filter((param) => param !== null && param !== 'null' && param !== '');
|
|
212
|
+
if (key === 'body') {
|
|
213
|
+
let inBody = '';
|
|
214
|
+
const bodyStr = [];
|
|
215
|
+
nodeParams.filter((t) => t.callInterParamValue)
|
|
216
|
+
.forEach((b) => {
|
|
217
|
+
const refTarget = Vertex.getVertexByRef(b.callInterParam);
|
|
218
|
+
if (refTarget.in === 'body') {
|
|
219
|
+
inBody = generateNode(b.callInterParamValue);
|
|
220
|
+
} else if (refTarget.in === '') {
|
|
221
|
+
bodyStr.push(`["${refTarget.name}"]: ${generateNode(b.callInterParamValue)}`);
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
return inBody || `{${bodyStr.join(',')}}`;
|
|
226
|
+
} else {
|
|
227
|
+
return nodeParams
|
|
228
|
+
.filter((param) => {
|
|
229
|
+
const refTarget = Vertex.getVertexByRef(param.callInterParam);
|
|
230
|
+
return refTarget && refTarget.in === key;
|
|
231
|
+
})
|
|
232
|
+
.map((param) => {
|
|
233
|
+
const refTarget = Vertex.getVertexByRef(param.callInterParam);
|
|
234
|
+
const callInterParamValue = nameToCodeForMemberExpression(param.callInterParamValue);
|
|
235
|
+
const value = generateNode(callInterParamValue);
|
|
236
|
+
|
|
237
|
+
return `${safeCodeAsKey(refTarget)}: ${value}`;
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
} catch (error) {
|
|
241
|
+
console.log('CallLogic calleeCode: ', node.calleeCode);
|
|
242
|
+
console.log('params type: ', key);
|
|
243
|
+
throw error;
|
|
237
244
|
}
|
|
238
245
|
};
|
|
239
246
|
const key = node.interfaceKey || node.callee || '';
|
|
@@ -264,30 +271,37 @@ export default function (source) {
|
|
|
264
271
|
const key = node.interfaceKey || '';
|
|
265
272
|
const arr = key.split('/');
|
|
266
273
|
const getParams = (key) => {
|
|
267
|
-
//
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
const
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
});
|
|
274
|
-
if (body) {
|
|
275
|
-
return generateNode(body.callInterParamValue);
|
|
276
|
-
}
|
|
277
|
-
return '{}';
|
|
278
|
-
} else {
|
|
279
|
-
return nodeParams
|
|
280
|
-
.filter((param) => {
|
|
274
|
+
// 增加参数拼接日志信息
|
|
275
|
+
try {
|
|
276
|
+
// 过滤掉 null 的 param
|
|
277
|
+
const nodeParams = (node.params || []).filter((param) => param !== null && param !== 'null' && param !== '');
|
|
278
|
+
if (key === 'body') {
|
|
279
|
+
const body = (nodeParams || []).find((param) => {
|
|
281
280
|
const refTarget = Vertex.getVertexByRef(param.callInterParam);
|
|
282
281
|
return refTarget && refTarget.in === key;
|
|
283
|
-
})
|
|
284
|
-
.map((param) => {
|
|
285
|
-
const refTarget = Vertex.getVertexByRef(param.callInterParam);
|
|
286
|
-
const callInterParamValue = nameToCodeForMemberExpression(param.callInterParamValue);
|
|
287
|
-
const value = generateNode(callInterParamValue);
|
|
288
|
-
|
|
289
|
-
return `${safeCodeAsKey(refTarget)}: ${value}`;
|
|
290
282
|
});
|
|
283
|
+
if (body) {
|
|
284
|
+
return generateNode(body.callInterParamValue);
|
|
285
|
+
}
|
|
286
|
+
return '{}';
|
|
287
|
+
} else {
|
|
288
|
+
return nodeParams
|
|
289
|
+
.filter((param) => {
|
|
290
|
+
const refTarget = Vertex.getVertexByRef(param.callInterParam);
|
|
291
|
+
return refTarget && refTarget.in === key;
|
|
292
|
+
})
|
|
293
|
+
.map((param) => {
|
|
294
|
+
const refTarget = Vertex.getVertexByRef(param.callInterParam);
|
|
295
|
+
const callInterParamValue = nameToCodeForMemberExpression(param.callInterParamValue);
|
|
296
|
+
const value = generateNode(callInterParamValue);
|
|
297
|
+
|
|
298
|
+
return `${safeCodeAsKey(refTarget)}: ${value}`;
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
} catch (error) {
|
|
302
|
+
console.log('CallInterface interfaceKey: ', node.interfaceKey);
|
|
303
|
+
console.log('params type: ', key);
|
|
304
|
+
throw error;
|
|
291
305
|
}
|
|
292
306
|
};
|
|
293
307
|
|
|
@@ -1036,15 +1036,26 @@ export class Element extends Vertex {
|
|
|
1036
1036
|
}
|
|
1037
1037
|
} else {
|
|
1038
1038
|
const expression = <ExpressionNode> this._parseExpression(directive.value, context);
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1039
|
+
if(!expression || expression.type === 'StringLiteral') { // 处理类似情况:v-auth="''",v-tooltip="''"
|
|
1040
|
+
element.directiveList.push(Directive.from({
|
|
1041
|
+
type: 'string',
|
|
1042
|
+
name: directive.name,
|
|
1043
|
+
rawName: directive.rawName,
|
|
1044
|
+
value: directive.value && directive.value.replace(/'/g, ''),
|
|
1045
|
+
arg: directive.arg,
|
|
1046
|
+
modifiers: directive.modifiers,
|
|
1047
|
+
}, element));
|
|
1048
|
+
} else {
|
|
1049
|
+
element.directiveList.push(Directive.from({
|
|
1050
|
+
type: 'dynamic',
|
|
1051
|
+
name: directive.name,
|
|
1052
|
+
rawName: directive.rawName,
|
|
1053
|
+
value: '',
|
|
1054
|
+
expression,
|
|
1055
|
+
arg: directive.arg,
|
|
1056
|
+
modifiers: directive.modifiers,
|
|
1057
|
+
}, element));
|
|
1058
|
+
}
|
|
1048
1059
|
}
|
|
1049
1060
|
});
|
|
1050
1061
|
|
package/src/types/page/Page.ts
CHANGED
|
@@ -107,6 +107,9 @@ export class Page extends Vertex {
|
|
|
107
107
|
path: {
|
|
108
108
|
id: this.id,
|
|
109
109
|
},
|
|
110
|
+
headers: {
|
|
111
|
+
'request-lcpAppId': this.service.appId,
|
|
112
|
+
},
|
|
110
113
|
});
|
|
111
114
|
this.assign(result);
|
|
112
115
|
|
|
@@ -174,6 +177,7 @@ export class Page extends Vertex {
|
|
|
174
177
|
appId: config.defaultApp?.id,
|
|
175
178
|
operationAction: actionOptions?.actionName || 'Page.create',
|
|
176
179
|
operationDesc: actionOptions?.actionDesc || `添加页面"${this.name}${this.title ? `(${this.title})` : ''}"`,
|
|
180
|
+
'request-lcpAppId': this.service.appId,
|
|
177
181
|
},
|
|
178
182
|
body,
|
|
179
183
|
}).catch(catchFn());
|
|
@@ -233,6 +237,7 @@ export class Page extends Vertex {
|
|
|
233
237
|
appId: config.defaultApp?.id,
|
|
234
238
|
operationAction: actionOptions?.actionName || 'Page.create',
|
|
235
239
|
operationDesc: actionOptions?.actionDesc || `添加页面"${this.name}${this.title ? `(${this.title})` : ''}"`,
|
|
240
|
+
'request-lcpAppId': this.service.appId,
|
|
236
241
|
},
|
|
237
242
|
body,
|
|
238
243
|
});
|
|
@@ -268,6 +273,7 @@ export class Page extends Vertex {
|
|
|
268
273
|
appId: config.defaultApp?.id,
|
|
269
274
|
operationAction: actionOptions?.actionName || 'Page.delete',
|
|
270
275
|
operationDesc: actionOptions?.actionDesc || `删除页面"${this.name}${this.title ? `(${this.title})` : ''}"`,
|
|
276
|
+
'request-lcpAppId': this.service.appId,
|
|
271
277
|
},
|
|
272
278
|
path: {
|
|
273
279
|
id: this.id,
|
|
@@ -295,6 +301,7 @@ export class Page extends Vertex {
|
|
|
295
301
|
appId: config.defaultApp?.id,
|
|
296
302
|
operationAction: actionOptions?.actionName || 'Page.delete',
|
|
297
303
|
operationDesc: actionOptions?.actionDesc || `修改页面"${this.name}${this.title ? `(${this.title})` : ''}"`,
|
|
304
|
+
'request-lcpAppId': this.service.appId,
|
|
298
305
|
},
|
|
299
306
|
body,
|
|
300
307
|
}).catch(catchFn());
|
package/src/types/page/View.ts
CHANGED
|
@@ -189,6 +189,7 @@ export class View extends Block {
|
|
|
189
189
|
if (this.contentPromise)
|
|
190
190
|
return this.contentPromise;
|
|
191
191
|
|
|
192
|
+
|
|
192
193
|
return this.contentPromise = (async () => {
|
|
193
194
|
try {
|
|
194
195
|
const result: View = await viewService.load({
|
|
@@ -198,6 +199,9 @@ export class View extends Block {
|
|
|
198
199
|
query: {
|
|
199
200
|
enableCache,
|
|
200
201
|
},
|
|
202
|
+
headers: {
|
|
203
|
+
'request-lcpAppId': this.page.service.appId, // generator调用时需要appId headers
|
|
204
|
+
},
|
|
201
205
|
});
|
|
202
206
|
|
|
203
207
|
const $def = result.$def;
|
|
@@ -237,6 +241,9 @@ export class View extends Block {
|
|
|
237
241
|
enableCache,
|
|
238
242
|
},
|
|
239
243
|
config: { noErrorTip: true },
|
|
244
|
+
headers: {
|
|
245
|
+
'request-lcpAppId': this.page.service.appId,
|
|
246
|
+
},
|
|
240
247
|
});
|
|
241
248
|
const oldLogics = this.$def.logics;
|
|
242
249
|
Object.assign(result, {
|
|
@@ -357,6 +364,9 @@ export class View extends Block {
|
|
|
357
364
|
appId: config.defaultApp?.id,
|
|
358
365
|
operationAction: actionOptions?.actionName || 'View.create',
|
|
359
366
|
operationDesc: actionOptions?.actionDesc || `添加子页面"${this.name}${this.title ? `(${this.title})` : ''}"`,
|
|
367
|
+
headers: {
|
|
368
|
+
'request-lcpAppId': this.page ? this.page.service.appId : this.parent.page.service.appId,
|
|
369
|
+
},
|
|
360
370
|
},
|
|
361
371
|
body,
|
|
362
372
|
}).catch(catchFn());
|
|
@@ -411,6 +421,9 @@ export class View extends Block {
|
|
|
411
421
|
appId: config.defaultApp?.id,
|
|
412
422
|
operationAction: actionOptions?.actionName || 'View.create',
|
|
413
423
|
operationDesc: actionOptions?.actionDesc || `添加子页面"${this.name}${this.title ? `(${this.title})` : ''}"`,
|
|
424
|
+
headers: {
|
|
425
|
+
'request-lcpAppId': this.page.service.appId,
|
|
426
|
+
},
|
|
414
427
|
},
|
|
415
428
|
body,
|
|
416
429
|
});
|
|
@@ -445,6 +458,9 @@ export class View extends Block {
|
|
|
445
458
|
appId: config.defaultApp?.id,
|
|
446
459
|
operationAction: actionOptions?.actionName || 'View.delete',
|
|
447
460
|
operationDesc: actionOptions?.actionDesc || `删除子页面"${this.name}${this.title ? `(${this.title})` : ''}"`,
|
|
461
|
+
headers: {
|
|
462
|
+
'request-lcpAppId': this.page.service.appId,
|
|
463
|
+
},
|
|
448
464
|
},
|
|
449
465
|
path: {
|
|
450
466
|
id: this.id,
|
|
@@ -479,6 +495,9 @@ export class View extends Block {
|
|
|
479
495
|
appId: config.defaultApp?.id,
|
|
480
496
|
operationAction: actionOptions?.actionName || 'View.update',
|
|
481
497
|
operationDesc: actionOptions?.actionDesc || `修改子页面"${this.name}${this.title ? `(${this.title})` : ''}"`,
|
|
498
|
+
headers: {
|
|
499
|
+
'request-lcpAppId': this.page.service.appId,
|
|
500
|
+
},
|
|
482
501
|
},
|
|
483
502
|
body,
|
|
484
503
|
}).catch(catchFn());
|
|
@@ -960,6 +979,9 @@ export class View extends Block {
|
|
|
960
979
|
appId: config.defaultApp?.id,
|
|
961
980
|
operationAction: 'View.mergeBlock',
|
|
962
981
|
operationDesc: '根据实体自动生成组件和逻辑',
|
|
982
|
+
headers: {
|
|
983
|
+
'request-lcpAppId': this.page.service.appId,
|
|
984
|
+
},
|
|
963
985
|
},
|
|
964
986
|
});
|
|
965
987
|
|
package/src/types/typeCheck.ts
CHANGED
|
@@ -25,14 +25,19 @@ export default {
|
|
|
25
25
|
push(record: TypeCheckRecord) {
|
|
26
26
|
const pos = this.deleteOwn(record.id);
|
|
27
27
|
|
|
28
|
-
if(record.typeCheckNote?.message?.filter)
|
|
28
|
+
if (record.typeCheckNote?.message?.filter)
|
|
29
29
|
record.typeCheckNote.message = record.typeCheckNote.message.filter((item) => !!item);
|
|
30
30
|
|
|
31
|
-
if(!record.typeCheckNote || record.typeCheckNote.status === 'success'
|
|
32
|
-
|| (record.typeCheckNote && record.typeCheckNote.message && record.typeCheckNote.message.length === 0))
|
|
31
|
+
if (!record.typeCheckNote || record.typeCheckNote.status === 'success')
|
|
33
32
|
return;
|
|
33
|
+
// typeCheckNote.message 不存在时,视为误报
|
|
34
|
+
if (record.typeCheckNote && record.typeCheckNote.status !== 'success'
|
|
35
|
+
&& (!record.typeCheckNote.message || record.typeCheckNote.message.length === 0)) {
|
|
36
|
+
console.error('typeCheckNote 异常数据', record);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
34
39
|
|
|
35
|
-
if(pos === -1)
|
|
40
|
+
if (pos === -1)
|
|
36
41
|
this.records.unshift(record);
|
|
37
42
|
else
|
|
38
43
|
this.records.splice(pos, 0, record);
|
|
@@ -97,13 +102,19 @@ export default {
|
|
|
97
102
|
if ((record as any)['cases']) {
|
|
98
103
|
for (const rec of (record as any)['cases']) {
|
|
99
104
|
this.pushAll(rec.consequent, { processComponentId, logicId });
|
|
105
|
+
if(rec.test && rec.test.id)
|
|
106
|
+
this.pushAll([rec.test], { processComponentId, logicId });
|
|
100
107
|
}
|
|
101
108
|
}
|
|
102
109
|
|
|
110
|
+
if ((record as any)['test']) {
|
|
111
|
+
this.pushAll([(record as any)['test']], { processComponentId, logicId });
|
|
112
|
+
}
|
|
113
|
+
|
|
103
114
|
if ((record as any)['right'] &&
|
|
104
115
|
(record as any)['right'].level === 'logicNode') {
|
|
105
116
|
this.pushAll([(record as any)['right']], { processComponentId, logicId });
|
|
106
117
|
}
|
|
107
118
|
}
|
|
108
119
|
},
|
|
109
|
-
};
|
|
120
|
+
};
|