@uidu/client 3.5.0 → 3.7.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.
@@ -3,7 +3,10 @@ import {
3
3
  GetChannelDocument,
4
4
  type GetChannelQuery,
5
5
  type GetChannelQueryVariables,
6
+ ListChannelsDocument,
7
+ type ListChannelsQueryVariables,
6
8
  } from './generated';
9
+ import { nodes } from './utils/relay';
7
10
 
8
11
  export type Channel = NonNullable<
9
12
  NonNullable<GetChannelQuery['currentWorkspace']>['channel']
@@ -16,3 +19,16 @@ export async function getChannel(
16
19
  const result = await client.query(GetChannelDocument, variables);
17
20
  return result.currentWorkspace?.channel ?? null;
18
21
  }
22
+
23
+ /**
24
+ * The workspace's help center channels. `isDefault` marks the one the
25
+ * workspace treats as its main channel — a caller that has no channel id
26
+ * configured should prefer it over the first row.
27
+ */
28
+ export async function listChannels(
29
+ client: UiduClient,
30
+ variables: ListChannelsQueryVariables = {},
31
+ ) {
32
+ const result = await client.query(ListChannelsDocument, variables);
33
+ return nodes(result.currentWorkspace?.channels);
34
+ }
package/src/index.ts CHANGED
@@ -40,6 +40,7 @@ export {
40
40
  createPage,
41
41
  createPageBlock,
42
42
  createFieldValue,
43
+ listProjects,
43
44
  } from './cms';
44
45
  export type { Page, Template } from './cms';
45
46
 
@@ -98,7 +99,7 @@ export {
98
99
  } from './forms';
99
100
  export type { Form } from './forms';
100
101
 
101
- export { getChannel } from './help-center';
102
+ export { getChannel, listChannels } from './help-center';
102
103
  export type { Channel } from './help-center';
103
104
 
104
105
  export { search } from './search';
@@ -81,6 +81,7 @@ describe('contractEvents', () => {
81
81
  endDate: '2025-03-31',
82
82
  endReason: 'contract_end',
83
83
  jobTitle: 'Senior Dev',
84
+ employmentKind: { id: 'ek1', name: 'determinato' },
84
85
  contractType: 'determinato',
85
86
  ccnl: null,
86
87
  compensations: [],
@@ -91,6 +92,7 @@ describe('contractEvents', () => {
91
92
  endDate: null,
92
93
  endReason: null,
93
94
  jobTitle: 'Dev',
95
+ employmentKind: { id: 'ek2', name: 'indeterminato' },
94
96
  contractType: 'indeterminato',
95
97
  ccnl: null,
96
98
  compensations: [],
@@ -107,6 +109,7 @@ describe('contractEvents', () => {
107
109
  endDate: null,
108
110
  endReason: null,
109
111
  jobTitle: null,
112
+ employmentKind: null,
110
113
  contractType: null,
111
114
  ccnl: null,
112
115
  compensations: [],
package/src/people.ts CHANGED
@@ -158,6 +158,14 @@ export type EmploymentRecord = {
158
158
  endDate: string | null;
159
159
  endReason: string | null;
160
160
  jobTitle: string | null;
161
+ /**
162
+ * The contract type, as a record. It used to be a free string on the
163
+ * employment (`contractType`); uidu promoted it to `EmploymentKind` so a
164
+ * workspace can configure its own, which is why writes take
165
+ * `employmentKindId`.
166
+ */
167
+ employmentKind: { id: string; name: string | null } | null;
168
+ /** The contract type's name — `employmentKind.name`, kept flat for display. */
161
169
  contractType: string | null;
162
170
  /** The CCNL (national collective labor contract) that applies, if any. */
163
171
  ccnl: { id: string; name: string | null } | null;
@@ -194,7 +202,10 @@ export async function listEmploymentHistory(
194
202
  endDate: e.endDate ?? null,
195
203
  endReason: e.endReason ?? null,
196
204
  jobTitle: e.jobTitle ?? null,
197
- contractType: e.contractType ?? null,
205
+ employmentKind: e.employmentKind
206
+ ? { id: e.employmentKind.id ?? '', name: e.employmentKind.name ?? null }
207
+ : null,
208
+ contractType: e.employmentKind?.name ?? null,
198
209
  ccnl: e.ccnl ? { id: e.ccnl.id ?? '', name: e.ccnl.name ?? null } : null,
199
210
  compensations: nodes(e.compensations)
200
211
  .map((c) => ({
@@ -0,0 +1,17 @@
1
+ query ListProjects($first: Int, $after: String) {
2
+ currentWorkspace {
3
+ projects(first: $first, after: $after) {
4
+ pageInfo {
5
+ hasNextPage
6
+ endCursor
7
+ }
8
+ edges {
9
+ node {
10
+ id
11
+ name
12
+ slug
13
+ }
14
+ }
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,17 @@
1
+ query ListChannels($first: Int, $after: String) {
2
+ currentWorkspace {
3
+ channels(first: $first, after: $after) {
4
+ pageInfo {
5
+ hasNextPage
6
+ endCursor
7
+ }
8
+ edges {
9
+ node {
10
+ id
11
+ name
12
+ isDefault
13
+ }
14
+ }
15
+ }
16
+ }
17
+ }
@@ -13,7 +13,10 @@ query GetEmployee($id: ID!, $weekStartingAt: ISO8601Date!) {
13
13
  currentEmployment {
14
14
  id
15
15
  jobTitle
16
- contractType
16
+ employmentKind {
17
+ id
18
+ name
19
+ }
17
20
  contractLevel
18
21
  classification
19
22
  isActive
@@ -19,7 +19,10 @@ query ListEmployees($first: Int, $after: String) {
19
19
  currentEmployment {
20
20
  id
21
21
  jobTitle
22
- contractType
22
+ employmentKind {
23
+ id
24
+ name
25
+ }
23
26
  isActive
24
27
  startDate
25
28
  }
@@ -25,7 +25,10 @@ query ListEmploymentHistory(
25
25
  endDate
26
26
  endReason
27
27
  jobTitle
28
- contractType
28
+ employmentKind {
29
+ id
30
+ name
31
+ }
29
32
  ccnl {
30
33
  id
31
34
  name
@@ -39,7 +39,10 @@ mutation CreateEmployment($input: CreateEmploymentInput!) {
39
39
  node {
40
40
  id
41
41
  jobTitle
42
- contractType
42
+ employmentKind {
43
+ id
44
+ name
45
+ }
43
46
  classification
44
47
  startDate
45
48
  endDate
@@ -59,7 +62,10 @@ mutation UpdateEmployment($input: UpdateEmploymentInput!) {
59
62
  employment {
60
63
  id
61
64
  jobTitle
62
- contractType
65
+ employmentKind {
66
+ id
67
+ name
68
+ }
63
69
  classification
64
70
  startDate
65
71
  endDate