import { S as EngineWasmSource, c as BlockReason, m as Decision } from "./types-BVx5XvPN.js"; import { n as PolicyValidation, t as AuthorizeInput } from "./policy-evaluator-YgP6tXTB.js"; import { n as WasmModuleNotRegisteredError, t as EdgeWasmArtifact } from "./wasm-module-error-DKPUG3DV.js"; //#region src/engine/edge-wasm.d.ts /** * Whether a module is the cedar-web build, judged by what it exports (its * Cedar evaluator constructor). Only a compiled `WebAssembly.Module` can be * inspected; any other source (bytes, a URL) counts as the engine-web build. * * `WebAssembly.Module.exports` is the module check, not `instanceof`: the * Next.js Edge sandbox hands middleware `.wasm?module` imports compiled in * another realm, which fail `instanceof WebAssembly.Module` here, and * `exports` accepts a module from any realm and throws for anything else. */ export declare function isCedarModule(source: EngineWasmSource | undefined): source is WebAssembly.Module; //#endregion //#region src/policy-evaluator-edge.d.ts /** Structural type of the WASM `PolicyEvaluator` class the cedar-web glue exports. */ interface WasmPolicyEvaluator { authorize(input: AuthorizeInput): unknown; free(): void; } /** * Host-facing wrapper around one compiled policy bundle. Mirrors the Node * `PolicyEvaluatorRuntime`: construction (in {@link evaluatePolicy}) compiles * once; every {@link authorize} reuses it. The evaluator owns the fail-closed * posture — a request it cannot marshal, or one matching no `permit`, returns * a `Block` Decision, not a throw. */ export declare class PolicyEvaluatorRuntime { private readonly inner; constructor(inner: WasmPolicyEvaluator); authorize(input: AuthorizeInput): Decision; free(): void; } /** * Register the wrangler-bundled cedar-web `WebAssembly.Module`. Call once at * worker module load with the statically-imported `.wasm`. Does NOT instantiate * the WASM — that is deferred to the first {@link evaluatePolicy} call so the * ~2 MB cedar binary stays off the detection-only hot path. * * A module that is not the cedar-web build is refused, without throwing (hosts * call this at module load): Cedar then rejects with * `WasmModuleNotRegisteredError`, whose message says the module was wrong. */ export declare function initPolicyEvaluatorEdge(wasmModule: WebAssembly.Module): void; /** Policy languages the edge seam can evaluate. Cedar today; Rego/OPA later. */ export declare const SUPPORTED_POLICY_LANGUAGES: readonly ["cedar"]; export type PolicyLanguage = (typeof SUPPORTED_POLICY_LANGUAGES)[number]; /** * Compile a tenant policy bundle into a reusable evaluator, dispatched by * language. The ONE seam every surface routes through — adding Rego is a new * `case` here, not a call-site change. * * @throws if `language` is unsupported (fail-closed — never silently treated as * Cedar) or if `sourceText` is not valid for that language (surfaced at * compile, never as a per-request deny). */ export declare function evaluatePolicy(language: string, sourceText: string): Promise; /** * Edge sibling of the Node `validatePolicy`: type-check a tenant Cedar bundle * against the canonical schema WITHOUT compiling an evaluator or throwing * (E4.7 / #3076), returning the errors + warnings. Async because it awaits the * lazy cedar-web init (like {@link evaluatePolicy}). Cedar-only today; a blank * bundle is valid ("no composed policy"). */ export declare function validatePolicy(policyText: string): Promise; //#endregion export { type AuthorizeInput, type BlockReason, type Decision, type EdgeWasmArtifact, type PolicyValidation, WasmModuleNotRegisteredError }; //# sourceMappingURL=policy-edge.d.ts.map