@mat3ra/wode 2026.2.9-0 → 2026.3.6-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.
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.Subworkflow = void 0;
|
|
7
7
|
var _ade = require("@mat3ra/ade");
|
|
8
8
|
var _entity = require("@mat3ra/code/dist/js/entity");
|
|
9
|
+
var _hash = require("@mat3ra/code/dist/js/entity/mixins/hash");
|
|
9
10
|
var _mode = require("@mat3ra/mode");
|
|
10
11
|
var _utils = require("@mat3ra/utils");
|
|
11
12
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
@@ -20,7 +21,7 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
|
20
21
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
21
22
|
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
23
|
/* eslint max-classes-per-file:0 */
|
|
23
|
-
class BaseSubworkflow extends (0, _mixwith.mix)(_entity.NamedDefaultableRepetitionImportantSettingsInMemoryEntity).with(_convergence.ConvergenceMixin, _entity.ContextAndRenderFieldsMixin) {}
|
|
24
|
+
class BaseSubworkflow extends (0, _mixwith.mix)(_entity.NamedDefaultableRepetitionImportantSettingsInMemoryEntity).with(_convergence.ConvergenceMixin, _entity.ContextAndRenderFieldsMixin, _hash.HashedEntityMixin) {}
|
|
24
25
|
class Subworkflow extends BaseSubworkflow {
|
|
25
26
|
constructor(config, _Application = _ade.Application, _ModelFactory = _mode.ModelFactory, _UnitFactory = _units.UnitFactory) {
|
|
26
27
|
super(config);
|
|
@@ -251,25 +252,18 @@ class Subworkflow extends BaseSubworkflow {
|
|
|
251
252
|
}
|
|
252
253
|
|
|
253
254
|
/**
|
|
254
|
-
* @summary
|
|
255
|
+
* @summary
|
|
256
|
+
* Returns object for hashing of the workflow. Meaningful fields are units, app and model.
|
|
255
257
|
* units must be sorted topologically before hashing (already sorted).
|
|
256
258
|
*/
|
|
257
|
-
|
|
259
|
+
getHashObject() {
|
|
258
260
|
const config = this.toJSON();
|
|
259
261
|
const meaningfulFields = {
|
|
260
|
-
application:
|
|
261
|
-
model:
|
|
262
|
+
application: new _ade.Application(config.application).calculateHash(),
|
|
263
|
+
model: new _mode.Model(config.model).calculateHash(),
|
|
262
264
|
units: _underscore.default.map(this.units, u => u.calculateHash()).join()
|
|
263
265
|
};
|
|
264
|
-
return
|
|
265
|
-
}
|
|
266
|
-
_calculateModelHash() {
|
|
267
|
-
const {
|
|
268
|
-
model
|
|
269
|
-
} = this.toJSON();
|
|
270
|
-
// ignore empty data object
|
|
271
|
-
if (this.model.Method.omitInHashCalculation) delete model.method.data;
|
|
272
|
-
return _utils.Utils.hash.calculateHashFromObject(model);
|
|
266
|
+
return meaningfulFields;
|
|
273
267
|
}
|
|
274
268
|
findUnitById(id) {
|
|
275
269
|
// TODO: come back and refactor after converting flowchartId to id
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.Workflow = void 0;
|
|
7
7
|
var _entity = require("@mat3ra/code/dist/js/entity");
|
|
8
|
+
var _hash = require("@mat3ra/code/dist/js/entity/mixins/hash");
|
|
8
9
|
var _workflow = _interopRequireDefault(require("@mat3ra/esse/dist/js/schema/workflow.json"));
|
|
9
10
|
var _ide = require("@mat3ra/ide");
|
|
10
11
|
var _mode = require("@mat3ra/mode");
|
|
@@ -27,7 +28,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
27
28
|
const {
|
|
28
29
|
MODEL_NAMES
|
|
29
30
|
} = _mode.tree;
|
|
30
|
-
class BaseWorkflow extends (0, _mixwith.mix)(_entity.NamedDefaultableRepetitionContextAndRenderInMemoryEntity).with(_ide.ComputedEntityMixin, _relaxation.RelaxationLogicMixin) {}
|
|
31
|
+
class BaseWorkflow extends (0, _mixwith.mix)(_entity.NamedDefaultableRepetitionContextAndRenderInMemoryEntity).with(_ide.ComputedEntityMixin, _relaxation.RelaxationLogicMixin, _hash.HashedEntityMixin) {}
|
|
31
32
|
class Workflow extends BaseWorkflow {
|
|
32
33
|
constructor(config, _Subworkflow = _subworkflow.Subworkflow, _UnitFactory = _factory.UnitFactory, _Workflow = Workflow, _MapUnit = _units.MapUnit) {
|
|
33
34
|
if (!config._id) {
|
|
@@ -292,16 +293,16 @@ class Workflow extends BaseWorkflow {
|
|
|
292
293
|
}
|
|
293
294
|
|
|
294
295
|
/**
|
|
295
|
-
* @summary
|
|
296
|
+
* @summary
|
|
297
|
+
* Returns object for hashing of the workflow. Meaningful fields are units and subworkflows.
|
|
296
298
|
* units and subworkflows must be sorted topologically before hashing (already sorted).
|
|
297
299
|
*/
|
|
298
|
-
|
|
299
|
-
|
|
300
|
+
getHashObject() {
|
|
301
|
+
return {
|
|
300
302
|
units: _underscore.default.map(this.units, u => u.calculateHash()).join(),
|
|
301
303
|
subworkflows: _underscore.default.map(this.subworkflows, sw => sw.calculateHash()).join(),
|
|
302
304
|
workflows: _underscore.default.map(this.workflows, w => w.calculateHash()).join()
|
|
303
305
|
};
|
|
304
|
-
return _utils.Utils.hash.calculateHashFromObject(meaningfulFields);
|
|
305
306
|
}
|
|
306
307
|
}
|
|
307
308
|
exports.Workflow = Workflow;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mat3ra/wode",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.3.6-0",
|
|
4
4
|
"description": "WOrkflow DEfinitions",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "nyc --reporter=text mocha --recursive --bail --require @babel/register/lib --require tests/js/setup.js tests/js",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"v20": "^0.1.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@mat3ra/ade": "
|
|
50
|
+
"@mat3ra/ade": "git+https://github.com/Exabyte-io/ade.git#8d63598ed4aac5ea9624383c8f70fef06bbd166b",
|
|
51
51
|
"@exabyte-io/eslint-config": "2025.5.13-0",
|
|
52
52
|
"@mat3ra/ide": "2025.11.19-0",
|
|
53
|
-
"@mat3ra/mode": "
|
|
53
|
+
"@mat3ra/mode": "git+https://github.com/Exabyte-io/mode.git#8b561751c99b19450846f57fb60d83e69ac5f8a1",
|
|
54
54
|
"@mat3ra/utils": "2025.9.20-0",
|
|
55
55
|
"@mat3ra/code": "2025.10.24-0",
|
|
56
56
|
"@mat3ra/esse": "2025.11.26-0",
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
ContextAndRenderFieldsMixin,
|
|
4
4
|
NamedDefaultableRepetitionImportantSettingsInMemoryEntity,
|
|
5
5
|
} from "@mat3ra/code/dist/js/entity";
|
|
6
|
+
import { HashedEntityMixin } from "@mat3ra/code/dist/js/entity/mixins/hash";
|
|
6
7
|
import { Model, ModelFactory } from "@mat3ra/mode";
|
|
7
8
|
import { Utils } from "@mat3ra/utils";
|
|
8
9
|
import lodash from "lodash";
|
|
@@ -18,6 +19,7 @@ import { ConvergenceMixin } from "./convergence";
|
|
|
18
19
|
class BaseSubworkflow extends mix(NamedDefaultableRepetitionImportantSettingsInMemoryEntity).with(
|
|
19
20
|
ConvergenceMixin,
|
|
20
21
|
ContextAndRenderFieldsMixin,
|
|
22
|
+
HashedEntityMixin,
|
|
21
23
|
) {}
|
|
22
24
|
|
|
23
25
|
export class Subworkflow extends BaseSubworkflow {
|
|
@@ -308,24 +310,18 @@ export class Subworkflow extends BaseSubworkflow {
|
|
|
308
310
|
}
|
|
309
311
|
|
|
310
312
|
/**
|
|
311
|
-
* @summary
|
|
313
|
+
* @summary
|
|
314
|
+
* Returns object for hashing of the workflow. Meaningful fields are units, app and model.
|
|
312
315
|
* units must be sorted topologically before hashing (already sorted).
|
|
313
316
|
*/
|
|
314
|
-
|
|
317
|
+
getHashObject() {
|
|
315
318
|
const config = this.toJSON();
|
|
316
319
|
const meaningfulFields = {
|
|
317
|
-
application:
|
|
318
|
-
model:
|
|
320
|
+
application: new Application(config.application).calculateHash(),
|
|
321
|
+
model: new Model(config.model).calculateHash(),
|
|
319
322
|
units: _.map(this.units, (u) => u.calculateHash()).join(),
|
|
320
323
|
};
|
|
321
|
-
return
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
_calculateModelHash() {
|
|
325
|
-
const { model } = this.toJSON();
|
|
326
|
-
// ignore empty data object
|
|
327
|
-
if (this.model.Method.omitInHashCalculation) delete model.method.data;
|
|
328
|
-
return Utils.hash.calculateHashFromObject(model);
|
|
324
|
+
return meaningfulFields;
|
|
329
325
|
}
|
|
330
326
|
|
|
331
327
|
findUnitById(id) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable max-classes-per-file */
|
|
2
2
|
import { NamedDefaultableRepetitionContextAndRenderInMemoryEntity } from "@mat3ra/code/dist/js/entity";
|
|
3
|
+
import { HashedEntityMixin } from "@mat3ra/code/dist/js/entity/mixins/hash";
|
|
3
4
|
import workflowSchema from "@mat3ra/esse/dist/js/schema/workflow.json";
|
|
4
5
|
import { ComputedEntityMixin, getDefaultComputeConfig } from "@mat3ra/ide";
|
|
5
6
|
import { tree } from "@mat3ra/mode";
|
|
@@ -22,6 +23,7 @@ const { MODEL_NAMES } = tree;
|
|
|
22
23
|
class BaseWorkflow extends mix(NamedDefaultableRepetitionContextAndRenderInMemoryEntity).with(
|
|
23
24
|
ComputedEntityMixin,
|
|
24
25
|
RelaxationLogicMixin,
|
|
26
|
+
HashedEntityMixin,
|
|
25
27
|
) {}
|
|
26
28
|
|
|
27
29
|
export class Workflow extends BaseWorkflow {
|
|
@@ -372,15 +374,15 @@ export class Workflow extends BaseWorkflow {
|
|
|
372
374
|
}
|
|
373
375
|
|
|
374
376
|
/**
|
|
375
|
-
* @summary
|
|
377
|
+
* @summary
|
|
378
|
+
* Returns object for hashing of the workflow. Meaningful fields are units and subworkflows.
|
|
376
379
|
* units and subworkflows must be sorted topologically before hashing (already sorted).
|
|
377
380
|
*/
|
|
378
|
-
|
|
379
|
-
|
|
381
|
+
getHashObject() {
|
|
382
|
+
return {
|
|
380
383
|
units: _.map(this.units, (u) => u.calculateHash()).join(),
|
|
381
384
|
subworkflows: _.map(this.subworkflows, (sw) => sw.calculateHash()).join(),
|
|
382
385
|
workflows: _.map(this.workflows, (w) => w.calculateHash()).join(),
|
|
383
386
|
};
|
|
384
|
-
return Utils.hash.calculateHashFromObject(meaningfulFields);
|
|
385
387
|
}
|
|
386
388
|
}
|