@mailwurf/e2e 0.0.0 → 1.0.0-8b6eeb8

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 CHANGED
@@ -1,45 +1,31 @@
1
1
  # @mailwurf/e2e
2
2
 
3
- ## ⚠️ IMPORTANT NOTICE ⚠️
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
- **This package is created solely for the purpose of setting up OIDC (OpenID Connect) trusted publishing with npm.**
5
+ Public on [npm](https://www.npmjs.com/package/@mailwurf/e2e).
6
6
 
7
- This is **NOT** a functional package and contains **NO** code or functionality beyond the OIDC setup configuration.
7
+ ```bash
8
+ npm install @mailwurf/e2e
9
+ ```
8
10
 
9
- ## Purpose
11
+ ```ts
12
+ import { createClient } from "@mailwurf/e2e";
10
13
 
11
- This package exists to:
12
- 1. Configure OIDC trusted publishing for the package name `@mailwurf/e2e`
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(); // https://api.mailwurf.io + MAILWURF_API_KEY
15
+ const inbox = await mailwurf.createInbox();
15
16
 
16
- ## What is OIDC Trusted Publishing?
17
+ await page.fill("[name=email]", inbox.address);
18
+ await page.click("text=Sign up");
17
19
 
18
- OIDC trusted publishing allows package maintainers to publish packages directly from their CI/CD workflows without needing to manage npm access tokens. Instead, it uses OpenID Connect to establish trust between the CI/CD provider (like GitHub Actions) and npm.
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
- ## Setup Instructions
25
+ The client talks to `https://api.mailwurf.io` by default. Point it elsewhere with the `baseUrl` option or `MAILWURF_URL` (option wins). A bare host is treated as `https://`:
21
26
 
22
- To properly configure OIDC trusted publishing for this package:
27
+ ```ts
28
+ createClient({ baseUrl: "api.dev.mailwurf.io", apiKey: "mw_live_…" });
29
+ ```
23
30
 
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**
31
+ `MAILWURF_API_KEY` (or `apiKey`) is an organization key (`mw_live_…`). `subject` is a case-insensitive substring. `timeout` is milliseconds.
@@ -0,0 +1,28 @@
1
+ import type { CreateInboxInput, Inbox, ListMessagesOptions, MailwurfOptions, Message, WaitForOptions } from "./types.js";
2
+ export declare const DEFAULT_BASE_URL = "https://api.mailwurf.io";
3
+ export declare class Mailwurf {
4
+ #private;
5
+ readonly baseUrl: string;
6
+ constructor(options?: MailwurfOptions);
7
+ health(): Promise<void>;
8
+ createInbox(input?: CreateInboxInput): Promise<MailwurfInbox>;
9
+ getInbox(id: string): Promise<MailwurfInbox>;
10
+ inboxByAddress(address: string): Promise<MailwurfInbox>;
11
+ getMessage(id: string): Promise<Message>;
12
+ listMessages(inboxId: string, options?: ListMessagesOptions): Promise<Message[]>;
13
+ waitFor(inboxId: string, options?: WaitForOptions): Promise<Message>;
14
+ deleteInbox(id: string): Promise<void>;
15
+ }
16
+ export declare class MailwurfInbox implements Inbox {
17
+ #private;
18
+ readonly id: string;
19
+ readonly address: string;
20
+ readonly createdAt: Date;
21
+ readonly expiresAt: Date | null;
22
+ constructor(client: Mailwurf, inbox: Inbox);
23
+ waitFor(options?: WaitForOptions): Promise<Message>;
24
+ messages(options?: ListMessagesOptions): Promise<Message[]>;
25
+ delete(): Promise<void>;
26
+ }
27
+ export declare function createClient(options?: MailwurfOptions): Mailwurf;
28
+ //# 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;AAEpB,eAAO,MAAM,gBAAgB,4BAA4B,CAAC;AA4D1D,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,186 @@
1
+ import { MailwurfError, MailwurfTimeoutError } from "./errors.js";
2
+ export const DEFAULT_BASE_URL = "https://api.mailwurf.io";
3
+ function defaultBaseUrl() {
4
+ const env = globalThis.process?.env?.MAILWURF_URL;
5
+ if (env && env.length > 0) {
6
+ return env;
7
+ }
8
+ return DEFAULT_BASE_URL;
9
+ }
10
+ /** Accepts `api.mailwurf.io` as well as `https://api.mailwurf.io/`. */
11
+ function normalizeBaseUrl(url) {
12
+ const trimmed = url.trim().replace(/\/+$/, "");
13
+ return /^https?:\/\//i.test(trimmed) ? trimmed : `https://${trimmed}`;
14
+ }
15
+ function defaultApiKey() {
16
+ const env = globalThis.process?.env?.MAILWURF_API_KEY;
17
+ if (env && env.length > 0) {
18
+ return env;
19
+ }
20
+ return undefined;
21
+ }
22
+ function asInbox(raw) {
23
+ return {
24
+ id: raw.id,
25
+ address: raw.address,
26
+ createdAt: new Date(raw.created_at),
27
+ expiresAt: raw.expires_at ? new Date(raw.expires_at) : null,
28
+ };
29
+ }
30
+ function asMessage(raw) {
31
+ return {
32
+ id: raw.id,
33
+ inboxId: raw.inbox_id,
34
+ from: raw.from,
35
+ to: raw.to,
36
+ subject: raw.subject,
37
+ text: raw.text,
38
+ html: raw.html,
39
+ links: raw.links ?? [],
40
+ otp: raw.otp,
41
+ receivedAt: new Date(raw.received_at),
42
+ };
43
+ }
44
+ function query(params) {
45
+ const q = new URLSearchParams();
46
+ for (const [key, value] of Object.entries(params)) {
47
+ if (value === undefined || value === "") {
48
+ continue;
49
+ }
50
+ q.set(key, String(value));
51
+ }
52
+ const s = q.toString();
53
+ return s ? `?${s}` : "";
54
+ }
55
+ export class Mailwurf {
56
+ baseUrl;
57
+ #fetch;
58
+ #apiKey;
59
+ constructor(options = {}) {
60
+ this.baseUrl = normalizeBaseUrl(options.baseUrl ?? defaultBaseUrl());
61
+ this.#fetch = options.fetch ?? fetch;
62
+ this.#apiKey = options.apiKey ?? defaultApiKey();
63
+ }
64
+ #headers(extra) {
65
+ const headers = new Headers(extra);
66
+ if (this.#apiKey) {
67
+ headers.set("authorization", `Bearer ${this.#apiKey}`);
68
+ }
69
+ return headers;
70
+ }
71
+ async health() {
72
+ const res = await this.#fetch(`${this.baseUrl}/api/v1/health`);
73
+ await this.#read(res);
74
+ }
75
+ async createInbox(input = {}) {
76
+ const init = { method: "POST", headers: this.#headers() };
77
+ if (input.address) {
78
+ init.headers = this.#headers({ "content-type": "application/json" });
79
+ init.body = JSON.stringify({ address: input.address });
80
+ }
81
+ const res = await this.#fetch(`${this.baseUrl}/api/v1/inboxes`, init);
82
+ const raw = await this.#read(res);
83
+ return this.#wrap(asInbox(raw));
84
+ }
85
+ async getInbox(id) {
86
+ const res = await this.#fetch(`${this.baseUrl}/api/v1/inboxes/${encodeURIComponent(id)}`, {
87
+ headers: this.#headers(),
88
+ });
89
+ const raw = await this.#read(res);
90
+ return this.#wrap(asInbox(raw));
91
+ }
92
+ async inboxByAddress(address) {
93
+ const res = await this.#fetch(`${this.baseUrl}/api/v1/inboxes${query({ address })}`, {
94
+ headers: this.#headers(),
95
+ });
96
+ const raw = await this.#read(res);
97
+ return this.#wrap(asInbox(raw));
98
+ }
99
+ async getMessage(id) {
100
+ const res = await this.#fetch(`${this.baseUrl}/api/v1/messages/${encodeURIComponent(id)}`, {
101
+ headers: this.#headers(),
102
+ });
103
+ const raw = await this.#read(res);
104
+ return asMessage(raw);
105
+ }
106
+ async listMessages(inboxId, options = {}) {
107
+ const res = await this.#fetch(`${this.baseUrl}/api/v1/inboxes/${encodeURIComponent(inboxId)}/messages${query(options)}`, { headers: this.#headers() });
108
+ const raw = await this.#read(res);
109
+ return (raw.messages ?? []).map(asMessage);
110
+ }
111
+ async waitFor(inboxId, options = {}) {
112
+ const timeout = options.timeout ?? 15_000;
113
+ const res = await this.#fetch(`${this.baseUrl}/api/v1/inboxes/${encodeURIComponent(inboxId)}/messages/wait${query({
114
+ subject: options.subject,
115
+ after: options.after,
116
+ timeout,
117
+ })}`, { headers: this.#headers(), signal: options.signal });
118
+ if (res.status === 408) {
119
+ throw new MailwurfTimeoutError();
120
+ }
121
+ const raw = await this.#read(res);
122
+ return asMessage(raw);
123
+ }
124
+ async deleteInbox(id) {
125
+ const res = await this.#fetch(`${this.baseUrl}/api/v1/inboxes/${encodeURIComponent(id)}`, {
126
+ method: "DELETE",
127
+ headers: this.#headers(),
128
+ });
129
+ if (res.status === 204) {
130
+ return;
131
+ }
132
+ await this.#read(res);
133
+ }
134
+ #wrap(inbox) {
135
+ return new MailwurfInbox(this, inbox);
136
+ }
137
+ async #read(res) {
138
+ const text = await res.text();
139
+ let body;
140
+ if (text.length > 0) {
141
+ try {
142
+ body = JSON.parse(text);
143
+ }
144
+ catch {
145
+ body = text;
146
+ }
147
+ }
148
+ if (!res.ok) {
149
+ const message = body && typeof body === "object" && "error" in body && typeof body.error === "string"
150
+ ? body.error
151
+ : res.statusText || `HTTP ${res.status}`;
152
+ if (res.status === 408) {
153
+ throw new MailwurfTimeoutError(message);
154
+ }
155
+ throw new MailwurfError(res.status, message);
156
+ }
157
+ return body;
158
+ }
159
+ }
160
+ export class MailwurfInbox {
161
+ id;
162
+ address;
163
+ createdAt;
164
+ expiresAt;
165
+ #client;
166
+ constructor(client, inbox) {
167
+ this.#client = client;
168
+ this.id = inbox.id;
169
+ this.address = inbox.address;
170
+ this.createdAt = inbox.createdAt;
171
+ this.expiresAt = inbox.expiresAt;
172
+ }
173
+ waitFor(options) {
174
+ return this.#client.waitFor(this.id, options);
175
+ }
176
+ messages(options) {
177
+ return this.#client.listMessages(this.id, options);
178
+ }
179
+ delete() {
180
+ return this.#client.deleteInbox(this.id);
181
+ }
182
+ }
183
+ export function createClient(options = {}) {
184
+ return new Mailwurf(options);
185
+ }
186
+ //# 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,MAAM,CAAC,MAAM,gBAAgB,GAAG,yBAAyB,CAAC;AAE1D,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,gBAAgB,CAAC;AAC1B,CAAC;AAED,uEAAuE;AACvE,SAAS,gBAAgB,CAAC,GAAW;IACnC,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC/C,OAAO,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,OAAO,EAAE,CAAC;AACxE,CAAC;AAED,SAAS,aAAa;IACpB,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,EAAE,GAAG,EAAE,gBAAgB,CAAC;IACtD,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,SAAS,CAAC;AAC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K,GAAG,EAAE,CAAC;gBACvB,MAAM,IAAI,oBAAoB,CAAC,OAAO,CAAC,CAAC;YAC1C,CAAC;YACD,MAAM,IAAI,aAAa,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC/C,CAAC;QACD,OAAO,IAAS,CAAC;IACnB,CAAC;CACF;AAED,MAAM,OAAO,aAAa;IACf,EAAE,CAAS;IACX,OAAO,CAAS;IAChB,SAAS,CAAO;IAChB,SAAS,CAAc;IACvB,OAAO,CAAW;IAE3B,YAAY,MAAgB,EAAE,KAAY;QACxC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;QACnB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;IACnC,CAAC;IAED,OAAO,CAAC,OAAwB;QAC9B,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;IAED,QAAQ,CAAC,OAA6B;QACpC,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC3C,CAAC;CACF;AAED,MAAM,UAAU,YAAY,CAAC,UAA2B,EAAE;IACxD,OAAO,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC;AAC/B,CAAC"}
@@ -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"}
@@ -0,0 +1,4 @@
1
+ export { createClient, DEFAULT_BASE_URL, 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,gBAAgB,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACtF,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,3 @@
1
+ export { createClient, DEFAULT_BASE_URL, Mailwurf, MailwurfInbox } from "./client.js";
2
+ export { MailwurfError, MailwurfTimeoutError } from "./errors.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,65 @@
1
+ export type MailwurfOptions = {
2
+ /**
3
+ * Mailbox API origin. Calls are made under `/api/v1`.
4
+ * Defaults to `MAILWURF_URL`, then `https://api.mailwurf.io`.
5
+ * A bare host such as `api.dev.mailwurf.io` is treated as `https://`.
6
+ */
7
+ baseUrl?: string;
8
+ /** Organization API key. Defaults to `MAILWURF_API_KEY`. */
9
+ apiKey?: string;
10
+ /** Injected in tests. Defaults to global `fetch`. */
11
+ fetch?: typeof fetch;
12
+ };
13
+ export type CreateInboxInput = {
14
+ address?: string;
15
+ };
16
+ export type WaitForOptions = {
17
+ /** Case-insensitive substring matched against the subject (server-side). */
18
+ subject?: string;
19
+ /** Milliseconds to block. Default 15000. `0` is a single lookup. */
20
+ timeout?: number;
21
+ /** Skip messages up to and including this id. */
22
+ after?: string;
23
+ signal?: AbortSignal;
24
+ };
25
+ export type ListMessagesOptions = {
26
+ subject?: string;
27
+ after?: string;
28
+ };
29
+ export type Inbox = {
30
+ id: string;
31
+ address: string;
32
+ createdAt: Date;
33
+ expiresAt: Date | null;
34
+ };
35
+ export type Message = {
36
+ id: string;
37
+ inboxId: string;
38
+ from: string;
39
+ to: string;
40
+ subject: string;
41
+ text: string;
42
+ html: string;
43
+ links: string[];
44
+ otp: string;
45
+ receivedAt: Date;
46
+ };
47
+ export type RawInbox = {
48
+ id: string;
49
+ address: string;
50
+ created_at: string;
51
+ expires_at: string | null;
52
+ };
53
+ export type RawMessage = {
54
+ id: string;
55
+ inbox_id: string;
56
+ from: string;
57
+ to: string;
58
+ subject: string;
59
+ text: string;
60
+ html: string;
61
+ links: string[] | null;
62
+ otp: string;
63
+ received_at: string;
64
+ };
65
+ //# 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;;;;OAIG;IACH,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,MAA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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": "0.0.0",
4
- "description": "OIDC trusted publishing setup package for @mailwurf/e2e",
3
+ "version": "1.0.0-8b6eeb8",
4
+ "private": false,
5
+ "description": "Fetch client for the Mailwurf wait API",
5
6
  "keywords": [
6
- "oidc",
7
- "trusted-publishing",
8
- "setup"
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
+ }