UNPKG

apitally

Version:

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

77 lines 2.33 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var utils_exports = {}; __export(utils_exports, { getAppInfo: () => getAppInfo, isBoom: () => isBoom }); module.exports = __toCommonJS(utils_exports); var import_packageVersions = require("../common/packageVersions.js"); function getAppInfo(server, appVersion) { const versions = []; if (process.versions.node) { versions.push([ "nodejs", process.versions.node ]); } const hapiVersion = (0, import_packageVersions.getPackageVersion)("@hapi/hapi"); const apitallyVersion = (0, import_packageVersions.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"); // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { getAppInfo, isBoom }); //# sourceMappingURL=utils.cjs.map