@mailhooks/sdk 2.5.0 → 2.6.10

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Mailhooks
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
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
@@ -150,11 +150,11 @@ var EmailsResource = class extends MailhooksClient {
150
150
  }
151
151
  /**
152
152
  * Wait for an email that matches the given filters
153
- *
153
+ *
154
154
  * @param options - Options for waiting including filters, timeouts, and delays
155
155
  * @returns The first email that matches the filters
156
156
  * @throws Error if timeout is reached or max retries exceeded
157
- *
157
+ *
158
158
  * @example
159
159
  * // Wait for an email from a specific sender (only considers emails from last 10 seconds)
160
160
  * const email = await mailhooks.emails.waitFor({
@@ -163,7 +163,7 @@ var EmailsResource = class extends MailhooksClient {
163
163
  * pollInterval: 2000, // Check every 2 seconds
164
164
  * lookbackWindow: 10000, // Only consider emails from last 10 seconds
165
165
  * });
166
- *
166
+ *
167
167
  * @example
168
168
  * // Wait with initial delay (useful when you know email will take time)
169
169
  * const email = await mailhooks.emails.waitFor({
@@ -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
  *
package/package.json CHANGED
@@ -1,19 +1,22 @@
1
1
  {
2
2
  "name": "@mailhooks/sdk",
3
- "version": "2.5.0",
3
+ "version": "2.6.10",
4
4
  "description": "TypeScript SDK for Mailhooks API",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/Mailhooks/integrations.git",
8
+ "directory": "packages/sdk"
9
+ },
10
+ "homepage": "https://github.com/Mailhooks/integrations#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/Mailhooks/integrations/issues"
13
+ },
5
14
  "publishConfig": {
6
15
  "access": "public"
7
16
  },
8
17
  "type": "module",
9
18
  "main": "dist/index.js",
10
19
  "types": "dist/index.d.ts",
11
- "scripts": {
12
- "build": "tsup",
13
- "dev": "tsc -p . --watch",
14
- "test": "echo \"No tests yet\"",
15
- "prepublishOnly": "pnpm build"
16
- },
17
20
  "keywords": [
18
21
  "mailhooks",
19
22
  "email",
@@ -41,5 +44,10 @@
41
44
  "import": "./dist/index.js",
42
45
  "default": "./dist/index.js"
43
46
  }
47
+ },
48
+ "scripts": {
49
+ "build": "tsup",
50
+ "dev": "tsc -p . --watch",
51
+ "test": "echo \"No tests yet\""
44
52
  }
45
- }
53
+ }