@workbuddy/piece-workbuddy-edge 1.0.5 → 1.0.7

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.
Files changed (44) hide show
  1. package/package.json +1 -1
  2. package/src/lib/auth.js +2 -2
  3. package/src/lib/auth.js.map +1 -1
  4. package/src/lib/auth.ts +2 -2
  5. package/src/lib/triggers/bill.d.ts +240 -48
  6. package/src/lib/triggers/bill.d.ts.map +1 -1
  7. package/src/lib/triggers/bill.js +288 -24
  8. package/src/lib/triggers/bill.js.map +1 -1
  9. package/src/lib/triggers/bill.ts +288 -24
  10. package/src/lib/triggers/invoice.d.ts +240 -48
  11. package/src/lib/triggers/invoice.d.ts.map +1 -1
  12. package/src/lib/triggers/invoice.js +288 -24
  13. package/src/lib/triggers/invoice.js.map +1 -1
  14. package/src/lib/triggers/invoice.ts +288 -24
  15. package/src/lib/triggers/job.d.ts +640 -128
  16. package/src/lib/triggers/job.d.ts.map +1 -1
  17. package/src/lib/triggers/job.js +768 -64
  18. package/src/lib/triggers/job.js.map +1 -1
  19. package/src/lib/triggers/job.ts +768 -64
  20. package/src/lib/triggers/lead.d.ts +400 -80
  21. package/src/lib/triggers/lead.d.ts.map +1 -1
  22. package/src/lib/triggers/lead.js +480 -40
  23. package/src/lib/triggers/lead.js.map +1 -1
  24. package/src/lib/triggers/lead.ts +480 -40
  25. package/src/lib/triggers/opportunity.d.ts +320 -64
  26. package/src/lib/triggers/opportunity.d.ts.map +1 -1
  27. package/src/lib/triggers/opportunity.js +384 -32
  28. package/src/lib/triggers/opportunity.js.map +1 -1
  29. package/src/lib/triggers/opportunity.ts +384 -32
  30. package/src/lib/triggers/quote.d.ts +240 -48
  31. package/src/lib/triggers/quote.d.ts.map +1 -1
  32. package/src/lib/triggers/quote.js +288 -24
  33. package/src/lib/triggers/quote.js.map +1 -1
  34. package/src/lib/triggers/quote.ts +288 -24
  35. package/src/lib/triggers/stage.d.ts +480 -96
  36. package/src/lib/triggers/stage.d.ts.map +1 -1
  37. package/src/lib/triggers/stage.js +576 -48
  38. package/src/lib/triggers/stage.js.map +1 -1
  39. package/src/lib/triggers/stage.ts +576 -48
  40. package/src/lib/triggers/task.d.ts +80 -16
  41. package/src/lib/triggers/task.d.ts.map +1 -1
  42. package/src/lib/triggers/task.js +96 -8
  43. package/src/lib/triggers/task.js.map +1 -1
  44. package/src/lib/triggers/task.ts +96 -8
@@ -8,30 +8,118 @@ export const opportunity_created_trigger = createTrigger({
8
8
  displayName: 'Opportunity Created',
9
9
  description: 'Triggered when a new opportunity is created',
10
10
  props: {
11
- customer: Property.Array({
11
+ customer: Property.MultiSelectDropdown({
12
12
  displayName: 'Filter by Customer',
13
- description: 'Only trigger for specific customer IDs',
13
+ description: 'Only trigger for specific customer',
14
14
  required: false,
15
+ auth: workbuddyAuth,
16
+ refreshers: [],
17
+ options: async ({ auth }) => {
18
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
19
+ const token = await getAccessToken(authValue);
20
+ const baseUrl = authValue.props.baseUrl;
21
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
22
+ method: HttpMethod.GET,
23
+ url: `${baseUrl}/api/v2/public/customers`,
24
+ headers: {
25
+ Authorization: `Bearer ${token}`,
26
+ 'X-WorkBuddy-Version': '2026-01',
27
+ },
28
+ });
29
+ const items = response.body?.items || [];
30
+ return {
31
+ options: items.map((item) => ({
32
+ label: item.name,
33
+ value: item.id,
34
+ })),
35
+ };
36
+ },
15
37
  }),
16
- billingCompany: Property.Array({
38
+ billingCompany: Property.MultiSelectDropdown({
17
39
  displayName: 'Filter by Billing Company',
18
- description: 'Only trigger for specific billing company IDs',
40
+ description: 'Only trigger for specific billing company',
19
41
  required: false,
42
+ auth: workbuddyAuth,
43
+ refreshers: [],
44
+ options: async ({ auth }) => {
45
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
46
+ const token = await getAccessToken(authValue);
47
+ const baseUrl = authValue.props.baseUrl;
48
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
49
+ method: HttpMethod.GET,
50
+ url: `${baseUrl}/api/v2/public/companies`,
51
+ headers: {
52
+ Authorization: `Bearer ${token}`,
53
+ 'X-WorkBuddy-Version': '2026-01',
54
+ },
55
+ });
56
+ const items = response.body?.items || [];
57
+ return {
58
+ options: items.map((item) => ({
59
+ label: item.name,
60
+ value: item.id,
61
+ })),
62
+ };
63
+ },
20
64
  }),
21
- tag: Property.Array({
65
+ tag: Property.MultiSelectDropdown({
22
66
  displayName: 'Filter by Tags',
23
- description: 'Only trigger for specific tags IDs',
67
+ description: 'Only trigger for specific tags',
24
68
  required: false,
69
+ auth: workbuddyAuth,
70
+ refreshers: [],
71
+ options: async ({ auth }) => {
72
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
73
+ const token = await getAccessToken(authValue);
74
+ const baseUrl = authValue.props.baseUrl;
75
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
76
+ method: HttpMethod.GET,
77
+ url: `${baseUrl}/api/v2/public/settings/tags`,
78
+ headers: {
79
+ Authorization: `Bearer ${token}`,
80
+ 'X-WorkBuddy-Version': '2026-01',
81
+ },
82
+ });
83
+ const items = response.body?.items || [];
84
+ return {
85
+ options: items.map((item) => ({
86
+ label: item.name,
87
+ value: item.id,
88
+ })),
89
+ };
90
+ },
25
91
  }),
26
92
  opportunityStage: Property.Array({
27
93
  displayName: 'Filter by Stage',
28
94
  description: 'Only trigger for specific stage IDs',
29
95
  required: false,
30
96
  }),
31
- owner: Property.Array({
97
+ owner: Property.MultiSelectDropdown({
32
98
  displayName: 'Filter by Owner',
33
- description: 'Only trigger for specific owner IDs',
99
+ description: 'Only trigger for specific owner',
34
100
  required: false,
101
+ auth: workbuddyAuth,
102
+ refreshers: [],
103
+ options: async ({ auth }) => {
104
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
105
+ const token = await getAccessToken(authValue);
106
+ const baseUrl = authValue.props.baseUrl;
107
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
108
+ method: HttpMethod.GET,
109
+ url: `${baseUrl}/api/v2/public/employees`,
110
+ headers: {
111
+ Authorization: `Bearer ${token}`,
112
+ 'X-WorkBuddy-Version': '2026-01',
113
+ },
114
+ });
115
+ const items = response.body?.items || [];
116
+ return {
117
+ options: items.map((item) => ({
118
+ label: item.name,
119
+ value: item.id,
120
+ })),
121
+ };
122
+ },
35
123
  }),
36
124
  },
37
125
  sampleData: {
@@ -117,30 +205,118 @@ export const opportunity_updated_trigger = createTrigger({
117
205
  displayName: 'Opportunity Updated',
118
206
  description: 'Triggered when an opportunity is updated',
119
207
  props: {
120
- customer: Property.Array({
208
+ customer: Property.MultiSelectDropdown({
121
209
  displayName: 'Filter by Customer',
122
- description: 'Only trigger for specific customer IDs',
210
+ description: 'Only trigger for specific customer',
123
211
  required: false,
212
+ auth: workbuddyAuth,
213
+ refreshers: [],
214
+ options: async ({ auth }) => {
215
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
216
+ const token = await getAccessToken(authValue);
217
+ const baseUrl = authValue.props.baseUrl;
218
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
219
+ method: HttpMethod.GET,
220
+ url: `${baseUrl}/api/v2/public/customers`,
221
+ headers: {
222
+ Authorization: `Bearer ${token}`,
223
+ 'X-WorkBuddy-Version': '2026-01',
224
+ },
225
+ });
226
+ const items = response.body?.items || [];
227
+ return {
228
+ options: items.map((item) => ({
229
+ label: item.name,
230
+ value: item.id,
231
+ })),
232
+ };
233
+ },
124
234
  }),
125
- billingCompany: Property.Array({
235
+ billingCompany: Property.MultiSelectDropdown({
126
236
  displayName: 'Filter by Billing Company',
127
- description: 'Only trigger for specific billing company IDs',
237
+ description: 'Only trigger for specific billing company',
128
238
  required: false,
239
+ auth: workbuddyAuth,
240
+ refreshers: [],
241
+ options: async ({ auth }) => {
242
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
243
+ const token = await getAccessToken(authValue);
244
+ const baseUrl = authValue.props.baseUrl;
245
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
246
+ method: HttpMethod.GET,
247
+ url: `${baseUrl}/api/v2/public/companies`,
248
+ headers: {
249
+ Authorization: `Bearer ${token}`,
250
+ 'X-WorkBuddy-Version': '2026-01',
251
+ },
252
+ });
253
+ const items = response.body?.items || [];
254
+ return {
255
+ options: items.map((item) => ({
256
+ label: item.name,
257
+ value: item.id,
258
+ })),
259
+ };
260
+ },
129
261
  }),
130
- tag: Property.Array({
262
+ tag: Property.MultiSelectDropdown({
131
263
  displayName: 'Filter by Tags',
132
- description: 'Only trigger for specific tags IDs',
264
+ description: 'Only trigger for specific tags',
133
265
  required: false,
266
+ auth: workbuddyAuth,
267
+ refreshers: [],
268
+ options: async ({ auth }) => {
269
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
270
+ const token = await getAccessToken(authValue);
271
+ const baseUrl = authValue.props.baseUrl;
272
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
273
+ method: HttpMethod.GET,
274
+ url: `${baseUrl}/api/v2/public/settings/tags`,
275
+ headers: {
276
+ Authorization: `Bearer ${token}`,
277
+ 'X-WorkBuddy-Version': '2026-01',
278
+ },
279
+ });
280
+ const items = response.body?.items || [];
281
+ return {
282
+ options: items.map((item) => ({
283
+ label: item.name,
284
+ value: item.id,
285
+ })),
286
+ };
287
+ },
134
288
  }),
135
289
  opportunityStage: Property.Array({
136
290
  displayName: 'Filter by Stage',
137
291
  description: 'Only trigger for specific stage IDs',
138
292
  required: false,
139
293
  }),
140
- owner: Property.Array({
294
+ owner: Property.MultiSelectDropdown({
141
295
  displayName: 'Filter by Owner',
142
- description: 'Only trigger for specific owner IDs',
296
+ description: 'Only trigger for specific owner',
143
297
  required: false,
298
+ auth: workbuddyAuth,
299
+ refreshers: [],
300
+ options: async ({ auth }) => {
301
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
302
+ const token = await getAccessToken(authValue);
303
+ const baseUrl = authValue.props.baseUrl;
304
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
305
+ method: HttpMethod.GET,
306
+ url: `${baseUrl}/api/v2/public/employees`,
307
+ headers: {
308
+ Authorization: `Bearer ${token}`,
309
+ 'X-WorkBuddy-Version': '2026-01',
310
+ },
311
+ });
312
+ const items = response.body?.items || [];
313
+ return {
314
+ options: items.map((item) => ({
315
+ label: item.name,
316
+ value: item.id,
317
+ })),
318
+ };
319
+ },
144
320
  }),
145
321
  },
146
322
  sampleData: {
@@ -226,30 +402,118 @@ export const opportunity_status_changed_trigger = createTrigger({
226
402
  displayName: 'Opportunity Status Changed',
227
403
  description: 'Triggered when an opportunity status changes',
228
404
  props: {
229
- customer: Property.Array({
405
+ customer: Property.MultiSelectDropdown({
230
406
  displayName: 'Filter by Customer',
231
- description: 'Only trigger for specific customer IDs',
407
+ description: 'Only trigger for specific customer',
232
408
  required: false,
409
+ auth: workbuddyAuth,
410
+ refreshers: [],
411
+ options: async ({ auth }) => {
412
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
413
+ const token = await getAccessToken(authValue);
414
+ const baseUrl = authValue.props.baseUrl;
415
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
416
+ method: HttpMethod.GET,
417
+ url: `${baseUrl}/api/v2/public/customers`,
418
+ headers: {
419
+ Authorization: `Bearer ${token}`,
420
+ 'X-WorkBuddy-Version': '2026-01',
421
+ },
422
+ });
423
+ const items = response.body?.items || [];
424
+ return {
425
+ options: items.map((item) => ({
426
+ label: item.name,
427
+ value: item.id,
428
+ })),
429
+ };
430
+ },
233
431
  }),
234
- billingCompany: Property.Array({
432
+ billingCompany: Property.MultiSelectDropdown({
235
433
  displayName: 'Filter by Billing Company',
236
- description: 'Only trigger for specific billing company IDs',
434
+ description: 'Only trigger for specific billing company',
237
435
  required: false,
436
+ auth: workbuddyAuth,
437
+ refreshers: [],
438
+ options: async ({ auth }) => {
439
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
440
+ const token = await getAccessToken(authValue);
441
+ const baseUrl = authValue.props.baseUrl;
442
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
443
+ method: HttpMethod.GET,
444
+ url: `${baseUrl}/api/v2/public/companies`,
445
+ headers: {
446
+ Authorization: `Bearer ${token}`,
447
+ 'X-WorkBuddy-Version': '2026-01',
448
+ },
449
+ });
450
+ const items = response.body?.items || [];
451
+ return {
452
+ options: items.map((item) => ({
453
+ label: item.name,
454
+ value: item.id,
455
+ })),
456
+ };
457
+ },
238
458
  }),
239
- tag: Property.Array({
459
+ tag: Property.MultiSelectDropdown({
240
460
  displayName: 'Filter by Tags',
241
- description: 'Only trigger for specific tags IDs',
461
+ description: 'Only trigger for specific tags',
242
462
  required: false,
463
+ auth: workbuddyAuth,
464
+ refreshers: [],
465
+ options: async ({ auth }) => {
466
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
467
+ const token = await getAccessToken(authValue);
468
+ const baseUrl = authValue.props.baseUrl;
469
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
470
+ method: HttpMethod.GET,
471
+ url: `${baseUrl}/api/v2/public/settings/tags`,
472
+ headers: {
473
+ Authorization: `Bearer ${token}`,
474
+ 'X-WorkBuddy-Version': '2026-01',
475
+ },
476
+ });
477
+ const items = response.body?.items || [];
478
+ return {
479
+ options: items.map((item) => ({
480
+ label: item.name,
481
+ value: item.id,
482
+ })),
483
+ };
484
+ },
243
485
  }),
244
486
  opportunityStage: Property.Array({
245
487
  displayName: 'Filter by Stage',
246
488
  description: 'Only trigger for specific stage IDs',
247
489
  required: false,
248
490
  }),
249
- owner: Property.Array({
491
+ owner: Property.MultiSelectDropdown({
250
492
  displayName: 'Filter by Owner',
251
- description: 'Only trigger for specific owner IDs',
493
+ description: 'Only trigger for specific owner',
252
494
  required: false,
495
+ auth: workbuddyAuth,
496
+ refreshers: [],
497
+ options: async ({ auth }) => {
498
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
499
+ const token = await getAccessToken(authValue);
500
+ const baseUrl = authValue.props.baseUrl;
501
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
502
+ method: HttpMethod.GET,
503
+ url: `${baseUrl}/api/v2/public/employees`,
504
+ headers: {
505
+ Authorization: `Bearer ${token}`,
506
+ 'X-WorkBuddy-Version': '2026-01',
507
+ },
508
+ });
509
+ const items = response.body?.items || [];
510
+ return {
511
+ options: items.map((item) => ({
512
+ label: item.name,
513
+ value: item.id,
514
+ })),
515
+ };
516
+ },
253
517
  }),
254
518
  },
255
519
  sampleData: {
@@ -335,30 +599,118 @@ export const opportunity_deleted_trigger = createTrigger({
335
599
  displayName: 'Opportunity Deleted',
336
600
  description: 'Triggered when an opportunity is deleted',
337
601
  props: {
338
- customer: Property.Array({
602
+ customer: Property.MultiSelectDropdown({
339
603
  displayName: 'Filter by Customer',
340
- description: 'Only trigger for specific customer IDs',
604
+ description: 'Only trigger for specific customer',
341
605
  required: false,
606
+ auth: workbuddyAuth,
607
+ refreshers: [],
608
+ options: async ({ auth }) => {
609
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
610
+ const token = await getAccessToken(authValue);
611
+ const baseUrl = authValue.props.baseUrl;
612
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
613
+ method: HttpMethod.GET,
614
+ url: `${baseUrl}/api/v2/public/customers`,
615
+ headers: {
616
+ Authorization: `Bearer ${token}`,
617
+ 'X-WorkBuddy-Version': '2026-01',
618
+ },
619
+ });
620
+ const items = response.body?.items || [];
621
+ return {
622
+ options: items.map((item) => ({
623
+ label: item.name,
624
+ value: item.id,
625
+ })),
626
+ };
627
+ },
342
628
  }),
343
- billingCompany: Property.Array({
629
+ billingCompany: Property.MultiSelectDropdown({
344
630
  displayName: 'Filter by Billing Company',
345
- description: 'Only trigger for specific billing company IDs',
631
+ description: 'Only trigger for specific billing company',
346
632
  required: false,
633
+ auth: workbuddyAuth,
634
+ refreshers: [],
635
+ options: async ({ auth }) => {
636
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
637
+ const token = await getAccessToken(authValue);
638
+ const baseUrl = authValue.props.baseUrl;
639
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
640
+ method: HttpMethod.GET,
641
+ url: `${baseUrl}/api/v2/public/companies`,
642
+ headers: {
643
+ Authorization: `Bearer ${token}`,
644
+ 'X-WorkBuddy-Version': '2026-01',
645
+ },
646
+ });
647
+ const items = response.body?.items || [];
648
+ return {
649
+ options: items.map((item) => ({
650
+ label: item.name,
651
+ value: item.id,
652
+ })),
653
+ };
654
+ },
347
655
  }),
348
- tag: Property.Array({
656
+ tag: Property.MultiSelectDropdown({
349
657
  displayName: 'Filter by Tags',
350
- description: 'Only trigger for specific tags IDs',
658
+ description: 'Only trigger for specific tags',
351
659
  required: false,
660
+ auth: workbuddyAuth,
661
+ refreshers: [],
662
+ options: async ({ auth }) => {
663
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
664
+ const token = await getAccessToken(authValue);
665
+ const baseUrl = authValue.props.baseUrl;
666
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
667
+ method: HttpMethod.GET,
668
+ url: `${baseUrl}/api/v2/public/settings/tags`,
669
+ headers: {
670
+ Authorization: `Bearer ${token}`,
671
+ 'X-WorkBuddy-Version': '2026-01',
672
+ },
673
+ });
674
+ const items = response.body?.items || [];
675
+ return {
676
+ options: items.map((item) => ({
677
+ label: item.name,
678
+ value: item.id,
679
+ })),
680
+ };
681
+ },
352
682
  }),
353
683
  opportunityStage: Property.Array({
354
684
  displayName: 'Filter by Stage',
355
685
  description: 'Only trigger for specific stage IDs',
356
686
  required: false,
357
687
  }),
358
- owner: Property.Array({
688
+ owner: Property.MultiSelectDropdown({
359
689
  displayName: 'Filter by Owner',
360
- description: 'Only trigger for specific owner IDs',
690
+ description: 'Only trigger for specific owner',
361
691
  required: false,
692
+ auth: workbuddyAuth,
693
+ refreshers: [],
694
+ options: async ({ auth }) => {
695
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
696
+ const token = await getAccessToken(authValue);
697
+ const baseUrl = authValue.props.baseUrl;
698
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
699
+ method: HttpMethod.GET,
700
+ url: `${baseUrl}/api/v2/public/employees`,
701
+ headers: {
702
+ Authorization: `Bearer ${token}`,
703
+ 'X-WorkBuddy-Version': '2026-01',
704
+ },
705
+ });
706
+ const items = response.body?.items || [];
707
+ return {
708
+ options: items.map((item) => ({
709
+ label: item.name,
710
+ value: item.id,
711
+ })),
712
+ };
713
+ },
362
714
  }),
363
715
  },
364
716
  sampleData: {