@xwiki/cristal-backend-dexie 0.21.0 → 0.21.1
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 +10 -0
- package/dist/index.es.js +61 -239
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -11
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @xwiki/cristal-backend-dexie
|
|
2
2
|
|
|
3
|
+
## 0.21.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Cristal 0.21.1 Release
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @xwiki/cristal-api@0.21.1
|
|
10
|
+
- @xwiki/cristal-backend-api@0.21.1
|
|
11
|
+
- @xwiki/cristal-sharedworker-api@0.21.1
|
|
12
|
+
|
|
3
13
|
## 0.21.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { DefaultPageData as
|
|
3
|
-
|
|
1
|
+
import u from "dexie";
|
|
2
|
+
import { DefaultPageData as f } from "@xwiki/cristal-api";
|
|
3
|
+
import { injectable as h, inject as i } from "inversify";
|
|
4
|
+
class d extends u {
|
|
4
5
|
constructor(t) {
|
|
5
6
|
super("pages_" + t), this.version(2).stores({
|
|
6
7
|
pages: (
|
|
@@ -10,250 +11,71 @@ class x extends U {
|
|
|
10
11
|
});
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
function h(e, t, n, o, r) {
|
|
20
|
-
const i = o(_(e, t, r) ?? n());
|
|
21
|
-
Reflect.defineMetadata(t, i, e, r);
|
|
22
|
-
}
|
|
23
|
-
var O, M, R;
|
|
24
|
-
(function(e) {
|
|
25
|
-
e.moduleId = "moduleId", e.serviceId = "serviceId";
|
|
26
|
-
})(O || (O = {}));
|
|
27
|
-
(function(e) {
|
|
28
|
-
e.id = "id", e.moduleId = "moduleId", e.serviceId = "serviceId";
|
|
29
|
-
})(M || (M = {}));
|
|
30
|
-
(function(e) {
|
|
31
|
-
e.moduleId = "moduleId", e.serviceId = "serviceId";
|
|
32
|
-
})(R || (R = {}));
|
|
33
|
-
const v = "@inversifyjs/core/classMetadataReflectKey";
|
|
34
|
-
function j() {
|
|
35
|
-
return { constructorArguments: [], lifecycle: { postConstructMethodName: void 0, preDestroyMethodName: void 0 }, properties: /* @__PURE__ */ new Map(), scope: void 0 };
|
|
36
|
-
}
|
|
37
|
-
const K = "@inversifyjs/core/pendingClassMetadataCountReflectKey", P = Symbol.for("@inversifyjs/core/InversifyCoreError");
|
|
38
|
-
class g extends Error {
|
|
39
|
-
[P];
|
|
40
|
-
kind;
|
|
41
|
-
constructor(t, n, o) {
|
|
42
|
-
super(n, o), this[P] = !0, this.kind = t;
|
|
43
|
-
}
|
|
44
|
-
static is(t) {
|
|
45
|
-
return typeof t == "object" && t !== null && t[P] === !0;
|
|
46
|
-
}
|
|
47
|
-
static isErrorOfKind(t, n) {
|
|
48
|
-
return g.is(t) && t.kind === n;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
var u, w, f;
|
|
52
|
-
function B() {
|
|
53
|
-
return 0;
|
|
54
|
-
}
|
|
55
|
-
function V(e) {
|
|
56
|
-
return (t) => {
|
|
57
|
-
t !== void 0 && t.kind === w.unknown && h(e, K, B, (n) => n - 1);
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
function q(e, t) {
|
|
61
|
-
return (...n) => (o) => {
|
|
62
|
-
if (o === void 0) return e(...n);
|
|
63
|
-
if (o.kind === f.unmanaged) throw new g(u.injectionDecoratorConflict, "Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found");
|
|
64
|
-
return t(o, ...n);
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
function Q(e) {
|
|
68
|
-
if (e.kind !== w.unknown && e.isFromTypescriptParamType !== !0) throw new g(u.injectionDecoratorConflict, "Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found");
|
|
69
|
-
}
|
|
70
|
-
(function(e) {
|
|
71
|
-
e[e.injectionDecoratorConflict = 0] = "injectionDecoratorConflict", e[e.missingInjectionDecorator = 1] = "missingInjectionDecorator", e[e.planning = 2] = "planning", e[e.resolution = 3] = "resolution", e[e.unknown = 4] = "unknown";
|
|
72
|
-
})(u || (u = {})), function(e) {
|
|
73
|
-
e[e.unknown = 32] = "unknown";
|
|
74
|
-
}(w || (w = {})), function(e) {
|
|
75
|
-
e[e.multipleInjection = 0] = "multipleInjection", e[e.singleInjection = 1] = "singleInjection", e[e.unmanaged = 2] = "unmanaged";
|
|
76
|
-
}(f || (f = {}));
|
|
77
|
-
const z = q(function(e, t, n) {
|
|
78
|
-
return e === f.multipleInjection ? { chained: n?.chained ?? !1, kind: e, name: void 0, optional: !1, tags: /* @__PURE__ */ new Map(), value: t } : { kind: e, name: void 0, optional: !1, tags: /* @__PURE__ */ new Map(), value: t };
|
|
79
|
-
}, function(e, t, n, o) {
|
|
80
|
-
return Q(e), t === f.multipleInjection ? { ...e, chained: o?.chained ?? !1, kind: t, value: n } : { ...e, kind: t, value: n };
|
|
81
|
-
});
|
|
82
|
-
function $(e, t) {
|
|
83
|
-
return (n) => {
|
|
84
|
-
const o = n.properties.get(t);
|
|
85
|
-
return n.properties.set(t, e(o)), n;
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
var l;
|
|
89
|
-
function G(e, t, n, o) {
|
|
90
|
-
if (g.isErrorOfKind(o, u.injectionDecoratorConflict)) {
|
|
91
|
-
const r = function(i, a, s) {
|
|
92
|
-
if (s === void 0) {
|
|
93
|
-
if (a === void 0) throw new g(u.unknown, "Unexpected undefined property and index values");
|
|
94
|
-
return { kind: l.property, property: a, targetClass: i.constructor };
|
|
95
|
-
}
|
|
96
|
-
return typeof s == "number" ? { index: s, kind: l.parameter, targetClass: i } : { kind: l.method, method: a, targetClass: i };
|
|
97
|
-
}(e, t, n);
|
|
98
|
-
throw new g(u.injectionDecoratorConflict, `Unexpected injection error.
|
|
99
|
-
|
|
100
|
-
Cause:
|
|
101
|
-
|
|
102
|
-
${o.message}
|
|
103
|
-
|
|
104
|
-
Details
|
|
105
|
-
|
|
106
|
-
${function(i) {
|
|
107
|
-
switch (i.kind) {
|
|
108
|
-
case l.method:
|
|
109
|
-
return `[class: "${i.targetClass.name}", method: "${i.method.toString()}"]`;
|
|
110
|
-
case l.parameter:
|
|
111
|
-
return `[class: "${i.targetClass.name}", index: "${i.index.toString()}"]`;
|
|
112
|
-
case l.property:
|
|
113
|
-
return `[class: "${i.targetClass.name}", property: "${i.property.toString()}"]`;
|
|
114
|
-
}
|
|
115
|
-
}(r)}`, { cause: o });
|
|
116
|
-
}
|
|
117
|
-
throw o;
|
|
118
|
-
}
|
|
119
|
-
function N(e, t) {
|
|
120
|
-
return (n, o, r) => {
|
|
121
|
-
try {
|
|
122
|
-
r === void 0 ? function(i, a) {
|
|
123
|
-
const s = I(i, a);
|
|
124
|
-
return (c, d) => {
|
|
125
|
-
h(c.constructor, v, j, $(s(c), d));
|
|
126
|
-
};
|
|
127
|
-
}(e, t)(n, o) : typeof r == "number" ? function(i, a) {
|
|
128
|
-
const s = I(i, a);
|
|
129
|
-
return (c, d, C) => {
|
|
130
|
-
if (!/* @__PURE__ */ function(p, m) {
|
|
131
|
-
return typeof p == "function" && m === void 0;
|
|
132
|
-
}(c, d)) throw new g(u.injectionDecoratorConflict, `Found an @inject decorator in a non constructor parameter.
|
|
133
|
-
Found @inject decorator at method "${d?.toString() ?? ""}" at class "${c.constructor.name}"`);
|
|
134
|
-
h(c, v, j, /* @__PURE__ */ function(p, m) {
|
|
135
|
-
return (S) => {
|
|
136
|
-
const E = S.constructorArguments[m];
|
|
137
|
-
return S.constructorArguments[m] = p(E), S;
|
|
138
|
-
};
|
|
139
|
-
}(s(c), C));
|
|
140
|
-
};
|
|
141
|
-
}(e, t)(n, o, r) : function(i, a) {
|
|
142
|
-
const s = I(i, a);
|
|
143
|
-
return (c, d, C) => {
|
|
144
|
-
if (!function(p) {
|
|
145
|
-
return p.set !== void 0;
|
|
146
|
-
}(C)) throw new g(u.injectionDecoratorConflict, `Found an @inject decorator in a non setter property method.
|
|
147
|
-
Found @inject decorator at method "${d.toString()}" at class "${c.constructor.name}"`);
|
|
148
|
-
h(c.constructor, v, j, $(s(c), d));
|
|
149
|
-
};
|
|
150
|
-
}(e, t)(n, o, r);
|
|
151
|
-
} catch (i) {
|
|
152
|
-
G(n, o, r, i);
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
function I(e, t) {
|
|
157
|
-
return (n) => {
|
|
158
|
-
const o = t(n);
|
|
159
|
-
return (r) => (o(r), e(r));
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
function y(e) {
|
|
163
|
-
return N(z(f.singleInjection, e), V);
|
|
164
|
-
}
|
|
165
|
-
(function(e) {
|
|
166
|
-
e[e.method = 0] = "method", e[e.parameter = 1] = "parameter", e[e.property = 2] = "property";
|
|
167
|
-
})(l || (l = {}));
|
|
168
|
-
const W = "@inversifyjs/core/classIsInjectableFlagReflectKey", H = [Array, BigInt, Boolean, Function, Number, Object, String];
|
|
169
|
-
function J(e) {
|
|
170
|
-
const t = _(e, "design:paramtypes");
|
|
171
|
-
t !== void 0 && h(e, v, j, /* @__PURE__ */ function(n) {
|
|
172
|
-
return (o) => (n.forEach((r, i) => {
|
|
173
|
-
var a;
|
|
174
|
-
o.constructorArguments[i] !== void 0 || (a = r, H.includes(a)) || (o.constructorArguments[i] = function(s) {
|
|
175
|
-
return { isFromTypescriptParamType: !0, kind: f.singleInjection, name: void 0, optional: !1, tags: /* @__PURE__ */ new Map(), value: s };
|
|
176
|
-
}(r));
|
|
177
|
-
}), o);
|
|
178
|
-
}(t));
|
|
179
|
-
}
|
|
180
|
-
function F(e) {
|
|
181
|
-
return (t) => {
|
|
182
|
-
(function(n) {
|
|
183
|
-
if (_(n, W) !== void 0) throw new g(u.injectionDecoratorConflict, `Cannot apply @injectable decorator multiple times at class "${n.name}"`);
|
|
184
|
-
T(n, W, !0);
|
|
185
|
-
})(t), J(t);
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
var A;
|
|
189
|
-
(function(e) {
|
|
190
|
-
e[e.multipleInjection = 0] = "multipleInjection", e[e.singleInjection = 1] = "singleInjection";
|
|
191
|
-
})(A || (A = {}));
|
|
192
|
-
var X = Object.getOwnPropertyDescriptor, Y = (e, t, n, o) => {
|
|
193
|
-
for (var r = o > 1 ? void 0 : o ? X(t, n) : t, i = e.length - 1, a; i >= 0; i--)
|
|
194
|
-
(a = e[i]) && (r = a(r) || r);
|
|
195
|
-
return r;
|
|
196
|
-
}, Z = (e, t) => (n, o) => t(n, o, e);
|
|
197
|
-
let k = class {
|
|
14
|
+
var p = Object.getOwnPropertyDescriptor, S = (e, t, g, o) => {
|
|
15
|
+
for (var a = o > 1 ? void 0 : o ? p(t, g) : t, r = e.length - 1, s; r >= 0; r--)
|
|
16
|
+
(s = e[r]) && (a = s(a) || a);
|
|
17
|
+
return a;
|
|
18
|
+
}, m = (e, t) => (g, o) => t(g, o, e);
|
|
19
|
+
let l = class {
|
|
198
20
|
constructor(e) {
|
|
199
21
|
this.pageStorageMap = /* @__PURE__ */ new Map(), this.logger = e, this.logger.setModule("storage.components.dexieOfflineStorage");
|
|
200
22
|
}
|
|
201
23
|
getPageStorage(e) {
|
|
202
24
|
let t = this.pageStorageMap.get(e);
|
|
203
|
-
return t == null && (t = new
|
|
25
|
+
return t == null && (t = new d(e), this.pageStorageMap.set(e, t)), t;
|
|
204
26
|
}
|
|
205
27
|
async getPage(e, t) {
|
|
206
28
|
try {
|
|
207
29
|
this.logger.debug("Ready to load page from local storage", t);
|
|
208
|
-
const
|
|
30
|
+
const g = this.getPageStorage(e);
|
|
209
31
|
this.logger.debug("pageStorage is ready, asking for page");
|
|
210
|
-
const o = await
|
|
211
|
-
return
|
|
212
|
-
} catch (
|
|
213
|
-
this.logger.debug("Exception while trying to read from local storage",
|
|
32
|
+
const o = await g.pages.get(t), a = new f();
|
|
33
|
+
return a.fromObject(o), a;
|
|
34
|
+
} catch (g) {
|
|
35
|
+
this.logger.debug("Exception while trying to read from local storage", g);
|
|
214
36
|
return;
|
|
215
37
|
}
|
|
216
38
|
}
|
|
217
|
-
async savePage(e, t,
|
|
39
|
+
async savePage(e, t, g) {
|
|
218
40
|
try {
|
|
219
|
-
await this.getPageStorage(e).pages.put(
|
|
41
|
+
await this.getPageStorage(e).pages.put(g.toObject(), t);
|
|
220
42
|
} catch (o) {
|
|
221
43
|
this.logger.debug(
|
|
222
44
|
"Exception while trying to store in local storage",
|
|
223
45
|
e,
|
|
224
46
|
t,
|
|
225
|
-
|
|
47
|
+
g,
|
|
226
48
|
o
|
|
227
49
|
);
|
|
228
50
|
}
|
|
229
51
|
}
|
|
230
|
-
async updatePage(e, t,
|
|
52
|
+
async updatePage(e, t, g) {
|
|
231
53
|
try {
|
|
232
54
|
const o = this.getPageStorage(e);
|
|
233
|
-
this.logger.debug("Ready to store",
|
|
55
|
+
this.logger.debug("Ready to store", g), await o.pages.update(t, g.toObject());
|
|
234
56
|
} catch (o) {
|
|
235
57
|
this.logger.debug(
|
|
236
58
|
"Exception while trying to store in local storage",
|
|
237
59
|
e,
|
|
238
60
|
t,
|
|
239
|
-
|
|
61
|
+
g,
|
|
240
62
|
o
|
|
241
63
|
);
|
|
242
64
|
}
|
|
243
65
|
}
|
|
244
66
|
};
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
],
|
|
249
|
-
var
|
|
250
|
-
for (var
|
|
251
|
-
(
|
|
252
|
-
return
|
|
253
|
-
},
|
|
254
|
-
let
|
|
255
|
-
constructor(e, t,
|
|
256
|
-
this.logger = e, this.logger.setModule("storage.components.wrappingOfflineStorage"), this.offlineStorage = t, this.queueWorker =
|
|
67
|
+
l = S([
|
|
68
|
+
h(),
|
|
69
|
+
m(0, i("Logger"))
|
|
70
|
+
], l);
|
|
71
|
+
var v = Object.getOwnPropertyDescriptor, P = (e, t, g, o) => {
|
|
72
|
+
for (var a = o > 1 ? void 0 : o ? v(t, g) : t, r = e.length - 1, s; r >= 0; r--)
|
|
73
|
+
(s = e[r]) && (a = s(a) || a);
|
|
74
|
+
return a;
|
|
75
|
+
}, n = (e, t) => (g, o) => t(g, o, e);
|
|
76
|
+
let c = class {
|
|
77
|
+
constructor(e, t, g) {
|
|
78
|
+
this.logger = e, this.logger.setModule("storage.components.wrappingOfflineStorage"), this.offlineStorage = t, this.queueWorker = g;
|
|
257
79
|
}
|
|
258
80
|
setStorage(e) {
|
|
259
81
|
this.storage = e;
|
|
@@ -281,16 +103,16 @@ let D = class {
|
|
|
281
103
|
}
|
|
282
104
|
// TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.
|
|
283
105
|
// eslint-disable-next-line max-statements
|
|
284
|
-
async getPageContent(e, t,
|
|
106
|
+
async getPageContent(e, t, g, o) {
|
|
285
107
|
if (this.logger.debug("Trying to get data for page ", e), this.offlineStorage) {
|
|
286
108
|
this.logger.debug("Asking offline storage for ", e);
|
|
287
|
-
const
|
|
109
|
+
const a = await this.offlineStorage.getPage(
|
|
288
110
|
this.getWikiConfig().name,
|
|
289
111
|
e + "_" + t
|
|
290
112
|
);
|
|
291
|
-
return
|
|
113
|
+
return a != null && a != null ? (this.logger.debug("Loading data from local storage for page", e), (o == null || o) && this.queueWorker.addToQueue(
|
|
292
114
|
this.getWikiConfig().name + ":" + e + "_" + t
|
|
293
|
-
),
|
|
115
|
+
), a) : (this.logger.debug(
|
|
294
116
|
"Could not find data in local storage for page",
|
|
295
117
|
e
|
|
296
118
|
), this.savePageContent(e, t));
|
|
@@ -304,27 +126,27 @@ let D = class {
|
|
|
304
126
|
return this.storage.getAttachment(e, t);
|
|
305
127
|
}
|
|
306
128
|
async savePageContent(e, t) {
|
|
307
|
-
const
|
|
308
|
-
if (
|
|
309
|
-
return
|
|
129
|
+
const g = await this.storage.getPageContent(e, t);
|
|
130
|
+
if (g)
|
|
131
|
+
return g.id = e + "_" + t, this.logger.debug("Saving page to offline storage", e), this.offlineStorage.savePage(
|
|
310
132
|
this.getWikiConfig().name,
|
|
311
133
|
e + "_" + t,
|
|
312
|
-
|
|
313
|
-
),
|
|
134
|
+
g
|
|
135
|
+
), g;
|
|
314
136
|
throw new Error("Can't save missing page.");
|
|
315
137
|
}
|
|
316
138
|
// TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.
|
|
317
139
|
// eslint-disable-next-line max-statements
|
|
318
140
|
async updatePageContent(e, t) {
|
|
319
|
-
const
|
|
141
|
+
const g = await this.offlineStorage.getPage(
|
|
320
142
|
this.getWikiConfig().name,
|
|
321
143
|
e + "_" + t
|
|
322
144
|
), o = await this.storage.getPageContent(e, t);
|
|
323
|
-
return
|
|
145
|
+
return g && o ? (o.id = e + "_" + t, this.logger.debug("Saving page to offline storage", e), this.offlineStorage.savePage(
|
|
324
146
|
this.getWikiConfig().name,
|
|
325
147
|
e + "_" + t,
|
|
326
148
|
o
|
|
327
|
-
), !0) :
|
|
149
|
+
), !0) : g?.version != o?.version && o ? (o.id = e + "_" + t, this.logger.debug("Updating page to offline storage", e), this.offlineStorage.updatePage(
|
|
328
150
|
this.getWikiConfig().name,
|
|
329
151
|
e + "_" + t,
|
|
330
152
|
o
|
|
@@ -332,14 +154,14 @@ let D = class {
|
|
|
332
154
|
"Local storage not updated, because version are identical"
|
|
333
155
|
), !1);
|
|
334
156
|
}
|
|
335
|
-
async getPanelContent(e, t,
|
|
336
|
-
return this.storage.getPanelContent(e, t,
|
|
157
|
+
async getPanelContent(e, t, g) {
|
|
158
|
+
return this.storage.getPanelContent(e, t, g);
|
|
337
159
|
}
|
|
338
160
|
async getEditField(e, t) {
|
|
339
161
|
return await this.storage.getEditField(e, t);
|
|
340
162
|
}
|
|
341
|
-
save(e, t,
|
|
342
|
-
return this.storage.save(e, t,
|
|
163
|
+
save(e, t, g, o) {
|
|
164
|
+
return this.storage.save(e, t, g, o);
|
|
343
165
|
}
|
|
344
166
|
async saveAttachments(e, t) {
|
|
345
167
|
return this.storage.saveAttachments(e, t);
|
|
@@ -347,22 +169,22 @@ let D = class {
|
|
|
347
169
|
async delete(e) {
|
|
348
170
|
return this.storage.delete(e);
|
|
349
171
|
}
|
|
350
|
-
async move(e, t,
|
|
351
|
-
return this.storage.move(e, t,
|
|
172
|
+
async move(e, t, g) {
|
|
173
|
+
return this.storage.move(e, t, g);
|
|
352
174
|
}
|
|
353
175
|
};
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
],
|
|
360
|
-
class
|
|
176
|
+
c = P([
|
|
177
|
+
h(),
|
|
178
|
+
n(0, i("Logger")),
|
|
179
|
+
n(1, i("OfflineStorage")),
|
|
180
|
+
n(2, i("QueueWorker"))
|
|
181
|
+
], c);
|
|
182
|
+
class w {
|
|
361
183
|
constructor(t) {
|
|
362
|
-
t.bind("WrappingStorage").to(
|
|
184
|
+
t.bind("WrappingStorage").to(c).inSingletonScope(), t.bind("OfflineStorage").to(l).inSingletonScope();
|
|
363
185
|
}
|
|
364
186
|
}
|
|
365
187
|
export {
|
|
366
|
-
|
|
188
|
+
w as ComponentInit
|
|
367
189
|
};
|
|
368
190
|
//# sourceMappingURL=index.es.js.map
|
package/dist/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../src/dexiePageStorage.ts","../../../../node_modules/.pnpm/@inversifyjs+reflect-metadata-utils@1.3.0_reflect-metadata@0.2.2/node_modules/@inversifyjs/reflect-metadata-utils/lib/esm/index.js","../../../../node_modules/.pnpm/@inversifyjs+core@6.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/esm/index.js","../src/dexieOfflineStorage.ts","../src/wrappingOfflineStorage.ts","../src/index.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { default as Dexie } from \"dexie\";\nimport type { Table } from \"dexie\";\n\nexport default class DexiePageStorage extends Dexie {\n pages!: Table<object>;\n\n constructor(wikiName: string) {\n super(\"pages_\" + wikiName);\n this.version(2).stores({\n pages:\n // Primary key and indexed props\n \"id, name, content, document, css, js, document.name, document.headline, document.creator\",\n });\n }\n}\n","function t(t){return n=>(n.push(...t),n)}function n(t){return n=>(n.push(t),n)}function e(t,n){return e=>(e[n]=t,e)}function u(){return[]}function f(){return new Map}function c(t,n,e){return Reflect.getOwnMetadata(n,t,e)}function a(t,n,e){return Reflect.getMetadata(n,t,e)}function r(t,n,e,u){Reflect.defineMetadata(n,e,t,u)}function i(t,n,e,u,f){const a=u(c(t,n,f)??e());Reflect.defineMetadata(n,a,t,f)}function o(t,n,e,u,f){const c=u(a(t,n,f)??e());Reflect.defineMetadata(n,c,t,f)}export{t as buildArrayMetadataWithArray,n as buildArrayMetadataWithElement,e as buildArrayMetadataWithIndex,u as buildEmptyArrayMetadata,f as buildEmptyMapMetadata,c as getOwnReflectMetadata,a as getReflectMetadata,r as setReflectMetadata,i as updateOwnReflectMetadata,o as updateReflectMetadata};\n//# sourceMappingURL=index.js.map\n","import{getOwnReflectMetadata as e,setReflectMetadata as t,updateOwnReflectMetadata as n}from\"@inversifyjs/reflect-metadata-utils\";import{getBaseType as i}from\"@inversifyjs/prototype-utils\";import{stringifyServiceIdentifier as o,LazyServiceIdentifier as r,isPromise as s}from\"@inversifyjs/common\";const a=\"@inversifyjs/container/bindingId\";function c(){const i=e(Object,a)??0;return i===Number.MAX_SAFE_INTEGER?t(Object,a,Number.MIN_SAFE_INTEGER):n(Object,a,()=>i,e=>e+1),i}const d={Request:\"Request\",Singleton:\"Singleton\",Transient:\"Transient\"},u={ConstantValue:\"ConstantValue\",DynamicValue:\"DynamicValue\",Factory:\"Factory\",Instance:\"Instance\",Provider:\"Provider\",ResolvedValue:\"ResolvedValue\",ServiceRedirection:\"ServiceRedirection\"};function*l(...e){for(const t of e)yield*t}class p{#e;#t;#n;constructor(e){this.#e=new Map,this.#t={};for(const t of Reflect.ownKeys(e))this.#t[t]=new Map;this.#n=e}add(e,t){this.#i(e).push(t);for(const n of Reflect.ownKeys(t))this.#o(n,t[n]).push(e)}clone(){const e=this.#r(),t=this.#s(),n=Reflect.ownKeys(this.#n),i=this._buildNewInstance(this.#n);this.#a(this.#e,i.#e,e,t);for(const t of n)this.#c(this.#t[t],i.#t[t],e);return i}get(e,t){return this.#t[e].get(t)}getAllKeys(e){return this.#t[e].keys()}removeByRelation(e,t){const n=this.get(e,t);if(void 0===n)return;const i=new Set(n);for(const n of i){const i=this.#e.get(n);if(void 0===i)throw new Error(\"Expecting model relation, none found\");for(const o of i)o[e]===t&&this.#d(n,o);this.#e.delete(n)}}_buildNewInstance(e){return new p(e)}_cloneModel(e){return e}_cloneRelation(e){return e}#r(){const e=new Map;for(const t of this.#e.keys()){const n=this._cloneModel(t);e.set(t,n)}return e}#s(){const e=new Map;for(const t of this.#e.values())for(const n of t){const t=this._cloneRelation(n);e.set(n,t)}return e}#i(e){let t=this.#e.get(e);return void 0===t&&(t=[],this.#e.set(e,t)),t}#o(e,t){let n=this.#t[e].get(t);return void 0===n&&(n=[],this.#t[e].set(t,n)),n}#u(e,t){const n=t.get(e);if(void 0===n)throw new Error(\"Expecting model to be cloned, none found\");return n}#l(e,t){const n=t.get(e);if(void 0===n)throw new Error(\"Expecting relation to be cloned, none found\");return n}#c(e,t,n){for(const[i,o]of e){const e=new Array;for(const t of o)e.push(this.#u(t,n));t.set(i,e)}}#a(e,t,n,i){for(const[o,r]of e){const e=new Array;for(const t of r)e.push(this.#l(t,i));t.set(this.#u(o,n),e)}}#d(e,t){for(const n of Reflect.ownKeys(t))this.#p(e,n,t[n])}#p(e,t,n){const i=this.#t[t].get(n);if(void 0!==i){const o=i.indexOf(e);-1!==o&&i.splice(o,1),0===i.length&&this.#t[t].delete(n)}}}var f,v,h;!function(e){e.moduleId=\"moduleId\",e.serviceId=\"serviceId\"}(f||(f={}));class g{#f;#v;constructor(e,t){this.#f=t??new p({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#v=e}static build(e){return new g(e)}add(e,t){this.#f.add(e,t)}clone(){return new g(this.#v,this.#f.clone())}get(e){const t=[],n=this.#f.get(f.serviceId,e);void 0!==n&&t.push(n);const i=this.#v()?.get(e);if(void 0!==i&&t.push(i),0!==t.length)return l(...t)}removeAllByModuleId(e){this.#f.removeByRelation(f.moduleId,e)}removeAllByServiceId(e){this.#f.removeByRelation(f.serviceId,e)}}function m(e){return e.isRight?{isRight:!0,value:e.value}:e}function y(e){switch(e.type){case u.ConstantValue:case u.DynamicValue:return function(e){return{cache:m(e.cache),id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type,value:e.value}}(e);case u.Factory:return function(e){return{cache:m(e.cache),factory:e.factory,id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case u.Instance:return function(e){return{cache:m(e.cache),id:e.id,implementationType:e.implementationType,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case u.Provider:return function(e){return{cache:m(e.cache),id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,provider:e.provider,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case u.ResolvedValue:return function(e){return{cache:m(e.cache),factory:e.factory,id:e.id,isSatisfiedBy:e.isSatisfiedBy,metadata:e.metadata,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case u.ServiceRedirection:return function(e){return{id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,serviceIdentifier:e.serviceIdentifier,targetServiceIdentifier:e.targetServiceIdentifier,type:e.type}}(e)}}!function(e){e.id=\"id\",e.moduleId=\"moduleId\",e.serviceId=\"serviceId\"}(v||(v={}));class M extends p{_buildNewInstance(e){return new M(e)}_cloneModel(e){return y(e)}}class I{#h;#v;constructor(e,t){this.#h=t??new M({id:{isOptional:!1},moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#v=e}static build(e){return new I(e)}clone(){return new I(this.#v,this.#h.clone())}get(e){return this.getNonParentBindings(e)??this.#v()?.get(e)}*getChained(e){const t=this.getNonParentBindings(e);void 0!==t&&(yield*t);const n=this.#v();void 0!==n&&(yield*n.getChained(e))}getBoundServices(){const e=new Set(this.#h.getAllKeys(v.serviceId)),t=this.#v();if(void 0!==t)for(const n of t.getBoundServices())e.add(n);return e}getById(e){return this.#h.get(v.id,e)??this.#v()?.getById(e)}getByModuleId(e){return this.#h.get(v.moduleId,e)??this.#v()?.getByModuleId(e)}getNonParentBindings(e){return this.#h.get(v.serviceId,e)}getNonParentBoundServices(){return this.#h.getAllKeys(v.serviceId)}removeById(e){this.#h.removeByRelation(v.id,e)}removeAllByModuleId(e){this.#h.removeByRelation(v.moduleId,e)}removeAllByServiceId(e){this.#h.removeByRelation(v.serviceId,e)}set(e){const t={[v.id]:e.id,[v.serviceId]:e.serviceIdentifier};void 0!==e.moduleId&&(t[v.moduleId]=e.moduleId),this.#h.add(e,t)}}!function(e){e.moduleId=\"moduleId\",e.serviceId=\"serviceId\"}(h||(h={}));class w{#g;#v;constructor(e,t){this.#g=t??new p({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#v=e}static build(e){return new w(e)}add(e,t){this.#g.add(e,t)}clone(){return new w(this.#v,this.#g.clone())}get(e){const t=[],n=this.#g.get(h.serviceId,e);void 0!==n&&t.push(n);const i=this.#v()?.get(e);if(void 0!==i&&t.push(i),0!==t.length)return l(...t)}removeAllByModuleId(e){this.#g.removeByRelation(h.moduleId,e)}removeAllByServiceId(e){this.#g.removeByRelation(h.serviceId,e)}}function b(e,t,n){const i=Array.isArray(e)?e:[e];if(void 0!==n)if(\"number\"!=typeof n)Reflect.decorate(i,t.prototype,n);else for(const e of i)e(t,void 0,n);else Reflect.decorate(i,t)}const S=\"@inversifyjs/core/classMetadataReflectKey\";function C(){return{constructorArguments:[],lifecycle:{postConstructMethodName:void 0,preDestroyMethodName:void 0},properties:new Map,scope:void 0}}const N=\"@inversifyjs/core/pendingClassMetadataCountReflectKey\";const T=Symbol.for(\"@inversifyjs/core/InversifyCoreError\");class j extends Error{[T];kind;constructor(e,t,n){super(t,n),this[T]=!0,this.kind=e}static is(e){return\"object\"==typeof e&&null!==e&&!0===e[T]}static isErrorOfKind(e,t){return j.is(e)&&e.kind===t}}var P,A,R;function x(t){const n=e(t,S)??C();if(!function(t){const n=e(t,N);return void 0!==n&&0!==n}(t))return function(e,t){const n=[];if(t.length<e.length)throw new j(P.missingInjectionDecorator,`Found unexpected missing metadata on type \"${e.name}\". \"${e.name}\" constructor requires at least ${e.length.toString()} arguments, found ${t.length.toString()} instead.\\nAre you using @inject, @multiInject or @unmanaged decorators in every non optional constructor argument?\\n\\nIf you're using typescript and want to rely on auto injection, set \"emitDecoratorMetadata\" compiler option to true`);for(let e=0;e<t.length;++e)void 0===t[e]&&n.push(e);if(n.length>0)throw new j(P.missingInjectionDecorator,`Found unexpected missing metadata on type \"${e.name}\" at constructor indexes \"${n.join('\", \"')}\".\\n\\nAre you using @inject, @multiInject or @unmanaged decorators at those indexes?\\n\\nIf you're using typescript and want to rely on auto injection, set \"emitDecoratorMetadata\" compiler option to true`)}(t,n.constructorArguments),n;!function(e,t){const n=[];for(let i=0;i<t.constructorArguments.length;++i){const o=t.constructorArguments[i];void 0!==o&&o.kind!==A.unknown||n.push(` - Missing or incomplete metadata for type \"${e.name}\" at constructor argument with index ${i.toString()}.\\nEvery constructor parameter must be decorated either with @inject, @multiInject or @unmanaged decorator.`)}for(const[i,o]of t.properties)o.kind===A.unknown&&n.push(` - Missing or incomplete metadata for type \"${e.name}\" at property \"${i.toString()}\".\\nThis property must be decorated either with @inject or @multiInject decorator.`);if(0===n.length)throw new j(P.unknown,`Unexpected class metadata for type \"${e.name}\" with uncompletion traces.\\nThis might be caused by one of the following reasons:\\n\\n1. A third party library is targeting inversify reflection metadata.\\n2. A bug is causing the issue. Consider submiting an issue to fix it.`);throw new j(P.missingInjectionDecorator,`Invalid class metadata at type ${e.name}:\\n\\n${n.join(\"\\n\\n\")}`)}(t,n)}function B(){return 0}function $(e){return t=>{void 0!==t&&t.kind===A.unknown&&n(e,N,B,e=>e-1)}}function D(e,t){return(...n)=>i=>{if(void 0===i)return e(...n);if(i.kind===R.unmanaged)throw new j(P.injectionDecoratorConflict,\"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found\");return t(i,...n)}}function k(e){if(e.kind!==A.unknown&&!0!==e.isFromTypescriptParamType)throw new j(P.injectionDecoratorConflict,\"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found\")}!function(e){e[e.injectionDecoratorConflict=0]=\"injectionDecoratorConflict\",e[e.missingInjectionDecorator=1]=\"missingInjectionDecorator\",e[e.planning=2]=\"planning\",e[e.resolution=3]=\"resolution\",e[e.unknown=4]=\"unknown\"}(P||(P={})),function(e){e[e.unknown=32]=\"unknown\"}(A||(A={})),function(e){e[e.multipleInjection=0]=\"multipleInjection\",e[e.singleInjection=1]=\"singleInjection\",e[e.unmanaged=2]=\"unmanaged\"}(R||(R={}));const F=D(function(e,t,n){return e===R.multipleInjection?{chained:n?.chained??!1,kind:e,name:void 0,optional:!1,tags:new Map,value:t}:{kind:e,name:void 0,optional:!1,tags:new Map,value:t}},function(e,t,n,i){return k(e),t===R.multipleInjection?{...e,chained:i?.chained??!1,kind:t,value:n}:{...e,kind:t,value:n}});function V(e,t){return n=>{const i=n.properties.get(t);return n.properties.set(t,e(i)),n}}var O;function E(e,t,n,i){if(j.isErrorOfKind(i,P.injectionDecoratorConflict)){const o=function(e,t,n){if(void 0===n){if(void 0===t)throw new j(P.unknown,\"Unexpected undefined property and index values\");return{kind:O.property,property:t,targetClass:e.constructor}}return\"number\"==typeof n?{index:n,kind:O.parameter,targetClass:e}:{kind:O.method,method:t,targetClass:e}}(e,t,n);throw new j(P.injectionDecoratorConflict,`Unexpected injection error.\\n\\nCause:\\n\\n${i.message}\\n\\nDetails\\n\\n${function(e){switch(e.kind){case O.method:return`[class: \"${e.targetClass.name}\", method: \"${e.method.toString()}\"]`;case O.parameter:return`[class: \"${e.targetClass.name}\", index: \"${e.index.toString()}\"]`;case O.property:return`[class: \"${e.targetClass.name}\", property: \"${e.property.toString()}\"]`}}(o)}`,{cause:i})}throw i}function _(e,t){return(i,o,r)=>{try{void 0===r?function(e,t){const i=U(e,t);return(e,t)=>{n(e.constructor,S,C,V(i(e),t))}}(e,t)(i,o):\"number\"==typeof r?function(e,t){const i=U(e,t);return(e,t,o)=>{if(!function(e,t){return\"function\"==typeof e&&void 0===t}(e,t))throw new j(P.injectionDecoratorConflict,`Found an @inject decorator in a non constructor parameter.\\nFound @inject decorator at method \"${t?.toString()??\"\"}\" at class \"${e.constructor.name}\"`);n(e,S,C,function(e,t){return n=>{const i=n.constructorArguments[t];return n.constructorArguments[t]=e(i),n}}(i(e),o))}}(e,t)(i,o,r):function(e,t){const i=U(e,t);return(e,t,o)=>{if(!function(e){return void 0!==e.set}(o))throw new j(P.injectionDecoratorConflict,`Found an @inject decorator in a non setter property method.\\nFound @inject decorator at method \"${t.toString()}\" at class \"${e.constructor.name}\"`);n(e.constructor,S,C,V(i(e),t))}}(e,t)(i,o,r)}catch(e){E(i,o,r,e)}}}function U(e,t){return n=>{const i=t(n);return t=>(i(t),e(t))}}function z(e){return _(F(R.singleInjection,e),$)}!function(e){e[e.method=0]=\"method\",e[e.parameter=1]=\"parameter\",e[e.property=2]=\"property\"}(O||(O={}));const K=\"@inversifyjs/core/classIsInjectableFlagReflectKey\";const L=[Array,BigInt,Boolean,Function,Number,Object,String];function q(t){const i=e(t,\"design:paramtypes\");void 0!==i&&n(t,S,C,function(e){return t=>(e.forEach((e,n)=>{var i;void 0!==t.constructorArguments[n]||(i=e,L.includes(i))||(t.constructorArguments[n]=function(e){return{isFromTypescriptParamType:!0,kind:R.singleInjection,name:void 0,optional:!1,tags:new Map,value:e}}(e))}),t)}(i))}function G(i){return o=>{!function(n){if(void 0!==e(n,K))throw new j(P.injectionDecoratorConflict,`Cannot apply @injectable decorator multiple times at class \"${n.name}\"`);t(n,K,!0)}(o),q(o),void 0!==i&&n(o,S,C,e=>({...e,scope:i}))}}function W(e,t,n){let i;return e.extendConstructorArguments??!0?(i=[...t.constructorArguments],n.constructorArguments.map((e,t)=>{i[t]=e})):i=n.constructorArguments,i}function X(e,t,n){let i;return i=e.extendProperties??!0?new Map(l(t.properties,n.properties)):n.properties,i}function H(e){return t=>{const i=x(e.type);n(t,S,C,function(e,t){const n=n=>({constructorArguments:W(e,t,n),lifecycle:n.lifecycle,properties:X(e,t,n),scope:n.scope});return n}(e,i))}}function J(e){return t=>{const n=i(t);if(void 0===n)throw new j(P.injectionDecoratorConflict,`Expected base type for type \"${t.name}\", none found.`);H({...e,type:n})(t)}}function Q(e,t){return _(F(R.multipleInjection,e,t),$)}function Y(e){return t=>{void 0===t&&n(e,N,B,e=>e+1)}}function Z(e){return t=>{const n=t??{kind:A.unknown,name:void 0,optional:!1,tags:new Map};if(n.kind===R.unmanaged)throw new j(P.injectionDecoratorConflict,\"Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections\");return e(n)}}function ee(e){const t=Z(function(e){return t=>{if(void 0!==t.name)throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated named decorator\");return t.name=e,t}}(e));return _(t,Y)}function te(e){if(e.optional)throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated optional decorator\");return e.optional=!0,e}function ne(){return _(Z(te),Y)}function ie(){return(e,t,i)=>{try{n(e.constructor,S,C,(o=t,e=>{if(void 0!==e.lifecycle.postConstructMethodName)throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated postConstruct decorator\");return e.lifecycle.postConstructMethodName=o,e}))}catch(n){E(e,t,void 0,n)}var o}}function oe(){return(e,t,i)=>{try{n(e.constructor,S,C,(o=t,e=>{if(void 0!==e.lifecycle.preDestroyMethodName)throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated preDestroy decorator\");return e.lifecycle.preDestroyMethodName=o,e}))}catch(n){E(e,t,void 0,n)}var o}}function re(e,t){const n=Z(function(e,t){return n=>{if(n.tags.has(e))throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated tag decorator with existing tag\");return n.tags.set(e,t),n}}(e,t));return _(n,Y)}function se(){return{kind:R.unmanaged}}const ae=D(se,function(e){if(k(e),function(e){return void 0!==e.name||e.optional||e.tags.size>0}(e))throw new j(P.injectionDecoratorConflict,\"Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections\");return se()});function ce(){return _(ae(),$)}var de;!function(e){e[e.multipleInjection=0]=\"multipleInjection\",e[e.singleInjection=1]=\"singleInjection\"}(de||(de={}));class ue{#m;constructor(e){this.#m=e}get name(){return this.#m.elem.name}get serviceIdentifier(){return this.#m.elem.serviceIdentifier}get tags(){return this.#m.elem.tags}getAncestor(){if(this.#m.elem.getAncestorsCalled=!0,void 0!==this.#m.previous)return new ue(this.#m.previous)}}function le(e,t,n){const i=n?.customServiceIdentifier??t.serviceIdentifier,o=(!0===n?.chained?[...e.operations.getBindingsChained(i)]:[...e.operations.getBindings(i)??[]]).filter(e=>e.isSatisfiedBy(t));if(0===o.length&&void 0!==e.autobindOptions&&\"function\"==typeof i){const t=function(e,t){const n=x(t),i=n.scope??e.scope;return{cache:{isRight:!1,value:void 0},id:c(),implementationType:t,isSatisfiedBy:()=>!0,moduleId:void 0,onActivation:void 0,onDeactivation:void 0,scope:i,serviceIdentifier:t,type:u.Instance}}(e.autobindOptions,i);e.operations.setBinding(t),o.push(t)}return o}class pe{last;constructor(e){this.last=e}concat(e){return new pe({elem:e,previous:this.last})}[Symbol.iterator](){let e=this.last;return{next:()=>{if(void 0===e)return{done:!0,value:void 0};const t=e.elem;return e=e.previous,{done:!1,value:t}}}}}function fe(e){return void 0!==e.redirections}function ve(e,t,n,i){const r=n.elem.serviceIdentifier,s=n.previous?.elem.serviceIdentifier;Array.isArray(e)?function(e,t,n,i,r,s){if(0!==e.length){const t=s[s.length-1]??n,a=`Ambiguous bindings found for service: \"${o(t)}\".${ye(s)}\\n\\nRegistered bindings:\\n\\n${e.map(e=>function(e){switch(e.type){case u.Instance:return`[ type: \"${e.type}\", serviceIdentifier: \"${o(e.serviceIdentifier)}\", scope: \"${e.scope}\", implementationType: \"${e.implementationType.name}\" ]`;case u.ServiceRedirection:return`[ type: \"${e.type}\", serviceIdentifier: \"${o(e.serviceIdentifier)}\", redirection: \"${o(e.targetServiceIdentifier)}\" ]`;default:return`[ type: \"${e.type}\", serviceIdentifier: \"${o(e.serviceIdentifier)}\", scope: \"${e.scope}\" ]`}}(e.binding)).join(\"\\n\")}\\n\\nTrying to resolve bindings for \"${ge(n,i)}\".${me(r)}`;throw new j(P.planning,a)}t||he(n,i,r,s)}(e,t,r,s,n.elem,i):function(e,t,n,i,o,r){void 0!==e||t||he(n,i,o,r)}(e,t,r,s,n.elem,i)}function he(e,t,n,i){const r=i[i.length-1]??e,s=`No bindings found for service: \"${o(r)}\".\\n\\nTrying to resolve bindings for \"${ge(e,t)}\".${ye(i)}${me(n)}`;throw new j(P.planning,s)}function ge(e,t){return void 0===t?`${o(e)} (Root service)`:o(t)}function me(e){const t=0===e.tags.size?\"\":`\\n- tags:\\n - ${[...e.tags.keys()].map(e=>e.toString()).join(\"\\n - \")}`;return`\\n\\nBinding constraints:\\n- service identifier: ${o(e.serviceIdentifier)}\\n- name: ${e.name?.toString()??\"-\"}${t}`}function ye(e){return 0===e.length?\"\":`\\n\\n- service redirections:\\n - ${e.map(e=>o(e)).join(\"\\n - \")}`}function Me(e,t,n,i){if(1===e.redirections.length){const[o]=e.redirections;return void(fe(o)&&Me(o,t,n,[...i,o.binding.targetServiceIdentifier]))}ve(e.redirections,t,n,i)}function Ie(e,t,n){if(Array.isArray(e.bindings)&&1===e.bindings.length){const[i]=e.bindings;return void(fe(i)&&Me(i,t,n,[i.binding.targetServiceIdentifier]))}ve(e.bindings,t,n,[])}function we(e){return r.is(e)?e.unwrap():e}function be(e,t){if(function(e){return e instanceof Error&&(e instanceof RangeError&&/stack space|call stack|too much recursion/i.test(e.message)||\"InternalError\"===e.name&&/too much recursion/.test(e.message))}(t)){const n=function(e){const t=[...e];if(0===t.length)return\"(No dependency trace)\";return t.map(o).join(\" -> \")}(function(e){const t=new Set;for(const n of e.servicesBranch){if(t.has(n))return[...t,n];t.add(n)}return[...t]}(e));throw new j(P.planning,`Circular dependency found: ${n}`,{cause:t})}throw t}const Se=Symbol.for(\"@inversifyjs/core/LazyPlanServiceNode\");class Ce{[Se];_serviceIdentifier;_serviceNode;constructor(e){this[Se]=!0,this._serviceIdentifier=e.serviceIdentifier,this._serviceNode=e}get bindings(){return this._getNode().bindings}get isContextFree(){return this._getNode().isContextFree}get serviceIdentifier(){return this._serviceIdentifier}set bindings(e){this._getNode().bindings=e}set isContextFree(e){this._getNode().isContextFree=e}static is(e){return\"object\"==typeof e&&null!==e&&!0===e[Se]}invalidate(){this._serviceNode=void 0}_getNode(){return void 0===this._serviceNode&&(this._serviceNode=this._buildPlanServiceNode()),this._serviceNode}}function Ne(e,t,n){if(void 0!==e&&n.isContextFree){const i={tree:{root:n}};t.setPlan(e,i)}else t.setNonCachedServiceNode(n)}class Te extends Ce{#y;constructor(e,t){super(t),this.#y=e}_buildPlanServiceNode(){return Ae(this.#y)}}class je extends Ce{#y;#M;#I;constructor(e,t,n,i){super(i),this.#y=e,this.#M=t,this.#I=n}_buildPlanServiceNode(){return Be(this.#y,this.#M,this.#I)}}class Pe extends Ce{#y;#M;#w;constructor(e,t,n,i){super(i),this.#y=e,this.#M=t,this.#w=n}_buildPlanServiceNode(){return $e(this.#y,this.#M,this.#w)}}function Ae(e){const t=function(e){const t=new Map;return void 0!==e.rootConstraints.tag&&t.set(e.rootConstraints.tag.key,e.rootConstraints.tag.value),new pe({elem:{getAncestorsCalled:!1,name:e.rootConstraints.name,serviceIdentifier:e.rootConstraints.serviceIdentifier,tags:t},previous:void 0})}(e),n=new ue(t.last),i=!!e.rootConstraints.isMultiple&&e.rootConstraints.chained,o=le(e,n,{chained:i}),r=[],s={bindings:r,isContextFree:!0,serviceIdentifier:e.rootConstraints.serviceIdentifier};if(r.push(...ke(e,t,o,s,i)),s.isContextFree=!t.last.elem.getAncestorsCalled,!e.rootConstraints.isMultiple){Ie(s,e.rootConstraints.isOptional??!1,t.last);const[n]=r;s.bindings=n}return s}function Re(e){try{const t=function(e){return e.rootConstraints.isMultiple?{chained:e.rootConstraints.chained,isMultiple:!0,name:e.rootConstraints.name,optional:e.rootConstraints.isOptional??!1,serviceIdentifier:e.rootConstraints.serviceIdentifier,tag:e.rootConstraints.tag}:{isMultiple:!1,name:e.rootConstraints.name,optional:e.rootConstraints.isOptional??!1,serviceIdentifier:e.rootConstraints.serviceIdentifier,tag:e.rootConstraints.tag}}(e),n=e.operations.getPlan(t);if(void 0!==n)return n;const i=Ae(e),o={tree:{root:new Te(e,i)}};return e.operations.setPlan(t,o),o}catch(t){be(e,t)}}function xe(e,t,n){const i={binding:t,classMetadata:e.operations.getClassMetadata(t.implementationType),constructorParams:[],propertyParams:new Map};return Ee({autobindOptions:e.autobindOptions,node:i,operations:e.operations,servicesBranch:e.servicesBranch},n)}function Be(e,t,n){const i=we(n.value),o=t.concat({getAncestorsCalled:!1,name:n.name,serviceIdentifier:i,tags:n.tags}),r=new ue(o.last),s=n.kind===R.multipleInjection&&n.chained,a=le(e,r,{chained:s}),c=[],d={bindings:c,isContextFree:!0,serviceIdentifier:i};if(c.push(...ke(e,o,a,d,s)),d.isContextFree=!o.last.elem.getAncestorsCalled,n.kind===R.singleInjection){Ie(d,n.optional,o.last);const[e]=c;d.bindings=e}return d}function $e(e,t,n){const i=we(n.value),o=t.concat({getAncestorsCalled:!1,name:n.name,serviceIdentifier:i,tags:n.tags}),r=new ue(o.last),s=n.kind===de.multipleInjection&&n.chained,a=le(e,r,{chained:s}),c=[],d={bindings:c,isContextFree:!0,serviceIdentifier:i};if(c.push(...ke(e,o,a,d,s)),d.isContextFree=!o.last.elem.getAncestorsCalled,n.kind===de.singleInjection){Ie(d,n.optional,o.last);const[e]=c;d.bindings=e}return d}function De(e,t,n){const i={binding:t,params:[]};return Ee({autobindOptions:e.autobindOptions,node:i,operations:e.operations,servicesBranch:e.servicesBranch},n)}function ke(e,t,n,i,o){const r=fe(i)?i.binding.targetServiceIdentifier:i.serviceIdentifier;e.servicesBranch.push(r);const s=[];for(const i of n)switch(i.type){case u.Instance:s.push(xe(e,i,t));break;case u.ResolvedValue:s.push(De(e,i,t));break;case u.ServiceRedirection:{const n=Fe(e,t,i,o);s.push(n);break}default:s.push({binding:i})}return e.servicesBranch.pop(),s}function Fe(e,t,n,i){const o={binding:n,redirections:[]},r=le(e,new ue(t.last),{chained:i,customServiceIdentifier:n.targetServiceIdentifier});return o.redirections.push(...ke(e,t,r,o,i)),o}function Ve(e,t,n){if(n.kind===R.unmanaged)return;const i=function(e){let t;if(0===e.tags.size)t=void 0;else{if(1!==e.tags.size)return;{const[n,i]=e.tags.entries().next().value;t={key:n,value:i}}}const n=r.is(e.value)?e.value.unwrap():e.value;return e.kind===R.multipleInjection?{chained:e.chained,isMultiple:!0,name:e.name,optional:e.optional,serviceIdentifier:n,tag:t}:{isMultiple:!1,name:e.name,optional:e.optional,serviceIdentifier:n,tag:t}}(n);if(void 0!==i){const t=e.operations.getPlan(i);if(void 0!==t&&t.tree.root.isContextFree)return t.tree.root}const o=Be(e,t,n),s=new je(e,t,n,o);return Ne(i,e.operations,s),s}function Oe(e,t,n){const i=function(e){let t;if(0===e.tags.size)t=void 0;else{if(1!==e.tags.size)return;{const[n,i]=e.tags.entries().next().value;t={key:n,value:i}}}const n=r.is(e.value)?e.value.unwrap():e.value;return e.kind===de.multipleInjection?{chained:e.chained,isMultiple:!0,name:e.name,optional:e.optional,serviceIdentifier:n,tag:t}:{isMultiple:!1,name:e.name,optional:e.optional,serviceIdentifier:n,tag:t}}(n);if(void 0!==i){const t=e.operations.getPlan(i);if(void 0!==t&&t.tree.root.isContextFree)return t.tree.root}const o=$e(e,t,n),s=new Pe(e,t,n,o);return Ne(i,e.operations,s),s}function Ee(e,t){return e.node.binding.type===u.Instance?function(e,t,n){const i=t.classMetadata;for(const[o,r]of i.constructorArguments.entries())t.constructorParams[o]=Ve(e,n,r);for(const[o,r]of i.properties){const i=Ve(e,n,r);void 0!==i&&t.propertyParams.set(o,i)}return e.node}(e,e.node,t):function(e,t,n){const i=t.binding.metadata;for(const[o,r]of i.arguments.entries())t.params[o]=Oe(e,n,r);return e.node}(e,e.node,t)}class _e{#b;#S;#C;constructor(){this.#b=[],this.#S=8,this.#C=1024}*[Symbol.iterator](){let e=0;for(const t of this.#b){const n=t.deref();void 0===n?++e:yield n}this.#b.length>=this.#S&&this.#N(e)&&this.#T(e)}push(e){const t=new WeakRef(e);if(this.#b.push(t),this.#b.length>=this.#S&&this.#b.length%this.#C===0){let e=0;for(const t of this.#b)void 0===t.deref()&&++e;this.#N(e)&&this.#T(e)}}#T(e){const t=new Array(this.#b.length-e);let n=0;for(const e of this.#b)e.deref()&&(t[n++]=e);this.#b=t}#N(e){return e>=.5*this.#b.length}}class Ue{#j;#P;#A;#R;#x;#B;constructor(){this.#j=new Map,this.#P=this.#$(),this.#A=this.#$(),this.#R=this.#$(),this.#x=this.#$(),this.#B=new _e}clearCache(){for(const e of this.#D())e.clear();for(const e of this.#B)e.clearCache()}get(e){return void 0===e.name?void 0===e.tag?this.#k(this.#P,e).get(e.serviceIdentifier):this.#k(this.#x,e).get(e.serviceIdentifier)?.get(e.tag.key)?.get(e.tag.value):void 0===e.tag?this.#k(this.#A,e).get(e.serviceIdentifier)?.get(e.name):this.#k(this.#R,e).get(e.serviceIdentifier)?.get(e.name)?.get(e.tag.key)?.get(e.tag.value)}invalidateService(e){this.#F(e),this.#V(e),this.#O(e),this.#E(e),this.#_(e);for(const t of this.#B)t.invalidateService(e)}set(e,t){void 0===e.name?void 0===e.tag?this.#k(this.#P,e).set(e.serviceIdentifier,t):this.#U(this.#U(this.#k(this.#x,e),e.serviceIdentifier),e.tag.key).set(e.tag.value,t):void 0===e.tag?this.#U(this.#k(this.#A,e),e.serviceIdentifier).set(e.name,t):this.#U(this.#U(this.#U(this.#k(this.#R,e),e.serviceIdentifier),e.name),e.tag.key).set(e.tag.value,t)}setNonCachedServiceNode(e){let t=this.#j.get(e.serviceIdentifier);void 0===t&&(t=new Set,this.#j.set(e.serviceIdentifier,t)),t.add(e)}subscribe(e){this.#B.push(e)}#$(){const e=new Array(8);for(let t=0;t<e.length;++t)e[t]=new Map;return e}#U(e,t){let n=e.get(t);return void 0===n&&(n=new Map,e.set(t,n)),n}#k(e,t){return e[this.#z(t)]}#D(){return[this.#j,...this.#P,...this.#A,...this.#R,...this.#x]}#z(e){return e.isMultiple?(e.chained?4:0)|(e.optional?1:0)|2:e.optional?1:0}#V(e){for(const t of this.#A){const n=t.get(e);if(void 0!==n)for(const e of n.values())Ce.is(e.tree.root)&&(this.#K(e.tree.root),e.tree.root.invalidate())}}#O(e){for(const t of this.#R){const n=t.get(e);if(void 0!==n)for(const e of n.values())for(const t of e.values())for(const e of t.values())Ce.is(e.tree.root)&&(this.#K(e.tree.root),e.tree.root.invalidate())}}#L(e){switch(e.binding.type){case u.ServiceRedirection:for(const t of e.redirections)this.#L(t);break;case u.Instance:for(const t of e.constructorParams)void 0!==t&&this.#q(t);for(const t of e.propertyParams.values())this.#q(t);break;case u.ResolvedValue:for(const t of e.params)this.#q(t)}}#q(e){const t=this.#j.get(e.serviceIdentifier);void 0!==t&&t.has(e)&&(t.delete(e),this.#K(e))}#K(e){if(void 0!==e.bindings)if(Array.isArray(e.bindings))for(const t of e.bindings)this.#L(t);else this.#L(e.bindings)}#_(e){const t=this.#j.get(e);if(void 0!==t)for(const e of t)Ce.is(e)&&(this.#K(e),e.invalidate())}#F(e){for(const t of this.#P){const n=t.get(e);void 0!==n&&Ce.is(n.tree.root)&&(this.#K(n.tree.root),n.tree.root.invalidate())}}#E(e){for(const t of this.#x){const n=t.get(e);if(void 0!==n)for(const e of n.values())for(const t of e.values())Ce.is(t.tree.root)&&(this.#K(t.tree.root),t.tree.root.invalidate())}}}function ze(e,t){return s(t)?(e.cache={isRight:!0,value:t},t.then(t=>Ke(e,t))):Ke(e,t)}function Ke(e,t){return e.cache={isRight:!0,value:t},t}function Le(e,t,n){const i=e.getActivations(t);return void 0===i?n:s(n)?qe(e,n,i[Symbol.iterator]()):function(e,t,n){let i=t,o=n.next();for(;!0!==o.done;){const t=o.value(e.context,i);if(s(t))return qe(e,t,n);i=t,o=n.next()}return i}(e,n,i[Symbol.iterator]())}async function qe(e,t,n){let i=await t,o=n.next();for(;!0!==o.done;)i=await o.value(e.context,i),o=n.next();return i}function Ge(e,t,n){let i=n;if(void 0!==t.onActivation){const n=t.onActivation;i=s(i)?i.then(t=>n(e.context,t)):n(e.context,i)}return Le(e,t.serviceIdentifier,i)}function We(e){return(t,n)=>{if(n.cache.isRight)return n.cache.value;return ze(n,Ge(t,n,e(t,n)))}}const Xe=We(function(e,t){return t.value});function He(e){return e}function Je(e,t){return(n,i)=>{const o=e(i);switch(o.scope){case d.Singleton:if(o.cache.isRight)return o.cache.value;return ze(o,Ge(n,o,t(n,i)));case d.Request:{if(n.requestScopeCache.has(o.id))return n.requestScopeCache.get(o.id);const e=Ge(n,o,t(n,i));return n.requestScopeCache.set(o.id,e),e}case d.Transient:return Ge(n,o,t(n,i))}}}const Qe=(e=>Je(He,e))(function(e,t){return t.value(e.context)});const Ye=We(function(e,t){return t.factory(e.context)});function Ze(e,t,n){const i=function(e,t,n){if(void 0===n)return;if(!(n in e))throw new j(P.resolution,`Expecting a \"${n.toString()}\" property when resolving \"${t.implementationType.name}\" class @postConstruct decorated method, none found.`);if(\"function\"!=typeof e[n])throw new j(P.resolution,`Expecting a \"${n.toString()}\" method when resolving \"${t.implementationType.name}\" class @postConstruct decorated method, a non function property was found instead.`);{let i;try{i=e[n]()}catch(e){throw new j(P.resolution,`Unexpected error found when calling \"${n.toString()}\" @postConstruct decorated method on class \"${t.implementationType.name}\"`,{cause:e})}if(s(i))return async function(e,t,n){try{await n}catch(n){throw new j(P.resolution,`Unexpected error found when calling \"${t.toString()}\" @postConstruct decorated method on class \"${e.implementationType.name}\"`,{cause:n})}}(t,n,i)}}(e,t,n);return s(i)?i.then(()=>e):e}function et(e){return(t,n,i)=>{const o=new i.binding.implementationType(...t),r=e(n,o,i);return s(r)?r.then(()=>Ze(o,i.binding,i.classMetadata.lifecycle.postConstructMethodName)):Ze(o,i.binding,i.classMetadata.lifecycle.postConstructMethodName)}}const tt=We(function(e,t){return t.provider(e.context)});function nt(e){return e.binding}function it(e){return e.binding}const ot=function(e){return(t,n,i)=>{const o=[];for(const[r,a]of i.propertyParams){const c=i.classMetadata.properties.get(r);if(void 0===c)throw new j(P.resolution,`Expecting metadata at property \"${r.toString()}\", none found`);c.kind!==R.unmanaged&&void 0!==a.bindings&&(n[r]=e(t,a),s(n[r])&&o.push((async()=>{n[r]=await n[r]})()))}if(o.length>0)return Promise.all(o).then(()=>{})}}(pt),rt=function(e){return function t(n,i){const o=[];for(const r of i.redirections)fe(r)?o.push(...t(n,r)):o.push(e(n,r));return o}}(lt),st=function(e,t,n){return(i,o)=>{const r=e(i,o);return s(r)?t(r,i,o):n(r,i,o)}}(function(e){return(t,n)=>{const i=[];for(const o of n.constructorParams)void 0===o?i.push(void 0):i.push(e(t,o));return i.some(s)?Promise.all(i):i}}(pt),function(e){return async(t,n,i)=>{const o=await t;return e(o,n,i)}}(et(ot)),et(ot)),at=function(e){return(t,n)=>{const i=e(t,n);return s(i)?i.then(e=>n.binding.factory(...e)):n.binding.factory(...i)}}(function(e){return(t,n)=>{const i=[];for(const o of n.params)i.push(e(t,o));return i.some(s)?Promise.all(i):i}}(pt)),ct=(e=>Je(nt,e))(st),dt=(e=>Je(it,e))(at);function ut(e){return pt(e,e.planResult.tree.root)}function lt(e,t){switch(t.binding.type){case u.ConstantValue:return Xe(e,t.binding);case u.DynamicValue:return Qe(e,t.binding);case u.Factory:return Ye(e,t.binding);case u.Instance:return ct(e,t);case u.Provider:return tt(e,t.binding);case u.ResolvedValue:return dt(e,t)}}function pt(e,t){if(void 0!==t.bindings)return Array.isArray(t.bindings)?function(e,t){const n=[];for(const i of t)fe(i)?n.push(...rt(e,i)):n.push(lt(e,i));if(n.some(s))return Promise.all(n);return n}(e,t.bindings):function(e,t){if(fe(t)){const n=rt(e,t);if(1===n.length)return n[0];throw new j(P.resolution,\"Unexpected multiple resolved values on single injection\")}return lt(e,t)}(e,t.bindings)}function ft(e){return void 0!==e.scope}function vt(e,t){if(void 0!==e.lifecycle.preDestroyMethodName&&\"function\"==typeof t[e.lifecycle.preDestroyMethodName])return t[e.lifecycle.preDestroyMethodName]()}function ht(e,t,n){const i=e.getDeactivations(t);if(void 0!==i)return s(n)?gt(n,i[Symbol.iterator]()):function(e,t){let n=t.next();for(;!0!==n.done;){const i=n.value(e);if(s(i))return gt(e,t);n=t.next()}}(n,i[Symbol.iterator]())}async function gt(e,t){const n=await e;let i=t.next();for(;!0!==i.done;)await i.value(n),i=t.next()}function mt(e,t){const n=function(e,t){if(t.type===u.Instance){const n=e.getClassMetadata(t.implementationType),i=t.cache.value;return s(i)?i.then(e=>vt(n,e)):vt(n,i)}}(e,t);return void 0===n?yt(e,t):n.then(()=>yt(e,t))}function yt(e,t){const n=t.cache;return s(n.value)?n.value.then(n=>Mt(e,t,n)):Mt(e,t,n.value)}function Mt(e,t,n){let i;if(void 0!==t.onDeactivation){i=(0,t.onDeactivation)(n)}return void 0===i?ht(e,t.serviceIdentifier,n):i.then(()=>ht(e,t.serviceIdentifier,n))}function It(e,t){if(void 0===t)return;const n=function(e){const t=[];for(const n of e)ft(n)&&n.scope===d.Singleton&&n.cache.isRight&&t.push(n);return t}(t),i=[];for(const t of n){const n=mt(e,t);void 0!==n&&i.push(n)}return i.length>0?Promise.all(i).then(()=>{}):void 0}function wt(e,t){const n=e.getBindingsFromModule(t);return It(e,n)}function bt(e,t){const n=e.getBindings(t);return It(e,n)}export{g as ActivationsService,I as BindingService,R as ClassElementMetadataKind,w as DeactivationsService,Ue as PlanResultCacheService,de as ResolvedValueElementMetadataKind,d as bindingScopeValues,u as bindingTypeValues,b as decorate,c as getBindingId,x as getClassMetadata,z as inject,J as injectFromBase,G as injectable,Q as multiInject,ee as named,ne as optional,Re as plan,ie as postConstruct,oe as preDestroy,ut as resolve,It as resolveBindingsDeactivations,wt as resolveModuleDeactivations,bt as resolveServiceDeactivations,re as tagged,ce as unmanaged};\n//# sourceMappingURL=index.js.map\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport DexiePageStorage from \"./dexiePageStorage\";\nimport { DefaultPageData, PageData } from \"@xwiki/cristal-api\";\nimport { inject, injectable } from \"inversify\";\nimport type { Logger } from \"@xwiki/cristal-api\";\nimport type { OfflineStorage } from \"@xwiki/cristal-backend-api\";\n\n@injectable()\nexport default class DexieOfflineStorage implements OfflineStorage {\n private pageStorageMap: Map<string, DexiePageStorage> = new Map<\n string,\n DexiePageStorage\n >();\n private logger: Logger;\n\n constructor(@inject(\"Logger\") logger: Logger) {\n this.logger = logger;\n this.logger.setModule(\"storage.components.dexieOfflineStorage\");\n }\n\n getPageStorage(wikiName: string): DexiePageStorage {\n let pageStorage = this.pageStorageMap.get(wikiName);\n if (pageStorage == null) {\n pageStorage = new DexiePageStorage(wikiName);\n this.pageStorageMap.set(wikiName, pageStorage);\n }\n return pageStorage;\n }\n\n async getPage(wikiName: string, id: string): Promise<PageData | undefined> {\n try {\n this.logger.debug(\"Ready to load page from local storage\", id);\n const pageStorage = this.getPageStorage(wikiName);\n this.logger.debug(\"pageStorage is ready, asking for page\");\n const pageObject = await pageStorage.pages.get(id);\n const pageData = new DefaultPageData();\n pageData.fromObject(pageObject);\n return pageData;\n } catch (e) {\n this.logger.debug(\"Exception while trying to read from local storage\", e);\n return undefined;\n }\n }\n\n async savePage(wikiName: string, id: string, page: PageData): Promise<void> {\n try {\n const pageStorage = this.getPageStorage(wikiName);\n // Put must be used instead of get since the later does not allow for\n // content update.\n await pageStorage.pages.put(page.toObject(), id);\n } catch (e) {\n this.logger.debug(\n \"Exception while trying to store in local storage\",\n wikiName,\n id,\n page,\n e,\n );\n }\n }\n\n async updatePage(\n wikiName: string,\n id: string,\n page: PageData,\n ): Promise<void> {\n try {\n const pageStorage = this.getPageStorage(wikiName);\n this.logger.debug(\"Ready to store\", page);\n await pageStorage.pages.update(id, page.toObject());\n } catch (e) {\n this.logger.debug(\n \"Exception while trying to store in local storage\",\n wikiName,\n id,\n page,\n e,\n );\n }\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { inject, injectable } from \"inversify\";\nimport type {\n AttachmentsData,\n Document,\n Logger,\n PageAttachment,\n PageData,\n Storage,\n WikiConfig,\n WrappingStorage,\n} from \"@xwiki/cristal-api\";\nimport type { OfflineStorage } from \"@xwiki/cristal-backend-api\";\nimport type { QueueWorker } from \"@xwiki/cristal-sharedworker-api\";\n\n@injectable()\nexport class WrappingOfflineStorage implements WrappingStorage {\n public logger: Logger;\n // @ts-expect-error storage can be temporarily undefined during class\n // initialization\n public storage: Storage;\n public offlineStorage: OfflineStorage;\n public queueWorker: QueueWorker;\n\n constructor(\n @inject(\"Logger\") logger: Logger,\n @inject(\"OfflineStorage\") offlineStorage: OfflineStorage,\n @inject(\"QueueWorker\") queueWorker: QueueWorker,\n ) {\n this.logger = logger;\n this.logger.setModule(\"storage.components.wrappingOfflineStorage\");\n this.offlineStorage = offlineStorage;\n this.queueWorker = queueWorker;\n }\n\n public setStorage(storage: Storage): void {\n this.storage = storage;\n }\n\n public getStorage(): Storage {\n return this.storage;\n }\n\n public setWikiConfig(config: WikiConfig): void {\n return this.storage.setWikiConfig(config);\n }\n\n public getWikiConfig(): WikiConfig {\n return this.storage.getWikiConfig();\n }\n\n public async isStorageReady(): Promise<boolean> {\n return this.storage.isStorageReady();\n }\n\n public getPageRestURL(page: string, syntax: string): string {\n return this.storage.getPageRestURL(page, syntax);\n }\n\n public getPageFromViewURL(url: string): string | null {\n return this.storage.getPageFromViewURL(url);\n }\n\n public getImageURL(page: string, image: string): string {\n return this.storage.getImageURL(page, image);\n }\n\n // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.\n // eslint-disable-next-line max-statements\n public async getPageContent(\n page: string,\n syntax: string,\n _revision?: string,\n requeue?: boolean,\n ): Promise<PageData | undefined> {\n this.logger.debug(\"Trying to get data for page \", page);\n if (this.offlineStorage) {\n this.logger.debug(\"Asking offline storage for \", page);\n const pageData = await this.offlineStorage.getPage(\n this.getWikiConfig().name,\n page + \"_\" + syntax,\n );\n if (pageData != null && pageData != undefined) {\n this.logger.debug(\"Loading data from local storage for page\", page);\n // Adding page to refresh queue in shared worker\n if (requeue == undefined || requeue) {\n this.queueWorker.addToQueue(\n this.getWikiConfig().name + \":\" + page + \"_\" + syntax,\n );\n }\n return pageData;\n } else {\n this.logger.debug(\n \"Could not find data in local storage for page\",\n page,\n );\n return this.savePageContent(page, syntax);\n }\n } else {\n this.logger.debug(\"No offline local storage available\");\n return this.storage.getPageContent(page, syntax);\n }\n }\n\n public getAttachments(page: string): Promise<AttachmentsData | undefined> {\n // TODO: add support for offline storage of attachments.\n return this.storage.getAttachments(page);\n }\n\n getAttachment(\n page: string,\n name: string,\n ): Promise<PageAttachment | undefined> {\n return this.storage.getAttachment(page, name);\n }\n\n private async savePageContent(\n page: string,\n syntax: string,\n ): Promise<PageData> {\n const pageData = await this.storage.getPageContent(page, syntax);\n if (pageData) {\n pageData.id = page + \"_\" + syntax;\n this.logger.debug(\"Saving page to offline storage\", page);\n this.offlineStorage.savePage(\n this.getWikiConfig().name,\n page + \"_\" + syntax,\n pageData,\n );\n\n return pageData;\n } else {\n throw new Error(\"Can't save missing page.\");\n }\n }\n\n // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.\n // eslint-disable-next-line max-statements\n public async updatePageContent(\n page: string,\n syntax: string,\n ): Promise<boolean> {\n const currentPageData = await this.offlineStorage.getPage(\n this.getWikiConfig().name,\n page + \"_\" + syntax,\n );\n const pageData = await this.storage.getPageContent(page, syntax);\n if (currentPageData && pageData) {\n pageData.id = page + \"_\" + syntax;\n this.logger.debug(\"Saving page to offline storage\", page);\n this.offlineStorage.savePage(\n this.getWikiConfig().name,\n page + \"_\" + syntax,\n pageData,\n );\n return true;\n } else if (currentPageData?.version != pageData?.version && pageData) {\n pageData.id = page + \"_\" + syntax;\n this.logger.debug(\"Updating page to offline storage\", page);\n this.offlineStorage.updatePage(\n this.getWikiConfig().name,\n page + \"_\" + syntax,\n pageData,\n );\n return true;\n } else {\n this.logger.debug(\n \"Local storage not updated, because version are identical\",\n );\n return false;\n }\n }\n\n public async getPanelContent(\n panel: string,\n contextPage: string,\n syntax: string,\n ): Promise<PageData> {\n return this.storage.getPanelContent(panel, contextPage, syntax);\n }\n\n public async getEditField(\n document: Document,\n fieldName: string,\n ): Promise<string> {\n return await this.storage.getEditField(document, fieldName);\n }\n\n save(\n page: string,\n title: string,\n content: string,\n syntax: string,\n ): Promise<unknown> {\n return this.storage.save(page, title, content, syntax);\n }\n\n async saveAttachments(\n page: string,\n files: File[],\n ): Promise<undefined | (undefined | string)[]> {\n return this.storage.saveAttachments(page, files);\n }\n\n async delete(page: string): Promise<{ success: boolean; error?: string }> {\n return this.storage.delete(page);\n }\n\n async move(\n page: string,\n newPage: string,\n preserveChildren: boolean,\n ): Promise<{ success: boolean; error?: string }> {\n return this.storage.move(page, newPage, preserveChildren);\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport DexieOfflineStorage from \"./dexieOfflineStorage\";\nimport { WrappingOfflineStorage } from \"./wrappingOfflineStorage\";\nimport { WrappingStorage } from \"@xwiki/cristal-api\";\nimport { OfflineStorage } from \"@xwiki/cristal-backend-api\";\nimport { Container } from \"inversify\";\n\nexport class ComponentInit {\n constructor(container: Container) {\n container\n .bind<WrappingStorage>(\"WrappingStorage\")\n .to(WrappingOfflineStorage)\n .inSingletonScope();\n container\n .bind<OfflineStorage>(\"OfflineStorage\")\n .to(DexieOfflineStorage)\n .inSingletonScope();\n }\n}\n"],"names":["DexiePageStorage","Dexie","wikiName","c","t","n","e","r","u","i","f","a","v","h","S","C","N","T","j","P","A","R","$","D","k","F","V","O","E","o","_","U","z","K","L","q","G","de","DexieOfflineStorage","logger","pageStorage","id","pageObject","pageData","DefaultPageData","page","__decorateClass","injectable","__decorateParam","WrappingOfflineStorage","offlineStorage","queueWorker","storage","config","syntax","url","image","_revision","requeue","name","currentPageData","panel","contextPage","document","fieldName","title","content","files","newPage","preserveChildren","ComponentInit","container"],"mappings":";;AAuBA,MAAqBA,UAAyBC,EAAM;AAAA,EAGlD,YAAYC,GAAkB;AAC5B,UAAM,WAAWA,CAAQ,GACzB,KAAK,QAAQ,CAAC,EAAE,OAAO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,KAAqB,gBAAgB,EACrC,GAAGjC,CAAmB,EACtB,iBAAA;AAAA,EACL;AACF;","x_google_ignoreList":[1,2]}
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../src/dexiePageStorage.ts","../src/dexieOfflineStorage.ts","../src/wrappingOfflineStorage.ts","../src/index.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { default as Dexie } from \"dexie\";\nimport type { Table } from \"dexie\";\n\nexport default class DexiePageStorage extends Dexie {\n pages!: Table<object>;\n\n constructor(wikiName: string) {\n super(\"pages_\" + wikiName);\n this.version(2).stores({\n pages:\n // Primary key and indexed props\n \"id, name, content, document, css, js, document.name, document.headline, document.creator\",\n });\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport DexiePageStorage from \"./dexiePageStorage\";\nimport { DefaultPageData, PageData } from \"@xwiki/cristal-api\";\nimport { inject, injectable } from \"inversify\";\nimport type { Logger } from \"@xwiki/cristal-api\";\nimport type { OfflineStorage } from \"@xwiki/cristal-backend-api\";\n\n@injectable()\nexport default class DexieOfflineStorage implements OfflineStorage {\n private pageStorageMap: Map<string, DexiePageStorage> = new Map<\n string,\n DexiePageStorage\n >();\n private logger: Logger;\n\n constructor(@inject(\"Logger\") logger: Logger) {\n this.logger = logger;\n this.logger.setModule(\"storage.components.dexieOfflineStorage\");\n }\n\n getPageStorage(wikiName: string): DexiePageStorage {\n let pageStorage = this.pageStorageMap.get(wikiName);\n if (pageStorage == null) {\n pageStorage = new DexiePageStorage(wikiName);\n this.pageStorageMap.set(wikiName, pageStorage);\n }\n return pageStorage;\n }\n\n async getPage(wikiName: string, id: string): Promise<PageData | undefined> {\n try {\n this.logger.debug(\"Ready to load page from local storage\", id);\n const pageStorage = this.getPageStorage(wikiName);\n this.logger.debug(\"pageStorage is ready, asking for page\");\n const pageObject = await pageStorage.pages.get(id);\n const pageData = new DefaultPageData();\n pageData.fromObject(pageObject);\n return pageData;\n } catch (e) {\n this.logger.debug(\"Exception while trying to read from local storage\", e);\n return undefined;\n }\n }\n\n async savePage(wikiName: string, id: string, page: PageData): Promise<void> {\n try {\n const pageStorage = this.getPageStorage(wikiName);\n // Put must be used instead of get since the later does not allow for\n // content update.\n await pageStorage.pages.put(page.toObject(), id);\n } catch (e) {\n this.logger.debug(\n \"Exception while trying to store in local storage\",\n wikiName,\n id,\n page,\n e,\n );\n }\n }\n\n async updatePage(\n wikiName: string,\n id: string,\n page: PageData,\n ): Promise<void> {\n try {\n const pageStorage = this.getPageStorage(wikiName);\n this.logger.debug(\"Ready to store\", page);\n await pageStorage.pages.update(id, page.toObject());\n } catch (e) {\n this.logger.debug(\n \"Exception while trying to store in local storage\",\n wikiName,\n id,\n page,\n e,\n );\n }\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { inject, injectable } from \"inversify\";\nimport type {\n AttachmentsData,\n Document,\n Logger,\n PageAttachment,\n PageData,\n Storage,\n WikiConfig,\n WrappingStorage,\n} from \"@xwiki/cristal-api\";\nimport type { OfflineStorage } from \"@xwiki/cristal-backend-api\";\nimport type { QueueWorker } from \"@xwiki/cristal-sharedworker-api\";\n\n@injectable()\nexport class WrappingOfflineStorage implements WrappingStorage {\n public logger: Logger;\n // @ts-expect-error storage can be temporarily undefined during class\n // initialization\n public storage: Storage;\n public offlineStorage: OfflineStorage;\n public queueWorker: QueueWorker;\n\n constructor(\n @inject(\"Logger\") logger: Logger,\n @inject(\"OfflineStorage\") offlineStorage: OfflineStorage,\n @inject(\"QueueWorker\") queueWorker: QueueWorker,\n ) {\n this.logger = logger;\n this.logger.setModule(\"storage.components.wrappingOfflineStorage\");\n this.offlineStorage = offlineStorage;\n this.queueWorker = queueWorker;\n }\n\n public setStorage(storage: Storage): void {\n this.storage = storage;\n }\n\n public getStorage(): Storage {\n return this.storage;\n }\n\n public setWikiConfig(config: WikiConfig): void {\n return this.storage.setWikiConfig(config);\n }\n\n public getWikiConfig(): WikiConfig {\n return this.storage.getWikiConfig();\n }\n\n public async isStorageReady(): Promise<boolean> {\n return this.storage.isStorageReady();\n }\n\n public getPageRestURL(page: string, syntax: string): string {\n return this.storage.getPageRestURL(page, syntax);\n }\n\n public getPageFromViewURL(url: string): string | null {\n return this.storage.getPageFromViewURL(url);\n }\n\n public getImageURL(page: string, image: string): string {\n return this.storage.getImageURL(page, image);\n }\n\n // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.\n // eslint-disable-next-line max-statements\n public async getPageContent(\n page: string,\n syntax: string,\n _revision?: string,\n requeue?: boolean,\n ): Promise<PageData | undefined> {\n this.logger.debug(\"Trying to get data for page \", page);\n if (this.offlineStorage) {\n this.logger.debug(\"Asking offline storage for \", page);\n const pageData = await this.offlineStorage.getPage(\n this.getWikiConfig().name,\n page + \"_\" + syntax,\n );\n if (pageData != null && pageData != undefined) {\n this.logger.debug(\"Loading data from local storage for page\", page);\n // Adding page to refresh queue in shared worker\n if (requeue == undefined || requeue) {\n this.queueWorker.addToQueue(\n this.getWikiConfig().name + \":\" + page + \"_\" + syntax,\n );\n }\n return pageData;\n } else {\n this.logger.debug(\n \"Could not find data in local storage for page\",\n page,\n );\n return this.savePageContent(page, syntax);\n }\n } else {\n this.logger.debug(\"No offline local storage available\");\n return this.storage.getPageContent(page, syntax);\n }\n }\n\n public getAttachments(page: string): Promise<AttachmentsData | undefined> {\n // TODO: add support for offline storage of attachments.\n return this.storage.getAttachments(page);\n }\n\n getAttachment(\n page: string,\n name: string,\n ): Promise<PageAttachment | undefined> {\n return this.storage.getAttachment(page, name);\n }\n\n private async savePageContent(\n page: string,\n syntax: string,\n ): Promise<PageData> {\n const pageData = await this.storage.getPageContent(page, syntax);\n if (pageData) {\n pageData.id = page + \"_\" + syntax;\n this.logger.debug(\"Saving page to offline storage\", page);\n this.offlineStorage.savePage(\n this.getWikiConfig().name,\n page + \"_\" + syntax,\n pageData,\n );\n\n return pageData;\n } else {\n throw new Error(\"Can't save missing page.\");\n }\n }\n\n // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.\n // eslint-disable-next-line max-statements\n public async updatePageContent(\n page: string,\n syntax: string,\n ): Promise<boolean> {\n const currentPageData = await this.offlineStorage.getPage(\n this.getWikiConfig().name,\n page + \"_\" + syntax,\n );\n const pageData = await this.storage.getPageContent(page, syntax);\n if (currentPageData && pageData) {\n pageData.id = page + \"_\" + syntax;\n this.logger.debug(\"Saving page to offline storage\", page);\n this.offlineStorage.savePage(\n this.getWikiConfig().name,\n page + \"_\" + syntax,\n pageData,\n );\n return true;\n } else if (currentPageData?.version != pageData?.version && pageData) {\n pageData.id = page + \"_\" + syntax;\n this.logger.debug(\"Updating page to offline storage\", page);\n this.offlineStorage.updatePage(\n this.getWikiConfig().name,\n page + \"_\" + syntax,\n pageData,\n );\n return true;\n } else {\n this.logger.debug(\n \"Local storage not updated, because version are identical\",\n );\n return false;\n }\n }\n\n public async getPanelContent(\n panel: string,\n contextPage: string,\n syntax: string,\n ): Promise<PageData> {\n return this.storage.getPanelContent(panel, contextPage, syntax);\n }\n\n public async getEditField(\n document: Document,\n fieldName: string,\n ): Promise<string> {\n return await this.storage.getEditField(document, fieldName);\n }\n\n save(\n page: string,\n title: string,\n content: string,\n syntax: string,\n ): Promise<unknown> {\n return this.storage.save(page, title, content, syntax);\n }\n\n async saveAttachments(\n page: string,\n files: File[],\n ): Promise<undefined | (undefined | string)[]> {\n return this.storage.saveAttachments(page, files);\n }\n\n async delete(page: string): Promise<{ success: boolean; error?: string }> {\n return this.storage.delete(page);\n }\n\n async move(\n page: string,\n newPage: string,\n preserveChildren: boolean,\n ): Promise<{ success: boolean; error?: string }> {\n return this.storage.move(page, newPage, preserveChildren);\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport DexieOfflineStorage from \"./dexieOfflineStorage\";\nimport { WrappingOfflineStorage } from \"./wrappingOfflineStorage\";\nimport { WrappingStorage } from \"@xwiki/cristal-api\";\nimport { OfflineStorage } from \"@xwiki/cristal-backend-api\";\nimport { Container } from \"inversify\";\n\nexport class ComponentInit {\n constructor(container: Container) {\n container\n .bind<WrappingStorage>(\"WrappingStorage\")\n .to(WrappingOfflineStorage)\n .inSingletonScope();\n container\n .bind<OfflineStorage>(\"OfflineStorage\")\n .to(DexieOfflineStorage)\n .inSingletonScope();\n }\n}\n"],"names":["DexiePageStorage","Dexie","wikiName","DexieOfflineStorage","logger","pageStorage","id","pageObject","pageData","DefaultPageData","e","page","__decorateClass","injectable","__decorateParam","WrappingOfflineStorage","offlineStorage","queueWorker","storage","config","syntax","url","image","_revision","requeue","name","currentPageData","panel","contextPage","document","fieldName","title","content","files","newPage","preserveChildren","ComponentInit","container"],"mappings":";;;AAuBA,MAAqBA,UAAyBC,EAAM;AAAA,EAGlD,YAAYC,GAAkB;AAC5B,UAAM,WAAWA,CAAQ,GACzB,KAAK,QAAQ,CAAC,EAAE,OAAO;AAAA,MACrB;AAAA;AAAA,QAEE;AAAA;AAAA,IAAA,CACH;AAAA,EACH;AACF;;;;;;ACPA,IAAqBC,IAArB,MAAmE;AAAA,EAOjE,YAA8BC,GAAgB;AAN9C,SAAQ,qCAAoD,IAAA,GAO1D,KAAK,SAASA,GACd,KAAK,OAAO,UAAU,wCAAwC;AAAA,EAChE;AAAA,EAEA,eAAeF,GAAoC;AACjD,QAAIG,IAAc,KAAK,eAAe,IAAIH,CAAQ;AAClD,WAAIG,KAAe,SACjBA,IAAc,IAAIL,EAAiBE,CAAQ,GAC3C,KAAK,eAAe,IAAIA,GAAUG,CAAW,IAExCA;AAAA,EAC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AC,GACAR,GACmB;AACnB,WAAO,KAAK,QAAQ,gBAAgBO,GAAOC,GAAaR,CAAM;AAAA,EAChE;AAAA,EAEA,MAAa,aACXS,GACAC,GACiB;AACjB,WAAO,MAAM,KAAK,QAAQ,aAAaD,GAAUC,CAAS;AAAA,EAC5D;AAAA,EAEA,KACEnB,GACAoB,GACAC,GACAZ,GACkB;AAClB,WAAO,KAAK,QAAQ,KAAKT,GAAMoB,GAAOC,GAASZ,CAAM;AAAA,EACvD;AAAA,EAEA,MAAM,gBACJT,GACAsB,GAC6C;AAC7C,WAAO,KAAK,QAAQ,gBAAgBtB,GAAMsB,CAAK;AAAA,EACjD;AAAA,EAEA,MAAM,OAAOtB,GAA6D;AACxE,WAAO,KAAK,QAAQ,OAAOA,CAAI;AAAA,EACjC;AAAA,EAEA,MAAM,KACJA,GACAuB,GACAC,GAC+C;AAC/C,WAAO,KAAK,QAAQ,KAAKxB,GAAMuB,GAASC,CAAgB;AAAA,EAC1D;AACF;AAvMapB,IAANH,EAAA;AAAA,EADNC,EAAA;AAAA,EAUIC,OAAO,QAAQ,CAAA;AAAA,EACfA,OAAO,gBAAgB,CAAA;AAAA,EACvBA,OAAO,aAAa,CAAA;AAAA,GAXZC,CAAA;ACTN,MAAMqB,EAAc;AAAA,EACzB,YAAYC,GAAsB;AAChC,IAAAA,EACG,KAAsB,iBAAiB,EACvC,GAAGtB,CAAsB,EACzB,iBAAA,GACHsB,EACG,KAAqB,gBAAgB,EACrC,GAAGlC,CAAmB,EACtB,iBAAA;AAAA,EACL;AACF;"}
|
package/dist/index.umd.js
CHANGED
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
|
|
3
|
-
Cause:
|
|
4
|
-
|
|
5
|
-
${o.message}
|
|
6
|
-
|
|
7
|
-
Details
|
|
8
|
-
|
|
9
|
-
${function(i){switch(i.kind){case d.method:return`[class: "${i.targetClass.name}", method: "${i.method.toString()}"]`;case d.parameter:return`[class: "${i.targetClass.name}", index: "${i.index.toString()}"]`;case d.property:return`[class: "${i.targetClass.name}", property: "${i.property.toString()}"]`}}(r)}`,{cause:o})}throw o}function N(e,t){return(n,o,r)=>{try{r===void 0?function(i,a){const s=b(i,a);return(c,p)=>{m(c.constructor,y,j,W(s(c),p))}}(e,t)(n,o):typeof r=="number"?function(i,a){const s=b(i,a);return(c,p,O)=>{if(!function(v,C){return typeof v=="function"&&C===void 0}(c,p))throw new g(u.injectionDecoratorConflict,`Found an @inject decorator in a non constructor parameter.
|
|
10
|
-
Found @inject decorator at method "${p?.toString()??""}" at class "${c.constructor.name}"`);m(c,y,j,function(v,C){return M=>{const oe=M.constructorArguments[C];return M.constructorArguments[C]=v(oe),M}}(s(c),O))}}(e,t)(n,o,r):function(i,a){const s=b(i,a);return(c,p,O)=>{if(!function(v){return v.set!==void 0}(O))throw new g(u.injectionDecoratorConflict,`Found an @inject decorator in a non setter property method.
|
|
11
|
-
Found @inject decorator at method "${p.toString()}" at class "${c.constructor.name}"`);m(c.constructor,y,j,W(s(c),p))}}(e,t)(n,o,r)}catch(i){G(n,o,r,i)}}}function b(e,t){return n=>{const o=t(n);return r=>(o(r),e(r))}}function S(e){return N(z(f.singleInjection,e),B)}(function(e){e[e.method=0]="method",e[e.parameter=1]="parameter",e[e.property=2]="property"})(d||(d={}));const x="@inversifyjs/core/classIsInjectableFlagReflectKey",H=[Array,BigInt,Boolean,Function,Number,Object,String];function J(e){const t=P(e,"design:paramtypes");t!==void 0&&m(e,y,j,function(n){return o=>(n.forEach((r,i)=>{var a;o.constructorArguments[i]!==void 0||(a=r,H.includes(a))||(o.constructorArguments[i]=function(s){return{isFromTypescriptParamType:!0,kind:f.singleInjection,name:void 0,optional:!1,tags:new Map,value:s}}(r))}),o)}(t))}function F(e){return t=>{(function(n){if(P(n,x)!==void 0)throw new g(u.injectionDecoratorConflict,`Cannot apply @injectable decorator multiple times at class "${n.name}"`);T(n,x,!0)})(t),J(t)}}var E;(function(e){e[e.multipleInjection=0]="multipleInjection",e[e.singleInjection=1]="singleInjection"})(E||(E={}));var X=Object.getOwnPropertyDescriptor,Y=(e,t,n,o)=>{for(var r=o>1?void 0:o?X(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(r=a(r)||r);return r},Z=(e,t)=>(n,o)=>t(n,o,e);let k=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 L(e),this.pageStorageMap.set(e,t)),t}async getPage(e,t){try{this.logger.debug("Ready to load page from local storage",t);const n=this.getPageStorage(e);this.logger.debug("pageStorage is ready, asking for page");const o=await n.pages.get(t),r=new U.DefaultPageData;return r.fromObject(o),r}catch(n){this.logger.debug("Exception while trying to read from local storage",n);return}}async savePage(e,t,n){try{await this.getPageStorage(e).pages.put(n.toObject(),t)}catch(o){this.logger.debug("Exception while trying to store in local storage",e,t,n,o)}}async updatePage(e,t,n){try{const o=this.getPageStorage(e);this.logger.debug("Ready to store",n),await o.pages.update(t,n.toObject())}catch(o){this.logger.debug("Exception while trying to store in local storage",e,t,n,o)}}};k=Y([F(),Z(0,S("Logger"))],k);var ee=Object.getOwnPropertyDescriptor,te=(e,t,n,o)=>{for(var r=o>1?void 0:o?ee(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(r=a(r)||r);return r},D=(e,t)=>(n,o)=>t(n,o,e);let _=class{constructor(e,t,n){this.logger=e,this.logger.setModule("storage.components.wrappingOfflineStorage"),this.offlineStorage=t,this.queueWorker=n}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,n,o){if(this.logger.debug("Trying to get data for page ",e),this.offlineStorage){this.logger.debug("Asking offline storage for ",e);const r=await this.offlineStorage.getPage(this.getWikiConfig().name,e+"_"+t);return r!=null&&r!=null?(this.logger.debug("Loading data from local storage for page",e),(o==null||o)&&this.queueWorker.addToQueue(this.getWikiConfig().name+":"+e+"_"+t),r):(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 n=await this.storage.getPageContent(e,t);if(n)return n.id=e+"_"+t,this.logger.debug("Saving page to offline storage",e),this.offlineStorage.savePage(this.getWikiConfig().name,e+"_"+t,n),n;throw new Error("Can't save missing page.")}async updatePageContent(e,t){const n=await this.offlineStorage.getPage(this.getWikiConfig().name,e+"_"+t),o=await this.storage.getPageContent(e,t);return n&&o?(o.id=e+"_"+t,this.logger.debug("Saving page to offline storage",e),this.offlineStorage.savePage(this.getWikiConfig().name,e+"_"+t,o),!0):n?.version!=o?.version&&o?(o.id=e+"_"+t,this.logger.debug("Updating page to offline storage",e),this.offlineStorage.updatePage(this.getWikiConfig().name,e+"_"+t,o),!0):(this.logger.debug("Local storage not updated, because version are identical"),!1)}async getPanelContent(e,t,n){return this.storage.getPanelContent(e,t,n)}async getEditField(e,t){return await this.storage.getEditField(e,t)}save(e,t,n,o){return this.storage.save(e,t,n,o)}async saveAttachments(e,t){return this.storage.saveAttachments(e,t)}async delete(e){return this.storage.delete(e)}async move(e,t,n){return this.storage.move(e,t,n)}};_=te([F(),D(0,S("Logger")),D(1,S("OfflineStorage")),D(2,S("QueueWorker"))],_);class ne{constructor(t){t.bind("WrappingStorage").to(_).inSingletonScope(),t.bind("OfflineStorage").to(k).inSingletonScope()}}l.ComponentInit=ne,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(g,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("dexie"),require("@xwiki/cristal-api"),require("inversify")):typeof define=="function"&&define.amd?define(["exports","dexie","@xwiki/cristal-api","inversify"],n):(g=typeof globalThis<"u"?globalThis:g||self,n(g["cristal_backend-dexie"]={},g.Dexie,g.cristalApi,g.inversify))})(this,function(g,n,f,s){"use strict";class d extends n{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.getOwnPropertyDescriptor,S=(e,t,a,o)=>{for(var r=o>1?void 0:o?p(t,a):t,i=e.length-1,l;i>=0;i--)(l=e[i])&&(r=l(r)||r);return r},P=(e,t)=>(a,o)=>t(a,o,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 a=this.getPageStorage(e);this.logger.debug("pageStorage is ready, asking for page");const o=await a.pages.get(t),r=new f.DefaultPageData;return r.fromObject(o),r}catch(a){this.logger.debug("Exception while trying to read from local storage",a);return}}async savePage(e,t,a){try{await this.getPageStorage(e).pages.put(a.toObject(),t)}catch(o){this.logger.debug("Exception while trying to store in local storage",e,t,a,o)}}async updatePage(e,t,a){try{const o=this.getPageStorage(e);this.logger.debug("Ready to store",a),await o.pages.update(t,a.toObject())}catch(o){this.logger.debug("Exception while trying to store in local storage",e,t,a,o)}}};c=S([s.injectable(),P(0,s.inject("Logger"))],c);var m=Object.getOwnPropertyDescriptor,v=(e,t,a,o)=>{for(var r=o>1?void 0:o?m(t,a):t,i=e.length-1,l;i>=0;i--)(l=e[i])&&(r=l(r)||r);return r},u=(e,t)=>(a,o)=>t(a,o,e);let h=class{constructor(e,t,a){this.logger=e,this.logger.setModule("storage.components.wrappingOfflineStorage"),this.offlineStorage=t,this.queueWorker=a}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,a,o){if(this.logger.debug("Trying to get data for page ",e),this.offlineStorage){this.logger.debug("Asking offline storage for ",e);const r=await this.offlineStorage.getPage(this.getWikiConfig().name,e+"_"+t);return r!=null&&r!=null?(this.logger.debug("Loading data from local storage for page",e),(o==null||o)&&this.queueWorker.addToQueue(this.getWikiConfig().name+":"+e+"_"+t),r):(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 a=await this.storage.getPageContent(e,t);if(a)return a.id=e+"_"+t,this.logger.debug("Saving page to offline storage",e),this.offlineStorage.savePage(this.getWikiConfig().name,e+"_"+t,a),a;throw new Error("Can't save missing page.")}async updatePageContent(e,t){const a=await this.offlineStorage.getPage(this.getWikiConfig().name,e+"_"+t),o=await this.storage.getPageContent(e,t);return a&&o?(o.id=e+"_"+t,this.logger.debug("Saving page to offline storage",e),this.offlineStorage.savePage(this.getWikiConfig().name,e+"_"+t,o),!0):a?.version!=o?.version&&o?(o.id=e+"_"+t,this.logger.debug("Updating page to offline storage",e),this.offlineStorage.updatePage(this.getWikiConfig().name,e+"_"+t,o),!0):(this.logger.debug("Local storage not updated, because version are identical"),!1)}async getPanelContent(e,t,a){return this.storage.getPanelContent(e,t,a)}async getEditField(e,t){return await this.storage.getEditField(e,t)}save(e,t,a,o){return this.storage.save(e,t,a,o)}async saveAttachments(e,t){return this.storage.saveAttachments(e,t)}async delete(e){return this.storage.delete(e)}async move(e,t,a){return this.storage.move(e,t,a)}};h=v([s.injectable(),u(0,s.inject("Logger")),u(1,s.inject("OfflineStorage")),u(2,s.inject("QueueWorker"))],h);class b{constructor(t){t.bind("WrappingStorage").to(h).inSingletonScope(),t.bind("OfflineStorage").to(c).inSingletonScope()}}g.ComponentInit=b,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|
|
12
2
|
//# sourceMappingURL=index.umd.js.map
|
package/dist/index.umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":["../src/dexiePageStorage.ts","../../../../node_modules/.pnpm/@inversifyjs+reflect-metadata-utils@1.3.0_reflect-metadata@0.2.2/node_modules/@inversifyjs/reflect-metadata-utils/lib/esm/index.js","../../../../node_modules/.pnpm/@inversifyjs+core@6.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/esm/index.js","../src/dexieOfflineStorage.ts","../src/wrappingOfflineStorage.ts","../src/index.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { default as Dexie } from \"dexie\";\nimport type { Table } from \"dexie\";\n\nexport default class DexiePageStorage extends Dexie {\n pages!: Table<object>;\n\n constructor(wikiName: string) {\n super(\"pages_\" + wikiName);\n this.version(2).stores({\n pages:\n // Primary key and indexed props\n \"id, name, content, document, css, js, document.name, document.headline, document.creator\",\n });\n }\n}\n","function t(t){return n=>(n.push(...t),n)}function n(t){return n=>(n.push(t),n)}function e(t,n){return e=>(e[n]=t,e)}function u(){return[]}function f(){return new Map}function c(t,n,e){return Reflect.getOwnMetadata(n,t,e)}function a(t,n,e){return Reflect.getMetadata(n,t,e)}function r(t,n,e,u){Reflect.defineMetadata(n,e,t,u)}function i(t,n,e,u,f){const a=u(c(t,n,f)??e());Reflect.defineMetadata(n,a,t,f)}function o(t,n,e,u,f){const c=u(a(t,n,f)??e());Reflect.defineMetadata(n,c,t,f)}export{t as buildArrayMetadataWithArray,n as buildArrayMetadataWithElement,e as buildArrayMetadataWithIndex,u as buildEmptyArrayMetadata,f as buildEmptyMapMetadata,c as getOwnReflectMetadata,a as getReflectMetadata,r as setReflectMetadata,i as updateOwnReflectMetadata,o as updateReflectMetadata};\n//# sourceMappingURL=index.js.map\n","import{getOwnReflectMetadata as e,setReflectMetadata as t,updateOwnReflectMetadata as n}from\"@inversifyjs/reflect-metadata-utils\";import{getBaseType as i}from\"@inversifyjs/prototype-utils\";import{stringifyServiceIdentifier as o,LazyServiceIdentifier as r,isPromise as s}from\"@inversifyjs/common\";const a=\"@inversifyjs/container/bindingId\";function c(){const i=e(Object,a)??0;return i===Number.MAX_SAFE_INTEGER?t(Object,a,Number.MIN_SAFE_INTEGER):n(Object,a,()=>i,e=>e+1),i}const d={Request:\"Request\",Singleton:\"Singleton\",Transient:\"Transient\"},u={ConstantValue:\"ConstantValue\",DynamicValue:\"DynamicValue\",Factory:\"Factory\",Instance:\"Instance\",Provider:\"Provider\",ResolvedValue:\"ResolvedValue\",ServiceRedirection:\"ServiceRedirection\"};function*l(...e){for(const t of e)yield*t}class p{#e;#t;#n;constructor(e){this.#e=new Map,this.#t={};for(const t of Reflect.ownKeys(e))this.#t[t]=new Map;this.#n=e}add(e,t){this.#i(e).push(t);for(const n of Reflect.ownKeys(t))this.#o(n,t[n]).push(e)}clone(){const e=this.#r(),t=this.#s(),n=Reflect.ownKeys(this.#n),i=this._buildNewInstance(this.#n);this.#a(this.#e,i.#e,e,t);for(const t of n)this.#c(this.#t[t],i.#t[t],e);return i}get(e,t){return this.#t[e].get(t)}getAllKeys(e){return this.#t[e].keys()}removeByRelation(e,t){const n=this.get(e,t);if(void 0===n)return;const i=new Set(n);for(const n of i){const i=this.#e.get(n);if(void 0===i)throw new Error(\"Expecting model relation, none found\");for(const o of i)o[e]===t&&this.#d(n,o);this.#e.delete(n)}}_buildNewInstance(e){return new p(e)}_cloneModel(e){return e}_cloneRelation(e){return e}#r(){const e=new Map;for(const t of this.#e.keys()){const n=this._cloneModel(t);e.set(t,n)}return e}#s(){const e=new Map;for(const t of this.#e.values())for(const n of t){const t=this._cloneRelation(n);e.set(n,t)}return e}#i(e){let t=this.#e.get(e);return void 0===t&&(t=[],this.#e.set(e,t)),t}#o(e,t){let n=this.#t[e].get(t);return void 0===n&&(n=[],this.#t[e].set(t,n)),n}#u(e,t){const n=t.get(e);if(void 0===n)throw new Error(\"Expecting model to be cloned, none found\");return n}#l(e,t){const n=t.get(e);if(void 0===n)throw new Error(\"Expecting relation to be cloned, none found\");return n}#c(e,t,n){for(const[i,o]of e){const e=new Array;for(const t of o)e.push(this.#u(t,n));t.set(i,e)}}#a(e,t,n,i){for(const[o,r]of e){const e=new Array;for(const t of r)e.push(this.#l(t,i));t.set(this.#u(o,n),e)}}#d(e,t){for(const n of Reflect.ownKeys(t))this.#p(e,n,t[n])}#p(e,t,n){const i=this.#t[t].get(n);if(void 0!==i){const o=i.indexOf(e);-1!==o&&i.splice(o,1),0===i.length&&this.#t[t].delete(n)}}}var f,v,h;!function(e){e.moduleId=\"moduleId\",e.serviceId=\"serviceId\"}(f||(f={}));class g{#f;#v;constructor(e,t){this.#f=t??new p({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#v=e}static build(e){return new g(e)}add(e,t){this.#f.add(e,t)}clone(){return new g(this.#v,this.#f.clone())}get(e){const t=[],n=this.#f.get(f.serviceId,e);void 0!==n&&t.push(n);const i=this.#v()?.get(e);if(void 0!==i&&t.push(i),0!==t.length)return l(...t)}removeAllByModuleId(e){this.#f.removeByRelation(f.moduleId,e)}removeAllByServiceId(e){this.#f.removeByRelation(f.serviceId,e)}}function m(e){return e.isRight?{isRight:!0,value:e.value}:e}function y(e){switch(e.type){case u.ConstantValue:case u.DynamicValue:return function(e){return{cache:m(e.cache),id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type,value:e.value}}(e);case u.Factory:return function(e){return{cache:m(e.cache),factory:e.factory,id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case u.Instance:return function(e){return{cache:m(e.cache),id:e.id,implementationType:e.implementationType,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case u.Provider:return function(e){return{cache:m(e.cache),id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,provider:e.provider,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case u.ResolvedValue:return function(e){return{cache:m(e.cache),factory:e.factory,id:e.id,isSatisfiedBy:e.isSatisfiedBy,metadata:e.metadata,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case u.ServiceRedirection:return function(e){return{id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,serviceIdentifier:e.serviceIdentifier,targetServiceIdentifier:e.targetServiceIdentifier,type:e.type}}(e)}}!function(e){e.id=\"id\",e.moduleId=\"moduleId\",e.serviceId=\"serviceId\"}(v||(v={}));class M extends p{_buildNewInstance(e){return new M(e)}_cloneModel(e){return y(e)}}class I{#h;#v;constructor(e,t){this.#h=t??new M({id:{isOptional:!1},moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#v=e}static build(e){return new I(e)}clone(){return new I(this.#v,this.#h.clone())}get(e){return this.getNonParentBindings(e)??this.#v()?.get(e)}*getChained(e){const t=this.getNonParentBindings(e);void 0!==t&&(yield*t);const n=this.#v();void 0!==n&&(yield*n.getChained(e))}getBoundServices(){const e=new Set(this.#h.getAllKeys(v.serviceId)),t=this.#v();if(void 0!==t)for(const n of t.getBoundServices())e.add(n);return e}getById(e){return this.#h.get(v.id,e)??this.#v()?.getById(e)}getByModuleId(e){return this.#h.get(v.moduleId,e)??this.#v()?.getByModuleId(e)}getNonParentBindings(e){return this.#h.get(v.serviceId,e)}getNonParentBoundServices(){return this.#h.getAllKeys(v.serviceId)}removeById(e){this.#h.removeByRelation(v.id,e)}removeAllByModuleId(e){this.#h.removeByRelation(v.moduleId,e)}removeAllByServiceId(e){this.#h.removeByRelation(v.serviceId,e)}set(e){const t={[v.id]:e.id,[v.serviceId]:e.serviceIdentifier};void 0!==e.moduleId&&(t[v.moduleId]=e.moduleId),this.#h.add(e,t)}}!function(e){e.moduleId=\"moduleId\",e.serviceId=\"serviceId\"}(h||(h={}));class w{#g;#v;constructor(e,t){this.#g=t??new p({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#v=e}static build(e){return new w(e)}add(e,t){this.#g.add(e,t)}clone(){return new w(this.#v,this.#g.clone())}get(e){const t=[],n=this.#g.get(h.serviceId,e);void 0!==n&&t.push(n);const i=this.#v()?.get(e);if(void 0!==i&&t.push(i),0!==t.length)return l(...t)}removeAllByModuleId(e){this.#g.removeByRelation(h.moduleId,e)}removeAllByServiceId(e){this.#g.removeByRelation(h.serviceId,e)}}function b(e,t,n){const i=Array.isArray(e)?e:[e];if(void 0!==n)if(\"number\"!=typeof n)Reflect.decorate(i,t.prototype,n);else for(const e of i)e(t,void 0,n);else Reflect.decorate(i,t)}const S=\"@inversifyjs/core/classMetadataReflectKey\";function C(){return{constructorArguments:[],lifecycle:{postConstructMethodName:void 0,preDestroyMethodName:void 0},properties:new Map,scope:void 0}}const N=\"@inversifyjs/core/pendingClassMetadataCountReflectKey\";const T=Symbol.for(\"@inversifyjs/core/InversifyCoreError\");class j extends Error{[T];kind;constructor(e,t,n){super(t,n),this[T]=!0,this.kind=e}static is(e){return\"object\"==typeof e&&null!==e&&!0===e[T]}static isErrorOfKind(e,t){return j.is(e)&&e.kind===t}}var P,A,R;function x(t){const n=e(t,S)??C();if(!function(t){const n=e(t,N);return void 0!==n&&0!==n}(t))return function(e,t){const n=[];if(t.length<e.length)throw new j(P.missingInjectionDecorator,`Found unexpected missing metadata on type \"${e.name}\". \"${e.name}\" constructor requires at least ${e.length.toString()} arguments, found ${t.length.toString()} instead.\\nAre you using @inject, @multiInject or @unmanaged decorators in every non optional constructor argument?\\n\\nIf you're using typescript and want to rely on auto injection, set \"emitDecoratorMetadata\" compiler option to true`);for(let e=0;e<t.length;++e)void 0===t[e]&&n.push(e);if(n.length>0)throw new j(P.missingInjectionDecorator,`Found unexpected missing metadata on type \"${e.name}\" at constructor indexes \"${n.join('\", \"')}\".\\n\\nAre you using @inject, @multiInject or @unmanaged decorators at those indexes?\\n\\nIf you're using typescript and want to rely on auto injection, set \"emitDecoratorMetadata\" compiler option to true`)}(t,n.constructorArguments),n;!function(e,t){const n=[];for(let i=0;i<t.constructorArguments.length;++i){const o=t.constructorArguments[i];void 0!==o&&o.kind!==A.unknown||n.push(` - Missing or incomplete metadata for type \"${e.name}\" at constructor argument with index ${i.toString()}.\\nEvery constructor parameter must be decorated either with @inject, @multiInject or @unmanaged decorator.`)}for(const[i,o]of t.properties)o.kind===A.unknown&&n.push(` - Missing or incomplete metadata for type \"${e.name}\" at property \"${i.toString()}\".\\nThis property must be decorated either with @inject or @multiInject decorator.`);if(0===n.length)throw new j(P.unknown,`Unexpected class metadata for type \"${e.name}\" with uncompletion traces.\\nThis might be caused by one of the following reasons:\\n\\n1. A third party library is targeting inversify reflection metadata.\\n2. A bug is causing the issue. Consider submiting an issue to fix it.`);throw new j(P.missingInjectionDecorator,`Invalid class metadata at type ${e.name}:\\n\\n${n.join(\"\\n\\n\")}`)}(t,n)}function B(){return 0}function $(e){return t=>{void 0!==t&&t.kind===A.unknown&&n(e,N,B,e=>e-1)}}function D(e,t){return(...n)=>i=>{if(void 0===i)return e(...n);if(i.kind===R.unmanaged)throw new j(P.injectionDecoratorConflict,\"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found\");return t(i,...n)}}function k(e){if(e.kind!==A.unknown&&!0!==e.isFromTypescriptParamType)throw new j(P.injectionDecoratorConflict,\"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found\")}!function(e){e[e.injectionDecoratorConflict=0]=\"injectionDecoratorConflict\",e[e.missingInjectionDecorator=1]=\"missingInjectionDecorator\",e[e.planning=2]=\"planning\",e[e.resolution=3]=\"resolution\",e[e.unknown=4]=\"unknown\"}(P||(P={})),function(e){e[e.unknown=32]=\"unknown\"}(A||(A={})),function(e){e[e.multipleInjection=0]=\"multipleInjection\",e[e.singleInjection=1]=\"singleInjection\",e[e.unmanaged=2]=\"unmanaged\"}(R||(R={}));const F=D(function(e,t,n){return e===R.multipleInjection?{chained:n?.chained??!1,kind:e,name:void 0,optional:!1,tags:new Map,value:t}:{kind:e,name:void 0,optional:!1,tags:new Map,value:t}},function(e,t,n,i){return k(e),t===R.multipleInjection?{...e,chained:i?.chained??!1,kind:t,value:n}:{...e,kind:t,value:n}});function V(e,t){return n=>{const i=n.properties.get(t);return n.properties.set(t,e(i)),n}}var O;function E(e,t,n,i){if(j.isErrorOfKind(i,P.injectionDecoratorConflict)){const o=function(e,t,n){if(void 0===n){if(void 0===t)throw new j(P.unknown,\"Unexpected undefined property and index values\");return{kind:O.property,property:t,targetClass:e.constructor}}return\"number\"==typeof n?{index:n,kind:O.parameter,targetClass:e}:{kind:O.method,method:t,targetClass:e}}(e,t,n);throw new j(P.injectionDecoratorConflict,`Unexpected injection error.\\n\\nCause:\\n\\n${i.message}\\n\\nDetails\\n\\n${function(e){switch(e.kind){case O.method:return`[class: \"${e.targetClass.name}\", method: \"${e.method.toString()}\"]`;case O.parameter:return`[class: \"${e.targetClass.name}\", index: \"${e.index.toString()}\"]`;case O.property:return`[class: \"${e.targetClass.name}\", property: \"${e.property.toString()}\"]`}}(o)}`,{cause:i})}throw i}function _(e,t){return(i,o,r)=>{try{void 0===r?function(e,t){const i=U(e,t);return(e,t)=>{n(e.constructor,S,C,V(i(e),t))}}(e,t)(i,o):\"number\"==typeof r?function(e,t){const i=U(e,t);return(e,t,o)=>{if(!function(e,t){return\"function\"==typeof e&&void 0===t}(e,t))throw new j(P.injectionDecoratorConflict,`Found an @inject decorator in a non constructor parameter.\\nFound @inject decorator at method \"${t?.toString()??\"\"}\" at class \"${e.constructor.name}\"`);n(e,S,C,function(e,t){return n=>{const i=n.constructorArguments[t];return n.constructorArguments[t]=e(i),n}}(i(e),o))}}(e,t)(i,o,r):function(e,t){const i=U(e,t);return(e,t,o)=>{if(!function(e){return void 0!==e.set}(o))throw new j(P.injectionDecoratorConflict,`Found an @inject decorator in a non setter property method.\\nFound @inject decorator at method \"${t.toString()}\" at class \"${e.constructor.name}\"`);n(e.constructor,S,C,V(i(e),t))}}(e,t)(i,o,r)}catch(e){E(i,o,r,e)}}}function U(e,t){return n=>{const i=t(n);return t=>(i(t),e(t))}}function z(e){return _(F(R.singleInjection,e),$)}!function(e){e[e.method=0]=\"method\",e[e.parameter=1]=\"parameter\",e[e.property=2]=\"property\"}(O||(O={}));const K=\"@inversifyjs/core/classIsInjectableFlagReflectKey\";const L=[Array,BigInt,Boolean,Function,Number,Object,String];function q(t){const i=e(t,\"design:paramtypes\");void 0!==i&&n(t,S,C,function(e){return t=>(e.forEach((e,n)=>{var i;void 0!==t.constructorArguments[n]||(i=e,L.includes(i))||(t.constructorArguments[n]=function(e){return{isFromTypescriptParamType:!0,kind:R.singleInjection,name:void 0,optional:!1,tags:new Map,value:e}}(e))}),t)}(i))}function G(i){return o=>{!function(n){if(void 0!==e(n,K))throw new j(P.injectionDecoratorConflict,`Cannot apply @injectable decorator multiple times at class \"${n.name}\"`);t(n,K,!0)}(o),q(o),void 0!==i&&n(o,S,C,e=>({...e,scope:i}))}}function W(e,t,n){let i;return e.extendConstructorArguments??!0?(i=[...t.constructorArguments],n.constructorArguments.map((e,t)=>{i[t]=e})):i=n.constructorArguments,i}function X(e,t,n){let i;return i=e.extendProperties??!0?new Map(l(t.properties,n.properties)):n.properties,i}function H(e){return t=>{const i=x(e.type);n(t,S,C,function(e,t){const n=n=>({constructorArguments:W(e,t,n),lifecycle:n.lifecycle,properties:X(e,t,n),scope:n.scope});return n}(e,i))}}function J(e){return t=>{const n=i(t);if(void 0===n)throw new j(P.injectionDecoratorConflict,`Expected base type for type \"${t.name}\", none found.`);H({...e,type:n})(t)}}function Q(e,t){return _(F(R.multipleInjection,e,t),$)}function Y(e){return t=>{void 0===t&&n(e,N,B,e=>e+1)}}function Z(e){return t=>{const n=t??{kind:A.unknown,name:void 0,optional:!1,tags:new Map};if(n.kind===R.unmanaged)throw new j(P.injectionDecoratorConflict,\"Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections\");return e(n)}}function ee(e){const t=Z(function(e){return t=>{if(void 0!==t.name)throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated named decorator\");return t.name=e,t}}(e));return _(t,Y)}function te(e){if(e.optional)throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated optional decorator\");return e.optional=!0,e}function ne(){return _(Z(te),Y)}function ie(){return(e,t,i)=>{try{n(e.constructor,S,C,(o=t,e=>{if(void 0!==e.lifecycle.postConstructMethodName)throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated postConstruct decorator\");return e.lifecycle.postConstructMethodName=o,e}))}catch(n){E(e,t,void 0,n)}var o}}function oe(){return(e,t,i)=>{try{n(e.constructor,S,C,(o=t,e=>{if(void 0!==e.lifecycle.preDestroyMethodName)throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated preDestroy decorator\");return e.lifecycle.preDestroyMethodName=o,e}))}catch(n){E(e,t,void 0,n)}var o}}function re(e,t){const n=Z(function(e,t){return n=>{if(n.tags.has(e))throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated tag decorator with existing tag\");return n.tags.set(e,t),n}}(e,t));return _(n,Y)}function se(){return{kind:R.unmanaged}}const ae=D(se,function(e){if(k(e),function(e){return void 0!==e.name||e.optional||e.tags.size>0}(e))throw new j(P.injectionDecoratorConflict,\"Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections\");return se()});function ce(){return _(ae(),$)}var de;!function(e){e[e.multipleInjection=0]=\"multipleInjection\",e[e.singleInjection=1]=\"singleInjection\"}(de||(de={}));class ue{#m;constructor(e){this.#m=e}get name(){return this.#m.elem.name}get serviceIdentifier(){return this.#m.elem.serviceIdentifier}get tags(){return this.#m.elem.tags}getAncestor(){if(this.#m.elem.getAncestorsCalled=!0,void 0!==this.#m.previous)return new ue(this.#m.previous)}}function le(e,t,n){const i=n?.customServiceIdentifier??t.serviceIdentifier,o=(!0===n?.chained?[...e.operations.getBindingsChained(i)]:[...e.operations.getBindings(i)??[]]).filter(e=>e.isSatisfiedBy(t));if(0===o.length&&void 0!==e.autobindOptions&&\"function\"==typeof i){const t=function(e,t){const n=x(t),i=n.scope??e.scope;return{cache:{isRight:!1,value:void 0},id:c(),implementationType:t,isSatisfiedBy:()=>!0,moduleId:void 0,onActivation:void 0,onDeactivation:void 0,scope:i,serviceIdentifier:t,type:u.Instance}}(e.autobindOptions,i);e.operations.setBinding(t),o.push(t)}return o}class pe{last;constructor(e){this.last=e}concat(e){return new pe({elem:e,previous:this.last})}[Symbol.iterator](){let e=this.last;return{next:()=>{if(void 0===e)return{done:!0,value:void 0};const t=e.elem;return e=e.previous,{done:!1,value:t}}}}}function fe(e){return void 0!==e.redirections}function ve(e,t,n,i){const r=n.elem.serviceIdentifier,s=n.previous?.elem.serviceIdentifier;Array.isArray(e)?function(e,t,n,i,r,s){if(0!==e.length){const t=s[s.length-1]??n,a=`Ambiguous bindings found for service: \"${o(t)}\".${ye(s)}\\n\\nRegistered bindings:\\n\\n${e.map(e=>function(e){switch(e.type){case u.Instance:return`[ type: \"${e.type}\", serviceIdentifier: \"${o(e.serviceIdentifier)}\", scope: \"${e.scope}\", implementationType: \"${e.implementationType.name}\" ]`;case u.ServiceRedirection:return`[ type: \"${e.type}\", serviceIdentifier: \"${o(e.serviceIdentifier)}\", redirection: \"${o(e.targetServiceIdentifier)}\" ]`;default:return`[ type: \"${e.type}\", serviceIdentifier: \"${o(e.serviceIdentifier)}\", scope: \"${e.scope}\" ]`}}(e.binding)).join(\"\\n\")}\\n\\nTrying to resolve bindings for \"${ge(n,i)}\".${me(r)}`;throw new j(P.planning,a)}t||he(n,i,r,s)}(e,t,r,s,n.elem,i):function(e,t,n,i,o,r){void 0!==e||t||he(n,i,o,r)}(e,t,r,s,n.elem,i)}function he(e,t,n,i){const r=i[i.length-1]??e,s=`No bindings found for service: \"${o(r)}\".\\n\\nTrying to resolve bindings for \"${ge(e,t)}\".${ye(i)}${me(n)}`;throw new j(P.planning,s)}function ge(e,t){return void 0===t?`${o(e)} (Root service)`:o(t)}function me(e){const t=0===e.tags.size?\"\":`\\n- tags:\\n - ${[...e.tags.keys()].map(e=>e.toString()).join(\"\\n - \")}`;return`\\n\\nBinding constraints:\\n- service identifier: ${o(e.serviceIdentifier)}\\n- name: ${e.name?.toString()??\"-\"}${t}`}function ye(e){return 0===e.length?\"\":`\\n\\n- service redirections:\\n - ${e.map(e=>o(e)).join(\"\\n - \")}`}function Me(e,t,n,i){if(1===e.redirections.length){const[o]=e.redirections;return void(fe(o)&&Me(o,t,n,[...i,o.binding.targetServiceIdentifier]))}ve(e.redirections,t,n,i)}function Ie(e,t,n){if(Array.isArray(e.bindings)&&1===e.bindings.length){const[i]=e.bindings;return void(fe(i)&&Me(i,t,n,[i.binding.targetServiceIdentifier]))}ve(e.bindings,t,n,[])}function we(e){return r.is(e)?e.unwrap():e}function be(e,t){if(function(e){return e instanceof Error&&(e instanceof RangeError&&/stack space|call stack|too much recursion/i.test(e.message)||\"InternalError\"===e.name&&/too much recursion/.test(e.message))}(t)){const n=function(e){const t=[...e];if(0===t.length)return\"(No dependency trace)\";return t.map(o).join(\" -> \")}(function(e){const t=new Set;for(const n of e.servicesBranch){if(t.has(n))return[...t,n];t.add(n)}return[...t]}(e));throw new j(P.planning,`Circular dependency found: ${n}`,{cause:t})}throw t}const Se=Symbol.for(\"@inversifyjs/core/LazyPlanServiceNode\");class Ce{[Se];_serviceIdentifier;_serviceNode;constructor(e){this[Se]=!0,this._serviceIdentifier=e.serviceIdentifier,this._serviceNode=e}get bindings(){return this._getNode().bindings}get isContextFree(){return this._getNode().isContextFree}get serviceIdentifier(){return this._serviceIdentifier}set bindings(e){this._getNode().bindings=e}set isContextFree(e){this._getNode().isContextFree=e}static is(e){return\"object\"==typeof e&&null!==e&&!0===e[Se]}invalidate(){this._serviceNode=void 0}_getNode(){return void 0===this._serviceNode&&(this._serviceNode=this._buildPlanServiceNode()),this._serviceNode}}function Ne(e,t,n){if(void 0!==e&&n.isContextFree){const i={tree:{root:n}};t.setPlan(e,i)}else t.setNonCachedServiceNode(n)}class Te extends Ce{#y;constructor(e,t){super(t),this.#y=e}_buildPlanServiceNode(){return Ae(this.#y)}}class je extends Ce{#y;#M;#I;constructor(e,t,n,i){super(i),this.#y=e,this.#M=t,this.#I=n}_buildPlanServiceNode(){return Be(this.#y,this.#M,this.#I)}}class Pe extends Ce{#y;#M;#w;constructor(e,t,n,i){super(i),this.#y=e,this.#M=t,this.#w=n}_buildPlanServiceNode(){return $e(this.#y,this.#M,this.#w)}}function Ae(e){const t=function(e){const t=new Map;return void 0!==e.rootConstraints.tag&&t.set(e.rootConstraints.tag.key,e.rootConstraints.tag.value),new pe({elem:{getAncestorsCalled:!1,name:e.rootConstraints.name,serviceIdentifier:e.rootConstraints.serviceIdentifier,tags:t},previous:void 0})}(e),n=new ue(t.last),i=!!e.rootConstraints.isMultiple&&e.rootConstraints.chained,o=le(e,n,{chained:i}),r=[],s={bindings:r,isContextFree:!0,serviceIdentifier:e.rootConstraints.serviceIdentifier};if(r.push(...ke(e,t,o,s,i)),s.isContextFree=!t.last.elem.getAncestorsCalled,!e.rootConstraints.isMultiple){Ie(s,e.rootConstraints.isOptional??!1,t.last);const[n]=r;s.bindings=n}return s}function Re(e){try{const t=function(e){return e.rootConstraints.isMultiple?{chained:e.rootConstraints.chained,isMultiple:!0,name:e.rootConstraints.name,optional:e.rootConstraints.isOptional??!1,serviceIdentifier:e.rootConstraints.serviceIdentifier,tag:e.rootConstraints.tag}:{isMultiple:!1,name:e.rootConstraints.name,optional:e.rootConstraints.isOptional??!1,serviceIdentifier:e.rootConstraints.serviceIdentifier,tag:e.rootConstraints.tag}}(e),n=e.operations.getPlan(t);if(void 0!==n)return n;const i=Ae(e),o={tree:{root:new Te(e,i)}};return e.operations.setPlan(t,o),o}catch(t){be(e,t)}}function xe(e,t,n){const i={binding:t,classMetadata:e.operations.getClassMetadata(t.implementationType),constructorParams:[],propertyParams:new Map};return Ee({autobindOptions:e.autobindOptions,node:i,operations:e.operations,servicesBranch:e.servicesBranch},n)}function Be(e,t,n){const i=we(n.value),o=t.concat({getAncestorsCalled:!1,name:n.name,serviceIdentifier:i,tags:n.tags}),r=new ue(o.last),s=n.kind===R.multipleInjection&&n.chained,a=le(e,r,{chained:s}),c=[],d={bindings:c,isContextFree:!0,serviceIdentifier:i};if(c.push(...ke(e,o,a,d,s)),d.isContextFree=!o.last.elem.getAncestorsCalled,n.kind===R.singleInjection){Ie(d,n.optional,o.last);const[e]=c;d.bindings=e}return d}function $e(e,t,n){const i=we(n.value),o=t.concat({getAncestorsCalled:!1,name:n.name,serviceIdentifier:i,tags:n.tags}),r=new ue(o.last),s=n.kind===de.multipleInjection&&n.chained,a=le(e,r,{chained:s}),c=[],d={bindings:c,isContextFree:!0,serviceIdentifier:i};if(c.push(...ke(e,o,a,d,s)),d.isContextFree=!o.last.elem.getAncestorsCalled,n.kind===de.singleInjection){Ie(d,n.optional,o.last);const[e]=c;d.bindings=e}return d}function De(e,t,n){const i={binding:t,params:[]};return Ee({autobindOptions:e.autobindOptions,node:i,operations:e.operations,servicesBranch:e.servicesBranch},n)}function ke(e,t,n,i,o){const r=fe(i)?i.binding.targetServiceIdentifier:i.serviceIdentifier;e.servicesBranch.push(r);const s=[];for(const i of n)switch(i.type){case u.Instance:s.push(xe(e,i,t));break;case u.ResolvedValue:s.push(De(e,i,t));break;case u.ServiceRedirection:{const n=Fe(e,t,i,o);s.push(n);break}default:s.push({binding:i})}return e.servicesBranch.pop(),s}function Fe(e,t,n,i){const o={binding:n,redirections:[]},r=le(e,new ue(t.last),{chained:i,customServiceIdentifier:n.targetServiceIdentifier});return o.redirections.push(...ke(e,t,r,o,i)),o}function Ve(e,t,n){if(n.kind===R.unmanaged)return;const i=function(e){let t;if(0===e.tags.size)t=void 0;else{if(1!==e.tags.size)return;{const[n,i]=e.tags.entries().next().value;t={key:n,value:i}}}const n=r.is(e.value)?e.value.unwrap():e.value;return e.kind===R.multipleInjection?{chained:e.chained,isMultiple:!0,name:e.name,optional:e.optional,serviceIdentifier:n,tag:t}:{isMultiple:!1,name:e.name,optional:e.optional,serviceIdentifier:n,tag:t}}(n);if(void 0!==i){const t=e.operations.getPlan(i);if(void 0!==t&&t.tree.root.isContextFree)return t.tree.root}const o=Be(e,t,n),s=new je(e,t,n,o);return Ne(i,e.operations,s),s}function Oe(e,t,n){const i=function(e){let t;if(0===e.tags.size)t=void 0;else{if(1!==e.tags.size)return;{const[n,i]=e.tags.entries().next().value;t={key:n,value:i}}}const n=r.is(e.value)?e.value.unwrap():e.value;return e.kind===de.multipleInjection?{chained:e.chained,isMultiple:!0,name:e.name,optional:e.optional,serviceIdentifier:n,tag:t}:{isMultiple:!1,name:e.name,optional:e.optional,serviceIdentifier:n,tag:t}}(n);if(void 0!==i){const t=e.operations.getPlan(i);if(void 0!==t&&t.tree.root.isContextFree)return t.tree.root}const o=$e(e,t,n),s=new Pe(e,t,n,o);return Ne(i,e.operations,s),s}function Ee(e,t){return e.node.binding.type===u.Instance?function(e,t,n){const i=t.classMetadata;for(const[o,r]of i.constructorArguments.entries())t.constructorParams[o]=Ve(e,n,r);for(const[o,r]of i.properties){const i=Ve(e,n,r);void 0!==i&&t.propertyParams.set(o,i)}return e.node}(e,e.node,t):function(e,t,n){const i=t.binding.metadata;for(const[o,r]of i.arguments.entries())t.params[o]=Oe(e,n,r);return e.node}(e,e.node,t)}class _e{#b;#S;#C;constructor(){this.#b=[],this.#S=8,this.#C=1024}*[Symbol.iterator](){let e=0;for(const t of this.#b){const n=t.deref();void 0===n?++e:yield n}this.#b.length>=this.#S&&this.#N(e)&&this.#T(e)}push(e){const t=new WeakRef(e);if(this.#b.push(t),this.#b.length>=this.#S&&this.#b.length%this.#C===0){let e=0;for(const t of this.#b)void 0===t.deref()&&++e;this.#N(e)&&this.#T(e)}}#T(e){const t=new Array(this.#b.length-e);let n=0;for(const e of this.#b)e.deref()&&(t[n++]=e);this.#b=t}#N(e){return e>=.5*this.#b.length}}class Ue{#j;#P;#A;#R;#x;#B;constructor(){this.#j=new Map,this.#P=this.#$(),this.#A=this.#$(),this.#R=this.#$(),this.#x=this.#$(),this.#B=new _e}clearCache(){for(const e of this.#D())e.clear();for(const e of this.#B)e.clearCache()}get(e){return void 0===e.name?void 0===e.tag?this.#k(this.#P,e).get(e.serviceIdentifier):this.#k(this.#x,e).get(e.serviceIdentifier)?.get(e.tag.key)?.get(e.tag.value):void 0===e.tag?this.#k(this.#A,e).get(e.serviceIdentifier)?.get(e.name):this.#k(this.#R,e).get(e.serviceIdentifier)?.get(e.name)?.get(e.tag.key)?.get(e.tag.value)}invalidateService(e){this.#F(e),this.#V(e),this.#O(e),this.#E(e),this.#_(e);for(const t of this.#B)t.invalidateService(e)}set(e,t){void 0===e.name?void 0===e.tag?this.#k(this.#P,e).set(e.serviceIdentifier,t):this.#U(this.#U(this.#k(this.#x,e),e.serviceIdentifier),e.tag.key).set(e.tag.value,t):void 0===e.tag?this.#U(this.#k(this.#A,e),e.serviceIdentifier).set(e.name,t):this.#U(this.#U(this.#U(this.#k(this.#R,e),e.serviceIdentifier),e.name),e.tag.key).set(e.tag.value,t)}setNonCachedServiceNode(e){let t=this.#j.get(e.serviceIdentifier);void 0===t&&(t=new Set,this.#j.set(e.serviceIdentifier,t)),t.add(e)}subscribe(e){this.#B.push(e)}#$(){const e=new Array(8);for(let t=0;t<e.length;++t)e[t]=new Map;return e}#U(e,t){let n=e.get(t);return void 0===n&&(n=new Map,e.set(t,n)),n}#k(e,t){return e[this.#z(t)]}#D(){return[this.#j,...this.#P,...this.#A,...this.#R,...this.#x]}#z(e){return e.isMultiple?(e.chained?4:0)|(e.optional?1:0)|2:e.optional?1:0}#V(e){for(const t of this.#A){const n=t.get(e);if(void 0!==n)for(const e of n.values())Ce.is(e.tree.root)&&(this.#K(e.tree.root),e.tree.root.invalidate())}}#O(e){for(const t of this.#R){const n=t.get(e);if(void 0!==n)for(const e of n.values())for(const t of e.values())for(const e of t.values())Ce.is(e.tree.root)&&(this.#K(e.tree.root),e.tree.root.invalidate())}}#L(e){switch(e.binding.type){case u.ServiceRedirection:for(const t of e.redirections)this.#L(t);break;case u.Instance:for(const t of e.constructorParams)void 0!==t&&this.#q(t);for(const t of e.propertyParams.values())this.#q(t);break;case u.ResolvedValue:for(const t of e.params)this.#q(t)}}#q(e){const t=this.#j.get(e.serviceIdentifier);void 0!==t&&t.has(e)&&(t.delete(e),this.#K(e))}#K(e){if(void 0!==e.bindings)if(Array.isArray(e.bindings))for(const t of e.bindings)this.#L(t);else this.#L(e.bindings)}#_(e){const t=this.#j.get(e);if(void 0!==t)for(const e of t)Ce.is(e)&&(this.#K(e),e.invalidate())}#F(e){for(const t of this.#P){const n=t.get(e);void 0!==n&&Ce.is(n.tree.root)&&(this.#K(n.tree.root),n.tree.root.invalidate())}}#E(e){for(const t of this.#x){const n=t.get(e);if(void 0!==n)for(const e of n.values())for(const t of e.values())Ce.is(t.tree.root)&&(this.#K(t.tree.root),t.tree.root.invalidate())}}}function ze(e,t){return s(t)?(e.cache={isRight:!0,value:t},t.then(t=>Ke(e,t))):Ke(e,t)}function Ke(e,t){return e.cache={isRight:!0,value:t},t}function Le(e,t,n){const i=e.getActivations(t);return void 0===i?n:s(n)?qe(e,n,i[Symbol.iterator]()):function(e,t,n){let i=t,o=n.next();for(;!0!==o.done;){const t=o.value(e.context,i);if(s(t))return qe(e,t,n);i=t,o=n.next()}return i}(e,n,i[Symbol.iterator]())}async function qe(e,t,n){let i=await t,o=n.next();for(;!0!==o.done;)i=await o.value(e.context,i),o=n.next();return i}function Ge(e,t,n){let i=n;if(void 0!==t.onActivation){const n=t.onActivation;i=s(i)?i.then(t=>n(e.context,t)):n(e.context,i)}return Le(e,t.serviceIdentifier,i)}function We(e){return(t,n)=>{if(n.cache.isRight)return n.cache.value;return ze(n,Ge(t,n,e(t,n)))}}const Xe=We(function(e,t){return t.value});function He(e){return e}function Je(e,t){return(n,i)=>{const o=e(i);switch(o.scope){case d.Singleton:if(o.cache.isRight)return o.cache.value;return ze(o,Ge(n,o,t(n,i)));case d.Request:{if(n.requestScopeCache.has(o.id))return n.requestScopeCache.get(o.id);const e=Ge(n,o,t(n,i));return n.requestScopeCache.set(o.id,e),e}case d.Transient:return Ge(n,o,t(n,i))}}}const Qe=(e=>Je(He,e))(function(e,t){return t.value(e.context)});const Ye=We(function(e,t){return t.factory(e.context)});function Ze(e,t,n){const i=function(e,t,n){if(void 0===n)return;if(!(n in e))throw new j(P.resolution,`Expecting a \"${n.toString()}\" property when resolving \"${t.implementationType.name}\" class @postConstruct decorated method, none found.`);if(\"function\"!=typeof e[n])throw new j(P.resolution,`Expecting a \"${n.toString()}\" method when resolving \"${t.implementationType.name}\" class @postConstruct decorated method, a non function property was found instead.`);{let i;try{i=e[n]()}catch(e){throw new j(P.resolution,`Unexpected error found when calling \"${n.toString()}\" @postConstruct decorated method on class \"${t.implementationType.name}\"`,{cause:e})}if(s(i))return async function(e,t,n){try{await n}catch(n){throw new j(P.resolution,`Unexpected error found when calling \"${t.toString()}\" @postConstruct decorated method on class \"${e.implementationType.name}\"`,{cause:n})}}(t,n,i)}}(e,t,n);return s(i)?i.then(()=>e):e}function et(e){return(t,n,i)=>{const o=new i.binding.implementationType(...t),r=e(n,o,i);return s(r)?r.then(()=>Ze(o,i.binding,i.classMetadata.lifecycle.postConstructMethodName)):Ze(o,i.binding,i.classMetadata.lifecycle.postConstructMethodName)}}const tt=We(function(e,t){return t.provider(e.context)});function nt(e){return e.binding}function it(e){return e.binding}const ot=function(e){return(t,n,i)=>{const o=[];for(const[r,a]of i.propertyParams){const c=i.classMetadata.properties.get(r);if(void 0===c)throw new j(P.resolution,`Expecting metadata at property \"${r.toString()}\", none found`);c.kind!==R.unmanaged&&void 0!==a.bindings&&(n[r]=e(t,a),s(n[r])&&o.push((async()=>{n[r]=await n[r]})()))}if(o.length>0)return Promise.all(o).then(()=>{})}}(pt),rt=function(e){return function t(n,i){const o=[];for(const r of i.redirections)fe(r)?o.push(...t(n,r)):o.push(e(n,r));return o}}(lt),st=function(e,t,n){return(i,o)=>{const r=e(i,o);return s(r)?t(r,i,o):n(r,i,o)}}(function(e){return(t,n)=>{const i=[];for(const o of n.constructorParams)void 0===o?i.push(void 0):i.push(e(t,o));return i.some(s)?Promise.all(i):i}}(pt),function(e){return async(t,n,i)=>{const o=await t;return e(o,n,i)}}(et(ot)),et(ot)),at=function(e){return(t,n)=>{const i=e(t,n);return s(i)?i.then(e=>n.binding.factory(...e)):n.binding.factory(...i)}}(function(e){return(t,n)=>{const i=[];for(const o of n.params)i.push(e(t,o));return i.some(s)?Promise.all(i):i}}(pt)),ct=(e=>Je(nt,e))(st),dt=(e=>Je(it,e))(at);function ut(e){return pt(e,e.planResult.tree.root)}function lt(e,t){switch(t.binding.type){case u.ConstantValue:return Xe(e,t.binding);case u.DynamicValue:return Qe(e,t.binding);case u.Factory:return Ye(e,t.binding);case u.Instance:return ct(e,t);case u.Provider:return tt(e,t.binding);case u.ResolvedValue:return dt(e,t)}}function pt(e,t){if(void 0!==t.bindings)return Array.isArray(t.bindings)?function(e,t){const n=[];for(const i of t)fe(i)?n.push(...rt(e,i)):n.push(lt(e,i));if(n.some(s))return Promise.all(n);return n}(e,t.bindings):function(e,t){if(fe(t)){const n=rt(e,t);if(1===n.length)return n[0];throw new j(P.resolution,\"Unexpected multiple resolved values on single injection\")}return lt(e,t)}(e,t.bindings)}function ft(e){return void 0!==e.scope}function vt(e,t){if(void 0!==e.lifecycle.preDestroyMethodName&&\"function\"==typeof t[e.lifecycle.preDestroyMethodName])return t[e.lifecycle.preDestroyMethodName]()}function ht(e,t,n){const i=e.getDeactivations(t);if(void 0!==i)return s(n)?gt(n,i[Symbol.iterator]()):function(e,t){let n=t.next();for(;!0!==n.done;){const i=n.value(e);if(s(i))return gt(e,t);n=t.next()}}(n,i[Symbol.iterator]())}async function gt(e,t){const n=await e;let i=t.next();for(;!0!==i.done;)await i.value(n),i=t.next()}function mt(e,t){const n=function(e,t){if(t.type===u.Instance){const n=e.getClassMetadata(t.implementationType),i=t.cache.value;return s(i)?i.then(e=>vt(n,e)):vt(n,i)}}(e,t);return void 0===n?yt(e,t):n.then(()=>yt(e,t))}function yt(e,t){const n=t.cache;return s(n.value)?n.value.then(n=>Mt(e,t,n)):Mt(e,t,n.value)}function Mt(e,t,n){let i;if(void 0!==t.onDeactivation){i=(0,t.onDeactivation)(n)}return void 0===i?ht(e,t.serviceIdentifier,n):i.then(()=>ht(e,t.serviceIdentifier,n))}function It(e,t){if(void 0===t)return;const n=function(e){const t=[];for(const n of e)ft(n)&&n.scope===d.Singleton&&n.cache.isRight&&t.push(n);return t}(t),i=[];for(const t of n){const n=mt(e,t);void 0!==n&&i.push(n)}return i.length>0?Promise.all(i).then(()=>{}):void 0}function wt(e,t){const n=e.getBindingsFromModule(t);return It(e,n)}function bt(e,t){const n=e.getBindings(t);return It(e,n)}export{g as ActivationsService,I as BindingService,R as ClassElementMetadataKind,w as DeactivationsService,Ue as PlanResultCacheService,de as ResolvedValueElementMetadataKind,d as bindingScopeValues,u as bindingTypeValues,b as decorate,c as getBindingId,x as getClassMetadata,z as inject,J as injectFromBase,G as injectable,Q as multiInject,ee as named,ne as optional,Re as plan,ie as postConstruct,oe as preDestroy,ut as resolve,It as resolveBindingsDeactivations,wt as resolveModuleDeactivations,bt as resolveServiceDeactivations,re as tagged,ce as unmanaged};\n//# sourceMappingURL=index.js.map\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport DexiePageStorage from \"./dexiePageStorage\";\nimport { DefaultPageData, PageData } from \"@xwiki/cristal-api\";\nimport { inject, injectable } from \"inversify\";\nimport type { Logger } from \"@xwiki/cristal-api\";\nimport type { OfflineStorage } from \"@xwiki/cristal-backend-api\";\n\n@injectable()\nexport default class DexieOfflineStorage implements OfflineStorage {\n private pageStorageMap: Map<string, DexiePageStorage> = new Map<\n string,\n DexiePageStorage\n >();\n private logger: Logger;\n\n constructor(@inject(\"Logger\") logger: Logger) {\n this.logger = logger;\n this.logger.setModule(\"storage.components.dexieOfflineStorage\");\n }\n\n getPageStorage(wikiName: string): DexiePageStorage {\n let pageStorage = this.pageStorageMap.get(wikiName);\n if (pageStorage == null) {\n pageStorage = new DexiePageStorage(wikiName);\n this.pageStorageMap.set(wikiName, pageStorage);\n }\n return pageStorage;\n }\n\n async getPage(wikiName: string, id: string): Promise<PageData | undefined> {\n try {\n this.logger.debug(\"Ready to load page from local storage\", id);\n const pageStorage = this.getPageStorage(wikiName);\n this.logger.debug(\"pageStorage is ready, asking for page\");\n const pageObject = await pageStorage.pages.get(id);\n const pageData = new DefaultPageData();\n pageData.fromObject(pageObject);\n return pageData;\n } catch (e) {\n this.logger.debug(\"Exception while trying to read from local storage\", e);\n return undefined;\n }\n }\n\n async savePage(wikiName: string, id: string, page: PageData): Promise<void> {\n try {\n const pageStorage = this.getPageStorage(wikiName);\n // Put must be used instead of get since the later does not allow for\n // content update.\n await pageStorage.pages.put(page.toObject(), id);\n } catch (e) {\n this.logger.debug(\n \"Exception while trying to store in local storage\",\n wikiName,\n id,\n page,\n e,\n );\n }\n }\n\n async updatePage(\n wikiName: string,\n id: string,\n page: PageData,\n ): Promise<void> {\n try {\n const pageStorage = this.getPageStorage(wikiName);\n this.logger.debug(\"Ready to store\", page);\n await pageStorage.pages.update(id, page.toObject());\n } catch (e) {\n this.logger.debug(\n \"Exception while trying to store in local storage\",\n wikiName,\n id,\n page,\n e,\n );\n }\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { inject, injectable } from \"inversify\";\nimport type {\n AttachmentsData,\n Document,\n Logger,\n PageAttachment,\n PageData,\n Storage,\n WikiConfig,\n WrappingStorage,\n} from \"@xwiki/cristal-api\";\nimport type { OfflineStorage } from \"@xwiki/cristal-backend-api\";\nimport type { QueueWorker } from \"@xwiki/cristal-sharedworker-api\";\n\n@injectable()\nexport class WrappingOfflineStorage implements WrappingStorage {\n public logger: Logger;\n // @ts-expect-error storage can be temporarily undefined during class\n // initialization\n public storage: Storage;\n public offlineStorage: OfflineStorage;\n public queueWorker: QueueWorker;\n\n constructor(\n @inject(\"Logger\") logger: Logger,\n @inject(\"OfflineStorage\") offlineStorage: OfflineStorage,\n @inject(\"QueueWorker\") queueWorker: QueueWorker,\n ) {\n this.logger = logger;\n this.logger.setModule(\"storage.components.wrappingOfflineStorage\");\n this.offlineStorage = offlineStorage;\n this.queueWorker = queueWorker;\n }\n\n public setStorage(storage: Storage): void {\n this.storage = storage;\n }\n\n public getStorage(): Storage {\n return this.storage;\n }\n\n public setWikiConfig(config: WikiConfig): void {\n return this.storage.setWikiConfig(config);\n }\n\n public getWikiConfig(): WikiConfig {\n return this.storage.getWikiConfig();\n }\n\n public async isStorageReady(): Promise<boolean> {\n return this.storage.isStorageReady();\n }\n\n public getPageRestURL(page: string, syntax: string): string {\n return this.storage.getPageRestURL(page, syntax);\n }\n\n public getPageFromViewURL(url: string): string | null {\n return this.storage.getPageFromViewURL(url);\n }\n\n public getImageURL(page: string, image: string): string {\n return this.storage.getImageURL(page, image);\n }\n\n // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.\n // eslint-disable-next-line max-statements\n public async getPageContent(\n page: string,\n syntax: string,\n _revision?: string,\n requeue?: boolean,\n ): Promise<PageData | undefined> {\n this.logger.debug(\"Trying to get data for page \", page);\n if (this.offlineStorage) {\n this.logger.debug(\"Asking offline storage for \", page);\n const pageData = await this.offlineStorage.getPage(\n this.getWikiConfig().name,\n page + \"_\" + syntax,\n );\n if (pageData != null && pageData != undefined) {\n this.logger.debug(\"Loading data from local storage for page\", page);\n // Adding page to refresh queue in shared worker\n if (requeue == undefined || requeue) {\n this.queueWorker.addToQueue(\n this.getWikiConfig().name + \":\" + page + \"_\" + syntax,\n );\n }\n return pageData;\n } else {\n this.logger.debug(\n \"Could not find data in local storage for page\",\n page,\n );\n return this.savePageContent(page, syntax);\n }\n } else {\n this.logger.debug(\"No offline local storage available\");\n return this.storage.getPageContent(page, syntax);\n }\n }\n\n public getAttachments(page: string): Promise<AttachmentsData | undefined> {\n // TODO: add support for offline storage of attachments.\n return this.storage.getAttachments(page);\n }\n\n getAttachment(\n page: string,\n name: string,\n ): Promise<PageAttachment | undefined> {\n return this.storage.getAttachment(page, name);\n }\n\n private async savePageContent(\n page: string,\n syntax: string,\n ): Promise<PageData> {\n const pageData = await this.storage.getPageContent(page, syntax);\n if (pageData) {\n pageData.id = page + \"_\" + syntax;\n this.logger.debug(\"Saving page to offline storage\", page);\n this.offlineStorage.savePage(\n this.getWikiConfig().name,\n page + \"_\" + syntax,\n pageData,\n );\n\n return pageData;\n } else {\n throw new Error(\"Can't save missing page.\");\n }\n }\n\n // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.\n // eslint-disable-next-line max-statements\n public async updatePageContent(\n page: string,\n syntax: string,\n ): Promise<boolean> {\n const currentPageData = await this.offlineStorage.getPage(\n this.getWikiConfig().name,\n page + \"_\" + syntax,\n );\n const pageData = await this.storage.getPageContent(page, syntax);\n if (currentPageData && pageData) {\n pageData.id = page + \"_\" + syntax;\n this.logger.debug(\"Saving page to offline storage\", page);\n this.offlineStorage.savePage(\n this.getWikiConfig().name,\n page + \"_\" + syntax,\n pageData,\n );\n return true;\n } else if (currentPageData?.version != pageData?.version && pageData) {\n pageData.id = page + \"_\" + syntax;\n this.logger.debug(\"Updating page to offline storage\", page);\n this.offlineStorage.updatePage(\n this.getWikiConfig().name,\n page + \"_\" + syntax,\n pageData,\n );\n return true;\n } else {\n this.logger.debug(\n \"Local storage not updated, because version are identical\",\n );\n return false;\n }\n }\n\n public async getPanelContent(\n panel: string,\n contextPage: string,\n syntax: string,\n ): Promise<PageData> {\n return this.storage.getPanelContent(panel, contextPage, syntax);\n }\n\n public async getEditField(\n document: Document,\n fieldName: string,\n ): Promise<string> {\n return await this.storage.getEditField(document, fieldName);\n }\n\n save(\n page: string,\n title: string,\n content: string,\n syntax: string,\n ): Promise<unknown> {\n return this.storage.save(page, title, content, syntax);\n }\n\n async saveAttachments(\n page: string,\n files: File[],\n ): Promise<undefined | (undefined | string)[]> {\n return this.storage.saveAttachments(page, files);\n }\n\n async delete(page: string): Promise<{ success: boolean; error?: string }> {\n return this.storage.delete(page);\n }\n\n async move(\n page: string,\n newPage: string,\n preserveChildren: boolean,\n ): Promise<{ success: boolean; error?: string }> {\n return this.storage.move(page, newPage, preserveChildren);\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport DexieOfflineStorage from \"./dexieOfflineStorage\";\nimport { WrappingOfflineStorage } from \"./wrappingOfflineStorage\";\nimport { WrappingStorage } from \"@xwiki/cristal-api\";\nimport { OfflineStorage } from \"@xwiki/cristal-backend-api\";\nimport { Container } from \"inversify\";\n\nexport class ComponentInit {\n constructor(container: Container) {\n container\n .bind<WrappingStorage>(\"WrappingStorage\")\n .to(WrappingOfflineStorage)\n .inSingletonScope();\n container\n .bind<OfflineStorage>(\"OfflineStorage\")\n .to(DexieOfflineStorage)\n .inSingletonScope();\n }\n}\n"],"names":["DexiePageStorage","Dexie","wikiName","c","t","n","e","r","u","i","f","a","v","h","S","C","N","T","j","P","A","R","B","$","D","k","F","V","O","E","o","_","U","z","K","L","q","G","de","DexieOfflineStorage","logger","pageStorage","id","pageObject","pageData","DefaultPageData","page","__decorateClass","injectable","__decorateParam","WrappingOfflineStorage","offlineStorage","queueWorker","storage","config","syntax","url","image","_revision","requeue","name","currentPageData","panel","contextPage","document","fieldName","title","content","files","newPage","preserveChildren","ComponentInit","container"],"mappings":"qVAuBA,MAAqBA,UAAyBC,CAAM,CAGlD,YAAYC,EAAkB,CAC5B,MAAM,SAAWA,CAAQ,EACzB,KAAK,QAAQ,CAAC,EAAE,OAAO,CACrB,MAEE,0FAAA,CACH,CACH,CACF,CClCsK,SAASC,EAAEC,EAAEC,EAAEC,EAAE,CAAC,OAAO,QAAQ,eAAeD,EAAED,EAAEE,CAAC,CAAC,CAAqD,SAASC,EAAEH,EAAEC,EAAEC,EAAEE,EAAE,CAAC,QAAQ,eAAeH,EAAEC,EAAEF,EAAEI,CAAC,CAAC,CAAC,SAASC,EAAEL,EAAEC,EAAEC,EAAEE,EAAEE,EAAE,CAAC,MAAMC,EAAEH,EAAEL,EAAEC,EAAEC,EAAEK,CAAC,GAAGJ,EAAC,CAAE,EAAE,QAAQ,eAAeD,EAAEM,EAAEP,EAAEM,CAAC,CAAC,CCA2nE,IAAIA,EAAEE,EAAEC,GAAG,SAAS,EAAE,CAAC,EAAE,SAAS,WAAW,EAAE,UAAU,WAAW,GAAEH,IAAIA,EAAE,CAAA,EAAG,EAA4oE,SAAS,EAAE,CAAC,EAAE,GAAG,KAAK,EAAE,SAAS,WAAW,EAAE,UAAU,WAAW,EAAEE,IAAIA,EAAE,CAAA,EAAG,EAAgrC,SAAS,EAAE,CAAC,EAAE,SAAS,WAAW,EAAE,UAAU,WAAW,EAAEC,IAAIA,EAAE,CAAA,EAAG,EAAmqB,MAAMC,EAAE,4CAA4C,SAASC,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EnB,EACAoB,EACAC,EACAZ,EACkB,CAClB,OAAO,KAAK,QAAQ,KAAKT,EAAMoB,EAAOC,EAASZ,CAAM,CACvD,CAEA,MAAM,gBACJT,EACAsB,EAC6C,CAC7C,OAAO,KAAK,QAAQ,gBAAgBtB,EAAMsB,CAAK,CACjD,CAEA,MAAM,OAAOtB,EAA6D,CACxE,OAAO,KAAK,QAAQ,OAAOA,CAAI,CACjC,CAEA,MAAM,KACJA,EACAuB,EACAC,EAC+C,CAC/C,OAAO,KAAK,QAAQ,KAAKxB,EAAMuB,EAASC,CAAgB,CAC1D,CACF,EAvMapB,EAANH,GAAA,CADNC,EAAA,EAUIC,MAAO,QAAQ,CAAA,EACfA,MAAO,gBAAgB,CAAA,EACvBA,MAAO,aAAa,CAAA,CAAA,EAXZC,CAAA,ECTN,MAAMqB,EAAc,CACzB,YAAYC,EAAsB,CAChCA,EACG,KAAsB,iBAAiB,EACvC,GAAGtB,CAAsB,EACzB,iBAAA,EACHsB,EACG,KAAqB,gBAAgB,EACrC,GAAGjC,CAAmB,EACtB,iBAAA,CACL,CACF","x_google_ignoreList":[1,2]}
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":["../src/dexiePageStorage.ts","../src/dexieOfflineStorage.ts","../src/wrappingOfflineStorage.ts","../src/index.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { default as Dexie } from \"dexie\";\nimport type { Table } from \"dexie\";\n\nexport default class DexiePageStorage extends Dexie {\n pages!: Table<object>;\n\n constructor(wikiName: string) {\n super(\"pages_\" + wikiName);\n this.version(2).stores({\n pages:\n // Primary key and indexed props\n \"id, name, content, document, css, js, document.name, document.headline, document.creator\",\n });\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport DexiePageStorage from \"./dexiePageStorage\";\nimport { DefaultPageData, PageData } from \"@xwiki/cristal-api\";\nimport { inject, injectable } from \"inversify\";\nimport type { Logger } from \"@xwiki/cristal-api\";\nimport type { OfflineStorage } from \"@xwiki/cristal-backend-api\";\n\n@injectable()\nexport default class DexieOfflineStorage implements OfflineStorage {\n private pageStorageMap: Map<string, DexiePageStorage> = new Map<\n string,\n DexiePageStorage\n >();\n private logger: Logger;\n\n constructor(@inject(\"Logger\") logger: Logger) {\n this.logger = logger;\n this.logger.setModule(\"storage.components.dexieOfflineStorage\");\n }\n\n getPageStorage(wikiName: string): DexiePageStorage {\n let pageStorage = this.pageStorageMap.get(wikiName);\n if (pageStorage == null) {\n pageStorage = new DexiePageStorage(wikiName);\n this.pageStorageMap.set(wikiName, pageStorage);\n }\n return pageStorage;\n }\n\n async getPage(wikiName: string, id: string): Promise<PageData | undefined> {\n try {\n this.logger.debug(\"Ready to load page from local storage\", id);\n const pageStorage = this.getPageStorage(wikiName);\n this.logger.debug(\"pageStorage is ready, asking for page\");\n const pageObject = await pageStorage.pages.get(id);\n const pageData = new DefaultPageData();\n pageData.fromObject(pageObject);\n return pageData;\n } catch (e) {\n this.logger.debug(\"Exception while trying to read from local storage\", e);\n return undefined;\n }\n }\n\n async savePage(wikiName: string, id: string, page: PageData): Promise<void> {\n try {\n const pageStorage = this.getPageStorage(wikiName);\n // Put must be used instead of get since the later does not allow for\n // content update.\n await pageStorage.pages.put(page.toObject(), id);\n } catch (e) {\n this.logger.debug(\n \"Exception while trying to store in local storage\",\n wikiName,\n id,\n page,\n e,\n );\n }\n }\n\n async updatePage(\n wikiName: string,\n id: string,\n page: PageData,\n ): Promise<void> {\n try {\n const pageStorage = this.getPageStorage(wikiName);\n this.logger.debug(\"Ready to store\", page);\n await pageStorage.pages.update(id, page.toObject());\n } catch (e) {\n this.logger.debug(\n \"Exception while trying to store in local storage\",\n wikiName,\n id,\n page,\n e,\n );\n }\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { inject, injectable } from \"inversify\";\nimport type {\n AttachmentsData,\n Document,\n Logger,\n PageAttachment,\n PageData,\n Storage,\n WikiConfig,\n WrappingStorage,\n} from \"@xwiki/cristal-api\";\nimport type { OfflineStorage } from \"@xwiki/cristal-backend-api\";\nimport type { QueueWorker } from \"@xwiki/cristal-sharedworker-api\";\n\n@injectable()\nexport class WrappingOfflineStorage implements WrappingStorage {\n public logger: Logger;\n // @ts-expect-error storage can be temporarily undefined during class\n // initialization\n public storage: Storage;\n public offlineStorage: OfflineStorage;\n public queueWorker: QueueWorker;\n\n constructor(\n @inject(\"Logger\") logger: Logger,\n @inject(\"OfflineStorage\") offlineStorage: OfflineStorage,\n @inject(\"QueueWorker\") queueWorker: QueueWorker,\n ) {\n this.logger = logger;\n this.logger.setModule(\"storage.components.wrappingOfflineStorage\");\n this.offlineStorage = offlineStorage;\n this.queueWorker = queueWorker;\n }\n\n public setStorage(storage: Storage): void {\n this.storage = storage;\n }\n\n public getStorage(): Storage {\n return this.storage;\n }\n\n public setWikiConfig(config: WikiConfig): void {\n return this.storage.setWikiConfig(config);\n }\n\n public getWikiConfig(): WikiConfig {\n return this.storage.getWikiConfig();\n }\n\n public async isStorageReady(): Promise<boolean> {\n return this.storage.isStorageReady();\n }\n\n public getPageRestURL(page: string, syntax: string): string {\n return this.storage.getPageRestURL(page, syntax);\n }\n\n public getPageFromViewURL(url: string): string | null {\n return this.storage.getPageFromViewURL(url);\n }\n\n public getImageURL(page: string, image: string): string {\n return this.storage.getImageURL(page, image);\n }\n\n // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.\n // eslint-disable-next-line max-statements\n public async getPageContent(\n page: string,\n syntax: string,\n _revision?: string,\n requeue?: boolean,\n ): Promise<PageData | undefined> {\n this.logger.debug(\"Trying to get data for page \", page);\n if (this.offlineStorage) {\n this.logger.debug(\"Asking offline storage for \", page);\n const pageData = await this.offlineStorage.getPage(\n this.getWikiConfig().name,\n page + \"_\" + syntax,\n );\n if (pageData != null && pageData != undefined) {\n this.logger.debug(\"Loading data from local storage for page\", page);\n // Adding page to refresh queue in shared worker\n if (requeue == undefined || requeue) {\n this.queueWorker.addToQueue(\n this.getWikiConfig().name + \":\" + page + \"_\" + syntax,\n );\n }\n return pageData;\n } else {\n this.logger.debug(\n \"Could not find data in local storage for page\",\n page,\n );\n return this.savePageContent(page, syntax);\n }\n } else {\n this.logger.debug(\"No offline local storage available\");\n return this.storage.getPageContent(page, syntax);\n }\n }\n\n public getAttachments(page: string): Promise<AttachmentsData | undefined> {\n // TODO: add support for offline storage of attachments.\n return this.storage.getAttachments(page);\n }\n\n getAttachment(\n page: string,\n name: string,\n ): Promise<PageAttachment | undefined> {\n return this.storage.getAttachment(page, name);\n }\n\n private async savePageContent(\n page: string,\n syntax: string,\n ): Promise<PageData> {\n const pageData = await this.storage.getPageContent(page, syntax);\n if (pageData) {\n pageData.id = page + \"_\" + syntax;\n this.logger.debug(\"Saving page to offline storage\", page);\n this.offlineStorage.savePage(\n this.getWikiConfig().name,\n page + \"_\" + syntax,\n pageData,\n );\n\n return pageData;\n } else {\n throw new Error(\"Can't save missing page.\");\n }\n }\n\n // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.\n // eslint-disable-next-line max-statements\n public async updatePageContent(\n page: string,\n syntax: string,\n ): Promise<boolean> {\n const currentPageData = await this.offlineStorage.getPage(\n this.getWikiConfig().name,\n page + \"_\" + syntax,\n );\n const pageData = await this.storage.getPageContent(page, syntax);\n if (currentPageData && pageData) {\n pageData.id = page + \"_\" + syntax;\n this.logger.debug(\"Saving page to offline storage\", page);\n this.offlineStorage.savePage(\n this.getWikiConfig().name,\n page + \"_\" + syntax,\n pageData,\n );\n return true;\n } else if (currentPageData?.version != pageData?.version && pageData) {\n pageData.id = page + \"_\" + syntax;\n this.logger.debug(\"Updating page to offline storage\", page);\n this.offlineStorage.updatePage(\n this.getWikiConfig().name,\n page + \"_\" + syntax,\n pageData,\n );\n return true;\n } else {\n this.logger.debug(\n \"Local storage not updated, because version are identical\",\n );\n return false;\n }\n }\n\n public async getPanelContent(\n panel: string,\n contextPage: string,\n syntax: string,\n ): Promise<PageData> {\n return this.storage.getPanelContent(panel, contextPage, syntax);\n }\n\n public async getEditField(\n document: Document,\n fieldName: string,\n ): Promise<string> {\n return await this.storage.getEditField(document, fieldName);\n }\n\n save(\n page: string,\n title: string,\n content: string,\n syntax: string,\n ): Promise<unknown> {\n return this.storage.save(page, title, content, syntax);\n }\n\n async saveAttachments(\n page: string,\n files: File[],\n ): Promise<undefined | (undefined | string)[]> {\n return this.storage.saveAttachments(page, files);\n }\n\n async delete(page: string): Promise<{ success: boolean; error?: string }> {\n return this.storage.delete(page);\n }\n\n async move(\n page: string,\n newPage: string,\n preserveChildren: boolean,\n ): Promise<{ success: boolean; error?: string }> {\n return this.storage.move(page, newPage, preserveChildren);\n }\n}\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport DexieOfflineStorage from \"./dexieOfflineStorage\";\nimport { WrappingOfflineStorage } from \"./wrappingOfflineStorage\";\nimport { WrappingStorage } from \"@xwiki/cristal-api\";\nimport { OfflineStorage } from \"@xwiki/cristal-backend-api\";\nimport { Container } from \"inversify\";\n\nexport class ComponentInit {\n constructor(container: Container) {\n container\n .bind<WrappingStorage>(\"WrappingStorage\")\n .to(WrappingOfflineStorage)\n .inSingletonScope();\n container\n .bind<OfflineStorage>(\"OfflineStorage\")\n .to(DexieOfflineStorage)\n .inSingletonScope();\n }\n}\n"],"names":["DexiePageStorage","Dexie","wikiName","DexieOfflineStorage","logger","pageStorage","id","pageObject","pageData","DefaultPageData","e","page","__decorateClass","injectable","__decorateParam","WrappingOfflineStorage","offlineStorage","queueWorker","storage","config","syntax","url","image","_revision","requeue","name","currentPageData","panel","contextPage","document","fieldName","title","content","files","newPage","preserveChildren","ComponentInit","container"],"mappings":"oYAuBA,MAAqBA,UAAyBC,CAAM,CAGlD,YAAYC,EAAkB,CAC5B,MAAM,SAAWA,CAAQ,EACzB,KAAK,QAAQ,CAAC,EAAE,OAAO,CACrB,MAEE,0FAAA,CACH,CACH,CACF,sKCPA,IAAqBC,EAArB,KAAmE,CAOjE,YAA8BC,EAAgB,CAN9C,KAAQ,mBAAoD,IAO1D,KAAK,OAASA,EACd,KAAK,OAAO,UAAU,wCAAwC,CAChE,CAEA,eAAeF,EAAoC,CACjD,IAAIG,EAAc,KAAK,eAAe,IAAIH,CAAQ,EAClD,OAAIG,GAAe,OACjBA,EAAc,IAAIL,EAAiBE,CAAQ,EAC3C,KAAK,eAAe,IAAIA,EAAUG,CAAW,GAExCA,CACT,CAEA,MAAM,QAAQH,EAAkBI,EAA2C,CACzE,GAAI,CACF,KAAK,OAAO,MAAM,wCAAyCA,CAAE,EAC7D,MAAMD,EAAc,KAAK,eAAeH,CAAQ,EAChD,KAAK,OAAO,MAAM,uCAAuC,EACzD,MAAMK,EAAa,MAAMF,EAAY,MAAM,IAAIC,CAAE,EAC3CE,EAAW,IAAIC,kBACrB,OAAAD,EAAS,WAAWD,CAAU,EACvBC,CACT,OAASE,EAAG,CACV,KAAK,OAAO,MAAM,oDAAqDA,CAAC,EACxE,MACF,CACF,CAEA,MAAM,SAASR,EAAkBI,EAAYK,EAA+B,CAC1E,GAAI,CAIF,MAHoB,KAAK,eAAeT,CAAQ,EAG9B,MAAM,IAAIS,EAAK,SAAA,EAAYL,CAAE,CACjD,OAASI,EAAG,CACV,KAAK,OAAO,MACV,mDACAR,EACAI,EACAK,EACAD,CAAA,CAEJ,CACF,CAEA,MAAM,WACJR,EACAI,EACAK,EACe,CACf,GAAI,CACF,MAAMN,EAAc,KAAK,eAAeH,CAAQ,EAChD,KAAK,OAAO,MAAM,iBAAkBS,CAAI,EACxC,MAAMN,E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BACXmB,EACAC,EACAR,EACmB,CACnB,OAAO,KAAK,QAAQ,gBAAgBO,EAAOC,EAAaR,CAAM,CAChE,CAEA,MAAa,aACXS,EACAC,EACiB,CACjB,OAAO,MAAM,KAAK,QAAQ,aAAaD,EAAUC,CAAS,CAC5D,CAEA,KACEnB,EACAoB,EACAC,EACAZ,EACkB,CAClB,OAAO,KAAK,QAAQ,KAAKT,EAAMoB,EAAOC,EAASZ,CAAM,CACvD,CAEA,MAAM,gBACJT,EACAsB,EAC6C,CAC7C,OAAO,KAAK,QAAQ,gBAAgBtB,EAAMsB,CAAK,CACjD,CAEA,MAAM,OAAOtB,EAA6D,CACxE,OAAO,KAAK,QAAQ,OAAOA,CAAI,CACjC,CAEA,MAAM,KACJA,EACAuB,EACAC,EAC+C,CAC/C,OAAO,KAAK,QAAQ,KAAKxB,EAAMuB,EAASC,CAAgB,CAC1D,CACF,EAvMapB,EAANH,EAAA,CADNC,aAAA,EAUIC,aAAO,QAAQ,CAAA,EACfA,aAAO,gBAAgB,CAAA,EACvBA,aAAO,aAAa,CAAA,CAAA,EAXZC,CAAA,ECTN,MAAMqB,CAAc,CACzB,YAAYC,EAAsB,CAChCA,EACG,KAAsB,iBAAiB,EACvC,GAAGtB,CAAsB,EACzB,iBAAA,EACHsB,EACG,KAAqB,gBAAgB,EACrC,GAAGlC,CAAmB,EACtB,iBAAA,CACL,CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xwiki/cristal-backend-dexie",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.1",
|
|
4
4
|
"license": "LGPL 2.1",
|
|
5
5
|
"author": "XWiki Org Community <contact@xwiki.org>",
|
|
6
6
|
"homepage": "https://cristal.xwiki.org/",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"main": "./dist/index.es.js",
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"dexie": "4.0.11",
|
|
31
|
-
"@xwiki/cristal-api": "0.21.
|
|
32
|
-
"@xwiki/cristal-
|
|
33
|
-
"@xwiki/cristal-sharedworker-api": "0.21.
|
|
31
|
+
"@xwiki/cristal-backend-api": "0.21.1",
|
|
32
|
+
"@xwiki/cristal-api": "0.21.1",
|
|
33
|
+
"@xwiki/cristal-sharedworker-api": "0.21.1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"inversify": "7.x",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"reflect-metadata": "0.2.2",
|
|
42
42
|
"typescript": "5.9.2",
|
|
43
43
|
"vite": "7.0.6",
|
|
44
|
-
"@xwiki/cristal-dev-config": "0.21.
|
|
44
|
+
"@xwiki/cristal-dev-config": "0.21.1"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "tsc --project tsconfig.json && vite build",
|