xypriss 4.0.0 → 4.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.
Files changed (54) hide show
  1. package/dist/cjs/src/config.js +57 -31
  2. package/dist/cjs/src/config.js.map +1 -1
  3. package/dist/cjs/src/file-upload.js +5 -4
  4. package/dist/cjs/src/file-upload.js.map +1 -1
  5. package/dist/cjs/src/index.js +1 -1
  6. package/dist/cjs/src/plugins/api/PluginAPI.js +135 -0
  7. package/dist/cjs/src/plugins/api/PluginAPI.js.map +1 -0
  8. package/dist/cjs/src/plugins/core/PluginManager.js +266 -0
  9. package/dist/cjs/src/plugins/core/PluginManager.js.map +1 -0
  10. package/dist/cjs/src/server/FastServer.js +28 -15
  11. package/dist/cjs/src/server/FastServer.js.map +1 -1
  12. package/dist/cjs/src/server/ServerFactory.js +29 -24
  13. package/dist/cjs/src/server/ServerFactory.js.map +1 -1
  14. package/dist/cjs/src/server/components/fastapi/FileUploadManager.js +3 -2
  15. package/dist/cjs/src/server/components/fastapi/FileUploadManager.js.map +1 -1
  16. package/dist/cjs/src/server/components/fastapi/console/ConsoleInterceptor.js +74 -22
  17. package/dist/cjs/src/server/components/fastapi/console/ConsoleInterceptor.js.map +1 -1
  18. package/dist/cjs/src/server/components/fastapi/console/types.js +0 -1
  19. package/dist/cjs/src/server/components/fastapi/console/types.js.map +1 -1
  20. package/dist/cjs/src/server/const/default.js +75 -0
  21. package/dist/cjs/src/server/const/default.js.map +1 -1
  22. package/dist/cjs/src/server/handlers/NotFoundHandler.js +1 -1
  23. package/dist/esm/src/config.js +57 -31
  24. package/dist/esm/src/config.js.map +1 -1
  25. package/dist/esm/src/file-upload.js +3 -2
  26. package/dist/esm/src/file-upload.js.map +1 -1
  27. package/dist/esm/src/index.js +1 -1
  28. package/dist/esm/src/plugins/api/PluginAPI.js +131 -0
  29. package/dist/esm/src/plugins/api/PluginAPI.js.map +1 -0
  30. package/dist/esm/src/plugins/core/PluginManager.js +264 -0
  31. package/dist/esm/src/plugins/core/PluginManager.js.map +1 -0
  32. package/dist/esm/src/server/FastServer.js +28 -15
  33. package/dist/esm/src/server/FastServer.js.map +1 -1
  34. package/dist/esm/src/server/ServerFactory.js +28 -23
  35. package/dist/esm/src/server/ServerFactory.js.map +1 -1
  36. package/dist/esm/src/server/components/fastapi/FileUploadManager.js +3 -2
  37. package/dist/esm/src/server/components/fastapi/FileUploadManager.js.map +1 -1
  38. package/dist/esm/src/server/components/fastapi/console/ConsoleInterceptor.js +74 -22
  39. package/dist/esm/src/server/components/fastapi/console/ConsoleInterceptor.js.map +1 -1
  40. package/dist/esm/src/server/components/fastapi/console/types.js +0 -1
  41. package/dist/esm/src/server/components/fastapi/console/types.js.map +1 -1
  42. package/dist/esm/src/server/const/default.js +75 -0
  43. package/dist/esm/src/server/const/default.js.map +1 -1
  44. package/dist/esm/src/server/handlers/NotFoundHandler.js +1 -1
  45. package/dist/index.d.ts +112 -109
  46. package/package.json +2 -1
  47. package/dist/cjs/src/plugins/core/PluginAPI.js +0 -80
  48. package/dist/cjs/src/plugins/core/PluginAPI.js.map +0 -1
  49. package/dist/cjs/src/server/utils/ConfigLoader.js +0 -306
  50. package/dist/cjs/src/server/utils/ConfigLoader.js.map +0 -1
  51. package/dist/esm/src/plugins/core/PluginAPI.js +0 -78
  52. package/dist/esm/src/plugins/core/PluginAPI.js.map +0 -1
  53. package/dist/esm/src/server/utils/ConfigLoader.js +0 -283
  54. package/dist/esm/src/server/utils/ConfigLoader.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -3941,7 +3941,7 @@ declare enum PluginType {
3941
3941
  CACHE = "cache",// <0.5ms - Cache operations, hit/miss handling
3942
3942
  PERFORMANCE = "performance",// <0.3ms - Metrics collection, monitoring
3943
3943
  POST_RESPONSE = "post-response",// <0.2ms - Cleanup, logging, analytics
3944
- MIDDLEWARE = "middleware",// <1ms - Custom Express middleware integration
3944
+ MIDDLEWARE = "middleware",// <1ms - Custom XyPriss middleware integration
3945
3945
  NATIVE = "native"
3946
3946
  }
3947
3947
  /**
@@ -4459,7 +4459,7 @@ declare class ServerMaintenancePlugin extends EventEmitter {
4459
4459
  * Manages all server plugins including route optimization and maintenance
4460
4460
  */
4461
4461
 
4462
- declare class PluginManager$1 extends EventEmitter {
4462
+ declare class PluginManager extends EventEmitter {
4463
4463
  private config;
4464
4464
  private routeOptimizationPlugin?;
4465
4465
  private serverMaintenancePlugin?;
@@ -4570,24 +4570,35 @@ interface ConsoleInterceptionStats {
4570
4570
  }
4571
4571
 
4572
4572
  /***************************************************************************
4573
- * XyPrissJS - Secure Array Types
4573
+ * ConsoleInterceptor.ts - Console Interception System for FastXyPrissServer
4574
+ * This file contains the ConsoleInterceptor class, which intercepts and manages all console output through the unified logging system
4575
+ * @author Nehonix
4576
+ * @license NehoPSLA - PROPRIETARY SOFTWARE
4577
+ * @version 1.0
4578
+ * @copyright Copyright (c) 2025 Nehonix. All rights reserved.
4574
4579
  *
4575
- * This file contains type definitions for the SecureArray architecture
4580
+ * PROPRIETARY AND CONFIDENTIAL
4576
4581
  *
4577
- * @author Nehonix
4578
- * @license MIT
4582
+ * This software is the proprietary information of NEHONIX and is protected
4583
+ * by copyright law and international treaties. Unauthorized reproduction,
4584
+ * distribution, modification, or use of this software is strictly prohibited
4585
+ * and may result in severe civil and criminal penalties.
4579
4586
  *
4580
- * Copyright (c) 2025 Nehonix. All rights reserved.
4587
+ * Licensed under the NEHO Proprietary Software License Agreement (NehoPSLA).
4588
+ * See LICENSE.md for full terms and conditions.
4589
+ * Official License: http://dll.nehonix.com/NehoPSLA/license
4581
4590
  *
4582
- * Permission is hereby granted, free of charge, to any person obtaining a copy
4583
- * of this software and associated documentation files (the "Software"), to deal
4584
- * in the Software without restriction, including without limitation the rights
4585
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4586
- * copies of the Software, and to permit persons to whom the Software is
4587
- * furnished to do so, subject to the following conditions:
4591
+ * ACCESS RESTRICTIONS:
4592
+ * - This software is exclusively for use by Authorized Personnel of NEHONIX
4593
+ * - Intended for Internal Use only within NEHONIX operations
4594
+ * - No rights granted to unauthorized individuals or entities
4595
+ * - All modifications are works made for hire assigned to NEHONIX
4588
4596
  *
4589
- * The above copyright notice and this permission notice shall be included in all
4590
- * copies or substantial portions of the Software.
4597
+ * PROHIBITED ACTIVITIES:
4598
+ * - Copying, distributing, or sublicensing without written permission
4599
+ * - Reverse engineering, decompiling, or disassembling
4600
+ * - Creating derivative works without explicit authorization
4601
+ * - External use or commercial distribution outside NEHONIX
4591
4602
  *
4592
4603
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4593
4604
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
@@ -4596,12 +4607,17 @@ interface ConsoleInterceptionStats {
4596
4607
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4597
4608
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
4598
4609
  * SOFTWARE.
4610
+ *
4611
+ * For questions or permissions, contact:
4612
+ * NEHONIX Legal Department
4613
+ * Email: legal@nehonix.com
4614
+ * Website: www.nehonix.com
4599
4615
  ***************************************************************************** */
4616
+
4600
4617
  /**
4601
4618
  * Console Interception System for FastXyPrissServer
4602
4619
  * Intercepts and manages all console output through the unified logging system
4603
4620
  */
4604
-
4605
4621
  declare class ConsoleInterceptor {
4606
4622
  private logger;
4607
4623
  private config;
@@ -4681,6 +4697,10 @@ declare class ConsoleInterceptor {
4681
4697
  * Add source information to intercepted call
4682
4698
  */
4683
4699
  private addSourceInformation;
4700
+ /**
4701
+ * Check if a message matches exclude patterns (supports regex and strings)
4702
+ */
4703
+ private matchesExcludePattern;
4684
4704
  /**
4685
4705
  * Check if call should be intercepted based on filters
4686
4706
  */
@@ -4925,7 +4945,7 @@ declare class XyPrissServer {
4925
4945
  private serverPluginManager;
4926
4946
  private securityMiddleware?;
4927
4947
  private lifecycleManager;
4928
- constructor(userOptions?: ServerOptions);
4948
+ constructor();
4929
4949
  /**
4930
4950
  * Initialize file upload methods synchronously for immediate availability
4931
4951
  */
@@ -4954,9 +4974,10 @@ declare class XyPrissServer {
4954
4974
  /**
4955
4975
  * Get the server plugin manager
4956
4976
  */
4957
- getServerPluginManager(): PluginManager$1 | undefined;
4977
+ getServerPluginManager(): PluginManager | undefined;
4958
4978
  /**
4959
4979
  * Wait for full initialization (cache, console interceptor, and all components)
4980
+ * This method is called automatically by the lifecycle manager
4960
4981
  */
4961
4982
  waitForReady(): Promise<void>;
4962
4983
  /**
@@ -7447,6 +7468,10 @@ interface FileUploadConfig {
7447
7468
  * in modular structures where accessing `app.configs` directly might
7448
7469
  * cause initialization timing issues.
7449
7470
  *
7471
+ * **IMPORTANT**: This is the SINGLE SOURCE OF TRUTH for all XyPriss configurations.
7472
+ * All components should use `Configs.get()` to access configuration values
7473
+ * instead of copying values during initialization.
7474
+ *
7450
7475
  * @example
7451
7476
  * ```typescript
7452
7477
  * import { Configs } from 'xypriss';
@@ -7465,7 +7490,7 @@ interface FileUploadConfig {
7465
7490
  * // Get entire config
7466
7491
  * const allConfigs = Configs.getAll();
7467
7492
  *
7468
- * // Update specific config
7493
+ * // Update specific config (updates the source of truth)
7469
7494
  * Configs.update('fileUpload', { maxFileSize: 10 * 1024 * 1024 });
7470
7495
  * ```
7471
7496
  */
@@ -7480,6 +7505,7 @@ declare class ConfigurationManager {
7480
7505
  private initialized;
7481
7506
  /**
7482
7507
  * Private constructor to enforce singleton pattern
7508
+ * Initializes with default configuration
7483
7509
  */
7484
7510
  private constructor();
7485
7511
  /**
@@ -7488,7 +7514,7 @@ declare class ConfigurationManager {
7488
7514
  private static getInstance;
7489
7515
  /**
7490
7516
  * Set the entire configuration
7491
- * @param config - Server configuration options
7517
+ * @param config - XP Server configuration options
7492
7518
  */
7493
7519
  static set(config: ServerOptions): void;
7494
7520
  /**
@@ -7496,20 +7522,27 @@ declare class ConfigurationManager {
7496
7522
  * @param key - Configuration key (e.g., 'fileUpload', 'security', 'cache')
7497
7523
  * @returns The configuration value for the specified key
7498
7524
  */
7499
- static get<K extends keyof ServerOptions>(key: K): ServerOptions[K] | undefined;
7525
+ static get<K extends keyof ServerOptions>(key: K): ServerOptions[K];
7500
7526
  /**
7501
7527
  * Get the entire configuration object
7502
- * @returns Complete server configuration
7528
+ * @returns Complete XyPriss Server Configuration (XPSC)
7503
7529
  */
7504
7530
  static getAll(): ServerOptions;
7505
7531
  /**
7506
- * Update a specific configuration section
7532
+ * Update a specific XyPriss configuration section (deep merge)
7507
7533
  * @param key - Configuration key to update
7508
- * @param value - New value for the configuration section
7534
+ * @param value - Partial value to merge with existing configuration
7535
+ */
7536
+ static update<K extends keyof ServerOptions>(key: K, value: Partial<ServerOptions[K]>): void;
7537
+ /**
7538
+ * Deep merge helper function
7539
+ * @param target - Target object
7540
+ * @param source - Source object to merge
7541
+ * @returns Merged object
7509
7542
  */
7510
- static update<K extends keyof ServerOptions>(key: K, value: ServerOptions[K]): void;
7543
+ private static deepMerge;
7511
7544
  /**
7512
- * Merge configuration with existing config
7545
+ * Merge configuration with existing config (deep merge)
7513
7546
  * @param config - Partial configuration to merge
7514
7547
  */
7515
7548
  static merge(config: Partial<ServerOptions>): void;
@@ -12433,115 +12466,85 @@ declare class PluginDevelopmentHelpers {
12433
12466
  }
12434
12467
 
12435
12468
  /**
12436
- * Plugin Manager
12437
- * Manages plugin registration, lifecycle, and execution
12469
+ * Plugin API
12470
+ * Public API for plugin management as documented in PLUGIN_SYSTEM_GUIDE.md
12438
12471
  */
12439
12472
 
12440
- declare class PluginManager {
12441
- private plugins;
12442
- private pluginOrder;
12443
- private server;
12444
- private logger;
12445
- constructor(server: XyPrissServer$1);
12446
- /**
12447
- * Register a plugin
12448
- */
12449
- register(plugin: XyPrissPlugin | PluginCreator, config?: any): void;
12450
- /**
12451
- * Initialize all plugins (resolve dependencies and set execution order)
12452
- */
12453
- initialize(): Promise<void>;
12454
- /**
12455
- * Execute a lifecycle hook on all plugins
12456
- */
12457
- executeHook(hookName: keyof XyPrissPlugin, ...args: any[]): Promise<void>;
12458
- /**
12459
- * Register routes from all plugins
12460
- */
12461
- registerRoutes(app: UltraFastApp): void;
12462
- /**
12463
- * Apply middleware from all plugins
12464
- */
12465
- applyMiddleware(app: UltraFastApp): void;
12466
- /**
12467
- * Apply error handlers from all plugins
12468
- * Wraps route methods to catch errors and call plugin error handlers
12469
- */
12470
- applyErrorHandlers(app: UltraFastApp): void;
12471
- /**
12472
- * Get a plugin by name
12473
- */
12474
- getPlugin(name: string): XyPrissPlugin | undefined;
12475
- /**
12476
- * Resolve dependencies and determine execution order
12477
- */
12478
- private resolveDependencies;
12479
- /**
12480
- * Shutdown all plugins
12481
- */
12482
- shutdown(): Promise<void>;
12483
- }
12484
-
12485
12473
  /**
12486
- * Plugin API - Imperative plugin registration
12487
- *
12488
- * Usage:
12489
- * import { Plugin } from 'xypriss';
12490
- *
12491
- * Plugin.register({
12492
- * name: 'my-plugin',
12493
- * version: '1.0.0',
12494
- * onServerStart: () => console.log('Started!')
12495
- * });
12474
+ * Plugin API
12475
+ * Provides imperative methods for plugin management
12496
12476
  */
12497
-
12498
- declare class PluginAPI {
12499
- private static manager;
12500
- /**
12501
- * Set the plugin manager (called internally by ServerFactory)
12502
- */
12503
- static setManager(manager: PluginManager): void;
12477
+ declare const Plugin: {
12504
12478
  /**
12505
12479
  * Register a plugin imperatively
12480
+ * @param plugin - Plugin instance or creator function
12481
+ * @param config - Optional configuration
12506
12482
  *
12507
12483
  * @example
12484
+ * ```typescript
12508
12485
  * Plugin.register({
12509
- * name: 'my-plugin',
12510
- * version: '1.0.0',
12511
- * onServerStart: () => console.log('Started!')
12486
+ * name: "my-plugin",
12487
+ * version: "1.0.0",
12488
+ * onServerStart: () => console.log("Started!")
12512
12489
  * });
12490
+ * ```
12513
12491
  */
12514
- static register(plugin: XyPrissPlugin | PluginCreator, config?: any): void;
12492
+ register(plugin: XyPrissPlugin | PluginCreator, config?: any): void;
12515
12493
  /**
12516
12494
  * Get a registered plugin by name
12495
+ * @param name - Plugin name
12496
+ * @returns Plugin instance or undefined if not found
12497
+ *
12498
+ * @example
12499
+ * ```typescript
12500
+ * const plugin = Plugin.get("my-plugin");
12501
+ * if (plugin) {
12502
+ * console.log(`Found plugin: ${plugin.name}@${plugin.version}`);
12503
+ * }
12504
+ * ```
12517
12505
  */
12518
- static get(name: string): XyPrissPlugin | undefined;
12506
+ get(name: string): XyPrissPlugin | undefined;
12519
12507
  /**
12520
- * Create a plugin (helper for creating plugin objects)
12508
+ * Create a plugin (helper method)
12509
+ * This is just a type-safe identity function that helps with TypeScript inference
12510
+ * @param plugin - Plugin definition
12511
+ * @returns The same plugin instance
12521
12512
  *
12522
12513
  * @example
12514
+ * ```typescript
12523
12515
  * const myPlugin = Plugin.create({
12524
- * name: 'my-plugin',
12525
- * version: '1.0.0',
12526
- * onServerStart: () => console.log('Started!')
12516
+ * name: "my-plugin",
12517
+ * version: "1.0.0",
12518
+ * onServerStart: (server) => {
12519
+ * console.log("Plugin started!");
12520
+ * }
12527
12521
  * });
12522
+ * ```
12528
12523
  */
12529
- static create(plugin: XyPrissPlugin): XyPrissPlugin;
12524
+ create(plugin: XyPrissPlugin): XyPrissPlugin;
12530
12525
  /**
12531
12526
  * Create a plugin factory function
12527
+ * Useful for creating reusable plugins with configuration
12528
+ * @param creator - Function that creates a plugin from config
12529
+ * @returns Plugin creator function
12532
12530
  *
12533
12531
  * @example
12534
- * const createAuthPlugin = Plugin.factory((config) => ({
12535
- * name: 'auth',
12536
- * version: '1.0.0',
12537
- * onRequest: (req, res, next) => {
12538
- * // Use config here
12539
- * next();
12532
+ * ```typescript
12533
+ * const createMyPlugin = Plugin.factory((config: { apiKey: string }) => ({
12534
+ * name: "my-plugin",
12535
+ * version: "1.0.0",
12536
+ * onServerStart: (server) => {
12537
+ * server.apiKey = config.apiKey;
12540
12538
  * }
12541
12539
  * }));
12540
+ *
12541
+ * // Use it
12542
+ * const plugin = createMyPlugin({ apiKey: "secret" });
12543
+ * Plugin.register(plugin);
12544
+ * ```
12542
12545
  */
12543
- static factory(creator: PluginCreator): PluginCreator;
12544
- }
12546
+ factory<TConfig = any>(creator: (config: TConfig) => XyPrissPlugin): PluginCreator;
12547
+ };
12545
12548
 
12546
12549
  /**
12547
12550
  * XyPrissJS Express Quick Start
@@ -12670,5 +12673,5 @@ declare class TrustProxy {
12670
12673
  */
12671
12674
  declare function Router(): XyPrissRouter;
12672
12675
 
12673
- export { CachePlugin as CachePluginBase, CompressionPlugin, ConfigurationManager as Configs, ConnectionPlugin, DEFAULT_PLUGIN_CONFIG, FileUploadAPI as FLA, FileUploadAPI, JWTAuthPlugin, NetworkCategory, NetworkPlugin, NetworkPluginFactory, NetworkPluginUtils, PERFORMANCE_TARGETS, PLUGIN_SYSTEM_NAME, PLUGIN_SYSTEM_VERSION, PerformanceMonitor, PerformancePlugin as PerformancePluginBase, PluginAPI as Plugin, PluginDevelopmentHelpers, PluginEngine, PluginEventType, PluginPriority, PluginRegistry, PluginSystemFactory, PluginSystemUtils, PluginType, ProxyPlugin, RateLimitPlugin, ResponseTimePlugin, Route, Router, SecurityMiddleware, SecurityPlugin as SecurityPluginBase, SmartCachePlugin, TrustProxy, Upload, XyPrissRouter, createCacheMiddleware, createCircularRefDebugger, createOptimalCache, createSafeJsonMiddleware, createServer, createServerInstance, expressStringify, fastStringify, initializeFileUpload, quickServer, safeJsonStringify, safeStringify, sendSafeJson, setupSafeJson, uploadAny, uploadArray, uploadFields, uploadSingle };
12676
+ export { CachePlugin as CachePluginBase, CompressionPlugin, ConfigurationManager as Configs, ConnectionPlugin, DEFAULT_PLUGIN_CONFIG, FileUploadAPI as FLA, FileUploadAPI, JWTAuthPlugin, NetworkCategory, NetworkPlugin, NetworkPluginFactory, NetworkPluginUtils, PERFORMANCE_TARGETS, PLUGIN_SYSTEM_NAME, PLUGIN_SYSTEM_VERSION, PerformanceMonitor, PerformancePlugin as PerformancePluginBase, Plugin, PluginDevelopmentHelpers, PluginEngine, PluginEventType, PluginPriority, PluginRegistry, PluginSystemFactory, PluginSystemUtils, PluginType, ProxyPlugin, RateLimitPlugin, ResponseTimePlugin, Route, Router, SecurityMiddleware, SecurityPlugin as SecurityPluginBase, SmartCachePlugin, TrustProxy, Upload, XyPrissRouter, createCacheMiddleware, createCircularRefDebugger, createOptimalCache, createSafeJsonMiddleware, createServer, createServerInstance, expressStringify, fastStringify, initializeFileUpload, quickServer, safeJsonStringify, safeStringify, sendSafeJson, setupSafeJson, uploadAny, uploadArray, uploadFields, uploadSingle };
12674
12677
  export type { BasePlugin, CacheConfig, CachePlugin$1 as CachePlugin, CompressionAlgorithm, CompressionConfig, ConnectionConfig, FailoverConfig, FileUploadConfig as FiUpConfig, FileUploadConfig, HTTPCacheConfig, HealthCheckConfig, CachePlugin$1 as ICachePlugin, PerformancePlugin$1 as IPerformancePlugin, SecurityPlugin$1 as ISecurityPlugin, LoadBalancingStrategy, MultiServerApp, MultiServerConfig, NativePlugin, NetworkExecutionContext, NetworkExecutionResult, NetworkHealthStatus, NetworkPluginConfig, NetworkSecurityConfig, NextFunction, PerformanceConfig, PerformanceMetrics, PerformancePlugin$1 as PerformancePlugin, PluginConfiguration, PluginCreator, PluginEvent, PluginExecutionContext, PluginExecutionResult, PluginExecutionStats, PluginInitializationContext, PluginRegistryConfig, ProxyConfig, RateLimitConfig, RateLimitRule, RateLimitStrategy, RedisConfig, XyPrisRequest as Request, RequestHandler, XyPrisResponse as Response, RouteConfig, RouteOptions, SecurityConfig, SecurityPlugin$1 as SecurityPlugin, ServerOptions, SmartRouteConfig, TrustProxyValue$1 as TrustProxyValue, UltraFastApp, UpstreamServer, WebSocketConfig, MultiServerApp as XyPMS, XyPrissPlugin, XyPrisRequest as XyPrissRequest, XyPrisResponse as XyPrissResponse };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xypriss",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
4
4
  "description": "XyPriss is a lightweight, TypeScript-first, open-source Node.js web framework crafted for developers seeking a familiar Express-like API without Express dependencies. It features built-in security middleware, a robust routing system, and performance optimizations to build scalable, secure web applications effortlessly. Join our community and contribute on GitHub!",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -271,3 +271,4 @@
271
271
  "xypriss-security": "^1.1.10"
272
272
  }
273
273
  }
274
+
@@ -1,80 +0,0 @@
1
- 'use strict';
2
-
3
- /**
4
- * Plugin API - Imperative plugin registration
5
- *
6
- * Usage:
7
- * import { Plugin } from 'xypriss';
8
- *
9
- * Plugin.register({
10
- * name: 'my-plugin',
11
- * version: '1.0.0',
12
- * onServerStart: () => console.log('Started!')
13
- * });
14
- */
15
- class PluginAPI {
16
- /**
17
- * Set the plugin manager (called internally by ServerFactory)
18
- */
19
- static setManager(manager) {
20
- this.manager = manager;
21
- }
22
- /**
23
- * Register a plugin imperatively
24
- *
25
- * @example
26
- * Plugin.register({
27
- * name: 'my-plugin',
28
- * version: '1.0.0',
29
- * onServerStart: () => console.log('Started!')
30
- * });
31
- */
32
- static register(plugin, config) {
33
- if (!this.manager) {
34
- throw new Error("Plugin system not initialized. Create a server first.");
35
- }
36
- this.manager.register(plugin, config);
37
- }
38
- /**
39
- * Get a registered plugin by name
40
- */
41
- static get(name) {
42
- if (!this.manager) {
43
- throw new Error("Plugin system not initialized. Create a server first.");
44
- }
45
- return this.manager.getPlugin(name);
46
- }
47
- /**
48
- * Create a plugin (helper for creating plugin objects)
49
- *
50
- * @example
51
- * const myPlugin = Plugin.create({
52
- * name: 'my-plugin',
53
- * version: '1.0.0',
54
- * onServerStart: () => console.log('Started!')
55
- * });
56
- */
57
- static create(plugin) {
58
- return plugin;
59
- }
60
- /**
61
- * Create a plugin factory function
62
- *
63
- * @example
64
- * const createAuthPlugin = Plugin.factory((config) => ({
65
- * name: 'auth',
66
- * version: '1.0.0',
67
- * onRequest: (req, res, next) => {
68
- * // Use config here
69
- * next();
70
- * }
71
- * }));
72
- */
73
- static factory(creator) {
74
- return creator;
75
- }
76
- }
77
- PluginAPI.manager = null;
78
-
79
- exports.Plugin = PluginAPI;
80
- //# sourceMappingURL=PluginAPI.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PluginAPI.js","sources":["../../../../../src/plugins/core/PluginAPI.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;;;;;;;AAWG;AAKH,MAAM,SAAS,CAAA;AAGX;;AAEG;IACH,OAAO,UAAU,CAAC,OAAsB,EAAA;AACpC,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;KAC1B;AAED;;;;;;;;;AASG;AACH,IAAA,OAAO,QAAQ,CAAC,MAAqC,EAAE,MAAY,EAAA;AAC/D,QAAA,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;AACf,YAAA,MAAM,IAAI,KAAK,CACX,uDAAuD,CAC1D,CAAC;SACL;QACD,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACzC;AAED;;AAEG;IACH,OAAO,GAAG,CAAC,IAAY,EAAA;AACnB,QAAA,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;AACf,YAAA,MAAM,IAAI,KAAK,CACX,uDAAuD,CAC1D,CAAC;SACL;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;KACvC;AAED;;;;;;;;;AASG;IACH,OAAO,MAAM,CAAC,MAAqB,EAAA;AAC/B,QAAA,OAAO,MAAM,CAAC;KACjB;AAED;;;;;;;;;;;;AAYG;IACH,OAAO,OAAO,CAAC,OAAsB,EAAA;AACjC,QAAA,OAAO,OAAO,CAAC;KAClB;;AArEc,SAAO,CAAA,OAAA,GAAyB,IAAI;;;;"}