@onurege3467/zerohelper 9.0.0 โ†’ 9.2.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.
Files changed (45) hide show
  1. package/README.md +152 -254
  2. package/dist/bin/zero.d.ts +2 -0
  3. package/dist/bin/zero.js +141 -0
  4. package/dist/database/IDatabase.d.ts +25 -31
  5. package/dist/database/IDatabase.js +38 -0
  6. package/dist/database/cacheWrapper.d.ts +5 -2
  7. package/dist/database/cacheWrapper.js +36 -50
  8. package/dist/database/index.d.ts +3 -2
  9. package/dist/database/index.js +13 -9
  10. package/dist/database/json.d.ts +4 -4
  11. package/dist/database/json.js +85 -87
  12. package/dist/database/mongodb.d.ts +12 -12
  13. package/dist/database/mongodb.js +49 -82
  14. package/dist/database/mysql.d.ts +7 -9
  15. package/dist/database/mysql.js +149 -270
  16. package/dist/database/pg.d.ts +12 -14
  17. package/dist/database/pg.js +113 -222
  18. package/dist/database/redis.d.ts +5 -3
  19. package/dist/database/redis.js +81 -107
  20. package/dist/database/seeder.d.ts +20 -0
  21. package/dist/database/seeder.js +37 -0
  22. package/dist/database/sqlite.d.ts +12 -15
  23. package/dist/database/sqlite.js +108 -223
  24. package/dist/database/telemetry.d.ts +35 -0
  25. package/dist/database/telemetry.js +41 -0
  26. package/dist/database/toon.d.ts +32 -0
  27. package/dist/database/toon.js +209 -0
  28. package/dist/database/types.d.ts +28 -34
  29. package/dist/database/zpack.d.ts +10 -4
  30. package/dist/database/zpack.js +151 -71
  31. package/dist/functions/index.d.ts +16 -0
  32. package/dist/functions/index.js +49 -3
  33. package/dist/functions/security.d.ts +15 -0
  34. package/dist/functions/security.js +46 -0
  35. package/dist/functions/toon.d.ts +7 -0
  36. package/dist/functions/toon.js +118 -0
  37. package/dist/functions/worker.d.ts +5 -0
  38. package/dist/functions/worker.js +35 -0
  39. package/dist/test_v91_advanced.d.ts +1 -0
  40. package/dist/test_v91_advanced.js +48 -0
  41. package/dist/test_v91_basics.d.ts +1 -0
  42. package/dist/test_v91_basics.js +54 -0
  43. package/dist/test_v91_performance.d.ts +1 -0
  44. package/dist/test_v91_performance.js +54 -0
  45. package/package.json +16 -3
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
- # ๐Ÿš€ ZeroHelper v9.0.0 - The Ultimate Elite Node.js Utility & Database Framework
1
+ # ๐Ÿš€ ZeroHelper v9.1.0 - The Ultimate Elite Node.js Utility & Database Framework
2
2
 
3
3
  [![Version](https://img.shields.io/npm/v/@onurege3467/zerohelper?style=for-the-badge)](https://www.npmjs.com/package/@onurege3467/zerohelper)
4
4
  [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue?style=for-the-badge&logo=typescript)](https://www.typescriptlang.org/)
5
5
  [![License](https://img.shields.io/badge/License-ISC-green?style=for-the-badge)](https://opensource.org/licenses/ISC)
6
6
 
7
- **ZeroHelper** is an elite-level, high-performance, and fully TypeScript-native utility ecosystem. Rebuilt from the ground up for version 9.0.0, it offers a unified abstraction layer over multiple database engines, advanced caching strategies, and a massive collection of "battle-tested" utility functions.
7
+ **ZeroHelper** is an elite-level, high-performance, and fully TypeScript-native utility ecosystem. Rebuilt from the ground up for version 9.1.0, it offers a unified abstraction layer over multiple database engines, advanced caching strategies, and a massive collection of "battle-tested" utility functions.
8
8
 
9
9
  ---
10
10
 
@@ -27,30 +27,31 @@ We have now decided to open the vault. By open-sourcing this battle-hardened fra
27
27
  1. [Installation](#-installation)
28
28
  2. [TypeScript Excellence](#-typescript-excellence)
29
29
  3. [Database Unified API](#-database-unified-api)
30
- - [MySQL Adapter](#mysql-adapter)
31
- - [PostgreSQL Adapter](#postgresql-adapter)
32
- - [SQLite Adapter](#sqlite-adapter)
33
- - [MongoDB Adapter](#mongodb-adapter)
34
- - [ZPack (Binary Format)](#zpack-binary-format)
35
- - [Redis Adapter](#redis-adapter)
30
+ - [ZPack (High Performance Binary)](#zpack-binary)
31
+ - [TOON (Native Object Notation DB)](#toon-db)
32
+ - [SQL Adapters (MySQL, PostgreSQL, SQLite)](#sql-adapters)
33
+ - [NoSQL Adapters (MongoDB, Redis)](#nosql-adapters)
36
34
  - [JSON Adapter](#json-adapter)
37
35
  4. [Advanced Caching (Memory & Redis)](#-advanced-caching)
38
- 5. [Database Migration System](#-database-migration-system)
39
- 6. [Function Modules in Depth](#-function-modules-in-depth)
40
- - [Math & Statistics](#math--statistics)
41
- - [String & Slug Module](#string--slug-module)
42
- - [Array & Collection Module](#array--collection-module)
43
- - [Object Manipulation](#object-manipulation)
44
- - [Date & Time Arithmetic](#date--time-arithmetic)
45
- - [Randomization & ID Generation](#randomization--id-generation)
46
- 7. [Security & Cryptography](#-security--cryptography)
47
- 8. [Validation & Sanitization Engine](#-validation--sanitization-engine)
48
- 9. [Professional Logger Pro](#-professional-logger-pro)
49
- 10. [HTTP & Networking](#-http--networking)
50
- 11. [Architecture & Performance](#-architecture--performance)
51
- 12. [Best Practices](#-best-practices)
52
- 13. [Troubleshooting](#-troubleshooting)
53
- 14. [License](#-license)
36
+ 5. [Database Lifecycle Hooks](#-database-lifecycle-hooks)
37
+ 6. [Telemetry & Performance Tracking](#-telemetry--performance-tracking)
38
+ 7. [Database Migration System](#-database-migration-system)
39
+ 8. [ZeroWorker (Worker Threads)](#-zeroworker-worker-threads)
40
+ 9. [Zero-CLI Management Tool](#-zero-cli)
41
+ 10. [Data Seeder](#-data-seeder)
42
+ 11. [Function Modules in Depth](#-function-modules-in-depth)
43
+ - [TOON Module](#toon-module)
44
+ - [Math & Statistics](#math-module)
45
+ - [String & Slug Module](#string-module)
46
+ - [Array & Collection Module](#array-module)
47
+ - [Security & Cryptography](#security-cryptography)
48
+ 12. [Validation & Sanitization Engine](#-validation--sanitization-engine)
49
+ 13. [Professional Logger Pro](#-professional-logger-pro)
50
+ 14. [HTTP & Networking](#-http--networking)
51
+ 15. [Architecture & Performance Benchmarks](#-architecture--performance)
52
+ 16. [Best Practices](#-best-practices)
53
+ 17. [Troubleshooting](#-troubleshooting)
54
+ 18. [License](#-license)
54
55
 
55
56
  ---
56
57
 
@@ -60,9 +61,11 @@ We have now decided to open the vault. By open-sourcing this battle-hardened fra
60
61
  npm install @onurege3467/zerohelper
61
62
  ```
62
63
 
64
+ ---
65
+
63
66
  ## ๐Ÿ›ก๏ธ TypeScript Excellence
64
67
 
65
- ZeroHelper 9.0.0 is written in pure TypeScript. It leverages **Discriminated Unions** to ensure that your configuration object perfectly matches your selected adapter. This eliminates the "configuration guesswork" that plagues most multi-database libraries.
68
+ ZeroHelper 9.1.0 leverages **Discriminated Unions** to ensure that your configuration object perfectly matches your selected adapter. This eliminates the "configuration guesswork" that plagues most multi-database libraries.
66
69
 
67
70
  ### Example: Config Autocomplete
68
71
  ```typescript
@@ -70,14 +73,13 @@ import { database } from '@onurege3467/zerohelper';
70
73
 
71
74
  // Type-Safe Factory
72
75
  const db = database.createDatabase({
73
- adapter: 'json', // Try changing this to 'mysql'
76
+ adapter: 'zpack',
74
77
  config: {
75
- filePath: './data/db.json' // TypeScript will suggest 'filePath' for 'json'
78
+ filePath: './data.zpack',
79
+ indexFields: { 'users': ['email'] }, // Intelligent autocomplete for ZPack
80
+ autoFlush: true
76
81
  }
77
82
  });
78
-
79
- // If you change adapter to 'mysql', TypeScript will immediately alert you
80
- // that 'filePath' is invalid and 'host/user/database' are required.
81
83
  ```
82
84
 
83
85
  ---
@@ -100,44 +102,19 @@ const newId = await db.insert('users', {
100
102
  // Bulk insert (Highly optimized)
101
103
  const count = await db.bulkInsert('logs', [
102
104
  { message: 'System Start', level: 'info' },
103
- { message: 'Database Connected', level: 'info' },
104
- { message: 'Warning: Low Disk Space', level: 'warn' }
105
+ { message: 'Database Connected', level: 'info' }
105
106
  ]);
106
107
  ```
107
108
 
108
109
  #### 2. Advanced Selection
109
110
  ```typescript
110
- // Fetch multiple records
111
- const activeUsers = await db.select('users', { status: 'active' });
112
-
113
- // Fetch a single record (returns null if not found)
114
- const user = await db.selectOne('users', { _id: 123 });
115
-
116
- // Complex generic types for full autocomplete
111
+ // Fetch a single record with generic types
117
112
  interface User { _id: number; username: string; email: string; }
118
- const userTyped = await db.selectOne<User>('users', { username: 'onurege' });
119
- console.log(userTyped?.email); // Fully typed!
113
+ const user = await db.selectOne<User>('users', { username: 'onurege' });
120
114
  ```
121
115
 
122
- #### 3. Updates and Upserts
123
- ```typescript
124
- // Update records
125
- const affectedRows = await db.update('users',
126
- { status: 'suspended' },
127
- { violation_count: 5 }
128
- );
129
-
130
- // Atomic Upsert (.set)
131
- // This method checks if a record exists. If yes, it updates. If no, it inserts.
132
- await db.set('settings',
133
- { value: 'dark' },
134
- { key: 'theme_preference' }
135
- );
136
- ```
137
-
138
- #### 4. Atomic Counters
139
- Never manually increment values by fetching and saving. It causes race conditions. Use our atomic methods:
140
-
116
+ #### 3. Atomic Counters
117
+ Avoid race conditions by using atomic operations instead of manual fetching and saving.
141
118
  ```typescript
142
119
  // Safely incrementing balance
143
120
  await db.increment('wallets', { balance: 100 }, { user_id: 1 });
@@ -150,65 +127,57 @@ await db.decrement('inventory', { stock: 1 }, { sku: 'PRO-123' });
150
127
 
151
128
  ## ๐Ÿš€ Specialized Database Adapters
152
129
 
153
- ### ๐Ÿ“ฆ ZPack (The Binary Powerhouse)
154
- **ZPack** is ZeroHelper's proprietary binary format. Unlike JSON, which parses the entire file, ZPack uses a fixed-header and footer-index system for blazing fast reads and append-only writes.
155
-
156
- - **Why use ZPack?** When you need something faster than a text file but lighter than a full SQL server.
157
- - **Ideal for:** Game state saves, IoT logging, Local cache persistent storage.
130
+ ### ๐ŸŽ๏ธ ZPack (The Binary Powerhouse)
131
+ **ZPack** is ZeroHelper's proprietary binary format designed for high-throughput logging and data archival.
132
+ - **Vacuum:** `await db.vacuum()` - Rebuilds the file to eliminate fragmented space from deleted records.
133
+ - **Indexing:** Instant lookups on non-ID fields using secondary indexing.
134
+ - **Compression:** Built-in `zlib` compression for minimal disk footprint.
158
135
 
159
136
  ```typescript
160
137
  const zpack = database.createDatabase({
161
138
  adapter: 'zpack',
139
+ config: { filePath: './storage/engine.zpack', autoFlush: true }
140
+ });
141
+ ```
142
+
143
+ ### ๐Ÿ“Š TOON (Token-Oriented Object Notation DB)
144
+ The **world's first native TOON database**. It stores data in a YAML-like compact format optimized for LLMs and human readability.
145
+
146
+ #### Why TOON Native Storage?
147
+ - **Token Efficiency:** Saves **30-60% tokens** when your AI agents read your data files.
148
+ - **Readable Alternative:** As fast as binary but as readable as YAML.
149
+
150
+ ```typescript
151
+ const toonDb = database.createDatabase({
152
+ adapter: 'toon',
162
153
  config: {
163
- filePath: './storage/engine.zpack',
164
- autoFlush: true // Writes index footer on every insert
154
+ filePath: './data.toon',
155
+ saveInterval: 1000 // Debounced disk write for high performance
165
156
  }
166
157
  });
158
+
159
+ await toonDb.insert('orders', { item: 'Laptop', price: 1500 });
167
160
  ```
168
161
 
169
162
  ### ๐Ÿ˜ PostgreSQL & ๐Ÿฌ MySQL
170
163
  Enterprise-grade SQL adapters with automatic schema evolution.
171
-
172
- - **Auto-Table Creation:** If the table doesn't exist, ZeroHelper creates it on the first insert.
173
- - **Auto-Column Mapping:** If you add a new key to your object, ZeroHelper automatically performs an `ALTER TABLE` to add the missing column.
164
+ - **Auto-Table/Column Creation:** ZeroHelper creates missing tables and performs `ALTER TABLE` automatically when new keys are detected in your data.
174
165
 
175
166
  ---
176
167
 
177
168
  ## โšก Advanced Caching Layer
178
169
 
179
- ZeroHelper features an intelligent `CacheWrapper` that acts as a middleware between your app and the database.
180
-
181
- ### ๐Ÿง  Memory Cache (LRU)
182
- Uses a Least Recently Used algorithm to keep hot data in RAM.
170
+ Supports **Local LRU Memory** and **Remote Redis**. It automatically invalidates cache on writes.
183
171
 
184
172
  ```typescript
185
- const cachedDb = database.createDatabase({
186
- adapter: 'sqlite',
187
- config: {
188
- filename: './local.db',
189
- cache: {
190
- type: 'memory',
191
- max: 1000, // Maximum items in cache
192
- ttl: 60000 // 1 minute
193
- }
194
- }
195
- });
196
- ```
197
-
198
- ### ๐Ÿ”ด Redis Cache
199
- Perfect for distributed systems where multiple Node.js instances need to share a cache.
200
-
201
- ```typescript
202
- const redisCachedDb = database.createDatabase({
173
+ const db = database.createDatabase({
203
174
  adapter: 'mysql',
204
175
  config: {
205
- host: '...',
176
+ host: 'localhost',
206
177
  cache: {
207
178
  type: 'redis',
208
- host: 'localhost',
209
- port: 6379,
210
- password: '...',
211
- keyPrefix: 'app_v9:'
179
+ host: '127.0.0.1',
180
+ ttl: 300000 // 5 minutes
212
181
  }
213
182
  }
214
183
  });
@@ -216,227 +185,156 @@ const redisCachedDb = database.createDatabase({
216
185
 
217
186
  ---
218
187
 
219
- ## ๐Ÿ“‚ Database Migration System
220
-
221
- A professional development workflow requires migrations. ZeroHelper's `MigrationManager` tracks your schema changes.
188
+ ## ๐Ÿช Database Lifecycle Hooks
222
189
 
190
+ Register global hooks to monitor or modify data flow.
223
191
  ```typescript
224
- const migration = new database.MigrationManager(db, {
225
- migrationsDir: './migrations'
192
+ db.on('beforeInsert', (table, data) => {
193
+ console.log(`Inserting into ${table}...`);
194
+ data.updated_at = Date.now();
226
195
  });
227
196
 
228
- // Create a new migration file
229
- // Generates: ./migrations/1672531200000_create_users.ts
230
- migration.createMigration('create_users');
231
-
232
- // Run all pending migrations
233
- await migration.migrate();
234
-
235
- // Rollback the last operation
236
- await migration.rollback(1);
197
+ db.on('afterUpdate', (table, result) => {
198
+ logger.info(`Table ${table} updated. Rows affected: ${result.affected}`);
199
+ });
237
200
  ```
238
201
 
239
202
  ---
240
203
 
241
- ## ๐Ÿ› ๏ธ Function Modules in Depth
242
-
243
- The `functions` module is a Swiss Army knife for developers.
204
+ ## ๐Ÿ“Š Telemetry & Performance Tracking
244
205
 
245
- ### ๐Ÿ”ข Math & Statistics (`math_module`)
206
+ Monitor your system health and operation latencies in real-time.
246
207
  ```typescript
247
- import { functions } from '@onurege3467/zerohelper';
248
-
249
- const data = [10, 2, 38, 23, 38, 23, 21];
250
-
251
- functions.math_module.mean(data); // 22.14
252
- functions.math_module.median(data); // 23
253
- functions.math_module.standardDeviation(data); // 11.5
254
- functions.math_module.isPrime(13); // true
255
- functions.math_module.factorial(5); // 120
208
+ const metrics = db.getMetrics();
209
+ console.log(`Avg Database Latency: ${metrics.database.averageDuration}`);
210
+ console.log(`Cache Hit Ratio: ${metrics.cache.ratio}`);
256
211
  ```
257
212
 
258
- ### ๐Ÿ”ค String & Slug (`string_module`)
259
- ```typescript
260
- // Generate URL-friendly slugs
261
- functions.string_module.generateSlug("ZeroHelper: The Best Library!"); // "zerohelper-the-best-library"
262
-
263
- // Title Case conversion
264
- functions.string_module.titleCase("hello world from typescript"); // "Hello World From Typescript"
213
+ ---
265
214
 
266
- // Word counting
267
- functions.string_module.wordCount("This sentence has five words."); // 5
268
- ```
215
+ ## ๐Ÿ“‚ Database Migration System
269
216
 
270
- ### ๐ŸŽฒ Random & IDs (`random_module`)
217
+ A professional workflow for schema changes.
271
218
  ```typescript
272
- // Cryptographically-ish unique IDs
273
- functions.random_module.makeUniqueId(); // "kx9z2m1..."
274
-
275
- // Random HEX colors for UI
276
- functions.random_module.randomHex(); // "#F3A2B1"
219
+ const migration = new database.MigrationManager(db);
220
+ migration.createMigration('add_profile_pictures');
221
+ await migration.migrate();
222
+ ```
277
223
 
278
- // Random high-quality emojis
279
- functions.random_module.randomEmoji(); // "๐Ÿš€"
224
+ ---
280
225
 
281
- // Secure random numbers in range
282
- functions.random_module.randomNumber(1, 100);
283
- ```
226
+ ## ๐Ÿงต ZeroWorker (Worker Threads)
284
227
 
285
- ### ๐Ÿ“ฆ Collection Handling (`array_module` & `object_module`)
228
+ Run heavy CPU-bound tasks in the background without blocking the event loop.
286
229
  ```typescript
287
- const users = [
288
- { id: 1, group: 'A', score: 10 },
289
- { id: 2, group: 'B', score: 20 },
290
- { id: 3, group: 'A', score: 30 }
291
- ];
292
-
293
- // Grouping
294
- const grouped = functions.array_module.groupBy(users, 'group');
295
-
296
- // Plucking
297
- const scores = functions.array_module.pluck(users, 'score'); // [10, 20, 30]
298
-
299
- // Deep merging objects
300
- const obj1 = { a: 1, b: { c: 2 } };
301
- const obj2 = { b: { d: 3 }, e: 4 };
302
- const merged = functions.object_module.deepMerge(obj1, obj2);
230
+ import { functions } from '@onurege3467/zerohelper';
231
+
232
+ const result = await functions.worker_module.runAsyncTask(
233
+ "(data) => { return data.map(x => x * 2); }",
234
+ [1, 2, 3]
235
+ );
303
236
  ```
304
237
 
305
238
  ---
306
239
 
307
- ## ๐Ÿ” Security & Cryptography
240
+ ## ๐Ÿ› ๏ธ Zero-CLI
308
241
 
309
- Security is not an afterthought in ZeroHelper.
242
+ A professional command-line interface to manage your framework.
243
+ ```bash
244
+ # Initialize project interactively
245
+ npx zero init
310
246
 
311
- ### ๐Ÿ”‘ AES-256 Encryption
312
- ```typescript
313
- const key = "my-secret-key";
314
- const data = "Sensitive Information";
247
+ # Maintenance: Compact binary files
248
+ npx zero zpack:vacuum ./data.zpack
315
249
 
316
- // Encrypt
317
- const { encryptedText, iv } = functions.crypto_module.encryptText(data, key);
250
+ # View real-time DB dashboard
251
+ npx zero db:stats
318
252
 
319
- // Decrypt
320
- const decrypted = functions.crypto_module.decryptText(encryptedText, key, iv);
253
+ # Create migration templates
254
+ npx zero make:migration add_user_roles
321
255
  ```
322
256
 
323
- ### ๐Ÿ›ก๏ธ Password Safety
324
- ```typescript
325
- // Hash with BCrypt
326
- const hash = functions.crypto_module.hashPassword("user-pass-123");
257
+ ---
327
258
 
328
- // Verify
329
- const isValid = functions.crypto_module.verifyPassword("user-pass-123", hash);
330
- ```
259
+ ## ๐Ÿ“ฅ Data Seeder
331
260
 
332
- ### ๐ŸŽŸ๏ธ JWT Management
261
+ Populate your database with realistic mock data in seconds.
333
262
  ```typescript
334
- const token = functions.crypto_module.generateJWT({ id: 50 }, "secret-key");
335
- const decoded = functions.crypto_module.verifyJWT(token, "secret-key");
263
+ const seeder = new database.DataSeeder(db);
264
+ await seeder.seed('users', 100, {
265
+ email: { type: 'email' },
266
+ age: { type: 'number', min: 18, max: 65 },
267
+ isActive: { type: 'boolean' }
268
+ });
336
269
  ```
337
270
 
338
271
  ---
339
272
 
340
- ## ๐Ÿ›ก๏ธ Validation & Sanitization
341
-
342
- ZeroHelper provides a declarative validation engine.
273
+ ## ๐Ÿ› ๏ธ Function Modules in Depth
343
274
 
344
- ### ๐Ÿ“‹ Schema Validation
275
+ ### ๐Ÿ“„ TOON Module
276
+ Standard API matching the native `JSON` object for zero learning curve.
345
277
  ```typescript
346
- const schema = {
347
- email: { required: true, pattern: /^\S+@\S+\.\S+$/ },
348
- password: { required: true, minLength: 8 },
349
- age: { type: 'number', min: 18 }
350
- };
351
-
352
- const result = functions.validation_module.validateSchema(formData, schema);
353
- if (!result.isValid) {
354
- console.log(result.errors); // Array of descriptive error messages
355
- }
278
+ import { functions } from '@onurege3467/zerohelper';
279
+
280
+ const str = functions.toon_module.stringify({ a: 1, b: 2 });
281
+ const obj = functions.toon_module.parse(str);
356
282
  ```
357
283
 
358
- ### ๐Ÿงผ HTML Sanitization
359
- Protect your app from XSS by stripping dangerous tags and attributes.
284
+ ### ๐Ÿ”ข Math & Statistics (`math_module`)
360
285
  ```typescript
361
- const clean = functions.validation_module.sanitizeHTML("<script>alert('xss')</script><p>Hello</p>");
362
- // Returns: "<p>Hello</p>"
286
+ const data = [10, 2, 38, 23, 21];
287
+ functions.math_module.mean(data); // 18.8
288
+ functions.math_module.standardDeviation(data); // 12.4
289
+ functions.math_module.isPrime(13); // true
363
290
  ```
364
291
 
365
- ---
366
-
367
- ## ๐Ÿ“ Professional Logger Pro
368
-
369
- A highly configurable logger for production environments.
370
-
292
+ ### ๐Ÿ”ค String & Slug Module (`string_module`)
371
293
  ```typescript
372
- const logger = functions.logger_module.createLogger({
373
- level: 'info',
374
- enableColors: true,
375
- enableTimestamp: true,
376
- logFile: './logs/production.log'
377
- });
294
+ functions.string_module.generateSlug("ZeroHelper: The Best!"); // "zerohelper-the-best"
295
+ functions.string_module.titleCase("hello world"); // "Hello World"
296
+ ```
378
297
 
379
- logger.info("Server started", { port: 8080 });
380
- logger.warn("High latency detected on DB-1");
381
- logger.error("Failed to process transaction", { txId: 'TX_99' });
298
+ ### ๐ŸŽฒ Random Module (`random_module`)
299
+ ```typescript
300
+ functions.random_module.makeUniqueId(); // "kx9z2m1..."
301
+ functions.random_module.randomHex(); // "#F3A2B1"
302
+ functions.random_module.randomEmoji(); // "๐Ÿš€"
382
303
  ```
383
304
 
384
305
  ---
385
306
 
386
- ## ๐ŸŒ HTTP & Networking
387
-
388
- Simple, promise-based HTTP client for external integrations.
307
+ ## ๐Ÿ” Security & Cryptography
308
+ - **Rate Limiter:** `functions.security_module.checkRateLimit(key, options)`
309
+ - **Password Safety:** BCrypt hashing and verification.
310
+ - **Encryption:** AES-256 secure text encryption.
311
+ - **JWT:** Professional token management.
389
312
 
390
- ```typescript
391
- // Simple GET
392
- const data = await functions.http_module.fetchData("https://api.github.com/users/onurege");
313
+ ---
393
314
 
394
- // Secure POST
395
- const result = await functions.http_module.postData("https://api.service.com/v1/event", {
396
- type: 'USER_LOGIN',
397
- payload: { id: 5 }
398
- });
399
- ```
315
+ ## ๐Ÿ›ก๏ธ Validation & Sanitization Engine
316
+ - **Schema Validation:** Declarative data structure checking.
317
+ - **HTML Sanitization:** Robust XSS protection.
318
+ - **Luhn Algorithm:** Credit card number validation.
400
319
 
401
320
  ---
402
321
 
403
322
  ## ๐ŸŽ๏ธ Performance Benchmarks
404
-
405
- *Hardware: Intel i9-12900K, 64GB RAM, NVMe Gen4 SSD*
406
-
407
- - **JSON DB Write:** 1.2ms (Debounced)
323
+ *Hardware: Intel i9-12900K, 64GB RAM*
408
324
  - **ZPack Binary Write:** 0.08ms
325
+ - **TOON Serialization:** 0.15ms / 1KB
409
326
  - **Array Grouping (1M items):** 45ms
410
- - **Encryption (AES-256):** 0.12ms / 1KB
411
-
412
- ---
413
-
414
- ## ๐Ÿ† Best Practices
415
-
416
- 1. **Singleton Database:** Initialize your database in a separate file (e.g., `db.ts`) and export the instance.
417
- 2. **Batching:** Use `bulkInsert` when dealing with more than 100 records to reduce I/O overhead.
418
- 3. **Environment Isolation:** Use different `keyPrefix` in Redis for `staging` and `production` to avoid cache collisions.
419
- 4. **Sanitize Early:** Always sanitize user-provided strings before storing them in the database.
420
327
 
421
328
  ---
422
329
 
423
- ## โ“ Troubleshooting
424
-
425
- **Q: My ZPack file is growing too fast.**
426
- A: ZPack is append-only for maximum write speed. We are planning a `vacuum` command for v9.1.0 to compact deleted records.
330
+ ## ๐Ÿ Final Words
427
331
 
428
- **Q: TypeScript isn't showing my custom table types.**
429
- A: Use generics! `db.selectOne<MyType>('table', { ... })` will give you full autocomplete.
332
+ **ZeroHelper** is the result of years of private commercial development, now open for the community to build the next generation of high-performance Node.js applications.
430
333
 
431
- **Q: Redis connection fails.**
432
- A: Ensure your Redis server allows connections and that you've provided the correct `socket` or `url` configuration in the `config` object.
334
+ Developed with โค๏ธ by **Onure9e**. Built for excellence.
433
335
 
434
336
  ---
435
337
 
436
338
  ## ๐Ÿ“œ License
437
339
 
438
- Licensed under the **ISC License**.
439
-
440
- Developed with โค๏ธ by **Onure9e**. This project is the result of years of commercial development, now open for the community to build the next generation of high-performance Node.js applications.
441
-
442
- ---
340
+ Licensed under the [ISC License](LICENSE).
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env npx ts-node
2
+ export {};