refactor: stop filtering deprecated content in the deserializer - #201
Merged
Conversation
tvdeyen
force-pushed
the
remove-essences
branch
2 times, most recently
from
August 20, 2026 18:03
a58159b to
47aa5be
Compare
Member
Author
|
superseds #107 |
tvdeyen
force-pushed
the
remove-essences
branch
from
August 20, 2026 19:52
47aa5be to
295763e
Compare
Deprecation on elements and ingredients is an admin-only hint; the deserializer must not drop that content from a serialized page. The old filterDeprecatedElements also only ever handled elements and the pre-6.0 "essences" — never the ingredients that replaced them — so it had silently done nothing for ingredient deprecation for years anyway. Remove the filtering entirely. deserializePage/deserializePages stay as thin, API-compatible wrappers around deserialize and no longer mutate the output; both are marked @deprecated and warn once (console.warn) in favour of calling deserialize directly.
tvdeyen
force-pushed
the
remove-essences
branch
from
August 20, 2026 19:58
295763e to
d111feb
Compare
tvdeyen
added a commit
that referenced
this pull request
Aug 31, 2026
…ion (#202) Migrates the deserializer to TypeScript and ships type declarations so consumers get types and editor support (including the `@deprecated` hints on `deserializePage`/`deserializePages` added in #201). **Source** — `deserialize`, `alchemyApiDeserializer` and the barrel become `.ts`. Behaviour is unchanged; the existing specs (migrated to `.ts`) still pass, and the folded numeric-id/absent-to-many case keeps the coverage the old `deserialize.spec.js` had. **Distribution pipeline** — `build` now runs `vite build` for the JS bundles plus `tsc --emitDeclarationOnly` for the `.d.ts`. A `tsconfig.json` (strict, `lib: ["ES2022","DOM"]` for `structuredClone`) drives declaration emit and a new `typecheck` script. `package.json` gains a `types` field and an `exports` map exposing types for both the root entry and the `./deserialize` subpath. **Public type surface** — the JSON:API document shapes are kept **internal** (not exported). `deserialize` is `<T = unknown>(document: unknown): T`, so those shapes aren't part of the contract; exporting them would only add generically-named types (`JsonApiResource`, `JsonApiDocument`, …) that could collide with a consumer's own definitions. The emitted `deserialize.d.ts` therefore exposes only `deserialize`. Based on `main` (after #200 and #201).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
deserializePage/deserializePagesstripped elements whosedeprecatedflag was set. Butdeprecatedis an admin-only hint — it marks element/ingredient definitions that were removed from config so the CMS can warn editors. It should never remove content from a serialized page delivered to a frontend; doing so is destructive and opinionated.It also turns out the filtering was already incomplete:
filterDeprecatedElementshandled elements and the pre-6.0essences, but never theingredientsthat replaced essences in Alchemy 6.0 — even though ingredients carry the samedeprecatedflag. So ingredient deprecation has been silently unfiltered in production for years with no ill effect, which is good evidence the filtering isn't needed.This removes
filterDeprecatedElementsentirely.deserializePage/deserializePagesremain as thin, API-compatible wrappers arounddeserializeand no longer mutate the output; the specs now assert that deprecated elements and nested elements are preserved.Stacked on #200 (merged); base is
main.