ts-cache-mongoose 1.7.5 → 1.7.7

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/biome.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://biomejs.dev/schemas/2.2.0/schema.json",
2
+ "$schema": "https://biomejs.dev/schemas/2.4.4/schema.json",
3
3
  "vcs": { "enabled": false, "clientKind": "git", "useIgnoreFile": false },
4
4
  "files": {
5
5
  "ignoreUnknown": false,
package/dist/index.cjs CHANGED
@@ -142,7 +142,7 @@ class Cache {
142
142
  async get(key) {
143
143
  const cacheEntry = await __privateGet$1(this, _engine).get(key);
144
144
  if (__privateGet$1(this, _debug)) {
145
- const cacheHit = cacheEntry != null ? "HIT" : "MISS";
145
+ const cacheHit = cacheEntry == null ? "MISS" : "HIT";
146
146
  console.log(`[ts-cache-mongoose] GET '${key}' - ${cacheHit}`);
147
147
  }
148
148
  return cacheEntry;
@@ -304,10 +304,10 @@ const _CacheMongoose = class _CacheMongoose {
304
304
  return __privateGet(_CacheMongoose, _instance);
305
305
  }
306
306
  async clear(customKey) {
307
- if (customKey != null) {
308
- await this.cache.del(customKey);
309
- } else {
307
+ if (customKey == null) {
310
308
  await this.cache.clear();
309
+ } else {
310
+ await this.cache.del(customKey);
311
311
  }
312
312
  }
313
313
  async close() {
package/dist/index.d.cts CHANGED
@@ -50,3 +50,4 @@ declare class CacheMongoose {
50
50
 
51
51
  export { CacheMongoose as default };
52
52
  export type { CacheData, CacheEngine, CacheOptions, CacheTTL };
53
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","sources":["../src/types.ts","../src/index.ts"],"mappings":";;;;AAGM,KAAM,QAAQ,YAAY,WAAW;AAErC,KAAM,SAAS,GAAG,MAAM,oBAAoB,MAAM;AAElD,KAAM,YAAY;;oBAEN,YAAY;iBACf,QAAQ;;;AAIjB,UAAW,WAAW;0BACJ,OAAO,CAAC,SAAS,IAAI,SAAS;8BAC1B,SAAS,QAAQ,QAAQ,KAAK,OAAO;0BACzC,OAAO;iBAChB,OAAO;iBACP,OAAO;;;ACVtB;;8EAE0E,QAAQ;;;cAGxE,QAAQ;iFAC2D,QAAQ;;;;;;;;mDAStC,QAAQ;;;cAG7C,QAAQ;sDACgC,QAAQ;;;AAI1D,cAAM,aAAa;;;;0BAQY,QAAQ,gBAAgB,YAAY,GAAG,aAAa;+BAczC,OAAO;aAQzB,OAAO","names":[]}
package/dist/index.d.mts CHANGED
@@ -50,3 +50,4 @@ declare class CacheMongoose {
50
50
 
51
51
  export { CacheMongoose as default };
52
52
  export type { CacheData, CacheEngine, CacheOptions, CacheTTL };
53
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sources":["../src/types.ts","../src/index.ts"],"mappings":";;;;AAGM,KAAM,QAAQ,YAAY,WAAW;AAErC,KAAM,SAAS,GAAG,MAAM,oBAAoB,MAAM;AAElD,KAAM,YAAY;;oBAEN,YAAY;iBACf,QAAQ;;;AAIjB,UAAW,WAAW;0BACJ,OAAO,CAAC,SAAS,IAAI,SAAS;8BAC1B,SAAS,QAAQ,QAAQ,KAAK,OAAO;0BACzC,OAAO;iBAChB,OAAO;iBACP,OAAO;;;ACVtB;;8EAE0E,QAAQ;;;cAGxE,QAAQ;iFAC2D,QAAQ;;;;;;;;mDAStC,QAAQ;;;cAG7C,QAAQ;sDACgC,QAAQ;;;AAI1D,cAAM,aAAa;;;;0BAQY,QAAQ,gBAAgB,YAAY,GAAG,aAAa;+BAczC,OAAO;aAQzB,OAAO","names":[]}
package/dist/index.mjs CHANGED
@@ -140,7 +140,7 @@ class Cache {
140
140
  async get(key) {
141
141
  const cacheEntry = await __privateGet$1(this, _engine).get(key);
142
142
  if (__privateGet$1(this, _debug)) {
143
- const cacheHit = cacheEntry != null ? "HIT" : "MISS";
143
+ const cacheHit = cacheEntry == null ? "MISS" : "HIT";
144
144
  console.log(`[ts-cache-mongoose] GET '${key}' - ${cacheHit}`);
145
145
  }
146
146
  return cacheEntry;
@@ -302,10 +302,10 @@ const _CacheMongoose = class _CacheMongoose {
302
302
  return __privateGet(_CacheMongoose, _instance);
303
303
  }
304
304
  async clear(customKey) {
305
- if (customKey != null) {
306
- await this.cache.del(customKey);
307
- } else {
305
+ if (customKey == null) {
308
306
  await this.cache.clear();
307
+ } else {
308
+ await this.cache.del(customKey);
309
309
  }
310
310
  }
311
311
  async close() {
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "ts-cache-mongoose",
3
- "version": "1.7.5",
3
+ "version": "1.7.7",
4
4
  "description": "Cache plugin for mongoose Queries and Aggregate (in-memory, redis)",
5
5
  "author": "ilovepixelart",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "git://github.com/ilovepixelart/ts-cache-mongoose.git"
9
+ "url": "git+https://github.com/ilovepixelart/ts-cache-mongoose.git"
10
10
  },
11
11
  "bugs": {
12
12
  "url": "https://github.com/ilovepixelart/ts-cache-mongoose/issues"
@@ -68,37 +68,41 @@
68
68
  "clean": "rm -rf ./dist",
69
69
  "type:check": "tsc --noEmit",
70
70
  "build": "pkgroll --clean-dist",
71
- "release": "npm install && npm run biome && npm run type:check && npm run build && np"
71
+ "release": "npm install && npm run biome && npm run type:check && npm run build && np --no-publish"
72
72
  },
73
73
  "dependencies": {
74
74
  "@types/ms": "2.1.0",
75
- "@types/semver": "7.7.0",
76
- "ioredis": "5.7.0",
75
+ "@types/semver": "7.7.1",
76
+ "ioredis": "5.9.3",
77
77
  "ms": "2.1.3",
78
- "semver": "7.7.2",
78
+ "semver": "7.7.4",
79
79
  "sort-keys": "4.2.0"
80
80
  },
81
81
  "devDependencies": {
82
- "@biomejs/biome": "2.2.0",
83
- "@types/node": "24.3.0",
84
- "@vitest/coverage-v8": "3.2.4",
85
- "bson": "^6.10.4",
86
- "mongodb-memory-server": "10.2.0",
87
- "mongoose": "8.17.1",
82
+ "@biomejs/biome": "2.4.4",
83
+ "@types/node": "25.3.0",
84
+ "@vitest/coverage-v8": "4.0.18",
85
+ "bson": "7.2.0",
86
+ "mongodb-memory-server": "11.0.1",
87
+ "mongoose": "9.2.2",
88
88
  "open-cli": "8.0.0",
89
- "pkgroll": "2.15.3",
89
+ "pkgroll": "2.26.3",
90
90
  "simple-git-hooks": "2.13.1",
91
- "typescript": "5.9.2",
92
- "vitest": "3.2.4"
91
+ "typescript": "5.9.3",
92
+ "vitest": "4.0.18",
93
+ "np": "11.0.2"
93
94
  },
94
95
  "peerDependencies": {
95
- "bson": ">=4.7.2 < 7",
96
- "mongoose": ">=6.6.0 < 9"
96
+ "bson": ">=4.7.2 < 8",
97
+ "mongoose": ">=6.6.0 < 10"
97
98
  },
98
99
  "simple-git-hooks": {
99
100
  "pre-commit": "npm run type:check",
100
101
  "pre-push": "npm run biome:fix"
101
102
  },
103
+ "np": {
104
+ "publish": false
105
+ },
102
106
  "overrides": {
103
107
  "esbuild": "0.25.0"
104
108
  }
@@ -37,7 +37,7 @@ export class Cache {
37
37
  async get(key: string): Promise<CacheData> {
38
38
  const cacheEntry = await this.#engine.get(key)
39
39
  if (this.#debug) {
40
- const cacheHit = cacheEntry != null ? 'HIT' : 'MISS'
40
+ const cacheHit = cacheEntry == null ? 'MISS' : 'HIT'
41
41
  console.log(`[ts-cache-mongoose] GET '${key}' - ${cacheHit}`)
42
42
  }
43
43
  return cacheEntry
package/src/index.ts CHANGED
@@ -53,10 +53,10 @@ class CacheMongoose {
53
53
  }
54
54
 
55
55
  public async clear(customKey?: string): Promise<void> {
56
- if (customKey != null) {
57
- await this.cache.del(customKey)
58
- } else {
56
+ if (customKey == null) {
59
57
  await this.cache.clear()
58
+ } else {
59
+ await this.cache.del(customKey)
60
60
  }
61
61
  }
62
62
 
package/vite.config.mts CHANGED
@@ -6,8 +6,18 @@ export default defineConfig({
6
6
  name: 'node',
7
7
  environment: 'node',
8
8
  coverage: {
9
- reporter: ['lcov'],
9
+ provider: 'v8',
10
+ reporter: ['text', 'json', 'html', 'lcov'],
10
11
  include: ['src/**/*.ts'],
12
+ exclude: [
13
+ 'node_modules/**',
14
+ 'dist/**',
15
+ 'coverage/**',
16
+ '**/*.d.ts',
17
+ '**/*.config.*',
18
+ '**/tests/**',
19
+ 'examples/**',
20
+ ],
11
21
  },
12
22
  },
13
23
  })