@data-eden/cache
Advanced tools
Comparing version 0.13.1 to 0.13.2
@@ -1,20 +0,20 @@ | ||
var ot = (c, t, e) => { | ||
var at = (c, t, e) => { | ||
if (!t.has(c)) | ||
throw TypeError("Cannot " + e); | ||
}; | ||
var s = (c, t, e) => (ot(c, t, "read from private field"), e ? e.call(c) : t.get(c)), o = (c, t, e) => { | ||
var s = (c, t, e) => (at(c, t, "read from private field"), e ? e.call(c) : t.get(c)), o = (c, t, e) => { | ||
if (t.has(c)) | ||
throw TypeError("Cannot add the same private member more than once"); | ||
t instanceof WeakSet ? t.add(c) : t.set(c, e); | ||
}, a = (c, t, e, i) => (ot(c, t, "write to private field"), i ? i.call(c, e) : t.set(c, e), e); | ||
var v = (c, t, e) => (ot(c, t, "access private method"), e); | ||
var N, V, U, j, I, z, g, m, T; | ||
class yt { | ||
}, a = (c, t, e, i) => (at(c, t, "write to private field"), i ? i.call(c, e) : t.set(c, e), e); | ||
var d = (c, t, e) => (at(c, t, "access private method"), e); | ||
var V, U, j, z, b, F, g, m, T; | ||
class ut { | ||
constructor(t, e = {}) { | ||
o(this, N, void 0); | ||
o(this, V, void 0); | ||
o(this, U, void 0); | ||
o(this, j, void 0); | ||
o(this, I, void 0); | ||
o(this, z, void 0); | ||
o(this, b, void 0); | ||
o(this, F, void 0); | ||
o(this, g, void 0); | ||
@@ -24,3 +24,3 @@ o(this, m, void 0); | ||
var i, n, r; | ||
a(this, N, t), a(this, V, /* @__PURE__ */ new Map()), a(this, T, /* @__PURE__ */ new Map()), a(this, I, A.ttl), a(this, z, A.lru), a(this, g, ((i = s(this, N).getCacheOptions()) == null ? void 0 : i.expiration) || A), this.context = e, s(this, g) && ((n = s(this, g)) != null && n.lru) && typeof s(this, g).lru == "number" && a(this, z, s(this, g).lru), s(this, g) && ((r = s(this, g)) != null && r.ttl) && typeof s(this, g).ttl == "number" && a(this, I, s(this, g).ttl), a(this, m, /* @__PURE__ */ new Map()), a(this, j, /* @__PURE__ */ new Map()), a(this, U, /* @__PURE__ */ new Map()); | ||
a(this, V, t), a(this, U, /* @__PURE__ */ new Map()), a(this, T, /* @__PURE__ */ new Map()), a(this, b, N.ttl), a(this, F, N.lru), a(this, g, ((i = s(this, V).getCacheOptions()) == null ? void 0 : i.expiration) || N), this.context = e, s(this, g) && ((n = s(this, g)) != null && n.lru) && typeof s(this, g).lru == "number" && a(this, F, s(this, g).lru), s(this, g) && ((r = s(this, g)) != null && r.ttl) && typeof s(this, g).ttl == "number" && a(this, b, s(this, g).ttl), a(this, m, /* @__PURE__ */ new Map()), a(this, z, /* @__PURE__ */ new Map()), a(this, j, /* @__PURE__ */ new Map()); | ||
} | ||
@@ -30,4 +30,4 @@ getExpirationPolicies() { | ||
userOptionExpirationPolicy: s(this, g), | ||
lruPolicy: s(this, z), | ||
ttlPolicy: s(this, I) | ||
lruPolicy: s(this, F), | ||
ttlPolicy: s(this, b) | ||
}; | ||
@@ -49,3 +49,3 @@ } | ||
setRevisionsBeforeTransactionStart(t) { | ||
a(this, j, t); | ||
a(this, z, t); | ||
} | ||
@@ -59,6 +59,6 @@ setCacheEntryState(t, e) { | ||
setCacheEntriesBeforeTransaction(t) { | ||
a(this, U, t); | ||
a(this, j, t); | ||
} | ||
getTransactionalCache() { | ||
return s(this, V); | ||
return s(this, U); | ||
} | ||
@@ -81,5 +81,5 @@ async *[Symbol.asyncIterator]() { | ||
return s(this, T).set(t, { | ||
retained: { lru: !0, ttl: s(this, I) }, | ||
retained: { lru: !0, ttl: s(this, b) }, | ||
lastAccessed: Date.now() | ||
}), e || await s(this, N).get(t); | ||
}), e || await s(this, V).get(t); | ||
} | ||
@@ -92,3 +92,3 @@ localEntries() { | ||
} | ||
}[Symbol.asyncIterator](s(this, V)); | ||
}[Symbol.asyncIterator](s(this, U)); | ||
} | ||
@@ -106,3 +106,3 @@ async entries() { | ||
this.localEntries(), | ||
s(this, U) | ||
s(this, j) | ||
); | ||
@@ -125,3 +125,3 @@ } | ||
} | ||
}, i = s(this, j).get(t) || [], n = s(this, m).get(t) || []; | ||
}, i = s(this, z).get(t) || [], n = s(this, m).get(t) || []; | ||
return e[Symbol.asyncIterator]( | ||
@@ -132,25 +132,25 @@ i.concat(n) | ||
} | ||
N = new WeakMap(), V = new WeakMap(), U = new WeakMap(), j = new WeakMap(), I = new WeakMap(), z = new WeakMap(), g = new WeakMap(), m = new WeakMap(), T = new WeakMap(); | ||
const ct = 0; | ||
var k, F, Y, W, G, x, S, H, ut, $, at; | ||
class Tt extends yt { | ||
V = new WeakMap(), U = new WeakMap(), j = new WeakMap(), z = new WeakMap(), b = new WeakMap(), F = new WeakMap(), g = new WeakMap(), m = new WeakMap(), T = new WeakMap(); | ||
const ht = 0; | ||
var k, J, H, $, Z, x, S, K, ft, D, ct; | ||
class xt extends ut { | ||
constructor(e, i, n, r, h = {}) { | ||
super(e); | ||
o(this, H); | ||
o(this, K); | ||
// assign transaction or cache level overriden merge strategy else use default | ||
o(this, $); | ||
o(this, D); | ||
o(this, k, void 0); | ||
o(this, F, void 0); | ||
o(this, Y, void 0); | ||
o(this, W, void 0); | ||
o(this, G, void 0); | ||
o(this, J, void 0); | ||
o(this, H, void 0); | ||
o(this, $, void 0); | ||
o(this, Z, void 0); | ||
o(this, x, void 0); | ||
o(this, S, void 0); | ||
a(this, k, e), a(this, S, r), a(this, F, this.getTransactionalCache()), this.context = h, this.setCacheEntriesBeforeTransaction(i), this.setRevisionsBeforeTransactionStart(n); | ||
const { userOptionExpirationPolicy: l, lruPolicy: y, ttlPolicy: f } = this.getExpirationPolicies(); | ||
a(this, W, f), a(this, G, y), a(this, Y, l); | ||
a(this, k, e), a(this, S, r), a(this, J, this.getTransactionalCache()), this.context = h, this.setCacheEntriesBeforeTransaction(i), this.setRevisionsBeforeTransactionStart(n); | ||
const { userOptionExpirationPolicy: u, lruPolicy: l, ttlPolicy: f } = this.getExpirationPolicies(); | ||
a(this, $, f), a(this, Z, l), a(this, H, u); | ||
} | ||
async set(e, i) { | ||
return s(this, F).set(e, i), this.setCacheEntryState(e, { | ||
retained: { lru: !0, ttl: s(this, W) }, | ||
return s(this, J).set(e, i), this.setCacheEntryState(e, { | ||
retained: { lru: !0, ttl: s(this, $) }, | ||
lastAccessed: Date.now() | ||
@@ -160,3 +160,3 @@ }), await this.get(e); | ||
async delete(e) { | ||
return await this.get(e) ? (s(this, F).delete(e), this.setCacheEntryState(e, { | ||
return await this.get(e) ? (s(this, J).delete(e), this.setCacheEntryState(e, { | ||
retained: { lru: !1, ttl: 0 }, | ||
@@ -168,6 +168,7 @@ deletedRecordInTransaction: !0, | ||
async merge(e, i, n) { | ||
var y, v; | ||
a(this, x, n == null ? void 0 : n.revisionContext); | ||
const r = v(this, $, at).call(this, n == null ? void 0 : n.entityMergeStrategy), h = await s(this, k).get(e), l = this.getLocalRevisionsByEntry(e); | ||
let y = l && l[l.length - 1].revision ? l[l.length - 1].revision : ct; | ||
y = ++y; | ||
const r = d(this, D, ct).call(this, n == null ? void 0 : n.entityMergeStrategy), h = await s(this, k).get(e), u = this.getLocalRevisionsByEntry(e); | ||
let l = (u && ((y = u[u.length - 1]) != null && y.revision) ? (v = u[u.length - 1]) == null ? void 0 : v.revision : ht) ?? 0; | ||
l = ++l; | ||
const f = h ? r( | ||
@@ -177,3 +178,3 @@ e, | ||
entity: i, | ||
revision: y, | ||
revision: l, | ||
revisionContext: s(this, x) | ||
@@ -187,3 +188,3 @@ }, | ||
entity: f, | ||
revision: y, | ||
revision: l, | ||
revisionContext: s(this, x) | ||
@@ -197,3 +198,3 @@ }; | ||
try { | ||
return i = await v(this, H, ut).call(this), s(this, S).commitUpdatesAndReleaseLock( | ||
return i = await d(this, K, ft).call(this), s(this, S).commitUpdatesAndReleaseLock( | ||
this, | ||
@@ -209,38 +210,38 @@ i | ||
} | ||
k = new WeakMap(), F = new WeakMap(), Y = new WeakMap(), W = new WeakMap(), G = new WeakMap(), x = new WeakMap(), S = new WeakMap(), H = new WeakSet(), ut = async function() { | ||
var n, r; | ||
k = new WeakMap(), J = new WeakMap(), H = new WeakMap(), $ = new WeakMap(), Z = new WeakMap(), x = new WeakMap(), S = new WeakMap(), K = new WeakSet(), ft = async function() { | ||
var n, r, h, u; | ||
const e = []; | ||
for await (const [h, l] of this.localEntries()) { | ||
const y = await s(this, k).get(h); | ||
let f; | ||
const L = v(this, $, at).call(this), u = this.getLocalRevisionsByEntry(h); | ||
let d = u && u[u.length - 1].revision ? u[u.length - 1].revision : ct; | ||
d = ++d, y && L ? f = L( | ||
h, | ||
for await (const [l, f] of this.localEntries()) { | ||
const L = await s(this, k).get(l); | ||
let y; | ||
const v = d(this, D, ct).call(this), I = this.getLocalRevisionsByEntry(l); | ||
let X = (I && ((n = I[I.length - 1]) != null && n.revision) ? (r = I[I.length - 1]) == null ? void 0 : r.revision : ht) ?? 0; | ||
X = ++X, L && v ? y = v( | ||
l, | ||
{ | ||
entity: l, | ||
revision: d, | ||
entity: f, | ||
revision: X, | ||
revisionContext: s(this, x) | ||
}, | ||
y, | ||
L, | ||
this | ||
) : f = l; | ||
const rt = kt( | ||
f | ||
), Et = this.getCacheEntryState(h) || dt; | ||
e.push([h, rt, Et]); | ||
const St = { | ||
entity: f, | ||
revision: d, | ||
) : y = f; | ||
const St = Lt( | ||
y | ||
), Tt = this.getCacheEntryState(l) || gt; | ||
e.push([l, St, Tt]); | ||
const kt = { | ||
entity: y, | ||
revision: X, | ||
revisionContext: s(this, x) | ||
}; | ||
this.setLocalRevisionsByEntry(h, St), s(this, S).updateSavedRevisions( | ||
this.setLocalRevisionsByEntry(l, kt), s(this, S).updateSavedRevisions( | ||
this.getLocalRevisions() | ||
), await s(this, S).applyRetentionPolicies(h, this); | ||
), await s(this, S).applyRetentionPolicies(l, this); | ||
} | ||
const i = (r = (n = s(this, k).getCacheOptions()) == null ? void 0 : n.hooks) == null ? void 0 : r.commit; | ||
const i = (u = (h = s(this, k).getCacheOptions()) == null ? void 0 : h.hooks) == null ? void 0 : u.commit; | ||
return i && await i(this), { | ||
entries: e | ||
}; | ||
}, $ = new WeakSet(), at = function(e) { | ||
}, D = new WeakSet(), ct = function(e) { | ||
var n, r; | ||
@@ -250,3 +251,3 @@ const i = (r = (n = s(this, k).getCacheOptions()) == null ? void 0 : n.hooks) == null ? void 0 : r.entitymergeStrategy; | ||
}; | ||
function kt(c) { | ||
function Lt(c) { | ||
try { | ||
@@ -260,11 +261,11 @@ return JSON.parse(JSON.stringify(c)); | ||
} | ||
var w, Z, ft, K, vt; | ||
class xt extends yt { | ||
var w, tt, vt, et, dt; | ||
class It extends ut { | ||
constructor(e, i) { | ||
super(e); | ||
o(this, Z); | ||
o(this, K); | ||
o(this, tt); | ||
o(this, et); | ||
o(this, w, void 0); | ||
this.setRevisionsBeforeTransactionStart(i); | ||
const n = (h, l) => v(this, Z, ft).call(this, h, l), r = (h) => v(this, K, vt).call(this, h); | ||
const n = (h, u) => d(this, tt, vt).call(this, h, u), r = (h) => d(this, et, dt).call(this, h); | ||
this.cache = { | ||
@@ -282,3 +283,3 @@ clearRevisions: r, | ||
} | ||
w = new WeakMap(), Z = new WeakSet(), ft = function(e, i) { | ||
w = new WeakMap(), tt = new WeakSet(), vt = function(e, i) { | ||
var n; | ||
@@ -290,40 +291,40 @@ if (s(this, w).has(e)) { | ||
s(this, w).set(e, i); | ||
}, K = new WeakSet(), vt = function(e) { | ||
}, et = new WeakSet(), dt = function(e) { | ||
s(this, w).has(e) && s(this, w).delete(e); | ||
}; | ||
const A = { lru: 1e4, ttl: 6e4 }, dt = { | ||
retained: { lru: !1, ttl: A.ttl } | ||
const N = { lru: 1e4, ttl: 6e4 }, gt = { | ||
retained: { lru: !1, ttl: N.ttl } | ||
}; | ||
var R, p, b, O, M, J, _, P, C, B, tt, gt, et, mt, q, X, st, wt, it, Rt, nt, pt; | ||
class Lt { | ||
var R, p, O, M, P, _, q, B, C, A, st, mt, it, wt, W, G, nt, Rt, rt, pt, ot, Ct; | ||
class bt { | ||
constructor(t) { | ||
o(this, tt); | ||
o(this, et); | ||
o(this, q); | ||
o(this, st); | ||
o(this, it); | ||
o(this, W); | ||
o(this, nt); | ||
o(this, rt); | ||
o(this, ot); | ||
o(this, R, void 0); | ||
o(this, p, void 0); | ||
o(this, b, void 0); | ||
o(this, O, void 0); | ||
o(this, M, void 0); | ||
o(this, J, void 0); | ||
o(this, P, void 0); | ||
o(this, _, void 0); | ||
o(this, P, void 0); | ||
o(this, q, void 0); | ||
o(this, B, void 0); | ||
o(this, C, void 0); | ||
o(this, B, void 0); | ||
o(this, A, void 0); | ||
var i, n, r, h; | ||
a(this, R, /* @__PURE__ */ new Map()), a(this, b, { | ||
a(this, R, /* @__PURE__ */ new Map()), a(this, O, { | ||
hooks: { | ||
commit: (i = t == null ? void 0 : t.hooks) == null ? void 0 : i.commit, | ||
entitymergeStrategy: ((n = t == null ? void 0 : t.hooks) == null ? void 0 : n.entitymergeStrategy) || bt, | ||
revisionMergeStrategy: ((r = t == null ? void 0 : t.hooks) == null ? void 0 : r.revisionMergeStrategy) || ht | ||
entitymergeStrategy: ((n = t == null ? void 0 : t.hooks) == null ? void 0 : n.entitymergeStrategy) || Mt, | ||
revisionMergeStrategy: ((r = t == null ? void 0 : t.hooks) == null ? void 0 : r.revisionMergeStrategy) || lt | ||
}, | ||
expiration: (t == null ? void 0 : t.expiration) || A | ||
}), a(this, J, A.lru), a(this, p, /* @__PURE__ */ new Map()), a(this, O, /* @__PURE__ */ new Map()); | ||
const e = ((h = s(this, b)) == null ? void 0 : h.expiration) || A; | ||
e && (e != null && e.lru) && typeof e.lru == "number" && a(this, J, e.lru), a(this, M, new It(s(this, J))), a(this, C, null), a(this, B, []), a(this, _, new FinalizationRegistry((l) => { | ||
const y = s(this, R), f = y.get(l); | ||
f && !f.deref() && y.delete(l); | ||
expiration: (t == null ? void 0 : t.expiration) || N | ||
}), a(this, _, N.lru), a(this, p, /* @__PURE__ */ new Map()), a(this, M, /* @__PURE__ */ new Map()); | ||
const e = ((h = s(this, O)) == null ? void 0 : h.expiration) || N; | ||
e && (e != null && e.lru) && typeof e.lru == "number" && a(this, _, e.lru), a(this, P, new Ot(s(this, _))), a(this, C, null), a(this, A, []), a(this, q, new FinalizationRegistry((u) => { | ||
const l = s(this, R), f = l.get(u); | ||
f && !f.deref() && l.delete(u); | ||
})); | ||
@@ -336,6 +337,6 @@ } | ||
for await (const [t] of this.entries()) | ||
s(this, R).delete(t), s(this, M).getCache().delete(t), s(this, p).delete(t); | ||
s(this, R).delete(t), s(this, P).getCache().delete(t), s(this, p).delete(t); | ||
} | ||
getCacheOptions() { | ||
return s(this, b); | ||
return s(this, O); | ||
} | ||
@@ -353,3 +354,3 @@ async get(t) { | ||
for await (const [e, i, n] of this.entries()) { | ||
const r = lt( | ||
const r = yt( | ||
i | ||
@@ -370,4 +371,4 @@ ); | ||
for await (let n of t) { | ||
let [r, h, l] = n, y = lt(h); | ||
s(this, R).set(r, new WeakRef(y)), s(this, _).register(y, r), s(this, M).set(r, y), s(this, O).set(r, l); | ||
let [r, h, u] = n, l = yt(h); | ||
s(this, R).set(r, new WeakRef(l)), s(this, q).register(l, r), s(this, P).set(r, l), s(this, M).set(r, u); | ||
const f = { | ||
@@ -394,3 +395,3 @@ entity: h, | ||
if (i) { | ||
const n = s(this, O).get(e) || dt; | ||
const n = s(this, M).get(e) || gt; | ||
yield [e, i, n]; | ||
@@ -432,10 +433,10 @@ } | ||
async beginTransaction(t) { | ||
const e = (u) => v(this, et, mt).call(this, u), i = (u) => v(this, q, X).call(this, u), n = (u, d) => v(this, it, Rt).call(this, u, d), r = (u, d) => v(this, st, wt).call(this, u, d), h = (u) => v(this, nt, pt).call(this, u), l = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(); | ||
for await (const [u, d] of this.entries()) | ||
l.set(u, d); | ||
for await (const [u] of this.entries()) { | ||
const d = []; | ||
for await (const rt of this.entryRevisions(u)) | ||
d.push(rt); | ||
y.set(u, d); | ||
const e = (y) => d(this, it, wt).call(this, y), i = (y) => d(this, W, G).call(this, y), n = (y, v) => d(this, rt, pt).call(this, y, v), r = (y, v) => d(this, nt, Rt).call(this, y, v), h = (y) => d(this, ot, Ct).call(this, y), u = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(); | ||
for await (const [y, v] of this.entries()) | ||
u.set(y, v); | ||
for await (const [y] of this.entries()) { | ||
const v = []; | ||
for await (const I of this.entryRevisions(y)) | ||
v.push(I); | ||
l.set(y, v); | ||
} | ||
@@ -449,9 +450,9 @@ const f = { | ||
}; | ||
return a(this, P, new xt( | ||
return a(this, B, new It( | ||
this, | ||
y | ||
)), new Tt( | ||
l | ||
)), new xt( | ||
this, | ||
u, | ||
l, | ||
y, | ||
f, | ||
@@ -462,3 +463,3 @@ t | ||
} | ||
R = new WeakMap(), p = new WeakMap(), b = new WeakMap(), O = new WeakMap(), M = new WeakMap(), J = new WeakMap(), _ = new WeakMap(), P = new WeakMap(), C = new WeakMap(), B = new WeakMap(), tt = new WeakSet(), gt = function(t) { | ||
R = new WeakMap(), p = new WeakMap(), O = new WeakMap(), M = new WeakMap(), P = new WeakMap(), _ = new WeakMap(), q = new WeakMap(), B = new WeakMap(), C = new WeakMap(), A = new WeakMap(), st = new WeakSet(), mt = function(t) { | ||
let e, i; | ||
@@ -474,18 +475,18 @@ const n = new Promise((r, h) => { | ||
}; | ||
}, et = new WeakSet(), mt = async function(t) { | ||
}, it = new WeakSet(), wt = async function(t) { | ||
if (s(this, C) === null) | ||
return a(this, C, t), new Promise((i) => { | ||
i(s(this, C)), setTimeout(() => { | ||
v(this, q, X).call(this, t); | ||
d(this, W, G).call(this, t); | ||
}, 3e3); | ||
}); | ||
let e = v(this, tt, gt).call(this, t); | ||
return s(this, B).push(e), e.promise; | ||
}, q = new WeakSet(), X = function(t) { | ||
let e = d(this, st, mt).call(this, t); | ||
return s(this, A).push(e), e.promise; | ||
}, W = new WeakSet(), G = function(t) { | ||
s(this, C) === t && a(this, C, null); | ||
}, st = new WeakSet(), wt = async function(t, e) { | ||
}, nt = new WeakSet(), Rt = async function(t, e) { | ||
var n, r; | ||
await (((r = (n = s(this, b)) == null ? void 0 : n.hooks) == null ? void 0 : r.revisionMergeStrategy) || ht)(t, s(this, P)); | ||
}, it = new WeakSet(), Rt = function(t, e) { | ||
Mt( | ||
await (((r = (n = s(this, O)) == null ? void 0 : n.hooks) == null ? void 0 : r.revisionMergeStrategy) || lt)(t, s(this, B)); | ||
}, rt = new WeakSet(), pt = function(t, e) { | ||
Bt( | ||
s(this, C) === t, | ||
@@ -496,3 +497,3 @@ "transaction owner incorrectly assigned when commiting updates" | ||
const [n, r, h] = i; | ||
s(this, R).set(n, new WeakRef(r)), s(this, _).register(r, n), s(this, O).set(n, h), h != null && h.retained.lru && s(this, M).set(n, r); | ||
s(this, R).set(n, new WeakRef(r)), s(this, q).register(r, n), s(this, M).set(n, h), h != null && h.retained.lru && s(this, P).set(n, r); | ||
} | ||
@@ -502,21 +503,21 @@ for (const [ | ||
n | ||
] of s(this, P).mergedEntryRevisions()) | ||
] of s(this, B).mergedEntryRevisions()) | ||
s(this, p).set(i, n); | ||
if (v(this, q, X).call(this, t), s(this, B).length > 0) { | ||
const i = s(this, B).shift(); | ||
if (d(this, W, G).call(this, t), s(this, A).length > 0) { | ||
const i = s(this, A).shift(); | ||
i && a(this, C, i.owner), i.resolve(); | ||
} | ||
}, nt = new WeakSet(), pt = function(t) { | ||
}, ot = new WeakSet(), Ct = function(t) { | ||
var e; | ||
(e = s(this, P)) == null || e.updateRevisions(t); | ||
(e = s(this, B)) == null || e.updateRevisions(t); | ||
}; | ||
function Bt(c) { | ||
return new Lt(c); | ||
function Nt(c) { | ||
return new bt(c); | ||
} | ||
var D, E; | ||
class It { | ||
var Q, E; | ||
class Ot { | ||
constructor(t) { | ||
o(this, D, void 0); | ||
o(this, Q, void 0); | ||
o(this, E, void 0); | ||
a(this, D, t), a(this, E, /* @__PURE__ */ new Map()); | ||
a(this, Q, t), a(this, E, /* @__PURE__ */ new Map()); | ||
} | ||
@@ -526,3 +527,3 @@ set(t, e) { | ||
s(this, E).delete(t); | ||
else if (s(this, E).size === s(this, D)) { | ||
else if (s(this, E).size === s(this, Q)) { | ||
const i = s(this, E).keys().next().value; | ||
@@ -537,4 +538,4 @@ s(this, E).delete(i); | ||
} | ||
D = new WeakMap(), E = new WeakMap(); | ||
const ht = async function(t, e) { | ||
Q = new WeakMap(), E = new WeakMap(); | ||
const lt = async function(t, e) { | ||
const i = []; | ||
@@ -544,13 +545,13 @@ for await (const n of e.entryRevisions(t)) | ||
e.cache.appendRevisions(t, [...i]); | ||
}, bt = function(t, { entity: e }, i, n) { | ||
return Ct(i, e); | ||
}, Q = function(t) { | ||
}, Mt = function(t, { entity: e }, i, n) { | ||
return Et(i, e); | ||
}, Y = function(t) { | ||
return t !== null && !Array.isArray(t) && typeof t == "object"; | ||
}; | ||
function Ct(c, t) { | ||
const e = Q(t) ? { ...t } : t, i = Q(c) ? { ...c } : c; | ||
return Q(e) && Q(i) ? (Object.keys(e).forEach((n) => { | ||
function Et(c, t) { | ||
const e = Y(t) ? { ...t } : t, i = Y(c) ? { ...c } : c; | ||
return Y(e) && Y(i) ? (Object.keys(e).forEach((n) => { | ||
if (Object.prototype.hasOwnProperty.call(i, n)) { | ||
if (e[n] != i[n]) { | ||
const r = Ot(i, e, n); | ||
const r = Pt(i, e, n); | ||
r != i[n] && (i[n] = r); | ||
@@ -562,4 +563,4 @@ } | ||
} | ||
function Ot(c, t, e) { | ||
return Ct( | ||
function Pt(c, t, e) { | ||
return Et( | ||
c[e], | ||
@@ -569,3 +570,3 @@ t[e] | ||
} | ||
function lt(c) { | ||
function yt(c) { | ||
try { | ||
@@ -579,3 +580,3 @@ return JSON.parse(JSON.stringify(c)); | ||
} | ||
function Mt(c, t) { | ||
function Bt(c, t) { | ||
if (!c) { | ||
@@ -589,3 +590,3 @@ if (typeof t == "string") | ||
export { | ||
Bt as buildCache | ||
Nt as buildCache | ||
}; |
{ | ||
"$schema": "https://json.schemastore.org/package.json", | ||
"name": "@data-eden/cache", | ||
"version": "0.13.1", | ||
"version": "0.13.2", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "type": "git", |
@@ -154,6 +154,6 @@ import { CacheTransactionImpl } from './cache-transaction.js'; | ||
let revisionNumber = | ||
localRevisionsByEntry && | ||
localRevisionsByEntry[localRevisionsByEntry.length - 1].revision | ||
? localRevisionsByEntry[localRevisionsByEntry.length - 1].revision | ||
: REVISION_COUNTER; | ||
(localRevisionsByEntry && | ||
localRevisionsByEntry[localRevisionsByEntry.length - 1]?.revision | ||
? localRevisionsByEntry[localRevisionsByEntry.length - 1]?.revision | ||
: REVISION_COUNTER) ?? 0; | ||
@@ -227,6 +227,6 @@ revisionNumber = ++revisionNumber; | ||
let revisionNumber = | ||
localRevisionsByEntry && | ||
localRevisionsByEntry[localRevisionsByEntry.length - 1].revision | ||
? localRevisionsByEntry[localRevisionsByEntry.length - 1].revision | ||
: REVISION_COUNTER; | ||
(localRevisionsByEntry && | ||
localRevisionsByEntry[localRevisionsByEntry.length - 1]?.revision | ||
? localRevisionsByEntry[localRevisionsByEntry.length - 1]?.revision | ||
: REVISION_COUNTER) ?? 0; | ||
@@ -233,0 +233,0 @@ revisionNumber = ++revisionNumber; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
253803
2942