@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
66exports . Subworkflow = void 0 ;
77var _ade = require ( "@mat3ra/ade" ) ;
88var _entity = require ( "@mat3ra/code/dist/js/entity" ) ;
9+ var _hash = require ( "@mat3ra/code/dist/js/entity/mixins/hash" ) ;
910var _mode = require ( "@mat3ra/mode" ) ;
1011var _utils = require ( "@mat3ra/utils" ) ;
1112var _lodash = _interopRequireDefault ( require ( "lodash" ) ) ;
@@ -20,7 +21,7 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
2021function _toPropertyKey ( t ) { var i = _toPrimitive ( t , "string" ) ; return "symbol" == typeof i ? i : i + "" ; }
2122function _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 ) ; }
2223/* 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 ) { }
2425class Subworkflow extends BaseSubworkflow {
2526 constructor ( config , _Application = _ade . Application , _ModelFactory = _mode . ModelFactory , _UnitFactory = _units . UnitFactory ) {
2627 super ( config ) ;
@@ -251,25 +252,18 @@ class Subworkflow extends BaseSubworkflow {
251252 }
252253
253254 /**
254- * @summary Calculates hash of the subworkflow. Meaningful fields are units, app and model.
255+ * @summary
256+ * Returns object for hashing of the workflow. Meaningful fields are units, app and model.
255257 * units must be sorted topologically before hashing (already sorted).
256258 */
257- calculateHash ( ) {
259+ getHashObject ( ) {
258260 const config = this . toJSON ( ) ;
259261 const meaningfulFields = {
260- application : _utils . Utils . specific . removeTimestampableKeysFromConfig ( config . application ) ,
261- model : this . _calculateModelHash ( ) ,
262+ application : new _ade . Application ( config . application ) . calculateHash ( ) ,
263+ model : new _mode . Model ( config . model ) . calculateHash ( ) ,
262264 units : _underscore . default . map ( this . units , u => u . calculateHash ( ) ) . join ( )
263265 } ;
264- return _utils . Utils . hash . calculateHashFromObject ( meaningfulFields ) ;
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 ;
273267 }
274268 findUnitById ( id ) {
275269 // TODO: come back and refactor after converting flowchartId to id
0 commit comments