@happyvertical/smrt-messages 0.70.2 → 0.71.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.
Files changed (56) hide show
  1. package/AGENTS.md +13 -3
  2. package/README.md +4 -2
  3. package/agents/attachment-storage.md +41 -0
  4. package/agents/send-approval.md +28 -0
  5. package/dist/access.d.ts +22 -0
  6. package/dist/access.d.ts.map +1 -1
  7. package/dist/attachment-storage.d.ts +50 -0
  8. package/dist/attachment-storage.d.ts.map +1 -0
  9. package/dist/chunks/{AttachmentCollection-CJZIkeYW.js → AttachmentCollection-C14dERNK.js} +77 -36
  10. package/dist/chunks/AttachmentCollection-C14dERNK.js.map +1 -0
  11. package/dist/chunks/{Email-BoRK4Y50.js → Email-Bd1lCLiC.js} +6 -6
  12. package/dist/chunks/{Email-BoRK4Y50.js.map → Email-Bd1lCLiC.js.map} +1 -1
  13. package/dist/chunks/{EmailAccountCollection-CJP22cvT.js → EmailAccountCollection-Clv4kruh.js} +143 -37
  14. package/dist/chunks/EmailAccountCollection-Clv4kruh.js.map +1 -0
  15. package/dist/chunks/{EmailCollection-DWmRULre.js → EmailCollection-CiZJ5I2l.js} +3 -3
  16. package/dist/chunks/{EmailCollection-DWmRULre.js.map → EmailCollection-CiZJ5I2l.js.map} +1 -1
  17. package/dist/chunks/{EmailFolder-C8IUwjPj.js → EmailFolder-Dvb6M-d_.js} +6 -6
  18. package/dist/chunks/{EmailFolder-C8IUwjPj.js.map → EmailFolder-Dvb6M-d_.js.map} +1 -1
  19. package/dist/chunks/{EmailFolderCollection-BHpe4h2Q.js → EmailFolderCollection-BR3yh7sp.js} +2 -2
  20. package/dist/chunks/{EmailFolderCollection-BHpe4h2Q.js.map → EmailFolderCollection-BR3yh7sp.js.map} +1 -1
  21. package/dist/chunks/{EmailSender-N8dK3Eeu.js → EmailSender-B-c7mxbY.js} +10 -4
  22. package/dist/chunks/EmailSender-B-c7mxbY.js.map +1 -0
  23. package/dist/chunks/{Message-ZYYtLVeV.js → Message-CGyhd0kh.js} +145 -10
  24. package/dist/chunks/Message-CGyhd0kh.js.map +1 -0
  25. package/dist/chunks/{MessageCollection-D2Qu7ExM.js → MessageCollection-DRCtm5z2.js} +2 -2
  26. package/dist/chunks/{MessageCollection-D2Qu7ExM.js.map → MessageCollection-DRCtm5z2.js.map} +1 -1
  27. package/dist/chunks/{MessagingEndpointCollection-ghumHaPw.js → MessagingEndpointCollection-Cju_NnJZ.js} +2 -2
  28. package/dist/chunks/{MessagingEndpointCollection-ghumHaPw.js.map → MessagingEndpointCollection-Cju_NnJZ.js.map} +1 -1
  29. package/dist/collections/AttachmentCollection.d.ts.map +1 -1
  30. package/dist/connect.js +1 -1
  31. package/dist/host.browser.d.ts +2 -0
  32. package/dist/host.browser.d.ts.map +1 -1
  33. package/dist/host.browser.js +3 -1
  34. package/dist/host.browser.js.map +1 -1
  35. package/dist/host.d.ts +20 -0
  36. package/dist/host.d.ts.map +1 -1
  37. package/dist/host.js +39 -1
  38. package/dist/host.js.map +1 -1
  39. package/dist/index.d.ts +1 -0
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +17 -17
  42. package/dist/index.js.map +1 -1
  43. package/dist/manifest.json +63 -1
  44. package/dist/models/Attachment.d.ts +33 -9
  45. package/dist/models/Attachment.d.ts.map +1 -1
  46. package/dist/models/Message.d.ts +32 -0
  47. package/dist/models/Message.d.ts.map +1 -1
  48. package/dist/send-approval.d.ts.map +1 -1
  49. package/dist/senders/EmailSender.d.ts.map +1 -1
  50. package/dist/smrt-knowledge.json +65 -9
  51. package/dist/smrt-knowledge.okf.md +9 -5
  52. package/package.json +12 -12
  53. package/dist/chunks/AttachmentCollection-CJZIkeYW.js.map +0 -1
  54. package/dist/chunks/EmailAccountCollection-CJP22cvT.js.map +0 -1
  55. package/dist/chunks/EmailSender-N8dK3Eeu.js.map +0 -1
  56. package/dist/chunks/Message-ZYYtLVeV.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
- import { A as deniedMailAccountIds, B as runWithMailSystemAccess, C as MailAccessError, D as canAccessMailAccount, E as assertMailAccess, F as isPersonMailPrincipal, G as MESSAGING_PERMISSION_DEFINITIONS, H as MANAGE_MESSAGE_CREDENTIALS_PERMISSION, I as learnMailAccessOptions, J as ensureMessagingPermissionsRegistered, K as SEND_MESSAGES_PERMISSION, L as mailScopePermission, M as getMailAccessConfig, N as inMailSystemAccess, O as configureMailAccess, P as isMailScope, R as resetMailAccess, S as MAIL_SCOPES, T as assertHydratedMailAccess, U as MANAGE_MESSAGE_ROUTES_PERMISSION, V as withoutListBounds, W as MESSAGES_ROLE_PERMISSION_MATRIX, X as seedMessagesRolePermissions, Y as messagingPrincipalFromPermissions, _ as resetMailSendApprovals, b as Account, c as HeldSendError, f as auditMailAction, g as mailSendBindingHash, i as AccountCollection, j as getEffectiveMailAccessConfigs, k as decideMailAccess, l as MailSendApprovalService, m as effectiveAgentSendPolicy, o as MailWriteBackUnsupportedError, p as configureMailSendApprovals, q as assertMessagingPermission, r as EmailAccount, s as APPROVE_HELD_SEND_PERMISSION, t as EmailAccountCollection, v as stampHandledBy, w as MailAccessService, x as MAIL_ACCOUNT_RESOURCE_TYPE, y as threadHandledBy, z as resolveMailPrincipal } from "./chunks/EmailAccountCollection-CJP22cvT.js";
1
+ import { $ as MANAGE_MESSAGE_ROUTES_PERMISSION, A as MailAccessService, B as getMailAccessConfig, D as MAIL_ACCOUNT_RESOURCE_TYPE, E as Account, F as canAccessMailAccount, G as learnMailAccessOptions, H as isMailScope, I as configureMailAccess, J as resetMailAccess, L as decideMailAccess, M as assertMailAccess, O as MAIL_SCOPES, Q as MANAGE_MESSAGE_CREDENTIALS_PERMISSION, R as deniedMailAccountIds, U as isPersonMailPrincipal, V as inMailSystemAccess, X as runWithMailSystemAccess, Y as resolveMailPrincipal, Z as withoutListBounds, _ as resetMailSendApprovals, at as messagingPrincipalFromPermissions, b as AttachmentStorageError, c as HeldSendError, et as MESSAGES_ROLE_PERMISSION_MATRIX, f as auditMailAction, g as mailSendBindingHash, i as AccountCollection, it as ensureMessagingPermissionsRegistered, j as assertHydratedMailAccess, k as MailAccessError, l as MailSendApprovalService, m as effectiveAgentSendPolicy, nt as SEND_MESSAGES_PERMISSION, o as MailWriteBackUnsupportedError, ot as seedMessagesRolePermissions, p as configureMailSendApprovals, q as mailScopePermission, r as EmailAccount, rt as assertMessagingPermission, s as APPROVE_HELD_SEND_PERMISSION, t as EmailAccountCollection, tt as MESSAGING_PERMISSION_DEFINITIONS, v as stampHandledBy, w as resetAttachmentStorage, x as configureAttachmentStorage, y as threadHandledBy, z as getEffectiveMailAccessConfigs } from "./chunks/EmailAccountCollection-Clv4kruh.js";
2
2
  import { buildSqliteRebuildStatements, isDeepStrictEqual, normalizeIdentityEmail, queryGlobal, queryWithGlobals, readNotificationProfile, withSystemContext, withTenant } from "./host.js";
3
- import { r as Attachment, t as AttachmentCollection } from "./chunks/AttachmentCollection-CJZIkeYW.js";
4
- import { t as EmailFolder } from "./chunks/EmailFolder-C8IUwjPj.js";
3
+ import { r as Attachment, t as AttachmentCollection } from "./chunks/AttachmentCollection-C14dERNK.js";
4
+ import { t as EmailFolder } from "./chunks/EmailFolder-Dvb6M-d_.js";
5
5
  import { d as withProtectedNotificationHandoff, f as PROFILE_NOTIFICATION_POLICY_PREFIX, l as protectedNotificationMetadata, m as profileNotificationPolicy, p as assertNotificationRecipientIdentity, t as ProtectedNotificationHandoffError } from "./chunks/protected-notification-handoff-mvaEZVp7.js";
6
- import { t as Message } from "./chunks/Message-ZYYtLVeV.js";
6
+ import { t as Message } from "./chunks/Message-CGyhd0kh.js";
7
7
  import { a as registerMessagingProvider, n as getMessagingProvider, o as ZulipSender, r as listMessagingProviders, s as TelegramSender, t as ensureBuiltinMessagingProvidersRegistered } from "./chunks/providers-Bz_F_ywF.js";
8
- import { t as MessageCollection } from "./chunks/MessageCollection-D2Qu7ExM.js";
9
- import { r as MessagingEndpoint, t as MessagingEndpointCollection } from "./chunks/MessagingEndpointCollection-ghumHaPw.js";
10
- import { t as Email } from "./chunks/Email-BoRK4Y50.js";
11
- import { t as EmailCollection } from "./chunks/EmailCollection-DWmRULre.js";
12
- import { t as EmailFolderCollection } from "./chunks/EmailFolderCollection-BHpe4h2Q.js";
13
- import { t as EmailSender } from "./chunks/EmailSender-N8dK3Eeu.js";
8
+ import { t as MessageCollection } from "./chunks/MessageCollection-DRCtm5z2.js";
9
+ import { r as MessagingEndpoint, t as MessagingEndpointCollection } from "./chunks/MessagingEndpointCollection-Cju_NnJZ.js";
10
+ import { t as Email } from "./chunks/Email-Bd1lCLiC.js";
11
+ import { t as EmailCollection } from "./chunks/EmailCollection-CiZJ5I2l.js";
12
+ import { t as EmailFolderCollection } from "./chunks/EmailFolderCollection-BR3yh7sp.js";
13
+ import { t as EmailSender } from "./chunks/EmailSender-B-c7mxbY.js";
14
14
  import { t as SlackSender } from "./chunks/SlackSender-CetlSe6D.js";
15
15
  import { t as TweetSender } from "./chunks/TweetSender-Dw-TDxIB.js";
16
16
  import { GlobalInterceptors, ObjectRegistry, SmrtCollection, SmrtObject, SmrtRecipe, crossPackageRef, detectEngine, field, foreignKey, isUniqueViolationError, smrt, usesEmbeddedRevisionFallback, withEmbeddedWriteQueue } from "@happyvertical/smrt-core";
@@ -98,7 +98,7 @@ function createMailAccessInterceptor() {
98
98
  const row = instance;
99
99
  row.accountId = null;
100
100
  if (!row.messageId || !row.options) return;
101
- const { MessageCollection } = await import("./chunks/MessageCollection-D2Qu7ExM.js").then((n) => n.n);
101
+ const { MessageCollection } = await import("./chunks/MessageCollection-DRCtm5z2.js").then((n) => n.n);
102
102
  row.accountId = (await runWithMailSystemAccess(async () => (await MessageCollection.create(row.options)).get({ id: row.messageId })))?.accountId || null;
103
103
  },
104
104
  async afterList(className, results, context) {
@@ -172,13 +172,13 @@ var MailDraftService = class {
172
172
  }
173
173
  options;
174
174
  async account(accountId) {
175
- const { EmailAccountCollection } = await import("./chunks/EmailAccountCollection-CJP22cvT.js").then((n) => n.n);
175
+ const { EmailAccountCollection } = await import("./chunks/EmailAccountCollection-Clv4kruh.js").then((n) => n.n);
176
176
  const account = await runWithMailSystemAccess(async () => (await EmailAccountCollection.create(withoutListBounds(this.options))).get({ id: accountId }));
177
177
  if (!account?.id) throw new MailDraftError("Mail account not found.", 404);
178
178
  return account;
179
179
  }
180
180
  async stored(id) {
181
- const { EmailCollection } = await import("./chunks/EmailCollection-DWmRULre.js").then((n) => n.n);
181
+ const { EmailCollection } = await import("./chunks/EmailCollection-CiZJ5I2l.js").then((n) => n.n);
182
182
  return await runWithMailSystemAccess(async () => (await EmailCollection.create(this.options)).get({ id }));
183
183
  }
184
184
  /** Create or update a draft. Returns the saved draft. */
@@ -203,7 +203,7 @@ var MailDraftService = class {
203
203
  draft = original.createReply({ replyAll: input.replyAll === true });
204
204
  await draft.initialize();
205
205
  } else {
206
- const { Email: EmailClass } = await import("./chunks/Email-BoRK4Y50.js").then((n) => n.n);
206
+ const { Email: EmailClass } = await import("./chunks/Email-Bd1lCLiC.js").then((n) => n.n);
207
207
  draft = new (ObjectRegistry.resolveEffectiveConstructor(EmailClass))({
208
208
  ...this.options,
209
209
  tenantId: account.tenantId,
@@ -983,7 +983,7 @@ var EmailAttachment = class extends Attachment {
983
983
  */
984
984
  async getEmail() {
985
985
  if (!this.messageId) return null;
986
- const { EmailCollection } = await import("./chunks/EmailCollection-DWmRULre.js").then((n) => n.n);
986
+ const { EmailCollection } = await import("./chunks/EmailCollection-CiZJ5I2l.js").then((n) => n.n);
987
987
  return await (await EmailCollection.create(this.options)).get({ id: this.messageId });
988
988
  }
989
989
  };
@@ -2689,7 +2689,7 @@ var CorrespondentService = class {
2689
2689
  return result;
2690
2690
  }
2691
2691
  async ownAddresses(accountIds) {
2692
- const { EmailAccountCollection } = await import("./chunks/EmailAccountCollection-CJP22cvT.js").then((n) => n.n);
2692
+ const { EmailAccountCollection } = await import("./chunks/EmailAccountCollection-Clv4kruh.js").then((n) => n.n);
2693
2693
  const accounts = await EmailAccountCollection.create({ db: this.options.db });
2694
2694
  const out = [];
2695
2695
  for (const id of accountIds) {
@@ -4464,6 +4464,6 @@ ensureBuiltinMessagingProvidersRegistered();
4464
4464
  ensureMessagingPermissionsRegistered();
4465
4465
  ensureMailAccessEnforcementRegistered();
4466
4466
  //#endregion
4467
- export { APPROVE_HELD_SEND_PERMISSION, Account, AccountCollection, Attachment, AttachmentCollection, Blacklist, BlacklistCollection, CHANGE_FEED_PROVIDERS, Correspondent, CorrespondentCollection, CorrespondentService, Email, EmailAccount, EmailAccountCollection, EmailAttachment, EmailAttachmentCollection, EmailCollection, EmailFolder, EmailFolderCollection, EmailSender, HeldSendError, MAIL_ACCOUNT_RESOURCE_TYPE, MAIL_SCOPES, MAIL_SYNC_QUEUE, MANAGE_MESSAGE_CREDENTIALS_PERMISSION, MANAGE_MESSAGE_ROUTES_PERMISSION, MESSAGES_ROLE_PERMISSION_MATRIX, MESSAGING_PERMISSION_DEFINITIONS, MailAccessError, MailAccessService, MailDraftError, MailDraftService, MailSearchService, MailSendApprovalService, MailWriteBackUnsupportedError, MailboxRecipe, Message, MessageCollection, MessagingEndpoint, MessagingEndpointCollection, MessagingSettingsService, NOTIFICATION_DELIVERY_CHANNELS, NOTIFICATION_OPT_OUT_ALL_SCOPE, NOTIFICATION_OPT_OUT_SCOPE_PATTERN, NotificationDelivery, NotificationDeliveryCollection, NotificationOptOut, NotificationOptOutCollection, NotificationOptOutDeniedError, NotificationOptOutService, NotificationOutboxDeniedError, NotificationOutboxService, NotificationsRecipe, PROFILE_NOTIFICATION_POLICY_PREFIX, PersonaMessageRoute, PersonaMessageRouteCollection, PersonaMessagingService, SEND_MESSAGES_PERMISSION, SlackAccount, SlackMessage, SlackRecipe, SlackSender, TelegramAccount, TelegramSender, Tweet, TweetSender, TwitterAccount, USER_NOTIFICATION_SEVERITIES, UserNotification, UserNotificationCollection, UserNotificationService, Whitelist, WhitelistCollection, ZulipAccount, ZulipSender, assertMailAccess, assertMessagingPermission, assertNotificationProfileRecipientSchema, auditMailAction, buildNotificationLink, canAccessMailAccount, configureMailAccess, configureMailSendApprovals, decideMailAccess, deniedMailAccountIds, effectiveAgentSendPolicy, enqueueDueMailSyncs, enqueueMailSync, ensureBuiltinMessagingProvidersRegistered, ensureMessagingPermissionsRegistered, getMessagingProvider, isMailScope, isPersonMailPrincipal, isValidNotificationOptOutScope, listMessagingProviders, mailScopePermission, mailSendBindingHash, mailSyncDedupeKey, messageSendTransport, messagingPrincipalFromPermissions, migrateNotificationProfileRecipients, normalizeCorrespondentAddress, notificationDeliveryCorrelationId, notificationDeliveryMessageId, optOutSuppression, planNotificationProfileRecipients, profileNotificationPolicy, readableMailAccounts, registerMessagingProvider, resetMailAccess, resetMailSendApprovals, resolveMailPrincipal, runWithMailSystemAccess, seedMessagesRolePermissions, stampHandledBy, threadHandledBy };
4467
+ export { APPROVE_HELD_SEND_PERMISSION, Account, AccountCollection, Attachment, AttachmentCollection, AttachmentStorageError, Blacklist, BlacklistCollection, CHANGE_FEED_PROVIDERS, Correspondent, CorrespondentCollection, CorrespondentService, Email, EmailAccount, EmailAccountCollection, EmailAttachment, EmailAttachmentCollection, EmailCollection, EmailFolder, EmailFolderCollection, EmailSender, HeldSendError, MAIL_ACCOUNT_RESOURCE_TYPE, MAIL_SCOPES, MAIL_SYNC_QUEUE, MANAGE_MESSAGE_CREDENTIALS_PERMISSION, MANAGE_MESSAGE_ROUTES_PERMISSION, MESSAGES_ROLE_PERMISSION_MATRIX, MESSAGING_PERMISSION_DEFINITIONS, MailAccessError, MailAccessService, MailDraftError, MailDraftService, MailSearchService, MailSendApprovalService, MailWriteBackUnsupportedError, MailboxRecipe, Message, MessageCollection, MessagingEndpoint, MessagingEndpointCollection, MessagingSettingsService, NOTIFICATION_DELIVERY_CHANNELS, NOTIFICATION_OPT_OUT_ALL_SCOPE, NOTIFICATION_OPT_OUT_SCOPE_PATTERN, NotificationDelivery, NotificationDeliveryCollection, NotificationOptOut, NotificationOptOutCollection, NotificationOptOutDeniedError, NotificationOptOutService, NotificationOutboxDeniedError, NotificationOutboxService, NotificationsRecipe, PROFILE_NOTIFICATION_POLICY_PREFIX, PersonaMessageRoute, PersonaMessageRouteCollection, PersonaMessagingService, SEND_MESSAGES_PERMISSION, SlackAccount, SlackMessage, SlackRecipe, SlackSender, TelegramAccount, TelegramSender, Tweet, TweetSender, TwitterAccount, USER_NOTIFICATION_SEVERITIES, UserNotification, UserNotificationCollection, UserNotificationService, Whitelist, WhitelistCollection, ZulipAccount, ZulipSender, assertMailAccess, assertMessagingPermission, assertNotificationProfileRecipientSchema, auditMailAction, buildNotificationLink, canAccessMailAccount, configureAttachmentStorage, configureMailAccess, configureMailSendApprovals, decideMailAccess, deniedMailAccountIds, effectiveAgentSendPolicy, enqueueDueMailSyncs, enqueueMailSync, ensureBuiltinMessagingProvidersRegistered, ensureMessagingPermissionsRegistered, getMessagingProvider, isMailScope, isPersonMailPrincipal, isValidNotificationOptOutScope, listMessagingProviders, mailScopePermission, mailSendBindingHash, mailSyncDedupeKey, messageSendTransport, messagingPrincipalFromPermissions, migrateNotificationProfileRecipients, normalizeCorrespondentAddress, notificationDeliveryCorrelationId, notificationDeliveryMessageId, optOutSuppression, planNotificationProfileRecipients, profileNotificationPolicy, readableMailAccounts, registerMessagingProvider, resetAttachmentStorage, resetMailAccess, resetMailSendApprovals, resolveMailPrincipal, runWithMailSystemAccess, seedMessagesRolePermissions, stampHandledBy, threadHandledBy };
4468
4468
 
4469
4469
  //# sourceMappingURL=index.js.map