@mat3ra/wode 2026.6.16-0 → 2026.6.18-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/dist/js/Subworkflow.d.ts +3 -3
- package/dist/js/Subworkflow.js +15 -10
- package/package.json +1 -1
- package/src/js/Subworkflow.ts +15 -9
package/dist/js/Subworkflow.d.ts
CHANGED
|
@@ -736,14 +736,14 @@ declare class Subworkflow extends InMemoryEntity implements SubworkflowSchema {
|
|
|
736
736
|
reason: string;
|
|
737
737
|
} | undefined;
|
|
738
738
|
findUnitKeyById(id: string): string;
|
|
739
|
-
private
|
|
739
|
+
private findAssignmentUnitWithTag;
|
|
740
740
|
get hasConvergence(): boolean;
|
|
741
741
|
get convergenceParam(): string | undefined;
|
|
742
742
|
get convergenceResult(): string | undefined;
|
|
743
743
|
convergenceSeries(scopeTrack: JobSchema["scopeTrack"]): {
|
|
744
744
|
x: number;
|
|
745
|
-
param:
|
|
746
|
-
y:
|
|
745
|
+
param: unknown;
|
|
746
|
+
y: unknown;
|
|
747
747
|
}[];
|
|
748
748
|
updateMethodData(materials: Material[], metaProperties: MetaPropertyHolder[]): void;
|
|
749
749
|
addConvergence({ parameter, parameterInitial, parameterIncrement, result, resultInitial, condition, operator, tolerance, maxOccurrences, externalContext, }: ConvergenceConfig): void;
|
package/dist/js/Subworkflow.js
CHANGED
|
@@ -186,7 +186,7 @@ class Subworkflow extends entity_1.InMemoryEntity {
|
|
|
186
186
|
const index = this.units.findIndex((u) => u.flowchartId === id);
|
|
187
187
|
return `units.${index}`;
|
|
188
188
|
}
|
|
189
|
-
|
|
189
|
+
findAssignmentUnitWithTag(tag) {
|
|
190
190
|
return this.units
|
|
191
191
|
.filter((unit) => unit.type === enums_1.UnitType.assignment)
|
|
192
192
|
.find((unit) => { var _a; return (_a = unit.tags) === null || _a === void 0 ? void 0 : _a.includes(tag); });
|
|
@@ -196,27 +196,32 @@ class Subworkflow extends entity_1.InMemoryEntity {
|
|
|
196
196
|
}
|
|
197
197
|
get convergenceParam() {
|
|
198
198
|
var _a;
|
|
199
|
-
return (_a = this.
|
|
199
|
+
return (_a = this.findAssignmentUnitWithTag(enums_1.UnitTag.hasConvergenceParam)) === null || _a === void 0 ? void 0 : _a.operand;
|
|
200
200
|
}
|
|
201
201
|
get convergenceResult() {
|
|
202
202
|
var _a;
|
|
203
|
-
return (_a = this.
|
|
203
|
+
return (_a = this.findAssignmentUnitWithTag(enums_1.UnitTag.hasConvergenceResult)) === null || _a === void 0 ? void 0 : _a.operand;
|
|
204
204
|
}
|
|
205
205
|
convergenceSeries(scopeTrack) {
|
|
206
|
-
|
|
206
|
+
const { convergenceParam, convergenceResult } = this;
|
|
207
|
+
if (!convergenceParam || !convergenceResult || !(scopeTrack === null || scopeTrack === void 0 ? void 0 : scopeTrack.length)) {
|
|
207
208
|
return [];
|
|
208
209
|
}
|
|
209
210
|
let prevResult;
|
|
211
|
+
// `scopeTrack` stores per-repetition diffs: each item only carries the global/local keys
|
|
212
|
+
// that were added or changed in that repetition (see UnitEndpoint.saveUnitStatus). Accumulate
|
|
213
|
+
// the global scope across items so each iteration reads the full scope, not just its delta.
|
|
214
|
+
// This also stays correct for legacy full-snapshot scopeTrack data, since re-applying a full
|
|
215
|
+
// snapshot is idempotent.
|
|
216
|
+
const accumulatedGlobal = {};
|
|
210
217
|
return scopeTrack
|
|
211
218
|
.map((scopeItem, i) => {
|
|
212
|
-
var _a
|
|
219
|
+
var _a;
|
|
220
|
+
Object.assign(accumulatedGlobal, (_a = scopeItem.scope) === null || _a === void 0 ? void 0 : _a.global);
|
|
213
221
|
return {
|
|
214
222
|
x: i,
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
param: (_a = scopeItem.scope) === null || _a === void 0 ? void 0 : _a.global[this.convergenceParam],
|
|
218
|
-
// @ts-ignore
|
|
219
|
-
y: (_b = scopeItem.scope) === null || _b === void 0 ? void 0 : _b.global[this.convergenceResult],
|
|
223
|
+
param: accumulatedGlobal[convergenceParam],
|
|
224
|
+
y: accumulatedGlobal[convergenceResult],
|
|
220
225
|
};
|
|
221
226
|
})
|
|
222
227
|
.filter(({ y }) => {
|
package/package.json
CHANGED
package/src/js/Subworkflow.ts
CHANGED
|
@@ -279,7 +279,7 @@ class Subworkflow extends InMemoryEntity implements SubworkflowSchema {
|
|
|
279
279
|
return `units.${index}`;
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
-
private
|
|
282
|
+
private findAssignmentUnitWithTag(tag: UnitTag) {
|
|
283
283
|
return this.units
|
|
284
284
|
.filter((unit) => unit.type === UnitType.assignment)
|
|
285
285
|
.find((unit) => unit.tags?.includes(tag));
|
|
@@ -290,29 +290,35 @@ class Subworkflow extends InMemoryEntity implements SubworkflowSchema {
|
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
get convergenceParam() {
|
|
293
|
-
return this.
|
|
293
|
+
return this.findAssignmentUnitWithTag(UnitTag.hasConvergenceParam)?.operand;
|
|
294
294
|
}
|
|
295
295
|
|
|
296
296
|
get convergenceResult() {
|
|
297
|
-
return this.
|
|
297
|
+
return this.findAssignmentUnitWithTag(UnitTag.hasConvergenceResult)?.operand;
|
|
298
298
|
}
|
|
299
299
|
|
|
300
300
|
convergenceSeries(scopeTrack: JobSchema["scopeTrack"]) {
|
|
301
|
-
|
|
301
|
+
const { convergenceParam, convergenceResult } = this;
|
|
302
|
+
|
|
303
|
+
if (!convergenceParam || !convergenceResult || !scopeTrack?.length) {
|
|
302
304
|
return [];
|
|
303
305
|
}
|
|
304
306
|
|
|
305
307
|
let prevResult: unknown;
|
|
308
|
+
// `scopeTrack` stores per-repetition diffs: each item only carries the global/local keys
|
|
309
|
+
// that were added or changed in that repetition (see UnitEndpoint.saveUnitStatus). Accumulate
|
|
310
|
+
// the global scope across items so each iteration reads the full scope, not just its delta.
|
|
311
|
+
// This also stays correct for legacy full-snapshot scopeTrack data, since re-applying a full
|
|
312
|
+
// snapshot is idempotent.
|
|
313
|
+
const accumulatedGlobal: Record<string, unknown> = {};
|
|
306
314
|
|
|
307
315
|
return scopeTrack
|
|
308
316
|
.map((scopeItem, i) => {
|
|
317
|
+
Object.assign(accumulatedGlobal, scopeItem.scope?.global);
|
|
309
318
|
return {
|
|
310
319
|
x: i,
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
param: scopeItem.scope?.global[this.convergenceParam],
|
|
314
|
-
// @ts-ignore
|
|
315
|
-
y: scopeItem.scope?.global[this.convergenceResult],
|
|
320
|
+
param: accumulatedGlobal[convergenceParam],
|
|
321
|
+
y: accumulatedGlobal[convergenceResult],
|
|
316
322
|
};
|
|
317
323
|
})
|
|
318
324
|
.filter(({ y }) => {
|