@uidu/client 3.12.0 → 3.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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/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,
@@ -156,6 +158,11 @@ export async function terminateEmployment(
156
158
  });
157
159
  }
158
160
 
161
+ // --- Time clocks (punches) ---
162
+ export async function createTimeClock(c: UiduClient, v: CreateTimeClockMutationVariables) {
163
+ return (await c.mutate(CreateTimeClockDocument, v)).createTimeClock ?? null;
164
+ }
165
+
159
166
  // --- Compensation (pay items on an employment) ---
160
167
  export async function createCompensation(c: UiduClient, v: CreateCompensationMutationVariables) {
161
168
  return (await c.mutate(CreateCompensationDocument, v)).createCompensation ?? null;
@@ -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
+ }
@@ -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/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
+ });
package/src/sites.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import type { UiduClient } from './client';
2
2
  import {
3
+ CreateSiteDocument,
4
+ type CreateSiteMutationVariables,
3
5
  GetSiteByDomainDocument,
4
6
  GetSiteDocument,
5
7
  GetSitePageBySlugDocument,
@@ -171,3 +173,18 @@ export async function getSingletonBlock(
171
173
  if (node?.__typename !== 'Site' || !node.singletonBlock) return null;
172
174
  return toPage(node.singletonBlock);
173
175
  }
176
+
177
+ // --- writes -----------------------------------------------------------------
178
+
179
+ /**
180
+ * Provisions a new Site in the workspace/account (`tenantId`). Bearer token
181
+ * (`apiKey`) — this is workspace admin territory, never a public write.
182
+ * Returns the mutation payload as-is, including `errors`.
183
+ */
184
+ export async function createSite(
185
+ client: UiduClient,
186
+ variables: CreateSiteMutationVariables,
187
+ ) {
188
+ const result = await client.mutate(CreateSiteDocument, variables);
189
+ return result.createSite ?? null;
190
+ }