{"_id":"@analytickit/plugin-contrib","_rev":"1-bd1ff2d3f02c29875bb4744fae73f2c8","name":"@analytickit/plugin-contrib","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.5":{"name":"@analytickit/plugin-contrib","version":"0.0.5","description":"Contributed utilities for plugin authors","author":{"name":"analytickit","email":"hey@analytickit.com"},"repository":{"type":"git","url":"git+https://github.com/analytickit/plugin-contrib.git"},"bugs":{"url":"https://github.com/analytickit/plugin-contrib/issues"},"scripts":{"build":"yarn clean && yarn compile","clean":"rimraf dist/*","compile":"tsc -b","prepublishOnly":"yarn build"},"devDependencies":{"@types/node":"^14.14.37","eslint":"^7.18.0","eslint-config-prettier":"^7.2.0","eslint-plugin-import":"^2.20.2","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^4.1.1","eslint-plugin-react":"^7.20.0","eslint-plugin-simple-import-sort":"^7.0.0","husky":">=4","lint-staged":">=10.5.1","prettier":"^2.2.1","rimraf":"^3.0.0","typescript":"^4.0.5"},"homepage":"https://github.com/analytickit/plugin-contrib#readme","license":"MIT","types":"dist/index.d.ts","main":"dist/index.js","husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.{js,ts}":"eslint --fix","*.{js,ts,css,scss,json,yml,yaml,md}":"prettier --write"},"gitHead":"32c8243517e68d7254c8a22c447c672295f0e098","_id":"@analytickit/plugin-contrib@0.0.5","_nodeVersion":"16.17.0","_npmVersion":"8.15.0","dist":{"integrity":"sha512-Xua17U4k0LSsGZTNgPcneq9sCy5MFjF9uOPyK470nB0MXKGNxsHznynqKkupd392I6rUrkuLWDBqmhvg0C//aw==","shasum":"6a3ee58a0da108a5c8bdc06e008a3736d6358e56","tarball":"https://registry.npmjs.org/@analytickit/plugin-contrib/-/plugin-contrib-0.0.5.tgz","fileCount":11,"unpackedSize":10231,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDkTg2V3IYFBvtZdQE/ds4krPPG9kHFpVJJmGB9GGvx7wIhAOiXwbl5MehrlENXz4n6+je26YwaivbEIkzyjXPii3tc"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjFQ+HACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmph7hAAiGm3TSgBGD1VXxx0I9S25QZC/+aShH2O2FQzySZEhr3yiB17\r\nymzAqpBjHChMDkHlWXpjsMceFdIZ4WL+Qf4eGV3GOK//M6WiQcSn+JT+4iv7\r\ndfivkVd/QeRmVIisXK6BBRFbR2QAE73brJEJGbkawZI9zmIaUlOoEBA4vMT8\r\naHnxMwQYcYqy17GWnjprjaEDyZ0gyRE/+VCGGNAq61Cf16+PDEDwrbTNfYyd\r\nzeNLD4gITi0qYgfkkI5796RxT9a3emQm74b3RvbX0QJDHj83c0VHhqNuytbX\r\n1lDee5sF0QY6sqBVUdp9ZCvN+Q4ALbodm60CCtXeWa2coPDm3FDG4jP8gN78\r\nuGO/9N+CC9itQHKvpn93I1syLceavil9jFrfDW8K8VBeQ65CSs+0/z6EHa3+\r\naqoKPyLcgEbHIobEYR6ZED76iGDErsGTJO7AsgHKGKUs1Z8TAetDBMKYfX9P\r\n9Fqqs8gqwAF7AXKzV6vqcDKJosz4Zt5pfNX0M+wKnHVmODxFFHpmC/fjLzxh\r\nICaNeWkF7Xy5CbsUK45SjnQ/djnwIN1eP1KMl+/IuFDXOcRZ/wdLuMjeXeaN\r\nZqfzt88G0y66R6gUSrs3Z6fKG0Gb6FfCsBycfagbyAHYwT4cKmrPUKTazPg6\r\nezSHxVcWls2/PJxHIK88YXrLrJX8RRvtO/M=\r\n=+wKj\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"kitadmin1","email":"analytickit@gmail.com"},"directories":{},"maintainers":[{"name":"kitadmin1","email":"analytickit@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/plugin-contrib_0.0.5_1662324615654_0.36736409427970584"},"_hasShrinkwrap":false},"0.0.1":{"name":"@analytickit/plugin-contrib","version":"0.0.1","description":"Contributed utilities for plugin authors","author":{"name":"AnalyticKit","email":"hey@analytickit.com"},"repository":{"type":"git","url":"git+https://github.com/AnalyticKit/plugin-contrib.git"},"bugs":{"url":"https://github.com/AnalyticKit/plugin-contrib/issues"},"scripts":{"build":"yarn clean && yarn compile","clean":"rimraf dist/*","compile":"tsc -b","prepublishOnly":"yarn build"},"devDependencies":{"@types/node":"^14.14.37","eslint":"^7.18.0","eslint-config-prettier":"^7.2.0","eslint-plugin-import":"^2.20.2","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^4.1.1","eslint-plugin-react":"^7.20.0","eslint-plugin-simple-import-sort":"^7.0.0","husky":">=4","lint-staged":">=10.5.1","prettier":"^2.2.1","rimraf":"^3.0.0","typescript":"^4.0.5"},"homepage":"https://github.com/AnalyticKit/plugin-contrib#readme","license":"MIT","types":"dist/index.d.ts","main":"dist/index.js","husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.{js,ts}":"eslint --fix","*.{js,ts,css,scss,json,yml,yaml,md}":"prettier --write"},"gitHead":"32c8243517e68d7254c8a22c447c672295f0e098","_id":"@analytickit/plugin-contrib@0.0.1","_nodeVersion":"16.17.0","_npmVersion":"8.15.0","dist":{"integrity":"sha512-HwAtDoMf5QqPS6B/r74iyi86jh+qwT+T00jGvOZqNxu939TLIKQ3id+/z5Dq9ZZdEppSo8JyJlXJFxslNhZVrg==","shasum":"dba7675e1e3740311639ab708d0d252851dd3317","tarball":"https://registry.npmjs.org/@analytickit/plugin-contrib/-/plugin-contrib-0.0.1.tgz","fileCount":11,"unpackedSize":10231,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGOPryQmNhWOUMo6aWPQAOANGkIYMaT4SKCmWDiNIdPjAiEAgqHrNB4dxBU2f58dwuVQ9NjNqi6tqfBrMWKlnIAmMU4="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjSronACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpggRAAmIaNO0rsqhMqMN7yNpoMaCNmZ1zh4A1nN3xzzC28dmeGKPGg\r\n9/6ea/0nuC4KoA5elb4ue+dl1lCKLU3fr7v5b/lRmrvJxvpOoBz53+tEV5Zd\r\nyekkif/wt2oyU5qlrF8K6oI0lKMH4Gm38/x2qfMH+4kPhXpUzc6243uKtDrg\r\nf/Te80SQKmcmO1mvD3YY7rjHVI7dacNo1gFSxV2vR9f3iMw78+ONgD5sUFt7\r\nU95X+KNRcpi/VJdC8je6/w1dHslpxbIciHb4SbQmfmhcyMU8Tjc/P50zGfCU\r\ntuITocnoO7xYOOouzZz32uWm53cp6UIa8tDFWhp5Oo+1u++bDVeCW72fvOqb\r\n+hb5JqadVQR7orVRpUo7pY6+dTMOrrZpQM73HuU2457qsPluWu1jo/aQApj7\r\ndr5VBrsfI5Bt7wLSYB7aDwPdjPWFPNIO+xy5Lna93zqyBTEczH4MCencL6a/\r\nlPRHFkcTzJsssDhqPUkeMEr6I4hJq0RC/4GqriTwq8A1seGF+SxEIYwQb6HY\r\nls4qVBfr/KcJ9tl9YEgsoSMFAQm7tWK3gRnx1Uf1xlGrTR29o9F7SKKqUGjq\r\nFK7OwUz8IrrPv+nE8OqQkpMj7b0qf1GQ2beherqgz1kSX3lv98sGD8ANhnfJ\r\nxO59+idJxQ212ElKJWh0rrPGSqAO0w0QjDo=\r\n=0mbV\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"kitadmin1","email":"analytickit@gmail.com"},"directories":{},"maintainers":[{"name":"kitadmin1","email":"analytickit@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/plugin-contrib_0.0.1_1665841703126_0.9137838011067352"},"_hasShrinkwrap":false}},"time":{"created":"2022-09-04T20:50:15.585Z","0.0.5":"2022-09-04T20:50:15.883Z","modified":"2022-10-15T13:48:23.396Z","0.0.1":"2022-10-15T13:48:23.323Z"},"maintainers":[{"name":"kitadmin1","email":"analytickit@gmail.com"}],"description":"Contributed utilities for plugin authors","homepage":"https://github.com/AnalyticKit/plugin-contrib#readme","repository":{"type":"git","url":"git+https://github.com/AnalyticKit/plugin-contrib.git"},"author":{"name":"AnalyticKit","email":"hey@analytickit.com"},"bugs":{"url":"https://github.com/AnalyticKit/plugin-contrib/issues"},"license":"MIT","readme":"## AnalyticKit Plugin Contrib\n\n[![npm package](https://img.shields.io/npm/v/@analytickit/plugin-contrib?style=flat-square)](https://www.npmjs.com/package/@analytickit/plugin-contrib)\n[![MIT License](https://img.shields.io/badge/License-MIT-red.svg?style=flat-square)](https://opensource.org/licenses/MIT)\n\nThis project contains shared code that AnalyticKit plugin authors can use.\n\nCode imported from this package runs outside the plugin virtual machine, and can thus use timeouts and other NodeJS features.\n\n## Included in this package\n\n### Batch processing\n\n```typescript\nimport { createBuffer } from '@analytickit/plugin-contrib'\nimport fetch from 'node-fetch'\n\nexport function setupPlugin({ global }) {\n    global.buffer = createBuffer({\n        limit: 10 * 1024 * 1024, // 10 MB\n        timeoutSeconds: 10 * 60, // 10 minutes\n        onFlush: async (batch) => {\n            const resp = await fetch('https://httpbin.org/post', {\n                method: 'post',\n                body: JSON.stringify(batch),\n                headers: { 'Content-Type': 'application/json' },\n            })\n            const json = await resp.json()\n            if (!json.success) {\n                // retry somehow?\n            }\n        },\n    })\n}\n\nexport function teardownPlugin({ global }) {\n    global.buffer.flush()\n}\n\nexport function processEvent(event, { config, global }) {\n    global.buffer.add(event, JSON.stringify(event).length) // add(object, points)\n    return event\n}\n```\n\n## Releasing a new version\n\nIt's magic! Just bump up `version` in `package.json` on the main branch and the new version will be published automatically, on GitHub and on npm. Courtesy of GitHub Actions.\n\n## Questions?\n\n### [Join our Slack community.](https://join.slack.com/t/analytickitusers/shared_invite/enQtOTY0MzU5NjAwMDY3LTc2MWQ0OTZlNjhkODk3ZDI3NDVjMDE1YjgxY2I4ZjI4MzJhZmVmNjJkN2NmMGJmMzc2N2U3Yjc3ZjI5NGFlZDQ)\n","readmeFilename":"README.md"}