banatie-service/apps/api-service/src/utils/constants/limits.ts

56 lines
1.2 KiB
TypeScript

export const RATE_LIMITS = {
master: {
requests: {
windowMs: 60 * 60 * 1000, // 1 hour
max: 1000,
},
generations: {
windowMs: 60 * 60 * 1000, // 1 hour
max: 100,
},
},
project: {
requests: {
windowMs: 60 * 60 * 1000, // 1 hour
max: 500,
},
generations: {
windowMs: 60 * 60 * 1000, // 1 hour
max: 50,
},
},
} as const;
export const PAGINATION_LIMITS = {
DEFAULT_LIMIT: 20,
MAX_LIMIT: 100,
MIN_LIMIT: 1,
DEFAULT_OFFSET: 0,
} as const;
export const IMAGE_LIMITS = {
MAX_FILE_SIZE: 5 * 1024 * 1024, // 5MB
MAX_REFERENCE_IMAGES: 3,
MAX_WIDTH: 8192,
MAX_HEIGHT: 8192,
ALLOWED_MIME_TYPES: ['image/jpeg', 'image/png', 'image/webp'] as const,
} as const;
export const GENERATION_LIMITS = {
MAX_PROMPT_LENGTH: 5000,
MAX_RETRY_COUNT: 3,
DEFAULT_ASPECT_RATIO: '1:1',
ALLOWED_ASPECT_RATIOS: ['1:1', '16:9', '9:16', '3:2', '2:3', '4:3', '3:4'] as const,
} as const;
export const FLOW_LIMITS = {
MAX_NAME_LENGTH: 100,
MAX_DESCRIPTION_LENGTH: 500,
MAX_ALIASES_PER_FLOW: 50,
} as const;
export const CACHE_LIMITS = {
PRESIGNED_URL_EXPIRY: 24 * 60 * 60, // 24 hours in seconds
CACHE_MAX_AGE: 365 * 24 * 60 * 60, // 1 year in seconds
} as const;