@arbidocs/sdk 0.5.96 → 0.5.98

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.
@@ -2201,6 +2201,19 @@ type MailMessagePage = Omit<Required<Schemas$2['MailMessagePage']>, 'messages'>
2201
2201
  messages: MailMessage[];
2202
2202
  };
2203
2203
  type MailMessageUpdate = Schemas$2['MailMessageUpdate'];
2204
+ /** One row of the conversation list: a thread's messages in the folder listed, newest first. */
2205
+ type MailConversation = Omit<Required<Schemas$2['MailConversation']>, 'messages'> & {
2206
+ messages: MailMessage[];
2207
+ };
2208
+ type MailConversationPage = Omit<Required<Schemas$2['MailConversationPage']>, 'conversations'> & {
2209
+ conversations: MailConversation[];
2210
+ };
2211
+ /** Every message of one conversation, oldest first. */
2212
+ type MailThread = Omit<Schemas$2['MailThread'], 'messages'> & {
2213
+ messages: MailMessage[];
2214
+ };
2215
+ /** Thread keys computed by the owner's client for an older native message (see `threadKeys`). */
2216
+ type NativeThreadKey = Schemas$2['NativeThreadKey'];
2204
2217
  type MailCompose = Omit<Schemas$2['MailCompose'], 'to' | 'cc' | 'bcc'> & {
2205
2218
  to?: MailAddressInput[];
2206
2219
  cc?: MailAddressInput[];
@@ -2234,10 +2247,30 @@ interface ListMessagesOptions {
2234
2247
  limit?: number;
2235
2248
  }
2236
2249
  declare function listMessages(mail: MailFetch, options: ListMessagesOptions): Promise<MailMessagePage>;
2250
+ /**
2251
+ * One page of a folder's conversations, newest first. Native mail pages by conversation; a connected
2252
+ * account groups each page of its messages by thread (merge pages by `thread_id`).
2253
+ */
2254
+ declare function listConversations$1(mail: MailFetch, options: ListMessagesOptions): Promise<MailConversationPage>;
2255
+ /**
2256
+ * One conversation's messages, oldest first, across folders except the Trash (unless `folderId` is
2257
+ * the Trash). `threadId` is a conversation's `thread_id`.
2258
+ */
2259
+ declare function getThread(mail: MailFetch, threadId: string, options?: {
2260
+ accountId?: string;
2261
+ folderId?: string;
2262
+ }): Promise<MailThread>;
2263
+ /** The key the user's own client keys older native mail with (raw bytes). */
2264
+ declare function getNativeThreadSecret(mail: MailFetch): Promise<Uint8Array>;
2265
+ /**
2266
+ * Submit thread keys for older native messages (by `eml-` id, at most 200 a call), which the server
2267
+ * cannot key itself: their Message-IDs are encrypted. Messages already keyed keep their keys.
2268
+ */
2269
+ declare function submitNativeThreadKeys(mail: MailFetch, keys: Record<string, NativeThreadKey>): Promise<number>;
2237
2270
  declare function getMessage$1(mail: MailFetch, messageId: string, accountId?: string): Promise<MailMessage>;
2238
2271
  /** The bytes of one attachment of a message. */
2239
2272
  declare function downloadAttachment(mail: MailFetch, messageId: string, attachmentId: string, accountId?: string): Promise<Uint8Array>;
2240
- /** Mark read or unread, move to a folder, or send to Trash. */
2273
+ /** Mark read or unread, flag or unflag, move to a folder, or send to Trash. */
2241
2274
  declare function updateMessage(mail: MailFetch, messageId: string, update: MailMessageUpdate, accountId?: string): Promise<void>;
2242
2275
  /**
2243
2276
  * Save a draft. In the native mailbox it lands in Drafts; an agent's draft lands in its owner's
@@ -2293,6 +2326,8 @@ type mail_MailAddress = MailAddress;
2293
2326
  type mail_MailAddressInput = MailAddressInput;
2294
2327
  type mail_MailAttachment = MailAttachment;
2295
2328
  type mail_MailCompose = MailCompose;
2329
+ type mail_MailConversation = MailConversation;
2330
+ type mail_MailConversationPage = MailConversationPage;
2296
2331
  type mail_MailDraftEditorOpen = MailDraftEditorOpen;
2297
2332
  type mail_MailDraftEditorSession = MailDraftEditorSession;
2298
2333
  type mail_MailDraftSaved = MailDraftSaved;
@@ -2304,24 +2339,29 @@ type mail_MailMessageUpdate = MailMessageUpdate;
2304
2339
  type mail_MailPolicy = MailPolicy;
2305
2340
  type mail_MailSend = MailSend;
2306
2341
  type mail_MailSendResult = MailSendResult;
2342
+ type mail_MailThread = MailThread;
2307
2343
  declare const mail_NATIVE_ACCOUNT: typeof NATIVE_ACCOUNT;
2308
2344
  type mail_NativeMailKeys = NativeMailKeys;
2345
+ type mail_NativeThreadKey = NativeThreadKey;
2309
2346
  declare const mail_attachmentFromBytes: typeof attachmentFromBytes;
2310
2347
  declare const mail_claimNativeAlias: typeof claimNativeAlias;
2311
2348
  declare const mail_createMailFetch: typeof createMailFetch;
2312
2349
  declare const mail_downloadAttachment: typeof downloadAttachment;
2313
2350
  declare const mail_getMailPolicy: typeof getMailPolicy;
2351
+ declare const mail_getNativeThreadSecret: typeof getNativeThreadSecret;
2352
+ declare const mail_getThread: typeof getThread;
2314
2353
  declare const mail_listFolders: typeof listFolders;
2315
2354
  declare const mail_listMailAccounts: typeof listMailAccounts;
2316
2355
  declare const mail_listMessages: typeof listMessages;
2317
2356
  declare const mail_openDraftEditor: typeof openDraftEditor;
2318
2357
  declare const mail_saveDraft: typeof saveDraft;
2319
2358
  declare const mail_sendMessage: typeof sendMessage;
2359
+ declare const mail_submitNativeThreadKeys: typeof submitNativeThreadKeys;
2320
2360
  declare const mail_unlockMailCredentials: typeof unlockMailCredentials;
2321
2361
  declare const mail_unlockNativeMail: typeof unlockNativeMail;
2322
2362
  declare const mail_updateMessage: typeof updateMessage;
2323
2363
  declare namespace mail {
2324
- export { type mail_ListMessagesOptions as ListMessagesOptions, type mail_MailAccount as MailAccount, type mail_MailAddress as MailAddress, type mail_MailAddressInput as MailAddressInput, type mail_MailAttachment as MailAttachment, type mail_MailCompose as MailCompose, type mail_MailDraftEditorOpen as MailDraftEditorOpen, type mail_MailDraftEditorSession as MailDraftEditorSession, type mail_MailDraftSaved as MailDraftSaved, type mail_MailFetch as MailFetch, type mail_MailFolder as MailFolder, type mail_MailMessage as MailMessage, type mail_MailMessagePage as MailMessagePage, type mail_MailMessageUpdate as MailMessageUpdate, type mail_MailPolicy as MailPolicy, type mail_MailSend as MailSend, type mail_MailSendResult as MailSendResult, mail_NATIVE_ACCOUNT as NATIVE_ACCOUNT, type mail_NativeMailKeys as NativeMailKeys, mail_attachmentFromBytes as attachmentFromBytes, mail_claimNativeAlias as claimNativeAlias, mail_createMailFetch as createMailFetch, mail_downloadAttachment as downloadAttachment, mail_getMailPolicy as getMailPolicy, getMessage$1 as getMessage, mail_listFolders as listFolders, mail_listMailAccounts as listMailAccounts, mail_listMessages as listMessages, mail_openDraftEditor as openDraftEditor, mail_saveDraft as saveDraft, mail_sendMessage as sendMessage, mail_unlockMailCredentials as unlockMailCredentials, mail_unlockNativeMail as unlockNativeMail, mail_updateMessage as updateMessage };
2364
+ export { type mail_ListMessagesOptions as ListMessagesOptions, type mail_MailAccount as MailAccount, type mail_MailAddress as MailAddress, type mail_MailAddressInput as MailAddressInput, type mail_MailAttachment as MailAttachment, type mail_MailCompose as MailCompose, type mail_MailConversation as MailConversation, type mail_MailConversationPage as MailConversationPage, type mail_MailDraftEditorOpen as MailDraftEditorOpen, type mail_MailDraftEditorSession as MailDraftEditorSession, type mail_MailDraftSaved as MailDraftSaved, type mail_MailFetch as MailFetch, type mail_MailFolder as MailFolder, type mail_MailMessage as MailMessage, type mail_MailMessagePage as MailMessagePage, type mail_MailMessageUpdate as MailMessageUpdate, type mail_MailPolicy as MailPolicy, type mail_MailSend as MailSend, type mail_MailSendResult as MailSendResult, type mail_MailThread as MailThread, mail_NATIVE_ACCOUNT as NATIVE_ACCOUNT, type mail_NativeMailKeys as NativeMailKeys, type mail_NativeThreadKey as NativeThreadKey, mail_attachmentFromBytes as attachmentFromBytes, mail_claimNativeAlias as claimNativeAlias, mail_createMailFetch as createMailFetch, mail_downloadAttachment as downloadAttachment, mail_getMailPolicy as getMailPolicy, getMessage$1 as getMessage, mail_getNativeThreadSecret as getNativeThreadSecret, mail_getThread as getThread, listConversations$1 as listConversations, mail_listFolders as listFolders, mail_listMailAccounts as listMailAccounts, mail_listMessages as listMessages, mail_openDraftEditor as openDraftEditor, mail_saveDraft as saveDraft, mail_sendMessage as sendMessage, mail_submitNativeThreadKeys as submitNativeThreadKeys, mail_unlockMailCredentials as unlockMailCredentials, mail_unlockNativeMail as unlockNativeMail, mail_updateMessage as updateMessage };
2325
2365
  }
2326
2366
 
2327
2367
  /**
@@ -2201,6 +2201,19 @@ type MailMessagePage = Omit<Required<Schemas$2['MailMessagePage']>, 'messages'>
2201
2201
  messages: MailMessage[];
2202
2202
  };
2203
2203
  type MailMessageUpdate = Schemas$2['MailMessageUpdate'];
2204
+ /** One row of the conversation list: a thread's messages in the folder listed, newest first. */
2205
+ type MailConversation = Omit<Required<Schemas$2['MailConversation']>, 'messages'> & {
2206
+ messages: MailMessage[];
2207
+ };
2208
+ type MailConversationPage = Omit<Required<Schemas$2['MailConversationPage']>, 'conversations'> & {
2209
+ conversations: MailConversation[];
2210
+ };
2211
+ /** Every message of one conversation, oldest first. */
2212
+ type MailThread = Omit<Schemas$2['MailThread'], 'messages'> & {
2213
+ messages: MailMessage[];
2214
+ };
2215
+ /** Thread keys computed by the owner's client for an older native message (see `threadKeys`). */
2216
+ type NativeThreadKey = Schemas$2['NativeThreadKey'];
2204
2217
  type MailCompose = Omit<Schemas$2['MailCompose'], 'to' | 'cc' | 'bcc'> & {
2205
2218
  to?: MailAddressInput[];
2206
2219
  cc?: MailAddressInput[];
@@ -2234,10 +2247,30 @@ interface ListMessagesOptions {
2234
2247
  limit?: number;
2235
2248
  }
2236
2249
  declare function listMessages(mail: MailFetch, options: ListMessagesOptions): Promise<MailMessagePage>;
2250
+ /**
2251
+ * One page of a folder's conversations, newest first. Native mail pages by conversation; a connected
2252
+ * account groups each page of its messages by thread (merge pages by `thread_id`).
2253
+ */
2254
+ declare function listConversations$1(mail: MailFetch, options: ListMessagesOptions): Promise<MailConversationPage>;
2255
+ /**
2256
+ * One conversation's messages, oldest first, across folders except the Trash (unless `folderId` is
2257
+ * the Trash). `threadId` is a conversation's `thread_id`.
2258
+ */
2259
+ declare function getThread(mail: MailFetch, threadId: string, options?: {
2260
+ accountId?: string;
2261
+ folderId?: string;
2262
+ }): Promise<MailThread>;
2263
+ /** The key the user's own client keys older native mail with (raw bytes). */
2264
+ declare function getNativeThreadSecret(mail: MailFetch): Promise<Uint8Array>;
2265
+ /**
2266
+ * Submit thread keys for older native messages (by `eml-` id, at most 200 a call), which the server
2267
+ * cannot key itself: their Message-IDs are encrypted. Messages already keyed keep their keys.
2268
+ */
2269
+ declare function submitNativeThreadKeys(mail: MailFetch, keys: Record<string, NativeThreadKey>): Promise<number>;
2237
2270
  declare function getMessage$1(mail: MailFetch, messageId: string, accountId?: string): Promise<MailMessage>;
2238
2271
  /** The bytes of one attachment of a message. */
2239
2272
  declare function downloadAttachment(mail: MailFetch, messageId: string, attachmentId: string, accountId?: string): Promise<Uint8Array>;
2240
- /** Mark read or unread, move to a folder, or send to Trash. */
2273
+ /** Mark read or unread, flag or unflag, move to a folder, or send to Trash. */
2241
2274
  declare function updateMessage(mail: MailFetch, messageId: string, update: MailMessageUpdate, accountId?: string): Promise<void>;
2242
2275
  /**
2243
2276
  * Save a draft. In the native mailbox it lands in Drafts; an agent's draft lands in its owner's
@@ -2293,6 +2326,8 @@ type mail_MailAddress = MailAddress;
2293
2326
  type mail_MailAddressInput = MailAddressInput;
2294
2327
  type mail_MailAttachment = MailAttachment;
2295
2328
  type mail_MailCompose = MailCompose;
2329
+ type mail_MailConversation = MailConversation;
2330
+ type mail_MailConversationPage = MailConversationPage;
2296
2331
  type mail_MailDraftEditorOpen = MailDraftEditorOpen;
2297
2332
  type mail_MailDraftEditorSession = MailDraftEditorSession;
2298
2333
  type mail_MailDraftSaved = MailDraftSaved;
@@ -2304,24 +2339,29 @@ type mail_MailMessageUpdate = MailMessageUpdate;
2304
2339
  type mail_MailPolicy = MailPolicy;
2305
2340
  type mail_MailSend = MailSend;
2306
2341
  type mail_MailSendResult = MailSendResult;
2342
+ type mail_MailThread = MailThread;
2307
2343
  declare const mail_NATIVE_ACCOUNT: typeof NATIVE_ACCOUNT;
2308
2344
  type mail_NativeMailKeys = NativeMailKeys;
2345
+ type mail_NativeThreadKey = NativeThreadKey;
2309
2346
  declare const mail_attachmentFromBytes: typeof attachmentFromBytes;
2310
2347
  declare const mail_claimNativeAlias: typeof claimNativeAlias;
2311
2348
  declare const mail_createMailFetch: typeof createMailFetch;
2312
2349
  declare const mail_downloadAttachment: typeof downloadAttachment;
2313
2350
  declare const mail_getMailPolicy: typeof getMailPolicy;
2351
+ declare const mail_getNativeThreadSecret: typeof getNativeThreadSecret;
2352
+ declare const mail_getThread: typeof getThread;
2314
2353
  declare const mail_listFolders: typeof listFolders;
2315
2354
  declare const mail_listMailAccounts: typeof listMailAccounts;
2316
2355
  declare const mail_listMessages: typeof listMessages;
2317
2356
  declare const mail_openDraftEditor: typeof openDraftEditor;
2318
2357
  declare const mail_saveDraft: typeof saveDraft;
2319
2358
  declare const mail_sendMessage: typeof sendMessage;
2359
+ declare const mail_submitNativeThreadKeys: typeof submitNativeThreadKeys;
2320
2360
  declare const mail_unlockMailCredentials: typeof unlockMailCredentials;
2321
2361
  declare const mail_unlockNativeMail: typeof unlockNativeMail;
2322
2362
  declare const mail_updateMessage: typeof updateMessage;
2323
2363
  declare namespace mail {
2324
- export { type mail_ListMessagesOptions as ListMessagesOptions, type mail_MailAccount as MailAccount, type mail_MailAddress as MailAddress, type mail_MailAddressInput as MailAddressInput, type mail_MailAttachment as MailAttachment, type mail_MailCompose as MailCompose, type mail_MailDraftEditorOpen as MailDraftEditorOpen, type mail_MailDraftEditorSession as MailDraftEditorSession, type mail_MailDraftSaved as MailDraftSaved, type mail_MailFetch as MailFetch, type mail_MailFolder as MailFolder, type mail_MailMessage as MailMessage, type mail_MailMessagePage as MailMessagePage, type mail_MailMessageUpdate as MailMessageUpdate, type mail_MailPolicy as MailPolicy, type mail_MailSend as MailSend, type mail_MailSendResult as MailSendResult, mail_NATIVE_ACCOUNT as NATIVE_ACCOUNT, type mail_NativeMailKeys as NativeMailKeys, mail_attachmentFromBytes as attachmentFromBytes, mail_claimNativeAlias as claimNativeAlias, mail_createMailFetch as createMailFetch, mail_downloadAttachment as downloadAttachment, mail_getMailPolicy as getMailPolicy, getMessage$1 as getMessage, mail_listFolders as listFolders, mail_listMailAccounts as listMailAccounts, mail_listMessages as listMessages, mail_openDraftEditor as openDraftEditor, mail_saveDraft as saveDraft, mail_sendMessage as sendMessage, mail_unlockMailCredentials as unlockMailCredentials, mail_unlockNativeMail as unlockNativeMail, mail_updateMessage as updateMessage };
2364
+ export { type mail_ListMessagesOptions as ListMessagesOptions, type mail_MailAccount as MailAccount, type mail_MailAddress as MailAddress, type mail_MailAddressInput as MailAddressInput, type mail_MailAttachment as MailAttachment, type mail_MailCompose as MailCompose, type mail_MailConversation as MailConversation, type mail_MailConversationPage as MailConversationPage, type mail_MailDraftEditorOpen as MailDraftEditorOpen, type mail_MailDraftEditorSession as MailDraftEditorSession, type mail_MailDraftSaved as MailDraftSaved, type mail_MailFetch as MailFetch, type mail_MailFolder as MailFolder, type mail_MailMessage as MailMessage, type mail_MailMessagePage as MailMessagePage, type mail_MailMessageUpdate as MailMessageUpdate, type mail_MailPolicy as MailPolicy, type mail_MailSend as MailSend, type mail_MailSendResult as MailSendResult, type mail_MailThread as MailThread, mail_NATIVE_ACCOUNT as NATIVE_ACCOUNT, type mail_NativeMailKeys as NativeMailKeys, type mail_NativeThreadKey as NativeThreadKey, mail_attachmentFromBytes as attachmentFromBytes, mail_claimNativeAlias as claimNativeAlias, mail_createMailFetch as createMailFetch, mail_downloadAttachment as downloadAttachment, mail_getMailPolicy as getMailPolicy, getMessage$1 as getMessage, mail_getNativeThreadSecret as getNativeThreadSecret, mail_getThread as getThread, listConversations$1 as listConversations, mail_listFolders as listFolders, mail_listMailAccounts as listMailAccounts, mail_listMessages as listMessages, mail_openDraftEditor as openDraftEditor, mail_saveDraft as saveDraft, mail_sendMessage as sendMessage, mail_submitNativeThreadKeys as submitNativeThreadKeys, mail_unlockMailCredentials as unlockMailCredentials, mail_unlockNativeMail as unlockNativeMail, mail_updateMessage as updateMessage };
2325
2365
  }
2326
2366
 
2327
2367
  /**
package/dist/browser.cjs CHANGED
@@ -10070,12 +10070,16 @@ __export(mail_exports, {
10070
10070
  downloadAttachment: () => downloadAttachment,
10071
10071
  getMailPolicy: () => getMailPolicy,
10072
10072
  getMessage: () => getMessage2,
10073
+ getNativeThreadSecret: () => getNativeThreadSecret,
10074
+ getThread: () => getThread,
10075
+ listConversations: () => listConversations2,
10073
10076
  listFolders: () => listFolders,
10074
10077
  listMailAccounts: () => listMailAccounts,
10075
10078
  listMessages: () => listMessages,
10076
10079
  openDraftEditor: () => openDraftEditor,
10077
10080
  saveDraft: () => saveDraft,
10078
10081
  sendMessage: () => sendMessage,
10082
+ submitNativeThreadKeys: () => submitNativeThreadKeys,
10079
10083
  unlockMailCredentials: () => unlockMailCredentials,
10080
10084
  unlockNativeMail: () => unlockNativeMail,
10081
10085
  updateMessage: () => updateMessage
@@ -10119,6 +10123,27 @@ function listMessages(mail, options) {
10119
10123
  if (options.limit) params.set("limit", String(options.limit));
10120
10124
  return json(mail(`${accountPath(options.accountId ?? NATIVE_ACCOUNT)}/messages?${params}`));
10121
10125
  }
10126
+ function listConversations2(mail, options) {
10127
+ const params = new URLSearchParams({ folder_id: options.folderId });
10128
+ if (options.query) params.set("q", options.query);
10129
+ if (options.cursor) params.set("cursor", options.cursor);
10130
+ if (options.limit) params.set("limit", String(options.limit));
10131
+ return json(mail(`${accountPath(options.accountId ?? NATIVE_ACCOUNT)}/conversations?${params}`));
10132
+ }
10133
+ function getThread(mail, threadId, options = {}) {
10134
+ const params = new URLSearchParams({ thread_id: threadId, folder_id: options.folderId ?? "" });
10135
+ return json(mail(`${accountPath(options.accountId ?? NATIVE_ACCOUNT)}/thread?${params}`));
10136
+ }
10137
+ async function getNativeThreadSecret(mail) {
10138
+ const { secret } = await json(mail("/native/thread-secret"));
10139
+ return Uint8Array.from(atob(secret), (c2) => c2.charCodeAt(0));
10140
+ }
10141
+ async function submitNativeThreadKeys(mail, keys) {
10142
+ const { updated } = await json(
10143
+ mail("/native/thread-keys", { method: "POST", body: JSON.stringify({ keys }) })
10144
+ );
10145
+ return updated;
10146
+ }
10122
10147
  function getMessage2(mail, messageId2, accountId = NATIVE_ACCOUNT) {
10123
10148
  return json(mail(`${accountPath(accountId)}/messages/${encodeURIComponent(messageId2)}`));
10124
10149
  }