@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,29 @@
|
|
|
1
|
+
import { UNIT_TYPES } from "../enums";
|
|
2
|
+
import { BaseUnit } from "./base";
|
|
3
|
+
|
|
4
|
+
export class AssertionUnit extends BaseUnit {
|
|
5
|
+
constructor(config) {
|
|
6
|
+
super({ ...AssertionUnit.getAssertionConfig(), ...config });
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
static getAssertionConfig() {
|
|
10
|
+
return {
|
|
11
|
+
name: UNIT_TYPES.assertion,
|
|
12
|
+
type: UNIT_TYPES.assertion,
|
|
13
|
+
statement: "true",
|
|
14
|
+
errorMessage: "assertion failed",
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
get statement() {
|
|
19
|
+
return this.prop("statement");
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
get errorMessage() {
|
|
23
|
+
return this.prop("errorMessage");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
getHashObject() {
|
|
27
|
+
return { statement: this.statement, errorMessage: this.errorMessage };
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { UNIT_TYPES } from "../enums";
|
|
2
|
+
import { BaseUnit } from "./base";
|
|
3
|
+
|
|
4
|
+
export class AssignmentUnit extends BaseUnit {
|
|
5
|
+
constructor(config) {
|
|
6
|
+
super({ ...AssignmentUnit.getAssignmentConfig(), ...config });
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
static getAssignmentConfig() {
|
|
10
|
+
return {
|
|
11
|
+
name: UNIT_TYPES.assignment,
|
|
12
|
+
type: UNIT_TYPES.assignment,
|
|
13
|
+
operand: "X",
|
|
14
|
+
value: "1",
|
|
15
|
+
input: [],
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
get operand() {
|
|
20
|
+
return this.prop("operand");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
get value() {
|
|
24
|
+
return this.prop("value");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
get input() {
|
|
28
|
+
return this.prop("input");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
getHashObject() {
|
|
32
|
+
return { input: this.input, operand: this.operand, value: this.value };
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { NamedDefaultableRepetitionRuntimeItemsImportantSettingsContextAndRenderHashedInMemoryEntity } from "@mat3ra/code/dist/js/entity";
|
|
2
|
+
import { taggableMixin } from "@mat3ra/code/dist/js/entity/mixins/TaggableMixin";
|
|
3
|
+
import { Utils } from "@mat3ra/utils";
|
|
4
|
+
import lodash from "lodash";
|
|
5
|
+
|
|
6
|
+
import { UNIT_STATUSES } from "../enums";
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line max-len
|
|
9
|
+
export class BaseUnit extends NamedDefaultableRepetitionRuntimeItemsImportantSettingsContextAndRenderHashedInMemoryEntity {
|
|
10
|
+
static usePredefinedIds = false;
|
|
11
|
+
|
|
12
|
+
constructor(config) {
|
|
13
|
+
const flowchartId =
|
|
14
|
+
config.flowchartId || BaseUnit.generateFlowChartId.call(new.target, config.name);
|
|
15
|
+
super({
|
|
16
|
+
...config,
|
|
17
|
+
status: config.status || UNIT_STATUSES.idle,
|
|
18
|
+
statusTrack: config.statusTrack || [],
|
|
19
|
+
flowchartId,
|
|
20
|
+
tags: config.tags || [],
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
static generateFlowChartId(...args) {
|
|
25
|
+
args[0] = `flowchart-${args[0]}`;
|
|
26
|
+
if (this.usePredefinedIds) return Utils.uuid.getUUIDFromNamespace(...args);
|
|
27
|
+
return Utils.uuid.getUUID();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
get flowchartId() {
|
|
31
|
+
return this.prop("flowchartId");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
get head() {
|
|
35
|
+
return this.prop("head", false);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
set head(bool) {
|
|
39
|
+
this.setProp("head", bool);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
get next() {
|
|
43
|
+
return this.prop("next");
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
set next(flowchartId) {
|
|
47
|
+
this.setProp("next", flowchartId);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
get status() {
|
|
51
|
+
return lodash.get(this.lastStatusUpdate, "status") || UNIT_STATUSES.idle;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
set status(s) {
|
|
55
|
+
this.setProp("status", s);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
get lastStatusUpdate() {
|
|
59
|
+
const statusTrack = this.prop("statusTrack", []).filter(
|
|
60
|
+
(s) => (s.repetition || 0) === this.repetition,
|
|
61
|
+
);
|
|
62
|
+
const sortedStatusTrack = lodash.sortBy(statusTrack || [], (x) => x.trackedAt);
|
|
63
|
+
return sortedStatusTrack[sortedStatusTrack.length - 1];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
get type() {
|
|
67
|
+
return this.prop("type");
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
get isDraft() {
|
|
71
|
+
return this.prop("isDraft", false);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
getHashObject() {
|
|
75
|
+
return { ...this.hashObjectFromRuntimeItems, type: this.type };
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Checks whether a unit is currently in a given status (e.g. idle, active, etc). The full list can be found
|
|
80
|
+
* in the UNIT_STATUSES variable in enums.js.
|
|
81
|
+
* @param status (String) name of the status to check
|
|
82
|
+
* @returns Boolean
|
|
83
|
+
*/
|
|
84
|
+
isInStatus(status) {
|
|
85
|
+
return this.status === status;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
clone(extraContext) {
|
|
89
|
+
const flowchartIDOverrideConfigAsExtraContext = {
|
|
90
|
+
flowchartId: this.constructor.generateFlowChartId(),
|
|
91
|
+
...extraContext,
|
|
92
|
+
};
|
|
93
|
+
return super.clone(flowchartIDOverrideConfigAsExtraContext);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
taggableMixin(BaseUnit.prototype);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { UNIT_TYPES } from "../../enums";
|
|
2
|
+
import { UnitConfigBuilder } from "./UnitConfigBuilder";
|
|
3
|
+
|
|
4
|
+
export class AssertionUnitConfigBuilder extends UnitConfigBuilder {
|
|
5
|
+
constructor(name, statement, errorMessage) {
|
|
6
|
+
super({ name, type: UNIT_TYPES.assertion });
|
|
7
|
+
this._statement = statement;
|
|
8
|
+
this._errorMessage = errorMessage;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
statement(str) {
|
|
12
|
+
this._statement = str;
|
|
13
|
+
return this;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
errorMessage(str) {
|
|
17
|
+
this._errorMessage = str;
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
build() {
|
|
22
|
+
return {
|
|
23
|
+
...super.build(),
|
|
24
|
+
statement: this._statement,
|
|
25
|
+
errorMessage: this._errorMessage,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { UNIT_TYPES } from "../../enums";
|
|
2
|
+
import { UnitConfigBuilder } from "./UnitConfigBuilder";
|
|
3
|
+
|
|
4
|
+
export class AssignmentUnitConfigBuilder extends UnitConfigBuilder {
|
|
5
|
+
constructor(name, variableName, variableValue, input = [], results = []) {
|
|
6
|
+
super({ name, type: UNIT_TYPES.assignment });
|
|
7
|
+
this._variableName = variableName;
|
|
8
|
+
this._variableValue = variableValue;
|
|
9
|
+
this._input = input;
|
|
10
|
+
this._results = results;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
input(arr) {
|
|
14
|
+
this._input = arr;
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
variableName(str) {
|
|
19
|
+
this._variableName = str;
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
variableValue(str) {
|
|
24
|
+
this._variableValue = str;
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
build() {
|
|
29
|
+
return {
|
|
30
|
+
...super.build(),
|
|
31
|
+
input: this._input,
|
|
32
|
+
operand: this._variableName,
|
|
33
|
+
value: this._variableValue,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/* eslint-disable class-methods-use-this */
|
|
2
|
+
import ApplicationRegistry from "@exabyte-io/ade.js/dist/js/ApplicationRegistry";
|
|
3
|
+
|
|
4
|
+
import { UNIT_TYPES } from "../../enums";
|
|
5
|
+
import { UnitConfigBuilder } from "./UnitConfigBuilder";
|
|
6
|
+
|
|
7
|
+
export class ExecutionUnitConfigBuilder extends UnitConfigBuilder {
|
|
8
|
+
constructor(name, application, execName, flavorName, flowchartId) {
|
|
9
|
+
super({ name, type: UNIT_TYPES.execution, flowchartId });
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
this.initialize(application, execName, flavorName);
|
|
13
|
+
} catch (e) {
|
|
14
|
+
console.error(`Can't initialize executable/flavor: ${execName}/${flavorName}`);
|
|
15
|
+
throw e;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// initialize runtimeItems
|
|
19
|
+
this._results = this.flavor.results;
|
|
20
|
+
this._monitors = this.flavor.monitors;
|
|
21
|
+
this._preProcessors = this.flavor.preProcessors;
|
|
22
|
+
this._postProcessors = this.flavor.postProcessors;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
initialize(application, execName, flavorName) {
|
|
26
|
+
this.application = application;
|
|
27
|
+
this.executable = this._createExecutable(this.application, execName);
|
|
28
|
+
this.flavor = this._createFlavor(this.executable, flavorName);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
build() {
|
|
32
|
+
return {
|
|
33
|
+
...super.build(),
|
|
34
|
+
application: this.application.toJSON(),
|
|
35
|
+
executable: this.executable.toJSON(),
|
|
36
|
+
flavor: this.flavor.toJSON(),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Creates an executable instance. This method is intended to be overridden in subclasses.
|
|
42
|
+
* @param {Application} application - The application object
|
|
43
|
+
* @param {string} execName - The name of the executable
|
|
44
|
+
* @returns {Executable} The created executable instance
|
|
45
|
+
*/
|
|
46
|
+
_createExecutable(application, execName) {
|
|
47
|
+
return ApplicationRegistry.getExecutableByName(application.name, execName);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Creates a flavor instance. This method is intended to be overridden in subclasses.
|
|
52
|
+
* @param {Executable} executable - The executable object
|
|
53
|
+
* @param {string} flavorName - The name of the flavor
|
|
54
|
+
* @returns {Flavor} The created flavor instance
|
|
55
|
+
*/
|
|
56
|
+
_createFlavor(executable, flavorName) {
|
|
57
|
+
return ApplicationRegistry.getFlavorByName(executable, flavorName);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { UNIT_TYPES } from "../../enums";
|
|
2
|
+
import { UnitConfigBuilder } from "./UnitConfigBuilder";
|
|
3
|
+
|
|
4
|
+
export class IOUnitConfigBuilder extends UnitConfigBuilder {
|
|
5
|
+
constructor(name, endpointName, endpointOptions) {
|
|
6
|
+
super({ name, type: UNIT_TYPES.io });
|
|
7
|
+
this._endpointName = endpointName;
|
|
8
|
+
this._endpointOptions = endpointOptions;
|
|
9
|
+
this._variableName = "DATA";
|
|
10
|
+
this._subtype = "input";
|
|
11
|
+
this._source = "api";
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
endpointName(str) {
|
|
15
|
+
this._endpointName = str;
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
endpointOptions(options) {
|
|
20
|
+
this._endpointOptions = options;
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
variableName(str) {
|
|
25
|
+
this._variableName = str;
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
subtype(str) {
|
|
30
|
+
this._subtype = str;
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
source(str) {
|
|
35
|
+
this._source = str;
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
build() {
|
|
40
|
+
return {
|
|
41
|
+
...super.build(),
|
|
42
|
+
subtype: this._subtype,
|
|
43
|
+
source: this._source,
|
|
44
|
+
input: [
|
|
45
|
+
{
|
|
46
|
+
endpoint: this._endpointName,
|
|
47
|
+
endpoint_options: this._endpointOptions,
|
|
48
|
+
name: this._variableName,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Utils } from "@mat3ra/utils";
|
|
2
|
+
import _ from "underscore";
|
|
3
|
+
|
|
4
|
+
export class UnitConfigBuilder {
|
|
5
|
+
static usePredefinedIds = false;
|
|
6
|
+
|
|
7
|
+
constructor({ name, type, flowchartId }) {
|
|
8
|
+
this.type = type;
|
|
9
|
+
this._name = name;
|
|
10
|
+
this._head = false;
|
|
11
|
+
this._results = [];
|
|
12
|
+
this._monitors = [];
|
|
13
|
+
this._preProcessors = [];
|
|
14
|
+
this._postProcessors = [];
|
|
15
|
+
this._flowchartId = flowchartId || this.constructor.generateFlowChartId(name);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
name(str) {
|
|
19
|
+
this._name = str;
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
head(bool) {
|
|
24
|
+
this._head = bool;
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
static generateFlowChartId(...args) {
|
|
29
|
+
if (this.usePredefinedIds) return Utils.uuid.getUUIDFromNamespace(...args);
|
|
30
|
+
return Utils.uuid.getUUID();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
flowchartId(flowchartId) {
|
|
34
|
+
this._flowchartId = flowchartId;
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static _stringArrayToNamedObject(array) {
|
|
39
|
+
return array.map((name) => (_.isString(name) ? { name } : name));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
addPreProcessors(preProcessorNames) {
|
|
43
|
+
this._preProcessors = _.union(
|
|
44
|
+
this.constructor._stringArrayToNamedObject(preProcessorNames),
|
|
45
|
+
this._preProcessors,
|
|
46
|
+
);
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
addPostProcessors(postProcessorNames) {
|
|
51
|
+
this._postProcessors = _.union(
|
|
52
|
+
this.constructor._stringArrayToNamedObject(postProcessorNames),
|
|
53
|
+
this._postProcessors,
|
|
54
|
+
);
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
addResults(resultNames) {
|
|
59
|
+
this._results = _.union(
|
|
60
|
+
this.constructor._stringArrayToNamedObject(resultNames),
|
|
61
|
+
this._results,
|
|
62
|
+
);
|
|
63
|
+
return this;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
addMonitors(monitorNames) {
|
|
67
|
+
this._monitors = _.union(
|
|
68
|
+
this.constructor._stringArrayToNamedObject(monitorNames),
|
|
69
|
+
this._monitors,
|
|
70
|
+
);
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
build() {
|
|
75
|
+
return {
|
|
76
|
+
type: this.type,
|
|
77
|
+
name: this._name,
|
|
78
|
+
head: this._head,
|
|
79
|
+
results: this._results,
|
|
80
|
+
monitors: this._monitors,
|
|
81
|
+
flowchartId: this._flowchartId,
|
|
82
|
+
preProcessors: this._preProcessors,
|
|
83
|
+
postProcessors: this._postProcessors,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AssertionUnitConfigBuilder } from "./AssertionUnitConfigBuilder";
|
|
2
|
+
import { AssignmentUnitConfigBuilder } from "./AssignmentUnitConfigBuilder";
|
|
3
|
+
import { ExecutionUnitConfigBuilder } from "./ExecutionUnitConfigBuilder";
|
|
4
|
+
import { IOUnitConfigBuilder } from "./IOUnitConfigBuilder";
|
|
5
|
+
import { UnitConfigBuilder } from "./UnitConfigBuilder";
|
|
6
|
+
|
|
7
|
+
const builders = {
|
|
8
|
+
UnitConfigBuilder,
|
|
9
|
+
AssignmentUnitConfigBuilder,
|
|
10
|
+
AssertionUnitConfigBuilder,
|
|
11
|
+
ExecutionUnitConfigBuilder,
|
|
12
|
+
IOUnitConfigBuilder,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { builders };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { UNIT_TYPES } from "../enums";
|
|
2
|
+
import { BaseUnit } from "./base";
|
|
3
|
+
|
|
4
|
+
export class ConditionUnit extends BaseUnit {
|
|
5
|
+
constructor(config) {
|
|
6
|
+
super({ ...ConditionUnit.getConditionConfig(), ...config });
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
static getConditionConfig() {
|
|
10
|
+
return {
|
|
11
|
+
name: UNIT_TYPES.condition,
|
|
12
|
+
type: UNIT_TYPES.condition,
|
|
13
|
+
input: [],
|
|
14
|
+
results: [],
|
|
15
|
+
preProcessors: [],
|
|
16
|
+
postProcessors: [],
|
|
17
|
+
then: undefined,
|
|
18
|
+
else: undefined,
|
|
19
|
+
statement: "true",
|
|
20
|
+
maxOccurrences: 100,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
get input() {
|
|
25
|
+
return this.prop("input");
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
get then() {
|
|
29
|
+
return this.prop("then");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
get else() {
|
|
33
|
+
return this.prop("else");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
get statement() {
|
|
37
|
+
return this.prop("statement");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
get maxOccurrences() {
|
|
41
|
+
return this.prop("maxOccurrences");
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
getHashObject() {
|
|
45
|
+
return { statement: this.statement, maxOccurrences: this.maxOccurrences };
|
|
46
|
+
}
|
|
47
|
+
}
|