@crvouga/mockingbird-service-rxvortex 1.1.0 → 1.1.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
@@ -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
  *
@@ -742,94 +770,6 @@ type FaultRegistry = {
742
770
  take(candidate: FaultCandidate): Promise<FaultHit[]>;
743
771
  };
744
772
 
745
- /** One handled request, as the structured log sees it. */
746
- type RequestLog = {
747
- service: string;
748
- namespace: string;
749
- operationId: string | undefined;
750
- method: string;
751
- path: string;
752
- status: number;
753
- durationMs: number;
754
- /** True when the path matched no operation in the contract. */
755
- unmatched: boolean;
756
- /** Set when a fault rule produced the response. */
757
- faultId?: string;
758
- /** Resource ids the handler touched (`userId`, `orderId`, …), when the service reports them. */
759
- ids?: Record<string, string>;
760
- /** Set when the service created a resource the request referred to but that did not exist. */
761
- adopted?: boolean;
762
- };
763
- type MetricsReport = {
764
- requests: number;
765
- /** Counts keyed `<operationId> <status>`. */
766
- byOperation: Record<string, number>;
767
- /**
768
- * Paths that matched no operation, most frequent first.
769
- *
770
- * This is the early-warning signal: a consumer calling something the mock does
771
- * not implement shows up here as a count, before it fails a suite as a 404.
772
- */
773
- unmatched: {
774
- method: string;
775
- path: string;
776
- count: number;
777
- }[];
778
- faults: number;
779
- totalDurationMs: number;
780
- };
781
- type Metrics = {
782
- record(entry: RequestLog): void;
783
- report(): MetricsReport;
784
- reset(): void;
785
- };
786
-
787
- /** One journal entry: a request log stamped with when (on the mock clock) it was handled. */
788
- type JournalEntry = RequestLog & {
789
- at: string;
790
- };
791
- type JournalQuery = {
792
- /** Only this namespace. Omit for every namespace, oldest first across all of them. */
793
- namespace?: string;
794
- operationId?: string;
795
- status?: number;
796
- /** Only entries at or after this instant (epoch ms). */
797
- since?: number;
798
- /** At most this many, the most recent kept. */
799
- limit?: number;
800
- };
801
- type Journal = {
802
- readonly size: number;
803
- record(entry: JournalEntry): void;
804
- list(query?: JournalQuery): JournalEntry[];
805
- /** Forget one namespace's entries, or every namespace's. */
806
- clear(namespace?: string): void;
807
- };
808
-
809
- /** Credential → namespace mapping behind `PUT /__admin/credentials`. */
810
- type CredentialRegistry = {
811
- set(credential: string, namespace: string): void;
812
- get(credential: string): string | undefined;
813
- remove(credential: string): boolean;
814
- clear(): void;
815
- entries(): {
816
- credential: string;
817
- namespace: string;
818
- }[];
819
- };
820
-
821
- /**
822
- * Sequential id source persisted in SQLite. Ids are deterministic for a given
823
- * sequence history (`cus_` + 14 opaque chars), so reproductions stay stable.
824
- */
825
- declare class IdSequence {
826
- private readonly sqlite;
827
- private readonly namespace;
828
- private readonly salt;
829
- constructor(sqlite: SqliteClient$1, namespace: string, salt?: string);
830
- next(prefix: string, length?: number): string;
831
- }
832
-
833
773
  /** A stable identifier for a point in a {@link Timeline}. */
834
774
  type CheckpointId = string;
835
775
  /** An immutable node in a timeline's checkpoint DAG. */
@@ -920,6 +860,135 @@ interface FetchAPI$1 {
920
860
  fetch(request: Request): Promise<Response>;
921
861
  }
922
862
 
863
+ /** Options every provider constructor accepts. */
864
+ type APIOptions = {
865
+ /** Sync SQLite client. Defaults to `@crvouga/mockingbird-service-sqlite`. */
866
+ sqlite?: SqliteClient$1;
867
+ /** Clock used for `created`-style fields. Default `Date.now`. */
868
+ now?: () => number;
869
+ /**
870
+ * Storage namespace for this instance's records. Instances sharing one SQLite
871
+ * client stay isolated when their namespaces differ. Defaults to the service name.
872
+ */
873
+ namespace?: string;
874
+ };
875
+
876
+ /**
877
+ * One problem with a request body, at a dotted path (`patient.address.city`, `items.0.sku`).
878
+ * `kind` is `media_type` when the body is present but its media type is not one the operation
879
+ * accepts (a `415` on most vendors), `syntax` when it could not be decoded, `required` when
880
+ * the operation needs a body and none arrived, and `schema` for a contract violation.
881
+ */
882
+ type BodyIssue = {
883
+ path: string;
884
+ message: string;
885
+ kind?: "media_type" | "syntax" | "required" | "schema";
886
+ };
887
+
888
+ /**
889
+ * What the mock received from a request it rejected, so a 4xx can be attributed after the
890
+ * fact (an empty body, a missing `content-type`, a schema violation) without logging the body.
891
+ */
892
+ type RejectedRequest = {
893
+ /** The raw `content-type` header, or `null` when the request sent none. */
894
+ contentType: string | null;
895
+ /** Bytes of body received from `content-length` (`0` for none), or `null` when the client sent no length (a streamed / chunked body). */
896
+ bodyBytes: number | null;
897
+ /** The raw `transfer-encoding` header (`chunked`), or `null`. */
898
+ transferEncoding: string | null;
899
+ };
900
+ /** One handled request, as the structured log sees it. */
901
+ type RequestLog = {
902
+ service: string;
903
+ namespace: string;
904
+ operationId: string | undefined;
905
+ method: string;
906
+ path: string;
907
+ status: number;
908
+ durationMs: number;
909
+ /** True when the path matched no operation in the contract. */
910
+ unmatched: boolean;
911
+ /** Set when a fault rule produced the response. */
912
+ faultId?: string;
913
+ /** Resource ids the handler touched (`userId`, `orderId`, …), when the service reports them. */
914
+ ids?: Record<string, string>;
915
+ /** Set when the service created a resource the request referred to but that did not exist. */
916
+ adopted?: boolean;
917
+ /** Set on a rejection (status ≥ 400) the mock produced itself, never on a scripted fault. */
918
+ request?: RejectedRequest;
919
+ /** The validation issues behind a rejection, when the service found any. */
920
+ issues?: BodyIssue[];
921
+ };
922
+ type MetricsReport = {
923
+ requests: number;
924
+ /** Counts keyed `<operationId> <status>`. */
925
+ byOperation: Record<string, number>;
926
+ /**
927
+ * Paths that matched no operation, most frequent first.
928
+ *
929
+ * This is the early-warning signal: a consumer calling something the mock does
930
+ * not implement shows up here as a count, before it fails a suite as a 404.
931
+ */
932
+ unmatched: {
933
+ method: string;
934
+ path: string;
935
+ count: number;
936
+ }[];
937
+ faults: number;
938
+ totalDurationMs: number;
939
+ };
940
+ type Metrics = {
941
+ record(entry: RequestLog): void;
942
+ report(): MetricsReport;
943
+ reset(): void;
944
+ };
945
+
946
+ /** One journal entry: a request log stamped with when (on the mock clock) it was handled. */
947
+ type JournalEntry = RequestLog & {
948
+ at: string;
949
+ };
950
+ type JournalQuery = {
951
+ /** Only this namespace. Omit for every namespace, oldest first across all of them. */
952
+ namespace?: string;
953
+ operationId?: string;
954
+ status?: number;
955
+ /** Only entries at or after this instant (epoch ms). */
956
+ since?: number;
957
+ /** At most this many, the most recent kept. */
958
+ limit?: number;
959
+ };
960
+ type Journal = {
961
+ readonly size: number;
962
+ record(entry: JournalEntry): void;
963
+ list(query?: JournalQuery): JournalEntry[];
964
+ /** Forget one namespace's entries, or every namespace's. */
965
+ clear(namespace?: string): void;
966
+ };
967
+
968
+ /** Credential → namespace mapping behind `PUT /__admin/credentials`. */
969
+ type CredentialRegistry = {
970
+ set(credential: string, namespace: string): void;
971
+ get(credential: string): string | undefined;
972
+ remove(credential: string): boolean;
973
+ clear(): void;
974
+ entries(): {
975
+ credential: string;
976
+ namespace: string;
977
+ }[];
978
+ };
979
+
980
+ /**
981
+ * Sequential id source persisted in SQLite. Ids are deterministic for a given
982
+ * sequence history (`cus_` + 14 opaque chars), so reproductions stay stable.
983
+ */
984
+ declare class IdSequence {
985
+ private readonly sqlite;
986
+ private readonly namespace;
987
+ private readonly salt;
988
+ constructor(sqlite: SqliteClient$1, namespace: string, salt?: string);
989
+ next(prefix: string, length?: number): string;
990
+ }
991
+
923
992
  /**
924
993
  * A point-in-time copy of everything a service namespace holds.
925
994
  *
@@ -1070,19 +1139,6 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI$1 & {
1070
1139
  timeline(namespace?: string): Timeline<ServiceTimelineState>;
1071
1140
  };
1072
1141
 
1073
- /** Options every provider constructor accepts. */
1074
- type APIOptions = {
1075
- /** Sync SQLite client. Defaults to `@crvouga/mockingbird-service-sqlite`. */
1076
- sqlite?: SqliteClient$1;
1077
- /** Clock used for `created`-style fields. Default `Date.now`. */
1078
- now?: () => number;
1079
- /**
1080
- * Storage namespace for this instance's records. Instances sharing one SQLite
1081
- * client stay isolated when their namespaces differ. Defaults to the service name.
1082
- */
1083
- namespace?: string;
1084
- };
1085
-
1086
1142
  /** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
1087
1143
  type SqliteValue = null | number | bigint | string | Uint8Array | boolean;
1088
1144
  /** Mutation counters returned by {@link SqliteStatement.run}. */
package/dist/server.js CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  createServer,
4
4
  loadCatalogFile,
5
5
  serveTarget
6
- } from "./chunk-SNW7NYY6.js";
7
- import "./chunk-VQAJFAUO.js";
6
+ } from "./chunk-XAWKEXKJ.js";
7
+ import "./chunk-5KK6W2PE.js";
8
8
  export {
9
9
  DEFAULT_PORT,
10
10
  createServer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crvouga/mockingbird-service-rxvortex",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Stateful mock of the RxVortex (Strive) pharmacy API: OAuth token, order submit, status, cancel, recovery by sender order id, preset catalog, and signed status webhooks.",
5
5
  "license": "MIT",
6
6
  "type": "module",