Newapp-sdk

@revenexx/app-sdk@0.6.0

@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).

0.4.1

Patch Changes

  • 9901d93: OpenTelemetry now auto-starts as a side effect of importing @revenexx/app-sdk/router — no NODE_OPTIONS=--require preload (which crashes open-runtimes, since the runtime server process can't resolve the app's node_modules). The bootstrap is lazy (heavy OTel packages load only when an OTLP endpoint is configured), idempotent, and never throws — a telemetry failure can no longer take the function down.

0.4.0

Minor Changes

  • 80cbf31: Add opt-in OpenTelemetry tracing for App functions.

    • New @revenexx/app-sdk/instrument preload: start it via NODE_OPTIONS=--require @revenexx/app-sdk/instrument. Lean (undici/fetch only, OTLP/proto), fully OTEL_*-env driven, and a no-op when no OTLP endpoint is set.
    • The router (createApp) now wraps each invocation in a SERVER span with W3C trace-context extraction, so a forwarded traceparent continues the caller's trace and outbound PostgREST fetches show up as child CLIENT spans.

    Set OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS, OTEL_SERVICE_NAME and OTEL_RESOURCE_ATTRIBUTES as function variables to enable it; leave them unset for zero overhead.

0.3.2

Patch Changes

  • acb355f: runtime adapter: default the data-plane endpoint to https://apps.api.revenexx.com when REVENEXX_DATA_ENDPOINT is unset — deployed apps reach their data with zero configuration. The env var still overrides (dev tenants, staging). Exported as DEFAULT_DATA_ENDPOINT.

0.3.1

Patch Changes

  • 3bdf2ae: router/mountCrud: the nested-parent filter from the path always wins — a ?parent_column=... query param can no longer widen a nested list beyond its parent resource.

0.3.0

Minor Changes

  • 6c34488: Add @revenexx/app-sdk/router — declarative HTTP routing for App functions.

    • createApp() with literal-first route matching (/markets/defaults beats /markets/{id}), {param}/:param templates, parsed bodies/queries, tenant extraction, built-in health route and 404/405 handling.
    • mountCrud() mounts the standard five REST routes for an entity in one call, including ?column=value filters, pagination metadata and nested resources scoped to their parent (/markets/{marketId}/locales).
    • HttpError plus notFound/badRequest/forbidden/conflict helpers; data-client permission errors map to 403.
    • Public-facing READMEs for the package and repo.

0.2.1

Patch Changes

  • 581e8e1: Publish to npmjs (private, scope @revenexx) via OIDC trusted publishing. No API changes — version parity with @revenexx/app-sdk-cli.

0.2.0

Minor Changes

  • 87864e7: Add count-aware pagination via page(). Each entity client now exposes page(query) returning { items, total, limit, offset } — the remote adapter asks PostgREST for Prefer: count=exact and reads the total from Content-Range in a single request; the mock adapter reports the filtered total. list() is unchanged. Generated clients (appsdk generate) now type page() alongside list().