verteilen-core 1.3.37 → 1.3.40

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.
@@ -385,6 +385,7 @@ class ClientJavascript {
385
385
  parse: JSON.parse,
386
386
  stringify: JSON.stringify
387
387
  },
388
+ Promise: Promise,
388
389
  math: {
389
390
  floor: Math.floor,
390
391
  abs: Math.abs,
@@ -2,9 +2,11 @@ export declare enum TaskLogicType {
2
2
  GROUP = 0,
3
3
  CONDITION = 1,
4
4
  EXECUTION = 2,
5
- Single = 3,
6
- ADD = 4,
7
- OR = 5
5
+ FAILED = 3,
6
+ SINGLE = 4,
7
+ ADD = 5,
8
+ OR = 6,
9
+ NOT = 7
8
10
  }
9
11
  export declare enum SocketState {
10
12
  CONNECTING = 0,
@@ -6,9 +6,11 @@ var TaskLogicType;
6
6
  TaskLogicType[TaskLogicType["GROUP"] = 0] = "GROUP";
7
7
  TaskLogicType[TaskLogicType["CONDITION"] = 1] = "CONDITION";
8
8
  TaskLogicType[TaskLogicType["EXECUTION"] = 2] = "EXECUTION";
9
- TaskLogicType[TaskLogicType["Single"] = 3] = "Single";
10
- TaskLogicType[TaskLogicType["ADD"] = 4] = "ADD";
11
- TaskLogicType[TaskLogicType["OR"] = 5] = "OR";
9
+ TaskLogicType[TaskLogicType["FAILED"] = 3] = "FAILED";
10
+ TaskLogicType[TaskLogicType["SINGLE"] = 4] = "SINGLE";
11
+ TaskLogicType[TaskLogicType["ADD"] = 5] = "ADD";
12
+ TaskLogicType[TaskLogicType["OR"] = 6] = "OR";
13
+ TaskLogicType[TaskLogicType["NOT"] = 7] = "NOT";
12
14
  })(TaskLogicType || (exports.TaskLogicType = TaskLogicType = {}));
13
15
  var SocketState;
14
16
  (function (SocketState) {
@@ -115,7 +115,6 @@ export interface TaskLogicUnit {
115
115
  job_uuid?: string;
116
116
  job?: Job;
117
117
  children: Array<TaskLogicUnit>;
118
- children2?: Array<TaskLogicUnit>;
119
118
  }
120
119
  export interface TaskLogic {
121
120
  group: Array<TaskLogicUnit>;
package/dist/lan/en.json CHANGED
@@ -141,7 +141,8 @@
141
141
  "delete-task-confirm": "Are you sure you want to delete these tasks?",
142
142
  "create-service": "Create Service",
143
143
  "delete-service": "Delete Service",
144
- "delete-service-confirm": "Are you sure you want to delete these services?"
144
+ "delete-service-confirm": "Are you sure you want to delete these services?",
145
+ "new-condition": "Create Condition"
145
146
  },
146
147
  "toolbar": {
147
148
  "server": "Server",
@@ -349,6 +350,16 @@
349
350
  "messager_log": "messager_log(message:string)"
350
351
  }
351
352
  },
353
+ "condition": {
354
+ "group": "Group",
355
+ "condition": "Condition",
356
+ "execution": "Execution (Success)",
357
+ "failed": "Execution (Failed)",
358
+ "single": "Job Content",
359
+ "or": "Or",
360
+ "and": "And",
361
+ "not": "Not"
362
+ },
352
363
  "token": "Token",
353
364
  "info": "Information",
354
365
  "search": "Search",
@@ -141,7 +141,8 @@
141
141
  "delete-task-confirm": "確定刪除選取的工作嗎?",
142
142
  "create-service": "建立服務",
143
143
  "delete-service": "刪除服務",
144
- "delete-service-confirm": "確定刪除選取的服務嗎?"
144
+ "delete-service-confirm": "確定刪除選取的服務嗎?",
145
+ "new-condition": "建立條件"
145
146
  },
146
147
  "toolbar": {
147
148
  "server": "伺服器",
@@ -349,6 +350,16 @@
349
350
  "messager_log": "messager_log(message:string)"
350
351
  }
351
352
  },
353
+ "condition": {
354
+ "group": "群組",
355
+ "condition": "條件",
356
+ "execution": "執行 (成功)",
357
+ "failed": "執行 (失敗)",
358
+ "single": "工作內容",
359
+ "or": "Or",
360
+ "and": "And",
361
+ "not": "Not"
362
+ },
352
363
  "token": "密鑰",
353
364
  "info": "資訊",
354
365
  "search": "搜尋",
@@ -150,6 +150,7 @@ export declare const i18nDefaultData: {
150
150
  "create-service": string;
151
151
  "delete-service": string;
152
152
  "delete-service-confirm": string;
153
+ "new-condition": string;
153
154
  };
154
155
  toolbar: {
155
156
  server: string;
@@ -357,6 +358,16 @@ export declare const i18nDefaultData: {
357
358
  messager_log: string;
358
359
  };
359
360
  };
361
+ condition: {
362
+ group: string;
363
+ condition: string;
364
+ execution: string;
365
+ failed: string;
366
+ single: string;
367
+ or: string;
368
+ and: string;
369
+ not: string;
370
+ };
360
371
  token: string;
361
372
  info: string;
362
373
  search: string;
@@ -581,6 +592,7 @@ export declare const i18nDefaultData: {
581
592
  "create-service": string;
582
593
  "delete-service": string;
583
594
  "delete-service-confirm": string;
595
+ "new-condition": string;
584
596
  };
585
597
  toolbar: {
586
598
  server: string;
@@ -788,6 +800,16 @@ export declare const i18nDefaultData: {
788
800
  messager_log: string;
789
801
  };
790
802
  };
803
+ condition: {
804
+ group: string;
805
+ condition: string;
806
+ execution: string;
807
+ failed: string;
808
+ single: string;
809
+ or: string;
810
+ and: string;
811
+ not: string;
812
+ };
791
813
  token: string;
792
814
  info: string;
793
815
  search: string;
@@ -1015,6 +1037,7 @@ export declare const i18n: import("vue-i18n").I18n<{
1015
1037
  "create-service": string;
1016
1038
  "delete-service": string;
1017
1039
  "delete-service-confirm": string;
1040
+ "new-condition": string;
1018
1041
  };
1019
1042
  toolbar: {
1020
1043
  server: string;
@@ -1222,6 +1245,16 @@ export declare const i18n: import("vue-i18n").I18n<{
1222
1245
  messager_log: string;
1223
1246
  };
1224
1247
  };
1248
+ condition: {
1249
+ group: string;
1250
+ condition: string;
1251
+ execution: string;
1252
+ failed: string;
1253
+ single: string;
1254
+ or: string;
1255
+ and: string;
1256
+ not: string;
1257
+ };
1225
1258
  token: string;
1226
1259
  info: string;
1227
1260
  search: string;
@@ -1446,6 +1479,7 @@ export declare const i18n: import("vue-i18n").I18n<{
1446
1479
  "create-service": string;
1447
1480
  "delete-service": string;
1448
1481
  "delete-service-confirm": string;
1482
+ "new-condition": string;
1449
1483
  };
1450
1484
  toolbar: {
1451
1485
  server: string;
@@ -1653,6 +1687,16 @@ export declare const i18n: import("vue-i18n").I18n<{
1653
1687
  messager_log: string;
1654
1688
  };
1655
1689
  };
1690
+ condition: {
1691
+ group: string;
1692
+ condition: string;
1693
+ execution: string;
1694
+ failed: string;
1695
+ single: string;
1696
+ or: string;
1697
+ and: string;
1698
+ not: string;
1699
+ };
1656
1700
  token: string;
1657
1701
  info: string;
1658
1702
  search: string;
@@ -44,6 +44,7 @@ export interface RecordIOBase {
44
44
  export interface RecordMongoBase {
45
45
  }
46
46
  export declare const _CreateRecordMemoryLoader: (loader: MemoryData, type: RecordType) => RecordIOLoader;
47
+ export declare const ObsoleteSupport: (loader: RecordIOBase, type: RecordType, folder: string) => Promise<void>;
47
48
  export declare const _CreateRecordIOLoader: (loader: RecordIOBase, memory: MemoryData, type: RecordType, folder: string, ext?: string) => RecordIOLoader;
48
49
  export declare const CreateRecordMemoryLoader: (loader: MemoryData) => RecordLoader;
49
50
  export declare const CreateRecordIOLoader: (loader: RecordIOBase, memory: MemoryData) => RecordLoader;
package/dist/server/io.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CreateRecordMongoLoader = exports.CreateRecordIOLoader = exports.CreateRecordMemoryLoader = exports._CreateRecordIOLoader = exports._CreateRecordMemoryLoader = void 0;
3
+ exports.CreateRecordMongoLoader = exports.CreateRecordIOLoader = exports.CreateRecordMemoryLoader = exports._CreateRecordIOLoader = exports.ObsoleteSupport = exports._CreateRecordMemoryLoader = void 0;
4
4
  const interface_1 = require("../interface");
5
5
  const _CreateRecordMemoryLoader = (loader, type) => {
6
6
  const get_array = (type) => {
@@ -55,6 +55,60 @@ const _CreateRecordMemoryLoader = (loader, type) => {
55
55
  };
56
56
  };
57
57
  exports._CreateRecordMemoryLoader = _CreateRecordMemoryLoader;
58
+ const ObsoleteSupport = async (loader, type, folder) => {
59
+ if (type == interface_1.RecordType.PROJECT) {
60
+ const path = loader.join(loader.root, "record");
61
+ if (!loader.exists(path))
62
+ return;
63
+ const p = await loader.read_dir_file(path);
64
+ const ps = p.filter(x => x.endsWith(".json")).map(x => {
65
+ const path_r = loader.join(path, x);
66
+ return loader.read_string(path_r);
67
+ });
68
+ const allRecordText = await Promise.all(ps);
69
+ const allRecord = allRecordText.map(x => JSON.parse(x));
70
+ const execute = allRecord.map(async (x) => {
71
+ x.tasks = [];
72
+ x.databaser_uuid = x.parameter_uuid;
73
+ x.tasks_uuid = x.task.map(y => y.uuid);
74
+ const tasks = x.task;
75
+ delete x.parameter_uuid;
76
+ delete x.task;
77
+ const execute_task = tasks.map(async (y) => {
78
+ const jobs = y.jobs;
79
+ y.jobs = [];
80
+ y.jobs_uuid = y.jobs.map(z => z.uuid);
81
+ const execute_jobs = jobs.map(async (z) => {
82
+ z.id_args = [];
83
+ const d3 = loader.join(loader.root, "job", `${z.uuid}.json`);
84
+ return loader.write_string(d3, JSON.stringify(z, null, 4));
85
+ });
86
+ await Promise.all(execute_jobs);
87
+ const d2 = loader.join(loader.root, "task", `${y.uuid}.json`);
88
+ return loader.write_string(d2, JSON.stringify(y, null, 4));
89
+ });
90
+ await Promise.all(execute_task);
91
+ const d1 = loader.join(loader.root, "project", `${x.uuid}.json`);
92
+ return loader.write_string(d1, JSON.stringify(x, null, 4));
93
+ });
94
+ await Promise.all(execute);
95
+ await loader.rm(path);
96
+ }
97
+ else if (type == interface_1.RecordType.DATABASE) {
98
+ const path = loader.join(loader.root, "parameter");
99
+ if (!loader.exists(path))
100
+ return;
101
+ const p = await loader.read_dir_file(path);
102
+ const ps = p.filter(x => x.endsWith(".json")).map(x => {
103
+ const path2 = loader.join(path, x);
104
+ const path3 = loader.join(loader.root, folder, x);
105
+ return loader.cp(path2, path3);
106
+ });
107
+ await Promise.all(ps);
108
+ loader.rm(path);
109
+ }
110
+ };
111
+ exports.ObsoleteSupport = ObsoleteSupport;
58
112
  const _CreateRecordIOLoader = (loader, memory, type, folder, ext = ".json") => {
59
113
  const get_array = (type) => {
60
114
  switch (type) {
@@ -74,6 +128,7 @@ const _CreateRecordIOLoader = (loader, memory, type, folder, ext = ".json") => {
74
128
  const root = loader.join(loader.root, folder);
75
129
  if (!loader.exists(root))
76
130
  await loader.mkdir(root);
131
+ await (0, exports.ObsoleteSupport)(loader, type, folder);
77
132
  const files = await loader.read_dir_file(root);
78
133
  const r = files.map(x => loader.read_string(loader.join(root, x), { encoding: 'utf8', flag: 'r' }));
79
134
  const p = await Promise.all(r);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "verteilen-core",
3
- "version": "1.3.37",
3
+ "version": "1.3.40",
4
4
  "license": "MIT",
5
5
  "homepage": "https://verteilen.github.io/wiki/",
6
6
  "author": "Elly",
@@ -389,6 +389,7 @@ export class ClientJavascript {
389
389
  parse: JSON.parse,
390
390
  stringify: JSON.stringify
391
391
  },
392
+ Promise: Promise,
392
393
  math: {
393
394
  floor: Math.floor,
394
395
  abs: Math.abs,
@@ -13,7 +13,7 @@
13
13
  * It effect the decoder behaviour
14
14
  */
15
15
  export enum TaskLogicType {
16
- GROUP, CONDITION, EXECUTION, Single, ADD, OR
16
+ GROUP, CONDITION, EXECUTION, FAILED, SINGLE, ADD, OR, NOT
17
17
  }
18
18
 
19
19
  /**
@@ -264,14 +264,6 @@ export interface TaskLogicUnit {
264
264
  * **Common Logic Group**
265
265
  */
266
266
  children: Array<TaskLogicUnit>
267
- /**
268
- * **False Logic Group**
269
- * - Group
270
- * - Condition
271
- * - Execution (True)
272
- * - Execution (False) <- This part
273
- */
274
- children2?: Array<TaskLogicUnit>
275
267
  }
276
268
 
277
269
  /**
package/src/lan/en.json CHANGED
@@ -141,7 +141,8 @@
141
141
  "delete-task-confirm": "Are you sure you want to delete these tasks?",
142
142
  "create-service": "Create Service",
143
143
  "delete-service": "Delete Service",
144
- "delete-service-confirm": "Are you sure you want to delete these services?"
144
+ "delete-service-confirm": "Are you sure you want to delete these services?",
145
+ "new-condition": "Create Condition"
145
146
  },
146
147
  "toolbar": {
147
148
  "server": "Server",
@@ -349,6 +350,16 @@
349
350
  "messager_log": "messager_log(message:string)"
350
351
  }
351
352
  },
353
+ "condition": {
354
+ "group": "Group",
355
+ "condition": "Condition",
356
+ "execution": "Execution (Success)",
357
+ "failed": "Execution (Failed)",
358
+ "single": "Job Content",
359
+ "or": "Or",
360
+ "and": "And",
361
+ "not": "Not"
362
+ },
352
363
  "token": "Token",
353
364
  "info": "Information",
354
365
  "search": "Search",
@@ -141,7 +141,8 @@
141
141
  "delete-task-confirm": "確定刪除選取的工作嗎?",
142
142
  "create-service": "建立服務",
143
143
  "delete-service": "刪除服務",
144
- "delete-service-confirm": "確定刪除選取的服務嗎?"
144
+ "delete-service-confirm": "確定刪除選取的服務嗎?",
145
+ "new-condition": "建立條件"
145
146
  },
146
147
  "toolbar": {
147
148
  "server": "伺服器",
@@ -349,6 +350,16 @@
349
350
  "messager_log": "messager_log(message:string)"
350
351
  }
351
352
  },
353
+ "condition": {
354
+ "group": "群組",
355
+ "condition": "條件",
356
+ "execution": "執行 (成功)",
357
+ "failed": "執行 (失敗)",
358
+ "single": "工作內容",
359
+ "or": "Or",
360
+ "and": "And",
361
+ "not": "Not"
362
+ },
352
363
  "token": "密鑰",
353
364
  "info": "資訊",
354
365
  "search": "搜尋",
package/src/server/io.ts CHANGED
@@ -136,6 +136,59 @@ export const _CreateRecordMemoryLoader = (loader:MemoryData, type:RecordType):Re
136
136
  }
137
137
  }
138
138
  }
139
+ export const ObsoleteSupport = async (loader:RecordIOBase, type:RecordType, folder:string) => {
140
+ if(type == RecordType.PROJECT){
141
+ const path = loader.join(loader.root, "record")
142
+ if(!loader.exists(path)) return
143
+ const p = await loader.read_dir_file(path)
144
+ const ps = p.filter(x => x.endsWith(".json")).map(x => {
145
+ const path_r = loader.join(path, x)
146
+ return loader.read_string(path_r)
147
+ })
148
+ const allRecordText:Array<string> = await Promise.all(ps)
149
+ const allRecord:Array<any> = allRecordText.map(x => JSON.parse(x))
150
+ const execute = allRecord.map(async x => {
151
+ x.tasks = []
152
+ x.databaser_uuid = x.parameter_uuid
153
+ x.tasks_uuid = x.task.map(y => y.uuid)
154
+ const tasks:Array<any> = x.task
155
+ delete x.parameter_uuid
156
+ delete x.task
157
+
158
+ const execute_task = tasks.map(async y => {
159
+ const jobs = y.jobs
160
+ y.jobs = []
161
+ y.jobs_uuid = y.jobs.map(z => z.uuid)
162
+
163
+ const execute_jobs = jobs.map(async z => {
164
+ z.id_args = []
165
+ const d3 = loader.join(loader.root, "job", `${z.uuid}.json`)
166
+ return loader.write_string(d3, JSON.stringify(z, null, 4))
167
+ })
168
+ await Promise.all(execute_jobs)
169
+ const d2 = loader.join(loader.root, "task", `${y.uuid}.json`)
170
+ return loader.write_string(d2, JSON.stringify(y, null, 4))
171
+ })
172
+ await Promise.all(execute_task)
173
+ const d1 = loader.join(loader.root, "project", `${x.uuid}.json`)
174
+ return loader.write_string(d1, JSON.stringify(x, null, 4))
175
+ })
176
+ await Promise.all(execute)
177
+ await loader.rm(path)
178
+ }
179
+ else if(type == RecordType.DATABASE){
180
+ const path = loader.join(loader.root, "parameter")
181
+ if(!loader.exists(path)) return
182
+ const p = await loader.read_dir_file(path)
183
+ const ps = p.filter(x => x.endsWith(".json")).map(x => {
184
+ const path2 = loader.join(path, x)
185
+ const path3 = loader.join(loader.root, folder, x)
186
+ return loader.cp(path2, path3)
187
+ })
188
+ await Promise.all(ps)
189
+ loader.rm(path)
190
+ }
191
+ }
139
192
  /**
140
193
  * **Create the interface for record files storage**\
141
194
  * Generate a loader interface for register to server event
@@ -162,6 +215,7 @@ export const _CreateRecordIOLoader = (loader:RecordIOBase, memory:MemoryData, ty
162
215
  load_all: async ():Promise<Array<string>> => {
163
216
  const root = loader.join(loader.root, folder)
164
217
  if(!loader.exists(root)) await loader.mkdir(root)
218
+ await ObsoleteSupport(loader, type, folder)
165
219
  const files = await loader.read_dir_file(root)
166
220
  const r:Array<Promise<string>> = files.map(x =>
167
221
  loader.read_string(loader.join(root, x), { encoding: 'utf8', flag: 'r' })