UNPKG

apitally

Version:

Simple API monitoring & analytics for REST APIs built with Express, Fastify, NestJS, AdonisJS, Hono, H3, Elysia, Hapi, and Koa.

53 lines 1.27 kB
var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); import { getPackageVersion } from "../common/packageVersions.js"; function getAppInfo(server, appVersion) { const versions = []; if (process.versions.node) { versions.push([ "nodejs", process.versions.node ]); } const hapiVersion = getPackageVersion("@hapi/hapi"); const apitallyVersion = getPackageVersion("../.."); if (hapiVersion) { versions.push([ "hapi", hapiVersion ]); } if (apitallyVersion) { versions.push([ "apitally", apitallyVersion ]); } if (appVersion) { versions.push([ "app", appVersion ]); } return { paths: server.table().map((route) => ({ method: route.method.toUpperCase(), path: route.path })).filter((route) => route.method && route.path && ![ "HEAD", "OPTIONS" ].includes(route.method)), versions: Object.fromEntries(versions), client: "js:hapi" }; } __name(getAppInfo, "getAppInfo"); function isBoom(response) { return "isBoom" in response && response.isBoom === true; } __name(isBoom, "isBoom"); export { getAppInfo, isBoom }; //# sourceMappingURL=utils.js.map