Skip to content

Commit 5b59e91

Browse files
committed
update: mixins
1 parent 72d2f4d commit 5b59e91

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+478
-1372
lines changed

dist/js/entity/index.d.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@ import { InMemoryEntity } from "./in_memory";
22
import { ContextAndRenderFieldsMixin } from "./mixins/context";
33
import { RuntimeContextFieldMixin } from "./mixins/context_runtime";
44
import { FlowchartEntityMixin, FlowchartItemMixin } from "./mixins/flowchart";
5-
import { HasScopeTrackMixin } from "./mixins/props";
6-
import { RuntimeItemsMixin } from "./mixins/runtime_items";
7-
import { DefaultableInMemoryEntity, HasConsistencyChecksHasMetadataNamedDefaultableInMemoryEntity, HasMetadataNamedDefaultableInMemoryEntity, NamedDefaultableInMemoryEntity, NamedDefaultableRepetitionContextAndRenderInMemoryEntity, NamedDefaultableRepetitionImportantSettingsInMemoryEntity, NamedDefaultableRepetitionRuntimeItemsImportantSettingsContextAndRenderHashedInMemoryEntity, NamedInMemoryEntity } from "./other";
5+
import { DefaultableInMemoryEntity, HasConsistencyChecksHasMetadataNamedDefaultableInMemoryEntity, HasMetadataNamedDefaultableInMemoryEntity, NamedDefaultableInMemoryEntity, NamedInMemoryEntity } from "./other";
86
import { InMemoryEntitySet } from "./set";
97
import { ENTITY_SET_TYPES } from "./set/enums";
108
import { constructEntitySetFactoryByConfig } from "./set/factory";
119
import { InMemoryEntityInSetMixin, InMemoryEntitySetMixin } from "./set/mixins";
1210
import { OrderedInMemoryEntityInSetMixin, OrderedInMemoryEntitySetMixin } from "./set/ordered/mixins";
1311
import * as selectorsForEntitySet from "./set/selectors";
14-
export { InMemoryEntity, NamedInMemoryEntity, DefaultableInMemoryEntity, NamedDefaultableInMemoryEntity, HasMetadataNamedDefaultableInMemoryEntity, NamedDefaultableRepetitionContextAndRenderInMemoryEntity, NamedDefaultableRepetitionImportantSettingsInMemoryEntity, NamedDefaultableRepetitionRuntimeItemsImportantSettingsContextAndRenderHashedInMemoryEntity, HasConsistencyChecksHasMetadataNamedDefaultableInMemoryEntity, HasScopeTrackMixin, RuntimeItemsMixin, RuntimeContextFieldMixin, InMemoryEntitySet, ENTITY_SET_TYPES, constructEntitySetFactoryByConfig, selectorsForEntitySet, InMemoryEntitySetMixin, InMemoryEntityInSetMixin, OrderedInMemoryEntitySetMixin, OrderedInMemoryEntityInSetMixin, ContextAndRenderFieldsMixin, FlowchartEntityMixin, FlowchartItemMixin, };
12+
export { InMemoryEntity, NamedInMemoryEntity, DefaultableInMemoryEntity, NamedDefaultableInMemoryEntity, HasMetadataNamedDefaultableInMemoryEntity, HasConsistencyChecksHasMetadataNamedDefaultableInMemoryEntity, RuntimeContextFieldMixin, InMemoryEntitySet, ENTITY_SET_TYPES, constructEntitySetFactoryByConfig, selectorsForEntitySet, InMemoryEntitySetMixin, InMemoryEntityInSetMixin, OrderedInMemoryEntitySetMixin, OrderedInMemoryEntityInSetMixin, ContextAndRenderFieldsMixin, FlowchartEntityMixin, FlowchartItemMixin, };

dist/js/entity/index.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
3333
};
3434
})();
3535
Object.defineProperty(exports, "__esModule", { value: true });
36-
exports.FlowchartItemMixin = exports.FlowchartEntityMixin = exports.ContextAndRenderFieldsMixin = exports.OrderedInMemoryEntityInSetMixin = exports.OrderedInMemoryEntitySetMixin = exports.InMemoryEntityInSetMixin = exports.InMemoryEntitySetMixin = exports.selectorsForEntitySet = exports.constructEntitySetFactoryByConfig = exports.ENTITY_SET_TYPES = exports.InMemoryEntitySet = exports.RuntimeContextFieldMixin = exports.RuntimeItemsMixin = exports.HasScopeTrackMixin = exports.HasConsistencyChecksHasMetadataNamedDefaultableInMemoryEntity = exports.NamedDefaultableRepetitionRuntimeItemsImportantSettingsContextAndRenderHashedInMemoryEntity = exports.NamedDefaultableRepetitionImportantSettingsInMemoryEntity = exports.NamedDefaultableRepetitionContextAndRenderInMemoryEntity = exports.HasMetadataNamedDefaultableInMemoryEntity = exports.NamedDefaultableInMemoryEntity = exports.DefaultableInMemoryEntity = exports.NamedInMemoryEntity = exports.InMemoryEntity = void 0;
36+
exports.FlowchartItemMixin = exports.FlowchartEntityMixin = exports.ContextAndRenderFieldsMixin = exports.OrderedInMemoryEntityInSetMixin = exports.OrderedInMemoryEntitySetMixin = exports.InMemoryEntityInSetMixin = exports.InMemoryEntitySetMixin = exports.selectorsForEntitySet = exports.constructEntitySetFactoryByConfig = exports.ENTITY_SET_TYPES = exports.InMemoryEntitySet = exports.RuntimeContextFieldMixin = exports.HasConsistencyChecksHasMetadataNamedDefaultableInMemoryEntity = exports.HasMetadataNamedDefaultableInMemoryEntity = exports.NamedDefaultableInMemoryEntity = exports.DefaultableInMemoryEntity = exports.NamedInMemoryEntity = exports.InMemoryEntity = void 0;
3737
const in_memory_1 = require("./in_memory");
3838
Object.defineProperty(exports, "InMemoryEntity", { enumerable: true, get: function () { return in_memory_1.InMemoryEntity; } });
3939
const context_1 = require("./mixins/context");
@@ -43,18 +43,12 @@ Object.defineProperty(exports, "RuntimeContextFieldMixin", { enumerable: true, g
4343
const flowchart_1 = require("./mixins/flowchart");
4444
Object.defineProperty(exports, "FlowchartEntityMixin", { enumerable: true, get: function () { return flowchart_1.FlowchartEntityMixin; } });
4545
Object.defineProperty(exports, "FlowchartItemMixin", { enumerable: true, get: function () { return flowchart_1.FlowchartItemMixin; } });
46-
const props_1 = require("./mixins/props");
47-
Object.defineProperty(exports, "HasScopeTrackMixin", { enumerable: true, get: function () { return props_1.HasScopeTrackMixin; } });
48-
const runtime_items_1 = require("./mixins/runtime_items");
49-
Object.defineProperty(exports, "RuntimeItemsMixin", { enumerable: true, get: function () { return runtime_items_1.RuntimeItemsMixin; } });
46+
// import { RuntimeItemsMixin } from "./mixins/runtime_items";
5047
const other_1 = require("./other");
5148
Object.defineProperty(exports, "DefaultableInMemoryEntity", { enumerable: true, get: function () { return other_1.DefaultableInMemoryEntity; } });
5249
Object.defineProperty(exports, "HasConsistencyChecksHasMetadataNamedDefaultableInMemoryEntity", { enumerable: true, get: function () { return other_1.HasConsistencyChecksHasMetadataNamedDefaultableInMemoryEntity; } });
5350
Object.defineProperty(exports, "HasMetadataNamedDefaultableInMemoryEntity", { enumerable: true, get: function () { return other_1.HasMetadataNamedDefaultableInMemoryEntity; } });
5451
Object.defineProperty(exports, "NamedDefaultableInMemoryEntity", { enumerable: true, get: function () { return other_1.NamedDefaultableInMemoryEntity; } });
55-
Object.defineProperty(exports, "NamedDefaultableRepetitionContextAndRenderInMemoryEntity", { enumerable: true, get: function () { return other_1.NamedDefaultableRepetitionContextAndRenderInMemoryEntity; } });
56-
Object.defineProperty(exports, "NamedDefaultableRepetitionImportantSettingsInMemoryEntity", { enumerable: true, get: function () { return other_1.NamedDefaultableRepetitionImportantSettingsInMemoryEntity; } });
57-
Object.defineProperty(exports, "NamedDefaultableRepetitionRuntimeItemsImportantSettingsContextAndRenderHashedInMemoryEntity", { enumerable: true, get: function () { return other_1.NamedDefaultableRepetitionRuntimeItemsImportantSettingsContextAndRenderHashedInMemoryEntity; } });
5852
Object.defineProperty(exports, "NamedInMemoryEntity", { enumerable: true, get: function () { return other_1.NamedInMemoryEntity; } });
5953
const set_1 = require("./set");
6054
Object.defineProperty(exports, "InMemoryEntitySet", { enumerable: true, get: function () { return set_1.InMemoryEntitySet; } });

dist/js/entity/mixins/HasConsistencyChecksMixin.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import { InMemoryEntity } from "../in_memory";
55
type HasConsistencyChecksProperties = {
66
addConsistencyChecks: (array: ConsistencyCheck[]) => void;
77
};
8-
export declare function hasConsistencyChecksMixin<T extends InMemoryEntity>(item: T): asserts item is T & HasConsistencyChecksProperties;
8+
type HasConsistencyChecks = HasConsistencyChecksSchemaMixin & HasConsistencyChecksProperties;
9+
export declare function hasConsistencyChecksMixin<T extends InMemoryEntity>(item: T): asserts item is T & HasConsistencyChecks;
910
export type HasConsistencyChecksInMemoryEntity = HasConsistencyChecksSchemaMixin & HasConsistencyChecksProperties;
1011
export type HasConsistencyChecksInMemoryEntityConstructor = Constructor<HasConsistencyChecksInMemoryEntity>;
1112
export {};

dist/js/entity/mixins/HasMetadataMixin.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { InMemoryEntity } from "../in_memory";
44
type HasMetadataProperties = {
55
updateMetadata: (object: object) => void;
66
};
7-
export declare function hasMetadataMixin<T extends InMemoryEntity>(item: T): asserts item is T & HasMetadataProperties;
7+
type HasMetadata = HasMetadataSchemaMixin & HasMetadataProperties;
8+
export declare function hasMetadataMixin<T extends InMemoryEntity>(item: T): asserts item is T & HasMetadata;
89
export type HasMetadataInMemoryEntity = HasMetadataSchemaMixin & HasMetadataProperties;
910
export type HasMetadataInMemoryEntityConstructor = Constructor<HasMetadataInMemoryEntity>;
1011
export {};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import type { InMemoryEntity } from "../in_memory";
2+
export interface HasRepetition {
3+
_repetition: number;
4+
_totalRepetitions: number;
5+
repetition: number;
6+
totalRepetitions: number;
7+
setRepetition: (repetition: number) => void;
8+
setTotalRepetitions: (totalRepetition: number) => void;
9+
}
10+
export declare function hasRepetitionMixin<T extends InMemoryEntity>(item: T): asserts item is T & HasRepetition;
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });
3+
exports.hasRepetitionMixin = hasRepetitionMixin;
4+
function hasRepetitionMixin(item) {
5+
// @ts-expect-error
6+
const properties = {
7+
_repetition: 0,
8+
_totalRepetitions: 0,
9+
get repetition() {
10+
return this._repetition;
11+
},
12+
get totalRepetitions() {
13+
return this._totalRepetitions || 1;
14+
},
15+
setRepetition(repetition) {
16+
this.repetition = repetition;
17+
// if (["Subworkflow", "Workflow"].find((n) => this.constructor.name === n)) {
18+
// this.units.forEach((u) => u.setRepetition(repetition));
19+
// }
20+
// if (this.constructor.name === "Workflow") {
21+
// this.subworkflows.forEach((sw) => sw.setRepetition(repetition));
22+
// this.workflows.forEach((wf) => wf.setRepetition(repetition));
23+
// }
24+
},
25+
setTotalRepetitions(totalRepetition) {
26+
this._totalRepetitions = totalRepetition;
27+
},
28+
};
29+
Object.defineProperties(item, Object.getOwnPropertyDescriptors(properties));
30+
}

dist/js/entity/mixins/HasScopeTrackMixin.d.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

dist/js/entity/mixins/HasScopeTrackMixin.js

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { type HasDescriptionSchemaMixin } from "../../generated/HasDescriptionSchemaMixin";
2+
import type { Constructor } from "../../utils/types";
3+
import { InMemoryEntity } from "../in_memory";
4+
type HashedEntityProperties = {
5+
calculateHash: () => string;
6+
getHashObject?: () => object;
7+
};
8+
export declare function hashedEntityMixin<T extends InMemoryEntity>(item: T): asserts item is T & HashedEntityProperties;
9+
export type HasDescriptionInMemoryEntity = HasDescriptionSchemaMixin;
10+
export type HasDescriptionInMemoryEntityConstructor = Constructor<HasDescriptionInMemoryEntity>;
11+
export {};
Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
3-
exports.HashedEntityMixin = HashedEntityMixin;
3+
exports.hashedEntityMixin = hashedEntityMixin;
44
const hash_1 = require("../../utils/hash");
5-
function HashedEntityMixin(superclass) {
6-
return class extends superclass {
7-
/*
8-
* @summary Returns an object based on meaningful fields for this unit, that will be used to calculate the hash
9-
* Must be overridden.
10-
*/
11-
// eslint-disable-next-line class-methods-use-this
12-
getHashObject() {
13-
return {};
14-
}
5+
function hashedEntityMixin(item) {
6+
// @ts-expect-error
7+
const properties = {
158
/**
169
* @summary Calculates hash based on meaningful fields and unit-specific fields. Unit-specific fields are
1710
* separated into _typeSpecificHash function which can be overwritten by child classes.
1811
* head and next are also important but not considered since they are included in subworkflow hash.
1912
*/
2013
calculateHash() {
21-
return (0, hash_1.calculateHashFromObject)(this.getHashObject());
22-
}
14+
var _a, _b;
15+
return (0, hash_1.calculateHashFromObject)((_b = (_a = this.getHashObject) === null || _a === void 0 ? void 0 : _a.call(this)) !== null && _b !== void 0 ? _b : {});
16+
},
2317
};
18+
Object.defineProperties(item, Object.getOwnPropertyDescriptors(properties));
2419
}

0 commit comments

Comments
 (0)