temp-disposable-email 1.1.0 → 1.2.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/CHANGELOG.md CHANGED
@@ -1,4 +1,13 @@
1
- # 1.1.0 (2024-11-28)
1
+ # [1.2.0](https://github.com/pirasanthan-jesugeevegan/temp-disposable-email/compare/v1.1.0...v1.2.0) (2024-11-28)
2
+
3
+
4
+ ### Features
5
+
6
+ * update main entry point to TypeScript source file ([3332c21](https://github.com/pirasanthan-jesugeevegan/temp-disposable-email/commit/3332c2147b825384ed52b068b95172f4fa3e94bd))
7
+
8
+
9
+
10
+ # [1.1.0](https://github.com/pirasanthan-jesugeevegan/temp-disposable-email/compare/d886b69f54169b24654ea60de37985a522058ac8...v1.1.0) (2024-11-28)
2
11
 
3
12
 
4
13
  ### Features
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "temp-disposable-email",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "",
5
- "main": "dist/index.js",
5
+ "main": "src/index.ts",
6
6
  "scripts": {
7
7
  "build": "tsc",
8
8
  "test": "jest",
package/dist/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export { createInbox, deleteAccount } from './services/accountService';
2
- export { getRecentEmail, deleteMessage, MessageContent, GetEmailOptions, } from './services/messageService';
3
- export { getVerificationCode } from './utils/getVerificationCode';
@@ -1,36 +0,0 @@
1
- /**
2
- * Creates a new email inbox with a unique address.
3
- *
4
- * This function selects an available domain, generates an email
5
- * address, and attempts to create an account on the Mail.tm service.
6
- * If account creation is rate-limited, the function retries with a
7
- * delay. Upon successful creation, it authenticates the account and
8
- * stores the token and account ID for future API calls.
9
- *
10
- * @param {string} [username] - Optional username; a random one is generated if not provided.
11
- * @returns {Promise<string>} The generated email address.
12
- *
13
- * @throws {Error} If no domains are available or account creation fails.
14
- *
15
- * @example
16
- * const email = await createInbox("customUser");
17
- * console.log(email); // Outputs: "customUser@mail.tm"
18
- */
19
- export declare const createInbox: (username?: string) => Promise<string>;
20
- /**
21
- * Deletes the account created during `createInbox`.
22
- *
23
- * This function removes the email account from the Mail.tm service
24
- * and clears the stored authentication token and account ID.
25
- * Subsequent API calls requiring authentication will fail until a
26
- * new account is created.
27
- *
28
- * @returns {Promise<void>} Resolves when the account is successfully deleted.
29
- *
30
- * @throws {Error} If no account is authenticated or deletion fails.
31
- *
32
- * @example
33
- * await deleteAccount();
34
- * console.log("Account deleted successfully.");
35
- */
36
- export declare const deleteAccount: () => Promise<void>;
@@ -1,2 +0,0 @@
1
- export declare const authenticate: (email: string, password: string) => Promise<void>;
2
- export declare const getToken: () => string | null;
@@ -1,53 +0,0 @@
1
- export interface MessageContent {
2
- from: {
3
- address: string;
4
- };
5
- to: {
6
- address: string;
7
- }[];
8
- subject: string;
9
- intro: string;
10
- text: string;
11
- html: string;
12
- }
13
- export interface GetEmailOptions {
14
- maxWaitTime?: number;
15
- waitInterval?: number;
16
- logPolling?: boolean;
17
- deleteAfterRead?: boolean;
18
- }
19
- /**
20
- * Retrieves the latest message from the inbox.
21
- *
22
- * If messages are available, this function fetches the first one and
23
- * returns its details. Polling options can be specified to wait for
24
- * messages if the inbox is empty. Optionally, the message can be
25
- * deleted after reading.
26
- *
27
- * @param {GetEmailOptions} [options] - Optional settings for polling and deletion.
28
- * @returns {Promise<MessageContent | null>} The email content (sender, recipient, subject, text, HTML), or `null` if no messages are found.
29
- *
30
- * @throws {Error} If no messages are available within the polling timeout or authentication fails.
31
- *
32
- * @example
33
- * const message = await getRecentEmail({ maxWaitTime: 5000, waitInterval: 1000, logPolling: true });
34
- * console.log(message.subject); // Outputs: "Hello!"
35
- */
36
- export declare const getRecentEmail: (options?: GetEmailOptions) => Promise<MessageContent | null>;
37
- /**
38
- * Deletes a message by its unique ID from the Mail.tm inbox.
39
- *
40
- * This function requires a valid authentication token. If the
41
- * token is not set, an error is thrown. The message is deleted
42
- * using the Mail.tm API, and a success or failure message is logged.
43
- *
44
- * @param {string} messageId - The unique ID of the message to delete.
45
- * @returns {Promise<void>} Resolves after the message is deleted.
46
- *
47
- * @throws {Error} If authentication is missing or the deletion fails.
48
- *
49
- * @example
50
- * await deleteMessage("12345");
51
- * console.log("Message deleted successfully.");
52
- */
53
- export declare const deleteMessage: (messageId: string) => Promise<void>;
@@ -1,6 +0,0 @@
1
- export declare const getAuthHeaders: () => {
2
- accept: string;
3
- Authorization: string;
4
- };
5
- export declare const fetchMessages: () => Promise<any[]>;
6
- export declare const fetchMessageContent: (messageId: string) => Promise<any>;
@@ -1 +0,0 @@
1
- export declare const BASE_URL: string | undefined;
@@ -1 +0,0 @@
1
- export declare const delay: (ms: number) => Promise<void>;
@@ -1 +0,0 @@
1
- export declare const generateRandomName: () => string;
@@ -1,16 +0,0 @@
1
- /**
2
- * Extracts a verification code from the provided email content.
3
- *
4
- * This function scans the given text for a sequence of 5 or more
5
- * consecutive digits and returns the first valid verification code.
6
- * If no valid sequence is found, the function returns `null`.
7
- *
8
- * @param {string} text - The content of the email, typically the body.
9
- * @returns {Promise<string | null>} The first verification code found, or `null` if no valid code exists.
10
- *
11
- * @example
12
- * const emailContent = "Your code is 123456.";
13
- * const verificationCode = await getVerificationCode(emailContent);
14
- * console.log(verificationCode); // Output: "123456"
15
- */
16
- export declare const getVerificationCode: (text: string) => Promise<string | null>;