@mat3ra/wode 2025.10.1-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/.babelrc +17 -0
- package/LICENSE.md +15 -0
- package/README.md +164 -0
- package/assets/subworkflows/deepmd/deepmd.yml +31 -0
- package/assets/subworkflows/deepmd/espresso_cp_md.yml +16 -0
- package/assets/subworkflows/espresso/average_electrostatic_potential_find_minima.yml +27 -0
- package/assets/subworkflows/espresso/average_electrostatic_potential_via_band_structure.yml +67 -0
- package/assets/subworkflows/espresso/band_gap.yml +21 -0
- package/assets/subworkflows/espresso/band_gap_hse_dos.yml +30 -0
- package/assets/subworkflows/espresso/band_structure.yml +26 -0
- package/assets/subworkflows/espresso/band_structure_dos.yml +34 -0
- package/assets/subworkflows/espresso/band_structure_hse.yml +30 -0
- package/assets/subworkflows/espresso/band_structure_magn.yml +31 -0
- package/assets/subworkflows/espresso/band_structure_soc.yml +30 -0
- package/assets/subworkflows/espresso/dielectric_tensor.yml +35 -0
- package/assets/subworkflows/espresso/dos.yml +24 -0
- package/assets/subworkflows/espresso/electronic_density_mesh.yml +19 -0
- package/assets/subworkflows/espresso/esm.yml +14 -0
- package/assets/subworkflows/espresso/esm_relax.yml +14 -0
- package/assets/subworkflows/espresso/espresso_extract_kpoints.yml +16 -0
- package/assets/subworkflows/espresso/espresso_xml_get_qpt_irr.yml +12 -0
- package/assets/subworkflows/espresso/fixed_cell_relaxation.yml +16 -0
- package/assets/subworkflows/espresso/gw_band_structure_band_gap_full_frequency.yml +22 -0
- package/assets/subworkflows/espresso/gw_band_structure_band_gap_plasmon_pole.yml +22 -0
- package/assets/subworkflows/espresso/hubbard_u_hp.yml +21 -0
- package/assets/subworkflows/espresso/kpoint_convergence.yml +86 -0
- package/assets/subworkflows/espresso/neb.yml +16 -0
- package/assets/subworkflows/espresso/ph_init_qpoints.yml +14 -0
- package/assets/subworkflows/espresso/ph_single_irr_qpt.yml +14 -0
- package/assets/subworkflows/espresso/phonon_dispersions.yml +29 -0
- package/assets/subworkflows/espresso/phonon_dos.yml +29 -0
- package/assets/subworkflows/espresso/phonon_dos_dispersion.yml +34 -0
- package/assets/subworkflows/espresso/phonon_reduce.yml +29 -0
- package/assets/subworkflows/espresso/post_processor.yml +14 -0
- package/assets/subworkflows/espresso/pre_processor.yml +14 -0
- package/assets/subworkflows/espresso/pw_scf.yml +16 -0
- package/assets/subworkflows/espresso/recalculate_bands.yml +19 -0
- package/assets/subworkflows/espresso/surface_energy.yml +16 -0
- package/assets/subworkflows/espresso/total_energy.yml +16 -0
- package/assets/subworkflows/espresso/valence_band_offset_calc_from_previous_esp_vbm.yml +35 -0
- package/assets/subworkflows/espresso/variable_cell_relaxation.yml +18 -0
- package/assets/subworkflows/espresso/zero_point_energy.yml +19 -0
- package/assets/subworkflows/jupyterLab/jupyter_notebook.yml +17 -0
- package/assets/subworkflows/nwchem/total_energy.yml +16 -0
- package/assets/subworkflows/python/ml/classification_tail.yml +56 -0
- package/assets/subworkflows/python/ml/clustering_tail.yml +62 -0
- package/assets/subworkflows/python/ml/regression_tail.yml +56 -0
- package/assets/subworkflows/python/ml/train_head.yml +61 -0
- package/assets/subworkflows/python/python_script.yml +14 -0
- package/assets/subworkflows/shell/batch_espresso_pwscf.yml +14 -0
- package/assets/subworkflows/shell/hello_world.yml +14 -0
- package/assets/subworkflows/vasp/band_gap.yml +21 -0
- package/assets/subworkflows/vasp/band_structure.yml +21 -0
- package/assets/subworkflows/vasp/band_structure_dos.yml +23 -0
- package/assets/subworkflows/vasp/dos.yml +18 -0
- package/assets/subworkflows/vasp/fixed_cell_relaxation.yml +16 -0
- package/assets/subworkflows/vasp/initial_final_total_energies.yml +25 -0
- package/assets/subworkflows/vasp/kpoint_convergence.yml +89 -0
- package/assets/subworkflows/vasp/neb_subworkflow.yml +16 -0
- package/assets/subworkflows/vasp/prepare_images.yml +16 -0
- package/assets/subworkflows/vasp/recalculate_bands.yml +16 -0
- package/assets/subworkflows/vasp/surface_energy.yml +18 -0
- package/assets/subworkflows/vasp/total_energy.yml +16 -0
- package/assets/subworkflows/vasp/variable_cell_relaxation.yml +18 -0
- package/assets/subworkflows/vasp/zero_point_energy.yml +16 -0
- package/assets/workflows/deepmd/deepmd_md.yml +6 -0
- package/assets/workflows/espresso/band_gap.yml +4 -0
- package/assets/workflows/espresso/band_gap_dos_hse.yml +4 -0
- package/assets/workflows/espresso/band_structure.yml +4 -0
- package/assets/workflows/espresso/band_structure_dos.yml +4 -0
- package/assets/workflows/espresso/band_structure_hse.yml +14 -0
- package/assets/workflows/espresso/band_structure_magn.yml +7 -0
- package/assets/workflows/espresso/band_structure_soc.yml +7 -0
- package/assets/workflows/espresso/dielectric_tensor.yml +4 -0
- package/assets/workflows/espresso/dos.yml +4 -0
- package/assets/workflows/espresso/electronic_density_mesh.yml +4 -0
- package/assets/workflows/espresso/esm.yml +4 -0
- package/assets/workflows/espresso/esm_relax.yml +4 -0
- package/assets/workflows/espresso/fixed_cell_relaxation.yml +4 -0
- package/assets/workflows/espresso/gw_band_structure_band_gap_full_frequency.yml +4 -0
- package/assets/workflows/espresso/gw_band_structure_band_gap_plasmon_pole.yml +4 -0
- package/assets/workflows/espresso/hubbard_u_hp.yml +7 -0
- package/assets/workflows/espresso/kpoint_convergence.yml +4 -0
- package/assets/workflows/espresso/neb.yml +4 -0
- package/assets/workflows/espresso/phonon_dispersions.yml +4 -0
- package/assets/workflows/espresso/phonon_dos.yml +4 -0
- package/assets/workflows/espresso/phonon_dos_dispersion.yml +4 -0
- package/assets/workflows/espresso/phonon_map.yml +28 -0
- package/assets/workflows/espresso/recalculate_bands.yml +4 -0
- package/assets/workflows/espresso/surface_energy.yml +4 -0
- package/assets/workflows/espresso/total_energy.yml +4 -0
- package/assets/workflows/espresso/valence_band_offset.yml +171 -0
- package/assets/workflows/espresso/variable_cell_relaxation.yml +4 -0
- package/assets/workflows/espresso/zero_point_energy.yml +4 -0
- package/assets/workflows/jupyterLab/jupyter_notebook.yml +4 -0
- package/assets/workflows/nwchem/total_energy.yml +4 -0
- package/assets/workflows/python/ml/classification_workflow.yml +9 -0
- package/assets/workflows/python/ml/clustering_workflow.yml +9 -0
- package/assets/workflows/python/ml/regression_workflow.yml +9 -0
- package/assets/workflows/python/python_script.yml +4 -0
- package/assets/workflows/shell/batch_espresso_pwscf.yml +4 -0
- package/assets/workflows/shell/hello_world.yml +4 -0
- package/assets/workflows/vasp/band_gap.yml +4 -0
- package/assets/workflows/vasp/band_structure.yml +4 -0
- package/assets/workflows/vasp/band_structure_dos.yml +4 -0
- package/assets/workflows/vasp/dos.yml +4 -0
- package/assets/workflows/vasp/fixed_cell_relaxation.yml +4 -0
- package/assets/workflows/vasp/kpoint_convergence.yml +4 -0
- package/assets/workflows/vasp/neb.yml +8 -0
- package/assets/workflows/vasp/recalculate_bands.yml +4 -0
- package/assets/workflows/vasp/surface_energy.yml +4 -0
- package/assets/workflows/vasp/total_energy.yml +4 -0
- package/assets/workflows/vasp/variable_cell_relaxation.yml +4 -0
- package/assets/workflows/vasp/zero_point_energy.yml +4 -0
- package/build_workflows.js +65 -0
- package/dist/context/context.js +49 -0
- package/dist/context/mixins/ApplicationContextMixin.js +19 -0
- package/dist/context/mixins/JobContextMixin.js +39 -0
- package/dist/context/mixins/MaterialContextMixin.js +40 -0
- package/dist/context/mixins/MaterialsContextMixin.js +19 -0
- package/dist/context/mixins/MaterialsSetContextMixin.js +25 -0
- package/dist/context/mixins/MethodDataContextMixin.js +48 -0
- package/dist/context/mixins/WorkflowContextMixin.js +28 -0
- package/dist/context/providers/BoundaryConditionsFormDataProvider.js +86 -0
- package/dist/context/providers/CollinearMagnetizationContextProvider.js +113 -0
- package/dist/context/providers/HubbardContextProviderLegacy.js +81 -0
- package/dist/context/providers/HubbardJContextProvider.js +74 -0
- package/dist/context/providers/HubbardUContextProvider.js +77 -0
- package/dist/context/providers/HubbardVContextProvider.js +104 -0
- package/dist/context/providers/IonDynamicsContextProvider.js +62 -0
- package/dist/context/providers/MLSettingsContextProvider.js +52 -0
- package/dist/context/providers/MLTrainTestSplitContextProvider.js +48 -0
- package/dist/context/providers/NEBFormDataProvider.js +38 -0
- package/dist/context/providers/NonCollinearMagnetizationContextProvider.js +253 -0
- package/dist/context/providers/PlanewaveCutoffsContextProvider.js +67 -0
- package/dist/context/providers/PointsGridFormDataProvider.js +272 -0
- package/dist/context/providers/PointsPathFormDataProvider.js +155 -0
- package/dist/context/providers/by_application/ExecutableContextProvider.js +17 -0
- package/dist/context/providers/by_application/espresso/QENEBContextProvider.js +60 -0
- package/dist/context/providers/by_application/espresso/QEPWXContextProvider.js +149 -0
- package/dist/context/providers/by_application/nwchem/NWChemTotalEnergyContextProvider.js +84 -0
- package/dist/context/providers/by_application/vasp/VASPContextProvider.js +64 -0
- package/dist/context/providers/by_application/vasp/VASPNEBContextProvider.js +56 -0
- package/dist/context/providers/settings.js +37 -0
- package/dist/context/providers.js +199 -0
- package/dist/enums.js +65 -0
- package/dist/index.js +64 -0
- package/dist/patch.js +19 -0
- package/dist/subworkflows/convergence/factory.js +35 -0
- package/dist/subworkflows/convergence/non_uniform_kgrid.js +31 -0
- package/dist/subworkflows/convergence/parameter.js +70 -0
- package/dist/subworkflows/convergence/uniform_kgrid.js +26 -0
- package/dist/subworkflows/convergence.js +189 -0
- package/dist/subworkflows/create.js +285 -0
- package/dist/subworkflows/dynamic/espresso/getQpointIrrep.js +34 -0
- package/dist/subworkflows/dynamic/index.js +19 -0
- package/dist/subworkflows/dynamic/surfaceEnergy.js +67 -0
- package/dist/subworkflows/index.js +19 -0
- package/dist/subworkflows/subworkflow.js +279 -0
- package/dist/units/assertion.js +37 -0
- package/dist/units/assignment.js +42 -0
- package/dist/units/base.js +91 -0
- package/dist/units/builders/AssertionUnitConfigBuilder.js +34 -0
- package/dist/units/builders/AssignmentUnitConfigBuilder.js +41 -0
- package/dist/units/builders/ExecutionUnitConfigBuilder.js +67 -0
- package/dist/units/builders/IOUnitConfigBuilder.js +54 -0
- package/dist/units/builders/UnitConfigBuilder.js +79 -0
- package/dist/units/builders/index.js +18 -0
- package/dist/units/condition.js +52 -0
- package/dist/units/execution.js +222 -0
- package/dist/units/factory.js +53 -0
- package/dist/units/index.js +82 -0
- package/dist/units/io.js +148 -0
- package/dist/units/map.js +38 -0
- package/dist/units/processing.js +41 -0
- package/dist/units/reduce.js +24 -0
- package/dist/units/subworkflow.js +23 -0
- package/dist/utils.js +92 -0
- package/dist/workflows/create.js +312 -0
- package/dist/workflows/default.js +41 -0
- package/dist/workflows/index.js +108 -0
- package/dist/workflows/relaxation.js +37 -0
- package/dist/workflows/workflow.js +303 -0
- package/package.json +94 -0
- package/src/context/context.js +47 -0
- package/src/context/mixins/ApplicationContextMixin.js +19 -0
- package/src/context/mixins/JobContextMixin.js +36 -0
- package/src/context/mixins/MaterialContextMixin.js +41 -0
- package/src/context/mixins/MaterialsContextMixin.js +18 -0
- package/src/context/mixins/MaterialsSetContextMixin.js +24 -0
- package/src/context/mixins/MethodDataContextMixin.js +48 -0
- package/src/context/mixins/WorkflowContextMixin.js +25 -0
- package/src/context/providers/BoundaryConditionsFormDataProvider.js +80 -0
- package/src/context/providers/CollinearMagnetizationContextProvider.js +117 -0
- package/src/context/providers/HubbardContextProviderLegacy.js +75 -0
- package/src/context/providers/HubbardJContextProvider.js +73 -0
- package/src/context/providers/HubbardUContextProvider.js +100 -0
- package/src/context/providers/HubbardVContextProvider.js +111 -0
- package/src/context/providers/IonDynamicsContextProvider.js +56 -0
- package/src/context/providers/MLSettingsContextProvider.js +48 -0
- package/src/context/providers/MLTrainTestSplitContextProvider.js +45 -0
- package/src/context/providers/NEBFormDataProvider.js +32 -0
- package/src/context/providers/NonCollinearMagnetizationContextProvider.js +269 -0
- package/src/context/providers/PlanewaveCutoffsContextProvider.js +68 -0
- package/src/context/providers/PointsGridFormDataProvider.js +285 -0
- package/src/context/providers/PointsPathFormDataProvider.js +165 -0
- package/src/context/providers/by_application/ExecutableContextProvider.js +10 -0
- package/src/context/providers/by_application/espresso/QENEBContextProvider.js +56 -0
- package/src/context/providers/by_application/espresso/QEPWXContextProvider.js +166 -0
- package/src/context/providers/by_application/nwchem/NWChemTotalEnergyContextProvider.js +86 -0
- package/src/context/providers/by_application/vasp/VASPContextProvider.js +56 -0
- package/src/context/providers/by_application/vasp/VASPNEBContextProvider.js +46 -0
- package/src/context/providers/settings.js +38 -0
- package/src/context/providers.js +140 -0
- package/src/enums.js +65 -0
- package/src/index.js +17 -0
- package/src/patch.js +12 -0
- package/src/subworkflows/convergence/factory.js +14 -0
- package/src/subworkflows/convergence/non_uniform_kgrid.js +28 -0
- package/src/subworkflows/convergence/parameter.js +58 -0
- package/src/subworkflows/convergence/uniform_kgrid.js +22 -0
- package/src/subworkflows/convergence.js +196 -0
- package/src/subworkflows/create.js +201 -0
- package/src/subworkflows/dynamic/espresso/getQpointIrrep.js +35 -0
- package/src/subworkflows/dynamic/index.js +8 -0
- package/src/subworkflows/dynamic/surfaceEnergy.js +124 -0
- package/src/subworkflows/index.js +2 -0
- package/src/subworkflows/subworkflow.js +329 -0
- package/src/units/assertion.js +29 -0
- package/src/units/assignment.js +34 -0
- package/src/units/base.js +97 -0
- package/src/units/builders/AssertionUnitConfigBuilder.js +28 -0
- package/src/units/builders/AssignmentUnitConfigBuilder.js +36 -0
- package/src/units/builders/ExecutionUnitConfigBuilder.js +59 -0
- package/src/units/builders/IOUnitConfigBuilder.js +53 -0
- package/src/units/builders/UnitConfigBuilder.js +86 -0
- package/src/units/builders/index.js +15 -0
- package/src/units/condition.js +47 -0
- package/src/units/execution.js +263 -0
- package/src/units/factory.js +53 -0
- package/src/units/index.js +25 -0
- package/src/units/io.js +163 -0
- package/src/units/map.js +33 -0
- package/src/units/processing.js +39 -0
- package/src/units/reduce.js +17 -0
- package/src/units/subworkflow.js +15 -0
- package/src/utils.js +73 -0
- package/src/workflows/create.js +222 -0
- package/src/workflows/default.js +39 -0
- package/src/workflows/index.js +99 -0
- package/src/workflows/relaxation.js +41 -0
- package/src/workflows/workflow.js +351 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Subworkflow", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _subworkflow.Subworkflow;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "createSubworkflowByName", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _create.createSubworkflowByName;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _subworkflow = require("./subworkflow");
|
|
19
|
+
var _create = require("./create");
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Subworkflow = void 0;
|
|
7
|
+
var _ade = require("@exabyte-io/ade.js");
|
|
8
|
+
var _mode = require("@exabyte-io/mode.js");
|
|
9
|
+
var _entity = require("@mat3ra/code/dist/js/entity");
|
|
10
|
+
var _utils = require("@mat3ra/utils");
|
|
11
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
12
|
+
var _mixwith = require("mixwith");
|
|
13
|
+
var _underscore = _interopRequireDefault(require("underscore"));
|
|
14
|
+
var _enums = require("../enums");
|
|
15
|
+
var _units = require("../units");
|
|
16
|
+
var _utils2 = require("../utils");
|
|
17
|
+
var _convergence = require("./convergence");
|
|
18
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
20
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
21
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
22
|
+
/* eslint max-classes-per-file:0 */
|
|
23
|
+
|
|
24
|
+
class BaseSubworkflow extends (0, _mixwith.mix)(_entity.NamedDefaultableRepetitionImportantSettingsInMemoryEntity).with(_convergence.ConvergenceMixin, _entity.ContextAndRenderFieldsMixin) {}
|
|
25
|
+
class Subworkflow extends BaseSubworkflow {
|
|
26
|
+
constructor(config) {
|
|
27
|
+
super(config);
|
|
28
|
+
this._Application = _ade.Application;
|
|
29
|
+
this._ModelFactory = _mode.ModelFactory;
|
|
30
|
+
this._UnitFactory = _units.UnitFactory;
|
|
31
|
+
this.initialize();
|
|
32
|
+
}
|
|
33
|
+
initialize() {
|
|
34
|
+
this._application = new this._Application(this.prop("application"));
|
|
35
|
+
this._model = this._ModelFactory.create({
|
|
36
|
+
...this.prop("model"),
|
|
37
|
+
application: this.prop("application")
|
|
38
|
+
});
|
|
39
|
+
this._units = (0, _utils2.setNextLinks)((0, _utils2.setUnitsHead)(this.prop("units", [])), this.id).map(cfg => this._UnitFactory.create(Object.assign(cfg, {
|
|
40
|
+
application: this.application.toJSON()
|
|
41
|
+
})));
|
|
42
|
+
}
|
|
43
|
+
static generateSubworkflowId(...args) {
|
|
44
|
+
args[0] = `subworkflow-${args[0]}`;
|
|
45
|
+
if (this.usePredefinedIds) return _utils.Utils.uuid.getUUIDFromNamespace(...args);
|
|
46
|
+
return _utils.Utils.uuid.getUUID();
|
|
47
|
+
}
|
|
48
|
+
static get defaultConfig() {
|
|
49
|
+
const defaultName = "New Subworkflow";
|
|
50
|
+
return {
|
|
51
|
+
_id: this.generateSubworkflowId(defaultName),
|
|
52
|
+
name: defaultName,
|
|
53
|
+
application: _ade.Application.defaultConfig,
|
|
54
|
+
model: _mode.Model.defaultConfig,
|
|
55
|
+
properties: [],
|
|
56
|
+
units: []
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/*
|
|
61
|
+
* @returns {SubworkflowUnit}
|
|
62
|
+
*/
|
|
63
|
+
getAsUnit() {
|
|
64
|
+
return this._UnitFactory.create({
|
|
65
|
+
type: _enums.UNIT_TYPES.subworkflow,
|
|
66
|
+
_id: this.id,
|
|
67
|
+
name: this.name
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/*
|
|
72
|
+
* @summary Used to generate initial application tree, therefore omit setting application.
|
|
73
|
+
*/
|
|
74
|
+
static fromArguments(application, model, method, name, units = [], config = {}, Cls = Subworkflow) {
|
|
75
|
+
return new Cls({
|
|
76
|
+
...config,
|
|
77
|
+
_id: Cls.generateSubworkflowId(name),
|
|
78
|
+
name,
|
|
79
|
+
application: application.toJSON(),
|
|
80
|
+
properties: _lodash.default.sortedUniq(_lodash.default.flatten(units.filter(x => x.resultNames).map(x => x.resultNames))),
|
|
81
|
+
model: {
|
|
82
|
+
...model.toJSON(),
|
|
83
|
+
method: method.toJSON()
|
|
84
|
+
},
|
|
85
|
+
units: units.map(unit => unit.toJSON ? unit.toJSON() : unit)
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
get application() {
|
|
89
|
+
return this._application;
|
|
90
|
+
}
|
|
91
|
+
setApplication(application) {
|
|
92
|
+
// TODO: adjust the logic above to take into account whether units need re-rendering after version change etc.
|
|
93
|
+
// reset units if application name changes
|
|
94
|
+
const previousApplicationName = this.application.name;
|
|
95
|
+
this._application = application;
|
|
96
|
+
if (previousApplicationName !== application.name) {
|
|
97
|
+
// TODO: figure out how to set a default unit per new application instead of removing all
|
|
98
|
+
this.setUnits([]);
|
|
99
|
+
} else {
|
|
100
|
+
// propagate new application version to all units
|
|
101
|
+
this.units.filter(unit => typeof unit.setApplication === "function").forEach(unit => unit.setApplication(application, true));
|
|
102
|
+
}
|
|
103
|
+
this.setProp("application", application.toJSON());
|
|
104
|
+
// set model to the default one for the application selected
|
|
105
|
+
this.setModel(this._ModelFactory.createFromApplication({
|
|
106
|
+
application: this.prop("application")
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
get model() {
|
|
110
|
+
return this._model;
|
|
111
|
+
}
|
|
112
|
+
setModel(model) {
|
|
113
|
+
this._model = model;
|
|
114
|
+
}
|
|
115
|
+
get units() {
|
|
116
|
+
return this._units;
|
|
117
|
+
}
|
|
118
|
+
setUnits(units) {
|
|
119
|
+
this._units = units;
|
|
120
|
+
}
|
|
121
|
+
toJSON(exclude = []) {
|
|
122
|
+
return {
|
|
123
|
+
...super.toJSON(exclude),
|
|
124
|
+
model: this.model.toJSON(),
|
|
125
|
+
units: this.units.map(x => x.toJSON()),
|
|
126
|
+
...(this.compute ? {
|
|
127
|
+
compute: this.compute
|
|
128
|
+
} : {}) // {"compute": null } won't pass esse validation
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
get contextProviders() {
|
|
132
|
+
const unitsWithContextProviders = this.units.filter(u => u.allContextProviders && u.allContextProviders.length);
|
|
133
|
+
const allContextProviders = _underscore.default.flatten(unitsWithContextProviders.map(u => u.allContextProviders));
|
|
134
|
+
const subworkflowContextProviders = allContextProviders.filter(p => p.isSubworkflowContextProvider);
|
|
135
|
+
return _underscore.default.uniq(subworkflowContextProviders, p => p.name);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Extracts a reduced version of the entity config to be stored inside redux state.
|
|
140
|
+
* This is used to track changes to context, monitors, properties, etc. when multiple materials are in state.
|
|
141
|
+
*/
|
|
142
|
+
extractReducedExternalDependentConfig() {
|
|
143
|
+
return {
|
|
144
|
+
id: this.id,
|
|
145
|
+
context: this.context || {},
|
|
146
|
+
units: this.units.map(unit => unit.extractReducedExternalDependentConfig())
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Applies the reduced config obtained from extractReducedExternalDependentConfig on the entity.
|
|
152
|
+
*/
|
|
153
|
+
applyReducedExternalDependentConfig(config) {
|
|
154
|
+
this.context = config.context || {};
|
|
155
|
+
this.units.forEach(unit => {
|
|
156
|
+
const unitConfig = (config.units || []).find(c => c.id === unit.flowchartId);
|
|
157
|
+
unit.applyReducedExternalDependentConfig(unitConfig || {});
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
get contextFromAssignmentUnits() {
|
|
161
|
+
const ctx = {};
|
|
162
|
+
this.units.filter(u => u.type === _enums.UNIT_TYPES.assignment).forEach(u => {
|
|
163
|
+
ctx[u.operand] = u.value;
|
|
164
|
+
});
|
|
165
|
+
return ctx;
|
|
166
|
+
}
|
|
167
|
+
render(context = {}) {
|
|
168
|
+
const ctx = {
|
|
169
|
+
...context,
|
|
170
|
+
application: this.application,
|
|
171
|
+
methodData: this.model.method.data,
|
|
172
|
+
model: this.model.toJSON(),
|
|
173
|
+
// context below is assembled from context providers and passed to units to override theirs
|
|
174
|
+
...this.context,
|
|
175
|
+
subworkflowContext: this.contextFromAssignmentUnits
|
|
176
|
+
};
|
|
177
|
+
this.units.forEach(u => u.render(ctx));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* TODO: reuse workflow function instead
|
|
182
|
+
* @param unit {Unit}
|
|
183
|
+
* @param head {Boolean}
|
|
184
|
+
* @param index {Number}
|
|
185
|
+
*/
|
|
186
|
+
addUnit(unit, index = -1) {
|
|
187
|
+
const {
|
|
188
|
+
units
|
|
189
|
+
} = this;
|
|
190
|
+
if (units.length === 0) {
|
|
191
|
+
unit.head = true;
|
|
192
|
+
this.setUnits([unit]);
|
|
193
|
+
} else {
|
|
194
|
+
if (index >= 0) units.splice(index, 0, unit);else units.push(unit);
|
|
195
|
+
this.setUnits((0, _utils2.setNextLinks)((0, _utils2.setUnitsHead)(units)));
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
removeUnit(flowchartId) {
|
|
199
|
+
const previousUnit = this.units.find(x => x.next === flowchartId);
|
|
200
|
+
if (previousUnit) previousUnit.unsetProp("next");
|
|
201
|
+
// TODO: remove the setNextLinks and setUnitsHead and handle the logic via flowchart designer
|
|
202
|
+
this.setUnits((0, _utils2.setNextLinks)((0, _utils2.setUnitsHead)(this.units.filter(x => x.flowchartId !== flowchartId))));
|
|
203
|
+
}
|
|
204
|
+
get properties() {
|
|
205
|
+
return _lodash.default.flatten(this.units.map(x => x.resultNames));
|
|
206
|
+
}
|
|
207
|
+
getUnit(flowchartId) {
|
|
208
|
+
return this.units.find(x => x.flowchartId === flowchartId);
|
|
209
|
+
}
|
|
210
|
+
unitIndex(flowchartId) {
|
|
211
|
+
return _lodash.default.findIndex(this.units, unit => {
|
|
212
|
+
return unit.flowchartId === flowchartId;
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
replaceUnit(index, unit) {
|
|
216
|
+
this.units[index] = unit;
|
|
217
|
+
this.setUnits((0, _utils2.setNextLinks)((0, _utils2.setUnitsHead)(this.units)));
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// eslint-disable-next-line class-methods-use-this
|
|
221
|
+
get scopeVariables() {
|
|
222
|
+
return ["N_k", "N_k_nonuniform"];
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// eslint-disable-next-line class-methods-use-this
|
|
226
|
+
get scalarResults() {
|
|
227
|
+
return ["total_energy", "pressure"];
|
|
228
|
+
}
|
|
229
|
+
get isMultiMaterial() {
|
|
230
|
+
return this.prop("isMultiMaterial", false);
|
|
231
|
+
}
|
|
232
|
+
get isDraft() {
|
|
233
|
+
return this.prop("isDraft", false);
|
|
234
|
+
}
|
|
235
|
+
setIsDraft(bool) {
|
|
236
|
+
return this.setProp("isDraft", bool);
|
|
237
|
+
}
|
|
238
|
+
get methodData() {
|
|
239
|
+
return this.model.method.data;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* @summary Calculates hash of the subworkflow. Meaningful fields are units, app and model.
|
|
244
|
+
* units must be sorted topologically before hashing (already sorted).
|
|
245
|
+
*/
|
|
246
|
+
calculateHash() {
|
|
247
|
+
const config = this.toJSON();
|
|
248
|
+
const meaningfulFields = {
|
|
249
|
+
application: _utils.Utils.specific.removeTimestampableKeysFromConfig(config.application),
|
|
250
|
+
model: this._calculateModelHash(),
|
|
251
|
+
units: _underscore.default.map(this.units, u => u.calculateHash()).join()
|
|
252
|
+
};
|
|
253
|
+
return _utils.Utils.hash.calculateHashFromObject(meaningfulFields);
|
|
254
|
+
}
|
|
255
|
+
_calculateModelHash() {
|
|
256
|
+
const {
|
|
257
|
+
model
|
|
258
|
+
} = this.toJSON();
|
|
259
|
+
// ignore empty data object
|
|
260
|
+
if (this.model.method.omitInHashCalculation) delete model.method.data;
|
|
261
|
+
return _utils.Utils.hash.calculateHashFromObject(model);
|
|
262
|
+
}
|
|
263
|
+
findUnitById(id) {
|
|
264
|
+
// TODO: come back and refactor after converting flowchartId to id
|
|
265
|
+
return this.units.find(u => u.flowchartId === id);
|
|
266
|
+
}
|
|
267
|
+
findUnitKeyById(id) {
|
|
268
|
+
const index = this.units.findIndex(u => u.flowchartId === id);
|
|
269
|
+
return `units.${index}`;
|
|
270
|
+
}
|
|
271
|
+
findUnitWithTag(tag) {
|
|
272
|
+
return this.units.find(unit => unit.tags.includes(tag));
|
|
273
|
+
}
|
|
274
|
+
get hasConvergence() {
|
|
275
|
+
return !!this.convergenceParam && !!this.convergenceResult && !!this.convergenceSeries;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
exports.Subworkflow = Subworkflow;
|
|
279
|
+
_defineProperty(Subworkflow, "usePredefinedIds", false);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.AssertionUnit = void 0;
|
|
7
|
+
var _enums = require("../enums");
|
|
8
|
+
var _base = require("./base");
|
|
9
|
+
class AssertionUnit extends _base.BaseUnit {
|
|
10
|
+
constructor(config) {
|
|
11
|
+
super({
|
|
12
|
+
...AssertionUnit.getAssertionConfig(),
|
|
13
|
+
...config
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
static getAssertionConfig() {
|
|
17
|
+
return {
|
|
18
|
+
name: _enums.UNIT_TYPES.assertion,
|
|
19
|
+
type: _enums.UNIT_TYPES.assertion,
|
|
20
|
+
statement: "true",
|
|
21
|
+
errorMessage: "assertion failed"
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
get statement() {
|
|
25
|
+
return this.prop("statement");
|
|
26
|
+
}
|
|
27
|
+
get errorMessage() {
|
|
28
|
+
return this.prop("errorMessage");
|
|
29
|
+
}
|
|
30
|
+
getHashObject() {
|
|
31
|
+
return {
|
|
32
|
+
statement: this.statement,
|
|
33
|
+
errorMessage: this.errorMessage
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.AssertionUnit = AssertionUnit;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.AssignmentUnit = void 0;
|
|
7
|
+
var _enums = require("../enums");
|
|
8
|
+
var _base = require("./base");
|
|
9
|
+
class AssignmentUnit extends _base.BaseUnit {
|
|
10
|
+
constructor(config) {
|
|
11
|
+
super({
|
|
12
|
+
...AssignmentUnit.getAssignmentConfig(),
|
|
13
|
+
...config
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
static getAssignmentConfig() {
|
|
17
|
+
return {
|
|
18
|
+
name: _enums.UNIT_TYPES.assignment,
|
|
19
|
+
type: _enums.UNIT_TYPES.assignment,
|
|
20
|
+
operand: "X",
|
|
21
|
+
value: "1",
|
|
22
|
+
input: []
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
get operand() {
|
|
26
|
+
return this.prop("operand");
|
|
27
|
+
}
|
|
28
|
+
get value() {
|
|
29
|
+
return this.prop("value");
|
|
30
|
+
}
|
|
31
|
+
get input() {
|
|
32
|
+
return this.prop("input");
|
|
33
|
+
}
|
|
34
|
+
getHashObject() {
|
|
35
|
+
return {
|
|
36
|
+
input: this.input,
|
|
37
|
+
operand: this.operand,
|
|
38
|
+
value: this.value
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.AssignmentUnit = AssignmentUnit;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.BaseUnit = void 0;
|
|
7
|
+
var _entity = require("@mat3ra/code/dist/js/entity");
|
|
8
|
+
var _TaggableMixin = require("@mat3ra/code/dist/js/entity/mixins/TaggableMixin");
|
|
9
|
+
var _utils = require("@mat3ra/utils");
|
|
10
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
11
|
+
var _enums = require("../enums");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
14
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
15
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
|
+
// eslint-disable-next-line max-len
|
|
17
|
+
class BaseUnit extends _entity.NamedDefaultableRepetitionRuntimeItemsImportantSettingsContextAndRenderHashedInMemoryEntity {
|
|
18
|
+
constructor(config) {
|
|
19
|
+
const flowchartId = config.flowchartId || BaseUnit.generateFlowChartId.call(new.target, config.name);
|
|
20
|
+
super({
|
|
21
|
+
...config,
|
|
22
|
+
status: config.status || _enums.UNIT_STATUSES.idle,
|
|
23
|
+
statusTrack: config.statusTrack || [],
|
|
24
|
+
flowchartId,
|
|
25
|
+
tags: config.tags || []
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
static generateFlowChartId(...args) {
|
|
29
|
+
args[0] = `flowchart-${args[0]}`;
|
|
30
|
+
if (this.usePredefinedIds) return _utils.Utils.uuid.getUUIDFromNamespace(...args);
|
|
31
|
+
return _utils.Utils.uuid.getUUID();
|
|
32
|
+
}
|
|
33
|
+
get flowchartId() {
|
|
34
|
+
return this.prop("flowchartId");
|
|
35
|
+
}
|
|
36
|
+
get head() {
|
|
37
|
+
return this.prop("head", false);
|
|
38
|
+
}
|
|
39
|
+
set head(bool) {
|
|
40
|
+
this.setProp("head", bool);
|
|
41
|
+
}
|
|
42
|
+
get next() {
|
|
43
|
+
return this.prop("next");
|
|
44
|
+
}
|
|
45
|
+
set next(flowchartId) {
|
|
46
|
+
this.setProp("next", flowchartId);
|
|
47
|
+
}
|
|
48
|
+
get status() {
|
|
49
|
+
return _lodash.default.get(this.lastStatusUpdate, "status") || _enums.UNIT_STATUSES.idle;
|
|
50
|
+
}
|
|
51
|
+
set status(s) {
|
|
52
|
+
this.setProp("status", s);
|
|
53
|
+
}
|
|
54
|
+
get lastStatusUpdate() {
|
|
55
|
+
const statusTrack = this.prop("statusTrack", []).filter(s => (s.repetition || 0) === this.repetition);
|
|
56
|
+
const sortedStatusTrack = _lodash.default.sortBy(statusTrack || [], x => x.trackedAt);
|
|
57
|
+
return sortedStatusTrack[sortedStatusTrack.length - 1];
|
|
58
|
+
}
|
|
59
|
+
get type() {
|
|
60
|
+
return this.prop("type");
|
|
61
|
+
}
|
|
62
|
+
get isDraft() {
|
|
63
|
+
return this.prop("isDraft", false);
|
|
64
|
+
}
|
|
65
|
+
getHashObject() {
|
|
66
|
+
return {
|
|
67
|
+
...this.hashObjectFromRuntimeItems,
|
|
68
|
+
type: this.type
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Checks whether a unit is currently in a given status (e.g. idle, active, etc). The full list can be found
|
|
74
|
+
* in the UNIT_STATUSES variable in enums.js.
|
|
75
|
+
* @param status (String) name of the status to check
|
|
76
|
+
* @returns Boolean
|
|
77
|
+
*/
|
|
78
|
+
isInStatus(status) {
|
|
79
|
+
return this.status === status;
|
|
80
|
+
}
|
|
81
|
+
clone(extraContext) {
|
|
82
|
+
const flowchartIDOverrideConfigAsExtraContext = {
|
|
83
|
+
flowchartId: this.constructor.generateFlowChartId(),
|
|
84
|
+
...extraContext
|
|
85
|
+
};
|
|
86
|
+
return super.clone(flowchartIDOverrideConfigAsExtraContext);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.BaseUnit = BaseUnit;
|
|
90
|
+
_defineProperty(BaseUnit, "usePredefinedIds", false);
|
|
91
|
+
(0, _TaggableMixin.taggableMixin)(BaseUnit.prototype);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.AssertionUnitConfigBuilder = void 0;
|
|
7
|
+
var _enums = require("../../enums");
|
|
8
|
+
var _UnitConfigBuilder = require("./UnitConfigBuilder");
|
|
9
|
+
class AssertionUnitConfigBuilder extends _UnitConfigBuilder.UnitConfigBuilder {
|
|
10
|
+
constructor(name, statement, errorMessage) {
|
|
11
|
+
super({
|
|
12
|
+
name,
|
|
13
|
+
type: _enums.UNIT_TYPES.assertion
|
|
14
|
+
});
|
|
15
|
+
this._statement = statement;
|
|
16
|
+
this._errorMessage = errorMessage;
|
|
17
|
+
}
|
|
18
|
+
statement(str) {
|
|
19
|
+
this._statement = str;
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
errorMessage(str) {
|
|
23
|
+
this._errorMessage = str;
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
build() {
|
|
27
|
+
return {
|
|
28
|
+
...super.build(),
|
|
29
|
+
statement: this._statement,
|
|
30
|
+
errorMessage: this._errorMessage
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.AssertionUnitConfigBuilder = AssertionUnitConfigBuilder;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.AssignmentUnitConfigBuilder = void 0;
|
|
7
|
+
var _enums = require("../../enums");
|
|
8
|
+
var _UnitConfigBuilder = require("./UnitConfigBuilder");
|
|
9
|
+
class AssignmentUnitConfigBuilder extends _UnitConfigBuilder.UnitConfigBuilder {
|
|
10
|
+
constructor(name, variableName, variableValue, input = [], results = []) {
|
|
11
|
+
super({
|
|
12
|
+
name,
|
|
13
|
+
type: _enums.UNIT_TYPES.assignment
|
|
14
|
+
});
|
|
15
|
+
this._variableName = variableName;
|
|
16
|
+
this._variableValue = variableValue;
|
|
17
|
+
this._input = input;
|
|
18
|
+
this._results = results;
|
|
19
|
+
}
|
|
20
|
+
input(arr) {
|
|
21
|
+
this._input = arr;
|
|
22
|
+
return this;
|
|
23
|
+
}
|
|
24
|
+
variableName(str) {
|
|
25
|
+
this._variableName = str;
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
variableValue(str) {
|
|
29
|
+
this._variableValue = str;
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
build() {
|
|
33
|
+
return {
|
|
34
|
+
...super.build(),
|
|
35
|
+
input: this._input,
|
|
36
|
+
operand: this._variableName,
|
|
37
|
+
value: this._variableValue
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.AssignmentUnitConfigBuilder = AssignmentUnitConfigBuilder;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ExecutionUnitConfigBuilder = void 0;
|
|
7
|
+
var _ApplicationRegistry = _interopRequireDefault(require("@exabyte-io/ade.js/dist/js/ApplicationRegistry"));
|
|
8
|
+
var _enums = require("../../enums");
|
|
9
|
+
var _UnitConfigBuilder = require("./UnitConfigBuilder");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
/* eslint-disable class-methods-use-this */
|
|
12
|
+
|
|
13
|
+
class ExecutionUnitConfigBuilder extends _UnitConfigBuilder.UnitConfigBuilder {
|
|
14
|
+
constructor(name, application, execName, flavorName, flowchartId) {
|
|
15
|
+
super({
|
|
16
|
+
name,
|
|
17
|
+
type: _enums.UNIT_TYPES.execution,
|
|
18
|
+
flowchartId
|
|
19
|
+
});
|
|
20
|
+
try {
|
|
21
|
+
this.initialize(application, execName, flavorName);
|
|
22
|
+
} catch (e) {
|
|
23
|
+
console.error(`Can't initialize executable/flavor: ${execName}/${flavorName}`);
|
|
24
|
+
throw e;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// initialize runtimeItems
|
|
28
|
+
this._results = this.flavor.results;
|
|
29
|
+
this._monitors = this.flavor.monitors;
|
|
30
|
+
this._preProcessors = this.flavor.preProcessors;
|
|
31
|
+
this._postProcessors = this.flavor.postProcessors;
|
|
32
|
+
}
|
|
33
|
+
initialize(application, execName, flavorName) {
|
|
34
|
+
this.application = application;
|
|
35
|
+
this.executable = this._createExecutable(this.application, execName);
|
|
36
|
+
this.flavor = this._createFlavor(this.executable, flavorName);
|
|
37
|
+
}
|
|
38
|
+
build() {
|
|
39
|
+
return {
|
|
40
|
+
...super.build(),
|
|
41
|
+
application: this.application.toJSON(),
|
|
42
|
+
executable: this.executable.toJSON(),
|
|
43
|
+
flavor: this.flavor.toJSON()
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Creates an executable instance. This method is intended to be overridden in subclasses.
|
|
49
|
+
* @param {Application} application - The application object
|
|
50
|
+
* @param {string} execName - The name of the executable
|
|
51
|
+
* @returns {Executable} The created executable instance
|
|
52
|
+
*/
|
|
53
|
+
_createExecutable(application, execName) {
|
|
54
|
+
return _ApplicationRegistry.default.getExecutableByName(application.name, execName);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Creates a flavor instance. This method is intended to be overridden in subclasses.
|
|
59
|
+
* @param {Executable} executable - The executable object
|
|
60
|
+
* @param {string} flavorName - The name of the flavor
|
|
61
|
+
* @returns {Flavor} The created flavor instance
|
|
62
|
+
*/
|
|
63
|
+
_createFlavor(executable, flavorName) {
|
|
64
|
+
return _ApplicationRegistry.default.getFlavorByName(executable, flavorName);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.ExecutionUnitConfigBuilder = ExecutionUnitConfigBuilder;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.IOUnitConfigBuilder = void 0;
|
|
7
|
+
var _enums = require("../../enums");
|
|
8
|
+
var _UnitConfigBuilder = require("./UnitConfigBuilder");
|
|
9
|
+
class IOUnitConfigBuilder extends _UnitConfigBuilder.UnitConfigBuilder {
|
|
10
|
+
constructor(name, endpointName, endpointOptions) {
|
|
11
|
+
super({
|
|
12
|
+
name,
|
|
13
|
+
type: _enums.UNIT_TYPES.io
|
|
14
|
+
});
|
|
15
|
+
this._endpointName = endpointName;
|
|
16
|
+
this._endpointOptions = endpointOptions;
|
|
17
|
+
this._variableName = "DATA";
|
|
18
|
+
this._subtype = "input";
|
|
19
|
+
this._source = "api";
|
|
20
|
+
}
|
|
21
|
+
endpointName(str) {
|
|
22
|
+
this._endpointName = str;
|
|
23
|
+
return this;
|
|
24
|
+
}
|
|
25
|
+
endpointOptions(options) {
|
|
26
|
+
this._endpointOptions = options;
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
variableName(str) {
|
|
30
|
+
this._variableName = str;
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
subtype(str) {
|
|
34
|
+
this._subtype = str;
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
source(str) {
|
|
38
|
+
this._source = str;
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
build() {
|
|
42
|
+
return {
|
|
43
|
+
...super.build(),
|
|
44
|
+
subtype: this._subtype,
|
|
45
|
+
source: this._source,
|
|
46
|
+
input: [{
|
|
47
|
+
endpoint: this._endpointName,
|
|
48
|
+
endpoint_options: this._endpointOptions,
|
|
49
|
+
name: this._variableName
|
|
50
|
+
}]
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.IOUnitConfigBuilder = IOUnitConfigBuilder;
|