@macro-inc/sdk 0.4.1 → 0.6.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 (228) hide show
  1. package/README.md +316 -21
  2. package/dist/{chunk-PTX2RV2N.js → chunk-4MI52GWV.js} +93 -1
  3. package/dist/{chunk-XFA7NCJ5.js → chunk-HO75UE4Z.js} +146 -15
  4. package/dist/{chunk-P4DTO6VD.js → chunk-MCSQNZ4E.js} +6 -0
  5. package/dist/{chunk-ZLBDES7U.js → chunk-SJ6S2GAT.js} +1271 -87
  6. package/dist/{chunk-AZJUIUIV.js → chunk-SK5CMXRV.js} +100 -14
  7. package/dist/{chunk-PZPTJI6F.js → chunk-TMTYN2UK.js} +229 -2
  8. package/dist/{chunk-PPR7IWZ7.js → chunk-ZYBAKW25.js} +2 -1
  9. package/dist/generated/agent-fold/index.d.ts +202 -14
  10. package/dist/generated/agent-harness/index.d.ts +1 -1
  11. package/dist/generated/agent-harness/index.js +1 -1
  12. package/dist/generated/agent-harness/sdk.gen.d.ts +49 -2
  13. package/dist/generated/agent-harness/types.gen.d.ts +527 -9
  14. package/dist/generated/agent-reviews/index.d.ts +11 -9
  15. package/dist/generated/auth/index.d.ts +1 -1
  16. package/dist/generated/auth/index.js +1 -1
  17. package/dist/generated/auth/sdk.gen.d.ts +82 -16
  18. package/dist/generated/auth/types.gen.d.ts +768 -18
  19. package/dist/generated/calendar/types.gen.d.ts +10 -3
  20. package/dist/generated/cognition/index.d.ts +1 -1
  21. package/dist/generated/cognition/index.js +1 -1
  22. package/dist/generated/cognition/sdk.gen.d.ts +60 -6
  23. package/dist/generated/cognition/types.gen.d.ts +663 -106
  24. package/dist/generated/connection/types.gen.d.ts +1 -1
  25. package/dist/generated/contacts/index.d.ts +1 -1
  26. package/dist/generated/contacts/index.js +1 -1
  27. package/dist/generated/contacts/sdk.gen.d.ts +5 -1
  28. package/dist/generated/contacts/types.gen.d.ts +56 -0
  29. package/dist/generated/email/types.gen.d.ts +8 -2
  30. package/dist/generated/notification/index.d.ts +1 -1
  31. package/dist/generated/notification/index.js +1 -1
  32. package/dist/generated/notification/sdk.gen.d.ts +2 -1
  33. package/dist/generated/notification/types.gen.d.ts +174 -1
  34. package/dist/generated/scheduled-action/index.d.ts +1 -1
  35. package/dist/generated/scheduled-action/index.js +1 -1
  36. package/dist/generated/scheduled-action/sdk.gen.d.ts +107 -2
  37. package/dist/generated/scheduled-action/types.gen.d.ts +2451 -479
  38. package/dist/generated/search/index.d.ts +1 -1
  39. package/dist/generated/search/types.gen.d.ts +50 -11
  40. package/dist/generated/storage/index.d.ts +1 -1
  41. package/dist/generated/storage/index.js +1 -1
  42. package/dist/generated/storage/sdk.gen.d.ts +511 -18
  43. package/dist/generated/storage/types.gen.d.ts +18528 -11395
  44. package/dist/src/entities/account-managers/grant.d.ts +28 -5
  45. package/dist/src/entities/account-managers/namespace.d.ts +15 -3
  46. package/dist/src/entities/activity/entity.d.ts +7 -0
  47. package/dist/src/entities/activity/namespace.d.ts +58 -0
  48. package/dist/src/entities/activity/namespace.test.d.ts +1 -0
  49. package/dist/src/entities/agent-sessions/activity.d.ts +12 -3
  50. package/dist/src/entities/agent-sessions/agent-session.d.ts +209 -22
  51. package/dist/src/entities/agent-sessions/code-execution.d.ts +15 -3
  52. package/dist/src/entities/agent-sessions/conversation.d.ts +46 -9
  53. package/dist/src/entities/agent-sessions/namespace.d.ts +72 -16
  54. package/dist/src/entities/agent-sessions/origin.d.ts +1 -1
  55. package/dist/src/entities/agent-sessions/queued-action.d.ts +17 -3
  56. package/dist/src/entities/agent-sessions/review.d.ts +56 -5
  57. package/dist/src/entities/agent-sessions/tool-approval.d.ts +5 -1
  58. package/dist/src/entities/agents/agent.d.ts +98 -3
  59. package/dist/src/entities/agents/namespace.d.ts +52 -8
  60. package/dist/src/entities/ai/namespace.d.ts +10 -2
  61. package/dist/src/entities/api-keys/api-key.d.ts +6 -1
  62. package/dist/src/entities/api-keys/namespace.d.ts +18 -3
  63. package/dist/src/entities/bots/bot.d.ts +44 -9
  64. package/dist/src/entities/bots/namespace.d.ts +13 -1
  65. package/dist/src/entities/bots/token.d.ts +6 -1
  66. package/dist/src/entities/calendar/booking-link.d.ts +7 -1
  67. package/dist/src/entities/calendar/booking-namespace.d.ts +14 -1
  68. package/dist/src/entities/calendar/booking.d.ts +15 -0
  69. package/dist/src/entities/calendar/calendar.d.ts +10 -3
  70. package/dist/src/entities/calendar/event.d.ts +68 -9
  71. package/dist/src/entities/calendar/namespace.d.ts +91 -12
  72. package/dist/src/entities/calendar/replacement.d.ts +19 -3
  73. package/dist/src/entities/calls/call-record.d.ts +107 -17
  74. package/dist/src/entities/calls/connection.d.ts +7 -1
  75. package/dist/src/entities/calls/message.d.ts +27 -5
  76. package/dist/src/entities/calls/namespace.d.ts +15 -3
  77. package/dist/src/entities/canvases/canvas.d.ts +329 -0
  78. package/dist/src/entities/channels/access-request.d.ts +10 -2
  79. package/dist/src/entities/channels/activity.d.ts +20 -4
  80. package/dist/src/entities/channels/channel.d.ts +154 -27
  81. package/dist/src/entities/channels/labels.d.ts +41 -7
  82. package/dist/src/entities/channels/message.d.ts +105 -8
  83. package/dist/src/entities/channels/message.test.d.ts +1 -0
  84. package/dist/src/entities/channels/namespace.d.ts +37 -7
  85. package/dist/src/entities/channels/post.d.ts +13 -7
  86. package/dist/src/entities/channels/post.test.d.ts +1 -0
  87. package/dist/src/entities/channels/share.d.ts +9 -0
  88. package/dist/src/entities/channels/share.test.d.ts +1 -0
  89. package/dist/src/entities/channels/thread.d.ts +24 -4
  90. package/dist/src/entities/chats/chat.d.ts +57 -7
  91. package/dist/src/entities/chats/generation.d.ts +11 -2
  92. package/dist/src/entities/chats/namespace.d.ts +10 -2
  93. package/dist/src/entities/connected-apps/connected-app.d.ts +16 -2
  94. package/dist/src/entities/connected-apps/connector.d.ts +3 -0
  95. package/dist/src/entities/connected-apps/namespace.d.ts +18 -0
  96. package/dist/src/entities/crm/company.d.ts +64 -16
  97. package/dist/src/entities/crm/contact.d.ts +102 -14
  98. package/dist/src/entities/crm/namespace.d.ts +113 -22
  99. package/dist/src/entities/crm/pipeline-entry.d.ts +109 -0
  100. package/dist/src/entities/crm/pipeline.d.ts +292 -29
  101. package/dist/src/entities/crm/pipelines.d.ts +69 -4
  102. package/dist/src/entities/crm-email-privacy/email-privacy.d.ts +238 -0
  103. package/dist/src/entities/crm-email-privacy/email-rule-preview.d.ts +55 -0
  104. package/dist/src/entities/crm-email-privacy/email-rule-revision.d.ts +27 -0
  105. package/dist/src/entities/crm-email-privacy/email-rules.d.ts +32 -0
  106. package/dist/src/entities/databases/column.d.ts +54 -7
  107. package/dist/src/entities/databases/database.d.ts +160 -18
  108. package/dist/src/entities/databases/namespace.d.ts +40 -8
  109. package/dist/src/entities/databases/row.d.ts +2 -0
  110. package/dist/src/entities/databases/saved-query.d.ts +151 -0
  111. package/dist/src/entities/databases/table.d.ts +73 -10
  112. package/dist/src/entities/databases/view.d.ts +37 -5
  113. package/dist/src/entities/databases/webhook.d.ts +8 -1
  114. package/dist/src/entities/documents/ai-edit.d.ts +2 -0
  115. package/dist/src/entities/documents/anchor.d.ts +12 -2
  116. package/dist/src/entities/documents/comment.d.ts +29 -5
  117. package/dist/src/entities/documents/create.test.d.ts +1 -0
  118. package/dist/src/entities/documents/document.d.ts +284 -26
  119. package/dist/src/entities/documents/markdown.d.ts +25 -0
  120. package/dist/src/entities/documents/namespace.d.ts +146 -13
  121. package/dist/src/entities/documents/skills.test.d.ts +1 -0
  122. package/dist/src/entities/documents/system-skill.d.ts +21 -1
  123. package/dist/src/entities/documents/text-comment.d.ts +41 -0
  124. package/dist/src/entities/documents/text-comment.test.d.ts +1 -0
  125. package/dist/src/entities/documents/version.d.ts +5 -1
  126. package/dist/src/entities/email/attachment.d.ts +3 -0
  127. package/dist/src/entities/email/draft.d.ts +61 -9
  128. package/dist/src/entities/email/filter.d.ts +12 -2
  129. package/dist/src/entities/email/label.d.ts +7 -1
  130. package/dist/src/entities/email/link.d.ts +5 -1
  131. package/dist/src/entities/email/message.d.ts +72 -14
  132. package/dist/src/entities/email/namespace.d.ts +134 -24
  133. package/dist/src/entities/email/thread.d.ts +124 -18
  134. package/dist/src/entities/entity-mentions/mention.d.ts +6 -1
  135. package/dist/src/entities/entity-mentions/namespace.d.ts +5 -1
  136. package/dist/src/entities/entity.d.ts +65 -6
  137. package/dist/src/entities/external-chat/chat.d.ts +80 -12
  138. package/dist/src/entities/external-chat/message.d.ts +1 -1
  139. package/dist/src/entities/external-chat/namespace.d.ts +5 -1
  140. package/dist/src/entities/external-chat/send.d.ts +10 -2
  141. package/dist/src/entities/favorites/namespace.d.ts +20 -3
  142. package/dist/src/entities/foreign/foreign-entity.d.ts +5 -1
  143. package/dist/src/entities/foreign/namespace.d.ts +5 -1
  144. package/dist/src/entities/forms/form.d.ts +91 -14
  145. package/dist/src/entities/forms/namespace.d.ts +10 -2
  146. package/dist/src/entities/forms/question.d.ts +35 -7
  147. package/dist/src/entities/forms/response.d.ts +25 -5
  148. package/dist/src/entities/forms/section.d.ts +15 -3
  149. package/dist/src/entities/github-pull-requests/namespace.d.ts +5 -1
  150. package/dist/src/entities/github-pull-requests/pull-request.d.ts +15 -3
  151. package/dist/src/entities/harnesses/harness.d.ts +51 -3
  152. package/dist/src/entities/harnesses/namespace.d.ts +54 -8
  153. package/dist/src/entities/harnesses/pairing.d.ts +13 -2
  154. package/dist/src/entities/images/image.d.ts +16 -5
  155. package/dist/src/entities/images/namespace.d.ts +8 -1
  156. package/dist/src/entities/imports/entry.d.ts +65 -0
  157. package/dist/src/entities/imports/namespace.d.ts +103 -0
  158. package/dist/src/entities/imports/namespace.test.d.ts +1 -0
  159. package/dist/src/entities/initiatives/initiative.d.ts +128 -4
  160. package/dist/src/entities/initiatives/initiative.test.d.ts +1 -0
  161. package/dist/src/entities/initiatives/namespace.d.ts +71 -7
  162. package/dist/src/entities/me/namespace.d.ts +28 -3
  163. package/dist/src/entities/meetings/meeting.d.ts +46 -8
  164. package/dist/src/entities/meetings/namespace.d.ts +20 -4
  165. package/dist/src/entities/memory/namespace.d.ts +49 -0
  166. package/dist/src/entities/memory/namespace.test.d.ts +1 -0
  167. package/dist/src/entities/messages/discussion.d.ts +84 -0
  168. package/dist/src/entities/messages/thread.d.ts +19 -5
  169. package/dist/src/entities/notifications/namespace.d.ts +41 -7
  170. package/dist/src/entities/notifications/notification.d.ts +31 -6
  171. package/dist/src/entities/passwords/item.d.ts +118 -0
  172. package/dist/src/entities/passwords/namespace.d.ts +45 -0
  173. package/dist/src/entities/pins/namespace.d.ts +23 -4
  174. package/dist/src/entities/projects/namespace.d.ts +29 -0
  175. package/dist/src/entities/projects/project.d.ts +58 -7
  176. package/dist/src/entities/properties/namespace.d.ts +67 -11
  177. package/dist/src/entities/properties/namespace.test.d.ts +1 -0
  178. package/dist/src/entities/properties/property-definition.d.ts +30 -5
  179. package/dist/src/entities/properties/property-option.d.ts +14 -2
  180. package/dist/src/entities/referrals/namespace.d.ts +8 -1
  181. package/dist/src/entities/routines/namespace.d.ts +198 -14
  182. package/dist/src/entities/routines/routine.d.ts +174 -27
  183. package/dist/src/entities/routines/suggestion.d.ts +38 -0
  184. package/dist/src/entities/saved-views/namespace.d.ts +58 -0
  185. package/dist/src/entities/saved-views/saved-view.d.ts +78 -0
  186. package/dist/src/entities/search/exclusions.d.ts +6 -0
  187. package/dist/src/entities/search/namespace.d.ts +9 -3
  188. package/dist/src/entities/search/options.d.ts +3 -2
  189. package/dist/src/entities/sharing/access.d.ts +50 -9
  190. package/dist/src/entities/spreadsheets/spreadsheet.d.ts +201 -0
  191. package/dist/src/entities/suggestions/namespace.d.ts +118 -0
  192. package/dist/src/entities/suggestions/suggestion.d.ts +172 -0
  193. package/dist/src/entities/suggestions/suggestion.test.d.ts +1 -0
  194. package/dist/src/entities/tasks/namespace.d.ts +18 -5
  195. package/dist/src/entities/tasks/task.d.ts +21 -3
  196. package/dist/src/entities/teams/invite.d.ts +3 -0
  197. package/dist/src/entities/teams/namespace.d.ts +10 -2
  198. package/dist/src/entities/teams/team.d.ts +22 -2
  199. package/dist/src/entities/ui/app-link.d.ts +24 -0
  200. package/dist/src/entities/ui/namespace.d.ts +75 -0
  201. package/dist/src/entities/unfurls/namespace.d.ts +12 -2
  202. package/dist/src/entities/users/namespace.d.ts +26 -4
  203. package/dist/src/entities/users/profile-picture.d.ts +29 -0
  204. package/dist/src/entities/users/profile-picture.test.d.ts +1 -0
  205. package/dist/src/entities/users/user.d.ts +52 -1
  206. package/dist/src/entities/web/namespace.d.ts +6 -0
  207. package/dist/src/entities/webhooks/namespace.d.ts +5 -0
  208. package/dist/src/entities/webhooks/webhook.d.ts +47 -7
  209. package/dist/src/entities/whatsapp/account.d.ts +5 -1
  210. package/dist/src/entities/whatsapp/chat.d.ts +9 -1
  211. package/dist/src/entities/whatsapp/namespace.d.ts +7 -1
  212. package/dist/src/entities/workspace/namespace.d.ts +12 -4
  213. package/dist/src/entities/workspace/query.d.ts +5 -1
  214. package/dist/src/entities/workspace/query.test.d.ts +1 -0
  215. package/dist/src/events/hydrate/document.d.ts +5 -0
  216. package/dist/src/events/hydrate/user.d.ts +14 -0
  217. package/dist/src/events/receiver.d.ts +2 -0
  218. package/dist/src/events/types.d.ts +2 -1
  219. package/dist/src/macro.d.ts +59 -6
  220. package/dist/src/macro.js +18710 -10355
  221. package/dist/src/utils/activity.d.ts +2 -0
  222. package/dist/src/utils/index.d.ts +1 -1
  223. package/dist/src/utils/lazy.d.ts +20 -1
  224. package/dist/src/utils/options.d.ts +7 -0
  225. package/dist/src/utils/pagination.d.ts +16 -0
  226. package/dist/src/utils/verbs.d.ts +3 -0
  227. package/package.json +1 -1
  228. package/dist/src/entities/crm/comment.d.ts +0 -64
@@ -0,0 +1,238 @@
1
+ import type { EmailPolicyAudit, EmailPolicyCommand, EmailPolicyOutcome, EmailPolicyToken, EmailPolicyView, EmailPrivacySettings, EmailRuleValidation } from '../../../generated/storage/types.gen';
2
+ import type { MacroClient } from '../../utils/client';
3
+ import { type IterationOptions } from '../../utils/pagination';
4
+ import { AgentSession } from '../agent-sessions/agent-session';
5
+ import { Agent } from '../agents/agent';
6
+ import { Link } from '../email/link';
7
+ import { EmailThread } from '../email/thread';
8
+ import { CrmEmailRulePreview } from './email-rule-preview';
9
+ import { CrmEmailRuleRevision } from './email-rule-revision';
10
+ import { type CrmEmailRuleSet } from './email-rules';
11
+ /** The server's opaque observation; pass it unchanged, never refresh on conflict. */
12
+ export type CrmEmailPolicyToken = EmailPolicyToken;
13
+ /** A retry repeats this exact observation, key and command. */
14
+ export type CrmEmailPolicyWriteOptions = {
15
+ /** The token returned by the inspection on which this decision was based. */
16
+ ifPolicy: CrmEmailPolicyToken;
17
+ /** One UUID per intended operation, reused only for its exact retries. */
18
+ idempotencyKey: EmailPolicyCommand['request_id'];
19
+ };
20
+ /** Inspection is read-only, including before a member ever contributes. */
21
+ export type CrmEmailPolicy = {
22
+ /** False means rule authoring is unavailable; do not attempt to bypass the gate. */
23
+ authoringAvailable: boolean;
24
+ /** Server explanation of whole-thread sharing, live targets and exclusions. */
25
+ effect: string;
26
+ /** Whether this mailbox currently contributes. */
27
+ enabled: boolean;
28
+ /** Exact current or prospective primary mailbox. */
29
+ inbox?: Link;
30
+ /** Address displayed for that mailbox. */
31
+ mailboxEmail?: string;
32
+ /** All eligible mail or selected whole threads. */
33
+ mode: EmailPolicyView['mode'];
34
+ /** Active saved definition, when selected. */
35
+ revision?: CrmEmailRuleRevision;
36
+ /** Saved selectors; handles do not fetch live target details. */
37
+ rules?: CrmEmailRuleSet;
38
+ /** Absent for legacy state while authoring is off. */
39
+ token?: CrmEmailPolicyToken;
40
+ };
41
+ /** A committed result; replayed describes the old commit, not current sharing. */
42
+ export type CrmEmailPolicyResult = {
43
+ /** Correlation with the owner's audit history, not an authorization token. */
44
+ auditEventId: EmailPolicyOutcome['audit_event_id'];
45
+ effect: string;
46
+ enabled: boolean;
47
+ mode: EmailPolicyOutcome['mode'];
48
+ replayed: boolean;
49
+ revision?: CrmEmailRuleRevision;
50
+ token: CrmEmailPolicyToken;
51
+ };
52
+ /** Canonical selectors and bounded warnings; no contribution is granted. */
53
+ export type CrmEmailRuleValidation = {
54
+ rules: CrmEmailRuleSet;
55
+ effect: string;
56
+ /** Indices in the canonical rules that may match most of this mailbox. */
57
+ broadRuleIndices: EmailRuleValidation['broad_rule_indices'];
58
+ /** Canonical rules whose live targets currently match nothing. */
59
+ inactiveRuleIndices: EmailRuleValidation['inactive_rule_indices'];
60
+ };
61
+ /** Actor provenance comes from authenticated credentials, never the SDK request. */
62
+ export type CrmEmailPolicyHistoryEvent = {
63
+ /** Stable event correlation identity. */
64
+ id: string;
65
+ action: EmailPolicyAudit['entry']['action'];
66
+ actorKind: EmailPolicyAudit['entry']['actor_kind'];
67
+ agent?: Agent;
68
+ agentSession?: AgentSession;
69
+ createdAt: string;
70
+ inbox: Link;
71
+ /** Historical lifetime/version; neither grants permission to write. */
72
+ consentIncarnation?: string;
73
+ policyVersion: number;
74
+ previousRevision?: CrmEmailRuleRevision;
75
+ nextRevision?: CrmEmailRuleRevision;
76
+ /** Bounded server metadata without mail content or expanded targets. */
77
+ details: unknown;
78
+ };
79
+ /** Existing consent and exclusions; CRM viewing permission is not required. */
80
+ export type CrmEmailPrivacySettings = {
81
+ enabled: boolean;
82
+ inbox?: Link;
83
+ mailboxEmail?: string;
84
+ personalDomains: string[];
85
+ teamDomains: string[];
86
+ personalDomainWarnings: EmailPrivacySettings['personal_domain_warnings'];
87
+ teamDomainWarnings: EmailPrivacySettings['team_domain_warnings'];
88
+ canRemoveTeamDomains: boolean;
89
+ };
90
+ /** One private mailbox copy; another member's eligible copy remains visible. */
91
+ export type CrmExcludedEmailThread = {
92
+ thread: EmailThread;
93
+ inbox: Link;
94
+ subject?: string;
95
+ };
96
+ /**
97
+ * Own-member contribution rules and exclusions, independent of CRM viewing access.
98
+ *
99
+ * @routing Use when reading or changing which of your emails contribute to CRM; not inbox filters or another member's contribution.
100
+ *
101
+ * @agent
102
+ * ## Email contribution
103
+ *
104
+ * `crm.emailPrivacy` manages only the authenticated member's contribution, even when CRM viewing is disabled. Read `get()` before deciding, and use its exact token plus one UUID idempotency key per intended write. A member-authorized agent activates rules directly; no separate member confirmation is required. A 409 requires inspection and a new decision, never an automatic token refresh and retry. Restricted credentials and server rollout gates still apply.
105
+ *
106
+ * Explain that a matching participant shares the whole past/future thread, contact/company targets resolve live, and all exclusions override inclusions. Narrowing or withdrawal hides this member's ineligible copies while CRM records remain; another member's independently eligible copy stays visible. `settings()` and `excludedThreads()` read existing exclusions separately. Preview counts are optional, mailbox-local and bounded: only complete is exact; partial is a lower bound and stale/cancelled is not a current estimate. Replayed mutations describe the original commit, so inspect again to report current sharing.
107
+ */
108
+ export declare class CrmEmailPrivacyNamespace {
109
+ private readonly client;
110
+ constructor(client: MacroClient);
111
+ /**
112
+ * Inspect your sharing and token without initializing consent; read exclusions separately with settings and excludedThreads.
113
+ * Handles do not fetch CRM records or email content. With the gate off a legacy
114
+ * member gets no editable token; existing consent withdrawal still uses setConsent(false).
115
+ *
116
+ * @readonly
117
+ */
118
+ get(): Promise<CrmEmailPolicy>;
119
+ /**
120
+ * Validate and normalize rules without sharing mail; warnings refer to the returned canonical list.
121
+ * Contact/company targets resolve live; a hidden or deleted target may be inactive.
122
+ * Validation is not a grant and activation revalidates. Server limits and field errors are preserved.
123
+ *
124
+ * @readonly
125
+ */
126
+ validateRules(rules: CrmEmailRuleSet): Promise<CrmEmailRuleValidation>;
127
+ /**
128
+ * Activate a complete replacement directly as the member; this shares eligible past and future whole threads.
129
+ * One matching participant includes the whole thread. Contacts and companies
130
+ * resolve live, while private threads and other exclusions always win. An empty
131
+ * list selects nothing. Previously created CRM records remain after narrowing.
132
+ * Ordinary member-authorized agents may activate without a separate human
133
+ * confirmation; restricted credentials and rollout gates still apply.
134
+ * Reuse the same key, token and rules only for an exact retry. On 409 inspect and
135
+ * decide again; never refresh the token automatically or retry the old decision.
136
+ * A replayed result records the original commit, not current sharing.
137
+ *
138
+ * @destructive
139
+ * @idempotent
140
+ */
141
+ replaceRules(rules: CrmEmailRuleSet, options: CrmEmailPolicyWriteOptions): Promise<CrmEmailPolicyResult>;
142
+ /**
143
+ * Share all eligible past and future mail using the observed token; exclusions still win and the rollout gate still applies.
144
+ * This replaces selected scope. Never refresh a stale token or retry an old
145
+ * decision after 409. Exact retries reuse the same idempotency key and token.
146
+ *
147
+ * @destructive
148
+ * @idempotent
149
+ */
150
+ enableAll(options: CrmEmailPolicyWriteOptions): Promise<CrmEmailPolicyResult>;
151
+ /**
152
+ * Withdraw your contribution using the observed token; CRM records and eligible teammate copies remain.
153
+ * Modern withdrawal remains available when authoring is disabled. Legacy members
154
+ * without a token use setConsent(false). No automatic token refresh or conflict retry.
155
+ *
156
+ * @destructive
157
+ * @idempotent
158
+ */
159
+ withdraw(options: CrmEmailPolicyWriteOptions): Promise<CrmEmailPolicyResult>;
160
+ private changePolicy;
161
+ /**
162
+ * Start a bounded count preview without activating consent; first inspect the current slot with preview().
163
+ * Pass that exact handle as ifPreview, or omit it only when no preview exists.
164
+ * The policy token must come from the decision's inspection. No automatic retry
165
+ * on conflicts or throttling. Counts cover only your mailbox copies; only a
166
+ * complete result is exact. Work is capped at 10,000 raw threads and five minutes.
167
+ *
168
+ * @readonly
169
+ */
170
+ previewRules(rules: CrmEmailRuleSet, options: {
171
+ ifPolicy: CrmEmailPolicyToken;
172
+ ifPreview?: CrmEmailRulePreview;
173
+ }): Promise<CrmEmailRulePreview>;
174
+ /**
175
+ * Inspect the current preview slot without starting work; retain its handle before requesting replacement.
176
+ *
177
+ * @readonly
178
+ */
179
+ preview(): Promise<CrmEmailRulePreview | undefined>;
180
+ /**
181
+ * Iterate your audit history lazily, fifty events per page; `maxItems` caps the total. Definitions are separate revision handles.
182
+ * Agent and session handles identify verified provenance and never fetch their content automatically.
183
+ *
184
+ * @readonly
185
+ */
186
+ history(opts?: IterationOptions): AsyncGenerator<CrmEmailPolicyHistoryEvent>;
187
+ private historyEvents;
188
+ /**
189
+ * Read current mailbox consent and personal/team domain exclusions without changing sharing.
190
+ * Use get() for selected rules and their token, and excludedThreads() for private exceptions.
191
+ *
192
+ * @readonly
193
+ */
194
+ settings(): Promise<CrmEmailPrivacySettings>;
195
+ /**
196
+ * Change existing all-mail consent; policies with a token use enableAll or withdraw instead.
197
+ * Enabling requires the exact primary inbox the member chose, and shares all
198
+ * eligible past and future mail. Disabling needs no connected inbox. This
199
+ * existing API never activates selected rules or bypasses their rollout gate.
200
+ *
201
+ * @destructive
202
+ * @idempotent
203
+ */
204
+ setConsent(enabled: boolean, inbox?: Link): Promise<CrmEmailPrivacySettings>;
205
+ /**
206
+ * Exclude a domain from your contributions retroactively; existing CRM records remain.
207
+ * Team-wide domain controls remain on crm.blockDomain/unblockDomain.
208
+ *
209
+ * @destructive
210
+ * @idempotent
211
+ */
212
+ blockDomain(domain: string): Promise<CrmEmailPrivacySettings>;
213
+ /**
214
+ * Remove your domain exclusion; consent, selected rules and all other exclusions still apply.
215
+ *
216
+ * @write
217
+ * @idempotent
218
+ */
219
+ unblockDomain(domain: string): Promise<CrmEmailPrivacySettings>;
220
+ /**
221
+ * Set or clear your private thread exception; another member's eligible copy is unaffected.
222
+ * Only your mailbox-local thread may be changed. Clearing does not itself opt
223
+ * anything in. The existing thread-exclusion rollout gate remains enforced.
224
+ *
225
+ * @destructive
226
+ * @idempotent
227
+ */
228
+ setThreadExcluded(thread: EmailThread, excluded: boolean): Promise<CrmEmailPrivacySettings>;
229
+ /**
230
+ * Iterate only your private thread exceptions lazily; `maxItems` caps the total. Subjects come from your own mailbox.
231
+ *
232
+ * @readonly
233
+ */
234
+ excludedThreads(opts?: IterationOptions): AsyncGenerator<CrmExcludedEmailThread>;
235
+ private excludedThreadPages;
236
+ private changePrivacy;
237
+ private privacySettings;
238
+ }
@@ -0,0 +1,55 @@
1
+ import type { EmailPreviewView } from '../../../generated/storage/types.gen';
2
+ import type { MacroClient } from '../../utils/client';
3
+ /** Counts concern this member's mailbox copies, never team-wide conversations. */
4
+ export type CrmEmailPreviewState = {
5
+ /** Only complete means exact counts; partial and running counts are lower bounds. */
6
+ status: EmailPreviewView['status'];
7
+ /** Distinct threads: current, proposed, added, removed, retained and denied. */
8
+ counts: EmailPreviewView['counts'];
9
+ /** Stable snapshot time, absent until a worker starts. */
10
+ asOf?: string;
11
+ /** Worker attempt identity; compare before combining observations. */
12
+ contextId: EmailPreviewView['context_id'];
13
+ /** Preview enqueue time. */
14
+ createdAt: string;
15
+ /** Five-minute work deadline, not a promise of a complete result. */
16
+ expiresAt: string;
17
+ /** Raw threads examined so far. */
18
+ scannedThreads: number;
19
+ };
20
+ /** An exact preview slot occupant; a replaced handle never follows newer work. */
21
+ export declare class CrmEmailRulePreview {
22
+ private readonly client;
23
+ readonly id: string;
24
+ private snapshot?;
25
+ private readVersion;
26
+ private constructor();
27
+ /** Reconstruct a handle; a subsequent read verifies it is still current. */
28
+ static byId(client: MacroClient, id: string): CrmEmailRulePreview;
29
+ /** @internal Preserve the preview identity and the response already received. */
30
+ static from(client: MacroClient, record: EmailPreviewView): CrmEmailRulePreview;
31
+ /**
32
+ * Refresh this preview's counts; only complete is exact, and a replaced preview is unavailable.
33
+ * Cancelled and stale counts are not current estimates. No polling or implicit restart.
34
+ *
35
+ * @readonly
36
+ */
37
+ get(): Promise<CrmEmailPreviewState>;
38
+ /**
39
+ * Cancel only this preview; consent is unchanged and newer preview work is never cancelled.
40
+ *
41
+ * @destructive
42
+ * @idempotent
43
+ */
44
+ cancel(): Promise<void>;
45
+ toJSON(): {
46
+ status?: import("../../../generated/storage").EmailPolicyPreviewStatus | undefined;
47
+ counts?: import("../../../generated/storage").EmailPolicyPreviewCounts | undefined;
48
+ asOf?: string;
49
+ contextId?: string | undefined;
50
+ createdAt?: string | undefined;
51
+ expiresAt?: string | undefined;
52
+ scannedThreads?: number | undefined;
53
+ id: string;
54
+ };
55
+ }
@@ -0,0 +1,27 @@
1
+ import type { MacroClient } from '../../utils/client';
2
+ import { Link } from '../email/link';
3
+ import { MacroEntity } from '../entity';
4
+ import { type CrmEmailRuleSet } from './email-rules';
5
+ /** One immutable rule definition in the caller's current team's history. */
6
+ export type CrmEmailRuleDefinition = {
7
+ /** The mailbox this definition was saved for. */
8
+ inbox: Link;
9
+ /** Definition commit time, as an RFC 3339 timestamp. */
10
+ createdAt: string;
11
+ /** Stored selectors, not an expansion of their live targets. */
12
+ rules: CrmEmailRuleSet;
13
+ };
14
+ /** A saved definition; reading it never reapplies it or grants access to its targets. */
15
+ export declare class CrmEmailRuleRevision extends MacroEntity<CrmEmailRuleDefinition> {
16
+ private readonly revision;
17
+ private constructor();
18
+ /** Construct a definition handle from its revision number. */
19
+ static byId(client: MacroClient, revision: number): CrmEmailRuleRevision;
20
+ protected fetch(): Promise<CrmEmailRuleDefinition>;
21
+ /**
22
+ * Read this saved definition without fetching live contact, company or email content.
23
+ *
24
+ * @readonly
25
+ */
26
+ get(): Promise<CrmEmailRuleDefinition>;
27
+ }
@@ -0,0 +1,32 @@
1
+ import type { EmailInclusionRule, EmailRuleSet } from '../../../generated/storage/types.gen';
2
+ import type { MacroClient } from '../../utils/client';
3
+ import { Company } from '../crm/company';
4
+ import { Contact } from '../crm/contact';
5
+ import { EmailThread } from '../email/thread';
6
+ /** One positive whole-thread selector; existing exclusions always win. */
7
+ export type CrmEmailRule = Extract<EmailInclusionRule, {
8
+ kind: 'address' | 'domain';
9
+ }> | {
10
+ /** Select one mailbox-local thread owned by the caller. */
11
+ kind: 'thread';
12
+ thread: EmailThread;
13
+ } | {
14
+ /** Follow all current addresses on this visible contact. */
15
+ kind: 'contact';
16
+ contact: Contact;
17
+ } | {
18
+ /** Follow the company's current domains and visible contacts. */
19
+ kind: 'company';
20
+ company: Company;
21
+ };
22
+ /** A complete replacement; an empty include list selects no mail. */
23
+ export type CrmEmailRuleSet = {
24
+ /** Rule format version, currently 1; unrelated to policy revisions. */
25
+ schemaVersion: EmailRuleSet['schema_version'];
26
+ /** OR-combined selectors; contact and company targets resolve live. */
27
+ include: CrmEmailRule[];
28
+ };
29
+ /** @internal Convert SDK handles without silently discarding mistyped options. */
30
+ export declare function emailRulesBody(rules: CrmEmailRuleSet): EmailRuleSet;
31
+ /** @internal Rebuild handles without fetching target details or email content. */
32
+ export declare function emailRules(client: MacroClient, rules: EmailRuleSet): CrmEmailRuleSet;
@@ -20,52 +20,99 @@ export declare class DatabaseColumn {
20
20
  /**
21
21
  * The column's record as the API returns it: the placement and the bound
22
22
  * property definition.
23
+ *
24
+ * @readonly
23
25
  */
24
26
  detail(): Promise<ColumnDetail>;
25
- /** The placement's display name, falling back to its property definition. */
27
+ /**
28
+ * The placement's display name, falling back to its property definition.
29
+ *
30
+ * @readonly
31
+ */
26
32
  name(): Promise<string>;
27
33
  /**
28
34
  * Rename this placement, only if its last-read name is still current,
29
35
  * without changing its shared property definition.
36
+ *
37
+ * @write
38
+ * @idempotent
30
39
  */
31
40
  rename(name: string): Promise<DatabaseColumn>;
32
- /** Settle the type of an empty column created with inferType enabled. */
41
+ /**
42
+ * Settle the type of an empty column created with inferType enabled.
43
+ *
44
+ * @write
45
+ * @idempotent
46
+ */
33
47
  inferType(options: InferColumnTypeOptions): Promise<DatabaseColumn>;
34
- /** Change this column's type. See {@link Database.changeColumnType}. */
48
+ /**
49
+ * Change this column's type. See {@link Database.changeColumnType}.
50
+ *
51
+ * @write
52
+ * @idempotent
53
+ */
35
54
  changeType(options: ChangeColumnTypeOptions): Promise<OpResultOf<'column', 'type_changed'>>;
36
55
  /**
37
56
  * Add a column of another type right after this one, filled with the
38
57
  * values that convert, leaving this one as it is. See
39
58
  * {@link Database.convertColumnIntoNewColumn}.
59
+ *
60
+ * @write
40
61
  */
41
62
  convertIntoNewColumn(options: ConvertIntoNewColumnOptions): Promise<DatabaseColumn>;
42
63
  /**
43
64
  * What changing this column to each type would do to its values: `safe`,
44
65
  * `checked` (with how many would not convert, and a few of them), or
45
66
  * `never` (with why). Changes nothing.
67
+ *
68
+ * @readonly
46
69
  */
47
70
  casts(): Promise<ColumnCast[]>;
48
- /** Delete this placement and its cells at the table version last read. */
71
+ /**
72
+ * Delete this placement and its cells at the table version last read.
73
+ *
74
+ * @destructive
75
+ * @idempotent
76
+ */
49
77
  delete(): Promise<void>;
50
- /** The value type the column holds. */
78
+ /**
79
+ * The value type the column holds.
80
+ *
81
+ * @readonly
82
+ */
51
83
  dataType(): Promise<DataType>;
52
- /** Whether the column holds multiple values. */
84
+ /**
85
+ * Whether the column holds multiple values.
86
+ *
87
+ * @readonly
88
+ */
53
89
  isMultiSelect(): Promise<boolean>;
54
- /** The column's fractional index within the table's column order. */
90
+ /**
91
+ * The column's fractional index within the table's column order.
92
+ *
93
+ * @readonly
94
+ */
55
95
  position(): Promise<string>;
56
96
  /**
57
97
  * The bound property definition together with its select options — the
58
98
  * source of the column's name, type, and allowed values.
99
+ *
100
+ * @readonly
59
101
  */
60
102
  definition(): Promise<PropertyDefinitionWithOptions>;
61
103
  /**
62
104
  * Column-kind configuration (a link), or `undefined` for a plain
63
105
  * value column.
106
+ *
107
+ * @readonly
64
108
  */
65
109
  config(): Promise<ColumnConfig | undefined>;
66
110
  /**
67
111
  * Add select options to the column. Labels it already has are skipped, so
68
112
  * the call is safe to repeat. Only select and tag columns accept options.
113
+ *
114
+ * @write
115
+ * @idempotent
69
116
  */
70
117
  addOptions(labels: string[]): Promise<DatabaseColumn>;
71
118
  toJSON(): {