@fluojs/prisma 1.0.0-beta.4 → 1.0.0-beta.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 +10 -2
- package/README.md +12 -2
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +1 -2
- package/dist/tokens.d.ts +5 -2
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +5 -2
- package/package.json +5 -5
package/README.ko.md
CHANGED
|
@@ -114,6 +114,8 @@ await this.prisma.transaction(async () => {
|
|
|
114
114
|
});
|
|
115
115
|
```
|
|
116
116
|
|
|
117
|
+
이미 활성 트랜잭션 컨텍스트가 있는 상태에서 `transaction()`을 호출하면 `PrismaService`는 중첩 Prisma 트랜잭션을 새로 열지 않고 활성 트랜잭션 클라이언트를 재사용합니다. 중첩 호출에는 isolation level 같은 트랜잭션 옵션을 전달하면 안 됩니다. 활성 컨텍스트에서 옵션을 제공하면 ambient transaction을 재사용하는 동안 호출자의 의도를 조용히 버리지 않도록 예외로 거부합니다.
|
|
118
|
+
|
|
117
119
|
### 자동 요청 트랜잭션
|
|
118
120
|
|
|
119
121
|
컨트롤러나 메서드에 `PrismaTransactionInterceptor`를 적용하면 전체 요청을 자동으로 트랜잭션으로 감쌉니다.
|
|
@@ -188,14 +190,19 @@ defineModule(ManualPrismaModule, {
|
|
|
188
190
|
- `current(): TClient | PrismaTransactionClient<TClient>`
|
|
189
191
|
- 현재 컨텍스트에 맞는 트랜잭션 클라이언트 또는 루트 클라이언트를 반환합니다.
|
|
190
192
|
- `transaction(fn, options?): Promise<T>`
|
|
191
|
-
- 대화형 트랜잭션 내에서 함수를 실행합니다.
|
|
193
|
+
- 대화형 트랜잭션 내에서 함수를 실행합니다. 이미 트랜잭션 컨텍스트가 활성화되어 있으면 callback은 그 컨텍스트를 재사용하며, 새 Prisma 트랜잭션 경계가 열리지 않기 때문에 중첩 트랜잭션 옵션은 거부됩니다.
|
|
192
194
|
- `requestTransaction(fn, signal?, options?): Promise<T>`
|
|
193
|
-
- HTTP 요청 라이프사이클에 특화된 트랜잭션 경계를 실행합니다. Abort를 인식하고, shutdown 중에는 disconnect 전에 열린 요청 트랜잭션을 drain하며, Prisma client가 `signal` 옵션을 거부하면 해당 옵션 없이 재시도합니다.
|
|
195
|
+
- HTTP 요청 라이프사이클에 특화된 트랜잭션 경계를 실행합니다. Abort를 인식하고, shutdown 중에는 disconnect 전에 열린 요청 트랜잭션을 drain하며, Prisma client가 `signal` 옵션을 거부하면 해당 옵션 없이 재시도합니다. `transaction()`과 마찬가지로 중첩 호출은 활성 트랜잭션 컨텍스트를 재사용하고, 트랜잭션 설정을 조용히 무시하지 않도록 중첩 옵션을 거부합니다.
|
|
194
196
|
|
|
195
197
|
### `PRISMA_CLIENT` (Token)
|
|
196
198
|
|
|
197
199
|
원시 `PrismaClient` 인스턴스를 위한 주입 토큰입니다.
|
|
198
200
|
|
|
201
|
+
### `PRISMA_OPTIONS` (Token)
|
|
202
|
+
|
|
203
|
+
`PrismaService`가 소비하는 공개 런타임 옵션을 위한 주입 토큰이며, 현재 형태는 `{ strictTransactions: boolean }`입니다.
|
|
204
|
+
이는 등록 identity, client ownership, visibility metadata까지 담는 패키지 내부 정규화 모듈 옵션 토큰보다 의도적으로 좁은 표면이며, 그 내부 토큰은 공개 API가 아닙니다.
|
|
205
|
+
|
|
199
206
|
### 플랫폼 status
|
|
200
207
|
|
|
201
208
|
- `createPrismaPlatformStatusSnapshot(input)`: Prisma readiness, health, ownership, ALS 기반 transaction context를 보고하는 persistence platform status snapshot을 생성합니다.
|
|
@@ -207,6 +214,7 @@ defineModule(ManualPrismaModule, {
|
|
|
207
214
|
- `getPrismaServiceToken(name?)`
|
|
208
215
|
|
|
209
216
|
이 헬퍼들은 `name`이 없으면 기본 이름 없는 토큰을 반환하고, `name`이 있으면 해당 등록 전용 토큰을 반환합니다.
|
|
217
|
+
이 헬퍼가 이름 있는 등록을 대상으로 삼는 공개 방법이며, 정규화 모듈 옵션 토큰 같은 내부 구현 토큰은 의도적으로 export하지 않습니다.
|
|
210
218
|
|
|
211
219
|
### 관련 export 타입
|
|
212
220
|
|
package/README.md
CHANGED
|
@@ -114,6 +114,8 @@ await this.prisma.transaction(async () => {
|
|
|
114
114
|
});
|
|
115
115
|
```
|
|
116
116
|
|
|
117
|
+
When `transaction()` is called while a transaction context is already active, `PrismaService` reuses the active transaction client instead of opening a nested Prisma transaction. Nested calls must not pass transaction options such as isolation levels; providing options in an active context is rejected so the package does not silently drop caller intent while reusing the ambient transaction.
|
|
118
|
+
|
|
117
119
|
### Automatic Request Transactions
|
|
118
120
|
|
|
119
121
|
Apply the `PrismaTransactionInterceptor` to a controller or method to wrap the entire request in a transaction automatically.
|
|
@@ -188,14 +190,20 @@ defineModule(ManualPrismaModule, {
|
|
|
188
190
|
- `current(): TClient | PrismaTransactionClient<TClient>`
|
|
189
191
|
- Returns the ambient transaction client or the root client.
|
|
190
192
|
- `transaction(fn, options?): Promise<T>`
|
|
191
|
-
- Runs a function within an interactive transaction.
|
|
193
|
+
- Runs a function within an interactive transaction. If a transaction context is already active, the callback reuses that context; nested transaction options are rejected because no new Prisma transaction boundary is opened.
|
|
192
194
|
- `requestTransaction(fn, signal?, options?): Promise<T>`
|
|
193
|
-
- Specialized transaction boundary for HTTP request lifecycles. It is abort-aware, drains during shutdown before disconnect, and retries without `signal` when a Prisma client rejects that option.
|
|
195
|
+
- Specialized transaction boundary for HTTP request lifecycles. It is abort-aware, drains during shutdown before disconnect, and retries without `signal` when a Prisma client rejects that option. Like `transaction()`, nested calls reuse the active transaction context and reject nested options to avoid silently ignoring transaction settings.
|
|
194
196
|
|
|
195
197
|
### `PRISMA_CLIENT` (Token)
|
|
196
198
|
|
|
197
199
|
Injectable token for the raw `PrismaClient` instance.
|
|
198
200
|
|
|
201
|
+
### `PRISMA_OPTIONS` (Token)
|
|
202
|
+
|
|
203
|
+
Injectable token for the public runtime options consumed by `PrismaService`, currently `{ strictTransactions: boolean }`.
|
|
204
|
+
This is intentionally narrower than the package's internal normalized module-options token, which also carries registration
|
|
205
|
+
identity, client ownership, and visibility metadata and is not part of the public API.
|
|
206
|
+
|
|
199
207
|
### Platform status
|
|
200
208
|
|
|
201
209
|
- `createPrismaPlatformStatusSnapshot(input)`: Creates a persistence platform status snapshot that reports Prisma readiness, health, ownership, and ALS-backed transaction context.
|
|
@@ -207,6 +215,8 @@ Injectable token for the raw `PrismaClient` instance.
|
|
|
207
215
|
- `getPrismaServiceToken(name?)`
|
|
208
216
|
|
|
209
217
|
These helpers return the default unnamed token when `name` is omitted and a registration-specific token when `name` is provided.
|
|
218
|
+
They are the public way to target named registrations; internal implementation tokens such as the normalized module-options
|
|
219
|
+
token are deliberately not exported.
|
|
210
220
|
|
|
211
221
|
### Related exported types
|
|
212
222
|
|
package/dist/service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAK3E,OAAO,KAAK,EACV,4BAA4B,EAC5B,6BAA6B,EAC7B,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAKpB,UAAU,oBAAoB;IAC5B,kBAAkB,EAAE,OAAO,CAAC;CAC7B;AAcD;;;;;;GAMG;AACH,qBACa,aAAa,CACxB,OAAO,SAAS,gBAAgB,CAAC,kBAAkB,EAAE,mBAAmB,CAAC,EACzE,kBAAkB,GAAG,4BAA4B,CAAC,OAAO,CAAC,EAC1D,mBAAmB,GAAG,6BAA6B,CAAC,OAAO,CAAC,CAE5D,YAAW,oBAAoB,CAAC,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,CAAC,EAAE,YAAY,EAAE,qBAAqB;IAQpH,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAPjC,OAAO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140,8 @@ class PrismaService {
|
|
|
140
140
|
async requestTransaction(fn, signal, options) {
|
|
141
141
|
const abortContext = createRequestAbortContext(signal);
|
|
142
142
|
const active = this.trackActiveRequestTransaction(abortContext.controller);
|
|
143
|
-
const transactionPromise = this.runWithTransactionClient(() => raceWithAbort(fn, abortContext.signal), (callback, transactionOptions) => this.runRequestTransactionWithAbortSignal(callback, abortContext.signal, transactionOptions), options);
|
|
144
143
|
try {
|
|
145
|
-
return await
|
|
144
|
+
return await this.runWithTransactionClient(() => raceWithAbort(fn, abortContext.signal), (callback, transactionOptions) => this.runRequestTransactionWithAbortSignal(callback, abortContext.signal, transactionOptions), options);
|
|
146
145
|
} finally {
|
|
147
146
|
abortContext.cleanup();
|
|
148
147
|
this.untrackActiveRequestTransaction(active);
|
package/dist/tokens.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Token } from '@fluojs/core';
|
|
2
2
|
/** Dependency-injection token for the raw Prisma client handle. */
|
|
3
3
|
export declare const PRISMA_CLIENT: unique symbol;
|
|
4
|
-
/** Dependency-injection token for
|
|
4
|
+
/** Dependency-injection token for public Prisma runtime options, such as strict transaction mode. */
|
|
5
5
|
export declare const PRISMA_OPTIONS: unique symbol;
|
|
6
6
|
/**
|
|
7
7
|
* Returns the DI token for the raw Prisma client bound to a registration name.
|
|
@@ -11,7 +11,10 @@ export declare const PRISMA_OPTIONS: unique symbol;
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function getPrismaClientToken(name?: string): Token;
|
|
13
13
|
/**
|
|
14
|
-
* Returns the DI token for
|
|
14
|
+
* Returns the DI token for the public Prisma runtime options bound to a registration name.
|
|
15
|
+
*
|
|
16
|
+
* This token resolves the `PRISMA_OPTIONS` public surface consumed by `PrismaService`.
|
|
17
|
+
* Normalized module options remain internal implementation details.
|
|
15
18
|
*
|
|
16
19
|
* @param name Optional registration name. Omit it to target the default unnamed Prisma registration.
|
|
17
20
|
* @returns The token that resolves the matching Prisma runtime options.
|
package/dist/tokens.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE1C,mEAAmE;AACnE,eAAO,MAAM,aAAa,eAAmC,CAAC;AAC9D,
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE1C,mEAAmE;AACnE,eAAO,MAAM,aAAa,eAAmC,CAAC;AAC9D,qGAAqG;AACrG,eAAO,MAAM,cAAc,eAAoC,CAAC;AAgBhE;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK,CAMzD;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK,CAM1D;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK,CAM1D"}
|
package/dist/tokens.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Dependency-injection token for the raw Prisma client handle. */
|
|
2
2
|
export const PRISMA_CLIENT = Symbol.for('fluo.prisma.client');
|
|
3
|
-
/** Dependency-injection token for
|
|
3
|
+
/** Dependency-injection token for public Prisma runtime options, such as strict transaction mode. */
|
|
4
4
|
export const PRISMA_OPTIONS = Symbol.for('fluo.prisma.options');
|
|
5
5
|
function normalizePrismaRegistrationName(name) {
|
|
6
6
|
if (name === undefined) {
|
|
@@ -25,7 +25,10 @@ export function getPrismaClientToken(name) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* Returns the DI token for
|
|
28
|
+
* Returns the DI token for the public Prisma runtime options bound to a registration name.
|
|
29
|
+
*
|
|
30
|
+
* This token resolves the `PRISMA_OPTIONS` public surface consumed by `PrismaService`.
|
|
31
|
+
* Normalized module options remain internal implementation details.
|
|
29
32
|
*
|
|
30
33
|
* @param name Optional registration name. Omit it to target the default unnamed Prisma registration.
|
|
31
34
|
* @returns The token that resolves the matching Prisma runtime options.
|
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.5",
|
|
13
13
|
"private": false,
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"repository": {
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"dist"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@fluojs/core": "^1.0.0-beta.
|
|
39
|
+
"@fluojs/core": "^1.0.0-beta.5",
|
|
40
|
+
"@fluojs/validation": "^1.0.0-beta.4",
|
|
40
41
|
"@fluojs/http": "^1.0.0-beta.10",
|
|
41
|
-
"@fluojs/
|
|
42
|
-
"@fluojs/runtime": "^1.0.0-beta.
|
|
43
|
-
"@fluojs/di": "^1.0.0-beta.6"
|
|
42
|
+
"@fluojs/di": "^1.0.0-beta.7",
|
|
43
|
+
"@fluojs/runtime": "^1.0.0-beta.12"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@prisma/client": ">=5.0.0"
|