@yolk-sdk/conformance 0.1.0-canary.96
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/LICENSE +21 -0
- package/README.md +316 -0
- package/dist/case.d.mts +89 -0
- package/dist/case.d.mts.map +1 -0
- package/dist/case.mjs +101 -0
- package/dist/case.mjs.map +1 -0
- package/dist/fixture.d.mts +432 -0
- package/dist/fixture.d.mts.map +1 -0
- package/dist/fixture.mjs +391 -0
- package/dist/fixture.mjs.map +1 -0
- package/dist/record.d.mts +96 -0
- package/dist/record.d.mts.map +1 -0
- package/dist/record.mjs +212 -0
- package/dist/record.mjs.map +1 -0
- package/dist/replay.d.mts +316 -0
- package/dist/replay.d.mts.map +1 -0
- package/dist/replay.mjs +272 -0
- package/dist/replay.mjs.map +1 -0
- package/dist/runner.d.mts +163 -0
- package/dist/runner.d.mts.map +1 -0
- package/dist/runner.mjs +264 -0
- package/dist/runner.mjs.map +1 -0
- package/dist/wire-internal.d.mts +90 -0
- package/dist/wire-internal.d.mts.map +1 -0
- package/dist/wire-internal.mjs +212 -0
- package/dist/wire-internal.mjs.map +1 -0
- package/package.json +75 -0
- package/src/case.ts +153 -0
- package/src/fixture.ts +625 -0
- package/src/record.ts +377 -0
- package/src/replay.ts +617 -0
- package/src/runner.ts +559 -0
- package/src/wire-internal.ts +382 -0
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
import { syntheticPortCredentialParams } from "./wire-internal.mjs";
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
|
+
|
|
4
|
+
//#region src/fixture.d.ts
|
|
5
|
+
/** `verified` = recorded from a live service; `unverified` = synthetic placeholder. */
|
|
6
|
+
declare const WireFixtureEvidence: Schema.Literals<readonly ["verified", "unverified"]>;
|
|
7
|
+
type WireFixtureEvidence = typeof WireFixtureEvidence.Type;
|
|
8
|
+
/** 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; /** Absolute URL including any query string. */
|
|
13
|
+
readonly url: Schema.NonEmptyString;
|
|
14
|
+
readonly headers: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>; /** Parsed JSON request body, or the raw text when it is not JSON (for example a form body). */
|
|
15
|
+
readonly body: Schema.optionalKey<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
16
|
+
}>;
|
|
17
|
+
type WireRequest = typeof WireRequest.Type;
|
|
18
|
+
/**
|
|
19
|
+
* One recorded network chunk. A chunk that is valid UTF-8 on its own is stored
|
|
20
|
+
* as readable text (empty chunks as `""`); any other chunk is stored as
|
|
21
|
+
* `{ base64 }` holding its exact bytes. Replay emits exactly these bytes.
|
|
22
|
+
*/
|
|
23
|
+
declare const WireChunk: Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
24
|
+
readonly base64: Schema.String;
|
|
25
|
+
}>]>;
|
|
26
|
+
type WireChunk = typeof WireChunk.Type;
|
|
27
|
+
/** A response whose whole body is valid UTF-8, stored as one string. */
|
|
28
|
+
declare const WireTextBodyResponse: Schema.Struct<{
|
|
29
|
+
readonly status: Schema.Int;
|
|
30
|
+
readonly headers: Schema.$Record<Schema.String, Schema.String>;
|
|
31
|
+
readonly body: Schema.String;
|
|
32
|
+
readonly bodyBase64: Schema.optionalKey<Schema.Never>;
|
|
33
|
+
readonly chunks: Schema.optionalKey<Schema.Never>;
|
|
34
|
+
}>;
|
|
35
|
+
type WireTextBodyResponse = typeof WireTextBodyResponse.Type;
|
|
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<{
|
|
38
|
+
readonly status: Schema.Int;
|
|
39
|
+
readonly headers: Schema.$Record<Schema.String, Schema.String>;
|
|
40
|
+
readonly bodyBase64: Schema.String;
|
|
41
|
+
readonly body: Schema.optionalKey<Schema.Never>;
|
|
42
|
+
readonly chunks: Schema.optionalKey<Schema.Never>;
|
|
43
|
+
}>;
|
|
44
|
+
type WireBase64BodyResponse = typeof WireBase64BodyResponse.Type;
|
|
45
|
+
/** A response recorded as one whole body: exactly one of `body` or `bodyBase64`. */
|
|
46
|
+
declare const WireBodyResponse: Schema.Union<readonly [Schema.Struct<{
|
|
47
|
+
readonly status: Schema.Int;
|
|
48
|
+
readonly headers: Schema.$Record<Schema.String, Schema.String>;
|
|
49
|
+
readonly body: Schema.String;
|
|
50
|
+
readonly bodyBase64: Schema.optionalKey<Schema.Never>;
|
|
51
|
+
readonly chunks: Schema.optionalKey<Schema.Never>;
|
|
52
|
+
}>, Schema.Struct<{
|
|
53
|
+
readonly status: Schema.Int;
|
|
54
|
+
readonly headers: Schema.$Record<Schema.String, Schema.String>;
|
|
55
|
+
readonly bodyBase64: Schema.String;
|
|
56
|
+
readonly body: Schema.optionalKey<Schema.Never>;
|
|
57
|
+
readonly chunks: Schema.optionalKey<Schema.Never>;
|
|
58
|
+
}>]>;
|
|
59
|
+
type WireBodyResponse = typeof WireBodyResponse.Type;
|
|
60
|
+
/**
|
|
61
|
+
* A streamed response (for example `text/event-stream`). Each entry is one
|
|
62
|
+
* network chunk (see `WireChunk`); chunk boundaries and bytes are preserved on
|
|
63
|
+
* replay.
|
|
64
|
+
*/
|
|
65
|
+
declare const WireStreamResponse: Schema.Struct<{
|
|
66
|
+
readonly status: Schema.Int;
|
|
67
|
+
readonly headers: Schema.$Record<Schema.String, Schema.String>;
|
|
68
|
+
readonly chunks: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
69
|
+
readonly base64: Schema.String;
|
|
70
|
+
}>]>>;
|
|
71
|
+
readonly body: Schema.optionalKey<Schema.Never>;
|
|
72
|
+
readonly bodyBase64: Schema.optionalKey<Schema.Never>;
|
|
73
|
+
}>;
|
|
74
|
+
type WireStreamResponse = typeof WireStreamResponse.Type;
|
|
75
|
+
declare const WireResponse: Schema.Union<readonly [Schema.Struct<{
|
|
76
|
+
readonly status: Schema.Int;
|
|
77
|
+
readonly headers: Schema.$Record<Schema.String, Schema.String>;
|
|
78
|
+
readonly body: Schema.String;
|
|
79
|
+
readonly bodyBase64: Schema.optionalKey<Schema.Never>;
|
|
80
|
+
readonly chunks: Schema.optionalKey<Schema.Never>;
|
|
81
|
+
}>, Schema.Struct<{
|
|
82
|
+
readonly status: Schema.Int;
|
|
83
|
+
readonly headers: Schema.$Record<Schema.String, Schema.String>;
|
|
84
|
+
readonly bodyBase64: Schema.String;
|
|
85
|
+
readonly body: Schema.optionalKey<Schema.Never>;
|
|
86
|
+
readonly chunks: Schema.optionalKey<Schema.Never>;
|
|
87
|
+
}>, Schema.Struct<{
|
|
88
|
+
readonly status: Schema.Int;
|
|
89
|
+
readonly headers: Schema.$Record<Schema.String, Schema.String>;
|
|
90
|
+
readonly chunks: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
91
|
+
readonly base64: Schema.String;
|
|
92
|
+
}>]>>;
|
|
93
|
+
readonly body: Schema.optionalKey<Schema.Never>;
|
|
94
|
+
readonly bodyBase64: Schema.optionalKey<Schema.Never>;
|
|
95
|
+
}>]>;
|
|
96
|
+
type WireResponse = typeof WireResponse.Type;
|
|
97
|
+
declare const WireExchange: Schema.Struct<{
|
|
98
|
+
readonly request: Schema.Struct<{
|
|
99
|
+
readonly method: Schema.NonEmptyString; /** Absolute URL including any query string. */
|
|
100
|
+
readonly url: Schema.NonEmptyString;
|
|
101
|
+
readonly headers: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>; /** Parsed JSON request body, or the raw text when it is not JSON (for example a form body). */
|
|
102
|
+
readonly body: Schema.optionalKey<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
103
|
+
}>;
|
|
104
|
+
readonly response: Schema.Union<readonly [Schema.Struct<{
|
|
105
|
+
readonly status: Schema.Int;
|
|
106
|
+
readonly headers: Schema.$Record<Schema.String, Schema.String>;
|
|
107
|
+
readonly body: Schema.String;
|
|
108
|
+
readonly bodyBase64: Schema.optionalKey<Schema.Never>;
|
|
109
|
+
readonly chunks: Schema.optionalKey<Schema.Never>;
|
|
110
|
+
}>, Schema.Struct<{
|
|
111
|
+
readonly status: Schema.Int;
|
|
112
|
+
readonly headers: Schema.$Record<Schema.String, Schema.String>;
|
|
113
|
+
readonly bodyBase64: Schema.String;
|
|
114
|
+
readonly body: Schema.optionalKey<Schema.Never>;
|
|
115
|
+
readonly chunks: Schema.optionalKey<Schema.Never>;
|
|
116
|
+
}>, Schema.Struct<{
|
|
117
|
+
readonly status: Schema.Int;
|
|
118
|
+
readonly headers: Schema.$Record<Schema.String, Schema.String>;
|
|
119
|
+
readonly chunks: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
120
|
+
readonly base64: Schema.String;
|
|
121
|
+
}>]>>;
|
|
122
|
+
readonly body: Schema.optionalKey<Schema.Never>;
|
|
123
|
+
readonly bodyBase64: Schema.optionalKey<Schema.Never>;
|
|
124
|
+
}>]>;
|
|
125
|
+
}>;
|
|
126
|
+
type WireExchange = typeof WireExchange.Type;
|
|
127
|
+
declare const WireFixture: Schema.Struct<{
|
|
128
|
+
readonly id: Schema.NonEmptyString;
|
|
129
|
+
readonly caseId: Schema.NonEmptyString;
|
|
130
|
+
readonly evidence: Schema.Literals<readonly ["verified", "unverified"]>; /** Calendar date of the recording (`YYYY-MM-DD`, UTC). */
|
|
131
|
+
readonly recordedAt: Schema.String; /** Synthetic account label, for example `synthetic`; never a real account name. */
|
|
132
|
+
readonly account: Schema.NonEmptyString;
|
|
133
|
+
readonly endpoint: Schema.NonEmptyString;
|
|
134
|
+
readonly model: Schema.optionalKey<Schema.String>;
|
|
135
|
+
readonly note: Schema.optionalKey<Schema.String>;
|
|
136
|
+
readonly exchanges: Schema.NonEmptyArray<Schema.Struct<{
|
|
137
|
+
readonly request: Schema.Struct<{
|
|
138
|
+
readonly method: Schema.NonEmptyString; /** Absolute URL including any query string. */
|
|
139
|
+
readonly url: Schema.NonEmptyString;
|
|
140
|
+
readonly headers: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>; /** Parsed JSON request body, or the raw text when it is not JSON (for example a form body). */
|
|
141
|
+
readonly body: Schema.optionalKey<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
142
|
+
}>;
|
|
143
|
+
readonly response: Schema.Union<readonly [Schema.Struct<{
|
|
144
|
+
readonly status: Schema.Int;
|
|
145
|
+
readonly headers: Schema.$Record<Schema.String, Schema.String>;
|
|
146
|
+
readonly body: Schema.String;
|
|
147
|
+
readonly bodyBase64: Schema.optionalKey<Schema.Never>;
|
|
148
|
+
readonly chunks: Schema.optionalKey<Schema.Never>;
|
|
149
|
+
}>, Schema.Struct<{
|
|
150
|
+
readonly status: Schema.Int;
|
|
151
|
+
readonly headers: Schema.$Record<Schema.String, Schema.String>;
|
|
152
|
+
readonly bodyBase64: Schema.String;
|
|
153
|
+
readonly body: Schema.optionalKey<Schema.Never>;
|
|
154
|
+
readonly chunks: Schema.optionalKey<Schema.Never>;
|
|
155
|
+
}>, Schema.Struct<{
|
|
156
|
+
readonly status: Schema.Int;
|
|
157
|
+
readonly headers: Schema.$Record<Schema.String, Schema.String>;
|
|
158
|
+
readonly chunks: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
159
|
+
readonly base64: Schema.String;
|
|
160
|
+
}>]>>;
|
|
161
|
+
readonly body: Schema.optionalKey<Schema.Never>;
|
|
162
|
+
readonly bodyBase64: Schema.optionalKey<Schema.Never>;
|
|
163
|
+
}>]>;
|
|
164
|
+
}>>;
|
|
165
|
+
}>;
|
|
166
|
+
type WireFixture = typeof WireFixture.Type;
|
|
167
|
+
/** 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<{
|
|
169
|
+
readonly exchanges: readonly [{
|
|
170
|
+
readonly request: {
|
|
171
|
+
readonly method: string;
|
|
172
|
+
readonly url: string;
|
|
173
|
+
readonly headers?: {
|
|
174
|
+
readonly [x: string]: string;
|
|
175
|
+
} | undefined;
|
|
176
|
+
readonly body?: Schema.Json | undefined;
|
|
177
|
+
};
|
|
178
|
+
readonly response: {
|
|
179
|
+
readonly headers: {
|
|
180
|
+
readonly [x: string]: string;
|
|
181
|
+
};
|
|
182
|
+
readonly body: string;
|
|
183
|
+
readonly status: number;
|
|
184
|
+
readonly bodyBase64?: undefined;
|
|
185
|
+
readonly chunks?: undefined;
|
|
186
|
+
} | {
|
|
187
|
+
readonly headers: {
|
|
188
|
+
readonly [x: string]: string;
|
|
189
|
+
};
|
|
190
|
+
readonly status: number;
|
|
191
|
+
readonly bodyBase64: string;
|
|
192
|
+
readonly body?: undefined;
|
|
193
|
+
readonly chunks?: undefined;
|
|
194
|
+
} | {
|
|
195
|
+
readonly headers: {
|
|
196
|
+
readonly [x: string]: string;
|
|
197
|
+
};
|
|
198
|
+
readonly status: number;
|
|
199
|
+
readonly chunks: readonly (string | {
|
|
200
|
+
readonly base64: string;
|
|
201
|
+
})[];
|
|
202
|
+
readonly body?: undefined;
|
|
203
|
+
readonly bodyBase64?: undefined;
|
|
204
|
+
};
|
|
205
|
+
}, ...{
|
|
206
|
+
readonly request: {
|
|
207
|
+
readonly method: string;
|
|
208
|
+
readonly url: string;
|
|
209
|
+
readonly headers?: {
|
|
210
|
+
readonly [x: string]: string;
|
|
211
|
+
} | undefined;
|
|
212
|
+
readonly body?: Schema.Json | undefined;
|
|
213
|
+
};
|
|
214
|
+
readonly response: {
|
|
215
|
+
readonly headers: {
|
|
216
|
+
readonly [x: string]: string;
|
|
217
|
+
};
|
|
218
|
+
readonly body: string;
|
|
219
|
+
readonly status: number;
|
|
220
|
+
readonly bodyBase64?: undefined;
|
|
221
|
+
readonly chunks?: undefined;
|
|
222
|
+
} | {
|
|
223
|
+
readonly headers: {
|
|
224
|
+
readonly [x: string]: string;
|
|
225
|
+
};
|
|
226
|
+
readonly status: number;
|
|
227
|
+
readonly bodyBase64: string;
|
|
228
|
+
readonly body?: undefined;
|
|
229
|
+
readonly chunks?: undefined;
|
|
230
|
+
} | {
|
|
231
|
+
readonly headers: {
|
|
232
|
+
readonly [x: string]: string;
|
|
233
|
+
};
|
|
234
|
+
readonly status: number;
|
|
235
|
+
readonly chunks: readonly (string | {
|
|
236
|
+
readonly base64: string;
|
|
237
|
+
})[];
|
|
238
|
+
readonly body?: undefined;
|
|
239
|
+
readonly bodyBase64?: undefined;
|
|
240
|
+
};
|
|
241
|
+
}[]];
|
|
242
|
+
readonly id: string;
|
|
243
|
+
readonly caseId: string;
|
|
244
|
+
readonly evidence: "verified" | "unverified";
|
|
245
|
+
readonly recordedAt: string;
|
|
246
|
+
readonly account: string;
|
|
247
|
+
readonly endpoint: string;
|
|
248
|
+
readonly model?: string | undefined;
|
|
249
|
+
readonly note?: string | undefined;
|
|
250
|
+
}, Schema.SchemaError, never>;
|
|
251
|
+
declare const isWireStreamResponse: (response: WireResponse) => response is WireStreamResponse;
|
|
252
|
+
declare const isWireBase64BodyResponse: (response: WireResponse) => response is WireBase64BodyResponse;
|
|
253
|
+
/**
|
|
254
|
+
* Whole days between `recordedAt` (UTC midnight) and `now`. `NaN` when
|
|
255
|
+
* `recordedAt` is not a `YYYY-MM-DD` date.
|
|
256
|
+
*/
|
|
257
|
+
declare const fixtureAgeDays: (fixture: Pick<WireFixture, "recordedAt">, now: Date) => number;
|
|
258
|
+
/**
|
|
259
|
+
* True when the fixture is older than `maxAgeDays` (default 30). Fixtures with
|
|
260
|
+
* an unreadable `recordedAt` are treated as stale.
|
|
261
|
+
*/
|
|
262
|
+
declare const isFixtureStale: (fixture: Pick<WireFixture, "recordedAt">, now: Date, maxAgeDays?: number) => boolean;
|
|
263
|
+
type FixtureSecretIssueKind = 'credential_header' | 'bearer_token' | 'api_key' | 'credential_query_param' | 'credential_field';
|
|
264
|
+
/** A secret-scan finding. `location` is a path into the fixture; the secret itself is never echoed. */
|
|
265
|
+
type FixtureSecretIssue = {
|
|
266
|
+
readonly kind: FixtureSecretIssueKind;
|
|
267
|
+
readonly location: string;
|
|
268
|
+
};
|
|
269
|
+
/**
|
|
270
|
+
* Pure secret scan. Flags credential headers, bearer tokens, common API-key
|
|
271
|
+
* prefixes, JWTs, private keys, credential query/form parameters, and
|
|
272
|
+
* credential JSON fields anywhere in the fixture: metadata, URLs, headers,
|
|
273
|
+
* request bodies, response bodies (text or decodable base64), each stream
|
|
274
|
+
* chunk, and the reassembled stream (so a secret split across chunks is still
|
|
275
|
+
* found). JSON bodies and SSE `data:` payloads get the credential-field scan.
|
|
276
|
+
* Issues name locations only. Returns an empty array when clean.
|
|
277
|
+
*/
|
|
278
|
+
declare const scanFixtureForSecrets: (fixture: WireFixture) => ReadonlyArray<FixtureSecretIssue>;
|
|
279
|
+
/**
|
|
280
|
+
* A failure a port answered instead of a value. `expected` is the port's value-level failure (for
|
|
281
|
+
* example a connector `ActionResult.failure`); `error` is the port's typed error channel. `code`
|
|
282
|
+
* is a sanitized classification, never raw provider text.
|
|
283
|
+
*/
|
|
284
|
+
declare const PortFailure: Schema.Struct<{
|
|
285
|
+
readonly kind: Schema.Literals<readonly ["expected", "error"]>;
|
|
286
|
+
readonly code: Schema.NonEmptyString;
|
|
287
|
+
readonly message: Schema.String;
|
|
288
|
+
readonly status: Schema.optionalKey<Schema.Int>;
|
|
289
|
+
}>;
|
|
290
|
+
type PortFailure = typeof PortFailure.Type;
|
|
291
|
+
/** 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>;
|
|
295
|
+
readonly id: Schema.NonEmptyString;
|
|
296
|
+
readonly port: Schema.NonEmptyString;
|
|
297
|
+
readonly method: Schema.NonEmptyString;
|
|
298
|
+
readonly request: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
299
|
+
readonly observed: Schema.optionalKey<Schema.Struct<{
|
|
300
|
+
readonly account: Schema.NonEmptyString;
|
|
301
|
+
readonly date: Schema.String;
|
|
302
|
+
}>>;
|
|
303
|
+
readonly note: Schema.optionalKey<Schema.String>;
|
|
304
|
+
}>;
|
|
305
|
+
type PortValueFixture = typeof PortValueFixture.Type;
|
|
306
|
+
/** 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>;
|
|
315
|
+
readonly id: Schema.NonEmptyString;
|
|
316
|
+
readonly port: Schema.NonEmptyString;
|
|
317
|
+
readonly method: Schema.NonEmptyString;
|
|
318
|
+
readonly request: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
319
|
+
readonly observed: Schema.optionalKey<Schema.Struct<{
|
|
320
|
+
readonly account: Schema.NonEmptyString;
|
|
321
|
+
readonly date: Schema.String;
|
|
322
|
+
}>>;
|
|
323
|
+
readonly note: Schema.optionalKey<Schema.String>;
|
|
324
|
+
}>;
|
|
325
|
+
type PortFailureFixture = typeof PortFailureFixture.Type;
|
|
326
|
+
/**
|
|
327
|
+
* One recorded call through a host-provided port: the port, the method, the credential-free JSON
|
|
328
|
+
* request, and exactly one of `response` or `failure`. Plain JSON only, so one fixture backs
|
|
329
|
+
* replay, an emulator, and parity checks alike.
|
|
330
|
+
*/
|
|
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>;
|
|
334
|
+
readonly id: Schema.NonEmptyString;
|
|
335
|
+
readonly port: Schema.NonEmptyString;
|
|
336
|
+
readonly method: Schema.NonEmptyString;
|
|
337
|
+
readonly request: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
338
|
+
readonly observed: Schema.optionalKey<Schema.Struct<{
|
|
339
|
+
readonly account: Schema.NonEmptyString;
|
|
340
|
+
readonly date: Schema.String;
|
|
341
|
+
}>>;
|
|
342
|
+
readonly note: Schema.optionalKey<Schema.String>;
|
|
343
|
+
}>, 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
|
+
readonly id: Schema.NonEmptyString;
|
|
352
|
+
readonly port: Schema.NonEmptyString;
|
|
353
|
+
readonly method: Schema.NonEmptyString;
|
|
354
|
+
readonly request: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
355
|
+
readonly observed: Schema.optionalKey<Schema.Struct<{
|
|
356
|
+
readonly account: Schema.NonEmptyString;
|
|
357
|
+
readonly date: Schema.String;
|
|
358
|
+
}>>;
|
|
359
|
+
readonly note: Schema.optionalKey<Schema.String>;
|
|
360
|
+
}>]>;
|
|
361
|
+
type PortFixture = typeof PortFixture.Type;
|
|
362
|
+
/** 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;
|
|
367
|
+
readonly id: string;
|
|
368
|
+
readonly port: string;
|
|
369
|
+
readonly note?: string | undefined;
|
|
370
|
+
readonly failure?: undefined;
|
|
371
|
+
readonly observed?: {
|
|
372
|
+
readonly account: string;
|
|
373
|
+
readonly date: string;
|
|
374
|
+
} | undefined;
|
|
375
|
+
} | {
|
|
376
|
+
readonly method: string;
|
|
377
|
+
readonly request: Schema.Json;
|
|
378
|
+
readonly id: string;
|
|
379
|
+
readonly failure: {
|
|
380
|
+
readonly kind: "expected" | "error";
|
|
381
|
+
readonly code: string;
|
|
382
|
+
readonly message: string;
|
|
383
|
+
readonly status?: number | undefined;
|
|
384
|
+
};
|
|
385
|
+
readonly port: string;
|
|
386
|
+
readonly note?: string | undefined;
|
|
387
|
+
readonly response?: undefined;
|
|
388
|
+
readonly observed?: {
|
|
389
|
+
readonly account: string;
|
|
390
|
+
readonly date: string;
|
|
391
|
+
} | undefined;
|
|
392
|
+
}, Schema.SchemaError, never>;
|
|
393
|
+
/** 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;
|
|
397
|
+
/** Evidence and (when known) date of a fixture. */
|
|
398
|
+
type ConformanceFixtureEvidence = {
|
|
399
|
+
readonly evidence: WireFixtureEvidence;
|
|
400
|
+
readonly date?: string;
|
|
401
|
+
};
|
|
402
|
+
/**
|
|
403
|
+
* Evidence and date of any fixture: a `WireFixture`'s `evidence` and `recordedAt`; a
|
|
404
|
+
* `PortFixture` is `verified` as of `observed.date` when observed, else `unverified` without a
|
|
405
|
+
* date.
|
|
406
|
+
*/
|
|
407
|
+
declare const conformanceFixtureEvidence: (fixture: ConformanceFixture) => ConformanceFixtureEvidence;
|
|
408
|
+
/** True for a port payload key that holds a credential (`credential`, `password`, `token`, ...). */
|
|
409
|
+
declare const isPortCredentialKey: (key: string) => boolean;
|
|
410
|
+
/**
|
|
411
|
+
* A copy of a port payload without credential fields (see `isPortCredentialKey`: `credential(s)`
|
|
412
|
+
* plus the credential field names, AWS-style `accessKeyId` / `secretAccessKey` / `sessionToken`
|
|
413
|
+
* and their snake_case forms included), at any depth.
|
|
414
|
+
* Port requests often carry the resolved credential; record and compare requests only after this.
|
|
415
|
+
*/
|
|
416
|
+
declare const redactPortPayload: (value: Schema.Json) => Schema.Json;
|
|
417
|
+
/**
|
|
418
|
+
* Pure secret scan of a `PortFixture`: the same token patterns and credential JSON fields as
|
|
419
|
+
* `scanFixtureForSecrets`, plus any non-null `credential` / `credentials` field (port requests must
|
|
420
|
+
* be recorded through `redactPortPayload`), plus credential query or form parameters inside every
|
|
421
|
+
* JSON string value, `note`, and `failure.message` (a signed URL a port answered, such as an S3
|
|
422
|
+
* presigned URL's `X-Amz-Signature` / `X-Amz-Credential` / `X-Amz-Security-Token`), each `name=`
|
|
423
|
+
* found and judged on its own. The only exemption: the raw value, up to `&`, `#`, whitespace, `"`,
|
|
424
|
+
* `<`, `>`, or the end (never `?` or `'`), percent-decoded, exactly equals that name's entry in
|
|
425
|
+
* `syntheticPortCredentialParams`. Parameters with escaped names (`&`, percent-encoded) are not
|
|
426
|
+
* found. Covers metadata, the request, the response, and the failure. Issues name locations only.
|
|
427
|
+
* Returns an empty array when clean.
|
|
428
|
+
*/
|
|
429
|
+
declare const scanPortFixtureForSecrets: (fixture: PortFixture) => ReadonlyArray<FixtureSecretIssue>;
|
|
430
|
+
//#endregion
|
|
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 };
|
|
432
|
+
//# sourceMappingURL=fixture.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixture.d.mts","names":[],"sources":["../src/fixture.ts"],"mappings":";;;;;cA2Ba,mBAAA,EAAmB,MAAA,CAAA,QAAA;AAAA,KAEpB,mBAAA,UAA6B,mBAAA,CAAoB,IAAI;;cAGpD,WAAA,EAAW,MAAA,CAAA,OAAA,CAAA,MAAA,CAAA,MAAA,EAAA,MAAA,CAAA,MAAA;AAAA,KAEZ,WAAA,UAAqB,WAAA,CAAY,IAAI;AAAA,cAIpC,WAAA,EAAW,MAAA,CAAA,MAAA;EAAA,wCATO;EAAA;sFAAkC;EAAA;;KAkBrD,WAAA,UAAqB,WAAA,CAAY,IAAI;;;;;;cASpC,SAAA,EAAS,MAAA,CAAA,KAAA,WAAA,MAAA,CAAA,MAAA,EAAA,MAAA,CAAA,MAAA;EAAA;;KAEV,SAAA,UAAmB,SAAA,CAAU,IAAI;;cAOhC,oBAAA,EAAoB,MAAA,CAAA,MAAA;EAAA;;;;;;KAQrB,oBAAA,UAA8B,oBAAA,CAAqB,IAAI;AAnCnE;AAAA,cAsCa,sBAAA,EAAsB,MAAA,CAAA,MAAA;EAAA;;;;;;KAQvB,sBAAA,UAAgC,sBAAA,CAAuB,IAAI;;cAG1D,gBAAA,EAAgB,MAAA,CAAA,KAAA,WAAA,MAAA,CAAA,MAAA;EAAA;;;;;;;;;;;;KAEjB,gBAAA,UAA0B,gBAAA,CAAiB,IAAI;;;;;;cAO9C,kBAAA,EAAkB,MAAA,CAAA,MAAA;EAAA;;;;;;;;KAQnB,kBAAA,UAA4B,kBAAA,CAAmB,IAAI;AAAA,cAElD,YAAA,EAAY,MAAA,CAAA,KAAA,WAAA,MAAA,CAAA,MAAA;EAAA;;;;;;;;;;;;;;;;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