Newapp-sdk

@revenexx/app-sdk@0.7.0

Minor Changes

  • 037f922: App settings are now part of the SDK: c.settings() on any router handler, or createSettings() standalone.

    Reading the tenant's configuration for your own App used to mean hand-rolling a gateway call per App — one App did it, twelve declared settings nothing ever read. There is now one implementation:

    const app = createApp({
      name: "orders",
      settings: { defaults: { auto_reserve: true, reservation_minutes: 30 } },
    });
    
    app.post("/orders", async (c) => {
      const s = await c.settings();
      if (s.auto_reserve) await reserve(c.body, s.reservation_minutes);
    });
    
    • Market-aware. The market on the request (X-Revenexx-Market) is sent to the gateway, so a setting declared "scope": "market" resolves for the market the call is for, with the tenant value as the fallback. Override per read with c.settings({ market: 'fr' }). Resolution stays the gateway's: market override → tenant value → settings.json default.
    • Defaults merged under stored values. defaults mirrors your settings.json and types the resolved object; a key the manifest declares never comes back needing a null-check. A stored false/0/'' still wins.
    • Fails open. An unreachable gateway, a 2s timeout, a missing tenant or an App with no settings at all yields the last resolved values, else the declared defaults. It never throws. onError reports the fallback.
    • Cached. Per (tenant, app, market), 60s, concurrent reads sharing one in-flight request; a failed read retries after 5s. Tune with ttlMs / REVENEXX_SETTINGS_TTL_MS.

    createSettings is exported from both @revenexx/app-sdk and @revenexx/app-sdk/router for code that reads settings outside a handler. App, AppOptions, Handler and RouteContext take an optional type parameter for the declared defaults; it defaults to the previous shape, so existing code is unaffected.

Patch Changes

  • 5823b1e: Decode the query string the runtime hands over. The previous decoding only ran when the query rode on req.path, which the open-runtimes adapter never does, so a percent-encoded filter value reached the handler still encoded.