@particle-academy/hubspot-js 0.3.3 → 0.4.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 +36 -0
- package/README.md +206 -1
- package/art/fancified.svg +26 -0
- package/dist/chunk-FFT5OGGS.js +1086 -0
- package/dist/chunk-FFT5OGGS.js.map +1 -0
- package/dist/flow.cjs +1266 -12
- package/dist/flow.cjs.map +1 -1
- package/dist/flow.d.cts +18 -1
- package/dist/flow.d.ts +18 -1
- package/dist/flow.js +259 -4
- package/dist/flow.js.map +1 -1
- package/dist/index.cjs +1016 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +601 -1
- package/dist/index.d.ts +601 -1
- package/dist/index.js +1 -1
- package/package.json +4 -3
- package/dist/chunk-6HO2IP5Q.js +0 -104
- package/dist/chunk-6HO2IP5Q.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -3,6 +3,107 @@
|
|
|
3
3
|
var fancyConnectorCore = require('@particle-academy/fancy-connector-core');
|
|
4
4
|
|
|
5
5
|
// src/faker.ts
|
|
6
|
+
function fakeCompanyCreate({ config, fake }) {
|
|
7
|
+
const boundRecordId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
|
|
8
|
+
return {
|
|
9
|
+
"id": boundRecordId,
|
|
10
|
+
"properties": {
|
|
11
|
+
"name": "Acme",
|
|
12
|
+
"domain": "acme.example.test",
|
|
13
|
+
"hs_object_id": boundRecordId,
|
|
14
|
+
"createdate": "2026-01-01T00:00:00.000Z",
|
|
15
|
+
"lastmodifieddate": "2026-01-01T00:00:00.000Z"
|
|
16
|
+
},
|
|
17
|
+
"createdAt": "2026-01-01T00:00:00.000Z",
|
|
18
|
+
"updatedAt": "2026-01-01T00:00:00.000Z",
|
|
19
|
+
"archived": false
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function fakeCompanyGet({ config, fake }) {
|
|
23
|
+
const boundRecordId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
|
|
24
|
+
return {
|
|
25
|
+
"id": boundRecordId,
|
|
26
|
+
"properties": {
|
|
27
|
+
"name": "Acme",
|
|
28
|
+
"domain": "acme.example.test",
|
|
29
|
+
"hs_object_id": boundRecordId,
|
|
30
|
+
"createdate": "2026-01-01T00:00:00.000Z",
|
|
31
|
+
"lastmodifieddate": "2026-01-01T00:00:00.000Z"
|
|
32
|
+
},
|
|
33
|
+
"createdAt": "2026-01-01T00:00:00.000Z",
|
|
34
|
+
"updatedAt": "2026-01-01T00:00:00.000Z",
|
|
35
|
+
"archived": false
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function fakeCompanyList({ config, fake }) {
|
|
39
|
+
const boundRecordId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
|
|
40
|
+
return {
|
|
41
|
+
"results": [
|
|
42
|
+
{
|
|
43
|
+
"id": boundRecordId,
|
|
44
|
+
"properties": {
|
|
45
|
+
"name": "Acme",
|
|
46
|
+
"domain": "acme.example.test",
|
|
47
|
+
"hs_object_id": boundRecordId,
|
|
48
|
+
"createdate": "2026-01-01T00:00:00.000Z",
|
|
49
|
+
"lastmodifieddate": "2026-01-01T00:00:00.000Z"
|
|
50
|
+
},
|
|
51
|
+
"createdAt": "2026-01-01T00:00:00.000Z",
|
|
52
|
+
"updatedAt": "2026-01-01T00:00:00.000Z",
|
|
53
|
+
"archived": false
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"paging": {
|
|
57
|
+
"next": {
|
|
58
|
+
"after": "10",
|
|
59
|
+
"link": "?after=10"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function fakeCompanySearch({ config, fake }) {
|
|
65
|
+
const boundRecordId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
|
|
66
|
+
return {
|
|
67
|
+
"total": 1,
|
|
68
|
+
"results": [
|
|
69
|
+
{
|
|
70
|
+
"id": boundRecordId,
|
|
71
|
+
"properties": {
|
|
72
|
+
"name": "Acme",
|
|
73
|
+
"domain": "acme.example.test",
|
|
74
|
+
"hs_object_id": boundRecordId,
|
|
75
|
+
"createdate": "2026-01-01T00:00:00.000Z",
|
|
76
|
+
"lastmodifieddate": "2026-01-01T00:00:00.000Z"
|
|
77
|
+
},
|
|
78
|
+
"createdAt": "2026-01-01T00:00:00.000Z",
|
|
79
|
+
"updatedAt": "2026-01-01T00:00:00.000Z",
|
|
80
|
+
"archived": false
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
"paging": {
|
|
84
|
+
"next": {
|
|
85
|
+
"after": "10",
|
|
86
|
+
"link": "?after=10"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function fakeCompanyUpdate({ config, fake }) {
|
|
92
|
+
const boundRecordId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
|
|
93
|
+
return {
|
|
94
|
+
"id": boundRecordId,
|
|
95
|
+
"properties": {
|
|
96
|
+
"name": "Acme",
|
|
97
|
+
"domain": "acme.example.test",
|
|
98
|
+
"hs_object_id": boundRecordId,
|
|
99
|
+
"createdate": "2026-01-01T00:00:00.000Z",
|
|
100
|
+
"lastmodifieddate": "2026-01-01T00:00:00.000Z"
|
|
101
|
+
},
|
|
102
|
+
"createdAt": "2026-01-01T00:00:00.000Z",
|
|
103
|
+
"updatedAt": "2026-01-01T00:00:00.000Z",
|
|
104
|
+
"archived": false
|
|
105
|
+
};
|
|
106
|
+
}
|
|
6
107
|
function fakeContactCreate({ config, fake }) {
|
|
7
108
|
const boundContactId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
|
|
8
109
|
return {
|
|
@@ -23,10 +124,314 @@ function fakeContactCreate({ config, fake }) {
|
|
|
23
124
|
"archived": false
|
|
24
125
|
};
|
|
25
126
|
}
|
|
127
|
+
function fakeContactGet({ config, fake }) {
|
|
128
|
+
const boundRecordId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
|
|
129
|
+
return {
|
|
130
|
+
"id": boundRecordId,
|
|
131
|
+
"properties": {
|
|
132
|
+
"email": "rosa@example.test",
|
|
133
|
+
"firstname": "Rosa",
|
|
134
|
+
"lastname": "Diaz",
|
|
135
|
+
"hs_object_id": boundRecordId,
|
|
136
|
+
"createdate": "2026-01-01T00:00:00.000Z",
|
|
137
|
+
"lastmodifieddate": "2026-01-01T00:00:00.000Z"
|
|
138
|
+
},
|
|
139
|
+
"createdAt": "2026-01-01T00:00:00.000Z",
|
|
140
|
+
"updatedAt": "2026-01-01T00:00:00.000Z",
|
|
141
|
+
"archived": false
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
function fakeContactList({ config, fake }) {
|
|
145
|
+
const boundRecordId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
|
|
146
|
+
return {
|
|
147
|
+
"results": [
|
|
148
|
+
{
|
|
149
|
+
"id": boundRecordId,
|
|
150
|
+
"properties": {
|
|
151
|
+
"email": "rosa@example.test",
|
|
152
|
+
"firstname": "Rosa",
|
|
153
|
+
"lastname": "Diaz",
|
|
154
|
+
"hs_object_id": boundRecordId,
|
|
155
|
+
"createdate": "2026-01-01T00:00:00.000Z",
|
|
156
|
+
"lastmodifieddate": "2026-01-01T00:00:00.000Z"
|
|
157
|
+
},
|
|
158
|
+
"createdAt": "2026-01-01T00:00:00.000Z",
|
|
159
|
+
"updatedAt": "2026-01-01T00:00:00.000Z",
|
|
160
|
+
"archived": false
|
|
161
|
+
}
|
|
162
|
+
],
|
|
163
|
+
"paging": {
|
|
164
|
+
"next": {
|
|
165
|
+
"after": "10",
|
|
166
|
+
"link": "?after=10"
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function fakeContactSearch({ config, fake }) {
|
|
172
|
+
const boundRecordId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
|
|
173
|
+
return {
|
|
174
|
+
"total": 1,
|
|
175
|
+
"results": [
|
|
176
|
+
{
|
|
177
|
+
"id": boundRecordId,
|
|
178
|
+
"properties": {
|
|
179
|
+
"email": "rosa@example.test",
|
|
180
|
+
"firstname": "Rosa",
|
|
181
|
+
"lastname": "Diaz",
|
|
182
|
+
"hs_object_id": boundRecordId,
|
|
183
|
+
"createdate": "2026-01-01T00:00:00.000Z",
|
|
184
|
+
"lastmodifieddate": "2026-01-01T00:00:00.000Z"
|
|
185
|
+
},
|
|
186
|
+
"createdAt": "2026-01-01T00:00:00.000Z",
|
|
187
|
+
"updatedAt": "2026-01-01T00:00:00.000Z",
|
|
188
|
+
"archived": false
|
|
189
|
+
}
|
|
190
|
+
],
|
|
191
|
+
"paging": {
|
|
192
|
+
"next": {
|
|
193
|
+
"after": "10",
|
|
194
|
+
"link": "?after=10"
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
function fakeContactUpdate({ config, fake }) {
|
|
200
|
+
const boundRecordId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
|
|
201
|
+
return {
|
|
202
|
+
"id": boundRecordId,
|
|
203
|
+
"properties": {
|
|
204
|
+
"email": "rosa@example.test",
|
|
205
|
+
"firstname": "Rosa",
|
|
206
|
+
"lastname": "Diaz",
|
|
207
|
+
"hs_object_id": boundRecordId,
|
|
208
|
+
"createdate": "2026-01-01T00:00:00.000Z",
|
|
209
|
+
"lastmodifieddate": "2026-01-01T00:00:00.000Z"
|
|
210
|
+
},
|
|
211
|
+
"createdAt": "2026-01-01T00:00:00.000Z",
|
|
212
|
+
"updatedAt": "2026-01-01T00:00:00.000Z",
|
|
213
|
+
"archived": false
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
function fakeDealCreate({ config, fake }) {
|
|
217
|
+
const boundRecordId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
|
|
218
|
+
return {
|
|
219
|
+
"id": boundRecordId,
|
|
220
|
+
"properties": {
|
|
221
|
+
"dealname": "Acme renewal",
|
|
222
|
+
"amount": "12000",
|
|
223
|
+
"dealstage": "appointmentscheduled",
|
|
224
|
+
"pipeline": "default",
|
|
225
|
+
"hs_object_id": boundRecordId,
|
|
226
|
+
"createdate": "2026-01-01T00:00:00.000Z",
|
|
227
|
+
"lastmodifieddate": "2026-01-01T00:00:00.000Z"
|
|
228
|
+
},
|
|
229
|
+
"createdAt": "2026-01-01T00:00:00.000Z",
|
|
230
|
+
"updatedAt": "2026-01-01T00:00:00.000Z",
|
|
231
|
+
"archived": false
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
function fakeDealGet({ config, fake }) {
|
|
235
|
+
const boundRecordId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
|
|
236
|
+
return {
|
|
237
|
+
"id": boundRecordId,
|
|
238
|
+
"properties": {
|
|
239
|
+
"dealname": "Acme renewal",
|
|
240
|
+
"amount": "12000",
|
|
241
|
+
"dealstage": "appointmentscheduled",
|
|
242
|
+
"pipeline": "default",
|
|
243
|
+
"hs_object_id": boundRecordId,
|
|
244
|
+
"createdate": "2026-01-01T00:00:00.000Z",
|
|
245
|
+
"lastmodifieddate": "2026-01-01T00:00:00.000Z"
|
|
246
|
+
},
|
|
247
|
+
"createdAt": "2026-01-01T00:00:00.000Z",
|
|
248
|
+
"updatedAt": "2026-01-01T00:00:00.000Z",
|
|
249
|
+
"archived": false
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
function fakeDealList({ config, fake }) {
|
|
253
|
+
const boundRecordId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
|
|
254
|
+
return {
|
|
255
|
+
"results": [
|
|
256
|
+
{
|
|
257
|
+
"id": boundRecordId,
|
|
258
|
+
"properties": {
|
|
259
|
+
"dealname": "Acme renewal",
|
|
260
|
+
"amount": "12000",
|
|
261
|
+
"dealstage": "appointmentscheduled",
|
|
262
|
+
"pipeline": "default",
|
|
263
|
+
"hs_object_id": boundRecordId,
|
|
264
|
+
"createdate": "2026-01-01T00:00:00.000Z",
|
|
265
|
+
"lastmodifieddate": "2026-01-01T00:00:00.000Z"
|
|
266
|
+
},
|
|
267
|
+
"createdAt": "2026-01-01T00:00:00.000Z",
|
|
268
|
+
"updatedAt": "2026-01-01T00:00:00.000Z",
|
|
269
|
+
"archived": false
|
|
270
|
+
}
|
|
271
|
+
],
|
|
272
|
+
"paging": {
|
|
273
|
+
"next": {
|
|
274
|
+
"after": "10",
|
|
275
|
+
"link": "?after=10"
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
function fakeDealSearch({ config, fake }) {
|
|
281
|
+
const boundRecordId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
|
|
282
|
+
return {
|
|
283
|
+
"total": 1,
|
|
284
|
+
"results": [
|
|
285
|
+
{
|
|
286
|
+
"id": boundRecordId,
|
|
287
|
+
"properties": {
|
|
288
|
+
"dealname": "Acme renewal",
|
|
289
|
+
"amount": "12000",
|
|
290
|
+
"dealstage": "appointmentscheduled",
|
|
291
|
+
"pipeline": "default",
|
|
292
|
+
"hs_object_id": boundRecordId,
|
|
293
|
+
"createdate": "2026-01-01T00:00:00.000Z",
|
|
294
|
+
"lastmodifieddate": "2026-01-01T00:00:00.000Z"
|
|
295
|
+
},
|
|
296
|
+
"createdAt": "2026-01-01T00:00:00.000Z",
|
|
297
|
+
"updatedAt": "2026-01-01T00:00:00.000Z",
|
|
298
|
+
"archived": false
|
|
299
|
+
}
|
|
300
|
+
],
|
|
301
|
+
"paging": {
|
|
302
|
+
"next": {
|
|
303
|
+
"after": "10",
|
|
304
|
+
"link": "?after=10"
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
function fakeDealUpdate({ config, fake }) {
|
|
310
|
+
const boundRecordId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
|
|
311
|
+
return {
|
|
312
|
+
"id": boundRecordId,
|
|
313
|
+
"properties": {
|
|
314
|
+
"dealname": "Acme renewal",
|
|
315
|
+
"amount": "12000",
|
|
316
|
+
"dealstage": "appointmentscheduled",
|
|
317
|
+
"pipeline": "default",
|
|
318
|
+
"hs_object_id": boundRecordId,
|
|
319
|
+
"createdate": "2026-01-01T00:00:00.000Z",
|
|
320
|
+
"lastmodifieddate": "2026-01-01T00:00:00.000Z"
|
|
321
|
+
},
|
|
322
|
+
"createdAt": "2026-01-01T00:00:00.000Z",
|
|
323
|
+
"updatedAt": "2026-01-01T00:00:00.000Z",
|
|
324
|
+
"archived": false
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
function fakeOwnerList({ config, fake }) {
|
|
328
|
+
const boundOwnerId = Array.from({ length: 8 }, () => fake.int(0, 9)).join("");
|
|
329
|
+
return {
|
|
330
|
+
"results": [
|
|
331
|
+
{
|
|
332
|
+
"id": boundOwnerId,
|
|
333
|
+
"email": "rosa@example.test",
|
|
334
|
+
"firstName": "Rosa",
|
|
335
|
+
"lastName": "Diaz",
|
|
336
|
+
"userId": 4242,
|
|
337
|
+
"archived": false
|
|
338
|
+
}
|
|
339
|
+
],
|
|
340
|
+
"paging": {
|
|
341
|
+
"next": {
|
|
342
|
+
"after": "10",
|
|
343
|
+
"link": "?after=10"
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
function fakePipelineList({ config, fake }) {
|
|
349
|
+
return {
|
|
350
|
+
"results": [
|
|
351
|
+
{
|
|
352
|
+
"id": "default",
|
|
353
|
+
"label": "Sales pipeline",
|
|
354
|
+
"displayOrder": 0,
|
|
355
|
+
"archived": false,
|
|
356
|
+
"stages": [
|
|
357
|
+
{
|
|
358
|
+
"id": "appointmentscheduled",
|
|
359
|
+
"label": "Appointment scheduled",
|
|
360
|
+
"displayOrder": 0,
|
|
361
|
+
"metadata": {
|
|
362
|
+
"probability": "0.2"
|
|
363
|
+
}
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
"id": "closedwon",
|
|
367
|
+
"label": "Closed won",
|
|
368
|
+
"displayOrder": 1,
|
|
369
|
+
"metadata": {
|
|
370
|
+
"probability": "1.0"
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
]
|
|
374
|
+
}
|
|
375
|
+
]
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
function fakePropertyList({ config, fake }) {
|
|
379
|
+
return {
|
|
380
|
+
"results": [
|
|
381
|
+
{
|
|
382
|
+
"name": "dealstage",
|
|
383
|
+
"label": "Deal Stage",
|
|
384
|
+
"type": "enumeration",
|
|
385
|
+
"fieldType": "select",
|
|
386
|
+
"groupName": "dealinformation",
|
|
387
|
+
"options": [
|
|
388
|
+
{
|
|
389
|
+
"label": "Appointment scheduled",
|
|
390
|
+
"value": "appointmentscheduled"
|
|
391
|
+
}
|
|
392
|
+
]
|
|
393
|
+
}
|
|
394
|
+
]
|
|
395
|
+
};
|
|
396
|
+
}
|
|
26
397
|
var hubspotFaker = (operation, request) => {
|
|
27
398
|
switch (operation) {
|
|
399
|
+
case "company_create":
|
|
400
|
+
return fakeCompanyCreate(request);
|
|
401
|
+
case "company_get":
|
|
402
|
+
return fakeCompanyGet(request);
|
|
403
|
+
case "company_list":
|
|
404
|
+
return fakeCompanyList(request);
|
|
405
|
+
case "company_search":
|
|
406
|
+
return fakeCompanySearch(request);
|
|
407
|
+
case "company_update":
|
|
408
|
+
return fakeCompanyUpdate(request);
|
|
28
409
|
case "contact_create":
|
|
29
410
|
return fakeContactCreate(request);
|
|
411
|
+
case "contact_get":
|
|
412
|
+
return fakeContactGet(request);
|
|
413
|
+
case "contact_list":
|
|
414
|
+
return fakeContactList(request);
|
|
415
|
+
case "contact_search":
|
|
416
|
+
return fakeContactSearch(request);
|
|
417
|
+
case "contact_update":
|
|
418
|
+
return fakeContactUpdate(request);
|
|
419
|
+
case "deal_create":
|
|
420
|
+
return fakeDealCreate(request);
|
|
421
|
+
case "deal_get":
|
|
422
|
+
return fakeDealGet(request);
|
|
423
|
+
case "deal_list":
|
|
424
|
+
return fakeDealList(request);
|
|
425
|
+
case "deal_search":
|
|
426
|
+
return fakeDealSearch(request);
|
|
427
|
+
case "deal_update":
|
|
428
|
+
return fakeDealUpdate(request);
|
|
429
|
+
case "owner_list":
|
|
430
|
+
return fakeOwnerList(request);
|
|
431
|
+
case "pipeline_list":
|
|
432
|
+
return fakePipelineList(request);
|
|
433
|
+
case "property_list":
|
|
434
|
+
return fakePropertyList(request);
|
|
30
435
|
default:
|
|
31
436
|
throw new Error(
|
|
32
437
|
`hubspot: no fake response is defined for "${operation}". Add a fixture under provider/fixtures/ and regenerate \u2014 a connector without a faker cannot be developed against, tested, or demonstrated.`
|
|
@@ -55,6 +460,185 @@ var HUBSPOT = {
|
|
|
55
460
|
authorize: hubspotAuthorize,
|
|
56
461
|
faker: hubspotFaker
|
|
57
462
|
};
|
|
463
|
+
var COMPANY_CREATE_OPERATION = "company_create";
|
|
464
|
+
async function hubspotCompanyCreate(options) {
|
|
465
|
+
const config = options.config ?? {};
|
|
466
|
+
if (config.properties === void 0 || config.properties === null || config.properties === "") {
|
|
467
|
+
throw new Error(`company_create: "properties" is required (Properties).`);
|
|
468
|
+
}
|
|
469
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
470
|
+
operation: COMPANY_CREATE_OPERATION,
|
|
471
|
+
config,
|
|
472
|
+
input: options.input,
|
|
473
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
474
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
475
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
476
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
477
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
478
|
+
request: {
|
|
479
|
+
method: "POST",
|
|
480
|
+
path: "/crm/v3/objects/companies",
|
|
481
|
+
json: {
|
|
482
|
+
"properties": propertiesMap(config.properties),
|
|
483
|
+
"associations": []
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
function propertiesMap(value) {
|
|
489
|
+
if (!value || typeof value !== "object") return {};
|
|
490
|
+
const out = {};
|
|
491
|
+
for (const [key, item] of Object.entries(value)) {
|
|
492
|
+
if (item !== void 0 && item !== null && item !== "") out[key] = String(item);
|
|
493
|
+
}
|
|
494
|
+
return out;
|
|
495
|
+
}
|
|
496
|
+
var COMPANY_GET_OPERATION = "company_get";
|
|
497
|
+
async function hubspotCompanyGet(options) {
|
|
498
|
+
const config = options.config ?? {};
|
|
499
|
+
if (config.companyId === void 0 || config.companyId === null || config.companyId === "") {
|
|
500
|
+
throw new Error(`company_get: "companyId" is required (Company id).`);
|
|
501
|
+
}
|
|
502
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
503
|
+
operation: COMPANY_GET_OPERATION,
|
|
504
|
+
config,
|
|
505
|
+
input: options.input,
|
|
506
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
507
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
508
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
509
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
510
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
511
|
+
request: {
|
|
512
|
+
method: "GET",
|
|
513
|
+
path: `/crm/v3/objects/companies/${encodeURIComponent(String(config.companyId))}`,
|
|
514
|
+
query: {
|
|
515
|
+
...config.properties !== void 0 && config.properties !== null && config.properties !== "" ? { "properties": String(config.properties) } : {},
|
|
516
|
+
...config.associations !== void 0 && config.associations !== null && config.associations !== "" ? { "associations": String(config.associations) } : {}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
var COMPANY_LIST_OPERATION = "company_list";
|
|
522
|
+
async function hubspotCompanyList(options) {
|
|
523
|
+
const config = options.config ?? {};
|
|
524
|
+
{
|
|
525
|
+
const n = Number(config.limit);
|
|
526
|
+
const given = config.limit !== void 0 && config.limit !== null && config.limit !== "";
|
|
527
|
+
if (given && !(Number.isInteger(n) && n >= 1 && n <= 100)) {
|
|
528
|
+
throw new Error(
|
|
529
|
+
`company_list: "limit" must be a integer, got ${JSON.stringify(config.limit)}.`
|
|
530
|
+
);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
534
|
+
operation: COMPANY_LIST_OPERATION,
|
|
535
|
+
config,
|
|
536
|
+
input: options.input,
|
|
537
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
538
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
539
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
540
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
541
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
542
|
+
request: {
|
|
543
|
+
method: "GET",
|
|
544
|
+
path: "/crm/v3/objects/companies",
|
|
545
|
+
query: {
|
|
546
|
+
...config.limit !== void 0 && config.limit !== null && config.limit !== "" ? { "limit": Math.trunc(Number(config.limit)) } : {},
|
|
547
|
+
...config.after !== void 0 && config.after !== null && config.after !== "" ? { "after": String(config.after) } : {},
|
|
548
|
+
...config.properties !== void 0 && config.properties !== null && config.properties !== "" ? { "properties": String(config.properties) } : {},
|
|
549
|
+
...config.associations !== void 0 && config.associations !== null && config.associations !== "" ? { "associations": String(config.associations) } : {}
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
var COMPANY_SEARCH_OPERATION = "company_search";
|
|
555
|
+
async function hubspotCompanySearch(options) {
|
|
556
|
+
const config = options.config ?? {};
|
|
557
|
+
if (typeof config.filterGroups === "string" && config.filterGroups !== "") {
|
|
558
|
+
try {
|
|
559
|
+
JSON.parse(config.filterGroups);
|
|
560
|
+
} catch (error) {
|
|
561
|
+
throw new Error(`company_search: "filterGroups" must be JSON: ${error.message}`);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
if (typeof config.sorts === "string" && config.sorts !== "") {
|
|
565
|
+
try {
|
|
566
|
+
JSON.parse(config.sorts);
|
|
567
|
+
} catch (error) {
|
|
568
|
+
throw new Error(`company_search: "sorts" must be JSON: ${error.message}`);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
{
|
|
572
|
+
const n = Number(config.limit);
|
|
573
|
+
const given = config.limit !== void 0 && config.limit !== null && config.limit !== "";
|
|
574
|
+
if (given && !(Number.isInteger(n) && n >= 1 && n <= 200)) {
|
|
575
|
+
throw new Error(
|
|
576
|
+
`company_search: "limit" must be a integer, got ${JSON.stringify(config.limit)}.`
|
|
577
|
+
);
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
581
|
+
operation: COMPANY_SEARCH_OPERATION,
|
|
582
|
+
config,
|
|
583
|
+
input: options.input,
|
|
584
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
585
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
586
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
587
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
588
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
589
|
+
request: {
|
|
590
|
+
method: "POST",
|
|
591
|
+
path: "/crm/v3/objects/companies/search",
|
|
592
|
+
json: {
|
|
593
|
+
...config.filterGroups !== void 0 && config.filterGroups !== null && config.filterGroups !== "" ? { "filterGroups": typeof config.filterGroups === "string" ? JSON.parse(config.filterGroups) : config.filterGroups } : {},
|
|
594
|
+
...config.sorts !== void 0 && config.sorts !== null && config.sorts !== "" ? { "sorts": typeof config.sorts === "string" ? JSON.parse(config.sorts) : config.sorts } : {},
|
|
595
|
+
...config.query !== void 0 && config.query !== null && config.query !== "" ? { "query": String(config.query) } : {},
|
|
596
|
+
...config.properties !== void 0 && config.properties !== null && config.properties !== "" ? { "properties": propertiesList(config.properties) } : {},
|
|
597
|
+
...config.limit !== void 0 && config.limit !== null && config.limit !== "" ? { "limit": Math.trunc(Number(config.limit)) } : {},
|
|
598
|
+
...config.after !== void 0 && config.after !== null && config.after !== "" ? { "after": String(config.after) } : {}
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
function propertiesList(value) {
|
|
604
|
+
const items = Array.isArray(value) ? value.map(String) : typeof value === "string" ? value.split(",") : [];
|
|
605
|
+
return items.map((item) => item.trim()).filter(Boolean);
|
|
606
|
+
}
|
|
607
|
+
var COMPANY_UPDATE_OPERATION = "company_update";
|
|
608
|
+
async function hubspotCompanyUpdate(options) {
|
|
609
|
+
const config = options.config ?? {};
|
|
610
|
+
if (config.companyId === void 0 || config.companyId === null || config.companyId === "") {
|
|
611
|
+
throw new Error(`company_update: "companyId" is required (Company id).`);
|
|
612
|
+
}
|
|
613
|
+
if (config.properties === void 0 || config.properties === null || config.properties === "") {
|
|
614
|
+
throw new Error(`company_update: "properties" is required (Properties).`);
|
|
615
|
+
}
|
|
616
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
617
|
+
operation: COMPANY_UPDATE_OPERATION,
|
|
618
|
+
config,
|
|
619
|
+
input: options.input,
|
|
620
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
621
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
622
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
623
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
624
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
625
|
+
request: {
|
|
626
|
+
method: "PATCH",
|
|
627
|
+
path: `/crm/v3/objects/companies/${encodeURIComponent(String(config.companyId))}`,
|
|
628
|
+
json: {
|
|
629
|
+
"properties": propertiesMap2(config.properties)
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
function propertiesMap2(value) {
|
|
635
|
+
if (!value || typeof value !== "object") return {};
|
|
636
|
+
const out = {};
|
|
637
|
+
for (const [key, item] of Object.entries(value)) {
|
|
638
|
+
if (item !== void 0 && item !== null && item !== "") out[key] = String(item);
|
|
639
|
+
}
|
|
640
|
+
return out;
|
|
641
|
+
}
|
|
58
642
|
var CONTACT_CREATE_OPERATION = "contact_create";
|
|
59
643
|
async function hubspotContactCreate(options) {
|
|
60
644
|
const config = options.config ?? {};
|
|
@@ -100,14 +684,446 @@ function nestFields(flat) {
|
|
|
100
684
|
}
|
|
101
685
|
return out;
|
|
102
686
|
}
|
|
687
|
+
var CONTACT_GET_OPERATION = "contact_get";
|
|
688
|
+
async function hubspotContactGet(options) {
|
|
689
|
+
const config = options.config ?? {};
|
|
690
|
+
if (config.contactId === void 0 || config.contactId === null || config.contactId === "") {
|
|
691
|
+
throw new Error(`contact_get: "contactId" is required (Contact id).`);
|
|
692
|
+
}
|
|
693
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
694
|
+
operation: CONTACT_GET_OPERATION,
|
|
695
|
+
config,
|
|
696
|
+
input: options.input,
|
|
697
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
698
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
699
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
700
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
701
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
702
|
+
request: {
|
|
703
|
+
method: "GET",
|
|
704
|
+
path: `/crm/v3/objects/contacts/${encodeURIComponent(String(config.contactId))}`,
|
|
705
|
+
query: {
|
|
706
|
+
...config.properties !== void 0 && config.properties !== null && config.properties !== "" ? { "properties": String(config.properties) } : {},
|
|
707
|
+
...config.associations !== void 0 && config.associations !== null && config.associations !== "" ? { "associations": String(config.associations) } : {}
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
});
|
|
711
|
+
}
|
|
712
|
+
var CONTACT_LIST_OPERATION = "contact_list";
|
|
713
|
+
async function hubspotContactList(options) {
|
|
714
|
+
const config = options.config ?? {};
|
|
715
|
+
{
|
|
716
|
+
const n = Number(config.limit);
|
|
717
|
+
const given = config.limit !== void 0 && config.limit !== null && config.limit !== "";
|
|
718
|
+
if (given && !(Number.isInteger(n) && n >= 1 && n <= 100)) {
|
|
719
|
+
throw new Error(
|
|
720
|
+
`contact_list: "limit" must be a integer, got ${JSON.stringify(config.limit)}.`
|
|
721
|
+
);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
725
|
+
operation: CONTACT_LIST_OPERATION,
|
|
726
|
+
config,
|
|
727
|
+
input: options.input,
|
|
728
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
729
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
730
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
731
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
732
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
733
|
+
request: {
|
|
734
|
+
method: "GET",
|
|
735
|
+
path: "/crm/v3/objects/contacts",
|
|
736
|
+
query: {
|
|
737
|
+
...config.limit !== void 0 && config.limit !== null && config.limit !== "" ? { "limit": Math.trunc(Number(config.limit)) } : {},
|
|
738
|
+
...config.after !== void 0 && config.after !== null && config.after !== "" ? { "after": String(config.after) } : {},
|
|
739
|
+
...config.properties !== void 0 && config.properties !== null && config.properties !== "" ? { "properties": String(config.properties) } : {},
|
|
740
|
+
...config.associations !== void 0 && config.associations !== null && config.associations !== "" ? { "associations": String(config.associations) } : {}
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
var CONTACT_SEARCH_OPERATION = "contact_search";
|
|
746
|
+
async function hubspotContactSearch(options) {
|
|
747
|
+
const config = options.config ?? {};
|
|
748
|
+
if (typeof config.filterGroups === "string" && config.filterGroups !== "") {
|
|
749
|
+
try {
|
|
750
|
+
JSON.parse(config.filterGroups);
|
|
751
|
+
} catch (error) {
|
|
752
|
+
throw new Error(`contact_search: "filterGroups" must be JSON: ${error.message}`);
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
if (typeof config.sorts === "string" && config.sorts !== "") {
|
|
756
|
+
try {
|
|
757
|
+
JSON.parse(config.sorts);
|
|
758
|
+
} catch (error) {
|
|
759
|
+
throw new Error(`contact_search: "sorts" must be JSON: ${error.message}`);
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
{
|
|
763
|
+
const n = Number(config.limit);
|
|
764
|
+
const given = config.limit !== void 0 && config.limit !== null && config.limit !== "";
|
|
765
|
+
if (given && !(Number.isInteger(n) && n >= 1 && n <= 200)) {
|
|
766
|
+
throw new Error(
|
|
767
|
+
`contact_search: "limit" must be a integer, got ${JSON.stringify(config.limit)}.`
|
|
768
|
+
);
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
772
|
+
operation: CONTACT_SEARCH_OPERATION,
|
|
773
|
+
config,
|
|
774
|
+
input: options.input,
|
|
775
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
776
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
777
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
778
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
779
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
780
|
+
request: {
|
|
781
|
+
method: "POST",
|
|
782
|
+
path: "/crm/v3/objects/contacts/search",
|
|
783
|
+
json: {
|
|
784
|
+
...config.filterGroups !== void 0 && config.filterGroups !== null && config.filterGroups !== "" ? { "filterGroups": typeof config.filterGroups === "string" ? JSON.parse(config.filterGroups) : config.filterGroups } : {},
|
|
785
|
+
...config.sorts !== void 0 && config.sorts !== null && config.sorts !== "" ? { "sorts": typeof config.sorts === "string" ? JSON.parse(config.sorts) : config.sorts } : {},
|
|
786
|
+
...config.query !== void 0 && config.query !== null && config.query !== "" ? { "query": String(config.query) } : {},
|
|
787
|
+
...config.properties !== void 0 && config.properties !== null && config.properties !== "" ? { "properties": propertiesList2(config.properties) } : {},
|
|
788
|
+
...config.limit !== void 0 && config.limit !== null && config.limit !== "" ? { "limit": Math.trunc(Number(config.limit)) } : {},
|
|
789
|
+
...config.after !== void 0 && config.after !== null && config.after !== "" ? { "after": String(config.after) } : {}
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
function propertiesList2(value) {
|
|
795
|
+
const items = Array.isArray(value) ? value.map(String) : typeof value === "string" ? value.split(",") : [];
|
|
796
|
+
return items.map((item) => item.trim()).filter(Boolean);
|
|
797
|
+
}
|
|
798
|
+
var CONTACT_UPDATE_OPERATION = "contact_update";
|
|
799
|
+
async function hubspotContactUpdate(options) {
|
|
800
|
+
const config = options.config ?? {};
|
|
801
|
+
if (config.contactId === void 0 || config.contactId === null || config.contactId === "") {
|
|
802
|
+
throw new Error(`contact_update: "contactId" is required (Contact id).`);
|
|
803
|
+
}
|
|
804
|
+
if (config.properties === void 0 || config.properties === null || config.properties === "") {
|
|
805
|
+
throw new Error(`contact_update: "properties" is required (Properties).`);
|
|
806
|
+
}
|
|
807
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
808
|
+
operation: CONTACT_UPDATE_OPERATION,
|
|
809
|
+
config,
|
|
810
|
+
input: options.input,
|
|
811
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
812
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
813
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
814
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
815
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
816
|
+
request: {
|
|
817
|
+
method: "PATCH",
|
|
818
|
+
path: `/crm/v3/objects/contacts/${encodeURIComponent(String(config.contactId))}`,
|
|
819
|
+
json: {
|
|
820
|
+
"properties": propertiesMap3(config.properties)
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
function propertiesMap3(value) {
|
|
826
|
+
if (!value || typeof value !== "object") return {};
|
|
827
|
+
const out = {};
|
|
828
|
+
for (const [key, item] of Object.entries(value)) {
|
|
829
|
+
if (item !== void 0 && item !== null && item !== "") out[key] = String(item);
|
|
830
|
+
}
|
|
831
|
+
return out;
|
|
832
|
+
}
|
|
833
|
+
var DEAL_CREATE_OPERATION = "deal_create";
|
|
834
|
+
async function hubspotDealCreate(options) {
|
|
835
|
+
const config = options.config ?? {};
|
|
836
|
+
if (config.properties === void 0 || config.properties === null || config.properties === "") {
|
|
837
|
+
throw new Error(`deal_create: "properties" is required (Properties).`);
|
|
838
|
+
}
|
|
839
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
840
|
+
operation: DEAL_CREATE_OPERATION,
|
|
841
|
+
config,
|
|
842
|
+
input: options.input,
|
|
843
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
844
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
845
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
846
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
847
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
848
|
+
request: {
|
|
849
|
+
method: "POST",
|
|
850
|
+
path: "/crm/v3/objects/deals",
|
|
851
|
+
json: {
|
|
852
|
+
"properties": propertiesMap4(config.properties),
|
|
853
|
+
"associations": []
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
function propertiesMap4(value) {
|
|
859
|
+
if (!value || typeof value !== "object") return {};
|
|
860
|
+
const out = {};
|
|
861
|
+
for (const [key, item] of Object.entries(value)) {
|
|
862
|
+
if (item !== void 0 && item !== null && item !== "") out[key] = String(item);
|
|
863
|
+
}
|
|
864
|
+
return out;
|
|
865
|
+
}
|
|
866
|
+
var DEAL_GET_OPERATION = "deal_get";
|
|
867
|
+
async function hubspotDealGet(options) {
|
|
868
|
+
const config = options.config ?? {};
|
|
869
|
+
if (config.dealId === void 0 || config.dealId === null || config.dealId === "") {
|
|
870
|
+
throw new Error(`deal_get: "dealId" is required (Deal id).`);
|
|
871
|
+
}
|
|
872
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
873
|
+
operation: DEAL_GET_OPERATION,
|
|
874
|
+
config,
|
|
875
|
+
input: options.input,
|
|
876
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
877
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
878
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
879
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
880
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
881
|
+
request: {
|
|
882
|
+
method: "GET",
|
|
883
|
+
path: `/crm/v3/objects/deals/${encodeURIComponent(String(config.dealId))}`,
|
|
884
|
+
query: {
|
|
885
|
+
...config.properties !== void 0 && config.properties !== null && config.properties !== "" ? { "properties": String(config.properties) } : {},
|
|
886
|
+
...config.associations !== void 0 && config.associations !== null && config.associations !== "" ? { "associations": String(config.associations) } : {}
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
});
|
|
890
|
+
}
|
|
891
|
+
var DEAL_LIST_OPERATION = "deal_list";
|
|
892
|
+
async function hubspotDealList(options) {
|
|
893
|
+
const config = options.config ?? {};
|
|
894
|
+
{
|
|
895
|
+
const n = Number(config.limit);
|
|
896
|
+
const given = config.limit !== void 0 && config.limit !== null && config.limit !== "";
|
|
897
|
+
if (given && !(Number.isInteger(n) && n >= 1 && n <= 100)) {
|
|
898
|
+
throw new Error(
|
|
899
|
+
`deal_list: "limit" must be a integer, got ${JSON.stringify(config.limit)}.`
|
|
900
|
+
);
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
904
|
+
operation: DEAL_LIST_OPERATION,
|
|
905
|
+
config,
|
|
906
|
+
input: options.input,
|
|
907
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
908
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
909
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
910
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
911
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
912
|
+
request: {
|
|
913
|
+
method: "GET",
|
|
914
|
+
path: "/crm/v3/objects/deals",
|
|
915
|
+
query: {
|
|
916
|
+
...config.limit !== void 0 && config.limit !== null && config.limit !== "" ? { "limit": Math.trunc(Number(config.limit)) } : {},
|
|
917
|
+
...config.after !== void 0 && config.after !== null && config.after !== "" ? { "after": String(config.after) } : {},
|
|
918
|
+
...config.properties !== void 0 && config.properties !== null && config.properties !== "" ? { "properties": String(config.properties) } : {},
|
|
919
|
+
...config.associations !== void 0 && config.associations !== null && config.associations !== "" ? { "associations": String(config.associations) } : {}
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
var DEAL_SEARCH_OPERATION = "deal_search";
|
|
925
|
+
async function hubspotDealSearch(options) {
|
|
926
|
+
const config = options.config ?? {};
|
|
927
|
+
if (typeof config.filterGroups === "string" && config.filterGroups !== "") {
|
|
928
|
+
try {
|
|
929
|
+
JSON.parse(config.filterGroups);
|
|
930
|
+
} catch (error) {
|
|
931
|
+
throw new Error(`deal_search: "filterGroups" must be JSON: ${error.message}`);
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
if (typeof config.sorts === "string" && config.sorts !== "") {
|
|
935
|
+
try {
|
|
936
|
+
JSON.parse(config.sorts);
|
|
937
|
+
} catch (error) {
|
|
938
|
+
throw new Error(`deal_search: "sorts" must be JSON: ${error.message}`);
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
{
|
|
942
|
+
const n = Number(config.limit);
|
|
943
|
+
const given = config.limit !== void 0 && config.limit !== null && config.limit !== "";
|
|
944
|
+
if (given && !(Number.isInteger(n) && n >= 1 && n <= 200)) {
|
|
945
|
+
throw new Error(
|
|
946
|
+
`deal_search: "limit" must be a integer, got ${JSON.stringify(config.limit)}.`
|
|
947
|
+
);
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
951
|
+
operation: DEAL_SEARCH_OPERATION,
|
|
952
|
+
config,
|
|
953
|
+
input: options.input,
|
|
954
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
955
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
956
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
957
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
958
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
959
|
+
request: {
|
|
960
|
+
method: "POST",
|
|
961
|
+
path: "/crm/v3/objects/deals/search",
|
|
962
|
+
json: {
|
|
963
|
+
...config.filterGroups !== void 0 && config.filterGroups !== null && config.filterGroups !== "" ? { "filterGroups": typeof config.filterGroups === "string" ? JSON.parse(config.filterGroups) : config.filterGroups } : {},
|
|
964
|
+
...config.sorts !== void 0 && config.sorts !== null && config.sorts !== "" ? { "sorts": typeof config.sorts === "string" ? JSON.parse(config.sorts) : config.sorts } : {},
|
|
965
|
+
...config.query !== void 0 && config.query !== null && config.query !== "" ? { "query": String(config.query) } : {},
|
|
966
|
+
...config.properties !== void 0 && config.properties !== null && config.properties !== "" ? { "properties": propertiesList3(config.properties) } : {},
|
|
967
|
+
...config.limit !== void 0 && config.limit !== null && config.limit !== "" ? { "limit": Math.trunc(Number(config.limit)) } : {},
|
|
968
|
+
...config.after !== void 0 && config.after !== null && config.after !== "" ? { "after": String(config.after) } : {}
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
});
|
|
972
|
+
}
|
|
973
|
+
function propertiesList3(value) {
|
|
974
|
+
const items = Array.isArray(value) ? value.map(String) : typeof value === "string" ? value.split(",") : [];
|
|
975
|
+
return items.map((item) => item.trim()).filter(Boolean);
|
|
976
|
+
}
|
|
977
|
+
var DEAL_UPDATE_OPERATION = "deal_update";
|
|
978
|
+
async function hubspotDealUpdate(options) {
|
|
979
|
+
const config = options.config ?? {};
|
|
980
|
+
if (config.dealId === void 0 || config.dealId === null || config.dealId === "") {
|
|
981
|
+
throw new Error(`deal_update: "dealId" is required (Deal id).`);
|
|
982
|
+
}
|
|
983
|
+
if (config.properties === void 0 || config.properties === null || config.properties === "") {
|
|
984
|
+
throw new Error(`deal_update: "properties" is required (Properties).`);
|
|
985
|
+
}
|
|
986
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
987
|
+
operation: DEAL_UPDATE_OPERATION,
|
|
988
|
+
config,
|
|
989
|
+
input: options.input,
|
|
990
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
991
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
992
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
993
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
994
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
995
|
+
request: {
|
|
996
|
+
method: "PATCH",
|
|
997
|
+
path: `/crm/v3/objects/deals/${encodeURIComponent(String(config.dealId))}`,
|
|
998
|
+
json: {
|
|
999
|
+
"properties": propertiesMap5(config.properties)
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
});
|
|
1003
|
+
}
|
|
1004
|
+
function propertiesMap5(value) {
|
|
1005
|
+
if (!value || typeof value !== "object") return {};
|
|
1006
|
+
const out = {};
|
|
1007
|
+
for (const [key, item] of Object.entries(value)) {
|
|
1008
|
+
if (item !== void 0 && item !== null && item !== "") out[key] = String(item);
|
|
1009
|
+
}
|
|
1010
|
+
return out;
|
|
1011
|
+
}
|
|
1012
|
+
var OWNER_LIST_OPERATION = "owner_list";
|
|
1013
|
+
async function hubspotOwnerList(options) {
|
|
1014
|
+
const config = options.config ?? {};
|
|
1015
|
+
{
|
|
1016
|
+
const n = Number(config.limit);
|
|
1017
|
+
const given = config.limit !== void 0 && config.limit !== null && config.limit !== "";
|
|
1018
|
+
if (given && !(Number.isInteger(n) && n >= 1 && n <= 100)) {
|
|
1019
|
+
throw new Error(
|
|
1020
|
+
`owner_list: "limit" must be a integer, got ${JSON.stringify(config.limit)}.`
|
|
1021
|
+
);
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
1025
|
+
operation: OWNER_LIST_OPERATION,
|
|
1026
|
+
config,
|
|
1027
|
+
input: options.input,
|
|
1028
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
1029
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
1030
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
1031
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
1032
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
1033
|
+
request: {
|
|
1034
|
+
method: "GET",
|
|
1035
|
+
path: "/crm/v3/owners",
|
|
1036
|
+
query: {
|
|
1037
|
+
...config.email !== void 0 && config.email !== null && config.email !== "" ? { "email": String(config.email) } : {},
|
|
1038
|
+
...config.limit !== void 0 && config.limit !== null && config.limit !== "" ? { "limit": Math.trunc(Number(config.limit)) } : {},
|
|
1039
|
+
...config.after !== void 0 && config.after !== null && config.after !== "" ? { "after": String(config.after) } : {}
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
});
|
|
1043
|
+
}
|
|
1044
|
+
var PIPELINE_LIST_OPERATION = "pipeline_list";
|
|
1045
|
+
async function hubspotPipelineList(options) {
|
|
1046
|
+
const config = options.config ?? {};
|
|
1047
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
1048
|
+
operation: PIPELINE_LIST_OPERATION,
|
|
1049
|
+
config,
|
|
1050
|
+
input: options.input,
|
|
1051
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
1052
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
1053
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
1054
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
1055
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
1056
|
+
request: {
|
|
1057
|
+
method: "GET",
|
|
1058
|
+
path: "/crm/v3/pipelines/deals",
|
|
1059
|
+
query: {}
|
|
1060
|
+
}
|
|
1061
|
+
});
|
|
1062
|
+
}
|
|
1063
|
+
var PROPERTY_LIST_OPERATION = "property_list";
|
|
1064
|
+
async function hubspotPropertyList(options) {
|
|
1065
|
+
const config = options.config ?? {};
|
|
1066
|
+
if (config.objectType === void 0 || config.objectType === null || config.objectType === "") {
|
|
1067
|
+
throw new Error(`property_list: "objectType" is required (Object).`);
|
|
1068
|
+
}
|
|
1069
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
1070
|
+
operation: PROPERTY_LIST_OPERATION,
|
|
1071
|
+
config,
|
|
1072
|
+
input: options.input,
|
|
1073
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
1074
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
1075
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
1076
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
1077
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
1078
|
+
request: {
|
|
1079
|
+
method: "GET",
|
|
1080
|
+
path: `/crm/v3/properties/${encodeURIComponent(String(config.objectType))}`,
|
|
1081
|
+
query: {}
|
|
1082
|
+
}
|
|
1083
|
+
});
|
|
1084
|
+
}
|
|
103
1085
|
|
|
1086
|
+
exports.COMPANY_CREATE_OPERATION = COMPANY_CREATE_OPERATION;
|
|
1087
|
+
exports.COMPANY_GET_OPERATION = COMPANY_GET_OPERATION;
|
|
1088
|
+
exports.COMPANY_LIST_OPERATION = COMPANY_LIST_OPERATION;
|
|
1089
|
+
exports.COMPANY_SEARCH_OPERATION = COMPANY_SEARCH_OPERATION;
|
|
1090
|
+
exports.COMPANY_UPDATE_OPERATION = COMPANY_UPDATE_OPERATION;
|
|
104
1091
|
exports.CONNECTOR_API_VERSION = CONNECTOR_API_VERSION;
|
|
105
1092
|
exports.CONTACT_CREATE_OPERATION = CONTACT_CREATE_OPERATION;
|
|
1093
|
+
exports.CONTACT_GET_OPERATION = CONTACT_GET_OPERATION;
|
|
1094
|
+
exports.CONTACT_LIST_OPERATION = CONTACT_LIST_OPERATION;
|
|
1095
|
+
exports.CONTACT_SEARCH_OPERATION = CONTACT_SEARCH_OPERATION;
|
|
1096
|
+
exports.CONTACT_UPDATE_OPERATION = CONTACT_UPDATE_OPERATION;
|
|
1097
|
+
exports.DEAL_CREATE_OPERATION = DEAL_CREATE_OPERATION;
|
|
1098
|
+
exports.DEAL_GET_OPERATION = DEAL_GET_OPERATION;
|
|
1099
|
+
exports.DEAL_LIST_OPERATION = DEAL_LIST_OPERATION;
|
|
1100
|
+
exports.DEAL_SEARCH_OPERATION = DEAL_SEARCH_OPERATION;
|
|
1101
|
+
exports.DEAL_UPDATE_OPERATION = DEAL_UPDATE_OPERATION;
|
|
106
1102
|
exports.HUBSPOT = HUBSPOT;
|
|
107
1103
|
exports.HUBSPOT_BASE_URLS = HUBSPOT_BASE_URLS;
|
|
108
1104
|
exports.HUBSPOT_REQUIRES = HUBSPOT_REQUIRES;
|
|
1105
|
+
exports.OWNER_LIST_OPERATION = OWNER_LIST_OPERATION;
|
|
1106
|
+
exports.PIPELINE_LIST_OPERATION = PIPELINE_LIST_OPERATION;
|
|
1107
|
+
exports.PROPERTY_LIST_OPERATION = PROPERTY_LIST_OPERATION;
|
|
109
1108
|
exports.hubspotAuthorize = hubspotAuthorize;
|
|
1109
|
+
exports.hubspotCompanyCreate = hubspotCompanyCreate;
|
|
1110
|
+
exports.hubspotCompanyGet = hubspotCompanyGet;
|
|
1111
|
+
exports.hubspotCompanyList = hubspotCompanyList;
|
|
1112
|
+
exports.hubspotCompanySearch = hubspotCompanySearch;
|
|
1113
|
+
exports.hubspotCompanyUpdate = hubspotCompanyUpdate;
|
|
110
1114
|
exports.hubspotContactCreate = hubspotContactCreate;
|
|
1115
|
+
exports.hubspotContactGet = hubspotContactGet;
|
|
1116
|
+
exports.hubspotContactList = hubspotContactList;
|
|
1117
|
+
exports.hubspotContactSearch = hubspotContactSearch;
|
|
1118
|
+
exports.hubspotContactUpdate = hubspotContactUpdate;
|
|
1119
|
+
exports.hubspotDealCreate = hubspotDealCreate;
|
|
1120
|
+
exports.hubspotDealGet = hubspotDealGet;
|
|
1121
|
+
exports.hubspotDealList = hubspotDealList;
|
|
1122
|
+
exports.hubspotDealSearch = hubspotDealSearch;
|
|
1123
|
+
exports.hubspotDealUpdate = hubspotDealUpdate;
|
|
111
1124
|
exports.hubspotFaker = hubspotFaker;
|
|
1125
|
+
exports.hubspotOwnerList = hubspotOwnerList;
|
|
1126
|
+
exports.hubspotPipelineList = hubspotPipelineList;
|
|
1127
|
+
exports.hubspotPropertyList = hubspotPropertyList;
|
|
112
1128
|
//# sourceMappingURL=index.cjs.map
|
|
113
1129
|
//# sourceMappingURL=index.cjs.map
|