@lcap/nasl 0.3.10 → 0.3.11
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/app/api.d.ts +1 -15
- package/out/service/app/api.js +7 -17
- package/out/service/app/api.js.map +1 -1
- package/out/service/create/errHandles.js +19 -2
- package/out/service/create/errHandles.js.map +1 -1
- package/out/service/create/index.js +5 -0
- package/out/service/create/index.js.map +1 -1
- package/out/service/logic/logic.d.ts +50 -14
- package/out/service/logic/logic.js +26 -0
- package/out/service/logic/logic.js.map +1 -1
- package/out/service/page/element.d.ts +9 -0
- package/out/service/page/element.js +6 -0
- package/out/service/page/element.js.map +1 -1
- package/out/service/permission/api.d.ts +57 -0
- package/out/service/permission/api.js +41 -0
- package/out/service/permission/api.js.map +1 -0
- package/out/service/permission/index.d.ts +2 -0
- package/out/service/permission/index.js +17 -0
- package/out/service/permission/index.js.map +1 -0
- package/out/service/webFile/index.js +5 -0
- package/out/service/webFile/index.js.map +1 -1
- package/out/types/app/App.d.ts +13 -0
- package/out/types/app/App.js +55 -1
- package/out/types/app/App.js.map +1 -1
- package/out/types/app/History.js +3 -2
- package/out/types/app/History.js.map +1 -1
- package/out/types/app/Service.d.ts +5 -2
- package/out/types/app/Service.js +42 -9
- package/out/types/app/Service.js.map +1 -1
- package/out/types/cache.d.ts +6 -0
- package/out/types/cache.js +54 -0
- package/out/types/cache.js.map +1 -0
- package/out/types/cacheData.js.map +1 -1
- package/out/types/common/Vertex.d.ts +25 -0
- package/out/types/common/Vertex.js +42 -1
- package/out/types/common/Vertex.js.map +1 -1
- package/out/types/data/Entity.d.ts +4 -0
- package/out/types/data/Entity.js +9 -0
- package/out/types/data/Entity.js.map +1 -1
- package/out/types/data/EntityProperty.d.ts +5 -0
- package/out/types/data/EntityProperty.js +16 -0
- package/out/types/data/EntityProperty.js.map +1 -1
- package/out/types/data/Enum.d.ts +5 -0
- package/out/types/data/Enum.js +5 -0
- package/out/types/data/Enum.js.map +1 -1
- package/out/types/data/GlobalLogicNode.js +8 -1
- package/out/types/data/GlobalLogicNode.js.map +1 -1
- package/out/types/data/Interface.js +5 -3
- package/out/types/data/Interface.js.map +1 -1
- package/out/types/data/dataTypes.js +1 -1
- package/out/types/data/dataTypes.js.map +1 -1
- package/out/types/data/genBlock/genCreateBlock.js +5 -5
- package/out/types/data/genBlock/genCreateBlock.js.map +1 -1
- package/out/types/data/genBlock/genCurdBlock.js +3 -3
- package/out/types/data/genBlock/genCurdBlock.js.map +1 -1
- package/out/types/data/genBlock/genCurdEditTableBlock.d.ts +3 -0
- package/out/types/data/genBlock/genCurdEditTableBlock.js +578 -0
- package/out/types/data/genBlock/genCurdEditTableBlock.js.map +1 -0
- package/out/types/data/genBlock/genEditTableBlock.d.ts +234 -0
- package/out/types/data/genBlock/genEditTableBlock.js +419 -0
- package/out/types/data/genBlock/genEditTableBlock.js.map +1 -0
- package/out/types/data/genBlock/genEnumSelectBlock.d.ts +1 -1
- package/out/types/data/genBlock/genEnumSelectBlock.js +2 -2
- package/out/types/data/genBlock/genEnumSelectBlock.js.map +1 -1
- package/out/types/data/genBlock/genGridViewBlock.js +12 -1
- package/out/types/data/genBlock/genGridViewBlock.js.map +1 -1
- package/out/types/data/genBlock/genListViewBlock.js +2 -2
- package/out/types/data/genBlock/genQueryComponent.d.ts +20 -0
- package/out/types/data/genBlock/genQueryComponent.js +57 -1
- package/out/types/data/genBlock/genQueryComponent.js.map +1 -1
- package/out/types/data/genBlock/genSelectBlock.js +2 -2
- package/out/types/data/genBlock/genTableBlock.js +23 -8
- package/out/types/data/genBlock/genTableBlock.js.map +1 -1
- package/out/types/data/genBlock/genUpdateBlock.js +5 -5
- package/out/types/data/genBlock/genUpdateBlock.js.map +1 -1
- package/out/types/data/genBlock/index.d.ts +2 -0
- package/out/types/data/genBlock/index.js +2 -0
- package/out/types/data/genBlock/index.js.map +1 -1
- package/out/types/data/genBlock/utils.d.ts +7 -0
- package/out/types/data/genBlock/utils.js +38 -1
- package/out/types/data/genBlock/utils.js.map +1 -1
- package/out/types/data/systemTypes.js +47 -0
- package/out/types/data/systemTypes.js.map +1 -1
- package/out/types/enum.d.ts +6 -0
- package/out/types/enum.js +11 -0
- package/out/types/enum.js.map +1 -0
- package/out/types/generator/hotReload.d.ts +2 -0
- package/out/types/generator/hotReload.js +12 -1
- package/out/types/generator/hotReload.js.map +1 -1
- package/out/types/index.d.ts +5 -1
- package/out/types/index.js +8 -2
- package/out/types/index.js.map +1 -1
- package/out/types/logic/Logic.d.ts +32 -0
- package/out/types/logic/Logic.js +151 -41
- package/out/types/logic/Logic.js.map +1 -1
- package/out/types/logic/LogicItem.d.ts +1 -0
- package/out/types/logic/LogicItem.js +49 -32
- package/out/types/logic/LogicItem.js.map +1 -1
- package/out/types/logic/Param.d.ts +1 -0
- package/out/types/logic/Param.js +43 -33
- package/out/types/logic/Param.js.map +1 -1
- package/out/types/logic/Return.js +17 -30
- package/out/types/logic/Return.js.map +1 -1
- package/out/types/logic/Variable.js +17 -25
- package/out/types/logic/Variable.js.map +1 -1
- package/out/types/logic/translator.js +39 -10
- package/out/types/logic/translator.js.map +1 -1
- package/out/types/nuims/Nuims.d.ts +1 -1
- package/out/types/nuims/Nuims.js +11 -4
- package/out/types/nuims/Nuims.js.map +1 -1
- package/out/types/page/Element.d.ts +24 -0
- package/out/types/page/Element.js +198 -134
- package/out/types/page/Element.js.map +1 -1
- package/out/types/page/Event.js.map +1 -1
- package/out/types/page/Page.d.ts +5 -0
- package/out/types/page/Page.js +66 -27
- package/out/types/page/Page.js.map +1 -1
- package/out/types/page/View.d.ts +19 -1
- package/out/types/page/View.js +150 -40
- package/out/types/page/View.js.map +1 -1
- package/out/types/page/ViewParam.d.ts +1 -0
- package/out/types/page/ViewParam.js +23 -4
- package/out/types/page/ViewParam.js.map +1 -1
- package/out/types/page/ViewVariable.js +13 -24
- package/out/types/page/ViewVariable.js.map +1 -1
- package/out/types/permission/Permission.d.ts +41 -0
- package/out/types/permission/Permission.js +122 -0
- package/out/types/permission/Permission.js.map +1 -0
- package/out/types/process/ProcessParam.js +3 -1
- package/out/types/process/ProcessParam.js.map +1 -1
- package/out/types/utils/index.d.ts +1 -0
- package/out/types/utils/index.js +16 -7
- package/out/types/utils/index.js.map +1 -1
- package/package.json +1 -2
- package/src/service/app/api.js +8 -17
- package/src/service/create/errHandles.js +18 -2
- package/src/service/create/index.js +6 -0
- package/src/service/developPermission/api.js +37 -0
- package/src/service/developPermission/index.js +13 -0
- package/src/service/logic/logic.js +26 -0
- package/src/service/page/element.js +6 -0
- package/src/service/permission/api.js +38 -0
- package/src/service/permission/index.js +13 -0
- package/src/service/webFile/index.js +6 -1
- package/src/types/app/App.ts +58 -2
- package/src/types/app/History.ts +3 -2
- package/src/types/app/Service.ts +48 -10
- package/src/types/cache.ts +50 -0
- package/src/types/cacheData.ts +7 -7
- package/src/types/common/Vertex.ts +32 -1
- package/src/types/data/Entity.ts +8 -0
- package/src/types/data/EntityProperty.ts +12 -0
- package/src/types/data/Enum.ts +5 -0
- package/src/types/data/GlobalLogicNode.ts +8 -1
- package/src/types/data/Interface.ts +4 -3
- package/src/types/data/dataTypes.ts +1 -1
- package/src/types/data/genBlock/genCreateBlock.ts +5 -5
- package/src/types/data/genBlock/genCurdBlock.ts +3 -3
- package/src/types/data/genBlock/genCurdEditTableBlock.ts +581 -0
- package/src/types/data/genBlock/genEditTableBlock.ts +470 -0
- package/src/types/data/genBlock/genEnumSelectBlock.ts +2 -2
- package/src/types/data/genBlock/genGridViewBlock.ts +12 -1
- package/src/types/data/genBlock/genListViewBlock.ts +2 -2
- package/src/types/data/genBlock/genQueryComponent.ts +56 -0
- package/src/types/data/genBlock/genSelectBlock.ts +2 -2
- package/src/types/data/genBlock/genTableBlock.ts +28 -13
- package/src/types/data/genBlock/genUpdateBlock.ts +5 -5
- package/src/types/data/genBlock/index.ts +2 -0
- package/src/types/data/genBlock/utils.ts +38 -0
- package/src/types/data/systemTypes.ts +47 -0
- package/src/types/enum.ts +6 -0
- package/src/types/generator/hotReload.ts +10 -0
- package/src/types/index.ts +5 -1
- package/src/types/logic/Logic.ts +148 -39
- package/src/types/logic/LogicItem.ts +55 -38
- package/src/types/logic/Param.ts +43 -35
- package/src/types/logic/Return.ts +21 -34
- package/src/types/logic/Variable.ts +21 -27
- package/src/types/logic/translator.js +41 -14
- package/src/types/logic/translator_backup.js +5 -16
- package/src/types/nuims/Nuims.ts +11 -5
- package/src/types/page/Element.ts +212 -138
- package/src/types/page/Event.ts +0 -3
- package/src/types/page/Page.ts +80 -40
- package/src/types/page/View.ts +154 -39
- package/src/types/page/ViewParam.ts +22 -3
- package/src/types/page/ViewVariable.ts +16 -26
- package/src/types/page/dist/View.js +727 -0
- package/src/types/permission/Permission.ts +112 -0
- package/src/types/process/ProcessParam.ts +4 -1
- package/src/types/utils/index.ts +16 -7
- package/out/test/units/config.spec.d.ts +0 -1
- package/out/test/units/config.spec.js +0 -12
- package/out/test/units/config.spec.js.map +0 -1
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { immutable } from '../decorators';
|
|
2
|
+
import { View, Element } from '..';
|
|
3
|
+
import permissionService from '../../service/permission';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export class Permission {
|
|
7
|
+
/**
|
|
8
|
+
* App Name
|
|
9
|
+
*/
|
|
10
|
+
@immutable()
|
|
11
|
+
public readonly domainName: string = undefined;
|
|
12
|
+
/**
|
|
13
|
+
* 上报权限后的资源id
|
|
14
|
+
*/
|
|
15
|
+
@immutable()
|
|
16
|
+
public readonly resourceId: string = undefined;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 应用 id
|
|
20
|
+
*/
|
|
21
|
+
@immutable()
|
|
22
|
+
public readonly serviceId: string = undefined;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* view
|
|
26
|
+
*/
|
|
27
|
+
@immutable()
|
|
28
|
+
public readonly view: View = undefined;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* element
|
|
32
|
+
*/
|
|
33
|
+
@immutable()
|
|
34
|
+
public readonly element: Element = undefined;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @param source 需要合并的部分参数
|
|
38
|
+
*/
|
|
39
|
+
constructor(source?: Partial<Permission>) {
|
|
40
|
+
const { domainName } = source;
|
|
41
|
+
Object.assign(this, source);
|
|
42
|
+
if (!domainName) {
|
|
43
|
+
throw new Error('Permission need domainName!');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async createDefaultRoleFromRoleName(roleName: string) {
|
|
48
|
+
if (!roleName)
|
|
49
|
+
return;
|
|
50
|
+
return await permissionService.createRole({
|
|
51
|
+
body: {
|
|
52
|
+
name: roleName,
|
|
53
|
+
serviceId: this.serviceId,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async updateRoleName(roleId: string, roleName: string) {
|
|
59
|
+
return await permissionService.updateRole({
|
|
60
|
+
body: {
|
|
61
|
+
id: roleId,
|
|
62
|
+
name: roleName,
|
|
63
|
+
serviceId: this.serviceId,
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
*
|
|
70
|
+
* @param query {
|
|
71
|
+
* resourceId
|
|
72
|
+
* roleId
|
|
73
|
+
* }
|
|
74
|
+
*/
|
|
75
|
+
async attachPermissionResource(query: Object) {
|
|
76
|
+
return await permissionService.attachPermissionResourceAction({ query });
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async detachPermissionResource(query: Object) {
|
|
80
|
+
return await permissionService.detachPermissionResourceAction({ query });
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async getInitRoles(resourceId: string) {
|
|
84
|
+
return await permissionService.getRoles({
|
|
85
|
+
query: {
|
|
86
|
+
serviceId: this.serviceId,
|
|
87
|
+
resourceId,
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async attachDevRole(resourceId: string) {
|
|
93
|
+
const data: any = await this.getInitRoles(resourceId)|| [];
|
|
94
|
+
let roleId;
|
|
95
|
+
data.forEach((item: any) => {
|
|
96
|
+
if (item.name === 'DEV-AdminRole') {
|
|
97
|
+
roleId = item.id;
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
// 获取权限树资源Id
|
|
101
|
+
if (roleId) {
|
|
102
|
+
// 默认角色开启
|
|
103
|
+
await this.attachPermissionResource({
|
|
104
|
+
resourceId,
|
|
105
|
+
roleId,
|
|
106
|
+
});
|
|
107
|
+
await this.getInitRoles(resourceId);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export default Permission;
|
|
@@ -62,10 +62,13 @@ export class ProcessParam extends Param {
|
|
|
62
62
|
body,
|
|
63
63
|
});
|
|
64
64
|
this.assign(ProcessParam.from(result, this.process));
|
|
65
|
-
this.updateInterface();
|
|
65
|
+
await this.updateInterface();
|
|
66
66
|
|
|
67
67
|
await config.defaultApp?.history.load();
|
|
68
68
|
config.defaultApp?.emit('saved');
|
|
69
|
+
|
|
70
|
+
// 更新所有调用此Logic的LogicItem
|
|
71
|
+
// await this.process.launchProcessInterface.logic.callLogicUpdate();
|
|
69
72
|
return this;
|
|
70
73
|
}
|
|
71
74
|
/**
|
package/src/types/utils/index.ts
CHANGED
|
@@ -4,6 +4,11 @@ export * from './logger';
|
|
|
4
4
|
|
|
5
5
|
import { traverse } from './traverse';
|
|
6
6
|
import { isBasicType } from '../';
|
|
7
|
+
import { cloneDeep } from 'lodash';
|
|
8
|
+
|
|
9
|
+
export function getGlobalEnv() {
|
|
10
|
+
return typeof window !== 'undefined' ? (window as any).appInfo.env : (global as any).appInfoEnv;
|
|
11
|
+
}
|
|
7
12
|
|
|
8
13
|
/**
|
|
9
14
|
* 用 lodash 的 throttle 好像有点问题,先临时做个处理
|
|
@@ -58,21 +63,25 @@ export function resolveParameter(params: Array<ParamStruts>): resolvedParameter
|
|
|
58
63
|
};
|
|
59
64
|
let hasBody = false;
|
|
60
65
|
let hasParam = false;
|
|
61
|
-
params.forEach((p) => {
|
|
62
|
-
|
|
66
|
+
params.forEach((p) => {
|
|
67
|
+
const pcopy = cloneDeep(p);
|
|
68
|
+
if(pcopy.required) {
|
|
69
|
+
delete pcopy.defaultValue
|
|
70
|
+
}
|
|
71
|
+
if (pcopy.in === 'body') {
|
|
63
72
|
hasBody = true;
|
|
64
|
-
requestBody.description.name =
|
|
65
|
-
if (!isBasicType(
|
|
66
|
-
requestBody.content['application/json'] =
|
|
73
|
+
requestBody.description.name = pcopy.name;
|
|
74
|
+
if (!isBasicType(pcopy.schema)) {
|
|
75
|
+
requestBody.content['application/json'] = pcopy;
|
|
67
76
|
} else {
|
|
68
77
|
requestBody.content['application/json'] = {
|
|
69
|
-
schema:
|
|
78
|
+
schema: pcopy.schema,
|
|
70
79
|
};
|
|
71
80
|
}
|
|
72
81
|
requestBody.required = true;
|
|
73
82
|
} else {
|
|
74
83
|
hasParam = true;
|
|
75
|
-
parameters[
|
|
84
|
+
parameters[pcopy.name] = pcopy;
|
|
76
85
|
}
|
|
77
86
|
});
|
|
78
87
|
return {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const chai_1 = require("chai");
|
|
4
|
-
const types_1 = require("../../types");
|
|
5
|
-
describe('config', () => {
|
|
6
|
-
it('login successfully', async () => {
|
|
7
|
-
types_1.config.baseURL = 'http://defaulttenant.qa-ci.lcap.group';
|
|
8
|
-
const userInfo = await types_1.login('admin', 'Admin@123456');
|
|
9
|
-
chai_1.expect(userInfo.UserId).to.equal('28db2e05f7e54c3b90a9e41e5cfe2318');
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
//# sourceMappingURL=config.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.spec.js","sourceRoot":"","sources":["../../../src/test/units/config.spec.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAC9B,uCAA4C;AAE5C,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACpB,EAAE,CAAC,oBAAoB,EAAE,KAAK,IAAI,EAAE;QAChC,cAAM,CAAC,OAAO,GAAG,uCAAuC,CAAC;QACzD,MAAM,QAAQ,GAAG,MAAM,aAAK,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QACtD,aAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|