mirror of
https://github.com/knex/knex.git
synced 2026-01-05 11:38:53 +00:00
* knex methods are proxies for context methods ... ... as opposed to injecting the methods directly onto the knex function. (Which was then causing `this` to point to the wrong object when evaluating the context methods) * Moved CONTEXT_METHODS constant to a higher scope * mv knex.context -> this.context * Extracted KNEX_PROPERTY_DEFINITIONS to module scope ... ... which was possible since all of the properties reference `this` instead of `knex` now * shallowCloneFunction no longer accesses _context ... ... instead, it uses the normal context property * transaction method delegates to _transaction ... ... This way, we can be sure that the lower-level details are consistent across implementations. Individual implementations just need to handle the quirks around setting up the `config` and `outerTx` * CONTEXT_METHODS shared. Fixed override of withUserParams ... Restructured the code so that CONTEXT_METHODS populates the KNEX_PROPERTY_DEFINITIONS with the proxy methods. In doing so, it also exposed the fact that the withUserParams(..) method was being overridden on the Transactor instead of its context. So, that bug was fixed as well. * Added a TODO to remove client.makeKnex(..) in future PR * Added a warning about QueryBuilder.extend(..) and side-effects