Skip to content

✨ Close SDK gaps found auditing three production Nuxt sites - #13

Merged
badmike merged 3 commits into
mainfrom
fix/preview-scoped-updates
Aug 24, 2026
Merged

✨ Close SDK gaps found auditing three production Nuxt sites#13
badmike merged 3 commits into
mainfrom
fix/preview-scoped-updates

Conversation

@badmike

@badmike badmike commented Aug 24, 2026

Copy link
Copy Markdown
Member

Wiring three production Nuxt sites against the SDK turned up a set of small gaps where the packages made you work around them: casts for typed params, hand-rolled paginated fetches in Nitro routes, a sitemap that emitted the wrong URLs for a mono-lingual space, and a generate types output path that doubled app/.

Each one is fixed at the source rather than in the sites.

@b10cks/client

  • rv is part of IBBaseQueryParams, so pinning a request to a revision no longer needs an as object cast.
  • getDataEntries takes a typed IBDataEntryParams with dimension.
  • GetConfigOptions.language is deprecated in favour of language_iso, matching every other content param. Both still work.
  • renderSitemapXml and filterSitemapEntries take a localePrefix strategy (auto | always | never | except-default), defaulting to auto. A mono-lingual space previously emitted /en/about for a page served at /about, making every sitemap URL a 404 or a redirect.

@b10cks/nuxt

  • useB10cksConfig watches language_iso as well as language, so a config passed language_iso refetches on a locale change instead of going stale.
  • New useB10cksServerApi(), auto-imported in the server bundle: Nitro routes get the full B10cksDataApi instead of hand-rolled paginated fetches and TTL caches.
  • New useB10cksVersion(), normalizing ?b10cks_vid to a version string defaulting to published.

@b10cks/richtext

  • New isRichTextEmpty(document), re-exported from @b10cks/vue/rich-text and @b10cks/nuxt. A field an editor cleared usually leaves an empty paragraph behind; this lets you skip the wrapper markup.

@b10cks/cli (separate commit)

  • An explicit -o is resolved against the working directory again, so -o ./app/b10cks/types no longer lands in app/app/….
  • Generated block interfaces carry a literal block: 'slug', so a heterogeneous body array can be discriminated on block without a cast.

@b10cks/mgmt-client (separate commit)

  • The single-content endpoints declared a bare Content but resolved to { data: Content }. They now unwrap, making the declared type true.

Changesets included. Typecheck, lint and tests pass.

🤖 Generated with Claude Code

An explicit `-o` is resolved against the working directory again. Only the
default output path is placed under a Nuxt 4 `app/` rootDir, so
`-o ./app/b10cks/types` no longer lands in `app/app/…`.

Each generated block interface carries a literal `block: 'slug'`, narrowing
`B10cksItem`'s `block: string`, so a heterogeneous body array can be
discriminated without a cast. A schema field named `block` is skipped, since
it would redeclare the discriminant.
`contents.get`, `create`, `update`, `move`, `publish`, `unpublish` and
`schedule` declared a bare `Content` but resolved to `{ data: Content }`, so
callers had to branch on the shape themselves. They now unwrap, making the
declared type true. An already-bare response passes through untouched.
- `@b10cks/client`: `rv` is part of `IBBaseQueryParams`, so pinning a request
  to a revision no longer needs an `as object` cast. `getDataEntries` takes a
  typed `IBDataEntryParams` with `dimension`. `GetConfigOptions.language` is
  deprecated in favour of `language_iso`; both still work.
- `@b10cks/client`: `renderSitemapXml` and `filterSitemapEntries` take a
  `localePrefix` strategy (`auto` | `always` | `never` | `except-default`),
  defaulting to `auto`. A mono-lingual space previously emitted `/en/about`
  for a page served at `/about`, making every sitemap URL a 404 or redirect.
- `@b10cks/nuxt`: `useB10cksConfig` watches `language_iso` as well as
  `language`. New `useB10cksServerApi()` gives Nitro routes the full
  `B10cksDataApi`, and `useB10cksVersion()` normalizes `?b10cks_vid`.
- `@b10cks/richtext`: new `isRichTextEmpty(document)`, re-exported from
  `@b10cks/vue/rich-text` and `@b10cks/nuxt`, so a field an editor cleared
  can skip its wrapper markup.
@badmike
badmike force-pushed the fix/preview-scoped-updates branch from bdd54af to 0a032af Compare August 24, 2026 20:51
@badmike
badmike merged commit b54a6e8 into main Aug 24, 2026
6 checks passed
@github-actions github-actions Bot mentioned this pull request Aug 24, 2026
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