Server package: validateOnServer + loadEvents adapter

Aberta
#37 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
5/5
Tempo estimado
Mais de uma semana
Facilidade para iniciantes
32/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Pouca atividade
Stack de tecnologia
typescript
Domínio
api, backend

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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

Linguagem predominante
TypeScript
Estrelas
620
Forks
6
Métricas de merge de PRs
Nenhum PR com merge em 30d

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de TanStack/time

Todas as issues de TanStack/time

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.