@workbuddy/piece-workbuddy-edge 1.0.32 → 1.0.34

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 (129) hide show
  1. package/package.json +1 -1
  2. package/src/index.d.ts.map +1 -1
  3. package/src/index.js +76 -14
  4. package/src/index.js.map +1 -1
  5. package/src/index.ts +139 -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 +7 -1
  45. package/src/lib/actions/index.d.ts.map +1 -1
  46. package/src/lib/actions/index.js +7 -1
  47. package/src/lib/actions/index.js.map +1 -1
  48. package/src/lib/actions/index.ts +7 -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 +87 -1
  65. package/src/lib/actions/jobs.d.ts.map +1 -1
  66. package/src/lib/actions/jobs.js +495 -7
  67. package/src/lib/actions/jobs.js.map +1 -1
  68. package/src/lib/actions/jobs.ts +523 -6
  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/settings-custom-fields.d.ts +21 -0
  80. package/src/lib/actions/settings-custom-fields.d.ts.map +1 -0
  81. package/src/lib/actions/settings-custom-fields.js +95 -0
  82. package/src/lib/actions/settings-custom-fields.js.map +1 -0
  83. package/src/lib/actions/settings-custom-fields.ts +107 -0
  84. package/src/lib/actions/settings-items.d.ts +136 -0
  85. package/src/lib/actions/settings-items.d.ts.map +1 -0
  86. package/src/lib/actions/settings-items.js +772 -0
  87. package/src/lib/actions/settings-items.js.map +1 -0
  88. package/src/lib/actions/settings-items.ts +818 -0
  89. package/src/lib/actions/{settings.d.ts → settings-reference-data.d.ts} +33 -10
  90. package/src/lib/actions/settings-reference-data.d.ts.map +1 -0
  91. package/src/lib/actions/settings-reference-data.js +423 -0
  92. package/src/lib/actions/settings-reference-data.js.map +1 -0
  93. package/src/lib/actions/settings-reference-data.ts +496 -0
  94. package/src/lib/actions/settings-templates.d.ts +15 -0
  95. package/src/lib/actions/settings-templates.d.ts.map +1 -0
  96. package/src/lib/actions/settings-templates.js +75 -0
  97. package/src/lib/actions/settings-templates.js.map +1 -0
  98. package/src/lib/actions/settings-templates.ts +79 -0
  99. package/src/lib/actions/stages-activities.d.ts +4 -3
  100. package/src/lib/actions/stages-activities.d.ts.map +1 -1
  101. package/src/lib/actions/stages-activities.js +19 -12
  102. package/src/lib/actions/stages-activities.js.map +1 -1
  103. package/src/lib/actions/stages-activities.ts +19 -12
  104. package/src/lib/actions/stages-pending-items.d.ts +75 -0
  105. package/src/lib/actions/stages-pending-items.d.ts.map +1 -0
  106. package/src/lib/actions/stages-pending-items.js +370 -0
  107. package/src/lib/actions/stages-pending-items.js.map +1 -0
  108. package/src/lib/actions/stages-pending-items.ts +404 -0
  109. package/src/lib/actions/stages-resources.d.ts.map +1 -1
  110. package/src/lib/actions/stages-resources.js +5 -8
  111. package/src/lib/actions/stages-resources.js.map +1 -1
  112. package/src/lib/actions/stages-resources.ts +8 -8
  113. package/src/lib/actions/stages-tasks.d.ts +0 -2
  114. package/src/lib/actions/stages-tasks.d.ts.map +1 -1
  115. package/src/lib/actions/stages-tasks.js +0 -12
  116. package/src/lib/actions/stages-tasks.js.map +1 -1
  117. package/src/lib/actions/stages-tasks.ts +0 -12
  118. package/src/lib/actions/stages.d.ts +20 -3
  119. package/src/lib/actions/stages.d.ts.map +1 -1
  120. package/src/lib/actions/stages.js +103 -21
  121. package/src/lib/actions/stages.js.map +1 -1
  122. package/src/lib/actions/stages.ts +116 -20
  123. package/src/lib/actions/webhooks-v2.js +11 -11
  124. package/src/lib/actions/webhooks-v2.js.map +1 -1
  125. package/src/lib/actions/webhooks-v2.ts +11 -11
  126. package/src/lib/actions/settings.d.ts.map +0 -1
  127. package/src/lib/actions/settings.js +0 -257
  128. package/src/lib/actions/settings.js.map +0 -1
  129. package/src/lib/actions/settings.ts +0 -301
@@ -121,6 +121,11 @@ export const PublicApiJobController_search = createAction({
121
121
  description: '',
122
122
  required: false,
123
123
  }),
124
+ integrationId: Property.Array({
125
+ displayName: 'Integration Id',
126
+ description: 'integration ID',
127
+ required: false,
128
+ }),
124
129
  resource: Property.Array({
125
130
  displayName: 'Resource',
126
131
  description: '',
@@ -222,6 +227,7 @@ export const PublicApiJobController_search = createAction({
222
227
  tag: context.propsValue.tag,
223
228
  priceBook: context.propsValue.priceBook,
224
229
  billingCompany: context.propsValue.billingCompany,
230
+ integrationId: context.propsValue.integrationId,
225
231
  resource: context.propsValue.resource,
226
232
  workCategory: context.propsValue.workCategory,
227
233
  stageStatus: context.propsValue.stageStatus,
@@ -256,11 +262,11 @@ export const PublicApiJobController_get = createAction({
256
262
  name: 'PublicApiJobController_get',
257
263
  auth: workbuddyAuth,
258
264
  displayName: 'Get job by ID or job number',
259
- description: 'Retrieve a single job by its ID or human-readable job number.',
265
+ description: 'Retrieve a single job by its ID, human-readable job number, or external integration ID.',
260
266
  props: {
261
267
  identifier: Property.ShortText({
262
268
  displayName: 'Identifier',
263
- description: 'Job ID (MongoDB ObjectId) or job number (e.g., JOB-12345)',
269
+ description: 'Job ID (MongoDB ObjectId), job number (e.g., JOB-12345), or external integration ID',
264
270
  required: true,
265
271
  }),
266
272
  },
@@ -338,6 +344,16 @@ export const PublicApiJobController_create = createAction({
338
344
  description: 'Display name',
339
345
  required: false,
340
346
  }),
347
+ integrationId: Property.ShortText({
348
+ displayName: 'Integration Id',
349
+ description: 'integration ID',
350
+ required: false,
351
+ }),
352
+ jobNumber: Property.ShortText({
353
+ displayName: 'Job Number',
354
+ description: '',
355
+ required: false,
356
+ }),
341
357
  description: Property.LongText({
342
358
  displayName: 'Description',
343
359
  description: 'Detailed description',
@@ -348,6 +364,11 @@ export const PublicApiJobController_create = createAction({
348
364
  description: 'Site ID — use /crm/sites to look up',
349
365
  required: false,
350
366
  }),
367
+ placeId: Property.ShortText({
368
+ displayName: 'Place Id',
369
+ description: 'place ID',
370
+ required: false,
371
+ }),
351
372
  site: Property.Json({
352
373
  displayName: 'Site',
353
374
  description: 'Inline site object — alternative to siteId',
@@ -418,9 +439,193 @@ export const PublicApiJobController_create = createAction({
418
439
  description: 'Customer purchase order reference',
419
440
  required: false,
420
441
  }),
442
+ startDate: Property.DateTime({
443
+ displayName: 'Start Date',
444
+ description: 'Start date (ISO 8601 datetime)',
445
+ required: false,
446
+ }),
447
+ dueDate: Property.DateTime({
448
+ displayName: 'Due Date',
449
+ description: 'Due date (ISO 8601 datetime)',
450
+ required: false,
451
+ }),
452
+ customFields: Property.Json({
453
+ displayName: 'Custom Fields',
454
+ description: 'Custom fields as key-value pairs — validated against tenant field definitions',
455
+ required: false,
456
+ }),
457
+ items: Property.Json({
458
+ displayName: 'Items',
459
+ description: '',
460
+ required: false,
461
+ defaultValue: [],
462
+ }),
463
+ },
464
+ async run(context) {
465
+ const token = await getAccessToken(context.auth);
466
+ const baseUrl = context.auth.props.baseUrl;
467
+
468
+ const url = `${baseUrl}/api/v2/public/jobs`;
469
+
470
+ const rawBody: Record<string, unknown> = {
471
+ name: context.propsValue.name,
472
+ integrationId: context.propsValue.integrationId,
473
+ jobNumber: context.propsValue.jobNumber,
474
+ description: context.propsValue.description,
475
+ customerId: context.propsValue.customerId,
476
+ siteId: context.propsValue.siteId,
477
+ placeId: context.propsValue.placeId,
478
+ site: context.propsValue.site,
479
+ contactId: context.propsValue.contactId,
480
+ contact: context.propsValue.contact,
481
+ typeId: context.propsValue.typeId,
482
+ priorityId: context.propsValue.priorityId,
483
+ priceBookId: context.propsValue.priceBookId,
484
+ ownerId: context.propsValue.ownerId,
485
+ fieldSupervisorId: context.propsValue.fieldSupervisorId,
486
+ zoneId: context.propsValue.zoneId,
487
+ tagIds: context.propsValue.tagIds,
488
+ notes: context.propsValue.notes,
489
+ reference: context.propsValue.reference,
490
+ customerWO: context.propsValue.customerWO,
491
+ customerPO: context.propsValue.customerPO,
492
+ startDate: context.propsValue.startDate,
493
+ dueDate: context.propsValue.dueDate,
494
+ customFields: context.propsValue.customFields,
495
+ items: context.propsValue.items,
496
+ };
497
+
498
+ const body = rawBody;
499
+ const response = await httpClient.sendRequest({
500
+ method: HttpMethod.POST,
501
+ url: `${baseUrl}/api/v2/public/jobs`,
502
+ headers: {
503
+ Authorization: `Bearer ${token}`,
504
+ 'Content-Type': 'application/json',
505
+ 'X-WorkBuddy-Version': '2026-01',
506
+ },
507
+ body: body,
508
+ });
509
+
510
+ return response.body;
511
+ },
512
+ });
513
+
514
+ export const PublicApiJobController_createFromTemplate = createAction({
515
+ name: 'PublicApiJobController_createFromTemplate',
516
+ auth: workbuddyAuth,
517
+ displayName: 'Create a new job from template',
518
+ description:
519
+ 'Create a job using a job template. Template-owned fields win over request values before final job validation.',
520
+ props: {
421
521
  templateId: Property.ShortText({
422
522
  displayName: 'Template Id',
423
- description: 'Template ID to pre-populate fields from a template',
523
+ description: 'Job template ID',
524
+ required: true,
525
+ }),
526
+ customerId: Property.ShortText({
527
+ displayName: 'Customer Id',
528
+ description: 'Customer ID — use /crm/customers to look up',
529
+ required: true,
530
+ }),
531
+ name: Property.ShortText({
532
+ displayName: 'Name',
533
+ description: 'Display name',
534
+ required: false,
535
+ }),
536
+ integrationId: Property.ShortText({
537
+ displayName: 'Integration Id',
538
+ description: 'integration ID',
539
+ required: false,
540
+ }),
541
+ jobNumber: Property.ShortText({
542
+ displayName: 'Job Number',
543
+ description: '',
544
+ required: false,
545
+ }),
546
+ description: Property.LongText({
547
+ displayName: 'Description',
548
+ description: 'Detailed description',
549
+ required: false,
550
+ }),
551
+ siteId: Property.ShortText({
552
+ displayName: 'Site Id',
553
+ description: 'Site ID — use /crm/sites to look up',
554
+ required: false,
555
+ }),
556
+ placeId: Property.ShortText({
557
+ displayName: 'Place Id',
558
+ description: 'place ID',
559
+ required: false,
560
+ }),
561
+ site: Property.Json({
562
+ displayName: 'Site',
563
+ description: 'Inline site object — alternative to siteId',
564
+ required: false,
565
+ }),
566
+ contactId: Property.ShortText({
567
+ displayName: 'Contact Id',
568
+ description: 'Contact ID — use /crm/contacts to look up',
569
+ required: false,
570
+ }),
571
+ contact: Property.Json({
572
+ displayName: 'Contact',
573
+ description: 'Inline contact object — alternative to contactId',
574
+ required: false,
575
+ }),
576
+ typeId: Property.ShortText({
577
+ displayName: 'Type Id',
578
+ description: 'Job type ID — use /settings/job-types to look up',
579
+ required: false,
580
+ }),
581
+ priorityId: Property.ShortText({
582
+ displayName: 'Priority Id',
583
+ description: 'Priority ID — use /settings/priorities to look up',
584
+ required: false,
585
+ }),
586
+ priceBookId: Property.ShortText({
587
+ displayName: 'Price Book Id',
588
+ description: 'Price book ID for job pricing',
589
+ required: false,
590
+ }),
591
+ ownerId: Property.ShortText({
592
+ displayName: 'Owner Id',
593
+ description: 'Owner (employee) ID — use /crm/employees to look up',
594
+ required: false,
595
+ }),
596
+ fieldSupervisorId: Property.ShortText({
597
+ displayName: 'Field Supervisor Id',
598
+ description: 'Field supervisor (employee) ID — use /crm/employees to look up',
599
+ required: false,
600
+ }),
601
+ zoneId: Property.ShortText({
602
+ displayName: 'Zone Id',
603
+ description: 'Zone ID — use /settings/zones to look up',
604
+ required: false,
605
+ }),
606
+ tagIds: Property.Array({
607
+ displayName: 'Tag Ids',
608
+ description: 'Array of tag IDs (comma-separated, e.g. "id1,id2") — use /settings/tags to look up',
609
+ required: false,
610
+ }),
611
+ notes: Property.LongText({
612
+ displayName: 'Notes',
613
+ description: 'Additional notes or comments',
614
+ required: false,
615
+ }),
616
+ reference: Property.ShortText({
617
+ displayName: 'Reference',
618
+ description: 'External reference number',
619
+ required: false,
620
+ }),
621
+ customerWO: Property.ShortText({
622
+ displayName: 'Customer W O',
623
+ description: 'Customer work order reference',
624
+ required: false,
625
+ }),
626
+ customerPO: Property.ShortText({
627
+ displayName: 'Customer P O',
628
+ description: 'Customer purchase order reference',
424
629
  required: false,
425
630
  }),
426
631
  startDate: Property.DateTime({
@@ -438,18 +643,27 @@ export const PublicApiJobController_create = createAction({
438
643
  description: 'Custom fields as key-value pairs — validated against tenant field definitions',
439
644
  required: false,
440
645
  }),
646
+ items: Property.Json({
647
+ displayName: 'Items',
648
+ description: '',
649
+ required: false,
650
+ defaultValue: [],
651
+ }),
441
652
  },
442
653
  async run(context) {
443
654
  const token = await getAccessToken(context.auth);
444
655
  const baseUrl = context.auth.props.baseUrl;
445
656
 
446
- const url = `${baseUrl}/api/v2/public/jobs`;
657
+ const url = `${baseUrl}/api/v2/public/jobs/template/${context.propsValue.templateId}`;
447
658
 
448
659
  const rawBody: Record<string, unknown> = {
449
660
  name: context.propsValue.name,
661
+ integrationId: context.propsValue.integrationId,
662
+ jobNumber: context.propsValue.jobNumber,
450
663
  description: context.propsValue.description,
451
664
  customerId: context.propsValue.customerId,
452
665
  siteId: context.propsValue.siteId,
666
+ placeId: context.propsValue.placeId,
453
667
  site: context.propsValue.site,
454
668
  contactId: context.propsValue.contactId,
455
669
  contact: context.propsValue.contact,
@@ -464,16 +678,91 @@ export const PublicApiJobController_create = createAction({
464
678
  reference: context.propsValue.reference,
465
679
  customerWO: context.propsValue.customerWO,
466
680
  customerPO: context.propsValue.customerPO,
467
- templateId: context.propsValue.templateId,
468
681
  startDate: context.propsValue.startDate,
469
682
  dueDate: context.propsValue.dueDate,
470
683
  customFields: context.propsValue.customFields,
684
+ items: context.propsValue.items,
471
685
  };
472
686
 
473
687
  const body = rawBody;
474
688
  const response = await httpClient.sendRequest({
475
689
  method: HttpMethod.POST,
476
- url: `${baseUrl}/api/v2/public/jobs`,
690
+ url: `${baseUrl}/api/v2/public/jobs/template/${context.propsValue.templateId}`,
691
+ headers: {
692
+ Authorization: `Bearer ${token}`,
693
+ 'Content-Type': 'application/json',
694
+ 'X-WorkBuddy-Version': '2026-01',
695
+ },
696
+ body: body,
697
+ });
698
+
699
+ return response.body;
700
+ },
701
+ });
702
+
703
+ export const PublicApiJobController_updateStatus = createAction({
704
+ name: 'PublicApiJobController_updateStatus',
705
+ auth: workbuddyAuth,
706
+ displayName: 'Update job status',
707
+ description: 'Change an existing job status and cascade the change to stages through the job domain command.',
708
+ props: {
709
+ id: Property.ShortText({
710
+ displayName: 'Id',
711
+ description: 'Job ID',
712
+ required: true,
713
+ }),
714
+ status: Property.StaticDropdown({
715
+ displayName: 'Status',
716
+ description: 'Status filter',
717
+ required: true,
718
+ options: {
719
+ options: [
720
+ { label: 'open', value: 'open' },
721
+ { label: 'in_progress', value: 'in_progress' },
722
+ { label: 'on_hold', value: 'on_hold' },
723
+ { label: 'completed', value: 'completed' },
724
+ { label: 'finalised', value: 'finalised' },
725
+ { label: 'closed', value: 'closed' },
726
+ { label: 'cancelled', value: 'cancelled' },
727
+ ],
728
+ },
729
+ }),
730
+ updatedAt: Property.DateTime({
731
+ displayName: 'Updated At',
732
+ description: 'For optimistic concurrency — update fails if entity was modified after this timestamp',
733
+ required: false,
734
+ }),
735
+ note: Property.ShortText({
736
+ displayName: 'Note',
737
+ description: '',
738
+ required: false,
739
+ }),
740
+ reason: Property.ShortText({
741
+ displayName: 'Reason',
742
+ description: 'Reason for the action (e.g. cancellation reason)',
743
+ required: false,
744
+ }),
745
+ },
746
+ async run(context) {
747
+ const token = await getAccessToken(context.auth);
748
+ const baseUrl = context.auth.props.baseUrl;
749
+
750
+ const url = `${baseUrl}/api/v2/public/jobs/${context.propsValue.id}/status`;
751
+
752
+ // Build body with only defined values (for partial updates)
753
+ const rawBody: Record<string, unknown> = {
754
+ updatedAt: context.propsValue.updatedAt,
755
+ status: context.propsValue.status,
756
+ note: context.propsValue.note,
757
+ reason: context.propsValue.reason,
758
+ };
759
+
760
+ const body = Object.fromEntries(
761
+ Object.entries(rawBody).filter(([_, v]) => v !== undefined && v !== null && v !== '')
762
+ );
763
+ const response = await httpClient.sendRequest({
764
+ method: HttpMethod.PATCH,
765
+ url: `${baseUrl}/api/v2/public/jobs/${context.propsValue.id}/status`,
477
766
  headers: {
478
767
  Authorization: `Bearer ${token}`,
479
768
  'Content-Type': 'application/json',
@@ -507,6 +796,11 @@ export const PublicApiJobController_update = createAction({
507
796
  description: 'Display name',
508
797
  required: false,
509
798
  }),
799
+ integrationId: Property.ShortText({
800
+ displayName: 'Integration Id',
801
+ description: 'integration ID',
802
+ required: false,
803
+ }),
510
804
  description: Property.LongText({
511
805
  displayName: 'Description',
512
806
  description: 'Detailed description',
@@ -613,6 +907,7 @@ export const PublicApiJobController_update = createAction({
613
907
  const rawBody: Record<string, unknown> = {
614
908
  updatedAt: context.propsValue.updatedAt,
615
909
  name: context.propsValue.name,
910
+ integrationId: context.propsValue.integrationId,
616
911
  description: context.propsValue.description,
617
912
  siteId: context.propsValue.siteId,
618
913
  contactId: context.propsValue.contactId,
@@ -845,6 +1140,61 @@ export const PublicApiJobController_getStageItems = createAction({
845
1140
  },
846
1141
  });
847
1142
 
1143
+ export const PublicApiJobController_createStageItems = createAction({
1144
+ name: 'PublicApiJobController_createStageItems',
1145
+ auth: workbuddyAuth,
1146
+ displayName: 'Create stage items',
1147
+ description: 'Add one or more catalogue-backed line items to a stage.',
1148
+ props: {
1149
+ id: Property.ShortText({
1150
+ displayName: 'Id',
1151
+ description: 'Job ID',
1152
+ required: true,
1153
+ }),
1154
+ stageId: Property.ShortText({
1155
+ displayName: 'Stage Id',
1156
+ description: 'Stage ID',
1157
+ required: true,
1158
+ }),
1159
+ updatedAt: Property.DateTime({
1160
+ displayName: 'Updated At',
1161
+ description: 'For optimistic concurrency — update fails if entity was modified after this timestamp',
1162
+ required: true,
1163
+ }),
1164
+ items: Property.Json({
1165
+ displayName: 'Items',
1166
+ description: '',
1167
+ required: true,
1168
+ defaultValue: [],
1169
+ }),
1170
+ },
1171
+ async run(context) {
1172
+ const token = await getAccessToken(context.auth);
1173
+ const baseUrl = context.auth.props.baseUrl;
1174
+
1175
+ const url = `${baseUrl}/api/v2/public/jobs/${context.propsValue.id}/stages/${context.propsValue.stageId}/items`;
1176
+
1177
+ const rawBody: Record<string, unknown> = {
1178
+ updatedAt: context.propsValue.updatedAt,
1179
+ items: context.propsValue.items,
1180
+ };
1181
+
1182
+ const body = rawBody;
1183
+ const response = await httpClient.sendRequest({
1184
+ method: HttpMethod.POST,
1185
+ url: `${baseUrl}/api/v2/public/jobs/${context.propsValue.id}/stages/${context.propsValue.stageId}/items`,
1186
+ headers: {
1187
+ Authorization: `Bearer ${token}`,
1188
+ 'Content-Type': 'application/json',
1189
+ 'X-WorkBuddy-Version': '2026-01',
1190
+ },
1191
+ body: body,
1192
+ });
1193
+
1194
+ return response.body;
1195
+ },
1196
+ });
1197
+
848
1198
  export const PublicApiJobController_getStageItem = createAction({
849
1199
  name: 'PublicApiJobController_getStageItem',
850
1200
  auth: workbuddyAuth,
@@ -886,3 +1236,170 @@ export const PublicApiJobController_getStageItem = createAction({
886
1236
  return response.body;
887
1237
  },
888
1238
  });
1239
+
1240
+ export const PublicApiJobController_updateStageItem = createAction({
1241
+ name: 'PublicApiJobController_updateStageItem',
1242
+ auth: workbuddyAuth,
1243
+ displayName: 'Update stage item',
1244
+ description: 'Update mutable fields on a stage line item.',
1245
+ props: {
1246
+ id: Property.ShortText({
1247
+ displayName: 'Id',
1248
+ description: 'Job ID',
1249
+ required: true,
1250
+ }),
1251
+ stageId: Property.ShortText({
1252
+ displayName: 'Stage Id',
1253
+ description: 'Stage ID',
1254
+ required: true,
1255
+ }),
1256
+ itemId: Property.ShortText({
1257
+ displayName: 'Item Id',
1258
+ description: 'Item ID',
1259
+ required: true,
1260
+ }),
1261
+ updatedAt: Property.DateTime({
1262
+ displayName: 'Updated At',
1263
+ description: 'For optimistic concurrency — update fails if entity was modified after this timestamp',
1264
+ required: true,
1265
+ }),
1266
+ quantity: Property.Number({
1267
+ displayName: 'Quantity',
1268
+ description: '',
1269
+ required: false,
1270
+ }),
1271
+ unit: Property.ShortText({
1272
+ displayName: 'Unit',
1273
+ description: '',
1274
+ required: false,
1275
+ }),
1276
+ location: Property.ShortText({
1277
+ displayName: 'Location',
1278
+ description: '',
1279
+ required: false,
1280
+ }),
1281
+ note: Property.ShortText({
1282
+ displayName: 'Note',
1283
+ description: '',
1284
+ required: false,
1285
+ }),
1286
+ buyPrice: Property.Number({
1287
+ displayName: 'Buy Price',
1288
+ description: '',
1289
+ required: false,
1290
+ }),
1291
+ sellPrice: Property.Number({
1292
+ displayName: 'Sell Price',
1293
+ description: '',
1294
+ required: false,
1295
+ }),
1296
+ status: Property.StaticDropdown({
1297
+ displayName: 'Status',
1298
+ description: 'Status filter',
1299
+ required: false,
1300
+ options: {
1301
+ options: [
1302
+ { label: 'Normal', value: 'Normal' },
1303
+ { label: 'Variation', value: 'Variation' },
1304
+ { label: 'Cancelled', value: 'Cancelled' },
1305
+ { label: 'Deleted', value: 'Deleted' },
1306
+ ],
1307
+ },
1308
+ }),
1309
+ invoicingStatus: Property.StaticDropdown({
1310
+ displayName: 'Invoicing Status',
1311
+ description: '',
1312
+ required: false,
1313
+ options: {
1314
+ options: [
1315
+ { label: 'Billable', value: 'Billable' },
1316
+ { label: 'No Charge', value: 'No Charge' },
1317
+ { label: 'Not Billable', value: 'Not Billable' },
1318
+ ],
1319
+ },
1320
+ }),
1321
+ suppliedBySubcontractor: Property.Checkbox({
1322
+ displayName: 'Supplied By Subcontractor',
1323
+ description: '',
1324
+ required: false,
1325
+ }),
1326
+ },
1327
+ async run(context) {
1328
+ const token = await getAccessToken(context.auth);
1329
+ const baseUrl = context.auth.props.baseUrl;
1330
+
1331
+ const url = `${baseUrl}/api/v2/public/jobs/${context.propsValue.id}/stages/${context.propsValue.stageId}/items/${context.propsValue.itemId}`;
1332
+
1333
+ // Build body with only defined values (for partial updates)
1334
+ const rawBody: Record<string, unknown> = {
1335
+ updatedAt: context.propsValue.updatedAt,
1336
+ quantity: context.propsValue.quantity,
1337
+ unit: context.propsValue.unit,
1338
+ location: context.propsValue.location,
1339
+ note: context.propsValue.note,
1340
+ buyPrice: context.propsValue.buyPrice,
1341
+ sellPrice: context.propsValue.sellPrice,
1342
+ status: context.propsValue.status,
1343
+ invoicingStatus: context.propsValue.invoicingStatus,
1344
+ suppliedBySubcontractor: context.propsValue.suppliedBySubcontractor,
1345
+ };
1346
+
1347
+ const body = Object.fromEntries(
1348
+ Object.entries(rawBody).filter(([_, v]) => v !== undefined && v !== null && v !== '')
1349
+ );
1350
+ const response = await httpClient.sendRequest({
1351
+ method: HttpMethod.PATCH,
1352
+ url: `${baseUrl}/api/v2/public/jobs/${context.propsValue.id}/stages/${context.propsValue.stageId}/items/${context.propsValue.itemId}`,
1353
+ headers: {
1354
+ Authorization: `Bearer ${token}`,
1355
+ 'Content-Type': 'application/json',
1356
+ 'X-WorkBuddy-Version': '2026-01',
1357
+ },
1358
+ body: body,
1359
+ });
1360
+
1361
+ return response.body;
1362
+ },
1363
+ });
1364
+
1365
+ export const PublicApiJobController_deleteStageItem = createAction({
1366
+ name: 'PublicApiJobController_deleteStageItem',
1367
+ auth: workbuddyAuth,
1368
+ displayName: 'Delete stage item',
1369
+ description: 'Remove or cancel a stage item depending on tenant deletion settings.',
1370
+ props: {
1371
+ id: Property.ShortText({
1372
+ displayName: 'Id',
1373
+ description: 'Job ID',
1374
+ required: true,
1375
+ }),
1376
+ stageId: Property.ShortText({
1377
+ displayName: 'Stage Id',
1378
+ description: 'Stage ID',
1379
+ required: true,
1380
+ }),
1381
+ itemId: Property.ShortText({
1382
+ displayName: 'Item Id',
1383
+ description: 'Item ID',
1384
+ required: true,
1385
+ }),
1386
+ },
1387
+ async run(context) {
1388
+ const token = await getAccessToken(context.auth);
1389
+ const baseUrl = context.auth.props.baseUrl;
1390
+
1391
+ const url = `${baseUrl}/api/v2/public/jobs/${context.propsValue.id}/stages/${context.propsValue.stageId}/items/${context.propsValue.itemId}`;
1392
+
1393
+ const response = await httpClient.sendRequest({
1394
+ method: HttpMethod.DELETE,
1395
+ url: `${baseUrl}/api/v2/public/jobs/${context.propsValue.id}/stages/${context.propsValue.stageId}/items/${context.propsValue.itemId}`,
1396
+ headers: {
1397
+ Authorization: `Bearer ${token}`,
1398
+ 'Content-Type': 'application/json',
1399
+ 'X-WorkBuddy-Version': '2026-01',
1400
+ },
1401
+ });
1402
+
1403
+ return response.body;
1404
+ },
1405
+ });
@@ -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>;
@@ -1 +1 @@
1
- {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["mcp.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iCAAiC;;;;OAwB5C,CAAC;AAEH,eAAO,MAAM,kCAAkC;;;;;;;;;EAyD7C,CAAC;AAEH,eAAO,MAAM,oCAAoC;;;;OAwB/C,CAAC"}
1
+ {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["mcp.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,mCAAmC;;;;OAwB9C,CAAC;AAEH,eAAO,MAAM,oCAAoC;;;;;;;;;EAyD/C,CAAC;AAEH,eAAO,MAAM,sCAAsC;;;;OAwBjD,CAAC"}