@fluojs/mongoose 1.0.0 → 1.0.2
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 +6 -4
- package/README.md +6 -4
- package/dist/connection.d.ts +3 -0
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +38 -3
- package/dist/module.d.ts +14 -3
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +15 -1
- package/dist/status.d.ts +4 -1
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +4 -0
- package/package.json +4 -4
package/README.ko.md
CHANGED
|
@@ -50,20 +50,20 @@ const connection = mongoose.createConnection('mongodb://localhost:27017/test');
|
|
|
50
50
|
class AppModule {}
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
`MongooseModule.forRootAsync(...)`는 주입된 의존성과 동기 또는 비동기로 옵션을 반환하는 `useFactory`를 지원합니다. provider를 전역으로 노출해야 할 때는 최상위 async 등록 옵션에 `global`을 전달하세요. 해석된 옵션은 모듈 인스턴스 안에서 재사용되므로 연결 설정과 dispose hook이 모든 provider에서 일관되게 유지됩니다.
|
|
53
|
+
`MongooseModule.forRootAsync(...)`는 주입된 의존성과 동기 또는 비동기로 옵션을 반환하는 `useFactory`를 지원합니다. 여러 모듈에서 async 등록 helper를 공유할 때는 export된 `MongooseAsyncModuleOptions<TConnection>` 타입을 사용하세요. provider를 전역으로 노출해야 할 때는 최상위 async 등록 옵션에 `global`을 전달하세요. 해석된 옵션은 모듈 인스턴스 안에서 재사용되므로 연결 설정과 dispose hook이 모든 provider에서 일관되게 유지됩니다.
|
|
54
54
|
|
|
55
55
|
## 라이프사이클과 종료
|
|
56
56
|
|
|
57
57
|
`MongooseModule`은 `MongooseConnection`을 fluo 애플리케이션 라이프사이클에 등록합니다. 이 패키지는 원본 Mongoose 연결을 직접 생성하거나 소유하지 않습니다. 애플리케이션 종료 시 외부 연결을 닫아야 한다면 `dispose` 훅을 전달하세요.
|
|
58
58
|
|
|
59
|
-
종료 과정은 트랜잭션 정리 순서를
|
|
59
|
+
종료 과정은 트랜잭션 정리 순서를 보존하며, 종료가 시작된 뒤에는 새 수동 또는 요청 범위 트랜잭션 경계를 거부합니다.
|
|
60
60
|
|
|
61
61
|
1. 열려 있는 요청 범위 트랜잭션은 `Application shutdown interrupted an open request transaction.` 오류로 abort됩니다.
|
|
62
62
|
2. 활성 ambient session은 transaction callback과 session cleanup이 settle될 때까지 추적됩니다.
|
|
63
63
|
3. 해당 Mongoose 세션은 `abortTransaction()`과 `endSession()` 정리를 끝냅니다.
|
|
64
64
|
4. 설정한 `dispose(connection)` 훅은 활성 요청 트랜잭션과 ambient session scope가 모두 settled된 뒤에만 실행됩니다.
|
|
65
65
|
|
|
66
|
-
`createMongoosePlatformStatusSnapshot(...)`은 트래픽 처리 중에는 `ready`, 요청 트랜잭션 drain 중에는 `shutting-down`, dispose 훅 완료 뒤에는 `stopped`를 보고합니다. 상태 details에는 `sessionStrategy`, `transactionContext: 'als'`, 활성 요청/session 개수, 리소스 소유권, strict/session 지원 진단이 포함됩니다. 수동 `transaction()`도 요청 범위 트랜잭션과 같은 명시적 세션 계약을 사용하므로, 트랜잭션에 참여해야 하는 Mongoose 모델 작업에는 repository 코드가 `conn.currentSession()`을 전달해야 합니다. 감싼 Mongoose 연결이 `connection.transaction(...)`을 노출하면 fluo는 Mongoose 자체 ambient-session scope를 보존하기 위해 그 API에 transaction boundary를 위임하면서도 같은 session을 `currentSession()`으로 노출합니다.
|
|
66
|
+
`createMongoosePlatformStatusSnapshot(...)`은 트래픽 처리 중에는 `ready`, 요청 트랜잭션 drain 중에는 `shutting-down`, dispose 훅 완료 뒤에는 `stopped`를 보고합니다. 상태 details에는 `sessionStrategy`, `transactionContext: 'als'`, 활성 요청/session 개수, 리소스 소유권, strict/session 지원 진단이 포함됩니다. 수동 `transaction()`도 요청 범위 트랜잭션과 같은 명시적 세션 계약을 사용하므로, 트랜잭션에 참여해야 하는 Mongoose 모델 작업에는 repository 코드가 `conn.currentSession()`을 전달해야 합니다. 감싼 Mongoose 연결이 `connection.transaction(...)`을 노출하면 fluo는 Mongoose 자체 ambient-session scope를 보존하기 위해 그 API에 transaction boundary를 위임하면서도 같은 session을 `currentSession()`으로 노출합니다. 요청 범위 트랜잭션은 session을 획득하는 동안과 위임된 `connection.transaction(...)` 작업을 시작하는 동안에도 request `AbortSignal`을 관찰하므로, 요청 취소가 사용자 callback 실행 전에 이러한 시작 단계를 중단할 수 있습니다.
|
|
67
67
|
|
|
68
68
|
## 공통 패턴
|
|
69
69
|
|
|
@@ -122,15 +122,17 @@ HTTP interceptor 밖에서 같은 request-aware transaction boundary가 필요
|
|
|
122
122
|
- `MongooseConnection`
|
|
123
123
|
- `MongooseTransactionInterceptor`
|
|
124
124
|
- `MONGOOSE_CONNECTION`, `MONGOOSE_DISPOSE`, `MONGOOSE_OPTIONS`
|
|
125
|
-
- `createMongooseProviders(options)`
|
|
125
|
+
- `createMongooseProviders(options)` — 호환성/수동 composition helper입니다. 애플리케이션-facing 등록에서는 module export와 provider visibility가 문서화된 namespace facade와 맞도록 `MongooseModule.forRoot(...)` 또는 `MongooseModule.forRootAsync(...)`를 우선 사용하세요.
|
|
126
126
|
- `createMongoosePlatformStatusSnapshot(...)`
|
|
127
127
|
|
|
128
128
|
### 관련 export 타입
|
|
129
129
|
|
|
130
130
|
- `MongooseModuleOptions<TConnection>`
|
|
131
|
+
- `MongooseAsyncModuleOptions<TConnection>`
|
|
131
132
|
- `MongooseConnectionLike`
|
|
132
133
|
- `MongooseSessionLike`
|
|
133
134
|
- `MongooseHandleProvider`
|
|
135
|
+
- `MongoosePlatformStatusSnapshotInput`
|
|
134
136
|
|
|
135
137
|
## 관련 패키지
|
|
136
138
|
|
package/README.md
CHANGED
|
@@ -48,20 +48,20 @@ const connection = mongoose.createConnection('mongodb://localhost:27017/test');
|
|
|
48
48
|
class AppModule {}
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
`MongooseModule.forRootAsync(...)` accepts injected dependencies and a `useFactory` that may return options synchronously or asynchronously. Pass `global` on the top-level async registration when the providers should be visible globally. The resolved options are reused for the module instance, so connection setup and disposal hooks stay consistent across all providers.
|
|
51
|
+
`MongooseModule.forRootAsync(...)` accepts injected dependencies and a `useFactory` that may return options synchronously or asynchronously. Use the exported `MongooseAsyncModuleOptions<TConnection>` type when sharing async registration helpers across modules. Pass `global` on the top-level async registration when the providers should be visible globally. The resolved options are reused for the module instance, so connection setup and disposal hooks stay consistent across all providers.
|
|
52
52
|
|
|
53
53
|
## Lifecycle and Shutdown
|
|
54
54
|
|
|
55
55
|
`MongooseModule` registers `MongooseConnection` with the fluo application lifecycle. The package does not create or own the raw Mongoose connection for you; pass a `dispose` hook when the application should close that external connection during shutdown.
|
|
56
56
|
|
|
57
|
-
Shutdown preserves transaction cleanup order:
|
|
57
|
+
Shutdown preserves transaction cleanup order and rejects new manual or request-scoped transaction boundaries once shutdown begins:
|
|
58
58
|
|
|
59
59
|
1. Open request-scoped transactions are aborted with `Application shutdown interrupted an open request transaction.`
|
|
60
60
|
2. Active ambient sessions are tracked until their transaction callback and session cleanup settle.
|
|
61
61
|
3. Their Mongoose sessions finish `abortTransaction()` and `endSession()` cleanup.
|
|
62
62
|
4. The configured `dispose(connection)` hook runs only after active request transactions and ambient session scopes have settled.
|
|
63
63
|
|
|
64
|
-
`createMongoosePlatformStatusSnapshot(...)` reports `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 still use the same explicit-session contract as request-scoped transactions: repository code must pass `conn.currentSession()` into Mongoose model operations that participate in the transaction. 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()`.
|
|
64
|
+
`createMongoosePlatformStatusSnapshot(...)` reports `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 still use the same explicit-session contract as request-scoped transactions: repository code must pass `conn.currentSession()` into Mongoose model operations that participate in the transaction. 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.
|
|
65
65
|
|
|
66
66
|
## Common Patterns
|
|
67
67
|
|
|
@@ -113,15 +113,17 @@ Use `MongooseConnection.requestTransaction(...)` directly when you need the same
|
|
|
113
113
|
- `MongooseConnection`
|
|
114
114
|
- `MongooseTransactionInterceptor`
|
|
115
115
|
- `MONGOOSE_CONNECTION`, `MONGOOSE_DISPOSE`, `MONGOOSE_OPTIONS`
|
|
116
|
-
- `createMongooseProviders(options)`
|
|
116
|
+
- `createMongooseProviders(options)` — compatibility/manual composition helper; prefer `MongooseModule.forRoot(...)` or `MongooseModule.forRootAsync(...)` for application-facing registration so module exports and provider visibility stay aligned.
|
|
117
117
|
- `createMongoosePlatformStatusSnapshot(...)`
|
|
118
118
|
|
|
119
119
|
### Related exported types
|
|
120
120
|
|
|
121
121
|
- `MongooseModuleOptions<TConnection>`
|
|
122
|
+
- `MongooseAsyncModuleOptions<TConnection>`
|
|
122
123
|
- `MongooseConnectionLike`
|
|
123
124
|
- `MongooseSessionLike`
|
|
124
125
|
- `MongooseHandleProvider`
|
|
126
|
+
- `MongoosePlatformStatusSnapshotInput`
|
|
125
127
|
|
|
126
128
|
## Related Packages
|
|
127
129
|
|
package/dist/connection.d.ts
CHANGED
|
@@ -70,7 +70,10 @@ export declare class MongooseConnection<TConnection extends MongooseConnectionLi
|
|
|
70
70
|
* @returns The callback result after the request transaction finishes or the direct-execution fallback completes.
|
|
71
71
|
*/
|
|
72
72
|
requestTransaction<T>(fn: () => Promise<T>, signal?: AbortSignal): Promise<T>;
|
|
73
|
+
private assertTransactionsAvailable;
|
|
74
|
+
private assertRequestTransactionsAvailable;
|
|
73
75
|
private runManualSessionTransaction;
|
|
76
|
+
private resolveSessionForRequest;
|
|
74
77
|
private runConnectionTransaction;
|
|
75
78
|
private trackActiveSession;
|
|
76
79
|
private trackActiveRequestTransaction;
|
package/dist/connection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAK7D,OAAO,KAAK,EACV,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACpB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAK7D,OAAO,KAAK,EACV,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAuBpB,KAAK,sBAAsB,GAAG;IAC5B,kBAAkB,EAAE,OAAO,CAAC;CAC7B,CAAC;AAmBF;;;;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,qGAAqG;IAC/F,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;IAmB5C,yFAAyF;IACzF,4BAA4B;IAY5B;;;;;;;;;;;;OAYG;IACG,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAoBtD;;;;;;;;;;;OAWG;IACG,kBAAkB,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC;IAwCnF,OAAO,CAAC,2BAA2B;IAMnC,OAAO,CAAC,kCAAkC;YAM5B,2BAA2B;YAc3B,wBAAwB;YA4BxB,wBAAwB;IActC,OAAO,CAAC,kBAAkB;IAkB1B,OAAO,CAAC,6BAA6B;IAIrC,OAAO,CAAC,+BAA+B;YAIzB,cAAc;CAW7B"}
|
package/dist/connection.js
CHANGED
|
@@ -10,6 +10,7 @@ import { Inject } from '@fluojs/core';
|
|
|
10
10
|
import { MONGOOSE_CONNECTION, MONGOOSE_DISPOSE, MONGOOSE_OPTIONS } from './tokens.js';
|
|
11
11
|
import { createMongoosePlatformStatusSnapshot } from './status.js';
|
|
12
12
|
const TRANSACTIONS_NOT_SUPPORTED_ERROR = 'Transaction not supported: Mongoose connection does not implement startSession.';
|
|
13
|
+
const TRANSACTION_UNAVAILABLE_ERROR = 'Mongoose transactions are unavailable during application shutdown.';
|
|
13
14
|
async function executeSessionTransaction(session, fn) {
|
|
14
15
|
try {
|
|
15
16
|
await session.startTransaction();
|
|
@@ -120,6 +121,7 @@ class MongooseConnection {
|
|
|
120
121
|
if (currentSession) {
|
|
121
122
|
return fn();
|
|
122
123
|
}
|
|
124
|
+
this.assertTransactionsAvailable();
|
|
123
125
|
if (typeof this.connection.transaction === 'function') {
|
|
124
126
|
return this.runConnectionTransaction(fn);
|
|
125
127
|
}
|
|
@@ -150,20 +152,36 @@ class MongooseConnection {
|
|
|
150
152
|
}
|
|
151
153
|
return fn();
|
|
152
154
|
}
|
|
155
|
+
this.assertRequestTransactionsAvailable();
|
|
153
156
|
const abortContext = createRequestAbortContext(signal);
|
|
154
157
|
const active = this.trackActiveRequestTransaction(abortContext.controller);
|
|
158
|
+
let untrackActiveInFinally = true;
|
|
155
159
|
try {
|
|
156
160
|
if (typeof this.connection.transaction === 'function') {
|
|
157
|
-
return await this.runConnectionTransaction(() => raceWithAbort(fn, abortContext.signal));
|
|
161
|
+
return await raceWithAbort(() => this.runConnectionTransaction(() => raceWithAbort(fn, abortContext.signal)), abortContext.signal);
|
|
158
162
|
}
|
|
159
|
-
const resolvedSession = await this.
|
|
163
|
+
const resolvedSession = await this.resolveSessionForRequest(abortContext.signal, active, () => {
|
|
164
|
+
untrackActiveInFinally = false;
|
|
165
|
+
});
|
|
160
166
|
if (!resolvedSession) {
|
|
161
167
|
return await raceWithAbort(fn, abortContext.signal);
|
|
162
168
|
}
|
|
163
169
|
return await this.runManualSessionTransaction(resolvedSession, () => raceWithAbort(fn, abortContext.signal));
|
|
164
170
|
} finally {
|
|
165
171
|
abortContext.cleanup();
|
|
166
|
-
|
|
172
|
+
if (untrackActiveInFinally) {
|
|
173
|
+
this.untrackActiveRequestTransaction(active);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
assertTransactionsAvailable() {
|
|
178
|
+
if (this.lifecycleState !== 'ready') {
|
|
179
|
+
throw new Error(TRANSACTION_UNAVAILABLE_ERROR);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
assertRequestTransactionsAvailable() {
|
|
183
|
+
if (this.lifecycleState !== 'ready') {
|
|
184
|
+
throw new Error(TRANSACTION_UNAVAILABLE_ERROR);
|
|
167
185
|
}
|
|
168
186
|
}
|
|
169
187
|
async runManualSessionTransaction(session, fn) {
|
|
@@ -178,6 +196,23 @@ class MongooseConnection {
|
|
|
178
196
|
}
|
|
179
197
|
}
|
|
180
198
|
}
|
|
199
|
+
async resolveSessionForRequest(signal, active, deferActiveSettlement) {
|
|
200
|
+
const sessionPromise = this.resolveSession();
|
|
201
|
+
try {
|
|
202
|
+
return await raceWithAbort(() => sessionPromise, signal);
|
|
203
|
+
} catch (error) {
|
|
204
|
+
if (!signal.aborted) {
|
|
205
|
+
throw error;
|
|
206
|
+
}
|
|
207
|
+
deferActiveSettlement();
|
|
208
|
+
void sessionPromise.then(async session => {
|
|
209
|
+
await session?.endSession();
|
|
210
|
+
}).catch(() => undefined).finally(() => {
|
|
211
|
+
this.untrackActiveRequestTransaction(active);
|
|
212
|
+
});
|
|
213
|
+
throw error;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
181
216
|
async runConnectionTransaction(fn) {
|
|
182
217
|
const activeSession = this.trackActiveSession();
|
|
183
218
|
try {
|
package/dist/module.d.ts
CHANGED
|
@@ -2,9 +2,21 @@ import type { AsyncModuleOptions } from '@fluojs/core';
|
|
|
2
2
|
import type { Provider } from '@fluojs/di';
|
|
3
3
|
import { type ModuleType } from '@fluojs/runtime';
|
|
4
4
|
import type { MongooseConnectionLike, MongooseModuleOptions } from './types.js';
|
|
5
|
-
type MongooseAsyncModuleOptions<TConnection extends MongooseConnectionLike> = AsyncModuleOptions<Omit<MongooseModuleOptions<TConnection>, 'global'>> & Pick<MongooseModuleOptions<TConnection>, 'global'>;
|
|
6
5
|
/**
|
|
7
|
-
*
|
|
6
|
+
* Async registration options accepted by `MongooseModule.forRootAsync(...)`.
|
|
7
|
+
*
|
|
8
|
+
* The factory resolves the same connection, disposal, and strict transaction
|
|
9
|
+
* options accepted by `MongooseModule.forRoot(...)`; `global` remains on the
|
|
10
|
+
* top-level async registration so callers can opt into global provider export.
|
|
11
|
+
*/
|
|
12
|
+
export type MongooseAsyncModuleOptions<TConnection extends MongooseConnectionLike> = AsyncModuleOptions<Omit<MongooseModuleOptions<TConnection>, 'global'>> & Pick<MongooseModuleOptions<TConnection>, 'global'>;
|
|
13
|
+
/**
|
|
14
|
+
* Creates Mongoose providers for compatibility-oriented manual module composition.
|
|
15
|
+
*
|
|
16
|
+
* Prefer `MongooseModule.forRoot(...)` for application registration so module
|
|
17
|
+
* exports and provider visibility stay aligned with the documented namespace
|
|
18
|
+
* facade. Use this helper only when hand-assembling providers in advanced
|
|
19
|
+
* compatibility scenarios.
|
|
8
20
|
*
|
|
9
21
|
* @param options Mongoose module options with a connection handle, optional dispose hook, and strict transaction policy.
|
|
10
22
|
* @returns Provider definitions equivalent to `MongooseModule.forRoot(...)`.
|
|
@@ -19,5 +31,4 @@ export declare class MongooseModule {
|
|
|
19
31
|
/** Creates a module definition from DI-aware async Mongoose options. */
|
|
20
32
|
static forRootAsync<TConnection extends MongooseConnectionLike>(options: MongooseAsyncModuleOptions<TConnection>): ModuleType;
|
|
21
33
|
}
|
|
22
|
-
export {};
|
|
23
34
|
//# sourceMappingURL=module.d.ts.map
|
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,
|
|
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;AAiFvD;;;;;;;;;;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,gEAAgE;IAChE,MAAM,CAAC,OAAO,CAAC,WAAW,SAAS,sBAAsB,EAAE,OAAO,EAAE,qBAAqB,CAAC,WAAW,CAAC,GAAG,UAAU;IAInH,wEAAwE;IACxE,MAAM,CAAC,YAAY,CAAC,WAAW,SAAS,sBAAsB,EAC5D,OAAO,EAAE,0BAA0B,CAAC,WAAW,CAAC,GAC/C,UAAU;CAGd"}
|
package/dist/module.js
CHANGED
|
@@ -2,6 +2,15 @@ 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
4
|
import { MongooseTransactionInterceptor } from './transaction.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Async registration options accepted by `MongooseModule.forRootAsync(...)`.
|
|
8
|
+
*
|
|
9
|
+
* The factory resolves the same connection, disposal, and strict transaction
|
|
10
|
+
* options accepted by `MongooseModule.forRoot(...)`; `global` remains on the
|
|
11
|
+
* top-level async registration so callers can opt into global provider export.
|
|
12
|
+
*/
|
|
13
|
+
|
|
5
14
|
const MONGOOSE_NORMALIZED_OPTIONS = Symbol('fluo.mongoose.normalized-options');
|
|
6
15
|
const MONGOOSE_MODULE_EXPORTS = [MongooseConnection, MongooseTransactionInterceptor];
|
|
7
16
|
function normalizeMongooseModuleOptions(options) {
|
|
@@ -54,7 +63,12 @@ function createMongooseProvidersAsync(options) {
|
|
|
54
63
|
}
|
|
55
64
|
|
|
56
65
|
/**
|
|
57
|
-
* Creates Mongoose providers for manual module composition.
|
|
66
|
+
* Creates Mongoose providers for compatibility-oriented manual module composition.
|
|
67
|
+
*
|
|
68
|
+
* Prefer `MongooseModule.forRoot(...)` for application registration so module
|
|
69
|
+
* exports and provider visibility stay aligned with the documented namespace
|
|
70
|
+
* facade. Use this helper only when hand-assembling providers in advanced
|
|
71
|
+
* compatibility scenarios.
|
|
58
72
|
*
|
|
59
73
|
* @param options Mongoose module options with a connection handle, optional dispose hook, and strict transaction policy.
|
|
60
74
|
* @returns Provider definitions equivalent to `MongooseModule.forRoot(...)`.
|
package/dist/status.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { PersistencePlatformStatusSnapshot } from '@fluojs/runtime';
|
|
2
2
|
type MongoosePlatformLifecycleState = 'ready' | 'shutting-down' | 'stopped';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Input values used to create a Mongoose persistence platform status snapshot.
|
|
5
|
+
*/
|
|
6
|
+
export type MongoosePlatformStatusSnapshotInput = {
|
|
4
7
|
activeRequestTransactions: number;
|
|
5
8
|
activeSessions: number;
|
|
6
9
|
hasActiveSession: boolean;
|
package/dist/status.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iCAAiC,EAGlC,MAAM,iBAAiB,CAAC;AAEzB,KAAK,8BAA8B,GAAG,OAAO,GAAG,eAAe,GAAG,SAAS,CAAC;AAE5E,
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iCAAiC,EAGlC,MAAM,iBAAiB,CAAC;AAEzB,KAAK,8BAA8B,GAAG,OAAO,GAAG,eAAe,GAAG,SAAS,CAAC;AAE5E;;GAEG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,yBAAyB,EAAE,MAAM,CAAC;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,8BAA8B,CAAC;IAC/C,kBAAkB,EAAE,OAAO,CAAC;IAC5B,6BAA6B,EAAE,OAAO,CAAC;IACvC,oBAAoB,EAAE,OAAO,CAAC;CAC/B,CAAC;AAqDF;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAClD,KAAK,EAAE,mCAAmC,GACzC,iCAAiC,CAoBnC"}
|
package/dist/status.js
CHANGED
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"transaction",
|
|
10
10
|
"odm"
|
|
11
11
|
],
|
|
12
|
-
"version": "1.0.
|
|
12
|
+
"version": "1.0.2",
|
|
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.
|
|
39
|
+
"@fluojs/core": "^1.0.1",
|
|
40
|
+
"@fluojs/di": "^1.0.1",
|
|
40
41
|
"@fluojs/http": "^1.0.0",
|
|
41
|
-
"@fluojs/
|
|
42
|
-
"@fluojs/runtime": "^1.0.0"
|
|
42
|
+
"@fluojs/runtime": "^1.0.1"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"mongoose": ">=7.0.0"
|