@uidu/client 3.20.0 → 3.22.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 +13 -0
- package/dist/declarations/src/candidates.d.ts +186 -7
- package/dist/declarations/src/generated/index.d.ts +757 -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 +107 -11
- package/dist/uidu-client.cjs.prod.js +107 -11
- package/dist/uidu-client.esm.js +101 -12
- package/package.json +1 -1
- package/src/candidates.ts +105 -5
- package/src/generated/index.ts +296 -37
- package/src/index.ts +16 -3
- package/src/meetings.ts +35 -0
- package/src/queries/candidates/CandidateFields.graphql +19 -1
- package/src/queries/candidates/CandidateMutations.graphql +41 -9
- package/src/queries/candidates/CandidateQueries.graphql +46 -3
- package/src/queries/candidates/PoolContactFields.graphql +29 -0
- package/src/queries/meetings/MeetingQueries.graphql +46 -0
- package/src/queries/reviews/ReviewQueries.graphql +22 -3
- package/src/recruiting.test.ts +143 -1
- package/src/reviews.ts +27 -6
package/src/index.ts
CHANGED
|
@@ -177,16 +177,24 @@ 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
|
+
updatePoolContact,
|
|
188
|
+
deletePoolContact,
|
|
184
189
|
} from './candidates';
|
|
185
190
|
export type {
|
|
186
191
|
Candidate,
|
|
187
192
|
CandidateDetail,
|
|
193
|
+
CandidateListItem,
|
|
188
194
|
CandidateSearch,
|
|
189
195
|
Pool,
|
|
196
|
+
PoolContact,
|
|
197
|
+
PoolDetail,
|
|
190
198
|
} from './candidates';
|
|
191
199
|
|
|
192
200
|
export {
|
|
@@ -197,10 +205,15 @@ export {
|
|
|
197
205
|
updateReview,
|
|
198
206
|
listReviewTemplates,
|
|
199
207
|
} from './reviews';
|
|
200
|
-
export type { Review, ReviewTemplate } from './reviews';
|
|
208
|
+
export type { Review, ReviewDetail, ReviewTemplate } from './reviews';
|
|
201
209
|
|
|
202
|
-
export {
|
|
203
|
-
|
|
210
|
+
export {
|
|
211
|
+
listMeetings,
|
|
212
|
+
getMeeting,
|
|
213
|
+
createMeeting,
|
|
214
|
+
updateMeeting,
|
|
215
|
+
} from './meetings';
|
|
216
|
+
export type { Meeting, MeetingDetail } from './meetings';
|
|
204
217
|
|
|
205
218
|
export { listSkills, createSkill } from './skills';
|
|
206
219
|
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 {
|
|
@@ -15,15 +32,7 @@ mutation CreatePoolContact($input: CreatePoolContactInput!) {
|
|
|
15
32
|
createPoolContact(input: $input) {
|
|
16
33
|
poolContact {
|
|
17
34
|
node {
|
|
18
|
-
|
|
19
|
-
pool {
|
|
20
|
-
id
|
|
21
|
-
name
|
|
22
|
-
}
|
|
23
|
-
contact {
|
|
24
|
-
id
|
|
25
|
-
name
|
|
26
|
-
}
|
|
35
|
+
...PoolContactSummary
|
|
27
36
|
}
|
|
28
37
|
}
|
|
29
38
|
errors {
|
|
@@ -33,3 +42,26 @@ mutation CreatePoolContact($input: CreatePoolContactInput!) {
|
|
|
33
42
|
}
|
|
34
43
|
}
|
|
35
44
|
}
|
|
45
|
+
|
|
46
|
+
mutation UpdatePoolContact($input: UpdatePoolContactInput!) {
|
|
47
|
+
updatePoolContact(input: $input) {
|
|
48
|
+
poolContact {
|
|
49
|
+
...PoolContactSummary
|
|
50
|
+
}
|
|
51
|
+
errors {
|
|
52
|
+
key
|
|
53
|
+
name
|
|
54
|
+
type
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
mutation DeletePoolContact($input: DeletePoolContactInput!) {
|
|
60
|
+
deletePoolContact(input: $input) {
|
|
61
|
+
errors {
|
|
62
|
+
key
|
|
63
|
+
name
|
|
64
|
+
type
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -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,46 @@ 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
|
+
...PoolContactSummary
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
# Every candidate in the workspace, filtered through `params.filters`:
|
|
120
|
+
# `poolIds` (in), `source` (in, GlobalIDs of the records they came through),
|
|
121
|
+
# `lastInteractionAt` (>=, <=, between).
|
|
122
|
+
query ListCandidates($first: Int, $after: String, $params: SearchParams) {
|
|
123
|
+
currentWorkspace {
|
|
124
|
+
candidates(first: $first, after: $after, params: $params) {
|
|
125
|
+
pageInfo {
|
|
126
|
+
hasNextPage
|
|
127
|
+
endCursor
|
|
128
|
+
}
|
|
129
|
+
edges {
|
|
130
|
+
node {
|
|
131
|
+
...CandidateSummary
|
|
132
|
+
fieldValuesByShortname
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# One entry in a talent pool, which is one referral: who sent the person
|
|
2
|
+
# (`source`, a referring Organization or the User who pointed them out), the
|
|
3
|
+
# channel and the day.
|
|
4
|
+
fragment PoolContactSummary on PoolContact {
|
|
5
|
+
id
|
|
6
|
+
createdAt
|
|
7
|
+
sourceChannel
|
|
8
|
+
referredOn
|
|
9
|
+
source {
|
|
10
|
+
__typename
|
|
11
|
+
... on Organization {
|
|
12
|
+
id
|
|
13
|
+
name
|
|
14
|
+
}
|
|
15
|
+
... on User {
|
|
16
|
+
id
|
|
17
|
+
name
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
pool {
|
|
21
|
+
id
|
|
22
|
+
name
|
|
23
|
+
}
|
|
24
|
+
contact {
|
|
25
|
+
id
|
|
26
|
+
name
|
|
27
|
+
email
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -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,22 @@
|
|
|
1
1
|
import { describe, expect, it, vi } from 'vitest';
|
|
2
2
|
import { listCallStatuses } from './calls';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
createCandidate,
|
|
5
|
+
createPoolContact,
|
|
6
|
+
getCandidate,
|
|
7
|
+
getPool,
|
|
8
|
+
listCandidates,
|
|
9
|
+
updatePoolContact,
|
|
10
|
+
} from './candidates';
|
|
4
11
|
import type { UiduClient } from './client';
|
|
12
|
+
import { CandidateSourceEnum } from './generated';
|
|
5
13
|
import {
|
|
6
14
|
type RecordFieldValue,
|
|
7
15
|
fieldValueAsOf,
|
|
8
16
|
getRecordFieldValues,
|
|
9
17
|
listFieldValueHistory,
|
|
10
18
|
} from './field-values';
|
|
19
|
+
import { getMeeting, updateMeeting } from './meetings';
|
|
11
20
|
import { createReview, listReviews } from './reviews';
|
|
12
21
|
|
|
13
22
|
const queryClient = (...pages: unknown[]) => {
|
|
@@ -61,6 +70,44 @@ describe('listReviews', () => {
|
|
|
61
70
|
]);
|
|
62
71
|
expect(await listReviews(client, { ownerId: 'x' })).toEqual([]);
|
|
63
72
|
});
|
|
73
|
+
|
|
74
|
+
it('reads the workspace connection when there is no owner', async () => {
|
|
75
|
+
const { client, query } = queryClient({
|
|
76
|
+
currentWorkspace: { reviews: conn([{ id: 'r3' }]) },
|
|
77
|
+
});
|
|
78
|
+
const params = {
|
|
79
|
+
filters: [
|
|
80
|
+
{
|
|
81
|
+
id: 'dueOn',
|
|
82
|
+
operator: 'between',
|
|
83
|
+
value: ['2026-11-10', '2026-11-25'],
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
};
|
|
87
|
+
expect(await listReviews(client, { params })).toEqual([{ id: 'r3' }]);
|
|
88
|
+
expect(query.mock.calls[0][1]).toEqual({ params });
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
describe('listCandidates', () => {
|
|
93
|
+
it('flattens the workspace connection, passing the filters through', async () => {
|
|
94
|
+
const { client, query } = queryClient({
|
|
95
|
+
currentWorkspace: { candidates: conn([{ id: 'c1' }, { id: 'c2' }]) },
|
|
96
|
+
});
|
|
97
|
+
const params = {
|
|
98
|
+
filters: [{ id: 'poolIds', operator: 'in', value: ['pool1'] }],
|
|
99
|
+
};
|
|
100
|
+
expect(await listCandidates(client, { params, first: 50 })).toEqual([
|
|
101
|
+
{ id: 'c1' },
|
|
102
|
+
{ id: 'c2' },
|
|
103
|
+
]);
|
|
104
|
+
expect(query.mock.calls[0][1]).toEqual({ params, first: 50 });
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('returns an empty list without a workspace', async () => {
|
|
108
|
+
const { client } = queryClient({ currentWorkspace: null });
|
|
109
|
+
expect(await listCandidates(client)).toEqual([]);
|
|
110
|
+
});
|
|
64
111
|
});
|
|
65
112
|
|
|
66
113
|
describe('createReview', () => {
|
|
@@ -194,3 +241,98 @@ describe('fieldValueAsOf', () => {
|
|
|
194
241
|
expect(fieldValueAsOf(history, '2023-12-31')).toBeNull();
|
|
195
242
|
});
|
|
196
243
|
});
|
|
244
|
+
|
|
245
|
+
describe('createCandidate', () => {
|
|
246
|
+
it('sends the attributes and returns the payload', async () => {
|
|
247
|
+
const payload = { createCandidate: { candidates: conn([]), errors: [] } };
|
|
248
|
+
const mutate = vi.fn().mockResolvedValue(payload);
|
|
249
|
+
const client = { mutate } as unknown as UiduClient;
|
|
250
|
+
const input = {
|
|
251
|
+
attributes: {
|
|
252
|
+
userId: 'u1',
|
|
253
|
+
sourceChannel: CandidateSourceEnum.Manual,
|
|
254
|
+
sourceId: 'org1',
|
|
255
|
+
},
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
expect(await createCandidate(client, { input })).toBe(
|
|
259
|
+
payload.createCandidate,
|
|
260
|
+
);
|
|
261
|
+
expect(mutate.mock.calls[0][1]).toEqual({ input });
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
describe('getPool', () => {
|
|
266
|
+
it('returns the pool, or null when there is none', async () => {
|
|
267
|
+
const pool = { id: 'p1', poolContacts: conn([{ id: 'pc1' }]) };
|
|
268
|
+
const { client } = queryClient(
|
|
269
|
+
{ currentWorkspace: { pool } },
|
|
270
|
+
{ currentWorkspace: { pool: null } },
|
|
271
|
+
);
|
|
272
|
+
expect(await getPool(client, { id: 'p1' })).toBe(pool);
|
|
273
|
+
expect(await getPool(client, { id: 'x' })).toBeNull();
|
|
274
|
+
});
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
describe('getMeeting', () => {
|
|
278
|
+
it('returns the meeting, or null when there is none', async () => {
|
|
279
|
+
const meeting = { id: 'm1', related: conn([]) };
|
|
280
|
+
const { client } = queryClient(
|
|
281
|
+
{ currentWorkspace: { meeting } },
|
|
282
|
+
{ currentWorkspace: null },
|
|
283
|
+
);
|
|
284
|
+
expect(await getMeeting(client, { id: 'm1' })).toBe(meeting);
|
|
285
|
+
expect(await getMeeting(client, { id: 'x' })).toBeNull();
|
|
286
|
+
});
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
describe('updateMeeting', () => {
|
|
290
|
+
it('returns null when the payload is missing', async () => {
|
|
291
|
+
const mutate = vi.fn().mockResolvedValue({ updateMeeting: null });
|
|
292
|
+
const client = { mutate } as unknown as UiduClient;
|
|
293
|
+
expect(
|
|
294
|
+
await updateMeeting(client, {
|
|
295
|
+
input: { id: 'm1', attributes: { name: 'Colloquio' } },
|
|
296
|
+
}),
|
|
297
|
+
).toBeNull();
|
|
298
|
+
});
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
describe('pool contacts', () => {
|
|
302
|
+
it('refers a contact to a pool with who sent them, and corrects the referral', async () => {
|
|
303
|
+
const referral = {
|
|
304
|
+
id: 'pc1',
|
|
305
|
+
sourceChannel: 'ente',
|
|
306
|
+
referredOn: '2024-05-02',
|
|
307
|
+
source: { __typename: 'Organization', id: 'o1', name: 'SIL Bergamo' },
|
|
308
|
+
};
|
|
309
|
+
const mutate = vi
|
|
310
|
+
.fn()
|
|
311
|
+
.mockResolvedValueOnce({
|
|
312
|
+
createPoolContact: { poolContact: { node: referral }, errors: [] },
|
|
313
|
+
})
|
|
314
|
+
.mockResolvedValueOnce({
|
|
315
|
+
updatePoolContact: {
|
|
316
|
+
poolContact: { ...referral, sourceChannel: 'passaparola' },
|
|
317
|
+
errors: [],
|
|
318
|
+
},
|
|
319
|
+
});
|
|
320
|
+
const client = { mutate } as unknown as UiduClient;
|
|
321
|
+
|
|
322
|
+
const attributes = {
|
|
323
|
+
poolId: 'p1',
|
|
324
|
+
contactId: 'c1',
|
|
325
|
+
sourceId: 'o1',
|
|
326
|
+
sourceChannel: 'ente',
|
|
327
|
+
referredOn: '2024-05-02',
|
|
328
|
+
};
|
|
329
|
+
const created = await createPoolContact(client, { input: { attributes } });
|
|
330
|
+
expect(created?.poolContact?.node).toBe(referral);
|
|
331
|
+
expect(mutate.mock.calls[0][1]).toEqual({ input: { attributes } });
|
|
332
|
+
|
|
333
|
+
const updated = await updatePoolContact(client, {
|
|
334
|
+
input: { id: 'pc1', attributes: { sourceChannel: 'passaparola' } },
|
|
335
|
+
});
|
|
336
|
+
expect(updated?.poolContact?.sourceChannel).toBe('passaparola');
|
|
337
|
+
});
|
|
338
|
+
});
|
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
|
}
|