@lcap/nasl 2.22.0-beta.0 → 2.22.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/automate/engine/operators.d.ts +9 -0
- package/out/automate/engine/viewCache.d.ts +1 -0
- package/out/automate/template/myProcess.d.ts +1 -0
- package/out/common/BaseNode.d.ts +1 -0
- package/out/common/BaseNode.js +7 -1
- package/out/common/BaseNode.js.map +1 -1
- package/out/common/Command.d.ts +1 -1
- package/out/common/EventEmitter.d.ts +1 -1
- package/out/concepts/Abort__.js.map +1 -1
- package/out/concepts/Anchor__.js.map +1 -1
- package/out/concepts/AnonymousFunction__.js.map +1 -1
- package/out/concepts/App__.d.ts +22 -0
- package/out/concepts/App__.js +78 -12
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/Assignee__.js.map +1 -1
- package/out/concepts/AssignmentLine__.js.map +1 -1
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/Attribute__.js.map +1 -1
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BindStyle__.js.map +1 -1
- package/out/concepts/BooleanLiteral__.js.map +1 -1
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.js +9 -1
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.js +2 -1
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts +2 -0
- package/out/concepts/CallQueryComponent__.js +76 -24
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/CompletionProperty__.js.map +1 -1
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigPropertyValue__.js.map +1 -1
- package/out/concepts/ConfigProperty__.d.ts +4 -0
- package/out/concepts/ConfigProperty__.js +18 -1
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/DataElement__.js.map +1 -1
- package/out/concepts/DataSource__.js.map +1 -1
- package/out/concepts/DatabaseTypeAnnotation__.js.map +1 -1
- package/out/concepts/Destination__.js +2 -2
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityIndex__.d.ts +1 -1
- package/out/concepts/EntityIndex__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +7 -2
- package/out/concepts/EntityProperty__.js +100 -1
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +2 -1
- package/out/concepts/Entity__.js +30 -1
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/EnumItem__.js.map +1 -1
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/ExternalDestination__.js.map +1 -1
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/FrontendLibrary__.js.map +1 -1
- package/out/concepts/Frontend__.js.map +1 -1
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.js +7 -0
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.js +2 -2
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/Integration__.d.ts +53 -0
- package/out/concepts/Integration__.js +143 -0
- package/out/concepts/Integration__.js.map +1 -0
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/JSBlock__.js.map +1 -1
- package/out/concepts/JavaLogic__.d.ts +42 -0
- package/out/concepts/JavaLogic__.js +122 -0
- package/out/concepts/JavaLogic__.js.map +1 -0
- package/out/concepts/LogicItem__.d.ts +1 -1
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.js +12 -7
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/Match__.js +11 -6
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/MemberExpression__.js +1 -1
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/MicroApp__.d.ts +51 -0
- package/out/concepts/MicroApp__.js +113 -0
- package/out/concepts/MicroApp__.js.map +1 -0
- package/out/concepts/Module__.d.ts +20 -9
- package/out/concepts/Module__.js +72 -14
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/NewComposite__.d.ts +1 -1
- package/out/concepts/NewComposite__.js +25 -11
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/NewList__.js.map +1 -1
- package/out/concepts/NewMap__.js.map +1 -1
- package/out/concepts/New__.js.map +1 -1
- package/out/concepts/NullLiteral__.js.map +1 -1
- package/out/concepts/NumericLiteral__.js.map +1 -1
- package/out/concepts/OqlQueryComponent__.js +1 -1
- package/out/concepts/OqlQueryComponent__.js.map +1 -1
- package/out/concepts/Param__.d.ts +1 -0
- package/out/concepts/Param__.js +5 -0
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/Point__.js.map +1 -1
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessOutcome__.js.map +1 -1
- package/out/concepts/ProcessOutcomes__.js.map +1 -1
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryAggregateExpression__.js.map +1 -1
- package/out/concepts/QueryFieldExpression__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryGroupByExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QueryLimitExpression__.js.map +1 -1
- package/out/concepts/QueryOrderByExpression__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.d.ts +104 -16
- package/out/concepts/QuerySelectExpression__.js +99 -9
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Rect__.js.map +1 -1
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/Role__.js.map +1 -1
- package/out/concepts/SelectMembers__.js.map +1 -1
- package/out/concepts/Slot__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/Start__.js.map +1 -1
- package/out/concepts/StringInterpolation__.js.map +1 -1
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.js +2 -2
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/Theme__.js.map +1 -1
- package/out/concepts/Transactional__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.js +8 -3
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/TypeParam__.js.map +1 -1
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/Unparsed__.js.map +1 -1
- package/out/concepts/UseComponent__.js.map +1 -1
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewBlock__.js.map +1 -1
- package/out/concepts/ViewComponent__.js.map +1 -1
- package/out/concepts/ViewElement__.js +26 -6
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +1 -1
- package/out/concepts/View__.js +3 -1
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.ui.js +15 -0
- package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.util.js +94 -0
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/concepts/index__.d.ts +3 -0
- package/out/concepts/index__.js +3 -0
- package/out/concepts/index__.js.map +1 -1
- package/out/config.d.ts +1 -1
- package/out/decorators/index.d.ts +2 -2
- package/out/generator/genBundleFiles.js +20 -3
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genReleaseBody.js +2 -2
- package/out/generator/genReleaseBody.js.map +1 -1
- package/out/generator/icestark.d.ts +2 -0
- package/out/generator/icestark.js +48 -0
- package/out/generator/icestark.js.map +1 -0
- package/out/generator/microApp.d.ts +2 -0
- package/out/generator/microApp.js +35 -0
- package/out/generator/microApp.js.map +1 -0
- package/out/generator/permission.d.ts +1 -1
- package/out/generator/permission.js +0 -13
- package/out/generator/permission.js.map +1 -1
- package/out/generator/qiankun.d.ts +2 -0
- package/out/generator/qiankun.js +52 -0
- package/out/generator/qiankun.js.map +1 -0
- package/out/index.d.ts +1 -0
- package/out/index.js +1 -0
- package/out/index.js.map +1 -1
- package/out/manager/stepRecorder.d.ts +20 -0
- package/out/manager/stepRecorder.js +110 -0
- package/out/manager/stepRecorder.js.map +1 -0
- package/out/sentry/index.d.ts +5 -4
- package/out/sentry/index.js +9 -2
- package/out/sentry/index.js.map +1 -1
- package/out/server/formatTsUtils.d.ts +1 -1
- package/out/server/formatTsUtils.js +40 -14
- package/out/server/formatTsUtils.js.map +1 -1
- package/out/server/getLogics.js +38 -6
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.js +5 -4
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/getProcesses.d.ts +3 -3
- package/out/server/getScope.d.ts +1 -1
- package/out/server/naslServer.d.ts +7 -3
- package/out/server/naslServer.js +270 -102
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js +25 -7
- package/out/server/translator.js.map +1 -1
- package/out/service/storage/init.d.ts +3 -3
- package/out/service/storage/init.js +6 -0
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCreateBlock.js +6 -1
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genQueryComponent.js +20 -6
- package/out/templator/genQueryComponent.js.map +1 -1
- package/out/templator/genUpdateBlock.js +7 -1
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/utils.d.ts +16 -0
- package/out/templator/utils.js +2 -0
- package/out/templator/utils.js.map +1 -1
- package/out/translator/index.d.ts +1 -1
- package/out/translator/lsp.d.ts +3 -3
- package/out/utils/index.d.ts +4 -4
- package/package.json +1 -1
- package/sandbox/stdlib/nasl.ui.ts +16 -11
- package/sandbox/stdlib/nasl.util.ts +4 -0
- package/sandbox/stdlib/nasl.validation.ts +2 -2
- package/src/automate/upgrader/2.17.js +1 -1
- package/src/common/BaseNode.ts +10 -2
- package/src/concepts/App__.ts +90 -46
- package/src/concepts/CallInterface__.ts +9 -1
- package/src/concepts/CallLogic__.ts +2 -1
- package/src/concepts/CallQueryComponent__.ts +73 -82
- package/src/concepts/ConfigProperty__.ts +18 -1
- package/src/concepts/Destination__.ts +2 -20
- package/src/concepts/EntityProperty__.ts +102 -8
- package/src/concepts/Entity__.ts +31 -8
- package/src/concepts/Identifier__.ts +9 -2
- package/src/concepts/IfStatement__.ts +2 -2
- package/src/concepts/Integration__.ts +162 -0
- package/src/concepts/JavaLogic__.ts +129 -0
- package/src/concepts/LogicItem__.ts +1 -1
- package/src/concepts/Logic__.ts +12 -45
- package/src/concepts/Match__.ts +10 -5
- package/src/concepts/MemberExpression__.ts +1 -1
- package/src/concepts/MicroApp__.ts +118 -0
- package/src/concepts/Module__.ts +106 -79
- package/src/concepts/NewComposite__.ts +23 -11
- package/src/concepts/OqlQueryComponent__.ts +1 -1
- package/src/concepts/Param__.ts +3 -0
- package/src/concepts/QueryFieldExpression__.ts +0 -7
- package/src/concepts/QuerySelectExpression__.ts +206 -30
- package/src/concepts/SwitchCase__.ts +2 -2
- package/src/concepts/TypeAnnotation__.ts +8 -42
- package/src/concepts/ViewElement__.ts +24 -6
- package/src/concepts/View__.ts +3 -24
- package/src/concepts/basics/stdlib/nasl.ui.ts +15 -0
- package/src/concepts/basics/stdlib/nasl.util.ts +94 -0
- package/src/concepts/index__.ts +3 -0
- package/src/generator/genBundleFiles.ts +22 -4
- package/src/generator/genReleaseBody.ts +2 -2
- package/src/generator/icestark.ts +45 -0
- package/src/generator/microApp.ts +32 -0
- package/src/generator/permission.ts +1 -15
- package/src/generator/qiankun.ts +49 -0
- package/src/index.ts +1 -0
- package/src/manager/stepRecorder.ts +112 -0
- package/src/sentry/index.ts +8 -2
- package/src/server/formatTsUtils.ts +42 -14
- package/src/server/getLogics.ts +41 -6
- package/src/server/getMemberIdentifier.ts +5 -4
- package/src/server/naslServer.ts +270 -101
- package/src/server/translator.ts +25 -7
- package/src/service/storage/init.ts +7 -0
- package/src/templator/genCreateBlock.ts +6 -1
- package/src/templator/genQueryComponent.ts +22 -8
- package/src/templator/genUpdateBlock.ts +7 -1
- package/src/templator/utils.ts +2 -0
- package/ts-worker/src/index.js +1 -4
- package/src/manager/history.ts +0 -0
- package/src/manager/problem.ts +0 -0
package/src/concepts/View__.ts
CHANGED
|
@@ -269,8 +269,6 @@ export class View extends BaseNode {
|
|
|
269
269
|
});
|
|
270
270
|
}
|
|
271
271
|
|
|
272
|
-
|
|
273
|
-
|
|
274
272
|
/**
|
|
275
273
|
* 插入页面元素
|
|
276
274
|
* @internal
|
|
@@ -404,7 +402,6 @@ export class View extends BaseNode {
|
|
|
404
402
|
return node;
|
|
405
403
|
}
|
|
406
404
|
|
|
407
|
-
|
|
408
405
|
getParamUniqueName(name = 'param1') {
|
|
409
406
|
return utils.unique(name, this.getVarExistingNames(), undefined, false);
|
|
410
407
|
}
|
|
@@ -542,7 +539,6 @@ export class View extends BaseNode {
|
|
|
542
539
|
return node;
|
|
543
540
|
}
|
|
544
541
|
|
|
545
|
-
|
|
546
542
|
getVariableUniqueName(name = 'variable1') {
|
|
547
543
|
return utils.unique(name, this.getVarExistingNames(), undefined, false);
|
|
548
544
|
}
|
|
@@ -680,7 +676,6 @@ export class View extends BaseNode {
|
|
|
680
676
|
return node;
|
|
681
677
|
}
|
|
682
678
|
|
|
683
|
-
|
|
684
679
|
getLogicUniqueName(name = 'logic1') {
|
|
685
680
|
return utils.unique(name, this.getLogicExistingNames(), undefined, false);
|
|
686
681
|
}
|
|
@@ -818,7 +813,6 @@ export class View extends BaseNode {
|
|
|
818
813
|
return node;
|
|
819
814
|
}
|
|
820
815
|
|
|
821
|
-
|
|
822
816
|
getBindEventExistingNames(excludedList: Array<BindEvent> = []) {
|
|
823
817
|
const excludedSet = new Set(excludedList);
|
|
824
818
|
return ((this.bindEvents as BindEvent[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
@@ -960,9 +954,6 @@ export class View extends BaseNode {
|
|
|
960
954
|
return node;
|
|
961
955
|
}
|
|
962
956
|
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
957
|
getViewExistingNames(excludedList: Array<View> = []) {
|
|
967
958
|
const excludedSet = new Set(excludedList);
|
|
968
959
|
return ((this.children as View[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
@@ -1104,9 +1095,6 @@ export class View extends BaseNode {
|
|
|
1104
1095
|
return node;
|
|
1105
1096
|
}
|
|
1106
1097
|
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
1098
|
/**
|
|
1111
1099
|
* 删除页面元素
|
|
1112
1100
|
* @param name 页面元素名称
|
|
@@ -1155,8 +1143,6 @@ export class View extends BaseNode {
|
|
|
1155
1143
|
return params;
|
|
1156
1144
|
}
|
|
1157
1145
|
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
1146
|
/**
|
|
1161
1147
|
* 删除输入参数
|
|
1162
1148
|
* @param name 输入参数名称
|
|
@@ -1205,8 +1191,6 @@ export class View extends BaseNode {
|
|
|
1205
1191
|
return params;
|
|
1206
1192
|
}
|
|
1207
1193
|
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
1194
|
/**
|
|
1211
1195
|
* 删除变量
|
|
1212
1196
|
* @param name 变量名称
|
|
@@ -1255,8 +1239,6 @@ export class View extends BaseNode {
|
|
|
1255
1239
|
return params;
|
|
1256
1240
|
}
|
|
1257
1241
|
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
1242
|
/**
|
|
1261
1243
|
* 删除逻辑
|
|
1262
1244
|
* @param name 逻辑名称
|
|
@@ -1305,8 +1287,6 @@ export class View extends BaseNode {
|
|
|
1305
1287
|
return params;
|
|
1306
1288
|
}
|
|
1307
1289
|
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
1290
|
/**
|
|
1311
1291
|
* 删除元素绑定事件
|
|
1312
1292
|
* @param name 元素绑定事件名称
|
|
@@ -1355,8 +1335,6 @@ export class View extends BaseNode {
|
|
|
1355
1335
|
return params;
|
|
1356
1336
|
}
|
|
1357
1337
|
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
1338
|
/**
|
|
1361
1339
|
* 删除页面
|
|
1362
1340
|
* @param name 页面名称
|
|
@@ -1489,9 +1467,9 @@ export class View extends BaseNode {
|
|
|
1489
1467
|
}
|
|
1490
1468
|
const definitionStr = utils.sliceTagContent(code, 'definition') || '{}';
|
|
1491
1469
|
const definition: any = JSON.parse(definitionStr);
|
|
1492
|
-
|
|
1470
|
+
let node = null;
|
|
1493
1471
|
if (template) {
|
|
1494
|
-
|
|
1472
|
+
node = ViewElement.fromHTML(template, {
|
|
1495
1473
|
view: this,
|
|
1496
1474
|
definition,
|
|
1497
1475
|
});
|
|
@@ -1584,6 +1562,7 @@ export class View extends BaseNode {
|
|
|
1584
1562
|
}
|
|
1585
1563
|
});
|
|
1586
1564
|
}
|
|
1565
|
+
return node;
|
|
1587
1566
|
}
|
|
1588
1567
|
|
|
1589
1568
|
onChange($event?: EventPayload): void {
|
|
@@ -921,6 +921,21 @@ export const uiStructures = [
|
|
|
921
921
|
}),
|
|
922
922
|
],
|
|
923
923
|
}),
|
|
924
|
+
new Structure({
|
|
925
|
+
name: 'ExpandEvent',
|
|
926
|
+
properties: [
|
|
927
|
+
new StructureProperty({
|
|
928
|
+
name: 'item',
|
|
929
|
+
description: '展开项相关对象',
|
|
930
|
+
typeAnnotation: TypeAnnotation.createPrimitive('String'),
|
|
931
|
+
}),
|
|
932
|
+
new StructureProperty({
|
|
933
|
+
name: 'expanded',
|
|
934
|
+
description: '展开状态值',
|
|
935
|
+
typeAnnotation: TypeAnnotation.createPrimitive('Boolean'),
|
|
936
|
+
}),
|
|
937
|
+
],
|
|
938
|
+
}),
|
|
924
939
|
];
|
|
925
940
|
|
|
926
941
|
export const uiTypeList: Array<TypeAnnotation> = reference2TypeAnnotationList(uiStructures, 'nasl.ui');
|
|
@@ -14,6 +14,7 @@ import BooleanLiteral from '../../BooleanLiteral__';
|
|
|
14
14
|
import StringLiteral from '../../StringLiteral__';
|
|
15
15
|
import AnonymousFunction from '../../AnonymousFunction__';
|
|
16
16
|
import StringInterpolation from '../../StringInterpolation__';
|
|
17
|
+
import NewList from '../../NewList__';
|
|
17
18
|
|
|
18
19
|
export default new Namespace({
|
|
19
20
|
name: 'util',
|
|
@@ -1230,6 +1231,99 @@ export default new Namespace({
|
|
|
1230
1231
|
}),
|
|
1231
1232
|
],
|
|
1232
1233
|
}),
|
|
1234
|
+
new Function({
|
|
1235
|
+
name: 'GetDateCount',
|
|
1236
|
+
description: '按指定维度计算日期,如“所在年-第几周”',
|
|
1237
|
+
params: [
|
|
1238
|
+
new Param({
|
|
1239
|
+
name: '指定日期',
|
|
1240
|
+
description: '将被计算的日期',
|
|
1241
|
+
typeAnnotation: TypeAnnotation.createPrimitive('DateTime'),
|
|
1242
|
+
}),
|
|
1243
|
+
new Param({
|
|
1244
|
+
name: '根据指定日期计算',
|
|
1245
|
+
description: '获取指定日期的特定信息,如是其所在年的第几天',
|
|
1246
|
+
typeAnnotation: TypeAnnotation.createPrimitive('String'),
|
|
1247
|
+
defaultValue: 'week-year',
|
|
1248
|
+
defaultExpression: new StringLiteral({ value: 'week-year' }),
|
|
1249
|
+
cascader: true,
|
|
1250
|
+
}),
|
|
1251
|
+
],
|
|
1252
|
+
}),
|
|
1253
|
+
new Function({
|
|
1254
|
+
name: 'AlterDateTime',
|
|
1255
|
+
description: '为指定日期时间调整增加(减少)时间',
|
|
1256
|
+
params: [
|
|
1257
|
+
new Param({
|
|
1258
|
+
name: '指定日期时间',
|
|
1259
|
+
description: '将被更改的日期时间或日期',
|
|
1260
|
+
typeAnnotation: TypeAnnotation.createPrimitive('DateTime'),
|
|
1261
|
+
}),
|
|
1262
|
+
new Param({
|
|
1263
|
+
name: '调整',
|
|
1264
|
+
description: '为指定的日期时间增加或减少指定的数量,只能填整数',
|
|
1265
|
+
typeAnnotation: TypeAnnotation.createPrimitive('String'),
|
|
1266
|
+
defaultValue: 'Increase',
|
|
1267
|
+
defaultExpression: new StringLiteral({ value: 'Increase' }),
|
|
1268
|
+
options: [
|
|
1269
|
+
{ text: '增加', value: 'Increase' },
|
|
1270
|
+
{ text: '减少', value: 'Decrease' },
|
|
1271
|
+
],
|
|
1272
|
+
}),
|
|
1273
|
+
new Param({
|
|
1274
|
+
name: 'amount',
|
|
1275
|
+
typeAnnotation: TypeAnnotation.createPrimitive('Long'),
|
|
1276
|
+
defaultExpression: new NumericLiteral({ value: '0' }),
|
|
1277
|
+
}),
|
|
1278
|
+
new Param({
|
|
1279
|
+
name: '计算数',
|
|
1280
|
+
typeAnnotation: TypeAnnotation.createPrimitive('String'),
|
|
1281
|
+
defaultValue: 'day',
|
|
1282
|
+
defaultExpression: new StringLiteral({ value: 'day' }),
|
|
1283
|
+
options: [
|
|
1284
|
+
{ text: '天', value: 'day' },
|
|
1285
|
+
{ text: '周', value: 'week' },
|
|
1286
|
+
{ text: '月', value: 'month' },
|
|
1287
|
+
{ text: '季度', value: 'quarter' },
|
|
1288
|
+
{ text: '年', value: 'year' },
|
|
1289
|
+
],
|
|
1290
|
+
}),
|
|
1291
|
+
],
|
|
1292
|
+
}),
|
|
1293
|
+
new Function({
|
|
1294
|
+
name: 'GetSpecificDaysOfWeek',
|
|
1295
|
+
description: '按“星期几”获取指定日期范围内的日子',
|
|
1296
|
+
params: [
|
|
1297
|
+
new Param({
|
|
1298
|
+
name: '起始',
|
|
1299
|
+
description: '起始日期(包含)',
|
|
1300
|
+
typeAnnotation: TypeAnnotation.createPrimitive('DateTime'),
|
|
1301
|
+
}),
|
|
1302
|
+
new Param({
|
|
1303
|
+
name: '结束',
|
|
1304
|
+
description: '结束日期(包含)',
|
|
1305
|
+
typeAnnotation: TypeAnnotation.createPrimitive('DateTime'),
|
|
1306
|
+
}),
|
|
1307
|
+
new Param({
|
|
1308
|
+
name: '指定',
|
|
1309
|
+
description: '指定的星期几,可多选',
|
|
1310
|
+
defaultExpression: new NewList({
|
|
1311
|
+
typeAnnotation: TypeAnnotation.createGeneric('List', {
|
|
1312
|
+
typeArguments: [TypeAnnotation.createPrimitive('Long')],
|
|
1313
|
+
}),
|
|
1314
|
+
}),
|
|
1315
|
+
options: [
|
|
1316
|
+
{ text: '星期一', value: '1' },
|
|
1317
|
+
{ text: '星期二', value: '2' },
|
|
1318
|
+
{ text: '星期三', value: '3' },
|
|
1319
|
+
{ text: '星期四', value: '4' },
|
|
1320
|
+
{ text: '星期五', value: '5' },
|
|
1321
|
+
{ text: '星期六', value: '6' },
|
|
1322
|
+
{ text: '星期日', value: '7' },
|
|
1323
|
+
],
|
|
1324
|
+
}),
|
|
1325
|
+
],
|
|
1326
|
+
}),
|
|
1233
1327
|
new Function({
|
|
1234
1328
|
name: 'Clone',
|
|
1235
1329
|
description: '复制一个所选参数的实例',
|
package/src/concepts/index__.ts
CHANGED
|
@@ -2,6 +2,8 @@ export * from './App__';
|
|
|
2
2
|
export * from './Module__';
|
|
3
3
|
export * from './Namespace__';
|
|
4
4
|
export * from './Frontend__';
|
|
5
|
+
export * from './Integration__';
|
|
6
|
+
export * from './MicroApp__';
|
|
5
7
|
export * from './TypeAnnotation__';
|
|
6
8
|
export * from './DatabaseTypeAnnotation__';
|
|
7
9
|
export * from './TypeParam__';
|
|
@@ -56,6 +58,7 @@ export * from './ValidationRule__';
|
|
|
56
58
|
export * from './Argument__';
|
|
57
59
|
export * from './Anchor__';
|
|
58
60
|
export * from './JSBlock__';
|
|
61
|
+
export * from './JavaLogic__';
|
|
59
62
|
export * from './Identifier__';
|
|
60
63
|
export * from './NullLiteral__';
|
|
61
64
|
export * from './BooleanLiteral__';
|
|
@@ -7,7 +7,7 @@ import * as JSON5 from 'json5';
|
|
|
7
7
|
import * as UglifyJS from 'uglify-js-export';
|
|
8
8
|
|
|
9
9
|
import { genMetaData } from './genMetaData';
|
|
10
|
-
|
|
10
|
+
import { integrateMicroApp } from './microApp';
|
|
11
11
|
export interface Route {
|
|
12
12
|
path?: string;
|
|
13
13
|
component?: RawOptions; // ExtendedVue<Vue, unknown, unknown, unknown, Record<never, any>>;
|
|
@@ -277,7 +277,18 @@ export function genBundleFiles(app: App, frontend: Frontend,
|
|
|
277
277
|
var metaData = ${metaDataStr};
|
|
278
278
|
var routes = ${routesStr};
|
|
279
279
|
|
|
280
|
-
window.createLcapApp = () =>
|
|
280
|
+
window.createLcapApp = () => {
|
|
281
|
+
appVM = window.cloudAdminDesigner.init(platformConfig.appConfig, platformConfig, routes, metaData);
|
|
282
|
+
|
|
283
|
+
try {
|
|
284
|
+
var push = appVM.$router.history.push;
|
|
285
|
+
appVM.$router.history.push = function (a, b) {
|
|
286
|
+
push.apply(this, [a, b, console.warn]);
|
|
287
|
+
};
|
|
288
|
+
} catch (e) { console.error(e) }
|
|
289
|
+
|
|
290
|
+
return window.appVM = appVM;
|
|
291
|
+
};
|
|
281
292
|
window.createLcapApp();
|
|
282
293
|
})();`;
|
|
283
294
|
|
|
@@ -364,9 +375,16 @@ export function genBundleFiles(app: App, frontend: Frontend,
|
|
|
364
375
|
bundleMinPath = `${baseUrl}${frontend.basePath}/bundle.${genHash(content)}.min.js`;
|
|
365
376
|
}
|
|
366
377
|
const otherJsList = (frontend as any)?.appletsConfig?.enable ? ['//res.wx.qq.com/open/js/jweixin-1.3.2.js'] : [];
|
|
378
|
+
|
|
379
|
+
const microAppIntegration = integrateMicroApp(frontend);
|
|
380
|
+
|
|
367
381
|
const assetsContent = `(function() {
|
|
368
|
-
|
|
369
|
-
|
|
382
|
+
const loadAssets = () => {
|
|
383
|
+
LazyLoad.js(${JSON5.stringify(assetsInfo.basic.js.concat(assetsInfo.custom.js, otherJsList).concat([bundleMinPath]))});
|
|
384
|
+
LazyLoad.css(${JSON5.stringify(assetsInfo.basic.css.concat(assetsInfo.custom.css))});
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
${microAppIntegration || 'loadAssets();'}
|
|
370
388
|
})()
|
|
371
389
|
`;
|
|
372
390
|
let minifyObj = { code: '' };
|
|
@@ -102,7 +102,7 @@ export async function genReleaseBody(app: App, {
|
|
|
102
102
|
|
|
103
103
|
// 打印传给服务端的nasl,为了服务端排查问题方便
|
|
104
104
|
if (globalThis.window) {
|
|
105
|
-
console.
|
|
105
|
+
console.info(NaslAnnotatedJSON, '标注后的nasl');
|
|
106
106
|
}
|
|
107
107
|
files.push({ name: 'nasl-annotated.json', content: jsonString });
|
|
108
108
|
|
|
@@ -210,7 +210,7 @@ function getAuthApiPathList(app: App, frontends: Array<Frontend>) {
|
|
|
210
210
|
return `/api/${_name}/${_path}:POST`;
|
|
211
211
|
}
|
|
212
212
|
} else {
|
|
213
|
-
return `/api/${logicName}:POST`;
|
|
213
|
+
return `/api/lcplogics/${logicName}:POST`;
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
function getName(name: string) {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export default `
|
|
2
|
+
if(window.ICESTARK?.root) {
|
|
3
|
+
Object.assign(window.ICESTARK, {
|
|
4
|
+
appEnter({ container, customProps }) {
|
|
5
|
+
window.LcapMicro = window.LcapMicro || {};
|
|
6
|
+
Object.assign(window.LcapMicro, {properties});
|
|
7
|
+
|
|
8
|
+
if(window.LcapMicro.noAuthUrl && !window.LcapMicro.noAuthFn)
|
|
9
|
+
window.LcapMicro.noAuthFn = () => {
|
|
10
|
+
location.href = window.LcapMicro.noAuthUrl;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
if(window.LcapMicro.loginUrl && !window.LcapMicro.loginFn)
|
|
14
|
+
window.LcapMicro.loginFn = () => {
|
|
15
|
+
location.href = window.LcapMicro.loginUrl;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
if(window.LcapMicro.notFoundUrl && !window.LcapMicro.notFoundFn)
|
|
19
|
+
window.LcapMicro.notFoundFn = () => {
|
|
20
|
+
location.href = window.LcapMicro.notFoundUrl;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// 兼容 ICESTARK 旧集成方式
|
|
24
|
+
if(!window.LcapMicro.loginFn)
|
|
25
|
+
window.LcapMicro.loginFn = window.ICESTARK.loginFn;
|
|
26
|
+
if(!window.LcapMicro.routePrefix)
|
|
27
|
+
window.LcapMicro.routePrefix = window.ICESTARK.basename;
|
|
28
|
+
if(!window.LcapMicro.proxyPrefix)
|
|
29
|
+
window.LcapMicro.proxyPrefix = window.ICESTARK.proxyPrefix;
|
|
30
|
+
|
|
31
|
+
window.LcapMicro.container = container;
|
|
32
|
+
window.LcapMicro.props = customProps;
|
|
33
|
+
loadAssets();
|
|
34
|
+
},
|
|
35
|
+
appLeave({ container }) {
|
|
36
|
+
container.innerHTML = null;
|
|
37
|
+
window.appVM?.$destroy();
|
|
38
|
+
document.querySelectorAll('script.lazyload').forEach((ele) => {
|
|
39
|
+
ele.active = false;
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
} else
|
|
44
|
+
loadAssets();
|
|
45
|
+
`;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import qiankun from './qiankun';
|
|
2
|
+
import icestark from './icestark';
|
|
3
|
+
import { App, Frontend } from '../concepts';
|
|
4
|
+
|
|
5
|
+
const framewords = {
|
|
6
|
+
qiankun, icestark,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export function integrateMicroApp(frontend: Frontend) {
|
|
10
|
+
if(frontend.type === 'h5') return '';
|
|
11
|
+
|
|
12
|
+
let { framework, name, routePrefix, proxyPrefix, loginUrl, noAuthUrl, notFoundUrl } = frontend.app.integration?.microApp || {};
|
|
13
|
+
if(!framework) framework = 'icestark'; // 兼容 ICESTARK 旧集成方式
|
|
14
|
+
|
|
15
|
+
if(loginUrl === `${routePrefix}${frontend.basePath}/login`)
|
|
16
|
+
loginUrl = undefined;
|
|
17
|
+
if(noAuthUrl === `${routePrefix}${frontend.basePath}/noAuth`)
|
|
18
|
+
noAuthUrl = undefined;
|
|
19
|
+
if(notFoundUrl === `${routePrefix}${frontend.basePath}/notFound`)
|
|
20
|
+
notFoundUrl = undefined;
|
|
21
|
+
|
|
22
|
+
const properties = JSON.stringify({
|
|
23
|
+
name: name || undefined,
|
|
24
|
+
routePrefix: routePrefix || undefined,
|
|
25
|
+
proxyPrefix: proxyPrefix || undefined,
|
|
26
|
+
loginUrl: loginUrl || undefined,
|
|
27
|
+
noAuthUrl: noAuthUrl || undefined,
|
|
28
|
+
notFoundUrl: notFoundUrl || undefined,
|
|
29
|
+
});
|
|
30
|
+
return framewords[framework].replace(/\{properties\}/g, properties);
|
|
31
|
+
}
|
|
32
|
+
|
|
@@ -115,8 +115,7 @@ function findResourcesOfUI(view: View | ViewElement) {
|
|
|
115
115
|
|
|
116
116
|
function optimizeResourceData(resources: ResourceNode[][]) {
|
|
117
117
|
let res = removeRedundantResourceData(resources);
|
|
118
|
-
|
|
119
|
-
return res;
|
|
118
|
+
return res
|
|
120
119
|
}
|
|
121
120
|
|
|
122
121
|
// [['b'], ['a' ,'b']] 只需要保留 [['b']]
|
|
@@ -144,19 +143,6 @@ function removeRedundantResourceData(resources: ResourceNode[][]) {
|
|
|
144
143
|
return res;
|
|
145
144
|
}
|
|
146
145
|
|
|
147
|
-
// 子页面有权限,父页面默认也有权限,所以不需要记录父页面权限;
|
|
148
|
-
// 组件有权限,组件所在的页面默认也有权限,所以不需要记录页面权限
|
|
149
|
-
function removeRedundantResourceData2(resources: ResourceNode[][]) {
|
|
150
|
-
return resources.map((resource) => {
|
|
151
|
-
if (resource.length <= 1)
|
|
152
|
-
return resource;
|
|
153
|
-
|
|
154
|
-
if (resource[0].type === 'page')
|
|
155
|
-
return resource.slice(0, 1);
|
|
156
|
-
else if (resource[0].type === 'component')
|
|
157
|
-
return resource.filter((item) => item.type === 'component');
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
146
|
|
|
161
147
|
async function findResourcesOfLogic(logic: Logic, uploaders: Map<string, ViewElement[]>) {
|
|
162
148
|
const logics = await findViewLogicReferences(logic);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export default `
|
|
2
|
+
if(window.__POWERED_BY_QIANKUN__) {
|
|
3
|
+
window.LcapMicro = window.LcapMicro || {};
|
|
4
|
+
Object.assign(window.LcapMicro, {properties});
|
|
5
|
+
|
|
6
|
+
window[window.LcapMicro.name] = {
|
|
7
|
+
bootstrap() {
|
|
8
|
+
return Promise.resolve();
|
|
9
|
+
},
|
|
10
|
+
mount(props) {
|
|
11
|
+
window.LcapMicro = window.LcapMicro || {};
|
|
12
|
+
Object.assign(window.LcapMicro, {properties});
|
|
13
|
+
|
|
14
|
+
if(window.LcapMicro.noAuthUrl && !window.LcapMicro.noAuthFn)
|
|
15
|
+
window.LcapMicro.noAuthFn = () => {
|
|
16
|
+
location.href = window.LcapMicro.noAuthUrl;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
if(window.LcapMicro.loginUrl && !window.LcapMicro.loginFn)
|
|
20
|
+
window.LcapMicro.loginFn = () => {
|
|
21
|
+
location.href = window.LcapMicro.loginUrl;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
if(window.LcapMicro.notFoundUrl && !window.LcapMicro.notFoundFn)
|
|
25
|
+
window.LcapMicro.notFoundFn = () => {
|
|
26
|
+
location.href = window.LcapMicro.notFoundUrl;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const { container } = props;
|
|
30
|
+
window.LcapMicro.container = container.querySelector('#app');
|
|
31
|
+
window.LcapMicro.props = props;
|
|
32
|
+
if(window.createLcapApp)
|
|
33
|
+
window.createLcapApp()
|
|
34
|
+
else
|
|
35
|
+
loadAssets();
|
|
36
|
+
return Promise.resolve();
|
|
37
|
+
},
|
|
38
|
+
unmount({ container }) {
|
|
39
|
+
window.LcapMicro.container.innerHTML = null;
|
|
40
|
+
window.appVM?.$destroy();
|
|
41
|
+
document.querySelectorAll('script.lazyload').forEach((ele) => {
|
|
42
|
+
ele.active = false;
|
|
43
|
+
})
|
|
44
|
+
return Promise.resolve();
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
} else
|
|
48
|
+
loadAssets();
|
|
49
|
+
`;
|
package/src/index.ts
CHANGED
|
@@ -10,4 +10,5 @@ export * from './config';
|
|
|
10
10
|
export * from './eventBus';
|
|
11
11
|
export { loadApp, loadAppSync, handleApp, batchAction, batchQuery } from './service/storage/init';
|
|
12
12
|
export { createService } from './service/creator';
|
|
13
|
+
export * from './manager/stepRecorder';
|
|
13
14
|
import './automate/engine';
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import format from 'date-fns/format';
|
|
2
|
+
|
|
3
|
+
export const stepRecorder = {
|
|
4
|
+
count: 0,
|
|
5
|
+
initialized: false,
|
|
6
|
+
init() {
|
|
7
|
+
this.count = this.getKeys().length;
|
|
8
|
+
|
|
9
|
+
const div = document.createElement('div');
|
|
10
|
+
div.id = 'recorder';
|
|
11
|
+
(div as any).style = 'position: fixed; top: -12px; right: 300px; z-index: 9999; background: #fffbd0; padding: 10px; border: 1px solid #ccc; border-radius: 5px;';
|
|
12
|
+
|
|
13
|
+
div.innerHTML = `<div><span style="color: red; font-size: 17px; vertical-align: -2px;">◉</span> 正在录制中…</div>
|
|
14
|
+
<div style="margin-top: -2px;">当前应用的操作步骤数:<span id="recorder-count">${this.count}</span></div>
|
|
15
|
+
<div style="margin-top: 4px;">
|
|
16
|
+
<button onclick="$data.nasl.stepRecorder.exportExcel()">下载数据</button>
|
|
17
|
+
</div>
|
|
18
|
+
`;
|
|
19
|
+
// <button onclick="$data.nasl.stepRecorder.clear()">清除数据</button>
|
|
20
|
+
document.body.appendChild(div);
|
|
21
|
+
|
|
22
|
+
const script = document.createElement('script');
|
|
23
|
+
script.src = 'https://cdnjs.cloudflare.com/ajax/libs/xlsx-populate/1.21.0/xlsx-populate.min.js';
|
|
24
|
+
document.body.appendChild(script);
|
|
25
|
+
|
|
26
|
+
this.initialized = true;
|
|
27
|
+
},
|
|
28
|
+
clear() {
|
|
29
|
+
// eslint-disable-next-line no-alert
|
|
30
|
+
const result = confirm('确定要清空所有当前应用的操作记录吗?');
|
|
31
|
+
if (result) {
|
|
32
|
+
this.getKeys().forEach((key) => localStorage.removeItem(key));
|
|
33
|
+
this.count = 0;
|
|
34
|
+
document.getElementById('recorder-count').innerText = String(this.count);
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
getAppName() {
|
|
38
|
+
return location.search.match(/appId=([^-]+)/)[1];
|
|
39
|
+
},
|
|
40
|
+
getKeys() {
|
|
41
|
+
return Object.keys(localStorage).filter((key) => key.startsWith(`录-${this.getAppName()}-`));
|
|
42
|
+
},
|
|
43
|
+
record(actionMsg: string, actionItem: {
|
|
44
|
+
action: 'undo' | 'redo',
|
|
45
|
+
}, actionList: Array<{ action: string, path: string, object: { concept: string, name: string } }>) {
|
|
46
|
+
try {
|
|
47
|
+
const actionItemDetail = actionList?.[0];
|
|
48
|
+
const timestamp = new Date().toJSON();
|
|
49
|
+
// eslint-disable-next-line function-paren-newline
|
|
50
|
+
localStorage.setItem(`录-${this.getAppName()}-${this.count + 1}`, JSON.stringify(
|
|
51
|
+
// {
|
|
52
|
+
// timestamp,
|
|
53
|
+
// message: actionMsg + (actionItem?.action ? ' ' + actionItem.action : ''),
|
|
54
|
+
// detail: {
|
|
55
|
+
// action: actionItemDetail?.action,
|
|
56
|
+
// path: actionItemDetail?.path,
|
|
57
|
+
// object: {
|
|
58
|
+
// concept: actionItemDetail?.object?.concept,
|
|
59
|
+
// name: actionItemDetail?.object?.name,
|
|
60
|
+
// }
|
|
61
|
+
// },
|
|
62
|
+
// }
|
|
63
|
+
[
|
|
64
|
+
timestamp,
|
|
65
|
+
actionMsg,
|
|
66
|
+
({ undo: '撤销', redo: '重做' })[actionItem?.action],
|
|
67
|
+
actionItemDetail?.action,
|
|
68
|
+
actionItemDetail?.path,
|
|
69
|
+
actionItemDetail?.object?.concept,
|
|
70
|
+
actionItemDetail?.object?.name,
|
|
71
|
+
]));
|
|
72
|
+
this.count++;
|
|
73
|
+
document.getElementById('recorder-count').innerText = String(this.count);
|
|
74
|
+
} catch (e) {
|
|
75
|
+
console.log(e);
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
exportExcel() {
|
|
79
|
+
(window as any).XlsxPopulate.fromBlankAsync()
|
|
80
|
+
.then((workbook: any) => {
|
|
81
|
+
const sheet = workbook.sheet(0);
|
|
82
|
+
const firstRowData = ['操作时间', '操作信息', '是否为撤销重做', '(详情)action', '(详情)path', '(详情)concept', '(详情)name'];
|
|
83
|
+
sheet.range(1, 1, 1, firstRowData.length).value([firstRowData]);
|
|
84
|
+
sheet.row(1).style({
|
|
85
|
+
bold: true,
|
|
86
|
+
fill: 'E1EAFF',
|
|
87
|
+
}).height(22);
|
|
88
|
+
[30, 30, 30, 14, 30, 18, 18].forEach((width, index) => sheet.column(index + 1).width(width));
|
|
89
|
+
|
|
90
|
+
this.getKeys().sort().forEach((key, index) => {
|
|
91
|
+
const item = JSON.parse(localStorage[key]);
|
|
92
|
+
item[0] = format(new Date(item[0]), 'yyyy-MM-dd HH:mm:ss');
|
|
93
|
+
sheet.range(index + 2, 1, index + 2, firstRowData.length).value([item]);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// Write to file.
|
|
97
|
+
return workbook.outputAsync()
|
|
98
|
+
.then((blob: Blob) => {
|
|
99
|
+
const url = window.URL.createObjectURL(blob);
|
|
100
|
+
const a = document.createElement('a');
|
|
101
|
+
document.body.appendChild(a);
|
|
102
|
+
a.href = url;
|
|
103
|
+
a.download = `操作步骤统计-${this.getAppName()}-${format(new Date(), 'yyyyMMddHHmmss')}.xlsx`;
|
|
104
|
+
a.click();
|
|
105
|
+
window.URL.revokeObjectURL(url);
|
|
106
|
+
document.body.removeChild(a);
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export default stepRecorder;
|
package/src/sentry/index.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
|
|
1
3
|
export const CONSTRUCTOR_HOOK = 'constructor';
|
|
2
4
|
export const BEFORE_HOOK = 'before';
|
|
3
5
|
export const AFTER_HOOK = 'after';
|
|
@@ -5,6 +7,8 @@ export const AFTER_HOOK = 'after';
|
|
|
5
7
|
export const NASL_NODE = 'nasl-node';
|
|
6
8
|
export const TS_WORKER_MESSAGER = 'ts-worker-messager';
|
|
7
9
|
|
|
10
|
+
export const getAxios = () => axios;
|
|
11
|
+
|
|
8
12
|
type ClassType = { new(...args: any[]): any };
|
|
9
13
|
|
|
10
14
|
type Source = {
|
|
@@ -19,6 +23,8 @@ type Listener = (source: Source) => void;
|
|
|
19
23
|
|
|
20
24
|
type Monitor = (key: string) => <T extends ClassType>(SourceClass: T) => T;
|
|
21
25
|
|
|
26
|
+
const passthroughProperties = ['constructor', 'getClassName'];
|
|
27
|
+
|
|
22
28
|
const previousStore: { [key:string]: Source } = {};
|
|
23
29
|
const listenersStore: { [key:string]: Listener[] } = {};
|
|
24
30
|
|
|
@@ -71,7 +77,7 @@ export const sentryMonitor: Monitor = (key) => (SourceClass) => {
|
|
|
71
77
|
|
|
72
78
|
const properties = Object.getOwnPropertyNames(SourceClass.prototype);
|
|
73
79
|
const names = properties.filter((property) => {
|
|
74
|
-
if (property
|
|
80
|
+
if (passthroughProperties.includes(property)) {
|
|
75
81
|
return false;
|
|
76
82
|
}
|
|
77
83
|
|
|
@@ -131,4 +137,4 @@ export const addListenerToNaslNode = addListener(NASL_NODE);
|
|
|
131
137
|
export const addListenerToTSWorkerMessager = addListener(TS_WORKER_MESSAGER);
|
|
132
138
|
|
|
133
139
|
export const sentryMonitorNaslNode = sentryMonitor(NASL_NODE);
|
|
134
|
-
export const sentryMonitorTSWorkerMessager = sentryMonitor(TS_WORKER_MESSAGER);
|
|
140
|
+
export const sentryMonitorTSWorkerMessager = sentryMonitor(TS_WORKER_MESSAGER);
|