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

feat(schema) TN-169 Adds canPaginate to BasicHookOperationSchema #399

Merged
merged 2 commits into from
Jul 22, 2021

Conversation

cyberwitch
Copy link
Contributor

This is required for hook triggers to paginate with cursors in performList - either for editor dropdowns, or Transfer support

This is required for hook triggers to paginate with cursors in performList - either for editor dropdowns, or Transfer support
Copy link
Contributor

@xavdid xavdid left a comment

Choose a reason for hiding this comment

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

Nice! You'll want to fix that readme thing, but it's otherwise good.

@@ -2666,7 +2666,7 @@ describe('triggers', () => {

### Using the `z` Object in Tests

Introduced in `[email protected]`, `appTester` can now run arbitrary functions that are not in your app definition:
Copy link
Contributor

Choose a reason for hiding this comment

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

You may need to re-merge master into this PR, this line shouldn't be being removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The line's being shortened, not removed. Not sure why, but it looks like the short version of the line was added to README-source.md in https://github.com/zapier/zapier-platform/pull/385/files#diff-3dde54695dbc62f7d2d2212cc889a7aeb3fbffee64355037ceaaba6755b616af and README.md is out of sync, maybe from some other branch? Building my changes included that one.

Copy link
Contributor

Choose a reason for hiding this comment

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

huh! I guess something didn't get run when I added it originally. ¯\_(ツ)_/¯ sorry about that!

@@ -51,6 +51,10 @@ BasicHookOperationSchema.properties = {
},
},
},
canPaginate: {
description: 'Does this endpoint support a page offset?',
Copy link
Contributor

Choose a reason for hiding this comment

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

I realize this is the existing text, but this is a good opportunity to improve it. canPaginate also controls whether the cursorStore works. So maybe something like:

Does this trigger support pagination? Either via a numeric "page" offset or via temporary cursor storage.

that's a little wordy, but you get the idea.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm...now that I think about it, is this description actually correct? I think canPaginate is only required for the cursor store, and https://github.com/zapier/zapier/pull/16646 makes it sound like there could be a performance hit if triggers set canPaginate but don't use the cursor store. Maybe we should actually flip it?

Does this endpoint support pagination via temporary cursor storage?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

yep, you're correct! I wonder why we even added this flag then - I think it predates the cursor store 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

ha, In https://github.com/zapier/zapier/pull/16646, I said (in 2018):

I notice the BasicPollingOperationSchema mentions canPaginate, but that string doesn't show up anywhere in our codebase

So maybe this is all just a happy accident.

Copy link
Contributor

@xavdid xavdid left a comment

Choose a reason for hiding this comment

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

nice update!

@cyberwitch cyberwitch merged commit fda2d05 into master Jul 22, 2021
@cyberwitch cyberwitch deleted the TN-169-hook-can-paginate branch July 22, 2021 16:02
@cyberwitch
Copy link
Contributor Author

cyberwitch commented Jul 22, 2021

@xavdid Thanks!

I merged, and then ran yarn version --minor as directed in packages/schema/README.md. This didn't publish anything to npm though - it just created a local commit updating the version in packages/schema/docs/build/schema.md, packages/schema/exported-schema.json, and packages/schema/package.json to 11.1.0.

Do I need to push this commit to master, and then create another PR to bump core/package.json's dependency on zapier-platform-schema to 11.1.0, if I want to have a CLI app start using this new schema?

Edit: Hmm, I do see there is a Travis.io deploy stage - I'll wait and see what that does! 😄

Edit 2: Doesn't look like it ran. I'll post in #team-dev-platform and await further instructions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants