entity-client 1.0.8 → 1.0.10
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/dist/EntityAppServerApi.d.ts +128 -176
- package/dist/EntityServerApi.d.ts +65 -92
- package/dist/client/base.d.ts +17 -12
- package/dist/client/base.js +1 -1
- package/dist/client/base.js.map +3 -3
- package/dist/client/request.d.ts +2 -2
- package/dist/client/request.js +1 -1
- package/dist/client/request.js.map +3 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/mixins/app/plugins/alimtalk.d.ts +8 -11
- package/dist/mixins/app/plugins/friendtalk.d.ts +8 -11
- package/dist/mixins/app/plugins/holidays.d.ts +8 -11
- package/dist/mixins/app/plugins/identity.d.ts +8 -11
- package/dist/mixins/app/plugins/llm.d.ts +8 -11
- package/dist/mixins/app/plugins/ocr.d.ts +8 -11
- package/dist/mixins/app/plugins/pg.d.ts +8 -11
- package/dist/mixins/app/plugins/push.d.ts +8 -11
- package/dist/mixins/app/plugins/sms.d.ts +8 -11
- package/dist/mixins/app/plugins/taxinvoice.d.ts +8 -11
- package/dist/mixins/app/routes/account.d.ts +8 -11
- package/dist/mixins/app/routes/board.d.ts +8 -11
- package/dist/mixins/app/routes/email-verify.d.ts +8 -11
- package/dist/mixins/app/routes/oauth.d.ts +8 -11
- package/dist/mixins/app/routes/password-reset.d.ts +8 -11
- package/dist/mixins/app/routes/two-factor.d.ts +8 -11
- package/dist/mixins/server/admin.d.ts +8 -11
- package/dist/mixins/server/auth.d.ts +10 -16
- package/dist/mixins/server/auth.js +1 -1
- package/dist/mixins/server/auth.js.map +2 -2
- package/dist/mixins/server/entity.d.ts +8 -11
- package/dist/mixins/server/file.d.ts +8 -11
- package/dist/mixins/server/push.d.ts +8 -11
- package/dist/mixins/server/smtp.d.ts +8 -11
- package/dist/mixins/server/transaction.d.ts +8 -11
- package/dist/mixins/server/utils.d.ts +8 -11
- package/dist/react.js +1 -1
- package/dist/react.js.map +3 -3
- package/dist/types.d.ts +24 -10
- package/package.json +1 -1
|
@@ -43,38 +43,35 @@ declare const EntityServerApi_base: {
|
|
|
43
43
|
hmacSecret: string;
|
|
44
44
|
encryptRequests: boolean;
|
|
45
45
|
csrfEnabled: boolean;
|
|
46
|
-
csrfToken: string;
|
|
47
46
|
csrfHeaderName: string;
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
csrfCookieName: string;
|
|
48
|
+
_csrfRefresher: (() => Promise<void>) | null;
|
|
50
49
|
activeTxId: string | null;
|
|
51
50
|
keepSession: boolean;
|
|
52
51
|
refreshBuffer: number;
|
|
53
52
|
onTokenRefreshed?: (accessToken: string, expiresIn: number) => void;
|
|
54
53
|
onSessionExpired?: (error: Error) => void;
|
|
54
|
+
onHealthChange?: (online: boolean) => void;
|
|
55
55
|
_sessionRefreshToken: string | null;
|
|
56
56
|
_refreshTimer: ReturnType<typeof setTimeout> | null;
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
_healthTickTimer: ReturnType<typeof setInterval> | null;
|
|
58
|
+
_healthTickPromise: Promise<unknown> | null;
|
|
59
59
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
60
60
|
setToken(token: string): void;
|
|
61
61
|
setAnonymousPacketToken(token: string): void;
|
|
62
62
|
setApiKey(apiKey: string): void;
|
|
63
63
|
setHmacSecret(secret: string): void;
|
|
64
64
|
setEncryptRequests(value: boolean): void;
|
|
65
|
-
setCsrfToken(token: string): void;
|
|
66
65
|
setCsrfEnabled(enabled: boolean): void;
|
|
66
|
+
startHealthTick(intervalMs?: number): void;
|
|
67
|
+
stopHealthTick(): void;
|
|
67
68
|
_scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
68
69
|
access_token: string;
|
|
69
70
|
expires_in: number;
|
|
70
71
|
}>): void;
|
|
71
72
|
_clearRefreshTimer(): void;
|
|
72
73
|
stopKeepSession(): void;
|
|
73
|
-
|
|
74
|
-
stopCsrfRefresh(): void;
|
|
75
|
-
_scheduleCsrfRefresh(expiresIn: number): void;
|
|
76
|
-
refreshCsrfToken(): Promise<string>;
|
|
77
|
-
_applyCsrfHealth(csrf?: import("./types.js").EntityServerClientHealthCsrf | null): void;
|
|
74
|
+
_applyCsrfHealth(): void;
|
|
78
75
|
readRequestBody<T = Record<string, unknown>>(body: ArrayBuffer | Uint8Array | string | T | null | undefined, contentType?: string, requireEncrypted?: boolean): T;
|
|
79
76
|
get _reqOpts(): import("./client/request.js").RequestOptions;
|
|
80
77
|
get http(): {
|
|
@@ -104,38 +101,35 @@ declare const EntityServerApi_base: {
|
|
|
104
101
|
hmacSecret: string;
|
|
105
102
|
encryptRequests: boolean;
|
|
106
103
|
csrfEnabled: boolean;
|
|
107
|
-
csrfToken: string;
|
|
108
104
|
csrfHeaderName: string;
|
|
109
|
-
|
|
110
|
-
|
|
105
|
+
csrfCookieName: string;
|
|
106
|
+
_csrfRefresher: (() => Promise<void>) | null;
|
|
111
107
|
activeTxId: string | null;
|
|
112
108
|
keepSession: boolean;
|
|
113
109
|
refreshBuffer: number;
|
|
114
110
|
onTokenRefreshed?: (accessToken: string, expiresIn: number) => void;
|
|
115
111
|
onSessionExpired?: (error: Error) => void;
|
|
112
|
+
onHealthChange?: (online: boolean) => void;
|
|
116
113
|
_sessionRefreshToken: string | null;
|
|
117
114
|
_refreshTimer: ReturnType<typeof setTimeout> | null;
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
_healthTickTimer: ReturnType<typeof setInterval> | null;
|
|
116
|
+
_healthTickPromise: Promise<unknown> | null;
|
|
120
117
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
121
118
|
setToken(token: string): void;
|
|
122
119
|
setAnonymousPacketToken(token: string): void;
|
|
123
120
|
setApiKey(apiKey: string): void;
|
|
124
121
|
setHmacSecret(secret: string): void;
|
|
125
122
|
setEncryptRequests(value: boolean): void;
|
|
126
|
-
setCsrfToken(token: string): void;
|
|
127
123
|
setCsrfEnabled(enabled: boolean): void;
|
|
124
|
+
startHealthTick(intervalMs?: number): void;
|
|
125
|
+
stopHealthTick(): void;
|
|
128
126
|
_scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
129
127
|
access_token: string;
|
|
130
128
|
expires_in: number;
|
|
131
129
|
}>): void;
|
|
132
130
|
_clearRefreshTimer(): void;
|
|
133
131
|
stopKeepSession(): void;
|
|
134
|
-
|
|
135
|
-
stopCsrfRefresh(): void;
|
|
136
|
-
_scheduleCsrfRefresh(expiresIn: number): void;
|
|
137
|
-
refreshCsrfToken(): Promise<string>;
|
|
138
|
-
_applyCsrfHealth(csrf?: import("./types.js").EntityServerClientHealthCsrf | null): void;
|
|
132
|
+
_applyCsrfHealth(): void;
|
|
139
133
|
readRequestBody<T = Record<string, unknown>>(body: ArrayBuffer | Uint8Array | string | T | null | undefined, contentType?: string, requireEncrypted?: boolean): T;
|
|
140
134
|
get _reqOpts(): import("./client/request.js").RequestOptions;
|
|
141
135
|
get http(): {
|
|
@@ -194,38 +188,35 @@ declare const EntityServerApi_base: {
|
|
|
194
188
|
hmacSecret: string;
|
|
195
189
|
encryptRequests: boolean;
|
|
196
190
|
csrfEnabled: boolean;
|
|
197
|
-
csrfToken: string;
|
|
198
191
|
csrfHeaderName: string;
|
|
199
|
-
|
|
200
|
-
|
|
192
|
+
csrfCookieName: string;
|
|
193
|
+
_csrfRefresher: (() => Promise<void>) | null;
|
|
201
194
|
activeTxId: string | null;
|
|
202
195
|
keepSession: boolean;
|
|
203
196
|
refreshBuffer: number;
|
|
204
197
|
onTokenRefreshed?: (accessToken: string, expiresIn: number) => void;
|
|
205
198
|
onSessionExpired?: (error: Error) => void;
|
|
199
|
+
onHealthChange?: (online: boolean) => void;
|
|
206
200
|
_sessionRefreshToken: string | null;
|
|
207
201
|
_refreshTimer: ReturnType<typeof setTimeout> | null;
|
|
208
|
-
|
|
209
|
-
|
|
202
|
+
_healthTickTimer: ReturnType<typeof setInterval> | null;
|
|
203
|
+
_healthTickPromise: Promise<unknown> | null;
|
|
210
204
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
211
205
|
setToken(token: string): void;
|
|
212
206
|
setAnonymousPacketToken(token: string): void;
|
|
213
207
|
setApiKey(apiKey: string): void;
|
|
214
208
|
setHmacSecret(secret: string): void;
|
|
215
209
|
setEncryptRequests(value: boolean): void;
|
|
216
|
-
setCsrfToken(token: string): void;
|
|
217
210
|
setCsrfEnabled(enabled: boolean): void;
|
|
211
|
+
startHealthTick(intervalMs?: number): void;
|
|
212
|
+
stopHealthTick(): void;
|
|
218
213
|
_scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
219
214
|
access_token: string;
|
|
220
215
|
expires_in: number;
|
|
221
216
|
}>): void;
|
|
222
217
|
_clearRefreshTimer(): void;
|
|
223
218
|
stopKeepSession(): void;
|
|
224
|
-
|
|
225
|
-
stopCsrfRefresh(): void;
|
|
226
|
-
_scheduleCsrfRefresh(expiresIn: number): void;
|
|
227
|
-
refreshCsrfToken(): Promise<string>;
|
|
228
|
-
_applyCsrfHealth(csrf?: import("./types.js").EntityServerClientHealthCsrf | null): void;
|
|
219
|
+
_applyCsrfHealth(): void;
|
|
229
220
|
readRequestBody<T = Record<string, unknown>>(body: ArrayBuffer | Uint8Array | string | T | null | undefined, contentType?: string, requireEncrypted?: boolean): T;
|
|
230
221
|
get _reqOpts(): import("./client/request.js").RequestOptions;
|
|
231
222
|
get http(): {
|
|
@@ -261,38 +252,35 @@ declare const EntityServerApi_base: {
|
|
|
261
252
|
hmacSecret: string;
|
|
262
253
|
encryptRequests: boolean;
|
|
263
254
|
csrfEnabled: boolean;
|
|
264
|
-
csrfToken: string;
|
|
265
255
|
csrfHeaderName: string;
|
|
266
|
-
|
|
267
|
-
|
|
256
|
+
csrfCookieName: string;
|
|
257
|
+
_csrfRefresher: (() => Promise<void>) | null;
|
|
268
258
|
activeTxId: string | null;
|
|
269
259
|
keepSession: boolean;
|
|
270
260
|
refreshBuffer: number;
|
|
271
261
|
onTokenRefreshed?: (accessToken: string, expiresIn: number) => void;
|
|
272
262
|
onSessionExpired?: (error: Error) => void;
|
|
263
|
+
onHealthChange?: (online: boolean) => void;
|
|
273
264
|
_sessionRefreshToken: string | null;
|
|
274
265
|
_refreshTimer: ReturnType<typeof setTimeout> | null;
|
|
275
|
-
|
|
276
|
-
|
|
266
|
+
_healthTickTimer: ReturnType<typeof setInterval> | null;
|
|
267
|
+
_healthTickPromise: Promise<unknown> | null;
|
|
277
268
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
278
269
|
setToken(token: string): void;
|
|
279
270
|
setAnonymousPacketToken(token: string): void;
|
|
280
271
|
setApiKey(apiKey: string): void;
|
|
281
272
|
setHmacSecret(secret: string): void;
|
|
282
273
|
setEncryptRequests(value: boolean): void;
|
|
283
|
-
setCsrfToken(token: string): void;
|
|
284
274
|
setCsrfEnabled(enabled: boolean): void;
|
|
275
|
+
startHealthTick(intervalMs?: number): void;
|
|
276
|
+
stopHealthTick(): void;
|
|
285
277
|
_scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
286
278
|
access_token: string;
|
|
287
279
|
expires_in: number;
|
|
288
280
|
}>): void;
|
|
289
281
|
_clearRefreshTimer(): void;
|
|
290
282
|
stopKeepSession(): void;
|
|
291
|
-
|
|
292
|
-
stopCsrfRefresh(): void;
|
|
293
|
-
_scheduleCsrfRefresh(expiresIn: number): void;
|
|
294
|
-
refreshCsrfToken(): Promise<string>;
|
|
295
|
-
_applyCsrfHealth(csrf?: import("./types.js").EntityServerClientHealthCsrf | null): void;
|
|
283
|
+
_applyCsrfHealth(): void;
|
|
296
284
|
readRequestBody<T = Record<string, unknown>>(body: ArrayBuffer | Uint8Array | string | T | null | undefined, contentType?: string, requireEncrypted?: boolean): T;
|
|
297
285
|
get _reqOpts(): import("./client/request.js").RequestOptions;
|
|
298
286
|
get http(): {
|
|
@@ -346,38 +334,35 @@ declare const EntityServerApi_base: {
|
|
|
346
334
|
hmacSecret: string;
|
|
347
335
|
encryptRequests: boolean;
|
|
348
336
|
csrfEnabled: boolean;
|
|
349
|
-
csrfToken: string;
|
|
350
337
|
csrfHeaderName: string;
|
|
351
|
-
|
|
352
|
-
|
|
338
|
+
csrfCookieName: string;
|
|
339
|
+
_csrfRefresher: (() => Promise<void>) | null;
|
|
353
340
|
activeTxId: string | null;
|
|
354
341
|
keepSession: boolean;
|
|
355
342
|
refreshBuffer: number;
|
|
356
343
|
onTokenRefreshed?: (accessToken: string, expiresIn: number) => void;
|
|
357
344
|
onSessionExpired?: (error: Error) => void;
|
|
345
|
+
onHealthChange?: (online: boolean) => void;
|
|
358
346
|
_sessionRefreshToken: string | null;
|
|
359
347
|
_refreshTimer: ReturnType<typeof setTimeout> | null;
|
|
360
|
-
|
|
361
|
-
|
|
348
|
+
_healthTickTimer: ReturnType<typeof setInterval> | null;
|
|
349
|
+
_healthTickPromise: Promise<unknown> | null;
|
|
362
350
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
363
351
|
setToken(token: string): void;
|
|
364
352
|
setAnonymousPacketToken(token: string): void;
|
|
365
353
|
setApiKey(apiKey: string): void;
|
|
366
354
|
setHmacSecret(secret: string): void;
|
|
367
355
|
setEncryptRequests(value: boolean): void;
|
|
368
|
-
setCsrfToken(token: string): void;
|
|
369
356
|
setCsrfEnabled(enabled: boolean): void;
|
|
357
|
+
startHealthTick(intervalMs?: number): void;
|
|
358
|
+
stopHealthTick(): void;
|
|
370
359
|
_scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
371
360
|
access_token: string;
|
|
372
361
|
expires_in: number;
|
|
373
362
|
}>): void;
|
|
374
363
|
_clearRefreshTimer(): void;
|
|
375
364
|
stopKeepSession(): void;
|
|
376
|
-
|
|
377
|
-
stopCsrfRefresh(): void;
|
|
378
|
-
_scheduleCsrfRefresh(expiresIn: number): void;
|
|
379
|
-
refreshCsrfToken(): Promise<string>;
|
|
380
|
-
_applyCsrfHealth(csrf?: import("./types.js").EntityServerClientHealthCsrf | null): void;
|
|
365
|
+
_applyCsrfHealth(): void;
|
|
381
366
|
readRequestBody<T = Record<string, unknown>>(body: ArrayBuffer | Uint8Array | string | T | null | undefined, contentType?: string, requireEncrypted?: boolean): T;
|
|
382
367
|
get _reqOpts(): import("./client/request.js").RequestOptions;
|
|
383
368
|
get http(): {
|
|
@@ -466,38 +451,35 @@ declare const EntityServerApi_base: {
|
|
|
466
451
|
hmacSecret: string;
|
|
467
452
|
encryptRequests: boolean;
|
|
468
453
|
csrfEnabled: boolean;
|
|
469
|
-
csrfToken: string;
|
|
470
454
|
csrfHeaderName: string;
|
|
471
|
-
|
|
472
|
-
|
|
455
|
+
csrfCookieName: string;
|
|
456
|
+
_csrfRefresher: (() => Promise<void>) | null;
|
|
473
457
|
activeTxId: string | null;
|
|
474
458
|
keepSession: boolean;
|
|
475
459
|
refreshBuffer: number;
|
|
476
460
|
onTokenRefreshed?: (accessToken: string, expiresIn: number) => void;
|
|
477
461
|
onSessionExpired?: (error: Error) => void;
|
|
462
|
+
onHealthChange?: (online: boolean) => void;
|
|
478
463
|
_sessionRefreshToken: string | null;
|
|
479
464
|
_refreshTimer: ReturnType<typeof setTimeout> | null;
|
|
480
|
-
|
|
481
|
-
|
|
465
|
+
_healthTickTimer: ReturnType<typeof setInterval> | null;
|
|
466
|
+
_healthTickPromise: Promise<unknown> | null;
|
|
482
467
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
483
468
|
setToken(token: string): void;
|
|
484
469
|
setAnonymousPacketToken(token: string): void;
|
|
485
470
|
setApiKey(apiKey: string): void;
|
|
486
471
|
setHmacSecret(secret: string): void;
|
|
487
472
|
setEncryptRequests(value: boolean): void;
|
|
488
|
-
setCsrfToken(token: string): void;
|
|
489
473
|
setCsrfEnabled(enabled: boolean): void;
|
|
474
|
+
startHealthTick(intervalMs?: number): void;
|
|
475
|
+
stopHealthTick(): void;
|
|
490
476
|
_scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
491
477
|
access_token: string;
|
|
492
478
|
expires_in: number;
|
|
493
479
|
}>): void;
|
|
494
480
|
_clearRefreshTimer(): void;
|
|
495
481
|
stopKeepSession(): void;
|
|
496
|
-
|
|
497
|
-
stopCsrfRefresh(): void;
|
|
498
|
-
_scheduleCsrfRefresh(expiresIn: number): void;
|
|
499
|
-
refreshCsrfToken(): Promise<string>;
|
|
500
|
-
_applyCsrfHealth(csrf?: import("./types.js").EntityServerClientHealthCsrf | null): void;
|
|
482
|
+
_applyCsrfHealth(): void;
|
|
501
483
|
readRequestBody<T = Record<string, unknown>>(body: ArrayBuffer | Uint8Array | string | T | null | undefined, contentType?: string, requireEncrypted?: boolean): T;
|
|
502
484
|
get _reqOpts(): import("./client/request.js").RequestOptions;
|
|
503
485
|
get http(): {
|
|
@@ -590,38 +572,35 @@ declare const EntityServerApi_base: {
|
|
|
590
572
|
hmacSecret: string;
|
|
591
573
|
encryptRequests: boolean;
|
|
592
574
|
csrfEnabled: boolean;
|
|
593
|
-
csrfToken: string;
|
|
594
575
|
csrfHeaderName: string;
|
|
595
|
-
|
|
596
|
-
|
|
576
|
+
csrfCookieName: string;
|
|
577
|
+
_csrfRefresher: (() => Promise<void>) | null;
|
|
597
578
|
activeTxId: string | null;
|
|
598
579
|
keepSession: boolean;
|
|
599
580
|
refreshBuffer: number;
|
|
600
581
|
onTokenRefreshed?: (accessToken: string, expiresIn: number) => void;
|
|
601
582
|
onSessionExpired?: (error: Error) => void;
|
|
583
|
+
onHealthChange?: (online: boolean) => void;
|
|
602
584
|
_sessionRefreshToken: string | null;
|
|
603
585
|
_refreshTimer: ReturnType<typeof setTimeout> | null;
|
|
604
|
-
|
|
605
|
-
|
|
586
|
+
_healthTickTimer: ReturnType<typeof setInterval> | null;
|
|
587
|
+
_healthTickPromise: Promise<unknown> | null;
|
|
606
588
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
607
589
|
setToken(token: string): void;
|
|
608
590
|
setAnonymousPacketToken(token: string): void;
|
|
609
591
|
setApiKey(apiKey: string): void;
|
|
610
592
|
setHmacSecret(secret: string): void;
|
|
611
593
|
setEncryptRequests(value: boolean): void;
|
|
612
|
-
setCsrfToken(token: string): void;
|
|
613
594
|
setCsrfEnabled(enabled: boolean): void;
|
|
595
|
+
startHealthTick(intervalMs?: number): void;
|
|
596
|
+
stopHealthTick(): void;
|
|
614
597
|
_scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
615
598
|
access_token: string;
|
|
616
599
|
expires_in: number;
|
|
617
600
|
}>): void;
|
|
618
601
|
_clearRefreshTimer(): void;
|
|
619
602
|
stopKeepSession(): void;
|
|
620
|
-
|
|
621
|
-
stopCsrfRefresh(): void;
|
|
622
|
-
_scheduleCsrfRefresh(expiresIn: number): void;
|
|
623
|
-
refreshCsrfToken(): Promise<string>;
|
|
624
|
-
_applyCsrfHealth(csrf?: import("./types.js").EntityServerClientHealthCsrf | null): void;
|
|
603
|
+
_applyCsrfHealth(): void;
|
|
625
604
|
readRequestBody<T = Record<string, unknown>>(body: ArrayBuffer | Uint8Array | string | T | null | undefined, contentType?: string, requireEncrypted?: boolean): T;
|
|
626
605
|
get _reqOpts(): import("./client/request.js").RequestOptions;
|
|
627
606
|
get http(): {
|
|
@@ -641,12 +620,10 @@ declare const EntityServerApi_base: {
|
|
|
641
620
|
};
|
|
642
621
|
} & {
|
|
643
622
|
new (...args: any[]): {
|
|
623
|
+
_csrfRefresher: () => Promise<void>;
|
|
644
624
|
checkHealth(): Promise<{
|
|
645
|
-
|
|
646
|
-
packet_encryption?: boolean;
|
|
647
|
-
packet_mode?: string;
|
|
625
|
+
status: string;
|
|
648
626
|
packet_token?: string;
|
|
649
|
-
csrf?: import("./types.js").EntityServerClientHealthCsrf;
|
|
650
627
|
}>;
|
|
651
628
|
login(email: string, password: string): Promise<{
|
|
652
629
|
access_token: string;
|
|
@@ -677,38 +654,34 @@ declare const EntityServerApi_base: {
|
|
|
677
654
|
hmacSecret: string;
|
|
678
655
|
encryptRequests: boolean;
|
|
679
656
|
csrfEnabled: boolean;
|
|
680
|
-
csrfToken: string;
|
|
681
657
|
csrfHeaderName: string;
|
|
682
|
-
|
|
683
|
-
csrfRefreshBuffer: number;
|
|
658
|
+
csrfCookieName: string;
|
|
684
659
|
activeTxId: string | null;
|
|
685
660
|
keepSession: boolean;
|
|
686
661
|
refreshBuffer: number;
|
|
687
662
|
onTokenRefreshed?: (accessToken: string, expiresIn: number) => void;
|
|
688
663
|
onSessionExpired?: (error: Error) => void;
|
|
664
|
+
onHealthChange?: (online: boolean) => void;
|
|
689
665
|
_sessionRefreshToken: string | null;
|
|
690
666
|
_refreshTimer: ReturnType<typeof setTimeout> | null;
|
|
691
|
-
|
|
692
|
-
|
|
667
|
+
_healthTickTimer: ReturnType<typeof setInterval> | null;
|
|
668
|
+
_healthTickPromise: Promise<unknown> | null;
|
|
693
669
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
694
670
|
setToken(token: string): void;
|
|
695
671
|
setAnonymousPacketToken(token: string): void;
|
|
696
672
|
setApiKey(apiKey: string): void;
|
|
697
673
|
setHmacSecret(secret: string): void;
|
|
698
674
|
setEncryptRequests(value: boolean): void;
|
|
699
|
-
setCsrfToken(token: string): void;
|
|
700
675
|
setCsrfEnabled(enabled: boolean): void;
|
|
676
|
+
startHealthTick(intervalMs?: number): void;
|
|
677
|
+
stopHealthTick(): void;
|
|
701
678
|
_scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
702
679
|
access_token: string;
|
|
703
680
|
expires_in: number;
|
|
704
681
|
}>): void;
|
|
705
682
|
_clearRefreshTimer(): void;
|
|
706
683
|
stopKeepSession(): void;
|
|
707
|
-
|
|
708
|
-
stopCsrfRefresh(): void;
|
|
709
|
-
_scheduleCsrfRefresh(expiresIn: number): void;
|
|
710
|
-
refreshCsrfToken(): Promise<string>;
|
|
711
|
-
_applyCsrfHealth(csrf?: import("./types.js").EntityServerClientHealthCsrf | null): void;
|
|
684
|
+
_applyCsrfHealth(): void;
|
|
712
685
|
readRequestBody<T = Record<string, unknown>>(body: ArrayBuffer | Uint8Array | string | T | null | undefined, contentType?: string, requireEncrypted?: boolean): T;
|
|
713
686
|
get _reqOpts(): import("./client/request.js").RequestOptions;
|
|
714
687
|
get http(): {
|
package/dist/client/base.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { EntityServerClientOptions } from "../types.js";
|
|
2
2
|
import { type RequestOptions } from "./request.js";
|
|
3
3
|
export type GConstructor<T = object> = new (...args: any[]) => T;
|
|
4
4
|
export declare class EntityServerClientBase {
|
|
@@ -9,19 +9,20 @@ export declare class EntityServerClientBase {
|
|
|
9
9
|
hmacSecret: string;
|
|
10
10
|
encryptRequests: boolean;
|
|
11
11
|
csrfEnabled: boolean;
|
|
12
|
-
csrfToken: string;
|
|
13
12
|
csrfHeaderName: string;
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
csrfCookieName: string;
|
|
14
|
+
/** @internal health 재호출로 CSRF 쿠키 갱신 (AuthMixin에서 설정) */
|
|
15
|
+
_csrfRefresher: (() => Promise<void>) | null;
|
|
16
16
|
activeTxId: string | null;
|
|
17
17
|
keepSession: boolean;
|
|
18
18
|
refreshBuffer: number;
|
|
19
19
|
onTokenRefreshed?: (accessToken: string, expiresIn: number) => void;
|
|
20
20
|
onSessionExpired?: (error: Error) => void;
|
|
21
|
+
onHealthChange?: (online: boolean) => void;
|
|
21
22
|
_sessionRefreshToken: string | null;
|
|
22
23
|
_refreshTimer: ReturnType<typeof setTimeout> | null;
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
_healthTickTimer: ReturnType<typeof setInterval> | null;
|
|
25
|
+
_healthTickPromise: Promise<unknown> | null;
|
|
25
26
|
/**
|
|
26
27
|
* EntityServerClient 인스턴스를 생성합니다.
|
|
27
28
|
*
|
|
@@ -41,8 +42,16 @@ export declare class EntityServerClientBase {
|
|
|
41
42
|
setHmacSecret(secret: string): void;
|
|
42
43
|
/** 암호화 요청 활성화 여부를 설정합니다. */
|
|
43
44
|
setEncryptRequests(value: boolean): void;
|
|
44
|
-
setCsrfToken(token: string): void;
|
|
45
45
|
setCsrfEnabled(enabled: boolean): void;
|
|
46
|
+
/**
|
|
47
|
+
* 주기적으로 health 체크를 실행합니다.
|
|
48
|
+
* CSRF 쿠키 갱신과 서버 상태 확인을 자동화합니다.
|
|
49
|
+
*
|
|
50
|
+
* @param intervalMs 호출 주기(ms). 기본값: 5분
|
|
51
|
+
*/
|
|
52
|
+
startHealthTick(intervalMs?: number): void;
|
|
53
|
+
/** health tick 타이머를 중지합니다. */
|
|
54
|
+
stopHealthTick(): void;
|
|
46
55
|
/** @internal 자동 토큰 갱신 타이머를 시작합니다. */
|
|
47
56
|
_scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
48
57
|
access_token: string;
|
|
@@ -55,11 +64,7 @@ export declare class EntityServerClientBase {
|
|
|
55
64
|
* `logout()` 호출 시 자동으로 중지되며, 직접 호출이 필요한 경우는 드뭅니다.
|
|
56
65
|
*/
|
|
57
66
|
stopKeepSession(): void;
|
|
58
|
-
|
|
59
|
-
stopCsrfRefresh(): void;
|
|
60
|
-
_scheduleCsrfRefresh(expiresIn: number): void;
|
|
61
|
-
refreshCsrfToken(): Promise<string>;
|
|
62
|
-
_applyCsrfHealth(csrf?: EntityServerClientHealthCsrf | null): void;
|
|
67
|
+
_applyCsrfHealth(): void;
|
|
63
68
|
/**
|
|
64
69
|
* 요청 바디를 파싱합니다.
|
|
65
70
|
* `application/octet-stream`이면 XChaCha20-Poly1305 복호화, 그 외는 JSON 파싱합니다.
|
package/dist/client/base.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{readEnv as
|
|
1
|
+
import{readEnv as c}from"./utils.js";import{derivePacketKey as f,parseRequestBody as l}from"./packet.js";import{entityRequest as h}from"./request.js";class y{baseUrl;token;anonymousPacketToken;apiKey;hmacSecret;encryptRequests;csrfEnabled;csrfHeaderName;csrfCookieName;_csrfRefresher=null;activeTxId=null;keepSession;refreshBuffer;onTokenRefreshed;onSessionExpired;onHealthChange;_sessionRefreshToken=null;_refreshTimer=null;_healthTickTimer=null;_healthTickPromise=null;constructor(e={}){const r=c("VITE_ENTITY_SERVER_URL");this.baseUrl=(e.baseUrl??r??"").replace(/\/$/,""),this.token=e.token??"",this.anonymousPacketToken=e.anonymousPacketToken??"",this.apiKey=e.apiKey??"",this.hmacSecret=e.hmacSecret??"",this.encryptRequests=e.encryptRequests??!1,this.csrfEnabled=e.csrfEnabled??!1,this.csrfHeaderName=e.csrfHeaderName??"x-csrf-token",this.csrfCookieName=e.csrfCookieName??"_csrf",this.keepSession=e.keepSession??!1,this.refreshBuffer=e.refreshBuffer??60,this.onTokenRefreshed=e.onTokenRefreshed,this.onSessionExpired=e.onSessionExpired,this.onHealthChange=e.onHealthChange,typeof e.healthTickInterval=="number"&&e.healthTickInterval>0&&Promise.resolve().then(()=>this.startHealthTick(e.healthTickInterval))}configure(e){typeof e.baseUrl=="string"&&(this.baseUrl=e.baseUrl.replace(/\/$/,"")),typeof e.token=="string"&&(this.token=e.token),typeof e.anonymousPacketToken=="string"&&(this.anonymousPacketToken=e.anonymousPacketToken),typeof e.encryptRequests=="boolean"&&(this.encryptRequests=e.encryptRequests),typeof e.csrfEnabled=="boolean"&&(this.csrfEnabled=e.csrfEnabled),typeof e.csrfHeaderName=="string"&&(this.csrfHeaderName=e.csrfHeaderName),typeof e.csrfCookieName=="string"&&(this.csrfCookieName=e.csrfCookieName),typeof e.apiKey=="string"&&(this.apiKey=e.apiKey),typeof e.hmacSecret=="string"&&(this.hmacSecret=e.hmacSecret),typeof e.keepSession=="boolean"&&(this.keepSession=e.keepSession),typeof e.refreshBuffer=="number"&&(this.refreshBuffer=e.refreshBuffer),e.onTokenRefreshed&&(this.onTokenRefreshed=e.onTokenRefreshed),e.onSessionExpired&&(this.onSessionExpired=e.onSessionExpired),e.onHealthChange&&(this.onHealthChange=e.onHealthChange),typeof e.healthTickInterval=="number"&&e.healthTickInterval>0&&Promise.resolve().then(()=>this.startHealthTick(e.healthTickInterval))}setToken(e){this.token=e}setAnonymousPacketToken(e){this.anonymousPacketToken=e}setApiKey(e){this.apiKey=e}setHmacSecret(e){this.hmacSecret=e}setEncryptRequests(e){this.encryptRequests=e}setCsrfEnabled(e){this.csrfEnabled=e}startHealthTick(e=300*1e3){this.stopHealthTick();const r=()=>{this._healthTickPromise||(this._healthTickPromise=(this._csrfRefresher?this._csrfRefresher():Promise.resolve()).then(()=>{this.onHealthChange?.(!0)}).catch(()=>{this.onHealthChange?.(!1)}).finally(()=>{this._healthTickPromise=null}))};r(),this._healthTickTimer=setInterval(r,e)}stopHealthTick(){this._healthTickTimer!==null&&(clearInterval(this._healthTickTimer),this._healthTickTimer=null),this._healthTickPromise=null}_scheduleKeepSession(e,r,t){this._clearRefreshTimer(),this._sessionRefreshToken=e;const i=Math.max((r-this.refreshBuffer)*1e3,0);this._refreshTimer=setTimeout(async()=>{if(this._sessionRefreshToken)try{const s=await t(this._sessionRefreshToken);this.onTokenRefreshed?.(s.access_token,s.expires_in),this._scheduleKeepSession(this._sessionRefreshToken,s.expires_in,t)}catch(s){this._clearRefreshTimer(),this.onSessionExpired?.(s instanceof Error?s:new Error(String(s)))}},i)}_clearRefreshTimer(){this._refreshTimer!==null&&(clearTimeout(this._refreshTimer),this._refreshTimer=null)}stopKeepSession(){this._clearRefreshTimer(),this._sessionRefreshToken=null}_applyCsrfHealth(){if(!(typeof document>"u")){for(const e of document.cookie.split(";")){const r=e.indexOf("=");if(!(r<0)&&e.substring(0,r).trim()===this.csrfCookieName){this.csrfEnabled=!!e.substring(r+1).trim();return}}this.csrfEnabled=!1}}readRequestBody(e,r="application/json",t=!1){const i=f(this.hmacSecret,this.token||this.anonymousPacketToken);return l(e,r,t,i)}get _reqOpts(){return{baseUrl:this.baseUrl,token:this.token,anonymousPacketToken:this.anonymousPacketToken,apiKey:this.apiKey,hmacSecret:this.hmacSecret,encryptRequests:this.encryptRequests,csrfEnabled:this.csrfEnabled,csrfHeaderName:this.csrfHeaderName,csrfCookieName:this.csrfCookieName,refreshCsrfCookie:this.csrfEnabled?this._csrfRefresher:null}}get http(){const e=this;return{get(r,t=!0,i){return h(e._reqOpts,"GET",r,void 0,t,i,!1)},post(r,t,i=!0,s){return h(e._reqOpts,"POST",r,t,i,s,!1)},put(r,t,i=!0,s){return h(e._reqOpts,"PUT",r,t,i,s,!1)},patch(r,t,i=!0,s){return h(e._reqOpts,"PATCH",r,t,i,s,!1)},delete(r,t,i=!0,s){return h(e._reqOpts,"DELETE",r,t,i,s,!1)}}}requestBinary(e,r,t,i=!0){return this._requestBinary(e,r,t,i)}requestForm(e,r,t,i=!0){return this._requestForm(e,r,t,i)}requestFormBinary(e,r,t,i=!0){return this._requestFormBinary(e,r,t,i)}_request(e,r,t,i=!0,s){return h(this._reqOpts,e,r,t,i,s,!0)}async _requestBinary(e,r,t,i=!0){const s={"Content-Type":"application/json"};i&&this.token&&(s.Authorization=`Bearer ${this.token}`),this.apiKey&&(s["X-API-Key"]=this.apiKey);const n=await fetch(this.baseUrl+r,{method:e,headers:s,...t!=null?{body:JSON.stringify(t)}:{},credentials:"include"});if(!n.ok){const o=await n.text(),a=new Error(`HTTP ${n.status}: ${o}`);throw a.status=n.status,a}return n.arrayBuffer()}async _requestForm(e,r,t,i=!0){const s={};i&&this.token&&(s.Authorization=`Bearer ${this.token}`),this.apiKey&&(s["X-API-Key"]=this.apiKey);const n=await fetch(this.baseUrl+r,{method:e,headers:s,body:t,credentials:"include"}),o=await n.json();if(!o.ok){const a=new Error(o.message??`EntityServer error (HTTP ${n.status})`);throw a.status=n.status,a}return o}async _requestFormBinary(e,r,t,i=!0){const s={};i&&this.token&&(s.Authorization=`Bearer ${this.token}`),this.apiKey&&(s["X-API-Key"]=this.apiKey);const n=await fetch(this.baseUrl+r,{method:e,headers:s,body:t,credentials:"include"});if(!n.ok){const o=await n.text(),a=new Error(`HTTP ${n.status}: ${o}`);throw a.status=n.status,a}return n.arrayBuffer()}}export{y as EntityServerClientBase};
|
|
2
2
|
//# sourceMappingURL=base.js.map
|