{"_id":"@_all_docs/cache","_rev":"6-8eb3d28d0109344ecfe03de584bc9c39","name":"@_all_docs/cache","dist-tags":{"latest":"0.5.1"},"versions":{"0.0.1":{"name":"@_all_docs/cache","version":"0.0.1","keywords":["relax","couchdb","_all_docs"],"author":{"name":"Charlie Robbins","email":"npm@charlie.dev"},"license":"Apache-2.0","_id":"@_all_docs/cache@0.0.1","maintainers":[{"name":"indexzero","email":"charlie.robbins@gmail.com"}],"homepage":"https://github.com/indexzero/_all_docs#readme","bugs":{"url":"https://github.com/indexzero/_all_docs/issues"},"bin":{"_all_docs_partipacku":"bin/packuments-fetch-for-partition.js","_all_docs_from_origin":"bin/partitions-fetch-from-origin.js"},"dist":{"shasum":"fde56f7eedd8ad8d7805c42d2e16b2b1ab037cc3","tarball":"https://registry.npmjs.org/@_all_docs/cache/-/cache-0.0.1.tgz","fileCount":15,"integrity":"sha512-2eGugG1Wt9zdo224Q5uP6B4KjqBRlJrMIxCLStLzZDD44Oyl0PsgPk29wi2JXuAePExOwvWFRqgRIjEv1oFkbg==","signatures":[{"sig":"MEUCIQCysSGOIcDCGo34Zb5oiUmjKWtMFGU5AOzbTTm4R9CNKQIgQaelL8Z5JZnkp1Zboel0kSX41JQRxsCuvb2sF0Rz71k=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":246462},"main":"src/index.js","gitHead":"e8896601439878e25931df9d9bdf509498d1e547","scripts":{"test":"node --test test/index.test.js"},"_npmUser":{"name":"indexzero","email":"charlie.robbins@gmail.com"},"repository":{"url":"git+https://github.com/indexzero/_all_docs.git","type":"git"},"_npmVersion":"10.9.2","description":"Fetch, cache, & map/reduce :origin/{_all_docs,:packument}` documents for a set of lexographically sorted pivots by range or partition","directories":{},"_nodeVersion":"22.14.0","dependencies":{"nano":"^10.1.4","debug":"^4.4.0","p-map":"^7.0.3","undici":"^7.4.0","p-queue":"^8.1.0","p-retry":"^6.2.1","p-debounce":"^4.0.0","p-map-series":"^3.0.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/cache_0.0.1_1742840978701_0.9309359441607243","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@_all_docs/cache","version":"0.0.2","keywords":["relax","couchdb","_all_docs"],"author":{"name":"Charlie Robbins","email":"npm@charlie.dev"},"license":"Apache-2.0","_id":"@_all_docs/cache@0.0.2","maintainers":[{"name":"indexzero","email":"charlie.robbins@gmail.com"}],"homepage":"https://github.com/indexzero/_all_docs#readme","bugs":{"url":"https://github.com/indexzero/_all_docs/issues"},"bin":{"_all_docs_partipacku":"bin/packuments-fetch-for-partition.js","_all_docs_from_origin":"bin/partitions-fetch-from-origin.js"},"dist":{"shasum":"9e8cc63b6a6b3a54ac981e5b2eb980dc38822386","tarball":"https://registry.npmjs.org/@_all_docs/cache/-/cache-0.0.2.tgz","fileCount":24,"integrity":"sha512-E1geH0EoPaexFLog7WmZYQUWVRVS01RwZFwwrEjvyU5jTE0uzOMbKCXni0mFBUITSYCf6D2D4jfLqCZfh60tTg==","signatures":[{"sig":"MEYCIQCVqYbGWJnV9OY9JWVUnNOuCjvb/ZXh/0+lGikErXDXiwIhAPhofLCli1HKXgm1ReRGbGvL8zfW3xY0xp2TCLMFneJ1","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":47532},"main":"src/index.js","gitHead":"7c208c574987052c75ba3acc42246b4d70f32018","scripts":{"test":"node --test test/index.test.js"},"_npmUser":{"name":"indexzero","email":"charlie.robbins@gmail.com"},"repository":{"url":"git+https://github.com/indexzero/_all_docs.git","type":"git"},"_npmVersion":"10.9.2","description":"Fetch, cache, & map/reduce :origin/{_all_docs,:packument}` documents for a set of lexographically sorted pivots by range or partition","directories":{},"_nodeVersion":"22.14.0","dependencies":{"nano":"^10.1.4","debug":"^4.4.0","delay":"^6.0.0","p-map":"^7.0.3","undici":"^7.4.0","p-queue":"^8.1.0","p-retry":"^6.2.1","minimist":"^1.2.8","p-debounce":"^4.0.0","p-map-series":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"npm-high-impact":"^1.10.0"},"_npmOperationalInternal":{"tmp":"tmp/cache_0.0.2_1742841072025_0.17235830904147775","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"@_all_docs/cache","version":"0.0.3","keywords":["relax","couchdb","_all_docs"],"author":{"name":"Charlie Robbins","email":"npm@charlie.dev"},"license":"Apache-2.0","_id":"@_all_docs/cache@0.0.3","maintainers":[{"name":"indexzero","email":"charlie.robbins@gmail.com"}],"homepage":"https://github.com/indexzero/_all_docs#readme","bugs":{"url":"https://github.com/indexzero/_all_docs/issues"},"bin":{"_all_docs_partipacku":"bin/packuments-fetch-for-partition.js","_all_docs_from_origin":"bin/partitions-fetch-from-origin.js"},"dist":{"shasum":"572e1e9aaf40f018706c3e86874cfdd8524f8801","tarball":"https://registry.npmjs.org/@_all_docs/cache/-/cache-0.0.3.tgz","fileCount":25,"integrity":"sha512-bPcyzW3KN2BL/DWLl/tyTBdVd8IyeVrYDYk/rAes138lq3pwTXrRldor0+6nt5m9uhypjjNwlGhdDw66lRicbA==","signatures":[{"sig":"MEUCIQDlJrAYdVr9NYWrQnyDzNUN2F7QcsxUrDpmHA0TkfjvbQIgAKUynZIJGzHbWXysAR9j9P6dueeWNDhC9gz7LE0k0Ng=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":47889},"main":"src/index.js","gitHead":"84015fa8a5f2b5846bf2a6ef611f0c75b0094b60","scripts":{"test":"node --test test/index.test.js"},"_npmUser":{"name":"indexzero","email":"charlie.robbins@gmail.com"},"repository":{"url":"git+https://github.com/indexzero/_all_docs.git","type":"git"},"_npmVersion":"10.9.2","description":"Fetch, cache, & map/reduce :origin/{_all_docs,:packument}` documents for a set of lexographically sorted pivots by range or partition","directories":{},"_nodeVersion":"22.14.0","dependencies":{"nano":"^10.1.4","debug":"^4.4.0","delay":"^6.0.0","p-map":"^7.0.3","undici":"^7.4.0","p-queue":"^8.1.0","p-retry":"^6.2.1","minimist":"^1.2.8","p-debounce":"^4.0.0","p-map-series":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"npm-high-impact":"^1.10.0"},"_npmOperationalInternal":{"tmp":"tmp/cache_0.0.3_1743706019937_0.056573570848533095","host":"s3://npm-registry-packages-npm-production"}},"0.1.0":{"name":"@_all_docs/cache","version":"0.1.0","author":{"name":"Charlie Robbins","email":"npm@charlie.dev"},"license":"Apache-2.0","_id":"@_all_docs/cache@0.1.0","maintainers":[{"name":"indexzero","email":"charlie.robbins@gmail.com"}],"homepage":"https://github.com/indexzero/_all_docs#readme","bugs":{"url":"https://github.com/indexzero/_all_docs/issues"},"dist":{"shasum":"92cc32ec7c84cca0a919dfaf4a60ceeaa41197ef","tarball":"https://registry.npmjs.org/@_all_docs/cache/-/cache-0.1.0.tgz","fileCount":4,"integrity":"sha512-2GyPbEnWUfIEu9/XR8CIOBWIs6v7FXVp8l7mcarJHVAOJKJd6C3QpZybau6Uf3R2Bbztap9iUTbO043Ig6D5Dg==","signatures":[{"sig":"MEUCIEA+cIj7aYJqBjhHlcDWBSchxuERK3eHWH/N6lVp1oQLAiEA62adoYKMCdumZN5dWEBI3Z6U1SoDJUtEmqYYibOO/fc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13928},"main":"index.js","type":"module","_from":"file:_all_docs-cache-0.1.0.tgz","scripts":{"lint":"xo","lint:fix":"xo --fix"},"_npmUser":{"name":"indexzero","email":"charlie.robbins@gmail.com"},"_resolved":"/tmp/71b3be1db006dcd453ac2fd6cb3b9f22/_all_docs-cache-0.1.0.tgz","_integrity":"sha512-2GyPbEnWUfIEu9/XR8CIOBWIs6v7FXVp8l7mcarJHVAOJKJd6C3QpZybau6Uf3R2Bbztap9iUTbO043Ig6D5Dg==","repository":{"url":"git+https://github.com/indexzero/_all_docs.git","type":"git","directory":"src/cache"},"_npmVersion":"10.9.2","description":"A hierarchical file-system buffer cache for HTTP responses","directories":{},"_nodeVersion":"22.17.1","dependencies":{"@vltpkg/cache":"0.0.0-9","@vltpkg/registry-client":"0.0.0-9"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/cache_0.1.0_1754373674267_0.22645683653344717","host":"s3://npm-registry-packages-npm-production"}},"0.5.0":{"name":"@_all_docs/cache","version":"0.5.0","author":{"name":"Charlie Robbins","email":"npm@charlie.dev"},"license":"Apache-2.0","_id":"@_all_docs/cache@0.5.0","maintainers":[{"name":"indexzero","email":"charlie.robbins@gmail.com"}],"homepage":"https://github.com/indexzero/_all_docs#readme","bugs":{"url":"https://github.com/indexzero/_all_docs/issues"},"dist":{"shasum":"552262fc888bd9b30f424431418a08becad13f40","tarball":"https://registry.npmjs.org/@_all_docs/cache/-/cache-0.5.0.tgz","fileCount":23,"integrity":"sha512-MAgiEQ4hTqq3eAowg6e9BNbItGPp8NEHc/PBHYnO/+/QomOXTKj+n+lP9JR9q2IRFJj0RwMKymDIrHU/MZMrmA==","signatures":[{"sig":"MEQCIDIH5upKEYx3tzaHreGqECtxeI7r86y/Q0ARHxTuNVOJAiANvDOikKDvK3l10EJME8BoC6B9QC3LcYKt7oU2HgNz8g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@_all_docs%2fcache@0.5.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":96345},"main":"index.js","type":"module","_from":"file:_all_docs-cache-0.5.0.tgz","scripts":{"lint":"xo","test":"node --test test/*.test.js","lint:fix":"xo --fix"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:e2cadc58-9abb-4ea3-813a-4cbc4a052c2a"}},"_resolved":"/tmp/622d125b536e28678ab12519b76dd3f9/_all_docs-cache-0.5.0.tgz","_integrity":"sha512-MAgiEQ4hTqq3eAowg6e9BNbItGPp8NEHc/PBHYnO/+/QomOXTKj+n+lP9JR9q2IRFJj0RwMKymDIrHU/MZMrmA==","repository":{"url":"git+https://github.com/indexzero/_all_docs.git","type":"git","directory":"src/cache"},"_npmVersion":"11.6.2","description":"A hierarchical file-system buffer cache for HTTP responses","directories":{},"_nodeVersion":"24.13.0","dependencies":{"undici":"^7.13.0","bloom-filters":"^3.0.2"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"^6.0.1"},"_npmOperationalInternal":{"tmp":"tmp/cache_0.5.0_1770009298655_0.5418267392489959","host":"s3://npm-registry-packages-npm-production"}},"0.5.1":{"name":"@_all_docs/cache","description":"A hierarchical file-system buffer cache for HTTP responses","version":"0.5.1","main":"index.js","type":"module","repository":{"type":"git","url":"git+https://github.com/indexzero/_all_docs.git","directory":"src/cache"},"author":{"name":"Charlie Robbins","email":"npm@charlie.dev"},"license":"Apache-2.0","bugs":{"url":"https://github.com/indexzero/_all_docs/issues"},"homepage":"https://github.com/indexzero/_all_docs#readme","dependencies":{"bloom-filters":"^3.0.2","undici":"^7.13.0"},"devDependencies":{"rimraf":"^6.0.1"},"scripts":{"test":"node --test test/*.test.js","lint":"xo","lint:fix":"xo --fix"},"_id":"@_all_docs/cache@0.5.1","_integrity":"sha512-gcDyyWDdr/ZCzSh+sAOwy4Y5ZkKsGKp1tw82/Fj3/IexfBA5oqbyzHGwDC6duUu3azojLcRvjbdxfx9nv1VGlA==","_resolved":"/tmp/a5f976050f8504971941025faf0e5e0b/_all_docs-cache-0.5.1.tgz","_from":"file:_all_docs-cache-0.5.1.tgz","_nodeVersion":"24.13.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-gcDyyWDdr/ZCzSh+sAOwy4Y5ZkKsGKp1tw82/Fj3/IexfBA5oqbyzHGwDC6duUu3azojLcRvjbdxfx9nv1VGlA==","shasum":"a96b04b8dd12d210fc5c1c5b8ef0ae2c905c16c1","tarball":"https://registry.npmjs.org/@_all_docs/cache/-/cache-0.5.1.tgz","fileCount":23,"unpackedSize":96345,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@_all_docs%2fcache@0.5.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCiIh0mHROTEghu1woETozzoJYQqi7ckzBPSfVfwKQ4JQIhAMTItf1RF2Bzd1G22rG9oYn4UPAVm3m8bp6ZT2Up8ycm"}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:e2cadc58-9abb-4ea3-813a-4cbc4a052c2a"}},"directories":{},"maintainers":[{"name":"indexzero","email":"charlie.robbins@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/cache_0.5.1_1770010118971_0.21187154793133955"},"_hasShrinkwrap":false}},"time":{"created":"2025-03-24T18:29:38.552Z","modified":"2026-02-02T05:28:39.387Z","0.0.1":"2025-03-24T18:29:38.901Z","0.0.2":"2025-03-24T18:31:12.201Z","0.0.3":"2025-04-03T18:47:00.122Z","0.1.0":"2025-08-05T06:01:14.443Z","0.5.0":"2026-02-02T05:14:58.815Z","0.5.1":"2026-02-02T05:28:39.113Z"},"bugs":{"url":"https://github.com/indexzero/_all_docs/issues"},"author":{"name":"Charlie Robbins","email":"npm@charlie.dev"},"license":"Apache-2.0","homepage":"https://github.com/indexzero/_all_docs#readme","repository":{"type":"git","url":"git+https://github.com/indexzero/_all_docs.git","directory":"src/cache"},"description":"A hierarchical file-system buffer cache for HTTP responses","maintainers":[{"name":"indexzero","email":"charlie.robbins@gmail.com"}],"readme":"# @_all_docs/cache\n\nEnhanced caching package with cross-runtime HTTP client and advanced cache features.\n\n## Overview\n\nThis package provides:\n- Cross-runtime HTTP client with undici compatibility\n- Cache entry management with HTTP semantics\n- Versioned cache key generation\n- Checkpoint system for tracking progress\n- Bloom filters for efficient existence checks\n- Request coalescing to prevent duplicate operations\n\n## Installation\n\n```sh\npnpm add @_all_docs/cache\n```\n\n## Usage\n\n### BaseHTTPClient\n\nCross-runtime HTTP client that works in Node.js and edge environments:\n\n```js\nimport { BaseHTTPClient, createDispatcher } from '@_all_docs/cache';\n\n// Create client with optional undici dispatcher\nconst dispatcher = await createDispatcher(env);\nconst client = new BaseHTTPClient('https://api.example.com', {\n  dispatcher,\n  requestTimeout: 30000,\n  userAgent: 'my-app/1.0'\n});\n\n// Make requests\nconst response = await client.request('/endpoint', {\n  headers: { 'Accept': 'application/json' }\n});\n\n// Use cache validation headers\nclient.setCacheHeaders(options, cacheEntry);\n```\n\n### CacheEntry\n\nManage HTTP cache entries with proper semantics:\n\n```js\nimport { CacheEntry } from '@_all_docs/cache';\n\nconst entry = new CacheEntry(200, {\n  'content-type': 'application/json',\n  'cache-control': 'max-age=3600',\n  'etag': '\"abc123\"'\n});\n\nawait entry.setBody({ data: 'value' });\n\n// Check validity\nif (entry.valid) {\n  const data = entry.json();\n}\n\n// Verify integrity\nconst isValid = await entry.verifyIntegrity();\n\n// Encode/decode for storage\nconst encoded = entry.encode();\nconst decoded = CacheEntry.decode(encoded);\n```\n\n### Cache with Storage Drivers\n\nAdvanced cache with pluggable storage backends:\n\n```js\nimport { Cache } from '@_all_docs/cache';\n\nconst cache = new Cache({\n  path: '/cache/path',\n  env: { RUNTIME: 'node' },\n  bloomSize: 10000,\n  bloomFalsePositiveRate: 0.01\n});\n\n// Basic operations\nawait cache.set('key', { value: 'data' });\nconst value = await cache.fetch('key');\nconst exists = await cache.has('key');\nawait cache.delete('key');\n\n// Iterate over entries\nfor await (const entry of cache) {\n  console.log(entry.key, entry.value);\n}\n\n// List keys with prefix\nfor await (const key of cache.keys('prefix:')) {\n  console.log(key);\n}\n```\n\n### Cache Keys\n\nGenerate versioned, cross-platform compatible cache keys:\n\n```js\nimport { \n  createPartitionKey, \n  createPackumentKey,\n  decodeCacheKey \n} from '@_all_docs/cache';\n\n// Partition cache key\nconst partKey = createPartitionKey('start', 'end', 'https://registry.npmjs.com');\n// => \"v1:partition:npm:7374617274:656e64\"\n\n// Packument cache key\nconst pkgKey = createPackumentKey('@scope/package', 'https://registry.npmjs.com');\n// => \"v1:packument:npm:4073636f70652f7061636b616765\"\n\n// Decode keys\nconst decoded = decodeCacheKey(partKey);\n// => { version: 'v1', type: 'partition', origin: '...', startKey: 'start', endKey: 'end' }\n```\n\n### Checkpoint System\n\nTrack progress of partition set processing:\n\n```js\nimport { PartitionCheckpoint } from '@_all_docs/cache';\n\nconst checkpoint = new PartitionCheckpoint(cache, 'partition-set-id');\n\n// Initialize with partitions\nawait checkpoint.initialize([\n  { startKey: 'a', endKey: 'b' },\n  { startKey: 'b', endKey: 'c' }\n]);\n\n// Track progress\nawait checkpoint.markInProgress(0);\nawait checkpoint.markCompleted(0, { rows: 1000 });\n\n// Get statistics\nconst progress = await checkpoint.getProgress();\nconsole.log(progress.stats); // { total: 2, completed: 1, pending: 1, ... }\nconsole.log(progress.percentComplete); // 50\n```\n\n## Features\n\n- **Bloom Filters** - Quickly check non-existence without storage lookup\n- **Request Coalescing** - Prevent duplicate concurrent requests\n- **Lazy Driver Initialization** - Load storage driver on first use\n- **Cross-Runtime Crypto** - Uses Web Crypto API or Node.js crypto\n- **Trace Headers** - Automatic request tracing with unique IDs\n- **Conditional Requests** - Support for If-None-Match and If-Modified-Since\n\n## Testing\n\n```sh\npnpm test\n```\n\n## License\n\nApache-2.0","readmeFilename":"README.md"}