Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDE-4685 feat(core,schema): allow to set primary for outputFields #754

Merged
merged 7 commits into from
Mar 21, 2024

Conversation

eliangcs
Copy link
Member

@eliangcs eliangcs commented Mar 18, 2024

After this PR, a developer can define which output field(s) to be the primary key of an output item. For example:

{
  triggers: {
    recipe: {
      operation: {
        outputFields: [
          { key: 'authorId', primary: true },
          { key: 'name', primary: true }
        ]
      }
    }
  }
}

will tell Zapier to dedupe polling trigger results using the unique hash of (authorId, name).

If no output fields are set as primary, the field with the key id will be as the primary key for deduplication. This is the same as the current behavior.

@eliangcs eliangcs marked this pull request as ready for review March 19, 2024 10:09
@eliangcs eliangcs requested a review from rnegron as a code owner March 19, 2024 10:09
@eliangcs eliangcs requested a review from kola-er March 19, 2024 13:41
kola-er
kola-er previously approved these changes Mar 20, 2024
Copy link
Contributor

@kola-er kola-er left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the thorough job.

return true;
} else {
hasPrimary = true;
break;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the loop is yet to process the id field with primary set? I don't think the outputFields is always sorted to start with the id field.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. Reverted the change and added a test in 7f5ef17. Thanks!

@eliangcs eliangcs merged commit a68b069 into main Mar 21, 2024
13 checks passed
@eliangcs eliangcs deleted the PDE-4685-primary-fields branch March 21, 2024 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants