@resolid/cache 1.0.0 → 1.0.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/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as CacheStore } from "./types-D3cbGkJC.mjs";
1
+ import { t as CacheStore } from "./types-BvLwqpdf.mjs";
2
2
 
3
3
  //#region src/index.d.ts
4
4
  interface CacheOptions {
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{t as e}from"./null-cache-DGPituGm.mjs";import{destr as t}from"destr";const n=e=>{let t=e.split(`?`)[0].replace(/[/\\]/g,`:`).replace(/:+/g,`:`).replace(/^:|:$/g,``);if(!t)throw Error(`Cache key cannot be empty after normalization`);return t};var r=class{_store;_defaultTtl;constructor({store:t=new e,defaultTtl:n}={}){this._store=t,this._defaultTtl=n}async get(e,r){let i=await this._store.get(n(e));return i===void 0?r:t(i)}set(e,t,r){return this._store.set(n(e),JSON.stringify(t),r??this._defaultTtl)}del(e){return this._store.del(n(e))}clear(){return this._store.clear()}async getMultiple(e,r){return this._store.getMultiple?(await this._store.getMultiple(e.map(n))).map(e=>e===void 0?r:t(e)):Promise.all(e.map(e=>this.get(e,r)))}async setMultiple(e,t){if(this._store.setMultiple){let r=Object.entries(e).reduce((e,[t,r])=>(e[n(t)]=JSON.stringify(r),e),{});return this._store.setMultiple(r,t)}return(await Promise.all(Object.entries(e).map(([e,n])=>this.set(e,n,t)))).every(Boolean)}async delMultiple(e){return this._store.delMultiple?this._store.delMultiple(e.map(n)):(await Promise.all(e.map(e=>this.del(e)))).every(Boolean)}async has(e){return this._store.has?this._store.has(n(e)):await this.get(e)!==void 0}async dispose(){await this._store.dispose?.()}};export{r as Cacher};
1
+ import{t as e}from"./null-cache-DGPituGm.mjs";import{destr as t}from"destr";const n=e=>{let t=e.split(`?`)[0]?.replace(/[/\\]/g,`:`).replace(/:+/g,`:`).replace(/^:|:$/g,``);if(!t)throw Error(`Cache key cannot be empty after normalization`);return t};var r=class{_store;_defaultTtl;constructor({store:t=new e,defaultTtl:n}={}){this._store=t,this._defaultTtl=n}async get(e,r){let i=await this._store.get(n(e));return i===void 0?r:t(i)}set(e,t,r){return this._store.set(n(e),JSON.stringify(t),r??this._defaultTtl)}del(e){return this._store.del(n(e))}clear(){return this._store.clear()}async getMultiple(e,r){return this._store.getMultiple?(await this._store.getMultiple(e.map(n))).map(e=>e===void 0?r:t(e)):Promise.all(e.map(e=>this.get(e,r)))}async setMultiple(e,t){if(this._store.setMultiple){let r=Object.entries(e).reduce((e,[t,r])=>(e[n(t)]=JSON.stringify(r),e),{});return this._store.setMultiple(r,t)}return(await Promise.all(Object.entries(e).map(([e,n])=>this.set(e,n,t)))).every(Boolean)}async delMultiple(e){return this._store.delMultiple?this._store.delMultiple(e.map(n)):(await Promise.all(e.map(e=>this.del(e)))).every(Boolean)}async has(e){return this._store.has?this._store.has(n(e)):await this.get(e)!==void 0}async dispose(){await this._store.dispose?.()}};export{r as Cacher};
package/dist/stores.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as CacheStore } from "./types-D3cbGkJC.mjs";
1
+ import { t as CacheStore } from "./types-BvLwqpdf.mjs";
2
2
 
3
3
  //#region src/stores/memory-cache.d.ts
4
4
  declare class MemoryCache implements CacheStore {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resolid/cache",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "private": false,
5
5
  "description": "Type-safe Async Cache for TypeScript",
6
6
  "keywords": [
@@ -33,7 +33,8 @@
33
33
  "./stores": {
34
34
  "types": "./dist/stores.d.mts",
35
35
  "import": "./dist/stores.mjs"
36
- }
36
+ },
37
+ "./package.json": "./package.json"
37
38
  },
38
39
  "publishConfig": {
39
40
  "access": "public",
@@ -44,8 +45,7 @@
44
45
  "quick-lru": "^7.3.0"
45
46
  },
46
47
  "devDependencies": {
47
- "tsdown": "^0.20.3",
48
- "typescript": "^5.9.3"
48
+ "tsdown": "^0.21.5"
49
49
  },
50
50
  "engines": {
51
51
  "node": "^22.13.0 || >=24"