@knowlearning/agents 0.9.134 → 0.9.135
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/agents/watch.js +5 -12
- package/package.json +1 -1
package/agents/watch.js
CHANGED
|
@@ -13,20 +13,13 @@ export default function({ metadata, environment, state, watchers, synced, sentUp
|
|
|
13
13
|
let removed = false
|
|
14
14
|
metadata(scope, user, domain)
|
|
15
15
|
.then(async ({ ii }) => {
|
|
16
|
-
if (removed) return
|
|
17
|
-
|
|
18
16
|
const { auth: { user: u }, domain: d } = await environment()
|
|
19
|
-
|
|
17
|
+
const state = await statePromise
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
scope,
|
|
23
|
-
user,
|
|
24
|
-
domain,
|
|
25
|
-
state: await statePromise,
|
|
26
|
-
patch: null,
|
|
27
|
-
ii
|
|
28
|
-
})
|
|
19
|
+
if (removed) return
|
|
29
20
|
|
|
21
|
+
qualifiedScope = isUUID(scope) ? scope : `${!domain || domain === d ? '' : domain}/${!user || user === u ? '' : user}/${scope}`
|
|
22
|
+
fn({ scope, user, domain, state, patch: null, ii })
|
|
30
23
|
if (sentUpdates) sentUpdates[qualifiedScope] = ii
|
|
31
24
|
|
|
32
25
|
if (removed) return
|
|
@@ -37,7 +30,7 @@ export default function({ metadata, environment, state, watchers, synced, sentUp
|
|
|
37
30
|
|
|
38
31
|
return () => {
|
|
39
32
|
removed = true
|
|
40
|
-
|
|
33
|
+
if (qualifiedScope) removeWatcher(qualifiedScope, fn)
|
|
41
34
|
}
|
|
42
35
|
}
|
|
43
36
|
|