Newapp-sdk

@revenexx/app-sdk@0.5.0

Minor Changes

  • 9ec65d2: Map PostgREST constraint violations to real HTTP statuses instead of forwarding them as 500s.

    The remote/runtime adapters used to rethrow PostgREST's response verbatim, so every ordinary database condition surfaced as 500 with the raw body — which also exposed table and constraint names to API callers. They now map:

    • 23505 / 23P01 duplicate → 409
    • 23503 foreign key → 400 when the referenced parent is missing, 409 when a dependent row blocks a delete
    • 23502 not-null, 23514 check, 22xxx data exceptions (incl. 22P02 bad uuid) → 400
    • PGRST103 offset past the last row → no error at all: an empty page with the requested limit/offset and the true total

    Messages are stable and generic; responses carry a machine-readable code. The raw PostgREST body is logged through the function's error() and recorded on the trace, never returned.

    HttpError moved to a shared module so adapters can raise it — it is still exported from @revenexx/app-sdk/router unchanged, and now from @revenexx/app-sdk as well, together with isHttpError() (use it instead of instanceof: the two entrypoints are separate bundles).