Skip to content

ExtractAslFromTemplateParams

Defined in: src/types/index.ts:1247

Parameters for extractAslFromTemplate (from the sfn-diagram/cfn subpath).

format?: "auto" | "json" | "yaml";

Defined in: src/types/index.ts:1249

Input format. ‘auto’ (default) sniffs JSON vs YAML.


readFile?: (params) => string;

Defined in: src/types/index.ts:1264

Reads a file the template points at, for a SAM DefinitionUri that is a local path. Synchronous: return the file’s text (for example with readFileSync), or throw to report it unreadable; the thrown message is appended to the error, so name the path in it, never the contents. Omitted, a DefinitionUri is reported instead of read, which is what browsers and edge runtimes get. A CDK DefinitionS3Location is read from the cloud assembly too, when templateFileName names a <stack>.template.json or a *.nested.template.json and the Key has CDK’s asset-hash shape: readFile is asked for <stack>.assets.json, then for the asset file it lists. For a nested stack template it is first asked for manifest.json, then for each stack’s asset manifest until one lists the template. s3:// URIs, S3Location objects and any other DefinitionS3Location are never read, and a value starting with two slashes or backslashes (a network or device path) is refused before readFile is called.

ReadFileParams

string


resourceId?: string;

Defined in: src/types/index.ts:1271

State machine to extract when the template has more than one: its logical id, or for a CDK template its construct path, either the full aws:cdk:path (OrdersStack/OrderWorkflow), the path relative to the stack (OrderWorkflow, Orders/Workflow) or a trailing part of it. An exact logical id wins; a value that matches more than one state machine throws.


template: string | Record<string, unknown>;

Defined in: src/types/index.ts:1273

Raw template string (JSON or YAML) or an already-parsed template object.


templateFileName?: string;

Defined in: src/types/index.ts:1281

The template’s file name as cdk synth wrote it (OrdersStack.template.json); a path works too, only its last segment is used. With readFile, a CDK DefinitionBody.fromFile definition is read from the <stack>.assets.json beside the template. For a *.nested.template.json, the asset manifest of the stack that holds it is found through the cloud assembly manifest.json beside it.