@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,45 +8,221 @@ export const job_created_trigger = createTrigger({
8
8
  displayName: 'Job Created',
9
9
  description: 'Triggered when a new job 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
- site: Property.Array({
92
+ site: Property.MultiSelectDropdown({
27
93
  displayName: 'Filter by Site',
28
- description: 'Only trigger for specific site IDs',
94
+ description: 'Only trigger for specific site',
29
95
  required: false,
96
+ auth: workbuddyAuth,
97
+ refreshers: [],
98
+ options: async ({ auth }) => {
99
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
100
+ const token = await getAccessToken(authValue);
101
+ const baseUrl = authValue.props.baseUrl;
102
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
103
+ method: HttpMethod.GET,
104
+ url: `${baseUrl}/api/v2/public/sites`,
105
+ headers: {
106
+ Authorization: `Bearer ${token}`,
107
+ 'X-WorkBuddy-Version': '2026-01',
108
+ },
109
+ });
110
+ const items = response.body?.items || [];
111
+ return {
112
+ options: items.map((item) => ({
113
+ label: item.name,
114
+ value: item.id,
115
+ })),
116
+ };
117
+ },
30
118
  }),
31
- type: Property.Array({
119
+ type: Property.MultiSelectDropdown({
32
120
  displayName: 'Filter by Job Type',
33
- description: 'Only trigger for specific job type IDs',
121
+ description: 'Only trigger for specific job type',
34
122
  required: false,
123
+ auth: workbuddyAuth,
124
+ refreshers: [],
125
+ options: async ({ auth }) => {
126
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
127
+ const token = await getAccessToken(authValue);
128
+ const baseUrl = authValue.props.baseUrl;
129
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
130
+ method: HttpMethod.GET,
131
+ url: `${baseUrl}/api/v2/public/settings/job-types`,
132
+ headers: {
133
+ Authorization: `Bearer ${token}`,
134
+ 'X-WorkBuddy-Version': '2026-01',
135
+ },
136
+ });
137
+ const items = response.body?.items || [];
138
+ return {
139
+ options: items.map((item) => ({
140
+ label: item.name,
141
+ value: item.id,
142
+ })),
143
+ };
144
+ },
35
145
  }),
36
- priority: Property.Array({
146
+ priority: Property.MultiSelectDropdown({
37
147
  displayName: 'Filter by Priority',
38
- description: 'Only trigger for specific priority IDs',
148
+ description: 'Only trigger for specific priority',
39
149
  required: false,
150
+ auth: workbuddyAuth,
151
+ refreshers: [],
152
+ options: async ({ auth }) => {
153
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
154
+ const token = await getAccessToken(authValue);
155
+ const baseUrl = authValue.props.baseUrl;
156
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
157
+ method: HttpMethod.GET,
158
+ url: `${baseUrl}/api/v2/public/settings/priorities`,
159
+ headers: {
160
+ Authorization: `Bearer ${token}`,
161
+ 'X-WorkBuddy-Version': '2026-01',
162
+ },
163
+ });
164
+ const items = response.body?.items || [];
165
+ return {
166
+ options: items.map((item) => ({
167
+ label: item.name,
168
+ value: item.id,
169
+ })),
170
+ };
171
+ },
40
172
  }),
41
- owner: Property.Array({
173
+ owner: Property.MultiSelectDropdown({
42
174
  displayName: 'Filter by Owner',
43
- description: 'Only trigger for specific owner IDs',
175
+ description: 'Only trigger for specific owner',
44
176
  required: false,
177
+ auth: workbuddyAuth,
178
+ refreshers: [],
179
+ options: async ({ auth }) => {
180
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
181
+ const token = await getAccessToken(authValue);
182
+ const baseUrl = authValue.props.baseUrl;
183
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
184
+ method: HttpMethod.GET,
185
+ url: `${baseUrl}/api/v2/public/employees`,
186
+ headers: {
187
+ Authorization: `Bearer ${token}`,
188
+ 'X-WorkBuddy-Version': '2026-01',
189
+ },
190
+ });
191
+ const items = response.body?.items || [];
192
+ return {
193
+ options: items.map((item) => ({
194
+ label: item.name,
195
+ value: item.id,
196
+ })),
197
+ };
198
+ },
45
199
  }),
46
- zone: Property.Array({
200
+ zone: Property.MultiSelectDropdown({
47
201
  displayName: 'Filter by Zone',
48
- description: 'Only trigger for specific zone IDs',
202
+ description: 'Only trigger for specific zone',
49
203
  required: false,
204
+ auth: workbuddyAuth,
205
+ refreshers: [],
206
+ options: async ({ auth }) => {
207
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
208
+ const token = await getAccessToken(authValue);
209
+ const baseUrl = authValue.props.baseUrl;
210
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
211
+ method: HttpMethod.GET,
212
+ url: `${baseUrl}/api/v2/public/settings/zones`,
213
+ headers: {
214
+ Authorization: `Bearer ${token}`,
215
+ 'X-WorkBuddy-Version': '2026-01',
216
+ },
217
+ });
218
+ const items = response.body?.items || [];
219
+ return {
220
+ options: items.map((item) => ({
221
+ label: item.name,
222
+ value: item.id,
223
+ })),
224
+ };
225
+ },
50
226
  }),
51
227
  status: Property.StaticMultiSelectDropdown({
52
228
  displayName: 'Filter by Status',
@@ -175,45 +351,221 @@ export const job_updated_trigger = createTrigger({
175
351
  displayName: 'Job Updated',
176
352
  description: 'Triggered when a job is updated',
177
353
  props: {
178
- customer: Property.Array({
354
+ customer: Property.MultiSelectDropdown({
179
355
  displayName: 'Filter by Customer',
180
- description: 'Only trigger for specific customer IDs',
356
+ description: 'Only trigger for specific customer',
181
357
  required: false,
358
+ auth: workbuddyAuth,
359
+ refreshers: [],
360
+ options: async ({ auth }) => {
361
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
362
+ const token = await getAccessToken(authValue);
363
+ const baseUrl = authValue.props.baseUrl;
364
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
365
+ method: HttpMethod.GET,
366
+ url: `${baseUrl}/api/v2/public/customers`,
367
+ headers: {
368
+ Authorization: `Bearer ${token}`,
369
+ 'X-WorkBuddy-Version': '2026-01',
370
+ },
371
+ });
372
+ const items = response.body?.items || [];
373
+ return {
374
+ options: items.map((item) => ({
375
+ label: item.name,
376
+ value: item.id,
377
+ })),
378
+ };
379
+ },
182
380
  }),
183
- billingCompany: Property.Array({
381
+ billingCompany: Property.MultiSelectDropdown({
184
382
  displayName: 'Filter by Billing Company',
185
- description: 'Only trigger for specific billing company IDs',
383
+ description: 'Only trigger for specific billing company',
186
384
  required: false,
385
+ auth: workbuddyAuth,
386
+ refreshers: [],
387
+ options: async ({ auth }) => {
388
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
389
+ const token = await getAccessToken(authValue);
390
+ const baseUrl = authValue.props.baseUrl;
391
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
392
+ method: HttpMethod.GET,
393
+ url: `${baseUrl}/api/v2/public/companies`,
394
+ headers: {
395
+ Authorization: `Bearer ${token}`,
396
+ 'X-WorkBuddy-Version': '2026-01',
397
+ },
398
+ });
399
+ const items = response.body?.items || [];
400
+ return {
401
+ options: items.map((item) => ({
402
+ label: item.name,
403
+ value: item.id,
404
+ })),
405
+ };
406
+ },
187
407
  }),
188
- tag: Property.Array({
408
+ tag: Property.MultiSelectDropdown({
189
409
  displayName: 'Filter by Tags',
190
- description: 'Only trigger for specific tags IDs',
410
+ description: 'Only trigger for specific tags',
191
411
  required: false,
412
+ auth: workbuddyAuth,
413
+ refreshers: [],
414
+ options: async ({ auth }) => {
415
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
416
+ const token = await getAccessToken(authValue);
417
+ const baseUrl = authValue.props.baseUrl;
418
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
419
+ method: HttpMethod.GET,
420
+ url: `${baseUrl}/api/v2/public/settings/tags`,
421
+ headers: {
422
+ Authorization: `Bearer ${token}`,
423
+ 'X-WorkBuddy-Version': '2026-01',
424
+ },
425
+ });
426
+ const items = response.body?.items || [];
427
+ return {
428
+ options: items.map((item) => ({
429
+ label: item.name,
430
+ value: item.id,
431
+ })),
432
+ };
433
+ },
192
434
  }),
193
- site: Property.Array({
435
+ site: Property.MultiSelectDropdown({
194
436
  displayName: 'Filter by Site',
195
- description: 'Only trigger for specific site IDs',
437
+ description: 'Only trigger for specific site',
196
438
  required: false,
439
+ auth: workbuddyAuth,
440
+ refreshers: [],
441
+ options: async ({ auth }) => {
442
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
443
+ const token = await getAccessToken(authValue);
444
+ const baseUrl = authValue.props.baseUrl;
445
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
446
+ method: HttpMethod.GET,
447
+ url: `${baseUrl}/api/v2/public/sites`,
448
+ headers: {
449
+ Authorization: `Bearer ${token}`,
450
+ 'X-WorkBuddy-Version': '2026-01',
451
+ },
452
+ });
453
+ const items = response.body?.items || [];
454
+ return {
455
+ options: items.map((item) => ({
456
+ label: item.name,
457
+ value: item.id,
458
+ })),
459
+ };
460
+ },
197
461
  }),
198
- type: Property.Array({
462
+ type: Property.MultiSelectDropdown({
199
463
  displayName: 'Filter by Job Type',
200
- description: 'Only trigger for specific job type IDs',
464
+ description: 'Only trigger for specific job type',
201
465
  required: false,
466
+ auth: workbuddyAuth,
467
+ refreshers: [],
468
+ options: async ({ auth }) => {
469
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
470
+ const token = await getAccessToken(authValue);
471
+ const baseUrl = authValue.props.baseUrl;
472
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
473
+ method: HttpMethod.GET,
474
+ url: `${baseUrl}/api/v2/public/settings/job-types`,
475
+ headers: {
476
+ Authorization: `Bearer ${token}`,
477
+ 'X-WorkBuddy-Version': '2026-01',
478
+ },
479
+ });
480
+ const items = response.body?.items || [];
481
+ return {
482
+ options: items.map((item) => ({
483
+ label: item.name,
484
+ value: item.id,
485
+ })),
486
+ };
487
+ },
202
488
  }),
203
- priority: Property.Array({
489
+ priority: Property.MultiSelectDropdown({
204
490
  displayName: 'Filter by Priority',
205
- description: 'Only trigger for specific priority IDs',
491
+ description: 'Only trigger for specific priority',
206
492
  required: false,
493
+ auth: workbuddyAuth,
494
+ refreshers: [],
495
+ options: async ({ auth }) => {
496
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
497
+ const token = await getAccessToken(authValue);
498
+ const baseUrl = authValue.props.baseUrl;
499
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
500
+ method: HttpMethod.GET,
501
+ url: `${baseUrl}/api/v2/public/settings/priorities`,
502
+ headers: {
503
+ Authorization: `Bearer ${token}`,
504
+ 'X-WorkBuddy-Version': '2026-01',
505
+ },
506
+ });
507
+ const items = response.body?.items || [];
508
+ return {
509
+ options: items.map((item) => ({
510
+ label: item.name,
511
+ value: item.id,
512
+ })),
513
+ };
514
+ },
207
515
  }),
208
- owner: Property.Array({
516
+ owner: Property.MultiSelectDropdown({
209
517
  displayName: 'Filter by Owner',
210
- description: 'Only trigger for specific owner IDs',
518
+ description: 'Only trigger for specific owner',
211
519
  required: false,
520
+ auth: workbuddyAuth,
521
+ refreshers: [],
522
+ options: async ({ auth }) => {
523
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
524
+ const token = await getAccessToken(authValue);
525
+ const baseUrl = authValue.props.baseUrl;
526
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
527
+ method: HttpMethod.GET,
528
+ url: `${baseUrl}/api/v2/public/employees`,
529
+ headers: {
530
+ Authorization: `Bearer ${token}`,
531
+ 'X-WorkBuddy-Version': '2026-01',
532
+ },
533
+ });
534
+ const items = response.body?.items || [];
535
+ return {
536
+ options: items.map((item) => ({
537
+ label: item.name,
538
+ value: item.id,
539
+ })),
540
+ };
541
+ },
212
542
  }),
213
- zone: Property.Array({
543
+ zone: Property.MultiSelectDropdown({
214
544
  displayName: 'Filter by Zone',
215
- description: 'Only trigger for specific zone IDs',
545
+ description: 'Only trigger for specific zone',
216
546
  required: false,
547
+ auth: workbuddyAuth,
548
+ refreshers: [],
549
+ options: async ({ auth }) => {
550
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
551
+ const token = await getAccessToken(authValue);
552
+ const baseUrl = authValue.props.baseUrl;
553
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
554
+ method: HttpMethod.GET,
555
+ url: `${baseUrl}/api/v2/public/settings/zones`,
556
+ headers: {
557
+ Authorization: `Bearer ${token}`,
558
+ 'X-WorkBuddy-Version': '2026-01',
559
+ },
560
+ });
561
+ const items = response.body?.items || [];
562
+ return {
563
+ options: items.map((item) => ({
564
+ label: item.name,
565
+ value: item.id,
566
+ })),
567
+ };
568
+ },
217
569
  }),
218
570
  status: Property.StaticMultiSelectDropdown({
219
571
  displayName: 'Filter by Status',
@@ -342,45 +694,221 @@ export const job_status_changed_trigger = createTrigger({
342
694
  displayName: 'Job Status Changed',
343
695
  description: 'Triggered when a job status changes',
344
696
  props: {
345
- customer: Property.Array({
697
+ customer: Property.MultiSelectDropdown({
346
698
  displayName: 'Filter by Customer',
347
- description: 'Only trigger for specific customer IDs',
699
+ description: 'Only trigger for specific customer',
348
700
  required: false,
701
+ auth: workbuddyAuth,
702
+ refreshers: [],
703
+ options: async ({ auth }) => {
704
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
705
+ const token = await getAccessToken(authValue);
706
+ const baseUrl = authValue.props.baseUrl;
707
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
708
+ method: HttpMethod.GET,
709
+ url: `${baseUrl}/api/v2/public/customers`,
710
+ headers: {
711
+ Authorization: `Bearer ${token}`,
712
+ 'X-WorkBuddy-Version': '2026-01',
713
+ },
714
+ });
715
+ const items = response.body?.items || [];
716
+ return {
717
+ options: items.map((item) => ({
718
+ label: item.name,
719
+ value: item.id,
720
+ })),
721
+ };
722
+ },
349
723
  }),
350
- billingCompany: Property.Array({
724
+ billingCompany: Property.MultiSelectDropdown({
351
725
  displayName: 'Filter by Billing Company',
352
- description: 'Only trigger for specific billing company IDs',
726
+ description: 'Only trigger for specific billing company',
353
727
  required: false,
728
+ auth: workbuddyAuth,
729
+ refreshers: [],
730
+ options: async ({ auth }) => {
731
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
732
+ const token = await getAccessToken(authValue);
733
+ const baseUrl = authValue.props.baseUrl;
734
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
735
+ method: HttpMethod.GET,
736
+ url: `${baseUrl}/api/v2/public/companies`,
737
+ headers: {
738
+ Authorization: `Bearer ${token}`,
739
+ 'X-WorkBuddy-Version': '2026-01',
740
+ },
741
+ });
742
+ const items = response.body?.items || [];
743
+ return {
744
+ options: items.map((item) => ({
745
+ label: item.name,
746
+ value: item.id,
747
+ })),
748
+ };
749
+ },
354
750
  }),
355
- tag: Property.Array({
751
+ tag: Property.MultiSelectDropdown({
356
752
  displayName: 'Filter by Tags',
357
- description: 'Only trigger for specific tags IDs',
753
+ description: 'Only trigger for specific tags',
358
754
  required: false,
755
+ auth: workbuddyAuth,
756
+ refreshers: [],
757
+ options: async ({ auth }) => {
758
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
759
+ const token = await getAccessToken(authValue);
760
+ const baseUrl = authValue.props.baseUrl;
761
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
762
+ method: HttpMethod.GET,
763
+ url: `${baseUrl}/api/v2/public/settings/tags`,
764
+ headers: {
765
+ Authorization: `Bearer ${token}`,
766
+ 'X-WorkBuddy-Version': '2026-01',
767
+ },
768
+ });
769
+ const items = response.body?.items || [];
770
+ return {
771
+ options: items.map((item) => ({
772
+ label: item.name,
773
+ value: item.id,
774
+ })),
775
+ };
776
+ },
359
777
  }),
360
- site: Property.Array({
778
+ site: Property.MultiSelectDropdown({
361
779
  displayName: 'Filter by Site',
362
- description: 'Only trigger for specific site IDs',
780
+ description: 'Only trigger for specific site',
363
781
  required: false,
782
+ auth: workbuddyAuth,
783
+ refreshers: [],
784
+ options: async ({ auth }) => {
785
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
786
+ const token = await getAccessToken(authValue);
787
+ const baseUrl = authValue.props.baseUrl;
788
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
789
+ method: HttpMethod.GET,
790
+ url: `${baseUrl}/api/v2/public/sites`,
791
+ headers: {
792
+ Authorization: `Bearer ${token}`,
793
+ 'X-WorkBuddy-Version': '2026-01',
794
+ },
795
+ });
796
+ const items = response.body?.items || [];
797
+ return {
798
+ options: items.map((item) => ({
799
+ label: item.name,
800
+ value: item.id,
801
+ })),
802
+ };
803
+ },
364
804
  }),
365
- type: Property.Array({
805
+ type: Property.MultiSelectDropdown({
366
806
  displayName: 'Filter by Job Type',
367
- description: 'Only trigger for specific job type IDs',
807
+ description: 'Only trigger for specific job type',
368
808
  required: false,
809
+ auth: workbuddyAuth,
810
+ refreshers: [],
811
+ options: async ({ auth }) => {
812
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
813
+ const token = await getAccessToken(authValue);
814
+ const baseUrl = authValue.props.baseUrl;
815
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
816
+ method: HttpMethod.GET,
817
+ url: `${baseUrl}/api/v2/public/settings/job-types`,
818
+ headers: {
819
+ Authorization: `Bearer ${token}`,
820
+ 'X-WorkBuddy-Version': '2026-01',
821
+ },
822
+ });
823
+ const items = response.body?.items || [];
824
+ return {
825
+ options: items.map((item) => ({
826
+ label: item.name,
827
+ value: item.id,
828
+ })),
829
+ };
830
+ },
369
831
  }),
370
- priority: Property.Array({
832
+ priority: Property.MultiSelectDropdown({
371
833
  displayName: 'Filter by Priority',
372
- description: 'Only trigger for specific priority IDs',
834
+ description: 'Only trigger for specific priority',
373
835
  required: false,
836
+ auth: workbuddyAuth,
837
+ refreshers: [],
838
+ options: async ({ auth }) => {
839
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
840
+ const token = await getAccessToken(authValue);
841
+ const baseUrl = authValue.props.baseUrl;
842
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
843
+ method: HttpMethod.GET,
844
+ url: `${baseUrl}/api/v2/public/settings/priorities`,
845
+ headers: {
846
+ Authorization: `Bearer ${token}`,
847
+ 'X-WorkBuddy-Version': '2026-01',
848
+ },
849
+ });
850
+ const items = response.body?.items || [];
851
+ return {
852
+ options: items.map((item) => ({
853
+ label: item.name,
854
+ value: item.id,
855
+ })),
856
+ };
857
+ },
374
858
  }),
375
- owner: Property.Array({
859
+ owner: Property.MultiSelectDropdown({
376
860
  displayName: 'Filter by Owner',
377
- description: 'Only trigger for specific owner IDs',
861
+ description: 'Only trigger for specific owner',
378
862
  required: false,
863
+ auth: workbuddyAuth,
864
+ refreshers: [],
865
+ options: async ({ auth }) => {
866
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
867
+ const token = await getAccessToken(authValue);
868
+ const baseUrl = authValue.props.baseUrl;
869
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
870
+ method: HttpMethod.GET,
871
+ url: `${baseUrl}/api/v2/public/employees`,
872
+ headers: {
873
+ Authorization: `Bearer ${token}`,
874
+ 'X-WorkBuddy-Version': '2026-01',
875
+ },
876
+ });
877
+ const items = response.body?.items || [];
878
+ return {
879
+ options: items.map((item) => ({
880
+ label: item.name,
881
+ value: item.id,
882
+ })),
883
+ };
884
+ },
379
885
  }),
380
- zone: Property.Array({
886
+ zone: Property.MultiSelectDropdown({
381
887
  displayName: 'Filter by Zone',
382
- description: 'Only trigger for specific zone IDs',
888
+ description: 'Only trigger for specific zone',
383
889
  required: false,
890
+ auth: workbuddyAuth,
891
+ refreshers: [],
892
+ options: async ({ auth }) => {
893
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
894
+ const token = await getAccessToken(authValue);
895
+ const baseUrl = authValue.props.baseUrl;
896
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
897
+ method: HttpMethod.GET,
898
+ url: `${baseUrl}/api/v2/public/settings/zones`,
899
+ headers: {
900
+ Authorization: `Bearer ${token}`,
901
+ 'X-WorkBuddy-Version': '2026-01',
902
+ },
903
+ });
904
+ const items = response.body?.items || [];
905
+ return {
906
+ options: items.map((item) => ({
907
+ label: item.name,
908
+ value: item.id,
909
+ })),
910
+ };
911
+ },
384
912
  }),
385
913
  status: Property.StaticMultiSelectDropdown({
386
914
  displayName: 'Filter by Status',
@@ -509,45 +1037,221 @@ export const job_deleted_trigger = createTrigger({
509
1037
  displayName: 'Job Deleted',
510
1038
  description: 'Triggered when a job is deleted',
511
1039
  props: {
512
- customer: Property.Array({
1040
+ customer: Property.MultiSelectDropdown({
513
1041
  displayName: 'Filter by Customer',
514
- description: 'Only trigger for specific customer IDs',
1042
+ description: 'Only trigger for specific customer',
515
1043
  required: false,
1044
+ auth: workbuddyAuth,
1045
+ refreshers: [],
1046
+ options: async ({ auth }) => {
1047
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
1048
+ const token = await getAccessToken(authValue);
1049
+ const baseUrl = authValue.props.baseUrl;
1050
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
1051
+ method: HttpMethod.GET,
1052
+ url: `${baseUrl}/api/v2/public/customers`,
1053
+ headers: {
1054
+ Authorization: `Bearer ${token}`,
1055
+ 'X-WorkBuddy-Version': '2026-01',
1056
+ },
1057
+ });
1058
+ const items = response.body?.items || [];
1059
+ return {
1060
+ options: items.map((item) => ({
1061
+ label: item.name,
1062
+ value: item.id,
1063
+ })),
1064
+ };
1065
+ },
516
1066
  }),
517
- billingCompany: Property.Array({
1067
+ billingCompany: Property.MultiSelectDropdown({
518
1068
  displayName: 'Filter by Billing Company',
519
- description: 'Only trigger for specific billing company IDs',
1069
+ description: 'Only trigger for specific billing company',
520
1070
  required: false,
1071
+ auth: workbuddyAuth,
1072
+ refreshers: [],
1073
+ options: async ({ auth }) => {
1074
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
1075
+ const token = await getAccessToken(authValue);
1076
+ const baseUrl = authValue.props.baseUrl;
1077
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
1078
+ method: HttpMethod.GET,
1079
+ url: `${baseUrl}/api/v2/public/companies`,
1080
+ headers: {
1081
+ Authorization: `Bearer ${token}`,
1082
+ 'X-WorkBuddy-Version': '2026-01',
1083
+ },
1084
+ });
1085
+ const items = response.body?.items || [];
1086
+ return {
1087
+ options: items.map((item) => ({
1088
+ label: item.name,
1089
+ value: item.id,
1090
+ })),
1091
+ };
1092
+ },
521
1093
  }),
522
- tag: Property.Array({
1094
+ tag: Property.MultiSelectDropdown({
523
1095
  displayName: 'Filter by Tags',
524
- description: 'Only trigger for specific tags IDs',
1096
+ description: 'Only trigger for specific tags',
525
1097
  required: false,
1098
+ auth: workbuddyAuth,
1099
+ refreshers: [],
1100
+ options: async ({ auth }) => {
1101
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
1102
+ const token = await getAccessToken(authValue);
1103
+ const baseUrl = authValue.props.baseUrl;
1104
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
1105
+ method: HttpMethod.GET,
1106
+ url: `${baseUrl}/api/v2/public/settings/tags`,
1107
+ headers: {
1108
+ Authorization: `Bearer ${token}`,
1109
+ 'X-WorkBuddy-Version': '2026-01',
1110
+ },
1111
+ });
1112
+ const items = response.body?.items || [];
1113
+ return {
1114
+ options: items.map((item) => ({
1115
+ label: item.name,
1116
+ value: item.id,
1117
+ })),
1118
+ };
1119
+ },
526
1120
  }),
527
- site: Property.Array({
1121
+ site: Property.MultiSelectDropdown({
528
1122
  displayName: 'Filter by Site',
529
- description: 'Only trigger for specific site IDs',
1123
+ description: 'Only trigger for specific site',
530
1124
  required: false,
1125
+ auth: workbuddyAuth,
1126
+ refreshers: [],
1127
+ options: async ({ auth }) => {
1128
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
1129
+ const token = await getAccessToken(authValue);
1130
+ const baseUrl = authValue.props.baseUrl;
1131
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
1132
+ method: HttpMethod.GET,
1133
+ url: `${baseUrl}/api/v2/public/sites`,
1134
+ headers: {
1135
+ Authorization: `Bearer ${token}`,
1136
+ 'X-WorkBuddy-Version': '2026-01',
1137
+ },
1138
+ });
1139
+ const items = response.body?.items || [];
1140
+ return {
1141
+ options: items.map((item) => ({
1142
+ label: item.name,
1143
+ value: item.id,
1144
+ })),
1145
+ };
1146
+ },
531
1147
  }),
532
- type: Property.Array({
1148
+ type: Property.MultiSelectDropdown({
533
1149
  displayName: 'Filter by Job Type',
534
- description: 'Only trigger for specific job type IDs',
1150
+ description: 'Only trigger for specific job type',
535
1151
  required: false,
1152
+ auth: workbuddyAuth,
1153
+ refreshers: [],
1154
+ options: async ({ auth }) => {
1155
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
1156
+ const token = await getAccessToken(authValue);
1157
+ const baseUrl = authValue.props.baseUrl;
1158
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
1159
+ method: HttpMethod.GET,
1160
+ url: `${baseUrl}/api/v2/public/settings/job-types`,
1161
+ headers: {
1162
+ Authorization: `Bearer ${token}`,
1163
+ 'X-WorkBuddy-Version': '2026-01',
1164
+ },
1165
+ });
1166
+ const items = response.body?.items || [];
1167
+ return {
1168
+ options: items.map((item) => ({
1169
+ label: item.name,
1170
+ value: item.id,
1171
+ })),
1172
+ };
1173
+ },
536
1174
  }),
537
- priority: Property.Array({
1175
+ priority: Property.MultiSelectDropdown({
538
1176
  displayName: 'Filter by Priority',
539
- description: 'Only trigger for specific priority IDs',
1177
+ description: 'Only trigger for specific priority',
540
1178
  required: false,
1179
+ auth: workbuddyAuth,
1180
+ refreshers: [],
1181
+ options: async ({ auth }) => {
1182
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
1183
+ const token = await getAccessToken(authValue);
1184
+ const baseUrl = authValue.props.baseUrl;
1185
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
1186
+ method: HttpMethod.GET,
1187
+ url: `${baseUrl}/api/v2/public/settings/priorities`,
1188
+ headers: {
1189
+ Authorization: `Bearer ${token}`,
1190
+ 'X-WorkBuddy-Version': '2026-01',
1191
+ },
1192
+ });
1193
+ const items = response.body?.items || [];
1194
+ return {
1195
+ options: items.map((item) => ({
1196
+ label: item.name,
1197
+ value: item.id,
1198
+ })),
1199
+ };
1200
+ },
541
1201
  }),
542
- owner: Property.Array({
1202
+ owner: Property.MultiSelectDropdown({
543
1203
  displayName: 'Filter by Owner',
544
- description: 'Only trigger for specific owner IDs',
1204
+ description: 'Only trigger for specific owner',
545
1205
  required: false,
1206
+ auth: workbuddyAuth,
1207
+ refreshers: [],
1208
+ options: async ({ auth }) => {
1209
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
1210
+ const token = await getAccessToken(authValue);
1211
+ const baseUrl = authValue.props.baseUrl;
1212
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
1213
+ method: HttpMethod.GET,
1214
+ url: `${baseUrl}/api/v2/public/employees`,
1215
+ headers: {
1216
+ Authorization: `Bearer ${token}`,
1217
+ 'X-WorkBuddy-Version': '2026-01',
1218
+ },
1219
+ });
1220
+ const items = response.body?.items || [];
1221
+ return {
1222
+ options: items.map((item) => ({
1223
+ label: item.name,
1224
+ value: item.id,
1225
+ })),
1226
+ };
1227
+ },
546
1228
  }),
547
- zone: Property.Array({
1229
+ zone: Property.MultiSelectDropdown({
548
1230
  displayName: 'Filter by Zone',
549
- description: 'Only trigger for specific zone IDs',
1231
+ description: 'Only trigger for specific zone',
550
1232
  required: false,
1233
+ auth: workbuddyAuth,
1234
+ refreshers: [],
1235
+ options: async ({ auth }) => {
1236
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
1237
+ const token = await getAccessToken(authValue);
1238
+ const baseUrl = authValue.props.baseUrl;
1239
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
1240
+ method: HttpMethod.GET,
1241
+ url: `${baseUrl}/api/v2/public/settings/zones`,
1242
+ headers: {
1243
+ Authorization: `Bearer ${token}`,
1244
+ 'X-WorkBuddy-Version': '2026-01',
1245
+ },
1246
+ });
1247
+ const items = response.body?.items || [];
1248
+ return {
1249
+ options: items.map((item) => ({
1250
+ label: item.name,
1251
+ value: item.id,
1252
+ })),
1253
+ };
1254
+ },
551
1255
  }),
552
1256
  status: Property.StaticMultiSelectDropdown({
553
1257
  displayName: 'Filter by Status',