@nxtedition/deepstream.io-client-js 31.0.22 → 31.1.1
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
CHANGED
|
@@ -15,6 +15,7 @@ export default function Connection(client, url, options) {
|
|
|
15
15
|
this._logger = options.logger
|
|
16
16
|
this._schedule = options.schedule ?? utils.schedule
|
|
17
17
|
this._batchSize = options.batchSize ?? 1024
|
|
18
|
+
this._priority = options.priority ?? 0
|
|
18
19
|
this._authParams = null
|
|
19
20
|
this._authCallback = null
|
|
20
21
|
this._deliberateClose = false
|
|
@@ -179,6 +180,7 @@ Connection.prototype._sendAuthParams = function () {
|
|
|
179
180
|
utils.isNode
|
|
180
181
|
? `Node/${process.version}`
|
|
181
182
|
: globalThis.navigator && globalThis.navigator.userAgent,
|
|
183
|
+
`${this._priority || 0}`,
|
|
182
184
|
])
|
|
183
185
|
this._submit(authMessage)
|
|
184
186
|
}
|
|
@@ -479,8 +479,50 @@ class RecordHandler {
|
|
|
479
479
|
}
|
|
480
480
|
|
|
481
481
|
/**
|
|
482
|
+
*
|
|
483
|
+
* @param {*} name
|
|
482
484
|
* @param {...any} args
|
|
483
|
-
* @returns {Promise}
|
|
485
|
+
* @returns { { value: object, async: false } | { value: Promise<object>, async: true } }
|
|
486
|
+
*/
|
|
487
|
+
getAsync(name, ...args) {
|
|
488
|
+
let path
|
|
489
|
+
let state = GET_DEFAULTS.state
|
|
490
|
+
|
|
491
|
+
let idx = 0
|
|
492
|
+
|
|
493
|
+
if (
|
|
494
|
+
idx < args.length &&
|
|
495
|
+
(args[idx] == null ||
|
|
496
|
+
typeof args[idx] === 'string' ||
|
|
497
|
+
Array.isArray(args[idx]) ||
|
|
498
|
+
typeof args[idx] === 'function')
|
|
499
|
+
) {
|
|
500
|
+
path = args[idx++]
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
if (idx < args.length && (args[idx] == null || typeof args[idx] === 'number')) {
|
|
504
|
+
state = args[idx++]
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
if (idx < args.length && (args[idx] == null || typeof args[idx] === 'object')) {
|
|
508
|
+
return { value: this.get(name, ...args), async: true }
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
const rec = this.getRecord(name)
|
|
512
|
+
try {
|
|
513
|
+
if (rec.state >= state) {
|
|
514
|
+
return { value: rec.get(path), async: false }
|
|
515
|
+
}
|
|
516
|
+
} finally {
|
|
517
|
+
rec.unref()
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
return { value: this.get(name, ...args), async: true }
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* @param {...any} args
|
|
525
|
+
* @returns {Promise<object>}
|
|
484
526
|
*/
|
|
485
527
|
get(...args) {
|
|
486
528
|
return rxjs.firstValueFrom(this._observe(GET_DEFAULTS, ...args))
|
|
@@ -488,7 +530,7 @@ class RecordHandler {
|
|
|
488
530
|
|
|
489
531
|
/**
|
|
490
532
|
* @param {...any} args
|
|
491
|
-
* @returns {Promise}
|
|
533
|
+
* @returns {Promise<object>}
|
|
492
534
|
*/
|
|
493
535
|
get2(...args) {
|
|
494
536
|
return rxjs.firstValueFrom(this._observe(GET2_DEFAULTS, ...args))
|