{"_id":"@bagdock/pii-patterns","_rev":"2-4f7fe66e64ed99ae9faf5b1af75f59bd","name":"@bagdock/pii-patterns","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@bagdock/pii-patterns","version":"0.1.0","keywords":["pii","privacy","redaction","scrubbing","gdpr","bagdock"],"license":"MIT","_id":"@bagdock/pii-patterns@0.1.0","maintainers":[{"name":"daf_bagdock","email":"daf@bagdock.com"}],"homepage":"https://bagdock.com/docs/pii-patterns","bugs":{"url":"https://github.com/bagdock/bagdock-pii-patterns/issues"},"dist":{"shasum":"e5359f16b5ecd27a8429ac609b5cb45500b04e4f","tarball":"https://registry.npmjs.org/@bagdock/pii-patterns/-/pii-patterns-0.1.0.tgz","fileCount":9,"integrity":"sha512-Sq6LMqA3LIZeFi+I2zH7etixTdDerVf+S2Wb2mUmRmL/vqZxgsgrP9SVgSvimwmhtsySufMDj7masCHfB1xSwg==","signatures":[{"sig":"MEYCIQCUmflH/azyBDxvVviK3y4oXXrTBEzzsJBIVKxiw+lUjAIhAJDWIiB+GoUxq0qvqGJ47cbw2JB24NhYEPx3WxyrTLKT","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":23210},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"7f25d5562e29af9decc1a9356df58a75abb5acd3","scripts":{"test":"bun test","build":"tsup src/index.ts --format cjs,esm --dts","prepublishOnly":"npm run build"},"_npmUser":{"name":"daf_bagdock","email":"daf@bagdock.com"},"repository":{"url":"git+https://github.com/bagdock/bagdock-pii-patterns.git","type":"git"},"_npmVersion":"10.8.2","description":"PII regex patterns and scrubbing utilities for Bagdock","directories":{},"_nodeVersion":"20.19.5","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/pii-patterns_0.1.0_1776012416932_0.26014265177182083","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@bagdock/pii-patterns","version":"0.1.1","description":"PII regex patterns and scrubbing utilities for Bagdock","license":"MIT","main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"build":"tsup src/index.ts --format cjs,esm --dts","test":"bun test","prepublishOnly":"npm run build"},"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0"},"repository":{"type":"git","url":"git+https://github.com/bagdock/bagdock-pii-patterns.git"},"homepage":"https://bagdock.com/docs/pii-patterns","bugs":{"url":"https://github.com/bagdock/bagdock-pii-patterns/issues"},"keywords":["pii","privacy","redaction","scrubbing","gdpr","bagdock"],"gitHead":"aa3cb7e1b5be2728ed9e80fdaf57f89ede6c7740","_id":"@bagdock/pii-patterns@0.1.1","_nodeVersion":"22.22.2","_npmVersion":"11.12.1","dist":{"integrity":"sha512-wRC52c7wMPzCIpAD0UNr+QEfln9RmKiOxtDOKi6edNhTcSu3EeydSyV0kklZvEgnwrwzd4dJnlR6sVe1fHq6KA==","shasum":"bc372ccb6736b93aad5a0c9018480f3acad48763","tarball":"https://registry.npmjs.org/@bagdock/pii-patterns/-/pii-patterns-0.1.1.tgz","fileCount":9,"unpackedSize":25017,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@bagdock%2fpii-patterns@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDBdQbLYaoNHSEQUYs7WCKCb+5sEc2pOiImJ39+LoE8/gIgMulDJ4xX09Nw5psTRZCRBqb6VFL1QDv8cY6I63DKuUk="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:c798ae8e-9431-407f-872b-b3d9b85c0f4d"}},"directories":{},"maintainers":[{"name":"daf_bagdock","email":"daf@bagdock.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pii-patterns_0.1.1_1776013145737_0.18102274452903977"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-12T16:46:56.810Z","modified":"2026-04-12T16:59:06.141Z","0.1.0":"2026-04-12T16:46:57.075Z","0.1.1":"2026-04-12T16:59:05.854Z"},"bugs":{"url":"https://github.com/bagdock/bagdock-pii-patterns/issues"},"license":"MIT","homepage":"https://bagdock.com/docs/pii-patterns","keywords":["pii","privacy","redaction","scrubbing","gdpr","bagdock"],"repository":{"type":"git","url":"git+https://github.com/bagdock/bagdock-pii-patterns.git"},"description":"PII regex patterns and scrubbing utilities for Bagdock","maintainers":[{"name":"daf_bagdock","email":"daf@bagdock.com"}],"readme":"```\n  ----++                                ----++                    ---+++     \n  ---+++                                ---++                     ---++      \n ----+---     -----     ---------  --------++ ------     -----   ----++----- \n ---------+ --------++----------++--------+++--------+ --------++---++---++++\n ---+++---++ ++++---++---+++---++---+++---++---+++---++---++---++------++++  \n----++ ---++--------++---++----++---+++---++---++ ---+---++     -------++    \n----+----+---+++---++---++----++---++----++---++---+++--++ --------+---++   \n---------++--------+++--------+++--------++ -------+++ -------++---++----++  \n +++++++++   +++++++++- +++---++   ++++++++    ++++++    ++++++  ++++  ++++  \n                     --------+++                                             \n                       +++++++                                               \n```\n\n# @bagdock/pii-patterns\n\nPII regex patterns and scrubbing utilities for the [Bagdock](https://bagdock.com) platform — 15-pattern defense-in-depth redaction for personally identifiable information.\n\n[![npm version](https://img.shields.io/npm/v/@bagdock/pii-patterns.svg)](https://www.npmjs.com/package/@bagdock/pii-patterns)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)\n\n## Install\n\n```bash\nnpm install @bagdock/pii-patterns\n```\n\n```bash\nyarn add @bagdock/pii-patterns\n```\n\n```bash\npnpm add @bagdock/pii-patterns\n```\n\n```bash\nbun add @bagdock/pii-patterns\n```\n\n## Usage\n\n```ts\nimport { scrubPii, scrubPiiDeep, scrubMessagesForModel } from '@bagdock/pii-patterns'\n\n// Scrub a single string\nscrubPii('Email me at john@example.com')\n// → 'Email me at [EMAIL_REDACTED]'\n\n// Recursively scrub nested objects\nscrubPiiDeep({ email: 'john@example.com', count: 42 })\n// → { email: '[EMAIL_REDACTED]', count: 42 }\n\n// Scrub user messages before sending to an AI model\nconst messages = [\n  { role: 'system', content: 'You are helpful.' },\n  { role: 'user', content: 'My SSN is 123-45-6789' },\n]\nscrubMessagesForModel(messages)\n// → [{ role: 'system', content: 'You are helpful.' },\n//    { role: 'user', content: 'My SSN is [SSN_REDACTED]' }]\n```\n\n## API\n\n### `scrubPii(text: string): string`\n\nApplies all 15 PII patterns in order and returns the redacted string.\n\n### `scrubPiiDeep(value: unknown): unknown`\n\nRecursively walks objects and arrays, scrubbing any string values. Non-string primitives pass through unchanged.\n\n### `scrubMessagesForModel<T>(messages: T[]): T[]`\n\nScrubs PII from `user` role messages before AI inference. Assistant and system messages pass through unchanged. Returns a shallow copy — originals are not mutated.\n\n## Patterns\n\n15 PII types are detected and redacted:\n\n| Pattern | Token | Coverage |\n|---------|-------|----------|\n| Email address | `[EMAIL_REDACTED]` | Global |\n| Social Security Number | `[SSN_REDACTED]` | US |\n| National Insurance Number | `[NINO_REDACTED]` | UK |\n| IBAN | `[IBAN_REDACTED]` | EU/UK |\n| NHS Number | `[NHS_REDACTED]` | UK |\n| PPS Number | `[PPSN_REDACTED]` | Ireland |\n| Driving Licence | `[LICENCE_REDACTED]` | UK (DVLA format) |\n| Sort Code + Account | `[BANKACCT_REDACTED]` | UK |\n| VAT Number | `[VAT_REDACTED]` | EU |\n| Credit/Debit Card | `[CARD_REDACTED]` | Global |\n| Phone Number | `[PHONE_REDACTED]` | Global |\n| Date of Birth | `[DOB_REDACTED]` | Global |\n| Postcode | `[POSTCODE_REDACTED]` | UK |\n| ZIP Code | `[ZIP_REDACTED]` | US |\n| Passport/ID Number | `[ID_REDACTED]` | Global |\n\n## Defense-in-depth\n\nThis package provides **client-side** PII scrubbing as a defense-in-depth layer.\nIt is **not** a substitute for server-side controls. The Bagdock platform applies\nauthoritative PII scrubbing on the server edge before any AI model receives input.\n\n## License\n\nMIT — see [LICENSE](LICENSE).\n","readmeFilename":"README.md"}