@knowlearning/agents 0.1.5 → 0.1.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowlearning/agents",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "API for embedding applications in KnowLearning systems.",
5
5
  "main": "package/node.js",
6
6
  "browser": "package/browser.js",
@@ -32,14 +32,6 @@ export default function MutableProxy(state, interact, ephemeralPaths={}, parentP
32
32
 
33
33
  const traps = {
34
34
  set(target, prop, value) {
35
- const path = [...parentPath, prop]
36
- const serializedPath = serializePath(path)
37
-
38
- if (ephemeralPaths[serializedPath]) {
39
- target[prop] = value
40
- return true
41
- }
42
-
43
35
  if (isArray) {
44
36
  if (!/^\d+$/.test(prop)) {
45
37
  target[prop] = value
@@ -48,6 +40,14 @@ export default function MutableProxy(state, interact, ephemeralPaths={}, parentP
48
40
  else prop = parseInt(prop)
49
41
  }
50
42
 
43
+ const path = [...parentPath, prop]
44
+ const serializedPath = serializePath(path)
45
+
46
+ if (ephemeralPaths[serializedPath]) {
47
+ target[prop] = value
48
+ return true
49
+ }
50
+
51
51
  if (value === undefined) {
52
52
  console.log('EXTRA ERROR INFO. target, prop, value', target, prop, value)
53
53
  throw new Error(`Setting properties to undefined is not supported. Please use a delete statement. Attempted to set ${serializedPath}`)
@@ -10,7 +10,7 @@ function isScopeSerializable(v) {
10
10
 
11
11
  export default async function (module, props) {
12
12
  const component = module.default ? { ...module.default } : { ...module } // copy component since we will mess with mounted and data functions
13
- /*
13
+
14
14
  if (!component.ephemeral) {
15
15
  const state = await Agent.mutate()
16
16
 
@@ -50,11 +50,9 @@ export default async function (module, props) {
50
50
  }
51
51
  }
52
52
  }
53
- */
54
53
 
55
54
  document.body.innerHTML = ''
56
55
  const app = createApp(component, props)
57
- console.log(app)
58
56
  app.component('Content', content)
59
57
  app.mount(document.body)
60
58
  }