fix(google-tag-manager): keep untouched fields on update, add create_version
YU
13d ago+183+183+012345678901234567890123456789-23-23-01234567890123456789
Problem
The GTM API's PUT replaces the whole entity. update_tag, update_trigger and update_variable forwarded only a few fields, so every update silently deleted the rest. Lost fields included:
consentSettings, which holds the Consent Mode/LGPD check of tags that need consent;parentFolderId;setupTag/teardownTag;priorityand the schedule.
get_tag also hid consentSettings, so callers could not notice.
Found while preparing the Grupo Dass containers (GTM-TL4DML26, GTM-P8Q5HMS, GTM-M6QJTLF). Tags lost their folder on update, and tags that need consent could not be edited safely.
Fix
GTMClient.mergedPut: reads the current entity, overlays only the fields the caller set (undefinedis skipped), then sends thePUT. Used by all three update methods.- Tag tools:
get/list/updatereturnconsentSettings.update_tagacceptsconsentSettingsandparentFolderId. - Variable
formatValue: typed as the options object GTM returns. The oldParameterschema madelist_variables/get_variablefail output validation. - New
create_versiontool:workspaces/{id}:create_version. It never publishes.
Validation
bun test: newgtm-client.test.tschecks that an update keepsconsentSettings,parentFolderIdandsetupTag, and dropsundefinedkeys.bun run check: no new errors. The existing@decocms/bindingsEventBusBindingClienterror also happens onmain.
🤖 Generated with Claude Code
Summary by cubic
Fixes GTM tag, trigger, and variable updates silently deleting fields the tool didn't forward. The GTM API's PUT replaces the whole entity, so every update dropped the consent settings, folder, setup/teardown tags, priority, and schedule.
- Update methods now merge the caller's input over the current entity, keeping untouched fields.
- Tag get/list/update expose
consentSettings;update_tagacceptsconsentSettingsandparentFolderId. - Variable
formatValueis now the options object GTM returns, fixinglist_variables/get_variableoutput validation. - Added a
create_versiontool that creates a container version without publishing.