@nxtedition/lib 13.0.3 → 13.0.4

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.
Files changed (3) hide show
  1. package/deepstream.js +12 -8
  2. package/http.js +0 -4
  3. package/package.json +1 -1
package/deepstream.js CHANGED
@@ -63,9 +63,8 @@ function parseKey(key) {
63
63
  function observe(ds, name, ...args) {
64
64
  let query = null
65
65
 
66
- if (args.length && (args[0] == null || typeof args[0] === 'object')) {
66
+ if (args.length > 0 && (args[0] == null || typeof args[0] === 'object')) {
67
67
  query = args.shift()
68
- query = query ? JSON.parse(JSON.stringify(query)) : null
69
68
  }
70
69
 
71
70
  name = `${name}`
@@ -83,9 +82,8 @@ function observe(ds, name, ...args) {
83
82
  function observe2(ds, name, ...args) {
84
83
  let query = null
85
84
 
86
- if (args.length && (args[0] == null || typeof args[0] === 'object')) {
85
+ if (args.length > 0 && (args[0] == null || typeof args[0] === 'object')) {
87
86
  query = args.shift()
88
- query = query ? JSON.parse(JSON.stringify(query)) : null
89
87
  }
90
88
 
91
89
  name = `${name}`
@@ -101,14 +99,20 @@ function observe2(ds, name, ...args) {
101
99
  }
102
100
 
103
101
  function get(ds, name, ...args) {
104
- let options = null
102
+ let query = null
105
103
 
106
- if (args[0] && typeof args[0] === 'object') {
107
- options = JSON.parse(JSON.stringify(args.shift()))
104
+ if (args.length > 0 && (args[0] == null || typeof args[0] === 'object')) {
105
+ query = args.shift()
108
106
  }
109
107
 
108
+ name = `${name}`
109
+
110
110
  return ds.record.get(
111
- `${name}${options && Object.keys(options).length > 0 ? `?${qs.stringify(options)}` : ''}`,
111
+ `${name}${
112
+ query && Object.keys(query).length > 0
113
+ ? `${name.endsWith('?') ? '' : '?'}${qs.stringify(query, { skipNulls: true })}`
114
+ : ''
115
+ }`,
112
116
  ...args
113
117
  )
114
118
  }
package/http.js CHANGED
@@ -56,10 +56,6 @@ module.exports.request = async function request(ctx, next) {
56
56
  reqLogger.trace({ req }, 'request started')
57
57
  }
58
58
 
59
- if (!ctx.url) {
60
- throw new createError.BadRequest()
61
- }
62
-
63
59
  const onClose = () => ac.abort()
64
60
  const onTimeout = () => res.destroy(new createError.RequestTimeout())
65
61
  const onError = (err) => ac.abort(err)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "13.0.3",
3
+ "version": "13.0.4",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "files": [