verteilen-core 1.3.9 → 1.3.11
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/server/io.js
CHANGED
|
@@ -114,7 +114,7 @@ const _CreateRecordIOLoader = (loader, memory, type, folder, ext = ".json") => {
|
|
|
114
114
|
if (cache) {
|
|
115
115
|
const b = arr.findIndex(x => x.uuid == name);
|
|
116
116
|
if (b != -1)
|
|
117
|
-
return arr[b];
|
|
117
|
+
return JSON.stringify(arr[b]);
|
|
118
118
|
}
|
|
119
119
|
const root = loader.join(loader.root, folder);
|
|
120
120
|
if (!loader.exists(root))
|
|
@@ -9,8 +9,8 @@ export declare class Project_Module {
|
|
|
9
9
|
ProjectJobCount(uuid: string): number;
|
|
10
10
|
PopulateProject(uuid: string): Project | undefined;
|
|
11
11
|
PopulateTask(uuid: string): Task | undefined;
|
|
12
|
-
GetProjectRelatedTask(uuid: string): Array<Task
|
|
13
|
-
GetTaskRelatedJob(uuid: string): Array<Job
|
|
12
|
+
GetProjectRelatedTask(uuid: string): Promise<Array<Task>>;
|
|
13
|
+
GetTaskRelatedJob(uuid: string): Promise<Array<Job>>;
|
|
14
14
|
CloneProjects(uuids: Array<string>): Promise<Array<string>>;
|
|
15
15
|
CloneTasks(uuids: Array<string>): Promise<Array<string>>;
|
|
16
16
|
CloneJobs(uuids: Array<string>): Promise<Array<string>>;
|
|
@@ -43,23 +43,29 @@ class Project_Module {
|
|
|
43
43
|
}
|
|
44
44
|
return buffer;
|
|
45
45
|
}
|
|
46
|
-
GetProjectRelatedTask(uuid) {
|
|
46
|
+
async GetProjectRelatedTask(uuid) {
|
|
47
|
+
await this.loader.project.load(uuid, true);
|
|
47
48
|
const p = this.memory.projects.find(x => x.uuid == uuid);
|
|
48
49
|
if (!p)
|
|
49
50
|
return [];
|
|
50
51
|
const r = p.tasks_uuid.map(x => {
|
|
51
|
-
return this.
|
|
52
|
-
})
|
|
53
|
-
|
|
52
|
+
return this.loader.task.load(x, true);
|
|
53
|
+
});
|
|
54
|
+
await Promise.all(r);
|
|
55
|
+
const tasks = this.memory.tasks.filter(x => p.tasks_uuid.includes(x.uuid));
|
|
56
|
+
return tasks;
|
|
54
57
|
}
|
|
55
|
-
GetTaskRelatedJob(uuid) {
|
|
58
|
+
async GetTaskRelatedJob(uuid) {
|
|
59
|
+
await this.loader.task.load(uuid, true);
|
|
56
60
|
const p = this.memory.tasks.find(x => x.uuid == uuid);
|
|
57
61
|
if (!p)
|
|
58
62
|
return [];
|
|
59
63
|
const r = p.jobs_uuid.map(x => {
|
|
60
|
-
return this.
|
|
61
|
-
})
|
|
62
|
-
|
|
64
|
+
return this.loader.job.load(x, true);
|
|
65
|
+
});
|
|
66
|
+
await Promise.all(r);
|
|
67
|
+
const jobs = this.memory.jobs.filter(x => p.jobs_uuid.includes(x.uuid));
|
|
68
|
+
return jobs;
|
|
63
69
|
}
|
|
64
70
|
async CloneProjects(uuids) {
|
|
65
71
|
const p = uuids.map(x => this.loader.project.load(x, true));
|
package/package.json
CHANGED
package/src/server/io.ts
CHANGED
|
@@ -195,7 +195,7 @@ export const _CreateRecordIOLoader = (loader:RecordIOBase, memory:MemoryData, ty
|
|
|
195
195
|
const arr = get_array(type)
|
|
196
196
|
if(cache){
|
|
197
197
|
const b = arr.findIndex(x => x.uuid == name)
|
|
198
|
-
if(b != -1) return arr[b]
|
|
198
|
+
if(b != -1) return JSON.stringify(arr[b])
|
|
199
199
|
}
|
|
200
200
|
const root = loader.join(loader.root, folder)
|
|
201
201
|
if(!loader.exists(root)) await loader.mkdir(root)
|
|
@@ -61,26 +61,32 @@ export class Project_Module {
|
|
|
61
61
|
* @param uuid Project UUID
|
|
62
62
|
* @returns Related Tasks
|
|
63
63
|
*/
|
|
64
|
-
GetProjectRelatedTask(uuid:string):Array<Task
|
|
64
|
+
async GetProjectRelatedTask(uuid:string):Promise<Array<Task>> {
|
|
65
|
+
await this.loader.project.load(uuid, true)
|
|
65
66
|
const p = this.memory.projects.find(x => x.uuid == uuid)
|
|
66
67
|
if(!p) return []
|
|
67
68
|
const r = p.tasks_uuid.map(x => {
|
|
68
|
-
return this.
|
|
69
|
-
})
|
|
70
|
-
|
|
69
|
+
return this.loader.task.load(x, true)
|
|
70
|
+
})
|
|
71
|
+
await Promise.all(r)
|
|
72
|
+
const tasks = this.memory.tasks.filter(x => p.tasks_uuid.includes(x.uuid))
|
|
73
|
+
return tasks
|
|
71
74
|
}
|
|
72
75
|
/**
|
|
73
76
|
* Get jobs from task related
|
|
74
77
|
* @param uuid Task UUID
|
|
75
78
|
* @returns Related Jobs
|
|
76
79
|
*/
|
|
77
|
-
GetTaskRelatedJob(uuid:string):Array<Job
|
|
80
|
+
async GetTaskRelatedJob(uuid:string):Promise<Array<Job>> {
|
|
81
|
+
await this.loader.task.load(uuid, true)
|
|
78
82
|
const p = this.memory.tasks.find(x => x.uuid == uuid)
|
|
79
83
|
if(!p) return []
|
|
80
84
|
const r = p.jobs_uuid.map(x => {
|
|
81
|
-
return this.
|
|
82
|
-
})
|
|
83
|
-
|
|
85
|
+
return this.loader.job.load(x, true)
|
|
86
|
+
})
|
|
87
|
+
await Promise.all(r)
|
|
88
|
+
const jobs = this.memory.jobs.filter(x => p.jobs_uuid.includes(x.uuid))
|
|
89
|
+
return jobs
|
|
84
90
|
}
|
|
85
91
|
/**
|
|
86
92
|
* Clone Project Container
|