entity-server-client 0.2.4 → 0.2.6

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 (48) hide show
  1. package/README.md +0 -1
  2. package/build.mjs +4 -1
  3. package/dist/EntityServerClient.d.ts +709 -0
  4. package/dist/client/base.d.ts +59 -0
  5. package/dist/client/hmac.d.ts +8 -0
  6. package/dist/client/packet.d.ts +24 -0
  7. package/dist/client/request.d.ts +15 -0
  8. package/dist/client/utils.d.ts +8 -0
  9. package/dist/index.d.ts +3 -393
  10. package/dist/index.js +1 -1
  11. package/dist/index.js.map +4 -4
  12. package/dist/mixins/alimtalk.d.ts +56 -0
  13. package/dist/mixins/auth.d.ts +167 -0
  14. package/dist/mixins/email.d.ts +51 -0
  15. package/dist/mixins/entity.d.ts +119 -0
  16. package/dist/mixins/file.d.ts +78 -0
  17. package/dist/mixins/identity.d.ts +52 -0
  18. package/dist/mixins/pg.d.ts +63 -0
  19. package/dist/mixins/push.d.ts +110 -0
  20. package/dist/mixins/sms.d.ts +55 -0
  21. package/dist/mixins/smtp.d.ts +44 -0
  22. package/dist/mixins/utils.d.ts +70 -0
  23. package/dist/react.js +1 -1
  24. package/dist/react.js.map +4 -4
  25. package/dist/types.d.ts +329 -0
  26. package/docs/apis.md +5 -12
  27. package/docs/react.md +6 -7
  28. package/package.json +2 -1
  29. package/src/EntityServerClient.ts +54 -0
  30. package/src/client/base.ts +246 -0
  31. package/src/client/hmac.ts +41 -0
  32. package/src/client/packet.ts +100 -0
  33. package/src/client/request.ts +93 -0
  34. package/src/client/utils.ts +34 -0
  35. package/src/hooks/useEntityServer.ts +3 -4
  36. package/src/index.ts +3 -917
  37. package/src/mixins/alimtalk.ts +35 -0
  38. package/src/mixins/auth.ts +287 -0
  39. package/src/mixins/email.ts +46 -0
  40. package/src/mixins/entity.ts +205 -0
  41. package/src/mixins/file.ts +99 -0
  42. package/src/mixins/identity.ts +35 -0
  43. package/src/mixins/pg.ts +58 -0
  44. package/src/mixins/push.ts +132 -0
  45. package/src/mixins/sms.ts +46 -0
  46. package/src/mixins/smtp.ts +20 -0
  47. package/src/mixins/utils.ts +75 -0
  48. package/src/types.ts +388 -0
@@ -0,0 +1,709 @@
1
+ /**
2
+ * @file EntityServerClient.ts
3
+ * Mixin 패턴으로 구성된 EntityServerClient.
4
+ *
5
+ * 절(section)별 구현:
6
+ * src/client/base.ts — 상태·생성자·공통 헬퍼
7
+ * src/mixins/auth.ts — 인증 (로그인/로그아웃/2FA/OAuth 등)
8
+ * src/mixins/entity.ts — 트랜잭션 & 엔티티 CRUD
9
+ * src/mixins/push.ts — 푸시 디바이스 관리 & 발송
10
+ * src/mixins/email.ts — 이메일 인증/변경
11
+ * src/mixins/sms.ts — SMS 발송/인증
12
+ * src/mixins/smtp.ts — SMTP 메일 발송
13
+ * src/mixins/alimtalk.ts — 알림톡/친구톡
14
+ * src/mixins/pg.ts — PG 결제 게이트웨이
15
+ * src/mixins/file.ts — 파일 스토리지
16
+ * src/mixins/identity.ts — 본인인증
17
+ * src/mixins/utils.ts — QR코드/바코드
18
+ */
19
+ import { EntityServerClientBase } from "./client/base";
20
+ declare const EntityServerClient_base: {
21
+ new (...args: any[]): {
22
+ qrcode(content: string, opts?: import("./types").QRCodeOptions): Promise<ArrayBuffer>;
23
+ qrcodeBase64(content: string, opts?: import("./types").QRCodeOptions): Promise<{
24
+ ok: boolean;
25
+ data: string;
26
+ data_uri: string;
27
+ }>;
28
+ qrcodeText(content: string, opts?: import("./types").QRCodeOptions): Promise<{
29
+ ok: boolean;
30
+ text: string;
31
+ }>;
32
+ barcode(content: string, opts?: import("./types").BarcodeOptions): Promise<ArrayBuffer>;
33
+ baseUrl: string;
34
+ token: string;
35
+ apiKey: string;
36
+ hmacSecret: string;
37
+ encryptRequests: boolean;
38
+ activeTxId: string | null;
39
+ keepSession: boolean;
40
+ refreshBuffer: number;
41
+ onTokenRefreshed?: (accessToken: string, expiresIn: number) => void;
42
+ onSessionExpired?: (error: Error) => void;
43
+ _sessionRefreshToken: string | null;
44
+ _refreshTimer: ReturnType<typeof setTimeout> | null;
45
+ configure(options: Partial<import("./types").EntityServerClientOptions>): void;
46
+ setToken(token: string): void;
47
+ setApiKey(apiKey: string): void;
48
+ setHmacSecret(secret: string): void;
49
+ setEncryptRequests(value: boolean): void;
50
+ _scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
51
+ access_token: string;
52
+ expires_in: number;
53
+ }>): void;
54
+ _clearRefreshTimer(): void;
55
+ stopKeepSession(): void;
56
+ readRequestBody<T = Record<string, unknown>>(body: ArrayBuffer | Uint8Array | string | T | null | undefined, contentType?: string, requireEncrypted?: boolean): T;
57
+ get _reqOpts(): import("./client/request").RequestOptions;
58
+ _request<T>(method: string, path: string, body?: unknown, withAuth?: boolean, extraHeaders?: Record<string, string>): Promise<T>;
59
+ _requestBinary(method: string, path: string, body?: unknown, withAuth?: boolean): Promise<ArrayBuffer>;
60
+ _requestForm<T>(method: string, path: string, form: FormData, withAuth?: boolean): Promise<T>;
61
+ };
62
+ } & {
63
+ new (...args: any[]): {
64
+ identityRequest(opts: import("./types").IdentityRequestOptions): Promise<{
65
+ ok: boolean;
66
+ data: Record<string, unknown>;
67
+ }>;
68
+ identityResult(requestId: string): Promise<{
69
+ ok: boolean;
70
+ data: Record<string, unknown>;
71
+ }>;
72
+ identityVerifyCI(ciHash: string): Promise<{
73
+ ok: boolean;
74
+ data: {
75
+ exists: boolean;
76
+ account_seq?: number;
77
+ };
78
+ }>;
79
+ baseUrl: string;
80
+ token: string;
81
+ apiKey: string;
82
+ hmacSecret: string;
83
+ encryptRequests: boolean;
84
+ activeTxId: string | null;
85
+ keepSession: boolean;
86
+ refreshBuffer: number;
87
+ onTokenRefreshed?: (accessToken: string, expiresIn: number) => void;
88
+ onSessionExpired?: (error: Error) => void;
89
+ _sessionRefreshToken: string | null;
90
+ _refreshTimer: ReturnType<typeof setTimeout> | null;
91
+ configure(options: Partial<import("./types").EntityServerClientOptions>): void;
92
+ setToken(token: string): void;
93
+ setApiKey(apiKey: string): void;
94
+ setHmacSecret(secret: string): void;
95
+ setEncryptRequests(value: boolean): void;
96
+ _scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
97
+ access_token: string;
98
+ expires_in: number;
99
+ }>): void;
100
+ _clearRefreshTimer(): void;
101
+ stopKeepSession(): void;
102
+ readRequestBody<T = Record<string, unknown>>(body: ArrayBuffer | Uint8Array | string | T | null | undefined, contentType?: string, requireEncrypted?: boolean): T;
103
+ get _reqOpts(): import("./client/request").RequestOptions;
104
+ _request<T>(method: string, path: string, body?: unknown, withAuth?: boolean, extraHeaders?: Record<string, string>): Promise<T>;
105
+ _requestBinary(method: string, path: string, body?: unknown, withAuth?: boolean): Promise<ArrayBuffer>;
106
+ _requestForm<T>(method: string, path: string, form: FormData, withAuth?: boolean): Promise<T>;
107
+ };
108
+ } & {
109
+ new (...args: any[]): {
110
+ fileUpload(entity: string, file: File | Blob, opts?: import("./types").FileUploadOptions): Promise<{
111
+ ok: boolean;
112
+ uuid: string;
113
+ data: import("./types").FileMeta;
114
+ }>;
115
+ fileDownload(entity: string, uuid: string): Promise<ArrayBuffer>;
116
+ fileDelete(entity: string, uuid: string): Promise<{
117
+ ok: boolean;
118
+ uuid: string;
119
+ deleted: boolean;
120
+ }>;
121
+ fileList(entity: string, opts?: {
122
+ refSeq?: number;
123
+ }): Promise<{
124
+ ok: boolean;
125
+ data: {
126
+ items: import("./types").FileMeta[];
127
+ total: number;
128
+ };
129
+ }>;
130
+ fileMeta(entity: string, uuid: string): Promise<{
131
+ ok: boolean;
132
+ data: import("./types").FileMeta;
133
+ }>;
134
+ fileToken(uuid: string): Promise<{
135
+ ok: boolean;
136
+ token: string;
137
+ }>;
138
+ fileUrl(uuid: string): string;
139
+ baseUrl: string;
140
+ token: string;
141
+ apiKey: string;
142
+ hmacSecret: string;
143
+ encryptRequests: boolean;
144
+ activeTxId: string | null;
145
+ keepSession: boolean;
146
+ refreshBuffer: number;
147
+ onTokenRefreshed?: (accessToken: string, expiresIn: number) => void;
148
+ onSessionExpired?: (error: Error) => void;
149
+ _sessionRefreshToken: string | null;
150
+ _refreshTimer: ReturnType<typeof setTimeout> | null;
151
+ configure(options: Partial<import("./types").EntityServerClientOptions>): void;
152
+ setToken(token: string): void;
153
+ setApiKey(apiKey: string): void;
154
+ setHmacSecret(secret: string): void;
155
+ setEncryptRequests(value: boolean): void;
156
+ _scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
157
+ access_token: string;
158
+ expires_in: number;
159
+ }>): void;
160
+ _clearRefreshTimer(): void;
161
+ stopKeepSession(): void;
162
+ readRequestBody<T = Record<string, unknown>>(body: ArrayBuffer | Uint8Array | string | T | null | undefined, contentType?: string, requireEncrypted?: boolean): T;
163
+ get _reqOpts(): import("./client/request").RequestOptions;
164
+ _request<T>(method: string, path: string, body?: unknown, withAuth?: boolean, extraHeaders?: Record<string, string>): Promise<T>;
165
+ _requestBinary(method: string, path: string, body?: unknown, withAuth?: boolean): Promise<ArrayBuffer>;
166
+ _requestForm<T>(method: string, path: string, form: FormData, withAuth?: boolean): Promise<T>;
167
+ };
168
+ } & {
169
+ new (...args: any[]): {
170
+ pgCreateOrder(req: import("./types").PgCreateOrderRequest): Promise<{
171
+ ok: boolean;
172
+ data: Record<string, unknown>;
173
+ }>;
174
+ pgGetOrder(orderId: string): Promise<{
175
+ ok: boolean;
176
+ data: Record<string, unknown>;
177
+ }>;
178
+ pgConfirmPayment(req: import("./types").PgConfirmPaymentRequest): Promise<{
179
+ ok: boolean;
180
+ data: Record<string, unknown>;
181
+ }>;
182
+ pgCancelPayment(orderId: string, req: import("./types").PgCancelPaymentRequest): Promise<{
183
+ ok: boolean;
184
+ data: Record<string, unknown>;
185
+ }>;
186
+ pgSyncPayment(orderId: string): Promise<{
187
+ ok: boolean;
188
+ }>;
189
+ pgConfig(): Promise<{
190
+ ok: boolean;
191
+ data: Record<string, unknown>;
192
+ }>;
193
+ baseUrl: string;
194
+ token: string;
195
+ apiKey: string;
196
+ hmacSecret: string;
197
+ encryptRequests: boolean;
198
+ activeTxId: string | null;
199
+ keepSession: boolean;
200
+ refreshBuffer: number;
201
+ onTokenRefreshed?: (accessToken: string, expiresIn: number) => void;
202
+ onSessionExpired?: (error: Error) => void;
203
+ _sessionRefreshToken: string | null;
204
+ _refreshTimer: ReturnType<typeof setTimeout> | null;
205
+ configure(options: Partial<import("./types").EntityServerClientOptions>): void;
206
+ setToken(token: string): void;
207
+ setApiKey(apiKey: string): void;
208
+ setHmacSecret(secret: string): void;
209
+ setEncryptRequests(value: boolean): void;
210
+ _scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
211
+ access_token: string;
212
+ expires_in: number;
213
+ }>): void;
214
+ _clearRefreshTimer(): void;
215
+ stopKeepSession(): void;
216
+ readRequestBody<T = Record<string, unknown>>(body: ArrayBuffer | Uint8Array | string | T | null | undefined, contentType?: string, requireEncrypted?: boolean): T;
217
+ get _reqOpts(): import("./client/request").RequestOptions;
218
+ _request<T>(method: string, path: string, body?: unknown, withAuth?: boolean, extraHeaders?: Record<string, string>): Promise<T>;
219
+ _requestBinary(method: string, path: string, body?: unknown, withAuth?: boolean): Promise<ArrayBuffer>;
220
+ _requestForm<T>(method: string, path: string, form: FormData, withAuth?: boolean): Promise<T>;
221
+ };
222
+ } & {
223
+ new (...args: any[]): {
224
+ alimtalkSend(req: import("./types").AlimtalkSendRequest): Promise<{
225
+ message: string;
226
+ }>;
227
+ alimtalkStatus(seq: number): Promise<{
228
+ ok: boolean;
229
+ status: string;
230
+ }>;
231
+ alimtalkTemplates(): Promise<{
232
+ templates: {
233
+ code: string;
234
+ name: string;
235
+ content: string;
236
+ }[];
237
+ count: number;
238
+ }>;
239
+ friendtalkSend(req: import("./types").FriendtalkSendRequest): Promise<{
240
+ message: string;
241
+ }>;
242
+ baseUrl: string;
243
+ token: string;
244
+ apiKey: string;
245
+ hmacSecret: string;
246
+ encryptRequests: boolean;
247
+ activeTxId: string | null;
248
+ keepSession: boolean;
249
+ refreshBuffer: number;
250
+ onTokenRefreshed?: (accessToken: string, expiresIn: number) => void;
251
+ onSessionExpired?: (error: Error) => void;
252
+ _sessionRefreshToken: string | null;
253
+ _refreshTimer: ReturnType<typeof setTimeout> | null;
254
+ configure(options: Partial<import("./types").EntityServerClientOptions>): void;
255
+ setToken(token: string): void;
256
+ setApiKey(apiKey: string): void;
257
+ setHmacSecret(secret: string): void;
258
+ setEncryptRequests(value: boolean): void;
259
+ _scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
260
+ access_token: string;
261
+ expires_in: number;
262
+ }>): void;
263
+ _clearRefreshTimer(): void;
264
+ stopKeepSession(): void;
265
+ readRequestBody<T = Record<string, unknown>>(body: ArrayBuffer | Uint8Array | string | T | null | undefined, contentType?: string, requireEncrypted?: boolean): T;
266
+ get _reqOpts(): import("./client/request").RequestOptions;
267
+ _request<T>(method: string, path: string, body?: unknown, withAuth?: boolean, extraHeaders?: Record<string, string>): Promise<T>;
268
+ _requestBinary(method: string, path: string, body?: unknown, withAuth?: boolean): Promise<ArrayBuffer>;
269
+ _requestForm<T>(method: string, path: string, form: FormData, withAuth?: boolean): Promise<T>;
270
+ };
271
+ } & {
272
+ new (...args: any[]): {
273
+ smtpSend(req: import("./types").SmtpSendRequest): Promise<{
274
+ ok: boolean;
275
+ seq: number;
276
+ }>;
277
+ smtpStatus(seq: number): Promise<{
278
+ ok: boolean;
279
+ status: string;
280
+ }>;
281
+ baseUrl: string;
282
+ token: string;
283
+ apiKey: string;
284
+ hmacSecret: string;
285
+ encryptRequests: boolean;
286
+ activeTxId: string | null;
287
+ keepSession: boolean;
288
+ refreshBuffer: number;
289
+ onTokenRefreshed?: (accessToken: string, expiresIn: number) => void;
290
+ onSessionExpired?: (error: Error) => void;
291
+ _sessionRefreshToken: string | null;
292
+ _refreshTimer: ReturnType<typeof setTimeout> | null;
293
+ configure(options: Partial<import("./types").EntityServerClientOptions>): void;
294
+ setToken(token: string): void;
295
+ setApiKey(apiKey: string): void;
296
+ setHmacSecret(secret: string): void;
297
+ setEncryptRequests(value: boolean): void;
298
+ _scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
299
+ access_token: string;
300
+ expires_in: number;
301
+ }>): void;
302
+ _clearRefreshTimer(): void;
303
+ stopKeepSession(): void;
304
+ readRequestBody<T = Record<string, unknown>>(body: ArrayBuffer | Uint8Array | string | T | null | undefined, contentType?: string, requireEncrypted?: boolean): T;
305
+ get _reqOpts(): import("./client/request").RequestOptions;
306
+ _request<T>(method: string, path: string, body?: unknown, withAuth?: boolean, extraHeaders?: Record<string, string>): Promise<T>;
307
+ _requestBinary(method: string, path: string, body?: unknown, withAuth?: boolean): Promise<ArrayBuffer>;
308
+ _requestForm<T>(method: string, path: string, form: FormData, withAuth?: boolean): Promise<T>;
309
+ };
310
+ } & {
311
+ new (...args: any[]): {
312
+ smsSend(req: import("./types").SmsSendRequest): Promise<{
313
+ ok: boolean;
314
+ seq: number;
315
+ }>;
316
+ smsStatus(seq: number): Promise<{
317
+ ok: boolean;
318
+ status: string;
319
+ }>;
320
+ smsVerificationSend(phone: string, opts?: {
321
+ purpose?: string;
322
+ }): Promise<{
323
+ ok: boolean;
324
+ }>;
325
+ smsVerificationVerify(phone: string, code: string): Promise<{
326
+ ok: boolean;
327
+ verified: boolean;
328
+ }>;
329
+ baseUrl: string;
330
+ token: string;
331
+ apiKey: string;
332
+ hmacSecret: string;
333
+ encryptRequests: boolean;
334
+ activeTxId: string | null;
335
+ keepSession: boolean;
336
+ refreshBuffer: number;
337
+ onTokenRefreshed?: (accessToken: string, expiresIn: number) => void;
338
+ onSessionExpired?: (error: Error) => void;
339
+ _sessionRefreshToken: string | null;
340
+ _refreshTimer: ReturnType<typeof setTimeout> | null;
341
+ configure(options: Partial<import("./types").EntityServerClientOptions>): void;
342
+ setToken(token: string): void;
343
+ setApiKey(apiKey: string): void;
344
+ setHmacSecret(secret: string): void;
345
+ setEncryptRequests(value: boolean): void;
346
+ _scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
347
+ access_token: string;
348
+ expires_in: number;
349
+ }>): void;
350
+ _clearRefreshTimer(): void;
351
+ stopKeepSession(): void;
352
+ readRequestBody<T = Record<string, unknown>>(body: ArrayBuffer | Uint8Array | string | T | null | undefined, contentType?: string, requireEncrypted?: boolean): T;
353
+ get _reqOpts(): import("./client/request").RequestOptions;
354
+ _request<T>(method: string, path: string, body?: unknown, withAuth?: boolean, extraHeaders?: Record<string, string>): Promise<T>;
355
+ _requestBinary(method: string, path: string, body?: unknown, withAuth?: boolean): Promise<ArrayBuffer>;
356
+ _requestForm<T>(method: string, path: string, form: FormData, withAuth?: boolean): Promise<T>;
357
+ };
358
+ } & {
359
+ new (...args: any[]): {
360
+ emailVerificationSend(email: string): Promise<{
361
+ ok: boolean;
362
+ }>;
363
+ emailVerificationConfirm(token: string): Promise<{
364
+ ok: boolean;
365
+ }>;
366
+ emailVerificationStatus(): Promise<{
367
+ ok: boolean;
368
+ verified: boolean;
369
+ email?: string;
370
+ }>;
371
+ emailChange(newEmail: string, code?: string): Promise<{
372
+ ok: boolean;
373
+ }>;
374
+ baseUrl: string;
375
+ token: string;
376
+ apiKey: string;
377
+ hmacSecret: string;
378
+ encryptRequests: boolean;
379
+ activeTxId: string | null;
380
+ keepSession: boolean;
381
+ refreshBuffer: number;
382
+ onTokenRefreshed?: (accessToken: string, expiresIn: number) => void;
383
+ onSessionExpired?: (error: Error) => void;
384
+ _sessionRefreshToken: string | null;
385
+ _refreshTimer: ReturnType<typeof setTimeout> | null;
386
+ configure(options: Partial<import("./types").EntityServerClientOptions>): void;
387
+ setToken(token: string): void;
388
+ setApiKey(apiKey: string): void;
389
+ setHmacSecret(secret: string): void;
390
+ setEncryptRequests(value: boolean): void;
391
+ _scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
392
+ access_token: string;
393
+ expires_in: number;
394
+ }>): void;
395
+ _clearRefreshTimer(): void;
396
+ stopKeepSession(): void;
397
+ readRequestBody<T = Record<string, unknown>>(body: ArrayBuffer | Uint8Array | string | T | null | undefined, contentType?: string, requireEncrypted?: boolean): T;
398
+ get _reqOpts(): import("./client/request").RequestOptions;
399
+ _request<T>(method: string, path: string, body?: unknown, withAuth?: boolean, extraHeaders?: Record<string, string>): Promise<T>;
400
+ _requestBinary(method: string, path: string, body?: unknown, withAuth?: boolean): Promise<ArrayBuffer>;
401
+ _requestForm<T>(method: string, path: string, form: FormData, withAuth?: boolean): Promise<T>;
402
+ };
403
+ } & {
404
+ new (...args: any[]): {
405
+ push(pushEntity: string, payload: Record<string, unknown>, opts?: {
406
+ transactionId?: string;
407
+ }): Promise<{
408
+ ok: boolean;
409
+ seq: number;
410
+ }>;
411
+ pushLogList<T = unknown>(params?: import("./types").EntityListParams): Promise<{
412
+ ok: boolean;
413
+ data: import("./types").EntityListResult<T>;
414
+ }>;
415
+ registerPushDevice(accountSeq: number, deviceId: string, pushToken: string, opts?: import("./types").RegisterPushDeviceOptions): Promise<{
416
+ ok: boolean;
417
+ seq: number;
418
+ }>;
419
+ updatePushDeviceToken(deviceSeq: number, pushToken: string, opts?: {
420
+ pushEnabled?: boolean;
421
+ transactionId?: string;
422
+ }): Promise<{
423
+ ok: boolean;
424
+ seq: number;
425
+ }>;
426
+ disablePushDevice(deviceSeq: number, opts?: {
427
+ transactionId?: string;
428
+ }): Promise<{
429
+ ok: boolean;
430
+ seq: number;
431
+ }>;
432
+ pushSend(req: import("./types").PushSendRequest): Promise<{
433
+ ok: boolean;
434
+ seq: number;
435
+ }>;
436
+ pushSendAll(req: import("./types").PushSendAllRequest): Promise<{
437
+ ok: boolean;
438
+ sent: number;
439
+ failed: number;
440
+ }>;
441
+ pushStatus(seq: number): Promise<{
442
+ ok: boolean;
443
+ status: string;
444
+ }>;
445
+ baseUrl: string;
446
+ token: string;
447
+ apiKey: string;
448
+ hmacSecret: string;
449
+ encryptRequests: boolean;
450
+ activeTxId: string | null;
451
+ keepSession: boolean;
452
+ refreshBuffer: number;
453
+ onTokenRefreshed?: (accessToken: string, expiresIn: number) => void;
454
+ onSessionExpired?: (error: Error) => void;
455
+ _sessionRefreshToken: string | null;
456
+ _refreshTimer: ReturnType<typeof setTimeout> | null;
457
+ configure(options: Partial<import("./types").EntityServerClientOptions>): void;
458
+ setToken(token: string): void;
459
+ setApiKey(apiKey: string): void;
460
+ setHmacSecret(secret: string): void;
461
+ setEncryptRequests(value: boolean): void;
462
+ _scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
463
+ access_token: string;
464
+ expires_in: number;
465
+ }>): void;
466
+ _clearRefreshTimer(): void;
467
+ stopKeepSession(): void;
468
+ readRequestBody<T = Record<string, unknown>>(body: ArrayBuffer | Uint8Array | string | T | null | undefined, contentType?: string, requireEncrypted?: boolean): T;
469
+ get _reqOpts(): import("./client/request").RequestOptions;
470
+ _request<T>(method: string, path: string, body?: unknown, withAuth?: boolean, extraHeaders?: Record<string, string>): Promise<T>;
471
+ _requestBinary(method: string, path: string, body?: unknown, withAuth?: boolean): Promise<ArrayBuffer>;
472
+ _requestForm<T>(method: string, path: string, form: FormData, withAuth?: boolean): Promise<T>;
473
+ submit(entity: string, data: Record<string, unknown>, opts?: {
474
+ transactionId?: string;
475
+ skipHooks?: boolean;
476
+ }): Promise<{
477
+ ok: boolean;
478
+ seq: number;
479
+ }>;
480
+ list<T = unknown>(entity: string, params?: import("./types").EntityListParams): Promise<{
481
+ ok: boolean;
482
+ data: import("./types").EntityListResult<T>;
483
+ }>;
484
+ };
485
+ } & {
486
+ new (...args: any[]): {
487
+ transStart(): Promise<string>;
488
+ transRollback(transactionId?: string): Promise<{
489
+ ok: boolean;
490
+ }>;
491
+ transCommit(transactionId?: string): Promise<{
492
+ ok: boolean;
493
+ results: {
494
+ entity: string;
495
+ action: string;
496
+ seq: number;
497
+ }[];
498
+ }>;
499
+ get<T = unknown>(entity: string, seq: number, opts?: {
500
+ skipHooks?: boolean;
501
+ }): Promise<{
502
+ ok: boolean;
503
+ data: T;
504
+ }>;
505
+ find<T = unknown>(entity: string, conditions?: Record<string, unknown>, opts?: {
506
+ skipHooks?: boolean;
507
+ }): Promise<{
508
+ ok: boolean;
509
+ data: T;
510
+ }>;
511
+ list<T = unknown>(entity: string, params?: import("./types").EntityListParams): Promise<{
512
+ ok: boolean;
513
+ data: import("./types").EntityListResult<T>;
514
+ }>;
515
+ count(entity: string, conditions?: Record<string, unknown>): Promise<{
516
+ ok: boolean;
517
+ count: number;
518
+ }>;
519
+ query<T = unknown>(entity: string, req: import("./types").EntityQueryRequest): Promise<{
520
+ ok: boolean;
521
+ data: {
522
+ items: T[];
523
+ count: number;
524
+ };
525
+ }>;
526
+ submit(entity: string, data: Record<string, unknown>, opts?: {
527
+ transactionId?: string;
528
+ skipHooks?: boolean;
529
+ }): Promise<{
530
+ ok: boolean;
531
+ seq: number;
532
+ }>;
533
+ delete(entity: string, seq: number, opts?: {
534
+ transactionId?: string;
535
+ hard?: boolean;
536
+ skipHooks?: boolean;
537
+ }): Promise<{
538
+ ok: boolean;
539
+ deleted: number;
540
+ }>;
541
+ history<T = unknown>(entity: string, seq: number, params?: Pick<import("./types").EntityListParams, "page" | "limit">): Promise<{
542
+ ok: boolean;
543
+ data: import("./types").EntityListResult<import("./types").EntityHistoryRecord<T>>;
544
+ }>;
545
+ rollback(entity: string, historySeq: number): Promise<{
546
+ ok: boolean;
547
+ }>;
548
+ baseUrl: string;
549
+ token: string;
550
+ apiKey: string;
551
+ hmacSecret: string;
552
+ encryptRequests: boolean;
553
+ activeTxId: string | null;
554
+ keepSession: boolean;
555
+ refreshBuffer: number;
556
+ onTokenRefreshed?: (accessToken: string, expiresIn: number) => void;
557
+ onSessionExpired?: (error: Error) => void;
558
+ _sessionRefreshToken: string | null;
559
+ _refreshTimer: ReturnType<typeof setTimeout> | null;
560
+ configure(options: Partial<import("./types").EntityServerClientOptions>): void;
561
+ setToken(token: string): void;
562
+ setApiKey(apiKey: string): void;
563
+ setHmacSecret(secret: string): void;
564
+ setEncryptRequests(value: boolean): void;
565
+ _scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
566
+ access_token: string;
567
+ expires_in: number;
568
+ }>): void;
569
+ _clearRefreshTimer(): void;
570
+ stopKeepSession(): void;
571
+ readRequestBody<T = Record<string, unknown>>(body: ArrayBuffer | Uint8Array | string | T | null | undefined, contentType?: string, requireEncrypted?: boolean): T;
572
+ get _reqOpts(): import("./client/request").RequestOptions;
573
+ _request<T>(method: string, path: string, body?: unknown, withAuth?: boolean, extraHeaders?: Record<string, string>): Promise<T>;
574
+ _requestBinary(method: string, path: string, body?: unknown, withAuth?: boolean): Promise<ArrayBuffer>;
575
+ _requestForm<T>(method: string, path: string, form: FormData, withAuth?: boolean): Promise<T>;
576
+ };
577
+ } & {
578
+ new (...args: any[]): {
579
+ checkHealth(): Promise<{
580
+ ok: boolean;
581
+ packet_encryption?: boolean;
582
+ }>;
583
+ login(email: string, password: string): Promise<{
584
+ access_token: string;
585
+ refresh_token: string;
586
+ expires_in: number;
587
+ }>;
588
+ refreshToken(refreshToken: string): Promise<{
589
+ access_token: string;
590
+ expires_in: number;
591
+ }>;
592
+ logout(refreshToken: string): Promise<{
593
+ ok: boolean;
594
+ }>;
595
+ me<T = Record<string, unknown>>(): Promise<{
596
+ ok: boolean;
597
+ data: T;
598
+ }>;
599
+ changePassword(currentPasswd: string, newPasswd: string): Promise<{
600
+ ok: boolean;
601
+ }>;
602
+ withdraw(passwd?: string): Promise<{
603
+ ok: boolean;
604
+ }>;
605
+ reactivate(params: {
606
+ email: string;
607
+ passwd?: string;
608
+ provider?: string;
609
+ code?: string;
610
+ }): Promise<{
611
+ access_token: string;
612
+ refresh_token: string;
613
+ expires_in: number;
614
+ }>;
615
+ passwordResetRequest(email: string): Promise<{
616
+ ok: boolean;
617
+ }>;
618
+ passwordResetConfirm(token: string, newPasswd: string): Promise<{
619
+ ok: boolean;
620
+ }>;
621
+ oauthLink(provider: string, code: string, state?: string): Promise<{
622
+ ok: boolean;
623
+ message: string;
624
+ provider: string;
625
+ }>;
626
+ oauthUnlink(provider: string): Promise<{
627
+ ok: boolean;
628
+ message: string;
629
+ provider: string;
630
+ }>;
631
+ oauthProviders(): Promise<{
632
+ ok: boolean;
633
+ data: {
634
+ provider: string;
635
+ email?: string;
636
+ linked_at?: string;
637
+ }[];
638
+ }>;
639
+ oauthTokenRefresh(provider: string): Promise<{
640
+ ok: boolean;
641
+ access_token: string;
642
+ expires_at?: string;
643
+ }>;
644
+ twoFactorSetup(): Promise<{
645
+ ok: boolean;
646
+ setup_token: string;
647
+ qr_url: string;
648
+ secret: string;
649
+ }>;
650
+ twoFactorSetupVerify(code: string, setupToken: string): Promise<{
651
+ ok: boolean;
652
+ recovery_codes: string[];
653
+ }>;
654
+ twoFactorDisable(code: string): Promise<{
655
+ ok: boolean;
656
+ }>;
657
+ twoFactorStatus(): Promise<{
658
+ ok: boolean;
659
+ enabled: boolean;
660
+ }>;
661
+ twoFactorVerify(twoFactorToken: string, code: string): Promise<{
662
+ ok: boolean;
663
+ access_token: string;
664
+ refresh_token: string;
665
+ expires_in: number;
666
+ }>;
667
+ twoFactorRecovery(twoFactorToken: string, recoveryCode: string): Promise<{
668
+ ok: boolean;
669
+ access_token: string;
670
+ refresh_token: string;
671
+ expires_in: number;
672
+ }>;
673
+ twoFactorRegenerateRecovery(code: string): Promise<{
674
+ ok: boolean;
675
+ recovery_codes: string[];
676
+ }>;
677
+ baseUrl: string;
678
+ token: string;
679
+ apiKey: string;
680
+ hmacSecret: string;
681
+ encryptRequests: boolean;
682
+ activeTxId: string | null;
683
+ keepSession: boolean;
684
+ refreshBuffer: number;
685
+ onTokenRefreshed?: (accessToken: string, expiresIn: number) => void;
686
+ onSessionExpired?: (error: Error) => void;
687
+ _sessionRefreshToken: string | null;
688
+ _refreshTimer: ReturnType<typeof setTimeout> | null;
689
+ configure(options: Partial<import("./types").EntityServerClientOptions>): void;
690
+ setToken(token: string): void;
691
+ setApiKey(apiKey: string): void;
692
+ setHmacSecret(secret: string): void;
693
+ setEncryptRequests(value: boolean): void;
694
+ _scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
695
+ access_token: string;
696
+ expires_in: number;
697
+ }>): void;
698
+ _clearRefreshTimer(): void;
699
+ stopKeepSession(): void;
700
+ readRequestBody<T = Record<string, unknown>>(body: ArrayBuffer | Uint8Array | string | T | null | undefined, contentType?: string, requireEncrypted?: boolean): T;
701
+ get _reqOpts(): import("./client/request").RequestOptions;
702
+ _request<T>(method: string, path: string, body?: unknown, withAuth?: boolean, extraHeaders?: Record<string, string>): Promise<T>;
703
+ _requestBinary(method: string, path: string, body?: unknown, withAuth?: boolean): Promise<ArrayBuffer>;
704
+ _requestForm<T>(method: string, path: string, form: FormData, withAuth?: boolean): Promise<T>;
705
+ };
706
+ } & typeof EntityServerClientBase;
707
+ export declare class EntityServerClient extends EntityServerClient_base {
708
+ }
709
+ export {};