@mat3ra/wode 2026.7.29-0 → 2026.8.13-0
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/js/Subworkflow.d.ts +21 -20
- package/dist/js/Subworkflow.js +8 -7
- package/dist/js/Workflow.d.ts +11 -10
- package/dist/js/Workflow.js +7 -3
- package/dist/js/context/mixins/MaterialContextMixin.d.ts +1 -4
- package/dist/js/context/providers/CollinearMagnetizationDataManager.js +1 -1
- package/dist/js/context/providers/Hubbard/HubbardContextProvider.d.ts +6 -4
- package/dist/js/context/providers/Hubbard/HubbardContextProvider.js +12 -7
- package/dist/js/context/providers/NonCollinearMagnetizationDataManager.js +1 -1
- package/dist/js/context/providers/PointsGrid/PointsGridFormDataProvider.d.ts +6 -4
- package/dist/js/context/providers/PointsGrid/PointsGridFormDataProvider.js +10 -5
- package/dist/js/context/providers/PointsPath/PointsPathFormDataProvider.d.ts +3 -4
- package/dist/js/context/providers/PointsPath/PointsPathFormDataProvider.js +3 -2
- package/dist/js/context/providers/by_application/espresso/QEPWXInputDataManager.js +2 -1
- package/dist/js/context/providers/by_application/nwchem/NWChemInputDataManager.js +1 -1
- package/dist/js/generated/AssertionUnitSchemaMixin.d.ts +2 -2
- package/dist/js/generated/AssignmentUnitSchemaMixin.d.ts +2 -2
- package/dist/js/generated/BaseUnitSchemaMixin.d.ts +2 -2
- package/dist/js/generated/BaseUnitSchemaMixin.js +6 -18
- package/dist/js/generated/ConditionUnitSchemaMixin.d.ts +2 -2
- package/dist/js/generated/ErrorUnitSchemaMixin.d.ts +2 -2
- package/dist/js/generated/ExecutionUnitInputSchemaMixin.d.ts +2 -2
- package/dist/js/generated/ExecutionUnitSchemaMixin.d.ts +2 -2
- package/dist/js/generated/IOUnitSchemaMixin.d.ts +2 -2
- package/dist/js/generated/MapUnitSchemaMixin.d.ts +2 -2
- package/dist/js/generated/ReduceUnitSchemaMixin.d.ts +2 -2
- package/dist/js/generated/StatusTrackSchemaMixin.d.ts +5 -0
- package/dist/js/generated/{StatusSchemaMixin.js → StatusTrackSchemaMixin.js} +2 -8
- package/dist/js/generated/SubworkflowSchemaMixin.d.ts +2 -2
- package/dist/js/generated/SubworkflowUnitSchemaMixin.d.ts +2 -2
- package/dist/js/generated/WorkflowSchemaMixin.d.ts +2 -2
- package/dist/js/units/AssertionUnit.d.ts +4 -7
- package/dist/js/units/AssignmentUnit.d.ts +4 -7
- package/dist/js/units/BaseUnit.d.ts +13 -12
- package/dist/js/units/BaseUnit.js +14 -11
- package/dist/js/units/ConditionUnit.d.ts +4 -7
- package/dist/js/units/ErrorUnit.d.ts +4 -7
- package/dist/js/units/ExecutionUnit.d.ts +4 -7
- package/dist/js/units/ExecutionUnit.js +6 -6
- package/dist/js/units/ExecutionUnitInput.d.ts +3 -7
- package/dist/js/units/ExecutionUnitInput.js +12 -2
- package/dist/js/units/IOUnit.d.ts +4 -7
- package/dist/js/units/MapUnit.d.ts +4 -7
- package/dist/js/units/MapUnit.js +1 -1
- package/dist/js/units/ReduceUnit.d.ts +4 -7
- package/dist/js/units/SubworkflowUnit.d.ts +4 -7
- package/package.json +8 -9
- package/src/js/Subworkflow.ts +42 -32
- package/src/js/Workflow.ts +28 -16
- package/src/js/context/mixins/MaterialContextMixin.ts +1 -2
- package/src/js/context/providers/CollinearMagnetizationDataManager.ts +1 -1
- package/src/js/context/providers/Hubbard/HubbardContextProvider.ts +17 -8
- package/src/js/context/providers/NonCollinearMagnetizationDataManager.ts +1 -1
- package/src/js/context/providers/PointsGrid/PointsGridFormDataProvider.ts +14 -12
- package/src/js/context/providers/PointsPath/PointsPathFormDataProvider.ts +9 -6
- package/src/js/context/providers/by_application/espresso/QEPWXInputDataManager.ts +4 -3
- package/src/js/context/providers/by_application/nwchem/NWChemInputDataManager.ts +1 -1
- package/src/js/generated/AssertionUnitSchemaMixin.ts +11 -6
- package/src/js/generated/AssignmentUnitSchemaMixin.ts +12 -7
- package/src/js/generated/BaseUnitSchemaMixin.ts +17 -26
- package/src/js/generated/ConditionUnitSchemaMixin.ts +15 -10
- package/src/js/generated/ErrorUnitSchemaMixin.ts +7 -5
- package/src/js/generated/ExecutionUnitInputSchemaMixin.ts +12 -8
- package/src/js/generated/ExecutionUnitSchemaMixin.ts +14 -9
- package/src/js/generated/IOUnitSchemaMixin.ts +7 -7
- package/src/js/generated/MapUnitSchemaMixin.ts +6 -6
- package/src/js/generated/ReduceUnitSchemaMixin.ts +8 -6
- package/src/js/generated/StatusTrackSchemaMixin.ts +24 -0
- package/src/js/generated/SubworkflowSchemaMixin.ts +12 -10
- package/src/js/generated/SubworkflowUnitSchemaMixin.ts +9 -4
- package/src/js/generated/WorkflowSchemaMixin.ts +10 -10
- package/src/js/units/AssertionUnit.ts +3 -7
- package/src/js/units/AssignmentUnit.ts +4 -7
- package/src/js/units/BaseUnit.ts +39 -29
- package/src/js/units/ConditionUnit.ts +3 -7
- package/src/js/units/ErrorUnit.ts +3 -7
- package/src/js/units/ExecutionUnit.ts +10 -15
- package/src/js/units/ExecutionUnitInput.ts +16 -13
- package/src/js/units/IOUnit.ts +3 -7
- package/src/js/units/MapUnit.ts +4 -10
- package/src/js/units/ReduceUnit.ts +3 -7
- package/src/js/units/SubworkflowUnit.ts +3 -7
- package/dist/js/WorkflowDesignerMaterial.d.ts +0 -21
- package/dist/js/WorkflowDesignerMaterial.js +0 -26
- package/dist/js/generated/StatusSchemaMixin.d.ts +0 -5
- package/dist/js/repair/createErrorUnitData.d.ts +0 -3
- package/dist/js/repair/createErrorUnitData.js +0 -25
- package/dist/js/repair/formatRepairReason.d.ts +0 -1
- package/dist/js/repair/formatRepairReason.js +0 -22
- package/dist/js/repair/types.d.ts +0 -16
- package/dist/js/repair/types.js +0 -2
- package/dist/js/subworkflows/convergence/enums.js +0 -15
- package/dist/js/subworkflows/convergence/factory.js +0 -36
- package/dist/js/subworkflows/subworkflow.js +0 -285
- package/dist/js/utils/subworkflow.d.ts +0 -2
- package/dist/js/utils/subworkflow.js +0 -29
- package/dist/js/utils/underscoreStringSlugify.d.ts +0 -6
- package/dist/js/utils/underscoreStringSlugify.js +0 -32
- package/dist/js/utils.js +0 -87
- package/dist/js/workflows/workflow.d.ts +0 -4404
- package/dist/js/workflows/workflow.js +0 -315
- package/src/js/generated/StatusSchemaMixin.ts +0 -28
|
@@ -1,315 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Workflow = void 0;
|
|
7
|
-
/* eslint-disable max-classes-per-file */
|
|
8
|
-
const entity_1 = require("@mat3ra/code/dist/js/entity");
|
|
9
|
-
const hash_1 = require("@mat3ra/code/dist/js/entity/mixins/hash");
|
|
10
|
-
const workflow_json_1 = __importDefault(require("@mat3ra/esse/dist/js/schema/workflow.json"));
|
|
11
|
-
const ide_1 = require("@mat3ra/ide");
|
|
12
|
-
const mode_1 = require("@mat3ra/mode");
|
|
13
|
-
const utils_1 = require("@mat3ra/utils");
|
|
14
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
15
|
-
const mixwith_1 = require("mixwith");
|
|
16
|
-
const underscore_1 = __importDefault(require("underscore"));
|
|
17
|
-
const underscore_string_1 = __importDefault(require("underscore.string"));
|
|
18
|
-
const enums_1 = require("../enums");
|
|
19
|
-
const subworkflow_1 = require("../subworkflows/subworkflow");
|
|
20
|
-
const units_1 = require("../units");
|
|
21
|
-
const factory_1 = require("../units/factory");
|
|
22
|
-
const utils_2 = require("../utils");
|
|
23
|
-
const default_1 = __importDefault(require("./default"));
|
|
24
|
-
const relaxation_1 = require("./relaxation");
|
|
25
|
-
const { MODEL_NAMES } = mode_1.tree;
|
|
26
|
-
class BaseWorkflow extends (0, mixwith_1.mix)(entity_1.NamedDefaultableRepetitionContextAndRenderInMemoryEntity).with(ide_1.ComputedEntityMixin, relaxation_1.RelaxationLogicMixin, hash_1.HashedEntityMixin) {
|
|
27
|
-
}
|
|
28
|
-
class Workflow extends BaseWorkflow {
|
|
29
|
-
constructor(config, _Subworkflow = subworkflow_1.Subworkflow, _UnitFactory = factory_1.UnitFactory, _Workflow = Workflow, _MapUnit = units_1.MapUnit) {
|
|
30
|
-
if (!config._id) {
|
|
31
|
-
config._id = Workflow.generateWorkflowId(config.name, config.properties, config.subworkflows, config.applicationName);
|
|
32
|
-
}
|
|
33
|
-
super(config);
|
|
34
|
-
this._Subworkflow = _Subworkflow;
|
|
35
|
-
this._UnitFactory = _UnitFactory;
|
|
36
|
-
this._Workflow = _Workflow;
|
|
37
|
-
this._MapUnit = _MapUnit;
|
|
38
|
-
if (!config.skipInitialize)
|
|
39
|
-
this.initialize();
|
|
40
|
-
}
|
|
41
|
-
initialize() {
|
|
42
|
-
const me = this;
|
|
43
|
-
this._subworkflows = this.prop("subworkflows").map((x) => new me._Subworkflow(x));
|
|
44
|
-
this._units = this.prop("units").map((unit) => me._UnitFactory.create(unit));
|
|
45
|
-
this._json.workflows = this._json.workflows || [];
|
|
46
|
-
this._workflows = this.prop("workflows").map((x) => new me._Workflow(x));
|
|
47
|
-
}
|
|
48
|
-
static get defaultConfig() {
|
|
49
|
-
return default_1.default;
|
|
50
|
-
}
|
|
51
|
-
static generateWorkflowId(name, properties = null, subworkflows = null, applicationName = null) {
|
|
52
|
-
const propsInfo = (properties === null || properties === void 0 ? void 0 : properties.length) ? properties.sort().join(",") : "";
|
|
53
|
-
const swInfo = (subworkflows === null || subworkflows === void 0 ? void 0 : subworkflows.length)
|
|
54
|
-
? subworkflows.map((sw) => sw.name || "unknown").join(",")
|
|
55
|
-
: "";
|
|
56
|
-
const seed = [`workflow-${name}`, applicationName, propsInfo, swInfo]
|
|
57
|
-
.filter((p) => p)
|
|
58
|
-
.join("-");
|
|
59
|
-
if (this.usePredefinedIds)
|
|
60
|
-
return utils_1.Utils.uuid.getUUIDFromNamespace(seed);
|
|
61
|
-
return utils_1.Utils.uuid.getUUID();
|
|
62
|
-
}
|
|
63
|
-
static fromSubworkflow(subworkflow, ClsConstructor = Workflow) {
|
|
64
|
-
const config = {
|
|
65
|
-
name: subworkflow.name,
|
|
66
|
-
subworkflows: [subworkflow.toJSON()],
|
|
67
|
-
units: (0, utils_2.setNextLinks)((0, utils_2.setUnitsHead)([subworkflow.getAsUnit().toJSON()])),
|
|
68
|
-
properties: subworkflow.properties,
|
|
69
|
-
applicationName: subworkflow.application.name,
|
|
70
|
-
};
|
|
71
|
-
return new ClsConstructor(config);
|
|
72
|
-
}
|
|
73
|
-
static fromSubworkflows(name, ClsConstructor = Workflow, ...subworkflows) {
|
|
74
|
-
return new ClsConstructor(name, subworkflows, subworkflows.map((sw) => sw.getAsUnit()));
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* @summary Adds subworkflow to current workflow.
|
|
78
|
-
* @param subworkflow {Subworkflow}
|
|
79
|
-
* @param head {Boolean}
|
|
80
|
-
*/
|
|
81
|
-
addSubworkflow(subworkflow, head = false, index = -1) {
|
|
82
|
-
const subworkflowUnit = subworkflow.getAsUnit();
|
|
83
|
-
if (head) {
|
|
84
|
-
this.subworkflows.unshift(subworkflow);
|
|
85
|
-
this.addUnit(subworkflowUnit, head, index);
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
this.subworkflows.push(subworkflow);
|
|
89
|
-
this.addUnit(subworkflowUnit, head, index);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
removeSubworkflow(id) {
|
|
93
|
-
const subworkflowUnit = this.units.find((u) => u.id === id);
|
|
94
|
-
if (subworkflowUnit)
|
|
95
|
-
this.removeUnit(subworkflowUnit.flowchartId);
|
|
96
|
-
}
|
|
97
|
-
subworkflowId(index) {
|
|
98
|
-
const sw = this.prop(`subworkflows[${index}]`);
|
|
99
|
-
return sw ? sw._id : null;
|
|
100
|
-
}
|
|
101
|
-
replaceSubworkflowAtIndex(index, newSubworkflow) {
|
|
102
|
-
this._subworkflows[index] = newSubworkflow;
|
|
103
|
-
this.setUnits((0, utils_2.setNextLinks)((0, utils_2.setUnitsHead)(this._units)));
|
|
104
|
-
}
|
|
105
|
-
get units() {
|
|
106
|
-
return this._units;
|
|
107
|
-
}
|
|
108
|
-
setUnits(arr) {
|
|
109
|
-
this._units = arr;
|
|
110
|
-
}
|
|
111
|
-
// returns a list of `app` Classes
|
|
112
|
-
get usedApplications() {
|
|
113
|
-
const swApplications = this.subworkflows.map((sw) => sw.application);
|
|
114
|
-
const wfApplications = lodash_1.default.flatten(this.workflows.map((w) => w.usedApplications));
|
|
115
|
-
return lodash_1.default.uniqBy(swApplications.concat(wfApplications), (a) => a.name);
|
|
116
|
-
}
|
|
117
|
-
// return application names
|
|
118
|
-
get usedApplicationNames() {
|
|
119
|
-
return this.usedApplications.map((a) => a.name);
|
|
120
|
-
}
|
|
121
|
-
get usedApplicationVersions() {
|
|
122
|
-
return this.usedApplications.map((a) => a.version);
|
|
123
|
-
}
|
|
124
|
-
get usedApplicationNamesWithVersions() {
|
|
125
|
-
return this.usedApplications.map((a) => `${a.name} ${a.version}`);
|
|
126
|
-
}
|
|
127
|
-
get usedModels() {
|
|
128
|
-
return lodash_1.default.uniq(this.subworkflows.map((sw) => sw.model.type));
|
|
129
|
-
}
|
|
130
|
-
get humanReadableUsedModels() {
|
|
131
|
-
return this.usedModels.filter((m) => m !== "unknown").map((m) => MODEL_NAMES[m]);
|
|
132
|
-
}
|
|
133
|
-
toJSON(exclude = []) {
|
|
134
|
-
return lodash_1.default.omit({
|
|
135
|
-
...super.toJSON(),
|
|
136
|
-
units: this._units.map((x) => x.toJSON()),
|
|
137
|
-
subworkflows: this._subworkflows.map((x) => x.toJSON()),
|
|
138
|
-
workflows: this.workflows.map((x) => x.toJSON()),
|
|
139
|
-
...(this.compute ? { compute: this.compute } : {}), // {"compute": null } won't pass esse validation
|
|
140
|
-
}, exclude);
|
|
141
|
-
}
|
|
142
|
-
get isDefault() {
|
|
143
|
-
return this.prop("isDefault", false);
|
|
144
|
-
}
|
|
145
|
-
get isMultiMaterial() {
|
|
146
|
-
const fromSubworkflows = this.subworkflows.some((sw) => sw.isMultiMaterial);
|
|
147
|
-
return this.prop("isMultiMaterial") || fromSubworkflows;
|
|
148
|
-
}
|
|
149
|
-
set isMultiMaterial(value) {
|
|
150
|
-
this.setProp("isMultiMaterial", value);
|
|
151
|
-
}
|
|
152
|
-
set isUsingDataset(value) {
|
|
153
|
-
this.setProp("isUsingDataset", value);
|
|
154
|
-
}
|
|
155
|
-
get isUsingDataset() {
|
|
156
|
-
return !!this.prop("isUsingDataset", false);
|
|
157
|
-
}
|
|
158
|
-
get properties() {
|
|
159
|
-
return lodash_1.default.uniq(lodash_1.default.flatten(this._subworkflows.map((x) => x.properties)));
|
|
160
|
-
}
|
|
161
|
-
get humanReadableProperties() {
|
|
162
|
-
return this.properties.map((name) => underscore_string_1.default.humanize(name));
|
|
163
|
-
}
|
|
164
|
-
get systemName() {
|
|
165
|
-
return underscore_string_1.default.slugify(`${this.usedApplicationNames.join(":")}-${this.name.toLowerCase()}`);
|
|
166
|
-
}
|
|
167
|
-
get defaultDescription() {
|
|
168
|
-
return `${this.usedModels
|
|
169
|
-
.join(", ")
|
|
170
|
-
.toUpperCase()} workflow using ${this.usedApplicationNames.join(", ")}.`;
|
|
171
|
-
}
|
|
172
|
-
get exabyteId() {
|
|
173
|
-
return this.prop("exabyteId");
|
|
174
|
-
}
|
|
175
|
-
get hash() {
|
|
176
|
-
return this.prop("hash", "");
|
|
177
|
-
}
|
|
178
|
-
get isOutdated() {
|
|
179
|
-
return this.prop("isOutdated", false);
|
|
180
|
-
}
|
|
181
|
-
get history() {
|
|
182
|
-
return this.prop("history", []);
|
|
183
|
-
}
|
|
184
|
-
setMethodData(methodData) {
|
|
185
|
-
this.subworkflows.forEach((sw) => {
|
|
186
|
-
const method = methodData.getMethodBySubworkflow(sw);
|
|
187
|
-
if (method)
|
|
188
|
-
sw.model.setMethod(method);
|
|
189
|
-
});
|
|
190
|
-
this.workflows.forEach((wf) => {
|
|
191
|
-
wf.subworkflows.forEach((sw) => {
|
|
192
|
-
const method = methodData.getMethodBySubworkflow(sw);
|
|
193
|
-
if (method)
|
|
194
|
-
sw.model.setMethod(method);
|
|
195
|
-
});
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* @param unit {Unit}
|
|
200
|
-
* @param head {Boolean}
|
|
201
|
-
* @param index {Number}
|
|
202
|
-
*/
|
|
203
|
-
addUnit(unit, head = false, index = -1) {
|
|
204
|
-
const { units } = this;
|
|
205
|
-
if (units.length === 0) {
|
|
206
|
-
unit.head = true;
|
|
207
|
-
this.setUnits([unit]);
|
|
208
|
-
}
|
|
209
|
-
else {
|
|
210
|
-
if (head) {
|
|
211
|
-
units.unshift(unit);
|
|
212
|
-
}
|
|
213
|
-
else if (index >= 0) {
|
|
214
|
-
units.splice(index, 0, unit);
|
|
215
|
-
}
|
|
216
|
-
else {
|
|
217
|
-
units.push(unit);
|
|
218
|
-
}
|
|
219
|
-
this.setUnits((0, utils_2.setNextLinks)((0, utils_2.setUnitsHead)(units)));
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
removeUnit(flowchartId) {
|
|
223
|
-
if (this.units.length < 2)
|
|
224
|
-
return;
|
|
225
|
-
const unit = this.units.find((x) => x.flowchartId === flowchartId);
|
|
226
|
-
const previousUnit = this.units.find((x) => x.next === unit.flowchartId);
|
|
227
|
-
if (previousUnit) {
|
|
228
|
-
delete previousUnit.next;
|
|
229
|
-
}
|
|
230
|
-
this._subworkflows = this._subworkflows.filter((x) => x.id !== unit.id);
|
|
231
|
-
this._units = (0, utils_2.setNextLinks)((0, utils_2.setUnitsHead)(this._units.filter((x) => x.flowchartId !== flowchartId)));
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* @return Subworkflow[]
|
|
235
|
-
*/
|
|
236
|
-
get subworkflows() {
|
|
237
|
-
return this._subworkflows;
|
|
238
|
-
}
|
|
239
|
-
get workflows() {
|
|
240
|
-
return this._workflows;
|
|
241
|
-
}
|
|
242
|
-
/*
|
|
243
|
-
* @param type {String|Object} Unit type, map or subworkflow
|
|
244
|
-
* @param head {Boolean}
|
|
245
|
-
* @param index {Number} Index at which the unit will be added. -1 by default (ignored).
|
|
246
|
-
*/
|
|
247
|
-
addUnitType(type, head = false, index = -1) {
|
|
248
|
-
switch (type) {
|
|
249
|
-
case enums_1.UNIT_TYPES.map:
|
|
250
|
-
// eslint-disable-next-line no-case-declarations
|
|
251
|
-
const workflowConfig = default_1.default;
|
|
252
|
-
// eslint-disable-next-line no-case-declarations
|
|
253
|
-
const mapUnit = new this._MapUnit();
|
|
254
|
-
workflowConfig._id = this._Workflow.generateWorkflowId(workflowConfig.name, workflowConfig.properties, workflowConfig.subworkflows, this.applicationName);
|
|
255
|
-
this.prop("workflows").push(workflowConfig);
|
|
256
|
-
this._workflows = this.prop("workflows").map((x) => new this._Workflow(x));
|
|
257
|
-
mapUnit.setWorkflowId(workflowConfig._id);
|
|
258
|
-
this.addUnit(mapUnit, head, index);
|
|
259
|
-
break;
|
|
260
|
-
case enums_1.UNIT_TYPES.subworkflow:
|
|
261
|
-
this.addSubworkflow(this._Subworkflow.createDefault(), head, index);
|
|
262
|
-
break;
|
|
263
|
-
default:
|
|
264
|
-
console.log(`unit_type=${type} unrecognized, skipping.`);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
addMapUnit(mapUnit, mapWorkflow) {
|
|
268
|
-
const mapWorkflowConfig = mapWorkflow.toJSON();
|
|
269
|
-
if (!mapWorkflowConfig._id) {
|
|
270
|
-
mapWorkflowConfig._id = this._Workflow.generateWorkflowId(mapWorkflowConfig.name, mapWorkflowConfig.properties, mapWorkflowConfig.subworkflows, mapWorkflow.applicationName || this.applicationName);
|
|
271
|
-
}
|
|
272
|
-
mapUnit.setWorkflowId(mapWorkflowConfig._id);
|
|
273
|
-
this.addUnit(mapUnit);
|
|
274
|
-
this._json.workflows.push(mapWorkflowConfig);
|
|
275
|
-
const me = this;
|
|
276
|
-
this._workflows = this.prop("workflows").map((x) => new me._Workflow(x));
|
|
277
|
-
}
|
|
278
|
-
findSubworkflowById(id) {
|
|
279
|
-
if (!id)
|
|
280
|
-
return;
|
|
281
|
-
const workflows = this.workflows || [];
|
|
282
|
-
const subworkflows = this.subworkflows || [];
|
|
283
|
-
const subworkflow = subworkflows.find((sw) => sw.id === id);
|
|
284
|
-
if (subworkflow)
|
|
285
|
-
return subworkflow;
|
|
286
|
-
const workflow = workflows.find((w) => w.findSubworkflowById(id));
|
|
287
|
-
if (workflow)
|
|
288
|
-
return workflow.findSubworkflowById(id);
|
|
289
|
-
console.warn("attempted to find a non-existing subworkflow");
|
|
290
|
-
}
|
|
291
|
-
get allSubworkflows() {
|
|
292
|
-
const subworkflowsList = [];
|
|
293
|
-
this.subworkflows.forEach((sw) => subworkflowsList.push(sw));
|
|
294
|
-
this.workflows.forEach((workflow) => {
|
|
295
|
-
return Array.prototype.push.apply(subworkflowsList, workflow.allSubworkflows);
|
|
296
|
-
});
|
|
297
|
-
return subworkflowsList;
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* @summary
|
|
301
|
-
* Returns object for hashing of the workflow. Meaningful fields are units and subworkflows.
|
|
302
|
-
* units and subworkflows must be sorted topologically before hashing (already sorted).
|
|
303
|
-
*/
|
|
304
|
-
getHashObject() {
|
|
305
|
-
return {
|
|
306
|
-
units: underscore_1.default.map(this.units, (u) => u.calculateHash()).join(),
|
|
307
|
-
subworkflows: underscore_1.default.map(this.subworkflows, (sw) => sw.calculateHash()).join(),
|
|
308
|
-
workflows: underscore_1.default.map(this.workflows, (w) => w.calculateHash()).join(),
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
exports.Workflow = Workflow;
|
|
313
|
-
Workflow.getDefaultComputeConfig = ide_1.getDefaultComputeConfig;
|
|
314
|
-
Workflow.jsonSchema = workflow_json_1.default;
|
|
315
|
-
Workflow.usePredefinedIds = false;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { InMemoryEntity } from "@mat3ra/code/dist/js/entity";
|
|
2
|
-
import type { StatusSchema } from "@mat3ra/esse/dist/js/types";
|
|
3
|
-
|
|
4
|
-
export type StatusSchemaMixin = StatusSchema;
|
|
5
|
-
|
|
6
|
-
export type StatusInMemoryEntity = InMemoryEntity & StatusSchemaMixin;
|
|
7
|
-
|
|
8
|
-
export function statusSchemaMixin<T extends InMemoryEntity>(
|
|
9
|
-
item: InMemoryEntity,
|
|
10
|
-
): asserts item is T & StatusSchemaMixin {
|
|
11
|
-
// @ts-expect-error
|
|
12
|
-
const properties: InMemoryEntity & StatusSchemaMixin = {
|
|
13
|
-
get status() {
|
|
14
|
-
return this.prop<StatusSchema["status"]>("status");
|
|
15
|
-
},
|
|
16
|
-
set status(value: StatusSchema["status"]) {
|
|
17
|
-
this.setProp("status", value);
|
|
18
|
-
},
|
|
19
|
-
get statusTrack() {
|
|
20
|
-
return this.prop<StatusSchema["statusTrack"]>("statusTrack");
|
|
21
|
-
},
|
|
22
|
-
set statusTrack(value: StatusSchema["statusTrack"]) {
|
|
23
|
-
this.setProp("statusTrack", value);
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
Object.defineProperties(item, Object.getOwnPropertyDescriptors(properties));
|
|
28
|
-
}
|