@crvouga/mockingbird-service-posthog 1.0.0 → 1.0.1

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.
package/CHANGELOG.md CHANGED
@@ -1,15 +1,18 @@
1
1
  # Changelog — @crvouga/mockingbird-service-posthog
2
2
 
3
+ ## 1.0.1 (2026-09-26)
4
+
5
+ ### Fixes and improvements
6
+
7
+ - take the rejected-request byte count from content-length, never by reading the body ([a0e5fb2](https://github.com/crvouga/mockingbird/commit/a0e5fb2fc80ab725c3552b612f3f091fd6c857fb))
8
+ - reject a present body by media type, and log what a rejected request sent ([12e351a](https://github.com/crvouga/mockingbird/commit/12e351aba53cfb7b41e31a7809419455fc2902eb))
9
+
3
10
  ## 1.0.0 (2026-09-24)
4
11
 
5
12
  ### ⚠️ Breaking changes
6
13
 
7
14
  - vendor branding for every service; purge internal mocks and consumer names ([f689534](https://github.com/crvouga/mockingbird/commit/f6895343543550dafcb7d76b426cae7635e03226))
8
15
 
9
- ### Dependencies
10
-
11
- - `@crvouga/mockingbird-service-sqlite`
12
-
13
16
  ## 0.2.0 (2026-09-23)
14
17
 
15
18
  ### Features
@@ -1183,6 +1183,16 @@ var operationMetadata = (operation) => {
1183
1183
 
1184
1184
  // ../core/dist/service.js
1185
1185
  import { Hono } from "hono";
1186
+
1187
+ // ../core/dist/validation.js
1188
+ var recorded = /* @__PURE__ */ new WeakMap();
1189
+ var recordedIssues = (request) => recorded.get(request);
1190
+
1191
+ // ../core/dist/service.js
1192
+ var withIssues = (request, response) => {
1193
+ const issues = response.status >= 400 ? recordedIssues(request) : void 0;
1194
+ return issues && issues.length > 0 ? annotateResponse(response, { issues }) : response;
1195
+ };
1186
1196
  var defineOperations = (handlers) => handlers;
1187
1197
  var OperationRegistryError = class extends Error {
1188
1198
  problems;
@@ -1268,9 +1278,7 @@ var createService = (options) => {
1268
1278
  now
1269
1279
  };
1270
1280
  const short = await options.before?.(context);
1271
- if (short)
1272
- return short;
1273
- return handler(context);
1281
+ return withIssues(request, short ?? await handler(context));
1274
1282
  };
1275
1283
  app.on(operation.method.toUpperCase(), honoPath(operation.path), route);
1276
1284
  }
@@ -1307,7 +1315,7 @@ var restoreNamespace = (sqlite, namespace, snapshot) => {
1307
1315
  };
1308
1316
 
1309
1317
  // ../core/dist/version.js
1310
- var PACKAGE_VERSION = true ? "1.0.0" : UNRELEASED_VERSION;
1318
+ var PACKAGE_VERSION = true ? "1.0.1" : UNRELEASED_VERSION;
1311
1319
 
1312
1320
  // ../core/dist/signing.js
1313
1321
  var encoder = new TextEncoder();
@@ -1750,8 +1758,15 @@ var createRuntime = (options) => {
1750
1758
  const started = monotonicNow();
1751
1759
  const url = new URL(request.url);
1752
1760
  const operationId = operationIdFor(request, url.pathname);
1761
+ const contentLength = request.headers.get("content-length");
1762
+ const received = {
1763
+ contentType: request.headers.get("content-type"),
1764
+ bodyBytes: contentLength !== null && /^\d+$/.test(contentLength) ? Number(contentLength) : null,
1765
+ transferEncoding: request.headers.get("transfer-encoding")
1766
+ };
1753
1767
  const log = (status, faultId, response2) => {
1754
1768
  const noted = response2 ? responseNotes(response2) : void 0;
1769
+ const rejected = status >= 400 && faultId === void 0;
1755
1770
  const entry = {
1756
1771
  service: options.name,
1757
1772
  namespace,
@@ -1763,7 +1778,9 @@ var createRuntime = (options) => {
1763
1778
  unmatched: options.document !== void 0 && operationId === void 0,
1764
1779
  ...faultId !== void 0 ? { faultId } : {},
1765
1780
  ...noted?.ids && Object.keys(noted.ids).length > 0 ? { ids: noted.ids } : {},
1766
- ...noted?.adopted ? { adopted: true } : {}
1781
+ ...noted?.adopted ? { adopted: true } : {},
1782
+ ...rejected ? { request: { ...received } } : {},
1783
+ ...rejected && noted?.issues && noted.issues.length > 0 ? { issues: noted.issues.map((issue) => ({ ...issue })) } : {}
1767
1784
  };
1768
1785
  metrics.record(entry);
1769
1786
  journal.record({ ...entry, at: new Date(clock.now()).toISOString() });
@@ -2942,4 +2959,4 @@ export {
2942
2959
  scrubProperties,
2943
2960
  PostHogAPI
2944
2961
  };
2945
- //# sourceMappingURL=chunk-OBJA3E7X.js.map
2962
+ //# sourceMappingURL=chunk-DME2EREJ.js.map