@happyvertical/cache 0.74.8

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.
@@ -0,0 +1,281 @@
1
+ /**
2
+ * Core types and interfaces for the Cache library
3
+ */
4
+ /**
5
+ * Standardized cache entry structure (internal use)
6
+ */
7
+ export interface CacheEntry<T = any> {
8
+ /**
9
+ * The cached value
10
+ */
11
+ value: T;
12
+ /**
13
+ * When this entry was created (Unix timestamp in milliseconds)
14
+ */
15
+ createdAt: number;
16
+ /**
17
+ * When this entry will expire (Unix timestamp in milliseconds)
18
+ * undefined means no expiration
19
+ */
20
+ expiresAt?: number;
21
+ /**
22
+ * Size in bytes (for memory/disk management)
23
+ */
24
+ size: number;
25
+ /**
26
+ * Number of times this entry has been accessed
27
+ */
28
+ hits: number;
29
+ /**
30
+ * Additional metadata
31
+ */
32
+ metadata?: {
33
+ compressed?: boolean;
34
+ serialized?: boolean;
35
+ namespace?: string;
36
+ };
37
+ }
38
+ /**
39
+ * Cache statistics
40
+ */
41
+ export interface CacheStats {
42
+ /**
43
+ * Total number of cached entries
44
+ */
45
+ entries: number;
46
+ /**
47
+ * Total size in bytes
48
+ */
49
+ totalSize: number;
50
+ /**
51
+ * Cache hit count
52
+ */
53
+ hits: number;
54
+ /**
55
+ * Cache miss count
56
+ */
57
+ misses: number;
58
+ /**
59
+ * Hit rate (hits / (hits + misses))
60
+ */
61
+ hitRate: number;
62
+ /**
63
+ * Number of evictions (entries removed due to size/TTL)
64
+ */
65
+ evictions: number;
66
+ /**
67
+ * Backend-specific statistics
68
+ */
69
+ backend?: {
70
+ type: 'memory' | 'file' | 'redis' | 's3';
71
+ [key: string]: any;
72
+ };
73
+ }
74
+ /**
75
+ * Cache provider interface - all providers must implement this
76
+ */
77
+ export interface CacheProvider {
78
+ /**
79
+ * Retrieves a value from the cache by key
80
+ * @param key - The cache key
81
+ * @returns Promise resolving to the cached value, or undefined if not found or expired
82
+ */
83
+ get<T = any>(key: string): Promise<T | undefined>;
84
+ /**
85
+ * Stores a value in the cache with an optional time-to-live
86
+ * @param key - The cache key
87
+ * @param value - The value to cache
88
+ * @param ttl - Optional time-to-live in seconds
89
+ * @returns Promise resolving when the value is cached
90
+ */
91
+ set<T = any>(key: string, value: T, ttl?: number): Promise<void>;
92
+ /**
93
+ * Checks if a key exists in the cache and is not expired
94
+ * @param key - The cache key
95
+ * @returns Promise resolving to true if the key exists and is valid
96
+ */
97
+ has(key: string): Promise<boolean>;
98
+ /**
99
+ * Removes a value from the cache
100
+ * @param key - The cache key
101
+ * @returns Promise resolving to true if the key was deleted, false if it didn't exist
102
+ */
103
+ delete(key: string): Promise<boolean>;
104
+ /**
105
+ * Clears all entries from the cache, or all entries in a namespace if specified
106
+ * @param namespace - Optional namespace to clear
107
+ * @returns Promise resolving when the cache is cleared
108
+ */
109
+ clear(namespace?: string): Promise<void>;
110
+ /**
111
+ * Gets all keys in the cache, optionally filtered by a pattern
112
+ * @param pattern - Optional glob-style pattern to filter keys
113
+ * @returns Promise resolving to an array of matching keys
114
+ */
115
+ keys(pattern?: string): Promise<string[]>;
116
+ /**
117
+ * Retrieves multiple values from the cache
118
+ * @param keys - An array of cache keys
119
+ * @returns Promise resolving to a map of key-value pairs
120
+ */
121
+ getMany<T = any>(keys: string[]): Promise<Map<string, T>>;
122
+ /**
123
+ * Stores multiple key-value pairs in the cache
124
+ * @param entries - An array of {key, value, ttl?} objects
125
+ * @returns Promise resolving when all values are cached
126
+ */
127
+ setMany<T = any>(entries: Array<{
128
+ key: string;
129
+ value: T;
130
+ ttl?: number;
131
+ }>): Promise<void>;
132
+ /**
133
+ * Removes multiple values from the cache
134
+ * @param keys - An array of cache keys
135
+ * @returns Promise resolving to the number of keys deleted
136
+ */
137
+ deleteMany(keys: string[]): Promise<number>;
138
+ /**
139
+ * Gets cache statistics
140
+ * @returns Promise resolving to cache statistics
141
+ */
142
+ getStats(): Promise<CacheStats>;
143
+ /**
144
+ * Updates the TTL for an existing cache entry
145
+ * @param key - The cache key
146
+ * @param ttl - New time-to-live in seconds
147
+ * @returns Promise resolving to true if TTL was updated, false if key doesn't exist
148
+ */
149
+ touch(key: string, ttl: number): Promise<boolean>;
150
+ /**
151
+ * Closes the cache connection/cleanup resources
152
+ * @returns Promise resolving when cleanup is complete
153
+ */
154
+ close(): Promise<void>;
155
+ }
156
+ /**
157
+ * Cache adapter interface (structurally identical to CacheProvider)
158
+ */
159
+ export interface CacheAdapter extends CacheProvider {
160
+ }
161
+ /**
162
+ * Memory cache options
163
+ */
164
+ export interface MemoryOptions {
165
+ provider: 'memory';
166
+ namespace?: string;
167
+ /** Default time-to-live in seconds for entries without an explicit TTL */
168
+ defaultTTL?: number;
169
+ /** Maximum total cache size in bytes (default: 100 MB) */
170
+ maxSize?: number;
171
+ /** Maximum number of entries (default: 10 000) */
172
+ maxEntries?: number;
173
+ evictionPolicy?: 'lru' | 'lfu' | 'fifo';
174
+ /** Interval in milliseconds between expired-entry sweeps (default: 60 000) */
175
+ checkPeriod?: number;
176
+ }
177
+ /**
178
+ * File cache options
179
+ */
180
+ export interface FileOptions {
181
+ provider: 'file';
182
+ /** Directory where cache files are stored (required) */
183
+ cacheDir: string;
184
+ namespace?: string;
185
+ /** Default time-to-live in seconds for entries without an explicit TTL */
186
+ defaultTTL?: number;
187
+ /** Maximum total cache size in bytes (default: 500 MB) */
188
+ maxSize?: number;
189
+ /** Enable gzip compression for stored files (default: false) */
190
+ compression?: boolean;
191
+ /** File suffix for cache files (default: '.cache') */
192
+ fileExtension?: string;
193
+ /** Interval in milliseconds between expired-file cleanup sweeps (default: 300 000) */
194
+ checkPeriod?: number;
195
+ }
196
+ /**
197
+ * Redis cache options
198
+ */
199
+ export interface RedisOptions {
200
+ provider: 'redis';
201
+ /** Redis server hostname (default: 'localhost') */
202
+ host?: string;
203
+ /** Redis server port (default: 6379) */
204
+ port?: number;
205
+ password?: string;
206
+ /** Redis database index 0-15 (default: 0) */
207
+ db?: number;
208
+ namespace?: string;
209
+ /** Alternative to namespace — used as the key prefix */
210
+ keyPrefix?: string;
211
+ /** Default time-to-live in seconds for entries without an explicit TTL */
212
+ defaultTTL?: number;
213
+ /** Enable gzip compression for values exceeding compressionThreshold (default: false) */
214
+ enableCompression?: boolean;
215
+ /** Minimum value size in bytes before compression applies (default: 1024) */
216
+ compressionThreshold?: number;
217
+ /** Socket connect timeout in milliseconds (default: 5000) */
218
+ connectTimeout?: number;
219
+ /** Per-command timeout in milliseconds */
220
+ commandTimeout?: number;
221
+ retryStrategy?: (times: number) => number | null;
222
+ }
223
+ /**
224
+ * S3 cache options
225
+ * Use this for CI environments where cache needs to persist between runs
226
+ */
227
+ export interface S3Options {
228
+ provider: 's3';
229
+ /** S3 bucket name (required) */
230
+ bucket: string;
231
+ /** Key prefix for cache files (default: 'cache/') */
232
+ prefix?: string;
233
+ /** AWS region (default: from AWS_REGION env var or 'us-east-1') */
234
+ region?: string;
235
+ /** Optional namespace for key organization */
236
+ namespace?: string;
237
+ /** Default TTL in seconds */
238
+ defaultTTL?: number;
239
+ /** Enable gzip compression (default: true) */
240
+ compression?: boolean;
241
+ /** Only compress if value exceeds this size in bytes (default: 1024) */
242
+ compressionThreshold?: number;
243
+ }
244
+ /**
245
+ * Discriminated union of all cache adapter options
246
+ */
247
+ export type CacheAdapterOptions = MemoryOptions | FileOptions | RedisOptions | S3Options;
248
+ /**
249
+ * Base cache error class
250
+ */
251
+ export declare class CacheError extends Error {
252
+ code: string;
253
+ provider: string;
254
+ constructor(message: string, code: string, provider: string);
255
+ }
256
+ /**
257
+ * Invalid cache key error
258
+ */
259
+ export declare class CacheKeyError extends CacheError {
260
+ key: string;
261
+ constructor(key: string, provider: string);
262
+ }
263
+ /**
264
+ * Cache connection error
265
+ */
266
+ export declare class CacheConnectionError extends CacheError {
267
+ constructor(message: string, provider: string);
268
+ }
269
+ /**
270
+ * Cache size limit exceeded error
271
+ */
272
+ export declare class CacheSizeError extends CacheError {
273
+ constructor(message: string, provider: string);
274
+ }
275
+ /**
276
+ * Cache serialization error
277
+ */
278
+ export declare class CacheSerializationError extends CacheError {
279
+ constructor(message: string, provider: string);
280
+ }
281
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/shared/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC,GAAG,GAAG;IACjC;;OAEG;IACH,KAAK,EAAE,CAAC,CAAC;IAET;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,QAAQ,CAAC,EAAE;QACT,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE;QACR,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;QACzC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,GAAG,OAA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,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAI9C;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,UAAU;gBAChC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAI9C;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,UAAU;gBACzC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAI9C"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Utility functions for cache operations
3
+ */
4
+ /**
5
+ * Validates a cache key
6
+ * @param key - The cache key to validate
7
+ * @returns True if the key is valid
8
+ */
9
+ export declare function isValidKey(key: string): boolean;
10
+ /**
11
+ * Calculates the size of a value in bytes (approximate)
12
+ * @param value - The value to measure
13
+ * @returns Size in bytes
14
+ */
15
+ export declare function calculateSize(value: any): number;
16
+ /**
17
+ * Checks if a pattern matches a string (glob-style)
18
+ * @param pattern - The glob pattern (supports * wildcard)
19
+ * @param str - The string to test
20
+ * @returns True if the pattern matches
21
+ */
22
+ export declare function matchesPattern(pattern: string, str: string): boolean;
23
+ /**
24
+ * Formats a namespace and key into a full key
25
+ * @param namespace - Optional namespace
26
+ * @param key - The cache key
27
+ * @returns Formatted key with namespace prefix if provided
28
+ */
29
+ export declare function formatKey(namespace: string | undefined, key: string): string;
30
+ /**
31
+ * Extracts the original key from a namespaced key
32
+ * @param namespace - Optional namespace
33
+ * @param fullKey - The full key with namespace
34
+ * @returns Original key without namespace
35
+ */
36
+ export declare function extractKey(namespace: string | undefined, fullKey: string): string;
37
+ /**
38
+ * Checks if an entry has expired
39
+ * @param expiresAt - Expiration timestamp (undefined means no expiration)
40
+ * @returns True if the entry has expired
41
+ */
42
+ export declare function isExpired(expiresAt: number | undefined): boolean;
43
+ /**
44
+ * Calculates expiration timestamp from TTL
45
+ * @param ttl - Time-to-live in seconds (undefined means no expiration)
46
+ * @returns Expiration timestamp in milliseconds, or undefined
47
+ */
48
+ export declare function calculateExpiration(ttl: number | undefined): number | undefined;
49
+ /**
50
+ * Serializes a value to JSON string
51
+ * @param value - The value to serialize
52
+ * @returns JSON string
53
+ * @throws Error if serialization fails
54
+ */
55
+ export declare function serialize(value: any): string;
56
+ /**
57
+ * Deserializes a JSON string to a value
58
+ * @param json - The JSON string
59
+ * @returns Deserialized value
60
+ * @throws Error if deserialization fails
61
+ */
62
+ export declare function deserialize<T = any>(json: string): T;
63
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/shared/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,CAQhD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CASpE;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,OAAO,EAAE,MAAM,GACd,MAAM,CAMR;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAKhE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,MAAM,GAAG,SAAS,GACtB,MAAM,GAAG,SAAS,CAKpB;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,CAQ5C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAQpD"}
package/metadata.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@happyvertical/cache",
3
+ "path": "packages/cache",
4
+ "position": {
5
+ "index": 5,
6
+ "count": 30
7
+ },
8
+ "description": "Standardized caching interface supporting Memory, File, and Redis backends",
9
+ "provides": [
10
+ "Standardized caching interface supporting Memory, File, and Redis backends"
11
+ ],
12
+ "implements": [],
13
+ "requires": {
14
+ "workspace": [
15
+ "@happyvertical/utils"
16
+ ],
17
+ "externalHappyVertical": [],
18
+ "external": [
19
+ "@aws-sdk/client-s3",
20
+ "@aws-sdk/credential-providers",
21
+ "redis"
22
+ ]
23
+ },
24
+ "dependents": [
25
+ "@happyvertical/geo",
26
+ "@happyvertical/translator"
27
+ ],
28
+ "stability": {
29
+ "level": "stable",
30
+ "reason": "Primary package surface is described as implemented and production-oriented."
31
+ },
32
+ "keywords": [
33
+ "cache"
34
+ ]
35
+ }
package/package.json ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "name": "@happyvertical/cache",
3
+ "version": "0.74.8",
4
+ "description": "Standardized caching interface supporting Memory, File, and Redis backends",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "bin": {
15
+ "have-cache-context": "./dist/cli/claude-context.js"
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "README.md",
20
+ "LICENSE",
21
+ "AGENT.md",
22
+ "metadata.json"
23
+ ],
24
+ "publishConfig": {
25
+ "registry": "https://registry.npmjs.org",
26
+ "access": "public"
27
+ },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/happyvertical/sdk.git",
31
+ "directory": "packages/cache"
32
+ },
33
+ "bugs": {
34
+ "url": "https://github.com/happyvertical/sdk/issues"
35
+ },
36
+ "homepage": "https://github.com/happyvertical/sdk/tree/main/packages/cache#readme",
37
+ "keywords": [
38
+ "cache",
39
+ "caching",
40
+ "redis",
41
+ "memory-cache",
42
+ "file-cache",
43
+ "key-value",
44
+ "ttl",
45
+ "lru"
46
+ ],
47
+ "author": "willgriffin@gmail.com",
48
+ "license": "ISC",
49
+ "dependencies": {
50
+ "@aws-sdk/client-s3": "3.1034.0",
51
+ "@aws-sdk/credential-providers": "3.1034.0",
52
+ "redis": "^5.12.1",
53
+ "@happyvertical/utils": "0.74.8"
54
+ },
55
+ "devDependencies": {
56
+ "@types/node": "25.0.10",
57
+ "typescript": "^5.9.3",
58
+ "vite": "7.3.2",
59
+ "vite-plugin-dts": "4.5.4",
60
+ "vitest": "^4.1.5"
61
+ },
62
+ "scripts": {
63
+ "test": "npx vitest run",
64
+ "test:watch": "npx vitest",
65
+ "build": "vite build",
66
+ "build:watch": "vite build --watch",
67
+ "docs": "typedoc --plugin typedoc-plugin-markdown --out docs --entryPoints ./src/index.ts --tsconfig ./tsconfig.json --excludePrivate --excludeInternal --hideGenerator --fileExtension .md --readme none --categorizeByGroup false --includeVersion false --hidePageHeader --hidePageTitle false --outputFileStrategy modules",
68
+ "docs:watch": "typedoc --plugin typedoc-plugin-markdown --out docs --entryPoints ./src/index.ts --tsconfig ./tsconfig.json --excludePrivate --excludeInternal --hideGenerator --fileExtension .md --readme none --categorizeByGroup false --includeVersion false --hidePageHeader --hidePageTitle false --outputFileStrategy modules --watch",
69
+ "clean": "rm -rf dist docs *.tsbuildinfo",
70
+ "dev": "npm run build:watch & npm run test:watch"
71
+ }
72
+ }