@internxt/sdk 1.17.6 → 1.17.8

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.
@@ -66,6 +66,7 @@ export declare class MailApi {
66
66
  * @returns The email with the corresponding id - `EmailResponse`
67
67
  */
68
68
  getEmail(id: string): Promise<EmailResponse>;
69
+ getThreads(parentMessageId: string): Promise<EmailResponse[]>;
69
70
  /**
70
71
  * Deletes the email with the corresponding id
71
72
  *
@@ -92,6 +92,9 @@ class MailApi {
92
92
  getEmail(id) {
93
93
  return this.client.get(`/email/${id}`, this.headers());
94
94
  }
95
+ getThreads(parentMessageId) {
96
+ return this.client.get(`/email/threads/${parentMessageId}`, this.headers());
97
+ }
95
98
  /**
96
99
  * Deletes the email with the corresponding id
97
100
  *
@@ -99,7 +99,7 @@ export interface paths {
99
99
  patch?: never;
100
100
  trace?: never;
101
101
  };
102
- '/email/{id}': {
102
+ '/email/threads/{id}': {
103
103
  parameters: {
104
104
  query?: never;
105
105
  header?: never;
@@ -107,24 +107,16 @@ export interface paths {
107
107
  cookie?: never;
108
108
  };
109
109
  /**
110
- * Get email by ID
111
- * @description Returns the full email including body content, headers, and metadata.
110
+ * Get email thread by id
111
+ * @description Returns all emails in the same thread as the given id, ordered chronologically. If the email has no replies, returns a single-element array.
112
112
  */
113
- get: operations['EmailController_get'];
113
+ get: operations['EmailController_getThread'];
114
114
  put?: never;
115
115
  post?: never;
116
- /**
117
- * Delete an email
118
- * @description Permanently deletes an email by ID.
119
- */
120
- delete: operations['EmailController_delete'];
116
+ delete?: never;
121
117
  options?: never;
122
118
  head?: never;
123
- /**
124
- * Update an email
125
- * @description Partially update an email: move it to another mailbox, mark as read/unread, or flag/unflag. Multiple operations can be combined in a single request.
126
- */
127
- patch: operations['EmailController_update'];
119
+ patch?: never;
128
120
  trace?: never;
129
121
  };
130
122
  '/email/keys/lookup': {
@@ -227,6 +219,30 @@ export interface paths {
227
219
  patch?: never;
228
220
  trace?: never;
229
221
  };
222
+ '/email/{id}': {
223
+ parameters: {
224
+ query?: never;
225
+ header?: never;
226
+ path?: never;
227
+ cookie?: never;
228
+ };
229
+ get?: never;
230
+ put?: never;
231
+ post?: never;
232
+ /**
233
+ * Delete an email
234
+ * @description Permanently deletes an email by ID.
235
+ */
236
+ delete: operations['EmailController_delete'];
237
+ options?: never;
238
+ head?: never;
239
+ /**
240
+ * Update an email
241
+ * @description Partially update an email: move it to another mailbox, mark as read/unread, or flag/unflag. Multiple operations can be combined in a single request.
242
+ */
243
+ patch: operations['EmailController_update'];
244
+ trace?: never;
245
+ };
230
246
  '/users/me/mail-account': {
231
247
  parameters: {
232
248
  query?: never;
@@ -595,6 +611,11 @@ export interface components {
595
611
  * @enum {string}
596
612
  */
597
613
  deliveryMode?: 'INTERNXT' | 'EXTERNAL';
614
+ /**
615
+ * @description JMAP id of the email being replied to (for threading)
616
+ * @example Ma1f09b…
617
+ */
618
+ inReplyToEmailId?: string;
598
619
  };
599
620
  EmailCreatedResponseDto: {
600
621
  /**
@@ -821,12 +842,12 @@ export interface operations {
821
842
  };
822
843
  };
823
844
  };
824
- EmailController_get: {
845
+ EmailController_getThread: {
825
846
  parameters: {
826
847
  query?: never;
827
848
  header?: never;
828
849
  path: {
829
- /** @description Email ID */
850
+ /** @description Any email id in the thread */
830
851
  id: string;
831
852
  };
832
853
  cookie?: never;
@@ -838,7 +859,7 @@ export interface operations {
838
859
  [name: string]: unknown;
839
860
  };
840
861
  content: {
841
- 'application/json': components['schemas']['EmailResponseDto'];
862
+ 'application/json': components['schemas']['EmailResponseDto'][];
842
863
  };
843
864
  };
844
865
  /** @description Email not found */
@@ -850,66 +871,6 @@ export interface operations {
850
871
  };
851
872
  };
852
873
  };
853
- EmailController_delete: {
854
- parameters: {
855
- query?: never;
856
- header?: never;
857
- path: {
858
- /** @description Email ID */
859
- id: string;
860
- };
861
- cookie?: never;
862
- };
863
- requestBody?: never;
864
- responses: {
865
- /** @description Email deleted successfully */
866
- 204: {
867
- headers: {
868
- [name: string]: unknown;
869
- };
870
- content?: never;
871
- };
872
- /** @description Email not found */
873
- 404: {
874
- headers: {
875
- [name: string]: unknown;
876
- };
877
- content?: never;
878
- };
879
- };
880
- };
881
- EmailController_update: {
882
- parameters: {
883
- query?: never;
884
- header?: never;
885
- path: {
886
- /** @description Email ID */
887
- id: string;
888
- };
889
- cookie?: never;
890
- };
891
- requestBody: {
892
- content: {
893
- 'application/json': components['schemas']['UpdateEmailRequestDto'];
894
- };
895
- };
896
- responses: {
897
- /** @description Email updated successfully */
898
- 204: {
899
- headers: {
900
- [name: string]: unknown;
901
- };
902
- content?: never;
903
- };
904
- /** @description Email not found */
905
- 404: {
906
- headers: {
907
- [name: string]: unknown;
908
- };
909
- content?: never;
910
- };
911
- };
912
- };
913
874
  EmailController_lookupRecipientKeys: {
914
875
  parameters: {
915
876
  query?: never;
@@ -1033,6 +994,66 @@ export interface operations {
1033
994
  };
1034
995
  };
1035
996
  };
997
+ EmailController_delete: {
998
+ parameters: {
999
+ query?: never;
1000
+ header?: never;
1001
+ path: {
1002
+ /** @description Email ID */
1003
+ id: string;
1004
+ };
1005
+ cookie?: never;
1006
+ };
1007
+ requestBody?: never;
1008
+ responses: {
1009
+ /** @description Email deleted successfully */
1010
+ 204: {
1011
+ headers: {
1012
+ [name: string]: unknown;
1013
+ };
1014
+ content?: never;
1015
+ };
1016
+ /** @description Email not found */
1017
+ 404: {
1018
+ headers: {
1019
+ [name: string]: unknown;
1020
+ };
1021
+ content?: never;
1022
+ };
1023
+ };
1024
+ };
1025
+ EmailController_update: {
1026
+ parameters: {
1027
+ query?: never;
1028
+ header?: never;
1029
+ path: {
1030
+ /** @description Email ID */
1031
+ id: string;
1032
+ };
1033
+ cookie?: never;
1034
+ };
1035
+ requestBody: {
1036
+ content: {
1037
+ 'application/json': components['schemas']['UpdateEmailRequestDto'];
1038
+ };
1039
+ };
1040
+ responses: {
1041
+ /** @description Email updated successfully */
1042
+ 204: {
1043
+ headers: {
1044
+ [name: string]: unknown;
1045
+ };
1046
+ content?: never;
1047
+ };
1048
+ /** @description Email not found */
1049
+ 404: {
1050
+ headers: {
1051
+ [name: string]: unknown;
1052
+ };
1053
+ content?: never;
1054
+ };
1055
+ };
1056
+ };
1036
1057
  UserController_getMailAccount: {
1037
1058
  parameters: {
1038
1059
  query?: never;
@@ -14,6 +14,7 @@ export type DraftEmailRequest = components['schemas']['DraftEmailRequestDto'];
14
14
  export type UpdateEmailRequest = components['schemas']['UpdateEmailRequestDto'];
15
15
  export type EmailAddress = components['schemas']['EmailAddressDto'];
16
16
  export type ListEmailsQuery = operations['EmailController_list']['parameters']['query'];
17
+ export type ThreadsQuery = operations['EmailController_getThread']['parameters']['query'];
17
18
  export type SearchFiltersQuery = operations['EmailController_search']['requestBody']['content']['application/json'];
18
19
  export type EmailDomainsResponse = components['schemas']['MailDomainDto'][];
19
20
  export type UploadAttachmentResponse = components['schemas']['UploadAttachmentResponseDto'];
@@ -21,14 +21,15 @@ async function downloadFile(fileId, bucketId, mnemonic, network, crypto, toBinar
21
21
  throw new errors_1.DownloadInvalidMnemonicError();
22
22
  }
23
23
  }
24
- const { index, shards, version, size } = await network.getDownloadLinks(bucketId, fileId, opts?.token);
24
+ const fileInfo = await network.getDownloadLinks(bucketId, fileId, opts?.token);
25
+ const { index, shards, version, size } = fileInfo;
25
26
  if (!version || version === 1) {
26
27
  throw new FileVersionOneError();
27
28
  }
28
29
  iv = toBinaryData(index, types_1.BinaryDataEncoding.HEX).slice(0, 16);
29
30
  key = await crypto.generateFileKey(mnemonic, bucketId, toBinaryData(index, types_1.BinaryDataEncoding.HEX));
30
31
  const downloadables = shards.sort((sA, sB) => sA.index - sB.index);
31
- await downloadFile(downloadables, size);
32
+ await downloadFile(downloadables, fileInfo);
32
33
  await decryptFile(crypto.algorithm.type, key, iv, size);
33
34
  }
34
35
  catch (err) {
@@ -45,6 +45,10 @@ export interface GetDownloadLinksResponse {
45
45
  shards: DownloadableShard[];
46
46
  version?: number;
47
47
  size: number;
48
+ hmac?: {
49
+ value: string;
50
+ type: 'sha512';
51
+ };
48
52
  }
49
53
  export interface NetworkRequestConfig {
50
54
  client: HttpClient;
@@ -74,7 +78,7 @@ export type UploadFileMultipartFunction = (urls: string[]) => Promise<{
74
78
  ETag: string;
75
79
  }[];
76
80
  }>;
77
- export type DownloadFileFunction = (downloadables: DownloadableShard[], fileSize: number) => Promise<void>;
81
+ export type DownloadFileFunction = (downloadables: DownloadableShard[], fileInfo: GetDownloadLinksResponse) => Promise<void>;
78
82
  export type BinaryData = {
79
83
  slice: (from: number, to: number) => BinaryData;
80
84
  toString(encoding: 'hex'): 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.17.6",
4
+ "version": "1.17.8",
5
5
  "description": "An sdk for interacting with Internxt's services",
6
6
  "repository": {
7
7
  "type": "git",