@crvouga/mockingbird-service-aha 0.2.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 +14 -1
- package/README.md +10 -7
- package/dist/{chunk-VJVM4I3P.js → chunk-J4SN6IVE.js} +7 -5
- package/dist/chunk-J4SN6IVE.js.map +7 -0
- package/dist/{chunk-HEWJBQGW.js → chunk-X63I2JY7.js} +121 -43
- package/dist/chunk-X63I2JY7.js.map +7 -0
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +134 -106
- package/dist/index.js +1 -1
- package/dist/server.d.ts +236 -180
- package/dist/server.js +2 -2
- package/package.json +7 -2
- package/dist/chunk-HEWJBQGW.js.map +0 -7
- package/dist/chunk-VJVM4I3P.js.map +0 -7
package/dist/server.d.ts
CHANGED
|
@@ -170,82 +170,6 @@ type FaultRegistry$1 = {
|
|
|
170
170
|
take(candidate: FaultCandidate$1): Promise<FaultHit$1[]>;
|
|
171
171
|
};
|
|
172
172
|
|
|
173
|
-
/** One handled request, as the structured log sees it. */
|
|
174
|
-
type RequestLog$1 = {
|
|
175
|
-
service: string;
|
|
176
|
-
namespace: string;
|
|
177
|
-
operationId: string | undefined;
|
|
178
|
-
method: string;
|
|
179
|
-
path: string;
|
|
180
|
-
status: number;
|
|
181
|
-
durationMs: number;
|
|
182
|
-
/** True when the path matched no operation in the contract. */
|
|
183
|
-
unmatched: boolean;
|
|
184
|
-
/** Set when a fault rule produced the response. */
|
|
185
|
-
faultId?: string;
|
|
186
|
-
/** Resource ids the handler touched (`userId`, `orderId`, …), when the service reports them. */
|
|
187
|
-
ids?: Record<string, string>;
|
|
188
|
-
/** Set when the service created a resource the request referred to but that did not exist. */
|
|
189
|
-
adopted?: boolean;
|
|
190
|
-
};
|
|
191
|
-
type MetricsReport$1 = {
|
|
192
|
-
requests: number;
|
|
193
|
-
/** Counts keyed `<operationId> <status>`. */
|
|
194
|
-
byOperation: Record<string, number>;
|
|
195
|
-
/**
|
|
196
|
-
* Paths that matched no operation, most frequent first.
|
|
197
|
-
*
|
|
198
|
-
* This is the early-warning signal: a consumer calling something the mock does
|
|
199
|
-
* not implement shows up here as a count, before it fails a suite as a 404.
|
|
200
|
-
*/
|
|
201
|
-
unmatched: {
|
|
202
|
-
method: string;
|
|
203
|
-
path: string;
|
|
204
|
-
count: number;
|
|
205
|
-
}[];
|
|
206
|
-
faults: number;
|
|
207
|
-
totalDurationMs: number;
|
|
208
|
-
};
|
|
209
|
-
type Metrics$1 = {
|
|
210
|
-
record(entry: RequestLog$1): void;
|
|
211
|
-
report(): MetricsReport$1;
|
|
212
|
-
reset(): void;
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
/** One journal entry: a request log stamped with when (on the mock clock) it was handled. */
|
|
216
|
-
type JournalEntry$1 = RequestLog$1 & {
|
|
217
|
-
at: string;
|
|
218
|
-
};
|
|
219
|
-
type JournalQuery$1 = {
|
|
220
|
-
/** Only this namespace. Omit for every namespace, oldest first across all of them. */
|
|
221
|
-
namespace?: string;
|
|
222
|
-
operationId?: string;
|
|
223
|
-
status?: number;
|
|
224
|
-
/** Only entries at or after this instant (epoch ms). */
|
|
225
|
-
since?: number;
|
|
226
|
-
/** At most this many, the most recent kept. */
|
|
227
|
-
limit?: number;
|
|
228
|
-
};
|
|
229
|
-
type Journal$1 = {
|
|
230
|
-
readonly size: number;
|
|
231
|
-
record(entry: JournalEntry$1): void;
|
|
232
|
-
list(query?: JournalQuery$1): JournalEntry$1[];
|
|
233
|
-
/** Forget one namespace's entries, or every namespace's. */
|
|
234
|
-
clear(namespace?: string): void;
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
/** Credential → namespace mapping behind `PUT /__admin/credentials`. */
|
|
238
|
-
type CredentialRegistry$1 = {
|
|
239
|
-
set(credential: string, namespace: string): void;
|
|
240
|
-
get(credential: string): string | undefined;
|
|
241
|
-
remove(credential: string): boolean;
|
|
242
|
-
clear(): void;
|
|
243
|
-
entries(): {
|
|
244
|
-
credential: string;
|
|
245
|
-
namespace: string;
|
|
246
|
-
}[];
|
|
247
|
-
};
|
|
248
|
-
|
|
249
173
|
/** A stable identifier for a point in a {@link Timeline}. */
|
|
250
174
|
type CheckpointId$1 = string;
|
|
251
175
|
/** An immutable node in a timeline's checkpoint DAG. */
|
|
@@ -336,6 +260,110 @@ interface FetchAPI$2 {
|
|
|
336
260
|
fetch(request: Request): Promise<Response>;
|
|
337
261
|
}
|
|
338
262
|
|
|
263
|
+
/**
|
|
264
|
+
* One problem with a request body, at a dotted path (`patient.address.city`, `items.0.sku`).
|
|
265
|
+
* `kind` is `media_type` when the body is present but its media type is not one the operation
|
|
266
|
+
* accepts (a `415` on most vendors), `syntax` when it could not be decoded, `required` when
|
|
267
|
+
* the operation needs a body and none arrived, and `schema` for a contract violation.
|
|
268
|
+
*/
|
|
269
|
+
type BodyIssue$1 = {
|
|
270
|
+
path: string;
|
|
271
|
+
message: string;
|
|
272
|
+
kind?: "media_type" | "syntax" | "required" | "schema";
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* What the mock received from a request it rejected, so a 4xx can be attributed after the
|
|
277
|
+
* fact (an empty body, a missing `content-type`, a schema violation) without logging the body.
|
|
278
|
+
*/
|
|
279
|
+
type RejectedRequest$1 = {
|
|
280
|
+
/** The raw `content-type` header, or `null` when the request sent none. */
|
|
281
|
+
contentType: string | null;
|
|
282
|
+
/** Bytes of body received from `content-length` (`0` for none), or `null` when the client sent no length (a streamed / chunked body). */
|
|
283
|
+
bodyBytes: number | null;
|
|
284
|
+
/** The raw `transfer-encoding` header (`chunked`), or `null`. */
|
|
285
|
+
transferEncoding: string | null;
|
|
286
|
+
};
|
|
287
|
+
/** One handled request, as the structured log sees it. */
|
|
288
|
+
type RequestLog$1 = {
|
|
289
|
+
service: string;
|
|
290
|
+
namespace: string;
|
|
291
|
+
operationId: string | undefined;
|
|
292
|
+
method: string;
|
|
293
|
+
path: string;
|
|
294
|
+
status: number;
|
|
295
|
+
durationMs: number;
|
|
296
|
+
/** True when the path matched no operation in the contract. */
|
|
297
|
+
unmatched: boolean;
|
|
298
|
+
/** Set when a fault rule produced the response. */
|
|
299
|
+
faultId?: string;
|
|
300
|
+
/** Resource ids the handler touched (`userId`, `orderId`, …), when the service reports them. */
|
|
301
|
+
ids?: Record<string, string>;
|
|
302
|
+
/** Set when the service created a resource the request referred to but that did not exist. */
|
|
303
|
+
adopted?: boolean;
|
|
304
|
+
/** Set on a rejection (status ≥ 400) the mock produced itself, never on a scripted fault. */
|
|
305
|
+
request?: RejectedRequest$1;
|
|
306
|
+
/** The validation issues behind a rejection, when the service found any. */
|
|
307
|
+
issues?: BodyIssue$1[];
|
|
308
|
+
};
|
|
309
|
+
type MetricsReport$1 = {
|
|
310
|
+
requests: number;
|
|
311
|
+
/** Counts keyed `<operationId> <status>`. */
|
|
312
|
+
byOperation: Record<string, number>;
|
|
313
|
+
/**
|
|
314
|
+
* Paths that matched no operation, most frequent first.
|
|
315
|
+
*
|
|
316
|
+
* This is the early-warning signal: a consumer calling something the mock does
|
|
317
|
+
* not implement shows up here as a count, before it fails a suite as a 404.
|
|
318
|
+
*/
|
|
319
|
+
unmatched: {
|
|
320
|
+
method: string;
|
|
321
|
+
path: string;
|
|
322
|
+
count: number;
|
|
323
|
+
}[];
|
|
324
|
+
faults: number;
|
|
325
|
+
totalDurationMs: number;
|
|
326
|
+
};
|
|
327
|
+
type Metrics$1 = {
|
|
328
|
+
record(entry: RequestLog$1): void;
|
|
329
|
+
report(): MetricsReport$1;
|
|
330
|
+
reset(): void;
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
/** One journal entry: a request log stamped with when (on the mock clock) it was handled. */
|
|
334
|
+
type JournalEntry$1 = RequestLog$1 & {
|
|
335
|
+
at: string;
|
|
336
|
+
};
|
|
337
|
+
type JournalQuery$1 = {
|
|
338
|
+
/** Only this namespace. Omit for every namespace, oldest first across all of them. */
|
|
339
|
+
namespace?: string;
|
|
340
|
+
operationId?: string;
|
|
341
|
+
status?: number;
|
|
342
|
+
/** Only entries at or after this instant (epoch ms). */
|
|
343
|
+
since?: number;
|
|
344
|
+
/** At most this many, the most recent kept. */
|
|
345
|
+
limit?: number;
|
|
346
|
+
};
|
|
347
|
+
type Journal$1 = {
|
|
348
|
+
readonly size: number;
|
|
349
|
+
record(entry: JournalEntry$1): void;
|
|
350
|
+
list(query?: JournalQuery$1): JournalEntry$1[];
|
|
351
|
+
/** Forget one namespace's entries, or every namespace's. */
|
|
352
|
+
clear(namespace?: string): void;
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
/** Credential → namespace mapping behind `PUT /__admin/credentials`. */
|
|
356
|
+
type CredentialRegistry$1 = {
|
|
357
|
+
set(credential: string, namespace: string): void;
|
|
358
|
+
get(credential: string): string | undefined;
|
|
359
|
+
remove(credential: string): boolean;
|
|
360
|
+
clear(): void;
|
|
361
|
+
entries(): {
|
|
362
|
+
credential: string;
|
|
363
|
+
namespace: string;
|
|
364
|
+
}[];
|
|
365
|
+
};
|
|
366
|
+
|
|
339
367
|
/**
|
|
340
368
|
* A point-in-time copy of everything a service namespace holds.
|
|
341
369
|
*
|
|
@@ -728,6 +756,133 @@ type FaultRegistry = {
|
|
|
728
756
|
take(candidate: FaultCandidate): Promise<FaultHit[]>;
|
|
729
757
|
};
|
|
730
758
|
|
|
759
|
+
/** A stable identifier for a point in a {@link Timeline}. */
|
|
760
|
+
type CheckpointId = string;
|
|
761
|
+
/** An immutable node in a timeline's checkpoint DAG. */
|
|
762
|
+
type Checkpoint<T> = Readonly<{
|
|
763
|
+
id: CheckpointId;
|
|
764
|
+
branch: string;
|
|
765
|
+
parent: CheckpointId | null;
|
|
766
|
+
/** Logical time supplied by the timeline's injected clock. */
|
|
767
|
+
at: number;
|
|
768
|
+
value: T;
|
|
769
|
+
}>;
|
|
770
|
+
type TimelineOptions = {
|
|
771
|
+
/** Logical clock used to stamp checkpoints. Defaults to a deterministic counter. */
|
|
772
|
+
now?: () => number;
|
|
773
|
+
/** Maximum retained checkpoints. Branch heads are never collected. Default 1,000. */
|
|
774
|
+
maxCheckpoints?: number;
|
|
775
|
+
/** Customize deterministic checkpoint IDs. */
|
|
776
|
+
id?: (sequence: number) => CheckpointId;
|
|
777
|
+
};
|
|
778
|
+
type CommitOptions = {
|
|
779
|
+
branch?: string;
|
|
780
|
+
/** Parent checkpoint. Defaults to the selected branch's current head. */
|
|
781
|
+
parent?: CheckpointId | null;
|
|
782
|
+
};
|
|
783
|
+
type ForkOptions = {
|
|
784
|
+
/** Checkpoint to fork from. Defaults to the main branch's head. */
|
|
785
|
+
from?: CheckpointId;
|
|
786
|
+
};
|
|
787
|
+
/**
|
|
788
|
+
* Small, storage-agnostic checkpoint DAG shared by service runtimes. Its values may be immutable
|
|
789
|
+
* records, namespace images, or copy-on-write SQL engine snapshots.
|
|
790
|
+
*
|
|
791
|
+
* Values are retained by reference. Engines can therefore use persistent/COW snapshots while
|
|
792
|
+
* simpler services can use immutable values. IDs and GC order are deterministic, and all IO
|
|
793
|
+
* (the logical clock) is injected.
|
|
794
|
+
*/
|
|
795
|
+
declare class Timeline<T> {
|
|
796
|
+
readonly maxCheckpoints: number;
|
|
797
|
+
private readonly now;
|
|
798
|
+
private readonly makeId;
|
|
799
|
+
private readonly nodes;
|
|
800
|
+
private readonly heads;
|
|
801
|
+
/** Unreferenced nodes in the exact order they became collectible. */
|
|
802
|
+
private readonly evictable;
|
|
803
|
+
/** Branch heads plus explicit retainers. Absent means zero. */
|
|
804
|
+
private readonly references;
|
|
805
|
+
private readonly explicitPins;
|
|
806
|
+
private sequence;
|
|
807
|
+
constructor(options?: TimelineOptions);
|
|
808
|
+
/** Capture a new immutable value and move `branch` to it. */
|
|
809
|
+
commit(value: T, options?: CommitOptions): Checkpoint<T>;
|
|
810
|
+
/** Create a branch pointer without copying its checkpoint value. */
|
|
811
|
+
fork(branch: string, options?: ForkOptions): Checkpoint<T> | undefined;
|
|
812
|
+
/** Move a branch pointer to an existing checkpoint. */
|
|
813
|
+
checkout(branch: string, id: CheckpointId): Checkpoint<T>;
|
|
814
|
+
get(id: CheckpointId): Checkpoint<T>;
|
|
815
|
+
head(branch?: string): Checkpoint<T> | undefined;
|
|
816
|
+
hasBranch(branch: string): boolean;
|
|
817
|
+
branches(): Readonly<Record<string, CheckpointId>>;
|
|
818
|
+
checkpoints(): readonly Checkpoint<T>[];
|
|
819
|
+
/** Number of retained checkpoints without allocating an array. */
|
|
820
|
+
get size(): number;
|
|
821
|
+
/** Pin a checkpoint independently of branch heads (used by compatibility snapshot handles). */
|
|
822
|
+
retain(id: CheckpointId): Checkpoint<T>;
|
|
823
|
+
/** Release one explicit pin. Branch heads remain pinned until moved or deleted. */
|
|
824
|
+
release(id: CheckpointId): boolean;
|
|
825
|
+
deleteBranch(branch: string): boolean;
|
|
826
|
+
/**
|
|
827
|
+
* Deterministically discard oldest unpinned checkpoints. Collection is O(number removed):
|
|
828
|
+
* commits never scan pinned nodes or the retained history. Parents are metadata rather than a
|
|
829
|
+
* storage dependency, so a retained node remains usable after pruning.
|
|
830
|
+
*/
|
|
831
|
+
gc(max?: number): CheckpointId[];
|
|
832
|
+
private collect;
|
|
833
|
+
private moveHead;
|
|
834
|
+
private addReference;
|
|
835
|
+
private removeReference;
|
|
836
|
+
private assertBranch;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
/**
|
|
840
|
+
* Anything that can answer a Fetch `Request` with a `Response`.
|
|
841
|
+
*
|
|
842
|
+
* Every Mockingbird service implements this, and every runtime adapter consumes it.
|
|
843
|
+
* It is the only contract shared across the whole graph.
|
|
844
|
+
*/
|
|
845
|
+
interface FetchAPI$1 {
|
|
846
|
+
fetch(request: Request): Promise<Response>;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
/** Options every provider constructor accepts. */
|
|
850
|
+
type APIOptions = {
|
|
851
|
+
/** Sync SQLite client. Defaults to `@crvouga/mockingbird-service-sqlite`. */
|
|
852
|
+
sqlite?: SqliteClient$1;
|
|
853
|
+
/** Clock used for `created`-style fields. Default `Date.now`. */
|
|
854
|
+
now?: () => number;
|
|
855
|
+
/**
|
|
856
|
+
* Storage namespace for this instance's records. Instances sharing one SQLite
|
|
857
|
+
* client stay isolated when their namespaces differ. Defaults to the service name.
|
|
858
|
+
*/
|
|
859
|
+
namespace?: string;
|
|
860
|
+
};
|
|
861
|
+
|
|
862
|
+
/**
|
|
863
|
+
* One problem with a request body, at a dotted path (`patient.address.city`, `items.0.sku`).
|
|
864
|
+
* `kind` is `media_type` when the body is present but its media type is not one the operation
|
|
865
|
+
* accepts (a `415` on most vendors), `syntax` when it could not be decoded, `required` when
|
|
866
|
+
* the operation needs a body and none arrived, and `schema` for a contract violation.
|
|
867
|
+
*/
|
|
868
|
+
type BodyIssue = {
|
|
869
|
+
path: string;
|
|
870
|
+
message: string;
|
|
871
|
+
kind?: "media_type" | "syntax" | "required" | "schema";
|
|
872
|
+
};
|
|
873
|
+
|
|
874
|
+
/**
|
|
875
|
+
* What the mock received from a request it rejected, so a 4xx can be attributed after the
|
|
876
|
+
* fact (an empty body, a missing `content-type`, a schema violation) without logging the body.
|
|
877
|
+
*/
|
|
878
|
+
type RejectedRequest = {
|
|
879
|
+
/** The raw `content-type` header, or `null` when the request sent none. */
|
|
880
|
+
contentType: string | null;
|
|
881
|
+
/** Bytes of body received from `content-length` (`0` for none), or `null` when the client sent no length (a streamed / chunked body). */
|
|
882
|
+
bodyBytes: number | null;
|
|
883
|
+
/** The raw `transfer-encoding` header (`chunked`), or `null`. */
|
|
884
|
+
transferEncoding: string | null;
|
|
885
|
+
};
|
|
731
886
|
/** One handled request, as the structured log sees it. */
|
|
732
887
|
type RequestLog = {
|
|
733
888
|
service: string;
|
|
@@ -745,6 +900,10 @@ type RequestLog = {
|
|
|
745
900
|
ids?: Record<string, string>;
|
|
746
901
|
/** Set when the service created a resource the request referred to but that did not exist. */
|
|
747
902
|
adopted?: boolean;
|
|
903
|
+
/** Set on a rejection (status ≥ 400) the mock produced itself, never on a scripted fault. */
|
|
904
|
+
request?: RejectedRequest;
|
|
905
|
+
/** The validation issues behind a rejection, when the service found any. */
|
|
906
|
+
issues?: BodyIssue[];
|
|
748
907
|
};
|
|
749
908
|
type MetricsReport = {
|
|
750
909
|
requests: number;
|
|
@@ -834,96 +993,6 @@ declare class IdSequence {
|
|
|
834
993
|
next(prefix: string, length?: number): string;
|
|
835
994
|
}
|
|
836
995
|
|
|
837
|
-
/** A stable identifier for a point in a {@link Timeline}. */
|
|
838
|
-
type CheckpointId = string;
|
|
839
|
-
/** An immutable node in a timeline's checkpoint DAG. */
|
|
840
|
-
type Checkpoint<T> = Readonly<{
|
|
841
|
-
id: CheckpointId;
|
|
842
|
-
branch: string;
|
|
843
|
-
parent: CheckpointId | null;
|
|
844
|
-
/** Logical time supplied by the timeline's injected clock. */
|
|
845
|
-
at: number;
|
|
846
|
-
value: T;
|
|
847
|
-
}>;
|
|
848
|
-
type TimelineOptions = {
|
|
849
|
-
/** Logical clock used to stamp checkpoints. Defaults to a deterministic counter. */
|
|
850
|
-
now?: () => number;
|
|
851
|
-
/** Maximum retained checkpoints. Branch heads are never collected. Default 1,000. */
|
|
852
|
-
maxCheckpoints?: number;
|
|
853
|
-
/** Customize deterministic checkpoint IDs. */
|
|
854
|
-
id?: (sequence: number) => CheckpointId;
|
|
855
|
-
};
|
|
856
|
-
type CommitOptions = {
|
|
857
|
-
branch?: string;
|
|
858
|
-
/** Parent checkpoint. Defaults to the selected branch's current head. */
|
|
859
|
-
parent?: CheckpointId | null;
|
|
860
|
-
};
|
|
861
|
-
type ForkOptions = {
|
|
862
|
-
/** Checkpoint to fork from. Defaults to the main branch's head. */
|
|
863
|
-
from?: CheckpointId;
|
|
864
|
-
};
|
|
865
|
-
/**
|
|
866
|
-
* Small, storage-agnostic checkpoint DAG shared by service runtimes. Its values may be immutable
|
|
867
|
-
* records, namespace images, or copy-on-write SQL engine snapshots.
|
|
868
|
-
*
|
|
869
|
-
* Values are retained by reference. Engines can therefore use persistent/COW snapshots while
|
|
870
|
-
* simpler services can use immutable values. IDs and GC order are deterministic, and all IO
|
|
871
|
-
* (the logical clock) is injected.
|
|
872
|
-
*/
|
|
873
|
-
declare class Timeline<T> {
|
|
874
|
-
readonly maxCheckpoints: number;
|
|
875
|
-
private readonly now;
|
|
876
|
-
private readonly makeId;
|
|
877
|
-
private readonly nodes;
|
|
878
|
-
private readonly heads;
|
|
879
|
-
/** Unreferenced nodes in the exact order they became collectible. */
|
|
880
|
-
private readonly evictable;
|
|
881
|
-
/** Branch heads plus explicit retainers. Absent means zero. */
|
|
882
|
-
private readonly references;
|
|
883
|
-
private readonly explicitPins;
|
|
884
|
-
private sequence;
|
|
885
|
-
constructor(options?: TimelineOptions);
|
|
886
|
-
/** Capture a new immutable value and move `branch` to it. */
|
|
887
|
-
commit(value: T, options?: CommitOptions): Checkpoint<T>;
|
|
888
|
-
/** Create a branch pointer without copying its checkpoint value. */
|
|
889
|
-
fork(branch: string, options?: ForkOptions): Checkpoint<T> | undefined;
|
|
890
|
-
/** Move a branch pointer to an existing checkpoint. */
|
|
891
|
-
checkout(branch: string, id: CheckpointId): Checkpoint<T>;
|
|
892
|
-
get(id: CheckpointId): Checkpoint<T>;
|
|
893
|
-
head(branch?: string): Checkpoint<T> | undefined;
|
|
894
|
-
hasBranch(branch: string): boolean;
|
|
895
|
-
branches(): Readonly<Record<string, CheckpointId>>;
|
|
896
|
-
checkpoints(): readonly Checkpoint<T>[];
|
|
897
|
-
/** Number of retained checkpoints without allocating an array. */
|
|
898
|
-
get size(): number;
|
|
899
|
-
/** Pin a checkpoint independently of branch heads (used by compatibility snapshot handles). */
|
|
900
|
-
retain(id: CheckpointId): Checkpoint<T>;
|
|
901
|
-
/** Release one explicit pin. Branch heads remain pinned until moved or deleted. */
|
|
902
|
-
release(id: CheckpointId): boolean;
|
|
903
|
-
deleteBranch(branch: string): boolean;
|
|
904
|
-
/**
|
|
905
|
-
* Deterministically discard oldest unpinned checkpoints. Collection is O(number removed):
|
|
906
|
-
* commits never scan pinned nodes or the retained history. Parents are metadata rather than a
|
|
907
|
-
* storage dependency, so a retained node remains usable after pruning.
|
|
908
|
-
*/
|
|
909
|
-
gc(max?: number): CheckpointId[];
|
|
910
|
-
private collect;
|
|
911
|
-
private moveHead;
|
|
912
|
-
private addReference;
|
|
913
|
-
private removeReference;
|
|
914
|
-
private assertBranch;
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
/**
|
|
918
|
-
* Anything that can answer a Fetch `Request` with a `Response`.
|
|
919
|
-
*
|
|
920
|
-
* Every Mockingbird service implements this, and every runtime adapter consumes it.
|
|
921
|
-
* It is the only contract shared across the whole graph.
|
|
922
|
-
*/
|
|
923
|
-
interface FetchAPI$1 {
|
|
924
|
-
fetch(request: Request): Promise<Response>;
|
|
925
|
-
}
|
|
926
|
-
|
|
927
996
|
/**
|
|
928
997
|
* A point-in-time copy of everything a service namespace holds.
|
|
929
998
|
*
|
|
@@ -1074,19 +1143,6 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI$1 & {
|
|
|
1074
1143
|
timeline(namespace?: string): Timeline<ServiceTimelineState>;
|
|
1075
1144
|
};
|
|
1076
1145
|
|
|
1077
|
-
/** Options every provider constructor accepts. */
|
|
1078
|
-
type APIOptions = {
|
|
1079
|
-
/** Sync SQLite client. Defaults to `@crvouga/mockingbird-service-sqlite`. */
|
|
1080
|
-
sqlite?: SqliteClient$1;
|
|
1081
|
-
/** Clock used for `created`-style fields. Default `Date.now`. */
|
|
1082
|
-
now?: () => number;
|
|
1083
|
-
/**
|
|
1084
|
-
* Storage namespace for this instance's records. Instances sharing one SQLite
|
|
1085
|
-
* client stay isolated when their namespaces differ. Defaults to the service name.
|
|
1086
|
-
*/
|
|
1087
|
-
namespace?: string;
|
|
1088
|
-
};
|
|
1089
|
-
|
|
1090
1146
|
/** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
|
|
1091
1147
|
type SqliteValue = null | number | bigint | string | Uint8Array | boolean;
|
|
1092
1148
|
/** Mutation counters returned by {@link SqliteStatement.run}. */
|
|
@@ -1169,7 +1225,7 @@ type Settings = {
|
|
|
1169
1225
|
* secret has its signature verified exactly.
|
|
1170
1226
|
*/
|
|
1171
1227
|
credentials: ApiCredential[];
|
|
1172
|
-
/** Accept `X
|
|
1228
|
+
/** Accept `X-<Partner>-Auth-Key` (legacy mode). Default true. */
|
|
1173
1229
|
allowLegacy: boolean;
|
|
1174
1230
|
/** Reject an `X-TIMESTAMP` further than this from wall-clock time; 0 disables. Default 5 min. */
|
|
1175
1231
|
timestampToleranceMs: number;
|
package/dist/server.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crvouga/mockingbird-service-aha",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Stateful AHA phlebotomy mock with signed HTTP orders, status webhooks, and a real deterministic SSH/SFTP result server.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -59,6 +59,11 @@
|
|
|
59
59
|
"layer": "service",
|
|
60
60
|
"category": "health",
|
|
61
61
|
"displayName": "AHA",
|
|
62
|
+
"vendor": {
|
|
63
|
+
"website": "https://www.mobileaha.com",
|
|
64
|
+
"name": "mobileAHA",
|
|
65
|
+
"description": "mobileAHA provides mobile phlebotomy: at-home and workplace blood draws for lab orders."
|
|
66
|
+
},
|
|
62
67
|
"status": "wip"
|
|
63
68
|
},
|
|
64
69
|
"scripts": {
|
|
@@ -74,7 +79,7 @@
|
|
|
74
79
|
"pack:check": "bun ../../../scripts/pack-check.ts"
|
|
75
80
|
},
|
|
76
81
|
"dependencies": {
|
|
77
|
-
"@crvouga/mockingbird-service-sqlite": "0.
|
|
82
|
+
"@crvouga/mockingbird-service-sqlite": "1.0.0",
|
|
78
83
|
"hono": "4.11.9",
|
|
79
84
|
"ssh2": "1.17.0"
|
|
80
85
|
},
|