| 
									
										
										
										
											2022-08-04 11:00:21 +03:00
										 |  |  | /********************************************************************** | 
					
						
							|  |  |  | *  | 
					
						
							|  |  |  | * | 
					
						
							|  |  |  | * | 
					
						
							|  |  |  | **********************************************************************/ | 
					
						
							|  |  |  | ((typeof define)[0]=='u'?function(f){module.exports=f(require)}:define) | 
					
						
							|  |  |  | (function(require){ var module={} // make module AMD/node compatible...
 | 
					
						
							|  |  |  | /*********************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | var object = require('ig-object') | 
					
						
							|  |  |  | var types = require('ig-types') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-05 18:26:37 +03:00
										 |  |  | var pwpath = require('./pwiki/path') | 
					
						
							|  |  |  | var page = require('./pwiki/page') | 
					
						
							| 
									
										
										
										
											2022-08-04 11:00:21 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-05 18:26:37 +03:00
										 |  |  | var basestore = require('./pwiki/store/base') | 
					
						
							|  |  |  | var localstoragestore = require('./pwiki/store/localstorage') | 
					
						
							| 
									
										
										
										
											2022-10-10 01:10:32 +03:00
										 |  |  | var indexeddb = require('./pwiki/store/indexeddb') | 
					
						
							| 
									
										
										
										
											2022-08-04 11:00:21 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-05 18:26:37 +03:00
										 |  |  | var pouchdbstore = require('./pwiki/store/pouchdb') | 
					
						
							| 
									
										
										
										
											2022-08-04 11:00:21 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | // XXX this fails silently in browser...
 | 
					
						
							|  |  |  | //var bootstrap = require('./bootstrap')
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-04 14:29:25 +03:00
										 |  |  | //---------------------------------------------------------------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | var store =  | 
					
						
							| 
									
										
										
										
											2022-09-01 01:14:34 +03:00
										 |  |  | /* XXX the store cache is not working correctly yet -- should be global  | 
					
						
							|  |  |  | // 		and not local to a specific store...
 | 
					
						
							|  |  |  | // 		...i.e. likely like MetaStore, it should be Level-2...
 | 
					
						
							|  |  |  | module.store = object.mixin({  | 
					
						
							|  |  |  | 	__proto__: localstoragestore.localStorageStore, | 
					
						
							|  |  |  | 	__prefix__: '--pwiki-root:', | 
					
						
							|  |  |  | 	data: localStorage, | 
					
						
							|  |  |  | 	next: { __proto__: basestore.Store }, | 
					
						
							|  |  |  | }, basestore.CachedStoreMixin) | 
					
						
							|  |  |  | /*/ | 
					
						
							| 
									
										
										
										
											2022-08-26 18:16:07 +03:00
										 |  |  | module.store = {  | 
					
						
							|  |  |  | 	__proto__: localstoragestore.localStorageStore, | 
					
						
							|  |  |  | 	__prefix__: '--pwiki-root:', | 
					
						
							|  |  |  | 	data: localStorage, | 
					
						
							| 
									
										
										
										
											2022-09-01 01:14:34 +03:00
										 |  |  | 	next: { __proto__: basestore.Store }, | 
					
						
							| 
									
										
										
										
											2022-08-26 18:16:07 +03:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2022-09-01 01:14:34 +03:00
										 |  |  | //*/
 | 
					
						
							| 
									
										
										
										
											2022-08-04 14:29:25 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-16 11:00:23 +03:00
										 |  |  | module.setup =  | 
					
						
							|  |  |  | Promise.all([ | 
					
						
							|  |  |  | 	// static stores...
 | 
					
						
							|  |  |  | 	//
 | 
					
						
							| 
									
										
										
										
											2022-09-17 17:13:23 +03:00
										 |  |  | 	//store.next.update('System', 
 | 
					
						
							|  |  |  | 	store.next.update( | 
					
						
							|  |  |  | 		pwpath.sanitize(pwpath.SYSTEM_PATH), | 
					
						
							| 
									
										
										
										
											2022-08-20 09:37:05 +03:00
										 |  |  | 		Object.create(basestore.BaseStore).load(page.System)), | 
					
						
							| 
									
										
										
										
											2022-09-22 03:27:02 +03:00
										 |  |  | 	store.next.update('.templates', | 
					
						
							|  |  |  | 		Object.create(basestore.BaseStore).load(page.Templates)), | 
					
						
							| 
									
										
										
										
											2022-09-18 20:45:55 +03:00
										 |  |  | 	store.update('.config',  | 
					
						
							|  |  |  | 		Object.create(basestore.BaseStore).load(page.Config)), | 
					
						
							| 
									
										
										
										
											2022-09-22 03:27:02 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-20 09:37:05 +03:00
										 |  |  | 	store.update('Test',  | 
					
						
							|  |  |  | 		Object.create(basestore.BaseStore).load(page.Test)), | 
					
						
							| 
									
										
										
										
											2022-08-16 11:00:23 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// persistent stores...
 | 
					
						
							|  |  |  | 	//
 | 
					
						
							| 
									
										
										
										
											2022-10-15 13:42:51 +03:00
										 |  |  | 	store.update('Stores/localStorage', { | 
					
						
							| 
									
										
										
										
											2022-08-16 11:00:23 +03:00
										 |  |  | 		__proto__: localstoragestore.localStorageStore, | 
					
						
							| 
									
										
										
										
											2022-10-15 13:42:51 +03:00
										 |  |  | 		__prefix__: '--pwiki-nested:', | 
					
						
							| 
									
										
										
										
											2022-08-16 11:00:23 +03:00
										 |  |  | 		data: localStorage, | 
					
						
							|  |  |  | 	}), | 
					
						
							| 
									
										
										
										
											2022-10-10 18:44:00 +03:00
										 |  |  | 	store.update('Stores/sessionStorage', { | 
					
						
							| 
									
										
										
										
											2022-08-16 11:00:23 +03:00
										 |  |  | 		__proto__: localstoragestore.localStorageStore, | 
					
						
							|  |  |  | 		data: sessionStorage, | 
					
						
							|  |  |  | 	}), | 
					
						
							| 
									
										
										
										
											2022-10-10 18:44:00 +03:00
										 |  |  | 	store.update('Stores/PouchDB', { | 
					
						
							| 
									
										
										
										
											2022-08-16 11:00:23 +03:00
										 |  |  | 		__proto__: pouchdbstore.PouchDBStore, | 
					
						
							|  |  |  | 	}), | 
					
						
							| 
									
										
										
										
											2022-10-10 18:44:00 +03:00
										 |  |  | 	store.update('Stores/IndexedDB', { | 
					
						
							| 
									
										
										
										
											2022-10-10 01:10:32 +03:00
										 |  |  | 		__proto__: indexeddb.IndexedDBStore, | 
					
						
							|  |  |  | 	}), | 
					
						
							| 
									
										
										
										
											2022-10-15 13:42:51 +03:00
										 |  |  | 	store.update('/Stores/memory', { | 
					
						
							| 
									
										
										
										
											2022-10-12 03:25:07 +03:00
										 |  |  | 		__proto__: basestore.MetaStore, | 
					
						
							|  |  |  | 		data: { | 
					
						
							|  |  |  | 			'': {text: 'memory store'}, | 
					
						
							|  |  |  | 			moo: {text: 'moo'}, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 	}), | 
					
						
							| 
									
										
										
										
											2022-08-28 10:02:58 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-28 16:34:46 +03:00
										 |  |  | 	/*/ XXX next testing... | 
					
						
							| 
									
										
										
										
											2022-08-28 10:02:58 +03:00
										 |  |  | 	store.next.update('NextPage', { | 
					
						
							|  |  |  | 		text: 'next page...', | 
					
						
							|  |  |  | 	}), | 
					
						
							|  |  |  | 	store.next.update('Next', { | 
					
						
							|  |  |  | 		__proto__: localstoragestore.localStorageStore, | 
					
						
							|  |  |  | 		__prefix__: '--pwiki-next:', | 
					
						
							|  |  |  | 		data: localStorage, | 
					
						
							|  |  |  | 	}), | 
					
						
							|  |  |  | 	store.next.update('Next/Test', {  | 
					
						
							|  |  |  | 		text: 'next test..' | 
					
						
							|  |  |  | 	}), | 
					
						
							|  |  |  | 	// XXX not sure of we need this to work...
 | 
					
						
							|  |  |  | 	store.next.update('System/NextTest', {  | 
					
						
							|  |  |  | 		text: 'next test..' | 
					
						
							|  |  |  | 	}), | 
					
						
							| 
									
										
										
										
											2022-08-28 16:34:46 +03:00
										 |  |  | 	//*/
 | 
					
						
							| 
									
										
										
										
											2022-08-16 11:00:23 +03:00
										 |  |  | ]) | 
					
						
							|  |  |  | // XXX
 | 
					
						
							|  |  |  | //typeof(Bootstrap) != 'undefined'
 | 
					
						
							|  |  |  | //	&& pwiki.store.load(Bootstrap)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-04 14:29:25 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | var pwiki = | 
					
						
							|  |  |  | module.pwiki =  | 
					
						
							| 
									
										
										
										
											2022-08-06 11:09:25 +03:00
										 |  |  | 	// XXX
 | 
					
						
							| 
									
										
										
										
											2022-08-10 11:42:31 +03:00
										 |  |  | 	//page.Page('/', '/', store)
 | 
					
						
							|  |  |  | 	page.pWikiPageElement('/', '/', store) | 
					
						
							| 
									
										
										
										
											2022-08-04 14:29:25 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-04 11:00:21 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | /********************************************************************** | 
					
						
							|  |  |  | * vim:set ts=4 sw=4 :                               */ return module }) |