@mailwurf/e2e 0.0.0 → 1.0.0-913292c
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 +16 -36
- package/dist/client.d.ts +27 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +183 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +8 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +15 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +61 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +48 -7
package/README.md
CHANGED
|
@@ -1,45 +1,25 @@
|
|
|
1
1
|
# @mailwurf/e2e
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`fetch` client for the tenant-scoped Mailwurf API at `/api/v1`. No Playwright dependency. The app keeps its real mail sender; tests only set the recipient.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Public on [npm](https://www.npmjs.com/package/@mailwurf/e2e).
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```bash
|
|
8
|
+
npm install @mailwurf/e2e
|
|
9
|
+
```
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
```ts
|
|
12
|
+
import { createClient } from "@mailwurf/e2e";
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
2. Enable secure, token-less publishing from CI/CD workflows
|
|
14
|
-
3. Establish provenance for packages published under this name
|
|
14
|
+
const mailwurf = createClient(); // MAILWURF_URL + MAILWURF_API_KEY
|
|
15
|
+
const inbox = await mailwurf.createInbox();
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
await page.fill("[name=email]", inbox.address);
|
|
18
|
+
await page.click("text=Sign up");
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
const mail = await inbox.waitFor({ subject: "Confirm", timeout: 15_000 });
|
|
21
|
+
await page.goto(mail.links[0]!);
|
|
22
|
+
// mail.otp → "482193"
|
|
23
|
+
```
|
|
19
24
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
To properly configure OIDC trusted publishing for this package:
|
|
23
|
-
|
|
24
|
-
1. Go to [npmjs.com](https://www.npmjs.com/) and navigate to your package settings
|
|
25
|
-
2. Configure the trusted publisher (e.g., GitHub Actions)
|
|
26
|
-
3. Specify the repository and workflow that should be allowed to publish
|
|
27
|
-
4. Use the configured workflow to publish your actual package
|
|
28
|
-
|
|
29
|
-
## DO NOT USE THIS PACKAGE
|
|
30
|
-
|
|
31
|
-
This package is a placeholder for OIDC configuration only. It:
|
|
32
|
-
- Contains no executable code
|
|
33
|
-
- Provides no functionality
|
|
34
|
-
- Should not be installed as a dependency
|
|
35
|
-
- Exists only for administrative purposes
|
|
36
|
-
|
|
37
|
-
## More Information
|
|
38
|
-
|
|
39
|
-
For more details about npm's trusted publishing feature, see:
|
|
40
|
-
- [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
|
|
41
|
-
- [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
**Maintained for OIDC setup purposes only**
|
|
25
|
+
`MAILWURF_URL` is the API origin (`https://api.dev.mailwurf.io` or the app origin). `MAILWURF_API_KEY` is an organization key (`mw_live_…`). `subject` is a case-insensitive substring. `timeout` is milliseconds.
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { CreateInboxInput, Inbox, ListMessagesOptions, MailwurfOptions, Message, WaitForOptions } from "./types.js";
|
|
2
|
+
export declare class Mailwurf {
|
|
3
|
+
#private;
|
|
4
|
+
readonly baseUrl: string;
|
|
5
|
+
constructor(options?: MailwurfOptions);
|
|
6
|
+
health(): Promise<void>;
|
|
7
|
+
createInbox(input?: CreateInboxInput): Promise<MailwurfInbox>;
|
|
8
|
+
getInbox(id: string): Promise<MailwurfInbox>;
|
|
9
|
+
inboxByAddress(address: string): Promise<MailwurfInbox>;
|
|
10
|
+
getMessage(id: string): Promise<Message>;
|
|
11
|
+
listMessages(inboxId: string, options?: ListMessagesOptions): Promise<Message[]>;
|
|
12
|
+
waitFor(inboxId: string, options?: WaitForOptions): Promise<Message>;
|
|
13
|
+
deleteInbox(id: string): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export declare class MailwurfInbox implements Inbox {
|
|
16
|
+
#private;
|
|
17
|
+
readonly id: string;
|
|
18
|
+
readonly address: string;
|
|
19
|
+
readonly createdAt: Date;
|
|
20
|
+
readonly expiresAt: Date | null;
|
|
21
|
+
constructor(client: Mailwurf, inbox: Inbox);
|
|
22
|
+
waitFor(options?: WaitForOptions): Promise<Message>;
|
|
23
|
+
messages(options?: ListMessagesOptions): Promise<Message[]>;
|
|
24
|
+
delete(): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
export declare function createClient(options?: MailwurfOptions): Mailwurf;
|
|
27
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,gBAAgB,EAChB,KAAK,EACL,mBAAmB,EACnB,eAAe,EACf,OAAO,EAGP,cAAc,EACf,MAAM,YAAY,CAAC;AA0DpB,qBAAa,QAAQ;;IACnB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;gBAIb,OAAO,GAAE,eAAoB;IAcnC,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAKvB,WAAW,CAAC,KAAK,GAAE,gBAAqB,GAAG,OAAO,CAAC,aAAa,CAAC;IAWjE,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAQ5C,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAQvD,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAQxC,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IASpF,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,OAAO,CAAC;IAiBxE,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAqC7C;AAED,qBAAa,aAAc,YAAW,KAAK;;IACzC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;gBAGpB,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK;IAQ1C,OAAO,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IAInD,QAAQ,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAI3D,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAGxB;AAED,wBAAgB,YAAY,CAAC,OAAO,GAAE,eAAoB,GAAG,QAAQ,CAEpE"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { MailwurfError, MailwurfTimeoutError } from "./errors.js";
|
|
2
|
+
function defaultBaseUrl() {
|
|
3
|
+
const env = globalThis.process?.env?.MAILWURF_URL;
|
|
4
|
+
if (env && env.length > 0) {
|
|
5
|
+
return env;
|
|
6
|
+
}
|
|
7
|
+
return "http://localhost:3000";
|
|
8
|
+
}
|
|
9
|
+
function defaultApiKey() {
|
|
10
|
+
const env = globalThis.process?.env?.MAILWURF_API_KEY;
|
|
11
|
+
if (env && env.length > 0) {
|
|
12
|
+
return env;
|
|
13
|
+
}
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
function trimSlash(url) {
|
|
17
|
+
return url.replace(/\/+$/, "");
|
|
18
|
+
}
|
|
19
|
+
function asInbox(raw) {
|
|
20
|
+
return {
|
|
21
|
+
id: raw.id,
|
|
22
|
+
address: raw.address,
|
|
23
|
+
createdAt: new Date(raw.created_at),
|
|
24
|
+
expiresAt: raw.expires_at ? new Date(raw.expires_at) : null,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function asMessage(raw) {
|
|
28
|
+
return {
|
|
29
|
+
id: raw.id,
|
|
30
|
+
inboxId: raw.inbox_id,
|
|
31
|
+
from: raw.from,
|
|
32
|
+
to: raw.to,
|
|
33
|
+
subject: raw.subject,
|
|
34
|
+
text: raw.text,
|
|
35
|
+
html: raw.html,
|
|
36
|
+
links: raw.links ?? [],
|
|
37
|
+
otp: raw.otp,
|
|
38
|
+
receivedAt: new Date(raw.received_at),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function query(params) {
|
|
42
|
+
const q = new URLSearchParams();
|
|
43
|
+
for (const [key, value] of Object.entries(params)) {
|
|
44
|
+
if (value === undefined || value === "") {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
q.set(key, String(value));
|
|
48
|
+
}
|
|
49
|
+
const s = q.toString();
|
|
50
|
+
return s ? `?${s}` : "";
|
|
51
|
+
}
|
|
52
|
+
export class Mailwurf {
|
|
53
|
+
baseUrl;
|
|
54
|
+
#fetch;
|
|
55
|
+
#apiKey;
|
|
56
|
+
constructor(options = {}) {
|
|
57
|
+
this.baseUrl = trimSlash(options.baseUrl ?? defaultBaseUrl());
|
|
58
|
+
this.#fetch = options.fetch ?? fetch;
|
|
59
|
+
this.#apiKey = options.apiKey ?? defaultApiKey();
|
|
60
|
+
}
|
|
61
|
+
#headers(extra) {
|
|
62
|
+
const headers = new Headers(extra);
|
|
63
|
+
if (this.#apiKey) {
|
|
64
|
+
headers.set("authorization", `Bearer ${this.#apiKey}`);
|
|
65
|
+
}
|
|
66
|
+
return headers;
|
|
67
|
+
}
|
|
68
|
+
async health() {
|
|
69
|
+
const res = await this.#fetch(`${this.baseUrl}/api/v1/health`);
|
|
70
|
+
await this.#read(res);
|
|
71
|
+
}
|
|
72
|
+
async createInbox(input = {}) {
|
|
73
|
+
const init = { method: "POST", headers: this.#headers() };
|
|
74
|
+
if (input.address) {
|
|
75
|
+
init.headers = this.#headers({ "content-type": "application/json" });
|
|
76
|
+
init.body = JSON.stringify({ address: input.address });
|
|
77
|
+
}
|
|
78
|
+
const res = await this.#fetch(`${this.baseUrl}/api/v1/inboxes`, init);
|
|
79
|
+
const raw = await this.#read(res);
|
|
80
|
+
return this.#wrap(asInbox(raw));
|
|
81
|
+
}
|
|
82
|
+
async getInbox(id) {
|
|
83
|
+
const res = await this.#fetch(`${this.baseUrl}/api/v1/inboxes/${encodeURIComponent(id)}`, {
|
|
84
|
+
headers: this.#headers(),
|
|
85
|
+
});
|
|
86
|
+
const raw = await this.#read(res);
|
|
87
|
+
return this.#wrap(asInbox(raw));
|
|
88
|
+
}
|
|
89
|
+
async inboxByAddress(address) {
|
|
90
|
+
const res = await this.#fetch(`${this.baseUrl}/api/v1/inboxes${query({ address })}`, {
|
|
91
|
+
headers: this.#headers(),
|
|
92
|
+
});
|
|
93
|
+
const raw = await this.#read(res);
|
|
94
|
+
return this.#wrap(asInbox(raw));
|
|
95
|
+
}
|
|
96
|
+
async getMessage(id) {
|
|
97
|
+
const res = await this.#fetch(`${this.baseUrl}/api/v1/messages/${encodeURIComponent(id)}`, {
|
|
98
|
+
headers: this.#headers(),
|
|
99
|
+
});
|
|
100
|
+
const raw = await this.#read(res);
|
|
101
|
+
return asMessage(raw);
|
|
102
|
+
}
|
|
103
|
+
async listMessages(inboxId, options = {}) {
|
|
104
|
+
const res = await this.#fetch(`${this.baseUrl}/api/v1/inboxes/${encodeURIComponent(inboxId)}/messages${query(options)}`, { headers: this.#headers() });
|
|
105
|
+
const raw = await this.#read(res);
|
|
106
|
+
return (raw.messages ?? []).map(asMessage);
|
|
107
|
+
}
|
|
108
|
+
async waitFor(inboxId, options = {}) {
|
|
109
|
+
const timeout = options.timeout ?? 15_000;
|
|
110
|
+
const res = await this.#fetch(`${this.baseUrl}/api/v1/inboxes/${encodeURIComponent(inboxId)}/messages/wait${query({
|
|
111
|
+
subject: options.subject,
|
|
112
|
+
after: options.after,
|
|
113
|
+
timeout,
|
|
114
|
+
})}`, { headers: this.#headers(), signal: options.signal });
|
|
115
|
+
if (res.status === 408) {
|
|
116
|
+
throw new MailwurfTimeoutError();
|
|
117
|
+
}
|
|
118
|
+
const raw = await this.#read(res);
|
|
119
|
+
return asMessage(raw);
|
|
120
|
+
}
|
|
121
|
+
async deleteInbox(id) {
|
|
122
|
+
const res = await this.#fetch(`${this.baseUrl}/api/v1/inboxes/${encodeURIComponent(id)}`, {
|
|
123
|
+
method: "DELETE",
|
|
124
|
+
headers: this.#headers(),
|
|
125
|
+
});
|
|
126
|
+
if (res.status === 204) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
await this.#read(res);
|
|
130
|
+
}
|
|
131
|
+
#wrap(inbox) {
|
|
132
|
+
return new MailwurfInbox(this, inbox);
|
|
133
|
+
}
|
|
134
|
+
async #read(res) {
|
|
135
|
+
const text = await res.text();
|
|
136
|
+
let body;
|
|
137
|
+
if (text.length > 0) {
|
|
138
|
+
try {
|
|
139
|
+
body = JSON.parse(text);
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
body = text;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (!res.ok) {
|
|
146
|
+
const message = body && typeof body === "object" && "error" in body && typeof body.error === "string"
|
|
147
|
+
? body.error
|
|
148
|
+
: res.statusText || `HTTP ${res.status}`;
|
|
149
|
+
if (res.status === 408) {
|
|
150
|
+
throw new MailwurfTimeoutError(message);
|
|
151
|
+
}
|
|
152
|
+
throw new MailwurfError(res.status, message);
|
|
153
|
+
}
|
|
154
|
+
return body;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
export class MailwurfInbox {
|
|
158
|
+
id;
|
|
159
|
+
address;
|
|
160
|
+
createdAt;
|
|
161
|
+
expiresAt;
|
|
162
|
+
#client;
|
|
163
|
+
constructor(client, inbox) {
|
|
164
|
+
this.#client = client;
|
|
165
|
+
this.id = inbox.id;
|
|
166
|
+
this.address = inbox.address;
|
|
167
|
+
this.createdAt = inbox.createdAt;
|
|
168
|
+
this.expiresAt = inbox.expiresAt;
|
|
169
|
+
}
|
|
170
|
+
waitFor(options) {
|
|
171
|
+
return this.#client.waitFor(this.id, options);
|
|
172
|
+
}
|
|
173
|
+
messages(options) {
|
|
174
|
+
return this.#client.listMessages(this.id, options);
|
|
175
|
+
}
|
|
176
|
+
delete() {
|
|
177
|
+
return this.#client.deleteInbox(this.id);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
export function createClient(options = {}) {
|
|
181
|
+
return new Mailwurf(options);
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAYlE,SAAS,cAAc;IACrB,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,EAAE,GAAG,EAAE,YAAY,CAAC;IAClD,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,uBAAuB,CAAC;AACjC,CAAC;AAED,SAAS,aAAa;IACpB,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,EAAE,GAAG,EAAE,gBAAgB,CAAC;IACtD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,YAAY,CAAC,UAA2B,EAAE;IACxD,OAAO,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC;AAC/B,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare class MailwurfError extends Error {
|
|
2
|
+
readonly status: number;
|
|
3
|
+
constructor(status: number, message: string);
|
|
4
|
+
}
|
|
5
|
+
export declare class MailwurfTimeoutError extends MailwurfError {
|
|
6
|
+
constructor(message?: string);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,aAAc,SAAQ,KAAK;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAK5C;AAED,qBAAa,oBAAqB,SAAQ,aAAa;gBACzC,OAAO,SAAY;CAIhC"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export class MailwurfError extends Error {
|
|
2
|
+
status;
|
|
3
|
+
constructor(status, message) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = "MailwurfError";
|
|
6
|
+
this.status = status;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export class MailwurfTimeoutError extends MailwurfError {
|
|
10
|
+
constructor(message = "timeout") {
|
|
11
|
+
super(408, message);
|
|
12
|
+
this.name = "MailwurfTimeoutError";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,aAAc,SAAQ,KAAK;IAC7B,MAAM,CAAS;IAExB,YAAY,MAAc,EAAE,OAAe;QACzC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED,MAAM,OAAO,oBAAqB,SAAQ,aAAa;IACrD,YAAY,OAAO,GAAG,SAAS;QAC7B,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { createClient, Mailwurf, MailwurfInbox } from "./client.js";
|
|
2
|
+
export { MailwurfError, MailwurfTimeoutError } from "./errors.js";
|
|
3
|
+
export type { CreateInboxInput, Inbox, ListMessagesOptions, MailwurfOptions, Message, WaitForOptions, } from "./types.js";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAClE,YAAY,EACV,gBAAgB,EAChB,KAAK,EACL,mBAAmB,EACnB,eAAe,EACf,OAAO,EACP,cAAc,GACf,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export type MailwurfOptions = {
|
|
2
|
+
/** Next.js API origin, e.g. `https://app.mailwurf.io` or `https://api.dev.mailwurf.io`. Calls are made under `/api/v1`. */
|
|
3
|
+
baseUrl?: string;
|
|
4
|
+
/** Organization API key. Defaults to `MAILWURF_API_KEY`. */
|
|
5
|
+
apiKey?: string;
|
|
6
|
+
/** Injected in tests. Defaults to global `fetch`. */
|
|
7
|
+
fetch?: typeof fetch;
|
|
8
|
+
};
|
|
9
|
+
export type CreateInboxInput = {
|
|
10
|
+
address?: string;
|
|
11
|
+
};
|
|
12
|
+
export type WaitForOptions = {
|
|
13
|
+
/** Case-insensitive substring matched against the subject (server-side). */
|
|
14
|
+
subject?: string;
|
|
15
|
+
/** Milliseconds to block. Default 15000. `0` is a single lookup. */
|
|
16
|
+
timeout?: number;
|
|
17
|
+
/** Skip messages up to and including this id. */
|
|
18
|
+
after?: string;
|
|
19
|
+
signal?: AbortSignal;
|
|
20
|
+
};
|
|
21
|
+
export type ListMessagesOptions = {
|
|
22
|
+
subject?: string;
|
|
23
|
+
after?: string;
|
|
24
|
+
};
|
|
25
|
+
export type Inbox = {
|
|
26
|
+
id: string;
|
|
27
|
+
address: string;
|
|
28
|
+
createdAt: Date;
|
|
29
|
+
expiresAt: Date | null;
|
|
30
|
+
};
|
|
31
|
+
export type Message = {
|
|
32
|
+
id: string;
|
|
33
|
+
inboxId: string;
|
|
34
|
+
from: string;
|
|
35
|
+
to: string;
|
|
36
|
+
subject: string;
|
|
37
|
+
text: string;
|
|
38
|
+
html: string;
|
|
39
|
+
links: string[];
|
|
40
|
+
otp: string;
|
|
41
|
+
receivedAt: Date;
|
|
42
|
+
};
|
|
43
|
+
export type RawInbox = {
|
|
44
|
+
id: string;
|
|
45
|
+
address: string;
|
|
46
|
+
created_at: string;
|
|
47
|
+
expires_at: string | null;
|
|
48
|
+
};
|
|
49
|
+
export type RawMessage = {
|
|
50
|
+
id: string;
|
|
51
|
+
inbox_id: string;
|
|
52
|
+
from: string;
|
|
53
|
+
to: string;
|
|
54
|
+
subject: string;
|
|
55
|
+
text: string;
|
|
56
|
+
html: string;
|
|
57
|
+
links: string[] | null;
|
|
58
|
+
otp: string;
|
|
59
|
+
received_at: string;
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,2HAA2H;IAC3H,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,IAAI,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,10 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailwurf/e2e",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
3
|
+
"version": "1.0.0-913292c",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Fetch client for the Mailwurf wait API",
|
|
5
6
|
"keywords": [
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
"e2e",
|
|
8
|
+
"email",
|
|
9
|
+
"inbox",
|
|
10
|
+
"mailwurf",
|
|
11
|
+
"playwright",
|
|
12
|
+
"testing"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://github.com/wemogy/mailwurf",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/wemogy/mailwurf/issues"
|
|
17
|
+
},
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/wemogy/mailwurf.git",
|
|
22
|
+
"directory": "src/frontend/packages/client"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
27
|
+
"type": "module",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"import": "./dist/index.js"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/node": "^24.0.0",
|
|
39
|
+
"typescript": "^5.9.2",
|
|
40
|
+
"vitest": "^3.2.6",
|
|
41
|
+
"@mailwurf/config": "0.0.0"
|
|
42
|
+
},
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=18"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "tsc -p tsconfig.build.json",
|
|
48
|
+
"typecheck": "tsc --noEmit",
|
|
49
|
+
"test": "vitest run"
|
|
50
|
+
}
|
|
51
|
+
}
|