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