{"_id":"@chrono-os/digital-products","_rev":"3-a8a88fcc74967e52ef0b897929b5bc83","name":"@chrono-os/digital-products","dist-tags":{"latest":"0.2.1"},"versions":{"0.1.0":{"name":"@chrono-os/digital-products","version":"0.1.0","keywords":["chrono-os","digital-products","ebook","membership","r2","s3","presigned-url"],"license":"UNLICENSED","_id":"@chrono-os/digital-products@0.1.0","maintainers":[{"name":"sugarhoneyicetea","email":"aquilaferraz@gmail.com"}],"homepage":"https://github.com/SugarHoneyIceTea/digital-products#readme","bugs":{"url":"https://github.com/SugarHoneyIceTea/digital-products/issues"},"dist":{"shasum":"ac13e9b053abb4b2a7e4a614d856ba366f9c1bac","tarball":"https://registry.npmjs.org/@chrono-os/digital-products/-/digital-products-0.1.0.tgz","fileCount":17,"integrity":"sha512-ZlPxKbyn4UU5ZCZrMT+1QGIO63cqPymBZibnB1H5nZ5s4Bvg/T2mjhAa/OMsK3x9cYt6UifBatxfMWOiBlOW9Q==","signatures":[{"sig":"MEUCIQDg/kIz0X1z/wADEHHXgn0uYHynenvm5LCikVVrMk8GaQIgePbqHkwjJ6sIrswb5ZC1aqpVGREx3OG7iAPA1YfUfyo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":78325},"main":"./dist/fastify/index.cjs","type":"module","types":"./dist/fastify/index.d.ts","module":"./dist/fastify/index.js","engines":{"node":">=20"},"exports":{"./schema":{"types":"./dist/schema/index.d.ts","import":"./dist/schema/index.js","require":"./dist/schema/index.cjs"},"./fastify":{"types":"./dist/fastify/index.d.ts","import":"./dist/fastify/index.js","require":"./dist/fastify/index.cjs"},"./prisma-template":"./prisma/schema.template.prisma"},"gitHead":"66beb646b69696617d7de53bd501a8595bc3e840","scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","typecheck":"tsc --noEmit"},"_npmUser":{"name":"sugarhoneyicetea","email":"aquilaferraz@gmail.com"},"repository":{"url":"git+https://github.com/SugarHoneyIceTea/digital-products.git","type":"git"},"_npmVersion":"11.9.0","description":"Catálogo de produtos digitais (Product/Asset/Membership/DownloadLog) + presigned URLs R2/S3 + access gate por user+productSlug. Reaproveitável em qualquer site de venda de PDFs/cursos","directories":{},"_nodeVersion":"24.14.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"zod":"^3.23.0","tsup":"^8.0.0","vitest":"^1.5.0","fastify":"^5.0.0","typescript":"^5.4.0","@aws-sdk/client-s3":"^3.0.0","@aws-sdk/s3-request-presigner":"^3.0.0"},"peerDependencies":{"zod":"^3.23.0","fastify":"^5.0.0","@prisma/client":"^5.0.0 || ^6.0.0","@aws-sdk/client-s3":"^3.0.0","@aws-sdk/s3-request-presigner":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/digital-products_0.1.0_1779797415324_0.6503205804081313","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@chrono-os/digital-products","version":"0.2.0","keywords":["chrono-os","digital-products","ebook","membership","r2","s3","presigned-url"],"license":"UNLICENSED","_id":"@chrono-os/digital-products@0.2.0","maintainers":[{"name":"sugarhoneyicetea","email":"aquilaferraz@gmail.com"}],"homepage":"https://github.com/SugarHoneyIceTea/digital-products#readme","bugs":{"url":"https://github.com/SugarHoneyIceTea/digital-products/issues"},"dist":{"shasum":"e2f1f9df636206908dc1c2b9e5b5f518157232a1","tarball":"https://registry.npmjs.org/@chrono-os/digital-products/-/digital-products-0.2.0.tgz","fileCount":17,"integrity":"sha512-2G0PihQclFLT1RXG/Aqladyc+HN5KqUKjUi6FYbpUUAaIGwAe1nNQOSWkx1Yh55N/UQtuRzQc7GE/Gqv09/2xw==","signatures":[{"sig":"MEUCIQDMwuVCxjVLj3DnskHQZm/tUmLGP7P589p/3rcKFEYw/gIgCq3pIMO0BxF41KlB8V+e/gqH+3uPoc1QSxM9y/HEfYM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":80244},"main":"./dist/fastify/index.cjs","type":"module","types":"./dist/fastify/index.d.ts","module":"./dist/fastify/index.js","engines":{"node":">=20"},"exports":{"./schema":{"types":"./dist/schema/index.d.ts","import":"./dist/schema/index.js","require":"./dist/schema/index.cjs"},"./fastify":{"types":"./dist/fastify/index.d.ts","import":"./dist/fastify/index.js","require":"./dist/fastify/index.cjs"},"./prisma-template":"./prisma/schema.template.prisma"},"gitHead":"45f26cba41f4b2968c212434a70b479bca6f0e44","scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","typecheck":"tsc --noEmit"},"_npmUser":{"name":"sugarhoneyicetea","email":"aquilaferraz@gmail.com"},"repository":{"url":"git+https://github.com/SugarHoneyIceTea/digital-products.git","type":"git"},"_npmVersion":"11.9.0","description":"Catálogo de produtos digitais (Product/Asset/Membership/DownloadLog) + presigned URLs R2/S3 + access gate por user+productSlug. Reaproveitável em qualquer site de venda de PDFs/cursos","directories":{},"_nodeVersion":"24.14.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"zod":"^3.23.0","tsup":"^8.0.0","vitest":"^1.5.0","fastify":"^5.0.0","typescript":"^5.4.0","@aws-sdk/client-s3":"^3.0.0","@aws-sdk/s3-request-presigner":"^3.0.0"},"peerDependencies":{"zod":"^3.23.0","fastify":"^5.0.0","@prisma/client":"^5.0.0 || ^6.0.0 || ^7.0.0","@aws-sdk/client-s3":"^3.0.0","@aws-sdk/s3-request-presigner":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/digital-products_0.2.0_1788409475475_0.6230553892036379","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"_id":"@chrono-os/digital-products@0.2.1","bugs":{"url":"https://github.com/SugarHoneyIceTea/digital-products/issues"},"dist":{"shasum":"ce04560362a33b1814a98670582dcdb72a50894d","tarball":"https://registry.npmjs.org/@chrono-os/digital-products/-/digital-products-0.2.1.tgz","fileCount":17,"integrity":"sha512-gTzzepSm+Cr7Ygn5A2L+blPfZ3Nfo/bRB+t6wGKGo5otuwZQdM1nHSDU/TMs2FaGorhkyqpdK0tjH3XZKnjmOg==","signatures":[{"sig":"MEYCIQDV4cMrHE0kjbz6IMz7uSMqSJkzq6TQJh1VLLadhIDJvAIhALSGDrphsNofTeFvGdBRoA9jXIdLMLjz86WFqugBHxs+","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCEKRkPzw1CxQOzdFYgU1QtAoP3BJD08JTc18V/mvPqoQIgGFxr0zTXsPx/iSHJ4h3jszeQgYRz4R2QqIVYHeMzqLU="}],"unpackedSize":81018},"main":"./dist/fastify/index.cjs","name":"@chrono-os/digital-products","type":"module","types":"./dist/fastify/index.d.ts","module":"./dist/fastify/index.js","engines":{"node":">=20"},"exports":{"./schema":{"import":{"types":"./dist/schema/index.d.ts","default":"./dist/schema/index.js"},"require":{"types":"./dist/schema/index.d.cts","default":"./dist/schema/index.cjs"}},"./fastify":{"import":{"types":"./dist/fastify/index.d.ts","default":"./dist/fastify/index.js"},"require":{"types":"./dist/fastify/index.d.cts","default":"./dist/fastify/index.cjs"}},"./prisma-template":"./prisma/schema.template.prisma"},"gitHead":"9a9196afd5036bb7d597d8e7ce2706205f5223e2","license":"UNLICENSED","scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","typecheck":"tsc --noEmit"},"version":"0.2.1","_npmUser":{"name":"sugarhoneyicetea","email":"aquilaferraz@gmail.com"},"homepage":"https://github.com/SugarHoneyIceTea/digital-products#readme","keywords":["chrono-os","digital-products","ebook","membership","r2","s3","presigned-url"],"repository":{"url":"git+https://github.com/SugarHoneyIceTea/digital-products.git","type":"git"},"_npmVersion":"11.9.0","description":"Catálogo de produtos digitais (Product/Asset/Membership/DownloadLog) + presigned URLs R2/S3 + access gate por user+productSlug. Reaproveitável em qualquer site de venda de PDFs/cursos","directories":{},"maintainers":[{"name":"sugarhoneyicetea","email":"aquilaferraz@gmail.com"}],"_nodeVersion":"24.14.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"zod":"^3.23.0","tsup":"^8.0.0","vitest":"^1.5.0","fastify":"^5.0.0","typescript":"5.9.3","@aws-sdk/client-s3":"^3.0.0","@aws-sdk/s3-request-presigner":"^3.0.0"},"peerDependencies":{"zod":"^3.23.0","fastify":"^5.0.0","@prisma/client":"^5.0.0 || ^6.0.0 || ^7.0.0","@aws-sdk/client-s3":"^3.0.0","@aws-sdk/s3-request-presigner":"^3.0.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/digital-products_0.2.1_1789076726675_0.8950591887926451"}}},"time":{"created":"2026-05-26T12:10:15.148Z","modified":"2026-09-10T21:45:26.965Z","0.1.0":"2026-05-26T12:10:15.472Z","0.2.0":"2026-09-03T04:24:35.599Z","0.2.1":"2026-09-10T21:45:26.775Z"},"bugs":{"url":"https://github.com/SugarHoneyIceTea/digital-products/issues"},"license":"UNLICENSED","homepage":"https://github.com/SugarHoneyIceTea/digital-products#readme","keywords":["chrono-os","digital-products","ebook","membership","r2","s3","presigned-url"],"repository":{"url":"git+https://github.com/SugarHoneyIceTea/digital-products.git","type":"git"},"description":"Catálogo de produtos digitais (Product/Asset/Membership/DownloadLog) + presigned URLs R2/S3 + access gate por user+productSlug. Reaproveitável em qualquer site de venda de PDFs/cursos","maintainers":[{"name":"sugarhoneyicetea","email":"aquilaferraz@gmail.com"}],"readme":"# @chrono-os/digital-products\n\nCatálogo de produtos digitais (`Product` + `Asset` + `Membership` + `DownloadLog`) com presigned URLs R2/S3 (TTL configurável) + access gate por `user+productSlug` + audit de downloads (IP hash). Reaproveitável em qualquer site de venda de PDFs, cursos, ou conteúdo digital protegido.\n\n## Status\n\n🚧 **0.1.0 em construção** — código será extraído do SVA na Fase 1 da Trilha C.\n\n## Install\n\n```bash\nyarn add @chrono-os/digital-products\n```\n\nAplicar template Prisma:\n```bash\ncat node_modules/@chrono-os/digital-products/prisma/schema.template.prisma >> prisma/schema.prisma\nyarn prisma migrate dev --name add_digital_products\n```\n\n## Uso\n\n```ts\nimport { digitalProductsPlugin } from '@chrono-os/digital-products/fastify'\n\nawait server.register(digitalProductsPlugin, {\n  storage: {\n    endpoint: process.env.R2_ENDPOINT,\n    accessKeyId: process.env.R2_ACCESS_KEY_ID,\n    secretAccessKey: process.env.R2_SECRET_ACCESS_KEY,\n    bucket: process.env.R2_BUCKET_NAME,\n  },\n  fallbackPublicBaseUrl: process.env.EBOOK_FILES_BASE_URL,  // bootstrap mode\n  signedUrlTtlMinutes: 15,\n})\n\n// Rotas expostas (todas auth-gated):\n// GET  /members/library                 → lista produtos do user\n// POST /members/download/:productSlug   → presigned URL + log\n```\n\n## API\n\n- **`digitalProductsPlugin(opts)`** — Fastify plugin\n- **`grantMembershipForOrder`, `listMembershipsForUser`, `userHasAccess`** — services\n- **`signObjectUrl(fileKey, opts)`** — wrapper R2/S3 com TTL\n- Models Prisma: `Product`, `Asset`, `Membership`, `DownloadLog`, `BundleItem` (self-rel)\n\n## Bootstrap mode\n\nSem credenciais R2: retorna `{ kind: 'public', url: <fallback> }` usando `fallbackPublicBaseUrl`. Útil em dev.\n\n## Versionamento\n\nSemVer. Tag `v*` → npmjs.org.\n\n## Origem\n\nExtraído de `apps/api/src/services/membership.service.ts`, `apps/api/src/lib/storage.ts`, `apps/api/src/routes/members.ts` do SVA. Catálogo (`lib/ebooks.ts`) NÃO faz parte — o pacote oferece o **shape**, o consumer provê os **dados**.\n","readmeFilename":"README.md"}