{"_id":"@athidden/uri","_rev":"2-0e44c2def97e64b52285c07966d7dd8b","name":"@athidden/uri","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@athidden/uri","version":"0.1.0","author":{"url":"https://foxgirl.dev/","name":"Lua","email":"lua@foxgirl.dev"},"license":"MIT","_id":"@athidden/uri@0.1.0","maintainers":[{"name":"luavixen","email":"lua@foxgirl.dev"}],"homepage":"https://github.com/luavixen/athidden","bugs":{"url":"https://github.com/athidden/athidden/issues"},"dist":{"shasum":"1a455977653c1fd4913bdc13b1b3a62bcb93139e","tarball":"https://registry.npmjs.org/@athidden/uri/-/uri-0.1.0.tgz","fileCount":4,"integrity":"sha512-A/Azg9FK4spQB1c5Fge6WhOi5dHrVz86WtgF2GJ34tCx4zGV7yCQv0sPyHkv7fnnTgbqcIghjnlMiCbfqJ1MhQ==","signatures":[{"sig":"MEYCIQDAlfNcVp8LZ1Ci+kiIABDizm2csNTPbdgsIf20Y9+KqAIhAPnEl5RZ5tKRoo3zCaXF+ORtREn1HQXu9mVl8DkXfg/V","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":14619},"type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","gitHead":"975827e7dc4909d397157a1eff2ddf64d1967f6c","private":false,"scripts":{"test":"bun test","build":"tsc --project tsconfig.build.json","prepublish":"rm -rf dist && bun run build && bun run test"},"_npmUser":{"name":"luavixen","email":"lua@foxgirl.dev"},"repository":{"url":"git+https://github.com/luavixen/athidden.git","directory":"packages/uri"},"_npmVersion":"11.12.1","description":"Parse and validate restricted AT URIs with support for both `at://` and `athidden://` protocols.","directories":{},"_nodeVersion":"25.9.0","dependencies":{"@atproto/syntax":"^0.5.3"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"^1.3.11","typescript":"latest"},"_npmOperationalInternal":{"tmp":"tmp/uri_0.1.0_1775257554816_0.0003168946883558288","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@athidden/uri","version":"0.1.1","private":false,"description":"Parse and validate restricted AT URIs with support for both `at://` and `athidden://` protocols.","author":{"name":"Lua","email":"lua@foxgirl.dev","url":"https://foxgirl.dev/"},"license":"MIT","repository":{"url":"git+https://github.com/athidden/athidden.git","directory":"packages/uri"},"bugs":{"url":"https://github.com/athidden/athidden/issues"},"homepage":"https://github.com/athidden/athidden","type":"module","module":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"test":"bun test","build":"tsc --project tsconfig.build.json","prepublish":"rm -rf dist && bun run build && bun run test"},"dependencies":{"@atproto/syntax":"^0.5.3"},"devDependencies":{"@types/bun":"^1.3.11","typescript":"latest"},"gitHead":"5173caeddf997f71f8baeb0aea2e8a4355c9098a","_id":"@athidden/uri@0.1.1","_nodeVersion":"25.9.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-PqXm4x4wSyxB3dUJjmgO39TBMyCnDi4s+z6BSYhweA/fkX8O4S4dEwYpNS4YNSRhFGcqFsmY/0hcIDMlnAq4Nw==","shasum":"661299d75d6dce361c69d52c89d35600f2d11758","tarball":"https://registry.npmjs.org/@athidden/uri/-/uri-0.1.1.tgz","fileCount":4,"unpackedSize":14623,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDJn1VLup5xV6wnxBP9nXXXl3cdHWiTx3nyveozhKcCwQIgHnjLm85YKvI8RkEFR8hDwKc190d9gMFIta3oArIfwiI="}]},"_npmUser":{"name":"luavixen","email":"lua@foxgirl.dev"},"directories":{},"maintainers":[{"name":"luavixen","email":"lua@foxgirl.dev"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/uri_0.1.1_1775257816132_0.6299670587203443"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-03T23:05:54.692Z","modified":"2026-04-03T23:10:16.436Z","0.1.0":"2026-04-03T23:05:54.970Z","0.1.1":"2026-04-03T23:10:16.289Z"},"bugs":{"url":"https://github.com/athidden/athidden/issues"},"author":{"name":"Lua","email":"lua@foxgirl.dev","url":"https://foxgirl.dev/"},"license":"MIT","homepage":"https://github.com/athidden/athidden","repository":{"url":"git+https://github.com/athidden/athidden.git","directory":"packages/uri"},"description":"Parse and validate restricted AT URIs with support for both `at://` and `athidden://` protocols.","maintainers":[{"name":"luavixen","email":"lua@foxgirl.dev"}],"readme":"# @athidden/uri\nParse and validate [restricted AT URIs](https://atproto.com/pt/specs/at-uri-scheme#restricted-at-uri-syntax) with support for both `at://` and `athidden://` protocols.\n\n## Usage\n\n```ts\nimport { AtHiddenUri } from '@athidden/uri'\n\n// Parse from a URI string\nconst uri = new AtHiddenUri('at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.post/3l6oveex3ii2l')\n\nuri.protocol   // 'at:'\nuri.hidden     // false\nuri.repo       // 'did:plc:z72i7hdynmk6r22z27h6tvur'\nuri.collection // 'app.bsky.feed.post'\nuri.rkey       // '3l6oveex3ii2l'\nuri.toString() // 'at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.post/3l6oveex3ii2l'\n\n// athidden:// protocol\nconst hidden = new AtHiddenUri('athidden://did:plc:z72i7hdynmk6r22z27h6tvur/ooo.bsky.hidden.post/3l6oveex3ii2l')\n\nhidden.protocol // 'athidden:'\nhidden.hidden   // true\n\n// Construct from options\nconst fromOpts = new AtHiddenUri({\n  hidden: true,\n  repo: 'did:plc:z72i7hdynmk6r22z27h6tvur',\n  collection: 'app.bsky.feed.post',\n  rkey: '3l6oveex3ii2l',\n})\nfromOpts.toString() // 'athidden://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.post/3l6oveex3ii2l'\n\n// Repo-only and collection-only URIs\nconst repoOnly = new AtHiddenUri('at://did:plc:z72i7hdynmk6r22z27h6tvur')\nrepoOnly.collection // undefined\nrepoOnly.rkey       // undefined\n\nconst withCollection = new AtHiddenUri('at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.post')\nwithCollection.collection // 'app.bsky.feed.post'\nwithCollection.rkey       // undefined\n\n// Handle-based URIs work too!\nconst handleUri = new AtHiddenUri('at://bsky.app/app.bsky.feed.post/3l6oveex3ii2l')\nhandleUri.repo // 'bsky.app'\n\n// Type guards for narrowing\nconst full = new AtHiddenUri('at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.post/3l6oveex3ii2l')\n\nfull.hasDid()        // true  - repo is a DID, not a handle\nfull.hasCollection() // true  - collection component is present\nfull.hasRecord()     // true  - both collection and rkey are present\nfull.isCanon()       // true  - DID repo + collection + rkey (canonical form!)\n\nif (full.isCanon()) {\n  console.log(full.rkey.length) // TypeScript knows that full.rkey is valid due to the type guard\n}\n\n// Safe parsing (returns null instead of throwing)\nAtHiddenUri.parse('at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.post/3l6oveex3ii2l') // AtHiddenUri\nAtHiddenUri.parse('garbage') // null\n\n// Validation errors\nnew AtHiddenUri('https://example.com')      // throws InvalidUriError (bad protocol)\nnew AtHiddenUri('at://did:bad')             // throws InvalidHandleError (malformed identifier)\nnew AtHiddenUri('at://did:plc:abc/bad')     // throws InvalidNsidError (invalid collection)\nnew AtHiddenUri('at://did:plc:abc/a.b.c/.') // throws InvalidRecordKeyError (invalid rkey)\n```\n\n## License\nLicensed under the [MIT License](LICENSE).\n","readmeFilename":"README.md"}