@workbuddy/piece-workbuddy-edge 1.0.33 → 1.0.35

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 (149) hide show
  1. package/package.json +1 -1
  2. package/src/index.d.ts.map +1 -1
  3. package/src/index.js +98 -14
  4. package/src/index.js.map +1 -1
  5. package/src/index.ts +183 -10
  6. package/src/lib/actions/crm-companies.d.ts +1 -0
  7. package/src/lib/actions/crm-companies.d.ts.map +1 -1
  8. package/src/lib/actions/crm-companies.js +9 -0
  9. package/src/lib/actions/crm-companies.js.map +1 -1
  10. package/src/lib/actions/crm-companies.ts +11 -0
  11. package/src/lib/actions/crm-contacts.d.ts +25 -0
  12. package/src/lib/actions/crm-contacts.d.ts.map +1 -1
  13. package/src/lib/actions/crm-contacts.js +135 -3
  14. package/src/lib/actions/crm-contacts.js.map +1 -1
  15. package/src/lib/actions/crm-contacts.ts +149 -2
  16. package/src/lib/actions/crm-contractors.d.ts +110 -0
  17. package/src/lib/actions/crm-contractors.d.ts.map +1 -1
  18. package/src/lib/actions/crm-contractors.js +585 -2
  19. package/src/lib/actions/crm-contractors.js.map +1 -1
  20. package/src/lib/actions/crm-contractors.ts +631 -1
  21. package/src/lib/actions/crm-customers.d.ts +94 -0
  22. package/src/lib/actions/crm-customers.d.ts.map +1 -1
  23. package/src/lib/actions/crm-customers.js +504 -3
  24. package/src/lib/actions/crm-customers.js.map +1 -1
  25. package/src/lib/actions/crm-customers.ts +545 -2
  26. package/src/lib/actions/crm-external-users.js +1 -1
  27. package/src/lib/actions/crm-external-users.js.map +1 -1
  28. package/src/lib/actions/crm-external-users.ts +1 -1
  29. package/src/lib/actions/crm-invites.d.ts +1 -0
  30. package/src/lib/actions/crm-invites.d.ts.map +1 -1
  31. package/src/lib/actions/crm-invites.js +9 -0
  32. package/src/lib/actions/crm-invites.js.map +1 -1
  33. package/src/lib/actions/crm-invites.ts +11 -0
  34. package/src/lib/actions/crm-sites.d.ts +10 -0
  35. package/src/lib/actions/crm-sites.d.ts.map +1 -1
  36. package/src/lib/actions/crm-sites.js +59 -3
  37. package/src/lib/actions/crm-sites.js.map +1 -1
  38. package/src/lib/actions/crm-sites.ts +70 -2
  39. package/src/lib/actions/crm-suppliers.d.ts +64 -0
  40. package/src/lib/actions/crm-suppliers.d.ts.map +1 -1
  41. package/src/lib/actions/crm-suppliers.js +352 -2
  42. package/src/lib/actions/crm-suppliers.js.map +1 -1
  43. package/src/lib/actions/crm-suppliers.ts +376 -1
  44. package/src/lib/actions/index.d.ts +11 -1
  45. package/src/lib/actions/index.d.ts.map +1 -1
  46. package/src/lib/actions/index.js +11 -1
  47. package/src/lib/actions/index.js.map +1 -1
  48. package/src/lib/actions/index.ts +11 -1
  49. package/src/lib/actions/items.d.ts +8 -0
  50. package/src/lib/actions/items.d.ts.map +1 -0
  51. package/src/lib/actions/items.js +42 -0
  52. package/src/lib/actions/items.js.map +1 -0
  53. package/src/lib/actions/items.ts +45 -0
  54. package/src/lib/actions/jobs-activities.d.ts +4 -3
  55. package/src/lib/actions/jobs-activities.d.ts.map +1 -1
  56. package/src/lib/actions/jobs-activities.js +19 -12
  57. package/src/lib/actions/jobs-activities.js.map +1 -1
  58. package/src/lib/actions/jobs-activities.ts +19 -12
  59. package/src/lib/actions/jobs-tasks.d.ts +0 -2
  60. package/src/lib/actions/jobs-tasks.d.ts.map +1 -1
  61. package/src/lib/actions/jobs-tasks.js +0 -12
  62. package/src/lib/actions/jobs-tasks.js.map +1 -1
  63. package/src/lib/actions/jobs-tasks.ts +0 -12
  64. package/src/lib/actions/jobs.d.ts +89 -3
  65. package/src/lib/actions/jobs.d.ts.map +1 -1
  66. package/src/lib/actions/jobs.js +499 -31
  67. package/src/lib/actions/jobs.js.map +1 -1
  68. package/src/lib/actions/jobs.ts +527 -30
  69. package/src/lib/actions/mcp.d.ts +3 -3
  70. package/src/lib/actions/mcp.d.ts.map +1 -1
  71. package/src/lib/actions/mcp.js +9 -9
  72. package/src/lib/actions/mcp.js.map +1 -1
  73. package/src/lib/actions/mcp.ts +8 -8
  74. package/src/lib/actions/pending-items.d.ts +8 -0
  75. package/src/lib/actions/pending-items.d.ts.map +1 -0
  76. package/src/lib/actions/pending-items.js +42 -0
  77. package/src/lib/actions/pending-items.js.map +1 -0
  78. package/src/lib/actions/pending-items.ts +45 -0
  79. package/src/lib/actions/service-plans-lines-tasks-subtasks.d.ts +52 -0
  80. package/src/lib/actions/service-plans-lines-tasks-subtasks.d.ts.map +1 -0
  81. package/src/lib/actions/service-plans-lines-tasks-subtasks.js +257 -0
  82. package/src/lib/actions/service-plans-lines-tasks-subtasks.js.map +1 -0
  83. package/src/lib/actions/service-plans-lines-tasks-subtasks.ts +274 -0
  84. package/src/lib/actions/service-plans-lines-tasks.d.ts +52 -0
  85. package/src/lib/actions/service-plans-lines-tasks.d.ts.map +1 -0
  86. package/src/lib/actions/service-plans-lines-tasks.js +261 -0
  87. package/src/lib/actions/service-plans-lines-tasks.js.map +1 -0
  88. package/src/lib/actions/service-plans-lines-tasks.ts +278 -0
  89. package/src/lib/actions/service-plans-lines.d.ts +52 -0
  90. package/src/lib/actions/service-plans-lines.d.ts.map +1 -0
  91. package/src/lib/actions/service-plans-lines.js +286 -0
  92. package/src/lib/actions/service-plans-lines.js.map +1 -0
  93. package/src/lib/actions/service-plans-lines.ts +302 -0
  94. package/src/lib/actions/service-plans.d.ts +45 -0
  95. package/src/lib/actions/service-plans.d.ts.map +1 -0
  96. package/src/lib/actions/service-plans.js +229 -0
  97. package/src/lib/actions/service-plans.js.map +1 -0
  98. package/src/lib/actions/service-plans.ts +250 -0
  99. package/src/lib/actions/settings-custom-fields.d.ts +21 -0
  100. package/src/lib/actions/settings-custom-fields.d.ts.map +1 -0
  101. package/src/lib/actions/settings-custom-fields.js +95 -0
  102. package/src/lib/actions/settings-custom-fields.js.map +1 -0
  103. package/src/lib/actions/settings-custom-fields.ts +107 -0
  104. package/src/lib/actions/settings-items.d.ts +136 -0
  105. package/src/lib/actions/settings-items.d.ts.map +1 -0
  106. package/src/lib/actions/settings-items.js +772 -0
  107. package/src/lib/actions/settings-items.js.map +1 -0
  108. package/src/lib/actions/settings-items.ts +818 -0
  109. package/src/lib/actions/{settings.d.ts → settings-reference-data.d.ts} +42 -10
  110. package/src/lib/actions/settings-reference-data.d.ts.map +1 -0
  111. package/src/lib/actions/settings-reference-data.js +505 -0
  112. package/src/lib/actions/settings-reference-data.js.map +1 -0
  113. package/src/lib/actions/settings-reference-data.ts +586 -0
  114. package/src/lib/actions/settings-templates.d.ts +15 -0
  115. package/src/lib/actions/settings-templates.d.ts.map +1 -0
  116. package/src/lib/actions/settings-templates.js +75 -0
  117. package/src/lib/actions/settings-templates.js.map +1 -0
  118. package/src/lib/actions/settings-templates.ts +79 -0
  119. package/src/lib/actions/stages-activities.d.ts +4 -3
  120. package/src/lib/actions/stages-activities.d.ts.map +1 -1
  121. package/src/lib/actions/stages-activities.js +19 -12
  122. package/src/lib/actions/stages-activities.js.map +1 -1
  123. package/src/lib/actions/stages-activities.ts +19 -12
  124. package/src/lib/actions/stages-pending-items.d.ts +75 -0
  125. package/src/lib/actions/stages-pending-items.d.ts.map +1 -0
  126. package/src/lib/actions/stages-pending-items.js +370 -0
  127. package/src/lib/actions/stages-pending-items.js.map +1 -0
  128. package/src/lib/actions/stages-pending-items.ts +404 -0
  129. package/src/lib/actions/stages-resources.d.ts.map +1 -1
  130. package/src/lib/actions/stages-resources.js +5 -8
  131. package/src/lib/actions/stages-resources.js.map +1 -1
  132. package/src/lib/actions/stages-resources.ts +8 -8
  133. package/src/lib/actions/stages-tasks.d.ts +0 -2
  134. package/src/lib/actions/stages-tasks.d.ts.map +1 -1
  135. package/src/lib/actions/stages-tasks.js +0 -12
  136. package/src/lib/actions/stages-tasks.js.map +1 -1
  137. package/src/lib/actions/stages-tasks.ts +0 -12
  138. package/src/lib/actions/stages.d.ts +20 -3
  139. package/src/lib/actions/stages.d.ts.map +1 -1
  140. package/src/lib/actions/stages.js +103 -21
  141. package/src/lib/actions/stages.js.map +1 -1
  142. package/src/lib/actions/stages.ts +116 -20
  143. package/src/lib/actions/webhooks-v2.js +11 -11
  144. package/src/lib/actions/webhooks-v2.js.map +1 -1
  145. package/src/lib/actions/webhooks-v2.ts +11 -11
  146. package/src/lib/actions/settings.d.ts.map +0 -1
  147. package/src/lib/actions/settings.js +0 -257
  148. package/src/lib/actions/settings.js.map +0 -1
  149. package/src/lib/actions/settings.ts +0 -301
@@ -55,21 +55,11 @@ export const PublicApiJobController_search = createAction({
55
55
  ],
56
56
  },
57
57
  }),
58
- status: Property.StaticMultiSelectDropdown({
58
+ status: Property.Json({
59
59
  displayName: 'Status',
60
60
  description: 'Status filter',
61
61
  required: false,
62
- options: {
63
- options: [
64
- { label: 'Open', value: JSON.stringify({ match: 'systemStatus', value: 'Open' }) },
65
- { label: 'In Progress', value: JSON.stringify({ match: 'systemStatus', value: 'In Progress' }) },
66
- { label: 'On Hold', value: JSON.stringify({ match: 'systemStatus', value: 'On Hold' }) },
67
- { label: 'Completed', value: JSON.stringify({ match: 'systemStatus', value: 'Completed' }) },
68
- { label: 'Finalised', value: JSON.stringify({ match: 'systemStatus', value: 'Finalised' }) },
69
- { label: 'Closed', value: JSON.stringify({ match: 'systemStatus', value: 'Closed' }) },
70
- { label: 'Canceled', value: JSON.stringify({ match: 'systemStatus', value: 'Canceled' }) },
71
- ],
72
- },
62
+ defaultValue: [],
73
63
  }),
74
64
  customer: Property.Array({
75
65
  displayName: 'Customer',
@@ -121,6 +111,11 @@ export const PublicApiJobController_search = createAction({
121
111
  description: '',
122
112
  required: false,
123
113
  }),
114
+ integrationId: Property.Array({
115
+ displayName: 'Integration Id',
116
+ description: 'integration ID',
117
+ required: false,
118
+ }),
124
119
  resource: Property.Array({
125
120
  displayName: 'Resource',
126
121
  description: '',
@@ -131,21 +126,11 @@ export const PublicApiJobController_search = createAction({
131
126
  description: '',
132
127
  required: false,
133
128
  }),
134
- stageStatus: Property.StaticMultiSelectDropdown({
129
+ stageStatus: Property.Json({
135
130
  displayName: 'Stage Status',
136
131
  description: '',
137
132
  required: false,
138
- options: {
139
- options: [
140
- { label: 'Open', value: JSON.stringify({ match: 'systemStatus', value: 'Open' }) },
141
- { label: 'In Progress', value: JSON.stringify({ match: 'systemStatus', value: 'In Progress' }) },
142
- { label: 'On Hold', value: JSON.stringify({ match: 'systemStatus', value: 'On Hold' }) },
143
- { label: 'Completed', value: JSON.stringify({ match: 'systemStatus', value: 'Completed' }) },
144
- { label: 'Finalised', value: JSON.stringify({ match: 'systemStatus', value: 'Finalised' }) },
145
- { label: 'Closed', value: JSON.stringify({ match: 'systemStatus', value: 'Closed' }) },
146
- { label: 'Canceled', value: JSON.stringify({ match: 'systemStatus', value: 'Canceled' }) },
147
- ],
148
- },
133
+ defaultValue: [],
149
134
  }),
150
135
  search: Property.ShortText({
151
136
  displayName: 'Search',
@@ -222,6 +207,7 @@ export const PublicApiJobController_search = createAction({
222
207
  tag: context.propsValue.tag,
223
208
  priceBook: context.propsValue.priceBook,
224
209
  billingCompany: context.propsValue.billingCompany,
210
+ integrationId: context.propsValue.integrationId,
225
211
  resource: context.propsValue.resource,
226
212
  workCategory: context.propsValue.workCategory,
227
213
  stageStatus: context.propsValue.stageStatus,
@@ -256,11 +242,11 @@ export const PublicApiJobController_get = createAction({
256
242
  name: 'PublicApiJobController_get',
257
243
  auth: workbuddyAuth,
258
244
  displayName: 'Get job by ID or job number',
259
- description: 'Retrieve a single job by its ID or human-readable job number.',
245
+ description: 'Retrieve a single job by its ID, human-readable job number, or external integration ID.',
260
246
  props: {
261
247
  identifier: Property.ShortText({
262
248
  displayName: 'Identifier',
263
- description: 'Job ID (MongoDB ObjectId) or job number (e.g., JOB-12345)',
249
+ description: 'Job ID (MongoDB ObjectId), job number (e.g., JOB-12345), or external integration ID',
264
250
  required: true,
265
251
  }),
266
252
  },
@@ -338,6 +324,16 @@ export const PublicApiJobController_create = createAction({
338
324
  description: 'Display name',
339
325
  required: false,
340
326
  }),
327
+ integrationId: Property.ShortText({
328
+ displayName: 'Integration Id',
329
+ description: 'integration ID',
330
+ required: false,
331
+ }),
332
+ jobNumber: Property.ShortText({
333
+ displayName: 'Job Number',
334
+ description: '',
335
+ required: false,
336
+ }),
341
337
  description: Property.LongText({
342
338
  displayName: 'Description',
343
339
  description: 'Detailed description',
@@ -348,6 +344,11 @@ export const PublicApiJobController_create = createAction({
348
344
  description: 'Site ID — use /crm/sites to look up',
349
345
  required: false,
350
346
  }),
347
+ placeId: Property.ShortText({
348
+ displayName: 'Place Id',
349
+ description: 'place ID',
350
+ required: false,
351
+ }),
351
352
  site: Property.Json({
352
353
  displayName: 'Site',
353
354
  description: 'Inline site object — alternative to siteId',
@@ -418,9 +419,193 @@ export const PublicApiJobController_create = createAction({
418
419
  description: 'Customer purchase order reference',
419
420
  required: false,
420
421
  }),
422
+ startDate: Property.DateTime({
423
+ displayName: 'Start Date',
424
+ description: 'Start date (ISO 8601 datetime)',
425
+ required: false,
426
+ }),
427
+ dueDate: Property.DateTime({
428
+ displayName: 'Due Date',
429
+ description: 'Due date (ISO 8601 datetime)',
430
+ required: false,
431
+ }),
432
+ customFields: Property.Json({
433
+ displayName: 'Custom Fields',
434
+ description: 'Custom fields as key-value pairs — validated against tenant field definitions',
435
+ required: false,
436
+ }),
437
+ items: Property.Json({
438
+ displayName: 'Items',
439
+ description: '',
440
+ required: false,
441
+ defaultValue: [],
442
+ }),
443
+ },
444
+ async run(context) {
445
+ const token = await getAccessToken(context.auth);
446
+ const baseUrl = context.auth.props.baseUrl;
447
+
448
+ const url = `${baseUrl}/api/v2/public/jobs`;
449
+
450
+ const rawBody: Record<string, unknown> = {
451
+ name: context.propsValue.name,
452
+ integrationId: context.propsValue.integrationId,
453
+ jobNumber: context.propsValue.jobNumber,
454
+ description: context.propsValue.description,
455
+ customerId: context.propsValue.customerId,
456
+ siteId: context.propsValue.siteId,
457
+ placeId: context.propsValue.placeId,
458
+ site: context.propsValue.site,
459
+ contactId: context.propsValue.contactId,
460
+ contact: context.propsValue.contact,
461
+ typeId: context.propsValue.typeId,
462
+ priorityId: context.propsValue.priorityId,
463
+ priceBookId: context.propsValue.priceBookId,
464
+ ownerId: context.propsValue.ownerId,
465
+ fieldSupervisorId: context.propsValue.fieldSupervisorId,
466
+ zoneId: context.propsValue.zoneId,
467
+ tagIds: context.propsValue.tagIds,
468
+ notes: context.propsValue.notes,
469
+ reference: context.propsValue.reference,
470
+ customerWO: context.propsValue.customerWO,
471
+ customerPO: context.propsValue.customerPO,
472
+ startDate: context.propsValue.startDate,
473
+ dueDate: context.propsValue.dueDate,
474
+ customFields: context.propsValue.customFields,
475
+ items: context.propsValue.items,
476
+ };
477
+
478
+ const body = rawBody;
479
+ const response = await httpClient.sendRequest({
480
+ method: HttpMethod.POST,
481
+ url: `${baseUrl}/api/v2/public/jobs`,
482
+ headers: {
483
+ Authorization: `Bearer ${token}`,
484
+ 'Content-Type': 'application/json',
485
+ 'X-WorkBuddy-Version': '2026-01',
486
+ },
487
+ body: body,
488
+ });
489
+
490
+ return response.body;
491
+ },
492
+ });
493
+
494
+ export const PublicApiJobController_createFromTemplate = createAction({
495
+ name: 'PublicApiJobController_createFromTemplate',
496
+ auth: workbuddyAuth,
497
+ displayName: 'Create a new job from template',
498
+ description:
499
+ 'Create a job using a job template. Template-owned fields win over request values before final job validation.',
500
+ props: {
421
501
  templateId: Property.ShortText({
422
502
  displayName: 'Template Id',
423
- description: 'Template ID to pre-populate fields from a template',
503
+ description: 'Job template ID',
504
+ required: true,
505
+ }),
506
+ customerId: Property.ShortText({
507
+ displayName: 'Customer Id',
508
+ description: 'Customer ID — use /crm/customers to look up',
509
+ required: true,
510
+ }),
511
+ name: Property.ShortText({
512
+ displayName: 'Name',
513
+ description: 'Display name',
514
+ required: false,
515
+ }),
516
+ integrationId: Property.ShortText({
517
+ displayName: 'Integration Id',
518
+ description: 'integration ID',
519
+ required: false,
520
+ }),
521
+ jobNumber: Property.ShortText({
522
+ displayName: 'Job Number',
523
+ description: '',
524
+ required: false,
525
+ }),
526
+ description: Property.LongText({
527
+ displayName: 'Description',
528
+ description: 'Detailed description',
529
+ required: false,
530
+ }),
531
+ siteId: Property.ShortText({
532
+ displayName: 'Site Id',
533
+ description: 'Site ID — use /crm/sites to look up',
534
+ required: false,
535
+ }),
536
+ placeId: Property.ShortText({
537
+ displayName: 'Place Id',
538
+ description: 'place ID',
539
+ required: false,
540
+ }),
541
+ site: Property.Json({
542
+ displayName: 'Site',
543
+ description: 'Inline site object — alternative to siteId',
544
+ required: false,
545
+ }),
546
+ contactId: Property.ShortText({
547
+ displayName: 'Contact Id',
548
+ description: 'Contact ID — use /crm/contacts to look up',
549
+ required: false,
550
+ }),
551
+ contact: Property.Json({
552
+ displayName: 'Contact',
553
+ description: 'Inline contact object — alternative to contactId',
554
+ required: false,
555
+ }),
556
+ typeId: Property.ShortText({
557
+ displayName: 'Type Id',
558
+ description: 'Job type ID — use /settings/job-types to look up',
559
+ required: false,
560
+ }),
561
+ priorityId: Property.ShortText({
562
+ displayName: 'Priority Id',
563
+ description: 'Priority ID — use /settings/priorities to look up',
564
+ required: false,
565
+ }),
566
+ priceBookId: Property.ShortText({
567
+ displayName: 'Price Book Id',
568
+ description: 'Price book ID for job pricing',
569
+ required: false,
570
+ }),
571
+ ownerId: Property.ShortText({
572
+ displayName: 'Owner Id',
573
+ description: 'Owner (employee) ID — use /crm/employees to look up',
574
+ required: false,
575
+ }),
576
+ fieldSupervisorId: Property.ShortText({
577
+ displayName: 'Field Supervisor Id',
578
+ description: 'Field supervisor (employee) ID — use /crm/employees to look up',
579
+ required: false,
580
+ }),
581
+ zoneId: Property.ShortText({
582
+ displayName: 'Zone Id',
583
+ description: 'Zone ID — use /settings/zones to look up',
584
+ required: false,
585
+ }),
586
+ tagIds: Property.Array({
587
+ displayName: 'Tag Ids',
588
+ description: 'Array of tag IDs (comma-separated, e.g. "id1,id2") — use /settings/tags to look up',
589
+ required: false,
590
+ }),
591
+ notes: Property.LongText({
592
+ displayName: 'Notes',
593
+ description: 'Additional notes or comments',
594
+ required: false,
595
+ }),
596
+ reference: Property.ShortText({
597
+ displayName: 'Reference',
598
+ description: 'External reference number',
599
+ required: false,
600
+ }),
601
+ customerWO: Property.ShortText({
602
+ displayName: 'Customer W O',
603
+ description: 'Customer work order reference',
604
+ required: false,
605
+ }),
606
+ customerPO: Property.ShortText({
607
+ displayName: 'Customer P O',
608
+ description: 'Customer purchase order reference',
424
609
  required: false,
425
610
  }),
426
611
  startDate: Property.DateTime({
@@ -438,18 +623,27 @@ export const PublicApiJobController_create = createAction({
438
623
  description: 'Custom fields as key-value pairs — validated against tenant field definitions',
439
624
  required: false,
440
625
  }),
626
+ items: Property.Json({
627
+ displayName: 'Items',
628
+ description: '',
629
+ required: false,
630
+ defaultValue: [],
631
+ }),
441
632
  },
442
633
  async run(context) {
443
634
  const token = await getAccessToken(context.auth);
444
635
  const baseUrl = context.auth.props.baseUrl;
445
636
 
446
- const url = `${baseUrl}/api/v2/public/jobs`;
637
+ const url = `${baseUrl}/api/v2/public/jobs/template/${context.propsValue.templateId}`;
447
638
 
448
639
  const rawBody: Record<string, unknown> = {
449
640
  name: context.propsValue.name,
641
+ integrationId: context.propsValue.integrationId,
642
+ jobNumber: context.propsValue.jobNumber,
450
643
  description: context.propsValue.description,
451
644
  customerId: context.propsValue.customerId,
452
645
  siteId: context.propsValue.siteId,
646
+ placeId: context.propsValue.placeId,
453
647
  site: context.propsValue.site,
454
648
  contactId: context.propsValue.contactId,
455
649
  contact: context.propsValue.contact,
@@ -464,16 +658,91 @@ export const PublicApiJobController_create = createAction({
464
658
  reference: context.propsValue.reference,
465
659
  customerWO: context.propsValue.customerWO,
466
660
  customerPO: context.propsValue.customerPO,
467
- templateId: context.propsValue.templateId,
468
661
  startDate: context.propsValue.startDate,
469
662
  dueDate: context.propsValue.dueDate,
470
663
  customFields: context.propsValue.customFields,
664
+ items: context.propsValue.items,
471
665
  };
472
666
 
473
667
  const body = rawBody;
474
668
  const response = await httpClient.sendRequest({
475
669
  method: HttpMethod.POST,
476
- url: `${baseUrl}/api/v2/public/jobs`,
670
+ url: `${baseUrl}/api/v2/public/jobs/template/${context.propsValue.templateId}`,
671
+ headers: {
672
+ Authorization: `Bearer ${token}`,
673
+ 'Content-Type': 'application/json',
674
+ 'X-WorkBuddy-Version': '2026-01',
675
+ },
676
+ body: body,
677
+ });
678
+
679
+ return response.body;
680
+ },
681
+ });
682
+
683
+ export const PublicApiJobController_updateStatus = createAction({
684
+ name: 'PublicApiJobController_updateStatus',
685
+ auth: workbuddyAuth,
686
+ displayName: 'Update job status',
687
+ description: 'Change an existing job status and cascade the change to stages through the job domain command.',
688
+ props: {
689
+ id: Property.ShortText({
690
+ displayName: 'Id',
691
+ description: 'Job ID',
692
+ required: true,
693
+ }),
694
+ status: Property.StaticDropdown({
695
+ displayName: 'Status',
696
+ description: 'Status filter',
697
+ required: true,
698
+ options: {
699
+ options: [
700
+ { label: 'open', value: 'open' },
701
+ { label: 'in_progress', value: 'in_progress' },
702
+ { label: 'on_hold', value: 'on_hold' },
703
+ { label: 'completed', value: 'completed' },
704
+ { label: 'finalised', value: 'finalised' },
705
+ { label: 'closed', value: 'closed' },
706
+ { label: 'cancelled', value: 'cancelled' },
707
+ ],
708
+ },
709
+ }),
710
+ updatedAt: Property.DateTime({
711
+ displayName: 'Updated At',
712
+ description: 'For optimistic concurrency — update fails if entity was modified after this timestamp',
713
+ required: false,
714
+ }),
715
+ note: Property.ShortText({
716
+ displayName: 'Note',
717
+ description: '',
718
+ required: false,
719
+ }),
720
+ reason: Property.ShortText({
721
+ displayName: 'Reason',
722
+ description: 'Reason for the action (e.g. cancellation reason)',
723
+ required: false,
724
+ }),
725
+ },
726
+ async run(context) {
727
+ const token = await getAccessToken(context.auth);
728
+ const baseUrl = context.auth.props.baseUrl;
729
+
730
+ const url = `${baseUrl}/api/v2/public/jobs/${context.propsValue.id}/status`;
731
+
732
+ // Build body with only defined values (for partial updates)
733
+ const rawBody: Record<string, unknown> = {
734
+ updatedAt: context.propsValue.updatedAt,
735
+ status: context.propsValue.status,
736
+ note: context.propsValue.note,
737
+ reason: context.propsValue.reason,
738
+ };
739
+
740
+ const body = Object.fromEntries(
741
+ Object.entries(rawBody).filter(([_, v]) => v !== undefined && v !== null && v !== '')
742
+ );
743
+ const response = await httpClient.sendRequest({
744
+ method: HttpMethod.PATCH,
745
+ url: `${baseUrl}/api/v2/public/jobs/${context.propsValue.id}/status`,
477
746
  headers: {
478
747
  Authorization: `Bearer ${token}`,
479
748
  'Content-Type': 'application/json',
@@ -507,6 +776,11 @@ export const PublicApiJobController_update = createAction({
507
776
  description: 'Display name',
508
777
  required: false,
509
778
  }),
779
+ integrationId: Property.ShortText({
780
+ displayName: 'Integration Id',
781
+ description: 'integration ID',
782
+ required: false,
783
+ }),
510
784
  description: Property.LongText({
511
785
  displayName: 'Description',
512
786
  description: 'Detailed description',
@@ -613,6 +887,7 @@ export const PublicApiJobController_update = createAction({
613
887
  const rawBody: Record<string, unknown> = {
614
888
  updatedAt: context.propsValue.updatedAt,
615
889
  name: context.propsValue.name,
890
+ integrationId: context.propsValue.integrationId,
616
891
  description: context.propsValue.description,
617
892
  siteId: context.propsValue.siteId,
618
893
  contactId: context.propsValue.contactId,
@@ -845,6 +1120,61 @@ export const PublicApiJobController_getStageItems = createAction({
845
1120
  },
846
1121
  });
847
1122
 
1123
+ export const PublicApiJobController_createStageItems = createAction({
1124
+ name: 'PublicApiJobController_createStageItems',
1125
+ auth: workbuddyAuth,
1126
+ displayName: 'Create stage items',
1127
+ description: 'Add one or more catalogue-backed line items to a stage.',
1128
+ props: {
1129
+ id: Property.ShortText({
1130
+ displayName: 'Id',
1131
+ description: 'Job ID',
1132
+ required: true,
1133
+ }),
1134
+ stageId: Property.ShortText({
1135
+ displayName: 'Stage Id',
1136
+ description: 'Stage ID',
1137
+ required: true,
1138
+ }),
1139
+ updatedAt: Property.DateTime({
1140
+ displayName: 'Updated At',
1141
+ description: 'For optimistic concurrency — update fails if entity was modified after this timestamp',
1142
+ required: true,
1143
+ }),
1144
+ items: Property.Json({
1145
+ displayName: 'Items',
1146
+ description: '',
1147
+ required: true,
1148
+ defaultValue: [],
1149
+ }),
1150
+ },
1151
+ async run(context) {
1152
+ const token = await getAccessToken(context.auth);
1153
+ const baseUrl = context.auth.props.baseUrl;
1154
+
1155
+ const url = `${baseUrl}/api/v2/public/jobs/${context.propsValue.id}/stages/${context.propsValue.stageId}/items`;
1156
+
1157
+ const rawBody: Record<string, unknown> = {
1158
+ updatedAt: context.propsValue.updatedAt,
1159
+ items: context.propsValue.items,
1160
+ };
1161
+
1162
+ const body = rawBody;
1163
+ const response = await httpClient.sendRequest({
1164
+ method: HttpMethod.POST,
1165
+ url: `${baseUrl}/api/v2/public/jobs/${context.propsValue.id}/stages/${context.propsValue.stageId}/items`,
1166
+ headers: {
1167
+ Authorization: `Bearer ${token}`,
1168
+ 'Content-Type': 'application/json',
1169
+ 'X-WorkBuddy-Version': '2026-01',
1170
+ },
1171
+ body: body,
1172
+ });
1173
+
1174
+ return response.body;
1175
+ },
1176
+ });
1177
+
848
1178
  export const PublicApiJobController_getStageItem = createAction({
849
1179
  name: 'PublicApiJobController_getStageItem',
850
1180
  auth: workbuddyAuth,
@@ -886,3 +1216,170 @@ export const PublicApiJobController_getStageItem = createAction({
886
1216
  return response.body;
887
1217
  },
888
1218
  });
1219
+
1220
+ export const PublicApiJobController_updateStageItem = createAction({
1221
+ name: 'PublicApiJobController_updateStageItem',
1222
+ auth: workbuddyAuth,
1223
+ displayName: 'Update stage item',
1224
+ description: 'Update mutable fields on a stage line item.',
1225
+ props: {
1226
+ id: Property.ShortText({
1227
+ displayName: 'Id',
1228
+ description: 'Job ID',
1229
+ required: true,
1230
+ }),
1231
+ stageId: Property.ShortText({
1232
+ displayName: 'Stage Id',
1233
+ description: 'Stage ID',
1234
+ required: true,
1235
+ }),
1236
+ itemId: Property.ShortText({
1237
+ displayName: 'Item Id',
1238
+ description: 'Item ID',
1239
+ required: true,
1240
+ }),
1241
+ updatedAt: Property.DateTime({
1242
+ displayName: 'Updated At',
1243
+ description: 'For optimistic concurrency — update fails if entity was modified after this timestamp',
1244
+ required: true,
1245
+ }),
1246
+ quantity: Property.Number({
1247
+ displayName: 'Quantity',
1248
+ description: '',
1249
+ required: false,
1250
+ }),
1251
+ unit: Property.ShortText({
1252
+ displayName: 'Unit',
1253
+ description: '',
1254
+ required: false,
1255
+ }),
1256
+ location: Property.ShortText({
1257
+ displayName: 'Location',
1258
+ description: '',
1259
+ required: false,
1260
+ }),
1261
+ note: Property.ShortText({
1262
+ displayName: 'Note',
1263
+ description: '',
1264
+ required: false,
1265
+ }),
1266
+ buyPrice: Property.Number({
1267
+ displayName: 'Buy Price',
1268
+ description: '',
1269
+ required: false,
1270
+ }),
1271
+ sellPrice: Property.Number({
1272
+ displayName: 'Sell Price',
1273
+ description: '',
1274
+ required: false,
1275
+ }),
1276
+ status: Property.StaticDropdown({
1277
+ displayName: 'Status',
1278
+ description: 'Status filter',
1279
+ required: false,
1280
+ options: {
1281
+ options: [
1282
+ { label: 'Normal', value: 'Normal' },
1283
+ { label: 'Variation', value: 'Variation' },
1284
+ { label: 'Cancelled', value: 'Cancelled' },
1285
+ { label: 'Deleted', value: 'Deleted' },
1286
+ ],
1287
+ },
1288
+ }),
1289
+ invoicingStatus: Property.StaticDropdown({
1290
+ displayName: 'Invoicing Status',
1291
+ description: '',
1292
+ required: false,
1293
+ options: {
1294
+ options: [
1295
+ { label: 'Billable', value: 'Billable' },
1296
+ { label: 'No Charge', value: 'No Charge' },
1297
+ { label: 'Not Billable', value: 'Not Billable' },
1298
+ ],
1299
+ },
1300
+ }),
1301
+ suppliedBySubcontractor: Property.Checkbox({
1302
+ displayName: 'Supplied By Subcontractor',
1303
+ description: '',
1304
+ required: false,
1305
+ }),
1306
+ },
1307
+ async run(context) {
1308
+ const token = await getAccessToken(context.auth);
1309
+ const baseUrl = context.auth.props.baseUrl;
1310
+
1311
+ const url = `${baseUrl}/api/v2/public/jobs/${context.propsValue.id}/stages/${context.propsValue.stageId}/items/${context.propsValue.itemId}`;
1312
+
1313
+ // Build body with only defined values (for partial updates)
1314
+ const rawBody: Record<string, unknown> = {
1315
+ updatedAt: context.propsValue.updatedAt,
1316
+ quantity: context.propsValue.quantity,
1317
+ unit: context.propsValue.unit,
1318
+ location: context.propsValue.location,
1319
+ note: context.propsValue.note,
1320
+ buyPrice: context.propsValue.buyPrice,
1321
+ sellPrice: context.propsValue.sellPrice,
1322
+ status: context.propsValue.status,
1323
+ invoicingStatus: context.propsValue.invoicingStatus,
1324
+ suppliedBySubcontractor: context.propsValue.suppliedBySubcontractor,
1325
+ };
1326
+
1327
+ const body = Object.fromEntries(
1328
+ Object.entries(rawBody).filter(([_, v]) => v !== undefined && v !== null && v !== '')
1329
+ );
1330
+ const response = await httpClient.sendRequest({
1331
+ method: HttpMethod.PATCH,
1332
+ url: `${baseUrl}/api/v2/public/jobs/${context.propsValue.id}/stages/${context.propsValue.stageId}/items/${context.propsValue.itemId}`,
1333
+ headers: {
1334
+ Authorization: `Bearer ${token}`,
1335
+ 'Content-Type': 'application/json',
1336
+ 'X-WorkBuddy-Version': '2026-01',
1337
+ },
1338
+ body: body,
1339
+ });
1340
+
1341
+ return response.body;
1342
+ },
1343
+ });
1344
+
1345
+ export const PublicApiJobController_deleteStageItem = createAction({
1346
+ name: 'PublicApiJobController_deleteStageItem',
1347
+ auth: workbuddyAuth,
1348
+ displayName: 'Delete stage item',
1349
+ description: 'Remove or cancel a stage item depending on tenant deletion settings.',
1350
+ props: {
1351
+ id: Property.ShortText({
1352
+ displayName: 'Id',
1353
+ description: 'Job ID',
1354
+ required: true,
1355
+ }),
1356
+ stageId: Property.ShortText({
1357
+ displayName: 'Stage Id',
1358
+ description: 'Stage ID',
1359
+ required: true,
1360
+ }),
1361
+ itemId: Property.ShortText({
1362
+ displayName: 'Item Id',
1363
+ description: 'Item ID',
1364
+ required: true,
1365
+ }),
1366
+ },
1367
+ async run(context) {
1368
+ const token = await getAccessToken(context.auth);
1369
+ const baseUrl = context.auth.props.baseUrl;
1370
+
1371
+ const url = `${baseUrl}/api/v2/public/jobs/${context.propsValue.id}/stages/${context.propsValue.stageId}/items/${context.propsValue.itemId}`;
1372
+
1373
+ const response = await httpClient.sendRequest({
1374
+ method: HttpMethod.DELETE,
1375
+ url: `${baseUrl}/api/v2/public/jobs/${context.propsValue.id}/stages/${context.propsValue.stageId}/items/${context.propsValue.itemId}`,
1376
+ headers: {
1377
+ Authorization: `Bearer ${token}`,
1378
+ 'Content-Type': 'application/json',
1379
+ 'X-WorkBuddy-Version': '2026-01',
1380
+ },
1381
+ });
1382
+
1383
+ return response.body;
1384
+ },
1385
+ });
@@ -1,9 +1,9 @@
1
- export declare const McpStreamableController_handleGet: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
1
+ export declare const McpV3StreamableController_handleGet: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
2
  baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
3
  clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
4
  clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
5
5
  }>, {}>;
6
- export declare const McpStreamableController_handlePost: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
6
+ export declare const McpV3StreamableController_handlePost: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
7
7
  baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
8
8
  clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
9
9
  clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
@@ -13,7 +13,7 @@ export declare const McpStreamableController_handlePost: import("@activepieces/p
13
13
  id: import("@activepieces/pieces-framework").ShortTextProperty<false>;
14
14
  params: import("@activepieces/pieces-framework").JsonProperty<false>;
15
15
  }>;
16
- export declare const McpStreamableController_handleDelete: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
16
+ export declare const McpV3StreamableController_handleDelete: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
17
17
  baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
18
18
  clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
19
19
  clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;