xypriss 3.2.3 → 3.3.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/dist/cjs/src/FiUp.js +5 -2
- package/dist/cjs/src/FiUp.js.map +1 -1
- package/dist/cjs/src/config.js +169 -0
- package/dist/cjs/src/config.js.map +1 -0
- package/dist/cjs/src/file-upload.js +24 -4
- package/dist/cjs/src/file-upload.js.map +1 -1
- package/dist/cjs/src/index.js +3 -2
- package/dist/cjs/src/index.js.map +1 -1
- package/dist/cjs/src/server/FastServer.js +2 -1
- package/dist/cjs/src/server/FastServer.js.map +1 -1
- package/dist/cjs/src/server/ServerFactory.js +67 -32
- package/dist/cjs/src/server/ServerFactory.js.map +1 -1
- package/dist/cjs/src/server/components/fastapi/console/ConsoleInterceptor.js +9 -0
- package/dist/cjs/src/server/components/fastapi/console/ConsoleInterceptor.js.map +1 -1
- package/dist/esm/src/FiUp.js +5 -2
- package/dist/esm/src/FiUp.js.map +1 -1
- package/dist/esm/src/config.js +167 -0
- package/dist/esm/src/config.js.map +1 -0
- package/dist/esm/src/file-upload.js +24 -4
- package/dist/esm/src/file-upload.js.map +1 -1
- package/dist/esm/src/index.js +2 -2
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/server/FastServer.js +2 -1
- package/dist/esm/src/server/FastServer.js.map +1 -1
- package/dist/esm/src/server/ServerFactory.js +67 -32
- package/dist/esm/src/server/ServerFactory.js.map +1 -1
- package/dist/esm/src/server/components/fastapi/console/ConsoleInterceptor.js +9 -0
- package/dist/esm/src/server/components/fastapi/console/ConsoleInterceptor.js.map +1 -1
- package/dist/index.d.ts +104 -33
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -5176,7 +5176,7 @@ declare function createCacheMiddleware(cache: SecureCacheAdapter, options?: Rout
|
|
|
5176
5176
|
* Multi-Server App interface for managing multiple server instances
|
|
5177
5177
|
* Extends UltraFastApp to maintain API compatibility
|
|
5178
5178
|
*/
|
|
5179
|
-
interface MultiServerApp extends Omit<UltraFastApp,
|
|
5179
|
+
interface MultiServerApp extends Omit<UltraFastApp, "start"> {
|
|
5180
5180
|
/**
|
|
5181
5181
|
* Start all server instances (simple API - hides complexity)
|
|
5182
5182
|
* @param port - Port parameter (ignored in multi-server mode)
|
|
@@ -7436,63 +7436,119 @@ interface FileUploadConfig {
|
|
|
7436
7436
|
}
|
|
7437
7437
|
|
|
7438
7438
|
/**
|
|
7439
|
-
*
|
|
7440
|
-
*
|
|
7439
|
+
* XyPriss Configuration Manager
|
|
7440
|
+
*
|
|
7441
|
+
* Provides a safe way to access and update XyPriss configurations
|
|
7442
|
+
* without encountering "cannot access before initialization" errors.
|
|
7443
|
+
*
|
|
7444
|
+
* This class acts as a singleton configuration store that can be used
|
|
7445
|
+
* in modular structures where accessing `app.configs` directly might
|
|
7446
|
+
* cause initialization timing issues.
|
|
7447
|
+
*
|
|
7448
|
+
* @example
|
|
7449
|
+
* ```typescript
|
|
7450
|
+
* import { Configs } from 'xypriss';
|
|
7451
|
+
*
|
|
7452
|
+
* // Set configuration
|
|
7453
|
+
* Configs.set({
|
|
7454
|
+
* fileUpload: {
|
|
7455
|
+
* enabled: true,
|
|
7456
|
+
* maxFileSize: 5 * 1024 * 1024
|
|
7457
|
+
* }
|
|
7458
|
+
* });
|
|
7459
|
+
*
|
|
7460
|
+
* // Get configuration
|
|
7461
|
+
* const fileUploadConfig = Configs.get('fileUpload');
|
|
7462
|
+
*
|
|
7463
|
+
* // Get entire config
|
|
7464
|
+
* const allConfigs = Configs.getAll();
|
|
7465
|
+
*
|
|
7466
|
+
* // Update specific config
|
|
7467
|
+
* Configs.update('fileUpload', { maxFileSize: 10 * 1024 * 1024 });
|
|
7468
|
+
* ```
|
|
7441
7469
|
*/
|
|
7442
7470
|
|
|
7443
|
-
|
|
7444
|
-
|
|
7471
|
+
/**
|
|
7472
|
+
* Configuration Manager Class
|
|
7473
|
+
* Singleton pattern for managing XyPriss configurations
|
|
7474
|
+
*/
|
|
7475
|
+
declare class ConfigurationManager {
|
|
7476
|
+
private static instance;
|
|
7445
7477
|
private config;
|
|
7446
|
-
private
|
|
7447
|
-
private upload;
|
|
7448
|
-
constructor(config: FileUploadConfig, logger: Logger);
|
|
7478
|
+
private initialized;
|
|
7449
7479
|
/**
|
|
7450
|
-
*
|
|
7480
|
+
* Private constructor to enforce singleton pattern
|
|
7451
7481
|
*/
|
|
7452
|
-
|
|
7482
|
+
private constructor();
|
|
7453
7483
|
/**
|
|
7454
|
-
*
|
|
7484
|
+
* Get the singleton instance
|
|
7455
7485
|
*/
|
|
7456
|
-
private
|
|
7486
|
+
private static getInstance;
|
|
7457
7487
|
/**
|
|
7458
|
-
*
|
|
7488
|
+
* Set the entire configuration
|
|
7489
|
+
* @param config - Server configuration options
|
|
7459
7490
|
*/
|
|
7460
|
-
|
|
7491
|
+
static set(config: ServerOptions): void;
|
|
7461
7492
|
/**
|
|
7462
|
-
* Get
|
|
7493
|
+
* Get a specific configuration section
|
|
7494
|
+
* @param key - Configuration key (e.g., 'fileUpload', 'security', 'cache')
|
|
7495
|
+
* @returns The configuration value for the specified key
|
|
7463
7496
|
*/
|
|
7464
|
-
|
|
7497
|
+
static get<K extends keyof ServerOptions>(key: K): ServerOptions[K] | undefined;
|
|
7465
7498
|
/**
|
|
7466
|
-
* Get
|
|
7499
|
+
* Get the entire configuration object
|
|
7500
|
+
* @returns Complete server configuration
|
|
7467
7501
|
*/
|
|
7468
|
-
|
|
7502
|
+
static getAll(): ServerOptions;
|
|
7469
7503
|
/**
|
|
7470
|
-
*
|
|
7504
|
+
* Update a specific configuration section
|
|
7505
|
+
* @param key - Configuration key to update
|
|
7506
|
+
* @param value - New value for the configuration section
|
|
7471
7507
|
*/
|
|
7472
|
-
|
|
7508
|
+
static update<K extends keyof ServerOptions>(key: K, value: ServerOptions[K]): void;
|
|
7473
7509
|
/**
|
|
7474
|
-
*
|
|
7510
|
+
* Merge configuration with existing config
|
|
7511
|
+
* @param config - Partial configuration to merge
|
|
7475
7512
|
*/
|
|
7476
|
-
|
|
7513
|
+
static merge(config: Partial<ServerOptions>): void;
|
|
7477
7514
|
/**
|
|
7478
|
-
*
|
|
7515
|
+
* Check if configuration has been initialized
|
|
7516
|
+
* @returns true if configuration has been set, false otherwise
|
|
7479
7517
|
*/
|
|
7480
|
-
|
|
7518
|
+
static isInitialized(): boolean;
|
|
7481
7519
|
/**
|
|
7482
|
-
*
|
|
7520
|
+
* Reset configuration to empty state
|
|
7521
|
+
* Useful for testing or reinitializing
|
|
7483
7522
|
*/
|
|
7484
|
-
|
|
7523
|
+
static reset(): void;
|
|
7524
|
+
/**
|
|
7525
|
+
* Check if a specific configuration section exists
|
|
7526
|
+
* @param key - Configuration key to check
|
|
7527
|
+
* @returns true if the configuration section exists
|
|
7528
|
+
*/
|
|
7529
|
+
static has<K extends keyof ServerOptions>(key: K): boolean;
|
|
7530
|
+
/**
|
|
7531
|
+
* Get configuration with a default value if not set
|
|
7532
|
+
* @param key - Configuration key
|
|
7533
|
+
* @param defaultValue - Default value to return if key doesn't exist
|
|
7534
|
+
* @returns Configuration value or default value
|
|
7535
|
+
*/
|
|
7536
|
+
static getOrDefault<K extends keyof ServerOptions>(key: K, defaultValue: ServerOptions[K]): ServerOptions[K];
|
|
7485
7537
|
/**
|
|
7486
|
-
*
|
|
7538
|
+
* Delete a specific configuration section
|
|
7539
|
+
* @param key - Configuration key to delete
|
|
7487
7540
|
*/
|
|
7488
|
-
|
|
7541
|
+
static delete<K extends keyof ServerOptions>(key: K): void;
|
|
7489
7542
|
}
|
|
7490
7543
|
|
|
7491
7544
|
/**
|
|
7492
7545
|
* Initialize the global file upload manager (legacy)
|
|
7493
7546
|
* This is called automatically when the server starts with file upload enabled
|
|
7547
|
+
*
|
|
7548
|
+
* @param configManager - The Configs class for accessing configuration
|
|
7549
|
+
* @param logger - Logger instance
|
|
7494
7550
|
*/
|
|
7495
|
-
declare function initializeFileUpload(
|
|
7551
|
+
declare function initializeFileUpload(configManager: typeof ConfigurationManager, logger: Logger): void;
|
|
7496
7552
|
/**
|
|
7497
7553
|
* Create a middleware for uploading a single file (legacy)
|
|
7498
7554
|
*/
|
|
@@ -7541,9 +7597,22 @@ declare class FileUploadAPI {
|
|
|
7541
7597
|
private initialized;
|
|
7542
7598
|
constructor(logger?: Logger);
|
|
7543
7599
|
/**
|
|
7544
|
-
* Initialize the file upload API with configuration
|
|
7600
|
+
* Initialize the file upload API with configuration from Configs
|
|
7601
|
+
*
|
|
7602
|
+
* This method requires the Configs class to enforce a single source of truth.
|
|
7603
|
+
* Configuration is accessed internally from Configs.get('fileUpload').
|
|
7604
|
+
*
|
|
7605
|
+
* @param configManager - The Configs class (not an instance, the class itself)
|
|
7606
|
+
*
|
|
7607
|
+
* @example
|
|
7608
|
+
* ```typescript
|
|
7609
|
+
* import { Configs } from 'xypriss';
|
|
7610
|
+
*
|
|
7611
|
+
* const upload = new FileUploadAPI();
|
|
7612
|
+
* await upload.initialize(Configs);
|
|
7613
|
+
* ```
|
|
7545
7614
|
*/
|
|
7546
|
-
initialize(
|
|
7615
|
+
initialize(configManager: typeof ConfigurationManager): Promise<void>;
|
|
7547
7616
|
/**
|
|
7548
7617
|
* Check if the file upload API is enabled
|
|
7549
7618
|
*/
|
|
@@ -7585,6 +7654,8 @@ declare class FileUploadAPI {
|
|
|
7585
7654
|
any(): (req: any, res: any, next: any) => any;
|
|
7586
7655
|
}
|
|
7587
7656
|
|
|
7657
|
+
declare const Uploader: FileUploadAPI;
|
|
7658
|
+
|
|
7588
7659
|
interface RouteDefinition {
|
|
7589
7660
|
method: string;
|
|
7590
7661
|
path: string;
|
|
@@ -12486,5 +12557,5 @@ declare class TrustProxy {
|
|
|
12486
12557
|
*/
|
|
12487
12558
|
declare function Router(): XyPrissRouter;
|
|
12488
12559
|
|
|
12489
|
-
export { CachePlugin as CachePluginBase, CompressionPlugin, ConnectionPlugin, DEFAULT_PLUGIN_CONFIG, FileUploadAPI as FLA,
|
|
12490
|
-
export type { BasePlugin, CacheConfig, CachePlugin$1 as CachePlugin, CompressionAlgorithm, CompressionConfig, ConnectionConfig, FailoverConfig, FileUploadConfig as FiUpConfig, 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, 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, XyPrisRequest as XyPrissRequest, XyPrisResponse as XyPrissResponse };
|
|
12560
|
+
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, PluginDevelopmentHelpers, PluginEngine, PluginEventType, PluginPriority, PluginRegistry, PluginSystemFactory, PluginSystemUtils, PluginType, ProxyPlugin, RateLimitPlugin, ResponseTimePlugin, Route, Router, SecurityMiddleware, SecurityPlugin as SecurityPluginBase, SmartCachePlugin, TrustProxy, Uploader, XyPrissRouter, createCacheMiddleware, createCircularRefDebugger, createOptimalCache, createSafeJsonMiddleware, createServer, createServerInstance, expressStringify, fastStringify, initializeFileUpload, quickServer, safeJsonStringify, safeStringify, sendSafeJson, setupSafeJson, uploadAny, uploadArray, uploadFields, uploadSingle };
|
|
12561
|
+
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, 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, XyPrisRequest as XyPrissRequest, XyPrisResponse as XyPrissResponse };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xypriss",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.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",
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"test": "jest",
|
|
26
26
|
"test:watch": "jest --watch",
|
|
27
27
|
"test:coverage": "jest --coverage",
|
|
28
|
-
"benchmark": "node benchmarks/index.js"
|
|
28
|
+
"benchmark": "node benchmarks/index.js",
|
|
29
|
+
"prepublishOnly": "npm run build"
|
|
29
30
|
},
|
|
30
31
|
"exports": {
|
|
31
32
|
".": {
|