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, orcreateSettings()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 withc.settings({ market: 'fr' }). Resolution stays the gateway's: market override → tenant value →settings.jsondefault. - Defaults merged under stored values.
defaultsmirrors yoursettings.jsonand types the resolved object; a key the manifest declares never comes back needing a null-check. A storedfalse/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.
onErrorreports 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.
createSettingsis exported from both@revenexx/app-sdkand@revenexx/app-sdk/routerfor code that reads settings outside a handler.App,AppOptions,HandlerandRouteContexttake an optional type parameter for the declared defaults; it defaults to the previous shape, so existing code is unaffected.- Market-aware. The market on the request (
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.