@nxtedition/deepstream.io-client-js 32.0.12 → 32.0.13
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/package.json +1 -1
- package/src/client.d.ts +34 -9
- package/src/event/event-handler.js +1 -1
- package/src/record/record.js +1 -1
- package/src/utils/utils.js +1 -1
- package/.claude/settings.local.json +0 -9
- package/nxtedition-deepstream.io-client-js-31.0.18-b1.tgz +0 -0
- package/nxtedition-deepstream.io-client-js-31.0.18-b2.tgz +0 -0
- package/nxtedition-deepstream.io-client-js-31.0.18-b3.tgz +0 -0
- package/nxtedition-deepstream.io-client-js-32.0.6-alpha.0.tgz +0 -0
package/package.json
CHANGED
package/src/client.d.ts
CHANGED
|
@@ -33,6 +33,8 @@ export type {
|
|
|
33
33
|
SyncOptions,
|
|
34
34
|
Paths,
|
|
35
35
|
Get,
|
|
36
|
+
ConnectionStateName,
|
|
37
|
+
DeepstreamErrorEventName,
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
type RecordStateConstants = Readonly<{
|
|
@@ -99,6 +101,26 @@ export interface DeepstreamError extends Error {
|
|
|
99
101
|
data?: unknown
|
|
100
102
|
}
|
|
101
103
|
|
|
104
|
+
export interface DeepstreamMessage {
|
|
105
|
+
raw: string | null
|
|
106
|
+
topic: string | null
|
|
107
|
+
action: string | null
|
|
108
|
+
data: string[]
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface DeepstreamClientEventMap {
|
|
112
|
+
connectionStateChanged: (state: ConnectionStateName) => void
|
|
113
|
+
connected: (connected: boolean) => void
|
|
114
|
+
MAX_RECONNECTION_ATTEMPTS_REACHED: (attempt: number) => void
|
|
115
|
+
error: (error: DeepstreamError) => void
|
|
116
|
+
recv: (message: DeepstreamMessage) => void
|
|
117
|
+
send: (message: DeepstreamMessage) => void
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
type DeepstreamErrorEventMap = {
|
|
121
|
+
[K in DeepstreamErrorEventName]: (error: DeepstreamError) => void
|
|
122
|
+
}
|
|
123
|
+
|
|
102
124
|
export interface DeepstreamClient<
|
|
103
125
|
Records extends Record<string, unknown> = Record<string, unknown>,
|
|
104
126
|
Methods extends Record<string, RpcMethodDef> = Record<string, RpcMethodDef>,
|
|
@@ -108,18 +130,21 @@ export interface DeepstreamClient<
|
|
|
108
130
|
rpc: RpcHandler<Methods>
|
|
109
131
|
record: RecordHandler<Records>
|
|
110
132
|
user: string | null
|
|
111
|
-
on
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
off
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
133
|
+
on<K extends keyof (DeepstreamClientEventMap & DeepstreamErrorEventMap)>(
|
|
134
|
+
evt: K,
|
|
135
|
+
callback: (DeepstreamClientEventMap & DeepstreamErrorEventMap)[K],
|
|
136
|
+
): this
|
|
137
|
+
off<K extends keyof (DeepstreamClientEventMap & DeepstreamErrorEventMap)>(
|
|
138
|
+
evt: K,
|
|
139
|
+
callback: (DeepstreamClientEventMap & DeepstreamErrorEventMap)[K],
|
|
140
|
+
): this
|
|
119
141
|
getConnectionState: () => ConnectionStateName
|
|
120
142
|
close: () => void
|
|
121
143
|
login(callback: (success: boolean, authData: unknown) => void): this
|
|
122
|
-
login(
|
|
144
|
+
login(
|
|
145
|
+
authParams: Record<string, unknown>,
|
|
146
|
+
callback: (success: boolean, authData: unknown) => void,
|
|
147
|
+
): this
|
|
123
148
|
stats: {
|
|
124
149
|
record: RecordStats
|
|
125
150
|
rpc: RpcStats
|
package/src/record/record.js
CHANGED
|
@@ -249,7 +249,7 @@ class Record {
|
|
|
249
249
|
when(stateOrNil, optionsOrNil) {
|
|
250
250
|
invariant(this._refs > 0, 'missing refs')
|
|
251
251
|
|
|
252
|
-
if (stateOrNil != null && stateOrNil === 'object') {
|
|
252
|
+
if (stateOrNil != null && typeof stateOrNil === 'object') {
|
|
253
253
|
optionsOrNil = stateOrNil
|
|
254
254
|
stateOrNil = optionsOrNil?.state
|
|
255
255
|
}
|
package/src/utils/utils.js
CHANGED
|
@@ -85,7 +85,7 @@ export function setTimeout(callback, timeoutDuration) {
|
|
|
85
85
|
|
|
86
86
|
export function setInterval(callback, intervalDuration) {
|
|
87
87
|
if (intervalDuration !== null) {
|
|
88
|
-
return setInterval(callback, intervalDuration)
|
|
88
|
+
return globalThis.setInterval(callback, intervalDuration)
|
|
89
89
|
} else {
|
|
90
90
|
return -1
|
|
91
91
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|