@nxtedition/deepstream.io-client-js 31.2.10 → 31.2.12

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/deepstream.io-client-js",
3
- "version": "31.2.10",
3
+ "version": "31.2.12",
4
4
  "description": "the javascript client for deepstream.io",
5
5
  "homepage": "http://deepstream.io",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  import make, { type DeepstreamClient } from './client.js'
3
- import { expectAssignable, expectError } from 'tsd'
3
+ import { expectAssignable, expectError, expectType } from 'tsd'
4
4
  import type { Observable } from 'rxjs'
5
5
 
6
6
  interface Records extends Record<string, unknown> {
@@ -195,6 +195,11 @@ rec.set('o0.o1', {})
195
195
  expectError(rec.update((x) => 'x'))
196
196
  expectError(rec.update('o0', (x) => ({ ...x, o1: '22' })))
197
197
 
198
+ expectType<string | undefined>(rec.get('o0.o1.o2.o3'))
199
+ expectType<{ o0?: { o1?: { o2?: { o3?: string } } } }>(rec.get())
200
+ const pathOrUndefined: 'o0.01.02.03' | undefined = undefined
201
+ expectType<unknown>(rec.get(pathOrUndefined))
202
+
198
203
  // when with options
199
204
  expectAssignable<Promise<typeof rec>>(rec.when())
200
205
  expectAssignable<Promise<typeof rec>>(rec.when(2))
@@ -214,3 +219,8 @@ expectAssignable<Promise<void>>(
214
219
  )
215
220
  expectAssignable<Promise<void>>(rec.update('o0', (x) => x, { timeout: 5000 }))
216
221
  expectAssignable<Promise<void>>(rec.update('o0', (x) => x, { state: 2 }))
222
+
223
+ const state = 'VOID'
224
+ expectType<0>(ds.record.STATE[state])
225
+ const unknownState: string = 'VOID'
226
+ expectType<number>(ds.record.STATE[unknownState])
@@ -17,6 +17,15 @@ export default class RecordHandler<Records = Record<string, unknown>> {
17
17
  STALE: 3
18
18
  PROVIDER: 4
19
19
 
20
+ STATE: {
21
+ VOID: 0
22
+ CLIENT: 1
23
+ SERVER: 2
24
+ STALE: 3
25
+ PROVIDER: 4
26
+ [key: string]: number
27
+ }
28
+
20
29
  JSON: {
21
30
  EMPTY: EmptyObject
22
31
  EMPTY_OBJ: EmptyObject
@@ -282,7 +282,7 @@ class RecordHandler {
282
282
  // TODO (perf): Slow implementation...
283
283
 
284
284
  const signal = opts?.signal
285
- const timeout = opts?.timeout
285
+ const timeout = opts?.timeout ?? 60e3
286
286
 
287
287
  let disposers
288
288
  try {
@@ -75,6 +75,7 @@ export default class Record<Data = unknown> {
75
75
  <P extends string | string[]>(path: P): Get<Data, P>
76
76
  // without path
77
77
  (): Data
78
+ (path: undefined | string | string[]): unknown
78
79
  }
79
80
 
80
81
  set: {
@@ -1,9 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(npm run test:types:*)"
5
- ],
6
- "deny": [],
7
- "ask": []
8
- }
9
- }