@mailhooks/sdk 1.0.3 → 1.0.5
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 +63 -0
- package/dist/client.d.ts +1 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +4 -0
- package/dist/resources/emails.d.ts +38 -2
- package/dist/resources/emails.d.ts.map +1 -1
- package/dist/resources/emails.js +123 -2
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -62,6 +62,7 @@ const emails = await mailhooks.emails.list({
|
|
|
62
62
|
subject: 'Important',
|
|
63
63
|
startDate: '2024-01-01',
|
|
64
64
|
endDate: '2024-12-31',
|
|
65
|
+
read: false, // Filter by read status
|
|
65
66
|
},
|
|
66
67
|
sort: {
|
|
67
68
|
field: 'createdAt',
|
|
@@ -73,7 +74,11 @@ const emails = await mailhooks.emails.list({
|
|
|
73
74
|
#### Get Email
|
|
74
75
|
|
|
75
76
|
```typescript
|
|
77
|
+
// Get email without marking as read
|
|
76
78
|
const email = await mailhooks.emails.getEmail('email-id');
|
|
79
|
+
|
|
80
|
+
// Get email and mark it as read in one call
|
|
81
|
+
const readEmail = await mailhooks.emails.getEmail('email-id', true);
|
|
77
82
|
```
|
|
78
83
|
|
|
79
84
|
#### Get Email Content
|
|
@@ -99,6 +104,63 @@ const attachment = await mailhooks.emails.downloadAttachment('email-id', 'attach
|
|
|
99
104
|
// attachment.contentType contains the MIME type
|
|
100
105
|
```
|
|
101
106
|
|
|
107
|
+
#### Mark Email as Read/Unread
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
// Mark email as read
|
|
111
|
+
const readEmail = await mailhooks.emails.markAsRead('email-id');
|
|
112
|
+
console.log(readEmail.read); // true
|
|
113
|
+
|
|
114
|
+
// Mark email as unread
|
|
115
|
+
const unreadEmail = await mailhooks.emails.markAsUnread('email-id');
|
|
116
|
+
console.log(unreadEmail.read); // false
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
#### Wait for Email
|
|
120
|
+
|
|
121
|
+
Wait for an email that matches specific filters. Useful for testing and automation.
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
// Basic usage - wait for unread email from specific sender
|
|
125
|
+
const email = await mailhooks.emails.waitFor({
|
|
126
|
+
filter: {
|
|
127
|
+
from: 'noreply@example.com',
|
|
128
|
+
read: false // Only wait for unread emails
|
|
129
|
+
},
|
|
130
|
+
timeout: 30000, // 30 seconds
|
|
131
|
+
pollInterval: 2000, // Check every 2 seconds
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
// Advanced usage with all options
|
|
135
|
+
const email = await mailhooks.emails.waitFor({
|
|
136
|
+
filter: {
|
|
137
|
+
from: 'noreply@example.com',
|
|
138
|
+
to: 'test@yourdomain.com',
|
|
139
|
+
subject: 'Order Confirmation',
|
|
140
|
+
read: false, // Only unread emails
|
|
141
|
+
},
|
|
142
|
+
lookbackWindow: 10000, // Only consider emails from last 10 seconds
|
|
143
|
+
initialDelay: 5000, // Wait 5 seconds before first check
|
|
144
|
+
timeout: 60000, // Total timeout of 60 seconds
|
|
145
|
+
pollInterval: 3000, // Check every 3 seconds
|
|
146
|
+
maxRetries: 20, // Stop after 20 attempts
|
|
147
|
+
});
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**Options:**
|
|
151
|
+
- `filter`: Same filters as `list()` method (from, to, subject, startDate, endDate, read)
|
|
152
|
+
- `lookbackWindow`: How far back to look for emails on first check (default: 10000ms)
|
|
153
|
+
- `initialDelay`: Delay before starting to poll (default: 0ms)
|
|
154
|
+
- `timeout`: Maximum time to wait before throwing error (default: 30000ms)
|
|
155
|
+
- `pollInterval`: Time between checks (default: 1000ms)
|
|
156
|
+
- `maxRetries`: Maximum number of polling attempts (default: unlimited)
|
|
157
|
+
|
|
158
|
+
**Key Features:**
|
|
159
|
+
- Returns immediately if a matching email already exists (within lookback window)
|
|
160
|
+
- Prevents returning old emails by using the lookback window
|
|
161
|
+
- Efficiently tracks checked emails to avoid duplicates
|
|
162
|
+
- Throws error on timeout or max retries exceeded
|
|
163
|
+
|
|
102
164
|
## Types
|
|
103
165
|
|
|
104
166
|
The SDK includes comprehensive TypeScript types:
|
|
@@ -109,6 +171,7 @@ interface Email {
|
|
|
109
171
|
from: string;
|
|
110
172
|
to: string[];
|
|
111
173
|
subject: string;
|
|
174
|
+
read: boolean;
|
|
112
175
|
createdAt: Date;
|
|
113
176
|
attachments: Attachment[];
|
|
114
177
|
}
|
package/dist/client.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare class MailhooksClient {
|
|
|
7
7
|
protected get<T>(path: string, params?: Record<string, any>): Promise<T>;
|
|
8
8
|
protected post<T>(path: string, data?: any): Promise<T>;
|
|
9
9
|
protected put<T>(path: string, data?: any): Promise<T>;
|
|
10
|
+
protected patch<T>(path: string, data?: any): Promise<T>;
|
|
10
11
|
protected delete<T>(path: string): Promise<T>;
|
|
11
12
|
protected downloadFile(path: string): Promise<ArrayBuffer>;
|
|
12
13
|
protected getAxiosInstance(): AxiosInstance;
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAiB,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,qBAAa,eAAe;IAC1B,OAAO,CAAC,IAAI,CAAgB;gBAEhB,MAAM,EAAE,eAAe;IAkBnC,OAAO,CAAC,UAAU;cAkBF,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;cAK9D,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,G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IAOhE,SAAS,CAAC,gBAAgB,IAAI,aAAa;CAG5C"}
|
package/dist/client.js
CHANGED
|
@@ -53,6 +53,10 @@ class MailhooksClient {
|
|
|
53
53
|
const response = await this.http.put(path, data);
|
|
54
54
|
return response.data;
|
|
55
55
|
}
|
|
56
|
+
async patch(path, data) {
|
|
57
|
+
const response = await this.http.patch(path, data);
|
|
58
|
+
return response.data;
|
|
59
|
+
}
|
|
56
60
|
async delete(path) {
|
|
57
61
|
const response = await this.http.delete(path);
|
|
58
62
|
return response.data;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MailhooksClient } from '../client';
|
|
2
|
-
import { Email, EmailContent, EmailsResponse, EmailListParams, DownloadResponse } from '../types';
|
|
2
|
+
import { Email, EmailContent, EmailsResponse, EmailListParams, DownloadResponse, WaitForOptions } from '../types';
|
|
3
3
|
export declare class EmailsResource extends MailhooksClient {
|
|
4
4
|
/**
|
|
5
5
|
* Get a paginated list of emails
|
|
@@ -7,8 +7,10 @@ export declare class EmailsResource extends MailhooksClient {
|
|
|
7
7
|
list(params?: EmailListParams): Promise<EmailsResponse>;
|
|
8
8
|
/**
|
|
9
9
|
* Get a specific email by ID
|
|
10
|
+
* @param emailId - The ID of the email to retrieve
|
|
11
|
+
* @param markAsRead - Optional: Mark the email as read when fetching (default: false)
|
|
10
12
|
*/
|
|
11
|
-
getEmail(emailId: string): Promise<Email>;
|
|
13
|
+
getEmail(emailId: string, markAsRead?: boolean): Promise<Email>;
|
|
12
14
|
/**
|
|
13
15
|
* Get the HTML and text content of an email
|
|
14
16
|
*/
|
|
@@ -21,5 +23,39 @@ export declare class EmailsResource extends MailhooksClient {
|
|
|
21
23
|
* Download a specific attachment from an email
|
|
22
24
|
*/
|
|
23
25
|
downloadAttachment(emailId: string, attachmentId: string): Promise<DownloadResponse>;
|
|
26
|
+
/**
|
|
27
|
+
* Mark an email as read
|
|
28
|
+
*/
|
|
29
|
+
markAsRead(emailId: string): Promise<Email>;
|
|
30
|
+
/**
|
|
31
|
+
* Mark an email as unread
|
|
32
|
+
*/
|
|
33
|
+
markAsUnread(emailId: string): Promise<Email>;
|
|
34
|
+
/**
|
|
35
|
+
* Wait for an email that matches the given filters
|
|
36
|
+
*
|
|
37
|
+
* @param options - Options for waiting including filters, timeouts, and delays
|
|
38
|
+
* @returns The first email that matches the filters
|
|
39
|
+
* @throws Error if timeout is reached or max retries exceeded
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* // Wait for an email from a specific sender (only considers emails from last 10 seconds)
|
|
43
|
+
* const email = await mailhooks.emails.waitFor({
|
|
44
|
+
* filter: { from: 'test@example.com' },
|
|
45
|
+
* timeout: 30000, // 30 seconds
|
|
46
|
+
* pollInterval: 2000, // Check every 2 seconds
|
|
47
|
+
* lookbackWindow: 10000, // Only consider emails from last 10 seconds
|
|
48
|
+
* });
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* // Wait with initial delay (useful when you know email will take time)
|
|
52
|
+
* const email = await mailhooks.emails.waitFor({
|
|
53
|
+
* filter: { subject: 'Order Confirmation' },
|
|
54
|
+
* initialDelay: 5000, // Wait 5 seconds before first check
|
|
55
|
+
* timeout: 60000,
|
|
56
|
+
* lookbackWindow: 5000, // Only consider very recent emails
|
|
57
|
+
* });
|
|
58
|
+
*/
|
|
59
|
+
waitFor(options?: WaitForOptions): Promise<Email>;
|
|
24
60
|
}
|
|
25
61
|
//# sourceMappingURL=emails.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emails.d.ts","sourceRoot":"","sources":["../../src/resources/emails.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EACL,KAAK,EACL,YAAY,EACZ,cAAc,EACd,eAAe,EACf,gBAAgB,
|
|
1
|
+
{"version":3,"file":"emails.d.ts","sourceRoot":"","sources":["../../src/resources/emails.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EACL,KAAK,EACL,YAAY,EACZ,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,cAAc,EACf,MAAM,UAAU,CAAC;AAElB,qBAAa,cAAe,SAAQ,eAAe;IACjD;;OAEG;IACG,IAAI,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;IA0B7D;;;;OAIG;IACG,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,GAAE,OAAe,GAAG,OAAO,CAAC,KAAK,CAAC;IAK5E;;OAEG;IACG,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAIxD;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAS7D;;OAEG;IACG,kBAAkB,CACtB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,gBAAgB,CAAC;IAqB5B;;OAEG;IACG,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAIjD;;OAEG;IACG,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAInD;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACG,OAAO,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,KAAK,CAAC;CA8F5D"}
|
package/dist/resources/emails.js
CHANGED
|
@@ -24,6 +24,8 @@ class EmailsResource extends client_1.MailhooksClient {
|
|
|
24
24
|
queryParams['filter.createdAfter'] = params.filter.startDate;
|
|
25
25
|
if (params.filter.endDate)
|
|
26
26
|
queryParams['filter.createdBefore'] = params.filter.endDate;
|
|
27
|
+
if (params.filter.read !== undefined)
|
|
28
|
+
queryParams['filter.read'] = String(params.filter.read);
|
|
27
29
|
}
|
|
28
30
|
// Handle sort params
|
|
29
31
|
if (params?.sort) {
|
|
@@ -36,9 +38,12 @@ class EmailsResource extends client_1.MailhooksClient {
|
|
|
36
38
|
}
|
|
37
39
|
/**
|
|
38
40
|
* Get a specific email by ID
|
|
41
|
+
* @param emailId - The ID of the email to retrieve
|
|
42
|
+
* @param markAsRead - Optional: Mark the email as read when fetching (default: false)
|
|
39
43
|
*/
|
|
40
|
-
async getEmail(emailId) {
|
|
41
|
-
|
|
44
|
+
async getEmail(emailId, markAsRead = false) {
|
|
45
|
+
const params = markAsRead ? { markAsRead: 'true' } : undefined;
|
|
46
|
+
return super.get(`/v1/emails/${emailId}`, params);
|
|
42
47
|
}
|
|
43
48
|
/**
|
|
44
49
|
* Get the HTML and text content of an email
|
|
@@ -75,5 +80,121 @@ class EmailsResource extends client_1.MailhooksClient {
|
|
|
75
80
|
contentType: response.headers['content-type'],
|
|
76
81
|
};
|
|
77
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Mark an email as read
|
|
85
|
+
*/
|
|
86
|
+
async markAsRead(emailId) {
|
|
87
|
+
return super.patch(`/v1/emails/${emailId}/read`);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Mark an email as unread
|
|
91
|
+
*/
|
|
92
|
+
async markAsUnread(emailId) {
|
|
93
|
+
return super.patch(`/v1/emails/${emailId}/unread`);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Wait for an email that matches the given filters
|
|
97
|
+
*
|
|
98
|
+
* @param options - Options for waiting including filters, timeouts, and delays
|
|
99
|
+
* @returns The first email that matches the filters
|
|
100
|
+
* @throws Error if timeout is reached or max retries exceeded
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* // Wait for an email from a specific sender (only considers emails from last 10 seconds)
|
|
104
|
+
* const email = await mailhooks.emails.waitFor({
|
|
105
|
+
* filter: { from: 'test@example.com' },
|
|
106
|
+
* timeout: 30000, // 30 seconds
|
|
107
|
+
* pollInterval: 2000, // Check every 2 seconds
|
|
108
|
+
* lookbackWindow: 10000, // Only consider emails from last 10 seconds
|
|
109
|
+
* });
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* // Wait with initial delay (useful when you know email will take time)
|
|
113
|
+
* const email = await mailhooks.emails.waitFor({
|
|
114
|
+
* filter: { subject: 'Order Confirmation' },
|
|
115
|
+
* initialDelay: 5000, // Wait 5 seconds before first check
|
|
116
|
+
* timeout: 60000,
|
|
117
|
+
* lookbackWindow: 5000, // Only consider very recent emails
|
|
118
|
+
* });
|
|
119
|
+
*/
|
|
120
|
+
async waitFor(options = {}) {
|
|
121
|
+
const { filter = {}, timeout = 30000, // Default 30 seconds
|
|
122
|
+
pollInterval = 1000, // Default poll every 1 second
|
|
123
|
+
maxRetries = null, initialDelay = 0, lookbackWindow = 10000, // Default 10 seconds lookback
|
|
124
|
+
} = options;
|
|
125
|
+
const startTime = Date.now();
|
|
126
|
+
let retries = 0;
|
|
127
|
+
let lastCheckedTime = null;
|
|
128
|
+
// Helper function to check for matching emails
|
|
129
|
+
const checkForEmail = async (isFirstCheck = false) => {
|
|
130
|
+
try {
|
|
131
|
+
// Calculate the time window for filtering
|
|
132
|
+
const now = new Date();
|
|
133
|
+
let startDateFilter;
|
|
134
|
+
if (isFirstCheck && lookbackWindow) {
|
|
135
|
+
// On first check, only look back the specified window
|
|
136
|
+
startDateFilter = new Date(now.getTime() - lookbackWindow).toISOString();
|
|
137
|
+
}
|
|
138
|
+
else if (lastCheckedTime) {
|
|
139
|
+
// On subsequent checks, look for emails since last check
|
|
140
|
+
startDateFilter = lastCheckedTime.toISOString();
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
// Fallback to lookback window
|
|
144
|
+
startDateFilter = new Date(now.getTime() - lookbackWindow).toISOString();
|
|
145
|
+
}
|
|
146
|
+
// Merge the time filter with user-provided filters
|
|
147
|
+
const searchFilter = {
|
|
148
|
+
...filter,
|
|
149
|
+
startDate: startDateFilter,
|
|
150
|
+
};
|
|
151
|
+
const response = await this.list({
|
|
152
|
+
filter: searchFilter,
|
|
153
|
+
perPage: 10,
|
|
154
|
+
sort: { field: 'createdAt', order: 'desc' },
|
|
155
|
+
});
|
|
156
|
+
// Update last checked time for next iteration
|
|
157
|
+
lastCheckedTime = now;
|
|
158
|
+
if (response.data.length > 0) {
|
|
159
|
+
// Return the most recent matching email
|
|
160
|
+
return response.data[0];
|
|
161
|
+
}
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
// Log error but continue polling
|
|
166
|
+
console.warn('Error checking for email:', error);
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
// Check immediately for existing emails (before any delay)
|
|
171
|
+
const existingEmail = await checkForEmail(true);
|
|
172
|
+
if (existingEmail) {
|
|
173
|
+
return existingEmail;
|
|
174
|
+
}
|
|
175
|
+
// Apply initial delay if specified
|
|
176
|
+
if (initialDelay > 0) {
|
|
177
|
+
await new Promise(resolve => setTimeout(resolve, initialDelay));
|
|
178
|
+
}
|
|
179
|
+
// Start polling
|
|
180
|
+
while (true) {
|
|
181
|
+
// Check timeout
|
|
182
|
+
if (timeout && Date.now() - startTime > timeout) {
|
|
183
|
+
throw new Error(`Timeout waiting for email after ${timeout}ms`);
|
|
184
|
+
}
|
|
185
|
+
// Check max retries
|
|
186
|
+
if (maxRetries !== null && retries >= maxRetries) {
|
|
187
|
+
throw new Error(`Max retries (${maxRetries}) exceeded waiting for email`);
|
|
188
|
+
}
|
|
189
|
+
// Check for email
|
|
190
|
+
const email = await checkForEmail();
|
|
191
|
+
if (email) {
|
|
192
|
+
return email;
|
|
193
|
+
}
|
|
194
|
+
// Wait before next poll
|
|
195
|
+
await new Promise(resolve => setTimeout(resolve, pollInterval));
|
|
196
|
+
retries++;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
78
199
|
}
|
|
79
200
|
exports.EmailsResource = EmailsResource;
|
package/dist/types.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export interface Email {
|
|
|
9
9
|
from: string;
|
|
10
10
|
to: string[];
|
|
11
11
|
subject: string;
|
|
12
|
+
read: boolean;
|
|
12
13
|
createdAt: Date;
|
|
13
14
|
attachments: Attachment[];
|
|
14
15
|
}
|
|
@@ -33,6 +34,7 @@ export interface EmailFilter {
|
|
|
33
34
|
subject?: string;
|
|
34
35
|
startDate?: string;
|
|
35
36
|
endDate?: string;
|
|
37
|
+
read?: boolean;
|
|
36
38
|
}
|
|
37
39
|
export interface EmailSort {
|
|
38
40
|
field?: 'createdAt' | 'from' | 'subject';
|
|
@@ -53,4 +55,12 @@ export interface DownloadResponse {
|
|
|
53
55
|
filename?: string;
|
|
54
56
|
contentType?: string;
|
|
55
57
|
}
|
|
58
|
+
export interface WaitForOptions {
|
|
59
|
+
filter?: EmailFilter;
|
|
60
|
+
timeout?: number;
|
|
61
|
+
pollInterval?: number;
|
|
62
|
+
maxRetries?: number;
|
|
63
|
+
initialDelay?: number;
|
|
64
|
+
lookbackWindow?: number;
|
|
65
|
+
}
|
|
56
66
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,EAAE,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WA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