@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,20 +8,86 @@ export const quote_created_trigger = createTrigger({
8
8
  displayName: 'Quote Created',
9
9
  description: 'Triggered when a new quote 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
  status: Property.StaticMultiSelectDropdown({
27
93
  displayName: 'Filter by Status',
@@ -122,20 +188,86 @@ export const quote_updated_trigger = createTrigger({
122
188
  displayName: 'Quote Updated',
123
189
  description: 'Triggered when a quote is updated',
124
190
  props: {
125
- customer: Property.Array({
191
+ customer: Property.MultiSelectDropdown({
126
192
  displayName: 'Filter by Customer',
127
- description: 'Only trigger for specific customer IDs',
193
+ description: 'Only trigger for specific customer',
128
194
  required: false,
195
+ auth: workbuddyAuth,
196
+ refreshers: [],
197
+ options: async ({ auth }) => {
198
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
199
+ const token = await getAccessToken(authValue);
200
+ const baseUrl = authValue.props.baseUrl;
201
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
202
+ method: HttpMethod.GET,
203
+ url: `${baseUrl}/api/v2/public/customers`,
204
+ headers: {
205
+ Authorization: `Bearer ${token}`,
206
+ 'X-WorkBuddy-Version': '2026-01',
207
+ },
208
+ });
209
+ const items = response.body?.items || [];
210
+ return {
211
+ options: items.map((item) => ({
212
+ label: item.name,
213
+ value: item.id,
214
+ })),
215
+ };
216
+ },
129
217
  }),
130
- billingCompany: Property.Array({
218
+ billingCompany: Property.MultiSelectDropdown({
131
219
  displayName: 'Filter by Billing Company',
132
- description: 'Only trigger for specific billing company IDs',
220
+ description: 'Only trigger for specific billing company',
133
221
  required: false,
222
+ auth: workbuddyAuth,
223
+ refreshers: [],
224
+ options: async ({ auth }) => {
225
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
226
+ const token = await getAccessToken(authValue);
227
+ const baseUrl = authValue.props.baseUrl;
228
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
229
+ method: HttpMethod.GET,
230
+ url: `${baseUrl}/api/v2/public/companies`,
231
+ headers: {
232
+ Authorization: `Bearer ${token}`,
233
+ 'X-WorkBuddy-Version': '2026-01',
234
+ },
235
+ });
236
+ const items = response.body?.items || [];
237
+ return {
238
+ options: items.map((item) => ({
239
+ label: item.name,
240
+ value: item.id,
241
+ })),
242
+ };
243
+ },
134
244
  }),
135
- tag: Property.Array({
245
+ tag: Property.MultiSelectDropdown({
136
246
  displayName: 'Filter by Tags',
137
- description: 'Only trigger for specific tags IDs',
247
+ description: 'Only trigger for specific tags',
138
248
  required: false,
249
+ auth: workbuddyAuth,
250
+ refreshers: [],
251
+ options: async ({ auth }) => {
252
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
253
+ const token = await getAccessToken(authValue);
254
+ const baseUrl = authValue.props.baseUrl;
255
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
256
+ method: HttpMethod.GET,
257
+ url: `${baseUrl}/api/v2/public/settings/tags`,
258
+ headers: {
259
+ Authorization: `Bearer ${token}`,
260
+ 'X-WorkBuddy-Version': '2026-01',
261
+ },
262
+ });
263
+ const items = response.body?.items || [];
264
+ return {
265
+ options: items.map((item) => ({
266
+ label: item.name,
267
+ value: item.id,
268
+ })),
269
+ };
270
+ },
139
271
  }),
140
272
  status: Property.StaticMultiSelectDropdown({
141
273
  displayName: 'Filter by Status',
@@ -236,20 +368,86 @@ export const quote_status_changed_trigger = createTrigger({
236
368
  displayName: 'Quote Status Changed',
237
369
  description: 'Triggered when a quote status changes',
238
370
  props: {
239
- customer: Property.Array({
371
+ customer: Property.MultiSelectDropdown({
240
372
  displayName: 'Filter by Customer',
241
- description: 'Only trigger for specific customer IDs',
373
+ description: 'Only trigger for specific customer',
242
374
  required: false,
375
+ auth: workbuddyAuth,
376
+ refreshers: [],
377
+ options: async ({ auth }) => {
378
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
379
+ const token = await getAccessToken(authValue);
380
+ const baseUrl = authValue.props.baseUrl;
381
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
382
+ method: HttpMethod.GET,
383
+ url: `${baseUrl}/api/v2/public/customers`,
384
+ headers: {
385
+ Authorization: `Bearer ${token}`,
386
+ 'X-WorkBuddy-Version': '2026-01',
387
+ },
388
+ });
389
+ const items = response.body?.items || [];
390
+ return {
391
+ options: items.map((item) => ({
392
+ label: item.name,
393
+ value: item.id,
394
+ })),
395
+ };
396
+ },
243
397
  }),
244
- billingCompany: Property.Array({
398
+ billingCompany: Property.MultiSelectDropdown({
245
399
  displayName: 'Filter by Billing Company',
246
- description: 'Only trigger for specific billing company IDs',
400
+ description: 'Only trigger for specific billing company',
247
401
  required: false,
402
+ auth: workbuddyAuth,
403
+ refreshers: [],
404
+ options: async ({ auth }) => {
405
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
406
+ const token = await getAccessToken(authValue);
407
+ const baseUrl = authValue.props.baseUrl;
408
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
409
+ method: HttpMethod.GET,
410
+ url: `${baseUrl}/api/v2/public/companies`,
411
+ headers: {
412
+ Authorization: `Bearer ${token}`,
413
+ 'X-WorkBuddy-Version': '2026-01',
414
+ },
415
+ });
416
+ const items = response.body?.items || [];
417
+ return {
418
+ options: items.map((item) => ({
419
+ label: item.name,
420
+ value: item.id,
421
+ })),
422
+ };
423
+ },
248
424
  }),
249
- tag: Property.Array({
425
+ tag: Property.MultiSelectDropdown({
250
426
  displayName: 'Filter by Tags',
251
- description: 'Only trigger for specific tags IDs',
427
+ description: 'Only trigger for specific tags',
252
428
  required: false,
429
+ auth: workbuddyAuth,
430
+ refreshers: [],
431
+ options: async ({ auth }) => {
432
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
433
+ const token = await getAccessToken(authValue);
434
+ const baseUrl = authValue.props.baseUrl;
435
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
436
+ method: HttpMethod.GET,
437
+ url: `${baseUrl}/api/v2/public/settings/tags`,
438
+ headers: {
439
+ Authorization: `Bearer ${token}`,
440
+ 'X-WorkBuddy-Version': '2026-01',
441
+ },
442
+ });
443
+ const items = response.body?.items || [];
444
+ return {
445
+ options: items.map((item) => ({
446
+ label: item.name,
447
+ value: item.id,
448
+ })),
449
+ };
450
+ },
253
451
  }),
254
452
  status: Property.StaticMultiSelectDropdown({
255
453
  displayName: 'Filter by Status',
@@ -350,20 +548,86 @@ export const quote_deleted_trigger = createTrigger({
350
548
  displayName: 'Quote Deleted',
351
549
  description: 'Triggered when a quote is deleted',
352
550
  props: {
353
- customer: Property.Array({
551
+ customer: Property.MultiSelectDropdown({
354
552
  displayName: 'Filter by Customer',
355
- description: 'Only trigger for specific customer IDs',
553
+ description: 'Only trigger for specific customer',
356
554
  required: false,
555
+ auth: workbuddyAuth,
556
+ refreshers: [],
557
+ options: async ({ auth }) => {
558
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
559
+ const token = await getAccessToken(authValue);
560
+ const baseUrl = authValue.props.baseUrl;
561
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
562
+ method: HttpMethod.GET,
563
+ url: `${baseUrl}/api/v2/public/customers`,
564
+ headers: {
565
+ Authorization: `Bearer ${token}`,
566
+ 'X-WorkBuddy-Version': '2026-01',
567
+ },
568
+ });
569
+ const items = response.body?.items || [];
570
+ return {
571
+ options: items.map((item) => ({
572
+ label: item.name,
573
+ value: item.id,
574
+ })),
575
+ };
576
+ },
357
577
  }),
358
- billingCompany: Property.Array({
578
+ billingCompany: Property.MultiSelectDropdown({
359
579
  displayName: 'Filter by Billing Company',
360
- description: 'Only trigger for specific billing company IDs',
580
+ description: 'Only trigger for specific billing company',
361
581
  required: false,
582
+ auth: workbuddyAuth,
583
+ refreshers: [],
584
+ options: async ({ auth }) => {
585
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
586
+ const token = await getAccessToken(authValue);
587
+ const baseUrl = authValue.props.baseUrl;
588
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
589
+ method: HttpMethod.GET,
590
+ url: `${baseUrl}/api/v2/public/companies`,
591
+ headers: {
592
+ Authorization: `Bearer ${token}`,
593
+ 'X-WorkBuddy-Version': '2026-01',
594
+ },
595
+ });
596
+ const items = response.body?.items || [];
597
+ return {
598
+ options: items.map((item) => ({
599
+ label: item.name,
600
+ value: item.id,
601
+ })),
602
+ };
603
+ },
362
604
  }),
363
- tag: Property.Array({
605
+ tag: Property.MultiSelectDropdown({
364
606
  displayName: 'Filter by Tags',
365
- description: 'Only trigger for specific tags IDs',
607
+ description: 'Only trigger for specific tags',
366
608
  required: false,
609
+ auth: workbuddyAuth,
610
+ refreshers: [],
611
+ options: async ({ auth }) => {
612
+ const authValue = auth as unknown as { props: { baseUrl: string; clientId: string; clientSecret: string } };
613
+ const token = await getAccessToken(authValue);
614
+ const baseUrl = authValue.props.baseUrl;
615
+ const response = await httpClient.sendRequest<{ items: Array<{ id: string; name: string }> }>({
616
+ method: HttpMethod.GET,
617
+ url: `${baseUrl}/api/v2/public/settings/tags`,
618
+ headers: {
619
+ Authorization: `Bearer ${token}`,
620
+ 'X-WorkBuddy-Version': '2026-01',
621
+ },
622
+ });
623
+ const items = response.body?.items || [];
624
+ return {
625
+ options: items.map((item) => ({
626
+ label: item.name,
627
+ value: item.id,
628
+ })),
629
+ };
630
+ },
367
631
  }),
368
632
  status: Property.StaticMultiSelectDropdown({
369
633
  displayName: 'Filter by Status',