@nxtedition/deepstream.io-client-js 26.0.14 → 26.0.15
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.js +1 -3
- package/src/event/event-handler.js +1 -1
- package/src/message/connection.js +12 -14
- package/src/message/message-builder.js +3 -3
- package/src/message/message-parser.js +8 -18
- package/src/rpc/rpc-handler.js +1 -1
- package/src/utils/multicast-listener.js +1 -3
- package/src/utils/unicast-listener.js +1 -3
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -127,12 +127,10 @@ Client.prototype._getOptions = function (options) {
|
|
|
127
127
|
return mergedOptions
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
function createDeepstream(url, options) {
|
|
130
|
+
export default function createDeepstream(url, options) {
|
|
131
131
|
return new Client(url, options)
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
Client.prototype.isSameOrNewer = utils.isSameOrNewer
|
|
135
135
|
Client.prototype.CONSTANTS = C
|
|
136
136
|
createDeepstream.CONSTANTS = C
|
|
137
|
-
|
|
138
|
-
export default createDeepstream
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as C from '../constants/constants.js'
|
|
2
2
|
import * as messageBuilder from '../message/message-builder.js'
|
|
3
|
-
import messageParser from '../message/message-parser.js'
|
|
3
|
+
import * as messageParser from '../message/message-parser.js'
|
|
4
4
|
import MulticastListener from '../utils/multicast-listener.js'
|
|
5
5
|
import UnicastListener from '../utils/unicast-listener.js'
|
|
6
6
|
import EventEmitter from 'component-emitter2'
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import * as utils from '../utils/utils.js'
|
|
2
|
+
import * as messageParser from './message-parser.js'
|
|
3
|
+
import * as messageBuilder from './message-builder.js'
|
|
4
|
+
import * as C from '../constants/constants.js'
|
|
5
|
+
import xxhash from 'xxhash-wasm'
|
|
6
|
+
import FixedQueue from '../utils/fixed-queue.js'
|
|
7
|
+
import Emitter from 'component-emitter2'
|
|
8
|
+
|
|
9
|
+
const NodeWebSocket = utils.isNode ? await import('ws').then((x) => x.default) : null
|
|
1
10
|
const BrowserWebSocket = globalThis.WebSocket || globalThis.MozWebSocket
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const messageParser = require('./message-parser')
|
|
5
|
-
const messageBuilder = require('./message-builder')
|
|
6
|
-
const C = require('../constants/constants')
|
|
7
|
-
const pkg = require('../../package.json')
|
|
8
|
-
const xxhash = require('xxhash-wasm')
|
|
9
|
-
const FixedQueue = require('../utils/fixed-queue')
|
|
10
|
-
const Emitter = require('component-emitter2')
|
|
11
|
-
|
|
12
|
-
const Connection = function (client, url, options) {
|
|
11
|
+
|
|
12
|
+
export default function Connection(client, url, options) {
|
|
13
13
|
this._client = client
|
|
14
14
|
this._options = options
|
|
15
15
|
this._logger = options.logger
|
|
@@ -166,7 +166,7 @@ Connection.prototype._sendAuthParams = function () {
|
|
|
166
166
|
this._setState(C.CONNECTION_STATE.AUTHENTICATING)
|
|
167
167
|
const authMessage = messageBuilder.getMsg(C.TOPIC.AUTH, C.ACTIONS.REQUEST, [
|
|
168
168
|
this._authParams,
|
|
169
|
-
|
|
169
|
+
'26.0.0',
|
|
170
170
|
utils.isNode
|
|
171
171
|
? `Node/${process.version}`
|
|
172
172
|
: globalThis.navigator && globalThis.navigator.userAgent,
|
|
@@ -365,5 +365,3 @@ Connection.prototype._clearReconnect = function () {
|
|
|
365
365
|
}
|
|
366
366
|
this._reconnectionAttempt = 0
|
|
367
367
|
}
|
|
368
|
-
|
|
369
|
-
module.exports = Connection
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import * as C from '../constants/constants.js'
|
|
2
2
|
|
|
3
3
|
const SEP = C.MESSAGE_PART_SEPERATOR
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
export function getMsg(topic, action, data) {
|
|
6
6
|
if (data && !(data instanceof Array)) {
|
|
7
7
|
throw new Error('data must be an array')
|
|
8
8
|
}
|
|
@@ -22,7 +22,7 @@ module.exports.getMsg = function (topic, action, data) {
|
|
|
22
22
|
return sendData.join(SEP)
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
export function typed(value) {
|
|
26
26
|
const type = typeof value
|
|
27
27
|
|
|
28
28
|
if (type === 'string') {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import * as C from '../constants/constants.js'
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
|
|
3
|
+
const actions = {}
|
|
4
|
+
|
|
5
|
+
for (const key in C.ACTIONS) {
|
|
6
|
+
actions[C.ACTIONS[key]] = key
|
|
5
7
|
}
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
export function convertTyped(value, client) {
|
|
8
10
|
const type = value.charAt(0)
|
|
9
11
|
|
|
10
12
|
if (type === C.TYPES.STRING) {
|
|
@@ -45,17 +47,7 @@ MessageParser.prototype.convertTyped = function (value, client) {
|
|
|
45
47
|
return undefined
|
|
46
48
|
}
|
|
47
49
|
|
|
48
|
-
|
|
49
|
-
const actions = {}
|
|
50
|
-
|
|
51
|
-
for (const key in C.ACTIONS) {
|
|
52
|
-
actions[C.ACTIONS[key]] = key
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return actions
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
MessageParser.prototype.parseMessage = function (message, client, result) {
|
|
50
|
+
export function parseMessage(message, client, result) {
|
|
59
51
|
const parts = message.split(C.MESSAGE_PART_SEPERATOR)
|
|
60
52
|
|
|
61
53
|
if (parts.length < 2) {
|
|
@@ -72,7 +64,7 @@ MessageParser.prototype.parseMessage = function (message, client, result) {
|
|
|
72
64
|
return null
|
|
73
65
|
}
|
|
74
66
|
|
|
75
|
-
if (
|
|
67
|
+
if (actions[parts[1]] === undefined) {
|
|
76
68
|
client._$onError(
|
|
77
69
|
C.TOPIC.ERROR,
|
|
78
70
|
C.EVENT.MESSAGE_PARSE_ERROR,
|
|
@@ -87,5 +79,3 @@ MessageParser.prototype.parseMessage = function (message, client, result) {
|
|
|
87
79
|
result.action = parts[1]
|
|
88
80
|
result.data = parts.splice(2)
|
|
89
81
|
}
|
|
90
|
-
|
|
91
|
-
module.exports = new MessageParser()
|
package/src/rpc/rpc-handler.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as C from '../constants/constants.js'
|
|
2
2
|
import RpcResponse from './rpc-response.js'
|
|
3
|
-
import messageParser from '../message/message-parser.js'
|
|
3
|
+
import * as messageParser from '../message/message-parser.js'
|
|
4
4
|
import * as messageBuilder from '../message/message-builder.js'
|
|
5
5
|
import xuid from 'xuid'
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as C from '../constants/constants.js'
|
|
2
2
|
import rxjs from 'rxjs'
|
|
3
3
|
|
|
4
|
-
class Listener {
|
|
4
|
+
export default class Listener {
|
|
5
5
|
constructor(topic, pattern, callback, handler, { recursive = false, stringify = null } = {}) {
|
|
6
6
|
this._topic = topic
|
|
7
7
|
this._pattern = pattern
|
|
@@ -228,5 +228,3 @@ class Listener {
|
|
|
228
228
|
this._subscriptions.clear()
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
-
|
|
232
|
-
export default Listener
|
|
@@ -21,7 +21,7 @@ const PIPE = rxjs.pipe(
|
|
|
21
21
|
rx.distinctUntilChanged(),
|
|
22
22
|
)
|
|
23
23
|
|
|
24
|
-
class Listener {
|
|
24
|
+
export default class Listener {
|
|
25
25
|
constructor(topic, pattern, callback, handler, opts) {
|
|
26
26
|
if (opts.recursive) {
|
|
27
27
|
throw new Error('invalid argument: recursive')
|
|
@@ -126,5 +126,3 @@ class Listener {
|
|
|
126
126
|
this._connection.sendMsg(this._topic, C.ACTIONS.UNLISTEN, [this._pattern])
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
|
|
130
|
-
export default Listener
|