← All procedures
client.import
Parse a procedure reference ({ $proc, input }) from JSON text. Other JSON, for example a number or a list, gives success false.
browsernot registered- Package
- @procedures/client · README
- Path
["client","import"]- CLI
- Not a
mark command: it is not in the default registry. - As data
{"$proc":["client","import"],"input":{}}- Tags
- core, meta
Try it in the Composer →
Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY, allCoreProcedures } from "@procedures/client";
for (const procedure of allCoreProcedures) {
if (!PROCEDURE_REGISTRY.has(procedure.path)) PROCEDURE_REGISTRY.register(procedure);
}
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["client","import"], {});
console.log(JSON.stringify(result));As data, in a program
{ "$proc": ["client", "import"], "input": {} }Input
Output
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"json": {
"description": "JSON string containing procedure ref",
"type": "string"
},
"path": {
"description": "File path to load procedure ref from (requires fs.read procedure)",
"type": "string"
}
}
},
"output": {
"type": "object",
"properties": {
"procedure": {
"description": "The parsed procedure reference"
},
"success": {
"type": "boolean",
"description": "True when the text is a valid procedure reference"
},
"error": {
"description": "The error message when the parse failed",
"type": "string"
}
},
"required": [
"success"
],
"additionalProperties": {}
}
}