Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit61a33237e0

README.md

target

The declarer a preset's values are for: resolved by the guid its target envelope names (pinned in the preset's .refs) or by the identity string a hand-written target names, checked against that declarer's current schema, and compared with the checksum the pin recorded.

Exports

  • Target.literalFor(ref) -> string — the guid a preset pins for ref.
  • Target.describe(ref) -> string — ref's identity.
  • Target.envelopeFor(ref) -> Envelope — { __ref, type, name } for ref.
  • Target.resolve(presetRef, doc) -> Resolved
  • Target.resolveLiteral(literal: string) -> Resolved
  • Target.declarerOfAsset(ref) -> (declarer, schema)
  • Target.isComponentTarget(v) -> boolean — true for { entity = <id>, component = <name> }.
  • Target.declarerOfComponent(t) -> (component, schema, proxy) — the component asset governing a component on an entity, its schema, and the live component.
  • Target.check(schema, values) -> (valid, rejected)
  • Target.valuesOf(presetRef, doc) -> (values, report, resolved?) — what preset.values answers, from a document already read.
  • Target.merge(schema, current, patch) -> values
  • Target.refuse(prefix: string, violations) — raises.

Types:

  • Resolved = { literal: string, name: string, ref: any?, guid: string?, schema: any?, pinned: boolean, changed: boolean }
  • Violation = { path: string, message: string }
  • Report = { format, target, targetGuid?, pinned, targetChanged, rejected }

Usage

local Target = require("@builtin::modules.preset.target")
local declarer, schema = Target.declarerOfAsset(texRef)