@typokit/server-native 0.1.4
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 +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +327 -0
- package/dist/index.js.map +1 -0
- package/package.json +33 -0
- package/src/index.test.ts +1303 -0
- package/src/index.ts +450 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { SerializerMap, TypoKitResponse, ValidatorMap, ValidationFieldError } from "@typokit/types";
|
|
2
|
+
import type { ServerAdapter } from "@typokit/core";
|
|
3
|
+
/** Build a 400 validation error response matching ErrorResponse schema */
|
|
4
|
+
declare function validationErrorResponse(message: string, fields: ValidationFieldError[]): TypoKitResponse;
|
|
5
|
+
/**
|
|
6
|
+
* Run the request validation pipeline for params, query, and body.
|
|
7
|
+
* Returns a 400 TypoKitResponse on validation failure, or undefined if all pass.
|
|
8
|
+
*/
|
|
9
|
+
declare function runValidators(routeHandler: {
|
|
10
|
+
validators?: {
|
|
11
|
+
params?: string;
|
|
12
|
+
query?: string;
|
|
13
|
+
body?: string;
|
|
14
|
+
};
|
|
15
|
+
}, validatorMap: ValidatorMap | null, params: Record<string, string>, query: Record<string, string | string[] | undefined>, body: unknown): TypoKitResponse | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Serialize the response body using a compiled fast-json-stringify schema
|
|
18
|
+
* if available, otherwise fall back to the default (JSON.stringify via writeResponse).
|
|
19
|
+
* Automatically sets Content-Type to application/json for JSON bodies.
|
|
20
|
+
*/
|
|
21
|
+
declare function serializeResponse(response: TypoKitResponse, serializerRef: string | undefined, serializerMap: SerializerMap | null): TypoKitResponse;
|
|
22
|
+
/**
|
|
23
|
+
* Create the native server adapter — TypoKit's built-in HTTP server.
|
|
24
|
+
*
|
|
25
|
+
* ```ts
|
|
26
|
+
* import { nativeServer } from "@typokit/server-native";
|
|
27
|
+
* const adapter = nativeServer();
|
|
28
|
+
* adapter.registerRoutes(routeTable, handlerMap, middlewareChain, validatorMap);
|
|
29
|
+
* const handle = await adapter.listen(3000);
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function nativeServer(): ServerAdapter;
|
|
33
|
+
export { serializeResponse, runValidators, validationErrorResponse };
|
|
34
|
+
export { type ServerAdapter } from "@typokit/core";
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAOV,aAAa,EAGb,eAAe,EACf,YAAY,EACZ,oBAAoB,EACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAmB,MAAM,eAAe,CAAC;AA4EpE,0EAA0E;AAC1E,iBAAS,uBAAuB,CAC9B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,oBAAoB,EAAE,GAC7B,eAAe,CAajB;AAED;;;GAGG;AACH,iBAAS,aAAa,CACpB,YAAY,EAAE;IACZ,UAAU,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACjE,EACD,YAAY,EAAE,YAAY,GAAG,IAAI,EACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,EACpD,IAAI,EAAE,OAAO,GACZ,eAAe,GAAG,SAAS,CA+D7B;AAID;;;;GAIG;AACH,iBAAS,iBAAiB,CACxB,QAAQ,EAAE,eAAe,EACzB,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,aAAa,EAAE,aAAa,GAAG,IAAI,GAClC,eAAe,CAkCjB;AAYD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,IAAI,aAAa,CA0L5C;AAGD,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,uBAAuB,EAAE,CAAC;AACrE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
// @typokit/server-native — Built-In Server Adapter
|
|
2
|
+
//
|
|
3
|
+
// Zero-dependency native HTTP server that uses the compiled radix tree
|
|
4
|
+
// for O(k) route lookup (k = number of path segments).
|
|
5
|
+
import { createRequestContext, executeMiddlewareChain } from "@typokit/core";
|
|
6
|
+
import { writeResponse as nodeWriteResponse, createServer, } from "@typokit/platform-node";
|
|
7
|
+
/** Normalize path: strip trailing slash (keep "/" as-is) */
|
|
8
|
+
function normalizePath(path) {
|
|
9
|
+
if (path.length > 1 && path.endsWith("/")) {
|
|
10
|
+
return path.slice(0, -1);
|
|
11
|
+
}
|
|
12
|
+
return path;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Traverse the compiled radix tree to find the route node matching the
|
|
16
|
+
* given path segments. Returns the matching node and extracted params,
|
|
17
|
+
* or undefined if no route matches.
|
|
18
|
+
*/
|
|
19
|
+
function lookupRoute(root, segments) {
|
|
20
|
+
let current = root;
|
|
21
|
+
const params = {};
|
|
22
|
+
for (let i = 0; i < segments.length; i++) {
|
|
23
|
+
const seg = segments[i];
|
|
24
|
+
// 1. Try static child match first (O(1) hash lookup)
|
|
25
|
+
if (current.children?.[seg]) {
|
|
26
|
+
current = current.children[seg];
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
// 2. Try parameterized child (:id)
|
|
30
|
+
if (current.paramChild) {
|
|
31
|
+
const paramNode = current.paramChild;
|
|
32
|
+
params[paramNode.paramName] = decodeURIComponent(seg);
|
|
33
|
+
current = paramNode;
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
// 3. Try wildcard child (*path) — captures remaining segments
|
|
37
|
+
if (current.wildcardChild) {
|
|
38
|
+
const wildcardNode = current.wildcardChild;
|
|
39
|
+
params[wildcardNode.paramName] = segments
|
|
40
|
+
.slice(i)
|
|
41
|
+
.map(decodeURIComponent)
|
|
42
|
+
.join("/");
|
|
43
|
+
return { node: wildcardNode, params };
|
|
44
|
+
}
|
|
45
|
+
// No match
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
return { node: current, params };
|
|
49
|
+
}
|
|
50
|
+
/** Collect all HTTP methods registered at a given route node */
|
|
51
|
+
function collectMethods(node) {
|
|
52
|
+
if (!node.handlers)
|
|
53
|
+
return [];
|
|
54
|
+
return Object.keys(node.handlers);
|
|
55
|
+
}
|
|
56
|
+
// ─── Request Validation Pipeline ─────────────────────────────
|
|
57
|
+
/** Build a 400 validation error response matching ErrorResponse schema */
|
|
58
|
+
function validationErrorResponse(message, fields) {
|
|
59
|
+
const body = {
|
|
60
|
+
error: {
|
|
61
|
+
code: "VALIDATION_ERROR",
|
|
62
|
+
message,
|
|
63
|
+
details: { fields },
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
return {
|
|
67
|
+
status: 400,
|
|
68
|
+
headers: { "content-type": "application/json" },
|
|
69
|
+
body,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Run the request validation pipeline for params, query, and body.
|
|
74
|
+
* Returns a 400 TypoKitResponse on validation failure, or undefined if all pass.
|
|
75
|
+
*/
|
|
76
|
+
function runValidators(routeHandler, validatorMap, params, query, body) {
|
|
77
|
+
if (!validatorMap || !routeHandler.validators) {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
const allErrors = [];
|
|
81
|
+
// Validate params
|
|
82
|
+
if (routeHandler.validators.params) {
|
|
83
|
+
const validator = validatorMap[routeHandler.validators.params];
|
|
84
|
+
if (validator) {
|
|
85
|
+
const result = validator(params);
|
|
86
|
+
if (!result.success && result.errors) {
|
|
87
|
+
for (const e of result.errors) {
|
|
88
|
+
allErrors.push({
|
|
89
|
+
path: `params.${e.path}`,
|
|
90
|
+
expected: e.expected,
|
|
91
|
+
actual: e.actual,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// Validate query
|
|
98
|
+
if (routeHandler.validators.query) {
|
|
99
|
+
const validator = validatorMap[routeHandler.validators.query];
|
|
100
|
+
if (validator) {
|
|
101
|
+
const result = validator(query);
|
|
102
|
+
if (!result.success && result.errors) {
|
|
103
|
+
for (const e of result.errors) {
|
|
104
|
+
allErrors.push({
|
|
105
|
+
path: `query.${e.path}`,
|
|
106
|
+
expected: e.expected,
|
|
107
|
+
actual: e.actual,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// Validate body
|
|
114
|
+
if (routeHandler.validators.body) {
|
|
115
|
+
const validator = validatorMap[routeHandler.validators.body];
|
|
116
|
+
if (validator) {
|
|
117
|
+
const result = validator(body);
|
|
118
|
+
if (!result.success && result.errors) {
|
|
119
|
+
for (const e of result.errors) {
|
|
120
|
+
allErrors.push({
|
|
121
|
+
path: `body.${e.path}`,
|
|
122
|
+
expected: e.expected,
|
|
123
|
+
actual: e.actual,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (allErrors.length > 0) {
|
|
130
|
+
return validationErrorResponse("Request validation failed", allErrors);
|
|
131
|
+
}
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
// ─── Response Serialization Pipeline ──────────────────────────
|
|
135
|
+
/**
|
|
136
|
+
* Serialize the response body using a compiled fast-json-stringify schema
|
|
137
|
+
* if available, otherwise fall back to the default (JSON.stringify via writeResponse).
|
|
138
|
+
* Automatically sets Content-Type to application/json for JSON bodies.
|
|
139
|
+
*/
|
|
140
|
+
function serializeResponse(response, serializerRef, serializerMap) {
|
|
141
|
+
// Nothing to serialize for null/undefined/string/Buffer bodies
|
|
142
|
+
if (response.body === null ||
|
|
143
|
+
response.body === undefined ||
|
|
144
|
+
typeof response.body === "string") {
|
|
145
|
+
return response;
|
|
146
|
+
}
|
|
147
|
+
// Ensure content-type is set for JSON bodies
|
|
148
|
+
const headers = { ...response.headers };
|
|
149
|
+
if (!headers["content-type"]) {
|
|
150
|
+
headers["content-type"] = "application/json";
|
|
151
|
+
}
|
|
152
|
+
// Try compiled serializer first
|
|
153
|
+
if (serializerRef && serializerMap) {
|
|
154
|
+
const serializer = serializerMap[serializerRef];
|
|
155
|
+
if (serializer) {
|
|
156
|
+
return {
|
|
157
|
+
...response,
|
|
158
|
+
headers,
|
|
159
|
+
body: serializer(response.body),
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
// Fall back to JSON.stringify
|
|
164
|
+
return {
|
|
165
|
+
...response,
|
|
166
|
+
headers,
|
|
167
|
+
body: JSON.stringify(response.body),
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Create the native server adapter — TypoKit's built-in HTTP server.
|
|
172
|
+
*
|
|
173
|
+
* ```ts
|
|
174
|
+
* import { nativeServer } from "@typokit/server-native";
|
|
175
|
+
* const adapter = nativeServer();
|
|
176
|
+
* adapter.registerRoutes(routeTable, handlerMap, middlewareChain, validatorMap);
|
|
177
|
+
* const handle = await adapter.listen(3000);
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
export function nativeServer() {
|
|
181
|
+
const state = {
|
|
182
|
+
routeTable: null,
|
|
183
|
+
handlerMap: null,
|
|
184
|
+
middlewareChain: null,
|
|
185
|
+
validatorMap: null,
|
|
186
|
+
serializerMap: null,
|
|
187
|
+
};
|
|
188
|
+
let nativeServerInstance = null;
|
|
189
|
+
/** Handle a single incoming request */
|
|
190
|
+
async function handleRequest(req) {
|
|
191
|
+
if (!state.routeTable || !state.handlerMap) {
|
|
192
|
+
return {
|
|
193
|
+
status: 500,
|
|
194
|
+
headers: { "content-type": "application/json" },
|
|
195
|
+
body: { error: "Server not configured" },
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
// Normalize trailing slashes
|
|
199
|
+
const path = normalizePath(req.path);
|
|
200
|
+
const segments = path === "/" ? [] : path.slice(1).split("/");
|
|
201
|
+
const result = lookupRoute(state.routeTable, segments);
|
|
202
|
+
// 404 — no route matches
|
|
203
|
+
if (!result) {
|
|
204
|
+
return {
|
|
205
|
+
status: 404,
|
|
206
|
+
headers: { "content-type": "application/json" },
|
|
207
|
+
body: {
|
|
208
|
+
error: "Not Found",
|
|
209
|
+
message: `No route matches ${req.method} ${req.path}`,
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
const { node, params } = result;
|
|
214
|
+
const method = req.method;
|
|
215
|
+
// 405 — route exists but method not allowed
|
|
216
|
+
if (!node.handlers?.[method]) {
|
|
217
|
+
const allowed = collectMethods(node);
|
|
218
|
+
if (allowed.length === 0) {
|
|
219
|
+
return {
|
|
220
|
+
status: 404,
|
|
221
|
+
headers: { "content-type": "application/json" },
|
|
222
|
+
body: {
|
|
223
|
+
error: "Not Found",
|
|
224
|
+
message: `No route matches ${req.method} ${req.path}`,
|
|
225
|
+
},
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
return {
|
|
229
|
+
status: 405,
|
|
230
|
+
headers: {
|
|
231
|
+
"content-type": "application/json",
|
|
232
|
+
allow: allowed.join(", "),
|
|
233
|
+
},
|
|
234
|
+
body: {
|
|
235
|
+
error: "Method Not Allowed",
|
|
236
|
+
message: `${method} not allowed. Use: ${allowed.join(", ")}`,
|
|
237
|
+
},
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
const routeHandler = node.handlers[method];
|
|
241
|
+
// ── Request Validation Pipeline ──
|
|
242
|
+
const validationError = runValidators(routeHandler, state.validatorMap, params, req.query, req.body);
|
|
243
|
+
if (validationError) {
|
|
244
|
+
return validationError;
|
|
245
|
+
}
|
|
246
|
+
const handlerFn = state.handlerMap[routeHandler.ref];
|
|
247
|
+
if (!handlerFn) {
|
|
248
|
+
return {
|
|
249
|
+
status: 500,
|
|
250
|
+
headers: { "content-type": "application/json" },
|
|
251
|
+
body: {
|
|
252
|
+
error: "Internal Server Error",
|
|
253
|
+
message: `Handler not found: ${routeHandler.ref}`,
|
|
254
|
+
},
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
// Inject extracted params into the request
|
|
258
|
+
const enrichedReq = { ...req, params, path };
|
|
259
|
+
// Create request context
|
|
260
|
+
let ctx = createRequestContext();
|
|
261
|
+
// Execute middleware chain if present
|
|
262
|
+
if (state.middlewareChain && state.middlewareChain.entries.length > 0) {
|
|
263
|
+
const entries = state.middlewareChain.entries.map((e) => ({
|
|
264
|
+
name: e.name,
|
|
265
|
+
middleware: {
|
|
266
|
+
handler: async (input) => {
|
|
267
|
+
const mwReq = {
|
|
268
|
+
method: enrichedReq.method,
|
|
269
|
+
path: enrichedReq.path,
|
|
270
|
+
headers: input.headers,
|
|
271
|
+
body: input.body,
|
|
272
|
+
query: input.query,
|
|
273
|
+
params: input.params,
|
|
274
|
+
};
|
|
275
|
+
const response = await e.handler(mwReq, input.ctx, async () => {
|
|
276
|
+
return { status: 200, headers: {}, body: null };
|
|
277
|
+
});
|
|
278
|
+
return response;
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
}));
|
|
282
|
+
ctx = await executeMiddlewareChain(enrichedReq, ctx, entries);
|
|
283
|
+
}
|
|
284
|
+
// Call the handler
|
|
285
|
+
const response = await handlerFn(enrichedReq, ctx);
|
|
286
|
+
// ── Response Serialization Pipeline ──
|
|
287
|
+
return serializeResponse(response, routeHandler.serializer, state.serializerMap);
|
|
288
|
+
}
|
|
289
|
+
const adapter = {
|
|
290
|
+
name: "native",
|
|
291
|
+
registerRoutes(routeTable, handlerMap, middlewareChain, validatorMap, serializerMap) {
|
|
292
|
+
state.routeTable = routeTable;
|
|
293
|
+
state.handlerMap = handlerMap;
|
|
294
|
+
state.middlewareChain = middlewareChain;
|
|
295
|
+
state.validatorMap = validatorMap ?? null;
|
|
296
|
+
state.serializerMap = serializerMap ?? null;
|
|
297
|
+
},
|
|
298
|
+
async listen(port) {
|
|
299
|
+
nativeServerInstance = createServer(handleRequest);
|
|
300
|
+
return nativeServerInstance.listen(port);
|
|
301
|
+
},
|
|
302
|
+
normalizeRequest(raw) {
|
|
303
|
+
// Synchronous normalization from an already-parsed request object.
|
|
304
|
+
// For internal use; the actual async normalization from IncomingMessage
|
|
305
|
+
// happens inside the server's request handler via platform-node.
|
|
306
|
+
const r = raw;
|
|
307
|
+
return {
|
|
308
|
+
method: r.method,
|
|
309
|
+
path: r.path,
|
|
310
|
+
headers: r.headers ?? {},
|
|
311
|
+
body: r.body,
|
|
312
|
+
query: r.query ?? {},
|
|
313
|
+
params: r.params ?? {},
|
|
314
|
+
};
|
|
315
|
+
},
|
|
316
|
+
writeResponse(raw, response) {
|
|
317
|
+
nodeWriteResponse(raw, response);
|
|
318
|
+
},
|
|
319
|
+
getNativeServer() {
|
|
320
|
+
return nativeServerInstance?.server ?? null;
|
|
321
|
+
},
|
|
322
|
+
};
|
|
323
|
+
return adapter;
|
|
324
|
+
}
|
|
325
|
+
// Re-export for convenience
|
|
326
|
+
export { serializeResponse, runValidators, validationErrorResponse };
|
|
327
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,EAAE;AACF,uEAAuE;AACvE,uDAAuD;AAkBvD,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EACL,aAAa,IAAI,iBAAiB,EAClC,YAAY,GACb,MAAM,wBAAwB,CAAC;AAShC,4DAA4D;AAC5D,SAAS,aAAa,CAAC,IAAY;IACjC,I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yB;YACnD,iBAAiB,CAAC,GAAqB,EAAE,QAAQ,CAAC,CAAC;QACrD,CAAC;QAED,eAAe;YACb,OAAO,oBAAoB,EAAE,MAAM,IAAI,IAAI,CAAC;QAC9C,CAAC;KACF,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,4BAA4B;AAC5B,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,uBAAuB,EAAE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@typokit/server-native",
|
|
3
|
+
"exports": {
|
|
4
|
+
".": {
|
|
5
|
+
"import": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts"
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
"version": "0.1.4",
|
|
10
|
+
"type": "module",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"src"
|
|
14
|
+
],
|
|
15
|
+
"main": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@typokit/types": "0.1.4",
|
|
19
|
+
"@typokit/platform-node": "0.1.4",
|
|
20
|
+
"@typokit/core": "0.1.4"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/node": "^22.0.0"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://github.com/KyleBastien/typokit",
|
|
28
|
+
"directory": "packages/server-native"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"test": "rstest run --passWithNoTests"
|
|
32
|
+
}
|
|
33
|
+
}
|