libpetri 2.1.0 → 2.3.1
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/debug/index.d.ts +2 -2
- package/dist/doclet/index.d.ts +1 -1
- package/dist/doclet/resources/petrinet-diagrams.css +7 -0
- package/dist/doclet/resources/petrinet-diagrams.js +28 -26
- package/dist/{event-store-2zkXeQkd.d.ts → event-store-I3QiQABh.d.ts} +1 -1
- package/dist/export/index.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +66 -0
- package/dist/index.js.map +1 -1
- package/dist/{petri-net-BDrj4XZE.d.ts → petri-net-CKZYPOsL.d.ts} +30 -0
- package/dist/{chunk-RNWTYK5B.js → render-UY4OKXXQ.js} +65 -6
- package/dist/render-UY4OKXXQ.js.map +1 -0
- package/dist/verification/index.d.ts +2 -2
- package/dist/viewer/index.d.ts +38 -14
- package/dist/viewer/index.js +73 -15
- package/dist/viewer/index.js.map +1 -1
- package/dist/viewer/viewer.css +7 -0
- package/dist/viewer/viewer.iife.js +28 -26
- package/package.json +1 -7
- package/dist/chunk-RNWTYK5B.js.map +0 -1
- package/dist/render-QK57X4TP.js +0 -73
- package/dist/render-QK57X4TP.js.map +0 -1
- package/dist/viewer/layout/index.d.ts +0 -200
- package/dist/viewer/layout/index.js +0 -15
- package/dist/viewer/layout/index.js.map +0 -1
- package/dist/viewer/viewer-static.iife.js +0 -3
package/dist/export/index.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { P as PetriNet, S as SubnetDef, a as Place, T as Token, b as Transition, E as EnvironmentPlace, c as TransitionContext, O as Out } from './petri-net-
|
|
2
|
-
export { A as Arc, d as ArcInhibitor, e as ArcInput, f as ArcOutput, g as ArcRead, h as ArcReset, C as Channel, i as ComposeBindings, F as FusionSet, j as FusionSetBuilder, I as In, k as InAll, l as InAtLeast, m as InExactly, n as InOne, o as Instance, p as Interface, q as InterfaceBuilder, L as LogFn, M as MAX_DURATION_MS, r as OutAnd, s as OutForwardInput, t as OutPlace, u as OutTimeout, v as OutXor, w as OutputEntry, x as PetriNetBuilder, y as Port, z as PortDirection, B as SubnetDefBuilder, D as SubnetInstance, G as Timing, H as TimingDeadline, J as TimingDelayed, K as TimingExact, N as TimingImmediate, Q as TimingWindow, R as TokenInput, U as TokenOutput, V as TransitionAction, W as TransitionBuilder, X as VerificationHarness, Y as VerificationResult, Z as all, _ as allPlaces, $ as and, a0 as andPlaces, a1 as arcPlace, a2 as atLeast, a3 as consumptionCount, a4 as deadline, a5 as delayed, a6 as earliest, a7 as enumerateBranches, a8 as environmentPlace, a9 as exact, aa as exactly, ab as fork, ac as forwardInput, ad as hasDeadline, ae as hasGuard, af as immediate, ag as inhibitorArc, ah as inputArc, ai as isUnit, aj as latest, ak as matchesGuard, al as one, am as outPlace, an as outputArc, ao as passthrough, ap as place, aq as produce, ar as readArc, as as requiredCount, at as resetArc, au as timeout, av as timeoutPlace, aw as tokenAt, ax as tokenOf, ay as transform, az as transformAsync, aA as transformFrom, aB as unitToken, aC as window, aD as withTimeout, aE as xor, aF as xorPlaces } from './petri-net-
|
|
3
|
-
import { E as EventStore } from './event-store-
|
|
4
|
-
export { A as ActionTimedOut, a as ExecutionCompleted, b as ExecutionStarted, I as InMemoryEventStore, L as LogMessage, M as MarkingSnapshot, N as NetEvent, T as TokenAdded, c as TokenRemoved, d as TransitionClockRestarted, e as TransitionCompleted, f as TransitionEnabled, g as TransitionFailed, h as TransitionStarted, i as TransitionTimedOut, j as eventTransitionName, k as eventsOfType, l as failures, m as filterEvents, n as inMemoryEventStore, o as isFailureEvent, p as noopEventStore, t as transitionEvents } from './event-store-
|
|
1
|
+
import { P as PetriNet, S as SubnetDef, a as Place, T as Token, b as Transition, E as EnvironmentPlace, c as TransitionContext, O as Out } from './petri-net-CKZYPOsL.js';
|
|
2
|
+
export { A as Arc, d as ArcInhibitor, e as ArcInput, f as ArcOutput, g as ArcRead, h as ArcReset, C as Channel, i as ComposeBindings, F as FusionSet, j as FusionSetBuilder, I as In, k as InAll, l as InAtLeast, m as InExactly, n as InOne, o as Instance, p as Interface, q as InterfaceBuilder, L as LogFn, M as MAX_DURATION_MS, r as OutAnd, s as OutForwardInput, t as OutPlace, u as OutTimeout, v as OutXor, w as OutputEntry, x as PetriNetBuilder, y as Port, z as PortDirection, B as SubnetDefBuilder, D as SubnetInstance, G as Timing, H as TimingDeadline, J as TimingDelayed, K as TimingExact, N as TimingImmediate, Q as TimingWindow, R as TokenInput, U as TokenOutput, V as TransitionAction, W as TransitionBuilder, X as VerificationHarness, Y as VerificationResult, Z as all, _ as allPlaces, $ as and, a0 as andPlaces, a1 as arcPlace, a2 as atLeast, a3 as consumptionCount, a4 as deadline, a5 as delayed, a6 as earliest, a7 as enumerateBranches, a8 as environmentPlace, a9 as exact, aa as exactly, ab as fork, ac as forwardInput, ad as hasDeadline, ae as hasGuard, af as immediate, ag as inhibitorArc, ah as inputArc, ai as isUnit, aj as latest, ak as matchesGuard, al as one, am as outPlace, an as outputArc, ao as passthrough, ap as place, aq as produce, ar as readArc, as as requiredCount, at as resetArc, au as timeout, av as timeoutPlace, aw as tokenAt, ax as tokenOf, ay as transform, az as transformAsync, aA as transformFrom, aB as unitToken, aC as window, aD as withTimeout, aE as xor, aF as xorPlaces } from './petri-net-CKZYPOsL.js';
|
|
3
|
+
import { E as EventStore } from './event-store-I3QiQABh.js';
|
|
4
|
+
export { A as ActionTimedOut, a as ExecutionCompleted, b as ExecutionStarted, I as InMemoryEventStore, L as LogMessage, M as MarkingSnapshot, N as NetEvent, T as TokenAdded, c as TokenRemoved, d as TransitionClockRestarted, e as TransitionCompleted, f as TransitionEnabled, g as TransitionFailed, h as TransitionStarted, i as TransitionTimedOut, j as eventTransitionName, k as eventsOfType, l as failures, m as filterEvents, n as inMemoryEventStore, o as isFailureEvent, p as noopEventStore, t as transitionEvents } from './event-store-I3QiQABh.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Discriminated sum-type abstraction over Petri nets, distinguishing **closed**
|
package/dist/index.js
CHANGED
|
@@ -1138,6 +1138,9 @@ var PetriNetBuilder = class {
|
|
|
1138
1138
|
return this;
|
|
1139
1139
|
}
|
|
1140
1140
|
compose(instance, arg) {
|
|
1141
|
+
if (arg === void 0) {
|
|
1142
|
+
return this.composeAuto(instance);
|
|
1143
|
+
}
|
|
1141
1144
|
if (typeof arg === "function") {
|
|
1142
1145
|
const bindings = __createComposeBindings();
|
|
1143
1146
|
arg(bindings);
|
|
@@ -1146,6 +1149,56 @@ var PetriNetBuilder = class {
|
|
|
1146
1149
|
const portMappings = arg instanceof Map ? arg : new Map(Object.entries(arg));
|
|
1147
1150
|
return this.composeInternal(instance, portMappings, /* @__PURE__ */ new Map());
|
|
1148
1151
|
}
|
|
1152
|
+
/**
|
|
1153
|
+
* Identity-default auto-compose per **MOD-024**.
|
|
1154
|
+
*
|
|
1155
|
+
* Each declared interface port auto-binds to its own `port.place` — the
|
|
1156
|
+
* Place the SubnetDef builder declared via `.inputPort(name, hostPlace)`
|
|
1157
|
+
* (or `outputPort` / `inoutPort`). If the host builder already declares
|
|
1158
|
+
* the equal place, the two merge; if not, the place arrives implicitly
|
|
1159
|
+
* via the rewritten transitions' arcs (same flow as explicit `bindPort`).
|
|
1160
|
+
*
|
|
1161
|
+
* If the subnet declares no interface ports at all, body places are
|
|
1162
|
+
* checked against this builder's place set **by name** (matching the
|
|
1163
|
+
* existing TS Place equality semantics; see [CORE-002] note in
|
|
1164
|
+
* `spec/11-modular-composition.md` MOD-024). Body places that don't match
|
|
1165
|
+
* stay private under their prefixed names per [MOD-010].
|
|
1166
|
+
*
|
|
1167
|
+
* Channels are NOT auto-bound — transition identity is too delicate for
|
|
1168
|
+
* inference. If the subnet declares any channel, this overload throws.
|
|
1169
|
+
*/
|
|
1170
|
+
composeAuto(instance) {
|
|
1171
|
+
const iface = instance.def.iface;
|
|
1172
|
+
if (iface.channels.size > 0) {
|
|
1173
|
+
const channelNames = [];
|
|
1174
|
+
for (const c of iface.channels.values()) channelNames.push(c.name);
|
|
1175
|
+
channelNames.sort();
|
|
1176
|
+
throw new Error(
|
|
1177
|
+
`compose(Instance): subnet '${instance.def.name}' (instance prefix '${instance.prefix}') declares channels [${channelNames.join(", ")}]; auto-compose does not bind channels. Use compose(instance, bind => bind.bindChannel(...)) with explicit channel bindings.`
|
|
1178
|
+
);
|
|
1179
|
+
}
|
|
1180
|
+
const hostByName = /* @__PURE__ */ new Map();
|
|
1181
|
+
for (const p of this._places) hostByName.set(p.name, p);
|
|
1182
|
+
if (iface.ports.size > 0) {
|
|
1183
|
+
const portMappings = /* @__PURE__ */ new Map();
|
|
1184
|
+
for (const port of iface.ports.values()) {
|
|
1185
|
+
const hostMatch = hostByName.get(port.place.name);
|
|
1186
|
+
portMappings.set(port.name, hostMatch ?? port.place);
|
|
1187
|
+
}
|
|
1188
|
+
return this.composeInternal(instance, portMappings, /* @__PURE__ */ new Map());
|
|
1189
|
+
}
|
|
1190
|
+
const mergeMap = /* @__PURE__ */ new Map();
|
|
1191
|
+
const prefix = instance.prefix + "/";
|
|
1192
|
+
for (const renamed of instance.renamedBody.places) {
|
|
1193
|
+
if (!renamed.name.startsWith(prefix)) continue;
|
|
1194
|
+
const originalName = renamed.name.substring(prefix.length);
|
|
1195
|
+
const hostMatch = hostByName.get(originalName);
|
|
1196
|
+
if (hostMatch !== void 0) {
|
|
1197
|
+
mergeMap.set(renamed.name, hostMatch);
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
return this.applyComposition(instance, mergeMap, /* @__PURE__ */ new Map());
|
|
1201
|
+
}
|
|
1149
1202
|
/**
|
|
1150
1203
|
* @internal Shared compose implementation: validates port and channel
|
|
1151
1204
|
* bindings, builds the place-substitution map, walks every renamed-body
|
|
@@ -1194,6 +1247,19 @@ var PetriNetBuilder = class {
|
|
|
1194
1247
|
const ifacePlace = instance.port(portName);
|
|
1195
1248
|
mergeMap.set(ifacePlace.name, callerPlace);
|
|
1196
1249
|
}
|
|
1250
|
+
return this.applyComposition(instance, mergeMap, channelBindings);
|
|
1251
|
+
}
|
|
1252
|
+
/**
|
|
1253
|
+
* Shared post-mergeMap pipeline: rewrites renamed-body transitions
|
|
1254
|
+
* through `mergeMap`, applies channel merges per **MOD-021**, and adds
|
|
1255
|
+
* the surviving transitions to the builder.
|
|
1256
|
+
*
|
|
1257
|
+
* Used by both the explicit-binding path (`composeInternal`) and the
|
|
1258
|
+
* auto-compose path (`composeAuto` per **MOD-024**). The two paths differ
|
|
1259
|
+
* only in how the (renamed Place name → host Place) `mergeMap` is built.
|
|
1260
|
+
*/
|
|
1261
|
+
applyComposition(instance, mergeMap, channelBindings) {
|
|
1262
|
+
const iface = instance.def.iface;
|
|
1197
1263
|
const rewrittenByName = /* @__PURE__ */ new Map();
|
|
1198
1264
|
for (const t of instance.renamedBody.transitions) {
|
|
1199
1265
|
rewrittenByName.set(t.name, substitutePlaces(t, mergeMap));
|