@wgtechlabs/nuvex 0.1.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.
Files changed (70) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +427 -0
  3. package/dist/.tsbuildinfo +1 -0
  4. package/dist/cjs/core/client.js +981 -0
  5. package/dist/cjs/core/client.js.map +1 -0
  6. package/dist/cjs/core/database.js +297 -0
  7. package/dist/cjs/core/database.js.map +1 -0
  8. package/dist/cjs/core/engine.js +1202 -0
  9. package/dist/cjs/core/engine.js.map +1 -0
  10. package/dist/cjs/core/index.js +35 -0
  11. package/dist/cjs/core/index.js.map +1 -0
  12. package/dist/cjs/index.js +109 -0
  13. package/dist/cjs/index.js.map +1 -0
  14. package/dist/cjs/interfaces/index.js +12 -0
  15. package/dist/cjs/interfaces/index.js.map +1 -0
  16. package/dist/cjs/layers/index.js +22 -0
  17. package/dist/cjs/layers/index.js.map +1 -0
  18. package/dist/cjs/layers/memory.js +388 -0
  19. package/dist/cjs/layers/memory.js.map +1 -0
  20. package/dist/cjs/layers/postgres.js +492 -0
  21. package/dist/cjs/layers/postgres.js.map +1 -0
  22. package/dist/cjs/layers/redis.js +388 -0
  23. package/dist/cjs/layers/redis.js.map +1 -0
  24. package/dist/cjs/types/index.js +52 -0
  25. package/dist/cjs/types/index.js.map +1 -0
  26. package/dist/esm/core/client.js +944 -0
  27. package/dist/esm/core/client.js.map +1 -0
  28. package/dist/esm/core/database.js +289 -0
  29. package/dist/esm/core/database.js.map +1 -0
  30. package/dist/esm/core/engine.js +1198 -0
  31. package/dist/esm/core/engine.js.map +1 -0
  32. package/dist/esm/core/index.js +16 -0
  33. package/dist/esm/core/index.js.map +1 -0
  34. package/dist/esm/index.js +87 -0
  35. package/dist/esm/index.js.map +1 -0
  36. package/dist/esm/interfaces/index.js +11 -0
  37. package/dist/esm/interfaces/index.js.map +1 -0
  38. package/dist/esm/layers/index.js +16 -0
  39. package/dist/esm/layers/index.js.map +1 -0
  40. package/dist/esm/layers/memory.js +384 -0
  41. package/dist/esm/layers/memory.js.map +1 -0
  42. package/dist/esm/layers/postgres.js +485 -0
  43. package/dist/esm/layers/postgres.js.map +1 -0
  44. package/dist/esm/layers/redis.js +384 -0
  45. package/dist/esm/layers/redis.js.map +1 -0
  46. package/dist/esm/types/index.js +49 -0
  47. package/dist/esm/types/index.js.map +1 -0
  48. package/dist/types/core/client.d.ts +561 -0
  49. package/dist/types/core/client.d.ts.map +1 -0
  50. package/dist/types/core/database.d.ts +130 -0
  51. package/dist/types/core/database.d.ts.map +1 -0
  52. package/dist/types/core/engine.d.ts +450 -0
  53. package/dist/types/core/engine.d.ts.map +1 -0
  54. package/dist/types/core/index.d.ts +13 -0
  55. package/dist/types/core/index.d.ts.map +1 -0
  56. package/dist/types/index.d.ts +85 -0
  57. package/dist/types/index.d.ts.map +1 -0
  58. package/dist/types/interfaces/index.d.ts +209 -0
  59. package/dist/types/interfaces/index.d.ts.map +1 -0
  60. package/dist/types/layers/index.d.ts +16 -0
  61. package/dist/types/layers/index.d.ts.map +1 -0
  62. package/dist/types/layers/memory.d.ts +261 -0
  63. package/dist/types/layers/memory.d.ts.map +1 -0
  64. package/dist/types/layers/postgres.d.ts +313 -0
  65. package/dist/types/layers/postgres.d.ts.map +1 -0
  66. package/dist/types/layers/redis.d.ts +248 -0
  67. package/dist/types/layers/redis.d.ts.map +1 -0
  68. package/dist/types/types/index.d.ts +410 -0
  69. package/dist/types/types/index.d.ts.map +1 -0
  70. package/package.json +90 -0
@@ -0,0 +1,384 @@
1
+ /**
2
+ * Nuvex - Redis Storage Layer (L2)
3
+ * Next-gen Unified Vault Experience
4
+ *
5
+ * Redis distributed cache layer providing fast, persistent caching across
6
+ * multiple application instances. Acts as the middle tier in the storage hierarchy.
7
+ *
8
+ * Features:
9
+ * - Distributed caching for multi-instance deployments
10
+ * - Fast access times (1-5ms typical)
11
+ * - Automatic TTL-based expiration
12
+ * - Connection health monitoring
13
+ * - Graceful degradation on failures
14
+ *
15
+ * @author Waren Gonzaga, WG Technology Labs
16
+ * @since 2025
17
+ */
18
+ import { createClient } from 'redis';
19
+ /**
20
+ * Redis Storage Layer - L2 Distributed Cache
21
+ *
22
+ * Implements distributed caching using Redis. This layer provides fast access
23
+ * to frequently used data while supporting multiple application instances.
24
+ * Redis data persists across application restarts (depending on Redis configuration).
25
+ *
26
+ * **Key Features:**
27
+ * - Distributed cache shared across instances
28
+ * - Configurable TTL for automatic expiration
29
+ * - JSON serialization for complex objects
30
+ * - Graceful error handling with logging
31
+ * - Connection health monitoring via PING
32
+ *
33
+ * **Performance Characteristics:**
34
+ * - Get: O(1) network + Redis lookup
35
+ * - Set: O(1) network + Redis write
36
+ * - Latency: 1-5ms typical (network dependent)
37
+ *
38
+ * **Error Handling:**
39
+ * - Returns null on connection failures
40
+ * - Logs errors for monitoring
41
+ * - Doesn't throw to allow graceful degradation
42
+ *
43
+ * @implements {StorageLayerInterface}
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * // Create Redis layer
48
+ * const redis = new RedisStorage('redis://localhost:6379');
49
+ *
50
+ * // Connect to Redis
51
+ * await redis.connect();
52
+ *
53
+ * // Store with 5 minute TTL
54
+ * await redis.set('session:abc', sessionData, 300);
55
+ *
56
+ * // Retrieve data
57
+ * const data = await redis.get('session:abc');
58
+ *
59
+ * // Check health
60
+ * const isHealthy = await redis.ping();
61
+ * ```
62
+ *
63
+ * @class RedisStorage
64
+ * @since 1.0.0
65
+ */
66
+ export class RedisStorage {
67
+ /**
68
+ * Creates a new RedisStorage instance
69
+ *
70
+ * Note: The instance is created but not connected. Call connect() to establish
71
+ * the Redis connection.
72
+ *
73
+ * @param url - Redis connection URL (e.g., redis://localhost:6379)
74
+ * @param logger - Optional logger for debugging
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * const redis = new RedisStorage('redis://localhost:6379', console);
79
+ * await redis.connect();
80
+ * ```
81
+ */
82
+ constructor(url, logger = null) {
83
+ this.url = url;
84
+ this.client = null;
85
+ this.connected = false;
86
+ this.logger = logger;
87
+ }
88
+ /**
89
+ * Establish connection to Redis
90
+ *
91
+ * Creates and connects the Redis client. Should be called before any
92
+ * storage operations.
93
+ *
94
+ * @throws {Error} If connection fails
95
+ *
96
+ * @example
97
+ * ```typescript
98
+ * try {
99
+ * await redis.connect();
100
+ * console.log('Redis connected');
101
+ * } catch (error) {
102
+ * console.error('Redis connection failed:', error);
103
+ * }
104
+ * ```
105
+ */
106
+ async connect() {
107
+ try {
108
+ this.client = createClient({ url: this.url });
109
+ // Set up error handler
110
+ this.client.on('error', (err) => {
111
+ this.log('error', 'Redis L2: Connection error', { error: err.message });
112
+ });
113
+ await this.client.connect();
114
+ this.connected = true;
115
+ this.log('info', 'Redis L2: Connected successfully');
116
+ }
117
+ catch (error) {
118
+ this.connected = false;
119
+ this.log('error', 'Redis L2: Connection failed', {
120
+ error: error instanceof Error ? error.message : String(error)
121
+ });
122
+ throw error;
123
+ }
124
+ }
125
+ /**
126
+ * Close Redis connection
127
+ *
128
+ * Gracefully closes the Redis connection. Should be called during
129
+ * application shutdown.
130
+ *
131
+ * @example
132
+ * ```typescript
133
+ * await redis.disconnect();
134
+ * ```
135
+ */
136
+ async disconnect() {
137
+ if (this.client) {
138
+ await this.client.quit();
139
+ this.connected = false;
140
+ this.log('info', 'Redis L2: Disconnected');
141
+ }
142
+ }
143
+ /**
144
+ * Retrieve a value from Redis cache
145
+ *
146
+ * Deserializes the JSON-stored value. Returns null if the key doesn't exist
147
+ * or if there's a connection/parsing error.
148
+ *
149
+ * @param key - The key to retrieve
150
+ * @returns Promise resolving to the value or null if not found
151
+ *
152
+ * @example
153
+ * ```typescript
154
+ * const userData = await redis.get('user:123');
155
+ * if (userData !== null) {
156
+ * console.log('Found in Redis');
157
+ * }
158
+ * ```
159
+ */
160
+ async get(key) {
161
+ if (!this.connected || !this.client) {
162
+ return null;
163
+ }
164
+ try {
165
+ const value = await this.client.get(key);
166
+ if (value === null) {
167
+ return null;
168
+ }
169
+ return JSON.parse(value);
170
+ }
171
+ catch (error) {
172
+ this.log('error', `Redis L2: Error getting key: ${key}`, {
173
+ error: error instanceof Error ? error.message : String(error)
174
+ });
175
+ return null;
176
+ }
177
+ }
178
+ /**
179
+ * Store a value in Redis cache
180
+ *
181
+ * Serializes the value as JSON and stores it with optional TTL.
182
+ * If TTL is not provided, the key will persist indefinitely (until manually deleted).
183
+ *
184
+ * @param key - The key to store
185
+ * @param value - The value to store (will be JSON serialized)
186
+ * @param ttlSeconds - Optional TTL in seconds
187
+ *
188
+ * @example
189
+ * ```typescript
190
+ * // Store with 1 hour TTL
191
+ * await redis.set('session:abc', sessionData, 3600);
192
+ *
193
+ * // Store without TTL (persists until deleted)
194
+ * await redis.set('config:app', configData);
195
+ * ```
196
+ */
197
+ async set(key, value, ttlSeconds) {
198
+ if (!this.connected || !this.client) {
199
+ this.log('warn', 'Redis L2: Cannot set - not connected', { key });
200
+ return;
201
+ }
202
+ try {
203
+ const serialized = JSON.stringify(value);
204
+ if (ttlSeconds) {
205
+ await this.client.setEx(key, ttlSeconds, serialized);
206
+ }
207
+ else {
208
+ await this.client.set(key, serialized);
209
+ }
210
+ }
211
+ catch (error) {
212
+ this.log('error', `Redis L2: Error setting key: ${key}`, {
213
+ error: error instanceof Error ? error.message : String(error)
214
+ });
215
+ }
216
+ }
217
+ /**
218
+ * Delete a value from Redis cache
219
+ *
220
+ * @param key - The key to delete
221
+ *
222
+ * @example
223
+ * ```typescript
224
+ * await redis.delete('session:expired');
225
+ * ```
226
+ */
227
+ async delete(key) {
228
+ if (!this.connected || !this.client) {
229
+ return;
230
+ }
231
+ try {
232
+ await this.client.del(key);
233
+ }
234
+ catch (error) {
235
+ this.log('error', `Redis L2: Error deleting key: ${key}`, {
236
+ error: error instanceof Error ? error.message : String(error)
237
+ });
238
+ }
239
+ }
240
+ /**
241
+ * Check if a key exists in Redis cache
242
+ *
243
+ * @param key - The key to check
244
+ * @returns Promise resolving to true if the key exists
245
+ *
246
+ * @example
247
+ * ```typescript
248
+ * if (await redis.exists('user:123')) {
249
+ * console.log('Key exists in Redis');
250
+ * }
251
+ * ```
252
+ */
253
+ async exists(key) {
254
+ if (!this.connected || !this.client) {
255
+ return false;
256
+ }
257
+ try {
258
+ const result = await this.client.exists(key);
259
+ return result === 1;
260
+ }
261
+ catch (error) {
262
+ this.log('error', `Redis L2: Error checking existence: ${key}`, {
263
+ error: error instanceof Error ? error.message : String(error)
264
+ });
265
+ return false;
266
+ }
267
+ }
268
+ /**
269
+ * Clear all keys from Redis database
270
+ *
271
+ * **WARNING:** This operation flushes the entire Redis database.
272
+ * Use with caution in production environments.
273
+ *
274
+ * @example
275
+ * ```typescript
276
+ * await redis.clear(); // Flushes entire Redis DB
277
+ * ```
278
+ */
279
+ async clear() {
280
+ if (!this.connected || !this.client) {
281
+ return;
282
+ }
283
+ try {
284
+ await this.client.flushDb();
285
+ this.log('info', 'Redis L2: Database flushed');
286
+ }
287
+ catch (error) {
288
+ this.log('error', 'Redis L2: Error flushing database', {
289
+ error: error instanceof Error ? error.message : String(error)
290
+ });
291
+ }
292
+ }
293
+ /**
294
+ * Health check for Redis connection
295
+ *
296
+ * Uses Redis PING command to verify connectivity and responsiveness.
297
+ * Returns false if not connected or if PING fails.
298
+ *
299
+ * @returns Promise resolving to true if Redis is healthy and responsive
300
+ *
301
+ * @example
302
+ * ```typescript
303
+ * const isHealthy = await redis.ping();
304
+ * if (!isHealthy) {
305
+ * console.error('Redis connection is down');
306
+ * }
307
+ * ```
308
+ */
309
+ async ping() {
310
+ if (!this.connected || !this.client) {
311
+ return false;
312
+ }
313
+ try {
314
+ const result = await this.client.ping();
315
+ return result === 'PONG';
316
+ }
317
+ catch (error) {
318
+ this.log('error', 'Redis L2: Ping failed', {
319
+ error: error instanceof Error ? error.message : String(error)
320
+ });
321
+ return false;
322
+ }
323
+ }
324
+ /**
325
+ * Check if Redis is connected
326
+ *
327
+ * @returns True if connected
328
+ */
329
+ isConnected() {
330
+ return this.connected;
331
+ }
332
+ /**
333
+ * Atomically increment a numeric value
334
+ *
335
+ * Uses Redis INCRBY command for true atomic increments that are safe
336
+ * across multiple instances and concurrent requests.
337
+ *
338
+ * @param key - The key to increment
339
+ * @param delta - The amount to increment by
340
+ * @param ttlSeconds - Optional TTL in seconds
341
+ * @returns Promise resolving to the new value after increment
342
+ *
343
+ * @example
344
+ * ```typescript
345
+ * // Atomic increment - safe for concurrent access
346
+ * const newValue = await redis.increment('counter', 1, 3600);
347
+ * ```
348
+ */
349
+ async increment(key, delta, ttlSeconds) {
350
+ if (!this.connected || !this.client) {
351
+ this.log('warn', 'Redis L2: Cannot increment - not connected', { key });
352
+ throw new Error('Redis not connected');
353
+ }
354
+ try {
355
+ // Use INCRBY for atomic increment
356
+ const newValue = await this.client.incrBy(key, delta);
357
+ // Set TTL if specified
358
+ if (ttlSeconds) {
359
+ await this.client.expire(key, ttlSeconds);
360
+ }
361
+ return newValue;
362
+ }
363
+ catch (error) {
364
+ this.log('error', `Redis L2: Error incrementing key: ${key}`, {
365
+ error: error instanceof Error ? error.message : String(error)
366
+ });
367
+ throw error;
368
+ }
369
+ }
370
+ /**
371
+ * Log a message if logger is configured
372
+ *
373
+ * @private
374
+ * @param level - Log level
375
+ * @param message - Log message
376
+ * @param meta - Optional metadata
377
+ */
378
+ log(level, message, meta) {
379
+ if (this.logger) {
380
+ this.logger[level](message, meta);
381
+ }
382
+ }
383
+ }
384
+ //# sourceMappingURL=redis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redis.js","sourceRoot":"","sources":["../../../src/layers/redis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,YAAY,EAAmB,MAAM,OAAO,CAAC;AAGtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAM,OAAO,YAAY;IAavB;;;;;;;;;;;;;;OAcG;IACH,YAAY,GAAW,EAAE,SAAwB,IAAI;QACn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AC;YAChB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Nuvex - Type Definitions
3
+ * Next-gen Unified Vault Experience
4
+ *
5
+ * Comprehensive type definitions for the multi-layer storage SDK.
6
+ * Provides type safety and IntelliSense support for all storage operations,
7
+ * configurations, and data structures.
8
+ *
9
+ * @author Waren Gonzaga, WG Technology Labs
10
+ * @since 2025
11
+ */
12
+ // ===== Enum Types =====
13
+ /**
14
+ * Storage layer enumeration
15
+ *
16
+ * Defines the available storage layers in the multi-tier architecture.
17
+ * Each layer has different performance characteristics and use cases.
18
+ *
19
+ * @enum {string}
20
+ */
21
+ export var StorageLayer;
22
+ (function (StorageLayer) {
23
+ /** In-memory cache layer - fastest access, volatile storage */
24
+ StorageLayer["MEMORY"] = "memory";
25
+ /** Redis cache layer - fast distributed cache, configurable persistence */
26
+ StorageLayer["REDIS"] = "redis";
27
+ /** PostgreSQL layer - persistent storage, ACID compliance */
28
+ StorageLayer["POSTGRES"] = "postgres";
29
+ })(StorageLayer || (StorageLayer = {}));
30
+ /**
31
+ * Logging level enumeration
32
+ *
33
+ * Defines the available logging levels for the system logger.
34
+ *
35
+ * @enum {string}
36
+ */
37
+ export var LogLevel;
38
+ (function (LogLevel) {
39
+ /** Detailed debug information */
40
+ LogLevel["DEBUG"] = "debug";
41
+ /** General information messages */
42
+ LogLevel["INFO"] = "info";
43
+ /** Warning messages for non-critical issues */
44
+ LogLevel["WARN"] = "warn";
45
+ /** Error messages for failures and exceptions */
46
+ LogLevel["ERROR"] = "error";
47
+ })(LogLevel || (LogLevel = {}));
48
+ // ===== Export all types =====
49
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAyYH,yBAAyB;AAEzB;;;;;;;GAOG;AACH,MAAM,CAAN,IAAY,YAOX;AAPD,WAAY,YAAY;IACtB,+DAA+D;IAC/D,iCAAiB,CAAA;IACjB,2EAA2E;IAC3E,+BAAe,CAAA;IACf,6DAA6D;IAC7D,qCAAqB,CAAA;AACvB,CAAC,EAPW,YAAY,KAAZ,YAAY,QAOvB;AAED;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,QASX;AATD,WAAY,QAAQ;IAClB,iCAAiC;IACjC,2BAAe,CAAA;IACf,mCAAmC;IACnC,yBAAa,CAAA;IACb,+CAA+C;IAC/C,yBAAa,CAAA;IACb,iDAAiD;IACjD,2BAAe,CAAA;AACjB,CAAC,EATW,QAAQ,KAAR,QAAQ,QASnB;AAED,+BAA+B"}