Bring back something deleted
Restore a deleted record: nothing is purged, so every deleted Thing comes back with its history and its links.
Nothing is purged. A deleted Thing leaves every list and keeps its history, and restore brings it back with its Relationships intact.
What you get
- 1record back in every list and search it left, with its history and links intactThing
- 1entry in its history saying who restored it and whenEvent
Your agent does
You, to your agent
Bring back the lease I deleted.
Restore the page the agent deleted.
I deleted that by mistake, get it back.
# Look up the Thing: Thing.list
THING= $(curl "https: //api.sb/ leaseline.app/ things? where= deleted%20%3D%20true& limit= 1" \
-H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" | jq -r '.things[0]["$id"] | split("/ ") | last')
# Thing.restore
curl -X POST https: //api.sb/ leaseline.app/ things/ $THING/ restore \
-H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
import { $ } from 'startup-builder'
const [thing] = await $.Thing.list({ where: 'deleted = true', limit: 1 })
await $.Thing.restore({ thing: thing.$id })
THING= $(npx startup-builder do Thing.list --json '{"where": "deleted = true", "limit": 1}' | jq -r '.things[0]["$id"] | split("/ ") | last')
npx startup-builder do Thing.restore --json '{"thing": "'"$THING"'"}'
{
"name": "do",
"arguments": {
"code": "const [thing] = await $.Thing.list({ where: 'deleted = true', limit: 1 })\nreturn await $.Thing.restore({ thing: thing.$id })"
}
}
Change it
- Restore everything deleted yesterday.
- Undo what the agent just did instead.
- Show me the history of the restored lease.
Under the hood
- Systems
- Work queue
- Nouns
- Thing, Event
- Events
Thing.restored