@crvouga/mockingbird-service-junction 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/CHANGELOG.md +8 -2
- package/dist/{chunk-SENEZJTT.js → chunk-R4LSSE3O.js} +5 -3
- package/dist/chunk-R4LSSE3O.js.map +7 -0
- package/dist/{chunk-DBNCTIW4.js → chunk-WEQDMSPV.js} +258 -170
- package/dist/chunk-WEQDMSPV.js.map +7 -0
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +42 -27
- package/dist/index.js +1 -1
- package/dist/server.d.ts +87 -54
- package/dist/server.js +2 -2
- package/package.json +2 -2
- package/dist/chunk-DBNCTIW4.js.map +0 -7
- package/dist/chunk-SENEZJTT.js.map +0 -7
package/dist/cli.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
runCli,
|
|
5
5
|
serveCommand,
|
|
6
6
|
serveTarget
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-R4LSSE3O.js";
|
|
8
8
|
import {
|
|
9
9
|
DEFAULT_JUNCTION_BASE_URL,
|
|
10
10
|
createRuntime,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
isSandboxKey,
|
|
13
13
|
pullCorpus,
|
|
14
14
|
verifyAgainstReal
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-WEQDMSPV.js";
|
|
16
16
|
import {
|
|
17
17
|
defaultCorpus
|
|
18
18
|
} from "./chunk-2FZJPMTR.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,33 +1,15 @@
|
|
|
1
1
|
import { Hono } from 'hono';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
type MountedAPI = FetchAPI$1 & {
|
|
4
|
+
readonly prefix: string;
|
|
5
|
+
GET: FetchHandler;
|
|
6
|
+
POST: FetchHandler;
|
|
7
|
+
PUT: FetchHandler;
|
|
8
|
+
PATCH: FetchHandler;
|
|
9
|
+
DELETE: FetchHandler;
|
|
10
|
+
HEAD: FetchHandler;
|
|
11
|
+
OPTIONS: FetchHandler;
|
|
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$1 {
|
|
16
|
-
run(...params: SqliteValue$1[]): SqliteRunResult$1;
|
|
17
|
-
all<T = Record<string, unknown>>(...params: SqliteValue$1[]): T[];
|
|
18
|
-
get<T = Record<string, unknown>>(...params: SqliteValue$1[]): 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$1 {
|
|
27
|
-
exec(sql: string): void;
|
|
28
|
-
prepare(sql: string): SqliteStatement$1;
|
|
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 = string;
|
|
@@ -118,6 +100,37 @@ declare class Timeline<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 = (request: Request) => Promise<Response>;
|
|
105
|
+
|
|
106
|
+
/** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
|
|
107
|
+
type SqliteValue$1 = null | number | bigint | string | Uint8Array | boolean;
|
|
108
|
+
/** Mutation counters returned by {@link SqliteStatement.run}. */
|
|
109
|
+
type SqliteRunResult$1 = {
|
|
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$1 {
|
|
119
|
+
run(...params: SqliteValue$1[]): SqliteRunResult$1;
|
|
120
|
+
all<T = Record<string, unknown>>(...params: SqliteValue$1[]): T[];
|
|
121
|
+
get<T = Record<string, unknown>>(...params: SqliteValue$1[]): 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$1 {
|
|
130
|
+
exec(sql: string): void;
|
|
131
|
+
prepare(sql: string): SqliteStatement$1;
|
|
132
|
+
transaction<T>(fn: () => T): T;
|
|
133
|
+
}
|
|
121
134
|
|
|
122
135
|
/** Options every provider constructor accepts. */
|
|
123
136
|
type APIOptions = {
|
|
@@ -547,6 +560,8 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI$1 & {
|
|
|
547
560
|
/** Stop package-owned lifecycle timers when a supervisor closes the runtime. */
|
|
548
561
|
stop?(): void;
|
|
549
562
|
readonly name: string;
|
|
563
|
+
/** Same-origin Fetch handler and App Router method exports, sharing this runtime. */
|
|
564
|
+
mount(prefix: string): MountedAPI;
|
|
550
565
|
readonly sqlite: SqliteClient$1;
|
|
551
566
|
readonly clock: Clock;
|
|
552
567
|
readonly faults: FaultRegistry;
|
package/dist/index.js
CHANGED
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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,
|
|
@@ -619,34 +637,16 @@ type ServeTarget = {
|
|
|
619
637
|
listening?(server: Listening): void;
|
|
620
638
|
};
|
|
621
639
|
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
640
|
+
type MountedAPI = FetchAPI$1 & {
|
|
641
|
+
readonly prefix: string;
|
|
642
|
+
GET: FetchHandler;
|
|
643
|
+
POST: FetchHandler;
|
|
644
|
+
PUT: FetchHandler;
|
|
645
|
+
PATCH: FetchHandler;
|
|
646
|
+
DELETE: FetchHandler;
|
|
647
|
+
HEAD: FetchHandler;
|
|
648
|
+
OPTIONS: FetchHandler;
|
|
628
649
|
};
|
|
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
650
|
|
|
651
651
|
/** A stable identifier for a point in a {@link Timeline}. */
|
|
652
652
|
type CheckpointId = string;
|
|
@@ -737,6 +737,37 @@ declare class Timeline<T> {
|
|
|
737
737
|
interface FetchAPI$1 {
|
|
738
738
|
fetch(request: Request): Promise<Response>;
|
|
739
739
|
}
|
|
740
|
+
/** A bare function form of {@link FetchAPI}, compatible with `Bun.serve`, workerd, and Deno. */
|
|
741
|
+
type FetchHandler = (request: Request) => Promise<Response>;
|
|
742
|
+
|
|
743
|
+
/** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
|
|
744
|
+
type SqliteValue$1 = null | number | bigint | string | Uint8Array | boolean;
|
|
745
|
+
/** Mutation counters returned by {@link SqliteStatement.run}. */
|
|
746
|
+
type SqliteRunResult$1 = {
|
|
747
|
+
changes: number;
|
|
748
|
+
lastInsertRowid: number | bigint;
|
|
749
|
+
};
|
|
750
|
+
/**
|
|
751
|
+
* Prepared statement bound to a {@link SqliteClient}.
|
|
752
|
+
*
|
|
753
|
+
* Pass bind values as rest arguments on each call (no sticky `bind()`).
|
|
754
|
+
*/
|
|
755
|
+
interface SqliteStatement$1 {
|
|
756
|
+
run(...params: SqliteValue$1[]): SqliteRunResult$1;
|
|
757
|
+
all<T = Record<string, unknown>>(...params: SqliteValue$1[]): T[];
|
|
758
|
+
get<T = Record<string, unknown>>(...params: SqliteValue$1[]): T | undefined;
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* Sync SQLite client port owned by Mockingbird.
|
|
762
|
+
*
|
|
763
|
+
* Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
|
|
764
|
+
* `bun:sqlite` instances all work when they expose this surface.
|
|
765
|
+
*/
|
|
766
|
+
interface SqliteClient$1 {
|
|
767
|
+
exec(sql: string): void;
|
|
768
|
+
prepare(sql: string): SqliteStatement$1;
|
|
769
|
+
transaction<T>(fn: () => T): T;
|
|
770
|
+
}
|
|
740
771
|
|
|
741
772
|
/** Options every provider constructor accepts. */
|
|
742
773
|
type APIOptions = {
|
|
@@ -1166,6 +1197,8 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI$1 & {
|
|
|
1166
1197
|
/** Stop package-owned lifecycle timers when a supervisor closes the runtime. */
|
|
1167
1198
|
stop?(): void;
|
|
1168
1199
|
readonly name: string;
|
|
1200
|
+
/** Same-origin Fetch handler and App Router method exports, sharing this runtime. */
|
|
1201
|
+
mount(prefix: string): MountedAPI;
|
|
1169
1202
|
readonly sqlite: SqliteClient$1;
|
|
1170
1203
|
readonly clock: Clock;
|
|
1171
1204
|
readonly faults: FaultRegistry;
|
package/dist/server.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crvouga/mockingbird-service-junction",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Stateful emulator 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",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"verify": "bun src/cli.ts verify"
|
|
115
115
|
},
|
|
116
116
|
"dependencies": {
|
|
117
|
-
"@crvouga/mockingbird-service-sqlite": "3.
|
|
117
|
+
"@crvouga/mockingbird-service-sqlite": "3.2.0",
|
|
118
118
|
"hono": "4.11.9"
|
|
119
119
|
},
|
|
120
120
|
"devDependencies": {
|