fix: preserve v1 Video Player settings via typeVersion 2 bump#11
Open
eitanp461 wants to merge 1 commit into
Open
fix: preserve v1 Video Player settings via typeVersion 2 bump#11eitanp461 wants to merge 1 commit into
eitanp461 wants to merge 1 commit into
Conversation
0.2.0 (#10) regrouped the Video Player's flat params (playerAutoplayMode, playerSkin, playerAdvancedOptions, …) into collection fields (playerPlayback, playerLayout, playerAppearance, playerFeatures, playerAiOptions). Those flat params had already shipped to npm in 0.1.0–0.1.2, so renaming them — a frozen-by-string break — silently dropped Video Player settings from any workflow saved against 0.1.x on upgrade to 0.2.0. The backward-compat check missed it because it was baselined against 0.0.9, which predates the Video Player. (Flagged by n8n Cloud verification.) Fix per the standard n8n pattern: keep the v1 schema intact behind a typeVersion bump instead of mutating it. - Cloudinary.node.ts: version 1 -> [1, 2], defaultVersion 2. - widget.fields.ts: restore the v1 flat fields gated on displayOptions.show['@Version']: [1]; gate the v2 collections on [{ _cnd: { gte: 2 } }] (gte so a future v3 inherits the schema without re-gating); the three unchanged essentials (playerTransformation, playerPoster, playerSourceTypes) stay ungated and show for both. - videoPlayer.ts: dispatch on getNode().typeVersion to readPlayerParamsV1 (flat) or readPlayerParamsV2 (collections) into one shared PlayerParams; the URL/config builders are untouched. v1 yields ai: {}, so its output matches 0.1.x exactly. - testHelpers.ts: makeCtx accepts typeVersion (default 2), exposed via getNode(). - widget.test.ts: explicit dispatch coverage at both ends — v2 reads collections / ignores stray flat params; v1 reads flat params / ignores stray collections, plus the no-AI-keys guarantee. - docs/backwards-compat.md: worked example of the bump. - package.json: 0.2.0 -> 0.2.1 (lockfile was lagging at 0.1.2; corrected). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
sveta-slepner
approved these changes
Jun 9, 2026
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.
Summary
n8n Cloud verification flagged a [HIGH] breaking change: the 0.1.2 → 0.2.0 update renamed the Video Player parameters without a
typeVersionbump, silently dropping saved settings on upgrade.PR #10 (0.2.0) regrouped the Video Player's flat params (
playerAutoplayMode,playerSkin,playerAdvancedOptions, …) into fivecollectionfields (playerPlayback,playerLayout,playerAppearance,playerFeatures,playerAiOptions). A parameternamerename is frozen-by-string (seedocs/backwards-compat.md) — every workflow that references the old name is orphaned.The catch: those flat params had already shipped to public npm in 0.1.0–0.1.2 (live for two days before 0.2.0). So any workflow saved against 0.1.x with Video Player settings lost them on upgrade. The backward-compat check passed only because it was baselined against 0.0.9, which predates the Video Player entirely.
This PR applies Option 1 (the standard n8n pattern the reviewer recommended): keep the v1 schema intact behind a
typeVersionbump instead of mutating it.Changes
Cloudinary.node.ts—version: 1→version: [1, 2]+defaultVersion: 2. Both schemas ship side by side; new nodes default to v2.descriptions/widget.fields.ts— restore the v1 flat fields gated ondisplayOptions.show['@version']: [1]; gate the v2 collections on[{ _cnd: { gte: 2 } }](gteso a future v3 inheriting the v2 schema keeps showing them without re-gating). The three unchanged essentials (playerTransformation,playerPoster,playerSourceTypes) keep the same name across versions, so they're declared once and shown for both.operations/widget/videoPlayer.ts— dispatch ongetNode().typeVersiontoreadPlayerParamsV1(flat) orreadPlayerParamsV2(collections) into one sharedPlayerParams; the URL/config builders are untouched. v1 yieldsai: {}, so its output matches 0.1.x exactly (no AI keys, which v1 didn't have).operations/testHelpers.ts—makeCtxacceptstypeVersion(default 2), exposed viagetNode().operations/widget/widget.test.ts— explicit dispatch coverage at both ends: a v2 node reads collections / ignores stray flat params; a v1 node reads flat params / ignores stray collections, plus the no-AI-keys guarantee for v1.docs/backwards-compat.md— added a worked example documenting the v1→v2 bump.package.json—0.2.0→0.2.1(the lockfile was lagging at0.1.2; corrected to match).Behavior
122(default)Verification
npm test— 242/242 pass (added explicit version-coverage tests)npm run build,npm run lint, prepublish lint — cleannpm run n8n-validate— security scan passed🤖 Generated with Claude Code