Docs

JavaScript: Version history

Read the project configuration at any point in time, preview and apply a restore, manage timelines and snapshots with @sovaria/sdk.

Updated Nov 11, 2026

Every change to policies, tables, functions, settings, buckets and keys is recorded on the project's timeline. These methods read it and take the project back. Background: Version history: see, undo and restore changes.

const at = '2026-10-15T09:00:00Z'
const plan = await sovaria.chrono.restorePlan(at)
console.log(plan.actions, plan.preview?.violations)
await sovaria.chrono.restore(at)

#sovaria.chrono

sovaria.chrono.state

The project's configuration (policies, schema, functions, settings, buckets, keys) at a commit or ISO time.

sovaria.chrono.state(
  query?: { at?: string; prefix?: string; timeline?: string } = {},
): Promise<JsonObject>

Parameters

query{ at?: string; prefix?: string; timeline?: string }optionaldefault {}
at (commit id or ISO time; default now), prefix (policies/, schema/, functions/, settings/, storage/, keys/), timeline (default main).

Returns

Promise<JsonObject>

{
  "timeline": "main",
  "commit": "9f3c2a71e4b85d06c1a7f2e9",
  "timestamp_ns": 1792227600123456800,
  "message": "policy pol_orders_read updated",
  "files": {
    "policies/pol_orders_read.spl": "ALLOW IF ctx.resource.name == \"orders\" AND ctx.actor.is_anonymous == False",
    "policies/pol_orders_read.json": "{\"name\": \"Signed-in users read orders\", \"active\": true, \"version\": 3}"
  },
  "truncated": false
}

sovaria.chrono.restorePlan

What going back to at on a branch changes, file by file, with who would gain or lose access.

sovaria.chrono.restorePlan(
  at: string,
  timeline?: string = 'main',
  options?: { envId?: string } = {},
): Promise<JsonObject>

Writes nothing. The branch decides the environment acted on (main = production); envId is the one you have checked out ('' = production) and a mismatch is refused (ENV_MISMATCH).

Parameters

atstringrequired
Commit id or ISO time.
timelinestringoptionaldefault 'main'
Timeline name.
options{ envId?: string }optionaldefault {}

Returns

Promise<JsonObject> — Each item that would change back, which are automatic and which manual, and who would gain or lose access. Writes nothing.

{
  "at": "41aa07d2c96e3b58f0e1d4a2",
  "actions": [
    {
      "type": "policy.restore",
      "path": "policies/pol_orders_read.spl",
      "policy_id": "pol_orders_read",
      "name": "Signed-in users read orders",
      "spl_source": "ALLOW IF ctx.resource.name == \"orders\"",
      "exists_now": true
    },
    {
      "type": "settings.restore",
      "path": "settings/project.json",
      "settings": {
        "allowPublicSignup": false
      }
    }
  ],
  "automated": 2,
  "manual": 0,
  "database": null,
  "preview": {
    "violations": [],
    "changes": []
  }
}

sovaria.chrono.restore

Go back to at on a branch: applies the plan's automated changes with the caller's own permissions, in that branch's own environment.

sovaria.chrono.restore(
  at: string,
  timeline?: string = 'main',
  options?: { includeDatabase?: boolean; includeSchema?: boolean; envId?: string } = {},
): Promise<JsonObject>

includeSchema also rolls back the migrations applied since then; includeDatabase also restores the database as of then (production: the closest backup; an environment: point-in-time). The answer has new_head, or recording: true while the new commits are still arriving.

Parameters

atstringrequired
Commit id or ISO time.
timelinestringoptionaldefault 'main'
Timeline name.
options{ includeDatabase?: boolean; includeSchema?: boolean; envId?: string }optionaldefault {}

Returns

Promise<JsonObject>

  • Runs with the caller's permissions; the restore itself becomes a new commit.
{
  "at": "41aa07d2c96e3b58f0e1d4a2",
  "results": [
    {
      "type": "policy.restore",
      "path": "policies/pol_orders_read.spl",
      "status": "applied",
      "http_status": 200,
      "detail": null
    }
  ],
  "applied": 1,
  "failed": 0,
  "manual": 0
}

sovaria.chrono.commit

Commit.

sovaria.chrono.commit(payload: JsonObject): Promise<JsonObject>

Parameters

payloadJsonObjectrequired

Returns

Promise<JsonObject>

{
  "hex_id": "9f3c2a71e4b85d06c1a7f2e9",
  "timeline": "main",
  "timestamp_ns": 1792310000000000000
}

sovaria.chrono.timelineSpawn

Timeline spawn.

sovaria.chrono.timelineSpawn(payload: JsonObject): Promise<JsonObject>

Parameters

payloadJsonObjectrequired

Returns

Promise<JsonObject>

{
  "timeline": "try-new-rules",
  "spawned_from_hex": "9f3c2a71e4b85d06c1a7f2e9",
  "created_at_ns": 1792310000000000000
}

sovaria.chrono.timelineList

Timeline list.

sovaria.chrono.timelineList(): Promise<JsonObject>

Returns

Promise<JsonObject>

{
  "timelines": [
    {
      "name": "main",
      "head_hex": "9f3c2a71e4b85d06c1a7f2e9",
      "chronon_count": 412
    },
    {
      "name": "try-new-rules",
      "head_hex": "c0de…",
      "chronon_count": 3
    }
  ]
}

sovaria.chrono.timelineDelete

Timeline delete.

sovaria.chrono.timelineDelete(name: string): Promise<JsonObject>

Parameters

namestringrequired

Returns

Promise<JsonObject>

{
  "deleted": true,
  "timeline": "try-new-rules"
}

sovaria.chrono.timelineJump

Timeline jump.

sovaria.chrono.timelineJump(
  name: string,
  targetHex: string,
): Promise<JsonObject>

Parameters

namestringrequired
targetHexstringrequired

Returns

Promise<JsonObject>

{
  "jumped": true,
  "previous_head": "9f3c2a71e4b85d06c1a7f2e9",
  "new_head": "41aa07d2c96e3b58f0e1d4a2"
}

sovaria.chrono.timelineHistory

Timeline history.

sovaria.chrono.timelineHistory(
  name: string,
  limit?: number = 50,
  offset?: number = 0,
): Promise<JsonObject>

Parameters

namestringrequired
limitnumberoptionaldefault 50
offsetnumberoptionaldefault 0

Returns

Promise<JsonObject>

{
  "timeline": "main",
  "chronons": [
    {
      "hex_id": "9f3c2a71e4b85d06c1a7f2e9",
      "short_hex": "9f3c2a71e4b8",
      "message": "policy pol_orders_read updated",
      "author": "ana@skolist.com",
      "timestamp_ns": 1792227600123456800,
      "parent_hex_ids": [
        "41aa07d2c96e3b58f0e1d4a2"
      ],
      "changed_domains": [
        "policies"
      ],
      "event_type": "policy.updated",
      "metadata": {
        "policy_id": "pol_orders_read"
      }
    }
  ]
}

sovaria.chrono.topology

Topology.

sovaria.chrono.topology(
  timeline?: string = 'main',
  limit?: number = 50,
): Promise<JsonObject>

Parameters

timelinestringoptionaldefault 'main'
limitnumberoptionaldefault 50

Returns

Promise<JsonObject>

{
  "nodes": [
    {
      "chronon_hex": "9f3c2a71e4b85d06c1a7f2e9",
      "message": "policy pol_orders_read updated",
      "parents": [
        "41aa07d2c96e3b58f0e1d4a2"
      ]
    }
  ],
  "edges": [
    {
      "from_node": "41aa07d2c96e3b58f0e1d4a2",
      "to_node": "9f3c2a71e4b85d06c1a7f2e9"
    }
  ]
}

sovaria.chrono.converge

Converge.

sovaria.chrono.converge(payload: JsonObject): Promise<JsonObject>

Parameters

payloadJsonObjectrequired

Returns

Promise<JsonObject>

{
  "strategy": "THREE_WAY_MERGE",
  "new_head_hex": "e5f1…",
  "conflict_count": 0
}

sovaria.chrono.variance

Variance.

sovaria.chrono.variance(payload: JsonObject): Promise<JsonObject>

Parameters

payloadJsonObjectrequired

Returns

Promise<JsonObject>

{
  "summary": {
    "insertions": 1,
    "deletions": 1,
    "unchanged": 0
  },
  "hunks": [
    {
      "domain": "policies",
      "name": "pol_orders_read.spl",
      "operations": [
        [
          "-",
          "ALLOW IF ctx.resource.name == \"orders\""
        ],
        [
          "+",
          "ALLOW IF ctx.resource.name == \"orders\" AND ctx.actor.is_anonymous == False"
        ]
      ]
    }
  ],
  "truncated": false,
  "truncation_reason": null,
  "processed_hunks": 1,
  "total_hunks": 1
}

sovaria.chrono.snapshotCreate

Snapshot create.

sovaria.chrono.snapshotCreate(payload: JsonObject): Promise<JsonObject>

Parameters

payloadJsonObjectrequired

Returns

Promise<JsonObject>

{
  "snapshot_id": 12,
  "base_chronon_hex": "9f3c2a71e4b85d06c1a7f2e9",
  "lock_time_us": 1840,
  "engine_pointers": {
    "guard": 412,
    "forge": 98
  },
  "created_at_ns": 1792310000000000000,
  "degraded": false
}

sovaria.chrono.snapshotList

Snapshot list.

sovaria.chrono.snapshotList(): Promise<JsonObject>

Returns

Promise<JsonObject>

{
  "snapshots": [
    {
      "snapshot_id": 12,
      "message": "before launch",
      "created_at_ns": 1792310000000000000,
      "base_chronon_hex": "9f3c2a71e4b85d06c1a7f2e9",
      "project_id": "f0c3e9a2-…",
      "author": "ana@skolist.com",
      "degraded": false,
      "engine_count": 6
    }
  ]
}

sovaria.chrono.snapshotRestore

Snapshot restore.

sovaria.chrono.snapshotRestore(snapshotId: number): Promise<JsonObject>

Parameters

snapshotIdnumberrequired

Returns

Promise<JsonObject>

{
  "restored": true,
  "snapshot_id": 12,
  "total_time_ms": 940,
  "engines_acked": [
    "guard",
    "forge"
  ],
  "engines_requested": [
    "guard",
    "forge"
  ],
  "restore_status": "full",
  "degraded": false
}