@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/CHANGELOG.md +18 -0
- package/dist/declarations/src/applications.d.ts +56 -3
- package/dist/declarations/src/generated/index.d.ts +2883 -166
- package/dist/declarations/src/index.d.ts +3 -3
- package/dist/declarations/src/mutations.d.ts +20 -1
- package/dist/declarations/src/sites.d.ts +23 -1
- package/dist/uidu-client.cjs.dev.js +54 -3
- package/dist/uidu-client.cjs.prod.js +54 -3
- package/dist/uidu-client.esm.js +51 -4
- package/package.json +1 -1
- package/src/applications.test.ts +42 -0
- package/src/applications.ts +31 -2
- package/src/generated/index.ts +2526 -170
- package/src/index.ts +8 -1
- package/src/mutations.ts +7 -0
- package/src/queries/applications/UpdateApplication.graphql +17 -0
- package/src/queries/people/TimeClockMutations.graphql +17 -0
- package/src/queries/sites/CreateSite.graphql +15 -0
- package/src/sites.test.ts +26 -0
- package/src/sites.ts +17 -0
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 {
|
|
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;
|
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
|
+
}
|