@nxtedition/deepstream.io-client-js 32.0.7 → 32.0.8

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": "32.0.7",
3
+ "version": "32.0.8",
4
4
  "description": "the javascript client for deepstream.io",
5
5
  "homepage": "http://deepstream.io",
6
6
  "type": "module",
package/src/client.d.ts CHANGED
@@ -87,11 +87,12 @@ export interface DeepstreamClient<
87
87
  rpc: RpcHandler<Methods>
88
88
  record: RecordHandler<Records>
89
89
  user: string | null
90
- on: (evt: EventName, callback: (...args: unknown[]) => void) => void
91
- off: (evt: EventName, callback: (...args: unknown[]) => void) => void
90
+ on: (evt: EventName, callback: (...args: unknown[]) => void) => this
91
+ off: (evt: EventName, callback: (...args: unknown[]) => void) => this
92
92
  getConnectionState: () => ConnectionStateName
93
93
  close: () => void
94
- login: unknown
94
+ login(callback: (success: boolean, authData: unknown) => void): this
95
+ login(authParams: object, callback: (success: boolean, authData: unknown) => void): this
95
96
  stats: {
96
97
  record: RecordStats
97
98
  rpc: RpcStats
@@ -6,6 +6,7 @@ export default class Listener {
6
6
  constructor(topic, pattern, callback, handler, { recursive = false, stringify = null } = {}) {
7
7
  this._topic = topic
8
8
  this._pattern = pattern
9
+ this._expr = new RegExp(pattern)
9
10
  this._callback = callback
10
11
  this._handler = handler
11
12
  this._client = this._handler._client
@@ -54,6 +55,11 @@ export default class Listener {
54
55
  return
55
56
  }
56
57
 
58
+ if (!this._expr.test(name)) {
59
+ this._error(name, 'invalid add: name does not match pattern')
60
+ return
61
+ }
62
+
57
63
  // TODO (refactor): Move to class
58
64
  const provider = {
59
65
  name,
@@ -37,6 +37,7 @@ export default class Listener {
37
37
 
38
38
  this._topic = topic
39
39
  this._pattern = pattern
40
+ this._expr = new RegExp(pattern)
40
41
  this._callback = callback
41
42
  this._handler = handler
42
43
  this._client = this._handler._client
@@ -69,6 +70,11 @@ export default class Listener {
69
70
  return
70
71
  }
71
72
 
73
+ if (!this._expr.test(name)) {
74
+ this._error(name, 'invalid accept: name does not match pattern')
75
+ return
76
+ }
77
+
72
78
  let value$
73
79
  try {
74
80
  value$ = this._callback(name)
@@ -1,9 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(npm run test:types:*)"
5
- ],
6
- "deny": [],
7
- "ask": []
8
- }
9
- }