{"_id":"@bernierllc/email-capture","_rev":"8-29a1516b1704a258f63c7fed5a4998c0","name":"@bernierllc/email-capture","dist-tags":{"latest":"1.3.0"},"versions":{"1.0.1":{"name":"@bernierllc/email-capture","version":"1.0.1","keywords":["email","capture","testing","storage","smtp","webhook","analysis","debug","bernierllc"],"author":{"name":"Bernier LLC"},"license":"UNLICENSED","_id":"@bernierllc/email-capture@1.0.1","maintainers":[{"name":"alikhan410","email":"mczeyo@gmail.com"},{"name":"mkbernier","email":"mkbernier@gmail.com"}],"homepage":"https://github.com/bernierllc/tools#readme","bugs":{"url":"https://github.com/bernierllc/tools/issues"},"dist":{"shasum":"b24d427af231fcff484d3e1db7952357db30cf76","tarball":"https://registry.npmjs.org/@bernierllc/email-capture/-/email-capture-1.0.1.tgz","fileCount":30,"integrity":"sha512-bLRP7YhPxqMKo2YxX6/BL9P7Pjn332oC8UE0MpgH6aNPicyR4ALETiy5YZDj6V/FB4XMgst8HNFdWarxdbVrLw==","signatures":[{"sig":"MEUCIQDlyMv2taIYKRG0eCF2DXyHKUPkpKU1j9K3nO4Oik1W2gIgG9ajRqK14+5bTd6T4MZ1SsSkOgTM0SSA3sCMRSM00Q0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":89052},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"946cfd3c13fa4ec6048cc145321aa2e71954dead","private":false,"scripts":{"lint":"eslint src/**/*.ts","test":"jest","build":"tsc","clean":"rm -rf dist","test:run":"jest --passWithNoTests","test:watch":"jest --watch","test:coverage":"jest --coverage"},"_npmUser":{"name":"mkbernier","email":"mkbernier@gmail.com"},"repository":{"url":"git+https://github.com/bernierllc/tools.git","type":"git","directory":"packages/core/email-capture"},"_npmVersion":"11.4.2","description":"Atomic utility package for capturing and storing emails for testing and analysis","directories":{},"_nodeVersion":"24.4.1","dependencies":{},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","eslint":"^8.56.0","ts-jest":"^29.1.2","typescript":"^5.3.3","@types/jest":"^29.5.12","@types/node":"^20.11.17","@typescript-eslint/parser":"^6.21.0","@typescript-eslint/eslint-plugin":"^6.21.0"},"peerDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/email-capture_1.0.1_1757019371239_0.4165146529888091","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@bernierllc/email-capture","version":"1.0.2","keywords":["email","capture","testing","storage","smtp","webhook","analysis","debug","bernierllc"],"author":{"name":"Bernier LLC"},"license":"UNLICENSED","_id":"@bernierllc/email-capture@1.0.2","maintainers":[{"name":"alikhan410","email":"mczeyo@gmail.com"},{"name":"mkbernier","email":"mkbernier@gmail.com"}],"homepage":"https://github.com/bernierllc/tools#readme","bugs":{"url":"https://github.com/bernierllc/tools/issues"},"dist":{"shasum":"2aaa04999ade65afaf40dd7fd4dfd8340f193873","tarball":"https://registry.npmjs.org/@bernierllc/email-capture/-/email-capture-1.0.2.tgz","fileCount":30,"integrity":"sha512-TZPRl0xTT82+nKhDACUsmlnATGuMcR2agUfmhI9VhiB1X8n5VnbegJNYYL4Ie764YAE5NUM/d1uzy7/R1YpAUQ==","signatures":[{"sig":"MEUCICPyNgd2CgA0P/AWXDl3Y7o9SerCsrZsw2iUAWoapq+pAiEA+HgWKAnO+7sXlGkZLsqvqCcyucyeKDLeNeBKfmCXNWE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":89052},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"ca2300fe95bd2a1125203bd37cb2602392b8c3b9","private":false,"scripts":{"lint":"eslint src/**/*.ts","test":"jest","build":"tsc","clean":"rm -rf dist","test:run":"jest --passWithNoTests","test:watch":"jest --watch","test:coverage":"jest --coverage"},"_npmUser":{"name":"mkbernier","email":"mkbernier@gmail.com"},"repository":{"url":"git+https://github.com/bernierllc/tools.git","type":"git","directory":"packages/core/email-capture"},"_npmVersion":"11.4.2","description":"Atomic utility package for capturing and storing emails for testing and analysis","directories":{},"_nodeVersion":"24.4.1","dependencies":{},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","eslint":"^8.56.0","ts-jest":"^29.1.2","typescript":"^5.3.3","@types/jest":"^29.5.12","@types/node":"^20.11.17","@typescript-eslint/parser":"^6.21.0","@typescript-eslint/eslint-plugin":"^6.21.0"},"peerDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/email-capture_1.0.2_1757019445075_0.9295096215435295","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@bernierllc/email-capture","version":"1.0.3","keywords":["email","capture","testing","storage","smtp","webhook","analysis","debug","bernierllc"],"author":{"name":"Bernier LLC"},"license":"UNLICENSED","_id":"@bernierllc/email-capture@1.0.3","maintainers":[{"name":"alikhan410","email":"mczeyo@gmail.com"},{"name":"mkbernier","email":"mkbernier@gmail.com"}],"homepage":"https://github.com/bernierllc/tools#readme","bugs":{"url":"https://github.com/bernierllc/tools/issues"},"dist":{"shasum":"c5db024dfddf85c0b25b803f134b57b149b8ccc0","tarball":"https://registry.npmjs.org/@bernierllc/email-capture/-/email-capture-1.0.3.tgz","fileCount":30,"integrity":"sha512-EkaqQywL8wdawO3tjliLHpClx68rb5EJlqYbutq3q3873Yo+LjtPvyIgVYx9oyxjqb/+6/C2ewxBGQZRBpfAyw==","signatures":[{"sig":"MEUCIQCqyWyzXVjCgWAzPd5vFMCMwzOJdrcKculxIeyZQagqKwIgG22U/teOSZXhaaizmd7IvGooRMwaCUKGXQkk+kNQH9E=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":89004},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"ac60dcf96650f32d01c43c3f55509861e6cd5b03","private":false,"scripts":{"lint":"eslint src/**/*.ts","test":"jest","build":"tsc","clean":"rm -rf dist","test:run":"jest --passWithNoTests","test:watch":"jest --watch","test:coverage":"jest --coverage"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:4425215a-8344-4d93-adc5-885765226443"}},"repository":{"url":"git+https://github.com/bernierllc/tools.git","type":"git","directory":"packages/core/email-capture"},"_npmVersion":"11.10.0","description":"Atomic utility package for capturing and storing emails for testing and analysis","directories":{},"_nodeVersion":"20.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","eslint":"^8.56.0","ts-jest":"^29.1.2","typescript":"^5.3.3","@types/jest":"^29.5.12","@types/node":"^20.11.17","@typescript-eslint/parser":"^6.21.0","@typescript-eslint/eslint-plugin":"^6.21.0"},"_npmOperationalInternal":{"tmp":"tmp/email-capture_1.0.3_1771265102370_0.4725066027500482","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@bernierllc/email-capture","version":"1.0.4","keywords":["email","capture","testing","storage","smtp","webhook","analysis","debug","bernierllc"],"author":{"name":"Bernier LLC"},"license":"UNLICENSED","_id":"@bernierllc/email-capture@1.0.4","maintainers":[{"name":"alikhan410","email":"mczeyo@gmail.com"},{"name":"mkbernier","email":"mkbernier@gmail.com"}],"homepage":"https://github.com/bernierllc/tools#readme","bugs":{"url":"https://github.com/bernierllc/tools/issues"},"dist":{"shasum":"4b0d3c63c6230d0b39687bfebb22594f2bbcde84","tarball":"https://registry.npmjs.org/@bernierllc/email-capture/-/email-capture-1.0.4.tgz","fileCount":30,"integrity":"sha512-MXWTFZQgVPbCkbXUQPciJZU6nwtb9636fTtckbsy8axiJvBi8UuzwhhQ8f1ppF8sSjo46TjEEE9Zw/rrXN1zIA==","signatures":[{"sig":"MEUCIBGvW117qahlqHpRVqc/yearT5fIpdWyNpp8V32LuewAAiEA5TFHfQcpPaPVPepEhCNmpmBu/rU2PrnQqQ68xd4q5qg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":89003},"main":"dist/index.js","_from":"file:bernierllc-email-capture-1.0.4.tgz","types":"dist/index.d.ts","private":false,"scripts":{"lint":"eslint src/**/*.ts","test":"jest","build":"tsc","clean":"rm -rf dist","test:run":"jest --passWithNoTests","test:watch":"jest --watch","test:coverage":"jest --coverage"},"_npmUser":{"name":"mkbernier","email":"mkbernier@gmail.com"},"_resolved":"/Users/mattbernier/projects/tools/packages/core/email-capture/bernierllc-email-capture-1.0.4.tgz","_integrity":"sha512-MXWTFZQgVPbCkbXUQPciJZU6nwtb9636fTtckbsy8axiJvBi8UuzwhhQ8f1ppF8sSjo46TjEEE9Zw/rrXN1zIA==","repository":{"url":"git+https://github.com/bernierllc/tools.git","type":"git","directory":"packages/core/email-capture"},"_npmVersion":"11.6.2","description":"Atomic utility package for capturing and storing emails for testing and analysis","directories":{},"_nodeVersion":"25.2.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","eslint":"^8.56.0","ts-jest":"^29.1.2","typescript":"^5.3.3","@types/jest":"^29.5.12","@types/node":"^20.11.17","@typescript-eslint/parser":"^6.21.0","@typescript-eslint/eslint-plugin":"^6.21.0"},"_npmOperationalInternal":{"tmp":"tmp/email-capture_1.0.4_1772569241139_0.28577154181524045","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"@bernierllc/email-capture","version":"1.0.5","keywords":["email","capture","testing","storage","smtp","webhook","analysis","debug","bernierllc"],"author":{"name":"Bernier LLC"},"license":"UNLICENSED","_id":"@bernierllc/email-capture@1.0.5","maintainers":[{"name":"alikhan410","email":"mczeyo@gmail.com"},{"name":"mkbernier","email":"mkbernier@gmail.com"}],"homepage":"https://github.com/bernierllc/tools#readme","bugs":{"url":"https://github.com/bernierllc/tools/issues"},"dist":{"shasum":"32d32e8dcaab6c5ebf6eca9a6eaedfb81d126e28","tarball":"https://registry.npmjs.org/@bernierllc/email-capture/-/email-capture-1.0.5.tgz","fileCount":30,"integrity":"sha512-w7d9Xqmxjsf3NFxKBtATvbZvHhsFM5wXYmLTndQOPnK5GfcvuOVu+wSUTT75IGArSRSfHCD4PdK5nDmG9itD+A==","signatures":[{"sig":"MEQCIDGNwtBbJgarwJAqtOi8ESYbDSw6hebVqp/Tdxv7wNkOAiBjfvVgseucs046obt16SEEbSNuNMio2QX4NduF2We6DQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":89003},"main":"dist/index.js","_from":"file:bernierllc-email-capture-1.0.5.tgz","types":"dist/index.d.ts","private":false,"scripts":{"lint":"eslint src/**/*.ts","test":"jest","build":"tsc","clean":"rm -rf dist","test:run":"jest --passWithNoTests","test:watch":"jest --watch","test:coverage":"jest --coverage"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:4425215a-8344-4d93-adc5-885765226443"}},"_resolved":"/tmp/0686cab0116d3ad9181b9632d1865257/bernierllc-email-capture-1.0.5.tgz","_integrity":"sha512-w7d9Xqmxjsf3NFxKBtATvbZvHhsFM5wXYmLTndQOPnK5GfcvuOVu+wSUTT75IGArSRSfHCD4PdK5nDmG9itD+A==","repository":{"url":"git+https://github.com/bernierllc/tools.git","type":"git","directory":"packages/core/email-capture"},"_npmVersion":"11.11.0","description":"Atomic utility package for capturing and storing emails for testing and analysis","directories":{},"_nodeVersion":"20.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","eslint":"^8.56.0","ts-jest":"^29.1.2","typescript":"^5.3.3","@types/jest":"^29.5.12","@types/node":"^20.11.17","@typescript-eslint/parser":"^6.21.0","@typescript-eslint/eslint-plugin":"^6.21.0"},"_npmOperationalInternal":{"tmp":"tmp/email-capture_1.0.5_1773081173219_0.933445260667346","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@bernierllc/email-capture","version":"1.2.0","keywords":["email","capture","testing","storage","smtp","webhook","analysis","debug","bernierllc"],"author":{"name":"Bernier LLC"},"license":"UNLICENSED","_id":"@bernierllc/email-capture@1.2.0","maintainers":[{"name":"alikhan410","email":"mczeyo@gmail.com"},{"name":"mkbernier","email":"mkbernier@gmail.com"}],"homepage":"https://github.com/bernierllc/tools#readme","bugs":{"url":"https://github.com/bernierllc/tools/issues"},"dist":{"shasum":"72adefb4ba9e750004cab64b78ebbe7e92665f06","tarball":"https://registry.npmjs.org/@bernierllc/email-capture/-/email-capture-1.2.0.tgz","fileCount":34,"integrity":"sha512-HuWfiI7yUAkD7skwU2Jrr8yFz2XErX6Y7Kcw1RrIOywn1sUeaW/n7/MJ3P299c9gb3u5MllfzEpYij4TICTtKw==","signatures":[{"sig":"MEQCIGFqDXYupHmVLkiKEEAVyklT0UEWzPlFqfbfpu6FBX2KAiBz1pg1Ch+kIZjGkE9GQ9G3kjGIj6TbuOsSaDFOB2+NTQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":91974},"main":"dist/index.js","_from":"file:bernierllc-email-capture-1.2.0.tgz","types":"dist/index.d.ts","private":false,"scripts":{"lint":"eslint src/**/*.ts","test":"jest","build":"tsc","clean":"rm -rf dist","test:run":"jest --passWithNoTests","test:watch":"jest --watch","test:coverage":"jest --coverage"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:4425215a-8344-4d93-adc5-885765226443"}},"_resolved":"/home/runner/work/tools/tools/packages/core/email-capture/bernierllc-email-capture-1.2.0.tgz","_integrity":"sha512-HuWfiI7yUAkD7skwU2Jrr8yFz2XErX6Y7Kcw1RrIOywn1sUeaW/n7/MJ3P299c9gb3u5MllfzEpYij4TICTtKw==","repository":{"url":"git+https://github.com/bernierllc/tools.git","type":"git","directory":"packages/core/email-capture"},"_npmVersion":"11.14.1","description":"Atomic utility package for capturing and storing emails for testing and analysis","directories":{},"_nodeVersion":"20.20.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","eslint":"^8.56.0","ts-jest":"^29.1.2","typescript":"^5.3.3","@types/jest":"^29.5.12","@types/node":"^20.11.17","@typescript-eslint/parser":"^6.21.0","@typescript-eslint/eslint-plugin":"^6.21.0"},"_npmOperationalInternal":{"tmp":"tmp/email-capture_1.2.0_1779241127057_0.8065152433313763","host":"s3://npm-registry-packages-npm-production"}},"1.3.0":{"name":"@bernierllc/email-capture","version":"1.3.0","description":"Atomic utility package for capturing and storing emails for testing and analysis","main":"dist/index.js","types":"dist/index.d.ts","keywords":["email","capture","testing","storage","smtp","webhook","analysis","debug","bernierllc"],"author":{"name":"Bernier LLC"},"license":"UNLICENSED","private":false,"devDependencies":{"@types/jest":"^29.5.12","@types/node":"^20.11.17","@typescript-eslint/eslint-plugin":"^6.21.0","@typescript-eslint/parser":"^6.21.0","eslint":"^8.56.0","jest":"^29.7.0","ts-jest":"^29.1.2","typescript":"^5.3.3"},"repository":{"type":"git","url":"git+https://github.com/bernierllc/tools.git","directory":"packages/core/email-capture"},"publishConfig":{"access":"public"},"scripts":{"build":"tsc","test":"jest","test:watch":"jest --watch","test:coverage":"jest --coverage","test:run":"jest --passWithNoTests","lint":"eslint src/**/*.ts","clean":"rm -rf dist"},"_id":"@bernierllc/email-capture@1.3.0","bugs":{"url":"https://github.com/bernierllc/tools/issues"},"homepage":"https://github.com/bernierllc/tools#readme","_integrity":"sha512-JNk/xaCSSOAhpF2rvilMATKVDvmM7/FkuJYewvKgJ+b5+YVXPl231P7TbxiqiHDERt12+QDW48MJStn4mXj8IA==","_resolved":"/home/runner/work/tools/tools/packages/core/email-capture/bernierllc-email-capture-1.3.0.tgz","_from":"file:bernierllc-email-capture-1.3.0.tgz","_nodeVersion":"20.20.2","_npmVersion":"11.14.1","dist":{"integrity":"sha512-JNk/xaCSSOAhpF2rvilMATKVDvmM7/FkuJYewvKgJ+b5+YVXPl231P7TbxiqiHDERt12+QDW48MJStn4mXj8IA==","shasum":"b7589263de77ea78e0e5c6a01e7c44d08165887e","tarball":"https://registry.npmjs.org/@bernierllc/email-capture/-/email-capture-1.3.0.tgz","fileCount":34,"unpackedSize":91974,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQClKC98mbU2n+oDoCcHYBq34zksBmHlC0FMT1JHGzUcVgIgNaSD90J03AUcFwiNECS3ks/9a0N4dcrYSk/qvTc/o64="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:4425215a-8344-4d93-adc5-885765226443"}},"directories":{},"maintainers":[{"name":"alikhan410","email":"mczeyo@gmail.com"},{"name":"mkbernier","email":"mkbernier@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/email-capture_1.3.0_1779249871304_0.9753201607681878"},"_hasShrinkwrap":false}},"time":{"created":"2025-09-04T20:56:10.687Z","modified":"2026-05-20T04:04:31.585Z","1.0.1":"2025-09-04T20:56:11.425Z","1.0.2":"2025-09-04T20:57:25.273Z","1.0.3":"2026-02-16T18:05:02.518Z","1.0.4":"2026-03-03T20:20:41.288Z","1.0.5":"2026-03-09T18:32:53.364Z","1.2.0":"2026-05-20T01:38:47.185Z","1.3.0":"2026-05-20T04:04:31.445Z"},"bugs":{"url":"https://github.com/bernierllc/tools/issues"},"author":{"name":"Bernier LLC"},"license":"UNLICENSED","homepage":"https://github.com/bernierllc/tools#readme","keywords":["email","capture","testing","storage","smtp","webhook","analysis","debug","bernierllc"],"repository":{"type":"git","url":"git+https://github.com/bernierllc/tools.git","directory":"packages/core/email-capture"},"description":"Atomic utility package for capturing and storing emails for testing and analysis","maintainers":[{"name":"alikhan410","email":"mczeyo@gmail.com"},{"name":"mkbernier","email":"mkbernier@gmail.com"}],"readme":"# @bernierllc/email-capture\n\nAtomic utility package for capturing and storing emails for testing and analysis. Provides session-based email capture with metadata extraction, querying capabilities, and multiple export formats.\n\n## Installation\n\n```bash\nnpm install @bernierllc/email-capture\n```\n\n## Usage\n\n### Basic Email Capture\n\n```typescript\nimport { EmailCapture } from '@bernierllc/email-capture';\n\n// Create an email capture instance\nconst capture = new EmailCapture();\n\n// Create a session for organizing captured emails\nconst session = await capture.createSession({\n  name: 'Test Session',\n  description: 'Capturing emails for API testing',\n  retention: {\n    maxAge: 86400000, // 24 hours\n    maxCount: 1000,\n    autoCleanup: true\n  }\n});\n\n// Capture an email\nconst email = await capture.captureEmail(session.id, {\n  content: 'From: sender@example.com\\nTo: recipient@example.com\\nSubject: Test Email\\n\\nHello, world!',\n  source: { \n    type: 'smtp', \n    server: 'localhost:1025' \n  }\n});\n\nconsole.log('Captured email:', email.id);\n```\n\n### Querying and Filtering\n\n```typescript\n// Query emails by various criteria\nconst emails = await capture.queryEmails({\n  sessionId: session.id,\n  sender: 'sender@example.com',\n  subject: 'Test Email'\n});\n\n// Get emails with pagination\nconst recentEmails = await capture.queryEmails(\n  { sessionId: session.id },\n  10, // limit\n  0   // offset\n);\n```\n\n### Export Functionality\n\n```typescript\n// Export emails as JSON\nconst jsonData = await capture.exportEmails(\n  { sessionId: session.id },\n  { format: 'json', includeContent: true }\n);\n\n// Export as CSV for spreadsheet analysis\nconst csvData = await capture.exportEmails(\n  { sessionId: session.id },\n  { format: 'csv' }\n);\n\n// Export as EML files\nconst emlData = await capture.exportEmails(\n  { sessionId: session.id },\n  { format: 'eml' }\n);\n\n// Export as MBOX format\nconst mboxData = await capture.exportEmails(\n  { sessionId: session.id },\n  { format: 'mbox' }\n);\n```\n\n### Session Management\n\n```typescript\n// List all sessions\nconst sessions = await capture.listSessions(10, 0);\n\n// Update session configuration\nawait capture.updateSession(session.id, {\n  name: 'Updated Session Name',\n  retention: {\n    maxAge: 172800000, // 48 hours\n    maxCount: 2000,\n    autoCleanup: true\n  }\n});\n\n// Get session statistics\nconst stats = await capture.getSessionStats(session.id);\nconsole.log(`Session has ${stats.totalEmails} emails using ${stats.totalBytes} bytes`);\n```\n\n### Cleanup Operations\n\n```typescript\n// Clean up old emails based on retention policy\nconst cleanupResult = await capture.cleanupSession(session.id);\nconsole.log(`Deleted ${cleanupResult.emailsDeleted} emails, freed ${cleanupResult.bytesFreed} bytes`);\n\n// Clean up expired sessions globally\nconst globalCleanup = await capture.cleanupExpiredSessions();\nconsole.log(`Cleaned up ${globalCleanup.sessionsDeleted} expired sessions`);\n```\n\n## API Reference\n\n### EmailCapture\n\nMain class for email capture operations.\n\n#### Constructor\n\n```typescript\nnew EmailCapture(storage?: StorageBackend)\n```\n\n- `storage` (optional): Custom storage backend. Defaults to `MemoryStorage`.\n\n#### Session Management Methods\n\n##### `createSession(config: SessionConfig): Promise<EmailCaptureSession>`\n\nCreates a new email capture session.\n\n- `config.name`: Human-readable session name\n- `config.description` (optional): Session description\n- `config.retention` (optional): Retention policy configuration\n- `config.metadata` (optional): Additional session metadata\n\n##### `getSession(sessionId: string): Promise<EmailCaptureSession | null>`\n\nRetrieves a session by ID.\n\n##### `updateSession(sessionId: string, updates: Partial<EmailCaptureSession>): Promise<EmailCaptureSession>`\n\nUpdates session configuration.\n\n##### `deleteSession(sessionId: string): Promise<boolean>`\n\nDeletes a session and all its emails.\n\n##### `listSessions(limit?: number, offset?: number): Promise<QueryResult<EmailCaptureSession>>`\n\nLists all sessions with pagination.\n\n#### Email Capture Methods\n\n##### `captureEmail(sessionId: string, email: RawEmail): Promise<CapturedEmail>`\n\nCaptures an email in the specified session.\n\n- `email.content`: Raw email content (headers + body)\n- `email.source`: Source information (type, server, etc.)\n- `email.metadata` (optional): Pre-extracted metadata\n\n##### `getEmail(emailId: string): Promise<CapturedEmail | null>`\n\nRetrieves a specific email by ID.\n\n##### `deleteEmail(emailId: string): Promise<boolean>`\n\nDeletes a specific email.\n\n#### Query and Export Methods\n\n##### `queryEmails(filters: EmailFilters, limit?: number, offset?: number): Promise<QueryResult<CapturedEmail>>`\n\nQueries emails with filtering and pagination.\n\nSupported filters:\n- `sessionId`: Filter by session\n- `sender`: Filter by sender email address\n- `recipient`: Filter by recipient email address\n- `subject`: Filter by subject (partial match)\n- `sourceType`: Filter by source type ('smtp', 'api', 'webhook', etc.)\n\n##### `exportEmails(filters: EmailFilters, options: ExportOptions): Promise<string>`\n\nExports emails in various formats.\n\nExport options:\n- `format`: 'json', 'csv', 'eml', or 'mbox'\n- `includeContent` (optional): Include raw email content\n- `includeMetadata` (optional): Include extracted metadata\n\n##### `exportSession(sessionId: string, options: ExportOptions): Promise<string>`\n\nExports all emails from a session.\n\n#### Statistics Methods\n\n##### `getSessionStats(sessionId: string): Promise<SessionStats>`\n\nReturns statistics for a specific session.\n\n##### `getGlobalStats(): Promise<GlobalStats>`\n\nReturns global statistics across all sessions.\n\n#### Cleanup Methods\n\n##### `cleanupSession(sessionId: string): Promise<CleanupResult>`\n\nCleans up emails in a session based on retention policy.\n\n##### `cleanupExpiredSessions(): Promise<CleanupResult>`\n\nCleans up all expired sessions globally.\n\n### Types\n\n#### EmailCaptureSession\n\n```typescript\ninterface EmailCaptureSession {\n  id: string;\n  name: string;\n  description?: string;\n  createdAt: Date;\n  updatedAt: Date;\n  isActive: boolean;\n  retention?: RetentionPolicy;\n  metadata?: Record<string, any>;\n}\n```\n\n#### CapturedEmail\n\n```typescript\ninterface CapturedEmail {\n  id: string;\n  sessionId: string;\n  content: string;\n  source: EmailSource;\n  metadata?: EmailMetadata;\n  capturedAt: Date;\n  size: number;\n}\n```\n\n#### RetentionPolicy\n\n```typescript\ninterface RetentionPolicy {\n  maxAge?: number;        // Max age in milliseconds\n  maxCount?: number;      // Max number of emails\n  autoCleanup?: boolean;  // Auto-cleanup on capture\n}\n```\n\n## Configuration\n\n### Environment Variables\n\nThe package respects these environment variables:\n\n- `EMAIL_CAPTURE_MAX_SIZE`: Maximum email size in bytes (default: 10MB)\n- `EMAIL_CAPTURE_DEFAULT_RETENTION`: Default retention period in milliseconds\n- `EMAIL_CAPTURE_AUTO_CLEANUP`: Enable auto-cleanup by default (true/false)\n\n### Storage Backends\n\nBy default, the package uses in-memory storage. You can implement custom storage backends:\n\n```typescript\nimport { StorageBackend } from '@bernierllc/email-capture';\n\nclass CustomStorage implements StorageBackend {\n  // Implement all required methods\n  async createSession(config: SessionConfig): Promise<EmailCaptureSession> {\n    // Custom implementation\n  }\n  \n  // ... other methods\n}\n\nconst capture = new EmailCapture(new CustomStorage());\n```\n\n## Integration Status\n\n- **Logger integration**: not-applicable - Core utility package with minimal logging needs. Uses console for critical errors only.\n- **Docs-Suite**: ready - Complete API documentation with TypeScript support, exportable as TypeDoc format.\n- **NeverHub integration**: not-applicable - Core atomic utility with no external service dependencies. Designed for direct integration by service packages. Uses graceful degradation patterns when @bernierllc/neverhub-adapter is not available.\n\n## Error Handling\n\nAll methods follow a consistent error handling pattern. Errors are thrown with descriptive messages and error codes:\n\n```typescript\ntry {\n  await capture.captureEmail('invalid-session', email);\n} catch (error) {\n  console.error('Capture failed:', error.message);\n  // Error includes context: session ID, email details, etc.\n}\n```\n\n## Security Considerations\n\n- Email content is stored as provided - no automatic sanitization\n- Session IDs use cryptographically secure random generation\n- No external network connections required\n- Memory storage is cleared on process exit\n\n## Testing\n\nThe package includes comprehensive tests with 95+ test cases covering:\n\n- Session management and lifecycle\n- Email capture and metadata extraction\n- Query operations with various filters\n- Export functionality in all formats\n- Error handling and edge cases\n- Storage backend compliance\n\nRun tests:\n\n```bash\nnpm test                # Run all tests\nnpm run test:coverage   # Run with coverage report\nnpm run test:watch      # Run in watch mode\n```\n\n## License\n\nCopyright (c) 2025 Bernier LLC. All rights reserved.\n\nThis package is part of the BernierLLC tools ecosystem and follows the BernierLLC MECE architecture principles for atomic, reusable utilities.","readmeFilename":"README.md"}