@xwiki/cristal-backend-dexie 0.14.0 → 0.15.0
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/CHANGELOG.md +13 -0
- package/dist/index.es.js +17 -17
- package/dist/index.umd.js +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @xwiki/cristal-backend-dexie
|
|
2
2
|
|
|
3
|
+
## 0.15.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Cristal 0.15 Release
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @xwiki/cristal-api@0.15.0
|
|
13
|
+
- @xwiki/cristal-backend-api@0.15.0
|
|
14
|
+
- @xwiki/cristal-sharedworker-api@0.15.0
|
|
15
|
+
|
|
3
16
|
## 0.14.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { DefaultPageData as
|
|
3
|
-
import { injectable as
|
|
4
|
-
class d extends
|
|
1
|
+
import u from "dexie";
|
|
2
|
+
import { DefaultPageData as h } from "@xwiki/cristal-api";
|
|
3
|
+
import { injectable as c, inject as i } from "inversify";
|
|
4
|
+
class d extends u {
|
|
5
5
|
constructor(t) {
|
|
6
6
|
super("pages_" + t), this.version(2).stores({
|
|
7
7
|
pages: (
|
|
@@ -11,11 +11,11 @@ class d extends h {
|
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
var p = Object.defineProperty, S = Object.getOwnPropertyDescriptor,
|
|
14
|
+
var p = Object.defineProperty, S = Object.getOwnPropertyDescriptor, m = (e, t, o, r) => {
|
|
15
15
|
for (var g = r > 1 ? void 0 : r ? S(t, o) : t, a = e.length - 1, s; a >= 0; a--)
|
|
16
16
|
(s = e[a]) && (g = (r ? s(t, o, g) : s(g)) || g);
|
|
17
17
|
return r && g && p(t, o, g), g;
|
|
18
|
-
},
|
|
18
|
+
}, P = (e, t) => (o, r) => t(o, r, e);
|
|
19
19
|
let l = class {
|
|
20
20
|
constructor(e) {
|
|
21
21
|
this.pageStorageMap = /* @__PURE__ */ new Map(), this.logger = e, this.logger.setModule("storage.components.dexieOfflineStorage");
|
|
@@ -29,7 +29,7 @@ let l = class {
|
|
|
29
29
|
this.logger.debug("Ready to load page from local storage", t);
|
|
30
30
|
const o = this.getPageStorage(e);
|
|
31
31
|
this.logger.debug("pageStorage is ready, asking for page");
|
|
32
|
-
const r = await o.pages.get(t), g = new
|
|
32
|
+
const r = await o.pages.get(t), g = new h();
|
|
33
33
|
return g.fromObject(r), g;
|
|
34
34
|
} catch (o) {
|
|
35
35
|
this.logger.debug("Exception while trying to read from local storage", o);
|
|
@@ -64,16 +64,16 @@ let l = class {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
|
-
l =
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
l = m([
|
|
68
|
+
c(),
|
|
69
|
+
P(0, i("Logger"))
|
|
70
70
|
], l);
|
|
71
|
-
var
|
|
71
|
+
var v = Object.defineProperty, b = Object.getOwnPropertyDescriptor, _ = (e, t, o, r) => {
|
|
72
72
|
for (var g = r > 1 ? void 0 : r ? b(t, o) : t, a = e.length - 1, s; a >= 0; a--)
|
|
73
73
|
(s = e[a]) && (g = (r ? s(t, o, g) : s(g)) || g);
|
|
74
|
-
return r && g &&
|
|
74
|
+
return r && g && v(t, o, g), g;
|
|
75
75
|
}, n = (e, t) => (o, r) => t(o, r, e);
|
|
76
|
-
let
|
|
76
|
+
let f = class {
|
|
77
77
|
constructor(e, t, o) {
|
|
78
78
|
this.logger = e, this.logger.setModule("storage.components.wrappingOfflineStorage"), this.offlineStorage = t, this.queueWorker = o;
|
|
79
79
|
}
|
|
@@ -173,15 +173,15 @@ let c = class {
|
|
|
173
173
|
return this.storage.move(e, t, o);
|
|
174
174
|
}
|
|
175
175
|
};
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
f = _([
|
|
177
|
+
c(),
|
|
178
178
|
n(0, i("Logger")),
|
|
179
179
|
n(1, i("OfflineStorage")),
|
|
180
180
|
n(2, i("QueueWorker"))
|
|
181
|
-
],
|
|
181
|
+
], f);
|
|
182
182
|
class W {
|
|
183
183
|
constructor(t) {
|
|
184
|
-
t.bind("WrappingStorage").to(
|
|
184
|
+
t.bind("WrappingStorage").to(f).inSingletonScope(), t.bind("OfflineStorage").to(l).inSingletonScope();
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
export {
|
package/dist/index.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(a,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("dexie"),require("@xwiki/cristal-api"),require("inversify")):typeof define=="function"&&define.amd?define(["exports","dexie","@xwiki/cristal-api","inversify"],l):(a=typeof globalThis<"u"?globalThis:a||self,l(a["cristal_backend-dexie"]={},a.Dexie,a.cristalApi,a.inversify))})(this,function(a,l,h,
|
|
1
|
+
(function(a,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("dexie"),require("@xwiki/cristal-api"),require("inversify")):typeof define=="function"&&define.amd?define(["exports","dexie","@xwiki/cristal-api","inversify"],l):(a=typeof globalThis<"u"?globalThis:a||self,l(a["cristal_backend-dexie"]={},a.Dexie,a.cristalApi,a.inversify))})(this,function(a,l,h,s){"use strict";class d extends l{constructor(t){super("pages_"+t),this.version(2).stores({pages:"id, name, content, document, css, js, document.name, document.headline, document.creator"})}}var p=Object.defineProperty,S=Object.getOwnPropertyDescriptor,P=(e,t,o,r)=>{for(var g=r>1?void 0:r?S(t,o):t,i=e.length-1,n;i>=0;i--)(n=e[i])&&(g=(r?n(t,o,g):n(g))||g);return r&&g&&p(t,o,g),g},m=(e,t)=>(o,r)=>t(o,r,e);let c=class{constructor(e){this.pageStorageMap=new Map,this.logger=e,this.logger.setModule("storage.components.dexieOfflineStorage")}getPageStorage(e){let t=this.pageStorageMap.get(e);return t==null&&(t=new d(e),this.pageStorageMap.set(e,t)),t}async getPage(e,t){try{this.logger.debug("Ready to load page from local storage",t);const o=this.getPageStorage(e);this.logger.debug("pageStorage is ready, asking for page");const r=await o.pages.get(t),g=new h.DefaultPageData;return g.fromObject(r),g}catch(o){this.logger.debug("Exception while trying to read from local storage",o);return}}async savePage(e,t,o){try{await this.getPageStorage(e).pages.put(o.toObject(),t)}catch(r){this.logger.debug("Exception while trying to store in local storage",e,t,o,r)}}async updatePage(e,t,o){try{const r=this.getPageStorage(e);this.logger.debug("Ready to store",o),await r.pages.update(t,o.toObject())}catch(r){this.logger.debug("Exception while trying to store in local storage",e,t,o,r)}}};c=P([s.injectable(),m(0,s.inject("Logger"))],c);var v=Object.defineProperty,b=Object.getOwnPropertyDescriptor,_=(e,t,o,r)=>{for(var g=r>1?void 0:r?b(t,o):t,i=e.length-1,n;i>=0;i--)(n=e[i])&&(g=(r?n(t,o,g):n(g))||g);return r&&g&&v(t,o,g),g},f=(e,t)=>(o,r)=>t(o,r,e);let u=class{constructor(e,t,o){this.logger=e,this.logger.setModule("storage.components.wrappingOfflineStorage"),this.offlineStorage=t,this.queueWorker=o}setStorage(e){this.storage=e}getStorage(){return this.storage}setWikiConfig(e){return this.storage.setWikiConfig(e)}getWikiConfig(){return this.storage.getWikiConfig()}async isStorageReady(){return this.storage.isStorageReady()}getPageRestURL(e,t){return this.storage.getPageRestURL(e,t)}getPageFromViewURL(e){return this.storage.getPageFromViewURL(e)}getImageURL(e,t){return this.storage.getImageURL(e,t)}async getPageContent(e,t,o,r){if(this.logger.debug("Trying to get data for page ",e),this.offlineStorage){this.logger.debug("Asking offline storage for ",e);const g=await this.offlineStorage.getPage(this.getWikiConfig().name,e+"_"+t);return g!=null&&g!=null?(this.logger.debug("Loading data from local storage for page",e),(r==null||r)&&this.queueWorker.addToQueue(this.getWikiConfig().name+":"+e+"_"+t),g):(this.logger.debug("Could not find data in local storage for page",e),this.savePageContent(e,t))}else return this.logger.debug("No offline local storage available"),this.storage.getPageContent(e,t)}getAttachments(e){return this.storage.getAttachments(e)}getAttachment(e,t){return this.storage.getAttachment(e,t)}async savePageContent(e,t){const o=await this.storage.getPageContent(e,t);if(o)return o.id=e+"_"+t,this.logger.debug("Saving page to offline storage",e),this.offlineStorage.savePage(this.getWikiConfig().name,e+"_"+t,o),o;throw new Error("Can't save missing page.")}async updatePageContent(e,t){const o=await this.offlineStorage.getPage(this.getWikiConfig().name,e+"_"+t),r=await this.storage.getPageContent(e,t);return o&&r?(r.id=e+"_"+t,this.logger.debug("Saving page to offline storage",e),this.offlineStorage.savePage(this.getWikiConfig().name,e+"_"+t,r),!0):(o==null?void 0:o.version)!=(r==null?void 0:r.version)&&r?(r.id=e+"_"+t,this.logger.debug("Updating page to offline storage",e),this.offlineStorage.updatePage(this.getWikiConfig().name,e+"_"+t,r),!0):(this.logger.debug("Local storage not updated, because version are identical"),!1)}async getPanelContent(e,t,o){return this.storage.getPanelContent(e,t,o)}async getEditField(e,t){return await this.storage.getEditField(e,t)}save(e,t,o,r){return this.storage.save(e,t,o,r)}async saveAttachments(e,t){return this.storage.saveAttachments(e,t)}async delete(e){return this.storage.delete(e)}async move(e,t,o){return this.storage.move(e,t,o)}};u=_([s.injectable(),f(0,s.inject("Logger")),f(1,s.inject("OfflineStorage")),f(2,s.inject("QueueWorker"))],u);class C{constructor(t){t.bind("WrappingStorage").to(u).inSingletonScope(),t.bind("OfflineStorage").to(c).inSingletonScope()}}a.ComponentInit=C,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=index.umd.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xwiki/cristal-backend-dexie",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"license": "LGPL 2.1",
|
|
5
5
|
"author": "XWiki Org Community <contact@xwiki.org>",
|
|
6
6
|
"homepage": "https://cristal.xwiki.org/",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"main": "./dist/index.es.js",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"dexie": "4.0.11",
|
|
26
|
-
"inversify": "6.2.
|
|
27
|
-
"@xwiki/cristal-api": "0.
|
|
28
|
-
"@xwiki/cristal-
|
|
29
|
-
"@xwiki/cristal-
|
|
26
|
+
"inversify": "6.2.2",
|
|
27
|
+
"@xwiki/cristal-backend-api": "0.15.0",
|
|
28
|
+
"@xwiki/cristal-api": "0.15.0",
|
|
29
|
+
"@xwiki/cristal-sharedworker-api": "0.15.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"reflect-metadata": "0.2.2"
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"reflect-metadata": "0.2.2",
|
|
36
36
|
"typescript": "5.7.3",
|
|
37
|
-
"vite": "6.0
|
|
38
|
-
"@xwiki/cristal-dev-config": "0.
|
|
37
|
+
"vite": "6.1.0",
|
|
38
|
+
"@xwiki/cristal-dev-config": "0.15.0"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "tsc --project tsconfig.json && vite build",
|