orchid-orm 1.62.4 → 1.63.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.mjs CHANGED
@@ -2257,19 +2257,19 @@ const orchidORMWithAdapter = ({
2257
2257
  noPrimaryKey
2258
2258
  };
2259
2259
  let adapter;
2260
- let transactionStorage;
2260
+ let asyncStorage;
2261
2261
  let qb;
2262
2262
  if ("db" in options) {
2263
2263
  adapter = options.db.q.adapter;
2264
- transactionStorage = options.db.internal.transactionStorage;
2264
+ asyncStorage = options.db.internal.asyncStorage;
2265
2265
  qb = options.db.qb;
2266
2266
  } else {
2267
2267
  adapter = options.adapter;
2268
- transactionStorage = new AsyncLocalStorage();
2268
+ asyncStorage = new AsyncLocalStorage();
2269
2269
  qb = _initQueryBuilder(
2270
2270
  adapter,
2271
2271
  makeColumnTypes(defaultSchemaConfig),
2272
- transactionStorage,
2272
+ asyncStorage,
2273
2273
  commonOptions,
2274
2274
  options
2275
2275
  );
@@ -2279,7 +2279,8 @@ const orchidORMWithAdapter = ({
2279
2279
  $ensureTransaction: ensureTransaction,
2280
2280
  $isInTransaction: isInTransaction,
2281
2281
  $afterCommit: afterCommit,
2282
- $adapter: adapter,
2282
+ $adapterNotInTransaction: adapter,
2283
+ $getAdapter,
2283
2284
  $qb: qb,
2284
2285
  get $query() {
2285
2286
  return qb.query;
@@ -2289,7 +2290,8 @@ const orchidORMWithAdapter = ({
2289
2290
  $withRecursive: qb.withRecursive.bind(qb),
2290
2291
  $withSql: qb.withSql.bind(qb),
2291
2292
  $from: qb.from.bind(qb),
2292
- $close: adapter.close.bind(adapter)
2293
+ $close: adapter.close.bind(adapter),
2294
+ $withOptions: qb.withOptions.bind(qb)
2293
2295
  };
2294
2296
  const tableInstances = {};
2295
2297
  for (const key in tables) {
@@ -2318,7 +2320,7 @@ const orchidORMWithAdapter = ({
2318
2320
  table.table,
2319
2321
  table.columns.shape,
2320
2322
  table.types,
2321
- transactionStorage,
2323
+ asyncStorage,
2322
2324
  options2,
2323
2325
  table.constructor.prototype.columns?.data ?? {}
2324
2326
  );
@@ -2336,10 +2338,11 @@ const orchidORMWithAdapter = ({
2336
2338
  Object.assign(result[key].baseQuery.q, table.q);
2337
2339
  }
2338
2340
  }
2339
- const db = result;
2340
- db.$adapter;
2341
2341
  return result;
2342
2342
  };
2343
+ function $getAdapter() {
2344
+ return this.$qb.$getAdapter();
2345
+ }
2343
2346
 
2344
2347
  const createRepo = (table, methods) => {
2345
2348
  const queryMethods = {