@crvouga/mockingbird-service-junction 3.10.11 → 3.10.12

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,13 @@
1
1
  # Changelog — @crvouga/mockingbird-service-junction
2
2
 
3
- ## 3.10.11 (2026-11-05)
3
+ ## 3.10.12 (2026-11-05)
4
+
5
+ ### Fixes and improvements
6
+
7
+ - list the availability window constants in the API table ([5be8737](https://github.com/crvouga/mockingbird/commit/5be873730b85d7cde734f13d5f8465249a7006a2))
8
+ - return Junction's 14-day availability window ([a538bfb](https://github.com/crvouga/mockingbird/commit/a538bfb859a5195d8fcc34fc7feb50e1ab562a09))
9
+
10
+ ## 3.10.11 (2026-11-04)
4
11
 
5
12
  ### Fixes and improvements
6
13
 
package/README.md CHANGED
@@ -856,7 +856,7 @@ Main entry (`@crvouga/mockingbird-service-junction`, runtime-neutral):
856
856
 
857
857
  | Export | Description |
858
858
  | --- | --- |
859
- | `createRuntime` | `(options?: JunctionRuntimeOptions) => JunctionRuntime` — the served emulator (health, admin, namespaces, clock, faults, metrics, journal, webhooks) as one `fetch`. Options: `corpus`, `geo`, `zipOverlays`, `catalogOverlays`, `markerCatalog`, `addOnSourceMarkers`, `labAccounts`, `teamId`, `limits`, `identity`, `defaultBillingTypes`, `labAccountBehavior`, `quirks`, `fixtures`, `journalSize`, `webhooks`, `onWebhook`, `sqlite`, `clock`, `seed`, `adminKey`, `onLog`. |
859
+ | `createRuntime` | `(options?: JunctionRuntimeOptions) => JunctionRuntime` — the served emulator (health, admin, namespaces, clock, faults, metrics, journal, webhooks) as one `fetch`. Options: `corpus`, `geo`, `zipOverlays`, `catalogOverlays`, `markerCatalog`, `addOnSourceMarkers`, `labAccounts`, `teamId`, `limits`, `availabilityWindowDays`, `identity`, `defaultBillingTypes`, `labAccountBehavior`, `quirks`, `fixtures`, `journalSize`, `webhooks`, `onWebhook`, `sqlite`, `clock`, `seed`, `adminKey`, `onLog`. |
860
860
  | `JunctionAPI` | Class. `new JunctionAPI(options?)`: one namespace's emulator, implementing `fetch(request: Request): Promise<Response>`. |
861
861
  | `JUNCTION_NAMESPACE` | `"junction"` — the default namespace's storage key when sharing a `sqlite` client. |
862
862
  | `document` | The vendored Junction OpenAPI document (Mockingbird subset) that drives routing. |
@@ -870,6 +870,7 @@ Main entry (`@crvouga/mockingbird-service-junction`, runtime-neutral):
870
870
  | `SEALED_CORPUS_VERSION` | Current corpus format version (`2`: adds `teamId`). |
871
871
  | `SUPPORTED_SEALED_CORPUS_VERSIONS` | Versions `parseSealedCorpus` loads (`[1, 2]`). |
872
872
  | `MOCK_TEAM_ID` | The team id used when neither `teamId` nor the corpus gives one. |
873
+ | `DEFAULT_AVAILABILITY_WINDOW_DAYS` / `MAX_AVAILABILITY_WINDOW_DAYS` | `14` / `60` — the days phlebotomy and PSC availability return from `start_date` by default, and the most `availabilityWindowDays` accepts. |
873
874
  | `OTHER_TEAM_ID` | A team that is not the emulator's, for fixtures modelling another team's account. |
874
875
  | `isLinkedToTeam` | `(account, teamId) => boolean` — the allowlist rule (`[]` counts as linked). |
875
876
  | `LAB_ACCOUNT_PRESETS` | The [lab-account presets](#lab-account-presets), without ids. |
@@ -963,6 +964,7 @@ type JunctionAPIOptions = {
963
964
  labAccounts?: LabAccountInput[] | { presets?: (string | { name; id? })[]; accounts?: LabAccountInput[] }
964
965
  teamId?: string // default: the corpus's recorded team, else MOCK_TEAM_ID
965
966
  limits?: { maxUsers?: number | null; simulateRequiresSandbox?: boolean; rateLimitPerSecond?: number | null }
967
+ availabilityWindowDays?: number // days phlebotomy/PSC availability return from start_date, 1–60; default 14
966
968
  identity?: "strict" | "adopt-users" // default "strict"
967
969
  defaultBillingTypes?: Record<string, BillingType> // lab slug → billing_type when omitted; default client_bill
968
970
  fixtures?: { users?: UserFixture[]; orders?: OrderFixture[] } // loaded now and on every reset()
@@ -13,7 +13,7 @@ import {
13
13
  pullCorpus,
14
14
  resolveAdminPrefix,
15
15
  restoreClock
16
- } from "./chunk-6LQTNRTP.js";
16
+ } from "./chunk-WCWZAPES.js";
17
17
  import {
18
18
  defaultCorpus
19
19
  } from "./chunk-2FZJPMTR.js";
@@ -3070,7 +3070,7 @@ async function preflightFleet(config, options) {
3070
3070
  break;
3071
3071
  }
3072
3072
  }
3073
- targets.set(name, { ...target, packageVersion: packageVersion ?? "3.10.11" });
3073
+ targets.set(name, { ...target, packageVersion: packageVersion ?? "3.10.12" });
3074
3074
  } catch (error) {
3075
3075
  throw new Error(`service ${name}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
3076
3076
  }
@@ -5264,4 +5264,4 @@ export {
5264
5264
  createServer2 as createServer,
5265
5265
  serveTarget
5266
5266
  };
5267
- //# sourceMappingURL=chunk-OWKW44HP.js.map
5267
+ //# sourceMappingURL=chunk-IHCJMTGY.js.map
@@ -3806,7 +3806,7 @@ var stateAdminRoutes = (routes) => {
3806
3806
  };
3807
3807
 
3808
3808
  // ../core/dist/version.js
3809
- var PACKAGE_VERSION = true ? "3.10.11" : UNRELEASED_VERSION;
3809
+ var PACKAGE_VERSION = true ? "3.10.12" : UNRELEASED_VERSION;
3810
3810
 
3811
3811
  // ../core/dist/webhooks.js
3812
3812
  var json4 = (status, body) => new Response(JSON.stringify(body), {
@@ -5940,6 +5940,15 @@ var RateWindow = class {
5940
5940
  };
5941
5941
 
5942
5942
  // src/state.ts
5943
+ var DEFAULT_AVAILABILITY_WINDOW_DAYS = 14;
5944
+ var MAX_AVAILABILITY_WINDOW_DAYS = 60;
5945
+ var availabilityWindowDaysFrom = (value) => {
5946
+ if (typeof value !== "number" || !Number.isInteger(value) || value < 1 || value > MAX_AVAILABILITY_WINDOW_DAYS)
5947
+ throw new TypeError(
5948
+ `availabilityWindowDays must be a whole number from 1 to ${MAX_AVAILABILITY_WINDOW_DAYS}`
5949
+ );
5950
+ return value;
5951
+ };
5943
5952
  var sortedQueryString = (params) => {
5944
5953
  const entries = [...params.entries()].sort(([leftKey, leftValue], [rightKey, rightValue]) => {
5945
5954
  const keyOrder = leftKey.localeCompare(rightKey);
@@ -6021,6 +6030,8 @@ var JunctionState = class {
6021
6030
  teamId = MOCK_TEAM_ID;
6022
6031
  /** Sandbox-only restrictions to enforce; every one is off by default. */
6023
6032
  limits = { ...DEFAULT_LIMITS };
6033
+ /** Days from `start_date` that phlebotomy and PSC availability return. */
6034
+ availabilityWindowDays = DEFAULT_AVAILABILITY_WINDOW_DAYS;
6024
6035
  /** Lab slug → the `billing_type` an order for that lab gets when it omits one. */
6025
6036
  labAccountOmissionPolicies = {};
6026
6037
  defaultBillingTypes = {};
@@ -8021,7 +8032,7 @@ var generatePhlebotomySlots = (state, zip, startDate, provider, nowMs) => {
8021
8032
  const random = seededRandom2(seedFor(["phlebotomy", provider, zip, startDate]));
8022
8033
  const timezone = zipTimezone(zip);
8023
8034
  const days = [];
8024
- for (let day = 0; day < 3; day++) {
8035
+ for (let day = 0; day < state.availabilityWindowDays; day++) {
8025
8036
  const date = addDays(startDate, day);
8026
8037
  const slots = [];
8027
8038
  const slotCount = 2 + Math.floor(random() * 3);
@@ -8072,7 +8083,7 @@ var generatePscSlots = (state, zip, startDate, siteCodes, nowMs) => {
8072
8083
  const random = seededRandom2(seedFor(["psc", zip, startDate, (siteCodes ?? []).sort().join("|")]));
8073
8084
  const timezone = zipTimezone(zip);
8074
8085
  const days = [];
8075
- for (let day = 0; day < 3; day++) {
8086
+ for (let day = 0; day < state.availabilityWindowDays; day++) {
8076
8087
  const date = addDays(startDate, day);
8077
8088
  const slots = [];
8078
8089
  const slotCount = 2 + Math.floor(random() * 3);
@@ -12885,6 +12896,8 @@ var createRuntime2 = (options = {}) => {
12885
12896
  if (options.labAccountBehavior)
12886
12897
  labAccountBehaviorFrom({ profile: "native", ...options.labAccountBehavior });
12887
12898
  if (options.quirks) quirksFrom(options.quirks);
12899
+ if (options.availabilityWindowDays !== void 0)
12900
+ availabilityWindowDaysFrom(options.availabilityWindowDays);
12888
12901
  const webhooks = options.webhooks ? createWebhookDispatcher(options.webhooks) : void 0;
12889
12902
  const runtime = createRuntime({
12890
12903
  name: JUNCTION_NAMESPACE,
@@ -12915,6 +12928,7 @@ var createRuntime2 = (options = {}) => {
12915
12928
  ...options.quirks ? { quirks: options.quirks } : {},
12916
12929
  ...options.teamId !== void 0 ? { teamId: options.teamId } : {},
12917
12930
  ...options.limits ? { limits: options.limits } : {},
12931
+ ...options.availabilityWindowDays !== void 0 ? { availabilityWindowDays: options.availabilityWindowDays } : {},
12918
12932
  ...options.identity ? { identity: options.identity } : {},
12919
12933
  ...options.defaultBillingTypes ? { defaultBillingTypes: options.defaultBillingTypes } : {},
12920
12934
  ...options.fixtures ? { fixtures: options.fixtures } : {},
@@ -13456,6 +13470,9 @@ var JunctionAPI = class {
13456
13470
  this.explicitTeamId = options.teamId;
13457
13471
  state.teamId = options.teamId ?? options.corpus?.teamId ?? MOCK_TEAM_ID;
13458
13472
  state.limits = mergeLimits(DEFAULT_LIMITS, options.limits ?? {});
13473
+ state.availabilityWindowDays = availabilityWindowDaysFrom(
13474
+ options.availabilityWindowDays ?? DEFAULT_AVAILABILITY_WINDOW_DAYS
13475
+ );
13459
13476
  if (options.identity !== void 0 && !IDENTITY_MODES.includes(options.identity))
13460
13477
  throw new TypeError(`identity must be one of ${IDENTITY_MODES.join(", ")}`);
13461
13478
  state.identity = options.identity ?? "strict";
@@ -13887,6 +13904,8 @@ export {
13887
13904
  isSandboxKey,
13888
13905
  DEFAULT_LIMITS,
13889
13906
  sandboxUserQuotaBody,
13907
+ DEFAULT_AVAILABILITY_WINDOW_DAYS,
13908
+ MAX_AVAILABILITY_WINDOW_DAYS,
13890
13909
  observationCacheKey,
13891
13910
  MOCK_TEAM_ID,
13892
13911
  US_STATES,
@@ -13940,4 +13959,4 @@ export {
13940
13959
  JunctionAPI,
13941
13960
  LabAccountConflict
13942
13961
  };
13943
- //# sourceMappingURL=chunk-6LQTNRTP.js.map
13962
+ //# sourceMappingURL=chunk-WCWZAPES.js.map