@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.
- package/package.json +1 -1
- package/src/index.d.ts.map +1 -1
- package/src/index.js +76 -14
- package/src/index.js.map +1 -1
- package/src/index.ts +139 -10
- package/src/lib/actions/crm-companies.d.ts +1 -0
- package/src/lib/actions/crm-companies.d.ts.map +1 -1
- package/src/lib/actions/crm-companies.js +9 -0
- package/src/lib/actions/crm-companies.js.map +1 -1
- package/src/lib/actions/crm-companies.ts +11 -0
- package/src/lib/actions/crm-contacts.d.ts +25 -0
- package/src/lib/actions/crm-contacts.d.ts.map +1 -1
- package/src/lib/actions/crm-contacts.js +135 -3
- package/src/lib/actions/crm-contacts.js.map +1 -1
- package/src/lib/actions/crm-contacts.ts +149 -2
- package/src/lib/actions/crm-contractors.d.ts +110 -0
- package/src/lib/actions/crm-contractors.d.ts.map +1 -1
- package/src/lib/actions/crm-contractors.js +585 -2
- package/src/lib/actions/crm-contractors.js.map +1 -1
- package/src/lib/actions/crm-contractors.ts +631 -1
- package/src/lib/actions/crm-customers.d.ts +94 -0
- package/src/lib/actions/crm-customers.d.ts.map +1 -1
- package/src/lib/actions/crm-customers.js +504 -3
- package/src/lib/actions/crm-customers.js.map +1 -1
- package/src/lib/actions/crm-customers.ts +545 -2
- package/src/lib/actions/crm-external-users.js +1 -1
- package/src/lib/actions/crm-external-users.js.map +1 -1
- package/src/lib/actions/crm-external-users.ts +1 -1
- package/src/lib/actions/crm-invites.d.ts +1 -0
- package/src/lib/actions/crm-invites.d.ts.map +1 -1
- package/src/lib/actions/crm-invites.js +9 -0
- package/src/lib/actions/crm-invites.js.map +1 -1
- package/src/lib/actions/crm-invites.ts +11 -0
- package/src/lib/actions/crm-sites.d.ts +10 -0
- package/src/lib/actions/crm-sites.d.ts.map +1 -1
- package/src/lib/actions/crm-sites.js +59 -3
- package/src/lib/actions/crm-sites.js.map +1 -1
- package/src/lib/actions/crm-sites.ts +70 -2
- package/src/lib/actions/crm-suppliers.d.ts +64 -0
- package/src/lib/actions/crm-suppliers.d.ts.map +1 -1
- package/src/lib/actions/crm-suppliers.js +352 -2
- package/src/lib/actions/crm-suppliers.js.map +1 -1
- package/src/lib/actions/crm-suppliers.ts +376 -1
- package/src/lib/actions/index.d.ts +7 -1
- package/src/lib/actions/index.d.ts.map +1 -1
- package/src/lib/actions/index.js +7 -1
- package/src/lib/actions/index.js.map +1 -1
- package/src/lib/actions/index.ts +7 -1
- package/src/lib/actions/items.d.ts +8 -0
- package/src/lib/actions/items.d.ts.map +1 -0
- package/src/lib/actions/items.js +42 -0
- package/src/lib/actions/items.js.map +1 -0
- package/src/lib/actions/items.ts +45 -0
- package/src/lib/actions/jobs-activities.d.ts +4 -3
- package/src/lib/actions/jobs-activities.d.ts.map +1 -1
- package/src/lib/actions/jobs-activities.js +19 -12
- package/src/lib/actions/jobs-activities.js.map +1 -1
- package/src/lib/actions/jobs-activities.ts +19 -12
- package/src/lib/actions/jobs-tasks.d.ts +0 -2
- package/src/lib/actions/jobs-tasks.d.ts.map +1 -1
- package/src/lib/actions/jobs-tasks.js +0 -12
- package/src/lib/actions/jobs-tasks.js.map +1 -1
- package/src/lib/actions/jobs-tasks.ts +0 -12
- package/src/lib/actions/jobs.d.ts +87 -1
- package/src/lib/actions/jobs.d.ts.map +1 -1
- package/src/lib/actions/jobs.js +495 -7
- package/src/lib/actions/jobs.js.map +1 -1
- package/src/lib/actions/jobs.ts +523 -6
- package/src/lib/actions/mcp.d.ts +3 -3
- package/src/lib/actions/mcp.d.ts.map +1 -1
- package/src/lib/actions/mcp.js +9 -9
- package/src/lib/actions/mcp.js.map +1 -1
- package/src/lib/actions/mcp.ts +8 -8
- package/src/lib/actions/pending-items.d.ts +8 -0
- package/src/lib/actions/pending-items.d.ts.map +1 -0
- package/src/lib/actions/pending-items.js +42 -0
- package/src/lib/actions/pending-items.js.map +1 -0
- package/src/lib/actions/pending-items.ts +45 -0
- package/src/lib/actions/settings-custom-fields.d.ts +21 -0
- package/src/lib/actions/settings-custom-fields.d.ts.map +1 -0
- package/src/lib/actions/settings-custom-fields.js +95 -0
- package/src/lib/actions/settings-custom-fields.js.map +1 -0
- package/src/lib/actions/settings-custom-fields.ts +107 -0
- package/src/lib/actions/settings-items.d.ts +136 -0
- package/src/lib/actions/settings-items.d.ts.map +1 -0
- package/src/lib/actions/settings-items.js +772 -0
- package/src/lib/actions/settings-items.js.map +1 -0
- package/src/lib/actions/settings-items.ts +818 -0
- package/src/lib/actions/{settings.d.ts → settings-reference-data.d.ts} +33 -10
- package/src/lib/actions/settings-reference-data.d.ts.map +1 -0
- package/src/lib/actions/settings-reference-data.js +423 -0
- package/src/lib/actions/settings-reference-data.js.map +1 -0
- package/src/lib/actions/settings-reference-data.ts +496 -0
- package/src/lib/actions/settings-templates.d.ts +15 -0
- package/src/lib/actions/settings-templates.d.ts.map +1 -0
- package/src/lib/actions/settings-templates.js +75 -0
- package/src/lib/actions/settings-templates.js.map +1 -0
- package/src/lib/actions/settings-templates.ts +79 -0
- package/src/lib/actions/stages-activities.d.ts +4 -3
- package/src/lib/actions/stages-activities.d.ts.map +1 -1
- package/src/lib/actions/stages-activities.js +19 -12
- package/src/lib/actions/stages-activities.js.map +1 -1
- package/src/lib/actions/stages-activities.ts +19 -12
- package/src/lib/actions/stages-pending-items.d.ts +75 -0
- package/src/lib/actions/stages-pending-items.d.ts.map +1 -0
- package/src/lib/actions/stages-pending-items.js +370 -0
- package/src/lib/actions/stages-pending-items.js.map +1 -0
- package/src/lib/actions/stages-pending-items.ts +404 -0
- package/src/lib/actions/stages-resources.d.ts.map +1 -1
- package/src/lib/actions/stages-resources.js +5 -8
- package/src/lib/actions/stages-resources.js.map +1 -1
- package/src/lib/actions/stages-resources.ts +8 -8
- package/src/lib/actions/stages-tasks.d.ts +0 -2
- package/src/lib/actions/stages-tasks.d.ts.map +1 -1
- package/src/lib/actions/stages-tasks.js +0 -12
- package/src/lib/actions/stages-tasks.js.map +1 -1
- package/src/lib/actions/stages-tasks.ts +0 -12
- package/src/lib/actions/stages.d.ts +20 -3
- package/src/lib/actions/stages.d.ts.map +1 -1
- package/src/lib/actions/stages.js +103 -21
- package/src/lib/actions/stages.js.map +1 -1
- package/src/lib/actions/stages.ts +116 -20
- package/src/lib/actions/webhooks-v2.js +11 -11
- package/src/lib/actions/webhooks-v2.js.map +1 -1
- package/src/lib/actions/webhooks-v2.ts +11 -11
- package/src/lib/actions/settings.d.ts.map +0 -1
- package/src/lib/actions/settings.js +0 -257
- package/src/lib/actions/settings.js.map +0 -1
- package/src/lib/actions/settings.ts +0 -301
package/src/lib/actions/jobs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PublicApiJobController_getStageItem = exports.PublicApiJobController_getStageItems = exports.PublicApiJobController_getJobStage = exports.PublicApiJobController_getJobStages = exports.PublicApiJobController_dispatch = exports.PublicApiJobController_update = exports.PublicApiJobController_create = exports.PublicApiJobController_delete = exports.PublicApiJobController_get = exports.PublicApiJobController_search = void 0;
|
|
3
|
+
exports.PublicApiJobController_deleteStageItem = exports.PublicApiJobController_updateStageItem = exports.PublicApiJobController_getStageItem = exports.PublicApiJobController_createStageItems = exports.PublicApiJobController_getStageItems = exports.PublicApiJobController_getJobStage = exports.PublicApiJobController_getJobStages = exports.PublicApiJobController_dispatch = exports.PublicApiJobController_update = exports.PublicApiJobController_updateStatus = exports.PublicApiJobController_createFromTemplate = exports.PublicApiJobController_create = exports.PublicApiJobController_delete = exports.PublicApiJobController_get = exports.PublicApiJobController_search = void 0;
|
|
4
4
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
5
|
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
6
|
const auth_1 = require("../auth");
|
|
@@ -122,6 +122,11 @@ exports.PublicApiJobController_search = (0, pieces_framework_1.createAction)({
|
|
|
122
122
|
description: '',
|
|
123
123
|
required: false,
|
|
124
124
|
}),
|
|
125
|
+
integrationId: pieces_framework_1.Property.Array({
|
|
126
|
+
displayName: 'Integration Id',
|
|
127
|
+
description: 'integration ID',
|
|
128
|
+
required: false,
|
|
129
|
+
}),
|
|
125
130
|
resource: pieces_framework_1.Property.Array({
|
|
126
131
|
displayName: 'Resource',
|
|
127
132
|
description: '',
|
|
@@ -221,6 +226,7 @@ exports.PublicApiJobController_search = (0, pieces_framework_1.createAction)({
|
|
|
221
226
|
tag: context.propsValue.tag,
|
|
222
227
|
priceBook: context.propsValue.priceBook,
|
|
223
228
|
billingCompany: context.propsValue.billingCompany,
|
|
229
|
+
integrationId: context.propsValue.integrationId,
|
|
224
230
|
resource: context.propsValue.resource,
|
|
225
231
|
workCategory: context.propsValue.workCategory,
|
|
226
232
|
stageStatus: context.propsValue.stageStatus,
|
|
@@ -252,11 +258,11 @@ exports.PublicApiJobController_get = (0, pieces_framework_1.createAction)({
|
|
|
252
258
|
name: 'PublicApiJobController_get',
|
|
253
259
|
auth: auth_1.workbuddyAuth,
|
|
254
260
|
displayName: 'Get job by ID or job number',
|
|
255
|
-
description: 'Retrieve a single job by its ID
|
|
261
|
+
description: 'Retrieve a single job by its ID, human-readable job number, or external integration ID.',
|
|
256
262
|
props: {
|
|
257
263
|
identifier: pieces_framework_1.Property.ShortText({
|
|
258
264
|
displayName: 'Identifier',
|
|
259
|
-
description: 'Job ID (MongoDB ObjectId)
|
|
265
|
+
description: 'Job ID (MongoDB ObjectId), job number (e.g., JOB-12345), or external integration ID',
|
|
260
266
|
required: true,
|
|
261
267
|
}),
|
|
262
268
|
},
|
|
@@ -325,6 +331,16 @@ exports.PublicApiJobController_create = (0, pieces_framework_1.createAction)({
|
|
|
325
331
|
description: 'Display name',
|
|
326
332
|
required: false,
|
|
327
333
|
}),
|
|
334
|
+
integrationId: pieces_framework_1.Property.ShortText({
|
|
335
|
+
displayName: 'Integration Id',
|
|
336
|
+
description: 'integration ID',
|
|
337
|
+
required: false,
|
|
338
|
+
}),
|
|
339
|
+
jobNumber: pieces_framework_1.Property.ShortText({
|
|
340
|
+
displayName: 'Job Number',
|
|
341
|
+
description: '',
|
|
342
|
+
required: false,
|
|
343
|
+
}),
|
|
328
344
|
description: pieces_framework_1.Property.LongText({
|
|
329
345
|
displayName: 'Description',
|
|
330
346
|
description: 'Detailed description',
|
|
@@ -335,6 +351,11 @@ exports.PublicApiJobController_create = (0, pieces_framework_1.createAction)({
|
|
|
335
351
|
description: 'Site ID — use /crm/sites to look up',
|
|
336
352
|
required: false,
|
|
337
353
|
}),
|
|
354
|
+
placeId: pieces_framework_1.Property.ShortText({
|
|
355
|
+
displayName: 'Place Id',
|
|
356
|
+
description: 'place ID',
|
|
357
|
+
required: false,
|
|
358
|
+
}),
|
|
338
359
|
site: pieces_framework_1.Property.Json({
|
|
339
360
|
displayName: 'Site',
|
|
340
361
|
description: 'Inline site object — alternative to siteId',
|
|
@@ -405,9 +426,187 @@ exports.PublicApiJobController_create = (0, pieces_framework_1.createAction)({
|
|
|
405
426
|
description: 'Customer purchase order reference',
|
|
406
427
|
required: false,
|
|
407
428
|
}),
|
|
429
|
+
startDate: pieces_framework_1.Property.DateTime({
|
|
430
|
+
displayName: 'Start Date',
|
|
431
|
+
description: 'Start date (ISO 8601 datetime)',
|
|
432
|
+
required: false,
|
|
433
|
+
}),
|
|
434
|
+
dueDate: pieces_framework_1.Property.DateTime({
|
|
435
|
+
displayName: 'Due Date',
|
|
436
|
+
description: 'Due date (ISO 8601 datetime)',
|
|
437
|
+
required: false,
|
|
438
|
+
}),
|
|
439
|
+
customFields: pieces_framework_1.Property.Json({
|
|
440
|
+
displayName: 'Custom Fields',
|
|
441
|
+
description: 'Custom fields as key-value pairs — validated against tenant field definitions',
|
|
442
|
+
required: false,
|
|
443
|
+
}),
|
|
444
|
+
items: pieces_framework_1.Property.Json({
|
|
445
|
+
displayName: 'Items',
|
|
446
|
+
description: '',
|
|
447
|
+
required: false,
|
|
448
|
+
defaultValue: [],
|
|
449
|
+
}),
|
|
450
|
+
},
|
|
451
|
+
async run(context) {
|
|
452
|
+
const token = await (0, auth_1.getAccessToken)(context.auth);
|
|
453
|
+
const baseUrl = context.auth.props.baseUrl;
|
|
454
|
+
const url = `${baseUrl}/api/v2/public/jobs`;
|
|
455
|
+
const rawBody = {
|
|
456
|
+
name: context.propsValue.name,
|
|
457
|
+
integrationId: context.propsValue.integrationId,
|
|
458
|
+
jobNumber: context.propsValue.jobNumber,
|
|
459
|
+
description: context.propsValue.description,
|
|
460
|
+
customerId: context.propsValue.customerId,
|
|
461
|
+
siteId: context.propsValue.siteId,
|
|
462
|
+
placeId: context.propsValue.placeId,
|
|
463
|
+
site: context.propsValue.site,
|
|
464
|
+
contactId: context.propsValue.contactId,
|
|
465
|
+
contact: context.propsValue.contact,
|
|
466
|
+
typeId: context.propsValue.typeId,
|
|
467
|
+
priorityId: context.propsValue.priorityId,
|
|
468
|
+
priceBookId: context.propsValue.priceBookId,
|
|
469
|
+
ownerId: context.propsValue.ownerId,
|
|
470
|
+
fieldSupervisorId: context.propsValue.fieldSupervisorId,
|
|
471
|
+
zoneId: context.propsValue.zoneId,
|
|
472
|
+
tagIds: context.propsValue.tagIds,
|
|
473
|
+
notes: context.propsValue.notes,
|
|
474
|
+
reference: context.propsValue.reference,
|
|
475
|
+
customerWO: context.propsValue.customerWO,
|
|
476
|
+
customerPO: context.propsValue.customerPO,
|
|
477
|
+
startDate: context.propsValue.startDate,
|
|
478
|
+
dueDate: context.propsValue.dueDate,
|
|
479
|
+
customFields: context.propsValue.customFields,
|
|
480
|
+
items: context.propsValue.items,
|
|
481
|
+
};
|
|
482
|
+
const body = rawBody;
|
|
483
|
+
const response = await pieces_common_1.httpClient.sendRequest({
|
|
484
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
485
|
+
url: `${baseUrl}/api/v2/public/jobs`,
|
|
486
|
+
headers: {
|
|
487
|
+
Authorization: `Bearer ${token}`,
|
|
488
|
+
'Content-Type': 'application/json',
|
|
489
|
+
'X-WorkBuddy-Version': '2026-01',
|
|
490
|
+
},
|
|
491
|
+
body: body,
|
|
492
|
+
});
|
|
493
|
+
return response.body;
|
|
494
|
+
},
|
|
495
|
+
});
|
|
496
|
+
exports.PublicApiJobController_createFromTemplate = (0, pieces_framework_1.createAction)({
|
|
497
|
+
name: 'PublicApiJobController_createFromTemplate',
|
|
498
|
+
auth: auth_1.workbuddyAuth,
|
|
499
|
+
displayName: 'Create a new job from template',
|
|
500
|
+
description: 'Create a job using a job template. Template-owned fields win over request values before final job validation.',
|
|
501
|
+
props: {
|
|
408
502
|
templateId: pieces_framework_1.Property.ShortText({
|
|
409
503
|
displayName: 'Template Id',
|
|
410
|
-
description: '
|
|
504
|
+
description: 'Job template ID',
|
|
505
|
+
required: true,
|
|
506
|
+
}),
|
|
507
|
+
customerId: pieces_framework_1.Property.ShortText({
|
|
508
|
+
displayName: 'Customer Id',
|
|
509
|
+
description: 'Customer ID — use /crm/customers to look up',
|
|
510
|
+
required: true,
|
|
511
|
+
}),
|
|
512
|
+
name: pieces_framework_1.Property.ShortText({
|
|
513
|
+
displayName: 'Name',
|
|
514
|
+
description: 'Display name',
|
|
515
|
+
required: false,
|
|
516
|
+
}),
|
|
517
|
+
integrationId: pieces_framework_1.Property.ShortText({
|
|
518
|
+
displayName: 'Integration Id',
|
|
519
|
+
description: 'integration ID',
|
|
520
|
+
required: false,
|
|
521
|
+
}),
|
|
522
|
+
jobNumber: pieces_framework_1.Property.ShortText({
|
|
523
|
+
displayName: 'Job Number',
|
|
524
|
+
description: '',
|
|
525
|
+
required: false,
|
|
526
|
+
}),
|
|
527
|
+
description: pieces_framework_1.Property.LongText({
|
|
528
|
+
displayName: 'Description',
|
|
529
|
+
description: 'Detailed description',
|
|
530
|
+
required: false,
|
|
531
|
+
}),
|
|
532
|
+
siteId: pieces_framework_1.Property.ShortText({
|
|
533
|
+
displayName: 'Site Id',
|
|
534
|
+
description: 'Site ID — use /crm/sites to look up',
|
|
535
|
+
required: false,
|
|
536
|
+
}),
|
|
537
|
+
placeId: pieces_framework_1.Property.ShortText({
|
|
538
|
+
displayName: 'Place Id',
|
|
539
|
+
description: 'place ID',
|
|
540
|
+
required: false,
|
|
541
|
+
}),
|
|
542
|
+
site: pieces_framework_1.Property.Json({
|
|
543
|
+
displayName: 'Site',
|
|
544
|
+
description: 'Inline site object — alternative to siteId',
|
|
545
|
+
required: false,
|
|
546
|
+
}),
|
|
547
|
+
contactId: pieces_framework_1.Property.ShortText({
|
|
548
|
+
displayName: 'Contact Id',
|
|
549
|
+
description: 'Contact ID — use /crm/contacts to look up',
|
|
550
|
+
required: false,
|
|
551
|
+
}),
|
|
552
|
+
contact: pieces_framework_1.Property.Json({
|
|
553
|
+
displayName: 'Contact',
|
|
554
|
+
description: 'Inline contact object — alternative to contactId',
|
|
555
|
+
required: false,
|
|
556
|
+
}),
|
|
557
|
+
typeId: pieces_framework_1.Property.ShortText({
|
|
558
|
+
displayName: 'Type Id',
|
|
559
|
+
description: 'Job type ID — use /settings/job-types to look up',
|
|
560
|
+
required: false,
|
|
561
|
+
}),
|
|
562
|
+
priorityId: pieces_framework_1.Property.ShortText({
|
|
563
|
+
displayName: 'Priority Id',
|
|
564
|
+
description: 'Priority ID — use /settings/priorities to look up',
|
|
565
|
+
required: false,
|
|
566
|
+
}),
|
|
567
|
+
priceBookId: pieces_framework_1.Property.ShortText({
|
|
568
|
+
displayName: 'Price Book Id',
|
|
569
|
+
description: 'Price book ID for job pricing',
|
|
570
|
+
required: false,
|
|
571
|
+
}),
|
|
572
|
+
ownerId: pieces_framework_1.Property.ShortText({
|
|
573
|
+
displayName: 'Owner Id',
|
|
574
|
+
description: 'Owner (employee) ID — use /crm/employees to look up',
|
|
575
|
+
required: false,
|
|
576
|
+
}),
|
|
577
|
+
fieldSupervisorId: pieces_framework_1.Property.ShortText({
|
|
578
|
+
displayName: 'Field Supervisor Id',
|
|
579
|
+
description: 'Field supervisor (employee) ID — use /crm/employees to look up',
|
|
580
|
+
required: false,
|
|
581
|
+
}),
|
|
582
|
+
zoneId: pieces_framework_1.Property.ShortText({
|
|
583
|
+
displayName: 'Zone Id',
|
|
584
|
+
description: 'Zone ID — use /settings/zones to look up',
|
|
585
|
+
required: false,
|
|
586
|
+
}),
|
|
587
|
+
tagIds: pieces_framework_1.Property.Array({
|
|
588
|
+
displayName: 'Tag Ids',
|
|
589
|
+
description: 'Array of tag IDs (comma-separated, e.g. "id1,id2") — use /settings/tags to look up',
|
|
590
|
+
required: false,
|
|
591
|
+
}),
|
|
592
|
+
notes: pieces_framework_1.Property.LongText({
|
|
593
|
+
displayName: 'Notes',
|
|
594
|
+
description: 'Additional notes or comments',
|
|
595
|
+
required: false,
|
|
596
|
+
}),
|
|
597
|
+
reference: pieces_framework_1.Property.ShortText({
|
|
598
|
+
displayName: 'Reference',
|
|
599
|
+
description: 'External reference number',
|
|
600
|
+
required: false,
|
|
601
|
+
}),
|
|
602
|
+
customerWO: pieces_framework_1.Property.ShortText({
|
|
603
|
+
displayName: 'Customer W O',
|
|
604
|
+
description: 'Customer work order reference',
|
|
605
|
+
required: false,
|
|
606
|
+
}),
|
|
607
|
+
customerPO: pieces_framework_1.Property.ShortText({
|
|
608
|
+
displayName: 'Customer P O',
|
|
609
|
+
description: 'Customer purchase order reference',
|
|
411
610
|
required: false,
|
|
412
611
|
}),
|
|
413
612
|
startDate: pieces_framework_1.Property.DateTime({
|
|
@@ -425,16 +624,25 @@ exports.PublicApiJobController_create = (0, pieces_framework_1.createAction)({
|
|
|
425
624
|
description: 'Custom fields as key-value pairs — validated against tenant field definitions',
|
|
426
625
|
required: false,
|
|
427
626
|
}),
|
|
627
|
+
items: pieces_framework_1.Property.Json({
|
|
628
|
+
displayName: 'Items',
|
|
629
|
+
description: '',
|
|
630
|
+
required: false,
|
|
631
|
+
defaultValue: [],
|
|
632
|
+
}),
|
|
428
633
|
},
|
|
429
634
|
async run(context) {
|
|
430
635
|
const token = await (0, auth_1.getAccessToken)(context.auth);
|
|
431
636
|
const baseUrl = context.auth.props.baseUrl;
|
|
432
|
-
const url = `${baseUrl}/api/v2/public/jobs`;
|
|
637
|
+
const url = `${baseUrl}/api/v2/public/jobs/template/${context.propsValue.templateId}`;
|
|
433
638
|
const rawBody = {
|
|
434
639
|
name: context.propsValue.name,
|
|
640
|
+
integrationId: context.propsValue.integrationId,
|
|
641
|
+
jobNumber: context.propsValue.jobNumber,
|
|
435
642
|
description: context.propsValue.description,
|
|
436
643
|
customerId: context.propsValue.customerId,
|
|
437
644
|
siteId: context.propsValue.siteId,
|
|
645
|
+
placeId: context.propsValue.placeId,
|
|
438
646
|
site: context.propsValue.site,
|
|
439
647
|
contactId: context.propsValue.contactId,
|
|
440
648
|
contact: context.propsValue.contact,
|
|
@@ -449,15 +657,83 @@ exports.PublicApiJobController_create = (0, pieces_framework_1.createAction)({
|
|
|
449
657
|
reference: context.propsValue.reference,
|
|
450
658
|
customerWO: context.propsValue.customerWO,
|
|
451
659
|
customerPO: context.propsValue.customerPO,
|
|
452
|
-
templateId: context.propsValue.templateId,
|
|
453
660
|
startDate: context.propsValue.startDate,
|
|
454
661
|
dueDate: context.propsValue.dueDate,
|
|
455
662
|
customFields: context.propsValue.customFields,
|
|
663
|
+
items: context.propsValue.items,
|
|
456
664
|
};
|
|
457
665
|
const body = rawBody;
|
|
458
666
|
const response = await pieces_common_1.httpClient.sendRequest({
|
|
459
667
|
method: pieces_common_1.HttpMethod.POST,
|
|
460
|
-
url: `${baseUrl}/api/v2/public/jobs`,
|
|
668
|
+
url: `${baseUrl}/api/v2/public/jobs/template/${context.propsValue.templateId}`,
|
|
669
|
+
headers: {
|
|
670
|
+
Authorization: `Bearer ${token}`,
|
|
671
|
+
'Content-Type': 'application/json',
|
|
672
|
+
'X-WorkBuddy-Version': '2026-01',
|
|
673
|
+
},
|
|
674
|
+
body: body,
|
|
675
|
+
});
|
|
676
|
+
return response.body;
|
|
677
|
+
},
|
|
678
|
+
});
|
|
679
|
+
exports.PublicApiJobController_updateStatus = (0, pieces_framework_1.createAction)({
|
|
680
|
+
name: 'PublicApiJobController_updateStatus',
|
|
681
|
+
auth: auth_1.workbuddyAuth,
|
|
682
|
+
displayName: 'Update job status',
|
|
683
|
+
description: 'Change an existing job status and cascade the change to stages through the job domain command.',
|
|
684
|
+
props: {
|
|
685
|
+
id: pieces_framework_1.Property.ShortText({
|
|
686
|
+
displayName: 'Id',
|
|
687
|
+
description: 'Job ID',
|
|
688
|
+
required: true,
|
|
689
|
+
}),
|
|
690
|
+
status: pieces_framework_1.Property.StaticDropdown({
|
|
691
|
+
displayName: 'Status',
|
|
692
|
+
description: 'Status filter',
|
|
693
|
+
required: true,
|
|
694
|
+
options: {
|
|
695
|
+
options: [
|
|
696
|
+
{ label: 'open', value: 'open' },
|
|
697
|
+
{ label: 'in_progress', value: 'in_progress' },
|
|
698
|
+
{ label: 'on_hold', value: 'on_hold' },
|
|
699
|
+
{ label: 'completed', value: 'completed' },
|
|
700
|
+
{ label: 'finalised', value: 'finalised' },
|
|
701
|
+
{ label: 'closed', value: 'closed' },
|
|
702
|
+
{ label: 'cancelled', value: 'cancelled' },
|
|
703
|
+
],
|
|
704
|
+
},
|
|
705
|
+
}),
|
|
706
|
+
updatedAt: pieces_framework_1.Property.DateTime({
|
|
707
|
+
displayName: 'Updated At',
|
|
708
|
+
description: 'For optimistic concurrency — update fails if entity was modified after this timestamp',
|
|
709
|
+
required: false,
|
|
710
|
+
}),
|
|
711
|
+
note: pieces_framework_1.Property.ShortText({
|
|
712
|
+
displayName: 'Note',
|
|
713
|
+
description: '',
|
|
714
|
+
required: false,
|
|
715
|
+
}),
|
|
716
|
+
reason: pieces_framework_1.Property.ShortText({
|
|
717
|
+
displayName: 'Reason',
|
|
718
|
+
description: 'Reason for the action (e.g. cancellation reason)',
|
|
719
|
+
required: false,
|
|
720
|
+
}),
|
|
721
|
+
},
|
|
722
|
+
async run(context) {
|
|
723
|
+
const token = await (0, auth_1.getAccessToken)(context.auth);
|
|
724
|
+
const baseUrl = context.auth.props.baseUrl;
|
|
725
|
+
const url = `${baseUrl}/api/v2/public/jobs/${context.propsValue.id}/status`;
|
|
726
|
+
// Build body with only defined values (for partial updates)
|
|
727
|
+
const rawBody = {
|
|
728
|
+
updatedAt: context.propsValue.updatedAt,
|
|
729
|
+
status: context.propsValue.status,
|
|
730
|
+
note: context.propsValue.note,
|
|
731
|
+
reason: context.propsValue.reason,
|
|
732
|
+
};
|
|
733
|
+
const body = Object.fromEntries(Object.entries(rawBody).filter(([_, v]) => v !== undefined && v !== null && v !== ''));
|
|
734
|
+
const response = await pieces_common_1.httpClient.sendRequest({
|
|
735
|
+
method: pieces_common_1.HttpMethod.PATCH,
|
|
736
|
+
url: `${baseUrl}/api/v2/public/jobs/${context.propsValue.id}/status`,
|
|
461
737
|
headers: {
|
|
462
738
|
Authorization: `Bearer ${token}`,
|
|
463
739
|
'Content-Type': 'application/json',
|
|
@@ -489,6 +765,11 @@ exports.PublicApiJobController_update = (0, pieces_framework_1.createAction)({
|
|
|
489
765
|
description: 'Display name',
|
|
490
766
|
required: false,
|
|
491
767
|
}),
|
|
768
|
+
integrationId: pieces_framework_1.Property.ShortText({
|
|
769
|
+
displayName: 'Integration Id',
|
|
770
|
+
description: 'integration ID',
|
|
771
|
+
required: false,
|
|
772
|
+
}),
|
|
492
773
|
description: pieces_framework_1.Property.LongText({
|
|
493
774
|
displayName: 'Description',
|
|
494
775
|
description: 'Detailed description',
|
|
@@ -593,6 +874,7 @@ exports.PublicApiJobController_update = (0, pieces_framework_1.createAction)({
|
|
|
593
874
|
const rawBody = {
|
|
594
875
|
updatedAt: context.propsValue.updatedAt,
|
|
595
876
|
name: context.propsValue.name,
|
|
877
|
+
integrationId: context.propsValue.integrationId,
|
|
596
878
|
description: context.propsValue.description,
|
|
597
879
|
siteId: context.propsValue.siteId,
|
|
598
880
|
contactId: context.propsValue.contactId,
|
|
@@ -797,6 +1079,56 @@ exports.PublicApiJobController_getStageItems = (0, pieces_framework_1.createActi
|
|
|
797
1079
|
return response.body;
|
|
798
1080
|
},
|
|
799
1081
|
});
|
|
1082
|
+
exports.PublicApiJobController_createStageItems = (0, pieces_framework_1.createAction)({
|
|
1083
|
+
name: 'PublicApiJobController_createStageItems',
|
|
1084
|
+
auth: auth_1.workbuddyAuth,
|
|
1085
|
+
displayName: 'Create stage items',
|
|
1086
|
+
description: 'Add one or more catalogue-backed line items to a stage.',
|
|
1087
|
+
props: {
|
|
1088
|
+
id: pieces_framework_1.Property.ShortText({
|
|
1089
|
+
displayName: 'Id',
|
|
1090
|
+
description: 'Job ID',
|
|
1091
|
+
required: true,
|
|
1092
|
+
}),
|
|
1093
|
+
stageId: pieces_framework_1.Property.ShortText({
|
|
1094
|
+
displayName: 'Stage Id',
|
|
1095
|
+
description: 'Stage ID',
|
|
1096
|
+
required: true,
|
|
1097
|
+
}),
|
|
1098
|
+
updatedAt: pieces_framework_1.Property.DateTime({
|
|
1099
|
+
displayName: 'Updated At',
|
|
1100
|
+
description: 'For optimistic concurrency — update fails if entity was modified after this timestamp',
|
|
1101
|
+
required: true,
|
|
1102
|
+
}),
|
|
1103
|
+
items: pieces_framework_1.Property.Json({
|
|
1104
|
+
displayName: 'Items',
|
|
1105
|
+
description: '',
|
|
1106
|
+
required: true,
|
|
1107
|
+
defaultValue: [],
|
|
1108
|
+
}),
|
|
1109
|
+
},
|
|
1110
|
+
async run(context) {
|
|
1111
|
+
const token = await (0, auth_1.getAccessToken)(context.auth);
|
|
1112
|
+
const baseUrl = context.auth.props.baseUrl;
|
|
1113
|
+
const url = `${baseUrl}/api/v2/public/jobs/${context.propsValue.id}/stages/${context.propsValue.stageId}/items`;
|
|
1114
|
+
const rawBody = {
|
|
1115
|
+
updatedAt: context.propsValue.updatedAt,
|
|
1116
|
+
items: context.propsValue.items,
|
|
1117
|
+
};
|
|
1118
|
+
const body = rawBody;
|
|
1119
|
+
const response = await pieces_common_1.httpClient.sendRequest({
|
|
1120
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
1121
|
+
url: `${baseUrl}/api/v2/public/jobs/${context.propsValue.id}/stages/${context.propsValue.stageId}/items`,
|
|
1122
|
+
headers: {
|
|
1123
|
+
Authorization: `Bearer ${token}`,
|
|
1124
|
+
'Content-Type': 'application/json',
|
|
1125
|
+
'X-WorkBuddy-Version': '2026-01',
|
|
1126
|
+
},
|
|
1127
|
+
body: body,
|
|
1128
|
+
});
|
|
1129
|
+
return response.body;
|
|
1130
|
+
},
|
|
1131
|
+
});
|
|
800
1132
|
exports.PublicApiJobController_getStageItem = (0, pieces_framework_1.createAction)({
|
|
801
1133
|
name: 'PublicApiJobController_getStageItem',
|
|
802
1134
|
auth: auth_1.workbuddyAuth,
|
|
@@ -835,4 +1167,160 @@ exports.PublicApiJobController_getStageItem = (0, pieces_framework_1.createActio
|
|
|
835
1167
|
return response.body;
|
|
836
1168
|
},
|
|
837
1169
|
});
|
|
1170
|
+
exports.PublicApiJobController_updateStageItem = (0, pieces_framework_1.createAction)({
|
|
1171
|
+
name: 'PublicApiJobController_updateStageItem',
|
|
1172
|
+
auth: auth_1.workbuddyAuth,
|
|
1173
|
+
displayName: 'Update stage item',
|
|
1174
|
+
description: 'Update mutable fields on a stage line item.',
|
|
1175
|
+
props: {
|
|
1176
|
+
id: pieces_framework_1.Property.ShortText({
|
|
1177
|
+
displayName: 'Id',
|
|
1178
|
+
description: 'Job ID',
|
|
1179
|
+
required: true,
|
|
1180
|
+
}),
|
|
1181
|
+
stageId: pieces_framework_1.Property.ShortText({
|
|
1182
|
+
displayName: 'Stage Id',
|
|
1183
|
+
description: 'Stage ID',
|
|
1184
|
+
required: true,
|
|
1185
|
+
}),
|
|
1186
|
+
itemId: pieces_framework_1.Property.ShortText({
|
|
1187
|
+
displayName: 'Item Id',
|
|
1188
|
+
description: 'Item ID',
|
|
1189
|
+
required: true,
|
|
1190
|
+
}),
|
|
1191
|
+
updatedAt: pieces_framework_1.Property.DateTime({
|
|
1192
|
+
displayName: 'Updated At',
|
|
1193
|
+
description: 'For optimistic concurrency — update fails if entity was modified after this timestamp',
|
|
1194
|
+
required: true,
|
|
1195
|
+
}),
|
|
1196
|
+
quantity: pieces_framework_1.Property.Number({
|
|
1197
|
+
displayName: 'Quantity',
|
|
1198
|
+
description: '',
|
|
1199
|
+
required: false,
|
|
1200
|
+
}),
|
|
1201
|
+
unit: pieces_framework_1.Property.ShortText({
|
|
1202
|
+
displayName: 'Unit',
|
|
1203
|
+
description: '',
|
|
1204
|
+
required: false,
|
|
1205
|
+
}),
|
|
1206
|
+
location: pieces_framework_1.Property.ShortText({
|
|
1207
|
+
displayName: 'Location',
|
|
1208
|
+
description: '',
|
|
1209
|
+
required: false,
|
|
1210
|
+
}),
|
|
1211
|
+
note: pieces_framework_1.Property.ShortText({
|
|
1212
|
+
displayName: 'Note',
|
|
1213
|
+
description: '',
|
|
1214
|
+
required: false,
|
|
1215
|
+
}),
|
|
1216
|
+
buyPrice: pieces_framework_1.Property.Number({
|
|
1217
|
+
displayName: 'Buy Price',
|
|
1218
|
+
description: '',
|
|
1219
|
+
required: false,
|
|
1220
|
+
}),
|
|
1221
|
+
sellPrice: pieces_framework_1.Property.Number({
|
|
1222
|
+
displayName: 'Sell Price',
|
|
1223
|
+
description: '',
|
|
1224
|
+
required: false,
|
|
1225
|
+
}),
|
|
1226
|
+
status: pieces_framework_1.Property.StaticDropdown({
|
|
1227
|
+
displayName: 'Status',
|
|
1228
|
+
description: 'Status filter',
|
|
1229
|
+
required: false,
|
|
1230
|
+
options: {
|
|
1231
|
+
options: [
|
|
1232
|
+
{ label: 'Normal', value: 'Normal' },
|
|
1233
|
+
{ label: 'Variation', value: 'Variation' },
|
|
1234
|
+
{ label: 'Cancelled', value: 'Cancelled' },
|
|
1235
|
+
{ label: 'Deleted', value: 'Deleted' },
|
|
1236
|
+
],
|
|
1237
|
+
},
|
|
1238
|
+
}),
|
|
1239
|
+
invoicingStatus: pieces_framework_1.Property.StaticDropdown({
|
|
1240
|
+
displayName: 'Invoicing Status',
|
|
1241
|
+
description: '',
|
|
1242
|
+
required: false,
|
|
1243
|
+
options: {
|
|
1244
|
+
options: [
|
|
1245
|
+
{ label: 'Billable', value: 'Billable' },
|
|
1246
|
+
{ label: 'No Charge', value: 'No Charge' },
|
|
1247
|
+
{ label: 'Not Billable', value: 'Not Billable' },
|
|
1248
|
+
],
|
|
1249
|
+
},
|
|
1250
|
+
}),
|
|
1251
|
+
suppliedBySubcontractor: pieces_framework_1.Property.Checkbox({
|
|
1252
|
+
displayName: 'Supplied By Subcontractor',
|
|
1253
|
+
description: '',
|
|
1254
|
+
required: false,
|
|
1255
|
+
}),
|
|
1256
|
+
},
|
|
1257
|
+
async run(context) {
|
|
1258
|
+
const token = await (0, auth_1.getAccessToken)(context.auth);
|
|
1259
|
+
const baseUrl = context.auth.props.baseUrl;
|
|
1260
|
+
const url = `${baseUrl}/api/v2/public/jobs/${context.propsValue.id}/stages/${context.propsValue.stageId}/items/${context.propsValue.itemId}`;
|
|
1261
|
+
// Build body with only defined values (for partial updates)
|
|
1262
|
+
const rawBody = {
|
|
1263
|
+
updatedAt: context.propsValue.updatedAt,
|
|
1264
|
+
quantity: context.propsValue.quantity,
|
|
1265
|
+
unit: context.propsValue.unit,
|
|
1266
|
+
location: context.propsValue.location,
|
|
1267
|
+
note: context.propsValue.note,
|
|
1268
|
+
buyPrice: context.propsValue.buyPrice,
|
|
1269
|
+
sellPrice: context.propsValue.sellPrice,
|
|
1270
|
+
status: context.propsValue.status,
|
|
1271
|
+
invoicingStatus: context.propsValue.invoicingStatus,
|
|
1272
|
+
suppliedBySubcontractor: context.propsValue.suppliedBySubcontractor,
|
|
1273
|
+
};
|
|
1274
|
+
const body = Object.fromEntries(Object.entries(rawBody).filter(([_, v]) => v !== undefined && v !== null && v !== ''));
|
|
1275
|
+
const response = await pieces_common_1.httpClient.sendRequest({
|
|
1276
|
+
method: pieces_common_1.HttpMethod.PATCH,
|
|
1277
|
+
url: `${baseUrl}/api/v2/public/jobs/${context.propsValue.id}/stages/${context.propsValue.stageId}/items/${context.propsValue.itemId}`,
|
|
1278
|
+
headers: {
|
|
1279
|
+
Authorization: `Bearer ${token}`,
|
|
1280
|
+
'Content-Type': 'application/json',
|
|
1281
|
+
'X-WorkBuddy-Version': '2026-01',
|
|
1282
|
+
},
|
|
1283
|
+
body: body,
|
|
1284
|
+
});
|
|
1285
|
+
return response.body;
|
|
1286
|
+
},
|
|
1287
|
+
});
|
|
1288
|
+
exports.PublicApiJobController_deleteStageItem = (0, pieces_framework_1.createAction)({
|
|
1289
|
+
name: 'PublicApiJobController_deleteStageItem',
|
|
1290
|
+
auth: auth_1.workbuddyAuth,
|
|
1291
|
+
displayName: 'Delete stage item',
|
|
1292
|
+
description: 'Remove or cancel a stage item depending on tenant deletion settings.',
|
|
1293
|
+
props: {
|
|
1294
|
+
id: pieces_framework_1.Property.ShortText({
|
|
1295
|
+
displayName: 'Id',
|
|
1296
|
+
description: 'Job ID',
|
|
1297
|
+
required: true,
|
|
1298
|
+
}),
|
|
1299
|
+
stageId: pieces_framework_1.Property.ShortText({
|
|
1300
|
+
displayName: 'Stage Id',
|
|
1301
|
+
description: 'Stage ID',
|
|
1302
|
+
required: true,
|
|
1303
|
+
}),
|
|
1304
|
+
itemId: pieces_framework_1.Property.ShortText({
|
|
1305
|
+
displayName: 'Item Id',
|
|
1306
|
+
description: 'Item ID',
|
|
1307
|
+
required: true,
|
|
1308
|
+
}),
|
|
1309
|
+
},
|
|
1310
|
+
async run(context) {
|
|
1311
|
+
const token = await (0, auth_1.getAccessToken)(context.auth);
|
|
1312
|
+
const baseUrl = context.auth.props.baseUrl;
|
|
1313
|
+
const url = `${baseUrl}/api/v2/public/jobs/${context.propsValue.id}/stages/${context.propsValue.stageId}/items/${context.propsValue.itemId}`;
|
|
1314
|
+
const response = await pieces_common_1.httpClient.sendRequest({
|
|
1315
|
+
method: pieces_common_1.HttpMethod.DELETE,
|
|
1316
|
+
url: `${baseUrl}/api/v2/public/jobs/${context.propsValue.id}/stages/${context.propsValue.stageId}/items/${context.propsValue.itemId}`,
|
|
1317
|
+
headers: {
|
|
1318
|
+
Authorization: `Bearer ${token}`,
|
|
1319
|
+
'Content-Type': 'application/json',
|
|
1320
|
+
'X-WorkBuddy-Version': '2026-01',
|
|
1321
|
+
},
|
|
1322
|
+
});
|
|
1323
|
+
return response.body;
|
|
1324
|
+
},
|
|
1325
|
+
});
|
|
838
1326
|
//# sourceMappingURL=jobs.js.map
|