Saxonberg Server API
    Preparing search index...
    Index

    Methods

    • Throw SecurityError unless some frame on the current call stack is test code — a .test.{ts,js} spec or a __tests__/ fixture. Call from the top of every _*ForTest / _*ForTesting method to guarantee production code can't reach the seam.

      op is the seam name; included in the error message so the offender sees exactly which seam was misused.

      Parameters

      • op: string

      Returns void

    • Apply the standard Api-class decoration imperatively — used by Api files that can't take a @CallSecurity class decorator because they have static #private identifiers (TS18036). Stamps the class-default policy as Public (only when no policy is already registered, so we don't trample a per-method or class-form decorator that ran first) and wraps every own static method so static Api calls push frames.

      Parameters

      • cls: object

      Returns void

    • Returns the set of

      Parameters

      • cls: object

      Returns ReadonlySet<string> | undefined

      method names declared on cls directly (not inherited). Read by the loader-hook validator (ModuleApi.stamp's #validateNoFinalOverrides).

    • Register the security gate as a ProxyApi interceptor. Called automatically by the static initializer at module-load time; idempotent — safe for tests that reset ProxyApi to call again.

      Returns void

    • Returns true if the method is marked unshadowable — either method-form on it directly, or class-form on the host's class or any ancestor. Read at attach time by ShadowApi.

      Parameters

      • hostInstance: object
      • methodName: string

      Returns boolean

    • Resolve the entry policy for a method on instance. Walks the prototype chain looking for the closest method-form @CallSecurity, then falls back to class-form default along the chain, then to Public.

      Resolution order:

      1. Method-form

      Parameters

      • instance: object
      • methodName: string

      Returns SecurityPolicy

      (closest in prototype chain) 2. Class-form

      (closest in prototype chain) 3. Public (framework default)

    • Resolve @ShadowSecurity for host[methodName]. Walks the host's prototype chain; closest spec wins. Returns null when nothing is stamped — ShadowApi treats absent specs as Public.

      Parameters

      • host: object
      • methodName: string

      Returns ShadowSecuritySpec | null

    • Resolve the entry policy for a static method on cls. Walks up the class itself (not the prototype chain — statics aren't inherited the same way). Returns Public if no policy was registered.

      Parameters

      • cls: object
      • methodName: string

      Returns SecurityPolicy

    • Mint a fresh, URL-safe, collision-resistant identifier — the project-wide id source. Server code calls this instead of importing nanoid directly, so id generation routes through one Api seam (the client mints its own ids browser-side). Despite the name it returns a nanoid (21 chars by default), not an RFC-4122 UUID.

      Parameters

      • Optionalsize: number

        optional length override (e.g. short handles).

      Returns string