@prismatic-io/components-gusto 0.0.0-stage → 0.1.0
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/README.md +64 -2
- package/dist/icon.png +0 -0
- package/dist/index.js +227 -0
- package/npm-dist/icon.png +0 -0
- package/npm-dist/index.cjs +1335 -0
- package/npm-dist/index.d.cts +1279 -0
- package/package.json +50 -4
|
@@ -0,0 +1,1335 @@
|
|
|
1
|
+
let _prismatic_io_spectral = require("@prismatic-io/spectral");
|
|
2
|
+
let _prismatic_io_spectral_http = require("@prismatic-io/spectral/http");
|
|
3
|
+
var connections_default = [(0, _prismatic_io_spectral.oauth2Connection)({
|
|
4
|
+
key: "gustoOauth",
|
|
5
|
+
display: {
|
|
6
|
+
label: "OAuth 2.0",
|
|
7
|
+
description: "OAuth 2.0 connection for Gusto"
|
|
8
|
+
},
|
|
9
|
+
oauth2Type: _prismatic_io_spectral.OAuth2Type.AuthorizationCode,
|
|
10
|
+
inputs: {
|
|
11
|
+
authorizeUrl: {
|
|
12
|
+
label: "Authorize URL",
|
|
13
|
+
placeholder: "Authorize URL",
|
|
14
|
+
type: "string",
|
|
15
|
+
required: true,
|
|
16
|
+
shown: true,
|
|
17
|
+
default: "https://api.gusto.com/oauth/authorize",
|
|
18
|
+
model: [{
|
|
19
|
+
label: "Production (https://api.gusto.com/oauth/authorize)",
|
|
20
|
+
value: "https://api.gusto.com/oauth/authorize"
|
|
21
|
+
}, {
|
|
22
|
+
label: "Developer Sandbox (https://api.gusto-demo.com/oauth/authorize)",
|
|
23
|
+
value: "https://api.gusto-demo.com/oauth/authorize"
|
|
24
|
+
}],
|
|
25
|
+
comments: "The OAuth 2.0 Authorization URL for Gusto"
|
|
26
|
+
},
|
|
27
|
+
tokenUrl: {
|
|
28
|
+
label: "Token URL",
|
|
29
|
+
placeholder: "Token URL",
|
|
30
|
+
type: "string",
|
|
31
|
+
required: true,
|
|
32
|
+
shown: true,
|
|
33
|
+
default: "https://api.gusto.com/oauth/token",
|
|
34
|
+
model: [{
|
|
35
|
+
label: "Production (https://api.gusto.com/oauth/token)",
|
|
36
|
+
value: "https://api.gusto.com/oauth/token"
|
|
37
|
+
}, {
|
|
38
|
+
label: "Developer Sandbox (https://api.gusto-demo.com/oauth/token)",
|
|
39
|
+
value: "https://api.gusto-demo.com/oauth/token"
|
|
40
|
+
}],
|
|
41
|
+
comments: "The OAuth 2.0 Token URL for Gusto"
|
|
42
|
+
},
|
|
43
|
+
scopes: {
|
|
44
|
+
label: "Scopes",
|
|
45
|
+
placeholder: "Scopes",
|
|
46
|
+
type: "string",
|
|
47
|
+
required: false,
|
|
48
|
+
shown: false,
|
|
49
|
+
comments: "Scopes are not used for Gusto",
|
|
50
|
+
default: ""
|
|
51
|
+
},
|
|
52
|
+
clientId: {
|
|
53
|
+
label: "Client ID",
|
|
54
|
+
placeholder: "Client ID",
|
|
55
|
+
type: "string",
|
|
56
|
+
required: true,
|
|
57
|
+
shown: true,
|
|
58
|
+
comments: "Client Identifier of your app for the API",
|
|
59
|
+
example: "Client ID"
|
|
60
|
+
},
|
|
61
|
+
clientSecret: {
|
|
62
|
+
label: "Client Secret",
|
|
63
|
+
placeholder: "Client Secret",
|
|
64
|
+
type: "password",
|
|
65
|
+
required: true,
|
|
66
|
+
shown: true,
|
|
67
|
+
comments: "Client Secret of your app for the API",
|
|
68
|
+
example: "Client Secret"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
})];
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/constants.ts
|
|
74
|
+
const API_VERSION = "2026-02-01";
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/util.ts
|
|
77
|
+
const fetchToken = async (connection, debug) => {
|
|
78
|
+
const { clientId, clientSecret, tokenUrl } = connection.fields;
|
|
79
|
+
const { data } = await (0, _prismatic_io_spectral_http.createClient)({
|
|
80
|
+
baseUrl: _prismatic_io_spectral.util.types.toString(tokenUrl),
|
|
81
|
+
headers: { "Content-Type": "application/json" },
|
|
82
|
+
debug
|
|
83
|
+
}).post("", {
|
|
84
|
+
grant_type: "system_access",
|
|
85
|
+
client_id: _prismatic_io_spectral.util.types.toString(clientId),
|
|
86
|
+
client_secret: _prismatic_io_spectral.util.types.toString(clientSecret)
|
|
87
|
+
});
|
|
88
|
+
return data.access_token;
|
|
89
|
+
};
|
|
90
|
+
const toObject = (value) => value ? _prismatic_io_spectral.util.types.toObject(value) : {};
|
|
91
|
+
const toOptionalString = (value) => value ? _prismatic_io_spectral.util.types.toString(value) : void 0;
|
|
92
|
+
const fetchAllPages = async (client, url) => {
|
|
93
|
+
const allRecords = [];
|
|
94
|
+
let page = 1;
|
|
95
|
+
let hasMorePages = true;
|
|
96
|
+
do {
|
|
97
|
+
const { data, headers } = await client.get(url, { params: { page } });
|
|
98
|
+
allRecords.push(...data);
|
|
99
|
+
hasMorePages = _prismatic_io_spectral.util.types.toNumber(headers["x-total-pages"]) > _prismatic_io_spectral.util.types.toNumber(headers["x-page"]);
|
|
100
|
+
page += 1;
|
|
101
|
+
} while (hasMorePages);
|
|
102
|
+
return allRecords;
|
|
103
|
+
};
|
|
104
|
+
const fetchAllCursorEvents = async (client, url, params) => {
|
|
105
|
+
const allEvents = [];
|
|
106
|
+
let startingAfterUuid;
|
|
107
|
+
const pageSize = 100;
|
|
108
|
+
let hasNextPage = true;
|
|
109
|
+
do {
|
|
110
|
+
const queryParams = {
|
|
111
|
+
...params,
|
|
112
|
+
limit: _prismatic_io_spectral.util.types.toString(pageSize)
|
|
113
|
+
};
|
|
114
|
+
if (startingAfterUuid) queryParams.starting_after_uuid = startingAfterUuid;
|
|
115
|
+
const { data, headers } = await client.get(url, { params: queryParams });
|
|
116
|
+
allEvents.push(...data);
|
|
117
|
+
hasNextPage = _prismatic_io_spectral.util.types.toString(headers["x-has-next-page"]) === "true" && data.length > 0;
|
|
118
|
+
if (hasNextPage) startingAfterUuid = data[data.length - 1].uuid;
|
|
119
|
+
} while (hasNextPage);
|
|
120
|
+
return allEvents;
|
|
121
|
+
};
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/inputs.ts
|
|
124
|
+
const connectionInput = (0, _prismatic_io_spectral.input)({
|
|
125
|
+
label: "Connection",
|
|
126
|
+
required: true,
|
|
127
|
+
type: "connection"
|
|
128
|
+
});
|
|
129
|
+
const fetchAll = (0, _prismatic_io_spectral.input)({
|
|
130
|
+
label: "Fetch All",
|
|
131
|
+
type: "boolean",
|
|
132
|
+
clean: _prismatic_io_spectral.util.types.toBool,
|
|
133
|
+
comments: "When enabled, automatically fetches all pages of results. Pagination inputs are ignored when this is enabled.",
|
|
134
|
+
required: false,
|
|
135
|
+
default: "false"
|
|
136
|
+
});
|
|
137
|
+
const additionalFieldsInput = (0, _prismatic_io_spectral.input)({
|
|
138
|
+
label: "Additional Fields",
|
|
139
|
+
type: "code",
|
|
140
|
+
language: "json",
|
|
141
|
+
comments: "Additional fields that might not be covered by the standard inputs.",
|
|
142
|
+
required: false,
|
|
143
|
+
placeholder: "Enter additional fields",
|
|
144
|
+
example: JSON.stringify({ preferred_first_name: "John" }, null, 2),
|
|
145
|
+
clean: toObject
|
|
146
|
+
});
|
|
147
|
+
const companyIdInput = (0, _prismatic_io_spectral.input)({
|
|
148
|
+
label: "Company ID",
|
|
149
|
+
required: true,
|
|
150
|
+
type: "string",
|
|
151
|
+
comments: "A UUID representing a company.",
|
|
152
|
+
example: "00000000-0000-0000-0000-000000000000",
|
|
153
|
+
dataSource: "selectCompany",
|
|
154
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
155
|
+
});
|
|
156
|
+
const employeeIdInput = (0, _prismatic_io_spectral.input)({
|
|
157
|
+
label: "Employee ID",
|
|
158
|
+
required: true,
|
|
159
|
+
type: "string",
|
|
160
|
+
comments: "A UUID representing a employee.",
|
|
161
|
+
example: "00000000-0000-0000-0000-000000000000",
|
|
162
|
+
dataSource: "selectEmployee",
|
|
163
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
164
|
+
});
|
|
165
|
+
const payScheduleIdInput = (0, _prismatic_io_spectral.input)({
|
|
166
|
+
label: "Pay Schedule ID",
|
|
167
|
+
required: true,
|
|
168
|
+
type: "string",
|
|
169
|
+
comments: "A UUID representing a pay schedule.",
|
|
170
|
+
example: "00000000-0000-0000-0000-000000000000",
|
|
171
|
+
dataSource: "selectPaySchedule",
|
|
172
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
173
|
+
});
|
|
174
|
+
const paginationPageInput = (0, _prismatic_io_spectral.input)({
|
|
175
|
+
label: "Pagination Page",
|
|
176
|
+
required: false,
|
|
177
|
+
type: "string",
|
|
178
|
+
comments: "Which page of results to fetch. See [Gusto API documentation](https://docs.gusto.com/app-integrations/docs/pagination) for more information.",
|
|
179
|
+
clean: (value) => _prismatic_io_spectral.util.types.toInt(value) || void 0
|
|
180
|
+
});
|
|
181
|
+
const firstNameInput = (0, _prismatic_io_spectral.input)({
|
|
182
|
+
label: "First Name",
|
|
183
|
+
required: true,
|
|
184
|
+
type: "string",
|
|
185
|
+
comments: "The employee's first name.",
|
|
186
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
187
|
+
});
|
|
188
|
+
const middleInitialInput = (0, _prismatic_io_spectral.input)({
|
|
189
|
+
label: "Middle Initial",
|
|
190
|
+
required: false,
|
|
191
|
+
type: "string",
|
|
192
|
+
comments: "The employee's middle initial.",
|
|
193
|
+
clean: (value) => value ? _prismatic_io_spectral.util.types.toString(value) : void 0
|
|
194
|
+
});
|
|
195
|
+
const lastNameInput = (0, _prismatic_io_spectral.input)({
|
|
196
|
+
label: "Last Name",
|
|
197
|
+
required: true,
|
|
198
|
+
type: "string",
|
|
199
|
+
comments: "The employee's last name.",
|
|
200
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
201
|
+
});
|
|
202
|
+
const dateOfBirthInput = (0, _prismatic_io_spectral.input)({
|
|
203
|
+
label: "Date of Birth",
|
|
204
|
+
required: false,
|
|
205
|
+
type: "string",
|
|
206
|
+
comments: "The employee's date of birth.",
|
|
207
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
208
|
+
example: "1990-12-30"
|
|
209
|
+
});
|
|
210
|
+
const emailInput = (0, _prismatic_io_spectral.input)({
|
|
211
|
+
label: "Email Address",
|
|
212
|
+
required: false,
|
|
213
|
+
type: "string",
|
|
214
|
+
comments: "The employee's personal email address.",
|
|
215
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
216
|
+
example: "john.doe@example.com"
|
|
217
|
+
});
|
|
218
|
+
const selfOnboardingInput = (0, _prismatic_io_spectral.input)({
|
|
219
|
+
label: "Self Onboarding",
|
|
220
|
+
required: false,
|
|
221
|
+
type: "boolean",
|
|
222
|
+
comments: "If true, employee is expected to self-onboard. If false, payroll admin is expected to enter in the employee's onboarding information.",
|
|
223
|
+
clean: _prismatic_io_spectral.util.types.toBool,
|
|
224
|
+
default: "false"
|
|
225
|
+
});
|
|
226
|
+
const ssnInput = (0, _prismatic_io_spectral.input)({
|
|
227
|
+
label: "Social Security Number",
|
|
228
|
+
required: false,
|
|
229
|
+
type: "string",
|
|
230
|
+
comments: "The employee's social security number.",
|
|
231
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
232
|
+
example: "123-45-6789"
|
|
233
|
+
});
|
|
234
|
+
const terminationDateInput = (0, _prismatic_io_spectral.input)({
|
|
235
|
+
label: "Termination Date",
|
|
236
|
+
required: true,
|
|
237
|
+
type: "string",
|
|
238
|
+
comments: "The date the employee was terminated.",
|
|
239
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
240
|
+
example: "2020-12-30"
|
|
241
|
+
});
|
|
242
|
+
const runTerminationPayrollInput = (0, _prismatic_io_spectral.input)({
|
|
243
|
+
label: "Run Termination Payroll?",
|
|
244
|
+
required: true,
|
|
245
|
+
type: "boolean",
|
|
246
|
+
comments: "Whether to run a termination payroll for the employee.",
|
|
247
|
+
clean: _prismatic_io_spectral.util.types.toBool
|
|
248
|
+
});
|
|
249
|
+
const webhookUrlInput = (0, _prismatic_io_spectral.input)({
|
|
250
|
+
label: "Webhook URL",
|
|
251
|
+
required: true,
|
|
252
|
+
type: "string",
|
|
253
|
+
comments: "The URL for the webhook subscription.",
|
|
254
|
+
example: "https://example.com/webhooks",
|
|
255
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
256
|
+
});
|
|
257
|
+
const subscriptionTypesInput = (0, _prismatic_io_spectral.input)({
|
|
258
|
+
label: "Subscription Types",
|
|
259
|
+
required: true,
|
|
260
|
+
type: "text",
|
|
261
|
+
comments: "Types of notifications to receive when entities change. Enter as comma-separated values.",
|
|
262
|
+
example: "type1,type2",
|
|
263
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
264
|
+
});
|
|
265
|
+
const webhookSubscriptionUuidInput = (0, _prismatic_io_spectral.input)({
|
|
266
|
+
label: "Webhook Subscription UUID",
|
|
267
|
+
required: true,
|
|
268
|
+
type: "string",
|
|
269
|
+
comments: "The webhook subscription UUID.",
|
|
270
|
+
example: "00000000-0000-0000-0000-000000000000",
|
|
271
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
272
|
+
});
|
|
273
|
+
const startingAfterUuidInput = (0, _prismatic_io_spectral.input)({
|
|
274
|
+
label: "Starting After UUID",
|
|
275
|
+
required: false,
|
|
276
|
+
type: "string",
|
|
277
|
+
comments: "Serves as a cursor, returns all events occurring after specified UUID (exclusive).",
|
|
278
|
+
clean: toOptionalString
|
|
279
|
+
});
|
|
280
|
+
const eventTypeInput = (0, _prismatic_io_spectral.input)({
|
|
281
|
+
label: "Event Type",
|
|
282
|
+
required: false,
|
|
283
|
+
type: "string",
|
|
284
|
+
comments: "A string containing the exact event name or use a wildcard match to filter for a group of events.",
|
|
285
|
+
example: "employee.created",
|
|
286
|
+
clean: toOptionalString
|
|
287
|
+
});
|
|
288
|
+
const limitInput = (0, _prismatic_io_spectral.input)({
|
|
289
|
+
label: "Limit",
|
|
290
|
+
required: false,
|
|
291
|
+
type: "string",
|
|
292
|
+
comments: "Limits the number of objects returned in a single response, between 1 and 100. Defaults to 25.",
|
|
293
|
+
clean: toOptionalString
|
|
294
|
+
});
|
|
295
|
+
const resourceUuidInput = (0, _prismatic_io_spectral.input)({
|
|
296
|
+
label: "Resource UUID",
|
|
297
|
+
required: false,
|
|
298
|
+
type: "string",
|
|
299
|
+
comments: "The UUID of the company. If not specified, will return all events for all companies.",
|
|
300
|
+
example: "00000000-0000-0000-0000-000000000000",
|
|
301
|
+
clean: toOptionalString
|
|
302
|
+
});
|
|
303
|
+
const sortOrderInput = (0, _prismatic_io_spectral.input)({
|
|
304
|
+
label: "Sort Order",
|
|
305
|
+
required: false,
|
|
306
|
+
type: "string",
|
|
307
|
+
model: [{
|
|
308
|
+
label: "Ascending",
|
|
309
|
+
value: "asc"
|
|
310
|
+
}, {
|
|
311
|
+
label: "Descending",
|
|
312
|
+
value: "desc"
|
|
313
|
+
}],
|
|
314
|
+
comments: "Sort resulting events in ascending (asc) or descending (desc) chronological order.",
|
|
315
|
+
clean: toOptionalString
|
|
316
|
+
});
|
|
317
|
+
const apiVersionInput = (0, _prismatic_io_spectral.input)({
|
|
318
|
+
label: "API Version",
|
|
319
|
+
required: true,
|
|
320
|
+
type: "string",
|
|
321
|
+
comments: "The API version to use.",
|
|
322
|
+
example: API_VERSION,
|
|
323
|
+
default: API_VERSION,
|
|
324
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
325
|
+
});
|
|
326
|
+
//#endregion
|
|
327
|
+
//#region src/client.ts
|
|
328
|
+
const getBaseUrl = (connection) => {
|
|
329
|
+
return connection.fields.authorizeUrl === "https://api.gusto.com/oauth/authorize" ? "https://api.gusto.com/v1" : "https://api.gusto-demo.com/v1";
|
|
330
|
+
};
|
|
331
|
+
const createClient = (connection, debug = false) => {
|
|
332
|
+
return (0, _prismatic_io_spectral_http.createClient)({
|
|
333
|
+
baseUrl: getBaseUrl(connection),
|
|
334
|
+
headers: {
|
|
335
|
+
Authorization: `Bearer ${connection.token?.access_token}`,
|
|
336
|
+
"X-Gusto-API-Version": API_VERSION
|
|
337
|
+
},
|
|
338
|
+
debug
|
|
339
|
+
});
|
|
340
|
+
};
|
|
341
|
+
const createWebhookClient = async (connection, debug) => {
|
|
342
|
+
const token = await fetchToken(connection, debug);
|
|
343
|
+
return (0, _prismatic_io_spectral_http.createClient)({
|
|
344
|
+
baseUrl: getBaseUrl(connection),
|
|
345
|
+
headers: {
|
|
346
|
+
Authorization: `Bearer ${token}`,
|
|
347
|
+
"X-Gusto-API-Version": API_VERSION
|
|
348
|
+
},
|
|
349
|
+
debug
|
|
350
|
+
});
|
|
351
|
+
};
|
|
352
|
+
//#endregion
|
|
353
|
+
//#region src/examplePayloads.ts
|
|
354
|
+
const companyPayload = {
|
|
355
|
+
uuid: "c7a07c73-a703-4462-9343-1b181182b6e0",
|
|
356
|
+
name: "Shoppe Studios LLC",
|
|
357
|
+
trade_name: "Record Shoppe",
|
|
358
|
+
is_partner_managed: true,
|
|
359
|
+
tier: "complete",
|
|
360
|
+
locations: [{
|
|
361
|
+
street_1: "412 Kiera Stravenue",
|
|
362
|
+
street_2: "Suite 391",
|
|
363
|
+
city: "San Francisco",
|
|
364
|
+
state: "CA",
|
|
365
|
+
zip: "94107",
|
|
366
|
+
country: "USA",
|
|
367
|
+
active: true
|
|
368
|
+
}, {
|
|
369
|
+
street_1: "644 Fay Vista",
|
|
370
|
+
street_2: "Suite 842",
|
|
371
|
+
city: "Richmond",
|
|
372
|
+
state: "VA",
|
|
373
|
+
zip: "23218",
|
|
374
|
+
country: "USA",
|
|
375
|
+
active: true
|
|
376
|
+
}],
|
|
377
|
+
ein: "00-0000001",
|
|
378
|
+
entity_type: "C-Corporation",
|
|
379
|
+
pay_schedule_type: "by_department",
|
|
380
|
+
join_date: "2024-01-15",
|
|
381
|
+
funding_type: "ach",
|
|
382
|
+
slug: "shoppe-studios-llc",
|
|
383
|
+
is_suspended: false,
|
|
384
|
+
company_status: "Approved",
|
|
385
|
+
is_high_risk_business: false,
|
|
386
|
+
is_marijuana_business: false,
|
|
387
|
+
contractor_only: false,
|
|
388
|
+
compensations: {
|
|
389
|
+
hourly: [
|
|
390
|
+
{
|
|
391
|
+
uuid: "7da6b57d-22f9-11f1-ad28-0242ac100003",
|
|
392
|
+
name: "Overtime",
|
|
393
|
+
multiple: 1.5
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
uuid: "7da6b5ec-22f9-11f1-ad28-0242ac100003",
|
|
397
|
+
name: "Double overtime",
|
|
398
|
+
multiple: 2
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
uuid: "7da6b22f-22f9-11f1-ad28-0242ac100003",
|
|
402
|
+
name: "Regular",
|
|
403
|
+
multiple: 1
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
uuid: "7da6b3ac-22f9-11f1-ad28-0242ac100003",
|
|
407
|
+
name: "Outstanding vacation",
|
|
408
|
+
multiple: 1
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
uuid: "7da6b532-22f9-11f1-ad28-0242ac100003",
|
|
412
|
+
name: "Holiday",
|
|
413
|
+
multiple: 1
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
uuid: "7da6b44e-22f9-11f1-ad28-0242ac100003",
|
|
417
|
+
name: "Emergency sick - self care",
|
|
418
|
+
multiple: 1
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
uuid: "7da6b49d-22f9-11f1-ad28-0242ac100003",
|
|
422
|
+
name: "Emergency sick - caring for others",
|
|
423
|
+
multiple: 1
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
uuid: "7da6b4e6-22f9-11f1-ad28-0242ac100003",
|
|
427
|
+
name: "FMLA Public Health Emergency Leave",
|
|
428
|
+
multiple: 1
|
|
429
|
+
}
|
|
430
|
+
],
|
|
431
|
+
fixed: [
|
|
432
|
+
{
|
|
433
|
+
uuid: "7da68d82-22f9-11f1-ad28-0242ac100003",
|
|
434
|
+
name: "Bonus"
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
uuid: "7da69024-22f9-11f1-ad28-0242ac100003",
|
|
438
|
+
name: "Commission"
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
uuid: "7da69104-22f9-11f1-ad28-0242ac100003",
|
|
442
|
+
name: "Paycheck Tips"
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
uuid: "7da6918f-22f9-11f1-ad28-0242ac100003",
|
|
446
|
+
name: "Cash Tips"
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
uuid: "7da69216-22f9-11f1-ad28-0242ac100003",
|
|
450
|
+
name: "Correction Payment"
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
uuid: "7da692a6-22f9-11f1-ad28-0242ac100003",
|
|
454
|
+
name: "Severance"
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
uuid: "7da69356-22f9-11f1-ad28-0242ac100003",
|
|
458
|
+
name: "Minimum Wage Adjustment"
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
uuid: null,
|
|
462
|
+
name: "Reimbursement"
|
|
463
|
+
}
|
|
464
|
+
],
|
|
465
|
+
paid_time_off: [
|
|
466
|
+
{
|
|
467
|
+
uuid: "7dcdcb77-22f9-11f1-ad28-0242ac100003",
|
|
468
|
+
name: "Vacation Hours"
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
uuid: "7dcdcc8b-22f9-11f1-ad28-0242ac100003",
|
|
472
|
+
name: "Sick Hours"
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
uuid: null,
|
|
476
|
+
name: "Holiday Hours"
|
|
477
|
+
}
|
|
478
|
+
]
|
|
479
|
+
},
|
|
480
|
+
primary_signatory: {
|
|
481
|
+
uuid: "2d7cd96f-e2fb-4db7-8c04-99ef531b4527",
|
|
482
|
+
first_name: "Alda",
|
|
483
|
+
middle_initial: "",
|
|
484
|
+
last_name: "Carter",
|
|
485
|
+
phone: "4160000000",
|
|
486
|
+
email: "louie.hessel7757869450111547@zemlak.biz",
|
|
487
|
+
home_address: {
|
|
488
|
+
street_1: "524 Roob Divide",
|
|
489
|
+
street_2: "Suite 565",
|
|
490
|
+
city: "San Francisco",
|
|
491
|
+
state: "CA",
|
|
492
|
+
zip: "94107",
|
|
493
|
+
country: "USA"
|
|
494
|
+
}
|
|
495
|
+
},
|
|
496
|
+
primary_payroll_admin: {
|
|
497
|
+
first_name: "Ian",
|
|
498
|
+
last_name: "Labadie",
|
|
499
|
+
phone: "1-565-710-7559",
|
|
500
|
+
email: "louie.hessel7757869450111547@zemlak.biz"
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
const listCompaniesExamplePayload = { data: {
|
|
504
|
+
data: [companyPayload],
|
|
505
|
+
headers: {}
|
|
506
|
+
} };
|
|
507
|
+
const getCompanyExamplePayload = { data: {
|
|
508
|
+
data: companyPayload,
|
|
509
|
+
headers: {}
|
|
510
|
+
} };
|
|
511
|
+
const listCompanyAdminsExamplePayload = { data: {
|
|
512
|
+
data: [{
|
|
513
|
+
uuid: "987058cc-23ee-46e9-81ef-5cee086cceca",
|
|
514
|
+
first_name: "John",
|
|
515
|
+
last_name: "Smith",
|
|
516
|
+
email: "jsmith99@gmail.com",
|
|
517
|
+
phone: "8009360383"
|
|
518
|
+
}],
|
|
519
|
+
headers: {}
|
|
520
|
+
} };
|
|
521
|
+
const employeePayload = {
|
|
522
|
+
uuid: "d7282d99-ab6b-42f5-ba45-f4a670e886a8",
|
|
523
|
+
first_name: "Boaty",
|
|
524
|
+
middle_initial: null,
|
|
525
|
+
last_name: "Koss",
|
|
526
|
+
email: "keena.feest@kiehn.co.uk",
|
|
527
|
+
company_uuid: "e904cc79-818a-4da8-9d37-0be0a86fdda8",
|
|
528
|
+
manager_uuid: null,
|
|
529
|
+
version: "a5cec1f1c0135feb3e76ca6ea3c46176",
|
|
530
|
+
current_employment_status: "full_time",
|
|
531
|
+
onboarding_status: "onboarding_completed",
|
|
532
|
+
preferred_first_name: null,
|
|
533
|
+
department_uuid: null,
|
|
534
|
+
employee_code: "46f036",
|
|
535
|
+
payment_method: "Direct Deposit",
|
|
536
|
+
department: null,
|
|
537
|
+
terminated: false,
|
|
538
|
+
two_percent_shareholder: false,
|
|
539
|
+
onboarded: true,
|
|
540
|
+
historical: false,
|
|
541
|
+
has_ssn: true,
|
|
542
|
+
onboarding_documents_config: {
|
|
543
|
+
uuid: null,
|
|
544
|
+
i9_document: false
|
|
545
|
+
},
|
|
546
|
+
jobs: [{
|
|
547
|
+
uuid: "bc875f9d-adc5-40f6-99db-ed8470bda25f",
|
|
548
|
+
version: "863bcd01c51fcfa2468d604cffec7413",
|
|
549
|
+
employee_uuid: "d7282d99-ab6b-42f5-ba45-f4a670e886a8",
|
|
550
|
+
current_compensation_uuid: "2ec164d0-808b-446c-8120-8cfb500945d0",
|
|
551
|
+
payment_unit: "Year",
|
|
552
|
+
primary: true,
|
|
553
|
+
two_percent_shareholder: false,
|
|
554
|
+
state_wc_covered: null,
|
|
555
|
+
state_wc_class_code: null,
|
|
556
|
+
title: "",
|
|
557
|
+
compensations: [{
|
|
558
|
+
uuid: "2ec164d0-808b-446c-8120-8cfb500945d0",
|
|
559
|
+
employee_uuid: "d7282d99-ab6b-42f5-ba45-f4a670e886a8",
|
|
560
|
+
version: "db7bfb49a4f0893432cb562311bfcad9",
|
|
561
|
+
payment_unit: "Year",
|
|
562
|
+
flsa_status: "Exempt",
|
|
563
|
+
adjust_for_minimum_wage: false,
|
|
564
|
+
minimum_wages: [],
|
|
565
|
+
job_uuid: "bc875f9d-adc5-40f6-99db-ed8470bda25f",
|
|
566
|
+
effective_date: "2025-06-09",
|
|
567
|
+
rate: "80000.00"
|
|
568
|
+
}],
|
|
569
|
+
rate: "80000.00",
|
|
570
|
+
hire_date: "2024-06-09"
|
|
571
|
+
}],
|
|
572
|
+
eligible_paid_time_off: [],
|
|
573
|
+
terminations: [],
|
|
574
|
+
garnishments: [],
|
|
575
|
+
date_of_birth: "2005-06-09",
|
|
576
|
+
ssn: "",
|
|
577
|
+
phone: null,
|
|
578
|
+
work_email: null,
|
|
579
|
+
current_home_address: {
|
|
580
|
+
street_1: "412 Kiera Stravenue",
|
|
581
|
+
street_2: "Suite 391",
|
|
582
|
+
city: "San Francisco",
|
|
583
|
+
state: "CA",
|
|
584
|
+
zip: "94107",
|
|
585
|
+
country: "USA",
|
|
586
|
+
active: true,
|
|
587
|
+
uiud: "sample-uuid-123231"
|
|
588
|
+
},
|
|
589
|
+
all_home_addresses: [{
|
|
590
|
+
street_1: "412 Kiera Stravenue",
|
|
591
|
+
street_2: "Suite 391",
|
|
592
|
+
city: "San Francisco",
|
|
593
|
+
state: "CA",
|
|
594
|
+
zip: "94107",
|
|
595
|
+
country: "USA",
|
|
596
|
+
active: true,
|
|
597
|
+
uiud: "sample-uuid-123231"
|
|
598
|
+
}, {
|
|
599
|
+
street_1: "123 Example Rd",
|
|
600
|
+
street_2: null,
|
|
601
|
+
city: "Example City",
|
|
602
|
+
state: "EX",
|
|
603
|
+
zip: "12345",
|
|
604
|
+
country: "USA",
|
|
605
|
+
active: false,
|
|
606
|
+
uiud: "another-sample-uuid-456789"
|
|
607
|
+
}],
|
|
608
|
+
member_portal_invitation_status: {
|
|
609
|
+
status: "sent",
|
|
610
|
+
token_expired: false,
|
|
611
|
+
welcome_email_sent_at: "2024-01-15T14:30:00Z",
|
|
612
|
+
last_password_resent_at: null
|
|
613
|
+
},
|
|
614
|
+
partner_portal_invitation_sent: true
|
|
615
|
+
};
|
|
616
|
+
const listEmployeesExamplePayload = { data: {
|
|
617
|
+
data: [employeePayload],
|
|
618
|
+
headers: {}
|
|
619
|
+
} };
|
|
620
|
+
const getEmployeeExamplePayload = { data: {
|
|
621
|
+
data: employeePayload,
|
|
622
|
+
headers: {}
|
|
623
|
+
} };
|
|
624
|
+
const createEmployeeExamplePayload = { data: {
|
|
625
|
+
data: employeePayload,
|
|
626
|
+
headers: {}
|
|
627
|
+
} };
|
|
628
|
+
const findEmployeeByEmailExamplePayload = { data: {
|
|
629
|
+
data: employeePayload,
|
|
630
|
+
headers: {}
|
|
631
|
+
} };
|
|
632
|
+
const paySchedulePayload = {
|
|
633
|
+
uuid: "f2a69c38-e2f9-4e31-b5c5-4754fc60a052",
|
|
634
|
+
version: "68934a3e9455fa72420237eb05902327",
|
|
635
|
+
frequency: "Monthly",
|
|
636
|
+
anchor_pay_date: "2022-12-11",
|
|
637
|
+
anchor_end_of_pay_period: "2022-11-13",
|
|
638
|
+
day_1: 11,
|
|
639
|
+
day_2: null,
|
|
640
|
+
name: null,
|
|
641
|
+
custom_name: "every 11th of the month",
|
|
642
|
+
auto_pilot: true,
|
|
643
|
+
active: true,
|
|
644
|
+
auto_payroll_enablement_blockers: null
|
|
645
|
+
};
|
|
646
|
+
const listPaySchedulesExamplePayload = { data: {
|
|
647
|
+
data: [paySchedulePayload],
|
|
648
|
+
headers: {}
|
|
649
|
+
} };
|
|
650
|
+
const getPayScheduleExamplePayload = { data: {
|
|
651
|
+
data: [paySchedulePayload],
|
|
652
|
+
headers: {}
|
|
653
|
+
} };
|
|
654
|
+
const terminateEmployeeExamplePayload = { data: {
|
|
655
|
+
data: {
|
|
656
|
+
uuid: "f8a034b0-91e3-4976-b762-3f8a1d47c950",
|
|
657
|
+
employee_uuid: "9779767c-6044-48e0-bf68-aeb370b9a2e7",
|
|
658
|
+
active: true,
|
|
659
|
+
effective_date: "2024-03-15",
|
|
660
|
+
run_termination_payroll: false
|
|
661
|
+
},
|
|
662
|
+
headers: {}
|
|
663
|
+
} };
|
|
664
|
+
const webhookSubscriptionPayload = {
|
|
665
|
+
uuid: "c5fdae57-5483-4529-9aae-f0edceed92d4",
|
|
666
|
+
url: "https://partner-app.com/subscriber",
|
|
667
|
+
status: "verified",
|
|
668
|
+
subscription_types: [
|
|
669
|
+
"BankAccount",
|
|
670
|
+
"Company",
|
|
671
|
+
"CompanyBenefit",
|
|
672
|
+
"Contractor",
|
|
673
|
+
"ContractorPayment",
|
|
674
|
+
"Employee",
|
|
675
|
+
"EmployeeBenefit",
|
|
676
|
+
"EmployeeJobCompensation",
|
|
677
|
+
"ExternalPayroll",
|
|
678
|
+
"Form",
|
|
679
|
+
"Location",
|
|
680
|
+
"Notification",
|
|
681
|
+
"Payroll",
|
|
682
|
+
"PayrollSync",
|
|
683
|
+
"PaySchedule",
|
|
684
|
+
"Signatory"
|
|
685
|
+
]
|
|
686
|
+
};
|
|
687
|
+
const listWebhookSubscriptionsExamplePayload = { data: {
|
|
688
|
+
data: [webhookSubscriptionPayload],
|
|
689
|
+
headers: {}
|
|
690
|
+
} };
|
|
691
|
+
const getWebhookSubscriptionExamplePayload = { data: {
|
|
692
|
+
data: webhookSubscriptionPayload,
|
|
693
|
+
headers: {}
|
|
694
|
+
} };
|
|
695
|
+
const createWebhookSubscriptionExamplePayload = { data: {
|
|
696
|
+
data: webhookSubscriptionPayload,
|
|
697
|
+
headers: {}
|
|
698
|
+
} };
|
|
699
|
+
const updateWebhookSubscriptionExamplePayload = { data: {
|
|
700
|
+
data: webhookSubscriptionPayload,
|
|
701
|
+
headers: {}
|
|
702
|
+
} };
|
|
703
|
+
const deleteWebhookSubscriptionExamplePayload = { data: { message: "The resource was deleted successfully." } };
|
|
704
|
+
const getWebhookEventsExamplePayload = { data: {
|
|
705
|
+
data: [{
|
|
706
|
+
uuid: "f7397a24-57ad-4fae-b011-d258e8232900",
|
|
707
|
+
event_type: "employee.created",
|
|
708
|
+
resource_type: "Company",
|
|
709
|
+
resource_uuid: "92a20431-9489-4bde-ad27-6feb20b969d5",
|
|
710
|
+
entity_type: "Employee",
|
|
711
|
+
entity_uuid: "92a20431-9489-4bde-ad27-6feb20b969d5",
|
|
712
|
+
timestamp: 1686784995
|
|
713
|
+
}],
|
|
714
|
+
headers: {}
|
|
715
|
+
} };
|
|
716
|
+
//#endregion
|
|
717
|
+
//#region src/actions/companies.ts
|
|
718
|
+
const listCompanies = (0, _prismatic_io_spectral.action)({
|
|
719
|
+
display: {
|
|
720
|
+
label: "List Companies",
|
|
721
|
+
description: "List all companies that the currently authenticated user is a part of"
|
|
722
|
+
},
|
|
723
|
+
inputs: {
|
|
724
|
+
connection: connectionInput,
|
|
725
|
+
fetchAll,
|
|
726
|
+
page: paginationPageInput
|
|
727
|
+
},
|
|
728
|
+
perform: async (context, params) => {
|
|
729
|
+
const client = createClient(params.connection, context.debug.enabled);
|
|
730
|
+
if (params.fetchAll) return { data: {
|
|
731
|
+
data: await fetchAllPages(client, "/companies"),
|
|
732
|
+
headers: {}
|
|
733
|
+
} };
|
|
734
|
+
const { data, headers } = await client.get("/companies", { params: { page: params.page } });
|
|
735
|
+
return { data: {
|
|
736
|
+
data,
|
|
737
|
+
headers
|
|
738
|
+
} };
|
|
739
|
+
},
|
|
740
|
+
examplePayload: listCompaniesExamplePayload
|
|
741
|
+
});
|
|
742
|
+
var companies_default = {
|
|
743
|
+
getCompany: (0, _prismatic_io_spectral.action)({
|
|
744
|
+
display: {
|
|
745
|
+
label: "Get Company by ID",
|
|
746
|
+
description: "Get company metadata by ID"
|
|
747
|
+
},
|
|
748
|
+
inputs: {
|
|
749
|
+
connection: connectionInput,
|
|
750
|
+
companyId: companyIdInput
|
|
751
|
+
},
|
|
752
|
+
perform: async (context, params) => {
|
|
753
|
+
const { data, headers } = await createClient(params.connection, context.debug.enabled).get(`/companies/${params.companyId}`);
|
|
754
|
+
return { data: {
|
|
755
|
+
data,
|
|
756
|
+
headers
|
|
757
|
+
} };
|
|
758
|
+
},
|
|
759
|
+
examplePayload: getCompanyExamplePayload
|
|
760
|
+
}),
|
|
761
|
+
listCompanies,
|
|
762
|
+
listCompanyAdmins: (0, _prismatic_io_spectral.action)({
|
|
763
|
+
display: {
|
|
764
|
+
label: "List Company Admins",
|
|
765
|
+
description: "List all admin users at a company"
|
|
766
|
+
},
|
|
767
|
+
inputs: {
|
|
768
|
+
connection: connectionInput,
|
|
769
|
+
companyId: companyIdInput,
|
|
770
|
+
fetchAll,
|
|
771
|
+
page: paginationPageInput
|
|
772
|
+
},
|
|
773
|
+
perform: async (context, params) => {
|
|
774
|
+
const client = createClient(params.connection, context.debug.enabled);
|
|
775
|
+
if (params.fetchAll) return { data: {
|
|
776
|
+
data: await fetchAllPages(client, `/companies/${params.companyId}/admins`),
|
|
777
|
+
headers: {}
|
|
778
|
+
} };
|
|
779
|
+
const { data, headers } = await client.get(`/companies/${params.companyId}/admins`, { params: { page: params.page } });
|
|
780
|
+
return { data: {
|
|
781
|
+
data,
|
|
782
|
+
headers
|
|
783
|
+
} };
|
|
784
|
+
},
|
|
785
|
+
examplePayload: listCompanyAdminsExamplePayload
|
|
786
|
+
})
|
|
787
|
+
};
|
|
788
|
+
//#endregion
|
|
789
|
+
//#region src/actions/employees.ts
|
|
790
|
+
const listEmployees = (0, _prismatic_io_spectral.action)({
|
|
791
|
+
display: {
|
|
792
|
+
label: "List Employees",
|
|
793
|
+
description: "List employees of a company"
|
|
794
|
+
},
|
|
795
|
+
inputs: {
|
|
796
|
+
connection: connectionInput,
|
|
797
|
+
companyId: companyIdInput,
|
|
798
|
+
fetchAll,
|
|
799
|
+
page: paginationPageInput
|
|
800
|
+
},
|
|
801
|
+
perform: async (context, params) => {
|
|
802
|
+
const client = createClient(params.connection, context.debug.enabled);
|
|
803
|
+
if (params.fetchAll) return { data: {
|
|
804
|
+
data: await fetchAllPages(client, `/companies/${params.companyId}/employees`),
|
|
805
|
+
headers: {}
|
|
806
|
+
} };
|
|
807
|
+
const { data, headers } = await client.get(`/companies/${params.companyId}/employees`, { params: { page: params.page } });
|
|
808
|
+
return { data: {
|
|
809
|
+
data,
|
|
810
|
+
headers
|
|
811
|
+
} };
|
|
812
|
+
},
|
|
813
|
+
examplePayload: listEmployeesExamplePayload
|
|
814
|
+
});
|
|
815
|
+
const getEmployee = (0, _prismatic_io_spectral.action)({
|
|
816
|
+
display: {
|
|
817
|
+
label: "Get Employee",
|
|
818
|
+
description: "Get an employee by ID"
|
|
819
|
+
},
|
|
820
|
+
inputs: {
|
|
821
|
+
connection: connectionInput,
|
|
822
|
+
employeeId: employeeIdInput
|
|
823
|
+
},
|
|
824
|
+
perform: async (context, params) => {
|
|
825
|
+
const { data, headers } = await createClient(params.connection, context.debug.enabled).get(`/employees/${params.employeeId}`);
|
|
826
|
+
return { data: {
|
|
827
|
+
data,
|
|
828
|
+
headers
|
|
829
|
+
} };
|
|
830
|
+
},
|
|
831
|
+
examplePayload: getEmployeeExamplePayload
|
|
832
|
+
});
|
|
833
|
+
var employees_default = {
|
|
834
|
+
createEmployee: (0, _prismatic_io_spectral.action)({
|
|
835
|
+
display: {
|
|
836
|
+
label: "Create Employee",
|
|
837
|
+
description: "Create an employee of a company"
|
|
838
|
+
},
|
|
839
|
+
inputs: {
|
|
840
|
+
connection: connectionInput,
|
|
841
|
+
companyId: companyIdInput,
|
|
842
|
+
firstName: firstNameInput,
|
|
843
|
+
middleInitial: middleInitialInput,
|
|
844
|
+
lastName: lastNameInput,
|
|
845
|
+
dateOfBirth: dateOfBirthInput,
|
|
846
|
+
email: {
|
|
847
|
+
...emailInput,
|
|
848
|
+
comments: `${emailInput.comments} Required if Self Onboarding is true.`
|
|
849
|
+
},
|
|
850
|
+
ssn: ssnInput,
|
|
851
|
+
selfOnboarding: selfOnboardingInput,
|
|
852
|
+
additionalFields: additionalFieldsInput
|
|
853
|
+
},
|
|
854
|
+
perform: async (context, params) => {
|
|
855
|
+
if (params.selfOnboarding && !params.email) throw new Error("Email Address is required when Self Onboarding is enabled.");
|
|
856
|
+
const { data, headers } = await createClient(params.connection, context.debug.enabled).post(`/companies/${params.companyId}/employees`, {
|
|
857
|
+
first_name: params.firstName,
|
|
858
|
+
middle_initial: params.middleInitial,
|
|
859
|
+
last_name: params.lastName,
|
|
860
|
+
date_of_birth: params.dateOfBirth,
|
|
861
|
+
email: params.email,
|
|
862
|
+
ssn: params.ssn,
|
|
863
|
+
self_onboarding: params.selfOnboarding,
|
|
864
|
+
...params.additionalFields
|
|
865
|
+
});
|
|
866
|
+
return { data: {
|
|
867
|
+
data,
|
|
868
|
+
headers
|
|
869
|
+
} };
|
|
870
|
+
},
|
|
871
|
+
examplePayload: createEmployeeExamplePayload
|
|
872
|
+
}),
|
|
873
|
+
findEmployeeByEmail: (0, _prismatic_io_spectral.action)({
|
|
874
|
+
display: {
|
|
875
|
+
label: "Find Employee by Email",
|
|
876
|
+
description: "Get an employee by personal email address."
|
|
877
|
+
},
|
|
878
|
+
inputs: {
|
|
879
|
+
connection: connectionInput,
|
|
880
|
+
companyId: companyIdInput,
|
|
881
|
+
email: {
|
|
882
|
+
...emailInput,
|
|
883
|
+
required: true
|
|
884
|
+
}
|
|
885
|
+
},
|
|
886
|
+
perform: async (context, params) => {
|
|
887
|
+
const client = createClient(params.connection, context.debug.enabled);
|
|
888
|
+
let page = 1;
|
|
889
|
+
let hasMorePages = true;
|
|
890
|
+
do {
|
|
891
|
+
const { data: employees, headers } = await client.get(`/companies/${params.companyId}/employees`, { params: {
|
|
892
|
+
page,
|
|
893
|
+
per: 5
|
|
894
|
+
} });
|
|
895
|
+
for (const employee of employees) if (employee.email === params.email) return { data: {
|
|
896
|
+
data: employee,
|
|
897
|
+
headers
|
|
898
|
+
} };
|
|
899
|
+
hasMorePages = headers["x-total-pages"] > headers["x-page"];
|
|
900
|
+
page += 1;
|
|
901
|
+
} while (hasMorePages);
|
|
902
|
+
throw new Error("Employee not found");
|
|
903
|
+
},
|
|
904
|
+
examplePayload: findEmployeeByEmailExamplePayload
|
|
905
|
+
}),
|
|
906
|
+
getEmployee,
|
|
907
|
+
listEmployees
|
|
908
|
+
};
|
|
909
|
+
//#endregion
|
|
910
|
+
//#region src/actions/paySchedules.ts
|
|
911
|
+
const listPaySchedules = (0, _prismatic_io_spectral.action)({
|
|
912
|
+
display: {
|
|
913
|
+
label: "List Pay Schedules",
|
|
914
|
+
description: "List pay schedules for a company"
|
|
915
|
+
},
|
|
916
|
+
inputs: {
|
|
917
|
+
connection: connectionInput,
|
|
918
|
+
companyId: companyIdInput,
|
|
919
|
+
fetchAll,
|
|
920
|
+
page: paginationPageInput
|
|
921
|
+
},
|
|
922
|
+
perform: async (context, params) => {
|
|
923
|
+
const client = createClient(params.connection, context.debug.enabled);
|
|
924
|
+
if (params.fetchAll) return { data: {
|
|
925
|
+
data: await fetchAllPages(client, `/companies/${params.companyId}/pay_schedules`),
|
|
926
|
+
headers: {}
|
|
927
|
+
} };
|
|
928
|
+
const { data, headers } = await client.get(`/companies/${params.companyId}/pay_schedules`, { params: { page: params.page } });
|
|
929
|
+
return { data: {
|
|
930
|
+
data,
|
|
931
|
+
headers
|
|
932
|
+
} };
|
|
933
|
+
},
|
|
934
|
+
examplePayload: listPaySchedulesExamplePayload
|
|
935
|
+
});
|
|
936
|
+
var paySchedules_default = {
|
|
937
|
+
getPaySchedule: (0, _prismatic_io_spectral.action)({
|
|
938
|
+
display: {
|
|
939
|
+
label: "Get Pay Schedule by ID",
|
|
940
|
+
description: "Get a pay schedules for a company by pay schedule ID"
|
|
941
|
+
},
|
|
942
|
+
inputs: {
|
|
943
|
+
connection: connectionInput,
|
|
944
|
+
companyId: companyIdInput,
|
|
945
|
+
payScheduleId: payScheduleIdInput
|
|
946
|
+
},
|
|
947
|
+
perform: async (context, params) => {
|
|
948
|
+
const { data, headers } = await createClient(params.connection, context.debug.enabled).get(`/companies/${params.companyId}/pay_schedules/${params.payScheduleId}`);
|
|
949
|
+
return { data: {
|
|
950
|
+
data,
|
|
951
|
+
headers
|
|
952
|
+
} };
|
|
953
|
+
},
|
|
954
|
+
examplePayload: getPayScheduleExamplePayload
|
|
955
|
+
}),
|
|
956
|
+
listPaySchedules
|
|
957
|
+
};
|
|
958
|
+
var terminations_default = { terminateEmployee: (0, _prismatic_io_spectral.action)({
|
|
959
|
+
display: {
|
|
960
|
+
label: "Terminate Employee",
|
|
961
|
+
description: "End an employee's employment"
|
|
962
|
+
},
|
|
963
|
+
inputs: {
|
|
964
|
+
connection: connectionInput,
|
|
965
|
+
employeeId: employeeIdInput,
|
|
966
|
+
terminationDate: terminationDateInput,
|
|
967
|
+
runTerminationPayroll: runTerminationPayrollInput
|
|
968
|
+
},
|
|
969
|
+
perform: async (context, params) => {
|
|
970
|
+
const { data, headers } = await createClient(params.connection, context.debug.enabled).post(`/employees/${params.employeeId}/terminations`, {
|
|
971
|
+
effective_date: params.terminationDate,
|
|
972
|
+
run_termination_payroll: params.runTerminationPayroll
|
|
973
|
+
});
|
|
974
|
+
return { data: {
|
|
975
|
+
data,
|
|
976
|
+
headers
|
|
977
|
+
} };
|
|
978
|
+
},
|
|
979
|
+
examplePayload: terminateEmployeeExamplePayload
|
|
980
|
+
}) };
|
|
981
|
+
var webhooks_default = {
|
|
982
|
+
listWebhookSubscriptions: (0, _prismatic_io_spectral.action)({
|
|
983
|
+
display: {
|
|
984
|
+
label: "List Webhook Subscriptions",
|
|
985
|
+
description: "Returns all webhook subscriptions associated with the provided Partner API token for Gusto."
|
|
986
|
+
},
|
|
987
|
+
inputs: { connection: connectionInput },
|
|
988
|
+
perform: async (context, params) => {
|
|
989
|
+
const { data, headers } = await (await createWebhookClient(params.connection, context.debug.enabled)).get(`/webhook_subscriptions`);
|
|
990
|
+
return { data: {
|
|
991
|
+
data,
|
|
992
|
+
headers
|
|
993
|
+
} };
|
|
994
|
+
},
|
|
995
|
+
examplePayload: listWebhookSubscriptionsExamplePayload
|
|
996
|
+
}),
|
|
997
|
+
getWebhookSubscription: (0, _prismatic_io_spectral.action)({
|
|
998
|
+
display: {
|
|
999
|
+
label: "Get Webhook Subscription",
|
|
1000
|
+
description: "Returns the Webhook Subscription associated with the provided UUID for Gusto."
|
|
1001
|
+
},
|
|
1002
|
+
inputs: {
|
|
1003
|
+
connection: connectionInput,
|
|
1004
|
+
webhookSubscriptionUuid: webhookSubscriptionUuidInput
|
|
1005
|
+
},
|
|
1006
|
+
perform: async (context, params) => {
|
|
1007
|
+
const client = await createWebhookClient(params.connection, context.debug.enabled);
|
|
1008
|
+
const endpoint = `/webhook_subscriptions/${params.webhookSubscriptionUuid}`;
|
|
1009
|
+
const { data, headers } = await client.get(endpoint);
|
|
1010
|
+
return { data: {
|
|
1011
|
+
data,
|
|
1012
|
+
headers
|
|
1013
|
+
} };
|
|
1014
|
+
},
|
|
1015
|
+
examplePayload: getWebhookSubscriptionExamplePayload
|
|
1016
|
+
}),
|
|
1017
|
+
createWebhookSubscription: (0, _prismatic_io_spectral.action)({
|
|
1018
|
+
display: {
|
|
1019
|
+
label: "Create Webhook Subscription",
|
|
1020
|
+
description: "Creates a Webhook Subscription to receive notifications when entities change for Gusto."
|
|
1021
|
+
},
|
|
1022
|
+
inputs: {
|
|
1023
|
+
connection: connectionInput,
|
|
1024
|
+
webhookUrl: webhookUrlInput,
|
|
1025
|
+
subscriptionTypes: subscriptionTypesInput
|
|
1026
|
+
},
|
|
1027
|
+
perform: async (context, params) => {
|
|
1028
|
+
const client = await createWebhookClient(params.connection, context.debug.enabled);
|
|
1029
|
+
const cleanedSubscriptionTypes = params.subscriptionTypes.split(",").map((str) => str.trim());
|
|
1030
|
+
const body = {
|
|
1031
|
+
url: params.webhookUrl,
|
|
1032
|
+
subscription_types: cleanedSubscriptionTypes
|
|
1033
|
+
};
|
|
1034
|
+
const { data, headers } = await client.post(`/webhook_subscriptions`, body);
|
|
1035
|
+
return { data: {
|
|
1036
|
+
data,
|
|
1037
|
+
headers
|
|
1038
|
+
} };
|
|
1039
|
+
},
|
|
1040
|
+
examplePayload: createWebhookSubscriptionExamplePayload
|
|
1041
|
+
}),
|
|
1042
|
+
updateWebhookSubscription: (0, _prismatic_io_spectral.action)({
|
|
1043
|
+
display: {
|
|
1044
|
+
label: "Update Webhook Subscription",
|
|
1045
|
+
description: "Updates the Webhook Subscription associated with the provided UUID for Gusto."
|
|
1046
|
+
},
|
|
1047
|
+
inputs: {
|
|
1048
|
+
connection: connectionInput,
|
|
1049
|
+
webhookSubscriptionUuid: webhookSubscriptionUuidInput,
|
|
1050
|
+
subscriptionTypes: subscriptionTypesInput
|
|
1051
|
+
},
|
|
1052
|
+
perform: async (context, params) => {
|
|
1053
|
+
const client = await createWebhookClient(params.connection, context.debug.enabled);
|
|
1054
|
+
const body = { subscription_types: params.subscriptionTypes.split(",").map((str) => str.trim()) };
|
|
1055
|
+
const { data, headers } = await client.put(`/webhook_subscriptions/${params.webhookSubscriptionUuid}`, body);
|
|
1056
|
+
return { data: {
|
|
1057
|
+
data,
|
|
1058
|
+
headers
|
|
1059
|
+
} };
|
|
1060
|
+
},
|
|
1061
|
+
examplePayload: updateWebhookSubscriptionExamplePayload
|
|
1062
|
+
}),
|
|
1063
|
+
deleteWebhookSubscription: (0, _prismatic_io_spectral.action)({
|
|
1064
|
+
display: {
|
|
1065
|
+
label: "Delete Webhook Subscription",
|
|
1066
|
+
description: "Deletes the Webhook Subscription associated with the provided UUID for Gusto."
|
|
1067
|
+
},
|
|
1068
|
+
inputs: {
|
|
1069
|
+
connection: connectionInput,
|
|
1070
|
+
webhookSubscriptionUuid: webhookSubscriptionUuidInput
|
|
1071
|
+
},
|
|
1072
|
+
perform: async (context, params) => {
|
|
1073
|
+
await (await createWebhookClient(params.connection, context.debug.enabled)).delete(`/webhook_subscriptions/${params.webhookSubscriptionUuid}`);
|
|
1074
|
+
return { data: { message: "The resource was deleted successfully." } };
|
|
1075
|
+
},
|
|
1076
|
+
examplePayload: deleteWebhookSubscriptionExamplePayload
|
|
1077
|
+
}),
|
|
1078
|
+
getWebhookEvents: (0, _prismatic_io_spectral.action)({
|
|
1079
|
+
display: {
|
|
1080
|
+
label: "Get Webhook Events",
|
|
1081
|
+
description: "Get webhook events based on the partner application's scopes for Gusto."
|
|
1082
|
+
},
|
|
1083
|
+
inputs: {
|
|
1084
|
+
connection: connectionInput,
|
|
1085
|
+
resourceUuid: resourceUuidInput,
|
|
1086
|
+
eventType: eventTypeInput,
|
|
1087
|
+
sortOrder: sortOrderInput,
|
|
1088
|
+
fetchAll,
|
|
1089
|
+
startingAfterUuid: startingAfterUuidInput,
|
|
1090
|
+
limit: limitInput
|
|
1091
|
+
},
|
|
1092
|
+
perform: async (context, params) => {
|
|
1093
|
+
const client = await createWebhookClient(params.connection, context.debug.enabled);
|
|
1094
|
+
if (params.fetchAll) return { data: {
|
|
1095
|
+
data: await fetchAllCursorEvents(client, "/events", {
|
|
1096
|
+
resource_uuid: params.resourceUuid,
|
|
1097
|
+
event_type: params.eventType,
|
|
1098
|
+
sort_order: params.sortOrder
|
|
1099
|
+
}),
|
|
1100
|
+
headers: {}
|
|
1101
|
+
} };
|
|
1102
|
+
const queryParams = {
|
|
1103
|
+
resource_uuid: params.resourceUuid,
|
|
1104
|
+
event_type: params.eventType,
|
|
1105
|
+
starting_after_uuid: params.startingAfterUuid,
|
|
1106
|
+
limit: params.limit,
|
|
1107
|
+
sort_order: params.sortOrder
|
|
1108
|
+
};
|
|
1109
|
+
const { data, headers } = await client.get(`/events`, { params: queryParams });
|
|
1110
|
+
return { data: {
|
|
1111
|
+
data,
|
|
1112
|
+
headers
|
|
1113
|
+
} };
|
|
1114
|
+
},
|
|
1115
|
+
examplePayload: getWebhookEventsExamplePayload
|
|
1116
|
+
})
|
|
1117
|
+
};
|
|
1118
|
+
//#endregion
|
|
1119
|
+
//#region src/actions/rawRequest.ts
|
|
1120
|
+
const { debugRequest: _, ...rest } = _prismatic_io_spectral_http.inputs;
|
|
1121
|
+
const rawRequest = (0, _prismatic_io_spectral.action)({
|
|
1122
|
+
display: {
|
|
1123
|
+
label: "Raw Request",
|
|
1124
|
+
description: "Send raw HTTP request to Gusto"
|
|
1125
|
+
},
|
|
1126
|
+
inputs: {
|
|
1127
|
+
connection: connectionInput,
|
|
1128
|
+
apiVersion: apiVersionInput,
|
|
1129
|
+
...rest,
|
|
1130
|
+
url: {
|
|
1131
|
+
...rest.url,
|
|
1132
|
+
comments: "Input the path only (/provision), The base URL is already included (https://api.gusto.com/v1). For example, to connect to https://api.gusto.com/v1/provision, only /provision is entered in this field.",
|
|
1133
|
+
example: "/provision"
|
|
1134
|
+
}
|
|
1135
|
+
},
|
|
1136
|
+
perform: async (context, { connection, apiVersion, ...rest }) => {
|
|
1137
|
+
const { data, headers } = await (0, _prismatic_io_spectral_http.sendRawRequest)(getBaseUrl(connection), {
|
|
1138
|
+
...rest,
|
|
1139
|
+
debugRequest: context.debug.enabled
|
|
1140
|
+
}, {
|
|
1141
|
+
Authorization: `Bearer ${connection.token?.access_token}`,
|
|
1142
|
+
"X-Gusto-API-Version": apiVersion
|
|
1143
|
+
});
|
|
1144
|
+
return { data: {
|
|
1145
|
+
data,
|
|
1146
|
+
headers
|
|
1147
|
+
} };
|
|
1148
|
+
}
|
|
1149
|
+
});
|
|
1150
|
+
//#endregion
|
|
1151
|
+
//#region src/actions/index.ts
|
|
1152
|
+
var actions_default = {
|
|
1153
|
+
...companies_default,
|
|
1154
|
+
...employees_default,
|
|
1155
|
+
...paySchedules_default,
|
|
1156
|
+
...terminations_default,
|
|
1157
|
+
...webhooks_default,
|
|
1158
|
+
rawRequest
|
|
1159
|
+
};
|
|
1160
|
+
//#endregion
|
|
1161
|
+
//#region src/dataSources/index.ts
|
|
1162
|
+
var dataSources_default = {
|
|
1163
|
+
selectCompany: (0, _prismatic_io_spectral.dataSource)({
|
|
1164
|
+
display: {
|
|
1165
|
+
label: "Select Company",
|
|
1166
|
+
description: "A picklist of companies in your Gusto account."
|
|
1167
|
+
},
|
|
1168
|
+
dataSourceType: "picklist",
|
|
1169
|
+
inputs: { connection: connectionInput },
|
|
1170
|
+
perform: async (_context, { connection }) => {
|
|
1171
|
+
const { data } = await createClient(connection).get("/companies");
|
|
1172
|
+
return { result: data.map((company) => ({
|
|
1173
|
+
label: company.name,
|
|
1174
|
+
key: company.uuid.toString()
|
|
1175
|
+
})).sort((a, b) => (a.label ?? "") < (b.label ?? "") ? -1 : 1) };
|
|
1176
|
+
},
|
|
1177
|
+
examplePayload: { result: [{
|
|
1178
|
+
label: "Acme Corporation",
|
|
1179
|
+
key: "c44d66dc-c41b-4a60-9e25-5e93ff8583f2"
|
|
1180
|
+
}] }
|
|
1181
|
+
}),
|
|
1182
|
+
selectEmployee: (0, _prismatic_io_spectral.dataSource)({
|
|
1183
|
+
display: {
|
|
1184
|
+
label: "Select Employee",
|
|
1185
|
+
description: "A picklist of employees for the selected company."
|
|
1186
|
+
},
|
|
1187
|
+
dataSourceType: "picklist",
|
|
1188
|
+
inputs: {
|
|
1189
|
+
connection: connectionInput,
|
|
1190
|
+
companyId: {
|
|
1191
|
+
...companyIdInput,
|
|
1192
|
+
dataSource: void 0
|
|
1193
|
+
}
|
|
1194
|
+
},
|
|
1195
|
+
perform: async (_context, { connection, companyId }) => {
|
|
1196
|
+
const client = createClient(connection);
|
|
1197
|
+
let page = 1;
|
|
1198
|
+
let hasMorePages = true;
|
|
1199
|
+
const employees = [];
|
|
1200
|
+
do {
|
|
1201
|
+
const { data, headers } = await client.get(`/companies/${companyId}/employees`, { params: { page } });
|
|
1202
|
+
employees.push(...data);
|
|
1203
|
+
hasMorePages = headers["x-total-pages"] > headers["x-page"];
|
|
1204
|
+
page += 1;
|
|
1205
|
+
} while (hasMorePages);
|
|
1206
|
+
return { result: employees.map((employee) => ({
|
|
1207
|
+
label: `${employee.first_name} ${employee.last_name}`,
|
|
1208
|
+
key: employee.uuid.toString()
|
|
1209
|
+
})).sort((a, b) => (a.label ?? "") < (b.label ?? "") ? -1 : 1) };
|
|
1210
|
+
},
|
|
1211
|
+
examplePayload: { result: [{
|
|
1212
|
+
label: "Nicole Boehm",
|
|
1213
|
+
key: "9779767c-6044-48e0-bf68-aeb370b9a2e7"
|
|
1214
|
+
}] }
|
|
1215
|
+
}),
|
|
1216
|
+
selectPaySchedule: (0, _prismatic_io_spectral.dataSource)({
|
|
1217
|
+
display: {
|
|
1218
|
+
label: "Select Pay Schedule",
|
|
1219
|
+
description: "A picklist of pay schedules for the selected company."
|
|
1220
|
+
},
|
|
1221
|
+
dataSourceType: "picklist",
|
|
1222
|
+
inputs: {
|
|
1223
|
+
connection: connectionInput,
|
|
1224
|
+
companyId: {
|
|
1225
|
+
...companyIdInput,
|
|
1226
|
+
dataSource: void 0
|
|
1227
|
+
}
|
|
1228
|
+
},
|
|
1229
|
+
perform: async (_context, { connection, companyId }) => {
|
|
1230
|
+
const client = createClient(connection);
|
|
1231
|
+
let page = 1;
|
|
1232
|
+
let hasMorePages = true;
|
|
1233
|
+
const paySchedules = [];
|
|
1234
|
+
do {
|
|
1235
|
+
const { data, headers } = await client.get(`/companies/${companyId}/pay_schedules`, { params: { page } });
|
|
1236
|
+
paySchedules.push(...data);
|
|
1237
|
+
hasMorePages = headers["x-total-pages"] > headers["x-page"];
|
|
1238
|
+
page += 1;
|
|
1239
|
+
} while (hasMorePages);
|
|
1240
|
+
return { result: paySchedules.map((schedule) => ({
|
|
1241
|
+
label: `${schedule.name} (${schedule.frequency})`,
|
|
1242
|
+
key: schedule.uuid.toString()
|
|
1243
|
+
})).sort((a, b) => (a.label ?? "") < (b.label ?? "") ? -1 : 1) };
|
|
1244
|
+
},
|
|
1245
|
+
examplePayload: { result: [{
|
|
1246
|
+
label: "Engineering (Twice per month)",
|
|
1247
|
+
key: "2097fe08-407a-46d7-b35c-a32402a2355e"
|
|
1248
|
+
}] }
|
|
1249
|
+
})
|
|
1250
|
+
};
|
|
1251
|
+
//#endregion
|
|
1252
|
+
//#region src/triggers.ts
|
|
1253
|
+
async function listWebhookSubscriptions(client) {
|
|
1254
|
+
const { data } = await client.get("/webhook_subscriptions");
|
|
1255
|
+
return data;
|
|
1256
|
+
}
|
|
1257
|
+
async function verifyWebhookSubscription(client, webhookUuid, verificationToken) {
|
|
1258
|
+
const endpoint = `/webhook_subscriptions/${webhookUuid}/verify`;
|
|
1259
|
+
try {
|
|
1260
|
+
return (await client.put(endpoint, { verification_token: verificationToken })).data;
|
|
1261
|
+
} catch (error) {
|
|
1262
|
+
console.error("Error verifying webhook:", error);
|
|
1263
|
+
throw error;
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
var triggers_default = { gustoWebhookTrigger: (0, _prismatic_io_spectral.trigger)({
|
|
1267
|
+
display: {
|
|
1268
|
+
label: "Webhook",
|
|
1269
|
+
description: "Receive and validate webhook requests from Gusto for webhooks you configure."
|
|
1270
|
+
},
|
|
1271
|
+
scheduleSupport: "invalid",
|
|
1272
|
+
synchronousResponseSupport: "valid",
|
|
1273
|
+
allowsBranching: true,
|
|
1274
|
+
inputs: { connection: connectionInput },
|
|
1275
|
+
staticBranchNames: ["Notification", "URL Validation"],
|
|
1276
|
+
perform: async (context, payload, params) => {
|
|
1277
|
+
const headers = _prismatic_io_spectral.util.types.lowerCaseHeaders(payload.headers);
|
|
1278
|
+
const client = await createWebhookClient(params.connection, context.debug.enabled);
|
|
1279
|
+
const existingWebhooks = await listWebhookSubscriptions(client);
|
|
1280
|
+
const thisWebhookUrl = context.webhookUrls[context.flow.name];
|
|
1281
|
+
const filteredWebhook = existingWebhooks.find((webhook) => webhook.url === thisWebhookUrl);
|
|
1282
|
+
let verificationToken;
|
|
1283
|
+
if (typeof payload.body.data === "object" && payload.body.data !== null) {
|
|
1284
|
+
const data = payload.body.data;
|
|
1285
|
+
if (typeof data.verification_token === "string") verificationToken = data.verification_token;
|
|
1286
|
+
}
|
|
1287
|
+
if (verificationToken && filteredWebhook) {
|
|
1288
|
+
await verifyWebhookSubscription(client, filteredWebhook.uuid, verificationToken);
|
|
1289
|
+
return Promise.resolve({
|
|
1290
|
+
payload,
|
|
1291
|
+
response: {
|
|
1292
|
+
statusCode: 200,
|
|
1293
|
+
headers: {
|
|
1294
|
+
...headers,
|
|
1295
|
+
accept: "application/json"
|
|
1296
|
+
},
|
|
1297
|
+
body: JSON.stringify({ verification_token: verificationToken }),
|
|
1298
|
+
contentType: "application/json"
|
|
1299
|
+
},
|
|
1300
|
+
branch: "URL Validation"
|
|
1301
|
+
});
|
|
1302
|
+
}
|
|
1303
|
+
return Promise.resolve({
|
|
1304
|
+
payload,
|
|
1305
|
+
response: {
|
|
1306
|
+
statusCode: 200,
|
|
1307
|
+
contentType: "text/plain"
|
|
1308
|
+
},
|
|
1309
|
+
branch: "Notification"
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1312
|
+
}) };
|
|
1313
|
+
//#endregion
|
|
1314
|
+
//#region src/index.ts
|
|
1315
|
+
var src_default = (0, _prismatic_io_spectral.component)({
|
|
1316
|
+
key: "gusto",
|
|
1317
|
+
public: true,
|
|
1318
|
+
documentationUrl: "https://prismatic.io/docs/components/gusto/",
|
|
1319
|
+
display: {
|
|
1320
|
+
category: "Application Connectors",
|
|
1321
|
+
label: "Gusto",
|
|
1322
|
+
description: "Manage payroll, benefits, and human resource within Gusto",
|
|
1323
|
+
iconPath: "icon.png"
|
|
1324
|
+
},
|
|
1325
|
+
actions: actions_default,
|
|
1326
|
+
connections: connections_default,
|
|
1327
|
+
dataSources: dataSources_default,
|
|
1328
|
+
triggers: triggers_default,
|
|
1329
|
+
hooks: { error: _prismatic_io_spectral_http.handleErrors }
|
|
1330
|
+
});
|
|
1331
|
+
//#endregion
|
|
1332
|
+
//#region npm-dist/.entry.ts
|
|
1333
|
+
var _entry_default = (0, _prismatic_io_spectral.callableComponent)(src_default);
|
|
1334
|
+
//#endregion
|
|
1335
|
+
module.exports = _entry_default;
|