{"_id":"@1000hz/smile","_rev":"2-79363f5bf6fbeb2568591c0d1b906074","name":"@1000hz/smile","dist-tags":{"latest":"0.0.0-alpha.c4830ab"},"versions":{"0.0.0-alpha.5ed4d1d":{"name":"@1000hz/smile","version":"0.0.0-alpha.5ed4d1d","_id":"@1000hz/smile@0.0.0-alpha.5ed4d1d","maintainers":[{"name":"1000hz","email":"itscina@gmail.com"}],"dist":{"shasum":"10c4b17ba128e4d950585a825048a0ffe6d16b14","tarball":"https://registry.npmjs.org/@1000hz/smile/-/smile-0.0.0-alpha.5ed4d1d.tgz","fileCount":4,"integrity":"sha512-f++LbizGA5ai4ak2KMv9gIrRhevKg7Aemq2SGJKAXi46m4loyhCHuZtsxt6iWGbKdhOnMXQcLDo2M3o8zsPyNQ==","signatures":[{"sig":"MEUCID/3wrH/KPl12ctjAqv9w5S+9IaoI93h3ZuhrKX5CzekAiEA4jm0w4pa/xTra8ijLjFuwNYKhbRxvgmHHw/OLIahwgg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13306},"exports":{".":{"types":"./dist/smile.d.ts","import":"./dist/smile.mjs"}},"gitHead":"5ed4d1de405b570f327a36b8af7229433a5af038","scripts":{"dev":"wrangler dev","test":"vitest","build":"vite build && tsc","start":"wrangler dev","cf-typegen":"wrangler types"},"_npmUser":{"name":"1000hz","email":"itscina@gmail.com"},"_npmVersion":"10.2.3","description":"> A _la**s**t-**mile**_ session cache for Cloudflare Workers","directories":{},"_nodeVersion":"20.10.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^6.0.3","vitest":"^2.1.8","wrangler":"^3.60.3","typescript":"^5.5.2","@cloudflare/workers-types":"^4.20241022.0","@cloudflare/vitest-pool-workers":"^0.5.38"},"_npmOperationalInternal":{"tmp":"tmp/smile_0.0.0-alpha.5ed4d1d_1737754686440_0.29217473153139206","host":"s3://npm-registry-packages-npm-production"}},"0.0.0-alpha.5f96481":{"name":"@1000hz/smile","version":"0.0.0-alpha.5f96481","_id":"@1000hz/smile@0.0.0-alpha.5f96481","maintainers":[{"name":"1000hz","email":"itscina@gmail.com"}],"dist":{"shasum":"b51eb3e6bc001a9dcca94f27996a6cee9025f4d8","tarball":"https://registry.npmjs.org/@1000hz/smile/-/smile-0.0.0-alpha.5f96481.tgz","fileCount":4,"integrity":"sha512-4Y1lk2hG1FsEVQdwBlxd+jhMTevcWCY8R+YtyHV99QBLZBOoiQTzTHju/Relyf1M9wCJLIVE0Mg73To4yEvv1g==","signatures":[{"sig":"MEUCICE5S5cpzJfEgq1COpQIll3gNxZiYXQXSTVQmWlSMTLiAiEA0r14nabyN/787bZdFPv5a3FilvxXDsG5yu28L51li0Y=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13686},"exports":{".":{"types":"./dist/smile.d.ts","import":"./dist/smile.mjs"}},"gitHead":"5f96481cdf88e13ea49f04435318e8c439497c49","scripts":{"dev":"wrangler dev","test":"vitest","build":"vite build && tsc","start":"wrangler dev","cf-typegen":"wrangler types"},"_npmUser":{"name":"1000hz","email":"itscina@gmail.com"},"_npmVersion":"10.2.3","description":"> A _la**s**t-**mile**_ session cache for Cloudflare Workers","directories":{},"_nodeVersion":"20.10.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^6.0.3","vitest":"^2.1.8","wrangler":"^3.60.3","typescript":"^5.5.2","@cloudflare/workers-types":"^4.20241022.0","@cloudflare/vitest-pool-workers":"^0.5.38"},"_npmOperationalInternal":{"tmp":"tmp/smile_0.0.0-alpha.5f96481_1738340897053_0.14029059536811506","host":"s3://npm-registry-packages-npm-production"}},"0.0.0-alpha.c4830ab":{"name":"@1000hz/smile","version":"0.0.0-alpha.c4830ab","exports":{".":{"import":"./dist/smile.mjs","types":"./dist/smile.d.ts"}},"publishConfig":{"access":"public"},"scripts":{"test":"vitest","dev":"wrangler dev","build":"vite build && tsc","start":"wrangler dev","cf-typegen":"wrangler types","version:prerelease":"npm version --no-git-tag-version 0.0.0-alpha.$(git rev-parse --short HEAD)","publish:prerelease":"pnpm run build && pnpm run version:prerelease && npm publish && git checkout HEAD package.json"},"devDependencies":{"@cloudflare/vitest-pool-workers":"^0.5.38","@cloudflare/workers-types":"^4.20241022.0","typescript":"^5.5.2","vite":"^6.0.3","vitest":"^2.1.8","wrangler":"^3.60.3"},"_id":"@1000hz/smile@0.0.0-alpha.c4830ab","gitHead":"c4830ab1760608b52f4525f616c5c3cef915fde6","description":"> A _la**s**t-**mile**_ session cache for Cloudflare Workers","_nodeVersion":"20.10.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-jzHb7H64x5lJYiOICwbtrYN84pdDbJLbYtEjvjdOQL1VvyoVOVOxZli33XB/kt/fsZNSa60WJx2zWW1B55t3vA==","shasum":"b71a502e0b1504afd75b034676829cbc4597bbbb","tarball":"https://registry.npmjs.org/@1000hz/smile/-/smile-0.0.0-alpha.c4830ab.tgz","fileCount":4,"unpackedSize":13667,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDVr4rYxz7PfrHdGD8u8IB0kQVA8yS3uzSsl31gVe/h+QIgB91bKlCm20xfrmElJi8XxOsVb/WLN5tFbTTI1p3a3qg="}]},"_npmUser":{"name":"1000hz","email":"itscina@gmail.com"},"directories":{},"maintainers":[{"name":"1000hz","email":"itscina@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/smile_0.0.0-alpha.c4830ab_1740437466453_0.46375200086389423"},"_hasShrinkwrap":false}},"time":{"created":"2025-01-24T21:38:06.327Z","modified":"2025-02-24T22:51:06.812Z","0.0.0-alpha.5ed4d1d":"2025-01-24T21:38:06.632Z","0.0.0-alpha.5f96481":"2025-01-31T16:28:17.297Z","0.0.0-alpha.c4830ab":"2025-02-24T22:51:06.633Z"},"description":"> A _la**s**t-**mile**_ session cache for Cloudflare Workers","maintainers":[{"name":"1000hz","email":"itscina@gmail.com"}],"readme":"# smile :)\n\n> A _la**s**t-**mile**_ session cache for Cloudflare Workers\n\nSmile is a private HTTP cache implemented on Durable Objects. It brings your application's data close to the user to make repeated requests super-fast. It uses stale-while-revalidate caching by default when no `Cache-Control` directives are present in the request or response.\n\n## Installation\n\n```\npnpm add @cloudflare/smile\n```\n\n## Usage\n\nInclude a new migration and Durable Object binding to Smile in your `wrangler.toml`:\n\n```toml\n[[migrations]]\ntag = \"v1\"\nnew_sqlite_classes = [\"Smile\"]\n\n[[durable_objects.bindings]]\nname = \"SMILE\"\nclass_name = \"Smile\"\n```\n\nThen get a stub to an instance of Smile inside of your Worker. Caches are scoped by the ID you use to instantiate your Durable Object, so it's recommended to use a session ID coming from the request. Then, simply fetch through your Smile instance and enjoy faster response times.\n\n```js\n// worker.js\n\nexport { Smile } from '@cloudflare/smile'; // re-export the Durable Object class so it gets included in your Worker bundle\n\nexport default {\n\tfetch(request, env, ctx) {\n\t\tconst sessionId = request.headers.get('x-session-id'); // In practice, you'll probably get the session ID from a cookie\n\n\t\tconst cacheId = env.SMILE.idFromName(sessionId);\n\t\tconst smile = env.SMILE.get(cacheId);\n\n\t\treturn smile.fetch(request);\n\t},\n};\n```\n","readmeFilename":"README.md"}