@knowlearning/agents 0.9.30 → 0.9.31

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.
@@ -53,16 +53,18 @@ export default function EmbeddedAgent() {
53
53
  const d = !domain || domain === rootDomain ? '' : domain
54
54
  const u = !user || auth.user === user ? '' : user
55
55
  const key = isUUID(scope) ? scope : `${d}/${u}/${scope}`
56
+
57
+ const sendUpdate = () => {
58
+ sentUpdates[key] = data.ii
59
+ watchers[key].forEach(fn => fn(data))
60
+ }
61
+
56
62
  if (watchers[key]) {
57
- if (sentUpdates[key] === undefined || sentUpdates[key] + 1 === data.ii) {
58
- sentUpdates[key] = data.ii
59
- watchers[key].forEach(fn => fn(data))
60
- }
61
- else if (data.ii === sentUpdates[key]) {
62
- console.warn('Repeated update for', key, data, sentUpdates[key])
63
- }
63
+ if (sentUpdates[key] === undefined || sentUpdates[key] + 1 === data.ii) sendUpdate()
64
+ else if (data.ii === sentUpdates[key]) console.warn('Repeated update for', key, data, sentUpdates[key])
64
65
  else {
65
66
  console.warn('Out of order update for', key, data, sentUpdates[key])
67
+ if (data.ii > sentUpdates[key]) sendUpdate()
66
68
  }
67
69
  }
68
70
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowlearning/agents",
3
- "version": "0.9.30",
3
+ "version": "0.9.31",
4
4
  "description": "API for embedding applications in KnowLearning systems.",
5
5
  "main": "node.js",
6
6
  "browser": "browser.js",