@crvouga/mockingbird-service-junction 2.2.1 → 2.3.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/dist/server.d.ts CHANGED
@@ -1,6 +1,125 @@
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;
10
+ };
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
+
33
+ /** A stable identifier for a point in a {@link Timeline}. */
34
+ type CheckpointId$1 = string;
35
+ /** An immutable node in a timeline's checkpoint DAG. */
36
+ type Checkpoint$1<T> = Readonly<{
37
+ id: CheckpointId$1;
38
+ branch: string;
39
+ parent: CheckpointId$1 | null;
40
+ /** Logical time supplied by the timeline's injected clock. */
41
+ at: number;
42
+ value: T;
43
+ }>;
44
+ type TimelineOptions$1 = {
45
+ /** Logical clock used to stamp checkpoints. Defaults to a deterministic counter. */
46
+ now?: () => number;
47
+ /** Maximum retained checkpoints. Branch heads are never collected. Default 1,000. */
48
+ maxCheckpoints?: number;
49
+ /** Customize deterministic checkpoint IDs. */
50
+ id?: (sequence: number) => CheckpointId$1;
51
+ };
52
+ type CommitOptions$1 = {
53
+ branch?: string;
54
+ /** Parent checkpoint. Defaults to the selected branch's current head. */
55
+ parent?: CheckpointId$1 | null;
56
+ };
57
+ type ForkOptions$1 = {
58
+ /** Checkpoint to fork from. Defaults to the main branch's head. */
59
+ from?: CheckpointId$1;
60
+ };
61
+ /**
62
+ * Small, storage-agnostic checkpoint DAG shared by service runtimes. Its values may be immutable
63
+ * records, namespace images, or copy-on-write SQL engine snapshots.
64
+ *
65
+ * Values are retained by reference. Engines can therefore use persistent/COW snapshots while
66
+ * simpler services can use immutable values. IDs and GC order are deterministic, and all IO
67
+ * (the logical clock) is injected.
68
+ */
69
+ declare class Timeline$1<T> {
70
+ readonly maxCheckpoints: number;
71
+ private readonly now;
72
+ private readonly makeId;
73
+ private readonly nodes;
74
+ private readonly heads;
75
+ /** Unreferenced nodes in the exact order they became collectible. */
76
+ private readonly evictable;
77
+ /** Branch heads plus explicit retainers. Absent means zero. */
78
+ private readonly references;
79
+ private readonly explicitPins;
80
+ private sequence;
81
+ constructor(options?: TimelineOptions$1);
82
+ /** Capture a new immutable value and move `branch` to it. */
83
+ commit(value: T, options?: CommitOptions$1): Checkpoint$1<T>;
84
+ /** Create a branch pointer without copying its checkpoint value. */
85
+ fork(branch: string, options?: ForkOptions$1): Checkpoint$1<T> | undefined;
86
+ /** Move a branch pointer to an existing checkpoint. */
87
+ checkout(branch: string, id: CheckpointId$1): Checkpoint$1<T>;
88
+ get(id: CheckpointId$1): Checkpoint$1<T>;
89
+ head(branch?: string): Checkpoint$1<T> | undefined;
90
+ hasBranch(branch: string): boolean;
91
+ branches(): Readonly<Record<string, CheckpointId$1>>;
92
+ checkpoints(): readonly Checkpoint$1<T>[];
93
+ /** Number of retained checkpoints without allocating an array. */
94
+ get size(): number;
95
+ /** Pin a checkpoint independently of branch heads (used by compatibility snapshot handles). */
96
+ retain(id: CheckpointId$1): Checkpoint$1<T>;
97
+ /** Release one explicit pin. Branch heads remain pinned until moved or deleted. */
98
+ release(id: CheckpointId$1): boolean;
99
+ deleteBranch(branch: string): boolean;
100
+ /**
101
+ * Deterministically discard oldest unpinned checkpoints. Collection is O(number removed):
102
+ * commits never scan pinned nodes or the retained history. Parents are metadata rather than a
103
+ * storage dependency, so a retained node remains usable after pruning.
104
+ */
105
+ gc(max?: number): CheckpointId$1[];
106
+ private collect;
107
+ private moveHead;
108
+ private addReference;
109
+ private removeReference;
110
+ private assertBranch;
111
+ }
112
+
113
+ /**
114
+ * Anything that can answer a Fetch `Request` with a `Response`.
115
+ *
116
+ * Every Mockingbird service implements this, and every runtime adapter consumes it.
117
+ * It is the only contract shared across the whole graph.
118
+ */
119
+ interface FetchAPI$2 {
120
+ fetch(request: Request): Promise<Response>;
121
+ }
122
+
4
123
  /**
5
124
  * The single source of time for a service.
6
125
  *
@@ -31,35 +150,6 @@ type Clock$1 = {
31
150
  state(): ClockState$1;
32
151
  };
33
152
 
34
- /** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
35
- type SqliteValue$2 = null | number | bigint | string | Uint8Array | boolean;
36
- /** Mutation counters returned by {@link SqliteStatement.run}. */
37
- type SqliteRunResult$2 = {
38
- changes: number;
39
- lastInsertRowid: number | bigint;
40
- };
41
- /**
42
- * Prepared statement bound to a {@link SqliteClient}.
43
- *
44
- * Pass bind values as rest arguments on each call (no sticky `bind()`).
45
- */
46
- interface SqliteStatement$2 {
47
- run(...params: SqliteValue$2[]): SqliteRunResult$2;
48
- all<T = Record<string, unknown>>(...params: SqliteValue$2[]): T[];
49
- get<T = Record<string, unknown>>(...params: SqliteValue$2[]): T | undefined;
50
- }
51
- /**
52
- * Sync SQLite client port owned by Mockingbird.
53
- *
54
- * Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
55
- * `bun:sqlite` instances all work when they expose this surface.
56
- */
57
- interface SqliteClient$2 {
58
- exec(sql: string): void;
59
- prepare(sql: string): SqliteStatement$2;
60
- transaction<T>(fn: () => T): T;
61
- }
62
-
63
153
  /**
64
154
  * Seeded pseudo-random numbers, so anything a mock invents — ids, jitter, which
65
155
  * request a percentage fault hits — is reproducible from a seed.
@@ -187,96 +277,6 @@ type FaultRegistry$1 = {
187
277
  take(candidate: FaultCandidate$1): Promise<FaultHit$1[]>;
188
278
  };
189
279
 
190
- /** A stable identifier for a point in a {@link Timeline}. */
191
- type CheckpointId$1 = string;
192
- /** An immutable node in a timeline's checkpoint DAG. */
193
- type Checkpoint$1<T> = Readonly<{
194
- id: CheckpointId$1;
195
- branch: string;
196
- parent: CheckpointId$1 | null;
197
- /** Logical time supplied by the timeline's injected clock. */
198
- at: number;
199
- value: T;
200
- }>;
201
- type TimelineOptions$1 = {
202
- /** Logical clock used to stamp checkpoints. Defaults to a deterministic counter. */
203
- now?: () => number;
204
- /** Maximum retained checkpoints. Branch heads are never collected. Default 1,000. */
205
- maxCheckpoints?: number;
206
- /** Customize deterministic checkpoint IDs. */
207
- id?: (sequence: number) => CheckpointId$1;
208
- };
209
- type CommitOptions$1 = {
210
- branch?: string;
211
- /** Parent checkpoint. Defaults to the selected branch's current head. */
212
- parent?: CheckpointId$1 | null;
213
- };
214
- type ForkOptions$1 = {
215
- /** Checkpoint to fork from. Defaults to the main branch's head. */
216
- from?: CheckpointId$1;
217
- };
218
- /**
219
- * Small, storage-agnostic checkpoint DAG shared by service runtimes. Its values may be immutable
220
- * records, namespace images, or copy-on-write SQL engine snapshots.
221
- *
222
- * Values are retained by reference. Engines can therefore use persistent/COW snapshots while
223
- * simpler services can use immutable values. IDs and GC order are deterministic, and all IO
224
- * (the logical clock) is injected.
225
- */
226
- declare class Timeline$1<T> {
227
- readonly maxCheckpoints: number;
228
- private readonly now;
229
- private readonly makeId;
230
- private readonly nodes;
231
- private readonly heads;
232
- /** Unreferenced nodes in the exact order they became collectible. */
233
- private readonly evictable;
234
- /** Branch heads plus explicit retainers. Absent means zero. */
235
- private readonly references;
236
- private readonly explicitPins;
237
- private sequence;
238
- constructor(options?: TimelineOptions$1);
239
- /** Capture a new immutable value and move `branch` to it. */
240
- commit(value: T, options?: CommitOptions$1): Checkpoint$1<T>;
241
- /** Create a branch pointer without copying its checkpoint value. */
242
- fork(branch: string, options?: ForkOptions$1): Checkpoint$1<T> | undefined;
243
- /** Move a branch pointer to an existing checkpoint. */
244
- checkout(branch: string, id: CheckpointId$1): Checkpoint$1<T>;
245
- get(id: CheckpointId$1): Checkpoint$1<T>;
246
- head(branch?: string): Checkpoint$1<T> | undefined;
247
- hasBranch(branch: string): boolean;
248
- branches(): Readonly<Record<string, CheckpointId$1>>;
249
- checkpoints(): readonly Checkpoint$1<T>[];
250
- /** Number of retained checkpoints without allocating an array. */
251
- get size(): number;
252
- /** Pin a checkpoint independently of branch heads (used by compatibility snapshot handles). */
253
- retain(id: CheckpointId$1): Checkpoint$1<T>;
254
- /** Release one explicit pin. Branch heads remain pinned until moved or deleted. */
255
- release(id: CheckpointId$1): boolean;
256
- deleteBranch(branch: string): boolean;
257
- /**
258
- * Deterministically discard oldest unpinned checkpoints. Collection is O(number removed):
259
- * commits never scan pinned nodes or the retained history. Parents are metadata rather than a
260
- * storage dependency, so a retained node remains usable after pruning.
261
- */
262
- gc(max?: number): CheckpointId$1[];
263
- private collect;
264
- private moveHead;
265
- private addReference;
266
- private removeReference;
267
- private assertBranch;
268
- }
269
-
270
- /**
271
- * Anything that can answer a Fetch `Request` with a `Response`.
272
- *
273
- * Every Mockingbird service implements this, and every runtime adapter consumes it.
274
- * It is the only contract shared across the whole graph.
275
- */
276
- interface FetchAPI$2 {
277
- fetch(request: Request): Promise<Response>;
278
- }
279
-
280
280
  /**
281
281
  * One problem with a request body, at a dotted path (`patient.address.city`, `items.0.sku`).
282
282
  * `kind` is `media_type` when the body is present but its media type is not one the operation
@@ -318,6 +318,10 @@ type RequestLog$1 = {
318
318
  ids?: Record<string, string>;
319
319
  /** Set when the service created a resource the request referred to but that did not exist. */
320
320
  adopted?: boolean;
321
+ /** Explicit durable acceptance, independent of response delivery. */
322
+ accepted?: boolean;
323
+ /** Checkpoint captured at explicit acceptance. */
324
+ checkpoint?: string;
321
325
  /** Set on a rejection (status ≥ 400) the mock produced itself, never on a scripted fault. */
322
326
  request?: RejectedRequest$1;
323
327
  /** The validation issues behind a rejection, when the service found any. */
@@ -615,6 +619,138 @@ type ServeTarget = {
615
619
  listening?(server: Listening): void;
616
620
  };
617
621
 
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;
628
+ };
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
+
651
+ /** A stable identifier for a point in a {@link Timeline}. */
652
+ type CheckpointId = string;
653
+ /** An immutable node in a timeline's checkpoint DAG. */
654
+ type Checkpoint<T> = Readonly<{
655
+ id: CheckpointId;
656
+ branch: string;
657
+ parent: CheckpointId | null;
658
+ /** Logical time supplied by the timeline's injected clock. */
659
+ at: number;
660
+ value: T;
661
+ }>;
662
+ type TimelineOptions = {
663
+ /** Logical clock used to stamp checkpoints. Defaults to a deterministic counter. */
664
+ now?: () => number;
665
+ /** Maximum retained checkpoints. Branch heads are never collected. Default 1,000. */
666
+ maxCheckpoints?: number;
667
+ /** Customize deterministic checkpoint IDs. */
668
+ id?: (sequence: number) => CheckpointId;
669
+ };
670
+ type CommitOptions = {
671
+ branch?: string;
672
+ /** Parent checkpoint. Defaults to the selected branch's current head. */
673
+ parent?: CheckpointId | null;
674
+ };
675
+ type ForkOptions = {
676
+ /** Checkpoint to fork from. Defaults to the main branch's head. */
677
+ from?: CheckpointId;
678
+ };
679
+ /**
680
+ * Small, storage-agnostic checkpoint DAG shared by service runtimes. Its values may be immutable
681
+ * records, namespace images, or copy-on-write SQL engine snapshots.
682
+ *
683
+ * Values are retained by reference. Engines can therefore use persistent/COW snapshots while
684
+ * simpler services can use immutable values. IDs and GC order are deterministic, and all IO
685
+ * (the logical clock) is injected.
686
+ */
687
+ declare class Timeline<T> {
688
+ readonly maxCheckpoints: number;
689
+ private readonly now;
690
+ private readonly makeId;
691
+ private readonly nodes;
692
+ private readonly heads;
693
+ /** Unreferenced nodes in the exact order they became collectible. */
694
+ private readonly evictable;
695
+ /** Branch heads plus explicit retainers. Absent means zero. */
696
+ private readonly references;
697
+ private readonly explicitPins;
698
+ private sequence;
699
+ constructor(options?: TimelineOptions);
700
+ /** Capture a new immutable value and move `branch` to it. */
701
+ commit(value: T, options?: CommitOptions): Checkpoint<T>;
702
+ /** Create a branch pointer without copying its checkpoint value. */
703
+ fork(branch: string, options?: ForkOptions): Checkpoint<T> | undefined;
704
+ /** Move a branch pointer to an existing checkpoint. */
705
+ checkout(branch: string, id: CheckpointId): Checkpoint<T>;
706
+ get(id: CheckpointId): Checkpoint<T>;
707
+ head(branch?: string): Checkpoint<T> | undefined;
708
+ hasBranch(branch: string): boolean;
709
+ branches(): Readonly<Record<string, CheckpointId>>;
710
+ checkpoints(): readonly Checkpoint<T>[];
711
+ /** Number of retained checkpoints without allocating an array. */
712
+ get size(): number;
713
+ /** Pin a checkpoint independently of branch heads (used by compatibility snapshot handles). */
714
+ retain(id: CheckpointId): Checkpoint<T>;
715
+ /** Release one explicit pin. Branch heads remain pinned until moved or deleted. */
716
+ release(id: CheckpointId): boolean;
717
+ deleteBranch(branch: string): boolean;
718
+ /**
719
+ * Deterministically discard oldest unpinned checkpoints. Collection is O(number removed):
720
+ * commits never scan pinned nodes or the retained history. Parents are metadata rather than a
721
+ * storage dependency, so a retained node remains usable after pruning.
722
+ */
723
+ gc(max?: number): CheckpointId[];
724
+ private collect;
725
+ private moveHead;
726
+ private addReference;
727
+ private removeReference;
728
+ private assertBranch;
729
+ }
730
+
731
+ /**
732
+ * Anything that can answer a Fetch `Request` with a `Response`.
733
+ *
734
+ * Every Mockingbird service implements this, and every runtime adapter consumes it.
735
+ * It is the only contract shared across the whole graph.
736
+ */
737
+ interface FetchAPI$1 {
738
+ fetch(request: Request): Promise<Response>;
739
+ }
740
+
741
+ /** Options every provider constructor accepts. */
742
+ type APIOptions = {
743
+ /** Sync SQLite client. Defaults to `@crvouga/mockingbird-service-sqlite`. */
744
+ sqlite?: SqliteClient$1;
745
+ /** Clock used for `created`-style fields. Default `Date.now`. */
746
+ now?: () => number;
747
+ /**
748
+ * Storage namespace for this instance's records. Instances sharing one SQLite
749
+ * client stay isolated when their namespaces differ. Defaults to the service name.
750
+ */
751
+ namespace?: string;
752
+ };
753
+
618
754
  /**
619
755
  * The single source of time for a service.
620
756
  *
@@ -645,35 +781,6 @@ type Clock = {
645
781
  state(): ClockState;
646
782
  };
647
783
 
648
- /** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
649
- type SqliteValue$1 = null | number | bigint | string | Uint8Array | boolean;
650
- /** Mutation counters returned by {@link SqliteStatement.run}. */
651
- type SqliteRunResult$1 = {
652
- changes: number;
653
- lastInsertRowid: number | bigint;
654
- };
655
- /**
656
- * Prepared statement bound to a {@link SqliteClient}.
657
- *
658
- * Pass bind values as rest arguments on each call (no sticky `bind()`).
659
- */
660
- interface SqliteStatement$1 {
661
- run(...params: SqliteValue$1[]): SqliteRunResult$1;
662
- all<T = Record<string, unknown>>(...params: SqliteValue$1[]): T[];
663
- get<T = Record<string, unknown>>(...params: SqliteValue$1[]): T | undefined;
664
- }
665
- /**
666
- * Sync SQLite client port owned by Mockingbird.
667
- *
668
- * Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
669
- * `bun:sqlite` instances all work when they expose this surface.
670
- */
671
- interface SqliteClient$1 {
672
- exec(sql: string): void;
673
- prepare(sql: string): SqliteStatement$1;
674
- transaction<T>(fn: () => T): T;
675
- }
676
-
677
784
  /**
678
785
  * Seeded pseudo-random numbers, so anything a mock invents — ids, jitter, which
679
786
  * request a percentage fault hits — is reproducible from a seed.
@@ -801,109 +908,6 @@ type FaultRegistry = {
801
908
  take(candidate: FaultCandidate): Promise<FaultHit[]>;
802
909
  };
803
910
 
804
- /** A stable identifier for a point in a {@link Timeline}. */
805
- type CheckpointId = string;
806
- /** An immutable node in a timeline's checkpoint DAG. */
807
- type Checkpoint<T> = Readonly<{
808
- id: CheckpointId;
809
- branch: string;
810
- parent: CheckpointId | null;
811
- /** Logical time supplied by the timeline's injected clock. */
812
- at: number;
813
- value: T;
814
- }>;
815
- type TimelineOptions = {
816
- /** Logical clock used to stamp checkpoints. Defaults to a deterministic counter. */
817
- now?: () => number;
818
- /** Maximum retained checkpoints. Branch heads are never collected. Default 1,000. */
819
- maxCheckpoints?: number;
820
- /** Customize deterministic checkpoint IDs. */
821
- id?: (sequence: number) => CheckpointId;
822
- };
823
- type CommitOptions = {
824
- branch?: string;
825
- /** Parent checkpoint. Defaults to the selected branch's current head. */
826
- parent?: CheckpointId | null;
827
- };
828
- type ForkOptions = {
829
- /** Checkpoint to fork from. Defaults to the main branch's head. */
830
- from?: CheckpointId;
831
- };
832
- /**
833
- * Small, storage-agnostic checkpoint DAG shared by service runtimes. Its values may be immutable
834
- * records, namespace images, or copy-on-write SQL engine snapshots.
835
- *
836
- * Values are retained by reference. Engines can therefore use persistent/COW snapshots while
837
- * simpler services can use immutable values. IDs and GC order are deterministic, and all IO
838
- * (the logical clock) is injected.
839
- */
840
- declare class Timeline<T> {
841
- readonly maxCheckpoints: number;
842
- private readonly now;
843
- private readonly makeId;
844
- private readonly nodes;
845
- private readonly heads;
846
- /** Unreferenced nodes in the exact order they became collectible. */
847
- private readonly evictable;
848
- /** Branch heads plus explicit retainers. Absent means zero. */
849
- private readonly references;
850
- private readonly explicitPins;
851
- private sequence;
852
- constructor(options?: TimelineOptions);
853
- /** Capture a new immutable value and move `branch` to it. */
854
- commit(value: T, options?: CommitOptions): Checkpoint<T>;
855
- /** Create a branch pointer without copying its checkpoint value. */
856
- fork(branch: string, options?: ForkOptions): Checkpoint<T> | undefined;
857
- /** Move a branch pointer to an existing checkpoint. */
858
- checkout(branch: string, id: CheckpointId): Checkpoint<T>;
859
- get(id: CheckpointId): Checkpoint<T>;
860
- head(branch?: string): Checkpoint<T> | undefined;
861
- hasBranch(branch: string): boolean;
862
- branches(): Readonly<Record<string, CheckpointId>>;
863
- checkpoints(): readonly Checkpoint<T>[];
864
- /** Number of retained checkpoints without allocating an array. */
865
- get size(): number;
866
- /** Pin a checkpoint independently of branch heads (used by compatibility snapshot handles). */
867
- retain(id: CheckpointId): Checkpoint<T>;
868
- /** Release one explicit pin. Branch heads remain pinned until moved or deleted. */
869
- release(id: CheckpointId): boolean;
870
- deleteBranch(branch: string): boolean;
871
- /**
872
- * Deterministically discard oldest unpinned checkpoints. Collection is O(number removed):
873
- * commits never scan pinned nodes or the retained history. Parents are metadata rather than a
874
- * storage dependency, so a retained node remains usable after pruning.
875
- */
876
- gc(max?: number): CheckpointId[];
877
- private collect;
878
- private moveHead;
879
- private addReference;
880
- private removeReference;
881
- private assertBranch;
882
- }
883
-
884
- /**
885
- * Anything that can answer a Fetch `Request` with a `Response`.
886
- *
887
- * Every Mockingbird service implements this, and every runtime adapter consumes it.
888
- * It is the only contract shared across the whole graph.
889
- */
890
- interface FetchAPI$1 {
891
- fetch(request: Request): Promise<Response>;
892
- }
893
-
894
- /** Options every provider constructor accepts. */
895
- type APIOptions = {
896
- /** Sync SQLite client. Defaults to `@crvouga/mockingbird-service-sqlite`. */
897
- sqlite?: SqliteClient$1;
898
- /** Clock used for `created`-style fields. Default `Date.now`. */
899
- now?: () => number;
900
- /**
901
- * Storage namespace for this instance's records. Instances sharing one SQLite
902
- * client stay isolated when their namespaces differ. Defaults to the service name.
903
- */
904
- namespace?: string;
905
- };
906
-
907
911
  /**
908
912
  * One problem with a request body, at a dotted path (`patient.address.city`, `items.0.sku`).
909
913
  * `kind` is `media_type` when the body is present but its media type is not one the operation
@@ -945,6 +949,10 @@ type RequestLog = {
945
949
  ids?: Record<string, string>;
946
950
  /** Set when the service created a resource the request referred to but that did not exist. */
947
951
  adopted?: boolean;
952
+ /** Explicit durable acceptance, independent of response delivery. */
953
+ accepted?: boolean;
954
+ /** Checkpoint captured at explicit acceptance. */
955
+ checkpoint?: string;
948
956
  /** Set on a rejection (status ≥ 400) the mock produced itself, never on a scripted fault. */
949
957
  request?: RejectedRequest;
950
958
  /** The validation issues behind a rejection, when the service found any. */
package/dist/server.js CHANGED
@@ -3,9 +3,9 @@ import {
3
3
  createServer,
4
4
  loadCorpus,
5
5
  serveTarget
6
- } from "./chunk-CC4RCCHM.js";
7
- import "./chunk-5EF324W7.js";
8
- import "./chunk-C2UGIPPM.js";
6
+ } from "./chunk-RLSHRM7U.js";
7
+ import "./chunk-UHZKTYBX.js";
8
+ import "./chunk-2FZJPMTR.js";
9
9
  import "./chunk-ISDNA2TU.js";
10
10
  export {
11
11
  DEFAULT_PORT,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crvouga/mockingbird-service-junction",
3
- "version": "2.2.1",
3
+ "version": "2.3.1",
4
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.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -111,11 +111,11 @@
111
111
  "verify": "bun src/cli.ts verify"
112
112
  },
113
113
  "dependencies": {
114
- "@crvouga/mockingbird-service-sqlite": "2.1.0",
114
+ "@crvouga/mockingbird-service-sqlite": "2.1.1",
115
115
  "hono": "4.11.9"
116
116
  },
117
117
  "devDependencies": {
118
- "@cloudflare/workers-types": "^5.20260908.1",
118
+ "@cloudflare/workers-types": "^5.20260929.1",
119
119
  "@crvouga/mockingbird-openapi-codegen": "0.1.0",
120
120
  "@crvouga/mockingbird-adapter-node": "0.0.0-development",
121
121
  "@crvouga/mockingbird-openapi-metadata": "0.0.0-development",
@@ -124,7 +124,7 @@
124
124
  "@crvouga/mockingbird-service-sqlite": "0.0.0-development",
125
125
  "@tryvital/vital-node": "3.1.511",
126
126
  "fast-check": "4.9.0",
127
- "wrangler": "^4.129.1",
127
+ "wrangler": "^4.143.0",
128
128
  "@crvouga/mockingbird-core": "0.0.0-development",
129
129
  "@crvouga/mockingbird-sqlite": "0.0.0-development",
130
130
  "@crvouga/mockingbird-openapi": "0.0.0-development",