@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/dist/flow.cjs CHANGED
@@ -6,6 +6,107 @@ var hubspotUi = require('@particle-academy/hubspot-ui');
6
6
  // src/flow.ts
7
7
 
8
8
  // src/faker.ts
9
+ function fakeCompanyCreate({ config, fake }) {
10
+ const boundRecordId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
11
+ return {
12
+ "id": boundRecordId,
13
+ "properties": {
14
+ "name": "Acme",
15
+ "domain": "acme.example.test",
16
+ "hs_object_id": boundRecordId,
17
+ "createdate": "2026-01-01T00:00:00.000Z",
18
+ "lastmodifieddate": "2026-01-01T00:00:00.000Z"
19
+ },
20
+ "createdAt": "2026-01-01T00:00:00.000Z",
21
+ "updatedAt": "2026-01-01T00:00:00.000Z",
22
+ "archived": false
23
+ };
24
+ }
25
+ function fakeCompanyGet({ config, fake }) {
26
+ const boundRecordId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
27
+ return {
28
+ "id": boundRecordId,
29
+ "properties": {
30
+ "name": "Acme",
31
+ "domain": "acme.example.test",
32
+ "hs_object_id": boundRecordId,
33
+ "createdate": "2026-01-01T00:00:00.000Z",
34
+ "lastmodifieddate": "2026-01-01T00:00:00.000Z"
35
+ },
36
+ "createdAt": "2026-01-01T00:00:00.000Z",
37
+ "updatedAt": "2026-01-01T00:00:00.000Z",
38
+ "archived": false
39
+ };
40
+ }
41
+ function fakeCompanyList({ config, fake }) {
42
+ const boundRecordId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
43
+ return {
44
+ "results": [
45
+ {
46
+ "id": boundRecordId,
47
+ "properties": {
48
+ "name": "Acme",
49
+ "domain": "acme.example.test",
50
+ "hs_object_id": boundRecordId,
51
+ "createdate": "2026-01-01T00:00:00.000Z",
52
+ "lastmodifieddate": "2026-01-01T00:00:00.000Z"
53
+ },
54
+ "createdAt": "2026-01-01T00:00:00.000Z",
55
+ "updatedAt": "2026-01-01T00:00:00.000Z",
56
+ "archived": false
57
+ }
58
+ ],
59
+ "paging": {
60
+ "next": {
61
+ "after": "10",
62
+ "link": "?after=10"
63
+ }
64
+ }
65
+ };
66
+ }
67
+ function fakeCompanySearch({ config, fake }) {
68
+ const boundRecordId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
69
+ return {
70
+ "total": 1,
71
+ "results": [
72
+ {
73
+ "id": boundRecordId,
74
+ "properties": {
75
+ "name": "Acme",
76
+ "domain": "acme.example.test",
77
+ "hs_object_id": boundRecordId,
78
+ "createdate": "2026-01-01T00:00:00.000Z",
79
+ "lastmodifieddate": "2026-01-01T00:00:00.000Z"
80
+ },
81
+ "createdAt": "2026-01-01T00:00:00.000Z",
82
+ "updatedAt": "2026-01-01T00:00:00.000Z",
83
+ "archived": false
84
+ }
85
+ ],
86
+ "paging": {
87
+ "next": {
88
+ "after": "10",
89
+ "link": "?after=10"
90
+ }
91
+ }
92
+ };
93
+ }
94
+ function fakeCompanyUpdate({ config, fake }) {
95
+ const boundRecordId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
96
+ return {
97
+ "id": boundRecordId,
98
+ "properties": {
99
+ "name": "Acme",
100
+ "domain": "acme.example.test",
101
+ "hs_object_id": boundRecordId,
102
+ "createdate": "2026-01-01T00:00:00.000Z",
103
+ "lastmodifieddate": "2026-01-01T00:00:00.000Z"
104
+ },
105
+ "createdAt": "2026-01-01T00:00:00.000Z",
106
+ "updatedAt": "2026-01-01T00:00:00.000Z",
107
+ "archived": false
108
+ };
109
+ }
9
110
  function fakeContactCreate({ config, fake }) {
10
111
  const boundContactId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
11
112
  return {
@@ -26,10 +127,347 @@ function fakeContactCreate({ config, fake }) {
26
127
  "archived": false
27
128
  };
28
129
  }
130
+ function fakeContactGet({ config, fake }) {
131
+ const boundRecordId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
132
+ return {
133
+ "id": boundRecordId,
134
+ "properties": {
135
+ "email": "rosa@example.test",
136
+ "firstname": "Rosa",
137
+ "lastname": "Diaz",
138
+ "hs_object_id": boundRecordId,
139
+ "createdate": "2026-01-01T00:00:00.000Z",
140
+ "lastmodifieddate": "2026-01-01T00:00:00.000Z"
141
+ },
142
+ "createdAt": "2026-01-01T00:00:00.000Z",
143
+ "updatedAt": "2026-01-01T00:00:00.000Z",
144
+ "archived": false
145
+ };
146
+ }
147
+ function fakeContactList({ config, fake }) {
148
+ const boundRecordId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
149
+ return {
150
+ "results": [
151
+ {
152
+ "id": boundRecordId,
153
+ "properties": {
154
+ "email": "rosa@example.test",
155
+ "firstname": "Rosa",
156
+ "lastname": "Diaz",
157
+ "hs_object_id": boundRecordId,
158
+ "createdate": "2026-01-01T00:00:00.000Z",
159
+ "lastmodifieddate": "2026-01-01T00:00:00.000Z"
160
+ },
161
+ "createdAt": "2026-01-01T00:00:00.000Z",
162
+ "updatedAt": "2026-01-01T00:00:00.000Z",
163
+ "archived": false
164
+ }
165
+ ],
166
+ "paging": {
167
+ "next": {
168
+ "after": "10",
169
+ "link": "?after=10"
170
+ }
171
+ }
172
+ };
173
+ }
174
+ function fakeContactSearch({ config, fake }) {
175
+ const boundRecordId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
176
+ return {
177
+ "total": 1,
178
+ "results": [
179
+ {
180
+ "id": boundRecordId,
181
+ "properties": {
182
+ "email": "rosa@example.test",
183
+ "firstname": "Rosa",
184
+ "lastname": "Diaz",
185
+ "hs_object_id": boundRecordId,
186
+ "createdate": "2026-01-01T00:00:00.000Z",
187
+ "lastmodifieddate": "2026-01-01T00:00:00.000Z"
188
+ },
189
+ "createdAt": "2026-01-01T00:00:00.000Z",
190
+ "updatedAt": "2026-01-01T00:00:00.000Z",
191
+ "archived": false
192
+ }
193
+ ],
194
+ "paging": {
195
+ "next": {
196
+ "after": "10",
197
+ "link": "?after=10"
198
+ }
199
+ }
200
+ };
201
+ }
202
+ function fakeContactUpdate({ config, fake }) {
203
+ const boundRecordId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
204
+ return {
205
+ "id": boundRecordId,
206
+ "properties": {
207
+ "email": "rosa@example.test",
208
+ "firstname": "Rosa",
209
+ "lastname": "Diaz",
210
+ "hs_object_id": boundRecordId,
211
+ "createdate": "2026-01-01T00:00:00.000Z",
212
+ "lastmodifieddate": "2026-01-01T00:00:00.000Z"
213
+ },
214
+ "createdAt": "2026-01-01T00:00:00.000Z",
215
+ "updatedAt": "2026-01-01T00:00:00.000Z",
216
+ "archived": false
217
+ };
218
+ }
219
+ function fakeDealCreate({ config, fake }) {
220
+ const boundRecordId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
221
+ return {
222
+ "id": boundRecordId,
223
+ "properties": {
224
+ "dealname": "Acme renewal",
225
+ "amount": "12000",
226
+ "dealstage": "appointmentscheduled",
227
+ "pipeline": "default",
228
+ "hs_object_id": boundRecordId,
229
+ "createdate": "2026-01-01T00:00:00.000Z",
230
+ "lastmodifieddate": "2026-01-01T00:00:00.000Z"
231
+ },
232
+ "createdAt": "2026-01-01T00:00:00.000Z",
233
+ "updatedAt": "2026-01-01T00:00:00.000Z",
234
+ "archived": false
235
+ };
236
+ }
237
+ function fakeDealGet({ config, fake }) {
238
+ const boundRecordId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
239
+ return {
240
+ "id": boundRecordId,
241
+ "properties": {
242
+ "dealname": "Acme renewal",
243
+ "amount": "12000",
244
+ "dealstage": "appointmentscheduled",
245
+ "pipeline": "default",
246
+ "hs_object_id": boundRecordId,
247
+ "createdate": "2026-01-01T00:00:00.000Z",
248
+ "lastmodifieddate": "2026-01-01T00:00:00.000Z"
249
+ },
250
+ "createdAt": "2026-01-01T00:00:00.000Z",
251
+ "updatedAt": "2026-01-01T00:00:00.000Z",
252
+ "archived": false
253
+ };
254
+ }
255
+ function fakeDealList({ config, fake }) {
256
+ const boundRecordId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
257
+ return {
258
+ "results": [
259
+ {
260
+ "id": boundRecordId,
261
+ "properties": {
262
+ "dealname": "Acme renewal",
263
+ "amount": "12000",
264
+ "dealstage": "appointmentscheduled",
265
+ "pipeline": "default",
266
+ "hs_object_id": boundRecordId,
267
+ "createdate": "2026-01-01T00:00:00.000Z",
268
+ "lastmodifieddate": "2026-01-01T00:00:00.000Z"
269
+ },
270
+ "createdAt": "2026-01-01T00:00:00.000Z",
271
+ "updatedAt": "2026-01-01T00:00:00.000Z",
272
+ "archived": false
273
+ }
274
+ ],
275
+ "paging": {
276
+ "next": {
277
+ "after": "10",
278
+ "link": "?after=10"
279
+ }
280
+ }
281
+ };
282
+ }
283
+ function fakeDealSearch({ config, fake }) {
284
+ const boundRecordId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
285
+ return {
286
+ "total": 1,
287
+ "results": [
288
+ {
289
+ "id": boundRecordId,
290
+ "properties": {
291
+ "dealname": "Acme renewal",
292
+ "amount": "12000",
293
+ "dealstage": "appointmentscheduled",
294
+ "pipeline": "default",
295
+ "hs_object_id": boundRecordId,
296
+ "createdate": "2026-01-01T00:00:00.000Z",
297
+ "lastmodifieddate": "2026-01-01T00:00:00.000Z"
298
+ },
299
+ "createdAt": "2026-01-01T00:00:00.000Z",
300
+ "updatedAt": "2026-01-01T00:00:00.000Z",
301
+ "archived": false
302
+ }
303
+ ],
304
+ "paging": {
305
+ "next": {
306
+ "after": "10",
307
+ "link": "?after=10"
308
+ }
309
+ }
310
+ };
311
+ }
312
+ function fakeDealUpdate({ config, fake }) {
313
+ const boundRecordId = Array.from({ length: 9 }, () => fake.int(0, 9)).join("");
314
+ return {
315
+ "id": boundRecordId,
316
+ "properties": {
317
+ "dealname": "Acme renewal",
318
+ "amount": "12000",
319
+ "dealstage": "appointmentscheduled",
320
+ "pipeline": "default",
321
+ "hs_object_id": boundRecordId,
322
+ "createdate": "2026-01-01T00:00:00.000Z",
323
+ "lastmodifieddate": "2026-01-01T00:00:00.000Z"
324
+ },
325
+ "createdAt": "2026-01-01T00:00:00.000Z",
326
+ "updatedAt": "2026-01-01T00:00:00.000Z",
327
+ "archived": false
328
+ };
329
+ }
330
+ function fakeOwnerList({ config, fake }) {
331
+ const boundOwnerId = Array.from({ length: 8 }, () => fake.int(0, 9)).join("");
332
+ return {
333
+ "results": [
334
+ {
335
+ "id": boundOwnerId,
336
+ "email": "rosa@example.test",
337
+ "firstName": "Rosa",
338
+ "lastName": "Diaz",
339
+ "userId": 4242,
340
+ "archived": false
341
+ }
342
+ ],
343
+ "paging": {
344
+ "next": {
345
+ "after": "10",
346
+ "link": "?after=10"
347
+ }
348
+ }
349
+ };
350
+ }
351
+ function fakePipelineList({ config, fake }) {
352
+ return {
353
+ "results": [
354
+ {
355
+ "id": "default",
356
+ "label": "Sales pipeline",
357
+ "displayOrder": 0,
358
+ "archived": false,
359
+ "stages": [
360
+ {
361
+ "id": "appointmentscheduled",
362
+ "label": "Appointment scheduled",
363
+ "displayOrder": 0,
364
+ "metadata": {
365
+ "probability": "0.2"
366
+ }
367
+ },
368
+ {
369
+ "id": "closedwon",
370
+ "label": "Closed won",
371
+ "displayOrder": 1,
372
+ "metadata": {
373
+ "probability": "1.0"
374
+ }
375
+ }
376
+ ]
377
+ }
378
+ ]
379
+ };
380
+ }
381
+ function fakePropertyList({ config, fake }) {
382
+ return {
383
+ "results": [
384
+ {
385
+ "name": "dealstage",
386
+ "label": "Deal Stage",
387
+ "type": "enumeration",
388
+ "fieldType": "select",
389
+ "groupName": "dealinformation",
390
+ "options": [
391
+ {
392
+ "label": "Appointment scheduled",
393
+ "value": "appointmentscheduled"
394
+ }
395
+ ]
396
+ }
397
+ ]
398
+ };
399
+ }
400
+ function fakeCrmEvent({ config, fake }) {
401
+ return [
402
+ {
403
+ "eventId": 531833541,
404
+ "subscriptionId": 3923621,
405
+ "portalId": 48807704,
406
+ "appId": 16111050,
407
+ "occurredAt": 1752613920733,
408
+ "subscriptionType": "contact.creation",
409
+ "attemptNumber": 0,
410
+ "objectId": 138017612137,
411
+ "changeFlag": "CREATED",
412
+ "changeSource": "CRM_UI",
413
+ "sourceId": "userId:76023669"
414
+ },
415
+ {
416
+ "eventId": 531833542,
417
+ "subscriptionId": 3923622,
418
+ "portalId": 48807704,
419
+ "appId": 16111050,
420
+ "occurredAt": 1752613921e3,
421
+ "subscriptionType": "deal.propertyChange",
422
+ "attemptNumber": 0,
423
+ "objectId": 9876543210,
424
+ "propertyName": "dealstage",
425
+ "propertyValue": "closedwon",
426
+ "changeSource": "CRM_UI",
427
+ "sourceId": "userId:76023669"
428
+ }
429
+ ];
430
+ }
29
431
  var hubspotFaker = (operation, request) => {
30
432
  switch (operation) {
433
+ case "company_create":
434
+ return fakeCompanyCreate(request);
435
+ case "company_get":
436
+ return fakeCompanyGet(request);
437
+ case "company_list":
438
+ return fakeCompanyList(request);
439
+ case "company_search":
440
+ return fakeCompanySearch(request);
441
+ case "company_update":
442
+ return fakeCompanyUpdate(request);
31
443
  case "contact_create":
32
444
  return fakeContactCreate(request);
445
+ case "contact_get":
446
+ return fakeContactGet(request);
447
+ case "contact_list":
448
+ return fakeContactList(request);
449
+ case "contact_search":
450
+ return fakeContactSearch(request);
451
+ case "contact_update":
452
+ return fakeContactUpdate(request);
453
+ case "deal_create":
454
+ return fakeDealCreate(request);
455
+ case "deal_get":
456
+ return fakeDealGet(request);
457
+ case "deal_list":
458
+ return fakeDealList(request);
459
+ case "deal_search":
460
+ return fakeDealSearch(request);
461
+ case "deal_update":
462
+ return fakeDealUpdate(request);
463
+ case "owner_list":
464
+ return fakeOwnerList(request);
465
+ case "pipeline_list":
466
+ return fakePipelineList(request);
467
+ case "property_list":
468
+ return fakePropertyList(request);
469
+ case "crm_event":
470
+ return fakeCrmEvent(request);
33
471
  default:
34
472
  throw new Error(
35
473
  `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.`
@@ -57,6 +495,185 @@ var HUBSPOT = {
57
495
  authorize: hubspotAuthorize,
58
496
  faker: hubspotFaker
59
497
  };
498
+ var COMPANY_CREATE_OPERATION = "company_create";
499
+ async function hubspotCompanyCreate(options) {
500
+ const config = options.config ?? {};
501
+ if (config.properties === void 0 || config.properties === null || config.properties === "") {
502
+ throw new Error(`company_create: "properties" is required (Properties).`);
503
+ }
504
+ return fancyConnectorCore.callConnector(HUBSPOT, {
505
+ operation: COMPANY_CREATE_OPERATION,
506
+ config,
507
+ input: options.input,
508
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
509
+ ...options.mode === void 0 ? {} : { mode: options.mode },
510
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
511
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
512
+ ...options.transport === void 0 ? {} : { transport: options.transport },
513
+ request: {
514
+ method: "POST",
515
+ path: "/crm/v3/objects/companies",
516
+ json: {
517
+ "properties": propertiesMap(config.properties),
518
+ "associations": []
519
+ }
520
+ }
521
+ });
522
+ }
523
+ function propertiesMap(value) {
524
+ if (!value || typeof value !== "object") return {};
525
+ const out = {};
526
+ for (const [key, item] of Object.entries(value)) {
527
+ if (item !== void 0 && item !== null && item !== "") out[key] = String(item);
528
+ }
529
+ return out;
530
+ }
531
+ var COMPANY_GET_OPERATION = "company_get";
532
+ async function hubspotCompanyGet(options) {
533
+ const config = options.config ?? {};
534
+ if (config.companyId === void 0 || config.companyId === null || config.companyId === "") {
535
+ throw new Error(`company_get: "companyId" is required (Company id).`);
536
+ }
537
+ return fancyConnectorCore.callConnector(HUBSPOT, {
538
+ operation: COMPANY_GET_OPERATION,
539
+ config,
540
+ input: options.input,
541
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
542
+ ...options.mode === void 0 ? {} : { mode: options.mode },
543
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
544
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
545
+ ...options.transport === void 0 ? {} : { transport: options.transport },
546
+ request: {
547
+ method: "GET",
548
+ path: `/crm/v3/objects/companies/${encodeURIComponent(String(config.companyId))}`,
549
+ query: {
550
+ ...config.properties !== void 0 && config.properties !== null && config.properties !== "" ? { "properties": String(config.properties) } : {},
551
+ ...config.associations !== void 0 && config.associations !== null && config.associations !== "" ? { "associations": String(config.associations) } : {}
552
+ }
553
+ }
554
+ });
555
+ }
556
+ var COMPANY_LIST_OPERATION = "company_list";
557
+ async function hubspotCompanyList(options) {
558
+ const config = options.config ?? {};
559
+ {
560
+ const n = Number(config.limit);
561
+ const given = config.limit !== void 0 && config.limit !== null && config.limit !== "";
562
+ if (given && !(Number.isInteger(n) && n >= 1 && n <= 100)) {
563
+ throw new Error(
564
+ `company_list: "limit" must be a integer, got ${JSON.stringify(config.limit)}.`
565
+ );
566
+ }
567
+ }
568
+ return fancyConnectorCore.callConnector(HUBSPOT, {
569
+ operation: COMPANY_LIST_OPERATION,
570
+ config,
571
+ input: options.input,
572
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
573
+ ...options.mode === void 0 ? {} : { mode: options.mode },
574
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
575
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
576
+ ...options.transport === void 0 ? {} : { transport: options.transport },
577
+ request: {
578
+ method: "GET",
579
+ path: "/crm/v3/objects/companies",
580
+ query: {
581
+ ...config.limit !== void 0 && config.limit !== null && config.limit !== "" ? { "limit": Math.trunc(Number(config.limit)) } : {},
582
+ ...config.after !== void 0 && config.after !== null && config.after !== "" ? { "after": String(config.after) } : {},
583
+ ...config.properties !== void 0 && config.properties !== null && config.properties !== "" ? { "properties": String(config.properties) } : {},
584
+ ...config.associations !== void 0 && config.associations !== null && config.associations !== "" ? { "associations": String(config.associations) } : {}
585
+ }
586
+ }
587
+ });
588
+ }
589
+ var COMPANY_SEARCH_OPERATION = "company_search";
590
+ async function hubspotCompanySearch(options) {
591
+ const config = options.config ?? {};
592
+ if (typeof config.filterGroups === "string" && config.filterGroups !== "") {
593
+ try {
594
+ JSON.parse(config.filterGroups);
595
+ } catch (error) {
596
+ throw new Error(`company_search: "filterGroups" must be JSON: ${error.message}`);
597
+ }
598
+ }
599
+ if (typeof config.sorts === "string" && config.sorts !== "") {
600
+ try {
601
+ JSON.parse(config.sorts);
602
+ } catch (error) {
603
+ throw new Error(`company_search: "sorts" must be JSON: ${error.message}`);
604
+ }
605
+ }
606
+ {
607
+ const n = Number(config.limit);
608
+ const given = config.limit !== void 0 && config.limit !== null && config.limit !== "";
609
+ if (given && !(Number.isInteger(n) && n >= 1 && n <= 200)) {
610
+ throw new Error(
611
+ `company_search: "limit" must be a integer, got ${JSON.stringify(config.limit)}.`
612
+ );
613
+ }
614
+ }
615
+ return fancyConnectorCore.callConnector(HUBSPOT, {
616
+ operation: COMPANY_SEARCH_OPERATION,
617
+ config,
618
+ input: options.input,
619
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
620
+ ...options.mode === void 0 ? {} : { mode: options.mode },
621
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
622
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
623
+ ...options.transport === void 0 ? {} : { transport: options.transport },
624
+ request: {
625
+ method: "POST",
626
+ path: "/crm/v3/objects/companies/search",
627
+ json: {
628
+ ...config.filterGroups !== void 0 && config.filterGroups !== null && config.filterGroups !== "" ? { "filterGroups": typeof config.filterGroups === "string" ? JSON.parse(config.filterGroups) : config.filterGroups } : {},
629
+ ...config.sorts !== void 0 && config.sorts !== null && config.sorts !== "" ? { "sorts": typeof config.sorts === "string" ? JSON.parse(config.sorts) : config.sorts } : {},
630
+ ...config.query !== void 0 && config.query !== null && config.query !== "" ? { "query": String(config.query) } : {},
631
+ ...config.properties !== void 0 && config.properties !== null && config.properties !== "" ? { "properties": propertiesList(config.properties) } : {},
632
+ ...config.limit !== void 0 && config.limit !== null && config.limit !== "" ? { "limit": Math.trunc(Number(config.limit)) } : {},
633
+ ...config.after !== void 0 && config.after !== null && config.after !== "" ? { "after": String(config.after) } : {}
634
+ }
635
+ }
636
+ });
637
+ }
638
+ function propertiesList(value) {
639
+ const items = Array.isArray(value) ? value.map(String) : typeof value === "string" ? value.split(",") : [];
640
+ return items.map((item) => item.trim()).filter(Boolean);
641
+ }
642
+ var COMPANY_UPDATE_OPERATION = "company_update";
643
+ async function hubspotCompanyUpdate(options) {
644
+ const config = options.config ?? {};
645
+ if (config.companyId === void 0 || config.companyId === null || config.companyId === "") {
646
+ throw new Error(`company_update: "companyId" is required (Company id).`);
647
+ }
648
+ if (config.properties === void 0 || config.properties === null || config.properties === "") {
649
+ throw new Error(`company_update: "properties" is required (Properties).`);
650
+ }
651
+ return fancyConnectorCore.callConnector(HUBSPOT, {
652
+ operation: COMPANY_UPDATE_OPERATION,
653
+ config,
654
+ input: options.input,
655
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
656
+ ...options.mode === void 0 ? {} : { mode: options.mode },
657
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
658
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
659
+ ...options.transport === void 0 ? {} : { transport: options.transport },
660
+ request: {
661
+ method: "PATCH",
662
+ path: `/crm/v3/objects/companies/${encodeURIComponent(String(config.companyId))}`,
663
+ json: {
664
+ "properties": propertiesMap2(config.properties)
665
+ }
666
+ }
667
+ });
668
+ }
669
+ function propertiesMap2(value) {
670
+ if (!value || typeof value !== "object") return {};
671
+ const out = {};
672
+ for (const [key, item] of Object.entries(value)) {
673
+ if (item !== void 0 && item !== null && item !== "") out[key] = String(item);
674
+ }
675
+ return out;
676
+ }
60
677
  var CONTACT_CREATE_OPERATION = "contact_create";
61
678
  async function hubspotContactCreate(options) {
62
679
  const config = options.config ?? {};
@@ -102,27 +719,737 @@ function nestFields(flat) {
102
719
  }
103
720
  return out;
104
721
  }
105
-
106
- // src/flow.ts
107
- var hubspotContactCreateExecutor = async (ctx) => {
108
- const config = ctx.node.data?.config ?? {};
109
- const result = await hubspotContactCreate({
722
+ var CONTACT_GET_OPERATION = "contact_get";
723
+ async function hubspotContactGet(options) {
724
+ const config = options.config ?? {};
725
+ if (config.contactId === void 0 || config.contactId === null || config.contactId === "") {
726
+ throw new Error(`contact_get: "contactId" is required (Contact id).`);
727
+ }
728
+ return fancyConnectorCore.callConnector(HUBSPOT, {
729
+ operation: CONTACT_GET_OPERATION,
110
730
  config,
111
- input: ctx.inputs?.in
731
+ input: options.input,
732
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
733
+ ...options.mode === void 0 ? {} : { mode: options.mode },
734
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
735
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
736
+ ...options.transport === void 0 ? {} : { transport: options.transport },
737
+ request: {
738
+ method: "GET",
739
+ path: `/crm/v3/objects/contacts/${encodeURIComponent(String(config.contactId))}`,
740
+ query: {
741
+ ...config.properties !== void 0 && config.properties !== null && config.properties !== "" ? { "properties": String(config.properties) } : {},
742
+ ...config.associations !== void 0 && config.associations !== null && config.associations !== "" ? { "associations": String(config.associations) } : {}
743
+ }
744
+ }
112
745
  });
113
- ctx.emit({
114
- type: "log",
115
- level: "info",
116
- nodeId: ctx.node.id,
117
- message: `hubspot contact_create ${result.data?.id} (${result.mode})`
746
+ }
747
+ var CONTACT_LIST_OPERATION = "contact_list";
748
+ async function hubspotContactList(options) {
749
+ const config = options.config ?? {};
750
+ {
751
+ const n = Number(config.limit);
752
+ const given = config.limit !== void 0 && config.limit !== null && config.limit !== "";
753
+ if (given && !(Number.isInteger(n) && n >= 1 && n <= 100)) {
754
+ throw new Error(
755
+ `contact_list: "limit" must be a integer, got ${JSON.stringify(config.limit)}.`
756
+ );
757
+ }
758
+ }
759
+ return fancyConnectorCore.callConnector(HUBSPOT, {
760
+ operation: CONTACT_LIST_OPERATION,
761
+ config,
762
+ input: options.input,
763
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
764
+ ...options.mode === void 0 ? {} : { mode: options.mode },
765
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
766
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
767
+ ...options.transport === void 0 ? {} : { transport: options.transport },
768
+ request: {
769
+ method: "GET",
770
+ path: "/crm/v3/objects/contacts",
771
+ query: {
772
+ ...config.limit !== void 0 && config.limit !== null && config.limit !== "" ? { "limit": Math.trunc(Number(config.limit)) } : {},
773
+ ...config.after !== void 0 && config.after !== null && config.after !== "" ? { "after": String(config.after) } : {},
774
+ ...config.properties !== void 0 && config.properties !== null && config.properties !== "" ? { "properties": String(config.properties) } : {},
775
+ ...config.associations !== void 0 && config.associations !== null && config.associations !== "" ? { "associations": String(config.associations) } : {}
776
+ }
777
+ }
118
778
  });
119
- return { __port: "out", value: result };
779
+ }
780
+ var CONTACT_SEARCH_OPERATION = "contact_search";
781
+ async function hubspotContactSearch(options) {
782
+ const config = options.config ?? {};
783
+ if (typeof config.filterGroups === "string" && config.filterGroups !== "") {
784
+ try {
785
+ JSON.parse(config.filterGroups);
786
+ } catch (error) {
787
+ throw new Error(`contact_search: "filterGroups" must be JSON: ${error.message}`);
788
+ }
789
+ }
790
+ if (typeof config.sorts === "string" && config.sorts !== "") {
791
+ try {
792
+ JSON.parse(config.sorts);
793
+ } catch (error) {
794
+ throw new Error(`contact_search: "sorts" must be JSON: ${error.message}`);
795
+ }
796
+ }
797
+ {
798
+ const n = Number(config.limit);
799
+ const given = config.limit !== void 0 && config.limit !== null && config.limit !== "";
800
+ if (given && !(Number.isInteger(n) && n >= 1 && n <= 200)) {
801
+ throw new Error(
802
+ `contact_search: "limit" must be a integer, got ${JSON.stringify(config.limit)}.`
803
+ );
804
+ }
805
+ }
806
+ return fancyConnectorCore.callConnector(HUBSPOT, {
807
+ operation: CONTACT_SEARCH_OPERATION,
808
+ config,
809
+ input: options.input,
810
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
811
+ ...options.mode === void 0 ? {} : { mode: options.mode },
812
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
813
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
814
+ ...options.transport === void 0 ? {} : { transport: options.transport },
815
+ request: {
816
+ method: "POST",
817
+ path: "/crm/v3/objects/contacts/search",
818
+ json: {
819
+ ...config.filterGroups !== void 0 && config.filterGroups !== null && config.filterGroups !== "" ? { "filterGroups": typeof config.filterGroups === "string" ? JSON.parse(config.filterGroups) : config.filterGroups } : {},
820
+ ...config.sorts !== void 0 && config.sorts !== null && config.sorts !== "" ? { "sorts": typeof config.sorts === "string" ? JSON.parse(config.sorts) : config.sorts } : {},
821
+ ...config.query !== void 0 && config.query !== null && config.query !== "" ? { "query": String(config.query) } : {},
822
+ ...config.properties !== void 0 && config.properties !== null && config.properties !== "" ? { "properties": propertiesList2(config.properties) } : {},
823
+ ...config.limit !== void 0 && config.limit !== null && config.limit !== "" ? { "limit": Math.trunc(Number(config.limit)) } : {},
824
+ ...config.after !== void 0 && config.after !== null && config.after !== "" ? { "after": String(config.after) } : {}
825
+ }
826
+ }
827
+ });
828
+ }
829
+ function propertiesList2(value) {
830
+ const items = Array.isArray(value) ? value.map(String) : typeof value === "string" ? value.split(",") : [];
831
+ return items.map((item) => item.trim()).filter(Boolean);
832
+ }
833
+ var CONTACT_UPDATE_OPERATION = "contact_update";
834
+ async function hubspotContactUpdate(options) {
835
+ const config = options.config ?? {};
836
+ if (config.contactId === void 0 || config.contactId === null || config.contactId === "") {
837
+ throw new Error(`contact_update: "contactId" is required (Contact id).`);
838
+ }
839
+ if (config.properties === void 0 || config.properties === null || config.properties === "") {
840
+ throw new Error(`contact_update: "properties" is required (Properties).`);
841
+ }
842
+ return fancyConnectorCore.callConnector(HUBSPOT, {
843
+ operation: CONTACT_UPDATE_OPERATION,
844
+ config,
845
+ input: options.input,
846
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
847
+ ...options.mode === void 0 ? {} : { mode: options.mode },
848
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
849
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
850
+ ...options.transport === void 0 ? {} : { transport: options.transport },
851
+ request: {
852
+ method: "PATCH",
853
+ path: `/crm/v3/objects/contacts/${encodeURIComponent(String(config.contactId))}`,
854
+ json: {
855
+ "properties": propertiesMap3(config.properties)
856
+ }
857
+ }
858
+ });
859
+ }
860
+ function propertiesMap3(value) {
861
+ if (!value || typeof value !== "object") return {};
862
+ const out = {};
863
+ for (const [key, item] of Object.entries(value)) {
864
+ if (item !== void 0 && item !== null && item !== "") out[key] = String(item);
865
+ }
866
+ return out;
867
+ }
868
+ var DEAL_CREATE_OPERATION = "deal_create";
869
+ async function hubspotDealCreate(options) {
870
+ const config = options.config ?? {};
871
+ if (config.properties === void 0 || config.properties === null || config.properties === "") {
872
+ throw new Error(`deal_create: "properties" is required (Properties).`);
873
+ }
874
+ return fancyConnectorCore.callConnector(HUBSPOT, {
875
+ operation: DEAL_CREATE_OPERATION,
876
+ config,
877
+ input: options.input,
878
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
879
+ ...options.mode === void 0 ? {} : { mode: options.mode },
880
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
881
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
882
+ ...options.transport === void 0 ? {} : { transport: options.transport },
883
+ request: {
884
+ method: "POST",
885
+ path: "/crm/v3/objects/deals",
886
+ json: {
887
+ "properties": propertiesMap4(config.properties),
888
+ "associations": []
889
+ }
890
+ }
891
+ });
892
+ }
893
+ function propertiesMap4(value) {
894
+ if (!value || typeof value !== "object") return {};
895
+ const out = {};
896
+ for (const [key, item] of Object.entries(value)) {
897
+ if (item !== void 0 && item !== null && item !== "") out[key] = String(item);
898
+ }
899
+ return out;
900
+ }
901
+ var DEAL_GET_OPERATION = "deal_get";
902
+ async function hubspotDealGet(options) {
903
+ const config = options.config ?? {};
904
+ if (config.dealId === void 0 || config.dealId === null || config.dealId === "") {
905
+ throw new Error(`deal_get: "dealId" is required (Deal id).`);
906
+ }
907
+ return fancyConnectorCore.callConnector(HUBSPOT, {
908
+ operation: DEAL_GET_OPERATION,
909
+ config,
910
+ input: options.input,
911
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
912
+ ...options.mode === void 0 ? {} : { mode: options.mode },
913
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
914
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
915
+ ...options.transport === void 0 ? {} : { transport: options.transport },
916
+ request: {
917
+ method: "GET",
918
+ path: `/crm/v3/objects/deals/${encodeURIComponent(String(config.dealId))}`,
919
+ query: {
920
+ ...config.properties !== void 0 && config.properties !== null && config.properties !== "" ? { "properties": String(config.properties) } : {},
921
+ ...config.associations !== void 0 && config.associations !== null && config.associations !== "" ? { "associations": String(config.associations) } : {}
922
+ }
923
+ }
924
+ });
925
+ }
926
+ var DEAL_LIST_OPERATION = "deal_list";
927
+ async function hubspotDealList(options) {
928
+ const config = options.config ?? {};
929
+ {
930
+ const n = Number(config.limit);
931
+ const given = config.limit !== void 0 && config.limit !== null && config.limit !== "";
932
+ if (given && !(Number.isInteger(n) && n >= 1 && n <= 100)) {
933
+ throw new Error(
934
+ `deal_list: "limit" must be a integer, got ${JSON.stringify(config.limit)}.`
935
+ );
936
+ }
937
+ }
938
+ return fancyConnectorCore.callConnector(HUBSPOT, {
939
+ operation: DEAL_LIST_OPERATION,
940
+ config,
941
+ input: options.input,
942
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
943
+ ...options.mode === void 0 ? {} : { mode: options.mode },
944
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
945
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
946
+ ...options.transport === void 0 ? {} : { transport: options.transport },
947
+ request: {
948
+ method: "GET",
949
+ path: "/crm/v3/objects/deals",
950
+ query: {
951
+ ...config.limit !== void 0 && config.limit !== null && config.limit !== "" ? { "limit": Math.trunc(Number(config.limit)) } : {},
952
+ ...config.after !== void 0 && config.after !== null && config.after !== "" ? { "after": String(config.after) } : {},
953
+ ...config.properties !== void 0 && config.properties !== null && config.properties !== "" ? { "properties": String(config.properties) } : {},
954
+ ...config.associations !== void 0 && config.associations !== null && config.associations !== "" ? { "associations": String(config.associations) } : {}
955
+ }
956
+ }
957
+ });
958
+ }
959
+ var DEAL_SEARCH_OPERATION = "deal_search";
960
+ async function hubspotDealSearch(options) {
961
+ const config = options.config ?? {};
962
+ if (typeof config.filterGroups === "string" && config.filterGroups !== "") {
963
+ try {
964
+ JSON.parse(config.filterGroups);
965
+ } catch (error) {
966
+ throw new Error(`deal_search: "filterGroups" must be JSON: ${error.message}`);
967
+ }
968
+ }
969
+ if (typeof config.sorts === "string" && config.sorts !== "") {
970
+ try {
971
+ JSON.parse(config.sorts);
972
+ } catch (error) {
973
+ throw new Error(`deal_search: "sorts" must be JSON: ${error.message}`);
974
+ }
975
+ }
976
+ {
977
+ const n = Number(config.limit);
978
+ const given = config.limit !== void 0 && config.limit !== null && config.limit !== "";
979
+ if (given && !(Number.isInteger(n) && n >= 1 && n <= 200)) {
980
+ throw new Error(
981
+ `deal_search: "limit" must be a integer, got ${JSON.stringify(config.limit)}.`
982
+ );
983
+ }
984
+ }
985
+ return fancyConnectorCore.callConnector(HUBSPOT, {
986
+ operation: DEAL_SEARCH_OPERATION,
987
+ config,
988
+ input: options.input,
989
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
990
+ ...options.mode === void 0 ? {} : { mode: options.mode },
991
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
992
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
993
+ ...options.transport === void 0 ? {} : { transport: options.transport },
994
+ request: {
995
+ method: "POST",
996
+ path: "/crm/v3/objects/deals/search",
997
+ json: {
998
+ ...config.filterGroups !== void 0 && config.filterGroups !== null && config.filterGroups !== "" ? { "filterGroups": typeof config.filterGroups === "string" ? JSON.parse(config.filterGroups) : config.filterGroups } : {},
999
+ ...config.sorts !== void 0 && config.sorts !== null && config.sorts !== "" ? { "sorts": typeof config.sorts === "string" ? JSON.parse(config.sorts) : config.sorts } : {},
1000
+ ...config.query !== void 0 && config.query !== null && config.query !== "" ? { "query": String(config.query) } : {},
1001
+ ...config.properties !== void 0 && config.properties !== null && config.properties !== "" ? { "properties": propertiesList3(config.properties) } : {},
1002
+ ...config.limit !== void 0 && config.limit !== null && config.limit !== "" ? { "limit": Math.trunc(Number(config.limit)) } : {},
1003
+ ...config.after !== void 0 && config.after !== null && config.after !== "" ? { "after": String(config.after) } : {}
1004
+ }
1005
+ }
1006
+ });
1007
+ }
1008
+ function propertiesList3(value) {
1009
+ const items = Array.isArray(value) ? value.map(String) : typeof value === "string" ? value.split(",") : [];
1010
+ return items.map((item) => item.trim()).filter(Boolean);
1011
+ }
1012
+ var DEAL_UPDATE_OPERATION = "deal_update";
1013
+ async function hubspotDealUpdate(options) {
1014
+ const config = options.config ?? {};
1015
+ if (config.dealId === void 0 || config.dealId === null || config.dealId === "") {
1016
+ throw new Error(`deal_update: "dealId" is required (Deal id).`);
1017
+ }
1018
+ if (config.properties === void 0 || config.properties === null || config.properties === "") {
1019
+ throw new Error(`deal_update: "properties" is required (Properties).`);
1020
+ }
1021
+ return fancyConnectorCore.callConnector(HUBSPOT, {
1022
+ operation: DEAL_UPDATE_OPERATION,
1023
+ config,
1024
+ input: options.input,
1025
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
1026
+ ...options.mode === void 0 ? {} : { mode: options.mode },
1027
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
1028
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
1029
+ ...options.transport === void 0 ? {} : { transport: options.transport },
1030
+ request: {
1031
+ method: "PATCH",
1032
+ path: `/crm/v3/objects/deals/${encodeURIComponent(String(config.dealId))}`,
1033
+ json: {
1034
+ "properties": propertiesMap5(config.properties)
1035
+ }
1036
+ }
1037
+ });
1038
+ }
1039
+ function propertiesMap5(value) {
1040
+ if (!value || typeof value !== "object") return {};
1041
+ const out = {};
1042
+ for (const [key, item] of Object.entries(value)) {
1043
+ if (item !== void 0 && item !== null && item !== "") out[key] = String(item);
1044
+ }
1045
+ return out;
1046
+ }
1047
+ var OWNER_LIST_OPERATION = "owner_list";
1048
+ async function hubspotOwnerList(options) {
1049
+ const config = options.config ?? {};
1050
+ {
1051
+ const n = Number(config.limit);
1052
+ const given = config.limit !== void 0 && config.limit !== null && config.limit !== "";
1053
+ if (given && !(Number.isInteger(n) && n >= 1 && n <= 100)) {
1054
+ throw new Error(
1055
+ `owner_list: "limit" must be a integer, got ${JSON.stringify(config.limit)}.`
1056
+ );
1057
+ }
1058
+ }
1059
+ return fancyConnectorCore.callConnector(HUBSPOT, {
1060
+ operation: OWNER_LIST_OPERATION,
1061
+ config,
1062
+ input: options.input,
1063
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
1064
+ ...options.mode === void 0 ? {} : { mode: options.mode },
1065
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
1066
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
1067
+ ...options.transport === void 0 ? {} : { transport: options.transport },
1068
+ request: {
1069
+ method: "GET",
1070
+ path: "/crm/v3/owners",
1071
+ query: {
1072
+ ...config.email !== void 0 && config.email !== null && config.email !== "" ? { "email": String(config.email) } : {},
1073
+ ...config.limit !== void 0 && config.limit !== null && config.limit !== "" ? { "limit": Math.trunc(Number(config.limit)) } : {},
1074
+ ...config.after !== void 0 && config.after !== null && config.after !== "" ? { "after": String(config.after) } : {}
1075
+ }
1076
+ }
1077
+ });
1078
+ }
1079
+ var PIPELINE_LIST_OPERATION = "pipeline_list";
1080
+ async function hubspotPipelineList(options) {
1081
+ const config = options.config ?? {};
1082
+ return fancyConnectorCore.callConnector(HUBSPOT, {
1083
+ operation: PIPELINE_LIST_OPERATION,
1084
+ config,
1085
+ input: options.input,
1086
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
1087
+ ...options.mode === void 0 ? {} : { mode: options.mode },
1088
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
1089
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
1090
+ ...options.transport === void 0 ? {} : { transport: options.transport },
1091
+ request: {
1092
+ method: "GET",
1093
+ path: "/crm/v3/pipelines/deals",
1094
+ query: {}
1095
+ }
1096
+ });
1097
+ }
1098
+ var PROPERTY_LIST_OPERATION = "property_list";
1099
+ async function hubspotPropertyList(options) {
1100
+ const config = options.config ?? {};
1101
+ if (config.objectType === void 0 || config.objectType === null || config.objectType === "") {
1102
+ throw new Error(`property_list: "objectType" is required (Object).`);
1103
+ }
1104
+ return fancyConnectorCore.callConnector(HUBSPOT, {
1105
+ operation: PROPERTY_LIST_OPERATION,
1106
+ config,
1107
+ input: options.input,
1108
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
1109
+ ...options.mode === void 0 ? {} : { mode: options.mode },
1110
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
1111
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
1112
+ ...options.transport === void 0 ? {} : { transport: options.transport },
1113
+ request: {
1114
+ method: "GET",
1115
+ path: `/crm/v3/properties/${encodeURIComponent(String(config.objectType))}`,
1116
+ query: {}
1117
+ }
1118
+ });
1119
+ }
1120
+ var HUBSPOT_CRM_EVENT_SIGNATURE_HEADER = "X-HubSpot-Signature-v3";
1121
+ var HUBSPOT_CRM_EVENT_TOLERANCE = 300;
1122
+ var HUBSPOT_CRM_EVENT_SCHEME = {
1123
+ algorithm: "SHA-256",
1124
+ payload: (raw, timestamp, _id, request) => `${request?.method ?? ""}${request?.uri ?? ""}${raw}${timestamp}`,
1125
+ tolerance: HUBSPOT_CRM_EVENT_TOLERANCE,
1126
+ timestampUnit: "ms",
1127
+ signsRequestLine: true,
1128
+ uri: "hubspot-v3",
1129
+ encoding: "base64"
1130
+ };
1131
+ var HUBSPOT_CRM_EVENT = {
1132
+ service: "hubspot",
1133
+ operation: "crm_event",
1134
+ delivery: "webhook",
1135
+ 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.",
1136
+ verification: {
1137
+ signatureHeader: HUBSPOT_CRM_EVENT_SIGNATURE_HEADER,
1138
+ scheme: HUBSPOT_CRM_EVENT_SCHEME,
1139
+ timestampHeader: "X-HubSpot-Request-Timestamp"
1140
+ },
1141
+ route: { by: "portalId", path: "[].portalId" },
1142
+ faker: hubspotFaker
1143
+ };
1144
+
1145
+ // src/flow.ts
1146
+ var hubspotCompanyCreateExecutor = async (ctx) => {
1147
+ const config = ctx.node.data?.config ?? {};
1148
+ const result = await hubspotCompanyCreate({
1149
+ config,
1150
+ input: ctx.inputs?.in
1151
+ });
1152
+ ctx.emit({
1153
+ type: "log",
1154
+ level: "info",
1155
+ nodeId: ctx.node.id,
1156
+ message: `hubspot company_create ${result.data?.id} (${result.mode})`
1157
+ });
1158
+ return { __port: "out", value: result };
1159
+ };
1160
+ var hubspotCompanyGetExecutor = async (ctx) => {
1161
+ const config = ctx.node.data?.config ?? {};
1162
+ const result = await hubspotCompanyGet({
1163
+ config,
1164
+ input: ctx.inputs?.in
1165
+ });
1166
+ ctx.emit({
1167
+ type: "log",
1168
+ level: "info",
1169
+ nodeId: ctx.node.id,
1170
+ message: `hubspot company_get ${result.data?.id} (${result.mode})`
1171
+ });
1172
+ return { __port: "out", value: result };
1173
+ };
1174
+ var hubspotCompanyListExecutor = async (ctx) => {
1175
+ const config = ctx.node.data?.config ?? {};
1176
+ const result = await hubspotCompanyList({
1177
+ config,
1178
+ input: ctx.inputs?.in
1179
+ });
1180
+ ctx.emit({
1181
+ type: "log",
1182
+ level: "info",
1183
+ nodeId: ctx.node.id,
1184
+ message: `hubspot company_list ${result.data?.id} (${result.mode})`
1185
+ });
1186
+ return { __port: "out", value: result };
1187
+ };
1188
+ var hubspotCompanySearchExecutor = async (ctx) => {
1189
+ const config = ctx.node.data?.config ?? {};
1190
+ const result = await hubspotCompanySearch({
1191
+ config,
1192
+ input: ctx.inputs?.in
1193
+ });
1194
+ ctx.emit({
1195
+ type: "log",
1196
+ level: "info",
1197
+ nodeId: ctx.node.id,
1198
+ message: `hubspot company_search ${result.data?.id} (${result.mode})`
1199
+ });
1200
+ return { __port: "out", value: result };
1201
+ };
1202
+ var hubspotCompanyUpdateExecutor = async (ctx) => {
1203
+ const config = ctx.node.data?.config ?? {};
1204
+ const result = await hubspotCompanyUpdate({
1205
+ config,
1206
+ input: ctx.inputs?.in
1207
+ });
1208
+ ctx.emit({
1209
+ type: "log",
1210
+ level: "info",
1211
+ nodeId: ctx.node.id,
1212
+ message: `hubspot company_update ${result.data?.id} (${result.mode})`
1213
+ });
1214
+ return { __port: "out", value: result };
1215
+ };
1216
+ var hubspotContactCreateExecutor = async (ctx) => {
1217
+ const config = ctx.node.data?.config ?? {};
1218
+ const result = await hubspotContactCreate({
1219
+ config,
1220
+ input: ctx.inputs?.in
1221
+ });
1222
+ ctx.emit({
1223
+ type: "log",
1224
+ level: "info",
1225
+ nodeId: ctx.node.id,
1226
+ message: `hubspot contact_create ${result.data?.id} (${result.mode})`
1227
+ });
1228
+ return { __port: "out", value: result };
1229
+ };
1230
+ var hubspotContactGetExecutor = async (ctx) => {
1231
+ const config = ctx.node.data?.config ?? {};
1232
+ const result = await hubspotContactGet({
1233
+ config,
1234
+ input: ctx.inputs?.in
1235
+ });
1236
+ ctx.emit({
1237
+ type: "log",
1238
+ level: "info",
1239
+ nodeId: ctx.node.id,
1240
+ message: `hubspot contact_get ${result.data?.id} (${result.mode})`
1241
+ });
1242
+ return { __port: "out", value: result };
1243
+ };
1244
+ var hubspotContactListExecutor = async (ctx) => {
1245
+ const config = ctx.node.data?.config ?? {};
1246
+ const result = await hubspotContactList({
1247
+ config,
1248
+ input: ctx.inputs?.in
1249
+ });
1250
+ ctx.emit({
1251
+ type: "log",
1252
+ level: "info",
1253
+ nodeId: ctx.node.id,
1254
+ message: `hubspot contact_list ${result.data?.id} (${result.mode})`
1255
+ });
1256
+ return { __port: "out", value: result };
1257
+ };
1258
+ var hubspotContactSearchExecutor = async (ctx) => {
1259
+ const config = ctx.node.data?.config ?? {};
1260
+ const result = await hubspotContactSearch({
1261
+ config,
1262
+ input: ctx.inputs?.in
1263
+ });
1264
+ ctx.emit({
1265
+ type: "log",
1266
+ level: "info",
1267
+ nodeId: ctx.node.id,
1268
+ message: `hubspot contact_search ${result.data?.id} (${result.mode})`
1269
+ });
1270
+ return { __port: "out", value: result };
1271
+ };
1272
+ var hubspotContactUpdateExecutor = async (ctx) => {
1273
+ const config = ctx.node.data?.config ?? {};
1274
+ const result = await hubspotContactUpdate({
1275
+ config,
1276
+ input: ctx.inputs?.in
1277
+ });
1278
+ ctx.emit({
1279
+ type: "log",
1280
+ level: "info",
1281
+ nodeId: ctx.node.id,
1282
+ message: `hubspot contact_update ${result.data?.id} (${result.mode})`
1283
+ });
1284
+ return { __port: "out", value: result };
1285
+ };
1286
+ var hubspotDealCreateExecutor = async (ctx) => {
1287
+ const config = ctx.node.data?.config ?? {};
1288
+ const result = await hubspotDealCreate({
1289
+ config,
1290
+ input: ctx.inputs?.in
1291
+ });
1292
+ ctx.emit({
1293
+ type: "log",
1294
+ level: "info",
1295
+ nodeId: ctx.node.id,
1296
+ message: `hubspot deal_create ${result.data?.id} (${result.mode})`
1297
+ });
1298
+ return { __port: "out", value: result };
1299
+ };
1300
+ var hubspotDealGetExecutor = async (ctx) => {
1301
+ const config = ctx.node.data?.config ?? {};
1302
+ const result = await hubspotDealGet({
1303
+ config,
1304
+ input: ctx.inputs?.in
1305
+ });
1306
+ ctx.emit({
1307
+ type: "log",
1308
+ level: "info",
1309
+ nodeId: ctx.node.id,
1310
+ message: `hubspot deal_get ${result.data?.id} (${result.mode})`
1311
+ });
1312
+ return { __port: "out", value: result };
1313
+ };
1314
+ var hubspotDealListExecutor = async (ctx) => {
1315
+ const config = ctx.node.data?.config ?? {};
1316
+ const result = await hubspotDealList({
1317
+ config,
1318
+ input: ctx.inputs?.in
1319
+ });
1320
+ ctx.emit({
1321
+ type: "log",
1322
+ level: "info",
1323
+ nodeId: ctx.node.id,
1324
+ message: `hubspot deal_list ${result.data?.id} (${result.mode})`
1325
+ });
1326
+ return { __port: "out", value: result };
1327
+ };
1328
+ var hubspotDealSearchExecutor = async (ctx) => {
1329
+ const config = ctx.node.data?.config ?? {};
1330
+ const result = await hubspotDealSearch({
1331
+ config,
1332
+ input: ctx.inputs?.in
1333
+ });
1334
+ ctx.emit({
1335
+ type: "log",
1336
+ level: "info",
1337
+ nodeId: ctx.node.id,
1338
+ message: `hubspot deal_search ${result.data?.id} (${result.mode})`
1339
+ });
1340
+ return { __port: "out", value: result };
1341
+ };
1342
+ var hubspotDealUpdateExecutor = async (ctx) => {
1343
+ const config = ctx.node.data?.config ?? {};
1344
+ const result = await hubspotDealUpdate({
1345
+ config,
1346
+ input: ctx.inputs?.in
1347
+ });
1348
+ ctx.emit({
1349
+ type: "log",
1350
+ level: "info",
1351
+ nodeId: ctx.node.id,
1352
+ message: `hubspot deal_update ${result.data?.id} (${result.mode})`
1353
+ });
1354
+ return { __port: "out", value: result };
1355
+ };
1356
+ var hubspotOwnerListExecutor = async (ctx) => {
1357
+ const config = ctx.node.data?.config ?? {};
1358
+ const result = await hubspotOwnerList({
1359
+ config,
1360
+ input: ctx.inputs?.in
1361
+ });
1362
+ ctx.emit({
1363
+ type: "log",
1364
+ level: "info",
1365
+ nodeId: ctx.node.id,
1366
+ message: `hubspot owner_list ${result.data?.id} (${result.mode})`
1367
+ });
1368
+ return { __port: "out", value: result };
1369
+ };
1370
+ var hubspotPipelineListExecutor = async (ctx) => {
1371
+ const config = ctx.node.data?.config ?? {};
1372
+ const result = await hubspotPipelineList({
1373
+ config,
1374
+ input: ctx.inputs?.in
1375
+ });
1376
+ ctx.emit({
1377
+ type: "log",
1378
+ level: "info",
1379
+ nodeId: ctx.node.id,
1380
+ message: `hubspot pipeline_list ${result.data?.id} (${result.mode})`
1381
+ });
1382
+ return { __port: "out", value: result };
1383
+ };
1384
+ var hubspotPropertyListExecutor = async (ctx) => {
1385
+ const config = ctx.node.data?.config ?? {};
1386
+ const result = await hubspotPropertyList({
1387
+ config,
1388
+ input: ctx.inputs?.in
1389
+ });
1390
+ ctx.emit({
1391
+ type: "log",
1392
+ level: "info",
1393
+ nodeId: ctx.node.id,
1394
+ message: `hubspot property_list ${result.data?.id} (${result.mode})`
1395
+ });
1396
+ return { __port: "out", value: result };
1397
+ };
1398
+ var hubspotCrmEventTriggerExecutor = async (ctx) => {
1399
+ const config = ctx.node.data?.config ?? {};
1400
+ const connection = fancyConnectorCore.resolveConnection({
1401
+ service: HUBSPOT.service,
1402
+ operation: "crm_event",
1403
+ sandbox: HUBSPOT.sandbox,
1404
+ baseUrls: HUBSPOT.baseUrls,
1405
+ requires: HUBSPOT.requires,
1406
+ connectionId: typeof config.connection === "string" ? config.connection : null,
1407
+ requested: typeof config.mode === "string" ? config.mode : null
1408
+ });
1409
+ const event = fancyConnectorCore.triggerEvent(HUBSPOT_CRM_EVENT, connection, ctx.inputs?.in, config);
1410
+ return { __port: "out", value: event };
120
1411
  };
121
1412
  var HUBSPOT_RUNNABLE_KINDS = [
122
- { ...hubspotUi.hubspotContactCreateKind, executor: hubspotContactCreateExecutor }
1413
+ { ...hubspotUi.hubspotCompanyCreateKind, executor: hubspotCompanyCreateExecutor },
1414
+ { ...hubspotUi.hubspotCompanyGetKind, executor: hubspotCompanyGetExecutor },
1415
+ { ...hubspotUi.hubspotCompanyListKind, executor: hubspotCompanyListExecutor },
1416
+ { ...hubspotUi.hubspotCompanySearchKind, executor: hubspotCompanySearchExecutor },
1417
+ { ...hubspotUi.hubspotCompanyUpdateKind, executor: hubspotCompanyUpdateExecutor },
1418
+ { ...hubspotUi.hubspotContactCreateKind, executor: hubspotContactCreateExecutor },
1419
+ { ...hubspotUi.hubspotContactGetKind, executor: hubspotContactGetExecutor },
1420
+ { ...hubspotUi.hubspotContactListKind, executor: hubspotContactListExecutor },
1421
+ { ...hubspotUi.hubspotContactSearchKind, executor: hubspotContactSearchExecutor },
1422
+ { ...hubspotUi.hubspotContactUpdateKind, executor: hubspotContactUpdateExecutor },
1423
+ { ...hubspotUi.hubspotDealCreateKind, executor: hubspotDealCreateExecutor },
1424
+ { ...hubspotUi.hubspotDealGetKind, executor: hubspotDealGetExecutor },
1425
+ { ...hubspotUi.hubspotDealListKind, executor: hubspotDealListExecutor },
1426
+ { ...hubspotUi.hubspotDealSearchKind, executor: hubspotDealSearchExecutor },
1427
+ { ...hubspotUi.hubspotDealUpdateKind, executor: hubspotDealUpdateExecutor },
1428
+ { ...hubspotUi.hubspotOwnerListKind, executor: hubspotOwnerListExecutor },
1429
+ { ...hubspotUi.hubspotPipelineListKind, executor: hubspotPipelineListExecutor },
1430
+ { ...hubspotUi.hubspotPropertyListKind, executor: hubspotPropertyListExecutor },
1431
+ { ...hubspotUi.hubspotCrmEventTriggerKind, executor: hubspotCrmEventTriggerExecutor }
123
1432
  ];
124
1433
 
125
1434
  exports.HUBSPOT_RUNNABLE_KINDS = HUBSPOT_RUNNABLE_KINDS;
1435
+ exports.hubspotCompanyCreateExecutor = hubspotCompanyCreateExecutor;
1436
+ exports.hubspotCompanyGetExecutor = hubspotCompanyGetExecutor;
1437
+ exports.hubspotCompanyListExecutor = hubspotCompanyListExecutor;
1438
+ exports.hubspotCompanySearchExecutor = hubspotCompanySearchExecutor;
1439
+ exports.hubspotCompanyUpdateExecutor = hubspotCompanyUpdateExecutor;
126
1440
  exports.hubspotContactCreateExecutor = hubspotContactCreateExecutor;
1441
+ exports.hubspotContactGetExecutor = hubspotContactGetExecutor;
1442
+ exports.hubspotContactListExecutor = hubspotContactListExecutor;
1443
+ exports.hubspotContactSearchExecutor = hubspotContactSearchExecutor;
1444
+ exports.hubspotContactUpdateExecutor = hubspotContactUpdateExecutor;
1445
+ exports.hubspotCrmEventTriggerExecutor = hubspotCrmEventTriggerExecutor;
1446
+ exports.hubspotDealCreateExecutor = hubspotDealCreateExecutor;
1447
+ exports.hubspotDealGetExecutor = hubspotDealGetExecutor;
1448
+ exports.hubspotDealListExecutor = hubspotDealListExecutor;
1449
+ exports.hubspotDealSearchExecutor = hubspotDealSearchExecutor;
1450
+ exports.hubspotDealUpdateExecutor = hubspotDealUpdateExecutor;
1451
+ exports.hubspotOwnerListExecutor = hubspotOwnerListExecutor;
1452
+ exports.hubspotPipelineListExecutor = hubspotPipelineListExecutor;
1453
+ exports.hubspotPropertyListExecutor = hubspotPropertyListExecutor;
127
1454
  //# sourceMappingURL=flow.cjs.map
128
1455
  //# sourceMappingURL=flow.cjs.map