@lcap/nasl 3.7.0-beta.11 → 3.7.0-beta.13
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/concepts/CallInterface__.js +1 -1
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.js +1 -1
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +5 -0
- package/out/concepts/Entity__.js +7 -0
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/FrontendType__.d.ts +4 -0
- package/out/concepts/FrontendType__.js +9 -0
- package/out/concepts/FrontendType__.js.map +1 -1
- package/out/concepts/Frontend__.d.ts +2 -0
- package/out/concepts/Frontend__.js +7 -0
- package/out/concepts/Frontend__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +1 -0
- package/out/concepts/Logic__.js +52 -1
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/Match__.js +1 -1
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/ProcessElementV2__.js +7 -0
- package/out/concepts/ProcessElementV2__.js.map +1 -1
- package/out/concepts/ProcessV2__.js +2 -2
- package/out/concepts/ProcessV2__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +1 -0
- package/out/concepts/ViewElement__.js +23 -1
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +2 -0
- package/out/concepts/View__.js +29 -1
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.processV2.js +1 -1
- package/out/generator/genBundleFiles.js +6 -5
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/permission.js +2 -2
- package/out/generator/permission.js.map +1 -1
- package/out/generator/release-body/body.js +17 -0
- package/out/generator/release-body/body.js.map +1 -1
- package/out/natural/genNaturalTS.js +1 -1
- package/out/server/extendBaseNode.js +31 -1
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/getLogics.js +1 -1
- package/out/server/getLogics.js.map +1 -1
- package/out/server/naslServer.js +4 -10
- package/out/server/naslServer.js.map +1 -1
- package/out/templator/genCreateBlock.d.ts +6 -3
- package/out/templator/genCreateBlock.js +11 -8
- package/out/templator/genCreateBlock.js.map +1 -1
- package/package.json +1 -1
- package/sandbox/stdlib/nasl.processV2.ts +1 -1
- package/src/concepts/CallInterface__.ts +1 -1
- package/src/concepts/CallLogic__.ts +1 -1
- package/src/concepts/Entity__.ts +7 -0
- package/src/concepts/FrontendType__.ts +8 -0
- package/src/concepts/Frontend__.ts +8 -0
- package/src/concepts/Logic__.ts +47 -2
- package/src/concepts/Match__.ts +1 -1
- package/src/concepts/ProcessElementV2__.ts +7 -0
- package/src/concepts/ProcessV2__.ts +2 -2
- package/src/concepts/ViewElement__.ts +24 -2
- package/src/concepts/View__.ts +31 -1
- package/src/concepts/basics/stdlib/nasl.processV2.ts +1 -1
- package/src/generator/genBundleFiles.ts +7 -4
- package/src/generator/permission.ts +2 -2
- package/src/generator/release-body/body.ts +19 -2
- package/src/natural/genNaturalTS.ts +1 -1
- package/src/server/extendBaseNode.ts +32 -1
- package/src/server/getLogics.ts +1 -1
- package/src/server/naslServer.ts +5 -11
- package/src/templator/genCreateBlock.ts +15 -9
- package/ts-worker/bundle.js +591 -0
- package/ts-worker/webpack.config.js +1 -2
|
@@ -201,6 +201,21 @@ BaseNode.prototype.changeName = async function changeName(newValue: string, upda
|
|
|
201
201
|
const callback = (value: boolean, toast?: Function) => {
|
|
202
202
|
if (value) {
|
|
203
203
|
const App = this.rootNode;
|
|
204
|
+
// 实体重命名时需要同步更新绑定该实体的审批页面
|
|
205
|
+
if(this.concept === 'Entity') {
|
|
206
|
+
const originEvent: any = [];
|
|
207
|
+
(this as Entity).__bindView?.forEach((view) => {
|
|
208
|
+
originEvent.push({
|
|
209
|
+
originEvent: {
|
|
210
|
+
action: 'update',
|
|
211
|
+
target: view,
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
})
|
|
215
|
+
naslServer.embeddedTSEmitter?.emit('change', {
|
|
216
|
+
value: originEvent,
|
|
217
|
+
})
|
|
218
|
+
}
|
|
204
219
|
// 收集修改
|
|
205
220
|
App.emit('collect:start', {
|
|
206
221
|
actionMsg: '重命名并更新引用',
|
|
@@ -888,6 +903,10 @@ function newNode(node: BaseNode, parentNode: BaseNode, needNewStructure: boolean
|
|
|
888
903
|
}
|
|
889
904
|
return node as Structure;
|
|
890
905
|
}
|
|
906
|
+
|
|
907
|
+
function findStructInConnectorByName(name: string, connector: Connector) {
|
|
908
|
+
return connector?.structures?.find((struct) => struct.name === name);
|
|
909
|
+
}
|
|
891
910
|
/**
|
|
892
911
|
* 获取下一级变量
|
|
893
912
|
*/
|
|
@@ -898,6 +917,12 @@ BaseNode.prototype.getSelectRef = function getSelectRef(newTypeAnnotation: TypeA
|
|
|
898
917
|
const { typeName, typeKind, typeNamespace, typeArguments, properties: typeProperties } = typeAnnotation;
|
|
899
918
|
const parentNode = this;
|
|
900
919
|
let completionChildren: any;
|
|
920
|
+
// 连接器需要区分 编辑态和稳定态
|
|
921
|
+
const connector = this.getAncestor('Connector') as Connector;
|
|
922
|
+
const isInConnector = !!connector;
|
|
923
|
+
const isInIntegration = !!this.getAncestor('Integration');
|
|
924
|
+
const isInEditableConnector = isInConnector && isInIntegration;
|
|
925
|
+
|
|
901
926
|
if (typeKind === 'reference') {
|
|
902
927
|
if (typeNamespace === 'nasl.ui' || typeNamespace === 'nasl.process' || typeNamespace === 'nasl.auth' || typeNamespace === 'nasl.http') {
|
|
903
928
|
const node = newNode(getNaslNodeByNodeCallee(typeNamespace, typeName), parentNode, needNewStructure);
|
|
@@ -912,7 +937,13 @@ BaseNode.prototype.getSelectRef = function getSelectRef(newTypeAnnotation: TypeA
|
|
|
912
937
|
} else {
|
|
913
938
|
app = this.rootNode || typeAnnotation.app;
|
|
914
939
|
}
|
|
915
|
-
|
|
940
|
+
let node;
|
|
941
|
+
if (isInEditableConnector) {
|
|
942
|
+
const target = findStructInConnectorByName(typeName, connector);
|
|
943
|
+
node = newNode(target, parentNode, needNewStructure);
|
|
944
|
+
} else {
|
|
945
|
+
node = newNode(getNodeByNodeCallee(app, typeNamespace + '.' + typeName, ), parentNode, needNewStructure)
|
|
946
|
+
}
|
|
916
947
|
const properties = node?.properties || [];
|
|
917
948
|
completionChildren = properties;
|
|
918
949
|
}
|
package/src/server/getLogics.ts
CHANGED
|
@@ -160,7 +160,7 @@ function getElementsMethods(likeComponent: View | BusinessComponent, parentNodeN
|
|
|
160
160
|
|
|
161
161
|
export function getLogicsSync(node: CallLogic | BindEvent | Identifier | Logic, needAllLogic: boolean = true) {
|
|
162
162
|
const app = node?.rootNode as App;
|
|
163
|
-
if (node?.concept === 'CallLogic' || node?.concept === 'BindEvent' || node?.concept
|
|
163
|
+
if (node?.concept === 'CallLogic' || node?.concept === 'BindEvent' || ['Logic', 'BusinessLogic'].includes(node?.concept)) {
|
|
164
164
|
const result = [];
|
|
165
165
|
|
|
166
166
|
if (needAllLogic) {
|
package/src/server/naslServer.ts
CHANGED
|
@@ -297,19 +297,13 @@ class NaslServer {
|
|
|
297
297
|
if (globalThis.process)
|
|
298
298
|
// For TS build
|
|
299
299
|
this.worker = new Worker(path.join(__dirname, '../../ts-worker/src/index.js'));
|
|
300
|
-
// worker = new Worker(path.join(__dirname, '../../../src/static/ts-worker.js'));
|
|
301
300
|
/// #endif
|
|
302
301
|
/// #if process.env.BUILD_TARGET !== 'node'
|
|
303
|
-
if (globalThis.window){
|
|
304
|
-
const source = require('!!raw-loader
|
|
305
|
-
const
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
const url = URL.createObjectURL(bold);
|
|
309
|
-
const worker = new Worker(url);
|
|
310
|
-
return worker;
|
|
311
|
-
};
|
|
312
|
-
this.worker = createWorker(source);
|
|
302
|
+
if (globalThis.window) {
|
|
303
|
+
const source = require('!!raw-loader!../../ts-worker/bundle.js').default;
|
|
304
|
+
const url = URL.createObjectURL(new Blob([source]));
|
|
305
|
+
this.worker = new Worker(url);
|
|
306
|
+
URL.revokeObjectURL(url);
|
|
313
307
|
}
|
|
314
308
|
/// #endif
|
|
315
309
|
|
|
@@ -14,9 +14,14 @@ import {
|
|
|
14
14
|
genQueryLogic,
|
|
15
15
|
} from '.';
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
interface IBlockExtra {
|
|
18
|
+
disabledRelationEntity?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function genCreateFormTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroupMap: Map<string, NameGroup>, appointKeys: string[] = [], process: ProcessV2, extra: IBlockExtra = {}) {
|
|
18
22
|
const dataSource = entity.parentNode as DataSource;
|
|
19
23
|
let properties = entity.properties.filter(filterProperty('inForm'));
|
|
24
|
+
const { disabledRelationEntity } = extra;
|
|
20
25
|
|
|
21
26
|
if(appointKeys.length) {
|
|
22
27
|
properties = entity.properties.filter((property) => appointKeys.includes(property.name));
|
|
@@ -48,7 +53,7 @@ export function genCreateFormTemplate(entity: Entity, nameGroup: NameGroup, sele
|
|
|
48
53
|
?.split('(')[1]
|
|
49
54
|
.slice(0, -1)
|
|
50
55
|
) || 0;
|
|
51
|
-
if (property.relationEntity) {
|
|
56
|
+
if (property.relationEntity && !disabledRelationEntity) {
|
|
52
57
|
// 有外键关联
|
|
53
58
|
const relationEntity = dataSource?.findEntityByName(property.relationEntity);
|
|
54
59
|
if (relationEntity) {
|
|
@@ -109,9 +114,10 @@ export function genCreateFormTemplate(entity: Entity, nameGroup: NameGroup, sele
|
|
|
109
114
|
</u-form>`;
|
|
110
115
|
}
|
|
111
116
|
|
|
112
|
-
export function genH5CreateFormTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroupMap: Map<string, NameGroup>, appointKeys: string[] = [] ) {
|
|
117
|
+
export function genH5CreateFormTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroupMap: Map<string, NameGroup>, appointKeys: string[] = [], process: ProcessV2, extra: IBlockExtra = {}) {
|
|
113
118
|
const dataSource = entity.parentNode as DataSource;
|
|
114
119
|
let properties = entity.properties.filter(filterProperty('inForm'));
|
|
120
|
+
const { disabledRelationEntity } = extra;
|
|
115
121
|
|
|
116
122
|
if(appointKeys.length) {
|
|
117
123
|
properties = entity.properties.filter((property) => appointKeys.includes(property.name));
|
|
@@ -134,7 +140,7 @@ export function genH5CreateFormTemplate(entity: Entity, nameGroup: NameGroup, se
|
|
|
134
140
|
const { typeAnnotation } = property || {};
|
|
135
141
|
const { typeNamespace: propertyTypeNamespace } = typeAnnotation || {};
|
|
136
142
|
const propertyTypeName = transEntityMetadataTypes(typeAnnotation, dataSource.app);
|
|
137
|
-
if (property.relationEntity) {
|
|
143
|
+
if (property.relationEntity && !disabledRelationEntity) {
|
|
138
144
|
// 有外键关联
|
|
139
145
|
const relationEntity = dataSource?.findEntityByName(property.relationEntity);
|
|
140
146
|
if (relationEntity) {
|
|
@@ -380,16 +386,16 @@ function genProcessV2LunchLogic(module: any, entity: Entity, process: ProcessV2)
|
|
|
380
386
|
],
|
|
381
387
|
});
|
|
382
388
|
}
|
|
383
|
-
|
|
384
389
|
/**
|
|
385
390
|
* 生成创建页区块
|
|
386
391
|
* @param resolver 实体创建 Action
|
|
387
392
|
*/
|
|
388
|
-
export function genCreateBlock(entity: Entity, oldNode: ViewElement, appointKeys: string[] = [],frontendType: string, process: ProcessV2) {
|
|
393
|
+
export function genCreateBlock(entity: Entity, oldNode: ViewElement, appointKeys: string[] = [],frontendType: string, process: ProcessV2, extra: IBlockExtra = {}) {
|
|
389
394
|
const likeComponent = oldNode?.likeComponent;
|
|
390
395
|
const dataSource = entity.parentNode as DataSource;
|
|
391
396
|
const module = dataSource.app;
|
|
392
397
|
const { ns } = entity;
|
|
398
|
+
const { disabledRelationEntity } = extra;
|
|
393
399
|
const createLogic = ns?.logics?.find((logic) => logic.name === `create`);
|
|
394
400
|
|
|
395
401
|
const nameGroup: NameGroup = {};
|
|
@@ -403,7 +409,7 @@ export function genCreateBlock(entity: Entity, oldNode: ViewElement, appointKeys
|
|
|
403
409
|
const newLoadSelectLogics: any[] = [];
|
|
404
410
|
entity.properties.forEach((property) => {
|
|
405
411
|
// 有外键关联
|
|
406
|
-
if (property.relationEntity) {
|
|
412
|
+
if (property.relationEntity && !disabledRelationEntity) {
|
|
407
413
|
const relationEntity = dataSource?.findEntityByName(property.relationEntity);
|
|
408
414
|
if (relationEntity) {
|
|
409
415
|
const displayedProperty = getFirstDisplayedProperty(relationEntity);
|
|
@@ -449,8 +455,8 @@ export function genCreateBlock(entity: Entity, oldNode: ViewElement, appointKeys
|
|
|
449
455
|
|
|
450
456
|
return `<template>
|
|
451
457
|
${(frontendType || config.scope) === 'h5'
|
|
452
|
-
? genH5CreateFormTemplate(entity, nameGroup, selectNameGroupMap, appointKeys)
|
|
453
|
-
: genCreateFormTemplate(entity, nameGroup, selectNameGroupMap, appointKeys)
|
|
458
|
+
? genH5CreateFormTemplate(entity, nameGroup, selectNameGroupMap, appointKeys, process, extra)
|
|
459
|
+
: genCreateFormTemplate(entity, nameGroup, selectNameGroupMap, appointKeys, process, extra)
|
|
454
460
|
}
|
|
455
461
|
</template>
|
|
456
462
|
|