Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7927a72662 | |||
| d9d318f8c7 | |||
| d0686ecfe8 |
@@ -1,5 +1,13 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2025-10-17 - 2.0.3 - fix(tests)
|
||||||
|
Update testing setup and bump deps; add deno.lock and combined Node/Deno/Bun test
|
||||||
|
|
||||||
|
- Bump dev dependency @git.zone/tstest from ^2.6.1 to ^2.6.2 and dependency @push.rocks/smartrequest from ^4.3.1 to ^4.3.2 in package.json
|
||||||
|
- Add deno.lock with resolved dependency tree (new lockfile checked in)
|
||||||
|
- Introduce test/test.node+deno+bun.ts — consolidated tests for Node/Deno/Bun using Qenv and Mailgun integration flows
|
||||||
|
- Remove the old test/test.ts (replaced by the new multi-runtime test file)
|
||||||
|
|
||||||
## 2025-10-13 - 2.0.2 - fix(mailgun)
|
## 2025-10-13 - 2.0.2 - fix(mailgun)
|
||||||
Normalize package scope and modernize Mailgun client: rename package to @apiclient.xyz/mailgun, update dependencies, refactor HTTP handling, fix types, update TS config and CI, refresh docs and tests
|
Normalize package scope and modernize Mailgun client: rename package to @apiclient.xyz/mailgun, update dependencies, refactor HTTP handling, fix types, update TS config and CI, refresh docs and tests
|
||||||
|
|
||||||
|
|||||||
10
package.json
10
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@apiclient.xyz/mailgun",
|
"name": "@apiclient.xyz/mailgun",
|
||||||
"version": "2.0.2",
|
"version": "2.0.3",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "an api abstraction package for mailgun",
|
"description": "an api abstraction package for mailgun",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
@@ -9,22 +9,22 @@
|
|||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/)",
|
"test": "(tstest test/ --verbose)",
|
||||||
"build": "(tsbuild --web --allowimplicitany)",
|
"build": "(tsbuild --web --allowimplicitany)",
|
||||||
"format": "(gitzone format)",
|
"format": "(gitzone format)",
|
||||||
"buildDocs": "tsdoc"
|
"buildDocs": "tsdoc"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@git.zone/tsbuild": "^2.1.65",
|
"@git.zone/tsbuild": "^2.1.65",
|
||||||
"@git.zone/tstest": "^2.5.0",
|
"@git.zone/tstest": "^2.6.2",
|
||||||
"@push.rocks/qenv": "^6.1.3",
|
"@push.rocks/qenv": "^6.1.3",
|
||||||
"@push.rocks/tapbundle": "^6.0.3",
|
"@push.rocks/tapbundle": "^6.0.3",
|
||||||
"@types/node": "^24.7.2"
|
"@types/node": "^22.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@push.rocks/smartfile": "^11.2.7",
|
"@push.rocks/smartfile": "^11.2.7",
|
||||||
"@push.rocks/smartmail": "^2.1.0",
|
"@push.rocks/smartmail": "^2.1.0",
|
||||||
"@push.rocks/smartrequest": "^4.3.1",
|
"@push.rocks/smartrequest": "^4.3.2",
|
||||||
"@push.rocks/smartsmtp": "^3.0.3",
|
"@push.rocks/smartsmtp": "^3.0.3",
|
||||||
"@push.rocks/smartstring": "^4.0.2"
|
"@push.rocks/smartstring": "^4.0.2"
|
||||||
},
|
},
|
||||||
|
|||||||
1611
pnpm-lock.yaml
generated
1611
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -50,8 +50,10 @@ tap.test('should send a smartmail with empty body', async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should retrieve a mail using a retrieval url', async () => {
|
tap.test('should retrieve a mail using a retrieval url', async () => {
|
||||||
|
// Note: This test requires a valid message storage URL from a recently sent email
|
||||||
|
// Storage URLs are available for 3 days after sending via Events API or Mailgun dashboard
|
||||||
const result = await testMailgunAccount.retrieveSmartMailFromMessageUrl(
|
const result = await testMailgunAccount.retrieveSmartMailFromMessageUrl(
|
||||||
'https://sw.api.mailgun.net/v3/domains/mail.lossless.one/messages/AgMFnnnAKC8xp_dDa79LyoxhloxtaVmnRA==',
|
'https://api.eu.mailgun.net/v3/domains/mail.lossless.one/messages/AgMFnnnAKC8xp_dDa79LyoxhloxtaVmnRA==',
|
||||||
);
|
);
|
||||||
console.log(result);
|
console.log(result);
|
||||||
|
|
||||||
@@ -66,4 +68,4 @@ tap.test('should retrieve a mail using a retrieval url', async () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.start();
|
export default tap.start();
|
||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@apiclient.xyz/mailgun',
|
name: '@apiclient.xyz/mailgun',
|
||||||
version: '2.0.2',
|
version: '2.0.3',
|
||||||
description: 'an api abstraction package for mailgun'
|
description: 'an api abstraction package for mailgun'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export class MailgunAccount {
|
|||||||
this.apiBaseUrl =
|
this.apiBaseUrl =
|
||||||
this.options.region === 'eu'
|
this.options.region === 'eu'
|
||||||
? 'https://api.eu.mailgun.net/v3'
|
? 'https://api.eu.mailgun.net/v3'
|
||||||
: 'https://api..mailgun.net/v3';
|
: 'https://api.mailgun.net/v3';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -127,8 +127,24 @@ export class MailgunAccount {
|
|||||||
);
|
);
|
||||||
return await response.json();
|
return await response.json();
|
||||||
} else {
|
} else {
|
||||||
console.log(await response.json());
|
let errorMessage = `HTTP ${response.status}: ${response.statusText}`;
|
||||||
throw new Error('could not send email');
|
try {
|
||||||
|
// Get response body as text first
|
||||||
|
const errorText = await response.text();
|
||||||
|
console.log(errorText);
|
||||||
|
|
||||||
|
// Try to parse as JSON
|
||||||
|
try {
|
||||||
|
const errorBody = JSON.parse(errorText);
|
||||||
|
errorMessage = errorBody.message || JSON.stringify(errorBody);
|
||||||
|
} catch {
|
||||||
|
// Not JSON, use plain text
|
||||||
|
errorMessage = errorText || errorMessage;
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// Couldn't read body at all
|
||||||
|
}
|
||||||
|
throw new Error(`could not send email: ${errorMessage}`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log(
|
console.log(
|
||||||
|
|||||||
Reference in New Issue
Block a user