@knowlearning/agents 0.3.13 → 0.3.15

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.
@@ -115,7 +115,7 @@ export default function EmbeddedAgent() {
115
115
  async function upload(name, type, data, id=uuid()) {
116
116
  const url = await send({ type: 'upload', name, contentType: type, id })
117
117
 
118
- if (!data) return url
118
+ if (data === undefined) return url
119
119
  else {
120
120
  console.log('UPLOADING TO URL!!!!!!!!!!!!!!', id, url)
121
121
  const headers = { 'Content-Type': type }
package/agents/generic.js CHANGED
@@ -91,7 +91,7 @@ export default function Agent({ host, token, WebSocket, protocol='ws', uuid, fet
91
91
  try {
92
92
  log('handling message', disconnected, authed)
93
93
  const message = JSON.parse(data)
94
- log('message', message)
94
+ if (mode === 'debug') log('message', JSON.stringify(message))
95
95
 
96
96
  if (message.error) console.warn('ERROR RESPONSE', message)
97
97
 
@@ -238,7 +238,7 @@ export default function Agent({ host, token, WebSocket, protocol='ws', uuid, fet
238
238
  const { url } = await lastMessageResponse()
239
239
  sessionData[session].uploads[id].url = url
240
240
 
241
- if (!data) return url
241
+ if (data === undefined) return url
242
242
  else {
243
243
  const headers = { 'Content-Type': type }
244
244
  const response = await fetch(url, {method: 'PUT', headers, body: data})
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowlearning/agents",
3
- "version": "0.3.13",
3
+ "version": "0.3.15",
4
4
  "description": "API for embedding applications in KnowLearning systems.",
5
5
  "main": "node.js",
6
6
  "browser": "browser.js",
@@ -60,7 +60,7 @@ export default function MutableProxy(state, interact, ephemeralPaths={}, parentP
60
60
  // something smart around insertions/deletions
61
61
  // TODO: if is array and prop is last element, consider passing -1 as prop
62
62
  interact([{
63
- op: target[prop] ? 'replace' : 'add',
63
+ op: target[prop] === undefined ? 'add' : 'replace',
64
64
  value: JSON.parse(JSON.stringify(value)), // TODO: more efficient sanitization
65
65
  path
66
66
  }])