Server package: validateOnServer + loadEvents adapter

オープン
#37 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
32/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
typescript
領域
api, backend

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
TypeScript
スター
620
フォーク
6
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

TanStack/time のほかの issue

TanStack/time の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。