@fluojs/mongoose 1.1.0 → 1.1.1

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 CHANGED
@@ -12,6 +12,7 @@
12
12
  - [라이프사이클과 종료](#라이프사이클과-종료)
13
13
  - [공통 패턴](#공통-패턴)
14
14
  - [서비스 트랜잭션 경계 (@Transaction)](#서비스-트랜잭션-경계-transaction)
15
+ - [요청 트랜잭션 인터셉터 호환성](#요청-트랜잭션-인터셉터-호환성)
15
16
  - [수동 트랜잭션과 currentSession()](#수동-트랜잭션과-currentsession)
16
17
  - [공개 API](#공개-api)
17
18
  - [관련 패키지](#관련-패키지)
@@ -28,8 +29,11 @@ pnpm add mongoose
28
29
 
29
30
  - Mongoose를 나머지 애플리케이션과 같은 DI 및 라이프사이클 모델에 연결하고 싶을 때.
30
31
  - 모든 서비스에서 MongoDB 세션과 트랜잭션을 임시 배관 코드 없이 하나의 wrapper로 다루고 싶을 때.
32
+ - 요청 단위 트랜잭션에 명시적 `requestTransaction(...)` 경계가 필요할 때.
31
33
  - 애플리케이션이 이미 concrete Mongoose connection을 생성·구성하고 있고, fluo가 그 ownership을 대체하지 않고 관측하기를 원할 때.
32
34
 
35
+ Root `@fluojs/mongoose` wrapper는 ambient transaction context에 Node.js `node:async_hooks`를 사용하며, package manifest의 `engines.node >=20.0.0`과 동일하게 Node.js 20 이상을 지원합니다. 비 Node 런타임에서는 runtime-specific transaction-context adapter가 문서화되기 전까지 root wrapper를 import하지 말고 raw Mongoose-compatible handle을 애플리케이션 소유 provider 뒤에 등록하세요.
36
+
33
37
  ## 빠른 시작
34
38
 
35
39
  루트 모듈에 Mongoose 연결 인스턴스를 전달하여 `MongooseModule`을 등록합니다.
@@ -61,10 +65,12 @@ class AppModule {}
61
65
  종료 절차는 트랜잭션 정리 순서를 보존하고, 종료가 시작된 뒤에는 새로운 수동 또는 요청 단위 트랜잭션 경계를 거부합니다.
62
66
 
63
67
  1. 열린 요청 단위 트랜잭션은 `Application shutdown interrupted an open request transaction.`으로 abort됩니다.
64
- 2. 활성 ambient session transaction callback session cleanup이 settle될 때까지 추적됩니다.
65
- 3. 해당 Mongoose 세션은 `abortTransaction()`과 `endSession()` 정리를 끝냅니다.
68
+ 2. 활성 ambient session, 원본 request callback, fail-open 직접 실행 transaction callback 작업이 settle될 때까지 추적됩니다.
69
+ 3. 해당 Mongoose 세션은 시작된 callback이 settle된 뒤에만 `abortTransaction()`과 `endSession()` 정리를 끝냅니다.
66
70
  4. 설정한 `dispose(connection)` 훅은 활성 요청 트랜잭션과 ambient session scope가 모두 settled된 뒤에만 실행됩니다.
67
71
 
72
+ Request cancellation 또는 shutdown이 callback 시작 후 boundary를 abort하면, boundary는 abort 결과를 보존하되 원본 callback이 settle될 때까지 기다린 다음 rollback, session 종료, connection dispose를 진행합니다. 따라서 ALS-backed 작업이 이미 정리된 session이나 connection을 사용하며 계속 실행되지 않습니다.
73
+
68
74
  `MongooseConnection.createPlatformStatusSnapshot()`과 export된 low-level `createMongoosePlatformStatusSnapshot(...)` helper는 serving 중에는 `ready`, 요청 트랜잭션을 drain하는 shutdown 중에는 `shutting-down`, dispose hook 완료 후에는 `stopped`를 보고합니다. status details에는 `sessionStrategy`, `transactionContext: 'als'`, 활성 요청/세션 수, 리소스 소유권, strict/session 지원 진단이 포함됩니다. 수동 `transaction()` 호출과 서비스 `@Transaction()` 메서드는 같은 ambient session을 `conn.model(...)`에 노출합니다. 지원되는 facade 메서드(`create`, `find`, `findOne`, `aggregate`, `bulkWrite`)는 해당 세션을 자동으로 첨부합니다. 자동 세션 주입은 `MongooseConnection.model(...)` wrapper 메서드에만 scope되며, `conn.current()`가 반환하는 raw `connection.model(...)` cache/compile 경로를 교체하거나 변형하지 않습니다. 지원되지 않는 model 메서드, `doc.save()`, 외부 유틸리티에 명시적 세션 배관이 필요할 때는 `conn.currentSession()`을 사용하세요. 래핑된 Mongoose connection이 `connection.transaction(...)`을 제공하면 fluo는 Mongoose 자체 ambient-session scope를 보존하면서 동일한 세션을 `currentSession()`으로 노출하도록 해당 API에 트랜잭션 경계를 위임합니다. 요청 단위 트랜잭션은 세션을 획득하는 동안과 위임된 `connection.transaction(...)` 작업을 시작하는 동안 request `AbortSignal`을 관찰하므로, request cancellation은 사용자 callback이 실행되기 전의 startup phase를 중단할 수 있습니다.
69
75
 
70
76
  기존 수동 `transaction(...)` boundary 안에서 열린 중첩 `requestTransaction(...)` 호출은 ambient session을 재사용하고 `details.activeRequestTransactions`에 계속 표시되며, 종료 중에 abort되어 바깥 수동 transaction이 `dispose(connection)` 실행 전에 rollback할 수 있습니다.
@@ -76,15 +82,18 @@ class AppModule {}
76
82
  `@Transaction()` 데코레이터는 서비스 레이어에서 트랜잭션 경계를 정의하는 권장 방법입니다. 이 데코레이터가 적용된 메서드 내부에서 발생하는 모든 리포지토리 호출은 동일한 MongoDB 세션을 공유합니다.
77
83
 
78
84
  ```ts
79
- import { Transaction } from '@fluojs/mongoose';
80
- import { UserRepository } from './user.repository';
85
+ import { MongooseConnection, Transaction, type MongooseModelFacade } from '@fluojs/mongoose';
86
+
87
+ type UserDocument = { readonly _id: string; readonly name: string };
88
+ type UserCreateModel = MongooseModelFacade<Promise<readonly [UserDocument]>>;
89
+ type ProfileCreateModel = MongooseModelFacade<Promise<readonly { readonly userId: string }[]>>;
81
90
 
82
91
  export class UserService {
83
92
  constructor(private readonly repo: UserRepository) {}
84
93
 
85
94
  @Transaction()
86
95
  async onboardUser(dto: CreateUserDto) {
87
- const user = await this.repo.create(dto);
96
+ const [user] = await this.repo.create(dto);
88
97
  await this.repo.initProfile(user._id);
89
98
  return user;
90
99
  }
@@ -93,21 +102,41 @@ export class UserService {
93
102
  export class UserRepository {
94
103
  constructor(private readonly conn: MongooseConnection) {}
95
104
 
96
- async create(data: any) {
105
+ async create(data: CreateUserDto) {
97
106
  // @Transaction() 내부에서 conn.model()은 세션 인지형 facade를 반환합니다.
98
107
  // create, find, findOne, aggregate, bulkWrite 등의 작업은
99
108
  // 자동으로 활성 트랜잭션에 참여합니다.
100
- return this.conn.model('User').create(data);
109
+ return this.conn.model<UserCreateModel>('User').create([data]);
101
110
  }
102
111
 
103
- async initProfile(userId: any) {
104
- return this.conn.model('Profile').create({ userId });
112
+ async initProfile(userId: string) {
113
+ return this.conn.model<ProfileCreateModel>('Profile').create([{ userId }]);
105
114
  }
106
115
  }
107
116
  ```
108
117
 
109
118
  `@Transaction()` 메서드 호출은 재진입(reentrant)이 가능합니다. 데코레이터가 적용된 메서드가 다른 데코레이터 적용 메서드를 호출하더라도 하나의 동일한 MongoDB 세션 안에서 실행됩니다. 참고로 v1에서 `doc.save()`는 자동으로 세션을 주입하지 않으므로, 자동 트랜잭션 참여가 필요하다면 지원되는 facade 작업(`model.create()`, `model.find()`, `model.findOne()`, `model.aggregate()`, `model.bulkWrite()`)을 사용하세요.
110
119
 
120
+ ### 요청 트랜잭션 인터셉터 호환성
121
+
122
+ `MongooseTransactionInterceptor`는 기존 request-wide `@UseInterceptors(...)` boundary를 위한 deprecated 1.x 호환성 export로 복원되었습니다. `MongooseModule.forRoot(...)`와 `forRootAsync(...)`가 이 interceptor를 provider 및 export로 제공하며, `MongooseConnection.requestTransaction(...)`에 위임하고 request `AbortSignal`을 전달합니다.
123
+
124
+ ```ts
125
+ import { Controller, Post, UseInterceptors } from '@fluojs/http';
126
+ import { MongooseTransactionInterceptor } from '@fluojs/mongoose';
127
+
128
+ @Controller('/orders')
129
+ export class OrdersController {
130
+ @Post('/')
131
+ @UseInterceptors(MongooseTransactionInterceptor)
132
+ createOrder() {
133
+ return this.orders.create();
134
+ }
135
+ }
136
+ ```
137
+
138
+ 새 비즈니스 작업에는 서비스 계층 `@Transaction()`을 우선 사용하세요. 기존 request-wide boundary를 migration하는 동안에만 이 interceptor를 유지하고, request orchestration에서 경계를 명시해야 한다면 `requestTransaction(...)` 직접 호출로 교체하세요.
139
+
111
140
  ### 수동 트랜잭션과 currentSession()
112
141
 
113
142
  `MongooseConnection`은 활성 MongoDB 세션에 접근하기 위한 `currentSession()`과 루트 연결 handle에 접근하기 위한 `current()` 메서드를 제공합니다. 외부 유틸리티에 세션을 전달하거나 복잡한 수동 처리가 필요한 경우 escape hatch로 사용하세요.
@@ -137,17 +166,18 @@ await this.conn.transaction(async () => {
137
166
  });
138
167
  ```
139
168
 
140
- 래핑된 연결이 `connection.transaction(...)`을 구현하고 있다면 fluo는 이를 엄격한 트랜잭션 경계로 취급합니다. 그렇지 않고 `startSession()`이 없는 경우 트랜잭션은 기본값(`strictTransactions: false`)에서 callback 직접 실행으로 fail-open합니다. 이 모드는 local fake나 staged migration에는 유용하지만 rollback 원자성은 제공하지 않습니다. MongoDB transaction 보장이 필요한 production 흐름에서는 `strictTransactions: true`를 설정하세요. 그러면 transaction 지원 누락이 readiness `not-ready`와 helper 예외로 드러납니다.
169
+ 래핑된 연결이 `connection.transaction(...)`을 구현하고 있다면 fluo는 이를 엄격한 트랜잭션 경계로 취급합니다. 그렇지 않고 `startSession()`이 없는 경우 트랜잭션은 기본값(`strictTransactions: false`)에서 callback 직접 실행으로 fail-open합니다. 이 모드는 local fake나 staged migration에는 유용하지만 rollback 원자성은 제공하지 않습니다. 열린 fail-open 수동 `transaction(...)` callback도 종료 중에 drain되므로 `dispose(connection)`은 해당 callback이 settle된 뒤 실행됩니다. MongoDB transaction 보장이 필요한 production 흐름에서는 `strictTransactions: true`를 설정하세요. 그러면 transaction 지원 누락이 readiness `not-ready`와 helper 예외로 드러납니다.
141
170
 
142
- 지원되는 facade 메서드에서 fluo는 기존 Mongoose 작업 옵션을 보존하고 올바른 options 인자에 ambient `{ session }`만 병합합니다. 활성 트랜잭션 내부에서 명시적으로 `{ session: null }`을 전달하거나 다른 세션 객체를 사용하면, 의도치 않은 트랜잭션 탈출을 방지하기 위해 세션 충돌 에러를 발생시킵니다.
171
+ 지원되는 facade 메서드에서 fluo는 기존 Mongoose 작업 옵션을 보존하고 올바른 options 인자에 ambient `{ session }`만 병합합니다. `create(...)`는 Mongoose의 array overload인 `create([docs], options?)`를 통해서만 session을 주입합니다. Positional `create(docA, docB)` 인자는 마지막 문서에 `timestamps` 같은 option-like field가 있어도 그대로 전달되며 자동 session 주입을 받지 않습니다. 트랜잭션 참여가 필요하면 array overload를 사용하세요. 활성 트랜잭션 내부에서 명시적으로 `{ session: null }`을 전달하거나 다른 세션 객체를 사용하면, `findOne(filter, projection, options)`의 세 번째 options 인자를 포함해 의도치 않은 트랜잭션 탈출을 방지하는 세션 충돌 에러를 발생시킵니다. Repository code에서 typed operation result가 필요하면 result-specialized `MongooseModelFacade`를 `model<TModel>(...)` 타입 인자로 전달하세요.
143
172
 
144
173
  ## 공개 API
145
174
 
146
175
  - `MongooseModule.forRoot(options)` / `MongooseModule.forRootAsync(options)`
147
176
  - `MongooseConnection`
148
177
  - `MongooseConnection.createPlatformStatusSnapshot()` — platform observability surface를 위해 health/readiness, resource ownership, 활성 request/session drain 수, strict transaction 지원 진단을 보고합니다.
149
- - `MongooseConnection.model(name, ...args)` — 트랜잭션 밖에서는 raw model을 반환하고, 활성 트랜잭션 안에서는 underlying Mongoose connection을 변형하지 않으면서 `create`, `find`, `findOne`, `aggregate`, `bulkWrite`에 세션을 주입하는 facade를 반환합니다.
178
+ - `MongooseConnection.model<TModel>(name, ...args)` — 트랜잭션 밖에서는 callable하고 result-specializable한 `MongooseModelFacade`를 반환하고, 활성 트랜잭션 안에서는 underlying Mongoose connection을 변형하지 않으면서 `create`, `find`, `findOne`, `aggregate`, `bulkWrite`에 세션을 주입하는 버전을 반환합니다.
150
179
  - `Transaction`
180
+ - `MongooseTransactionInterceptor` — deprecated request-wide 호환성 interceptor입니다. 새 코드에서는 서비스 `@Transaction()` 또는 명시적 `requestTransaction(...)`을 우선 사용하세요.
151
181
  - `MONGOOSE_CONNECTION`, `MONGOOSE_DISPOSE`, `MONGOOSE_OPTIONS`
152
182
  - `createMongooseProviders(options)` — 호환성/수동 composition helper입니다. 애플리케이션-facing 등록에서는 module export와 provider visibility가 문서화된 namespace facade와 맞도록 `MongooseModule.forRoot(...)` 또는 `MongooseModule.forRootAsync(...)`를 우선 사용하세요.
153
183
  - `createMongoosePlatformStatusSnapshot(...)`
@@ -160,6 +190,7 @@ await this.conn.transaction(async () => {
160
190
  - `MongooseAsyncModuleOptions<TConnection>`
161
191
  - `MongooseConnectionLike`
162
192
  - `MongooseSessionLike`
193
+ - `MongooseModelFacade`
163
194
  - `MongooseHandleProvider`
164
195
  - `MongoosePlatformStatusSnapshotInput`
165
196
 
package/README.md CHANGED
@@ -12,6 +12,7 @@ Mongoose integration for fluo with session-aware transaction handling and lifecy
12
12
  - [Lifecycle and Shutdown](#lifecycle-and-shutdown)
13
13
  - [Common Patterns](#common-patterns)
14
14
  - [Service Transaction Boundary (@Transaction)](#service-transaction-boundary-transaction)
15
+ - [Request Transaction Interceptor Compatibility](#request-transaction-interceptor-compatibility)
15
16
  - [Manual Transactions and currentSession()](#manual-transactions-and-currentsession)
16
17
  - [Public API](#public-api)
17
18
  - [Related Packages](#related-packages)
@@ -31,6 +32,8 @@ pnpm add mongoose
31
32
  - when request-scoped transactions need explicit `requestTransaction(...)` boundaries
32
33
  - when an application already creates and configures its concrete Mongoose connection and wants fluo to observe, not replace, that ownership
33
34
 
35
+ The root `@fluojs/mongoose` wrapper uses Node.js `node:async_hooks` for ambient transaction context and supports Node.js 20 or newer, matching the package manifest `engines.node >=20.0.0`. For non-Node runtimes, register raw Mongoose-compatible handles behind application-owned providers instead of importing the root wrapper until a runtime-specific transaction-context adapter is documented.
36
+
34
37
  ## Quick Start
35
38
 
36
39
  ```ts
@@ -60,10 +63,12 @@ class AppModule {}
60
63
  Shutdown preserves transaction cleanup order and rejects new manual or request-scoped transaction boundaries once shutdown begins:
61
64
 
62
65
  1. Open request-scoped transactions are aborted with `Application shutdown interrupted an open request transaction.`
63
- 2. Active ambient sessions are tracked until their transaction callback and session cleanup settle.
64
- 3. Their Mongoose sessions finish `abortTransaction()` and `endSession()` cleanup.
66
+ 2. Active ambient sessions, original request callbacks, and fail-open direct-execution transaction callbacks are tracked until their work settles.
67
+ 3. Their Mongoose sessions finish `abortTransaction()` and `endSession()` cleanup only after started callbacks settle.
65
68
  4. The configured `dispose(connection)` hook runs only after active request transactions and ambient session scopes have settled.
66
69
 
70
+ When request cancellation or shutdown aborts a boundary after its callback has started, the boundary preserves the abort result but waits for the original callback to settle before rolling back, ending the session, or disposing the connection. This prevents ALS-backed work from continuing against an already-cleaned-up session or connection.
71
+
67
72
  `MongooseConnection.createPlatformStatusSnapshot()` and the exported low-level `createMongoosePlatformStatusSnapshot(...)` helper report `ready` while serving traffic, `shutting-down` while request transactions are draining, and `stopped` after the dispose hook completes. The status details include `sessionStrategy`, `transactionContext: 'als'`, active request/session counts, resource ownership, and strict/session support diagnostics. Manual `transaction()` calls and service `@Transaction()` methods expose the same ambient session to `conn.model(...)`; supported facade methods (`create`, `find`, `findOne`, `aggregate`, and `bulkWrite`) automatically attach that session. Automatic session injection is scoped to the `MongooseConnection.model(...)` wrapper method and does not replace or mutate the raw `connection.model(...)` cache/compile path returned by `conn.current()`. Use `conn.currentSession()` for unsupported model methods, `doc.save()`, or external utilities that need explicit session plumbing. If the wrapped Mongoose connection exposes `connection.transaction(...)`, fluo delegates the transaction boundary to that API so Mongoose's own ambient-session scope is preserved while still exposing the same session through `currentSession()`. Request-scoped transactions observe the request `AbortSignal` while acquiring sessions and while starting delegated `connection.transaction(...)` work, so request cancellation can interrupt those startup phases before user callbacks run.
68
73
  Nested `requestTransaction(...)` calls opened inside an existing manual `transaction(...)` boundary reuse the ambient session, stay visible in `details.activeRequestTransactions`, and are aborted during shutdown so the outer manual transaction can roll back before `dispose(connection)` runs.
69
74
 
@@ -74,15 +79,18 @@ Nested `requestTransaction(...)` calls opened inside an existing manual `transac
74
79
  The `@Transaction()` decorator is the recommended way to define transaction boundaries in your service layer. It ensures that all repository calls made within the decorated method share the same MongoDB session.
75
80
 
76
81
  ```ts
77
- import { Transaction } from '@fluojs/mongoose';
78
- import { UserRepository } from './user.repository';
82
+ import { MongooseConnection, Transaction, type MongooseModelFacade } from '@fluojs/mongoose';
83
+
84
+ type UserDocument = { readonly _id: string; readonly name: string };
85
+ type UserCreateModel = MongooseModelFacade<Promise<readonly [UserDocument]>>;
86
+ type ProfileCreateModel = MongooseModelFacade<Promise<readonly { readonly userId: string }[]>>;
79
87
 
80
88
  export class UserService {
81
89
  constructor(private readonly repo: UserRepository) {}
82
90
 
83
91
  @Transaction()
84
92
  async onboardUser(dto: CreateUserDto) {
85
- const user = await this.repo.create(dto);
93
+ const [user] = await this.repo.create(dto);
86
94
  await this.repo.initProfile(user._id);
87
95
  return user;
88
96
  }
@@ -91,21 +99,41 @@ export class UserService {
91
99
  export class UserRepository {
92
100
  constructor(private readonly conn: MongooseConnection) {}
93
101
 
94
- async create(data: any) {
102
+ async create(data: CreateUserDto) {
95
103
  // model() returns a session-aware facade inside @Transaction().
96
104
  // Operations like create, find, findOne, aggregate, and bulkWrite
97
105
  // automatically participate in the ambient transaction.
98
- return this.conn.model('User').create(data);
106
+ return this.conn.model<UserCreateModel>('User').create([data]);
99
107
  }
100
108
 
101
- async initProfile(userId: any) {
102
- return this.conn.model('Profile').create({ userId });
109
+ async initProfile(userId: string) {
110
+ return this.conn.model<ProfileCreateModel>('Profile').create([{ userId }]);
103
111
  }
104
112
  }
105
113
  ```
106
114
 
107
115
  Calls to `@Transaction()` methods are reentrant. If a decorated method calls another decorated method, they share the same underlying MongoDB session. Note that `doc.save()` is not automatically session-aware in v1; use the supported facade operations (`model.create()`, `model.find()`, `model.findOne()`, `model.aggregate()`, or `model.bulkWrite()`) for automatic transaction participation.
108
116
 
117
+ ### Request Transaction Interceptor Compatibility
118
+
119
+ `MongooseTransactionInterceptor` is restored as a deprecated 1.x compatibility export for existing request-wide `@UseInterceptors(...)` boundaries. `MongooseModule.forRoot(...)` and `forRootAsync(...)` provide and export it. It delegates to `MongooseConnection.requestTransaction(...)` and forwards the request `AbortSignal`.
120
+
121
+ ```ts
122
+ import { Controller, Post, UseInterceptors } from '@fluojs/http';
123
+ import { MongooseTransactionInterceptor } from '@fluojs/mongoose';
124
+
125
+ @Controller('/orders')
126
+ export class OrdersController {
127
+ @Post('/')
128
+ @UseInterceptors(MongooseTransactionInterceptor)
129
+ createOrder() {
130
+ return this.orders.create();
131
+ }
132
+ }
133
+ ```
134
+
135
+ Prefer service-layer `@Transaction()` for new business operations. Keep this interceptor only while migrating existing request-wide boundaries, or replace it with an explicit `requestTransaction(...)` call when request orchestration must make the boundary visible.
136
+
109
137
  ### Manual Transactions and currentSession()
110
138
 
111
139
  The `MongooseConnection` provides `currentSession()` to access the ambient MongoDB session and `current()` to access the root connection handle. Use these as escape hatches when you need to pass sessions to external utilities or perform advanced manual plumbing.
@@ -135,17 +163,18 @@ await this.conn.transaction(async () => {
135
163
  });
136
164
  ```
137
165
 
138
- If the wrapped connection implements `connection.transaction(...)`, fluo treats that as the strict transaction boundary. Otherwise, when the connection does not implement `startSession()`, transactions use fail-open direct callback execution by default (`strictTransactions: false`), which is useful for local fakes and staged migrations but provides no rollback atomicity. Set `strictTransactions: true` for production flows that require MongoDB transaction guarantees; missing transaction support then makes readiness `not-ready` and causes transaction helpers to throw.
166
+ If the wrapped connection implements `connection.transaction(...)`, fluo treats that as the strict transaction boundary. Otherwise, when the connection does not implement `startSession()`, transactions use fail-open direct callback execution by default (`strictTransactions: false`), which is useful for local fakes and staged migrations but provides no rollback atomicity. Open fail-open manual `transaction(...)` callbacks still drain during shutdown before `dispose(connection)` runs. Set `strictTransactions: true` for production flows that require MongoDB transaction guarantees; missing transaction support then makes readiness `not-ready` and causes transaction helpers to throw.
139
167
 
140
- For supported facade methods, fluo preserves existing Mongoose operation options and only merges the ambient `{ session }` into the correct options argument. If a model call passes an explicit `{ session: null }` or a different session object inside an ambient transaction, fluo throws a session conflict error to prevent accidental transaction escapes.
168
+ For supported facade methods, fluo preserves existing Mongoose operation options and only merges the ambient `{ session }` into the correct options argument. `create(...)` injects the session only through Mongoose's array overload, `create([docs], options?)`. Positional `create(docA, docB)` arguments are forwarded unchanged—even when the last document contains option-like fields such as `timestamps`—and therefore do not receive automatic session injection. Use the array overload for transaction participation. If a model call passes an explicit `{ session: null }` or a different session object inside an ambient transaction, including the third options argument of `findOne(filter, projection, options)`, fluo throws a session conflict error to prevent accidental transaction escapes. Pass a result-specialized `MongooseModelFacade` as the `model<TModel>(...)` type argument when repository code needs typed operation results.
141
169
 
142
170
  ## Public API
143
171
 
144
172
  - `MongooseModule.forRoot(options)` / `MongooseModule.forRootAsync(options)`
145
173
  - `MongooseConnection`
146
174
  - `MongooseConnection.createPlatformStatusSnapshot()` — reports health/readiness, resource ownership, active request/session drain counts, and strict transaction support diagnostics for platform observability surfaces.
147
- - `MongooseConnection.model(name, ...args)` — returns the raw model outside transactions or a session-aware facade for `create`, `find`, `findOne`, `aggregate`, and `bulkWrite` inside an active transaction without mutating the underlying Mongoose connection.
175
+ - `MongooseConnection.model<TModel>(name, ...args)` — returns the callable, result-specializable `MongooseModelFacade` outside transactions or a session-aware version for `create`, `find`, `findOne`, `aggregate`, and `bulkWrite` inside an active transaction without mutating the underlying Mongoose connection.
148
176
  - `Transaction`
177
+ - `MongooseTransactionInterceptor` — deprecated request-wide compatibility interceptor; prefer service `@Transaction()` or explicit `requestTransaction(...)` in new code.
149
178
  - `MONGOOSE_CONNECTION`, `MONGOOSE_DISPOSE`, `MONGOOSE_OPTIONS`
150
179
  - `createMongooseProviders(options)` — compatibility/manual composition helper; prefer `MongooseModule.forRoot(...)` or `MongooseModule.forRootAsync(...)` for application-facing registration so module exports and provider visibility stay aligned.
151
180
  - `createMongoosePlatformStatusSnapshot(...)`
@@ -158,6 +187,7 @@ For supported facade methods, fluo preserves existing Mongoose operation options
158
187
  - `MongooseAsyncModuleOptions<TConnection>`
159
188
  - `MongooseConnectionLike`
160
189
  - `MongooseSessionLike`
190
+ - `MongooseModelFacade`
161
191
  - `MongooseHandleProvider`
162
192
  - `MongoosePlatformStatusSnapshotInput`
163
193
 
@@ -1,9 +1,8 @@
1
1
  import type { OnApplicationShutdown } from '@fluojs/runtime';
2
- import type { MongooseConnectionLike, MongooseHandleProvider, MongooseSessionLike } from './types.js';
2
+ import type { MongooseConnectionLike, MongooseHandleProvider, MongooseModelFacade, MongooseSessionLike } from './types.js';
3
3
  type MongooseRuntimeOptions = {
4
4
  strictTransactions: boolean;
5
5
  };
6
- type MongooseModelLike = Record<PropertyKey, unknown>;
7
6
  /**
8
7
  * Session-aware Mongoose wrapper that integrates request scoping and shutdown handling with the Fluo runtime.
9
8
  *
@@ -16,6 +15,7 @@ export declare class MongooseConnection<TConnection extends MongooseConnectionLi
16
15
  private readonly sessions;
17
16
  private readonly activeRequestTransactions;
18
17
  private readonly activeSessions;
18
+ private readonly activeTransactionCallbacks;
19
19
  private lifecycleState;
20
20
  constructor(connection: TConnection, dispose?: ((connection: TConnection) => Promise<void> | void) | undefined, connectionOptions?: MongooseRuntimeOptions);
21
21
  /**
@@ -43,11 +43,12 @@ export declare class MongooseConnection<TConnection extends MongooseConnectionLi
43
43
  /**
44
44
  * Returns a model from the root connection, injecting the ambient transaction session into conservative operations.
45
45
  *
46
+ * @typeParam TModel Consumer-defined facade result contract for the wrapped model.
46
47
  * @param name Model name passed to the underlying Mongoose connection.
47
48
  * @param args Additional model resolver arguments forwarded unchanged.
48
49
  * @returns The real model outside transactions, or a model facade inside an active transaction boundary.
49
50
  */
50
- model(name: string, ...args: unknown[]): MongooseModelLike;
51
+ model<TModel extends MongooseModelFacade = MongooseModelFacade>(name: string, ...args: unknown[]): TModel;
51
52
  /** Aborts active request transactions, waits for settlement, then runs the optional dispose hook. */
52
53
  onApplicationShutdown(): Promise<void>;
53
54
  /** Produces the shared persistence status snapshot for platform diagnostics surfaces. */
@@ -82,9 +83,11 @@ export declare class MongooseConnection<TConnection extends MongooseConnectionLi
82
83
  private assertTransactionsAvailable;
83
84
  private assertRequestTransactionsAvailable;
84
85
  private runManualSessionTransaction;
86
+ private runDirectTransaction;
85
87
  private resolveSessionForRequest;
86
88
  private runConnectionTransaction;
87
89
  private trackActiveSession;
90
+ private trackActiveTransactionCallback;
88
91
  private trackActiveRequestTransaction;
89
92
  private untrackActiveRequestTransaction;
90
93
  private resolveSession;
@@ -1 +1 @@
1
- {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAS7D,OAAO,KAAK,EACV,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAuBpB,KAAK,sBAAsB,GAAG;IAC5B,kBAAkB,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,KAAK,iBAAiB,GAAG,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AAyJtD;;;;GAIG;AACH,qBACa,kBAAkB,CAAC,WAAW,SAAS,sBAAsB,GAAG,sBAAsB,CACjG,YAAW,sBAAsB,CAAC,WAAW,CAAC,EAAE,qBAAqB;IAQnE,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IARpC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgD;IACzE,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAuC;IACjF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiC;IAChE,OAAO,CAAC,cAAc,CAAkD;gBAGrD,UAAU,EAAE,WAAW,EACvB,OAAO,CAAC,GAAE,CAAC,UAAU,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,aAAA,EAC3D,iBAAiB,GAAE,sBAAsD;IAG5F;;;;;;;;;OASG;IACH,OAAO,IAAI,WAAW;IAItB;;;;;;;;;OASG;IACH,cAAc,IAAI,mBAAmB,GAAG,SAAS;IAIjD;;;;;;OAMG;IACH,KA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B"}
@@ -13,38 +13,14 @@ const TRANSACTIONS_NOT_SUPPORTED_ERROR = 'Transaction not supported: Mongoose co
13
13
  const TRANSACTION_UNAVAILABLE_ERROR = 'Mongoose transactions are unavailable during application shutdown.';
14
14
  const MODEL_OPERATIONS_WITH_OPTIONS = new Set(['aggregate', 'bulkWrite', 'create', 'find', 'findOne']);
15
15
  const MODEL_OPERATIONS_WITH_PROJECTION = new Set(['find', 'findOne']);
16
- const MONGOOSE_CREATE_OPTION_KEYS = new Set(['aggregateErrors', 'checkKeys', 'j', 'ordered', 'populate', 'safe', 'session', 'timestamps', 'validateBeforeSave', 'validateModifiedOnly', 'w', 'writeConcern', 'wtimeout']);
17
- function hasExplicitSessionOption(value) {
18
- return value !== null && typeof value === 'object' && 'session' in value;
19
- }
20
16
  function isObjectLike(value) {
21
17
  return typeof value === 'object' && value !== null || typeof value === 'function';
22
18
  }
23
- function isMongooseCreateOptionsCandidate(value) {
24
- if (!isObjectLike(value)) {
25
- return false;
26
- }
27
- for (const key of MONGOOSE_CREATE_OPTION_KEYS) {
28
- if (key in value) {
29
- return true;
30
- }
31
- }
32
- return false;
33
- }
34
- function isEmptyCreateOptionsCandidate(value) {
35
- return value !== null && typeof value === 'object' && !Array.isArray(value) && Object.keys(value).length === 0;
36
- }
37
19
  function resolveCreateOptionsIndex(operationArgs) {
38
- if (operationArgs.length >= 2 && isMongooseCreateOptionsCandidate(operationArgs[operationArgs.length - 1])) {
39
- return operationArgs.length - 1;
40
- }
41
- if (operationArgs.length === 2 && Array.isArray(operationArgs[0])) {
42
- return 1;
43
- }
44
- if (operationArgs.length === 2 && isEmptyCreateOptionsCandidate(operationArgs[1])) {
20
+ if (Array.isArray(operationArgs[0])) {
45
21
  return 1;
46
22
  }
47
- return operationArgs.length;
23
+ return undefined;
48
24
  }
49
25
  function resolveOptionsIndex(operation, operationArgs) {
50
26
  if (operation === 'create') {
@@ -56,9 +32,6 @@ function resolveOptionsIndex(operation, operationArgs) {
56
32
  if (operationArgs.length >= 3) {
57
33
  return 2;
58
34
  }
59
- if (operationArgs.length === 2 && hasExplicitSessionOption(operationArgs[1])) {
60
- return 1;
61
- }
62
35
  if (operationArgs.length <= 1) {
63
36
  return 2;
64
37
  }
@@ -87,12 +60,29 @@ function createAmbientSessionModelFacade(model, ambient) {
87
60
  return (...args) => {
88
61
  const operationArgs = [...args];
89
62
  const optionsIndex = resolveOptionsIndex(prop, operationArgs);
63
+ if (optionsIndex === undefined) {
64
+ return value.apply(target, operationArgs);
65
+ }
90
66
  operationArgs[optionsIndex] = resolveSessionOptions(operationArgs[optionsIndex], ambient);
91
67
  return value.apply(target, operationArgs);
92
68
  };
93
69
  }
94
70
  });
95
71
  }
72
+ async function raceWithAbortAndDrainCallback(fn, signal, shouldDrainAfterAbort = () => true) {
73
+ let callback;
74
+ try {
75
+ return await raceWithAbort(() => {
76
+ callback = Promise.resolve().then(fn);
77
+ return callback;
78
+ }, signal);
79
+ } catch (error) {
80
+ if (signal.aborted && callback && shouldDrainAfterAbort()) {
81
+ await callback.then(() => undefined, () => undefined);
82
+ }
83
+ throw error;
84
+ }
85
+ }
96
86
  function resolveModelFactory(connection) {
97
87
  if (!isObjectLike(connection)) {
98
88
  return undefined;
@@ -129,6 +119,7 @@ class MongooseConnection {
129
119
  sessions = new AsyncLocalStorage();
130
120
  activeRequestTransactions = new Set();
131
121
  activeSessions = new Set();
122
+ activeTransactionCallbacks = new Set();
132
123
  lifecycleState = 'ready';
133
124
  constructor(connection, dispose, connectionOptions = {
134
125
  strictTransactions: false
@@ -163,16 +154,18 @@ class MongooseConnection {
163
154
  * @returns The ambient session inside a transaction boundary, or `undefined` outside one.
164
155
  */
165
156
  currentSession() {
166
- return this.sessions.getStore();
157
+ return this.sessions.getStore()?.session;
167
158
  }
168
159
 
169
160
  /**
170
161
  * Returns a model from the root connection, injecting the ambient transaction session into conservative operations.
171
162
  *
163
+ * @typeParam TModel Consumer-defined facade result contract for the wrapped model.
172
164
  * @param name Model name passed to the underlying Mongoose connection.
173
165
  * @param args Additional model resolver arguments forwarded unchanged.
174
166
  * @returns The real model outside transactions, or a model facade inside an active transaction boundary.
175
167
  */
168
+
176
169
  model(name, ...args) {
177
170
  const modelFactory = resolveModelFactory(this.connection);
178
171
  if (typeof modelFactory !== 'function') {
@@ -189,7 +182,7 @@ class MongooseConnection {
189
182
  for (const transaction of this.activeRequestTransactions) {
190
183
  transaction.abort(new Error('Application shutdown interrupted an open request transaction.'));
191
184
  }
192
- await Promise.allSettled([...Array.from(this.activeRequestTransactions, transaction => transaction.settled), ...Array.from(this.activeSessions, session => session.settled)]);
185
+ await Promise.allSettled([...Array.from(this.activeRequestTransactions, transaction => transaction.settled), ...Array.from(this.activeSessions, session => session.settled), ...Array.from(this.activeTransactionCallbacks, callback => callback.settled)]);
193
186
  if (this.dispose) {
194
187
  await this.dispose(this.connection);
195
188
  }
@@ -231,10 +224,18 @@ class MongooseConnection {
231
224
  if (typeof this.connection.transaction === 'function') {
232
225
  return this.runConnectionTransaction(fn);
233
226
  }
234
- const session = await this.resolveSession();
227
+ const activeCallback = this.trackActiveTransactionCallback();
228
+ let session;
229
+ try {
230
+ session = await this.resolveSession();
231
+ } catch (error) {
232
+ activeCallback.settle();
233
+ throw error;
234
+ }
235
235
  if (!session) {
236
- return fn();
236
+ return this.runDirectTransaction(fn, activeCallback);
237
237
  }
238
+ activeCallback.settle();
238
239
  return this.runManualSessionTransaction(session, fn);
239
240
  }
240
241
 
@@ -251,16 +252,16 @@ class MongooseConnection {
251
252
  * @returns The callback result after the request transaction finishes or the direct-execution fallback completes.
252
253
  */
253
254
  async requestTransaction(fn, signal) {
254
- const currentSession = this.sessions.getStore();
255
- if (currentSession) {
255
+ const currentScope = this.sessions.getStore();
256
+ if (currentScope) {
256
257
  this.assertRequestTransactionsAvailable();
257
258
  const abortContext = createRequestAbortContext(signal);
258
259
  const active = this.trackActiveRequestTransaction(abortContext.controller);
259
260
  try {
260
- return await raceWithAbort(fn, abortContext.signal);
261
+ return await raceWithAbortAndDrainCallback(fn, abortContext.signal);
261
262
  } finally {
262
263
  abortContext.cleanup();
263
- this.untrackActiveRequestTransaction(active);
264
+ currentScope.activeSession.retainRequestTransaction(active);
264
265
  }
265
266
  }
266
267
  this.assertRequestTransactionsAvailable();
@@ -269,15 +270,20 @@ class MongooseConnection {
269
270
  let untrackActiveInFinally = true;
270
271
  try {
271
272
  if (typeof this.connection.transaction === 'function') {
272
- return await raceWithAbort(() => this.runConnectionTransaction(() => raceWithAbort(fn, abortContext.signal)), abortContext.signal);
273
+ let delegatedCallbackStarted = false;
274
+ const delegatedTransaction = this.runConnectionTransaction(() => {
275
+ delegatedCallbackStarted = true;
276
+ return raceWithAbortAndDrainCallback(fn, abortContext.signal);
277
+ });
278
+ return await raceWithAbortAndDrainCallback(() => delegatedTransaction, abortContext.signal, () => delegatedCallbackStarted);
273
279
  }
274
280
  const resolvedSession = await this.resolveSessionForRequest(abortContext.signal, active, () => {
275
281
  untrackActiveInFinally = false;
276
282
  });
277
283
  if (!resolvedSession) {
278
- return await raceWithAbort(fn, abortContext.signal);
284
+ return await raceWithAbortAndDrainCallback(fn, abortContext.signal);
279
285
  }
280
- return await this.runManualSessionTransaction(resolvedSession, () => raceWithAbort(fn, abortContext.signal));
286
+ return await this.runManualSessionTransaction(resolvedSession, () => raceWithAbortAndDrainCallback(fn, abortContext.signal));
281
287
  } finally {
282
288
  abortContext.cleanup();
283
289
  if (untrackActiveInFinally) {
@@ -298,7 +304,10 @@ class MongooseConnection {
298
304
  async runManualSessionTransaction(session, fn) {
299
305
  const activeSession = this.trackActiveSession();
300
306
  try {
301
- return await this.sessions.run(session, () => executeSessionTransaction(session, fn));
307
+ return await this.sessions.run({
308
+ activeSession,
309
+ session
310
+ }, () => executeSessionTransaction(session, fn));
302
311
  } finally {
303
312
  try {
304
313
  await session.endSession();
@@ -307,6 +316,13 @@ class MongooseConnection {
307
316
  }
308
317
  }
309
318
  }
319
+ async runDirectTransaction(fn, activeCallback) {
320
+ try {
321
+ return await fn();
322
+ } finally {
323
+ activeCallback.settle();
324
+ }
325
+ }
310
326
  async resolveSessionForRequest(signal, active, deferActiveSettlement) {
311
327
  const sessionPromise = this.resolveSession();
312
328
  try {
@@ -330,7 +346,10 @@ class MongooseConnection {
330
346
  if (typeof this.connection.transaction !== 'function') {
331
347
  throw new Error('Mongoose connection transaction resolver initialization failed.');
332
348
  }
333
- return await this.connection.transaction(session => this.sessions.run(session, fn));
349
+ return await this.connection.transaction(session => this.sessions.run({
350
+ activeSession,
351
+ session
352
+ }, fn));
334
353
  } finally {
335
354
  activeSession.settle();
336
355
  }
@@ -342,14 +361,37 @@ class MongooseConnection {
342
361
  settle = resolve;
343
362
  })
344
363
  };
364
+ const retainedRequestTransactions = new Set();
345
365
  this.activeSessions.add(active);
346
366
  return {
367
+ retainRequestTransaction: handle => {
368
+ retainedRequestTransactions.add(handle);
369
+ },
347
370
  settle: () => {
371
+ for (const handle of retainedRequestTransactions) {
372
+ this.untrackActiveRequestTransaction(handle);
373
+ }
374
+ retainedRequestTransactions.clear();
348
375
  this.activeSessions.delete(active);
349
376
  settle();
350
377
  }
351
378
  };
352
379
  }
380
+ trackActiveTransactionCallback() {
381
+ let settle;
382
+ const active = {
383
+ settled: new Promise(resolve => {
384
+ settle = resolve;
385
+ })
386
+ };
387
+ this.activeTransactionCallbacks.add(active);
388
+ return {
389
+ settle: () => {
390
+ this.activeTransactionCallbacks.delete(active);
391
+ settle();
392
+ }
393
+ };
394
+ }
353
395
  trackActiveRequestTransaction(controller) {
354
396
  return trackActiveRequestTransaction(this.activeRequestTransactions, controller);
355
397
  }
package/dist/module.d.ts CHANGED
@@ -30,7 +30,7 @@ export declare class MongooseModule {
30
30
  * Registers Mongoose providers from static options.
31
31
  *
32
32
  * @param options Mongoose module options with connection handle, optional dispose hook, and strict transaction mode.
33
- * @returns A module definition that exports `MongooseConnection`.
33
+ * @returns A module definition that exports `MongooseConnection` and its compatibility request interceptor.
34
34
  */
35
35
  static forRoot<TConnection extends MongooseConnectionLike>(options: MongooseModuleOptions<TConnection>): ModuleType;
36
36
  /**
@@ -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;AAIhE,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;AA2EvD;;;;;;;;;;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"}
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
@@ -1,6 +1,7 @@
1
1
  import { defineModule } from '@fluojs/runtime';
2
2
  import { MongooseConnection } from './connection.js';
3
3
  import { MONGOOSE_CONNECTION, MONGOOSE_DISPOSE, MONGOOSE_OPTIONS } from './tokens.js';
4
+ import { MongooseTransactionInterceptor } from './transaction.js';
4
5
 
5
6
  /**
6
7
  * Async registration options accepted by `MongooseModule.forRootAsync(...)`.
@@ -11,7 +12,7 @@ import { MONGOOSE_CONNECTION, MONGOOSE_DISPOSE, MONGOOSE_OPTIONS } from './token
11
12
  */
12
13
 
13
14
  const MONGOOSE_NORMALIZED_OPTIONS = Symbol('fluo.mongoose.normalized-options');
14
- const MONGOOSE_MODULE_EXPORTS = [MongooseConnection];
15
+ const MONGOOSE_MODULE_EXPORTS = [MongooseConnection, MongooseTransactionInterceptor];
15
16
  function isObjectLike(value) {
16
17
  return typeof value === 'object' && value !== null || typeof value === 'function';
17
18
  }
@@ -42,7 +43,7 @@ function createMongooseRuntimeProviders(normalizedOptionsProvider) {
42
43
  inject: [MONGOOSE_NORMALIZED_OPTIONS],
43
44
  provide: MONGOOSE_OPTIONS,
44
45
  useFactory: options => createRuntimeOptionsProviderValue(options.strictTransactions)
45
- }, MongooseConnection];
46
+ }, MongooseConnection, MongooseTransactionInterceptor];
46
47
  }
47
48
  function createMongooseProvidersAsync(options) {
48
49
  const factory = options.useFactory;
@@ -104,7 +105,7 @@ export class MongooseModule {
104
105
  * Registers Mongoose providers from static options.
105
106
  *
106
107
  * @param options Mongoose module options with connection handle, optional dispose hook, and strict transaction mode.
107
- * @returns A module definition that exports `MongooseConnection`.
108
+ * @returns A module definition that exports `MongooseConnection` and its compatibility request interceptor.
108
109
  */
109
110
  static forRoot(options) {
110
111
  return buildMongooseModule(options);
@@ -1,3 +1,6 @@
1
+ import type { CallHandler, Interceptor, InterceptorContext } from '@fluojs/http';
2
+ import { MongooseConnection } from './connection.js';
3
+ import type { MongooseConnectionLike } from './types.js';
1
4
  type TransactionConnection = {
2
5
  transaction<T>(fn: () => Promise<T>): Promise<T>;
3
6
  };
@@ -16,5 +19,26 @@ type TransactionMethod<THost, TArgs extends unknown[], TResult> = (this: THost,
16
19
  * @returns A standard method decorator that executes the original method inside a Mongoose transaction.
17
20
  */
18
21
  export declare function Transaction<THost>(accessor?: (self: THost) => TransactionConnection): <TArgs extends unknown[], TResult>(value: TransactionMethod<THost, TArgs, TResult>, context: ClassMethodDecoratorContext<THost, TransactionMethod<THost, TArgs, TResult>>) => TransactionMethod<THost, TArgs, TResult>;
22
+ /**
23
+ * Compatibility HTTP interceptor that opens a Mongoose request transaction around a routed handler.
24
+ *
25
+ * @remarks
26
+ * This deprecated 1.x bridge forwards the request `AbortSignal` to `MongooseConnection.requestTransaction(...)`.
27
+ * Prefer service-layer `@Transaction()` or an explicit request boundary for new code.
28
+ *
29
+ * @deprecated Prefer service-layer `@Transaction()` or explicit `MongooseConnection.requestTransaction(...)`.
30
+ */
31
+ export declare class MongooseTransactionInterceptor implements Interceptor {
32
+ private readonly connection;
33
+ constructor(connection: MongooseConnection<MongooseConnectionLike>);
34
+ /**
35
+ * Runs the downstream handler inside the compatibility request transaction.
36
+ *
37
+ * @param context Interceptor context containing the request cancellation signal.
38
+ * @param next Downstream handler chain.
39
+ * @returns The downstream result after the request transaction settles.
40
+ */
41
+ intercept(context: InterceptorContext, next: CallHandler): Promise<unknown>;
42
+ }
19
43
  export {};
20
44
  //# sourceMappingURL=transaction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../src/transaction.ts"],"names":[],"mappings":"AAAA,KAAK,qBAAqB,GAAG;IAC3B,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAClD,CAAC;AAEF,KAAK,iBAAiB,CAAC,KAAK,EAAE,KAAK,SAAS,OAAO,EAAE,EAAE,OAAO,IAAI,CAChE,IAAI,EAAE,KAAK,EACX,GAAG,IAAI,EAAE,KAAK,KACX,OAAO,CAAC,OAAO,CAAC,CAAC;AA6DtB;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAC/B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,qBAAqB,GAChD,CAAC,KAAK,SAAS,OAAO,EAAE,EAAE,OAAO,EAClC,KAAK,EAAE,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAC/C,OAAO,EAAE,2BAA2B,CAAC,KAAK,EAAE,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,KAClF,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,O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,CAAC,OAAO,CAAC;CAGlF"}
@@ -1,3 +1,11 @@
1
+ let _initClass;
2
+ function _applyDecs(e, t, n, r, o, i) { var a, c, u, s, f, l, p, d = Symbol.metadata || Symbol.for("Symbol.metadata"), m = Object.defineProperty, h = Object.create, y = [h(null), h(null)], v = t.length; function g(t, n, r) { return function (o, i) { n && (i = o, o = e); for (var a = 0; a < t.length; a++) i = t[a].apply(o, r ? [i] : []); return r ? i : o; }; } function b(e, t, n, r) { if ("function" != typeof e && (r || void 0 !== e)) throw new TypeError(t + " must " + (n || "be") + " a function" + (r ? "" : " or undefined")); return e; } function applyDec(e, t, n, r, o, i, u, s, f, l, p) { function d(e) { if (!p(e)) throw new TypeError("Attempted to access private element on non-instance"); } var h = [].concat(t[0]), v = t[3], w = !u, D = 1 === o, S = 3 === o, j = 4 === o, E = 2 === o; function I(t, n, r) { return function (o, i) { return n && (i = o, o = e), r && r(o), P[t].call(o, i); }; } if (!w) { var P = {}, k = [], F = S ? "get" : j || D ? "set" : "value"; if (f ? (l || D ? P = { get: _setFunctionName(function () { return v(this); }, r, "get"), set: function (e) { t[4](this, e); } } : P[F] = v, l || _setFunctionName(P[F], r, E ? "" : F)) : l || (P = Object.getOwnPropertyDescriptor(e, r)), !l && !f) { if ((c = y[+s][r]) && 7 !== (c ^ o)) throw Error("Decorating two elements with the same name (" + P[F].name + ") is not supported yet"); y[+s][r] = o < 3 ? 1 : o; } } for (var N = e, O = h.length - 1; O >= 0; O -= n ? 2 : 1) { var T = b(h[O], "A decorator", "be", !0), z = n ? h[O - 1] : void 0, A = {}, H = { kind: ["field", "accessor", "method", "getter", "setter", "class"][o], name: r, metadata: a, addInitializer: function (e, t) { if (e.v) throw new TypeError("attempted to call addInitializer after decoration was finished"); b(t, "An initializer", "be", !0), i.push(t); }.bind(null, A) }; if (w) c = T.call(z, N, H), A.v = 1, b(c, "class decorators", "return") && (N = c);else if (H.static = s, H.private = f, c = H.access = { has: f ? p.bind() : function (e) { return r in e; } }, j || (c.get = f ? E ? function (e) { return d(e), P.value; } : I("get", 0, d) : function (e) { return e[r]; }), E || S || (c.set = f ? I("set", 0, d) : function (e, t) { e[r] = t; }), N = T.call(z, D ? { get: P.get, set: P.set } : P[F], H), A.v = 1, D) { if ("object" == typeof N && N) (c = b(N.get, "accessor.get")) && (P.get = c), (c = b(N.set, "accessor.set")) && (P.set = c), (c = b(N.init, "accessor.init")) && k.unshift(c);else if (void 0 !== N) throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined"); } else b(N, (l ? "field" : "method") + " decorators", "return") && (l ? k.unshift(N) : P[F] = N); } return o < 2 && u.push(g(k, s, 1), g(i, s, 0)), l || w || (f ? D ? u.splice(-1, 0, I("get", s), I("set", s)) : u.push(E ? P[F] : b.call.bind(P[F])) : m(e, r, P)), N; } function w(e) { return m(e, d, { configurable: !0, enumerable: !0, value: a }); } return void 0 !== i && (a = i[d]), a = h(null == a ? null : a), f = [], l = function (e) { e && f.push(g(e)); }, p = function (t, r) { for (var i = 0; i < n.length; i++) { var a = n[i], c = a[1], l = 7 & c; if ((8 & c) == t && !l == r) { var p = a[2], d = !!a[3], m = 16 & c; applyDec(t ? e : e.prototype, a, m, d ? "#" + p : _toPropertyKey(p), l, l < 2 ? [] : t ? s = s || [] : u = u || [], f, !!t, d, r, t && d ? function (t) { return _checkInRHS(t) === e; } : o); } } }, p(8, 0), p(0, 0), p(8, 1), p(0, 1), l(u), l(s), c = f, v || w(e), { e: c, get c() { var n = []; return v && [w(e = applyDec(e, [t], r, e.name, 5, n)), g(n, 1)]; } }; }
3
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
4
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5
+ function _setFunctionName(e, t, n) { "symbol" == typeof t && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: !0, value: n ? n + " " + t : t }); } catch (e) {} return e; }
6
+ function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? typeof e : "null")); return e; }
7
+ import { Inject } from '@fluojs/core';
8
+ import { MongooseConnection } from './connection.js';
1
9
  function isTransactionConnection(value) {
2
10
  return (typeof value === 'object' && value !== null || typeof value === 'function') && typeof value.transaction === 'function';
3
11
  }
@@ -62,4 +70,38 @@ export function Transaction(accessor) {
62
70
  return connection.transaction(() => value.apply(this, args));
63
71
  };
64
72
  };
65
- }
73
+ }
74
+
75
+ /**
76
+ * Compatibility HTTP interceptor that opens a Mongoose request transaction around a routed handler.
77
+ *
78
+ * @remarks
79
+ * This deprecated 1.x bridge forwards the request `AbortSignal` to `MongooseConnection.requestTransaction(...)`.
80
+ * Prefer service-layer `@Transaction()` or an explicit request boundary for new code.
81
+ *
82
+ * @deprecated Prefer service-layer `@Transaction()` or explicit `MongooseConnection.requestTransaction(...)`.
83
+ */
84
+ let _MongooseTransactionI;
85
+ class MongooseTransactionInterceptor {
86
+ static {
87
+ [_MongooseTransactionI, _initClass] = _applyDecs(this, [Inject(MongooseConnection)], []).c;
88
+ }
89
+ constructor(connection) {
90
+ this.connection = connection;
91
+ }
92
+
93
+ /**
94
+ * Runs the downstream handler inside the compatibility request transaction.
95
+ *
96
+ * @param context Interceptor context containing the request cancellation signal.
97
+ * @param next Downstream handler chain.
98
+ * @returns The downstream result after the request transaction settles.
99
+ */
100
+ async intercept(context, next) {
101
+ return this.connection.requestTransaction(() => next.handle(), context.requestContext.request.signal);
102
+ }
103
+ static {
104
+ _initClass();
105
+ }
106
+ }
107
+ export { _MongooseTransactionI as MongooseTransactionInterceptor };
package/dist/types.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import type { MaybePromise } from '@fluojs/core';
2
2
  /**
3
- * Minimal Mongoose connection seam that optionally supports session creation.
3
+ * Minimal Mongoose connection seam that optionally supports session transaction APIs.
4
4
  *
5
5
  * @remarks
6
- * Fluo only requires `startSession()` to expose transaction helpers; plain connection usage still works without it.
6
+ * Fluo can open transaction helpers through either `connection.transaction(...)` or `startSession()`;
7
+ * plain connection usage still works without either API.
7
8
  */
8
9
  export interface MongooseConnectionLike {
9
10
  startSession?(): Promise<MongooseSessionLike>;
@@ -18,6 +19,32 @@ export interface MongooseSessionLike {
18
19
  abortTransaction(): MaybePromise<void>;
19
20
  endSession(): MaybePromise<void>;
20
21
  }
22
+ /**
23
+ * Callable model facade returned by `MongooseConnection.model(...)`.
24
+ *
25
+ * @remarks
26
+ * The listed operations receive the ambient transaction session automatically when called inside a transaction boundary.
27
+ * Other model properties remain available as `unknown` because fluo does not own application schema or plugin typing.
28
+ *
29
+ * @typeParam TCreateResult Result returned by `create(...)`.
30
+ * @typeParam TFindResult Result returned by `find(...)`.
31
+ * @typeParam TFindOneResult Result returned by `findOne(...)`.
32
+ * @typeParam TAggregateResult Result returned by `aggregate(...)`.
33
+ * @typeParam TBulkWriteResult Result returned by `bulkWrite(...)`.
34
+ */
35
+ export interface MongooseModelFacade<TCreateResult = unknown, TFindResult = unknown, TFindOneResult = unknown, TAggregateResult = unknown, TBulkWriteResult = unknown> {
36
+ /** Runs a Mongoose aggregate operation with ambient session options. */
37
+ aggregate(...args: unknown[]): TAggregateResult;
38
+ /** Runs a Mongoose bulk-write operation with ambient session options. */
39
+ bulkWrite(...args: unknown[]): TBulkWriteResult;
40
+ /** Runs a Mongoose create operation with ambient session options. */
41
+ create(...args: unknown[]): TCreateResult;
42
+ /** Runs a Mongoose find operation with ambient session options. */
43
+ find(...args: unknown[]): TFindResult;
44
+ /** Runs a Mongoose find-one operation with ambient session options. */
45
+ findOne(...args: unknown[]): TFindOneResult;
46
+ readonly [key: PropertyKey]: unknown;
47
+ }
21
48
  /**
22
49
  * Module options for registering a Mongoose connection and optional shutdown disposal hook.
23
50
  *
@@ -31,7 +58,8 @@ export interface MongooseModuleOptions<TConnection extends MongooseConnectionLik
31
58
  /** Whether Mongoose providers should be visible globally. Defaults to `false`. */
32
59
  global?: boolean;
33
60
  /**
34
- * Throws when transaction helpers are used against a connection that does not implement `startSession()`.
61
+ * Throws when transaction helpers are used against a connection that implements neither `connection.transaction(...)` nor
62
+ * `startSession()`.
35
63
  *
36
64
  * @remarks
37
65
  * Leave this disabled when `transaction()` / `requestTransaction()` should fall back to direct execution.
@@ -55,7 +83,7 @@ export interface MongooseHandleProvider<TConnection extends MongooseConnectionLi
55
83
  * @param args Additional model resolver arguments forwarded unchanged.
56
84
  * @returns The root model outside transactions, or a model facade inside an active transaction boundary.
57
85
  */
58
- model(name: string, ...args: unknown[]): Record<PropertyKey, unknown>;
86
+ model<TModel extends MongooseModelFacade = MongooseModelFacade>(name: string, ...args: unknown[]): TModel;
59
87
  /**
60
88
  * Opens a Mongoose session transaction boundary around `fn`.
61
89
  *
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,YAAY,CAAC,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC9C,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAC/E;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,gBAAgB,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;IACvC,iBAAiB,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;IACxC,gBAAgB,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;IACvC,UAAU,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;CAClC;AAED;;;;GAIG;AACH,MAAM,W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ACjB;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB,CAAC,WAAW,SAAS,sBAAsB,GAAG,sBAAsB;IACzG,uFAAuF;IACvF,OAAO,IAAI,WAAW,CAAC;IACvB,2FAA2F;IAC3F,cAAc,IAAI,mBAAmB,GAAG,SAAS,CAAC;IAClD;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,SAAS,mBAAmB,GAAG,mBAAmB,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAC1G;;;;;OAKG;IACH,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACjD;;;;;;OAMG;IACH,kBAAkB,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAC/E"}
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "transaction",
10
10
  "odm"
11
11
  ],
12
- "version": "1.1.0",
12
+ "version": "1.1.1",
13
13
  "private": false,
14
14
  "license": "MIT",
15
15
  "repository": {
@@ -36,10 +36,10 @@
36
36
  "dist"
37
37
  ],
38
38
  "dependencies": {
39
- "@fluojs/core": "^1.0.3",
40
- "@fluojs/http": "^1.1.2",
41
- "@fluojs/di": "^1.1.0",
42
- "@fluojs/runtime": "^1.1.8"
39
+ "@fluojs/core": "^1.1.0",
40
+ "@fluojs/http": "^2.0.1",
41
+ "@fluojs/di": "^2.0.0",
42
+ "@fluojs/runtime": "^2.0.1"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "mongoose": ">=7.0.0"