@lcap/nasl 3.6.4-beta.4 → 3.6.4-beta.5
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/Integration__.d.ts +1 -0
- package/out/concepts/Integration__.js +4 -0
- package/out/concepts/Integration__.js.map +1 -1
- package/out/natural/genNaturalTS.d.ts +8 -8
- package/out/natural/genNaturalTS.js +41 -41
- package/out/natural/prompt/analyzeClaims.js +4 -3
- package/out/natural/prompt/analyzeClaims.js.map +1 -1
- package/out/natural/prompt/analyzeFormatOutput.js +1 -1
- package/out/natural/prompt/analyzeTasks.js +2 -2
- package/out/server/extendBaseNode.js +6 -8
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/naslServer.js +8 -0
- package/out/server/naslServer.js.map +1 -1
- package/out/templator/genCreateBlock.js +2 -2
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +2 -2
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +2 -2
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/utils/delay/index.d.ts +0 -0
- package/out/utils/delay/index.js +1 -0
- package/out/utils/delay/index.js.map +1 -0
- package/out/utils/delay.d.ts +9 -0
- package/out/utils/delay.js +41 -0
- package/out/utils/delay.js.map +1 -0
- package/out/utils/env.d.ts +4 -0
- package/out/utils/env.js +6 -1
- package/out/utils/env.js.map +1 -1
- package/out/utils/time-slicing/controller.js +4 -2
- package/out/utils/time-slicing/controller.js.map +1 -1
- package/out/utils/time-slicing/page-state.d.ts +1 -1
- package/out/utils/time-slicing/page-state.js +3 -9
- package/out/utils/time-slicing/page-state.js.map +1 -1
- package/package.json +1 -1
- package/src/concepts/Integration__.ts +5 -0
- package/src/natural/genNaturalTS.ts +41 -41
- package/src/natural/prompt/analyzeClaims.ts +4 -3
- package/src/natural/prompt/analyzeFormatOutput.ts +1 -1
- package/src/natural/prompt/analyzeTasks.ts +2 -2
- package/src/server/extendBaseNode.ts +6 -8
- package/src/server/naslServer.ts +10 -0
- package/src/templator/genCreateBlock.ts +2 -2
- package/src/templator/genCurdEditMultipleKeyBlock.ts +1 -1
- package/src/templator/genCurdMultipleKeyBlock.ts +2 -2
- package/src/templator/genUpdateBlock.ts +2 -2
- package/src/utils/delay/index.ts +0 -0
- package/src/utils/delay.ts +41 -0
- package/src/utils/env.ts +7 -0
- package/src/utils/time-slicing/controller.ts +5 -3
- package/src/utils/time-slicing/page-state.ts +1 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../src/utils/time-slicing/controller.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAC5C,+CAA4C;AAC5C,mCAQiB;AACjB,yCAMoB;
|
|
1
|
+
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../src/utils/time-slicing/controller.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAC5C,+CAA4C;AAC5C,mCAQiB;AACjB,yCAMoB;AACpB,oCAAyC;AAEzC,cAAc;AACd,MAAa,qBAAqB;IAAlC;QACE,YAAY;QACJ,OAAE,GAAG,IAAA,aAAK,GAAE,CAAC;QAErB,eAAe;QACP,kBAAa,GAAG,CAAC,CAAC;QAE1B;;;;WAIG;QACK,gBAAW,GAAG,CAAC,CAAC;QAExB;;;;WAIG;QACK,oBAAe,GAAG,IAAI,CAAC;QAE/B,eAAe;QACP,qBAAgB,GAAG,CAAC,CAAC;QAE7B,UAAU;QACO,UAAK,GAAc;YAClC,EAAE,EAAE,CAAC;YACL,IAAI,EAAE,CAAC;YACP,SAAS,EAAE,CAAC;YACZ,IAAI,EAAE,IAAA,oBAAY,EAAC,CAAC,CAAC;SACtB,CAAC;QAEF,YAAY;QACK,UAAK,GAAc;YAClC,EAAE,EAAE,CAAC;YACL,IAA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AAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YAC3B,UAAU;YAEV,OAAO;YACP,QAAQ,EAAE,CAAC;QACb,CAAC,CAAQ,CAAC;IACZ,CAAC;CACF;AA7UD,sDA6UC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** 页面活动状态 */
|
|
2
|
-
export declare
|
|
2
|
+
export declare const isPageActive: () => boolean;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isPageActive = void 0;
|
|
4
4
|
const env_1 = require("../env");
|
|
5
5
|
/** 页面活动状态 */
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
if (!env_1.isNode) {
|
|
9
|
-
exports.pageIsActive = !(document?.hidden ?? true);
|
|
10
|
-
document?.addEventListener('visibilitychange', () => {
|
|
11
|
-
exports.pageIsActive = !document.hidden;
|
|
12
|
-
});
|
|
13
|
-
}
|
|
6
|
+
const isPageActive = () => !env_1.isNode && !document.hidden;
|
|
7
|
+
exports.isPageActive = isPageActive;
|
|
14
8
|
//# sourceMappingURL=page-state.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-state.js","sourceRoot":"","sources":["../../../src/utils/time-slicing/page-state.ts"],"names":[],"mappings":";;;AAAA,gCAAgC;AAEhC,aAAa;
|
|
1
|
+
{"version":3,"file":"page-state.js","sourceRoot":"","sources":["../../../src/utils/time-slicing/page-state.ts"],"names":[],"mappings":";;;AAAA,gCAAgC;AAEhC,aAAa;AACN,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,CAAC,YAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;AAAjD,QAAA,YAAY,gBAAqC"}
|
package/package.json
CHANGED
|
@@ -289,6 +289,11 @@ export class Integration extends BaseNode {
|
|
|
289
289
|
};
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
+
getConnectorExistingTitles(excludedList: Array<Connector> = []) {
|
|
293
|
+
const excludedSet = new Set(excludedList);
|
|
294
|
+
return ((this.connectors as Connector[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.title);
|
|
295
|
+
}
|
|
296
|
+
|
|
292
297
|
//================================================================================
|
|
293
298
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
294
299
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -97,8 +97,8 @@ export const getNaslOql = () => {
|
|
|
97
97
|
return { code, naslOql };
|
|
98
98
|
};
|
|
99
99
|
|
|
100
|
-
export const getEnums = (app: App, state: any,
|
|
101
|
-
const needNamespace =
|
|
100
|
+
export const getEnums = (app: App, state: any, requiredIndexes?: string[]) => {
|
|
101
|
+
const needNamespace = requiredIndexes?.length >= 0;
|
|
102
102
|
const namespace = 'app.enums';
|
|
103
103
|
const data = [] as { description: string; code: string; }[];
|
|
104
104
|
let code = '';
|
|
@@ -113,8 +113,8 @@ export const getEnums = (app: App, state: any, moduleIndexList?: string[]) => {
|
|
|
113
113
|
return { code, namespace, enums: { namespace, data } };
|
|
114
114
|
};
|
|
115
115
|
|
|
116
|
-
export const getEntities = (app: App, state: any,
|
|
117
|
-
const needNamespace =
|
|
116
|
+
export const getEntities = (app: App, state: any, requiredIndexes?: string[]) => {
|
|
117
|
+
const needNamespace = requiredIndexes?.length >= 0;
|
|
118
118
|
const entities = [] as { namespace: string; data: { description: string; code: string; }[]; }[];
|
|
119
119
|
let code = '';
|
|
120
120
|
app.dataSources.forEach((dataSource) => {
|
|
@@ -136,8 +136,8 @@ export const getEntities = (app: App, state: any, moduleIndexList?: string[]) =>
|
|
|
136
136
|
return { code, entities };
|
|
137
137
|
};
|
|
138
138
|
|
|
139
|
-
export const getStructures = (app: App, state: any,
|
|
140
|
-
const needNamespace =
|
|
139
|
+
export const getStructures = (app: App, state: any, requiredIndexes?: string[]) => {
|
|
140
|
+
const needNamespace = requiredIndexes?.length >= 0;
|
|
141
141
|
const data = [] as { description: string; code: string; }[];
|
|
142
142
|
const namespace = `app.structures`;
|
|
143
143
|
let code = '';
|
|
@@ -154,8 +154,8 @@ export const getStructures = (app: App, state: any, moduleIndexList?: string[])
|
|
|
154
154
|
return { code, structures: { namespace, data } };
|
|
155
155
|
};
|
|
156
156
|
|
|
157
|
-
export const getLogics = (app: App, currentNode: BaseNode,
|
|
158
|
-
const hasModuleIndexList =
|
|
157
|
+
export const getLogics = (app: App, currentNode: BaseNode, requiredIndexes?: string[]) => {
|
|
158
|
+
const hasModuleIndexList = requiredIndexes?.length > 0;
|
|
159
159
|
const data = [] as { description: string; code: string; }[];
|
|
160
160
|
const namespace = `app.logics`;
|
|
161
161
|
let code = '';
|
|
@@ -163,9 +163,9 @@ export const getLogics = (app: App, currentNode: BaseNode, moduleIndexList?: str
|
|
|
163
163
|
?.filter((logic) => logic !== currentNode && !logic.name.startsWith('LCAP'))
|
|
164
164
|
?.forEach((logic, index) => {
|
|
165
165
|
const logicIndex = `6-${index}`;
|
|
166
|
-
if (hasModuleIndexList && !
|
|
167
|
-
const logicName =
|
|
168
|
-
const needNamespace =
|
|
166
|
+
if (hasModuleIndexList && !requiredIndexes?.includes(logicIndex)) return;
|
|
167
|
+
const logicName = requiredIndexes?.length >= 0 ? logic?.calleewholeKey : undefined;
|
|
168
|
+
const needNamespace = requiredIndexes?.length >= 0;
|
|
169
169
|
const tempCode = `${logic?.toNaturalTS(createCompilerState('', { needNamespace }), 'inTsContext', logicName, currentNode)}`;
|
|
170
170
|
const description = logic?.description || '';
|
|
171
171
|
code += `[${logicIndex}]${description} ${tempCode}`;
|
|
@@ -174,8 +174,8 @@ export const getLogics = (app: App, currentNode: BaseNode, moduleIndexList?: str
|
|
|
174
174
|
return { code, appLogics: { namespace, data } };
|
|
175
175
|
};
|
|
176
176
|
|
|
177
|
-
export const getModuleInterfaces = (app: App, state: any,
|
|
178
|
-
const hasModuleIndexList =
|
|
177
|
+
export const getModuleInterfaces = (app: App, state: any, requiredIndexes?: string[]) => {
|
|
178
|
+
const hasModuleIndexList = requiredIndexes?.length > 0;
|
|
179
179
|
const interfaceDependencies = [] as {
|
|
180
180
|
name: string;
|
|
181
181
|
structures: { namespace: string; data: { description: string; code: string; }[]; };
|
|
@@ -199,14 +199,14 @@ export const getModuleInterfaces = (app: App, state: any, moduleIndexList?: stri
|
|
|
199
199
|
const logicData = [] as { description: string; code: string; }[];
|
|
200
200
|
interfaceDependency?.interfaces?.forEach((interface_: any, index) => {
|
|
201
201
|
const interfaceIndex = `7-${moduleIndex}-${index}`;
|
|
202
|
-
if (hasModuleIndexList && !
|
|
202
|
+
if (hasModuleIndexList && !requiredIndexes?.includes(interfaceIndex)) return;
|
|
203
203
|
const description = interface_?.description || '';
|
|
204
|
-
const interfaceName =
|
|
205
|
-
const needNamespace =
|
|
204
|
+
const interfaceName = requiredIndexes?.length >= 0 ? interface_?.calleewholeKey : undefined;
|
|
205
|
+
const needNamespace = requiredIndexes?.length >= 0;
|
|
206
206
|
const tempCode = interface_?.toNaturalTS(createCompilerState('', { needNamespace }), interfaceName);
|
|
207
207
|
logicData.push({ description, code: tempCode });
|
|
208
208
|
|
|
209
|
-
if (
|
|
209
|
+
if (requiredIndexes?.includes(interfaceIndex)) {
|
|
210
210
|
code += getLogicStructures(interface_, 'interface', { description, codeStr: tempCode }, structureNamespace);
|
|
211
211
|
} else {
|
|
212
212
|
code += `[${interfaceIndex}]${description} ${tempCode}\n`;
|
|
@@ -219,8 +219,8 @@ export const getModuleInterfaces = (app: App, state: any, moduleIndexList?: stri
|
|
|
219
219
|
return { code, interfaceDependencies };
|
|
220
220
|
};
|
|
221
221
|
|
|
222
|
-
export const getConnectors = (app: App, state: any,
|
|
223
|
-
const hasModuleIndexList =
|
|
222
|
+
export const getConnectors = (app: App, state: any, requiredIndexes?: string[]) => {
|
|
223
|
+
const hasModuleIndexList = requiredIndexes?.length > 0;
|
|
224
224
|
const connections = [] as {
|
|
225
225
|
name: string;
|
|
226
226
|
structures: { namespace: string; data: { description: string; code: string; }[]; };
|
|
@@ -247,14 +247,14 @@ export const getConnectors = (app: App, state: any, moduleIndexList?: string[])
|
|
|
247
247
|
connection?.connector?.namespaces?.forEach((namespace: Namespace, namespaceIndex: number) => {
|
|
248
248
|
namespace?.logics?.forEach((logic: Logic, index) => {
|
|
249
249
|
const logicIndex = `8-${connectionIndex}-${namespaceIndex}-${index}`;
|
|
250
|
-
if (hasModuleIndexList && !
|
|
250
|
+
if (hasModuleIndexList && !requiredIndexes?.includes(logicIndex)) return;
|
|
251
251
|
const description = `${logic?.description || logic?.title || ''}`;
|
|
252
|
-
const logicName =
|
|
253
|
-
const needNamespace =
|
|
252
|
+
const logicName = requiredIndexes?.length >= 0 ? `${connection?.name}.${logic?.calleewholeKey}` : undefined;
|
|
253
|
+
const needNamespace = requiredIndexes?.length >= 0;
|
|
254
254
|
const tempCode = `${logic?.toNaturalTS(shiftState({ ...state, needNamespace }, code), 'inConnector', logicName)}`;
|
|
255
255
|
logicData.push({ description, code: tempCode });
|
|
256
256
|
|
|
257
|
-
if (
|
|
257
|
+
if (requiredIndexes?.includes(logicIndex)) {
|
|
258
258
|
code += getLogicStructures(logic, 'connector', { description, codeStr: tempCode }, structureNamespace);
|
|
259
259
|
} else {
|
|
260
260
|
code += `[${logicIndex}]${description} ${tempCode}`;
|
|
@@ -265,14 +265,14 @@ export const getConnectors = (app: App, state: any, moduleIndexList?: string[])
|
|
|
265
265
|
if (!connection?.connector?.namespaces?.length && connection?.connector?.logics?.length) {
|
|
266
266
|
connection?.connector?.logics.forEach((logic: Logic, index: number) => {
|
|
267
267
|
const logicIndex = `8-${connectionIndex}-${index}`;
|
|
268
|
-
if (hasModuleIndexList && !
|
|
268
|
+
if (hasModuleIndexList && !requiredIndexes?.includes(logicIndex)) return;
|
|
269
269
|
const description = logic?.description || '';
|
|
270
|
-
const logicName =
|
|
271
|
-
const needNamespace =
|
|
270
|
+
const logicName = requiredIndexes?.length >= 0 ? `${connection?.name}.${logic?.calleewholeKey}` : undefined;
|
|
271
|
+
const needNamespace = requiredIndexes?.length >= 0;
|
|
272
272
|
const tempCode = `${logic?.toNaturalTS(shiftState({ ...state, needNamespace }, code), 'inConnector', logicName)}`;
|
|
273
273
|
logicData.push({ description, code: tempCode });
|
|
274
274
|
|
|
275
|
-
if (
|
|
275
|
+
if (requiredIndexes?.includes(logicIndex)) {
|
|
276
276
|
code += getLogicStructures(logic, 'connector', { description, codeStr: tempCode }, structureNamespace);
|
|
277
277
|
} else {
|
|
278
278
|
code += `[${logicIndex}]${description} ${tempCode}`;
|
|
@@ -285,8 +285,8 @@ export const getConnectors = (app: App, state: any, moduleIndexList?: string[])
|
|
|
285
285
|
return { code, connections };
|
|
286
286
|
};
|
|
287
287
|
|
|
288
|
-
export const getDependencies = (app: App, state: any,
|
|
289
|
-
const hasModuleIndexList =
|
|
288
|
+
export const getDependencies = (app: App, state: any, requiredIndexes?: string[]) => {
|
|
289
|
+
const hasModuleIndexList = requiredIndexes?.length > 0;
|
|
290
290
|
const dependencies = [] as {
|
|
291
291
|
name: string;
|
|
292
292
|
structures: { namespace: string; data: { description: string; code: string; }[]; };
|
|
@@ -312,14 +312,14 @@ export const getDependencies = (app: App, state: any, moduleIndexList?: string[]
|
|
|
312
312
|
const logicData = [] as { description: string; code: string; }[];
|
|
313
313
|
module?.logics?.forEach((logic, index) => {
|
|
314
314
|
const logicIndex = `9-${moduleIndex}-${index}`;
|
|
315
|
-
if (hasModuleIndexList && !
|
|
315
|
+
if (hasModuleIndexList && !requiredIndexes?.includes(logicIndex)) return;
|
|
316
316
|
const description = logic?.description || '';
|
|
317
|
-
const logicName =
|
|
318
|
-
const needNamespace =
|
|
317
|
+
const logicName = requiredIndexes?.length >= 0 ? logic?.calleewholeKey : undefined;
|
|
318
|
+
const needNamespace = requiredIndexes?.length >= 0;
|
|
319
319
|
const tempCode = `${logic?.toNaturalTS(shiftState({ ...state, needNamespace }, code), 'inDependency', logicName)}`;
|
|
320
320
|
logicData.push({ description, code: tempCode });
|
|
321
321
|
|
|
322
|
-
if (
|
|
322
|
+
if (requiredIndexes?.includes(logicIndex)) {
|
|
323
323
|
code += getLogicStructures(logic, 'extension', { description, codeStr: tempCode }, structureNamespace);
|
|
324
324
|
} else {
|
|
325
325
|
code += `[${logicIndex}]${description} ${tempCode}`;
|
|
@@ -406,7 +406,7 @@ export const getCurrentNodeContext = (currentNode: BaseNode, focusedNodePath?: s
|
|
|
406
406
|
return { code: genTsBlock(code), currentLogic: code };
|
|
407
407
|
};
|
|
408
408
|
|
|
409
|
-
export function genNaturalTSContext(app: App, currentNode?: BaseNode, focusedNodePath?: string,
|
|
409
|
+
export function genNaturalTSContext(app: App, currentNode?: BaseNode, focusedNodePath?: string, requiredIndexes?: string[]) {
|
|
410
410
|
const frontend = currentNode?.getAncestor('Frontend') as Frontend;
|
|
411
411
|
const logicType = currentNode?.parentNode?.concept === 'App' ? 'global_logic' : 'view_logic';
|
|
412
412
|
const state = createCompilerState();
|
|
@@ -429,28 +429,28 @@ export function genNaturalTSContext(app: App, currentNode?: BaseNode, focusedNod
|
|
|
429
429
|
|
|
430
430
|
code += '\n### [5]全局上下文\n';
|
|
431
431
|
code += '\n#### [5-0]枚举\n';
|
|
432
|
-
code += getEnums(app, state,
|
|
432
|
+
code += getEnums(app, state, requiredIndexes).code;
|
|
433
433
|
|
|
434
434
|
code += '\n#### [5-1]实体\n';
|
|
435
|
-
code += getEntities(app, state,
|
|
435
|
+
code += getEntities(app, state, requiredIndexes).code;
|
|
436
436
|
|
|
437
437
|
code += '\n#### [5-2]可用的数据结构\n';
|
|
438
|
-
code += getStructures(app, state,
|
|
438
|
+
code += getStructures(app, state, requiredIndexes).code;
|
|
439
439
|
|
|
440
440
|
code += '\n### [6]服务端逻辑\n';
|
|
441
|
-
code += getLogics(app, currentNode,
|
|
441
|
+
code += getLogics(app, currentNode, requiredIndexes).code;
|
|
442
442
|
|
|
443
443
|
code += '\n### [7]可调用的接口列表\n';
|
|
444
|
-
code += getModuleInterfaces(app, state,
|
|
444
|
+
code += getModuleInterfaces(app, state, requiredIndexes).code;
|
|
445
445
|
|
|
446
446
|
if (app?.connections?.length > 0 && logicType === 'global_logic') {
|
|
447
447
|
code += '\n### [8]连接器逻辑列表\n';
|
|
448
|
-
code += getConnectors(app, state,
|
|
448
|
+
code += getConnectors(app, state, requiredIndexes).code;
|
|
449
449
|
}
|
|
450
450
|
|
|
451
451
|
if (app?.dependencies?.length > 0) {
|
|
452
452
|
code += '\n### [9]依赖库逻辑列表\n';
|
|
453
|
-
code += getDependencies(app, state,
|
|
453
|
+
code += getDependencies(app, state, requiredIndexes).code;
|
|
454
454
|
}
|
|
455
455
|
|
|
456
456
|
if (frontend) {
|
|
@@ -2,7 +2,7 @@ export const analyzeClaims = (params: any) => {
|
|
|
2
2
|
const { logicType } = params;
|
|
3
3
|
const claims = `
|
|
4
4
|
- Knowledge 是你的知识库,你可以参考,但是你最终制定的计划中禁止包含方法或者函数名
|
|
5
|
-
-
|
|
5
|
+
- requiredIndexes 用于下一步的具体实施,需要尽可能详细的返回所有和执行计划相关的模块或方法索引
|
|
6
6
|
- 如果用户没有特别指明是打印(日志/输出结果),"输出结果"一律按照"返回输出结果"处理
|
|
7
7
|
- 涉及到查询、获取数据时,先查找当前上下文[6/7/8/9]中是否有相关的方法,如果没有,再考虑实体的方法
|
|
8
8
|
- 实体的 get 方法一次只能获取一条数据,返回一个对象,无法返回列表。
|
|
@@ -14,12 +14,13 @@ export const analyzeClaims = (params: any) => {
|
|
|
14
14
|
const claimsMap = {
|
|
15
15
|
global_logic: `
|
|
16
16
|
- Knowledge 是你的知识库,你可以参考,但是你最终制定的计划中禁止包含方法或者函数名
|
|
17
|
-
-
|
|
17
|
+
- requiredIndexes 用于下一步的具体实施,需要尽可能详细的返回所有和执行计划相关的模块或方法索引
|
|
18
18
|
- 如果用户没有特别指明是打印(日志/输出结果),"输出结果"一律按照"返回输出结果"处理
|
|
19
19
|
- 如果用户的需求涉及定时或延时等操作,请提示用户:当前暂不支持定时或延时操作,请调整后重新输入。
|
|
20
20
|
- 如果用户的需求需要调用某个方法并且当前上下文中不存在时,请提示用户:当前应用中暂无该方法,请先导入相关依赖库或连接器模块
|
|
21
21
|
- 例如:加解密依赖库中的方法
|
|
22
|
-
- 当前逻辑类型下暂不支持跳转页面功能,请提示用户:
|
|
22
|
+
- 当前逻辑类型下暂不支持跳转页面功能,请提示用户: 如果需要跳转页面,请切换到前端页面逻辑或事件逻辑。
|
|
23
|
+
- 当前逻辑类型下暂不支持弹出消息/弹窗消息功能,请提示用户: 当前逻辑类型暂不支持此功能。
|
|
23
24
|
- 分析用户的需求,当需要从实体中获取或者查询数据时
|
|
24
25
|
- 优先使用 SQL 的查询和数据操纵能力: 例如 JOIN、SUM、GROUP_BY 等能力
|
|
25
26
|
- 使用 SQL 语句同时实现查询和计算
|
|
@@ -7,8 +7,8 @@ export const analyzeTasks = () => {
|
|
|
7
7
|
- text: 如果你认为需求不够明确时,可以继续询问用户需求的细节,不可为空
|
|
8
8
|
- executable
|
|
9
9
|
- 类型为 boolean, 如果你认为需求比较明确并且 plan 可执行, 返回 true, 否则返回 false
|
|
10
|
-
-
|
|
10
|
+
- requiredIndexes
|
|
11
11
|
- 类型为 Array, 你需要根据用户的执行计划,从 Context Definition 中整理出执行需要用到的模块或者方法,返回对应的索引
|
|
12
|
-
- 用于下一步的具体实施,需要尽可能详细的返回所有和执行计划相关的模块或方法索引。例如:"
|
|
12
|
+
- 用于下一步的具体实施,需要尽可能详细的返回所有和执行计划相关的模块或方法索引。例如:"requiredIndexes": ['1','6-3','8-1-1-0']。
|
|
13
13
|
`;
|
|
14
14
|
};
|
|
@@ -250,14 +250,12 @@ function delConnection(node: Connection) {
|
|
|
250
250
|
app.emit('collect:start', {
|
|
251
251
|
actionMsg: '删除连接器',
|
|
252
252
|
});
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
});
|
|
260
|
-
}
|
|
253
|
+
// 删除相关的触发器
|
|
254
|
+
app.triggerLaunchers.forEach((launcher) => {
|
|
255
|
+
if ((launcher as MsgTriggerLauncher).calleeConnectionName === node.name) {
|
|
256
|
+
launcher.delete();
|
|
257
|
+
}
|
|
258
|
+
});
|
|
261
259
|
node.delete();
|
|
262
260
|
app.emit('collect:end');
|
|
263
261
|
}
|
package/src/server/naslServer.ts
CHANGED
|
@@ -2758,6 +2758,11 @@ class NaslServer {
|
|
|
2758
2758
|
* @returns 处理后的结果
|
|
2759
2759
|
*/
|
|
2760
2760
|
private *_resolveDiagnosticWithGenerator(diagnostic: tsProtocol.DiagnosticWithFileName, fileNode: FileNode, record: DiagnosticRecord) {
|
|
2761
|
+
// 连接器只校验编辑态的连接器
|
|
2762
|
+
if (fileNode?.getAncestor('Connector') && !fileNode.getAncestor('Integration')) {
|
|
2763
|
+
return;
|
|
2764
|
+
}
|
|
2765
|
+
|
|
2761
2766
|
// 拓展模块中的翻译先过滤掉,因为有错用户也不能修改
|
|
2762
2767
|
if (((fileNode as any).module || (fileNode as any).connector) && !(fileNode instanceof ConfigProperty)) {
|
|
2763
2768
|
return;
|
|
@@ -4419,6 +4424,11 @@ class NaslServer {
|
|
|
4419
4424
|
|
|
4420
4425
|
this.logger.timeEnd('全量标注');
|
|
4421
4426
|
|
|
4427
|
+
// 测试环境打印数据
|
|
4428
|
+
if (utils.isTestBrowser) {
|
|
4429
|
+
this.logger.info('全量标注数据', json);
|
|
4430
|
+
}
|
|
4431
|
+
|
|
4422
4432
|
if (releaseFlag) {
|
|
4423
4433
|
// 全量标注后对json进行一些修改,为了服务端翻译处理
|
|
4424
4434
|
this.annotationToJson(typesMap, json);
|
|
@@ -31,7 +31,7 @@ export function genCreateFormTemplate(entity: Entity, nameGroup: NameGroup, sele
|
|
|
31
31
|
if (required) rules.push('required');
|
|
32
32
|
const rulesStr = rules.join(' | ');
|
|
33
33
|
|
|
34
|
-
let formItem = ` <u-form-item ${required ? ' required' : ''}${rulesStr.length ? ` rules="${rulesStr}"` : ''
|
|
34
|
+
let formItem = ` <u-form-item ${required ? ' :required="true"' : ''}${rulesStr.length ? ` rules="${rulesStr}"` : ''
|
|
35
35
|
} layout="center"><template #label><u-text text="${label}"></u-text></template>\n`;
|
|
36
36
|
|
|
37
37
|
const { typeAnnotation } = property || {};
|
|
@@ -121,7 +121,7 @@ export function genH5CreateFormTemplate(entity: Entity, nameGroup: NameGroup, se
|
|
|
121
121
|
if (required) rules.push('required');
|
|
122
122
|
const rulesStr = rules.join(' | ');
|
|
123
123
|
|
|
124
|
-
let formItem = ` <van-field drole="other" ${required ? ' required' : ''}${rulesStr.length ? ` rules="${rulesStr}"` : ''}>\n`;
|
|
124
|
+
let formItem = ` <van-field drole="other" ${required ? ' :required="true"' : ''}${rulesStr.length ? ` rules="${rulesStr}"` : ''}>\n`;
|
|
125
125
|
const { typeAnnotation } = property || {};
|
|
126
126
|
const { typeNamespace: propertyTypeNamespace } = typeAnnotation || {};
|
|
127
127
|
const propertyTypeName = transEntityMetadataTypes(typeAnnotation, dataSource.app);
|
|
@@ -137,7 +137,7 @@ function genSaveModalTemplate(entity: Entity, nameGroup: NameGroup, selectNameGr
|
|
|
137
137
|
const rulesStr = rules.join(' | ');
|
|
138
138
|
|
|
139
139
|
let formItem = `<u-form-item
|
|
140
|
-
${required ? 'required' : ''}
|
|
140
|
+
${required ? ':required="true"' : ''}
|
|
141
141
|
${rulesStr.length ? `rules="${rulesStr}"` : ''}
|
|
142
142
|
layout="center"
|
|
143
143
|
><template #label><u-text text="${label}"></u-text></template>`;
|
|
@@ -147,7 +147,7 @@ function genSaveModalTemplate(entity: Entity, nameGroup: NameGroup, selectNameGr
|
|
|
147
147
|
}
|
|
148
148
|
if (required) rules.push('required');
|
|
149
149
|
const rulesStr = rules.join(' | ');
|
|
150
|
-
let formItem = `<u-form-item ${required ? 'required' : ''} ${
|
|
150
|
+
let formItem = `<u-form-item ${required ? ':required="true"' : ''} ${
|
|
151
151
|
rulesStr.length ? `rules="${rulesStr}"` : ''
|
|
152
152
|
} layout="center"><template #label><u-text text="${label}"></u-text></template>`;
|
|
153
153
|
|
|
@@ -1094,7 +1094,7 @@ function genSaveModalTemplateDesigner(
|
|
|
1094
1094
|
}
|
|
1095
1095
|
if (required) rules.push('required');
|
|
1096
1096
|
const rulesStr = rules.join(' | ');
|
|
1097
|
-
let formItem = `<u-form-item ${required ? 'required' : ''} ${
|
|
1097
|
+
let formItem = `<u-form-item ${required ? ':required="true"' : ''} ${
|
|
1098
1098
|
rulesStr.length ? `rules="${rulesStr}"` : ''
|
|
1099
1099
|
} layout="center"><template #label><u-text text="${label}"></u-text></template>`;
|
|
1100
1100
|
|
|
@@ -31,7 +31,7 @@ export function genUpdateFormTemplate(entity: Entity, nameGroup: NameGroup, sele
|
|
|
31
31
|
if (required) rules.push('required');
|
|
32
32
|
const rulesStr = rules.join(' | ');
|
|
33
33
|
|
|
34
|
-
let formItem = ` <u-form-item ${required ? ' required' : ''}${rulesStr.length ? ` rules="${rulesStr}"` : ''
|
|
34
|
+
let formItem = ` <u-form-item ${required ? ' :required="true"' : ''}${rulesStr.length ? ` rules="${rulesStr}"` : ''
|
|
35
35
|
} layout="center"><template #label><u-text text="${label}"></u-text></template>\n`;
|
|
36
36
|
|
|
37
37
|
const { typeAnnotation } = property || {};
|
|
@@ -124,7 +124,7 @@ export function genH5UpdateFormTemplate(entity: Entity, nameGroup: NameGroup, se
|
|
|
124
124
|
if (required) rules.push('required');
|
|
125
125
|
const rulesStr = rules.join(' | ');
|
|
126
126
|
|
|
127
|
-
let formItem = ` <van-field drole="other" ${required ? ' required' : ''}${rulesStr.length ? ` rules="${rulesStr}"` : ''}>\n`;
|
|
127
|
+
let formItem = ` <van-field drole="other" ${required ? ' :required="true"' : ''}${rulesStr.length ? ` rules="${rulesStr}"` : ''}>\n`;
|
|
128
128
|
|
|
129
129
|
const { typeAnnotation } = property || {};
|
|
130
130
|
const { typeNamespace: propertyTypeNamespace } = typeAnnotation || {};
|
|
File without changes
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { isNode } from './env';
|
|
2
|
+
|
|
3
|
+
/** 主线程延迟 */
|
|
4
|
+
export function delay(time: number) {
|
|
5
|
+
return new Promise((resolve) => setTimeout(resolve, time));
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
let delaySwitch = (): void => void 0;
|
|
9
|
+
let worker: Worker;
|
|
10
|
+
|
|
11
|
+
if (!isNode) {
|
|
12
|
+
const workerCode = `
|
|
13
|
+
self.onmessage = function({ data: delay }) {
|
|
14
|
+
setTimeout(function() {
|
|
15
|
+
self.postMessage('Delayed');
|
|
16
|
+
}, delay);
|
|
17
|
+
}
|
|
18
|
+
`.trim();
|
|
19
|
+
|
|
20
|
+
worker = new Worker(URL.createObjectURL(new Blob([workerCode], { type: 'application/javascript' })));
|
|
21
|
+
worker.addEventListener('message', () => {
|
|
22
|
+
delaySwitch();
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Web Worker 延迟
|
|
28
|
+
*
|
|
29
|
+
* @description 和 setTimeout 相比,它能无视页面在后台导致的 setTimeout 暂停问题
|
|
30
|
+
* @description 仅在浏览器环境下有效;Nodejs 环境下等同于 setTimeout
|
|
31
|
+
*/
|
|
32
|
+
export function delayInWorker(time = 0) {
|
|
33
|
+
if (isNode) {
|
|
34
|
+
return delay(time);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return new Promise<void>((resolve) => {
|
|
38
|
+
worker.postMessage(time);
|
|
39
|
+
delaySwitch = resolve;
|
|
40
|
+
});
|
|
41
|
+
}
|
package/src/utils/env.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
/** 浏览器环境 */
|
|
2
|
+
export const isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
1
3
|
/** Node 环境 */
|
|
2
4
|
export const isNode = process.env.BUILD_TARGET === 'node' || !globalThis.window;
|
|
5
|
+
/** 是否是浏览器测试环境 */
|
|
6
|
+
export const isTestBrowser = isBrowser && (
|
|
7
|
+
/codewave-(test|dev)\.163yun\.com$/.test(location.hostname) ||
|
|
8
|
+
location.hostname.includes('localhost')
|
|
9
|
+
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isPageActive } from './page-state';
|
|
2
2
|
import { Performance } from './performance';
|
|
3
3
|
import {
|
|
4
4
|
getFrameMark,
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
NextState,
|
|
17
17
|
TheoreticalLimitCalculationCoefficient as Coefficient,
|
|
18
18
|
} from './constant';
|
|
19
|
+
import { delayInWorker } from '../delay';
|
|
19
20
|
|
|
20
21
|
/** 时间分片控制器 */
|
|
21
22
|
export class TimeSlicingController {
|
|
@@ -97,11 +98,12 @@ export class TimeSlicingController {
|
|
|
97
98
|
const { frame, group, async } = this;
|
|
98
99
|
|
|
99
100
|
// 页面处于活动状态
|
|
100
|
-
if (
|
|
101
|
+
if (isPageActive()) {
|
|
101
102
|
/** 帧剩余时间 */
|
|
102
103
|
const restFrameTime = Math.max(FrameMinTime - async.time - frame.time, 0);
|
|
103
104
|
/** 是否使用下一帧 */
|
|
104
105
|
const useNextFrame = restFrameTime < FrameIdleTime;
|
|
106
|
+
/** 下组任务状态 */
|
|
105
107
|
const state = useNextFrame ? NextState.NextFrame : NextState.MicroTask;
|
|
106
108
|
/** 增长系数计算的任务上限 */
|
|
107
109
|
const taskNumberByRatio = this.increaseRatio(group.limit);
|
|
@@ -273,7 +275,7 @@ export class TimeSlicingController {
|
|
|
273
275
|
}
|
|
274
276
|
else {
|
|
275
277
|
this.setFrameEnd();
|
|
276
|
-
|
|
278
|
+
delayInWorker(FrameIdleTime).then(runFrame);
|
|
277
279
|
}
|
|
278
280
|
};
|
|
279
281
|
/** 运行任务组 */
|
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
import { isNode } from '../env';
|
|
2
2
|
|
|
3
3
|
/** 页面活动状态 */
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
// 浏览器环境需要监听页面活动状态
|
|
7
|
-
if (!isNode) {
|
|
8
|
-
pageIsActive = !(document?.hidden ?? true);
|
|
9
|
-
document?.addEventListener('visibilitychange', () => {
|
|
10
|
-
pageIsActive = !document.hidden;
|
|
11
|
-
});
|
|
12
|
-
}
|
|
4
|
+
export const isPageActive = () => !isNode && !document.hidden;
|