@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
|
@@ -0,0 +1,772 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PublicApiUoMController_list = exports.PublicApiItemCategoryController_upsert = exports.PublicApiItemCategoryController_list = exports.PublicApiItemController_delete = exports.PublicApiItemController_update = exports.PublicApiItemController_getById = exports.PublicApiItemController_upsert = exports.PublicApiItemController_create = exports.PublicApiItemController_list = void 0;
|
|
4
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
+
const auth_1 = require("../auth");
|
|
7
|
+
exports.PublicApiItemController_list = (0, pieces_framework_1.createAction)({
|
|
8
|
+
name: 'PublicApiItemController_list',
|
|
9
|
+
auth: auth_1.workbuddyAuth,
|
|
10
|
+
displayName: 'List items',
|
|
11
|
+
description: 'Retrieve paginated editable settings items.',
|
|
12
|
+
props: {},
|
|
13
|
+
async run(context) {
|
|
14
|
+
const token = await (0, auth_1.getAccessToken)(context.auth);
|
|
15
|
+
const baseUrl = context.auth.props.baseUrl;
|
|
16
|
+
const url = `${baseUrl}/api/v2/public/settings/items`;
|
|
17
|
+
const response = await pieces_common_1.httpClient.sendRequest({
|
|
18
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
19
|
+
url: `${baseUrl}/api/v2/public/settings/items`,
|
|
20
|
+
headers: {
|
|
21
|
+
Authorization: `Bearer ${token}`,
|
|
22
|
+
'Content-Type': 'application/json',
|
|
23
|
+
'X-WorkBuddy-Version': '2026-01',
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
return response.body;
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
exports.PublicApiItemController_create = (0, pieces_framework_1.createAction)({
|
|
30
|
+
name: 'PublicApiItemController_create',
|
|
31
|
+
auth: auth_1.workbuddyAuth,
|
|
32
|
+
displayName: 'Create item',
|
|
33
|
+
description: 'Create a settings item. This endpoint does not upsert.',
|
|
34
|
+
props: {},
|
|
35
|
+
async run(context) {
|
|
36
|
+
const token = await (0, auth_1.getAccessToken)(context.auth);
|
|
37
|
+
const baseUrl = context.auth.props.baseUrl;
|
|
38
|
+
const url = `${baseUrl}/api/v2/public/settings/items`;
|
|
39
|
+
const response = await pieces_common_1.httpClient.sendRequest({
|
|
40
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
41
|
+
url: `${baseUrl}/api/v2/public/settings/items`,
|
|
42
|
+
headers: {
|
|
43
|
+
Authorization: `Bearer ${token}`,
|
|
44
|
+
'Content-Type': 'application/json',
|
|
45
|
+
'X-WorkBuddy-Version': '2026-01',
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
return response.body;
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
exports.PublicApiItemController_upsert = (0, pieces_framework_1.createAction)({
|
|
52
|
+
name: 'PublicApiItemController_upsert',
|
|
53
|
+
auth: auth_1.workbuddyAuth,
|
|
54
|
+
displayName: 'Upsert item',
|
|
55
|
+
description: 'Create or partially update a settings item using integrationId when supplied, otherwise name. Create still requires mandatory item fields.',
|
|
56
|
+
props: {
|
|
57
|
+
name: pieces_framework_1.Property.ShortText({
|
|
58
|
+
displayName: 'Name',
|
|
59
|
+
description: 'Display name',
|
|
60
|
+
required: true,
|
|
61
|
+
}),
|
|
62
|
+
type: pieces_framework_1.Property.StaticDropdown({
|
|
63
|
+
displayName: 'Type',
|
|
64
|
+
description: '',
|
|
65
|
+
required: false,
|
|
66
|
+
options: {
|
|
67
|
+
options: [
|
|
68
|
+
{ label: 'SERVICE', value: 'SERVICE' },
|
|
69
|
+
{ label: 'INVENTORY', value: 'INVENTORY' },
|
|
70
|
+
{ label: 'NON-INVENTORY', value: 'NON-INVENTORY' },
|
|
71
|
+
{ label: 'INCENTIVE', value: 'INCENTIVE' },
|
|
72
|
+
{ label: 'KIT', value: 'KIT' },
|
|
73
|
+
{ label: 'BUNDLE', value: 'BUNDLE' },
|
|
74
|
+
{ label: 'SOR', value: 'SOR' },
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
}),
|
|
78
|
+
baseUomId: pieces_framework_1.Property.ShortText({
|
|
79
|
+
displayName: 'Base Uom Id',
|
|
80
|
+
description: 'base uom ID',
|
|
81
|
+
required: false,
|
|
82
|
+
}),
|
|
83
|
+
baseUomName: pieces_framework_1.Property.ShortText({
|
|
84
|
+
displayName: 'Base Uom Name',
|
|
85
|
+
description: '',
|
|
86
|
+
required: false,
|
|
87
|
+
}),
|
|
88
|
+
description: pieces_framework_1.Property.LongText({
|
|
89
|
+
displayName: 'Description',
|
|
90
|
+
description: 'Detailed description',
|
|
91
|
+
required: false,
|
|
92
|
+
}),
|
|
93
|
+
category: pieces_framework_1.Property.Dropdown({
|
|
94
|
+
displayName: 'Flag Category',
|
|
95
|
+
description: 'Select a flag category',
|
|
96
|
+
required: false,
|
|
97
|
+
refreshers: [],
|
|
98
|
+
auth: auth_1.workbuddyAuth,
|
|
99
|
+
options: async ({ auth }) => {
|
|
100
|
+
const authValue = auth;
|
|
101
|
+
const token = await (0, auth_1.getAccessToken)(authValue);
|
|
102
|
+
const baseUrl = authValue.props.baseUrl;
|
|
103
|
+
const response = await pieces_common_1.httpClient.sendRequest({
|
|
104
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
105
|
+
url: `${baseUrl}/api/v2/public/settings/tags?type=flag-category`,
|
|
106
|
+
headers: {
|
|
107
|
+
Authorization: `Bearer ${token}`,
|
|
108
|
+
'X-WorkBuddy-Version': '2026-01',
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
const items = response.body?.items || [];
|
|
112
|
+
return {
|
|
113
|
+
options: items.map((item) => ({
|
|
114
|
+
label: item.name,
|
|
115
|
+
value: JSON.stringify({ id: item.id, name: item.name }),
|
|
116
|
+
})),
|
|
117
|
+
};
|
|
118
|
+
},
|
|
119
|
+
}),
|
|
120
|
+
active: pieces_framework_1.Property.Checkbox({
|
|
121
|
+
displayName: 'Active',
|
|
122
|
+
description: 'Whether the entity is active',
|
|
123
|
+
required: false,
|
|
124
|
+
}),
|
|
125
|
+
integrationId: pieces_framework_1.Property.ShortText({
|
|
126
|
+
displayName: 'Integration Id',
|
|
127
|
+
description: 'integration ID',
|
|
128
|
+
required: false,
|
|
129
|
+
}),
|
|
130
|
+
canOverrideDesc: pieces_framework_1.Property.Checkbox({
|
|
131
|
+
displayName: 'Can Override Desc',
|
|
132
|
+
description: '',
|
|
133
|
+
required: false,
|
|
134
|
+
}),
|
|
135
|
+
longDescription: pieces_framework_1.Property.LongText({
|
|
136
|
+
displayName: 'Long Description',
|
|
137
|
+
description: '',
|
|
138
|
+
required: false,
|
|
139
|
+
}),
|
|
140
|
+
manufacturer: pieces_framework_1.Property.ShortText({
|
|
141
|
+
displayName: 'Manufacturer',
|
|
142
|
+
description: '',
|
|
143
|
+
required: false,
|
|
144
|
+
}),
|
|
145
|
+
retailPrice: pieces_framework_1.Property.Number({
|
|
146
|
+
displayName: 'Retail Price',
|
|
147
|
+
description: '',
|
|
148
|
+
required: false,
|
|
149
|
+
}),
|
|
150
|
+
tradePrice: pieces_framework_1.Property.Number({
|
|
151
|
+
displayName: 'Trade Price',
|
|
152
|
+
description: '',
|
|
153
|
+
required: false,
|
|
154
|
+
}),
|
|
155
|
+
standardCost: pieces_framework_1.Property.Number({
|
|
156
|
+
displayName: 'Standard Cost',
|
|
157
|
+
description: '',
|
|
158
|
+
required: false,
|
|
159
|
+
}),
|
|
160
|
+
economicOrderQty: pieces_framework_1.Property.Number({
|
|
161
|
+
displayName: 'Economic Order Qty',
|
|
162
|
+
description: '',
|
|
163
|
+
required: false,
|
|
164
|
+
}),
|
|
165
|
+
safetyStockQty: pieces_framework_1.Property.Number({
|
|
166
|
+
displayName: 'Safety Stock Qty',
|
|
167
|
+
description: '',
|
|
168
|
+
required: false,
|
|
169
|
+
}),
|
|
170
|
+
leadTimeDays: pieces_framework_1.Property.Number({
|
|
171
|
+
displayName: 'Lead Time Days',
|
|
172
|
+
description: '',
|
|
173
|
+
required: false,
|
|
174
|
+
}),
|
|
175
|
+
upc: pieces_framework_1.Property.ShortText({
|
|
176
|
+
displayName: 'Upc',
|
|
177
|
+
description: '',
|
|
178
|
+
required: false,
|
|
179
|
+
}),
|
|
180
|
+
itemSold: pieces_framework_1.Property.Checkbox({
|
|
181
|
+
displayName: 'Item Sold',
|
|
182
|
+
description: '',
|
|
183
|
+
required: false,
|
|
184
|
+
}),
|
|
185
|
+
saleGlCode: pieces_framework_1.Property.ShortText({
|
|
186
|
+
displayName: 'Sale Gl Code',
|
|
187
|
+
description: '',
|
|
188
|
+
required: false,
|
|
189
|
+
}),
|
|
190
|
+
saleTaxRateId: pieces_framework_1.Property.ShortText({
|
|
191
|
+
displayName: 'Sale Tax Rate Id',
|
|
192
|
+
description: 'sale tax rate ID',
|
|
193
|
+
required: false,
|
|
194
|
+
}),
|
|
195
|
+
saleTaxRateName: pieces_framework_1.Property.ShortText({
|
|
196
|
+
displayName: 'Sale Tax Rate Name',
|
|
197
|
+
description: '',
|
|
198
|
+
required: false,
|
|
199
|
+
}),
|
|
200
|
+
itemPurchased: pieces_framework_1.Property.Checkbox({
|
|
201
|
+
displayName: 'Item Purchased',
|
|
202
|
+
description: '',
|
|
203
|
+
required: false,
|
|
204
|
+
}),
|
|
205
|
+
purchaseGlCode: pieces_framework_1.Property.ShortText({
|
|
206
|
+
displayName: 'Purchase Gl Code',
|
|
207
|
+
description: '',
|
|
208
|
+
required: false,
|
|
209
|
+
}),
|
|
210
|
+
purchaseTaxRateId: pieces_framework_1.Property.ShortText({
|
|
211
|
+
displayName: 'Purchase Tax Rate Id',
|
|
212
|
+
description: 'purchase tax rate ID',
|
|
213
|
+
required: false,
|
|
214
|
+
}),
|
|
215
|
+
purchaseTaxRateName: pieces_framework_1.Property.ShortText({
|
|
216
|
+
displayName: 'Purchase Tax Rate Name',
|
|
217
|
+
description: '',
|
|
218
|
+
required: false,
|
|
219
|
+
}),
|
|
220
|
+
codeInvoicingStatus: pieces_framework_1.Property.StaticDropdown({
|
|
221
|
+
displayName: 'Code Invoicing Status',
|
|
222
|
+
description: '',
|
|
223
|
+
required: false,
|
|
224
|
+
options: {
|
|
225
|
+
options: [
|
|
226
|
+
{ label: 'Billable', value: 'Billable' },
|
|
227
|
+
{ label: 'No Charge', value: 'No Charge' },
|
|
228
|
+
{ label: 'Not Billable', value: 'Not Billable' },
|
|
229
|
+
],
|
|
230
|
+
},
|
|
231
|
+
}),
|
|
232
|
+
suppliedBySubcontractor: pieces_framework_1.Property.Checkbox({
|
|
233
|
+
displayName: 'Supplied By Subcontractor',
|
|
234
|
+
description: '',
|
|
235
|
+
required: false,
|
|
236
|
+
}),
|
|
237
|
+
autoCreateTask: pieces_framework_1.Property.Checkbox({
|
|
238
|
+
displayName: 'Auto Create Task',
|
|
239
|
+
description: '',
|
|
240
|
+
required: false,
|
|
241
|
+
}),
|
|
242
|
+
customFields: pieces_framework_1.Property.ShortText({
|
|
243
|
+
displayName: 'Custom Fields',
|
|
244
|
+
description: 'Custom fields as key-value pairs — validated against tenant field definitions',
|
|
245
|
+
required: false,
|
|
246
|
+
}),
|
|
247
|
+
trackingCategory1: pieces_framework_1.Property.ShortText({
|
|
248
|
+
displayName: 'Tracking Category1',
|
|
249
|
+
description: '',
|
|
250
|
+
required: false,
|
|
251
|
+
}),
|
|
252
|
+
trackingCategory2: pieces_framework_1.Property.ShortText({
|
|
253
|
+
displayName: 'Tracking Category2',
|
|
254
|
+
description: '',
|
|
255
|
+
required: false,
|
|
256
|
+
}),
|
|
257
|
+
uoms: pieces_framework_1.Property.Json({
|
|
258
|
+
displayName: 'Uoms',
|
|
259
|
+
description: '',
|
|
260
|
+
required: false,
|
|
261
|
+
defaultValue: [],
|
|
262
|
+
}),
|
|
263
|
+
},
|
|
264
|
+
async run(context) {
|
|
265
|
+
const token = await (0, auth_1.getAccessToken)(context.auth);
|
|
266
|
+
const baseUrl = context.auth.props.baseUrl;
|
|
267
|
+
const url = `${baseUrl}/api/v2/public/settings/items`;
|
|
268
|
+
// Build body with only defined values (for partial updates)
|
|
269
|
+
const rawBody = {
|
|
270
|
+
type: context.propsValue.type,
|
|
271
|
+
name: context.propsValue.name,
|
|
272
|
+
baseUomId: context.propsValue.baseUomId,
|
|
273
|
+
baseUomName: context.propsValue.baseUomName,
|
|
274
|
+
description: context.propsValue.description,
|
|
275
|
+
category: typeof context.propsValue.category === 'string'
|
|
276
|
+
? JSON.parse(context.propsValue.category)
|
|
277
|
+
: context.propsValue.category,
|
|
278
|
+
active: context.propsValue.active,
|
|
279
|
+
integrationId: context.propsValue.integrationId,
|
|
280
|
+
canOverrideDesc: context.propsValue.canOverrideDesc,
|
|
281
|
+
longDescription: context.propsValue.longDescription,
|
|
282
|
+
manufacturer: context.propsValue.manufacturer,
|
|
283
|
+
retailPrice: context.propsValue.retailPrice,
|
|
284
|
+
tradePrice: context.propsValue.tradePrice,
|
|
285
|
+
standardCost: context.propsValue.standardCost,
|
|
286
|
+
economicOrderQty: context.propsValue.economicOrderQty,
|
|
287
|
+
safetyStockQty: context.propsValue.safetyStockQty,
|
|
288
|
+
leadTimeDays: context.propsValue.leadTimeDays,
|
|
289
|
+
upc: context.propsValue.upc,
|
|
290
|
+
itemSold: context.propsValue.itemSold,
|
|
291
|
+
saleGlCode: context.propsValue.saleGlCode,
|
|
292
|
+
saleTaxRateId: context.propsValue.saleTaxRateId,
|
|
293
|
+
saleTaxRateName: context.propsValue.saleTaxRateName,
|
|
294
|
+
itemPurchased: context.propsValue.itemPurchased,
|
|
295
|
+
purchaseGlCode: context.propsValue.purchaseGlCode,
|
|
296
|
+
purchaseTaxRateId: context.propsValue.purchaseTaxRateId,
|
|
297
|
+
purchaseTaxRateName: context.propsValue.purchaseTaxRateName,
|
|
298
|
+
codeInvoicingStatus: context.propsValue.codeInvoicingStatus,
|
|
299
|
+
suppliedBySubcontractor: context.propsValue.suppliedBySubcontractor,
|
|
300
|
+
autoCreateTask: context.propsValue.autoCreateTask,
|
|
301
|
+
customFields: context.propsValue.customFields,
|
|
302
|
+
trackingCategory1: context.propsValue.trackingCategory1,
|
|
303
|
+
trackingCategory2: context.propsValue.trackingCategory2,
|
|
304
|
+
uoms: context.propsValue.uoms,
|
|
305
|
+
};
|
|
306
|
+
const body = Object.fromEntries(Object.entries(rawBody).filter(([_, v]) => v !== undefined && v !== null && v !== ''));
|
|
307
|
+
const response = await pieces_common_1.httpClient.sendRequest({
|
|
308
|
+
method: pieces_common_1.HttpMethod.PUT,
|
|
309
|
+
url: `${baseUrl}/api/v2/public/settings/items`,
|
|
310
|
+
headers: {
|
|
311
|
+
Authorization: `Bearer ${token}`,
|
|
312
|
+
'Content-Type': 'application/json',
|
|
313
|
+
'X-WorkBuddy-Version': '2026-01',
|
|
314
|
+
},
|
|
315
|
+
body: body,
|
|
316
|
+
});
|
|
317
|
+
return response.body;
|
|
318
|
+
},
|
|
319
|
+
});
|
|
320
|
+
exports.PublicApiItemController_getById = (0, pieces_framework_1.createAction)({
|
|
321
|
+
name: 'PublicApiItemController_getById',
|
|
322
|
+
auth: auth_1.workbuddyAuth,
|
|
323
|
+
displayName: 'Get item',
|
|
324
|
+
description: 'Retrieve a settings item by ID, name, or integration ID.',
|
|
325
|
+
props: {
|
|
326
|
+
id: pieces_framework_1.Property.ShortText({
|
|
327
|
+
displayName: 'Id',
|
|
328
|
+
description: 'Entity ID',
|
|
329
|
+
required: true,
|
|
330
|
+
}),
|
|
331
|
+
},
|
|
332
|
+
async run(context) {
|
|
333
|
+
const token = await (0, auth_1.getAccessToken)(context.auth);
|
|
334
|
+
const baseUrl = context.auth.props.baseUrl;
|
|
335
|
+
const url = `${baseUrl}/api/v2/public/settings/items/${context.propsValue.id}`;
|
|
336
|
+
const response = await pieces_common_1.httpClient.sendRequest({
|
|
337
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
338
|
+
url: `${baseUrl}/api/v2/public/settings/items/${context.propsValue.id}`,
|
|
339
|
+
headers: {
|
|
340
|
+
Authorization: `Bearer ${token}`,
|
|
341
|
+
'Content-Type': 'application/json',
|
|
342
|
+
'X-WorkBuddy-Version': '2026-01',
|
|
343
|
+
},
|
|
344
|
+
});
|
|
345
|
+
return response.body;
|
|
346
|
+
},
|
|
347
|
+
});
|
|
348
|
+
exports.PublicApiItemController_update = (0, pieces_framework_1.createAction)({
|
|
349
|
+
name: 'PublicApiItemController_update',
|
|
350
|
+
auth: auth_1.workbuddyAuth,
|
|
351
|
+
displayName: 'Update item',
|
|
352
|
+
description: 'Update a settings item by ID.',
|
|
353
|
+
props: {
|
|
354
|
+
id: pieces_framework_1.Property.ShortText({
|
|
355
|
+
displayName: 'Id',
|
|
356
|
+
description: 'Entity ID',
|
|
357
|
+
required: true,
|
|
358
|
+
}),
|
|
359
|
+
type: pieces_framework_1.Property.StaticDropdown({
|
|
360
|
+
displayName: 'Type',
|
|
361
|
+
description: '',
|
|
362
|
+
required: false,
|
|
363
|
+
options: {
|
|
364
|
+
options: [
|
|
365
|
+
{ label: 'SERVICE', value: 'SERVICE' },
|
|
366
|
+
{ label: 'INVENTORY', value: 'INVENTORY' },
|
|
367
|
+
{ label: 'NON-INVENTORY', value: 'NON-INVENTORY' },
|
|
368
|
+
{ label: 'INCENTIVE', value: 'INCENTIVE' },
|
|
369
|
+
{ label: 'KIT', value: 'KIT' },
|
|
370
|
+
{ label: 'BUNDLE', value: 'BUNDLE' },
|
|
371
|
+
{ label: 'SOR', value: 'SOR' },
|
|
372
|
+
],
|
|
373
|
+
},
|
|
374
|
+
}),
|
|
375
|
+
name: pieces_framework_1.Property.ShortText({
|
|
376
|
+
displayName: 'Name',
|
|
377
|
+
description: 'Display name',
|
|
378
|
+
required: false,
|
|
379
|
+
}),
|
|
380
|
+
baseUomId: pieces_framework_1.Property.ShortText({
|
|
381
|
+
displayName: 'Base Uom Id',
|
|
382
|
+
description: 'base uom ID',
|
|
383
|
+
required: false,
|
|
384
|
+
}),
|
|
385
|
+
baseUomName: pieces_framework_1.Property.ShortText({
|
|
386
|
+
displayName: 'Base Uom Name',
|
|
387
|
+
description: '',
|
|
388
|
+
required: false,
|
|
389
|
+
}),
|
|
390
|
+
description: pieces_framework_1.Property.LongText({
|
|
391
|
+
displayName: 'Description',
|
|
392
|
+
description: 'Detailed description',
|
|
393
|
+
required: false,
|
|
394
|
+
}),
|
|
395
|
+
category: pieces_framework_1.Property.Dropdown({
|
|
396
|
+
displayName: 'Flag Category',
|
|
397
|
+
description: 'Select a flag category',
|
|
398
|
+
required: false,
|
|
399
|
+
refreshers: [],
|
|
400
|
+
auth: auth_1.workbuddyAuth,
|
|
401
|
+
options: async ({ auth }) => {
|
|
402
|
+
const authValue = auth;
|
|
403
|
+
const token = await (0, auth_1.getAccessToken)(authValue);
|
|
404
|
+
const baseUrl = authValue.props.baseUrl;
|
|
405
|
+
const response = await pieces_common_1.httpClient.sendRequest({
|
|
406
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
407
|
+
url: `${baseUrl}/api/v2/public/settings/tags?type=flag-category`,
|
|
408
|
+
headers: {
|
|
409
|
+
Authorization: `Bearer ${token}`,
|
|
410
|
+
'X-WorkBuddy-Version': '2026-01',
|
|
411
|
+
},
|
|
412
|
+
});
|
|
413
|
+
const items = response.body?.items || [];
|
|
414
|
+
return {
|
|
415
|
+
options: items.map((item) => ({
|
|
416
|
+
label: item.name,
|
|
417
|
+
value: JSON.stringify({ id: item.id, name: item.name }),
|
|
418
|
+
})),
|
|
419
|
+
};
|
|
420
|
+
},
|
|
421
|
+
}),
|
|
422
|
+
active: pieces_framework_1.Property.Checkbox({
|
|
423
|
+
displayName: 'Active',
|
|
424
|
+
description: 'Whether the entity is active',
|
|
425
|
+
required: false,
|
|
426
|
+
}),
|
|
427
|
+
integrationId: pieces_framework_1.Property.ShortText({
|
|
428
|
+
displayName: 'Integration Id',
|
|
429
|
+
description: 'integration ID',
|
|
430
|
+
required: false,
|
|
431
|
+
}),
|
|
432
|
+
canOverrideDesc: pieces_framework_1.Property.Checkbox({
|
|
433
|
+
displayName: 'Can Override Desc',
|
|
434
|
+
description: '',
|
|
435
|
+
required: false,
|
|
436
|
+
}),
|
|
437
|
+
longDescription: pieces_framework_1.Property.LongText({
|
|
438
|
+
displayName: 'Long Description',
|
|
439
|
+
description: '',
|
|
440
|
+
required: false,
|
|
441
|
+
}),
|
|
442
|
+
manufacturer: pieces_framework_1.Property.ShortText({
|
|
443
|
+
displayName: 'Manufacturer',
|
|
444
|
+
description: '',
|
|
445
|
+
required: false,
|
|
446
|
+
}),
|
|
447
|
+
retailPrice: pieces_framework_1.Property.Number({
|
|
448
|
+
displayName: 'Retail Price',
|
|
449
|
+
description: '',
|
|
450
|
+
required: false,
|
|
451
|
+
}),
|
|
452
|
+
tradePrice: pieces_framework_1.Property.Number({
|
|
453
|
+
displayName: 'Trade Price',
|
|
454
|
+
description: '',
|
|
455
|
+
required: false,
|
|
456
|
+
}),
|
|
457
|
+
standardCost: pieces_framework_1.Property.Number({
|
|
458
|
+
displayName: 'Standard Cost',
|
|
459
|
+
description: '',
|
|
460
|
+
required: false,
|
|
461
|
+
}),
|
|
462
|
+
economicOrderQty: pieces_framework_1.Property.Number({
|
|
463
|
+
displayName: 'Economic Order Qty',
|
|
464
|
+
description: '',
|
|
465
|
+
required: false,
|
|
466
|
+
}),
|
|
467
|
+
safetyStockQty: pieces_framework_1.Property.Number({
|
|
468
|
+
displayName: 'Safety Stock Qty',
|
|
469
|
+
description: '',
|
|
470
|
+
required: false,
|
|
471
|
+
}),
|
|
472
|
+
leadTimeDays: pieces_framework_1.Property.Number({
|
|
473
|
+
displayName: 'Lead Time Days',
|
|
474
|
+
description: '',
|
|
475
|
+
required: false,
|
|
476
|
+
}),
|
|
477
|
+
upc: pieces_framework_1.Property.ShortText({
|
|
478
|
+
displayName: 'Upc',
|
|
479
|
+
description: '',
|
|
480
|
+
required: false,
|
|
481
|
+
}),
|
|
482
|
+
itemSold: pieces_framework_1.Property.Checkbox({
|
|
483
|
+
displayName: 'Item Sold',
|
|
484
|
+
description: '',
|
|
485
|
+
required: false,
|
|
486
|
+
}),
|
|
487
|
+
saleGlCode: pieces_framework_1.Property.ShortText({
|
|
488
|
+
displayName: 'Sale Gl Code',
|
|
489
|
+
description: '',
|
|
490
|
+
required: false,
|
|
491
|
+
}),
|
|
492
|
+
saleTaxRateId: pieces_framework_1.Property.ShortText({
|
|
493
|
+
displayName: 'Sale Tax Rate Id',
|
|
494
|
+
description: 'sale tax rate ID',
|
|
495
|
+
required: false,
|
|
496
|
+
}),
|
|
497
|
+
saleTaxRateName: pieces_framework_1.Property.ShortText({
|
|
498
|
+
displayName: 'Sale Tax Rate Name',
|
|
499
|
+
description: '',
|
|
500
|
+
required: false,
|
|
501
|
+
}),
|
|
502
|
+
itemPurchased: pieces_framework_1.Property.Checkbox({
|
|
503
|
+
displayName: 'Item Purchased',
|
|
504
|
+
description: '',
|
|
505
|
+
required: false,
|
|
506
|
+
}),
|
|
507
|
+
purchaseGlCode: pieces_framework_1.Property.ShortText({
|
|
508
|
+
displayName: 'Purchase Gl Code',
|
|
509
|
+
description: '',
|
|
510
|
+
required: false,
|
|
511
|
+
}),
|
|
512
|
+
purchaseTaxRateId: pieces_framework_1.Property.ShortText({
|
|
513
|
+
displayName: 'Purchase Tax Rate Id',
|
|
514
|
+
description: 'purchase tax rate ID',
|
|
515
|
+
required: false,
|
|
516
|
+
}),
|
|
517
|
+
purchaseTaxRateName: pieces_framework_1.Property.ShortText({
|
|
518
|
+
displayName: 'Purchase Tax Rate Name',
|
|
519
|
+
description: '',
|
|
520
|
+
required: false,
|
|
521
|
+
}),
|
|
522
|
+
codeInvoicingStatus: pieces_framework_1.Property.StaticDropdown({
|
|
523
|
+
displayName: 'Code Invoicing Status',
|
|
524
|
+
description: '',
|
|
525
|
+
required: false,
|
|
526
|
+
options: {
|
|
527
|
+
options: [
|
|
528
|
+
{ label: 'Billable', value: 'Billable' },
|
|
529
|
+
{ label: 'No Charge', value: 'No Charge' },
|
|
530
|
+
{ label: 'Not Billable', value: 'Not Billable' },
|
|
531
|
+
],
|
|
532
|
+
},
|
|
533
|
+
}),
|
|
534
|
+
suppliedBySubcontractor: pieces_framework_1.Property.Checkbox({
|
|
535
|
+
displayName: 'Supplied By Subcontractor',
|
|
536
|
+
description: '',
|
|
537
|
+
required: false,
|
|
538
|
+
}),
|
|
539
|
+
autoCreateTask: pieces_framework_1.Property.Checkbox({
|
|
540
|
+
displayName: 'Auto Create Task',
|
|
541
|
+
description: '',
|
|
542
|
+
required: false,
|
|
543
|
+
}),
|
|
544
|
+
customFields: pieces_framework_1.Property.ShortText({
|
|
545
|
+
displayName: 'Custom Fields',
|
|
546
|
+
description: 'Custom fields as key-value pairs — validated against tenant field definitions',
|
|
547
|
+
required: false,
|
|
548
|
+
}),
|
|
549
|
+
trackingCategory1: pieces_framework_1.Property.ShortText({
|
|
550
|
+
displayName: 'Tracking Category1',
|
|
551
|
+
description: '',
|
|
552
|
+
required: false,
|
|
553
|
+
}),
|
|
554
|
+
trackingCategory2: pieces_framework_1.Property.ShortText({
|
|
555
|
+
displayName: 'Tracking Category2',
|
|
556
|
+
description: '',
|
|
557
|
+
required: false,
|
|
558
|
+
}),
|
|
559
|
+
uoms: pieces_framework_1.Property.Json({
|
|
560
|
+
displayName: 'Uoms',
|
|
561
|
+
description: '',
|
|
562
|
+
required: false,
|
|
563
|
+
defaultValue: [],
|
|
564
|
+
}),
|
|
565
|
+
},
|
|
566
|
+
async run(context) {
|
|
567
|
+
const token = await (0, auth_1.getAccessToken)(context.auth);
|
|
568
|
+
const baseUrl = context.auth.props.baseUrl;
|
|
569
|
+
const url = `${baseUrl}/api/v2/public/settings/items/${context.propsValue.id}`;
|
|
570
|
+
// Build body with only defined values (for partial updates)
|
|
571
|
+
const rawBody = {
|
|
572
|
+
type: context.propsValue.type,
|
|
573
|
+
name: context.propsValue.name,
|
|
574
|
+
baseUomId: context.propsValue.baseUomId,
|
|
575
|
+
baseUomName: context.propsValue.baseUomName,
|
|
576
|
+
description: context.propsValue.description,
|
|
577
|
+
category: typeof context.propsValue.category === 'string'
|
|
578
|
+
? JSON.parse(context.propsValue.category)
|
|
579
|
+
: context.propsValue.category,
|
|
580
|
+
active: context.propsValue.active,
|
|
581
|
+
integrationId: context.propsValue.integrationId,
|
|
582
|
+
canOverrideDesc: context.propsValue.canOverrideDesc,
|
|
583
|
+
longDescription: context.propsValue.longDescription,
|
|
584
|
+
manufacturer: context.propsValue.manufacturer,
|
|
585
|
+
retailPrice: context.propsValue.retailPrice,
|
|
586
|
+
tradePrice: context.propsValue.tradePrice,
|
|
587
|
+
standardCost: context.propsValue.standardCost,
|
|
588
|
+
economicOrderQty: context.propsValue.economicOrderQty,
|
|
589
|
+
safetyStockQty: context.propsValue.safetyStockQty,
|
|
590
|
+
leadTimeDays: context.propsValue.leadTimeDays,
|
|
591
|
+
upc: context.propsValue.upc,
|
|
592
|
+
itemSold: context.propsValue.itemSold,
|
|
593
|
+
saleGlCode: context.propsValue.saleGlCode,
|
|
594
|
+
saleTaxRateId: context.propsValue.saleTaxRateId,
|
|
595
|
+
saleTaxRateName: context.propsValue.saleTaxRateName,
|
|
596
|
+
itemPurchased: context.propsValue.itemPurchased,
|
|
597
|
+
purchaseGlCode: context.propsValue.purchaseGlCode,
|
|
598
|
+
purchaseTaxRateId: context.propsValue.purchaseTaxRateId,
|
|
599
|
+
purchaseTaxRateName: context.propsValue.purchaseTaxRateName,
|
|
600
|
+
codeInvoicingStatus: context.propsValue.codeInvoicingStatus,
|
|
601
|
+
suppliedBySubcontractor: context.propsValue.suppliedBySubcontractor,
|
|
602
|
+
autoCreateTask: context.propsValue.autoCreateTask,
|
|
603
|
+
customFields: context.propsValue.customFields,
|
|
604
|
+
trackingCategory1: context.propsValue.trackingCategory1,
|
|
605
|
+
trackingCategory2: context.propsValue.trackingCategory2,
|
|
606
|
+
uoms: context.propsValue.uoms,
|
|
607
|
+
};
|
|
608
|
+
const body = Object.fromEntries(Object.entries(rawBody).filter(([_, v]) => v !== undefined && v !== null && v !== ''));
|
|
609
|
+
const response = await pieces_common_1.httpClient.sendRequest({
|
|
610
|
+
method: pieces_common_1.HttpMethod.PATCH,
|
|
611
|
+
url: `${baseUrl}/api/v2/public/settings/items/${context.propsValue.id}`,
|
|
612
|
+
headers: {
|
|
613
|
+
Authorization: `Bearer ${token}`,
|
|
614
|
+
'Content-Type': 'application/json',
|
|
615
|
+
'X-WorkBuddy-Version': '2026-01',
|
|
616
|
+
},
|
|
617
|
+
body: body,
|
|
618
|
+
});
|
|
619
|
+
return response.body;
|
|
620
|
+
},
|
|
621
|
+
});
|
|
622
|
+
exports.PublicApiItemController_delete = (0, pieces_framework_1.createAction)({
|
|
623
|
+
name: 'PublicApiItemController_delete',
|
|
624
|
+
auth: auth_1.workbuddyAuth,
|
|
625
|
+
displayName: 'Delete item',
|
|
626
|
+
description: 'Deactivate a settings item by ID.',
|
|
627
|
+
props: {
|
|
628
|
+
id: pieces_framework_1.Property.ShortText({
|
|
629
|
+
displayName: 'Id',
|
|
630
|
+
description: 'Entity ID',
|
|
631
|
+
required: true,
|
|
632
|
+
}),
|
|
633
|
+
},
|
|
634
|
+
async run(context) {
|
|
635
|
+
const token = await (0, auth_1.getAccessToken)(context.auth);
|
|
636
|
+
const baseUrl = context.auth.props.baseUrl;
|
|
637
|
+
const url = `${baseUrl}/api/v2/public/settings/items/${context.propsValue.id}`;
|
|
638
|
+
const response = await pieces_common_1.httpClient.sendRequest({
|
|
639
|
+
method: pieces_common_1.HttpMethod.DELETE,
|
|
640
|
+
url: `${baseUrl}/api/v2/public/settings/items/${context.propsValue.id}`,
|
|
641
|
+
headers: {
|
|
642
|
+
Authorization: `Bearer ${token}`,
|
|
643
|
+
'Content-Type': 'application/json',
|
|
644
|
+
'X-WorkBuddy-Version': '2026-01',
|
|
645
|
+
},
|
|
646
|
+
});
|
|
647
|
+
return response.body;
|
|
648
|
+
},
|
|
649
|
+
});
|
|
650
|
+
exports.PublicApiItemCategoryController_list = (0, pieces_framework_1.createAction)({
|
|
651
|
+
name: 'PublicApiItemCategoryController_list',
|
|
652
|
+
auth: auth_1.workbuddyAuth,
|
|
653
|
+
displayName: 'List item categories',
|
|
654
|
+
description: 'Retrieve active item categories and sub-categories. Use search, name, or id to filter by category/sub-category name or id.',
|
|
655
|
+
props: {
|
|
656
|
+
id: pieces_framework_1.Property.ShortText({
|
|
657
|
+
displayName: 'Id',
|
|
658
|
+
description: 'Alias for search',
|
|
659
|
+
required: false,
|
|
660
|
+
}),
|
|
661
|
+
name: pieces_framework_1.Property.ShortText({
|
|
662
|
+
displayName: 'Name',
|
|
663
|
+
description: 'Alias for search',
|
|
664
|
+
required: false,
|
|
665
|
+
}),
|
|
666
|
+
search: pieces_framework_1.Property.ShortText({
|
|
667
|
+
displayName: 'Search',
|
|
668
|
+
description: 'Filter by category/sub-category name or id',
|
|
669
|
+
required: false,
|
|
670
|
+
}),
|
|
671
|
+
},
|
|
672
|
+
async run(context) {
|
|
673
|
+
const token = await (0, auth_1.getAccessToken)(context.auth);
|
|
674
|
+
const baseUrl = context.auth.props.baseUrl;
|
|
675
|
+
const url = `${baseUrl}/settings/item-categories`;
|
|
676
|
+
const queryParams = new URLSearchParams();
|
|
677
|
+
if (context.propsValue.id !== undefined && context.propsValue.id !== null && context.propsValue.id !== '')
|
|
678
|
+
queryParams.append('id', String(context.propsValue.id));
|
|
679
|
+
if (context.propsValue.name !== undefined && context.propsValue.name !== null && context.propsValue.name !== '')
|
|
680
|
+
queryParams.append('name', String(context.propsValue.name));
|
|
681
|
+
if (context.propsValue.search !== undefined &&
|
|
682
|
+
context.propsValue.search !== null &&
|
|
683
|
+
context.propsValue.search !== '')
|
|
684
|
+
queryParams.append('search', String(context.propsValue.search));
|
|
685
|
+
const queryString = queryParams.toString();
|
|
686
|
+
const urlWithQuery = queryString ? `${url}?${queryString}` : url;
|
|
687
|
+
const response = await pieces_common_1.httpClient.sendRequest({
|
|
688
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
689
|
+
url: urlWithQuery,
|
|
690
|
+
headers: {
|
|
691
|
+
Authorization: `Bearer ${token}`,
|
|
692
|
+
'Content-Type': 'application/json',
|
|
693
|
+
'X-WorkBuddy-Version': '2026-01',
|
|
694
|
+
},
|
|
695
|
+
});
|
|
696
|
+
return response.body;
|
|
697
|
+
},
|
|
698
|
+
});
|
|
699
|
+
exports.PublicApiItemCategoryController_upsert = (0, pieces_framework_1.createAction)({
|
|
700
|
+
name: 'PublicApiItemCategoryController_upsert',
|
|
701
|
+
auth: auth_1.workbuddyAuth,
|
|
702
|
+
displayName: 'Upsert item category',
|
|
703
|
+
description: 'Create a category/sub-category pair if it does not already exist.',
|
|
704
|
+
props: {
|
|
705
|
+
categoryId: pieces_framework_1.Property.ShortText({
|
|
706
|
+
displayName: 'Category Id',
|
|
707
|
+
description: 'category ID',
|
|
708
|
+
required: false,
|
|
709
|
+
}),
|
|
710
|
+
categoryName: pieces_framework_1.Property.ShortText({
|
|
711
|
+
displayName: 'Category Name',
|
|
712
|
+
description: '',
|
|
713
|
+
required: false,
|
|
714
|
+
}),
|
|
715
|
+
subCategoryId: pieces_framework_1.Property.ShortText({
|
|
716
|
+
displayName: 'Sub Category Id',
|
|
717
|
+
description: 'sub category ID',
|
|
718
|
+
required: false,
|
|
719
|
+
}),
|
|
720
|
+
subCategoryName: pieces_framework_1.Property.ShortText({
|
|
721
|
+
displayName: 'Sub Category Name',
|
|
722
|
+
description: '',
|
|
723
|
+
required: false,
|
|
724
|
+
}),
|
|
725
|
+
},
|
|
726
|
+
async run(context) {
|
|
727
|
+
const token = await (0, auth_1.getAccessToken)(context.auth);
|
|
728
|
+
const baseUrl = context.auth.props.baseUrl;
|
|
729
|
+
const url = `${baseUrl}/api/v2/public/settings/item-categories/upsert`;
|
|
730
|
+
const rawBody = {
|
|
731
|
+
categoryId: context.propsValue.categoryId,
|
|
732
|
+
categoryName: context.propsValue.categoryName,
|
|
733
|
+
subCategoryId: context.propsValue.subCategoryId,
|
|
734
|
+
subCategoryName: context.propsValue.subCategoryName,
|
|
735
|
+
};
|
|
736
|
+
const body = rawBody;
|
|
737
|
+
const response = await pieces_common_1.httpClient.sendRequest({
|
|
738
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
739
|
+
url: `${baseUrl}/api/v2/public/settings/item-categories/upsert`,
|
|
740
|
+
headers: {
|
|
741
|
+
Authorization: `Bearer ${token}`,
|
|
742
|
+
'Content-Type': 'application/json',
|
|
743
|
+
'X-WorkBuddy-Version': '2026-01',
|
|
744
|
+
},
|
|
745
|
+
body: body,
|
|
746
|
+
});
|
|
747
|
+
return response.body;
|
|
748
|
+
},
|
|
749
|
+
});
|
|
750
|
+
exports.PublicApiUoMController_list = (0, pieces_framework_1.createAction)({
|
|
751
|
+
name: 'PublicApiUoMController_list',
|
|
752
|
+
auth: auth_1.workbuddyAuth,
|
|
753
|
+
displayName: 'List UOMs',
|
|
754
|
+
description: 'Retrieve active units of measure for item create/update.',
|
|
755
|
+
props: {},
|
|
756
|
+
async run(context) {
|
|
757
|
+
const token = await (0, auth_1.getAccessToken)(context.auth);
|
|
758
|
+
const baseUrl = context.auth.props.baseUrl;
|
|
759
|
+
const url = `${baseUrl}/api/v2/public/settings/uoms`;
|
|
760
|
+
const response = await pieces_common_1.httpClient.sendRequest({
|
|
761
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
762
|
+
url: `${baseUrl}/api/v2/public/settings/uoms`,
|
|
763
|
+
headers: {
|
|
764
|
+
Authorization: `Bearer ${token}`,
|
|
765
|
+
'Content-Type': 'application/json',
|
|
766
|
+
'X-WorkBuddy-Version': '2026-01',
|
|
767
|
+
},
|
|
768
|
+
});
|
|
769
|
+
return response.body;
|
|
770
|
+
},
|
|
771
|
+
});
|
|
772
|
+
//# sourceMappingURL=settings-items.js.map
|