feat(routes): expose complete registered route handlers - #16
Merged
Conversation
Expose a replayable multicast lifecycle API for complete route handlers without attaching another provider to the internal registering proxy. Keep explicit removals and module unloads synchronized with the public observer.
Snapshot live subscribers so nested subscriptions do not receive duplicate events. Skip stale replay entries removed by earlier observer callbacks.
Member
Author
|
@greptile review |
Track observer subscription generations so callbacks removed during an emission are skipped, including remove-and-resubscribe sequences.
Member
Author
|
@greptile review |
Revalidate the route before each live registration callback so reentrant removal cannot leave later observer caches stale.
Member
Author
|
@greptile review |
Reuse one active subscription per observer identity so either unsubscribe handle stops future notifications without weakening reentrant generation checks.
Member
Author
|
@greptile review |
Co-authored-by: Upd4ting <upd4ting@gmail.com>
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.
Summary
getRegisteredRouteHandlers()as a snapshot of the complete route registryRouteHandler, including mode, callback, prototype, parameters, properties, priority, and owner moduleroutesListlifecycle so explicit unregister and module unload remove stale entriesroutesProxyprovider attachment untouchedWhy
CMS API needs complete handlers for route introspection, middleware ordering, controller inspection, and request-log matching. The existing
getRegisteredRoutes()intentionally returns reduced metadata and omitsmode, the callback, and the controller prototype.CMS API currently works around that limitation by calling the internal
routesProxy.onRegister()andonUnregister()methods. Those methods attach the real API implementation; they are not a multicast event source. A second attachment can replace or compete with the API provider.The new getter exposes the already-maintained source of truth directly. CMS API #22 can remove its mirrored cache and read the current registry without subscriptions, replay, detach logic, or provider interaction.
Contract
handleris the same complete handler object sent to the API providerValidation
pnpm lintpnpm buildpnpm --package=@antelopejs/core@1.4.7 dlx ajs module test .— 83 passingpnpm packand packed declaration inspectiongit diff --checkThe planned release is 0.0.13; this PR intentionally does not bump the package version.