@vorplex/core 0.0.41 → 0.0.43
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.
|
@@ -93,19 +93,18 @@ export class Task extends Subscribable {
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
getStatus() {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return TaskStatus.Cancelled;
|
|
96
|
+
if (this.status !== TaskStatus.Busy)
|
|
97
|
+
return this.status;
|
|
99
98
|
for (const task of this.tasks) {
|
|
100
99
|
const status = task.getStatus();
|
|
101
100
|
if (status === TaskStatus.Failed)
|
|
102
|
-
|
|
101
|
+
return TaskStatus.Failed;
|
|
103
102
|
if (status === TaskStatus.Busy)
|
|
104
103
|
return TaskStatus.Busy;
|
|
105
104
|
}
|
|
106
|
-
if (
|
|
107
|
-
return TaskStatus.
|
|
108
|
-
return
|
|
105
|
+
if (this.isCancelled())
|
|
106
|
+
return TaskStatus.Cancelled;
|
|
107
|
+
return TaskStatus.Busy;
|
|
109
108
|
}
|
|
110
109
|
hasWarning() {
|
|
111
110
|
for (const log of this.logs) {
|
|
@@ -58,15 +58,15 @@ export class TsonArray extends TsonSchemaBase {
|
|
|
58
58
|
return this.definition.default;
|
|
59
59
|
if (value != null && !Array.isArray(value))
|
|
60
60
|
throw new TsonError('Array expected', value, this);
|
|
61
|
-
|
|
62
|
-
if (this.definition.min != null &&
|
|
61
|
+
let result = [];
|
|
62
|
+
if (this.definition.min != null && value.length < this.definition.min)
|
|
63
63
|
throw new TsonError(`Array min length of ${this.definition.min} expected`, value, this);
|
|
64
|
-
if (this.definition.max != null &&
|
|
64
|
+
if (this.definition.max != null && value.length > this.definition.max)
|
|
65
65
|
throw new TsonError(`Array max length of ${this.definition.max} expected`, value, this);
|
|
66
66
|
if (this.definition.itemDefinition) {
|
|
67
|
-
for (const [index, item] of
|
|
67
|
+
for (const [index, item] of value.entries()) {
|
|
68
68
|
try {
|
|
69
|
-
|
|
69
|
+
result[index] = $Tson.parse(this.definition.itemDefinition).parse(item);
|
|
70
70
|
}
|
|
71
71
|
catch (error) {
|
|
72
72
|
if (!(error instanceof TsonError))
|
|
@@ -75,6 +75,6 @@ export class TsonArray extends TsonSchemaBase {
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
return
|
|
78
|
+
return result;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
@@ -55,10 +55,11 @@ export class TsonObject extends TsonSchemaBase {
|
|
|
55
55
|
return this.definition.default;
|
|
56
56
|
if (value != null && typeof value !== 'object')
|
|
57
57
|
throw new TsonError('Object expected', value, this);
|
|
58
|
+
let result = {};
|
|
58
59
|
if (this.definition.property) {
|
|
59
60
|
for (const property in value) {
|
|
60
61
|
try {
|
|
61
|
-
|
|
62
|
+
result[property] = $Tson.parse(this.definition.property).parse(value[property]);
|
|
62
63
|
}
|
|
63
64
|
catch (error) {
|
|
64
65
|
if (error instanceof TsonError) {
|
|
@@ -71,7 +72,7 @@ export class TsonObject extends TsonSchemaBase {
|
|
|
71
72
|
if (this.definition.properties) {
|
|
72
73
|
for (const property in this.definition.properties) {
|
|
73
74
|
try {
|
|
74
|
-
|
|
75
|
+
result[property] = $Tson.parse(this.definition.properties[property]).parse(value[property]);
|
|
75
76
|
}
|
|
76
77
|
catch (error) {
|
|
77
78
|
if (error instanceof TsonError) {
|
|
@@ -82,7 +83,7 @@ export class TsonObject extends TsonSchemaBase {
|
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
if (this.definition.prototype)
|
|
85
|
-
|
|
86
|
-
return
|
|
86
|
+
Object.setPrototypeOf(result, this.definition.prototype);
|
|
87
|
+
return result;
|
|
87
88
|
}
|
|
88
89
|
}
|