@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
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Vertex } from '..';
|
|
1
|
+
import { Vertex, utils } from '..';
|
|
3
2
|
|
|
4
3
|
function switchCase2If(cases) {
|
|
5
4
|
const cas = cases.shift();
|
|
@@ -9,7 +8,13 @@ function switchCase2If(cases) {
|
|
|
9
8
|
test: cas.test,
|
|
10
9
|
consequent: {
|
|
11
10
|
type: 'BlockStatement',
|
|
12
|
-
body:
|
|
11
|
+
body: [
|
|
12
|
+
{
|
|
13
|
+
type: 'CallConsoleInfo',
|
|
14
|
+
content: 'SWITCHCASE',
|
|
15
|
+
},
|
|
16
|
+
...cas.consequent || [],
|
|
17
|
+
],
|
|
13
18
|
},
|
|
14
19
|
alternate: null,
|
|
15
20
|
};
|
|
@@ -19,7 +24,13 @@ function switchCase2If(cases) {
|
|
|
19
24
|
} else {
|
|
20
25
|
return {
|
|
21
26
|
type: 'BlockStatement',
|
|
22
|
-
body:
|
|
27
|
+
body: [
|
|
28
|
+
{
|
|
29
|
+
type: 'CallConsoleInfo',
|
|
30
|
+
content: 'SWITCHDEFAULT',
|
|
31
|
+
},
|
|
32
|
+
...cas.consequent || [],
|
|
33
|
+
],
|
|
23
34
|
};
|
|
24
35
|
}
|
|
25
36
|
|
|
@@ -27,6 +38,7 @@ function switchCase2If(cases) {
|
|
|
27
38
|
}
|
|
28
39
|
|
|
29
40
|
export default function (source) {
|
|
41
|
+
const isGONGHANG = utils.getGlobalEnv() === 'gonghang';
|
|
30
42
|
const definition = typeof source === 'string' ? JSON.parse(source) : source;
|
|
31
43
|
|
|
32
44
|
function traverse(node, func, parent, index) {
|
|
@@ -459,6 +471,13 @@ export default function (source) {
|
|
|
459
471
|
return `${newLine()}console.log(${generateNode(node.arguments[0])})${colon()}${newLine()}`;
|
|
460
472
|
}
|
|
461
473
|
|
|
474
|
+
if (node.type === 'CallConsoleInfo') {
|
|
475
|
+
if (isGONGHANG) {
|
|
476
|
+
return `console.info("${node.content}")${colon()}`;
|
|
477
|
+
}
|
|
478
|
+
return '';
|
|
479
|
+
}
|
|
480
|
+
|
|
462
481
|
if (node.type === 'Destination') {
|
|
463
482
|
const params = (node.params || [])
|
|
464
483
|
.filter((param) => param.pageParamKey && param.pageParamKeyValue)
|
|
@@ -479,16 +498,27 @@ export default function (source) {
|
|
|
479
498
|
if (Array.isArray(node.consequent)) {
|
|
480
499
|
node.consequent = {
|
|
481
500
|
type: 'BlockStatement',
|
|
482
|
-
body:
|
|
501
|
+
body: [
|
|
502
|
+
{
|
|
503
|
+
type: 'CallConsoleInfo',
|
|
504
|
+
content: 'IF',
|
|
505
|
+
},
|
|
506
|
+
...node.consequent,
|
|
507
|
+
],
|
|
483
508
|
};
|
|
484
509
|
}
|
|
485
|
-
if (Array.isArray(node.alternate)) {
|
|
510
|
+
if (Array.isArray(node.alternate) && node.alternate.length > 0) {
|
|
486
511
|
node.alternate = {
|
|
487
512
|
type: 'BlockStatement',
|
|
488
|
-
body:
|
|
513
|
+
body: [
|
|
514
|
+
{
|
|
515
|
+
type: 'CallConsoleInfo',
|
|
516
|
+
content: 'ELSE',
|
|
517
|
+
},
|
|
518
|
+
...node.alternate,
|
|
519
|
+
],
|
|
489
520
|
};
|
|
490
521
|
}
|
|
491
|
-
|
|
492
522
|
let alternateScript = '';
|
|
493
523
|
if (node.alternate) {
|
|
494
524
|
alternateScript = generateNode(node.alternate);
|
|
@@ -597,13 +627,10 @@ export default function (source) {
|
|
|
597
627
|
script += `${generateNode(node, index)}${newLine()}`;
|
|
598
628
|
});
|
|
599
629
|
|
|
600
|
-
// console.info("JSON generate:", JSON.stringify(logic.body));
|
|
601
|
-
// console.log(generate({ type: 'Program', body: logic.body }).code);
|
|
602
|
-
|
|
603
630
|
return `methods['${logic.name}'] = async function (${logic.params.map((param) => param.name).join(', ')}) {
|
|
604
|
-
${logic.params.length ? logic.params.map((param) => `${param.name} = ${param.name} !== undefined ? ${param.name} : this.$genInitFromSchema(${JSON.stringify(param.schema)}, ${JSON.stringify(param.defaultValue)});`).join('\n') + '' : ''}
|
|
605
|
-
${logic.variables.length ? logic.variables.map((variable) => `let ${variable.name} = this.$genInitFromSchema(${JSON.stringify(variable.schema)}, ${JSON.stringify(variable.defaultValue)});`).join('\n') + '' : ''}
|
|
606
|
-
let ${returnObj.name} = this.$genInitFromSchema(${JSON.stringify(returnObj.schema)}, ${JSON.stringify(returnObj.defaultValue)})
|
|
631
|
+
${logic.params.length ? logic.params.map((param) => `${param.name} = ${param.name} !== undefined ? ${param.name} : this.$genInitFromSchema(${JSON.stringify(param.schema)}, ${JSON.stringify(param.defaultValue)});` + (isGONGHANG ? `console.info(${param.name})` : '')).join('\n') + '' : ''}
|
|
632
|
+
${logic.variables.length ? logic.variables.map((variable) => `let ${variable.name} = this.$genInitFromSchema(${JSON.stringify(variable.schema)}, ${JSON.stringify(variable.defaultValue)});` + (isGONGHANG ? `console.info(${variable.name})` : '')).join('\n') + '' : ''}
|
|
633
|
+
let ${returnObj.name} = this.$genInitFromSchema(${JSON.stringify(returnObj.schema)}, ${JSON.stringify(returnObj.defaultValue)});` + (isGONGHANG ? `console.info(${returnObj.name})` : '') + `
|
|
607
634
|
${script}
|
|
608
635
|
}`;
|
|
609
636
|
});
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import generate from '@babel/generator';
|
|
2
2
|
import * as babel from '@babel/core';
|
|
3
|
-
import {
|
|
4
|
-
import { Vertex, vertexesMap, utils } from '..';
|
|
5
|
-
import { getQuerySchemaMap } from './tools';
|
|
3
|
+
import { Vertex, utils } from '..';
|
|
6
4
|
|
|
7
5
|
function switchCase2If(cases) {
|
|
8
6
|
const cas = cases.shift();
|
|
@@ -81,9 +79,7 @@ export default function (source) {
|
|
|
81
79
|
} else if (node.type === 'MemberExpression') {
|
|
82
80
|
return checkThis(node.object);
|
|
83
81
|
} else if (node.type === 'CallExpression') {
|
|
84
|
-
(node.arguments || []).forEach((arg) =>
|
|
85
|
-
return checkThis(arg);
|
|
86
|
-
});
|
|
82
|
+
(node.arguments || []).forEach((arg) => checkThis(arg));
|
|
87
83
|
}
|
|
88
84
|
}
|
|
89
85
|
function safeGenerate(node) {
|
|
@@ -586,7 +582,7 @@ export default function (source) {
|
|
|
586
582
|
const jsBlock_${index} = async () => {
|
|
587
583
|
${node.code}
|
|
588
584
|
}
|
|
589
|
-
|
|
585
|
+
|
|
590
586
|
await jsBlock_${index}();
|
|
591
587
|
}`,
|
|
592
588
|
{
|
|
@@ -600,16 +596,9 @@ export default function (source) {
|
|
|
600
596
|
}
|
|
601
597
|
});
|
|
602
598
|
|
|
603
|
-
// console.info("JSON generate:", JSON.stringify(logic.body));
|
|
604
|
-
// console.log(generate({ type: 'Program', body: logic.body }).code);
|
|
605
|
-
|
|
606
599
|
return `methods['${logic.name}'] = async function (${logic.params.map((param) => param.name).join(', ')}) {
|
|
607
|
-
${logic.params.length ? logic.params.map((param) => {
|
|
608
|
-
|
|
609
|
-
}).join('\n') + '' : ''}
|
|
610
|
-
${logic.variables.length ? logic.variables.map((variable) => {
|
|
611
|
-
return `let ${variable.name} = this.$genInitFromSchema(${JSON.stringify(variable.schema)}, ${JSON.stringify(variable.defaultValue)});`;
|
|
612
|
-
}).join('\n') + '' : ''}
|
|
600
|
+
${logic.params.length ? logic.params.map((param) => `${param.name} = ${param.name} !== undefined ? ${param.name} : this.$genInitFromSchema(${JSON.stringify(param.schema)}, ${JSON.stringify(param.defaultValue)});`).join('\n') + '' : ''}
|
|
601
|
+
${logic.variables.length ? logic.variables.map((variable) => `let ${variable.name} = this.$genInitFromSchema(${JSON.stringify(variable.schema)}, ${JSON.stringify(variable.defaultValue)});`).join('\n') + '' : ''}
|
|
613
602
|
let ${returnObj.name} = this.$genInitFromSchema(${JSON.stringify(returnObj.schema)}, ${JSON.stringify(returnObj.defaultValue)});
|
|
614
603
|
${generate({ type: 'Program', body: logic.body }).code}
|
|
615
604
|
}`;
|
package/src/types/nuims/Nuims.ts
CHANGED
|
@@ -17,7 +17,7 @@ interface RoleItem extends Role {
|
|
|
17
17
|
toggling?: Boolean,
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
interface Permission{
|
|
20
|
+
interface Permission {
|
|
21
21
|
DomainName: string,
|
|
22
22
|
PermissionId: string,
|
|
23
23
|
PermissionValue: string,
|
|
@@ -79,7 +79,7 @@ export class Nuims {
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
async getInitRoles() {
|
|
82
|
+
async getInitRoles(auto: unknown) {
|
|
83
83
|
let isCreated = false;
|
|
84
84
|
let resource = await this.getResource();
|
|
85
85
|
if (!resource) {
|
|
@@ -99,9 +99,15 @@ export class Nuims {
|
|
|
99
99
|
await this.bindRolesAndPermissions(role, permission);
|
|
100
100
|
}
|
|
101
101
|
roleName2Permission.set(role.RoleName, permission);
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
if (auto) {
|
|
103
|
+
if ((ResourceValue === '/dashboard' || ((ResourceValue === '/index' || ResourceValue === '/user') && config.scope === 'h5')) && role.RoleName === 'DEV-AdminRole') {
|
|
104
|
+
await this.attachPermissionResourceAction();
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
// 创建 /dashboard 资源时自动关联 DEV-AdminRole 权限
|
|
108
|
+
if (isCreated && (ResourceValue === '/dashboard' || ((ResourceValue === '/index' || ResourceValue === '/user') && config.scope === 'h5')) && role.RoleName === 'DEV-AdminRole') {
|
|
109
|
+
await this.attachPermissionResourceAction();
|
|
110
|
+
}
|
|
105
111
|
}
|
|
106
112
|
roleItem.permission = permission;
|
|
107
113
|
const resources = await this.getResourcesFromPermission(permission);
|