verteilen-core 1.3.12 → 1.3.13
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 +14 -14
- package/dist/server/module/project.js +2 -2
- package/package.json +1 -1
- package/src/server/io.ts +15 -15
- package/src/server/module/project.ts +2 -2
package/dist/server/io.js
CHANGED
|
@@ -96,56 +96,56 @@ const _CreateRecordIOLoader = (loader, memory, type, folder, ext = ".json") => {
|
|
|
96
96
|
await loader.mkdir(root);
|
|
97
97
|
return loader.read_dir_file(root);
|
|
98
98
|
},
|
|
99
|
-
save: async (
|
|
99
|
+
save: async (uuid, data) => {
|
|
100
100
|
const root = loader.join(loader.root, folder);
|
|
101
101
|
if (!loader.exists(root))
|
|
102
102
|
await loader.mkdir(root);
|
|
103
|
-
const file = loader.join(root,
|
|
103
|
+
const file = loader.join(root, uuid + ext);
|
|
104
104
|
await loader.write_string(file, data);
|
|
105
105
|
const arr = get_array(type);
|
|
106
|
-
const b = arr.findIndex(x => x.uuid ==
|
|
106
|
+
const b = arr.findIndex(x => x.uuid == uuid);
|
|
107
107
|
if (b != -1)
|
|
108
108
|
arr.push(JSON.parse(data));
|
|
109
109
|
else
|
|
110
110
|
arr[b] = JSON.parse(data);
|
|
111
111
|
},
|
|
112
|
-
load: async (
|
|
112
|
+
load: async (uuid, cache) => {
|
|
113
113
|
const arr = get_array(type);
|
|
114
114
|
if (cache) {
|
|
115
|
-
const b = arr.findIndex(x => x.uuid ==
|
|
115
|
+
const b = arr.findIndex(x => x.uuid == uuid);
|
|
116
116
|
if (b != -1)
|
|
117
117
|
return JSON.stringify(arr[b]);
|
|
118
118
|
}
|
|
119
119
|
const root = loader.join(loader.root, folder);
|
|
120
120
|
if (!loader.exists(root))
|
|
121
121
|
await loader.mkdir(root);
|
|
122
|
-
const file = loader.join(root,
|
|
122
|
+
const file = loader.join(root, uuid + ext);
|
|
123
123
|
const a = await loader.read_string(file);
|
|
124
124
|
if (cache)
|
|
125
125
|
arr.push(JSON.parse(a));
|
|
126
126
|
return a;
|
|
127
127
|
},
|
|
128
|
-
rename: async (
|
|
128
|
+
rename: async (uuid, newuuid) => {
|
|
129
129
|
const root = loader.join(loader.root, folder);
|
|
130
130
|
if (!loader.exists(root))
|
|
131
131
|
await loader.mkdir(root);
|
|
132
|
-
const oldfile = loader.join(root,
|
|
133
|
-
const newfile = loader.join(root,
|
|
132
|
+
const oldfile = loader.join(root, uuid + ext);
|
|
133
|
+
const newfile = loader.join(root, newuuid + ext);
|
|
134
134
|
await loader.cp(oldfile, newfile);
|
|
135
135
|
await loader.rm(oldfile);
|
|
136
136
|
const arr = get_array(type);
|
|
137
|
-
const b = arr.findIndex(x => x.uuid ==
|
|
137
|
+
const b = arr.findIndex(x => x.uuid == uuid);
|
|
138
138
|
if (b != -1)
|
|
139
|
-
arr[b].uuid =
|
|
139
|
+
arr[b].uuid = newuuid;
|
|
140
140
|
},
|
|
141
|
-
delete: async (
|
|
141
|
+
delete: async (uuid) => {
|
|
142
142
|
const root = loader.join(loader.root, folder);
|
|
143
143
|
if (!loader.exists(root))
|
|
144
144
|
await loader.mkdir(root);
|
|
145
|
-
const file = loader.join(root,
|
|
145
|
+
const file = loader.join(root, uuid + ext);
|
|
146
146
|
await loader.rm(file);
|
|
147
147
|
const arr = get_array(type);
|
|
148
|
-
const b = arr.findIndex(x => x.uuid ==
|
|
148
|
+
const b = arr.findIndex(x => x.uuid == uuid);
|
|
149
149
|
if (b != -1)
|
|
150
150
|
arr.splice(b, 1);
|
|
151
151
|
}
|
|
@@ -52,7 +52,7 @@ class Project_Module {
|
|
|
52
52
|
return this.loader.task.load(x, true);
|
|
53
53
|
});
|
|
54
54
|
await Promise.all(r);
|
|
55
|
-
const tasks = this.memory.tasks.
|
|
55
|
+
const tasks = p.tasks_uuid.map(x => this.memory.tasks.find(y => y.uuid == x)).filter(x => x != undefined);
|
|
56
56
|
return tasks;
|
|
57
57
|
}
|
|
58
58
|
async GetTaskRelatedJob(uuid) {
|
|
@@ -64,7 +64,7 @@ class Project_Module {
|
|
|
64
64
|
return this.loader.job.load(x, true);
|
|
65
65
|
});
|
|
66
66
|
await Promise.all(r);
|
|
67
|
-
const jobs = this.memory.jobs.
|
|
67
|
+
const jobs = p.jobs_uuid.map(x => this.memory.jobs.find(y => y.uuid == x)).filter(x => x != undefined);
|
|
68
68
|
return jobs;
|
|
69
69
|
}
|
|
70
70
|
async CloneProjects(uuids) {
|
package/package.json
CHANGED
package/src/server/io.ts
CHANGED
|
@@ -181,47 +181,47 @@ export const _CreateRecordIOLoader = (loader:RecordIOBase, memory:MemoryData, ty
|
|
|
181
181
|
if(!loader.exists(root)) await loader.mkdir(root)
|
|
182
182
|
return loader.read_dir_file(root)
|
|
183
183
|
},
|
|
184
|
-
save: async (
|
|
184
|
+
save: async (uuid:string, data:string):Promise<void> => {
|
|
185
185
|
const root = loader.join(loader.root, folder)
|
|
186
186
|
if(!loader.exists(root)) await loader.mkdir(root)
|
|
187
|
-
const file = loader.join(root,
|
|
187
|
+
const file = loader.join(root, uuid + ext)
|
|
188
188
|
await loader.write_string(file, data)
|
|
189
189
|
const arr = get_array(type)
|
|
190
|
-
const b = arr.findIndex(x => x.uuid ==
|
|
190
|
+
const b = arr.findIndex(x => x.uuid == uuid)
|
|
191
191
|
if(b != -1) arr.push(JSON.parse(data))
|
|
192
192
|
else arr[b] = JSON.parse(data)
|
|
193
193
|
},
|
|
194
|
-
load: async (
|
|
195
|
-
const arr = get_array(type)
|
|
194
|
+
load: async (uuid:string, cache: boolean):Promise<string> => {
|
|
195
|
+
const arr:Array<any> = get_array(type)
|
|
196
196
|
if(cache){
|
|
197
|
-
const b = arr.findIndex(x => x.uuid ==
|
|
197
|
+
const b = arr.findIndex(x => x.uuid == uuid)
|
|
198
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)
|
|
202
|
-
const file = loader.join(root,
|
|
202
|
+
const file = loader.join(root, uuid + ext)
|
|
203
203
|
const a = await loader.read_string(file)
|
|
204
204
|
if(cache) arr.push(JSON.parse(a))
|
|
205
205
|
return a
|
|
206
206
|
},
|
|
207
|
-
rename: async (
|
|
207
|
+
rename: async (uuid:string, newuuid:string):Promise<void> => {
|
|
208
208
|
const root = loader.join(loader.root, folder)
|
|
209
209
|
if(!loader.exists(root)) await loader.mkdir(root)
|
|
210
|
-
const oldfile = loader.join(root,
|
|
211
|
-
const newfile = loader.join(root,
|
|
210
|
+
const oldfile = loader.join(root, uuid + ext)
|
|
211
|
+
const newfile = loader.join(root, newuuid + ext)
|
|
212
212
|
await loader.cp(oldfile, newfile)
|
|
213
213
|
await loader.rm(oldfile)
|
|
214
214
|
const arr = get_array(type)
|
|
215
|
-
const b = arr.findIndex(x => x.uuid ==
|
|
216
|
-
if(b != -1) arr[b].uuid =
|
|
215
|
+
const b = arr.findIndex(x => x.uuid == uuid)
|
|
216
|
+
if(b != -1) arr[b].uuid = newuuid
|
|
217
217
|
},
|
|
218
|
-
delete: async (
|
|
218
|
+
delete: async (uuid:string):Promise<void> => {
|
|
219
219
|
const root = loader.join(loader.root, folder)
|
|
220
220
|
if(!loader.exists(root)) await loader.mkdir(root)
|
|
221
|
-
const file = loader.join(root,
|
|
221
|
+
const file = loader.join(root, uuid + ext)
|
|
222
222
|
await loader.rm(file)
|
|
223
223
|
const arr = get_array(type)
|
|
224
|
-
const b = arr.findIndex(x => x.uuid ==
|
|
224
|
+
const b = arr.findIndex(x => x.uuid == uuid)
|
|
225
225
|
if(b != -1) arr.splice(b, 1)
|
|
226
226
|
}
|
|
227
227
|
}
|
|
@@ -69,7 +69,7 @@ export class Project_Module {
|
|
|
69
69
|
return this.loader.task.load(x, true)
|
|
70
70
|
})
|
|
71
71
|
await Promise.all(r)
|
|
72
|
-
const tasks = this.memory.tasks.
|
|
72
|
+
const tasks = p.tasks_uuid.map(x => this.memory.tasks.find(y => y.uuid == x)).filter(x => x != undefined)
|
|
73
73
|
return tasks
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
@@ -85,7 +85,7 @@ export class Project_Module {
|
|
|
85
85
|
return this.loader.job.load(x, true)
|
|
86
86
|
})
|
|
87
87
|
await Promise.all(r)
|
|
88
|
-
const jobs = this.memory.jobs.
|
|
88
|
+
const jobs = p.jobs_uuid.map(x => this.memory.jobs.find(y => y.uuid == x)).filter(x => x != undefined)
|
|
89
89
|
return jobs
|
|
90
90
|
}
|
|
91
91
|
/**
|