{"_id":"@mesub/node","_rev":"10-26c713a88c1d6a018fa0284be2307b93","name":"@mesub/node","dist-tags":{"latest":"0.1.7"},"versions":{"0.0.0-stage":{"name":"@mesub/node","version":"0.0.0-stage","_id":"@mesub/node@0.0.0-stage","stub":true,"maintainers":[{"name":"ft_gring0","email":"emiledubdart@gmail.com"}],"dist":{"shasum":"0b0db148ec19551ffa2843ef3538e8c0a5e29c95","tarball":"https://registry.npmjs.org/@mesub/node/-/node-0.0.0-stage.tgz","fileCount":2,"integrity":"sha512-vQ4Zwa+GOjBwQl/7EsZ9NzRZV42X8hd/L79+FnrP/Kv+243wxGrZwjh4iL+bLY2tIMuc9azi2h+lWplyGduSug==","signatures":[{"sig":"MEYCIQCwoxjN4Euhmos1jYRVbs8KOrd3aPnSp3/Z2PdWsxD0VQIhAMKK8ccutDilDZTN3yIMCILPFx74g19obz1SgaYZ05a9","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":333},"_npmUser":{"name":"ft_gring0","email":"emiledubdart@gmail.com"},"deprecated":"Placeholder, install @mesub/node@latest","description":"Temporary package placeholder for staged publishing","directories":{}},"0.1.0":{"name":"@mesub/node","version":"0.1.0","keywords":["mesub","solana","subscriptions","billing","sdk","webhooks","usdc"],"license":"MIT","_id":"@mesub/node@0.1.0","maintainers":[{"name":"ft_gring0","email":"emiledubdart@gmail.com"}],"homepage":"https://github.com/Mesub-io/node-sdk#readme","bugs":{"url":"https://github.com/Mesub-io/node-sdk/issues"},"dist":{"shasum":"198b15e6589db6396addab5319a2e3207f866ee9","tarball":"https://registry.npmjs.org/@mesub/node/-/node-0.1.0.tgz","fileCount":65,"integrity":"sha512-3bCk7AIodxEBMrgQobfXKctE/IaQJ40VwFp0EFL9VE/RI75wp890GYwOj8Ge4J6+UpHt/gAtYzPZa3dmyHRNUg==","signatures":[{"sig":"MEQCIE4TX1Ajz9jjxuHv6ZB//gEQMvlA3hz4pt2/+IhkLaG0AiBgagACE1LVord14VZR0oR1ecOgOrKQIWJJCqC4TKUqbw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIG72QhOaF0Vv2eOMbg0Nj39YEbj1jf6iSakuaa3o9skCAiEAmRAyZjxHoMQAO25KxFFRZ91Od0jHV+dPkhnRRcfejuI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@mesub%2fnode@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":1607541},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=22"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"./nest":{"import":{"types":"./dist/nest.d.ts","default":"./dist/nest.js"},"require":{"types":"./dist/nest.d.cts","default":"./dist/nest.cjs"}},"./next":{"import":{"types":"./dist/next.d.ts","default":"./dist/next.js"},"require":{"types":"./dist/next.d.cts","default":"./dist/next.cjs"}},"./express":{"import":{"types":"./dist/express.d.ts","default":"./dist/express.js"},"require":{"types":"./dist/express.d.cts","default":"./dist/express.cjs"}},"./testing":{"import":{"types":"./dist/testing.d.ts","default":"./dist/testing.js"},"require":{"types":"./dist/testing.d.cts","default":"./dist/testing.cjs"}},"./situations":{"import":{"types":"./dist/situations.d.ts","default":"./dist/situations.js"},"require":{"types":"./dist/situations.d.cts","default":"./dist/situations.cjs"}},"./package.json":"./package.json"},"gitHead":"3ceaaf9c7725cf1836a234346d1cdc3ba797d6da","scripts":{"lint":"oxlint --deny-warnings src/ test/","test":"vitest run","build":"tsup","format":"prettier --write .","prepare":"husky || true","typecheck":"tsc --noEmit","test:watch":"vitest","format:check":"prettier --check .","check:exports":"node scripts/check-exports.mjs","test:contract":"vitest run test/contract.spec.ts","test:coverage":"vitest run --coverage","prepublishOnly":"pnpm build && pnpm check:exports"},"_npmUser":{"name":"ft_gring0","email":"emiledubdart@gmail.com"},"repository":{"url":"git+https://github.com/Mesub-io/node-sdk.git","type":"git"},"_npmVersion":"11.19.0","description":"Mesub for Node: check a customer's access, take subscriptions and verify webhooks for subscription billing on Solana.","directories":{},"lint-staged":{"*.{ts,mjs}":["oxlint --deny-warnings","prettier --check"],"*.{json,md,yml,yaml}":["prettier --check"]},"sideEffects":false,"_nodeVersion":"24.21.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"pnpm@11.27.0","devDependencies":{"rxjs":"^7.8.2","tsup":"^8.5.1","husky":"^9.1.7","oxlint":"^1.58.0","vitest":"^4.1.2","express":"^5.2.1","prettier":"^3.4.2","supertest":"^7.3.0","typescript":"^6.0.2","@types/node":"^24.0.0","lint-staged":"^17.5.0","@nestjs/core":"^12.1.1","@nestjs/common":"^12.1.1","@types/express":"^5.0.6","@nestjs/testing":"^12.1.1","@types/supertest":"^7.2.1","reflect-metadata":"^0.2.2","@vitest/coverage-v8":"^4.1.11","@cfworker/json-schema":"^4.1.1","@nestjs/platform-express":"^12.1.1"},"peerDependencies":{"next":">=14","express":">=4","@nestjs/common":">=10"},"peerDependenciesMeta":{"next":{"optional":true},"express":{"optional":true},"@nestjs/common":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/node_0.1.0_1792163477716_0.1257969957840923","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@mesub/node","version":"0.1.2","keywords":["mesub","solana","subscriptions","billing","sdk","webhooks","usdc"],"license":"MIT","_id":"@mesub/node@0.1.2","maintainers":[{"name":"faiz777","email":"faizwinters777@gmail.com"},{"name":"ft_gring0","email":"emiledubdart@gmail.com"}],"homepage":"https://github.com/Mesub-io/node-sdk#readme","bugs":{"url":"https://github.com/Mesub-io/node-sdk/issues"},"dist":{"shasum":"c4c743c1b4c42623c4e4e2cde8b93ff2757d6bd7","tarball":"https://registry.npmjs.org/@mesub/node/-/node-0.1.2.tgz","fileCount":65,"integrity":"sha512-RePRzk0hky0yum0ExJKsB64B5JOFjpFKTGpn2khwMvUtr6gXoER1qN3zi9s7ps3zjoO7v519thXQg9g3aJ2Zyg==","signatures":[{"sig":"MEUCIF7Dkt9EXuGn4fKlxhGLBdwLHcVx18P2qDjOsMEMRB3OAiEAt/+JWWATb1PhNbF5HvhxnZuZ6+jmsPN/6ivEfDywsOI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@mesub%2fnode@0.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":1611463},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=22"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"./nest":{"import":{"types":"./dist/nest.d.ts","default":"./dist/nest.js"},"require":{"types":"./dist/nest.d.cts","default":"./dist/nest.cjs"}},"./next":{"import":{"types":"./dist/next.d.ts","default":"./dist/next.js"},"require":{"types":"./dist/next.d.cts","default":"./dist/next.cjs"}},"./express":{"import":{"types":"./dist/express.d.ts","default":"./dist/express.js"},"require":{"types":"./dist/express.d.cts","default":"./dist/express.cjs"}},"./testing":{"import":{"types":"./dist/testing.d.ts","default":"./dist/testing.js"},"require":{"types":"./dist/testing.d.cts","default":"./dist/testing.cjs"}},"./situations":{"import":{"types":"./dist/situations.d.ts","default":"./dist/situations.js"},"require":{"types":"./dist/situations.d.cts","default":"./dist/situations.cjs"}},"./package.json":"./package.json"},"gitHead":"9cf4bbae74c1ea907b5345885d47d3f693847045","scripts":{"lint":"oxlint --deny-warnings src/ test/","test":"vitest run","build":"tsup","format":"prettier --write .","prepare":"husky || true","typecheck":"tsc --noEmit","test:watch":"vitest","format:check":"prettier --check .","check:exports":"node scripts/check-exports.mjs","test:contract":"vitest run test/contract.spec.ts","test:coverage":"vitest run --coverage","prepublishOnly":"pnpm build && pnpm check:exports"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","approver":{"name":"faiz777","email":"faizwinters777@gmail.com"},"trustedPublisher":{"id":"github","oidcConfigId":"f5de1e50-4669-4515-a3ce-661984bc4628"}},"repository":{"url":"git+https://github.com/Mesub-io/node-sdk.git","type":"git"},"_npmVersion":"11.19.0","description":"Mesub for Node: check a customer's access, take subscriptions and verify webhooks for subscription billing on Solana.","directories":{},"lint-staged":{"*.{ts,mjs}":["oxlint --deny-warnings","prettier --check"],"*.{json,md,yml,yaml}":["prettier --check"]},"sideEffects":false,"_nodeVersion":"24.21.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"pnpm@11.27.0","devDependencies":{"rxjs":"^7.8.2","tsup":"^8.5.1","husky":"^9.1.7","oxlint":"^1.58.0","vitest":"^4.1.2","express":"^5.2.1","prettier":"^3.4.2","supertest":"^7.3.0","typescript":"^6.0.2","@types/node":"^24.0.0","lint-staged":"^17.5.0","@nestjs/core":"^12.1.1","@nestjs/common":"^12.1.1","@types/express":"^5.0.6","@nestjs/testing":"^12.1.1","@types/supertest":"^7.2.1","reflect-metadata":"^0.2.2","@vitest/coverage-v8":"^4.1.11","@cfworker/json-schema":"^4.1.1","@nestjs/platform-express":"^12.1.1"},"peerDependencies":{"next":">=14","express":">=4","@nestjs/common":">=10"},"peerDependenciesMeta":{"next":{"optional":true},"express":{"optional":true},"@nestjs/common":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/node_0.1.2_1792539179309_0.008205244061393557","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@mesub/node","version":"0.1.3","keywords":["mesub","solana","subscriptions","billing","sdk","webhooks","usdc"],"license":"MIT","_id":"@mesub/node@0.1.3","maintainers":[{"name":"faiz777","email":"faizwinters777@gmail.com"},{"name":"ft_gring0","email":"emiledubdart@gmail.com"}],"homepage":"https://github.com/Mesub-io/node-sdk#readme","bugs":{"url":"https://github.com/Mesub-io/node-sdk/issues"},"dist":{"shasum":"18f7c1572f3d9b7cf706ae6127acbe58d4c733a4","tarball":"https://registry.npmjs.org/@mesub/node/-/node-0.1.3.tgz","fileCount":65,"integrity":"sha512-4g2jho94ZYhXv3FDpvbfYbltKagJ4A6iADKmFr7T1/2EWJ76tvP0OGUon0GvHM7rciWvhpwEDRIIP/iZ/Bzx4g==","signatures":[{"sig":"MEYCIQC/JSGbKmMr4MdqY0wbc0K8C3aJYIsOYHrvDPjXV3AGVQIhAJ91g0lh1iY5qPC13hKDC8MdFr6Q5ibfxQDAyBNDfPDy","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@mesub%2fnode@0.1.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":1613684},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=22"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"./nest":{"import":{"types":"./dist/nest.d.ts","default":"./dist/nest.js"},"require":{"types":"./dist/nest.d.cts","default":"./dist/nest.cjs"}},"./next":{"import":{"types":"./dist/next.d.ts","default":"./dist/next.js"},"require":{"types":"./dist/next.d.cts","default":"./dist/next.cjs"}},"./express":{"import":{"types":"./dist/express.d.ts","default":"./dist/express.js"},"require":{"types":"./dist/express.d.cts","default":"./dist/express.cjs"}},"./testing":{"import":{"types":"./dist/testing.d.ts","default":"./dist/testing.js"},"require":{"types":"./dist/testing.d.cts","default":"./dist/testing.cjs"}},"./situations":{"import":{"types":"./dist/situations.d.ts","default":"./dist/situations.js"},"require":{"types":"./dist/situations.d.cts","default":"./dist/situations.cjs"}},"./package.json":"./package.json"},"gitHead":"df00b0eba62eee33af752f74a69f059ca806def8","scripts":{"lint":"oxlint --deny-warnings src/ test/","test":"vitest run","build":"tsup","format":"prettier --write .","prepare":"husky || true","typecheck":"tsc --noEmit","test:watch":"vitest","format:check":"prettier --check .","check:exports":"node scripts/check-exports.mjs","test:contract":"vitest run test/contract.spec.ts","test:coverage":"vitest run --coverage","prepublishOnly":"pnpm build && pnpm check:exports"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","approver":{"name":"faiz777","email":"faizwinters777@gmail.com"},"trustedPublisher":{"id":"github","oidcConfigId":"f5de1e50-4669-4515-a3ce-661984bc4628"}},"repository":{"url":"git+https://github.com/Mesub-io/node-sdk.git","type":"git"},"_npmVersion":"11.19.1","description":"Mesub for Node: check a customer's access, take subscriptions and verify webhooks for subscription billing on Solana.","directories":{},"lint-staged":{"*.{ts,mjs}":["oxlint --deny-warnings","prettier --check"],"*.{json,md,yml,yaml}":["prettier --check"]},"sideEffects":false,"_nodeVersion":"24.22.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"pnpm@11.27.0","devDependencies":{"rxjs":"^7.8.2","tsup":"^8.5.1","husky":"^9.1.7","oxlint":"^1.58.0","vitest":"^4.1.2","express":"^5.2.1","prettier":"^3.4.2","supertest":"^7.3.0","typescript":"^6.0.2","@types/node":"^24.0.0","lint-staged":"^17.5.0","@nestjs/core":"^12.1.1","@nestjs/common":"^12.1.1","@types/express":"^5.0.6","@nestjs/testing":"^12.1.1","@types/supertest":"^7.2.1","reflect-metadata":"^0.2.2","@vitest/coverage-v8":"^4.1.11","@cfworker/json-schema":"^4.1.1","@nestjs/platform-express":"^12.1.1"},"peerDependencies":{"next":">=14","express":">=4","@nestjs/common":">=10"},"peerDependenciesMeta":{"next":{"optional":true},"express":{"optional":true},"@nestjs/common":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/node_0.1.3_1793125911252_0.4171745506921082","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"name":"@mesub/node","version":"0.1.4","keywords":["mesub","solana","subscriptions","billing","sdk","webhooks","usdc"],"license":"MIT","_id":"@mesub/node@0.1.4","maintainers":[{"name":"faiz777","email":"faizwinters777@gmail.com"},{"name":"ft_gring0","email":"emiledubdart@gmail.com"}],"homepage":"https://github.com/Mesub-io/node-sdk#readme","bugs":{"url":"https://github.com/Mesub-io/node-sdk/issues"},"dist":{"shasum":"43a0b267f7bb576cb11bfdea6e9bc6c05be4b04f","tarball":"https://registry.npmjs.org/@mesub/node/-/node-0.1.4.tgz","fileCount":65,"integrity":"sha512-uwojgkdlt4fnEQo71NE4eBY1Yzqo2YDj8vts/eY1ORQ4Yb+x+1ZPsiVTFeKVgS7o+GWApiw2nWaMAI3Hiz/M5A==","signatures":[{"sig":"MEYCIQCRcCAhHaeZkCKvOXzyAg0/Huh+7qmSmS+XlBAu+WUbFwIhAIRCD6HlKtIjpo17OSPaJsxGRIpfOgu+C8yPIbcVn5qh","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@mesub%2fnode@0.1.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":1618558},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=22"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"./nest":{"import":{"types":"./dist/nest.d.ts","default":"./dist/nest.js"},"require":{"types":"./dist/nest.d.cts","default":"./dist/nest.cjs"}},"./next":{"import":{"types":"./dist/next.d.ts","default":"./dist/next.js"},"require":{"types":"./dist/next.d.cts","default":"./dist/next.cjs"}},"./express":{"import":{"types":"./dist/express.d.ts","default":"./dist/express.js"},"require":{"types":"./dist/express.d.cts","default":"./dist/express.cjs"}},"./testing":{"import":{"types":"./dist/testing.d.ts","default":"./dist/testing.js"},"require":{"types":"./dist/testing.d.cts","default":"./dist/testing.cjs"}},"./situations":{"import":{"types":"./dist/situations.d.ts","default":"./dist/situations.js"},"require":{"types":"./dist/situations.d.cts","default":"./dist/situations.cjs"}},"./package.json":"./package.json"},"gitHead":"2066e43b4f6ef16606768c2634a9efe4cb356438","scripts":{"lint":"oxlint --deny-warnings src/ test/","test":"vitest run","build":"tsup","format":"prettier --write .","prepare":"husky || true","typecheck":"tsc --noEmit","test:watch":"vitest","format:check":"prettier --check .","check:exports":"node scripts/check-exports.mjs","test:contract":"vitest run test/contract.spec.ts","test:coverage":"vitest run --coverage","prepublishOnly":"pnpm build && pnpm check:exports"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","approver":{"name":"faiz777","email":"faizwinters777@gmail.com"},"trustedPublisher":{"id":"github","oidcConfigId":"f5de1e50-4669-4515-a3ce-661984bc4628"}},"repository":{"url":"git+https://github.com/Mesub-io/node-sdk.git","type":"git"},"_npmVersion":"11.19.1","description":"Mesub for Node: check a customer's access, take subscriptions and verify webhooks for subscription billing on Solana.","directories":{},"lint-staged":{"*.{ts,mjs}":["oxlint --deny-warnings","prettier --check"],"*.{json,md,yml,yaml}":["prettier --check"]},"sideEffects":false,"_nodeVersion":"24.22.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"pnpm@11.27.0","devDependencies":{"rxjs":"^7.8.2","tsup":"^8.5.1","husky":"^9.1.7","oxlint":"^1.58.0","vitest":"^4.1.2","express":"^5.2.1","prettier":"^3.4.2","supertest":"^7.3.0","typescript":"^6.0.2","@types/node":"^24.0.0","lint-staged":"^17.5.0","@nestjs/core":"^12.1.1","@nestjs/common":"^12.1.1","@types/express":"^5.0.6","@nestjs/testing":"^12.1.1","@types/supertest":"^7.2.1","reflect-metadata":"^0.2.2","@vitest/coverage-v8":"^4.1.11","@cfworker/json-schema":"^4.1.1","@nestjs/platform-express":"^12.1.1"},"peerDependencies":{"next":">=14","express":">=4","@nestjs/common":">=10"},"peerDependenciesMeta":{"next":{"optional":true},"express":{"optional":true},"@nestjs/common":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/node_0.1.4_1793273578735_0.7663434661052434","host":"s3://npm-registry-packages-npm-production"}},"0.1.5":{"name":"@mesub/node","version":"0.1.5","keywords":["mesub","solana","subscriptions","billing","sdk","webhooks","usdc"],"license":"MIT","_id":"@mesub/node@0.1.5","maintainers":[{"name":"faiz777","email":"faizwinters777@gmail.com"},{"name":"ft_gring0","email":"emiledubdart@gmail.com"}],"homepage":"https://github.com/Mesub-io/node-sdk#readme","bugs":{"url":"https://github.com/Mesub-io/node-sdk/issues"},"dist":{"shasum":"a26c892b666ed7ffe9bf7fbfcabb5419488382bc","tarball":"https://registry.npmjs.org/@mesub/node/-/node-0.1.5.tgz","fileCount":65,"integrity":"sha512-ON+RjyG/GudLKBEgwvXSBYahls4IZYSwKpMmZiY2MlSs9KSOlXDr8catr2IS1IdFhezta1pn4RdbyzmKfrcKew==","signatures":[{"sig":"MEQCIHxRnyfS7TlakSWVHXSUhtV/1gJeqS71qgj1rYXSwNgEAiAyMUy34pYgHOZAHRZDQoDfKVsTUCin6QjqH5eAIoWK9A==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@mesub%2fnode@0.1.5","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":1618737},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=22"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"./nest":{"import":{"types":"./dist/nest.d.ts","default":"./dist/nest.js"},"require":{"types":"./dist/nest.d.cts","default":"./dist/nest.cjs"}},"./next":{"import":{"types":"./dist/next.d.ts","default":"./dist/next.js"},"require":{"types":"./dist/next.d.cts","default":"./dist/next.cjs"}},"./express":{"import":{"types":"./dist/express.d.ts","default":"./dist/express.js"},"require":{"types":"./dist/express.d.cts","default":"./dist/express.cjs"}},"./testing":{"import":{"types":"./dist/testing.d.ts","default":"./dist/testing.js"},"require":{"types":"./dist/testing.d.cts","default":"./dist/testing.cjs"}},"./situations":{"import":{"types":"./dist/situations.d.ts","default":"./dist/situations.js"},"require":{"types":"./dist/situations.d.cts","default":"./dist/situations.cjs"}},"./package.json":"./package.json"},"gitHead":"cbad047b2863882a15717d5d1d6d4c81003f7fe8","scripts":{"lint":"oxlint --deny-warnings src/ test/","test":"vitest run","build":"tsup","format":"prettier --write .","prepare":"husky || true","typecheck":"tsc --noEmit","test:watch":"vitest","format:check":"prettier --check .","check:exports":"node scripts/check-exports.mjs","test:contract":"vitest run test/contract.spec.ts","test:coverage":"vitest run --coverage","prepublishOnly":"pnpm build && pnpm check:exports"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","approver":{"name":"faiz777","email":"faizwinters777@gmail.com"},"trustedPublisher":{"id":"github","oidcConfigId":"f5de1e50-4669-4515-a3ce-661984bc4628"}},"repository":{"url":"git+https://github.com/Mesub-io/node-sdk.git","type":"git"},"_npmVersion":"11.19.1","description":"Mesub for Node: check a customer's access, take subscriptions and verify webhooks for subscription billing on Solana.","directories":{},"lint-staged":{"*.{ts,mjs}":["oxlint --deny-warnings","prettier --check"],"*.{json,md,yml,yaml}":["prettier --check"]},"sideEffects":false,"_nodeVersion":"24.22.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"pnpm@11.27.0","devDependencies":{"rxjs":"^7.8.2","tsup":"^8.5.1","husky":"^9.1.7","oxlint":"^1.58.0","vitest":"^4.1.2","express":"^5.2.1","prettier":"^3.4.2","supertest":"^7.3.0","typescript":"^6.0.2","@types/node":"^24.0.0","lint-staged":"^17.5.0","@nestjs/core":"^12.1.1","@nestjs/common":"^12.1.1","@types/express":"^5.0.6","@nestjs/testing":"^12.1.1","@types/supertest":"^7.2.1","reflect-metadata":"^0.2.2","@vitest/coverage-v8":"^4.1.11","@cfworker/json-schema":"^4.1.1","@nestjs/platform-express":"^12.1.1"},"peerDependencies":{"next":">=14","express":">=4","@nestjs/common":">=10"},"peerDependenciesMeta":{"next":{"optional":true},"express":{"optional":true},"@nestjs/common":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/node_0.1.5_1793493500194_0.4996175504857947","host":"s3://npm-registry-packages-npm-production"}},"0.1.6":{"name":"@mesub/node","version":"0.1.6","keywords":["mesub","solana","subscriptions","billing","sdk","webhooks","usdc"],"license":"MIT","_id":"@mesub/node@0.1.6","maintainers":[{"name":"faiz777","email":"faizwinters777@gmail.com"},{"name":"ft_gring0","email":"emiledubdart@gmail.com"}],"homepage":"https://github.com/Mesub-io/node-sdk#readme","bugs":{"url":"https://github.com/Mesub-io/node-sdk/issues"},"dist":{"shasum":"f9d2aeb7ed56b34961ea8045a904bcbca44b5960","tarball":"https://registry.npmjs.org/@mesub/node/-/node-0.1.6.tgz","fileCount":65,"integrity":"sha512-LXrFWbMtaOtIfDgv3LjSHNqEk81yExXZEr661iOUYc7OqQP5ASqSdcKf5MR2NitqQ6cez3l9Qwh3AXiCrcH+yg==","signatures":[{"sig":"MEUCICFnkFZV1vmVtOeBu8lp17d57BlP8NM51qcBoGlD4OVFAiEAolLoAYMEJjKod2G9AUvny1Z+TtX0cHp9UvmyDihQSy8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@mesub%2fnode@0.1.6","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":1645952},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=22"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"./nest":{"import":{"types":"./dist/nest.d.ts","default":"./dist/nest.js"},"require":{"types":"./dist/nest.d.cts","default":"./dist/nest.cjs"}},"./next":{"import":{"types":"./dist/next.d.ts","default":"./dist/next.js"},"require":{"types":"./dist/next.d.cts","default":"./dist/next.cjs"}},"./express":{"import":{"types":"./dist/express.d.ts","default":"./dist/express.js"},"require":{"types":"./dist/express.d.cts","default":"./dist/express.cjs"}},"./testing":{"import":{"types":"./dist/testing.d.ts","default":"./dist/testing.js"},"require":{"types":"./dist/testing.d.cts","default":"./dist/testing.cjs"}},"./situations":{"import":{"types":"./dist/situations.d.ts","default":"./dist/situations.js"},"require":{"types":"./dist/situations.d.cts","default":"./dist/situations.cjs"}},"./package.json":"./package.json"},"gitHead":"24ecc40e7772bb66dd152129650b82829d3547cc","scripts":{"lint":"oxlint --deny-warnings src/ test/","test":"vitest run","build":"tsup","format":"prettier --write .","prepare":"husky || true","typecheck":"tsc --noEmit","test:watch":"vitest","format:check":"prettier --check .","check:exports":"node scripts/check-exports.mjs","test:contract":"vitest run test/contract.spec.ts","test:coverage":"vitest run --coverage","prepublishOnly":"pnpm build && pnpm check:exports"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","approver":{"name":"ft_gring0","email":"emiledubdart@gmail.com"},"trustedPublisher":{"id":"github","oidcConfigId":"f5de1e50-4669-4515-a3ce-661984bc4628"}},"repository":{"url":"git+https://github.com/Mesub-io/node-sdk.git","type":"git"},"_npmVersion":"11.19.1","description":"Mesub for Node: check a customer's access, take subscriptions and verify webhooks for subscription billing on Solana.","directories":{},"lint-staged":{"*.{ts,mjs}":["oxlint --deny-warnings","prettier --check"],"*.{json,md,yml,yaml}":["prettier --check"]},"sideEffects":false,"_nodeVersion":"24.22.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"pnpm@11.27.0","devDependencies":{"rxjs":"^7.8.2","tsup":"^8.5.1","husky":"^9.1.7","oxlint":"^1.58.0","vitest":"^4.1.2","express":"^5.2.1","prettier":"^3.4.2","supertest":"^7.3.0","typescript":"^6.0.2","@types/node":"^24.0.0","lint-staged":"^17.5.0","@nestjs/core":"^12.1.1","@nestjs/common":"^12.1.1","@types/express":"^5.0.6","@nestjs/testing":"^12.1.1","@types/supertest":"^7.2.1","reflect-metadata":"^0.2.2","@vitest/coverage-v8":"^4.1.11","@cfworker/json-schema":"^4.1.1","@nestjs/platform-express":"^12.1.1"},"peerDependencies":{"next":">=14","express":">=4","@nestjs/common":">=10"},"peerDependenciesMeta":{"next":{"optional":true},"express":{"optional":true},"@nestjs/common":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/node_0.1.6_1794237654302_0.49349486637130136","host":"s3://npm-registry-packages-npm-production"}},"0.1.7":{"_id":"@mesub/node@0.1.7","bugs":{"url":"https://github.com/Mesub-io/node-sdk/issues"},"dist":{"shasum":"c1c204c1056207fb07fabc34f24ad2d6453d40ee","tarball":"https://registry.npmjs.org/@mesub/node/-/node-0.1.7.tgz","integrity":"sha512-XHBaH2o9FSnpa0MB98lW25ci0tHcUNwnr8qTyG/qBTY7F2V/OU0dB4xb3L2vHeXEfpkPzH+S3eo+WOwfUiMLIg==","fileCount":65,"unpackedSize":1667200,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@mesub%2fnode@0.1.7","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDkw/60zW4mPA6KH35gv0Y+71KGBHnBwBP6fv3fpVPWSAiEAmWyG6aig6AJgoiqD9kw2/sJba9P2ppAwsMmPU7HZduA="}]},"main":"./dist/index.cjs","name":"@mesub/node","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=22"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"./nest":{"import":{"types":"./dist/nest.d.ts","default":"./dist/nest.js"},"require":{"types":"./dist/nest.d.cts","default":"./dist/nest.cjs"}},"./next":{"import":{"types":"./dist/next.d.ts","default":"./dist/next.js"},"require":{"types":"./dist/next.d.cts","default":"./dist/next.cjs"}},"./express":{"import":{"types":"./dist/express.d.ts","default":"./dist/express.js"},"require":{"types":"./dist/express.d.cts","default":"./dist/express.cjs"}},"./testing":{"import":{"types":"./dist/testing.d.ts","default":"./dist/testing.js"},"require":{"types":"./dist/testing.d.cts","default":"./dist/testing.cjs"}},"./situations":{"import":{"types":"./dist/situations.d.ts","default":"./dist/situations.js"},"require":{"types":"./dist/situations.d.cts","default":"./dist/situations.cjs"}},"./package.json":"./package.json"},"gitHead":"e4ba64d7fc7a464612e017f1039fdd1ac1000847","license":"MIT","scripts":{"lint":"oxlint --deny-warnings src/ test/","test":"vitest run","build":"tsup","format":"prettier --write .","prepare":"husky || true","typecheck":"tsc --noEmit","test:watch":"vitest","format:check":"prettier --check .","check:exports":"node scripts/check-exports.mjs","test:contract":"vitest run test/contract.spec.ts","test:coverage":"vitest run --coverage","prepublishOnly":"pnpm build && pnpm check:exports"},"version":"0.1.7","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"f5de1e50-4669-4515-a3ce-661984bc4628"},"approver":{"name":"ft_gring0","email":"emiledubdart@gmail.com"}},"homepage":"https://github.com/Mesub-io/node-sdk#readme","keywords":["mesub","solana","subscriptions","billing","sdk","webhooks","usdc"],"repository":{"url":"git+https://github.com/Mesub-io/node-sdk.git","type":"git"},"_npmVersion":"11.19.1","description":"Mesub for Node: check a customer's access, take subscriptions and verify webhooks for subscription billing on Solana.","directories":{},"lint-staged":{"*.{ts,mjs}":["oxlint --deny-warnings","prettier --check"],"*.{json,md,yml,yaml}":["prettier --check"]},"maintainers":[{"name":"faiz777","email":"faizwinters777@gmail.com"},{"name":"ft_gring0","email":"emiledubdart@gmail.com"}],"sideEffects":false,"_nodeVersion":"24.22.2","publishConfig":{"access":"public"},"packageManager":"pnpm@11.27.0","devDependencies":{"rxjs":"^7.8.2","tsup":"^8.5.1","husky":"^9.1.7","oxlint":"^1.58.0","vitest":"^4.1.2","express":"^5.2.1","prettier":"^3.4.2","supertest":"^7.3.0","typescript":"^6.0.2","@types/node":"^24.0.0","lint-staged":"^17.5.0","@nestjs/core":"^12.1.1","@nestjs/common":"^12.1.1","@types/express":"^5.0.6","@nestjs/testing":"^12.1.1","@types/supertest":"^7.2.1","reflect-metadata":"^0.2.2","@vitest/coverage-v8":"^4.1.11","@cfworker/json-schema":"^4.1.1","@nestjs/platform-express":"^12.1.1"},"peerDependencies":{"next":">=14","express":">=4","@nestjs/common":">=10"},"peerDependenciesMeta":{"next":{"optional":true},"express":{"optional":true},"@nestjs/common":{"optional":true}},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/node_0.1.7_1794412184745_0.4441615298354006"},"_hasShrinkwrap":false}},"time":{"created":"2026-10-16T15:09:38.429Z","modified":"2026-11-11T15:49:45.210Z","0.0.0-stage":"2026-10-16T15:09:38.429Z","0.1.0":"2026-10-16T15:11:17.832Z","0.1.2":"2026-10-20T23:32:59.434Z","0.1.3":"2026-10-27T18:31:51.367Z","0.1.4":"2026-10-29T11:32:58.842Z","0.1.5":"2026-11-01T00:38:20.279Z","0.1.6":"2026-11-09T15:20:54.446Z","0.1.7":"2026-11-11T15:49:44.884Z"},"bugs":{"url":"https://github.com/Mesub-io/node-sdk/issues"},"license":"MIT","homepage":"https://github.com/Mesub-io/node-sdk#readme","keywords":["mesub","solana","subscriptions","billing","sdk","webhooks","usdc"],"repository":{"url":"git+https://github.com/Mesub-io/node-sdk.git","type":"git"},"description":"Mesub for Node: check a customer's access, take subscriptions and verify webhooks for subscription billing on Solana.","maintainers":[{"name":"faiz777","email":"faizwinters777@gmail.com"},{"name":"ft_gring0","email":"emiledubdart@gmail.com"}],"readme":"# @mesub/node\n\nServer-side SDK for [Mesub](https://mesub.io), recurring payments on Solana.\n\nMesub runs the billing: it holds no funds, pulls each period on the merchant's\nbehalf, retries, and keeps the record of every attempt. This package is the\npart that lives on your servers. It answers **does this customer have access\nto this plan?** on every request, and opens subscriptions for your front to\nhave the wallet sign.\n\n**[Read the docs](https://docs.mesub.io)** for the walkthroughs. This page is\nthe short version and the reference of the options.\n\n[![npm](https://img.shields.io/npm/v/@mesub/node)](https://www.npmjs.com/package/@mesub/node)\n\n> **Status: early, 0.x.** The API may still change between minor versions:\n> `npm update` takes patches (0.1.x), a new minor (0.2.0) takes\n> `npm install @mesub/node@latest`. See the\n> [board](https://github.com/orgs/Mesub-io/projects/4) for what is next.\n\n## Install\n\n```sh\nnpm install @mesub/node\n```\n\nNode 22 or later. No runtime dependency. Every release is built by GitHub\nActions from a tagged commit and published with a provenance statement:\n`npm audit signatures` verifies it.\n\n## How it fits\n\nYour subscribers get no Mesub account. You keep your own login and your own\nUI; your server talks to Mesub with the API key, through this package, and\nyour pages only have the wallet sign. See\n[How it works](https://docs.mesub.io/docs/how-it-works).\n[The Solana Subscriptions program, explained](https://mesub.io/guides/solana-subscriptions-program)\nsays what the program does on chain and what it leaves to whoever runs a plan.\n\n| Where                | What                                                                             |\n| -------------------- | -------------------------------------------------------------------------------- |\n| Your server's `.env` | `MESUB_API_KEY=SUB_...`, the API key, from your dashboard. Read by this package. |\n| Your server's `.env` | With webhooks: `MESUB_WEBHOOK_SECRET=whsec_...`, the endpoint's signing secret.  |\n| Your pages           | Nothing. No key ever goes to the browser.                                        |\n\n## Gate a route\n\nYour own login says who the user is; Mesub says whether they have access.\n\n```ts\nimport { Mesub } from '@mesub/node';\n\nconst mesub = new Mesub(); // reads MESUB_API_KEY\n\n// Your login sets req.user: declare it once. With Passport, add these fields to Express.User.\ndeclare global {\n    namespace Express {\n        interface Request {\n            user?: { id: string; email?: string };\n        }\n    }\n}\n\napp.get('/api/analytics', yourLogin, async (req, res) => {\n    const user = req.user!; // yourLogin answers 401 when nobody is signed in\n    if (!(await mesub.hasAccess({ external_id: user.id }, 'pro'))) {\n        res.status(402).json({ error: 'The Pro plan is needed.' });\n        return;\n    }\n    res.json(buildAnalytics(user));\n});\n```\n\nCalled like this, `hasAccess` has no time budget: it waits out the client's\ntimeout and retries, and a 429's `Retry-After` twice, so a rate limit can hold\nthe route for about two minutes. The guards do the same in one line, within\n`guardTimeout` (2 s by default), and answer the refusals themselves (401\nnobody signed in, 402 no access, 503 Mesub could not answer about a customer it\nnever saw):\n\n```ts\n// Express\nimport type { Request } from 'express';\nimport { requirePlan } from '@mesub/node/express';\n\nconst customer = (req: Request) => (req.user ? { external_id: req.user.id } : null);\napp.get('/api/analytics', yourLogin, requirePlan('pro', { customer }), handler);\n```\n\n```ts\n// Next, app/api/analytics/route.ts\nimport { withMesub } from '@mesub/node/next';\n\nexport const GET = withMesub(async (request, mesub) => Response.json(await analytics(mesub)), {\n    plan: 'pro',\n    customer: async (request) => {\n        const session = await yourSession(request);\n        return session ? { external_id: session.userId } : null;\n    },\n});\n```\n\n```ts\n// Nest\nimport { Controller, Get, UseGuards } from '@nestjs/common';\nimport { MesubAccess, type MesubRequest, RequirePlan } from '@mesub/node/nest';\n\ninterface AuthedRequest extends MesubRequest {\n    user?: { id: string };\n}\n\n@Controller('analytics')\n@UseGuards(\n    YourAuthGuard,\n    RequirePlan<AuthedRequest>('pro', {\n        customer: (req) => (req.user ? { external_id: req.user.id } : null),\n    }),\n)\nexport class AnalyticsController {\n    @Get()\n    list(@MesubAccess() mesub: MesubAccess) {\n        return buildAnalytics(mesub.customer);\n    }\n}\n```\n\n> **`customer` must come from a session you verified**, never from the request\n> itself. A guard reading `req.query.wallet` lets in anyone who types a\n> subscriber's address.\n\nA customer is named by exactly one of `external_id` (your own id for them),\n`wallet` or `email`. A guard takes one plan, a list of up to three, or a\nfunction of the request. `access` returns the whole answer for a screen, and\n`accessList` every plan a customer has anything on.\n\nA guard reads `access`, never `status`. Access runs past `access_until`\nwhile the renewal goes through, a couple of minutes when nothing is in its\nway; never past it on a blocked subscription, nor past a plan's end. On a plan\nwith an end date (`ends_at` on the plan) `access_until` is never later than\nthat end: nobody has access past it, the last period being charged in full\nall the same. In that last period the\nanswer has no `next_charge_at`, and a late one no `next_retry_at`, since no\npull is left to run. For a few minutes past the end, `status` can still read\n`active` or `unpaid` with `access: false`, until Mesub ends the subscription\n(`ended`, `end_reason: 'plan_ended'`).\n\nA charge can also fail for a reason that is not your customer's. The answer\nthen carries `blocked_since` and `blocked_reason`, both null otherwise:\n`mesub` for a cause on Mesub's side, or your plan's own setup by name,\n`puller_not_allowed`, `receiver_not_allowed`, `receiver_account_missing`,\n`receiver_account_frozen`, `receiver_account_needs_memo` (the receiving token\naccount requires a memo on every payment in, which Mesub's charges do not\ncarry: turn it off or choose another receiving wallet),\n`receiver_account_confidential_only` (it takes confidential transfers only:\nallow plain ones or choose another receiving wallet) or `mint_gone`. Two are\nthe token issuer's to lift, not yours: `mint_paused` (the issuer paused the\ntoken) and `mint_transfer_hook` (the issuer made its transfers run a program\nMesub does not support yet; otherwise, create a plan with another token).\n`status` and `payment_status` do not move for it and Mesub keeps trying; `access` ends at `access_until` if nothing\nis collected by then, and comes back with the first charge that goes through,\nnothing to sign. On `mint_gone` no charge can go through again, so access does\nnot come back.\n\nEverything else, the answer's fields, the errors, who to ask about:\n[Check access](https://docs.mesub.io/docs/access). What each status means:\n[Lifecycle](https://docs.mesub.io/docs/lifecycle).\n\n## When Mesub does not answer\n\n`hasAccess` and the guards do not lock out a paying subscriber for an outage,\nnor let a stranger in: they serve the last answer they knew for that customer\nand plan, for up to 24 hours (`maxStaleMs`), and `false` or a 503 for one they\nnever saw. An answer with no charge or retry ahead (cancelled, parked, or in\na plan's last period) stops at its `access_until`; one with a renewal ahead\nkeeps the fallback, as it was likely paid while Mesub was down. A blocked one\n(`blocked_since`) stops at its `access_until` whatever is ahead, as Mesub\ndoes: its retries say nothing of a payment.\n`access` throws instead. A guard never holds a request longer than\n`guardTimeout`, 2 s by default, a cache store that hangs included: a read not\nanswered by then is a miss, and no answer waits for a write. Its 503 carries\nthe `Retry-After` Mesub sent, 30 s when it sent none. A bad key or an unknown\nplan always throws: a broken integration is never read as \"not subscribed\".\n\n## Show your plans\n\n```ts\nconst plans = await mesub.plans.list(); // sorted by slug\nconst pro = await mesub.plans.retrieve('pro');\n// pro.amount_display \"9.99\", pro.symbol \"USDC\", pro.period_hours 720, pro.available\n// pro.token { symbol: \"USDC\", name: \"USD Coin\", logo_url, verified: true }, pro.amount_usd \"9.99\"\n```\n\n`available` is false on a plan that is ending and when your project is full:\nshow \"Subscribe\" only when it is true. `ends_at` is when a plan ends, null\nfor one with no end. Nothing is cached.\n\n`symbol` is set only for a mint Mesub vouches for (USDC, USDT, PYUSD).\n`token` is what Mesub resolved for any mint: its symbol, name and logo, and\n`verified`, true for a vouched mint or one Jupiter marks verified. A symbol is\nfree text on chain and a fake \"USDC\" is a known scam: show an unverified token\nas unverified and keep `mint` visible. `amount_usd` is the plan's amount in\ndollars at the latest price Mesub knows, a decimal string to show beside the\namount, null when it knows none. An attempt's `amount_usd` is priced when it\nwas attempted, null until then.\n\n## Subscribe from your server\n\nThree steps, with the wallet in the middle. The API key never leaves your\nserver.\n\n```ts\n// 1. On your server: Mesub reserves it and builds what the wallet signs.\nconst { subscription, transaction, terms, costs } = await mesub.subscriptions.create({\n    plan: 'pro',\n    wallet, // the wallet that signs and pays\n    external_id: user.id, // optional: your own id, what you gate routes by\n    email, // optional: where their notices go\n});\n\n// 2. In your pages: the wallet signs terms.message, then the transaction,\n//    without sending it, before terms.expires_at.\n\n// 3. On your server: Mesub co-signs, sends, and waits for the chain.\nconst { subscription: now, reason } = await mesub.subscriptions.submit(subscription.id, {\n    transaction: signedTransaction,\n    terms_signature,\n});\nif (now.access) {\n    // it landed: grant the plan\n}\n```\n\n`submit` waits for the chain: up to 130 s by default, which `{ timeout, budget }`\nlower for a serverless function. When no answer says what became of it, it\nthrows a `MesubSubmitError`: read the subscription back with `retrieve` before\ncreating a new one, since the wallet may have paid. A 503 `unavailable` (too\nmany submits waiting on your project) says nothing was signed or sent: `submit`\nsends the same request again after its `Retry-After`, and past its replays\nthrows it as is, `retryable`, with `retryAfter`.\n\nA transaction lives about half a minute, the terms five:\n`transaction_expires_at` says when it should run out, an estimate that errs\nearly. Have the terms signed first, then ask for the transaction when the\nwallet is ready, and after a submit refused with `transaction_expired`:\n\n```ts\nconst fresh = await mesub.subscriptions.transaction(subscription.id);\n// fresh.terms.message is the text the wallet signed: its signature is still good.\n// Another text is new terms: have the wallet sign them too.\n```\n\nIt answers what `create` answers for the same subscription, reserves nothing,\nand is refused with `not_awaiting_signature` once the subscription is signed\nor expired. Always sign the transaction of the last call.\n\nA `submit` or a confirm that settled nothing answers the subscription with a\n`reason`, a sentence for a person, and a `reason_code` for your code\n(`transaction_expired`, `nothing_landed`, ...): branch on `reason_code`, and\nkeep a default branch, since Mesub adds codes.\n\nThe signing code, what `create` answers, the refusals:\n[Subscribe from your server](https://docs.mesub.io/docs/subscribe).\n\n## Cancel, resume, close, pay now, and payments\n\nEach action is two calls from your server with the wallet in between: your\nserver builds a transaction, the subscription's own wallet signs and sends it,\nyour server confirms with the signature.\n\n| To                                            | Build        | Confirm                            |\n| --------------------------------------------- | ------------ | ---------------------------------- |\n| stop the renewals of a running one            | `cancel(id)` | `confirmCancel(id, { signature })` |\n| take a cancellation back before its end       | `resume(id)` | `confirmResume(id, { signature })` |\n| close one that is over, and get its rent back | `close(id)`  | `confirmClose(id, { signature })`  |\n\nWhether `close` can work now is on every subscription and access answer:\n`closable`, and `closable_from`, the date it can when not yet (null when no\ndate is known: a running one is cancelled first). A subscription stopped\nbecause the wallet closed its approval for good (`stop_reason`\n`authority_closed`) can be closed at once, and cannot come back. An access\nanswer names its subscription in `subscription_id`, so you can act on it\nwithout listing first.\n\nA late payment is paid now in one call, with nothing to sign: `retry(id)`,\nshown to your customer as \"Pay now\". Mesub answers the subscription, still\n`unpaid`: the outcome comes with the pull, as the `subscription.renewed` or\n`subscription.payment_failed` webhook. It refuses with an `apiCode` when paying\ncannot succeed, so no retry is spent for nothing: `insufficient_balance` (top\nup first), `retry_cannot_succeed` (the wallet no longer approves it, its token\naccount is frozen, or its authority is closed), `retry_too_soon` (`retryAfter`\nsays when). Two refusals are `retryable`: `subscription_changed` (two retries\nmet, or a pull moved it on) and, on Free, `pull_running` (a pull runs now).\nRead the subscription back before you ask again. A 503 (`unavailable`, the\ncharge could not be queued, or `network_unavailable`) changed nothing, and\n`retryAfter` says when to ask again. Sent once, never retried.\n\n```ts\nawait mesub.subscriptions.retrieve(id);\nawait mesub.subscriptions.list({ external_id: user.id }); // { data, has_more }\nconst { data, paid } = await mesub.subscriptions.attempts(id); // its charges, and the total paid\n```\n\n`listAll` and `allAttempts` walk every page. The steps, the refusals and what\nan attempt carries: [Manage from your server](https://docs.mesub.io/docs/manage).\n\n## Show a subscription's situation\n\n`explain` turns an access answer or a subscription into the words Mesub uses\neverywhere: one sentence for the subscriber, one for you, the access line,\nand what each of you can do now. Show these rather than your own: a late\npayment the wallet cannot fix by adding funds reads differently from one it\ncan.\n\n```ts\nimport { explain } from '@mesub/node'; // or '@mesub/node/situations' in a page\n\nconst answer = await mesub.access({ external_id: user.id }, 'pro');\nconst { key, subscriber, access, actions } = explain(answer, {\n    names: { plan: 'Pro', merchant: 'Acme', amount: '9.99 USDC', token: 'USDC' },\n});\n// key \"unpaid_approval_revoked\"\n// subscriber \"Mesub could not take your payment of 9.99 USDC: your wallet no longer approves it (...)\"\n// access \"No access\"\n// actions [{ by: 'subscriber', action: 'cancel', sdk: 'subscriptions.cancel', confirm: 'Cancel Pro? ...' }]\n```\n\n`names` fills what neither answer carries; a placeholder left without a value\nstays as `{amount}` and is listed in `missing`. Dates are written as Mesub\nserves them, in ISO 8601, unless you pass `formatDate`. A status or a reason\nnewer than this release gives `key: 'unknown'` and the access line, never an\nerror. A blocked subscription has its own keys, `blocked_mesub` and one per\ncause (`blocked_puller_not_allowed`, ..., `blocked_mint_paused`): the\nsubscriber reads that nothing is theirs to do, you read what to fix, or who\nlifts it when the token's issuer does.\n\n`close` is offered only while Mesub says the subscription is `closable`, and\nthe sentence names `closable_from` when it can be closed later. A\nsubscription stopped for good (`stop_reason` `authority_closed`) reads\n`stopped_authority_closed`: no comeback, only the close.\n`@mesub/node/situations` imports nothing of Node, so your pages can use\nit too; `SITUATIONS` is the whole table.\n\n## Routes for the React widget\n\n[`@mesub/react`](https://github.com/Mesub-io/react-sdk) is optional. It never\ntalks to Mesub: it calls your server, on routes this package mounts in one\nline.\n\n`@mesub/react` 0.1.x works with the routes of `@mesub/node` 0.1.x: upgrade\nboth to the same minor together.\n\n```ts\n// Express, after your own login. Under Nest: the same app.use in main.ts.\nimport { mesubRoutes } from '@mesub/node/express';\n\napp.use(\n    '/api/mesub',\n    yourLogin,\n    mesubRoutes({\n        customer: (req) => (req.user ? { external_id: req.user.id } : null),\n        email: (req) => req.user?.email,\n    }),\n);\n```\n\n```ts\n// Next, app/api/mesub/[...mesub]/route.ts\nimport { mesubRouteHandlers } from '@mesub/node/next';\n\nexport const { GET, POST } = mesubRouteHandlers({\n    customer: async (request) => {\n        const session = await yourSession(request);\n        return session ? { external_id: session.userId } : null;\n    },\n});\n```\n\nEvery subscription created is tied to the customer your function returns,\nwhatever the browser sends; one that is not theirs answers 404. `plans:\n['pro', 'team']` keeps the widget to those plans. The browser never gets your\nAPI key, nor the email and the id you gave Mesub.\n\n| Route                                                        | What it does                                |\n| ------------------------------------------------------------ | ------------------------------------------- |\n| `GET /plans/:slug`                                           | The plan to show. Public.                   |\n| `GET /subscriptions`                                         | The customer's subscriptions, 500 at most.  |\n| `GET /subscriptions/:id`                                     | One of them, with its payments.             |\n| `POST /subscriptions`                                        | Prepares one: terms and a transaction.      |\n| `POST /subscriptions/:id/transaction`                        | A fresh transaction for it, and its terms.  |\n| `POST /subscriptions/:id/submit`                             | Sends what the wallet signed.               |\n| `POST /subscriptions/:id/retry`                              | Pay now: queues the missed charge.          |\n| `POST /subscriptions/:id/cancel`, `/resume`, `/close`        | The transaction the wallet signs and sends. |\n| `POST /subscriptions/:id/cancel/confirm`, and the two others | Confirms it with its signature.             |\n\n`GET /plans/:slug` is public, so the routes answer it from your project's\nplan list, kept in memory for 60 seconds: one call to Mesub a minute at most,\nwhatever the slugs asked, and a slug you do not have costs none. A change to a\nplan shows there within a minute. `mesub.plans.list` and `mesub.plans.retrieve`\nthemselves are never cached.\n\nA refusal is `{ error: { code, message } }`. A 401 always means nobody is\nsigned in on your site. Mesub refusing your API key (missing, wrong or\nrotated) is thrown to your framework, which logs it and answers 500, never\nhanded to the browser as a 401. The widget's side:\n[React widget](https://docs.mesub.io/docs/react).\n\nUnder Express, `requirePlan` and `mesubRoutes` hand such an error to\n`next(err)`, and Express's own handler answers an error's `status`. So one\nMesub answered with a 4xx (a refused key, an unknown plan) reaches your error\nhandler as a `MesubError` with the same `code` and `apiCode` and a `status`\nof 500, the original, with Mesub's status, as its `cause`: with no error\nhandler of yours, Express answers 500.\n\n## Webhooks\n\nMesub posts an event to your endpoint when a subscription changes, signed the\n[Standard Webhooks](https://www.standardwebhooks.com) way. Verify the raw body,\nnever one a JSON parser read and wrote again:\n\n```ts\nimport { MesubError } from '@mesub/node';\n\napp.post('/webhooks/mesub', express.raw({ type: 'application/json' }), async (req, res) => {\n    let event;\n    try {\n        event = await mesub.webhooks.verify(req.body, req.headers);\n    } catch (error) {\n        if (!(error instanceof MesubError)) throw error;\n        // Not Mesub's, or not now: refuse it.\n        if (error.code === 'invalid_webhook') return res.status(400).end();\n        // Mesub signed it, but this release cannot read it: update @mesub/node.\n        console.error(error);\n        return res.status(500).end();\n    }\n\n    if (event.test) return res.status(200).end(); // sent from the dashboard\n    if (await alreadyHandled(event.delivery_id)) return res.status(200).end();\n    // event.type, event.data (the subscription), event.detail\n    res.status(200).end();\n});\n```\n\nIn a Next route handler: `await verifyWebhook(await request.text(),\nrequest.headers)`.\n\nAnswer 400 only for `invalid_webhook`. An `unexpected` error is a body Mesub\nsigned that this release cannot read: log it, and answer a 5xx. Mesub then\nretries the same body for 3 days, so the event still gets through once you\nupdate `@mesub/node`; a 2xx would lose it. After 3 days of failures, Mesub\ndisables the endpoint.\n\nTo rotate the signing secret, regenerate it on the endpoint's dashboard page\nwith an overlap (24 hours, rather than stopping it now): the old secret keeps signing beside the new\none until the overlap ends. Every delivery in that window carries two\nsignatures in `webhook-signature`, space separated, the new secret's first,\nand `verify` accepts it when any one matches. `verify` takes one secret, so\nthere is nothing to hold twice: the old secret keeps verifying until you\ndeploy the new one as `MESUB_WEBHOOK_SECRET` (or `webhookSecret`), and the new\none verifies from then on. Deploy it before the overlap ends and no delivery\nfails. Regenerated with no overlap, the old secret stops at once: deliveries\nfail verification until the new secret is deployed, and Mesub retries each\nfor about 3 days.\n\n`event.delivery_id` is the `webhook-id` header: one per event and per\nendpoint, the same on every retry and resend. Drop a delivery you already\nhandled by it. `event.id` is the event's own, the same for every endpoint:\ndeduplicate on it across endpoints, and read the event again with\n`events.retrieve(event.id)`. Deliveries can arrive out of order: `event.sequence`\nnumbers one subscription's events 1, 2, 3..., two events of one change\nincluded. Apply them by `sequence`, and skip one lower than the last you\napplied for that subscription. An event without `sequence` (written before\nMesub numbered events, or one it could not number) cannot be placed: read the\nsubscription now with `subscriptions.retrieve` or `access` rather than\napplying its `data`.\n\n`event.data` is the subscription as it stood right after the change, however\nlate the delivery; `event.detail` says what the event is about. A body Mesub\nwrote before this shape, and retries as it was sent, is handed back in the\nsame shape: its detail at the top, and `id`, `network` and `api_version` null.\n\nA body sent from the dashboard carries `test: true`, on a made-up subscription\n(`sub_test`, `user_123`), whatever its `type`. Change nothing for it: `verify`\nkeeps the access cache as it is.\n\nA cancellation reaching its end reads `ended` from its `access_until` on. Once\nthe access events are on, its `subscription.access_revoked` comes at the\nexpiry, then `subscription.ended` with `end_reason: 'cancelled'` (in `data`\nand `detail`) and `detail.changed_at` (the expiry), usually within half an hour. Closing it later\nsends `subscription.ended` again, `end_reason: 'closed'`: one subscription can\nend twice, so key what you do on `end_reason`, not on the event alone.\n\n`subscription.created` carries `detail.first_payment`, `{ amount, mint,\nsignature }` of the first payment, or null when Mesub recorded none (a period\npaid only in part, which the next charge collects); absent on older events.\n\n`subscription.paused` and `subscription.unpaused` (with the access events)\nsay a seat was parked because the project holds more subscribers than its tier\nallows, and brought back: `data.paused` true or false, the status unchanged.\nA parked seat keeps access to the end of its paid period; its\n`subscription.access_revoked` comes then, and an `access_granted` follows an\nunpause when access had ended.\n\nA `subscription.renewed` can come late, on\na subscription that is no longer `active`. Its `detail.amount_received` is what\nthe receiver got, `amount` less the fee a Token-2022 mint withholds: book\nrevenue from it. Null when Mesub does not know it. The events, their bodies and how to\ntest: [Webhooks](https://docs.mesub.io/docs/webhooks).\n\n`subscription.renewal_upcoming` comes once per period, in its last quarter and\nthree days before the charge at most. Its detail says whether the wallet, as\nMesub just read it, can pay: a reading, not a promise.\n\n```ts\nif (event.type === 'subscription.renewal_upcoming' && !event.detail.can_pay) {\n    // renewal_issue: 'balance' (add funds) or 'authority' (the approval is gone)\n    await remind(event.data.external_id, event.detail.renewal_issue);\n}\n```\n\nIt changes no access, so `verify` leaves the access cache as it is for it.\n\n### Drive access from the access events\n\n`subscription.access_granted` and `subscription.access_revoked` are sent\nexactly when the access a subscription grants changes, whatever made it\nchange, a date passing included: the first access, a payment that gives it\nback, the end of a cancellation, of a paid period or of the plan. One event\nper change, never two; a renewal paid on time, or a resume while the period\nruns, sends neither. Keep your customer's access from these two alone; the\nother events say why.\n\n**They are off until Mesub turns them on**: Mesub is not sending them yet. Until then,\n`hasAccess` (or the guards) stays the way to know, and the other events say\nwhat changed.\n\n```ts\nswitch (event.type) {\n    case 'subscription.access_granted':\n    case 'subscription.access_revoked': {\n        const { id, access, external_id } = event.data;\n        if (event.sequence === undefined) {\n            // Cannot be placed: read the state now.\n            await setAccess(id, external_id, (await mesub.subscriptions.retrieve(id)).access);\n            break;\n        }\n        // Apply only what is newer than the last event applied for it.\n        if (event.sequence <= ((await lastSequence(id)) ?? 0)) break;\n        await setAccess(id, external_id, access, event.sequence);\n        break;\n    }\n    // The other events say why: payment_failed, stopped, cancelled...\n}\n```\n\n`data.access` is true on `access_granted`, false on `access_revoked`.\n`event.detail.changed_at` is when access changed: a date that passed with\nnothing else happening is that date to the millisecond, even when the event\nwas written a few seconds later, its `created_at`. `detail.blocked_reason` says\nwhether charges were held when access changed (`data.blocked_reason`'s words,\nnull when not). `detail.access_until` is, on `access_revoked`, the date access\nended (null for a stop or a close), and on `access_granted`, for a held\nsubscription, the date access ends unless a charge lands (null otherwise).\nBoth are absent on events written before Mesub added them. `verify` drops the\naccess answers cached for the customer on both.\n\n### Catch up on missed events\n\nMesub keeps the last 30 days of events, each the very body its webhooks\ncarried. Read them after an endpoint was down or turned off:\n\n```ts\nconst { data, has_more, available_since } = await mesub.events.list({\n    type: 'subscription.payment_failed', // optional\n    subscription: id, // optional\n    limit: 100, // 1 to 100, 25 by default\n});\nfor (const event of data) await handle(event); // the same shape as a webhook's\n\nconst one = await mesub.events.retrieve(eventId); // the id a webhook body carried\n```\n\nNewest first, and within one millisecond by `sequence`, highest first; page\nwith `starting_after` set to the last id. Events before\n`available_since` are not served. An event can appear a moment after its\n`created_at`, so when polling, page on until `created_at` is a minute older\nthan the newest you held, and skip the ids you have seen.\n\n## Errors\n\nEvery failure is a `MesubError` with a `status` (the HTTP status, or `null`)\nand a stable `code` to branch on:\n\n| `code`            | Meaning                                                                 |\n| ----------------- | ----------------------------------------------------------------------- |\n| `invalid_request` | 400, e.g. a wallet that is not an address                               |\n| `unauthorized`    | 401, an API key Mesub never issued                                      |\n| `forbidden`       | 403, e.g. signed terms that expired                                     |\n| `plan_not_found`  | 404, no plan of yours under that slug                                   |\n| `not_found`       | any other 404 Mesub answered, e.g. an unknown subscription id           |\n| `conflict`        | 409, e.g. a wallet already subscribed                                   |\n| `rate_limited`    | 429, after the retries, or a quota on create (`pending_cap_reached`)    |\n| `unavailable`     | 5xx, a timeout or a network error, after the retries                    |\n| `invalid_webhook` | a webhook that fails verification: signature, headers or timestamp      |\n| `unexpected`      | any other status, or an answer that is not Mesub's: is `baseUrl` right? |\n\nIt also carries `apiCode`, Mesub's own finer code (`already_subscribed`,\n`close_too_early`, ...), `retryable`, `retryAfter` in milliseconds, the\nparsed `body`, and `requestId`, the id Mesub gave the request\n(`Mesub-Request-Id`): log it, and quote it to Mesub support. New codes are added: keep a default branch. Every code:\n[Errors](https://docs.mesub.io/reference/errors).\n\nA subscribe (`create`, `transaction`, `submit`) refused with\n`subscription_cancelled` also says what to do with the cancelled subscription\nin the way: `subscriptionId`, `canResume` (true: resume it instead) and\n`closableFrom` (when it can be closed, while that is ahead). `subscriptionId`\nis null when that subscription is another customer's on the same wallet. The\nwidget routes hand the three on to the browser, as `subscription_id`,\n`can_resume` and `closable_from` beside `code` and `message`.\n\n`pending_cap_reached` is a quota, not a rate: too many subscriptions wait for\na signature. `create` is never retried for it, and `retryAfter` says when the\noldest stops counting, up to an hour. Do not hold a request that long.\n\nReads time out after 5 s and are retried twice. `create`, `transaction` and\nthe six manage calls are sent once and never retried.\n\n## Test your integration\n\n`@mesub/node/testing` is a fake Mesub for your own tests: no network, no Mesub\naccount, and nothing of it in your production bundle.\n\n```ts\nimport { FakeMesub } from '@mesub/node/testing';\n\nconst fake = new FakeMesub();\nconst mesub = fake.client(); // a real Mesub, wired to the fake\n\nfake.grant({ external_id: 'user_42' }, 'pro');\nawait mesub.hasAccess({ external_id: 'user_42' }, 'pro'); // true\n\nfake.grantLastPeriod({ external_id: 'user_7' }, 'pro', endsAt); // access until the plan ends\nfake.endPlan('pro'); // the end passed: what is held on it ends with plan_ended\n\nfake.grant({ external_id: 'user_9' }, 'pro', {\n    blocked_since: new Date().toISOString(), // charges blocked, access still on\n    blocked_reason: 'puller_not_allowed',\n});\n\n// A plan is in verified USDC unless told: here an unverified token, no symbol, no price.\nnew FakeMesub({ plans: ['pro', { slug: 'bonk', mint, token: { name: 'Bonk' } }] });\n\nfake.fail('outage'); // every call answers 503, until fail(null)\nfake.fail({ status: 503, code: 'unavailable' }); // Retry-After as Mesub: 2 s on submit, 20 s on retry\nconst { body, headers } = await fake.webhook('subscription.renewed'); // signed\nfake.addEvent('subscription.payment_failed', { subscription: { id } }); // on /v1/events\nfake.addEvent('subscription.access_revoked', { subscription: { id }, sequence: 5 });\nfake.park(id); // a seat over the tier's cap: paused, no next charge; unpark(id) brings it back\nfake.reset(); // between tests\n```\n\nEvery event the fake signs or serves carries the next `sequence` of its\nsubscription (`sequence: null` leaves it out). The access events are off by\ndefault, as on Mesub: `new FakeMesub({ accessEvents: true })` raises\n`subscription.access_granted` after the `subscription.created` of a submit,\none `sequence` later, an access event after any other change of the fake\nthat flips access, and `subscription.paused` and `subscription.unpaused` on\n`park` and `unpark`. `addEvent` and `webhook` make either type whatever this says.\n\nAs on Mesub, a client keeps a yes up to five minutes: a change shows to a new\n`fake.client()`, or on the next call with `new FakeMesub({ revalidateAfter: 0 })`.\n\nHand the fake's client to the guards and the routes, which otherwise build\ntheir own from `MESUB_API_KEY`:\n\n```ts\nconst mesub = fake.client();\napp.get('/api/analytics', yourLogin, requirePlan('pro', { client: mesub, customer }), handler);\napp.use('/api/mesub', yourLogin, mesubRoutes({ client: mesub, customer }));\n```\n\nPay now refuses as Mesub does, from what the fake holds: a parked seat, a row\nnot late, a plan past its end, and the wait between two retries, which\ndepends on `tier` (`dev` by default; `free` also caps a missed period at\nthree and closes at `retry_deadline`). A taken retry pulls nothing: the row\nstays `unpaid`.\n\n```ts\nconst fake = new FakeMesub({ revalidateAfter: 0 });\nconst late = fake.addSubscription({ wallet, plan: 'pro', status: 'unpaid' }); // late, retry tomorrow\nawait fake.client().subscriptions.retry(late.id); // 202, still unpaid\nawait fake.client().subscriptions.retry(late.id); // retry_too_soon, retryAfter 20 minutes\n```\n\n`fail()` answers every call, not only the one under test: a route that reads\nthe subscription before it pays now gets the error on that read. What only\nthe chain decides (`insufficient_balance`, `retry_cannot_succeed`) is tested\non the SDK call alone, or on a route that makes that one call.\n\nGuards, webhooks, subscribing and managing against it:\n[Test your integration](https://docs.mesub.io/docs/testing).\n\n## Options\n\n```ts\nnew Mesub({\n    apiKey, // default: process.env.MESUB_API_KEY\n    baseUrl, // default: process.env.MESUB_BASE_URL, then https://api.mesub.io; may carry a path\n    headers, // extra headers on every call, e.g. for a proxy\n    timeout, // per attempt, ms, default 5000\n    maxRetries, // default 2\n    fetch, // a custom fetch, e.g. bound to your own agent\n    cache, // where answers are kept, default: 10,000 entries in memory\n    maxStaleMs, // how long a stale answer serves the outage fallback, default 24 h\n    guardTimeout, // the guards' budget for the access check, ms, default 2000\n    webhookSecret, // the endpoint's whsec_ secret, default: process.env.MESUB_WEBHOOK_SECRET\n});\n```\n\nThey are checked once, by `new Mesub()`, which throws a `TypeError` naming\nthe option: a `baseUrl` that is not https (plain http only to `localhost` or\n`127.0.0.1`: every call carries the key), a timeout that is not a positive\nnumber of milliseconds, or `maxRetries` or `maxStaleMs` below 0. On an edge runtime\nwithout `process.env` (Cloudflare Workers), pass `apiKey` yourself.\n\n`await mesub.project()` answers `{ id }`, the project the key belongs to: the\nquickest way to check that a key works. A wrong key throws `invalid_api_key`.\n\nBehind a proxy, `baseUrl` may carry a path: every call goes under it\n(`https://proxy.example.com/mesub/v1/access`). Add whatever the proxy asks\nfor, such as a Cloudflare Access service token:\n\n```ts\nimport { Mesub } from '@mesub/node';\n\nnew Mesub({\n    baseUrl: 'https://proxy.example.com/mesub',\n    headers: {\n        'CF-Access-Client-Id': process.env.CF_ACCESS_CLIENT_ID!,\n        'CF-Access-Client-Secret': process.env.CF_ACCESS_CLIENT_SECRET!,\n    },\n});\n```\n\n`headers` cannot replace the SDK's own (`Authorization`, `User-Agent`,\n`Accept`, `Content-Type`, `Mesub-Version`).\n\nThe memory cache is per process and emptied on restart. A store is three\nmethods, so Redis is a few lines, and keeps the outage fallback across\nrestarts and servers:\n\n```ts\nimport { type AccessAnswer, type AccessList, type CacheStore, Mesub } from '@mesub/node';\n\nconst redisStore: CacheStore<AccessAnswer | AccessList> = {\n    get: async (key) => JSON.parse((await redis.get(key)) ?? 'null') ?? undefined,\n    set: async (key, entry, ttlMs) => {\n        await redis.set(key, JSON.stringify(entry), 'PX', ttlMs);\n    },\n    delete: async (key) => {\n        await redis.del(key);\n    },\n};\n\nconst mesub = new Mesub({ cache: redisStore });\n```\n\n`delete` is what drops a cached no once a subscription lands. It is optional:\na store without it gets that answer rewritten as stale instead, which also\nmakes the next call ask Mesub.\n\nKeys read `mesub:access:key-<hash>:<plan>:<kind>:<id>`, and\n`mesub:access-list:key-<hash>:<kind>:<id>` for `accessList`, so several\nprojects can share one Redis. `<hash>` is the start of your API key's SHA-256,\nnever the key itself: it needs no call to Mesub, so a server restarted during\nan outage still reads what was cached before. `<kind>` is `wallet`,\n`external_id` or `email`; `<id>` is the wallet itself, or for an external id or\nan email an HMAC-SHA256 under your API key, so neither is ever stored in\nclear. Rotating the API key starts a fresh cache: each customer costs one call\nto Mesub, and the old keys expire on their own TTL. So do keys written before\nthe `<kind>` segment, which are no longer read.\n\n### API version\n\nEvery call sends `Mesub-Version: 2026-10-02`, the version of the API this\nrelease was written against, exported as `API_VERSION`. It is pinned per\nrelease and cannot be set, so Mesub can change an answer for newer releases\nwithout breaking one already installed: upgrading the package is what moves\nyou to a newer version. Mesub reads it. A version Mesub no longer serves is\nrefused with a 400 (`invalid_request`, `apiCode` `unsupported_version`), and\nevery call throws, guards included. Mesub keeps a version while releases that\nsend it are in use.\n\n## Requirements\n\nNode 22 or later. Express, Next and `@nestjs/common` are optional peer\ndependencies: install the one you use. There is no runtime dependency.\n\nWhat CI runs the tests against: Node 22 and 24; Express 5, and Express 4 on\nNode 22; Nest 12. `@mesub/node/next` imports nothing from Next, only the Web\n`Request` and `Response`, so no Next version is installed to test it.\n\n## Development\n\n```sh\npnpm install\npnpm test          # unit tests, against a fake Mesub\npnpm test:coverage # the same, with v8 coverage of src/ in coverage/index.html\npnpm typecheck\npnpm lint\npnpm build         # dist/, ESM and CJS, with declaration files\npnpm check:exports # every entry resolves through import and require, shares one MesubError,\n                   # and the fake Mesub stays in @mesub/node/testing\n```\n\nThe pre-commit hook lints and checks the format of the staged files; the\npre-push hook runs typecheck, test, build and check:exports. CI runs all of\nit on Node 22 and 24, measures coverage on Node 24, fails under 90%, and\nkeeps the report as the `coverage` artifact of the run.\n\n### Releasing\n\nA version tag on main publishes, once a reviewer approves: see\n[RELEASING.md](./RELEASING.md) for the one-time setup and the checklist, and\n[CHANGELOG.md](./CHANGELOG.md) for what changed.\n\n### Contract test\n\n`pnpm test` runs against a fake Mesub. The contract test runs the SDK against\nthe real back instead, to catch the back changing a field, a status or an\nerror code under the SDK. With the back running locally (`pnpm start:dev` in\nMesub-io/backend):\n\n```sh\n# in the backend: write a merchant, a key, its plans and their subscribers\npnpm -s contract:fixture > /tmp/mesub-contract.env\n\n# here\nenv $(cat /tmp/mesub-contract.env) pnpm test:contract\n```\n\nWithout `MESUB_CONTRACT_URL` it is skipped, which is why `pnpm test` never\nneeds a back.\n\n`pnpm test` also holds what the fake serves to the back's own contract,\n`openapi/v1.json`, copied to `test/fixtures/openapi-v1.json` from the commit\nnamed in `test/openapi.spec.ts`. When the back's contract moves, copy it\nagain and move the commit.\n\nThe Contract workflow runs it on every push, every morning and by hand (with a\nback branch to try): it checks out Mesub-io/backend, starts Postgres and Redis,\nmigrates, seeds the fixture, starts the API and runs `pnpm test:contract`.\nThe back is private, so it needs one secret, set once by an admin:\n\n1. `ssh-keygen -t ed25519 -N '' -C node-sdk-contract -f contract_key`\n2. Mesub-io/backend, Settings, Deploy keys: add `contract_key.pub`, read-only.\n3. Mesub-io/node-sdk, Settings, Secrets and variables, Actions: a repository\n   secret `BACKEND_DEPLOY_KEY` holding `contract_key`. Then delete both files.\n\nWithout it the job is skipped with a warning. Whoever can push a branch here\ncan read the back's code through that key.\n\n## License\n\n[MIT](./LICENSE)\n","readmeFilename":"README.md"}