mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-30 10:30:08 +00:00
reworked .names() and some fixes and tweaks...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
498536695f
commit
71be07be39
@ -76,6 +76,13 @@ Promise.all([
|
|||||||
store.update('Stores/IndexedDB', {
|
store.update('Stores/IndexedDB', {
|
||||||
__proto__: indexeddb.IndexedDBStore,
|
__proto__: indexeddb.IndexedDBStore,
|
||||||
}),
|
}),
|
||||||
|
store.update('Stores/memory', {
|
||||||
|
__proto__: basestore.MetaStore,
|
||||||
|
data: {
|
||||||
|
'': {text: 'memory store'},
|
||||||
|
moo: {text: 'moo'},
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
|
||||||
/*/ XXX next testing...
|
/*/ XXX next testing...
|
||||||
store.next.update('NextPage', {
|
store.next.update('NextPage', {
|
||||||
|
|||||||
@ -168,24 +168,15 @@ module.BaseStore = {
|
|||||||
.concat((!local && (this.next || {}).paths) ?
|
.concat((!local && (this.next || {}).paths) ?
|
||||||
this.next.paths()
|
this.next.paths()
|
||||||
: []) },
|
: []) },
|
||||||
|
// XXX BUG: after caching this will ignore the local argument....
|
||||||
// local names...
|
names: cached('names', async function(local=false){
|
||||||
__names: cached('names', async function(){
|
return this.paths(local)
|
||||||
return this.__paths()
|
|
||||||
.iter()
|
.iter()
|
||||||
.reduce(function(res, path){
|
.reduce(function(res, path){
|
||||||
var n = pwpath.basename(path)
|
var n = pwpath.basename(path)
|
||||||
if(!n.includes('*')){
|
if(!n.includes('*')){
|
||||||
(res[n] = res[n] ?? []).push(path) }
|
(res[n] = res[n] ?? []).push(path) }
|
||||||
return res }, {}) }),
|
return res }, {}) }),
|
||||||
// XXX should this also be cached???
|
|
||||||
names: async function(local=false){
|
|
||||||
return {
|
|
||||||
...(!local && (this.next || {}).names ?
|
|
||||||
await this.next.names()
|
|
||||||
: {}),
|
|
||||||
...await this.__names(),
|
|
||||||
} },
|
|
||||||
|
|
||||||
// XXX sort paths based on search order into three groups:
|
// XXX sort paths based on search order into three groups:
|
||||||
// - non-system
|
// - non-system
|
||||||
@ -713,18 +704,6 @@ module.MetaStore = {
|
|||||||
return object.parentCall(MetaStore.paths, this, ...arguments)
|
return object.parentCall(MetaStore.paths, this, ...arguments)
|
||||||
.iter()
|
.iter()
|
||||||
.concat(stores) },
|
.concat(stores) },
|
||||||
names: async function(){
|
|
||||||
var that = this
|
|
||||||
var res = await object.parentCall(MetaStore.names, this, ...arguments)
|
|
||||||
await Promise.all(Object.entries(this.substores ?? {})
|
|
||||||
.map(async function([path, store]){
|
|
||||||
return Object.entries(await store.names())
|
|
||||||
.map(function([name, paths]){
|
|
||||||
res[name] = (res[name] ?? [])
|
|
||||||
.concat(paths
|
|
||||||
.map(function(s){
|
|
||||||
return pwpath.join(path, s) })) }) }))
|
|
||||||
return res },
|
|
||||||
|
|
||||||
exists: metaProxy('exists',
|
exists: metaProxy('exists',
|
||||||
//async function(path){
|
//async function(path){
|
||||||
|
|||||||
@ -17,12 +17,8 @@
|
|||||||
* - CLI
|
* - CLI
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* XXX BUG: can't .get(..) data from substore root...
|
* XXX BUG: when editing the root page of a substore the page's .cache is
|
||||||
* ...updating it seems to work fine...
|
* not reset for some reason...
|
||||||
* XXX IndexedDB: after editing a page for some reason we do not see the
|
|
||||||
* final version until a full refresh -- cache???
|
|
||||||
* ...this seems to disappeared after moving external stores
|
|
||||||
* from / to /Stores...
|
|
||||||
* XXX Chrome started spamming CORS error:
|
* XXX Chrome started spamming CORS error:
|
||||||
* Access to manifest at 'file:///L:/work/pWiki/manifest.json'
|
* Access to manifest at 'file:///L:/work/pWiki/manifest.json'
|
||||||
* from origin 'null' ...
|
* from origin 'null' ...
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user