@tstdl/base 0.92.67 → 0.92.69
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/orm/server/repository.js +7 -4
- package/package.json +6 -4
package/orm/server/repository.js
CHANGED
|
@@ -36,11 +36,11 @@ export const ENTITY_TYPE = injectionToken('EntityType');
|
|
|
36
36
|
const entityTypeToken = Symbol('EntityType');
|
|
37
37
|
const entityRepositoryConfigToken = Symbol('EntityRepositoryConfig');
|
|
38
38
|
const TRANSACTION_TIMESTAMP = sql `transaction_timestamp()`;
|
|
39
|
-
const { getCurrentEntityRepositoryContext, runInEntityRepositoryContext } = createContextProvider('EntityRepository');
|
|
39
|
+
const { getCurrentEntityRepositoryContext, runInEntityRepositoryContext, isInEntityRepositoryContext } = createContextProvider('EntityRepository');
|
|
40
40
|
let EntityRepository = class EntityRepository {
|
|
41
41
|
#repositoryConstructor;
|
|
42
42
|
#withTransactionCache = new WeakMap();
|
|
43
|
-
#encryptionSecret = inject(ENCRYPTION_SECRET, undefined, { optional: true });
|
|
43
|
+
#encryptionSecret = isInEntityRepositoryContext() ? getCurrentEntityRepositoryContext()?.encryptionSecret : inject(ENCRYPTION_SECRET, undefined, { optional: true });
|
|
44
44
|
#transformContext;
|
|
45
45
|
type;
|
|
46
46
|
table;
|
|
@@ -51,13 +51,14 @@ let EntityRepository = class EntityRepository {
|
|
|
51
51
|
constructor() {
|
|
52
52
|
this.#repositoryConstructor = new.target;
|
|
53
53
|
const entityRepositoryConfig = new.target[entityRepositoryConfigToken] ?? inject(EntityRepositoryConfig);
|
|
54
|
-
const { type, table, columnDefinitions, columnDefinitionsMap, session } = getCurrentEntityRepositoryContext() ?? {};
|
|
54
|
+
const { type, table, columnDefinitions, columnDefinitionsMap, session, transformContext } = getCurrentEntityRepositoryContext() ?? {};
|
|
55
55
|
this.type = type ?? injectArgument(this, { optional: true }) ?? assertDefinedPass(new.target[entityTypeToken], 'Missing entity type.');
|
|
56
56
|
this.table = table ?? getDrizzleTableFromType(this.type, entityRepositoryConfig.schema);
|
|
57
57
|
this.columnDefinitions = columnDefinitions ?? getColumnDefinitions(this.table);
|
|
58
58
|
this.columnDefinitionsMap = columnDefinitionsMap ?? new Map(this.columnDefinitions.map((column) => [column.objectPath.path, column]));
|
|
59
59
|
this.session = session ?? inject(Database);
|
|
60
60
|
this.isInTransaction = this.session instanceof DrizzlePgTransaction;
|
|
61
|
+
this.#transformContext = transformContext;
|
|
61
62
|
}
|
|
62
63
|
withOptionalTransaction(transaction) {
|
|
63
64
|
if (isUndefined(transaction)) {
|
|
@@ -74,7 +75,9 @@ let EntityRepository = class EntityRepository {
|
|
|
74
75
|
table: this.table,
|
|
75
76
|
columnDefinitions: this.columnDefinitions,
|
|
76
77
|
columnDefinitionsMap: this.columnDefinitionsMap,
|
|
77
|
-
session: transaction.transaction
|
|
78
|
+
session: transaction.transaction,
|
|
79
|
+
encryptionSecret: this.#encryptionSecret,
|
|
80
|
+
transformContext: this.#transformContext
|
|
78
81
|
};
|
|
79
82
|
const repositoryWithTransaction = runInEntityRepositoryContext(context, () => new this.#repositoryConstructor());
|
|
80
83
|
this.#withTransactionCache.set(transaction, repositoryWithTransaction);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tstdl/base",
|
|
3
|
-
"version": "0.92.
|
|
3
|
+
"version": "0.92.69",
|
|
4
4
|
"author": "Patrick Hein",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"./api": "./api/index.js",
|
|
44
44
|
"./application": "./application/index.js",
|
|
45
45
|
"./authentication": "./authentication/index.js",
|
|
46
|
+
"./authentication/server": "./authentication/server/index.js",
|
|
46
47
|
"./browser": "./browser/index.js",
|
|
47
48
|
"./cancellation": "./cancellation/index.js",
|
|
48
49
|
"./cookie": "./cookie/index.js",
|
|
@@ -52,10 +53,11 @@
|
|
|
52
53
|
"./decorators": "./decorators/index.js",
|
|
53
54
|
"./disposable": "./disposable/index.js",
|
|
54
55
|
"./distributed-loop": "./distributed-loop/index.js",
|
|
55
|
-
"./dom": "./dom/index.js",
|
|
56
56
|
"./document-management": "./document-management/index.js",
|
|
57
|
-
"./
|
|
57
|
+
"./document-management/server": "./document-management/server/index.js",
|
|
58
|
+
"./dom": "./dom/index.js",
|
|
58
59
|
"./enumerable": "./enumerable/index.js",
|
|
60
|
+
"./enumeration": "./enumeration/index.js",
|
|
59
61
|
"./errors": "./errors/index.js",
|
|
60
62
|
"./file": "./file/index.js",
|
|
61
63
|
"./function": "./function/index.js",
|
|
@@ -85,6 +87,7 @@
|
|
|
85
87
|
"./password": "./password/index.js",
|
|
86
88
|
"./pdf": "./pdf/index.js",
|
|
87
89
|
"./pool": "./pool/index.js",
|
|
90
|
+
"./process": "./process/index.js",
|
|
88
91
|
"./promise": "./promise/index.js",
|
|
89
92
|
"./queue": "./queue/index.js",
|
|
90
93
|
"./queue/mongo": "./queue/mongo/index.js",
|
|
@@ -102,7 +105,6 @@
|
|
|
102
105
|
"./serializer/handlers": "./serializer/handlers/index.js",
|
|
103
106
|
"./signals": "./signals/index.js",
|
|
104
107
|
"./signals/implementation": "./signals/implementation/index.js",
|
|
105
|
-
"./process": "./process/index.js",
|
|
106
108
|
"./sse": "./sse/index.js",
|
|
107
109
|
"./templates": "./templates/index.js",
|
|
108
110
|
"./templates/providers": "./templates/providers/index.js",
|