context
API reference for @effx/compiler/lift/context
context.ts overview
Exports Grouped by Category
- utils
- AccessRule (type alias)
- Context (interface)
- MetadataRule (type alias)
- NoSchemaRule (type alias)
- Position (type alias)
- ProblemRule (type alias)
- SuccessRule (type alias)
- claimName
- findingCause
- freeName
- groupPart
- isDeclared
- localDeclarationIdentity
- makeContext
- nameOfSymbol
- plannedSchemaRef
- plannedSymbolRef
- reserveName
- restoreTaken
- snapshotTaken
- sourceRangeIdentity
- stripSuffix
- subjectOf
- unrecognized
- upperFirst
utils
AccessRule (type alias)
Signature
type AccessRule = RuleOf<"Access">Context (interface)
Signature
export interface Context {
readonly model: EffectModel
readonly input: LiftInput
readonly files: ReadonlyMap<string, SourceFileRecord>
readonly filesByModule: ReadonlyMap<string, SourceFileRecord>
readonly schemaFacts: ReadonlyMap<string, SchemaFact>
readonly markers: ReadonlyMap<string, MiddlewareFact>
readonly values: ReadonlyMap<string, ValueRecord>
readonly localValues: ReadonlyMap<string, LocalValueRecord>
readonly localCalls: ReadonlyMap<string, LocalValueCall>
readonly wrappers: ReadonlyMap<string, WrapperFact>
readonly successRules: ReadonlyMap<string, SuccessRule>
readonly noSchemaRules: ReadonlyMap<string, NoSchemaRule>
readonly problemRules: ReadonlyArray<ProblemRule>
readonly metadataRules: ReadonlyArray<MetadataRule>
readonly accessRules: ReadonlyArray<AccessRule>
/** Definition records by reference identity (both the definition's own ref and its effect key's). */
readonly definitionsByRef: ReadonlyMap<string, DefinitionRecord>
/** Definition records by annotation name. */
readonly definitionsByName: ReadonlyMap<string, DefinitionRecord>
/** The selected definition-owned hooks the caller composed with `liftRegistryOf`. */
readonly registry: LiftRegistry
/** Names already taken per file, extended as exports are planned (collision-free by construction). */
readonly taken: Map<string, Set<string>>
/** Successful extraction plans shared by every consumer of the same resolved union. */
readonly codePlans: Map<string, { readonly refactors: ReadonlyArray<Refactor>; readonly reference: CodeReference }>
}MetadataRule (type alias)
Signature
type MetadataRule = RuleOf<"Metadata">NoSchemaRule (type alias)
Signature
type NoSchemaRule = RuleOf<"NoSchemaSuccess">Position (type alias)
Where a finding sits semantically; the diagnostic code is a function of position and finding kind.
Signature
type Position = "structure" | "channel" | "success" | "problems" | "metadata" | "access"ProblemRule (type alias)
Signature
type ProblemRule = RuleOf<"ProblemRegistry">SuccessRule (type alias)
Signature
type SuccessRule = RuleOf<"SuccessWrapper">claimName
Reserves name in file on top of everything the file already binds, so no later plan can take it.
Signature
declare const claimName: (ctx: Context, file: SourceFileRecord, name: string) => voidfindingCause
A finding becomes a diagnostic by the position it occurred in (§6).
Signature
declare const findingCause: (ctx: Context, subject: string, position: Position, finding: Finding) => CausefreeName
The first collision-free name for preferred in file: preferred, then preferred2, … Reserves nothing.
Signature
declare const freeName: (ctx: Context, file: SourceFileRecord, preferred: string) => stringgroupPart
social-events → SocialEvents: the group part the generator already uses in export names.
Signature
declare const groupPart: (group: string) => stringisDeclared
Whether a name is already bound at the top level of a file (before any planning).
Signature
declare const isDeclared: (file: SourceFileRecord, name: string) => booleanlocalDeclarationIdentity
Signature
declare const localDeclarationIdentity: (id: LocalDeclarationId) => stringmakeContext
Signature
declare const makeContext: (model: EffectModel, input: LiftInput, registry: LiftRegistry) => ContextnameOfSymbol
Callee or Callee.member, the way a diagnostic names an application symbol.
Signature
declare const nameOfSymbol: (ref: SymbolRef) => stringplannedSchemaRef
The real SchemaRef an export planned into file will have: module and identity path of that file. The
identity is the StableId the frontend derives once the export exists. A file or name that cannot form one
cannot hold a schema export the IR can name, so the result says why (the caller diagnoses it) and lifting
stays total (spec 0019 §10.5).
Signature
declare const plannedSchemaRef: (file: SourceFileRecord, name: string) => Result.Result<SchemaRef, string>plannedSymbolRef
The reference an exported value planned into file will have.
Signature
declare const plannedSymbolRef: (file: SourceFileRecord, name: string) => SymbolRefreserveName
A collision-free, deterministic name, reserved: preferred, then preferred2, preferred3, …
Signature
declare const reserveName: (ctx: Context, file: SourceFileRecord, preferred: string) => stringrestoreTaken
Restores the reserved names to a snapshot (every file the snapshot does not know is forgotten).
Signature
declare const restoreTaken: (ctx: Context, snapshot: ReadonlyMap<string, ReadonlySet<string>>) => voidsnapshotTaken
The planner's reserved names, copied so a rejected endpoint cannot leave its names reserved.
Signature
declare const snapshotTaken: (ctx: Context) => ReadonlyMap<string, ReadonlySet<string>>sourceRangeIdentity
Signature
declare const sourceRangeIdentity: (range: SourceRange) => stringstripSuffix
ProfileReadProblem without its Problem suffix; a name without the suffix is unchanged.
Signature
declare const stripSuffix: (name: string, suffix: string) => stringsubjectOf
Group.key as users write it; the key falls back to the declared symbol when it is not a literal.
Signature
declare const subjectOf: (group: string, key: Option.Option<string>, symbol: SymbolRef) => stringunrecognized
EFFX3001 for a construct the grammar does not contain.
Signature
declare const unrecognized: (subject: string, at: SourceRange, construct: string) => CauseupperFirst
profile.readOwnProfile → ReadOwnProfile: the export name of an operation const.
Signature
declare const upperFirst: (name: string) => string