@fluojs/mongoose 1.0.4 → 1.0.5
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/README.ko.md +2 -1
- package/README.md +2 -1
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +10 -1
- package/package.json +2 -2
package/README.ko.md
CHANGED
|
@@ -99,7 +99,7 @@ await this.conn.transaction(async () => {
|
|
|
99
99
|
});
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
-
감싼 연결이 `startSession()`을 구현하지 않으면 트랜잭션은 기본적으로 직접 실행으로 fallback합니다. fallback 대신 예외를 던지려면 `strictTransactions: true`를 설정합니다. 이때 오류 메시지는 `Transaction not supported: Mongoose connection does not implement startSession.`입니다.
|
|
102
|
+
감싼 연결이 `connection.transaction(...)`을 구현하면 `startSession()`이 직접 노출되지 않아도 fluo는 이를 strict transaction boundary로 취급합니다. 그렇지 않고 연결이 `startSession()`을 구현하지 않으면 트랜잭션은 기본적으로 직접 실행으로 fallback합니다. fallback 대신 예외를 던지려면 `strictTransactions: true`를 설정합니다. 이때 오류 메시지는 `Transaction not supported: Mongoose connection does not implement startSession.`입니다.
|
|
103
103
|
|
|
104
104
|
Fluo는 Mongoose operation option을 다시 쓰지 않습니다. 모델 호출이 명시적인 `{ session }`을 전달하면 그 option은 그대로 유지되며, 생략한 경우 fluo가 session을 자동 부착한다고 가정하면 안 됩니다. 같은 session에서 병렬 작업이나 중첩 transaction 기대치는 보수적으로 유지하세요. 중첩된 `MongooseConnection.transaction(...)` 호출은 같은 session에 두 번째 MongoDB transaction을 여는 대신 활성 boundary를 재사용합니다.
|
|
105
105
|
|
|
@@ -125,6 +125,7 @@ HTTP interceptor 밖에서 같은 request-aware transaction boundary가 필요
|
|
|
125
125
|
- `MONGOOSE_CONNECTION`, `MONGOOSE_DISPOSE`, `MONGOOSE_OPTIONS`
|
|
126
126
|
- `createMongooseProviders(options)` — 호환성/수동 composition helper입니다. 애플리케이션-facing 등록에서는 module export와 provider visibility가 문서화된 namespace facade와 맞도록 `MongooseModule.forRoot(...)` 또는 `MongooseModule.forRootAsync(...)`를 우선 사용하세요.
|
|
127
127
|
- `createMongoosePlatformStatusSnapshot(...)`
|
|
128
|
+
- sync 및 async 등록 모두에서 `connection`은 실제 object/function handle이어야 하며, 누락된 handle은 모듈 등록 또는 async bootstrap 중 거부됩니다.
|
|
128
129
|
|
|
129
130
|
### 관련 export 타입
|
|
130
131
|
|
package/README.md
CHANGED
|
@@ -92,7 +92,7 @@ await this.conn.transaction(async () => {
|
|
|
92
92
|
});
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
If the wrapped connection does not implement `startSession()`, transactions fall back to direct execution by default. Set `strictTransactions: true` to throw `Transaction not supported: Mongoose connection does not implement startSession.` instead of falling back.
|
|
95
|
+
If the wrapped connection implements `connection.transaction(...)`, fluo treats that as the strict transaction boundary even when `startSession()` is not exposed directly. Otherwise, when the connection does not implement `startSession()`, transactions fall back to direct execution by default. Set `strictTransactions: true` to throw `Transaction not supported: Mongoose connection does not implement startSession.` instead of falling back.
|
|
96
96
|
|
|
97
97
|
Fluo never rewrites Mongoose operation options. If a model call passes an explicit `{ session }`, that option is left intact; if it omits one, repositories should not assume fluo will attach a session for them. Keep same-session parallel work and nested transaction expectations conservative: nested `MongooseConnection.transaction(...)` calls reuse the active boundary rather than opening a second MongoDB transaction on the same session.
|
|
98
98
|
|
|
@@ -116,6 +116,7 @@ Use `MongooseConnection.requestTransaction(...)` directly when you need the same
|
|
|
116
116
|
- `MONGOOSE_CONNECTION`, `MONGOOSE_DISPOSE`, `MONGOOSE_OPTIONS`
|
|
117
117
|
- `createMongooseProviders(options)` — compatibility/manual composition helper; prefer `MongooseModule.forRoot(...)` or `MongooseModule.forRootAsync(...)` for application-facing registration so module exports and provider visibility stay aligned.
|
|
118
118
|
- `createMongoosePlatformStatusSnapshot(...)`
|
|
119
|
+
- `connection` must be a concrete object/function handle for both sync and async registration; missing handles are rejected during module registration or async bootstrap.
|
|
119
120
|
|
|
120
121
|
### Related exported types
|
|
121
122
|
|
package/dist/module.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAKhE,OAAO,KAAK,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAahF;;;;;;GAMG;AACH,MAAM,MAAM,0BAA0B,CAAC,WAAW,SAAS,sBAAsB,IAAI,kBAAkB,CACrG,IAAI,CAAC,qBAAqB,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,CACnD,GAAG,IAAI,CAAC,qBAAqB,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAKhE,OAAO,KAAK,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAahF;;;;;;GAMG;AACH,MAAM,MAAM,0BAA0B,CAAC,WAAW,SAAS,sBAAsB,IAAI,kBAAkB,CACrG,IAAI,CAAC,qBAAqB,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,CACnD,GAAG,IAAI,CAAC,qBAAqB,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,CAAC;AA4EvD;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,SAAS,sBAAsB,EAChF,OAAO,EAAE,qBAAqB,CAAC,WAAW,CAAC,GAC1C,QAAQ,EAAE,CAOZ;AA0BD;;GAEG;AACH,qBAAa,cAAc;IACzB;;;;;OAKG;IACH,MAAM,CAAC,OAAO,CAAC,WAAW,SAAS,sBAAsB,EAAE,OAAO,EAAE,qBAAqB,CAAC,WAAW,CAAC,GAAG,UAAU;IAInH;;;;;OAKG;IACH,MAAM,CAAC,YAAY,CAAC,WAAW,SAAS,sBAAsB,EAC5D,OAAO,EAAE,0BAA0B,CAAC,WAAW,CAAC,GAC/C,UAAU;CAGd"}
|
package/dist/module.js
CHANGED
|
@@ -13,7 +13,13 @@ import { MongooseTransactionInterceptor } from './transaction.js';
|
|
|
13
13
|
|
|
14
14
|
const MONGOOSE_NORMALIZED_OPTIONS = Symbol('fluo.mongoose.normalized-options');
|
|
15
15
|
const MONGOOSE_MODULE_EXPORTS = [MongooseConnection, MongooseTransactionInterceptor];
|
|
16
|
+
function isObjectLike(value) {
|
|
17
|
+
return typeof value === 'object' && value !== null || typeof value === 'function';
|
|
18
|
+
}
|
|
16
19
|
function normalizeMongooseModuleOptions(options) {
|
|
20
|
+
if (!isObjectLike(options.connection)) {
|
|
21
|
+
throw new Error('MongooseModule requires a connection option.');
|
|
22
|
+
}
|
|
17
23
|
return {
|
|
18
24
|
...options,
|
|
19
25
|
strictTransactions: options.strictTransactions ?? false
|
|
@@ -47,7 +53,10 @@ function createMongooseProvidersAsync(options) {
|
|
|
47
53
|
scope: 'singleton',
|
|
48
54
|
useFactory: async (...deps) => {
|
|
49
55
|
const resolvedOptions = await factory(...deps);
|
|
50
|
-
return normalizeMongooseModuleOptions(
|
|
56
|
+
return normalizeMongooseModuleOptions({
|
|
57
|
+
...resolvedOptions,
|
|
58
|
+
global: options.global
|
|
59
|
+
});
|
|
51
60
|
}
|
|
52
61
|
};
|
|
53
62
|
return createMongooseRuntimeProviders(normalizedOptionsProvider);
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"transaction",
|
|
10
10
|
"odm"
|
|
11
11
|
],
|
|
12
|
-
"version": "1.0.
|
|
12
|
+
"version": "1.0.5",
|
|
13
13
|
"private": false,
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"repository": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@fluojs/core": "^1.0.3",
|
|
40
40
|
"@fluojs/http": "^1.1.0",
|
|
41
41
|
"@fluojs/di": "^1.0.3",
|
|
42
|
-
"@fluojs/runtime": "^1.1.
|
|
42
|
+
"@fluojs/runtime": "^1.1.2"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"mongoose": ">=7.0.0"
|