@crvouga/mockingbird-service-aws-speech 3.1.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/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,
@@ -648,76 +666,16 @@ type H2cListening = {
648
666
  */
649
667
  declare const listenH2c: (api: FetchAPI$1, options?: H2cListenOptions) => Promise<H2cListening>;
650
668
 
651
- /** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
652
- type SqliteValue$1 = null | number | bigint | string | Uint8Array | boolean;
653
- /** Mutation counters returned by {@link SqliteStatement.run}. */
654
- type SqliteRunResult$1 = {
655
- changes: number;
656
- lastInsertRowid: number | bigint;
669
+ type MountedAPI = FetchAPI & {
670
+ readonly prefix: string;
671
+ GET: FetchHandler;
672
+ POST: FetchHandler;
673
+ PUT: FetchHandler;
674
+ PATCH: FetchHandler;
675
+ DELETE: FetchHandler;
676
+ HEAD: FetchHandler;
677
+ OPTIONS: FetchHandler;
657
678
  };
658
- /**
659
- * Prepared statement bound to a {@link SqliteClient}.
660
- *
661
- * Pass bind values as rest arguments on each call (no sticky `bind()`).
662
- */
663
- interface SqliteStatement$1 {
664
- run(...params: SqliteValue$1[]): SqliteRunResult$1;
665
- all<T = Record<string, unknown>>(...params: SqliteValue$1[]): T[];
666
- get<T = Record<string, unknown>>(...params: SqliteValue$1[]): T | undefined;
667
- }
668
- /**
669
- * Sync SQLite client port owned by Mockingbird.
670
- *
671
- * Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
672
- * `bun:sqlite` instances all work when they expose this surface.
673
- */
674
- interface SqliteClient$1 {
675
- exec(sql: string): void;
676
- prepare(sql: string): SqliteStatement$1;
677
- transaction<T>(fn: () => T): T;
678
- }
679
-
680
- /** Every stored record carries a monotonically increasing sequence for stable ordering. */
681
- type Stored<T> = {
682
- seq: number;
683
- value: T;
684
- };
685
- type ListRecordsOptions<T> = {
686
- /** Keep only records passing the predicate. */
687
- where?: (value: T, seq: number) => boolean;
688
- /** Sort order; default newest first. */
689
- order?: "newest" | "oldest";
690
- };
691
- /**
692
- * A SQLite-backed table of JSON records addressed by id. Ordering is by insertion
693
- * sequence, never by id lexicographic order, so list semantics stay stable.
694
- */
695
- declare class Collection<T> {
696
- private readonly sqlite;
697
- /** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
698
- readonly namespace: string;
699
- /** Table name inside the namespace. Stable across resets of the rows themselves. */
700
- readonly collectionName: string;
701
- constructor(sqlite: SqliteClient$1,
702
- /** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
703
- namespace: string,
704
- /** Table name inside the namespace. Stable across resets of the rows themselves. */
705
- collectionName: string);
706
- private bumpCollectionSeq;
707
- nextSequence(): number;
708
- get(id: string): T | undefined;
709
- has(id: string): boolean;
710
- /** Insert a new record, assigning it the next sequence number. */
711
- insert(id: string, value: T): Stored<T>;
712
- /** Replace an existing record's value, keeping its position. */
713
- update(id: string, value: T): Stored<T> | undefined;
714
- delete(id: string): boolean;
715
- /** How many records the collection holds, without reading them. */
716
- count(): number;
717
- list(options?: ListRecordsOptions<T>): Array<Stored<T> & {
718
- id: string;
719
- }>;
720
- }
721
679
 
722
680
  /** A stable identifier for a point in a {@link Timeline}. */
723
681
  type CheckpointId = string;
@@ -808,6 +766,79 @@ declare class Timeline<T> {
808
766
  interface FetchAPI {
809
767
  fetch(request: Request): Promise<Response>;
810
768
  }
769
+ /** A bare function form of {@link FetchAPI}, compatible with `Bun.serve`, workerd, and Deno. */
770
+ type FetchHandler = (request: Request) => Promise<Response>;
771
+
772
+ /** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
773
+ type SqliteValue$1 = null | number | bigint | string | Uint8Array | boolean;
774
+ /** Mutation counters returned by {@link SqliteStatement.run}. */
775
+ type SqliteRunResult$1 = {
776
+ changes: number;
777
+ lastInsertRowid: number | bigint;
778
+ };
779
+ /**
780
+ * Prepared statement bound to a {@link SqliteClient}.
781
+ *
782
+ * Pass bind values as rest arguments on each call (no sticky `bind()`).
783
+ */
784
+ interface SqliteStatement$1 {
785
+ run(...params: SqliteValue$1[]): SqliteRunResult$1;
786
+ all<T = Record<string, unknown>>(...params: SqliteValue$1[]): T[];
787
+ get<T = Record<string, unknown>>(...params: SqliteValue$1[]): T | undefined;
788
+ }
789
+ /**
790
+ * Sync SQLite client port owned by Mockingbird.
791
+ *
792
+ * Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
793
+ * `bun:sqlite` instances all work when they expose this surface.
794
+ */
795
+ interface SqliteClient$1 {
796
+ exec(sql: string): void;
797
+ prepare(sql: string): SqliteStatement$1;
798
+ transaction<T>(fn: () => T): T;
799
+ }
800
+
801
+ /** Every stored record carries a monotonically increasing sequence for stable ordering. */
802
+ type Stored<T> = {
803
+ seq: number;
804
+ value: T;
805
+ };
806
+ type ListRecordsOptions<T> = {
807
+ /** Keep only records passing the predicate. */
808
+ where?: (value: T, seq: number) => boolean;
809
+ /** Sort order; default newest first. */
810
+ order?: "newest" | "oldest";
811
+ };
812
+ /**
813
+ * A SQLite-backed table of JSON records addressed by id. Ordering is by insertion
814
+ * sequence, never by id lexicographic order, so list semantics stay stable.
815
+ */
816
+ declare class Collection<T> {
817
+ private readonly sqlite;
818
+ /** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
819
+ readonly namespace: string;
820
+ /** Table name inside the namespace. Stable across resets of the rows themselves. */
821
+ readonly collectionName: string;
822
+ constructor(sqlite: SqliteClient$1,
823
+ /** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
824
+ namespace: string,
825
+ /** Table name inside the namespace. Stable across resets of the rows themselves. */
826
+ collectionName: string);
827
+ private bumpCollectionSeq;
828
+ nextSequence(): number;
829
+ get(id: string): T | undefined;
830
+ has(id: string): boolean;
831
+ /** Insert a new record, assigning it the next sequence number. */
832
+ insert(id: string, value: T): Stored<T>;
833
+ /** Replace an existing record's value, keeping its position. */
834
+ update(id: string, value: T): Stored<T> | undefined;
835
+ delete(id: string): boolean;
836
+ /** How many records the collection holds, without reading them. */
837
+ count(): number;
838
+ list(options?: ListRecordsOptions<T>): Array<Stored<T> & {
839
+ id: string;
840
+ }>;
841
+ }
811
842
 
812
843
  /** Options every provider constructor accepts. */
813
844
  type APIOptions = {
@@ -1237,6 +1268,8 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI & {
1237
1268
  /** Stop package-owned lifecycle timers when a supervisor closes the runtime. */
1238
1269
  stop?(): void;
1239
1270
  readonly name: string;
1271
+ /** Same-origin Fetch handler and App Router method exports, sharing this runtime. */
1272
+ mount(prefix: string): MountedAPI;
1240
1273
  readonly sqlite: SqliteClient$1;
1241
1274
  readonly clock: Clock;
1242
1275
  readonly faults: FaultRegistry;
package/dist/server.js CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  createServer,
4
4
  listenH2c,
5
5
  serveTarget
6
- } from "./chunk-KX3DZ6N5.js";
7
- import "./chunk-NQQSHZ6K.js";
6
+ } from "./chunk-6XMOS247.js";
7
+ import "./chunk-KXMGRBLP.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-aws-speech",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "description": "Stateful emulator of AWS Polly (SynthesizeSpeech, StartSpeechSynthesisStream) and Transcribe (streaming over h2c, batch jobs), with exact event-stream framing and scripted transcripts.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -100,7 +100,7 @@
100
100
  "pack:check": "bun ../../../scripts/pack-check.ts"
101
101
  },
102
102
  "dependencies": {
103
- "@crvouga/mockingbird-service-sqlite": "3.1.0",
103
+ "@crvouga/mockingbird-service-sqlite": "3.2.0",
104
104
  "hono": "4.11.9"
105
105
  },
106
106
  "devDependencies": {