@clipboard-health/playwright-toolkit 1.0.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/README.md +221 -0
- package/package.json +39 -0
- package/src/index.d.ts +7 -0
- package/src/index.js +11 -0
- package/src/index.js.map +1 -0
- package/src/lib/adminAuthToken.d.ts +56 -0
- package/src/lib/adminAuthToken.js +369 -0
- package/src/lib/adminAuthToken.js.map +1 -0
- package/src/lib/cognitoDiagnostics.d.ts +41 -0
- package/src/lib/cognitoDiagnostics.js +331 -0
- package/src/lib/cognitoDiagnostics.js.map +1 -0
- package/src/lib/deployedAssets.d.ts +77 -0
- package/src/lib/deployedAssets.js +348 -0
- package/src/lib/deployedAssets.js.map +1 -0
- package/src/lib/mailpit.d.ts +86 -0
- package/src/lib/mailpit.js +252 -0
- package/src/lib/mailpit.js.map +1 -0
- package/src/lib/retry.d.ts +66 -0
- package/src/lib/retry.js +262 -0
- package/src/lib/retry.js.map +1 -0
- package/src/lib/setupRetry.d.ts +29 -0
- package/src/lib/setupRetry.js +55 -0
- package/src/lib/setupRetry.js.map +1 -0
- package/src/lib/traceparent.d.ts +31 -0
- package/src/lib/traceparent.js +66 -0
- package/src/lib/traceparent.js.map +1 -0
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.verifyDeployedAssets = verifyDeployedAssets;
|
|
4
|
+
exports.waitForDeployedAssets = waitForDeployedAssets;
|
|
5
|
+
const node_perf_hooks_1 = require("node:perf_hooks");
|
|
6
|
+
const util_ts_1 = require("@clipboard-health/util-ts");
|
|
7
|
+
const retry_1 = require("./retry");
|
|
8
|
+
const setupRetry_1 = require("./setupRetry");
|
|
9
|
+
const DEFAULT_CONCURRENCY_LIMIT = 5;
|
|
10
|
+
const DEFAULT_FETCH_TIMEOUT_MS = 10_000;
|
|
11
|
+
const DEFAULT_RETRY_ATTEMPTS = 3;
|
|
12
|
+
const DEFAULT_RETRY_DELAY_MS = 500;
|
|
13
|
+
const DEFAULT_POLL_INTERVAL_MS = 10_000;
|
|
14
|
+
const CACHE_BUST_QUERY_PARAMETER = "cbhAssetVerifier";
|
|
15
|
+
class AssetAttemptFailure extends Error {
|
|
16
|
+
attempt;
|
|
17
|
+
isTransient;
|
|
18
|
+
constructor(params) {
|
|
19
|
+
super(params.message);
|
|
20
|
+
this.name = "AssetAttemptFailure";
|
|
21
|
+
this.attempt = params.attempt;
|
|
22
|
+
this.isTransient = params.isTransient;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
class AssetGraphNotReadyError extends Error {
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Checks a repo-supplied deployed asset graph with bounded concurrency and
|
|
29
|
+
* classified per-asset retries. Discovery and asset classification remain in
|
|
30
|
+
* thin repo wrappers.
|
|
31
|
+
*/
|
|
32
|
+
async function verifyDeployedAssets(params) {
|
|
33
|
+
const concurrencyLimit = params.concurrencyLimit ?? DEFAULT_CONCURRENCY_LIMIT;
|
|
34
|
+
if (!Number.isInteger(concurrencyLimit) || concurrencyLimit < 1) {
|
|
35
|
+
throw new Error("concurrencyLimit must be a positive integer");
|
|
36
|
+
}
|
|
37
|
+
const results = Array.from({
|
|
38
|
+
length: params.checks.length,
|
|
39
|
+
});
|
|
40
|
+
let nextIndex = 0;
|
|
41
|
+
async function worker() {
|
|
42
|
+
for (;;) {
|
|
43
|
+
const index = nextIndex;
|
|
44
|
+
nextIndex += 1;
|
|
45
|
+
if (index >= params.checks.length) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const check = params.checks[index];
|
|
49
|
+
if (check === undefined) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
// eslint-disable-next-line no-await-in-loop -- Each worker consumes one bounded queue item at a time.
|
|
53
|
+
results[index] = await verifyDeployedAsset({ check, options: params });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
await Promise.all(Array.from({ length: Math.min(concurrencyLimit, params.checks.length) }, worker));
|
|
57
|
+
const completedResults = results.filter(util_ts_1.isDefined);
|
|
58
|
+
const failureCount = completedResults.filter((result) => !result.isSuccess).length;
|
|
59
|
+
return {
|
|
60
|
+
results: completedResults,
|
|
61
|
+
summary: {
|
|
62
|
+
failureCount,
|
|
63
|
+
passedCount: completedResults.length - failureCount,
|
|
64
|
+
totalCount: completedResults.length,
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Polls the whole graph until it is healthy for an optional stable window.
|
|
70
|
+
*/
|
|
71
|
+
async function waitForDeployedAssets(params) {
|
|
72
|
+
const nowImplementation = params.nowImplementation ?? Date.now;
|
|
73
|
+
const stableWindowMs = params.stableWindowMs ?? 0;
|
|
74
|
+
let stableWindowStartedAtMs;
|
|
75
|
+
let lastReport;
|
|
76
|
+
const result = await (0, retry_1.runWithRetry)({
|
|
77
|
+
operationName: "wait for deployed asset graph",
|
|
78
|
+
operation: async () => {
|
|
79
|
+
lastReport = await verifyDeployedAssets(params);
|
|
80
|
+
const nowMs = nowImplementation();
|
|
81
|
+
if (lastReport.summary.failureCount > 0) {
|
|
82
|
+
stableWindowStartedAtMs = undefined;
|
|
83
|
+
throw new AssetGraphNotReadyError(`Deployed asset graph has ${lastReport.summary.failureCount} failure(s)`);
|
|
84
|
+
}
|
|
85
|
+
stableWindowStartedAtMs ??= nowMs;
|
|
86
|
+
const stableWindowElapsedMs = nowMs - stableWindowStartedAtMs;
|
|
87
|
+
if (stableWindowElapsedMs < stableWindowMs) {
|
|
88
|
+
throw new AssetGraphNotReadyError(`Deployed asset graph is healthy for ${stableWindowElapsedMs}ms; ` +
|
|
89
|
+
`${stableWindowMs}ms required`);
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
report: lastReport,
|
|
93
|
+
stableWindowElapsedMs,
|
|
94
|
+
};
|
|
95
|
+
},
|
|
96
|
+
mode: {
|
|
97
|
+
kind: "poll",
|
|
98
|
+
timeoutMs: params.timeoutMs,
|
|
99
|
+
intervalsMs: [params.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS],
|
|
100
|
+
isTransient: ({ error }) => error instanceof AssetGraphNotReadyError,
|
|
101
|
+
},
|
|
102
|
+
nowImplementation,
|
|
103
|
+
sleepImplementation: params.sleepImplementation,
|
|
104
|
+
});
|
|
105
|
+
return {
|
|
106
|
+
...result.value.report,
|
|
107
|
+
wait: {
|
|
108
|
+
attempts: result.attempts,
|
|
109
|
+
isStableWindowSatisfied: true,
|
|
110
|
+
stableWindowElapsedMs: result.value.stableWindowElapsedMs,
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
async function verifyDeployedAsset(params) {
|
|
115
|
+
const attempts = [];
|
|
116
|
+
const maxAttempts = params.options.retry?.maxAttempts ?? DEFAULT_RETRY_ATTEMPTS;
|
|
117
|
+
const reportCheck = toDeployedAssetReportCheck(params.check);
|
|
118
|
+
try {
|
|
119
|
+
const result = await (0, retry_1.runWithRetry)({
|
|
120
|
+
operationName: `verify deployed asset ${params.check.path}`,
|
|
121
|
+
operation: async ({ attemptNumber }) => {
|
|
122
|
+
try {
|
|
123
|
+
const attempt = await checkAssetOnce({
|
|
124
|
+
attemptNumber,
|
|
125
|
+
check: params.check,
|
|
126
|
+
fetchImplementation: params.options.fetchImplementation ?? fetch,
|
|
127
|
+
fetchTimeoutMs: params.options.fetchTimeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS,
|
|
128
|
+
nowImplementation: params.options.nowImplementation ?? (() => node_perf_hooks_1.performance.now()),
|
|
129
|
+
});
|
|
130
|
+
attempts.push(attempt);
|
|
131
|
+
return attempt;
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
if (error instanceof AssetAttemptFailure) {
|
|
135
|
+
attempts.push(error.attempt);
|
|
136
|
+
}
|
|
137
|
+
throw error;
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
mode: {
|
|
141
|
+
kind: "classified",
|
|
142
|
+
maxAttempts,
|
|
143
|
+
delayMs: params.options.retry?.delayMs ?? DEFAULT_RETRY_DELAY_MS,
|
|
144
|
+
isTransient: ({ error }) => error instanceof AssetAttemptFailure && error.isTransient,
|
|
145
|
+
},
|
|
146
|
+
sleepImplementation: params.options.sleepImplementation,
|
|
147
|
+
nowImplementation: params.options.nowImplementation,
|
|
148
|
+
});
|
|
149
|
+
const finalAttempt = result.value;
|
|
150
|
+
return {
|
|
151
|
+
attempts,
|
|
152
|
+
check: reportCheck,
|
|
153
|
+
...(finalAttempt.contentType === undefined ? {} : { contentType: finalAttempt.contentType }),
|
|
154
|
+
isSuccess: true,
|
|
155
|
+
...(finalAttempt.status === undefined ? {} : { status: finalAttempt.status }),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
const failure = getAssetAttemptFailure({ error });
|
|
160
|
+
const finalAttempt = attempts.at(-1);
|
|
161
|
+
return {
|
|
162
|
+
attempts,
|
|
163
|
+
check: reportCheck,
|
|
164
|
+
...(finalAttempt?.contentType === undefined ? {} : { contentType: finalAttempt.contentType }),
|
|
165
|
+
errorMessage: failure?.message ?? (0, util_ts_1.toErrorMessage)(error),
|
|
166
|
+
isSuccess: false,
|
|
167
|
+
...(finalAttempt?.status === undefined ? {} : { status: finalAttempt.status }),
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
async function checkAssetOnce(params) {
|
|
172
|
+
const requestUrl = getRequestUrl({
|
|
173
|
+
attemptNumber: params.attemptNumber,
|
|
174
|
+
check: params.check,
|
|
175
|
+
});
|
|
176
|
+
const abortController = new AbortController();
|
|
177
|
+
const timeout = setTimeout(() => {
|
|
178
|
+
abortController.abort();
|
|
179
|
+
}, params.fetchTimeoutMs);
|
|
180
|
+
const startedAtMs = params.nowImplementation();
|
|
181
|
+
try {
|
|
182
|
+
let response;
|
|
183
|
+
try {
|
|
184
|
+
response = await params.fetchImplementation(requestUrl, {
|
|
185
|
+
...getRequestInit({ check: params.check }),
|
|
186
|
+
method: params.check.method ?? "GET",
|
|
187
|
+
signal: abortController.signal,
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
catch (error) {
|
|
191
|
+
const message = (0, util_ts_1.toErrorMessage)(error);
|
|
192
|
+
throw new AssetAttemptFailure({
|
|
193
|
+
attempt: {
|
|
194
|
+
attemptNumber: params.attemptNumber,
|
|
195
|
+
durationMs: params.nowImplementation() - startedAtMs,
|
|
196
|
+
errorMessage: message,
|
|
197
|
+
url: requestUrl,
|
|
198
|
+
},
|
|
199
|
+
isTransient: isTransientFetchError({ error }),
|
|
200
|
+
message,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
const contentType = response.headers.get("content-type") ?? undefined;
|
|
204
|
+
const attempt = {
|
|
205
|
+
attemptNumber: params.attemptNumber,
|
|
206
|
+
...(contentType === undefined ? {} : { contentType }),
|
|
207
|
+
durationMs: params.nowImplementation() - startedAtMs,
|
|
208
|
+
status: response.status,
|
|
209
|
+
url: requestUrl,
|
|
210
|
+
};
|
|
211
|
+
if (!response.ok) {
|
|
212
|
+
const message = `expected HTTP 2xx but received HTTP ${response.status}`;
|
|
213
|
+
throw new AssetAttemptFailure({
|
|
214
|
+
attempt: { ...attempt, errorMessage: message },
|
|
215
|
+
isTransient: isTransientAssetStatus({ status: response.status }),
|
|
216
|
+
message,
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
if (params.check.expectedContentTypes !== undefined &&
|
|
220
|
+
!isExpectedContentType({
|
|
221
|
+
actualContentType: contentType,
|
|
222
|
+
expectedContentTypes: params.check.expectedContentTypes,
|
|
223
|
+
})) {
|
|
224
|
+
const message = `expected content-type ${params.check.expectedContentTypes.join(" or ")} ` +
|
|
225
|
+
`but received ${contentType ?? "none"}`;
|
|
226
|
+
throw new AssetAttemptFailure({
|
|
227
|
+
attempt: { ...attempt, errorMessage: message },
|
|
228
|
+
isTransient: false,
|
|
229
|
+
message,
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
if (params.check.validateResponse !== undefined) {
|
|
233
|
+
let validation;
|
|
234
|
+
try {
|
|
235
|
+
validation = await params.check.validateResponse({ response });
|
|
236
|
+
}
|
|
237
|
+
catch (error) {
|
|
238
|
+
const message = (0, util_ts_1.toErrorMessage)(error);
|
|
239
|
+
throw new AssetAttemptFailure({
|
|
240
|
+
attempt: { ...attempt, errorMessage: message },
|
|
241
|
+
isTransient: isTransientFetchError({ error }),
|
|
242
|
+
message,
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
if (!validation.isValid) {
|
|
246
|
+
const message = validation.message ?? "custom deployed asset validation failed";
|
|
247
|
+
throw new AssetAttemptFailure({
|
|
248
|
+
attempt: { ...attempt, errorMessage: message },
|
|
249
|
+
isTransient: validation.isTransient ?? false,
|
|
250
|
+
message,
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return attempt;
|
|
255
|
+
}
|
|
256
|
+
finally {
|
|
257
|
+
clearTimeout(timeout);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
function getRequestUrl(params) {
|
|
261
|
+
const url = new URL(params.check.url);
|
|
262
|
+
if ((params.check.cacheMode ?? "normal") === "normal") {
|
|
263
|
+
return url.toString();
|
|
264
|
+
}
|
|
265
|
+
url.searchParams.set(CACHE_BUST_QUERY_PARAMETER, `${Date.now()}-${params.attemptNumber}`);
|
|
266
|
+
return url.toString();
|
|
267
|
+
}
|
|
268
|
+
function getRequestInit(params) {
|
|
269
|
+
if ((params.check.cacheMode ?? "normal") === "normal") {
|
|
270
|
+
return params.check.headers === undefined ? {} : { headers: params.check.headers };
|
|
271
|
+
}
|
|
272
|
+
return {
|
|
273
|
+
cache: "no-store",
|
|
274
|
+
headers: {
|
|
275
|
+
"cache-control": "no-cache",
|
|
276
|
+
pragma: "no-cache",
|
|
277
|
+
...params.check.headers,
|
|
278
|
+
},
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
function isTransientAssetStatus(params) {
|
|
282
|
+
return params.status === 425 || (0, setupRetry_1.isRetryableHttpStatus)({ status: params.status });
|
|
283
|
+
}
|
|
284
|
+
function isTransientFetchError(params) {
|
|
285
|
+
const inspectedErrors = new Set();
|
|
286
|
+
let error = params.error;
|
|
287
|
+
while ((0, util_ts_1.isRecord)(error) && !inspectedErrors.has(error)) {
|
|
288
|
+
inspectedErrors.add(error);
|
|
289
|
+
if (error["name"] === "AbortError" ||
|
|
290
|
+
error["code"] === "ECONNREFUSED" ||
|
|
291
|
+
error["code"] === "ECONNRESET" ||
|
|
292
|
+
error["code"] === "EAI_AGAIN" ||
|
|
293
|
+
error["code"] === "ENOTFOUND" ||
|
|
294
|
+
error["code"] === "ETIMEDOUT") {
|
|
295
|
+
return true;
|
|
296
|
+
}
|
|
297
|
+
error = error["cause"];
|
|
298
|
+
}
|
|
299
|
+
const normalizedMessage = (0, util_ts_1.toErrorMessage)(params.error).toLowerCase();
|
|
300
|
+
return (normalizedMessage.includes("failed to fetch") ||
|
|
301
|
+
normalizedMessage.includes("fetch failed") ||
|
|
302
|
+
normalizedMessage.includes("networkerror"));
|
|
303
|
+
}
|
|
304
|
+
function isExpectedContentType(params) {
|
|
305
|
+
if (params.actualContentType === undefined) {
|
|
306
|
+
return false;
|
|
307
|
+
}
|
|
308
|
+
const actualContentType = normalizeContentType(params.actualContentType);
|
|
309
|
+
const expectedContentTypes = params.expectedContentTypes.flatMap(getEquivalentContentTypes);
|
|
310
|
+
return expectedContentTypes.includes(actualContentType);
|
|
311
|
+
}
|
|
312
|
+
function getEquivalentContentTypes(contentType) {
|
|
313
|
+
const normalized = normalizeContentType(contentType);
|
|
314
|
+
if (normalized === "application/javascript" || normalized === "text/javascript") {
|
|
315
|
+
return ["application/javascript", "text/javascript"];
|
|
316
|
+
}
|
|
317
|
+
if (normalized === "application/json" || normalized === "application/manifest+json") {
|
|
318
|
+
return ["application/json", "application/manifest+json"];
|
|
319
|
+
}
|
|
320
|
+
if (normalized === "image/x-icon" || normalized === "image/vnd.microsoft.icon") {
|
|
321
|
+
return ["image/x-icon", "image/vnd.microsoft.icon"];
|
|
322
|
+
}
|
|
323
|
+
return [normalized];
|
|
324
|
+
}
|
|
325
|
+
function toDeployedAssetReportCheck(check) {
|
|
326
|
+
return {
|
|
327
|
+
path: check.path,
|
|
328
|
+
url: check.url,
|
|
329
|
+
...(check.method === undefined ? {} : { method: check.method }),
|
|
330
|
+
...(check.cacheMode === undefined ? {} : { cacheMode: check.cacheMode }),
|
|
331
|
+
...(check.expectedContentTypes === undefined
|
|
332
|
+
? {}
|
|
333
|
+
: { expectedContentTypes: check.expectedContentTypes }),
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
function normalizeContentType(contentType) {
|
|
337
|
+
return contentType.split(";")[0]?.trim().toLowerCase() ?? "";
|
|
338
|
+
}
|
|
339
|
+
function getAssetAttemptFailure(params) {
|
|
340
|
+
if (params.error instanceof AssetAttemptFailure) {
|
|
341
|
+
return params.error;
|
|
342
|
+
}
|
|
343
|
+
if (params.error instanceof retry_1.RetryError && params.error.cause instanceof AssetAttemptFailure) {
|
|
344
|
+
return params.error.cause;
|
|
345
|
+
}
|
|
346
|
+
return undefined;
|
|
347
|
+
}
|
|
348
|
+
//# sourceMappingURL=deployedAssets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployedAssets.js","sourceRoot":"","sources":["../../../../../packages/playwright-toolkit/src/lib/deployedAssets.ts"],"names":[],"mappings":";;;;AAAA,qDAA8C;AAE9C,uDAAmG;AAEnG,mCAAmD;AACnD,6CAAqD;AAErD,MAAM,yBAAyB,GAAG,CAAC,CAAC;AACpC,MAAM,wBAAwB,GAAG,MAAM,CAAC;AACxC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACjC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AACnC,MAAM,wBAAwB,GAAG,MAAM,CA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KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;QACxE,GAAG,CAAC,KAAK,CAAC,oBAAoB,KAAK,SAAS;YAC1C,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,oBAAoB,EAAE,KAAK,CAAC,oBAAoB,EAAE,CAAC;KAC1D,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAAC,WAAmB;IAC/C,OAAO,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC;AAC/D,CAAC;AAED,SAAS,sBAAsB,CAAC,MAA0B;IACxD,IAAI,MAAM,CAAC,KAAK,YAAY,mBAAmB,EAAE,CAAC;QAChD,OAAO,MAAM,CAAC,KAAK,CAAC;IACtB,CAAC;IAED,IAAI,MAAM,CAAC,KAAK,YAAY,kBAAU,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,YAAY,mBAAmB,EAAE,CAAC;QAC5F,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;IAC5B,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export interface MailpitAddress {
|
|
2
|
+
Address: string;
|
|
3
|
+
Name: string;
|
|
4
|
+
}
|
|
5
|
+
export interface MailpitMessageHeaders {
|
|
6
|
+
ID: string;
|
|
7
|
+
From: MailpitAddress;
|
|
8
|
+
To: MailpitAddress[];
|
|
9
|
+
Subject: string;
|
|
10
|
+
}
|
|
11
|
+
export interface MailpitMessageSummary extends MailpitMessageHeaders {
|
|
12
|
+
Created: string;
|
|
13
|
+
}
|
|
14
|
+
export interface MailpitMessage extends MailpitMessageHeaders {
|
|
15
|
+
Date: string;
|
|
16
|
+
Text: string;
|
|
17
|
+
HTML: string;
|
|
18
|
+
}
|
|
19
|
+
export interface MailpitClient {
|
|
20
|
+
searchMessages(params: {
|
|
21
|
+
query: string;
|
|
22
|
+
}): Promise<MailpitMessageSummary[]>;
|
|
23
|
+
getMessage(params: {
|
|
24
|
+
messageId: string;
|
|
25
|
+
}): Promise<MailpitMessage>;
|
|
26
|
+
}
|
|
27
|
+
export interface CreateMailpitClientParams {
|
|
28
|
+
password: string;
|
|
29
|
+
username?: string | undefined;
|
|
30
|
+
baseUrl?: string | undefined;
|
|
31
|
+
fetchImplementation?: typeof fetch | undefined;
|
|
32
|
+
requestTimeoutMs?: number | undefined;
|
|
33
|
+
}
|
|
34
|
+
export interface FetchMailpitValueResult {
|
|
35
|
+
value: string;
|
|
36
|
+
messageId: string;
|
|
37
|
+
}
|
|
38
|
+
export interface FetchMailpitValueParams {
|
|
39
|
+
client: MailpitClient;
|
|
40
|
+
email: string;
|
|
41
|
+
extractValue: (params: {
|
|
42
|
+
message: MailpitMessage;
|
|
43
|
+
}) => string | undefined;
|
|
44
|
+
valueLabel: string;
|
|
45
|
+
timeoutMs?: number | undefined;
|
|
46
|
+
pollIntervalMs?: number | undefined;
|
|
47
|
+
sentAfter?: Date | undefined;
|
|
48
|
+
excludedValues?: readonly string[] | undefined;
|
|
49
|
+
sleepImplementation?: ((params: {
|
|
50
|
+
durationMs: number;
|
|
51
|
+
}) => Promise<void>) | undefined;
|
|
52
|
+
nowImplementation?: (() => number) | undefined;
|
|
53
|
+
}
|
|
54
|
+
type MailpitPollParams = Omit<FetchMailpitValueParams, "excludedValues" | "extractValue" | "valueLabel">;
|
|
55
|
+
export type FetchMagicLinkFromMailpitParams = MailpitPollParams & {
|
|
56
|
+
excludeLinks?: readonly string[] | undefined;
|
|
57
|
+
};
|
|
58
|
+
export type FetchEmailOtpCodeFromMailpitParams = MailpitPollParams & {
|
|
59
|
+
excludeCodes?: readonly string[] | undefined;
|
|
60
|
+
};
|
|
61
|
+
interface MailpitRequestErrorParams {
|
|
62
|
+
message: string;
|
|
63
|
+
status?: number | undefined;
|
|
64
|
+
cause?: unknown;
|
|
65
|
+
isTransient?: boolean | undefined;
|
|
66
|
+
}
|
|
67
|
+
export declare class MailpitRequestError extends Error {
|
|
68
|
+
readonly cause: unknown;
|
|
69
|
+
readonly isTransient: boolean;
|
|
70
|
+
readonly status: number | undefined;
|
|
71
|
+
constructor(params: MailpitRequestErrorParams);
|
|
72
|
+
}
|
|
73
|
+
export declare function createMailpitClient(params: CreateMailpitClientParams): MailpitClient;
|
|
74
|
+
export declare function fetchMailpitValue(params: FetchMailpitValueParams): Promise<FetchMailpitValueResult>;
|
|
75
|
+
export declare function fetchMagicLinkFromMailpit(params: FetchMagicLinkFromMailpitParams): Promise<FetchMailpitValueResult>;
|
|
76
|
+
export declare function fetchEmailOtpCodeFromMailpit(params: FetchEmailOtpCodeFromMailpitParams): Promise<FetchMailpitValueResult>;
|
|
77
|
+
export declare function extractMagicLinkFromMailpitMessage(params: {
|
|
78
|
+
message: MailpitMessage;
|
|
79
|
+
}): string | undefined;
|
|
80
|
+
export declare function extractEmailOtpCodeFromMailpitMessage(params: {
|
|
81
|
+
message: MailpitMessage;
|
|
82
|
+
}): string | undefined;
|
|
83
|
+
export declare function isTransientMailpitError(params: {
|
|
84
|
+
error: unknown;
|
|
85
|
+
}): boolean;
|
|
86
|
+
export {};
|