@plyaz/types 1.46.10 → 1.47.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/campaign/index.d.ts +1 -1
- package/dist/campaign/types.d.ts +38 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/init/index.d.ts +1 -1
- package/dist/core/init/types.d.ts +271 -44
- package/dist/core/validation.d.ts +47 -0
- package/package.json +1 -1
package/dist/campaign/index.d.ts
CHANGED
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
export { CreateCampaignSchema, UpdateCampaignSchema, PatchCampaignSchema, QueryCampaignSchema, DeleteCampaignSchema, CampaignResponseSchema, CampaignListResponseSchema, formCampaignSchema, } from './schemas';
|
|
17
17
|
export type { FormCampaignData } from './schemas';
|
|
18
18
|
export { CAMPAIGN_STATUS, MILESTONE_TRIGGER_TYPE, MILESTONE_STATUS } from './enums';
|
|
19
|
-
export type { CreateCampaignDTO, UpdateCampaignDTO, PatchCampaignDTO, QueryCampaignDTO, DeleteCampaignDTO, UpdateCampaignParams, CampaignResponseDTO, CampaignListResponseDTO, CampaignEntity, CampaignStoreItem, CampaignStoreState, CampaignCreatedPayload, CampaignUpdatedPayload, CampaignDeletedPayload, CampaignValidationFailedPayload, CampaignFrontendStoreData, CampaignFrontendStoreState, CampaignFrontendStoreActions, CampaignCoreBaseMethods, CampaignSpecificActions, CampaignFrontendStoreSlice, CampaignFrontendServiceConfig, CampaignFrontendEventType, CampaignDomainServiceConfig, OverviewDataItem, OverviewData, FormCampaignDataInterface, DraftCampaignData, CampaignDatabaseRow, CampaignManager, } from './types';
|
|
19
|
+
export type { CreateCampaignDTO, UpdateCampaignDTO, PatchCampaignDTO, QueryCampaignDTO, DeleteCampaignDTO, UpdateCampaignParams, CampaignResponseDTO, CampaignListResponseDTO, CampaignEntity, CampaignStoreItem, CampaignStoreState, CampaignCreatedPayload, CampaignUpdatedPayload, CampaignDeletedPayload, CampaignValidationFailedPayload, CampaignFrontendStoreData, CampaignFrontendStoreState, CampaignFrontendStoreActions, CampaignCoreBaseMethods, CampaignSpecificActions, CampaignFrontendStoreSlice, CampaignFrontendServiceConfig, CampaignFrontendEventType, CampaignDomainServiceConfig, OverviewDataItem, OverviewData, FormCampaignDataInterface, DraftCampaignData, CampaignDatabaseRow, CampaignManager, CampaignFileOperations, CampaignOperations, CampaignFileUpload, } from './types';
|
package/dist/campaign/types.d.ts
CHANGED
|
@@ -293,6 +293,44 @@ export interface CampaignManager {
|
|
|
293
293
|
updateCampaign: (id: string, data: PatchCampaignDTO) => Promise<CampaignEntity | null>;
|
|
294
294
|
deleteCampaign: (id: string) => Promise<boolean>;
|
|
295
295
|
}
|
|
296
|
+
/**
|
|
297
|
+
* Campaign file operations interface
|
|
298
|
+
* Provides file upload operations for campaigns
|
|
299
|
+
*/
|
|
300
|
+
export interface CampaignFileOperations {
|
|
301
|
+
createWithFiles: (data: CreateCampaignDTO & {
|
|
302
|
+
files?: Record<string, File | File[]>;
|
|
303
|
+
}, setCampaigns: Dispatch<SetStateAction<CampaignEntity[]>>) => Promise<CampaignEntity | null>;
|
|
304
|
+
updateWithFiles: (id: string, data: PatchCampaignDTO & {
|
|
305
|
+
files?: Record<string, File | File[]>;
|
|
306
|
+
}, setCampaigns: Dispatch<SetStateAction<CampaignEntity[]>>) => Promise<CampaignEntity | null>;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Enhanced campaign operations interface
|
|
310
|
+
* Combines basic operations with file upload capabilities
|
|
311
|
+
*/
|
|
312
|
+
export interface CampaignOperations {
|
|
313
|
+
campaigns: CampaignEntity[];
|
|
314
|
+
fetchCampaigns: (query?: QueryCampaignDTO) => Promise<void>;
|
|
315
|
+
createCampaign: (data: CreateCampaignDTO) => Promise<CampaignEntity | null>;
|
|
316
|
+
createCampaignWithFiles: (data: CreateCampaignDTO & {
|
|
317
|
+
files?: Record<string, File | File[]>;
|
|
318
|
+
}) => Promise<CampaignEntity | null>;
|
|
319
|
+
updateCampaign: (id: string, data: PatchCampaignDTO) => Promise<CampaignEntity | null>;
|
|
320
|
+
updateCampaignWithFiles: (id: string, data: PatchCampaignDTO & {
|
|
321
|
+
files?: Record<string, File | File[]>;
|
|
322
|
+
}) => Promise<CampaignEntity | null>;
|
|
323
|
+
deleteCampaign: (id: string) => Promise<boolean>;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Campaign file upload interface
|
|
327
|
+
* Provides file upload methods for campaigns
|
|
328
|
+
*/
|
|
329
|
+
export interface CampaignFileUpload {
|
|
330
|
+
uploadCampaignImages: (files: File[], campaignId?: string) => Promise<string[]>;
|
|
331
|
+
uploadCampaignVideos: (files: File[], campaignId?: string) => Promise<string[]>;
|
|
332
|
+
uploadCampaignDocuments: (files: File[], campaignId?: string) => Promise<string[]>;
|
|
333
|
+
}
|
|
296
334
|
/**
|
|
297
335
|
* Database row type for Campaign entity
|
|
298
336
|
*/
|
package/dist/core/index.d.ts
CHANGED
|
@@ -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, CoreNestJsMiddlewareConfig, CoreNestJsRateLimitConfig, CoreNestJsValidationConfig, CoreNestJsSwaggerConfig, } from './types';
|
|
5
|
+
export type { CoreDomainServiceInstance, CoreServiceInitConfig, CoreServiceCreateOptions, CoreInitializableDomainService, CoreServiceEntry, CoreServiceRegistryConfig, CoreExtractServiceConfig, CoreExtractServiceInstance, CoreFeatureFlagInitConfig, CoreErrorHandlerInitConfig, CoreCacheConfig, CoreStorageConfig, CoreNotificationConfig, CoreObservabilityConfig, CoreStreamConfig, CoreInitOptionsBase, CoreServicesResultBase, CoreMiddlewareConfig, CoreRateLimitConfig, CoreCorsConfig, ConfigureAppResult, CoreNestJsMiddlewareConfig, CoreNestJsRateLimitConfig, CoreNestJsValidationConfig, CoreNestJsSwaggerConfig, CoreNestJsVersioningConfig, CoreExpressMiddlewareConfig, CoreNextJsMiddlewareConfig, } from './types';
|
|
@@ -788,16 +788,115 @@ export interface CoreStreamConfig {
|
|
|
788
788
|
};
|
|
789
789
|
}
|
|
790
790
|
/**
|
|
791
|
-
*
|
|
791
|
+
* Common rate limiting configuration.
|
|
792
|
+
* Shared across all frameworks (NestJS, Express, Hono, etc.)
|
|
792
793
|
*/
|
|
793
|
-
export interface
|
|
794
|
+
export interface CoreRateLimitConfig {
|
|
794
795
|
/** Time window in seconds (default: 60) */
|
|
795
796
|
ttl?: number;
|
|
796
797
|
/** Max requests per window (default: 100) */
|
|
797
798
|
limit?: number;
|
|
798
|
-
/** Skip rate limiting for certain
|
|
799
|
+
/** Skip rate limiting for certain requests */
|
|
799
800
|
skipIf?: (request: unknown) => boolean;
|
|
800
801
|
}
|
|
802
|
+
/**
|
|
803
|
+
* Common CORS configuration.
|
|
804
|
+
* Shared across all frameworks.
|
|
805
|
+
*/
|
|
806
|
+
export interface CoreCorsConfig {
|
|
807
|
+
/** Allowed origins (default: true for all) */
|
|
808
|
+
origin?: string | string[] | boolean;
|
|
809
|
+
/** Allow credentials (default: true) */
|
|
810
|
+
credentials?: boolean;
|
|
811
|
+
/** Allowed methods */
|
|
812
|
+
methods?: string[];
|
|
813
|
+
/** Allowed headers */
|
|
814
|
+
allowedHeaders?: string[];
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* Base middleware configuration shared across all frameworks.
|
|
818
|
+
* NestJS, Express, Next.js, Hono, etc. all extend this interface.
|
|
819
|
+
*
|
|
820
|
+
* @example
|
|
821
|
+
* ```typescript
|
|
822
|
+
* const config: CoreMiddlewareConfig = {
|
|
823
|
+
* compression: true,
|
|
824
|
+
* helmet: true,
|
|
825
|
+
* rateLimit: { ttl: 60, limit: 100 },
|
|
826
|
+
* bodyLimit: '10mb',
|
|
827
|
+
* timeout: 30000,
|
|
828
|
+
* cors: { origin: ['http://localhost:3000'] },
|
|
829
|
+
* gracefulShutdown: true,
|
|
830
|
+
* };
|
|
831
|
+
* ```
|
|
832
|
+
*/
|
|
833
|
+
export interface CoreMiddlewareConfig {
|
|
834
|
+
/**
|
|
835
|
+
* Enable response compression (default: true in production).
|
|
836
|
+
* Uses compression middleware for gzip/brotli.
|
|
837
|
+
*/
|
|
838
|
+
compression?: boolean;
|
|
839
|
+
/**
|
|
840
|
+
* Enable Helmet security headers (default: true).
|
|
841
|
+
* Adds XSS protection, content security policy, etc.
|
|
842
|
+
*/
|
|
843
|
+
helmet?: boolean | Record<string, unknown>;
|
|
844
|
+
/**
|
|
845
|
+
* Rate limiting configuration.
|
|
846
|
+
* Set to false to disable, true for defaults, or object for custom config.
|
|
847
|
+
*/
|
|
848
|
+
rateLimit?: boolean | CoreRateLimitConfig;
|
|
849
|
+
/**
|
|
850
|
+
* Maximum request body size (default: '10mb').
|
|
851
|
+
* Accepts string like '1mb', '10kb', or number in bytes.
|
|
852
|
+
*/
|
|
853
|
+
bodyLimit?: string | number;
|
|
854
|
+
/**
|
|
855
|
+
* Request timeout in milliseconds (default: 30000).
|
|
856
|
+
* Set to 0 to disable timeout.
|
|
857
|
+
*/
|
|
858
|
+
timeout?: number;
|
|
859
|
+
/**
|
|
860
|
+
* CORS configuration.
|
|
861
|
+
* Set to false to disable, true for defaults, or object for custom config.
|
|
862
|
+
*/
|
|
863
|
+
cors?: boolean | CoreCorsConfig;
|
|
864
|
+
/**
|
|
865
|
+
* Enable graceful shutdown handling (default: true).
|
|
866
|
+
* Registers SIGTERM/SIGINT handlers for clean shutdown.
|
|
867
|
+
*/
|
|
868
|
+
gracefulShutdown?: boolean;
|
|
869
|
+
/**
|
|
870
|
+
* Shutdown timeout in milliseconds (default: 10000).
|
|
871
|
+
* Time to wait for graceful shutdown before force exit.
|
|
872
|
+
*/
|
|
873
|
+
shutdownTimeout?: number;
|
|
874
|
+
}
|
|
875
|
+
/**
|
|
876
|
+
* Result of configuring an app (framework-agnostic).
|
|
877
|
+
* Returned by configureNestApp, configureExpressApp, etc.
|
|
878
|
+
*/
|
|
879
|
+
export interface ConfigureAppResult {
|
|
880
|
+
/** Features that were enabled */
|
|
881
|
+
enabled: string[];
|
|
882
|
+
/** Features that were skipped (not configured or dependencies missing) */
|
|
883
|
+
skipped: string[];
|
|
884
|
+
/** Any warnings during configuration */
|
|
885
|
+
warnings: string[];
|
|
886
|
+
/** Configured paths */
|
|
887
|
+
paths: {
|
|
888
|
+
/** API prefix (e.g., 'api') */
|
|
889
|
+
prefix?: string;
|
|
890
|
+
/** Documentation path (e.g., 'api/docs') */
|
|
891
|
+
docs?: string;
|
|
892
|
+
};
|
|
893
|
+
}
|
|
894
|
+
/**
|
|
895
|
+
* Rate limiting configuration for NestJS.
|
|
896
|
+
* @deprecated Use CoreRateLimitConfig instead
|
|
897
|
+
*/
|
|
898
|
+
export interface CoreNestJsRateLimitConfig extends CoreRateLimitConfig {
|
|
899
|
+
}
|
|
801
900
|
/**
|
|
802
901
|
* Validation pipe configuration for NestJS
|
|
803
902
|
*/
|
|
@@ -828,8 +927,48 @@ export interface CoreNestJsSwaggerConfig {
|
|
|
828
927
|
/** Bearer auth enabled */
|
|
829
928
|
bearerAuth?: boolean;
|
|
830
929
|
}
|
|
930
|
+
/**
|
|
931
|
+
* API versioning configuration for NestJS.
|
|
932
|
+
* Enables per-controller versioning via @Version() decorator.
|
|
933
|
+
*/
|
|
934
|
+
export interface CoreNestJsVersioningConfig {
|
|
935
|
+
/**
|
|
936
|
+
* Versioning type.
|
|
937
|
+
* - 'uri': Version in URL path (e.g., /v1/users) - default
|
|
938
|
+
* - 'header': Version in request header
|
|
939
|
+
* - 'media-type': Version in Accept header media type
|
|
940
|
+
* - 'custom': Custom version extractor
|
|
941
|
+
*/
|
|
942
|
+
type?: 'uri' | 'header' | 'media-type' | 'custom';
|
|
943
|
+
/**
|
|
944
|
+
* Default version when none specified.
|
|
945
|
+
* Can be a single version or array of versions.
|
|
946
|
+
* @example '1' or ['1', '2']
|
|
947
|
+
*/
|
|
948
|
+
defaultVersion?: string | string[];
|
|
949
|
+
/**
|
|
950
|
+
* URI prefix for URI versioning (default: 'v').
|
|
951
|
+
* @example prefix: 'v' results in /v1/users
|
|
952
|
+
*/
|
|
953
|
+
prefix?: string;
|
|
954
|
+
/**
|
|
955
|
+
* Header name for header versioning (default: 'X-API-Version').
|
|
956
|
+
*/
|
|
957
|
+
header?: string;
|
|
958
|
+
/**
|
|
959
|
+
* Media type key for media-type versioning (default: 'v').
|
|
960
|
+
* @example Accept: application/json;v=1
|
|
961
|
+
*/
|
|
962
|
+
key?: string;
|
|
963
|
+
/**
|
|
964
|
+
* Custom version extractor function.
|
|
965
|
+
* Only used when type is 'custom'.
|
|
966
|
+
*/
|
|
967
|
+
extractor?: (request: unknown) => string | string[];
|
|
968
|
+
}
|
|
831
969
|
/**
|
|
832
970
|
* NestJS middleware and configuration options.
|
|
971
|
+
* Extends CoreMiddlewareConfig with NestJS-specific features.
|
|
833
972
|
* Applied during app bootstrap via configureNestApp().
|
|
834
973
|
*
|
|
835
974
|
* @example
|
|
@@ -848,37 +987,77 @@ export interface CoreNestJsSwaggerConfig {
|
|
|
848
987
|
* });
|
|
849
988
|
* ```
|
|
850
989
|
*/
|
|
851
|
-
export interface CoreNestJsMiddlewareConfig {
|
|
990
|
+
export interface CoreNestJsMiddlewareConfig extends CoreMiddlewareConfig {
|
|
852
991
|
/**
|
|
853
|
-
*
|
|
854
|
-
*
|
|
992
|
+
* Global validation pipe configuration.
|
|
993
|
+
* Enables class-validator for DTO validation.
|
|
994
|
+
* NestJS-specific feature.
|
|
855
995
|
*/
|
|
856
|
-
|
|
996
|
+
validation?: boolean | CoreNestJsValidationConfig;
|
|
857
997
|
/**
|
|
858
|
-
* Enable
|
|
859
|
-
*
|
|
998
|
+
* Enable raw body parsing for webhooks (default: false).
|
|
999
|
+
* Required for signature verification (Stripe, GitHub, etc.).
|
|
1000
|
+
* When enabled, raw body is available on request.rawBody.
|
|
860
1001
|
*/
|
|
861
|
-
|
|
1002
|
+
rawBody?: boolean | {
|
|
1003
|
+
paths?: string[];
|
|
1004
|
+
};
|
|
862
1005
|
/**
|
|
863
|
-
*
|
|
1006
|
+
* Swagger/OpenAPI documentation configuration.
|
|
864
1007
|
* Set to false to disable, true for defaults, or object for custom config.
|
|
1008
|
+
* NestJS-specific feature.
|
|
865
1009
|
*/
|
|
866
|
-
|
|
1010
|
+
swagger?: boolean | CoreNestJsSwaggerConfig;
|
|
867
1011
|
/**
|
|
868
|
-
* Global
|
|
869
|
-
*
|
|
1012
|
+
* Global prefix for all routes (default: 'api').
|
|
1013
|
+
* Set to false to disable prefix.
|
|
870
1014
|
*/
|
|
871
|
-
|
|
1015
|
+
globalPrefix?: string | false;
|
|
872
1016
|
/**
|
|
873
|
-
*
|
|
874
|
-
*
|
|
1017
|
+
* Routes to exclude from global prefix.
|
|
1018
|
+
* @example ['health', 'metrics', 'webhooks/*']
|
|
875
1019
|
*/
|
|
876
|
-
|
|
1020
|
+
excludeFromPrefix?: string[];
|
|
877
1021
|
/**
|
|
878
|
-
*
|
|
879
|
-
*
|
|
1022
|
+
* API versioning configuration.
|
|
1023
|
+
* Enables per-controller versioning via @Version() decorator.
|
|
1024
|
+
* NestJS-specific feature.
|
|
1025
|
+
*
|
|
1026
|
+
* @example URI versioning (default)
|
|
1027
|
+
* ```typescript
|
|
1028
|
+
* versioning: { type: 'uri', defaultVersion: '1' }
|
|
1029
|
+
* // Routes: /v1/users, /v2/users
|
|
1030
|
+
* ```
|
|
1031
|
+
*
|
|
1032
|
+
* @example Header versioning
|
|
1033
|
+
* ```typescript
|
|
1034
|
+
* versioning: { type: 'header', header: 'X-API-Version' }
|
|
1035
|
+
* // Use header: X-API-Version: 1
|
|
1036
|
+
* ```
|
|
880
1037
|
*/
|
|
881
|
-
|
|
1038
|
+
versioning?: CoreNestJsVersioningConfig;
|
|
1039
|
+
}
|
|
1040
|
+
/**
|
|
1041
|
+
* Express middleware and configuration options.
|
|
1042
|
+
* Extends CoreMiddlewareConfig with Express-specific features.
|
|
1043
|
+
* Applied during app bootstrap via configureExpressApp().
|
|
1044
|
+
*
|
|
1045
|
+
* @example
|
|
1046
|
+
* ```typescript
|
|
1047
|
+
* const app = express();
|
|
1048
|
+
* await configureExpressApp(app, {
|
|
1049
|
+
* express: {
|
|
1050
|
+
* compression: true,
|
|
1051
|
+
* helmet: true,
|
|
1052
|
+
* rateLimit: { ttl: 60, limit: 100 },
|
|
1053
|
+
* bodyLimit: '10mb',
|
|
1054
|
+
* trustProxy: true,
|
|
1055
|
+
* rawBody: { paths: ['/webhooks'] },
|
|
1056
|
+
* },
|
|
1057
|
+
* });
|
|
1058
|
+
* ```
|
|
1059
|
+
*/
|
|
1060
|
+
export interface CoreExpressMiddlewareConfig extends CoreMiddlewareConfig {
|
|
882
1061
|
/**
|
|
883
1062
|
* Enable raw body parsing for webhooks (default: false).
|
|
884
1063
|
* Required for signature verification (Stripe, GitHub, etc.).
|
|
@@ -888,40 +1067,76 @@ export interface CoreNestJsMiddlewareConfig {
|
|
|
888
1067
|
paths?: string[];
|
|
889
1068
|
};
|
|
890
1069
|
/**
|
|
891
|
-
*
|
|
892
|
-
*
|
|
1070
|
+
* Trust proxy setting for Express.
|
|
1071
|
+
* Required when behind a reverse proxy (nginx, load balancer).
|
|
1072
|
+
* @see https://expressjs.com/en/guide/behind-proxies.html
|
|
893
1073
|
*/
|
|
894
|
-
|
|
1074
|
+
trustProxy?: boolean | string | number;
|
|
895
1075
|
/**
|
|
896
|
-
*
|
|
897
|
-
*
|
|
1076
|
+
* Mount path for the Express app.
|
|
1077
|
+
* @example '/api' mounts all routes under /api/*
|
|
898
1078
|
*/
|
|
899
|
-
|
|
900
|
-
origin?: string | string[] | boolean;
|
|
901
|
-
credentials?: boolean;
|
|
902
|
-
methods?: string[];
|
|
903
|
-
allowedHeaders?: string[];
|
|
904
|
-
};
|
|
1079
|
+
mountPath?: string;
|
|
905
1080
|
/**
|
|
906
|
-
*
|
|
907
|
-
*
|
|
1081
|
+
* Extended URL encoding for body parser.
|
|
1082
|
+
* @default true
|
|
908
1083
|
*/
|
|
909
|
-
|
|
1084
|
+
extendedUrlEncoded?: boolean;
|
|
1085
|
+
}
|
|
1086
|
+
/**
|
|
1087
|
+
* Next.js middleware and configuration options.
|
|
1088
|
+
* Extends CoreMiddlewareConfig with Next.js-specific features.
|
|
1089
|
+
* Applied via middleware.ts or API route wrappers.
|
|
1090
|
+
*
|
|
1091
|
+
* @example App Router API
|
|
1092
|
+
* ```typescript
|
|
1093
|
+
* // app/api/users/route.ts
|
|
1094
|
+
* import { withCoreMiddleware } from '@plyaz/core/nextjs';
|
|
1095
|
+
*
|
|
1096
|
+
* export const GET = withCoreMiddleware(async (req) => {
|
|
1097
|
+
* return Response.json({ users: [] });
|
|
1098
|
+
* }, {
|
|
1099
|
+
* rateLimit: { ttl: 60, limit: 100 },
|
|
1100
|
+
* });
|
|
1101
|
+
* ```
|
|
1102
|
+
*
|
|
1103
|
+
* @example Pages Router API
|
|
1104
|
+
* ```typescript
|
|
1105
|
+
* // pages/api/users.ts
|
|
1106
|
+
* import { withCoreApiHandler } from '@plyaz/core/nextjs';
|
|
1107
|
+
*
|
|
1108
|
+
* export default withCoreApiHandler(async (req, res) => {
|
|
1109
|
+
* res.json({ users: [] });
|
|
1110
|
+
* }, {
|
|
1111
|
+
* rateLimit: { ttl: 60, limit: 100 },
|
|
1112
|
+
* });
|
|
1113
|
+
* ```
|
|
1114
|
+
*/
|
|
1115
|
+
export interface CoreNextJsMiddlewareConfig extends CoreMiddlewareConfig {
|
|
910
1116
|
/**
|
|
911
|
-
*
|
|
912
|
-
*
|
|
1117
|
+
* Enable raw body parsing for webhooks (default: false).
|
|
1118
|
+
* Required for signature verification (Stripe, GitHub, etc.).
|
|
1119
|
+
* Note: Next.js App Router requires config.api.bodyParser = false
|
|
913
1120
|
*/
|
|
914
|
-
|
|
1121
|
+
rawBody?: boolean | {
|
|
1122
|
+
paths?: string[];
|
|
1123
|
+
};
|
|
915
1124
|
/**
|
|
916
|
-
*
|
|
917
|
-
*
|
|
1125
|
+
* API base path for Next.js routes.
|
|
1126
|
+
* @default '/api'
|
|
918
1127
|
*/
|
|
919
|
-
|
|
1128
|
+
apiBasePath?: string;
|
|
920
1129
|
/**
|
|
921
|
-
*
|
|
922
|
-
*
|
|
1130
|
+
* Enable Edge runtime compatibility mode.
|
|
1131
|
+
* Some middleware (compression, helmet) may not work on Edge.
|
|
1132
|
+
* @default false
|
|
923
1133
|
*/
|
|
924
|
-
|
|
1134
|
+
edgeCompatible?: boolean;
|
|
1135
|
+
/**
|
|
1136
|
+
* Skip middleware for certain paths (regex patterns).
|
|
1137
|
+
* @example ['^/api/health$', '^/_next/.*']
|
|
1138
|
+
*/
|
|
1139
|
+
skipPaths?: string[];
|
|
925
1140
|
}
|
|
926
1141
|
/**
|
|
927
1142
|
* Base core initialization options
|
|
@@ -990,6 +1205,18 @@ export interface CoreInitOptionsBase<TDb = unknown, TApi = unknown, TStorage = u
|
|
|
990
1205
|
* Only used when runtime is 'nestjs'.
|
|
991
1206
|
*/
|
|
992
1207
|
nestjs?: CoreNestJsMiddlewareConfig;
|
|
1208
|
+
/**
|
|
1209
|
+
* Express-specific middleware and configuration.
|
|
1210
|
+
* Applied during app bootstrap via configureExpressApp().
|
|
1211
|
+
* Only used when runtime is 'express'.
|
|
1212
|
+
*/
|
|
1213
|
+
express?: CoreExpressMiddlewareConfig;
|
|
1214
|
+
/**
|
|
1215
|
+
* Next.js-specific middleware and configuration.
|
|
1216
|
+
* Applied via middleware.ts or API route wrappers.
|
|
1217
|
+
* Only used when runtime is 'nextjs'.
|
|
1218
|
+
*/
|
|
1219
|
+
nextjs?: CoreNextJsMiddlewareConfig;
|
|
993
1220
|
}
|
|
994
1221
|
/**
|
|
995
1222
|
* Core services result from initialization
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation Types
|
|
3
|
+
*
|
|
4
|
+
* Types for schema validation across the Plyaz ecosystem.
|
|
5
|
+
* Compatible with Zod schemas without complex type inference issues.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Minimal schema interface for validation pipes.
|
|
9
|
+
* Compatible with Zod schemas without complex type inference issues.
|
|
10
|
+
*
|
|
11
|
+
* Use this type instead of ZodSchema<T> to avoid TypeScript
|
|
12
|
+
* "type instantiation excessively deep" errors with complex schemas.
|
|
13
|
+
*
|
|
14
|
+
* Note: This uses Zod's actual API structure where error is an object
|
|
15
|
+
* with an `issues` array, not the abstracted `ValidationSchema` from
|
|
16
|
+
* errors/validation.ts which uses a flat `errors` array.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* import type { ValidatableSchema } from '@plyaz/types/core';
|
|
21
|
+
*
|
|
22
|
+
* class ValidationPipe<T> {
|
|
23
|
+
* constructor(private schema: ValidatableSchema<T>) {}
|
|
24
|
+
*
|
|
25
|
+
* transform(value: unknown): T {
|
|
26
|
+
* const result = this.schema.safeParse(value);
|
|
27
|
+
* if (!result.success) throw result.error;
|
|
28
|
+
* return result.data;
|
|
29
|
+
* }
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export interface ValidatableSchema<T = unknown> {
|
|
34
|
+
safeParse(value: unknown): {
|
|
35
|
+
success: true;
|
|
36
|
+
data: T;
|
|
37
|
+
} | {
|
|
38
|
+
success: false;
|
|
39
|
+
error: {
|
|
40
|
+
issues: ReadonlyArray<{
|
|
41
|
+
path: PropertyKey[];
|
|
42
|
+
message: string;
|
|
43
|
+
code: string;
|
|
44
|
+
}>;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
}
|
package/package.json
CHANGED