{"_id":"@aegenet/ya-vigil-reporter","_rev":"4-70dc1ba3bfe5416bcec20d977acedb32","name":"@aegenet/ya-vigil-reporter","dist-tags":{"latest":"1.3.0"},"versions":{"1.0.0":{"name":"@aegenet/ya-vigil-reporter","description":"Yet Another Vigil Reporter","version":"1.0.0","main":"dist/index.cjs","module":"dist/index.mjs","exports":{"node":{"require":"./dist/index.cjs","import":"./dist/index.mjs"},"default":{"require":"./dist/index.cjs","import":"./dist/index.mjs"}},"typings":"./dist/bundle.d.ts","author":{"name":"Alexandre Genet"},"repository":{"type":"git","url":"git+https://github.com/aegenet/ya-vigil-reporter.git"},"license":"MIT","engines":{"node":">=18"},"nyc":{"check-coverage":true,"exclude":"**/*.spec.ts","reporter":["html","lcov","text","text-summary"],"report-dir":"coverage"},"devDependencies":{},"dependencies":{},"pre-commit":["lint","test"],"publishConfig":{"registry":"https://npm.pkg.github.com","@aegenet:registry":"https://registry.npmjs.org/"},"scripts":{},"gitHead":"314f58b48667ef9cbca11ed1cd92064f6b2e3d54","bugs":{"url":"https://github.com/aegenet/ya-vigil-reporter/issues"},"homepage":"https://github.com/aegenet/ya-vigil-reporter#readme","_id":"@aegenet/ya-vigil-reporter@1.0.0","_nodeVersion":"18.17.0","_npmVersion":"9.6.7","dist":{"integrity":"sha512-SkG7x+kwFmewrhJnBHB2pM766tiHeJhxQaU6xngeM+IvLObehfMSN9307ulS00xIkbpkJQ7Yu34rv80Iwlaftw==","shasum":"4ae304fe52a3037e4460f571e7b0c4b54c7c9a41","tarball":"https://registry.npmjs.org/@aegenet/ya-vigil-reporter/-/ya-vigil-reporter-1.0.0.tgz","fileCount":7,"unpackedSize":22364,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICEBNWq7XtV9IZOwgcwUf318OXQHDfDhSB42J6oUIIICAiEA3J5IMjJEawNl5/CksoQMS4Cz3yjRgq2thQx9VgTeA/k="}]},"_npmUser":{"name":"agenet","email":"npm@creadigme.net"},"directories":{},"maintainers":[{"name":"agenet","email":"npm@creadigme.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ya-vigil-reporter_1.0.0_1690472229780_0.5730469649486443"},"_hasShrinkwrap":false},"1.0.1":{"name":"@aegenet/ya-vigil-reporter","description":"Yet Another Vigil Reporter","version":"1.0.1","main":"dist/index.cjs","module":"dist/index.mjs","exports":{"node":{"require":"./dist/index.cjs","import":"./dist/index.mjs"},"default":{"require":"./dist/index.cjs","import":"./dist/index.mjs"}},"typings":"./dist/bundle.d.ts","author":{"name":"Alexandre Genet"},"repository":{"type":"git","url":"git+https://github.com/aegenet/ya-vigil-reporter.git"},"license":"MIT","engines":{"node":">=18"},"nyc":{"check-coverage":true,"exclude":"**/*.spec.ts","reporter":["html","lcov","text","text-summary"],"report-dir":"coverage"},"devDependencies":{},"dependencies":{},"pre-commit":["lint","test"],"publishConfig":{"registry":"https://npm.pkg.github.com","@aegenet:registry":"https://registry.npmjs.org/"},"scripts":{},"gitHead":"f2a8ab69bbe3ae16d1b5789b1bcbcf5928d468b2","bugs":{"url":"https://github.com/aegenet/ya-vigil-reporter/issues"},"homepage":"https://github.com/aegenet/ya-vigil-reporter#readme","_id":"@aegenet/ya-vigil-reporter@1.0.1","_nodeVersion":"18.17.0","_npmVersion":"9.6.7","dist":{"integrity":"sha512-C5hiGJRkINlbttq5yWo9/kkWqbmJP6biGrStpVYXun37ToThlbGLeoTsFRP7QEf/Uoq23rtq5Dl1Q9SJ3a3ILQ==","shasum":"0680e63e5b92266471f73a1c84092c4112c717ff","tarball":"https://registry.npmjs.org/@aegenet/ya-vigil-reporter/-/ya-vigil-reporter-1.0.1.tgz","fileCount":7,"unpackedSize":22912,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCixz0cUXM62xzvHjGwFKzlJTAkL1iMYIE3KLy0mo7D2AIgQdJtuFctfQG3tRaYilothOQVV0EJh0yB6CZ5VjKp/tU="}]},"_npmUser":{"name":"agenet","email":"npm@creadigme.net"},"directories":{},"maintainers":[{"name":"agenet","email":"npm@creadigme.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ya-vigil-reporter_1.0.1_1690493083261_0.9572572256266665"},"_hasShrinkwrap":false},"1.1.0":{"name":"@aegenet/ya-vigil-reporter","description":"Yet Another Vigil Reporter","version":"1.1.0","main":"dist/index.cjs","module":"dist/index.mjs","exports":{"node":{"require":"./dist/index.cjs","import":"./dist/index.mjs"},"default":{"require":"./dist/index.cjs","import":"./dist/index.mjs"}},"typings":"./dist/bundle.d.ts","author":{"name":"Alexandre Genet"},"repository":{"type":"git","url":"git+https://github.com/aegenet/ya-vigil-reporter.git"},"license":"MIT","engines":{"node":">=18"},"nyc":{"check-coverage":true,"exclude":"**/*.spec.ts","reporter":["html","lcov","text","text-summary"],"report-dir":"coverage"},"devDependencies":{},"dependencies":{},"pre-commit":["lint","test"],"publishConfig":{"registry":"https://npm.pkg.github.com","@aegenet:registry":"https://registry.npmjs.org/"},"scripts":{},"gitHead":"350de5bac6fbc183d63a7d985617d9276c206159","bugs":{"url":"https://github.com/aegenet/ya-vigil-reporter/issues"},"homepage":"https://github.com/aegenet/ya-vigil-reporter#readme","_id":"@aegenet/ya-vigil-reporter@1.1.0","_nodeVersion":"18.17.0","_npmVersion":"9.6.7","dist":{"integrity":"sha512-IgY8XJbJ3rOgrUsYLfHtUoDOOTFgQjyGRyGfru4DfBqPIbnXPvuj5Ef4WX89KH4pzvI83P5efPt4l8MzWZrQuQ==","shasum":"444c0d97c07b4d407b4d9b069b2ee2d31f6a8329","tarball":"https://registry.npmjs.org/@aegenet/ya-vigil-reporter/-/ya-vigil-reporter-1.1.0.tgz","fileCount":7,"unpackedSize":25133,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCqpZT0rAa+hq11GhqXpRog9U6yOpX4F5ZDCs/tivddPwIgS+OUddjZkobyjQsPOL09aywJO0LLGc0xt484rYFP9Qk="}]},"_npmUser":{"name":"agenet","email":"npm@creadigme.net"},"directories":{},"maintainers":[{"name":"agenet","email":"npm@creadigme.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ya-vigil-reporter_1.1.0_1690628500177_0.856780178897735"},"_hasShrinkwrap":false},"1.2.0":{"name":"@aegenet/ya-vigil-reporter","description":"Yet Another Vigil Reporter","version":"1.2.0","main":"dist/index.cjs","module":"dist/index.mjs","exports":{"node":{"require":"./dist/index.cjs","import":"./dist/index.mjs"},"default":{"require":"./dist/index.cjs","import":"./dist/index.mjs"}},"typings":"./dist/bundle.d.ts","author":{"name":"Alexandre Genet"},"repository":{"type":"git","url":"git+https://github.com/aegenet/ya-vigil-reporter.git"},"license":"MIT","engines":{"node":">=18"},"nyc":{"check-coverage":true,"exclude":"**/*.spec.ts","reporter":["html","lcov","text","text-summary"],"report-dir":"coverage"},"devDependencies":{},"dependencies":{},"pre-commit":["lint","test"],"publishConfig":{"registry":"https://npm.pkg.github.com","@aegenet:registry":"https://registry.npmjs.org/"},"scripts":{},"_id":"@aegenet/ya-vigil-reporter@1.2.0","gitHead":"6687bbcbfaf9a57f25cf86b2a6863dde53bbd7e1","bugs":{"url":"https://github.com/aegenet/ya-vigil-reporter/issues"},"homepage":"https://github.com/aegenet/ya-vigil-reporter#readme","_nodeVersion":"18.18.0","_npmVersion":"9.8.1","dist":{"integrity":"sha512-DkQx0+Jh6P1csFx3vDLXncxN8UNwSA8SzJNeEbHRHjpkmZjNVj2is6r0f9S/UxOdDnhRuY+jrPJZLZObVop9sg==","shasum":"a25142cc235d0ad3ec11ebe803437510fadd0ed2","tarball":"https://registry.npmjs.org/@aegenet/ya-vigil-reporter/-/ya-vigil-reporter-1.2.0.tgz","fileCount":7,"unpackedSize":26293,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBTguiZPc3JTBpSXjjaQ7N8dlNjtAAZnj4KAkUKwIQaUAiBTjUFCO4dDIREpopJ+WzOeSMh6x7yyiZYdNy068QgDiw=="}]},"_npmUser":{"name":"agenet","email":"npm@creadigme.net"},"directories":{},"maintainers":[{"name":"agenet","email":"npm@creadigme.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ya-vigil-reporter_1.2.0_1696880191524_0.12782219233515568"},"_hasShrinkwrap":false},"1.3.0":{"name":"@aegenet/ya-vigil-reporter","description":"Yet Another Vigil Reporter","version":"1.3.0","main":"dist/index.cjs","module":"dist/index.mjs","exports":{"node":{"require":"./dist/index.cjs","import":"./dist/index.mjs"},"default":{"require":"./dist/index.cjs","import":"./dist/index.mjs"}},"typings":"./dist/bundle.d.ts","author":{"name":"Alexandre Genet"},"repository":{"type":"git","url":"git+https://github.com/aegenet/ya-vigil-reporter.git"},"license":"MIT","engines":{"node":">=18"},"nyc":{"check-coverage":true,"exclude":"**/*.spec.ts","reporter":["html","lcov","text","text-summary"],"report-dir":"coverage"},"devDependencies":{},"dependencies":{},"pre-commit":["lint","test"],"publishConfig":{"@aegenet:registry":"https://registry.npmjs.org/"},"scripts":{},"_id":"@aegenet/ya-vigil-reporter@1.3.0","gitHead":"04fca150808223aff3df5ed87b62e7451b27cff7","bugs":{"url":"https://github.com/aegenet/ya-vigil-reporter/issues"},"homepage":"https://github.com/aegenet/ya-vigil-reporter#readme","_nodeVersion":"18.19.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-l1nJECv0rIMJdqTI56ms9OO0QiEcHQGCsxbqxL7KDsCRfa1NlTP5UIzN5+qHv90USvB1JA77HjZWWG5o+nHx1w==","shasum":"e781eaf9e3110d059b1abd1605f94cb6024a15d6","tarball":"https://registry.npmjs.org/@aegenet/ya-vigil-reporter/-/ya-vigil-reporter-1.3.0.tgz","fileCount":7,"unpackedSize":27202,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHXGjeNrFIw8THdkE7FIxlfYBOv2Z46EJvIZJcznAPERAiA1EMvy9Oz5kMNftuGkcoLrSmjXCKj84BvvT5G2lIBJGg=="}]},"_npmUser":{"name":"agenet","email":"npm@creadigme.net"},"directories":{},"maintainers":[{"name":"agenet","email":"npm@creadigme.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ya-vigil-reporter_1.3.0_1705573931872_0.7081860987286255"},"_hasShrinkwrap":false}},"time":{"created":"2023-07-27T15:37:09.707Z","1.0.0":"2023-07-27T15:37:09.951Z","modified":"2024-01-18T10:32:12.254Z","1.0.1":"2023-07-27T21:24:43.467Z","1.1.0":"2023-07-29T11:01:40.319Z","1.2.0":"2023-10-09T19:36:31.723Z","1.3.0":"2024-01-18T10:32:12.039Z"},"maintainers":[{"name":"agenet","email":"npm@creadigme.net"}],"description":"Yet Another Vigil Reporter","homepage":"https://github.com/aegenet/ya-vigil-reporter#readme","repository":{"type":"git","url":"git+https://github.com/aegenet/ya-vigil-reporter.git"},"author":{"name":"Alexandre Genet"},"bugs":{"url":"https://github.com/aegenet/ya-vigil-reporter/issues"},"license":"MIT","readme":"[![npm version](https://img.shields.io/npm/v/@aegenet/ya-vigil-reporter.svg)](https://www.npmjs.com/package/@aegenet/ya-vigil-reporter)\n[![Build Status](https://github.com/aegenet/ya-vigil-reporter/actions/workflows/ci.yml/badge.svg)](https://github.com/aegenet/ya-vigil-reporter/actions)\n[![codecov](https://codecov.io/gh/aegenet/ya-vigil-reporter/branch/main/graph/badge.svg?token=NRN5ODOY91)](https://codecov.io/gh/aegenet/ya-vigil-reporter)\n<br />\n\n# Yet Another Vigil Reporter\n\nAn alternative to [`node-vigil-reporter`](https://github.com/valeriansaliou/node-vigil-reporter).\n\n>  _\"Vigil is an open-source Status Page you can host on your infrastructure, used to monitor all your servers and apps, and visible to your users (on a domain of your >  choice, eg. status.example.com).\"_ https://github.com/valeriansaliou/vigil\n\n\n## ≠ Notable differences with `node-vigil-reporter`\n\n- `ya-vigil-reporter` does not start automatically. You must call the `start` method.\n- An `end` (_callback way_) method exists, but I don't recommend using it; use `stop` (_Promise way_) instead.\n- You can call the `report` method manually.\n- CPU usage is calculated differently _(compatible with Windows OS)_.\n- Use native `fetch` method.\n\n\n## 💾 Installation\n\n```shell\nyarn add @aegenet/ya-vigil-reporter@~1\n# or\nnpm i @aegenet/ya-vigil-reporter@~1\n```\n\n## 📝 Usage\n\n### Classic\n\n```typescript\nimport { YaVigilReporter } from '@aegenet/ya-vigil-reporter';\n\nconst vigilReporter = new YaVigilReporter({\n  url: \"https://status.example.com\",\n  token: \"...\",\n  probe_id: \"api\",\n  node_id: \"my-backend\", \n  replica_id: \"the-one\",\n  interval: 30,\n  // logger: console,\n});\n\nawait vigilReporter.start();\n\n/* ... */\n// stop the reporter\nawait vigilReporter.stop();\n\n// or specify the flush options to teardown the replica\nawait vigilReporter.stop({ flush: true });\n```\n\n\n### 📝 Custom fetch\n\n```typescript\nimport { YaVigilReporter } from '@aegenet/ya-vigil-reporter';\nimport { bFetch, type bFetchOptions } from '@aegenet/belt-fetch';\n\n// Async DNS & cache 1mn\nconst bFetchOpts: bFetchOptions = {\n  dnsCacheTTL: 60000,\n};\n\nconst vigilReporter = new YaVigilReporter({\n  url: \"https://status.example.com\",\n  token: \"...\",\n  probe_id: \"api\",\n  node_id: \"my-backend\", \n  replica_id: \"the-one\",\n  interval: 30,\n  // logger: console,\n  fetch(input, init) {\n    return bFetch(input, init, bFetchOpts);\n  },\n});\n\nawait vigilReporter.start();\n\n/* ... */\n// stop the reporter\nawait vigilReporter.stop();\n\n// or specify the flush options to teardown the replica\nawait vigilReporter.stop({ flush: true });\n```\n\n## 🖹 API\n\n```typescript\n/**\n * Yet Another Vigil Reporter\n */\nexport interface IYaVigilReporter {\n  /** Start the Vigil Reporter */\n  start(args?: { ensure?: boolean }): Promise<void>;\n\n  /** Stop the Vigil Reporter */\n  stop(args?: { flush?: boolean }): Promise<void>;\n\n  /** Stop the Vigil Reporter (legacy way) */\n  end(args?: { flush?: boolean; done?: (error?: Error) => void }): Promise<void>;\n\n  /** Cron is running ? */\n  get isRunning(): boolean;\n\n  /** Report the replica */\n  report(args?: { /** @default true */ reThrow?: boolean }): Promise<YaVigilReportResult>;\n\n  /** Flush the replica */\n  flush(args?: { /** @default true */ reThrow?: boolean; timeout?: number }): Promise<{\n    error?: Error;\n  }>;\n}\n```\n\n```typescript\nexport interface YaVigilReporterOptions {\n  /** `page_url` from Vigil `config.cfg` */\n  url: string;\n\n  /** `reporter_token` from Vigil `config.cfg` */\n  token: string;\n\n  /** The parent node of the reporting replica */\n  node_id: string;\n\n  /** The parent probe of the node */\n  probe_id: string;\n\n  /** The replica unique identifier (eg. the server LAN IP) */\n  replica_id: string;\n\n  /**\n   * Reporting interval in seconds\n   *\n   * @default 30\n   *\n   */\n  interval?: number;\n\n  /**\n   * Overwrite logger\n   *\n   * Set to `null` (and not `undefined`) to disabled the logger\n   *\n   * @default console\n   */\n  logger?: YaVigilReporterLogger | undefined | null;\n\n  /** (legacy) Alias of `logger` options */\n  console?: YaVigilReporterLogger | undefined | null;\n\n  /** On Tick */\n  onTick?: (data: YaVigilReportResult) => void;\n\n  /** On Report Error */\n  onReportError?: (error: unknown) => void;\n\n  /** On Fetch Error */\n  onFlushError?: (error: unknown) => void;\n\n  /** Format the fetch error message */\n  formatFetchError?: (resp: Response) => Promise<string> | string;\n\n  /**\n   * fetch function\n   *\n   * @default globalThis.fetch\n   */\n  fetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;\n}\n```\n\n## Vigil HTTP API Specifications\n\n- [Vigil Reporter HTTP API](https://github.com/valeriansaliou/vigil/blob/master/PROTOCOL.md#vigil-reporter-http-api) protocol specifications.\n- [Vigil Manager HTTP API](https://github.com/valeriansaliou/vigil/blob/master/PROTOCOL.md#vigil-manager-http-api) protocol specifications.\n\n# Coverage\n[![codecov](https://codecov.io/gh/aegenet/ya-vigil-reporter/branch/main/graph/badge.svg?token=NRN5ODOY91)](https://codecov.io/gh/aegenet/ya-vigil-reporter)\n\n![Coverage sunburst](https://codecov.io/gh/aegenet/ya-vigil-reporter/branch/main/graphs/sunburst.svg?token=NRN5ODOY91)\n\n![Coverage tree](https://codecov.io/gh/aegenet/ya-vigil-reporter/branch/main/graphs/tree.svg?token=NRN5ODOY91)\n\n\n## 📝 License\n\n[The MIT License](LICENSE) - Copyright © 2023 [Alexandre Genet](https://github.com/aegenet).","readmeFilename":"README.md"}