Server package: validateOnServer + loadEvents adapter

Abierto
#37 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
32/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
typescript
Área
api, backend

Línea de trabajo

Start by reading the parent issue #25 and blocked issue #26 to understand the shared Validation Core and what this package depends on. Then trace the existing core's public functions and package conventions; this issue names no files or tests. Done means the new runtime-agnostic package implements the adapter and direct exports, has mock-based unit tests, and documents transactional isolation and the exclusion-constraint recommendation.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

enhancement

Parent

https://github.com/TanStack/time/issues/25

What to build

Build `@tanstack/time-server` — a runtime-agnostic package that exposes the shared isomorphic Validation Core with a `loadEvents` adapter seam for authoritative server-side validation. The library never opens a database connection; the consumer implements `loadEvents` against their own DB inside their own write transaction.

The package's key export:

```ts
validateOnServer(write, { loadEvents }, ctx) → Promise<conflicts[]>
```

The library computes `getRequiredRange(write)`, calls `loadEvents(range, ctx)` to get the relevant events from the consumer's DB, then runs the same pure Validation Core as the client's advisory checks. Same logic, authoritative data.

Documentation must prominently state: read-validate-write is only race-free inside one transaction with a consistent/locked view. The library provides rules; the consumer provides isolation. A DB exclusion constraint is the recommended backstop for raw time-overlap.

Acceptance criteria

  • `@tanstack/time-server` is a new package in the monorepo with no DOM or browser dependencies
  • `validateOnServer(write, { loadEvents }, ctx)` calls `loadEvents` with the required range, then runs the Validation Core
  • `loadEvents(range, ctx) → Promise<Event[]>` is the only DB seam; the package opens no connections
  • The package works in Node, Bun, Deno, and edge runtimes (no Node-specific APIs)
  • Unit tests use a mock `loadEvents` — no real DB required
  • The package exports the same Validation Core pure functions directly for consumers who want to call them without the adapter orchestration
  • Documentation clearly states the transactional-isolation requirement and the DB exclusion constraint recommendation

Blocked by

https://github.com/TanStack/time/issues/26

Lenguaje dominante
TypeScript
Estrellas
620
Forks
6
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de TanStack/time

Todos los issues de TanStack/time

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.