Repository navigation
feat(platform): forward events the SDK doesn't know to onEvent - #329
Merged
amitbardos merged 1 commit intoOct 14, 2026
Merged
amitbardos merged 1 commit into
amitbardos merged 1 commit into
Conversation
A new backend event now reaches partners when the service deploys it, as
{ type: "unknown", name, appId, data }, instead of being dropped until they
upgrade. Session events and room.* notices are still not forwarded.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/sdk@0.8.53-pr.329.cce6621Prefer not to change any import paths? Install using npm alias so your code still imports npm i "@base44/sdk@npm:@base44-preview/sdk@0.8.53-pr.329.cce6621"Or add it to your {
"dependencies": {
"@base44/sdk": "npm:@base44-preview/sdk@0.8.53-pr.329.cce6621"
}
}
Preview published to npm registry — try new features instantly! |
🚀 Package Preview Available! (
|
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.
Stacked on #313 (base
amitb/platform-asyncapi-sync).This changes the original event filtering Oz (@ozsay) wrote, so it needs his agreement before merging.
What
Today the builder session registers a Socket.IO handler only for the event names generated into the SDK, so a new backend event is dropped until a partner upgrades. Now:
socket.onAnyforwards any other name toonEvent, except session events (app.snapshot,session.ended) androom.*notices (a new notice has no error code, so it's still dropped).{room, data}envelope validation, per-app routing andprotocol_errorhandling as known events.discard()now also callsoffAny().PlatformEventmember:{ type: "unknown"; name: string; appId: string; data: Record<string, unknown> }.Why
type: "unknown"and nottype: stringThe original plan was an
OtherToolCall-style member withtype: string & {}. In TypeScript 5.9 that breaks narrowing for every known event: withstring & {},event.type === "message.updated"doesn't narrow at all. With plainstringit narrows to that event plus the catch-all, soevent.data.messagebecomesunknown. Either way existing partner code likeevent.data.message.contentstops compiling. A literal"unknown"discriminant keeps known types narrowing exactly. It can't clash with a real event because backend event names are always dotted (noun.verb). The name goes inname. Once a partner upgrades, the event arrives under its owntype.This is a type-level breaking change (an exhaustive
switchneedscase "unknown"), so it should ship in 0.2.0. It's noted in the CHANGELOG.Tests
New unit tests: an unknown event reaches only its app's
onEvent, known, session androom.*names aren't double-delivered throughonAny, a malformed unknown frame fails only its app, andclose()callsoffAny. New type tests: an unknown event'sdataneeds a check before use, and known types still narrow.🤖 Generated with Claude Code