Skip to content

Commit 85e31b1

Browse files
committed
refactor(devframe): isolate local RPC discovery metadata
1 parent 6551d26 commit 85e31b1

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

‎packages/devframe/src/node/instance-shell.ts‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,17 @@ export function createInstanceShell<TContext extends DevframeNodeContext>(
861861
}
862862
}
863863

864+
function addLocalMethodHints(meta: ConnectionMeta): void {
865+
if (tier === 'external' || meta.backend === 'none')
866+
return
867+
// Routes retain this descriptor. Read the registry on discovery so it
868+
// includes methods registered after startup.
869+
Object.defineProperty(meta, 'jsonSerializableMethods', {
870+
enumerable: true,
871+
get: () => getJsonSerializableMethods(ctx.rpc),
872+
})
873+
}
874+
864875
async function init(): Promise<void> {
865876
const result = await options.init(api)
866877
ctx = result.context
@@ -913,14 +924,7 @@ export function createInstanceShell<TContext extends DevframeNodeContext>(
913924
: {}),
914925
}
915926

916-
// Routes retain this descriptor. Read the registry on discovery so it
917-
// includes methods registered after startup. External relays own theirs.
918-
if (tier !== 'external' && (wsAvailable || sseEnabled)) {
919-
Object.defineProperty(meta, 'jsonSerializableMethods', {
920-
enumerable: true,
921-
get: () => getJsonSerializableMethods(ctx.rpc),
922-
})
923-
}
927+
addLocalMethodHints(meta)
924928

925929
// Whatever `setup(ctx)` wrote to `ctx.staticConfig` during
926930
// `options.init(api)` (e.g. a hub aggregating each installed devframe's

0 commit comments

Comments
 (0)