Commit Graph

16 Commits

Author SHA1 Message Date
aac37fd9af docs(core-shared): correct defineErrorMiddleware jsdoc to match implementation
Code-quality reviewer flagged a stale 'try/catch' phrase in the jsdoc
that didn't match the actual result.ok inspection pattern. Updated
description to accurately describe how tRPC v11 middleware sees errors
(returned result, not thrown exception) and how the middleware
discriminates and rethrows.

Pure docstring change — no behavioral or signature impact.
2026-05-06 11:54:51 +02:00
e25b1f7a1c feat(core-shared): add defineErrorMiddleware factory + export t
Factory takes [[ErrorCtor, TRPC_CODE], ...] tuples and returns a tRPC
middleware that translates matching domain errors to TRPCError. Discrim-
inates by instanceof; preserves original error as cause; unmapped
errors propagate (tRPC then wraps them as INTERNAL_SERVER_ERROR with
the original error as .cause — middleware does not interfere).

core-shared never enumerates feature errors — each feature passes its
own constructors in via integrations/api/procedures.ts (Tasks 3-7).

Also exports the `t` instance from trpc/init.ts so feature procedure
files can do t.procedure.use(...).

Also fixes tsconfig.json: rootDir set to "." and @/* path alias added
so test files using @/ resolve correctly under tsc --noEmit.

Refactor log: §1, §2, §4
Spec: R13–R17
2026-05-06 11:43:45 +02:00
614b0178a0 feat(core-shared): wire root index.ts barrel 2026-05-04 20:45:09 +02:00
884b0c01e8 fix(core-shared): narrow Payload Field union before accessing name in tests
Payload's Field type is a discriminated union; field.name only exists on
named variants. Tests now narrow on type (and 'name' in field for groups)
before reading variant-specific properties.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 20:43:23 +02:00
428346a36d feat(core-shared): add tRPC context factory 2026-05-04 20:40:52 +02:00
cd2f3b1fff feat(core-shared): add tRPC init with superjson 2026-05-04 20:40:42 +02:00
a9a8d32726 feat(core-shared): add payload barrel export 2026-05-04 20:39:54 +02:00
520a792b7f feat(core-shared): add toIsoString helper 2026-05-04 20:37:26 +02:00
3ffe752c7a feat(core-shared): add requireEnv helper 2026-05-04 20:37:12 +02:00
2b2de66b5d feat(core-shared): add slugifyIfMissing hook 2026-05-04 20:37:00 +02:00
124ccabc5f feat(core-shared): add setPublishedAt hook 2026-05-04 20:36:45 +02:00
6bd428214f feat(core-shared): add cta block 2026-05-04 20:36:30 +02:00
2d838b2dcf feat(core-shared): add seoFields group 2026-05-04 20:36:17 +02:00
f2f8e2b3b3 feat(core-shared): add slugField helper 2026-05-04 20:35:59 +02:00
5942317222 feat(core-shared): add isAdmin access helper 2026-05-04 20:35:36 +02:00
b4a9994dc2 feat(core-shared): scaffold empty package with exports + tags 2026-05-04 20:29:57 +02:00