@fluojs/mongoose 1.0.0-beta.1 → 1.0.0-beta.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.
Files changed (3) hide show
  1. package/README.ko.md +13 -0
  2. package/README.md +13 -0
  3. package/package.json +4 -4
package/README.ko.md CHANGED
@@ -9,6 +9,7 @@ fluo 애플리케이션을 위한 Mongoose 라이프사이클 및 세션 기반
9
9
  - [설치](#설치)
10
10
  - [사용 시점](#사용-시점)
11
11
  - [빠른 시작](#빠른-시작)
12
+ - [라이프사이클과 종료](#라이프사이클과-종료)
12
13
  - [공통 패턴](#공통-패턴)
13
14
  - [공개 API](#공개-api)
14
15
  - [관련 패키지](#관련-패키지)
@@ -50,6 +51,18 @@ const connection = mongoose.createConnection('mongodb://localhost:27017/test');
50
51
  class AppModule {}
51
52
  ```
52
53
 
54
+ ## 라이프사이클과 종료
55
+
56
+ `MongooseModule`은 `MongooseConnection`을 fluo 애플리케이션 라이프사이클에 등록합니다. 이 패키지는 원본 Mongoose 연결을 직접 생성하거나 소유하지 않습니다. 애플리케이션 종료 시 외부 연결을 닫아야 한다면 `dispose` 훅을 전달하세요.
57
+
58
+ 종료 과정은 요청 트랜잭션 정리 순서를 보존합니다.
59
+
60
+ 1. 열려 있는 요청 범위 트랜잭션은 `Application shutdown interrupted an open request transaction.` 오류로 abort됩니다.
61
+ 2. 해당 Mongoose 세션은 `abortTransaction()`과 `endSession()` 정리를 끝냅니다.
62
+ 3. 설정한 `dispose(connection)` 훅은 활성 요청 트랜잭션이 모두 settled된 뒤에만 실행됩니다.
63
+
64
+ `createMongoosePlatformStatusSnapshot(...)`은 트래픽 처리 중에는 `ready`, 요청 트랜잭션 drain 중에는 `shutting-down`, dispose 훅 완료 뒤에는 `stopped`를 보고합니다. 수동 `transaction()`도 요청 범위 트랜잭션과 같은 명시적 세션 계약을 사용하므로, 트랜잭션에 참여해야 하는 Mongoose 모델 작업에는 repository 코드가 `conn.currentSession()`을 전달해야 합니다.
65
+
53
66
  ## 공통 패턴
54
67
 
55
68
  ### `MongooseConnection`을 통한 연결 접근
package/README.md CHANGED
@@ -9,6 +9,7 @@ Mongoose integration for fluo with session-aware transaction handling and lifecy
9
9
  - [Installation](#installation)
10
10
  - [When to Use](#when-to-use)
11
11
  - [Quick Start](#quick-start)
12
+ - [Lifecycle and Shutdown](#lifecycle-and-shutdown)
12
13
  - [Common Patterns](#common-patterns)
13
14
  - [Public API](#public-api)
14
15
  - [Related Packages](#related-packages)
@@ -47,6 +48,18 @@ const connection = mongoose.createConnection('mongodb://localhost:27017/test');
47
48
  class AppModule {}
48
49
  ```
49
50
 
51
+ ## Lifecycle and Shutdown
52
+
53
+ `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.
54
+
55
+ Shutdown preserves request transaction cleanup order:
56
+
57
+ 1. Open request-scoped transactions are aborted with `Application shutdown interrupted an open request transaction.`
58
+ 2. Their Mongoose sessions finish `abortTransaction()` and `endSession()` cleanup.
59
+ 3. The configured `dispose(connection)` hook runs only after active request transactions have settled.
60
+
61
+ `createMongoosePlatformStatusSnapshot(...)` reports `ready` while serving traffic, `shutting-down` while request transactions are draining, and `stopped` after the dispose hook completes. 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.
62
+
50
63
  ## Common Patterns
51
64
 
52
65
  ### Access the connection through `MongooseConnection`
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "transaction",
10
10
  "odm"
11
11
  ],
12
- "version": "1.0.0-beta.1",
12
+ "version": "1.0.0-beta.2",
13
13
  "private": false,
14
14
  "license": "MIT",
15
15
  "repository": {
@@ -37,9 +37,9 @@
37
37
  ],
38
38
  "dependencies": {
39
39
  "@fluojs/core": "^1.0.0-beta.1",
40
- "@fluojs/di": "^1.0.0-beta.1",
41
- "@fluojs/runtime": "^1.0.0-beta.1",
42
- "@fluojs/http": "^1.0.0-beta.1"
40
+ "@fluojs/http": "^1.0.0-beta.1",
41
+ "@fluojs/di": "^1.0.0-beta.2",
42
+ "@fluojs/runtime": "^1.0.0-beta.2"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "mongoose": ">=7.0.0"