@lcap/nasl 2.19.0-beta.1 → 2.19.0-beta.3
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/common/BaseNode.js +4 -1
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/Abort__.d.ts +25 -0
- package/out/concepts/Abort__.js +80 -0
- package/out/concepts/Abort__.js.map +1 -0
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/BatchAssignment__.js +3 -3
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/CallFunction__.js +23 -7
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.js +1 -1
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.js +9 -65
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/DatabaseTypeAnnotation__.d.ts +31 -0
- package/out/concepts/DatabaseTypeAnnotation__.js +78 -0
- package/out/concepts/DatabaseTypeAnnotation__.js.map +1 -0
- package/out/concepts/EnumItem__.d.ts +5 -5
- package/out/concepts/EnumItem__.js +6 -6
- package/out/concepts/Enum__.d.ts +20 -19
- package/out/concepts/Enum__.js +28 -1
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/ForEachStatement__.js +1 -1
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/FrontendLibrary__.d.ts +213 -0
- package/out/concepts/FrontendLibrary__.js +352 -0
- package/out/concepts/FrontendLibrary__.js.map +1 -0
- package/out/concepts/Frontend__.d.ts +373 -0
- package/out/concepts/Frontend__.js +685 -0
- package/out/concepts/Frontend__.js.map +1 -0
- package/out/concepts/Integration__.d.ts +53 -0
- package/out/concepts/Integration__.js +143 -0
- package/out/concepts/Integration__.js.map +1 -0
- package/out/concepts/JavaLogic__.d.ts +42 -0
- package/out/concepts/JavaLogic__.js +122 -0
- package/out/concepts/JavaLogic__.js.map +1 -0
- package/out/concepts/Logic__.js +3 -0
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MicroApp__.d.ts +51 -0
- package/out/concepts/MicroApp__.js +113 -0
- package/out/concepts/MicroApp__.js.map +1 -0
- package/out/concepts/NewComposite__.js +14 -14
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/NewList__.d.ts +1 -0
- package/out/concepts/NewList__.js +17 -1
- package/out/concepts/NewList__.js.map +1 -1
- package/out/concepts/NewMap__.d.ts +1 -0
- package/out/concepts/NewMap__.js +18 -1
- package/out/concepts/NewMap__.js.map +1 -1
- package/out/concepts/OqlQueryComponent__.js +2 -0
- package/out/concepts/OqlQueryComponent__.js.map +1 -1
- package/out/concepts/StringInterpolation__.js +2 -0
- package/out/concepts/StringInterpolation__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.js +3 -3
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/ViewBlock__.d.ts +35 -0
- package/out/concepts/ViewBlock__.js +85 -0
- package/out/concepts/ViewBlock__.js.map +1 -0
- package/out/concepts/ViewElement__.js +1 -1
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.js +1 -0
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.util.js +4 -2
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/generator/genBundleFiles.js +10 -1
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genReleaseBody.js +3 -0
- package/out/generator/genReleaseBody.js.map +1 -1
- package/out/generator/icestark.d.ts +2 -0
- package/out/generator/icestark.js +48 -0
- package/out/generator/icestark.js.map +1 -0
- package/out/generator/microApp.d.ts +2 -0
- package/out/generator/microApp.js +35 -0
- package/out/generator/microApp.js.map +1 -0
- package/out/generator/qiankun.d.ts +2 -0
- package/out/generator/qiankun.js +52 -0
- package/out/generator/qiankun.js.map +1 -0
- package/out/manager/stepRecorder.d.ts +20 -0
- package/out/manager/stepRecorder.js +110 -0
- package/out/manager/stepRecorder.js.map +1 -0
- package/out/sentry/index.d.ts +29 -0
- package/out/sentry/index.js +111 -0
- package/out/sentry/index.js.map +1 -0
- package/out/server/extendBaseNode.js +5 -1
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/formatTsUtils.js +11 -8
- package/out/server/formatTsUtils.js.map +1 -1
- package/out/server/naslServer.js +118 -9
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js +43 -10
- package/out/server/translator.js.map +1 -1
- package/out/service/creator/add.configs.js +2 -0
- package/out/service/creator/add.configs.js.map +1 -1
- package/out/service/creator/errHandles.js +5 -0
- package/out/service/creator/errHandles.js.map +1 -1
- package/out/service/creator/index.js +2 -0
- package/out/service/creator/index.js.map +1 -1
- package/out/service/storage/api.d.ts +18 -0
- package/out/service/storage/api.js +12 -0
- package/out/service/storage/api.js.map +1 -1
- package/out/service/storage/init.d.ts +41 -1
- package/out/service/storage/init.js +175 -30
- package/out/service/storage/init.js.map +1 -1
- package/out/service/storage/service.d.ts +9 -1
- package/out/service/storage/service.js +27 -1
- package/out/service/storage/service.js.map +1 -1
- package/out/templator/genGetBlock.js +1 -1
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genListViewBlock.js +6 -0
- package/out/templator/genListViewBlock.js.map +1 -1
- package/package.json +2 -2
- package/sandbox/stdlib/nasl.core.ts +2 -0
- package/sandbox/stdlib/nasl.oql.ts +16 -4
- package/sandbox/stdlib/nasl.util.ts +2 -1
- package/src/common/BaseNode.ts +3 -1
- package/src/concepts/App__.ts +41 -1
- package/src/concepts/BatchAssignment__.ts +3 -3
- package/src/concepts/CallFunction__.ts +34 -20
- package/src/concepts/CallInterface__.ts +19 -1
- package/src/concepts/CallLogic__.ts +8 -65
- package/src/concepts/EnumItem__.ts +6 -6
- package/src/concepts/Enum__.ts +22 -19
- package/src/concepts/ForEachStatement__.ts +1 -1
- package/src/concepts/Logic__.ts +13 -10
- package/src/concepts/NewComposite__.ts +14 -14
- package/src/concepts/NewList__.ts +18 -1
- package/src/concepts/NewMap__.ts +19 -1
- package/src/concepts/OqlQueryComponent__.ts +2 -0
- package/src/concepts/StringInterpolation__.ts +6 -4
- package/src/concepts/TypeAnnotation__.ts +41 -3
- package/src/concepts/ViewElement__.ts +1 -1
- package/src/concepts/View__.ts +3 -2
- package/src/concepts/basics/stdlib/nasl.util.ts +4 -2
- package/src/generator/genBundleFiles.ts +10 -1
- package/src/generator/genReleaseBody.ts +3 -1
- package/src/server/extendBaseNode.ts +4 -1
- package/src/server/formatTsUtils.ts +11 -8
- package/src/server/naslServer.ts +124 -11
- package/src/server/translator.ts +37 -10
- package/src/service/creator/add.configs.js +3 -0
- package/src/service/creator/errHandles.js +6 -0
- package/src/service/creator/index.js +3 -0
- package/src/service/storage/api.js +12 -0
- package/src/service/storage/init.ts +207 -29
- package/src/service/storage/service.ts +29 -1
- package/src/templator/genGetBlock.ts +1 -1
- package/src/templator/genListViewBlock.ts +6 -0
- package/ts-worker/lib/tsserver.js +10 -2
- package/ts-worker/package.json +1 -0
- package/ts-worker/webpack.config.js +11 -2
- package/sandbox/stdlib/dist/nasl.logging.js +0 -0
- package/sandbox/stdlib/dist/nasl.util.js +0 -0
- package/src/automate/engine/dist/index.dev.js +0 -517
- package/src/common/dist/BaseNode.js +0 -1101
- package/src/concepts/basics/stdlib/dist/nasl.util.js +0 -1602
- package/src/concepts/basics/stdlib/dist/reference2TypeAnnotationList.js +0 -24
- package/src/concepts/dist/BindAttribute__.js +0 -760
- package/src/concepts/dist/BindEvent__.js +0 -732
- package/src/concepts/dist/CallFunction__.js +0 -527
- package/src/concepts/dist/CallLogic__.js +0 -932
- package/src/concepts/dist/Identifier__.js +0 -311
- package/src/concepts/dist/StringInterpolation__.js +0 -231
- package/src/concepts/dist/TypeAnnotation__.js +0 -834
- package/src/concepts/dist/ViewElement__.js +0 -1692
- package/src/concepts/dist/View__.js +0 -1601
- package/src/generator/dist/genBundleFiles.js +0 -261
- package/src/generator/dist/genMetaData.js +0 -245
- package/src/generator/dist/permission.js +0 -392
- package/src/server/dist/naslServer.js +0 -3590
- package/src/service/storage/dist/init.js +0 -579
- package/src/templator/dist/genEditTableBlock.js +0 -204
- package/src/templator/dist/genGridViewBlock.js +0 -265
- package/src/templator/dist/genListViewBlock.js +0 -84
- package/src/templator/dist/genTableBlock.js +0 -209
- package/src/templator/dist/utils.js +0 -527
- package/ts-worker/dist/webpack.config.dev.js +0 -106
- /package/src/service/{dataSource → datasource}/api.js +0 -0
- /package/src/service/{dataSource → datasource}/index.js +0 -0
|
@@ -3,6 +3,7 @@ import { getConceptConstructor } from '../../decorators';
|
|
|
3
3
|
import { config } from '../../config';
|
|
4
4
|
import Vue from 'vue';
|
|
5
5
|
import storageService from './service';
|
|
6
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
6
7
|
/// #if !process.env.NODE_ENV || process.env.BUILD_TARGET === 'node'
|
|
7
8
|
import * as fs from 'fs-extra';
|
|
8
9
|
import * as jsoner from './jsoner';
|
|
@@ -10,6 +11,9 @@ import * as jsoner from './jsoner';
|
|
|
10
11
|
|
|
11
12
|
export const batchQuery = storageService.batchQuery;
|
|
12
13
|
export const batchAction = storageService.batchAction;
|
|
14
|
+
export const batchInstruct = storageService.batchInstruct;
|
|
15
|
+
|
|
16
|
+
let tabTimestamp: string;
|
|
13
17
|
|
|
14
18
|
function getLogic(key: string, app: any, diffLogicList: string[]) {
|
|
15
19
|
if (!diffLogicList.includes(key)) {
|
|
@@ -75,6 +79,9 @@ function getStatement(state: any, app: any, diffLogicList: string[]) {
|
|
|
75
79
|
case 'CallInterface':
|
|
76
80
|
logicItems = state.arguments?.map((item: Argument) => item.expression);
|
|
77
81
|
break;
|
|
82
|
+
case 'ExternalDestination':
|
|
83
|
+
logicItems = [state.anchor, state.link];
|
|
84
|
+
break;
|
|
78
85
|
case 'BatchAssignment':
|
|
79
86
|
logicItems = [state.left?.expression, ...state.left?.members, ...state.rights.map((item: SelectMembers) => [item?.expression, ...item?.members]).flat(1)];
|
|
80
87
|
break;
|
|
@@ -114,7 +121,6 @@ function getMiniAppChange(target: any, obj: any, action: string) {
|
|
|
114
121
|
* 执行更新
|
|
115
122
|
*/
|
|
116
123
|
async function doAction(app: any, actionItem: any) {
|
|
117
|
-
app.emit('saving');
|
|
118
124
|
let hasFrontEnd = false;
|
|
119
125
|
let hasBackEnd = false;
|
|
120
126
|
const actionList: any[] = [];
|
|
@@ -252,9 +258,186 @@ async function doAction(app: any, actionItem: any) {
|
|
|
252
258
|
}
|
|
253
259
|
} catch (error) {
|
|
254
260
|
console.log(error);
|
|
261
|
+
taskQueue.refreshNasl(app, {
|
|
262
|
+
errorInfo: {
|
|
263
|
+
message: error?.message,
|
|
264
|
+
stack: error?.stack,
|
|
265
|
+
},
|
|
266
|
+
});
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const instructList = [{
|
|
271
|
+
uuid: uuidv4().replace(/-/g, ''),
|
|
272
|
+
actions: actionList,
|
|
273
|
+
}];
|
|
274
|
+
saveNasl({app, hasFrontEnd, hasBackEnd, instructList });
|
|
275
|
+
|
|
276
|
+
if (!app._historying) {
|
|
277
|
+
if (app._historyIndex !== app._historyList.length) {
|
|
278
|
+
app._historyList = app._historyList.splice(0, app._historyIndex);
|
|
279
|
+
}
|
|
280
|
+
app._historyList.push({
|
|
281
|
+
actionMsg,
|
|
282
|
+
list: list.map((item: any) => item.originEvent),
|
|
283
|
+
});
|
|
284
|
+
app._historyIndex = app._historyList.length;
|
|
285
|
+
} else {
|
|
286
|
+
const actionMap = {
|
|
287
|
+
undo: '已撤销操作:',
|
|
288
|
+
redo: '已重做操作:',
|
|
289
|
+
};
|
|
290
|
+
let msg = actionMap[action as 'undo' | 'redo'];
|
|
291
|
+
msg += actionMsg;
|
|
292
|
+
Vue.prototype.$toast.info(msg);
|
|
293
|
+
app._historying = false;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
type Instruct = {
|
|
298
|
+
uuid: string,
|
|
299
|
+
actions: any[],
|
|
300
|
+
};
|
|
301
|
+
type TaskOption = {
|
|
302
|
+
app: any,
|
|
303
|
+
hasFrontEnd: boolean,
|
|
304
|
+
hasBackEnd: boolean,
|
|
305
|
+
instructList: Instruct[],
|
|
306
|
+
};
|
|
307
|
+
enum TaskQueueStatus {
|
|
308
|
+
ExceedMaxTaskCount,
|
|
309
|
+
Retrying,
|
|
310
|
+
};
|
|
311
|
+
type RefreshNaslOptions = {
|
|
312
|
+
errorInfo: {
|
|
313
|
+
message?: string,
|
|
314
|
+
stack?: string,
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
class TaskQueue {
|
|
319
|
+
queue: TaskOption[] = []
|
|
320
|
+
lastQueue: TaskOption[] = []
|
|
321
|
+
running: Boolean = false
|
|
322
|
+
maxTaskCount: number = 10
|
|
323
|
+
status?: TaskQueueStatus = undefined
|
|
324
|
+
|
|
325
|
+
addTask(task: TaskOption) {
|
|
326
|
+
this.queue.push(task);
|
|
327
|
+
|
|
328
|
+
if(this.queue.length >= this.maxTaskCount) {
|
|
329
|
+
this.status = TaskQueueStatus.ExceedMaxTaskCount;
|
|
330
|
+
task.app.emit('ExceedMaxTaskCount');
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
this.run();
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
clear() {
|
|
337
|
+
this.queue = [];
|
|
338
|
+
this.lastQueue = [];
|
|
339
|
+
this.status = undefined;
|
|
340
|
+
this.running = false;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
async run(queue = this.queue) {
|
|
344
|
+
if(this.running) return;
|
|
345
|
+
if(queue.length === 0) return;
|
|
346
|
+
|
|
347
|
+
const app = queue[0].app;
|
|
348
|
+
let hasFrontEnd = false;
|
|
349
|
+
let hasBackEnd = false;
|
|
350
|
+
let instructList: Instruct[] = [];
|
|
351
|
+
|
|
352
|
+
for(const task of queue) {
|
|
353
|
+
if(task.hasFrontEnd) hasFrontEnd = true;
|
|
354
|
+
if(task.hasBackEnd) hasBackEnd = true;
|
|
355
|
+
instructList = instructList.concat(task.instructList);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
if(queue === this.queue) {
|
|
359
|
+
this.lastQueue = [...queue];
|
|
360
|
+
this.queue = [];
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
this.running = true;
|
|
364
|
+
const error = await _saveNasl({
|
|
365
|
+
app, hasFrontEnd, hasBackEnd, instructList,
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
// code: 401650, 检测到当前应用拉取操作已被强制结束, 用户确认后再刷新
|
|
369
|
+
// code: 500502 msg: "该应用已在新tab 页打开,请刷新!" 不重试或刷新
|
|
370
|
+
if(!error)
|
|
371
|
+
this.recover(app);
|
|
372
|
+
else if (![401650, 500502].includes(error.code)) {
|
|
373
|
+
// 连接失败,或超时,或后端持久化异常
|
|
374
|
+
if((error.message === 'Network Error' || error.message?.includes('timeout') || error.code === 500500)
|
|
375
|
+
&& this.status !== TaskQueueStatus.Retrying) {
|
|
376
|
+
this.running = false;
|
|
377
|
+
this.retry();
|
|
378
|
+
} else
|
|
379
|
+
this.refreshNasl(app);
|
|
380
|
+
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
this.running = false;
|
|
385
|
+
|
|
386
|
+
this.run();
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
retry() {
|
|
390
|
+
if(this.lastQueue.length === 0) return;
|
|
391
|
+
|
|
392
|
+
const app = this.lastQueue[0].app;
|
|
393
|
+
this.status = TaskQueueStatus.Retrying;
|
|
394
|
+
app.emit('Retrying');
|
|
395
|
+
this.run(this.lastQueue);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
async refreshNasl(app: App, options: RefreshNaslOptions = { errorInfo: {} }) {
|
|
399
|
+
const failedQueue = this.lastQueue.map(({ hasFrontEnd, hasBackEnd, instructList }) => ({
|
|
400
|
+
hasFrontEnd, hasBackEnd, instructList,
|
|
401
|
+
}));
|
|
402
|
+
const queue = this.queue.map(({ hasFrontEnd, hasBackEnd, instructList }) => ({
|
|
403
|
+
hasFrontEnd, hasBackEnd, instructList,
|
|
404
|
+
}));
|
|
405
|
+
await storageService.saveFrontendNasl({
|
|
406
|
+
body: {
|
|
407
|
+
nasl: app.toJSON(),
|
|
408
|
+
failedQueue,
|
|
409
|
+
queue,
|
|
410
|
+
errorInfo: options.errorInfo,
|
|
411
|
+
},
|
|
412
|
+
}).catch((err: any) => {
|
|
413
|
+
console.log('备份 nasl 失败:', err);
|
|
414
|
+
});
|
|
415
|
+
this.clear();
|
|
255
416
|
app.emit('refresh');
|
|
256
417
|
}
|
|
257
418
|
|
|
419
|
+
recover(app: App) {
|
|
420
|
+
switch(this.status) {
|
|
421
|
+
case TaskQueueStatus.ExceedMaxTaskCount:
|
|
422
|
+
app.emit('BelowMaxTaskCount');
|
|
423
|
+
this.status = undefined;
|
|
424
|
+
break;
|
|
425
|
+
case TaskQueueStatus.Retrying:
|
|
426
|
+
app.emit('SuccessRetry');
|
|
427
|
+
this.status = undefined;
|
|
428
|
+
break;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
export const taskQueue = new TaskQueue();
|
|
434
|
+
async function saveNasl(options: TaskOption) {
|
|
435
|
+
taskQueue.addTask(options);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
async function _saveNasl(options: TaskOption) {
|
|
439
|
+
const { app, hasFrontEnd, hasBackEnd, instructList } = options;
|
|
440
|
+
app.emit('saving');
|
|
258
441
|
let ChangedNASLType = '';
|
|
259
442
|
if (hasFrontEnd && hasBackEnd) {
|
|
260
443
|
ChangedNASLType = 'both';
|
|
@@ -266,50 +449,35 @@ async function doAction(app: any, actionItem: any) {
|
|
|
266
449
|
let err;
|
|
267
450
|
if (config.storage.protocol === 'http') {
|
|
268
451
|
try {
|
|
269
|
-
await storageService.
|
|
270
|
-
body:
|
|
452
|
+
await storageService.batchInstruct({
|
|
453
|
+
body: instructList,
|
|
271
454
|
headers: {
|
|
272
455
|
appId: app.id,
|
|
273
456
|
ChangedNASLType,
|
|
457
|
+
tabTimestamp,
|
|
274
458
|
// 其他封装在 storageService 里了
|
|
275
459
|
},
|
|
276
460
|
});
|
|
277
461
|
} catch (error) {
|
|
278
462
|
err = error;
|
|
279
|
-
|
|
280
|
-
// 401650, 检测到当前应用拉取操作已被强制结束, 用户确认后再刷新
|
|
281
|
-
if (error?.code !== 401650)
|
|
282
|
-
app.emit('refresh');
|
|
283
463
|
}
|
|
284
464
|
} else if (config.storage.protocol === 'mock') {
|
|
285
465
|
// Do nothing
|
|
286
466
|
} else {
|
|
287
467
|
const json = await fs.readJSON(config.storage.basePath);
|
|
468
|
+
|
|
469
|
+
let actionList: any[] = [];
|
|
470
|
+
for(const { actions } of instructList) {
|
|
471
|
+
actionList = actionList.concat(actions);
|
|
472
|
+
}
|
|
473
|
+
|
|
288
474
|
jsoner.batchAction(json, actionList);
|
|
289
475
|
await fs.writeJSON(config.storage.basePath, json, {
|
|
290
476
|
spaces: 4,
|
|
291
477
|
});
|
|
292
478
|
}
|
|
293
479
|
app.emit('saved', err);
|
|
294
|
-
|
|
295
|
-
if (app._historyIndex !== app._historyList.length) {
|
|
296
|
-
app._historyList = app._historyList.splice(0, app._historyIndex);
|
|
297
|
-
}
|
|
298
|
-
app._historyList.push({
|
|
299
|
-
actionMsg,
|
|
300
|
-
list: list.map((item: any) => item.originEvent),
|
|
301
|
-
});
|
|
302
|
-
app._historyIndex = app._historyList.length;
|
|
303
|
-
} else {
|
|
304
|
-
const actionMap = {
|
|
305
|
-
undo: '已撤销操作:',
|
|
306
|
-
redo: '已重做操作:',
|
|
307
|
-
};
|
|
308
|
-
let msg = actionMap[action as 'undo' | 'redo'];
|
|
309
|
-
msg += actionMsg;
|
|
310
|
-
Vue.prototype.$toast.info(msg);
|
|
311
|
-
app._historying = false;
|
|
312
|
-
}
|
|
480
|
+
return err;
|
|
313
481
|
}
|
|
314
482
|
|
|
315
483
|
export function handleApp(app: any) {
|
|
@@ -341,7 +509,11 @@ export function handleApp(app: any) {
|
|
|
341
509
|
if (!app._noTimer) {
|
|
342
510
|
app._timer = setTimeout(() => {
|
|
343
511
|
console.error('收集超时,请及时排查原因');
|
|
344
|
-
|
|
512
|
+
taskQueue.refreshNasl(app, {
|
|
513
|
+
errorInfo: {
|
|
514
|
+
message: '收集超时,请及时排查原因',
|
|
515
|
+
}
|
|
516
|
+
});
|
|
345
517
|
}, 2500);
|
|
346
518
|
}
|
|
347
519
|
if (!app._isCollectingCount) {
|
|
@@ -430,7 +602,7 @@ export async function loadApp(appId?: string) {
|
|
|
430
602
|
let app: App;
|
|
431
603
|
if (config.storage.protocol === 'http') {
|
|
432
604
|
// 请求
|
|
433
|
-
const
|
|
605
|
+
const res = await storageService.batchQuery({
|
|
434
606
|
body: [
|
|
435
607
|
{
|
|
436
608
|
path: 'app',
|
|
@@ -439,10 +611,16 @@ export async function loadApp(appId?: string) {
|
|
|
439
611
|
],
|
|
440
612
|
headers: {
|
|
441
613
|
appId,
|
|
614
|
+
checkTabOpenTime: 'true',
|
|
442
615
|
// 其他封装在 storageService 里了
|
|
443
616
|
},
|
|
617
|
+
config: {
|
|
618
|
+
shortResponse: false,
|
|
619
|
+
},
|
|
444
620
|
});
|
|
445
|
-
|
|
621
|
+
|
|
622
|
+
tabTimestamp = res?.headers?.tabtimestamp;
|
|
623
|
+
const data = res?.data?.result;
|
|
446
624
|
app = new App(Object.assign(data?.[0], { id: appId }));
|
|
447
625
|
} else if (config.storage.protocol === 'mock') {
|
|
448
626
|
app = new App({
|
|
@@ -4,7 +4,7 @@ import api from './api';
|
|
|
4
4
|
const service = createService(api);
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
|
-
batchQuery({ body, headers }: { body: Array<any>, headers: Record<string, string
|
|
7
|
+
batchQuery({ body, headers, config }: { body: Array<any>, headers: Record<string, string>, config?: object }) {
|
|
8
8
|
const appData = (window as any).appData;
|
|
9
9
|
|
|
10
10
|
return service.batchQuery({
|
|
@@ -15,6 +15,7 @@ export default {
|
|
|
15
15
|
'request-versionChangedTime': appData?.versionChangedTime || '',
|
|
16
16
|
operateArea: appData?.branchStatus === 'merging' ? 'merge_conflict' : '',
|
|
17
17
|
}, headers),
|
|
18
|
+
config,
|
|
18
19
|
});
|
|
19
20
|
},
|
|
20
21
|
batchAction({ body, headers }: { body: Array<any>, headers: Record<string, string> }) {
|
|
@@ -30,4 +31,31 @@ export default {
|
|
|
30
31
|
}, headers),
|
|
31
32
|
});
|
|
32
33
|
},
|
|
34
|
+
batchInstruct({ body, headers }: { body: Array<any>, headers: Record<string, string> }) {
|
|
35
|
+
const appData = (window as any).appData;
|
|
36
|
+
|
|
37
|
+
return service.batchInstruct({
|
|
38
|
+
body,
|
|
39
|
+
headers: Object.assign({
|
|
40
|
+
appId: appData?.appId,
|
|
41
|
+
'request-appBaseVersion': (window as any).appData?.baseVersion || '',
|
|
42
|
+
'request-versionChangedTime': (window as any).appData?.versionChangedTime || '',
|
|
43
|
+
operateArea: (window as any).appData?.branchStatus === 'merging' ? 'merge_conflict' : '',
|
|
44
|
+
}, headers),
|
|
45
|
+
config: {
|
|
46
|
+
timeout: 1000 * 60,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
saveFrontendNasl({ body }: { body: any }) {
|
|
51
|
+
const appData = (window as any).appData;
|
|
52
|
+
|
|
53
|
+
return service.saveFrontendNasl({
|
|
54
|
+
body,
|
|
55
|
+
headers: {
|
|
56
|
+
appId: appData?.appId,
|
|
57
|
+
skipVersionCheck: true,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
}
|
|
33
61
|
};
|
|
@@ -14,7 +14,7 @@ export function genGetTemplate(entity: Entity, nameGroup: NameGroup) {
|
|
|
14
14
|
.map((property) => {
|
|
15
15
|
const valueExpression = `${nameGroup.viewVariableEntity}.${property.name}`;
|
|
16
16
|
let formItem = ` <u-info-list-item><template #label><u-text text="${property.label || property.name}"></u-text></template>`;
|
|
17
|
-
formItem += `<u-text :text="
|
|
17
|
+
formItem += `<u-text :text="${valueExpression}"></u-text>`;
|
|
18
18
|
formItem += ` </u-info-list-item>\n`;
|
|
19
19
|
return formItem;
|
|
20
20
|
})
|
|
@@ -35,6 +35,12 @@ export function genH5ListViewTemplate(property: EntityProperty, nameGroup: NameG
|
|
|
35
35
|
<template #title>{{ ${valueExpression} }}</template>
|
|
36
36
|
</van-cell>
|
|
37
37
|
</template>
|
|
38
|
+
<template #prev>
|
|
39
|
+
上一页
|
|
40
|
+
</template>
|
|
41
|
+
<template #next>
|
|
42
|
+
下一页
|
|
43
|
+
</template>
|
|
38
44
|
</van-list-view>`;
|
|
39
45
|
}
|
|
40
46
|
|
|
@@ -171847,6 +171847,9 @@ var ts;
|
|
|
171847
171847
|
ProjectService.prototype.doEnsureDefaultProjectForFile = function (fileName) {
|
|
171848
171848
|
this.ensureProjectStructuresUptoDate();
|
|
171849
171849
|
var scriptInfo = this.getScriptInfoForNormalizedPath(fileName);
|
|
171850
|
+
if (!scriptInfo) {
|
|
171851
|
+
console.log(fileName);
|
|
171852
|
+
}
|
|
171850
171853
|
return scriptInfo ? scriptInfo.getDefaultProject() : (this.logErrorForScriptInfoNotFound(fileName), server.Errors.ThrowNoProject());
|
|
171851
171854
|
};
|
|
171852
171855
|
ProjectService.prototype.getScriptInfoEnsuringProjectsUptoDate = function (uncheckedFileName) {
|
|
@@ -176745,7 +176748,7 @@ var ts;
|
|
|
176745
176748
|
if (left) {
|
|
176746
176749
|
typeInfo.typeNamespace = analyzeTypeNameSpace(left);
|
|
176747
176750
|
}
|
|
176748
|
-
} else if(Array.isArray(types)) {
|
|
176751
|
+
} else if (Array.isArray(types)) {
|
|
176749
176752
|
typeInfo.typeName = 'Union';
|
|
176750
176753
|
} else {
|
|
176751
176754
|
typeInfo.typeKind = 'anonymousStructure';
|
|
@@ -176897,7 +176900,10 @@ var ts;
|
|
|
176897
176900
|
}
|
|
176898
176901
|
}
|
|
176899
176902
|
}
|
|
176900
|
-
} else if (
|
|
176903
|
+
} else if ([
|
|
176904
|
+
2048/* SymbolFlags.TypeLiteral */,
|
|
176905
|
+
4096 /* SymbolFlags.ObjectLiteral */
|
|
176906
|
+
].includes(flags)) {
|
|
176901
176907
|
if (objectFlags & 16 /* ObjectFlags.Anonymous */) {
|
|
176902
176908
|
const typeNode = typeChecker.typeToTypeNode(type, enclosingDeclaration, toNodeBuilderFlags(typeFlags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 0);
|
|
176903
176909
|
const { members } = typeNode || {};
|
|
@@ -176981,6 +176987,8 @@ var ts;
|
|
|
176981
176987
|
206, /* SyntaxKind.PropertyAccessExpression */
|
|
176982
176988
|
208, /* SyntaxKind.CallExpression */
|
|
176983
176989
|
209, /* SyntaxKind.NewExpression */
|
|
176990
|
+
212, /* SyntaxKind.ParenthesizedExpression */
|
|
176991
|
+
213, /* SyntaxKind.FunctionExpression */
|
|
176984
176992
|
].includes(node.kind)) {
|
|
176985
176993
|
const result = ts.isCallLikeExpression(node);
|
|
176986
176994
|
if (result) {
|
package/ts-worker/package.json
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
|
+
const pkg = require('./package.json');
|
|
2
3
|
// const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
4
|
+
const TerserPlugin = require('terser-webpack-plugin');
|
|
3
5
|
|
|
4
6
|
module.exports = {
|
|
5
7
|
//mode: 'development',
|
|
@@ -8,8 +10,8 @@ module.exports = {
|
|
|
8
10
|
bundle: './src/index.js',
|
|
9
11
|
},
|
|
10
12
|
output: {
|
|
11
|
-
path: path.resolve(__dirname, '../../../src/static/'),
|
|
12
|
-
filename:
|
|
13
|
+
path: path.resolve(__dirname, '../../../src/static/ts-worker'),
|
|
14
|
+
filename: `${pkg.version}.js`,
|
|
13
15
|
},
|
|
14
16
|
target: 'webworker',
|
|
15
17
|
resolve: {
|
|
@@ -104,4 +106,11 @@ module.exports = {
|
|
|
104
106
|
},
|
|
105
107
|
},
|
|
106
108
|
},
|
|
109
|
+
optimization: {
|
|
110
|
+
minimizer: [
|
|
111
|
+
new TerserPlugin({
|
|
112
|
+
extractComments: false,
|
|
113
|
+
}),
|
|
114
|
+
],
|
|
115
|
+
},
|
|
107
116
|
};
|
|
File without changes
|
|
File without changes
|