(viewOpts)
| 8855 | } |
| 8856 | |
| 8857 | async function fetchFromView(viewOpts) { |
| 8858 | viewOpts.include_docs = true; |
| 8859 | const res$$1 = await view.db.allDocs(viewOpts); |
| 8860 | totalRows = res$$1.total_rows; |
| 8861 | |
| 8862 | return res$$1.rows.map(function (result) { |
| 8863 | // implicit migration - in older versions of PouchDB, |
| 8864 | // we explicitly stored the doc as {id: ..., key: ..., value: ...} |
| 8865 | // this is tested in a migration test |
| 8866 | /* istanbul ignore next */ |
| 8867 | if ('value' in result.doc && typeof result.doc.value === 'object' && |
| 8868 | result.doc.value !== null) { |
| 8869 | const keys = Object.keys(result.doc.value).sort(); |
| 8870 | // this detection method is not perfect, but it's unlikely the user |
| 8871 | // emitted a value which was an object with these 3 exact keys |
| 8872 | const expectedKeys = ['id', 'key', 'value']; |
| 8873 | if (!(keys < expectedKeys || keys > expectedKeys)) { |
| 8874 | return result.doc.value; |
| 8875 | } |
| 8876 | } |
| 8877 | |
| 8878 | const parsedKeyAndDocId = parseIndexableString(result.doc._id); |
| 8879 | return { |
| 8880 | key: parsedKeyAndDocId[0], |
| 8881 | id: parsedKeyAndDocId[1], |
| 8882 | value: ('value' in result.doc ? result.doc.value : null) |
| 8883 | }; |
| 8884 | }); |
| 8885 | } |
| 8886 | |
| 8887 | async function onMapResultsReady(rows) { |
| 8888 | let finalResults; |
no test coverage detected
searching dependent graphs…