Skip to content

Commit 4a4e7e0

Browse files
krisnyeclaude
andauthored
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

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
{
22
"name": "data-monorepo",
3-
"version": "0.9.67",
3+
"version": "0.9.68",
44
"private": true,
55
"scripts": {
66
"build": "pnpm -r run build",
77
"test": "pnpm -r run test",
8+
"lint": "pnpm -r run lint",
9+
"lint-fix": "pnpm -r run lint-fix",
10+
"typecheck": "pnpm -r run typecheck",
811
"dev": "pnpm -r --parallel run dev",
912
"dev:data": "pnpm --filter @adobe/data run dev",
1013
"link": "pnpm -r --filter @adobe/data* run link",

packages/data-lit-tictactoe/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "data-lit-tictactoe",
3-
"version": "0.9.67",
3+
"version": "0.9.68",
44
"description": "Tic-Tac-Toe sample - Lit web components with @adobe/data-lit and AgenticService",
55
"type": "module",
66
"private": true,

packages/data-lit-todo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "data-lit-todo",
3-
"version": "0.9.67",
3+
"version": "0.9.68",
44
"description": "Todo sample app demonstrating @adobe/data with Lit",
55
"type": "module",
66
"private": true,

packages/data-lit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@adobe/data-lit",
3-
"version": "0.9.67",
3+
"version": "0.9.68",
44
"description": "Adobe data Lit bindings - hooks, elements, decorators",
55
"type": "module",
66
"private": false,

packages/data-p2p-tictactoe/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "data-p2p-tictactoe",
3-
"version": "0.9.67",
3+
"version": "0.9.68",
44
"description": "Serverless P2P tic-tac-toe — WebRTC DataChannel + @adobe/data-sync",
55
"type": "module",
66
"private": true,

packages/data-persistence/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@adobe/data-persistence",
3-
"version": "0.9.67",
3+
"version": "0.9.68",
44
"description": "Worker-based incremental persistence layer for @adobe/data ECS over OPFS (browser) and node:fs (server).",
55
"type": "module",
66
"sideEffects": false,
@@ -18,7 +18,6 @@
1818
"build": "cp ../../LICENSE . 2>/dev/null || true; tsc -b",
1919
"clean": "rm -rf dist node_modules",
2020
"dev": "tsc -b -w --preserveWatchOutput",
21-
"lint": "pnpm eslint .",
2221
"test": "pnpm exec playwright install chromium && vitest --run",
2322
"test:node": "vitest --run --project=node",
2423
"test:browser": "vitest --run --project=browser",

packages/data-react-hello/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "data-react-hello",
3-
"version": "0.9.67",
3+
"version": "0.9.68",
44
"description": "Hello World sample - click counter using @adobe/data-react",
55
"type": "module",
66
"private": true,

packages/data-react-pixie/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "data-react-pixie",
3-
"version": "0.9.67",
3+
"version": "0.9.68",
44
"description": "PixiJS React sample - ECS sprites (bunny, fox) with @adobe/data-react",
55
"type": "module",
66
"private": true,

packages/data-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@adobe/data-react",
3-
"version": "0.9.67",
3+
"version": "0.9.68",
44
"description": "Adobe data React bindings — hooks and context for ECS database",
55
"type": "module",
66
"private": false,

packages/data-solid-dashboard/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "data-solid-dashboard",
3-
"version": "0.9.67",
3+
"version": "0.9.68",
44
"description": "Mini dashboard sample — multiple components sharing one @adobe/data ECS database with SolidJS",
55
"type": "module",
66
"private": true,

0 commit comments

Comments
 (0)