TypeScript HTTP handlers#4931
Open
gefjon wants to merge 4 commits intophoebe/http-handlers-webhooksfrom
Open
Conversation
This commit adds host support for registering HTTP handlers in V8 modules, and a minimal draft of TypeScript bindings support for the same. The TypeScript bindings support is fully vibe-coded and unreviewed, and is present only to allow a new smoketest, which is added to the `http_routes` suite. The host changes were also AI-assisted, but I reviewed and polished them.
coolreader18
approved these changes
May 7, 2026
Collaborator
coolreader18
left a comment
There was a problem hiding this comment.
Some comments, but overall LGTM
Comment on lines
+51
to
+53
| type RouterWithRoutes = Router & { | ||
| [routesSymbol]: Route[]; | ||
| }; |
Collaborator
There was a problem hiding this comment.
Isn't this redundant?
Comment on lines
+48
to
+49
| const routesSymbol = Symbol('SpacetimeDB.http.routes'); | ||
| const httpHandlerSymbol = Symbol('SpacetimeDB.http.handler'); |
Collaborator
There was a problem hiding this comment.
What purpose do these serve? httpHandlerSymbol seems unused and routesSymbol could just be a private field on Router with a static method to access it.
coolreader18
reviewed
May 7, 2026
| }; | ||
| } | ||
|
|
||
| export function makeHttpNamespace(ctx: SchemaInner) { |
Collaborator
There was a problem hiding this comment.
It would be nice for the return value of this function (and thus also the Schema.http field) to be explicitly typed with an interface, rather than just inferred from the body.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on #4636 .
Description of Changes
This commit adds host support for registering HTTP handlers in V8 modules, and a minimal draft of TypeScript bindings support for the same. The TypeScript bindings support is fully vibe-coded and unreviewed, and is present only to allow a new smoketest, which is added to the
http_routessuite. The host changes were also AI-assisted, but I reviewed and polished them.API and ABI breaking changes
Adds new TypeScript "ABI." Also adds a new API, which I sure hope will be overwritten by @JasonAtClockwork .
Expected complexity level and risk
2: pretty simple extensions to TypeScript execution, which largely mirror existing
call_proceduremachinery.Testing