@live-change/dao 0.5.6 → 0.5.8

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/lib/Path.js CHANGED
@@ -83,7 +83,7 @@ class Path {
83
83
  }
84
84
  newMore.push(more)
85
85
  } else if(fetchObject.$toPath) { /// sourceProxy returned
86
- console.log("FETCH OBJECT PROXY", fetchObject)
86
+ //console.log("FETCH OBJECT PROXY", fetchObject)
87
87
  const schema = JSON.parse(JSON.stringify(fetchObject.$toPath(), (key, value) => {
88
88
  if(value instanceof Path) {
89
89
  const path = value.what.slice(0, -1)
@@ -631,22 +631,34 @@ class ReactiveServerConnection extends EventEmitter {
631
631
  }
632
632
  return dataPromise.then(result => {
633
633
  if(!resultsMap.has(key)) {
634
- results.push({
634
+ const resultInfo = {
635
635
  what,
636
636
  data: result
637
- })
638
- resultsMap.set(key, result)
637
+ }
638
+ results.push(resultInfo)
639
+ resultsMap.set(key, resultInfo)
639
640
  }
640
641
  if(path.more) {
641
642
  return fetchMore(result, path.more).then(m=>result)
642
643
  } else return Promise.resolve(result)
644
+ }).catch(error => {
645
+ if(!resultsMap.has(key)) {
646
+ const resultInfo = {
647
+ what,
648
+ error: error
649
+ }
650
+ results.push(resultInfo)
651
+ resultsMap.set(key, resultInfo)
652
+ }
643
653
  })
644
654
  } else if(path.schema) {
645
655
  return fetchDeps(undefined, path.schema).then(pointers => {
646
656
  //console.log("PTRS", pointers)
647
657
  return Promise.all(pointers.map(pointer => fetch({ what: pointer }))).then(results => {
658
+ const error = results.find(r => r.error)
659
+ if(error) return error
648
660
  if (path.more) {
649
- return fetchMore(results, path.more).then(m=>results)
661
+ return fetchMore(results.map(r => r.data), path.more).then(m=>results)
650
662
  } else return Promise.resolve(results)
651
663
  })
652
664
  })
package/package.json CHANGED
@@ -35,6 +35,6 @@
35
35
  "scripts": {
36
36
  "test": "NODE_ENV=test blue-tape tests/*"
37
37
  },
38
- "version": "0.5.6",
39
- "gitHead": "8a0894ea0f57b6e1c5a627258617b8353e70533d"
38
+ "version": "0.5.8",
39
+ "gitHead": "645fab4e2e100b75403f362145d0edf3583bca5d"
40
40
  }