olavim / objection-cursor

Cursor based pagination plugin for Objection.js
MIT License
30 stars 8 forks source link

fix(mergecontext): suppress warnings for deprecated method #21

Closed andy-hayes1 closed 4 years ago

jtomaszewski commented 4 years ago

Good idea. Or maybe if somehow we can tell if the builder comes from v1 or v2, then we could just use context / mergeContext depending on which Objection version we're at. Maybe by the existence of toSql method ( https://vincit.github.io/objection.js/release-notes/migration.html#querybuilder-tostring-and-querybuilder-tosql-have-been-removed ). Or some method that has been introduced in v2 but didn't exist in v1.

jtomaszewski commented 4 years ago

We can tell it by the existence of clearContext method. It has been introduced in the very same commit. See https://github.com/Vincit/objection.js/commit/9c9b25569e99ac3fd26d58791a7720d6d608c074#diff-8f266653ab055c494b98c08438ab98f8R95 . Will make a PR in a sec.