@fluojs/drizzle 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.
- package/README.ko.md +15 -0
- package/README.md +15 -0
- package/package.json +4 -4
package/README.ko.md
CHANGED
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
- [사용 시점](#사용-시점)
|
|
11
11
|
- [빠른 시작](#빠른-시작)
|
|
12
12
|
- [주요 패턴](#주요-패턴)
|
|
13
|
+
- [repository에서 `DrizzleDatabase.current()` 사용하기](#repository에서-drizzledatabasecurrent-사용하기)
|
|
14
|
+
- [수동 트랜잭션 경계](#수동-트랜잭션-경계)
|
|
15
|
+
- [인터셉터 기반 요청 단위 트랜잭션](#인터셉터-기반-요청-단위-트랜잭션)
|
|
16
|
+
- [종료와 상태 계약](#종료와-상태-계약)
|
|
13
17
|
- [수동 모듈 구성](#수동-모듈-구성)
|
|
14
18
|
- [공개 API 개요](#공개-api-개요)
|
|
15
19
|
- [관련 패키지](#관련-패키지)
|
|
@@ -96,6 +100,17 @@ import { DrizzleTransactionInterceptor } from '@fluojs/drizzle';
|
|
|
96
100
|
class UsersController {}
|
|
97
101
|
```
|
|
98
102
|
|
|
103
|
+
### 종료와 상태 계약
|
|
104
|
+
|
|
105
|
+
`DrizzleTransactionInterceptor`는 각 HTTP 요청을 `DrizzleDatabase.requestTransaction(...)`으로 실행합니다. 애플리케이션 종료 중에는 `DrizzleDatabase`가 아직 활성 상태인 요청 트랜잭션을 abort하고, 해당 transaction callback이 settle되거나 rollback될 때까지 기다린 뒤 선택적 `dispose(database)` hook을 실행합니다. 이 순서는 pool이나 외부 관리 리소스를 닫기 전에 driver가 rollback/cleanup 작업을 끝낼 수 있게 보장합니다.
|
|
106
|
+
|
|
107
|
+
`createDrizzlePlatformStatusSnapshot(...)`과 `DrizzleDatabase.createPlatformStatusSnapshot()`은 같은 계약을 진단 surface에 노출합니다.
|
|
108
|
+
|
|
109
|
+
- Drizzle이 종료 중이거나 중지된 상태이면, 또는 `strictTransactions`가 켜져 있는데 `database.transaction(...)` 지원이 없으면 `readiness.status`는 `not-ready`입니다.
|
|
110
|
+
- 요청 트랜잭션을 drain하는 종료 중에는 `health.status`가 `degraded`이고, dispose 이후에는 `unhealthy`입니다.
|
|
111
|
+
- `details.activeRequestTransactions`, `details.lifecycleState`, `details.strictTransactions`, `details.supportsTransaction`은 현재 요청 트랜잭션과 트랜잭션 지원 상태를 설명합니다.
|
|
112
|
+
- `ownership.externallyManaged: true`와 `ownership.ownsResources: false`는 이 패키지가 설정된 dispose hook은 실행하지만 underlying driver resource의 소유권을 주장하지 않는다는 뜻입니다.
|
|
113
|
+
|
|
99
114
|
## 수동 모듈 구성
|
|
100
115
|
|
|
101
116
|
`DrizzleModule.forRoot(...)` / `forRootAsync(...)`를 사용해 Drizzle을 등록합니다. 커스텀 `defineModule(...)` 안에서 Drizzle 지원을 조합해야 할 때도 동일한 모듈 entrypoint를 import해서 사용하세요.
|
package/README.md
CHANGED
|
@@ -10,6 +10,10 @@ Drizzle ORM integration for fluo with a transaction-aware database wrapper and a
|
|
|
10
10
|
- [When to Use](#when-to-use)
|
|
11
11
|
- [Quick Start](#quick-start)
|
|
12
12
|
- [Common Patterns](#common-patterns)
|
|
13
|
+
- [Use `DrizzleDatabase.current()` inside repositories](#use-drizzledatabasecurrent-inside-repositories)
|
|
14
|
+
- [Manual transaction boundaries](#manual-transaction-boundaries)
|
|
15
|
+
- [Request-scoped transactions with an interceptor](#request-scoped-transactions-with-an-interceptor)
|
|
16
|
+
- [Shutdown and status contracts](#shutdown-and-status-contracts)
|
|
13
17
|
- [Manual Module Composition](#manual-module-composition)
|
|
14
18
|
- [Public API Overview](#public-api-overview)
|
|
15
19
|
- [Related Packages](#related-packages)
|
|
@@ -96,6 +100,17 @@ import { DrizzleTransactionInterceptor } from '@fluojs/drizzle';
|
|
|
96
100
|
class UsersController {}
|
|
97
101
|
```
|
|
98
102
|
|
|
103
|
+
### Shutdown and status contracts
|
|
104
|
+
|
|
105
|
+
`DrizzleTransactionInterceptor` runs each HTTP request through `DrizzleDatabase.requestTransaction(...)`. During application shutdown, `DrizzleDatabase` aborts any still-active request transaction, waits for its transaction callback to settle or roll back, and only then runs the optional `dispose(database)` hook. This ordering lets drivers finish rollback/cleanup work before pools or externally managed resources are closed.
|
|
106
|
+
|
|
107
|
+
`createDrizzlePlatformStatusSnapshot(...)` and `DrizzleDatabase.createPlatformStatusSnapshot()` expose the same contract to diagnostics surfaces:
|
|
108
|
+
|
|
109
|
+
- `readiness.status` is `not-ready` while Drizzle is shutting down or stopped, and when `strictTransactions` is enabled without `database.transaction(...)` support.
|
|
110
|
+
- `health.status` is `degraded` while request transactions are draining during shutdown and `unhealthy` after disposal.
|
|
111
|
+
- `details.activeRequestTransactions`, `details.lifecycleState`, `details.strictTransactions`, and `details.supportsTransaction` describe the current request transaction and transaction-capability state.
|
|
112
|
+
- `ownership.externallyManaged: true` and `ownership.ownsResources: false` mean the package runs your configured dispose hook but does not claim ownership of the underlying driver resources.
|
|
113
|
+
|
|
99
114
|
## Manual Module Composition
|
|
100
115
|
|
|
101
116
|
Use `DrizzleModule.forRoot(...)` / `forRootAsync(...)` to register Drizzle. When you need to compose Drizzle support inside a custom `defineModule(...)` registration, import the module entrypoint there as well.
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"transaction",
|
|
10
10
|
"als"
|
|
11
11
|
],
|
|
12
|
-
"version": "1.0.0-beta.
|
|
12
|
+
"version": "1.0.0-beta.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/runtime": "^1.0.0-beta.1",
|
|
40
|
-
"@fluojs/di": "^1.0.0-beta.1",
|
|
41
39
|
"@fluojs/core": "^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
|
"drizzle-orm": ">=0.30.0"
|