@internxt/sdk 1.15.7 → 1.15.9

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.
@@ -48,7 +48,7 @@ export interface paths {
48
48
  };
49
49
  /**
50
50
  * List emails
51
- * @description Paginated list of email summaries for a given mailbox. Defaults to the inbox.
51
+ * @description Paginated list of email summaries. Filter by mailbox or omit to list all.
52
52
  */
53
53
  get: operations['EmailController_list'];
54
54
  put?: never;
@@ -127,6 +127,74 @@ export interface paths {
127
127
  patch?: never;
128
128
  trace?: never;
129
129
  };
130
+ '/gateway/accounts': {
131
+ parameters: {
132
+ query?: never;
133
+ header?: never;
134
+ path?: never;
135
+ cookie?: never;
136
+ };
137
+ get?: never;
138
+ put?: never;
139
+ /** Provision a new mail account (called by the auth service) */
140
+ post: operations['GatewayController_provisionAccount'];
141
+ delete?: never;
142
+ options?: never;
143
+ head?: never;
144
+ patch?: never;
145
+ trace?: never;
146
+ };
147
+ '/gateway/domains': {
148
+ parameters: {
149
+ query?: never;
150
+ header?: never;
151
+ path?: never;
152
+ cookie?: never;
153
+ };
154
+ /** List available mail domains (called by the auth service) */
155
+ get: operations['GatewayController_listDomains'];
156
+ put?: never;
157
+ post?: never;
158
+ delete?: never;
159
+ options?: never;
160
+ head?: never;
161
+ patch?: never;
162
+ trace?: never;
163
+ };
164
+ '/gateway/accounts/{uuid}/suspend': {
165
+ parameters: {
166
+ query?: never;
167
+ header?: never;
168
+ path?: never;
169
+ cookie?: never;
170
+ };
171
+ get?: never;
172
+ put?: never;
173
+ /** Suspend a mail account */
174
+ post: operations['GatewayController_suspendAccount'];
175
+ delete?: never;
176
+ options?: never;
177
+ head?: never;
178
+ patch?: never;
179
+ trace?: never;
180
+ };
181
+ '/gateway/accounts/{uuid}/reactivate': {
182
+ parameters: {
183
+ query?: never;
184
+ header?: never;
185
+ path?: never;
186
+ cookie?: never;
187
+ };
188
+ get?: never;
189
+ put?: never;
190
+ /** Reactivate a mail account */
191
+ post: operations['GatewayController_reactivateAccount'];
192
+ delete?: never;
193
+ options?: never;
194
+ head?: never;
195
+ patch?: never;
196
+ trace?: never;
197
+ };
130
198
  }
131
199
  export type webhooks = Record<string, never>;
132
200
  export interface components {
@@ -157,6 +225,13 @@ export interface components {
157
225
  EmailSummaryResponseDto: {
158
226
  /** @example Ma1f09b… */
159
227
  id: string;
228
+ /**
229
+ * @example [
230
+ * "d",
231
+ * "a"
232
+ * ]
233
+ */
234
+ mailboxIds: string[];
160
235
  /** @example T1a2b3c… */
161
236
  threadId: string;
162
237
  from: components['schemas']['EmailAddressDto'][];
@@ -186,10 +261,24 @@ export interface components {
186
261
  * @example 142
187
262
  */
188
263
  total: number;
264
+ /**
265
+ * @description Whether there are more emails to fetch
266
+ * @example true
267
+ */
268
+ hasMoreMails: boolean;
269
+ /** @example Ma1f09b… */
270
+ nextAnchor?: string;
189
271
  };
190
272
  EmailResponseDto: {
191
273
  /** @example Ma1f09b… */
192
274
  id: string;
275
+ /**
276
+ * @example [
277
+ * "d",
278
+ * "a"
279
+ * ]
280
+ */
281
+ mailboxIds: string[];
193
282
  /** @example T1a2b3c… */
194
283
  threadId: string;
195
284
  from: components['schemas']['EmailAddressDto'][];
@@ -215,11 +304,11 @@ export interface components {
215
304
  bcc: components['schemas']['EmailAddressDto'][];
216
305
  replyTo: components['schemas']['EmailAddressDto'][];
217
306
  /** @example 2025-06-15T10:29:55Z */
218
- sentAt: Record<string, never> | null;
307
+ sentAt: string | null;
219
308
  /** @example Hi team, here are the notes… */
220
- textBody: Record<string, never> | null;
309
+ textBody: string | null;
221
310
  /** @example <p>Hi team, here are the notes…</p> */
222
- htmlBody: Record<string, never> | null;
311
+ htmlBody: string | null;
223
312
  };
224
313
  SendEmailRequestDto: {
225
314
  /** @description Primary recipients (at least one required) */
@@ -275,6 +364,28 @@ export interface components {
275
364
  */
276
365
  isFlagged?: boolean;
277
366
  };
367
+ ProvisionAccountRequestDto: {
368
+ /**
369
+ * @description User id
370
+ * @example d7ffe6b1-434d-4eae-86a5-029f76d1aa80
371
+ */
372
+ userId: string;
373
+ /**
374
+ * @description Full email address
375
+ * @example alice@internxt.com
376
+ */
377
+ address: string;
378
+ /**
379
+ * @description Email domain
380
+ * @example internxt.com
381
+ */
382
+ domain: string;
383
+ /**
384
+ * @description User display name
385
+ * @example Alice Smith
386
+ */
387
+ displayName: string;
388
+ };
278
389
  };
279
390
  responses: never;
280
391
  parameters: never;
@@ -323,12 +434,14 @@ export interface operations {
323
434
  EmailController_list: {
324
435
  parameters: {
325
436
  query?: {
326
- /** @description Mailbox to list. Defaults to `inbox`. */
437
+ /** @description Mailbox to filter by. Omit to list emails from all mailboxes. */
327
438
  mailbox?: 'inbox' | 'drafts' | 'sent' | 'trash' | 'spam' | 'archive';
328
439
  /** @description Maximum number of emails to return. Defaults to `20`. */
329
440
  limit?: number;
330
441
  /** @description Zero-based offset for pagination. Defaults to `0`. */
331
442
  position?: number;
443
+ /** @description Anchor ID for pagination. */
444
+ anchorId?: string;
332
445
  };
333
446
  header?: never;
334
447
  path?: never;
@@ -483,4 +596,80 @@ export interface operations {
483
596
  };
484
597
  };
485
598
  };
599
+ GatewayController_provisionAccount: {
600
+ parameters: {
601
+ query?: never;
602
+ header?: never;
603
+ path?: never;
604
+ cookie?: never;
605
+ };
606
+ requestBody: {
607
+ content: {
608
+ 'application/json': components['schemas']['ProvisionAccountRequestDto'];
609
+ };
610
+ };
611
+ responses: {
612
+ 201: {
613
+ headers: {
614
+ [name: string]: unknown;
615
+ };
616
+ content?: never;
617
+ };
618
+ };
619
+ };
620
+ GatewayController_listDomains: {
621
+ parameters: {
622
+ query?: never;
623
+ header?: never;
624
+ path?: never;
625
+ cookie?: never;
626
+ };
627
+ requestBody?: never;
628
+ responses: {
629
+ 200: {
630
+ headers: {
631
+ [name: string]: unknown;
632
+ };
633
+ content?: never;
634
+ };
635
+ };
636
+ };
637
+ GatewayController_suspendAccount: {
638
+ parameters: {
639
+ query?: never;
640
+ header?: never;
641
+ path: {
642
+ uuid: string;
643
+ };
644
+ cookie?: never;
645
+ };
646
+ requestBody?: never;
647
+ responses: {
648
+ 204: {
649
+ headers: {
650
+ [name: string]: unknown;
651
+ };
652
+ content?: never;
653
+ };
654
+ };
655
+ };
656
+ GatewayController_reactivateAccount: {
657
+ parameters: {
658
+ query?: never;
659
+ header?: never;
660
+ path: {
661
+ uuid: string;
662
+ };
663
+ cookie?: never;
664
+ };
665
+ requestBody?: never;
666
+ responses: {
667
+ 204: {
668
+ headers: {
669
+ [name: string]: unknown;
670
+ };
671
+ content?: never;
672
+ };
673
+ };
674
+ };
486
675
  }
@@ -129,7 +129,7 @@ function uploadMultipartFile(network_1, crypto_1, bucketId_1, mnemonic_1, fileSi
129
129
  index: index.toString('hex'),
130
130
  shards: [{ hash: hash, uuid: uuid, UploadId: UploadId, parts: uploadedPartsReference }],
131
131
  };
132
- return [4 /*yield*/, network.finishUpload(bucketId, finishUploadPayload, signal)];
132
+ return [4 /*yield*/, network.finishMultipartUpload(bucketId, finishUploadPayload, signal)];
133
133
  case 5:
134
134
  finishUploadResponse = _c.sent();
135
135
  return [2 /*return*/, finishUploadResponse.id];
@@ -41,7 +41,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
41
41
  Object.defineProperty(exports, "__esModule", { value: true });
42
42
  exports.HttpClient = void 0;
43
43
  var axios_1 = __importDefault(require("axios"));
44
- var errors_1 = __importDefault(require("../types/errors"));
44
+ var errors_1 = require("../types/errors");
45
45
  var retryWithBackoff_1 = require("./retryWithBackoff");
46
46
  var HttpClient = /** @class */ (function () {
47
47
  function HttpClient(baseURL, unauthorizedCallback, retryOptions) {
@@ -277,26 +277,20 @@ var HttpClient = /** @class */ (function () {
277
277
  * @private
278
278
  */
279
279
  HttpClient.prototype.normalizeError = function (error) {
280
- var errorMessage, errorStatus, errorCode, errorHeaders;
280
+ var _a, _b, _c, _d, _e, _f;
281
+ var baseUrl = (_b = (_a = error.config) === null || _a === void 0 ? void 0 : _a.baseURL) !== null && _b !== void 0 ? _b : '';
282
+ var url = (_d = (_c = error.config) === null || _c === void 0 ? void 0 : _c.url) !== null && _d !== void 0 ? _d : '';
283
+ var method = (_f = (_e = error.config) === null || _e === void 0 ? void 0 : _e.method) !== null && _f !== void 0 ? _f : '';
284
+ var request = "".concat(method, " ").concat(baseUrl).concat(url);
281
285
  if (error.response) {
282
- var response = error.response;
283
- if (response.status === 401) {
286
+ if (error.response.status === 401) {
284
287
  this.unauthorizedCallback();
285
288
  }
286
- errorMessage = response.data.message || response.data.error || JSON.stringify(response.data);
287
- errorStatus = response.status;
288
- errorCode = response.data.code;
289
- errorHeaders = response.headers;
290
- }
291
- else if (error.request) {
292
- errorMessage = 'Server unavailable';
293
- errorStatus = 500;
289
+ throw new errors_1.AxiosResponseError(error.message, request, error.response);
294
290
  }
295
291
  else {
296
- errorMessage = error.message;
297
- errorStatus = 400;
292
+ throw new errors_1.AxiosUnknownError(error.message, request, error);
298
293
  }
299
- throw new errors_1.default(errorMessage, errorStatus, errorCode, errorHeaders);
300
294
  };
301
295
  HttpClient.globalInterceptors = [];
302
296
  return HttpClient;
@@ -1,3 +1,4 @@
1
+ import { AxiosError, AxiosResponse } from 'axios';
1
2
  export default class AppError extends Error {
2
3
  readonly status?: number;
3
4
  readonly code?: string;
@@ -5,3 +6,16 @@ export default class AppError extends Error {
5
6
  readonly requestId?: string;
6
7
  constructor(message: string, status?: number, code?: string, headers?: Record<string, string>);
7
8
  }
9
+ export declare class AxiosResponseError extends Error {
10
+ readonly request: string;
11
+ readonly data: unknown;
12
+ readonly status: number;
13
+ readonly xRequestId: string | undefined;
14
+ constructor(message: string, request: string, response: AxiosResponse);
15
+ }
16
+ export declare class AxiosUnknownError extends Error {
17
+ readonly request: string;
18
+ readonly status: number;
19
+ readonly code: string | undefined;
20
+ constructor(message: string, request: string, error: AxiosError);
21
+ }
@@ -15,6 +15,7 @@ var __extends = (this && this.__extends) || (function () {
15
15
  };
16
16
  })();
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.AxiosUnknownError = exports.AxiosResponseError = void 0;
18
19
  var AppError = /** @class */ (function (_super) {
19
20
  __extends(AppError, _super);
20
21
  function AppError(message, status, code, headers) {
@@ -29,3 +30,31 @@ var AppError = /** @class */ (function (_super) {
29
30
  return AppError;
30
31
  }(Error));
31
32
  exports.default = AppError;
33
+ var AxiosResponseError = /** @class */ (function (_super) {
34
+ __extends(AxiosResponseError, _super);
35
+ function AxiosResponseError(message, request, response) {
36
+ var _a;
37
+ var _this = _super.call(this, message) || this;
38
+ _this.request = request;
39
+ _this.data = response.data;
40
+ _this.status = response.status;
41
+ _this.xRequestId = (_a = response.headers) === null || _a === void 0 ? void 0 : _a['x-request-id'];
42
+ Object.setPrototypeOf(_this, AxiosResponseError.prototype);
43
+ return _this;
44
+ }
45
+ return AxiosResponseError;
46
+ }(Error));
47
+ exports.AxiosResponseError = AxiosResponseError;
48
+ var AxiosUnknownError = /** @class */ (function (_super) {
49
+ __extends(AxiosUnknownError, _super);
50
+ function AxiosUnknownError(message, request, error) {
51
+ var _this = _super.call(this, message) || this;
52
+ _this.request = request;
53
+ _this.status = error.request ? 500 : 400;
54
+ _this.code = error.code;
55
+ Object.setPrototypeOf(_this, AxiosUnknownError.prototype);
56
+ return _this;
57
+ }
58
+ return AxiosUnknownError;
59
+ }(Error));
60
+ exports.AxiosUnknownError = AxiosUnknownError;
package/dist/utils.d.ts CHANGED
@@ -1,3 +1 @@
1
- import { AxiosError } from 'axios';
2
- export declare function extractAxiosErrorMessage(err: AxiosError): string;
3
1
  export declare function isHexString(string: string): boolean;
package/dist/utils.js CHANGED
@@ -1,23 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.extractAxiosErrorMessage = extractAxiosErrorMessage;
4
3
  exports.isHexString = isHexString;
5
- function extractAxiosErrorMessage(err) {
6
- var errMsg;
7
- var error = err;
8
- var isServerError = !!error.response;
9
- var serverUnavailable = !!error.request;
10
- if (isServerError) {
11
- errMsg = error.response.data.error;
12
- }
13
- else if (serverUnavailable) {
14
- errMsg = 'Server not available';
15
- }
16
- else {
17
- errMsg = error.message;
18
- }
19
- return errMsg;
20
- }
21
4
  function isHexString(string) {
22
5
  // TODO: replace with proper library
23
6
  return /^([0-9a-fA-F]{2})+$/.test(string);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@internxt/sdk",
3
3
  "author": "Internxt <hello@internxt.com>",
4
- "version": "1.15.7",
4
+ "version": "1.15.9",
5
5
  "description": "An sdk for interacting with Internxt's services",
6
6
  "repository": {
7
7
  "type": "git",
@@ -21,7 +21,7 @@
21
21
  "prepare": "husky",
22
22
  "test": "vitest run --coverage",
23
23
  "test:watch": "vitest watch",
24
- "clean": "rimraf dist coverage tsconfig.tsbuildinfo",
24
+ "clean": "rimraf dist coverage",
25
25
  "build": "yarn clean && tsc",
26
26
  "lint": "eslint ./src",
27
27
  "format": "prettier --write **/*.{js,jsx,tsx,ts}",
@@ -30,10 +30,9 @@
30
30
  },
31
31
  "devDependencies": {
32
32
  "@internxt/eslint-config-internxt": "2.1.0",
33
- "@internxt/prettier-config": "internxt/prettier-config#v1.0.2",
33
+ "@internxt/prettier-config": "internxt/prettier-config#v2.0.0",
34
34
  "@types/node": "25.5.0",
35
35
  "@vitest/coverage-istanbul": "4.1.0",
36
- "@vitest/spy": "4.1.0",
37
36
  "eslint": "10.0.3",
38
37
  "husky": "9.1.7",
39
38
  "lint-staged": "16.4.0",