Commit 4a4e7e0
feat(ecs): surface base-plugin computeds inside derived computed factories (#124)
* feat(ecs): export Database.Plugin.ToComputedDb — computed-db alias without Omit hack
bump: 0.9.68
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(ecs): surface base-plugin computeds inside derived computed factories
FullDBForPlugin hardcoded the computed-factory db's CV slot to `unknown`,
which erased the extends/imports base's already-resolved computeds — not
just the current plugin's in-progress ones. A derived plugin's computed
factory therefore could not compose on a base plugin's computed.
Set CV to FromComputedFactories<XP['computed']>. XP is AmbientPlugin<XP, IP>
at the call sites, so this surfaces the base + imports computeds (all fully
constructed — no circularity). The current plugin's own CVF is never a
parameter to this type, so in-progress siblings stay hidden, matching the
rule actions/systems already follow.
Adds type-tests for both directions (base composition works; sibling stays
hidden) and corrects the ToComputedDb doc now that factories see base
computeds rather than `unknown`.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* refactor(ecs): drop Database.Plugin.ToComputedDb
With computed factories now seeing the base plugin's resolved computeds,
the computed-erased alias no longer mirrors the factory context — the db a
factory receives is no longer `computed: unknown`. Its only residual use
(strip computed to break a type cycle) is speculative, has no consumer, and
is a near-duplicate of ToDatabase; the rare call site can write
`Omit<ToDatabase<P>, 'computed'>` inline.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* chore: add root lint/typecheck scripts; drop dead lint scripts
`pnpm run lint` / `pnpm run typecheck` now work from the repo root
(recursive, matching the existing `build`/`test` pattern) — no need to know
which package to cd into. Removed the phantom `lint` scripts from data-sync
and data-persistence: they had no eslint config or dependency and always
errored, which would otherwise break the recursive root lint. CI already
lints only @adobe/data, so nothing relied on them.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* test(ecs): prove standalone-computed factory aggregation type-checks cleanly
Adds a compile-time test for a common app pattern: computed factories
authored as standalone functions (annotated with the exported
`Database.Plugin.ToDatabase<typeof basePlugin>`) aggregated into one
`computed: {}` block in a createPlugin call. Covers a plain resource read, a
factory composing on a base computed, and a parameterized computed; asserts
the aggregated result types exactly, with no `Omit` and no cast.
Verified load-bearing: reverting the FullDBForPlugin CV slot to `unknown`
breaks this exact assignment with TS2322 (`unknown` not assignable to the
factory's `computed`), which is the contravariance failure that forced the
old `Omit<ToDatabase<...>, 'computed'>` workaround.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 00c674e commit 4a4e7e0
15 files changed
Lines changed: 133 additions & 20 deletions
File tree
- packages
- data-lit-tictactoe
- data-lit-todo
- data-lit
- data-p2p-tictactoe
- data-persistence
- data-react-hello
- data-react-pixie
- data-react
- data-solid-dashboard
- data-solid
- data-sync
- data
- src/ecs/database
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
8 | 11 | | |
9 | 12 | | |
10 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
0 commit comments