ts-mailcow-api 1.5.0 → 1.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DeleteQuarantineRequest, MailcowResponse, QuarantineItem } from '../types';
|
|
1
|
+
import { DeleteQuarantineRequest, EditQuarantineItemRequest, MailcowResponse, QuarantineItem } from '../types';
|
|
2
2
|
import MailcowClient from '../index';
|
|
3
3
|
/**
|
|
4
4
|
* Interface for all Quarantine endpoints related to email handling in Mailcow.
|
|
@@ -10,6 +10,13 @@ export interface QuarantineEndpoints {
|
|
|
10
10
|
* @returns A promise that resolves to the Mailcow API response indicating success or failure.
|
|
11
11
|
*/
|
|
12
12
|
delete(payload: DeleteQuarantineRequest): Promise<MailcowResponse>;
|
|
13
|
+
/**
|
|
14
|
+
* Acts on quarantined emails: release them to the recipient's inbox
|
|
15
|
+
* or learn them as ham to improve future Rspamd filtering.
|
|
16
|
+
* @param payload - The IDs to act on and the action to take.
|
|
17
|
+
* @returns A promise that resolves to the Mailcow API response indicating success or failure.
|
|
18
|
+
*/
|
|
19
|
+
edit(payload: EditQuarantineItemRequest): Promise<MailcowResponse>;
|
|
13
20
|
/**
|
|
14
21
|
* Retrieves all emails currently held in quarantine.
|
|
15
22
|
* @returns A promise that resolves to an array of `QuarantineItem` representing each quarantined email.
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.quarantineEndpoints = quarantineEndpoints;
|
|
4
4
|
const QUARANTINE_ENDPOINTS = {
|
|
5
5
|
DELETE: 'delete/qitem',
|
|
6
|
+
EDIT: 'edit/qitem',
|
|
6
7
|
GET: 'get/quarantine/all',
|
|
7
8
|
};
|
|
8
9
|
/**
|
|
@@ -15,6 +16,9 @@ function quarantineEndpoints(bind) {
|
|
|
15
16
|
delete(payload) {
|
|
16
17
|
return bind.requestFactory.post(QUARANTINE_ENDPOINTS.DELETE, payload.items);
|
|
17
18
|
},
|
|
19
|
+
edit(payload) {
|
|
20
|
+
return bind.requestFactory.post(QUARANTINE_ENDPOINTS.EDIT, payload);
|
|
21
|
+
},
|
|
18
22
|
get() {
|
|
19
23
|
return bind.requestFactory.get(QUARANTINE_ENDPOINTS.GET);
|
|
20
24
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quarantine-endpoints.js","sourceRoot":"","sources":["../../src/endpoints/quarantine-endpoints.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"quarantine-endpoints.js","sourceRoot":"","sources":["../../src/endpoints/quarantine-endpoints.ts"],"names":[],"mappings":";;AAwCA,kDAYC;AAvBD,MAAM,oBAAoB,GAAG;IAC3B,MAAM,EAAE,cAAc;IACtB,IAAI,EAAE,YAAY;IAClB,GAAG,EAAE,oBAAoB;CAC1B,CAAC;AAEF;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,IAAmB;IACrD,OAAO;QACL,MAAM,CAAC,OAAgC;YACrC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAA4B,oBAAoB,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QACzG,CAAC;QACD,IAAI,CAAC,OAAkC;YACrC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAA6C,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAClH,CAAC;QACD,GAAG;YACD,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAmB,oBAAoB,CAAC,GAAG,CAAC,CAAC;QAC7E,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1687,6 +1687,33 @@ export interface DeleteQuarantineRequest {
|
|
|
1687
1687
|
*/
|
|
1688
1688
|
items: number[];
|
|
1689
1689
|
}
|
|
1690
|
+
/**
|
|
1691
|
+
* Action to take on a quarantined email via `edit/qitem`.
|
|
1692
|
+
*
|
|
1693
|
+
* - `release` -- deliver the email to the original recipient's inbox.
|
|
1694
|
+
* - `learnham` -- mark the email as ham and feed it back to Rspamd as
|
|
1695
|
+
* a training sample. Useful for false positives.
|
|
1696
|
+
*
|
|
1697
|
+
* The quarantine queue is already presumed-spam by definition, so there
|
|
1698
|
+
* is no `learnspam` counterpart -- Mailcow does not document one.
|
|
1699
|
+
*/
|
|
1700
|
+
export type QuarantineItemAction = 'release' | 'learnham';
|
|
1701
|
+
/**
|
|
1702
|
+
* Request payload for `edit/qitem`.
|
|
1703
|
+
*
|
|
1704
|
+
* The `items` array holds the IDs of the quarantined messages to act
|
|
1705
|
+
* on; the same `attr.action` is applied to every entry.
|
|
1706
|
+
*/
|
|
1707
|
+
export interface EditQuarantineItemRequest {
|
|
1708
|
+
/**
|
|
1709
|
+
* IDs of the quarantined messages to act on. Get them from
|
|
1710
|
+
* `mcc.quarantine.get()`.
|
|
1711
|
+
*/
|
|
1712
|
+
items: number[];
|
|
1713
|
+
attr: {
|
|
1714
|
+
action: QuarantineItemAction;
|
|
1715
|
+
};
|
|
1716
|
+
}
|
|
1690
1717
|
/**
|
|
1691
1718
|
* Request payload to edit rate limits for specified domains.
|
|
1692
1719
|
*/
|