@knowlearning/agents 0.9.186 → 0.9.188
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/embedded.js +2 -0
- package/agents/generic/index.js +2 -0
- package/agents/generic/message-queue.js +10 -1
- package/agents/sync.js +7 -0
- package/package.json +1 -1
package/agents/embedded.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { validate as isUUID, v1 as uuid } from 'uuid'
|
|
2
2
|
import PatchProxy from '@knowlearning/patch-proxy'
|
|
3
3
|
import watchImplementation from './watch.js'
|
|
4
|
+
import sync from './sync.js'
|
|
4
5
|
|
|
5
6
|
export default function EmbeddedAgent(postMessage) {
|
|
6
7
|
let messageIndex = 0
|
|
@@ -227,6 +228,7 @@ export default function EmbeddedAgent(postMessage) {
|
|
|
227
228
|
synced,
|
|
228
229
|
close,
|
|
229
230
|
response,
|
|
231
|
+
sync,
|
|
230
232
|
query
|
|
231
233
|
}
|
|
232
234
|
}
|
package/agents/generic/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import messageQueue from './message-queue.js'
|
|
|
4
4
|
import stateImplementation from './state.js'
|
|
5
5
|
import watchImplementation from '../watch.js'
|
|
6
6
|
import downloadImplementation from '../download.js'
|
|
7
|
+
import sync from '../sync.js'
|
|
7
8
|
|
|
8
9
|
// TODO: consider using something better than name as mechanism
|
|
9
10
|
// for resoling default scope in context
|
|
@@ -229,6 +230,7 @@ export default function Agent({ Connection, domain, token, sid, uuid, fetch, app
|
|
|
229
230
|
debug,
|
|
230
231
|
guarantee,
|
|
231
232
|
response,
|
|
233
|
+
sync,
|
|
232
234
|
on
|
|
233
235
|
}
|
|
234
236
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { validate as isUUID } from 'uuid'
|
|
2
2
|
import { standardJSONPatch } from '@knowlearning/patch-proxy'
|
|
3
|
+
import pkg from '../../package.json' assert { type: 'json' }
|
|
3
4
|
|
|
4
5
|
const HEARTBEAT_TIMEOUT = 10000
|
|
5
6
|
const DOMAIN_MESSAGES = { open: true, mutate: true, close: true }
|
|
@@ -36,7 +37,15 @@ export default function messageQueue({ token, sid, domain, Connection, watchers,
|
|
|
36
37
|
authenticated: null
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
async function environment() {
|
|
40
|
+
async function environment() {
|
|
41
|
+
const { version } = pkg
|
|
42
|
+
return {
|
|
43
|
+
variables,
|
|
44
|
+
...(await environmentPromise),
|
|
45
|
+
context: [],
|
|
46
|
+
version
|
|
47
|
+
}
|
|
48
|
+
}
|
|
40
49
|
|
|
41
50
|
function queueMessage({ scope, patch, context }) {
|
|
42
51
|
if (lastSynchronousScopePatched === scope) {
|
package/agents/sync.js
ADDED