Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/snapshot"; // registers its procedures
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["snapshot","restore"], { id: "<id>", bucket: "<bucket>", targetPath: "<targetPath>" });
console.log(JSON.stringify(result));From the command line
$ mark snapshot restore --id <string> --bucket <string> --targetPath <string>
As data, in a program
{
"$proc": ["snapshot", "restore"],
"input": {
"id": "<id>",
"bucket": "<bucket>",
"targetPath": "<targetPath>"
}
}JSON Schemas
{
"input": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Snapshot ID to restore"
},
"bucket": {
"type": "string",
"description": "S3 bucket containing snapshot"
},
"targetPath": {
"type": "string",
"description": "Destination directory the snapshot is extracted into. Required: restore must never fall back to a temporary scratch directory, because that scratch directory is deleted on cleanup and would wipe the restored files."
},
"overwrite": {
"default": false,
"description": "Overwrite existing files (default: false)",
"type": "boolean"
}
},
"required": [
"id",
"bucket",
"targetPath"
]
},
"output": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "True when the restore succeeded"
},
"metadata": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The snapshot id"
},
"name": {
"description": "The name of the snapshot",
"type": "string"
},
"preset": {
"description": "The preset: light, medium or heavy",
"type": "string"
},
"createdAt": {
"description": "The time of the snapshot (ISO 8601)",
"type": "string"
},
"environment": {
"description": "The environment of the snapshot",
"type": "object",
"properties": {
"os": {
"description": "The operating system",
"type": "string"
},
"nodeVersion": {
"description": "The Node.js version",
"type": "string"
},
"pnpmVersion": {
"description": "The pnpm version",
"type": "string"
},
"username": {
"description": "The user who made the snapshot",
"type": "string"
},
"hostname": {
"description": "The host name",
"type": "string"
}
},
"additionalProperties": {}
},
"repositories": {
"description": "The repositories in the snapshot",
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"description": "The repository folder, relative to the snapshot root",
"type": "string"
},
"name": {
"description": "The package name",
"type": "string"
},
"branch": {
"description": "The branch at the time of the snapshot",
"type": "string"
},
"commit": {
"description": "The HEAD commit at the time of the snapshot",
"type": "string"
},
"dirty": {
"description": "True when the working tree had changes",
"type": "boolean"
},
"stashCount": {
"description": "The number of stashes",
"type": "number"
},
"remoteUrl": {
"description": "The remote URL",
"type": "string"
},
"ahead": {
"description": "The commits that the remote did not have",
"type": "number"
},
"behind": {
"description": "The commits of the remote that the branch did not have",
"type": "number"
}
},
"additionalProperties": {}
}
},
"checksum": {
"description": "The SHA-256 checksum of the archive",
"type": "string"
},
"archiveSize": {
"description": "The size of the compressed archive, in bytes",
"type": "number"
},
"description": {
"description": "The description",
"type": "string"
}
},
"required": [
"id"
],
"additionalProperties": {},
"description": "The metadata of the snapshot"
},
"restoredPaths": {
"type": "array",
"items": {
"type": "string"
},
"description": "The folders that the restore wrote"
},
"downloadDuration": {
"type": "number",
"description": "The time of the download, in milliseconds"
},
"extractDuration": {
"type": "number",
"description": "The time of the extraction, in milliseconds"
}
},
"required": [
"success",
"metadata",
"restoredPaths",
"downloadDuration",
"extractDuration"
],
"additionalProperties": {}
}
}