mailisk 2.2.4 → 2.4.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.
package/dist/index.d.ts CHANGED
@@ -231,6 +231,108 @@ interface SendVirtualSmsParams {
231
231
  /** The body of the SMS message */
232
232
  body: string;
233
233
  }
234
+ type TotpAlgorithm = "SHA1" | "SHA256" | "SHA512";
235
+ type KnownTotpDeviceSource = "shared_secret" | "custom" | "base32_secret_key" | "otpauth_url";
236
+ type TotpDeviceSource = KnownTotpDeviceSource | (string & {});
237
+ interface TotpDevice {
238
+ id: string;
239
+ organisation_id: string;
240
+ name: string;
241
+ username?: string | null;
242
+ issuer?: string | null;
243
+ digits: number;
244
+ period: number;
245
+ algorithm: TotpAlgorithm;
246
+ source: TotpDeviceSource;
247
+ expires_at?: string | null;
248
+ created_at: string;
249
+ updated_at: string;
250
+ }
251
+ interface ListTotpDevicesParams {
252
+ /** The maximum number of saved TOTP devices returned (1-100), used alongside `offset` for pagination. */
253
+ limit?: number;
254
+ /** The number of saved TOTP devices to skip/ignore, used alongside `limit` for pagination. Must be >= 0. */
255
+ offset?: number;
256
+ /** Case-insensitive partial username match. Trimmed before sending. */
257
+ username?: string;
258
+ /** Case-insensitive partial issuer match. Trimmed before sending. */
259
+ issuer?: string;
260
+ }
261
+ interface ListTotpDevicesResponse {
262
+ total_count: number;
263
+ options: ListTotpDevicesParams;
264
+ items: TotpDevice[];
265
+ }
266
+ interface CreateTotpDeviceParams {
267
+ /** Base32 shared secret. Uses default TOTP settings. */
268
+ shared_secret: string;
269
+ /** Optional saved-device display name. Max 120 characters. */
270
+ name?: string;
271
+ /** Future ISO timestamp after which the saved device expires. */
272
+ expires_at?: string;
273
+ }
274
+ interface CreateCustomTotpDeviceParams {
275
+ /** Base32 shared secret. */
276
+ secret: string;
277
+ /** Optional saved-device display name. Max 120 characters. */
278
+ name?: string;
279
+ /** Account label. Max 240 characters. */
280
+ username?: string;
281
+ /** Issuer/app label. Max 240 characters. */
282
+ issuer?: string;
283
+ /** Number of OTP digits. */
284
+ digits?: 6 | 8;
285
+ /** OTP period in seconds. Must be an integer from 10 to 300. */
286
+ period?: number;
287
+ /** Hashing algorithm. */
288
+ algorithm?: TotpAlgorithm;
289
+ /** Future ISO timestamp after which the saved device expires. */
290
+ expires_at?: string;
291
+ }
292
+ interface CreateBase32SecretKeyTotpDeviceParams {
293
+ /** Base32 shared secret key. */
294
+ base32_secret_key: string;
295
+ /** Optional saved-device display name. Max 120 characters. */
296
+ name?: string;
297
+ /** Account label. Max 240 characters. */
298
+ username?: string;
299
+ /** Issuer/app label. Max 240 characters. */
300
+ issuer?: string;
301
+ /** Number of OTP digits. */
302
+ digits?: 6 | 8;
303
+ /** OTP period in seconds. Must be an integer from 10 to 300. */
304
+ period?: number;
305
+ /** Hashing algorithm. */
306
+ algorithm?: TotpAlgorithm;
307
+ /** Future ISO timestamp after which the saved device expires. */
308
+ expires_at?: string;
309
+ }
310
+ interface CreateOtpAuthUrlTotpDeviceParams {
311
+ /** otpauth://totp URL with a secret query parameter. */
312
+ otp_auth_url: string;
313
+ /** Optional saved-device display name. Max 120 characters. */
314
+ name?: string;
315
+ /** Account label, used when missing from the URL label. Max 240 characters. */
316
+ username?: string;
317
+ /** Issuer/app label, used when missing from the URL. Max 240 characters. */
318
+ issuer?: string;
319
+ /** Number of OTP digits, used when missing from the URL. */
320
+ digits?: 6 | 8;
321
+ /** OTP period in seconds, used when missing from the URL. Must be an integer from 10 to 300. */
322
+ period?: number;
323
+ /** Hashing algorithm, used when missing from the URL. */
324
+ algorithm?: TotpAlgorithm;
325
+ /** Future ISO timestamp after which the saved device expires. */
326
+ expires_at?: string;
327
+ }
328
+ interface GetTotpOtpParams {
329
+ /** Minimum number of seconds the returned OTP should remain valid. Must be >= 0 and less than the TOTP period. */
330
+ min_seconds_until_expire?: number;
331
+ }
332
+ interface TotpOtpResponse {
333
+ code: string;
334
+ expires: string;
335
+ }
234
336
 
235
337
  declare class MailiskClient {
236
338
  constructor({ apiKey, baseUrl, auth }: {
@@ -260,6 +362,110 @@ declare class MailiskClient {
260
362
  */
261
363
  listSmsNumbers(): Promise<ListSmsNumbersResponse>;
262
364
  sendVirtualSms(params: SendVirtualSmsParams): Promise<void>;
365
+ /**
366
+ * List saved TOTP devices.
367
+ *
368
+ * @example
369
+ * List saved TOTP devices for an issuer and username
370
+ * ```typescript
371
+ * const { items: devices } = await client.listTotpDevices({
372
+ * issuer: "GitHub",
373
+ * username: "qa@example.com",
374
+ * });
375
+ * ```
376
+ */
377
+ listTotpDevices(params?: ListTotpDevicesParams): Promise<ListTotpDevicesResponse>;
378
+ /**
379
+ * Create a saved TOTP device from a Base32 shared secret using default TOTP settings.
380
+ *
381
+ * @example
382
+ * Create a saved TOTP device from a shared secret
383
+ * ```typescript
384
+ * const device = await client.createTotpDevice({
385
+ * name: "GitHub staging",
386
+ * shared_secret: "JBSWY3DPEHPK3PXP",
387
+ * });
388
+ * ```
389
+ */
390
+ createTotpDevice(params: CreateTotpDeviceParams): Promise<TotpDevice>;
391
+ /**
392
+ * Create a saved TOTP device with custom settings.
393
+ *
394
+ * @example
395
+ * Create a saved TOTP device with custom settings
396
+ * ```typescript
397
+ * const device = await client.createCustomTotpDevice({
398
+ * name: "GitHub staging",
399
+ * secret: "JBSWY3DPEHPK3PXP",
400
+ * username: "qa@example.com",
401
+ * issuer: "GitHub",
402
+ * digits: 6,
403
+ * period: 30,
404
+ * algorithm: "SHA1",
405
+ * });
406
+ * ```
407
+ */
408
+ createCustomTotpDevice(params: CreateCustomTotpDeviceParams): Promise<TotpDevice>;
409
+ /**
410
+ * Create a saved TOTP device from a Base32 secret key.
411
+ *
412
+ * @example
413
+ * Create a saved TOTP device from a Base32 secret key
414
+ * ```typescript
415
+ * const device = await client.createTotpDeviceFromBase32SecretKey({
416
+ * base32_secret_key: "JBSWY3DPEHPK3PXP",
417
+ * username: "qa@example.com",
418
+ * issuer: "GitHub",
419
+ * });
420
+ * ```
421
+ */
422
+ createTotpDeviceFromBase32SecretKey(params: CreateBase32SecretKeyTotpDeviceParams): Promise<TotpDevice>;
423
+ /**
424
+ * Create a saved TOTP device from an otpauth://totp URL.
425
+ *
426
+ * @example
427
+ * Create a saved TOTP device from an otpauth URL
428
+ * ```typescript
429
+ * const device = await client.createTotpDeviceFromOtpAuthUrl({
430
+ * otp_auth_url: "otpauth://totp/GitHub:qa@example.com?secret=JBSWY3DPEHPK3PXP&issuer=GitHub",
431
+ * });
432
+ * ```
433
+ */
434
+ createTotpDeviceFromOtpAuthUrl(params: CreateOtpAuthUrlTotpDeviceParams): Promise<TotpDevice>;
435
+ /**
436
+ * Generate a TOTP code from a shared secret without saving a device.
437
+ *
438
+ * @example
439
+ * Generate a TOTP code from a shared secret
440
+ * ```typescript
441
+ * const { code } = await client.getTotpOtpBySharedSecret("JBSWY3DPEHPK3PXP", {
442
+ * min_seconds_until_expire: 10,
443
+ * });
444
+ * ```
445
+ */
446
+ getTotpOtpBySharedSecret(sharedSecret: string, params?: GetTotpOtpParams): Promise<TotpOtpResponse>;
447
+ /**
448
+ * Generate a TOTP code for a saved device.
449
+ *
450
+ * @example
451
+ * Generate a TOTP code for a saved device
452
+ * ```typescript
453
+ * const { code } = await client.getTotpOtpByDeviceId(device.id, {
454
+ * min_seconds_until_expire: 10,
455
+ * });
456
+ * ```
457
+ */
458
+ getTotpOtpByDeviceId(deviceId: string, params?: GetTotpOtpParams): Promise<TotpOtpResponse>;
459
+ /**
460
+ * Delete a saved TOTP device.
461
+ *
462
+ * @example
463
+ * Delete a saved TOTP device
464
+ * ```typescript
465
+ * await client.deleteTotpDevice(device.id);
466
+ * ```
467
+ */
468
+ deleteTotpDevice(deviceId: string): Promise<void>;
263
469
  /**
264
470
  * List all namespaces that belong to the current account (API key).
265
471
  */
@@ -335,4 +541,4 @@ declare class MailiskClient {
335
541
  downloadAttachment(attachmentId: string): Promise<Buffer>;
336
542
  }
337
543
 
338
- export { MailiskClient };
544
+ export { type CreateBase32SecretKeyTotpDeviceParams, type CreateCustomTotpDeviceParams, type CreateOtpAuthUrlTotpDeviceParams, type CreateTotpDeviceParams, type Email, type EmailAddress, type EmailAttachment, type GetAttachmentResponse, type GetTotpOtpParams, type KnownTotpDeviceSource, type ListNamespacesResponse, type ListSmsNumbersResponse, type ListTotpDevicesParams, type ListTotpDevicesResponse, MailiskClient, type SearchInboxParams, type SearchInboxResponse, type SearchSmsMessagesParams, type SearchSmsMessagesResponse, type SendVirtualEmailParams, type SendVirtualSmsParams, type SmsMessage, type SmsNumber, type SmtpSettings, type TotpAlgorithm, type TotpDevice, type TotpDeviceSource, type TotpOtpResponse };
package/dist/index.js CHANGED
@@ -19,22 +19,29 @@ var __copyProps = (to, from, except, desc) => {
19
19
  return to;
20
20
  };
21
21
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
22
26
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
27
  mod
24
28
  ));
25
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
26
30
 
27
31
  // src/index.ts
28
- var src_exports = {};
29
- __export(src_exports, {
32
+ var index_exports = {};
33
+ __export(index_exports, {
30
34
  MailiskClient: () => MailiskClient
31
35
  });
32
- module.exports = __toCommonJS(src_exports);
36
+ module.exports = __toCommonJS(index_exports);
33
37
 
34
38
  // src/mailisk.ts
35
39
  var import_axios = __toESM(require("axios"));
36
40
  var import_nodemailer = __toESM(require("nodemailer"));
37
41
  var MailiskClient = class {
42
+ static {
43
+ __name(this, "MailiskClient");
44
+ }
38
45
  constructor({ apiKey, baseUrl, auth }) {
39
46
  this.axiosInstance = import_axios.default.create({
40
47
  headers: {
@@ -45,6 +52,15 @@ var MailiskClient = class {
45
52
  });
46
53
  }
47
54
  axiosInstance;
55
+ /**
56
+ * Search SMS messages sent to a phone number.
57
+ *
58
+ * @example
59
+ * Search for SMS messages sent to a phone number
60
+ * ```typescript
61
+ * const { data: smsMessages } = await client.searchSmsMessages("1234567890");
62
+ * ```
63
+ */
48
64
  async searchSmsMessages(phoneNumber, params, config) {
49
65
  let _params = { ...params };
50
66
  if (params?.from_date === void 0 || params?.from_date === null) {
@@ -70,15 +86,171 @@ var MailiskClient = class {
70
86
  params: requestParams
71
87
  })).data;
72
88
  }
89
+ /**
90
+ * List all SMS phone numbers associated with the current account.
91
+ *
92
+ * @example
93
+ * List all SMS phone numbers
94
+ * ```typescript
95
+ * const { data: smsNumbers } = await client.listSmsNumbers();
96
+ * ```
97
+ */
73
98
  async listSmsNumbers() {
74
99
  return (await this.axiosInstance.get("api/sms/numbers")).data;
75
100
  }
76
101
  async sendVirtualSms(params) {
77
102
  return (await this.axiosInstance.post("api/sms/virtual", params)).data;
78
103
  }
104
+ /**
105
+ * List saved TOTP devices.
106
+ *
107
+ * @example
108
+ * List saved TOTP devices for an issuer and username
109
+ * ```typescript
110
+ * const { items: devices } = await client.listTotpDevices({
111
+ * issuer: "GitHub",
112
+ * username: "qa@example.com",
113
+ * });
114
+ * ```
115
+ */
116
+ async listTotpDevices(params) {
117
+ const requestParams = {
118
+ ...params,
119
+ username: params?.username?.trim(),
120
+ issuer: params?.issuer?.trim()
121
+ };
122
+ return (await this.axiosInstance.get("api/devices", {
123
+ params: requestParams
124
+ })).data;
125
+ }
126
+ /**
127
+ * Create a saved TOTP device from a Base32 shared secret using default TOTP settings.
128
+ *
129
+ * @example
130
+ * Create a saved TOTP device from a shared secret
131
+ * ```typescript
132
+ * const device = await client.createTotpDevice({
133
+ * name: "GitHub staging",
134
+ * shared_secret: "JBSWY3DPEHPK3PXP",
135
+ * });
136
+ * ```
137
+ */
138
+ async createTotpDevice(params) {
139
+ return (await this.axiosInstance.post("api/devices", params)).data;
140
+ }
141
+ /**
142
+ * Create a saved TOTP device with custom settings.
143
+ *
144
+ * @example
145
+ * Create a saved TOTP device with custom settings
146
+ * ```typescript
147
+ * const device = await client.createCustomTotpDevice({
148
+ * name: "GitHub staging",
149
+ * secret: "JBSWY3DPEHPK3PXP",
150
+ * username: "qa@example.com",
151
+ * issuer: "GitHub",
152
+ * digits: 6,
153
+ * period: 30,
154
+ * algorithm: "SHA1",
155
+ * });
156
+ * ```
157
+ */
158
+ async createCustomTotpDevice(params) {
159
+ return (await this.axiosInstance.post("api/devices/custom", params)).data;
160
+ }
161
+ /**
162
+ * Create a saved TOTP device from a Base32 secret key.
163
+ *
164
+ * @example
165
+ * Create a saved TOTP device from a Base32 secret key
166
+ * ```typescript
167
+ * const device = await client.createTotpDeviceFromBase32SecretKey({
168
+ * base32_secret_key: "JBSWY3DPEHPK3PXP",
169
+ * username: "qa@example.com",
170
+ * issuer: "GitHub",
171
+ * });
172
+ * ```
173
+ */
174
+ async createTotpDeviceFromBase32SecretKey(params) {
175
+ return (await this.axiosInstance.post("api/devices/base32-secret-key", params)).data;
176
+ }
177
+ /**
178
+ * Create a saved TOTP device from an otpauth://totp URL.
179
+ *
180
+ * @example
181
+ * Create a saved TOTP device from an otpauth URL
182
+ * ```typescript
183
+ * const device = await client.createTotpDeviceFromOtpAuthUrl({
184
+ * otp_auth_url: "otpauth://totp/GitHub:qa@example.com?secret=JBSWY3DPEHPK3PXP&issuer=GitHub",
185
+ * });
186
+ * ```
187
+ */
188
+ async createTotpDeviceFromOtpAuthUrl(params) {
189
+ return (await this.axiosInstance.post("api/devices/otpauth-url", params)).data;
190
+ }
191
+ /**
192
+ * Generate a TOTP code from a shared secret without saving a device.
193
+ *
194
+ * @example
195
+ * Generate a TOTP code from a shared secret
196
+ * ```typescript
197
+ * const { code } = await client.getTotpOtpBySharedSecret("JBSWY3DPEHPK3PXP", {
198
+ * min_seconds_until_expire: 10,
199
+ * });
200
+ * ```
201
+ */
202
+ async getTotpOtpBySharedSecret(sharedSecret, params) {
203
+ return (await this.axiosInstance.post("api/devices/otp", { shared_secret: sharedSecret, ...params })).data;
204
+ }
205
+ /**
206
+ * Generate a TOTP code for a saved device.
207
+ *
208
+ * @example
209
+ * Generate a TOTP code for a saved device
210
+ * ```typescript
211
+ * const { code } = await client.getTotpOtpByDeviceId(device.id, {
212
+ * min_seconds_until_expire: 10,
213
+ * });
214
+ * ```
215
+ */
216
+ async getTotpOtpByDeviceId(deviceId, params) {
217
+ const url = `api/devices/${deviceId}/otp`;
218
+ return params ? (await this.axiosInstance.get(url, { params })).data : (await this.axiosInstance.get(url)).data;
219
+ }
220
+ /**
221
+ * Delete a saved TOTP device.
222
+ *
223
+ * @example
224
+ * Delete a saved TOTP device
225
+ * ```typescript
226
+ * await client.deleteTotpDevice(device.id);
227
+ * ```
228
+ */
229
+ async deleteTotpDevice(deviceId) {
230
+ await this.axiosInstance.delete(`api/devices/${deviceId}`);
231
+ }
232
+ /**
233
+ * List all namespaces that belong to the current account (API key).
234
+ */
79
235
  async listNamespaces() {
80
236
  return (await this.axiosInstance.get("api/namespaces")).data;
81
237
  }
238
+ /**
239
+ * Send an email using the Virtual SMTP.
240
+ *
241
+ * These emails can only be sent to valid Mailisk namespaces, i.e. emails that end in @mynamespace.mailisk.net
242
+ *
243
+ * @example
244
+ * For example, sending a test email:
245
+ * ```typescript
246
+ * client.sendVirtualEmail(namespace, {
247
+ * from: "test@example.com",
248
+ * to: `john@${namespace}.mailisk.net`,
249
+ * subject: "This is a test",
250
+ * text: "Testing",
251
+ * });
252
+ * ```
253
+ */
82
254
  async sendVirtualEmail(namespace, params) {
83
255
  const smtpSettings = await this.getSmtpSettings(namespace);
84
256
  const transport = import_nodemailer.default.createTransport({
@@ -102,10 +274,42 @@ var MailiskClient = class {
102
274
  });
103
275
  transport.close();
104
276
  }
277
+ /**
278
+ * Search inbox of a namespace.
279
+ *
280
+ * By default, this calls the api using the `wait` flag. This means the call won't timeout until at least one email is received or 5 minutes pass.
281
+ * It also uses a default `from_timestamp` of **current timestamp - 15 minutes**. This means that older emails will be ignored.
282
+ *
283
+ * Both of these settings can be overriden by passing them in the `params` object.
284
+ *
285
+ * @example
286
+ * Get the latest emails
287
+ * ```typescript
288
+ * const { data: emails } = await client.searchInbox(namespace);
289
+ * ```
290
+ *
291
+ * @example
292
+ * Get the latest emails for a specific email address
293
+ * ```typescript
294
+ * const { data: emails } = await client.searchInbox(namespace, {
295
+ * to_addr_prefix: 'john@mynamespace.mailisk.net'
296
+ * });
297
+ * ```
298
+ *
299
+ * @example
300
+ * Get the last 20 emails in the namespace
301
+ * ```typescript
302
+ * const { data: emails } = await mailisk.searchInbox(namespace, {
303
+ * wait: false,
304
+ * from_timestamp: 0,
305
+ * limit: 20
306
+ * });
307
+ * ```
308
+ */
105
309
  async searchInbox(namespace, params, config) {
106
310
  let _params = { ...params };
107
311
  if (params?.from_timestamp === void 0 || params?.from_timestamp === null) {
108
- _params.from_timestamp = Math.floor(new Date().getTime() / 1e3) - 15 * 60;
312
+ _params.from_timestamp = Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3) - 15 * 60;
109
313
  }
110
314
  if (params?.wait !== false) {
111
315
  _params.wait = true;
@@ -122,6 +326,9 @@ var MailiskClient = class {
122
326
  params: _params
123
327
  })).data;
124
328
  }
329
+ /**
330
+ * Get the SMTP settings for a namespace.
331
+ */
125
332
  async getSmtpSettings(namespace) {
126
333
  const result = await this.axiosInstance.get(`api/smtp/${namespace}`);
127
334
  return result.data;
@@ -130,13 +337,25 @@ var MailiskClient = class {
130
337
  const result = await this.axiosInstance.get(`api/attachments/${attachmentId}`);
131
338
  return result.data;
132
339
  }
340
+ /**
341
+ * Download an attachment from an attachment ID.
342
+ *
343
+ * @example
344
+ * Download an attachment from an email
345
+ * ```typescript
346
+ * const attachment = email.attachments[0];
347
+ * const attachmentBuffer = await client.downloadAttachment(attachment.id);
348
+ *
349
+ * // save to file
350
+ * fs.writeFileSync(attachment.filename, attachmentBuffer);
351
+ * ```
352
+ */
133
353
  async downloadAttachment(attachmentId) {
134
354
  const result = await this.getAttachment(attachmentId);
135
355
  const response = await import_axios.default.get(result.data.download_url, { responseType: "arraybuffer" });
136
356
  return Buffer.from(response.data);
137
357
  }
138
358
  };
139
- __name(MailiskClient, "MailiskClient");
140
359
  // Annotate the CommonJS export names for ESM import in node:
141
360
  0 && (module.exports = {
142
361
  MailiskClient
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/mailisk.ts"],"sourcesContent":["export * from \"./mailisk\";\n","import axios, { AxiosBasicCredentials, AxiosInstance, AxiosRequestConfig } from \"axios\";\nimport {\n GetAttachmentResponse,\n ListNamespacesResponse,\n ListSmsNumbersResponse,\n SearchInboxParams,\n SearchInboxResponse,\n SearchSmsMessagesParams,\n SearchSmsMessagesResponse,\n SendVirtualEmailParams,\n SendVirtualSmsParams,\n SmtpSettings,\n} from \"./mailisk.interfaces\";\nimport nodemailer from \"nodemailer\";\n\nexport class MailiskClient {\n constructor({ apiKey, baseUrl, auth }: { apiKey: string; baseUrl?: string; auth?: AxiosBasicCredentials }) {\n this.axiosInstance = axios.create({\n headers: {\n \"X-Api-Key\": apiKey,\n },\n baseURL: baseUrl || \"https://api.mailisk.com/\",\n auth,\n });\n }\n\n private readonly axiosInstance: AxiosInstance;\n\n /**\n * Search SMS messages sent to a phone number.\n *\n * @example\n * Search for SMS messages sent to a phone number\n * ```typescript\n * const { data: smsMessages } = await client.searchSmsMessages(\"1234567890\");\n * ```\n */\n async searchSmsMessages(\n phoneNumber: string,\n params?: SearchSmsMessagesParams,\n config?: AxiosRequestConfig\n ): Promise<SearchSmsMessagesResponse> {\n let _params: SearchSmsMessagesParams = { ...params };\n\n // default from timestamp, 15 minutes before starting this request\n if (params?.from_date === undefined || params?.from_date === null) {\n _params.from_date = new Date(Date.now() - 15 * 60 * 1000).toISOString();\n }\n\n // by default wait for sms\n if (params?.wait !== false) {\n _params.wait = true;\n }\n\n let _config = { ...config };\n\n if (config?.maxRedirects === undefined) {\n _config.maxRedirects = 99999;\n }\n\n // by default, wait 5 minutes for emails before timing out\n if (_params.wait && config?.timeout === undefined) {\n _config.timeout = 1000 * 60 * 5;\n }\n\n const requestParams = {\n ..._params,\n from_date: _params.from_date ?? undefined,\n to_date: _params.to_date ?? undefined,\n };\n\n return (\n await this.axiosInstance.get(`api/sms/${phoneNumber}/messages`, {\n ..._config,\n params: requestParams,\n })\n ).data;\n }\n\n /**\n * List all SMS phone numbers associated with the current account.\n *\n * @example\n * List all SMS phone numbers\n * ```typescript\n * const { data: smsNumbers } = await client.listSmsNumbers();\n * ```\n */\n async listSmsNumbers(): Promise<ListSmsNumbersResponse> {\n return (await this.axiosInstance.get(\"api/sms/numbers\")).data;\n }\n\n async sendVirtualSms(params: SendVirtualSmsParams): Promise<void> {\n return (await this.axiosInstance.post(\"api/sms/virtual\", params)).data;\n }\n\n /**\n * List all namespaces that belong to the current account (API key).\n */\n async listNamespaces(): Promise<ListNamespacesResponse> {\n return (await this.axiosInstance.get(\"api/namespaces\")).data;\n }\n\n /**\n * Send an email using the Virtual SMTP.\n *\n * These emails can only be sent to valid Mailisk namespaces, i.e. emails that end in @mynamespace.mailisk.net\n *\n * @example\n * For example, sending a test email:\n * ```typescript\n * client.sendVirtualEmail(namespace, {\n * from: \"test@example.com\",\n * to: `john@${namespace}.mailisk.net`,\n * subject: \"This is a test\",\n * text: \"Testing\",\n * });\n * ```\n */\n async sendVirtualEmail(namespace: string, params: SendVirtualEmailParams): Promise<void> {\n const smtpSettings = await this.getSmtpSettings(namespace);\n\n const transport = nodemailer.createTransport({\n host: smtpSettings.data.host,\n port: smtpSettings.data.port,\n secure: false,\n auth: {\n user: smtpSettings.data.username,\n pass: smtpSettings.data.password,\n },\n });\n\n const { from, to, subject, text, html, headers, attachments } = params;\n\n await transport.sendMail({\n from,\n to,\n subject,\n text,\n html,\n headers,\n attachments,\n });\n\n transport.close();\n }\n\n /**\n * Search inbox of a namespace.\n *\n * By default, this calls the api using the `wait` flag. This means the call won't timeout until at least one email is received or 5 minutes pass.\n * It also uses a default `from_timestamp` of **current timestamp - 15 minutes**. This means that older emails will be ignored.\n *\n * Both of these settings can be overriden by passing them in the `params` object.\n *\n * @example\n * Get the latest emails\n * ```typescript\n * const { data: emails } = await client.searchInbox(namespace);\n * ```\n *\n * @example\n * Get the latest emails for a specific email address\n * ```typescript\n * const { data: emails } = await client.searchInbox(namespace, {\n * to_addr_prefix: 'john@mynamespace.mailisk.net'\n * });\n * ```\n *\n * @example\n * Get the last 20 emails in the namespace\n * ```typescript\n * const { data: emails } = await mailisk.searchInbox(namespace, {\n * wait: false,\n * from_timestamp: 0,\n * limit: 20\n * });\n * ```\n */\n async searchInbox(\n namespace: string,\n params?: SearchInboxParams,\n config?: AxiosRequestConfig\n ): Promise<SearchInboxResponse> {\n let _params = { ...params };\n\n // default from timestamp, 15 minutes before starting this request\n if (params?.from_timestamp === undefined || params?.from_timestamp === null) {\n _params.from_timestamp = Math.floor(new Date().getTime() / 1000) - 15 * 60;\n }\n\n // by default wait for email\n if (params?.wait !== false) {\n _params.wait = true;\n }\n\n let _config = { ...config };\n\n if (config?.maxRedirects === undefined) {\n _config.maxRedirects = 99999;\n }\n\n // by default, wait 5 minutes for emails before timing out\n if (_params.wait && config?.timeout === undefined) {\n _config.timeout = 1000 * 60 * 5;\n }\n\n return (\n await this.axiosInstance.get(`api/emails/${namespace}/inbox`, {\n ..._config,\n params: _params,\n })\n ).data;\n }\n\n /**\n * Get the SMTP settings for a namespace.\n */\n async getSmtpSettings(namespace: string): Promise<SmtpSettings> {\n const result = await this.axiosInstance.get(`api/smtp/${namespace}`);\n return result.data;\n }\n\n async getAttachment(attachmentId: string): Promise<GetAttachmentResponse> {\n const result = await this.axiosInstance.get(`api/attachments/${attachmentId}`);\n return result.data;\n }\n\n /**\n * Download an attachment from an attachment ID.\n *\n * @example\n * Download an attachment from an email\n * ```typescript\n * const attachment = email.attachments[0];\n * const attachmentBuffer = await client.downloadAttachment(attachment.id);\n *\n * // save to file\n * fs.writeFileSync(attachment.filename, attachmentBuffer);\n * ```\n */\n async downloadAttachment(attachmentId: string): Promise<Buffer> {\n const result = await this.getAttachment(attachmentId);\n\n const response = await axios.get(result.data.download_url, { responseType: \"arraybuffer\" });\n return Buffer.from(response.data);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAgF;AAahF,wBAAuB;AAEhB,IAAM,gBAAN,MAAoB;AAAA,EACzB,YAAY,EAAE,QAAQ,SAAS,KAAK,GAAuE;AACzG,SAAK,gBAAgB,aAAAA,QAAM,OAAO;AAAA,MAChC,SAAS;AAAA,QACP,aAAa;AAAA,MACf;AAAA,MACA,SAAS,WAAW;AAAA,MACpB;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEiB;AAAA,EAWjB,MAAM,kBACJ,aACA,QACA,QACoC;AACpC,QAAI,UAAmC,EAAE,GAAG,OAAO;AAGnD,QAAI,QAAQ,cAAc,UAAa,QAAQ,cAAc,MAAM;AACjE,cAAQ,YAAY,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,GAAI,EAAE,YAAY;AAAA,IACxE;AAGA,QAAI,QAAQ,SAAS,OAAO;AAC1B,cAAQ,OAAO;AAAA,IACjB;AAEA,QAAI,UAAU,EAAE,GAAG,OAAO;AAE1B,QAAI,QAAQ,iBAAiB,QAAW;AACtC,cAAQ,eAAe;AAAA,IACzB;AAGA,QAAI,QAAQ,QAAQ,QAAQ,YAAY,QAAW;AACjD,cAAQ,UAAU,MAAO,KAAK;AAAA,IAChC;AAEA,UAAM,gBAAgB;AAAA,MACpB,GAAG;AAAA,MACH,WAAW,QAAQ,aAAa;AAAA,MAChC,SAAS,QAAQ,WAAW;AAAA,IAC9B;AAEA,YACE,MAAM,KAAK,cAAc,IAAI,WAAW,wBAAwB;AAAA,MAC9D,GAAG;AAAA,MACH,QAAQ;AAAA,IACV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ACzB;AAGA,QAAI,QAAQ,QAAQ,QAAQ,YAAY,QAAW;AACjD,cAAQ,UAAU,MAAO,KAAK;AAAA,IAChC;AAEA,YACE,MAAM,KAAK,cAAc,IAAI,cAAc,mBAAmB;AAAA,MAC5D,GAAG;AAAA,MACH,QAAQ;AAAA,IACV,CAAC,GACD;AAAA,EACJ;AAAA,EAKA,MAAM,gBAAgB,WAA0C;AAC9D,UAAM,SAAS,MAAM,KAAK,cAAc,IAAI,YAAY,WAAW;AACnE,WAAO,OAAO;AAAA,EAChB;AAAA,EAEA,MAAM,cAAc,cAAsD;AACxE,UAAM,SAAS,MAAM,KAAK,cAAc,IAAI,mBAAmB,cAAc;AAC7E,WAAO,OAAO;AAAA,EAChB;AAAA,EAeA,MAAM,mBAAmB,cAAuC;AAC9D,UAAM,SAAS,MAAM,KAAK,cAAc,YAAY;AAEpD,UAAM,WAAW,MAAM,aAAAD,QAAM,IAAI,OAAO,KAAK,cAAc,EAAE,cAAc,cAAc,CAAC;AAC1F,WAAO,OAAO,KAAK,SAAS,IAAI;AAAA,EAClC;AACF;AAxOa;","names":["axios","nodemailer"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/mailisk.ts"],"sourcesContent":["export * from \"./mailisk\";\nexport * from \"./mailisk.interfaces\";\n","import axios, { AxiosBasicCredentials, AxiosInstance, AxiosRequestConfig } from \"axios\";\nimport {\n CreateBase32SecretKeyTotpDeviceParams,\n CreateCustomTotpDeviceParams,\n CreateOtpAuthUrlTotpDeviceParams,\n CreateTotpDeviceParams,\n GetAttachmentResponse,\n GetTotpOtpParams,\n ListNamespacesResponse,\n ListSmsNumbersResponse,\n ListTotpDevicesParams,\n ListTotpDevicesResponse,\n SearchInboxParams,\n SearchInboxResponse,\n SearchSmsMessagesParams,\n SearchSmsMessagesResponse,\n SendVirtualEmailParams,\n SendVirtualSmsParams,\n SmtpSettings,\n TotpDevice,\n TotpOtpResponse,\n} from \"./mailisk.interfaces\";\nimport nodemailer from \"nodemailer\";\n\nexport class MailiskClient {\n constructor({ apiKey, baseUrl, auth }: { apiKey: string; baseUrl?: string; auth?: AxiosBasicCredentials }) {\n this.axiosInstance = axios.create({\n headers: {\n \"X-Api-Key\": apiKey,\n },\n baseURL: baseUrl || \"https://api.mailisk.com/\",\n auth,\n });\n }\n\n private readonly axiosInstance: AxiosInstance;\n\n /**\n * Search SMS messages sent to a phone number.\n *\n * @example\n * Search for SMS messages sent to a phone number\n * ```typescript\n * const { data: smsMessages } = await client.searchSmsMessages(\"1234567890\");\n * ```\n */\n async searchSmsMessages(\n phoneNumber: string,\n params?: SearchSmsMessagesParams,\n config?: AxiosRequestConfig,\n ): Promise<SearchSmsMessagesResponse> {\n let _params: SearchSmsMessagesParams = { ...params };\n\n // default from timestamp, 15 minutes before starting this request\n if (params?.from_date === undefined || params?.from_date === null) {\n _params.from_date = new Date(Date.now() - 15 * 60 * 1000).toISOString();\n }\n\n // by default wait for sms\n if (params?.wait !== false) {\n _params.wait = true;\n }\n\n let _config = { ...config };\n\n if (config?.maxRedirects === undefined) {\n _config.maxRedirects = 99999;\n }\n\n // by default, wait 5 minutes for emails before timing out\n if (_params.wait && config?.timeout === undefined) {\n _config.timeout = 1000 * 60 * 5;\n }\n\n const requestParams = {\n ..._params,\n from_date: _params.from_date ?? undefined,\n to_date: _params.to_date ?? undefined,\n };\n\n return (\n await this.axiosInstance.get(`api/sms/${phoneNumber}/messages`, {\n ..._config,\n params: requestParams,\n })\n ).data;\n }\n\n /**\n * List all SMS phone numbers associated with the current account.\n *\n * @example\n * List all SMS phone numbers\n * ```typescript\n * const { data: smsNumbers } = await client.listSmsNumbers();\n * ```\n */\n async listSmsNumbers(): Promise<ListSmsNumbersResponse> {\n return (await this.axiosInstance.get(\"api/sms/numbers\")).data;\n }\n\n async sendVirtualSms(params: SendVirtualSmsParams): Promise<void> {\n return (await this.axiosInstance.post(\"api/sms/virtual\", params)).data;\n }\n\n /**\n * List saved TOTP devices.\n *\n * @example\n * List saved TOTP devices for an issuer and username\n * ```typescript\n * const { items: devices } = await client.listTotpDevices({\n * issuer: \"GitHub\",\n * username: \"qa@example.com\",\n * });\n * ```\n */\n async listTotpDevices(params?: ListTotpDevicesParams): Promise<ListTotpDevicesResponse> {\n const requestParams: ListTotpDevicesParams = {\n ...params,\n username: params?.username?.trim(),\n issuer: params?.issuer?.trim(),\n };\n\n return (\n await this.axiosInstance.get(\"api/devices\", {\n params: requestParams,\n })\n ).data;\n }\n\n /**\n * Create a saved TOTP device from a Base32 shared secret using default TOTP settings.\n *\n * @example\n * Create a saved TOTP device from a shared secret\n * ```typescript\n * const device = await client.createTotpDevice({\n * name: \"GitHub staging\",\n * shared_secret: \"JBSWY3DPEHPK3PXP\",\n * });\n * ```\n */\n async createTotpDevice(params: CreateTotpDeviceParams): Promise<TotpDevice> {\n return (await this.axiosInstance.post(\"api/devices\", params)).data;\n }\n\n /**\n * Create a saved TOTP device with custom settings.\n *\n * @example\n * Create a saved TOTP device with custom settings\n * ```typescript\n * const device = await client.createCustomTotpDevice({\n * name: \"GitHub staging\",\n * secret: \"JBSWY3DPEHPK3PXP\",\n * username: \"qa@example.com\",\n * issuer: \"GitHub\",\n * digits: 6,\n * period: 30,\n * algorithm: \"SHA1\",\n * });\n * ```\n */\n async createCustomTotpDevice(params: CreateCustomTotpDeviceParams): Promise<TotpDevice> {\n return (await this.axiosInstance.post(\"api/devices/custom\", params)).data;\n }\n\n /**\n * Create a saved TOTP device from a Base32 secret key.\n *\n * @example\n * Create a saved TOTP device from a Base32 secret key\n * ```typescript\n * const device = await client.createTotpDeviceFromBase32SecretKey({\n * base32_secret_key: \"JBSWY3DPEHPK3PXP\",\n * username: \"qa@example.com\",\n * issuer: \"GitHub\",\n * });\n * ```\n */\n async createTotpDeviceFromBase32SecretKey(params: CreateBase32SecretKeyTotpDeviceParams): Promise<TotpDevice> {\n return (await this.axiosInstance.post(\"api/devices/base32-secret-key\", params)).data;\n }\n\n /**\n * Create a saved TOTP device from an otpauth://totp URL.\n *\n * @example\n * Create a saved TOTP device from an otpauth URL\n * ```typescript\n * const device = await client.createTotpDeviceFromOtpAuthUrl({\n * otp_auth_url: \"otpauth://totp/GitHub:qa@example.com?secret=JBSWY3DPEHPK3PXP&issuer=GitHub\",\n * });\n * ```\n */\n async createTotpDeviceFromOtpAuthUrl(params: CreateOtpAuthUrlTotpDeviceParams): Promise<TotpDevice> {\n return (await this.axiosInstance.post(\"api/devices/otpauth-url\", params)).data;\n }\n\n /**\n * Generate a TOTP code from a shared secret without saving a device.\n *\n * @example\n * Generate a TOTP code from a shared secret\n * ```typescript\n * const { code } = await client.getTotpOtpBySharedSecret(\"JBSWY3DPEHPK3PXP\", {\n * min_seconds_until_expire: 10,\n * });\n * ```\n */\n async getTotpOtpBySharedSecret(sharedSecret: string, params?: GetTotpOtpParams): Promise<TotpOtpResponse> {\n return (await this.axiosInstance.post(\"api/devices/otp\", { shared_secret: sharedSecret, ...params })).data;\n }\n\n /**\n * Generate a TOTP code for a saved device.\n *\n * @example\n * Generate a TOTP code for a saved device\n * ```typescript\n * const { code } = await client.getTotpOtpByDeviceId(device.id, {\n * min_seconds_until_expire: 10,\n * });\n * ```\n */\n async getTotpOtpByDeviceId(deviceId: string, params?: GetTotpOtpParams): Promise<TotpOtpResponse> {\n const url = `api/devices/${deviceId}/otp`;\n\n return params ? (await this.axiosInstance.get(url, { params })).data : (await this.axiosInstance.get(url)).data;\n }\n\n /**\n * Delete a saved TOTP device.\n *\n * @example\n * Delete a saved TOTP device\n * ```typescript\n * await client.deleteTotpDevice(device.id);\n * ```\n */\n async deleteTotpDevice(deviceId: string): Promise<void> {\n await this.axiosInstance.delete(`api/devices/${deviceId}`);\n }\n\n /**\n * List all namespaces that belong to the current account (API key).\n */\n async listNamespaces(): Promise<ListNamespacesResponse> {\n return (await this.axiosInstance.get(\"api/namespaces\")).data;\n }\n\n /**\n * Send an email using the Virtual SMTP.\n *\n * These emails can only be sent to valid Mailisk namespaces, i.e. emails that end in @mynamespace.mailisk.net\n *\n * @example\n * For example, sending a test email:\n * ```typescript\n * client.sendVirtualEmail(namespace, {\n * from: \"test@example.com\",\n * to: `john@${namespace}.mailisk.net`,\n * subject: \"This is a test\",\n * text: \"Testing\",\n * });\n * ```\n */\n async sendVirtualEmail(namespace: string, params: SendVirtualEmailParams): Promise<void> {\n const smtpSettings = await this.getSmtpSettings(namespace);\n\n const transport = nodemailer.createTransport({\n host: smtpSettings.data.host,\n port: smtpSettings.data.port,\n secure: false,\n auth: {\n user: smtpSettings.data.username,\n pass: smtpSettings.data.password,\n },\n });\n\n const { from, to, subject, text, html, headers, attachments } = params;\n\n await transport.sendMail({\n from,\n to,\n subject,\n text,\n html,\n headers,\n attachments,\n });\n\n transport.close();\n }\n\n /**\n * Search inbox of a namespace.\n *\n * By default, this calls the api using the `wait` flag. This means the call won't timeout until at least one email is received or 5 minutes pass.\n * It also uses a default `from_timestamp` of **current timestamp - 15 minutes**. This means that older emails will be ignored.\n *\n * Both of these settings can be overriden by passing them in the `params` object.\n *\n * @example\n * Get the latest emails\n * ```typescript\n * const { data: emails } = await client.searchInbox(namespace);\n * ```\n *\n * @example\n * Get the latest emails for a specific email address\n * ```typescript\n * const { data: emails } = await client.searchInbox(namespace, {\n * to_addr_prefix: 'john@mynamespace.mailisk.net'\n * });\n * ```\n *\n * @example\n * Get the last 20 emails in the namespace\n * ```typescript\n * const { data: emails } = await mailisk.searchInbox(namespace, {\n * wait: false,\n * from_timestamp: 0,\n * limit: 20\n * });\n * ```\n */\n async searchInbox(\n namespace: string,\n params?: SearchInboxParams,\n config?: AxiosRequestConfig,\n ): Promise<SearchInboxResponse> {\n let _params = { ...params };\n\n // default from timestamp, 15 minutes before starting this request\n if (params?.from_timestamp === undefined || params?.from_timestamp === null) {\n _params.from_timestamp = Math.floor(new Date().getTime() / 1000) - 15 * 60;\n }\n\n // by default wait for email\n if (params?.wait !== false) {\n _params.wait = true;\n }\n\n let _config = { ...config };\n\n if (config?.maxRedirects === undefined) {\n _config.maxRedirects = 99999;\n }\n\n // by default, wait 5 minutes for emails before timing out\n if (_params.wait && config?.timeout === undefined) {\n _config.timeout = 1000 * 60 * 5;\n }\n\n return (\n await this.axiosInstance.get(`api/emails/${namespace}/inbox`, {\n ..._config,\n params: _params,\n })\n ).data;\n }\n\n /**\n * Get the SMTP settings for a namespace.\n */\n async getSmtpSettings(namespace: string): Promise<SmtpSettings> {\n const result = await this.axiosInstance.get(`api/smtp/${namespace}`);\n return result.data;\n }\n\n async getAttachment(attachmentId: string): Promise<GetAttachmentResponse> {\n const result = await this.axiosInstance.get(`api/attachments/${attachmentId}`);\n return result.data;\n }\n\n /**\n * Download an attachment from an attachment ID.\n *\n * @example\n * Download an attachment from an email\n * ```typescript\n * const attachment = email.attachments[0];\n * const attachmentBuffer = await client.downloadAttachment(attachment.id);\n *\n * // save to file\n * fs.writeFileSync(attachment.filename, attachmentBuffer);\n * ```\n */\n async downloadAttachment(attachmentId: string): Promise<Buffer> {\n const result = await this.getAttachment(attachmentId);\n\n const response = await axios.get(result.data.download_url, { responseType: \"arraybuffer\" });\n return Buffer.from(response.data);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAgF;AAsBhF,wBAAuB;AAEhB,IAAM,gBAAN,MAAoB;AAAA,EAxB3B,OAwB2B;AAAA;AAAA;AAAA,EACzB,YAAY,EAAE,QAAQ,SAAS,KAAK,GAAuE;AACzG,SAAK,gBAAgB,aAAAA,QAAM,OAAO;AAAA,MAChC,SAAS;AAAA,QACP,aAAa;AAAA,MACf;AAAA,MACA,SAAS,WAAW;AAAA,MACpB;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWjB,MAAM,kBACJ,aACA,QACA,QACoC;AACpC,QAAI,UAAmC,EAAE,GAAG,OAAO;AAGnD,QAAI,QAAQ,cAAc,UAAa,QAAQ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