Offline API contract workspaces, dependency-aware updates and consumer upgrade gates; RFC 6570 compatibility
Dependencies
import { "JSJ222/moonuritemplate/contracts" @contracts, }moon check --target all --deny-warn
moon build --target all --deny-warn
moon test --target all --deny-warn
moon run examples/api --target wasm-gcpub(all) enum BindingIssue {
Missing(String)
Unused(String)
Duplicate(String)
CompositePrefix(String)
}pub struct BoundTemplate {
// private fields
}fn BoundTemplate::expand(self : BoundTemplate, dynamic : Array[(String, Value)], max_output? : Int, max_bindings? : Int, max_value_length? : Int, max_items? : Int) -> Result[String, ExpandError]fn BoundTemplate::measure(self : BoundTemplate, dynamic : Array[(String, Value)], max_output? : Int, max_bindings? : Int, max_value_length? : Int, max_items? : Int) -> Result[Int, ExpandError]pub(all) enum CatalogBatchError {
TooManyRequests
TotalOutputTooLong
InvalidRequest(Int, CatalogExpandError)
}pub struct CatalogDiff {
added : Array[String]
removed : Array[String]
changed : Array[CatalogTemplateChange]
}pub struct CatalogEntryAudit {
name : String
variable_count : Int
expression_count : Int
max_level : Int
findings : Array[PolicyFinding]
}pub(all) enum CatalogError {
TooManyTemplates
EmptyName
DuplicateName(String)
InvalidTemplate(String, ParseError)
}pub(all) enum CatalogJsonError {
RootMustBeObject
TemplateMustBeString(String)
Compilation(CatalogError)
}pub(all) enum CatalogJsonRenderError {
BindingConversion(JsonBridgeError)
CatalogExpansion(CatalogExpandError)
}pub(all) enum ContractError {
UnknownRule(String)
DuplicateRule(String)
IncompatibleRule(String)
MissingRequired(String)
WrongKind(String, BindingKind)
InvalidBindings(ExpandError)
}pub struct ContractTemplate {
// private fields
}fn ContractTemplate::expand(self : ContractTemplate, bindings : Array[(String, Value)], max_output? : Int, max_bindings? : Int, max_value_length? : Int, max_items? : Int) -> Result[String, ContractError]fn ContractTemplate::validate(self : ContractTemplate, bindings : Array[(String, Value)], max_bindings? : Int, max_value_length? : Int, max_items? : Int) -> Result[Unit, ContractError]pub(all) enum ExpandError {
DuplicateVariable(String)
MissingVariable(String)
UnusedVariable(String)
InvalidValue(String)
TooManyBindings
ValueTooLong(String)
TooManyItems(String)
InvalidLimit(String)
OutputTooLong
}pub(all) struct ExpressionInfo {
start : Int
end : Int
operator : String
level : Int
variable_count : Int
permits_reserved : Bool
}pub(all) enum JsonBridgeError {
RootMustBeObject
UnsupportedValue(String)
}pub struct LinkSession {
// private fields
}fn LinkSession::update(self : LinkSession, patch : Array[BindingChange]) -> Result[LinkUpdate, LinkSessionError]pub(all) enum LinkSessionError {
InvalidBudget
TooManyChanges
DuplicateChange(String)
InvalidBindings(ExpandError)
InvalidEndpoint(String, ExpandError)
TotalOutputTooLong
}pub struct LinkUpdate {
// private fields
}pub enum Operator {
Simple
Reserved
Fragment
Label
Path
PathParameter
Query
QueryContinuation
}pub(all) struct OutputSpan {
source_start : Int
source_end : Int
output_start : Int
output_end : Int
is_expression : Bool
}pub(all) enum ParseError {
InputTooLong
InvalidUnicode(Int)
InvalidLiteral(Int)
UnclosedExpression(Int)
NestedExpression(Int)
EmptyExpression(Int)
InvalidOperator(Int)
InvalidVariable(Int)
InvalidModifier(Int)
TooManyExpressions
TooManyVariables
}pub(all) enum PolicyError {
InvalidFeatureLevel
InvalidReferenceLimit
}pub(all) enum PolicyFindingKind {
ReservedExpansion
FragmentExpansion
FeatureLevelExceeded(Int)
ReferenceLimitExceeded
RepeatedVariable(String)
}pub struct RequestAudit {
index : Int
name : String
unknown_template : Bool
issues : Array[BindingIssue]
}pub struct Template {
// private fields
}fn Template::bind(self : Template, bindings : Array[(String, Value)], max_bindings? : Int, max_value_length? : Int, max_items? : Int) -> Result[BoundTemplate, ExpandError]fn Template::check_policy(self : Template, policy : TemplatePolicy) -> Result[Array[PolicyFinding], PolicyError]fn Template::expand(self : Template, bindings : Array[(String, Value)], max_output? : Int, max_bindings? : Int, max_value_length? : Int, max_items? : Int) -> Result[String, ExpandError]fn Template::expand_detailed(self : Template, bindings : Array[(String, Value)], max_output? : Int, max_bindings? : Int, max_value_length? : Int, max_items? : Int) -> Result[RenderedUri, ExpandError]fn Template::expand_json(self : Template, values : Json, max_output? : Int, max_bindings? : Int, max_value_length? : Int, max_items? : Int) -> Result[String, JsonRenderError]fn Template::expand_required(self : Template, bindings : Array[(String, Value)], reject_unused? : Bool, max_output? : Int, max_bindings? : Int, max_value_length? : Int, max_items? : Int) -> Result[String, ExpandError]fn Template::measure(self : Template, bindings : Array[(String, Value)], max_output? : Int, max_bindings? : Int, max_value_length? : Int, max_items? : Int) -> Result[Int, ExpandError]fn Template::with_contract(self : Template, rules : Array[BindingRule], reject_unused? : Bool) -> Result[ContractTemplate, ContractError]pub struct TemplateAnalysis {
expressions : Array[ExpressionInfo]
uses : Array[VariableUse]
max_level : Int
has_reserved_expansion : Bool
}pub struct TemplateCatalog {
// private fields
}fn TemplateCatalog::audit(self : TemplateCatalog, policy : TemplatePolicy) -> Result[CatalogAudit, PolicyError]fn TemplateCatalog::expand(self : TemplateCatalog, name : String, bindings : Array[(String, Value)], max_output? : Int) -> Result[String, CatalogExpandError]fn TemplateCatalog::expand_json(self : TemplateCatalog, name : String, values : Json, max_output? : Int) -> Result[String, CatalogJsonRenderError]fn TemplateCatalog::expand_requests(self : TemplateCatalog, requests : Array[CatalogRequest], max_requests? : Int, max_total_output? : Int, max_each_output? : Int) -> Result[Array[String], CatalogBatchError]fn TemplateCatalog::inspect_requests(self : TemplateCatalog, requests : Array[CatalogRequest], max_requests? : Int, max_bindings? : Int, max_findings? : Int) -> Result[Array[RequestAudit], RequestAuditError]fn TemplateCatalog::measure(self : TemplateCatalog, name : String, bindings : Array[(String, Value)], max_output? : Int) -> Result[Int, CatalogExpandError]fn TemplateCatalog::measure_requests(self : TemplateCatalog, requests : Array[CatalogRequest], max_requests? : Int, max_total_output? : Int, max_each_output? : Int) -> Result[Int, CatalogBatchError]fn TemplateCatalog::start_session(self : TemplateCatalog, bindings : Array[(String, Value)], max_each_output? : Int, max_total_output? : Int, max_bindings? : Int, max_value_length? : Int, max_items? : Int) -> Result[LinkSession, LinkSessionError]pub(all) struct TemplatePolicy {
allow_reserved : Bool
allow_fragment : Bool
max_level : Int
max_references : Int
forbid_repeated_variables : Bool
}pub(all) struct VariableProfile {
name : String
occurrences : Int
first_start : Int
last_end : Int
scalar_only : Bool
uses_explode : Bool
uses_reserved : Bool
uses_query : Bool
maximum_prefix : Int?
}pub(all) struct VariableUse {
name : String
start : Int
end : Int
expression_index : Int
operator : String
prefix : Int?
explode : Bool
}fn compile_catalog(entries : Array[(String, String)], max_templates? : Int, max_template_length? : Int) -> Result[TemplateCatalog, CatalogError]fn compile_catalog_json(input : Json, max_templates? : Int, max_template_length? : Int) -> Result[TemplateCatalog, CatalogJsonError]fn expand(source : String, bindings : Array[(String, Value)], max_output? : Int) -> Result[String, TemplateError]fn expand_json(source : String, values : Json, max_output? : Int) -> Result[String, JsonTemplateError]fn parse(input : String, max_length? : Int, max_expressions? : Int, max_variables? : Int, strict_literals? : Bool) -> Result[Template, ParseError]Install
Download zipOffline API contract workspaces, dependency-aware updates and consumer upgrade gates; RFC 6570 compatibility
Dependencies