@knowlearning/agents 0.9.0 → 0.9.1
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.
|
@@ -202,6 +202,7 @@ export default function EmbeddedAgent() {
|
|
|
202
202
|
return send({ type: 'login', provider, username, password })
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
+
function query(query, params) { return send({ type: 'query', query, params }) }
|
|
205
206
|
function logout() { return send({ type: 'logout' }) }
|
|
206
207
|
function disconnect() { return send({ type: 'disconnect' }) }
|
|
207
208
|
function reconnect() { return send({ type: 'reconnect' }) }
|
|
@@ -227,6 +228,7 @@ export default function EmbeddedAgent() {
|
|
|
227
228
|
reconnect,
|
|
228
229
|
synced,
|
|
229
230
|
close,
|
|
231
|
+
query,
|
|
230
232
|
tag
|
|
231
233
|
}
|
|
232
234
|
}
|
|
@@ -91,6 +91,10 @@ function embed(environment, iframe) {
|
|
|
91
91
|
const { root, scopes } = message
|
|
92
92
|
sendDown(await Agent.patch(root, scopes))
|
|
93
93
|
}
|
|
94
|
+
else if (type === 'query') {
|
|
95
|
+
const { query, params } = message
|
|
96
|
+
sendDown(await Agent.query(query, params))
|
|
97
|
+
}
|
|
94
98
|
else if (type === 'upload') {
|
|
95
99
|
const { name, contentType, id } = message
|
|
96
100
|
sendDown(await Agent.upload(name, contentType, undefined, id))
|
package/agents/generic.js
CHANGED
|
@@ -421,12 +421,13 @@ export default function Agent({ host, token, WebSocket, protocol='ws', uuid, fet
|
|
|
421
421
|
mode = 'debug'
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
-
function query(query, params, domain) {
|
|
424
|
+
async function query(query, params, domain) {
|
|
425
425
|
create({
|
|
426
426
|
active_type: POSTGRES_QUERY_TYPE,
|
|
427
427
|
active: { query, params, domain }
|
|
428
428
|
})
|
|
429
|
-
|
|
429
|
+
const { rows } = await lastMessageResponse()
|
|
430
|
+
return rows
|
|
430
431
|
}
|
|
431
432
|
|
|
432
433
|
function tag(tag_type, target, context=[]) {
|