@workbuddy/piece-workbuddy-edge 1.0.10 → 1.0.12
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/package.json +1 -1
- package/src/lib/actions/agents.d.ts.map +1 -1
- package/src/lib/actions/agents.js +4 -2
- package/src/lib/actions/agents.js.map +1 -1
- package/src/lib/actions/agents.ts +6 -2
- package/src/lib/actions/attachments.d.ts.map +1 -1
- package/src/lib/actions/attachments.js +2 -1
- package/src/lib/actions/attachments.js.map +1 -1
- package/src/lib/actions/attachments.ts +3 -1
- package/src/lib/actions/jobs-activities.d.ts.map +1 -1
- package/src/lib/actions/jobs-activities.js +18 -13
- package/src/lib/actions/jobs-activities.js.map +1 -1
- package/src/lib/actions/jobs-activities.ts +23 -13
- package/src/lib/actions/jobs-files.js +4 -4
- package/src/lib/actions/jobs-files.js.map +1 -1
- package/src/lib/actions/jobs-files.ts +4 -4
- package/src/lib/actions/jobs-tasks.d.ts.map +1 -1
- package/src/lib/actions/jobs-tasks.js +10 -8
- package/src/lib/actions/jobs-tasks.js.map +1 -1
- package/src/lib/actions/jobs-tasks.ts +13 -8
- package/src/lib/actions/jobs.d.ts.map +1 -1
- package/src/lib/actions/jobs.js +4 -2
- package/src/lib/actions/jobs.js.map +1 -1
- package/src/lib/actions/jobs.ts +7 -2
- package/src/lib/actions/mcp.d.ts.map +1 -1
- package/src/lib/actions/mcp.js +2 -1
- package/src/lib/actions/mcp.js.map +1 -1
- package/src/lib/actions/mcp.ts +3 -1
- package/src/lib/actions/stages-activities.d.ts.map +1 -1
- package/src/lib/actions/stages-activities.js +18 -13
- package/src/lib/actions/stages-activities.js.map +1 -1
- package/src/lib/actions/stages-activities.ts +23 -13
- package/src/lib/actions/stages-files.js +4 -4
- package/src/lib/actions/stages-files.js.map +1 -1
- package/src/lib/actions/stages-files.ts +4 -4
- package/src/lib/actions/stages-resources.d.ts.map +1 -1
- package/src/lib/actions/stages-resources.js +4 -2
- package/src/lib/actions/stages-resources.js.map +1 -1
- package/src/lib/actions/stages-resources.ts +6 -2
- package/src/lib/actions/stages-tasks.d.ts.map +1 -1
- package/src/lib/actions/stages-tasks.js +10 -8
- package/src/lib/actions/stages-tasks.js.map +1 -1
- package/src/lib/actions/stages-tasks.ts +13 -8
- package/src/lib/actions/stages.d.ts +6 -2
- package/src/lib/actions/stages.d.ts.map +1 -1
- package/src/lib/actions/stages.js +61 -11
- package/src/lib/actions/stages.js.map +1 -1
- package/src/lib/actions/stages.ts +72 -11
- package/src/lib/actions/webhooks-v2.js +9 -9
- package/src/lib/actions/webhooks-v2.js.map +1 -1
- package/src/lib/actions/webhooks-v2.ts +9 -9
- package/src/lib/triggers/activity.d.ts.map +1 -1
- package/src/lib/triggers/activity.js +54 -42
- package/src/lib/triggers/activity.js.map +1 -1
- package/src/lib/triggers/activity.ts +54 -42
- package/src/lib/triggers/bill.d.ts.map +1 -1
- package/src/lib/triggers/bill.js +80 -64
- package/src/lib/triggers/bill.js.map +1 -1
- package/src/lib/triggers/bill.ts +80 -64
- package/src/lib/triggers/invoice.d.ts.map +1 -1
- package/src/lib/triggers/invoice.js +80 -64
- package/src/lib/triggers/invoice.js.map +1 -1
- package/src/lib/triggers/invoice.ts +80 -64
- package/src/lib/triggers/job.d.ts.map +1 -1
- package/src/lib/triggers/job.js +160 -144
- package/src/lib/triggers/job.js.map +1 -1
- package/src/lib/triggers/job.ts +160 -144
- package/src/lib/triggers/lead.d.ts.map +1 -1
- package/src/lib/triggers/lead.js +72 -56
- package/src/lib/triggers/lead.js.map +1 -1
- package/src/lib/triggers/lead.ts +72 -56
- package/src/lib/triggers/opportunity.d.ts.map +1 -1
- package/src/lib/triggers/opportunity.js +72 -56
- package/src/lib/triggers/opportunity.js.map +1 -1
- package/src/lib/triggers/opportunity.ts +72 -56
- package/src/lib/triggers/quote.d.ts.map +1 -1
- package/src/lib/triggers/quote.js +80 -64
- package/src/lib/triggers/quote.js.map +1 -1
- package/src/lib/triggers/quote.ts +80 -64
- package/src/lib/triggers/stage.d.ts.map +1 -1
- package/src/lib/triggers/stage.js +188 -172
- package/src/lib/triggers/stage.js.map +1 -1
- package/src/lib/triggers/stage.ts +188 -172
- package/src/lib/triggers/task.d.ts.map +1 -1
- package/src/lib/triggers/task.js +76 -60
- package/src/lib/triggers/task.js.map +1 -1
- package/src/lib/triggers/task.ts +76 -60
package/src/lib/triggers/job.ts
CHANGED
|
@@ -240,39 +240,46 @@ export const job_created_trigger = createTrigger({
|
|
|
240
240
|
}),
|
|
241
241
|
},
|
|
242
242
|
sampleData: {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
createdAt: '2026-03-05T10:00:00.000Z',
|
|
251
|
-
updatedAt: '2026-03-05T10:00:00.000Z',
|
|
252
|
-
startDate: '2026-03-05T10:00:00.000Z',
|
|
253
|
-
dueDate: '2026-03-15T10:00:00.000Z',
|
|
254
|
-
completedDate: null,
|
|
255
|
-
customer: { id: '507f1f77bcf86cd799439011', name: 'Acme Corp' },
|
|
256
|
-
customerPO: 'PO-1234',
|
|
257
|
-
customerWO: 'WO-5678',
|
|
258
|
-
owner: { id: '507f1f77bcf86cd799439011', name: 'John Smith' },
|
|
259
|
-
labels: [{ id: '507f1f77bcf86cd799439011', name: 'Urgent' }],
|
|
260
|
-
zones: [{ id: '507f1f77bcf86cd799439011', name: 'North' }],
|
|
261
|
-
site: {
|
|
243
|
+
id: 'whd_019ceacb-232b-764f-8dfd-748e1a226de2',
|
|
244
|
+
event: 'Job Created',
|
|
245
|
+
action: 'create',
|
|
246
|
+
createdAt: '2026-03-14T05:21:47.307Z',
|
|
247
|
+
webhookTimestamp: 1773465707307,
|
|
248
|
+
data: {
|
|
249
|
+
job: {
|
|
262
250
|
id: '507f1f77bcf86cd799439011',
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
251
|
+
mode: 'job',
|
|
252
|
+
jobNumber: 'J10001',
|
|
253
|
+
description: 'Sample job description',
|
|
254
|
+
status: 'Open',
|
|
255
|
+
source: 'web',
|
|
256
|
+
createdAt: '2026-03-05T10:00:00.000Z',
|
|
257
|
+
updatedAt: '2026-03-05T10:00:00.000Z',
|
|
258
|
+
startDate: '2026-03-05T10:00:00.000Z',
|
|
259
|
+
dueDate: '2026-03-15T10:00:00.000Z',
|
|
260
|
+
completedDate: null,
|
|
261
|
+
customer: { id: '507f1f77bcf86cd799439011', name: 'Acme Corp' },
|
|
262
|
+
customerPO: 'PO-1234',
|
|
263
|
+
customerWO: 'WO-5678',
|
|
264
|
+
owner: { id: '507f1f77bcf86cd799439011', name: 'John Smith' },
|
|
265
|
+
labels: [{ id: '507f1f77bcf86cd799439011', name: 'Urgent' }],
|
|
266
|
+
zones: [{ id: '507f1f77bcf86cd799439011', name: 'North' }],
|
|
267
|
+
site: {
|
|
268
|
+
id: '507f1f77bcf86cd799439011',
|
|
269
|
+
name: 'Main Office',
|
|
270
|
+
address: {
|
|
271
|
+
street: '123 Main St',
|
|
272
|
+
suburb: 'Sydney',
|
|
273
|
+
state: 'NSW',
|
|
274
|
+
postcode: '2000',
|
|
275
|
+
country: 'Australia',
|
|
276
|
+
formatted: '123 Main St, Sydney NSW 2000',
|
|
277
|
+
},
|
|
271
278
|
},
|
|
279
|
+
priority: { id: '507f1f77bcf86cd799439011', name: 'High' },
|
|
280
|
+
type: { id: '507f1f77bcf86cd799439011', name: 'Maintenance' },
|
|
281
|
+
billingCompany: { id: '507f1f77bcf86cd799439011', name: 'Acme Corp' },
|
|
272
282
|
},
|
|
273
|
-
priority: { id: '507f1f77bcf86cd799439011', name: 'High' },
|
|
274
|
-
type: { id: '507f1f77bcf86cd799439011', name: 'Maintenance' },
|
|
275
|
-
billingCompany: { id: '507f1f77bcf86cd799439011', name: 'Acme Corp' },
|
|
276
283
|
},
|
|
277
284
|
},
|
|
278
285
|
type: TriggerStrategy.WEBHOOK,
|
|
@@ -292,7 +299,7 @@ export const job_created_trigger = createTrigger({
|
|
|
292
299
|
if (context.propsValue.owner?.length) filters.owner = context.propsValue.owner;
|
|
293
300
|
if (context.propsValue.zone?.length) filters.zone = context.propsValue.zone;
|
|
294
301
|
if (context.propsValue.status?.length) filters.status = context.propsValue.status.map((v: string) => JSON.parse(v));
|
|
295
|
-
// Register webhook with WorkBuddy v2 API
|
|
302
|
+
// Register webhook with WorkBuddy v2 API
|
|
296
303
|
const response = await httpClient.sendRequest<{ data: { id: string } }>({
|
|
297
304
|
method: HttpMethod.POST,
|
|
298
305
|
url: `${baseUrl}/api/v2/public/webhooks`,
|
|
@@ -324,18 +331,15 @@ export const job_created_trigger = createTrigger({
|
|
|
324
331
|
const webhookId = await context.store.get<string>('webhookId');
|
|
325
332
|
|
|
326
333
|
if (webhookId) {
|
|
327
|
-
//
|
|
334
|
+
// Delete webhook to avoid stale subscriptions causing duplicate trigger deliveries
|
|
328
335
|
await httpClient.sendRequest({
|
|
329
|
-
method: HttpMethod.
|
|
336
|
+
method: HttpMethod.DELETE,
|
|
330
337
|
url: `${baseUrl}/api/v2/public/webhooks/${webhookId}`,
|
|
331
338
|
headers: {
|
|
332
339
|
Authorization: `Bearer ${token}`,
|
|
333
340
|
'Content-Type': 'application/json',
|
|
334
341
|
'X-WorkBuddy-Version': '2026-01',
|
|
335
342
|
},
|
|
336
|
-
body: {
|
|
337
|
-
status: 'paused',
|
|
338
|
-
},
|
|
339
343
|
});
|
|
340
344
|
}
|
|
341
345
|
},
|
|
@@ -583,39 +587,46 @@ export const job_updated_trigger = createTrigger({
|
|
|
583
587
|
}),
|
|
584
588
|
},
|
|
585
589
|
sampleData: {
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
createdAt: '2026-03-05T10:00:00.000Z',
|
|
594
|
-
updatedAt: '2026-03-05T10:00:00.000Z',
|
|
595
|
-
startDate: '2026-03-05T10:00:00.000Z',
|
|
596
|
-
dueDate: '2026-03-15T10:00:00.000Z',
|
|
597
|
-
completedDate: null,
|
|
598
|
-
customer: { id: '507f1f77bcf86cd799439011', name: 'Acme Corp' },
|
|
599
|
-
customerPO: 'PO-1234',
|
|
600
|
-
customerWO: 'WO-5678',
|
|
601
|
-
owner: { id: '507f1f77bcf86cd799439011', name: 'John Smith' },
|
|
602
|
-
labels: [{ id: '507f1f77bcf86cd799439011', name: 'Urgent' }],
|
|
603
|
-
zones: [{ id: '507f1f77bcf86cd799439011', name: 'North' }],
|
|
604
|
-
site: {
|
|
590
|
+
id: 'whd_019ceacb-232b-764f-8dfd-748e1a226de2',
|
|
591
|
+
event: 'Job Updated',
|
|
592
|
+
action: 'update',
|
|
593
|
+
createdAt: '2026-03-14T05:21:47.307Z',
|
|
594
|
+
webhookTimestamp: 1773465707307,
|
|
595
|
+
data: {
|
|
596
|
+
job: {
|
|
605
597
|
id: '507f1f77bcf86cd799439011',
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
598
|
+
mode: 'job',
|
|
599
|
+
jobNumber: 'J10001',
|
|
600
|
+
description: 'Sample job description',
|
|
601
|
+
status: 'Open',
|
|
602
|
+
source: 'web',
|
|
603
|
+
createdAt: '2026-03-05T10:00:00.000Z',
|
|
604
|
+
updatedAt: '2026-03-05T10:00:00.000Z',
|
|
605
|
+
startDate: '2026-03-05T10:00:00.000Z',
|
|
606
|
+
dueDate: '2026-03-15T10:00:00.000Z',
|
|
607
|
+
completedDate: null,
|
|
608
|
+
customer: { id: '507f1f77bcf86cd799439011', name: 'Acme Corp' },
|
|
609
|
+
customerPO: 'PO-1234',
|
|
610
|
+
customerWO: 'WO-5678',
|
|
611
|
+
owner: { id: '507f1f77bcf86cd799439011', name: 'John Smith' },
|
|
612
|
+
labels: [{ id: '507f1f77bcf86cd799439011', name: 'Urgent' }],
|
|
613
|
+
zones: [{ id: '507f1f77bcf86cd799439011', name: 'North' }],
|
|
614
|
+
site: {
|
|
615
|
+
id: '507f1f77bcf86cd799439011',
|
|
616
|
+
name: 'Main Office',
|
|
617
|
+
address: {
|
|
618
|
+
street: '123 Main St',
|
|
619
|
+
suburb: 'Sydney',
|
|
620
|
+
state: 'NSW',
|
|
621
|
+
postcode: '2000',
|
|
622
|
+
country: 'Australia',
|
|
623
|
+
formatted: '123 Main St, Sydney NSW 2000',
|
|
624
|
+
},
|
|
614
625
|
},
|
|
626
|
+
priority: { id: '507f1f77bcf86cd799439011', name: 'High' },
|
|
627
|
+
type: { id: '507f1f77bcf86cd799439011', name: 'Maintenance' },
|
|
628
|
+
billingCompany: { id: '507f1f77bcf86cd799439011', name: 'Acme Corp' },
|
|
615
629
|
},
|
|
616
|
-
priority: { id: '507f1f77bcf86cd799439011', name: 'High' },
|
|
617
|
-
type: { id: '507f1f77bcf86cd799439011', name: 'Maintenance' },
|
|
618
|
-
billingCompany: { id: '507f1f77bcf86cd799439011', name: 'Acme Corp' },
|
|
619
630
|
},
|
|
620
631
|
},
|
|
621
632
|
type: TriggerStrategy.WEBHOOK,
|
|
@@ -635,7 +646,7 @@ export const job_updated_trigger = createTrigger({
|
|
|
635
646
|
if (context.propsValue.owner?.length) filters.owner = context.propsValue.owner;
|
|
636
647
|
if (context.propsValue.zone?.length) filters.zone = context.propsValue.zone;
|
|
637
648
|
if (context.propsValue.status?.length) filters.status = context.propsValue.status.map((v: string) => JSON.parse(v));
|
|
638
|
-
// Register webhook with WorkBuddy v2 API
|
|
649
|
+
// Register webhook with WorkBuddy v2 API
|
|
639
650
|
const response = await httpClient.sendRequest<{ data: { id: string } }>({
|
|
640
651
|
method: HttpMethod.POST,
|
|
641
652
|
url: `${baseUrl}/api/v2/public/webhooks`,
|
|
@@ -667,18 +678,15 @@ export const job_updated_trigger = createTrigger({
|
|
|
667
678
|
const webhookId = await context.store.get<string>('webhookId');
|
|
668
679
|
|
|
669
680
|
if (webhookId) {
|
|
670
|
-
//
|
|
681
|
+
// Delete webhook to avoid stale subscriptions causing duplicate trigger deliveries
|
|
671
682
|
await httpClient.sendRequest({
|
|
672
|
-
method: HttpMethod.
|
|
683
|
+
method: HttpMethod.DELETE,
|
|
673
684
|
url: `${baseUrl}/api/v2/public/webhooks/${webhookId}`,
|
|
674
685
|
headers: {
|
|
675
686
|
Authorization: `Bearer ${token}`,
|
|
676
687
|
'Content-Type': 'application/json',
|
|
677
688
|
'X-WorkBuddy-Version': '2026-01',
|
|
678
689
|
},
|
|
679
|
-
body: {
|
|
680
|
-
status: 'paused',
|
|
681
|
-
},
|
|
682
690
|
});
|
|
683
691
|
}
|
|
684
692
|
},
|
|
@@ -926,39 +934,46 @@ export const job_status_changed_trigger = createTrigger({
|
|
|
926
934
|
}),
|
|
927
935
|
},
|
|
928
936
|
sampleData: {
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
createdAt: '2026-03-05T10:00:00.000Z',
|
|
937
|
-
updatedAt: '2026-03-05T10:00:00.000Z',
|
|
938
|
-
startDate: '2026-03-05T10:00:00.000Z',
|
|
939
|
-
dueDate: '2026-03-15T10:00:00.000Z',
|
|
940
|
-
completedDate: null,
|
|
941
|
-
customer: { id: '507f1f77bcf86cd799439011', name: 'Acme Corp' },
|
|
942
|
-
customerPO: 'PO-1234',
|
|
943
|
-
customerWO: 'WO-5678',
|
|
944
|
-
owner: { id: '507f1f77bcf86cd799439011', name: 'John Smith' },
|
|
945
|
-
labels: [{ id: '507f1f77bcf86cd799439011', name: 'Urgent' }],
|
|
946
|
-
zones: [{ id: '507f1f77bcf86cd799439011', name: 'North' }],
|
|
947
|
-
site: {
|
|
937
|
+
id: 'whd_019ceacb-232b-764f-8dfd-748e1a226de2',
|
|
938
|
+
event: 'Job Status Changed',
|
|
939
|
+
action: 'update',
|
|
940
|
+
createdAt: '2026-03-14T05:21:47.307Z',
|
|
941
|
+
webhookTimestamp: 1773465707307,
|
|
942
|
+
data: {
|
|
943
|
+
job: {
|
|
948
944
|
id: '507f1f77bcf86cd799439011',
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
945
|
+
mode: 'job',
|
|
946
|
+
jobNumber: 'J10001',
|
|
947
|
+
description: 'Sample job description',
|
|
948
|
+
status: 'Open',
|
|
949
|
+
source: 'web',
|
|
950
|
+
createdAt: '2026-03-05T10:00:00.000Z',
|
|
951
|
+
updatedAt: '2026-03-05T10:00:00.000Z',
|
|
952
|
+
startDate: '2026-03-05T10:00:00.000Z',
|
|
953
|
+
dueDate: '2026-03-15T10:00:00.000Z',
|
|
954
|
+
completedDate: null,
|
|
955
|
+
customer: { id: '507f1f77bcf86cd799439011', name: 'Acme Corp' },
|
|
956
|
+
customerPO: 'PO-1234',
|
|
957
|
+
customerWO: 'WO-5678',
|
|
958
|
+
owner: { id: '507f1f77bcf86cd799439011', name: 'John Smith' },
|
|
959
|
+
labels: [{ id: '507f1f77bcf86cd799439011', name: 'Urgent' }],
|
|
960
|
+
zones: [{ id: '507f1f77bcf86cd799439011', name: 'North' }],
|
|
961
|
+
site: {
|
|
962
|
+
id: '507f1f77bcf86cd799439011',
|
|
963
|
+
name: 'Main Office',
|
|
964
|
+
address: {
|
|
965
|
+
street: '123 Main St',
|
|
966
|
+
suburb: 'Sydney',
|
|
967
|
+
state: 'NSW',
|
|
968
|
+
postcode: '2000',
|
|
969
|
+
country: 'Australia',
|
|
970
|
+
formatted: '123 Main St, Sydney NSW 2000',
|
|
971
|
+
},
|
|
957
972
|
},
|
|
973
|
+
priority: { id: '507f1f77bcf86cd799439011', name: 'High' },
|
|
974
|
+
type: { id: '507f1f77bcf86cd799439011', name: 'Maintenance' },
|
|
975
|
+
billingCompany: { id: '507f1f77bcf86cd799439011', name: 'Acme Corp' },
|
|
958
976
|
},
|
|
959
|
-
priority: { id: '507f1f77bcf86cd799439011', name: 'High' },
|
|
960
|
-
type: { id: '507f1f77bcf86cd799439011', name: 'Maintenance' },
|
|
961
|
-
billingCompany: { id: '507f1f77bcf86cd799439011', name: 'Acme Corp' },
|
|
962
977
|
},
|
|
963
978
|
},
|
|
964
979
|
type: TriggerStrategy.WEBHOOK,
|
|
@@ -978,7 +993,7 @@ export const job_status_changed_trigger = createTrigger({
|
|
|
978
993
|
if (context.propsValue.owner?.length) filters.owner = context.propsValue.owner;
|
|
979
994
|
if (context.propsValue.zone?.length) filters.zone = context.propsValue.zone;
|
|
980
995
|
if (context.propsValue.status?.length) filters.status = context.propsValue.status.map((v: string) => JSON.parse(v));
|
|
981
|
-
// Register webhook with WorkBuddy v2 API
|
|
996
|
+
// Register webhook with WorkBuddy v2 API
|
|
982
997
|
const response = await httpClient.sendRequest<{ data: { id: string } }>({
|
|
983
998
|
method: HttpMethod.POST,
|
|
984
999
|
url: `${baseUrl}/api/v2/public/webhooks`,
|
|
@@ -1010,18 +1025,15 @@ export const job_status_changed_trigger = createTrigger({
|
|
|
1010
1025
|
const webhookId = await context.store.get<string>('webhookId');
|
|
1011
1026
|
|
|
1012
1027
|
if (webhookId) {
|
|
1013
|
-
//
|
|
1028
|
+
// Delete webhook to avoid stale subscriptions causing duplicate trigger deliveries
|
|
1014
1029
|
await httpClient.sendRequest({
|
|
1015
|
-
method: HttpMethod.
|
|
1030
|
+
method: HttpMethod.DELETE,
|
|
1016
1031
|
url: `${baseUrl}/api/v2/public/webhooks/${webhookId}`,
|
|
1017
1032
|
headers: {
|
|
1018
1033
|
Authorization: `Bearer ${token}`,
|
|
1019
1034
|
'Content-Type': 'application/json',
|
|
1020
1035
|
'X-WorkBuddy-Version': '2026-01',
|
|
1021
1036
|
},
|
|
1022
|
-
body: {
|
|
1023
|
-
status: 'paused',
|
|
1024
|
-
},
|
|
1025
1037
|
});
|
|
1026
1038
|
}
|
|
1027
1039
|
},
|
|
@@ -1269,39 +1281,46 @@ export const job_deleted_trigger = createTrigger({
|
|
|
1269
1281
|
}),
|
|
1270
1282
|
},
|
|
1271
1283
|
sampleData: {
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
createdAt: '2026-03-05T10:00:00.000Z',
|
|
1280
|
-
updatedAt: '2026-03-05T10:00:00.000Z',
|
|
1281
|
-
startDate: '2026-03-05T10:00:00.000Z',
|
|
1282
|
-
dueDate: '2026-03-15T10:00:00.000Z',
|
|
1283
|
-
completedDate: null,
|
|
1284
|
-
customer: { id: '507f1f77bcf86cd799439011', name: 'Acme Corp' },
|
|
1285
|
-
customerPO: 'PO-1234',
|
|
1286
|
-
customerWO: 'WO-5678',
|
|
1287
|
-
owner: { id: '507f1f77bcf86cd799439011', name: 'John Smith' },
|
|
1288
|
-
labels: [{ id: '507f1f77bcf86cd799439011', name: 'Urgent' }],
|
|
1289
|
-
zones: [{ id: '507f1f77bcf86cd799439011', name: 'North' }],
|
|
1290
|
-
site: {
|
|
1284
|
+
id: 'whd_019ceacb-232b-764f-8dfd-748e1a226de2',
|
|
1285
|
+
event: 'Job Deleted',
|
|
1286
|
+
action: 'remove',
|
|
1287
|
+
createdAt: '2026-03-14T05:21:47.307Z',
|
|
1288
|
+
webhookTimestamp: 1773465707307,
|
|
1289
|
+
data: {
|
|
1290
|
+
job: {
|
|
1291
1291
|
id: '507f1f77bcf86cd799439011',
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1292
|
+
mode: 'job',
|
|
1293
|
+
jobNumber: 'J10001',
|
|
1294
|
+
description: 'Sample job description',
|
|
1295
|
+
status: 'Open',
|
|
1296
|
+
source: 'web',
|
|
1297
|
+
createdAt: '2026-03-05T10:00:00.000Z',
|
|
1298
|
+
updatedAt: '2026-03-05T10:00:00.000Z',
|
|
1299
|
+
startDate: '2026-03-05T10:00:00.000Z',
|
|
1300
|
+
dueDate: '2026-03-15T10:00:00.000Z',
|
|
1301
|
+
completedDate: null,
|
|
1302
|
+
customer: { id: '507f1f77bcf86cd799439011', name: 'Acme Corp' },
|
|
1303
|
+
customerPO: 'PO-1234',
|
|
1304
|
+
customerWO: 'WO-5678',
|
|
1305
|
+
owner: { id: '507f1f77bcf86cd799439011', name: 'John Smith' },
|
|
1306
|
+
labels: [{ id: '507f1f77bcf86cd799439011', name: 'Urgent' }],
|
|
1307
|
+
zones: [{ id: '507f1f77bcf86cd799439011', name: 'North' }],
|
|
1308
|
+
site: {
|
|
1309
|
+
id: '507f1f77bcf86cd799439011',
|
|
1310
|
+
name: 'Main Office',
|
|
1311
|
+
address: {
|
|
1312
|
+
street: '123 Main St',
|
|
1313
|
+
suburb: 'Sydney',
|
|
1314
|
+
state: 'NSW',
|
|
1315
|
+
postcode: '2000',
|
|
1316
|
+
country: 'Australia',
|
|
1317
|
+
formatted: '123 Main St, Sydney NSW 2000',
|
|
1318
|
+
},
|
|
1300
1319
|
},
|
|
1320
|
+
priority: { id: '507f1f77bcf86cd799439011', name: 'High' },
|
|
1321
|
+
type: { id: '507f1f77bcf86cd799439011', name: 'Maintenance' },
|
|
1322
|
+
billingCompany: { id: '507f1f77bcf86cd799439011', name: 'Acme Corp' },
|
|
1301
1323
|
},
|
|
1302
|
-
priority: { id: '507f1f77bcf86cd799439011', name: 'High' },
|
|
1303
|
-
type: { id: '507f1f77bcf86cd799439011', name: 'Maintenance' },
|
|
1304
|
-
billingCompany: { id: '507f1f77bcf86cd799439011', name: 'Acme Corp' },
|
|
1305
1324
|
},
|
|
1306
1325
|
},
|
|
1307
1326
|
type: TriggerStrategy.WEBHOOK,
|
|
@@ -1321,7 +1340,7 @@ export const job_deleted_trigger = createTrigger({
|
|
|
1321
1340
|
if (context.propsValue.owner?.length) filters.owner = context.propsValue.owner;
|
|
1322
1341
|
if (context.propsValue.zone?.length) filters.zone = context.propsValue.zone;
|
|
1323
1342
|
if (context.propsValue.status?.length) filters.status = context.propsValue.status.map((v: string) => JSON.parse(v));
|
|
1324
|
-
// Register webhook with WorkBuddy v2 API
|
|
1343
|
+
// Register webhook with WorkBuddy v2 API
|
|
1325
1344
|
const response = await httpClient.sendRequest<{ data: { id: string } }>({
|
|
1326
1345
|
method: HttpMethod.POST,
|
|
1327
1346
|
url: `${baseUrl}/api/v2/public/webhooks`,
|
|
@@ -1353,18 +1372,15 @@ export const job_deleted_trigger = createTrigger({
|
|
|
1353
1372
|
const webhookId = await context.store.get<string>('webhookId');
|
|
1354
1373
|
|
|
1355
1374
|
if (webhookId) {
|
|
1356
|
-
//
|
|
1375
|
+
// Delete webhook to avoid stale subscriptions causing duplicate trigger deliveries
|
|
1357
1376
|
await httpClient.sendRequest({
|
|
1358
|
-
method: HttpMethod.
|
|
1377
|
+
method: HttpMethod.DELETE,
|
|
1359
1378
|
url: `${baseUrl}/api/v2/public/webhooks/${webhookId}`,
|
|
1360
1379
|
headers: {
|
|
1361
1380
|
Authorization: `Bearer ${token}`,
|
|
1362
1381
|
'Content-Type': 'application/json',
|
|
1363
1382
|
'X-WorkBuddy-Version': '2026-01',
|
|
1364
1383
|
},
|
|
1365
|
-
body: {
|
|
1366
|
-
status: 'paused',
|
|
1367
|
-
},
|
|
1368
1384
|
});
|
|
1369
1385
|
}
|
|
1370
1386
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lead.d.ts","sourceRoot":"","sources":["lead.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,eAAe,EAAY,MAAM,gCAAgC,CAAC;AAI1F,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"lead.d.ts","sourceRoot":"","sources":["lead.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,eAAe,EAAY,MAAM,gCAAgC,CAAC;AAI1F,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyO/B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyO/B,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyOtC,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyO/B,CAAC"}
|