@maloma/listmonk 1.0.0 → 1.0.1

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.
Files changed (107) hide show
  1. package/README.md +14 -8
  2. package/dist/index.d.ts +5917 -63
  3. package/dist/index.js +765 -14271
  4. package/dist/testing/index.d.ts +900 -38
  5. package/dist/testing/index.js +1 -5
  6. package/package.json +38 -59
  7. package/dist/chunk-saezhne8.js +0 -14
  8. package/dist/chunk-saezhne8.js.map +0 -9
  9. package/dist/client.d.ts +0 -430
  10. package/dist/errors/api.d.ts +0 -178
  11. package/dist/errors/base.d.ts +0 -47
  12. package/dist/errors/configuration.d.ts +0 -49
  13. package/dist/errors/index.d.ts +0 -13
  14. package/dist/errors/network.d.ts +0 -69
  15. package/dist/errors/validation.d.ts +0 -57
  16. package/dist/http/auth.d.ts +0 -39
  17. package/dist/http/client.d.ts +0 -149
  18. package/dist/http/hooks.d.ts +0 -90
  19. package/dist/http/index.d.ts +0 -10
  20. package/dist/http/resource.d.ts +0 -100
  21. package/dist/http/sse.d.ts +0 -36
  22. package/dist/http/url.d.ts +0 -51
  23. package/dist/index.js.map +0 -120
  24. package/dist/resources/admin/admin.d.ts +0 -92
  25. package/dist/resources/admin/index.d.ts +0 -10
  26. package/dist/resources/admin/schemas.d.ts +0 -23
  27. package/dist/resources/admin/types.d.ts +0 -29
  28. package/dist/resources/bounces/bounces.d.ts +0 -262
  29. package/dist/resources/bounces/index.d.ts +0 -10
  30. package/dist/resources/bounces/schemas.d.ts +0 -86
  31. package/dist/resources/bounces/types.d.ts +0 -37
  32. package/dist/resources/campaigns/campaigns.d.ts +0 -339
  33. package/dist/resources/campaigns/index.d.ts +0 -10
  34. package/dist/resources/campaigns/schemas.d.ts +0 -374
  35. package/dist/resources/campaigns/types.d.ts +0 -111
  36. package/dist/resources/dashboard/dashboard.d.ts +0 -73
  37. package/dist/resources/dashboard/index.d.ts +0 -10
  38. package/dist/resources/dashboard/schemas.d.ts +0 -55
  39. package/dist/resources/dashboard/types.d.ts +0 -22
  40. package/dist/resources/import/import.d.ts +0 -215
  41. package/dist/resources/import/index.d.ts +0 -10
  42. package/dist/resources/import/schemas.d.ts +0 -109
  43. package/dist/resources/import/types.d.ts +0 -72
  44. package/dist/resources/lists/index.d.ts +0 -10
  45. package/dist/resources/lists/lists.d.ts +0 -180
  46. package/dist/resources/lists/schemas.d.ts +0 -176
  47. package/dist/resources/lists/types.d.ts +0 -56
  48. package/dist/resources/maintenance/index.d.ts +0 -10
  49. package/dist/resources/maintenance/maintenance.d.ts +0 -92
  50. package/dist/resources/maintenance/schemas.d.ts +0 -36
  51. package/dist/resources/maintenance/types.d.ts +0 -31
  52. package/dist/resources/media/index.d.ts +0 -10
  53. package/dist/resources/media/media.d.ts +0 -198
  54. package/dist/resources/media/schemas.d.ts +0 -48
  55. package/dist/resources/media/types.d.ts +0 -48
  56. package/dist/resources/public/index.d.ts +0 -10
  57. package/dist/resources/public/public.d.ts +0 -111
  58. package/dist/resources/public/schemas.d.ts +0 -52
  59. package/dist/resources/public/types.d.ts +0 -30
  60. package/dist/resources/settings/index.d.ts +0 -10
  61. package/dist/resources/settings/schemas.d.ts +0 -374
  62. package/dist/resources/settings/settings.d.ts +0 -106
  63. package/dist/resources/settings/types.d.ts +0 -78
  64. package/dist/resources/subscribers/index.d.ts +0 -10
  65. package/dist/resources/subscribers/schemas.d.ts +0 -360
  66. package/dist/resources/subscribers/subscribers.d.ts +0 -308
  67. package/dist/resources/subscribers/types.d.ts +0 -113
  68. package/dist/resources/templates/index.d.ts +0 -10
  69. package/dist/resources/templates/schemas.d.ts +0 -110
  70. package/dist/resources/templates/templates.d.ts +0 -225
  71. package/dist/resources/templates/types.d.ts +0 -45
  72. package/dist/resources/tx/index.d.ts +0 -10
  73. package/dist/resources/tx/schemas.d.ts +0 -67
  74. package/dist/resources/tx/tx.d.ts +0 -167
  75. package/dist/resources/tx/types.d.ts +0 -88
  76. package/dist/schemas/common.d.ts +0 -48
  77. package/dist/schemas/index.d.ts +0 -6
  78. package/dist/testing/errors.d.ts +0 -25
  79. package/dist/testing/factories/bounce.d.ts +0 -43
  80. package/dist/testing/factories/campaign.d.ts +0 -43
  81. package/dist/testing/factories/common.d.ts +0 -54
  82. package/dist/testing/factories/index.d.ts +0 -12
  83. package/dist/testing/factories/list.d.ts +0 -43
  84. package/dist/testing/factories/media.d.ts +0 -40
  85. package/dist/testing/factories/subscriber.d.ts +0 -43
  86. package/dist/testing/factories/template.d.ts +0 -40
  87. package/dist/testing/index.js.map +0 -32
  88. package/dist/testing/mock-client.d.ts +0 -119
  89. package/dist/testing/mock-function.d.ts +0 -28
  90. package/dist/testing/resources/admin.d.ts +0 -20
  91. package/dist/testing/resources/bounces.d.ts +0 -22
  92. package/dist/testing/resources/campaigns.d.ts +0 -31
  93. package/dist/testing/resources/dashboard.d.ts +0 -17
  94. package/dist/testing/resources/import.d.ts +0 -19
  95. package/dist/testing/resources/index.d.ts +0 -18
  96. package/dist/testing/resources/lists.d.ts +0 -24
  97. package/dist/testing/resources/maintenance.d.ts +0 -18
  98. package/dist/testing/resources/media.d.ts +0 -21
  99. package/dist/testing/resources/public.d.ts +0 -18
  100. package/dist/testing/resources/settings.d.ts +0 -19
  101. package/dist/testing/resources/subscribers.d.ts +0 -33
  102. package/dist/testing/resources/templates.d.ts +0 -24
  103. package/dist/testing/resources/tx.d.ts +0 -16
  104. package/dist/testing/types.d.ts +0 -138
  105. package/dist/types/config.d.ts +0 -59
  106. package/dist/types/index.d.ts +0 -7
  107. package/dist/types/pagination.d.ts +0 -37
@@ -1,5 +1,3 @@
1
- import"../chunk-saezhne8.js";
2
-
3
1
  // src/testing/errors.ts
4
2
  class MockNotConfiguredError extends Error {
5
3
  name = "MockNotConfiguredError";
@@ -34,7 +32,7 @@ function createMockFunction(resourceName, methodName) {
34
32
  throw error;
35
33
  }
36
34
  try {
37
- const result = implementation(...args);
35
+ const result = implementation?.(...args);
38
36
  if (result instanceof Promise) {
39
37
  return result.then((value) => {
40
38
  state.results.push({
@@ -569,5 +567,3 @@ export {
569
567
  MockNotConfiguredError,
570
568
  MockListmonkClient
571
569
  };
572
-
573
- //# debugId=367CDA81B275C35364756E2164756E21
package/package.json CHANGED
@@ -1,9 +1,27 @@
1
1
  {
2
2
  "name": "@maloma/listmonk",
3
- "version": "1.0.0",
4
- "description": "Production-grade TypeScript SDK for the listmonk email marketing platform API",
5
- "author": "maloma",
3
+ "version": "1.0.1",
4
+ "description": "TypeScript SDK for the listmonk email marketing platform API",
5
+ "keywords": [
6
+ "listmonk",
7
+ "email",
8
+ "newsletter",
9
+ "mailing list",
10
+ "typescript",
11
+ "sdk",
12
+ "api",
13
+ "email marketing"
14
+ ],
15
+ "homepage": "https://maloma.org/projects/listmonk-sdk",
16
+ "bugs": {
17
+ "url": "https://codeberg.org/maloma/listmonk-sdk/issues"
18
+ },
19
+ "repository": {
20
+ "url": "https://codeberg.org/maloma/listmonk-sdk.git"
21
+ },
6
22
  "license": "MIT",
23
+ "author": "maloma",
24
+ "sideEffects": false,
7
25
  "type": "module",
8
26
  "exports": {
9
27
  ".": {
@@ -30,68 +48,29 @@
30
48
  "README.md",
31
49
  "LICENSE"
32
50
  ],
33
- "sideEffects": false,
34
- "packageManager": "bun@1.3.5",
35
- "engines": {
36
- "bun": ">=1.3.0",
37
- "node": ">=22.0.0"
38
- },
39
- "keywords": [
40
- "listmonk",
41
- "email",
42
- "newsletter",
43
- "mailing list",
44
- "typescript",
45
- "sdk",
46
- "api",
47
- "email marketing"
48
- ],
49
- "homepage": "https://maloma.org/projects/listmonk-sdk",
50
- "bugs": {
51
- "url": "https://codeberg.org/maloma/listmonk-sdk/issues"
52
- },
53
- "repository": {
54
- "type": "git",
55
- "url": "https://codeberg.org/maloma/listmonk-sdk.git"
56
- },
57
51
  "scripts": {
58
- "build": "bun run build:js && bun run build:types",
59
- "build:js": "bun run scripts/build.ts",
60
- "build:types": "tsc -p tsconfig.build.json",
61
- "test": "bun test tests/",
62
- "test:unit": "bun test tests/unit/",
63
- "test:integration": "bun test tests/integration/",
64
- "test:e2e": "bun test tests/e2e/",
65
- "check": "biome check",
66
- "lint": "biome lint --write",
67
- "format": "biome format --write",
68
- "typecheck": "tsc -p tsconfig.check.json",
69
- "docs": "typedoc",
70
- "prepublishOnly": "bun run build && bun test tests/unit/ tests/integration/"
52
+ "build": "bunup src/index.ts src/testing/index.ts --dts.infer-types",
53
+ "test": "bun test tests/unit/ tests/integration/",
54
+ "lint": "biome check",
55
+ "lint:fix": "biome check --write",
56
+ "typecheck": "tsc --noEmit",
57
+ "prepublishOnly": "bun run build && bun run test"
71
58
  },
72
59
  "dependencies": {
73
- "zod": "^4.3.5"
74
- },
75
- "publishConfig": {
76
- "access": "public",
77
- "registry": "https://registry.npmjs.org"
78
- },
79
- "overrides": {
80
- "got": "11.8.5"
60
+ "zod": "^4.3.6"
81
61
  },
82
62
  "devDependencies": {
83
- "@biomejs/biome": "2.3.11",
84
63
  "@bun-security-scanner/osv": "^1.0.0",
85
- "@commitlint/cli": "^20.3.0",
86
- "@commitlint/config-conventional": "^20.3.0",
87
- "@saithodev/semantic-release-gitea": "^2.0.0",
88
- "@semantic-release/changelog": "^6.0.0",
89
- "@semantic-release/git": "^10.0.0",
90
- "@tsconfig/bun": "^1.0.10",
91
- "@types/bun": "^1.3.5",
92
- "semantic-release": "^25.0.0",
93
- "typedoc": "^0.28.15",
94
- "typedoc-plugin-markdown": "^4.0.0",
64
+ "@types/bun": "^1.3.6",
65
+ "bunup": "^0.16.20",
95
66
  "typescript": "^5.9.3"
67
+ },
68
+ "packageManager": "bun@1.3.6",
69
+ "engines": {
70
+ "bun": ">=1.3.0",
71
+ "node": ">=22.0.0"
72
+ },
73
+ "publishConfig": {
74
+ "access": "public"
96
75
  }
97
76
  }
@@ -1,14 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __export = (target, all) => {
3
- for (var name in all)
4
- __defProp(target, name, {
5
- get: all[name],
6
- enumerable: true,
7
- configurable: true,
8
- set: (newValue) => all[name] = () => newValue
9
- });
10
- };
11
-
12
- export { __export };
13
-
14
- //# debugId=934851CB66A4F95F64756E2164756E21
@@ -1,9 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [
5
- ],
6
- "mappings": "",
7
- "debugId": "934851CB66A4F95F64756E2164756E21",
8
- "names": []
9
- }
package/dist/client.d.ts DELETED
@@ -1,430 +0,0 @@
1
- /**
2
- * Main Listmonk client class.
3
- *
4
- * The primary entry point for the SDK. Validates configuration,
5
- * creates the HTTP client, and provides access to resource modules.
6
- *
7
- * @module client
8
- */
9
- import { HttpClient } from "./http/client";
10
- import type { ClientOptionsInput } from "./types/config";
11
- import { SubscribersResource } from "./resources/subscribers";
12
- import { ListsResource } from "./resources/lists";
13
- import { CampaignsResource } from "./resources/campaigns";
14
- import { TemplatesResource } from "./resources/templates";
15
- import { TransactionalResource } from "./resources/tx";
16
- import { MediaResource } from "./resources/media";
17
- import { ImportResource } from "./resources/import";
18
- import { BouncesResource } from "./resources/bounces";
19
- import { SettingsResource } from "./resources/settings";
20
- import { DashboardResource } from "./resources/dashboard";
21
- import { AdminResource } from "./resources/admin";
22
- import { MaintenanceResource } from "./resources/maintenance";
23
- import { PublicResource } from "./resources/public";
24
- import type { ServerHealth, ServerConfig } from "./resources/settings/types";
25
- /**
26
- * Listmonk SDK client for interacting with the listmonk API.
27
- *
28
- * @example
29
- * ```typescript
30
- * import { Listmonk } from '@maloma/listmonk';
31
- *
32
- * const client = new Listmonk({
33
- * url: 'https://listmonk.example.com',
34
- * auth: {
35
- * username: 'admin',
36
- * password: 'secret',
37
- * },
38
- * });
39
- *
40
- * // Use resource modules (to be added in subsequent specs)
41
- * // const subscribers = await client.subscribers.list();
42
- * ```
43
- */
44
- export declare class Listmonk {
45
- /** @internal The underlying HTTP client */
46
- private readonly _httpClient;
47
- /**
48
- * Subscribers resource for managing subscriber lifecycle.
49
- *
50
- * @example
51
- * ```typescript
52
- * // Create a subscriber
53
- * const subscriber = await client.subscribers.create({
54
- * email: 'john@example.com',
55
- * name: 'John Doe',
56
- * status: 'enabled',
57
- * });
58
- *
59
- * // List subscribers
60
- * for await (const sub of client.subscribers.listAll()) {
61
- * console.log(sub.email);
62
- * }
63
- * ```
64
- */
65
- readonly subscribers: SubscribersResource;
66
- /**
67
- * Lists resource for managing mailing lists.
68
- *
69
- * @example
70
- * ```typescript
71
- * // Create a list
72
- * const list = await client.lists.create({
73
- * name: 'Newsletter',
74
- * type: 'public',
75
- * optin: 'double',
76
- * });
77
- *
78
- * // List all lists
79
- * for await (const l of client.lists.listAll()) {
80
- * console.log(l.name);
81
- * }
82
- * ```
83
- */
84
- readonly lists: ListsResource;
85
- /**
86
- * Campaigns resource for managing email campaigns.
87
- *
88
- * @example
89
- * ```typescript
90
- * // Create a campaign
91
- * const campaign = await client.campaigns.create({
92
- * name: 'Weekly Newsletter',
93
- * subject: 'This Week in Tech',
94
- * lists: [1],
95
- * body: '<h1>Hello!</h1>',
96
- * content_type: 'html',
97
- * });
98
- *
99
- * // Start the campaign
100
- * await client.campaigns.updateStatus(campaign.id, 'running');
101
- *
102
- * // List all campaigns
103
- * for await (const c of client.campaigns.listAll()) {
104
- * console.log(c.name, c.status);
105
- * }
106
- * ```
107
- */
108
- readonly campaigns: CampaignsResource;
109
- /**
110
- * Templates resource for managing email templates.
111
- *
112
- * @example
113
- * ```typescript
114
- * // Create a template
115
- * const template = await client.templates.create({
116
- * name: 'Newsletter Template',
117
- * type: 'campaign',
118
- * body: '<html>{{ template "content" . }}</html>',
119
- * });
120
- *
121
- * // List all templates
122
- * for await (const t of client.templates.listAll()) {
123
- * console.log(t.name, t.is_default);
124
- * }
125
- *
126
- * // Set as default
127
- * await client.templates.setDefault(template.id);
128
- * ```
129
- */
130
- readonly templates: TemplatesResource;
131
- /**
132
- * Transactional resource for sending application-triggered emails.
133
- *
134
- * @example
135
- * ```typescript
136
- * // Send to an existing subscriber
137
- * await client.tx.send({
138
- * template_id: 2,
139
- * subscriber_email: 'user@example.com',
140
- * });
141
- *
142
- * // Send with template data
143
- * await client.tx.send({
144
- * template_id: 2,
145
- * subscriber_email: 'user@example.com',
146
- * data: {
147
- * order_id: '12345',
148
- * total: '$99.99',
149
- * },
150
- * });
151
- *
152
- * // Send to external recipient
153
- * await client.tx.send({
154
- * template_id: 2,
155
- * subscriber_mode: 'external',
156
- * subscriber_emails: ['guest@example.com'],
157
- * });
158
- *
159
- * // Send with file attachment
160
- * await client.tx.send({
161
- * template_id: 2,
162
- * subscriber_email: 'user@example.com',
163
- * attachments: [
164
- * { filename: 'invoice.pdf', content: pdfBuffer },
165
- * ],
166
- * });
167
- * ```
168
- */
169
- readonly tx: TransactionalResource;
170
- /**
171
- * Media resource for managing media files (images, PDFs, etc.).
172
- *
173
- * @example
174
- * ```typescript
175
- * // Upload a file (Browser)
176
- * const file = new File([content], 'hero.jpg', { type: 'image/jpeg' });
177
- * const media = await client.media.upload(file);
178
- * console.log(`URL: ${media.url}`);
179
- *
180
- * // Upload a file (Node.js)
181
- * import { readFileSync } from 'fs';
182
- * const media = await client.media.upload({
183
- * filename: 'hero.jpg',
184
- * content: readFileSync('./hero.jpg'),
185
- * });
186
- *
187
- * // List all media
188
- * const allMedia = await client.media.list();
189
- *
190
- * // Delete media
191
- * const deleted = await client.media.remove(42);
192
- * ```
193
- */
194
- readonly media: MediaResource;
195
- /**
196
- * Import resource for bulk subscriber import from CSV/ZIP files.
197
- *
198
- * @example
199
- * ```typescript
200
- * // Start import (Browser)
201
- * const file = new File([csvContent], 'subscribers.csv');
202
- * await client.import.start(file, {
203
- * mode: 'subscribe',
204
- * delimiter: ',',
205
- * lists: [1, 2],
206
- * });
207
- *
208
- * // Start import (Node.js)
209
- * import { readFileSync } from 'fs';
210
- * await client.import.start(
211
- * { filename: 'subscribers.csv', content: readFileSync('./subscribers.csv') },
212
- * { mode: 'subscribe', delimiter: ',', lists: [1] }
213
- * );
214
- *
215
- * // Poll for completion
216
- * let status = await client.import.getStatus();
217
- * while (status.status === 'processing') {
218
- * await new Promise(r => setTimeout(r, 1000));
219
- * status = await client.import.getStatus();
220
- * }
221
- *
222
- * // Check logs
223
- * const logs = await client.import.getLogs();
224
- *
225
- * // Cancel if needed
226
- * await client.import.cancel();
227
- * ```
228
- */
229
- readonly import: ImportResource;
230
- /**
231
- * Bounces resource for managing email bounce records.
232
- *
233
- * @example
234
- * ```typescript
235
- * // List bounces with filtering
236
- * const bounces = await client.bounces.list({
237
- * campaign_id: 5,
238
- * order_by: 'created_at',
239
- * order: 'desc',
240
- * });
241
- *
242
- * // Iterate all bounces
243
- * for await (const bounce of client.bounces.listAll()) {
244
- * if (bounce.type === 'hard') {
245
- * console.log(`Hard bounce: ${bounce.email}`);
246
- * }
247
- * }
248
- *
249
- * // Delete a specific bounce
250
- * await client.bounces.remove(123);
251
- *
252
- * // Blocklist all bounced subscribers
253
- * await client.bounces.blocklistBounced();
254
- * ```
255
- */
256
- readonly bounces: BouncesResource;
257
- /**
258
- * Settings resource for managing server settings.
259
- *
260
- * @example
261
- * ```typescript
262
- * // Get all settings
263
- * const settings = await client.settings.getAll();
264
- * console.log(settings['app.site_name']);
265
- *
266
- * // Update settings
267
- * const result = await client.settings.update({
268
- * 'app.site_name': 'My Newsletter',
269
- * ...settings,
270
- * });
271
- *
272
- * // Test SMTP configuration
273
- * const logs = await client.settings.testSmtp({
274
- * host: 'smtp.example.com',
275
- * port: 587,
276
- * auth_protocol: 'login',
277
- * username: 'user',
278
- * password: 'pass',
279
- * tls_type: 'STARTTLS',
280
- * email: 'test@example.com',
281
- * });
282
- * ```
283
- */
284
- readonly settings: SettingsResource;
285
- /**
286
- * Dashboard resource for retrieving statistics.
287
- *
288
- * @example
289
- * ```typescript
290
- * // Get dashboard counts
291
- * const counts = await client.dashboard.getCounts();
292
- * console.log(`Total subscribers: ${counts.subscribers.total}`);
293
- *
294
- * // Get chart data
295
- * const charts = await client.dashboard.getCharts();
296
- * for (const point of charts.link_clicks) {
297
- * console.log(`${point.date}: ${point.count} clicks`);
298
- * }
299
- * ```
300
- */
301
- readonly dashboard: DashboardResource;
302
- /**
303
- * Admin resource for server administration.
304
- *
305
- * @example
306
- * ```typescript
307
- * // Reload application
308
- * await client.admin.reload();
309
- *
310
- * // Get logs
311
- * const logs = await client.admin.getLogs();
312
- *
313
- * // Stream events
314
- * for await (const event of client.admin.getEventStream()) {
315
- * console.log(event.type, event.message);
316
- * }
317
- * ```
318
- */
319
- readonly admin: AdminResource;
320
- /**
321
- * Maintenance resource for cleanup operations.
322
- *
323
- * @example
324
- * ```typescript
325
- * // Delete blocklisted subscribers
326
- * const result = await client.maintenance.gcSubscribers('blocklisted');
327
- * console.log(`Deleted ${result.count} subscribers`);
328
- *
329
- * // Delete old analytics
330
- * await client.maintenance.gcAnalytics('all', '2025-01-01T00:00:00Z');
331
- * ```
332
- */
333
- readonly maintenance: MaintenanceResource;
334
- /**
335
- * Public resource for unauthenticated endpoints.
336
- *
337
- * @example
338
- * ```typescript
339
- * // Get public lists
340
- * const lists = await client.public.getLists();
341
- *
342
- * // Submit subscription
343
- * const result = await client.public.subscribe({
344
- * email: 'user@example.com',
345
- * list_uuids: [lists[0].uuid],
346
- * });
347
- *
348
- * // Get CAPTCHA challenge
349
- * const challenge = await client.public.getCaptchaChallenge();
350
- * ```
351
- */
352
- readonly public: PublicResource;
353
- /**
354
- * Creates a new Listmonk client.
355
- *
356
- * @param options - Client configuration options
357
- * @throws {ListmonkConfigurationError} If options are invalid
358
- *
359
- * @example
360
- * ```typescript
361
- * const client = new Listmonk({
362
- * url: 'https://listmonk.example.com',
363
- * auth: { username: 'admin', password: 'secret' },
364
- * timeout: 60_000, // Optional, default 30s
365
- * maxRetries: 5, // Optional, default 3
366
- * debug: true, // Optional, default false
367
- * });
368
- * ```
369
- */
370
- constructor(options: ClientOptionsInput);
371
- /**
372
- * Gets the underlying HTTP client.
373
- * For internal use by resource modules.
374
- * @internal
375
- */
376
- get httpClient(): HttpClient;
377
- /**
378
- * Checks server health (authenticated endpoint).
379
- *
380
- * Returns `true` if the server is healthy and reachable.
381
- * Throws an error on network failure or authentication issues.
382
- *
383
- * @returns `true` if server is healthy
384
- * @throws {ListmonkApiError} On API errors
385
- * @throws {ListmonkNetworkError} On network failures
386
- *
387
- * @example
388
- * ```typescript
389
- * const healthy = await client.health();
390
- * console.log(`Server healthy: ${healthy}`); // true
391
- * ```
392
- */
393
- health(): Promise<ServerHealth>;
394
- /**
395
- * Checks server health (public endpoint, no authentication).
396
- *
397
- * Useful for health checks before authentication is configured
398
- * or for public monitoring systems.
399
- *
400
- * @returns `true` if server is healthy
401
- * @throws {ListmonkNetworkError} On network failures
402
- *
403
- * @example
404
- * ```typescript
405
- * const healthy = await client.publicHealth();
406
- * console.log(`Server reachable: ${healthy}`); // true
407
- * ```
408
- */
409
- publicHealth(): Promise<ServerHealth>;
410
- /**
411
- * Retrieves server configuration and capabilities.
412
- *
413
- * Returns information about the server version, enabled features,
414
- * available updates, and runtime configuration.
415
- *
416
- * @returns Server configuration object
417
- *
418
- * @example
419
- * ```typescript
420
- * const config = await client.getConfig();
421
- * console.log(`Version: ${config.version}`);
422
- * console.log(`Needs restart: ${config.needs_restart}`);
423
- *
424
- * if (config.update?.is_new) {
425
- * console.log(`Update available: ${config.update.release_version}`);
426
- * }
427
- * ```
428
- */
429
- getConfig(): Promise<ServerConfig>;
430
- }