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

Add type keys to service pagination options. #1888

Merged
merged 1 commit into from
Mar 24, 2020

Conversation

JorgenVatle
Copy link
Contributor

Just a simple tweak that defines the missing types for the pagination options of ServiceOptions. Here I'm assuming that the only supported options are max and default.

I was unable to find anything that would indicate that there are additional options. But I assume the available options could be tied to the database adapter in use? If the pagination object should accept any list of customizable options, perhaps we could consider refactoring to something like the following snippet;

export interface ServiceOptions {
  events: string[];
  multi: boolean|string[];
  id: string;
  paginate: {
    [key: string]: any;
    default?: number;
    max?: number;
  }
  whitelist: string[];
  filters: string[];
}

This would keep type-hinting for the two documented pagination options while allowing for use of additional options.

@daffl daffl merged commit 859c601 into feathersjs:master Mar 24, 2020
@deskoh
Copy link
Contributor

deskoh commented Apr 18, 2020

@JorgenVatle Looking at the following line and the docs, paginate can take the value of false as well to disable pagination?

@JorgenVatle
Copy link
Contributor Author

@deskoh This PR only addresses service registration options. app.use('/example', new ServiceAdapter({ ... })) The actual query API referenced in the following example provided by the docs you mentioned should remain unaffected by this PR. 👍
image

@JorgenVatle
Copy link
Contributor Author

@deskoh To follow up on the previous note, I do believe the query API already has the proper type definitions for the paginate param. See @feathersjs/feathers/index.d.ts. 👍

The query API however, appears to lack type hints for the $limit and $skip options. Unless that's been changed with a recent PR. 😅

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.

3 participants