@yolk-sdk/conformance 0.1.0-canary.122 → 0.1.0-canary.124
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/README.md +3 -1
- package/dist/case.d.mts +28 -24
- package/dist/case.d.mts.map +1 -1
- package/dist/case.mjs +1 -2
- package/dist/case.mjs.map +1 -1
- package/dist/fixture.d.mts +108 -103
- package/dist/fixture.d.mts.map +1 -1
- package/dist/fixture.mjs +2 -3
- package/dist/fixture.mjs.map +1 -1
- package/dist/record.d.mts +18 -20
- package/dist/record.d.mts.map +1 -1
- package/dist/record.mjs +4 -4
- package/dist/record.mjs.map +1 -1
- package/dist/replay.d.mts +55 -193
- package/dist/replay.d.mts.map +1 -1
- package/dist/replay.mjs +2 -3
- package/dist/replay.mjs.map +1 -1
- package/dist/runner.d.mts +48 -33
- package/dist/runner.d.mts.map +1 -1
- package/dist/runner.mjs +3 -4
- package/dist/runner.mjs.map +1 -1
- package/dist/wire-internal.d.mts +20 -24
- package/dist/wire-internal.d.mts.map +1 -1
- package/dist/wire-internal.mjs +3 -4
- package/dist/wire-internal.mjs.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -14,9 +14,11 @@ Canary APIs are unstable. Keep all `@yolk-sdk/*` packages on the same version.
|
|
|
14
14
|
## Install
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
-
pnpm add -D @yolk-sdk/conformance@canary effect@4.
|
|
17
|
+
pnpm add -D @yolk-sdk/conformance@canary effect@4.1.2
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
+
Use the SDK's matching Effect version (`4.1.2`) in host code.
|
|
21
|
+
|
|
20
22
|
## Subpaths
|
|
21
23
|
|
|
22
24
|
There is no root export. Import an explicit subpath:
|
package/dist/case.d.mts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import * as Schema from "effect/Schema";
|
|
3
|
-
|
|
4
|
-
//#region src/case.d.ts
|
|
5
3
|
/**
|
|
6
4
|
* What a case does to the account it runs against:
|
|
7
5
|
*
|
|
@@ -12,41 +10,48 @@ import * as Schema from "effect/Schema";
|
|
|
12
10
|
* - `write-irreversible`: a write that cannot be undone (for example sending
|
|
13
11
|
* an email). Never automated against a live account.
|
|
14
12
|
*/
|
|
15
|
-
declare const ConformanceSafety: Schema.Literals<readonly ["read", "write-reversible", "write-irreversible"]>;
|
|
16
|
-
type ConformanceSafety = typeof ConformanceSafety.Type;
|
|
13
|
+
export declare const ConformanceSafety: Schema.Literals<readonly ["read", "write-reversible", "write-irreversible"]>;
|
|
14
|
+
export type ConformanceSafety = typeof ConformanceSafety.Type;
|
|
17
15
|
/**
|
|
18
16
|
* Dotted lower-case case id: two or more segments of `a-z`, `0-9`, and inner
|
|
19
17
|
* hyphens, for example `vendor.stream.plain-text`.
|
|
20
18
|
*/
|
|
21
|
-
declare const ConformanceCaseId: Schema.String;
|
|
19
|
+
export declare const ConformanceCaseId: Schema.String;
|
|
22
20
|
/** When and where a person last watched the claim hold against the real service. */
|
|
23
|
-
declare const ConformanceObservation: Schema.Struct<{
|
|
24
|
-
/** Synthetic account label, for example `synthetic`; never a real account name. */
|
|
21
|
+
export declare const ConformanceObservation: Schema.Struct<{
|
|
22
|
+
/** Synthetic account label, for example `synthetic`; never a real account name. */
|
|
23
|
+
readonly account: Schema.NonEmptyString;
|
|
24
|
+
/** Calendar date of the observation (`YYYY-MM-DD`, UTC). */
|
|
25
25
|
readonly date: Schema.String;
|
|
26
26
|
}>;
|
|
27
|
-
type ConformanceObservation = typeof ConformanceObservation.Type;
|
|
27
|
+
export type ConformanceObservation = typeof ConformanceObservation.Type;
|
|
28
28
|
/**
|
|
29
29
|
* One wire claim. `run` succeeds when the claim holds and fails (with a
|
|
30
30
|
* `ConformanceMismatch`, its own error, or a port's error) when it does not.
|
|
31
31
|
*/
|
|
32
|
-
type ConformanceCase<E = never, R = never> = {
|
|
33
|
-
/** Dotted lower-case id (see `ConformanceCaseId`). */
|
|
32
|
+
export type ConformanceCase<E = never, R = never> = {
|
|
33
|
+
/** Dotted lower-case id (see `ConformanceCaseId`). */
|
|
34
|
+
readonly id: string;
|
|
34
35
|
readonly title?: string;
|
|
35
|
-
readonly safety: ConformanceSafety;
|
|
36
|
-
|
|
37
|
-
readonly
|
|
38
|
-
|
|
36
|
+
readonly safety: ConformanceSafety;
|
|
37
|
+
/** What the service's documentation claims. */
|
|
38
|
+
readonly docs: string;
|
|
39
|
+
/** What the wire actually does (the claim this case proves). */
|
|
40
|
+
readonly wire: string;
|
|
41
|
+
/** Last live observation. Absent means the claim is unverified against the real service. */
|
|
42
|
+
readonly observed?: ConformanceObservation;
|
|
43
|
+
/** Ids of the fixtures (`WireFixture`s or `PortFixture`s) that back replay of this case. */
|
|
39
44
|
readonly fixtures: ReadonlyArray<string>;
|
|
40
45
|
readonly run: Effect.Effect<void, E, R>;
|
|
41
46
|
};
|
|
42
|
-
declare const ConformanceCaseInvalid_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
|
|
47
|
+
declare const ConformanceCaseInvalid_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
43
48
|
readonly _tag: "ConformanceCaseInvalid";
|
|
44
49
|
} & Readonly<A>;
|
|
45
50
|
/**
|
|
46
51
|
* Thrown by `defineConformanceCase` for an invalid definition. A programmer
|
|
47
52
|
* error, surfaced when the defining module loads (like `makeTool`).
|
|
48
53
|
*/
|
|
49
|
-
declare class ConformanceCaseInvalid extends ConformanceCaseInvalid_base<{
|
|
54
|
+
export declare class ConformanceCaseInvalid extends ConformanceCaseInvalid_base<{
|
|
50
55
|
readonly caseId: string;
|
|
51
56
|
readonly reason: string;
|
|
52
57
|
}> {
|
|
@@ -59,31 +64,30 @@ declare class ConformanceCaseInvalid extends ConformanceCaseInvalid_base<{
|
|
|
59
64
|
* module-level constants, so a bad one fails fast when the module loads
|
|
60
65
|
* instead of surfacing mid-run.
|
|
61
66
|
*/
|
|
62
|
-
declare const defineConformanceCase: <E = never, R = never>(spec: ConformanceCase<E, R>) => ConformanceCase<E, R>;
|
|
63
|
-
declare const ConformanceMismatch_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
|
|
67
|
+
export declare const defineConformanceCase: <E = never, R = never>(spec: ConformanceCase<E, R>) => ConformanceCase<E, R>;
|
|
68
|
+
declare const ConformanceMismatch_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
64
69
|
readonly _tag: "ConformanceMismatch";
|
|
65
70
|
} & Readonly<A>;
|
|
66
71
|
/**
|
|
67
72
|
* A wire claim did not hold. Model-free: `expected` / `actual` are optional
|
|
68
73
|
* JSON values chosen by the case author; keep them small and synthetic.
|
|
69
74
|
*/
|
|
70
|
-
declare class ConformanceMismatch extends ConformanceMismatch_base<{
|
|
75
|
+
export declare class ConformanceMismatch extends ConformanceMismatch_base<{
|
|
71
76
|
readonly message: string;
|
|
72
77
|
readonly expected?: Schema.Json;
|
|
73
78
|
readonly actual?: Schema.Json;
|
|
74
79
|
}> {}
|
|
75
|
-
type ConformanceMismatchDetails = {
|
|
80
|
+
export type ConformanceMismatchDetails = {
|
|
76
81
|
readonly expected?: Schema.Json;
|
|
77
82
|
readonly actual?: Schema.Json;
|
|
78
83
|
};
|
|
79
84
|
/** Succeed when `condition` holds; otherwise fail with a `ConformanceMismatch`. */
|
|
80
|
-
declare const expectConformance: (condition: boolean, message: string, details?: ConformanceMismatchDetails) => Effect.Effect<void, ConformanceMismatch>;
|
|
85
|
+
export declare const expectConformance: (condition: boolean, message: string, details?: ConformanceMismatchDetails) => Effect.Effect<void, ConformanceMismatch>;
|
|
81
86
|
/**
|
|
82
87
|
* Succeed when `actual` and `expected` are structurally equal JSON values
|
|
83
88
|
* (effect `Equal.equals`: same primitives, same array order, same object keys
|
|
84
89
|
* and values); otherwise fail with a `ConformanceMismatch` carrying both.
|
|
85
90
|
*/
|
|
86
|
-
declare const expectEqual: (actual: Schema.Json, expected: Schema.Json, message: string) => Effect.Effect<void, ConformanceMismatch>;
|
|
87
|
-
|
|
88
|
-
export { ConformanceCase, ConformanceCaseId, ConformanceCaseInvalid, ConformanceMismatch, ConformanceMismatchDetails, ConformanceObservation, ConformanceSafety, defineConformanceCase, expectConformance, expectEqual };
|
|
91
|
+
export declare const expectEqual: (actual: Schema.Json, expected: Schema.Json, message: string) => Effect.Effect<void, ConformanceMismatch>;
|
|
92
|
+
export {};
|
|
89
93
|
//# sourceMappingURL=case.d.mts.map
|
package/dist/case.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"case.d.mts","names":[],"sources":["../src/case.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"case.d.mts","names":[],"sources":["../src/case.ts"],"mappings":";;;;;;;;;;;;qBAwBa,mBAAiB,OAAA;YAElB,2BAA2B,kBAAkB;;;;;qBAM5C,mBAAiB,OAAA;;qBAOjB,wBAAsB,OAAA;;;;;;YAOvB,gCAAgC,uBAAuB;;;;;YAMvD,gBAAgB,WAAW;;WAE5B;WACA;WACA,QAAQ;;WAER;;WAEA;;WAEA,WAAW;;WAEX,UAAU;WACV,KAAK,OAAO,aAAa,GAAG;;;;;;;;;qBAmB1B,+BAA+B;WACjC;WACA;;MAEI;;;;;;;;;qBAYF,wBAAyB,WAAW,WAAS,MAClD,gBAAgB,GAAG,OACxB,gBAAgB,GAAG;;;;;;;;qBAkBT,4BAA4B;WAC9B;WACA,WAAW,OAAO;WAClB,SAAS,OAAO;;YAGf;WACD,WAAW,OAAO;WAClB,SAAS,OAAO;;;qBAOd,oBAAiB,oBACV,iBACH,UACL,+BACT,OAAO,aAAa;;;;;;qBAQV,cAAW,QACd,OAAO,MAAI,UACT,OAAO,MAAI,oBAEpB,OAAO,aAAa"}
|
package/dist/case.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Data, Effect, Equal, Result } from "effect";
|
|
2
2
|
import * as Schema from "effect/Schema";
|
|
3
|
-
|
|
3
|
+
// src/case.ts
|
|
4
4
|
/**
|
|
5
5
|
* Conformance cases: small, named, pure Effect programs that each prove one
|
|
6
6
|
* claim about how an outside service really behaves on the wire.
|
|
@@ -95,7 +95,6 @@ const expectEqual = (actual, expected, message) => expectConformance(Equal.equal
|
|
|
95
95
|
expected,
|
|
96
96
|
actual
|
|
97
97
|
});
|
|
98
|
-
//#endregion
|
|
99
98
|
export { ConformanceCaseId, ConformanceCaseInvalid, ConformanceMismatch, ConformanceObservation, ConformanceSafety, defineConformanceCase, expectConformance, expectEqual };
|
|
100
99
|
|
|
101
100
|
//# sourceMappingURL=case.mjs.map
|
package/dist/case.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"case.mjs","names":[],"sources":["../src/case.ts"],"sourcesContent":["/**\n * Conformance cases: small, named, pure Effect programs that each prove one\n * claim about how an outside service really behaves on the wire.\n *\n * A case only states what it needs (its `R`); the same case runs unchanged\n * against replayed fixtures, an in-process emulator, a local emulator\n * process, or a real practice account. Only the layers a host provides\n * change. See `@yolk-sdk/conformance/runner` for the safety policy.\n *\n * @experimental\n */\nimport { Data, Effect, Equal, Result } from 'effect'\nimport * as Schema from 'effect/Schema'\n\n/**\n * What a case does to the account it runs against:\n *\n * - `read`: only reads.\n * - `write-reversible`: writes but leaves the account as it found it (it\n * creates its own records and cleans them up, or the write is rejected and\n * changes nothing).\n * - `write-irreversible`: a write that cannot be undone (for example sending\n * an email). Never automated against a live account.\n */\nexport const ConformanceSafety = Schema.Literals(['read', 'write-reversible', 'write-irreversible'])\n\nexport type ConformanceSafety = typeof ConformanceSafety.Type\n\n/**\n * Dotted lower-case case id: two or more segments of `a-z`, `0-9`, and inner\n * hyphens, for example `vendor.stream.plain-text`.\n */\nexport const ConformanceCaseId = Schema.String.check(\n Schema.isPattern(/^[a-z0-9]+(?:-[a-z0-9]+)*(?:\\.[a-z0-9]+(?:-[a-z0-9]+)*)+$/u)\n)\n\nconst CalendarDate = Schema.String.check(Schema.isPattern(/^\\d{4}-\\d{2}-\\d{2}$/u))\n\n/** When and where a person last watched the claim hold against the real service. */\nexport const ConformanceObservation = Schema.Struct({\n /** Synthetic account label, for example `synthetic`; never a real account name. */\n account: Schema.NonEmptyString,\n /** Calendar date of the observation (`YYYY-MM-DD`, UTC). */\n date: CalendarDate\n})\n\nexport type ConformanceObservation = typeof ConformanceObservation.Type\n\n/**\n * One wire claim. `run` succeeds when the claim holds and fails (with a\n * `ConformanceMismatch`, its own error, or a port's error) when it does not.\n */\nexport type ConformanceCase<E = never, R = never> = {\n /** Dotted lower-case id (see `ConformanceCaseId`). */\n readonly id: string\n readonly title?: string\n readonly safety: ConformanceSafety\n /** What the service's documentation claims. */\n readonly docs: string\n /** What the wire actually does (the claim this case proves). */\n readonly wire: string\n /** Last live observation. Absent means the claim is unverified against the real service. */\n readonly observed?: ConformanceObservation\n /** Ids of the fixtures (`WireFixture`s or `PortFixture`s) that back replay of this case. */\n readonly fixtures: ReadonlyArray<string>\n readonly run: Effect.Effect<void, E, R>\n}\n\nconst ConformanceCaseMetadata = Schema.Struct({\n id: ConformanceCaseId,\n title: Schema.optionalKey(Schema.NonEmptyString),\n safety: ConformanceSafety,\n docs: Schema.NonEmptyString,\n wire: Schema.NonEmptyString,\n observed: Schema.optionalKey(ConformanceObservation),\n fixtures: Schema.Array(Schema.NonEmptyString)\n})\n\nconst validateMetadata = Schema.decodeUnknownResult(ConformanceCaseMetadata)\n\n/**\n * Thrown by `defineConformanceCase` for an invalid definition. A programmer\n * error, surfaced when the defining module loads (like `makeTool`).\n */\nexport class ConformanceCaseInvalid extends Data.TaggedError('ConformanceCaseInvalid')<{\n readonly caseId: string\n readonly reason: string\n}> {\n override get message(): string {\n return `Invalid conformance case ${JSON.stringify(this.caseId)}: ${this.reason}`\n }\n}\n\n/**\n * Define a conformance case. The metadata (id format, safety, non-empty\n * `docs`/`wire`, observation date, fixture ids) is validated here and an\n * invalid definition throws `ConformanceCaseInvalid`: definitions are\n * module-level constants, so a bad one fails fast when the module loads\n * instead of surfacing mid-run.\n */\nexport const defineConformanceCase = <E = never, R = never>(\n spec: ConformanceCase<E, R>\n): ConformanceCase<E, R> => {\n const { run: _run, ...metadata } = spec\n const result = validateMetadata(metadata)\n\n if (Result.isFailure(result)) {\n throw new ConformanceCaseInvalid({\n caseId: spec.id,\n reason: new Schema.SchemaError(result.failure.issue).message\n })\n }\n\n return spec\n}\n\n/**\n * A wire claim did not hold. Model-free: `expected` / `actual` are optional\n * JSON values chosen by the case author; keep them small and synthetic.\n */\nexport class ConformanceMismatch extends Data.TaggedError('ConformanceMismatch')<{\n readonly message: string\n readonly expected?: Schema.Json\n readonly actual?: Schema.Json\n}> {}\n\nexport type ConformanceMismatchDetails = {\n readonly expected?: Schema.Json\n readonly actual?: Schema.Json\n}\n\nconst mismatch = (message: string, details: ConformanceMismatchDetails = {}) =>\n new ConformanceMismatch({ message, ...details })\n\n/** Succeed when `condition` holds; otherwise fail with a `ConformanceMismatch`. */\nexport const expectConformance = (\n condition: boolean,\n message: string,\n details?: ConformanceMismatchDetails\n): Effect.Effect<void, ConformanceMismatch> =>\n condition ? Effect.void : Effect.fail(mismatch(message, details))\n\n/**\n * Succeed when `actual` and `expected` are structurally equal JSON values\n * (effect `Equal.equals`: same primitives, same array order, same object keys\n * and values); otherwise fail with a `ConformanceMismatch` carrying both.\n */\nexport const expectEqual = (\n actual: Schema.Json,\n expected: Schema.Json,\n message: string\n): Effect.Effect<void, ConformanceMismatch> =>\n expectConformance(Equal.equals(actual, expected), message, { expected, actual })\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAa,oBAAoB,OAAO,SAAS;CAAC;CAAQ;CAAoB;AAAoB,CAAC;;;;;AAQnG,MAAa,oBAAoB,OAAO,OAAO,MAC7C,OAAO,UAAU,4DAA4D,CAC/E;AAEA,MAAM,eAAe,OAAO,OAAO,MAAM,OAAO,UAAU,sBAAsB,CAAC;;AAGjF,MAAa,yBAAyB,OAAO,OAAO;;CAElD,SAAS,OAAO;;CAEhB,MAAM;AACR,CAAC;AAwBD,MAAM,0BAA0B,OAAO,OAAO;CAC5C,IAAI;CACJ,OAAO,OAAO,YAAY,OAAO,cAAc;CAC/C,QAAQ;CACR,MAAM,OAAO;CACb,MAAM,OAAO;CACb,UAAU,OAAO,YAAY,sBAAsB;CACnD,UAAU,OAAO,MAAM,OAAO,cAAc;AAC9C,CAAC;AAED,MAAM,mBAAmB,OAAO,oBAAoB,uBAAuB;;;;;AAM3E,IAAa,yBAAb,cAA4C,KAAK,YAAY,wBAAwB,
|
|
1
|
+
{"version":3,"file":"case.mjs","names":[],"sources":["../src/case.ts"],"sourcesContent":["/**\n * Conformance cases: small, named, pure Effect programs that each prove one\n * claim about how an outside service really behaves on the wire.\n *\n * A case only states what it needs (its `R`); the same case runs unchanged\n * against replayed fixtures, an in-process emulator, a local emulator\n * process, or a real practice account. Only the layers a host provides\n * change. See `@yolk-sdk/conformance/runner` for the safety policy.\n *\n * @experimental\n */\nimport { Data, Effect, Equal, Result } from 'effect'\nimport * as Schema from 'effect/Schema'\n\n/**\n * What a case does to the account it runs against:\n *\n * - `read`: only reads.\n * - `write-reversible`: writes but leaves the account as it found it (it\n * creates its own records and cleans them up, or the write is rejected and\n * changes nothing).\n * - `write-irreversible`: a write that cannot be undone (for example sending\n * an email). Never automated against a live account.\n */\nexport const ConformanceSafety = Schema.Literals(['read', 'write-reversible', 'write-irreversible'])\n\nexport type ConformanceSafety = typeof ConformanceSafety.Type\n\n/**\n * Dotted lower-case case id: two or more segments of `a-z`, `0-9`, and inner\n * hyphens, for example `vendor.stream.plain-text`.\n */\nexport const ConformanceCaseId = Schema.String.check(\n Schema.isPattern(/^[a-z0-9]+(?:-[a-z0-9]+)*(?:\\.[a-z0-9]+(?:-[a-z0-9]+)*)+$/u)\n)\n\nconst CalendarDate = Schema.String.check(Schema.isPattern(/^\\d{4}-\\d{2}-\\d{2}$/u))\n\n/** When and where a person last watched the claim hold against the real service. */\nexport const ConformanceObservation = Schema.Struct({\n /** Synthetic account label, for example `synthetic`; never a real account name. */\n account: Schema.NonEmptyString,\n /** Calendar date of the observation (`YYYY-MM-DD`, UTC). */\n date: CalendarDate\n})\n\nexport type ConformanceObservation = typeof ConformanceObservation.Type\n\n/**\n * One wire claim. `run` succeeds when the claim holds and fails (with a\n * `ConformanceMismatch`, its own error, or a port's error) when it does not.\n */\nexport type ConformanceCase<E = never, R = never> = {\n /** Dotted lower-case id (see `ConformanceCaseId`). */\n readonly id: string\n readonly title?: string\n readonly safety: ConformanceSafety\n /** What the service's documentation claims. */\n readonly docs: string\n /** What the wire actually does (the claim this case proves). */\n readonly wire: string\n /** Last live observation. Absent means the claim is unverified against the real service. */\n readonly observed?: ConformanceObservation\n /** Ids of the fixtures (`WireFixture`s or `PortFixture`s) that back replay of this case. */\n readonly fixtures: ReadonlyArray<string>\n readonly run: Effect.Effect<void, E, R>\n}\n\nconst ConformanceCaseMetadata = Schema.Struct({\n id: ConformanceCaseId,\n title: Schema.optionalKey(Schema.NonEmptyString),\n safety: ConformanceSafety,\n docs: Schema.NonEmptyString,\n wire: Schema.NonEmptyString,\n observed: Schema.optionalKey(ConformanceObservation),\n fixtures: Schema.Array(Schema.NonEmptyString)\n})\n\nconst validateMetadata = Schema.decodeUnknownResult(ConformanceCaseMetadata)\n\n/**\n * Thrown by `defineConformanceCase` for an invalid definition. A programmer\n * error, surfaced when the defining module loads (like `makeTool`).\n */\nexport class ConformanceCaseInvalid extends Data.TaggedError('ConformanceCaseInvalid')<{\n readonly caseId: string\n readonly reason: string\n}> {\n override get message(): string {\n return `Invalid conformance case ${JSON.stringify(this.caseId)}: ${this.reason}`\n }\n}\n\n/**\n * Define a conformance case. The metadata (id format, safety, non-empty\n * `docs`/`wire`, observation date, fixture ids) is validated here and an\n * invalid definition throws `ConformanceCaseInvalid`: definitions are\n * module-level constants, so a bad one fails fast when the module loads\n * instead of surfacing mid-run.\n */\nexport const defineConformanceCase = <E = never, R = never>(\n spec: ConformanceCase<E, R>\n): ConformanceCase<E, R> => {\n const { run: _run, ...metadata } = spec\n const result = validateMetadata(metadata)\n\n if (Result.isFailure(result)) {\n throw new ConformanceCaseInvalid({\n caseId: spec.id,\n reason: new Schema.SchemaError(result.failure.issue).message\n })\n }\n\n return spec\n}\n\n/**\n * A wire claim did not hold. Model-free: `expected` / `actual` are optional\n * JSON values chosen by the case author; keep them small and synthetic.\n */\nexport class ConformanceMismatch extends Data.TaggedError('ConformanceMismatch')<{\n readonly message: string\n readonly expected?: Schema.Json\n readonly actual?: Schema.Json\n}> {}\n\nexport type ConformanceMismatchDetails = {\n readonly expected?: Schema.Json\n readonly actual?: Schema.Json\n}\n\nconst mismatch = (message: string, details: ConformanceMismatchDetails = {}) =>\n new ConformanceMismatch({ message, ...details })\n\n/** Succeed when `condition` holds; otherwise fail with a `ConformanceMismatch`. */\nexport const expectConformance = (\n condition: boolean,\n message: string,\n details?: ConformanceMismatchDetails\n): Effect.Effect<void, ConformanceMismatch> =>\n condition ? Effect.void : Effect.fail(mismatch(message, details))\n\n/**\n * Succeed when `actual` and `expected` are structurally equal JSON values\n * (effect `Equal.equals`: same primitives, same array order, same object keys\n * and values); otherwise fail with a `ConformanceMismatch` carrying both.\n */\nexport const expectEqual = (\n actual: Schema.Json,\n expected: Schema.Json,\n message: string\n): Effect.Effect<void, ConformanceMismatch> =>\n expectConformance(Equal.equals(actual, expected), message, { expected, actual })\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAa,oBAAoB,OAAO,SAAS;CAAC;CAAQ;CAAoB;AAAoB,CAAC;;;;;AAQnG,MAAa,oBAAoB,OAAO,OAAO,MAC7C,OAAO,UAAU,4DAA4D,CAC/E;AAEA,MAAM,eAAe,OAAO,OAAO,MAAM,OAAO,UAAU,sBAAsB,CAAC;;AAGjF,MAAa,yBAAyB,OAAO,OAAO;;CAElD,SAAS,OAAO;;CAEhB,MAAM;AACR,CAAC;AAwBD,MAAM,0BAA0B,OAAO,OAAO;CAC5C,IAAI;CACJ,OAAO,OAAO,YAAY,OAAO,cAAc;CAC/C,QAAQ;CACR,MAAM,OAAO;CACb,MAAM,OAAO;CACb,UAAU,OAAO,YAAY,sBAAsB;CACnD,UAAU,OAAO,MAAM,OAAO,cAAc;AAC9C,CAAC;AAED,MAAM,mBAAmB,OAAO,oBAAoB,uBAAuB;;;;;AAM3E,IAAa,yBAAb,cAA4C,KAAK,YAAY,wBAAwB,CAAC,CAGnF;CACD,IAAa,UAAkB;EAC7B,OAAO,4BAA4B,KAAK,UAAU,KAAK,MAAM,EAAE,IAAI,KAAK;CAC1E;AACF;;;;;;;;AASA,MAAa,yBACX,SAC0B;CAC1B,MAAM,EAAE,KAAK,MAAM,GAAG,aAAa;CACnC,MAAM,SAAS,iBAAiB,QAAQ;CAExC,IAAI,OAAO,UAAU,MAAM,GACzB,MAAM,IAAI,uBAAuB;EAC/B,QAAQ,KAAK;EACb,QAAQ,IAAI,OAAO,YAAY,OAAO,QAAQ,KAAK,CAAC,CAAC;CACvD,CAAC;CAGH,OAAO;AACT;;;;;AAMA,IAAa,sBAAb,cAAyC,KAAK,YAAY,qBAAqB,CAAC,CAI7E,CAAC;AAOJ,MAAM,YAAY,SAAiB,UAAsC,CAAC,MACxE,IAAI,oBAAoB;CAAE;CAAS,GAAG;AAAQ,CAAC;;AAGjD,MAAa,qBACX,WACA,SACA,YAEA,YAAY,OAAO,OAAO,OAAO,KAAK,SAAS,SAAS,OAAO,CAAC;;;;;;AAOlE,MAAa,eACX,QACA,UACA,YAEA,kBAAkB,MAAM,OAAO,QAAQ,QAAQ,GAAG,SAAS;CAAE;CAAU;AAAO,CAAC"}
|
package/dist/fixture.d.mts
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
import { syntheticPortCredentialParams } from "./wire-internal.mjs";
|
|
2
2
|
import * as Schema from "effect/Schema";
|
|
3
|
-
|
|
4
|
-
//#region src/fixture.d.ts
|
|
5
3
|
/** `verified` = recorded from a live service; `unverified` = synthetic placeholder. */
|
|
6
|
-
declare const WireFixtureEvidence: Schema.Literals<readonly ["verified", "unverified"]>;
|
|
7
|
-
type WireFixtureEvidence = typeof WireFixtureEvidence.Type;
|
|
4
|
+
export declare const WireFixtureEvidence: Schema.Literals<readonly ["verified", "unverified"]>;
|
|
5
|
+
export type WireFixtureEvidence = typeof WireFixtureEvidence.Type;
|
|
8
6
|
/** Lowercase header name to value. Request headers are allowlisted and never credentials. */
|
|
9
|
-
declare const WireHeaders: Schema.$Record<Schema.String, Schema.String>;
|
|
10
|
-
type WireHeaders = typeof WireHeaders.Type;
|
|
11
|
-
declare const WireRequest: Schema.Struct<{
|
|
12
|
-
readonly method: Schema.NonEmptyString;
|
|
7
|
+
export declare const WireHeaders: Schema.$Record<Schema.String, Schema.String>;
|
|
8
|
+
export type WireHeaders = typeof WireHeaders.Type;
|
|
9
|
+
export declare const WireRequest: Schema.Struct<{
|
|
10
|
+
readonly method: Schema.NonEmptyString;
|
|
11
|
+
/** Absolute URL including any query string. */
|
|
13
12
|
readonly url: Schema.NonEmptyString;
|
|
14
|
-
readonly headers: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
13
|
+
readonly headers: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
14
|
+
/** Parsed JSON request body, or the raw text when it is not JSON (for example a form body). */
|
|
15
15
|
readonly body: Schema.optionalKey<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
16
16
|
}>;
|
|
17
|
-
type WireRequest = typeof WireRequest.Type;
|
|
17
|
+
export type WireRequest = typeof WireRequest.Type;
|
|
18
18
|
/**
|
|
19
19
|
* One recorded network chunk. A chunk that is valid UTF-8 on its own is stored
|
|
20
20
|
* as readable text (empty chunks as `""`); any other chunk is stored as
|
|
21
21
|
* `{ base64 }` holding its exact bytes. Replay emits exactly these bytes.
|
|
22
22
|
*/
|
|
23
|
-
declare const WireChunk: Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
23
|
+
export declare const WireChunk: Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
24
24
|
readonly base64: Schema.String;
|
|
25
25
|
}>]>;
|
|
26
|
-
type WireChunk = typeof WireChunk.Type;
|
|
26
|
+
export type WireChunk = typeof WireChunk.Type;
|
|
27
27
|
/** A response whose whole body is valid UTF-8, stored as one string. */
|
|
28
|
-
declare const WireTextBodyResponse: Schema.Struct<{
|
|
28
|
+
export declare const WireTextBodyResponse: Schema.Struct<{
|
|
29
29
|
readonly status: Schema.Int;
|
|
30
30
|
readonly headers: Schema.$Record<Schema.String, Schema.String>;
|
|
31
31
|
readonly body: Schema.String;
|
|
32
32
|
readonly bodyBase64: Schema.optionalKey<Schema.Never>;
|
|
33
33
|
readonly chunks: Schema.optionalKey<Schema.Never>;
|
|
34
34
|
}>;
|
|
35
|
-
type WireTextBodyResponse = typeof WireTextBodyResponse.Type;
|
|
35
|
+
export type WireTextBodyResponse = typeof WireTextBodyResponse.Type;
|
|
36
36
|
/** A response whose whole body is not valid UTF-8 (for example a PDF), stored as base64 bytes. */
|
|
37
|
-
declare const WireBase64BodyResponse: Schema.Struct<{
|
|
37
|
+
export declare const WireBase64BodyResponse: Schema.Struct<{
|
|
38
38
|
readonly status: Schema.Int;
|
|
39
39
|
readonly headers: Schema.$Record<Schema.String, Schema.String>;
|
|
40
40
|
readonly bodyBase64: Schema.String;
|
|
41
41
|
readonly body: Schema.optionalKey<Schema.Never>;
|
|
42
42
|
readonly chunks: Schema.optionalKey<Schema.Never>;
|
|
43
43
|
}>;
|
|
44
|
-
type WireBase64BodyResponse = typeof WireBase64BodyResponse.Type;
|
|
44
|
+
export type WireBase64BodyResponse = typeof WireBase64BodyResponse.Type;
|
|
45
45
|
/** A response recorded as one whole body: exactly one of `body` or `bodyBase64`. */
|
|
46
|
-
declare const WireBodyResponse: Schema.Union<readonly [Schema.Struct<{
|
|
46
|
+
export declare const WireBodyResponse: Schema.Union<readonly [Schema.Struct<{
|
|
47
47
|
readonly status: Schema.Int;
|
|
48
48
|
readonly headers: Schema.$Record<Schema.String, Schema.String>;
|
|
49
49
|
readonly body: Schema.String;
|
|
@@ -56,13 +56,13 @@ declare const WireBodyResponse: Schema.Union<readonly [Schema.Struct<{
|
|
|
56
56
|
readonly body: Schema.optionalKey<Schema.Never>;
|
|
57
57
|
readonly chunks: Schema.optionalKey<Schema.Never>;
|
|
58
58
|
}>]>;
|
|
59
|
-
type WireBodyResponse = typeof WireBodyResponse.Type;
|
|
59
|
+
export type WireBodyResponse = typeof WireBodyResponse.Type;
|
|
60
60
|
/**
|
|
61
61
|
* A streamed response (for example `text/event-stream`). Each entry is one
|
|
62
62
|
* network chunk (see `WireChunk`); chunk boundaries and bytes are preserved on
|
|
63
63
|
* replay.
|
|
64
64
|
*/
|
|
65
|
-
declare const WireStreamResponse: Schema.Struct<{
|
|
65
|
+
export declare const WireStreamResponse: Schema.Struct<{
|
|
66
66
|
readonly status: Schema.Int;
|
|
67
67
|
readonly headers: Schema.$Record<Schema.String, Schema.String>;
|
|
68
68
|
readonly chunks: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
@@ -71,8 +71,8 @@ declare const WireStreamResponse: Schema.Struct<{
|
|
|
71
71
|
readonly body: Schema.optionalKey<Schema.Never>;
|
|
72
72
|
readonly bodyBase64: Schema.optionalKey<Schema.Never>;
|
|
73
73
|
}>;
|
|
74
|
-
type WireStreamResponse = typeof WireStreamResponse.Type;
|
|
75
|
-
declare const WireResponse: Schema.Union<readonly [Schema.Struct<{
|
|
74
|
+
export type WireStreamResponse = typeof WireStreamResponse.Type;
|
|
75
|
+
export declare const WireResponse: Schema.Union<readonly [Schema.Struct<{
|
|
76
76
|
readonly status: Schema.Int;
|
|
77
77
|
readonly headers: Schema.$Record<Schema.String, Schema.String>;
|
|
78
78
|
readonly body: Schema.String;
|
|
@@ -93,12 +93,14 @@ declare const WireResponse: Schema.Union<readonly [Schema.Struct<{
|
|
|
93
93
|
readonly body: Schema.optionalKey<Schema.Never>;
|
|
94
94
|
readonly bodyBase64: Schema.optionalKey<Schema.Never>;
|
|
95
95
|
}>]>;
|
|
96
|
-
type WireResponse = typeof WireResponse.Type;
|
|
97
|
-
declare const WireExchange: Schema.Struct<{
|
|
96
|
+
export type WireResponse = typeof WireResponse.Type;
|
|
97
|
+
export declare const WireExchange: Schema.Struct<{
|
|
98
98
|
readonly request: Schema.Struct<{
|
|
99
|
-
readonly method: Schema.NonEmptyString;
|
|
99
|
+
readonly method: Schema.NonEmptyString;
|
|
100
|
+
/** Absolute URL including any query string. */
|
|
100
101
|
readonly url: Schema.NonEmptyString;
|
|
101
|
-
readonly headers: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
102
|
+
readonly headers: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
103
|
+
/** Parsed JSON request body, or the raw text when it is not JSON (for example a form body). */
|
|
102
104
|
readonly body: Schema.optionalKey<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
103
105
|
}>;
|
|
104
106
|
readonly response: Schema.Union<readonly [Schema.Struct<{
|
|
@@ -123,21 +125,25 @@ declare const WireExchange: Schema.Struct<{
|
|
|
123
125
|
readonly bodyBase64: Schema.optionalKey<Schema.Never>;
|
|
124
126
|
}>]>;
|
|
125
127
|
}>;
|
|
126
|
-
type WireExchange = typeof WireExchange.Type;
|
|
127
|
-
declare const WireFixture: Schema.Struct<{
|
|
128
|
+
export type WireExchange = typeof WireExchange.Type;
|
|
129
|
+
export declare const WireFixture: Schema.Struct<{
|
|
128
130
|
readonly id: Schema.NonEmptyString;
|
|
129
131
|
readonly caseId: Schema.NonEmptyString;
|
|
130
|
-
readonly evidence: Schema.Literals<readonly ["verified", "unverified"]>;
|
|
131
|
-
|
|
132
|
+
readonly evidence: Schema.Literals<readonly ["verified", "unverified"]>;
|
|
133
|
+
/** Calendar date of the recording (`YYYY-MM-DD`, UTC). */
|
|
134
|
+
readonly recordedAt: Schema.String;
|
|
135
|
+
/** Synthetic account label, for example `synthetic`; never a real account name. */
|
|
132
136
|
readonly account: Schema.NonEmptyString;
|
|
133
137
|
readonly endpoint: Schema.NonEmptyString;
|
|
134
138
|
readonly model: Schema.optionalKey<Schema.String>;
|
|
135
139
|
readonly note: Schema.optionalKey<Schema.String>;
|
|
136
140
|
readonly exchanges: Schema.NonEmptyArray<Schema.Struct<{
|
|
137
141
|
readonly request: Schema.Struct<{
|
|
138
|
-
readonly method: Schema.NonEmptyString;
|
|
142
|
+
readonly method: Schema.NonEmptyString;
|
|
143
|
+
/** Absolute URL including any query string. */
|
|
139
144
|
readonly url: Schema.NonEmptyString;
|
|
140
|
-
readonly headers: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
145
|
+
readonly headers: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
146
|
+
/** Parsed JSON request body, or the raw text when it is not JSON (for example a form body). */
|
|
141
147
|
readonly body: Schema.optionalKey<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
142
148
|
}>;
|
|
143
149
|
readonly response: Schema.Union<readonly [Schema.Struct<{
|
|
@@ -163,10 +169,17 @@ declare const WireFixture: Schema.Struct<{
|
|
|
163
169
|
}>]>;
|
|
164
170
|
}>>;
|
|
165
171
|
}>;
|
|
166
|
-
type WireFixture = typeof WireFixture.Type;
|
|
172
|
+
export type WireFixture = typeof WireFixture.Type;
|
|
167
173
|
/** Decode unknown input (for example a JSON file) into a `WireFixture`. */
|
|
168
|
-
declare const decodeWireFixture: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<{
|
|
174
|
+
export declare const decodeWireFixture: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<{
|
|
175
|
+
readonly id: string;
|
|
176
|
+
readonly caseId: string;
|
|
177
|
+
readonly evidence: "unverified" | "verified";
|
|
178
|
+
readonly recordedAt: string;
|
|
169
179
|
readonly account: string;
|
|
180
|
+
readonly endpoint: string;
|
|
181
|
+
readonly model?: string | undefined;
|
|
182
|
+
readonly note?: string | undefined;
|
|
170
183
|
readonly exchanges: readonly [{
|
|
171
184
|
readonly request: {
|
|
172
185
|
readonly method: string;
|
|
@@ -177,26 +190,26 @@ declare const decodeWireFixture: (input: unknown, options?: import("effect/Schem
|
|
|
177
190
|
readonly body?: Schema.Json | undefined;
|
|
178
191
|
};
|
|
179
192
|
readonly response: {
|
|
193
|
+
readonly status: number;
|
|
180
194
|
readonly headers: {
|
|
181
195
|
readonly [x: string]: string;
|
|
182
196
|
};
|
|
183
197
|
readonly body: string;
|
|
184
|
-
readonly status: number;
|
|
185
198
|
readonly bodyBase64?: undefined;
|
|
186
199
|
readonly chunks?: undefined;
|
|
187
200
|
} | {
|
|
201
|
+
readonly status: number;
|
|
188
202
|
readonly headers: {
|
|
189
203
|
readonly [x: string]: string;
|
|
190
204
|
};
|
|
191
|
-
readonly status: number;
|
|
192
205
|
readonly bodyBase64: string;
|
|
193
206
|
readonly body?: undefined;
|
|
194
207
|
readonly chunks?: undefined;
|
|
195
208
|
} | {
|
|
209
|
+
readonly status: number;
|
|
196
210
|
readonly headers: {
|
|
197
211
|
readonly [x: string]: string;
|
|
198
212
|
};
|
|
199
|
-
readonly status: number;
|
|
200
213
|
readonly chunks: readonly (string | {
|
|
201
214
|
readonly base64: string;
|
|
202
215
|
})[];
|
|
@@ -213,26 +226,26 @@ declare const decodeWireFixture: (input: unknown, options?: import("effect/Schem
|
|
|
213
226
|
readonly body?: Schema.Json | undefined;
|
|
214
227
|
};
|
|
215
228
|
readonly response: {
|
|
229
|
+
readonly status: number;
|
|
216
230
|
readonly headers: {
|
|
217
231
|
readonly [x: string]: string;
|
|
218
232
|
};
|
|
219
233
|
readonly body: string;
|
|
220
|
-
readonly status: number;
|
|
221
234
|
readonly bodyBase64?: undefined;
|
|
222
235
|
readonly chunks?: undefined;
|
|
223
236
|
} | {
|
|
237
|
+
readonly status: number;
|
|
224
238
|
readonly headers: {
|
|
225
239
|
readonly [x: string]: string;
|
|
226
240
|
};
|
|
227
|
-
readonly status: number;
|
|
228
241
|
readonly bodyBase64: string;
|
|
229
242
|
readonly body?: undefined;
|
|
230
243
|
readonly chunks?: undefined;
|
|
231
244
|
} | {
|
|
245
|
+
readonly status: number;
|
|
232
246
|
readonly headers: {
|
|
233
247
|
readonly [x: string]: string;
|
|
234
248
|
};
|
|
235
|
-
readonly status: number;
|
|
236
249
|
readonly chunks: readonly (string | {
|
|
237
250
|
readonly base64: string;
|
|
238
251
|
})[];
|
|
@@ -240,29 +253,22 @@ declare const decodeWireFixture: (input: unknown, options?: import("effect/Schem
|
|
|
240
253
|
readonly bodyBase64?: undefined;
|
|
241
254
|
};
|
|
242
255
|
}[]];
|
|
243
|
-
readonly id: string;
|
|
244
|
-
readonly caseId: string;
|
|
245
|
-
readonly evidence: "verified" | "unverified";
|
|
246
|
-
readonly recordedAt: string;
|
|
247
|
-
readonly endpoint: string;
|
|
248
|
-
readonly model?: string | undefined;
|
|
249
|
-
readonly note?: string | undefined;
|
|
250
256
|
}, Schema.SchemaError, never>;
|
|
251
|
-
declare const isWireStreamResponse: (response: WireResponse) => response is WireStreamResponse;
|
|
252
|
-
declare const isWireBase64BodyResponse: (response: WireResponse) => response is WireBase64BodyResponse;
|
|
257
|
+
export declare const isWireStreamResponse: (response: WireResponse) => response is WireStreamResponse;
|
|
258
|
+
export declare const isWireBase64BodyResponse: (response: WireResponse) => response is WireBase64BodyResponse;
|
|
253
259
|
/**
|
|
254
260
|
* Whole days between `recordedAt` (UTC midnight) and `now`. `NaN` when
|
|
255
261
|
* `recordedAt` is not a `YYYY-MM-DD` date.
|
|
256
262
|
*/
|
|
257
|
-
declare const fixtureAgeDays: (fixture: Pick<WireFixture,
|
|
263
|
+
export declare const fixtureAgeDays: (fixture: Pick<WireFixture, 'recordedAt'>, now: Date) => number;
|
|
258
264
|
/**
|
|
259
265
|
* True when the fixture is older than `maxAgeDays` (default 30). Fixtures with
|
|
260
266
|
* an unreadable `recordedAt` are treated as stale.
|
|
261
267
|
*/
|
|
262
|
-
declare const isFixtureStale: (fixture: Pick<WireFixture,
|
|
263
|
-
type FixtureSecretIssueKind = 'credential_header' | 'bearer_token' | 'api_key' | 'credential_query_param' | 'credential_field';
|
|
268
|
+
export declare const isFixtureStale: (fixture: Pick<WireFixture, 'recordedAt'>, now: Date, maxAgeDays?: number) => boolean;
|
|
269
|
+
export type FixtureSecretIssueKind = 'credential_header' | 'bearer_token' | 'api_key' | 'credential_query_param' | 'credential_field';
|
|
264
270
|
/** A secret-scan finding. `location` is a path into the fixture; the secret itself is never echoed. */
|
|
265
|
-
type FixtureSecretIssue = {
|
|
271
|
+
export type FixtureSecretIssue = {
|
|
266
272
|
readonly kind: FixtureSecretIssueKind;
|
|
267
273
|
readonly location: string;
|
|
268
274
|
};
|
|
@@ -275,23 +281,21 @@ type FixtureSecretIssue = {
|
|
|
275
281
|
* found). JSON bodies and SSE `data:` payloads get the credential-field scan.
|
|
276
282
|
* Issues name locations only. Returns an empty array when clean.
|
|
277
283
|
*/
|
|
278
|
-
declare const scanFixtureForSecrets: (fixture: WireFixture) => ReadonlyArray<FixtureSecretIssue>;
|
|
284
|
+
export declare const scanFixtureForSecrets: (fixture: WireFixture) => ReadonlyArray<FixtureSecretIssue>;
|
|
279
285
|
/**
|
|
280
286
|
* A failure a port answered instead of a value. `expected` is the port's value-level failure (for
|
|
281
287
|
* example a connector `ActionResult.failure`); `error` is the port's typed error channel. `code`
|
|
282
288
|
* is a sanitized classification, never raw provider text.
|
|
283
289
|
*/
|
|
284
|
-
declare const PortFailure: Schema.Struct<{
|
|
290
|
+
export declare const PortFailure: Schema.Struct<{
|
|
285
291
|
readonly kind: Schema.Literals<readonly ["expected", "error"]>;
|
|
286
292
|
readonly code: Schema.NonEmptyString;
|
|
287
293
|
readonly message: Schema.String;
|
|
288
294
|
readonly status: Schema.optionalKey<Schema.Int>;
|
|
289
295
|
}>;
|
|
290
|
-
type PortFailure = typeof PortFailure.Type;
|
|
296
|
+
export type PortFailure = typeof PortFailure.Type;
|
|
291
297
|
/** A port call answered with a value (`response`, plain JSON). */
|
|
292
|
-
declare const PortValueFixture: Schema.Struct<{
|
|
293
|
-
readonly response: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
294
|
-
readonly failure: Schema.optionalKey<Schema.Never>;
|
|
298
|
+
export declare const PortValueFixture: Schema.Struct<{
|
|
295
299
|
readonly id: Schema.NonEmptyString;
|
|
296
300
|
readonly port: Schema.NonEmptyString;
|
|
297
301
|
readonly method: Schema.NonEmptyString;
|
|
@@ -301,17 +305,12 @@ declare const PortValueFixture: Schema.Struct<{
|
|
|
301
305
|
readonly date: Schema.String;
|
|
302
306
|
}>>;
|
|
303
307
|
readonly note: Schema.optionalKey<Schema.String>;
|
|
308
|
+
readonly response: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
309
|
+
readonly failure: Schema.optionalKey<Schema.Never>;
|
|
304
310
|
}>;
|
|
305
|
-
type PortValueFixture = typeof PortValueFixture.Type;
|
|
311
|
+
export type PortValueFixture = typeof PortValueFixture.Type;
|
|
306
312
|
/** A port call answered with a failure. */
|
|
307
|
-
declare const PortFailureFixture: Schema.Struct<{
|
|
308
|
-
readonly failure: Schema.Struct<{
|
|
309
|
-
readonly kind: Schema.Literals<readonly ["expected", "error"]>;
|
|
310
|
-
readonly code: Schema.NonEmptyString;
|
|
311
|
-
readonly message: Schema.String;
|
|
312
|
-
readonly status: Schema.optionalKey<Schema.Int>;
|
|
313
|
-
}>;
|
|
314
|
-
readonly response: Schema.optionalKey<Schema.Never>;
|
|
313
|
+
export declare const PortFailureFixture: Schema.Struct<{
|
|
315
314
|
readonly id: Schema.NonEmptyString;
|
|
316
315
|
readonly port: Schema.NonEmptyString;
|
|
317
316
|
readonly method: Schema.NonEmptyString;
|
|
@@ -321,16 +320,21 @@ declare const PortFailureFixture: Schema.Struct<{
|
|
|
321
320
|
readonly date: Schema.String;
|
|
322
321
|
}>>;
|
|
323
322
|
readonly note: Schema.optionalKey<Schema.String>;
|
|
323
|
+
readonly failure: Schema.Struct<{
|
|
324
|
+
readonly kind: Schema.Literals<readonly ["expected", "error"]>;
|
|
325
|
+
readonly code: Schema.NonEmptyString;
|
|
326
|
+
readonly message: Schema.String;
|
|
327
|
+
readonly status: Schema.optionalKey<Schema.Int>;
|
|
328
|
+
}>;
|
|
329
|
+
readonly response: Schema.optionalKey<Schema.Never>;
|
|
324
330
|
}>;
|
|
325
|
-
type PortFailureFixture = typeof PortFailureFixture.Type;
|
|
331
|
+
export type PortFailureFixture = typeof PortFailureFixture.Type;
|
|
326
332
|
/**
|
|
327
333
|
* One recorded call through a host-provided port: the port, the method, the credential-free JSON
|
|
328
334
|
* request, and exactly one of `response` or `failure`. Plain JSON only, so one fixture backs
|
|
329
335
|
* replay, an emulator, and parity checks alike.
|
|
330
336
|
*/
|
|
331
|
-
declare const PortFixture: Schema.Union<readonly [Schema.Struct<{
|
|
332
|
-
readonly response: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
333
|
-
readonly failure: Schema.optionalKey<Schema.Never>;
|
|
337
|
+
export declare const PortFixture: Schema.Union<readonly [Schema.Struct<{
|
|
334
338
|
readonly id: Schema.NonEmptyString;
|
|
335
339
|
readonly port: Schema.NonEmptyString;
|
|
336
340
|
readonly method: Schema.NonEmptyString;
|
|
@@ -340,14 +344,9 @@ declare const PortFixture: Schema.Union<readonly [Schema.Struct<{
|
|
|
340
344
|
readonly date: Schema.String;
|
|
341
345
|
}>>;
|
|
342
346
|
readonly note: Schema.optionalKey<Schema.String>;
|
|
347
|
+
readonly response: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
348
|
+
readonly failure: Schema.optionalKey<Schema.Never>;
|
|
343
349
|
}>, Schema.Struct<{
|
|
344
|
-
readonly failure: Schema.Struct<{
|
|
345
|
-
readonly kind: Schema.Literals<readonly ["expected", "error"]>;
|
|
346
|
-
readonly code: Schema.NonEmptyString;
|
|
347
|
-
readonly message: Schema.String;
|
|
348
|
-
readonly status: Schema.optionalKey<Schema.Int>;
|
|
349
|
-
}>;
|
|
350
|
-
readonly response: Schema.optionalKey<Schema.Never>;
|
|
351
350
|
readonly id: Schema.NonEmptyString;
|
|
352
351
|
readonly port: Schema.NonEmptyString;
|
|
353
352
|
readonly method: Schema.NonEmptyString;
|
|
@@ -357,45 +356,52 @@ declare const PortFixture: Schema.Union<readonly [Schema.Struct<{
|
|
|
357
356
|
readonly date: Schema.String;
|
|
358
357
|
}>>;
|
|
359
358
|
readonly note: Schema.optionalKey<Schema.String>;
|
|
359
|
+
readonly failure: Schema.Struct<{
|
|
360
|
+
readonly kind: Schema.Literals<readonly ["expected", "error"]>;
|
|
361
|
+
readonly code: Schema.NonEmptyString;
|
|
362
|
+
readonly message: Schema.String;
|
|
363
|
+
readonly status: Schema.optionalKey<Schema.Int>;
|
|
364
|
+
}>;
|
|
365
|
+
readonly response: Schema.optionalKey<Schema.Never>;
|
|
360
366
|
}>]>;
|
|
361
|
-
type PortFixture = typeof PortFixture.Type;
|
|
367
|
+
export type PortFixture = typeof PortFixture.Type;
|
|
362
368
|
/** Decode unknown input (for example a JSON file) into a `PortFixture`. */
|
|
363
|
-
declare const decodePortFixture: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<{
|
|
364
|
-
readonly method: string;
|
|
365
|
-
readonly request: Schema.Json;
|
|
366
|
-
readonly response: Schema.Json;
|
|
369
|
+
export declare const decodePortFixture: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<{
|
|
367
370
|
readonly id: string;
|
|
368
371
|
readonly port: string;
|
|
369
|
-
readonly
|
|
370
|
-
readonly
|
|
372
|
+
readonly method: string;
|
|
373
|
+
readonly request: Schema.Json;
|
|
371
374
|
readonly observed?: {
|
|
372
375
|
readonly account: string;
|
|
373
376
|
readonly date: string;
|
|
374
377
|
} | undefined;
|
|
378
|
+
readonly note?: string | undefined;
|
|
379
|
+
readonly response: Schema.Json;
|
|
380
|
+
readonly failure?: undefined;
|
|
375
381
|
} | {
|
|
382
|
+
readonly id: string;
|
|
383
|
+
readonly port: string;
|
|
376
384
|
readonly method: string;
|
|
377
385
|
readonly request: Schema.Json;
|
|
378
|
-
readonly
|
|
386
|
+
readonly observed?: {
|
|
387
|
+
readonly account: string;
|
|
388
|
+
readonly date: string;
|
|
389
|
+
} | undefined;
|
|
390
|
+
readonly note?: string | undefined;
|
|
379
391
|
readonly failure: {
|
|
380
|
-
readonly kind: "
|
|
392
|
+
readonly kind: "error" | "expected";
|
|
381
393
|
readonly code: string;
|
|
382
394
|
readonly message: string;
|
|
383
395
|
readonly status?: number | undefined;
|
|
384
396
|
};
|
|
385
|
-
readonly port: string;
|
|
386
|
-
readonly note?: string | undefined;
|
|
387
397
|
readonly response?: undefined;
|
|
388
|
-
readonly observed?: {
|
|
389
|
-
readonly account: string;
|
|
390
|
-
readonly date: string;
|
|
391
|
-
} | undefined;
|
|
392
398
|
}, Schema.SchemaError, never>;
|
|
393
399
|
/** Any fixture a conformance case may cite: an HTTP `WireFixture` or a `PortFixture`. */
|
|
394
|
-
type ConformanceFixture = WireFixture | PortFixture;
|
|
395
|
-
declare const isPortFixture: (fixture: ConformanceFixture) => fixture is PortFixture;
|
|
396
|
-
declare const isPortFailureFixture: (fixture: PortFixture) => fixture is PortFailureFixture;
|
|
400
|
+
export type ConformanceFixture = WireFixture | PortFixture;
|
|
401
|
+
export declare const isPortFixture: (fixture: ConformanceFixture) => fixture is PortFixture;
|
|
402
|
+
export declare const isPortFailureFixture: (fixture: PortFixture) => fixture is PortFailureFixture;
|
|
397
403
|
/** Evidence and (when known) date of a fixture. */
|
|
398
|
-
type ConformanceFixtureEvidence = {
|
|
404
|
+
export type ConformanceFixtureEvidence = {
|
|
399
405
|
readonly evidence: WireFixtureEvidence;
|
|
400
406
|
readonly date?: string;
|
|
401
407
|
};
|
|
@@ -404,16 +410,16 @@ type ConformanceFixtureEvidence = {
|
|
|
404
410
|
* `PortFixture` is `verified` as of `observed.date` when observed, else `unverified` without a
|
|
405
411
|
* date.
|
|
406
412
|
*/
|
|
407
|
-
declare const conformanceFixtureEvidence: (fixture: ConformanceFixture) => ConformanceFixtureEvidence;
|
|
413
|
+
export declare const conformanceFixtureEvidence: (fixture: ConformanceFixture) => ConformanceFixtureEvidence;
|
|
408
414
|
/** True for a port payload key that holds a credential (`credential`, `password`, `token`, ...). */
|
|
409
|
-
declare const isPortCredentialKey: (key: string) => boolean;
|
|
415
|
+
export declare const isPortCredentialKey: (key: string) => boolean;
|
|
410
416
|
/**
|
|
411
417
|
* A copy of a port payload without credential fields (see `isPortCredentialKey`: `credential(s)`
|
|
412
418
|
* plus the credential field names, AWS-style `accessKeyId` / `secretAccessKey` / `sessionToken`
|
|
413
419
|
* and their snake_case forms included), at any depth.
|
|
414
420
|
* Port requests often carry the resolved credential; record and compare requests only after this.
|
|
415
421
|
*/
|
|
416
|
-
declare const redactPortPayload: (value: Schema.Json) => Schema.Json;
|
|
422
|
+
export declare const redactPortPayload: (value: Schema.Json) => Schema.Json;
|
|
417
423
|
/**
|
|
418
424
|
* Pure secret scan of a `PortFixture`: the same token patterns and credential JSON fields as
|
|
419
425
|
* `scanFixtureForSecrets`, plus any non-null `credential` / `credentials` field (port requests must
|
|
@@ -426,7 +432,6 @@ declare const redactPortPayload: (value: Schema.Json) => Schema.Json;
|
|
|
426
432
|
* found. Covers metadata, the request, the response, and the failure. Issues name locations only.
|
|
427
433
|
* Returns an empty array when clean.
|
|
428
434
|
*/
|
|
429
|
-
declare const scanPortFixtureForSecrets: (fixture: PortFixture) => ReadonlyArray<FixtureSecretIssue>;
|
|
430
|
-
|
|
431
|
-
export { ConformanceFixture, ConformanceFixtureEvidence, FixtureSecretIssue, FixtureSecretIssueKind, PortFailure, PortFailureFixture, PortFixture, PortValueFixture, WireBase64BodyResponse, WireBodyResponse, WireChunk, WireExchange, WireFixture, WireFixtureEvidence, WireHeaders, WireRequest, WireResponse, WireStreamResponse, WireTextBodyResponse, conformanceFixtureEvidence, decodePortFixture, decodeWireFixture, fixtureAgeDays, isFixtureStale, isPortCredentialKey, isPortFailureFixture, isPortFixture, isWireBase64BodyResponse, isWireStreamResponse, redactPortPayload, scanFixtureForSecrets, scanPortFixtureForSecrets, syntheticPortCredentialParams };
|
|
435
|
+
export declare const scanPortFixtureForSecrets: (fixture: PortFixture) => ReadonlyArray<FixtureSecretIssue>;
|
|
436
|
+
export { syntheticPortCredentialParams };
|
|
432
437
|
//# sourceMappingURL=fixture.d.mts.map
|