apitally 0.19.0 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/README.md +98 -43
  2. package/dist/adonisjs/middleware.cjs +3 -0
  3. package/dist/adonisjs/middleware.cjs.map +1 -1
  4. package/dist/adonisjs/middleware.js +3 -0
  5. package/dist/adonisjs/middleware.js.map +1 -1
  6. package/dist/adonisjs/provider.cjs +55 -25
  7. package/dist/adonisjs/provider.cjs.map +1 -1
  8. package/dist/adonisjs/provider.js +55 -25
  9. package/dist/adonisjs/provider.js.map +1 -1
  10. package/dist/common/client.cjs +4 -3
  11. package/dist/common/client.cjs.map +1 -1
  12. package/dist/common/client.js +4 -3
  13. package/dist/common/client.js.map +1 -1
  14. package/dist/common/requestLogger.cjs +5 -1
  15. package/dist/common/requestLogger.cjs.map +1 -1
  16. package/dist/common/requestLogger.d.cts +1 -1
  17. package/dist/common/requestLogger.d.ts +1 -1
  18. package/dist/common/requestLogger.js +5 -1
  19. package/dist/common/requestLogger.js.map +1 -1
  20. package/dist/common/response.cjs +12 -6
  21. package/dist/common/response.cjs.map +1 -1
  22. package/dist/common/response.d.cts +3 -3
  23. package/dist/common/response.d.ts +3 -3
  24. package/dist/common/response.js +12 -6
  25. package/dist/common/response.js.map +1 -1
  26. package/dist/common/validationErrorCounter.cjs +2 -2
  27. package/dist/common/validationErrorCounter.cjs.map +1 -1
  28. package/dist/common/validationErrorCounter.js +2 -2
  29. package/dist/common/validationErrorCounter.js.map +1 -1
  30. package/dist/elysia/index.cjs +1586 -0
  31. package/dist/elysia/index.cjs.map +1 -0
  32. package/dist/elysia/index.d.cts +9 -0
  33. package/dist/elysia/index.d.ts +9 -0
  34. package/dist/elysia/index.js +1556 -0
  35. package/dist/elysia/index.js.map +1 -0
  36. package/dist/elysia/plugin.cjs +1580 -0
  37. package/dist/elysia/plugin.cjs.map +1 -0
  38. package/dist/elysia/plugin.d.cts +53 -0
  39. package/dist/elysia/plugin.d.ts +53 -0
  40. package/dist/elysia/plugin.js +1556 -0
  41. package/dist/elysia/plugin.js.map +1 -0
  42. package/dist/elysia/utils.cjs +98 -0
  43. package/dist/elysia/utils.cjs.map +1 -0
  44. package/dist/elysia/utils.d.cts +12 -0
  45. package/dist/elysia/utils.d.ts +12 -0
  46. package/dist/elysia/utils.js +78 -0
  47. package/dist/elysia/utils.js.map +1 -0
  48. package/dist/express/index.cjs +58 -25
  49. package/dist/express/index.cjs.map +1 -1
  50. package/dist/express/index.js +58 -25
  51. package/dist/express/index.js.map +1 -1
  52. package/dist/express/middleware.cjs +58 -25
  53. package/dist/express/middleware.cjs.map +1 -1
  54. package/dist/express/middleware.js +58 -25
  55. package/dist/express/middleware.js.map +1 -1
  56. package/dist/fastify/index.cjs +58 -25
  57. package/dist/fastify/index.cjs.map +1 -1
  58. package/dist/fastify/index.js +58 -25
  59. package/dist/fastify/index.js.map +1 -1
  60. package/dist/fastify/plugin.cjs +58 -25
  61. package/dist/fastify/plugin.cjs.map +1 -1
  62. package/dist/fastify/plugin.js +58 -25
  63. package/dist/fastify/plugin.js.map +1 -1
  64. package/dist/h3/index.cjs +24 -11
  65. package/dist/h3/index.cjs.map +1 -1
  66. package/dist/h3/index.js +24 -11
  67. package/dist/h3/index.js.map +1 -1
  68. package/dist/h3/plugin.cjs +24 -11
  69. package/dist/h3/plugin.cjs.map +1 -1
  70. package/dist/h3/plugin.js +24 -11
  71. package/dist/h3/plugin.js.map +1 -1
  72. package/dist/hapi/index.cjs +6134 -0
  73. package/dist/hapi/index.cjs.map +1 -0
  74. package/dist/hapi/index.d.cts +9 -0
  75. package/dist/hapi/index.d.ts +9 -0
  76. package/dist/hapi/index.js +6124 -0
  77. package/dist/hapi/index.js.map +1 -0
  78. package/dist/hapi/plugin.cjs +6131 -0
  79. package/dist/hapi/plugin.cjs.map +1 -0
  80. package/dist/hapi/plugin.d.cts +36 -0
  81. package/dist/hapi/plugin.d.ts +36 -0
  82. package/dist/hapi/plugin.js +6124 -0
  83. package/dist/hapi/plugin.js.map +1 -0
  84. package/dist/hapi/utils.cjs +98 -0
  85. package/dist/hapi/utils.cjs.map +1 -0
  86. package/dist/hapi/utils.d.cts +14 -0
  87. package/dist/hapi/utils.d.ts +14 -0
  88. package/dist/hapi/utils.js +77 -0
  89. package/dist/hapi/utils.js.map +1 -0
  90. package/dist/hono/index.cjs +25 -12
  91. package/dist/hono/index.cjs.map +1 -1
  92. package/dist/hono/index.js +25 -12
  93. package/dist/hono/index.js.map +1 -1
  94. package/dist/hono/middleware.cjs +25 -12
  95. package/dist/hono/middleware.cjs.map +1 -1
  96. package/dist/hono/middleware.js +25 -12
  97. package/dist/hono/middleware.js.map +1 -1
  98. package/dist/koa/index.cjs +13 -6
  99. package/dist/koa/index.cjs.map +1 -1
  100. package/dist/koa/index.js +13 -6
  101. package/dist/koa/index.js.map +1 -1
  102. package/dist/koa/middleware.cjs +13 -6
  103. package/dist/koa/middleware.cjs.map +1 -1
  104. package/dist/koa/middleware.js +13 -6
  105. package/dist/koa/middleware.js.map +1 -1
  106. package/dist/loggers/hapi.cjs +54 -0
  107. package/dist/loggers/hapi.cjs.map +1 -0
  108. package/dist/loggers/hapi.d.cts +10 -0
  109. package/dist/loggers/hapi.d.ts +10 -0
  110. package/dist/loggers/hapi.js +31 -0
  111. package/dist/loggers/hapi.js.map +1 -0
  112. package/dist/loggers/index.cjs +81 -28
  113. package/dist/loggers/index.cjs.map +1 -1
  114. package/dist/loggers/index.d.cts +2 -0
  115. package/dist/loggers/index.d.ts +2 -0
  116. package/dist/loggers/index.js +80 -28
  117. package/dist/loggers/index.js.map +1 -1
  118. package/dist/loggers/pino.cjs +39 -13
  119. package/dist/loggers/pino.cjs.map +1 -1
  120. package/dist/loggers/pino.d.cts +1 -1
  121. package/dist/loggers/pino.d.ts +1 -1
  122. package/dist/loggers/pino.js +39 -13
  123. package/dist/loggers/pino.js.map +1 -1
  124. package/dist/nestjs/index.cjs +158 -118
  125. package/dist/nestjs/index.cjs.map +1 -1
  126. package/dist/nestjs/index.js +156 -117
  127. package/dist/nestjs/index.js.map +1 -1
  128. package/package.json +42 -2
package/dist/h3/plugin.js CHANGED
@@ -384,7 +384,8 @@ var ALLOWED_CONTENT_TYPES = [
384
384
  "application/json",
385
385
  "application/problem+json",
386
386
  "application/vnd.api+json",
387
- "text/plain"
387
+ "text/plain",
388
+ "text/html"
388
389
  ];
389
390
  var EXCLUDE_PATH_PATTERNS = [
390
391
  /\/_?healthz?$/i,
@@ -714,6 +715,9 @@ var _RequestLogger = class _RequestLogger {
714
715
  __name(_RequestLogger, "RequestLogger");
715
716
  var RequestLogger = _RequestLogger;
716
717
  function convertHeaders(headers) {
718
+ if (!headers) {
719
+ return [];
720
+ }
717
721
  if (headers instanceof Headers) {
718
722
  return Array.from(headers.entries());
719
723
  }
@@ -797,7 +801,7 @@ var _ValidationErrorCounter = class _ValidationErrorCounter {
797
801
  consumer: validationError.consumer || null,
798
802
  method: validationError.method,
799
803
  path: validationError.path,
800
- loc: validationError.loc.split("."),
804
+ loc: validationError.loc.split(".").filter(Boolean),
801
805
  msg: validationError.msg,
802
806
  type: validationError.type,
803
807
  error_count: count
@@ -813,7 +817,7 @@ var _ValidationErrorCounter = class _ValidationErrorCounter {
813
817
  validationError.consumer || "",
814
818
  validationError.method.toUpperCase(),
815
819
  validationError.path,
816
- validationError.loc,
820
+ validationError.loc.split(".").filter(Boolean),
817
821
  validationError.msg.trim(),
818
822
  validationError.type
819
823
  ].join("|");
@@ -1125,8 +1129,11 @@ function mergeHeaders(base, merge) {
1125
1129
  __name(mergeHeaders, "mergeHeaders");
1126
1130
 
1127
1131
  // src/common/response.ts
1128
- async function measureResponseSize(response) {
1129
- const [newResponse1, newResponse2] = await teeResponse(response);
1132
+ async function measureResponseSize(response, tee = true) {
1133
+ const [newResponse1, newResponse2] = tee ? teeResponse(response) : [
1134
+ response,
1135
+ response
1136
+ ];
1130
1137
  let size = 0;
1131
1138
  if (newResponse2.body) {
1132
1139
  let done = false;
@@ -1145,8 +1152,11 @@ async function measureResponseSize(response) {
1145
1152
  ];
1146
1153
  }
1147
1154
  __name(measureResponseSize, "measureResponseSize");
1148
- async function getResponseBody(response) {
1149
- const [newResponse1, newResponse2] = await teeResponse(response);
1155
+ async function getResponseBody(response, tee = true) {
1156
+ const [newResponse1, newResponse2] = tee ? teeResponse(response) : [
1157
+ response,
1158
+ response
1159
+ ];
1150
1160
  const responseBuffer = Buffer.from(await newResponse2.arrayBuffer());
1151
1161
  return [
1152
1162
  responseBuffer,
@@ -1154,7 +1164,7 @@ async function getResponseBody(response) {
1154
1164
  ];
1155
1165
  }
1156
1166
  __name(getResponseBody, "getResponseBody");
1157
- async function teeResponse(response) {
1167
+ function teeResponse(response) {
1158
1168
  if (!response.body) {
1159
1169
  return [
1160
1170
  response,
@@ -1219,8 +1229,11 @@ function captureLog(level, args) {
1219
1229
  }
1220
1230
  __name(captureLog, "captureLog");
1221
1231
 
1222
- // src/loggers/utils.ts
1232
+ // src/loggers/hapi.ts
1223
1233
  import { format as format3 } from "util";
1234
+
1235
+ // src/loggers/utils.ts
1236
+ import { format as format4 } from "util";
1224
1237
  function formatMessage(message, ...args) {
1225
1238
  return [
1226
1239
  message,
@@ -1237,7 +1250,7 @@ function formatArg(arg) {
1237
1250
  return arg.trim();
1238
1251
  }
1239
1252
  if (arg instanceof Error) {
1240
- return format3(arg).trim();
1253
+ return format4(arg).trim();
1241
1254
  }
1242
1255
  if (arg === void 0 || arg === null || isEmptyObject(arg)) {
1243
1256
  return "";
@@ -1245,7 +1258,7 @@ function formatArg(arg) {
1245
1258
  try {
1246
1259
  return JSON.stringify(arg);
1247
1260
  } catch {
1248
- return format3(arg).trim();
1261
+ return format4(arg).trim();
1249
1262
  }
1250
1263
  }
1251
1264
  __name(formatArg, "formatArg");