@btravstack/testing 0.13.0 → 0.14.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/index.d.cts +7 -7
- package/dist/index.d.mts +7 -7
- package/dist/jwt.d.cts +5 -6
- package/dist/jwt.d.mts +5 -6
- package/package.json +12 -12
package/dist/index.d.cts
CHANGED
|
@@ -34,7 +34,7 @@ type BootDefaults = Omit<StartOptions, "signals">;
|
|
|
34
34
|
* even when the test never looked at `exited`, while a modeled `Err` passes
|
|
35
35
|
* through, since a startup failure is an outcome a test may be asserting.
|
|
36
36
|
*/
|
|
37
|
-
declare const bootFixture: (defaults?: BootDefaults) => ({}: object, use: (boot: Boot) => Promise<void>) => Promise<void>;
|
|
37
|
+
export declare const bootFixture: (defaults?: BootDefaults) => ({}: object, use: (boot: Boot) => Promise<void>) => Promise<void>;
|
|
38
38
|
//#endregion
|
|
39
39
|
//#region src/fake-clock.d.ts
|
|
40
40
|
type FakeClock = Clock & {
|
|
@@ -63,7 +63,7 @@ type FakeClock = Clock & {
|
|
|
63
63
|
* await clock.advance(20_000); // the drain deadline
|
|
64
64
|
* ```
|
|
65
65
|
*/
|
|
66
|
-
declare const createFakeClock: (start?: number) => FakeClock;
|
|
66
|
+
export declare const createFakeClock: (start?: number) => FakeClock;
|
|
67
67
|
//#endregion
|
|
68
68
|
//#region src/overridden.d.ts
|
|
69
69
|
/** One override's error channel, unioned across the tuple by `overridden`. */
|
|
@@ -91,7 +91,7 @@ type AnyProviderFor = Provider<never, unknown, unknown>;
|
|
|
91
91
|
* root to re-export internals to be overridable. They are checked at build
|
|
92
92
|
* instead, by `plan`'s missing-provider defect.
|
|
93
93
|
*/
|
|
94
|
-
declare const overridden: <X, E, N, const O extends readonly AnyProviderFor[]>(module: Module<X, E, N>, overrides: O) => Module<X, E | ErrorsOf<O>, N>;
|
|
94
|
+
export declare const overridden: <X, E, N, const O extends readonly AnyProviderFor[]>(module: Module<X, E, N>, overrides: O) => Module<X, E | ErrorsOf<O>, N>;
|
|
95
95
|
//#endregion
|
|
96
96
|
//#region src/tapped.d.ts
|
|
97
97
|
/** The services behind `ports`, in order — what `tapped(...).services()` answers once the graph is built. */
|
|
@@ -122,7 +122,7 @@ type ServicesOf<P extends readonly AnyPort[]> = { readonly [K in keyof P]: Servi
|
|
|
122
122
|
type TapGate<P extends readonly AnyPort[], X> = [Exclude<InstanceType<P[number]>, X>] extends [never] ? unknown : {
|
|
123
123
|
readonly "NOT EXPORTED — tap only what the module exports": Exclude<InstanceType<P[number]>, X>;
|
|
124
124
|
};
|
|
125
|
-
declare const tapped: <X, E, N, const P extends readonly AnyPort[]>(module: Module<X, E, N>, ports: P & TapGate<P, X>) => {
|
|
125
|
+
export declare const tapped: <X, E, N, const P extends readonly AnyPort[]>(module: Module<X, E, N>, ports: P & TapGate<P, X>) => {
|
|
126
126
|
readonly module: Module<X, E, N>;
|
|
127
127
|
readonly services: () => ServicesOf<P>;
|
|
128
128
|
};
|
|
@@ -141,7 +141,7 @@ type TestRuntimeInfo = {
|
|
|
141
141
|
readonly name: string;
|
|
142
142
|
};
|
|
143
143
|
/** The in-memory runtime's port: what `TestRuntime.module` provides, and what a test composition exports. */
|
|
144
|
-
declare class TestRuntimePort extends RuntimePort<Runtime<never, TestRuntimeInfo>> {}
|
|
144
|
+
export declare class TestRuntimePort extends RuntimePort<Runtime<never, TestRuntimeInfo>> {}
|
|
145
145
|
/**
|
|
146
146
|
* A module `options.unit` may bind, as the upper bound `testRuntime`
|
|
147
147
|
* constrains its own `Unit` type parameter to. `Module`'s `_exports` channel is
|
|
@@ -191,6 +191,6 @@ type TestRuntime<Unit extends AnyUnitModule | undefined = undefined> = Runtime<n
|
|
|
191
191
|
/** The `RuntimeHost` the kernel last called `start` with. **Throws** if the runtime was never started — the same misuse guard as `serving()`. */
|
|
192
192
|
readonly host: () => RuntimeHost<never>;
|
|
193
193
|
};
|
|
194
|
-
declare const testRuntime: <Unit extends AnyUnitModule | undefined = undefined>(name?: string, options?: TestRuntimeOptions<Unit>) => TestRuntime<Unit>;
|
|
194
|
+
export declare const testRuntime: <Unit extends AnyUnitModule | undefined = undefined>(name?: string, options?: TestRuntimeOptions<Unit>) => TestRuntime<Unit>;
|
|
195
195
|
//#endregion
|
|
196
|
-
export {
|
|
196
|
+
export type { Boot, BootDefaults, FakeClock, ServicesOf, SubmittedUnit, TestRuntime, TestRuntimeInfo, TestRuntimeOptions };
|
package/dist/index.d.mts
CHANGED
|
@@ -34,7 +34,7 @@ type BootDefaults = Omit<StartOptions, "signals">;
|
|
|
34
34
|
* even when the test never looked at `exited`, while a modeled `Err` passes
|
|
35
35
|
* through, since a startup failure is an outcome a test may be asserting.
|
|
36
36
|
*/
|
|
37
|
-
declare const bootFixture: (defaults?: BootDefaults) => ({}: object, use: (boot: Boot) => Promise<void>) => Promise<void>;
|
|
37
|
+
export declare const bootFixture: (defaults?: BootDefaults) => ({}: object, use: (boot: Boot) => Promise<void>) => Promise<void>;
|
|
38
38
|
//#endregion
|
|
39
39
|
//#region src/fake-clock.d.ts
|
|
40
40
|
type FakeClock = Clock & {
|
|
@@ -63,7 +63,7 @@ type FakeClock = Clock & {
|
|
|
63
63
|
* await clock.advance(20_000); // the drain deadline
|
|
64
64
|
* ```
|
|
65
65
|
*/
|
|
66
|
-
declare const createFakeClock: (start?: number) => FakeClock;
|
|
66
|
+
export declare const createFakeClock: (start?: number) => FakeClock;
|
|
67
67
|
//#endregion
|
|
68
68
|
//#region src/overridden.d.ts
|
|
69
69
|
/** One override's error channel, unioned across the tuple by `overridden`. */
|
|
@@ -91,7 +91,7 @@ type AnyProviderFor = Provider<never, unknown, unknown>;
|
|
|
91
91
|
* root to re-export internals to be overridable. They are checked at build
|
|
92
92
|
* instead, by `plan`'s missing-provider defect.
|
|
93
93
|
*/
|
|
94
|
-
declare const overridden: <X, E, N, const O extends readonly AnyProviderFor[]>(module: Module<X, E, N>, overrides: O) => Module<X, E | ErrorsOf<O>, N>;
|
|
94
|
+
export declare const overridden: <X, E, N, const O extends readonly AnyProviderFor[]>(module: Module<X, E, N>, overrides: O) => Module<X, E | ErrorsOf<O>, N>;
|
|
95
95
|
//#endregion
|
|
96
96
|
//#region src/tapped.d.ts
|
|
97
97
|
/** The services behind `ports`, in order — what `tapped(...).services()` answers once the graph is built. */
|
|
@@ -122,7 +122,7 @@ type ServicesOf<P extends readonly AnyPort[]> = { readonly [K in keyof P]: Servi
|
|
|
122
122
|
type TapGate<P extends readonly AnyPort[], X> = [Exclude<InstanceType<P[number]>, X>] extends [never] ? unknown : {
|
|
123
123
|
readonly "NOT EXPORTED — tap only what the module exports": Exclude<InstanceType<P[number]>, X>;
|
|
124
124
|
};
|
|
125
|
-
declare const tapped: <X, E, N, const P extends readonly AnyPort[]>(module: Module<X, E, N>, ports: P & TapGate<P, X>) => {
|
|
125
|
+
export declare const tapped: <X, E, N, const P extends readonly AnyPort[]>(module: Module<X, E, N>, ports: P & TapGate<P, X>) => {
|
|
126
126
|
readonly module: Module<X, E, N>;
|
|
127
127
|
readonly services: () => ServicesOf<P>;
|
|
128
128
|
};
|
|
@@ -141,7 +141,7 @@ type TestRuntimeInfo = {
|
|
|
141
141
|
readonly name: string;
|
|
142
142
|
};
|
|
143
143
|
/** The in-memory runtime's port: what `TestRuntime.module` provides, and what a test composition exports. */
|
|
144
|
-
declare class TestRuntimePort extends RuntimePort<Runtime<never, TestRuntimeInfo>> {}
|
|
144
|
+
export declare class TestRuntimePort extends RuntimePort<Runtime<never, TestRuntimeInfo>> {}
|
|
145
145
|
/**
|
|
146
146
|
* A module `options.unit` may bind, as the upper bound `testRuntime`
|
|
147
147
|
* constrains its own `Unit` type parameter to. `Module`'s `_exports` channel is
|
|
@@ -191,6 +191,6 @@ type TestRuntime<Unit extends AnyUnitModule | undefined = undefined> = Runtime<n
|
|
|
191
191
|
/** The `RuntimeHost` the kernel last called `start` with. **Throws** if the runtime was never started — the same misuse guard as `serving()`. */
|
|
192
192
|
readonly host: () => RuntimeHost<never>;
|
|
193
193
|
};
|
|
194
|
-
declare const testRuntime: <Unit extends AnyUnitModule | undefined = undefined>(name?: string, options?: TestRuntimeOptions<Unit>) => TestRuntime<Unit>;
|
|
194
|
+
export declare const testRuntime: <Unit extends AnyUnitModule | undefined = undefined>(name?: string, options?: TestRuntimeOptions<Unit>) => TestRuntime<Unit>;
|
|
195
195
|
//#endregion
|
|
196
|
-
export {
|
|
196
|
+
export type { Boot, BootDefaults, FakeClock, ServicesOf, SubmittedUnit, TestRuntime, TestRuntimeInfo, TestRuntimeOptions };
|
package/dist/jwt.d.cts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { AsyncResult } from "unthrown";
|
|
2
2
|
import { JWK, JWTPayload } from "jose";
|
|
3
3
|
//#region src/jwt.d.ts
|
|
4
|
-
type LocalIssuerOptions = {
|
|
4
|
+
export type LocalIssuerOptions = {
|
|
5
5
|
readonly issuer: string;
|
|
6
6
|
readonly audience: string;
|
|
7
7
|
/** Asymmetric only, the same list `jwtAuthenticator` accepts; default `"RS256"`. */
|
|
8
8
|
readonly algorithm?: "RS256" | "RS384" | "RS512" | "ES256" | "ES384";
|
|
9
9
|
};
|
|
10
|
-
type SignOptions = {
|
|
10
|
+
export type SignOptions = {
|
|
11
11
|
readonly issuer?: string;
|
|
12
12
|
readonly audience?: string;
|
|
13
13
|
/** `"5m"` by default; `false` mints a token with no `exp` at all. */
|
|
14
14
|
readonly expiresIn?: string | false;
|
|
15
15
|
};
|
|
16
|
-
type LocalIssuer = {
|
|
16
|
+
export type LocalIssuer = {
|
|
17
17
|
/** `http://127.0.0.1:<port>/jwks.json` — served on ANY path, so a caller need not match it exactly. */
|
|
18
18
|
readonly jwks: string;
|
|
19
19
|
/** The public key as served, with `kid`/`alg`/`use` already set. */
|
|
@@ -31,6 +31,5 @@ type LocalIssuer = {
|
|
|
31
31
|
* listener answering the JWKS on any path, and `sign` closing over the
|
|
32
32
|
* private key. `close()` stops the listener; nothing else needs tearing down.
|
|
33
33
|
*/
|
|
34
|
-
declare const localIssuer: (options: LocalIssuerOptions) => AsyncResult<LocalIssuer, never>;
|
|
35
|
-
//#endregion
|
|
36
|
-
export { LocalIssuer, LocalIssuerOptions, SignOptions, localIssuer };
|
|
34
|
+
export declare const localIssuer: (options: LocalIssuerOptions) => AsyncResult<LocalIssuer, never>;
|
|
35
|
+
//#endregion
|
package/dist/jwt.d.mts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { AsyncResult } from "unthrown";
|
|
2
2
|
import { JWK, JWTPayload } from "jose";
|
|
3
3
|
//#region src/jwt.d.ts
|
|
4
|
-
type LocalIssuerOptions = {
|
|
4
|
+
export type LocalIssuerOptions = {
|
|
5
5
|
readonly issuer: string;
|
|
6
6
|
readonly audience: string;
|
|
7
7
|
/** Asymmetric only, the same list `jwtAuthenticator` accepts; default `"RS256"`. */
|
|
8
8
|
readonly algorithm?: "RS256" | "RS384" | "RS512" | "ES256" | "ES384";
|
|
9
9
|
};
|
|
10
|
-
type SignOptions = {
|
|
10
|
+
export type SignOptions = {
|
|
11
11
|
readonly issuer?: string;
|
|
12
12
|
readonly audience?: string;
|
|
13
13
|
/** `"5m"` by default; `false` mints a token with no `exp` at all. */
|
|
14
14
|
readonly expiresIn?: string | false;
|
|
15
15
|
};
|
|
16
|
-
type LocalIssuer = {
|
|
16
|
+
export type LocalIssuer = {
|
|
17
17
|
/** `http://127.0.0.1:<port>/jwks.json` — served on ANY path, so a caller need not match it exactly. */
|
|
18
18
|
readonly jwks: string;
|
|
19
19
|
/** The public key as served, with `kid`/`alg`/`use` already set. */
|
|
@@ -31,6 +31,5 @@ type LocalIssuer = {
|
|
|
31
31
|
* listener answering the JWKS on any path, and `sign` closing over the
|
|
32
32
|
* private key. `close()` stops the listener; nothing else needs tearing down.
|
|
33
33
|
*/
|
|
34
|
-
declare const localIssuer: (options: LocalIssuerOptions) => AsyncResult<LocalIssuer, never>;
|
|
35
|
-
//#endregion
|
|
36
|
-
export { LocalIssuer, LocalIssuerOptions, SignOptions, localIssuer };
|
|
34
|
+
export declare const localIssuer: (options: LocalIssuerOptions) => AsyncResult<LocalIssuer, never>;
|
|
35
|
+
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@btravstack/testing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Test the applications @btravstack/core boots: an in-memory runtime, a fake clock, a boot fixture that stops what it started, and a tap into a running graph",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dependency-injection",
|
|
@@ -55,24 +55,24 @@
|
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@btravstack/tsconfig": "0.4.0",
|
|
58
|
-
"@types/node": "26.4.
|
|
59
|
-
"@unthrown/vitest": "5.
|
|
58
|
+
"@types/node": "26.4.1",
|
|
59
|
+
"@unthrown/vitest": "5.8.0",
|
|
60
60
|
"@vitest/coverage-v8": "4.1.11",
|
|
61
|
-
"jose": "6.2.
|
|
62
|
-
"tsdown": "0.
|
|
61
|
+
"jose": "6.2.12",
|
|
62
|
+
"tsdown": "0.23.0",
|
|
63
63
|
"typescript": "7.0.2",
|
|
64
|
-
"unthrown": "5.
|
|
64
|
+
"unthrown": "5.8.0",
|
|
65
65
|
"vitest": "4.1.11",
|
|
66
|
-
"@btravstack/config": "0.
|
|
67
|
-
"@btravstack/core": "0.
|
|
68
|
-
"@btravstack/di": "0.
|
|
66
|
+
"@btravstack/config": "0.14.0",
|
|
67
|
+
"@btravstack/core": "0.14.0",
|
|
68
|
+
"@btravstack/di": "0.14.0"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"jose": "^6",
|
|
72
72
|
"unthrown": "^5.0.0",
|
|
73
|
-
"@btravstack/config": "^0.
|
|
74
|
-
"@btravstack/core": "^0.
|
|
75
|
-
"@btravstack/di": "^0.
|
|
73
|
+
"@btravstack/config": "^0.14.0",
|
|
74
|
+
"@btravstack/core": "^0.14.0",
|
|
75
|
+
"@btravstack/di": "^0.14.0"
|
|
76
76
|
},
|
|
77
77
|
"peerDependenciesMeta": {
|
|
78
78
|
"jose": {
|