← All procedures

algebra.replay

This function replays a trace against a machine document, and it gives each disagreement: - Each instance starts in the state that its first transition leaves. - Each transition must leave the state where the replay of its instance is, and that state must be in the document. - The document must have a transition from that state, on that event, to that state. The state "*" is each state that is not final.

CLI
Package
@procedures/algebra · README
Path
["algebra","replay"]
CLI
mark algebra replay --doc <object> --transitions <object[]>
As data
{"$proc":["algebra","replay"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/algebra/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["algebra","replay"], { doc: {}, transitions: [] });
console.log(JSON.stringify(result));

From the command line

$ mark algebra replay --doc <object> --transitions <object[]>

As data, in a program

{
  "$proc": ["algebra", "replay"],
  "input": { "doc": {}, "transitions": [] }
}

Input

FieldTypeRequiredDefaultDescription
docobjectyes
transitionsobject[]yes
optionsobjectno

Output

The schema does not list fields (string[]).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "doc": {
        "type": "object",
        "properties": {
          "states": {
            "type": "object",
            "properties": {},
            "additionalProperties": {
              "type": "object",
              "properties": {
                "initial": {
                  "type": "boolean"
                },
                "final": {
                  "type": "boolean"
                },
                "pseudo": {
                  "type": "boolean"
                },
                "note": {
                  "type": "string"
                }
              },
              "additionalProperties": {}
            }
          },
          "id": {
            "type": "string"
          },
          "transitions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "from": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  ]
                },
                "to": {
                  "type": "string"
                },
                "on": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  ]
                },
                "guard": {
                  "type": "string"
                },
                "timer": {
                  "type": "string"
                },
                "emits": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "errno": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                },
                "source": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "from",
                "to",
                "on"
              ],
              "additionalProperties": {}
            }
          }
        },
        "required": [
          "states",
          "id",
          "transitions"
        ],
        "additionalProperties": {}
      },
      "transitions": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "machine": {
              "type": "string",
              "description": "This name identifies the machine that reported. Each program names its own machines."
            },
            "instance": {
              "type": "string",
              "description": "This name identifies one machine among others of its kind: a connection, a check."
            },
            "from": {
              "type": "string"
            },
            "on": {
              "type": "string"
            },
            "to": {
              "type": "string"
            },
            "at": {
              "type": "number",
              "description": "This time is when the transition occurred, in milliseconds. The replay does not read it."
            }
          },
          "required": [
            "instance",
            "from",
            "on",
            "to"
          ],
          "additionalProperties": {}
        }
      },
      "options": {
        "type": "object",
        "properties": {
          "machine": {
            "type": "string",
            "description": "Only the transitions of this machine replay. Without it, each transition of the trace replays."
          }
        },
        "additionalProperties": {}
      }
    },
    "required": [
      "doc",
      "transitions"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "array",
    "items": {
      "type": "string"
    }
  }
}