You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.3 KiB
53 lines
1.3 KiB
/**
|
|
* Canonical constants for polling system
|
|
*/
|
|
|
|
// JWT ID regex pattern with numbered capture groups
|
|
export const JWT_ID_PATTERN = /^(\d{10})_([A-Za-z0-9]{6})_([a-f0-9]{8})$/;
|
|
|
|
// Default configuration values
|
|
export const DEFAULT_CONFIG = {
|
|
// Outbox pressure controls
|
|
maxUndelivered: 1000,
|
|
backpressureThreshold: 0.8,
|
|
maxRetries: 3,
|
|
cleanupIntervalMs: 3600000, // 1 hour
|
|
|
|
// Backoff policy
|
|
baseDelayMs: 1000,
|
|
maxDelayMs: 30000,
|
|
jitterFactor: 0.25,
|
|
respectRetryAfter: true,
|
|
retryAfterMaxMs: 300000, // 5 minutes
|
|
|
|
// Clock sync
|
|
maxClockSkewSeconds: 30,
|
|
skewCheckIntervalMs: 300000, // 5 minutes
|
|
jwtClockSkewTolerance: 30,
|
|
jwtMaxAge: 3600000, // 1 hour
|
|
|
|
// Telemetry
|
|
metricsPrefix: 'starred_projects',
|
|
logLevel: 'INFO'
|
|
} as const;
|
|
|
|
// Error codes
|
|
export const ERROR_CODES = {
|
|
INVALID_REQUEST: 'INVALID_REQUEST',
|
|
VALIDATION_ERROR: 'VALIDATION_ERROR',
|
|
RATE_LIMIT_EXCEEDED: 'RATE_LIMIT_EXCEEDED',
|
|
EXECUTION_ERROR: 'EXECUTION_ERROR',
|
|
CLOCK_SKEW_ERROR: 'CLOCK_SKEW_ERROR',
|
|
STORAGE_PRESSURE: 'STORAGE_PRESSURE'
|
|
} as const;
|
|
|
|
// HTTP status codes
|
|
export const HTTP_STATUS = {
|
|
OK: 200,
|
|
BAD_REQUEST: 400,
|
|
UNAUTHORIZED: 401,
|
|
FORBIDDEN: 403,
|
|
TOO_MANY_REQUESTS: 429,
|
|
INTERNAL_SERVER_ERROR: 500,
|
|
SERVICE_UNAVAILABLE: 503
|
|
} as const;
|
|
|