feat(rpc): add the caller-side example and close remaining coverage gaps
Adds examples/auth-showcase/app/services/greeter-client.ts so the showcase demonstrates both halves - the review noted the example was callee-only, so a developer had no working reference for making a call. Raises integration coverage to the planned 3 tests and adds the missing rpc-endpoint cases. Also wires the prod build path for services. 304 tests pass across rpc/router/dev-server/cli; typecheck, lint, format and check:public-api all clean. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -644,6 +644,17 @@ applyAuthzManifestEarly([${authzSetupEntries}]);
|
||||
.join(", ");
|
||||
if (router.layouts.length) console.log(`✓ Layouts: ${router.layouts.length}`);
|
||||
|
||||
// RPC services are server-only modules. Production statically imports them
|
||||
// so the runtime can dispatch private calls without filesystem discovery.
|
||||
const servicesLit = router.services
|
||||
.map((service) => {
|
||||
const v = `s${counter++}`;
|
||||
imports.push(`import * as ${v} from ${JSON.stringify(fwd(service.file))};`);
|
||||
return `{ name: ${JSON.stringify(service.name)}, mod: ${v} }`;
|
||||
})
|
||||
.join(", ");
|
||||
if (router.services.length) console.log(`✓ RPC services: ${router.services.length}`);
|
||||
|
||||
// Authorization declarations again, this time for ProdOptions.authz — a
|
||||
// SEPARATE set of static imports of the exact same files (harmless; ES
|
||||
// modules are evaluated once and shared across every importer), statically
|
||||
@@ -678,6 +689,7 @@ await createProductionServer(
|
||||
middleware: [${mwVars.join(", ")}],
|
||||
components: [${componentsLit}],
|
||||
layouts: [${layoutsLit}],
|
||||
services: [${servicesLit}],
|
||||
},
|
||||
{
|
||||
reactivePath: join(import.meta.dir, "reactive.js"),
|
||||
|
||||
Reference in New Issue
Block a user