verteilen-core 1.4.21 → 1.4.23
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/dist/client/analysis.d.ts +0 -17
- package/dist/client/analysis.js +0 -22
- package/dist/client/client.d.ts +0 -17
- package/dist/client/client.js +4 -34
- package/dist/client/cluster.d.ts +0 -3
- package/dist/client/cluster.js +0 -32
- package/dist/client/database.d.ts +0 -16
- package/dist/client/database.js +0 -16
- package/dist/client/execute.d.ts +0 -33
- package/dist/client/execute.js +0 -38
- package/dist/client/javascript.d.ts +0 -23
- package/dist/client/javascript.js +0 -34
- package/dist/client/job_database.d.ts +0 -4
- package/dist/client/job_database.js +0 -4
- package/dist/client/job_execute.d.ts +0 -28
- package/dist/client/job_execute.js +0 -29
- package/dist/client/os.d.ts +0 -26
- package/dist/client/os.js +0 -32
- package/dist/client/resource.d.ts +0 -3
- package/dist/client/resource.js +0 -8
- package/dist/client/shell.d.ts +0 -16
- package/dist/client/shell.js +0 -21
- package/dist/computed.d.ts +0 -13
- package/dist/computed.js +0 -13
- package/dist/index.js +0 -4
- package/dist/interface/base.d.ts +0 -261
- package/dist/interface/base.js +0 -8
- package/dist/interface/bus.d.ts +0 -73
- package/dist/interface/enum.d.ts +0 -67
- package/dist/interface/enum.js +0 -74
- package/dist/interface/execute.d.ts +0 -46
- package/dist/interface/log.d.ts +0 -54
- package/dist/interface/plugin.d.ts +0 -192
- package/dist/interface/record.d.ts +0 -13
- package/dist/interface/server.d.ts +0 -20
- package/dist/interface/server.js +0 -8
- package/dist/interface/struct.d.ts +1 -140
- package/dist/interface/table.d.ts +0 -39
- package/dist/interface/ui.d.ts +0 -104
- package/dist/interface/ui.js +0 -8
- package/dist/interface.d.ts +0 -30
- package/dist/interface.js +0 -35
- package/dist/plugins/i18n.d.ts +0 -19
- package/dist/plugins/i18n.js +0 -24
- package/dist/script/console_manager.d.ts +0 -3
- package/dist/script/console_manager.js +0 -3
- package/dist/script/console_server_manager.d.ts +0 -3
- package/dist/script/console_server_manager.js +0 -3
- package/dist/script/execute/base.d.ts +2 -98
- package/dist/script/execute/base.js +0 -105
- package/dist/script/execute/feedback.d.ts +0 -34
- package/dist/script/execute/feedback.js +0 -46
- package/dist/script/execute/region_job.js +0 -6
- package/dist/script/execute/region_project.js +0 -17
- package/dist/script/execute/region_subtask.js +0 -5
- package/dist/script/execute/region_task.d.ts +5 -41
- package/dist/script/execute/region_task.js +0 -75
- package/dist/script/execute/runner.d.ts +0 -7
- package/dist/script/execute/runner.js +0 -15
- package/dist/script/execute/util_parser.d.ts +0 -41
- package/dist/script/execute/util_parser.js +1 -47
- package/dist/script/execute_manager.d.ts +0 -38
- package/dist/script/execute_manager.js +0 -54
- package/dist/script/socket_manager.d.ts +0 -79
- package/dist/script/socket_manager.js +0 -84
- package/dist/script/webhook_server_manager.js +1 -1
- package/dist/server/detail/console_handle.d.ts +0 -13
- package/dist/server/detail/console_handle.js +0 -14
- package/dist/server/detail/log_handle.d.ts +0 -5
- package/dist/server/detail/log_handle.js +0 -5
- package/dist/server/detail.d.ts +4 -32
- package/dist/server/detail.js +0 -43
- package/dist/server/io.d.ts +0 -21
- package/dist/server/io.js +0 -18
- package/dist/server/io2.d.ts +0 -19
- package/dist/server/io2.js +0 -54
- package/dist/server/module/account.d.ts +0 -6
- package/dist/server/module/account.js +0 -11
- package/dist/server/module/project.d.ts +1 -50
- package/dist/server/module/project.js +0 -49
- package/dist/server/plugin.d.ts +0 -51
- package/dist/server/plugin.js +0 -13
- package/dist/server/server.d.ts +0 -21
- package/dist/server/server.js +0 -10
- package/dist/server/server2.d.ts +0 -4
- package/dist/server/server2.js +0 -9
- package/dist/server.d.ts +0 -3
- package/dist/server.js +0 -3
- package/jest.config.js +11 -0
- package/package.json +3 -2
- package/src/client/client.ts +1 -1
- package/src/computed.ts +1 -5
- package/src/interface/struct.ts +1 -1
- package/src/script/webhook_server_manager.ts +1 -1
- package/test/call/print.ts +1 -1
- package/tsconfig.json +4 -4
- package/dist/util/port.d.ts +0 -1
- package/dist/util/port.js +0 -15
- package/jest.config.ts +0 -12
- package/src/util/port.ts +0 -15
package/dist/server/io2.d.ts
CHANGED
|
@@ -1,23 +1,4 @@
|
|
|
1
1
|
import { MemoryData, RecordIOBase, RecordLoader } from "./io";
|
|
2
|
-
/**
|
|
3
|
-
* **Create the interface for record memory storage**\
|
|
4
|
-
* Generate a loader interface for register to server event
|
|
5
|
-
* @param loader loader memory loader interface
|
|
6
|
-
* @returns Interface for server calling
|
|
7
|
-
*/
|
|
8
2
|
export declare const CreateRecordMemoryLoader: (loader: MemoryData) => RecordLoader;
|
|
9
|
-
/**
|
|
10
|
-
* **Create the interface for record files storage**\
|
|
11
|
-
* Generate a loader interface for register to server event
|
|
12
|
-
* @param loader loader IO loader interface
|
|
13
|
-
* @param user should include user
|
|
14
|
-
* @returns Interface for server calling
|
|
15
|
-
*/
|
|
16
3
|
export declare const CreateRecordIOLoader: (loader: RecordIOBase, memory: MemoryData) => RecordLoader;
|
|
17
|
-
/**
|
|
18
|
-
* **Create the interface for record mongoDB storage**\
|
|
19
|
-
* @param url MongoDB URL
|
|
20
|
-
* @param memory loader memory loader interface
|
|
21
|
-
* @returns
|
|
22
|
-
*/
|
|
23
4
|
export declare const CreateRecordMongoLoader: (url: string, memory: MemoryData) => RecordLoader;
|
package/dist/server/io2.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
// ========================
|
|
2
|
-
//
|
|
3
|
-
// Share Codebase
|
|
4
|
-
//
|
|
5
|
-
// ========================
|
|
6
1
|
import { MongoClient } from "mongodb";
|
|
7
2
|
import { RecordType, ACLType, SERECT, MONGODB_NAME, } from "../interface";
|
|
8
3
|
import jwt from 'jsonwebtoken';
|
|
@@ -82,13 +77,6 @@ const obsoleteSupport = async (loader, type, folder) => {
|
|
|
82
77
|
loader.rm(path);
|
|
83
78
|
}
|
|
84
79
|
};
|
|
85
|
-
/**
|
|
86
|
-
* **Create the interface for record memory storage**\
|
|
87
|
-
* Generate a loader interface for register to server event
|
|
88
|
-
* @param loader Memory loader interface
|
|
89
|
-
* @param type Type of storage
|
|
90
|
-
* @returns Interface for calling
|
|
91
|
-
*/
|
|
92
80
|
const _CreateRecordMemoryLoader = (loader, type) => {
|
|
93
81
|
const get_array = (type) => {
|
|
94
82
|
switch (type) {
|
|
@@ -308,16 +296,6 @@ const _CreateRecordMemoryLoader = (loader, type) => {
|
|
|
308
296
|
}
|
|
309
297
|
};
|
|
310
298
|
};
|
|
311
|
-
/**
|
|
312
|
-
* **Create the interface for record files storage**\
|
|
313
|
-
* Generate a loader interface for register to server event
|
|
314
|
-
* @param loader File loader interface
|
|
315
|
-
* @param memory Memory loader interface
|
|
316
|
-
* @param type Type of storage
|
|
317
|
-
* @param folder Folder name
|
|
318
|
-
* @param ext Store file extension
|
|
319
|
-
* @returns Interface for calling
|
|
320
|
-
*/
|
|
321
299
|
const _CreateRecordIOLoader = (loader, memory, type, folder, ext = ".json") => {
|
|
322
300
|
const mem = _CreateRecordMemoryLoader(memory, type);
|
|
323
301
|
return {
|
|
@@ -344,9 +322,7 @@ const _CreateRecordIOLoader = (loader, memory, type, folder, ext = ".json") => {
|
|
|
344
322
|
},
|
|
345
323
|
delete_all: async (token) => {
|
|
346
324
|
const root = loader.join(loader.root, folder);
|
|
347
|
-
// Memory action
|
|
348
325
|
const c = await mem.delete_all(token);
|
|
349
|
-
// Get the removed uuids and delete from disk
|
|
350
326
|
const kill_all = c.map(x => {
|
|
351
327
|
return loader.rm(loader.join(root, x + ext));
|
|
352
328
|
});
|
|
@@ -391,15 +367,6 @@ const _CreateRecordIOLoader = (loader, memory, type, folder, ext = ".json") => {
|
|
|
391
367
|
}
|
|
392
368
|
};
|
|
393
369
|
};
|
|
394
|
-
/**
|
|
395
|
-
* **Create the interface for record mongoDB storage**\
|
|
396
|
-
* @param loader MongoDB loader client
|
|
397
|
-
* @param memory Memory loader interface
|
|
398
|
-
* @param type Type of storage
|
|
399
|
-
* @param db Database name
|
|
400
|
-
* @param collection Collection from database
|
|
401
|
-
* @returns Interface for calling
|
|
402
|
-
*/
|
|
403
370
|
const _CreateRecordMongoLoader = (loader, memory, type, db, collection) => {
|
|
404
371
|
const mem = _CreateRecordMemoryLoader(memory, type);
|
|
405
372
|
return {
|
|
@@ -417,11 +384,9 @@ const _CreateRecordMongoLoader = (loader, memory, type, db, collection) => {
|
|
|
417
384
|
return mem.load_all(token);
|
|
418
385
|
},
|
|
419
386
|
delete_all: async (token) => {
|
|
420
|
-
// Memory action
|
|
421
387
|
const c = await mem.delete_all(token);
|
|
422
388
|
const database = loader.db(db);
|
|
423
389
|
const col = database.collection(collection);
|
|
424
|
-
// Get the removed uuids and delete from disk
|
|
425
390
|
const exec = c.map(x => {
|
|
426
391
|
return col.deleteOne({ uuid: x });
|
|
427
392
|
});
|
|
@@ -454,12 +419,6 @@ const _CreateRecordMongoLoader = (loader, memory, type, db, collection) => {
|
|
|
454
419
|
}
|
|
455
420
|
};
|
|
456
421
|
};
|
|
457
|
-
/**
|
|
458
|
-
* **Create the interface for record memory storage**\
|
|
459
|
-
* Generate a loader interface for register to server event
|
|
460
|
-
* @param loader loader memory loader interface
|
|
461
|
-
* @returns Interface for server calling
|
|
462
|
-
*/
|
|
463
422
|
export const CreateRecordMemoryLoader = (loader) => {
|
|
464
423
|
return {
|
|
465
424
|
project: _CreateRecordMemoryLoader(loader, RecordType.PROJECT),
|
|
@@ -472,13 +431,6 @@ export const CreateRecordMemoryLoader = (loader) => {
|
|
|
472
431
|
user: _CreateRecordMemoryLoader(loader, RecordType.USER),
|
|
473
432
|
};
|
|
474
433
|
};
|
|
475
|
-
/**
|
|
476
|
-
* **Create the interface for record files storage**\
|
|
477
|
-
* Generate a loader interface for register to server event
|
|
478
|
-
* @param loader loader IO loader interface
|
|
479
|
-
* @param user should include user
|
|
480
|
-
* @returns Interface for server calling
|
|
481
|
-
*/
|
|
482
434
|
export const CreateRecordIOLoader = (loader, memory) => {
|
|
483
435
|
return {
|
|
484
436
|
project: _CreateRecordIOLoader(loader, memory, RecordType.PROJECT, "project"),
|
|
@@ -491,12 +443,6 @@ export const CreateRecordIOLoader = (loader, memory) => {
|
|
|
491
443
|
user: _CreateRecordIOLoader(loader, memory, RecordType.USER, "user"),
|
|
492
444
|
};
|
|
493
445
|
};
|
|
494
|
-
/**
|
|
495
|
-
* **Create the interface for record mongoDB storage**\
|
|
496
|
-
* @param url MongoDB URL
|
|
497
|
-
* @param memory loader memory loader interface
|
|
498
|
-
* @returns
|
|
499
|
-
*/
|
|
500
446
|
export const CreateRecordMongoLoader = (url, memory) => {
|
|
501
447
|
const loader = new MongoClient(url);
|
|
502
448
|
return {
|
|
@@ -3,11 +3,5 @@ export declare class Account_Module {
|
|
|
3
3
|
loader: RecordLoader;
|
|
4
4
|
memory: MemoryData;
|
|
5
5
|
constructor(loader: RecordLoader, memory: MemoryData);
|
|
6
|
-
/**
|
|
7
|
-
* If login failed, it will throw error
|
|
8
|
-
* @param username Login Username Field
|
|
9
|
-
* @param password Login Password Field
|
|
10
|
-
* @returns Token string
|
|
11
|
-
*/
|
|
12
6
|
login: (username: string, password: string) => Promise<string>;
|
|
13
7
|
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
// ========================
|
|
2
|
-
//
|
|
3
|
-
// Share Codebase
|
|
4
|
-
//
|
|
5
|
-
// ========================
|
|
6
1
|
import jwt from 'jsonwebtoken';
|
|
7
2
|
import { SERECT } from '../../interface';
|
|
8
3
|
export class Account_Module {
|
|
@@ -12,12 +7,6 @@ export class Account_Module {
|
|
|
12
7
|
this.loader = loader;
|
|
13
8
|
this.memory = memory;
|
|
14
9
|
}
|
|
15
|
-
/**
|
|
16
|
-
* If login failed, it will throw error
|
|
17
|
-
* @param username Login Username Field
|
|
18
|
-
* @param password Login Password Field
|
|
19
|
-
* @returns Token string
|
|
20
|
-
*/
|
|
21
10
|
login = async (username, password) => {
|
|
22
11
|
const data = await this.loader.user.load_all();
|
|
23
12
|
const users = data.map(x => JSON.parse(x));
|
|
@@ -8,64 +8,15 @@ export declare class Project_Module {
|
|
|
8
8
|
get loader(): RecordLoader;
|
|
9
9
|
ProjectJobCount(uuid: string): Promise<number>;
|
|
10
10
|
ReOrderProjectTask(uuid: string, uuids: Array<string>): Promise<void>;
|
|
11
|
-
/**
|
|
12
|
-
* Assign real data to instance
|
|
13
|
-
* @param uuid Project UUID
|
|
14
|
-
*/
|
|
15
11
|
PopulateProject(uuid: string): Promise<Project | undefined>;
|
|
16
|
-
/**
|
|
17
|
-
* Assign real data to instance
|
|
18
|
-
* @param uuid Task UUID
|
|
19
|
-
*/
|
|
20
12
|
PopulateTask(uuid: string): Promise<Task | undefined>;
|
|
21
|
-
/**
|
|
22
|
-
* Get tasks from project related
|
|
23
|
-
* @param uuid Project UUID
|
|
24
|
-
* @returns Related Tasks
|
|
25
|
-
*/
|
|
26
13
|
GetProjectRelatedTask(uuid: string): Promise<Array<Task>>;
|
|
27
|
-
/**
|
|
28
|
-
* Get jobs from task related
|
|
29
|
-
* @param uuid Task UUID
|
|
30
|
-
* @returns Related Jobs
|
|
31
|
-
*/
|
|
32
14
|
GetTaskRelatedJob(uuid: string): Promise<Array<Job>>;
|
|
33
|
-
/**
|
|
34
|
-
* Clone Project Container
|
|
35
|
-
* @param uuids project uuids
|
|
36
|
-
* @returns The new uuids list
|
|
37
|
-
*/
|
|
38
15
|
CloneProjects(uuids: Array<string>): Promise<Array<string>>;
|
|
39
|
-
/**
|
|
40
|
-
* Clone Task Container
|
|
41
|
-
* @param uuids task uuids
|
|
42
|
-
* @returns The new uuids list
|
|
43
|
-
*/
|
|
44
16
|
CloneTasks(uuids: Array<string>): Promise<Array<string>>;
|
|
45
|
-
/**
|
|
46
|
-
* Clone Job Container
|
|
47
|
-
* @param uuids job uuids
|
|
48
|
-
* @returns The new uuids list
|
|
49
|
-
*/
|
|
50
17
|
CloneJobs(uuids: Array<string>): Promise<Array<string>>;
|
|
51
|
-
/**
|
|
52
|
-
* Delete project related data and project itself
|
|
53
|
-
* @param uuid Project UUID
|
|
54
|
-
*/
|
|
55
18
|
CascadeDeleteProject(uuid: string, bind: boolean): Promise<void>;
|
|
56
|
-
/**
|
|
57
|
-
* Delete Task related data and project itself
|
|
58
|
-
* @param uuid Task UUID
|
|
59
|
-
*/
|
|
60
19
|
CascadeDeleteTask(uuid: string): Promise<void>;
|
|
61
|
-
/**
|
|
62
|
-
* Delete Task related data and project itself
|
|
63
|
-
* @param uuid Task UUID
|
|
64
|
-
*/
|
|
65
20
|
CascadeDeleteJob(uuid: string): Promise<void>;
|
|
66
|
-
|
|
67
|
-
* Delete idle database
|
|
68
|
-
* @param uuid Database UUID
|
|
69
|
-
*/
|
|
70
|
-
Delete_Database_Idle(uuid: string): Promise<any>;
|
|
21
|
+
Delete_Database_Idle(uuid: string): Promise<void>;
|
|
71
22
|
}
|
|
@@ -23,10 +23,6 @@ export class Project_Module {
|
|
|
23
23
|
p.tasks_uuid = uuids;
|
|
24
24
|
this.loader.project.save(uuid, JSON.stringify(p, null, 4));
|
|
25
25
|
}
|
|
26
|
-
/**
|
|
27
|
-
* Assign real data to instance
|
|
28
|
-
* @param uuid Project UUID
|
|
29
|
-
*/
|
|
30
26
|
async PopulateProject(uuid) {
|
|
31
27
|
await this.loader.project.load(uuid);
|
|
32
28
|
const p = this.memory.projects.find(p => p.uuid == uuid);
|
|
@@ -37,10 +33,6 @@ export class Project_Module {
|
|
|
37
33
|
buffer.tasks = (await Promise.all(ts)).filter(x => x != undefined);
|
|
38
34
|
return buffer;
|
|
39
35
|
}
|
|
40
|
-
/**
|
|
41
|
-
* Assign real data to instance
|
|
42
|
-
* @param uuid Task UUID
|
|
43
|
-
*/
|
|
44
36
|
async PopulateTask(uuid) {
|
|
45
37
|
await this.loader.task.load(uuid);
|
|
46
38
|
const p = this.memory.tasks.find(p => p.uuid == uuid);
|
|
@@ -54,11 +46,6 @@ export class Project_Module {
|
|
|
54
46
|
buffer.jobs = (await Promise.all(js)).filter(x => x != undefined);
|
|
55
47
|
return buffer;
|
|
56
48
|
}
|
|
57
|
-
/**
|
|
58
|
-
* Get tasks from project related
|
|
59
|
-
* @param uuid Project UUID
|
|
60
|
-
* @returns Related Tasks
|
|
61
|
-
*/
|
|
62
49
|
async GetProjectRelatedTask(uuid) {
|
|
63
50
|
await this.loader.project.load(uuid);
|
|
64
51
|
const p = this.memory.projects.find(x => x.uuid == uuid);
|
|
@@ -71,11 +58,6 @@ export class Project_Module {
|
|
|
71
58
|
const tasks = p.tasks_uuid.map(x => this.memory.tasks.find(y => y.uuid == x)).filter(x => x != undefined);
|
|
72
59
|
return tasks;
|
|
73
60
|
}
|
|
74
|
-
/**
|
|
75
|
-
* Get jobs from task related
|
|
76
|
-
* @param uuid Task UUID
|
|
77
|
-
* @returns Related Jobs
|
|
78
|
-
*/
|
|
79
61
|
async GetTaskRelatedJob(uuid) {
|
|
80
62
|
await this.loader.task.load(uuid);
|
|
81
63
|
const p = this.memory.tasks.find(x => x.uuid == uuid);
|
|
@@ -88,11 +70,6 @@ export class Project_Module {
|
|
|
88
70
|
const jobs = p.jobs_uuid.map(x => this.memory.jobs.find(y => y.uuid == x)).filter(x => x != undefined);
|
|
89
71
|
return jobs;
|
|
90
72
|
}
|
|
91
|
-
/**
|
|
92
|
-
* Clone Project Container
|
|
93
|
-
* @param uuids project uuids
|
|
94
|
-
* @returns The new uuids list
|
|
95
|
-
*/
|
|
96
73
|
async CloneProjects(uuids) {
|
|
97
74
|
const p = uuids.map(x => this.loader.project.load(x));
|
|
98
75
|
const ps = await Promise.all(p);
|
|
@@ -107,11 +84,6 @@ export class Project_Module {
|
|
|
107
84
|
await Promise.all(js);
|
|
108
85
|
return projects.map(x => x.uuid);
|
|
109
86
|
}
|
|
110
|
-
/**
|
|
111
|
-
* Clone Task Container
|
|
112
|
-
* @param uuids task uuids
|
|
113
|
-
* @returns The new uuids list
|
|
114
|
-
*/
|
|
115
87
|
async CloneTasks(uuids) {
|
|
116
88
|
const p = uuids.map(x => this.loader.task.load(x));
|
|
117
89
|
const ps = await Promise.all(p);
|
|
@@ -126,11 +98,6 @@ export class Project_Module {
|
|
|
126
98
|
await Promise.all(js);
|
|
127
99
|
return tasks.map(x => x.uuid);
|
|
128
100
|
}
|
|
129
|
-
/**
|
|
130
|
-
* Clone Job Container
|
|
131
|
-
* @param uuids job uuids
|
|
132
|
-
* @returns The new uuids list
|
|
133
|
-
*/
|
|
134
101
|
async CloneJobs(uuids) {
|
|
135
102
|
const p = uuids.map(x => this.loader.job.load(x));
|
|
136
103
|
const ps = await Promise.all(p);
|
|
@@ -140,10 +107,6 @@ export class Project_Module {
|
|
|
140
107
|
await Promise.all(js);
|
|
141
108
|
return jobs.map(x => x.uuid);
|
|
142
109
|
}
|
|
143
|
-
/**
|
|
144
|
-
* Delete project related data and project itself
|
|
145
|
-
* @param uuid Project UUID
|
|
146
|
-
*/
|
|
147
110
|
async CascadeDeleteProject(uuid, bind) {
|
|
148
111
|
await this.loader.project.load(uuid);
|
|
149
112
|
const p = this.memory.projects.find(p => p.uuid == uuid);
|
|
@@ -156,10 +119,6 @@ export class Project_Module {
|
|
|
156
119
|
if (bind)
|
|
157
120
|
await this.Delete_Database_Idle(db);
|
|
158
121
|
}
|
|
159
|
-
/**
|
|
160
|
-
* Delete Task related data and project itself
|
|
161
|
-
* @param uuid Task UUID
|
|
162
|
-
*/
|
|
163
122
|
async CascadeDeleteTask(uuid) {
|
|
164
123
|
await this.loader.task.load(uuid);
|
|
165
124
|
const p = this.memory.tasks.find(p => p.uuid == uuid);
|
|
@@ -175,10 +134,6 @@ export class Project_Module {
|
|
|
175
134
|
this.memory.projects.splice(index, 1);
|
|
176
135
|
}
|
|
177
136
|
}
|
|
178
|
-
/**
|
|
179
|
-
* Delete Task related data and project itself
|
|
180
|
-
* @param uuid Task UUID
|
|
181
|
-
*/
|
|
182
137
|
async CascadeDeleteJob(uuid) {
|
|
183
138
|
await this.loader.job.delete(uuid);
|
|
184
139
|
const ps2 = this.memory.tasks.filter(x => x.jobs_uuid.includes(uuid)).map(x => x.uuid);
|
|
@@ -188,10 +143,6 @@ export class Project_Module {
|
|
|
188
143
|
this.memory.tasks.splice(index, 1);
|
|
189
144
|
}
|
|
190
145
|
}
|
|
191
|
-
/**
|
|
192
|
-
* Delete idle database
|
|
193
|
-
* @param uuid Database UUID
|
|
194
|
-
*/
|
|
195
146
|
async Delete_Database_Idle(uuid) {
|
|
196
147
|
return this.loader.project.load_all().then(() => {
|
|
197
148
|
const f = this.memory.projects.find(x => x.database_uuid == uuid);
|
package/dist/server/plugin.d.ts
CHANGED
|
@@ -1,67 +1,16 @@
|
|
|
1
1
|
import { RecordIOBase } from "./io";
|
|
2
2
|
import { PluginPageData, WebsocketPack } from "../interface";
|
|
3
3
|
import { PluginFeedback } from "./server";
|
|
4
|
-
/**
|
|
5
|
-
* Get socket from websocket client method
|
|
6
|
-
*/
|
|
7
4
|
export type SocketGetter = (uuid: string) => WebsocketPack | undefined;
|
|
8
|
-
/**
|
|
9
|
-
* **Plugin Function Interface**\
|
|
10
|
-
* Use for access the plugin store function
|
|
11
|
-
*/
|
|
12
5
|
export interface PluginLoader {
|
|
13
|
-
/**
|
|
14
|
-
* Loading all plugins
|
|
15
|
-
*/
|
|
16
6
|
load_all: () => Promise<PluginPageData>;
|
|
17
|
-
/**
|
|
18
|
-
* Loading plugins from cache
|
|
19
|
-
*/
|
|
20
7
|
get_plugins: () => Promise<PluginPageData>;
|
|
21
|
-
/**
|
|
22
|
-
* Get project template
|
|
23
|
-
* @param name Plugin name
|
|
24
|
-
* @param group Group search
|
|
25
|
-
* @param filename Template filename
|
|
26
|
-
*/
|
|
27
8
|
get_project: (name: string, group: string, filename: string) => Promise<string> | undefined;
|
|
28
|
-
/**
|
|
29
|
-
* Get database template
|
|
30
|
-
* @param name Plugin name
|
|
31
|
-
* @param group Group search
|
|
32
|
-
* @param filename Template filename
|
|
33
|
-
*/
|
|
34
9
|
get_database: (name: string, group: string, filename: string) => Promise<string> | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* Import plugin from web
|
|
37
|
-
* @param name Plugin name
|
|
38
|
-
* @param url The URL for plugin manifest
|
|
39
|
-
* @param token Token list, use space to seperate
|
|
40
|
-
*/
|
|
41
10
|
import_plugin: (name: string, url: string, token: string) => Promise<PluginPageData>;
|
|
42
|
-
/**
|
|
43
|
-
* Delete plugin by name
|
|
44
|
-
* @param name Plugin name
|
|
45
|
-
*/
|
|
46
11
|
delete_plugin: (name: string) => Promise<void>;
|
|
47
|
-
/**
|
|
48
|
-
* Telling node Download plugin
|
|
49
|
-
* @param uuid Node ID
|
|
50
|
-
* @param plugin Plugin name
|
|
51
|
-
* @param token Token list, use space to seperate
|
|
52
|
-
*/
|
|
53
12
|
plugin_download: (uuid: string, plugin: string, tokens: string) => Promise<void>;
|
|
54
|
-
/**
|
|
55
|
-
* Telling node Remove plugin
|
|
56
|
-
* @param uuid Node ID
|
|
57
|
-
* @param plugin Plugin name
|
|
58
|
-
*/
|
|
59
13
|
plugin_remove: (uuid: string, plugin: string) => Promise<void>;
|
|
60
14
|
}
|
|
61
|
-
/**
|
|
62
|
-
* **Get Current Plugin List**
|
|
63
|
-
* @param loader The file io loader
|
|
64
|
-
* @returns Current list in disk storage
|
|
65
|
-
*/
|
|
66
15
|
export declare const GetCurrentPlugin: (loader: RecordIOBase) => Promise<PluginPageData>;
|
|
67
16
|
export declare const CreatePluginLoader: (loader: RecordIOBase, memory: PluginPageData, socket: SocketGetter, feedback: PluginFeedback) => PluginLoader;
|
package/dist/server/plugin.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* **Get Current Plugin List**
|
|
3
|
-
* @param loader The file io loader
|
|
4
|
-
* @returns Current list in disk storage
|
|
5
|
-
*/
|
|
6
1
|
export const GetCurrentPlugin = async (loader) => {
|
|
7
2
|
return new Promise(async (resolve) => {
|
|
8
3
|
const b = {
|
|
@@ -77,14 +72,10 @@ export const CreatePluginLoader = (loader, memory, socket, feedback) => {
|
|
|
77
72
|
await loader.mkdir(project_folder);
|
|
78
73
|
if (!loader.exists(database_folder))
|
|
79
74
|
await loader.mkdir(database_folder);
|
|
80
|
-
// Trying no token first
|
|
81
75
|
const tokens = [undefined, ...token.split(' ')];
|
|
82
76
|
let req = {};
|
|
83
77
|
let ob = undefined;
|
|
84
78
|
for (let t of tokens) {
|
|
85
|
-
// Do not store cache
|
|
86
|
-
// Even tho, some website have it's own CDN policy, You might still get old data
|
|
87
|
-
// But most of them only sustained couple minutes
|
|
88
79
|
req = t == undefined ? { method: 'GET', cache: "no-store" } : {
|
|
89
80
|
method: 'GET',
|
|
90
81
|
cache: "no-store",
|
|
@@ -92,7 +83,6 @@ export const CreatePluginLoader = (loader, memory, socket, feedback) => {
|
|
|
92
83
|
"Authorization": t ? `Bearer ${t}` : ''
|
|
93
84
|
}
|
|
94
85
|
};
|
|
95
|
-
// Get data
|
|
96
86
|
let tex = "";
|
|
97
87
|
try {
|
|
98
88
|
const res = await fetch(url, req);
|
|
@@ -106,7 +96,6 @@ export const CreatePluginLoader = (loader, memory, socket, feedback) => {
|
|
|
106
96
|
}
|
|
107
97
|
}
|
|
108
98
|
if (ob == undefined) {
|
|
109
|
-
// Query data failed
|
|
110
99
|
const p = { title: "Import Failed", type: "error", message: `Cannot find the json from url ${url}, or maybe just the wrong token` };
|
|
111
100
|
const h = { name: "makeToast", data: JSON.stringify(p) };
|
|
112
101
|
if (feedback.electron) {
|
|
@@ -122,7 +111,6 @@ export const CreatePluginLoader = (loader, memory, socket, feedback) => {
|
|
|
122
111
|
const folder = url.substring(0, url.lastIndexOf('/'));
|
|
123
112
|
const project_calls = ob.projects.map(p => fetch(folder + "/project/" + p.filename + '.json', req));
|
|
124
113
|
const database_calls = ob.databases.map(p => fetch(folder + "/database/" + p.filename + '.json', req));
|
|
125
|
-
// * Project template query
|
|
126
114
|
const pss = await Promise.all(project_calls);
|
|
127
115
|
const project_calls2 = pss.map(x => x.text());
|
|
128
116
|
const pss_result = await Promise.all(project_calls2);
|
|
@@ -137,7 +125,6 @@ export const CreatePluginLoader = (loader, memory, socket, feedback) => {
|
|
|
137
125
|
error_children.push([`Import Project ${n} Error`, error.message]);
|
|
138
126
|
}
|
|
139
127
|
});
|
|
140
|
-
// * Database template query
|
|
141
128
|
const pss2 = await Promise.all(database_calls);
|
|
142
129
|
const database_calls2 = pss2.map(x => x.text());
|
|
143
130
|
const pss_result2 = await Promise.all(database_calls2);
|
package/dist/server/server.d.ts
CHANGED
|
@@ -11,19 +11,8 @@ export type Caller_Socket = (data: any) => void;
|
|
|
11
11
|
export type TypeMap = {
|
|
12
12
|
[key: string]: Function;
|
|
13
13
|
};
|
|
14
|
-
/**
|
|
15
|
-
* **Backend Feedback**\
|
|
16
|
-
* The config that which {@link ServerDetail} require to use\
|
|
17
|
-
* Depends on what input value it have, it could have different type of response
|
|
18
|
-
*/
|
|
19
14
|
export interface PluginFeedback {
|
|
20
|
-
/**
|
|
21
|
-
* Eletron feedback
|
|
22
|
-
*/
|
|
23
15
|
electron: (() => (Caller_Electron | undefined)) | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* WebServer feedback
|
|
26
|
-
*/
|
|
27
16
|
socket: Caller_Socket | undefined;
|
|
28
17
|
}
|
|
29
18
|
export declare class ServerBase {
|
|
@@ -38,16 +27,6 @@ export declare class ServerBase {
|
|
|
38
27
|
module_project: Project_Module;
|
|
39
28
|
constructor();
|
|
40
29
|
get current_loader(): RecordLoader;
|
|
41
|
-
/**
|
|
42
|
-
* **Data: Memory**\
|
|
43
|
-
* Load every type of data from disk, store them into memory
|
|
44
|
-
*/
|
|
45
30
|
LoadFromDisk: () => Promise<Array<Array<string>>>;
|
|
46
|
-
/**
|
|
47
|
-
* **Broadcast To Console**\
|
|
48
|
-
* Send messages to all console server
|
|
49
|
-
* @param name channel
|
|
50
|
-
* @param data raw data
|
|
51
|
-
*/
|
|
52
31
|
Boradcasting: (name: string, data: any) => void;
|
|
53
32
|
}
|
package/dist/server/server.js
CHANGED
|
@@ -30,10 +30,6 @@ export class ServerBase {
|
|
|
30
30
|
return this.loader;
|
|
31
31
|
return this.memory_loader;
|
|
32
32
|
}
|
|
33
|
-
/**
|
|
34
|
-
* **Data: Memory**\
|
|
35
|
-
* Load every type of data from disk, store them into memory
|
|
36
|
-
*/
|
|
37
33
|
LoadFromDisk = () => {
|
|
38
34
|
const ts = [
|
|
39
35
|
this.current_loader.project.fetch_all(),
|
|
@@ -47,12 +43,6 @@ export class ServerBase {
|
|
|
47
43
|
];
|
|
48
44
|
return Promise.all(ts);
|
|
49
45
|
};
|
|
50
|
-
/**
|
|
51
|
-
* **Broadcast To Console**\
|
|
52
|
-
* Send messages to all console server
|
|
53
|
-
* @param name channel
|
|
54
|
-
* @param data raw data
|
|
55
|
-
*/
|
|
56
46
|
Boradcasting = (name, data) => {
|
|
57
47
|
const d = {
|
|
58
48
|
name: name,
|
package/dist/server/server2.d.ts
CHANGED
package/dist/server/server2.js
CHANGED
package/dist/server.d.ts
CHANGED
package/dist/server.js
CHANGED
package/jest.config.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "verteilen-core",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.23",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://verteilen.github.io/wiki/",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"url": "https://github.com/Verteilen/Verteilen-Core/issues"
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
|
-
"test": "jest --coverage"
|
|
15
|
+
"test": "jest --coverage",
|
|
16
|
+
"test:init": "ts-jest config:init"
|
|
16
17
|
},
|
|
17
18
|
"devDependencies": {
|
|
18
19
|
"@types/bcrypt": "^5.0.2",
|
package/src/client/client.ts
CHANGED
|
@@ -75,7 +75,7 @@ export class Client {
|
|
|
75
75
|
res.end('HTTPS server is running');
|
|
76
76
|
})
|
|
77
77
|
this.httpss.addListener('upgrade', (req, res, head) => console.log('UPGRADE:', req.url))
|
|
78
|
-
this.client = new ws.
|
|
78
|
+
this.client = new ws.WebSocketServer({server: this.httpss})
|
|
79
79
|
this.client.on('listening', () => {
|
|
80
80
|
this.messager_log('[Server] Listen PORT: ' + port_result.toString())
|
|
81
81
|
})
|
package/src/computed.ts
CHANGED
|
@@ -22,8 +22,4 @@ export * as Execute_WebhookServerManager from './script/webhook_server_manager'
|
|
|
22
22
|
*/
|
|
23
23
|
export * as ServerWorker from './server/server2'
|
|
24
24
|
export * as ServerIO from './server/io2'
|
|
25
|
-
export * as ServerModule_Account from './server/module/account'
|
|
26
|
-
/**
|
|
27
|
-
* Util Components
|
|
28
|
-
*/
|
|
29
|
-
export * as UtilPort from './util/port'
|
|
25
|
+
export * as ServerModule_Account from './server/module/account'
|
package/src/interface/struct.ts
CHANGED
|
@@ -39,7 +39,7 @@ export class WebhookServerManager {
|
|
|
39
39
|
res.end('HTTPS server is running');
|
|
40
40
|
})
|
|
41
41
|
this.httpss.addListener('upgrade', (req, res, head) => console.log('UPGRADE:', req.url))
|
|
42
|
-
this.server = new ws.
|
|
42
|
+
this.server = new ws.WebSocketServer({server: this.httpss})
|
|
43
43
|
this.server.on('listening', () => {
|
|
44
44
|
this.messager_log('[Server] Listen PORT: ' + port_result.toString())
|
|
45
45
|
})
|
package/test/call/print.ts
CHANGED