@mailhooks/sdk 2.5.0 → 2.6.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 +0 -9
- package/dist/index.d.ts +2 -10
- package/dist/index.js +0 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -254,15 +254,6 @@ import { Mailhooks } from '@mailhooks/sdk';
|
|
|
254
254
|
// Use as normal
|
|
255
255
|
```
|
|
256
256
|
|
|
257
|
-
### Check Connection Limits
|
|
258
|
-
|
|
259
|
-
```typescript
|
|
260
|
-
const access = await mailhooks.realtime.checkAccess();
|
|
261
|
-
console.log('Has access:', access.hasAccess);
|
|
262
|
-
console.log('Max connections:', access.maxConnections); // -1 = unlimited
|
|
263
|
-
console.log('Current connections:', access.currentConnections);
|
|
264
|
-
```
|
|
265
|
-
|
|
266
257
|
### Event Types
|
|
267
258
|
|
|
268
259
|
| Event | Payload | Description |
|
package/dist/index.d.ts
CHANGED
|
@@ -274,16 +274,6 @@ declare class RealtimeResource {
|
|
|
274
274
|
private eventSource;
|
|
275
275
|
private reconnectTimeout;
|
|
276
276
|
constructor(config: MailhooksConfig);
|
|
277
|
-
/**
|
|
278
|
-
* Check if the plan allows real-time notifications and get connection quota
|
|
279
|
-
*
|
|
280
|
-
* @returns Promise resolving to access status and connection limits
|
|
281
|
-
*/
|
|
282
|
-
checkAccess(): Promise<{
|
|
283
|
-
hasAccess: boolean;
|
|
284
|
-
maxConnections: number;
|
|
285
|
-
currentConnections: number;
|
|
286
|
-
}>;
|
|
287
277
|
/**
|
|
288
278
|
* Subscribe to real-time email notifications via Server-Sent Events (SSE)
|
|
289
279
|
*
|
|
@@ -345,6 +335,8 @@ interface WebhookPayload {
|
|
|
345
335
|
html?: string;
|
|
346
336
|
/** Array of attachment metadata */
|
|
347
337
|
attachments: Array<{
|
|
338
|
+
/** Unique attachment ID */
|
|
339
|
+
id: string;
|
|
348
340
|
filename: string;
|
|
349
341
|
contentType: string;
|
|
350
342
|
size: number;
|
package/dist/index.js
CHANGED
|
@@ -256,23 +256,6 @@ var RealtimeResource = class {
|
|
|
256
256
|
this.reconnectTimeout = null;
|
|
257
257
|
this.config = config;
|
|
258
258
|
}
|
|
259
|
-
/**
|
|
260
|
-
* Check if the plan allows real-time notifications and get connection quota
|
|
261
|
-
*
|
|
262
|
-
* @returns Promise resolving to access status and connection limits
|
|
263
|
-
*/
|
|
264
|
-
async checkAccess() {
|
|
265
|
-
const baseUrl = this.config.baseUrl ?? "https://mailhooks.dev/api";
|
|
266
|
-
const response = await fetch(`${baseUrl}/v1/realtime/plan-access`, {
|
|
267
|
-
headers: {
|
|
268
|
-
"x-api-key": this.config.apiKey
|
|
269
|
-
}
|
|
270
|
-
});
|
|
271
|
-
if (!response.ok) {
|
|
272
|
-
throw new Error(`Failed to check plan access: ${response.statusText}`);
|
|
273
|
-
}
|
|
274
|
-
return response.json();
|
|
275
|
-
}
|
|
276
259
|
/**
|
|
277
260
|
* Subscribe to real-time email notifications via Server-Sent Events (SSE)
|
|
278
261
|
*
|