tempmail-sdk 1.0.2 → 1.1.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 +7 -3
- package/dist/index.d.ts +94 -1
- package/dist/index.js +169 -37
- package/dist/logger.d.ts +73 -0
- package/dist/logger.js +100 -0
- package/dist/normalize.d.ts +7 -0
- package/dist/normalize.js +47 -2
- package/dist/providers/guerrillamail.d.ts +22 -0
- package/dist/providers/guerrillamail.js +71 -0
- package/dist/providers/mail-tm.js +8 -3
- package/dist/providers/maildrop.d.ts +21 -0
- package/dist/providers/maildrop.js +180 -0
- package/dist/providers/temp-mail-io.js +54 -24
- package/dist/retry.d.ts +38 -0
- package/dist/retry.js +121 -0
- package/dist/types.d.ts +88 -1
- package/dist/types.js +1 -1
- package/package.json +1 -1
- package/src/index.ts +165 -42
- package/src/logger.ts +106 -0
- package/src/normalize.ts +46 -1
- package/src/providers/guerrillamail.ts +78 -0
- package/src/providers/mail-tm.ts +7 -2
- package/src/providers/maildrop.ts +210 -0
- package/src/providers/temp-mail-io.ts +55 -23
- package/src/retry.ts +146 -0
- package/src/types.ts +89 -1
package/dist/types.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICog5pSv5oyB55qE5Li05pe26YKu566x5rig6YGT5qCH6K+GXG4gKiDmr4/kuKrmuKDpgZPlr7nlupTkuIDkuKrnrKzkuInmlrnkuLTml7bpgq7nrrHmnI3liqHllYZcbiAqL1xuZ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5Q29uZmlnIHtcbiAgLyoqIOacgOWkp+mHjeivleasoeaVsO+8iOS4jeWQq+mmluasoeivt+axgu+8ie+8jOm7mOiupCAyICovXG4gIG1heFJldHJpZXM/OiBudW1iZXI7XG4gIC8qKiDliJ3lp4vph43or5Xlu7bov5/vvIjmr6vnp5LvvInvvIzph4fnlKjmjIfmlbDpgIDpgb/nrZbnlaXvvIzpu5jorqQgMTAwMCAqL1xuICBpbml0aWFsRGVsYXk/OiBudW1iZXI7XG4gIC8qKiDmnIDlpKfph43or5Xlu7bov5/kuIrpmZDvvIjmr6vnp5LvvInvvIzpu5jorqQgNTAwMCAqL1xuICBtYXhEZWxheT86IG51bWJlcjtcbiAgLyoqIOWNleasoeivt+axgui2heaXtuaXtumXtO+8iOavq+enku+8ie+8jOm7mOiupCAxNTAwMCAqL1xuICB0aW1lb3V0PzogbnVtYmVyO1xufVxuXG4vKipcbiAqIOWIm+W7uuS4tOaXtumCrueuseeahOmAiemhuVxuICpcbiAqIEBleGFtcGxlXG4gKiBgYGB0c1xuICogLy8g5L2/55So5oyH5a6a5rig6YGT5Yib5bu66YKu566xXG4gKiBjb25zdCBlbWFpbCA9IGF3YWl0IGdlbmVyYXRlRW1haWwoeyBjaGFubmVsOiAnbWFpbC10bScgfSk7XG4gKlxuICogLy8g6ZqP5py66YCJ5oup5rig6YGTXG4gKiBjb25zdCBlbWFpbCA9IGF3YWl0IGdlbmVyYXRlRW1haWwoKTtcbiAqIGBgYFxuICovXG5leHBvcnQgaW50ZXJmYWNlIEdlbmVyYXRlRW1haWxPcHRpb25zIHtcbiAgLyoqIOaMh+Wumua4oOmBk++8jOS4jeS8oOWImemaj+acuumAieaLqSAqL1xuICBjaGFubmVsPzogQ2hhbm5lbDtcbiAgLyoqIOmCrueuseacieaViOaXtumVvyAqL1xuICBkdXJhdGlvbj86IG51bWJlcjtcbiAgLyoqIOaMh+WumumCrueuseWfn+WQjSAqL1xuICBkb21haW4/OiBzdHJpbmcgfCBudWxsO1xuICAvKiog6YeN6K+V6YWN572u77yM5LiN5Lyg5YiZ5L2/55So6buY6K6k5YC877yI5pyA5aSa6YeN6K+VIDIg5qyh77yJICovXG4gIHJldHJ5PzogUmV0cnlDb25maWc7XG59XG5cbi8qKlxuICog6I635Y+W6YKu5Lu25YiX6KGo55qE6YCJ6aG5XG4gKlxuICogQGV4YW1wbGVcbiAqIGBgYHRzXG4gKiBjb25zdCByZXN1bHQgPSBhd2FpdCBnZXRFbWFpbHMoe1xuICogICBjaGFubmVsOiBlbWFpbEluZm8uY2hhbm5lbCxcbiAqICAgZW1haWw6IGVtYWlsSW5mby5lbWFpbCxcbiAqICAgdG9rZW46IGVtYWlsSW5mby50b2tlbixcbiAqIH0pO1xuICogaWYgKHJlc3VsdC5zdWNjZXNzICYmIHJlc3VsdC5lbWFpbHMubGVuZ3RoID4gMCkge1xuICogICBjb25zb2xlLmxvZygn5pS25Yiw6YKu5Lu2OicsIHJlc3VsdC5lbWFpbHMpO1xuICogfVxuICogYGBgXG4gKi9cbmV4cG9ydCBpbnRlcmZhY2UgR2V0RW1haWxzT3B0aW9ucyB7XG4gIC8qKiDmuKDpgZPmoIfor4bvvIzlv4XloasgKi9cbiAgY2hhbm5lbDogQ2hhbm5lbDtcbiAgLyoqIOmCrueuseWcsOWdgO+8jOW/heWhqyAqL1xuICBlbWFpbDogc3RyaW5nO1xuICAvKiog6K6k6K+B5Luk54mMICovXG4gIHRva2VuPzogc3RyaW5nO1xuICAvKiog6YeN6K+V6YWN572u77yM5LiN5Lyg5YiZ5L2/55So6buY6K6k5YC877yI5pyA5aSa6YeN6K+VIDIg5qyh77yJICovXG4gIHJldHJ5PzogUmV0cnlDb25maWc7XG59XG4iXX0=
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -7,11 +7,18 @@ import * as tempMailIO from './providers/temp-mail-io';
|
|
|
7
7
|
import * as awamail from './providers/awamail';
|
|
8
8
|
import * as mailTm from './providers/mail-tm';
|
|
9
9
|
import * as dropmail from './providers/dropmail';
|
|
10
|
+
import * as guerrillamail from './providers/guerrillamail';
|
|
11
|
+
import * as maildropProvider from './providers/maildrop';
|
|
10
12
|
import { Channel, EmailInfo, Email, EmailAttachment, GetEmailsResult, GenerateEmailOptions, GetEmailsOptions } from './types';
|
|
13
|
+
import { withRetry, RetryOptions } from './retry';
|
|
14
|
+
import { logger } from './logger';
|
|
11
15
|
|
|
12
16
|
export { Channel, EmailInfo, Email, EmailAttachment, GetEmailsResult, GenerateEmailOptions, GetEmailsOptions } from './types';
|
|
13
17
|
export { normalizeEmail } from './normalize';
|
|
18
|
+
export { withRetry, fetchWithTimeout, RetryOptions } from './retry';
|
|
19
|
+
export { LogLevel, LogHandler, setLogLevel, getLogLevel, setLogger, logger } from './logger';
|
|
14
20
|
|
|
21
|
+
/** 渠道名称到 provider 实现的映射表 */
|
|
15
22
|
const providers = {
|
|
16
23
|
'tempmail': tempmail,
|
|
17
24
|
'linshi-email': linshiEmail,
|
|
@@ -22,16 +29,26 @@ const providers = {
|
|
|
22
29
|
'awamail': awamail,
|
|
23
30
|
'mail-tm': mailTm,
|
|
24
31
|
'dropmail': dropmail,
|
|
32
|
+
'guerrillamail': guerrillamail,
|
|
33
|
+
'maildrop': maildropProvider,
|
|
25
34
|
};
|
|
26
35
|
|
|
27
|
-
|
|
36
|
+
/** 所有支持的渠道列表,用于随机选择和遍历 */
|
|
37
|
+
const allChannels: Channel[] = ['tempmail', 'linshi-email', 'tempmail-lol', 'chatgpt-org-uk', 'tempmail-la', 'temp-mail-io', 'awamail', 'mail-tm', 'dropmail', 'guerrillamail', 'maildrop'];
|
|
28
38
|
|
|
39
|
+
/**
|
|
40
|
+
* 渠道信息,包含渠道标识、显示名称和对应网站
|
|
41
|
+
*/
|
|
29
42
|
export interface ChannelInfo {
|
|
43
|
+
/** 渠道标识 */
|
|
30
44
|
channel: Channel;
|
|
45
|
+
/** 渠道显示名称 */
|
|
31
46
|
name: string;
|
|
47
|
+
/** 对应的临时邮箱服务网站 */
|
|
32
48
|
website: string;
|
|
33
49
|
}
|
|
34
50
|
|
|
51
|
+
/** 渠道信息映射表 */
|
|
35
52
|
const channelInfoMap: Record<Channel, ChannelInfo> = {
|
|
36
53
|
'tempmail': { channel: 'tempmail', name: 'TempMail', website: 'tempmail.ing' },
|
|
37
54
|
'linshi-email': { channel: 'linshi-email', name: '临时邮箱', website: 'linshi-email.com' },
|
|
@@ -42,25 +59,66 @@ const channelInfoMap: Record<Channel, ChannelInfo> = {
|
|
|
42
59
|
'awamail': { channel: 'awamail', name: 'AwaMail', website: 'awamail.com' },
|
|
43
60
|
'mail-tm': { channel: 'mail-tm', name: 'Mail.tm', website: 'mail.tm' },
|
|
44
61
|
'dropmail': { channel: 'dropmail', name: 'DropMail', website: 'dropmail.me' },
|
|
62
|
+
'guerrillamail': { channel: 'guerrillamail', name: 'Guerrilla Mail', website: 'guerrillamail.com' },
|
|
63
|
+
'maildrop': { channel: 'maildrop', name: 'Maildrop', website: 'maildrop.cc' },
|
|
45
64
|
};
|
|
46
65
|
|
|
47
66
|
/**
|
|
48
67
|
* 获取所有支持的渠道列表
|
|
68
|
+
*
|
|
69
|
+
* @returns 所有渠道的信息数组
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* const channels = listChannels();
|
|
74
|
+
* channels.forEach(ch => console.log(`${ch.name} (${ch.website})`));
|
|
75
|
+
* ```
|
|
49
76
|
*/
|
|
50
77
|
export function listChannels(): ChannelInfo[] {
|
|
51
78
|
return allChannels.map(ch => channelInfoMap[ch]);
|
|
52
79
|
}
|
|
53
80
|
|
|
54
81
|
/**
|
|
55
|
-
*
|
|
82
|
+
* 获取指定渠道的详细信息
|
|
83
|
+
*
|
|
84
|
+
* @param channel - 渠道标识
|
|
85
|
+
* @returns 渠道信息,不存在时返回 undefined
|
|
56
86
|
*/
|
|
57
87
|
export function getChannelInfo(channel: Channel): ChannelInfo | undefined {
|
|
58
88
|
return channelInfoMap[channel];
|
|
59
89
|
}
|
|
60
90
|
|
|
91
|
+
/**
|
|
92
|
+
* 创建临时邮箱
|
|
93
|
+
*
|
|
94
|
+
* 错误处理策略:
|
|
95
|
+
* - 网络错误、超时、服务端 5xx 错误 → 自动重试(默认 2 次,指数退避)
|
|
96
|
+
* - 4xx 客户端错误、参数错误 → 直接抛出异常
|
|
97
|
+
*
|
|
98
|
+
* @param options - 创建选项,可指定渠道、有效时长、域名等
|
|
99
|
+
* @returns 邮箱信息,包含地址、令牌等
|
|
100
|
+
* @throws 重试耗尽后仍失败时抛出异常
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```ts
|
|
104
|
+
* const emailInfo = await generateEmail({ channel: 'temp-mail-io' });
|
|
105
|
+
* console.log(emailInfo.email); // 临时邮箱地址
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
61
108
|
export async function generateEmail(options: GenerateEmailOptions = {}): Promise<EmailInfo> {
|
|
62
109
|
const channel = options.channel || allChannels[Math.floor(Math.random() * allChannels.length)];
|
|
63
|
-
|
|
110
|
+
|
|
111
|
+
logger.info(`创建临时邮箱, 渠道: ${channel}`);
|
|
112
|
+
const result = await withRetry(() => generateEmailOnce(channel, options), options.retry);
|
|
113
|
+
logger.info(`邮箱创建成功: ${result.email}`);
|
|
114
|
+
return result;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* 单次创建邮箱(不含重试逻辑)
|
|
119
|
+
* 根据渠道类型分发到对应的 provider 实现
|
|
120
|
+
*/
|
|
121
|
+
async function generateEmailOnce(channel: Channel, options: GenerateEmailOptions): Promise<EmailInfo> {
|
|
64
122
|
switch (channel) {
|
|
65
123
|
case 'tempmail':
|
|
66
124
|
return tempmail.generateEmail(options.duration || 30);
|
|
@@ -80,14 +138,44 @@ export async function generateEmail(options: GenerateEmailOptions = {}): Promise
|
|
|
80
138
|
return mailTm.generateEmail();
|
|
81
139
|
case 'dropmail':
|
|
82
140
|
return dropmail.generateEmail();
|
|
141
|
+
case 'guerrillamail':
|
|
142
|
+
return guerrillamail.generateEmail();
|
|
143
|
+
case 'maildrop':
|
|
144
|
+
return maildropProvider.generateEmail();
|
|
83
145
|
default:
|
|
84
146
|
throw new Error(`Unknown channel: ${channel}`);
|
|
85
147
|
}
|
|
86
148
|
}
|
|
87
149
|
|
|
150
|
+
/**
|
|
151
|
+
* 获取邮件列表
|
|
152
|
+
*
|
|
153
|
+
* 错误处理策略:
|
|
154
|
+
* - 网络错误、超时、服务端 5xx 错误 → 自动重试(默认 2 次)
|
|
155
|
+
* - 重试耗尽后返回 { success: false, emails: [] },不抛异常
|
|
156
|
+
* - 参数校验错误(缺少 channel / token)直接抛出
|
|
157
|
+
*
|
|
158
|
+
* 这种设计让调用方在轮询场景下不会因网络波动而中断整个流程,
|
|
159
|
+
* 只需检查 success 字段即可判断本次请求是否成功。
|
|
160
|
+
*
|
|
161
|
+
* @param options - 获取选项,包含渠道、邮箱地址、令牌
|
|
162
|
+
* @returns 邮件结果,包含 success 标记和邮件列表
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* ```ts
|
|
166
|
+
* const result = await getEmails({
|
|
167
|
+
* channel: emailInfo.channel,
|
|
168
|
+
* email: emailInfo.email,
|
|
169
|
+
* token: emailInfo.token,
|
|
170
|
+
* });
|
|
171
|
+
* if (result.success && result.emails.length > 0) {
|
|
172
|
+
* console.log('收到邮件:', result.emails[0].subject);
|
|
173
|
+
* }
|
|
174
|
+
* ```
|
|
175
|
+
*/
|
|
88
176
|
export async function getEmails(options: GetEmailsOptions): Promise<GetEmailsResult> {
|
|
89
177
|
const { channel, email, token } = options;
|
|
90
|
-
|
|
178
|
+
|
|
91
179
|
if (!channel) {
|
|
92
180
|
throw new Error('Channel is required');
|
|
93
181
|
}
|
|
@@ -95,68 +183,99 @@ export async function getEmails(options: GetEmailsOptions): Promise<GetEmailsRes
|
|
|
95
183
|
throw new Error('Email is required');
|
|
96
184
|
}
|
|
97
185
|
|
|
98
|
-
|
|
186
|
+
logger.debug(`获取邮件, 渠道: ${channel}, 邮箱: ${email}`);
|
|
187
|
+
try {
|
|
188
|
+
const emails = await withRetry(() => getEmailsOnce(channel, email, token), options.retry);
|
|
189
|
+
if (emails.length > 0) {
|
|
190
|
+
logger.info(`获取到 ${emails.length} 封邮件, 渠道: ${channel}`);
|
|
191
|
+
} else {
|
|
192
|
+
logger.debug(`暂无邮件, 渠道: ${channel}`);
|
|
193
|
+
}
|
|
194
|
+
return { channel, email, emails, success: true };
|
|
195
|
+
} catch (err: any) {
|
|
196
|
+
/*
|
|
197
|
+
* 重试耗尽后仍然失败 → 返回空结果而非抛异常
|
|
198
|
+
* 这样调用方在轮询场景下不会因为一次网络波动而中断整个流程
|
|
199
|
+
*/
|
|
200
|
+
logger.error(`获取邮件失败, 渠道: ${channel}, 错误: ${err.message || err}`);
|
|
201
|
+
return { channel, email, emails: [], success: false };
|
|
202
|
+
}
|
|
203
|
+
}
|
|
99
204
|
|
|
205
|
+
/**
|
|
206
|
+
* 单次获取邮件(不含重试逻辑)
|
|
207
|
+
* 根据渠道类型分发到对应的 provider 实现,并校验必需的 token 参数
|
|
208
|
+
*/
|
|
209
|
+
async function getEmailsOnce(channel: Channel, email: string, token?: string): Promise<Email[]> {
|
|
100
210
|
switch (channel) {
|
|
101
211
|
case 'tempmail':
|
|
102
|
-
|
|
103
|
-
break;
|
|
212
|
+
return tempmail.getEmails(email);
|
|
104
213
|
case 'linshi-email':
|
|
105
|
-
|
|
106
|
-
break;
|
|
214
|
+
return linshiEmail.getEmails(email);
|
|
107
215
|
case 'tempmail-lol':
|
|
108
|
-
if (!token)
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
emails = await tempmailLol.getEmails(token, email);
|
|
112
|
-
break;
|
|
216
|
+
if (!token) throw new Error('Token is required for tempmail-lol channel');
|
|
217
|
+
return tempmailLol.getEmails(token, email);
|
|
113
218
|
case 'chatgpt-org-uk':
|
|
114
|
-
|
|
115
|
-
break;
|
|
219
|
+
return chatgptOrgUk.getEmails(email);
|
|
116
220
|
case 'tempmail-la':
|
|
117
|
-
|
|
118
|
-
break;
|
|
221
|
+
return tempmailLa.getEmails(email);
|
|
119
222
|
case 'temp-mail-io':
|
|
120
|
-
|
|
121
|
-
break;
|
|
223
|
+
return tempMailIO.getEmails(email);
|
|
122
224
|
case 'awamail':
|
|
123
|
-
if (!token)
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
emails = await awamail.getEmails(token, email);
|
|
127
|
-
break;
|
|
225
|
+
if (!token) throw new Error('Token is required for awamail channel');
|
|
226
|
+
return awamail.getEmails(token, email);
|
|
128
227
|
case 'mail-tm':
|
|
129
|
-
if (!token)
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
emails = await mailTm.getEmails(token, email);
|
|
133
|
-
break;
|
|
228
|
+
if (!token) throw new Error('Token is required for mail-tm channel');
|
|
229
|
+
return mailTm.getEmails(token, email);
|
|
134
230
|
case 'dropmail':
|
|
135
|
-
if (!token)
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
231
|
+
if (!token) throw new Error('Token is required for dropmail channel');
|
|
232
|
+
return dropmail.getEmails(token, email);
|
|
233
|
+
case 'guerrillamail':
|
|
234
|
+
if (!token) throw new Error('Token is required for guerrillamail channel');
|
|
235
|
+
return guerrillamail.getEmails(token, email);
|
|
236
|
+
case 'maildrop':
|
|
237
|
+
if (!token) throw new Error('Token is required for maildrop channel');
|
|
238
|
+
return maildropProvider.getEmails(token, email);
|
|
140
239
|
default:
|
|
141
240
|
throw new Error(`Unknown channel: ${channel}`);
|
|
142
241
|
}
|
|
143
|
-
|
|
144
|
-
return {
|
|
145
|
-
channel,
|
|
146
|
-
email,
|
|
147
|
-
emails,
|
|
148
|
-
success: true,
|
|
149
|
-
};
|
|
150
242
|
}
|
|
151
243
|
|
|
244
|
+
/**
|
|
245
|
+
* 临时邮箱客户端
|
|
246
|
+
* 封装了邮箱创建和邮件获取的完整流程,自动管理邮箱信息和认证令牌
|
|
247
|
+
*
|
|
248
|
+
* @example
|
|
249
|
+
* ```ts
|
|
250
|
+
* const client = new TempEmailClient();
|
|
251
|
+
* const emailInfo = await client.generate({ channel: 'mail-tm' });
|
|
252
|
+
* console.log('邮箱:', emailInfo.email);
|
|
253
|
+
*
|
|
254
|
+
* // 轮询获取邮件
|
|
255
|
+
* const result = await client.getEmails();
|
|
256
|
+
* if (result.success) {
|
|
257
|
+
* console.log('邮件数:', result.emails.length);
|
|
258
|
+
* }
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
152
261
|
export class TempEmailClient {
|
|
153
262
|
private emailInfo: EmailInfo | null = null;
|
|
154
263
|
|
|
264
|
+
/**
|
|
265
|
+
* 创建临时邮箱并缓存邮箱信息
|
|
266
|
+
* 后续调用 getEmails() 时自动使用此邮箱的渠道、地址和令牌
|
|
267
|
+
*/
|
|
155
268
|
async generate(options: GenerateEmailOptions = {}): Promise<EmailInfo> {
|
|
156
269
|
this.emailInfo = await generateEmail(options);
|
|
157
270
|
return this.emailInfo;
|
|
158
271
|
}
|
|
159
272
|
|
|
273
|
+
/**
|
|
274
|
+
* 获取当前邮箱的邮件列表
|
|
275
|
+
* 必须先调用 generate() 创建邮箱
|
|
276
|
+
*
|
|
277
|
+
* @throws 未调用 generate() 时抛出异常
|
|
278
|
+
*/
|
|
160
279
|
async getEmails(): Promise<GetEmailsResult> {
|
|
161
280
|
if (!this.emailInfo) {
|
|
162
281
|
throw new Error('No email generated. Call generate() first.');
|
|
@@ -169,6 +288,10 @@ export class TempEmailClient {
|
|
|
169
288
|
});
|
|
170
289
|
}
|
|
171
290
|
|
|
291
|
+
/**
|
|
292
|
+
* 获取当前缓存的邮箱信息
|
|
293
|
+
* 未调用 generate() 时返回 null
|
|
294
|
+
*/
|
|
172
295
|
getEmailInfo(): EmailInfo | null {
|
|
173
296
|
return this.emailInfo;
|
|
174
297
|
}
|
package/src/logger.ts
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK 日志模块
|
|
3
|
+
* 提供分级日志能力,支持自定义日志处理器
|
|
4
|
+
* 默认静默不输出,用户可通过 setLogLevel / setLogger 启用
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 日志级别枚举
|
|
9
|
+
* 数值越小级别越高,设置某级别后只输出该级别及以上的日志
|
|
10
|
+
*/
|
|
11
|
+
export enum LogLevel {
|
|
12
|
+
/** 关闭所有日志 */
|
|
13
|
+
SILENT = 0,
|
|
14
|
+
/** 错误日志:请求失败、重试耗尽等 */
|
|
15
|
+
ERROR = 1,
|
|
16
|
+
/** 警告日志:重试中、降级处理等 */
|
|
17
|
+
WARN = 2,
|
|
18
|
+
/** 信息日志:请求开始、完成等关键流程 */
|
|
19
|
+
INFO = 3,
|
|
20
|
+
/** 调试日志:请求详情、响应内容等 */
|
|
21
|
+
DEBUG = 4,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 日志处理器接口
|
|
26
|
+
* 用户可实现此接口来自定义日志输出方式(如写文件、发送到远程等)
|
|
27
|
+
*/
|
|
28
|
+
export interface LogHandler {
|
|
29
|
+
error(message: string, ...args: any[]): void;
|
|
30
|
+
warn(message: string, ...args: any[]): void;
|
|
31
|
+
info(message: string, ...args: any[]): void;
|
|
32
|
+
debug(message: string, ...args: any[]): void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 默认日志处理器,直接输出到 console
|
|
37
|
+
*/
|
|
38
|
+
const defaultHandler: LogHandler = {
|
|
39
|
+
error: (msg, ...args) => console.error(msg, ...args),
|
|
40
|
+
warn: (msg, ...args) => console.warn(msg, ...args),
|
|
41
|
+
info: (msg, ...args) => console.info(msg, ...args),
|
|
42
|
+
debug: (msg, ...args) => console.debug(msg, ...args),
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
let currentLevel: LogLevel = LogLevel.SILENT;
|
|
46
|
+
let currentHandler: LogHandler = defaultHandler;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 设置日志级别
|
|
50
|
+
* 默认 SILENT(不输出任何日志)
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* import { setLogLevel, LogLevel } from 'tempmail-sdk';
|
|
55
|
+
* setLogLevel(LogLevel.DEBUG); // 开启所有日志
|
|
56
|
+
* setLogLevel(LogLevel.INFO); // 只输出 INFO 及以上
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export function setLogLevel(level: LogLevel): void {
|
|
60
|
+
currentLevel = level;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 获取当前日志级别
|
|
65
|
+
*/
|
|
66
|
+
export function getLogLevel(): LogLevel {
|
|
67
|
+
return currentLevel;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* 设置自定义日志处理器
|
|
72
|
+
* 替换默认的 console 输出
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* import { setLogger } from 'tempmail-sdk';
|
|
77
|
+
* setLogger({
|
|
78
|
+
* error: (msg, ...args) => myLogger.error(msg, ...args),
|
|
79
|
+
* warn: (msg, ...args) => myLogger.warn(msg, ...args),
|
|
80
|
+
* info: (msg, ...args) => myLogger.info(msg, ...args),
|
|
81
|
+
* debug: (msg, ...args) => myLogger.debug(msg, ...args),
|
|
82
|
+
* });
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export function setLogger(handler: LogHandler): void {
|
|
86
|
+
currentHandler = handler;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* SDK 内部日志工具
|
|
91
|
+
* 根据当前日志级别过滤输出
|
|
92
|
+
*/
|
|
93
|
+
export const logger = {
|
|
94
|
+
error(msg: string, ...args: any[]): void {
|
|
95
|
+
if (currentLevel >= LogLevel.ERROR) currentHandler.error(msg, ...args);
|
|
96
|
+
},
|
|
97
|
+
warn(msg: string, ...args: any[]): void {
|
|
98
|
+
if (currentLevel >= LogLevel.WARN) currentHandler.warn(msg, ...args);
|
|
99
|
+
},
|
|
100
|
+
info(msg: string, ...args: any[]): void {
|
|
101
|
+
if (currentLevel >= LogLevel.INFO) currentHandler.info(msg, ...args);
|
|
102
|
+
},
|
|
103
|
+
debug(msg: string, ...args: any[]): void {
|
|
104
|
+
if (currentLevel >= LogLevel.DEBUG) currentHandler.debug(msg, ...args);
|
|
105
|
+
},
|
|
106
|
+
};
|
package/src/normalize.ts
CHANGED
|
@@ -2,6 +2,13 @@ import { Email, EmailAttachment } from './types';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* 将各提供商返回的原始邮件数据标准化为统一的 Email 格式
|
|
5
|
+
*
|
|
6
|
+
* 不同渠道的 API 返回字段名各不相同,此函数通过多字段候选策略
|
|
7
|
+
* 将它们统一映射为标准的 Email 结构,保证 SDK 输出一致性。
|
|
8
|
+
*
|
|
9
|
+
* @param raw - 原始邮件数据(来自不同提供商的 API 响应)
|
|
10
|
+
* @param recipientEmail - 收件人邮箱地址,当原始数据中无收件人字段时用作回退值
|
|
11
|
+
* @returns 标准化的 Email 对象
|
|
5
12
|
*/
|
|
6
13
|
export function normalizeEmail(raw: any, recipientEmail: string = ''): Email {
|
|
7
14
|
return {
|
|
@@ -17,31 +24,60 @@ export function normalizeEmail(raw: any, recipientEmail: string = ''): Email {
|
|
|
17
24
|
};
|
|
18
25
|
}
|
|
19
26
|
|
|
27
|
+
/**
|
|
28
|
+
* 提取邮件 ID
|
|
29
|
+
* 候选字段: id, eid, _id, mailboxId, messageId, mail_id
|
|
30
|
+
*/
|
|
20
31
|
function normalizeId(raw: any): string {
|
|
21
32
|
const id = raw.id ?? raw.eid ?? raw._id ?? raw.mailboxId ?? raw.messageId ?? raw.mail_id ?? '';
|
|
22
33
|
return String(id);
|
|
23
34
|
}
|
|
24
35
|
|
|
36
|
+
/**
|
|
37
|
+
* 提取发件人地址
|
|
38
|
+
* 候选字段: from_address, address_from, from, messageFrom, sender
|
|
39
|
+
*/
|
|
25
40
|
function normalizeFrom(raw: any): string {
|
|
26
41
|
return raw.from_address || raw.address_from || raw.from || raw.messageFrom || raw.sender || '';
|
|
27
42
|
}
|
|
28
43
|
|
|
44
|
+
/**
|
|
45
|
+
* 提取收件人地址,无匹配字段时回退为 recipientEmail
|
|
46
|
+
* 候选字段: to, to_address, name_to, email_address, address
|
|
47
|
+
*/
|
|
29
48
|
function normalizeTo(raw: any, recipientEmail: string): string {
|
|
30
49
|
return raw.to || raw.to_address || raw.name_to || raw.email_address || raw.address || recipientEmail || '';
|
|
31
50
|
}
|
|
32
51
|
|
|
52
|
+
/**
|
|
53
|
+
* 提取邮件主题
|
|
54
|
+
* 候选字段: subject, e_subject
|
|
55
|
+
*/
|
|
33
56
|
function normalizeSubject(raw: any): string {
|
|
34
57
|
return raw.subject || raw.e_subject || '';
|
|
35
58
|
}
|
|
36
59
|
|
|
60
|
+
/**
|
|
61
|
+
* 提取纯文本内容
|
|
62
|
+
* 候选字段: text, body, content, body_text, text_content
|
|
63
|
+
*/
|
|
37
64
|
function normalizeText(raw: any): string {
|
|
38
65
|
return raw.text || raw.body || raw.content || raw.body_text || raw.text_content || '';
|
|
39
66
|
}
|
|
40
67
|
|
|
68
|
+
/**
|
|
69
|
+
* 提取 HTML 内容
|
|
70
|
+
* 候选字段: html, html_content, body_html
|
|
71
|
+
*/
|
|
41
72
|
function normalizeHtml(raw: any): string {
|
|
42
73
|
return raw.html || raw.html_content || raw.body_html || '';
|
|
43
74
|
}
|
|
44
75
|
|
|
76
|
+
/**
|
|
77
|
+
* 提取并统一日期格式为 ISO 8601
|
|
78
|
+
* 候选字段: received_at, created_at, createdAt, date, timestamp, e_date
|
|
79
|
+
* 其中 timestamp 为 Unix 秒级时间戳,需乘以 1000 转为毫秒
|
|
80
|
+
*/
|
|
45
81
|
function normalizeDate(raw: any): string {
|
|
46
82
|
try {
|
|
47
83
|
if (raw.received_at) return new Date(raw.received_at).toISOString();
|
|
@@ -54,11 +90,16 @@ function normalizeDate(raw: any): string {
|
|
|
54
90
|
if (raw.timestamp) return new Date(raw.timestamp * 1000).toISOString();
|
|
55
91
|
if (raw.e_date) return new Date(raw.e_date).toISOString();
|
|
56
92
|
} catch {
|
|
57
|
-
|
|
93
|
+
/* 日期解析失败,返回空字符串 */
|
|
58
94
|
}
|
|
59
95
|
return '';
|
|
60
96
|
}
|
|
61
97
|
|
|
98
|
+
/**
|
|
99
|
+
* 提取已读状态
|
|
100
|
+
* 候选字段: seen, read, isRead, is_read
|
|
101
|
+
* 支持 boolean / number(0|1) / string('0'|'1') 多种类型
|
|
102
|
+
*/
|
|
62
103
|
function normalizeIsRead(raw: any): boolean {
|
|
63
104
|
if (typeof raw.seen === 'boolean') return raw.seen;
|
|
64
105
|
if (typeof raw.read === 'boolean') return raw.read;
|
|
@@ -69,6 +110,10 @@ function normalizeIsRead(raw: any): boolean {
|
|
|
69
110
|
return false;
|
|
70
111
|
}
|
|
71
112
|
|
|
113
|
+
/**
|
|
114
|
+
* 提取并标准化附件列表
|
|
115
|
+
* 每个附件的字段也采用多候选策略映射
|
|
116
|
+
*/
|
|
72
117
|
function normalizeAttachments(attachments: any): EmailAttachment[] {
|
|
73
118
|
if (!attachments || !Array.isArray(attachments)) return [];
|
|
74
119
|
return attachments.map((a: any) => ({
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Guerrilla Mail 渠道实现
|
|
3
|
+
* API 文档: https://www.guerrillamail.com/GuerrillaMailAPI.html
|
|
4
|
+
*
|
|
5
|
+
* 特点:
|
|
6
|
+
* - 无需认证,公开 JSON API
|
|
7
|
+
* - 通过 sid_token 维持会话
|
|
8
|
+
* - 邮箱有效期 60 分钟
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { EmailInfo, Email, Channel } from '../types';
|
|
12
|
+
import { normalizeEmail } from '../normalize';
|
|
13
|
+
|
|
14
|
+
const CHANNEL: Channel = 'guerrillamail';
|
|
15
|
+
const BASE_URL = 'https://api.guerrillamail.com/ajax.php';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 创建临时邮箱
|
|
19
|
+
* API: GET ajax.php?f=get_email_address
|
|
20
|
+
* 返回 email_addr + sid_token(用于后续获取邮件)
|
|
21
|
+
*/
|
|
22
|
+
export async function generateEmail(): Promise<EmailInfo> {
|
|
23
|
+
const response = await fetch(`${BASE_URL}?f=get_email_address&lang=en`, {
|
|
24
|
+
method: 'GET',
|
|
25
|
+
headers: {
|
|
26
|
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
if (!response.ok) {
|
|
31
|
+
throw new Error(`Failed to generate email: ${response.status}`);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const data = await response.json();
|
|
35
|
+
|
|
36
|
+
if (!data.email_addr || !data.sid_token) {
|
|
37
|
+
throw new Error('Failed to generate email: missing email_addr or sid_token');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
channel: CHANNEL,
|
|
42
|
+
email: data.email_addr,
|
|
43
|
+
token: data.sid_token,
|
|
44
|
+
expiresAt: data.email_timestamp ? (data.email_timestamp + 3600) * 1000 : undefined,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 获取邮件列表
|
|
50
|
+
* API: GET ajax.php?f=check_email&seq=0&sid_token=xxx
|
|
51
|
+
* 返回 list 数组,每个元素包含 mail_id, mail_from, mail_subject, mail_body 等
|
|
52
|
+
*/
|
|
53
|
+
export async function getEmails(token: string, email: string): Promise<Email[]> {
|
|
54
|
+
const response = await fetch(`${BASE_URL}?f=check_email&seq=0&sid_token=${encodeURIComponent(token)}`, {
|
|
55
|
+
method: 'GET',
|
|
56
|
+
headers: {
|
|
57
|
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
if (!response.ok) {
|
|
62
|
+
throw new Error(`Failed to get emails: ${response.status}`);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const data = await response.json();
|
|
66
|
+
const list = Array.isArray(data.list) ? data.list : [];
|
|
67
|
+
|
|
68
|
+
return list.map((item: any) => normalizeEmail({
|
|
69
|
+
id: item.mail_id,
|
|
70
|
+
from: item.mail_from,
|
|
71
|
+
to: email,
|
|
72
|
+
subject: item.mail_subject,
|
|
73
|
+
text: item.mail_body || item.mail_excerpt || '',
|
|
74
|
+
html: item.mail_body || '',
|
|
75
|
+
date: item.mail_date || '',
|
|
76
|
+
isRead: item.mail_read === 1,
|
|
77
|
+
}, email));
|
|
78
|
+
}
|
package/src/providers/mail-tm.ts
CHANGED
|
@@ -36,7 +36,11 @@ async function getDomains(): Promise<string[]> {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
const data = await response.json();
|
|
39
|
-
|
|
39
|
+
/* 兼容两种响应格式:
|
|
40
|
+
* - Accept: application/ld+json → Hydra 格式 { "hydra:member": [...] }
|
|
41
|
+
* - Accept: application/json → 纯数组 [...]
|
|
42
|
+
*/
|
|
43
|
+
const members = Array.isArray(data) ? data : (data['hydra:member'] || []);
|
|
40
44
|
return members
|
|
41
45
|
.filter((d: any) => d.isActive)
|
|
42
46
|
.map((d: any) => d.domain);
|
|
@@ -153,7 +157,8 @@ export async function getEmails(token: string, email: string): Promise<Email[]>
|
|
|
153
157
|
}
|
|
154
158
|
|
|
155
159
|
const listData = await listResponse.json();
|
|
156
|
-
|
|
160
|
+
/* 兼容 Hydra 格式和纯数组格式 */
|
|
161
|
+
const messages = Array.isArray(listData) ? listData : (listData['hydra:member'] || []);
|
|
157
162
|
|
|
158
163
|
if (messages.length === 0) {
|
|
159
164
|
return [];
|