entity-client 1.0.21 → 1.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +362 -362
- package/dist/EntityAppServerApi.d.ts +16 -32
- package/dist/EntityAppServerApi.js.map +1 -1
- package/dist/EntityServerApi.d.ts +8 -16
- package/dist/EntityServerApi.js.map +1 -1
- package/dist/client/base.d.ts +1 -4
- package/dist/client/base.js +1 -1
- package/dist/client/base.js.map +3 -3
- package/dist/client/hmac.js.map +1 -1
- package/dist/client/packet.js.map +1 -1
- package/dist/client/request.js.map +1 -1
- package/dist/client/utils.js.map +1 -1
- package/dist/hooks/useEntityAppServer.js.map +1 -1
- package/dist/hooks/useEntityClient.js.map +1 -1
- package/dist/hooks/useEntityServer.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/mixins/app/index.js.map +1 -1
- package/dist/mixins/app/plugins/alimtalk.d.ts +1 -2
- package/dist/mixins/app/plugins/alimtalk.js.map +1 -1
- package/dist/mixins/app/plugins/friendtalk.d.ts +1 -2
- package/dist/mixins/app/plugins/friendtalk.js.map +1 -1
- package/dist/mixins/app/plugins/holidays.d.ts +1 -2
- package/dist/mixins/app/plugins/holidays.js.map +1 -1
- package/dist/mixins/app/plugins/identity.d.ts +1 -2
- package/dist/mixins/app/plugins/identity.js.map +1 -1
- package/dist/mixins/app/plugins/index.js.map +1 -1
- package/dist/mixins/app/plugins/llm.d.ts +1 -2
- package/dist/mixins/app/plugins/llm.js.map +1 -1
- package/dist/mixins/app/plugins/ocr.d.ts +1 -2
- package/dist/mixins/app/plugins/ocr.js.map +1 -1
- package/dist/mixins/app/plugins/pg.d.ts +1 -2
- package/dist/mixins/app/plugins/pg.js.map +1 -1
- package/dist/mixins/app/plugins/push.d.ts +1 -2
- package/dist/mixins/app/plugins/push.js.map +1 -1
- package/dist/mixins/app/plugins/sms.d.ts +1 -2
- package/dist/mixins/app/plugins/sms.js.map +1 -1
- package/dist/mixins/app/plugins/taxinvoice.d.ts +1 -2
- package/dist/mixins/app/plugins/taxinvoice.js.map +1 -1
- package/dist/mixins/app/routes/account.d.ts +1 -2
- package/dist/mixins/app/routes/account.js.map +1 -1
- package/dist/mixins/app/routes/board.d.ts +1 -2
- package/dist/mixins/app/routes/board.js.map +1 -1
- package/dist/mixins/app/routes/email-verify.d.ts +1 -2
- package/dist/mixins/app/routes/email-verify.js.map +1 -1
- package/dist/mixins/app/routes/oauth.d.ts +1 -2
- package/dist/mixins/app/routes/oauth.js.map +1 -1
- package/dist/mixins/app/routes/password-reset.d.ts +1 -2
- package/dist/mixins/app/routes/password-reset.js.map +1 -1
- package/dist/mixins/app/routes/two-factor.d.ts +1 -2
- package/dist/mixins/app/routes/two-factor.js.map +1 -1
- package/dist/mixins/server/admin.d.ts +1 -2
- package/dist/mixins/server/admin.js.map +1 -1
- package/dist/mixins/server/auth.d.ts +1 -3
- package/dist/mixins/server/auth.js +1 -1
- package/dist/mixins/server/auth.js.map +3 -3
- package/dist/mixins/server/entity.d.ts +1 -2
- package/dist/mixins/server/entity.js.map +1 -1
- package/dist/mixins/server/file.d.ts +1 -2
- package/dist/mixins/server/file.js.map +1 -1
- package/dist/mixins/server/index.js.map +1 -1
- package/dist/mixins/server/push.d.ts +1 -2
- package/dist/mixins/server/push.js.map +1 -1
- package/dist/mixins/server/smtp.d.ts +1 -2
- package/dist/mixins/server/smtp.js.map +1 -1
- package/dist/mixins/server/transaction.d.ts +1 -2
- package/dist/mixins/server/transaction.js.map +1 -1
- package/dist/mixins/server/utils.d.ts +1 -2
- package/dist/mixins/server/utils.js.map +1 -1
- package/dist/packet.js.map +1 -1
- package/dist/react.js +1 -1
- package/dist/react.js.map +3 -3
- package/package.json +57 -57
|
@@ -40,7 +40,6 @@ declare const EntityAppServerApi_base: {
|
|
|
40
40
|
realtimeEventListeners: Map<string, Set<import("./types.js").RealtimeMessageListener>>;
|
|
41
41
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
42
42
|
setToken(token: string): void;
|
|
43
|
-
setAccessTokenFromResponse(token: string): void;
|
|
44
43
|
setAnonymousPacketToken(token: string): void;
|
|
45
44
|
setApiKey(apiKey: string): void;
|
|
46
45
|
setHmacSecret(secret: string): void;
|
|
@@ -57,7 +56,7 @@ declare const EntityAppServerApi_base: {
|
|
|
57
56
|
sendRealtime(message: import("./types.js").RealtimeEnvelope | Record<string, unknown>): boolean;
|
|
58
57
|
subscribeRealtime(subscriptions: string[]): boolean;
|
|
59
58
|
unsubscribeRealtime(subscriptions: string[]): boolean;
|
|
60
|
-
startHealthTick(intervalMs?: number
|
|
59
|
+
startHealthTick(intervalMs?: number): void;
|
|
61
60
|
stopHealthTick(): void;
|
|
62
61
|
scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
63
62
|
access_token: string;
|
|
@@ -125,7 +124,6 @@ declare const EntityAppServerApi_base: {
|
|
|
125
124
|
realtimeEventListeners: Map<string, Set<import("./types.js").RealtimeMessageListener>>;
|
|
126
125
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
127
126
|
setToken(token: string): void;
|
|
128
|
-
setAccessTokenFromResponse(token: string): void;
|
|
129
127
|
setAnonymousPacketToken(token: string): void;
|
|
130
128
|
setApiKey(apiKey: string): void;
|
|
131
129
|
setHmacSecret(secret: string): void;
|
|
@@ -142,7 +140,7 @@ declare const EntityAppServerApi_base: {
|
|
|
142
140
|
sendRealtime(message: import("./types.js").RealtimeEnvelope | Record<string, unknown>): boolean;
|
|
143
141
|
subscribeRealtime(subscriptions: string[]): boolean;
|
|
144
142
|
unsubscribeRealtime(subscriptions: string[]): boolean;
|
|
145
|
-
startHealthTick(intervalMs?: number
|
|
143
|
+
startHealthTick(intervalMs?: number): void;
|
|
146
144
|
stopHealthTick(): void;
|
|
147
145
|
scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
148
146
|
access_token: string;
|
|
@@ -213,7 +211,6 @@ declare const EntityAppServerApi_base: {
|
|
|
213
211
|
realtimeEventListeners: Map<string, Set<import("./types.js").RealtimeMessageListener>>;
|
|
214
212
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
215
213
|
setToken(token: string): void;
|
|
216
|
-
setAccessTokenFromResponse(token: string): void;
|
|
217
214
|
setAnonymousPacketToken(token: string): void;
|
|
218
215
|
setApiKey(apiKey: string): void;
|
|
219
216
|
setHmacSecret(secret: string): void;
|
|
@@ -230,7 +227,7 @@ declare const EntityAppServerApi_base: {
|
|
|
230
227
|
sendRealtime(message: import("./types.js").RealtimeEnvelope | Record<string, unknown>): boolean;
|
|
231
228
|
subscribeRealtime(subscriptions: string[]): boolean;
|
|
232
229
|
unsubscribeRealtime(subscriptions: string[]): boolean;
|
|
233
|
-
startHealthTick(intervalMs?: number
|
|
230
|
+
startHealthTick(intervalMs?: number): void;
|
|
234
231
|
stopHealthTick(): void;
|
|
235
232
|
scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
236
233
|
access_token: string;
|
|
@@ -302,7 +299,6 @@ declare const EntityAppServerApi_base: {
|
|
|
302
299
|
realtimeEventListeners: Map<string, Set<import("./types.js").RealtimeMessageListener>>;
|
|
303
300
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
304
301
|
setToken(token: string): void;
|
|
305
|
-
setAccessTokenFromResponse(token: string): void;
|
|
306
302
|
setAnonymousPacketToken(token: string): void;
|
|
307
303
|
setApiKey(apiKey: string): void;
|
|
308
304
|
setHmacSecret(secret: string): void;
|
|
@@ -319,7 +315,7 @@ declare const EntityAppServerApi_base: {
|
|
|
319
315
|
sendRealtime(message: import("./types.js").RealtimeEnvelope | Record<string, unknown>): boolean;
|
|
320
316
|
subscribeRealtime(subscriptions: string[]): boolean;
|
|
321
317
|
unsubscribeRealtime(subscriptions: string[]): boolean;
|
|
322
|
-
startHealthTick(intervalMs?: number
|
|
318
|
+
startHealthTick(intervalMs?: number): void;
|
|
323
319
|
stopHealthTick(): void;
|
|
324
320
|
scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
325
321
|
access_token: string;
|
|
@@ -393,7 +389,6 @@ declare const EntityAppServerApi_base: {
|
|
|
393
389
|
realtimeEventListeners: Map<string, Set<import("./types.js").RealtimeMessageListener>>;
|
|
394
390
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
395
391
|
setToken(token: string): void;
|
|
396
|
-
setAccessTokenFromResponse(token: string): void;
|
|
397
392
|
setAnonymousPacketToken(token: string): void;
|
|
398
393
|
setApiKey(apiKey: string): void;
|
|
399
394
|
setHmacSecret(secret: string): void;
|
|
@@ -410,7 +405,7 @@ declare const EntityAppServerApi_base: {
|
|
|
410
405
|
sendRealtime(message: import("./types.js").RealtimeEnvelope | Record<string, unknown>): boolean;
|
|
411
406
|
subscribeRealtime(subscriptions: string[]): boolean;
|
|
412
407
|
unsubscribeRealtime(subscriptions: string[]): boolean;
|
|
413
|
-
startHealthTick(intervalMs?: number
|
|
408
|
+
startHealthTick(intervalMs?: number): void;
|
|
414
409
|
stopHealthTick(): void;
|
|
415
410
|
scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
416
411
|
access_token: string;
|
|
@@ -483,7 +478,6 @@ declare const EntityAppServerApi_base: {
|
|
|
483
478
|
realtimeEventListeners: Map<string, Set<import("./types.js").RealtimeMessageListener>>;
|
|
484
479
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
485
480
|
setToken(token: string): void;
|
|
486
|
-
setAccessTokenFromResponse(token: string): void;
|
|
487
481
|
setAnonymousPacketToken(token: string): void;
|
|
488
482
|
setApiKey(apiKey: string): void;
|
|
489
483
|
setHmacSecret(secret: string): void;
|
|
@@ -500,7 +494,7 @@ declare const EntityAppServerApi_base: {
|
|
|
500
494
|
sendRealtime(message: import("./types.js").RealtimeEnvelope | Record<string, unknown>): boolean;
|
|
501
495
|
subscribeRealtime(subscriptions: string[]): boolean;
|
|
502
496
|
unsubscribeRealtime(subscriptions: string[]): boolean;
|
|
503
|
-
startHealthTick(intervalMs?: number
|
|
497
|
+
startHealthTick(intervalMs?: number): void;
|
|
504
498
|
stopHealthTick(): void;
|
|
505
499
|
scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
506
500
|
access_token: string;
|
|
@@ -575,7 +569,6 @@ declare const EntityAppServerApi_base: {
|
|
|
575
569
|
realtimeEventListeners: Map<string, Set<import("./types.js").RealtimeMessageListener>>;
|
|
576
570
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
577
571
|
setToken(token: string): void;
|
|
578
|
-
setAccessTokenFromResponse(token: string): void;
|
|
579
572
|
setAnonymousPacketToken(token: string): void;
|
|
580
573
|
setApiKey(apiKey: string): void;
|
|
581
574
|
setHmacSecret(secret: string): void;
|
|
@@ -592,7 +585,7 @@ declare const EntityAppServerApi_base: {
|
|
|
592
585
|
sendRealtime(message: import("./types.js").RealtimeEnvelope | Record<string, unknown>): boolean;
|
|
593
586
|
subscribeRealtime(subscriptions: string[]): boolean;
|
|
594
587
|
unsubscribeRealtime(subscriptions: string[]): boolean;
|
|
595
|
-
startHealthTick(intervalMs?: number
|
|
588
|
+
startHealthTick(intervalMs?: number): void;
|
|
596
589
|
stopHealthTick(): void;
|
|
597
590
|
scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
598
591
|
access_token: string;
|
|
@@ -694,7 +687,6 @@ declare const EntityAppServerApi_base: {
|
|
|
694
687
|
realtimeEventListeners: Map<string, Set<import("./types.js").RealtimeMessageListener>>;
|
|
695
688
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
696
689
|
setToken(token: string): void;
|
|
697
|
-
setAccessTokenFromResponse(token: string): void;
|
|
698
690
|
setAnonymousPacketToken(token: string): void;
|
|
699
691
|
setApiKey(apiKey: string): void;
|
|
700
692
|
setHmacSecret(secret: string): void;
|
|
@@ -711,7 +703,7 @@ declare const EntityAppServerApi_base: {
|
|
|
711
703
|
sendRealtime(message: import("./types.js").RealtimeEnvelope | Record<string, unknown>): boolean;
|
|
712
704
|
subscribeRealtime(subscriptions: string[]): boolean;
|
|
713
705
|
unsubscribeRealtime(subscriptions: string[]): boolean;
|
|
714
|
-
startHealthTick(intervalMs?: number
|
|
706
|
+
startHealthTick(intervalMs?: number): void;
|
|
715
707
|
stopHealthTick(): void;
|
|
716
708
|
scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
717
709
|
access_token: string;
|
|
@@ -782,7 +774,6 @@ declare const EntityAppServerApi_base: {
|
|
|
782
774
|
realtimeEventListeners: Map<string, Set<import("./types.js").RealtimeMessageListener>>;
|
|
783
775
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
784
776
|
setToken(token: string): void;
|
|
785
|
-
setAccessTokenFromResponse(token: string): void;
|
|
786
777
|
setAnonymousPacketToken(token: string): void;
|
|
787
778
|
setApiKey(apiKey: string): void;
|
|
788
779
|
setHmacSecret(secret: string): void;
|
|
@@ -799,7 +790,7 @@ declare const EntityAppServerApi_base: {
|
|
|
799
790
|
sendRealtime(message: import("./types.js").RealtimeEnvelope | Record<string, unknown>): boolean;
|
|
800
791
|
subscribeRealtime(subscriptions: string[]): boolean;
|
|
801
792
|
unsubscribeRealtime(subscriptions: string[]): boolean;
|
|
802
|
-
startHealthTick(intervalMs?: number
|
|
793
|
+
startHealthTick(intervalMs?: number): void;
|
|
803
794
|
stopHealthTick(): void;
|
|
804
795
|
scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
805
796
|
access_token: string;
|
|
@@ -873,7 +864,6 @@ declare const EntityAppServerApi_base: {
|
|
|
873
864
|
realtimeEventListeners: Map<string, Set<import("./types.js").RealtimeMessageListener>>;
|
|
874
865
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
875
866
|
setToken(token: string): void;
|
|
876
|
-
setAccessTokenFromResponse(token: string): void;
|
|
877
867
|
setAnonymousPacketToken(token: string): void;
|
|
878
868
|
setApiKey(apiKey: string): void;
|
|
879
869
|
setHmacSecret(secret: string): void;
|
|
@@ -890,7 +880,7 @@ declare const EntityAppServerApi_base: {
|
|
|
890
880
|
sendRealtime(message: import("./types.js").RealtimeEnvelope | Record<string, unknown>): boolean;
|
|
891
881
|
subscribeRealtime(subscriptions: string[]): boolean;
|
|
892
882
|
unsubscribeRealtime(subscriptions: string[]): boolean;
|
|
893
|
-
startHealthTick(intervalMs?: number
|
|
883
|
+
startHealthTick(intervalMs?: number): void;
|
|
894
884
|
stopHealthTick(): void;
|
|
895
885
|
scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
896
886
|
access_token: string;
|
|
@@ -963,7 +953,6 @@ declare const EntityAppServerApi_base: {
|
|
|
963
953
|
realtimeEventListeners: Map<string, Set<import("./types.js").RealtimeMessageListener>>;
|
|
964
954
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
965
955
|
setToken(token: string): void;
|
|
966
|
-
setAccessTokenFromResponse(token: string): void;
|
|
967
956
|
setAnonymousPacketToken(token: string): void;
|
|
968
957
|
setApiKey(apiKey: string): void;
|
|
969
958
|
setHmacSecret(secret: string): void;
|
|
@@ -980,7 +969,7 @@ declare const EntityAppServerApi_base: {
|
|
|
980
969
|
sendRealtime(message: import("./types.js").RealtimeEnvelope | Record<string, unknown>): boolean;
|
|
981
970
|
subscribeRealtime(subscriptions: string[]): boolean;
|
|
982
971
|
unsubscribeRealtime(subscriptions: string[]): boolean;
|
|
983
|
-
startHealthTick(intervalMs?: number
|
|
972
|
+
startHealthTick(intervalMs?: number): void;
|
|
984
973
|
stopHealthTick(): void;
|
|
985
974
|
scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
986
975
|
access_token: string;
|
|
@@ -1054,7 +1043,6 @@ declare const EntityAppServerApi_base: {
|
|
|
1054
1043
|
realtimeEventListeners: Map<string, Set<import("./types.js").RealtimeMessageListener>>;
|
|
1055
1044
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
1056
1045
|
setToken(token: string): void;
|
|
1057
|
-
setAccessTokenFromResponse(token: string): void;
|
|
1058
1046
|
setAnonymousPacketToken(token: string): void;
|
|
1059
1047
|
setApiKey(apiKey: string): void;
|
|
1060
1048
|
setHmacSecret(secret: string): void;
|
|
@@ -1071,7 +1059,7 @@ declare const EntityAppServerApi_base: {
|
|
|
1071
1059
|
sendRealtime(message: import("./types.js").RealtimeEnvelope | Record<string, unknown>): boolean;
|
|
1072
1060
|
subscribeRealtime(subscriptions: string[]): boolean;
|
|
1073
1061
|
unsubscribeRealtime(subscriptions: string[]): boolean;
|
|
1074
|
-
startHealthTick(intervalMs?: number
|
|
1062
|
+
startHealthTick(intervalMs?: number): void;
|
|
1075
1063
|
stopHealthTick(): void;
|
|
1076
1064
|
scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
1077
1065
|
access_token: string;
|
|
@@ -1143,7 +1131,6 @@ declare const EntityAppServerApi_base: {
|
|
|
1143
1131
|
realtimeEventListeners: Map<string, Set<import("./types.js").RealtimeMessageListener>>;
|
|
1144
1132
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
1145
1133
|
setToken(token: string): void;
|
|
1146
|
-
setAccessTokenFromResponse(token: string): void;
|
|
1147
1134
|
setAnonymousPacketToken(token: string): void;
|
|
1148
1135
|
setApiKey(apiKey: string): void;
|
|
1149
1136
|
setHmacSecret(secret: string): void;
|
|
@@ -1160,7 +1147,7 @@ declare const EntityAppServerApi_base: {
|
|
|
1160
1147
|
sendRealtime(message: import("./types.js").RealtimeEnvelope | Record<string, unknown>): boolean;
|
|
1161
1148
|
subscribeRealtime(subscriptions: string[]): boolean;
|
|
1162
1149
|
unsubscribeRealtime(subscriptions: string[]): boolean;
|
|
1163
|
-
startHealthTick(intervalMs?: number
|
|
1150
|
+
startHealthTick(intervalMs?: number): void;
|
|
1164
1151
|
stopHealthTick(): void;
|
|
1165
1152
|
scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
1166
1153
|
access_token: string;
|
|
@@ -1232,7 +1219,6 @@ declare const EntityAppServerApi_base: {
|
|
|
1232
1219
|
realtimeEventListeners: Map<string, Set<import("./types.js").RealtimeMessageListener>>;
|
|
1233
1220
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
1234
1221
|
setToken(token: string): void;
|
|
1235
|
-
setAccessTokenFromResponse(token: string): void;
|
|
1236
1222
|
setAnonymousPacketToken(token: string): void;
|
|
1237
1223
|
setApiKey(apiKey: string): void;
|
|
1238
1224
|
setHmacSecret(secret: string): void;
|
|
@@ -1249,7 +1235,7 @@ declare const EntityAppServerApi_base: {
|
|
|
1249
1235
|
sendRealtime(message: import("./types.js").RealtimeEnvelope | Record<string, unknown>): boolean;
|
|
1250
1236
|
subscribeRealtime(subscriptions: string[]): boolean;
|
|
1251
1237
|
unsubscribeRealtime(subscriptions: string[]): boolean;
|
|
1252
|
-
startHealthTick(intervalMs?: number
|
|
1238
|
+
startHealthTick(intervalMs?: number): void;
|
|
1253
1239
|
stopHealthTick(): void;
|
|
1254
1240
|
scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
1255
1241
|
access_token: string;
|
|
@@ -1349,7 +1335,6 @@ declare const EntityAppServerApi_base: {
|
|
|
1349
1335
|
realtimeEventListeners: Map<string, Set<import("./types.js").RealtimeMessageListener>>;
|
|
1350
1336
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
1351
1337
|
setToken(token: string): void;
|
|
1352
|
-
setAccessTokenFromResponse(token: string): void;
|
|
1353
1338
|
setAnonymousPacketToken(token: string): void;
|
|
1354
1339
|
setApiKey(apiKey: string): void;
|
|
1355
1340
|
setHmacSecret(secret: string): void;
|
|
@@ -1366,7 +1351,7 @@ declare const EntityAppServerApi_base: {
|
|
|
1366
1351
|
sendRealtime(message: import("./types.js").RealtimeEnvelope | Record<string, unknown>): boolean;
|
|
1367
1352
|
subscribeRealtime(subscriptions: string[]): boolean;
|
|
1368
1353
|
unsubscribeRealtime(subscriptions: string[]): boolean;
|
|
1369
|
-
startHealthTick(intervalMs?: number
|
|
1354
|
+
startHealthTick(intervalMs?: number): void;
|
|
1370
1355
|
stopHealthTick(): void;
|
|
1371
1356
|
scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
1372
1357
|
access_token: string;
|
|
@@ -1443,7 +1428,6 @@ declare const EntityAppServerApi_base: {
|
|
|
1443
1428
|
realtimeEventListeners: Map<string, Set<import("./types.js").RealtimeMessageListener>>;
|
|
1444
1429
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
1445
1430
|
setToken(token: string): void;
|
|
1446
|
-
setAccessTokenFromResponse(token: string): void;
|
|
1447
1431
|
setAnonymousPacketToken(token: string): void;
|
|
1448
1432
|
setApiKey(apiKey: string): void;
|
|
1449
1433
|
setHmacSecret(secret: string): void;
|
|
@@ -1460,7 +1444,7 @@ declare const EntityAppServerApi_base: {
|
|
|
1460
1444
|
sendRealtime(message: import("./types.js").RealtimeEnvelope | Record<string, unknown>): boolean;
|
|
1461
1445
|
subscribeRealtime(subscriptions: string[]): boolean;
|
|
1462
1446
|
unsubscribeRealtime(subscriptions: string[]): boolean;
|
|
1463
|
-
startHealthTick(intervalMs?: number
|
|
1447
|
+
startHealthTick(intervalMs?: number): void;
|
|
1464
1448
|
stopHealthTick(): void;
|
|
1465
1449
|
scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
1466
1450
|
access_token: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/EntityAppServerApi.ts"],
|
|
4
|
-
"sourcesContent": ["import { EntityServerApi } from \"./EntityServerApi.js\";\
|
|
4
|
+
"sourcesContent": ["import { EntityServerApi } from \"./EntityServerApi.js\";\nimport {\n AccountAppMixin,\n BoardMixin,\n EmailVerifyMixin,\n OAuthMixin,\n PasswordResetMixin,\n TwoFactorMixin,\n} from \"./mixins/app/index.js\";\nimport {\n AlimtalkMixin,\n AppPushMixin,\n FriendtalkMixin,\n HolidaysMixin,\n IdentityMixin,\n LlmMixin,\n OcrMixin,\n PgMixin,\n SmsMixin,\n TaxinvoiceMixin,\n} from \"./mixins/app/plugins/index.js\";\n\nexport class EntityAppServerApi extends AlimtalkMixin(\n FriendtalkMixin(\n SmsMixin(\n AppPushMixin(\n PgMixin(\n TaxinvoiceMixin(\n OcrMixin(\n LlmMixin(\n IdentityMixin(\n HolidaysMixin(\n OAuthMixin(\n TwoFactorMixin(\n PasswordResetMixin(\n EmailVerifyMixin(\n BoardMixin(\n AccountAppMixin(\n EntityServerApi,\n ),\n ),\n ),\n ),\n ),\n ),\n ),\n ),\n ),\n ),\n ),\n ),\n ),\n ),\n ),\n) {}\n"],
|
|
5
5
|
"mappings": "AAAA,OAAS,mBAAAA,MAAuB,uBAChC,OACI,mBAAAC,EACA,cAAAC,EACA,oBAAAC,EACA,cAAAC,EACA,sBAAAC,EACA,kBAAAC,MACG,wBACP,OACI,iBAAAC,EACA,gBAAAC,EACA,mBAAAC,EACA,iBAAAC,EACA,iBAAAC,EACA,YAAAC,EACA,YAAAC,EACA,WAAAC,EACA,YAAAC,EACA,mBAAAC,MACG,gCAEA,MAAMC,UAA2BV,EACpCE,EACIM,EACIP,EACIM,EACIE,EACIH,EACID,EACID,EACID,EACIN,EACIE,EACID,EACIF,EACID,EACID,EACID,CACJ,CACJ,CACJ,CACJ,CACJ,CACJ,CACJ,CACJ,CACJ,CACJ,CACJ,CACJ,CACJ,CACJ,CACJ,CACJ,CAAE,CAAC",
|
|
6
6
|
"names": ["EntityServerApi", "AccountAppMixin", "BoardMixin", "EmailVerifyMixin", "OAuthMixin", "PasswordResetMixin", "TwoFactorMixin", "AlimtalkMixin", "AppPushMixin", "FriendtalkMixin", "HolidaysMixin", "IdentityMixin", "LlmMixin", "OcrMixin", "PgMixin", "SmsMixin", "TaxinvoiceMixin", "EntityAppServerApi"]
|
|
7
7
|
}
|
|
@@ -71,7 +71,6 @@ declare const EntityServerApi_base: {
|
|
|
71
71
|
realtimeEventListeners: Map<string, Set<import("./types.js").RealtimeMessageListener>>;
|
|
72
72
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
73
73
|
setToken(token: string): void;
|
|
74
|
-
setAccessTokenFromResponse(token: string): void;
|
|
75
74
|
setAnonymousPacketToken(token: string): void;
|
|
76
75
|
setApiKey(apiKey: string): void;
|
|
77
76
|
setHmacSecret(secret: string): void;
|
|
@@ -88,7 +87,7 @@ declare const EntityServerApi_base: {
|
|
|
88
87
|
sendRealtime(message: import("./types.js").RealtimeEnvelope | Record<string, unknown>): boolean;
|
|
89
88
|
subscribeRealtime(subscriptions: string[]): boolean;
|
|
90
89
|
unsubscribeRealtime(subscriptions: string[]): boolean;
|
|
91
|
-
startHealthTick(intervalMs?: number
|
|
90
|
+
startHealthTick(intervalMs?: number): void;
|
|
92
91
|
stopHealthTick(): void;
|
|
93
92
|
scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
94
93
|
access_token: string;
|
|
@@ -158,7 +157,6 @@ declare const EntityServerApi_base: {
|
|
|
158
157
|
realtimeEventListeners: Map<string, Set<import("./types.js").RealtimeMessageListener>>;
|
|
159
158
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
160
159
|
setToken(token: string): void;
|
|
161
|
-
setAccessTokenFromResponse(token: string): void;
|
|
162
160
|
setAnonymousPacketToken(token: string): void;
|
|
163
161
|
setApiKey(apiKey: string): void;
|
|
164
162
|
setHmacSecret(secret: string): void;
|
|
@@ -175,7 +173,7 @@ declare const EntityServerApi_base: {
|
|
|
175
173
|
sendRealtime(message: import("./types.js").RealtimeEnvelope | Record<string, unknown>): boolean;
|
|
176
174
|
subscribeRealtime(subscriptions: string[]): boolean;
|
|
177
175
|
unsubscribeRealtime(subscriptions: string[]): boolean;
|
|
178
|
-
startHealthTick(intervalMs?: number
|
|
176
|
+
startHealthTick(intervalMs?: number): void;
|
|
179
177
|
stopHealthTick(): void;
|
|
180
178
|
scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
181
179
|
access_token: string;
|
|
@@ -307,7 +305,6 @@ declare const EntityServerApi_base: {
|
|
|
307
305
|
realtimeEventListeners: Map<string, Set<import("./types.js").RealtimeMessageListener>>;
|
|
308
306
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
309
307
|
setToken(token: string): void;
|
|
310
|
-
setAccessTokenFromResponse(token: string): void;
|
|
311
308
|
setAnonymousPacketToken(token: string): void;
|
|
312
309
|
setApiKey(apiKey: string): void;
|
|
313
310
|
setHmacSecret(secret: string): void;
|
|
@@ -324,7 +321,7 @@ declare const EntityServerApi_base: {
|
|
|
324
321
|
sendRealtime(message: import("./types.js").RealtimeEnvelope | Record<string, unknown>): boolean;
|
|
325
322
|
subscribeRealtime(subscriptions: string[]): boolean;
|
|
326
323
|
unsubscribeRealtime(subscriptions: string[]): boolean;
|
|
327
|
-
startHealthTick(intervalMs?: number
|
|
324
|
+
startHealthTick(intervalMs?: number): void;
|
|
328
325
|
stopHealthTick(): void;
|
|
329
326
|
scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
330
327
|
access_token: string;
|
|
@@ -400,7 +397,6 @@ declare const EntityServerApi_base: {
|
|
|
400
397
|
realtimeEventListeners: Map<string, Set<import("./types.js").RealtimeMessageListener>>;
|
|
401
398
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
402
399
|
setToken(token: string): void;
|
|
403
|
-
setAccessTokenFromResponse(token: string): void;
|
|
404
400
|
setAnonymousPacketToken(token: string): void;
|
|
405
401
|
setApiKey(apiKey: string): void;
|
|
406
402
|
setHmacSecret(secret: string): void;
|
|
@@ -417,7 +413,7 @@ declare const EntityServerApi_base: {
|
|
|
417
413
|
sendRealtime(message: import("./types.js").RealtimeEnvelope | Record<string, unknown>): boolean;
|
|
418
414
|
subscribeRealtime(subscriptions: string[]): boolean;
|
|
419
415
|
unsubscribeRealtime(subscriptions: string[]): boolean;
|
|
420
|
-
startHealthTick(intervalMs?: number
|
|
416
|
+
startHealthTick(intervalMs?: number): void;
|
|
421
417
|
stopHealthTick(): void;
|
|
422
418
|
scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
423
419
|
access_token: string;
|
|
@@ -511,7 +507,6 @@ declare const EntityServerApi_base: {
|
|
|
511
507
|
realtimeEventListeners: Map<string, Set<import("./types.js").RealtimeMessageListener>>;
|
|
512
508
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
513
509
|
setToken(token: string): void;
|
|
514
|
-
setAccessTokenFromResponse(token: string): void;
|
|
515
510
|
setAnonymousPacketToken(token: string): void;
|
|
516
511
|
setApiKey(apiKey: string): void;
|
|
517
512
|
setHmacSecret(secret: string): void;
|
|
@@ -528,7 +523,7 @@ declare const EntityServerApi_base: {
|
|
|
528
523
|
sendRealtime(message: import("./types.js").RealtimeEnvelope | Record<string, unknown>): boolean;
|
|
529
524
|
subscribeRealtime(subscriptions: string[]): boolean;
|
|
530
525
|
unsubscribeRealtime(subscriptions: string[]): boolean;
|
|
531
|
-
startHealthTick(intervalMs?: number
|
|
526
|
+
startHealthTick(intervalMs?: number): void;
|
|
532
527
|
stopHealthTick(): void;
|
|
533
528
|
scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
534
529
|
access_token: string;
|
|
@@ -657,7 +652,6 @@ declare const EntityServerApi_base: {
|
|
|
657
652
|
realtimeEventListeners: Map<string, Set<import("./types.js").RealtimeMessageListener>>;
|
|
658
653
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
659
654
|
setToken(token: string): void;
|
|
660
|
-
setAccessTokenFromResponse(token: string): void;
|
|
661
655
|
setAnonymousPacketToken(token: string): void;
|
|
662
656
|
setApiKey(apiKey: string): void;
|
|
663
657
|
setHmacSecret(secret: string): void;
|
|
@@ -674,7 +668,7 @@ declare const EntityServerApi_base: {
|
|
|
674
668
|
sendRealtime(message: import("./types.js").RealtimeEnvelope | Record<string, unknown>): boolean;
|
|
675
669
|
subscribeRealtime(subscriptions: string[]): boolean;
|
|
676
670
|
unsubscribeRealtime(subscriptions: string[]): boolean;
|
|
677
|
-
startHealthTick(intervalMs?: number
|
|
671
|
+
startHealthTick(intervalMs?: number): void;
|
|
678
672
|
stopHealthTick(): void;
|
|
679
673
|
scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
680
674
|
access_token: string;
|
|
@@ -807,7 +801,6 @@ declare const EntityServerApi_base: {
|
|
|
807
801
|
realtimeEventListeners: Map<string, Set<import("./types.js").RealtimeMessageListener>>;
|
|
808
802
|
configure(options: Partial<import("./types.js").EntityServerClientOptions>): void;
|
|
809
803
|
setToken(token: string): void;
|
|
810
|
-
setAccessTokenFromResponse(token: string): void;
|
|
811
804
|
setAnonymousPacketToken(token: string): void;
|
|
812
805
|
setApiKey(apiKey: string): void;
|
|
813
806
|
setHmacSecret(secret: string): void;
|
|
@@ -824,7 +817,7 @@ declare const EntityServerApi_base: {
|
|
|
824
817
|
sendRealtime(message: import("./types.js").RealtimeEnvelope | Record<string, unknown>): boolean;
|
|
825
818
|
subscribeRealtime(subscriptions: string[]): boolean;
|
|
826
819
|
unsubscribeRealtime(subscriptions: string[]): boolean;
|
|
827
|
-
startHealthTick(intervalMs?: number
|
|
820
|
+
startHealthTick(intervalMs?: number): void;
|
|
828
821
|
stopHealthTick(): void;
|
|
829
822
|
scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
830
823
|
access_token: string;
|
|
@@ -859,7 +852,6 @@ declare const EntityServerApi_base: {
|
|
|
859
852
|
authBootstrapPromise: Promise<void> | null;
|
|
860
853
|
authBootstrapToken: string;
|
|
861
854
|
authBootstrapAnonymousCompleted: boolean;
|
|
862
|
-
setAccessTokenFromResponse(token: string): void;
|
|
863
855
|
csrfRefresher: () => Promise<void>;
|
|
864
856
|
checkHealth(bootstrapAuth?: boolean): Promise<{
|
|
865
857
|
status: string;
|
|
@@ -941,7 +933,7 @@ declare const EntityServerApi_base: {
|
|
|
941
933
|
sendRealtime(message: import("./types.js").RealtimeEnvelope | Record<string, unknown>): boolean;
|
|
942
934
|
subscribeRealtime(subscriptions: string[]): boolean;
|
|
943
935
|
unsubscribeRealtime(subscriptions: string[]): boolean;
|
|
944
|
-
startHealthTick(intervalMs?: number
|
|
936
|
+
startHealthTick(intervalMs?: number): void;
|
|
945
937
|
stopHealthTick(): void;
|
|
946
938
|
scheduleKeepSession(refreshToken: string, expiresIn: number, refreshFn: (rt: string) => Promise<{
|
|
947
939
|
access_token: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/EntityServerApi.ts"],
|
|
4
|
-
"sourcesContent": ["/**\
|
|
4
|
+
"sourcesContent": ["/**\n * @file EntityServerApi.ts\n * entity-server core route\uC6A9 Mixin \uC870\uD569 \uD074\uB77C\uC774\uC5B8\uD2B8.\n *\n * \uC808(section)\uBCC4 \uAD6C\uD604:\n * src/client/base.ts \u2014 \uC0C1\uD0DC\u00B7\uC0DD\uC131\uC790\u00B7\uACF5\uD1B5 \uD5EC\uD37C\n * src/mixins/server/* \u2014 entity-server core route mixin\n * src/mixins/app/* \u2014 entity-app-server plugin mixin\n */\nimport { EntityServerClientBase } from \"./client/base.js\";\nimport {\n AdminMixin,\n AuthMixin,\n EntityMixin,\n FileMixin,\n PushMixin,\n SmtpMixin,\n TransactionMixin,\n UtilsMixin,\n} from \"./mixins/server/index.js\";\n\n// \u2500\u2500\u2500 Composed class \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport class EntityServerApi extends UtilsMixin(\n TransactionMixin(\n FileMixin(\n SmtpMixin(\n PushMixin(\n AdminMixin(EntityMixin(AuthMixin(EntityServerClientBase))),\n ),\n ),\n ),\n ),\n) {}\n"],
|
|
5
5
|
"mappings": "AASA,OAAS,0BAAAA,MAA8B,mBACvC,OACI,cAAAC,EACA,aAAAC,EACA,eAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,EACA,oBAAAC,EACA,cAAAC,MACG,2BAIA,MAAMC,UAAwBD,EACjCD,EACIH,EACIE,EACID,EACIJ,EAAWE,EAAYD,EAAUF,CAAsB,CAAC,CAAC,CAC7D,CACJ,CACJ,CACJ,CACJ,CAAE,CAAC",
|
|
6
6
|
"names": ["EntityServerClientBase", "AdminMixin", "AuthMixin", "EntityMixin", "FileMixin", "PushMixin", "SmtpMixin", "TransactionMixin", "UtilsMixin", "EntityServerApi"]
|
|
7
7
|
}
|
package/dist/client/base.d.ts
CHANGED
|
@@ -47,8 +47,6 @@ export declare class EntityServerClientBase {
|
|
|
47
47
|
configure(options: Partial<EntityServerClientOptions>): void;
|
|
48
48
|
/** 인증 요청에 사용할 JWT Access Token을 설정합니다. */
|
|
49
49
|
setToken(token: string): void;
|
|
50
|
-
/** 응답 헤더로 받은 access token 갱신을 반영한다. */
|
|
51
|
-
setAccessTokenFromResponse(token: string): void;
|
|
52
50
|
/** 익명 패킷 암호화용 토큰을 설정합니다. */
|
|
53
51
|
setAnonymousPacketToken(token: string): void;
|
|
54
52
|
/** HMAC 인증용 API Key를 설정합니다. */
|
|
@@ -75,9 +73,8 @@ export declare class EntityServerClientBase {
|
|
|
75
73
|
* keepSession=true 이면 각 tick에서 세션 부트스트랩도 함께 시도합니다.
|
|
76
74
|
*
|
|
77
75
|
* @param intervalMs 호출 주기(ms). 기본값: 5분
|
|
78
|
-
* @param runImmediately true면 시작 직후 첫 tick을 즉시 실행합니다.
|
|
79
76
|
*/
|
|
80
|
-
startHealthTick(intervalMs?: number
|
|
77
|
+
startHealthTick(intervalMs?: number): void;
|
|
81
78
|
/** health tick 타이머를 중지합니다. */
|
|
82
79
|
stopHealthTick(): void;
|
|
83
80
|
/** @deprecated 세션 연장은 health tick 기반 부트스트랩으로 대체되었습니다. */
|
package/dist/client/base.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{readEnv as m}from"./utils.js";import{derivePacketKey as u,parseRequestBody as f}from"./packet.js";import{entityRequest as l}from"./request.js";const c="/v1/realtime";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;realtimeEnabled;realtimePath;realtimeAutoConnect;realtimeAutoReconnect;realtimeReconnectDelayMs;realtimeStatus;realtimeSocket=null;realtimeConnectPromise=null;realtimeReconnectTimer=null;realtimeShouldReconnect=!1;realtimeMessageListeners=new Set;realtimeStatusListeners=new Set;realtimeEventListeners=new Map;constructor(e={}){const t=m("VITE_ENTITY_SERVER_URL");this.baseUrl=(e.baseUrl??t??"").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,this.realtimeEnabled=!1,this.realtimePath=c,this.realtimeAutoConnect=!0,this.realtimeAutoReconnect=!0,this.realtimeReconnectDelayMs=3e3,this.realtimeStatus="idle",this.applyRealtimeOptions(e.realtime),typeof e.healthTickInterval=="number"&&e.healthTickInterval>0&&Promise.resolve().then(()=>this.startHealthTick(e.healthTickInterval,!1))}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.realtime<"u"&&this.applyRealtimeOptions(e.realtime),typeof e.healthTickInterval=="number"&&e.healthTickInterval>0&&Promise.resolve().then(()=>this.startHealthTick(e.healthTickInterval,!1))}setToken(e){if(this.token=e,!e){this.disconnectRealtime("token_cleared");return}this.realtimeEnabled&&this.realtimeAutoConnect&&this.connectRealtime().catch(()=>{})}setAccessTokenFromResponse(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}addRealtimeListener(e){this.realtimeMessageListeners.add(e)}removeRealtimeListener(e){this.realtimeMessageListeners.delete(e)}addRealtimeStatusListener(e){this.realtimeStatusListeners.add(e)}removeRealtimeStatusListener(e){this.realtimeStatusListeners.delete(e)}addRealtimeEventListener(e,t){const s=String(e).trim();s&&(this.realtimeEventListeners.has(s)||this.realtimeEventListeners.set(s,new Set),this.realtimeEventListeners.get(s).add(t))}removeRealtimeEventListener(e,t){const s=String(e).trim();if(!s)return;const i=this.realtimeEventListeners.get(s);i&&(i.delete(t),i.size===0&&this.realtimeEventListeners.delete(s))}async connectRealtime(){if(!this.realtimeEnabled){this.setRealtimeStatus("disabled","realtime_disabled");return}if(!this.token)throw new Error("Cannot open realtime connection without access token.");if(typeof WebSocket>"u")throw new Error("WebSocket is not available in this environment.");if(this.realtimeSocket&&this.realtimeSocket.readyState===WebSocket.OPEN)return;if(this.realtimeSocket&&this.realtimeSocket.readyState===WebSocket.CONNECTING&&this.realtimeConnectPromise)return this.realtimeConnectPromise;this.clearRealtimeReconnectTimer(),this.realtimeShouldReconnect=this.realtimeAutoReconnect,this.setRealtimeStatus("connecting","connect_requested");const e=new WebSocket(this.buildRealtimeUrl());return this.realtimeSocket=e,this.realtimeConnectPromise=new Promise((t,s)=>{let i=!1;const r=()=>{i||(i=!0,this.realtimeConnectPromise=null,t())},n=a=>{i||(i=!0,this.realtimeConnectPromise=null,s(a))};e.addEventListener("open",()=>{this.setRealtimeStatus("open","socket_open"),r()}),e.addEventListener("message",a=>{this.handleRealtimeMessage(a.data)}),e.addEventListener("error",()=>{this.setRealtimeStatus("closed","socket_error",new Error("Realtime socket error."))}),e.addEventListener("close",a=>{this.realtimeSocket===e&&(this.realtimeSocket=null);const o=a.reason||"socket_closed",h=new Error(`Realtime socket closed (${a.code}${a.reason?`: ${a.reason}`:""}).`);this.setRealtimeStatus("closed",o,h),i||n(h),this.realtimeShouldReconnect&&this.realtimeEnabled&&this.realtimeAutoReconnect&&this.token&&this.scheduleRealtimeReconnect(o)})}),this.realtimeConnectPromise}disconnectRealtime(e="client_disconnect"){if(this.realtimeShouldReconnect=!1,this.clearRealtimeReconnectTimer(),this.realtimeSocket){const t=this.realtimeSocket;this.realtimeSocket=null;try{(t.readyState===WebSocket.OPEN||t.readyState===WebSocket.CONNECTING)&&t.close(1e3,e)}catch{}}this.realtimeConnectPromise=null,this.setRealtimeStatus(this.realtimeEnabled?"idle":"disabled",e)}sendRealtime(e){return!this.realtimeSocket||this.realtimeSocket.readyState!==WebSocket.OPEN?!1:(this.realtimeSocket.send(JSON.stringify(e)),!0)}subscribeRealtime(e){return this.sendRealtime({type:"subscribe",channel:"session",event:"session.subscribe",data:{subscriptions:e}})}unsubscribeRealtime(e){return this.sendRealtime({type:"unsubscribe",channel:"session",event:"session.unsubscribe",data:{subscriptions:e}})}startHealthTick(e=300*1e3,t=!0){this.stopHealthTick();const s=()=>{this.healthTickPromise||(this.healthTickPromise=(this.csrfRefresher?this.csrfRefresher():Promise.resolve()).then(()=>{this.onHealthChange?.(!0)}).catch(()=>{this.onHealthChange?.(!1)}).finally(()=>{this.healthTickPromise=null}))};t&&s(),this.healthTickTimer=setInterval(s,e)}stopHealthTick(){this.healthTickTimer!==null&&(clearInterval(this.healthTickTimer),this.healthTickTimer=null),this.healthTickPromise=null}scheduleKeepSession(e,t,s){this.clearRefreshTimer(),this.sessionRefreshToken=e;const i=Math.max((t-this.refreshBuffer)*1e3,0);this.refreshTimer=setTimeout(async()=>{if(this.sessionRefreshToken)try{const r=await s(this.sessionRefreshToken);this.onTokenRefreshed?.(r.access_token,r.expires_in),this.scheduleKeepSession(this.sessionRefreshToken,r.expires_in,s)}catch(r){this.clearRefreshTimer(),this.onSessionExpired?.(r instanceof Error?r:new Error(String(r)))}},i)}clearRefreshTimer(){this.refreshTimer!==null&&(clearTimeout(this.refreshTimer),this.refreshTimer=null)}stopKeepSession(){this.clearRefreshTimer(),this.sessionRefreshToken=null}applyRealtimeOptions(e){const t=typeof e=="boolean"?{enabled:e}:e??{};if(this.realtimeEnabled=t.enabled??!1,this.realtimePath=String(t.path??c).trim()||c,this.realtimeAutoConnect=t.autoConnect??!0,this.realtimeAutoReconnect=t.autoReconnect??!0,this.realtimeReconnectDelayMs=Math.max(250,t.reconnectDelayMs??3e3),!this.realtimeEnabled){this.disconnectRealtime("realtime_disabled");return}this.setRealtimeStatus("idle","realtime_enabled"),this.token&&this.realtimeAutoConnect&&this.connectRealtime().catch(()=>{})}buildRealtimeUrl(){const t=this.baseUrl||m("VITE_ENTITY_SERVER_URL")||""||(typeof window<"u"?window.location.origin:"");if(!t)throw new Error("Realtime connection requires baseUrl.");const s=new URL(this.realtimePath,t);return s.protocol=s.protocol==="https:"?"wss:":"ws:",s.searchParams.set("access_token",this.token),s.toString()}handleRealtimeMessage(e){if(typeof e!="string")return;let t;try{t=JSON.parse(e)}catch{return}for(const i of this.realtimeMessageListeners)i(t);const s=this.realtimeEventListeners.get(t.event);if(s)for(const i of s)i(t)}scheduleRealtimeReconnect(e){this.clearRealtimeReconnectTimer(),this.realtimeReconnectTimer=setTimeout(()=>{this.realtimeReconnectTimer=null,!(!this.realtimeEnabled||!this.token)&&(this.setRealtimeStatus("connecting",`${e}:reconnect`),this.connectRealtime().catch(()=>{}))},this.realtimeReconnectDelayMs)}clearRealtimeReconnectTimer(){this.realtimeReconnectTimer!==null&&(clearTimeout(this.realtimeReconnectTimer),this.realtimeReconnectTimer=null)}setRealtimeStatus(e,t,s){const i=this.realtimeStatus;if(!(i===e&&typeof t>"u"&&typeof s>"u")){this.realtimeStatus=e;for(const r of this.realtimeStatusListeners)r({status:e,previousStatus:i,...t?{reason:t}:{},...s?{error:s}:{}})}}applyCsrfHealth(){if(!(typeof document>"u")){for(const e of document.cookie.split(";")){const t=e.indexOf("=");if(!(t<0)&&e.substring(0,t).trim()===this.csrfCookieName){this.csrfEnabled=!!e.substring(t+1).trim();return}}this.csrfEnabled=!1}}readRequestBody(e,t="application/json",s=!1){const i=u(this.hmacSecret,this.token||this.anonymousPacketToken);return f(e,t,s,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,onAccessToken:e=>{this.setAccessTokenFromResponse(e)}}}prepareRequest(e){return Promise.resolve()}get http(){const e=this;return{get(t,s=!0,i,r){return e.prepareRequest(s).then(()=>l(e.reqOpts,"GET",t,void 0,s,i,r??!0))},post(t,s,i=!0,r,n){return e.prepareRequest(i).then(()=>l(e.reqOpts,"POST",t,s,i,r,n??!0))},put(t,s,i=!0,r,n){return e.prepareRequest(i).then(()=>l(e.reqOpts,"PUT",t,s,i,r,n??!0))},patch(t,s,i=!0,r,n){return e.prepareRequest(i).then(()=>l(e.reqOpts,"PATCH",t,s,i,r,n??!0))},delete(t,s,i=!0,r,n){return e.prepareRequest(i).then(()=>l(e.reqOpts,"DELETE",t,s,i,r,n??!0))}}}request(e,t,s,i=!0,r,n){return this.prepareRequest(i).then(()=>l(this.reqOpts,e,t,s,i,r,n??!0))}async requestBinary(e,t,s,i=!0){await this.prepareRequest(i);const r={"Content-Type":"application/json"};i&&this.token&&(r.Authorization=`Bearer ${this.token}`),this.apiKey&&(r["X-API-Key"]=this.apiKey);const n=await fetch(this.baseUrl+t,{method:e,headers:r,...s!=null?{body:JSON.stringify(s)}:{},credentials:"include"});if(!n.ok){const a=await n.text(),o=new Error(`HTTP ${n.status}: ${a}`);throw o.status=n.status,o}return n.arrayBuffer()}async requestForm(e,t,s,i=!0){const r={};i&&this.token&&(r.Authorization=`Bearer ${this.token}`),this.apiKey&&(r["X-API-Key"]=this.apiKey);const n=await fetch(this.baseUrl+t,{method:e,headers:r,body:s,credentials:"include"}),a=await n.json();if(!a.ok){const o=new Error(a.message??`EntityServer error (HTTP ${n.status})`);throw o.status=n.status,o}return a}async requestFormBinary(e,t,s,i=!0){const r={};i&&this.token&&(r.Authorization=`Bearer ${this.token}`),this.apiKey&&(r["X-API-Key"]=this.apiKey);const n=await fetch(this.baseUrl+t,{method:e,headers:r,body:s,credentials:"include"});if(!n.ok){const a=await n.text(),o=new Error(`HTTP ${n.status}: ${a}`);throw o.status=n.status,o}return n.arrayBuffer()}}export{y as EntityServerClientBase};
|
|
1
|
+
import{readEnv as m}from"./utils.js";import{derivePacketKey as u,parseRequestBody as f}from"./packet.js";import{entityRequest as l}from"./request.js";const c="/v1/realtime";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;realtimeEnabled;realtimePath;realtimeAutoConnect;realtimeAutoReconnect;realtimeReconnectDelayMs;realtimeStatus;realtimeSocket=null;realtimeConnectPromise=null;realtimeReconnectTimer=null;realtimeShouldReconnect=!1;realtimeMessageListeners=new Set;realtimeStatusListeners=new Set;realtimeEventListeners=new Map;constructor(e={}){const t=m("VITE_ENTITY_SERVER_URL");this.baseUrl=(e.baseUrl??t??"").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,this.realtimeEnabled=!1,this.realtimePath=c,this.realtimeAutoConnect=!0,this.realtimeAutoReconnect=!0,this.realtimeReconnectDelayMs=3e3,this.realtimeStatus="idle",this.applyRealtimeOptions(e.realtime),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.realtime<"u"&&this.applyRealtimeOptions(e.realtime),typeof e.healthTickInterval=="number"&&e.healthTickInterval>0&&Promise.resolve().then(()=>this.startHealthTick(e.healthTickInterval))}setToken(e){if(this.token=e,!e){this.disconnectRealtime("token_cleared");return}this.realtimeEnabled&&this.realtimeAutoConnect&&this.connectRealtime().catch(()=>{})}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}addRealtimeListener(e){this.realtimeMessageListeners.add(e)}removeRealtimeListener(e){this.realtimeMessageListeners.delete(e)}addRealtimeStatusListener(e){this.realtimeStatusListeners.add(e)}removeRealtimeStatusListener(e){this.realtimeStatusListeners.delete(e)}addRealtimeEventListener(e,t){const i=String(e).trim();i&&(this.realtimeEventListeners.has(i)||this.realtimeEventListeners.set(i,new Set),this.realtimeEventListeners.get(i).add(t))}removeRealtimeEventListener(e,t){const i=String(e).trim();if(!i)return;const s=this.realtimeEventListeners.get(i);s&&(s.delete(t),s.size===0&&this.realtimeEventListeners.delete(i))}async connectRealtime(){if(!this.realtimeEnabled){this.setRealtimeStatus("disabled","realtime_disabled");return}if(!this.token)throw new Error("Cannot open realtime connection without access token.");if(typeof WebSocket>"u")throw new Error("WebSocket is not available in this environment.");if(this.realtimeSocket&&this.realtimeSocket.readyState===WebSocket.OPEN)return;if(this.realtimeSocket&&this.realtimeSocket.readyState===WebSocket.CONNECTING&&this.realtimeConnectPromise)return this.realtimeConnectPromise;this.clearRealtimeReconnectTimer(),this.realtimeShouldReconnect=this.realtimeAutoReconnect,this.setRealtimeStatus("connecting","connect_requested");const e=new WebSocket(this.buildRealtimeUrl());return this.realtimeSocket=e,this.realtimeConnectPromise=new Promise((t,i)=>{let s=!1;const r=()=>{s||(s=!0,this.realtimeConnectPromise=null,t())},n=a=>{s||(s=!0,this.realtimeConnectPromise=null,i(a))};e.addEventListener("open",()=>{this.setRealtimeStatus("open","socket_open"),r()}),e.addEventListener("message",a=>{this.handleRealtimeMessage(a.data)}),e.addEventListener("error",()=>{this.setRealtimeStatus("closed","socket_error",new Error("Realtime socket error."))}),e.addEventListener("close",a=>{this.realtimeSocket===e&&(this.realtimeSocket=null);const o=a.reason||"socket_closed",h=new Error(`Realtime socket closed (${a.code}${a.reason?`: ${a.reason}`:""}).`);this.setRealtimeStatus("closed",o,h),s||n(h),this.realtimeShouldReconnect&&this.realtimeEnabled&&this.realtimeAutoReconnect&&this.token&&this.scheduleRealtimeReconnect(o)})}),this.realtimeConnectPromise}disconnectRealtime(e="client_disconnect"){if(this.realtimeShouldReconnect=!1,this.clearRealtimeReconnectTimer(),this.realtimeSocket){const t=this.realtimeSocket;this.realtimeSocket=null;try{(t.readyState===WebSocket.OPEN||t.readyState===WebSocket.CONNECTING)&&t.close(1e3,e)}catch{}}this.realtimeConnectPromise=null,this.setRealtimeStatus(this.realtimeEnabled?"idle":"disabled",e)}sendRealtime(e){return!this.realtimeSocket||this.realtimeSocket.readyState!==WebSocket.OPEN?!1:(this.realtimeSocket.send(JSON.stringify(e)),!0)}subscribeRealtime(e){return this.sendRealtime({type:"subscribe",channel:"session",event:"session.subscribe",data:{subscriptions:e}})}unsubscribeRealtime(e){return this.sendRealtime({type:"unsubscribe",channel:"session",event:"session.unsubscribe",data:{subscriptions:e}})}startHealthTick(e=300*1e3){this.stopHealthTick();const t=()=>{this.healthTickPromise||(this.healthTickPromise=(this.csrfRefresher?this.csrfRefresher():Promise.resolve()).then(()=>{this.onHealthChange?.(!0)}).catch(()=>{this.onHealthChange?.(!1)}).finally(()=>{this.healthTickPromise=null}))};t(),this.healthTickTimer=setInterval(t,e)}stopHealthTick(){this.healthTickTimer!==null&&(clearInterval(this.healthTickTimer),this.healthTickTimer=null),this.healthTickPromise=null}scheduleKeepSession(e,t,i){this.clearRefreshTimer(),this.sessionRefreshToken=e;const s=Math.max((t-this.refreshBuffer)*1e3,0);this.refreshTimer=setTimeout(async()=>{if(this.sessionRefreshToken)try{const r=await i(this.sessionRefreshToken);this.onTokenRefreshed?.(r.access_token,r.expires_in),this.scheduleKeepSession(this.sessionRefreshToken,r.expires_in,i)}catch(r){this.clearRefreshTimer(),this.onSessionExpired?.(r instanceof Error?r:new Error(String(r)))}},s)}clearRefreshTimer(){this.refreshTimer!==null&&(clearTimeout(this.refreshTimer),this.refreshTimer=null)}stopKeepSession(){this.clearRefreshTimer(),this.sessionRefreshToken=null}applyRealtimeOptions(e){const t=typeof e=="boolean"?{enabled:e}:e??{};if(this.realtimeEnabled=t.enabled??!1,this.realtimePath=String(t.path??c).trim()||c,this.realtimeAutoConnect=t.autoConnect??!0,this.realtimeAutoReconnect=t.autoReconnect??!0,this.realtimeReconnectDelayMs=Math.max(250,t.reconnectDelayMs??3e3),!this.realtimeEnabled){this.disconnectRealtime("realtime_disabled");return}this.setRealtimeStatus("idle","realtime_enabled"),this.token&&this.realtimeAutoConnect&&this.connectRealtime().catch(()=>{})}buildRealtimeUrl(){const e=this.baseUrl||m("VITE_ENTITY_SERVER_URL")||"",t=typeof window<"u"?window.location.origin:"",i=e||t;if(!i)throw new Error("Realtime connection requires baseUrl.");const s=new URL(i,t||void 0),r=s.pathname==="/"?"":s.pathname.replace(/\/+$/,""),n=`/${this.realtimePath.replace(/^\/+/,"")}`;return s.pathname=`${r}${n}`||n,s.search="",s.hash="",s.protocol=s.protocol==="https:"?"wss:":"ws:",s.searchParams.set("access_token",this.token),s.toString()}handleRealtimeMessage(e){if(typeof e!="string")return;let t;try{t=JSON.parse(e)}catch{return}for(const s of this.realtimeMessageListeners)s(t);const i=this.realtimeEventListeners.get(t.event);if(i)for(const s of i)s(t)}scheduleRealtimeReconnect(e){this.clearRealtimeReconnectTimer(),this.realtimeReconnectTimer=setTimeout(()=>{this.realtimeReconnectTimer=null,!(!this.realtimeEnabled||!this.token)&&(this.setRealtimeStatus("connecting",`${e}:reconnect`),this.connectRealtime().catch(()=>{}))},this.realtimeReconnectDelayMs)}clearRealtimeReconnectTimer(){this.realtimeReconnectTimer!==null&&(clearTimeout(this.realtimeReconnectTimer),this.realtimeReconnectTimer=null)}setRealtimeStatus(e,t,i){const s=this.realtimeStatus;if(!(s===e&&typeof t>"u"&&typeof i>"u")){this.realtimeStatus=e;for(const r of this.realtimeStatusListeners)r({status:e,previousStatus:s,...t?{reason:t}:{},...i?{error:i}:{}})}}applyCsrfHealth(){if(!(typeof document>"u")){for(const e of document.cookie.split(";")){const t=e.indexOf("=");if(!(t<0)&&e.substring(0,t).trim()===this.csrfCookieName){this.csrfEnabled=!!e.substring(t+1).trim();return}}this.csrfEnabled=!1}}readRequestBody(e,t="application/json",i=!1){const s=u(this.hmacSecret,this.token||this.anonymousPacketToken);return f(e,t,i,s)}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,onAccessToken:e=>{this.token=e}}}prepareRequest(e){return Promise.resolve()}get http(){const e=this;return{get(t,i=!0,s,r){return e.prepareRequest(i).then(()=>l(e.reqOpts,"GET",t,void 0,i,s,r??!0))},post(t,i,s=!0,r,n){return e.prepareRequest(s).then(()=>l(e.reqOpts,"POST",t,i,s,r,n??!0))},put(t,i,s=!0,r,n){return e.prepareRequest(s).then(()=>l(e.reqOpts,"PUT",t,i,s,r,n??!0))},patch(t,i,s=!0,r,n){return e.prepareRequest(s).then(()=>l(e.reqOpts,"PATCH",t,i,s,r,n??!0))},delete(t,i,s=!0,r,n){return e.prepareRequest(s).then(()=>l(e.reqOpts,"DELETE",t,i,s,r,n??!0))}}}request(e,t,i,s=!0,r,n){return this.prepareRequest(s).then(()=>l(this.reqOpts,e,t,i,s,r,n??!0))}async requestBinary(e,t,i,s=!0){await this.prepareRequest(s);const r={"Content-Type":"application/json"};s&&this.token&&(r.Authorization=`Bearer ${this.token}`),this.apiKey&&(r["X-API-Key"]=this.apiKey);const n=await fetch(this.baseUrl+t,{method:e,headers:r,...i!=null?{body:JSON.stringify(i)}:{},credentials:"include"});if(!n.ok){const a=await n.text(),o=new Error(`HTTP ${n.status}: ${a}`);throw o.status=n.status,o}return n.arrayBuffer()}async requestForm(e,t,i,s=!0){const r={};s&&this.token&&(r.Authorization=`Bearer ${this.token}`),this.apiKey&&(r["X-API-Key"]=this.apiKey);const n=await fetch(this.baseUrl+t,{method:e,headers:r,body:i,credentials:"include"}),a=await n.json();if(!a.ok){const o=new Error(a.message??`EntityServer error (HTTP ${n.status})`);throw o.status=n.status,o}return a}async requestFormBinary(e,t,i,s=!0){const r={};s&&this.token&&(r.Authorization=`Bearer ${this.token}`),this.apiKey&&(r["X-API-Key"]=this.apiKey);const n=await fetch(this.baseUrl+t,{method:e,headers:r,body:i,credentials:"include"});if(!n.ok){const a=await n.text(),o=new Error(`HTTP ${n.status}: ${a}`);throw o.status=n.status,o}return n.arrayBuffer()}}export{y as EntityServerClientBase};
|
|
2
2
|
//# sourceMappingURL=base.js.map
|