/* tslint:disable */ /* eslint-disable */ /** A concrete JavaScript value or Decodal range descriptor. */ export type DecodalValue = | string | number | boolean | DecodalValue[] | { [field: string]: DecodalValue } | DecodalPrimitiveDescriptor | DecodalUnknownDescriptor | DecodalArrayDescriptor | DecodalMapDescriptor | DecodalObjectDescriptor | DecodalRangeDescriptor; export type DecodalPrimitiveType = 'String' | 'Int' | 'Float' | 'Bool'; export type DecodalConstraint = | { kind: 'unknown' } | { kind: 'type'; value: DecodalPrimitiveType } | { kind: 'compare'; op: '>' | '>=' | '<' | '<='; value: string | number | boolean } | { kind: 'regex'; value: string } | { kind: 'predicate'; value: string }; export interface DecodalPrimitiveDescriptor { $decodal: DecodalPrimitiveType; constraints?: DecodalConstraint[]; default?: DecodalValue; } export interface DecodalUnknownDescriptor { $decodal: 'Unknown'; constraints?: DecodalConstraint[]; default?: DecodalValue; } export interface DecodalArrayDescriptor { $decodal: 'Array'; item: DecodalValue; constraints?: DecodalConstraint[]; default?: DecodalValue; } export interface DecodalMapDescriptor { $decodal: 'Map'; value: DecodalValue; constraints?: DecodalConstraint[]; default?: DecodalValue; } export interface DecodalObjectDescriptor { $decodal: 'Object'; fields: Record; rest: DecodalValue; } export interface DecodalRangeDescriptor { $decodal: 'Range'; constraints?: DecodalConstraint[]; default?: DecodalValue; } export type DecodalLoadedImport = | { kind: 'source'; key: string; name?: string; source: string } | { kind: 'value'; key: string; value: DecodalValue }; export type DecodalImportCandidate = | string | { specifier: string; detail?: string }; /** Host-owned environment shared by evaluation and language tooling. */ export interface DecodalEnvironment { globals?: Record; /** Synchronous import callback. Preload or cache asynchronous resources first. */ loadImport?: (currentKey: string | null, specifier: string) => DecodalLoadedImport; /** Synchronous import completion callback. */ completeImport?: (currentKey: string | null, prefix: string) => DecodalImportCandidate[]; } /** * A browser-facing language service configured entirely by its JavaScript host. * * The host owns globals, import loading, and import completion. This keeps * filesystem, network, and virtual-project policy outside the WASM package. */ export class DecodalLanguageService { free(): void; [Symbol.dispose](): void; /** * Completes a source using the same injected environment as evaluation. * * Positions and returned ranges are UTF-16 offsets, matching browser * editors and the Language Server Protocol. */ complete(key: string, source: string, position: number, explicit: boolean): string; /** * Evaluates a source using the injected globals and import loader. */ evaluate(key: string, name: string, source: string): string; constructor(options?: DecodalEnvironment); } /** * Evaluates one standalone Decodal source with no host globals or imports. */ export function evaluate(source: string): string; export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; export interface InitOutput { readonly memory: WebAssembly.Memory; readonly __wbg_decodallanguageservice_free: (a: number, b: number) => void; readonly decodallanguageservice_complete: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number]; readonly decodallanguageservice_evaluate: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number]; readonly decodallanguageservice_new: (a: any) => [number, number, number]; readonly evaluate: (a: number, b: number) => [number, number]; readonly __wbindgen_malloc: (a: number, b: number) => number; readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number; readonly __wbindgen_exn_store: (a: number) => void; readonly __externref_table_alloc: () => number; readonly __wbindgen_externrefs: WebAssembly.Table; readonly __wbindgen_free: (a: number, b: number, c: number) => void; readonly __externref_table_dealloc: (a: number) => void; readonly __wbindgen_start: () => void; } export type SyncInitInput = BufferSource | WebAssembly.Module; /** * Instantiates the given `module`, which can either be bytes or * a precompiled `WebAssembly.Module`. * * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated. * * @returns {InitOutput} */ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput; /** * If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * * @param {{ module_or_path: InitInput | Promise }} module_or_path - Passing `InitInput` directly is deprecated. * * @returns {Promise} */ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise } | InitInput | Promise): Promise;