@rawdash/hono 0.18.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -2,17 +2,6 @@ import { DashboardConfig, ServerStorage, ConnectorLoggerFactory, WidgetCache, Co
2
2
  import { Context, MiddlewareHandler, Hono } from 'hono';
3
3
  import { ConnectorRegistry, SecretsResolver } from '@rawdash/core';
4
4
 
5
- /**
6
- * Common options accepted by every `@rawdash/hono` router factory.
7
- *
8
- * `getConfig` / `getStorage` are invoked per-request with the Hono
9
- * `Context`, so adapters can derive the config or storage from request
10
- * state (e.g. a path parameter, an id attached by an auth middleware, or
11
- * environment bindings).
12
- *
13
- * `before` middleware runs before any handler — typically auth/scope
14
- * checks.
15
- */
16
5
  interface HonoRouterOptions {
17
6
  getConfig: (c: Context) => DashboardConfig | Promise<DashboardConfig>;
18
7
  getStorage: (c: Context) => ServerStorage | Promise<ServerStorage>;
@@ -23,27 +12,8 @@ interface HonoStorageRouterOptions {
23
12
  before?: MiddlewareHandler[];
24
13
  }
25
14
 
26
- /**
27
- * Liveness probe — returns `{status:'ok'}` synchronously, no storage
28
- * access. Mount at `/health` (or wherever your platform's probe expects).
29
- */
30
15
  declare function createHealthRouter(): Hono;
31
16
 
32
- /**
33
- * Options for `createSyncRouter`.
34
- *
35
- * `mode` defaults to `'in-process'`: the trigger handler kicks off
36
- * `runSync` in the background, iterating `config.connectors` and
37
- * instantiating each via `connectorRegistry`. In this mode both
38
- * `getConfig` and `connectorRegistry` are required.
39
- *
40
- * In `mode: 'deferred'`, the trigger handler only records the `queued`
41
- * transition; an external runner is responsible for `running →
42
- * succeeded/failed`. `getConfig` and `connectorRegistry` can be omitted
43
- * in this mode — useful when the deployment cannot materialize connector
44
- * implementations at request time (e.g. cloud, where the actual
45
- * `connector.sync(...)` call happens in a queue consumer worker).
46
- */
47
17
  type SyncRouterOptions = (HonoRouterOptions & {
48
18
  mode?: 'in-process';
49
19
  connectorRegistry: ConnectorRegistry;
@@ -55,99 +25,33 @@ type SyncRouterOptions = (HonoRouterOptions & {
55
25
  getConfig?: HonoRouterOptions['getConfig'];
56
26
  before?: MiddlewareHandler[];
57
27
  };
58
- /**
59
- * `POST /` — triggers a sync, returning immediately with
60
- * `{queued: true|false}`. In `mode: 'in-process'` (default) the sync
61
- * runs in the background; in `mode: 'deferred'` the handler only
62
- * persists the `queued` transition and the external runner takes it
63
- * from there.
64
- *
65
- * Mount at `/sync`.
66
- */
67
28
  declare function createSyncRouter(opts: SyncRouterOptions): Hono;
68
- /**
69
- * `GET /` — returns the current `SyncState`. Mount at `/sync/state`.
70
- */
71
29
  declare function createSyncStateRouter(opts: HonoStorageRouterOptions): Hono;
72
30
 
73
31
  interface HonoWidgetsRouterOptions extends HonoRouterOptions {
74
- /**
75
- * Optional per-request factory returning a `WidgetCache`. Invoked once
76
- * per request so the cache can be scoped to the request's tenant/auth
77
- * context. When omitted, widgets are resolved fresh on every request.
78
- */
79
32
  cache?: (c: Context) => WidgetCache;
80
33
  }
81
- /**
82
- * - `GET /:dashboardId/widgets` → `WidgetsListResponse`
83
- * - `GET /:dashboardId/widgets/:widgetId` → `CachedWidget`
84
- *
85
- * Mount at `/dashboards`.
86
- */
87
34
  declare function createWidgetsRouter(opts: HonoWidgetsRouterOptions): Hono;
88
35
 
89
- /**
90
- * `POST /retain` — runs the retention policy once. Coalesces concurrent
91
- * calls so multiple requests during an in-flight run share the same
92
- * promise.
93
- *
94
- * Mount at `/retention`.
95
- */
96
36
  declare function createRetentionRouter(opts: HonoRouterOptions): Hono;
97
37
  interface RetentionLoopOptions {
98
38
  getConfig: () => DashboardConfig | Promise<DashboardConfig>;
99
39
  getStorage: () => ServerStorage | Promise<ServerStorage>;
100
40
  intervalMs?: number;
101
41
  }
102
- /**
103
- * Start a background loop that periodically runs the retention policy.
104
- * Returns a `stop()` function that clears the interval.
105
- *
106
- * Only useful on long-lived runtimes (Node, Bun, Deno). In serverless
107
- * runtimes (Workers, Lambda) use the platform's native scheduler
108
- * (Cron Triggers, CloudWatch Events) to call `POST /retention/retain`.
109
- */
110
42
  declare function startRetentionLoop(opts: RetentionLoopOptions): () => void;
111
43
 
112
44
  interface MountEngineOptions {
113
45
  storage?: ServerStorage;
114
- /**
115
- * Registry mapping connector type id (e.g. `'github-actions'`) to the
116
- * connector class. Used to instantiate connector implementations on
117
- * demand from the declarative entries in `DashboardConfig.connectors`.
118
- * Required for sync and retention to function.
119
- */
120
46
  connectorRegistry: ConnectorRegistry$1;
121
- /**
122
- * Resolves `secret('NAME')` markers in connector configs. Defaults to
123
- * `EnvSecretsResolver` (process.env lookup) inside connector
124
- * instantiation.
125
- */
126
47
  secretsResolver?: SecretsResolver$1;
127
- /**
128
- * Build a connector logger for the runner and each connector instance.
129
- * Called with `'runner'` for the sync-runner envelopes and with each
130
- * connector instance name for per-connector progress logs. Defaults to
131
- * a structured stdout logger.
132
- */
133
48
  loggerFactory?: ConnectorLoggerFactory;
134
- /** Set false to skip the background retention timer (e.g. on serverless). */
135
49
  startRetention?: boolean;
136
50
  }
137
51
  interface MountEngineResult {
138
52
  app: Hono;
139
53
  stop(): void;
140
54
  }
141
- /**
142
- * Convenience wrapper for the common case: builds a Hono app with all
143
- * standard rawdash routes mounted at their canonical paths, backed by
144
- * one `DashboardConfig` and one `ServerStorage` (defaults to
145
- * `InMemoryStorage`).
146
- *
147
- * For deployments that need auth or that look up config / storage per
148
- * request, skip this and compose the router factories directly with
149
- * per-request `getConfig` / `getStorage` and `before` middleware.
150
- */
151
55
  declare function mountEngine(config: DashboardConfig, options: MountEngineOptions): MountEngineResult;
152
56
 
153
57
  export { type HonoRouterOptions, type HonoStorageRouterOptions, type HonoWidgetsRouterOptions, type MountEngineOptions, type MountEngineResult, type RetentionLoopOptions, type SyncRouterOptions, createHealthRouter, createRetentionRouter, createSyncRouter, createSyncStateRouter, createWidgetsRouter, mountEngine, startRetentionLoop };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/health.ts","../src/sync.ts","../src/shared.ts","../src/widgets.ts","../src/retention.ts","../src/mount.ts"],"sourcesContent":["import { getHealth } from '@rawdash/server';\nimport { Hono } from 'hono';\n\n/**\n * Liveness probe — returns `{status:'ok'}` synchronously, no storage\n * access. Mount at `/health` (or wherever your platform's probe expects).\n */\nexport function createHealthRouter(): Hono {\n const app = new Hono();\n app.get('/', (c) => c.json(getHealth()));\n return app;\n}\n","import type { ConnectorRegistry, SecretsResolver } from '@rawdash/core';\nimport type { ConnectorLoggerFactory } from '@rawdash/server';\nimport { getSyncStateHandler, triggerSync } from '@rawdash/server';\nimport type { MiddlewareHandler } from 'hono';\nimport { Hono } from 'hono';\n\nimport type { HonoRouterOptions, HonoStorageRouterOptions } from './shared';\nimport { applyBefore, mapError } from './shared';\n\n/**\n * Options for `createSyncRouter`.\n *\n * `mode` defaults to `'in-process'`: the trigger handler kicks off\n * `runSync` in the background, iterating `config.connectors` and\n * instantiating each via `connectorRegistry`. In this mode both\n * `getConfig` and `connectorRegistry` are required.\n *\n * In `mode: 'deferred'`, the trigger handler only records the `queued`\n * transition; an external runner is responsible for `running →\n * succeeded/failed`. `getConfig` and `connectorRegistry` can be omitted\n * in this mode — useful when the deployment cannot materialize connector\n * implementations at request time (e.g. cloud, where the actual\n * `connector.sync(...)` call happens in a queue consumer worker).\n */\nexport type SyncRouterOptions =\n | (HonoRouterOptions & {\n mode?: 'in-process';\n connectorRegistry: ConnectorRegistry;\n secretsResolver?: SecretsResolver;\n loggerFactory?: ConnectorLoggerFactory;\n })\n | {\n mode: 'deferred';\n getStorage: HonoRouterOptions['getStorage'];\n getConfig?: HonoRouterOptions['getConfig'];\n before?: MiddlewareHandler[];\n };\n\n/**\n * `POST /` — triggers a sync, returning immediately with\n * `{queued: true|false}`. In `mode: 'in-process'` (default) the sync\n * runs in the background; in `mode: 'deferred'` the handler only\n * persists the `queued` transition and the external runner takes it\n * from there.\n *\n * Mount at `/sync`.\n */\nexport function createSyncRouter(opts: SyncRouterOptions): Hono {\n const app = new Hono();\n applyBefore(app, opts.before);\n app.post('/', async (c) => {\n try {\n if (opts.mode === 'deferred') {\n const getConfig = opts.getConfig;\n return c.json(\n await triggerSync(\n {\n getStorage: () => opts.getStorage(c),\n getConfig: getConfig ? () => getConfig(c) : undefined,\n },\n { mode: 'deferred' },\n ),\n );\n }\n return c.json(\n await triggerSync({\n getStorage: () => opts.getStorage(c),\n getConfig: () => opts.getConfig(c),\n connectorRegistry: opts.connectorRegistry,\n secretsResolver: opts.secretsResolver,\n loggerFactory: opts.loggerFactory,\n }),\n );\n } catch (err) {\n return mapError(c, err);\n }\n });\n return app;\n}\n\n/**\n * `GET /` — returns the current `SyncState`. Mount at `/sync/state`.\n */\nexport function createSyncStateRouter(opts: HonoStorageRouterOptions): Hono {\n const app = new Hono();\n applyBefore(app, opts.before);\n app.get('/', async (c) => {\n try {\n return c.json(\n await getSyncStateHandler({\n getConfig: () => {\n throw new Error('getConfig should not be called by sync-state');\n },\n getStorage: () => opts.getStorage(c),\n }),\n );\n } catch (err) {\n return mapError(c, err);\n }\n });\n return app;\n}\n","import type { EngineContext } from '@rawdash/server';\nimport type { DashboardConfig, ServerStorage } from '@rawdash/server';\nimport { isRawdashError } from '@rawdash/server';\nimport type { Context, MiddlewareHandler } from 'hono';\nimport { Hono } from 'hono';\n\n/**\n * Common options accepted by every `@rawdash/hono` router factory.\n *\n * `getConfig` / `getStorage` are invoked per-request with the Hono\n * `Context`, so adapters can derive the config or storage from request\n * state (e.g. a path parameter, an id attached by an auth middleware, or\n * environment bindings).\n *\n * `before` middleware runs before any handler — typically auth/scope\n * checks.\n */\nexport interface HonoRouterOptions {\n getConfig: (c: Context) => DashboardConfig | Promise<DashboardConfig>;\n getStorage: (c: Context) => ServerStorage | Promise<ServerStorage>;\n before?: MiddlewareHandler[];\n}\n\nexport interface HonoStorageRouterOptions {\n getStorage: (c: Context) => ServerStorage | Promise<ServerStorage>;\n before?: MiddlewareHandler[];\n}\n\nexport function makeEngineContext(\n c: Context,\n opts: HonoRouterOptions,\n): EngineContext {\n return {\n getConfig: () => opts.getConfig(c),\n getStorage: () => opts.getStorage(c),\n };\n}\n\nexport function applyBefore(app: Hono, before?: MiddlewareHandler[]): void {\n if (!before) {\n return;\n }\n for (const mw of before) {\n app.use('*', mw);\n }\n}\n\n/**\n * Translate a thrown error into a Hono JSON response. `RawdashError`\n * becomes a structured `{error, code}` body at the carried status; any\n * other error is re-thrown for Hono's own error handling.\n */\nexport function mapError(c: Context, err: unknown): Response {\n if (isRawdashError(err)) {\n return c.json(\n { error: err.message, code: err.code },\n err.status as Parameters<typeof c.json>[1],\n );\n }\n throw err;\n}\n","import type { WidgetCache } from '@rawdash/server';\nimport { getWidget, listWidgets } from '@rawdash/server';\nimport type { Context } from 'hono';\nimport { Hono } from 'hono';\n\nimport type { HonoRouterOptions } from './shared';\nimport { applyBefore, makeEngineContext, mapError } from './shared';\n\nexport interface HonoWidgetsRouterOptions extends HonoRouterOptions {\n /**\n * Optional per-request factory returning a `WidgetCache`. Invoked once\n * per request so the cache can be scoped to the request's tenant/auth\n * context. When omitted, widgets are resolved fresh on every request.\n */\n cache?: (c: Context) => WidgetCache;\n}\n\n/**\n * - `GET /:dashboardId/widgets` → `WidgetsListResponse`\n * - `GET /:dashboardId/widgets/:widgetId` → `CachedWidget`\n *\n * Mount at `/dashboards`.\n */\nexport function createWidgetsRouter(opts: HonoWidgetsRouterOptions): Hono {\n const app = new Hono();\n applyBefore(app, opts.before);\n\n app.get('/:dashboardId/widgets', async (c) => {\n try {\n return c.json(\n await listWidgets(\n makeEngineContext(c, opts),\n c.req.param('dashboardId'),\n opts.cache?.(c),\n ),\n );\n } catch (err) {\n return mapError(c, err);\n }\n });\n\n app.get('/:dashboardId/widgets/:widgetId', async (c) => {\n try {\n const result = await getWidget(\n makeEngineContext(c, opts),\n c.req.param('dashboardId'),\n c.req.param('widgetId'),\n {\n cache: opts.cache?.(c),\n ifNoneMatch: c.req.header('if-none-match'),\n },\n );\n if (result.status === 'not-modified') {\n c.header('ETag', result.etag);\n return c.body(null, 304);\n }\n if (result.etag) {\n c.header('ETag', result.etag);\n }\n return c.json(result.widget);\n } catch (err) {\n return mapError(c, err);\n }\n });\n\n return app;\n}\n","import type { DashboardConfig, ServerStorage } from '@rawdash/server';\nimport {\n DEFAULT_RETENTION_INTERVAL_MS,\n hasPruningPolicy,\n runRetention,\n runRetentionOnce,\n} from '@rawdash/server';\nimport { Hono } from 'hono';\n\nimport type { HonoRouterOptions } from './shared';\nimport { applyBefore, makeEngineContext, mapError } from './shared';\n\n/**\n * `POST /retain` — runs the retention policy once. Coalesces concurrent\n * calls so multiple requests during an in-flight run share the same\n * promise.\n *\n * Mount at `/retention`.\n */\nexport function createRetentionRouter(opts: HonoRouterOptions): Hono {\n const app = new Hono();\n applyBefore(app, opts.before);\n\n let inFlight: Promise<void> | null = null;\n\n app.post('/retain', async (c) => {\n try {\n if (!inFlight) {\n const ctx = makeEngineContext(c, opts);\n inFlight = runRetentionOnce(ctx).finally(() => {\n inFlight = null;\n });\n }\n await inFlight;\n return c.json({ triggered: true });\n } catch (err) {\n console.error('retention run failed', err);\n return mapError(c, err);\n }\n });\n\n return app;\n}\n\nexport interface RetentionLoopOptions {\n getConfig: () => DashboardConfig | Promise<DashboardConfig>;\n getStorage: () => ServerStorage | Promise<ServerStorage>;\n intervalMs?: number;\n}\n\n/**\n * Start a background loop that periodically runs the retention policy.\n * Returns a `stop()` function that clears the interval.\n *\n * Only useful on long-lived runtimes (Node, Bun, Deno). In serverless\n * runtimes (Workers, Lambda) use the platform's native scheduler\n * (Cron Triggers, CloudWatch Events) to call `POST /retention/retain`.\n */\nexport function startRetentionLoop(opts: RetentionLoopOptions): () => void {\n let stopped = false;\n let inFlight: Promise<void> | null = null;\n let timer: ReturnType<typeof setInterval> | null = null;\n\n const tick = async (): Promise<void> => {\n if (inFlight || stopped) {\n return;\n }\n try {\n const config = await opts.getConfig();\n if (!config.retention || !hasPruningPolicy(config.retention)) {\n return;\n }\n const storage = await opts.getStorage();\n inFlight = runRetention(config, storage).finally(() => {\n inFlight = null;\n });\n await inFlight;\n } catch (err) {\n console.error('retention run failed', err);\n }\n };\n\n void (async () => {\n try {\n const config = await opts.getConfig();\n if (!config.retention || !hasPruningPolicy(config.retention)) {\n return;\n }\n // Re-check `stopped` after the async getConfig in case stop()\n // was called while we were awaiting it.\n if (stopped) {\n return;\n }\n const intervalMs =\n opts.intervalMs ??\n config.retention.intervalMs ??\n DEFAULT_RETENTION_INTERVAL_MS;\n const created = setInterval(() => {\n void tick();\n }, intervalMs);\n // Race with stop(): if stop() ran between the check above and\n // setInterval, clear it immediately rather than leaving a\n // lingering timer behind.\n if (stopped) {\n clearInterval(created);\n } else {\n timer = created;\n }\n } catch (err) {\n console.error('retention loop startup failed', err);\n }\n })();\n\n return () => {\n stopped = true;\n if (timer !== null) {\n clearInterval(timer);\n timer = null;\n }\n };\n}\n","import type {\n ConnectorLoggerFactory,\n ConnectorRegistry,\n DashboardConfig,\n SecretsResolver,\n ServerStorage,\n} from '@rawdash/server';\nimport { InMemoryStorage, ROUTES } from '@rawdash/server';\nimport { Hono } from 'hono';\n\nimport { createHealthRouter } from './health';\nimport { createRetentionRouter, startRetentionLoop } from './retention';\nimport { createSyncRouter, createSyncStateRouter } from './sync';\nimport { createWidgetsRouter } from './widgets';\n\nexport interface MountEngineOptions {\n storage?: ServerStorage;\n /**\n * Registry mapping connector type id (e.g. `'github-actions'`) to the\n * connector class. Used to instantiate connector implementations on\n * demand from the declarative entries in `DashboardConfig.connectors`.\n * Required for sync and retention to function.\n */\n connectorRegistry: ConnectorRegistry;\n /**\n * Resolves `secret('NAME')` markers in connector configs. Defaults to\n * `EnvSecretsResolver` (process.env lookup) inside connector\n * instantiation.\n */\n secretsResolver?: SecretsResolver;\n /**\n * Build a connector logger for the runner and each connector instance.\n * Called with `'runner'` for the sync-runner envelopes and with each\n * connector instance name for per-connector progress logs. Defaults to\n * a structured stdout logger.\n */\n loggerFactory?: ConnectorLoggerFactory;\n /** Set false to skip the background retention timer (e.g. on serverless). */\n startRetention?: boolean;\n}\n\nexport interface MountEngineResult {\n app: Hono;\n stop(): void;\n}\n\n/**\n * Convenience wrapper for the common case: builds a Hono app with all\n * standard rawdash routes mounted at their canonical paths, backed by\n * one `DashboardConfig` and one `ServerStorage` (defaults to\n * `InMemoryStorage`).\n *\n * For deployments that need auth or that look up config / storage per\n * request, skip this and compose the router factories directly with\n * per-request `getConfig` / `getStorage` and `before` middleware.\n */\nexport function mountEngine(\n config: DashboardConfig,\n options: MountEngineOptions,\n): MountEngineResult {\n const storage: ServerStorage = options.storage ?? new InMemoryStorage();\n const { connectorRegistry, secretsResolver, loggerFactory } = options;\n const getConfig = (): DashboardConfig => config;\n const getStorage = (): ServerStorage => storage;\n\n const app = new Hono();\n app.route('/dashboards', createWidgetsRouter({ getConfig, getStorage }));\n app.route(\n ROUTES.sync,\n createSyncRouter({\n getConfig,\n getStorage,\n connectorRegistry,\n secretsResolver,\n loggerFactory,\n }),\n );\n app.route(ROUTES.syncState, createSyncStateRouter({ getStorage }));\n app.route('/retention', createRetentionRouter({ getConfig, getStorage }));\n app.route(ROUTES.health, createHealthRouter());\n\n let stopRetention: (() => void) | null = null;\n if (options.startRetention !== false) {\n stopRetention = startRetentionLoop({ getConfig, getStorage });\n }\n\n return {\n app,\n stop() {\n if (stopRetention) {\n stopRetention();\n }\n },\n };\n}\n"],"mappings":";AAAA,SAAS,iBAAiB;AAC1B,SAAS,YAAY;AAMd,SAAS,qBAA2B;AACzC,QAAM,MAAM,IAAI,KAAK;AACrB,MAAI,IAAI,KAAK,CAAC,MAAM,EAAE,KAAK,UAAU,CAAC,CAAC;AACvC,SAAO;AACT;;;ACTA,SAAS,qBAAqB,mBAAmB;AAEjD,SAAS,QAAAA,aAAY;;;ACFrB,SAAS,sBAAsB;AA0BxB,SAAS,kBACd,GACA,MACe;AACf,SAAO;AAAA,IACL,WAAW,MAAM,KAAK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AO;AACpC,oBAAgB,mBAAmB,EAAE,WAAW,WAAW,CAAC;AAAA,EAC9D;AAEA,SAAO;AAAA,IACL;AAAA,IACA,OAAO;AACL,UAAI,eAAe;AACjB,sBAAc;AAAA,MAChB;AAAA,IACF;AAAA,EACF;AACF;","names":["Hono","Hono","Hono","Hono","Hono","Hono","Hono","Hono"]}
1
+ {"version":3,"sources":["../src/health.ts","../src/sync.ts","../src/shared.ts","../src/widgets.ts","../src/retention.ts","../src/mount.ts"],"sourcesContent":["import { getHealth } from '@rawdash/server';\nimport { Hono } from 'hono';\n\nexport function createHealthRouter(): Hono {\n const app = new Hono();\n app.get('/', (c) => c.json(getHealth()));\n return app;\n}\n","import type { ConnectorRegistry, SecretsResolver } from '@rawdash/core';\nimport type { ConnectorLoggerFactory } from '@rawdash/server';\nimport { getSyncStateHandler, triggerSync } from '@rawdash/server';\nimport type { MiddlewareHandler } from 'hono';\nimport { Hono } from 'hono';\n\nimport type { HonoRouterOptions, HonoStorageRouterOptions } from './shared';\nimport { applyBefore, mapError } from './shared';\n\nexport type SyncRouterOptions =\n | (HonoRouterOptions & {\n mode?: 'in-process';\n connectorRegistry: ConnectorRegistry;\n secretsResolver?: SecretsResolver;\n loggerFactory?: ConnectorLoggerFactory;\n })\n | {\n mode: 'deferred';\n getStorage: HonoRouterOptions['getStorage'];\n getConfig?: HonoRouterOptions['getConfig'];\n before?: MiddlewareHandler[];\n };\n\nexport function createSyncRouter(opts: SyncRouterOptions): Hono {\n const app = new Hono();\n applyBefore(app, opts.before);\n app.post('/', async (c) => {\n try {\n if (opts.mode === 'deferred') {\n const getConfig = opts.getConfig;\n return c.json(\n await triggerSync(\n {\n getStorage: () => opts.getStorage(c),\n getConfig: getConfig ? () => getConfig(c) : undefined,\n },\n { mode: 'deferred' },\n ),\n );\n }\n return c.json(\n await triggerSync({\n getStorage: () => opts.getStorage(c),\n getConfig: () => opts.getConfig(c),\n connectorRegistry: opts.connectorRegistry,\n secretsResolver: opts.secretsResolver,\n loggerFactory: opts.loggerFactory,\n }),\n );\n } catch (err) {\n return mapError(c, err);\n }\n });\n return app;\n}\n\nexport function createSyncStateRouter(opts: HonoStorageRouterOptions): Hono {\n const app = new Hono();\n applyBefore(app, opts.before);\n app.get('/', async (c) => {\n try {\n return c.json(\n await getSyncStateHandler({\n getConfig: () => {\n throw new Error('getConfig should not be called by sync-state');\n },\n getStorage: () => opts.getStorage(c),\n }),\n );\n } catch (err) {\n return mapError(c, err);\n }\n });\n return app;\n}\n","import type { EngineContext } from '@rawdash/server';\nimport type { DashboardConfig, ServerStorage } from '@rawdash/server';\nimport { isRawdashError } from '@rawdash/server';\nimport type { Context, MiddlewareHandler } from 'hono';\nimport { Hono } from 'hono';\n\nexport interface HonoRouterOptions {\n getConfig: (c: Context) => DashboardConfig | Promise<DashboardConfig>;\n getStorage: (c: Context) => ServerStorage | Promise<ServerStorage>;\n before?: MiddlewareHandler[];\n}\n\nexport interface HonoStorageRouterOptions {\n getStorage: (c: Context) => ServerStorage | Promise<ServerStorage>;\n before?: MiddlewareHandler[];\n}\n\nexport function makeEngineContext(\n c: Context,\n opts: HonoRouterOptions,\n): EngineContext {\n return {\n getConfig: () => opts.getConfig(c),\n getStorage: () => opts.getStorage(c),\n };\n}\n\nexport function applyBefore(app: Hono, before?: MiddlewareHandler[]): void {\n if (!before) {\n return;\n }\n for (const mw of before) {\n app.use('*', mw);\n }\n}\n\nexport function mapError(c: Context, err: unknown): Response {\n if (isRawdashError(err)) {\n return c.json(\n { error: err.message, code: err.code },\n err.status as Parameters<typeof c.json>[1],\n );\n }\n throw err;\n}\n","import type { WidgetCache } from '@rawdash/server';\nimport { getWidget, listWidgets } from '@rawdash/server';\nimport type { Context } from 'hono';\nimport { Hono } from 'hono';\n\nimport type { HonoRouterOptions } from './shared';\nimport { applyBefore, makeEngineContext, mapError } from './shared';\n\nexport interface HonoWidgetsRouterOptions extends HonoRouterOptions {\n cache?: (c: Context) => WidgetCache;\n}\n\nexport function createWidgetsRouter(opts: HonoWidgetsRouterOptions): Hono {\n const app = new Hono();\n applyBefore(app, opts.before);\n\n app.get('/:dashboardId/widgets', async (c) => {\n try {\n return c.json(\n await listWidgets(\n makeEngineContext(c, opts),\n c.req.param('dashboardId'),\n opts.cache?.(c),\n ),\n );\n } catch (err) {\n return mapError(c, err);\n }\n });\n\n app.get('/:dashboardId/widgets/:widgetId', async (c) => {\n try {\n const result = await getWidget(\n makeEngineContext(c, opts),\n c.req.param('dashboardId'),\n c.req.param('widgetId'),\n {\n cache: opts.cache?.(c),\n ifNoneMatch: c.req.header('if-none-match'),\n },\n );\n if (result.status === 'not-modified') {\n c.header('ETag', result.etag);\n return c.body(null, 304);\n }\n if (result.etag) {\n c.header('ETag', result.etag);\n }\n return c.json(result.widget);\n } catch (err) {\n return mapError(c, err);\n }\n });\n\n return app;\n}\n","import type { DashboardConfig, ServerStorage } from '@rawdash/server';\nimport {\n DEFAULT_RETENTION_INTERVAL_MS,\n hasPruningPolicy,\n runRetention,\n runRetentionOnce,\n} from '@rawdash/server';\nimport { Hono } from 'hono';\n\nimport type { HonoRouterOptions } from './shared';\nimport { applyBefore, makeEngineContext, mapError } from './shared';\n\nexport function createRetentionRouter(opts: HonoRouterOptions): Hono {\n const app = new Hono();\n applyBefore(app, opts.before);\n\n let inFlight: Promise<void> | null = null;\n\n app.post('/retain', async (c) => {\n try {\n if (!inFlight) {\n const ctx = makeEngineContext(c, opts);\n inFlight = runRetentionOnce(ctx).finally(() => {\n inFlight = null;\n });\n }\n await inFlight;\n return c.json({ triggered: true });\n } catch (err) {\n console.error('retention run failed', err);\n return mapError(c, err);\n }\n });\n\n return app;\n}\n\nexport interface RetentionLoopOptions {\n getConfig: () => DashboardConfig | Promise<DashboardConfig>;\n getStorage: () => ServerStorage | Promise<ServerStorage>;\n intervalMs?: number;\n}\n\nexport function startRetentionLoop(opts: RetentionLoopOptions): () => void {\n let stopped = false;\n let inFlight: Promise<void> | null = null;\n let timer: ReturnType<typeof setInterval> | null = null;\n\n const tick = async (): Promise<void> => {\n if (inFlight || stopped) {\n return;\n }\n try {\n const config = await opts.getConfig();\n if (!config.retention || !hasPruningPolicy(config.retention)) {\n return;\n }\n const storage = await opts.getStorage();\n inFlight = runRetention(config, storage).finally(() => {\n inFlight = null;\n });\n await inFlight;\n } catch (err) {\n console.error('retention run failed', err);\n }\n };\n\n void (async () => {\n try {\n const config = await opts.getConfig();\n if (!config.retention || !hasPruningPolicy(config.retention)) {\n return;\n }\n if (stopped) {\n return;\n }\n const intervalMs =\n opts.intervalMs ??\n config.retention.intervalMs ??\n DEFAULT_RETENTION_INTERVAL_MS;\n const created = setInterval(() => {\n void tick();\n }, intervalMs);\n if (stopped) {\n clearInterval(created);\n } else {\n timer = created;\n }\n } catch (err) {\n console.error('retention loop startup failed', err);\n }\n })();\n\n return () => {\n stopped = true;\n if (timer !== null) {\n clearInterval(timer);\n timer = null;\n }\n };\n}\n","import type {\n ConnectorLoggerFactory,\n ConnectorRegistry,\n DashboardConfig,\n SecretsResolver,\n ServerStorage,\n} from '@rawdash/server';\nimport { InMemoryStorage, ROUTES } from '@rawdash/server';\nimport { Hono } from 'hono';\n\nimport { createHealthRouter } from './health';\nimport { createRetentionRouter, startRetentionLoop } from './retention';\nimport { createSyncRouter, createSyncStateRouter } from './sync';\nimport { createWidgetsRouter } from './widgets';\n\nexport interface MountEngineOptions {\n storage?: ServerStorage;\n connectorRegistry: ConnectorRegistry;\n secretsResolver?: SecretsResolver;\n loggerFactory?: ConnectorLoggerFactory;\n startRetention?: boolean;\n}\n\nexport interface MountEngineResult {\n app: Hono;\n stop(): void;\n}\n\nexport function mountEngine(\n config: DashboardConfig,\n options: MountEngineOptions,\n): MountEngineResult {\n const storage: ServerStorage = options.storage ?? new InMemoryStorage();\n const { connectorRegistry, secretsResolver, loggerFactory } = options;\n const getConfig = (): DashboardConfig => config;\n const getStorage = (): ServerStorage => storage;\n\n const app = new Hono();\n app.route('/dashboards', createWidgetsRouter({ getConfig, getStorage }));\n app.route(\n ROUTES.sync,\n createSyncRouter({\n getConfig,\n getStorage,\n connectorRegistry,\n secretsResolver,\n loggerFactory,\n }),\n );\n app.route(ROUTES.syncState, createSyncStateRouter({ getStorage }));\n app.route('/retention', createRetentionRouter({ getConfig, getStorage }));\n app.route(ROUTES.health, createHealthRouter());\n\n let stopRetention: (() => void) | null = null;\n if (options.startRetention !== false) {\n stopRetention = startRetentionLoop({ getConfig, getStorage });\n }\n\n return {\n app,\n stop() {\n if (stopRetention) {\n stopRetention();\n }\n },\n };\n}\n"],"mappings":";AAAA,SAAS,iBAAiB;AAC1B,SAAS,YAAY;AAEd,SAAS,qBAA2B;AACzC,QAAM,MAAM,IAAI,KAAK;AACrB,MAAI,IAAI,KAAK,CAAC,MAAM,EAAE,KAAK,UAAU,CAAC,CAAC;AACvC,SAAO;AACT;;;ACLA,SAAS,qBAAqB,mBAAmB;AAEjD,SAAS,QAAAA,aAAY;;;ACFrB,SAAS,sBAAsB;AAexB,SAAS,kBACd,GACA,MACe;AACf,SAAO;AAAA,IACL,WAAW,MAAM,KAAK,UAAU,CAAC;AAAA,IACjC,YAAY,MAAM,KAAK,WAAW,CAAC;AAAA,EACrC;AACF;AAEO,SAAS,YAAY,KAAW,QAAoC;AACzE,MAAI,CAAC,QAAQ;AACX;AAAA,EACF;AACA,aAAW,MAAM,QAAQ;AACvB,QAAI,IAAI,KAAK,EAAE;AAAA,EACjB;AACF;AAEO,SAAS,SAAS,GAAY,KAAwB;AAC3D,MAAI,eAAe,GAAG,GAAG;AACvB,WAAO,EAAE;AAAA,MACP,EAAE,OAAO,IAAI,SAAS,MAAM,IAAI,KAAK;AAAA,MACrC,IAAI;AAAA,IACN;AAAA,EACF;AACA,QAAM;AACR;;;ADrBO,SAAS,iBAAiB,MAA+B;AAC9D,QAAM,MAAM,IAAIC,MAAK;AACrB,cAAY,KAAK,KAAK,MAAM;AAC5B,MAAI,KAAK,KAAK,OAAO,MAAM;AACzB,QAAI;AACF,UAAI,KAAK,SAAS,YAAY;A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AAc;AACxC,SAAS,QAAAC,aAAY;AAoBd,SAAS,YACd,QACA,SACmB;AACnB,QAAM,UAAyB,QAAQ,WAAW,IAAI,gBAAgB;AACtE,QAAM,EAAE,mBAAmB,iBAAiB,cAAc,IAAI;AAC9D,QAAM,YAAY,MAAuB;AACzC,QAAM,aAAa,MAAqB;AAExC,QAAM,MAAM,IAAIC,MAAK;AACrB,MAAI,MAAM,eAAe,oBAAoB,EAAE,WAAW,WAAW,CAAC,CAAC;AACvE,MAAI;AAAA,IACF,OAAO;AAAA,IACP,iBAAiB;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AACA,MAAI,MAAM,OAAO,WAAW,sBAAsB,EAAE,WAAW,CAAC,CAAC;AACjE,MAAI,MAAM,cAAc,sBAAsB,EAAE,WAAW,WAAW,CAAC,CAAC;AACxE,MAAI,MAAM,OAAO,QAAQ,mBAAmB,CAAC;AAE7C,MAAI,gBAAqC;AACzC,MAAI,QAAQ,mBAAmB,OAAO;AACpC,oBAAgB,mBAAmB,EAAE,WAAW,WAAW,CAAC;AAAA,EAC9D;AAEA,SAAO;AAAA,IACL;AAAA,IACA,OAAO;AACL,UAAI,eAAe;AACjB,sBAAc;AAAA,MAChB;AAAA,IACF;AAAA,EACF;AACF;","names":["Hono","Hono","Hono","Hono","Hono","Hono","Hono","Hono"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rawdash/hono",
3
- "version": "0.18.0",
3
+ "version": "0.20.0",
4
4
  "description": "Hono adapter for rawdash — router factories and helpers that mount @rawdash/server handlers onto a Hono app. Runtime-agnostic (Workers, Node, Bun, Deno).",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -25,8 +25,8 @@
25
25
  "hono": "^4.0.0"
26
26
  },
27
27
  "dependencies": {
28
- "@rawdash/core": "0.18.0",
29
- "@rawdash/server": "0.18.0"
28
+ "@rawdash/core": "0.20.0",
29
+ "@rawdash/server": "0.20.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "hono": "^4.7.7",