@hauska-sdk/adapters-storage-redis 0.1.0
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/CHANGELOG.md +18 -0
- package/dist/index.d.ts +88 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +185 -0
- package/dist/index.js.map +1 -0
- package/package.json +77 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Changelog - @hauska-sdk/adapters-storage-redis
|
|
2
|
+
|
|
3
|
+
All notable changes to the Redis Storage Adapter will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [0.1.0] - 2025-02-03
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- Initial release of Redis Storage Adapter
|
|
9
|
+
- Caching layer for VDA and payment data
|
|
10
|
+
- Cache-aside pattern for reads
|
|
11
|
+
- Write-through/write-back for writes
|
|
12
|
+
- Configurable TTL and key prefixes
|
|
13
|
+
- Fallback to primary storage adapter
|
|
14
|
+
- Cache invalidation on mutations
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
[0.1.0]: https://github.com/hauska-sdk/hauska-sdk/releases/tag/@hauska-sdk/adapters-storage-redis@0.1.0
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hauska-sdk/adapters-storage-redis
|
|
3
|
+
* CNS Protocol Redis Storage Adapter - Caching layer with fallback to primary storage
|
|
4
|
+
*/
|
|
5
|
+
import type { StorageAdapter, SearchOptions, SearchResult } from "@hauska-sdk/adapters-storage-mock";
|
|
6
|
+
import type { VDA } from "@hauska-sdk/vda";
|
|
7
|
+
import type { PaymentRecord } from "@hauska-sdk/payment";
|
|
8
|
+
/**
|
|
9
|
+
* Redis Storage Adapter Configuration
|
|
10
|
+
*/
|
|
11
|
+
export interface RedisAdapterConfig {
|
|
12
|
+
/**
|
|
13
|
+
* Redis client instance (from 'redis' package)
|
|
14
|
+
*/
|
|
15
|
+
client: any;
|
|
16
|
+
/**
|
|
17
|
+
* Primary storage adapter to fallback to on cache miss
|
|
18
|
+
*/
|
|
19
|
+
primaryStorage: StorageAdapter;
|
|
20
|
+
/**
|
|
21
|
+
* Cache TTL in seconds (default: 3600 = 1 hour)
|
|
22
|
+
*/
|
|
23
|
+
ttl?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Key prefix for Redis keys (default: "cns:")
|
|
26
|
+
*/
|
|
27
|
+
keyPrefix?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Redis Storage Adapter
|
|
31
|
+
*
|
|
32
|
+
* Implements a caching layer using Redis with fallback to primary storage.
|
|
33
|
+
* This adapter is designed to improve performance by caching frequently
|
|
34
|
+
* accessed VDAs and payment records.
|
|
35
|
+
*/
|
|
36
|
+
export declare class RedisStorageAdapter implements StorageAdapter {
|
|
37
|
+
private client;
|
|
38
|
+
private primaryStorage;
|
|
39
|
+
private ttl;
|
|
40
|
+
private keyPrefix;
|
|
41
|
+
constructor(config: RedisAdapterConfig);
|
|
42
|
+
/**
|
|
43
|
+
* Get Redis key with prefix
|
|
44
|
+
*/
|
|
45
|
+
private getKey;
|
|
46
|
+
/**
|
|
47
|
+
* Serialize value to JSON string
|
|
48
|
+
*/
|
|
49
|
+
private serialize;
|
|
50
|
+
/**
|
|
51
|
+
* Deserialize JSON string to value
|
|
52
|
+
*/
|
|
53
|
+
private deserialize;
|
|
54
|
+
/**
|
|
55
|
+
* Get value from cache or primary storage
|
|
56
|
+
*/
|
|
57
|
+
private getCached;
|
|
58
|
+
/**
|
|
59
|
+
* Invalidate cache entry
|
|
60
|
+
*/
|
|
61
|
+
private invalidate;
|
|
62
|
+
createVDA(vda: VDA): Promise<VDA>;
|
|
63
|
+
getVDA(vdaId: string): Promise<VDA | null>;
|
|
64
|
+
getVDAByCID(cid: string): Promise<VDA | null>;
|
|
65
|
+
listVDAsByOwner(wallet: string): Promise<VDA[]>;
|
|
66
|
+
listAccessPassesByOwner(wallet: string): Promise<VDA[]>;
|
|
67
|
+
indexByAddress(address: string, vdaId: string): Promise<void>;
|
|
68
|
+
searchByAddress(address: string, options?: SearchOptions): Promise<SearchResult>;
|
|
69
|
+
indexByPatientId(patientId: string, vdaId: string): Promise<void>;
|
|
70
|
+
searchByPatientId(patientId: string, options?: SearchOptions): Promise<SearchResult>;
|
|
71
|
+
indexByAPI14(api14: string, vdaId: string): Promise<void>;
|
|
72
|
+
searchByAPI14(api14: string, options?: SearchOptions): Promise<SearchResult>;
|
|
73
|
+
transferOwnership(vdaId: string, newOwner: string): Promise<void>;
|
|
74
|
+
recordPayment(record: PaymentRecord): Promise<void>;
|
|
75
|
+
getPayment(resourceId: string): Promise<PaymentRecord | null>;
|
|
76
|
+
/**
|
|
77
|
+
* Clear all cached entries (useful for testing or cache invalidation)
|
|
78
|
+
*/
|
|
79
|
+
clearCache(): Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Get cache statistics (useful for monitoring)
|
|
82
|
+
*/
|
|
83
|
+
getCacheStats(): Promise<{
|
|
84
|
+
keys: number;
|
|
85
|
+
memory: string;
|
|
86
|
+
}>;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,YAAY,EACb,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,MAAM,EAAE,GAAG,CAAC;IAEZ;;OAEG;IACH,cAAc,EAAE,cAAc,CAAC;IAE/B;;OAEG;IACH,GAAG,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,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMzD,aAAa,CACjB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,YAAY,CAAC;IAOlB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBjE,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAWnD,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAMnE;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAOjC;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC;QAC7B,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CAaH"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hauska-sdk/adapters-storage-redis
|
|
3
|
+
* CNS Protocol Redis Storage Adapter - Caching layer with fallback to primary storage
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Redis Storage Adapter
|
|
7
|
+
*
|
|
8
|
+
* Implements a caching layer using Redis with fallback to primary storage.
|
|
9
|
+
* This adapter is designed to improve performance by caching frequently
|
|
10
|
+
* accessed VDAs and payment records.
|
|
11
|
+
*/
|
|
12
|
+
export class RedisStorageAdapter {
|
|
13
|
+
client;
|
|
14
|
+
primaryStorage;
|
|
15
|
+
ttl;
|
|
16
|
+
keyPrefix;
|
|
17
|
+
constructor(config) {
|
|
18
|
+
this.client = config.client;
|
|
19
|
+
this.primaryStorage = config.primaryStorage;
|
|
20
|
+
this.ttl = config.ttl ?? 3600; // Default 1 hour
|
|
21
|
+
this.keyPrefix = config.keyPrefix ?? "cns:";
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get Redis key with prefix
|
|
25
|
+
*/
|
|
26
|
+
getKey(suffix) {
|
|
27
|
+
return `${this.keyPrefix}${suffix}`;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Serialize value to JSON string
|
|
31
|
+
*/
|
|
32
|
+
serialize(value) {
|
|
33
|
+
return JSON.stringify(value);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Deserialize JSON string to value
|
|
37
|
+
*/
|
|
38
|
+
deserialize(value) {
|
|
39
|
+
if (!value)
|
|
40
|
+
return null;
|
|
41
|
+
try {
|
|
42
|
+
return JSON.parse(value);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get value from cache or primary storage
|
|
50
|
+
*/
|
|
51
|
+
async getCached(cacheKey, fetcher) {
|
|
52
|
+
// Try cache first
|
|
53
|
+
const cached = await this.client.get(this.getKey(cacheKey));
|
|
54
|
+
if (cached) {
|
|
55
|
+
return this.deserialize(cached);
|
|
56
|
+
}
|
|
57
|
+
// Cache miss - fetch from primary storage
|
|
58
|
+
const value = await fetcher();
|
|
59
|
+
// Cache the value if found
|
|
60
|
+
if (value) {
|
|
61
|
+
await this.client.setEx(this.getKey(cacheKey), this.ttl, this.serialize(value));
|
|
62
|
+
}
|
|
63
|
+
return value;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Invalidate cache entry
|
|
67
|
+
*/
|
|
68
|
+
async invalidate(key) {
|
|
69
|
+
await this.client.del(this.getKey(key));
|
|
70
|
+
}
|
|
71
|
+
// VDA operations
|
|
72
|
+
async createVDA(vda) {
|
|
73
|
+
// Create in primary storage
|
|
74
|
+
const created = await this.primaryStorage.createVDA(vda);
|
|
75
|
+
// Cache the VDA
|
|
76
|
+
await this.client.setEx(this.getKey(`vda:${vda.id}`), this.ttl, this.serialize(created));
|
|
77
|
+
// Cache by CID if present
|
|
78
|
+
if (vda.metadata.ipfsCid) {
|
|
79
|
+
await this.client.setEx(this.getKey(`cid:${vda.metadata.ipfsCid}`), this.ttl, vda.id);
|
|
80
|
+
}
|
|
81
|
+
// Invalidate owner index cache
|
|
82
|
+
await this.invalidate(`owner:${vda.metadata.ownerWallet}`);
|
|
83
|
+
return created;
|
|
84
|
+
}
|
|
85
|
+
async getVDA(vdaId) {
|
|
86
|
+
return this.getCached(`vda:${vdaId}`, () => this.primaryStorage.getVDA(vdaId));
|
|
87
|
+
}
|
|
88
|
+
async getVDAByCID(cid) {
|
|
89
|
+
// Try to get VDA ID from cache
|
|
90
|
+
const cachedVdaId = await this.client.get(this.getKey(`cid:${cid}`));
|
|
91
|
+
if (cachedVdaId) {
|
|
92
|
+
return this.getVDA(cachedVdaId);
|
|
93
|
+
}
|
|
94
|
+
// Cache miss - fetch from primary storage
|
|
95
|
+
const vda = await this.primaryStorage.getVDAByCID(cid);
|
|
96
|
+
// Cache the VDA and CID mapping if found
|
|
97
|
+
if (vda) {
|
|
98
|
+
await this.client.setEx(this.getKey(`vda:${vda.id}`), this.ttl, this.serialize(vda));
|
|
99
|
+
await this.client.setEx(this.getKey(`cid:${cid}`), this.ttl, vda.id);
|
|
100
|
+
}
|
|
101
|
+
return vda;
|
|
102
|
+
}
|
|
103
|
+
async listVDAsByOwner(wallet) {
|
|
104
|
+
// For lists, we don't cache (too dynamic)
|
|
105
|
+
// But we can cache individual VDAs as they're accessed
|
|
106
|
+
return this.primaryStorage.listVDAsByOwner(wallet);
|
|
107
|
+
}
|
|
108
|
+
async listAccessPassesByOwner(wallet) {
|
|
109
|
+
// For lists, we don't cache (too dynamic)
|
|
110
|
+
return this.primaryStorage.listAccessPassesByOwner(wallet);
|
|
111
|
+
}
|
|
112
|
+
// Universal indexing
|
|
113
|
+
async indexByAddress(address, vdaId) {
|
|
114
|
+
await this.primaryStorage.indexByAddress(address, vdaId);
|
|
115
|
+
// Invalidate address search cache
|
|
116
|
+
await this.invalidate(`search:address:${address}`);
|
|
117
|
+
}
|
|
118
|
+
async searchByAddress(address, options) {
|
|
119
|
+
// Search results are not cached (too dynamic)
|
|
120
|
+
return this.primaryStorage.searchByAddress(address, options);
|
|
121
|
+
}
|
|
122
|
+
async indexByPatientId(patientId, vdaId) {
|
|
123
|
+
await this.primaryStorage.indexByPatientId(patientId, vdaId);
|
|
124
|
+
// Invalidate patient ID search cache
|
|
125
|
+
await this.invalidate(`search:patient:${patientId}`);
|
|
126
|
+
}
|
|
127
|
+
async searchByPatientId(patientId, options) {
|
|
128
|
+
// Search results are not cached (too dynamic)
|
|
129
|
+
return this.primaryStorage.searchByPatientId(patientId, options);
|
|
130
|
+
}
|
|
131
|
+
async indexByAPI14(api14, vdaId) {
|
|
132
|
+
await this.primaryStorage.indexByAPI14(api14, vdaId);
|
|
133
|
+
// Invalidate API14 search cache
|
|
134
|
+
await this.invalidate(`search:api14:${api14}`);
|
|
135
|
+
}
|
|
136
|
+
async searchByAPI14(api14, options) {
|
|
137
|
+
// Search results are not cached (too dynamic)
|
|
138
|
+
return this.primaryStorage.searchByAPI14(api14, options);
|
|
139
|
+
}
|
|
140
|
+
// Ownership transfer
|
|
141
|
+
async transferOwnership(vdaId, newOwner) {
|
|
142
|
+
await this.primaryStorage.transferOwnership(vdaId, newOwner);
|
|
143
|
+
// Invalidate VDA cache
|
|
144
|
+
await this.invalidate(`vda:${vdaId}`);
|
|
145
|
+
// Invalidate owner index caches
|
|
146
|
+
const vda = await this.primaryStorage.getVDA(vdaId);
|
|
147
|
+
if (vda) {
|
|
148
|
+
await this.invalidate(`owner:${vda.metadata.ownerWallet}`);
|
|
149
|
+
await this.invalidate(`owner:${newOwner}`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
// Payment records
|
|
153
|
+
async recordPayment(record) {
|
|
154
|
+
await this.primaryStorage.recordPayment(record);
|
|
155
|
+
// Cache the payment record
|
|
156
|
+
await this.client.setEx(this.getKey(`payment:${record.resourceId}`), this.ttl, this.serialize(record));
|
|
157
|
+
}
|
|
158
|
+
async getPayment(resourceId) {
|
|
159
|
+
return this.getCached(`payment:${resourceId}`, () => this.primaryStorage.getPayment(resourceId));
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Clear all cached entries (useful for testing or cache invalidation)
|
|
163
|
+
*/
|
|
164
|
+
async clearCache() {
|
|
165
|
+
const keys = await this.client.keys(this.getKey("*"));
|
|
166
|
+
if (keys.length > 0) {
|
|
167
|
+
await this.client.del(keys);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Get cache statistics (useful for monitoring)
|
|
172
|
+
*/
|
|
173
|
+
async getCacheStats() {
|
|
174
|
+
const keys = await this.client.keys(this.getKey("*"));
|
|
175
|
+
const info = await this.client.info("memory");
|
|
176
|
+
// Parse memory info (simplified - in production, use proper parsing)
|
|
177
|
+
const memoryMatch = info.match(/used_memory_human:([^\r\n]+)/);
|
|
178
|
+
const memory = memoryMatch ? memoryMatch[1].trim() : "unknown";
|
|
179
|
+
return {
|
|
180
|
+
keys: keys.length,
|
|
181
|
+
memory,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAmCH;;;;;;GAMG;AACH,MAAM,OAAO,mBAAmB;IACtB,MAAM,CAAM;IACZ,cAAc,CAAiB;IAC/B,GAAG,CAAS;IACZ,SAAS,CAAS;IAE1B,YAAY,MAA0B;QACpC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;QAC5C,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,iBAAiB;QAChD,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,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AC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QAE/D,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,MAAM;YACjB,MAAM;SACP,CAAC;IACJ,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hauska-sdk/adapters-storage-redis",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "CNS Protocol Redis Storage Adapter",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"require": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc",
|
|
17
|
+
"clean": "rimraf dist",
|
|
18
|
+
"test": "vitest run",
|
|
19
|
+
"test:watch": "vitest",
|
|
20
|
+
"test:coverage": "vitest run --coverage",
|
|
21
|
+
"type-check": "tsc --noEmit"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@hauska-sdk/adapters-storage-mock": "^0.1.0",
|
|
25
|
+
"@hauska-sdk/vda": "^0.1.0",
|
|
26
|
+
"@hauska-sdk/payment": "^0.1.0",
|
|
27
|
+
"@hauska-sdk/retrieval": "^0.1.0",
|
|
28
|
+
"ioredis": "^5.3.2"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "^20.19.31",
|
|
32
|
+
"rimraf": "^5.0.5",
|
|
33
|
+
"typescript": "^5.3.3",
|
|
34
|
+
"vitest": "^1.6.1"
|
|
35
|
+
},
|
|
36
|
+
"keywords": [
|
|
37
|
+
"cns-protocol",
|
|
38
|
+
"storage",
|
|
39
|
+
"redis",
|
|
40
|
+
"adapter",
|
|
41
|
+
"cache",
|
|
42
|
+
"caching"
|
|
43
|
+
],
|
|
44
|
+
"author": "Hauska SDK Team",
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "https://github.com/hauska-sdk/hauska-sdk.git",
|
|
49
|
+
"directory": "packages/adapters/storage-redis"
|
|
50
|
+
},
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/hauska-sdk/hauska-sdk/issues"
|
|
53
|
+
},
|
|
54
|
+
"homepage": "https://github.com/hauska-sdk/hauska-sdk#readme",
|
|
55
|
+
"engines": {
|
|
56
|
+
"node": ">=18.0.0",
|
|
57
|
+
"npm": ">=9.0.0"
|
|
58
|
+
},
|
|
59
|
+
"files": [
|
|
60
|
+
"dist",
|
|
61
|
+
"README.md",
|
|
62
|
+
"CHANGELOG.md"
|
|
63
|
+
],
|
|
64
|
+
"scripts": {
|
|
65
|
+
"build": "tsc",
|
|
66
|
+
"clean": "rimraf dist",
|
|
67
|
+
"test": "vitest run",
|
|
68
|
+
"test:watch": "vitest",
|
|
69
|
+
"test:coverage": "vitest run --coverage",
|
|
70
|
+
"type-check": "tsc --noEmit",
|
|
71
|
+
"prepublishOnly": "npm run build"
|
|
72
|
+
},
|
|
73
|
+
"publishConfig": {
|
|
74
|
+
"access": "public",
|
|
75
|
+
"registry": "https://registry.npmjs.org"
|
|
76
|
+
}
|
|
77
|
+
}
|