@rawdash/hono 0.13.0 → 0.15.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/LICENSE +202 -0
- package/README.md +47 -2
- package/dist/index.d.ts +56 -6
- package/dist/index.js +62 -20
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -111,6 +111,51 @@ export default app;
|
|
|
111
111
|
|
|
112
112
|
The pure handlers in `@rawdash/server` do all the work; this package only translates HTTP. Adapters in other frameworks (Express, NestJS, etc.) would be a parallel thin layer over the same handlers.
|
|
113
113
|
|
|
114
|
+
## Widget cache (optional)
|
|
115
|
+
|
|
116
|
+
`createWidgetsRouter` accepts an optional `cache: (c: Context) => WidgetCache` factory. It is invoked once per request, so the returned cache can be scoped to the request's tenant / auth context:
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
import { createWidgetsRouter } from '@rawdash/hono';
|
|
120
|
+
|
|
121
|
+
app.route(
|
|
122
|
+
'/dashboards',
|
|
123
|
+
createWidgetsRouter({
|
|
124
|
+
getConfig: (c) => loadConfig(c),
|
|
125
|
+
getStorage: (c) => loadStorage(c),
|
|
126
|
+
cache: (c) => new MyKvWidgetCache(c.env, c.get('orgId')),
|
|
127
|
+
}),
|
|
128
|
+
);
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
See the `WidgetCache` section in [`@rawdash/server`](https://www.npmjs.com/package/@rawdash/server) for the interface and error-isolation semantics. Omit `cache` and behavior is identical to the no-cache path.
|
|
132
|
+
|
|
133
|
+
## Deferred sync mode (queue-backed runners)
|
|
134
|
+
|
|
135
|
+
By default `createSyncRouter` runs the sync **in-process**: the handler records the `queued` transition and then kicks off `runSync(config, storage)` as a background promise that iterates `config.connectors`.
|
|
136
|
+
|
|
137
|
+
For deployments where the actual sync work runs **out-of-process** — typically a queue/worker setup where credentials, retries, and rate-limit budgets live in a separate runtime — pass `mode: 'deferred'`. The trigger handler then only persists the `queued` transition; the `running → succeeded/failed` transitions become the storage's responsibility, driven by the external runner:
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
authedApp.route(
|
|
141
|
+
'/sync',
|
|
142
|
+
createSyncRouter({
|
|
143
|
+
mode: 'deferred',
|
|
144
|
+
before: [assertScope('widgets:write')],
|
|
145
|
+
getStorage: (c) => loadStorage(c),
|
|
146
|
+
// getConfig can be omitted in deferred mode — useful when you can't
|
|
147
|
+
// materialize OSS-format Connector instances at request time.
|
|
148
|
+
}),
|
|
149
|
+
);
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
In deferred mode:
|
|
153
|
+
|
|
154
|
+
- `runSync` is **never** invoked by the trigger handler.
|
|
155
|
+
- `getConfig` is optional and never called.
|
|
156
|
+
- `markSyncQueued` is called exactly as in in-process mode; its return value drives the `{queued: true|false}` response.
|
|
157
|
+
- Your external worker is responsible for calling `markSyncRunning`, `markSyncSucceeded`, and `markSyncFailed` on the same storage.
|
|
158
|
+
|
|
114
159
|
## Running on Node
|
|
115
160
|
|
|
116
161
|
`@rawdash/hono` does **not** depend on `@hono/node-server` — the package stays runtime-agnostic so a Workers bundle doesn't pull Node-specific code. To run on Node, add `@hono/node-server` yourself:
|
|
@@ -137,8 +182,8 @@ Handler errors translate to JSON:
|
|
|
137
182
|
## Links
|
|
138
183
|
|
|
139
184
|
- [rawdash docs](https://rawdash.dev)
|
|
140
|
-
- [`@rawdash/server`](
|
|
141
|
-
- [`@rawdash/client`](
|
|
185
|
+
- [`@rawdash/server`](https://www.npmjs.com/package/@rawdash/server) — pure handlers + engine (the package this wraps)
|
|
186
|
+
- [`@rawdash/client`](https://www.npmjs.com/package/@rawdash/client) — typed HTTP client (speaks the same wire contract)
|
|
142
187
|
- [GitHub](https://github.com/rawdash/rawdash)
|
|
143
188
|
- [Issues](https://github.com/rawdash/rawdash/issues)
|
|
144
189
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { DashboardConfig, ServerStorage } from '@rawdash/server';
|
|
1
|
+
import { DashboardConfig, ServerStorage, WidgetCache, ConnectorRegistry as ConnectorRegistry$1, SecretsResolver as SecretsResolver$1 } from '@rawdash/server';
|
|
2
2
|
import { Context, MiddlewareHandler, Hono } from 'hono';
|
|
3
|
+
import { ConnectorRegistry, SecretsResolver } from '@rawdash/core';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Common options accepted by every `@rawdash/hono` router factory.
|
|
@@ -28,25 +29,61 @@ interface HonoStorageRouterOptions {
|
|
|
28
29
|
*/
|
|
29
30
|
declare function createHealthRouter(): Hono;
|
|
30
31
|
|
|
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
|
+
type SyncRouterOptions = (HonoRouterOptions & {
|
|
48
|
+
mode?: 'in-process';
|
|
49
|
+
connectorRegistry: ConnectorRegistry;
|
|
50
|
+
secretsResolver?: SecretsResolver;
|
|
51
|
+
}) | {
|
|
52
|
+
mode: 'deferred';
|
|
53
|
+
getStorage: HonoRouterOptions['getStorage'];
|
|
54
|
+
getConfig?: HonoRouterOptions['getConfig'];
|
|
55
|
+
before?: MiddlewareHandler[];
|
|
56
|
+
};
|
|
31
57
|
/**
|
|
32
58
|
* `POST /` — triggers a sync, returning immediately with
|
|
33
|
-
* `{queued: true|false}`.
|
|
59
|
+
* `{queued: true|false}`. In `mode: 'in-process'` (default) the sync
|
|
60
|
+
* runs in the background; in `mode: 'deferred'` the handler only
|
|
61
|
+
* persists the `queued` transition and the external runner takes it
|
|
62
|
+
* from there.
|
|
34
63
|
*
|
|
35
64
|
* Mount at `/sync`.
|
|
36
65
|
*/
|
|
37
|
-
declare function createSyncRouter(opts:
|
|
66
|
+
declare function createSyncRouter(opts: SyncRouterOptions): Hono;
|
|
38
67
|
/**
|
|
39
68
|
* `GET /` — returns the current `SyncState`. Mount at `/sync/state`.
|
|
40
69
|
*/
|
|
41
70
|
declare function createSyncStateRouter(opts: HonoStorageRouterOptions): Hono;
|
|
42
71
|
|
|
72
|
+
interface HonoWidgetsRouterOptions extends HonoRouterOptions {
|
|
73
|
+
/**
|
|
74
|
+
* Optional per-request factory returning a `WidgetCache`. Invoked once
|
|
75
|
+
* per request so the cache can be scoped to the request's tenant/auth
|
|
76
|
+
* context. When omitted, widgets are resolved fresh on every request.
|
|
77
|
+
*/
|
|
78
|
+
cache?: (c: Context) => WidgetCache;
|
|
79
|
+
}
|
|
43
80
|
/**
|
|
44
81
|
* - `GET /:dashboardId/widgets` → `WidgetsListResponse`
|
|
45
82
|
* - `GET /:dashboardId/widgets/:widgetId` → `CachedWidget`
|
|
46
83
|
*
|
|
47
84
|
* Mount at `/dashboards`.
|
|
48
85
|
*/
|
|
49
|
-
declare function createWidgetsRouter(opts:
|
|
86
|
+
declare function createWidgetsRouter(opts: HonoWidgetsRouterOptions): Hono;
|
|
50
87
|
|
|
51
88
|
/**
|
|
52
89
|
* `POST /retain` — runs the retention policy once. Coalesces concurrent
|
|
@@ -73,6 +110,19 @@ declare function startRetentionLoop(opts: RetentionLoopOptions): () => void;
|
|
|
73
110
|
|
|
74
111
|
interface MountEngineOptions {
|
|
75
112
|
storage?: ServerStorage;
|
|
113
|
+
/**
|
|
114
|
+
* Registry mapping connector type id (e.g. `'github-actions'`) to the
|
|
115
|
+
* connector class. Used to instantiate connector implementations on
|
|
116
|
+
* demand from the declarative entries in `DashboardConfig.connectors`.
|
|
117
|
+
* Required for sync and retention to function.
|
|
118
|
+
*/
|
|
119
|
+
connectorRegistry: ConnectorRegistry$1;
|
|
120
|
+
/**
|
|
121
|
+
* Resolves `secret('NAME')` markers in connector configs. Defaults to
|
|
122
|
+
* `EnvSecretsResolver` (process.env lookup) inside connector
|
|
123
|
+
* instantiation.
|
|
124
|
+
*/
|
|
125
|
+
secretsResolver?: SecretsResolver$1;
|
|
76
126
|
/** Set false to skip the background retention timer (e.g. on serverless). */
|
|
77
127
|
startRetention?: boolean;
|
|
78
128
|
}
|
|
@@ -90,6 +140,6 @@ interface MountEngineResult {
|
|
|
90
140
|
* request, skip this and compose the router factories directly with
|
|
91
141
|
* per-request `getConfig` / `getStorage` and `before` middleware.
|
|
92
142
|
*/
|
|
93
|
-
declare function mountEngine(config: DashboardConfig, options
|
|
143
|
+
declare function mountEngine(config: DashboardConfig, options: MountEngineOptions): MountEngineResult;
|
|
94
144
|
|
|
95
|
-
export { type HonoRouterOptions, type HonoStorageRouterOptions, type MountEngineOptions, type MountEngineResult, type RetentionLoopOptions, createHealthRouter, createRetentionRouter, createSyncRouter, createSyncStateRouter, createWidgetsRouter, mountEngine, startRetentionLoop };
|
|
145
|
+
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
CHANGED
|
@@ -43,7 +43,26 @@ function createSyncRouter(opts) {
|
|
|
43
43
|
applyBefore(app, opts.before);
|
|
44
44
|
app.post("/", async (c) => {
|
|
45
45
|
try {
|
|
46
|
-
|
|
46
|
+
if (opts.mode === "deferred") {
|
|
47
|
+
const getConfig = opts.getConfig;
|
|
48
|
+
return c.json(
|
|
49
|
+
await triggerSync(
|
|
50
|
+
{
|
|
51
|
+
getStorage: () => opts.getStorage(c),
|
|
52
|
+
getConfig: getConfig ? () => getConfig(c) : void 0
|
|
53
|
+
},
|
|
54
|
+
{ mode: "deferred" }
|
|
55
|
+
)
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
return c.json(
|
|
59
|
+
await triggerSync({
|
|
60
|
+
getStorage: () => opts.getStorage(c),
|
|
61
|
+
getConfig: () => opts.getConfig(c),
|
|
62
|
+
connectorRegistry: opts.connectorRegistry,
|
|
63
|
+
secretsResolver: opts.secretsResolver
|
|
64
|
+
})
|
|
65
|
+
);
|
|
47
66
|
} catch (err) {
|
|
48
67
|
return mapError(c, err);
|
|
49
68
|
}
|
|
@@ -81,7 +100,8 @@ function createWidgetsRouter(opts) {
|
|
|
81
100
|
return c.json(
|
|
82
101
|
await listWidgets(
|
|
83
102
|
makeEngineContext(c, opts),
|
|
84
|
-
c.req.param("dashboardId")
|
|
103
|
+
c.req.param("dashboardId"),
|
|
104
|
+
opts.cache?.(c)
|
|
85
105
|
)
|
|
86
106
|
);
|
|
87
107
|
} catch (err) {
|
|
@@ -94,7 +114,8 @@ function createWidgetsRouter(opts) {
|
|
|
94
114
|
await getWidget(
|
|
95
115
|
makeEngineContext(c, opts),
|
|
96
116
|
c.req.param("dashboardId"),
|
|
97
|
-
c.req.param("widgetId")
|
|
117
|
+
c.req.param("widgetId"),
|
|
118
|
+
opts.cache?.(c)
|
|
98
119
|
)
|
|
99
120
|
);
|
|
100
121
|
} catch (err) {
|
|
@@ -141,29 +162,41 @@ function startRetentionLoop(opts) {
|
|
|
141
162
|
if (inFlight || stopped) {
|
|
142
163
|
return;
|
|
143
164
|
}
|
|
144
|
-
const config = await opts.getConfig();
|
|
145
|
-
if (!config.retention || !hasPruningPolicy(config.retention)) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
const storage = await opts.getStorage();
|
|
149
|
-
inFlight = runRetention(config, storage).finally(() => {
|
|
150
|
-
inFlight = null;
|
|
151
|
-
});
|
|
152
165
|
try {
|
|
166
|
+
const config = await opts.getConfig();
|
|
167
|
+
if (!config.retention || !hasPruningPolicy(config.retention)) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
const storage = await opts.getStorage();
|
|
171
|
+
inFlight = runRetention(config, storage).finally(() => {
|
|
172
|
+
inFlight = null;
|
|
173
|
+
});
|
|
153
174
|
await inFlight;
|
|
154
175
|
} catch (err) {
|
|
155
176
|
console.error("retention run failed", err);
|
|
156
177
|
}
|
|
157
178
|
};
|
|
158
179
|
void (async () => {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
180
|
+
try {
|
|
181
|
+
const config = await opts.getConfig();
|
|
182
|
+
if (!config.retention || !hasPruningPolicy(config.retention)) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (stopped) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const intervalMs = opts.intervalMs ?? config.retention.intervalMs ?? DEFAULT_RETENTION_INTERVAL_MS;
|
|
189
|
+
const created = setInterval(() => {
|
|
190
|
+
void tick();
|
|
191
|
+
}, intervalMs);
|
|
192
|
+
if (stopped) {
|
|
193
|
+
clearInterval(created);
|
|
194
|
+
} else {
|
|
195
|
+
timer = created;
|
|
196
|
+
}
|
|
197
|
+
} catch (err) {
|
|
198
|
+
console.error("retention loop startup failed", err);
|
|
162
199
|
}
|
|
163
|
-
const intervalMs = opts.intervalMs ?? config.retention.intervalMs ?? DEFAULT_RETENTION_INTERVAL_MS;
|
|
164
|
-
timer = setInterval(() => {
|
|
165
|
-
void tick();
|
|
166
|
-
}, intervalMs);
|
|
167
200
|
})();
|
|
168
201
|
return () => {
|
|
169
202
|
stopped = true;
|
|
@@ -177,13 +210,22 @@ function startRetentionLoop(opts) {
|
|
|
177
210
|
// src/mount.ts
|
|
178
211
|
import { InMemoryStorage, ROUTES } from "@rawdash/server";
|
|
179
212
|
import { Hono as Hono5 } from "hono";
|
|
180
|
-
function mountEngine(config, options
|
|
213
|
+
function mountEngine(config, options) {
|
|
181
214
|
const storage = options.storage ?? new InMemoryStorage();
|
|
215
|
+
const { connectorRegistry, secretsResolver } = options;
|
|
182
216
|
const getConfig = () => config;
|
|
183
217
|
const getStorage = () => storage;
|
|
184
218
|
const app = new Hono5();
|
|
185
219
|
app.route("/dashboards", createWidgetsRouter({ getConfig, getStorage }));
|
|
186
|
-
app.route(
|
|
220
|
+
app.route(
|
|
221
|
+
ROUTES.sync,
|
|
222
|
+
createSyncRouter({
|
|
223
|
+
getConfig,
|
|
224
|
+
getStorage,
|
|
225
|
+
connectorRegistry,
|
|
226
|
+
secretsResolver
|
|
227
|
+
})
|
|
228
|
+
);
|
|
187
229
|
app.route(ROUTES.syncState, createSyncStateRouter({ getStorage }));
|
|
188
230
|
app.route("/retention", createRetentionRouter({ getConfig, getStorage }));
|
|
189
231
|
app.route(ROUTES.health, createHealthRouter());
|
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 { getSyncStateHandler, triggerSync } from '@rawdash/server';\nimport { Hono } from 'hono';\n\nimport type { HonoRouterOptions, HonoStorageRouterOptions } from './shared';\nimport { applyBefore, makeEngineContext, mapError } from './shared';\n\n/**\n * `POST /` — triggers a sync, returning immediately with\n * `{queued: true|false}`. The sync runs in the background.\n *\n * Mount at `/sync`.\n */\nexport function createSyncRouter(opts: HonoRouterOptions): Hono {\n const app = new Hono();\n applyBefore(app, opts.before);\n app.post('/', async (c) => {\n try {\n return c.json(await triggerSync(makeEngineContext(c, opts)));\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 // sync-state only needs storage, but reuse the EngineContext shape\n // for handler uniformity. getConfig is a no-op here.\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 { getWidget, listWidgets } from '@rawdash/server';\nimport { Hono } from 'hono';\n\nimport type { HonoRouterOptions } from './shared';\nimport { applyBefore, makeEngineContext, mapError } from './shared';\n\n/**\n * - `GET /:dashboardId/widgets` → `WidgetsListResponse`\n * - `GET /:dashboardId/widgets/:widgetId` → `CachedWidget`\n *\n * Mount at `/dashboards`.\n */\nexport function createWidgetsRouter(opts: HonoRouterOptions): 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 ),\n );\n } catch (err) {\n return mapError(c, err);\n }\n });\n\n app.get('/:dashboardId/widgets/:widgetId', async (c) => {\n try {\n return c.json(\n await getWidget(\n makeEngineContext(c, opts),\n c.req.param('dashboardId'),\n c.req.param('widgetId'),\n ),\n );\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 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 try {\n await inFlight;\n } catch (err) {\n console.error('retention run failed', err);\n }\n };\n\n void (async () => {\n const config = await opts.getConfig();\n if (!config.retention || !hasPruningPolicy(config.retention)) {\n return;\n }\n const intervalMs =\n opts.intervalMs ??\n config.retention.intervalMs ??\n DEFAULT_RETENTION_INTERVAL_MS;\n timer = setInterval(() => {\n void tick();\n }, intervalMs);\n })();\n\n return () => {\n stopped = true;\n if (timer !== null) {\n clearInterval(timer);\n timer = null;\n }\n };\n}\n","import type { DashboardConfig, ServerStorage } 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 /** 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 getConfig = (): DashboardConfig => config;\n const getStorage = (): ServerStorage => storage;\n\n const app = new Hono();\n app.route('/dashboards', createWidgetsRouter({ getConfig, getStorage }));\n app.route(ROUTES.sync, createSyncRouter({ getConfig, getStorage }));\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;AAC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BAAoB,EAAE,WAAW,WAAW,CAAC,CAAC;AACvE,MAAI,MAAM,OAAO,MAAM,iBAAiB,EAAE,WAAW,WAAW,CAAC,CAAC;AAClE,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"]}
|
|
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 { 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 })\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 }),\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 return c.json(\n await getWidget(\n makeEngineContext(c, opts),\n c.req.param('dashboardId'),\n c.req.param('widgetId'),\n opts.cache?.(c),\n ),\n );\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 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 /** 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 } = 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 }),\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,S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AA,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.
|
|
3
|
+
"version": "0.15.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",
|
|
@@ -21,23 +21,23 @@
|
|
|
21
21
|
"import": "./dist/index.js"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
-
"scripts": {
|
|
25
|
-
"build": "tsup",
|
|
26
|
-
"typecheck": "tsc --noEmit",
|
|
27
|
-
"lint": "eslint src",
|
|
28
|
-
"test": "vitest run"
|
|
29
|
-
},
|
|
30
24
|
"peerDependencies": {
|
|
31
25
|
"hono": "^4.0.0"
|
|
32
26
|
},
|
|
33
27
|
"dependencies": {
|
|
34
|
-
"@rawdash/core": "
|
|
35
|
-
"@rawdash/server": "
|
|
28
|
+
"@rawdash/core": "0.15.0",
|
|
29
|
+
"@rawdash/server": "0.15.0"
|
|
36
30
|
},
|
|
37
31
|
"devDependencies": {
|
|
38
32
|
"hono": "^4.7.7",
|
|
39
33
|
"tsup": "^8.0.0",
|
|
40
34
|
"typescript": "^5.7.2",
|
|
41
35
|
"vitest": "^4.1.4"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsup",
|
|
39
|
+
"typecheck": "tsc --noEmit",
|
|
40
|
+
"lint": "eslint src",
|
|
41
|
+
"test": "vitest run"
|
|
42
42
|
}
|
|
43
|
-
}
|
|
43
|
+
}
|