@crvouga/mockingbird-service-aha 0.2.0 → 1.0.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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,16 @@
1
1
  # Changelog — @crvouga/mockingbird-service-aha
2
2
 
3
- ## 0.2.0 (2026-09-24)
3
+ ## 1.0.0 (2026-09-24)
4
+
5
+ ### ⚠️ Breaking changes
6
+
7
+ - vendor branding for every service; purge internal mocks and consumer names ([f689534](https://github.com/crvouga/mockingbird/commit/f6895343543550dafcb7d76b426cae7635e03226))
8
+
9
+ ### Dependencies
10
+
11
+ - `@crvouga/mockingbird-service-sqlite`
12
+
13
+ ## 0.2.0 (2026-09-23)
4
14
 
5
15
  ### Features
6
16
 
package/README.md CHANGED
@@ -28,7 +28,7 @@ Point the app at the mock:
28
28
  | --- | --- |
29
29
  | `AHA_API_URL` | `http://127.0.0.1:8799` (the lab-provider path already allows loopback; `AhaService` needs an http exception, see G-A1 / S10.2) |
30
30
  | `AHA_API_KEY` / `AHA_API_SECRET` | anything, or the pair passed as `--api-key` / `--api-secret` to verify signatures exactly |
31
- | `AHA_USE_LEGACY_AUTH` | `true` switches to `X-Geviti-Auth-Key`; both modes are accepted |
31
+ | `AHA_USE_LEGACY_AUTH` | `true` switches to `X-<Partner>-Auth-Key` (e.g. `X-Acme-Auth-Key`); both modes are accepted |
32
32
  | `AHA_WEBHOOK_SECRET` | the same value as `--webhook-secret` |
33
33
 
34
34
  ```bash
@@ -54,31 +54,34 @@ const admin = (path: string, body: unknown) =>
54
54
  }),
55
55
  )
56
56
 
57
- // …the app's checkout calls POST /v1/geviti/create-order for GV-101…
57
+ // …the app's checkout calls POST /v1/acme/create-order for AC-101…
58
58
 
59
59
  // AHA books the draw: our handler books the EMR appointment for 10:30 Denver time.
60
- await admin("/orders/GV-101/transition", {
60
+ await admin("/orders/AC-101/transition", {
61
61
  status: "Scheduled",
62
62
  scheduledAt: "2026-10-01T16:30:00Z",
63
63
  timeZone: "America/Denver",
64
64
  })
65
65
  // The phlebotomist checks out with a sample: our handler sets vitalBloodDrawn.
66
- await admin("/orders/GV-101/transition", { status: "Check Out", drawStatus: "Sample Collected" })
66
+ await admin("/orders/AC-101/transition", { status: "Check Out", drawStatus: "Sample Collected" })
67
67
  ```
68
68
 
69
69
  ### Routes
70
70
 
71
+ The `{partner}` path segment is your account's slug (e.g. `acme`); the mock accepts any.
72
+
71
73
  | Route | Behaviour |
72
74
  | --- | --- |
73
- | `POST /v1/geviti/create-order` | Validates the body (`partner_order_id`, patient fields, `biological_sex`, `service_type`, `npi`, `ordering_physician`, `test_codes`, optional `preferred_schedule_date/time`, `patient_timezone`). Create **or update**: a repeated `partner_order_id` keeps its `order_number`. Answers `{content: {partner_order_id, order_number}, message, status: "SUCCESS"}`. |
74
- | `POST /v1/geviti/cancel` | `{partner_order_id, notes: [{note_type: "CANCELLATION", notes}]}` → `{message, status}`. Emits a `Cancelled` webhook (turn off with `cancelWebhook: false`). Unknown id → 404; an order whose sample was collected → 200 with `status: "ERROR"`. The AHA `order_number` is accepted in `partner_order_id` too, because our lab-provider client sends it there (G-A1). |
75
+ | `POST /v1/{partner}/create-order` | Validates the body (`partner_order_id`, patient fields, `biological_sex`, `service_type`, `npi`, `ordering_physician`, `test_codes`, optional `preferred_schedule_date/time`, `patient_timezone`). Create **or update**: a repeated `partner_order_id` keeps its `order_number`. Answers `{content: {partner_order_id, order_number}, message, status: "SUCCESS"}`. |
76
+ | `POST /v1/{partner}/cancel` | `{partner_order_id, notes: [{note_type: "CANCELLATION", notes}]}` → `{message, status}`. Emits a `Cancelled` webhook (turn off with `cancelWebhook: false`). Unknown id → 404; an order whose sample was collected → 200 with `status: "ERROR"`. The AHA `order_number` is accepted in `partner_order_id` too, because our lab-provider client sends it there (G-A1). |
75
77
 
76
78
  **Auth.** HMAC mode: `X-API-KEY`, `X-TIMESTAMP` (epoch ms, within ±5 min of wall-clock time),
77
79
  `X-SIGNATURE` = base64 HMAC-SHA256(secret, `"<apiKey>:<path>:<timestamp>"`), where `path` is the
78
80
  request path without host, body or `/ns/<name>` prefix. With a known key + secret
79
81
  (`--api-key/--api-secret` or `credentials` in settings) the signature is verified exactly;
80
82
  with none configured any key is accepted and the signature is checked for shape only. Legacy
81
- mode: `X-Geviti-Auth-Key` (+ `X-API-Version: 1.0`). Failures are 401 `{status: "ERROR", message}`.
83
+ mode: `X-<Partner>-Auth-Key` (+ `X-API-Version: 1.0`), e.g. `X-Acme-Auth-Key`; any partner name is
84
+ accepted. Failures are 401 `{status: "ERROR", message}`.
82
85
 
83
86
  **Envelope (G-A1).** `AhaService` expects the raw `{content, message, status}`;
84
87
  `AhaLabProvider` expects `{success: true, data: {…}}`. Raw is the default; choose with
@@ -1543,7 +1543,7 @@ var restoreNamespace = (sqlite, namespace, snapshot) => {
1543
1543
  };
1544
1544
 
1545
1545
  // ../core/dist/version.js
1546
- var PACKAGE_VERSION = true ? "0.2.0" : UNRELEASED_VERSION;
1546
+ var PACKAGE_VERSION = true ? "1.0.0" : UNRELEASED_VERSION;
1547
1547
 
1548
1548
  // ../core/dist/signing.js
1549
1549
  var encoder = new TextEncoder();
@@ -2561,7 +2561,7 @@ var issuesByField = (issues) => {
2561
2561
  };
2562
2562
 
2563
2563
  // src/generated/openapi.ts
2564
- var document = JSON.parse(`{"openapi":"3.1.0","info":{"title":"AHA (Advanced Health Academy) partner API (Mockingbird subset)","description":"Stateful mock of the AHA at-home phlebotomy partner API: create-or-update order and cancel.\\nThe vendor has no pull API; order state reaches the partner only as inbound webhooks, which\\nthe mock emits from admin transitions (see the README). Hand-authored from the consumer's\\nwire shapes (the vendor publishes no spec).\\n","version":"1","x-mockingbird-upstream":{"note":"Hand-authored from aha.service.ts, aha.types.ts (zod request/response schemas) and aha.lab-provider.ts. Success responses come in one of two envelopes (raw, or {success, data}) because our two clients disagree (G-A1); the mock serves either."}},"servers":[{"url":"https://stage-api.mobileaha.com"}],"security":[{"hmacKey":[],"hmacTimestamp":[],"hmacSignature":[]},{"legacyKey":[]}],"paths":{"/v1/geviti/create-order":{"post":{"operationId":"CreateOrder","description":"Create an order, or update it when partner_order_id already exists (the same order_number is returned). Honors X-Idempotency-Key.","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrderBody"}}}},"responses":{"200":{"description":"Order created or updated (raw or wrapped envelope, per namespace setting)","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/CreateOrderResponse"},{"$ref":"#/components/schemas/WrappedCreateOrderResponse"}]}}}},"400":{"description":"Invalid request body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing or invalid authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"Idempotency key reused with a different request, or still in flight","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/geviti/cancel":{"post":{"operationId":"CancelOrder","description":"Cancel an order by partner_order_id. The mock also accepts the AHA order_number here, because our lab-provider client sends it in that field (G-A1).","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelOrderBody"}}}},"responses":{"200":{"description":"Cancel outcome (raw or wrapped envelope; status ERROR when not cancellable)","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/CancelOrderResponse"},{"$ref":"#/components/schemas/WrappedCancelOrderResponse"}]}}}},"400":{"description":"Invalid request body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing or invalid authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"Unknown partner order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"Idempotency key reused with a different request, or still in flight","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}}},"components":{"securitySchemes":{"hmacKey":{"type":"apiKey","in":"header","name":"X-API-KEY"},"hmacTimestamp":{"type":"apiKey","in":"header","name":"X-TIMESTAMP","description":"Unix epoch milliseconds."},"hmacSignature":{"type":"apiKey","in":"header","name":"X-SIGNATURE","description":"base64(HMAC-SHA256(apiSecret, \\"<apiKey>:<path>:<timestamp>\\"))."},"legacyKey":{"type":"apiKey","in":"header","name":"X-Geviti-Auth-Key","description":"Legacy mode (AHA_USE_LEGACY_AUTH=true), sent with X-API-Version 1.0."}},"parameters":{"IdempotencyKey":{"name":"X-Idempotency-Key","in":"header","required":false,"description":"Sent by the lab-provider client; the same key and body replays the stored response.","schema":{"type":"string","pattern":"^[A-Za-z0-9:_.-]{1,128}$"}}},"schemas":{"TestCode":{"type":"object","required":["test_code","test_description"],"properties":{"test_code":{"type":"string","minLength":1,"maxLength":64},"test_description":{"type":"string","maxLength":200}}},"CreateOrderBody":{"type":"object","required":["partner_order_id","patient_first_name","patient_id","patient_last_name","biological_sex","patient_dob","patient_phone_number","patient_address_line1","patient_city","patient_state","patient_zipcode","service_type","npi","ordering_physician","test_codes"],"properties":{"partner_order_id":{"type":"string","minLength":1,"maxLength":64},"patient_first_name":{"type":"string","minLength":1,"maxLength":60},"patient_id":{"type":"string","minLength":1,"maxLength":64},"patient_middle_initial":{"type":"string","maxLength":5},"patient_last_name":{"type":"string","minLength":1,"maxLength":60},"biological_sex":{"type":"string","enum":["Male","Female","Non-binary"]},"patient_dob":{"type":"string","description":"YYYY-MM-DD","maxLength":10},"patient_phone_number":{"type":"string","description":"10 digits from AhaService; the lab-provider client may send +1XXXXXXXXXX.","maxLength":20},"patient_email_address":{"type":"string","maxLength":120},"patient_address_line1":{"type":"string","minLength":1,"maxLength":120},"patient_address_line2":{"type":"string","maxLength":120},"patient_city":{"type":"string","minLength":1,"maxLength":60},"patient_state":{"type":"string","minLength":1,"maxLength":20},"patient_zipcode":{"type":"string","minLength":1,"maxLength":10},"service_type":{"type":"string","enum":["Full Service","Draw Only","Pickup Only"]},"preferred_schedule_date":{"type":"string","description":"YYYY-MM-DD","maxLength":10},"preferred_schedule_time":{"type":"string","description":"HH:MM","maxLength":8},"patient_timezone":{"type":"string","description":"IANA zone, e.g. America/New_York","maxLength":64},"npi":{"type":"string","minLength":1,"maxLength":20},"ordering_physician":{"type":"string","minLength":1,"maxLength":120},"test_codes":{"type":"array","maxItems":20,"items":{"$ref":"#/components/schemas/TestCode"}}}},"CancelOrderBody":{"type":"object","required":["partner_order_id","notes"],"properties":{"partner_order_id":{"type":"string","minLength":1,"maxLength":64,"x-mockingbird-resource-ref":{"type":"order","missing":"GV-999999999"}},"notes":{"type":"array","maxItems":5,"items":{"type":"object","required":["note_type","notes"],"properties":{"note_type":{"type":"string","enum":["CANCELLATION"]},"notes":{"type":"string","maxLength":500}}}}}},"CreateOrderResponse":{"type":"object","required":["content","message","status"],"properties":{"content":{"type":"object","required":["partner_order_id","order_number"],"properties":{"partner_order_id":{"type":"string","x-mockingbird-resource":{"type":"order","identity":true}},"order_number":{"type":"string","x-mockingbird-volatile":{"kind":"id"}}}},"message":{"type":"string"},"status":{"type":"string","enum":["SUCCESS","ERROR"]}}},"WrappedCreateOrderResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/CreateOrderResponse"}}},"CancelOrderResponse":{"type":"object","required":["message","status"],"properties":{"message":{"type":"string"},"status":{"type":"string","enum":["SUCCESS","ERROR"]}}},"WrappedCancelOrderResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/CancelOrderResponse"}}},"ErrorBody":{"type":"object","required":["status","message"],"properties":{"status":{"type":"string","enum":["ERROR"]},"message":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}}}}}}`);
2564
+ var document = JSON.parse(`{"openapi":"3.1.0","info":{"title":"AHA (Advanced Health Academy) partner API (Mockingbird subset)","description":"Stateful mock of the AHA at-home phlebotomy partner API: create-or-update order and cancel.\\nThe vendor has no pull API; order state reaches the partner only as inbound webhooks, which\\nthe mock emits from admin transitions (see the README). Hand-authored from the consumer's\\nwire shapes (the vendor publishes no spec).\\n","version":"1","x-mockingbird-upstream":{"note":"Hand-authored from aha.service.ts, aha.types.ts (zod request/response schemas) and aha.lab-provider.ts. Success responses come in one of two envelopes (raw, or {success, data}) because our two clients disagree (G-A1); the mock serves either."}},"servers":[{"url":"https://stage-api.mobileaha.com"}],"security":[{"hmacKey":[],"hmacTimestamp":[],"hmacSignature":[]},{"legacyKey":[]}],"paths":{"/v1/{partner}/create-order":{"post":{"operationId":"CreateOrder","description":"Create an order, or update it when partner_order_id already exists (the same order_number is returned). Honors X-Idempotency-Key.","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"parameters":[{"$ref":"#/components/parameters/Partner"},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrderBody"}}}},"responses":{"200":{"description":"Order created or updated (raw or wrapped envelope, per namespace setting)","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/CreateOrderResponse"},{"$ref":"#/components/schemas/WrappedCreateOrderResponse"}]}}}},"400":{"description":"Invalid request body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing or invalid authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"Idempotency key reused with a different request, or still in flight","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/v1/{partner}/cancel":{"post":{"operationId":"CancelOrder","description":"Cancel an order by partner_order_id. The mock also accepts the AHA order_number here, because our lab-provider client sends it in that field (G-A1).","x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"parameters":[{"$ref":"#/components/parameters/Partner"},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelOrderBody"}}}},"responses":{"200":{"description":"Cancel outcome (raw or wrapped envelope; status ERROR when not cancellable)","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/CancelOrderResponse"},{"$ref":"#/components/schemas/WrappedCancelOrderResponse"}]}}}},"400":{"description":"Invalid request body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Missing or invalid authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"404":{"description":"Unknown partner order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"409":{"description":"Idempotency key reused with a different request, or still in flight","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}}},"components":{"securitySchemes":{"hmacKey":{"type":"apiKey","in":"header","name":"X-API-KEY"},"hmacTimestamp":{"type":"apiKey","in":"header","name":"X-TIMESTAMP","description":"Unix epoch milliseconds."},"hmacSignature":{"type":"apiKey","in":"header","name":"X-SIGNATURE","description":"base64(HMAC-SHA256(apiSecret, \\"<apiKey>:<path>:<timestamp>\\"))."},"legacyKey":{"type":"apiKey","in":"header","name":"X-Acme-Auth-Key","description":"Legacy mode (AHA_USE_LEGACY_AUTH=true), sent with X-API-Version 1.0. The real header embeds the partner's name (\`X-<Partner>-Auth-Key\`); the mock accepts any partner name."}},"parameters":{"Partner":{"name":"partner","in":"path","required":true,"description":"The partner segment AHA assigns your account (its slug), e.g. \`acme\`.","schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,64}$","examples":["acme"]}},"IdempotencyKey":{"name":"X-Idempotency-Key","in":"header","required":false,"description":"Sent by the lab-provider client; the same key and body replays the stored response.","schema":{"type":"string","pattern":"^[A-Za-z0-9:_.-]{1,128}$"}}},"schemas":{"TestCode":{"type":"object","required":["test_code","test_description"],"properties":{"test_code":{"type":"string","minLength":1,"maxLength":64},"test_description":{"type":"string","maxLength":200}}},"CreateOrderBody":{"type":"object","required":["partner_order_id","patient_first_name","patient_id","patient_last_name","biological_sex","patient_dob","patient_phone_number","patient_address_line1","patient_city","patient_state","patient_zipcode","service_type","npi","ordering_physician","test_codes"],"properties":{"partner_order_id":{"type":"string","minLength":1,"maxLength":64},"patient_first_name":{"type":"string","minLength":1,"maxLength":60},"patient_id":{"type":"string","minLength":1,"maxLength":64},"patient_middle_initial":{"type":"string","maxLength":5},"patient_last_name":{"type":"string","minLength":1,"maxLength":60},"biological_sex":{"type":"string","enum":["Male","Female","Non-binary"]},"patient_dob":{"type":"string","description":"YYYY-MM-DD","maxLength":10},"patient_phone_number":{"type":"string","description":"10 digits from AhaService; the lab-provider client may send +1XXXXXXXXXX.","maxLength":20},"patient_email_address":{"type":"string","maxLength":120},"patient_address_line1":{"type":"string","minLength":1,"maxLength":120},"patient_address_line2":{"type":"string","maxLength":120},"patient_city":{"type":"string","minLength":1,"maxLength":60},"patient_state":{"type":"string","minLength":1,"maxLength":20},"patient_zipcode":{"type":"string","minLength":1,"maxLength":10},"service_type":{"type":"string","enum":["Full Service","Draw Only","Pickup Only"]},"preferred_schedule_date":{"type":"string","description":"YYYY-MM-DD","maxLength":10},"preferred_schedule_time":{"type":"string","description":"HH:MM","maxLength":8},"patient_timezone":{"type":"string","description":"IANA zone, e.g. America/New_York","maxLength":64},"npi":{"type":"string","minLength":1,"maxLength":20},"ordering_physician":{"type":"string","minLength":1,"maxLength":120},"test_codes":{"type":"array","maxItems":20,"items":{"$ref":"#/components/schemas/TestCode"}}}},"CancelOrderBody":{"type":"object","required":["partner_order_id","notes"],"properties":{"partner_order_id":{"type":"string","minLength":1,"maxLength":64,"x-mockingbird-resource-ref":{"type":"order","missing":"AC-999999999"}},"notes":{"type":"array","maxItems":5,"items":{"type":"object","required":["note_type","notes"],"properties":{"note_type":{"type":"string","enum":["CANCELLATION"]},"notes":{"type":"string","maxLength":500}}}}}},"CreateOrderResponse":{"type":"object","required":["content","message","status"],"properties":{"content":{"type":"object","required":["partner_order_id","order_number"],"properties":{"partner_order_id":{"type":"string","x-mockingbird-resource":{"type":"order","identity":true}},"order_number":{"type":"string","x-mockingbird-volatile":{"kind":"id"}}}},"message":{"type":"string"},"status":{"type":"string","enum":["SUCCESS","ERROR"]}}},"WrappedCreateOrderResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/CreateOrderResponse"}}},"CancelOrderResponse":{"type":"object","required":["message","status"],"properties":{"message":{"type":"string"},"status":{"type":"string","enum":["SUCCESS","ERROR"]}}},"WrappedCancelOrderResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/CancelOrderResponse"}}},"ErrorBody":{"type":"object","required":["status","message"],"properties":{"status":{"type":"string","enum":["ERROR"]},"message":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}}}}}}`);
2565
2565
  var operationIds = ["CreateOrder", "CancelOrder"];
2566
2566
  var supportedOperationIds = ["CreateOrder", "CancelOrder"];
2567
2567
 
@@ -2703,13 +2703,13 @@ var WEBHOOK_PATH = "/bloodwork/aha-webhook";
2703
2703
  var AHA_PRESETS = {
2704
2704
  bad_signature: {
2705
2705
  description: "Every call answers 401 Invalid signature (AHA_API_ERROR / upstream)",
2706
- rules: [{ pathPrefix: "/v1/geviti", effect: "bad_signature" }]
2706
+ rules: [{ pathPrefix: "/v1/", effect: "bad_signature" }]
2707
2707
  },
2708
2708
  rate_limited: {
2709
2709
  description: "Every call answers 429 (the lab-provider client maps it to rate_limit, retryable)",
2710
2710
  rules: [
2711
2711
  {
2712
- pathPrefix: "/v1/geviti",
2712
+ pathPrefix: "/v1/",
2713
2713
  status: 429,
2714
2714
  body: { status: "ERROR", message: "Too many requests" }
2715
2715
  }
@@ -2719,7 +2719,7 @@ var AHA_PRESETS = {
2719
2719
  description: "Every call answers 500",
2720
2720
  rules: [
2721
2721
  {
2722
- pathPrefix: "/v1/geviti",
2722
+ pathPrefix: "/v1/",
2723
2723
  status: 500,
2724
2724
  body: { status: "ERROR", message: "Internal server error" }
2725
2725
  }
@@ -2727,11 +2727,11 @@ var AHA_PRESETS = {
2727
2727
  },
2728
2728
  order_error: {
2729
2729
  description: "create-order / cancel answer 200 with inner status ERROR (the lab provider fails it; AhaService does not check)",
2730
- rules: [{ pathPrefix: "/v1/geviti", effect: "order_error" }]
2730
+ rules: [{ pathPrefix: "/v1/", effect: "order_error" }]
2731
2731
  },
2732
2732
  invalid_response: {
2733
2733
  description: "create-order / cancel answer 200 with a body neither client's zod schema accepts",
2734
- rules: [{ pathPrefix: "/v1/geviti", effect: "invalid_response" }]
2734
+ rules: [{ pathPrefix: "/v1/", effect: "invalid_response" }]
2735
2735
  },
2736
2736
  webhook_duplicate: {
2737
2737
  description: "The next webhook is delivered twice",
@@ -2908,6 +2908,12 @@ var isBase64Sha256 = (value) => {
2908
2908
  return false;
2909
2909
  }
2910
2910
  };
2911
+ var legacyAuthKey = (request) => {
2912
+ for (const [name, value] of request.headers) {
2913
+ if (/^x-[a-z0-9_-]+-auth-key$/.test(name) && value) return value;
2914
+ }
2915
+ return void 0;
2916
+ };
2911
2917
  var verifyAuth = async (request, path, settings, wallNow) => {
2912
2918
  const apiKey = request.headers.get("x-api-key");
2913
2919
  if (apiKey) {
@@ -2932,7 +2938,7 @@ var verifyAuth = async (request, path, settings, wallNow) => {
2932
2938
  if (settings.credentials.length > 0) return "API key has no secret; use legacy auth";
2933
2939
  return isBase64Sha256(signature) ? void 0 : "Invalid signature";
2934
2940
  }
2935
- const legacy = request.headers.get("x-geviti-auth-key");
2941
+ const legacy = legacyAuthKey(request);
2936
2942
  if (legacy) {
2937
2943
  if (!settings.allowLegacy) return "Legacy authentication is disabled";
2938
2944
  if (settings.credentials.length > 0 && !settings.credentials.some((c) => c.apiKey === legacy)) {
@@ -2942,7 +2948,7 @@ var verifyAuth = async (request, path, settings, wallNow) => {
2942
2948
  }
2943
2949
  return "Missing authentication headers";
2944
2950
  };
2945
- var apiKeyCredential = (request) => request.headers.get("x-api-key") ?? request.headers.get("x-geviti-auth-key") ?? void 0;
2951
+ var apiKeyCredential = (request) => request.headers.get("x-api-key") ?? legacyAuthKey(request);
2946
2952
  var AhaAPI = class {
2947
2953
  app;
2948
2954
  sqlite;
@@ -3238,4 +3244,4 @@ export {
3238
3244
  apiKeyCredential,
3239
3245
  AhaAPI
3240
3246
  };
3241
- //# sourceMappingURL=chunk-HEWJBQGW.js.map
3247
+ //# sourceMappingURL=chunk-BPPF4CO6.js.map