@tstdl/base 0.92.77 → 0.92.78

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.
@@ -13,7 +13,8 @@ import { PgTransaction as DrizzlePgTransaction } from 'drizzle-orm/pg-core';
13
13
  import { createContextProvider } from '../../context/context.js';
14
14
  import { NotFoundError } from '../../errors/not-found.error.js';
15
15
  import { Singleton } from '../../injector/decorators.js';
16
- import { inject, injectArgument } from '../../injector/inject.js';
16
+ import { Injector } from '../../injector/index.js';
17
+ import { inject, injectArgument, runInInjectionContext } from '../../injector/inject.js';
17
18
  import { resolveArgumentType } from '../../injector/interfaces.js';
18
19
  import { Schema } from '../../schema/schema.js';
19
20
  import { toArray } from '../../utils/array/array.js';
@@ -35,6 +36,7 @@ const entityTypeToken = Symbol('EntityType');
35
36
  const TRANSACTION_TIMESTAMP = sql `transaction_timestamp()`;
36
37
  const { getCurrentEntityRepositoryContext, runInEntityRepositoryContext, isInEntityRepositoryContext } = createContextProvider('EntityRepository');
37
38
  let EntityRepository = class EntityRepository {
39
+ #injector = inject(Injector);
38
40
  #repositoryConstructor;
39
41
  #withTransactionCache = new WeakMap();
40
42
  #encryptionSecret = isInEntityRepositoryContext() ? getCurrentEntityRepositoryContext()?.encryptionSecret : inject(ENCRYPTION_SECRET, undefined, { optional: true });
@@ -75,7 +77,7 @@ let EntityRepository = class EntityRepository {
75
77
  encryptionSecret: this.#encryptionSecret,
76
78
  transformContext: this.#transformContext
77
79
  };
78
- const repositoryWithTransaction = runInEntityRepositoryContext(context, () => new this.#repositoryConstructor());
80
+ const repositoryWithTransaction = runInInjectionContext(this.#injector, () => runInEntityRepositoryContext(context, () => new this.#repositoryConstructor()));
79
81
  this.#withTransactionCache.set(transaction, repositoryWithTransaction);
80
82
  return repositoryWithTransaction;
81
83
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tstdl/base",
3
- "version": "0.92.77",
3
+ "version": "0.92.78",
4
4
  "author": "Patrick Hein",
5
5
  "publishConfig": {
6
6
  "access": "public"