Skip to content
This repository was archived by the owner on Oct 7, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
[![TypeScript](https://img.shields.io/badge/TypeScript-7.0-blue?logo=typescript)](https://www.typescriptlang.org/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

[**Documentation**](https://btravstack.github.io/entity/) · [**Getting started**](https://btravstack.github.io/entity/tutorial/getting-started) · [**Reference**](https://btravstack.github.io/entity/reference/declaration) · [**Why entity?**](https://btravstack.github.io/entity/explanation/why-entity)
[**Documentation**](https://btravstack.github.io/btravstack/entity/) · [**Getting started**](https://btravstack.github.io/btravstack/entity/tutorial/getting-started) · [**Reference**](https://btravstack.github.io/btravstack/entity/reference/declaration) · [**Why entity?**](https://btravstack.github.io/btravstack/entity/explanation/why-entity)

</div>

Expand Down Expand Up @@ -68,7 +68,7 @@ pnpm add @btravstack/entity zod unthrown @unthrown/standard-schema

`zod`, `unthrown` and `@unthrown/standard-schema` are **peer dependencies** —
install all four.
([Why](https://btravstack.github.io/entity/explanation/peer-dependencies).)
([Why](https://btravstack.github.io/btravstack/entity/explanation/peer-dependencies).)

## A worked example

Expand Down Expand Up @@ -182,7 +182,7 @@ only need the shared behaviour".
There is no class form. Putting the union at a base-class position is `TS2507`
at the declaration, because a class's instance type cannot be a union at all
(`TS2509`).
([Why](https://btravstack.github.io/entity/explanation/unions-and-roots).)
([Why](https://btravstack.github.io/btravstack/entity/explanation/unions-and-roots).)

## Aggregates

Expand Down Expand Up @@ -228,19 +228,19 @@ events that were folded and checked against every invariant. Load with
state or as events without touching its declaration. Use `Entity` for
everything inside the boundary, and for simple models where a public `update()`
costs nothing. See [Model an event-driven
aggregate](https://btravstack.github.io/entity/how-to/model-an-event-driven-aggregate).
aggregate](https://btravstack.github.io/btravstack/entity/how-to/model-an-event-driven-aggregate).

## Documentation

**[btravstack.github.io/entity](https://btravstack.github.io/entity/)** — built
**[btravstack.github.io/entity](https://btravstack.github.io/btravstack/entity/)** — built
with VitePress from [`docs/`](./docs), and organised by the four
[Diátaxis](https://diataxis.fr/) modes:

- **[Tutorial](https://btravstack.github.io/entity/tutorial/getting-started)** — from nothing to a working entity, one step at a time.
- **How-to guides** — [expose an HTTP contract](https://btravstack.github.io/entity/how-to/http-contract) · [persist and rehydrate](https://btravstack.github.io/entity/how-to/persist-and-rehydrate) · [model an aggregate](https://btravstack.github.io/entity/how-to/model-an-aggregate) · [model an event-driven aggregate](https://btravstack.github.io/entity/how-to/model-an-event-driven-aggregate) · [test domain logic](https://btravstack.github.io/entity/how-to/test-domain-logic)
- **[Reference](https://btravstack.github.io/entity/reference/declaration)** — every member, option and type, with signatures. Plus the [generated API reference](https://btravstack.github.io/entity/api/).
- **[Guarantees and compatibility](https://btravstack.github.io/entity/reference/guarantees)** — before you adopt: what is enforced at compile time and at runtime, what is deliberately left to you, and the supported Node, TypeScript and zod versions. Then the same model [compared with plain zod and Effect `Schema.Class`](https://btravstack.github.io/entity/explanation/compared).
- **[Explanation](https://btravstack.github.io/entity/explanation/why-entity)** — why it is built this way: sealed construction, what immutability covers, no I/O, why an entity is final and a union has no class form.
- **[Tutorial](https://btravstack.github.io/btravstack/entity/tutorial/getting-started)** — from nothing to a working entity, one step at a time.
- **How-to guides** — [expose an HTTP contract](https://btravstack.github.io/btravstack/entity/how-to/http-contract) · [persist and rehydrate](https://btravstack.github.io/btravstack/entity/how-to/persist-and-rehydrate) · [model an aggregate](https://btravstack.github.io/btravstack/entity/how-to/model-an-aggregate) · [model an event-driven aggregate](https://btravstack.github.io/btravstack/entity/how-to/model-an-event-driven-aggregate) · [test domain logic](https://btravstack.github.io/btravstack/entity/how-to/test-domain-logic)
- **[Reference](https://btravstack.github.io/btravstack/entity/reference/declaration)** — every member, option and type, with signatures. Plus the [generated API reference](https://btravstack.github.io/btravstack/api/entity/).
- **[Guarantees and compatibility](https://btravstack.github.io/btravstack/entity/reference/guarantees)** — before you adopt: what is enforced at compile time and at runtime, what is deliberately left to you, and the supported Node, TypeScript and zod versions. Then the same model [compared with plain zod and Effect `Schema.Class`](https://btravstack.github.io/btravstack/entity/explanation/compared).
- **[Explanation](https://btravstack.github.io/btravstack/entity/explanation/why-entity)** — why it is built this way: sealed construction, what immutability covers, no I/O, why an entity is final and a union has no class form.

## Development

Expand Down
9 changes: 8 additions & 1 deletion docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ export default defineConfig({
const normalizedPath = pageData.relativePath.replace(/^\/+/, "");
// cleanUrls is true, so the public URL has no `.html` extension: strip
// `index.md` to the directory and any other `.md` to the bare route.
const canonicalUrl = `${SITE_URL}${normalizedPath}`
const newBase = pageData.relativePath.startsWith("api/")
? "https://btravstack.github.io/btravstack/"
: "https://btravstack.github.io/btravstack/entity/";
const canonicalUrl = `${newBase}${normalizedPath}`
.replace(/index\.md$/, "")
.replace(/\.md$/, "");

Expand All @@ -123,6 +126,10 @@ export default defineConfig({
pageData.frontmatter.editLink = false;
}

pageData.frontmatter.head.push([
"meta",
{ "http-equiv": "refresh", content: `0;url=${canonicalUrl}` },

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve URL fragments during the redirect

When an existing deep link such as /entity/reference/declaration#fields is opened, this fixed meta-refresh target omits the incoming fragment, so the browser redirects to the correct new page but drops the section anchor and lands at the top. The documentation contains many section-level links, so the redirect should carry location.hash (for example via a small client-side redirect) while keeping the canonical URL fragment-free.

Useful? React with 👍 / 👎.

]);
pageData.frontmatter.head.push(["link", { rel: "canonical", href: canonicalUrl }]);

const pageTitle = pageData.title || pageData.frontmatter.title || "entity";
Expand Down
33 changes: 29 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ catalogs:
# runtime deps, which are the three peers). Each selector is version-scoped so
# only the affected line moves and unrelated lines are untouched.
overrides:
# GHSA-pqg4-j6r4-53mv (Critical): shell-quote command injection through a
# line terminator after a comment token. Reaches us via the Changesets CLI's
# editor launcher, never the published entity package.
"shell-quote@>=1.8.4 <1.11.0": "1.11.0"
# GHSA-fx2h-pf6j-xcff (High, `server.fs.deny` bypass on Windows alternate data
# streams) plus three moderates on the same line: GHSA path traversal in
# optimized deps, launch-editor NTLMv2 disclosure, and the esbuild dev-server
Expand Down
Loading