@uidu/client 3.20.0 → 3.21.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 +7 -0
- package/dist/declarations/src/candidates.d.ts +118 -5
- package/dist/declarations/src/generated/index.d.ts +629 -19
- package/dist/declarations/src/index.d.ts +5 -5
- package/dist/declarations/src/meetings.d.ts +42 -1
- package/dist/declarations/src/reviews.d.ts +14 -7
- package/dist/uidu-client.cjs.dev.js +90 -9
- package/dist/uidu-client.cjs.prod.js +90 -9
- package/dist/uidu-client.esm.js +85 -10
- package/package.json +1 -1
- package/src/candidates.ts +84 -3
- package/src/generated/index.ts +271 -35
- package/src/index.ts +15 -3
- package/src/meetings.ts +35 -0
- package/src/queries/candidates/CandidateFields.graphql +19 -1
- package/src/queries/candidates/CandidateMutations.graphql +27 -0
- package/src/queries/candidates/CandidateQueries.graphql +52 -3
- package/src/queries/meetings/MeetingQueries.graphql +46 -0
- package/src/queries/reviews/ReviewQueries.graphql +22 -3
- package/src/recruiting.test.ts +102 -1
- package/src/reviews.ts +27 -6
package/src/index.ts
CHANGED
|
@@ -177,16 +177,23 @@ export type { Application } from './applications';
|
|
|
177
177
|
|
|
178
178
|
export {
|
|
179
179
|
findCandidates,
|
|
180
|
+
listCandidates,
|
|
180
181
|
getCandidate,
|
|
182
|
+
createCandidate,
|
|
181
183
|
updateCandidate,
|
|
182
184
|
listPools,
|
|
185
|
+
getPool,
|
|
183
186
|
createPoolContact,
|
|
187
|
+
deletePoolContact,
|
|
184
188
|
} from './candidates';
|
|
185
189
|
export type {
|
|
186
190
|
Candidate,
|
|
187
191
|
CandidateDetail,
|
|
192
|
+
CandidateListItem,
|
|
188
193
|
CandidateSearch,
|
|
189
194
|
Pool,
|
|
195
|
+
PoolContact,
|
|
196
|
+
PoolDetail,
|
|
190
197
|
} from './candidates';
|
|
191
198
|
|
|
192
199
|
export {
|
|
@@ -197,10 +204,15 @@ export {
|
|
|
197
204
|
updateReview,
|
|
198
205
|
listReviewTemplates,
|
|
199
206
|
} from './reviews';
|
|
200
|
-
export type { Review, ReviewTemplate } from './reviews';
|
|
207
|
+
export type { Review, ReviewDetail, ReviewTemplate } from './reviews';
|
|
201
208
|
|
|
202
|
-
export {
|
|
203
|
-
|
|
209
|
+
export {
|
|
210
|
+
listMeetings,
|
|
211
|
+
getMeeting,
|
|
212
|
+
createMeeting,
|
|
213
|
+
updateMeeting,
|
|
214
|
+
} from './meetings';
|
|
215
|
+
export type { Meeting, MeetingDetail } from './meetings';
|
|
204
216
|
|
|
205
217
|
export { listSkills, createSkill } from './skills';
|
|
206
218
|
export type { WorkspaceSkill } from './skills';
|
package/src/meetings.ts
CHANGED
|
@@ -2,9 +2,14 @@ import type { UiduClient } from './client';
|
|
|
2
2
|
import {
|
|
3
3
|
CreateMeetingDocument,
|
|
4
4
|
type CreateMeetingMutationVariables,
|
|
5
|
+
GetMeetingDocument,
|
|
6
|
+
type GetMeetingQuery,
|
|
7
|
+
type GetMeetingQueryVariables,
|
|
5
8
|
ListMeetingsDocument,
|
|
6
9
|
type ListMeetingsQueryVariables,
|
|
7
10
|
type MeetingSummaryFragment,
|
|
11
|
+
UpdateMeetingDocument,
|
|
12
|
+
type UpdateMeetingMutationVariables,
|
|
8
13
|
} from './generated';
|
|
9
14
|
import { nodes } from './utils/relay';
|
|
10
15
|
|
|
@@ -13,6 +18,9 @@ import { nodes } from './utils/relay';
|
|
|
13
18
|
// Reads and writes need an account (Bearer / apiKey), server-side.
|
|
14
19
|
|
|
15
20
|
export type Meeting = MeetingSummaryFragment;
|
|
21
|
+
export type MeetingDetail = NonNullable<
|
|
22
|
+
NonNullable<GetMeetingQuery['currentWorkspace']>['meeting']
|
|
23
|
+
>;
|
|
16
24
|
|
|
17
25
|
/** The workspace's meetings, filtered and sorted with `params`; page with `first`/`after`. */
|
|
18
26
|
export async function listMeetings(
|
|
@@ -23,6 +31,19 @@ export async function listMeetings(
|
|
|
23
31
|
return nodes(result.currentWorkspace?.meetings);
|
|
24
32
|
}
|
|
25
33
|
|
|
34
|
+
/**
|
|
35
|
+
* One meeting by GlobalID with the records it is linked to (`related`, each
|
|
36
|
+
* relationship's `relatedTo`: an Application, a Call, a Contact, an
|
|
37
|
+
* Employee…), or null.
|
|
38
|
+
*/
|
|
39
|
+
export async function getMeeting(
|
|
40
|
+
client: UiduClient,
|
|
41
|
+
variables: GetMeetingQueryVariables,
|
|
42
|
+
): Promise<MeetingDetail | null> {
|
|
43
|
+
const result = await client.query(GetMeetingDocument, variables);
|
|
44
|
+
return result.currentWorkspace?.meeting ?? null;
|
|
45
|
+
}
|
|
46
|
+
|
|
26
47
|
/**
|
|
27
48
|
* Create a meeting (`name`, `startsAt`, `endsAt`, `timeZone`, and
|
|
28
49
|
* `relatedAttributes` to link it to an application or a contact). Returns the
|
|
@@ -35,3 +56,17 @@ export async function createMeeting(
|
|
|
35
56
|
const result = await client.mutate(CreateMeetingDocument, variables);
|
|
36
57
|
return result.createMeeting ?? null;
|
|
37
58
|
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Update a meeting — reschedule it (`startsAt`, `endsAt`, `timeZone`), rename
|
|
62
|
+
* it, attach `recordingUrl` / `transcriptUrl`, or link more records with
|
|
63
|
+
* `relatedAttributes`. Returns the mutation payload as-is (including any
|
|
64
|
+
* `errors`).
|
|
65
|
+
*/
|
|
66
|
+
export async function updateMeeting(
|
|
67
|
+
client: UiduClient,
|
|
68
|
+
variables: UpdateMeetingMutationVariables,
|
|
69
|
+
) {
|
|
70
|
+
const result = await client.mutate(UpdateMeetingDocument, variables);
|
|
71
|
+
return result.updateMeeting ?? null;
|
|
72
|
+
}
|
|
@@ -3,7 +3,25 @@ fragment CandidateSummary on Candidate {
|
|
|
3
3
|
name
|
|
4
4
|
cvHeadline
|
|
5
5
|
cvSummary
|
|
6
|
-
|
|
6
|
+
sourceChannel
|
|
7
|
+
source {
|
|
8
|
+
__typename
|
|
9
|
+
... on Application {
|
|
10
|
+
id
|
|
11
|
+
}
|
|
12
|
+
... on Organization {
|
|
13
|
+
id
|
|
14
|
+
name
|
|
15
|
+
}
|
|
16
|
+
... on Pool {
|
|
17
|
+
id
|
|
18
|
+
name
|
|
19
|
+
}
|
|
20
|
+
... on User {
|
|
21
|
+
id
|
|
22
|
+
name
|
|
23
|
+
}
|
|
24
|
+
}
|
|
7
25
|
poolConsent
|
|
8
26
|
poolConsentAt
|
|
9
27
|
retainUntil
|
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
mutation CreateCandidate($input: CreateCandidateInput!) {
|
|
2
|
+
createCandidate(input: $input) {
|
|
3
|
+
candidates(first: 1) {
|
|
4
|
+
edges {
|
|
5
|
+
node {
|
|
6
|
+
...CandidateSummary
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
errors {
|
|
11
|
+
key
|
|
12
|
+
name
|
|
13
|
+
type
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
1
18
|
mutation UpdateCandidate($input: UpdateCandidateInput!) {
|
|
2
19
|
updateCandidate(input: $input) {
|
|
3
20
|
candidate {
|
|
@@ -33,3 +50,13 @@ mutation CreatePoolContact($input: CreatePoolContactInput!) {
|
|
|
33
50
|
}
|
|
34
51
|
}
|
|
35
52
|
}
|
|
53
|
+
|
|
54
|
+
mutation DeletePoolContact($input: DeletePoolContactInput!) {
|
|
55
|
+
deletePoolContact(input: $input) {
|
|
56
|
+
errors {
|
|
57
|
+
key
|
|
58
|
+
name
|
|
59
|
+
type
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
3
|
-
#
|
|
1
|
+
# `findCandidates` ranks talent-pool candidates (and, with `callId`, that
|
|
2
|
+
# call's applications) against a description; `ListCandidates` below is the
|
|
3
|
+
# plain, filterable list.
|
|
4
4
|
query FindCandidates(
|
|
5
5
|
$term: String
|
|
6
6
|
$callId: ID
|
|
@@ -92,3 +92,52 @@ query ListPools($first: Int, $after: String, $params: SearchParams) {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
+
|
|
96
|
+
query GetPool($id: ID!, $first: Int, $after: String) {
|
|
97
|
+
currentWorkspace {
|
|
98
|
+
pool(id: $id) {
|
|
99
|
+
id
|
|
100
|
+
name
|
|
101
|
+
color
|
|
102
|
+
poolContactsCount
|
|
103
|
+
createdAt
|
|
104
|
+
poolContacts(first: $first, after: $after) {
|
|
105
|
+
pageInfo {
|
|
106
|
+
hasNextPage
|
|
107
|
+
endCursor
|
|
108
|
+
}
|
|
109
|
+
edges {
|
|
110
|
+
node {
|
|
111
|
+
id
|
|
112
|
+
createdAt
|
|
113
|
+
contact {
|
|
114
|
+
id
|
|
115
|
+
name
|
|
116
|
+
email
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
# Every candidate in the workspace, filtered through `params.filters`:
|
|
126
|
+
# `poolIds` (in), `source` (in, GlobalIDs of the records they came through),
|
|
127
|
+
# `lastInteractionAt` (>=, <=, between).
|
|
128
|
+
query ListCandidates($first: Int, $after: String, $params: SearchParams) {
|
|
129
|
+
currentWorkspace {
|
|
130
|
+
candidates(first: $first, after: $after, params: $params) {
|
|
131
|
+
pageInfo {
|
|
132
|
+
hasNextPage
|
|
133
|
+
endCursor
|
|
134
|
+
}
|
|
135
|
+
edges {
|
|
136
|
+
node {
|
|
137
|
+
...CandidateSummary
|
|
138
|
+
fieldValuesByShortname
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
@@ -46,3 +46,49 @@ mutation CreateMeeting($input: CreateMeetingInput!) {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
+
|
|
50
|
+
query GetMeeting($id: ID!) {
|
|
51
|
+
currentWorkspace {
|
|
52
|
+
meeting(id: $id) {
|
|
53
|
+
...MeetingSummary
|
|
54
|
+
related(first: 50) {
|
|
55
|
+
edges {
|
|
56
|
+
node {
|
|
57
|
+
id
|
|
58
|
+
relatedTo {
|
|
59
|
+
__typename
|
|
60
|
+
... on Application {
|
|
61
|
+
id
|
|
62
|
+
}
|
|
63
|
+
... on Call {
|
|
64
|
+
id
|
|
65
|
+
name
|
|
66
|
+
}
|
|
67
|
+
... on Contact {
|
|
68
|
+
id
|
|
69
|
+
humanName
|
|
70
|
+
}
|
|
71
|
+
... on Employee {
|
|
72
|
+
id
|
|
73
|
+
humanName
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
mutation UpdateMeeting($input: UpdateMeetingInput!) {
|
|
84
|
+
updateMeeting(input: $input) {
|
|
85
|
+
meeting {
|
|
86
|
+
...MeetingSummary
|
|
87
|
+
}
|
|
88
|
+
errors {
|
|
89
|
+
key
|
|
90
|
+
name
|
|
91
|
+
type
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
# The
|
|
2
|
-
#
|
|
3
|
-
# is the GlobalID of any of the three.
|
|
1
|
+
# The reviews of one owner: the person reviewed (Employee or User) or the
|
|
2
|
+
# cycle they belong to. `ownerId` is the GlobalID of any of the three.
|
|
4
3
|
query ListReviews($ownerId: ID!, $first: Int, $after: String) {
|
|
5
4
|
node(id: $ownerId) {
|
|
6
5
|
__typename
|
|
@@ -46,10 +45,30 @@ query ListReviews($ownerId: ID!, $first: Int, $after: String) {
|
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
47
|
|
|
48
|
+
# Every review in the workspace, with or without a cycle, earliest due
|
|
49
|
+
# first, filtered through `params.filters`: `user` and `reviewTemplate`
|
|
50
|
+
# (GlobalIDs), `dueOn` and `completedAt` (>=, <=, between).
|
|
51
|
+
query ListWorkspaceReviews($first: Int, $after: String, $params: SearchParams) {
|
|
52
|
+
currentWorkspace {
|
|
53
|
+
reviews(first: $first, after: $after, params: $params) {
|
|
54
|
+
pageInfo {
|
|
55
|
+
hasNextPage
|
|
56
|
+
endCursor
|
|
57
|
+
}
|
|
58
|
+
edges {
|
|
59
|
+
node {
|
|
60
|
+
...ReviewSummary
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
49
67
|
query GetReview($id: ID!) {
|
|
50
68
|
currentWorkspace {
|
|
51
69
|
review(id: $id) {
|
|
52
70
|
...ReviewSummary
|
|
71
|
+
pdfUrl
|
|
53
72
|
}
|
|
54
73
|
}
|
|
55
74
|
}
|
package/src/recruiting.test.ts
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { describe, expect, it, vi } from 'vitest';
|
|
2
2
|
import { listCallStatuses } from './calls';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
createCandidate,
|
|
5
|
+
getCandidate,
|
|
6
|
+
getPool,
|
|
7
|
+
listCandidates,
|
|
8
|
+
} from './candidates';
|
|
4
9
|
import type { UiduClient } from './client';
|
|
10
|
+
import { CandidateSourceEnum } from './generated';
|
|
5
11
|
import {
|
|
6
12
|
type RecordFieldValue,
|
|
7
13
|
fieldValueAsOf,
|
|
8
14
|
getRecordFieldValues,
|
|
9
15
|
listFieldValueHistory,
|
|
10
16
|
} from './field-values';
|
|
17
|
+
import { getMeeting, updateMeeting } from './meetings';
|
|
11
18
|
import { createReview, listReviews } from './reviews';
|
|
12
19
|
|
|
13
20
|
const queryClient = (...pages: unknown[]) => {
|
|
@@ -61,6 +68,44 @@ describe('listReviews', () => {
|
|
|
61
68
|
]);
|
|
62
69
|
expect(await listReviews(client, { ownerId: 'x' })).toEqual([]);
|
|
63
70
|
});
|
|
71
|
+
|
|
72
|
+
it('reads the workspace connection when there is no owner', async () => {
|
|
73
|
+
const { client, query } = queryClient({
|
|
74
|
+
currentWorkspace: { reviews: conn([{ id: 'r3' }]) },
|
|
75
|
+
});
|
|
76
|
+
const params = {
|
|
77
|
+
filters: [
|
|
78
|
+
{
|
|
79
|
+
id: 'dueOn',
|
|
80
|
+
operator: 'between',
|
|
81
|
+
value: ['2026-11-10', '2026-11-25'],
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
};
|
|
85
|
+
expect(await listReviews(client, { params })).toEqual([{ id: 'r3' }]);
|
|
86
|
+
expect(query.mock.calls[0][1]).toEqual({ params });
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
describe('listCandidates', () => {
|
|
91
|
+
it('flattens the workspace connection, passing the filters through', async () => {
|
|
92
|
+
const { client, query } = queryClient({
|
|
93
|
+
currentWorkspace: { candidates: conn([{ id: 'c1' }, { id: 'c2' }]) },
|
|
94
|
+
});
|
|
95
|
+
const params = {
|
|
96
|
+
filters: [{ id: 'poolIds', operator: 'in', value: ['pool1'] }],
|
|
97
|
+
};
|
|
98
|
+
expect(await listCandidates(client, { params, first: 50 })).toEqual([
|
|
99
|
+
{ id: 'c1' },
|
|
100
|
+
{ id: 'c2' },
|
|
101
|
+
]);
|
|
102
|
+
expect(query.mock.calls[0][1]).toEqual({ params, first: 50 });
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('returns an empty list without a workspace', async () => {
|
|
106
|
+
const { client } = queryClient({ currentWorkspace: null });
|
|
107
|
+
expect(await listCandidates(client)).toEqual([]);
|
|
108
|
+
});
|
|
64
109
|
});
|
|
65
110
|
|
|
66
111
|
describe('createReview', () => {
|
|
@@ -194,3 +239,59 @@ describe('fieldValueAsOf', () => {
|
|
|
194
239
|
expect(fieldValueAsOf(history, '2023-12-31')).toBeNull();
|
|
195
240
|
});
|
|
196
241
|
});
|
|
242
|
+
|
|
243
|
+
describe('createCandidate', () => {
|
|
244
|
+
it('sends the attributes and returns the payload', async () => {
|
|
245
|
+
const payload = { createCandidate: { candidates: conn([]), errors: [] } };
|
|
246
|
+
const mutate = vi.fn().mockResolvedValue(payload);
|
|
247
|
+
const client = { mutate } as unknown as UiduClient;
|
|
248
|
+
const input = {
|
|
249
|
+
attributes: {
|
|
250
|
+
userId: 'u1',
|
|
251
|
+
sourceChannel: CandidateSourceEnum.Manual,
|
|
252
|
+
sourceId: 'org1',
|
|
253
|
+
},
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
expect(await createCandidate(client, { input })).toBe(
|
|
257
|
+
payload.createCandidate,
|
|
258
|
+
);
|
|
259
|
+
expect(mutate.mock.calls[0][1]).toEqual({ input });
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
describe('getPool', () => {
|
|
264
|
+
it('returns the pool, or null when there is none', async () => {
|
|
265
|
+
const pool = { id: 'p1', poolContacts: conn([{ id: 'pc1' }]) };
|
|
266
|
+
const { client } = queryClient(
|
|
267
|
+
{ currentWorkspace: { pool } },
|
|
268
|
+
{ currentWorkspace: { pool: null } },
|
|
269
|
+
);
|
|
270
|
+
expect(await getPool(client, { id: 'p1' })).toBe(pool);
|
|
271
|
+
expect(await getPool(client, { id: 'x' })).toBeNull();
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
describe('getMeeting', () => {
|
|
276
|
+
it('returns the meeting, or null when there is none', async () => {
|
|
277
|
+
const meeting = { id: 'm1', related: conn([]) };
|
|
278
|
+
const { client } = queryClient(
|
|
279
|
+
{ currentWorkspace: { meeting } },
|
|
280
|
+
{ currentWorkspace: null },
|
|
281
|
+
);
|
|
282
|
+
expect(await getMeeting(client, { id: 'm1' })).toBe(meeting);
|
|
283
|
+
expect(await getMeeting(client, { id: 'x' })).toBeNull();
|
|
284
|
+
});
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
describe('updateMeeting', () => {
|
|
288
|
+
it('returns null when the payload is missing', async () => {
|
|
289
|
+
const mutate = vi.fn().mockResolvedValue({ updateMeeting: null });
|
|
290
|
+
const client = { mutate } as unknown as UiduClient;
|
|
291
|
+
expect(
|
|
292
|
+
await updateMeeting(client, {
|
|
293
|
+
input: { id: 'm1', attributes: { name: 'Colloquio' } },
|
|
294
|
+
}),
|
|
295
|
+
).toBeNull();
|
|
296
|
+
});
|
|
297
|
+
});
|
package/src/reviews.ts
CHANGED
|
@@ -3,9 +3,12 @@ import {
|
|
|
3
3
|
CreateReviewsDocument,
|
|
4
4
|
type CreateReviewsMutationVariables,
|
|
5
5
|
GetReviewDocument,
|
|
6
|
+
type GetReviewQuery,
|
|
6
7
|
type GetReviewQueryVariables,
|
|
7
8
|
ListReviewsDocument,
|
|
8
9
|
type ListReviewsQueryVariables,
|
|
10
|
+
ListWorkspaceReviewsDocument,
|
|
11
|
+
type ListWorkspaceReviewsQueryVariables,
|
|
9
12
|
ListReviewTemplatesDocument,
|
|
10
13
|
type ListReviewTemplatesQuery,
|
|
11
14
|
type ListReviewTemplatesQueryVariables,
|
|
@@ -24,6 +27,9 @@ import { nodes } from './utils/relay';
|
|
|
24
27
|
// Reads and writes need an account (Bearer / apiKey), server-side.
|
|
25
28
|
|
|
26
29
|
export type Review = ReviewSummaryFragment;
|
|
30
|
+
export type ReviewDetail = NonNullable<
|
|
31
|
+
NonNullable<GetReviewQuery['currentWorkspace']>['review']
|
|
32
|
+
>;
|
|
27
33
|
export type ReviewTemplate = NonNullable<
|
|
28
34
|
NonNullable<
|
|
29
35
|
NonNullable<
|
|
@@ -35,14 +41,26 @@ export type ReviewTemplate = NonNullable<
|
|
|
35
41
|
>;
|
|
36
42
|
|
|
37
43
|
/**
|
|
38
|
-
*
|
|
39
|
-
* Employee, a User or a ReviewCycle —
|
|
40
|
-
*
|
|
44
|
+
* Reviews as a flat array; page with `first`/`after`. With `ownerId` — the
|
|
45
|
+
* GlobalID of an Employee, a User or a ReviewCycle — the reviews of that
|
|
46
|
+
* owner. Without it, every review in the workspace, with or without a cycle,
|
|
47
|
+
* earliest due first, filtered with `params.filters`: `user` and
|
|
48
|
+
* `reviewTemplate` (GlobalIDs), `dueOn` and `completedAt` (`>=`, `<=`,
|
|
49
|
+
* `between`).
|
|
41
50
|
*/
|
|
42
51
|
export async function listReviews(
|
|
43
52
|
client: UiduClient,
|
|
44
|
-
variables:
|
|
53
|
+
variables:
|
|
54
|
+
| ListReviewsQueryVariables
|
|
55
|
+
| ListWorkspaceReviewsQueryVariables = {},
|
|
45
56
|
): Promise<Review[]> {
|
|
57
|
+
if (!('ownerId' in variables) || !variables.ownerId) {
|
|
58
|
+
const result = await client.query(
|
|
59
|
+
ListWorkspaceReviewsDocument,
|
|
60
|
+
variables as ListWorkspaceReviewsQueryVariables,
|
|
61
|
+
);
|
|
62
|
+
return nodes(result.currentWorkspace?.reviews);
|
|
63
|
+
}
|
|
46
64
|
const result = await client.query(ListReviewsDocument, variables);
|
|
47
65
|
const node = result.node;
|
|
48
66
|
if (!node) return [];
|
|
@@ -58,11 +76,14 @@ export async function listReviews(
|
|
|
58
76
|
return [];
|
|
59
77
|
}
|
|
60
78
|
|
|
61
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* One review by id with `pdfUrl` — the review, its questions and answers
|
|
81
|
+
* printed to PDF — or null.
|
|
82
|
+
*/
|
|
62
83
|
export async function getReview(
|
|
63
84
|
client: UiduClient,
|
|
64
85
|
variables: GetReviewQueryVariables,
|
|
65
|
-
): Promise<
|
|
86
|
+
): Promise<ReviewDetail | null> {
|
|
66
87
|
const result = await client.query(GetReviewDocument, variables);
|
|
67
88
|
return result.currentWorkspace?.review ?? null;
|
|
68
89
|
}
|