@lcap/nasl 3.8.0-beta.6 → 3.8.0-beta.7
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/.mocharc.js +1 -0
- package/out/common/BaseNode.d.ts +19 -3
- package/out/common/BaseNode.js +85 -7
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/AbstractInterface__.js.map +1 -1
- package/out/concepts/Annotation__.js +1 -1
- package/out/concepts/Annotation__.js.map +1 -1
- package/out/concepts/App__.d.ts +3 -0
- package/out/concepts/App__.js +964 -4
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.js +3 -3
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/BatchAssignment__.d.ts +1 -1
- package/out/concepts/BatchAssignment__.js +2 -2
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/BindAttribute__.js +3 -4
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.js +3 -4
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BusinessComponent__.d.ts +2 -0
- package/out/concepts/BusinessComponent__.js +48 -0
- package/out/concepts/BusinessComponent__.js.map +1 -1
- package/out/concepts/BusinessLogic__.d.ts +1 -0
- package/out/concepts/BusinessLogic__.js +10 -0
- package/out/concepts/BusinessLogic__.js.map +1 -1
- package/out/concepts/CallEvent__.d.ts +2 -0
- package/out/concepts/CallEvent__.js +75 -0
- package/out/concepts/CallEvent__.js.map +1 -1
- package/out/concepts/CallInterface__.d.ts +1 -0
- package/out/concepts/CallInterface__.js +26 -15
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +4 -0
- package/out/concepts/CallLogic__.js +59 -3
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +3 -3
- package/out/concepts/Entity__.js +4 -0
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/Event__.d.ts +2 -0
- package/out/concepts/Event__.js +30 -0
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/FrontendType__.d.ts +2 -0
- package/out/concepts/FrontendType__.js +32 -0
- package/out/concepts/FrontendType__.js.map +1 -1
- package/out/concepts/Frontend__.d.ts +2 -0
- package/out/concepts/Frontend__.js +48 -0
- package/out/concepts/Frontend__.js.map +1 -1
- package/out/concepts/IfStatement__.js +6 -6
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/InterfaceParam__.d.ts +1 -0
- package/out/concepts/InterfaceParam__.js +23 -4
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.d.ts +2 -1
- package/out/concepts/Interface__.js +29 -5
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/JSBlock__.d.ts +1 -0
- package/out/concepts/JSBlock__.js +6 -0
- package/out/concepts/JSBlock__.js.map +1 -1
- package/out/concepts/LogicDeclaration__.d.ts +1 -0
- package/out/concepts/LogicDeclaration__.js +58 -7
- package/out/concepts/LogicDeclaration__.js.map +1 -1
- package/out/concepts/Logic__.js +32 -22
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchCase__.js +1 -2
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/Match__.js +3 -18
- 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/Module__.d.ts +2 -0
- package/out/concepts/Module__.js +64 -0
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/NewComposite__.d.ts +1 -1
- package/out/concepts/NewComposite__.js +2 -2
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/Paginate__.d.ts +1 -0
- package/out/concepts/Paginate__.js +15 -7
- package/out/concepts/Paginate__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.js +2 -2
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/StringLiteral__.js +3 -4
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.js +1 -0
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +2 -0
- package/out/concepts/ViewElement__.js +8 -5
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +1 -0
- package/out/concepts/View__.js +55 -1
- package/out/concepts/View__.js.map +1 -1
- package/out/generator/genBundleFiles.js +14 -11
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genHash.d.ts +2 -2
- package/out/generator/genHash.js +30 -30
- package/out/generator/genHash.js.map +1 -1
- package/out/generator/permission.d.ts +8 -1
- package/out/generator/permission.js +321 -23
- package/out/generator/permission.js.map +1 -1
- package/out/generator/release-body/body.js +18 -4
- package/out/generator/release-body/body.js.map +1 -1
- package/out/generator/release-body/data.js +6 -2
- package/out/generator/release-body/data.js.map +1 -1
- package/out/generator/release-body/utils.js +3 -3
- package/out/generator/release-body/utils.js.map +1 -1
- package/out/generator/release-body/validation.js +2 -2
- package/out/generator/release-body/validation.js.map +1 -1
- package/out/index.d.ts +1 -1
- package/out/index.js.map +1 -1
- package/out/natural/genNaturalTS.d.ts +2 -2
- package/out/natural/genNaturalTS.js +7 -7
- package/out/natural/genNaturalTS.js.map +1 -1
- package/out/natural/getContext/index.d.ts +1 -1
- package/out/natural/getContext/index.js +15 -9
- package/out/natural/getContext/index.js.map +1 -1
- package/out/natural/transformTS2UI.js +30 -11
- package/out/natural/transformTS2UI.js.map +1 -1
- package/out/natural/transformTSCode.js +30 -11
- package/out/natural/transformTSCode.js.map +1 -1
- package/out/server/entity2LogicNamespace.d.ts +2 -2
- package/out/server/entity2LogicNamespace.js +321 -310
- package/out/server/entity2LogicNamespace.js.map +1 -1
- package/out/server/extendBaseNode.js +25 -0
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/naslServer.d.ts +1 -1
- package/out/server/naslServer.js +23 -16
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js +12 -0
- package/out/server/translator.js.map +1 -1
- package/out/templator/genCreateBlock.js +3 -3
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +2 -2
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +4 -4
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.js +1 -1
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genGridViewBlock.js.map +1 -1
- package/out/templator/genSelectBlock.js.map +1 -1
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +3 -3
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/utils.js +1 -1
- package/out/templator/utils.js.map +1 -1
- package/package.json +5 -5
- package/src/common/BaseNode.ts +91 -11
- package/src/concepts/AbstractInterface__.ts +1 -0
- package/src/concepts/Annotation__.ts +1 -1
- package/src/concepts/App__.ts +104 -4
- package/src/concepts/Argument__.ts +3 -3
- package/src/concepts/BatchAssignment__.ts +2 -2
- package/src/concepts/BindAttribute__.ts +3 -4
- package/src/concepts/BindDirective__.ts +3 -4
- package/src/concepts/BusinessComponent__.ts +54 -1
- package/src/concepts/BusinessLogic__.ts +10 -1
- package/src/concepts/CallEvent__.ts +66 -0
- package/src/concepts/CallInterface__.ts +21 -9
- package/src/concepts/CallLogic__.ts +59 -3
- package/src/concepts/Entity__.ts +7 -1
- package/src/concepts/Event__.ts +32 -0
- package/src/concepts/FrontendType__.ts +34 -1
- package/src/concepts/Frontend__.ts +51 -0
- package/src/concepts/IfStatement__.ts +6 -6
- package/src/concepts/InterfaceParam__.ts +23 -4
- package/src/concepts/Interface__.ts +29 -5
- package/src/concepts/JSBlock__.ts +5 -0
- package/src/concepts/LogicDeclaration__.ts +65 -7
- package/src/concepts/Logic__.ts +34 -25
- package/src/concepts/MatchCase__.ts +1 -2
- package/src/concepts/Match__.ts +3 -21
- package/src/concepts/MemberExpression__.ts +1 -1
- package/src/concepts/Module__.ts +75 -0
- package/src/concepts/NewComposite__.ts +2 -2
- package/src/concepts/Paginate__.ts +14 -7
- package/src/concepts/QueryFromExpression__.ts +2 -2
- package/src/concepts/StringLiteral__.ts +3 -4
- package/src/concepts/TypeAnnotation__.ts +1 -0
- package/src/concepts/ViewElement__.ts +9 -5
- package/src/concepts/View__.ts +56 -1
- package/src/generator/genBundleFiles.ts +14 -11
- package/src/generator/genHash.ts +32 -6
- package/src/generator/permission.ts +333 -23
- package/src/generator/release-body/body.ts +24 -5
- package/src/generator/release-body/data.ts +7 -2
- package/src/generator/release-body/utils.ts +3 -3
- package/src/generator/release-body/validation.ts +1 -1
- package/src/index.ts +13 -1
- package/src/natural/genNaturalTS.ts +9 -7
- package/src/natural/getContext/index.ts +17 -11
- package/src/natural/transformTS2UI.ts +28 -11
- package/src/natural/transformTSCode.ts +28 -11
- package/src/server/entity2LogicNamespace.ts +13 -1
- package/src/server/extendBaseNode.ts +31 -0
- package/src/server/naslServer.ts +32 -23
- package/src/server/translator.ts +15 -0
- package/src/templator/genCreateBlock.ts +4 -4
- package/src/templator/genCurdEditMultipleKeyBlock.ts +2 -2
- package/src/templator/genCurdMultipleKeyBlock.ts +7 -7
- package/src/templator/genEditTableBlock.ts +4 -4
- package/src/templator/genGetBlock.ts +1 -1
- package/src/templator/genGridViewBlock.ts +2 -2
- package/src/templator/genSelectBlock.ts +3 -3
- package/src/templator/genTableBlock.ts +2 -2
- package/src/templator/genUpdateBlock.ts +6 -6
- package/src/templator/utils.ts +1 -1
- package/test/concepts/string-literal/__snapshots__/toVue.spec.ts.snap +1 -1
- package/test/concepts/view-element/__snapshots__/toVue.spec.ts.snap +6 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { config } from '../config';
|
|
2
2
|
import * as utils from '../utils';
|
|
3
|
-
import { App, Module, Namespace, Entity, EntityProperty, View, DataSource, ViewElement } from '../concepts';
|
|
3
|
+
import { App, Module, Namespace, Entity, EntityProperty, View, DataSource, ViewElement, Logic } from '../concepts';
|
|
4
4
|
import { NameGroup, genUniqueQueryNameGroup, getFirstDisplayedProperty, genQueryLogic, genLogicParam, genCallComponentLogic } from '.';
|
|
5
5
|
import { NaslUITypeAnnotation, NaslCollectionTypeAnnotation, NaslLogicItem, NaslTypeAnnotation, NaslNode } from './utils';
|
|
6
6
|
|
|
@@ -103,7 +103,7 @@ export function genLoadSelectLogic(entity: Entity, nameGroup: NameGroup, newLogi
|
|
|
103
103
|
* @param view
|
|
104
104
|
* @returns
|
|
105
105
|
*/
|
|
106
|
-
export function genSelectBlock(entity: Entity, oldNode: ViewElement,
|
|
106
|
+
export function genSelectBlock(entity: Entity, oldNode: ViewElement,
|
|
107
107
|
genSelectTemplateLocal?: (property: EntityProperty, nameGroup: NameGroup, newLogic: any) => string ) {
|
|
108
108
|
const likeComponent = oldNode?.likeComponent;
|
|
109
109
|
const dataSource = entity.parentNode as DataSource;
|
|
@@ -304,7 +304,7 @@ export function genSelectItemAddLogic(entity: Entity, nameGroup: NameGroup, view
|
|
|
304
304
|
);
|
|
305
305
|
if (entity && entity.concept === 'Entity') {
|
|
306
306
|
const { ns } = entity;
|
|
307
|
-
const createLogic = ns?.logics?.find((logic) => logic.name === `create`);
|
|
307
|
+
const createLogic = ns?.logics?.find((logic : Logic) => logic.name === `create`);
|
|
308
308
|
callLogics.push(
|
|
309
309
|
NaslLogicItem.Assignment({
|
|
310
310
|
left: NaslLogicItem.Identifier({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as utils from '../utils';
|
|
2
|
-
import { App, Module, Namespace, Entity, EntityProperty, View, DataSource, ViewElement } from '../concepts';
|
|
2
|
+
import { App, Module, Namespace, Entity, EntityProperty, View, DataSource, ViewElement, Logic } from '../concepts';
|
|
3
3
|
import {
|
|
4
4
|
filterProperty,
|
|
5
5
|
NameGroup,
|
|
@@ -165,7 +165,7 @@ export function genTableRemoveLogic(entity: Entity, nameGroup: NameGroup) {
|
|
|
165
165
|
const currentName = nameGroup.currentName || 'current';
|
|
166
166
|
|
|
167
167
|
const { ns } = entity;
|
|
168
|
-
const deleteLogic = ns?.logics?.find((logic) => logic.name === 'delete');
|
|
168
|
+
const deleteLogic = ns?.logics?.find((logic : Logic) => logic.name === 'delete');
|
|
169
169
|
const idPropertys = entity.properties.filter((property) => property.primaryKey);
|
|
170
170
|
return NaslNode.Logic({
|
|
171
171
|
name: nameGroup.viewLogicRemove,
|
|
@@ -87,7 +87,7 @@ export function genUpdateFormTemplate(entity: Entity, nameGroup: NameGroup, sele
|
|
|
87
87
|
} else if (propertyTypeName === 'DateTime') {
|
|
88
88
|
formItem += `<u-date-time-picker :clearable="true" :value.sync="${vModel}" placeholder="请输入${label}"></u-date-time-picker>`;
|
|
89
89
|
} else {
|
|
90
|
-
const namespaceArr = propertyTypeNamespace
|
|
90
|
+
const namespaceArr = propertyTypeNamespace?.split?.('.') || [];
|
|
91
91
|
const type = namespaceArr.pop();
|
|
92
92
|
if (type === 'enums') {
|
|
93
93
|
const Enum = dataSource.app.findNodeByCompleteName(propertyTypeNamespace + '.' + propertyTypeName) as Enum;
|
|
@@ -196,7 +196,7 @@ export function genH5UpdateFormTemplate(entity: Entity, nameGroup: NameGroup, se
|
|
|
196
196
|
} else if (propertyTypeName === 'DateTime') {
|
|
197
197
|
formItem += `<template #input><van-linear-layout style="width:100%;" direction="horizontal"><van-datetime-picker type="datetime" v-model="${vModel}" title="请选择${label}" labelField="" inputAlign="left"></van-datetime-picker></van-linear-layout></template>`;
|
|
198
198
|
} else {
|
|
199
|
-
const namespaceArr = propertyTypeNamespace
|
|
199
|
+
const namespaceArr = propertyTypeNamespace?.split?.('.') || [];
|
|
200
200
|
const type = namespaceArr.pop();
|
|
201
201
|
if (type === 'enums') {
|
|
202
202
|
formItem += `<template #input><van-linear-layout style="width:100%;" direction="horizontal">${genEnumSelectBlock(
|
|
@@ -295,7 +295,7 @@ function genLoadLogic(getLogic: Logic, nameGroup: NameGroup) {
|
|
|
295
295
|
|
|
296
296
|
// 生成修改区块
|
|
297
297
|
export function genUpdateBlock(entity: Entity, oldNode: ViewElement, useViewVariable = true,
|
|
298
|
-
genUpdateTemplate?: (entity: Entity, nameGroup: NameGroup, selectNameGroupMap: Map<string, NameGroup>) => string,
|
|
298
|
+
genUpdateTemplate?: (entity: Entity, nameGroup: NameGroup, selectNameGroupMap: Map<string, NameGroup>) => string,
|
|
299
299
|
genLoadLogicLocal?: (getLogic: Logic, nameGroup: NameGroup, entity?: Entity) => any,
|
|
300
300
|
genSubmitLogicLocal?: (updateLogic: Logic, nameGroup: NameGroup) => any) {
|
|
301
301
|
const likeComponent = oldNode?.likeComponent;
|
|
@@ -303,8 +303,8 @@ export function genUpdateBlock(entity: Entity, oldNode: ViewElement, useViewVari
|
|
|
303
303
|
const dataSource = entity.parentNode as DataSource;
|
|
304
304
|
const module = dataSource.app;
|
|
305
305
|
const { ns } = entity;
|
|
306
|
-
const getLogic = ns?.logics?.find((logic) => logic.name === `get`);
|
|
307
|
-
const updateLogic = ns?.logics?.find((logic) => logic.name === `update`);
|
|
306
|
+
const getLogic = ns?.logics?.find((logic : Logic) => logic.name === `get`);
|
|
307
|
+
const updateLogic = ns?.logics?.find((logic : Logic) => logic.name === `update`);
|
|
308
308
|
|
|
309
309
|
const nameGroup: NameGroup = {};
|
|
310
310
|
nameGroup.viewElementMainView = likeComponent.getViewElementUniqueName('form1');
|
|
@@ -364,7 +364,7 @@ export function genUpdateBlock(entity: Entity, oldNode: ViewElement, useViewVari
|
|
|
364
364
|
)}
|
|
365
365
|
}` : ''
|
|
366
366
|
}
|
|
367
|
-
|
|
367
|
+
|
|
368
368
|
],
|
|
369
369
|
"viewLogics": [
|
|
370
370
|
${JSON.stringify((genLoadLogicLocal || genLoadLogic)(getLogic, nameGroup, entity))},
|
package/src/templator/utils.ts
CHANGED
|
@@ -19,7 +19,7 @@ export function getExpression(property: EntityProperty, expression: string) {
|
|
|
19
19
|
if (propertyTypeName === 'DateTime') return `$utils['FormatDateTime'](${expression}, 'YYYY-MM-DD HH:mm:ss')`;
|
|
20
20
|
if (propertyTypeName === 'Date') return `$utils['FormatDate'](${expression}, 'YYYY-MM-DD')`;
|
|
21
21
|
|
|
22
|
-
const namespaceArr = propertyTypeNamespace
|
|
22
|
+
const namespaceArr = propertyTypeNamespace?.split?.('.') || [];
|
|
23
23
|
const type = namespaceArr.pop();
|
|
24
24
|
if (type === 'enums') {
|
|
25
25
|
return `$utils['EnumValueToText'](${expression}, '__enumTypeAnnotation_${propertyTypeNamespace}.${propertyTypeName}')`;
|
|
@@ -103,7 +103,9 @@ exports[`view-element:toVue table-data-source-calllogic-with-server-validation 1
|
|
|
103
103
|
>
|
|
104
104
|
<u-table-view
|
|
105
105
|
:ref=\\"\`tableView_1\`\\"
|
|
106
|
-
:data-source=\\"
|
|
106
|
+
:data-source=\\"
|
|
107
|
+
$global.useDatabaseCallback()(__tableView_1_handleDataSourceLoad)
|
|
108
|
+
\\"
|
|
107
109
|
:data-schema=\\"\`LoadTestTableView_1Structure\`\\"
|
|
108
110
|
:value-field=\\"\`entity1.id\`\\"
|
|
109
111
|
:pagination=\\"true\\"
|
|
@@ -271,7 +273,9 @@ exports[`view-element:toVue with-table 1`] = `
|
|
|
271
273
|
</u-linear-layout>
|
|
272
274
|
<u-table-view
|
|
273
275
|
:ref=\\"\`tableView\`\\"
|
|
274
|
-
:data-source=\\"
|
|
276
|
+
:data-source=\\"
|
|
277
|
+
$global.useDatabaseCallback()(__tableView_handleDataSourceLoad)
|
|
278
|
+
\\"
|
|
275
279
|
:data-schema=\\"\`LoadTestTableView2Structure\`\\"
|
|
276
280
|
:value-field=\\"\`entity2.id\`\\"
|
|
277
281
|
:pagination=\\"true\\"
|