vue3-pouch 0.0.6 → 0.0.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/dist/index.js CHANGED
@@ -16,8 +16,11 @@ function usePouchRef(config, db) {
16
16
  since: "now",
17
17
  live: true
18
18
  }).on("change", async () => {
19
- if (config === "all") contentWrite.value = await db.allDocs();
19
+ if (config === "all") contentWrite.value = (await db.allDocs({ include_docs: true })).rows.map((d) => {
20
+ return d.doc;
21
+ });
20
22
  else if (typeof config === "string") contentWrite.value = await db.get(config);
23
+ else if (config.limit === 1) contentWrite.value = (await db.find(config)).docs[0];
21
24
  else contentWrite.value = (await db.find(config)).docs;
22
25
  });
23
26
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue3-pouch",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -36,13 +36,22 @@ export function usePouchRef<TContent extends TDatabaseType,
36
36
  live: true
37
37
  }).on('change', async () => {
38
38
  if (config === "all") {
39
- contentWrite.value = await db.allDocs()
39
+ contentWrite.value = (await db.allDocs({
40
+ include_docs: true
41
+ })).rows.map((d) => {
42
+ return d.doc!
43
+ })
40
44
  }
41
45
  else if (typeof config === 'string') {
42
46
  contentWrite.value = await db.get(config)
43
47
  }
44
48
  else {
45
- contentWrite.value = (await db.find(config)).docs
49
+ if (config.limit === 1) {
50
+ contentWrite.value = (await db.find(config)).docs[0]
51
+ }
52
+ else {
53
+ contentWrite.value = (await db.find(config)).docs
54
+ }
46
55
  }
47
56
  })
48
57
  })