@appwrite.io/console 10.0.0 → 11.0.0

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.
@@ -1,7 +1,24 @@
1
1
  import { Client } from '../client';
2
2
  import { Channel, ActionableChannel, ResolvedChannel } from '../channel';
3
3
  import { Query } from '../query';
4
+ export type RealtimeSubscriptionUpdate = {
5
+ channels?: (string | Channel<any> | ActionableChannel | ResolvedChannel)[];
6
+ queries?: (string | Query)[];
7
+ };
4
8
  export type RealtimeSubscription = {
9
+ /**
10
+ * Remove this subscription only. Keeps the WebSocket open so other subscriptions keep receiving events.
11
+ * Use `Realtime.disconnect()` to close the connection entirely.
12
+ */
13
+ unsubscribe: () => Promise<void>;
14
+ /**
15
+ * Replace the channels and/or queries for this subscription on the server without re-creating it.
16
+ */
17
+ update: (changes: RealtimeSubscriptionUpdate) => Promise<void>;
18
+ /**
19
+ * Alias of `unsubscribe()` plus legacy auto-disconnect when this was the last active subscription.
20
+ * Prefer `unsubscribe()` for per-subscription teardown and `Realtime.disconnect()` for full shutdown.
21
+ */
5
22
  close: () => Promise<void>;
6
23
  };
7
24
  export type RealtimeCallback<T = any> = {
@@ -23,15 +40,10 @@ export type RealtimeResponseEvent<T = any> = {
23
40
  export type RealtimeResponseConnected = {
24
41
  channels: string[];
25
42
  user?: object;
26
- subscriptions?: {
27
- [slot: string]: string;
28
- };
29
43
  };
30
44
  export type RealtimeRequest = {
31
- type: 'authentication';
32
- data: {
33
- session: string;
34
- };
45
+ type: 'authentication' | 'subscribe' | 'unsubscribe';
46
+ data: any;
35
47
  };
36
48
  export declare enum RealtimeCode {
37
49
  NORMAL_CLOSURE = 1000,
@@ -43,17 +55,16 @@ export declare class Realtime {
43
55
  private readonly TYPE_EVENT;
44
56
  private readonly TYPE_PONG;
45
57
  private readonly TYPE_CONNECTED;
58
+ private readonly TYPE_RESPONSE;
46
59
  private readonly DEBOUNCE_MS;
47
60
  private readonly HEARTBEAT_INTERVAL;
48
61
  private client;
49
62
  private socket?;
50
63
  private activeSubscriptions;
51
- private slotToSubscriptionId;
52
- private subscriptionIdToSlot;
64
+ private pendingSubscribes;
53
65
  private heartbeatTimer?;
54
66
  private subCallDepth;
55
67
  private reconnectAttempts;
56
- private subscriptionsCounter;
57
68
  private connectionId;
58
69
  private reconnect;
59
70
  private onErrorCallbacks;
@@ -87,6 +98,15 @@ export declare class Realtime {
87
98
  private closeSocket;
88
99
  private getTimeout;
89
100
  private sleep;
101
+ private sendUnsubscribeMessage;
102
+ private generateUniqueSubscriptionId;
103
+ private enqueuePendingSubscribe;
104
+ /**
105
+ * Close the WebSocket connection and drop all active subscriptions client-side.
106
+ * Use this instead of calling `unsubscribe()` on every subscription when you want to tear everything down.
107
+ */
108
+ disconnect(): Promise<void>;
109
+ private sendPendingSubscribes;
90
110
  /**
91
111
  * Convert a channel value to a string
92
112
  *
@@ -131,4 +151,5 @@ export declare class Realtime {
131
151
  private handleResponseConnected;
132
152
  private handleResponseError;
133
153
  private handleResponseEvent;
154
+ private handleResponseAction;
134
155
  }
@@ -1,133 +0,0 @@
1
- export declare enum SmsTemplateLocale {
2
- Af = "af",
3
- Arae = "ar-ae",
4
- Arbh = "ar-bh",
5
- Ardz = "ar-dz",
6
- Areg = "ar-eg",
7
- Ariq = "ar-iq",
8
- Arjo = "ar-jo",
9
- Arkw = "ar-kw",
10
- Arlb = "ar-lb",
11
- Arly = "ar-ly",
12
- Arma = "ar-ma",
13
- Arom = "ar-om",
14
- Arqa = "ar-qa",
15
- Arsa = "ar-sa",
16
- Arsy = "ar-sy",
17
- Artn = "ar-tn",
18
- Arye = "ar-ye",
19
- As = "as",
20
- Az = "az",
21
- Be = "be",
22
- Bg = "bg",
23
- Bh = "bh",
24
- Bn = "bn",
25
- Bs = "bs",
26
- Ca = "ca",
27
- Cs = "cs",
28
- Cy = "cy",
29
- Da = "da",
30
- De = "de",
31
- Deat = "de-at",
32
- Dech = "de-ch",
33
- Deli = "de-li",
34
- Delu = "de-lu",
35
- El = "el",
36
- En = "en",
37
- Enau = "en-au",
38
- Enbz = "en-bz",
39
- Enca = "en-ca",
40
- Engb = "en-gb",
41
- Enie = "en-ie",
42
- Enjm = "en-jm",
43
- Ennz = "en-nz",
44
- Entt = "en-tt",
45
- Enus = "en-us",
46
- Enza = "en-za",
47
- Eo = "eo",
48
- Es = "es",
49
- Esar = "es-ar",
50
- Esbo = "es-bo",
51
- Escl = "es-cl",
52
- Esco = "es-co",
53
- Escr = "es-cr",
54
- Esdo = "es-do",
55
- Esec = "es-ec",
56
- Esgt = "es-gt",
57
- Eshn = "es-hn",
58
- Esmx = "es-mx",
59
- Esni = "es-ni",
60
- Espa = "es-pa",
61
- Espe = "es-pe",
62
- Espr = "es-pr",
63
- Espy = "es-py",
64
- Essv = "es-sv",
65
- Esuy = "es-uy",
66
- Esve = "es-ve",
67
- Et = "et",
68
- Eu = "eu",
69
- Fa = "fa",
70
- Fi = "fi",
71
- Fo = "fo",
72
- Fr = "fr",
73
- Frbe = "fr-be",
74
- Frca = "fr-ca",
75
- Frch = "fr-ch",
76
- Frlu = "fr-lu",
77
- Ga = "ga",
78
- Gd = "gd",
79
- He = "he",
80
- Hi = "hi",
81
- Hr = "hr",
82
- Hu = "hu",
83
- Id = "id",
84
- Is = "is",
85
- It = "it",
86
- Itch = "it-ch",
87
- Ja = "ja",
88
- Ji = "ji",
89
- Ko = "ko",
90
- Ku = "ku",
91
- Lt = "lt",
92
- Lv = "lv",
93
- Mk = "mk",
94
- Ml = "ml",
95
- Ms = "ms",
96
- Mt = "mt",
97
- Nb = "nb",
98
- Ne = "ne",
99
- Nl = "nl",
100
- Nlbe = "nl-be",
101
- Nn = "nn",
102
- No = "no",
103
- Pa = "pa",
104
- Pl = "pl",
105
- Pt = "pt",
106
- Ptbr = "pt-br",
107
- Rm = "rm",
108
- Ro = "ro",
109
- Romd = "ro-md",
110
- Ru = "ru",
111
- Rumd = "ru-md",
112
- Sb = "sb",
113
- Sk = "sk",
114
- Sl = "sl",
115
- Sq = "sq",
116
- Sr = "sr",
117
- Sv = "sv",
118
- Svfi = "sv-fi",
119
- Th = "th",
120
- Tn = "tn",
121
- Tr = "tr",
122
- Ts = "ts",
123
- Ua = "ua",
124
- Ur = "ur",
125
- Ve = "ve",
126
- Vi = "vi",
127
- Xh = "xh",
128
- Zhcn = "zh-cn",
129
- Zhhk = "zh-hk",
130
- Zhsg = "zh-sg",
131
- Zhtw = "zh-tw",
132
- Zu = "zu"
133
- }
@@ -1,6 +0,0 @@
1
- export declare enum SmsTemplateType {
2
- Verification = "verification",
3
- Login = "login",
4
- Invitation = "invitation",
5
- MfaChallenge = "mfaChallenge"
6
- }