@mark1russell7/service 0.3.0 → 0.4.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/build/index.js CHANGED
@@ -1,7 +1,10 @@
1
- import { i as recoverSpan, n as asWindow, r as failSpan, t as asDebounce } from "./timing-DxZ4nkQg.js";
2
- import { n as mayReissue, r as operationProblems, t as realClock } from "./clock-DlJFFZlX.js";
1
+ import { platformClock, realClock } from "./clock.js";
2
+ import { detectionTime, heartbeat } from "./heartbeat.js";
3
+ import { a as recoverSpan, i as heartbeatDetection, n as asWindow, r as failSpan, t as asDebounce } from "./timing-DGRi3XCI.js";
4
+ import { n as operationProblems, t as mayReissue } from "./operation-DL5RxFds.js";
5
+ import { backoffBand, backoffDelay, backoffProblems } from "./backoff.js";
3
6
  import { convertExact, convertible, quantity, rationals, valueIn } from "@mark1russell7/quantity";
4
- import { arr, fromStates } from "@mark1russell7/algebra";
7
+ import { replay } from "@mark1russell7/algebra/replay";
5
8
  //#region src/description.ts
6
9
  /**
7
10
  * This is the format of a service as data: what `describe()` exports, and nothing starts. The
@@ -1453,7 +1456,8 @@ const lint = (svc, scenario, rules) => {
1453
1456
  /**
1454
1457
  * The machines of the runtime as `mark1russell7.machine/1` documents. The documents are the
1455
1458
  * specification, and TypeScript implements them. A test records the transitions of the runtime
1456
- * and replays them against each document, thus the code and the documents cannot disagree.
1459
+ * and replays them against each document (`replay` of `@mark1russell7/algebra`), thus the code and
1460
+ * the documents cannot disagree.
1457
1461
  */
1458
1462
  const SOURCE = [{
1459
1463
  ref: "packages/service/src (the runtime implements this document)",
@@ -1880,25 +1884,7 @@ const MACHINES = {
1880
1884
  exit: EXIT_MACHINE,
1881
1885
  watchdog: WATCHDOG_MACHINE
1882
1886
  };
1883
- /**
1884
- * This function replays the transitions of one machine of the runtime against its document. Each
1885
- * instance starts in the state that its first transition leaves. Each transition must leave the
1886
- * state where the replay is. The document must have a transition from that state, on that event,
1887
- * to that state. The function gives each disagreement.
1888
- */
1889
- const replay = (doc, events) => {
1890
- const problems = [];
1891
- const at = /* @__PURE__ */ new Map();
1892
- for (const event of events) {
1893
- const where = at.get(event.instance) ?? event.from;
1894
- if (doc.states[where] === void 0) problems.push(`${event.instance}: the state ${where} is not in ${doc.id}`);
1895
- if (event.from !== where) problems.push(`${event.instance}: the runtime left ${event.from} on ${event.on}, but the replay is in ${where}`);
1896
- if (!doc.transitions.some((each) => fromStates(doc, each.from).includes(event.from) && arr(each.on).includes(event.on) && each.to === event.to)) problems.push(`${event.instance}: ${doc.id} has no transition from ${event.from} on ${event.on} to ${event.to}`);
1897
- at.set(event.instance, event.to);
1898
- }
1899
- return problems;
1900
- };
1901
1887
  //#endregion
1902
- export { EXIT_MACHINE, EXIT_SIGNALS, FORMAT, GATE_MACHINE, LATCH_MACHINE, MACHINES, POLLER_MACHINE, SERVICE_RULES, STAGES, WATCHDOG_MACHINE, WINDOW_MACHINE, asDebounce, asWindow, capKnob, cooperativeAbortAt, drainMachine, evaluate, failSpan, inequalities, lint, mayReissue, nodeProcess, realClock, recoverSpan, replay, service, serviceBindings, stageRank, symbolsOf, verdictOf, watchdog };
1888
+ export { EXIT_MACHINE, EXIT_SIGNALS, FORMAT, GATE_MACHINE, LATCH_MACHINE, MACHINES, POLLER_MACHINE, SERVICE_RULES, STAGES, WATCHDOG_MACHINE, WINDOW_MACHINE, asDebounce, asWindow, backoffBand, backoffDelay, backoffProblems, capKnob, cooperativeAbortAt, detectionTime, drainMachine, evaluate, failSpan, heartbeat, heartbeatDetection, inequalities, lint, mayReissue, nodeProcess, platformClock, realClock, recoverSpan, replay, service, serviceBindings, stageRank, symbolsOf, verdictOf, watchdog };
1903
1889
 
1904
1890
  //# sourceMappingURL=index.js.map