@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
@@ -1,10 +1,15 @@
1
- import type { AccessiblePipeline, CardPosition, ColumnDetail, CreatePipeline, DatabaseOp, DatabaseView as DatabaseViewRecord, StorageRow, StorageRowsQuery, TableDetail } from '../../../generated/storage/types.gen';
1
+ import type { AccessiblePipeline, CardPosition, ColumnDetail, CreatePipeline, DatabaseOp, DatabaseView as DatabaseViewRecord, EditPipelineRequest, StorageRow, StorageRowsQuery, TableDetail } from '../../../generated/storage/types.gen';
2
+ import { type IterationOptions } from '../../utils';
2
3
  import type { MacroClient } from '../../utils/client';
4
+ import { Document } from '../documents/document';
3
5
  import { MacroEntity } from '../entity';
4
6
  import { PropertyOption } from '../properties/property-option';
5
7
  import { type SharePermissionOptions } from '../sharing/permissions';
6
8
  import { Team } from '../teams/team';
7
9
  import { User } from '../users/user';
10
+ import { Company } from './company';
11
+ import { Contact } from './contact';
12
+ import { PipelineEntry, type PipelineField, type PipelineFieldChange, type PipelineFieldInputs, type PipelineFieldTotal, type PipelineImport, type PipelineOptionCounts, type PipelineRecordInput } from './pipeline-entry';
8
13
  /** Required fields for one option of a pipeline stage column. */
9
14
  export type PipelineStageRequirement = {
10
15
  stageColumn: PipelineColumn;
@@ -31,35 +36,239 @@ export declare class CrmPipeline extends MacroEntity<AccessiblePipeline> {
31
36
  readonly owner: () => Promise<User>;
32
37
  /** Owning team. */
33
38
  readonly team: () => Promise<Team>;
34
- /** Rename this pipeline. */
39
+ /**
40
+ * Rename this pipeline.
41
+ *
42
+ * @write
43
+ * @idempotent
44
+ */
35
45
  rename(name: string): Promise<void>;
36
- /** Change its sharing scope. */
46
+ /**
47
+ * Change its sharing scope.
48
+ *
49
+ * @write
50
+ * @idempotent
51
+ */
37
52
  setSharing(sharing: CreatePipeline['sharing']): Promise<void>;
38
- /** Trash or restore the pipeline. */
53
+ /**
54
+ * Trash or restore the pipeline.
55
+ *
56
+ * @destructive
57
+ * @idempotent
58
+ */
39
59
  setTrashed(trashed: boolean): Promise<void>;
40
- /** Read sharing grants. */
60
+ /**
61
+ * Read sharing grants.
62
+ *
63
+ * @readonly
64
+ */
41
65
  sharePermissions(): Promise<import("../../../generated/storage").SharePermissionV2>;
42
- /** Update sharing grants. */
66
+ /**
67
+ * Update sharing grants.
68
+ *
69
+ * @write
70
+ * @idempotent
71
+ */
43
72
  updateSharePermissions(options: SharePermissionOptions): Promise<import("../../../generated/storage").SharePermissionV2>;
44
- /** Read stage rules with column and option handles that survive renames. */
73
+ /**
74
+ * Read stage rules with column and option handles that survive renames.
75
+ *
76
+ * @readonly
77
+ */
45
78
  stageRequirements(): Promise<PipelineStageRequirement[]>;
46
- /** Require fields when entering a stage; an empty list removes that stage's rule. */
79
+ /**
80
+ * Require fields when entering a stage; an empty list removes that stage's rule.
81
+ *
82
+ * @write
83
+ * @idempotent
84
+ * @mcp-exclude Takes a handle built from a listing record, which an MCP call can't reference.
85
+ */
47
86
  setStageRequirements(stageColumn: PipelineColumn, stage: PropertyOption, requiredFields: PipelineColumn[]): Promise<void>;
48
- /** Read the backing table through the pipeline's authorization boundary. */
87
+ /**
88
+ * Read the backing table through the pipeline's authorization boundary.
89
+ *
90
+ * @readonly
91
+ */
49
92
  table(): Promise<PipelineTable>;
50
- /** Saved card order through this pipeline's authorization boundary. */
93
+ /**
94
+ * Saved card order through this pipeline's authorization boundary.
95
+ *
96
+ * @readonly
97
+ * @mcp-exclude Takes a handle built from a listing record, which an MCP call can't reference.
98
+ */
51
99
  viewPositions(view: PipelineView): Promise<CardPosition[]>;
52
- /** @internal Cached table snapshot shared by all pipeline table handles. */
100
+ /**
101
+ * @internal Cached table snapshot shared by all pipeline table handles.
102
+ *
103
+ * @readonly
104
+ * @mcp-exclude Internal cache accessor shared by pipeline handles.
105
+ */
53
106
  tableRecord(): Promise<TableDetail>;
54
- /** Rows in pipeline order, automatically paginated. */
55
- rows(): AsyncGenerator<PipelineRow>;
56
- /** Query pipeline rows, optionally restricting the query to typed row handles. */
107
+ /**
108
+ * Rows in pipeline order, automatically paginated; `maxItems` caps the total.
109
+ *
110
+ * @readonly
111
+ */
112
+ rows(opts?: IterationOptions): AsyncGenerator<PipelineRow>;
113
+ /**
114
+ * Query pipeline rows, optionally restricting the query to typed row handles; `maxItems` caps the total.
115
+ *
116
+ * @readonly
117
+ */
57
118
  queryRows(options?: {
58
119
  query?: StorageRowsQuery['query'];
59
120
  rows?: PipelineRow[];
121
+ maxItems?: number;
60
122
  }): AsyncGenerator<PipelineRow>;
123
+ /**
124
+ * Add companies or contacts as entries (deals), filling fields by name: a
125
+ * stage by its label, a person as `'me'` or an email. A generic pipeline's
126
+ * entries name no record, only fields. A record already in the pipeline is
127
+ * not added again unless `allowDuplicates` (a separate second deal); its
128
+ * entry comes back in `alreadyPresent`.
129
+ *
130
+ * @write
131
+ */
132
+ addRecords(entries: {
133
+ record?: PipelineRecordInput;
134
+ set?: PipelineFieldInputs;
135
+ }[], options?: {
136
+ allowDuplicates?: boolean;
137
+ }): Promise<{
138
+ added: PipelineEntry[];
139
+ alreadyPresent: PipelineEntry[];
140
+ version: number | undefined;
141
+ }>;
142
+ /**
143
+ * Set fields of entries by name, all or nothing: a stage by its label, a
144
+ * person as `'me'` or an email, `null` to empty. Name an entry, or a company
145
+ * or contact with exactly one entry here. Pass `baseVersion` (from
146
+ * {@link CrmPipeline.find}) to refuse the change if the pipeline changed
147
+ * since. Each returned entry carries the fields the update set.
148
+ *
149
+ * @destructive
150
+ * @mcp-exclude Takes a pipeline entry built from a listing record, which an MCP call cannot reference.
151
+ */
152
+ updateEntries(updates: {
153
+ entry: PipelineEntry | Company | Contact;
154
+ set: PipelineFieldInputs;
155
+ }[], options?: {
156
+ baseVersion?: number;
157
+ }): Promise<{
158
+ updated: {
159
+ entry: PipelineEntry;
160
+ changes: PipelineFieldChange[];
161
+ }[];
162
+ version: number | undefined;
163
+ }>;
164
+ /**
165
+ * Delete entries: each entry given, and every entry of each company or
166
+ * contact given. The companies and contacts stay in the CRM. Returns the
167
+ * deleted entries as they were.
168
+ *
169
+ * @destructive
170
+ * @mcp-exclude Takes a pipeline entry built from a listing record, which an MCP call cannot reference.
171
+ */
172
+ removeRecords(targets: (PipelineEntry | Company | Contact)[]): Promise<{
173
+ removed: PipelineEntry[];
174
+ version: number | undefined;
175
+ }>;
176
+ /**
177
+ * Read entries by field name and label.
178
+ *
179
+ * `where` filters by field values (`{ Stage: 'Demo' }`, a list for any of
180
+ * several, `null` for empty). Restrict to some companies or contacts, or
181
+ * search their names, domains and emails; sort by a field.
182
+ * Also answers per-stage counts and number totals (such as Revenue)
183
+ * over every match, and the pipeline's fields and version. A monetary field
184
+ * (one whose field summary names a `currencyField`) has one total per
185
+ * `currency`; amounts in different currencies are never converted or added.
186
+ *
187
+ * @param query.limit Most entries to return, 1 to 5000 (default 50); counts and totals cover every match.
188
+ *
189
+ * @readonly
190
+ */
191
+ find(query?: {
192
+ where?: PipelineFieldInputs;
193
+ records?: (Company | Contact)[];
194
+ search?: string;
195
+ sortBy?: string;
196
+ descending?: boolean;
197
+ limit?: number;
198
+ }): Promise<{
199
+ entries: PipelineEntry[];
200
+ matched: number;
201
+ complete: boolean;
202
+ counts: PipelineOptionCounts[];
203
+ totals: PipelineFieldTotal[];
204
+ fields: PipelineField[];
205
+ version: number;
206
+ }>;
207
+ /**
208
+ * Edit pipeline sharing, fields and options together.
209
+ *
210
+ * Rename or share the pipeline; change fields and options by name: add
211
+ * fields (text, number, checkbox, date, link, select, multi_select, person or
212
+ * people), rename or delete fields, and add,
213
+ * relabel or delete options (new Stage options become the last stages).
214
+ * Returns the fields and version afterwards.
215
+ *
216
+ * @destructive
217
+ */
218
+ edit(changes: EditPipelineRequest): Promise<{
219
+ fields: PipelineField[];
220
+ version: number;
221
+ }>;
222
+ /**
223
+ * Import CSV entries into a company or contact pipeline; generic pipelines are refused.
224
+ *
225
+ * Accepts CSV text or a CSV document. Columns match fields by name;
226
+ * Company and Domain (or Contact and Email) name each row's
227
+ * record, created when the team lacks it. Records already here are not
228
+ * added again, and select options the CSV needs are added.
229
+ *
230
+ * @write
231
+ */
232
+ importCsv(source: string | Document): Promise<PipelineImport>;
233
+ /**
234
+ * Export up to 5000 entries as CSV; check `complete` before treating it as a full export.
235
+ *
236
+ * Company and contact pipelines export Company and Domain (or Contact and
237
+ * Email), then one column per field, with people as emails. Generic
238
+ * pipelines export only their fields. {@link CrmPipeline.importCsv} accepts
239
+ * the company or contact layout; generic pipelines refuse CSV imports.
240
+ *
241
+ * @readonly
242
+ */
243
+ exportCsv(): Promise<{
244
+ csv: string;
245
+ name: string;
246
+ rows: number;
247
+ complete: boolean;
248
+ }>;
249
+ /**
250
+ * Save up to 5000 entries as a CSV file; check `complete` before treating it as a full export.
251
+ *
252
+ * Saved in the caller's Macro files, laid out as {@link CrmPipeline.exportCsv} returns it.
253
+ *
254
+ * @write
255
+ */
256
+ exportCsvFile(): Promise<{
257
+ document: Document;
258
+ rows: number;
259
+ complete: boolean;
260
+ }>;
261
+ /**
262
+ * @internal Whether entries track companies or contacts; `undefined` for a generic pipeline.
263
+ * Writes read it first, so a failed read cannot hide a committed write that a retry would repeat.
264
+ */
265
+ private trackedRecordType;
61
266
  /** Apply an atomic generated database operation batch through this pipeline.
62
- * As with Database.applyOps, batch-local UUIDs may name resources minted earlier in the batch. */
267
+ * As with Database.applyOps, batch-local UUIDs may name resources minted earlier in the batch.
268
+ *
269
+ * @destructive
270
+ * @mcp-exclude Takes a handle built from a listing record, which an MCP call can't reference.
271
+ */
63
272
  applyOps(ops: DatabaseOp[], options?: {
64
273
  baseVersions?: {
65
274
  table: PipelineTable;
@@ -67,7 +276,11 @@ export declare class CrmPipeline extends MacroEntity<AccessiblePipeline> {
67
276
  }[];
68
277
  }): Promise<import("../../../generated/storage").AppliedOps>;
69
278
  }
70
- /** Backing table of a CRM pipeline. */
279
+ /**
280
+ * Backing table of a CRM pipeline.
281
+ *
282
+ * @mcp-exclude Built from a listing record; no id-only reference an MCP call can pass.
283
+ */
71
284
  export declare class PipelineTable extends MacroEntity<TableDetail> {
72
285
  /** Parent pipeline. */
73
286
  readonly pipeline: CrmPipeline;
@@ -81,18 +294,42 @@ export declare class PipelineTable extends MacroEntity<TableDetail> {
81
294
  /** Seed a table from a pipeline table response. */
82
295
  static from(client: MacroClient, pipeline: CrmPipeline, record: TableDetail): PipelineTable;
83
296
  protected fetch(): Promise<TableDetail>;
84
- /** Columns in this table. */
297
+ /**
298
+ * Columns in this table.
299
+ *
300
+ * @readonly
301
+ */
85
302
  columns(): Promise<PipelineColumn[]>;
86
- /** Stored views in display order. */
303
+ /**
304
+ * Stored views in display order.
305
+ *
306
+ * @readonly
307
+ */
87
308
  views(): Promise<PipelineView[]>;
88
- /** Table version for optimistic operation batches. */
309
+ /**
310
+ * Table version for optimistic operation batches.
311
+ *
312
+ * @readonly
313
+ */
89
314
  version(): Promise<number>;
90
- /** A scoped row handle. */
315
+ /**
316
+ * A scoped row handle.
317
+ *
318
+ * @readonly
319
+ */
91
320
  rowById(id: string): PipelineRow;
92
- /** Rows from the authorized pipeline surface. */
93
- rows(): AsyncGenerator<PipelineRow>;
321
+ /**
322
+ * Rows from the authorized pipeline surface; `maxItems` caps the total.
323
+ *
324
+ * @readonly
325
+ */
326
+ rows(opts?: IterationOptions): AsyncGenerator<PipelineRow>;
94
327
  }
95
- /** A view owned and authorized by its CRM pipeline. */
328
+ /**
329
+ * A view owned and authorized by its CRM pipeline.
330
+ *
331
+ * @mcp-exclude Its table is built from a listing record; no id-only reference an MCP call can pass.
332
+ */
96
333
  export declare class PipelineView {
97
334
  /** The pipeline table this view shows. */
98
335
  readonly table: PipelineTable;
@@ -101,12 +338,18 @@ export declare class PipelineView {
101
338
  private constructor();
102
339
  /** A handle to a stored view within a pipeline table. */
103
340
  static byId(table: PipelineTable, id: string): PipelineView;
104
- /** The current view definition from the pipeline's shared schema cache. */
341
+ /**
342
+ * The current view definition from the pipeline's shared schema cache.
343
+ *
344
+ * @readonly
345
+ */
105
346
  detail(): Promise<DatabaseViewRecord>;
106
347
  /**
107
348
  * Read only cards with saved positions; unplaced cards are omitted.
108
349
  * A saved lane may be stale after a row's grouping value changes outside a
109
350
  * card move. Compare each lane with the row's current grouping before using it.
351
+ *
352
+ * @readonly
110
353
  */
111
354
  positions(): Promise<CardPosition[]>;
112
355
  /** Serialize identity without an authenticated client. */
@@ -136,10 +379,18 @@ export declare class PipelineRow extends MacroEntity<StorageRow> {
136
379
  readonly cells: () => Promise<{
137
380
  [key: string]: import("../../../generated/storage").PropertyValue;
138
381
  }>;
139
- /** Reload this row after an operation batch. */
382
+ /**
383
+ * Reload this row after an operation batch.
384
+ *
385
+ * @readonly
386
+ */
140
387
  refresh(): Promise<void>;
141
388
  }
142
- /** A column belonging to a pipeline table. */
389
+ /**
390
+ * A column belonging to a pipeline table.
391
+ *
392
+ * @mcp-exclude Built from a listing record; no id-only reference an MCP call can pass.
393
+ */
143
394
  export declare class PipelineColumn extends MacroEntity<ColumnDetail> {
144
395
  /** Parent table. */
145
396
  readonly table: PipelineTable;
@@ -154,10 +405,22 @@ export declare class PipelineColumn extends MacroEntity<ColumnDetail> {
154
405
  /** Seed a column handle. */
155
406
  static from(client: MacroClient, table: PipelineTable, record: ColumnDetail): PipelineColumn;
156
407
  protected fetch(): Promise<ColumnDetail>;
157
- /** Selectable options, including stable stage identities for requirement rules. */
408
+ /**
409
+ * Selectable options, including stable stage identities for requirement rules.
410
+ *
411
+ * @readonly
412
+ */
158
413
  options(): Promise<PropertyOption[]>;
159
- /** Whether the caller can write this column. */
414
+ /**
415
+ * Whether the caller can write this column.
416
+ *
417
+ * @readonly
418
+ */
160
419
  writable(): Promise<boolean>;
161
- /** Current column label. */
420
+ /**
421
+ * Current column label.
422
+ *
423
+ * @readonly
424
+ */
162
425
  name(): Promise<string>;
163
426
  }
@@ -1,14 +1,79 @@
1
- import type { CreatePipeline } from '../../../generated/storage/types.gen';
1
+ import type { CreatePipelineRequest } from '../../../generated/storage/types.gen';
2
2
  import type { MacroClient } from '../../utils/client';
3
+ import type { Company } from './company';
4
+ import type { Contact } from './contact';
3
5
  import { CrmPipeline } from './pipeline';
6
+ import { PipelineEntry, type PipelineField } from './pipeline-entry';
4
7
  /** CRM pipelines in the caller's team. */
5
8
  export declare class PipelineNamespace {
6
9
  private readonly client;
7
10
  constructor(client: MacroClient);
8
11
  /** Construct a lazy pipeline handle. */
9
12
  byId(id: string): CrmPipeline;
10
- /** List accessible pipelines. */
13
+ /**
14
+ * List accessible pipelines.
15
+ *
16
+ * @readonly
17
+ */
11
18
  list(): Promise<CrmPipeline[]>;
12
- /** Create a pipeline and its backing storage. */
13
- create(options: CreatePipeline): Promise<CrmPipeline>;
19
+ /**
20
+ * List accessible pipelines with each one's fields in column order and its
21
+ * version, in one call. A select field lists its options, so Stage lists the
22
+ * pipeline's stages from first to last; a tracked pipeline's first field
23
+ * names its company or contact. Use it instead of reading each pipeline's
24
+ * table or running a `find` per pipeline just to learn its fields.
25
+ *
26
+ * @readonly
27
+ */
28
+ listWithFields(): Promise<{
29
+ pipeline: CrmPipeline;
30
+ fields: PipelineField[];
31
+ version: number;
32
+ }[]>;
33
+ /**
34
+ * Create a pipeline. A company or contact pipeline starts with its record,
35
+ * Stage, Owner and Revenue fields; a generic one (no `recordType`) with
36
+ * only Name. `stages` (first to last) replaces the team's default stages,
37
+ * or adds a Stage field to a generic pipeline; `fields` are added after the
38
+ * standard ones. Private unless `sharing` is `team`.
39
+ *
40
+ * @example
41
+ * await macro.crm.pipelines.create({
42
+ * name: 'Hiring',
43
+ * recordType: 'contact',
44
+ * stages: ['Sourced', 'Interview', 'Offer', 'Hired'],
45
+ * fields: [{ name: 'Role', type: 'select', options: ['Engineer', 'Designer'] }],
46
+ * });
47
+ *
48
+ * @write
49
+ */
50
+ create(options: CreatePipelineRequest): Promise<CrmPipeline>;
51
+ /**
52
+ * Every entry (deal) tracking one of these companies or contacts, across
53
+ * the caller's pipelines; pipelines without one are left out.
54
+ *
55
+ * @readonly
56
+ */
57
+ entriesFor(records: (Company | Contact)[]): Promise<{
58
+ pipeline: CrmPipeline;
59
+ entries: PipelineEntry[];
60
+ }[]>;
61
+ /**
62
+ * Search entries across the caller's pipelines.
63
+ *
64
+ * Returns entries (deals) whose company or contact name, domain or email contains
65
+ * `search`, across the caller's pipelines; pipelines without a match are
66
+ * left out.
67
+ *
68
+ * @param opts.limit Most entries per pipeline, 1 to 5000 (default 50).
69
+ *
70
+ * @readonly
71
+ */
72
+ searchEntries(search: string, opts?: {
73
+ limit?: number;
74
+ }): Promise<{
75
+ pipeline: CrmPipeline;
76
+ entries: PipelineEntry[];
77
+ }[]>;
78
+ private entries;
14
79
  }