Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@data-eden/cache

Package Overview
Dependencies
Maintainers
4
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@data-eden/cache - npm Package Compare versions

Comparing version 0.17.1 to 0.17.2

8

__tests__/index-test.ts

@@ -284,2 +284,6 @@ import { describe, it, expect } from 'vitest';

await tx.merge('book:1', { 'book:1': { title: 'Conflict', sub: 'j3' } });
await tx.merge('book:4', {
'book:4': { title: 'New book', sub: 'wat', newField: 'blah' },
});
await tx.merge('book:4', { 'book:4': { title: 'New book', sub: 'foo' } });

@@ -321,2 +325,6 @@ // Validate Transactional entries

});
expect(await cache.get('book:4')).toEqual({
'book:4': { title: 'New book', sub: 'foo', newField: 'blah' },
});
});

@@ -323,0 +331,0 @@

60

dist/data-eden-cache.js

@@ -12,3 +12,3 @@ var at = (c, t, e) => {

var V, U, j, z, b, F, g, m, T;
class ut {
class yt {
constructor(t, e = {}) {

@@ -128,3 +128,3 @@ o(this, V, void 0);

var k, J, H, $, Z, x, S, K, ft, D, ct;
class xt extends ut {
class xt extends yt {
constructor(e, i, n, r, h = {}) {

@@ -143,4 +143,4 @@ super(e);

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);
const { userOptionExpirationPolicy: y, lruPolicy: l, ttlPolicy: f } = this.getExpirationPolicies();
a(this, $, f), a(this, Z, l), a(this, H, y);
}

@@ -161,6 +161,6 @@ async set(e, i) {

async merge(e, i, n) {
var y, v;
var u, v;
a(this, x, n == null ? void 0 : n.revisionContext);
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;
const r = d(this, D, ct).call(this, n == null ? void 0 : n.entityMergeStrategy), h = await this.get(e) || await s(this, k).get(e), y = this.getLocalRevisionsByEntry(e);
let l = (y && ((u = y[y.length - 1]) != null && u.revision) ? (v = y[y.length - 1]) == null ? void 0 : v.revision : ht) ?? 0;
l = ++l;

@@ -201,10 +201,10 @@ const f = h ? 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;
var n, r, h, y;
const e = [];
for await (const [l, f] of this.localEntries()) {
const L = await s(this, k).get(l);
let y;
let u;
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(
X = ++X, L && v ? u = v(
l,

@@ -218,9 +218,9 @@ {

this
) : y = f;
) : u = f;
const St = Lt(
y
u
), Tt = this.getCacheEntryState(l) || gt;
e.push([l, St, Tt]);
const kt = {
entity: y,
entity: u,
revision: X,

@@ -233,3 +233,3 @@ revisionContext: s(this, x)

}
const i = (u = (h = s(this, k).getCacheOptions()) == null ? void 0 : h.hooks) == null ? void 0 : u.commit;
const i = (y = (h = s(this, k).getCacheOptions()) == null ? void 0 : h.hooks) == null ? void 0 : y.commit;
return i && await i(this), {

@@ -253,3 +253,3 @@ entries: e

var w, tt, vt, et, dt;
class It extends ut {
class It extends yt {
constructor(e, i) {

@@ -261,3 +261,3 @@ super(e);

this.setRevisionsBeforeTransactionStart(i);
const n = (h, u) => d(this, tt, vt).call(this, h, u), r = (h) => d(this, et, dt).call(this, h);
const n = (h, y) => d(this, tt, vt).call(this, h, y), r = (h) => d(this, et, dt).call(this, h);
this.cache = {

@@ -317,5 +317,5 @@ clearRevisions: r,

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);
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((y) => {
const l = s(this, R), f = l.get(y);
f && !f.deref() && l.delete(y);
}));

@@ -344,3 +344,3 @@ }

for await (const [e, i, n] of this.entries()) {
const r = yt(
const r = ut(
i

@@ -361,4 +361,4 @@ );

for await (let n of t) {
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);
let [r, h, y] = n, l = ut(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, y);
const f = {

@@ -422,10 +422,10 @@ entity: h,

async beginTransaction(t) {
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 e = (u) => d(this, it, wt).call(this, u), i = (u) => d(this, W, G).call(this, u), n = (u, v) => d(this, rt, pt).call(this, u, v), r = (u, v) => d(this, nt, Rt).call(this, u, v), h = (u) => d(this, ot, Ct).call(this, u), y = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
for await (const [u, v] of this.entries())
y.set(u, v);
for await (const [u] of this.entries()) {
const v = [];
for await (const I of this.entryRevisions(y))
for await (const I of this.entryRevisions(u))
v.push(I);
l.set(y, v);
l.set(u, v);
}

@@ -444,3 +444,3 @@ const f = {

this,
u,
y,
l,

@@ -551,3 +551,3 @@ f,

}
function yt(c) {
function ut(c) {
try {

@@ -554,0 +554,0 @@ return JSON.parse(JSON.stringify(c));

{
"$schema": "https://json.schemastore.org/package.json",
"name": "@data-eden/cache",
"version": "0.17.1",
"version": "0.17.2",
"repository": {

@@ -6,0 +6,0 @@ "type": "git",

@@ -589,3 +589,3 @@ import { LiveCacheTransactionImpl } from './live-transaction.js';

const defaultMergeStrategy = function deepMergeStratey<
const defaultMergeStrategy = function deepMergeStrategy<
CacheKeyRegistry extends DefaultRegistry,

@@ -592,0 +592,0 @@ Key extends keyof CacheKeyRegistry

@@ -149,4 +149,8 @@ import { CacheTransactionImpl } from './cache-transaction.js';

// get current cache value within this transaction
const currentValue = await this.#originalCacheReference.get(cacheKey);
// get current cache value within this transaction, and fall back to underlying cache if no
// value exists in the current transaction
const currentValue =
(await this.get(cacheKey)) ||
(await this.#originalCacheReference.get(cacheKey));
const localRevisionsByEntry = this.getLocalRevisionsByEntry(cacheKey);

@@ -153,0 +157,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc