3b7d0564bb
- Register built-in text schema ({type: 'string'}) alongside workflow schemas
- Add cmdCasPutText command: uwf cas put-text <text>
- Update CLI reference in workflow-util
- Update solve-issue.yaml procedure to use put-text
Refs #380
27 lines
865 B
TypeScript
27 lines
865 B
TypeScript
import type { Hash, Store } from "@uncaged/json-cas";
|
|
import { putSchema } from "@uncaged/json-cas";
|
|
import { START_NODE_SCHEMA, STEP_NODE_SCHEMA, WORKFLOW_SCHEMA } from "@uncaged/workflow-protocol";
|
|
|
|
export const TEXT_SCHEMA = { type: "string" as const };
|
|
|
|
export type UwfSchemaHashes = {
|
|
workflow: Hash;
|
|
startNode: Hash;
|
|
stepNode: Hash;
|
|
text: Hash;
|
|
};
|
|
|
|
/**
|
|
* Register Workflow, StartNode, and StepNode JSON Schemas in the CAS store.
|
|
* Idempotent: safe to call on every CLI invocation.
|
|
*/
|
|
export async function registerUwfSchemas(store: Store): Promise<UwfSchemaHashes> {
|
|
const [workflow, startNode, stepNode, text] = await Promise.all([
|
|
putSchema(store, WORKFLOW_SCHEMA),
|
|
putSchema(store, START_NODE_SCHEMA),
|
|
putSchema(store, STEP_NODE_SCHEMA),
|
|
putSchema(store, TEXT_SCHEMA),
|
|
]);
|
|
return { workflow, startNode, stepNode, text };
|
|
}
|