@crvouga/mockingbird-service-oauth 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/cli.js CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  runCli,
4
4
  serveCommand,
5
5
  serveTarget
6
- } from "./chunk-YZAZ5ZDZ.js";
7
- import "./chunk-KZJ46OLU.js";
6
+ } from "./chunk-AHMLLR4I.js";
7
+ import "./chunk-LAL7G624.js";
8
8
 
9
9
  // src/cli.ts
10
10
  var code = await runCli(
package/dist/index.d.ts CHANGED
@@ -1,73 +1,13 @@
1
- /** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
2
- type SqliteValue$1 = null | number | bigint | string | Uint8Array | boolean;
3
- /** Mutation counters returned by {@link SqliteStatement.run}. */
4
- type SqliteRunResult$1 = {
5
- changes: number;
6
- lastInsertRowid: number | bigint;
7
- };
8
- /**
9
- * Prepared statement bound to a {@link SqliteClient}.
10
- *
11
- * Pass bind values as rest arguments on each call (no sticky `bind()`).
12
- */
13
- interface SqliteStatement$1 {
14
- run(...params: SqliteValue$1[]): SqliteRunResult$1;
15
- all<T = Record<string, unknown>>(...params: SqliteValue$1[]): T[];
16
- get<T = Record<string, unknown>>(...params: SqliteValue$1[]): T | undefined;
17
- }
18
- /**
19
- * Sync SQLite client port owned by Mockingbird.
20
- *
21
- * Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
22
- * `bun:sqlite` instances all work when they expose this surface.
23
- */
24
- interface SqliteClient$1 {
25
- exec(sql: string): void;
26
- prepare(sql: string): SqliteStatement$1;
27
- transaction<T>(fn: () => T): T;
28
- }
29
-
30
- /** Every stored record carries a monotonically increasing sequence for stable ordering. */
31
- type Stored<T> = {
32
- seq: number;
33
- value: T;
34
- };
35
- type ListRecordsOptions<T> = {
36
- /** Keep only records passing the predicate. */
37
- where?: (value: T, seq: number) => boolean;
38
- /** Sort order; default newest first. */
39
- order?: "newest" | "oldest";
1
+ type MountedAPI = FetchAPI & {
2
+ readonly prefix: string;
3
+ GET: FetchHandler;
4
+ POST: FetchHandler;
5
+ PUT: FetchHandler;
6
+ PATCH: FetchHandler;
7
+ DELETE: FetchHandler;
8
+ HEAD: FetchHandler;
9
+ OPTIONS: FetchHandler;
40
10
  };
41
- /**
42
- * A SQLite-backed table of JSON records addressed by id. Ordering is by insertion
43
- * sequence, never by id lexicographic order, so list semantics stay stable.
44
- */
45
- declare class Collection<T> {
46
- private readonly sqlite;
47
- /** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
48
- readonly namespace: string;
49
- /** Table name inside the namespace. Stable across resets of the rows themselves. */
50
- readonly collectionName: string;
51
- constructor(sqlite: SqliteClient$1,
52
- /** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
53
- namespace: string,
54
- /** Table name inside the namespace. Stable across resets of the rows themselves. */
55
- collectionName: string);
56
- private bumpCollectionSeq;
57
- nextSequence(): number;
58
- get(id: string): T | undefined;
59
- has(id: string): boolean;
60
- /** Insert a new record, assigning it the next sequence number. */
61
- insert(id: string, value: T): Stored<T>;
62
- /** Replace an existing record's value, keeping its position. */
63
- update(id: string, value: T): Stored<T> | undefined;
64
- delete(id: string): boolean;
65
- /** How many records the collection holds, without reading them. */
66
- count(): number;
67
- list(options?: ListRecordsOptions<T>): Array<Stored<T> & {
68
- id: string;
69
- }>;
70
- }
71
11
 
72
12
  /** A stable identifier for a point in a {@link Timeline}. */
73
13
  type CheckpointId = string;
@@ -158,6 +98,79 @@ declare class Timeline<T> {
158
98
  interface FetchAPI {
159
99
  fetch(request: Request): Promise<Response>;
160
100
  }
101
+ /** A bare function form of {@link FetchAPI}, compatible with `Bun.serve`, workerd, and Deno. */
102
+ type FetchHandler = (request: Request) => Promise<Response>;
103
+
104
+ /** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
105
+ type SqliteValue$1 = null | number | bigint | string | Uint8Array | boolean;
106
+ /** Mutation counters returned by {@link SqliteStatement.run}. */
107
+ type SqliteRunResult$1 = {
108
+ changes: number;
109
+ lastInsertRowid: number | bigint;
110
+ };
111
+ /**
112
+ * Prepared statement bound to a {@link SqliteClient}.
113
+ *
114
+ * Pass bind values as rest arguments on each call (no sticky `bind()`).
115
+ */
116
+ interface SqliteStatement$1 {
117
+ run(...params: SqliteValue$1[]): SqliteRunResult$1;
118
+ all<T = Record<string, unknown>>(...params: SqliteValue$1[]): T[];
119
+ get<T = Record<string, unknown>>(...params: SqliteValue$1[]): T | undefined;
120
+ }
121
+ /**
122
+ * Sync SQLite client port owned by Mockingbird.
123
+ *
124
+ * Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
125
+ * `bun:sqlite` instances all work when they expose this surface.
126
+ */
127
+ interface SqliteClient$1 {
128
+ exec(sql: string): void;
129
+ prepare(sql: string): SqliteStatement$1;
130
+ transaction<T>(fn: () => T): T;
131
+ }
132
+
133
+ /** Every stored record carries a monotonically increasing sequence for stable ordering. */
134
+ type Stored<T> = {
135
+ seq: number;
136
+ value: T;
137
+ };
138
+ type ListRecordsOptions<T> = {
139
+ /** Keep only records passing the predicate. */
140
+ where?: (value: T, seq: number) => boolean;
141
+ /** Sort order; default newest first. */
142
+ order?: "newest" | "oldest";
143
+ };
144
+ /**
145
+ * A SQLite-backed table of JSON records addressed by id. Ordering is by insertion
146
+ * sequence, never by id lexicographic order, so list semantics stay stable.
147
+ */
148
+ declare class Collection<T> {
149
+ private readonly sqlite;
150
+ /** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
151
+ readonly namespace: string;
152
+ /** Table name inside the namespace. Stable across resets of the rows themselves. */
153
+ readonly collectionName: string;
154
+ constructor(sqlite: SqliteClient$1,
155
+ /** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
156
+ namespace: string,
157
+ /** Table name inside the namespace. Stable across resets of the rows themselves. */
158
+ collectionName: string);
159
+ private bumpCollectionSeq;
160
+ nextSequence(): number;
161
+ get(id: string): T | undefined;
162
+ has(id: string): boolean;
163
+ /** Insert a new record, assigning it the next sequence number. */
164
+ insert(id: string, value: T): Stored<T>;
165
+ /** Replace an existing record's value, keeping its position. */
166
+ update(id: string, value: T): Stored<T> | undefined;
167
+ delete(id: string): boolean;
168
+ /** How many records the collection holds, without reading them. */
169
+ count(): number;
170
+ list(options?: ListRecordsOptions<T>): Array<Stored<T> & {
171
+ id: string;
172
+ }>;
173
+ }
161
174
 
162
175
  /** Options every provider constructor accepts. */
163
176
  type APIOptions = {
@@ -600,6 +613,8 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI & {
600
613
  /** Stop package-owned lifecycle timers when a supervisor closes the runtime. */
601
614
  stop?(): void;
602
615
  readonly name: string;
616
+ /** Same-origin Fetch handler and App Router method exports, sharing this runtime. */
617
+ mount(prefix: string): MountedAPI;
603
618
  readonly sqlite: SqliteClient$1;
604
619
  readonly clock: Clock;
605
620
  readonly faults: FaultRegistry;
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  document,
8
8
  operationIds,
9
9
  supportedOperationIds
10
- } from "./chunk-KZJ46OLU.js";
10
+ } from "./chunk-LAL7G624.js";
11
11
  export {
12
12
  OAUTH_PRESETS,
13
13
  OAUTH_SCENARIOS,
package/dist/server.d.ts CHANGED
@@ -1,33 +1,15 @@
1
1
  import { Server } from 'node:http';
2
2
 
3
- /** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
4
- type SqliteValue$2 = null | number | bigint | string | Uint8Array | boolean;
5
- /** Mutation counters returned by {@link SqliteStatement.run}. */
6
- type SqliteRunResult$2 = {
7
- changes: number;
8
- lastInsertRowid: number | bigint;
3
+ type MountedAPI$1 = FetchAPI$1 & {
4
+ readonly prefix: string;
5
+ GET: FetchHandler$1;
6
+ POST: FetchHandler$1;
7
+ PUT: FetchHandler$1;
8
+ PATCH: FetchHandler$1;
9
+ DELETE: FetchHandler$1;
10
+ HEAD: FetchHandler$1;
11
+ OPTIONS: FetchHandler$1;
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$2 {
16
- run(...params: SqliteValue$2[]): SqliteRunResult$2;
17
- all<T = Record<string, unknown>>(...params: SqliteValue$2[]): T[];
18
- get<T = Record<string, unknown>>(...params: SqliteValue$2[]): 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$2 {
27
- exec(sql: string): void;
28
- prepare(sql: string): SqliteStatement$2;
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$1 = string;
@@ -118,6 +100,37 @@ declare class Timeline$1<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$1 = (request: Request) => Promise<Response>;
105
+
106
+ /** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
107
+ type SqliteValue$2 = null | number | bigint | string | Uint8Array | boolean;
108
+ /** Mutation counters returned by {@link SqliteStatement.run}. */
109
+ type SqliteRunResult$2 = {
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$2 {
119
+ run(...params: SqliteValue$2[]): SqliteRunResult$2;
120
+ all<T = Record<string, unknown>>(...params: SqliteValue$2[]): T[];
121
+ get<T = Record<string, unknown>>(...params: SqliteValue$2[]): 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$2 {
130
+ exec(sql: string): void;
131
+ prepare(sql: string): SqliteStatement$2;
132
+ transaction<T>(fn: () => T): T;
133
+ }
121
134
 
122
135
  /**
123
136
  * The single source of time for a service.
@@ -534,6 +547,8 @@ type ServiceRuntime$1<T extends ServiceInstance$1> = FetchAPI$1 & {
534
547
  /** Stop package-owned lifecycle timers when a supervisor closes the runtime. */
535
548
  stop?(): void;
536
549
  readonly name: string;
550
+ /** Same-origin Fetch handler and App Router method exports, sharing this runtime. */
551
+ mount(prefix: string): MountedAPI$1;
537
552
  readonly sqlite: SqliteClient$2;
538
553
  readonly clock: Clock$1;
539
554
  readonly faults: FaultRegistry$1;
@@ -600,6 +615,9 @@ type CommonServeOptions = {
600
615
  adminKey: string | undefined;
601
616
  seed: string | undefined;
602
617
  onLog: ((entry: RequestLog$1) => void) | undefined;
618
+ /** Synthetic provider fixture objects supplied by a fleet entry. */
619
+ fixtures?: Record<string, unknown>;
620
+ baseUrl?: string;
603
621
  };
604
622
  /**
605
623
  * What a service contributes to `serve`: how to build its runtime from CLI flags,
@@ -618,76 +636,16 @@ type ServeTarget = {
618
636
  listening?(server: Listening): void;
619
637
  };
620
638
 
621
- /** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
622
- type SqliteValue$1 = null | number | bigint | string | Uint8Array | boolean;
623
- /** Mutation counters returned by {@link SqliteStatement.run}. */
624
- type SqliteRunResult$1 = {
625
- changes: number;
626
- lastInsertRowid: number | bigint;
639
+ type MountedAPI = FetchAPI & {
640
+ readonly prefix: string;
641
+ GET: FetchHandler;
642
+ POST: FetchHandler;
643
+ PUT: FetchHandler;
644
+ PATCH: FetchHandler;
645
+ DELETE: FetchHandler;
646
+ HEAD: FetchHandler;
647
+ OPTIONS: FetchHandler;
627
648
  };
628
- /**
629
- * Prepared statement bound to a {@link SqliteClient}.
630
- *
631
- * Pass bind values as rest arguments on each call (no sticky `bind()`).
632
- */
633
- interface SqliteStatement$1 {
634
- run(...params: SqliteValue$1[]): SqliteRunResult$1;
635
- all<T = Record<string, unknown>>(...params: SqliteValue$1[]): T[];
636
- get<T = Record<string, unknown>>(...params: SqliteValue$1[]): T | undefined;
637
- }
638
- /**
639
- * Sync SQLite client port owned by Mockingbird.
640
- *
641
- * Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
642
- * `bun:sqlite` instances all work when they expose this surface.
643
- */
644
- interface SqliteClient$1 {
645
- exec(sql: string): void;
646
- prepare(sql: string): SqliteStatement$1;
647
- transaction<T>(fn: () => T): T;
648
- }
649
-
650
- /** Every stored record carries a monotonically increasing sequence for stable ordering. */
651
- type Stored<T> = {
652
- seq: number;
653
- value: T;
654
- };
655
- type ListRecordsOptions<T> = {
656
- /** Keep only records passing the predicate. */
657
- where?: (value: T, seq: number) => boolean;
658
- /** Sort order; default newest first. */
659
- order?: "newest" | "oldest";
660
- };
661
- /**
662
- * A SQLite-backed table of JSON records addressed by id. Ordering is by insertion
663
- * sequence, never by id lexicographic order, so list semantics stay stable.
664
- */
665
- declare class Collection<T> {
666
- private readonly sqlite;
667
- /** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
668
- readonly namespace: string;
669
- /** Table name inside the namespace. Stable across resets of the rows themselves. */
670
- readonly collectionName: string;
671
- constructor(sqlite: SqliteClient$1,
672
- /** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
673
- namespace: string,
674
- /** Table name inside the namespace. Stable across resets of the rows themselves. */
675
- collectionName: string);
676
- private bumpCollectionSeq;
677
- nextSequence(): number;
678
- get(id: string): T | undefined;
679
- has(id: string): boolean;
680
- /** Insert a new record, assigning it the next sequence number. */
681
- insert(id: string, value: T): Stored<T>;
682
- /** Replace an existing record's value, keeping its position. */
683
- update(id: string, value: T): Stored<T> | undefined;
684
- delete(id: string): boolean;
685
- /** How many records the collection holds, without reading them. */
686
- count(): number;
687
- list(options?: ListRecordsOptions<T>): Array<Stored<T> & {
688
- id: string;
689
- }>;
690
- }
691
649
 
692
650
  /** A stable identifier for a point in a {@link Timeline}. */
693
651
  type CheckpointId = string;
@@ -778,6 +736,79 @@ declare class Timeline<T> {
778
736
  interface FetchAPI {
779
737
  fetch(request: Request): Promise<Response>;
780
738
  }
739
+ /** A bare function form of {@link FetchAPI}, compatible with `Bun.serve`, workerd, and Deno. */
740
+ type FetchHandler = (request: Request) => Promise<Response>;
741
+
742
+ /** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
743
+ type SqliteValue$1 = null | number | bigint | string | Uint8Array | boolean;
744
+ /** Mutation counters returned by {@link SqliteStatement.run}. */
745
+ type SqliteRunResult$1 = {
746
+ changes: number;
747
+ lastInsertRowid: number | bigint;
748
+ };
749
+ /**
750
+ * Prepared statement bound to a {@link SqliteClient}.
751
+ *
752
+ * Pass bind values as rest arguments on each call (no sticky `bind()`).
753
+ */
754
+ interface SqliteStatement$1 {
755
+ run(...params: SqliteValue$1[]): SqliteRunResult$1;
756
+ all<T = Record<string, unknown>>(...params: SqliteValue$1[]): T[];
757
+ get<T = Record<string, unknown>>(...params: SqliteValue$1[]): T | undefined;
758
+ }
759
+ /**
760
+ * Sync SQLite client port owned by Mockingbird.
761
+ *
762
+ * Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
763
+ * `bun:sqlite` instances all work when they expose this surface.
764
+ */
765
+ interface SqliteClient$1 {
766
+ exec(sql: string): void;
767
+ prepare(sql: string): SqliteStatement$1;
768
+ transaction<T>(fn: () => T): T;
769
+ }
770
+
771
+ /** Every stored record carries a monotonically increasing sequence for stable ordering. */
772
+ type Stored<T> = {
773
+ seq: number;
774
+ value: T;
775
+ };
776
+ type ListRecordsOptions<T> = {
777
+ /** Keep only records passing the predicate. */
778
+ where?: (value: T, seq: number) => boolean;
779
+ /** Sort order; default newest first. */
780
+ order?: "newest" | "oldest";
781
+ };
782
+ /**
783
+ * A SQLite-backed table of JSON records addressed by id. Ordering is by insertion
784
+ * sequence, never by id lexicographic order, so list semantics stay stable.
785
+ */
786
+ declare class Collection<T> {
787
+ private readonly sqlite;
788
+ /** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
789
+ readonly namespace: string;
790
+ /** Table name inside the namespace. Stable across resets of the rows themselves. */
791
+ readonly collectionName: string;
792
+ constructor(sqlite: SqliteClient$1,
793
+ /** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
794
+ namespace: string,
795
+ /** Table name inside the namespace. Stable across resets of the rows themselves. */
796
+ collectionName: string);
797
+ private bumpCollectionSeq;
798
+ nextSequence(): number;
799
+ get(id: string): T | undefined;
800
+ has(id: string): boolean;
801
+ /** Insert a new record, assigning it the next sequence number. */
802
+ insert(id: string, value: T): Stored<T>;
803
+ /** Replace an existing record's value, keeping its position. */
804
+ update(id: string, value: T): Stored<T> | undefined;
805
+ delete(id: string): boolean;
806
+ /** How many records the collection holds, without reading them. */
807
+ count(): number;
808
+ list(options?: ListRecordsOptions<T>): Array<Stored<T> & {
809
+ id: string;
810
+ }>;
811
+ }
781
812
 
782
813
  /** Options every provider constructor accepts. */
783
814
  type APIOptions = {
@@ -1207,6 +1238,8 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI & {
1207
1238
  /** Stop package-owned lifecycle timers when a supervisor closes the runtime. */
1208
1239
  stop?(): void;
1209
1240
  readonly name: string;
1241
+ /** Same-origin Fetch handler and App Router method exports, sharing this runtime. */
1242
+ mount(prefix: string): MountedAPI;
1210
1243
  readonly sqlite: SqliteClient$1;
1211
1244
  readonly clock: Clock;
1212
1245
  readonly faults: FaultRegistry;
package/dist/server.js CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  createMultiServer,
4
4
  createServer,
5
5
  serveTarget
6
- } from "./chunk-YZAZ5ZDZ.js";
7
- import "./chunk-KZJ46OLU.js";
6
+ } from "./chunk-AHMLLR4I.js";
7
+ import "./chunk-LAL7G624.js";
8
8
  export {
9
9
  DEFAULT_PORT,
10
10
  createMultiServer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crvouga/mockingbird-service-oauth",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "description": "Social-login emulator with Google, Apple, Microsoft, GitHub and generic OIDC profiles, private relay identities, reproducible edge cases, signed tokens and an accessible UI.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -117,7 +117,7 @@
117
117
  "pack:check": "bun ../../../scripts/pack-check.ts"
118
118
  },
119
119
  "dependencies": {
120
- "@crvouga/mockingbird-service-sqlite": "3.1.0"
120
+ "@crvouga/mockingbird-service-sqlite": "3.2.0"
121
121
  },
122
122
  "devDependencies": {
123
123
  "@crvouga/mockingbird-adapter-node": "0.0.0-development",