@flow-state-dev/core/resource-template
Classes
ResourceTemplateParseError
Extends
Error
Constructors
Constructor
new ResourceTemplateParseError(message, options?): ResourceTemplateParseError;
Parameters
message
string
options?
cause?
unknown
sourcePath?
string
Returns
Overrides
Error.constructor
Properties
cause?
cause?: unknown;
Inherited from
Error.cause
message
message: string;
Inherited from
Error.message
name
name: string;
Inherited from
Error.name
sourcePath?
readonly sourcePath?: string;
stack?
stack?: string;
Inherited from
Error.stack
ResourceTemplateRenderError
Extends
Error
Constructors
Constructor
new ResourceTemplateRenderError(message, options?): ResourceTemplateRenderError;
Parameters
message
string
options?
cause?
unknown
sourcePath?
string
Returns
Overrides
Error.constructor
Properties
cause?
cause?: unknown;
Inherited from
Error.cause
message
message: string;
Inherited from
Error.message
name
name: string;
Inherited from
Error.name
sourcePath?
readonly sourcePath?: string;
stack?
stack?: string;
Inherited from
Error.stack
ResourceTemplateResolutionError
Extends
Error
Constructors
Constructor
new ResourceTemplateResolutionError(ref, consumer): ResourceTemplateResolutionError;
Parameters
ref
string
consumer
string
Returns
ResourceTemplateResolutionError
Overrides
Error.constructor
Properties
cause?
cause?: unknown;
Inherited from
Error.cause
consumer
readonly consumer: string;
message
message: string;
Inherited from
Error.message
name
name: string;
Inherited from
Error.name
ref
readonly ref: string;
stack?
stack?: string;
Inherited from
Error.stack
Interfaces
ResourceTemplate
Properties
description?
readonly description?: string;
inertKeys
readonly inertKeys: readonly string[];
name?
readonly name?: string;
partials?
readonly partials?: ResourceTemplatePartials;
sections
readonly sections: object;
context?
context?: string;
system
system: string;
user?
user?: string;
source
readonly source: string;
Type Aliases
ResourceTemplatePartials
type ResourceTemplatePartials = Record<string, string>;
Pre-registered partials, keyed by name (filename without .md).
Functions
isResourceTemplate()
function isResourceTemplate(value): value is ResourceTemplate;
True when value is a parsed ResourceTemplate — as opposed to an
unresolved file path (a string or anchored-path object) still sitting on a
config's contentTemplate slot. Structural: parsed templates always carry
a string source and a non-null sections object. Lives next to the
interface so the guard and the shape stay in lockstep.
Parameters
value
unknown
Returns
value is ResourceTemplate
parseResourceTemplate()
function parseResourceTemplate(text, options?): ResourceTemplate;
Parse role-tagged Markdown into a ResourceTemplate (isomorphic).
Parameters
text
string
options?
partials?
sourcePath?
string
Returns
Throws
on frontmatter or body parse failure.
renderResourceTemplate()
function renderResourceTemplate(
template,
state,
options?
): string;
Render a ResourceTemplate's body against resource state (deterministic, no model call).
Parameters
template
state
options?
partials?
Returns
string
Throws
on strict-variable miss, limit exceeded, etc.