@salespark/mailerlite-api 1.0.1 β 1.0.3
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 +40 -22
- package/dist/index.d.ts +1 -61
- package/dist/index.js +1 -1
- package/package.json +10 -21
package/README.md
CHANGED
|
@@ -2,26 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
[MailerLite API v2](https://developers.mailerlite.com/docs/getting-started-with-mailerlite-api) [Node.js](https://nodejs.org/en/) SDK. It is mostly a thin wrapper on [axios](https://github.com/axios/axios) that provides [authentication](https://developers.mailerlite.com/docs/authentication), response/request camelCase transformations, Typescript type definitions and some handy shorthand methods.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
---
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## π¦ Installation
|
|
8
8
|
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
```
|
|
9
|
+
```bash
|
|
10
|
+
yarn add @salespark/mailerlite-api
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
# or
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
yarn add @salespark/mailerlite-api
|
|
14
|
+
npm install @salespark/mailerlite-api
|
|
17
15
|
```
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## π Usage
|
|
20
20
|
|
|
21
21
|
In node:
|
|
22
22
|
|
|
23
23
|
```javascript
|
|
24
|
-
const MailerLite = require('@salespark/mailerlite-api')
|
|
24
|
+
const MailerLite = require('@salespark/mailerlite-api');
|
|
25
25
|
|
|
26
26
|
const mailerLite = MailerLite('YOUR_API_KEY');
|
|
27
27
|
|
|
@@ -39,7 +39,7 @@ async function getAccountEmail() {
|
|
|
39
39
|
|
|
40
40
|
It is important to note that the request is resolved to response body - it does not return the full axios response object.
|
|
41
41
|
|
|
42
|
-
## Options
|
|
42
|
+
## βοΈ Options
|
|
43
43
|
|
|
44
44
|
`axiosOptions`: `object` - additional [axios config](https://github.com/axios/axios#request-config). This config does not overwrite the explicit `baseURL` and `headers` options below.
|
|
45
45
|
|
|
@@ -49,7 +49,7 @@ It is important to note that the request is resolved to response body - it does
|
|
|
49
49
|
|
|
50
50
|
`useCaseConverter`: `boolean` - should the library convert all query params, request body and response body to camelCase. Defaults to `true`.
|
|
51
51
|
|
|
52
|
-
## Method reference
|
|
52
|
+
## π Method reference
|
|
53
53
|
|
|
54
54
|
For complete reference, visit the [official MailerLite API reference](https://developers.mailerlite.com/reference).
|
|
55
55
|
|
|
@@ -189,20 +189,38 @@ Shorthand that resolves to a Promise<boolean>.
|
|
|
189
189
|
|
|
190
190
|
#### `removeWebhook(webhookId)`
|
|
191
191
|
|
|
192
|
-
## Tests
|
|
193
|
-
|
|
194
|
-
Tests right now are quite limited, mostly concerned with reading data. To run them, you'll need to create a `config.ts` file and enter your API key in it (as per `config.example.ts`).
|
|
195
|
-
|
|
196
|
-
```
|
|
197
|
-
npm install
|
|
198
|
-
npm test
|
|
199
|
-
```
|
|
200
|
-
|
|
201
192
|
---
|
|
202
193
|
|
|
203
|
-
|
|
194
|
+
## Fixed: CWE-918
|
|
195
|
+
|
|
204
196
|
[Server-Side Request Forgery (SSRF)](https://cwe.mitre.org/data/definitions/918.html)
|
|
205
197
|
[Axios Bug](https://github.com/axios/axios/issues/6463)
|
|
206
198
|
|
|
207
199
|
Forked from:
|
|
208
200
|
https://github.com/zygos/mailerlite-v2-node
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
### π Internal Usage Notice
|
|
205
|
+
|
|
206
|
+
This package is primarily designed and maintained for internal use within the SalesPark ecosystem.
|
|
207
|
+
While it can technically be used in other Node.js/Mongoose projects, no official support or guarantees are provided outside of SalesPark-managed projects.
|
|
208
|
+
|
|
209
|
+
All code follows the same engineering standards applied across the SalesPark platform, ensuring consistency, reliability, and long-term maintainability of our internal systems.
|
|
210
|
+
|
|
211
|
+
β‘ Note: This package is most efficient and works best when used together with other official SalesPark packages, where interoperability and optimizations are fully leveraged.
|
|
212
|
+
|
|
213
|
+
Disclaimer: This software is provided βas isβ, without warranties of any kind, express or implied. SalesPark shall not be held liable for any issues, damages, or losses arising from its use outside the intended SalesPark environment.
|
|
214
|
+
|
|
215
|
+
Organization packages: https://www.npmjs.com/org/salespark
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## π License
|
|
220
|
+
|
|
221
|
+
MIT Β© [SalesPark](https://salespark.io)
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
_Document version: 2_
|
|
226
|
+
_Last update: 21-08-2025_
|
package/dist/index.d.ts
CHANGED
|
@@ -1,61 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function MailerLite(apiKey: string, options?: Options): {
|
|
3
|
-
getWebhooks(): Promise<any[]>;
|
|
4
|
-
getWebhooksCount(): Promise<number>;
|
|
5
|
-
getWebhooksRaw(): Promise<import("./@types").WebhooksResponse>;
|
|
6
|
-
getWebhook(webhookId: number): Promise<import("axios").AxiosResponse<any, any>>;
|
|
7
|
-
createWebhook(webhook: import("./@types").WebhookData): Promise<import("axios").AxiosResponse<any, any>>;
|
|
8
|
-
updateWebhook(webhookId: number, webhook: import("./@types").WebhookData): Promise<import("axios").AxiosResponse<any, any>>;
|
|
9
|
-
removeWebhook(webhookId: number): Promise<import("axios").AxiosResponse<any, any>>;
|
|
10
|
-
getTimezones(): Promise<import("./@types").Timezone>;
|
|
11
|
-
getTimezone(timezoneId: number): Promise<import("./@types").Timezone>;
|
|
12
|
-
getSubscribers(params?: import("./@types").SubscriberQuery): Promise<import("axios").AxiosResponse<any, any>>;
|
|
13
|
-
addSubscriber(subscriber: import("./@types").SubscriberData): Promise<import("axios").AxiosResponse<any, any>>;
|
|
14
|
-
getSubscriber(identifier: number | string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
15
|
-
updateSubscriber(identifier: number | string, subscriber: import("./@types").SubscriberDataUpdate): Promise<import("axios").AxiosResponse<any, any>>;
|
|
16
|
-
searchSubscribers(params?: import("./@types").SubscriberSearchQuery): Promise<import("axios").AxiosResponse<any, any>>;
|
|
17
|
-
getSubscriberActivity(identifier: number | string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
18
|
-
getSubscriberActivityByType(identifier: number | string, activityType: import("./@types").SubscriberActivityType): Promise<import("axios").AxiosResponse<any, any>>;
|
|
19
|
-
getSubscriberGroups(identifier: number | string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
20
|
-
removeSubscriber(identifier: number | string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
21
|
-
getStats(): Promise<import("./@types").Stats>;
|
|
22
|
-
getDoubleOptinStatus(): Promise<import("./@types").DoubleOptinStatus>;
|
|
23
|
-
hasEnabledDoubleOptin(): Promise<boolean>;
|
|
24
|
-
setDoubleOptin(isEnabled: boolean): Promise<import("./@types").DoubleOptinStatus>;
|
|
25
|
-
enableDoubleOptin(): Promise<import("./@types").DoubleOptinStatus>;
|
|
26
|
-
disableDoubleOptin(): Promise<import("./@types").DoubleOptinStatus>;
|
|
27
|
-
getSegments(params?: import("./@types").SegmentQuery): Promise<any[]>;
|
|
28
|
-
getSegmentsCount(params?: import("./@types").SegmentQuery): Promise<number>;
|
|
29
|
-
getSegmentsRaw(params?: import("./@types").SegmentQuery): Promise<import("./@types").SegmentsResponse>;
|
|
30
|
-
getGroups(params?: import("./@types").GroupQuery): Promise<import("./api/groups").MailerLiteGroup[]>;
|
|
31
|
-
searchGroups(groupName: import("./@types").GroupSearchQuery["group_name"]): Promise<import("./api/groups").MailerLiteGroup[]>;
|
|
32
|
-
getGroup(groupId: number): Promise<import("./api/groups").MailerLiteGroup>;
|
|
33
|
-
createGroup(group: import("./@types").GroupData): Promise<import("./api/groups").MailerLiteGroup>;
|
|
34
|
-
updateGroup(groupId: number, groupUpdate: import("./@types").GroupData): Promise<import("axios").AxiosResponse<any, any>>;
|
|
35
|
-
removeGroup(groupId: number): Promise<{
|
|
36
|
-
success: boolean;
|
|
37
|
-
}>;
|
|
38
|
-
addSubscriberToGroup(groupId: number, subscriber: import("./@types").GroupSubscriberData): Promise<import("axios").AxiosResponse<any, any>>;
|
|
39
|
-
addSubscribersToGroup(groupId: number, subscribers: import("./@types").GroupSubscriberData[], importOptions?: import("./@types").GroupSubscriberFlags): Promise<import("axios").AxiosResponse<any, any>>;
|
|
40
|
-
getSubscribersGroupImport(groupId: number, importId: number): Promise<import("axios").AxiosResponse<any, any>>;
|
|
41
|
-
getGroupSubscriber(groupId: number, subscriberId: number): Promise<import("axios").AxiosResponse<any, any>>;
|
|
42
|
-
getGroupSubscribers(groupId: number, params?: import("./@types").SubscriberGroupQuery): Promise<import("axios").AxiosResponse<any, any>>;
|
|
43
|
-
getGroupSubscriberCount(groupId: number): Promise<number>;
|
|
44
|
-
getGroupSubscribersByType(groupId: number, subscriberType: import("./@types").SubscriberType, params?: import("./@types").GroupQuery): Promise<import("axios").AxiosResponse<any, any>>;
|
|
45
|
-
getGroupSubscribersCountByType(groupId: number, subscriberType: import("./@types").SubscriberType): Promise<number>;
|
|
46
|
-
removeGroupSubscriber(groupId: number, subscriberIdentifier: number | string): Promise<string>;
|
|
47
|
-
getFields(): Promise<import("axios").AxiosResponse<any, any>>;
|
|
48
|
-
createField(field: import("./@types").FieldData): Promise<import("axios").AxiosResponse<any, any>>;
|
|
49
|
-
updateField(fieldId: number, fieldUpdate: import("./@types").FieldUpdate): Promise<import("axios").AxiosResponse<any, any>>;
|
|
50
|
-
removeField(fieldId: number): Promise<import("axios").AxiosResponse<any, any>>;
|
|
51
|
-
actOnCampaign(campaignId: number, action: import("./@types").CampaignAction, data?: import("./@types").CampaignSendData): Promise<import("axios").AxiosResponse<any, any>>;
|
|
52
|
-
getCampaigns(status?: import("./@types").CampaignStatus, params?: import("./@types").CampaignQuery): Promise<import("axios").AxiosResponse<any, any>>;
|
|
53
|
-
getCampaignCount(status?: import("./@types").CampaignStatus): Promise<number>;
|
|
54
|
-
createCampaign(campaign: import("./@types").CampaignData): Promise<import("axios").AxiosResponse<any, any>>;
|
|
55
|
-
removeCampaign(campaignId: number): Promise<import("axios").AxiosResponse<any, any>>;
|
|
56
|
-
setCampaignContent(campaignId: number, content: import("./@types").CampaignContent): Promise<import("axios").AxiosResponse<any, any>>;
|
|
57
|
-
batch(requests: import("./@types").Batch[]): Promise<any[]>;
|
|
58
|
-
getAccountRaw(): Promise<import("./@types").AccountWrap>;
|
|
59
|
-
getAccount(): Promise<import("./@types").Account>;
|
|
60
|
-
getMe(): Promise<import("./@types").Account>;
|
|
61
|
-
};
|
|
1
|
+
export {};
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.default = MailerLite;
|
|
18
17
|
var client_1 = __importDefault(require("./client"));
|
|
19
18
|
var account_1 = __importDefault(require("./api/account"));
|
|
20
19
|
var batch_1 = __importDefault(require("./api/batch"));
|
|
@@ -32,3 +31,4 @@ function MailerLite(apiKey, options) {
|
|
|
32
31
|
var client = (0, client_1.default)(apiKey, options);
|
|
33
32
|
return __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, (0, account_1.default)(client)), (0, batch_1.default)(client)), (0, campaigns_1.default)(client)), (0, fields_1.default)(client)), (0, groups_1.default)(client)), (0, segments_1.default)(client)), (0, settings_1.default)(client)), (0, stats_1.default)(client)), (0, subscribers_1.default)(client)), (0, timezones_1.default)(client)), (0, webhooks_1.default)(client));
|
|
34
33
|
}
|
|
34
|
+
module.exports = MailerLite;
|
package/package.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salespark/mailerlite-api",
|
|
3
|
-
"
|
|
3
|
+
"description": "MailerLite API v2 Node.js SDK. It is mostly a thin wrapper on axios that provides authentication, response/request camelCase transformations, Typescript type definitions and some handy shorthand methods.",
|
|
4
|
+
"version": "1.0.3",
|
|
4
5
|
"main": "dist/index.js",
|
|
5
6
|
"types": "dist/index.d.ts",
|
|
6
7
|
"scripts": {
|
|
7
|
-
"test": "npx jest --config jest.config.js",
|
|
8
|
-
"test:watch": "npx jest --config jest.config.js --watch",
|
|
9
8
|
"lint": "npx eslint ./src --ext .ts,.tsx",
|
|
9
|
+
"clean": "rimraf dist",
|
|
10
10
|
"lint:fix": "npx eslint ./src --fix --ext .ts,.tsx",
|
|
11
11
|
"build": "tsc && cp -r src/@types dist",
|
|
12
|
-
"prepare": "npm run build"
|
|
12
|
+
"prepare": "npm run build",
|
|
13
|
+
"prepublishOnly": "yarn run clean && yarn run build"
|
|
13
14
|
},
|
|
14
|
-
"author": "
|
|
15
|
+
"author": "SalesPark",
|
|
15
16
|
"license": "MIT",
|
|
16
17
|
"dependencies": {
|
|
17
18
|
"axios": "^1.10.0",
|
|
@@ -19,7 +20,6 @@
|
|
|
19
20
|
"snakecase-keys": "^8.0.1"
|
|
20
21
|
},
|
|
21
22
|
"devDependencies": {
|
|
22
|
-
"@types/jest": "^30.0.0",
|
|
23
23
|
"@types/node": "^24.0.6",
|
|
24
24
|
"@typescript-eslint/eslint-plugin": "^8.35.0",
|
|
25
25
|
"@typescript-eslint/parser": "^8.35.0",
|
|
@@ -30,20 +30,8 @@
|
|
|
30
30
|
"eslint-plugin-node": "^11.1.0",
|
|
31
31
|
"eslint-plugin-promise": "^7.2.1",
|
|
32
32
|
"eslint-plugin-standard": "^5.0.0",
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"jest-extended": "^6.0.0",
|
|
36
|
-
"ts-jest": "^29.4.0",
|
|
37
|
-
"typescript": "^5.3.3"
|
|
38
|
-
},
|
|
39
|
-
"husky": {
|
|
40
|
-
"hooks": {
|
|
41
|
-
"pre-commit": "npm test",
|
|
42
|
-
"pre-push": "npm test"
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
"directories": {
|
|
46
|
-
"test": "test"
|
|
33
|
+
"typescript": "^5.3.3",
|
|
34
|
+
"rimraf": "^6.0.1"
|
|
47
35
|
},
|
|
48
36
|
"homepage": "https://salespark.io",
|
|
49
37
|
"repository": {
|
|
@@ -53,7 +41,8 @@
|
|
|
53
41
|
"keywords": [
|
|
54
42
|
"mailerlite",
|
|
55
43
|
"node",
|
|
56
|
-
"api"
|
|
44
|
+
"api",
|
|
45
|
+
"salespark"
|
|
57
46
|
],
|
|
58
47
|
"files": [
|
|
59
48
|
"dist/**/*"
|