@crvouga/mockingbird-service-junction 3.0.0 → 3.2.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/dist/cli.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  runCli,
5
5
  serveCommand,
6
6
  serveTarget
7
- } from "./chunk-XMZYEZ4V.js";
7
+ } from "./chunk-R4LSSE3O.js";
8
8
  import {
9
9
  DEFAULT_JUNCTION_BASE_URL,
10
10
  createRuntime,
@@ -12,7 +12,7 @@ import {
12
12
  isSandboxKey,
13
13
  pullCorpus,
14
14
  verifyAgainstReal
15
- } from "./chunk-G3BD4D34.js";
15
+ } from "./chunk-WEQDMSPV.js";
16
16
  import {
17
17
  defaultCorpus
18
18
  } from "./chunk-2FZJPMTR.js";
package/dist/index.d.ts CHANGED
@@ -1,33 +1,15 @@
1
1
  import { Hono } from 'hono';
2
2
 
3
- /** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
4
- type SqliteValue$1 = null | number | bigint | string | Uint8Array | boolean;
5
- /** Mutation counters returned by {@link SqliteStatement.run}. */
6
- type SqliteRunResult$1 = {
7
- changes: number;
8
- lastInsertRowid: number | bigint;
3
+ type MountedAPI = FetchAPI$1 & {
4
+ readonly prefix: string;
5
+ GET: FetchHandler;
6
+ POST: FetchHandler;
7
+ PUT: FetchHandler;
8
+ PATCH: FetchHandler;
9
+ DELETE: FetchHandler;
10
+ HEAD: FetchHandler;
11
+ OPTIONS: FetchHandler;
9
12
  };
10
- /**
11
- * Prepared statement bound to a {@link SqliteClient}.
12
- *
13
- * Pass bind values as rest arguments on each call (no sticky `bind()`).
14
- */
15
- interface SqliteStatement$1 {
16
- run(...params: SqliteValue$1[]): SqliteRunResult$1;
17
- all<T = Record<string, unknown>>(...params: SqliteValue$1[]): T[];
18
- get<T = Record<string, unknown>>(...params: SqliteValue$1[]): T | undefined;
19
- }
20
- /**
21
- * Sync SQLite client port owned by Mockingbird.
22
- *
23
- * Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
24
- * `bun:sqlite` instances all work when they expose this surface.
25
- */
26
- interface SqliteClient$1 {
27
- exec(sql: string): void;
28
- prepare(sql: string): SqliteStatement$1;
29
- transaction<T>(fn: () => T): T;
30
- }
31
13
 
32
14
  /** A stable identifier for a point in a {@link Timeline}. */
33
15
  type CheckpointId = string;
@@ -118,6 +100,37 @@ declare class Timeline<T> {
118
100
  interface FetchAPI$1 {
119
101
  fetch(request: Request): Promise<Response>;
120
102
  }
103
+ /** A bare function form of {@link FetchAPI}, compatible with `Bun.serve`, workerd, and Deno. */
104
+ type FetchHandler = (request: Request) => Promise<Response>;
105
+
106
+ /** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
107
+ type SqliteValue$1 = null | number | bigint | string | Uint8Array | boolean;
108
+ /** Mutation counters returned by {@link SqliteStatement.run}. */
109
+ type SqliteRunResult$1 = {
110
+ changes: number;
111
+ lastInsertRowid: number | bigint;
112
+ };
113
+ /**
114
+ * Prepared statement bound to a {@link SqliteClient}.
115
+ *
116
+ * Pass bind values as rest arguments on each call (no sticky `bind()`).
117
+ */
118
+ interface SqliteStatement$1 {
119
+ run(...params: SqliteValue$1[]): SqliteRunResult$1;
120
+ all<T = Record<string, unknown>>(...params: SqliteValue$1[]): T[];
121
+ get<T = Record<string, unknown>>(...params: SqliteValue$1[]): T | undefined;
122
+ }
123
+ /**
124
+ * Sync SQLite client port owned by Mockingbird.
125
+ *
126
+ * Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
127
+ * `bun:sqlite` instances all work when they expose this surface.
128
+ */
129
+ interface SqliteClient$1 {
130
+ exec(sql: string): void;
131
+ prepare(sql: string): SqliteStatement$1;
132
+ transaction<T>(fn: () => T): T;
133
+ }
121
134
 
122
135
  /** Options every provider constructor accepts. */
123
136
  type APIOptions = {
@@ -547,6 +560,8 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI$1 & {
547
560
  /** Stop package-owned lifecycle timers when a supervisor closes the runtime. */
548
561
  stop?(): void;
549
562
  readonly name: string;
563
+ /** Same-origin Fetch handler and App Router method exports, sharing this runtime. */
564
+ mount(prefix: string): MountedAPI;
550
565
  readonly sqlite: SqliteClient$1;
551
566
  readonly clock: Clock;
552
567
  readonly faults: FaultRegistry;
package/dist/index.js CHANGED
@@ -53,7 +53,7 @@ import {
53
53
  supportedOperationIds,
54
54
  verifyAgainstReal,
55
55
  verifySvix
56
- } from "./chunk-G3BD4D34.js";
56
+ } from "./chunk-WEQDMSPV.js";
57
57
  import {
58
58
  SEALED_CORPUS_VERSION,
59
59
  SUPPORTED_SEALED_CORPUS_VERSIONS,
package/dist/server.d.ts CHANGED
@@ -1,34 +1,16 @@
1
1
  import { Server } from 'node:http';
2
2
  import { Hono } from 'hono';
3
3
 
4
- /** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
5
- type SqliteValue$2 = null | number | bigint | string | Uint8Array | boolean;
6
- /** Mutation counters returned by {@link SqliteStatement.run}. */
7
- type SqliteRunResult$2 = {
8
- changes: number;
9
- lastInsertRowid: number | bigint;
4
+ type MountedAPI$1 = FetchAPI$2 & {
5
+ readonly prefix: string;
6
+ GET: FetchHandler$1;
7
+ POST: FetchHandler$1;
8
+ PUT: FetchHandler$1;
9
+ PATCH: FetchHandler$1;
10
+ DELETE: FetchHandler$1;
11
+ HEAD: FetchHandler$1;
12
+ OPTIONS: FetchHandler$1;
10
13
  };
11
- /**
12
- * Prepared statement bound to a {@link SqliteClient}.
13
- *
14
- * Pass bind values as rest arguments on each call (no sticky `bind()`).
15
- */
16
- interface SqliteStatement$2 {
17
- run(...params: SqliteValue$2[]): SqliteRunResult$2;
18
- all<T = Record<string, unknown>>(...params: SqliteValue$2[]): T[];
19
- get<T = Record<string, unknown>>(...params: SqliteValue$2[]): T | undefined;
20
- }
21
- /**
22
- * Sync SQLite client port owned by Mockingbird.
23
- *
24
- * Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
25
- * `bun:sqlite` instances all work when they expose this surface.
26
- */
27
- interface SqliteClient$2 {
28
- exec(sql: string): void;
29
- prepare(sql: string): SqliteStatement$2;
30
- transaction<T>(fn: () => T): T;
31
- }
32
14
 
33
15
  /** A stable identifier for a point in a {@link Timeline}. */
34
16
  type CheckpointId$1 = string;
@@ -119,6 +101,37 @@ declare class Timeline$1<T> {
119
101
  interface FetchAPI$2 {
120
102
  fetch(request: Request): Promise<Response>;
121
103
  }
104
+ /** A bare function form of {@link FetchAPI}, compatible with `Bun.serve`, workerd, and Deno. */
105
+ type FetchHandler$1 = (request: Request) => Promise<Response>;
106
+
107
+ /** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
108
+ type SqliteValue$2 = null | number | bigint | string | Uint8Array | boolean;
109
+ /** Mutation counters returned by {@link SqliteStatement.run}. */
110
+ type SqliteRunResult$2 = {
111
+ changes: number;
112
+ lastInsertRowid: number | bigint;
113
+ };
114
+ /**
115
+ * Prepared statement bound to a {@link SqliteClient}.
116
+ *
117
+ * Pass bind values as rest arguments on each call (no sticky `bind()`).
118
+ */
119
+ interface SqliteStatement$2 {
120
+ run(...params: SqliteValue$2[]): SqliteRunResult$2;
121
+ all<T = Record<string, unknown>>(...params: SqliteValue$2[]): T[];
122
+ get<T = Record<string, unknown>>(...params: SqliteValue$2[]): T | undefined;
123
+ }
124
+ /**
125
+ * Sync SQLite client port owned by Mockingbird.
126
+ *
127
+ * Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
128
+ * `bun:sqlite` instances all work when they expose this surface.
129
+ */
130
+ interface SqliteClient$2 {
131
+ exec(sql: string): void;
132
+ prepare(sql: string): SqliteStatement$2;
133
+ transaction<T>(fn: () => T): T;
134
+ }
122
135
 
123
136
  /**
124
137
  * The single source of time for a service.
@@ -535,6 +548,8 @@ type ServiceRuntime$1<T extends ServiceInstance$1> = FetchAPI$2 & {
535
548
  /** Stop package-owned lifecycle timers when a supervisor closes the runtime. */
536
549
  stop?(): void;
537
550
  readonly name: string;
551
+ /** Same-origin Fetch handler and App Router method exports, sharing this runtime. */
552
+ mount(prefix: string): MountedAPI$1;
538
553
  readonly sqlite: SqliteClient$2;
539
554
  readonly clock: Clock$1;
540
555
  readonly faults: FaultRegistry$1;
@@ -601,6 +616,9 @@ type CommonServeOptions = {
601
616
  adminKey: string | undefined;
602
617
  seed: string | undefined;
603
618
  onLog: ((entry: RequestLog$1) => void) | undefined;
619
+ /** Synthetic provider fixture objects supplied by a fleet entry. */
620
+ fixtures?: Record<string, unknown>;
621
+ baseUrl?: string;
604
622
  };
605
623
  /**
606
624
  * What a service contributes to `serve`: how to build its runtime from CLI flags,
@@ -619,34 +637,16 @@ type ServeTarget = {
619
637
  listening?(server: Listening): void;
620
638
  };
621
639
 
622
- /** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
623
- type SqliteValue$1 = null | number | bigint | string | Uint8Array | boolean;
624
- /** Mutation counters returned by {@link SqliteStatement.run}. */
625
- type SqliteRunResult$1 = {
626
- changes: number;
627
- lastInsertRowid: number | bigint;
640
+ type MountedAPI = FetchAPI$1 & {
641
+ readonly prefix: string;
642
+ GET: FetchHandler;
643
+ POST: FetchHandler;
644
+ PUT: FetchHandler;
645
+ PATCH: FetchHandler;
646
+ DELETE: FetchHandler;
647
+ HEAD: FetchHandler;
648
+ OPTIONS: FetchHandler;
628
649
  };
629
- /**
630
- * Prepared statement bound to a {@link SqliteClient}.
631
- *
632
- * Pass bind values as rest arguments on each call (no sticky `bind()`).
633
- */
634
- interface SqliteStatement$1 {
635
- run(...params: SqliteValue$1[]): SqliteRunResult$1;
636
- all<T = Record<string, unknown>>(...params: SqliteValue$1[]): T[];
637
- get<T = Record<string, unknown>>(...params: SqliteValue$1[]): T | undefined;
638
- }
639
- /**
640
- * Sync SQLite client port owned by Mockingbird.
641
- *
642
- * Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
643
- * `bun:sqlite` instances all work when they expose this surface.
644
- */
645
- interface SqliteClient$1 {
646
- exec(sql: string): void;
647
- prepare(sql: string): SqliteStatement$1;
648
- transaction<T>(fn: () => T): T;
649
- }
650
650
 
651
651
  /** A stable identifier for a point in a {@link Timeline}. */
652
652
  type CheckpointId = string;
@@ -737,6 +737,37 @@ declare class Timeline<T> {
737
737
  interface FetchAPI$1 {
738
738
  fetch(request: Request): Promise<Response>;
739
739
  }
740
+ /** A bare function form of {@link FetchAPI}, compatible with `Bun.serve`, workerd, and Deno. */
741
+ type FetchHandler = (request: Request) => Promise<Response>;
742
+
743
+ /** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
744
+ type SqliteValue$1 = null | number | bigint | string | Uint8Array | boolean;
745
+ /** Mutation counters returned by {@link SqliteStatement.run}. */
746
+ type SqliteRunResult$1 = {
747
+ changes: number;
748
+ lastInsertRowid: number | bigint;
749
+ };
750
+ /**
751
+ * Prepared statement bound to a {@link SqliteClient}.
752
+ *
753
+ * Pass bind values as rest arguments on each call (no sticky `bind()`).
754
+ */
755
+ interface SqliteStatement$1 {
756
+ run(...params: SqliteValue$1[]): SqliteRunResult$1;
757
+ all<T = Record<string, unknown>>(...params: SqliteValue$1[]): T[];
758
+ get<T = Record<string, unknown>>(...params: SqliteValue$1[]): T | undefined;
759
+ }
760
+ /**
761
+ * Sync SQLite client port owned by Mockingbird.
762
+ *
763
+ * Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
764
+ * `bun:sqlite` instances all work when they expose this surface.
765
+ */
766
+ interface SqliteClient$1 {
767
+ exec(sql: string): void;
768
+ prepare(sql: string): SqliteStatement$1;
769
+ transaction<T>(fn: () => T): T;
770
+ }
740
771
 
741
772
  /** Options every provider constructor accepts. */
742
773
  type APIOptions = {
@@ -1166,6 +1197,8 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI$1 & {
1166
1197
  /** Stop package-owned lifecycle timers when a supervisor closes the runtime. */
1167
1198
  stop?(): void;
1168
1199
  readonly name: string;
1200
+ /** Same-origin Fetch handler and App Router method exports, sharing this runtime. */
1201
+ mount(prefix: string): MountedAPI;
1169
1202
  readonly sqlite: SqliteClient$1;
1170
1203
  readonly clock: Clock;
1171
1204
  readonly faults: FaultRegistry;
package/dist/server.js CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  createServer,
4
4
  loadCorpus,
5
5
  serveTarget
6
- } from "./chunk-XMZYEZ4V.js";
7
- import "./chunk-G3BD4D34.js";
6
+ } from "./chunk-R4LSSE3O.js";
7
+ import "./chunk-WEQDMSPV.js";
8
8
  import "./chunk-2FZJPMTR.js";
9
9
  import "./chunk-ISDNA2TU.js";
10
10
  export {
package/openapi.yaml CHANGED
@@ -2,7 +2,7 @@ openapi: 3.1.0
2
2
  info:
3
3
  title: Junction API (Mockingbird subset)
4
4
  description: |
5
- Stateful mock subset of the Junction (Vital) API.
5
+ Stateful emulator subset of the Junction (Vital) API.
6
6
  Docs: https://docs.junction.com/
7
7
  Auth: https://docs.junction.com/api-details/junction-api
8
8
  Create user: https://docs.junction.com/api-reference/user/create-user
@@ -351,7 +351,7 @@ paths:
351
351
  parity:
352
352
  enabled: false
353
353
  safe: true
354
- reason: "lab-account inventory is fixture-owned; the mock models the documented shape, filters and routing rules, not a live account inventory"
354
+ reason: "lab-account inventory is fixture-owned; the emulator models the documented shape, filters and routing rules, not a live account inventory"
355
355
  parameters:
356
356
  - name: lab_account_id
357
357
  in: query
@@ -688,7 +688,7 @@ paths:
688
688
  safe: true
689
689
  reason: >-
690
690
  central_labs presence, within_radius counts and getlabs market coverage are
691
- provider-owned geo data that a mock cannot replicate per-zip; covered by the
691
+ provider-owned geo data that an emulator cannot replicate per-zip; covered by the
692
692
  client-parity scenario shape checks instead
693
693
  parameters:
694
694
  - name: zip_code
@@ -740,7 +740,7 @@ paths:
740
740
  safe: true
741
741
  reason: >-
742
742
  patient_service_centers are real site inventories per zip (thousands of sites,
743
- result-capped at 30) that a fixture mock cannot replicate per-zip; covered by
743
+ result-capped at 30) that a fixture emulator cannot replicate per-zip; covered by
744
744
  the client-parity scenario shape checks instead
745
745
  parameters:
746
746
  - name: zip_code
@@ -795,7 +795,7 @@ paths:
795
795
  safe: true
796
796
  reason: >-
797
797
  availability slots are provider-side data whose values shift between sandbox calls;
798
- covered by the mock-internal scheduling property suite instead
798
+ covered by the emulator-internal scheduling property suite instead
799
799
  parameters:
800
800
  - name: start_date
801
801
  in: query
@@ -861,7 +861,7 @@ paths:
861
861
  safe: true
862
862
  reason: >-
863
863
  availability slots are provider-side data whose values shift between sandbox calls;
864
- covered by the mock-internal scheduling property suite instead
864
+ covered by the emulator-internal scheduling property suite instead
865
865
  parameters:
866
866
  - name: lab
867
867
  in: query
@@ -956,7 +956,7 @@ paths:
956
956
  enabled: false
957
957
  safe: true
958
958
  reason: >-
959
- appointment payloads embed provider-side slot data; covered by the mock-internal
959
+ appointment payloads embed provider-side slot data; covered by the emulator-internal
960
960
  scheduling property suite instead
961
961
  responses:
962
962
  "200":
@@ -996,7 +996,7 @@ paths:
996
996
  enabled: false
997
997
  safe: true
998
998
  reason: >-
999
- booking depends on live provider slot state; covered by the mock-internal scheduling
999
+ booking depends on live provider slot state; covered by the emulator-internal scheduling
1000
1000
  property suite instead
1001
1001
  requestBody:
1002
1002
  required: true
@@ -1048,7 +1048,7 @@ paths:
1048
1048
  enabled: false
1049
1049
  safe: true
1050
1050
  reason: >-
1051
- rescheduling depends on live provider slot state; covered by the mock-internal
1051
+ rescheduling depends on live provider slot state; covered by the emulator-internal
1052
1052
  scheduling property suite instead
1053
1053
  requestBody:
1054
1054
  required: true
@@ -1100,7 +1100,7 @@ paths:
1100
1100
  enabled: false
1101
1101
  safe: true
1102
1102
  reason: >-
1103
- cancellation depends on live provider appointment state; covered by the mock-internal
1103
+ cancellation depends on live provider appointment state; covered by the emulator-internal
1104
1104
  scheduling property suite instead
1105
1105
  requestBody:
1106
1106
  required: true
@@ -1152,7 +1152,7 @@ paths:
1152
1152
  enabled: false
1153
1153
  safe: true
1154
1154
  reason: >-
1155
- appointment payloads embed provider-side slot data; covered by the mock-internal
1155
+ appointment payloads embed provider-side slot data; covered by the emulator-internal
1156
1156
  scheduling property suite instead
1157
1157
  responses:
1158
1158
  "200":
@@ -1192,7 +1192,7 @@ paths:
1192
1192
  enabled: false
1193
1193
  safe: true
1194
1194
  reason: >-
1195
- booking depends on live provider slot state; covered by the mock-internal scheduling
1195
+ booking depends on live provider slot state; covered by the emulator-internal scheduling
1196
1196
  property suite instead
1197
1197
  parameters:
1198
1198
  - name: x-idempotency-key
@@ -1250,7 +1250,7 @@ paths:
1250
1250
  enabled: false
1251
1251
  safe: true
1252
1252
  reason: >-
1253
- rescheduling depends on live provider slot state; covered by the mock-internal
1253
+ rescheduling depends on live provider slot state; covered by the emulator-internal
1254
1254
  scheduling property suite instead
1255
1255
  requestBody:
1256
1256
  required: true
@@ -1302,7 +1302,7 @@ paths:
1302
1302
  enabled: false
1303
1303
  safe: true
1304
1304
  reason: >-
1305
- cancellation depends on live provider appointment state; covered by the mock-internal
1305
+ cancellation depends on live provider appointment state; covered by the emulator-internal
1306
1306
  scheduling property suite instead
1307
1307
  requestBody:
1308
1308
  required: true
@@ -1541,7 +1541,7 @@ paths:
1541
1541
  enabled: false
1542
1542
  safe: true
1543
1543
  reason: >-
1544
- results carry provider-side specimen data; covered by the mock-internal results
1544
+ results carry provider-side specimen data; covered by the emulator-internal results
1545
1545
  property suite instead
1546
1546
  responses:
1547
1547
  "200":
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@crvouga/mockingbird-service-junction",
3
- "version": "3.0.0",
4
- "description": "Stateful mock of the Junction (Vital) user API driven by its OpenAPI contract and verified by differential property tests against the Junction sandbox.",
3
+ "version": "3.2.0",
4
+ "description": "Stateful emulator of the Junction (Vital) user API driven by its OpenAPI contract and verified by differential property tests against the Junction sandbox.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "sideEffects": false,
@@ -49,6 +49,7 @@
49
49
  "vital"
50
50
  ],
51
51
  "mockingbird": {
52
+ "featured": true,
52
53
  "runtime": "portable",
53
54
  "entries": {
54
55
  "server": "node",
@@ -98,7 +99,9 @@
98
99
  "lint": "biome check .",
99
100
  "test": "bun test",
100
101
  "parity": "bun scripts/parity.ts",
102
+ "emulator:server": "bun scripts/server.ts",
101
103
  "mock:server": "bun scripts/server.ts",
104
+ "emulator:serve": "bun scripts/server.ts",
102
105
  "mock:serve": "bun scripts/server.ts",
103
106
  "corpus:record": "bun scripts/record-corpus.ts",
104
107
  "client-parity": "bun scripts/client-parity.ts",
@@ -111,7 +114,7 @@
111
114
  "verify": "bun src/cli.ts verify"
112
115
  },
113
116
  "dependencies": {
114
- "@crvouga/mockingbird-service-sqlite": "3.0.0",
117
+ "@crvouga/mockingbird-service-sqlite": "3.2.0",
115
118
  "hono": "4.11.9"
116
119
  },
117
120
  "devDependencies": {