entity-server-client 0.2.6 → 0.3.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 (64) hide show
  1. package/README.md +32 -0
  2. package/build.mjs +7 -0
  3. package/docs/api/alimtalk.md +62 -0
  4. package/docs/api/auth.md +256 -0
  5. package/docs/api/email.md +37 -0
  6. package/docs/api/entity.md +273 -0
  7. package/docs/api/file.md +80 -0
  8. package/docs/api/health.md +47 -0
  9. package/docs/api/identity.md +32 -0
  10. package/docs/api/import.md +45 -0
  11. package/docs/api/packet.md +90 -0
  12. package/docs/api/pg.md +90 -0
  13. package/docs/api/push.md +107 -0
  14. package/docs/api/react.md +141 -0
  15. package/docs/api/request.md +118 -0
  16. package/docs/api/setup.md +43 -0
  17. package/docs/api/sms.md +45 -0
  18. package/docs/api/smtp.md +33 -0
  19. package/docs/api/transaction.md +50 -0
  20. package/docs/api/utils.md +52 -0
  21. package/docs/apis.md +22 -779
  22. package/docs/react.md +58 -0
  23. package/package.json +6 -1
  24. package/src/EntityServerClient.ts +5 -31
  25. package/src/client/base.ts +114 -12
  26. package/src/client/packet.ts +8 -31
  27. package/src/client/request.ts +52 -6
  28. package/src/client/utils.ts +5 -6
  29. package/src/mixins/auth.ts +14 -158
  30. package/src/mixins/push.ts +0 -23
  31. package/src/mixins/utils.ts +32 -1
  32. package/src/packet.ts +84 -0
  33. package/src/types.ts +15 -125
  34. package/tests/packet.test.mjs +50 -0
  35. package/dist/EntityServerClient.d.ts +0 -709
  36. package/dist/client/base.d.ts +0 -59
  37. package/dist/client/hmac.d.ts +0 -8
  38. package/dist/client/packet.d.ts +0 -24
  39. package/dist/client/request.d.ts +0 -15
  40. package/dist/client/utils.d.ts +0 -8
  41. package/dist/hooks/useEntityServer.d.ts +0 -63
  42. package/dist/index.d.ts +0 -4
  43. package/dist/index.js +0 -2
  44. package/dist/index.js.map +0 -7
  45. package/dist/mixins/alimtalk.d.ts +0 -56
  46. package/dist/mixins/auth.d.ts +0 -167
  47. package/dist/mixins/email.d.ts +0 -51
  48. package/dist/mixins/entity.d.ts +0 -119
  49. package/dist/mixins/file.d.ts +0 -78
  50. package/dist/mixins/identity.d.ts +0 -52
  51. package/dist/mixins/pg.d.ts +0 -63
  52. package/dist/mixins/push.d.ts +0 -110
  53. package/dist/mixins/sms.d.ts +0 -55
  54. package/dist/mixins/smtp.d.ts +0 -44
  55. package/dist/mixins/utils.d.ts +0 -70
  56. package/dist/react.d.ts +0 -1
  57. package/dist/react.js +0 -2
  58. package/dist/react.js.map +0 -7
  59. package/dist/types.d.ts +0 -329
  60. package/src/mixins/alimtalk.ts +0 -35
  61. package/src/mixins/email.ts +0 -46
  62. package/src/mixins/identity.ts +0 -35
  63. package/src/mixins/pg.ts +0 -58
  64. package/src/mixins/sms.ts +0 -46
@@ -1,167 +0,0 @@
1
- import type { GConstructor, EntityServerClientBase } from "../client/base";
2
- export declare function AuthMixin<TBase extends GConstructor<EntityServerClientBase>>(Base: TBase): {
3
- new (...args: any[]): {
4
- /**
5
- * 서버 헬스 체크를 수행하고 패킷 암호화 활성 여부를 자동으로 감지합니다.
6
- *
7
- * 서버가 `packet_encryption: true`를 응답하면 이후 모든 요청에 암호화가 자동 적용됩니다.
8
- *
9
- * ```ts
10
- * await client.checkHealth();
11
- * await client.login(email, password);
12
- * ```
13
- */
14
- checkHealth(): Promise<{
15
- ok: boolean;
16
- packet_encryption?: boolean;
17
- }>;
18
- /** 로그인 후 `access_token`을 내부 상태에 저장합니다. */
19
- login(email: string, password: string): Promise<{
20
- access_token: string;
21
- refresh_token: string;
22
- expires_in: number;
23
- }>;
24
- /** Refresh Token으로 Access Token을 재발급받아 내부 토큰을 교체합니다. */
25
- refreshToken(refreshToken: string): Promise<{
26
- access_token: string;
27
- expires_in: number;
28
- }>;
29
- /**
30
- * 서버에 로그아웃을 요청하고 내부 토큰을 초기화합니다.
31
- * refresh_token을 서버에 전달해 무효화합니다.
32
- */
33
- logout(refreshToken: string): Promise<{
34
- ok: boolean;
35
- }>;
36
- /** 현재 로그인된 사용자 정보를 반환합니다. */
37
- me<T = Record<string, unknown>>(): Promise<{
38
- ok: boolean;
39
- data: T;
40
- }>;
41
- /** 비밀번호를 변경합니다. */
42
- changePassword(currentPasswd: string, newPasswd: string): Promise<{
43
- ok: boolean;
44
- }>;
45
- /** 회원 탈퇴를 요청합니다. */
46
- withdraw(passwd?: string): Promise<{
47
- ok: boolean;
48
- }>;
49
- /**
50
- * 휴면 계정을 재활성화합니다.
51
- * 비밀번호 또는 OAuth(provider + code)로 본인 확인합니다.
52
- */
53
- reactivate(params: {
54
- email: string;
55
- passwd?: string;
56
- provider?: string;
57
- code?: string;
58
- }): Promise<{
59
- access_token: string;
60
- refresh_token: string;
61
- expires_in: number;
62
- }>;
63
- /** 비밀번호 재설정 메일을 요청합니다. */
64
- passwordResetRequest(email: string): Promise<{
65
- ok: boolean;
66
- }>;
67
- /** 이메일로 전달된 토큰으로 비밀번호를 재설정합니다. */
68
- passwordResetConfirm(token: string, newPasswd: string): Promise<{
69
- ok: boolean;
70
- }>;
71
- /** OAuth 프로바이더를 현재 계정에 연동합니다. */
72
- oauthLink(provider: string, code: string, state?: string): Promise<{
73
- ok: boolean;
74
- message: string;
75
- provider: string;
76
- }>;
77
- /** OAuth 프로바이더 연동을 해제합니다. */
78
- oauthUnlink(provider: string): Promise<{
79
- ok: boolean;
80
- message: string;
81
- provider: string;
82
- }>;
83
- /** 현재 계정에 연동된 OAuth 프로바이더 목록을 반환합니다. */
84
- oauthProviders(): Promise<{
85
- ok: boolean;
86
- data: Array<{
87
- provider: string;
88
- email?: string;
89
- linked_at?: string;
90
- }>;
91
- }>;
92
- /** 특정 OAuth 프로바이더의 액세스 토큰을 갱신합니다. */
93
- oauthTokenRefresh(provider: string): Promise<{
94
- ok: boolean;
95
- access_token: string;
96
- expires_at?: string;
97
- }>;
98
- /** 2FA 설정을 시작하고 QR 코드 / 시크릿을 반환합니다. */
99
- twoFactorSetup(): Promise<{
100
- ok: boolean;
101
- setup_token: string;
102
- qr_url: string;
103
- secret: string;
104
- }>;
105
- /** TOTP 코드로 2FA 설정을 완료합니다. */
106
- twoFactorSetupVerify(code: string, setupToken: string): Promise<{
107
- ok: boolean;
108
- recovery_codes: string[];
109
- }>;
110
- /** 2FA를 비활성화합니다. */
111
- twoFactorDisable(code: string): Promise<{
112
- ok: boolean;
113
- }>;
114
- /** 2FA 활성화 여부를 조회합니다. */
115
- twoFactorStatus(): Promise<{
116
- ok: boolean;
117
- enabled: boolean;
118
- }>;
119
- /** 임시 토큰으로 TOTP 코드를 검증하여 최종 JWT를 발급받습니다. */
120
- twoFactorVerify(twoFactorToken: string, code: string): Promise<{
121
- ok: boolean;
122
- access_token: string;
123
- refresh_token: string;
124
- expires_in: number;
125
- }>;
126
- /** 복구 코드로 2FA를 우회하여 최종 JWT를 발급받습니다. */
127
- twoFactorRecovery(twoFactorToken: string, recoveryCode: string): Promise<{
128
- ok: boolean;
129
- access_token: string;
130
- refresh_token: string;
131
- expires_in: number;
132
- }>;
133
- /** 복구 코드를 재생성합니다. */
134
- twoFactorRegenerateRecovery(code: string): Promise<{
135
- ok: boolean;
136
- recovery_codes: string[];
137
- }>;
138
- baseUrl: string;
139
- token: string;
140
- apiKey: string;
141
- hmacSecret: string;
142
- encryptRequests: boolean;
143
- activeTxId: string | null;
144
- keepSession: boolean;
145
- refreshBuffer: number;
146
- onTokenRefreshed?: (accessToken: string, expiresIn: number) => void;
147
- onSessionExpired?: (error: Error) => void;
148
- _sessionRefreshToken: string | null;
149
- _refreshTimer: ReturnType<typeof setTimeout> | null;
150
- configure(options: Partial<import("..").EntityServerClientOptions>): void;
151
- setToken(token: string): void;
152
- setApiKey(apiKey: string): void;
153
- setHmacSecret(secret: string): void;
154
- setEncryptRequests(value: boolean): void;
155
- _scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
156
- access_token: string;
157
- expires_in: number;
158
- }>): void;
159
- _clearRefreshTimer(): void;
160
- stopKeepSession(): void;
161
- readRequestBody<T = Record<string, unknown>>(body: ArrayBuffer | Uint8Array | string | T | null | undefined, contentType?: string, requireEncrypted?: boolean): T;
162
- get _reqOpts(): import("../client/request").RequestOptions;
163
- _request<T>(method: string, path: string, body?: unknown, withAuth?: boolean, extraHeaders?: Record<string, string>): Promise<T>;
164
- _requestBinary(method: string, path: string, body?: unknown, withAuth?: boolean): Promise<ArrayBuffer>;
165
- _requestForm<T>(method: string, path: string, form: FormData, withAuth?: boolean): Promise<T>;
166
- };
167
- } & TBase;
@@ -1,51 +0,0 @@
1
- import type { GConstructor, EntityServerClientBase } from "../client/base";
2
- export declare function EmailMixin<TBase extends GConstructor<EntityServerClientBase>>(Base: TBase): {
3
- new (...args: any[]): {
4
- /** 이메일 인증 코드 또는 링크를 발송합니다. */
5
- emailVerificationSend(email: string): Promise<{
6
- ok: boolean;
7
- }>;
8
- /** 이메일 인증 코드를 확인합니다. */
9
- emailVerificationConfirm(token: string): Promise<{
10
- ok: boolean;
11
- }>;
12
- /** 현재 계정의 이메일 인증 상태를 조회합니다. (JWT 필요) */
13
- emailVerificationStatus(): Promise<{
14
- ok: boolean;
15
- verified: boolean;
16
- email?: string;
17
- }>;
18
- /** 이메일 주소를 변경합니다. (JWT + 인증 코드 필요) */
19
- emailChange(newEmail: string, code?: string): Promise<{
20
- ok: boolean;
21
- }>;
22
- baseUrl: string;
23
- token: string;
24
- apiKey: string;
25
- hmacSecret: string;
26
- encryptRequests: boolean;
27
- activeTxId: string | null;
28
- keepSession: boolean;
29
- refreshBuffer: number;
30
- onTokenRefreshed?: (accessToken: string, expiresIn: number) => void;
31
- onSessionExpired?: (error: Error) => void;
32
- _sessionRefreshToken: string | null;
33
- _refreshTimer: ReturnType<typeof setTimeout> | null;
34
- configure(options: Partial<import("..").EntityServerClientOptions>): void;
35
- setToken(token: string): void;
36
- setApiKey(apiKey: string): void;
37
- setHmacSecret(secret: string): void;
38
- setEncryptRequests(value: boolean): void;
39
- _scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
40
- access_token: string;
41
- expires_in: number;
42
- }>): void;
43
- _clearRefreshTimer(): void;
44
- stopKeepSession(): void;
45
- readRequestBody<T = Record<string, unknown>>(body: ArrayBuffer | Uint8Array | string | T | null | undefined, contentType?: string, requireEncrypted?: boolean): T;
46
- get _reqOpts(): import("../client/request").RequestOptions;
47
- _request<T>(method: string, path: string, body?: unknown, withAuth?: boolean, extraHeaders?: Record<string, string>): Promise<T>;
48
- _requestBinary(method: string, path: string, body?: unknown, withAuth?: boolean): Promise<ArrayBuffer>;
49
- _requestForm<T>(method: string, path: string, form: FormData, withAuth?: boolean): Promise<T>;
50
- };
51
- } & TBase;
@@ -1,119 +0,0 @@
1
- import type { EntityHistoryRecord, EntityListParams, EntityListResult, EntityQueryRequest } from "../types";
2
- import type { GConstructor, EntityServerClientBase } from "../client/base";
3
- export declare function EntityMixin<TBase extends GConstructor<EntityServerClientBase>>(Base: TBase): {
4
- new (...args: any[]): {
5
- /** 트랜잭션을 시작하고 활성 트랜잭션 ID를 저장합니다. */
6
- transStart(): Promise<string>;
7
- /** 활성 트랜잭션(또는 전달된 transactionId)을 롤백합니다. */
8
- transRollback(transactionId?: string): Promise<{
9
- ok: boolean;
10
- }>;
11
- /**
12
- * 활성 트랜잭션(또는 전달된 transactionId)을 커밋합니다.
13
- *
14
- * @returns `results` 배열: commit된 각 작업의 `entity`, `action`, `seq`
15
- */
16
- transCommit(transactionId?: string): Promise<{
17
- ok: boolean;
18
- results: Array<{
19
- entity: string;
20
- action: string;
21
- seq: number;
22
- }>;
23
- }>;
24
- /** 시퀀스 ID로 엔티티 단건을 조회합니다. */
25
- get<T = unknown>(entity: string, seq: number, opts?: {
26
- skipHooks?: boolean;
27
- }): Promise<{
28
- ok: boolean;
29
- data: T;
30
- }>;
31
- /** 조건으로 엔티티 단건을 조회합니다. data 컬럼을 완전히 복호화하여 반환합니다. */
32
- find<T = unknown>(entity: string, conditions?: Record<string, unknown>, opts?: {
33
- skipHooks?: boolean;
34
- }): Promise<{
35
- ok: boolean;
36
- data: T;
37
- }>;
38
- /** 페이지네이션/정렬/필터 조건으로 엔티티 목록을 조회합니다. */
39
- list<T = unknown>(entity: string, params?: EntityListParams): Promise<{
40
- ok: boolean;
41
- data: EntityListResult<T>;
42
- }>;
43
- /**
44
- * 엔티티 총 건수를 조회합니다.
45
- *
46
- * @param conditions 필터 조건 (예: `{ status: "active" }`)
47
- */
48
- count(entity: string, conditions?: Record<string, unknown>): Promise<{
49
- ok: boolean;
50
- count: number;
51
- }>;
52
- /**
53
- * 커스텀 SQL로 엔티티를 조회합니다.
54
- *
55
- * SELECT 전용이며 인덱스 테이블만 조회 가능합니다. JOIN 지원.
56
- */
57
- query<T = unknown>(entity: string, req: EntityQueryRequest): Promise<{
58
- ok: boolean;
59
- data: {
60
- items: T[];
61
- count: number;
62
- };
63
- }>;
64
- /** 엔티티 데이터를 생성/수정(Submit)합니다. `seq`가 없으면 INSERT, 있으면 UPDATE입니다. */
65
- submit(entity: string, data: Record<string, unknown>, opts?: {
66
- transactionId?: string;
67
- skipHooks?: boolean;
68
- }): Promise<{
69
- ok: boolean;
70
- seq: number;
71
- }>;
72
- /** 시퀀스 ID로 엔티티를 삭제합니다(`hard=true`면 하드 삭제, 기본은 소프트 삭제). */
73
- delete(entity: string, seq: number, opts?: {
74
- transactionId?: string;
75
- hard?: boolean;
76
- skipHooks?: boolean;
77
- }): Promise<{
78
- ok: boolean;
79
- deleted: number;
80
- }>;
81
- /** 엔티티 단건의 변경 이력을 조회합니다. */
82
- history<T = unknown>(entity: string, seq: number, params?: Pick<EntityListParams, "page" | "limit">): Promise<{
83
- ok: boolean;
84
- data: EntityListResult<EntityHistoryRecord<T>>;
85
- }>;
86
- /** 특정 이력 시점으로 엔티티를 롤백합니다. */
87
- rollback(entity: string, historySeq: number): Promise<{
88
- ok: boolean;
89
- }>;
90
- baseUrl: string;
91
- token: string;
92
- apiKey: string;
93
- hmacSecret: string;
94
- encryptRequests: boolean;
95
- activeTxId: string | null;
96
- keepSession: boolean;
97
- refreshBuffer: number;
98
- onTokenRefreshed?: (accessToken: string, expiresIn: number) => void;
99
- onSessionExpired?: (error: Error) => void;
100
- _sessionRefreshToken: string | null;
101
- _refreshTimer: ReturnType<typeof setTimeout> | null;
102
- configure(options: Partial<import("..").EntityServerClientOptions>): void;
103
- setToken(token: string): void;
104
- setApiKey(apiKey: string): void;
105
- setHmacSecret(secret: string): void;
106
- setEncryptRequests(value: boolean): void;
107
- _scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
108
- access_token: string;
109
- expires_in: number;
110
- }>): void;
111
- _clearRefreshTimer(): void;
112
- stopKeepSession(): void;
113
- readRequestBody<T = Record<string, unknown>>(body: ArrayBuffer | Uint8Array | string | T | null | undefined, contentType?: string, requireEncrypted?: boolean): T;
114
- get _reqOpts(): import("../client/request").RequestOptions;
115
- _request<T>(method: string, path: string, body?: unknown, withAuth?: boolean, extraHeaders?: Record<string, string>): Promise<T>;
116
- _requestBinary(method: string, path: string, body?: unknown, withAuth?: boolean): Promise<ArrayBuffer>;
117
- _requestForm<T>(method: string, path: string, form: FormData, withAuth?: boolean): Promise<T>;
118
- };
119
- } & TBase;
@@ -1,78 +0,0 @@
1
- import type { FileMeta, FileUploadOptions } from "../types";
2
- import type { GConstructor, EntityServerClientBase } from "../client/base";
3
- export declare function FileMixin<TBase extends GConstructor<EntityServerClientBase>>(Base: TBase): {
4
- new (...args: any[]): {
5
- /**
6
- * 파일을 업로드합니다. (multipart/form-data)
7
- *
8
- * ```ts
9
- * const input = document.querySelector('input[type="file"]');
10
- * const result = await client.fileUpload("product", input.files[0]);
11
- * console.log(result.data.uuid);
12
- * ```
13
- */
14
- fileUpload(entity: string, file: File | Blob, opts?: FileUploadOptions): Promise<{
15
- ok: boolean;
16
- uuid: string;
17
- data: FileMeta;
18
- }>;
19
- /** 파일을 다운로드합니다. `ArrayBuffer`를 반환합니다. */
20
- fileDownload(entity: string, uuid: string): Promise<ArrayBuffer>;
21
- /** 파일을 삭제합니다. */
22
- fileDelete(entity: string, uuid: string): Promise<{
23
- ok: boolean;
24
- uuid: string;
25
- deleted: boolean;
26
- }>;
27
- /** 엔티티에 연결된 파일 목록을 조회합니다. */
28
- fileList(entity: string, opts?: {
29
- refSeq?: number;
30
- }): Promise<{
31
- ok: boolean;
32
- data: {
33
- items: FileMeta[];
34
- total: number;
35
- };
36
- }>;
37
- /** 파일 메타 정보를 조회합니다. */
38
- fileMeta(entity: string, uuid: string): Promise<{
39
- ok: boolean;
40
- data: FileMeta;
41
- }>;
42
- /** 임시 파일 접근 토큰을 발급합니다. */
43
- fileToken(uuid: string): Promise<{
44
- ok: boolean;
45
- token: string;
46
- }>;
47
- /** 파일 인라인 뷰 URL을 반환합니다. (fetch 없음, URL 조합만) */
48
- fileUrl(uuid: string): string;
49
- baseUrl: string;
50
- token: string;
51
- apiKey: string;
52
- hmacSecret: string;
53
- encryptRequests: boolean;
54
- activeTxId: string | null;
55
- keepSession: boolean;
56
- refreshBuffer: number;
57
- onTokenRefreshed?: (accessToken: string, expiresIn: number) => void;
58
- onSessionExpired?: (error: Error) => void;
59
- _sessionRefreshToken: string | null;
60
- _refreshTimer: ReturnType<typeof setTimeout> | null;
61
- configure(options: Partial<import("..").EntityServerClientOptions>): void;
62
- setToken(token: string): void;
63
- setApiKey(apiKey: string): void;
64
- setHmacSecret(secret: string): void;
65
- setEncryptRequests(value: boolean): void;
66
- _scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
67
- access_token: string;
68
- expires_in: number;
69
- }>): void;
70
- _clearRefreshTimer(): void;
71
- stopKeepSession(): void;
72
- readRequestBody<T = Record<string, unknown>>(body: ArrayBuffer | Uint8Array | string | T | null | undefined, contentType?: string, requireEncrypted?: boolean): T;
73
- get _reqOpts(): import("../client/request").RequestOptions;
74
- _request<T>(method: string, path: string, body?: unknown, withAuth?: boolean, extraHeaders?: Record<string, string>): Promise<T>;
75
- _requestBinary(method: string, path: string, body?: unknown, withAuth?: boolean): Promise<ArrayBuffer>;
76
- _requestForm<T>(method: string, path: string, form: FormData, withAuth?: boolean): Promise<T>;
77
- };
78
- } & TBase;
@@ -1,52 +0,0 @@
1
- import type { IdentityRequestOptions } from "../types";
2
- import type { GConstructor, EntityServerClientBase } from "../client/base";
3
- export declare function IdentityMixin<TBase extends GConstructor<EntityServerClientBase>>(Base: TBase): {
4
- new (...args: any[]): {
5
- /** 본인인증 요청을 생성합니다. */
6
- identityRequest(opts: IdentityRequestOptions): Promise<{
7
- ok: boolean;
8
- data: Record<string, unknown>;
9
- }>;
10
- /** 본인인증 결과를 조회합니다. */
11
- identityResult(requestId: string): Promise<{
12
- ok: boolean;
13
- data: Record<string, unknown>;
14
- }>;
15
- /** CI 해시 중복 여부를 확인합니다. */
16
- identityVerifyCI(ciHash: string): Promise<{
17
- ok: boolean;
18
- data: {
19
- exists: boolean;
20
- account_seq?: number;
21
- };
22
- }>;
23
- baseUrl: string;
24
- token: string;
25
- apiKey: string;
26
- hmacSecret: string;
27
- encryptRequests: boolean;
28
- activeTxId: string | null;
29
- keepSession: boolean;
30
- refreshBuffer: number;
31
- onTokenRefreshed?: (accessToken: string, expiresIn: number) => void;
32
- onSessionExpired?: (error: Error) => void;
33
- _sessionRefreshToken: string | null;
34
- _refreshTimer: ReturnType<typeof setTimeout> | null;
35
- configure(options: Partial<import("..").EntityServerClientOptions>): void;
36
- setToken(token: string): void;
37
- setApiKey(apiKey: string): void;
38
- setHmacSecret(secret: string): void;
39
- setEncryptRequests(value: boolean): void;
40
- _scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
41
- access_token: string;
42
- expires_in: number;
43
- }>): void;
44
- _clearRefreshTimer(): void;
45
- stopKeepSession(): void;
46
- readRequestBody<T = Record<string, unknown>>(body: ArrayBuffer | Uint8Array | string | T | null | undefined, contentType?: string, requireEncrypted?: boolean): T;
47
- get _reqOpts(): import("../client/request").RequestOptions;
48
- _request<T>(method: string, path: string, body?: unknown, withAuth?: boolean, extraHeaders?: Record<string, string>): Promise<T>;
49
- _requestBinary(method: string, path: string, body?: unknown, withAuth?: boolean): Promise<ArrayBuffer>;
50
- _requestForm<T>(method: string, path: string, form: FormData, withAuth?: boolean): Promise<T>;
51
- };
52
- } & TBase;
@@ -1,63 +0,0 @@
1
- import type { PgCreateOrderRequest, PgConfirmPaymentRequest, PgCancelPaymentRequest } from "../types";
2
- import type { GConstructor, EntityServerClientBase } from "../client/base";
3
- export declare function PgMixin<TBase extends GConstructor<EntityServerClientBase>>(Base: TBase): {
4
- new (...args: any[]): {
5
- /** 결제 주문을 생성합니다. */
6
- pgCreateOrder(req: PgCreateOrderRequest): Promise<{
7
- ok: boolean;
8
- data: Record<string, unknown>;
9
- }>;
10
- /** 주문 정보를 조회합니다. */
11
- pgGetOrder(orderId: string): Promise<{
12
- ok: boolean;
13
- data: Record<string, unknown>;
14
- }>;
15
- /** 결제를 승인합니다. */
16
- pgConfirmPayment(req: PgConfirmPaymentRequest): Promise<{
17
- ok: boolean;
18
- data: Record<string, unknown>;
19
- }>;
20
- /** 결제를 취소합니다. */
21
- pgCancelPayment(orderId: string, req: PgCancelPaymentRequest): Promise<{
22
- ok: boolean;
23
- data: Record<string, unknown>;
24
- }>;
25
- /** 결제 상태를 외부 PG와 동기화합니다. */
26
- pgSyncPayment(orderId: string): Promise<{
27
- ok: boolean;
28
- }>;
29
- /** 클라이언트 SDK 설정을 반환합니다 (공개 API, 인증 불필요). */
30
- pgConfig(): Promise<{
31
- ok: boolean;
32
- data: Record<string, unknown>;
33
- }>;
34
- baseUrl: string;
35
- token: string;
36
- apiKey: string;
37
- hmacSecret: string;
38
- encryptRequests: boolean;
39
- activeTxId: string | null;
40
- keepSession: boolean;
41
- refreshBuffer: number;
42
- onTokenRefreshed?: (accessToken: string, expiresIn: number) => void;
43
- onSessionExpired?: (error: Error) => void;
44
- _sessionRefreshToken: string | null;
45
- _refreshTimer: ReturnType<typeof setTimeout> | null;
46
- configure(options: Partial<import("..").EntityServerClientOptions>): void;
47
- setToken(token: string): void;
48
- setApiKey(apiKey: string): void;
49
- setHmacSecret(secret: string): void;
50
- setEncryptRequests(value: boolean): void;
51
- _scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
52
- access_token: string;
53
- expires_in: number;
54
- }>): void;
55
- _clearRefreshTimer(): void;
56
- stopKeepSession(): void;
57
- readRequestBody<T = Record<string, unknown>>(body: ArrayBuffer | Uint8Array | string | T | null | undefined, contentType?: string, requireEncrypted?: boolean): T;
58
- get _reqOpts(): import("../client/request").RequestOptions;
59
- _request<T>(method: string, path: string, body?: unknown, withAuth?: boolean, extraHeaders?: Record<string, string>): Promise<T>;
60
- _requestBinary(method: string, path: string, body?: unknown, withAuth?: boolean): Promise<ArrayBuffer>;
61
- _requestForm<T>(method: string, path: string, form: FormData, withAuth?: boolean): Promise<T>;
62
- };
63
- } & TBase;
@@ -1,110 +0,0 @@
1
- import type { EntityListParams, EntityListResult, RegisterPushDeviceOptions, PushSendRequest, PushSendAllRequest } from "../types";
2
- import type { GConstructor, EntityServerClientBase } from "../client/base";
3
- type WithSubmit = EntityServerClientBase & {
4
- submit(entity: string, data: Record<string, unknown>, opts?: {
5
- transactionId?: string;
6
- skipHooks?: boolean;
7
- }): Promise<{
8
- ok: boolean;
9
- seq: number;
10
- }>;
11
- list<T = unknown>(entity: string, params?: EntityListParams): Promise<{
12
- ok: boolean;
13
- data: EntityListResult<T>;
14
- }>;
15
- };
16
- export declare function PushMixin<TBase extends GConstructor<WithSubmit>>(Base: TBase): {
17
- new (...args: any[]): {
18
- /**
19
- * 푸시 관련 엔티티로 payload를 전송(Submit)합니다.
20
- * 내부적으로 `submit()` 메서드를 호출합니다.
21
- */
22
- push(pushEntity: string, payload: Record<string, unknown>, opts?: {
23
- transactionId?: string;
24
- }): Promise<{
25
- ok: boolean;
26
- seq: number;
27
- }>;
28
- /** 푸시 로그 엔티티 목록을 조회합니다. */
29
- pushLogList<T = unknown>(params?: EntityListParams): Promise<{
30
- ok: boolean;
31
- data: EntityListResult<T>;
32
- }>;
33
- /** 계정의 푸시 디바이스를 등록합니다. */
34
- registerPushDevice(accountSeq: number, deviceId: string, pushToken: string, opts?: RegisterPushDeviceOptions): Promise<{
35
- ok: boolean;
36
- seq: number;
37
- }>;
38
- /** 디바이스 레코드의 푸시 토큰을 갱신합니다. */
39
- updatePushDeviceToken(deviceSeq: number, pushToken: string, opts?: {
40
- pushEnabled?: boolean;
41
- transactionId?: string;
42
- }): Promise<{
43
- ok: boolean;
44
- seq: number;
45
- }>;
46
- /** 디바이스의 푸시 수신을 비활성화합니다. */
47
- disablePushDevice(deviceSeq: number, opts?: {
48
- transactionId?: string;
49
- }): Promise<{
50
- ok: boolean;
51
- seq: number;
52
- }>;
53
- /** 특정 계정에 푸시 알림을 발송합니다. */
54
- pushSend(req: PushSendRequest): Promise<{
55
- ok: boolean;
56
- seq: number;
57
- }>;
58
- /** 전체 사용자에게 푸시 알림을 발송합니다. */
59
- pushSendAll(req: PushSendAllRequest): Promise<{
60
- ok: boolean;
61
- sent: number;
62
- failed: number;
63
- }>;
64
- /** 푸시 발송 상태를 조회합니다. */
65
- pushStatus(seq: number): Promise<{
66
- ok: boolean;
67
- status: string;
68
- }>;
69
- baseUrl: string;
70
- token: string;
71
- apiKey: string;
72
- hmacSecret: string;
73
- encryptRequests: boolean;
74
- activeTxId: string | null;
75
- keepSession: boolean;
76
- refreshBuffer: number;
77
- onTokenRefreshed?: (accessToken: string, expiresIn: number) => void;
78
- onSessionExpired?: (error: Error) => void;
79
- _sessionRefreshToken: string | null;
80
- _refreshTimer: ReturnType<typeof setTimeout> | null;
81
- configure(options: Partial<import("..").EntityServerClientOptions>): void;
82
- setToken(token: string): void;
83
- setApiKey(apiKey: string): void;
84
- setHmacSecret(secret: string): void;
85
- setEncryptRequests(value: boolean): void;
86
- _scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
87
- access_token: string;
88
- expires_in: number;
89
- }>): void;
90
- _clearRefreshTimer(): void;
91
- stopKeepSession(): void;
92
- readRequestBody<T = Record<string, unknown>>(body: ArrayBuffer | Uint8Array | string | T | null | undefined, contentType?: string, requireEncrypted?: boolean): T;
93
- get _reqOpts(): import("../client/request").RequestOptions;
94
- _request<T>(method: string, path: string, body?: unknown, withAuth?: boolean, extraHeaders?: Record<string, string>): Promise<T>;
95
- _requestBinary(method: string, path: string, body?: unknown, withAuth?: boolean): Promise<ArrayBuffer>;
96
- _requestForm<T>(method: string, path: string, form: FormData, withAuth?: boolean): Promise<T>;
97
- submit(entity: string, data: Record<string, unknown>, opts?: {
98
- transactionId?: string;
99
- skipHooks?: boolean;
100
- }): Promise<{
101
- ok: boolean;
102
- seq: number;
103
- }>;
104
- list<T = unknown>(entity: string, params?: EntityListParams): Promise<{
105
- ok: boolean;
106
- data: EntityListResult<T>;
107
- }>;
108
- };
109
- } & TBase;
110
- export {};