@wirecat/hubspot-cli 0.1.0 → 0.2.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 +24 -0
- package/README.md +40 -16
- package/contracts/wirecat.json +1441 -136
- package/dist/bin/hubspot.js +2 -2
- package/dist/bundle/{app-server-422MCA7S.js → app-server-GXV2OFML.js} +5 -5
- package/dist/bundle/chunk-2UOJ7DLZ.js +46 -0
- package/dist/bundle/{chunk-BKXDHU3G.js → chunk-3WLYWRGG.js} +1 -1
- package/dist/bundle/{chunk-SAKK2YRU.js → chunk-GPYCBYX5.js} +1 -1
- package/dist/bundle/chunk-IJADZW42.js +195 -0
- package/dist/bundle/{chunk-2TWQIWWG.js → chunk-LXZ66MCH.js} +2 -2
- package/dist/bundle/{chunk-WQBX7XYP.js → chunk-MFNMKHML.js} +807 -519
- package/dist/bundle/{chunk-HTAN663T.js → chunk-Q2OLOMHL.js} +1 -1
- package/dist/bundle/{chunk-LNV33FDC.js → chunk-TLKEPUAV.js} +4 -4
- package/dist/bundle/{chunk-JRCPCVPI.js → chunk-URX6YDUL.js} +2 -2
- package/dist/bundle/{chunk-ZBDSHFG4.js → chunk-VOH7S5M4.js} +1301 -1271
- package/dist/bundle/{chunk-X7XUX7A4.js → chunk-YMCY7VRE.js} +4 -4
- package/dist/bundle/{chunk-VIEYMDBR.js → chunk-Z73OL5HV.js} +1 -1
- package/dist/bundle/{dist-MYZZKZJ7.js → dist-7TGU56B2.js} +1 -1
- package/dist/bundle/{first-run-RPIJZEDT.js → first-run-UWAFSINQ.js} +1 -1
- package/dist/bundle/hubspot.js +2 -2
- package/dist/bundle/{program-POG5GHUQ.js → program-XA4C44Z4.js} +173 -40
- package/dist/bundle/{server-XJSNF3K5.js → server-ATG5KY7K.js} +2 -2
- package/dist/bundle/{server-C3ZHA7AZ.js → server-VNWVVH7A.js} +5 -5
- package/dist/bundle/{source-A3SBLHC4.js → source-54HR4IWG.js} +68 -341
- package/dist/bundle/{store-CCDNUB6A.js → store-DXWYNVVB.js} +2 -2
- package/dist/bundle/{store-maintenance-command-BRCG6MNA.js → store-maintenance-command-J57HCJYY.js} +3 -3
- package/dist/bundle/writer-NLLI5YRM.js +79 -0
- package/dist/commands/api.d.ts +4 -4
- package/dist/commands/api.d.ts.map +1 -1
- package/dist/commands/api.js +12 -7
- package/dist/commands/api.js.map +1 -1
- package/dist/commands/crm-shared.d.ts +2 -2
- package/dist/commands/crm-shared.d.ts.map +1 -1
- package/dist/commands/crm-shared.js +20 -4
- package/dist/commands/crm-shared.js.map +1 -1
- package/dist/config.d.ts +46 -8
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +137 -12
- package/dist/config.js.map +1 -1
- package/dist/context.d.ts +2 -2
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -1
- package/dist/context.js.map +1 -1
- package/dist/crm/source.d.ts +7 -2
- package/dist/crm/source.d.ts.map +1 -1
- package/dist/crm/source.js +26 -29
- package/dist/crm/source.js.map +1 -1
- package/dist/crm/writer.d.ts +15 -0
- package/dist/crm/writer.d.ts.map +1 -0
- package/dist/crm/writer.js +199 -0
- package/dist/crm/writer.js.map +1 -0
- package/dist/generated/manifest.d.ts.map +1 -1
- package/dist/generated/manifest.js +6 -1
- package/dist/generated/manifest.js.map +1 -1
- package/dist/hubspot/transport.d.ts +6 -1
- package/dist/hubspot/transport.d.ts.map +1 -1
- package/dist/hubspot/transport.js +13 -5
- package/dist/hubspot/transport.js.map +1 -1
- package/dist/identity.js +3 -3
- package/dist/identity.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +2 -1
- package/dist/program.js.map +1 -1
- package/dist/setup/texts.en.json +3 -3
- package/dist/setup/texts.es.json +3 -3
- package/dist/setup/texts.ru.json +3 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/skills/hubspot-cli/SKILL.md +13 -8
- package/skills/hubspot-cli/references/api/api-advanced.md +51 -0
- package/skills/hubspot-cli/references/api/api-basic.md +602 -0
- package/skills/hubspot-cli/references/api/api-batch.md +575 -0
- package/skills/hubspot-cli/references/api.md +3 -2
- package/dist/commands/comments.d.ts +0 -3
- package/dist/commands/comments.d.ts.map +0 -1
- package/dist/commands/comments.js +0 -114
- package/dist/commands/comments.js.map +0 -1
- package/dist/sample/comments.d.ts +0 -61
- package/dist/sample/comments.d.ts.map +0 -1
- package/dist/sample/comments.js +0 -39
- package/dist/sample/comments.js.map +0 -1
- package/dist/sample/records.d.ts +0 -16
- package/dist/sample/records.d.ts.map +0 -1
- package/dist/sample/records.js +0 -22
- package/dist/sample/records.js.map +0 -1
- package/dist/sample/transport.d.ts +0 -42
- package/dist/sample/transport.d.ts.map +0 -1
- package/dist/sample/transport.js +0 -153
- package/dist/sample/transport.js.map +0 -1
package/dist/bin/hubspot.js
CHANGED
|
@@ -9,7 +9,7 @@ if (
|
|
|
9
9
|
(words[0] === "--version" || words[0] === "-V") &&
|
|
10
10
|
!Object.keys(process.env).some((key) => key.endsWith("_TEST_ARGV_LOG"))
|
|
11
11
|
) {
|
|
12
|
-
process.stdout.write("0.
|
|
12
|
+
process.stdout.write("0.2.0\n")
|
|
13
13
|
} else {
|
|
14
14
|
// Before the bundle compiles: the bundle's own call comes after its chunks.
|
|
15
15
|
module.enableCompileCache()
|
|
@@ -28,7 +28,7 @@ if (
|
|
|
28
28
|
: next(specifier, context),
|
|
29
29
|
})
|
|
30
30
|
}
|
|
31
|
-
const chunks = ["../bundle/all-profiles-64JAUYW4.js","../bundle/anthropic-VJOS4OUM.js","../bundle/app-server-
|
|
31
|
+
const chunks = ["../bundle/all-profiles-64JAUYW4.js","../bundle/anthropic-VJOS4OUM.js","../bundle/app-server-GXV2OFML.js","../bundle/bun-M3J2QTR3.js","../bundle/bun-sqlite-IX3XYA5F.js","../bundle/decode-FC65Y4IV.js","../bundle/definitions-MVPICAWV.js","../bundle/dispatch-KOISQ5QJ.js","../bundle/dist-7TGU56B2.js","../bundle/echarts-FVTUDXDU.js","../bundle/embed-VNBZFPYH.js","../bundle/embedder-6U4NOFRO.js","../bundle/failure-FZ6VYKEQ.js","../bundle/first-screen-RTVMGHAE.js","../bundle/instructions-HET7BCYK.js","../bundle/mcp-RGNRW77S.js","../bundle/node-CXZIFHZC.js","../bundle/node-P4E63KXA.js","../bundle/node-TLZSIHIJ.js","../bundle/node-sqlite-P3O7XN7Q.js","../bundle/oauth-HNCY4B2S.js","../bundle/open-F4P6YV54.js","../bundle/openai-4AICLIK3.js","../bundle/process-5RUXWGYS.js","../bundle/program-XA4C44Z4.js","../bundle/prompt-NFMDVBZ4.js","../bundle/recognize-DKN3RY4V.js","../bundle/remote-6QHAGQWY.js","../bundle/rerank-M4KHEHUZ.js","../bundle/schemas-JRL3DLMP.js","../bundle/serve-DNU43ND6.js","../bundle/server-ATG5KY7K.js","../bundle/server-VNWVVH7A.js","../bundle/source-54HR4IWG.js","../bundle/sqlite-runtime-EMQAC63N.js","../bundle/state-T45CX7VY.js","../bundle/store-6LCEVBAZ.js","../bundle/store-6TZ2FCVA.js","../bundle/store-DXWYNVVB.js","../bundle/store-maintenance-command-J57HCJYY.js","../bundle/writer-NLLI5YRM.js"]
|
|
32
32
|
if (((words) => words
|
|
33
33
|
.filter((word) => !word.startsWith("-"))
|
|
34
34
|
.slice(0, 2)
|
|
@@ -3,10 +3,10 @@ const require = __bundleRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
PER_RUN,
|
|
5
5
|
envelope
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-TLKEPUAV.js";
|
|
7
7
|
import {
|
|
8
8
|
mcpUrlOf
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-LXZ66MCH.js";
|
|
10
10
|
import "./chunk-X2M6NIQG.js";
|
|
11
11
|
import {
|
|
12
12
|
answered,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
registerCommands,
|
|
15
15
|
runCommandForAgent,
|
|
16
16
|
toolsFromCommands
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-Q2OLOMHL.js";
|
|
18
18
|
import {
|
|
19
19
|
agentJson,
|
|
20
20
|
skillResources
|
|
@@ -24,8 +24,8 @@ import {
|
|
|
24
24
|
answeredWire,
|
|
25
25
|
serveStdio
|
|
26
26
|
} from "./chunk-4W6BMH45.js";
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import "./chunk-
|
|
27
|
+
import "./chunk-3WLYWRGG.js";
|
|
28
|
+
import "./chunk-VOH7S5M4.js";
|
|
29
29
|
import "./chunk-2QZK5BEP.js";
|
|
30
30
|
import "./chunk-WE4UFASG.js";
|
|
31
31
|
import "./chunk-RR5MX5TM.js";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
SERVICE
|
|
5
|
+
} from "./chunk-MFNMKHML.js";
|
|
6
|
+
import {
|
|
7
|
+
integer,
|
|
8
|
+
maxLength,
|
|
9
|
+
minValue,
|
|
10
|
+
number,
|
|
11
|
+
object,
|
|
12
|
+
optional,
|
|
13
|
+
pipe,
|
|
14
|
+
regex,
|
|
15
|
+
safeParse,
|
|
16
|
+
string
|
|
17
|
+
} from "./chunk-MVA5HVKL.js";
|
|
18
|
+
import {
|
|
19
|
+
CliError
|
|
20
|
+
} from "./chunk-DB2XKHI4.js";
|
|
21
|
+
import {
|
|
22
|
+
__name
|
|
23
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
24
|
+
|
|
25
|
+
// dist/hubspot/account.js
|
|
26
|
+
var DETAILS = object({
|
|
27
|
+
portalId: pipe(number(), integer(), minValue(1)),
|
|
28
|
+
uiDomain: pipe(string(), regex(/^[a-z0-9.-]{1,253}$/i)),
|
|
29
|
+
timeZone: pipe(string(), maxLength(64)),
|
|
30
|
+
accountType: pipe(string(), maxLength(64)),
|
|
31
|
+
companyCurrency: optional(string())
|
|
32
|
+
});
|
|
33
|
+
var accountDetails = /* @__PURE__ */ __name(async (hub) => {
|
|
34
|
+
const parsed = safeParse(DETAILS, await hub.get("/account-info/2026-03/details"));
|
|
35
|
+
if (!parsed.success)
|
|
36
|
+
throw new CliError("invalid_response", `${SERVICE}'s account details do not have the documented shape`);
|
|
37
|
+
const { companyCurrency, ...details } = parsed.output;
|
|
38
|
+
return {
|
|
39
|
+
...details,
|
|
40
|
+
...companyCurrency && /^[A-Z]{3}$/.test(companyCurrency) ? { companyCurrency } : {}
|
|
41
|
+
};
|
|
42
|
+
}, "accountDetails");
|
|
43
|
+
|
|
44
|
+
export {
|
|
45
|
+
accountDetails
|
|
46
|
+
};
|
|
@@ -114,7 +114,7 @@ var askLanguages = /* @__PURE__ */ __name(async ({ command, env, io, contentLang
|
|
|
114
114
|
return;
|
|
115
115
|
const [{ openCache }, { buildStems }] = await Promise.all([
|
|
116
116
|
import("./open-F4P6YV54.js"),
|
|
117
|
-
import("./store-maintenance-command-
|
|
117
|
+
import("./store-maintenance-command-J57HCJYY.js")
|
|
118
118
|
]);
|
|
119
119
|
const database = await openCache(storePath(env));
|
|
120
120
|
try {
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
OBJECTS,
|
|
5
|
+
SERVICE,
|
|
6
|
+
segment
|
|
7
|
+
} from "./chunk-MFNMKHML.js";
|
|
8
|
+
import {
|
|
9
|
+
foldFieldName,
|
|
10
|
+
values_exports
|
|
11
|
+
} from "./chunk-VOH7S5M4.js";
|
|
12
|
+
import {
|
|
13
|
+
CliError,
|
|
14
|
+
isCliError
|
|
15
|
+
} from "./chunk-DB2XKHI4.js";
|
|
16
|
+
import {
|
|
17
|
+
__name
|
|
18
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
19
|
+
|
|
20
|
+
// dist/crm/writer.js
|
|
21
|
+
var HUBSPOT_WRITES = {
|
|
22
|
+
kinds: ["deal", "person", "organization"],
|
|
23
|
+
verbs: ["create", "update", "move", "close", "remove"],
|
|
24
|
+
idempotent: false
|
|
25
|
+
};
|
|
26
|
+
var OWN = {
|
|
27
|
+
deal: new Set(["dealname", "pipeline", "dealstage", "amount", "deal_currency_code", "closedate", "hubspot_owner_id"].map(foldFieldName)),
|
|
28
|
+
person: new Set(["firstname", "lastname", "email", "phone", "mobilephone", "jobtitle", "hubspot_owner_id"].map(foldFieldName)),
|
|
29
|
+
organization: new Set(["name", "phone", "hubspot_owner_id"].map(foldFieldName))
|
|
30
|
+
};
|
|
31
|
+
var refused = /* @__PURE__ */ __name((message, param) => new CliError("validation_error", message, { reason: "crm.record-field", sent: false, ...param ? { param } : {} }), "refused");
|
|
32
|
+
var ID = /^\d{1,20}$/;
|
|
33
|
+
var idOf = /* @__PURE__ */ __name((value, param) => {
|
|
34
|
+
if (!ID.test(value))
|
|
35
|
+
throw refused(`${param} takes ${SERVICE}'s numeric id`, param);
|
|
36
|
+
return value;
|
|
37
|
+
}, "idOf");
|
|
38
|
+
var cleared = /* @__PURE__ */ __name((value) => value ?? "", "cleared");
|
|
39
|
+
var customOf = /* @__PURE__ */ __name((kind, custom) => {
|
|
40
|
+
const properties = {};
|
|
41
|
+
for (const [code, value] of Object.entries(custom ?? {})) {
|
|
42
|
+
if (OWN[kind].has(foldFieldName(code)))
|
|
43
|
+
throw refused(`${code} is one of ${SERVICE}'s own properties; set it with its own option, not --field`, "--field");
|
|
44
|
+
properties[code] = Array.isArray(value) ? value.join(";") : cleared(value);
|
|
45
|
+
}
|
|
46
|
+
return properties;
|
|
47
|
+
}, "customOf");
|
|
48
|
+
var listOf = /* @__PURE__ */ __name((values) => values?.map((one) => one.trim()).filter(Boolean), "listOf");
|
|
49
|
+
var dealOf = /* @__PURE__ */ __name((given) => {
|
|
50
|
+
if (given.people !== void 0 || given.organization !== void 0)
|
|
51
|
+
throw refused(`set a deal's contacts and company with ${SERVICE}'s associations, through api`);
|
|
52
|
+
const properties = customOf("deal", given.custom);
|
|
53
|
+
if (given.title !== void 0)
|
|
54
|
+
properties.dealname = given.title;
|
|
55
|
+
if (given.pipeline !== void 0)
|
|
56
|
+
properties.pipeline = given.pipeline;
|
|
57
|
+
if (given.stage !== void 0)
|
|
58
|
+
properties.dealstage = given.stage;
|
|
59
|
+
if (given.amount !== void 0)
|
|
60
|
+
properties.amount = cleared(given.amount);
|
|
61
|
+
if (given.currency !== void 0)
|
|
62
|
+
properties.deal_currency_code = cleared(given.currency);
|
|
63
|
+
if (given.closeDate !== void 0)
|
|
64
|
+
properties.closedate = given.closeDate ? `${given.closeDate}T12:00:00.000Z` : "";
|
|
65
|
+
if (given.owner !== void 0)
|
|
66
|
+
properties.hubspot_owner_id = given.owner === null ? "" : idOf(given.owner, "--owner");
|
|
67
|
+
return properties;
|
|
68
|
+
}, "dealOf");
|
|
69
|
+
var personOf = /* @__PURE__ */ __name((given) => {
|
|
70
|
+
const properties = customOf("person", given.custom);
|
|
71
|
+
if (given.name !== void 0 && given.firstName === void 0 && given.lastName === void 0) {
|
|
72
|
+
const [first, ...rest] = given.name.trim().split(/\s+/);
|
|
73
|
+
properties.firstname = first ?? "";
|
|
74
|
+
properties.lastname = rest.join(" ");
|
|
75
|
+
}
|
|
76
|
+
if (given.firstName !== void 0)
|
|
77
|
+
properties.firstname = cleared(given.firstName);
|
|
78
|
+
if (given.lastName !== void 0)
|
|
79
|
+
properties.lastname = cleared(given.lastName);
|
|
80
|
+
if (given.position !== void 0)
|
|
81
|
+
properties.jobtitle = cleared(given.position);
|
|
82
|
+
const emails = listOf(given.emails);
|
|
83
|
+
if (emails) {
|
|
84
|
+
if (emails.length > 1)
|
|
85
|
+
throw refused(`${SERVICE} keeps one e-mail per contact here; give one --email`, "--email");
|
|
86
|
+
properties.email = emails[0] ?? "";
|
|
87
|
+
}
|
|
88
|
+
const phones = listOf(given.phones);
|
|
89
|
+
if (phones) {
|
|
90
|
+
if (phones.length > 2)
|
|
91
|
+
throw refused(`${SERVICE} keeps two numbers per contact, phone and mobile; give at most two --phone`, "--phone");
|
|
92
|
+
properties.phone = phones[0] ?? "";
|
|
93
|
+
properties.mobilephone = phones[1] ?? "";
|
|
94
|
+
}
|
|
95
|
+
if (given.owner !== void 0)
|
|
96
|
+
properties.hubspot_owner_id = given.owner === null ? "" : idOf(given.owner, "--owner");
|
|
97
|
+
return properties;
|
|
98
|
+
}, "personOf");
|
|
99
|
+
var organizationOf = /* @__PURE__ */ __name((given) => {
|
|
100
|
+
const properties = customOf("organization", given.custom);
|
|
101
|
+
if (given.name !== void 0)
|
|
102
|
+
properties.name = given.name;
|
|
103
|
+
if (listOf(given.emails)?.length)
|
|
104
|
+
throw refused(`a ${SERVICE} company has no e-mail property; set the contacts' e-mails instead`, "--email");
|
|
105
|
+
const phones = listOf(given.phones);
|
|
106
|
+
if (phones) {
|
|
107
|
+
if (phones.length > 1)
|
|
108
|
+
throw refused(`a ${SERVICE} company keeps one number; give one --phone`, "--phone");
|
|
109
|
+
properties.phone = phones[0] ?? "";
|
|
110
|
+
}
|
|
111
|
+
if (given.owner !== void 0)
|
|
112
|
+
properties.hubspot_owner_id = given.owner === null ? "" : idOf(given.owner, "--owner");
|
|
113
|
+
return properties;
|
|
114
|
+
}, "organizationOf");
|
|
115
|
+
var propertiesFor = /* @__PURE__ */ __name((kind, given) => {
|
|
116
|
+
if (kind === "deal")
|
|
117
|
+
return dealOf(given);
|
|
118
|
+
if (kind === "person")
|
|
119
|
+
return personOf(given);
|
|
120
|
+
if (kind === "organization")
|
|
121
|
+
return organizationOf(given);
|
|
122
|
+
throw new CliError("validation_error", `${SERVICE} leads are written through api leads-create and leads-update`, {
|
|
123
|
+
reason: "crm.write-unsupported",
|
|
124
|
+
sent: false
|
|
125
|
+
});
|
|
126
|
+
}, "propertiesFor");
|
|
127
|
+
var pathOf = /* @__PURE__ */ __name((kind, externalId) => `/crm/objects/2026-03/${OBJECTS[kind].path}${externalId === void 0 ? "" : `/${segment(idOf(externalId, `<${kind}>`))}`}`, "pathOf");
|
|
128
|
+
var hubspotCrmWriter = /* @__PURE__ */ __name((hub, source) => {
|
|
129
|
+
const readBack = /* @__PURE__ */ __name(async (kind, externalId, options) => {
|
|
130
|
+
try {
|
|
131
|
+
const found = await source().record(kind, externalId);
|
|
132
|
+
if (!found)
|
|
133
|
+
throw new CliError("not_found", `${SERVICE} has no ${kind} ${externalId}`);
|
|
134
|
+
return found;
|
|
135
|
+
} catch (error) {
|
|
136
|
+
throw new CliError("invalid_response", `${SERVICE} made the change to ${kind} ${externalId}, but reading it back failed${isCliError(error) ? ` (${error.code})` : ""}; run sync to store it \u2014 do not write it again`, { operation_id: options.operationId, external_id: externalId, sent: true });
|
|
137
|
+
}
|
|
138
|
+
}, "readBack");
|
|
139
|
+
const update = /* @__PURE__ */ __name(async (kind, externalId, properties, options) => {
|
|
140
|
+
if (Object.keys(properties).length === 0)
|
|
141
|
+
throw refused("nothing to change: name a field");
|
|
142
|
+
await hub().patch(pathOf(kind, externalId), { properties });
|
|
143
|
+
return readBack(kind, externalId, options);
|
|
144
|
+
}, "update");
|
|
145
|
+
const closingStage = /* @__PURE__ */ __name(async (externalId, outcome) => {
|
|
146
|
+
const deal = await source().record("deal", externalId);
|
|
147
|
+
if (!deal)
|
|
148
|
+
throw new CliError("not_found", `${SERVICE} has no deal ${externalId}`, { sent: false });
|
|
149
|
+
const pipeline = (await source().pipelines("deal")).find((one) => one.externalId === deal.pipeline);
|
|
150
|
+
const stage = pipeline?.stages.find((one) => one.outcome === outcome);
|
|
151
|
+
if (!stage)
|
|
152
|
+
throw refused(`the deal's pipeline ${deal.pipeline} has no closed ${outcome} stage in ${SERVICE}`, "<outcome>");
|
|
153
|
+
return stage.externalId;
|
|
154
|
+
}, "closingStage");
|
|
155
|
+
return {
|
|
156
|
+
provider: "hubspot",
|
|
157
|
+
capabilities: HUBSPOT_WRITES,
|
|
158
|
+
async create(kind, draft, options) {
|
|
159
|
+
const properties = propertiesFor(kind, draft);
|
|
160
|
+
const answer = await hub().post(pathOf(kind), { properties, associations: [] });
|
|
161
|
+
const externalId = values_exports.id(values_exports.fieldOf(answer, "id"));
|
|
162
|
+
if (externalId === null)
|
|
163
|
+
throw new CliError("invalid_response", `${SERVICE} answered the new ${kind} without its id; run sync first`, {
|
|
164
|
+
operation_id: options.operationId,
|
|
165
|
+
sent: true
|
|
166
|
+
});
|
|
167
|
+
return readBack(kind, externalId, options);
|
|
168
|
+
},
|
|
169
|
+
async update(kind, externalId, patch, options) {
|
|
170
|
+
return update(kind, externalId, propertiesFor(kind, patch), options);
|
|
171
|
+
},
|
|
172
|
+
async move(kind, externalId, stage, options) {
|
|
173
|
+
return update(kind, externalId, propertiesFor(kind, { stage }), options);
|
|
174
|
+
},
|
|
175
|
+
async close(kind, externalId, outcome, options) {
|
|
176
|
+
const properties = propertiesFor(kind, { stage: await closingStage(externalId, outcome) });
|
|
177
|
+
if (options.reason !== void 0)
|
|
178
|
+
properties[`closed_${outcome}_reason`] = options.reason;
|
|
179
|
+
return update(kind, externalId, properties, options);
|
|
180
|
+
},
|
|
181
|
+
async remove(kind, externalId) {
|
|
182
|
+
if (kind !== "deal")
|
|
183
|
+
throw new CliError("validation_error", `${SERVICE} ${kind}s are deleted through api`, {
|
|
184
|
+
reason: "crm.write-unsupported",
|
|
185
|
+
sent: false
|
|
186
|
+
});
|
|
187
|
+
await hub().delete(pathOf(kind, externalId));
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
}, "hubspotCrmWriter");
|
|
191
|
+
|
|
192
|
+
export {
|
|
193
|
+
HUBSPOT_WRITES,
|
|
194
|
+
hubspotCrmWriter
|
|
195
|
+
};
|
|
@@ -3,7 +3,7 @@ const require = __bundleRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
refuseLocalWrite,
|
|
5
5
|
refuseUnknownPermissionKeys
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-3WLYWRGG.js";
|
|
7
7
|
import {
|
|
8
8
|
MAX_SEARCH_OFFSET,
|
|
9
9
|
SendJournal,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
senderIsMe,
|
|
20
20
|
sendsPathFor,
|
|
21
21
|
taskAccount
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-VOH7S5M4.js";
|
|
23
23
|
import {
|
|
24
24
|
commandPathOf
|
|
25
25
|
} from "./chunk-NWHEHV3K.js";
|