Coder Social home page Coder Social logo

sonicfury / spider-query-builder Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 252 KB

Builds a queryparams string for interactions with API Platform based backend

License: GNU Affero General Public License v3.0

TypeScript 100.00%
angular api-platform api-rest javascript query-builder queryparams typescript typescript-library

spider-query-builder's Introduction

Hi ! ๐Ÿ‘‹๐Ÿป

Creative, dynamic, and multi-talented, I am a software engineer currently employed at Sumit. I'm looking for an opportunity starting november 2024 as a Software Engineer!

๐Ÿ”ญ Iโ€™m currently working with:

๐Ÿ”— Links and socials:

๐Ÿง‘โ€๐Ÿ’ป Preferences:


Top Langs

spider-query-builder's People

Contributors

sonicfury avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

spider-query-builder's Issues

handle multiple SpdrParam instances in query builder

Version

2.x

Issue

There's no handling of multiple declarations of a param on the same property

Suggestion

const p1 = new SpdrSearch('lastname', ['Belmondo']);
const p2 = new SpdrSearch('lastname', ['Delon']);

const qb = new SpdrQueryBuilder([p1,p2]);

Several solutions to this:

  • This could throw an exception
  • Or glue SpdrParam instances into a single SpdrParam with multiple values when possible. Here it could transform p1 and p2 into const p3 = new SpdrSearch('lastname', ['Belmondo', 'Delon']) , for example.
  • Keep only the last instance, that may be the best solution as it would be super handy to use.
  • All solutions, depending on an optional parameter, with the exception by default.

commonjs dependencies to be replaced by ES6

{ {...} depends on '@sonicfury/spider-query-builder'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies" }

Probably some configuration issue in tsconfig.json to fix

Split sort params, pagination params and others in queryBuilder

Version

3.0.0 and prior

Issue

This would be interesting to split these 3 types of params, as oftentimes you want to update pageIndex, but not the filters, nor the sorting.

Suggestion

const qb = new SpdrQueryBuilder()

qb.params.{whatever filter}()
qb.sort.{whatever sort}()
qb.pagination.{whatever pagination}()

With clearing methods like

qb.sort.clear()

qb.params.search('username', ['johnny'])
qb.params.remove('username')

This way we would be able to update the pagination without the rest and vice versa

Add page & itemsPerPage params

# ./config/packages/api_platform.yaml
collection:
        pagination:
            page_parameter_name: _page
            items_per_page_parameter_name: itemsPerPage

Add SpiderParams for pagination, with custom param name for both

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.