@uidu/client 3.17.0 → 3.19.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.
Files changed (69) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/dist/declarations/src/calls.d.ts +9 -1
  3. package/dist/declarations/src/candidates.d.ts +102 -0
  4. package/dist/declarations/src/contacts.d.ts +22 -1
  5. package/dist/declarations/src/contracts.d.ts +8 -0
  6. package/dist/declarations/src/expenses.d.ts +169 -0
  7. package/dist/declarations/src/field-values.d.ts +34 -0
  8. package/dist/declarations/src/generated/index.d.ts +13283 -4414
  9. package/dist/declarations/src/index.d.ts +24 -8
  10. package/dist/declarations/src/meetings.d.ts +41 -0
  11. package/dist/declarations/src/mutations.d.ts +168 -131
  12. package/dist/declarations/src/people.d.ts +13 -1
  13. package/dist/declarations/src/reviews.d.ts +195 -0
  14. package/dist/declarations/src/skills.d.ts +34 -0
  15. package/dist/declarations/src/work-sites.d.ts +9 -0
  16. package/dist/uidu-client.cjs.dev.js +570 -31
  17. package/dist/uidu-client.cjs.prod.js +570 -31
  18. package/dist/uidu-client.esm.js +523 -32
  19. package/package.json +1 -1
  20. package/src/calls.ts +37 -0
  21. package/src/candidates.ts +105 -0
  22. package/src/contacts.ts +33 -0
  23. package/src/contracts.ts +44 -0
  24. package/src/expenses.test.ts +155 -0
  25. package/src/expenses.ts +155 -0
  26. package/src/field-values.ts +95 -0
  27. package/src/generated/index.ts +3461 -2268
  28. package/src/index.ts +83 -4
  29. package/src/meetings.ts +37 -0
  30. package/src/mutations.test.ts +40 -1
  31. package/src/mutations.ts +170 -60
  32. package/src/people.ts +33 -0
  33. package/src/queries/calls/ListCallStatuses.graphql +26 -0
  34. package/src/queries/candidates/CandidateFields.graphql +28 -0
  35. package/src/queries/candidates/CandidateMutations.graphql +35 -0
  36. package/src/queries/candidates/CandidateQueries.graphql +94 -0
  37. package/src/queries/contacts/ContactMutations.graphql +0 -13
  38. package/src/queries/contacts/GetOrganization.graphql +17 -0
  39. package/src/queries/contacts/ListOrganizations.graphql +21 -0
  40. package/src/queries/contacts/OrganizationMutations.graphql +17 -0
  41. package/src/queries/contracts/ContractQueries.graphql +67 -0
  42. package/src/queries/courses/CourseMutations.graphql +0 -13
  43. package/src/queries/discardable/DiscardableMutations.graphql +32 -0
  44. package/src/queries/expenses/ExpenseFields.graphql +29 -0
  45. package/src/queries/expenses/ExpenseMutations.graphql +81 -0
  46. package/src/queries/expenses/GetExpenseReport.graphql +14 -0
  47. package/src/queries/expenses/ListAnalyticAccounts.graphql +20 -0
  48. package/src/queries/expenses/ListExpenseReports.graphql +22 -0
  49. package/src/queries/field-values/FieldValueFields.graphql +18 -0
  50. package/src/queries/field-values/FieldValueQueries.graphql +43 -0
  51. package/src/queries/forms/FormMutations.graphql +0 -13
  52. package/src/queries/help-center/ChannelMutations.graphql +0 -13
  53. package/src/queries/kb/KbMutations.graphql +0 -26
  54. package/src/queries/meetings/MeetingQueries.graphql +48 -0
  55. package/src/queries/notes/NoteMutations.graphql +0 -13
  56. package/src/queries/people/EmploymentVariationKindMutations.graphql +51 -0
  57. package/src/queries/people/ListEmploymentVariationKinds.graphql +23 -0
  58. package/src/queries/people/PeopleMutations.graphql +0 -13
  59. package/src/queries/reviews/ReviewFields.graphql +35 -0
  60. package/src/queries/reviews/ReviewMutations.graphql +32 -0
  61. package/src/queries/reviews/ReviewQueries.graphql +86 -0
  62. package/src/queries/skills/SkillQueries.graphql +53 -0
  63. package/src/queries/spaces/SpaceMutations.graphql +0 -13
  64. package/src/queries/tasks/TaskMutations.graphql +0 -13
  65. package/src/queries/work-sites/ListWorkSites.graphql +32 -0
  66. package/src/recruiting.test.ts +196 -0
  67. package/src/reviews.ts +114 -0
  68. package/src/skills.ts +47 -0
  69. package/src/work-sites.ts +28 -0
package/src/index.ts CHANGED
@@ -11,11 +11,20 @@ export {
11
11
  } from './utils/fieldValues';
12
12
 
13
13
  export {
14
+ ListAnalyticAccountsDocument,
14
15
  ListApplicationsDocument,
15
16
  ListBookingsDocument,
16
17
  ListCalendarsDocument,
17
18
  ListCalendarEventsDocument,
18
19
  ListCallsDocument,
20
+ ListCallStatusesDocument,
21
+ ListContractsDocument,
22
+ ListFieldValueHistoryDocument,
23
+ ListMeetingsDocument,
24
+ ListPoolsDocument,
25
+ ListReviewTemplatesDocument,
26
+ ListSkillsDocument,
27
+ ListWorkSitesDocument,
19
28
  ListCampaignsDocument,
20
29
  ListEmailCampaignsDocument,
21
30
  ListCoursesDocument,
@@ -23,13 +32,16 @@ export {
23
32
  ListDonationCampaignsDocument,
24
33
  ListDonationsDocument,
25
34
  ListEmployeesDocument,
35
+ ListEmploymentVariationKindsDocument,
26
36
  ListEnrollmentsDocument,
27
37
  ListEventsDocument,
38
+ ListExpenseReportsDocument,
28
39
  ListFormsDocument,
29
40
  ListGoalsDocument,
30
41
  ListKbArticlesDocument,
31
42
  ListKbCollectionsDocument,
32
43
  ListLecturesDocument,
44
+ ListOrganizationsDocument,
33
45
  ListPagesDocument,
34
46
  ListStoriesDocument,
35
47
  ListTimeframesDocument,
@@ -85,6 +97,7 @@ export {
85
97
  deleteContact,
86
98
  createDeal,
87
99
  updateDeal,
100
+ createOrganization,
88
101
  createKbCollection,
89
102
  updateKbCollection,
90
103
  deleteKbCollection,
@@ -115,6 +128,8 @@ export {
115
128
  terminateEmployment,
116
129
  createEmploymentTerm,
117
130
  updateEmploymentTerm,
131
+ createEmploymentVariationKind,
132
+ updateEmploymentVariationKind,
118
133
  createCompensation,
119
134
  updateCompensation,
120
135
  deleteCompensation,
@@ -146,8 +161,8 @@ export {
146
161
  } from './events';
147
162
  export type { Event } from './events';
148
163
 
149
- export { getCall, listCalls } from './calls';
150
- export type { Call } from './calls';
164
+ export { getCall, listCalls, listCallStatuses } from './calls';
165
+ export type { Call, CallStatus } from './calls';
151
166
 
152
167
  export { getJob, listJobs } from './jobs';
153
168
  export type { Job } from './jobs';
@@ -160,6 +175,49 @@ export {
160
175
  } from './applications';
161
176
  export type { Application } from './applications';
162
177
 
178
+ export {
179
+ findCandidates,
180
+ getCandidate,
181
+ updateCandidate,
182
+ listPools,
183
+ createPoolContact,
184
+ } from './candidates';
185
+ export type {
186
+ Candidate,
187
+ CandidateDetail,
188
+ CandidateSearch,
189
+ Pool,
190
+ } from './candidates';
191
+
192
+ export {
193
+ listReviews,
194
+ getReview,
195
+ createReview,
196
+ createReviews,
197
+ updateReview,
198
+ listReviewTemplates,
199
+ } from './reviews';
200
+ export type { Review, ReviewTemplate } from './reviews';
201
+
202
+ export { listMeetings, createMeeting } from './meetings';
203
+ export type { Meeting } from './meetings';
204
+
205
+ export { listSkills, createSkill } from './skills';
206
+ export type { WorkspaceSkill } from './skills';
207
+
208
+ export { listWorkSites } from './work-sites';
209
+ export type { WorkSite } from './work-sites';
210
+
211
+ export { listContracts, getContract } from './contracts';
212
+ export type { Contract, ContractDetail } from './contracts';
213
+
214
+ export {
215
+ getRecordFieldValues,
216
+ listFieldValueHistory,
217
+ fieldValueAsOf,
218
+ } from './field-values';
219
+ export type { RecordFieldValue, RecordFieldValues } from './field-values';
220
+
163
221
  export {
164
222
  getDonationCampaign,
165
223
  listDonationCampaigns,
@@ -184,6 +242,7 @@ export {
184
242
  createCcnl,
185
243
  listEmploymentHistory,
186
244
  contractEvents,
245
+ listEmploymentVariationKinds,
187
246
  } from './people';
188
247
  export type {
189
248
  Employee,
@@ -195,6 +254,7 @@ export type {
195
254
  EmployeeContracts,
196
255
  ContractEvent,
197
256
  ContractEventType,
257
+ EmploymentVariationKind,
198
258
  } from './people';
199
259
 
200
260
  export {
@@ -222,8 +282,15 @@ export type { Course, Enrollment, Lecture } from './courses';
222
282
  export { getCampaign, listCampaigns, listEmailCampaigns } from './campaigns';
223
283
  export type { Campaign } from './campaigns';
224
284
 
225
- export { getContact, listContacts, getDeal, listDeals } from './contacts';
226
- export type { Contact, Deal } from './contacts';
285
+ export {
286
+ getContact,
287
+ listContacts,
288
+ getDeal,
289
+ listDeals,
290
+ getOrganization,
291
+ listOrganizations,
292
+ } from './contacts';
293
+ export type { Contact, Deal, Organization } from './contacts';
227
294
  export {
228
295
  listGoals,
229
296
  getGoal,
@@ -237,6 +304,18 @@ export {
237
304
  } from './goals';
238
305
  export type { Goal, Timeframe } from './goals';
239
306
 
307
+ export {
308
+ listExpenseReports,
309
+ getExpenseReport,
310
+ createExpenseReport,
311
+ updateExpenseReport,
312
+ createExpense,
313
+ updateExpense,
314
+ listAnalyticAccounts,
315
+ allocateExpense,
316
+ } from './expenses';
317
+ export type { ExpenseReport, Expense, AnalyticAccount } from './expenses';
318
+
240
319
  export {
241
320
  getKbArticle,
242
321
  listKbArticles,
@@ -0,0 +1,37 @@
1
+ import type { UiduClient } from './client';
2
+ import {
3
+ CreateMeetingDocument,
4
+ type CreateMeetingMutationVariables,
5
+ ListMeetingsDocument,
6
+ type ListMeetingsQueryVariables,
7
+ type MeetingSummaryFragment,
8
+ } from './generated';
9
+ import { nodes } from './utils/relay';
10
+
11
+ // Meetings: a scheduled or recorded conversation (an interview, a 1:1),
12
+ // optionally tied to records through `relatedAttributes`.
13
+ // Reads and writes need an account (Bearer / apiKey), server-side.
14
+
15
+ export type Meeting = MeetingSummaryFragment;
16
+
17
+ /** The workspace's meetings, filtered and sorted with `params`; page with `first`/`after`. */
18
+ export async function listMeetings(
19
+ client: UiduClient,
20
+ variables: ListMeetingsQueryVariables = {},
21
+ ): Promise<Meeting[]> {
22
+ const result = await client.query(ListMeetingsDocument, variables);
23
+ return nodes(result.currentWorkspace?.meetings);
24
+ }
25
+
26
+ /**
27
+ * Create a meeting (`name`, `startsAt`, `endsAt`, `timeZone`, and
28
+ * `relatedAttributes` to link it to an application or a contact). Returns the
29
+ * mutation payload as-is (including any `errors`).
30
+ */
31
+ export async function createMeeting(
32
+ client: UiduClient,
33
+ variables: CreateMeetingMutationVariables,
34
+ ) {
35
+ const result = await client.mutate(CreateMeetingDocument, variables);
36
+ return result.createMeeting ?? null;
37
+ }
@@ -1,6 +1,7 @@
1
1
  import { describe, expect, it, vi } from 'vitest';
2
2
  import type { UiduClient } from './client';
3
- import { terminateEmployment } from './mutations';
3
+ import { DeleteRecordDocument, DiscardRecordDocument } from './generated';
4
+ import { deleteContact, deleteKbArticle, terminateEmployment } from './mutations';
4
5
 
5
6
  describe('terminateEmployment', () => {
6
7
  it('closes an employment via updateEmployment with endDate + endReason', async () => {
@@ -41,3 +42,41 @@ describe('terminateEmployment', () => {
41
42
  });
42
43
  });
43
44
  });
45
+
46
+ describe('delete* on discardable records', () => {
47
+ it('moves the record to the trash and keeps the per-entity payload shape', async () => {
48
+ const mutate = vi.fn().mockResolvedValue({
49
+ discardableDiscard: { discardable: { __typename: 'Contact', id: 'c1' }, errors: [] },
50
+ });
51
+ const client = { mutate } as unknown as UiduClient;
52
+
53
+ const result = await deleteContact(client, { input: { id: 'c1' } });
54
+
55
+ expect(mutate).toHaveBeenCalledWith(DiscardRecordDocument, { input: { id: 'c1' } });
56
+ expect(result).toEqual({ contact: { id: 'c1' }, errors: [] });
57
+ });
58
+
59
+ it('deletes for good with permanent: true', async () => {
60
+ const mutate = vi.fn().mockResolvedValue({
61
+ discardableDelete: { discardable: { __typename: 'KbArticle', id: 'k1' }, errors: [] },
62
+ });
63
+ const client = { mutate } as unknown as UiduClient;
64
+
65
+ const result = await deleteKbArticle(client, { input: { id: 'k1' }, permanent: true });
66
+
67
+ expect(mutate).toHaveBeenCalledWith(DeleteRecordDocument, { input: { id: 'k1' } });
68
+ expect(result).toEqual({ kbArticle: { id: 'k1' }, errors: [] });
69
+ });
70
+
71
+ it('passes errors through with a null record, and null when there is no payload', async () => {
72
+ const errors = [{ key: 'base', name: "You don't have permission to do this", type: 'invalid' }];
73
+ const denied = { mutate: vi.fn().mockResolvedValue({ discardableDiscard: { discardable: null, errors } }) };
74
+ expect(await deleteContact(denied as unknown as UiduClient, { input: { id: 'c1' } })).toEqual({
75
+ contact: null,
76
+ errors,
77
+ });
78
+
79
+ const empty = { mutate: vi.fn().mockResolvedValue({}) } as unknown as UiduClient;
80
+ expect(await deleteContact(empty, { input: { id: 'c1' } })).toBeNull();
81
+ });
82
+ });
package/src/mutations.ts CHANGED
@@ -25,38 +25,27 @@ import {
25
25
  type CreateEmploymentMutationVariables,
26
26
  CreateEmploymentTermDocument,
27
27
  type CreateEmploymentTermMutationVariables,
28
+ CreateEmploymentVariationKindDocument,
29
+ type CreateEmploymentVariationKindMutationVariables,
28
30
  CreateFormDocument,
29
31
  type CreateFormMutationVariables,
30
32
  CreateKbArticleDocument,
31
33
  type CreateKbArticleMutationVariables,
32
34
  CreateKbCollectionDocument,
33
35
  type CreateKbCollectionMutationVariables,
36
+ CreateOrganizationDocument,
37
+ type CreateOrganizationMutationVariables,
34
38
  CreateTimeClockDocument,
35
39
  type CreateTimeClockMutationVariables,
36
- DeleteChannelDocument,
37
- type DeleteChannelMutationVariables,
38
- DeleteContactDocument,
39
- type DeleteContactMutationVariables,
40
- DeleteCourseDocument,
41
- type DeleteCourseMutationVariables,
42
40
  DeleteCompensationDocument,
43
41
  type DeleteCompensationMutationVariables,
44
42
  DeleteDonationCampaignDocument,
45
43
  type DeleteDonationCampaignMutationVariables,
46
- DeleteEmploymentDocument,
47
- type DeleteEmploymentMutationVariables,
48
- DeleteFormDocument,
49
- type DeleteFormMutationVariables,
50
- DeleteKbArticleDocument,
51
- type DeleteKbArticleMutationVariables,
52
- DeleteKbCollectionDocument,
53
- type DeleteKbCollectionMutationVariables,
54
- DeleteNoteDocument,
55
- type DeleteNoteMutationVariables,
56
- DeleteSpaceDocument,
57
- type DeleteSpaceMutationVariables,
58
- DeleteTaskDocument,
59
- type DeleteTaskMutationVariables,
44
+ DeleteRecordDocument,
45
+ type DeleteRecordMutation,
46
+ DiscardRecordDocument,
47
+ type DiscardRecordMutation,
48
+ type DiscardRecordMutationVariables,
60
49
  UpdateChannelDocument,
61
50
  type UpdateChannelMutationVariables,
62
51
  UpdateChannelKbCollectionDocument,
@@ -75,6 +64,8 @@ import {
75
64
  type UpdateEmploymentMutationVariables,
76
65
  UpdateEmploymentTermDocument,
77
66
  type UpdateEmploymentTermMutationVariables,
67
+ UpdateEmploymentVariationKindDocument,
68
+ type UpdateEmploymentVariationKindMutationVariables,
78
69
  UpdateEventDocument,
79
70
  type UpdateEventMutationVariables,
80
71
  UpdateFormDocument,
@@ -93,6 +84,30 @@ import {
93
84
  type UpdateTaskMutationVariables,
94
85
  } from './generated';
95
86
 
87
+ // --- Trash ---
88
+ // uidu's records are discardable: `discardableDiscard` moves one to the 30-day
89
+ // trash (restorable), `discardableDelete` destroys it for good. The delete*
90
+ // functions below trash by default and destroy with `permanent: true`, keeping
91
+ // the payload shape of the per-entity mutations they replace:
92
+ // `{ <entity>: { id } | null, errors }`.
93
+
94
+ /** `{ input: { id } }`, plus `permanent: true` to skip the trash. */
95
+ type DeleteRecordVariables = DiscardRecordMutationVariables & { permanent?: boolean };
96
+
97
+ type RemovePayload =
98
+ | DiscardRecordMutation['discardableDiscard']
99
+ | DeleteRecordMutation['discardableDelete'];
100
+
101
+ function removed<K extends string>(key: K, payload: RemovePayload) {
102
+ if (!payload) return null;
103
+ return {
104
+ [key]: payload.discardable ? { id: payload.discardable.id } : null,
105
+ errors: payload.errors,
106
+ } as { [P in K]: { id: string } | null } & {
107
+ errors: NonNullable<RemovePayload>['errors'];
108
+ };
109
+ }
110
+
96
111
  // --- Courses ---
97
112
  /**
98
113
  * Create a course from `{ input: { attributes } }`. Returns the payload (with
@@ -109,11 +124,16 @@ export async function updateCourse(c: UiduClient, v: UpdateCourseMutationVariabl
109
124
  return (await c.mutate(UpdateCourseDocument, v)).updateCourse ?? null;
110
125
  }
111
126
  /**
112
- * Delete a course by `{ input: { id } }`. Returns the payload (with `errors`)
113
- * or null.
127
+ * Move a course to the trash by `{ input: { id } }`, or delete it for good with
128
+ * `permanent: true`. Returns the payload (with `errors`) or null.
114
129
  */
115
- export async function deleteCourse(c: UiduClient, v: DeleteCourseMutationVariables) {
116
- return (await c.mutate(DeleteCourseDocument, v)).deleteCourse ?? null;
130
+ export async function deleteCourse(c: UiduClient, v: DeleteRecordVariables) {
131
+ return removed(
132
+ 'course',
133
+ v.permanent
134
+ ? (await c.mutate(DeleteRecordDocument, { input: v.input })).discardableDelete
135
+ : (await c.mutate(DiscardRecordDocument, { input: v.input })).discardableDiscard,
136
+ );
117
137
  }
118
138
 
119
139
  // --- Forms ---
@@ -132,11 +152,16 @@ export async function updateForm(c: UiduClient, v: UpdateFormMutationVariables)
132
152
  return (await c.mutate(UpdateFormDocument, v)).updateForm ?? null;
133
153
  }
134
154
  /**
135
- * Delete a form by `{ input: { id } }`. Returns the payload (with `errors`) or
136
- * null.
155
+ * Move a form to the trash by `{ input: { id } }`, or delete it for good with
156
+ * `permanent: true`. Returns the payload (with `errors`) or null.
137
157
  */
138
- export async function deleteForm(c: UiduClient, v: DeleteFormMutationVariables) {
139
- return (await c.mutate(DeleteFormDocument, v)).deleteForm ?? null;
158
+ export async function deleteForm(c: UiduClient, v: DeleteRecordVariables) {
159
+ return removed(
160
+ 'form',
161
+ v.permanent
162
+ ? (await c.mutate(DeleteRecordDocument, { input: v.input })).discardableDelete
163
+ : (await c.mutate(DiscardRecordDocument, { input: v.input })).discardableDiscard,
164
+ );
140
165
  }
141
166
 
142
167
  // --- Contacts & Deals ---
@@ -148,11 +173,16 @@ export async function createContact(c: UiduClient, v: CreateContactMutationVaria
148
173
  return (await c.mutate(CreateContactDocument, v)).createContact ?? null;
149
174
  }
150
175
  /**
151
- * Delete a contact by `{ input: { id } }`. Returns the payload (with `errors`)
152
- * or null.
176
+ * Move a contact to the trash by `{ input: { id } }`, or delete it for good
177
+ * with `permanent: true`. Returns the payload (with `errors`) or null.
153
178
  */
154
- export async function deleteContact(c: UiduClient, v: DeleteContactMutationVariables) {
155
- return (await c.mutate(DeleteContactDocument, v)).deleteContact ?? null;
179
+ export async function deleteContact(c: UiduClient, v: DeleteRecordVariables) {
180
+ return removed(
181
+ 'contact',
182
+ v.permanent
183
+ ? (await c.mutate(DeleteRecordDocument, { input: v.input })).discardableDelete
184
+ : (await c.mutate(DiscardRecordDocument, { input: v.input })).discardableDiscard,
185
+ );
156
186
  }
157
187
  /**
158
188
  * Create a deal in a pipeline (`attributes.pipelineId`, `statusId`). Returns
@@ -168,6 +198,19 @@ export async function createDeal(c: UiduClient, v: CreateDealMutationVariables)
168
198
  export async function updateDeal(c: UiduClient, v: UpdateDealMutationVariables) {
169
199
  return (await c.mutate(UpdateDealDocument, v)).updateDeal ?? null;
170
200
  }
201
+ /**
202
+ * Create an organization (company): `{ input: { attributes: { email,
203
+ * organizationAttributes: { name, … } } } }` — the CRM nests an organization's
204
+ * own fields under `attributes.organizationAttributes`, same as a person
205
+ * contact nests theirs under `attributes.userAttributes`. Returns the payload
206
+ * (with `errors`) or null.
207
+ */
208
+ export async function createOrganization(
209
+ c: UiduClient,
210
+ v: CreateOrganizationMutationVariables,
211
+ ) {
212
+ return (await c.mutate(CreateOrganizationDocument, v)).createOrganization ?? null;
213
+ }
171
214
 
172
215
  // --- People / HR (employees & employments) ---
173
216
  // An Employee is the HR record wrapping a workspace User (`userId`); an
@@ -219,11 +262,17 @@ export async function updateEmployment(c: UiduClient, v: UpdateEmploymentMutatio
219
262
  return (await c.mutate(UpdateEmploymentDocument, v)).updateEmployment ?? null;
220
263
  }
221
264
  /**
222
- * Delete an employment by `{ input: { id } }` (to end a contract, use
223
- * `terminateEmployment` instead). Returns the payload (with `errors`) or null.
265
+ * Move an employment to the trash by `{ input: { id } }` (to end a contract,
266
+ * use `terminateEmployment` instead), or delete it for good with
267
+ * `permanent: true`. Returns the payload (with `errors`) or null.
224
268
  */
225
- export async function deleteEmployment(c: UiduClient, v: DeleteEmploymentMutationVariables) {
226
- return (await c.mutate(DeleteEmploymentDocument, v)).deleteEmployment ?? null;
269
+ export async function deleteEmployment(c: UiduClient, v: DeleteRecordVariables) {
270
+ return removed(
271
+ 'employment',
272
+ v.permanent
273
+ ? (await c.mutate(DeleteRecordDocument, { input: v.input })).discardableDelete
274
+ : (await c.mutate(DiscardRecordDocument, { input: v.input })).discardableDiscard,
275
+ );
227
276
  }
228
277
 
229
278
  /**
@@ -269,6 +318,35 @@ export async function updateEmploymentTerm(
269
318
  return (await c.mutate(UpdateEmploymentTermDocument, v)).updateEmploymentTerm ?? null;
270
319
  }
271
320
 
321
+ /**
322
+ * Create an employment variation kind — a reusable reason for a contract
323
+ * change (`changesHours`, `changesPay`, `changesLevel`, …), picked by a
324
+ * contract variation's `employmentVariationKindId`. Returns the payload (with
325
+ * `errors`) or null. The new kind is at `employmentVariationKind.node`.
326
+ */
327
+ export async function createEmploymentVariationKind(
328
+ c: UiduClient,
329
+ v: CreateEmploymentVariationKindMutationVariables,
330
+ ) {
331
+ return (
332
+ (await c.mutate(CreateEmploymentVariationKindDocument, v)).createEmploymentVariationKind ??
333
+ null
334
+ );
335
+ }
336
+ /**
337
+ * Update an employment variation kind: `{ input: { id, attributes } }`.
338
+ * Returns the payload (with `errors`) or null.
339
+ */
340
+ export async function updateEmploymentVariationKind(
341
+ c: UiduClient,
342
+ v: UpdateEmploymentVariationKindMutationVariables,
343
+ ) {
344
+ return (
345
+ (await c.mutate(UpdateEmploymentVariationKindDocument, v)).updateEmploymentVariationKind ??
346
+ null
347
+ );
348
+ }
349
+
272
350
  // --- Time clocks (punches) ---
273
351
  /**
274
352
  * Record a time-clock punch (`beginsAt`, optional `finishesAt`, `resourceId`).
@@ -319,11 +397,17 @@ export async function updateKbCollection(c: UiduClient, v: UpdateKbCollectionMut
319
397
  return (await c.mutate(UpdateKbCollectionDocument, v)).updateKbCollection ?? null;
320
398
  }
321
399
  /**
322
- * Delete a knowledge-base collection by `{ input: { id } }`. Returns the
323
- * payload (with `errors`) or null.
400
+ * Move a knowledge-base collection to the trash by `{ input: { id } }`, or
401
+ * delete it for good with `permanent: true`. Returns the payload (with
402
+ * `errors`) or null.
324
403
  */
325
- export async function deleteKbCollection(c: UiduClient, v: DeleteKbCollectionMutationVariables) {
326
- return (await c.mutate(DeleteKbCollectionDocument, v)).deleteKbCollection ?? null;
404
+ export async function deleteKbCollection(c: UiduClient, v: DeleteRecordVariables) {
405
+ return removed(
406
+ 'kbCollection',
407
+ v.permanent
408
+ ? (await c.mutate(DeleteRecordDocument, { input: v.input })).discardableDelete
409
+ : (await c.mutate(DiscardRecordDocument, { input: v.input })).discardableDiscard,
410
+ );
327
411
  }
328
412
  /**
329
413
  * Create a knowledge-base article in `attributes.kbCollectionId`. Returns the
@@ -340,11 +424,17 @@ export async function updateKbArticle(c: UiduClient, v: UpdateKbArticleMutationV
340
424
  return (await c.mutate(UpdateKbArticleDocument, v)).updateKbArticle ?? null;
341
425
  }
342
426
  /**
343
- * Delete a knowledge-base article by `{ input: { id } }`. Returns the payload
344
- * (with `errors`) or null.
427
+ * Move a knowledge-base article to the trash by `{ input: { id } }`, or delete
428
+ * it for good with `permanent: true`. Returns the payload (with `errors`) or
429
+ * null.
345
430
  */
346
- export async function deleteKbArticle(c: UiduClient, v: DeleteKbArticleMutationVariables) {
347
- return (await c.mutate(DeleteKbArticleDocument, v)).deleteKbArticle ?? null;
431
+ export async function deleteKbArticle(c: UiduClient, v: DeleteRecordVariables) {
432
+ return removed(
433
+ 'kbArticle',
434
+ v.permanent
435
+ ? (await c.mutate(DeleteRecordDocument, { input: v.input })).discardableDelete
436
+ : (await c.mutate(DiscardRecordDocument, { input: v.input })).discardableDiscard,
437
+ );
348
438
  }
349
439
 
350
440
  // --- Help center channels ---
@@ -363,11 +453,16 @@ export async function updateChannel(c: UiduClient, v: UpdateChannelMutationVaria
363
453
  return (await c.mutate(UpdateChannelDocument, v)).updateChannel ?? null;
364
454
  }
365
455
  /**
366
- * Delete a help-center channel by `{ input: { id } }`. Returns the payload
367
- * (with `errors`) or null.
456
+ * Move a help-center channel to the trash by `{ input: { id } }`, or delete it
457
+ * for good with `permanent: true`. Returns the payload (with `errors`) or null.
368
458
  */
369
- export async function deleteChannel(c: UiduClient, v: DeleteChannelMutationVariables) {
370
- return (await c.mutate(DeleteChannelDocument, v)).deleteChannel ?? null;
459
+ export async function deleteChannel(c: UiduClient, v: DeleteRecordVariables) {
460
+ return removed(
461
+ 'channel',
462
+ v.permanent
463
+ ? (await c.mutate(DeleteRecordDocument, { input: v.input })).discardableDelete
464
+ : (await c.mutate(DiscardRecordDocument, { input: v.input })).discardableDiscard,
465
+ );
371
466
  }
372
467
 
373
468
  // --- Channel ↔ knowledge-base collection links ---
@@ -434,11 +529,16 @@ export async function updateTask(c: UiduClient, v: UpdateTaskMutationVariables)
434
529
  return (await c.mutate(UpdateTaskDocument, v)).updateTask ?? null;
435
530
  }
436
531
  /**
437
- * Delete a task by `{ input: { id } }`. Returns the payload (with `errors`) or
438
- * null.
532
+ * Move a task to the trash by `{ input: { id } }`, or delete it for good with
533
+ * `permanent: true`. Returns the payload (with `errors`) or null.
439
534
  */
440
- export async function deleteTask(c: UiduClient, v: DeleteTaskMutationVariables) {
441
- return (await c.mutate(DeleteTaskDocument, v)).deleteTask ?? null;
535
+ export async function deleteTask(c: UiduClient, v: DeleteRecordVariables) {
536
+ return removed(
537
+ 'task',
538
+ v.permanent
539
+ ? (await c.mutate(DeleteRecordDocument, { input: v.input })).discardableDelete
540
+ : (await c.mutate(DiscardRecordDocument, { input: v.input })).discardableDiscard,
541
+ );
442
542
  }
443
543
  /**
444
544
  * Update a note: `{ input: { id, attributes } }`. Returns the payload (with
@@ -448,11 +548,16 @@ export async function updateNote(c: UiduClient, v: UpdateNoteMutationVariables)
448
548
  return (await c.mutate(UpdateNoteDocument, v)).updateNote ?? null;
449
549
  }
450
550
  /**
451
- * Delete a note by `{ input: { id } }`. Returns the payload (with `errors`) or
452
- * null.
551
+ * Move a note to the trash by `{ input: { id } }`, or delete it for good with
552
+ * `permanent: true`. Returns the payload (with `errors`) or null.
453
553
  */
454
- export async function deleteNote(c: UiduClient, v: DeleteNoteMutationVariables) {
455
- return (await c.mutate(DeleteNoteDocument, v)).deleteNote ?? null;
554
+ export async function deleteNote(c: UiduClient, v: DeleteRecordVariables) {
555
+ return removed(
556
+ 'note',
557
+ v.permanent
558
+ ? (await c.mutate(DeleteRecordDocument, { input: v.input })).discardableDelete
559
+ : (await c.mutate(DiscardRecordDocument, { input: v.input })).discardableDiscard,
560
+ );
456
561
  }
457
562
  /**
458
563
  * Update a space: `{ input: { id, attributes } }`. Returns the payload (with
@@ -462,9 +567,14 @@ export async function updateSpace(c: UiduClient, v: UpdateSpaceMutationVariables
462
567
  return (await c.mutate(UpdateSpaceDocument, v)).updateSpace ?? null;
463
568
  }
464
569
  /**
465
- * Delete a space by `{ input: { id } }`. Returns the payload (with `errors`)
466
- * or null.
570
+ * Move a space to the trash by `{ input: { id } }`, or delete it for good with
571
+ * `permanent: true`. Returns the payload (with `errors`) or null.
467
572
  */
468
- export async function deleteSpace(c: UiduClient, v: DeleteSpaceMutationVariables) {
469
- return (await c.mutate(DeleteSpaceDocument, v)).deleteSpace ?? null;
573
+ export async function deleteSpace(c: UiduClient, v: DeleteRecordVariables) {
574
+ return removed(
575
+ 'space',
576
+ v.permanent
577
+ ? (await c.mutate(DeleteRecordDocument, { input: v.input })).discardableDelete
578
+ : (await c.mutate(DiscardRecordDocument, { input: v.input })).discardableDiscard,
579
+ );
470
580
  }
package/src/people.ts CHANGED
@@ -12,6 +12,9 @@ import {
12
12
  type ListEmployeesQueryVariables,
13
13
  ListEmploymentHistoryDocument,
14
14
  type ListEmploymentHistoryQueryVariables,
15
+ ListEmploymentVariationKindsDocument,
16
+ type ListEmploymentVariationKindsQuery,
17
+ type ListEmploymentVariationKindsQueryVariables,
15
18
  ListKindsDocument,
16
19
  type ListKindsQuery,
17
20
  type ListKindsQueryVariables,
@@ -44,6 +47,23 @@ export type Office = NonNullable<
44
47
  >[number]
45
48
  >['node']
46
49
  >;
50
+ /**
51
+ * A contract-variation reason (hours change, conversion to open-ended, a pay
52
+ * rise…) configured for the workspace — an employment's `varyAttributes` picks
53
+ * one by `employmentVariationKindId`.
54
+ */
55
+ export type EmploymentVariationKind = NonNullable<
56
+ NonNullable<
57
+ NonNullable<
58
+ NonNullable<
59
+ NonNullable<
60
+ ListEmploymentVariationKindsQuery['currentWorkspace']
61
+ >['employmentVariationKinds']
62
+ >['edges']
63
+ >[number]
64
+ >['node']
65
+ >;
66
+
47
67
  /** A `Kind` record — CCNLs (national collective labor contracts) are Kinds. */
48
68
  export type Kind = NonNullable<
49
69
  NonNullable<
@@ -127,6 +147,19 @@ export async function listRoles(
127
147
  return circles.filter((c) => c.kind === 'role');
128
148
  }
129
149
 
150
+ /**
151
+ * List the workspace's employment variation kinds — the reasons a contract
152
+ * can change (hours, pay, level, place, benefits…), each flagging which
153
+ * aspects it touches. Used for a contract variation's `employmentVariationKindId`.
154
+ */
155
+ export async function listEmploymentVariationKinds(
156
+ client: UiduClient,
157
+ variables: ListEmploymentVariationKindsQueryVariables = {},
158
+ ): Promise<EmploymentVariationKind[]> {
159
+ const result = await client.query(ListEmploymentVariationKindsDocument, variables);
160
+ return nodes(result.currentWorkspace?.employmentVariationKinds);
161
+ }
162
+
130
163
  /** List `Kind` records for the given polymorphic models. */
131
164
  export async function listKinds(
132
165
  client: UiduClient,
@@ -0,0 +1,26 @@
1
+ # The pipeline of a call: the statuses its applications move through
2
+ # (`Application.status`), in `position` order.
3
+ query ListCallStatuses($callId: ID!, $first: Int, $after: String) {
4
+ currentWorkspace {
5
+ call(id: $callId) {
6
+ id
7
+ statuses(first: $first, after: $after) {
8
+ pageInfo {
9
+ hasNextPage
10
+ endCursor
11
+ }
12
+ edges {
13
+ node {
14
+ id
15
+ name
16
+ color
17
+ description
18
+ kind
19
+ state
20
+ position
21
+ }
22
+ }
23
+ }
24
+ }
25
+ }
26
+ }