Skip to content

Export the contract as a subpath; invalidate discovery on publish (1.1.0) - #4

Merged
marianoviola merged 1 commit into
mainfrom
m1-contract-export
Sep 21, 2026
Merged

marianoviola merged 1 commit into
mainfrom
m1-contract-export

Conversation

@marianoviola

Copy link
Copy Markdown
Owner

M1, node side.

  • @sphere-pub/node/contract: the fragment contract as types, no Cloudflare deps (manifest, sources, relations, PublisherSummary, FragmentUsage, PaymentStatus, PublishResult). The plugin will import from here instead of vendoring src/contract/ (follow-up PR in sphere-plugin).
  • Owner handlers typed against src/core/owner-api.ts, so served shape and exported type can't drift.
  • Publish invalidates the discovery cache (KvStore.delete); test added. Previously a new fragment took up to 60 s to appear in /.well-known/sphere.json.
  • spec/node-api.md: documents PUT /owner/fragments/{id} (it existed without a spec entry).
  • Version 1.1.0.

After merge: publish 1.1.0 (npm publish --access public --otp=…), then the plugin PR can switch to ^1.1.0.

🤖 Generated with Claude Code

…1.0)

`@sphere-pub/node/contract` exposes the fragment contract as types with no
Cloudflare dependencies (manifest, sources, relations, owner-API
responses), so tools that read or write fragments — the plugin first —
import it instead of vendoring a copy. The owner handlers are now typed
against the same definitions (src/core/owner-api.ts), so the served shape
and the exported type cannot drift apart silently.

The publish route now deletes the cached discovery document, so
/.well-known/sphere.json lists a new fragment on the next read instead of
after the 60 s TTL. KvStore gains `delete`.

spec/node-api.md documents PUT /owner/fragments/{id}, which existed
without a spec entry.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@marianoviola
marianoviola merged commit 66031d4 into main Sep 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant