@wirecat/hubspot-cli 0.1.0 → 0.3.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 (212) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +40 -16
  3. package/contracts/wirecat.json +1516 -173
  4. package/dist/bin/hubspot.js +2 -2
  5. package/dist/bundle/agent-A7ARC3QB.js +40 -0
  6. package/dist/bundle/{all-profiles-64JAUYW4.js → all-profiles-6452VSJB.js} +64 -22
  7. package/dist/bundle/{anthropic-VJOS4OUM.js → anthropic-VQUOVYOW.js} +6 -6
  8. package/dist/bundle/{app-server-422MCA7S.js → app-server-FFYKM37G.js} +79 -68
  9. package/dist/bundle/{bun-M3J2QTR3.js → bun-AJPJ4ZUN.js} +2 -2
  10. package/dist/bundle/{bun-sqlite-IX3XYA5F.js → bun-sqlite-AGXGSF6D.js} +7 -7
  11. package/dist/bundle/{chunk-N2XADGL4.js → chunk-2A64XS22.js} +4 -4
  12. package/dist/bundle/{chunk-HTAN663T.js → chunk-2HYGCLKN.js} +93 -565
  13. package/dist/bundle/{chunk-FOZYMDRL.js → chunk-2NCO4E4T.js} +6 -6
  14. package/dist/bundle/{chunk-FBCCBCFH.js → chunk-2PRVWEJC.js} +3 -3
  15. package/dist/bundle/{chunk-LOBVOGOE.js → chunk-3DIXAEGH.js} +4 -4
  16. package/dist/bundle/{chunk-O3DYRCIT.js → chunk-3I2FGNWO.js} +1 -1
  17. package/dist/bundle/{chunk-65TWQ7BV.js → chunk-3PEKYGZ3.js} +2 -2
  18. package/dist/bundle/{chunk-DRWWJLI6.js → chunk-3R4KRNUZ.js} +8 -8
  19. package/dist/bundle/{chunk-2VGD63G6.js → chunk-3TEFE6YU.js} +7 -7
  20. package/dist/bundle/{chunk-BKXDHU3G.js → chunk-3WIVJJNB.js} +19 -17
  21. package/dist/bundle/{chunk-TI46WQXQ.js → chunk-4DNHXRCJ.js} +7 -7
  22. package/dist/bundle/{chunk-QU25DA5N.js → chunk-5AYKCKSE.js} +11 -11
  23. package/dist/bundle/chunk-5HD64ETI.js +561 -0
  24. package/dist/bundle/{chunk-CWXOXIWS.js → chunk-5K3FGXZH.js} +1 -1
  25. package/dist/bundle/{chunk-24ERVFJP.js → chunk-5YNAVVCW.js} +3 -3
  26. package/dist/bundle/chunk-77CUE3VX.js +46 -0
  27. package/dist/bundle/{chunk-36ITRDYY.js → chunk-7LQRXVQ3.js} +783 -482
  28. package/dist/bundle/{chunk-E5WLE7BM.js → chunk-7NZT7Y55.js} +1 -1
  29. package/dist/bundle/{chunk-C32AKHTY.js → chunk-7UEL65GQ.js} +35 -12
  30. package/dist/bundle/chunk-7VHBS5BJ.js +108 -0
  31. package/dist/bundle/{chunk-O55RWNSH.js → chunk-A6UFH3QU.js} +4 -4
  32. package/dist/bundle/{chunk-WE4UFASG.js → chunk-ABXVU5O4.js} +8 -1
  33. package/dist/bundle/{chunk-4W6BMH45.js → chunk-AF7DANIR.js} +2 -100
  34. package/dist/bundle/{chunk-LNV33FDC.js → chunk-AFL2C4JR.js} +60 -50
  35. package/dist/bundle/{chunk-2VGZRYEH.js → chunk-ARTJLL7W.js} +6 -6
  36. package/dist/bundle/chunk-AVUMH42T.js +194 -0
  37. package/dist/bundle/chunk-B2W3C4N6.js +338 -0
  38. package/dist/bundle/{chunk-FKA7DOCK.js → chunk-B3EH22CO.js} +1 -1
  39. package/dist/bundle/{chunk-E52JAS35.js → chunk-BAUK2MD5.js} +6 -6
  40. package/dist/bundle/{chunk-JLDBMEKZ.js → chunk-BN22EKQQ.js} +2 -2
  41. package/dist/bundle/{chunk-DB2XKHI4.js → chunk-BUGROVF3.js} +2 -2
  42. package/dist/bundle/{chunk-DSP36YHQ.js → chunk-CBCEMFCF.js} +2 -2
  43. package/dist/bundle/{chunk-WQBX7XYP.js → chunk-CYADK744.js} +1559 -1888
  44. package/dist/bundle/{chunk-HZRQLAHO.js → chunk-DQB5JMTY.js} +1 -1
  45. package/dist/bundle/{chunk-JRCPCVPI.js → chunk-DQP2GAAO.js} +75 -66
  46. package/dist/bundle/{chunk-FPUGMDJV.js → chunk-DSRXCLPO.js} +1 -1
  47. package/dist/bundle/{chunk-UUMUL4L3.js → chunk-DW23LM47.js} +2 -2
  48. package/dist/bundle/{chunk-TKVL2C3B.js → chunk-E4X7JAFC.js} +3 -3
  49. package/dist/bundle/{chunk-NUU4WZVL.js → chunk-EE4JSYGZ.js} +3 -3
  50. package/dist/bundle/{chunk-NWHEHV3K.js → chunk-EMOVVERN.js} +5 -5
  51. package/dist/bundle/{chunk-PVKF24ZW.js → chunk-FIVD4HM4.js} +8 -8
  52. package/dist/bundle/{chunk-QJW35N5V.js → chunk-GC6FLHZF.js} +12 -12
  53. package/dist/bundle/{chunk-TP7GDWVF.js → chunk-GRFICQTZ.js} +1 -1
  54. package/dist/bundle/{chunk-X2M6NIQG.js → chunk-HPZRUY6S.js} +1 -1
  55. package/dist/bundle/{chunk-CLAN3FES.js → chunk-IBTMK5KD.js} +54 -34
  56. package/dist/bundle/{chunk-5A6ZYNAQ.js → chunk-IQ2XZ62J.js} +18 -18
  57. package/dist/bundle/{chunk-DBEQI5YM.js → chunk-ITGNDZRR.js} +3 -3
  58. package/dist/bundle/{chunk-W53EJOFQ.js → chunk-IXZLMFPO.js} +1 -1
  59. package/dist/bundle/{chunk-TOSCB4SO.js → chunk-J5P5VSRG.js} +16 -10
  60. package/dist/bundle/{chunk-VIEYMDBR.js → chunk-J6C2QWL5.js} +3 -3
  61. package/dist/bundle/{chunk-ZBDSHFG4.js → chunk-JG7YMHNB.js} +3427 -3284
  62. package/dist/bundle/{chunk-RMIYKDUL.js → chunk-JK2SNLU5.js} +17 -17
  63. package/dist/bundle/{chunk-43EKCUBJ.js → chunk-JP2HJXFO.js} +3 -3
  64. package/dist/bundle/{chunk-DFCHHR5M.js → chunk-JUKAIXKY.js} +1 -1
  65. package/dist/bundle/{chunk-5GBUCHRU.js → chunk-KO4VR5NK.js} +4 -4
  66. package/dist/bundle/{chunk-PPHBRESD.js → chunk-KVXEEKBB.js} +2 -2
  67. package/dist/bundle/{chunk-SDQGB4KB.js → chunk-L433IDOX.js} +9 -9
  68. package/dist/bundle/chunk-LA3YU4K7.js +40 -0
  69. package/dist/bundle/{chunk-ECEZOLOD.js → chunk-LKSNISYV.js} +4 -4
  70. package/dist/bundle/{chunk-5K7QLJMM.js → chunk-LT5KE44Q.js} +226 -226
  71. package/dist/bundle/chunk-M763RNWP.js +733 -0
  72. package/dist/bundle/chunk-M7XLG6AN.js +353 -0
  73. package/dist/bundle/{chunk-IMJQRPLN.js → chunk-NNMU2TDU.js} +1 -1
  74. package/dist/bundle/chunk-NTQBS2JL.js +52 -0
  75. package/dist/bundle/{chunk-HCAZV5NP.js → chunk-NZGI74GS.js} +6 -6
  76. package/dist/bundle/{chunk-W7HM2VGO.js → chunk-O3VM5PTJ.js} +1 -1
  77. package/dist/bundle/chunk-OPVNUI4M.js +195 -0
  78. package/dist/bundle/{chunk-7ELMWE3P.js → chunk-PHXOL5HZ.js} +176 -160
  79. package/dist/bundle/{chunk-5D4AEUVA.js → chunk-PL5P7UKW.js} +434 -1
  80. package/dist/bundle/{chunk-B3MANLNK.js → chunk-PLRUUXK7.js} +19 -233
  81. package/dist/bundle/{chunk-RR5MX5TM.js → chunk-PMP37KLR.js} +4 -4
  82. package/dist/bundle/{chunk-FTFV3HFW.js → chunk-Q27QAB4X.js} +9 -9
  83. package/dist/bundle/{chunk-2TWQIWWG.js → chunk-QFZD6MTF.js} +35 -29
  84. package/dist/bundle/{chunk-2QZK5BEP.js → chunk-RVWGFD32.js} +30 -15
  85. package/dist/bundle/{chunk-MVA5HVKL.js → chunk-S4UUN6LD.js} +18 -0
  86. package/dist/bundle/{chunk-QGFX5MXL.js → chunk-SEELWPRD.js} +9 -9
  87. package/dist/bundle/{chunk-SAKK2YRU.js → chunk-SMTTIKZ5.js} +12 -12
  88. package/dist/bundle/{chunk-X7XUX7A4.js → chunk-TDQJS3JG.js} +10 -10
  89. package/dist/bundle/{chunk-HC5ZWE5X.js → chunk-TIHDBKA7.js} +2 -2
  90. package/dist/bundle/{chunk-NHHJHXMQ.js → chunk-U6XA3OOM.js} +2 -2
  91. package/dist/bundle/{chunk-NXERIDPJ.js → chunk-VQEAZXTV.js} +7 -7
  92. package/dist/bundle/{chunk-P5BHKKBI.js → chunk-VW5F6FK3.js} +4 -4
  93. package/dist/bundle/{chunk-XRREFEIW.js → chunk-WCQW4GYO.js} +7 -7
  94. package/dist/bundle/{chunk-H3TNVEQX.js → chunk-WGBVRDY3.js} +29 -4
  95. package/dist/bundle/chunk-WRCKE5ND.js +80 -0
  96. package/dist/bundle/{chunk-TBJYLC5K.js → chunk-X5S5KUSU.js} +75 -75
  97. package/dist/bundle/command-contract-R2FGN7CQ.js +40 -0
  98. package/dist/bundle/{command-server-entry-DJKVVZCQ.js → command-server-entry-GJSMDSNE.js} +29 -29
  99. package/dist/bundle/{decode-FC65Y4IV.js → decode-6PLXHVHW.js} +6 -6
  100. package/dist/bundle/{dispatch-KOISQ5QJ.js → dispatch-TAQ7635E.js} +8 -8
  101. package/dist/bundle/{dist-MYZZKZJ7.js → dist-7TGU56B2.js} +1 -1
  102. package/dist/bundle/dist-PAKDDIBT.js +191 -0
  103. package/dist/bundle/{echarts-FVTUDXDU.js → echarts-UZ7QLRE2.js} +2 -2
  104. package/dist/bundle/{embed-VNBZFPYH.js → embed-AWLL4EBF.js} +7 -7
  105. package/dist/bundle/{embedder-6U4NOFRO.js → embedder-MM225YJ6.js} +10 -10
  106. package/dist/bundle/{failure-FZ6VYKEQ.js → failure-MR2XVHFP.js} +3 -3
  107. package/dist/bundle/first-run-MAUI6QJ7.js +29 -0
  108. package/dist/bundle/first-screen-SCDV7TXT.js +40 -0
  109. package/dist/bundle/hubspot.js +26 -26
  110. package/dist/bundle/{instructions-HET7BCYK.js → instructions-ZJ7U3QUE.js} +1 -1
  111. package/dist/bundle/{mcp-RGNRW77S.js → mcp-CNV7F2XZ.js} +2 -2
  112. package/dist/bundle/meeting-combined-EL5XZIJ5.js +25 -0
  113. package/dist/bundle/meeting-model-OYXB2NOE.js +25 -0
  114. package/dist/bundle/{meeting-semantic-JY3OGCBS.js → meeting-semantic-S3DBB7XD.js} +7 -7
  115. package/dist/bundle/{node-CXZIFHZC.js → node-HGCZGZ4R.js} +2 -2
  116. package/dist/bundle/{node-sqlite-P3O7XN7Q.js → node-sqlite-RKYSRKEB.js} +8 -8
  117. package/dist/bundle/oauth-PYDCAQ7Y.js +20 -0
  118. package/dist/bundle/{open-F4P6YV54.js → open-UCDSQUN2.js} +6 -6
  119. package/dist/bundle/{openai-4AICLIK3.js → openai-Y4F5ZC7O.js} +16 -16
  120. package/dist/bundle/{process-5RUXWGYS.js → process-P7FB7YO7.js} +1 -1
  121. package/dist/bundle/{program-POG5GHUQ.js → program-2D5D32HK.js} +835 -261
  122. package/dist/bundle/{prompt-NFMDVBZ4.js → prompt-E5TKZ37Q.js} +6 -6
  123. package/dist/bundle/{recognize-DKN3RY4V.js → recognize-5NYPTSLT.js} +5 -5
  124. package/dist/bundle/{remote-6QHAGQWY.js → remote-U4LUAHF2.js} +10 -10
  125. package/dist/bundle/{rerank-M4KHEHUZ.js → rerank-AJAVKK5L.js} +8 -8
  126. package/dist/bundle/{schemas-JRL3DLMP.js → schemas-QLQ2K6DL.js} +7 -33
  127. package/dist/bundle/{serve-DNU43ND6.js → serve-4UJ3R5IP.js} +11 -11
  128. package/dist/bundle/server-CN6VQNNF.js +86 -0
  129. package/dist/bundle/{server-XJSNF3K5.js → server-OJPCTV77.js} +73 -61
  130. package/dist/bundle/{source-A3SBLHC4.js → source-VHDK74YS.js} +133 -399
  131. package/dist/bundle/{sqlite-runtime-EMQAC63N.js → sqlite-runtime-KLEA4XAU.js} +7 -7
  132. package/dist/bundle/{state-T45CX7VY.js → state-COGSYMVH.js} +7 -7
  133. package/dist/bundle/{store-6TZ2FCVA.js → store-BJXCSP26.js} +25 -24
  134. package/dist/bundle/store-HXA2MRWI.js +32 -0
  135. package/dist/bundle/{store-6LCEVBAZ.js → store-V5UMSWK4.js} +27 -22
  136. package/dist/bundle/store-maintenance-command-AC7GGLYC.js +73 -0
  137. package/dist/bundle/surface-ZZNG3OW2.js +72 -0
  138. package/dist/bundle/writer-CZYA657G.js +86 -0
  139. package/dist/commands/api.d.ts +4 -4
  140. package/dist/commands/api.d.ts.map +1 -1
  141. package/dist/commands/api.js +12 -7
  142. package/dist/commands/api.js.map +1 -1
  143. package/dist/commands/crm-shared.d.ts +2 -2
  144. package/dist/commands/crm-shared.d.ts.map +1 -1
  145. package/dist/commands/crm-shared.js +20 -4
  146. package/dist/commands/crm-shared.js.map +1 -1
  147. package/dist/config.d.ts +46 -8
  148. package/dist/config.d.ts.map +1 -1
  149. package/dist/config.js +133 -12
  150. package/dist/config.js.map +1 -1
  151. package/dist/context.d.ts +2 -2
  152. package/dist/context.d.ts.map +1 -1
  153. package/dist/context.js +1 -1
  154. package/dist/context.js.map +1 -1
  155. package/dist/crm/source.d.ts +7 -2
  156. package/dist/crm/source.d.ts.map +1 -1
  157. package/dist/crm/source.js +26 -29
  158. package/dist/crm/source.js.map +1 -1
  159. package/dist/crm/writer.d.ts +15 -0
  160. package/dist/crm/writer.d.ts.map +1 -0
  161. package/dist/crm/writer.js +199 -0
  162. package/dist/crm/writer.js.map +1 -0
  163. package/dist/generated/manifest.d.ts.map +1 -1
  164. package/dist/generated/manifest.js +6 -116
  165. package/dist/generated/manifest.js.map +1 -1
  166. package/dist/generated/types.d.ts +160 -0
  167. package/dist/generated/types.d.ts.map +1 -1
  168. package/dist/hubspot/transport.d.ts +6 -1
  169. package/dist/hubspot/transport.d.ts.map +1 -1
  170. package/dist/hubspot/transport.js +13 -5
  171. package/dist/hubspot/transport.js.map +1 -1
  172. package/dist/identity.js +3 -3
  173. package/dist/identity.js.map +1 -1
  174. package/dist/program.d.ts.map +1 -1
  175. package/dist/program.js +2 -1
  176. package/dist/program.js.map +1 -1
  177. package/dist/setup/texts.en.json +3 -3
  178. package/dist/setup/texts.es.json +3 -3
  179. package/dist/setup/texts.ru.json +3 -3
  180. package/dist/version.d.ts +1 -1
  181. package/dist/version.js +1 -1
  182. package/package.json +4 -4
  183. package/skills/hubspot-cli/SKILL.md +13 -8
  184. package/skills/hubspot-cli/references/api/api-advanced.md +51 -0
  185. package/skills/hubspot-cli/references/api/api-basic.md +602 -0
  186. package/skills/hubspot-cli/references/api/api-batch.md +575 -0
  187. package/skills/hubspot-cli/references/api.md +3 -2
  188. package/dist/bundle/command-contract-C6CBFXZF.js +0 -40
  189. package/dist/bundle/first-run-RPIJZEDT.js +0 -29
  190. package/dist/bundle/first-screen-RTVMGHAE.js +0 -40
  191. package/dist/bundle/meeting-combined-L5AGBPYX.js +0 -25
  192. package/dist/bundle/meeting-model-NTB4RK3F.js +0 -25
  193. package/dist/bundle/oauth-HNCY4B2S.js +0 -20
  194. package/dist/bundle/server-C3ZHA7AZ.js +0 -77
  195. package/dist/bundle/store-CCDNUB6A.js +0 -32
  196. package/dist/bundle/store-maintenance-command-BRCG6MNA.js +0 -68
  197. package/dist/commands/comments.d.ts +0 -3
  198. package/dist/commands/comments.d.ts.map +0 -1
  199. package/dist/commands/comments.js +0 -114
  200. package/dist/commands/comments.js.map +0 -1
  201. package/dist/sample/comments.d.ts +0 -61
  202. package/dist/sample/comments.d.ts.map +0 -1
  203. package/dist/sample/comments.js +0 -39
  204. package/dist/sample/comments.js.map +0 -1
  205. package/dist/sample/records.d.ts +0 -16
  206. package/dist/sample/records.d.ts.map +0 -1
  207. package/dist/sample/records.js +0 -22
  208. package/dist/sample/records.js.map +0 -1
  209. package/dist/sample/transport.d.ts +0 -42
  210. package/dist/sample/transport.d.ts.map +0 -1
  211. package/dist/sample/transport.js +0 -153
  212. package/dist/sample/transport.js.map +0 -1
@@ -1,8 +1,11 @@
1
1
  import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
- PROVIDER
5
- } from "./chunk-VIEYMDBR.js";
4
+ HUBSPOT_WRITES
5
+ } from "./chunk-OPVNUI4M.js";
6
+ import {
7
+ accountDetails
8
+ } from "./chunk-77CUE3VX.js";
6
9
  import {
7
10
  LONGEST_PACE_WAIT_MS,
8
11
  PACE,
@@ -10,10 +13,10 @@ import {
10
13
  REPORT_FORMAT,
11
14
  SECTION_CAPS,
12
15
  SERVICE,
13
- accountDetails,
14
16
  accountRemoveCommand,
15
17
  appDoctorCommand,
16
18
  appMcpCommand,
19
+ commandLevel,
17
20
  commandsCommand,
18
21
  configCommand,
19
22
  createProgram,
@@ -34,95 +37,114 @@ import {
34
37
  skillCommand,
35
38
  upgradeCommand,
36
39
  writeCsv
37
- } from "./chunk-WQBX7XYP.js";
38
- import "./chunk-DRWWJLI6.js";
40
+ } from "./chunk-CYADK744.js";
41
+ import "./chunk-O3VM5PTJ.js";
42
+ import {
43
+ PROVIDER
44
+ } from "./chunk-J6C2QWL5.js";
45
+ import "./chunk-7NZT7Y55.js";
39
46
  import {
40
47
  SOURCE_SEARCHED,
41
48
  allAnswer,
42
49
  historySkipsOf,
43
50
  offsetOf,
44
51
  refuseOffline
45
- } from "./chunk-2TWQIWWG.js";
46
- import "./chunk-X2M6NIQG.js";
47
- import "./chunk-W7HM2VGO.js";
48
- import "./chunk-B3MANLNK.js";
52
+ } from "./chunk-QFZD6MTF.js";
53
+ import "./chunk-PLRUUXK7.js";
54
+ import "./chunk-3R4KRNUZ.js";
55
+ import "./chunk-HPZRUY6S.js";
49
56
  import {
50
57
  addStoreMaintenanceCommands
51
- } from "./chunk-JRCPCVPI.js";
58
+ } from "./chunk-DQP2GAAO.js";
52
59
  import {
53
60
  commandPathKey,
54
61
  commandPermissions,
55
62
  terminalAsker
56
- } from "./chunk-BKXDHU3G.js";
63
+ } from "./chunk-3WIVJJNB.js";
64
+ import "./chunk-M7XLG6AN.js";
65
+ import "./chunk-VQEAZXTV.js";
66
+ import "./chunk-SMTTIKZ5.js";
67
+ import "./chunk-BN22EKQQ.js";
68
+ import "./chunk-NTQBS2JL.js";
69
+ import "./chunk-B2W3C4N6.js";
70
+ import "./chunk-AVUMH42T.js";
57
71
  import {
72
+ CRM_ASSIGN_OTHERS_KEY,
73
+ CRM_WRITE_DEFAULTS,
74
+ CRM_WRITE_KEYS,
58
75
  Pacer,
59
76
  RECORD_ID,
60
77
  SYNCED_FROM,
61
78
  SYNC_FAILED,
62
79
  closeCrmItem,
63
- commandPath,
64
80
  conditionsOf,
65
81
  createCrmItem,
66
82
  createCrmRecord,
67
83
  crmAccounts,
84
+ crmAlsoChecks,
68
85
  crmStatus,
69
86
  crmViewerOf,
70
87
  customConditions,
71
88
  customNames,
72
- dateWindow,
89
+ extractText,
73
90
  fieldPairsOf,
74
91
  filterableFields,
75
92
  foreignContacts,
76
93
  foreignContactsPathFor,
77
- listQuery,
94
+ importEngine,
78
95
  meaningLane,
79
96
  moveCrmItem,
80
- nativeField,
81
- nativeTerms,
82
97
  ownerOf,
83
98
  pacePathFor,
99
+ parseCrmFileId,
84
100
  personMeetings,
85
101
  pipelineOf,
86
- queryTerms,
87
102
  readableAccounts,
88
103
  removeCrmItem,
89
104
  searchAll,
90
- searchText,
91
105
  selectedCodes,
92
106
  shortened,
93
107
  syncRecorded,
94
108
  taskAccount,
95
- termField,
96
- timeBounds,
97
- typedQuery,
98
- unfilteredQuery,
99
109
  updateCrmItem,
100
110
  updateCrmRecord,
101
111
  viewerOf,
102
112
  wantedCodes,
103
113
  withCustomFields,
104
- withQuery,
105
114
  withReadableDeal
106
- } from "./chunk-ZBDSHFG4.js";
107
- import "./chunk-2QZK5BEP.js";
108
- import "./chunk-NXERIDPJ.js";
109
- import "./chunk-WE4UFASG.js";
110
- import "./chunk-SAKK2YRU.js";
115
+ } from "./chunk-JG7YMHNB.js";
116
+ import {
117
+ safeName
118
+ } from "./chunk-RVWGFD32.js";
119
+ import "./chunk-LA3YU4K7.js";
120
+ import "./chunk-ABXVU5O4.js";
111
121
  import {
112
122
  latestVersion,
113
123
  runUpdate,
114
124
  updateNotice
115
- } from "./chunk-RR5MX5TM.js";
116
- import "./chunk-CWXOXIWS.js";
117
- import "./chunk-JLDBMEKZ.js";
118
- import "./chunk-E5WLE7BM.js";
119
- import "./chunk-N2XADGL4.js";
120
- import "./chunk-FOZYMDRL.js";
121
- import "./chunk-QU25DA5N.js";
122
- import "./chunk-TKVL2C3B.js";
123
- import "./chunk-O55RWNSH.js";
124
- import "./chunk-24ERVFJP.js";
125
- import "./chunk-NWHEHV3K.js";
125
+ } from "./chunk-PMP37KLR.js";
126
+ import "./chunk-5K3FGXZH.js";
127
+ import {
128
+ commandPath,
129
+ dateWindow,
130
+ listQuery,
131
+ nativeField,
132
+ nativeTerms,
133
+ queryTerms,
134
+ searchText,
135
+ termField,
136
+ timeBounds,
137
+ typedQuery,
138
+ unfilteredQuery,
139
+ withQuery
140
+ } from "./chunk-M763RNWP.js";
141
+ import "./chunk-2A64XS22.js";
142
+ import "./chunk-2NCO4E4T.js";
143
+ import "./chunk-5AYKCKSE.js";
144
+ import "./chunk-E4X7JAFC.js";
145
+ import "./chunk-A6UFH3QU.js";
146
+ import "./chunk-5YNAVVCW.js";
147
+ import "./chunk-EMOVVERN.js";
126
148
  import {
127
149
  Argument,
128
150
  Command,
@@ -166,59 +188,64 @@ import {
166
188
  sharedCommand,
167
189
  snakeKeys,
168
190
  snakeKeysKeeping
169
- } from "./chunk-7ELMWE3P.js";
170
- import "./chunk-PVKF24ZW.js";
171
- import "./chunk-NUU4WZVL.js";
172
- import "./chunk-2VGZRYEH.js";
173
- import "./chunk-W53EJOFQ.js";
174
- import "./chunk-RMIYKDUL.js";
175
- import "./chunk-LOBVOGOE.js";
191
+ } from "./chunk-PHXOL5HZ.js";
192
+ import "./chunk-FIVD4HM4.js";
193
+ import "./chunk-EE4JSYGZ.js";
194
+ import "./chunk-ARTJLL7W.js";
195
+ import "./chunk-IXZLMFPO.js";
196
+ import "./chunk-JK2SNLU5.js";
197
+ import "./chunk-3DIXAEGH.js";
176
198
  import {
177
199
  CRM_CHANGES,
178
200
  CRM_SCOPES,
201
+ MAX_TEXT_CHARS,
202
+ attachmentMaxBytes,
203
+ crmIdentityId,
179
204
  crmSettingKey,
180
- dayIn,
181
205
  seenBy,
182
206
  viewerSql
183
- } from "./chunk-36ITRDYY.js";
184
- import "./chunk-C32AKHTY.js";
185
- import "./chunk-FTFV3HFW.js";
207
+ } from "./chunk-7LQRXVQ3.js";
208
+ import "./chunk-7UEL65GQ.js";
209
+ import {
210
+ dayIn
211
+ } from "./chunk-WRCKE5ND.js";
212
+ import "./chunk-Q27QAB4X.js";
186
213
  import {
187
214
  count,
188
215
  createTaskService,
189
216
  text,
190
217
  time
191
- } from "./chunk-CLAN3FES.js";
192
- import "./chunk-UUMUL4L3.js";
193
- import "./chunk-SDQGB4KB.js";
218
+ } from "./chunk-IBTMK5KD.js";
219
+ import "./chunk-DW23LM47.js";
220
+ import "./chunk-L433IDOX.js";
194
221
  import {
195
222
  hostFetch,
196
223
  retrying
197
- } from "./chunk-XRREFEIW.js";
198
- import "./chunk-TI46WQXQ.js";
199
- import "./chunk-E52JAS35.js";
200
- import "./chunk-5GBUCHRU.js";
224
+ } from "./chunk-WCQW4GYO.js";
225
+ import "./chunk-4DNHXRCJ.js";
226
+ import "./chunk-BAUK2MD5.js";
227
+ import "./chunk-KO4VR5NK.js";
201
228
  import {
202
229
  DESKTOP,
203
230
  IDENTITY,
204
231
  PACKAGE,
205
232
  SKILL
206
- } from "./chunk-X7XUX7A4.js";
207
- import "./chunk-H3TNVEQX.js";
208
- import "./chunk-HC5ZWE5X.js";
209
- import "./chunk-QGFX5MXL.js";
233
+ } from "./chunk-TDQJS3JG.js";
234
+ import "./chunk-TIHDBKA7.js";
210
235
  import "./chunk-EH6ZEJGT.js";
236
+ import "./chunk-WGBVRDY3.js";
237
+ import "./chunk-SEELWPRD.js";
211
238
  import {
212
239
  installerOf
213
- } from "./chunk-O3DYRCIT.js";
240
+ } from "./chunk-3I2FGNWO.js";
214
241
  import {
215
242
  fieldsOf
216
- } from "./chunk-2VGD63G6.js";
243
+ } from "./chunk-3TEFE6YU.js";
217
244
  import {
218
245
  foldName
219
- } from "./chunk-5A6ZYNAQ.js";
220
- import "./chunk-43EKCUBJ.js";
221
- import "./chunk-HZRQLAHO.js";
246
+ } from "./chunk-IQ2XZ62J.js";
247
+ import "./chunk-JP2HJXFO.js";
248
+ import "./chunk-DQB5JMTY.js";
222
249
  import {
223
250
  CRM_ACTIVITY_KINDS,
224
251
  CRM_KINDS,
@@ -226,39 +253,41 @@ import {
226
253
  DEAL_STATUSES,
227
254
  formatDecimal,
228
255
  groupDigits,
256
+ normalCrmUserId,
229
257
  parseDecimal,
230
258
  scaleOf
231
- } from "./chunk-QJW35N5V.js";
232
- import "./chunk-IMJQRPLN.js";
233
- import "./chunk-DSP36YHQ.js";
259
+ } from "./chunk-GC6FLHZF.js";
260
+ import "./chunk-NNMU2TDU.js";
261
+ import "./chunk-CBCEMFCF.js";
234
262
  import {
235
263
  SAVE_HELP,
236
264
  defineQuery,
237
265
  queryFieldsOf,
238
266
  timezoneOf,
239
267
  zonedMoment
240
- } from "./chunk-5K7QLJMM.js";
241
- import "./chunk-FPUGMDJV.js";
268
+ } from "./chunk-LT5KE44Q.js";
269
+ import "./chunk-DSRXCLPO.js";
242
270
  import "./chunk-D72URWJE.js";
243
271
  import {
244
272
  readSecret
245
- } from "./chunk-DBEQI5YM.js";
246
- import "./chunk-PPHBRESD.js";
247
- import "./chunk-65TWQ7BV.js";
248
- import "./chunk-HCAZV5NP.js";
249
- import "./chunk-DFCHHR5M.js";
273
+ } from "./chunk-ITGNDZRR.js";
274
+ import "./chunk-KVXEEKBB.js";
275
+ import "./chunk-3PEKYGZ3.js";
276
+ import "./chunk-NZGI74GS.js";
277
+ import "./chunk-JUKAIXKY.js";
250
278
  import {
251
279
  renderPretty,
252
280
  resolvePaths
253
- } from "./chunk-TBJYLC5K.js";
281
+ } from "./chunk-X5S5KUSU.js";
254
282
  import {
255
283
  isoTime
256
- } from "./chunk-TOSCB4SO.js";
284
+ } from "./chunk-J5P5VSRG.js";
257
285
  import {
258
286
  array,
259
287
  boolean,
260
288
  literal,
261
289
  nullable,
290
+ number,
262
291
  optional,
263
292
  picklist,
264
293
  record,
@@ -267,22 +296,22 @@ import {
267
296
  union,
268
297
  unknown,
269
298
  variant
270
- } from "./chunk-MVA5HVKL.js";
299
+ } from "./chunk-S4UUN6LD.js";
271
300
  import "./chunk-Y5E2WNWB.js";
272
301
  import {
273
302
  CliError,
274
303
  isCliError
275
- } from "./chunk-DB2XKHI4.js";
276
- import "./chunk-TP7GDWVF.js";
304
+ } from "./chunk-BUGROVF3.js";
305
+ import "./chunk-GRFICQTZ.js";
277
306
  import {
278
307
  __export,
279
308
  __name
280
309
  } from "./chunk-ZVVMGPBJ.js";
281
310
 
282
311
  // dist/program.js
283
- import { join as join3 } from "node:path";
312
+ import { join as join4 } from "node:path";
284
313
 
285
- // node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/update/index.js
314
+ // node_modules/.pnpm/@wirecat+cli-core@0.699.0_@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typ_13ea275dd452fd1070c59d86b8d8c388/node_modules/@wirecat/cli-core/dist/update/index.js
286
315
  import { realpathSync } from "node:fs";
287
316
  import { fileURLToPath } from "node:url";
288
317
  var npmRegistry = /* @__PURE__ */ __name(() => hostFetch({ hosts: ["registry.npmjs.org"] }), "npmRegistry");
@@ -372,7 +401,6 @@ var operations = [
372
401
  summary: "Retrieve contacts",
373
402
  description: "Retrieve all contacts, using query parameters to specify the information that gets returned.",
374
403
  tags: ["Basic"],
375
- security: [],
376
404
  pagination: {
377
405
  style: "cursor",
378
406
  cursor: {
@@ -471,7 +499,6 @@ var operations = [
471
499
  summary: "Create a contact",
472
500
  description: "Create a single contact. Include a `properties` object to define [property values](https://developers.hubspot.com/docs/guides/api/crm/properties) for the contact, along with an `associations` array to define [associations](https://developers.hubspot.com/docs/guides/api/crm/associations/associations-v4) with other CRM records.",
473
501
  tags: ["Basic"],
474
- security: [],
475
502
  parameters: [],
476
503
  request: {
477
504
  required: true,
@@ -495,7 +522,6 @@ var operations = [
495
522
  summary: "Archive a batch of contacts",
496
523
  description: "Archive a batch of contacts by ID. Archived contacts can be restored within 90 days of deletion. Learn more about the [data impacted by contact deletions](https://knowledge.hubspot.com/privacy-and-consent/understand-restorable-and-permanent-contact-deletions) and how to [restore archived records](https://knowledge.hubspot.com/records/restore-deleted-records).",
497
524
  tags: ["Batch"],
498
- security: [],
499
525
  permissions: [
500
526
  {
501
527
  key: "people.delete"
@@ -520,7 +546,6 @@ var operations = [
520
546
  summary: "Create a batch of contacts",
521
547
  description: "Create a batch of contacts. The `inputs` array can contain a `properties` object to define property values for each record, along with an `associations` array to define [associations](https://developers.hubspot.com/docs/guides/api/crm/associations/associations-v4) with other CRM records.",
522
548
  tags: ["Batch"],
523
- security: [],
524
549
  parameters: [],
525
550
  request: {
526
551
  required: true,
@@ -544,7 +569,6 @@ var operations = [
544
569
  summary: "Retrieve a batch of contacts",
545
570
  description: "Retrieve a batch of contacts by ID (`contactId`) or unique property value (`idProperty`). ",
546
571
  tags: ["Batch"],
547
- security: [],
548
572
  parameters: [
549
573
  {
550
574
  name: "archived",
@@ -579,7 +603,6 @@ var operations = [
579
603
  summary: "Update a batch of contacts",
580
604
  description: "Update a batch of contacts by ID (`contactId`) or unique property value (`idProperty`). Provided property values will be overwritten. Read-only and non-existent properties will result in an error. Properties values can be cleared by passing an empty string.",
581
605
  tags: ["Batch"],
582
- security: [],
583
606
  parameters: [],
584
607
  request: {
585
608
  required: true,
@@ -603,7 +626,6 @@ var operations = [
603
626
  summary: "Create or update a batch of contacts",
604
627
  description: "Upsert a batch of contacts. The `inputs` array can contain a `properties` object to define property values for each record.",
605
628
  tags: ["Batch"],
606
- security: [],
607
629
  parameters: [],
608
630
  request: {
609
631
  required: true,
@@ -627,7 +649,6 @@ var operations = [
627
649
  summary: "Permanently delete a contact (GDPR-compliant)",
628
650
  description: "Permanently delete a contact and all associated content to follow GDPR. Use optional property `idProperty` set to `email` to identify contact by email address. If email address is not found, the email address will be added to a blocklist and prevent it from being used in the future. Learn more about [permanently deleting contacts](https://knowledge.hubspot.com/privacy-and-consent/how-do-i-perform-a-gdpr-delete-in-hubspot).",
629
651
  tags: ["Advanced"],
630
- security: [],
631
652
  permissions: [
632
653
  {
633
654
  key: "people.delete"
@@ -652,7 +673,6 @@ var operations = [
652
673
  summary: "Merge two contacts",
653
674
  description: "Merge two contact records. Learn more about [merging records](https://knowledge.hubspot.com/records/merge-records). ",
654
675
  tags: ["Advanced"],
655
- security: [],
656
676
  permissions: [
657
677
  {
658
678
  key: "people.delete"
@@ -681,7 +701,6 @@ var operations = [
681
701
  summary: "Search for contacts",
682
702
  description: "Search for contacts by filtering on properties, searching through associations, and sorting results. Learn more about [CRM search](https://developers.hubspot.com/docs/guides/api/crm/search#make-a-search-request).",
683
703
  tags: ["Search"],
684
- security: [],
685
704
  pagination: {
686
705
  style: "cursor",
687
706
  cursor: {
@@ -718,7 +737,6 @@ var operations = [
718
737
  summary: "Retrieve a contact",
719
738
  description: "Retrieve a contact by its ID (`contactId`) or by a unique property (`idProperty`). You can specify what is returned using the `properties` query parameter.",
720
739
  tags: ["Basic"],
721
- security: [],
722
740
  parameters: [
723
741
  {
724
742
  name: "contactId",
@@ -802,7 +820,6 @@ var operations = [
802
820
  summary: "Update a contact",
803
821
  description: "Update an existing contact, identified by ID or email/unique property value. To identify a contact by ID, include the ID in the request URL path. To identify a contact by their email or other unique property, include the email/property value in the request URL path, and add the `idProperty` query parameter (`/crm/v3/objects/contacts/jon@website.com?idProperty=email`). Provided property values will be overwritten. Read-only and non-existent properties will result in an error. Properties values can be cleared by passing an empty string.",
804
822
  tags: ["Basic"],
805
- security: [],
806
823
  parameters: [
807
824
  {
808
825
  name: "contactId",
@@ -845,7 +862,6 @@ var operations = [
845
862
  summary: "Archive a contact",
846
863
  description: "Delete a contact by ID. Deleted contacts can be restored within 90 days of deletion. Learn more about the [data impacted by contact deletions](https://knowledge.hubspot.com/privacy-and-consent/understand-restorable-and-permanent-contact-deletions) and how to [restore archived records](https://knowledge.hubspot.com/records/restore-deleted-records).",
847
864
  tags: ["Basic"],
848
- security: [],
849
865
  permissions: [
850
866
  {
851
867
  key: "people.delete"
@@ -1034,7 +1050,6 @@ var operations = [
1034
1050
  summary: "Retrieve companies",
1035
1051
  description: "Retrieve all companies, using query parameters to control the information that gets returned.",
1036
1052
  tags: ["Basic"],
1037
- security: [],
1038
1053
  pagination: {
1039
1054
  style: "cursor",
1040
1055
  cursor: {
@@ -1133,7 +1148,6 @@ var operations = [
1133
1148
  summary: "Create a company",
1134
1149
  description: "Create a single company. Include a `properties` object to define [property values](https://developers.hubspot.com/docs/guides/api/crm/properties) for the company, along with an `associations` array to define [associations](https://developers.hubspot.com/docs/guides/api/crm/associations/associations-v4) with other CRM records.",
1135
1150
  tags: ["Basic"],
1136
- security: [],
1137
1151
  parameters: [],
1138
1152
  request: {
1139
1153
  required: true,
@@ -1157,7 +1171,6 @@ var operations = [
1157
1171
  summary: "Archive a batch of companies",
1158
1172
  description: "Delete a batch of companies by ID. Deleted companies can be restored within 90 days of deletion. Learn more about [restoring records](https://knowledge.hubspot.com/records/restore-deleted-records).",
1159
1173
  tags: ["Batch"],
1160
- security: [],
1161
1174
  permissions: [
1162
1175
  {
1163
1176
  key: "organizations.delete"
@@ -1182,7 +1195,6 @@ var operations = [
1182
1195
  summary: "Create a batch of companies",
1183
1196
  description: "Create a batch of companies. The `inputs` array can contain a `properties` object to define property values for each company, along with an `associations` array to define [associations](https://developers.hubspot.com/docs/guides/api/crm/associations/associations-v4) with other CRM records.",
1184
1197
  tags: ["Batch"],
1185
- security: [],
1186
1198
  parameters: [],
1187
1199
  request: {
1188
1200
  required: true,
@@ -1206,7 +1218,6 @@ var operations = [
1206
1218
  summary: "Retrieve a batch of companies",
1207
1219
  description: "Retrieve a batch of companies by ID (`companyId`) or by a unique property (`idProperty`). You can specify what is returned using the `properties` query parameter.",
1208
1220
  tags: ["Batch"],
1209
- security: [],
1210
1221
  parameters: [
1211
1222
  {
1212
1223
  name: "archived",
@@ -1241,7 +1252,6 @@ var operations = [
1241
1252
  summary: "Update a batch of companies",
1242
1253
  description: "Update a batch of companies by ID.",
1243
1254
  tags: ["Batch"],
1244
- security: [],
1245
1255
  parameters: [],
1246
1256
  request: {
1247
1257
  required: true,
@@ -1265,7 +1275,6 @@ var operations = [
1265
1275
  summary: "Create or update a batch of companies by unique property values",
1266
1276
  description: "Create or update companies identified by a unique property value as specified by the `idProperty` query parameter. `idProperty` query param refers to a property whose values are unique for the object.",
1267
1277
  tags: ["Batch"],
1268
- security: [],
1269
1278
  parameters: [],
1270
1279
  request: {
1271
1280
  required: true,
@@ -1289,7 +1298,6 @@ var operations = [
1289
1298
  summary: "Merge two companies",
1290
1299
  description: "Merge two company records. Learn more about [merging records](https://knowledge.hubspot.com/records/merge-records).",
1291
1300
  tags: ["Advanced"],
1292
- security: [],
1293
1301
  permissions: [
1294
1302
  {
1295
1303
  key: "organizations.delete"
@@ -1318,7 +1326,6 @@ var operations = [
1318
1326
  summary: "Search for companies",
1319
1327
  description: "Search for companies by filtering on properties, searching through associations, and sorting results. Learn more about [CRM search](https://developers.hubspot.com/docs/guides/api/crm/search#make-a-search-request).",
1320
1328
  tags: ["Search"],
1321
- security: [],
1322
1329
  pagination: {
1323
1330
  style: "cursor",
1324
1331
  cursor: {
@@ -1355,7 +1362,6 @@ var operations = [
1355
1362
  summary: "Retrieve a company",
1356
1363
  description: "Retrieve a company by its ID (`companyId`) or by a unique property (`idProperty`). You can specify what is returned using the `properties` query parameter.",
1357
1364
  tags: ["Basic"],
1358
- security: [],
1359
1365
  parameters: [
1360
1366
  {
1361
1367
  name: "companyId",
@@ -1439,7 +1445,6 @@ var operations = [
1439
1445
  summary: "Update a company",
1440
1446
  description: "Update a company by ID (`companyId`) or unique property value (`idProperty`). Provided property values will be overwritten. Read-only and non-existent properties will result in an error. Properties values can be cleared by passing an empty string.",
1441
1447
  tags: ["Basic"],
1442
- security: [],
1443
1448
  parameters: [
1444
1449
  {
1445
1450
  name: "companyId",
@@ -1482,7 +1487,6 @@ var operations = [
1482
1487
  summary: "Archive a company",
1483
1488
  description: "Delete a company by ID. Deleted companies can be restored within 90 days of deletion. Learn more about [restoring records](https://knowledge.hubspot.com/records/restore-deleted-records).",
1484
1489
  tags: ["Basic"],
1485
- security: [],
1486
1490
  permissions: [
1487
1491
  {
1488
1492
  key: "organizations.delete"
@@ -1512,7 +1516,6 @@ var operations = [
1512
1516
  summary: "List",
1513
1517
  description: "Read a page of deals. Control what is returned via the `properties` query param.",
1514
1518
  tags: ["Basic"],
1515
- security: [],
1516
1519
  pagination: {
1517
1520
  style: "cursor",
1518
1521
  cursor: {
@@ -1611,7 +1614,6 @@ var operations = [
1611
1614
  summary: "Create",
1612
1615
  description: "Create a deal with the given properties and return a copy of the object, including the ID. Documentation and examples for creating standard deals is provided.",
1613
1616
  tags: ["Basic"],
1614
- security: [],
1615
1617
  parameters: [],
1616
1618
  request: {
1617
1619
  required: true,
@@ -1635,7 +1637,6 @@ var operations = [
1635
1637
  summary: "Archive a batch of deals by ID",
1636
1638
  description: "Archive multiple deals using their IDs.",
1637
1639
  tags: ["Batch"],
1638
- security: [],
1639
1640
  permissions: [
1640
1641
  {
1641
1642
  key: "deals.delete"
@@ -1660,7 +1661,6 @@ var operations = [
1660
1661
  summary: "Create a batch of deals",
1661
1662
  description: "Create multiple deals in a single request.",
1662
1663
  tags: ["Batch"],
1663
- security: [],
1664
1664
  parameters: [],
1665
1665
  request: {
1666
1666
  required: true,
@@ -1684,7 +1684,6 @@ var operations = [
1684
1684
  summary: "Read a batch of deals by internal ID, or unique property values",
1685
1685
  description: "Retrieve records by record ID or include the `idProperty` parameter to retrieve records by a custom unique value property. ",
1686
1686
  tags: ["Batch"],
1687
- security: [],
1688
1687
  parameters: [
1689
1688
  {
1690
1689
  name: "archived",
@@ -1719,7 +1718,6 @@ var operations = [
1719
1718
  summary: "Update a batch of deals by internal ID, or unique property values",
1720
1719
  description: "Update multiple deals using their internal IDs or unique property values.",
1721
1720
  tags: ["Batch"],
1722
- security: [],
1723
1721
  parameters: [],
1724
1722
  request: {
1725
1723
  required: true,
@@ -1743,7 +1741,6 @@ var operations = [
1743
1741
  summary: "Create or update a batch of deals by unique property values",
1744
1742
  description: "Create or update records identified by a unique property value as specified by the `idProperty` query param. `idProperty` query param refers to a property whose values are unique for the object.",
1745
1743
  tags: ["Batch"],
1746
- security: [],
1747
1744
  parameters: [],
1748
1745
  request: {
1749
1746
  required: true,
@@ -1767,7 +1764,6 @@ var operations = [
1767
1764
  summary: "Merge two deals with same type",
1768
1765
  description: "Combine two deals of the same type into a single deal.",
1769
1766
  tags: ["Basic"],
1770
- security: [],
1771
1767
  permissions: [
1772
1768
  {
1773
1769
  key: "deals.delete"
@@ -1796,7 +1792,6 @@ var operations = [
1796
1792
  summary: "Search for deals using various filters and criteria to retrieve specific records.",
1797
1793
  description: "Search for deals using specified criteria and filters.",
1798
1794
  tags: ["Search"],
1799
- security: [],
1800
1795
  pagination: {
1801
1796
  style: "cursor",
1802
1797
  cursor: {
@@ -1833,7 +1828,6 @@ var operations = [
1833
1828
  summary: "Read",
1834
1829
  description: "Read an Object identified by `{dealId}`. `{dealId}` refers to the internal object ID by default, or optionally any unique property value as specified by the `idProperty` query param. Control what is returned via the `properties` query param.",
1835
1830
  tags: ["Basic"],
1836
- security: [],
1837
1831
  parameters: [
1838
1832
  {
1839
1833
  name: "dealId",
@@ -1917,7 +1911,6 @@ var operations = [
1917
1911
  summary: "Update",
1918
1912
  description: "Perform a partial update of an Object identified by `{dealId}`or optionally a unique property value as specified by the `idProperty` query param. `{dealId}` refers to the internal object ID by default, and the `idProperty` query param refers to a property whose values are unique for the object. Provided property values will be overwritten. Read-only and non-existent properties will result in an error. Properties values can be cleared by passing an empty string.",
1919
1913
  tags: ["Basic"],
1920
- security: [],
1921
1914
  parameters: [
1922
1915
  {
1923
1916
  name: "dealId",
@@ -1960,7 +1953,6 @@ var operations = [
1960
1953
  summary: "Archive",
1961
1954
  description: "Move an Object identified by `{dealId}` to the recycling bin.",
1962
1955
  tags: ["Basic"],
1963
- security: [],
1964
1956
  permissions: [
1965
1957
  {
1966
1958
  key: "deals.delete"
@@ -1990,7 +1982,6 @@ var operations = [
1990
1982
  summary: "List",
1991
1983
  description: "Read a page of tickets. Control what is returned via the `properties` query param.",
1992
1984
  tags: ["Basic"],
1993
- security: [],
1994
1985
  pagination: {
1995
1986
  style: "cursor",
1996
1987
  cursor: {
@@ -2089,7 +2080,6 @@ var operations = [
2089
2080
  summary: "Create",
2090
2081
  description: "Create a ticket with the given properties and return a copy of the object, including the ID. Documentation and examples for creating standard tickets is provided.",
2091
2082
  tags: ["Basic"],
2092
- security: [],
2093
2083
  parameters: [],
2094
2084
  request: {
2095
2085
  required: true,
@@ -2113,7 +2103,6 @@ var operations = [
2113
2103
  summary: "Archive a batch of tickets by ID",
2114
2104
  description: "Delete a batch of tickets by ID. Deleted tickets can be restored within 90 days of deletion. Learn more about [restoring records](https://knowledge.hubspot.com/records/restore-deleted-records).",
2115
2105
  tags: ["Batch"],
2116
- security: [],
2117
2106
  permissions: [
2118
2107
  {
2119
2108
  key: "tickets.delete"
@@ -2138,7 +2127,6 @@ var operations = [
2138
2127
  summary: "Create a batch of tickets",
2139
2128
  description: "Create a batch of tickets. The `inputs` array can contain a `properties` object to define property values for the ticket, along with an `associations` array to define [associations](https://developers.hubspot.com/docs/guides/api/crm/associations/associations-v4) with other CRM records.",
2140
2129
  tags: ["Batch"],
2141
- security: [],
2142
2130
  parameters: [],
2143
2131
  request: {
2144
2132
  required: true,
@@ -2162,7 +2150,6 @@ var operations = [
2162
2150
  summary: "Read a batch of tickets by internal ID, or unique property values",
2163
2151
  description: "Retrieve a batch of tickets by ID (`ticketId`) or unique property value (`idProperty`). ",
2164
2152
  tags: ["Batch"],
2165
- security: [],
2166
2153
  parameters: [
2167
2154
  {
2168
2155
  name: "archived",
@@ -2197,7 +2184,6 @@ var operations = [
2197
2184
  summary: "Update a batch of tickets by internal ID, or unique property values",
2198
2185
  description: "Update a batch of tickets by ID (`ticketId`) or unique property value (`idProperty`). Provided property values will be overwritten. Read-only and non-existent properties will result in an error. Properties values can be cleared by passing an empty string.",
2199
2186
  tags: ["Batch"],
2200
- security: [],
2201
2187
  parameters: [],
2202
2188
  request: {
2203
2189
  required: true,
@@ -2221,7 +2207,6 @@ var operations = [
2221
2207
  summary: "Create or update a batch of tickets by unique property values",
2222
2208
  description: "Create or update records identified by a unique property value as specified by the `idProperty` query param. `idProperty` query param refers to a property whose values are unique for the object.",
2223
2209
  tags: ["Batch"],
2224
- security: [],
2225
2210
  parameters: [],
2226
2211
  request: {
2227
2212
  required: true,
@@ -2245,7 +2230,6 @@ var operations = [
2245
2230
  summary: "Merge two tickets",
2246
2231
  description: "Merge two tickets, combining them into one ticket record.",
2247
2232
  tags: ["Advanced"],
2248
- security: [],
2249
2233
  permissions: [
2250
2234
  {
2251
2235
  key: "tickets.delete"
@@ -2274,7 +2258,6 @@ var operations = [
2274
2258
  summary: "Search for tickets",
2275
2259
  description: "Search for tickets by filtering on properties, searching through associations, and sorting results. Learn more about [CRM search](https://developers.hubspot.com/docs/guides/api/crm/search#make-a-search-request).",
2276
2260
  tags: ["Search"],
2277
- security: [],
2278
2261
  pagination: {
2279
2262
  style: "cursor",
2280
2263
  cursor: {
@@ -2311,7 +2294,6 @@ var operations = [
2311
2294
  summary: "Read",
2312
2295
  description: "Read an Object identified by `{ticketId}`. `{ticketId}` refers to the internal object ID by default, or optionally any unique property value as specified by the `idProperty` query param. Control what is returned via the `properties` query param.",
2313
2296
  tags: ["Basic"],
2314
- security: [],
2315
2297
  parameters: [
2316
2298
  {
2317
2299
  name: "ticketId",
@@ -2395,7 +2377,6 @@ var operations = [
2395
2377
  summary: "Update",
2396
2378
  description: "Perform a partial update of an Object identified by `{ticketId}`or optionally a unique property value as specified by the `idProperty` query param. `{ticketId}` refers to the internal object ID by default, and the `idProperty` query param refers to a property whose values are unique for the object. Provided property values will be overwritten. Read-only and non-existent properties will result in an error. Properties values can be cleared by passing an empty string.",
2397
2379
  tags: ["Basic"],
2398
- security: [],
2399
2380
  parameters: [
2400
2381
  {
2401
2382
  name: "ticketId",
@@ -2438,7 +2419,6 @@ var operations = [
2438
2419
  summary: "Archive",
2439
2420
  description: "Move an Object identified by `{ticketId}` to the recycling bin.",
2440
2421
  tags: ["Basic"],
2441
- security: [],
2442
2422
  permissions: [
2443
2423
  {
2444
2424
  key: "tickets.delete"
@@ -2468,7 +2448,6 @@ var operations = [
2468
2448
  summary: "List",
2469
2449
  description: "Read a page of leads. Control what is returned via the `properties` query param.",
2470
2450
  tags: ["Basic"],
2471
- security: [],
2472
2451
  pagination: {
2473
2452
  style: "cursor",
2474
2453
  cursor: {
@@ -2567,7 +2546,6 @@ var operations = [
2567
2546
  summary: "Create",
2568
2547
  description: "Create a lead with the given properties and return a copy of the object, including the ID. Documentation and examples for creating standard leads is provided.",
2569
2548
  tags: ["Basic"],
2570
- security: [],
2571
2549
  parameters: [],
2572
2550
  request: {
2573
2551
  required: true,
@@ -2591,7 +2569,6 @@ var operations = [
2591
2569
  summary: "Archive a batch of leads by ID",
2592
2570
  description: "Archive multiple leads by their IDs in a single request, moving them to the recycling bin.",
2593
2571
  tags: ["Batch"],
2594
- security: [],
2595
2572
  permissions: [
2596
2573
  {
2597
2574
  key: "leads.delete"
@@ -2616,7 +2593,6 @@ var operations = [
2616
2593
  summary: "Create a batch of leads",
2617
2594
  description: "Create multiple lead records in a single request by providing a batch of lead data. This endpoint allows for efficient creation of leads by processing them together, which can be useful for syncing data from other systems or importing large datasets.",
2618
2595
  tags: ["Batch"],
2619
- security: [],
2620
2596
  parameters: [],
2621
2597
  request: {
2622
2598
  required: true,
@@ -2640,7 +2616,6 @@ var operations = [
2640
2616
  summary: "Read a batch of leads by internal ID, or unique property values",
2641
2617
  description: "Retrieve records by record ID or include the `idProperty` parameter to retrieve records by a custom unique value property. ",
2642
2618
  tags: ["Batch"],
2643
- security: [],
2644
2619
  parameters: [
2645
2620
  {
2646
2621
  name: "archived",
@@ -2675,7 +2650,6 @@ var operations = [
2675
2650
  summary: "Update a batch of leads by internal ID, or unique property values",
2676
2651
  description: "Update multiple lead records using their internal IDs or unique property values. This endpoint allows batch processing of updates, where each lead's properties can be modified based on the provided input. Ensure that the properties being updated exist on the lead objects to avoid errors.",
2677
2652
  tags: ["Batch"],
2678
- security: [],
2679
2653
  parameters: [],
2680
2654
  request: {
2681
2655
  required: true,
@@ -2699,7 +2673,6 @@ var operations = [
2699
2673
  summary: "Create or update a batch of leads by unique property values",
2700
2674
  description: "Create or update records identified by a unique property value as specified by the `idProperty` query param. `idProperty` query param refers to a property whose values are unique for the object.",
2701
2675
  tags: ["Batch"],
2702
- security: [],
2703
2676
  parameters: [],
2704
2677
  request: {
2705
2678
  required: true,
@@ -2723,7 +2696,6 @@ var operations = [
2723
2696
  summary: "Search for leads using specified criteria.",
2724
2697
  description: "Perform a search for leads based on the provided filter groups, properties, and sorting options. The request allows for pagination and can return up to 200 results per page.",
2725
2698
  tags: ["Search"],
2726
- security: [],
2727
2699
  pagination: {
2728
2700
  style: "cursor",
2729
2701
  cursor: {
@@ -2760,7 +2732,6 @@ var operations = [
2760
2732
  summary: "Read",
2761
2733
  description: "Read an Object identified by `{leadsId}`. `{leadsId}` refers to the internal object ID by default, or optionally any unique property value as specified by the `idProperty` query param. Control what is returned via the `properties` query param.",
2762
2734
  tags: ["Basic"],
2763
- security: [],
2764
2735
  parameters: [
2765
2736
  {
2766
2737
  name: "leadsId",
@@ -2844,7 +2815,6 @@ var operations = [
2844
2815
  summary: "Update",
2845
2816
  description: "Perform a partial update of an Object identified by `{leadsId}`or optionally a unique property value as specified by the `idProperty` query param. `{leadsId}` refers to the internal object ID by default, and the `idProperty` query param refers to a property whose values are unique for the object. Provided property values will be overwritten. Read-only and non-existent properties will result in an error. Properties values can be cleared by passing an empty string.",
2846
2817
  tags: ["Basic"],
2847
- security: [],
2848
2818
  parameters: [
2849
2819
  {
2850
2820
  name: "leadsId",
@@ -2887,7 +2857,6 @@ var operations = [
2887
2857
  summary: "Archive",
2888
2858
  description: "Move an Object identified by `{leadsId}` to the recycling bin.",
2889
2859
  tags: ["Basic"],
2890
- security: [],
2891
2860
  permissions: [
2892
2861
  {
2893
2862
  key: "leads.delete"
@@ -2917,7 +2886,6 @@ var operations = [
2917
2886
  summary: "List",
2918
2887
  description: "Read a page of notes. Control what is returned via the `properties` query param.",
2919
2888
  tags: ["Basic"],
2920
- security: [],
2921
2889
  pagination: {
2922
2890
  style: "cursor",
2923
2891
  cursor: {
@@ -3016,7 +2984,6 @@ var operations = [
3016
2984
  summary: "Create",
3017
2985
  description: "Create a note with the given properties and return a copy of the object, including the ID. Documentation and examples for creating standard notes is provided.",
3018
2986
  tags: ["Basic"],
3019
- security: [],
3020
2987
  parameters: [],
3021
2988
  request: {
3022
2989
  required: true,
@@ -3040,7 +3007,6 @@ var operations = [
3040
3007
  summary: "Archive a batch of notes by ID",
3041
3008
  description: "Archive multiple notes by their IDs in a single request. This operation moves the specified notes to the recycling bin, making them inaccessible from regular queries.",
3042
3009
  tags: ["Batch"],
3043
- security: [],
3044
3010
  permissions: [
3045
3011
  {
3046
3012
  key: "notes.delete"
@@ -3065,7 +3031,6 @@ var operations = [
3065
3031
  summary: "Create a batch of notes",
3066
3032
  description: "Create multiple notes in a single request by providing the necessary properties for each note. This operation returns the created notes with their unique identifiers.",
3067
3033
  tags: ["Batch"],
3068
- security: [],
3069
3034
  parameters: [],
3070
3035
  request: {
3071
3036
  required: true,
@@ -3089,7 +3054,6 @@ var operations = [
3089
3054
  summary: "Read a batch of notes by internal ID, or unique property values",
3090
3055
  description: "Retrieve records by record ID or include the `idProperty` parameter to retrieve records by a custom unique value property. ",
3091
3056
  tags: ["Batch"],
3092
- security: [],
3093
3057
  parameters: [
3094
3058
  {
3095
3059
  name: "archived",
@@ -3124,7 +3088,6 @@ var operations = [
3124
3088
  summary: "Update a batch of notes by internal ID, or unique property values",
3125
3089
  description: "Update multiple notes using their internal IDs or unique property values. This operation allows you to modify the properties of several notes in a single request, streamlining the process of managing note data in bulk.",
3126
3090
  tags: ["Batch"],
3127
- security: [],
3128
3091
  parameters: [],
3129
3092
  request: {
3130
3093
  required: true,
@@ -3148,7 +3111,6 @@ var operations = [
3148
3111
  summary: "Create or update a batch of notes by unique property values",
3149
3112
  description: "Create or update records identified by a unique property value as specified by the `idProperty` query param. `idProperty` query param refers to a property whose values are unique for the object.",
3150
3113
  tags: ["Batch"],
3151
- security: [],
3152
3114
  parameters: [],
3153
3115
  request: {
3154
3116
  required: true,
@@ -3172,7 +3134,6 @@ var operations = [
3172
3134
  summary: "Search for notes based on specified criteria.",
3173
3135
  description: "Execute a search for notes using filters, sorting options, and other query parameters to refine the results. This endpoint allows for complex queries to locate specific notes within the CRM system.",
3174
3136
  tags: ["Search"],
3175
- security: [],
3176
3137
  pagination: {
3177
3138
  style: "cursor",
3178
3139
  cursor: {
@@ -3209,7 +3170,6 @@ var operations = [
3209
3170
  summary: "Read",
3210
3171
  description: "Read an Object identified by `{noteId}`. `{noteId}` refers to the internal object ID by default, or optionally any unique property value as specified by the `idProperty` query param. Control what is returned via the `properties` query param.",
3211
3172
  tags: ["Basic"],
3212
- security: [],
3213
3173
  parameters: [
3214
3174
  {
3215
3175
  name: "noteId",
@@ -3293,7 +3253,6 @@ var operations = [
3293
3253
  summary: "Update",
3294
3254
  description: "Perform a partial update of an Object identified by `{noteId}`or optionally a unique property value as specified by the `idProperty` query param. `{noteId}` refers to the internal object ID by default, and the `idProperty` query param refers to a property whose values are unique for the object. Provided property values will be overwritten. Read-only and non-existent properties will result in an error. Properties values can be cleared by passing an empty string.",
3295
3255
  tags: ["Basic"],
3296
- security: [],
3297
3256
  parameters: [
3298
3257
  {
3299
3258
  name: "noteId",
@@ -3336,7 +3295,6 @@ var operations = [
3336
3295
  summary: "Archive",
3337
3296
  description: "Move an Object identified by `{noteId}` to the recycling bin.",
3338
3297
  tags: ["Basic"],
3339
- security: [],
3340
3298
  permissions: [
3341
3299
  {
3342
3300
  key: "notes.delete"
@@ -3366,7 +3324,6 @@ var operations = [
3366
3324
  summary: "List",
3367
3325
  description: "Read a page of calls. Control what is returned via the `properties` query param.",
3368
3326
  tags: ["Basic"],
3369
- security: [],
3370
3327
  pagination: {
3371
3328
  style: "cursor",
3372
3329
  cursor: {
@@ -3465,7 +3422,6 @@ var operations = [
3465
3422
  summary: "Create",
3466
3423
  description: "Create a call with the given properties and return a copy of the object, including the ID. Documentation and examples for creating standard calls is provided.",
3467
3424
  tags: ["Basic"],
3468
- security: [],
3469
3425
  parameters: [],
3470
3426
  request: {
3471
3427
  required: true,
@@ -3489,7 +3445,6 @@ var operations = [
3489
3445
  summary: "Archive a batch of calls by ID",
3490
3446
  description: "Archive a batch of calls by ID. Deleted calls can be restored within 90 days of being deleted, but call recordings recording will be permanently deleted. Learn more about [restoring activity records](https://knowledge.hubspot.com/records/restore-deleted-activity-in-a-record).",
3491
3447
  tags: ["Batch"],
3492
- security: [],
3493
3448
  permissions: [
3494
3449
  {
3495
3450
  key: "calls.delete"
@@ -3514,7 +3469,6 @@ var operations = [
3514
3469
  summary: "Create a batch of calls",
3515
3470
  description: "Create a batch of calls. The `inputs` array can contain a `properties` object to define property values for each record, along with an `associations` array to define [associations](https://developers.hubspot.com/docs/guides/api/crm/associations/associations-v4) with other CRM records.",
3516
3471
  tags: ["Batch"],
3517
- security: [],
3518
3472
  parameters: [],
3519
3473
  request: {
3520
3474
  required: true,
@@ -3538,7 +3492,6 @@ var operations = [
3538
3492
  summary: "Read a batch of calls by internal ID, or unique property values",
3539
3493
  description: "Retrieve a batch of calls by ID.",
3540
3494
  tags: ["Batch"],
3541
- security: [],
3542
3495
  parameters: [
3543
3496
  {
3544
3497
  name: "archived",
@@ -3573,7 +3526,6 @@ var operations = [
3573
3526
  summary: "Update a batch of calls by internal ID, or unique property values",
3574
3527
  description: "Update a batch of calls by ID.",
3575
3528
  tags: ["Batch"],
3576
- security: [],
3577
3529
  parameters: [],
3578
3530
  request: {
3579
3531
  required: true,
@@ -3597,7 +3549,6 @@ var operations = [
3597
3549
  summary: "Create or update a batch of calls by unique property values",
3598
3550
  description: "Create or update records identified by a unique property value as specified by the `idProperty` query param. `idProperty` query param refers to a property whose values are unique for the object.",
3599
3551
  tags: ["Batch"],
3600
- security: [],
3601
3552
  parameters: [],
3602
3553
  request: {
3603
3554
  required: true,
@@ -3621,7 +3572,6 @@ var operations = [
3621
3572
  summary: "Search for calls",
3622
3573
  description: "Search for calls by filtering on properties, searching through associations, and sorting results. Learn more about [CRM search](https://developers.hubspot.com/docs/guides/api/crm/search#make-a-search-request).",
3623
3574
  tags: ["Search"],
3624
- security: [],
3625
3575
  pagination: {
3626
3576
  style: "cursor",
3627
3577
  cursor: {
@@ -3658,7 +3608,6 @@ var operations = [
3658
3608
  summary: "Read",
3659
3609
  description: "Read an Object identified by `{callId}`. `{callId}` refers to the internal object ID by default, or optionally any unique property value as specified by the `idProperty` query param. Control what is returned via the `properties` query param.",
3660
3610
  tags: ["Basic"],
3661
- security: [],
3662
3611
  parameters: [
3663
3612
  {
3664
3613
  name: "callId",
@@ -3742,7 +3691,6 @@ var operations = [
3742
3691
  summary: "Update",
3743
3692
  description: "Perform a partial update of an Object identified by `{callId}`or optionally a unique property value as specified by the `idProperty` query param. `{callId}` refers to the internal object ID by default, and the `idProperty` query param refers to a property whose values are unique for the object. Provided property values will be overwritten. Read-only and non-existent properties will result in an error. Properties values can be cleared by passing an empty string.",
3744
3693
  tags: ["Basic"],
3745
- security: [],
3746
3694
  parameters: [
3747
3695
  {
3748
3696
  name: "callId",
@@ -3785,7 +3733,6 @@ var operations = [
3785
3733
  summary: "Archive",
3786
3734
  description: "Move an Object identified by `{callId}` to the recycling bin.",
3787
3735
  tags: ["Basic"],
3788
- security: [],
3789
3736
  permissions: [
3790
3737
  {
3791
3738
  key: "calls.delete"
@@ -3815,7 +3762,6 @@ var operations = [
3815
3762
  summary: "List",
3816
3763
  description: "Read a page of emails. Control what is returned via the `properties` query param.",
3817
3764
  tags: ["Basic"],
3818
- security: [],
3819
3765
  pagination: {
3820
3766
  style: "cursor",
3821
3767
  cursor: {
@@ -3914,7 +3860,6 @@ var operations = [
3914
3860
  summary: "Create",
3915
3861
  description: "Create a email with the given properties and return a copy of the object, including the ID. Documentation and examples for creating standard emails is provided.",
3916
3862
  tags: ["Basic"],
3917
- security: [],
3918
3863
  parameters: [],
3919
3864
  request: {
3920
3865
  required: true,
@@ -3938,7 +3883,6 @@ var operations = [
3938
3883
  summary: "Archive a batch of emails by ID",
3939
3884
  description: "Archive a batch of emails identified by their IDs.",
3940
3885
  tags: ["Batch"],
3941
- security: [],
3942
3886
  permissions: [
3943
3887
  {
3944
3888
  key: "emails.delete"
@@ -3963,7 +3907,6 @@ var operations = [
3963
3907
  summary: "Create a batch of emails",
3964
3908
  description: "Create a batch of emails with specified properties and return the created objects.",
3965
3909
  tags: ["Batch"],
3966
- security: [],
3967
3910
  parameters: [],
3968
3911
  request: {
3969
3912
  required: true,
@@ -3987,7 +3930,6 @@ var operations = [
3987
3930
  summary: "Read a batch of emails by internal ID, or unique property values",
3988
3931
  description: "Retrieve records by record ID or include the `idProperty` parameter to retrieve records by a custom unique value property. ",
3989
3932
  tags: ["Batch"],
3990
- security: [],
3991
3933
  parameters: [
3992
3934
  {
3993
3935
  name: "archived",
@@ -4022,7 +3964,6 @@ var operations = [
4022
3964
  summary: "Update a batch of emails by internal ID, or unique property values",
4023
3965
  description: "Update a batch of emails using their internal IDs or unique property values.",
4024
3966
  tags: ["Batch"],
4025
- security: [],
4026
3967
  parameters: [],
4027
3968
  request: {
4028
3969
  required: true,
@@ -4046,7 +3987,6 @@ var operations = [
4046
3987
  summary: "Create or update a batch of emails by unique property values",
4047
3988
  description: "Create or update records identified by a unique property value as specified by the `idProperty` query param. `idProperty` query param refers to a property whose values are unique for the object.",
4048
3989
  tags: ["Batch"],
4049
- security: [],
4050
3990
  parameters: [],
4051
3991
  request: {
4052
3992
  required: true,
@@ -4070,7 +4010,6 @@ var operations = [
4070
4010
  summary: "Search for emails using specified criteria and filters.",
4071
4011
  description: "Perform a search for emails based on the provided query parameters and return matching results.",
4072
4012
  tags: ["Search"],
4073
- security: [],
4074
4013
  pagination: {
4075
4014
  style: "cursor",
4076
4015
  cursor: {
@@ -4107,7 +4046,6 @@ var operations = [
4107
4046
  summary: "Read",
4108
4047
  description: "Read an Object identified by `{emailId}`. `{emailId}` refers to the internal object ID by default, or optionally any unique property value as specified by the `idProperty` query param. Control what is returned via the `properties` query param.",
4109
4048
  tags: ["Basic"],
4110
- security: [],
4111
4049
  parameters: [
4112
4050
  {
4113
4051
  name: "emailId",
@@ -4191,7 +4129,6 @@ var operations = [
4191
4129
  summary: "Update",
4192
4130
  description: "Perform a partial update of an Object identified by `{emailId}`or optionally a unique property value as specified by the `idProperty` query param. `{emailId}` refers to the internal object ID by default, and the `idProperty` query param refers to a property whose values are unique for the object. Provided property values will be overwritten. Read-only and non-existent properties will result in an error. Properties values can be cleared by passing an empty string.",
4193
4131
  tags: ["Basic"],
4194
- security: [],
4195
4132
  parameters: [
4196
4133
  {
4197
4134
  name: "emailId",
@@ -4234,7 +4171,6 @@ var operations = [
4234
4171
  summary: "Archive",
4235
4172
  description: "Move an Object identified by `{emailId}` to the recycling bin.",
4236
4173
  tags: ["Basic"],
4237
- security: [],
4238
4174
  permissions: [
4239
4175
  {
4240
4176
  key: "emails.delete"
@@ -4264,7 +4200,6 @@ var operations = [
4264
4200
  summary: "List",
4265
4201
  description: "Read a page of meetings. Control what is returned via the `properties` query param.",
4266
4202
  tags: ["Basic"],
4267
- security: [],
4268
4203
  pagination: {
4269
4204
  style: "cursor",
4270
4205
  cursor: {
@@ -4363,7 +4298,6 @@ var operations = [
4363
4298
  summary: "Create",
4364
4299
  description: "Create a meeting with the given properties and return a copy of the object, including the ID. Documentation and examples for creating standard meetings is provided.",
4365
4300
  tags: ["Basic"],
4366
- security: [],
4367
4301
  parameters: [],
4368
4302
  request: {
4369
4303
  required: true,
@@ -4387,7 +4321,6 @@ var operations = [
4387
4321
  summary: "Archive a batch of meetings by ID",
4388
4322
  description: "Delete a batch of meetings by ID.",
4389
4323
  tags: ["Batch"],
4390
- security: [],
4391
4324
  permissions: [
4392
4325
  {
4393
4326
  key: "meetings.delete"
@@ -4412,7 +4345,6 @@ var operations = [
4412
4345
  summary: "Create a batch of meetings",
4413
4346
  description: "Create a batch of meetings. The `inputs` array can contain a `properties` object to define property values for the record, along with an `associations` array to define relationships with other object records.",
4414
4347
  tags: ["Batch"],
4415
- security: [],
4416
4348
  parameters: [],
4417
4349
  request: {
4418
4350
  required: true,
@@ -4436,7 +4368,6 @@ var operations = [
4436
4368
  summary: "Read a batch of meetings by internal ID, or unique property values",
4437
4369
  description: "Retrieve records by record ID or include the `idProperty` parameter to retrieve records by a custom unique value property. ",
4438
4370
  tags: ["Batch"],
4439
- security: [],
4440
4371
  parameters: [
4441
4372
  {
4442
4373
  name: "archived",
@@ -4471,7 +4402,6 @@ var operations = [
4471
4402
  summary: "Update a batch of meetings by internal ID, or unique property values",
4472
4403
  description: "Update a batch of meetings by ID (`objectId`) or unique property value (`idProperty`). Provided property values will be overwritten. Read-only and non-existent properties will result in an error. Properties values can be cleared by passing an empty string.",
4473
4404
  tags: ["Batch"],
4474
- security: [],
4475
4405
  parameters: [],
4476
4406
  request: {
4477
4407
  required: true,
@@ -4495,7 +4425,6 @@ var operations = [
4495
4425
  summary: "Create or update a batch of meetings by unique property values",
4496
4426
  description: "Create or update records identified by a unique property value as specified by the `idProperty` query param. `idProperty` query param refers to a property whose values are unique for the object.",
4497
4427
  tags: ["Batch"],
4498
- security: [],
4499
4428
  parameters: [],
4500
4429
  request: {
4501
4430
  required: true,
@@ -4519,7 +4448,6 @@ var operations = [
4519
4448
  summary: "Search for meetings",
4520
4449
  description: "Search for meetings by filtering on properties, searching through associations, and sorting results.",
4521
4450
  tags: ["Search"],
4522
- security: [],
4523
4451
  pagination: {
4524
4452
  style: "cursor",
4525
4453
  cursor: {
@@ -4556,7 +4484,6 @@ var operations = [
4556
4484
  summary: "Read",
4557
4485
  description: "Read an Object identified by `{meetingId}`. `{meetingId}` refers to the internal object ID by default, or optionally any unique property value as specified by the `idProperty` query param. Control what is returned via the `properties` query param.",
4558
4486
  tags: ["Basic"],
4559
- security: [],
4560
4487
  parameters: [
4561
4488
  {
4562
4489
  name: "meetingId",
@@ -4640,7 +4567,6 @@ var operations = [
4640
4567
  summary: "Update",
4641
4568
  description: "Perform a partial update of an Object identified by `{meetingId}`or optionally a unique property value as specified by the `idProperty` query param. `{meetingId}` refers to the internal object ID by default, and the `idProperty` query param refers to a property whose values are unique for the object. Provided property values will be overwritten. Read-only and non-existent properties will result in an error. Properties values can be cleared by passing an empty string.",
4642
4569
  tags: ["Basic"],
4643
- security: [],
4644
4570
  parameters: [
4645
4571
  {
4646
4572
  name: "meetingId",
@@ -4683,7 +4609,6 @@ var operations = [
4683
4609
  summary: "Archive",
4684
4610
  description: "Move an Object identified by `{meetingId}` to the recycling bin.",
4685
4611
  tags: ["Basic"],
4686
- security: [],
4687
4612
  permissions: [
4688
4613
  {
4689
4614
  key: "meetings.delete"
@@ -4713,7 +4638,6 @@ var operations = [
4713
4638
  summary: "List",
4714
4639
  description: "Read a page of tasks. Control what is returned via the `properties` query param.",
4715
4640
  tags: ["Basic"],
4716
- security: [],
4717
4641
  pagination: {
4718
4642
  style: "cursor",
4719
4643
  cursor: {
@@ -4812,7 +4736,6 @@ var operations = [
4812
4736
  summary: "Create",
4813
4737
  description: "Create a task with the given properties and return a copy of the object, including the ID. Documentation and examples for creating standard tasks is provided.",
4814
4738
  tags: ["Basic"],
4815
- security: [],
4816
4739
  parameters: [],
4817
4740
  request: {
4818
4741
  required: true,
@@ -4836,7 +4759,6 @@ var operations = [
4836
4759
  summary: "Archive a batch of tasks by ID",
4837
4760
  description: "Archive a batch of tasks by their IDs, moving them to the recycling bin. This operation requires a list of task IDs to be provided in the request body.",
4838
4761
  tags: ["Batch"],
4839
- security: [],
4840
4762
  permissions: [
4841
4763
  {
4842
4764
  key: "tasks.delete"
@@ -4861,7 +4783,6 @@ var operations = [
4861
4783
  summary: "Create a batch of tasks",
4862
4784
  description: "Create multiple tasks in a single request by providing a batch of task properties and associations. This endpoint allows for efficient task creation by processing multiple tasks together.",
4863
4785
  tags: ["Batch"],
4864
- security: [],
4865
4786
  parameters: [],
4866
4787
  request: {
4867
4788
  required: true,
@@ -4885,7 +4806,6 @@ var operations = [
4885
4806
  summary: "Read a batch of tasks by internal ID, or unique property values",
4886
4807
  description: "Retrieve records by record ID or include the `idProperty` parameter to retrieve records by a custom unique value property. ",
4887
4808
  tags: ["Batch"],
4888
- security: [],
4889
4809
  parameters: [
4890
4810
  {
4891
4811
  name: "archived",
@@ -4920,7 +4840,6 @@ var operations = [
4920
4840
  summary: "Update a batch of tasks by internal ID, or unique property values",
4921
4841
  description: "Update multiple tasks in a single request using their internal IDs or unique property values. This operation allows you to modify the properties of each task in the batch, ensuring efficient management of task data.",
4922
4842
  tags: ["Batch"],
4923
- security: [],
4924
4843
  parameters: [],
4925
4844
  request: {
4926
4845
  required: true,
@@ -4944,7 +4863,6 @@ var operations = [
4944
4863
  summary: "Create or update a batch of tasks by unique property values",
4945
4864
  description: "Create or update records identified by a unique property value as specified by the `idProperty` query param. `idProperty` query param refers to a property whose values are unique for the object.",
4946
4865
  tags: ["Batch"],
4947
- security: [],
4948
4866
  parameters: [],
4949
4867
  request: {
4950
4868
  required: true,
@@ -4968,7 +4886,6 @@ var operations = [
4968
4886
  summary: "Search for tasks using specified criteria.",
4969
4887
  description: "Execute a search for tasks based on the provided criteria, including filters, properties, and sorting options. This allows for retrieving tasks that match specific conditions or property values.",
4970
4888
  tags: ["Search"],
4971
- security: [],
4972
4889
  pagination: {
4973
4890
  style: "cursor",
4974
4891
  cursor: {
@@ -5005,7 +4922,6 @@ var operations = [
5005
4922
  summary: "Read",
5006
4923
  description: "Read an Object identified by `{taskId}`. `{taskId}` refers to the internal object ID by default, or optionally any unique property value as specified by the `idProperty` query param. Control what is returned via the `properties` query param.",
5007
4924
  tags: ["Basic"],
5008
- security: [],
5009
4925
  parameters: [
5010
4926
  {
5011
4927
  name: "taskId",
@@ -5089,7 +5005,6 @@ var operations = [
5089
5005
  summary: "Update",
5090
5006
  description: "Perform a partial update of an Object identified by `{taskId}`or optionally a unique property value as specified by the `idProperty` query param. `{taskId}` refers to the internal object ID by default, and the `idProperty` query param refers to a property whose values are unique for the object. Provided property values will be overwritten. Read-only and non-existent properties will result in an error. Properties values can be cleared by passing an empty string.",
5091
5007
  tags: ["Basic"],
5092
- security: [],
5093
5008
  parameters: [
5094
5009
  {
5095
5010
  name: "taskId",
@@ -5132,7 +5047,6 @@ var operations = [
5132
5047
  summary: "Archive",
5133
5048
  description: "Move an Object identified by `{taskId}` to the recycling bin.",
5134
5049
  tags: ["Basic"],
5135
- security: [],
5136
5050
  permissions: [
5137
5051
  {
5138
5052
  key: "tasks.delete"
@@ -5373,10 +5287,15 @@ var operations = [
5373
5287
  method: "PUT",
5374
5288
  path: "/crm/pipelines/2026-03/{objectType}/{pipelineId}"
5375
5289
  },
5376
- effect: "write",
5290
+ effect: "destructive",
5377
5291
  summary: "Replace a pipeline",
5378
5292
  description: "Replace all properties of an existing pipeline with the provided values.",
5379
5293
  tags: ["Basic"],
5294
+ permissions: [
5295
+ {
5296
+ key: "pipelines.delete"
5297
+ }
5298
+ ],
5380
5299
  parameters: [
5381
5300
  {
5382
5301
  name: "objectType",
@@ -6856,20 +6775,116 @@ var security = [
6856
6775
  ];
6857
6776
 
6858
6777
  // dist/config.js
6778
+ var firstWord = /* @__PURE__ */ __name((command) => command.split("-")[0] ?? command, "firstWord");
6779
+ var GROUPS = new Map(operations.flatMap((operation) => (operation.permissions ?? []).flatMap(({ key }) => key.endsWith(".delete") ? [[firstWord(operation.command), key.slice(0, -".delete".length)]] : [])));
6780
+ var COMMAND_KEYS = Object.fromEntries([
6781
+ ["deals", "deals"],
6782
+ ["contacts", "people"],
6783
+ ["companies", "organizations"]
6784
+ ].flatMap(([type, noun]) => [
6785
+ [`${type}-create`, [`${noun}.create`]],
6786
+ [`${type}-batch-create`, [`${noun}.create`]],
6787
+ [`${type}-update`, [`${noun}.update`]],
6788
+ [`${type}-batch-update`, [`${noun}.update`]],
6789
+ [`${type}-batch-upsert`, [`${noun}.create`, `${noun}.update`]]
6790
+ ]));
6791
+ var offered = /* @__PURE__ */ __name((operation) => !operation.response?.sensitive, "offered");
6792
+ var ERASE_KEY = "people.erase";
6793
+ var ERASES = "contacts-gdpr-delete";
6794
+ var keysOf = /* @__PURE__ */ __name((operation) => {
6795
+ const group = GROUPS.get(firstWord(operation.command));
6796
+ const own = operation.effect === "write" && group ? [{ key: `${group}.write` }] : [];
6797
+ const erases = operation.command === ERASES ? [{ key: ERASE_KEY }] : [];
6798
+ return [...own, ...erases, ...(COMMAND_KEYS[operation.command] ?? []).map((key) => ({ key }))];
6799
+ }, "keysOf");
6800
+ var isRecord2 = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isRecord");
6801
+ var propertiesOf = /* @__PURE__ */ __name((body) => {
6802
+ if (!isRecord2(body))
6803
+ return [];
6804
+ const records = Array.isArray(body.inputs) ? body.inputs.filter(isRecord2) : [body];
6805
+ return records.flatMap((record2) => isRecord2(record2.properties) ? [record2.properties] : []);
6806
+ }, "propertiesOf");
6807
+ var sets = /* @__PURE__ */ __name((body, name) => propertiesOf(body).some((properties) => {
6808
+ const value = properties[name];
6809
+ return value !== void 0 && value !== null && String(value).trim() !== "";
6810
+ }), "sets");
6811
+ var implied = /* @__PURE__ */ __name((key, names) => {
6812
+ const paths = names.map((name) => `properties.${name}`);
6813
+ return {
6814
+ /** For `--dry-run` and discovery: a flag the manifest names is a top-level field, so this one never applies. */
6815
+ named: { key, body: paths },
6816
+ checked: {
6817
+ key,
6818
+ when: `with ${paths.join(" or ")} set`,
6819
+ applies: /* @__PURE__ */ __name((body) => names.some((name) => sets(body, name)), "applies")
6820
+ }
6821
+ };
6822
+ }, "implied");
6823
+ var ASSIGNS = implied(CRM_ASSIGN_OTHERS_KEY, ["hubspot_owner_id"]);
6824
+ var MOVES = implied("deals.move", ["dealstage", "pipeline"]);
6825
+ var CLOSES = implied("deals.close", ["dealstage"]);
6826
+ var OWNED = /* @__PURE__ */ new Set([
6827
+ "contacts",
6828
+ "companies",
6829
+ "deals",
6830
+ "tickets",
6831
+ "leads",
6832
+ "notes",
6833
+ "calls",
6834
+ "emails",
6835
+ "meetings",
6836
+ "tasks"
6837
+ ]);
6838
+ var RECORD_WRITES = ["create", "update", "batch-create", "batch-update", "batch-upsert"];
6839
+ var bodyKeysOf = /* @__PURE__ */ __name((operation) => {
6840
+ const type = firstWord(operation.command);
6841
+ if (!OWNED.has(type) || !RECORD_WRITES.includes(operation.command.slice(type.length + 1)))
6842
+ return [];
6843
+ return [ASSIGNS, ...type === "deals" ? [MOVES, CLOSES] : []];
6844
+ }, "bodyKeysOf");
6845
+ var bodyPermissions = Object.fromEntries(operations.filter(offered).flatMap((operation) => {
6846
+ const keys = bodyKeysOf(operation).map(({ checked }) => checked);
6847
+ return keys.length ? [[operation.command, keys]] : [];
6848
+ }));
6859
6849
  var API = {
6860
6850
  manifest: {
6861
6851
  ...manifest_exports,
6862
- operations: operations.filter((operation) => operation.effect === "read" && !operation.response?.sensitive)
6852
+ operations: operations.filter(offered).map((operation) => ({
6853
+ ...operation,
6854
+ permissions: [
6855
+ ...operation.permissions ?? [],
6856
+ ...keysOf(operation),
6857
+ // cli-core takes a body key only when the manifest names it; the run checks it through `bodyPermissions`.
6858
+ ...bodyKeysOf(operation).map(({ named }) => named)
6859
+ ]
6860
+ }))
6863
6861
  },
6864
- service: SERVICE
6862
+ service: SERVICE,
6863
+ bodyPermissions
6865
6864
  };
6866
- var LATER = "it changes the HubSpot account, and this release only reads; writes come in a later release";
6867
- var API_EXCLUDED = operations.filter((operation) => operation.effect !== "read").flatMap((operation) => [
6868
- { id: operation.command, reason: LATER },
6869
- { id: operation.id, reason: LATER }
6870
- ]);
6865
+ var CRM_TYPES = { deal: "deals", person: "contacts", organization: "companies" };
6866
+ var crmApiKeys = /* @__PURE__ */ __name((kind, verb) => {
6867
+ const type = CRM_TYPES[kind];
6868
+ if (!type || verb === "remove")
6869
+ return [];
6870
+ return [`api.${type}-${verb === "create" ? "create" : "update"}`];
6871
+ }, "crmApiKeys");
6872
+ var api = serviceApiPermissions({ manifest: API.manifest });
6871
6873
  var keyOf = /* @__PURE__ */ __name((path) => path[0] === "api" && ["list", "show"].includes(path[1] ?? "") ? null : commandPathKey(path), "keyOf");
6872
- var permissions = commandPermissions({ keyOf, ...serviceApiPermissions(API) });
6874
+ var COMMAND_DEFAULTS = Object.fromEntries([.../* @__PURE__ */ new Set([...Object.values(COMMAND_KEYS).flat(), MOVES.named.key, CLOSES.named.key])].map((key) => [
6875
+ key,
6876
+ "allow"
6877
+ ]));
6878
+ var permissions = commandPermissions({
6879
+ keyOf,
6880
+ extra: [.../* @__PURE__ */ new Set([...api.extra, ...CRM_WRITE_KEYS])],
6881
+ alsoChecks: /* @__PURE__ */ __name((path) => [...api.alsoChecks(path), ...crmAlsoChecks(crmApiKeys)(path)], "alsoChecks"),
6882
+ defaults: {
6883
+ ...api.defaults,
6884
+ ...COMMAND_DEFAULTS,
6885
+ ...CRM_WRITE_DEFAULTS
6886
+ }
6887
+ });
6873
6888
  var configuration = settingsFor(IDENTITY, { permissions });
6874
6889
 
6875
6890
  // dist/context.js
@@ -7185,7 +7200,6 @@ var apiCommand = /* @__PURE__ */ __name(() => {
7185
7200
  ...API,
7186
7201
  app: IDENTITY,
7187
7202
  configuration,
7188
- excluded: API_EXCLUDED,
7189
7203
  fetch: /* @__PURE__ */ __name((command) => {
7190
7204
  const { environment } = contextOf(command);
7191
7205
  const { now } = environment;
@@ -7201,14 +7215,20 @@ var apiCommand = /* @__PURE__ */ __name(() => {
7201
7215
  ...now ? { now: /* @__PURE__ */ __name(() => new Date(now()), "now") } : {}
7202
7216
  });
7203
7217
  }, "fetch"),
7204
- failure: /* @__PURE__ */ __name((status, answer2) => failureOf({ status, writes: false, body: answer2, now: sent.now(), timeZone: sent.timeZone }), "failure"),
7218
+ failure: /* @__PURE__ */ __name((status, answer2, operation) => failureOf({
7219
+ status,
7220
+ writes: operation.effect !== "read",
7221
+ body: answer2,
7222
+ now: sent.now(),
7223
+ timeZone: sent.timeZone
7224
+ }), "failure"),
7205
7225
  token: tokenOf,
7206
- schemas: /* @__PURE__ */ __name(() => import("./schemas-JRL3DLMP.js").then((module) => module.schemas), "schemas"),
7226
+ schemas: /* @__PURE__ */ __name(() => import("./schemas-QLQ2K6DL.js").then((module) => module.schemas), "schemas"),
7207
7227
  definitions: /* @__PURE__ */ __name(() => import("./definitions-MVPICAWV.js").then((module) => module.definitions), "definitions")
7208
7228
  });
7209
7229
  }, "apiCommand");
7210
7230
 
7211
- // node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/crm/stage-tasks.js
7231
+ // node_modules/.pnpm/@wirecat+cli-core@0.699.0_@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typ_13ea275dd452fd1070c59d86b8d8c388/node_modules/@wirecat/cli-core/dist/crm/stage-tasks.js
7212
7232
  var DAY = 864e5;
7213
7233
  var openStageTasks = /* @__PURE__ */ __name(async (store, account, now, { history = false } = {}) => {
7214
7234
  const rules = await store.crm.stageTasks(account);
@@ -7245,7 +7265,7 @@ var openStageTasks = /* @__PURE__ */ __name(async (store, account, now, { histor
7245
7265
  return opened;
7246
7266
  }, "openStageTasks");
7247
7267
 
7248
- // node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/crm/digest.js
7268
+ // node_modules/.pnpm/@wirecat+cli-core@0.699.0_@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typ_13ea275dd452fd1070c59d86b8d8c388/node_modules/@wirecat/cli-core/dist/crm/digest.js
7249
7269
  var HOUR = 36e5;
7250
7270
  var STALE_HOURS = 24;
7251
7271
  var WORDS = {
@@ -7388,7 +7408,7 @@ var healthOf = /* @__PURE__ */ __name(async (store, account, { now, profile }) =
7388
7408
  return stale > STALE_HOURS ? [{ ...named, stale_hours: Math.floor(stale) }] : [];
7389
7409
  }, "healthOf");
7390
7410
 
7391
- // node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/crm/cli/csv.js
7411
+ // node_modules/.pnpm/@wirecat+cli-core@0.699.0_@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typ_13ea275dd452fd1070c59d86b8d8c388/node_modules/@wirecat/cli-core/dist/crm/cli/csv.js
7392
7412
  var csvFormatOption = /* @__PURE__ */ __name(() => annotateOption(new Option("--format <format>", "csv: this page as a table for a spreadsheet; --json=a,b picks its columns").choices(["csv"]), { mcp: false }), "csvFormatOption");
7393
7413
  var DEAL_CSV_COLUMNS = [
7394
7414
  "ref",
@@ -7412,12 +7432,12 @@ var DEAL_CSV_COLUMNS = [
7412
7432
  "updated_at",
7413
7433
  "provider_metadata"
7414
7434
  ];
7415
- var isRecord2 = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isRecord");
7416
- var at = /* @__PURE__ */ __name((item, path) => path.reduce((value, key) => isRecord2(value) ? value[key] : void 0, item), "at");
7435
+ var isRecord3 = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isRecord");
7436
+ var at = /* @__PURE__ */ __name((item, path) => path.reduce((value, key) => isRecord3(value) ? value[key] : void 0, item), "at");
7417
7437
  var flat = /* @__PURE__ */ __name((value) => {
7418
7438
  if (Array.isArray(value))
7419
7439
  return value.map(flat).join("; ");
7420
- if (isRecord2(value))
7440
+ if (isRecord3(value))
7421
7441
  return value.value ?? value.name ?? value.ref ?? JSON.stringify(value);
7422
7442
  return value;
7423
7443
  }, "flat");
@@ -7437,15 +7457,15 @@ var customColumns = /* @__PURE__ */ __name((field, header) => {
7437
7457
  ];
7438
7458
  }, "customColumns");
7439
7459
  var customFieldsOf = /* @__PURE__ */ __name((page) => {
7440
- const listed = new Set(page.fields.map((field) => field.code));
7460
+ const listed2 = new Set(page.fields.map((field) => field.code));
7441
7461
  const extra = /* @__PURE__ */ new Map();
7442
7462
  for (const item of page.items) {
7443
7463
  const metadata2 = item.provider_metadata;
7444
- if (!isRecord2(metadata2))
7464
+ if (!isRecord3(metadata2))
7445
7465
  continue;
7446
7466
  for (const [code, value] of Object.entries(metadata2))
7447
- if (!listed.has(code) && !extra.has(code)) {
7448
- const label = isRecord2(value) && typeof value.label === "string" ? value.label : null;
7467
+ if (!listed2.has(code) && !extra.has(code)) {
7468
+ const label = isRecord3(value) && typeof value.label === "string" ? value.label : null;
7449
7469
  extra.set(code, { code, label, type: "string" });
7450
7470
  }
7451
7471
  }
@@ -7496,10 +7516,10 @@ var printCsv = /* @__PURE__ */ __name((command, page, paths) => {
7496
7516
  if (page.hasMore)
7497
7517
  renderer.note(`\u2192 more rows: run it again with --page ${page.page + 1}`);
7498
7518
  }, "printCsv");
7499
- var renderCsv = /* @__PURE__ */ __name((command, open, read, defaults = DEAL_CSV_COLUMNS) => {
7519
+ var renderCsv = /* @__PURE__ */ __name((command, open2, read, defaults = DEAL_CSV_COLUMNS) => {
7500
7520
  refuseCsvConflict(command);
7501
7521
  return inCommandRun(command, async () => {
7502
- const run3 = await open(command, { readOnly: true });
7522
+ const run3 = await open2(command, { readOnly: true });
7503
7523
  let page;
7504
7524
  try {
7505
7525
  page = await read(run3);
@@ -7510,7 +7530,7 @@ var renderCsv = /* @__PURE__ */ __name((command, open, read, defaults = DEAL_CSV
7510
7530
  });
7511
7531
  }, "renderCsv");
7512
7532
 
7513
- // node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/crm/cli/records.js
7533
+ // node_modules/.pnpm/@wirecat+cli-core@0.699.0_@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typ_13ea275dd452fd1070c59d86b8d8c388/node_modules/@wirecat/cli-core/dist/crm/cli/records.js
7514
7534
  var time2 = nullable(isoTime);
7515
7535
  var metadata = optional(record(string(), strictObject({
7516
7536
  label: nullable(string()),
@@ -7677,7 +7697,7 @@ var sourceWith = /* @__PURE__ */ __name((run3, method, what) => {
7677
7697
  }, "sourceWith");
7678
7698
  var addCrmRecordCommands = /* @__PURE__ */ __name((program, options) => {
7679
7699
  const { within, example } = options;
7680
- const quotaOf = /* @__PURE__ */ __name((run3) => foreignContacts(run3.source(), async () => {
7700
+ const quotaOf2 = /* @__PURE__ */ __name((run3) => foreignContacts(run3.source(), async () => {
7681
7701
  const self = run3.source().self;
7682
7702
  return foreignContactsPathFor(options.app, run3.account, run3.env, self ? String(await self()) : void 0);
7683
7703
  }, { now: options.now }), "quotaOf");
@@ -7709,7 +7729,7 @@ var addCrmRecordCommands = /* @__PURE__ */ __name((program, options) => {
7709
7729
  limit: opts.limit,
7710
7730
  page: opts.page
7711
7731
  });
7712
- const shown = await quotaOf(run3).strip(noun.kind, page.items);
7732
+ const shown = await quotaOf2(run3).strip(noun.kind, page.items);
7713
7733
  return { items: shown.map(noun.of), fields, hasMore: page.hasMore };
7714
7734
  }, "read");
7715
7735
  if (csv)
@@ -7731,7 +7751,7 @@ var addCrmRecordCommands = /* @__PURE__ */ __name((program, options) => {
7731
7751
  example(answerEntity(annotate(group.command("show"), { effects: REMOTE_READ, offline: false }), noun.entity, noun.schema).description(`one of the CRM's ${noun.what}, read live, with its phones and e-mails; one that is not your client counts toward the day's limit when the CRM sets one`).argument(`<${noun.kind}>`, `the CRM's id of the ${noun.kind}, as list prints it, or its exact name`), `${noun.noun} show 42`, `${noun.noun} show "Anna Example" --json`).action(async (given, _opts, command) => {
7732
7752
  await within(command, async (run3) => {
7733
7753
  const found = await recordNamed(run3, noun, given);
7734
- await quotaOf(run3).spend(noun.kind, found);
7754
+ await quotaOf2(run3).spend(noun.kind, found);
7735
7755
  return itemOf(noun.of(found));
7736
7756
  });
7737
7757
  });
@@ -7879,7 +7899,7 @@ var addRecordWrites = /* @__PURE__ */ __name((group, noun, { within, example, wr
7879
7899
  }, "addRecordWrites");
7880
7900
  var idOf = /* @__PURE__ */ __name((opts) => opts.operationId === void 0 ? {} : { operationId: opts.operationId }, "idOf");
7881
7901
 
7882
- // node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/crm/cli/activities.js
7902
+ // node_modules/.pnpm/@wirecat+cli-core@0.699.0_@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typ_13ea275dd452fd1070c59d86b8d8c388/node_modules/@wirecat/cli-core/dist/crm/cli/activities.js
7883
7903
  var MOST2 = 500;
7884
7904
  var nullableText = nullable(text);
7885
7905
  var REFS = ["deal", "lead", "person", "organization"];
@@ -7992,7 +8012,7 @@ var addCrmActivityCommands = /* @__PURE__ */ __name((program, options) => {
7992
8012
  }, "addCrmActivityCommands");
7993
8013
  var refOf = /* @__PURE__ */ __name((kind, value) => value.includes(":") ? value : `${kind}:${value}`, "refOf");
7994
8014
 
7995
- // node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/crm/cli/changes.js
8015
+ // node_modules/.pnpm/@wirecat+cli-core@0.699.0_@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typ_13ea275dd452fd1070c59d86b8d8c388/node_modules/@wirecat/cli-core/dist/crm/cli/changes.js
7996
8016
  var MOST3 = 500;
7997
8017
  var DAY2 = 864e5;
7998
8018
  var nullableText2 = nullable(text);
@@ -8211,7 +8231,544 @@ var pipelineOf2 = /* @__PURE__ */ __name(async (run3, value) => {
8211
8231
  }) : new CliError("not_found", `no pipeline ${value} in this account`, { reason: "pipeline.not-found" });
8212
8232
  }, "pipelineOf");
8213
8233
 
8214
- // node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/crm/cli/pipeline-view.js
8234
+ // node_modules/.pnpm/@wirecat+cli-core@0.699.0_@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typ_13ea275dd452fd1070c59d86b8d8c388/node_modules/@wirecat/cli-core/dist/crm/cli/files.js
8235
+ import { createHash } from "node:crypto";
8236
+ import { chmodSync, constants, copyFileSync, existsSync, linkSync, mkdirSync, readFileSync as readFileSync2, renameSync, rmSync } from "node:fs";
8237
+ import { open } from "node:fs/promises";
8238
+ import { join as join2, resolve, sep } from "node:path";
8239
+ var MB = 1024 * 1024;
8240
+ var PAGE = 500;
8241
+ var DAY3 = 24 * 60 * 60 * 1e3;
8242
+ var DOWNLOAD_MB = 100;
8243
+ var MOST_DOWNLOAD_MB = 2048;
8244
+ var SHOWN_TEXT = 4e3;
8245
+ var FILES_ROUND = "crm:files-round";
8246
+ var FILES_DOWNLOAD_KEY = "files.download";
8247
+ var SKIP_REASONS = ["too-large", "run-files", "run-mb", "deadline", "disk-full", "unavailable"];
8248
+ var crmFile = strictObject({
8249
+ id: string(),
8250
+ name: string(),
8251
+ size: nullable(number()),
8252
+ mime: nullable(string()),
8253
+ created_at: nullable(string()),
8254
+ owner: strictObject({ kind: string(), id: string() }),
8255
+ source: string(),
8256
+ downloaded: boolean(),
8257
+ path: nullable(string()),
8258
+ untrusted: array(string())
8259
+ });
8260
+ var crmFileDownload = strictObject({
8261
+ ...crmFile.entries,
8262
+ text_status: string(),
8263
+ text: nullable(string()),
8264
+ text_truncated: boolean()
8265
+ });
8266
+ var crmFilesSync = strictObject({
8267
+ owners: number(),
8268
+ downloaded: array(strictObject({ id: string(), name: string(), size: number(), path: string(), text_status: string() })),
8269
+ skipped: array(strictObject({
8270
+ id: string(),
8271
+ name: string(),
8272
+ size: nullable(number()),
8273
+ reason: picklist(SKIP_REASONS),
8274
+ step: string()
8275
+ })),
8276
+ complete: boolean(),
8277
+ stopped: optional(picklist(SKIP_REASONS)),
8278
+ untrusted: array(string())
8279
+ });
8280
+ var OWNER_FLAGS = [
8281
+ ["deal", "--deal <id>"],
8282
+ ["lead", "--lead <id>"],
8283
+ ["person", "--person <id>"],
8284
+ ["organization", "--organization <id>"]
8285
+ ];
8286
+ var iso4 = /* @__PURE__ */ __name((ms) => ms === null ? null : new Date(ms).toISOString(), "iso");
8287
+ var segment = /* @__PURE__ */ __name((text2) => text2.replace(/[^\w.-]+/gu, "_"), "segment");
8288
+ var accountFolder = /* @__PURE__ */ __name((app, run3) => join2(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env: run3.env ?? process.env }).state, "crm", "files", segment(`${run3.account.provider}-${run3.account.account}`)), "accountFolder");
8289
+ var ownFolder = /* @__PURE__ */ __name((top, folder) => {
8290
+ mkdirSync(folder, { recursive: true, mode: 448 });
8291
+ for (let at2 = resolve(folder); at2.startsWith(resolve(top)); at2 = resolve(at2, "..")) {
8292
+ chmodSync(at2, 448);
8293
+ if (at2 === resolve(top))
8294
+ break;
8295
+ }
8296
+ }, "ownFolder");
8297
+ var TooLarge = class extends Error {
8298
+ static {
8299
+ __name(this, "TooLarge");
8300
+ }
8301
+ };
8302
+ var Taken = class extends Error {
8303
+ static {
8304
+ __name(this, "Taken");
8305
+ }
8306
+ };
8307
+ var errnoOf = /* @__PURE__ */ __name((error) => error?.code, "errnoOf");
8308
+ var placeNew = /* @__PURE__ */ __name((part, target) => {
8309
+ try {
8310
+ linkSync(part, target);
8311
+ } catch (error) {
8312
+ if (errnoOf(error) === "EEXIST")
8313
+ throw new Taken();
8314
+ try {
8315
+ copyFileSync(part, target, constants.COPYFILE_EXCL);
8316
+ } catch (copying) {
8317
+ if (errnoOf(copying) === "EEXIST")
8318
+ throw new Taken();
8319
+ throw copying;
8320
+ }
8321
+ }
8322
+ rmSync(part, { force: true });
8323
+ }, "placeNew");
8324
+ var saveStream = /* @__PURE__ */ __name(async (stream, target, { cap, signal, exclusive }) => {
8325
+ const part = `${target}.part-${process.pid}`;
8326
+ const handle = await open(part, "wx", 384);
8327
+ const hash = createHash("sha256");
8328
+ const reader = stream.getReader();
8329
+ let bytes = 0;
8330
+ try {
8331
+ for (; ; ) {
8332
+ if (signal?.aborted)
8333
+ throw signal.reason ?? new Error("aborted");
8334
+ const { done, value } = await reader.read();
8335
+ if (done)
8336
+ break;
8337
+ bytes += value.byteLength;
8338
+ if (bytes > cap)
8339
+ throw new TooLarge();
8340
+ hash.update(value);
8341
+ await handle.write(value);
8342
+ }
8343
+ await handle.close();
8344
+ if (exclusive)
8345
+ placeNew(part, target);
8346
+ else
8347
+ renameSync(part, target);
8348
+ chmodSync(target, 384);
8349
+ return { bytes, sha256: hash.digest("hex") };
8350
+ } catch (error) {
8351
+ await reader.cancel().catch(() => {
8352
+ });
8353
+ await handle.close().catch(() => {
8354
+ });
8355
+ rmSync(part, { force: true });
8356
+ throw error;
8357
+ }
8358
+ }, "saveStream");
8359
+ var tooLarge = /* @__PURE__ */ __name((id, size, capMb, flag) => new CliError("validation_error", `${id} is ${size === null ? "larger than" : `${Math.ceil(size / MB)} MB, over`} the ${capMb} MB a download takes` + (flag ? `: --max-size raises it up to ${MOST_DOWNLOAD_MB}` : ""), { reason: "crm.file-too-large", limit: capMb, ...size === null ? {} : { total: size } }), "tooLarge");
8360
+ var listed = /* @__PURE__ */ __name(async ({ run: run3 }, owner, gaps = []) => {
8361
+ const source = run3.source();
8362
+ if (!source.files)
8363
+ throw new CliError("configuration_error", "this CRM does not list its records' files");
8364
+ const context = { spend: /* @__PURE__ */ __name(() => {
8365
+ }, "spend"), gap: /* @__PURE__ */ __name((gap) => gaps.push(gap), "gap") };
8366
+ const found = await source.files(owner, context);
8367
+ if (!found)
8368
+ throw new CliError("not_found", `the CRM has no ${owner.kind} ${owner.id}, or this sign-in cannot see it`);
8369
+ return found;
8370
+ }, "listed");
8371
+ var quotaOf = /* @__PURE__ */ __name((context) => {
8372
+ const { run: run3, app, now } = context;
8373
+ return foreignContacts(run3.source(), async () => {
8374
+ const self = run3.source().self;
8375
+ return foreignContactsPathFor(app, run3.account, run3.env, self ? String(await self()) : void 0);
8376
+ }, { now });
8377
+ }, "quotaOf");
8378
+ var roomFor = /* @__PURE__ */ __name(async ({ run: run3 }, folder, { need, capBytes, own, target, drop }) => {
8379
+ const files = run3.store.crmFiles;
8380
+ const prefix = `${folder}${sep}`;
8381
+ const earlier = await files.get(run3.account, own);
8382
+ let total = await files.storedBytes(run3.account, prefix) - (earlier?.localPath?.startsWith(prefix) ? earlier.size ?? 0 : 0);
8383
+ if (total + need <= capBytes)
8384
+ return true;
8385
+ const droppable = (await files.droppable(run3.account, prefix)).filter((one) => one.externalId !== own && one.localPath !== target);
8386
+ if (total - droppable.reduce((sum, one) => sum + (one.size ?? 0), 0) + need > capBytes)
8387
+ return false;
8388
+ if (!drop)
8389
+ return true;
8390
+ for (const one of droppable) {
8391
+ if (one.localPath)
8392
+ rmSync(one.localPath, { force: true });
8393
+ await files.forgetFile(run3.account, one.externalId);
8394
+ total -= one.size ?? 0;
8395
+ if (total + need <= capBytes)
8396
+ return true;
8397
+ }
8398
+ return false;
8399
+ }, "roomFor");
8400
+ var diskFull = /* @__PURE__ */ __name((limits, folder, setting) => new CliError("validation_error", `the CRM files folder ${folder} is at its ${limits.max_total_mb} MB even after dropping every file whose text is kept; raise ${setting} or free files there`, { reason: "crm.files-disk-full", limit: limits.max_total_mb, path: folder }), "diskFull");
8401
+ var targetOf = /* @__PURE__ */ __name((folder, file, earlier, held, capped) => {
8402
+ const providerId = segment(parseCrmFileId(file.id).providerId);
8403
+ const name = safeName(file.name) ?? `file-${providerId}`;
8404
+ const free = /* @__PURE__ */ __name((path) => path === earlier || !held.has(path) && !existsSync(path), "free");
8405
+ for (const candidate of [join2(folder, name), join2(folder, `${providerId}-${name}`)])
8406
+ if (free(candidate))
8407
+ return candidate;
8408
+ if (capped)
8409
+ for (let at2 = 2; ; at2 += 1) {
8410
+ const candidate = join2(folder, `${providerId}-${at2}-${name}`);
8411
+ if (free(candidate))
8412
+ return candidate;
8413
+ }
8414
+ throw new CliError("conflict", `${folder} already holds ${name} and ${providerId}-${name}: choose another --dir`, {
8415
+ reason: "crm.file-exists",
8416
+ path: folder
8417
+ });
8418
+ }, "targetOf");
8419
+ var downloadCrmFile = /* @__PURE__ */ __name(async (context, file, assignee, { capBytes, capMb, flag, dir, limits }) => {
8420
+ const { run: run3, app, now, signal } = context;
8421
+ if (file.size !== null && file.size > capBytes)
8422
+ throw tooLarge(file.id, file.size, capMb, flag);
8423
+ const top = accountFolder(app, run3);
8424
+ const folder = dir ? resolve(dir) : join2(top, segment(`${file.owner.kind}-${file.owner.id}`));
8425
+ const setting = `crm.${run3.account.provider}:${run3.account.account}.files.max_total_mb`;
8426
+ const capped = dir === void 0;
8427
+ const room = /* @__PURE__ */ __name((need, target2, drop) => roomFor(context, top, { need, capBytes: limits.max_total_mb * MB, own: file.id, target: target2, drop }), "room");
8428
+ if (capped && !await room(file.size ?? 0, null, false))
8429
+ throw diskFull(limits, top, setting);
8430
+ if (capped)
8431
+ ownFolder(join2(top, ".."), folder);
8432
+ else
8433
+ mkdirSync(folder, { recursive: true, mode: 448 });
8434
+ const earlier = await run3.store.crmFiles.get(run3.account, file.id);
8435
+ const held = new Set(await run3.store.crmFiles.savedPaths(run3.account));
8436
+ if (earlier?.localPath)
8437
+ held.delete(earlier.localPath);
8438
+ const target = targetOf(folder, file, earlier?.localPath ?? null, held, capped);
8439
+ const discard = /* @__PURE__ */ __name(async () => {
8440
+ rmSync(target, { force: true });
8441
+ if (earlier?.localPath === target)
8442
+ await run3.store.crmFiles.forgetFile(run3.account, file.id);
8443
+ }, "discard");
8444
+ let saved;
8445
+ try {
8446
+ saved = await saveStream(await file.open(signal), target, {
8447
+ cap: capBytes,
8448
+ ...signal ? { signal } : {},
8449
+ exclusive: !capped && target !== earlier?.localPath
8450
+ });
8451
+ } catch (error) {
8452
+ if (error instanceof TooLarge)
8453
+ throw tooLarge(file.id, file.size, capMb, flag);
8454
+ if (error instanceof Taken)
8455
+ throw new CliError("conflict", `a file appeared at the name ${file.id} was to take in ${folder}; run it again`, {
8456
+ reason: "crm.file-exists",
8457
+ path: folder
8458
+ });
8459
+ if (signal?.aborted)
8460
+ throw new CliError("timeout", `the download of ${file.id} was cut off at the time limit and nothing was kept: run it again with a longer --timeout, such as --timeout 10m`, { reason: "crm.file-unavailable" });
8461
+ throw new CliError(isCliError(error) ? error.code : "provider_error", `the CRM did not give the file ${file.id}, and nothing was kept`, { reason: "crm.file-unavailable" });
8462
+ }
8463
+ if (capped && !await room(saved.bytes, target, true)) {
8464
+ await discard();
8465
+ throw diskFull(limits, top, setting);
8466
+ }
8467
+ let bytes;
8468
+ try {
8469
+ bytes = readFileSync2(target);
8470
+ } catch {
8471
+ await discard();
8472
+ throw new CliError("not_found", `the saved copy of ${file.id} was removed before its text was read; run it again`, {
8473
+ reason: "crm.file-unavailable"
8474
+ });
8475
+ }
8476
+ const cutOff = /* @__PURE__ */ __name(async () => {
8477
+ await discard();
8478
+ return new CliError("cancelled", `the time limit stopped reading the text of ${file.id}, and nothing was kept: run it again with a longer --timeout, such as --timeout 10m`, { reason: "crm.file-unavailable" });
8479
+ }, "cutOff");
8480
+ let extraction;
8481
+ try {
8482
+ extraction = saved.bytes > attachmentMaxBytes(run3.env ?? process.env) ? { status: "too-large" } : await extractText(bytes, { kind: "file", name: file.name, mime: file.mime, path: target }, importEngine, signal, run3.env ?? process.env);
8483
+ } catch (error) {
8484
+ if (signal?.aborted)
8485
+ throw await cutOff();
8486
+ await discard();
8487
+ throw error;
8488
+ }
8489
+ if (signal?.aborted)
8490
+ throw await cutOff();
8491
+ const self = run3.source().self ? String(await run3.source().self?.()) : null;
8492
+ const row = {
8493
+ externalId: file.id,
8494
+ ownerKind: file.owner.kind,
8495
+ ownerId: file.owner.id,
8496
+ ownerAssignee: assignee === null ? null : crmIdentityId(run3.account, normalCrmUserId(assignee), "user"),
8497
+ source: file.source,
8498
+ name: file.name,
8499
+ mime: file.mime,
8500
+ size: saved.bytes,
8501
+ externalCreatedAt: file.created,
8502
+ localPath: target,
8503
+ contentSha256: saved.sha256,
8504
+ text: extraction.status === "extracted" ? extraction.text.slice(0, MAX_TEXT_CHARS) : null,
8505
+ extraction: extraction.status,
8506
+ extractionError: extraction.status === "unreadable" ? extraction.error : null,
8507
+ downloadedBy: self,
8508
+ downloadedAt: now()
8509
+ };
8510
+ await run3.store.crmFiles.save(run3.account, row);
8511
+ if (earlier?.localPath && earlier.localPath !== target && earlier.localPath.startsWith(`${top}${sep}`))
8512
+ rmSync(earlier.localPath, { force: true });
8513
+ return { row, textStatus: extraction.status };
8514
+ }, "downloadCrmFile");
8515
+ var itemOfFile = /* @__PURE__ */ __name((file, saved) => {
8516
+ const listed2 = "owner" in file;
8517
+ return {
8518
+ id: listed2 ? file.id : file.externalId,
8519
+ name: file.name,
8520
+ size: file.size,
8521
+ mime: file.mime,
8522
+ created_at: iso4(listed2 ? file.created : file.externalCreatedAt),
8523
+ owner: listed2 ? { kind: file.owner.kind, id: file.owner.id } : { kind: file.ownerKind, id: file.ownerId },
8524
+ source: file.source,
8525
+ downloaded: saved !== void 0 && saved.localPath !== null,
8526
+ path: saved?.localPath ?? null,
8527
+ untrusted: ["name", "mime", "path"]
8528
+ };
8529
+ }, "itemOfFile");
8530
+ var addCrmFileCommands = /* @__PURE__ */ __name((program, options) => {
8531
+ const { within, example, app, now } = options;
8532
+ const kinds = OWNER_FLAGS.filter(([kind]) => kind !== "lead" || options.leads !== false);
8533
+ const contextOf3 = /* @__PURE__ */ __name((run3, command) => {
8534
+ const { signal } = environmentOf(command);
8535
+ return { app, run: run3, now, ...signal ? { signal } : {} };
8536
+ }, "contextOf");
8537
+ const group = annotate(program.command("files"), { effects: REMOTE_READ }).description("the files of the CRM's deals, leads, contacts and companies: listed live, downloaded on demand, their text found by search all");
8538
+ const list = example(answerEntity(annotate(group.command("list"), { effects: REMOTE_READ, offline: false }), "crm_file", crmFile).description("one record's files, read live from the CRM, with the path of each already downloaded; another user's record counts toward the day's limit when the CRM sets one"), "files list --deal 12", "files list --person 42 --json");
8539
+ for (const [, flag] of kinds)
8540
+ list.option(flag, `the ${flag.slice(2, flag.indexOf(" "))} whose files to list`);
8541
+ list.action(async (opts, command) => {
8542
+ const given = kinds.filter(([kind]) => opts[kind] !== void 0);
8543
+ const [chosen] = given;
8544
+ if (given.length !== 1 || !chosen)
8545
+ throw new CliError("validation_error", `name one record: ${kinds.map(([, flag]) => flag).join(", ")}`, {
8546
+ reason: "ref.malformed"
8547
+ });
8548
+ const owner = { kind: chosen[0], id: String(opts[chosen[0]]).trim() };
8549
+ await within(command, async (run3) => {
8550
+ const context = contextOf3(run3, command);
8551
+ const gaps = [];
8552
+ const found = await listed(context, owner, gaps);
8553
+ await quotaOf(context).spend(owner.kind, { externalId: owner.id, assignee: found.assignee });
8554
+ const saved = new Map((await run3.store.crmFiles.ofOwner(run3.account, owner.kind, owner.id)).map((one) => [one.externalId, one]));
8555
+ for (const gap of gaps)
8556
+ outputFor(command).renderer.note(gap.message);
8557
+ const items = found.files.map((file) => itemOfFile(file, saved.get(file.id)));
8558
+ return listOf("files list", {
8559
+ items,
8560
+ limit: Math.max(1, items.length),
8561
+ page: 1,
8562
+ has_more: false,
8563
+ ...gaps.length ? {
8564
+ meta: {
8565
+ complete: false,
8566
+ issues: gaps.map((gap) => ({
8567
+ code: "permission_error",
8568
+ reason: "crm.scope-missing",
8569
+ source: `crm:files${gap.scope ? `/${gap.scope}` : ""}`
8570
+ }))
8571
+ }
8572
+ } : {}
8573
+ });
8574
+ });
8575
+ });
8576
+ example(answerEntity(annotate(group.command("download"), { effects: FETCH, offline: false }), "crm_file_download", crmFileDownload).description(`save one file under the state folder (or --dir) and read its text, which search all then finds; ${DOWNLOAD_MB} MB at most unless --max-size; another user's record counts toward the day's limit`).argument("<file>", "the file's id, as files list prints it").option("--max-size <MB>", `the largest file to take, up to ${MOST_DOWNLOAD_MB}`, integer(MOST_DOWNLOAD_MB)).option("--dir <folder>", "save it here instead, as the owner's own copy: not counted, never dropped"), "files download deal:12:record:345", "files download deal:12:document:7 --max-size 500 --dir ~/Contracts").action(async (given, opts, command) => {
8577
+ const id = given.trim().replace(/^crmfile:/u, "");
8578
+ const { owner } = parseCrmFileId(id);
8579
+ const capMb = opts.maxSize ?? DOWNLOAD_MB;
8580
+ await within(command, async (run3) => {
8581
+ const context = contextOf3(run3, command);
8582
+ const found = await listed(context, owner);
8583
+ await quotaOf(context).spend(owner.kind, { externalId: owner.id, assignee: found.assignee });
8584
+ const file = found.files.find((one) => one.id === id);
8585
+ if (!file)
8586
+ throw new CliError("not_found", `${owner.kind} ${owner.id} has no file ${id}; files list names them`);
8587
+ const done = await downloadCrmFile(context, file, found.assignee, {
8588
+ capBytes: capMb * MB,
8589
+ capMb,
8590
+ flag: capMb < MOST_DOWNLOAD_MB,
8591
+ limits: await run3.store.crmFiles.limits(run3.account),
8592
+ ...opts.dir === void 0 ? {} : { dir: opts.dir }
8593
+ });
8594
+ const text2 = done.row.text;
8595
+ return itemOf({
8596
+ ...itemOfFile(file, done.row),
8597
+ size: done.row.size,
8598
+ text_status: done.textStatus,
8599
+ text: text2 === null ? null : text2.slice(0, SHOWN_TEXT),
8600
+ text_truncated: text2 !== null && text2.length > SHOWN_TEXT,
8601
+ untrusted: ["name", "mime", "path", "text"]
8602
+ });
8603
+ });
8604
+ });
8605
+ example(answerEntity(annotate(group.command("sync"), { effects: FETCH, offline: false, cooperative: true, partial: true }), "crm_files_sync", crmFilesSync).description(`download the files of your own deals and leads that changed lately, newest first, within the account's files.* limits; stops at its deadline and the next run goes on. Never another user's files. Run it on a schedule: ${app.command} schedule command crm-files --every 1h -- files sync`), "files sync").action(async (_opts, command) => {
8606
+ const level = commandLevel(command, app, FILES_DOWNLOAD_KEY);
8607
+ if (level === "deny" || level === "readonly")
8608
+ throw new CliError("permission_error", `files sync downloads files, which ${FILES_DOWNLOAD_KEY} ${level}s`, {
8609
+ reason: "crm.files-denied",
8610
+ permission: FILES_DOWNLOAD_KEY
8611
+ });
8612
+ const budget = runBudgetOf(command);
8613
+ await within(command, async (run3) => {
8614
+ const report = await syncFiles(contextOf3(run3, command), () => budget.take() !== null);
8615
+ const next = report.complete ? void 0 : [
8616
+ {
8617
+ kind: "command",
8618
+ step: "crm.files-sync",
8619
+ command: "files sync",
8620
+ args: {},
8621
+ why: "the run stopped at a limit; the next run goes on from there",
8622
+ safe_to_auto_execute: true
8623
+ }
8624
+ ];
8625
+ return itemOf({
8626
+ ...report,
8627
+ skipped: report.skipped.map((one) => ({ ...one, step: lineOf(command, `files download ${one.id}`) })),
8628
+ untrusted: ["downloaded.name", "downloaded.path", "skipped.name"]
8629
+ }, { ...report.complete ? {} : { meta: { complete: false } }, ...next ? { next } : {} });
8630
+ });
8631
+ });
8632
+ }, "addCrmFileCommands");
8633
+ var MOST_TRIES = 3;
8634
+ var roundOf = /* @__PURE__ */ __name(async (run3) => {
8635
+ try {
8636
+ const found = JSON.parse((await run3.store.sync.syncState(run3.account, FILES_ROUND))?.value ?? "null");
8637
+ if (found && Array.isArray(found.done))
8638
+ return found;
8639
+ } catch {
8640
+ }
8641
+ return { after: null, started: null, done: [] };
8642
+ }, "roundOf");
8643
+ var syncFiles = /* @__PURE__ */ __name(async (context, outOfTime, deadline = (ms) => AbortSignal.timeout(ms)) => {
8644
+ const { run: run3, now } = context;
8645
+ const source = run3.source();
8646
+ if (!source.self)
8647
+ throw new CliError("configuration_error", "this CRM names no user for the sign-in, so no deal is yours");
8648
+ const self = normalCrmUserId(String(await source.self()));
8649
+ const limits = await run3.store.crmFiles.limits(run3.account);
8650
+ const started = now();
8651
+ const ends = started + limits.run_minutes * 6e4;
8652
+ const round = await roundOf(run3);
8653
+ const roundStart = round.started ?? started;
8654
+ const since = Math.max(round.after ?? 0, roundStart - limits.days * DAY3);
8655
+ const assignee = crmIdentityId(run3.account, self, "user");
8656
+ const candidates = [];
8657
+ for (const kind of ["deal", "lead"])
8658
+ for (let offset = 0; ; offset += PAGE) {
8659
+ const found = await run3.store.deals.list({
8660
+ kind,
8661
+ account: run3.account,
8662
+ owner: assignee,
8663
+ updated: { since },
8664
+ limit: PAGE,
8665
+ offset
8666
+ });
8667
+ for (const one of found.items)
8668
+ candidates.push({ kind, id: one.externalId ?? "", updated: Date.parse(one.updatedAt) });
8669
+ if (!found.hasMore)
8670
+ break;
8671
+ }
8672
+ const owners = candidates.filter((one) => one.id && !round.done.includes(`${one.kind}:${one.id}`)).sort((a, b) => b.updated - a.updated);
8673
+ const report = { owners: owners.length, downloaded: [], skipped: [], complete: true };
8674
+ const done = [...round.done];
8675
+ let retry = false;
8676
+ const tries = { ...round.tries ?? {} };
8677
+ let runBytes = 0;
8678
+ const stop = /* @__PURE__ */ __name((reason, file) => {
8679
+ report.skipped.push({ id: file.id, name: file.name, size: file.size, reason });
8680
+ report.stopped = reason;
8681
+ report.complete = false;
8682
+ }, "stop");
8683
+ outer: for (const owner of owners) {
8684
+ if (now() >= ends || outOfTime()) {
8685
+ report.stopped = "deadline";
8686
+ report.complete = false;
8687
+ break;
8688
+ }
8689
+ const found = await source.files?.({ kind: owner.kind, id: owner.id }, { spend: /* @__PURE__ */ __name(() => {
8690
+ }, "spend"), gap: /* @__PURE__ */ __name(() => {
8691
+ }, "gap") });
8692
+ if (!found || found.assignee === null || normalCrmUserId(found.assignee) !== self) {
8693
+ done.push(`${owner.kind}:${owner.id}`);
8694
+ continue;
8695
+ }
8696
+ const files = [...found.files].sort((a, b) => (b.created ?? 0) - (a.created ?? 0));
8697
+ let available = true;
8698
+ for (const file of files) {
8699
+ if (await run3.store.crmFiles.get(run3.account, file.id))
8700
+ continue;
8701
+ const fileCap = limits.max_file_mb * MB;
8702
+ if (file.size !== null && file.size > fileCap) {
8703
+ report.skipped.push({ id: file.id, name: file.name, size: file.size, reason: "too-large" });
8704
+ continue;
8705
+ }
8706
+ if (report.downloaded.length >= limits.max_files) {
8707
+ stop("run-files", file);
8708
+ break outer;
8709
+ }
8710
+ const left = limits.max_run_mb * MB - runBytes;
8711
+ if (file.size !== null && file.size > left) {
8712
+ stop("run-mb", file);
8713
+ break outer;
8714
+ }
8715
+ if (now() >= ends || outOfTime()) {
8716
+ stop("deadline", file);
8717
+ break outer;
8718
+ }
8719
+ const remaining = deadline(Math.max(1, ends - now()));
8720
+ const signal = context.signal ? AbortSignal.any([context.signal, remaining]) : remaining;
8721
+ try {
8722
+ const saved = await downloadCrmFile({ ...context, signal }, file, found.assignee, {
8723
+ capBytes: Math.min(fileCap, left),
8724
+ capMb: limits.max_file_mb,
8725
+ flag: false,
8726
+ limits
8727
+ });
8728
+ delete tries[file.id];
8729
+ runBytes += saved.row.size ?? 0;
8730
+ report.downloaded.push({
8731
+ id: file.id,
8732
+ name: file.name,
8733
+ size: saved.row.size ?? 0,
8734
+ path: saved.row.localPath ?? "",
8735
+ text_status: saved.textStatus
8736
+ });
8737
+ } catch (error) {
8738
+ const reason = isCliError(error) ? error.details.reason : void 0;
8739
+ if (reason === "crm.files-disk-full") {
8740
+ stop("disk-full", file);
8741
+ break outer;
8742
+ }
8743
+ if (reason === "crm.file-too-large") {
8744
+ if (left < fileCap) {
8745
+ stop("run-mb", file);
8746
+ break outer;
8747
+ }
8748
+ report.skipped.push({ id: file.id, name: file.name, size: file.size, reason: "too-large" });
8749
+ continue;
8750
+ }
8751
+ if (signal.aborted || isCliError(error) && error.code === "timeout") {
8752
+ stop("deadline", file);
8753
+ break outer;
8754
+ }
8755
+ report.skipped.push({ id: file.id, name: file.name, size: file.size, reason: "unavailable" });
8756
+ tries[file.id] = (tries[file.id] ?? 0) + 1;
8757
+ if ((tries[file.id] ?? 0) < MOST_TRIES)
8758
+ available = false;
8759
+ }
8760
+ }
8761
+ if (available)
8762
+ done.push(`${owner.kind}:${owner.id}`);
8763
+ else
8764
+ retry = true;
8765
+ }
8766
+ const next = report.complete && !retry ? { after: roundStart, started: null, done: [] } : { after: round.after, started: roundStart, done, tries };
8767
+ await run3.store.sync.setSyncState(run3.account, FILES_ROUND, JSON.stringify(next));
8768
+ return report;
8769
+ }, "syncFiles");
8770
+
8771
+ // node_modules/.pnpm/@wirecat+cli-core@0.699.0_@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typ_13ea275dd452fd1070c59d86b8d8c388/node_modules/@wirecat/cli-core/dist/crm/cli/pipeline-view.js
8215
8772
  var sumOf = /* @__PURE__ */ __name((amounts) => amounts.map(({ amount, currency }) => `${groupDigits(amount)} ${currency}`).join(", ") || "\u2014", "sumOf");
8216
8773
  var percent = /* @__PURE__ */ __name((share) => share === null ? "\u2014" : `${Math.round(share * 100)}%`, "percent");
8217
8774
  var openStages = /* @__PURE__ */ __name((stages) => {
@@ -8257,7 +8814,7 @@ ${outcomes.join("\n")}`
8257
8814
  ].join("\n\n");
8258
8815
  }, "pipelineView");
8259
8816
 
8260
- // node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/crm/cli/search-all.js
8817
+ // node_modules/.pnpm/@wirecat+cli-core@0.699.0_@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typ_13ea275dd452fd1070c59d86b8d8c388/node_modules/@wirecat/cli-core/dist/crm/cli/search-all.js
8261
8818
  var SEARCHED = ["crm", ...SOURCE_SEARCHED];
8262
8819
  var DEFAULT_LIMIT = 20;
8263
8820
  var addCrmSearchAll = /* @__PURE__ */ __name((searches, { within, app, example, viewerOf: viewerOf2 }) => {
@@ -8271,7 +8828,7 @@ var addCrmSearchAll = /* @__PURE__ */ __name((searches, { within, app, example,
8271
8828
  throw new CliError("permission_error", "this process is locked to one profile; search all reads its own CRM account only, without --source", { reason: "profile.locked" });
8272
8829
  const asked = opts.only ?? SEARCHED;
8273
8830
  const denied = deniedKinds(leaf, app, [
8274
- ...asked.includes("crm") ? DEAL_KINDS : [],
8831
+ ...asked.includes("crm") ? [...DEAL_KINDS, "crm_file"] : [],
8275
8832
  ...asked.filter((one) => one !== "crm" && one !== "mail")
8276
8833
  ]);
8277
8834
  const out = new Set(denied.map(({ kind }) => kind));
@@ -8299,7 +8856,8 @@ var addCrmSearchAll = /* @__PURE__ */ __name((searches, { within, app, example,
8299
8856
  only,
8300
8857
  ...opts.only?.includes("meetings") ? { meetingsAsked: true } : {},
8301
8858
  ...crmKinds.length < DEAL_KINDS.length ? { crmKinds } : {},
8302
- ...viewers.length ? { crmViewers: viewers } : {},
8859
+ crmViewers: viewers,
8860
+ ...out.has("crm_file") ? { crmFiles: false } : {},
8303
8861
  ...opts.source === void 0 ? {} : { source: opts.source },
8304
8862
  ...alone ? { scope: { crm: [run3.account] } } : {}
8305
8863
  }, { app, hintCommand: commandAt(rootOf2(leaf), "models download") ? app.command : null }, void 0, meaningLane({ env, messenger: { app }, store: /* @__PURE__ */ __name(async () => run3.store, "store") }));
@@ -8322,15 +8880,15 @@ var addCrmSearchAll = /* @__PURE__ */ __name((searches, { within, app, example,
8322
8880
  });
8323
8881
  }, "addCrmSearchAll");
8324
8882
 
8325
- // node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/crm/cli/store.js
8326
- import { mkdtempSync, rmSync } from "node:fs";
8883
+ // node_modules/.pnpm/@wirecat+cli-core@0.699.0_@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typ_13ea275dd452fd1070c59d86b8d8c388/node_modules/@wirecat/cli-core/dist/crm/cli/store.js
8884
+ import { mkdtempSync, rmSync as rmSync2 } from "node:fs";
8327
8885
  import { tmpdir } from "node:os";
8328
- import { join as join2 } from "node:path";
8886
+ import { join as join3 } from "node:path";
8329
8887
  var openCrmStore = /* @__PURE__ */ __name(async (options) => {
8330
- const { app, env, profile, readOnly, open } = options;
8888
+ const { app, env, profile, readOnly, open: open2 } = options;
8331
8889
  const locked = readOnly && readOnlyLockOf(app, env) !== void 0;
8332
8890
  if (readOnly) {
8333
- const store = await open(env, { readOnly: true }).catch((error) => {
8891
+ const store = await open2(env, { readOnly: true }).catch((error) => {
8334
8892
  if (locked && !(isCliError(error) && error.code === "not_found"))
8335
8893
  throw error;
8336
8894
  return void 0;
@@ -8344,10 +8902,10 @@ var openCrmStore = /* @__PURE__ */ __name(async (options) => {
8344
8902
  }
8345
8903
  if (!locked)
8346
8904
  return withProfile(options, env, options.account());
8347
- const folder = mkdtempSync(join2(tmpdir(), `${app.command}-empty-`));
8348
- const removing = /* @__PURE__ */ __name(() => rmSync(folder, { recursive: true, force: true }), "removing");
8905
+ const folder = mkdtempSync(join3(tmpdir(), `${app.command}-empty-`));
8906
+ const removing = /* @__PURE__ */ __name(() => rmSync2(folder, { recursive: true, force: true }), "removing");
8349
8907
  try {
8350
- const empty = await withProfile(options, { ...env, MESSAGING_STORE: join2(folder, "wirecat.db") }, {
8908
+ const empty = await withProfile(options, { ...env, MESSAGING_STORE: join3(folder, "wirecat.db") }, {
8351
8909
  provider: options.provider,
8352
8910
  account: profile
8353
8911
  });
@@ -8359,8 +8917,8 @@ var openCrmStore = /* @__PURE__ */ __name(async (options) => {
8359
8917
  throw error;
8360
8918
  }
8361
8919
  }, "openCrmStore");
8362
- var withProfile = /* @__PURE__ */ __name(async ({ app, profile, open }, env, account) => {
8363
- const store = await open(env);
8920
+ var withProfile = /* @__PURE__ */ __name(async ({ app, profile, open: open2 }, env, account) => {
8921
+ const store = await open2(env);
8364
8922
  try {
8365
8923
  await store.accounts.saveAccount(account, { name: null, scope: "work" });
8366
8924
  await store.accounts.saveProfile(app.command, profile, account);
@@ -8371,7 +8929,7 @@ var withProfile = /* @__PURE__ */ __name(async ({ app, profile, open }, env, acc
8371
8929
  }
8372
8930
  }, "withProfile");
8373
8931
 
8374
- // node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/crm/cli/index.js
8932
+ // node_modules/.pnpm/@wirecat+cli-core@0.699.0_@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typ_13ea275dd452fd1070c59d86b8d8c388/node_modules/@wirecat/cli-core/dist/crm/cli/index.js
8375
8933
  var MOST4 = 500;
8376
8934
  var STAGE_REF = /^stage:\d+$/;
8377
8935
  var timeField = /* @__PURE__ */ __name((name, example, relation) => nativeField({ name, type: "time", operators: ["term", "range"], example, relation }), "timeField");
@@ -8880,14 +9438,14 @@ var addCrmCommandsDefinition = /* @__PURE__ */ __name((program, options) => {
8880
9438
  })
8881
9439
  ] : all;
8882
9440
  const rules = await run3.store.crm.stageTasks(run3.account);
8883
- const found = chosen.flatMap((pipeline) => pipeline.stages.map(({ name, position, outcome, externalId, open }) => {
9441
+ const found = chosen.flatMap((pipeline) => pipeline.stages.map(({ name, position, outcome, externalId, open: open2 }) => {
8884
9442
  const rule = externalId === null ? void 0 : rules[pipeline.kind][externalId];
8885
9443
  return {
8886
9444
  name,
8887
9445
  position,
8888
9446
  outcome,
8889
9447
  externalId,
8890
- open,
9448
+ open: open2,
8891
9449
  pipeline: pipeline.ref,
8892
9450
  pipelineName: pipeline.name,
8893
9451
  kind: pipeline.kind,
@@ -8913,6 +9471,8 @@ var addCrmCommandsDefinition = /* @__PURE__ */ __name((program, options) => {
8913
9471
  now
8914
9472
  });
8915
9473
  addCrmChangeCommands(program, { ...options, within, example, now, ownerOf, pathOf });
9474
+ if (options.files)
9475
+ addCrmFileCommands(program, { ...options, within, example, now });
8916
9476
  const fieldKinds = Object.keys(FIELD_KINDS).filter((word) => word !== "leads" || options.leads !== false);
8917
9477
  const fields = annotate(program.command("fields"), { effects: NO_EFFECTS }).description("the CRM's own fields on deals, leads, people and organizations, as last synced");
8918
9478
  example(withQuery(answerEntity(annotate(fields.command("list"), { effects: LOCAL_READ }), "crm_field", crmField).description("the CRM's custom fields of one kind, in its order, with a list field's options").argument("<kind>", fieldKinds.join(", ")).option("--limit <n>", `fields per page, 1\u2013${MOST4}`, integer(MOST4), 50).option("--page <n>", "which page, starting at 1", integer(1e6)).option("--all", "every field, no paging"), FIELDS_QUERY), "fields list deals", "fields list people --json").action(async (kind, words, opts, command) => {
@@ -8943,7 +9503,7 @@ var addCrmCommands = honoursDryRun(sharedCommand(addCrmCommandsDefinition));
8943
9503
 
8944
9504
  // dist/commands/crm-shared.js
8945
9505
  var savedAccount = /* @__PURE__ */ __name(async (env, profile) => {
8946
- const { openHubspotStore } = await import("./store-CCDNUB6A.js");
9506
+ const { openHubspotStore } = await import("./store-HXA2MRWI.js");
8947
9507
  const store = await openHubspotStore(env, { readOnly: true }).catch(() => void 0);
8948
9508
  if (!store)
8949
9509
  return void 0;
@@ -8957,9 +9517,10 @@ var savedAccount = /* @__PURE__ */ __name(async (env, profile) => {
8957
9517
  }, "savedAccount");
8958
9518
  var openProfile = /* @__PURE__ */ __name(async (command, { readOnly }) => {
8959
9519
  const { env, profile, environment } = contextOf(command);
8960
- const [{ openHubspotStore, PROVIDER: PROVIDER2 }, { hubspotCrmSource }] = await Promise.all([
8961
- import("./store-CCDNUB6A.js"),
8962
- import("./source-A3SBLHC4.js")
9520
+ const [{ openHubspotStore, PROVIDER: PROVIDER2 }, { hubspotCrmSource }, { hubspotCrmWriter }] = await Promise.all([
9521
+ import("./store-HXA2MRWI.js"),
9522
+ import("./source-VHDK74YS.js"),
9523
+ import("./writer-CZYA657G.js")
8963
9524
  ]);
8964
9525
  const fromToken = fromEnvironment(command);
8965
9526
  const online = metaOf(command).effects?.remote !== "none";
@@ -8989,6 +9550,7 @@ var openProfile = /* @__PURE__ */ __name(async (command, { readOnly }) => {
8989
9550
  account: accountOf
8990
9551
  });
8991
9552
  let source;
9553
+ const crm = /* @__PURE__ */ __name(() => source ??= hubspotCrmSource(hub, environment.now ? { now: environment.now } : {}), "crm");
8992
9554
  return {
8993
9555
  profile,
8994
9556
  account,
@@ -8998,7 +9560,17 @@ var openProfile = /* @__PURE__ */ __name(async (command, { readOnly }) => {
8998
9560
  store,
8999
9561
  env,
9000
9562
  locked: Boolean(env[`${IDENTITY.envPrefix}_PROFILE_LOCK`]),
9001
- source: /* @__PURE__ */ __name(() => source ??= hubspotCrmSource(hub, environment.now ? { now: environment.now } : {}), "source"),
9563
+ source: crm,
9564
+ // No `self`: the key is the account's, so every `--owner` gives the record to someone else (crm.assign-others).
9565
+ writes: /* @__PURE__ */ __name(() => ({
9566
+ writer: hubspotCrmWriter(hub, crm),
9567
+ app: IDENTITY,
9568
+ env,
9569
+ warn: outputFor(command).renderer.warn,
9570
+ alsoChecks: crmApiKeys,
9571
+ // contextOf, not resolveSettings: it carries the levels `mcp serve --permission` tightened.
9572
+ settings: /* @__PURE__ */ __name(() => ({ ...contextOf(command).settings, permissionDefaults: permissions.defaults }), "settings")
9573
+ }), "writes"),
9002
9574
  close: /* @__PURE__ */ __name(() => store.close(), "close")
9003
9575
  };
9004
9576
  }, "openProfile");
@@ -9008,6 +9580,7 @@ var crmSharedCommands = /* @__PURE__ */ __name(() => {
9008
9580
  app: IDENTITY,
9009
9581
  open: openProfile,
9010
9582
  leads: true,
9583
+ writes: HUBSPOT_WRITES,
9011
9584
  live: ["person", "organization", "user"],
9012
9585
  activities: true
9013
9586
  });
@@ -9024,16 +9597,16 @@ var scheduleCommand = /* @__PURE__ */ __name(() => scheduleCommandFor({ app: IDE
9024
9597
  // dist/setup/texts.en.json
9025
9598
  var texts_en_default = {
9026
9599
  "key.title": "Make a key",
9027
- "key.intro": "hubspot reads your deals, contacts and companies from one HubSpot account. It changes nothing there.",
9600
+ "key.intro": "hubspot reads your deals, contacts and companies from one HubSpot account. It changes them only if you give the key the write scopes too.",
9028
9601
  "key.service": "A super admin, or a user with HubSpot's **Developer tools access** permission, does this once in HubSpot:\n\n1. Open **Development**, then **Keys \u2192 Service keys** in the left menu. Some accounts show it under **Settings \u2192 Integrations \u2192 Service keys** instead.\n2. Click **Create service key** and name it *WireCat*.\n3. Click **Add new scope**, tick each read scope below, and click **Update**. A key gets only the scopes its maker has.\n4. Click **Create** and confirm.\n\nHubSpot's guide: https://developers.hubspot.com/docs/apps/developer-platform/build-apps/authentication/account-service-keys\n\nThe read scopes:",
9029
- "key.leads": "On Sales Hub Professional or Enterprise, add `crm.objects.leads.read` to read leads too. Add `tickets` if you want `api` to read tickets.",
9602
+ "key.leads": "On Sales Hub Professional or Enterprise, add `crm.objects.leads.read` to read leads too. Add `tickets` if you want `api` to read tickets. To let hubspot change records, add `crm.objects.contacts.write`, `crm.objects.companies.write` and `crm.objects.deals.write`; without them the key only reads.",
9030
9603
  "key.private.title": "Already have a legacy private app?",
9031
9604
  "key.private": "HubSpot stopped new private apps on 26 October 2026, but an existing one's token still works. Give it the same read scopes, then copy its access token from the app's **Auth** tab.",
9032
9605
  "token.title": "Paste the key",
9033
9606
  "token.where": "In **Keys \u2192 Service keys**, click the key's name, then **Show** and **Copy**. A private app's token is on its **Auth** tab. Both start with `pat-`.",
9034
9607
  "token.label": "Service key or access token",
9035
9608
  "token.hint": "Kept in your system keyring or, without one, in a file only you can read.",
9036
- "token.rights": "The key reads only what its scopes allow. Each profile signs in to its own HubSpot account: a second profile on the same account is refused.",
9609
+ "token.rights": "The key reads and changes only what its scopes allow. Each profile signs in to its own HubSpot account: a second profile on the same account is refused.",
9037
9610
  "check.title": "Checking the key",
9038
9611
  "check.body": "hubspot asks HubSpot which account the key belongs to. It saves the key only if HubSpot answers.",
9039
9612
  "failed.title": "The check did not pass",
@@ -9045,16 +9618,16 @@ var texts_en_default = {
9045
9618
  // dist/setup/texts.es.json
9046
9619
  var texts_es_default = {
9047
9620
  "key.title": "Crea una clave",
9048
- "key.intro": "hubspot lee tus negocios, contactos y empresas de una cuenta de HubSpot. No cambia nada en ella.",
9621
+ "key.intro": "hubspot lee tus negocios, contactos y empresas de una cuenta de HubSpot. Solo los cambia si le das a la clave tambi\xE9n los permisos de escritura.",
9049
9622
  "key.service": "Un superadministrador, o un usuario con el permiso **Developer tools access** de HubSpot, lo hace una vez en HubSpot:\n\n1. Abre **Development** y luego **Keys \u2192 Service keys** en el men\xFA de la izquierda. En algunas cuentas est\xE1 en **Settings \u2192 Integrations \u2192 Service keys**.\n2. Haz clic en **Create service key** y ll\xE1mala *WireCat*.\n3. Haz clic en **Add new scope**, marca cada permiso de lectura de abajo y haz clic en **Update**. Una clave solo recibe los permisos que tiene quien la crea.\n4. Haz clic en **Create** y confirma.\n\nGu\xEDa de HubSpot: https://developers.hubspot.com/docs/apps/developer-platform/build-apps/authentication/account-service-keys\n\nLos permisos de lectura:",
9050
- "key.leads": "Con Sales Hub Professional o Enterprise, a\xF1ade `crm.objects.leads.read` para leer tambi\xE9n los leads. A\xF1ade `tickets` si quieres que `api` lea los tickets.",
9623
+ "key.leads": "Con Sales Hub Professional o Enterprise, a\xF1ade `crm.objects.leads.read` para leer tambi\xE9n los leads. A\xF1ade `tickets` si quieres que `api` lea los tickets. Para que hubspot pueda cambiar registros, a\xF1ade `crm.objects.contacts.write`, `crm.objects.companies.write` y `crm.objects.deals.write`; sin ellos la clave solo lee.",
9051
9624
  "key.private.title": "\xBFYa tienes una aplicaci\xF3n privada antigua?",
9052
9625
  "key.private": "HubSpot dej\xF3 de crear aplicaciones privadas el 26 de octubre de 2026, pero el token de una que ya existe sigue funcionando. Dale los mismos permisos de lectura y copia su token de acceso de la pesta\xF1a **Auth** de la aplicaci\xF3n.",
9053
9626
  "token.title": "Pega la clave",
9054
9627
  "token.where": "En **Keys \u2192 Service keys**, haz clic en el nombre de la clave y luego en **Show** y **Copy**. El token de una aplicaci\xF3n privada est\xE1 en su pesta\xF1a **Auth**. Los dos empiezan por `pat-`.",
9055
9628
  "token.label": "Clave de servicio o token de acceso",
9056
9629
  "token.hint": "Se guarda en el llavero del sistema o, si no hay, en un archivo que solo t\xFA puedes leer.",
9057
- "token.rights": "La clave solo lee lo que permiten sus permisos. Cada perfil entra en su propia cuenta de HubSpot: se rechaza un segundo perfil en la misma cuenta.",
9630
+ "token.rights": "La clave solo lee y cambia lo que permiten sus permisos. Cada perfil entra en su propia cuenta de HubSpot: se rechaza un segundo perfil en la misma cuenta.",
9058
9631
  "check.title": "Comprobando la clave",
9059
9632
  "check.body": "hubspot pregunta a HubSpot a qu\xE9 cuenta pertenece la clave. Solo la guarda si HubSpot responde.",
9060
9633
  "failed.title": "La comprobaci\xF3n no ha pasado",
@@ -9066,16 +9639,16 @@ var texts_es_default = {
9066
9639
  // dist/setup/texts.ru.json
9067
9640
  var texts_ru_default = {
9068
9641
  "key.title": "\u0421\u043E\u0437\u0434\u0430\u0439\u0442\u0435 \u043A\u043B\u044E\u0447",
9069
- "key.intro": "hubspot \u0447\u0438\u0442\u0430\u0435\u0442 \u0432\u0430\u0448\u0438 \u0441\u0434\u0435\u043B\u043A\u0438, \u043A\u043E\u043D\u0442\u0430\u043A\u0442\u044B \u0438 \u043A\u043E\u043C\u043F\u0430\u043D\u0438\u0438 \u0438\u0437 \u043E\u0434\u043D\u043E\u0433\u043E \u0430\u043A\u043A\u0430\u0443\u043D\u0442\u0430 HubSpot. \u041D\u0438\u0447\u0435\u0433\u043E \u0432 \u043D\u0451\u043C \u043D\u0435 \u043C\u0435\u043D\u044F\u0435\u0442.",
9642
+ "key.intro": "hubspot \u0447\u0438\u0442\u0430\u0435\u0442 \u0432\u0430\u0448\u0438 \u0441\u0434\u0435\u043B\u043A\u0438, \u043A\u043E\u043D\u0442\u0430\u043A\u0442\u044B \u0438 \u043A\u043E\u043C\u043F\u0430\u043D\u0438\u0438 \u0438\u0437 \u043E\u0434\u043D\u043E\u0433\u043E \u0430\u043A\u043A\u0430\u0443\u043D\u0442\u0430 HubSpot. \u041C\u0435\u043D\u044F\u0435\u0442 \u0438\u0445, \u0442\u043E\u043B\u044C\u043A\u043E \u0435\u0441\u043B\u0438 \u0432\u044B \u0434\u0430\u0434\u0438\u0442\u0435 \u043A\u043B\u044E\u0447\u0443 \u0438 \u043F\u0440\u0430\u0432\u0430 \u043D\u0430 \u0437\u0430\u043F\u0438\u0441\u044C.",
9070
9643
  "key.service": "\u042D\u0442\u043E \u043E\u0434\u0438\u043D \u0440\u0430\u0437 \u0434\u0435\u043B\u0430\u0435\u0442 \u0441\u0443\u043F\u0435\u0440\u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440 \u0438\u043B\u0438 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C \u0441 \u043F\u0440\u0430\u0432\u043E\u043C HubSpot **Developer tools access** (\u043D\u0430\u0437\u0432\u0430\u043D\u0438\u044F \u0438\u0437 \u0430\u043D\u0433\u043B\u0438\u0439\u0441\u043A\u043E\u0433\u043E \u0438\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430):\n\n1. \u041E\u0442\u043A\u0440\u043E\u0439\u0442\u0435 **Development**, \u0437\u0430\u0442\u0435\u043C \u0432 \u043C\u0435\u043D\u044E \u0441\u043B\u0435\u0432\u0430 **Keys \u2192 Service keys**. \u0412 \u043D\u0435\u043A\u043E\u0442\u043E\u0440\u044B\u0445 \u0430\u043A\u043A\u0430\u0443\u043D\u0442\u0430\u0445 \u044D\u0442\u043E **Settings \u2192 Integrations \u2192 Service keys**.\n2. \u041D\u0430\u0436\u043C\u0438\u0442\u0435 **Create service key** \u0438 \u043D\u0430\u0437\u043E\u0432\u0438\u0442\u0435 \u043A\u043B\u044E\u0447 *WireCat*.\n3. \u041D\u0430\u0436\u043C\u0438\u0442\u0435 **Add new scope**, \u043E\u0442\u043C\u0435\u0442\u044C\u0442\u0435 \u043A\u0430\u0436\u0434\u043E\u0435 \u043F\u0440\u0430\u0432\u043E \u043D\u0430 \u0447\u0442\u0435\u043D\u0438\u0435 \u043D\u0438\u0436\u0435 \u0438 \u043D\u0430\u0436\u043C\u0438\u0442\u0435 **Update**. \u041A\u043B\u044E\u0447 \u043F\u043E\u043B\u0443\u0447\u0430\u0435\u0442 \u0442\u043E\u043B\u044C\u043A\u043E \u0442\u0435 \u043F\u0440\u0430\u0432\u0430, \u0447\u0442\u043E \u0435\u0441\u0442\u044C \u0443 \u0435\u0433\u043E \u0430\u0432\u0442\u043E\u0440\u0430.\n4. \u041D\u0430\u0436\u043C\u0438\u0442\u0435 **Create** \u0438 \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0435.\n\n\u0418\u043D\u0441\u0442\u0440\u0443\u043A\u0446\u0438\u044F HubSpot: https://developers.hubspot.com/docs/apps/developer-platform/build-apps/authentication/account-service-keys\n\n\u041F\u0440\u0430\u0432\u0430 \u043D\u0430 \u0447\u0442\u0435\u043D\u0438\u0435:",
9071
- "key.leads": "\u041D\u0430 Sales Hub Professional \u0438\u043B\u0438 Enterprise \u0434\u043E\u0431\u0430\u0432\u044C\u0442\u0435 `crm.objects.leads.read`, \u0447\u0442\u043E\u0431\u044B \u0447\u0438\u0442\u0430\u0442\u044C \u0438 \u043B\u0438\u0434\u044B. \u0414\u043E\u0431\u0430\u0432\u044C\u0442\u0435 `tickets`, \u0435\u0441\u043B\u0438 `api` \u0434\u043E\u043B\u0436\u0435\u043D \u0447\u0438\u0442\u0430\u0442\u044C \u0442\u0438\u043A\u0435\u0442\u044B.",
9644
+ "key.leads": "\u041D\u0430 Sales Hub Professional \u0438\u043B\u0438 Enterprise \u0434\u043E\u0431\u0430\u0432\u044C\u0442\u0435 `crm.objects.leads.read`, \u0447\u0442\u043E\u0431\u044B \u0447\u0438\u0442\u0430\u0442\u044C \u0438 \u043B\u0438\u0434\u044B. \u0414\u043E\u0431\u0430\u0432\u044C\u0442\u0435 `tickets`, \u0435\u0441\u043B\u0438 `api` \u0434\u043E\u043B\u0436\u0435\u043D \u0447\u0438\u0442\u0430\u0442\u044C \u0442\u0438\u043A\u0435\u0442\u044B. \u0427\u0442\u043E\u0431\u044B hubspot \u043C\u043E\u0433 \u043C\u0435\u043D\u044F\u0442\u044C \u0437\u0430\u043F\u0438\u0441\u0438, \u0434\u043E\u0431\u0430\u0432\u044C\u0442\u0435 `crm.objects.contacts.write`, `crm.objects.companies.write` \u0438 `crm.objects.deals.write`; \u0431\u0435\u0437 \u043D\u0438\u0445 \u043A\u043B\u044E\u0447 \u0442\u043E\u043B\u044C\u043A\u043E \u0447\u0438\u0442\u0430\u0435\u0442.",
9072
9645
  "key.private.title": "\u0423\u0436\u0435 \u0435\u0441\u0442\u044C \u0441\u0442\u0430\u0440\u043E\u0435 \u043F\u0440\u0438\u0432\u0430\u0442\u043D\u043E\u0435 \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0435?",
9073
9646
  "key.private": "HubSpot \u043F\u0435\u0440\u0435\u0441\u0442\u0430\u043B \u0441\u043E\u0437\u0434\u0430\u0432\u0430\u0442\u044C \u043F\u0440\u0438\u0432\u0430\u0442\u043D\u044B\u0435 \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u044F 26 \u043E\u043A\u0442\u044F\u0431\u0440\u044F 2026 \u0433\u043E\u0434\u0430, \u043D\u043E \u0442\u043E\u043A\u0435\u043D \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044E\u0449\u0435\u0433\u043E \u0440\u0430\u0431\u043E\u0442\u0430\u0435\u0442. \u0414\u0430\u0439\u0442\u0435 \u0435\u043C\u0443 \u0442\u0435 \u0436\u0435 \u043F\u0440\u0430\u0432\u0430 \u043D\u0430 \u0447\u0442\u0435\u043D\u0438\u0435 \u0438 \u0441\u043A\u043E\u043F\u0438\u0440\u0443\u0439\u0442\u0435 \u0442\u043E\u043A\u0435\u043D \u0434\u043E\u0441\u0442\u0443\u043F\u0430 \u043D\u0430 \u0432\u043A\u043B\u0430\u0434\u043A\u0435 **Auth** \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u044F.",
9074
9647
  "token.title": "\u0412\u0441\u0442\u0430\u0432\u044C\u0442\u0435 \u043A\u043B\u044E\u0447",
9075
9648
  "token.where": "\u0412 **Keys \u2192 Service keys** \u043D\u0430\u0436\u043C\u0438\u0442\u0435 \u043D\u0430 \u0438\u043C\u044F \u043A\u043B\u044E\u0447\u0430, \u0437\u0430\u0442\u0435\u043C **Show** \u0438 **Copy**. \u0422\u043E\u043A\u0435\u043D \u043F\u0440\u0438\u0432\u0430\u0442\u043D\u043E\u0433\u043E \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u044F \u043B\u0435\u0436\u0438\u0442 \u043D\u0430 \u0435\u0433\u043E \u0432\u043A\u043B\u0430\u0434\u043A\u0435 **Auth**. \u041E\u0431\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u044E\u0442\u0441\u044F \u0441 `pat-`.",
9076
9649
  "token.label": "\u0421\u0435\u0440\u0432\u0438\u0441\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0438\u043B\u0438 \u0442\u043E\u043A\u0435\u043D \u0434\u043E\u0441\u0442\u0443\u043F\u0430",
9077
9650
  "token.hint": "\u0425\u0440\u0430\u043D\u0438\u0442\u0441\u044F \u0432 \u0441\u0438\u0441\u0442\u0435\u043C\u043D\u043E\u0439 \u0441\u0432\u044F\u0437\u043A\u0435 \u043A\u043B\u044E\u0447\u0435\u0439, \u0430 \u0431\u0435\u0437 \u043D\u0435\u0451 \u0432 \u0444\u0430\u0439\u043B\u0435, \u043A\u043E\u0442\u043E\u0440\u044B\u0439 \u043C\u043E\u0436\u0435\u0442\u0435 \u043F\u0440\u043E\u0447\u0438\u0442\u0430\u0442\u044C \u0442\u043E\u043B\u044C\u043A\u043E \u0432\u044B.",
9078
- "token.rights": "\u041A\u043B\u044E\u0447 \u0447\u0438\u0442\u0430\u0435\u0442 \u0442\u043E\u043B\u044C\u043A\u043E \u0442\u043E, \u0447\u0442\u043E \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u044E\u0442 \u0435\u0433\u043E \u043F\u0440\u0430\u0432\u0430. \u041A\u0430\u0436\u0434\u044B\u0439 \u043F\u0440\u043E\u0444\u0438\u043B\u044C \u0432\u0445\u043E\u0434\u0438\u0442 \u0432 \u0441\u0432\u043E\u0439 \u0430\u043A\u043A\u0430\u0443\u043D\u0442 HubSpot: \u0432\u0442\u043E\u0440\u043E\u0439 \u043F\u0440\u043E\u0444\u0438\u043B\u044C \u043D\u0430 \u0442\u043E\u043C \u0436\u0435 \u0430\u043A\u043A\u0430\u0443\u043D\u0442\u0435 \u043E\u0442\u043A\u043B\u043E\u043D\u044F\u0435\u0442\u0441\u044F.",
9651
+ "token.rights": "\u041A\u043B\u044E\u0447 \u0447\u0438\u0442\u0430\u0435\u0442 \u0438 \u043C\u0435\u043D\u044F\u0435\u0442 \u0442\u043E\u043B\u044C\u043A\u043E \u0442\u043E, \u0447\u0442\u043E \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u044E\u0442 \u0435\u0433\u043E \u043F\u0440\u0430\u0432\u0430. \u041A\u0430\u0436\u0434\u044B\u0439 \u043F\u0440\u043E\u0444\u0438\u043B\u044C \u0432\u0445\u043E\u0434\u0438\u0442 \u0432 \u0441\u0432\u043E\u0439 \u0430\u043A\u043A\u0430\u0443\u043D\u0442 HubSpot: \u0432\u0442\u043E\u0440\u043E\u0439 \u043F\u0440\u043E\u0444\u0438\u043B\u044C \u043D\u0430 \u0442\u043E\u043C \u0436\u0435 \u0430\u043A\u043A\u0430\u0443\u043D\u0442\u0435 \u043E\u0442\u043A\u043B\u043E\u043D\u044F\u0435\u0442\u0441\u044F.",
9079
9652
  "check.title": "\u041F\u0440\u043E\u0432\u0435\u0440\u044F\u0435\u043C \u043A\u043B\u044E\u0447",
9080
9653
  "check.body": "hubspot \u0441\u043F\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0443 HubSpot, \u0447\u0435\u0439 \u0430\u043A\u043A\u0430\u0443\u043D\u0442 \u0443 \u044D\u0442\u043E\u0433\u043E \u043A\u043B\u044E\u0447\u0430. \u041A\u043B\u044E\u0447 \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u0441\u044F, \u0442\u043E\u043B\u044C\u043A\u043E \u0435\u0441\u043B\u0438 HubSpot \u043E\u0442\u0432\u0435\u0442\u0438\u0442.",
9081
9654
  "failed.title": "\u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u043D\u0435 \u043F\u0440\u043E\u0448\u043B\u0430",
@@ -9176,7 +9749,7 @@ var update = appUpdate({
9176
9749
  command: IDENTITY.command,
9177
9750
  version: IDENTITY.version,
9178
9751
  entry: new URL("../program.js", import.meta.url).href,
9179
- statePath: /* @__PURE__ */ __name((env) => join3(resolvePaths({ appName: IDENTITY.appName, prefix: IDENTITY.envPrefix, env }).state, "update-check.json"), "statePath"),
9752
+ statePath: /* @__PURE__ */ __name((env) => join4(resolvePaths({ appName: IDENTITY.appName, prefix: IDENTITY.envPrefix, env }).state, "update-check.json"), "statePath"),
9180
9753
  // biome-ignore lint/plugin/no-own-settings: the update check runs before any command exists to give baseContext
9181
9754
  enabled: /* @__PURE__ */ __name((env) => configuration.resolveSettings({}, { env, needsProfile: false }).updateCheck, "enabled"),
9182
9755
  offVariables: [`${IDENTITY.envPrefix}_NO_UPDATE_CHECK`]
@@ -9207,7 +9780,8 @@ var definition = /* @__PURE__ */ __name(() => ({
9207
9780
  { command: 'search all "kitchen"', does: "stored deals beside your other WireCat tools' data" },
9208
9781
  { command: 'people list "Anna"', does: "any contact, read live from the account" },
9209
9782
  { command: "activities list", does: "notes, calls, e-mails, meetings and tasks on your deals" },
9210
- { command: "api deals-list --limit 5", does: "any CRM read of HubSpot's API, one command per operation" }
9783
+ { command: "deals close deal:12 won", does: "close a deal won or lost in HubSpot, with the key's write scopes" },
9784
+ { command: "api deals-list --limit 5", does: "any operation of HubSpot's CRM API, one command per operation" }
9211
9785
  ],
9212
9786
  start: `${IDENTITY.command} work session start`
9213
9787
  },