[SCR-383] Auto-Mode (mode=auto) node fields#4
Open
kostas-jakeliunas-sb wants to merge 1 commit into
Open
Conversation
Add `mode` (Auto) and `maxCost` to the HTML API "Additional Fields" collection so the node can drive the server-side Auto-Mode feature: mode=auto escalates cheapest-first and charges only the winning config. - `mode`: options field, single value `auto`, neutral empty default (opt-in). Emitted as `&mode=auto`. - `maxCost`: number (minValue 1), shown only when mode=auto. The generic camelCase->snake_case querystring loop turns `maxCost` into `max_cost`. - Mutual exclusivity: hide renderJs / premiumProxy / stealthProxy / transparentStatusCode while mode=auto (server 400s on those combos). - Bump package version 0.1.6 -> 0.1.7. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
marius-nemeiksis-sbee
approved these changes
Jul 2, 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.
tl;dr
Adds
Mode(Auto) andMax Costfields to the HTML API node so users can opt into server-side Auto-Mode (mode=auto), which escalates cheapest→expensive and charges only the winning config. Opt-in (neutral default), GET-only feature, with incompatible toggles auto-hidden. Build + lint green. Hold until the API shipsmode=auto.Summary
nodes/ScrapingBee/ScrapingBee.node.ts— two new fields added inside thehtmlAPI"Additional Fields"collection(the only block whose keys are auto snake-cased into the request querystring — there is no request-building code to change):mode—optionsfield, single option{ name: 'Auto', value: 'auto' }, neutral empty default ('') so it's opt-in. Description carries the contract (GET-only cheapest-first escalation, charged only for the winning config, 0 on full failure, incompatible toggles hidden).maxCost—type: 'number',typeOptions: { minValue: 1 },displayOptions.showso it appears only whenmode = auto. Description: "Max credits a request may cost. Omit for no cap. Requires Mode = Auto."displayOptions.hide(mode: ['auto']) added torenderJs,premiumProxy,stealthProxy, andtransparentStatusCode(the four params the server 400s on when combined withmode=auto). All are siblings ofmodewithin the samecollection, so plain-name sibling references resolve at render time. Reverse hiding wasn't needed: whilemode=autois selected those toggles are hidden, so a server-rejected combo can't be built.package.json— version bumped0.1.6→0.1.7. No CHANGELOG file exists in the repo, so none was added.camel→snake key verification (the critical bit)
The node has no arbitrary key/value entry; for the HTML API it iterates
additionalFieldsand snake-cases each key via:I verified this transforms
maxCost→max_cost(each uppercase letter →_+ lowercase) — exactly the API param name — so I named the propertymaxCostand relied on the existing loop (no explicit mapping or request-code change).modeis already lowercase → staysmode. Confirmed in the compileddistoutput: both keys present, 5×mode: ['auto'](1show+ 4hide). The empty-string guard in the same loop (!== '') means a neutralmodeemits nothing, and an un-addedmaxCost(n8n only serializes explicitly-added collection fields) means omit = uncapped, matching the contract.Test plan
npm installnpm run build(tsc + gulp icons) — cleannpm run lint(eslint n8n-nodes-base ruleset) — 0 errors/warnings.eslintrc.prepublish.js) — cleandistcontainsmode+maxCostand the 5displayOptionsrulesMode = Autohides Render JS / Premium Proxy / Stealth Proxy / Transparent Status Code;Max Costappears only under Auto; emitted querystring is&mode=auto[&max_cost=N];Spb-auto-costheader observed🤖 Generated with Claude Code