@wirecat/hubspot-cli 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/README.md +75 -54
- package/contracts/wirecat.json +39 -13
- package/dist/bin/hubspot.js +2 -2
- package/dist/bundle/agent-XB35QVOK.js +40 -0
- package/dist/bundle/{all-profiles-JVEE4PXX.js → all-profiles-HFVXPMF6.js} +11 -11
- package/dist/bundle/{anthropic-6HT57GNF.js → anthropic-VE6WR6IN.js} +5 -5
- package/dist/bundle/{app-server-FOBFF6G6.js → app-server-GZ4DCQK7.js} +68 -68
- package/dist/bundle/{bun-GW443QB3.js → bun-2DHMKD34.js} +2 -2
- package/dist/bundle/{bun-sqlite-TGIAICDN.js → bun-sqlite-T5XTYL7L.js} +6 -6
- package/dist/bundle/{chunk-FK4LEJZM.js → chunk-24HPBWKZ.js} +63 -4
- package/dist/bundle/{chunk-4OPN3KCN.js → chunk-2I2KBCS6.js} +5 -5
- package/dist/bundle/{chunk-3BM6KBWP.js → chunk-2K5BAY32.js} +19 -19
- package/dist/bundle/{chunk-6ULR7N3T.js → chunk-2VUIJ5XB.js} +2 -2
- package/dist/bundle/{chunk-UHHXZKB2.js → chunk-3HS7JTPI.js} +27 -177
- package/dist/bundle/{chunk-3SRGN5MQ.js → chunk-3TLNO3VM.js} +2 -2
- package/dist/bundle/{chunk-ATGD64VO.js → chunk-3W5R3XAH.js} +8 -8
- package/dist/bundle/{chunk-CFQQTDSA.js → chunk-3WG4MTQI.js} +1 -1
- package/dist/bundle/{chunk-NL3RKJR6.js → chunk-3YTTWJKL.js} +1 -1
- package/dist/bundle/{chunk-5WKJFMC3.js → chunk-4UEYVM46.js} +4 -4
- package/dist/bundle/{chunk-5G4L6NQJ.js → chunk-5ILCAAY4.js} +35 -35
- package/dist/bundle/{chunk-ETKLP4VE.js → chunk-5IPB5WLB.js} +14 -14
- package/dist/bundle/{chunk-N4EIJ53V.js → chunk-5NIIXJV3.js} +2 -2
- package/dist/bundle/{chunk-QIFCH5DZ.js → chunk-5O5WYSSO.js} +1967 -654
- package/dist/bundle/{chunk-XMWMA2N5.js → chunk-5VTKBGPW.js} +90 -33
- package/dist/bundle/{chunk-M25KVDHA.js → chunk-5WDNG4QE.js} +7 -7
- package/dist/bundle/{chunk-WATDMTDC.js → chunk-67YPTVGP.js} +3 -3
- package/dist/bundle/{chunk-3MUHCLRY.js → chunk-6DABKZYH.js} +143 -8
- package/dist/bundle/{chunk-HVXOA4FO.js → chunk-745FMNI5.js} +1 -1
- package/dist/bundle/{chunk-5KLNBGPU.js → chunk-AKSWXRIU.js} +1 -1
- package/dist/bundle/{chunk-HM6AMYHR.js → chunk-AP3CWDRK.js} +2 -2
- package/dist/bundle/{chunk-HPRKSL5S.js → chunk-BM5F2ZNI.js} +2 -2
- package/dist/bundle/{chunk-FOLKK6FW.js → chunk-BU5CEMUH.js} +20 -14
- package/dist/bundle/{chunk-DBPFHJXX.js → chunk-CTN4DW2F.js} +4 -4
- package/dist/bundle/{chunk-QJHRRJKD.js → chunk-CU76ZACK.js} +3 -3
- package/dist/bundle/{chunk-7QH5BZUG.js → chunk-DIKUPU3T.js} +3 -3
- package/dist/bundle/{chunk-JWO3PB5Z.js → chunk-E27NRLJZ.js} +18 -18
- package/dist/bundle/{chunk-EU7AVWSX.js → chunk-EB53G4HO.js} +2 -2
- package/dist/bundle/{chunk-GJSHLF43.js → chunk-EJZIEBAR.js} +8 -8
- package/dist/bundle/{chunk-HQYJ66ZX.js → chunk-G6LDK6DJ.js} +18 -8
- package/dist/bundle/{chunk-VDAYIXV4.js → chunk-GEJI27GN.js} +6 -6
- package/dist/bundle/{chunk-XJVFXHDI.js → chunk-GHXTNKX2.js} +2 -2
- package/dist/bundle/{chunk-W5X37TBC.js → chunk-GR4HZBWO.js} +2 -2
- package/dist/bundle/{chunk-WBUVNKHJ.js → chunk-GWXTVO43.js} +7 -7
- package/dist/bundle/{chunk-2Q2XIXDL.js → chunk-H4W2OO35.js} +1 -1
- package/dist/bundle/{chunk-3LMW7U7F.js → chunk-H5HBZCEJ.js} +21 -8
- package/dist/bundle/{chunk-JKNUCEII.js → chunk-HX2BE7DO.js} +1 -1
- package/dist/bundle/{chunk-PQUZ2YDC.js → chunk-HYDXA624.js} +6 -6
- package/dist/bundle/{chunk-Z3YOKGVZ.js → chunk-HZIGGAC7.js} +2 -2
- package/dist/bundle/{chunk-AT43MYQL.js → chunk-I75ON7VM.js} +8 -8
- package/dist/bundle/{chunk-PKFLSX5F.js → chunk-ID4GJFE7.js} +8 -8
- package/dist/bundle/{chunk-A6PVEUGN.js → chunk-J2SCELII.js} +17 -17
- package/dist/bundle/{chunk-PMJCZIV4.js → chunk-J4FXBF44.js} +1 -1
- package/dist/bundle/{chunk-DG4RBKIV.js → chunk-J76CMNWQ.js} +1 -1
- package/dist/bundle/{chunk-MQACXJLG.js → chunk-JDCFHZNU.js} +10 -10
- package/dist/bundle/{chunk-K4DWBOO6.js → chunk-JFLKTYH5.js} +6 -6
- package/dist/bundle/{chunk-LS4S7PAP.js → chunk-K4Y2ZWOO.js} +3 -3
- package/dist/bundle/{chunk-5ZVYIA56.js → chunk-KDW7B7AR.js} +5 -5
- package/dist/bundle/{chunk-BXZRSXBL.js → chunk-KKMOKSS5.js} +3 -3
- package/dist/bundle/{chunk-EBJYK7UM.js → chunk-LHY5XGIR.js} +78 -63
- package/dist/bundle/{chunk-V23OHBGM.js → chunk-LTU4BQ4S.js} +3 -3
- package/dist/bundle/{chunk-LX7QMRRG.js → chunk-M3LRSN6J.js} +13 -13
- package/dist/bundle/{chunk-UIWWAT3C.js → chunk-MJ24YFXZ.js} +7 -7
- package/dist/bundle/{chunk-YYYRE4AV.js → chunk-MSQGZHKM.js} +32 -28
- package/dist/bundle/{chunk-6NUXFVJQ.js → chunk-NQOQG7L3.js} +1 -1
- package/dist/bundle/{chunk-WLFYEAZ6.js → chunk-PDVMYIBP.js} +1516 -745
- package/dist/bundle/{chunk-QODPEZC5.js → chunk-PR7ZDMGF.js} +10 -3
- package/dist/bundle/{chunk-2BCWK5BF.js → chunk-PZ3QJDTD.js} +8 -8
- package/dist/bundle/{chunk-OLDIP4CV.js → chunk-Q6AC7WLD.js} +3 -3
- package/dist/bundle/{chunk-X5U7GLHD.js → chunk-QH47G73D.js} +16 -3
- package/dist/bundle/{chunk-RFGIUCKU.js → chunk-QK5HQUHB.js} +3 -3
- package/dist/bundle/{chunk-3MPMYAII.js → chunk-R26OEZOL.js} +1 -1
- package/dist/bundle/{chunk-T3GZKV5A.js → chunk-RLK2EGQD.js} +21 -15
- package/dist/bundle/{chunk-Z4PY5BDP.js → chunk-RLNPTES2.js} +4 -4
- package/dist/bundle/{chunk-XCDRFC6G.js → chunk-T4MZJMEJ.js} +17 -17
- package/dist/bundle/{chunk-TAF4PKDS.js → chunk-TAPQZYXY.js} +1 -1
- package/dist/bundle/{chunk-AV2ZJ4WX.js → chunk-TCSVW7BA.js} +1 -1
- package/dist/bundle/{chunk-E33KM3DB.js → chunk-THGAVPRA.js} +11 -11
- package/dist/bundle/{chunk-XDDTJYGA.js → chunk-TRLV5NWZ.js} +2477 -2140
- package/dist/bundle/{chunk-5OBVICFK.js → chunk-TT75CEYZ.js} +22 -1
- package/dist/bundle/{chunk-7OJ43BAH.js → chunk-TXO4CJW3.js} +7 -7
- package/dist/bundle/{chunk-F4ZLRS4B.js → chunk-UCGZRZJA.js} +1 -1
- package/dist/bundle/{chunk-NLZADZ4F.js → chunk-UVGJL753.js} +61 -61
- package/dist/bundle/{chunk-VMF2UIQI.js → chunk-UZ2CL435.js} +3 -4
- package/dist/bundle/{chunk-IED6MKPU.js → chunk-V7N2K5OT.js} +33 -30
- package/dist/bundle/{chunk-QV4GDVBN.js → chunk-VR2CJFVL.js} +8 -8
- package/dist/bundle/{chunk-7JVKQ6NM.js → chunk-WASBOYI2.js} +4 -4
- package/dist/bundle/{chunk-F3HJ2E3P.js → chunk-WE4JSHIG.js} +6 -6
- package/dist/bundle/{chunk-FWW2CUXH.js → chunk-X2QRCFGJ.js} +4 -4
- package/dist/bundle/{chunk-V2B2OWTC.js → chunk-XRFYVVFU.js} +2 -2
- package/dist/bundle/{chunk-Q7DIEU6L.js → chunk-YDG5FIQB.js} +7 -9
- package/dist/bundle/{chunk-GOOXUCJW.js → chunk-YIH2A2PQ.js} +2 -2
- package/dist/bundle/{chunk-HM72O37C.js → chunk-ZERQSELP.js} +207 -163
- package/dist/bundle/{chunk-QNQ4V4UT.js → chunk-ZKTYTOF4.js} +8 -8
- package/dist/bundle/command-contract-5FXCYQUS.js +40 -0
- package/dist/bundle/{command-server-entry-OJQ55UA2.js → command-server-entry-H6IAJNOF.js} +28 -28
- package/dist/bundle/{decode-CDQDRPRJ.js → decode-TR2EC46M.js} +5 -5
- package/dist/bundle/{dispatch-JQBAZWCL.js → dispatch-B2EP6DDT.js} +8 -8
- package/dist/bundle/{echarts-GJ5JJG2A.js → echarts-7OP7I5B2.js} +2 -2
- package/dist/bundle/{embed-BUQXGMKR.js → embed-FLGS4LN7.js} +6 -6
- package/dist/bundle/{embedder-FCX6LE4O.js → embedder-JIXQXCP3.js} +9 -9
- package/dist/bundle/{failure-I6AAF5R5.js → failure-AOACEURF.js} +2 -2
- package/dist/bundle/{first-run-RPYEXXQK.js → first-run-XJ2NWIK2.js} +12 -12
- package/dist/bundle/first-screen-U73G5CMM.js +40 -0
- package/dist/bundle/hubspot.js +27 -25
- package/dist/bundle/{instructions-LPVTPERS.js → instructions-PYCYV6QE.js} +1 -1
- package/dist/bundle/{mcp-YGOAUNC3.js → mcp-ZNULRPZ4.js} +2 -2
- package/dist/bundle/meeting-combined-IHTM5H5B.js +25 -0
- package/dist/bundle/{meeting-model-TRGBEWCY.js → meeting-model-2PA5WJY5.js} +11 -11
- package/dist/bundle/{meeting-semantic-RSF5KNKD.js → meeting-semantic-5IH63QFV.js} +6 -6
- package/dist/bundle/{node-UAT3EIAP.js → node-6GTNIVBM.js} +2 -2
- package/dist/bundle/{node-sqlite-3HKDQNFD.js → node-sqlite-FBCEHPNT.js} +7 -7
- package/dist/bundle/{oauth-DYW2NSZP.js → oauth-BFP4SCL5.js} +7 -7
- package/dist/bundle/{open-KBRXJ5BC.js → open-MLU4MHGO.js} +5 -5
- package/dist/bundle/{openai-YNCLRTSK.js → openai-R7WJI6SO.js} +15 -15
- package/dist/bundle/{process-63BB7LKP.js → process-NMNQLJHZ.js} +1 -1
- package/dist/bundle/{program-VX52OB3O.js → program-Z735HPFG.js} +517 -343
- package/dist/bundle/{prompt-TWLJ3M2O.js → prompt-A6RM55Q4.js} +5 -5
- package/dist/bundle/{recognize-GQ6DLGE7.js → recognize-ORRDV45M.js} +4 -4
- package/dist/bundle/{remote-RKNSF3TT.js → remote-UF3WSC4X.js} +9 -9
- package/dist/bundle/{rerank-H4HSGQUJ.js → rerank-ZSJORUGH.js} +7 -7
- package/dist/bundle/{schemas-LDK7O6VW.js → schemas-EXBNVPMI.js} +1 -1
- package/dist/bundle/{serve-4ZNIAL7H.js → serve-4KBJ6SIA.js} +9 -9
- package/dist/bundle/{server-4G4QB3QN.js → server-IFK4S6LJ.js} +60 -60
- package/dist/bundle/server-MNUAZWTN.js +86 -0
- package/dist/bundle/source-PBCQAG4C.js +426 -0
- package/dist/bundle/{sqlite-runtime-C2JYC7JF.js → sqlite-runtime-XPDUWOPG.js} +6 -6
- package/dist/bundle/{state-3KDXCXHG.js → state-4M26H7NL.js} +6 -6
- package/dist/bundle/{store-LXLG5HTS.js → store-3W4ZOOIB.js} +28 -24
- package/dist/bundle/store-CDY2PW6J.js +34 -0
- package/dist/bundle/{store-J5FQBZYR.js → store-ICTY3RIF.js} +22 -22
- package/dist/bundle/store-maintenance-command-Y7TC3I43.js +73 -0
- package/dist/bundle/surface-4LNDJZD2.js +72 -0
- package/dist/bundle/writer-WGHWQTC2.js +86 -0
- package/dist/commands/account.d.ts +3 -2
- package/dist/commands/account.d.ts.map +1 -1
- package/dist/commands/account.js +31 -78
- package/dist/commands/account.js.map +1 -1
- package/dist/commands/crm-shared.d.ts.map +1 -1
- package/dist/commands/crm-shared.js +2 -0
- package/dist/commands/crm-shared.js.map +1 -1
- package/dist/commands/session.d.ts +0 -3
- package/dist/commands/session.d.ts.map +1 -1
- package/dist/commands/session.js +4 -31
- package/dist/commands/session.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +19 -12
- package/dist/config.js.map +1 -1
- package/dist/crm/activities.d.ts +6 -1
- package/dist/crm/activities.d.ts.map +1 -1
- package/dist/crm/activities.js +36 -0
- package/dist/crm/activities.js.map +1 -1
- package/dist/crm/writer.d.ts +1 -1
- package/dist/crm/writer.d.ts.map +1 -1
- package/dist/crm/writer.js +69 -1
- package/dist/crm/writer.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +0 -2
- package/dist/program.js.map +1 -1
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +0 -2
- package/dist/reasons.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
- package/skills/hubspot-cli/SKILL.md +10 -5
- package/skills/hubspot-cli/references/api/api-basic.md +2 -2
- package/skills/hubspot-cli/references/api/api-batch.md +2 -2
- package/dist/bundle/agent-NST4YXJR.js +0 -40
- package/dist/bundle/command-contract-LYX2QNIA.js +0 -40
- package/dist/bundle/first-screen-Y4EH3HZS.js +0 -40
- package/dist/bundle/meeting-combined-FEEVVUGC.js +0 -25
- package/dist/bundle/server-3IYIZEEQ.js +0 -86
- package/dist/bundle/source-2UCNCCO7.js +0 -917
- package/dist/bundle/store-2MNUHHZC.js +0 -32
- package/dist/bundle/store-maintenance-command-DDB7TR6V.js +0 -73
- package/dist/bundle/surface-ZTZANYKC.js +0 -72
- package/dist/bundle/writer-X7PGBLDH.js +0 -86
|
@@ -1,917 +0,0 @@
|
|
|
1
|
-
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
-
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
accountDetails
|
|
5
|
-
} from "./chunk-W5X37TBC.js";
|
|
6
|
-
import {
|
|
7
|
-
OBJECTS,
|
|
8
|
-
OVERLAP_MS,
|
|
9
|
-
SERVICE,
|
|
10
|
-
msOf,
|
|
11
|
-
nextOf,
|
|
12
|
-
propertiesOf,
|
|
13
|
-
resultsOf,
|
|
14
|
-
segment,
|
|
15
|
-
toDeal,
|
|
16
|
-
toField,
|
|
17
|
-
toLead,
|
|
18
|
-
toOrganization,
|
|
19
|
-
toPerson,
|
|
20
|
-
toPipeline,
|
|
21
|
-
toUser
|
|
22
|
-
} from "./chunk-XDDTJYGA.js";
|
|
23
|
-
import "./chunk-NL3RKJR6.js";
|
|
24
|
-
import "./chunk-VMF2UIQI.js";
|
|
25
|
-
import "./chunk-YYYRE4AV.js";
|
|
26
|
-
import "./chunk-F3HJ2E3P.js";
|
|
27
|
-
import "./chunk-ATGD64VO.js";
|
|
28
|
-
import "./chunk-TAF4PKDS.js";
|
|
29
|
-
import "./chunk-EBJYK7UM.js";
|
|
30
|
-
import "./chunk-UHHXZKB2.js";
|
|
31
|
-
import "./chunk-QV4GDVBN.js";
|
|
32
|
-
import "./chunk-7OJ43BAH.js";
|
|
33
|
-
import "./chunk-ETKLP4VE.js";
|
|
34
|
-
import "./chunk-EU7AVWSX.js";
|
|
35
|
-
import "./chunk-FWW2CUXH.js";
|
|
36
|
-
import "./chunk-5ZVYIA56.js";
|
|
37
|
-
import "./chunk-PKFLSX5F.js";
|
|
38
|
-
import {
|
|
39
|
-
crmWindowOf,
|
|
40
|
-
decodeEntities,
|
|
41
|
-
values_exports,
|
|
42
|
-
walk
|
|
43
|
-
} from "./chunk-QIFCH5DZ.js";
|
|
44
|
-
import "./chunk-LX7QMRRG.js";
|
|
45
|
-
import "./chunk-JKNUCEII.js";
|
|
46
|
-
import "./chunk-5OBVICFK.js";
|
|
47
|
-
import "./chunk-7QH5BZUG.js";
|
|
48
|
-
import "./chunk-CFQQTDSA.js";
|
|
49
|
-
import "./chunk-FOLKK6FW.js";
|
|
50
|
-
import "./chunk-RFGIUCKU.js";
|
|
51
|
-
import "./chunk-VDAYIXV4.js";
|
|
52
|
-
import "./chunk-E33KM3DB.js";
|
|
53
|
-
import "./chunk-OLDIP4CV.js";
|
|
54
|
-
import "./chunk-Z4PY5BDP.js";
|
|
55
|
-
import "./chunk-X5U7GLHD.js";
|
|
56
|
-
import "./chunk-4OPN3KCN.js";
|
|
57
|
-
import "./chunk-HM72O37C.js";
|
|
58
|
-
import "./chunk-AT43MYQL.js";
|
|
59
|
-
import "./chunk-WATDMTDC.js";
|
|
60
|
-
import "./chunk-2BCWK5BF.js";
|
|
61
|
-
import "./chunk-PMJCZIV4.js";
|
|
62
|
-
import "./chunk-XCDRFC6G.js";
|
|
63
|
-
import "./chunk-BXZRSXBL.js";
|
|
64
|
-
import "./chunk-WLFYEAZ6.js";
|
|
65
|
-
import "./chunk-QNQ4V4UT.js";
|
|
66
|
-
import "./chunk-QJHRRJKD.js";
|
|
67
|
-
import "./chunk-WBUVNKHJ.js";
|
|
68
|
-
import "./chunk-IED6MKPU.js";
|
|
69
|
-
import "./chunk-Z3YOKGVZ.js";
|
|
70
|
-
import "./chunk-MQACXJLG.js";
|
|
71
|
-
import "./chunk-M25KVDHA.js";
|
|
72
|
-
import "./chunk-UIWWAT3C.js";
|
|
73
|
-
import "./chunk-K4DWBOO6.js";
|
|
74
|
-
import "./chunk-DBPFHJXX.js";
|
|
75
|
-
import "./chunk-Q7DIEU6L.js";
|
|
76
|
-
import "./chunk-3SRGN5MQ.js";
|
|
77
|
-
import "./chunk-EH6ZEJGT.js";
|
|
78
|
-
import "./chunk-3MUHCLRY.js";
|
|
79
|
-
import "./chunk-GJSHLF43.js";
|
|
80
|
-
import "./chunk-HVXOA4FO.js";
|
|
81
|
-
import "./chunk-HQYJ66ZX.js";
|
|
82
|
-
import "./chunk-JWO3PB5Z.js";
|
|
83
|
-
import "./chunk-QODPEZC5.js";
|
|
84
|
-
import "./chunk-5KLNBGPU.js";
|
|
85
|
-
import "./chunk-T3GZKV5A.js";
|
|
86
|
-
import "./chunk-3MPMYAII.js";
|
|
87
|
-
import "./chunk-GOOXUCJW.js";
|
|
88
|
-
import "./chunk-NLZADZ4F.js";
|
|
89
|
-
import "./chunk-AV2ZJ4WX.js";
|
|
90
|
-
import "./chunk-D72URWJE.js";
|
|
91
|
-
import "./chunk-V23OHBGM.js";
|
|
92
|
-
import "./chunk-HPRKSL5S.js";
|
|
93
|
-
import "./chunk-6ULR7N3T.js";
|
|
94
|
-
import "./chunk-PQUZ2YDC.js";
|
|
95
|
-
import "./chunk-2Q2XIXDL.js";
|
|
96
|
-
import "./chunk-3BM6KBWP.js";
|
|
97
|
-
import "./chunk-3LMW7U7F.js";
|
|
98
|
-
import "./chunk-S4UUN6LD.js";
|
|
99
|
-
import "./chunk-Y5E2WNWB.js";
|
|
100
|
-
import {
|
|
101
|
-
CliError,
|
|
102
|
-
isCliError
|
|
103
|
-
} from "./chunk-HM6AMYHR.js";
|
|
104
|
-
import "./chunk-DG4RBKIV.js";
|
|
105
|
-
import {
|
|
106
|
-
__name
|
|
107
|
-
} from "./chunk-ZVVMGPBJ.js";
|
|
108
|
-
|
|
109
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.705.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1668a48934ee0d2606b0d61251c2625b/node_modules/@wirecat/cli-core/dist/mail/attachments.js
|
|
110
|
-
var DEFAULT_ATTACHMENT_POLICY = { read: true, maxBytes: 10 * 1024 * 1024 };
|
|
111
|
-
|
|
112
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.705.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1668a48934ee0d2606b0d61251c2625b/node_modules/@wirecat/cli-core/dist/mail/presets.js
|
|
113
|
-
var PRESETS = {
|
|
114
|
-
social: {
|
|
115
|
-
about: "notifications from social networks",
|
|
116
|
-
domains: [
|
|
117
|
-
"facebookmail.com",
|
|
118
|
-
"facebook.com",
|
|
119
|
-
"linkedin.com",
|
|
120
|
-
"twitter.com",
|
|
121
|
-
"x.com",
|
|
122
|
-
"instagram.com",
|
|
123
|
-
"vk.com",
|
|
124
|
-
"ok.ru",
|
|
125
|
-
"quora.com",
|
|
126
|
-
"redditmail.com",
|
|
127
|
-
"pinterest.com",
|
|
128
|
-
"tiktok.com",
|
|
129
|
-
"meetup.com",
|
|
130
|
-
"tumblr.com",
|
|
131
|
-
"youtube.com"
|
|
132
|
-
]
|
|
133
|
-
},
|
|
134
|
-
newsletters: {
|
|
135
|
-
about: "mailing lists with an unsubscribe link: List-Id and List-Unsubscribe, or a newsletter service",
|
|
136
|
-
domains: ["substack.com", "mcsv.net", "mailchimpapp.net", "sendinblue.com", "beehiiv.com", "convertkit.com"]
|
|
137
|
-
},
|
|
138
|
-
developer: {
|
|
139
|
-
about: "code hosting, CI, package and error-tracker notifications",
|
|
140
|
-
domains: [
|
|
141
|
-
"github.com",
|
|
142
|
-
"gitlab.com",
|
|
143
|
-
"bitbucket.org",
|
|
144
|
-
"atlassian.net",
|
|
145
|
-
"circleci.com",
|
|
146
|
-
"travis-ci.com",
|
|
147
|
-
"rollbar.com",
|
|
148
|
-
"sentry.io",
|
|
149
|
-
"vercel.com",
|
|
150
|
-
"netlify.com",
|
|
151
|
-
"npmjs.com",
|
|
152
|
-
"docker.com",
|
|
153
|
-
"heroku.com",
|
|
154
|
-
"codecov.io",
|
|
155
|
-
"libraries.io"
|
|
156
|
-
]
|
|
157
|
-
},
|
|
158
|
-
shopping: {
|
|
159
|
-
about: "shops and promotions, and what Gmail files under Promotions",
|
|
160
|
-
domains: [
|
|
161
|
-
"aliexpress.com",
|
|
162
|
-
"aliexpress.ru",
|
|
163
|
-
"ebay.com",
|
|
164
|
-
"ozon.ru",
|
|
165
|
-
"wildberries.ru",
|
|
166
|
-
"steampowered.com",
|
|
167
|
-
"booking.com",
|
|
168
|
-
"zalando.com",
|
|
169
|
-
"etsy.com",
|
|
170
|
-
"ikea.com"
|
|
171
|
-
]
|
|
172
|
-
},
|
|
173
|
-
alerts: {
|
|
174
|
-
about: "monitoring and uptime alerts",
|
|
175
|
-
domains: [
|
|
176
|
-
"uptimerobot.com",
|
|
177
|
-
"pingdom.com",
|
|
178
|
-
"statuscake.com",
|
|
179
|
-
"pagerduty.com",
|
|
180
|
-
"opsgenie.com",
|
|
181
|
-
"newrelic.com",
|
|
182
|
-
"datadoghq.com",
|
|
183
|
-
"betteruptime.com",
|
|
184
|
-
"healthchecks.io"
|
|
185
|
-
]
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
var PRESET_NAMES = Object.keys(PRESETS);
|
|
189
|
-
|
|
190
|
-
// node_modules/.pnpm/postal-mime@4.1.4/node_modules/postal-mime/dist/esm/decode-strings.js
|
|
191
|
-
var textEncoder = new TextEncoder();
|
|
192
|
-
var base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
193
|
-
var base64Lookup = new Uint8Array(256);
|
|
194
|
-
for (let i = 0; i < base64Chars.length; i++) {
|
|
195
|
-
base64Lookup[base64Chars.charCodeAt(i)] = i;
|
|
196
|
-
}
|
|
197
|
-
var ENCODING_LABELS = new Set([
|
|
198
|
-
// UTF-8
|
|
199
|
-
"unicode-1-1-utf-8 unicode11utf8 unicode20utf8 utf-8 utf8 x-unicode20utf8",
|
|
200
|
-
// IBM866
|
|
201
|
-
"866 cp866 csibm866 ibm866",
|
|
202
|
-
// ISO-8859-2
|
|
203
|
-
"csisolatin2 iso-8859-2 iso-ir-101 iso8859-2 iso88592 iso_8859-2 iso_8859-2:1987 l2 latin2",
|
|
204
|
-
// ISO-8859-3
|
|
205
|
-
"csisolatin3 iso-8859-3 iso-ir-109 iso8859-3 iso88593 iso_8859-3 iso_8859-3:1988 l3 latin3",
|
|
206
|
-
// ISO-8859-4
|
|
207
|
-
"csisolatin4 iso-8859-4 iso-ir-110 iso8859-4 iso88594 iso_8859-4 iso_8859-4:1988 l4 latin4",
|
|
208
|
-
// ISO-8859-5
|
|
209
|
-
"csisolatincyrillic cyrillic iso-8859-5 iso-ir-144 iso8859-5 iso88595 iso_8859-5 iso_8859-5:1988",
|
|
210
|
-
// ISO-8859-6
|
|
211
|
-
"arabic asmo-708 csiso88596e csiso88596i csisolatinarabic ecma-114 iso-8859-6 iso-8859-6-e",
|
|
212
|
-
"iso-8859-6-i iso-ir-127 iso8859-6 iso88596 iso_8859-6 iso_8859-6:1987",
|
|
213
|
-
// ISO-8859-7
|
|
214
|
-
"csisolatingreek ecma-118 elot_928 greek greek8 iso-8859-7 iso-ir-126 iso8859-7 iso88597 iso_8859-7",
|
|
215
|
-
"iso_8859-7:1987 sun_eu_greek",
|
|
216
|
-
// ISO-8859-8
|
|
217
|
-
"csiso88598e csisolatinhebrew hebrew iso-8859-8 iso-8859-8-e iso-ir-138 iso8859-8 iso88598 iso_8859-8",
|
|
218
|
-
"iso_8859-8:1988 visual",
|
|
219
|
-
// ISO-8859-8-I
|
|
220
|
-
"csiso88598i iso-8859-8-i logical",
|
|
221
|
-
// ISO-8859-10
|
|
222
|
-
"csisolatin6 iso-8859-10 iso-ir-157 iso8859-10 iso885910 l6 latin6",
|
|
223
|
-
// ISO-8859-13
|
|
224
|
-
"iso-8859-13 iso8859-13 iso885913",
|
|
225
|
-
// ISO-8859-14
|
|
226
|
-
"iso-8859-14 iso8859-14 iso885914",
|
|
227
|
-
// ISO-8859-15
|
|
228
|
-
"csisolatin9 iso-8859-15 iso8859-15 iso885915 iso_8859-15 l9",
|
|
229
|
-
// ISO-8859-16
|
|
230
|
-
"iso-8859-16",
|
|
231
|
-
// KOI8-R
|
|
232
|
-
"cskoi8r koi koi8 koi8-r koi8_r",
|
|
233
|
-
// KOI8-U
|
|
234
|
-
"koi8-ru koi8-u",
|
|
235
|
-
// macintosh
|
|
236
|
-
"csmacintosh mac macintosh x-mac-roman",
|
|
237
|
-
// windows-874
|
|
238
|
-
"dos-874 iso-8859-11 iso8859-11 iso885911 tis-620 windows-874",
|
|
239
|
-
// windows-1250
|
|
240
|
-
"cp1250 windows-1250 x-cp1250",
|
|
241
|
-
// windows-1251
|
|
242
|
-
"cp1251 windows-1251 x-cp1251",
|
|
243
|
-
// windows-1252
|
|
244
|
-
"ansi_x3.4-1968 ascii cp1252 cp819 csisolatin1 ibm819 iso-8859-1 iso-ir-100 iso8859-1 iso88591",
|
|
245
|
-
"iso_8859-1 iso_8859-1:1987 l1 latin1 us-ascii windows-1252 x-cp1252",
|
|
246
|
-
// windows-1253
|
|
247
|
-
"cp1253 windows-1253 x-cp1253",
|
|
248
|
-
// windows-1254
|
|
249
|
-
"cp1254 csisolatin5 iso-8859-9 iso-ir-148 iso8859-9 iso88599 iso_8859-9 iso_8859-9:1989 l5 latin5",
|
|
250
|
-
"windows-1254 x-cp1254",
|
|
251
|
-
// windows-1255
|
|
252
|
-
"cp1255 windows-1255 x-cp1255",
|
|
253
|
-
// windows-1256
|
|
254
|
-
"cp1256 windows-1256 x-cp1256",
|
|
255
|
-
// windows-1257
|
|
256
|
-
"cp1257 windows-1257 x-cp1257",
|
|
257
|
-
// windows-1258
|
|
258
|
-
"cp1258 windows-1258 x-cp1258",
|
|
259
|
-
// x-mac-cyrillic
|
|
260
|
-
"x-mac-cyrillic x-mac-ukrainian",
|
|
261
|
-
// GBK
|
|
262
|
-
"chinese csgb2312 csiso58gb231280 gb2312 gb_2312 gb_2312-80 gbk iso-ir-58 x-gbk",
|
|
263
|
-
// gb18030
|
|
264
|
-
"gb18030",
|
|
265
|
-
// Big5
|
|
266
|
-
"big5 big5-hkscs cn-big5 csbig5 x-x-big5",
|
|
267
|
-
// EUC-JP
|
|
268
|
-
"cseucpkdfmtjapanese euc-jp x-euc-jp",
|
|
269
|
-
// ISO-2022-JP
|
|
270
|
-
"csiso2022jp iso-2022-jp",
|
|
271
|
-
// Shift_JIS
|
|
272
|
-
"csshiftjis ms932 ms_kanji shift-jis shift_jis sjis windows-31j x-sjis",
|
|
273
|
-
// EUC-KR
|
|
274
|
-
"cseuckr csksc56011987 euc-kr iso-ir-149 korean ks_c_5601-1987 ks_c_5601-1989 ksc5601 ksc_5601",
|
|
275
|
-
"windows-949",
|
|
276
|
-
// replacement
|
|
277
|
-
"csiso2022kr hz-gb-2312 iso-2022-cn iso-2022-cn-ext iso-2022-kr replacement",
|
|
278
|
-
// x-user-defined
|
|
279
|
-
"x-user-defined"
|
|
280
|
-
].join(" ").split(" "));
|
|
281
|
-
var utf8Decoder = new TextDecoder();
|
|
282
|
-
var ENCODED_WORD_PATTERN = "=\\?([^?\\s]+)\\?([QqBb])\\?([^?]*)\\?=";
|
|
283
|
-
var ENCODED_WORD_REGEX = new RegExp(ENCODED_WORD_PATTERN, "g");
|
|
284
|
-
var ENCODED_WORDS_ONLY_REGEX = new RegExp(`^(?:${ENCODED_WORD_PATTERN}\\s*)+$`);
|
|
285
|
-
|
|
286
|
-
// node_modules/.pnpm/postal-mime@4.1.4/node_modules/postal-mime/dist/esm/mime-node.js
|
|
287
|
-
var headerDecoder = new TextDecoder("utf-8", { ignoreBOM: true });
|
|
288
|
-
|
|
289
|
-
// node_modules/.pnpm/postal-mime@4.1.4/node_modules/postal-mime/dist/esm/text-format.js
|
|
290
|
-
var hexByte = /* @__PURE__ */ __name((value) => value.toString(16).toUpperCase().padStart(2, "0"), "hexByte");
|
|
291
|
-
var PERCENT_ENCODED = Array.from({ length: 256 }, (_, byte) => "%" + hexByte(byte));
|
|
292
|
-
|
|
293
|
-
// node_modules/.pnpm/postal-mime@4.1.4/node_modules/postal-mime/dist/esm/postal-mime.js
|
|
294
|
-
var LINE_FEED = new Uint8Array([10]);
|
|
295
|
-
var MAX_HEADERS_SIZE = 2 * 1024 * 1024;
|
|
296
|
-
|
|
297
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.705.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1668a48934ee0d2606b0d61251c2625b/node_modules/@wirecat/cli-core/dist/mail/rules.js
|
|
298
|
-
var DAY_MS = 24 * 60 * 60 * 1e3;
|
|
299
|
-
|
|
300
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.705.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1668a48934ee0d2606b0d61251c2625b/node_modules/@wirecat/cli-core/dist/mail/meeting-notes.js
|
|
301
|
-
var HOUR_MS = 36e5;
|
|
302
|
-
var DAY_MS2 = 24 * HOUR_MS;
|
|
303
|
-
var MEETING_NOTES = {
|
|
304
|
-
telemost: {
|
|
305
|
-
senders: ["keeper@telemost.yandex.ru"],
|
|
306
|
-
day: /* @__PURE__ */ __name((subject) => {
|
|
307
|
-
const found = /(\d{2})\.(\d{2})\.(\d{4})/u.exec(subject);
|
|
308
|
-
return found ? { day: Number(found[1]), month: Number(found[2]), year: Number(found[3]) } : null;
|
|
309
|
-
}, "day"),
|
|
310
|
-
// Moscow, Yandex's default; the zone of the owner's Yandex account is not known here.
|
|
311
|
-
offsets: [3],
|
|
312
|
-
headings: ["\u0418\u0442\u043E\u0433\u0438", "\u0427\u0442\u043E \u043E\u0431\u0441\u0443\u0434\u0438\u043B\u0438", "\u0417\u0430\u0434\u0430\u0447\u0438", "\u041E\u0442\u043A\u0440\u044B\u0442\u044B\u0435 \u0432\u043E\u043F\u0440\u043E\u0441\u044B", "\u0421\u043B\u0435\u0434\u0443\u044E\u0449\u0430\u044F \u0432\u0441\u0442\u0440\u0435\u0447\u0430"],
|
|
313
|
-
overview: "\u0418\u0442\u043E\u0433\u0438",
|
|
314
|
-
title: "\u041A\u043E\u043D\u0441\u043F\u0435\u043A\u0442 \u0432\u0441\u0442\u0440\u0435\u0447\u0438",
|
|
315
|
-
ends: ["\u041E\u0446\u0435\u043D\u0438\u0442\u0435 \u0442\u043E\u0447\u043D\u043E\u0441\u0442\u044C \u043A\u043E\u043D\u0441\u043F\u0435\u043A\u0442\u0430"]
|
|
316
|
-
}
|
|
317
|
-
};
|
|
318
|
-
var MEETING_NOTES_PROVIDERS = Object.keys(MEETING_NOTES);
|
|
319
|
-
|
|
320
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.705.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1668a48934ee0d2606b0d61251c2625b/node_modules/@wirecat/cli-core/dist/mail/parse.js
|
|
321
|
-
var HIDDEN_OPEN = /<(script|style)/gi;
|
|
322
|
-
var HIDDEN_CLOSE = { script: /<\/script>/gi, style: /<\/style>/gi };
|
|
323
|
-
var dropHidden = /* @__PURE__ */ __name((html) => {
|
|
324
|
-
const unclosed = /* @__PURE__ */ new Set();
|
|
325
|
-
let out = "";
|
|
326
|
-
let kept = 0;
|
|
327
|
-
for (const open of html.matchAll(HIDDEN_OPEN)) {
|
|
328
|
-
const name = open[1].toLowerCase();
|
|
329
|
-
if (open.index < kept || unclosed.has(name))
|
|
330
|
-
continue;
|
|
331
|
-
const close = HIDDEN_CLOSE[name];
|
|
332
|
-
close.lastIndex = open.index + open[0].length;
|
|
333
|
-
const end = close.exec(html);
|
|
334
|
-
if (!end) {
|
|
335
|
-
unclosed.add(name);
|
|
336
|
-
continue;
|
|
337
|
-
}
|
|
338
|
-
out += html.slice(kept, open.index);
|
|
339
|
-
kept = end.index + end[0].length;
|
|
340
|
-
}
|
|
341
|
-
return out + html.slice(kept);
|
|
342
|
-
}, "dropHidden");
|
|
343
|
-
var stripTags = /* @__PURE__ */ __name((html) => {
|
|
344
|
-
const end = html.lastIndexOf(">") + 1;
|
|
345
|
-
return html.slice(0, end).replace(/<[^>]+>/g, "") + html.slice(end);
|
|
346
|
-
}, "stripTags");
|
|
347
|
-
var dropComments = /* @__PURE__ */ __name((html) => html.replace(/<!--[\s\S]*?(-->|$)/g, ""), "dropComments");
|
|
348
|
-
var htmlToText2 = /* @__PURE__ */ __name((html) => {
|
|
349
|
-
const text4 = stripTags(dropHidden(dropComments(html)).replace(/<br\s*\/?>|<\/(p|div|li|tr|h\d)>/gi, "\n"));
|
|
350
|
-
return decodeEntities(text4.replace(/ /gi, " ")).replace(/(?<![ \t])[ \t]+\n/g, "\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
351
|
-
}, "htmlToText");
|
|
352
|
-
|
|
353
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.705.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1668a48934ee0d2606b0d61251c2625b/node_modules/@wirecat/cli-core/dist/mail/sender-scores.js
|
|
354
|
-
var DAY = 864e5;
|
|
355
|
-
var RECENT = 2 * 365 * DAY;
|
|
356
|
-
|
|
357
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.705.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1668a48934ee0d2606b0d61251c2625b/node_modules/@wirecat/cli-core/dist/mail/sync.js
|
|
358
|
-
var DAY2 = 864e5;
|
|
359
|
-
var EDGE = 2 * DAY2;
|
|
360
|
-
|
|
361
|
-
// dist/crm/associations.js
|
|
362
|
-
var { fieldOf, id, number, rawsOf, text } = values_exports;
|
|
363
|
-
var associationsOf = /* @__PURE__ */ __name(async (post, from, to, ids) => {
|
|
364
|
-
const found = /* @__PURE__ */ new Map();
|
|
365
|
-
if (!ids.length)
|
|
366
|
-
return found;
|
|
367
|
-
const body = await post(`/crm/associations/2026-03/${from}/${to}/batch/read`, {
|
|
368
|
-
inputs: ids.map((one) => ({ id: one }))
|
|
369
|
-
});
|
|
370
|
-
for (const result of rawsOf(fieldOf(body, "results"))) {
|
|
371
|
-
const owner = id(fieldOf(result.from, "id"));
|
|
372
|
-
if (!owner)
|
|
373
|
-
continue;
|
|
374
|
-
const held = new Map((found.get(owner) ?? []).map((one) => [one.id, one]));
|
|
375
|
-
for (const one of rawsOf(result.to)) {
|
|
376
|
-
const linked = id(one.toObjectId);
|
|
377
|
-
if (!linked)
|
|
378
|
-
continue;
|
|
379
|
-
const types = rawsOf(one.associationTypes);
|
|
380
|
-
const kept = held.get(linked) ?? { id: linked, typeIds: [], labels: [] };
|
|
381
|
-
held.set(linked, {
|
|
382
|
-
id: linked,
|
|
383
|
-
typeIds: [.../* @__PURE__ */ new Set([...kept.typeIds, ...types.flatMap((type) => number(type.typeId) ?? [])])],
|
|
384
|
-
labels: [.../* @__PURE__ */ new Set([...kept.labels, ...types.flatMap((type) => text(type.label) ?? [])])]
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
|
-
found.set(owner, [...held.values()]);
|
|
388
|
-
}
|
|
389
|
-
return found;
|
|
390
|
-
}, "associationsOf");
|
|
391
|
-
var withAssociations = /* @__PURE__ */ __name((rows, to, found) => rows.map((raw) => ({
|
|
392
|
-
...raw,
|
|
393
|
-
associations: {
|
|
394
|
-
...typeof raw.associations === "object" && raw.associations !== null ? raw.associations : {},
|
|
395
|
-
[to]: { results: (found.get(String(raw.id)) ?? []).map((one) => ({ ...one, type: to })) }
|
|
396
|
-
}
|
|
397
|
-
})), "withAssociations");
|
|
398
|
-
|
|
399
|
-
// dist/crm/search.js
|
|
400
|
-
var SEARCH_PAGE = 200;
|
|
401
|
-
var SEARCH_CAP = 1e4;
|
|
402
|
-
var MAX_FILTERS_PER_GROUP = 6;
|
|
403
|
-
var search = /* @__PURE__ */ __name(async (post, path, request) => {
|
|
404
|
-
if (request.filters.length > MAX_FILTERS_PER_GROUP)
|
|
405
|
-
throw new CliError("validation_error", `${SERVICE} search takes at most ${MAX_FILTERS_PER_GROUP} conditions together; drop some`, { reason: "hubspot.too-many-filters" });
|
|
406
|
-
if (request.offset + request.limit > SEARCH_CAP)
|
|
407
|
-
throw new CliError("validation_error", `${SERVICE} search reaches only its first ${SEARCH_CAP} results; narrow the query`, { reason: "hubspot.search-cap" });
|
|
408
|
-
const body = await post(`/crm/objects/2026-03/${path}/search`, {
|
|
409
|
-
filterGroups: request.filters.length ? [{ filters: request.filters }] : [],
|
|
410
|
-
sorts: [request.sort],
|
|
411
|
-
properties: [...request.properties],
|
|
412
|
-
limit: request.limit,
|
|
413
|
-
...request.offset ? { after: String(request.offset) } : {},
|
|
414
|
-
...request.query ? { query: request.query } : {}
|
|
415
|
-
});
|
|
416
|
-
return { rows: resultsOf(body), more: nextOf(body) !== null };
|
|
417
|
-
}, "search");
|
|
418
|
-
var nextSpot = /* @__PURE__ */ __name((spot, rows, modified, limit) => {
|
|
419
|
-
const last = rows.at(-1);
|
|
420
|
-
const at = last ? msOf(propertiesOf(last)[modified]) ?? msOf(last.updatedAt) : null;
|
|
421
|
-
if (at !== null && at > spot.from)
|
|
422
|
-
return { from: at, offset: 0 };
|
|
423
|
-
const offset = spot.offset + rows.length;
|
|
424
|
-
return offset + limit > SEARCH_CAP ? null : { from: spot.from, offset };
|
|
425
|
-
}, "nextSpot");
|
|
426
|
-
var modifiedSince = /* @__PURE__ */ __name((modified, spot, limit, properties) => ({
|
|
427
|
-
filters: [{ propertyName: modified, operator: "GTE", value: String(spot.from) }],
|
|
428
|
-
sort: { propertyName: modified, direction: "ASCENDING" },
|
|
429
|
-
properties,
|
|
430
|
-
limit,
|
|
431
|
-
offset: spot.offset
|
|
432
|
-
}), "modifiedSince");
|
|
433
|
-
|
|
434
|
-
// dist/crm/activities.js
|
|
435
|
-
var { id: id2, text: text2 } = values_exports;
|
|
436
|
-
var CALL_OPEN = ["CALLING_CRM_USER", "CONNECTING", "IN_PROGRESS", "QUEUED", "RINGING"];
|
|
437
|
-
var EMAIL_OPEN = ["SCHEDULED", "SENDING"];
|
|
438
|
-
var COMMON = ["hubspot_owner_id", "hs_timestamp", "hs_createdate", "hs_lastmodifieddate"];
|
|
439
|
-
var plain = /* @__PURE__ */ __name((value) => {
|
|
440
|
-
const html = text2(value);
|
|
441
|
-
return html === null ? null : text2(htmlToText2(html));
|
|
442
|
-
}, "plain");
|
|
443
|
-
var CONTACTS_SCOPE = "crm.objects.contacts.read";
|
|
444
|
-
var ENGAGEMENTS = [
|
|
445
|
-
{
|
|
446
|
-
type: "notes",
|
|
447
|
-
kind: "comment",
|
|
448
|
-
scope: CONTACTS_SCOPE,
|
|
449
|
-
properties: ["hs_note_body", ...COMMON],
|
|
450
|
-
subject: /* @__PURE__ */ __name(() => "", "subject"),
|
|
451
|
-
body: /* @__PURE__ */ __name((properties) => plain(properties.hs_note_body), "body"),
|
|
452
|
-
dueAt: /* @__PURE__ */ __name(() => null, "dueAt"),
|
|
453
|
-
done: /* @__PURE__ */ __name(() => true, "done")
|
|
454
|
-
},
|
|
455
|
-
{
|
|
456
|
-
type: "calls",
|
|
457
|
-
kind: "call",
|
|
458
|
-
scope: CONTACTS_SCOPE,
|
|
459
|
-
properties: ["hs_call_title", "hs_call_direction", "hs_call_status", ...COMMON],
|
|
460
|
-
subject: /* @__PURE__ */ __name((properties) => text2(properties.hs_call_title) ?? (text2(properties.hs_call_direction) === "INBOUND" ? "incoming call" : "outgoing call"), "subject"),
|
|
461
|
-
body: /* @__PURE__ */ __name(() => null, "body"),
|
|
462
|
-
dueAt: /* @__PURE__ */ __name(() => null, "dueAt"),
|
|
463
|
-
done: /* @__PURE__ */ __name((properties) => !CALL_OPEN.includes(text2(properties.hs_call_status) ?? ""), "done")
|
|
464
|
-
},
|
|
465
|
-
{
|
|
466
|
-
type: "emails",
|
|
467
|
-
kind: "email",
|
|
468
|
-
scope: "sales-email-read",
|
|
469
|
-
properties: ["hs_email_subject", "hs_email_text", "hs_email_direction", "hs_email_status", ...COMMON],
|
|
470
|
-
subject: /* @__PURE__ */ __name((properties) => text2(properties.hs_email_subject), "subject"),
|
|
471
|
-
body: /* @__PURE__ */ __name((properties) => text2(properties.hs_email_text), "body"),
|
|
472
|
-
dueAt: /* @__PURE__ */ __name(() => null, "dueAt"),
|
|
473
|
-
done: /* @__PURE__ */ __name((properties) => !EMAIL_OPEN.includes(text2(properties.hs_email_status) ?? ""), "done")
|
|
474
|
-
},
|
|
475
|
-
{
|
|
476
|
-
type: "meetings",
|
|
477
|
-
kind: "meeting",
|
|
478
|
-
scope: CONTACTS_SCOPE,
|
|
479
|
-
properties: ["hs_meeting_title", "hs_meeting_body", "hs_meeting_start_time", "hs_meeting_outcome", ...COMMON],
|
|
480
|
-
subject: /* @__PURE__ */ __name((properties) => text2(properties.hs_meeting_title), "subject"),
|
|
481
|
-
body: /* @__PURE__ */ __name((properties) => plain(properties.hs_meeting_body), "body"),
|
|
482
|
-
dueAt: /* @__PURE__ */ __name((properties) => msOf(properties.hs_meeting_start_time), "dueAt"),
|
|
483
|
-
// "scheduled, completed, rescheduled, no show, and canceled", in prose and lower case
|
|
484
|
-
// (https://developers.hubspot.com/docs/api-reference/latest/crm/activities/meetings/guide).
|
|
485
|
-
done: /* @__PURE__ */ __name((properties) => text2(properties.hs_meeting_outcome)?.toUpperCase() === "COMPLETED", "done")
|
|
486
|
-
},
|
|
487
|
-
{
|
|
488
|
-
type: "tasks",
|
|
489
|
-
kind: "task",
|
|
490
|
-
scope: CONTACTS_SCOPE,
|
|
491
|
-
properties: ["hs_task_subject", "hs_task_body", "hs_task_status", ...COMMON],
|
|
492
|
-
subject: /* @__PURE__ */ __name((properties) => text2(properties.hs_task_subject), "subject"),
|
|
493
|
-
body: /* @__PURE__ */ __name((properties) => plain(properties.hs_task_body), "body"),
|
|
494
|
-
dueAt: /* @__PURE__ */ __name((properties) => msOf(properties.hs_timestamp), "dueAt"),
|
|
495
|
-
// COMPLETED or NOT_STARTED (https://developers.hubspot.com/docs/api-reference/latest/crm/activities/tasks/guide).
|
|
496
|
-
done: /* @__PURE__ */ __name((properties) => text2(properties.hs_task_status) === "COMPLETED", "done")
|
|
497
|
-
}
|
|
498
|
-
];
|
|
499
|
-
var ON = [
|
|
500
|
-
["deals", "deal"],
|
|
501
|
-
["leads", "lead"],
|
|
502
|
-
["contacts", "person"],
|
|
503
|
-
["companies", "organization"]
|
|
504
|
-
];
|
|
505
|
-
var toActivity = /* @__PURE__ */ __name((engagement, raw, on) => {
|
|
506
|
-
const externalId = id2(raw.id);
|
|
507
|
-
const properties = propertiesOf(raw);
|
|
508
|
-
const updatedAt = msOf(properties.hs_lastmodifieddate) ?? msOf(raw.updatedAt);
|
|
509
|
-
if (!externalId || updatedAt === null)
|
|
510
|
-
return null;
|
|
511
|
-
return {
|
|
512
|
-
// One id space for every kind: a note and a call may share a number.
|
|
513
|
-
externalId: `${engagement.type}:${externalId}`,
|
|
514
|
-
kind: engagement.kind,
|
|
515
|
-
subject: engagement.subject(properties) ?? "",
|
|
516
|
-
body: engagement.body(properties),
|
|
517
|
-
dueAt: engagement.dueAt(properties),
|
|
518
|
-
done: engagement.done(properties),
|
|
519
|
-
assignee: id2(properties.hubspot_owner_id),
|
|
520
|
-
createdAt: msOf(properties.hs_createdate) ?? msOf(raw.createdAt) ?? updatedAt,
|
|
521
|
-
updatedAt,
|
|
522
|
-
on
|
|
523
|
-
};
|
|
524
|
-
}, "toActivity");
|
|
525
|
-
var pageOf = /* @__PURE__ */ __name((page, since, now) => {
|
|
526
|
-
const fresh = { at: 0, spot: { from: since - OVERLAP_MS, offset: 0 }, after: void 0, started: now };
|
|
527
|
-
const cut = (page ?? "").lastIndexOf("@");
|
|
528
|
-
const started = Number(page?.slice(cut + 1));
|
|
529
|
-
const found = /^(\d+)\.(-?\d+)\.(?:(\d+)|L(.*))$/s.exec(page?.slice(0, cut) ?? "");
|
|
530
|
-
if (cut < 0 || !found || !Number.isSafeInteger(started))
|
|
531
|
-
return fresh;
|
|
532
|
-
return {
|
|
533
|
-
at: Number(found[1]),
|
|
534
|
-
spot: { from: Number(found[2]), offset: Number(found[3] ?? 0) },
|
|
535
|
-
after: found[4] === void 0 ? void 0 : found[4] || "",
|
|
536
|
-
started
|
|
537
|
-
};
|
|
538
|
-
}, "pageOf");
|
|
539
|
-
var readActivities = /* @__PURE__ */ __name(async (caller, since, page, context, now, sizes = { search: SEARCH_PAGE, list: 100 }) => {
|
|
540
|
-
const { at, spot, after, started } = pageOf(page, since, now());
|
|
541
|
-
const engagement = ENGAGEMENTS[at];
|
|
542
|
-
const last = { hasMore: false, cursor: String(started) };
|
|
543
|
-
if (!engagement)
|
|
544
|
-
return { items: [], ...last };
|
|
545
|
-
const following = /* @__PURE__ */ __name((items2, next2) => {
|
|
546
|
-
if (next2)
|
|
547
|
-
return { items: items2, hasMore: true, nextCursor: `${at}.${next2}@${started}` };
|
|
548
|
-
if (at + 1 >= ENGAGEMENTS.length)
|
|
549
|
-
return { items: items2, ...last };
|
|
550
|
-
return { items: items2, hasMore: true, nextCursor: `${at + 1}.${since - OVERLAP_MS}.0@${started}` };
|
|
551
|
-
}, "following");
|
|
552
|
-
let rows;
|
|
553
|
-
let more;
|
|
554
|
-
let listedNext = null;
|
|
555
|
-
try {
|
|
556
|
-
if (after === void 0)
|
|
557
|
-
({ rows, more } = await search(caller.post, engagement.type, modifiedSince("hs_lastmodifieddate", spot, sizes.search, engagement.properties)));
|
|
558
|
-
else {
|
|
559
|
-
const body = await caller.get(`/crm/objects/2026-03/${engagement.type}`, {
|
|
560
|
-
limit: sizes.list,
|
|
561
|
-
properties: engagement.properties.join(","),
|
|
562
|
-
archived: false,
|
|
563
|
-
...after ? { after } : {}
|
|
564
|
-
});
|
|
565
|
-
listedNext = nextOf(body);
|
|
566
|
-
more = listedNext !== null;
|
|
567
|
-
rows = resultsOf(body).filter((raw) => {
|
|
568
|
-
const changed = msOf(propertiesOf(raw).hs_lastmodifieddate) ?? msOf(raw.updatedAt);
|
|
569
|
-
return changed === null || changed >= spot.from;
|
|
570
|
-
});
|
|
571
|
-
}
|
|
572
|
-
} catch (error) {
|
|
573
|
-
if (!isCliError(error) || error.code !== "permission_error")
|
|
574
|
-
throw error;
|
|
575
|
-
context?.gap({
|
|
576
|
-
kind: "activities",
|
|
577
|
-
scope: engagement.scope,
|
|
578
|
-
message: `HubSpot refused the ${engagement.type} (${engagement.scope} scope missing); the other activities are read`
|
|
579
|
-
});
|
|
580
|
-
return following([]);
|
|
581
|
-
}
|
|
582
|
-
const ids = rows.flatMap((raw) => id2(raw.id) ?? []);
|
|
583
|
-
const on = /* @__PURE__ */ new Map();
|
|
584
|
-
for (const [to, kind] of ON) {
|
|
585
|
-
let found;
|
|
586
|
-
try {
|
|
587
|
-
found = await associationsOf(caller.post, engagement.type, to, ids);
|
|
588
|
-
} catch (error) {
|
|
589
|
-
if (isCliError(error) && error.code === "permission_error")
|
|
590
|
-
continue;
|
|
591
|
-
throw error;
|
|
592
|
-
}
|
|
593
|
-
for (const [owner, linked] of found)
|
|
594
|
-
on.set(owner, [...on.get(owner) ?? [], ...linked.map((one) => ({ kind, externalId: one.id }))]);
|
|
595
|
-
}
|
|
596
|
-
const items = rows.flatMap((raw) => toActivity(engagement, raw, on.get(String(raw.id)) ?? []) ?? []);
|
|
597
|
-
if (!more)
|
|
598
|
-
return following(items);
|
|
599
|
-
if (after !== void 0)
|
|
600
|
-
return following(items, `${spot.from}.L${listedNext}`);
|
|
601
|
-
const next = nextSpot(spot, rows, "hs_lastmodifieddate", sizes.search);
|
|
602
|
-
return following(items, next ? `${next.from}.${next.offset}` : `${spot.from}.L`);
|
|
603
|
-
}, "readActivities");
|
|
604
|
-
|
|
605
|
-
// dist/crm/source.js
|
|
606
|
-
var { id: id3, text: text3 } = values_exports;
|
|
607
|
-
var LIST_PAGE = 100;
|
|
608
|
-
var PIPELINES = { deal: "deals", lead: "leads" };
|
|
609
|
-
var scoped = /* @__PURE__ */ __name((error, scope) => isCliError(error) && error.code === "permission_error" && typeof error.details.scope !== "string" ? new CliError(error.code, error.message, { ...error.details, scope }) : error, "scoped");
|
|
610
|
-
var refused = /* @__PURE__ */ __name((error) => isCliError(error) && error.code === "permission_error", "refused");
|
|
611
|
-
var unseen = /* @__PURE__ */ __name((error) => isCliError(error) && (error.code === "not_found" || refused(error)), "unseen");
|
|
612
|
-
var pageOf2 = /* @__PURE__ */ __name((page, now) => {
|
|
613
|
-
const cut = (page ?? "").lastIndexOf("@");
|
|
614
|
-
const head = page?.slice(0, cut) ?? "";
|
|
615
|
-
const started = Number(page?.slice(cut + 1));
|
|
616
|
-
if (cut < 0 || !Number.isSafeInteger(started))
|
|
617
|
-
return { after: void 0, spot: void 0, started: now };
|
|
618
|
-
if (head.startsWith("l"))
|
|
619
|
-
return { after: head.slice(1) || void 0, spot: void 0, started };
|
|
620
|
-
const found = /^s(-?\d+)\.(\d+)$/.exec(head);
|
|
621
|
-
if (!found)
|
|
622
|
-
return { after: void 0, spot: void 0, started: now };
|
|
623
|
-
return { after: void 0, spot: { from: Number(found[1]), offset: Number(found[2]) }, started };
|
|
624
|
-
}, "pageOf");
|
|
625
|
-
var asked = /* @__PURE__ */ __name((raw, types) => {
|
|
626
|
-
const held = typeof raw.associations === "object" && raw.associations !== null ? raw.associations : {};
|
|
627
|
-
return {
|
|
628
|
-
...raw,
|
|
629
|
-
associations: { ...Object.fromEntries(types.map((type) => [type, { results: [] }])), ...held }
|
|
630
|
-
};
|
|
631
|
-
}, "asked");
|
|
632
|
-
var liveField = /* @__PURE__ */ __name((kind, field2) => ({
|
|
633
|
-
assigned_to: "hubspot_owner_id",
|
|
634
|
-
created_at: OBJECTS[kind].created,
|
|
635
|
-
updated_at: OBJECTS[kind].modified,
|
|
636
|
-
// A company's own `type` property (Prospect, Partner…), as b24 maps `type` to its company type.
|
|
637
|
-
...kind === "organization" ? { type: "type" } : {}
|
|
638
|
-
})[field2], "liveField");
|
|
639
|
-
var MAX_PROPERTIES_CHARS = 6e3;
|
|
640
|
-
var fitted = /* @__PURE__ */ __name((own, custom) => {
|
|
641
|
-
const kept = [...own];
|
|
642
|
-
let length = kept.join(",").length;
|
|
643
|
-
const dropped = [];
|
|
644
|
-
for (const name of custom) {
|
|
645
|
-
if (kept.includes(name))
|
|
646
|
-
continue;
|
|
647
|
-
if (length + name.length + 1 > MAX_PROPERTIES_CHARS)
|
|
648
|
-
dropped.push(name);
|
|
649
|
-
else {
|
|
650
|
-
kept.push(name);
|
|
651
|
-
length += name.length + 1;
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
return { properties: kept.join(","), dropped };
|
|
655
|
-
}, "fitted");
|
|
656
|
-
var OPERATORS = {
|
|
657
|
-
"=": "EQ",
|
|
658
|
-
"!=": "NEQ",
|
|
659
|
-
">": "GT",
|
|
660
|
-
">=": "GTE",
|
|
661
|
-
"<": "LT",
|
|
662
|
-
"<=": "LTE",
|
|
663
|
-
in: "IN"
|
|
664
|
-
};
|
|
665
|
-
var filtersOf = /* @__PURE__ */ __name((kind, conditions, defined) => conditions.map(({ field: field2, op, value }) => {
|
|
666
|
-
const propertyName = liveField(kind, field2) ?? defined.find((one) => one.code === field2)?.code;
|
|
667
|
-
if (!propertyName)
|
|
668
|
-
throw new CliError("validation_error", `${SERVICE} cannot filter ${OBJECTS[kind].name} by ${field2}`, {
|
|
669
|
-
reason: "query.unsupported-field"
|
|
670
|
-
});
|
|
671
|
-
if (Array.isArray(value))
|
|
672
|
-
return { propertyName, operator: op === "!=" ? "NOT_IN" : "IN", values: value.map(String) };
|
|
673
|
-
return { propertyName, operator: OPERATORS[op], value: String(value) };
|
|
674
|
-
}), "filtersOf");
|
|
675
|
-
var hubspotCrmSource = /* @__PURE__ */ __name((hub, options = {}) => {
|
|
676
|
-
const now = options.now ?? Date.now;
|
|
677
|
-
const listPage = options.page ?? LIST_PAGE;
|
|
678
|
-
const searchPage = options.searchPage ?? SEARCH_PAGE;
|
|
679
|
-
const metered = /* @__PURE__ */ __name((context) => {
|
|
680
|
-
let paid = false;
|
|
681
|
-
const pay = /* @__PURE__ */ __name(() => {
|
|
682
|
-
if (paid)
|
|
683
|
-
context?.spend();
|
|
684
|
-
paid = true;
|
|
685
|
-
}, "pay");
|
|
686
|
-
return {
|
|
687
|
-
get: /* @__PURE__ */ __name((path, query) => {
|
|
688
|
-
pay();
|
|
689
|
-
return hub().get(path, query);
|
|
690
|
-
}, "get"),
|
|
691
|
-
post: /* @__PURE__ */ __name((path, body) => {
|
|
692
|
-
pay();
|
|
693
|
-
return hub().post(path, body);
|
|
694
|
-
}, "post")
|
|
695
|
-
};
|
|
696
|
-
}, "metered");
|
|
697
|
-
const loaded = /* @__PURE__ */ new Map();
|
|
698
|
-
const fields = /* @__PURE__ */ __name((kind, caller) => {
|
|
699
|
-
let found = loaded.get(kind);
|
|
700
|
-
if (!found) {
|
|
701
|
-
found = caller.get(`/crm/properties/2026-03/${OBJECTS[kind].name}`).then((body) => resultsOf(body).flatMap((raw) => toField(raw) ?? [])).catch((error) => {
|
|
702
|
-
if (refused(error))
|
|
703
|
-
return [];
|
|
704
|
-
loaded.delete(kind);
|
|
705
|
-
throw error;
|
|
706
|
-
});
|
|
707
|
-
loaded.set(kind, found);
|
|
708
|
-
}
|
|
709
|
-
return found;
|
|
710
|
-
}, "fields");
|
|
711
|
-
let currency;
|
|
712
|
-
const currencyOf = /* @__PURE__ */ __name((caller) => {
|
|
713
|
-
currency ??= accountDetails(caller).then((details) => details.companyCurrency ?? null, (error) => {
|
|
714
|
-
currency = void 0;
|
|
715
|
-
throw error;
|
|
716
|
-
});
|
|
717
|
-
return currency;
|
|
718
|
-
}, "currencyOf");
|
|
719
|
-
const mapped = /* @__PURE__ */ __name(async (kind, rows, defined, caller) => {
|
|
720
|
-
if (kind === "deal") {
|
|
721
|
-
const bare = rows.some((raw) => {
|
|
722
|
-
const properties = propertiesOf(raw);
|
|
723
|
-
return text3(properties.amount) !== null && text3(properties.deal_currency_code) === null;
|
|
724
|
-
});
|
|
725
|
-
const fallback = bare ? await currencyOf(caller) : null;
|
|
726
|
-
return rows.map((raw) => toDeal(raw, defined, fallback));
|
|
727
|
-
}
|
|
728
|
-
const map = { lead: toLead, person: toPerson, organization: toOrganization }[kind];
|
|
729
|
-
return rows.map((raw) => map(raw, defined));
|
|
730
|
-
}, "mapped");
|
|
731
|
-
const synced = /* @__PURE__ */ __name((kind, caller) => kind === "person" ? Promise.resolve([]) : fields(kind, caller), "synced");
|
|
732
|
-
const propertiesFor = /* @__PURE__ */ __name((type, defined) => [
|
|
733
|
-
.../* @__PURE__ */ new Set([...type.properties, ...defined.map(({ code }) => code)])
|
|
734
|
-
], "propertiesFor");
|
|
735
|
-
const associate = /* @__PURE__ */ __name(async (type, rows, caller, types) => {
|
|
736
|
-
let linked = rows;
|
|
737
|
-
const ids = rows.flatMap((raw) => id3(raw.id) ?? []);
|
|
738
|
-
for (const to of types)
|
|
739
|
-
linked = withAssociations(linked, to, await associationsOf(caller.post, type.name, to, ids));
|
|
740
|
-
return linked;
|
|
741
|
-
}, "associate");
|
|
742
|
-
const everyLink = /* @__PURE__ */ __name((type) => [...type.associations, ...type.linked], "everyLink");
|
|
743
|
-
const getProperties = /* @__PURE__ */ __name((kind, defined, context) => {
|
|
744
|
-
const { properties, dropped } = fitted(OBJECTS[kind].properties, defined.map(({ code }) => code));
|
|
745
|
-
if (dropped.length)
|
|
746
|
-
context?.gap({
|
|
747
|
-
kind,
|
|
748
|
-
message: `${dropped.length} of the account's own ${OBJECTS[kind].name} properties do not fit one request and were not read`
|
|
749
|
-
});
|
|
750
|
-
return properties;
|
|
751
|
-
}, "getProperties");
|
|
752
|
-
const readChanges = /* @__PURE__ */ __name(async (kind, cursor, page, caller, context) => {
|
|
753
|
-
const type = OBJECTS[kind];
|
|
754
|
-
const since = cursor === null ? null : Date.parse(cursor);
|
|
755
|
-
if (since !== null && Number.isNaN(since))
|
|
756
|
-
return { reset: true };
|
|
757
|
-
const { after, spot: saved, started } = pageOf2(page, now());
|
|
758
|
-
const defined = await synced(kind, caller);
|
|
759
|
-
const properties = propertiesFor(type, defined);
|
|
760
|
-
const ended = { hasMore: false, cursor: new Date(started).toISOString() };
|
|
761
|
-
if (since === null) {
|
|
762
|
-
const query = {
|
|
763
|
-
limit: listPage,
|
|
764
|
-
properties: getProperties(kind, defined, context),
|
|
765
|
-
archived: false,
|
|
766
|
-
...type.associations.length ? { associations: type.associations.join(",") } : {},
|
|
767
|
-
...after ? { after } : {}
|
|
768
|
-
};
|
|
769
|
-
const body = await caller.get(`/crm/objects/2026-03/${type.path}`, query);
|
|
770
|
-
const rows2 = await associate(type, resultsOf(body).map((raw) => asked(raw, type.associations)), caller, type.linked);
|
|
771
|
-
const items2 = await mapped(kind, rows2, defined, caller);
|
|
772
|
-
const next2 = nextOf(body);
|
|
773
|
-
return next2 ? { items: items2, hasMore: true, nextCursor: `l${next2}@${started}` } : { items: items2, ...ended };
|
|
774
|
-
}
|
|
775
|
-
const spot = saved ?? { from: since - OVERLAP_MS, offset: 0 };
|
|
776
|
-
const { rows, more } = await search(caller.post, type.path, modifiedSince(type.modified, spot, searchPage, properties));
|
|
777
|
-
const items = await mapped(kind, await associate(type, rows, caller, everyLink(type)), defined, caller);
|
|
778
|
-
if (!more)
|
|
779
|
-
return { items, ...ended };
|
|
780
|
-
const next = nextSpot(spot, rows, type.modified, searchPage);
|
|
781
|
-
if (next === null)
|
|
782
|
-
return { reset: true };
|
|
783
|
-
return { items, hasMore: true, nextCursor: `s${next.from}.${next.offset}@${started}` };
|
|
784
|
-
}, "readChanges");
|
|
785
|
-
const known = /* @__PURE__ */ __name(async (kind, caller) => fields(kind, caller), "known");
|
|
786
|
-
return {
|
|
787
|
-
provider: "hubspot",
|
|
788
|
-
traits: { kinds: ["organization", "person", "deal", "lead"], removedInChanges: false },
|
|
789
|
-
async pipelines(kind, context) {
|
|
790
|
-
try {
|
|
791
|
-
const body = await metered(context).get(`/crm/pipelines/2026-03/${PIPELINES[kind]}`);
|
|
792
|
-
return resultsOf(body).flatMap((raw) => {
|
|
793
|
-
const pipeline = toPipeline(raw, kind, (stage) => context?.gap({
|
|
794
|
-
kind,
|
|
795
|
-
message: `closed lead stage ${stage}: HubSpot gives no outcome; counted as lost`
|
|
796
|
-
}));
|
|
797
|
-
return pipeline ? [pipeline] : [];
|
|
798
|
-
});
|
|
799
|
-
} catch (error) {
|
|
800
|
-
if (kind === "lead" && refused(error)) {
|
|
801
|
-
context?.gap({ kind: "lead", scope: OBJECTS.lead.scope, message: leadsRefused });
|
|
802
|
-
return [];
|
|
803
|
-
}
|
|
804
|
-
throw scoped(error, OBJECTS[kind].scope);
|
|
805
|
-
}
|
|
806
|
-
},
|
|
807
|
-
async changes(kind, cursor, page, context) {
|
|
808
|
-
try {
|
|
809
|
-
return await readChanges(kind, cursor, page, metered(context), context);
|
|
810
|
-
} catch (error) {
|
|
811
|
-
if (kind === "lead" && refused(error)) {
|
|
812
|
-
context?.gap({ kind: "lead", scope: OBJECTS.lead.scope, message: leadsRefused });
|
|
813
|
-
return { items: [], hasMore: false, cursor: null };
|
|
814
|
-
}
|
|
815
|
-
throw scoped(error, OBJECTS[kind].scope);
|
|
816
|
-
}
|
|
817
|
-
},
|
|
818
|
-
// Any other refusal fails the pass rather than answer no ids, which would mark every stored row deleted
|
|
819
|
-
// (WC-DATA-7). Leads are the exception: an account without Sales Hub Pro never has any, and core holds back a pass
|
|
820
|
-
// that would delete most of a kind until --rescan.
|
|
821
|
-
async ids(kind, page, context) {
|
|
822
|
-
const type = OBJECTS[kind];
|
|
823
|
-
try {
|
|
824
|
-
const body = await metered(context).get(`/crm/objects/2026-03/${type.path}`, {
|
|
825
|
-
limit: listPage,
|
|
826
|
-
properties: "hs_object_id",
|
|
827
|
-
archived: false,
|
|
828
|
-
...page ? { after: page } : {}
|
|
829
|
-
});
|
|
830
|
-
const items = resultsOf(body).flatMap((raw) => id3(raw.id) ?? []);
|
|
831
|
-
const next = nextOf(body);
|
|
832
|
-
return next ? { items, hasMore: true, nextCursor: next } : { items, hasMore: false };
|
|
833
|
-
} catch (error) {
|
|
834
|
-
if (kind === "lead" && refused(error)) {
|
|
835
|
-
context?.gap({ kind: "lead", scope: type.scope, message: leadsRefused });
|
|
836
|
-
return { items: [], hasMore: false };
|
|
837
|
-
}
|
|
838
|
-
throw scoped(error, type.scope);
|
|
839
|
-
}
|
|
840
|
-
},
|
|
841
|
-
async fields(kind, context) {
|
|
842
|
-
return fields(kind, metered(context));
|
|
843
|
-
},
|
|
844
|
-
// Active owners, then the deactivated ones, which `archived=true` lists alone (owners guide).
|
|
845
|
-
async users(context) {
|
|
846
|
-
const caller = metered(context);
|
|
847
|
-
const users = [];
|
|
848
|
-
for (const archived of [false, true]) {
|
|
849
|
-
let after = null;
|
|
850
|
-
do {
|
|
851
|
-
const body = await caller.get("/crm/owners/2026-03", { limit: LIST_PAGE, archived, ...after ? { after } : {} }).catch((error) => {
|
|
852
|
-
throw scoped(error, "crm.objects.owners.read");
|
|
853
|
-
});
|
|
854
|
-
for (const raw of resultsOf(body)) {
|
|
855
|
-
const user = toUser(raw);
|
|
856
|
-
if (user)
|
|
857
|
-
users.push(user);
|
|
858
|
-
}
|
|
859
|
-
after = nextOf(body);
|
|
860
|
-
} while (after);
|
|
861
|
-
}
|
|
862
|
-
return [...new Map(users.map((user) => [user.externalId, user])).values()];
|
|
863
|
-
},
|
|
864
|
-
async list(kind, query, context) {
|
|
865
|
-
const caller = metered(context);
|
|
866
|
-
const type = OBJECTS[kind];
|
|
867
|
-
const defined = await known(kind, caller);
|
|
868
|
-
const filters = filtersOf(kind, query.conditions, defined);
|
|
869
|
-
const properties = propertiesFor(type, defined);
|
|
870
|
-
const page = await walk(crmWindowOf(query), SEARCH_PAGE, async (offset, limit) => {
|
|
871
|
-
const { rows, more } = await search(caller.post, type.path, {
|
|
872
|
-
filters,
|
|
873
|
-
sort: { propertyName: type.created, direction: "DESCENDING" },
|
|
874
|
-
properties,
|
|
875
|
-
limit,
|
|
876
|
-
offset,
|
|
877
|
-
...query.text ? { query: query.text } : {}
|
|
878
|
-
});
|
|
879
|
-
return { rows: await associate(type, rows, caller, everyLink(type)), more };
|
|
880
|
-
});
|
|
881
|
-
return { items: await mapped(kind, page.items, defined, caller), hasMore: page.hasMore };
|
|
882
|
-
},
|
|
883
|
-
get: /* @__PURE__ */ __name((kind, externalId, context) => record(kind, externalId, context), "get"),
|
|
884
|
-
record,
|
|
885
|
-
activities: /* @__PURE__ */ __name((since, page, context) => readActivities(metered(context), since, page, context, now, { search: searchPage, list: listPage }), "activities")
|
|
886
|
-
};
|
|
887
|
-
async function record(kind, externalId, context) {
|
|
888
|
-
if (!/^\d{1,20}$/.test(externalId))
|
|
889
|
-
return null;
|
|
890
|
-
const caller = metered(context);
|
|
891
|
-
const type = OBJECTS[kind];
|
|
892
|
-
const defined = await fields(kind, caller);
|
|
893
|
-
let body;
|
|
894
|
-
try {
|
|
895
|
-
body = await caller.get(`/crm/objects/2026-03/${type.path}/${segment(externalId)}`, {
|
|
896
|
-
properties: getProperties(kind, defined, context),
|
|
897
|
-
...type.associations.length ? { associations: type.associations.join(",") } : {}
|
|
898
|
-
});
|
|
899
|
-
} catch (error) {
|
|
900
|
-
if (unseen(error))
|
|
901
|
-
return null;
|
|
902
|
-
throw error;
|
|
903
|
-
}
|
|
904
|
-
if (typeof body !== "object" || body === null)
|
|
905
|
-
return null;
|
|
906
|
-
const rows = await associate(type, [asked(body, type.associations)], caller, type.linked);
|
|
907
|
-
const [found] = await mapped(kind, rows, defined, caller);
|
|
908
|
-
return found ?? null;
|
|
909
|
-
}
|
|
910
|
-
__name(record, "record");
|
|
911
|
-
}, "hubspotCrmSource");
|
|
912
|
-
var leadsRefused = "HubSpot refused the leads: they need Sales Hub Professional or Enterprise and the crm.objects.leads.read scope; deals, contacts and companies are copied without them";
|
|
913
|
-
export {
|
|
914
|
-
MAX_PROPERTIES_CHARS,
|
|
915
|
-
fitted,
|
|
916
|
-
hubspotCrmSource
|
|
917
|
-
};
|