@uidu/client 3.17.0 → 3.18.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 +26 -0
- package/dist/declarations/src/contacts.d.ts +22 -1
- package/dist/declarations/src/expenses.d.ts +169 -0
- package/dist/declarations/src/generated/index.d.ts +3878 -1658
- package/dist/declarations/src/index.d.ts +8 -6
- package/dist/declarations/src/mutations.d.ts +89 -1
- package/dist/declarations/src/people.d.ts +13 -1
- package/dist/uidu-client.cjs.dev.js +169 -1
- package/dist/uidu-client.cjs.prod.js +169 -1
- package/dist/uidu-client.esm.js +152 -2
- package/package.json +1 -1
- package/src/contacts.ts +33 -0
- package/src/expenses.test.ts +155 -0
- package/src/expenses.ts +155 -0
- package/src/generated/index.ts +3065 -1944
- package/src/index.ts +30 -2
- package/src/mutations.ts +48 -0
- package/src/people.ts +33 -0
- package/src/queries/contacts/GetOrganization.graphql +17 -0
- package/src/queries/contacts/ListOrganizations.graphql +21 -0
- package/src/queries/contacts/OrganizationMutations.graphql +17 -0
- package/src/queries/expenses/ExpenseFields.graphql +29 -0
- package/src/queries/expenses/ExpenseMutations.graphql +81 -0
- package/src/queries/expenses/GetExpenseReport.graphql +14 -0
- package/src/queries/expenses/ListAnalyticAccounts.graphql +20 -0
- package/src/queries/expenses/ListExpenseReports.graphql +22 -0
- package/src/queries/people/EmploymentVariationKindMutations.graphql +51 -0
- package/src/queries/people/ListEmploymentVariationKinds.graphql +23 -0
package/src/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ export {
|
|
|
11
11
|
} from './utils/fieldValues';
|
|
12
12
|
|
|
13
13
|
export {
|
|
14
|
+
ListAnalyticAccountsDocument,
|
|
14
15
|
ListApplicationsDocument,
|
|
15
16
|
ListBookingsDocument,
|
|
16
17
|
ListCalendarsDocument,
|
|
@@ -23,13 +24,16 @@ export {
|
|
|
23
24
|
ListDonationCampaignsDocument,
|
|
24
25
|
ListDonationsDocument,
|
|
25
26
|
ListEmployeesDocument,
|
|
27
|
+
ListEmploymentVariationKindsDocument,
|
|
26
28
|
ListEnrollmentsDocument,
|
|
27
29
|
ListEventsDocument,
|
|
30
|
+
ListExpenseReportsDocument,
|
|
28
31
|
ListFormsDocument,
|
|
29
32
|
ListGoalsDocument,
|
|
30
33
|
ListKbArticlesDocument,
|
|
31
34
|
ListKbCollectionsDocument,
|
|
32
35
|
ListLecturesDocument,
|
|
36
|
+
ListOrganizationsDocument,
|
|
33
37
|
ListPagesDocument,
|
|
34
38
|
ListStoriesDocument,
|
|
35
39
|
ListTimeframesDocument,
|
|
@@ -85,6 +89,7 @@ export {
|
|
|
85
89
|
deleteContact,
|
|
86
90
|
createDeal,
|
|
87
91
|
updateDeal,
|
|
92
|
+
createOrganization,
|
|
88
93
|
createKbCollection,
|
|
89
94
|
updateKbCollection,
|
|
90
95
|
deleteKbCollection,
|
|
@@ -115,6 +120,8 @@ export {
|
|
|
115
120
|
terminateEmployment,
|
|
116
121
|
createEmploymentTerm,
|
|
117
122
|
updateEmploymentTerm,
|
|
123
|
+
createEmploymentVariationKind,
|
|
124
|
+
updateEmploymentVariationKind,
|
|
118
125
|
createCompensation,
|
|
119
126
|
updateCompensation,
|
|
120
127
|
deleteCompensation,
|
|
@@ -184,6 +191,7 @@ export {
|
|
|
184
191
|
createCcnl,
|
|
185
192
|
listEmploymentHistory,
|
|
186
193
|
contractEvents,
|
|
194
|
+
listEmploymentVariationKinds,
|
|
187
195
|
} from './people';
|
|
188
196
|
export type {
|
|
189
197
|
Employee,
|
|
@@ -195,6 +203,7 @@ export type {
|
|
|
195
203
|
EmployeeContracts,
|
|
196
204
|
ContractEvent,
|
|
197
205
|
ContractEventType,
|
|
206
|
+
EmploymentVariationKind,
|
|
198
207
|
} from './people';
|
|
199
208
|
|
|
200
209
|
export {
|
|
@@ -222,8 +231,15 @@ export type { Course, Enrollment, Lecture } from './courses';
|
|
|
222
231
|
export { getCampaign, listCampaigns, listEmailCampaigns } from './campaigns';
|
|
223
232
|
export type { Campaign } from './campaigns';
|
|
224
233
|
|
|
225
|
-
export {
|
|
226
|
-
|
|
234
|
+
export {
|
|
235
|
+
getContact,
|
|
236
|
+
listContacts,
|
|
237
|
+
getDeal,
|
|
238
|
+
listDeals,
|
|
239
|
+
getOrganization,
|
|
240
|
+
listOrganizations,
|
|
241
|
+
} from './contacts';
|
|
242
|
+
export type { Contact, Deal, Organization } from './contacts';
|
|
227
243
|
export {
|
|
228
244
|
listGoals,
|
|
229
245
|
getGoal,
|
|
@@ -237,6 +253,18 @@ export {
|
|
|
237
253
|
} from './goals';
|
|
238
254
|
export type { Goal, Timeframe } from './goals';
|
|
239
255
|
|
|
256
|
+
export {
|
|
257
|
+
listExpenseReports,
|
|
258
|
+
getExpenseReport,
|
|
259
|
+
createExpenseReport,
|
|
260
|
+
updateExpenseReport,
|
|
261
|
+
createExpense,
|
|
262
|
+
updateExpense,
|
|
263
|
+
listAnalyticAccounts,
|
|
264
|
+
allocateExpense,
|
|
265
|
+
} from './expenses';
|
|
266
|
+
export type { ExpenseReport, Expense, AnalyticAccount } from './expenses';
|
|
267
|
+
|
|
240
268
|
export {
|
|
241
269
|
getKbArticle,
|
|
242
270
|
listKbArticles,
|
package/src/mutations.ts
CHANGED
|
@@ -25,12 +25,16 @@ import {
|
|
|
25
25
|
type CreateEmploymentMutationVariables,
|
|
26
26
|
CreateEmploymentTermDocument,
|
|
27
27
|
type CreateEmploymentTermMutationVariables,
|
|
28
|
+
CreateEmploymentVariationKindDocument,
|
|
29
|
+
type CreateEmploymentVariationKindMutationVariables,
|
|
28
30
|
CreateFormDocument,
|
|
29
31
|
type CreateFormMutationVariables,
|
|
30
32
|
CreateKbArticleDocument,
|
|
31
33
|
type CreateKbArticleMutationVariables,
|
|
32
34
|
CreateKbCollectionDocument,
|
|
33
35
|
type CreateKbCollectionMutationVariables,
|
|
36
|
+
CreateOrganizationDocument,
|
|
37
|
+
type CreateOrganizationMutationVariables,
|
|
34
38
|
CreateTimeClockDocument,
|
|
35
39
|
type CreateTimeClockMutationVariables,
|
|
36
40
|
DeleteChannelDocument,
|
|
@@ -75,6 +79,8 @@ import {
|
|
|
75
79
|
type UpdateEmploymentMutationVariables,
|
|
76
80
|
UpdateEmploymentTermDocument,
|
|
77
81
|
type UpdateEmploymentTermMutationVariables,
|
|
82
|
+
UpdateEmploymentVariationKindDocument,
|
|
83
|
+
type UpdateEmploymentVariationKindMutationVariables,
|
|
78
84
|
UpdateEventDocument,
|
|
79
85
|
type UpdateEventMutationVariables,
|
|
80
86
|
UpdateFormDocument,
|
|
@@ -168,6 +174,19 @@ export async function createDeal(c: UiduClient, v: CreateDealMutationVariables)
|
|
|
168
174
|
export async function updateDeal(c: UiduClient, v: UpdateDealMutationVariables) {
|
|
169
175
|
return (await c.mutate(UpdateDealDocument, v)).updateDeal ?? null;
|
|
170
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* Create an organization (company): `{ input: { attributes: { email,
|
|
179
|
+
* organizationAttributes: { name, … } } } }` — the CRM nests an organization's
|
|
180
|
+
* own fields under `attributes.organizationAttributes`, same as a person
|
|
181
|
+
* contact nests theirs under `attributes.userAttributes`. Returns the payload
|
|
182
|
+
* (with `errors`) or null.
|
|
183
|
+
*/
|
|
184
|
+
export async function createOrganization(
|
|
185
|
+
c: UiduClient,
|
|
186
|
+
v: CreateOrganizationMutationVariables,
|
|
187
|
+
) {
|
|
188
|
+
return (await c.mutate(CreateOrganizationDocument, v)).createOrganization ?? null;
|
|
189
|
+
}
|
|
171
190
|
|
|
172
191
|
// --- People / HR (employees & employments) ---
|
|
173
192
|
// An Employee is the HR record wrapping a workspace User (`userId`); an
|
|
@@ -269,6 +288,35 @@ export async function updateEmploymentTerm(
|
|
|
269
288
|
return (await c.mutate(UpdateEmploymentTermDocument, v)).updateEmploymentTerm ?? null;
|
|
270
289
|
}
|
|
271
290
|
|
|
291
|
+
/**
|
|
292
|
+
* Create an employment variation kind — a reusable reason for a contract
|
|
293
|
+
* change (`changesHours`, `changesPay`, `changesLevel`, …), picked by a
|
|
294
|
+
* contract variation's `employmentVariationKindId`. Returns the payload (with
|
|
295
|
+
* `errors`) or null. The new kind is at `employmentVariationKind.node`.
|
|
296
|
+
*/
|
|
297
|
+
export async function createEmploymentVariationKind(
|
|
298
|
+
c: UiduClient,
|
|
299
|
+
v: CreateEmploymentVariationKindMutationVariables,
|
|
300
|
+
) {
|
|
301
|
+
return (
|
|
302
|
+
(await c.mutate(CreateEmploymentVariationKindDocument, v)).createEmploymentVariationKind ??
|
|
303
|
+
null
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Update an employment variation kind: `{ input: { id, attributes } }`.
|
|
308
|
+
* Returns the payload (with `errors`) or null.
|
|
309
|
+
*/
|
|
310
|
+
export async function updateEmploymentVariationKind(
|
|
311
|
+
c: UiduClient,
|
|
312
|
+
v: UpdateEmploymentVariationKindMutationVariables,
|
|
313
|
+
) {
|
|
314
|
+
return (
|
|
315
|
+
(await c.mutate(UpdateEmploymentVariationKindDocument, v)).updateEmploymentVariationKind ??
|
|
316
|
+
null
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
|
|
272
320
|
// --- Time clocks (punches) ---
|
|
273
321
|
/**
|
|
274
322
|
* Record a time-clock punch (`beginsAt`, optional `finishesAt`, `resourceId`).
|
package/src/people.ts
CHANGED
|
@@ -12,6 +12,9 @@ import {
|
|
|
12
12
|
type ListEmployeesQueryVariables,
|
|
13
13
|
ListEmploymentHistoryDocument,
|
|
14
14
|
type ListEmploymentHistoryQueryVariables,
|
|
15
|
+
ListEmploymentVariationKindsDocument,
|
|
16
|
+
type ListEmploymentVariationKindsQuery,
|
|
17
|
+
type ListEmploymentVariationKindsQueryVariables,
|
|
15
18
|
ListKindsDocument,
|
|
16
19
|
type ListKindsQuery,
|
|
17
20
|
type ListKindsQueryVariables,
|
|
@@ -44,6 +47,23 @@ export type Office = NonNullable<
|
|
|
44
47
|
>[number]
|
|
45
48
|
>['node']
|
|
46
49
|
>;
|
|
50
|
+
/**
|
|
51
|
+
* A contract-variation reason (hours change, conversion to open-ended, a pay
|
|
52
|
+
* rise…) configured for the workspace — an employment's `varyAttributes` picks
|
|
53
|
+
* one by `employmentVariationKindId`.
|
|
54
|
+
*/
|
|
55
|
+
export type EmploymentVariationKind = NonNullable<
|
|
56
|
+
NonNullable<
|
|
57
|
+
NonNullable<
|
|
58
|
+
NonNullable<
|
|
59
|
+
NonNullable<
|
|
60
|
+
ListEmploymentVariationKindsQuery['currentWorkspace']
|
|
61
|
+
>['employmentVariationKinds']
|
|
62
|
+
>['edges']
|
|
63
|
+
>[number]
|
|
64
|
+
>['node']
|
|
65
|
+
>;
|
|
66
|
+
|
|
47
67
|
/** A `Kind` record — CCNLs (national collective labor contracts) are Kinds. */
|
|
48
68
|
export type Kind = NonNullable<
|
|
49
69
|
NonNullable<
|
|
@@ -127,6 +147,19 @@ export async function listRoles(
|
|
|
127
147
|
return circles.filter((c) => c.kind === 'role');
|
|
128
148
|
}
|
|
129
149
|
|
|
150
|
+
/**
|
|
151
|
+
* List the workspace's employment variation kinds — the reasons a contract
|
|
152
|
+
* can change (hours, pay, level, place, benefits…), each flagging which
|
|
153
|
+
* aspects it touches. Used for a contract variation's `employmentVariationKindId`.
|
|
154
|
+
*/
|
|
155
|
+
export async function listEmploymentVariationKinds(
|
|
156
|
+
client: UiduClient,
|
|
157
|
+
variables: ListEmploymentVariationKindsQueryVariables = {},
|
|
158
|
+
): Promise<EmploymentVariationKind[]> {
|
|
159
|
+
const result = await client.query(ListEmploymentVariationKindsDocument, variables);
|
|
160
|
+
return nodes(result.currentWorkspace?.employmentVariationKinds);
|
|
161
|
+
}
|
|
162
|
+
|
|
130
163
|
/** List `Kind` records for the given polymorphic models. */
|
|
131
164
|
export async function listKinds(
|
|
132
165
|
client: UiduClient,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
query ListOrganizations($first: Int, $after: String, $params: SearchParams) {
|
|
2
|
+
currentWorkspace {
|
|
3
|
+
organizations(first: $first, after: $after, params: $params) {
|
|
4
|
+
pageInfo {
|
|
5
|
+
hasNextPage
|
|
6
|
+
endCursor
|
|
7
|
+
}
|
|
8
|
+
edges {
|
|
9
|
+
node {
|
|
10
|
+
id
|
|
11
|
+
name
|
|
12
|
+
email
|
|
13
|
+
avatar
|
|
14
|
+
fiscalCode
|
|
15
|
+
vatCode
|
|
16
|
+
createdAt
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# `amount` is in cents of `currency`. `category` is the integer the workspace's
|
|
2
|
+
# expense categories are keyed on. `fieldValuesByShortname` carries the custom
|
|
3
|
+
# fields the workspace added to expenses: `{ shortname: value }`.
|
|
4
|
+
fragment ExpenseFields on Expense {
|
|
5
|
+
id
|
|
6
|
+
amount
|
|
7
|
+
currency
|
|
8
|
+
spentAt
|
|
9
|
+
category
|
|
10
|
+
paymentMethod
|
|
11
|
+
fieldValuesByShortname
|
|
12
|
+
createdAt
|
|
13
|
+
updatedAt
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
# The report is addressed to a `user` (the person it reimburses); `contact` is
|
|
17
|
+
# derived from it inside uidu and not asked for here.
|
|
18
|
+
fragment ExpenseReportFields on ExpenseReport {
|
|
19
|
+
id
|
|
20
|
+
name
|
|
21
|
+
paidAt
|
|
22
|
+
fieldValuesByShortname
|
|
23
|
+
createdAt
|
|
24
|
+
updatedAt
|
|
25
|
+
user {
|
|
26
|
+
id
|
|
27
|
+
name
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
mutation CreateExpenseReport($input: CreateExpenseReportInput!) {
|
|
2
|
+
createExpenseReport(input: $input) {
|
|
3
|
+
expenseReport {
|
|
4
|
+
node {
|
|
5
|
+
...ExpenseReportFields
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
errors {
|
|
9
|
+
key
|
|
10
|
+
name
|
|
11
|
+
type
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
mutation UpdateExpenseReport($input: UpdateExpenseReportInput!) {
|
|
17
|
+
updateExpenseReport(input: $input) {
|
|
18
|
+
expenseReport {
|
|
19
|
+
...ExpenseReportFields
|
|
20
|
+
}
|
|
21
|
+
errors {
|
|
22
|
+
key
|
|
23
|
+
name
|
|
24
|
+
type
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
mutation CreateExpense($input: CreateExpenseInput!) {
|
|
30
|
+
createExpense(input: $input) {
|
|
31
|
+
expense {
|
|
32
|
+
node {
|
|
33
|
+
...ExpenseFields
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
errors {
|
|
37
|
+
key
|
|
38
|
+
name
|
|
39
|
+
type
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
mutation UpdateExpense($input: UpdateExpenseInput!) {
|
|
45
|
+
updateExpense(input: $input) {
|
|
46
|
+
expense {
|
|
47
|
+
...ExpenseFields
|
|
48
|
+
}
|
|
49
|
+
errors {
|
|
50
|
+
key
|
|
51
|
+
name
|
|
52
|
+
type
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
mutation CreateAnalyticAccountAllocation(
|
|
58
|
+
$input: CreateAnalyticAccountAllocationInput!
|
|
59
|
+
) {
|
|
60
|
+
createAnalyticAccountAllocation(input: $input) {
|
|
61
|
+
analyticAccountAllocation {
|
|
62
|
+
node {
|
|
63
|
+
id
|
|
64
|
+
amount
|
|
65
|
+
currency
|
|
66
|
+
kind
|
|
67
|
+
note
|
|
68
|
+
analyticAccount {
|
|
69
|
+
id
|
|
70
|
+
code
|
|
71
|
+
name
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
errors {
|
|
76
|
+
key
|
|
77
|
+
name
|
|
78
|
+
type
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# The analytic accounts (commesse, cost centres) an expense can be allocated to.
|
|
2
|
+
query ListAnalyticAccounts($first: Int, $after: String, $parentId: ID) {
|
|
3
|
+
currentWorkspace {
|
|
4
|
+
analyticAccounts(first: $first, after: $after, parentId: $parentId) {
|
|
5
|
+
pageInfo {
|
|
6
|
+
hasNextPage
|
|
7
|
+
endCursor
|
|
8
|
+
}
|
|
9
|
+
edges {
|
|
10
|
+
node {
|
|
11
|
+
id
|
|
12
|
+
code
|
|
13
|
+
name
|
|
14
|
+
status
|
|
15
|
+
currency
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
query ListExpenseReports($first: Int, $after: String) {
|
|
2
|
+
currentWorkspace {
|
|
3
|
+
expenseReports(first: $first, after: $after) {
|
|
4
|
+
pageInfo {
|
|
5
|
+
hasNextPage
|
|
6
|
+
endCursor
|
|
7
|
+
}
|
|
8
|
+
edges {
|
|
9
|
+
node {
|
|
10
|
+
...ExpenseReportFields
|
|
11
|
+
expenses {
|
|
12
|
+
edges {
|
|
13
|
+
node {
|
|
14
|
+
...ExpenseFields
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
mutation CreateEmploymentVariationKind($input: CreateEmploymentVariationKindInput!) {
|
|
2
|
+
createEmploymentVariationKind(input: $input) {
|
|
3
|
+
employmentVariationKind {
|
|
4
|
+
node {
|
|
5
|
+
id
|
|
6
|
+
name
|
|
7
|
+
description
|
|
8
|
+
shortname
|
|
9
|
+
color
|
|
10
|
+
position
|
|
11
|
+
changesContract
|
|
12
|
+
changesHours
|
|
13
|
+
changesLevel
|
|
14
|
+
changesPlace
|
|
15
|
+
changesPay
|
|
16
|
+
changesBenefits
|
|
17
|
+
requiresUnilav
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
errors {
|
|
21
|
+
key
|
|
22
|
+
name
|
|
23
|
+
type
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
mutation UpdateEmploymentVariationKind($input: UpdateEmploymentVariationKindInput!) {
|
|
29
|
+
updateEmploymentVariationKind(input: $input) {
|
|
30
|
+
employmentVariationKind {
|
|
31
|
+
id
|
|
32
|
+
name
|
|
33
|
+
description
|
|
34
|
+
shortname
|
|
35
|
+
color
|
|
36
|
+
position
|
|
37
|
+
changesContract
|
|
38
|
+
changesHours
|
|
39
|
+
changesLevel
|
|
40
|
+
changesPlace
|
|
41
|
+
changesPay
|
|
42
|
+
changesBenefits
|
|
43
|
+
requiresUnilav
|
|
44
|
+
}
|
|
45
|
+
errors {
|
|
46
|
+
key
|
|
47
|
+
name
|
|
48
|
+
type
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
query ListEmploymentVariationKinds($first: Int, $after: String) {
|
|
2
|
+
currentWorkspace {
|
|
3
|
+
employmentVariationKinds(first: $first, after: $after) {
|
|
4
|
+
edges {
|
|
5
|
+
node {
|
|
6
|
+
id
|
|
7
|
+
name
|
|
8
|
+
description
|
|
9
|
+
shortname
|
|
10
|
+
color
|
|
11
|
+
position
|
|
12
|
+
changesContract
|
|
13
|
+
changesHours
|
|
14
|
+
changesLevel
|
|
15
|
+
changesPlace
|
|
16
|
+
changesPay
|
|
17
|
+
changesBenefits
|
|
18
|
+
requiresUnilav
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|