|
1 | 1 | # @cobaltcore-dev/aurora |
2 | 2 |
|
| 3 | +## 0.18.0 |
| 4 | + |
| 5 | +### Minor Changes |
| 6 | + |
| 7 | +- d2cc53d: Add support for custom tRPC routers with full type safety |
| 8 | + |
| 9 | + **New exports from `@cobaltcore-dev/aurora/server`:** |
| 10 | + - `AuroraRouterWithCustom<T>` - Type helper to merge custom routers with base Aurora router |
| 11 | + |
| 12 | + **New exports from `@cobaltcore-dev/aurora/client`:** |
| 13 | + - `CreateTypedTrpcReact<T>` - Generic type for typed React tRPC client |
| 14 | + - `CreateTypedTrpcClient<T>` - Generic type for typed vanilla tRPC client |
| 15 | + - `TrpcReact` - Type alias for the React tRPC client |
| 16 | + |
| 17 | + **Usage:** |
| 18 | + 1. Define custom routers using `auroraRouter` and `protectedProcedure`: |
| 19 | + |
| 20 | + ```typescript |
| 21 | + import { auroraRouter, protectedProcedure } from "@cobaltcore-dev/aurora/server" |
| 22 | + |
| 23 | + export const customRouters = auroraRouter({ |
| 24 | + feedback: auroraRouter({ |
| 25 | + submit: protectedProcedure |
| 26 | + .input(z.object({ message: z.string() })) |
| 27 | + .mutation(async ({ input }) => ({ success: true })), |
| 28 | + }), |
| 29 | + }) |
| 30 | + ``` |
| 31 | + |
| 32 | + 2. Register with `createServer`: |
| 33 | + |
| 34 | + ```typescript |
| 35 | + createServer({ routers: [customRouters], ... }) |
| 36 | + ``` |
| 37 | + |
| 38 | + 3. Create typed client exports: |
| 39 | + |
| 40 | + ```typescript |
| 41 | + import type { AuroraRouterWithCustom } from "@cobaltcore-dev/aurora/server" |
| 42 | + import { trpcReact, CreateTypedTrpcReact } from "@cobaltcore-dev/aurora/client" |
| 43 | + |
| 44 | + type AppRouter = AuroraRouterWithCustom<typeof customRouters> |
| 45 | + export const trpc = trpcReact as unknown as CreateTypedTrpcReact<AppRouter> |
| 46 | + ``` |
| 47 | + |
| 48 | + 4. Use with full type safety: |
| 49 | + |
| 50 | + ```typescript |
| 51 | + const mutation = trpc.feedback.submit.useMutation() // ✅ Type-safe! |
| 52 | + ``` |
| 53 | + |
| 54 | +- 2f8cca6: Remove InactivityModal and redirect directly to login on session expiration |
| 55 | + |
| 56 | +### Patch Changes |
| 57 | + |
| 58 | +- 914411a: Simplify logout type - remove logoutReason tracking |
| 59 | + |
3 | 60 | ## 0.17.1 |
4 | 61 |
|
5 | 62 | ### Patch Changes |
|
0 commit comments