@ontrails/http 1.0.0-beta.12

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.
@@ -0,0 +1,232 @@
1
+ /**
2
+ * Hono adapter for Trails HTTP routes.
3
+ *
4
+ * Takes framework-agnostic HttpRouteDefinition[] and wires them into a
5
+ * Hono application, handling request parsing, response mapping, and errors.
6
+ *
7
+ * ```ts
8
+ * const app = topo("myapp", entity);
9
+ * await blaze(app, { port: 3000 });
10
+ * ```
11
+ */
12
+ import { isTrailsError, statusCodeMap, validateTopo } from '@ontrails/core';
13
+ import { Hono } from 'hono';
14
+ import { buildHttpRoutes } from '../build.js';
15
+ /** Unwrap optional/default wrappers to reach the underlying Zod type name. */
16
+ const unwrapZodType = (node) => {
17
+ let current = node;
18
+ while (current._zod.def['type'] === 'optional' ||
19
+ current._zod.def['type'] === 'default') {
20
+ current = current._zod.def['innerType'];
21
+ }
22
+ return current._zod.def['type'];
23
+ };
24
+ /** Extract the object shape from a Zod schema, or undefined if not an object. */
25
+ const extractShape = (schema) => {
26
+ const s = schema;
27
+ if (s._zod.def['type'] !== 'object') {
28
+ return undefined;
29
+ }
30
+ return s._zod.def['shape'];
31
+ };
32
+ /** Collect top-level field names whose underlying type is array. */
33
+ const collectArrayKeys = (inputSchema) => {
34
+ const shape = inputSchema ? extractShape(inputSchema) : undefined;
35
+ if (!shape) {
36
+ return new Set();
37
+ }
38
+ const keys = new Set();
39
+ for (const [key, value] of Object.entries(shape)) {
40
+ if (unwrapZodType(value) === 'array') {
41
+ keys.add(key);
42
+ }
43
+ }
44
+ return keys;
45
+ };
46
+ /** Parse query params into a plain object, preserving raw strings for Zod. */
47
+ const parseQueryParams = (c, inputSchema) => {
48
+ const result = {};
49
+ const url = new URL(c.req.url);
50
+ const arrayKeys = collectArrayKeys(inputSchema);
51
+ for (const key of url.searchParams.keys()) {
52
+ // Already collected via getAll
53
+ if (key in result) {
54
+ continue;
55
+ }
56
+ const all = url.searchParams.getAll(key);
57
+ result[key] = all.length > 1 || arrayKeys.has(key) ? all : all[0];
58
+ }
59
+ return result;
60
+ };
61
+ /** Sentinel indicating a JSON parse failure. */
62
+ const JSON_PARSE_ERROR = Symbol('JSON_PARSE_ERROR');
63
+ /** Return true when the request has no body content. */
64
+ const isEmptyBody = (c) => {
65
+ const contentLength = c.req.header('Content-Length');
66
+ if (contentLength !== undefined) {
67
+ return Number.parseInt(contentLength, 10) === 0;
68
+ }
69
+ // No Content-Length header — treat as empty when Content-Type is also absent.
70
+ return c.req.header('Content-Type') === undefined;
71
+ };
72
+ /** Read input from request based on input source. */
73
+ const readInput = async (c, inputSource, inputSchema) => {
74
+ if (inputSource === 'query') {
75
+ return parseQueryParams(c, inputSchema);
76
+ }
77
+ if (isEmptyBody(c)) {
78
+ return {};
79
+ }
80
+ try {
81
+ return await c.req.json();
82
+ }
83
+ catch {
84
+ return JSON_PARSE_ERROR;
85
+ }
86
+ };
87
+ // ---------------------------------------------------------------------------
88
+ // Response mapping
89
+ // ---------------------------------------------------------------------------
90
+ /** Map a TrailsError or generic Error to an HTTP error response. */
91
+ const mapErrorResponse = (error) => {
92
+ if (isTrailsError(error)) {
93
+ return {
94
+ body: {
95
+ error: {
96
+ category: error.category,
97
+ code: error.name,
98
+ message: error.message,
99
+ },
100
+ },
101
+ status: statusCodeMap[error.category],
102
+ };
103
+ }
104
+ return {
105
+ body: {
106
+ error: {
107
+ category: 'internal',
108
+ code: 'InternalError',
109
+ message: error.message,
110
+ },
111
+ },
112
+ status: 500,
113
+ };
114
+ };
115
+ // ---------------------------------------------------------------------------
116
+ // Route registration
117
+ // ---------------------------------------------------------------------------
118
+ /** Map a Result to an HTTP response via Hono context. */
119
+ const mapResultToResponse = (result, c) => {
120
+ if (result.isOk()) {
121
+ return c.json({ data: result.value }, 200);
122
+ }
123
+ const { body, status } = mapErrorResponse(result.error ?? new Error('Unknown error'));
124
+ return c.json(body, status);
125
+ };
126
+ /** Convert a caught unknown value to an error response. */
127
+ const handleCaughtError = (error, c) => {
128
+ const err = error instanceof Error ? error : new Error(String(error));
129
+ const { body, status } = mapErrorResponse(err);
130
+ return c.json(body, status);
131
+ };
132
+ /** Create a Hono handler from a route definition. */
133
+ const createHonoHandler = (route) => async (c) => {
134
+ const rawInput = await readInput(c, route.inputSource, route.trail.input);
135
+ if (rawInput === JSON_PARSE_ERROR) {
136
+ return c.json({
137
+ error: {
138
+ category: 'validation',
139
+ code: 'ValidationError',
140
+ message: 'Invalid JSON in request body',
141
+ },
142
+ }, 400);
143
+ }
144
+ const requestId = c.req.header('X-Request-ID') ?? undefined;
145
+ const { signal } = c.req.raw;
146
+ try {
147
+ const result = await route.execute(rawInput, requestId, signal);
148
+ return mapResultToResponse(result, c);
149
+ }
150
+ catch (error) {
151
+ return handleCaughtError(error, c);
152
+ }
153
+ };
154
+ /** Route registration keyed by HTTP method. */
155
+ const routeRegistrars = {
156
+ DELETE: (hono, path, handler) => {
157
+ hono.delete(path, handler);
158
+ },
159
+ GET: (hono, path, handler) => {
160
+ hono.get(path, handler);
161
+ },
162
+ POST: (hono, path, handler) => {
163
+ hono.post(path, handler);
164
+ },
165
+ };
166
+ const registerRoutes = (hono, routes) => {
167
+ for (const route of routes) {
168
+ const handler = createHonoHandler(route);
169
+ routeRegistrars[route.method](hono, route.path, handler);
170
+ }
171
+ };
172
+ // ---------------------------------------------------------------------------
173
+ // Global error handler
174
+ // ---------------------------------------------------------------------------
175
+ const registerErrorHandler = (hono) => {
176
+ // oxlint-disable-next-line prefer-await-to-callbacks -- Hono's onError API requires a callback
177
+ hono.onError((err, c) => c.json({
178
+ error: {
179
+ category: 'internal',
180
+ code: 'InternalError',
181
+ message: err.message,
182
+ },
183
+ }, 500));
184
+ };
185
+ // ---------------------------------------------------------------------------
186
+ // Validation
187
+ // ---------------------------------------------------------------------------
188
+ /**
189
+ * Throw a ValidationError if the topo has structural issues.
190
+ * Pass `skip: true` to bypass validation (e.g. when `validate: false` is set).
191
+ */
192
+ const assertValidTopo = (app, skip = false) => {
193
+ if (skip) {
194
+ return;
195
+ }
196
+ const validated = validateTopo(app);
197
+ if (validated.isErr()) {
198
+ throw validated.error;
199
+ }
200
+ };
201
+ // ---------------------------------------------------------------------------
202
+ // blaze
203
+ // ---------------------------------------------------------------------------
204
+ /**
205
+ * Build HTTP routes from a topo, create a Hono app, and optionally start serving.
206
+ */
207
+ // oxlint-disable-next-line require-await -- async for consistency with other blaze() surfaces
208
+ export const blaze = async (app, options = {}) => {
209
+ assertValidTopo(app, options.validate === false);
210
+ const hono = new Hono();
211
+ registerErrorHandler(hono);
212
+ const routesResult = buildHttpRoutes(app, {
213
+ basePath: options.basePath,
214
+ configValues: options.configValues,
215
+ createContext: options.createContext,
216
+ layers: options.layers,
217
+ services: options.services,
218
+ });
219
+ if (routesResult.isErr()) {
220
+ throw routesResult.error;
221
+ }
222
+ registerRoutes(hono, routesResult.value);
223
+ if (options.serve !== false) {
224
+ Bun.serve({
225
+ fetch: hono.fetch,
226
+ hostname: options.hostname ?? '0.0.0.0',
227
+ port: options.port ?? 3000,
228
+ });
229
+ }
230
+ return hono;
231
+ };
232
+ //# sourceMappingURL=blaze.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blaze.js","sourceRoot":"","sources":["../../src/hono/blaze.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAO5E,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAM5B,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAwC9C,8EAA8E;AAC9E,MAAM,aAAa,GAAG,CAAC,IAAY,EAAU,EAAE;IAC7C,IAAI,OAAO,GAAG,IAAI,CAAC;IACnB,OACG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAY,KAAK,UAAU;QAClD,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAY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AAC;QAC5B,GAAG,CAAC,KAAK,CAAC;YACR,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,SAAS;YACvC,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,IAAI;SAC3B,CAAC,CAAC;IACL,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { blaze, type BlazeHttpOptions } from './blaze.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hono/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { blaze } from './blaze.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hono/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAyB,MAAM,YAAY,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { buildHttpRoutes, type BuildHttpRoutesOptions, type HttpMethod, type HttpRouteDefinition, type InputSource, } from './build.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,KAAK,sBAAsB,EAC3B,KAAK,UAAU,EACf,KAAK,mBAAmB,EACxB,KAAK,WAAW,GACjB,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ // Build (framework-agnostic)
2
+ export { buildHttpRoutes, } from './build.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,OAAO,EACL,eAAe,GAKhB,MAAM,YAAY,CAAC"}
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@ontrails/http",
3
+ "version": "1.0.0-beta.12",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": "./src/index.ts",
7
+ "./hono": "./src/hono/index.ts",
8
+ "./package.json": "./package.json"
9
+ },
10
+ "scripts": {
11
+ "build": "tsc -b",
12
+ "test": "bun test",
13
+ "typecheck": "tsc --noEmit",
14
+ "lint": "oxlint ./src",
15
+ "clean": "rm -rf dist *.tsbuildinfo"
16
+ },
17
+ "dependencies": {
18
+ "@ontrails/core": "^1.0.0-beta.12"
19
+ },
20
+ "peerDependencies": {
21
+ "hono": "^4.7.0",
22
+ "zod": "^4.3.5"
23
+ },
24
+ "peerDependenciesMeta": {
25
+ "hono": {
26
+ "optional": true
27
+ }
28
+ }
29
+ }