Skip to content

Extending top-level ("cached") params #70

@rkaw92

Description

@rkaw92

Currently, the operators that should be "bubbled up" to the top level (exports.lastSeen) are only found in a module variable and can be configured library-wise. However, this is dangerous in combination with caching module systems. For instance, in Node.js, requiring the same module twice will re-use the module object and only create a new reference to it.

As I will be extending RQL with some custom operators for keyset-based paging that still need to impact query behavior as a whole, altering "lastSeen" is a necessity for my use case. However, I would very much like to avoid this modification of a global module instance at runtime, because it may break other users of the library in the same application.

This is why I believe the parser API should expose a class (constructor function?) that allows per-instance parser configuration. Moreover, this can be done without breaking API compatibility by making the value of exports an instance of the Parser.

Please let me know what you think of this rather significant refactoring.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions