zapier / zapier-platform

The SDK for you to build an integration on Zapier
https://platform.zapier.com
Other
344 stars 188 forks source link

feat(core) Update extendAppRaw to override arrays as well as objects [PDE-5114] #813

Closed kreddlear closed 3 months ago

kreddlear commented 3 months ago

The extendAppRaw function in createLambdaHandler currently assumes it should always/only concatenate arrays in an app definition. However, for many cases we actually do want to override the array, not concatenate it - for example for inputFields coming in from an external action, we should fully overwrite the base inputFields with the partial inputFields.

kreddlear commented 3 months ago

@eliangcs I've added some logic to the existing mergeWith customizer function - would you mind taking a look to see if that looks like it would cover the desired use case here better? Since it looks like all the overrides we care about are stored within the operation within a given trigger, I focused on handling that rather than rewriting a new deep merge function. If it seems ultimately better to just rewrite it though, or if there are holes in this solution as well, please let me know and I'll rework it again. Thank you!

kreddlear commented 3 months ago

Thanks for writing that up, @eliangcs - apologies for not being more aggressive with rewriting that sooner. I've tested your code as well and it seems to work great. I added that in and fixed the test description typo.