@upyo/mailgun 0.1.0-dev.14 → 0.1.0-dev.17

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/dist/index.cjs CHANGED
@@ -5,21 +5,11 @@
5
5
  *
6
6
  * This function takes a partial Mailgun configuration and returns a complete
7
7
  * configuration with all optional fields filled with sensible defaults.
8
+ * It is used internally by the Mailgun transport.
8
9
  *
9
10
  * @param config - The Mailgun configuration with optional fields
10
11
  * @returns A resolved configuration with all defaults applied
11
- *
12
- * @example
13
- * ```typescript
14
- * const resolved = createMailgunConfig({
15
- * apiKey: 'your-api-key',
16
- * domain: 'your-domain.com'
17
- * });
18
- *
19
- * // resolved.region will be 'us' (default)
20
- * // resolved.timeout will be 30000 (default)
21
- * // resolved.retries will be 3 (default)
22
- * ```
12
+ * @internal
23
13
  */
24
14
  function createMailgunConfig(config) {
25
15
  const region = config.region ?? "us";
@@ -271,6 +261,9 @@ function isStandardHeader(headerName) {
271
261
  * ```
272
262
  */
273
263
  var MailgunTransport = class {
264
+ /**
265
+ * The resolved Mailgun configuration used by this transport.
266
+ */
274
267
  config;
275
268
  httpClient;
276
269
  /**
@@ -401,5 +394,4 @@ var MailgunTransport = class {
401
394
 
402
395
  //#endregion
403
396
  exports.MailgunApiError = MailgunApiError;
404
- exports.MailgunTransport = MailgunTransport;
405
- exports.createMailgunConfig = createMailgunConfig;
397
+ exports.MailgunTransport = MailgunTransport;
package/dist/index.d.cts CHANGED
@@ -100,83 +100,12 @@ type ResolvedMailgunConfig = Required<MailgunConfig>;
100
100
  *
101
101
  * This function takes a partial Mailgun configuration and returns a complete
102
102
  * configuration with all optional fields filled with sensible defaults.
103
+ * It is used internally by the Mailgun transport.
103
104
  *
104
105
  * @param config - The Mailgun configuration with optional fields
105
106
  * @returns A resolved configuration with all defaults applied
106
- *
107
- * @example
108
- * ```typescript
109
- * const resolved = createMailgunConfig({
110
- * apiKey: 'your-api-key',
111
- * domain: 'your-domain.com'
112
- * });
113
- *
114
- * // resolved.region will be 'us' (default)
115
- * // resolved.timeout will be 30000 (default)
116
- * // resolved.retries will be 3 (default)
117
- * ```
107
+ * @internal
118
108
  */
119
- declare function createMailgunConfig(config: MailgunConfig): ResolvedMailgunConfig;
120
- //#endregion
121
- //#region src/http-client.d.ts
122
- /**
123
- * Response from Mailgun API for sending messages.
124
- */
125
- interface MailgunResponse {
126
- /**
127
- * The message ID returned by Mailgun.
128
- */
129
- id: string;
130
- /**
131
- * Success message from Mailgun.
132
- */
133
- message: string;
134
- }
135
- /**
136
- * Error response from Mailgun API.
137
- */
138
-
139
- /**
140
- * HTTP client wrapper for Mailgun API requests.
141
- *
142
- * This class handles authentication, request formatting, error handling,
143
- * and retry logic for Mailgun API calls.
144
- */
145
- declare class MailgunHttpClient {
146
- private config;
147
- constructor(config: ResolvedMailgunConfig);
148
- /**
149
- * Sends a message via Mailgun API.
150
- *
151
- * @param formData The form data to send to Mailgun.
152
- * @param signal Optional AbortSignal for cancellation.
153
- * @returns Promise that resolves to the Mailgun response.
154
- */
155
- sendMessage(formData: FormData, signal?: AbortSignal): Promise<MailgunResponse>;
156
- /**
157
- * Makes an HTTP request to Mailgun API with retry logic.
158
- *
159
- * @param url The URL to make the request to.
160
- * @param options Fetch options.
161
- * @returns Promise that resolves to the parsed response.
162
- */
163
- private makeRequest;
164
- /**
165
- * Makes a fetch request with Mailgun authentication.
166
- *
167
- * @param url The URL to make the request to.
168
- * @param options Fetch options.
169
- * @returns Promise that resolves to the fetch response.
170
- */
171
- private fetchWithAuth;
172
- }
173
- /**
174
- * Custom error class for Mailgun API errors.
175
- */
176
- declare class MailgunApiError extends Error {
177
- statusCode?: number;
178
- constructor(message: string, statusCode?: number);
179
- }
180
109
  //#endregion
181
110
  //#region src/mailgun-transport.d.ts
182
111
  /**
@@ -204,8 +133,11 @@ declare class MailgunApiError extends Error {
204
133
  * ```
205
134
  */
206
135
  declare class MailgunTransport implements Transport {
207
- config: ReturnType<typeof createMailgunConfig>;
208
- httpClient: MailgunHttpClient;
136
+ /**
137
+ * The resolved Mailgun configuration used by this transport.
138
+ */
139
+ config: ResolvedMailgunConfig;
140
+ private httpClient;
209
141
  /**
210
142
  * Creates a new Mailgun transport instance.
211
143
  *
@@ -301,4 +233,14 @@ declare class MailgunTransport implements Transport {
301
233
  sendMany(messages: Iterable<Message> | AsyncIterable<Message>, options?: TransportOptions): AsyncIterable<Receipt>;
302
234
  }
303
235
  //#endregion
304
- export { MailgunApiError, MailgunConfig, MailgunTransport, createMailgunConfig };
236
+ //#region src/http-client.d.ts
237
+
238
+ /**
239
+ * Custom error class for Mailgun API errors.
240
+ */
241
+ declare class MailgunApiError extends Error {
242
+ statusCode?: number;
243
+ constructor(message: string, statusCode?: number);
244
+ }
245
+ //#endregion
246
+ export { MailgunApiError, MailgunConfig, MailgunTransport };
package/dist/index.d.ts CHANGED
@@ -100,83 +100,12 @@ type ResolvedMailgunConfig = Required<MailgunConfig>;
100
100
  *
101
101
  * This function takes a partial Mailgun configuration and returns a complete
102
102
  * configuration with all optional fields filled with sensible defaults.
103
+ * It is used internally by the Mailgun transport.
103
104
  *
104
105
  * @param config - The Mailgun configuration with optional fields
105
106
  * @returns A resolved configuration with all defaults applied
106
- *
107
- * @example
108
- * ```typescript
109
- * const resolved = createMailgunConfig({
110
- * apiKey: 'your-api-key',
111
- * domain: 'your-domain.com'
112
- * });
113
- *
114
- * // resolved.region will be 'us' (default)
115
- * // resolved.timeout will be 30000 (default)
116
- * // resolved.retries will be 3 (default)
117
- * ```
107
+ * @internal
118
108
  */
119
- declare function createMailgunConfig(config: MailgunConfig): ResolvedMailgunConfig;
120
- //#endregion
121
- //#region src/http-client.d.ts
122
- /**
123
- * Response from Mailgun API for sending messages.
124
- */
125
- interface MailgunResponse {
126
- /**
127
- * The message ID returned by Mailgun.
128
- */
129
- id: string;
130
- /**
131
- * Success message from Mailgun.
132
- */
133
- message: string;
134
- }
135
- /**
136
- * Error response from Mailgun API.
137
- */
138
-
139
- /**
140
- * HTTP client wrapper for Mailgun API requests.
141
- *
142
- * This class handles authentication, request formatting, error handling,
143
- * and retry logic for Mailgun API calls.
144
- */
145
- declare class MailgunHttpClient {
146
- private config;
147
- constructor(config: ResolvedMailgunConfig);
148
- /**
149
- * Sends a message via Mailgun API.
150
- *
151
- * @param formData The form data to send to Mailgun.
152
- * @param signal Optional AbortSignal for cancellation.
153
- * @returns Promise that resolves to the Mailgun response.
154
- */
155
- sendMessage(formData: FormData, signal?: AbortSignal): Promise<MailgunResponse>;
156
- /**
157
- * Makes an HTTP request to Mailgun API with retry logic.
158
- *
159
- * @param url The URL to make the request to.
160
- * @param options Fetch options.
161
- * @returns Promise that resolves to the parsed response.
162
- */
163
- private makeRequest;
164
- /**
165
- * Makes a fetch request with Mailgun authentication.
166
- *
167
- * @param url The URL to make the request to.
168
- * @param options Fetch options.
169
- * @returns Promise that resolves to the fetch response.
170
- */
171
- private fetchWithAuth;
172
- }
173
- /**
174
- * Custom error class for Mailgun API errors.
175
- */
176
- declare class MailgunApiError extends Error {
177
- statusCode?: number;
178
- constructor(message: string, statusCode?: number);
179
- }
180
109
  //#endregion
181
110
  //#region src/mailgun-transport.d.ts
182
111
  /**
@@ -204,8 +133,11 @@ declare class MailgunApiError extends Error {
204
133
  * ```
205
134
  */
206
135
  declare class MailgunTransport implements Transport {
207
- config: ReturnType<typeof createMailgunConfig>;
208
- httpClient: MailgunHttpClient;
136
+ /**
137
+ * The resolved Mailgun configuration used by this transport.
138
+ */
139
+ config: ResolvedMailgunConfig;
140
+ private httpClient;
209
141
  /**
210
142
  * Creates a new Mailgun transport instance.
211
143
  *
@@ -301,4 +233,14 @@ declare class MailgunTransport implements Transport {
301
233
  sendMany(messages: Iterable<Message> | AsyncIterable<Message>, options?: TransportOptions): AsyncIterable<Receipt>;
302
234
  }
303
235
  //#endregion
304
- export { MailgunApiError, MailgunConfig, MailgunTransport, createMailgunConfig };
236
+ //#region src/http-client.d.ts
237
+
238
+ /**
239
+ * Custom error class for Mailgun API errors.
240
+ */
241
+ declare class MailgunApiError extends Error {
242
+ statusCode?: number;
243
+ constructor(message: string, statusCode?: number);
244
+ }
245
+ //#endregion
246
+ export { MailgunApiError, MailgunConfig, MailgunTransport };
package/dist/index.js CHANGED
@@ -4,21 +4,11 @@
4
4
  *
5
5
  * This function takes a partial Mailgun configuration and returns a complete
6
6
  * configuration with all optional fields filled with sensible defaults.
7
+ * It is used internally by the Mailgun transport.
7
8
  *
8
9
  * @param config - The Mailgun configuration with optional fields
9
10
  * @returns A resolved configuration with all defaults applied
10
- *
11
- * @example
12
- * ```typescript
13
- * const resolved = createMailgunConfig({
14
- * apiKey: 'your-api-key',
15
- * domain: 'your-domain.com'
16
- * });
17
- *
18
- * // resolved.region will be 'us' (default)
19
- * // resolved.timeout will be 30000 (default)
20
- * // resolved.retries will be 3 (default)
21
- * ```
11
+ * @internal
22
12
  */
23
13
  function createMailgunConfig(config) {
24
14
  const region = config.region ?? "us";
@@ -270,6 +260,9 @@ function isStandardHeader(headerName) {
270
260
  * ```
271
261
  */
272
262
  var MailgunTransport = class {
263
+ /**
264
+ * The resolved Mailgun configuration used by this transport.
265
+ */
273
266
  config;
274
267
  httpClient;
275
268
  /**
@@ -399,4 +392,4 @@ var MailgunTransport = class {
399
392
  };
400
393
 
401
394
  //#endregion
402
- export { MailgunApiError, MailgunTransport, createMailgunConfig };
395
+ export { MailgunApiError, MailgunTransport };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@upyo/mailgun",
3
- "version": "0.1.0-dev.14+1ceb3382",
3
+ "version": "0.1.0-dev.17+3ffd074a",
4
4
  "description": "Mailgun transport for Upyo email library",
5
5
  "keywords": [
6
6
  "email",
@@ -53,7 +53,7 @@
53
53
  },
54
54
  "sideEffects": false,
55
55
  "peerDependencies": {
56
- "@upyo/core": "0.1.0-dev.14+1ceb3382"
56
+ "@upyo/core": "0.1.0-dev.17+3ffd074a"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@dotenvx/dotenvx": "^1.47.3",