@rpcbase/client 0.63.0 → 0.64.0

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": "@rpcbase/client",
3
- "version": "0.63.0",
3
+ "version": "0.64.0",
4
4
  "scripts": {
5
5
  "test": "jest"
6
6
  },
package/rts/index.js CHANGED
@@ -184,7 +184,7 @@ export const register_query = (model_name, query, _options, _callback) => {
184
184
  }
185
185
 
186
186
  const key = options.key || ""
187
- const query_key = `${key}${JSON.stringify(query)}`
187
+ const query_key = `${key}${JSON.stringify(query)}${options.projection ? JSON.stringify(options.projection) : ""}`
188
188
  log("registering query with key", key, model_name, query, query_key)
189
189
 
190
190
  // save callback to update hooks
@@ -67,7 +67,6 @@ const run_query = async({model_name, query, query_key, options}, callback) => {
67
67
  return remapped_doc
68
68
  })
69
69
 
70
-
71
70
  if (options.projection) {
72
71
  mapped_docs = mapped_docs.filter((doc) => satisfies_projection(doc, options.projection))
73
72
  }
@@ -30,6 +30,14 @@ test("missing field", () => {
30
30
  })).toBe(false)
31
31
  })
32
32
 
33
+ test("matching and missing field", () => {
34
+ expect(satisfies_projection(doc, {
35
+ field1: true,
36
+ missing_field: 1,
37
+ ...projection
38
+ })).toBe(false)
39
+ })
40
+
33
41
  test("missing nested field", () => {
34
42
  expect(satisfies_projection(doc, {
35
43
  "missing_field.missing_nested": 1,