entity-server-client 0.3.2 → 1.0.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.
Files changed (69) hide show
  1. package/dist/EntityServerClient.d.ts +432 -0
  2. package/dist/client/base.d.ts +84 -0
  3. package/dist/client/hmac.d.ts +8 -0
  4. package/dist/client/packet.d.ts +24 -0
  5. package/dist/client/request.d.ts +16 -0
  6. package/dist/client/utils.d.ts +8 -0
  7. package/dist/hooks/useEntityServer.d.ts +63 -0
  8. package/{src/index.ts → dist/index.d.ts} +1 -3
  9. package/dist/index.js +2 -0
  10. package/dist/index.js.map +7 -0
  11. package/dist/mixins/alimtalk.d.ts +56 -0
  12. package/dist/mixins/auth.d.ts +100 -0
  13. package/dist/mixins/email.d.ts +51 -0
  14. package/dist/mixins/entity.d.ts +126 -0
  15. package/dist/mixins/file.d.ts +85 -0
  16. package/dist/mixins/identity.d.ts +52 -0
  17. package/dist/mixins/llm.d.ts +94 -0
  18. package/dist/mixins/pg.d.ts +63 -0
  19. package/dist/mixins/push.d.ts +101 -0
  20. package/dist/mixins/sms.d.ts +55 -0
  21. package/dist/mixins/smtp.d.ts +51 -0
  22. package/dist/mixins/utils.d.ts +88 -0
  23. package/dist/packet.d.ts +11 -0
  24. package/dist/packet.js +2 -0
  25. package/dist/packet.js.map +7 -0
  26. package/dist/react.js +2 -0
  27. package/dist/react.js.map +7 -0
  28. package/{src/types.ts → dist/types.d.ts} +2 -42
  29. package/package.json +9 -36
  30. package/LICENSE +0 -21
  31. package/README.md +0 -128
  32. package/build.mjs +0 -36
  33. package/docs/api/alimtalk.md +0 -62
  34. package/docs/api/auth.md +0 -256
  35. package/docs/api/email.md +0 -37
  36. package/docs/api/entity.md +0 -273
  37. package/docs/api/file.md +0 -80
  38. package/docs/api/health.md +0 -47
  39. package/docs/api/identity.md +0 -32
  40. package/docs/api/import.md +0 -45
  41. package/docs/api/packet.md +0 -90
  42. package/docs/api/pg.md +0 -90
  43. package/docs/api/push.md +0 -107
  44. package/docs/api/react.md +0 -141
  45. package/docs/api/request.md +0 -118
  46. package/docs/api/setup.md +0 -43
  47. package/docs/api/sms.md +0 -45
  48. package/docs/api/smtp.md +0 -33
  49. package/docs/api/transaction.md +0 -50
  50. package/docs/api/utils.md +0 -52
  51. package/docs/apis.md +0 -26
  52. package/docs/react.md +0 -137
  53. package/src/EntityServerClient.ts +0 -28
  54. package/src/client/base.ts +0 -348
  55. package/src/client/hmac.ts +0 -41
  56. package/src/client/packet.ts +0 -77
  57. package/src/client/request.ts +0 -139
  58. package/src/client/utils.ts +0 -33
  59. package/src/hooks/useEntityServer.ts +0 -154
  60. package/src/mixins/auth.ts +0 -143
  61. package/src/mixins/entity.ts +0 -205
  62. package/src/mixins/file.ts +0 -99
  63. package/src/mixins/push.ts +0 -109
  64. package/src/mixins/smtp.ts +0 -20
  65. package/src/mixins/utils.ts +0 -106
  66. package/src/packet.ts +0 -84
  67. package/tests/packet.test.mjs +0 -50
  68. package/tsconfig.json +0 -14
  69. /package/{src/react.ts → dist/react.d.ts} +0 -0
@@ -1,118 +0,0 @@
1
- # 범용 HTTP 요청
2
-
3
- `EntityServerClient`에서 제공하지 않는 커스텀 라우트(go서버·앱서버 신규 엔드포인트 등)를 직접 호출할 때 사용합니다.
4
- 인증 헤더, 패킷 암호화, HMAC 서명 등은 기존 SDK 옵션 그대로 자동 적용됩니다.
5
-
6
- ---
7
-
8
- ## `requestJson<T>(method, path, body?, withAuth?, extraHeaders?)`
9
-
10
- JSON 요청·응답의 범용 메서드입니다.
11
-
12
- - 응답이 `application/json`이면 파싱하여 반환합니다.
13
- - 응답이 `application/octet-stream`이면 패킷 복호화 후 반환합니다.
14
- - `ok` 필드 강제 없음 — go서버처럼 자유 응답 포맷을 그대로 반환합니다.
15
- - `encryptRequests: true`이면 요청 바디도 자동 암호화됩니다.
16
-
17
- | 파라미터 | 타입 | 기본값 | 설명 |
18
- | -------------- | ------------------------ | ------ | ------------------------- |
19
- | `method` | `string` | | `"GET"`, `"POST"` 등 |
20
- | `path` | `string` | | `/api/v1/...` 형태의 경로 |
21
- | `body` | `unknown` | — | 요청 바디 (GET이면 생략) |
22
- | `withAuth` | `boolean` | `true` | `Authorization` 헤더 포함 |
23
- | `extraHeaders` | `Record<string, string>` | — | 추가 헤더 |
24
-
25
- ```ts
26
- // GET — 인증 없이
27
- const res = await client.requestJson<{ version: string }>(
28
- "GET",
29
- "/api/v1/status",
30
- undefined,
31
- false,
32
- );
33
- console.log(res.version);
34
-
35
- // POST — 인증 포함, 암호화 자동 적용
36
- const res = await client.requestJson<{ distance_nm: number }>(
37
- "POST",
38
- "/api/v1/distance-server/route",
39
- { from: [37.5665, 126.978], to: [35.1796, 129.0756] },
40
- );
41
- console.log(res.distance_nm);
42
-
43
- // 추가 헤더
44
- const res = await client.requestJson<MyResponse>(
45
- "POST",
46
- "/api/v1/custom/endpoint",
47
- { key: "value" },
48
- true,
49
- { "X-Custom-Header": "value" },
50
- );
51
- ```
52
-
53
- ---
54
-
55
- ## `requestBinary(method, path, body?, withAuth?)`
56
-
57
- 바이너리(ArrayBuffer) 응답을 그대로 반환합니다.
58
- 이미지, PDF, 압축 파일 등 바이너리 스트림이 오는 엔드포인트에 사용합니다.
59
-
60
- ```ts
61
- const buffer = await client.requestBinary("GET", "/api/v1/export/report.pdf");
62
-
63
- // Blob 변환 후 다운로드
64
- const blob = new Blob([buffer], { type: "application/pdf" });
65
- const url = URL.createObjectURL(blob);
66
- ```
67
-
68
- ---
69
-
70
- ## `requestForm<T>(method, path, form, withAuth?)`
71
-
72
- `multipart/form-data` 요청을 보내고 JSON 응답을 반환합니다.
73
- 파일과 일반 필드를 함께 전송해야 하는 커스텀 엔드포인트에 사용합니다.
74
-
75
- ```ts
76
- const form = new FormData();
77
- form.append("file", fileBlob, "document.pdf");
78
- form.append("category", "report");
79
-
80
- const res = await client.requestForm<{ ok: boolean; seq: number }>(
81
- "POST",
82
- "/api/v1/custom/upload",
83
- form,
84
- );
85
- console.log(res.seq);
86
- ```
87
-
88
- ---
89
-
90
- ## `requestFormBinary(method, path, form, withAuth?)`
91
-
92
- `multipart/form-data` 요청을 보내고 바이너리(ArrayBuffer)를 반환합니다.
93
- 업로드 후 처리된 파일(변환·압축 등)을 바이너리로 받을 때 사용합니다.
94
-
95
- ```ts
96
- const form = new FormData();
97
- form.append("image", imageBlob, "photo.jpg");
98
-
99
- const processedBuffer = await client.requestFormBinary(
100
- "POST",
101
- "/api/v1/custom/image-process",
102
- form,
103
- );
104
- ```
105
-
106
- ---
107
-
108
- ## 내부 메서드와의 차이
109
-
110
- SDK 내부에서 엔티티 API를 호출할 때는 `ok: true` 강제 검사가 있는 `_request()`를 사용합니다.
111
- 외부에서 커스텀 엔드포인트를 호출할 때는 위의 public 메서드를 사용하세요.
112
-
113
- | 메서드 | public | `ok` 강제 | 암호화 | 용도 |
114
- | ------------------- | ------ | --------- | ------ | ----------------------------- |
115
- | `requestJson` | ✅ | ❌ | ✅ | 커스텀 라우트 (JSON) |
116
- | `requestBinary` | ✅ | ❌ | ❌ | 커스텀 라우트 (바이너리) |
117
- | `requestForm` | ✅ | ✅ | ❌ | 커스텀 라우트 (form) |
118
- | `requestFormBinary` | ✅ | ❌ | ❌ | 커스텀 라우트 (form→바이너리) |
package/docs/api/setup.md DELETED
@@ -1,43 +0,0 @@
1
- # 인스턴스 생성/설정
2
-
3
- ## `new EntityServerClient(options?)`
4
-
5
- | 옵션 | 타입 | 기본값 | 설명 |
6
- | ------------------ | ---------------------------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
7
- | `baseUrl` | `string` | `VITE_ENTITY_SERVER_URL` 또는 `""` | 서버 주소 |
8
- | `token` | `string` | `""` | JWT Access Token |
9
- | `encryptRequests` | `boolean` | `false` | `true` 로 설정하면 인증된 POST/PUT/PATCH 요청 바디를 XChaCha20-Poly1305 로 암호화하여 전송합니다. 서버에서 `requirePacketEncryption = true` 로 설정된 경우 반드시 활성화해야 합니다. |
10
- | `keepSession` | `boolean` | `false` | `true`이면 `login()` 성공 후 Access Token 만료 전에 자동으로 갱신합니다. |
11
- | `refreshBuffer` | `number` | `60` | 만료 몇 초 전에 갱신을 시도할지 설정합니다. 예: `expires_in=3600`, `refreshBuffer=60` → 3540초 후 갱신 |
12
- | `onTokenRefreshed` | `(accessToken, expiresIn) => void` | — | 자동 갱신 성공 시 호출됩니다. 새 `access_token`을 받아 앱 레벨 저장소에 업데이트하세요. |
13
- | `onSessionExpired` | `(error: Error) => void` | — | 세션 유지 갱신 실패 시 호출됩니다 (refresh_token 만료 등). 로그인 페이지로 이동하는 등의 처리를 여기서 합니다. |
14
-
15
- ```ts
16
- // 직접 생성
17
- const client = new EntityServerClient({
18
- baseUrl: "https://api.example.com",
19
- token: "eyJhbGciOi...",
20
- encryptRequests: true, // 요청 바디 암호화 활성화
21
- });
22
-
23
- // 싱글톤 (환경변수 자동 읽기)
24
- import { entityServer } from "entity-server-client";
25
- ```
26
-
27
- ## `configure(options)`
28
-
29
- 런타임에 설정을 갱신합니다.
30
-
31
- ```ts
32
- client.configure({
33
- baseUrl: "https://api.example.com",
34
- token: "new-access-token",
35
- encryptRequests: true,
36
- });
37
- ```
38
-
39
- ## `setToken(token)`
40
-
41
- ```ts
42
- client.setToken("eyJhbGciOi...");
43
- ```
package/docs/api/sms.md DELETED
@@ -1,45 +0,0 @@
1
- # SMS
2
-
3
- ## `smsSend(req)`
4
-
5
- SMS를 직접 발송합니다.
6
-
7
- | 필드 | 타입 | 설명 |
8
- | ------ | -------- | ---------------------------------- |
9
- | `to` | `string` | 수신 전화번호 (`01012345678` 형식) |
10
- | `text` | `string` | 메시지 내용 |
11
- | `from` | `string` | 발신 번호 (미지정 시 설정값 사용) |
12
-
13
- ```ts
14
- const res = await client.smsSend({
15
- to: "01012345678",
16
- text: "안녕하세요. 인증번호는 123456입니다.",
17
- });
18
- res.seq; // 발송 로그 seq
19
- ```
20
-
21
- ## `smsStatus(seq)`
22
-
23
- SMS 발송 처리 상태를 조회합니다.
24
-
25
- ```ts
26
- const res = await client.smsStatus(10);
27
- res.status; // "sent" | "failed" | "pending"
28
- ```
29
-
30
- ## `smsVerificationSend(phone)`
31
-
32
- SMS 인증번호를 발송합니다. 인증 불필요 (공개 API).
33
-
34
- ```ts
35
- await client.smsVerificationSend("01012345678");
36
- ```
37
-
38
- ## `smsVerificationVerify(phone, code)`
39
-
40
- 발송된 SMS 인증번호를 검증합니다. 인증 불필요 (공개 API).
41
-
42
- ```ts
43
- const res = await client.smsVerificationVerify("01012345678", "123456");
44
- res.verified; // true | false
45
- ```
package/docs/api/smtp.md DELETED
@@ -1,33 +0,0 @@
1
- # SMTP 메일
2
-
3
- ## `smtpSend(req)`
4
-
5
- SMTP를 통해 이메일을 발송합니다.
6
-
7
- | 필드 | 타입 | 설명 |
8
- | --------- | ---------- | ---------------------------- |
9
- | `to` | `string` | 수신 이메일 주소 |
10
- | `subject` | `string` | 이메일 제목 |
11
- | `html` | `string` | HTML 본문 |
12
- | `text` | `string` | 텍스트 본문 (HTML 대체) |
13
- | `from` | `string` | 발신 주소 (미지정 시 설정값) |
14
- | `cc` | `string[]` | 참조 수신자 목록 |
15
- | `bcc` | `string[]` | 숨은 참조 수신자 목록 |
16
-
17
- ```ts
18
- const res = await client.smtpSend({
19
- to: "user@example.com",
20
- subject: "가입을 환영합니다!",
21
- html: "<h1>안녕하세요</h1><p>가입해주셔서 감사합니다.</p>",
22
- });
23
- res.seq; // 발송 로그 seq
24
- ```
25
-
26
- ## `smtpStatus(seq)`
27
-
28
- SMTP 발송 로그의 처리 상태를 조회합니다.
29
-
30
- ```ts
31
- const res = await client.smtpStatus(5);
32
- res.status; // "sent" | "failed" | "pending"
33
- ```
@@ -1,50 +0,0 @@
1
- # 트랜잭션
2
-
3
- 여러 submit/delete를 하나의 DB 트랜잭션으로 묶습니다.
4
- 트랜잭션은 **5분 TTL**을 가집니다. 이 안에 commit 또는 rollback을 해야 합니다.
5
-
6
- ```
7
- transStart → submit/delete (여러 개) → transCommit
8
- └→ transRollback (실패 시)
9
- ```
10
-
11
- ## `transStart()`
12
-
13
- 트랜잭션을 시작하고 내부 활성 트랜잭션 ID를 저장합니다.
14
- 이후 `submit()`/`delete()`는 `X-Transaction-ID` 헤더를 자동 포함합니다.
15
-
16
- ```ts
17
- const txId = await client.transStart();
18
- ```
19
-
20
- ## `transCommit(transactionId?)`
21
-
22
- 큐에 쌓인 모든 작업을 단일 DB 트랜잭션으로 일괄 실행합니다.
23
- 하나라도 실패하면 전체 ROLLBACK됩니다.
24
-
25
- ```ts
26
- await client.transStart();
27
- await client.submit("order", { product_seq: 1, qty: 2 });
28
- await client.submit("inventory", { seq: 1, stock: 48 });
29
- const result = await client.transCommit();
30
- // result.results → [{ entity: "order", action: "submit", seq: 55 }, ...]
31
- ```
32
-
33
- > **트랜잭션 중 submit 응답**: commit 전에는 `{ ok: true, queued: true, seq: "$tx.0" }` 형태의
34
- > placeholder가 반환됩니다. `$tx.0`, `$tx.1` 값은 commit 시 실제 seq로 자동 치환되므로
35
- > 후속 submit의 외래키 값으로 그대로 사용할 수 있습니다.
36
-
37
- ## `transRollback(transactionId?)`
38
-
39
- - 아직 commit 전 (큐에 남아있음): 큐를 버립니다. DB에 아무 변경 없음.
40
- - 이미 commit 후: history 기반으로 전체 되돌립니다.
41
-
42
- ```ts
43
- try {
44
- await client.transStart();
45
- await client.submit("order", { ... });
46
- await client.transCommit();
47
- } catch (e) {
48
- await client.transRollback(); // 활성 트랜잭션 자동 참조
49
- }
50
- ```
package/docs/api/utils.md DELETED
@@ -1,52 +0,0 @@
1
- # QR코드 / 바코드
2
-
3
- ## `qrcode(content, opts?)`
4
-
5
- QR 코드 PNG를 생성합니다. `ArrayBuffer`를 반환합니다.
6
-
7
- | 옵션 | 타입 | 설명 |
8
- | -------- | -------- | --------------------------------- |
9
- | `size` | `number` | 이미지 크기 (px). 기본값 `256` |
10
- | `level` | `string` | 오류 정정 레벨 `L \| M \| Q \| H` |
11
- | `format` | `string` | 출력 포맷. 기본값 `"png"` |
12
-
13
- ```ts
14
- const buf = await client.qrcode("https://example.com", { size: 300 });
15
- const blob = new Blob([buf], { type: "image/png" });
16
- img.src = URL.createObjectURL(blob);
17
- ```
18
-
19
- ## `qrcodeBase64(content, opts?)`
20
-
21
- QR 코드를 base64 / data URI JSON으로 반환합니다.
22
-
23
- ```ts
24
- const res = await client.qrcodeBase64("https://example.com");
25
- res.data_uri; // "data:image/png;base64,..."
26
- res.data; // base64 문자열
27
- img.src = res.data_uri;
28
- ```
29
-
30
- ## `qrcodeText(content, opts?)`
31
-
32
- QR 코드를 ASCII 아트 텍스트로 반환합니다.
33
-
34
- ```ts
35
- const res = await client.qrcodeText("https://example.com");
36
- console.log(res.text); // ASCII 아트 QR 코드
37
- ```
38
-
39
- ## `barcode(content, opts?)`
40
-
41
- 바코드 PNG를 생성합니다. `ArrayBuffer`를 반환합니다.
42
-
43
- | 옵션 | 타입 | 설명 |
44
- | ------ | -------- | -------------------------------------------------- |
45
- | `type` | `string` | 바코드 형식. 예: `"code128"`, `"ean13"`, `"qr"` 등 |
46
- | `size` | `number` | 이미지 크기 |
47
-
48
- ```ts
49
- const buf = await client.barcode("1234567890128", { type: "ean13" });
50
- const blob = new Blob([buf], { type: "image/png" });
51
- img.src = URL.createObjectURL(blob);
52
- ```
package/docs/apis.md DELETED
@@ -1,26 +0,0 @@
1
- # entity-server-client API 문서
2
-
3
- 각 섹션은 별도 파일로 분리되어 있습니다.
4
-
5
- ## 목차
6
-
7
- | 구분 | 파일 |
8
- | ------------------ | ---------------------------------------- |
9
- | import | [api/import.md](api/import.md) |
10
- | 서버 헬스체크 | [api/health.md](api/health.md) |
11
- | 인스턴스 생성/설정 | [api/setup.md](api/setup.md) |
12
- | 인증 | [api/auth.md](api/auth.md) |
13
- | 트랜잭션 | [api/transaction.md](api/transaction.md) |
14
- | 엔티티 CRUD / 조회 | [api/entity.md](api/entity.md) |
15
- | 푸시 관련 | [api/push.md](api/push.md) |
16
- | 이메일 인증 / 변경 | [api/email.md](api/email.md) |
17
- | SMS | [api/sms.md](api/sms.md) |
18
- | SMTP 메일 | [api/smtp.md](api/smtp.md) |
19
- | 알림톡 / 친구톡 | [api/alimtalk.md](api/alimtalk.md) |
20
- | PG 결제 | [api/pg.md](api/pg.md) |
21
- | 파일 스토리지 | [api/file.md](api/file.md) |
22
- | 본인인증 | [api/identity.md](api/identity.md) |
23
- | QR코드 / 바코드 | [api/utils.md](api/utils.md) |
24
- | React Hook | [api/react.md](api/react.md) |
25
- | 범용 HTTP 요청 | [api/request.md](api/request.md) |
26
- | 암호화 패킷 처리 | [api/packet.md](api/packet.md) |
package/docs/react.md DELETED
@@ -1,137 +0,0 @@
1
- # React 전용 가이드
2
-
3
- ## import
4
-
5
- ```ts
6
- import { useEntityServer } from "entity-server-client/react";
7
- ```
8
-
9
- ## 기본 사용
10
-
11
- ```ts
12
- import { useEntityServer } from "entity-server-client/react";
13
-
14
- export function AccountPage() {
15
- const { client } = useEntityServer({
16
- tokenResolver: () => localStorage.getItem("auth_access_token"),
17
- });
18
-
19
- // 예: 버튼 클릭 시 목록 조회
20
- const onClick = async () => {
21
- const res = await client.list("account", { page: 1, limit: 20 });
22
- console.log(res.data);
23
- };
24
-
25
- return <button onClick={onClick}>불러오기</button>;
26
- }
27
- ```
28
-
29
- ## `client`로 사용 가능한 모든 API
30
-
31
- `client`는 `EntityServerClient` 인스턴스 그대로이므로 엔티티 CRUD 외에도 **모든 API**를 호출할 수 있습니다.
32
- `submit` / `del` / `query` 래퍼는 `isPending` / `error` 상태를 자동 관리해주는 편의 메서드일 뿐입니다.
33
-
34
- ```tsx
35
- const { client, submit, del } = useEntityServer({
36
- tokenResolver: () => localStorage.getItem("auth_access_token"),
37
- });
38
-
39
- // 인증
40
- await client.login("hong@example.com", "pw");
41
- await client.logout();
42
-
43
- // 트랜잭션
44
- await client.transStart();
45
- await client.submit("order", { product_seq: 1, qty: 2 });
46
- await client.transCommit();
47
-
48
- // 파일 업로드
49
- const res = await client.fileUpload("product", file, { refSeq: 10 });
50
-
51
- // SMS 인증
52
- await client.smsVerificationSend("01012345678");
53
- await client.smsVerificationVerify("01012345678", "123456");
54
-
55
- // 알림톡 발송
56
- await client.alimtalkSend({
57
- to: "01012345678",
58
- templateCode: "ORDER_CONFIRM",
59
- variables: {},
60
- });
61
-
62
- // PG 결제
63
- const order = await client.pgCreateOrder({
64
- orderId: "ord-001",
65
- amount: 15000,
66
- orderName: "상품 A",
67
- customerName: "홍길동",
68
- customerEmail: "hong@example.com",
69
- });
70
- await client.pgConfirmPayment({
71
- paymentKey: "key",
72
- orderId: "ord-001",
73
- amount: 15000,
74
- });
75
-
76
- // 본인인증
77
- const req = await client.identityRequest({
78
- redirect_url: "https://example.com/callback",
79
- });
80
-
81
- // QR코드
82
- const buf = await client.qrcode("https://example.com", { size: 300 });
83
- ```
84
-
85
- 카테고리별 상세 파라미터는 [api/](api/) 폴더의 각 문서를 참고하세요.
86
-
87
- ## 옵션
88
-
89
- ### `singleton` (기본: `true`)
90
-
91
- - `true`: 패키지 전역 인스턴스(`entityServer`)를 사용
92
- - `false`: 훅 호출 스코프마다 새 인스턴스 생성
93
-
94
- ```ts
95
- const { client } = useEntityServer({
96
- singleton: false,
97
- baseUrl: "http://localhost:47200",
98
- });
99
- ```
100
-
101
- ### `tokenResolver`
102
-
103
- 렌더 시점에 토큰을 읽어 자동으로 `setToken`을 적용합니다.
104
-
105
- ```ts
106
- const { client } = useEntityServer({
107
- tokenResolver: () => sessionStorage.getItem("access_token"),
108
- });
109
- ```
110
-
111
- ### `baseUrl`, `token`
112
-
113
- `EntityServerClientOptions`와 동일하게 전달할 수 있습니다.
114
-
115
- ```ts
116
- const { client } = useEntityServer({
117
- baseUrl: import.meta.env.VITE_ENTITY_SERVER_URL,
118
- });
119
- ```
120
-
121
- ## React Query와 함께 사용 예시
122
-
123
- ```ts
124
- import { useQuery } from "@tanstack/react-query";
125
- import { useEntityServer } from "entity-server-client/react";
126
-
127
- export function useAccountList() {
128
- const { client } = useEntityServer({
129
- tokenResolver: () => localStorage.getItem("auth_access_token"),
130
- });
131
-
132
- return useQuery({
133
- queryKey: ["account", "list"],
134
- queryFn: () => client.list("account", { page: 1, limit: 20 }),
135
- });
136
- }
137
- ```
@@ -1,28 +0,0 @@
1
- /**
2
- * @file EntityServerClient.ts
3
- * Mixin 패턴으로 구성된 EntityServerClient.
4
- *
5
- * 절(section)별 구현:
6
- * src/client/base.ts — 상태·생성자·공통 헬퍼
7
- * src/mixins/auth.ts — 인증 (로그인/로그아웃/me/트랜잭션 등)
8
- * src/mixins/entity.ts — 트랜잭션 & 엔티티 CRUD
9
- * src/mixins/push.ts — 푸시 디바이스 관리
10
- * src/mixins/smtp.ts — SMTP 메일 발송
11
- * src/mixins/file.ts — 파일 스토리지
12
- * src/mixins/utils.ts — QR코드/바코드/PDF변환
13
- */
14
- import { EntityServerClientBase } from "./client/base";
15
- import { AuthMixin } from "./mixins/auth";
16
- import { EntityMixin } from "./mixins/entity";
17
- import { PushMixin } from "./mixins/push";
18
- import { SmtpMixin } from "./mixins/smtp";
19
- import { FileMixin } from "./mixins/file";
20
- import { UtilsMixin } from "./mixins/utils";
21
-
22
- // ─── Composed class ───────────────────────────────────────────────────────────
23
-
24
- export class EntityServerClient extends UtilsMixin(
25
- FileMixin(
26
- SmtpMixin(PushMixin(EntityMixin(AuthMixin(EntityServerClientBase)))),
27
- ),
28
- ) {}