Replacing PouchDB indexes (used only to get the list of Gpxes by a custom implementation.
This commit is contained in:
parent
8c82b9c040
commit
3a5f5260c8
|
@ -27,7 +27,6 @@
|
|||
"ol": "^7.1.0",
|
||||
"pouchdb": "^7.3.1",
|
||||
"pouchdb-browser": "^7.3.1",
|
||||
"pouchdb-find": "^7.3.1",
|
||||
"solid-js": "^1.3.12"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -35,6 +34,7 @@
|
|||
"@testing-library/jest-dom": "^5.16.2",
|
||||
"@types/lodash": "^4.14.191",
|
||||
"@types/memoizee": "^0.4.8",
|
||||
"@types/pouchdb": "^6.4.0",
|
||||
"jsdom": ">19.0.0",
|
||||
"solid-testing-library": ">0.3.0",
|
||||
"typescript": "^4.6.2",
|
||||
|
@ -1383,6 +1383,15 @@
|
|||
"resolved": "https://registry.npmjs.org/@types/cordova/-/cordova-0.0.34.tgz",
|
||||
"integrity": "sha512-rkiiTuf/z2wTd4RxFOb+clE7PF4AEJU0hsczbUdkHHBtkUmpWQpEddynNfJYKYtZFJKbq4F+brfekt1kx85IZA=="
|
||||
},
|
||||
"node_modules/@types/debug": {
|
||||
"version": "4.1.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.7.tgz",
|
||||
"integrity": "sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/ms": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/fs-extra": {
|
||||
"version": "8.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-8.1.2.tgz",
|
||||
|
@ -1438,11 +1447,197 @@
|
|||
"integrity": "sha512-qDpXKGgwKywnQt/64fH1O0LiPA++QGIYeykEUiZ51HymKVRLnUSGcRuF60IfpPeeXiuRwiR/W4y7S5VzbrgLCA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/ms": {
|
||||
"version": "0.7.31",
|
||||
"resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.31.tgz",
|
||||
"integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "18.11.10",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.10.tgz",
|
||||
"integrity": "sha512-juG3RWMBOqcOuXC643OAdSA525V44cVgGV6dUDuiFtss+8Fk5x1hI93Rsld43VeJVIeqlP9I7Fn9/qaVqoEAuQ=="
|
||||
},
|
||||
"node_modules/@types/pouchdb": {
|
||||
"version": "6.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/pouchdb/-/pouchdb-6.4.0.tgz",
|
||||
"integrity": "sha512-eGCpX+NXhd5VLJuJMzwe3L79fa9+IDTrAG3CPaf4s/31PD56hOrhDJTSmRELSXuiqXr6+OHzzP0PldSaWsFt7w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/pouchdb-adapter-cordova-sqlite": "*",
|
||||
"@types/pouchdb-adapter-fruitdown": "*",
|
||||
"@types/pouchdb-adapter-http": "*",
|
||||
"@types/pouchdb-adapter-idb": "*",
|
||||
"@types/pouchdb-adapter-leveldb": "*",
|
||||
"@types/pouchdb-adapter-localstorage": "*",
|
||||
"@types/pouchdb-adapter-memory": "*",
|
||||
"@types/pouchdb-adapter-node-websql": "*",
|
||||
"@types/pouchdb-adapter-websql": "*",
|
||||
"@types/pouchdb-browser": "*",
|
||||
"@types/pouchdb-core": "*",
|
||||
"@types/pouchdb-http": "*",
|
||||
"@types/pouchdb-mapreduce": "*",
|
||||
"@types/pouchdb-node": "*",
|
||||
"@types/pouchdb-replication": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/pouchdb-adapter-cordova-sqlite": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/pouchdb-adapter-cordova-sqlite/-/pouchdb-adapter-cordova-sqlite-1.0.1.tgz",
|
||||
"integrity": "sha512-nqlXpW1ho3KBg1mUQvZgH2755y3z/rw4UA7ZJCPMRTHofxGMY8izRVw5rHBL4/7P615or0J2udpRYxgkT3D02g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/pouchdb-core": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/pouchdb-adapter-fruitdown": {
|
||||
"version": "6.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/pouchdb-adapter-fruitdown/-/pouchdb-adapter-fruitdown-6.1.3.tgz",
|
||||
"integrity": "sha512-Wz1Z1JLOW1hgmFQjqnSkmyyfH7by/iWb4abKn684WMvQfmxx6BxKJpJ4+eulkVPQzzgMMSgU1MpnQOm9FgRkbw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/pouchdb-core": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/pouchdb-adapter-http": {
|
||||
"version": "6.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/pouchdb-adapter-http/-/pouchdb-adapter-http-6.1.3.tgz",
|
||||
"integrity": "sha512-9Z4TLbF/KJWy/D2sWRPBA+RNU0odQimfdvlDX+EY7rGcd3aVoH8qjD/X0Xcd/0dfBH5pKrNIMFFQgW/TylRCmA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/pouchdb-core": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/pouchdb-adapter-idb": {
|
||||
"version": "6.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/pouchdb-adapter-idb/-/pouchdb-adapter-idb-6.1.4.tgz",
|
||||
"integrity": "sha512-KIAXbkF4uYUz0ZwfNEFLtEkK44mEWopAsD76UhucH92XnJloBysav+TjI4FFfYQyTjoW3S1s6V+Z14CUJZ0F6w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/pouchdb-core": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/pouchdb-adapter-leveldb": {
|
||||
"version": "6.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/pouchdb-adapter-leveldb/-/pouchdb-adapter-leveldb-6.1.3.tgz",
|
||||
"integrity": "sha512-ex8NFqQGFwEpFi7AaZ5YofmuemfZNsL3nTFZBUCAKYMBkazQij1pe2ILLStSvJr0XS0qxgXjCEW19T5Wqiiskg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/pouchdb-core": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/pouchdb-adapter-localstorage": {
|
||||
"version": "6.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/pouchdb-adapter-localstorage/-/pouchdb-adapter-localstorage-6.1.3.tgz",
|
||||
"integrity": "sha512-oor040tye1KKiGLWYtIy7rRT7C2yoyX3Tf6elEJRpjOA7Ja/H8lKc4LaSh9ATbptIcES6MRqZDxtp7ly9hsW3Q==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/pouchdb-core": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/pouchdb-adapter-memory": {
|
||||
"version": "6.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/pouchdb-adapter-memory/-/pouchdb-adapter-memory-6.1.3.tgz",
|
||||
"integrity": "sha512-gVbsIMzDzgZYThFVT4eVNsmuZwVm/4jDxP1sjlgc3qtDIxbtBhGgyNfcskwwz9Zu5Lv1avkDsIWvcxQhnvRlHg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/pouchdb-core": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/pouchdb-adapter-node-websql": {
|
||||
"version": "6.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/pouchdb-adapter-node-websql/-/pouchdb-adapter-node-websql-6.1.3.tgz",
|
||||
"integrity": "sha512-F/P+os6Jsa7CgHtH64+Z0HfwIcj0hIRB5z8gNhF7L7dxPWoAfkopK5H2gydrP3sQrlGyN4WInF+UJW/Zu1+FKg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/pouchdb-adapter-websql": "*",
|
||||
"@types/pouchdb-core": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/pouchdb-adapter-websql": {
|
||||
"version": "6.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/pouchdb-adapter-websql/-/pouchdb-adapter-websql-6.1.4.tgz",
|
||||
"integrity": "sha512-zMJQCtXC40hBsIDRn0GhmpeGMK0f9l/OGWfLguvczROzxxcOD7REI+e6SEmX7gJKw5JuMvlfuHzkQwjmvSJbtg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/pouchdb-core": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/pouchdb-browser": {
|
||||
"version": "6.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/pouchdb-browser/-/pouchdb-browser-6.1.3.tgz",
|
||||
"integrity": "sha512-EdYowrWxW9SWBMX/rux2eq7dbHi5Zeyzz+FF/IAsgQKnUxgeCO5VO2j4zTzos0SDyJvAQU+EYRc11r7xGn5tvA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/pouchdb-adapter-http": "*",
|
||||
"@types/pouchdb-adapter-idb": "*",
|
||||
"@types/pouchdb-adapter-websql": "*",
|
||||
"@types/pouchdb-core": "*",
|
||||
"@types/pouchdb-mapreduce": "*",
|
||||
"@types/pouchdb-replication": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/pouchdb-core": {
|
||||
"version": "7.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@types/pouchdb-core/-/pouchdb-core-7.0.10.tgz",
|
||||
"integrity": "sha512-mKhjLlWWXyV3PTTjDhzDV1kc2dolO7VYFa75IoKM/hr8Er9eo8RIbS7mJLfC8r/C3p6ihZu9yZs1PWC1LQ0SOA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/debug": "*",
|
||||
"@types/pouchdb-find": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/pouchdb-find": {
|
||||
"version": "7.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/pouchdb-find/-/pouchdb-find-7.3.0.tgz",
|
||||
"integrity": "sha512-sFPli5tBjGX9UfXioik1jUzPdcN84eV82n0lmEFuoPepWqkLjQcyri0eOa++HYOaNPyMDhKFBqEALEZivK2dRg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/pouchdb-core": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/pouchdb-http": {
|
||||
"version": "6.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/pouchdb-http/-/pouchdb-http-6.1.3.tgz",
|
||||
"integrity": "sha512-0e9E5SqNOyPl/3FnEIbENssB4FlJsNYuOy131nxrZk36S+y1R/6qO7ZVRypWpGTqBWSuVd7gCsq2UDwO/285+w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/pouchdb-adapter-http": "*",
|
||||
"@types/pouchdb-core": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/pouchdb-mapreduce": {
|
||||
"version": "6.1.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/pouchdb-mapreduce/-/pouchdb-mapreduce-6.1.7.tgz",
|
||||
"integrity": "sha512-WzBwm7tmO9QhfRzVaWT4v6JQSS/fG2OoUDrWrhX87rPe2Pn6laPvdK5li6myNRxCoI/l5e8Jd+oYBAFnaiFucA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/pouchdb-core": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/pouchdb-node": {
|
||||
"version": "6.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/pouchdb-node/-/pouchdb-node-6.1.4.tgz",
|
||||
"integrity": "sha512-wnTCH8X1JOPpNOfVhz8HW0AvmdHh6pt40MuRj0jQnK7QEHsHS79WujsKTKSOF8QXtPwpvCNSsI7ut7H7tfxxJQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/pouchdb-adapter-http": "*",
|
||||
"@types/pouchdb-adapter-leveldb": "*",
|
||||
"@types/pouchdb-core": "*",
|
||||
"@types/pouchdb-mapreduce": "*",
|
||||
"@types/pouchdb-replication": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/pouchdb-replication": {
|
||||
"version": "6.4.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/pouchdb-replication/-/pouchdb-replication-6.4.4.tgz",
|
||||
"integrity": "sha512-BsE5LKpjJK4iAf6Fx5kyrMw+33V+Ip7uWldUnU2BYrrvtR+MLD22dcImm7DZN1st2wPPb91i0XEnQzvP0w1C/Q==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/pouchdb-core": "*",
|
||||
"@types/pouchdb-find": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/slice-ansi": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/slice-ansi/-/slice-ansi-4.0.0.tgz",
|
||||
|
@ -4603,29 +4798,6 @@
|
|||
"vuvuzela": "1.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/pouchdb-abstract-mapreduce": {
|
||||
"version": "7.3.1",
|
||||
"resolved": "https://registry.npmjs.org/pouchdb-abstract-mapreduce/-/pouchdb-abstract-mapreduce-7.3.1.tgz",
|
||||
"integrity": "sha512-0zKXVFBvrfc1KnN0ggrB762JDmZnUpePHywo9Bq3Jy+L1FnoG7fXM5luFfvv5/T0gEw+ZTIwoocZECMnESBI9w==",
|
||||
"dependencies": {
|
||||
"pouchdb-binary-utils": "7.3.1",
|
||||
"pouchdb-collate": "7.3.1",
|
||||
"pouchdb-collections": "7.3.1",
|
||||
"pouchdb-errors": "7.3.1",
|
||||
"pouchdb-fetch": "7.3.1",
|
||||
"pouchdb-mapreduce-utils": "7.3.1",
|
||||
"pouchdb-md5": "7.3.1",
|
||||
"pouchdb-utils": "7.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/pouchdb-binary-utils": {
|
||||
"version": "7.3.1",
|
||||
"resolved": "https://registry.npmjs.org/pouchdb-binary-utils/-/pouchdb-binary-utils-7.3.1.tgz",
|
||||
"integrity": "sha512-crZJNfAEOnUoRk977Qtmk4cxEv6sNKllQ6vDDKgQrQLFjMUXma35EHzNyIJr1s76J77Q4sqKQAmxz9Y40yHGtw==",
|
||||
"dependencies": {
|
||||
"buffer-from": "1.1.2"
|
||||
}
|
||||
},
|
||||
"node_modules/pouchdb-browser": {
|
||||
"version": "7.3.1",
|
||||
"resolved": "https://registry.npmjs.org/pouchdb-browser/-/pouchdb-browser-7.3.1.tgz",
|
||||
|
@ -4639,92 +4811,6 @@
|
|||
"vuvuzela": "1.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/pouchdb-collate": {
|
||||
"version": "7.3.1",
|
||||
"resolved": "https://registry.npmjs.org/pouchdb-collate/-/pouchdb-collate-7.3.1.tgz",
|
||||
"integrity": "sha512-o4gyGqDMLMSNzf6EDTr3eHaH/JRMoqRhdc+eV+oA8u00nTBtr9wD+jypVe2LbgKLJ4NWqx2qVkXiTiQdUFtsLQ=="
|
||||
},
|
||||
"node_modules/pouchdb-collections": {
|
||||
"version": "7.3.1",
|
||||
"resolved": "https://registry.npmjs.org/pouchdb-collections/-/pouchdb-collections-7.3.1.tgz",
|
||||
"integrity": "sha512-yUyDqR+OJmtwgExOSJegpBJXDLAEC84TWnbAYycyh+DZoA51Yw0+XVQF5Vh8Ii90/Ut2xo88fmrmp0t6kqom8w=="
|
||||
},
|
||||
"node_modules/pouchdb-errors": {
|
||||
"version": "7.3.1",
|
||||
"resolved": "https://registry.npmjs.org/pouchdb-errors/-/pouchdb-errors-7.3.1.tgz",
|
||||
"integrity": "sha512-Zktz4gnXEUcZcty8FmyvtYUYsHskoST05m6H5/E2gg/0mCfEXq/XeyyLkZHaZmqD0ZPS9yNmASB1VaFWEKEaDw==",
|
||||
"dependencies": {
|
||||
"inherits": "2.0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/pouchdb-fetch": {
|
||||
"version": "7.3.1",
|
||||
"resolved": "https://registry.npmjs.org/pouchdb-fetch/-/pouchdb-fetch-7.3.1.tgz",
|
||||
"integrity": "sha512-205xAtvdHRPQ4fp1h9+RmT9oQabo9gafuPmWsS9aEl3ER54WbY8Vaj1JHZGbU4KtMTYvW7H5088zLS7Nrusuag==",
|
||||
"dependencies": {
|
||||
"abort-controller": "3.0.0",
|
||||
"fetch-cookie": "0.11.0",
|
||||
"node-fetch": "2.6.7"
|
||||
}
|
||||
},
|
||||
"node_modules/pouchdb-find": {
|
||||
"version": "7.3.1",
|
||||
"resolved": "https://registry.npmjs.org/pouchdb-find/-/pouchdb-find-7.3.1.tgz",
|
||||
"integrity": "sha512-AeqUfAVY1c7IFaY36BRT0vIz9r4VTKq/YOWTmiqndOZUQ/pDGxyO2fNFal6NN3PyYww0JijlD377cPvhnrhJVA==",
|
||||
"dependencies": {
|
||||
"pouchdb-abstract-mapreduce": "7.3.1",
|
||||
"pouchdb-collate": "7.3.1",
|
||||
"pouchdb-errors": "7.3.1",
|
||||
"pouchdb-fetch": "7.3.1",
|
||||
"pouchdb-md5": "7.3.1",
|
||||
"pouchdb-selector-core": "7.3.1",
|
||||
"pouchdb-utils": "7.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/pouchdb-mapreduce-utils": {
|
||||
"version": "7.3.1",
|
||||
"resolved": "https://registry.npmjs.org/pouchdb-mapreduce-utils/-/pouchdb-mapreduce-utils-7.3.1.tgz",
|
||||
"integrity": "sha512-oUMcq82+4pTGQ6dtrhgORHOVHZSr6w/5tFIUGlv7RABIDvJarL4snMawADjlpiEwPdiQ/ESG8Fqt8cxqvqsIgg==",
|
||||
"dependencies": {
|
||||
"argsarray": "0.0.1",
|
||||
"inherits": "2.0.4",
|
||||
"pouchdb-collections": "7.3.1",
|
||||
"pouchdb-utils": "7.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/pouchdb-md5": {
|
||||
"version": "7.3.1",
|
||||
"resolved": "https://registry.npmjs.org/pouchdb-md5/-/pouchdb-md5-7.3.1.tgz",
|
||||
"integrity": "sha512-aDV8ui/mprnL3xmt0gT/81DFtTtJiKyn+OxIAbwKPMfz/rDFdPYvF0BmDC9QxMMzGfkV+JJUjU6at0PPs2mRLg==",
|
||||
"dependencies": {
|
||||
"pouchdb-binary-utils": "7.3.1",
|
||||
"spark-md5": "3.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/pouchdb-selector-core": {
|
||||
"version": "7.3.1",
|
||||
"resolved": "https://registry.npmjs.org/pouchdb-selector-core/-/pouchdb-selector-core-7.3.1.tgz",
|
||||
"integrity": "sha512-HBX+nNGXcaL9z0uNpwSMRq2GNZd3EZXW+fe9rJHS0hvJohjZL7aRJLoaXfEdHPRTNW+CpjM3Rny60eGekQdI/w==",
|
||||
"dependencies": {
|
||||
"pouchdb-collate": "7.3.1",
|
||||
"pouchdb-utils": "7.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/pouchdb-utils": {
|
||||
"version": "7.3.1",
|
||||
"resolved": "https://registry.npmjs.org/pouchdb-utils/-/pouchdb-utils-7.3.1.tgz",
|
||||
"integrity": "sha512-R3hHBo1zTdTu/NFs3iqkcaQAPwhIH0gMIdfVKd5lbDYlmP26rCG5pdS+v7NuoSSFLJ4xxnaGV+Gjf4duYsJ8wQ==",
|
||||
"dependencies": {
|
||||
"argsarray": "0.0.1",
|
||||
"clone-buffer": "1.0.0",
|
||||
"immediate": "3.3.0",
|
||||
"inherits": "2.0.4",
|
||||
"pouchdb-collections": "7.3.1",
|
||||
"pouchdb-errors": "7.3.1",
|
||||
"pouchdb-md5": "7.3.1",
|
||||
"uuid": "8.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/pouchdb/node_modules/string_decoder": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
"@testing-library/jest-dom": "^5.16.2",
|
||||
"@types/lodash": "^4.14.191",
|
||||
"@types/memoizee": "^0.4.8",
|
||||
"@types/pouchdb": "^6.4.0",
|
||||
"jsdom": ">19.0.0",
|
||||
"solid-testing-library": ">0.3.0",
|
||||
"typescript": "^4.6.2",
|
||||
|
@ -42,7 +43,6 @@
|
|||
"ol": "^7.1.0",
|
||||
"pouchdb": "^7.3.1",
|
||||
"pouchdb-browser": "^7.3.1",
|
||||
"pouchdb-find": "^7.3.1",
|
||||
"solid-js": "^1.3.12"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { getWpt } from '../db/wpt';
|
||||
import { returnAgain } from '../workers/dispatcher-worker';
|
||||
import { getAllGpxes, getGpx } from './gpx';
|
||||
import { put } from './lib';
|
||||
import { getRte } from './rte';
|
||||
import { getTrk } from './trk';
|
||||
import { getTrkseg } from './trkseg';
|
||||
|
@ -38,6 +39,25 @@ const changeHandler = async (change: any) => {
|
|||
sendUpdate(globalThis.watches.get(id));
|
||||
|
||||
const parentId = id.substring(0, id.lastIndexOf('/'));
|
||||
|
||||
if (parentId === 'gpx') {
|
||||
const gpxes = await getAllGpxes();
|
||||
console.log({ caller: 'changeHandler / gpxes', gpxes, id });
|
||||
if (!(id in gpxes)) {
|
||||
await put(
|
||||
parentId,
|
||||
`idx-${parentId}`,
|
||||
(doc) => {
|
||||
console.log({ caller: 'changeHandler / gpxes', doc });
|
||||
doc.push(id);
|
||||
doc.sort().reverse();
|
||||
return doc;
|
||||
},
|
||||
[]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
sendUpdate(globalThis.watches.get(parentId));
|
||||
};
|
||||
|
||||
|
|
|
@ -186,6 +186,7 @@ const extensionsFromGpx = (gpx: Gpx) => {
|
|||
};
|
||||
|
||||
export const pruneAndSaveImportedGpx = async (params: any) => {
|
||||
console.log({ caller: 'pruneAndSaveImportedGpx', params });
|
||||
const { id, gpx, extensions } = params;
|
||||
let docs: any[] = [
|
||||
{ _id: getUri('gpx', id), type: 'gpx', doc: gpx },
|
||||
|
@ -206,32 +207,11 @@ export const pruneAndSaveImportedGpx = async (params: any) => {
|
|||
};
|
||||
|
||||
export const getAllGpxes = async () => {
|
||||
return (await getDocsByType('gpx')).map((doc: any) => doc._id);
|
||||
};
|
||||
|
||||
export const getGpxesForViewport = async (params: any) => {
|
||||
const { viewport, zoomLevel } = params;
|
||||
const zoomedViewport: Rectangle = {
|
||||
topLeft: {
|
||||
x: viewport.topLeft.x / 2 ** zoomLevel,
|
||||
y: viewport.topLeft.y / 2 ** zoomLevel,
|
||||
},
|
||||
bottomRight: {
|
||||
x: (viewport.bottomRight.x + 1) / 2 ** zoomLevel,
|
||||
y: (viewport.bottomRight.y + 1) / 2 ** zoomLevel,
|
||||
},
|
||||
};
|
||||
const allExtensions = await getDocsByType('extensions');
|
||||
console.log(
|
||||
`getGpxesForViewport, allExtensions: ${JSON.stringify(allExtensions)}`
|
||||
);
|
||||
return allExtensions
|
||||
.filter((extensions: any) => {
|
||||
return rectanglesIntersect(zoomedViewport, extensions.doc.viewport);
|
||||
})
|
||||
.map((extensions: any) =>
|
||||
getUri('gpx', getUri('extensions', extensions._id))
|
||||
);
|
||||
try {
|
||||
return (await get('gpx')).doc;
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
export const appendToArray = (target: any, key: string, value: any) => {
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
import _ from 'lodash';
|
||||
import PouchDB from 'pouchdb';
|
||||
import PouchDBFind from 'pouchdb-find';
|
||||
import uri from '../lib/ids';
|
||||
import changeHandler from './change-handler';
|
||||
|
||||
PouchDB.plugin(PouchDBFind);
|
||||
|
||||
const dbDefinitionId = uri('dbdef', {});
|
||||
|
||||
const currentDbDefinition = {
|
||||
|
@ -25,7 +22,7 @@ export const initDb = async (params: any) => {
|
|||
if (globalThis.db === undefined) {
|
||||
globalThis.db = new PouchDB('dyomedea', {
|
||||
auto_compaction: false,
|
||||
// revs_limit: 10,
|
||||
// revs_limit: 10,
|
||||
});
|
||||
}
|
||||
const db = globalThis.db;
|
||||
|
@ -51,48 +48,6 @@ export const initDb = async (params: any) => {
|
|||
// TODO: support migrations
|
||||
}
|
||||
//await await db.compact();
|
||||
await db.viewCleanup();
|
||||
|
||||
// WARNING: defs must use the canonical form and be identical to what will be returned by db.getIndexes
|
||||
const requiredIndexes: any = [
|
||||
{
|
||||
name: 'type',
|
||||
def: {
|
||||
fields: [{ type: 'asc' }],
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const existingIndexes = (await db.getIndexes()).indexes;
|
||||
|
||||
const pruneIndex = ({ name, def }: any) => ({ name, def });
|
||||
|
||||
const isSameIndex = (idx1: any, idx2: any) => {
|
||||
return _.isEqual(pruneIndex(idx1), pruneIndex(idx2));
|
||||
};
|
||||
|
||||
const findIndex = (targetIndexes: any, index: any) =>
|
||||
targetIndexes.find((targetIndex: any) => {
|
||||
return isSameIndex(targetIndex, index);
|
||||
});
|
||||
|
||||
for (var index of existingIndexes) {
|
||||
if (index.type === 'json') {
|
||||
// Non system indexes
|
||||
// console.log(`Checking existing index :${JSON.stringify(index)}`);
|
||||
if (!findIndex(requiredIndexes, index)) {
|
||||
// console.log(`db.deleteIndex(${JSON.stringify(index)})`);
|
||||
await db.deleteIndex(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (index of requiredIndexes) {
|
||||
if (!findIndex(existingIndexes, index)) {
|
||||
// console.log(`db.createIndex(${JSON.stringify(index)})`);
|
||||
await db.createIndex({ name: index.name, ...index.def });
|
||||
}
|
||||
}
|
||||
|
||||
globalThis.dbReady = true;
|
||||
|
||||
|
@ -111,26 +66,4 @@ export const initDb = async (params: any) => {
|
|||
// console.log({ caller: 'initDb / back from db.changes', changes });
|
||||
|
||||
// changes.cancel();
|
||||
|
||||
/* const indexes = await db.getIndexes();
|
||||
console.log(`indexes: ${JSON.stringify(indexes)}`);
|
||||
|
||||
const explain1 = await db.explain({
|
||||
selector: {
|
||||
type: 'trkpt',
|
||||
gpx: 'xxxx',
|
||||
},
|
||||
// sort: ['trkpt.time'],
|
||||
// use_index: 'type-trkpt-gpx-time',
|
||||
});
|
||||
console.log(`explain1: ${JSON.stringify(explain1)}`);
|
||||
const explain2 = await db.explain({
|
||||
selector: {
|
||||
type: 'gpx',
|
||||
},
|
||||
// sort: ['trkpt.time'],
|
||||
// use_index: 'type-trkpt-gpx-time',
|
||||
});
|
||||
console.log(`explain2: ${JSON.stringify(explain2)}`);
|
||||
*/
|
||||
};
|
||||
|
|
|
@ -46,7 +46,3 @@ export const get = async (id: string) => {
|
|||
export const putAll = async (docs: any[]) => {
|
||||
return await db.bulkDocs(docs);
|
||||
};
|
||||
|
||||
export const getDocsByType = async (type: string) => {
|
||||
return (await db.find({ selector: { type: type } })).docs;
|
||||
};
|
||||
|
|
|
@ -50,6 +50,5 @@ const halfMinDate = minDate / 2;
|
|||
const maxDate = 8640000000000000;
|
||||
const halfMaxDate = maxDate / 2;
|
||||
|
||||
export const intToGpxId = (i: number) => halfMaxDate - Math.round(i / 2);
|
||||
|
||||
export const intToTrkptId = (i: number) => Math.round(i / 2) - halfMinDate;
|
||||
export const intToGpxId = intToTrkptId;
|
||||
|
|
|
@ -5,7 +5,6 @@ import {
|
|||
putNewGpx,
|
||||
existsGpx,
|
||||
pruneAndSaveImportedGpx,
|
||||
getGpxesForViewport,
|
||||
getGpx,
|
||||
getAllGpxes,
|
||||
} from '../db/gpx';
|
||||
|
@ -25,7 +24,6 @@ onmessage = async function (e) {
|
|||
existsGpx,
|
||||
pruneAndSaveImportedGpx,
|
||||
getAllGpxes,
|
||||
getGpxesForViewport,
|
||||
getGpx,
|
||||
getTrk,
|
||||
getTrkseg,
|
||||
|
|
Loading…
Reference in New Issue