{
  "definitions": [
    {
      "callable": true,
      "callees": [],
      "callers": [
        {
          "file": "core/adapters/surface.adapter.ts",
          "name": "settled",
          "source": {
            "href": "https://banes-lab.com/anatomy/build-scripts#file-build-scripts-core-adapters-surface-adapter-ts",
            "json": "https://banes-lab.com/json/source/build-scripts/core/adapters/surface.adapter.ts",
            "label": "core/adapters/surface.adapter.ts",
            "markdown": "https://banes-lab.com/source/build-scripts/core/adapters/surface.adapter.ts.md",
            "ref": "anatomy:file-build-scripts-core-adapters-surface-adapter-ts"
          }
        }
      ],
      "exported": false,
      "flow": "leaf",
      "kind": "lexical_declaration",
      "line": 28,
      "name": "pause",
      "signature": "const pause = async function pause(ms: number): Promise<void> {"
    },
    {
      "callable": true,
      "callees": [
        {
          "file": "configuration/strings/surface.strings.ts",
          "name": "stepFailed",
          "source": {
            "href": "https://banes-lab.com/anatomy/build-scripts#file-build-scripts-configuration-strings-surface-strings-ts",
            "json": "https://banes-lab.com/json/source/build-scripts/configuration/strings/surface.strings.ts",
            "label": "configuration/strings/surface.strings.ts",
            "markdown": "https://banes-lab.com/source/build-scripts/configuration/strings/surface.strings.ts.md",
            "ref": "anatomy:file-build-scripts-configuration-strings-surface-strings-ts"
          }
        },
        {
          "file": "configuration/strings/surface.strings.ts",
          "name": "waitUnresolved",
          "source": {
            "href": "https://banes-lab.com/anatomy/build-scripts#file-build-scripts-configuration-strings-surface-strings-ts",
            "json": "https://banes-lab.com/json/source/build-scripts/configuration/strings/surface.strings.ts",
            "label": "configuration/strings/surface.strings.ts",
            "markdown": "https://banes-lab.com/source/build-scripts/configuration/strings/surface.strings.ts.md",
            "ref": "anatomy:file-build-scripts-configuration-strings-surface-strings-ts"
          }
        }
      ],
      "callers": [],
      "exported": true,
      "flow": "entry",
      "kind": "method_definition",
      "line": 131,
      "name": "runWait",
      "signature": "private async runWait(step: WaitStep, writer: ScenarioStep | undefined): Promise<void> {"
    },
    {
      "callable": true,
      "callees": [
        {
          "file": "configuration/strings/surface.strings.ts",
          "name": "venueMissing",
          "source": {
            "href": "https://banes-lab.com/anatomy/build-scripts#file-build-scripts-configuration-strings-surface-strings-ts",
            "json": "https://banes-lab.com/json/source/build-scripts/configuration/strings/surface.strings.ts",
            "label": "configuration/strings/surface.strings.ts",
            "markdown": "https://banes-lab.com/source/build-scripts/configuration/strings/surface.strings.ts.md",
            "ref": "anatomy:file-build-scripts-configuration-strings-surface-strings-ts"
          }
        },
        {
          "file": "core/converters/surface.converter.ts",
          "name": "appendLine",
          "source": {
            "href": "https://banes-lab.com/anatomy/build-scripts#file-build-scripts-core-converters-surface-converter-ts",
            "json": "https://banes-lab.com/json/source/build-scripts/core/converters/surface.converter.ts",
            "label": "core/converters/surface.converter.ts",
            "markdown": "https://banes-lab.com/source/build-scripts/core/converters/surface.converter.ts.md",
            "ref": "anatomy:file-build-scripts-core-converters-surface-converter-ts"
          }
        }
      ],
      "callers": [],
      "exported": true,
      "flow": "entry",
      "kind": "method_definition",
      "line": 164,
      "name": "runWrite",
      "signature": "private runWrite(text: string, figures: readonly SurfaceFigureName[]): void {"
    },
    {
      "callable": true,
      "callees": [
        {
          "file": "core/adapters/surface.adapter.ts",
          "name": "pause",
          "source": {
            "href": "https://banes-lab.com/anatomy/build-scripts#file-build-scripts-core-adapters-surface-adapter-ts",
            "json": "https://banes-lab.com/json/source/build-scripts/core/adapters/surface.adapter.ts",
            "label": "core/adapters/surface.adapter.ts",
            "markdown": "https://banes-lab.com/source/build-scripts/core/adapters/surface.adapter.ts.md",
            "ref": "anatomy:file-build-scripts-core-adapters-surface-adapter-ts"
          }
        }
      ],
      "callers": [],
      "exported": false,
      "flow": "entry",
      "kind": "lexical_declaration",
      "line": 34,
      "name": "settled",
      "signature": "const settled = async function settled("
    },
    {
      "callable": true,
      "callees": [
        {
          "file": "core/converters/surface.converter.ts",
          "name": "venueView",
          "source": {
            "href": "https://banes-lab.com/anatomy/build-scripts#file-build-scripts-core-converters-surface-converter-ts",
            "json": "https://banes-lab.com/json/source/build-scripts/core/converters/surface.converter.ts",
            "label": "core/converters/surface.converter.ts",
            "markdown": "https://banes-lab.com/source/build-scripts/core/converters/surface.converter.ts.md",
            "ref": "anatomy:file-build-scripts-core-converters-surface-converter-ts"
          }
        }
      ],
      "callers": [],
      "exported": true,
      "flow": "entry",
      "kind": "method_definition",
      "line": 94,
      "name": "venueLines",
      "signature": "private venueLines(): string[] {"
    },
    {
      "callable": true,
      "callees": [
        {
          "file": "configuration/strings/surface.strings.ts",
          "name": "stepFailed",
          "source": {
            "href": "https://banes-lab.com/anatomy/build-scripts#file-build-scripts-configuration-strings-surface-strings-ts",
            "json": "https://banes-lab.com/json/source/build-scripts/configuration/strings/surface.strings.ts",
            "label": "configuration/strings/surface.strings.ts",
            "markdown": "https://banes-lab.com/source/build-scripts/configuration/strings/surface.strings.ts.md",
            "ref": "anatomy:file-build-scripts-configuration-strings-surface-strings-ts"
          }
        }
      ],
      "callers": [],
      "exported": true,
      "flow": "entry",
      "kind": "method_definition",
      "line": 110,
      "name": "runTool",
      "signature": "private runTool(step: ToolStep): void {"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 17,
      "name": "UTF8",
      "signature": "const UTF8 = \"utf8\";"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 19,
      "name": "LINE_BREAK",
      "signature": "const LINE_BREAK = \"\\n\";"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "interface_declaration",
      "line": 21,
      "name": "Shown",
      "signature": "interface Shown {"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 41,
      "name": "now",
      "signature": "const now = read();"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 42,
      "name": "quiet",
      "signature": "const quiet = now.length > 0 && now === since ? quietFor + WAIT_POLL_MS : 0;"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 46,
      "name": "exitWithin",
      "signature": "const exitWithin = async function exitWithin(closed: Promise<number>, limit: number): Promise<number | null> {"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": false,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 47,
      "name": "expired",
      "signature": "const expired = pause(limit).then((): number | null => null);"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "class_declaration",
      "line": 51,
      "name": "ScenarioPlayer",
      "signature": "export class ScenarioPlayer {"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "public_field_definition",
      "line": 52,
      "name": "install",
      "signature": "private readonly install: string;"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "public_field_definition",
      "line": 53,
      "name": "scripts",
      "signature": "private readonly scripts: ReadonlyMap<ScenarioTool, string>;"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "public_field_definition",
      "line": 54,
      "name": "frames",
      "signature": "private readonly frames: FigureFrame[] = [];"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "public_field_definition",
      "line": 55,
      "name": "venue",
      "signature": "private venue: string | null = null;"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "public_field_definition",
      "line": 56,
      "name": "lastRegion",
      "signature": "private lastRegion: Region | null = null;"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "method_definition",
      "line": 58,
      "name": "constructor",
      "signature": "public constructor(install: string, scripts: ReadonlyMap<ScenarioTool, string>) {"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "method_definition",
      "line": 63,
      "name": "play",
      "signature": "public async play(): Promise<readonly FigureFrame[]> {"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "method_definition",
      "line": 68,
      "name": "playFrom",
      "signature": "private async playFrom(index: number): Promise<void> {"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 69,
      "name": "step",
      "signature": "const step = SCENARIO.steps.at(index);"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 73,
      "name": "taken",
      "signature": "const taken = await this.take(step, SCENARIO.steps.at(index + 1));"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "method_definition",
      "line": 77,
      "name": "take",
      "signature": "private async take(step: ScenarioStep, next: ScenarioStep | undefined): Promise<number> {"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "method_definition",
      "line": 90,
      "name": "resolved",
      "signature": "private resolved(args: readonly string[]): string[] {"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "method_definition",
      "line": 100,
      "name": "discoverVenue",
      "signature": "private discoverVenue(): void {"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "method_definition",
      "line": 104,
      "name": "show",
      "signature": "private show(figures: readonly SurfaceFigureName[], shown: Shown): void {"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 105,
      "name": "lines",
      "signature": "const lines = markedLines(this.venueLines(), shown.highlight);"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 106,
      "name": "frame",
      "signature": "const frame = { command: shown.command, lines, output: shown.output, surface: this.venue ?? \"\" };"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 114,
      "name": "result",
      "signature": "const result = spawnSync(process.execPath, [this.scripts.get(step.tool) ?? \"\", ...args], {"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 126,
      "name": "delivered",
      "signature": "const delivered = step.delivers ? this.lastRegion : null;"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 132,
      "name": "args",
      "signature": "const args = this.resolved(step.args);"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 133,
      "name": "command",
      "signature": "const command = commandLine(\"await\", args);"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 134,
      "name": "child",
      "signature": "const child = spawn(process.execPath, [this.scripts.get(\"await\") ?? \"\", ...args], { cwd: this.install });"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 135,
      "name": "output",
      "signature": "let output = \"\";"
    },
    {
      "callable": true,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 136,
      "name": "collect",
      "signature": "const collect = (chunk: string): void => {"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 141,
      "name": "closed",
      "signature": "const closed = new Promise<number>((done) => {"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 147,
      "name": "parked",
      "signature": "const parked = await settled(() => output, \"\", 0, WAIT_LIMIT_MS);"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 153,
      "name": "code",
      "signature": "const code = await exitWithin(closed, WAIT_LIMIT_MS);"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 168,
      "name": "before",
      "signature": "const before = this.venueLines();"
    },
    {
      "callable": false,
      "callees": [],
      "callers": [],
      "exported": true,
      "flow": "isolated",
      "kind": "lexical_declaration",
      "line": 170,
      "name": "own",
      "signature": "const own = changedRegion(before, this.venueLines());"
    }
  ],
  "document": null,
  "findings": [],
  "generated": false,
  "href": "https://banes-lab.com/anatomy/build-scripts#file-build-scripts-core-adapters-surface-adapter-ts",
  "language": "typescript",
  "layer": "infrastructure",
  "name": "surface.adapter.ts",
  "path": "core/adapters/surface.adapter.ts",
  "ref": "anatomy:file-build-scripts-core-adapters-surface-adapter-ts",
  "relations": [
    {
      "links": [
        {
          "href": "https://banes-lab.com/anatomy/build-scripts#folder-build-scripts-core-adapters",
          "json": "https://banes-lab.com/json/anatomy/build-scripts/folder-build-scripts-core-adapters",
          "label": "core/adapters",
          "markdown": "https://banes-lab.com/anatomy/build-scripts/folder-build-scripts-core-adapters.md",
          "ref": "chapter:/anatomy/build-scripts#folder-build-scripts-core-adapters"
        }
      ],
      "relation": "contained-in"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/anatomy/build-scripts#file-build-scripts-configuration-strings-surface-strings-ts",
          "json": "https://banes-lab.com/json/source/build-scripts/configuration/strings/surface.strings.ts",
          "label": "configuration/strings/surface.strings.ts",
          "markdown": "https://banes-lab.com/source/build-scripts/configuration/strings/surface.strings.ts.md",
          "ref": "anatomy:file-build-scripts-configuration-strings-surface-strings-ts"
        },
        {
          "href": "https://banes-lab.com/anatomy/build-scripts#file-build-scripts-core-converters-surface-converter-ts",
          "json": "https://banes-lab.com/json/source/build-scripts/core/converters/surface.converter.ts",
          "label": "core/converters/surface.converter.ts",
          "markdown": "https://banes-lab.com/source/build-scripts/core/converters/surface.converter.ts.md",
          "ref": "anatomy:file-build-scripts-core-converters-surface-converter-ts"
        }
      ],
      "relation": "uses"
    },
    {
      "links": [
        {
          "href": "https://banes-lab.com/anatomy/build-scripts#folder-build-scripts-configuration-strings",
          "json": "https://banes-lab.com/json/anatomy/build-scripts/folder-build-scripts-configuration-strings",
          "label": "configuration/strings",
          "markdown": "https://banes-lab.com/anatomy/build-scripts/folder-build-scripts-configuration-strings.md",
          "ref": "chapter:/anatomy/build-scripts#folder-build-scripts-configuration-strings"
        },
        {
          "href": "https://banes-lab.com/anatomy/build-scripts#folder-build-scripts-core-adapters",
          "json": "https://banes-lab.com/json/anatomy/build-scripts/folder-build-scripts-core-adapters",
          "label": "core/adapters",
          "markdown": "https://banes-lab.com/anatomy/build-scripts/folder-build-scripts-core-adapters.md",
          "ref": "chapter:/anatomy/build-scripts#folder-build-scripts-core-adapters"
        },
        {
          "href": "https://banes-lab.com/anatomy/build-scripts#folder-build-scripts-core-converters",
          "json": "https://banes-lab.com/json/anatomy/build-scripts/folder-build-scripts-core-converters",
          "label": "core/converters",
          "markdown": "https://banes-lab.com/anatomy/build-scripts/folder-build-scripts-core-converters.md",
          "ref": "chapter:/anatomy/build-scripts#folder-build-scripts-core-converters"
        }
      ],
      "relation": "linked-from"
    }
  ],
  "slots": {
    "concern": "adapter",
    "subject": "surface",
    "variant": null
  },
  "stats": {
    "bytes": 6715,
    "callable": 15,
    "definitions": 42,
    "edges": 7,
    "exported": 33,
    "files": 1,
    "findings": {},
    "flows": {
      "leaf": 1,
      "entry": 5,
      "isolated": 36
    },
    "lines": {
      "blank": 20,
      "code": 154,
      "total": 174
    }
  },
  "summary": "154 lines of code and 42 definitions.",
  "text": "https://banes-lab.com/source/build-scripts/core/adapters/surface.adapter.ts.txt",
  "tree": "build-scripts",
  "siblings": {
    "next": null,
    "previous": {
      "href": "https://banes-lab.com/anatomy/build-scripts#file-build-scripts-core-adapters-server-adapter-ts",
      "json": "https://banes-lab.com/json/source/build-scripts/core/adapters/server.adapter.ts",
      "label": "core/adapters/server.adapter.ts",
      "markdown": "https://banes-lab.com/source/build-scripts/core/adapters/server.adapter.ts.md",
      "ref": "anatomy:file-build-scripts-core-adapters-server-adapter-ts"
    }
  },
  "up": {
    "href": null,
    "json": "https://banes-lab.com/json/api/source/build-scripts/core/adapters",
    "label": "core/adapters",
    "markdown": "https://banes-lab.com/api/source/build-scripts/core/adapters.md",
    "ref": "api:source/build-scripts/core/adapters"
  }
}
