@particle-academy/hubspot-js 0.3.4 → 0.5.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 +61 -0
- package/README.md +218 -1
- package/art/fancified.svg +26 -0
- package/dist/chunk-SZT3VK7Z.js +1146 -0
- package/dist/chunk-SZT3VK7Z.js.map +1 -0
- package/dist/flow.cjs +1340 -13
- package/dist/flow.cjs.map +1 -1
- package/dist/flow.d.cts +19 -1
- package/dist/flow.d.ts +19 -1
- package/dist/flow.js +275 -5
- package/dist/flow.js.map +1 -1
- package/dist/index.cjs +1081 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +637 -2
- package/dist/index.d.ts +637 -2
- 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,347 @@ 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
|
+
}
|
|
397
|
+
function fakeCrmEvent({ config, fake }) {
|
|
398
|
+
return [
|
|
399
|
+
{
|
|
400
|
+
"eventId": 531833541,
|
|
401
|
+
"subscriptionId": 3923621,
|
|
402
|
+
"portalId": 48807704,
|
|
403
|
+
"appId": 16111050,
|
|
404
|
+
"occurredAt": 1752613920733,
|
|
405
|
+
"subscriptionType": "contact.creation",
|
|
406
|
+
"attemptNumber": 0,
|
|
407
|
+
"objectId": 138017612137,
|
|
408
|
+
"changeFlag": "CREATED",
|
|
409
|
+
"changeSource": "CRM_UI",
|
|
410
|
+
"sourceId": "userId:76023669"
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
"eventId": 531833542,
|
|
414
|
+
"subscriptionId": 3923622,
|
|
415
|
+
"portalId": 48807704,
|
|
416
|
+
"appId": 16111050,
|
|
417
|
+
"occurredAt": 1752613921e3,
|
|
418
|
+
"subscriptionType": "deal.propertyChange",
|
|
419
|
+
"attemptNumber": 0,
|
|
420
|
+
"objectId": 9876543210,
|
|
421
|
+
"propertyName": "dealstage",
|
|
422
|
+
"propertyValue": "closedwon",
|
|
423
|
+
"changeSource": "CRM_UI",
|
|
424
|
+
"sourceId": "userId:76023669"
|
|
425
|
+
}
|
|
426
|
+
];
|
|
427
|
+
}
|
|
26
428
|
var hubspotFaker = (operation, request) => {
|
|
27
429
|
switch (operation) {
|
|
430
|
+
case "company_create":
|
|
431
|
+
return fakeCompanyCreate(request);
|
|
432
|
+
case "company_get":
|
|
433
|
+
return fakeCompanyGet(request);
|
|
434
|
+
case "company_list":
|
|
435
|
+
return fakeCompanyList(request);
|
|
436
|
+
case "company_search":
|
|
437
|
+
return fakeCompanySearch(request);
|
|
438
|
+
case "company_update":
|
|
439
|
+
return fakeCompanyUpdate(request);
|
|
28
440
|
case "contact_create":
|
|
29
441
|
return fakeContactCreate(request);
|
|
442
|
+
case "contact_get":
|
|
443
|
+
return fakeContactGet(request);
|
|
444
|
+
case "contact_list":
|
|
445
|
+
return fakeContactList(request);
|
|
446
|
+
case "contact_search":
|
|
447
|
+
return fakeContactSearch(request);
|
|
448
|
+
case "contact_update":
|
|
449
|
+
return fakeContactUpdate(request);
|
|
450
|
+
case "deal_create":
|
|
451
|
+
return fakeDealCreate(request);
|
|
452
|
+
case "deal_get":
|
|
453
|
+
return fakeDealGet(request);
|
|
454
|
+
case "deal_list":
|
|
455
|
+
return fakeDealList(request);
|
|
456
|
+
case "deal_search":
|
|
457
|
+
return fakeDealSearch(request);
|
|
458
|
+
case "deal_update":
|
|
459
|
+
return fakeDealUpdate(request);
|
|
460
|
+
case "owner_list":
|
|
461
|
+
return fakeOwnerList(request);
|
|
462
|
+
case "pipeline_list":
|
|
463
|
+
return fakePipelineList(request);
|
|
464
|
+
case "property_list":
|
|
465
|
+
return fakePropertyList(request);
|
|
466
|
+
case "crm_event":
|
|
467
|
+
return fakeCrmEvent(request);
|
|
30
468
|
default:
|
|
31
469
|
throw new Error(
|
|
32
470
|
`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 +493,185 @@ var HUBSPOT = {
|
|
|
55
493
|
authorize: hubspotAuthorize,
|
|
56
494
|
faker: hubspotFaker
|
|
57
495
|
};
|
|
496
|
+
var COMPANY_CREATE_OPERATION = "company_create";
|
|
497
|
+
async function hubspotCompanyCreate(options) {
|
|
498
|
+
const config = options.config ?? {};
|
|
499
|
+
if (config.properties === void 0 || config.properties === null || config.properties === "") {
|
|
500
|
+
throw new Error(`company_create: "properties" is required (Properties).`);
|
|
501
|
+
}
|
|
502
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
503
|
+
operation: COMPANY_CREATE_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: "POST",
|
|
513
|
+
path: "/crm/v3/objects/companies",
|
|
514
|
+
json: {
|
|
515
|
+
"properties": propertiesMap(config.properties),
|
|
516
|
+
"associations": []
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
function propertiesMap(value) {
|
|
522
|
+
if (!value || typeof value !== "object") return {};
|
|
523
|
+
const out = {};
|
|
524
|
+
for (const [key, item] of Object.entries(value)) {
|
|
525
|
+
if (item !== void 0 && item !== null && item !== "") out[key] = String(item);
|
|
526
|
+
}
|
|
527
|
+
return out;
|
|
528
|
+
}
|
|
529
|
+
var COMPANY_GET_OPERATION = "company_get";
|
|
530
|
+
async function hubspotCompanyGet(options) {
|
|
531
|
+
const config = options.config ?? {};
|
|
532
|
+
if (config.companyId === void 0 || config.companyId === null || config.companyId === "") {
|
|
533
|
+
throw new Error(`company_get: "companyId" is required (Company id).`);
|
|
534
|
+
}
|
|
535
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
536
|
+
operation: COMPANY_GET_OPERATION,
|
|
537
|
+
config,
|
|
538
|
+
input: options.input,
|
|
539
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
540
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
541
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
542
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
543
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
544
|
+
request: {
|
|
545
|
+
method: "GET",
|
|
546
|
+
path: `/crm/v3/objects/companies/${encodeURIComponent(String(config.companyId))}`,
|
|
547
|
+
query: {
|
|
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_LIST_OPERATION = "company_list";
|
|
555
|
+
async function hubspotCompanyList(options) {
|
|
556
|
+
const config = options.config ?? {};
|
|
557
|
+
{
|
|
558
|
+
const n = Number(config.limit);
|
|
559
|
+
const given = config.limit !== void 0 && config.limit !== null && config.limit !== "";
|
|
560
|
+
if (given && !(Number.isInteger(n) && n >= 1 && n <= 100)) {
|
|
561
|
+
throw new Error(
|
|
562
|
+
`company_list: "limit" must be a integer, got ${JSON.stringify(config.limit)}.`
|
|
563
|
+
);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
567
|
+
operation: COMPANY_LIST_OPERATION,
|
|
568
|
+
config,
|
|
569
|
+
input: options.input,
|
|
570
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
571
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
572
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
573
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
574
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
575
|
+
request: {
|
|
576
|
+
method: "GET",
|
|
577
|
+
path: "/crm/v3/objects/companies",
|
|
578
|
+
query: {
|
|
579
|
+
...config.limit !== void 0 && config.limit !== null && config.limit !== "" ? { "limit": Math.trunc(Number(config.limit)) } : {},
|
|
580
|
+
...config.after !== void 0 && config.after !== null && config.after !== "" ? { "after": String(config.after) } : {},
|
|
581
|
+
...config.properties !== void 0 && config.properties !== null && config.properties !== "" ? { "properties": String(config.properties) } : {},
|
|
582
|
+
...config.associations !== void 0 && config.associations !== null && config.associations !== "" ? { "associations": String(config.associations) } : {}
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
var COMPANY_SEARCH_OPERATION = "company_search";
|
|
588
|
+
async function hubspotCompanySearch(options) {
|
|
589
|
+
const config = options.config ?? {};
|
|
590
|
+
if (typeof config.filterGroups === "string" && config.filterGroups !== "") {
|
|
591
|
+
try {
|
|
592
|
+
JSON.parse(config.filterGroups);
|
|
593
|
+
} catch (error) {
|
|
594
|
+
throw new Error(`company_search: "filterGroups" must be JSON: ${error.message}`);
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
if (typeof config.sorts === "string" && config.sorts !== "") {
|
|
598
|
+
try {
|
|
599
|
+
JSON.parse(config.sorts);
|
|
600
|
+
} catch (error) {
|
|
601
|
+
throw new Error(`company_search: "sorts" must be JSON: ${error.message}`);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
{
|
|
605
|
+
const n = Number(config.limit);
|
|
606
|
+
const given = config.limit !== void 0 && config.limit !== null && config.limit !== "";
|
|
607
|
+
if (given && !(Number.isInteger(n) && n >= 1 && n <= 200)) {
|
|
608
|
+
throw new Error(
|
|
609
|
+
`company_search: "limit" must be a integer, got ${JSON.stringify(config.limit)}.`
|
|
610
|
+
);
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
614
|
+
operation: COMPANY_SEARCH_OPERATION,
|
|
615
|
+
config,
|
|
616
|
+
input: options.input,
|
|
617
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
618
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
619
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
620
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
621
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
622
|
+
request: {
|
|
623
|
+
method: "POST",
|
|
624
|
+
path: "/crm/v3/objects/companies/search",
|
|
625
|
+
json: {
|
|
626
|
+
...config.filterGroups !== void 0 && config.filterGroups !== null && config.filterGroups !== "" ? { "filterGroups": typeof config.filterGroups === "string" ? JSON.parse(config.filterGroups) : config.filterGroups } : {},
|
|
627
|
+
...config.sorts !== void 0 && config.sorts !== null && config.sorts !== "" ? { "sorts": typeof config.sorts === "string" ? JSON.parse(config.sorts) : config.sorts } : {},
|
|
628
|
+
...config.query !== void 0 && config.query !== null && config.query !== "" ? { "query": String(config.query) } : {},
|
|
629
|
+
...config.properties !== void 0 && config.properties !== null && config.properties !== "" ? { "properties": propertiesList(config.properties) } : {},
|
|
630
|
+
...config.limit !== void 0 && config.limit !== null && config.limit !== "" ? { "limit": Math.trunc(Number(config.limit)) } : {},
|
|
631
|
+
...config.after !== void 0 && config.after !== null && config.after !== "" ? { "after": String(config.after) } : {}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
function propertiesList(value) {
|
|
637
|
+
const items = Array.isArray(value) ? value.map(String) : typeof value === "string" ? value.split(",") : [];
|
|
638
|
+
return items.map((item) => item.trim()).filter(Boolean);
|
|
639
|
+
}
|
|
640
|
+
var COMPANY_UPDATE_OPERATION = "company_update";
|
|
641
|
+
async function hubspotCompanyUpdate(options) {
|
|
642
|
+
const config = options.config ?? {};
|
|
643
|
+
if (config.companyId === void 0 || config.companyId === null || config.companyId === "") {
|
|
644
|
+
throw new Error(`company_update: "companyId" is required (Company id).`);
|
|
645
|
+
}
|
|
646
|
+
if (config.properties === void 0 || config.properties === null || config.properties === "") {
|
|
647
|
+
throw new Error(`company_update: "properties" is required (Properties).`);
|
|
648
|
+
}
|
|
649
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
650
|
+
operation: COMPANY_UPDATE_OPERATION,
|
|
651
|
+
config,
|
|
652
|
+
input: options.input,
|
|
653
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
654
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
655
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
656
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
657
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
658
|
+
request: {
|
|
659
|
+
method: "PATCH",
|
|
660
|
+
path: `/crm/v3/objects/companies/${encodeURIComponent(String(config.companyId))}`,
|
|
661
|
+
json: {
|
|
662
|
+
"properties": propertiesMap2(config.properties)
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
function propertiesMap2(value) {
|
|
668
|
+
if (!value || typeof value !== "object") return {};
|
|
669
|
+
const out = {};
|
|
670
|
+
for (const [key, item] of Object.entries(value)) {
|
|
671
|
+
if (item !== void 0 && item !== null && item !== "") out[key] = String(item);
|
|
672
|
+
}
|
|
673
|
+
return out;
|
|
674
|
+
}
|
|
58
675
|
var CONTACT_CREATE_OPERATION = "contact_create";
|
|
59
676
|
async function hubspotContactCreate(options) {
|
|
60
677
|
const config = options.config ?? {};
|
|
@@ -100,14 +717,478 @@ function nestFields(flat) {
|
|
|
100
717
|
}
|
|
101
718
|
return out;
|
|
102
719
|
}
|
|
720
|
+
var CONTACT_GET_OPERATION = "contact_get";
|
|
721
|
+
async function hubspotContactGet(options) {
|
|
722
|
+
const config = options.config ?? {};
|
|
723
|
+
if (config.contactId === void 0 || config.contactId === null || config.contactId === "") {
|
|
724
|
+
throw new Error(`contact_get: "contactId" is required (Contact id).`);
|
|
725
|
+
}
|
|
726
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
727
|
+
operation: CONTACT_GET_OPERATION,
|
|
728
|
+
config,
|
|
729
|
+
input: options.input,
|
|
730
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
731
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
732
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
733
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
734
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
735
|
+
request: {
|
|
736
|
+
method: "GET",
|
|
737
|
+
path: `/crm/v3/objects/contacts/${encodeURIComponent(String(config.contactId))}`,
|
|
738
|
+
query: {
|
|
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_LIST_OPERATION = "contact_list";
|
|
746
|
+
async function hubspotContactList(options) {
|
|
747
|
+
const config = options.config ?? {};
|
|
748
|
+
{
|
|
749
|
+
const n = Number(config.limit);
|
|
750
|
+
const given = config.limit !== void 0 && config.limit !== null && config.limit !== "";
|
|
751
|
+
if (given && !(Number.isInteger(n) && n >= 1 && n <= 100)) {
|
|
752
|
+
throw new Error(
|
|
753
|
+
`contact_list: "limit" must be a integer, got ${JSON.stringify(config.limit)}.`
|
|
754
|
+
);
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
758
|
+
operation: CONTACT_LIST_OPERATION,
|
|
759
|
+
config,
|
|
760
|
+
input: options.input,
|
|
761
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
762
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
763
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
764
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
765
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
766
|
+
request: {
|
|
767
|
+
method: "GET",
|
|
768
|
+
path: "/crm/v3/objects/contacts",
|
|
769
|
+
query: {
|
|
770
|
+
...config.limit !== void 0 && config.limit !== null && config.limit !== "" ? { "limit": Math.trunc(Number(config.limit)) } : {},
|
|
771
|
+
...config.after !== void 0 && config.after !== null && config.after !== "" ? { "after": String(config.after) } : {},
|
|
772
|
+
...config.properties !== void 0 && config.properties !== null && config.properties !== "" ? { "properties": String(config.properties) } : {},
|
|
773
|
+
...config.associations !== void 0 && config.associations !== null && config.associations !== "" ? { "associations": String(config.associations) } : {}
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
var CONTACT_SEARCH_OPERATION = "contact_search";
|
|
779
|
+
async function hubspotContactSearch(options) {
|
|
780
|
+
const config = options.config ?? {};
|
|
781
|
+
if (typeof config.filterGroups === "string" && config.filterGroups !== "") {
|
|
782
|
+
try {
|
|
783
|
+
JSON.parse(config.filterGroups);
|
|
784
|
+
} catch (error) {
|
|
785
|
+
throw new Error(`contact_search: "filterGroups" must be JSON: ${error.message}`);
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
if (typeof config.sorts === "string" && config.sorts !== "") {
|
|
789
|
+
try {
|
|
790
|
+
JSON.parse(config.sorts);
|
|
791
|
+
} catch (error) {
|
|
792
|
+
throw new Error(`contact_search: "sorts" must be JSON: ${error.message}`);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
{
|
|
796
|
+
const n = Number(config.limit);
|
|
797
|
+
const given = config.limit !== void 0 && config.limit !== null && config.limit !== "";
|
|
798
|
+
if (given && !(Number.isInteger(n) && n >= 1 && n <= 200)) {
|
|
799
|
+
throw new Error(
|
|
800
|
+
`contact_search: "limit" must be a integer, got ${JSON.stringify(config.limit)}.`
|
|
801
|
+
);
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
805
|
+
operation: CONTACT_SEARCH_OPERATION,
|
|
806
|
+
config,
|
|
807
|
+
input: options.input,
|
|
808
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
809
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
810
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
811
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
812
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
813
|
+
request: {
|
|
814
|
+
method: "POST",
|
|
815
|
+
path: "/crm/v3/objects/contacts/search",
|
|
816
|
+
json: {
|
|
817
|
+
...config.filterGroups !== void 0 && config.filterGroups !== null && config.filterGroups !== "" ? { "filterGroups": typeof config.filterGroups === "string" ? JSON.parse(config.filterGroups) : config.filterGroups } : {},
|
|
818
|
+
...config.sorts !== void 0 && config.sorts !== null && config.sorts !== "" ? { "sorts": typeof config.sorts === "string" ? JSON.parse(config.sorts) : config.sorts } : {},
|
|
819
|
+
...config.query !== void 0 && config.query !== null && config.query !== "" ? { "query": String(config.query) } : {},
|
|
820
|
+
...config.properties !== void 0 && config.properties !== null && config.properties !== "" ? { "properties": propertiesList2(config.properties) } : {},
|
|
821
|
+
...config.limit !== void 0 && config.limit !== null && config.limit !== "" ? { "limit": Math.trunc(Number(config.limit)) } : {},
|
|
822
|
+
...config.after !== void 0 && config.after !== null && config.after !== "" ? { "after": String(config.after) } : {}
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
});
|
|
826
|
+
}
|
|
827
|
+
function propertiesList2(value) {
|
|
828
|
+
const items = Array.isArray(value) ? value.map(String) : typeof value === "string" ? value.split(",") : [];
|
|
829
|
+
return items.map((item) => item.trim()).filter(Boolean);
|
|
830
|
+
}
|
|
831
|
+
var CONTACT_UPDATE_OPERATION = "contact_update";
|
|
832
|
+
async function hubspotContactUpdate(options) {
|
|
833
|
+
const config = options.config ?? {};
|
|
834
|
+
if (config.contactId === void 0 || config.contactId === null || config.contactId === "") {
|
|
835
|
+
throw new Error(`contact_update: "contactId" is required (Contact id).`);
|
|
836
|
+
}
|
|
837
|
+
if (config.properties === void 0 || config.properties === null || config.properties === "") {
|
|
838
|
+
throw new Error(`contact_update: "properties" is required (Properties).`);
|
|
839
|
+
}
|
|
840
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
841
|
+
operation: CONTACT_UPDATE_OPERATION,
|
|
842
|
+
config,
|
|
843
|
+
input: options.input,
|
|
844
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
845
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
846
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
847
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
848
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
849
|
+
request: {
|
|
850
|
+
method: "PATCH",
|
|
851
|
+
path: `/crm/v3/objects/contacts/${encodeURIComponent(String(config.contactId))}`,
|
|
852
|
+
json: {
|
|
853
|
+
"properties": propertiesMap3(config.properties)
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
function propertiesMap3(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_CREATE_OPERATION = "deal_create";
|
|
867
|
+
async function hubspotDealCreate(options) {
|
|
868
|
+
const config = options.config ?? {};
|
|
869
|
+
if (config.properties === void 0 || config.properties === null || config.properties === "") {
|
|
870
|
+
throw new Error(`deal_create: "properties" is required (Properties).`);
|
|
871
|
+
}
|
|
872
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
873
|
+
operation: DEAL_CREATE_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: "POST",
|
|
883
|
+
path: "/crm/v3/objects/deals",
|
|
884
|
+
json: {
|
|
885
|
+
"properties": propertiesMap4(config.properties),
|
|
886
|
+
"associations": []
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
});
|
|
890
|
+
}
|
|
891
|
+
function propertiesMap4(value) {
|
|
892
|
+
if (!value || typeof value !== "object") return {};
|
|
893
|
+
const out = {};
|
|
894
|
+
for (const [key, item] of Object.entries(value)) {
|
|
895
|
+
if (item !== void 0 && item !== null && item !== "") out[key] = String(item);
|
|
896
|
+
}
|
|
897
|
+
return out;
|
|
898
|
+
}
|
|
899
|
+
var DEAL_GET_OPERATION = "deal_get";
|
|
900
|
+
async function hubspotDealGet(options) {
|
|
901
|
+
const config = options.config ?? {};
|
|
902
|
+
if (config.dealId === void 0 || config.dealId === null || config.dealId === "") {
|
|
903
|
+
throw new Error(`deal_get: "dealId" is required (Deal id).`);
|
|
904
|
+
}
|
|
905
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
906
|
+
operation: DEAL_GET_OPERATION,
|
|
907
|
+
config,
|
|
908
|
+
input: options.input,
|
|
909
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
910
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
911
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
912
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
913
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
914
|
+
request: {
|
|
915
|
+
method: "GET",
|
|
916
|
+
path: `/crm/v3/objects/deals/${encodeURIComponent(String(config.dealId))}`,
|
|
917
|
+
query: {
|
|
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_LIST_OPERATION = "deal_list";
|
|
925
|
+
async function hubspotDealList(options) {
|
|
926
|
+
const config = options.config ?? {};
|
|
927
|
+
{
|
|
928
|
+
const n = Number(config.limit);
|
|
929
|
+
const given = config.limit !== void 0 && config.limit !== null && config.limit !== "";
|
|
930
|
+
if (given && !(Number.isInteger(n) && n >= 1 && n <= 100)) {
|
|
931
|
+
throw new Error(
|
|
932
|
+
`deal_list: "limit" must be a integer, got ${JSON.stringify(config.limit)}.`
|
|
933
|
+
);
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
937
|
+
operation: DEAL_LIST_OPERATION,
|
|
938
|
+
config,
|
|
939
|
+
input: options.input,
|
|
940
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
941
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
942
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
943
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
944
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
945
|
+
request: {
|
|
946
|
+
method: "GET",
|
|
947
|
+
path: "/crm/v3/objects/deals",
|
|
948
|
+
query: {
|
|
949
|
+
...config.limit !== void 0 && config.limit !== null && config.limit !== "" ? { "limit": Math.trunc(Number(config.limit)) } : {},
|
|
950
|
+
...config.after !== void 0 && config.after !== null && config.after !== "" ? { "after": String(config.after) } : {},
|
|
951
|
+
...config.properties !== void 0 && config.properties !== null && config.properties !== "" ? { "properties": String(config.properties) } : {},
|
|
952
|
+
...config.associations !== void 0 && config.associations !== null && config.associations !== "" ? { "associations": String(config.associations) } : {}
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
});
|
|
956
|
+
}
|
|
957
|
+
var DEAL_SEARCH_OPERATION = "deal_search";
|
|
958
|
+
async function hubspotDealSearch(options) {
|
|
959
|
+
const config = options.config ?? {};
|
|
960
|
+
if (typeof config.filterGroups === "string" && config.filterGroups !== "") {
|
|
961
|
+
try {
|
|
962
|
+
JSON.parse(config.filterGroups);
|
|
963
|
+
} catch (error) {
|
|
964
|
+
throw new Error(`deal_search: "filterGroups" must be JSON: ${error.message}`);
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
if (typeof config.sorts === "string" && config.sorts !== "") {
|
|
968
|
+
try {
|
|
969
|
+
JSON.parse(config.sorts);
|
|
970
|
+
} catch (error) {
|
|
971
|
+
throw new Error(`deal_search: "sorts" must be JSON: ${error.message}`);
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
{
|
|
975
|
+
const n = Number(config.limit);
|
|
976
|
+
const given = config.limit !== void 0 && config.limit !== null && config.limit !== "";
|
|
977
|
+
if (given && !(Number.isInteger(n) && n >= 1 && n <= 200)) {
|
|
978
|
+
throw new Error(
|
|
979
|
+
`deal_search: "limit" must be a integer, got ${JSON.stringify(config.limit)}.`
|
|
980
|
+
);
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
984
|
+
operation: DEAL_SEARCH_OPERATION,
|
|
985
|
+
config,
|
|
986
|
+
input: options.input,
|
|
987
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
988
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
989
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
990
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
991
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
992
|
+
request: {
|
|
993
|
+
method: "POST",
|
|
994
|
+
path: "/crm/v3/objects/deals/search",
|
|
995
|
+
json: {
|
|
996
|
+
...config.filterGroups !== void 0 && config.filterGroups !== null && config.filterGroups !== "" ? { "filterGroups": typeof config.filterGroups === "string" ? JSON.parse(config.filterGroups) : config.filterGroups } : {},
|
|
997
|
+
...config.sorts !== void 0 && config.sorts !== null && config.sorts !== "" ? { "sorts": typeof config.sorts === "string" ? JSON.parse(config.sorts) : config.sorts } : {},
|
|
998
|
+
...config.query !== void 0 && config.query !== null && config.query !== "" ? { "query": String(config.query) } : {},
|
|
999
|
+
...config.properties !== void 0 && config.properties !== null && config.properties !== "" ? { "properties": propertiesList3(config.properties) } : {},
|
|
1000
|
+
...config.limit !== void 0 && config.limit !== null && config.limit !== "" ? { "limit": Math.trunc(Number(config.limit)) } : {},
|
|
1001
|
+
...config.after !== void 0 && config.after !== null && config.after !== "" ? { "after": String(config.after) } : {}
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1006
|
+
function propertiesList3(value) {
|
|
1007
|
+
const items = Array.isArray(value) ? value.map(String) : typeof value === "string" ? value.split(",") : [];
|
|
1008
|
+
return items.map((item) => item.trim()).filter(Boolean);
|
|
1009
|
+
}
|
|
1010
|
+
var DEAL_UPDATE_OPERATION = "deal_update";
|
|
1011
|
+
async function hubspotDealUpdate(options) {
|
|
1012
|
+
const config = options.config ?? {};
|
|
1013
|
+
if (config.dealId === void 0 || config.dealId === null || config.dealId === "") {
|
|
1014
|
+
throw new Error(`deal_update: "dealId" is required (Deal id).`);
|
|
1015
|
+
}
|
|
1016
|
+
if (config.properties === void 0 || config.properties === null || config.properties === "") {
|
|
1017
|
+
throw new Error(`deal_update: "properties" is required (Properties).`);
|
|
1018
|
+
}
|
|
1019
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
1020
|
+
operation: DEAL_UPDATE_OPERATION,
|
|
1021
|
+
config,
|
|
1022
|
+
input: options.input,
|
|
1023
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
1024
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
1025
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
1026
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
1027
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
1028
|
+
request: {
|
|
1029
|
+
method: "PATCH",
|
|
1030
|
+
path: `/crm/v3/objects/deals/${encodeURIComponent(String(config.dealId))}`,
|
|
1031
|
+
json: {
|
|
1032
|
+
"properties": propertiesMap5(config.properties)
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
});
|
|
1036
|
+
}
|
|
1037
|
+
function propertiesMap5(value) {
|
|
1038
|
+
if (!value || typeof value !== "object") return {};
|
|
1039
|
+
const out = {};
|
|
1040
|
+
for (const [key, item] of Object.entries(value)) {
|
|
1041
|
+
if (item !== void 0 && item !== null && item !== "") out[key] = String(item);
|
|
1042
|
+
}
|
|
1043
|
+
return out;
|
|
1044
|
+
}
|
|
1045
|
+
var OWNER_LIST_OPERATION = "owner_list";
|
|
1046
|
+
async function hubspotOwnerList(options) {
|
|
1047
|
+
const config = options.config ?? {};
|
|
1048
|
+
{
|
|
1049
|
+
const n = Number(config.limit);
|
|
1050
|
+
const given = config.limit !== void 0 && config.limit !== null && config.limit !== "";
|
|
1051
|
+
if (given && !(Number.isInteger(n) && n >= 1 && n <= 100)) {
|
|
1052
|
+
throw new Error(
|
|
1053
|
+
`owner_list: "limit" must be a integer, got ${JSON.stringify(config.limit)}.`
|
|
1054
|
+
);
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
1058
|
+
operation: OWNER_LIST_OPERATION,
|
|
1059
|
+
config,
|
|
1060
|
+
input: options.input,
|
|
1061
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
1062
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
1063
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
1064
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
1065
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
1066
|
+
request: {
|
|
1067
|
+
method: "GET",
|
|
1068
|
+
path: "/crm/v3/owners",
|
|
1069
|
+
query: {
|
|
1070
|
+
...config.email !== void 0 && config.email !== null && config.email !== "" ? { "email": String(config.email) } : {},
|
|
1071
|
+
...config.limit !== void 0 && config.limit !== null && config.limit !== "" ? { "limit": Math.trunc(Number(config.limit)) } : {},
|
|
1072
|
+
...config.after !== void 0 && config.after !== null && config.after !== "" ? { "after": String(config.after) } : {}
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1077
|
+
var PIPELINE_LIST_OPERATION = "pipeline_list";
|
|
1078
|
+
async function hubspotPipelineList(options) {
|
|
1079
|
+
const config = options.config ?? {};
|
|
1080
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
1081
|
+
operation: PIPELINE_LIST_OPERATION,
|
|
1082
|
+
config,
|
|
1083
|
+
input: options.input,
|
|
1084
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
1085
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
1086
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
1087
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
1088
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
1089
|
+
request: {
|
|
1090
|
+
method: "GET",
|
|
1091
|
+
path: "/crm/v3/pipelines/deals",
|
|
1092
|
+
query: {}
|
|
1093
|
+
}
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
var PROPERTY_LIST_OPERATION = "property_list";
|
|
1097
|
+
async function hubspotPropertyList(options) {
|
|
1098
|
+
const config = options.config ?? {};
|
|
1099
|
+
if (config.objectType === void 0 || config.objectType === null || config.objectType === "") {
|
|
1100
|
+
throw new Error(`property_list: "objectType" is required (Object).`);
|
|
1101
|
+
}
|
|
1102
|
+
return fancyConnectorCore.callConnector(HUBSPOT, {
|
|
1103
|
+
operation: PROPERTY_LIST_OPERATION,
|
|
1104
|
+
config,
|
|
1105
|
+
input: options.input,
|
|
1106
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
1107
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
1108
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
1109
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
1110
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
1111
|
+
request: {
|
|
1112
|
+
method: "GET",
|
|
1113
|
+
path: `/crm/v3/properties/${encodeURIComponent(String(config.objectType))}`,
|
|
1114
|
+
query: {}
|
|
1115
|
+
}
|
|
1116
|
+
});
|
|
1117
|
+
}
|
|
1118
|
+
var HUBSPOT_CRM_EVENT_SIGNATURE_HEADER = "X-HubSpot-Signature-v3";
|
|
1119
|
+
var HUBSPOT_CRM_EVENT_TOLERANCE = 300;
|
|
1120
|
+
var HUBSPOT_CRM_EVENT_SCHEME = {
|
|
1121
|
+
algorithm: "SHA-256",
|
|
1122
|
+
payload: (raw, timestamp, _id, request) => `${request?.method ?? ""}${request?.uri ?? ""}${raw}${timestamp}`,
|
|
1123
|
+
tolerance: HUBSPOT_CRM_EVENT_TOLERANCE,
|
|
1124
|
+
timestampUnit: "ms",
|
|
1125
|
+
signsRequestLine: true,
|
|
1126
|
+
uri: "hubspot-v3",
|
|
1127
|
+
encoding: "base64"
|
|
1128
|
+
};
|
|
1129
|
+
var HUBSPOT_CRM_EVENT = {
|
|
1130
|
+
service: "hubspot",
|
|
1131
|
+
operation: "crm_event",
|
|
1132
|
+
delivery: "webhook",
|
|
1133
|
+
setup: "In the HubSpot app's webhook settings, set the target URL to the route your host mounts for this trigger and subscribe to the deal, contact and company events you want. Deliveries are signed with the app's client secret, already on the connection as `clientSecret`. ONE URL serves every portal that installed the app, so route each event by its portalId, and only after the signature has verified: map portalId to the connection created when that portal installed, and drop an unmapped portalId with a 2xx and a log line, creating nothing.",
|
|
1134
|
+
verification: {
|
|
1135
|
+
signatureHeader: HUBSPOT_CRM_EVENT_SIGNATURE_HEADER,
|
|
1136
|
+
scheme: HUBSPOT_CRM_EVENT_SCHEME,
|
|
1137
|
+
timestampHeader: "X-HubSpot-Request-Timestamp"
|
|
1138
|
+
},
|
|
1139
|
+
route: { by: "portalId", path: "[].portalId" },
|
|
1140
|
+
faker: hubspotFaker
|
|
1141
|
+
};
|
|
1142
|
+
function verifyHubspotDelivery(delivery, clientSecret, now) {
|
|
1143
|
+
return fancyConnectorCore.verifyDelivery(HUBSPOT_CRM_EVENT, delivery, clientSecret, now);
|
|
1144
|
+
}
|
|
103
1145
|
|
|
1146
|
+
exports.COMPANY_CREATE_OPERATION = COMPANY_CREATE_OPERATION;
|
|
1147
|
+
exports.COMPANY_GET_OPERATION = COMPANY_GET_OPERATION;
|
|
1148
|
+
exports.COMPANY_LIST_OPERATION = COMPANY_LIST_OPERATION;
|
|
1149
|
+
exports.COMPANY_SEARCH_OPERATION = COMPANY_SEARCH_OPERATION;
|
|
1150
|
+
exports.COMPANY_UPDATE_OPERATION = COMPANY_UPDATE_OPERATION;
|
|
104
1151
|
exports.CONNECTOR_API_VERSION = CONNECTOR_API_VERSION;
|
|
105
1152
|
exports.CONTACT_CREATE_OPERATION = CONTACT_CREATE_OPERATION;
|
|
1153
|
+
exports.CONTACT_GET_OPERATION = CONTACT_GET_OPERATION;
|
|
1154
|
+
exports.CONTACT_LIST_OPERATION = CONTACT_LIST_OPERATION;
|
|
1155
|
+
exports.CONTACT_SEARCH_OPERATION = CONTACT_SEARCH_OPERATION;
|
|
1156
|
+
exports.CONTACT_UPDATE_OPERATION = CONTACT_UPDATE_OPERATION;
|
|
1157
|
+
exports.DEAL_CREATE_OPERATION = DEAL_CREATE_OPERATION;
|
|
1158
|
+
exports.DEAL_GET_OPERATION = DEAL_GET_OPERATION;
|
|
1159
|
+
exports.DEAL_LIST_OPERATION = DEAL_LIST_OPERATION;
|
|
1160
|
+
exports.DEAL_SEARCH_OPERATION = DEAL_SEARCH_OPERATION;
|
|
1161
|
+
exports.DEAL_UPDATE_OPERATION = DEAL_UPDATE_OPERATION;
|
|
106
1162
|
exports.HUBSPOT = HUBSPOT;
|
|
107
1163
|
exports.HUBSPOT_BASE_URLS = HUBSPOT_BASE_URLS;
|
|
1164
|
+
exports.HUBSPOT_CRM_EVENT = HUBSPOT_CRM_EVENT;
|
|
1165
|
+
exports.HUBSPOT_CRM_EVENT_SCHEME = HUBSPOT_CRM_EVENT_SCHEME;
|
|
1166
|
+
exports.HUBSPOT_CRM_EVENT_SIGNATURE_HEADER = HUBSPOT_CRM_EVENT_SIGNATURE_HEADER;
|
|
1167
|
+
exports.HUBSPOT_CRM_EVENT_TOLERANCE = HUBSPOT_CRM_EVENT_TOLERANCE;
|
|
108
1168
|
exports.HUBSPOT_REQUIRES = HUBSPOT_REQUIRES;
|
|
1169
|
+
exports.OWNER_LIST_OPERATION = OWNER_LIST_OPERATION;
|
|
1170
|
+
exports.PIPELINE_LIST_OPERATION = PIPELINE_LIST_OPERATION;
|
|
1171
|
+
exports.PROPERTY_LIST_OPERATION = PROPERTY_LIST_OPERATION;
|
|
109
1172
|
exports.hubspotAuthorize = hubspotAuthorize;
|
|
1173
|
+
exports.hubspotCompanyCreate = hubspotCompanyCreate;
|
|
1174
|
+
exports.hubspotCompanyGet = hubspotCompanyGet;
|
|
1175
|
+
exports.hubspotCompanyList = hubspotCompanyList;
|
|
1176
|
+
exports.hubspotCompanySearch = hubspotCompanySearch;
|
|
1177
|
+
exports.hubspotCompanyUpdate = hubspotCompanyUpdate;
|
|
110
1178
|
exports.hubspotContactCreate = hubspotContactCreate;
|
|
1179
|
+
exports.hubspotContactGet = hubspotContactGet;
|
|
1180
|
+
exports.hubspotContactList = hubspotContactList;
|
|
1181
|
+
exports.hubspotContactSearch = hubspotContactSearch;
|
|
1182
|
+
exports.hubspotContactUpdate = hubspotContactUpdate;
|
|
1183
|
+
exports.hubspotDealCreate = hubspotDealCreate;
|
|
1184
|
+
exports.hubspotDealGet = hubspotDealGet;
|
|
1185
|
+
exports.hubspotDealList = hubspotDealList;
|
|
1186
|
+
exports.hubspotDealSearch = hubspotDealSearch;
|
|
1187
|
+
exports.hubspotDealUpdate = hubspotDealUpdate;
|
|
111
1188
|
exports.hubspotFaker = hubspotFaker;
|
|
1189
|
+
exports.hubspotOwnerList = hubspotOwnerList;
|
|
1190
|
+
exports.hubspotPipelineList = hubspotPipelineList;
|
|
1191
|
+
exports.hubspotPropertyList = hubspotPropertyList;
|
|
1192
|
+
exports.verifyHubspotDelivery = verifyHubspotDelivery;
|
|
112
1193
|
//# sourceMappingURL=index.cjs.map
|
|
113
1194
|
//# sourceMappingURL=index.cjs.map
|