Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lcap/nasl-concepts

Package Overview
Dependencies
Maintainers
21
Versions
224
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lcap/nasl-concepts - npm Package Compare versions

Comparing version 3.9.0-beta.19 to 3.9.0-beta.20

4

out/common/BaseNode.d.ts

@@ -34,2 +34,6 @@ import { Translator, Embedded } from '@lcap/nasl-types';

/**
* 用于AI指标的uuid
*/
_aiUUID: undefined | string;
/**
* 变动时间

@@ -36,0 +40,0 @@ */

12

out/concepts/CallFunction__.js

@@ -178,3 +178,3 @@ "use strict";

let argTyAnno;
if (this.calleeName === 'ToString') {
if (['ToString', 'EnumItemToText', 'EnumItemToStructure'].includes(this.calleeName)) {
const arg0 = this.arguments[0];

@@ -188,3 +188,3 @@ argTyAnno = arg0.typeAnnotation || arg0.__TypeAnnotation;

// 事实上,大部分编译器都会选择把 type tag 放到前端来做运行时匹配,而非末位。
if (this.calleeName === 'ToString' && argTyAnno) {
if (['ToString', 'EnumItemToText', 'EnumItemToStructure'].includes(this.calleeName) && argTyAnno) {
code += `'${argTyAnno?.sortedTypeKey}', `;

@@ -210,3 +210,3 @@ }

// 用作做语义控制。后面这段代码没完全理解,需要保持进入条件不变。
const flagControl = ['ToString', 'FromString'].includes(this.calleeName) && argTyAnno;
const flagControl = ['ToString', 'FromString', 'EnumItemToText', 'EnumItemToStructure'].includes(this.calleeName) && argTyAnno;
if (!flagControl && Array.isArray(this.typeArguments) && this.typeArguments.length) {

@@ -260,3 +260,3 @@ if (this.arguments?.length)

let argTyAnno;
if (this.calleeName === 'ToString') {
if (['ToString', 'EnumItemToText', 'EnumItemToStructure'].includes(this.calleeName)) {
const arg0 = this.arguments[0];

@@ -270,3 +270,3 @@ argTyAnno = arg0.typeAnnotation || arg0.__TypeAnnotation;

// 事实上,大部分编译器都会选择把 type tag 放到前端来做运行时匹配,而非末位。
if (this.calleeName === 'ToString' && argTyAnno) {
if (['ToString', 'EnumItemToText', 'EnumItemToStructure'].includes(this.calleeName) && argTyAnno) {
code += `'${argTyAnno?.sortedTypeKey}', `;

@@ -293,3 +293,3 @@ }

// 用作做语义控制。后面这段代码没完全理解,需要保持进入条件不变。
const flagControl = ['ToString', 'FromString'].includes(this.calleeName) && argTyAnno;
const flagControl = ['ToString', 'FromString', 'EnumItemToText', 'EnumItemToStructure'].includes(this.calleeName) && argTyAnno;
if (!flagControl && Array.isArray(this.typeArguments) && this.typeArguments.length) {

@@ -296,0 +296,0 @@ if (this.arguments?.length)

@@ -155,3 +155,3 @@ import type { Embedded } from '@lcap/nasl-types';

getEmbeddedFilePath(name?: string): string;
static getTsNamespace(): string;
getTsNamespace(): string;
toEmbeddedTSFile(): Embedded.TSFileGenerator<Connection>;

@@ -158,0 +158,0 @@ /**

@@ -226,7 +226,7 @@ "use strict";

}
static getTsNamespace() {
getTsNamespace() {
return 'app.connections';
}
*toEmbeddedTSFile() {
let code = `namespace ${Connection_1.getTsNamespace()} {\n`;
let code = `namespace ${this.getTsNamespace()} {\n`;
const state = (0, nasl_translator_1.createCompilerState)(code, { tabSize: 1 });

@@ -282,3 +282,3 @@ try {

toEmbeddedDeclarationTSFile() {
let code = `namespace ${Connection_1.getTsNamespace()} {\n`;
let code = `namespace ${this.getTsNamespace()} {\n`;
try {

@@ -285,0 +285,0 @@ code += utils.runGeneratorSync(this.toEmbeddedTS((0, nasl_translator_1.createCompilerState)(code, {

@@ -64,3 +64,3 @@ "use strict";

const Connection = (0, decorators_1.getConceptConstructor)('Connection');
code += Connection.getTsNamespace();
code += Connection.prototype.getTsNamespace();
code += '.';

@@ -67,0 +67,0 @@ code += this.connectionTsName;

@@ -682,3 +682,3 @@ "use strict";

updateNodes.forEach((node) => {
node.update(node.toJSON());
node?.update({ ...node.toJSON(), field: 'setI18n' });
});

@@ -688,3 +688,3 @@ }

setMap.forEach((value, node) => {
node?.update({ i18nKey: value });
node?.update({ i18nKey: value, field: 'setI18n' });
});

@@ -691,0 +691,0 @@ }

@@ -488,3 +488,3 @@ import type { Embedded } from '@lcap/nasl-types';

getVarExistingNames(excludedList?: Array<Param | Return | Constant | ProcessElement>): string[];
getNamespace(ns: string): string;
getNamespace(ns?: string): string;
getEmbeddedFilePath(name?: string): string;

@@ -500,3 +500,5 @@ genExclusiveGatewayLogic(elem: ProcessElement): Logic;

toEmbeddedTS(state?: import("@lcap/nasl-types/out/translator").TranslatorState<import("@lcap/nasl-types/out/concept").BaseNode>): TranslatorGenerator;
toEmbeddedDeclarationTS(state?: import("@lcap/nasl-types/out/translator").TranslatorState<import("@lcap/nasl-types/out/concept").BaseNode>): TranslatorGenerator;
toEmbeddedTSFile(): Embedded.TSFileGenerator<Process>;
toEmbeddedDeclarationTSFile(): Embedded.DeclarationTSFileResult;
static getDefaultOptions(): {

@@ -503,0 +505,0 @@ constants: {

@@ -544,3 +544,3 @@ "use strict";

}
getNamespace(ns) {
getNamespace(ns = 'processes') {
if (this.parentNode && this.parentNode.getNamespace) {

@@ -712,4 +712,29 @@ const parentNamespace = this.parentNode.getNamespace();

}
*toEmbeddedDeclarationTS(state = (0, nasl_translator_1.createCompilerState)()) {
const self = this;
let code = `export namespace ${self.name} {\n`;
const tab1 = (0, nasl_translator_1.indent)((state?.tabSize || 0) + 1);
code += `${tab1}export namespace logics {\n`;
const logic = (0, getProcesses_1.genLaunchProcess)(this);
logic.parentNode = this;
code += `${(0, nasl_translator_1.indent)((state?.tabSize || 0) + 1)}// @ts-ignore\n`;
code += yield* logic.toEmbeddedDeclarationTS((0, nasl_translator_1.shiftState)(state, code, { tabSize: (state?.tabSize || 0) + 2 }), null);
code += `${tab1}}\n`;
code += `${tab1}export declare const elements: {\n`;
yield* (0, utils_1.wrapForEachToGenerator)(self.elements, function* warpForEachGenerator(ele) {
code += '\n';
if (ele.type !== 'AutoTask' &&
ele.type !== 'EndNoneEvent' &&
ele.type !== 'SequenceFlow' &&
ele.type !== 'StartNoneEvent' &&
ele.type !== 'ExclusiveGateway') {
code += yield* ele.toEmbeddedDeclarationTS((0, nasl_translator_1.shiftState)(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
}
});
code += `\n${tab1}}\n`;
code += `}\n`;
return code;
}
*toEmbeddedTSFile() {
let code = `namespace ${this.getNamespace('processes')} {\n`;
let code = `namespace ${this.getNamespace()} {\n`;
const state = (0, nasl_translator_1.createCompilerState)(code, { tabSize: 1 });

@@ -730,2 +755,20 @@ try {

}
toEmbeddedDeclarationTSFile() {
let code = `namespace ${this.getNamespace()} {\n`;
try {
code += utils.runGeneratorSync(this.toEmbeddedDeclarationTS((0, nasl_translator_1.createCompilerState)(code, {
tabSize: 1,
onlyDeclaration: true,
})));
}
catch (err) {
code += '';
console.log(err);
}
code += '}\n';
return {
code,
filePath: this.getEmbeddedFilePath(),
};
}
static getDefaultOptions() {

@@ -732,0 +775,0 @@ const userTaskAttr = {

@@ -621,2 +621,3 @@ import { TranslatorGenerator } from '@lcap/nasl-translator';

toEmbeddedTS(state?: import("@lcap/nasl-types/out/translator").TranslatorState<import("@lcap/nasl-types/out/concept").BaseNode>): TranslatorGenerator;
toEmbeddedDeclarationTS(state?: import("@lcap/nasl-types/out/translator").TranslatorState<import("@lcap/nasl-types/out/concept").BaseNode>): TranslatorGenerator;
/**

@@ -623,0 +624,0 @@ * 设置流程元素名称

@@ -938,2 +938,16 @@ "use strict";

}
*toEmbeddedDeclarationTS(state = (0, nasl_translator_1.createCompilerState)()) {
const self = this;
const tab1 = (0, nasl_translator_1.indent)((state?.tabSize || 0) + 1);
let code = `${self.name}: {\n`;
if (self.isUserTask) {
const logics = (0, getProcesses_1.genUserTaskLogic)(this);
yield* (0, utils_1.wrapForEachToGenerator)(logics, function* warpForEachGenerator(logic) {
logic.parentNode = self.process;
code += yield* logic.toEmbeddedDeclarationTS((0, nasl_translator_1.shiftState)(state, code, { tabSize: (state?.tabSize || 0) + 3 }), 'inObject');
});
}
code += `${tab1}},\n`;
return code;
}
getSubLogics() {

@@ -940,0 +954,0 @@ // 只有 AutoTask 才需要在他的节点下找子逻辑

@@ -180,3 +180,3 @@ import type { Embedded } from '@lcap/nasl-types';

getVarExistingNames(excludedList?: Array<ProcessElementV2>): string[];
getNamespace(ns: string): string;
getNamespace(ns?: string): string;
getElementLogicRoot(): void;

@@ -187,2 +187,4 @@ getVarialbesRoot(): void;

toEmbeddedTSFile(): Embedded.TSFileGenerator<ProcessV2>;
getTokenKeyWithNamespace(): string;
toEmbeddedDeclarationTSFile(): Embedded.DeclarationTSFileResult;
renameUniqueKey(): void;

@@ -189,0 +191,0 @@ static getDefaultOptions(): {

@@ -257,3 +257,3 @@ "use strict";

}
getNamespace(ns) {
getNamespace(ns = 'processV2s') {
if (this.parentNode && this.parentNode.getNamespace) {

@@ -266,3 +266,3 @@ const parentNamespace = this.parentNode.getNamespace();

}
return `${arr.join('.')}.${ns || 'processV2s'}`;
return `${arr.join('.')}.${ns}`;
}

@@ -324,7 +324,9 @@ throw new Error('无法获取命名空间,请设置 parentNode!');

if (bind) {
code += `let refEntity = `;
code += yield* bind.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code));
code += `;\n`;
if (!state.onlyDeclaration) {
code += `let refEntity = `;
code += yield* bind.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code));
code += `;\n`;
}
code += `// 绑定数据类型定义(实体/关联实体等)
export let bindData: {`;
export declare let bindData: {`;
const { properties } = bind.typeAnnotation || {};

@@ -341,3 +343,3 @@ if (Array.isArray(properties)) {

// 流程实例暴露出去的逻辑
code += `${tab1}export declare namespace logics {\n`;
code += `${tab1}export namespace logics {\n`;
const launchLogic = (0, getProcessesV2_1.genLaunchProcess)(this);

@@ -353,19 +355,16 @@ launchLogic.parentNode = this;

yield* (0, utils_1.wrapForEachToGenerator)([launchLogic, ...processOperates], function* warpForEachGenerator(logic) {
code += yield* logic.toEmbeddedDeclarationTS((0, nasl_translator_1.shiftState)(state, code, { tabSize: (state?.tabSize || 0) + 2, hideDefaultValue: true }));
code += yield* logic.toEmbeddedDeclarationTS((0, nasl_translator_1.shiftState)(state, code, {
tabSize: (state?.tabSize || 0) + 2,
onlyDeclaration: true,
}));
});
code += `${tab1}}\n`;
// 流程节点
// code += `${tab1}export const elements = {\n`;
// yield* wrapForEach(self.selectedElements, function* warpForEachGenerator(ele) {
// if (!(['EndNoneEvent'].includes(ele.type) || ele.isFlow || ele.isBranch)) {
// code += `...${ele.name}Elem,\n`;
// }
// });
// code += `\n${tab1}}\n`;
// 所有流程
yield* (0, utils_1.wrapForEachToGenerator)(self.processDefinitions, function* warpForEachGenerator(processDefinition, index) {
code += `${tab1}namespace processDefinition_${index} {\n`;
code += yield* processDefinition.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
code += '\n}\n';
});
if (!state.onlyDeclaration) {
// 所有流程
yield* (0, utils_1.wrapForEachToGenerator)(self.processDefinitions, function* warpForEachGenerator(processDefinition, index) {
code += `${tab1}namespace processDefinition_${index} {\n`;
code += yield* processDefinition.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
code += '\n}\n';
});
}
code += `${tab1}}\n`;

@@ -378,3 +377,3 @@ return code;

*toEmbeddedTSFile() {
let code = `namespace ${this.getNamespace('processV2s')} {\n`;
let code = `namespace ${this.getNamespace()} {\n`;
const state = (0, nasl_translator_1.createCompilerState)(code, { tabSize: 1 });

@@ -395,2 +394,23 @@ try {

}
getTokenKeyWithNamespace() {
return `${this.getNamespace()}.${this.uniqueKey}`;
}
toEmbeddedDeclarationTSFile() {
let code = `namespace ${this.getNamespace()} {\n`;
try {
code += utils.runGeneratorSync(this.toEmbeddedTS((0, nasl_translator_1.createCompilerState)(code, {
tabSize: 1,
onlyDeclaration: true,
})));
}
catch (err) {
code += '';
console.log(err);
}
code += '}\n';
return {
code,
filePath: this.getEmbeddedFilePath(),
};
}
renameUniqueKey() {

@@ -397,0 +417,0 @@ let unique = (0, utils_2.createUniqueKey)().slice(0, 8);

@@ -155,3 +155,3 @@ "use strict";

const app = node?.rootNode;
if (node?.concept === 'CallLogic' || node?.concept === 'BindEvent' || ['Logic', 'BusinessLogic', 'SubLogic'].includes(node?.concept)) {
if (['Logic', 'BusinessLogic', 'SubLogic', 'CallLogic', 'BindEvent', 'OverriddenLogic'].includes(node?.concept)) {
const result = [];

@@ -158,0 +158,0 @@ if (needAllLogic) {

@@ -209,3 +209,3 @@ "use strict";

let defaultValue = 'undefined';
for (let i = 0; i < element.bindAttrs.length; i++) {
for (let i = 0; i < (element?.bindAttrs?.length || 0); i++) {
const attr = element.bindAttrs[i];

@@ -212,0 +212,0 @@ if (attr.name === prop) {

{
"name": "@lcap/nasl-concepts",
"description": "NetEase Application Specific Language",
"version": "3.9.0-beta.19",
"version": "3.9.0-beta.20",
"author": "Forrest <rainforest92@126.com>",

@@ -40,6 +40,6 @@ "main": "./out",

"uuid": "8.3.2",
"@lcap/nasl-sentry": "3.9.0-beta.19",
"@lcap/nasl-translator": "3.9.0-beta.19",
"@lcap/nasl-types": "3.9.0-beta.19",
"@lcap/nasl-utils": "3.9.0-beta.19"
"@lcap/nasl-translator": "3.9.0-beta.20",
"@lcap/nasl-types": "3.9.0-beta.20",
"@lcap/nasl-sentry": "3.9.0-beta.20",
"@lcap/nasl-utils": "3.9.0-beta.20"
},

@@ -46,0 +46,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc