@uidu/client 3.13.0 → 3.13.1

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 (60) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/declarations/src/actions.d.ts +10 -0
  3. package/dist/declarations/src/benefit-enrollments.d.ts +5 -0
  4. package/dist/declarations/src/benefits.d.ts +5 -0
  5. package/dist/declarations/src/bookings.d.ts +22 -0
  6. package/dist/declarations/src/calls.d.ts +8 -0
  7. package/dist/declarations/src/campaigns.d.ts +12 -0
  8. package/dist/declarations/src/client.d.ts +13 -1
  9. package/dist/declarations/src/cms.d.ts +32 -0
  10. package/dist/declarations/src/contacts.d.ts +16 -0
  11. package/dist/declarations/src/courses.d.ts +23 -0
  12. package/dist/declarations/src/donations.d.ts +19 -0
  13. package/dist/declarations/src/events.d.ts +19 -0
  14. package/dist/declarations/src/forms.d.ts +19 -0
  15. package/dist/declarations/src/generated/index.d.ts +10 -10
  16. package/dist/declarations/src/goals.d.ts +4 -0
  17. package/dist/declarations/src/help-center.d.ts +4 -0
  18. package/dist/declarations/src/kb.d.ts +15 -0
  19. package/dist/declarations/src/models.d.ts +54 -0
  20. package/dist/declarations/src/mutations.d.ts +155 -0
  21. package/dist/declarations/src/notes.d.ts +4 -0
  22. package/dist/declarations/src/people.d.ts +8 -0
  23. package/dist/declarations/src/search.d.ts +7 -0
  24. package/dist/declarations/src/spaces.d.ts +4 -0
  25. package/dist/declarations/src/stories.d.ts +11 -0
  26. package/dist/declarations/src/system.d.ts +4 -0
  27. package/dist/declarations/src/tasks.d.ts +4 -0
  28. package/dist/declarations/src/types.d.ts +4 -0
  29. package/dist/uidu-client.cjs.dev.js +532 -8
  30. package/dist/uidu-client.cjs.prod.js +532 -8
  31. package/dist/uidu-client.esm.js +532 -8
  32. package/package.json +1 -1
  33. package/src/actions.ts +10 -6
  34. package/src/benefit-enrollments.ts +5 -0
  35. package/src/benefits.ts +5 -0
  36. package/src/bookings.ts +22 -0
  37. package/src/calls.ts +8 -0
  38. package/src/campaigns.ts +12 -0
  39. package/src/client.ts +13 -1
  40. package/src/cms.ts +32 -0
  41. package/src/contacts.ts +16 -0
  42. package/src/courses.ts +23 -0
  43. package/src/donations.ts +19 -0
  44. package/src/events.ts +19 -0
  45. package/src/forms.ts +19 -0
  46. package/src/generated/index.ts +2 -2
  47. package/src/goals.ts +4 -0
  48. package/src/help-center.ts +4 -0
  49. package/src/kb.ts +15 -0
  50. package/src/models.ts +54 -0
  51. package/src/mutations.ts +155 -0
  52. package/src/notes.ts +4 -0
  53. package/src/people.ts +8 -0
  54. package/src/queries/cms/GetPage.graphql +1 -0
  55. package/src/search.ts +7 -0
  56. package/src/spaces.ts +4 -0
  57. package/src/stories.ts +11 -0
  58. package/src/system.ts +4 -0
  59. package/src/tasks.ts +4 -0
  60. package/src/types.ts +4 -0
package/src/goals.ts CHANGED
@@ -50,6 +50,10 @@ export async function getGoal(
50
50
  return result.currentWorkspace?.goal ?? null;
51
51
  }
52
52
 
53
+ /**
54
+ * The workspace's timeframes (the periods goals run over, `active` marks the
55
+ * current ones) as a flat array; page with `first`/`after`.
56
+ */
53
57
  export async function listTimeframes(
54
58
  client: UiduClient,
55
59
  variables: ListTimeframesQueryVariables = {},
@@ -12,6 +12,10 @@ export type Channel = NonNullable<
12
12
  NonNullable<GetChannelQuery['currentWorkspace']>['channel']
13
13
  >;
14
14
 
15
+ /**
16
+ * One help center channel with its collections and their articles in a single
17
+ * request (the last 100 of each), or null.
18
+ */
15
19
  export async function getChannel(
16
20
  client: UiduClient,
17
21
  variables: GetChannelQueryVariables,
package/src/kb.ts CHANGED
@@ -20,6 +20,10 @@ export type KbCollection = NonNullable<
20
20
  NonNullable<GetKbCollectionQuery['currentWorkspace']>['kbCollection']
21
21
  >;
22
22
 
23
+ /**
24
+ * One knowledge-base article with its rich-text `body` and its collection, or
25
+ * null.
26
+ */
23
27
  export async function getKbArticle(
24
28
  client: UiduClient,
25
29
  variables: GetKbArticleQueryVariables,
@@ -28,6 +32,10 @@ export async function getKbArticle(
28
32
  return result.currentWorkspace?.kbArticle ?? null;
29
33
  }
30
34
 
35
+ /**
36
+ * Knowledge-base articles across every collection, as a flat array; page with
37
+ * `first`/`after` (or `last`/`before`).
38
+ */
31
39
  export async function listKbArticles(
32
40
  client: UiduClient,
33
41
  variables: ListKbArticlesQueryVariables = {},
@@ -36,6 +44,9 @@ export async function listKbArticles(
36
44
  return nodes(result.currentWorkspace?.kbArticles);
37
45
  }
38
46
 
47
+ /**
48
+ * One knowledge-base collection with its first 50 articles, or null.
49
+ */
39
50
  export async function getKbCollection(
40
51
  client: UiduClient,
41
52
  variables: GetKbCollectionQueryVariables,
@@ -44,6 +55,10 @@ export async function getKbCollection(
44
55
  return result.currentWorkspace?.kbCollection ?? null;
45
56
  }
46
57
 
58
+ /**
59
+ * The workspace's knowledge-base collections as a flat array; page with
60
+ * `first`/`after` (or `last`/`before`).
61
+ */
47
62
  export async function listKbCollections(
48
63
  client: UiduClient,
49
64
  variables: ListKbCollectionsQueryVariables = {},
package/src/models.ts CHANGED
@@ -72,6 +72,9 @@ export async function listModels(
72
72
  return node?.__typename === 'WorkspaceApp' ? (node.modelList ?? []) : [];
73
73
  }
74
74
 
75
+ /**
76
+ * One model with its fields, or null when the id is not a Model.
77
+ */
75
78
  export async function getModel(
76
79
  client: UiduClient,
77
80
  variables: { id: string },
@@ -92,6 +95,10 @@ export async function listModelItems(
92
95
  return node?.__typename === 'Model' ? node.modelItemList : [];
93
96
  }
94
97
 
98
+ /**
99
+ * One model item with its values and its `model.id`, or null when the id is
100
+ * not a ModelItem.
101
+ */
95
102
  export async function getModelItem(
96
103
  client: UiduClient,
97
104
  variables: { id: string },
@@ -102,6 +109,12 @@ export async function getModelItem(
102
109
 
103
110
  // --- writes -----------------------------------------------------------------
104
111
 
112
+ /**
113
+ * Create a model in a WorkspaceApp (`attributes.modelableId`, `name`,
114
+ * `namePlural`). Returns the payload (with `errors`) or null.
115
+ *
116
+ * To find-or-create a model and its fields in one call, use `ensureModel`.
117
+ */
105
118
  export async function createModel(
106
119
  client: UiduClient,
107
120
  variables: CreateModelMutationVariables,
@@ -110,6 +123,10 @@ export async function createModel(
110
123
  return result.createModel ?? null;
111
124
  }
112
125
 
126
+ /**
127
+ * Rename or reconfigure a model: `{ input: { id, attributes } }`. Returns the
128
+ * payload (with `errors`) or null.
129
+ */
113
130
  export async function updateModel(
114
131
  client: UiduClient,
115
132
  variables: UpdateModelMutationVariables,
@@ -130,6 +147,10 @@ export async function createField(
130
147
  return result.createField ?? null;
131
148
  }
132
149
 
150
+ /**
151
+ * Update a field (name, `required`, preferences…): `{ input: { id, attributes
152
+ * } }`. Returns the payload (with `errors`) or null.
153
+ */
133
154
  export async function updateField(
134
155
  client: UiduClient,
135
156
  variables: UpdateFieldMutationVariables,
@@ -138,6 +159,10 @@ export async function updateField(
138
159
  return result.updateField ?? null;
139
160
  }
140
161
 
162
+ /**
163
+ * Delete a field from its model by `{ input: { id } }`. Returns the payload
164
+ * (with `errors`) or null.
165
+ */
141
166
  export async function deleteField(
142
167
  client: UiduClient,
143
168
  variables: DeleteFieldMutationVariables,
@@ -146,6 +171,10 @@ export async function deleteField(
146
171
  return result.deleteField ?? null;
147
172
  }
148
173
 
174
+ /**
175
+ * Add an option to a select-kind field (`attributes.fieldId`, `name`,
176
+ * `color`). Returns the payload (with `errors`) or null.
177
+ */
149
178
  export async function createFieldOption(
150
179
  client: UiduClient,
151
180
  variables: CreateFieldOptionMutationVariables,
@@ -154,6 +183,10 @@ export async function createFieldOption(
154
183
  return result.createFieldOption ?? null;
155
184
  }
156
185
 
186
+ /**
187
+ * Update a select option: `{ input: { id, attributes } }`. Returns the payload
188
+ * (with `errors`) or null.
189
+ */
157
190
  export async function updateFieldOption(
158
191
  client: UiduClient,
159
192
  variables: UpdateFieldOptionMutationVariables,
@@ -162,6 +195,10 @@ export async function updateFieldOption(
162
195
  return result.updateFieldOption ?? null;
163
196
  }
164
197
 
198
+ /**
199
+ * Delete a select option by `{ input: { id } }`. Returns the payload (with
200
+ * `errors`) or null.
201
+ */
165
202
  export async function deleteFieldOption(
166
203
  client: UiduClient,
167
204
  variables: DeleteFieldOptionMutationVariables,
@@ -182,6 +219,11 @@ export async function createModelItem(
182
219
  return result.createModelItem ?? null;
183
220
  }
184
221
 
222
+ /**
223
+ * Update an item: `{ input: { id, attributes: { fieldValuesAttributes } } }`,
224
+ * built with `toFieldValuesAttributes`. Returns the payload (with `errors`) or
225
+ * null.
226
+ */
185
227
  export async function updateModelItem(
186
228
  client: UiduClient,
187
229
  variables: UpdateModelItemMutationVariables,
@@ -190,6 +232,10 @@ export async function updateModelItem(
190
232
  return result.updateModelItem ?? null;
191
233
  }
192
234
 
235
+ /**
236
+ * Delete an item by `{ input: { id } }`. Returns the payload (with `errors`)
237
+ * or null.
238
+ */
193
239
  export async function deleteModelItem(
194
240
  client: UiduClient,
195
241
  variables: DeleteModelItemMutationVariables,
@@ -198,6 +244,10 @@ export async function deleteModelItem(
198
244
  return result.deleteModelItem ?? null;
199
245
  }
200
246
 
247
+ /**
248
+ * Set a single value by its FieldValue id: `{ input: { id, attributes: {
249
+ * content: { value } } } }`. Returns the payload (with `errors`) or null.
250
+ */
201
251
  export async function updateFieldValue(
202
252
  client: UiduClient,
203
253
  variables: UpdateFieldValueMutationVariables,
@@ -206,6 +256,10 @@ export async function updateFieldValue(
206
256
  return result.updateFieldValue ?? null;
207
257
  }
208
258
 
259
+ /**
260
+ * Clear a single value by its FieldValue id; `deleteLinkedRecord: true` also
261
+ * deletes the record it links to. Returns the payload (with `errors`) or null.
262
+ */
209
263
  export async function deleteFieldValue(
210
264
  client: UiduClient,
211
265
  variables: DeleteFieldValueMutationVariables,
package/src/mutations.ts CHANGED
@@ -84,37 +84,77 @@ import {
84
84
  } from './generated';
85
85
 
86
86
  // --- Courses ---
87
+ /**
88
+ * Create a course from `{ input: { attributes } }`. Returns the payload (with
89
+ * `errors`) or null.
90
+ */
87
91
  export async function createCourse(c: UiduClient, v: CreateCourseMutationVariables) {
88
92
  return (await c.mutate(CreateCourseDocument, v)).createCourse ?? null;
89
93
  }
94
+ /**
95
+ * Update a course: `{ input: { id, attributes } }`. Returns the payload (with
96
+ * `errors`) or null.
97
+ */
90
98
  export async function updateCourse(c: UiduClient, v: UpdateCourseMutationVariables) {
91
99
  return (await c.mutate(UpdateCourseDocument, v)).updateCourse ?? null;
92
100
  }
101
+ /**
102
+ * Delete a course by `{ input: { id } }`. Returns the payload (with `errors`)
103
+ * or null.
104
+ */
93
105
  export async function deleteCourse(c: UiduClient, v: DeleteCourseMutationVariables) {
94
106
  return (await c.mutate(DeleteCourseDocument, v)).deleteCourse ?? null;
95
107
  }
96
108
 
97
109
  // --- Forms ---
110
+ /**
111
+ * Create a form, questions included via `attributes.formQuestionsAttributes`.
112
+ * Returns the payload (with `errors`) or null. The new form is at `form.node`.
113
+ */
98
114
  export async function createForm(c: UiduClient, v: CreateFormMutationVariables) {
99
115
  return (await c.mutate(CreateFormDocument, v)).createForm ?? null;
100
116
  }
117
+ /**
118
+ * Update a form: `{ input: { id, attributes } }`. Returns the payload (with
119
+ * `errors`) or null.
120
+ */
101
121
  export async function updateForm(c: UiduClient, v: UpdateFormMutationVariables) {
102
122
  return (await c.mutate(UpdateFormDocument, v)).updateForm ?? null;
103
123
  }
124
+ /**
125
+ * Delete a form by `{ input: { id } }`. Returns the payload (with `errors`) or
126
+ * null.
127
+ */
104
128
  export async function deleteForm(c: UiduClient, v: DeleteFormMutationVariables) {
105
129
  return (await c.mutate(DeleteFormDocument, v)).deleteForm ?? null;
106
130
  }
107
131
 
108
132
  // --- Contacts & Deals ---
133
+ /**
134
+ * Create a CRM contact from `{ input: { attributes } }`. Returns the payload
135
+ * (with `errors`) or null.
136
+ */
109
137
  export async function createContact(c: UiduClient, v: CreateContactMutationVariables) {
110
138
  return (await c.mutate(CreateContactDocument, v)).createContact ?? null;
111
139
  }
140
+ /**
141
+ * Delete a contact by `{ input: { id } }`. Returns the payload (with `errors`)
142
+ * or null.
143
+ */
112
144
  export async function deleteContact(c: UiduClient, v: DeleteContactMutationVariables) {
113
145
  return (await c.mutate(DeleteContactDocument, v)).deleteContact ?? null;
114
146
  }
147
+ /**
148
+ * Create a deal in a pipeline (`attributes.pipelineId`, `statusId`). Returns
149
+ * the payload (with `errors`) or null. The new deal is at `deal.node`.
150
+ */
115
151
  export async function createDeal(c: UiduClient, v: CreateDealMutationVariables) {
116
152
  return (await c.mutate(CreateDealDocument, v)).createDeal ?? null;
117
153
  }
154
+ /**
155
+ * Update a deal, e.g. move it to another `statusId`: `{ input: { id,
156
+ * attributes } }`. Returns the payload (with `errors`) or null.
157
+ */
118
158
  export async function updateDeal(c: UiduClient, v: UpdateDealMutationVariables) {
119
159
  return (await c.mutate(UpdateDealDocument, v)).updateDeal ?? null;
120
160
  }
@@ -125,18 +165,39 @@ export async function updateDeal(c: UiduClient, v: UpdateDealMutationVariables)
125
165
  // offices, FTE…). A hire = createEmployment; a termination = updateEmployment
126
166
  // with an `endDate` + `endReason` (see `terminateEmployment`); a contract
127
167
  // variation = a new createEmployment (or updateEmployment on the current one).
168
+ /**
169
+ * Create the HR record for a workspace user (`attributes.userId`). Returns the
170
+ * payload (with `errors`) or null. The new employee is at `employee.node`.
171
+ */
128
172
  export async function createEmployee(c: UiduClient, v: CreateEmployeeMutationVariables) {
129
173
  return (await c.mutate(CreateEmployeeDocument, v)).createEmployee ?? null;
130
174
  }
175
+ /**
176
+ * Update an employee's HR record (code, kiosk PIN, time-clock flags): `{
177
+ * input: { id, attributes } }`. Returns the payload (with `errors`) or null.
178
+ */
131
179
  export async function updateEmployee(c: UiduClient, v: UpdateEmployeeMutationVariables) {
132
180
  return (await c.mutate(UpdateEmployeeDocument, v)).updateEmployee ?? null;
133
181
  }
182
+ /**
183
+ * Hire: open a new employment (contract) for `attributes.employeeId` with its
184
+ * start date, kind, role and hours. Returns the payload (with `errors`) or
185
+ * null. The new employment is at `employment.node`.
186
+ */
134
187
  export async function createEmployment(c: UiduClient, v: CreateEmploymentMutationVariables) {
135
188
  return (await c.mutate(CreateEmploymentDocument, v)).createEmployment ?? null;
136
189
  }
190
+ /**
191
+ * Update an employment: `{ input: { id, attributes } }`; to end one, prefer
192
+ * `terminateEmployment`. Returns the payload (with `errors`) or null.
193
+ */
137
194
  export async function updateEmployment(c: UiduClient, v: UpdateEmploymentMutationVariables) {
138
195
  return (await c.mutate(UpdateEmploymentDocument, v)).updateEmployment ?? null;
139
196
  }
197
+ /**
198
+ * Delete an employment by `{ input: { id } }` (to end a contract, use
199
+ * `terminateEmployment` instead). Returns the payload (with `errors`) or null.
200
+ */
140
201
  export async function deleteEmployment(c: UiduClient, v: DeleteEmploymentMutationVariables) {
141
202
  return (await c.mutate(DeleteEmploymentDocument, v)).deleteEmployment ?? null;
142
203
  }
@@ -159,82 +220,176 @@ export async function terminateEmployment(
159
220
  }
160
221
 
161
222
  // --- Time clocks (punches) ---
223
+ /**
224
+ * Record a time-clock punch (`beginsAt`, optional `finishesAt`, `resourceId`).
225
+ * Returns the payload (with `errors`) or null. The new punch is at
226
+ * `timeClock.node`.
227
+ */
162
228
  export async function createTimeClock(c: UiduClient, v: CreateTimeClockMutationVariables) {
163
229
  return (await c.mutate(CreateTimeClockDocument, v)).createTimeClock ?? null;
164
230
  }
165
231
 
166
232
  // --- Compensation (pay items on an employment) ---
233
+ /**
234
+ * Add a pay item to an employment (`attributes.employmentId`, `amount`,
235
+ * `currency`, `frequency`, `effectiveFrom`). Returns the payload (with
236
+ * `errors`) or null. The new item is at `compensation.node`.
237
+ */
167
238
  export async function createCompensation(c: UiduClient, v: CreateCompensationMutationVariables) {
168
239
  return (await c.mutate(CreateCompensationDocument, v)).createCompensation ?? null;
169
240
  }
241
+ /**
242
+ * Update a pay item: `{ input: { id, attributes } }`. Returns the payload
243
+ * (with `errors`) or null.
244
+ */
170
245
  export async function updateCompensation(c: UiduClient, v: UpdateCompensationMutationVariables) {
171
246
  return (await c.mutate(UpdateCompensationDocument, v)).updateCompensation ?? null;
172
247
  }
248
+ /**
249
+ * Delete a pay item by `{ input: { id } }`. Returns the payload (with
250
+ * `errors`) or null.
251
+ */
173
252
  export async function deleteCompensation(c: UiduClient, v: DeleteCompensationMutationVariables) {
174
253
  return (await c.mutate(DeleteCompensationDocument, v)).deleteCompensation ?? null;
175
254
  }
176
255
 
177
256
  // --- Knowledge base ---
257
+ /**
258
+ * Create a knowledge-base collection. Returns the payload (with `errors`) or
259
+ * null. The new collection is at `kbCollection.node`.
260
+ */
178
261
  export async function createKbCollection(c: UiduClient, v: CreateKbCollectionMutationVariables) {
179
262
  return (await c.mutate(CreateKbCollectionDocument, v)).createKbCollection ?? null;
180
263
  }
264
+ /**
265
+ * Update a knowledge-base collection: `{ input: { id, attributes } }`. Returns
266
+ * the payload (with `errors`) or null.
267
+ */
181
268
  export async function updateKbCollection(c: UiduClient, v: UpdateKbCollectionMutationVariables) {
182
269
  return (await c.mutate(UpdateKbCollectionDocument, v)).updateKbCollection ?? null;
183
270
  }
271
+ /**
272
+ * Delete a knowledge-base collection by `{ input: { id } }`. Returns the
273
+ * payload (with `errors`) or null.
274
+ */
184
275
  export async function deleteKbCollection(c: UiduClient, v: DeleteKbCollectionMutationVariables) {
185
276
  return (await c.mutate(DeleteKbCollectionDocument, v)).deleteKbCollection ?? null;
186
277
  }
278
+ /**
279
+ * Create a knowledge-base article in `attributes.kbCollectionId`. Returns the
280
+ * payload (with `errors`) or null. The new article is at `kbArticle.node`.
281
+ */
187
282
  export async function createKbArticle(c: UiduClient, v: CreateKbArticleMutationVariables) {
188
283
  return (await c.mutate(CreateKbArticleDocument, v)).createKbArticle ?? null;
189
284
  }
285
+ /**
286
+ * Update a knowledge-base article: `{ input: { id, attributes } }`. Returns
287
+ * the payload (with `errors`) or null.
288
+ */
190
289
  export async function updateKbArticle(c: UiduClient, v: UpdateKbArticleMutationVariables) {
191
290
  return (await c.mutate(UpdateKbArticleDocument, v)).updateKbArticle ?? null;
192
291
  }
292
+ /**
293
+ * Delete a knowledge-base article by `{ input: { id } }`. Returns the payload
294
+ * (with `errors`) or null.
295
+ */
193
296
  export async function deleteKbArticle(c: UiduClient, v: DeleteKbArticleMutationVariables) {
194
297
  return (await c.mutate(DeleteKbArticleDocument, v)).deleteKbArticle ?? null;
195
298
  }
196
299
 
197
300
  // --- Help center channels ---
301
+ /**
302
+ * Create a help-center channel. Returns the payload (with `errors`) or null.
303
+ * The new channel is at `channel.node`.
304
+ */
198
305
  export async function createChannel(c: UiduClient, v: CreateChannelMutationVariables) {
199
306
  return (await c.mutate(CreateChannelDocument, v)).createChannel ?? null;
200
307
  }
308
+ /**
309
+ * Update a help-center channel: `{ input: { id, attributes } }`. Returns the
310
+ * payload (with `errors`) or null.
311
+ */
201
312
  export async function updateChannel(c: UiduClient, v: UpdateChannelMutationVariables) {
202
313
  return (await c.mutate(UpdateChannelDocument, v)).updateChannel ?? null;
203
314
  }
315
+ /**
316
+ * Delete a help-center channel by `{ input: { id } }`. Returns the payload
317
+ * (with `errors`) or null.
318
+ */
204
319
  export async function deleteChannel(c: UiduClient, v: DeleteChannelMutationVariables) {
205
320
  return (await c.mutate(DeleteChannelDocument, v)).deleteChannel ?? null;
206
321
  }
207
322
 
208
323
  // --- Content updates (create lives in the scope's domain file) ---
324
+ /**
325
+ * Update an event: `{ input: { id, attributes } }` (create it with
326
+ * `createEvent`). Returns the payload (with `errors`) or null.
327
+ */
209
328
  export async function updateEvent(c: UiduClient, v: UpdateEventMutationVariables) {
210
329
  return (await c.mutate(UpdateEventDocument, v)).updateEvent ?? null;
211
330
  }
331
+ /**
332
+ * Update a story: `{ input: { id, attributes } }` (create it with
333
+ * `createStory`). Returns the payload (with `errors`) or null.
334
+ */
212
335
  export async function updateStory(c: UiduClient, v: UpdateStoryMutationVariables) {
213
336
  return (await c.mutate(UpdateStoryDocument, v)).updateStory ?? null;
214
337
  }
338
+ /**
339
+ * Update a donation campaign: `{ input: { id, attributes } }`. Returns the
340
+ * payload (with `errors`) or null.
341
+ */
215
342
  export async function updateDonationCampaign(c: UiduClient, v: UpdateDonationCampaignMutationVariables) {
216
343
  return (await c.mutate(UpdateDonationCampaignDocument, v)).updateDonationCampaign ?? null;
217
344
  }
345
+ /**
346
+ * Delete a donation campaign by `{ input: { id } }`. Returns the payload (with
347
+ * `errors`) or null.
348
+ */
218
349
  export async function deleteDonationCampaign(c: UiduClient, v: DeleteDonationCampaignMutationVariables) {
219
350
  return (await c.mutate(DeleteDonationCampaignDocument, v)).deleteDonationCampaign ?? null;
220
351
  }
221
352
 
222
353
  // --- Tasks / Notes / Spaces (create lives in their domain files) ---
354
+ /**
355
+ * Update a task, e.g. its `statusId` or dates: `{ input: { id, attributes }
356
+ * }`. Returns the payload (with `errors`) or null.
357
+ */
223
358
  export async function updateTask(c: UiduClient, v: UpdateTaskMutationVariables) {
224
359
  return (await c.mutate(UpdateTaskDocument, v)).updateTask ?? null;
225
360
  }
361
+ /**
362
+ * Delete a task by `{ input: { id } }`. Returns the payload (with `errors`) or
363
+ * null.
364
+ */
226
365
  export async function deleteTask(c: UiduClient, v: DeleteTaskMutationVariables) {
227
366
  return (await c.mutate(DeleteTaskDocument, v)).deleteTask ?? null;
228
367
  }
368
+ /**
369
+ * Update a note: `{ input: { id, attributes } }`. Returns the payload (with
370
+ * `errors`) or null.
371
+ */
229
372
  export async function updateNote(c: UiduClient, v: UpdateNoteMutationVariables) {
230
373
  return (await c.mutate(UpdateNoteDocument, v)).updateNote ?? null;
231
374
  }
375
+ /**
376
+ * Delete a note by `{ input: { id } }`. Returns the payload (with `errors`) or
377
+ * null.
378
+ */
232
379
  export async function deleteNote(c: UiduClient, v: DeleteNoteMutationVariables) {
233
380
  return (await c.mutate(DeleteNoteDocument, v)).deleteNote ?? null;
234
381
  }
382
+ /**
383
+ * Update a space: `{ input: { id, attributes } }`. Returns the payload (with
384
+ * `errors`) or null.
385
+ */
235
386
  export async function updateSpace(c: UiduClient, v: UpdateSpaceMutationVariables) {
236
387
  return (await c.mutate(UpdateSpaceDocument, v)).updateSpace ?? null;
237
388
  }
389
+ /**
390
+ * Delete a space by `{ input: { id } }`. Returns the payload (with `errors`)
391
+ * or null.
392
+ */
238
393
  export async function deleteSpace(c: UiduClient, v: DeleteSpaceMutationVariables) {
239
394
  return (await c.mutate(DeleteSpaceDocument, v)).deleteSpace ?? null;
240
395
  }
package/src/notes.ts CHANGED
@@ -6,6 +6,10 @@ import {
6
6
 
7
7
  // Authoring (Bearer / doorkeeper token). Returns the payload, incl. `errors`.
8
8
 
9
+ /**
10
+ * Create a note. Returns the payload (with `errors`) or null; the new note is
11
+ * at `note.node`.
12
+ */
9
13
  export async function createNote(
10
14
  client: UiduClient,
11
15
  variables: CreateNoteMutationVariables,
package/src/people.ts CHANGED
@@ -55,6 +55,10 @@ export type Kind = NonNullable<
55
55
  >['node']
56
56
  >;
57
57
 
58
+ /**
59
+ * The workspace's employees with their current employment, as a flat array;
60
+ * page with `first`/`after`.
61
+ */
58
62
  export async function listEmployees(
59
63
  client: UiduClient,
60
64
  variables: ListEmployeesQueryVariables = {},
@@ -63,6 +67,10 @@ export async function listEmployees(
63
67
  return nodes(result.currentWorkspace?.employees);
64
68
  }
65
69
 
70
+ /**
71
+ * One employee with current employment, today's time clocks and the shifts of
72
+ * the week starting `weekStartingAt` (see `weekStartFor`), or null.
73
+ */
66
74
  export async function getEmployee(
67
75
  client: UiduClient,
68
76
  variables: GetEmployeeQueryVariables,
@@ -37,6 +37,7 @@ query GetPage($projectId: ID!, $slug: String!) {
37
37
  kind
38
38
  }
39
39
  linkedRecord {
40
+ __typename
40
41
  ... on Form {
41
42
  id
42
43
  inputs: formQuestions {
package/src/search.ts CHANGED
@@ -9,6 +9,13 @@ export type SearchResult = NonNullable<
9
9
  NonNullable<SearchQuery['currentWorkspace']>['search']
10
10
  >;
11
11
 
12
+ /**
13
+ * Search the workspace index, optionally limited to `models`, with filters and
14
+ * sorting in `params`; page with `first`/`after`.
15
+ *
16
+ * Returns the connection itself, not a flat array: `edges`, `pageInfo`,
17
+ * `totalCount`, `term`, `took`. Each node only carries `__typename` and `id`.
18
+ */
12
19
  export async function search(
13
20
  client: UiduClient,
14
21
  variables: SearchQueryVariables,
package/src/spaces.ts CHANGED
@@ -6,6 +6,10 @@ import {
6
6
 
7
7
  // Authoring (Bearer / doorkeeper token). Returns the payload, incl. `errors`.
8
8
 
9
+ /**
10
+ * Create a space, the container tasks live in. Returns the payload (with
11
+ * `errors`) or null; the new space is at `space.node`.
12
+ */
9
13
  export async function createSpace(
10
14
  client: UiduClient,
11
15
  variables: CreateSpaceMutationVariables,
package/src/stories.ts CHANGED
@@ -14,6 +14,9 @@ export type Story = NonNullable<
14
14
  NonNullable<GetStoryQuery['currentWorkspace']>['story']
15
15
  >;
16
16
 
17
+ /**
18
+ * One story with its rich-text `body`, or null.
19
+ */
17
20
  export async function getStory(
18
21
  client: UiduClient,
19
22
  variables: GetStoryQueryVariables,
@@ -22,6 +25,10 @@ export async function getStory(
22
25
  return result.currentWorkspace?.story ?? null;
23
26
  }
24
27
 
28
+ /**
29
+ * The workspace's stories as a flat array of summaries (no `body`); page with
30
+ * `first`/`after`.
31
+ */
25
32
  export async function listStories(
26
33
  client: UiduClient,
27
34
  variables: ListStoriesQueryVariables = {},
@@ -30,6 +37,10 @@ export async function listStories(
30
37
  return nodes(result.currentWorkspace?.storiesConnection);
31
38
  }
32
39
 
40
+ /**
41
+ * Create a story; returns the payload as-is, `{ errors, story }`, validation
42
+ * failures included.
43
+ */
33
44
  export async function createStory(
34
45
  client: UiduClient,
35
46
  variables: CreateStoryMutationVariables,
package/src/system.ts CHANGED
@@ -9,6 +9,10 @@ import {
9
9
  // Workspace-level authoring. Requires a doorkeeper Bearer token (apiKey on the
10
10
  // client) — these run as the authenticated account, subject to its Pundit role.
11
11
 
12
+ /**
13
+ * Create a workspace owned by the authenticated account (`attributes.name`,
14
+ * `subdomain`…). Returns the payload (with `errors`) or null.
15
+ */
12
16
  export async function createWorkspace(
13
17
  client: UiduClient,
14
18
  variables: CreateWorkspaceMutationVariables,
package/src/tasks.ts CHANGED
@@ -6,6 +6,10 @@ import {
6
6
 
7
7
  // Authoring (Bearer / doorkeeper token). Returns the payload, incl. `errors`.
8
8
 
9
+ /**
10
+ * Create a task, usually in a space (`attributes.spaceId`). Returns the
11
+ * payload (with `errors`) or null.
12
+ */
9
13
  export async function createTask(
10
14
  client: UiduClient,
11
15
  variables: CreateTaskMutationVariables,
package/src/types.ts CHANGED
@@ -20,6 +20,10 @@ export interface UiduErrorOptions {
20
20
  cause?: unknown;
21
21
  }
22
22
 
23
+ /**
24
+ * What `UiduClient` throws: `code` is `GRAPHQL_ERROR` (with `graphQLErrors`),
25
+ * `NETWORK_ERROR`, `TOKEN_ERROR` or `CONFIG_ERROR`.
26
+ */
23
27
  export class UiduError extends Error {
24
28
  readonly code: string;
25
29
  readonly graphQLErrors: ReadonlyArray<unknown>;