npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

prisma-api-query-builder

v0.1.10

Published

[View Implementation](https://github.com/jeremiah-olisa/shopping-list)

Downloads

5

Readme

View Implementation

https://github.com/jeremiah-olisa/shopping-list

ApiQueryBuilder

Kind: global class

new ApiQueryBuilder(modelEntity, entity, [query], validStringFilter)

The constructor takes in a modelEntity, entity, query, and validStringFilter

| Param | Type | Description | | ----------------- | -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | | modelEntity | PrismaModelDelegate | This is the prisma entity e.g this.prisma.shoppingItem | | entity | TModelEntity | This is the entity that you want to query. it also contains all the settings for filtering and selecting of data | | [query] | IQueryFields | This is the query string fields from the api. | | validStringFilter | Array.<PrismaValidStringFilter> | This is an array of PrismaValidStringFilter. This is used to validate the string filter. |

apiQueryBuilder.filter() ⇒

keysakes a query string, parses it into an object, and then recursively filters out any invalid

Kind: instance method of ApiQueryBuilder Returns: The builder object with the filter property set to the validFilterObj.

apiQueryBuilder.sort() ⇒

the sortable columnsery parameter, splits it into an array, and then filters it to only include

Kind: instance method of ApiQueryBuilder Returns: The builder object

apiQueryBuilder.select() ⇒

whether the column was selected or notmn names and the values being true or false depending on

Kind: instance method of ApiQueryBuilder Returns: The builder object

apiQueryBuilder.populate() ⇒

property to the knex query builderparameter called include then we will add the select

Kind: instance method of ApiQueryBuilder Returns: The builder object with the select property set to the selectables object.

apiQueryBuilder.paginate() ⇒

take values for the paginationom the query string, and then uses them to calculate the skip and

Kind: instance method of ApiQueryBuilder properties. The builder object with the paginate property set to an object with skip and take

apiQueryBuilder.build() ⇒

them to the builderObj propertyselect, and sort properties from the builder object and assigns

Kind: instance method of ApiQueryBuilder Returns: The builder object

apiQueryBuilder.all() ⇒

query.unction sorts, filters, selects, populates, and paginates the query, and then returns the

Kind: instance method of ApiQueryBuilder Returns: The query object.

apiQueryBuilder.many() ⇒

It returns a paginated object with the data and the paginated object

Kind: instance method of ApiQueryBuilder Returns: An object with two properties: data and paginated.

apiQueryBuilder.findMany(filter) ⇒

and returns the data and paginated objectatch the filter, calculates the total number of pages,ct,

| --- | --- | --- | | selectables | Array.<string> | string[] - an array of strings that are the selectable options | | array | Array.<string> | string[] - the array of strings to convert to a boolean object |

apiQueryBuilder.filterRecursive(filterObj)

it's empty filter object, picks only the valid keys, and then recursively filters the object until

Kind: instance method of ApiQueryBuilder

| Param | Type | Description | | --------- | ------------------- | -------------------------------------------- | | filterObj | object | object - The object that you want to filter. |

View Implementation