@uidu/client 3.12.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 (71) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/declarations/src/actions.d.ts +10 -0
  3. package/dist/declarations/src/applications.d.ts +56 -3
  4. package/dist/declarations/src/benefit-enrollments.d.ts +5 -0
  5. package/dist/declarations/src/benefits.d.ts +5 -0
  6. package/dist/declarations/src/bookings.d.ts +22 -0
  7. package/dist/declarations/src/calls.d.ts +8 -0
  8. package/dist/declarations/src/campaigns.d.ts +12 -0
  9. package/dist/declarations/src/client.d.ts +13 -1
  10. package/dist/declarations/src/cms.d.ts +32 -0
  11. package/dist/declarations/src/contacts.d.ts +16 -0
  12. package/dist/declarations/src/courses.d.ts +23 -0
  13. package/dist/declarations/src/donations.d.ts +19 -0
  14. package/dist/declarations/src/events.d.ts +19 -0
  15. package/dist/declarations/src/forms.d.ts +19 -0
  16. package/dist/declarations/src/generated/index.d.ts +2893 -176
  17. package/dist/declarations/src/goals.d.ts +4 -0
  18. package/dist/declarations/src/help-center.d.ts +4 -0
  19. package/dist/declarations/src/index.d.ts +3 -3
  20. package/dist/declarations/src/kb.d.ts +15 -0
  21. package/dist/declarations/src/models.d.ts +54 -0
  22. package/dist/declarations/src/mutations.d.ts +175 -1
  23. package/dist/declarations/src/notes.d.ts +4 -0
  24. package/dist/declarations/src/people.d.ts +8 -0
  25. package/dist/declarations/src/search.d.ts +7 -0
  26. package/dist/declarations/src/sites.d.ts +23 -1
  27. package/dist/declarations/src/spaces.d.ts +4 -0
  28. package/dist/declarations/src/stories.d.ts +11 -0
  29. package/dist/declarations/src/system.d.ts +4 -0
  30. package/dist/declarations/src/tasks.d.ts +4 -0
  31. package/dist/declarations/src/types.d.ts +4 -0
  32. package/dist/uidu-client.cjs.dev.js +585 -10
  33. package/dist/uidu-client.cjs.prod.js +585 -10
  34. package/dist/uidu-client.esm.js +582 -11
  35. package/package.json +1 -1
  36. package/src/actions.ts +10 -6
  37. package/src/applications.test.ts +42 -0
  38. package/src/applications.ts +31 -2
  39. package/src/benefit-enrollments.ts +5 -0
  40. package/src/benefits.ts +5 -0
  41. package/src/bookings.ts +22 -0
  42. package/src/calls.ts +8 -0
  43. package/src/campaigns.ts +12 -0
  44. package/src/client.ts +13 -1
  45. package/src/cms.ts +32 -0
  46. package/src/contacts.ts +16 -0
  47. package/src/courses.ts +23 -0
  48. package/src/donations.ts +19 -0
  49. package/src/events.ts +19 -0
  50. package/src/forms.ts +19 -0
  51. package/src/generated/index.ts +2528 -172
  52. package/src/goals.ts +4 -0
  53. package/src/help-center.ts +4 -0
  54. package/src/index.ts +8 -1
  55. package/src/kb.ts +15 -0
  56. package/src/models.ts +54 -0
  57. package/src/mutations.ts +162 -0
  58. package/src/notes.ts +4 -0
  59. package/src/people.ts +8 -0
  60. package/src/queries/applications/UpdateApplication.graphql +17 -0
  61. package/src/queries/cms/GetPage.graphql +1 -0
  62. package/src/queries/people/TimeClockMutations.graphql +17 -0
  63. package/src/queries/sites/CreateSite.graphql +15 -0
  64. package/src/search.ts +7 -0
  65. package/src/sites.test.ts +26 -0
  66. package/src/sites.ts +17 -0
  67. package/src/spaces.ts +4 -0
  68. package/src/stories.ts +11 -0
  69. package/src/system.ts +4 -0
  70. package/src/tasks.ts +4 -0
  71. 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/index.ts CHANGED
@@ -53,6 +53,7 @@ export {
53
53
  getPageBySlug,
54
54
  listSitePages,
55
55
  getSingletonBlock,
56
+ createSite,
56
57
  } from './sites';
57
58
  export type {
58
59
  Site,
@@ -111,6 +112,7 @@ export {
111
112
  createCompensation,
112
113
  updateCompensation,
113
114
  deleteCompensation,
115
+ createTimeClock,
114
116
  } from './mutations';
115
117
 
116
118
  export {
@@ -136,7 +138,12 @@ export type { Call } from './calls';
136
138
  export { getJob, listJobs } from './jobs';
137
139
  export type { Job } from './jobs';
138
140
 
139
- export { listApplications, createApplication } from './applications';
141
+ export {
142
+ listApplications,
143
+ createApplication,
144
+ updateApplication,
145
+ completeApplication,
146
+ } from './applications';
140
147
  export type { Application } from './applications';
141
148
 
142
149
  export {
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
@@ -25,6 +25,8 @@ import {
25
25
  type CreateKbArticleMutationVariables,
26
26
  CreateKbCollectionDocument,
27
27
  type CreateKbCollectionMutationVariables,
28
+ CreateTimeClockDocument,
29
+ type CreateTimeClockMutationVariables,
28
30
  DeleteChannelDocument,
29
31
  type DeleteChannelMutationVariables,
30
32
  DeleteContactDocument,
@@ -82,37 +84,77 @@ import {
82
84
  } from './generated';
83
85
 
84
86
  // --- Courses ---
87
+ /**
88
+ * Create a course from `{ input: { attributes } }`. Returns the payload (with
89
+ * `errors`) or null.
90
+ */
85
91
  export async function createCourse(c: UiduClient, v: CreateCourseMutationVariables) {
86
92
  return (await c.mutate(CreateCourseDocument, v)).createCourse ?? null;
87
93
  }
94
+ /**
95
+ * Update a course: `{ input: { id, attributes } }`. Returns the payload (with
96
+ * `errors`) or null.
97
+ */
88
98
  export async function updateCourse(c: UiduClient, v: UpdateCourseMutationVariables) {
89
99
  return (await c.mutate(UpdateCourseDocument, v)).updateCourse ?? null;
90
100
  }
101
+ /**
102
+ * Delete a course by `{ input: { id } }`. Returns the payload (with `errors`)
103
+ * or null.
104
+ */
91
105
  export async function deleteCourse(c: UiduClient, v: DeleteCourseMutationVariables) {
92
106
  return (await c.mutate(DeleteCourseDocument, v)).deleteCourse ?? null;
93
107
  }
94
108
 
95
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
+ */
96
114
  export async function createForm(c: UiduClient, v: CreateFormMutationVariables) {
97
115
  return (await c.mutate(CreateFormDocument, v)).createForm ?? null;
98
116
  }
117
+ /**
118
+ * Update a form: `{ input: { id, attributes } }`. Returns the payload (with
119
+ * `errors`) or null.
120
+ */
99
121
  export async function updateForm(c: UiduClient, v: UpdateFormMutationVariables) {
100
122
  return (await c.mutate(UpdateFormDocument, v)).updateForm ?? null;
101
123
  }
124
+ /**
125
+ * Delete a form by `{ input: { id } }`. Returns the payload (with `errors`) or
126
+ * null.
127
+ */
102
128
  export async function deleteForm(c: UiduClient, v: DeleteFormMutationVariables) {
103
129
  return (await c.mutate(DeleteFormDocument, v)).deleteForm ?? null;
104
130
  }
105
131
 
106
132
  // --- Contacts & Deals ---
133
+ /**
134
+ * Create a CRM contact from `{ input: { attributes } }`. Returns the payload
135
+ * (with `errors`) or null.
136
+ */
107
137
  export async function createContact(c: UiduClient, v: CreateContactMutationVariables) {
108
138
  return (await c.mutate(CreateContactDocument, v)).createContact ?? null;
109
139
  }
140
+ /**
141
+ * Delete a contact by `{ input: { id } }`. Returns the payload (with `errors`)
142
+ * or null.
143
+ */
110
144
  export async function deleteContact(c: UiduClient, v: DeleteContactMutationVariables) {
111
145
  return (await c.mutate(DeleteContactDocument, v)).deleteContact ?? null;
112
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
+ */
113
151
  export async function createDeal(c: UiduClient, v: CreateDealMutationVariables) {
114
152
  return (await c.mutate(CreateDealDocument, v)).createDeal ?? null;
115
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
+ */
116
158
  export async function updateDeal(c: UiduClient, v: UpdateDealMutationVariables) {
117
159
  return (await c.mutate(UpdateDealDocument, v)).updateDeal ?? null;
118
160
  }
@@ -123,18 +165,39 @@ export async function updateDeal(c: UiduClient, v: UpdateDealMutationVariables)
123
165
  // offices, FTE…). A hire = createEmployment; a termination = updateEmployment
124
166
  // with an `endDate` + `endReason` (see `terminateEmployment`); a contract
125
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
+ */
126
172
  export async function createEmployee(c: UiduClient, v: CreateEmployeeMutationVariables) {
127
173
  return (await c.mutate(CreateEmployeeDocument, v)).createEmployee ?? null;
128
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
+ */
129
179
  export async function updateEmployee(c: UiduClient, v: UpdateEmployeeMutationVariables) {
130
180
  return (await c.mutate(UpdateEmployeeDocument, v)).updateEmployee ?? null;
131
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
+ */
132
187
  export async function createEmployment(c: UiduClient, v: CreateEmploymentMutationVariables) {
133
188
  return (await c.mutate(CreateEmploymentDocument, v)).createEmployment ?? null;
134
189
  }
190
+ /**
191
+ * Update an employment: `{ input: { id, attributes } }`; to end one, prefer
192
+ * `terminateEmployment`. Returns the payload (with `errors`) or null.
193
+ */
135
194
  export async function updateEmployment(c: UiduClient, v: UpdateEmploymentMutationVariables) {
136
195
  return (await c.mutate(UpdateEmploymentDocument, v)).updateEmployment ?? null;
137
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
+ */
138
201
  export async function deleteEmployment(c: UiduClient, v: DeleteEmploymentMutationVariables) {
139
202
  return (await c.mutate(DeleteEmploymentDocument, v)).deleteEmployment ?? null;
140
203
  }
@@ -156,78 +219,177 @@ export async function terminateEmployment(
156
219
  });
157
220
  }
158
221
 
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
+ */
228
+ export async function createTimeClock(c: UiduClient, v: CreateTimeClockMutationVariables) {
229
+ return (await c.mutate(CreateTimeClockDocument, v)).createTimeClock ?? null;
230
+ }
231
+
159
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
+ */
160
238
  export async function createCompensation(c: UiduClient, v: CreateCompensationMutationVariables) {
161
239
  return (await c.mutate(CreateCompensationDocument, v)).createCompensation ?? null;
162
240
  }
241
+ /**
242
+ * Update a pay item: `{ input: { id, attributes } }`. Returns the payload
243
+ * (with `errors`) or null.
244
+ */
163
245
  export async function updateCompensation(c: UiduClient, v: UpdateCompensationMutationVariables) {
164
246
  return (await c.mutate(UpdateCompensationDocument, v)).updateCompensation ?? null;
165
247
  }
248
+ /**
249
+ * Delete a pay item by `{ input: { id } }`. Returns the payload (with
250
+ * `errors`) or null.
251
+ */
166
252
  export async function deleteCompensation(c: UiduClient, v: DeleteCompensationMutationVariables) {
167
253
  return (await c.mutate(DeleteCompensationDocument, v)).deleteCompensation ?? null;
168
254
  }
169
255
 
170
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
+ */
171
261
  export async function createKbCollection(c: UiduClient, v: CreateKbCollectionMutationVariables) {
172
262
  return (await c.mutate(CreateKbCollectionDocument, v)).createKbCollection ?? null;
173
263
  }
264
+ /**
265
+ * Update a knowledge-base collection: `{ input: { id, attributes } }`. Returns
266
+ * the payload (with `errors`) or null.
267
+ */
174
268
  export async function updateKbCollection(c: UiduClient, v: UpdateKbCollectionMutationVariables) {
175
269
  return (await c.mutate(UpdateKbCollectionDocument, v)).updateKbCollection ?? null;
176
270
  }
271
+ /**
272
+ * Delete a knowledge-base collection by `{ input: { id } }`. Returns the
273
+ * payload (with `errors`) or null.
274
+ */
177
275
  export async function deleteKbCollection(c: UiduClient, v: DeleteKbCollectionMutationVariables) {
178
276
  return (await c.mutate(DeleteKbCollectionDocument, v)).deleteKbCollection ?? null;
179
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
+ */
180
282
  export async function createKbArticle(c: UiduClient, v: CreateKbArticleMutationVariables) {
181
283
  return (await c.mutate(CreateKbArticleDocument, v)).createKbArticle ?? null;
182
284
  }
285
+ /**
286
+ * Update a knowledge-base article: `{ input: { id, attributes } }`. Returns
287
+ * the payload (with `errors`) or null.
288
+ */
183
289
  export async function updateKbArticle(c: UiduClient, v: UpdateKbArticleMutationVariables) {
184
290
  return (await c.mutate(UpdateKbArticleDocument, v)).updateKbArticle ?? null;
185
291
  }
292
+ /**
293
+ * Delete a knowledge-base article by `{ input: { id } }`. Returns the payload
294
+ * (with `errors`) or null.
295
+ */
186
296
  export async function deleteKbArticle(c: UiduClient, v: DeleteKbArticleMutationVariables) {
187
297
  return (await c.mutate(DeleteKbArticleDocument, v)).deleteKbArticle ?? null;
188
298
  }
189
299
 
190
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
+ */
191
305
  export async function createChannel(c: UiduClient, v: CreateChannelMutationVariables) {
192
306
  return (await c.mutate(CreateChannelDocument, v)).createChannel ?? null;
193
307
  }
308
+ /**
309
+ * Update a help-center channel: `{ input: { id, attributes } }`. Returns the
310
+ * payload (with `errors`) or null.
311
+ */
194
312
  export async function updateChannel(c: UiduClient, v: UpdateChannelMutationVariables) {
195
313
  return (await c.mutate(UpdateChannelDocument, v)).updateChannel ?? null;
196
314
  }
315
+ /**
316
+ * Delete a help-center channel by `{ input: { id } }`. Returns the payload
317
+ * (with `errors`) or null.
318
+ */
197
319
  export async function deleteChannel(c: UiduClient, v: DeleteChannelMutationVariables) {
198
320
  return (await c.mutate(DeleteChannelDocument, v)).deleteChannel ?? null;
199
321
  }
200
322
 
201
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
+ */
202
328
  export async function updateEvent(c: UiduClient, v: UpdateEventMutationVariables) {
203
329
  return (await c.mutate(UpdateEventDocument, v)).updateEvent ?? null;
204
330
  }
331
+ /**
332
+ * Update a story: `{ input: { id, attributes } }` (create it with
333
+ * `createStory`). Returns the payload (with `errors`) or null.
334
+ */
205
335
  export async function updateStory(c: UiduClient, v: UpdateStoryMutationVariables) {
206
336
  return (await c.mutate(UpdateStoryDocument, v)).updateStory ?? null;
207
337
  }
338
+ /**
339
+ * Update a donation campaign: `{ input: { id, attributes } }`. Returns the
340
+ * payload (with `errors`) or null.
341
+ */
208
342
  export async function updateDonationCampaign(c: UiduClient, v: UpdateDonationCampaignMutationVariables) {
209
343
  return (await c.mutate(UpdateDonationCampaignDocument, v)).updateDonationCampaign ?? null;
210
344
  }
345
+ /**
346
+ * Delete a donation campaign by `{ input: { id } }`. Returns the payload (with
347
+ * `errors`) or null.
348
+ */
211
349
  export async function deleteDonationCampaign(c: UiduClient, v: DeleteDonationCampaignMutationVariables) {
212
350
  return (await c.mutate(DeleteDonationCampaignDocument, v)).deleteDonationCampaign ?? null;
213
351
  }
214
352
 
215
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
+ */
216
358
  export async function updateTask(c: UiduClient, v: UpdateTaskMutationVariables) {
217
359
  return (await c.mutate(UpdateTaskDocument, v)).updateTask ?? null;
218
360
  }
361
+ /**
362
+ * Delete a task by `{ input: { id } }`. Returns the payload (with `errors`) or
363
+ * null.
364
+ */
219
365
  export async function deleteTask(c: UiduClient, v: DeleteTaskMutationVariables) {
220
366
  return (await c.mutate(DeleteTaskDocument, v)).deleteTask ?? null;
221
367
  }
368
+ /**
369
+ * Update a note: `{ input: { id, attributes } }`. Returns the payload (with
370
+ * `errors`) or null.
371
+ */
222
372
  export async function updateNote(c: UiduClient, v: UpdateNoteMutationVariables) {
223
373
  return (await c.mutate(UpdateNoteDocument, v)).updateNote ?? null;
224
374
  }
375
+ /**
376
+ * Delete a note by `{ input: { id } }`. Returns the payload (with `errors`) or
377
+ * null.
378
+ */
225
379
  export async function deleteNote(c: UiduClient, v: DeleteNoteMutationVariables) {
226
380
  return (await c.mutate(DeleteNoteDocument, v)).deleteNote ?? null;
227
381
  }
382
+ /**
383
+ * Update a space: `{ input: { id, attributes } }`. Returns the payload (with
384
+ * `errors`) or null.
385
+ */
228
386
  export async function updateSpace(c: UiduClient, v: UpdateSpaceMutationVariables) {
229
387
  return (await c.mutate(UpdateSpaceDocument, v)).updateSpace ?? null;
230
388
  }
389
+ /**
390
+ * Delete a space by `{ input: { id } }`. Returns the payload (with `errors`)
391
+ * or null.
392
+ */
231
393
  export async function deleteSpace(c: UiduClient, v: DeleteSpaceMutationVariables) {
232
394
  return (await c.mutate(DeleteSpaceDocument, v)).deleteSpace ?? null;
233
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,
@@ -0,0 +1,17 @@
1
+ mutation UpdateApplication($input: UpdateApplicationInput!) {
2
+ updateApplication(input: $input) {
3
+ errors {
4
+ key
5
+ name
6
+ type
7
+ }
8
+ application {
9
+ id
10
+ aasmState
11
+ completedAt
12
+ formResponse {
13
+ id
14
+ }
15
+ }
16
+ }
17
+ }
@@ -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 {
@@ -0,0 +1,17 @@
1
+ mutation CreateTimeClock($input: CreateTimeClockInput!) {
2
+ createTimeClock(input: $input) {
3
+ timeClock {
4
+ node {
5
+ id
6
+ beginsAt
7
+ finishesAt
8
+ kind
9
+ }
10
+ }
11
+ errors {
12
+ key
13
+ name
14
+ type
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,15 @@
1
+ mutation CreateSite($input: CreateSiteInput!) {
2
+ createSite(input: $input) {
3
+ site {
4
+ node {
5
+ id
6
+ name
7
+ }
8
+ }
9
+ errors {
10
+ key
11
+ name
12
+ type
13
+ }
14
+ }
15
+ }
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/sites.test.ts CHANGED
@@ -313,3 +313,29 @@ describe('getSingletonBlock', () => {
313
313
  ).resolves.toBeNull();
314
314
  });
315
315
  });
316
+
317
+ describe('createSite', () => {
318
+ it('provisions a Site and returns the mutation payload', async () => {
319
+ request.mockResolvedValue({
320
+ createSite: { site: { node: { id: 'site_2', name: 'Acme' } }, errors: [] },
321
+ });
322
+ const result = await sites.createSite(client, {
323
+ input: { attributes: { name: 'Acme', tenantId: 'tnt_1' } },
324
+ });
325
+ expect(operation(request.mock.calls[0])).toBe('CreateSite');
326
+ expect(request.mock.calls[0][1]).toEqual({
327
+ input: { attributes: { name: 'Acme', tenantId: 'tnt_1' } },
328
+ });
329
+ expect(result).toEqual({ site: { node: { id: 'site_2', name: 'Acme' } }, errors: [] });
330
+ });
331
+
332
+ it('returns the payload as-is, including errors, without throwing', async () => {
333
+ request.mockResolvedValue({
334
+ createSite: { site: null, errors: [{ key: 'name', name: "can't be blank", type: 'blank' }] },
335
+ });
336
+ const result = await sites.createSite(client, {
337
+ input: { attributes: { tenantId: 'tnt_1' } },
338
+ });
339
+ expect(result?.errors).toEqual([{ key: 'name', name: "can't be blank", type: 'blank' }]);
340
+ });
341
+ });