orchid-orm 1.50.5 → 1.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -188,19 +188,19 @@ interface BelongsToInfo<T extends RelationConfigSelf, Name extends string, Rel e
188
188
  }
189
189
 
190
190
  declare function transaction<Result>(this: {
191
- $queryBuilder: Db;
191
+ $qb: Db;
192
192
  }, fn: () => Promise<Result>): Promise<Result>;
193
193
  declare function transaction<Result>(this: {
194
- $queryBuilder: Db;
194
+ $qb: Db;
195
195
  }, options: IsolationLevel | TransactionOptions, fn: () => Promise<Result>): Promise<Result>;
196
196
  declare function ensureTransaction<Result>(this: {
197
- $queryBuilder: Db;
197
+ $qb: Db;
198
198
  }, cb: () => Promise<Result>): Promise<Result>;
199
199
  declare function isInTransaction(this: {
200
- $queryBuilder: Db;
200
+ $qb: Db;
201
201
  }): boolean;
202
202
  declare function afterCommit(this: {
203
- $queryBuilder: Db;
203
+ $qb: Db;
204
204
  }, hook: AfterCommitStandaloneHook): void;
205
205
 
206
206
  interface FromQuery extends Query {
@@ -226,7 +226,7 @@ type OrchidORM<T extends TableClasses = TableClasses> = {
226
226
  */
227
227
  $afterCommit: typeof afterCommit;
228
228
  $adapter: Adapter;
229
- $queryBuilder: Db;
229
+ $qb: Db;
230
230
  /**
231
231
  * Use `$query` to perform raw SQL queries.
232
232
  *
package/dist/index.js CHANGED
@@ -2051,19 +2051,19 @@ const applyRelation = (table, qb, { relationName, relation, dbTable, otherDbTabl
2051
2051
  };
2052
2052
 
2053
2053
  function transaction(fnOrOptions, fn) {
2054
- return this.$queryBuilder.transaction(
2054
+ return this.$qb.transaction(
2055
2055
  fnOrOptions,
2056
2056
  fn
2057
2057
  );
2058
2058
  }
2059
2059
  function ensureTransaction(cb) {
2060
- return this.$queryBuilder.ensureTransaction(cb);
2060
+ return this.$qb.ensureTransaction(cb);
2061
2061
  }
2062
2062
  function isInTransaction() {
2063
- return this.$queryBuilder.isInTransaction();
2063
+ return this.$qb.isInTransaction();
2064
2064
  }
2065
2065
  function afterCommit(hook) {
2066
- this.$queryBuilder.afterCommit(hook);
2066
+ this.$qb.afterCommit(hook);
2067
2067
  }
2068
2068
 
2069
2069
  const orchidORM = ({
@@ -2085,7 +2085,7 @@ const orchidORM = ({
2085
2085
  if ("db" in options) {
2086
2086
  adapter = options.db.q.adapter;
2087
2087
  transactionStorage = options.db.internal.transactionStorage;
2088
- qb = options.db.queryBuilder;
2088
+ qb = options.db.qb;
2089
2089
  } else {
2090
2090
  adapter = "adapter" in options ? options.adapter : new pqb.Adapter(options);
2091
2091
  transactionStorage = new node_async_hooks.AsyncLocalStorage();
@@ -2103,8 +2103,10 @@ const orchidORM = ({
2103
2103
  $isInTransaction: isInTransaction,
2104
2104
  $afterCommit: afterCommit,
2105
2105
  $adapter: adapter,
2106
- $queryBuilder: qb,
2107
- $query: (...args) => qb.query(...args),
2106
+ $qb: qb,
2107
+ get $query() {
2108
+ return qb.query;
2109
+ },
2108
2110
  $queryArrays: (...args) => qb.queryArrays(...args),
2109
2111
  $with: qb.with.bind(qb),
2110
2112
  $withRecursive: qb.withRecursive.bind(qb),