HarperFast / HarperFast/rql

Extending top-level ("cached") params

Open
#70 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
276
Forks
48
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.