@plyaz/types 1.46.1 → 1.46.2
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/core/init/index.d.ts +1 -1
- package/dist/core/init/types.d.ts +142 -0
- package/package.json +1 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Core Init Types
|
|
3
3
|
* Service registry and initialization type definitions
|
|
4
4
|
*/
|
|
5
|
-
export type { CoreDomainServiceInstance, CoreServiceInitConfig, CoreServiceCreateOptions, CoreInitializableDomainService, CoreServiceEntry, CoreServiceRegistryConfig, CoreExtractServiceConfig, CoreExtractServiceInstance, CoreFeatureFlagInitConfig, CoreErrorHandlerInitConfig, CoreCacheConfig, CoreStorageConfig, CoreNotificationConfig, CoreObservabilityConfig, CoreStreamConfig, CoreInitOptionsBase, CoreServicesResultBase, } from './types';
|
|
5
|
+
export type { CoreDomainServiceInstance, CoreServiceInitConfig, CoreServiceCreateOptions, CoreInitializableDomainService, CoreServiceEntry, CoreServiceRegistryConfig, CoreExtractServiceConfig, CoreExtractServiceInstance, CoreFeatureFlagInitConfig, CoreErrorHandlerInitConfig, CoreCacheConfig, CoreStorageConfig, CoreNotificationConfig, CoreObservabilityConfig, CoreStreamConfig, CoreInitOptionsBase, CoreServicesResultBase, CoreNestJsMiddlewareConfig, CoreNestJsRateLimitConfig, CoreNestJsValidationConfig, CoreNestJsSwaggerConfig, } from './types';
|
|
@@ -787,6 +787,142 @@ export interface CoreStreamConfig {
|
|
|
787
787
|
maxConnections?: number;
|
|
788
788
|
};
|
|
789
789
|
}
|
|
790
|
+
/**
|
|
791
|
+
* Rate limiting configuration for NestJS
|
|
792
|
+
*/
|
|
793
|
+
export interface CoreNestJsRateLimitConfig {
|
|
794
|
+
/** Time window in seconds (default: 60) */
|
|
795
|
+
ttl?: number;
|
|
796
|
+
/** Max requests per window (default: 100) */
|
|
797
|
+
limit?: number;
|
|
798
|
+
/** Skip rate limiting for certain paths */
|
|
799
|
+
skipIf?: (request: unknown) => boolean;
|
|
800
|
+
}
|
|
801
|
+
/**
|
|
802
|
+
* Validation pipe configuration for NestJS
|
|
803
|
+
*/
|
|
804
|
+
export interface CoreNestJsValidationConfig {
|
|
805
|
+
/** Strip properties not in DTO (default: true) */
|
|
806
|
+
whitelist?: boolean;
|
|
807
|
+
/** Throw on non-whitelisted properties (default: false) */
|
|
808
|
+
forbidNonWhitelisted?: boolean;
|
|
809
|
+
/** Transform payloads to DTO instances (default: true) */
|
|
810
|
+
transform?: boolean;
|
|
811
|
+
/** Disable error messages (default: false) */
|
|
812
|
+
disableErrorMessages?: boolean;
|
|
813
|
+
}
|
|
814
|
+
/**
|
|
815
|
+
* Swagger/OpenAPI configuration for NestJS
|
|
816
|
+
*/
|
|
817
|
+
export interface CoreNestJsSwaggerConfig {
|
|
818
|
+
/** Enable Swagger (default: false in production) */
|
|
819
|
+
enabled?: boolean;
|
|
820
|
+
/** Swagger path (default: '/api/docs') */
|
|
821
|
+
path?: string;
|
|
822
|
+
/** API title */
|
|
823
|
+
title?: string;
|
|
824
|
+
/** API description */
|
|
825
|
+
description?: string;
|
|
826
|
+
/** API version */
|
|
827
|
+
version?: string;
|
|
828
|
+
/** Bearer auth enabled */
|
|
829
|
+
bearerAuth?: boolean;
|
|
830
|
+
}
|
|
831
|
+
/**
|
|
832
|
+
* NestJS middleware and configuration options.
|
|
833
|
+
* Applied during app bootstrap via configureNestApp().
|
|
834
|
+
*
|
|
835
|
+
* @example
|
|
836
|
+
* ```typescript
|
|
837
|
+
* await Core.initialize({
|
|
838
|
+
* nestjs: {
|
|
839
|
+
* compression: true,
|
|
840
|
+
* helmet: true,
|
|
841
|
+
* rateLimit: { ttl: 60, limit: 100 },
|
|
842
|
+
* validation: { whitelist: true, transform: true },
|
|
843
|
+
* bodyLimit: '10mb',
|
|
844
|
+
* timeout: 30000,
|
|
845
|
+
* rawBody: true,
|
|
846
|
+
* swagger: { enabled: true, path: '/api/docs' },
|
|
847
|
+
* },
|
|
848
|
+
* });
|
|
849
|
+
* ```
|
|
850
|
+
*/
|
|
851
|
+
export interface CoreNestJsMiddlewareConfig {
|
|
852
|
+
/**
|
|
853
|
+
* Enable response compression (default: true in production).
|
|
854
|
+
* Uses compression middleware for gzip/brotli.
|
|
855
|
+
*/
|
|
856
|
+
compression?: boolean;
|
|
857
|
+
/**
|
|
858
|
+
* Enable Helmet security headers (default: true).
|
|
859
|
+
* Adds XSS protection, content security policy, etc.
|
|
860
|
+
*/
|
|
861
|
+
helmet?: boolean | Record<string, unknown>;
|
|
862
|
+
/**
|
|
863
|
+
* Rate limiting configuration.
|
|
864
|
+
* Set to false to disable, true for defaults, or object for custom config.
|
|
865
|
+
*/
|
|
866
|
+
rateLimit?: boolean | CoreNestJsRateLimitConfig;
|
|
867
|
+
/**
|
|
868
|
+
* Global validation pipe configuration.
|
|
869
|
+
* Enables class-validator for DTO validation.
|
|
870
|
+
*/
|
|
871
|
+
validation?: boolean | CoreNestJsValidationConfig;
|
|
872
|
+
/**
|
|
873
|
+
* Maximum request body size (default: '10mb').
|
|
874
|
+
* Accepts string like '1mb', '10kb', or number in bytes.
|
|
875
|
+
*/
|
|
876
|
+
bodyLimit?: string | number;
|
|
877
|
+
/**
|
|
878
|
+
* Request timeout in milliseconds (default: 30000).
|
|
879
|
+
* Set to 0 to disable timeout.
|
|
880
|
+
*/
|
|
881
|
+
timeout?: number;
|
|
882
|
+
/**
|
|
883
|
+
* Enable raw body parsing for webhooks (default: false).
|
|
884
|
+
* Required for signature verification (Stripe, GitHub, etc.).
|
|
885
|
+
* When enabled, raw body is available on request.rawBody.
|
|
886
|
+
*/
|
|
887
|
+
rawBody?: boolean | {
|
|
888
|
+
paths?: string[];
|
|
889
|
+
};
|
|
890
|
+
/**
|
|
891
|
+
* Swagger/OpenAPI documentation configuration.
|
|
892
|
+
* Set to false to disable, true for defaults, or object for custom config.
|
|
893
|
+
*/
|
|
894
|
+
swagger?: boolean | CoreNestJsSwaggerConfig;
|
|
895
|
+
/**
|
|
896
|
+
* CORS configuration override.
|
|
897
|
+
* By default, uses app-level CORS. Set here to override.
|
|
898
|
+
*/
|
|
899
|
+
cors?: boolean | {
|
|
900
|
+
origin?: string | string[] | boolean;
|
|
901
|
+
credentials?: boolean;
|
|
902
|
+
methods?: string[];
|
|
903
|
+
allowedHeaders?: string[];
|
|
904
|
+
};
|
|
905
|
+
/**
|
|
906
|
+
* Global prefix for all routes (default: 'api').
|
|
907
|
+
* Set to false to disable prefix.
|
|
908
|
+
*/
|
|
909
|
+
globalPrefix?: string | false;
|
|
910
|
+
/**
|
|
911
|
+
* Routes to exclude from global prefix.
|
|
912
|
+
* @example ['health', 'metrics', 'webhooks/*']
|
|
913
|
+
*/
|
|
914
|
+
excludeFromPrefix?: string[];
|
|
915
|
+
/**
|
|
916
|
+
* Enable graceful shutdown handling (default: true).
|
|
917
|
+
* Registers SIGTERM/SIGINT handlers for clean shutdown.
|
|
918
|
+
*/
|
|
919
|
+
gracefulShutdown?: boolean;
|
|
920
|
+
/**
|
|
921
|
+
* Shutdown timeout in milliseconds (default: 10000).
|
|
922
|
+
* Time to wait for graceful shutdown before force exit.
|
|
923
|
+
*/
|
|
924
|
+
shutdownTimeout?: number;
|
|
925
|
+
}
|
|
790
926
|
/**
|
|
791
927
|
* Base core initialization options
|
|
792
928
|
* Extended by @plyaz/core's CoreInitOptions with specific types
|
|
@@ -848,6 +984,12 @@ export interface CoreInitOptionsBase<TDb = unknown, TApi = unknown, TStorage = u
|
|
|
848
984
|
featureFlags?: CoreFeatureFlagInitConfig;
|
|
849
985
|
/** Domain services to auto-initialize */
|
|
850
986
|
services?: CoreServiceEntry[];
|
|
987
|
+
/**
|
|
988
|
+
* NestJS-specific middleware and configuration.
|
|
989
|
+
* Applied during app bootstrap via configureNestApp().
|
|
990
|
+
* Only used when runtime is 'nestjs'.
|
|
991
|
+
*/
|
|
992
|
+
nestjs?: CoreNestJsMiddlewareConfig;
|
|
851
993
|
}
|
|
852
994
|
/**
|
|
853
995
|
* Core services result from initialization
|
package/package.json
CHANGED