@plyaz/config 1.6.5 → 1.7.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/api/index.cjs +3 -0
- package/dist/api/index.cjs.map +1 -0
- package/dist/api/index.mjs +3 -0
- package/dist/api/index.mjs.map +1 -0
- package/dist/chains/supportedChains.d.ts +2 -2
- package/dist/notifications/index.cjs +3 -0
- package/dist/notifications/index.cjs.map +1 -0
- package/dist/notifications/index.mjs +3 -0
- package/dist/notifications/index.mjs.map +1 -0
- package/package.json +8 -2
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
'use strict';// @plyaz package - Built with tsup
|
|
2
|
+
var e={SECOND:1e3,THIRTY_SECONDS:3e4,TWO_MINUTES:12e4};var i={timeout:e.THIRTY_SECONDS,unifiedStrategy:"interactive",revalidationStrategy:"balanced",strategy:"softFail",headers:{presets:["json"],autoDetectNetwork:true,requestClientHints:false},enrichedHeaders:{enabled:true,preset:"standard",includeDevice:false,includeNetwork:true,includePlatform:true,includeCompliance:true,respectDoNotTrack:true,autoDetectRegion:true,regionalPreset:"global",useTimezone:true},networkAware:{enabled:true,adaptConfig:true,requestClientHints:false},tracking:{enabled:true,operations:true,events:true,performanceMode:"minimal",queueStrategy:"batch",eventStrategy:"queued",telemetry:true},retryStrategy:"aggressive",encryption:{enabled:true,algorithm:"AES-GCM",autoDecrypt:true,target:["all"],key:void 0,fields:["*.email","*.ssn","*.taxId","*.nationalId","*.passport","*.driverLicense","*.governmentId","*.phone","*.phoneNumber","*.mobile","*.telephone","*.address.street","*.address.line1","*.address.line2","*.postalCode","*.zipCode","*.cardNumber","*.creditCard","*.debitCard","*.cvv","*.cvc","*.iban","*.accountNumber","*.routingNumber","*.swiftCode","*.sortCode","*.password","*.apiKey","*.secret","*.token","*.accessToken","*.refreshToken","*.privateKey","*.secretKey","*.wallet","*.walletAddress","*.mnemonic","*.seedPhrase","*.privateKeyHex","*.medicalRecord","*.medicalRecordNumber","*.healthInfo","*.diagnosis","*.prescription","*.healthInsurance","*.fingerprint","*.faceId","*.biometric","*.birthDate","*.dateOfBirth","*.dob","*.ipAddress","*.ip"]}},o={timeout:e.THIRTY_SECONDS,unifiedStrategy:"interactive",revalidationStrategy:"balanced",strategy:"softFail",headers:{presets:["json"],autoDetectNetwork:true,requestClientHints:false},enrichedHeaders:{enabled:true,preset:"standard",includeDevice:true,includeNetwork:true,includePlatform:true,includeCompliance:true,respectDoNotTrack:true,autoDetectRegion:true,regionalPreset:"global",useTimezone:true},networkAware:{enabled:true,adaptConfig:true,requestClientHints:false},tracking:{enabled:true,operations:true,events:true,performanceMode:"full",queueStrategy:"batch",eventStrategy:"queued",telemetry:true},retryStrategy:"aggressive",encryption:{enabled:true,algorithm:"AES-GCM",autoDecrypt:true,target:["all"],key:void 0,fields:["*.email","*.ssn","*.taxId","*.nationalId","*.passport","*.driverLicense","*.governmentId","*.phone","*.phoneNumber","*.mobile","*.telephone","*.address.street","*.address.line1","*.address.line2","*.postalCode","*.zipCode","*.cardNumber","*.creditCard","*.debitCard","*.cvv","*.cvc","*.iban","*.accountNumber","*.routingNumber","*.swiftCode","*.sortCode","*.password","*.apiKey","*.secret","*.token","*.accessToken","*.refreshToken","*.privateKey","*.secretKey","*.wallet","*.walletAddress","*.mnemonic","*.seedPhrase","*.privateKeyHex","*.medicalRecord","*.medicalRecordNumber","*.healthInfo","*.diagnosis","*.prescription","*.healthInsurance","*.fingerprint","*.faceId","*.biometric","*.birthDate","*.dateOfBirth","*.dob","*.ipAddress","*.ip"]}},s={timeout:e.TWO_MINUTES,unifiedStrategy:"interactive",revalidationStrategy:"balanced",strategy:"softFail",headers:{presets:["json"],autoDetectNetwork:true,requestClientHints:true},enrichedHeaders:{enabled:true,preset:"full",includeDevice:true,includeNetwork:true,includePlatform:true,includeCompliance:true,includePerformance:true,respectDoNotTrack:false,autoDetectRegion:true,regionalPreset:"global",useTimezone:true},networkAware:{enabled:false,adaptConfig:false,requestClientHints:false},tracking:{enabled:true,operations:true,events:true,performanceMode:"full",queueStrategy:"immediate",eventStrategy:"immediate",telemetry:false},retryStrategy:"conservative",encryption:{enabled:false,algorithm:"AES-GCM",autoDecrypt:true,target:["all"],key:void 0,fields:["*.email","*.ssn","*.taxId","*.nationalId","*.passport","*.driverLicense","*.governmentId","*.phone","*.phoneNumber","*.mobile","*.telephone","*.address.street","*.address.line1","*.address.line2","*.postalCode","*.zipCode","*.cardNumber","*.creditCard","*.debitCard","*.cvv","*.cvc","*.iban","*.accountNumber","*.routingNumber","*.swiftCode","*.sortCode","*.password","*.apiKey","*.secret","*.token","*.accessToken","*.refreshToken","*.privateKey","*.secretKey","*.wallet","*.walletAddress","*.mnemonic","*.seedPhrase","*.privateKeyHex","*.medicalRecord","*.medicalRecordNumber","*.healthInfo","*.diagnosis","*.prescription","*.healthInsurance","*.fingerprint","*.faceId","*.biometric","*.birthDate","*.dateOfBirth","*.dob","*.ipAddress","*.ip"]}};var T={baseURL:"",timeout:e.THIRTY_SECONDS,retry:{attempts:3,delay:e.SECOND,maxDelay:e.THIRTY_SECONDS,backoff:1.5},cache:{ttl:60,stale:300},headers:{"Content-Type":"application/json",Accept:"application/json"},strategy:"softFail"},l={enrichedHeaders:{enabled:true,preset:"standard"}};exports.DEFAULT_API_CLIENT_OPTIONS=l;exports.DEFAULT_API_CONFIG=T;exports.DEVELOPMENT_CONFIG=s;exports.PRODUCTION_CONFIG=i;exports.STAGING_CONFIG=o;//# sourceMappingURL=index.cjs.map
|
|
3
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/time/constants.ts","../../src/api/environments.ts","../../src/api/package/defaults.ts"],"names":["TIME_CONSTANTS","PRODUCTION_CONFIG","STAGING_CONFIG","DEVELOPMENT_CONFIG","DEFAULT_API_CONFIG","DEFAULT_API_CLIENT_OPTIONS"],"mappings":";AAYO,IAAMA,CAAAA,CAAiB,CAU5B,OAAQ,GAAA,CAqHR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file":"index.cjs","sourcesContent":["/**\n * Time-related Constants\n *\n * Common time values and durations used throughout the application\n * for timeouts, delays, caching, and other time-based operations.\n *\n * @module time/constants\n */\n\n/**\n * Time conversion and duration constants\n */\nexport const TIME_CONSTANTS = {\n // Time unit conversions (in milliseconds)\n /**\n * One millisecond in milliseconds\n */\n MILLISECOND: 1,\n\n /**\n * One second in milliseconds\n */\n SECOND: 1000,\n\n /**\n * One minute in milliseconds\n */\n MINUTE: 60000,\n\n /**\n * One hour in milliseconds\n */\n HOUR: 3600000,\n\n /**\n * One day in milliseconds\n */\n DAY: 86400000,\n\n /**\n * One week in milliseconds\n */\n WEEK: 604800000,\n\n /**\n * One month in milliseconds (30 days average)\n */\n MONTH: 2592000000,\n\n /**\n * One year in milliseconds (365 days)\n */\n YEAR: 31536000000,\n\n // Time unit ratios\n /**\n * Number of milliseconds in one second\n */\n MILLISECONDS_PER_SECOND: 1000,\n\n /**\n * Number of seconds in one minute\n */\n SECONDS_PER_MINUTE: 60,\n\n /**\n * Number of minutes in one hour\n */\n MINUTES_PER_HOUR: 60,\n\n /**\n * Number of hours in one day\n */\n HOURS_PER_DAY: 24,\n\n /**\n * Number of days in one week\n */\n DAYS_PER_WEEK: 7,\n\n /**\n * Number of days in one month (average)\n */\n DAYS_PER_MONTH: 30,\n\n /**\n * Number of days in one year\n */\n DAYS_PER_YEAR: 365,\n\n /**\n * Number of weeks in one year\n */\n WEEKS_PER_YEAR: 52,\n\n /**\n * Number of months in one year\n */\n MONTHS_PER_YEAR: 12,\n\n // Common durations in milliseconds\n /**\n * 100 milliseconds\n */\n HUNDRED_MS: 100,\n\n /**\n * 250 milliseconds\n */\n QUARTER_SECOND: 250,\n\n /**\n * 500 milliseconds (half second)\n */\n HALF_SECOND: 500,\n\n /**\n * 2 seconds in milliseconds\n */\n TWO_SECONDS: 2000,\n\n /**\n * 3 seconds in milliseconds\n */\n THREE_SECONDS: 3000,\n\n /**\n * 5 seconds in milliseconds\n */\n FIVE_SECONDS: 5000,\n\n /**\n * 10 seconds in milliseconds\n */\n TEN_SECONDS: 10000,\n\n /**\n * 30 seconds in milliseconds\n */\n THIRTY_SECONDS: 30000,\n\n /**\n * 2 minutes in milliseconds\n */\n TWO_MINUTES: 120000,\n\n /**\n * 5 minutes in milliseconds\n */\n FIVE_MINUTES: 300000,\n\n /**\n * 10 minutes in milliseconds\n */\n TEN_MINUTES: 600000,\n\n /**\n * 15 minutes in milliseconds\n */\n FIFTEEN_MINUTES: 900000,\n\n /**\n * 30 minutes in milliseconds\n */\n THIRTY_MINUTES: 1800000,\n\n /**\n * 1 hour in milliseconds\n */\n ONE_HOUR: 3600000,\n\n /**\n * 2 hours in milliseconds\n */\n TWO_HOURS: 7200000,\n\n /**\n * 6 hours in milliseconds\n */\n SIX_HOURS: 21600000,\n\n /**\n * 12 hours in milliseconds\n */\n TWELVE_HOURS: 43200000,\n\n // Default values\n /**\n * Default timeout duration in milliseconds (5 seconds)\n */\n DEFAULT_TIMEOUT: 5000,\n\n /**\n * Default short timeout in milliseconds (1 second)\n */\n DEFAULT_SHORT_TIMEOUT: 1000,\n\n /**\n * Default long timeout in milliseconds (30 seconds)\n */\n DEFAULT_LONG_TIMEOUT: 30000,\n\n /**\n * Default retry delay in milliseconds (100ms)\n */\n DEFAULT_RETRY_DELAY: 100,\n\n /**\n * Default exponential backoff base delay in milliseconds (1 second)\n */\n DEFAULT_BACKOFF_BASE: 1000,\n\n /**\n * Default maximum backoff delay in milliseconds (30 seconds)\n */\n DEFAULT_MAX_BACKOFF: 30000,\n\n /**\n * Default number of retry attempts\n */\n DEFAULT_RETRY_ATTEMPTS: 3,\n\n /**\n * Default debounce delay in milliseconds (50ms)\n */\n DEFAULT_DEBOUNCE_DELAY: 50,\n\n /**\n * Default throttle delay in milliseconds (100ms)\n */\n DEFAULT_THROTTLE_DELAY: 100,\n\n /**\n * Default animation frame duration in milliseconds (~60fps)\n */\n DEFAULT_ANIMATION_FRAME: 16.67,\n\n /**\n * Default transition duration in milliseconds (300ms)\n */\n DEFAULT_TRANSITION_DURATION: 300,\n\n /**\n * Default cache time-to-live in seconds (5 minutes)\n */\n DEFAULT_CACHE_TTL: 300,\n\n /**\n * Default short cache TTL in seconds (1 minute)\n */\n DEFAULT_SHORT_CACHE_TTL: 60,\n\n /**\n * Default long cache TTL in seconds (1 hour)\n */\n DEFAULT_LONG_CACHE_TTL: 3600,\n\n /**\n * Default session timeout in milliseconds (30 minutes)\n */\n DEFAULT_SESSION_TIMEOUT: 1800000,\n\n /**\n * Default idle timeout in milliseconds (15 minutes)\n */\n DEFAULT_IDLE_TIMEOUT: 900000,\n\n /**\n * Default poll interval in milliseconds (5 seconds)\n */\n DEFAULT_POLL_INTERVAL: 5000,\n\n /**\n * Default heartbeat interval in milliseconds (30 seconds)\n */\n DEFAULT_HEARTBEAT_INTERVAL: 30000,\n\n // Network and ports\n /**\n * Default port number for servers\n */\n DEFAULT_PORT: 3000,\n\n /**\n * Default HTTP port\n */\n HTTP_PORT: 80,\n\n /**\n * Default HTTPS port\n */\n HTTPS_PORT: 443,\n\n /**\n * Default WebSocket port\n */\n WEBSOCKET_PORT: 8080,\n\n /**\n * Default database port (PostgreSQL)\n */\n DATABASE_PORT: 5432,\n\n /**\n * Default Redis port\n */\n REDIS_PORT: 6379,\n\n // WebSocket specific\n /**\n * WebSocket normal closure code\n */\n WEBSOCKET_CLOSE_NORMAL: 1000,\n\n /**\n * WebSocket going away code\n */\n WEBSOCKET_CLOSE_GOING_AWAY: 1001,\n\n /**\n * WebSocket protocol error code\n */\n WEBSOCKET_CLOSE_PROTOCOL_ERROR: 1002,\n\n /**\n * WebSocket unsupported data code\n */\n WEBSOCKET_CLOSE_UNSUPPORTED: 1003,\n\n /**\n * WebSocket abnormal closure code\n */\n WEBSOCKET_CLOSE_ABNORMAL: 1006,\n\n /**\n * WebSocket retry delay in milliseconds (500ms)\n */\n WEBSOCKET_RETRY_DELAY: 500,\n\n /**\n * WebSocket ping interval in milliseconds (30 seconds)\n */\n WEBSOCKET_PING_INTERVAL: 30000,\n\n /**\n * WebSocket reconnect delay in milliseconds (1 second)\n */\n WEBSOCKET_RECONNECT_DELAY: 1000,\n\n /**\n * WebSocket max reconnect delay in milliseconds (30 seconds)\n */\n WEBSOCKET_MAX_RECONNECT_DELAY: 30000,\n} as const;\n\n/**\n * Type for time constant values\n */\nexport type TimeConstant = (typeof TIME_CONSTANTS)[keyof typeof TIME_CONSTANTS];\n","/**\n * API Client Environment Configurations\n *\n * Provides environment-specific default configurations for the API client service.\n * These configs are optimized for production, staging, and development environments.\n *\n * @module config/api/environments\n */\n\nimport type { ApiConfig, HeaderPresetName, EncryptionKey } from '@plyaz/types/api';\nimport { TIME_CONSTANTS } from '../time';\n\n/**\n * Production configuration for the API client service.\n * Optimized for reliability, security, and performance in production environments.\n *\n * Key Production Features:\n * - Encryption REQUIRED (enforced)\n * - Minimal headers (privacy-focused)\n * - Network adaptation enabled (auto-adjust to conditions)\n * - Balanced telemetry (monitoring without overhead)\n * - Aggressive retry strategy (5 attempts with exponential backoff)\n * - Uses retry PRESET strings instead of hardcoded values\n */\nexport const PRODUCTION_CONFIG: Partial<ApiConfig> = {\n // Core settings\n timeout: TIME_CONSTANTS.THIRTY_SECONDS,\n\n // Unified strategy - includes cache, retry, performance strategies\n // 'interactive' = standard cache + standard retry + balanced performance\n unifiedStrategy: 'interactive',\n\n // Revalidation strategy - NOT covered by unifiedStrategy\n // Controls when to revalidate cached data (SWR pattern)\n revalidationStrategy: 'balanced', // Revalidate on focus, network reconnect\n\n // Error handling strategy - return {data, error} without throwing\n strategy: 'softFail',\n\n // Default JSON headers for most API interactions\n headers: {\n presets: ['json' as unknown as HeaderPresetName] as const, // Sets Accept and Content-Type to application/json\n autoDetectNetwork: true,\n requestClientHints: false,\n },\n\n // Enriched headers - minimal preset with GLOBAL compliance\n // Adds ~5-7 headers: platform, app version, timezone, locale, network type\n // Privacy-conscious: respects DNT, no device fingerprinting\n // Global compliance: covers GDPR, CCPA, PIPL, APPI automatically\n enrichedHeaders: {\n enabled: true,\n preset: 'standard', // standard context headers\n includeDevice: false, // No device fingerprinting (privacy)\n includeNetwork: true, // Network type (wifi/cellular/etc)\n includePlatform: true, // Platform (web/ios/android)\n includeCompliance: true, // Timezone, locale for regional compliance\n respectDoNotTrack: true, // Honor DNT header (GDPR/CCPA)\n autoDetectRegion: true, // Auto-detect region from timezone\n regionalPreset: 'global', // Global compliance (GDPR+CCPA+PIPL+APPI)\n useTimezone: true, // Use timezone for region detection\n },\n\n // Network awareness - monitoring enabled, WITH auto-adaptation\n // Adjusts strategies based on network quality\n networkAware: {\n enabled: true, // Enable network quality monitoring\n adaptConfig: true, // Auto-adjust strategies based on network\n requestClientHints: false, // Don't request extra browser hints\n },\n\n // Tracking configuration - balanced for production (monitoring without overhead)\n tracking: {\n enabled: true,\n operations: true,\n events: true,\n performanceMode: 'minimal', // Not 'full' - avoid overhead in prod\n queueStrategy: 'batch',\n eventStrategy: 'queued',\n telemetry: true, // Send to monitoring in production\n },\n\n // Retry strategy - use preset instead of hardcoded values\n retryStrategy: 'aggressive', // More retries for production reliability (5 attempts)\n // Note: unifiedStrategy 'interactive' already includes 'standard' retry (3 attempts)\n // This overrides it for production to be more aggressive\n\n // Encryption - ENABLED by default for regulatory compliance (GDPR, CCPA, PIPL, etc.)\n // Encrypts common sensitive fields automatically\n // User MUST provide encryption key via init() - defaults don't include key\n encryption: {\n enabled: true,\n algorithm: 'AES-GCM', // Industry standard, FIPS 140-2 compliant\n autoDecrypt: true, // Auto-decrypt responses\n target: ['all'], // Encrypt in request body and query params\n // Key will be provided by user during initialization\n key: undefined as unknown as EncryptionKey, // Placeholder - user must provide via apiConfig\n\n // Common sensitive field patterns (uses glob matching)\n // Covers: email, SSN, phone, card numbers, passwords, tokens, wallet addresses\n fields: [\n // Personal Identifiable Information (PII) - GDPR Art. 9\n '*.email',\n '*.ssn',\n '*.taxId',\n '*.nationalId',\n '*.passport',\n '*.driverLicense',\n '*.governmentId',\n\n // Contact Information - GDPR Art. 4(1)\n '*.phone',\n '*.phoneNumber',\n '*.mobile',\n '*.telephone',\n '*.address.street',\n '*.address.line1',\n '*.address.line2',\n '*.postalCode',\n '*.zipCode',\n\n // Financial Information - PCI-DSS Req 3.4\n '*.cardNumber',\n '*.creditCard',\n '*.debitCard',\n '*.cvv',\n '*.cvc',\n '*.iban',\n '*.accountNumber',\n '*.routingNumber',\n '*.swiftCode',\n '*.sortCode',\n\n // Authentication Credentials - OWASP ASVS 2.1\n '*.password',\n '*.apiKey',\n '*.secret',\n '*.token',\n '*.accessToken',\n '*.refreshToken',\n '*.privateKey',\n '*.secretKey',\n\n // Crypto/Blockchain - Web3 security\n '*.wallet',\n '*.walletAddress',\n '*.mnemonic',\n '*.seedPhrase',\n '*.privateKeyHex',\n\n // Health Information - HIPAA §164.312(a)(2)(iv)\n '*.medicalRecord',\n '*.medicalRecordNumber',\n '*.healthInfo',\n '*.diagnosis',\n '*.prescription',\n '*.healthInsurance',\n\n // Biometric Data - GDPR Art. 9(1)\n '*.fingerprint',\n '*.faceId',\n '*.biometric',\n\n // Date of Birth - Age verification\n '*.birthDate',\n '*.dateOfBirth',\n '*.dob',\n\n // IP Addresses - GDPR considers PII\n '*.ipAddress',\n '*.ip',\n ],\n\n // Key provider - MUST be provided by user via init()\n // Supports three patterns:\n //\n // 1. EncryptionKey object (with metadata):\n // key: {\n // id: 'prod-key-v1',\n // key: process.env.ENCRYPTION_KEY!,\n // algorithm: 'AES-GCM',\n // format: 'raw'\n // }\n //\n // 2. KeyProvider function (for key rotation):\n // key: async (context) => {\n // const keyId = await getActiveKeyId();\n // const key = await keyManagementService.getKey(keyId);\n // return { id: keyId, key, algorithm: 'AES-GCM' };\n // }\n //\n // 3. Simple string (auto-converted to EncryptionKey):\n // key: process.env.ENCRYPTION_KEY!\n //\n // NO default key - user provides via init()\n },\n};\n\n/**\n * Staging configuration for the API client service.\n * ALIGNED with production for accurate pre-production testing.\n * Only differences: standard headers for debugging, full performance tracking.\n *\n * Key Staging Features:\n * - Encryption ENABLED (same as production)\n * - Standard headers (slightly more context for debugging than prod)\n * - Full performance tracking (catch issues before production)\n * - Same retry strategy as production (aggressive)\n * - Same network adaptation as production\n */\nexport const STAGING_CONFIG: Partial<ApiConfig> = {\n // Core settings - SAME AS PRODUCTION\n timeout: TIME_CONSTANTS.THIRTY_SECONDS,\n\n // Unified strategy - SAME AS PRODUCTION\n unifiedStrategy: 'interactive',\n\n // Revalidation strategy - SAME AS PRODUCTION\n revalidationStrategy: 'balanced',\n\n // Error handling strategy - SAME AS PRODUCTION\n strategy: 'softFail',\n\n // Headers preset - SAME AS PRODUCTION\n headers: {\n presets: ['json' as unknown as HeaderPresetName] as const,\n autoDetectNetwork: true,\n requestClientHints: false, // Same as prod\n },\n\n // Enriched headers - SLIGHTLY MORE than prod for debugging\n enrichedHeaders: {\n enabled: true,\n preset: 'standard', // One level up from prod's 'minimal'\n includeDevice: true, // Include device info for debugging\n includeNetwork: true,\n includePlatform: true,\n includeCompliance: true,\n respectDoNotTrack: true, // Same as prod\n autoDetectRegion: true,\n regionalPreset: 'global', // Same as prod\n useTimezone: true,\n },\n\n // Network awareness - SAME AS PRODUCTION\n networkAware: {\n enabled: true,\n adaptConfig: true, // Same as prod\n requestClientHints: false, // Same as prod\n },\n\n // Tracking configuration - FULL in staging (only difference from prod)\n tracking: {\n enabled: true,\n operations: true,\n events: true,\n performanceMode: 'full', // Full tracking to catch issues (prod uses 'balanced')\n queueStrategy: 'batch',\n eventStrategy: 'queued',\n telemetry: true, // Same as prod\n },\n\n // Retry strategy - SAME AS PRODUCTION\n retryStrategy: 'aggressive', // Same aggressive retries as production\n // Test production retry behavior in staging\n\n // Encryption - SAME AS PRODUCTION (REQUIRED)\n encryption: {\n enabled: true, // REQUIRED in staging (same as prod)\n algorithm: 'AES-GCM',\n autoDecrypt: true,\n target: ['all'],\n key: undefined as unknown as EncryptionKey, // Placeholder - user must provide via apiConfig\n fields: [\n // Same 50+ fields as production\n '*.email',\n '*.ssn',\n '*.taxId',\n '*.nationalId',\n '*.passport',\n '*.driverLicense',\n '*.governmentId',\n '*.phone',\n '*.phoneNumber',\n '*.mobile',\n '*.telephone',\n '*.address.street',\n '*.address.line1',\n '*.address.line2',\n '*.postalCode',\n '*.zipCode',\n '*.cardNumber',\n '*.creditCard',\n '*.debitCard',\n '*.cvv',\n '*.cvc',\n '*.iban',\n '*.accountNumber',\n '*.routingNumber',\n '*.swiftCode',\n '*.sortCode',\n '*.password',\n '*.apiKey',\n '*.secret',\n '*.token',\n '*.accessToken',\n '*.refreshToken',\n '*.privateKey',\n '*.secretKey',\n '*.wallet',\n '*.walletAddress',\n '*.mnemonic',\n '*.seedPhrase',\n '*.privateKeyHex',\n '*.medicalRecord',\n '*.medicalRecordNumber',\n '*.healthInfo',\n '*.diagnosis',\n '*.prescription',\n '*.healthInsurance',\n '*.fingerprint',\n '*.faceId',\n '*.biometric',\n '*.birthDate',\n '*.dateOfBirth',\n '*.dob',\n '*.ipAddress',\n '*.ip',\n ],\n },\n};\n\n/**\n * Development configuration for the API client service.\n * Optimized for debugging and fast feedback during development.\n *\n * Key Development Features:\n * - Encryption OPTIONAL (disable for easier debugging)\n * - Full headers (all context for debugging)\n * - No network adaptation (consistent behavior)\n * - Minimal retries (fail fast to see errors quickly)\n * - Full performance tracking (optimize during development)\n * - Longer timeout (allow for debugging/breakpoints)\n */\nexport const DEVELOPMENT_CONFIG: Partial<ApiConfig> = {\n // Core settings - longer timeout for debugging\n timeout: TIME_CONSTANTS.TWO_MINUTES,\n\n // Unified strategy - interactive works well for dev\n unifiedStrategy: 'interactive',\n\n // Revalidation strategy\n revalidationStrategy: 'balanced',\n\n // Error handling strategy\n strategy: 'softFail',\n\n // Full headers preset for maximum debugging context\n headers: {\n presets: ['json' as unknown as HeaderPresetName] as const,\n autoDetectNetwork: true,\n requestClientHints: true,\n },\n\n // Enriched headers - FULL preset with all context\n enrichedHeaders: {\n enabled: true,\n preset: 'full', // All possible headers for debugging\n includeDevice: true, // Include everything\n includeNetwork: true,\n includePlatform: true,\n includeCompliance: true,\n includePerformance: true, // Performance hints\n respectDoNotTrack: false, // Ignore DNT in dev\n autoDetectRegion: true,\n regionalPreset: 'global',\n useTimezone: true,\n },\n\n // Network awareness - DISABLED (consistent behavior in dev)\n networkAware: {\n enabled: false, // Don't adapt config in dev\n adaptConfig: false,\n requestClientHints: false,\n },\n\n // Tracking configuration - FULL to see everything\n tracking: {\n enabled: true,\n operations: true,\n events: true,\n performanceMode: 'full', // Track everything in dev\n queueStrategy: 'immediate', // Process immediately (no batching)\n eventStrategy: 'immediate', // Immediate events for debugging\n telemetry: false, // Don't send to monitoring from dev\n },\n\n // Retry strategy - MINIMAL (fail fast to see errors)\n retryStrategy: 'conservative', // Minimal retries (1 attempt) to see errors immediately\n // Note: unifiedStrategy 'interactive' includes 'standard' retry (3 attempts)\n // This overrides it for development to fail faster\n\n // Encryption - DISABLED by default but with SAME fields as production\n // This allows developers to test encryption locally when needed\n encryption: {\n enabled: false, // Disabled in dev by default (enable via apiConfig when testing)\n algorithm: 'AES-GCM',\n autoDecrypt: true,\n target: ['all'],\n\n // NO default key in development - encryption is disabled\n // To test encryption locally, pass key via apiConfig:\n // encryption: {\n // enabled: true,\n // key: \"your-test-key\" // Auto-converted to EncryptionKey\n // // Or use EncryptionKey object:\n // // key: { id: \"test-1\", key: \"your-key\", algorithm: \"AES-GCM\" }\n // }\n key: undefined as unknown as EncryptionKey, // Placeholder - encryption disabled in development\n\n // Same 50+ fields as production for testing\n fields: [\n '*.email',\n '*.ssn',\n '*.taxId',\n '*.nationalId',\n '*.passport',\n '*.driverLicense',\n '*.governmentId',\n '*.phone',\n '*.phoneNumber',\n '*.mobile',\n '*.telephone',\n '*.address.street',\n '*.address.line1',\n '*.address.line2',\n '*.postalCode',\n '*.zipCode',\n '*.cardNumber',\n '*.creditCard',\n '*.debitCard',\n '*.cvv',\n '*.cvc',\n '*.iban',\n '*.accountNumber',\n '*.routingNumber',\n '*.swiftCode',\n '*.sortCode',\n '*.password',\n '*.apiKey',\n '*.secret',\n '*.token',\n '*.accessToken',\n '*.refreshToken',\n '*.privateKey',\n '*.secretKey',\n '*.wallet',\n '*.walletAddress',\n '*.mnemonic',\n '*.seedPhrase',\n '*.privateKeyHex',\n '*.medicalRecord',\n '*.medicalRecordNumber',\n '*.healthInfo',\n '*.diagnosis',\n '*.prescription',\n '*.healthInsurance',\n '*.fingerprint',\n '*.faceId',\n '*.biometric',\n '*.birthDate',\n '*.dateOfBirth',\n '*.dob',\n '*.ipAddress',\n '*.ip',\n ],\n },\n};\n","import type { ApiClientOptions, ApiConfig } from '@plyaz/types/api';\nimport { TIME_CONSTANTS } from '../../time/constants';\n\n/**\n * Default configuration for API clients\n *\n * These defaults provide sensible out-of-the-box behavior:\n * - 30 second timeout for requests\n * - 3 retry attempts with exponential backoff\n * - 60 second cache TTL with 5 minute stale time\n * - Standard JSON content-type headers\n * - Soft-fail error strategy (returns error without throwing)\n */\nexport const DEFAULT_API_CONFIG: ApiConfig = {\n baseURL: '',\n timeout: TIME_CONSTANTS.THIRTY_SECONDS,\n retry: {\n attempts: 3,\n delay: TIME_CONSTANTS.SECOND,\n maxDelay: TIME_CONSTANTS.THIRTY_SECONDS,\n backoff: 1.5,\n },\n cache: {\n ttl: 60,\n stale: 300,\n },\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n },\n strategy: 'softFail',\n};\n\n/**\n * Default client options with global compliance enabled by default\n *\n * This ensures maximum privacy protection out of the box:\n * - Enriched headers enabled with standard preset\n * - Global compliance level (minimum data collection)\n */\nexport const DEFAULT_API_CLIENT_OPTIONS: Partial<ApiClientOptions> = {\n enrichedHeaders: {\n enabled: true,\n preset: 'standard', // Uses 'global' compliance by default\n },\n};\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @plyaz package - Built with tsup
|
|
2
|
+
var e={SECOND:1e3,THIRTY_SECONDS:3e4,TWO_MINUTES:12e4};var i={timeout:e.THIRTY_SECONDS,unifiedStrategy:"interactive",revalidationStrategy:"balanced",strategy:"softFail",headers:{presets:["json"],autoDetectNetwork:true,requestClientHints:false},enrichedHeaders:{enabled:true,preset:"standard",includeDevice:false,includeNetwork:true,includePlatform:true,includeCompliance:true,respectDoNotTrack:true,autoDetectRegion:true,regionalPreset:"global",useTimezone:true},networkAware:{enabled:true,adaptConfig:true,requestClientHints:false},tracking:{enabled:true,operations:true,events:true,performanceMode:"minimal",queueStrategy:"batch",eventStrategy:"queued",telemetry:true},retryStrategy:"aggressive",encryption:{enabled:true,algorithm:"AES-GCM",autoDecrypt:true,target:["all"],key:void 0,fields:["*.email","*.ssn","*.taxId","*.nationalId","*.passport","*.driverLicense","*.governmentId","*.phone","*.phoneNumber","*.mobile","*.telephone","*.address.street","*.address.line1","*.address.line2","*.postalCode","*.zipCode","*.cardNumber","*.creditCard","*.debitCard","*.cvv","*.cvc","*.iban","*.accountNumber","*.routingNumber","*.swiftCode","*.sortCode","*.password","*.apiKey","*.secret","*.token","*.accessToken","*.refreshToken","*.privateKey","*.secretKey","*.wallet","*.walletAddress","*.mnemonic","*.seedPhrase","*.privateKeyHex","*.medicalRecord","*.medicalRecordNumber","*.healthInfo","*.diagnosis","*.prescription","*.healthInsurance","*.fingerprint","*.faceId","*.biometric","*.birthDate","*.dateOfBirth","*.dob","*.ipAddress","*.ip"]}},o={timeout:e.THIRTY_SECONDS,unifiedStrategy:"interactive",revalidationStrategy:"balanced",strategy:"softFail",headers:{presets:["json"],autoDetectNetwork:true,requestClientHints:false},enrichedHeaders:{enabled:true,preset:"standard",includeDevice:true,includeNetwork:true,includePlatform:true,includeCompliance:true,respectDoNotTrack:true,autoDetectRegion:true,regionalPreset:"global",useTimezone:true},networkAware:{enabled:true,adaptConfig:true,requestClientHints:false},tracking:{enabled:true,operations:true,events:true,performanceMode:"full",queueStrategy:"batch",eventStrategy:"queued",telemetry:true},retryStrategy:"aggressive",encryption:{enabled:true,algorithm:"AES-GCM",autoDecrypt:true,target:["all"],key:void 0,fields:["*.email","*.ssn","*.taxId","*.nationalId","*.passport","*.driverLicense","*.governmentId","*.phone","*.phoneNumber","*.mobile","*.telephone","*.address.street","*.address.line1","*.address.line2","*.postalCode","*.zipCode","*.cardNumber","*.creditCard","*.debitCard","*.cvv","*.cvc","*.iban","*.accountNumber","*.routingNumber","*.swiftCode","*.sortCode","*.password","*.apiKey","*.secret","*.token","*.accessToken","*.refreshToken","*.privateKey","*.secretKey","*.wallet","*.walletAddress","*.mnemonic","*.seedPhrase","*.privateKeyHex","*.medicalRecord","*.medicalRecordNumber","*.healthInfo","*.diagnosis","*.prescription","*.healthInsurance","*.fingerprint","*.faceId","*.biometric","*.birthDate","*.dateOfBirth","*.dob","*.ipAddress","*.ip"]}},s={timeout:e.TWO_MINUTES,unifiedStrategy:"interactive",revalidationStrategy:"balanced",strategy:"softFail",headers:{presets:["json"],autoDetectNetwork:true,requestClientHints:true},enrichedHeaders:{enabled:true,preset:"full",includeDevice:true,includeNetwork:true,includePlatform:true,includeCompliance:true,includePerformance:true,respectDoNotTrack:false,autoDetectRegion:true,regionalPreset:"global",useTimezone:true},networkAware:{enabled:false,adaptConfig:false,requestClientHints:false},tracking:{enabled:true,operations:true,events:true,performanceMode:"full",queueStrategy:"immediate",eventStrategy:"immediate",telemetry:false},retryStrategy:"conservative",encryption:{enabled:false,algorithm:"AES-GCM",autoDecrypt:true,target:["all"],key:void 0,fields:["*.email","*.ssn","*.taxId","*.nationalId","*.passport","*.driverLicense","*.governmentId","*.phone","*.phoneNumber","*.mobile","*.telephone","*.address.street","*.address.line1","*.address.line2","*.postalCode","*.zipCode","*.cardNumber","*.creditCard","*.debitCard","*.cvv","*.cvc","*.iban","*.accountNumber","*.routingNumber","*.swiftCode","*.sortCode","*.password","*.apiKey","*.secret","*.token","*.accessToken","*.refreshToken","*.privateKey","*.secretKey","*.wallet","*.walletAddress","*.mnemonic","*.seedPhrase","*.privateKeyHex","*.medicalRecord","*.medicalRecordNumber","*.healthInfo","*.diagnosis","*.prescription","*.healthInsurance","*.fingerprint","*.faceId","*.biometric","*.birthDate","*.dateOfBirth","*.dob","*.ipAddress","*.ip"]}};var T={baseURL:"",timeout:e.THIRTY_SECONDS,retry:{attempts:3,delay:e.SECOND,maxDelay:e.THIRTY_SECONDS,backoff:1.5},cache:{ttl:60,stale:300},headers:{"Content-Type":"application/json",Accept:"application/json"},strategy:"softFail"},l={enrichedHeaders:{enabled:true,preset:"standard"}};export{l as DEFAULT_API_CLIENT_OPTIONS,T as DEFAULT_API_CONFIG,s as DEVELOPMENT_CONFIG,i as PRODUCTION_CONFIG,o as STAGING_CONFIG};//# sourceMappingURL=index.mjs.map
|
|
3
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/time/constants.ts","../../src/api/environments.ts","../../src/api/package/defaults.ts"],"names":["TIME_CONSTANTS","PRODUCTION_CONFIG","STAGING_CONFIG","DEVELOPMENT_CONFIG","DEFAULT_API_CONFIG","DEFAULT_API_CLIENT_OPTIONS"],"mappings":";AAYO,IAAMA,CAAAA,CAAiB,CAU5B,OAAQ,GAAA,CAqHR,cAAA,CAAgB,GAAA,CAKhB,WAAA,CAAa,IAiNf,ECzUO,IAAMC,CAAAA,CAAwC,CAEnD,OAAA,CAASD,EAAe,cAAA,CAIxB,eAAA,CAAiB,aAAA,CAIjB,oBAAA,CAAsB,WAGtB,QAAA,CAAU,UAAA,CAGV,OAAA,CAAS,CACP,QAAS,CAAC,MAAqC,CAAA,CAC/C,iBAAA,CAAmB,IAAA,CACnB,kBAAA,CAAoB,KACtB,CAAA,CAMA,gBAAiB,CACf,OAAA,CAAS,IAAA,CACT,MAAA,CAAQ,WACR,aAAA,CAAe,KAAA,CACf,cAAA,CAAgB,IAAA,CAChB,gBAAiB,IAAA,CACjB,iBAAA,CAAmB,IAAA,CACnB,iBAAA,CAAmB,KACnB,gBAAA,CAAkB,IAAA,CAClB,cAAA,CAAgB,QAAA,CAChB,YAAa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CACA,UAAA,CACA,UAAA,CACA,SAAA,CACA,eAAA,CACA,iBACA,cAAA,CACA,aAAA,CACA,UAAA,CACA,iBAAA,CACA,aACA,cAAA,CACA,iBAAA,CACA,iBAAA,CACA,uBAAA,CACA,eACA,aAAA,CACA,gBAAA,CACA,mBAAA,CACA,eAAA,CACA,WACA,aAAA,CACA,aAAA,CACA,eAAA,CACA,OAAA,CACA,cACA,MACF,CACF,CACF,MChdaI,CAAAA,CAAgC,CAC3C,OAAA,CAAS,EAAA,CACT,QAASJ,CAAAA,CAAe,cAAA,CACxB,KAAA,CAAO,CACL,SAAU,CAAA,CACV,KAAA,CAAOA,CAAAA,CAAe,MAAA,CACtB,SAAUA,CAAAA,CAAe,cAAA,CACzB,OAAA,CAAS,GACX,EACA,KAAA,CAAO,CACL,GAAA,CAAK,EAAA,CACL,MAAO,GACT,CAAA,CACA,OAAA,CAAS,CACP,eAAgB,kBAAA,CAChB,MAAA,CAAQ,kBACV,CAAA,CACA,SAAU,UACZ,CAAA,CASaK,CAAAA,CAAwD,CACnE,gBAAiB,CACf,OAAA,CAAS,IAAA,CACT,MAAA,CAAQ,UACV,CACF","file":"index.mjs","sourcesContent":["/**\n * Time-related Constants\n *\n * Common time values and durations used throughout the application\n * for timeouts, delays, caching, and other time-based operations.\n *\n * @module time/constants\n */\n\n/**\n * Time conversion and duration constants\n */\nexport const TIME_CONSTANTS = {\n // Time unit conversions (in milliseconds)\n /**\n * One millisecond in milliseconds\n */\n MILLISECOND: 1,\n\n /**\n * One second in milliseconds\n */\n SECOND: 1000,\n\n /**\n * One minute in milliseconds\n */\n MINUTE: 60000,\n\n /**\n * One hour in milliseconds\n */\n HOUR: 3600000,\n\n /**\n * One day in milliseconds\n */\n DAY: 86400000,\n\n /**\n * One week in milliseconds\n */\n WEEK: 604800000,\n\n /**\n * One month in milliseconds (30 days average)\n */\n MONTH: 2592000000,\n\n /**\n * One year in milliseconds (365 days)\n */\n YEAR: 31536000000,\n\n // Time unit ratios\n /**\n * Number of milliseconds in one second\n */\n MILLISECONDS_PER_SECOND: 1000,\n\n /**\n * Number of seconds in one minute\n */\n SECONDS_PER_MINUTE: 60,\n\n /**\n * Number of minutes in one hour\n */\n MINUTES_PER_HOUR: 60,\n\n /**\n * Number of hours in one day\n */\n HOURS_PER_DAY: 24,\n\n /**\n * Number of days in one week\n */\n DAYS_PER_WEEK: 7,\n\n /**\n * Number of days in one month (average)\n */\n DAYS_PER_MONTH: 30,\n\n /**\n * Number of days in one year\n */\n DAYS_PER_YEAR: 365,\n\n /**\n * Number of weeks in one year\n */\n WEEKS_PER_YEAR: 52,\n\n /**\n * Number of months in one year\n */\n MONTHS_PER_YEAR: 12,\n\n // Common durations in milliseconds\n /**\n * 100 milliseconds\n */\n HUNDRED_MS: 100,\n\n /**\n * 250 milliseconds\n */\n QUARTER_SECOND: 250,\n\n /**\n * 500 milliseconds (half second)\n */\n HALF_SECOND: 500,\n\n /**\n * 2 seconds in milliseconds\n */\n TWO_SECONDS: 2000,\n\n /**\n * 3 seconds in milliseconds\n */\n THREE_SECONDS: 3000,\n\n /**\n * 5 seconds in milliseconds\n */\n FIVE_SECONDS: 5000,\n\n /**\n * 10 seconds in milliseconds\n */\n TEN_SECONDS: 10000,\n\n /**\n * 30 seconds in milliseconds\n */\n THIRTY_SECONDS: 30000,\n\n /**\n * 2 minutes in milliseconds\n */\n TWO_MINUTES: 120000,\n\n /**\n * 5 minutes in milliseconds\n */\n FIVE_MINUTES: 300000,\n\n /**\n * 10 minutes in milliseconds\n */\n TEN_MINUTES: 600000,\n\n /**\n * 15 minutes in milliseconds\n */\n FIFTEEN_MINUTES: 900000,\n\n /**\n * 30 minutes in milliseconds\n */\n THIRTY_MINUTES: 1800000,\n\n /**\n * 1 hour in milliseconds\n */\n ONE_HOUR: 3600000,\n\n /**\n * 2 hours in milliseconds\n */\n TWO_HOURS: 7200000,\n\n /**\n * 6 hours in milliseconds\n */\n SIX_HOURS: 21600000,\n\n /**\n * 12 hours in milliseconds\n */\n TWELVE_HOURS: 43200000,\n\n // Default values\n /**\n * Default timeout duration in milliseconds (5 seconds)\n */\n DEFAULT_TIMEOUT: 5000,\n\n /**\n * Default short timeout in milliseconds (1 second)\n */\n DEFAULT_SHORT_TIMEOUT: 1000,\n\n /**\n * Default long timeout in milliseconds (30 seconds)\n */\n DEFAULT_LONG_TIMEOUT: 30000,\n\n /**\n * Default retry delay in milliseconds (100ms)\n */\n DEFAULT_RETRY_DELAY: 100,\n\n /**\n * Default exponential backoff base delay in milliseconds (1 second)\n */\n DEFAULT_BACKOFF_BASE: 1000,\n\n /**\n * Default maximum backoff delay in milliseconds (30 seconds)\n */\n DEFAULT_MAX_BACKOFF: 30000,\n\n /**\n * Default number of retry attempts\n */\n DEFAULT_RETRY_ATTEMPTS: 3,\n\n /**\n * Default debounce delay in milliseconds (50ms)\n */\n DEFAULT_DEBOUNCE_DELAY: 50,\n\n /**\n * Default throttle delay in milliseconds (100ms)\n */\n DEFAULT_THROTTLE_DELAY: 100,\n\n /**\n * Default animation frame duration in milliseconds (~60fps)\n */\n DEFAULT_ANIMATION_FRAME: 16.67,\n\n /**\n * Default transition duration in milliseconds (300ms)\n */\n DEFAULT_TRANSITION_DURATION: 300,\n\n /**\n * Default cache time-to-live in seconds (5 minutes)\n */\n DEFAULT_CACHE_TTL: 300,\n\n /**\n * Default short cache TTL in seconds (1 minute)\n */\n DEFAULT_SHORT_CACHE_TTL: 60,\n\n /**\n * Default long cache TTL in seconds (1 hour)\n */\n DEFAULT_LONG_CACHE_TTL: 3600,\n\n /**\n * Default session timeout in milliseconds (30 minutes)\n */\n DEFAULT_SESSION_TIMEOUT: 1800000,\n\n /**\n * Default idle timeout in milliseconds (15 minutes)\n */\n DEFAULT_IDLE_TIMEOUT: 900000,\n\n /**\n * Default poll interval in milliseconds (5 seconds)\n */\n DEFAULT_POLL_INTERVAL: 5000,\n\n /**\n * Default heartbeat interval in milliseconds (30 seconds)\n */\n DEFAULT_HEARTBEAT_INTERVAL: 30000,\n\n // Network and ports\n /**\n * Default port number for servers\n */\n DEFAULT_PORT: 3000,\n\n /**\n * Default HTTP port\n */\n HTTP_PORT: 80,\n\n /**\n * Default HTTPS port\n */\n HTTPS_PORT: 443,\n\n /**\n * Default WebSocket port\n */\n WEBSOCKET_PORT: 8080,\n\n /**\n * Default database port (PostgreSQL)\n */\n DATABASE_PORT: 5432,\n\n /**\n * Default Redis port\n */\n REDIS_PORT: 6379,\n\n // WebSocket specific\n /**\n * WebSocket normal closure code\n */\n WEBSOCKET_CLOSE_NORMAL: 1000,\n\n /**\n * WebSocket going away code\n */\n WEBSOCKET_CLOSE_GOING_AWAY: 1001,\n\n /**\n * WebSocket protocol error code\n */\n WEBSOCKET_CLOSE_PROTOCOL_ERROR: 1002,\n\n /**\n * WebSocket unsupported data code\n */\n WEBSOCKET_CLOSE_UNSUPPORTED: 1003,\n\n /**\n * WebSocket abnormal closure code\n */\n WEBSOCKET_CLOSE_ABNORMAL: 1006,\n\n /**\n * WebSocket retry delay in milliseconds (500ms)\n */\n WEBSOCKET_RETRY_DELAY: 500,\n\n /**\n * WebSocket ping interval in milliseconds (30 seconds)\n */\n WEBSOCKET_PING_INTERVAL: 30000,\n\n /**\n * WebSocket reconnect delay in milliseconds (1 second)\n */\n WEBSOCKET_RECONNECT_DELAY: 1000,\n\n /**\n * WebSocket max reconnect delay in milliseconds (30 seconds)\n */\n WEBSOCKET_MAX_RECONNECT_DELAY: 30000,\n} as const;\n\n/**\n * Type for time constant values\n */\nexport type TimeConstant = (typeof TIME_CONSTANTS)[keyof typeof TIME_CONSTANTS];\n","/**\n * API Client Environment Configurations\n *\n * Provides environment-specific default configurations for the API client service.\n * These configs are optimized for production, staging, and development environments.\n *\n * @module config/api/environments\n */\n\nimport type { ApiConfig, HeaderPresetName, EncryptionKey } from '@plyaz/types/api';\nimport { TIME_CONSTANTS } from '../time';\n\n/**\n * Production configuration for the API client service.\n * Optimized for reliability, security, and performance in production environments.\n *\n * Key Production Features:\n * - Encryption REQUIRED (enforced)\n * - Minimal headers (privacy-focused)\n * - Network adaptation enabled (auto-adjust to conditions)\n * - Balanced telemetry (monitoring without overhead)\n * - Aggressive retry strategy (5 attempts with exponential backoff)\n * - Uses retry PRESET strings instead of hardcoded values\n */\nexport const PRODUCTION_CONFIG: Partial<ApiConfig> = {\n // Core settings\n timeout: TIME_CONSTANTS.THIRTY_SECONDS,\n\n // Unified strategy - includes cache, retry, performance strategies\n // 'interactive' = standard cache + standard retry + balanced performance\n unifiedStrategy: 'interactive',\n\n // Revalidation strategy - NOT covered by unifiedStrategy\n // Controls when to revalidate cached data (SWR pattern)\n revalidationStrategy: 'balanced', // Revalidate on focus, network reconnect\n\n // Error handling strategy - return {data, error} without throwing\n strategy: 'softFail',\n\n // Default JSON headers for most API interactions\n headers: {\n presets: ['json' as unknown as HeaderPresetName] as const, // Sets Accept and Content-Type to application/json\n autoDetectNetwork: true,\n requestClientHints: false,\n },\n\n // Enriched headers - minimal preset with GLOBAL compliance\n // Adds ~5-7 headers: platform, app version, timezone, locale, network type\n // Privacy-conscious: respects DNT, no device fingerprinting\n // Global compliance: covers GDPR, CCPA, PIPL, APPI automatically\n enrichedHeaders: {\n enabled: true,\n preset: 'standard', // standard context headers\n includeDevice: false, // No device fingerprinting (privacy)\n includeNetwork: true, // Network type (wifi/cellular/etc)\n includePlatform: true, // Platform (web/ios/android)\n includeCompliance: true, // Timezone, locale for regional compliance\n respectDoNotTrack: true, // Honor DNT header (GDPR/CCPA)\n autoDetectRegion: true, // Auto-detect region from timezone\n regionalPreset: 'global', // Global compliance (GDPR+CCPA+PIPL+APPI)\n useTimezone: true, // Use timezone for region detection\n },\n\n // Network awareness - monitoring enabled, WITH auto-adaptation\n // Adjusts strategies based on network quality\n networkAware: {\n enabled: true, // Enable network quality monitoring\n adaptConfig: true, // Auto-adjust strategies based on network\n requestClientHints: false, // Don't request extra browser hints\n },\n\n // Tracking configuration - balanced for production (monitoring without overhead)\n tracking: {\n enabled: true,\n operations: true,\n events: true,\n performanceMode: 'minimal', // Not 'full' - avoid overhead in prod\n queueStrategy: 'batch',\n eventStrategy: 'queued',\n telemetry: true, // Send to monitoring in production\n },\n\n // Retry strategy - use preset instead of hardcoded values\n retryStrategy: 'aggressive', // More retries for production reliability (5 attempts)\n // Note: unifiedStrategy 'interactive' already includes 'standard' retry (3 attempts)\n // This overrides it for production to be more aggressive\n\n // Encryption - ENABLED by default for regulatory compliance (GDPR, CCPA, PIPL, etc.)\n // Encrypts common sensitive fields automatically\n // User MUST provide encryption key via init() - defaults don't include key\n encryption: {\n enabled: true,\n algorithm: 'AES-GCM', // Industry standard, FIPS 140-2 compliant\n autoDecrypt: true, // Auto-decrypt responses\n target: ['all'], // Encrypt in request body and query params\n // Key will be provided by user during initialization\n key: undefined as unknown as EncryptionKey, // Placeholder - user must provide via apiConfig\n\n // Common sensitive field patterns (uses glob matching)\n // Covers: email, SSN, phone, card numbers, passwords, tokens, wallet addresses\n fields: [\n // Personal Identifiable Information (PII) - GDPR Art. 9\n '*.email',\n '*.ssn',\n '*.taxId',\n '*.nationalId',\n '*.passport',\n '*.driverLicense',\n '*.governmentId',\n\n // Contact Information - GDPR Art. 4(1)\n '*.phone',\n '*.phoneNumber',\n '*.mobile',\n '*.telephone',\n '*.address.street',\n '*.address.line1',\n '*.address.line2',\n '*.postalCode',\n '*.zipCode',\n\n // Financial Information - PCI-DSS Req 3.4\n '*.cardNumber',\n '*.creditCard',\n '*.debitCard',\n '*.cvv',\n '*.cvc',\n '*.iban',\n '*.accountNumber',\n '*.routingNumber',\n '*.swiftCode',\n '*.sortCode',\n\n // Authentication Credentials - OWASP ASVS 2.1\n '*.password',\n '*.apiKey',\n '*.secret',\n '*.token',\n '*.accessToken',\n '*.refreshToken',\n '*.privateKey',\n '*.secretKey',\n\n // Crypto/Blockchain - Web3 security\n '*.wallet',\n '*.walletAddress',\n '*.mnemonic',\n '*.seedPhrase',\n '*.privateKeyHex',\n\n // Health Information - HIPAA §164.312(a)(2)(iv)\n '*.medicalRecord',\n '*.medicalRecordNumber',\n '*.healthInfo',\n '*.diagnosis',\n '*.prescription',\n '*.healthInsurance',\n\n // Biometric Data - GDPR Art. 9(1)\n '*.fingerprint',\n '*.faceId',\n '*.biometric',\n\n // Date of Birth - Age verification\n '*.birthDate',\n '*.dateOfBirth',\n '*.dob',\n\n // IP Addresses - GDPR considers PII\n '*.ipAddress',\n '*.ip',\n ],\n\n // Key provider - MUST be provided by user via init()\n // Supports three patterns:\n //\n // 1. EncryptionKey object (with metadata):\n // key: {\n // id: 'prod-key-v1',\n // key: process.env.ENCRYPTION_KEY!,\n // algorithm: 'AES-GCM',\n // format: 'raw'\n // }\n //\n // 2. KeyProvider function (for key rotation):\n // key: async (context) => {\n // const keyId = await getActiveKeyId();\n // const key = await keyManagementService.getKey(keyId);\n // return { id: keyId, key, algorithm: 'AES-GCM' };\n // }\n //\n // 3. Simple string (auto-converted to EncryptionKey):\n // key: process.env.ENCRYPTION_KEY!\n //\n // NO default key - user provides via init()\n },\n};\n\n/**\n * Staging configuration for the API client service.\n * ALIGNED with production for accurate pre-production testing.\n * Only differences: standard headers for debugging, full performance tracking.\n *\n * Key Staging Features:\n * - Encryption ENABLED (same as production)\n * - Standard headers (slightly more context for debugging than prod)\n * - Full performance tracking (catch issues before production)\n * - Same retry strategy as production (aggressive)\n * - Same network adaptation as production\n */\nexport const STAGING_CONFIG: Partial<ApiConfig> = {\n // Core settings - SAME AS PRODUCTION\n timeout: TIME_CONSTANTS.THIRTY_SECONDS,\n\n // Unified strategy - SAME AS PRODUCTION\n unifiedStrategy: 'interactive',\n\n // Revalidation strategy - SAME AS PRODUCTION\n revalidationStrategy: 'balanced',\n\n // Error handling strategy - SAME AS PRODUCTION\n strategy: 'softFail',\n\n // Headers preset - SAME AS PRODUCTION\n headers: {\n presets: ['json' as unknown as HeaderPresetName] as const,\n autoDetectNetwork: true,\n requestClientHints: false, // Same as prod\n },\n\n // Enriched headers - SLIGHTLY MORE than prod for debugging\n enrichedHeaders: {\n enabled: true,\n preset: 'standard', // One level up from prod's 'minimal'\n includeDevice: true, // Include device info for debugging\n includeNetwork: true,\n includePlatform: true,\n includeCompliance: true,\n respectDoNotTrack: true, // Same as prod\n autoDetectRegion: true,\n regionalPreset: 'global', // Same as prod\n useTimezone: true,\n },\n\n // Network awareness - SAME AS PRODUCTION\n networkAware: {\n enabled: true,\n adaptConfig: true, // Same as prod\n requestClientHints: false, // Same as prod\n },\n\n // Tracking configuration - FULL in staging (only difference from prod)\n tracking: {\n enabled: true,\n operations: true,\n events: true,\n performanceMode: 'full', // Full tracking to catch issues (prod uses 'balanced')\n queueStrategy: 'batch',\n eventStrategy: 'queued',\n telemetry: true, // Same as prod\n },\n\n // Retry strategy - SAME AS PRODUCTION\n retryStrategy: 'aggressive', // Same aggressive retries as production\n // Test production retry behavior in staging\n\n // Encryption - SAME AS PRODUCTION (REQUIRED)\n encryption: {\n enabled: true, // REQUIRED in staging (same as prod)\n algorithm: 'AES-GCM',\n autoDecrypt: true,\n target: ['all'],\n key: undefined as unknown as EncryptionKey, // Placeholder - user must provide via apiConfig\n fields: [\n // Same 50+ fields as production\n '*.email',\n '*.ssn',\n '*.taxId',\n '*.nationalId',\n '*.passport',\n '*.driverLicense',\n '*.governmentId',\n '*.phone',\n '*.phoneNumber',\n '*.mobile',\n '*.telephone',\n '*.address.street',\n '*.address.line1',\n '*.address.line2',\n '*.postalCode',\n '*.zipCode',\n '*.cardNumber',\n '*.creditCard',\n '*.debitCard',\n '*.cvv',\n '*.cvc',\n '*.iban',\n '*.accountNumber',\n '*.routingNumber',\n '*.swiftCode',\n '*.sortCode',\n '*.password',\n '*.apiKey',\n '*.secret',\n '*.token',\n '*.accessToken',\n '*.refreshToken',\n '*.privateKey',\n '*.secretKey',\n '*.wallet',\n '*.walletAddress',\n '*.mnemonic',\n '*.seedPhrase',\n '*.privateKeyHex',\n '*.medicalRecord',\n '*.medicalRecordNumber',\n '*.healthInfo',\n '*.diagnosis',\n '*.prescription',\n '*.healthInsurance',\n '*.fingerprint',\n '*.faceId',\n '*.biometric',\n '*.birthDate',\n '*.dateOfBirth',\n '*.dob',\n '*.ipAddress',\n '*.ip',\n ],\n },\n};\n\n/**\n * Development configuration for the API client service.\n * Optimized for debugging and fast feedback during development.\n *\n * Key Development Features:\n * - Encryption OPTIONAL (disable for easier debugging)\n * - Full headers (all context for debugging)\n * - No network adaptation (consistent behavior)\n * - Minimal retries (fail fast to see errors quickly)\n * - Full performance tracking (optimize during development)\n * - Longer timeout (allow for debugging/breakpoints)\n */\nexport const DEVELOPMENT_CONFIG: Partial<ApiConfig> = {\n // Core settings - longer timeout for debugging\n timeout: TIME_CONSTANTS.TWO_MINUTES,\n\n // Unified strategy - interactive works well for dev\n unifiedStrategy: 'interactive',\n\n // Revalidation strategy\n revalidationStrategy: 'balanced',\n\n // Error handling strategy\n strategy: 'softFail',\n\n // Full headers preset for maximum debugging context\n headers: {\n presets: ['json' as unknown as HeaderPresetName] as const,\n autoDetectNetwork: true,\n requestClientHints: true,\n },\n\n // Enriched headers - FULL preset with all context\n enrichedHeaders: {\n enabled: true,\n preset: 'full', // All possible headers for debugging\n includeDevice: true, // Include everything\n includeNetwork: true,\n includePlatform: true,\n includeCompliance: true,\n includePerformance: true, // Performance hints\n respectDoNotTrack: false, // Ignore DNT in dev\n autoDetectRegion: true,\n regionalPreset: 'global',\n useTimezone: true,\n },\n\n // Network awareness - DISABLED (consistent behavior in dev)\n networkAware: {\n enabled: false, // Don't adapt config in dev\n adaptConfig: false,\n requestClientHints: false,\n },\n\n // Tracking configuration - FULL to see everything\n tracking: {\n enabled: true,\n operations: true,\n events: true,\n performanceMode: 'full', // Track everything in dev\n queueStrategy: 'immediate', // Process immediately (no batching)\n eventStrategy: 'immediate', // Immediate events for debugging\n telemetry: false, // Don't send to monitoring from dev\n },\n\n // Retry strategy - MINIMAL (fail fast to see errors)\n retryStrategy: 'conservative', // Minimal retries (1 attempt) to see errors immediately\n // Note: unifiedStrategy 'interactive' includes 'standard' retry (3 attempts)\n // This overrides it for development to fail faster\n\n // Encryption - DISABLED by default but with SAME fields as production\n // This allows developers to test encryption locally when needed\n encryption: {\n enabled: false, // Disabled in dev by default (enable via apiConfig when testing)\n algorithm: 'AES-GCM',\n autoDecrypt: true,\n target: ['all'],\n\n // NO default key in development - encryption is disabled\n // To test encryption locally, pass key via apiConfig:\n // encryption: {\n // enabled: true,\n // key: \"your-test-key\" // Auto-converted to EncryptionKey\n // // Or use EncryptionKey object:\n // // key: { id: \"test-1\", key: \"your-key\", algorithm: \"AES-GCM\" }\n // }\n key: undefined as unknown as EncryptionKey, // Placeholder - encryption disabled in development\n\n // Same 50+ fields as production for testing\n fields: [\n '*.email',\n '*.ssn',\n '*.taxId',\n '*.nationalId',\n '*.passport',\n '*.driverLicense',\n '*.governmentId',\n '*.phone',\n '*.phoneNumber',\n '*.mobile',\n '*.telephone',\n '*.address.street',\n '*.address.line1',\n '*.address.line2',\n '*.postalCode',\n '*.zipCode',\n '*.cardNumber',\n '*.creditCard',\n '*.debitCard',\n '*.cvv',\n '*.cvc',\n '*.iban',\n '*.accountNumber',\n '*.routingNumber',\n '*.swiftCode',\n '*.sortCode',\n '*.password',\n '*.apiKey',\n '*.secret',\n '*.token',\n '*.accessToken',\n '*.refreshToken',\n '*.privateKey',\n '*.secretKey',\n '*.wallet',\n '*.walletAddress',\n '*.mnemonic',\n '*.seedPhrase',\n '*.privateKeyHex',\n '*.medicalRecord',\n '*.medicalRecordNumber',\n '*.healthInfo',\n '*.diagnosis',\n '*.prescription',\n '*.healthInsurance',\n '*.fingerprint',\n '*.faceId',\n '*.biometric',\n '*.birthDate',\n '*.dateOfBirth',\n '*.dob',\n '*.ipAddress',\n '*.ip',\n ],\n },\n};\n","import type { ApiClientOptions, ApiConfig } from '@plyaz/types/api';\nimport { TIME_CONSTANTS } from '../../time/constants';\n\n/**\n * Default configuration for API clients\n *\n * These defaults provide sensible out-of-the-box behavior:\n * - 30 second timeout for requests\n * - 3 retry attempts with exponential backoff\n * - 60 second cache TTL with 5 minute stale time\n * - Standard JSON content-type headers\n * - Soft-fail error strategy (returns error without throwing)\n */\nexport const DEFAULT_API_CONFIG: ApiConfig = {\n baseURL: '',\n timeout: TIME_CONSTANTS.THIRTY_SECONDS,\n retry: {\n attempts: 3,\n delay: TIME_CONSTANTS.SECOND,\n maxDelay: TIME_CONSTANTS.THIRTY_SECONDS,\n backoff: 1.5,\n },\n cache: {\n ttl: 60,\n stale: 300,\n },\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n },\n strategy: 'softFail',\n};\n\n/**\n * Default client options with global compliance enabled by default\n *\n * This ensures maximum privacy protection out of the box:\n * - Enriched headers enabled with standard preset\n * - Global compliance level (minimum data collection)\n */\nexport const DEFAULT_API_CLIENT_OPTIONS: Partial<ApiClientOptions> = {\n enrichedHeaders: {\n enabled: true,\n preset: 'standard', // Uses 'global' compliance by default\n },\n};\n"]}
|
|
@@ -126,7 +126,7 @@ export declare const STAGING_SUPPORTED_CHAINS: {
|
|
|
126
126
|
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
127
127
|
rpcUrls: {
|
|
128
128
|
readonly default: {
|
|
129
|
-
readonly http: readonly ["https://
|
|
129
|
+
readonly http: readonly ["https://11155111.rpc.thirdweb.com"];
|
|
130
130
|
};
|
|
131
131
|
};
|
|
132
132
|
sourceId?: number | undefined | undefined;
|
|
@@ -174,7 +174,7 @@ export declare const DEV_SUPPORTED_CHAINS: {
|
|
|
174
174
|
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
175
175
|
rpcUrls: {
|
|
176
176
|
readonly default: {
|
|
177
|
-
readonly http: readonly ["https://
|
|
177
|
+
readonly http: readonly ["https://11155111.rpc.thirdweb.com"];
|
|
178
178
|
};
|
|
179
179
|
};
|
|
180
180
|
sourceId?: number | undefined | undefined;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
'use strict';var types=require('@plyaz/types');// @plyaz package - Built with tsup
|
|
2
|
+
var E={BYTES_PER_MB:1048576};var T=25,_=30,U=types.NOTIFICATION_CATEGORIES.TRANSACTIONAL,A={DEFAULT_MAX_ATTEMPTS:3,DEFAULT_INITIAL_DELAY_MS:1e3,MAX_DELAY_MS:3e4,BACKOFF_MULTIPLIER:2},I={DEFAULT_MAX_ATTACHMENTS:10,DEFAULT_MAX_SIZE_PER_ATTACHMENT:T*E.BYTES_PER_MB,DEFAULT_MAX_TOTAL_SIZE:T*E.BYTES_PER_MB,SENDGRID_MAX_SIZE:_*E.BYTES_PER_MB,SENDGRID_MAX_TOTAL_SIZE:_*E.BYTES_PER_MB,INFOBIP_MAX_SIZE:_*E.BYTES_PER_MB,INFOBIP_MAX_TOTAL_SIZE:_*E.BYTES_PER_MB,URL_FETCH_TIMEOUT_MS:3e4,URL_FETCH_MAX_RETRIES:3},N={DEFAULT_FAILURE_THRESHOLD:5,DEFAULT_TIMEOUT_MS:6e4,DEFAULT_SUCCESS_THRESHOLD:2},S={DEFAULT_MAX_SIZE:1e4,DEFAULT_CONCURRENCY:5,DEFAULT_PROCESSING_INTERVAL_MS:100},L={DEFAULT_REQUESTS_PER_SECOND:10,DEFAULT_BURST_ALLOWANCE:20,DEFAULT_WINDOW_MS:1e3},C={DEFAULT_LOCALE:"en",FALLBACK_LOCALE:"en",CACHE_TTL_MS:3e5,MAX_TEMPLATE_SIZE:E.BYTES_PER_MB},R={GSM7_SINGLE_MESSAGE_LIMIT:160,GSM7_MULTI_PART_SEGMENT_LIMIT:153,UCS2_SINGLE_MESSAGE_LIMIT:70,UCS2_MULTI_PART_SEGMENT_LIMIT:67,DEFAULT_MAX_SEGMENTS:10,WARNING_THRESHOLD_PERCENTAGE:90},M={DEFAULT_PRIORITY:"normal",MAX_SUBJECT_LENGTH:255,MAX_PUSH_TITLE_LENGTH:100,MAX_PUSH_BODY_LENGTH:500},O={DEFAULT_LEVEL:"info",MAX_LOG_SIZE:1e4},o={DEFAULT_INTERVAL_MS:3e4,DEFAULT_TIMEOUT_MS:5e3,MAX_ACCEPTABLE_LATENCY_MS:2e3},G={RETRY:A,ATTACHMENT:I,CIRCUIT_BREAKER:N,QUEUE:S,RATE_LIMIT:L,TEMPLATE:C,SMS:R,NOTIFICATION:M,LOGGING:O,HEALTH_CHECK:o};exports.ATTACHMENT_CONFIG=I;exports.CIRCUIT_BREAKER_CONFIG=N;exports.DEFAULT_NOTIFICATION_CATEGORY=U;exports.HEALTH_CHECK_CONFIG=o;exports.LOGGING_CONFIG=O;exports.NOTIFICATION_CONFIG=M;exports.NOTIFICATION_PACKAGE_CONFIG=G;exports.QUEUE_CONFIG=S;exports.RATE_LIMIT_CONFIG=L;exports.RETRY_CONFIG=A;exports.SMS_CONFIG=R;exports.TEMPLATE_CONFIG=C;//# sourceMappingURL=index.cjs.map
|
|
3
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/math/constants.ts","../../src/notifications/constants.ts"],"names":["NUMBER_SYSTEM","SIZE_25_MB","SIZE_30_MB","DEFAULT_NOTIFICATION_CATEGORY","NOTIFICATION_CATEGORIES","RETRY_CONFIG","ATTACHMENT_CONFIG","CIRCUIT_BREAKER_CONFIG","QUEUE_CONFIG","RATE_LIMIT_CONFIG","TEMPLATE_CONFIG","SMS_CONFIG","NOTIFICATION_CONFIG","LOGGING_CONFIG","HEALTH_CHECK_CONFIG","NOTIFICATION_PACKAGE_CONFIG"],"mappings":";AAYO,IAAMA,CAAAA,CAAgB,CAsF3B,YAAA,CAAc,OAsIhB,CAAA,CCxNA,IAAMC,CAAAA,CAAa,EAAA,CACbC,CAAAA,CAAa,EAAA,CAMNC,CAAAA,CAAgCC,6BAAAA,CAAwB,aAAA,CAKxDC,CAAAA,CAAe,CAK1B,oBAAA,CAAsB,CAAA,CAMtB,wBAAA,CAA0B,GAAA,CAM1B,YAAA,CAAc,GAAA,CAMd,kBAAA,CAAoB,CACtB,CAAA,CAKaC,CAAAA,CAAoB,CAI/B,uBAAA,CAAyB,EAAA,CAM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Ae,MAAA,CAMf,YAAA,CAAc,GAChB,CAAA,CAKaC,CAAAA,CAAsB,CAIjC,mBAAA,CAAqB,GAAA,CAKrB,kBAAA,CAAoB,GAAA,CAMpB,yBAAA,CAA2B,GAC7B,CAAA,CAKaC,CAAAA,CAA8B,CACzC,KAAA,CAAOV,CAAAA,CACP,UAAA,CAAYC,CAAAA,CACZ,eAAA,CAAiBC,CAAAA,CACjB,KAAA,CAAOC,CAAAA,CACP,UAAA,CAAYC,CAAAA,CACZ,QAAA,CAAUC,CAAAA,CACV,GAAA,CAAKC,CAAAA,CACL,YAAA,CAAcC,CAAAA,CACd,OAAA,CAASC,CAAAA,CACT,YAAA,CAAcC,CAChB","file":"index.cjs","sourcesContent":["/**\n * Mathematical Constants\n *\n * Common mathematical values, number system bases, and calculation constants\n * used throughout the application for various computations.\n *\n * @module math/constants\n */\n\n/**\n * Number system base constants\n */\nexport const NUMBER_SYSTEM = {\n // Number bases\n /**\n * Base 2 - Binary number system\n */\n BINARY_BASE: 2,\n\n /**\n * Base 8 - Octal number system\n */\n OCTAL_BASE: 8,\n\n /**\n * Base 10 - Decimal number system\n */\n DECIMAL_BASE: 10,\n\n /**\n * Base 12 - Duodecimal number system\n */\n DUODECIMAL_BASE: 12,\n\n /**\n * Base 16 - Hexadecimal number system\n */\n HEX_BASE: 16,\n\n /**\n * Base 32 - Base32 encoding\n */\n BASE32: 32,\n\n /**\n * Base 36 - Alphanumeric number system (0-9, a-z)\n */\n BASE36: 36,\n\n /**\n * Base 58 - Bitcoin base58 encoding (excludes similar looking characters)\n */\n BASE58: 58,\n\n /**\n * Base 62 - Alphanumeric with uppercase (0-9, a-z, A-Z)\n */\n BASE62: 62,\n\n /**\n * Base 64 - Base64 encoding\n */\n BASE64: 64,\n\n // Formatting and padding\n /**\n * Default padding length for hexadecimal values (e.g., \"0F\" instead of \"F\")\n */\n HEX_PAD_LENGTH: 2,\n\n /**\n * Padding length for RGB hex colors (6 characters)\n */\n HEX_COLOR_LENGTH: 6,\n\n /**\n * Padding length for RGBA hex colors with alpha (8 characters)\n */\n HEX_COLOR_ALPHA_LENGTH: 8,\n\n /**\n * Standard byte size in bits\n */\n BITS_PER_BYTE: 8,\n\n /**\n * Standard nibble size in bits (half byte)\n */\n BITS_PER_NIBBLE: 4,\n\n /**\n * Number of bytes in a kilobyte (binary)\n */\n BYTES_PER_KB: 1024,\n\n /**\n * Number of bytes in a megabyte (binary)\n */\n BYTES_PER_MB: 1048576,\n\n /**\n * Number of bytes in a gigabyte (binary)\n */\n BYTES_PER_GB: 1073741824,\n\n // Precision and rounding\n /**\n * Default decimal places for currency\n */\n CURRENCY_DECIMAL_PLACES: 2,\n\n /**\n * Default decimal places for percentages\n */\n PERCENTAGE_DECIMAL_PLACES: 2,\n\n /**\n * Default decimal places for coordinates\n */\n COORDINATE_DECIMAL_PLACES: 6,\n\n /**\n * Maximum safe integer in JavaScript\n */\n MAX_SAFE_INTEGER: 9007199254740991,\n\n /**\n * Minimum safe integer in JavaScript\n */\n MIN_SAFE_INTEGER: -9007199254740991,\n\n /**\n * Maximum 32-bit signed integer\n */\n MAX_INT32: 2147483647,\n\n /**\n * Minimum 32-bit signed integer\n */\n MIN_INT32: -2147483648,\n\n /**\n * Maximum 16-bit unsigned integer\n */\n MAX_UINT16: 65535,\n\n /**\n * Maximum 8-bit unsigned integer\n */\n MAX_UINT8: 255,\n\n // Common angles in degrees\n /**\n * Full circle in degrees\n */\n DEGREES_FULL_CIRCLE: 360,\n\n /**\n * Half circle in degrees\n */\n DEGREES_HALF_CIRCLE: 180,\n\n /**\n * Quarter circle in degrees (right angle)\n */\n DEGREES_RIGHT_ANGLE: 90,\n\n /**\n * Degrees in a radian\n */\n DEGREES_PER_RADIAN: 57.29577951308232,\n\n /**\n * Radians in a degree\n */\n RADIANS_PER_DEGREE: 0.017453292519943295,\n\n // Mathematical constants\n /**\n * Pi (π)\n */\n PI: 3.141592653589793,\n\n /**\n * Two times Pi (2π) - full circle in radians\n */\n TWO_PI: 6.283185307179586,\n\n /**\n * Half Pi (π/2) - quarter circle in radians\n */\n HALF_PI: 1.5707963267948966,\n\n /**\n * Euler's number (e)\n */\n E: 2.718281828459045,\n\n /**\n * Golden ratio (φ)\n */\n GOLDEN_RATIO: 1.618033988749895,\n\n /**\n * Square root of 2\n */\n SQRT2: 1.4142135623730951,\n\n /**\n * Square root of 3\n */\n SQRT3: 1.7320508075688772,\n\n /**\n * Natural logarithm of 2\n */\n LN2: 0.6931471805599453,\n\n /**\n * Natural logarithm of 10\n */\n LN10: 2.302585092994046,\n\n /**\n * Base 2 logarithm of E\n */\n LOG2E: 1.4426950408889634,\n\n /**\n * Base 10 logarithm of E\n */\n LOG10E: 0.4342944819032518,\n} as const;\n\n/**\n * Mathematical and percentage constants\n */\nexport const MATH_CONSTANTS = {\n /**\n * Maximum percentage value\n */\n PERCENTAGE_MAX: 100,\n\n /**\n * Half value (50%)\n */\n HALF: 0.5,\n\n /**\n * One tenth (10%)\n */\n TENTH: 0.1,\n\n /**\n * One twentieth (5%)\n */\n TWENTIETH: 0.05,\n\n /**\n * 95th percentile\n */\n PERCENT_95: 0.95,\n\n /**\n * 99th percentile\n */\n PERCENT_99: 0.99,\n\n /**\n * Threshold for quadratic algorithm detection\n */\n QUADRATIC_THRESHOLD: 1.5,\n\n /**\n * Threshold for exponential algorithm detection\n */\n EXPONENTIAL_THRESHOLD: 3,\n\n /**\n * Multiplier for variance calculations\n */\n VARIANCE_MULTIPLIER: 4,\n\n /**\n * Offset for variance calculations\n */\n VARIANCE_OFFSET: 2,\n} as const;\n\n/**\n * Common numeric multipliers for calculations\n */\nexport const MULTIPLIERS = {\n /**\n * One and a half times (1.5x)\n */\n ONE_AND_HALF: 1.5,\n\n /**\n * Double (2x)\n */\n DOUBLE: 2,\n\n /**\n * Triple (3x)\n */\n TRIPLE: 3,\n\n /**\n * Quadruple (4x)\n */\n QUADRUPLE: 4,\n\n /**\n * Quintuple (5x)\n */\n QUINTUPLE: 5,\n\n /**\n * Ten times (10x)\n */\n TEN: 10,\n} as const;\n\n/**\n * Common numeric constants for general use\n */\nexport const NUMERIC_CONSTANTS = {\n /**\n * Milliseconds in one second\n */\n MILLISECONDS_PER_SECOND: 1000,\n\n /**\n * Seconds in one minute\n */\n SECONDS_PER_MINUTE: 60,\n\n /**\n * Minutes in one hour\n */\n MINUTES_PER_HOUR: 60,\n\n /**\n * Hours in one day\n */\n HOURS_PER_DAY: 24,\n\n /**\n * Negative one (-1)\n */\n NEGATIVE_ONE: -1,\n\n /**\n * Zero (0)\n */\n ZERO: 0,\n\n /**\n * One (1)\n */\n ONE: 1,\n\n /**\n * Two (2)\n */\n TWO: 2,\n\n /**\n * Three (3)\n */\n THREE: 3,\n\n /**\n * Five (5)\n */\n FIVE: 5,\n\n /**\n * Ten (10)\n */\n TEN: 10,\n} as const;\n\n/**\n * Type for number system values\n */\nexport type NumberSystemBase = (typeof NUMBER_SYSTEM)[keyof typeof NUMBER_SYSTEM];\n\n/**\n * Type for math constant values\n */\nexport type MathConstant = (typeof MATH_CONSTANTS)[keyof typeof MATH_CONSTANTS];\n\n/**\n * Type for multiplier values\n */\nexport type Multiplier = (typeof MULTIPLIERS)[keyof typeof MULTIPLIERS];\n\n/**\n * Type for numeric constant values\n */\nexport type NumericConstant = (typeof NUMERIC_CONSTANTS)[keyof typeof NUMERIC_CONSTANTS];\n","/**\n * Notification Configuration Constants\n *\n * Default configuration values for the notifications system.\n * These can be overridden at runtime through configuration objects.\n *\n * @module src/notifications/constants\n */\n\n// Import type-level constants from @plyaz/types\nimport { NOTIFICATION_CATEGORIES } from '@plyaz/types';\n\n// Import byte calculation constants from @plyaz/config/math\nimport { NUMBER_SYSTEM } from '../math/constants';\n\n// Common size values in MB\nconst SIZE_25_MB = 25;\nconst SIZE_30_MB = 30;\n\n/**\n * Default notification category\n * Safest default for compliance - transactional emails must always be sent\n */\nexport const DEFAULT_NOTIFICATION_CATEGORY = NOTIFICATION_CATEGORIES.TRANSACTIONAL;\n\n/**\n * Retry Configuration\n */\nexport const RETRY_CONFIG = {\n /**\n * Default maximum number of retry attempts\n * Used when no specific retry count is provided\n */\n DEFAULT_MAX_ATTEMPTS: 3,\n\n /**\n * Default initial delay between retries (milliseconds)\n * Used for exponential backoff calculation\n */\n DEFAULT_INITIAL_DELAY_MS: 1000,\n\n /**\n * Maximum delay between retries (milliseconds)\n * Prevents exponential backoff from growing too large\n */\n MAX_DELAY_MS: 30000,\n\n /**\n * Backoff multiplier for exponential backoff\n * Each retry delay = previous delay * multiplier\n */\n BACKOFF_MULTIPLIER: 2,\n} as const;\n\n/**\n * Attachment Configuration\n */\nexport const ATTACHMENT_CONFIG = {\n /**\n * Default maximum number of attachments per notification\n */\n DEFAULT_MAX_ATTACHMENTS: 10,\n\n /**\n * Default maximum size per attachment (bytes)\n * 25MB - Common limit across providers\n */\n DEFAULT_MAX_SIZE_PER_ATTACHMENT: SIZE_25_MB * NUMBER_SYSTEM.BYTES_PER_MB,\n\n /**\n * Default maximum total size of all attachments (bytes)\n * 25MB - Ensures we don't exceed provider limits\n */\n DEFAULT_MAX_TOTAL_SIZE: SIZE_25_MB * NUMBER_SYSTEM.BYTES_PER_MB,\n\n /**\n * Maximum attachment size for SendGrid (bytes)\n * 30MB per SendGrid documentation\n */\n SENDGRID_MAX_SIZE: SIZE_30_MB * NUMBER_SYSTEM.BYTES_PER_MB,\n\n /**\n * Maximum total attachment size for SendGrid (bytes)\n * 30MB per SendGrid documentation\n */\n SENDGRID_MAX_TOTAL_SIZE: SIZE_30_MB * NUMBER_SYSTEM.BYTES_PER_MB,\n\n /**\n * Maximum attachment size for Infobip (bytes)\n * 30MB - matching SendGrid for consistency\n */\n INFOBIP_MAX_SIZE: SIZE_30_MB * NUMBER_SYSTEM.BYTES_PER_MB,\n\n /**\n * Maximum total attachment size for Infobip (bytes)\n * 30MB - matching SendGrid for consistency\n */\n INFOBIP_MAX_TOTAL_SIZE: SIZE_30_MB * NUMBER_SYSTEM.BYTES_PER_MB,\n\n /**\n * Default timeout for URL attachment fetching (milliseconds)\n */\n URL_FETCH_TIMEOUT_MS: 30000,\n\n /**\n * Maximum number of retry attempts for failed URL fetches\n */\n URL_FETCH_MAX_RETRIES: 3,\n} as const;\n\n/**\n * Circuit Breaker Configuration\n */\nexport const CIRCUIT_BREAKER_CONFIG = {\n /**\n * Default failure threshold before opening circuit\n * Circuit opens after this many consecutive failures\n */\n DEFAULT_FAILURE_THRESHOLD: 5,\n\n /**\n * Default timeout before attempting half-open state (milliseconds)\n * How long to wait before testing if provider has recovered\n */\n DEFAULT_TIMEOUT_MS: 60000,\n\n /**\n * Default success threshold in half-open state\n * Number of successful requests needed to close circuit\n */\n DEFAULT_SUCCESS_THRESHOLD: 2,\n} as const;\n\n/**\n * Queue Configuration\n */\nexport const QUEUE_CONFIG = {\n /**\n * Default maximum queue size\n */\n DEFAULT_MAX_SIZE: 10000,\n\n /**\n * Default number of concurrent workers\n */\n DEFAULT_CONCURRENCY: 5,\n\n /**\n * Default queue processing interval (milliseconds)\n */\n DEFAULT_PROCESSING_INTERVAL_MS: 100,\n} as const;\n\n/**\n * Rate Limiting Configuration\n */\nexport const RATE_LIMIT_CONFIG = {\n /**\n * Default requests per second per provider\n */\n DEFAULT_REQUESTS_PER_SECOND: 10,\n\n /**\n * Default burst allowance\n * Number of requests that can be sent in a burst\n */\n DEFAULT_BURST_ALLOWANCE: 20,\n\n /**\n * Default window size for rate limiting (milliseconds)\n */\n DEFAULT_WINDOW_MS: 1000,\n} as const;\n\n/**\n * Template Configuration\n */\nexport const TEMPLATE_CONFIG = {\n /**\n * Default locale for templates\n */\n DEFAULT_LOCALE: 'en',\n\n /**\n * Fallback locale when requested locale not found\n */\n FALLBACK_LOCALE: 'en',\n\n /**\n * Template cache TTL (milliseconds)\n * How long to cache compiled templates\n */\n CACHE_TTL_MS: 300000, // 5 minutes\n\n /**\n * Maximum template size (bytes)\n */\n MAX_TEMPLATE_SIZE: NUMBER_SYSTEM.BYTES_PER_MB, // 1MB\n} as const;\n\n/**\n * SMS Character Limits and Encoding\n * Based on GSM-7 and UCS-2 encoding standards\n */\nexport const SMS_CONFIG = {\n /**\n * Single SMS message limit for GSM-7 encoding (standard characters)\n * Includes: A-Z, a-z, 0-9, and basic punctuation\n */\n GSM7_SINGLE_MESSAGE_LIMIT: 160,\n\n /**\n * Multi-part SMS message segment limit for GSM-7 encoding\n * Each segment in a concatenated message is limited to 153 characters (7 chars for UDH)\n */\n GSM7_MULTI_PART_SEGMENT_LIMIT: 153,\n\n /**\n * Single SMS message limit for UCS-2 encoding (unicode characters)\n * Used when message contains emoji, non-Latin characters, etc.\n */\n UCS2_SINGLE_MESSAGE_LIMIT: 70,\n\n /**\n * Multi-part SMS message segment limit for UCS-2 encoding\n * Each segment in a concatenated message is limited to 67 characters\n */\n UCS2_MULTI_PART_SEGMENT_LIMIT: 67,\n\n /**\n * Maximum number of SMS segments to allow\n * Prevents accidentally sending very expensive multi-part messages\n */\n DEFAULT_MAX_SEGMENTS: 10,\n\n /**\n * Warning threshold (percentage of limit)\n * Emit warning when message reaches this percentage of the limit\n */\n WARNING_THRESHOLD_PERCENTAGE: 90,\n} as const;\n\n/**\n * Notification Configuration\n */\nexport const NOTIFICATION_CONFIG = {\n /**\n * Default notification priority\n */\n DEFAULT_PRIORITY: 'normal' as const,\n\n /**\n * Maximum subject line length\n */\n MAX_SUBJECT_LENGTH: 255,\n\n /**\n * Maximum push notification title length\n */\n MAX_PUSH_TITLE_LENGTH: 100,\n\n /**\n * Maximum push notification body length\n */\n MAX_PUSH_BODY_LENGTH: 500,\n} as const;\n\n/**\n * Logging Configuration\n */\nexport const LOGGING_CONFIG = {\n /**\n * Default log level\n */\n DEFAULT_LEVEL: 'info' as const,\n\n /**\n * Maximum log message size (bytes)\n * Prevents excessive log sizes\n */\n MAX_LOG_SIZE: 10000,\n} as const;\n\n/**\n * Health Check Configuration\n */\nexport const HEALTH_CHECK_CONFIG = {\n /**\n * Default health check interval (milliseconds)\n */\n DEFAULT_INTERVAL_MS: 30000,\n\n /**\n * Default health check timeout (milliseconds)\n */\n DEFAULT_TIMEOUT_MS: 5000,\n\n /**\n * Maximum acceptable latency (milliseconds)\n * Health check fails if latency exceeds this\n */\n MAX_ACCEPTABLE_LATENCY_MS: 2000,\n} as const;\n\n/**\n * Export all configuration as a single object for convenience\n */\nexport const NOTIFICATION_PACKAGE_CONFIG = {\n RETRY: RETRY_CONFIG,\n ATTACHMENT: ATTACHMENT_CONFIG,\n CIRCUIT_BREAKER: CIRCUIT_BREAKER_CONFIG,\n QUEUE: QUEUE_CONFIG,\n RATE_LIMIT: RATE_LIMIT_CONFIG,\n TEMPLATE: TEMPLATE_CONFIG,\n SMS: SMS_CONFIG,\n NOTIFICATION: NOTIFICATION_CONFIG,\n LOGGING: LOGGING_CONFIG,\n HEALTH_CHECK: HEALTH_CHECK_CONFIG,\n} as const;\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import {NOTIFICATION_CATEGORIES}from'@plyaz/types';// @plyaz package - Built with tsup
|
|
2
|
+
var E={BYTES_PER_MB:1048576};var T=25,_=30,U=NOTIFICATION_CATEGORIES.TRANSACTIONAL,A={DEFAULT_MAX_ATTEMPTS:3,DEFAULT_INITIAL_DELAY_MS:1e3,MAX_DELAY_MS:3e4,BACKOFF_MULTIPLIER:2},I={DEFAULT_MAX_ATTACHMENTS:10,DEFAULT_MAX_SIZE_PER_ATTACHMENT:T*E.BYTES_PER_MB,DEFAULT_MAX_TOTAL_SIZE:T*E.BYTES_PER_MB,SENDGRID_MAX_SIZE:_*E.BYTES_PER_MB,SENDGRID_MAX_TOTAL_SIZE:_*E.BYTES_PER_MB,INFOBIP_MAX_SIZE:_*E.BYTES_PER_MB,INFOBIP_MAX_TOTAL_SIZE:_*E.BYTES_PER_MB,URL_FETCH_TIMEOUT_MS:3e4,URL_FETCH_MAX_RETRIES:3},N={DEFAULT_FAILURE_THRESHOLD:5,DEFAULT_TIMEOUT_MS:6e4,DEFAULT_SUCCESS_THRESHOLD:2},S={DEFAULT_MAX_SIZE:1e4,DEFAULT_CONCURRENCY:5,DEFAULT_PROCESSING_INTERVAL_MS:100},L={DEFAULT_REQUESTS_PER_SECOND:10,DEFAULT_BURST_ALLOWANCE:20,DEFAULT_WINDOW_MS:1e3},C={DEFAULT_LOCALE:"en",FALLBACK_LOCALE:"en",CACHE_TTL_MS:3e5,MAX_TEMPLATE_SIZE:E.BYTES_PER_MB},R={GSM7_SINGLE_MESSAGE_LIMIT:160,GSM7_MULTI_PART_SEGMENT_LIMIT:153,UCS2_SINGLE_MESSAGE_LIMIT:70,UCS2_MULTI_PART_SEGMENT_LIMIT:67,DEFAULT_MAX_SEGMENTS:10,WARNING_THRESHOLD_PERCENTAGE:90},M={DEFAULT_PRIORITY:"normal",MAX_SUBJECT_LENGTH:255,MAX_PUSH_TITLE_LENGTH:100,MAX_PUSH_BODY_LENGTH:500},O={DEFAULT_LEVEL:"info",MAX_LOG_SIZE:1e4},o={DEFAULT_INTERVAL_MS:3e4,DEFAULT_TIMEOUT_MS:5e3,MAX_ACCEPTABLE_LATENCY_MS:2e3},G={RETRY:A,ATTACHMENT:I,CIRCUIT_BREAKER:N,QUEUE:S,RATE_LIMIT:L,TEMPLATE:C,SMS:R,NOTIFICATION:M,LOGGING:O,HEALTH_CHECK:o};export{I as ATTACHMENT_CONFIG,N as CIRCUIT_BREAKER_CONFIG,U as DEFAULT_NOTIFICATION_CATEGORY,o as HEALTH_CHECK_CONFIG,O as LOGGING_CONFIG,M as NOTIFICATION_CONFIG,G as NOTIFICATION_PACKAGE_CONFIG,S as QUEUE_CONFIG,L as RATE_LIMIT_CONFIG,A as RETRY_CONFIG,R as SMS_CONFIG,C as TEMPLATE_CONFIG};//# sourceMappingURL=index.mjs.map
|
|
3
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/math/constants.ts","../../src/notifications/constants.ts"],"names":["NUMBER_SYSTEM","SIZE_25_MB","SIZE_30_M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AAA,CAAoB,CAI/B,2BAAA,CAA6B,EAAA,CAM7B,uBAAA,CAAyB,EAAA,CAKzB,iBAAA,CAAmB,GACrB,CAAA,CAKaC,CAAAA,CAAkB,CAI7B,cAAA,CAAgB,IAAA,CAKhB,eAAA,CAAiB,IAAA,CAMjB,YAAA,CAAc,GAAA,CAKd,iBAAA,CAAmBV,CAAAA,CAAc,YACnC,CAAA,CAMaW,CAAAA,CAAa,CAKxB,0BAA2B,GAAA,CAM3B,6BAAA,CAA+B,GAAA,CAM/B,yBAAA,CAA2B,EAAA,CAM3B,6BAAA,CAA+B,EAAA,CAM/B,oBAAA,CAAsB,EAAA,CAMtB,4BAAA,CAA8B,EAChC,CAAA,CAKaC,CAAAA,CAAsB,CAIjC,gBAAA,CAAkB,QAAA,CAKlB,kBAAA,CAAoB,GAAA,CAKpB,qBAAA,CAAuB,GAAA,CAKvB,oBAAA,CAAsB,GACxB,CAAA,CAKaC,CAAAA,CAAiB,CAI5B,aAAA,CAAe,MAAA,CAMf,YAAA,CAAc,GAChB,CAAA,CAKaC,CAAAA,CAAsB,CAIjC,mBAAA,CAAqB,GAAA,CAKrB,kBAAA,CAAoB,GAAA,CAMpB,yBAAA,CAA2B,GAC7B,CAAA,CAKaC,CAAAA,CAA8B,CACzC,KAAA,CAAOV,CAAAA,CACP,UAAA,CAAYC,CAAAA,CACZ,eAAA,CAAiBC,CAAAA,CACjB,KAAA,CAAOC,CAAAA,CACP,UAAA,CAAYC,CAAAA,CACZ,QAAA,CAAUC,CAAAA,CACV,GAAA,CAAKC,CAAAA,CACL,YAAA,CAAcC,CAAAA,CACd,OAAA,CAASC,CAAAA,CACT,YAAA,CAAcC,CAChB","file":"index.mjs","sourcesContent":["/**\n * Mathematical Constants\n *\n * Common mathematical values, number system bases, and calculation constants\n * used throughout the application for various computations.\n *\n * @module math/constants\n */\n\n/**\n * Number system base constants\n */\nexport const NUMBER_SYSTEM = {\n // Number bases\n /**\n * Base 2 - Binary number system\n */\n BINARY_BASE: 2,\n\n /**\n * Base 8 - Octal number system\n */\n OCTAL_BASE: 8,\n\n /**\n * Base 10 - Decimal number system\n */\n DECIMAL_BASE: 10,\n\n /**\n * Base 12 - Duodecimal number system\n */\n DUODECIMAL_BASE: 12,\n\n /**\n * Base 16 - Hexadecimal number system\n */\n HEX_BASE: 16,\n\n /**\n * Base 32 - Base32 encoding\n */\n BASE32: 32,\n\n /**\n * Base 36 - Alphanumeric number system (0-9, a-z)\n */\n BASE36: 36,\n\n /**\n * Base 58 - Bitcoin base58 encoding (excludes similar looking characters)\n */\n BASE58: 58,\n\n /**\n * Base 62 - Alphanumeric with uppercase (0-9, a-z, A-Z)\n */\n BASE62: 62,\n\n /**\n * Base 64 - Base64 encoding\n */\n BASE64: 64,\n\n // Formatting and padding\n /**\n * Default padding length for hexadecimal values (e.g., \"0F\" instead of \"F\")\n */\n HEX_PAD_LENGTH: 2,\n\n /**\n * Padding length for RGB hex colors (6 characters)\n */\n HEX_COLOR_LENGTH: 6,\n\n /**\n * Padding length for RGBA hex colors with alpha (8 characters)\n */\n HEX_COLOR_ALPHA_LENGTH: 8,\n\n /**\n * Standard byte size in bits\n */\n BITS_PER_BYTE: 8,\n\n /**\n * Standard nibble size in bits (half byte)\n */\n BITS_PER_NIBBLE: 4,\n\n /**\n * Number of bytes in a kilobyte (binary)\n */\n BYTES_PER_KB: 1024,\n\n /**\n * Number of bytes in a megabyte (binary)\n */\n BYTES_PER_MB: 1048576,\n\n /**\n * Number of bytes in a gigabyte (binary)\n */\n BYTES_PER_GB: 1073741824,\n\n // Precision and rounding\n /**\n * Default decimal places for currency\n */\n CURRENCY_DECIMAL_PLACES: 2,\n\n /**\n * Default decimal places for percentages\n */\n PERCENTAGE_DECIMAL_PLACES: 2,\n\n /**\n * Default decimal places for coordinates\n */\n COORDINATE_DECIMAL_PLACES: 6,\n\n /**\n * Maximum safe integer in JavaScript\n */\n MAX_SAFE_INTEGER: 9007199254740991,\n\n /**\n * Minimum safe integer in JavaScript\n */\n MIN_SAFE_INTEGER: -9007199254740991,\n\n /**\n * Maximum 32-bit signed integer\n */\n MAX_INT32: 2147483647,\n\n /**\n * Minimum 32-bit signed integer\n */\n MIN_INT32: -2147483648,\n\n /**\n * Maximum 16-bit unsigned integer\n */\n MAX_UINT16: 65535,\n\n /**\n * Maximum 8-bit unsigned integer\n */\n MAX_UINT8: 255,\n\n // Common angles in degrees\n /**\n * Full circle in degrees\n */\n DEGREES_FULL_CIRCLE: 360,\n\n /**\n * Half circle in degrees\n */\n DEGREES_HALF_CIRCLE: 180,\n\n /**\n * Quarter circle in degrees (right angle)\n */\n DEGREES_RIGHT_ANGLE: 90,\n\n /**\n * Degrees in a radian\n */\n DEGREES_PER_RADIAN: 57.29577951308232,\n\n /**\n * Radians in a degree\n */\n RADIANS_PER_DEGREE: 0.017453292519943295,\n\n // Mathematical constants\n /**\n * Pi (π)\n */\n PI: 3.141592653589793,\n\n /**\n * Two times Pi (2π) - full circle in radians\n */\n TWO_PI: 6.283185307179586,\n\n /**\n * Half Pi (π/2) - quarter circle in radians\n */\n HALF_PI: 1.5707963267948966,\n\n /**\n * Euler's number (e)\n */\n E: 2.718281828459045,\n\n /**\n * Golden ratio (φ)\n */\n GOLDEN_RATIO: 1.618033988749895,\n\n /**\n * Square root of 2\n */\n SQRT2: 1.4142135623730951,\n\n /**\n * Square root of 3\n */\n SQRT3: 1.7320508075688772,\n\n /**\n * Natural logarithm of 2\n */\n LN2: 0.6931471805599453,\n\n /**\n * Natural logarithm of 10\n */\n LN10: 2.302585092994046,\n\n /**\n * Base 2 logarithm of E\n */\n LOG2E: 1.4426950408889634,\n\n /**\n * Base 10 logarithm of E\n */\n LOG10E: 0.4342944819032518,\n} as const;\n\n/**\n * Mathematical and percentage constants\n */\nexport const MATH_CONSTANTS = {\n /**\n * Maximum percentage value\n */\n PERCENTAGE_MAX: 100,\n\n /**\n * Half value (50%)\n */\n HALF: 0.5,\n\n /**\n * One tenth (10%)\n */\n TENTH: 0.1,\n\n /**\n * One twentieth (5%)\n */\n TWENTIETH: 0.05,\n\n /**\n * 95th percentile\n */\n PERCENT_95: 0.95,\n\n /**\n * 99th percentile\n */\n PERCENT_99: 0.99,\n\n /**\n * Threshold for quadratic algorithm detection\n */\n QUADRATIC_THRESHOLD: 1.5,\n\n /**\n * Threshold for exponential algorithm detection\n */\n EXPONENTIAL_THRESHOLD: 3,\n\n /**\n * Multiplier for variance calculations\n */\n VARIANCE_MULTIPLIER: 4,\n\n /**\n * Offset for variance calculations\n */\n VARIANCE_OFFSET: 2,\n} as const;\n\n/**\n * Common numeric multipliers for calculations\n */\nexport const MULTIPLIERS = {\n /**\n * One and a half times (1.5x)\n */\n ONE_AND_HALF: 1.5,\n\n /**\n * Double (2x)\n */\n DOUBLE: 2,\n\n /**\n * Triple (3x)\n */\n TRIPLE: 3,\n\n /**\n * Quadruple (4x)\n */\n QUADRUPLE: 4,\n\n /**\n * Quintuple (5x)\n */\n QUINTUPLE: 5,\n\n /**\n * Ten times (10x)\n */\n TEN: 10,\n} as const;\n\n/**\n * Common numeric constants for general use\n */\nexport const NUMERIC_CONSTANTS = {\n /**\n * Milliseconds in one second\n */\n MILLISECONDS_PER_SECOND: 1000,\n\n /**\n * Seconds in one minute\n */\n SECONDS_PER_MINUTE: 60,\n\n /**\n * Minutes in one hour\n */\n MINUTES_PER_HOUR: 60,\n\n /**\n * Hours in one day\n */\n HOURS_PER_DAY: 24,\n\n /**\n * Negative one (-1)\n */\n NEGATIVE_ONE: -1,\n\n /**\n * Zero (0)\n */\n ZERO: 0,\n\n /**\n * One (1)\n */\n ONE: 1,\n\n /**\n * Two (2)\n */\n TWO: 2,\n\n /**\n * Three (3)\n */\n THREE: 3,\n\n /**\n * Five (5)\n */\n FIVE: 5,\n\n /**\n * Ten (10)\n */\n TEN: 10,\n} as const;\n\n/**\n * Type for number system values\n */\nexport type NumberSystemBase = (typeof NUMBER_SYSTEM)[keyof typeof NUMBER_SYSTEM];\n\n/**\n * Type for math constant values\n */\nexport type MathConstant = (typeof MATH_CONSTANTS)[keyof typeof MATH_CONSTANTS];\n\n/**\n * Type for multiplier values\n */\nexport type Multiplier = (typeof MULTIPLIERS)[keyof typeof MULTIPLIERS];\n\n/**\n * Type for numeric constant values\n */\nexport type NumericConstant = (typeof NUMERIC_CONSTANTS)[keyof typeof NUMERIC_CONSTANTS];\n","/**\n * Notification Configuration Constants\n *\n * Default configuration values for the notifications system.\n * These can be overridden at runtime through configuration objects.\n *\n * @module src/notifications/constants\n */\n\n// Import type-level constants from @plyaz/types\nimport { NOTIFICATION_CATEGORIES } from '@plyaz/types';\n\n// Import byte calculation constants from @plyaz/config/math\nimport { NUMBER_SYSTEM } from '../math/constants';\n\n// Common size values in MB\nconst SIZE_25_MB = 25;\nconst SIZE_30_MB = 30;\n\n/**\n * Default notification category\n * Safest default for compliance - transactional emails must always be sent\n */\nexport const DEFAULT_NOTIFICATION_CATEGORY = NOTIFICATION_CATEGORIES.TRANSACTIONAL;\n\n/**\n * Retry Configuration\n */\nexport const RETRY_CONFIG = {\n /**\n * Default maximum number of retry attempts\n * Used when no specific retry count is provided\n */\n DEFAULT_MAX_ATTEMPTS: 3,\n\n /**\n * Default initial delay between retries (milliseconds)\n * Used for exponential backoff calculation\n */\n DEFAULT_INITIAL_DELAY_MS: 1000,\n\n /**\n * Maximum delay between retries (milliseconds)\n * Prevents exponential backoff from growing too large\n */\n MAX_DELAY_MS: 30000,\n\n /**\n * Backoff multiplier for exponential backoff\n * Each retry delay = previous delay * multiplier\n */\n BACKOFF_MULTIPLIER: 2,\n} as const;\n\n/**\n * Attachment Configuration\n */\nexport const ATTACHMENT_CONFIG = {\n /**\n * Default maximum number of attachments per notification\n */\n DEFAULT_MAX_ATTACHMENTS: 10,\n\n /**\n * Default maximum size per attachment (bytes)\n * 25MB - Common limit across providers\n */\n DEFAULT_MAX_SIZE_PER_ATTACHMENT: SIZE_25_MB * NUMBER_SYSTEM.BYTES_PER_MB,\n\n /**\n * Default maximum total size of all attachments (bytes)\n * 25MB - Ensures we don't exceed provider limits\n */\n DEFAULT_MAX_TOTAL_SIZE: SIZE_25_MB * NUMBER_SYSTEM.BYTES_PER_MB,\n\n /**\n * Maximum attachment size for SendGrid (bytes)\n * 30MB per SendGrid documentation\n */\n SENDGRID_MAX_SIZE: SIZE_30_MB * NUMBER_SYSTEM.BYTES_PER_MB,\n\n /**\n * Maximum total attachment size for SendGrid (bytes)\n * 30MB per SendGrid documentation\n */\n SENDGRID_MAX_TOTAL_SIZE: SIZE_30_MB * NUMBER_SYSTEM.BYTES_PER_MB,\n\n /**\n * Maximum attachment size for Infobip (bytes)\n * 30MB - matching SendGrid for consistency\n */\n INFOBIP_MAX_SIZE: SIZE_30_MB * NUMBER_SYSTEM.BYTES_PER_MB,\n\n /**\n * Maximum total attachment size for Infobip (bytes)\n * 30MB - matching SendGrid for consistency\n */\n INFOBIP_MAX_TOTAL_SIZE: SIZE_30_MB * NUMBER_SYSTEM.BYTES_PER_MB,\n\n /**\n * Default timeout for URL attachment fetching (milliseconds)\n */\n URL_FETCH_TIMEOUT_MS: 30000,\n\n /**\n * Maximum number of retry attempts for failed URL fetches\n */\n URL_FETCH_MAX_RETRIES: 3,\n} as const;\n\n/**\n * Circuit Breaker Configuration\n */\nexport const CIRCUIT_BREAKER_CONFIG = {\n /**\n * Default failure threshold before opening circuit\n * Circuit opens after this many consecutive failures\n */\n DEFAULT_FAILURE_THRESHOLD: 5,\n\n /**\n * Default timeout before attempting half-open state (milliseconds)\n * How long to wait before testing if provider has recovered\n */\n DEFAULT_TIMEOUT_MS: 60000,\n\n /**\n * Default success threshold in half-open state\n * Number of successful requests needed to close circuit\n */\n DEFAULT_SUCCESS_THRESHOLD: 2,\n} as const;\n\n/**\n * Queue Configuration\n */\nexport const QUEUE_CONFIG = {\n /**\n * Default maximum queue size\n */\n DEFAULT_MAX_SIZE: 10000,\n\n /**\n * Default number of concurrent workers\n */\n DEFAULT_CONCURRENCY: 5,\n\n /**\n * Default queue processing interval (milliseconds)\n */\n DEFAULT_PROCESSING_INTERVAL_MS: 100,\n} as const;\n\n/**\n * Rate Limiting Configuration\n */\nexport const RATE_LIMIT_CONFIG = {\n /**\n * Default requests per second per provider\n */\n DEFAULT_REQUESTS_PER_SECOND: 10,\n\n /**\n * Default burst allowance\n * Number of requests that can be sent in a burst\n */\n DEFAULT_BURST_ALLOWANCE: 20,\n\n /**\n * Default window size for rate limiting (milliseconds)\n */\n DEFAULT_WINDOW_MS: 1000,\n} as const;\n\n/**\n * Template Configuration\n */\nexport const TEMPLATE_CONFIG = {\n /**\n * Default locale for templates\n */\n DEFAULT_LOCALE: 'en',\n\n /**\n * Fallback locale when requested locale not found\n */\n FALLBACK_LOCALE: 'en',\n\n /**\n * Template cache TTL (milliseconds)\n * How long to cache compiled templates\n */\n CACHE_TTL_MS: 300000, // 5 minutes\n\n /**\n * Maximum template size (bytes)\n */\n MAX_TEMPLATE_SIZE: NUMBER_SYSTEM.BYTES_PER_MB, // 1MB\n} as const;\n\n/**\n * SMS Character Limits and Encoding\n * Based on GSM-7 and UCS-2 encoding standards\n */\nexport const SMS_CONFIG = {\n /**\n * Single SMS message limit for GSM-7 encoding (standard characters)\n * Includes: A-Z, a-z, 0-9, and basic punctuation\n */\n GSM7_SINGLE_MESSAGE_LIMIT: 160,\n\n /**\n * Multi-part SMS message segment limit for GSM-7 encoding\n * Each segment in a concatenated message is limited to 153 characters (7 chars for UDH)\n */\n GSM7_MULTI_PART_SEGMENT_LIMIT: 153,\n\n /**\n * Single SMS message limit for UCS-2 encoding (unicode characters)\n * Used when message contains emoji, non-Latin characters, etc.\n */\n UCS2_SINGLE_MESSAGE_LIMIT: 70,\n\n /**\n * Multi-part SMS message segment limit for UCS-2 encoding\n * Each segment in a concatenated message is limited to 67 characters\n */\n UCS2_MULTI_PART_SEGMENT_LIMIT: 67,\n\n /**\n * Maximum number of SMS segments to allow\n * Prevents accidentally sending very expensive multi-part messages\n */\n DEFAULT_MAX_SEGMENTS: 10,\n\n /**\n * Warning threshold (percentage of limit)\n * Emit warning when message reaches this percentage of the limit\n */\n WARNING_THRESHOLD_PERCENTAGE: 90,\n} as const;\n\n/**\n * Notification Configuration\n */\nexport const NOTIFICATION_CONFIG = {\n /**\n * Default notification priority\n */\n DEFAULT_PRIORITY: 'normal' as const,\n\n /**\n * Maximum subject line length\n */\n MAX_SUBJECT_LENGTH: 255,\n\n /**\n * Maximum push notification title length\n */\n MAX_PUSH_TITLE_LENGTH: 100,\n\n /**\n * Maximum push notification body length\n */\n MAX_PUSH_BODY_LENGTH: 500,\n} as const;\n\n/**\n * Logging Configuration\n */\nexport const LOGGING_CONFIG = {\n /**\n * Default log level\n */\n DEFAULT_LEVEL: 'info' as const,\n\n /**\n * Maximum log message size (bytes)\n * Prevents excessive log sizes\n */\n MAX_LOG_SIZE: 10000,\n} as const;\n\n/**\n * Health Check Configuration\n */\nexport const HEALTH_CHECK_CONFIG = {\n /**\n * Default health check interval (milliseconds)\n */\n DEFAULT_INTERVAL_MS: 30000,\n\n /**\n * Default health check timeout (milliseconds)\n */\n DEFAULT_TIMEOUT_MS: 5000,\n\n /**\n * Maximum acceptable latency (milliseconds)\n * Health check fails if latency exceeds this\n */\n MAX_ACCEPTABLE_LATENCY_MS: 2000,\n} as const;\n\n/**\n * Export all configuration as a single object for convenience\n */\nexport const NOTIFICATION_PACKAGE_CONFIG = {\n RETRY: RETRY_CONFIG,\n ATTACHMENT: ATTACHMENT_CONFIG,\n CIRCUIT_BREAKER: CIRCUIT_BREAKER_CONFIG,\n QUEUE: QUEUE_CONFIG,\n RATE_LIMIT: RATE_LIMIT_CONFIG,\n TEMPLATE: TEMPLATE_CONFIG,\n SMS: SMS_CONFIG,\n NOTIFICATION: NOTIFICATION_CONFIG,\n LOGGING: LOGGING_CONFIG,\n HEALTH_CHECK: HEALTH_CHECK_CONFIG,\n} as const;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plyaz/config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"author": "Redeemer Pace",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"description": "Provides shared configs and constants for @playz ecosystem.",
|
|
@@ -105,6 +105,12 @@
|
|
|
105
105
|
"require": "./dist/auth/index.cjs",
|
|
106
106
|
"default": "./dist/auth/index.mjs"
|
|
107
107
|
},
|
|
108
|
+
"./notifications": {
|
|
109
|
+
"types": "./dist/notifications/index.d.ts",
|
|
110
|
+
"import": "./dist/notifications/index.mjs",
|
|
111
|
+
"require": "./dist/notifications/index.cjs",
|
|
112
|
+
"default": "./dist/notifications/index.mjs"
|
|
113
|
+
},
|
|
108
114
|
"./translations": {
|
|
109
115
|
"types": "./dist/translations/index.d.ts"
|
|
110
116
|
},
|
|
@@ -121,7 +127,7 @@
|
|
|
121
127
|
"packageManager": "pnpm@10.11.0",
|
|
122
128
|
"dependencies": {
|
|
123
129
|
"@plyaz/devtools": "^1.9.4",
|
|
124
|
-
"@plyaz/types": "^1.
|
|
130
|
+
"@plyaz/types": "^1.13.4",
|
|
125
131
|
"viem": "^2.31.7"
|
|
126
132
|
},
|
|
127
133
|
"devDependencies": {
|