@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @uidu/client
|
|
2
2
|
|
|
3
|
+
## 3.18.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 461a151: Expense reports. `@uidu/client` adds `listExpenseReports` and
|
|
8
|
+
`getExpenseReport` (each report with its person — `user { id name }` —,
|
|
9
|
+
`paidAt`, custom fields as `fieldValuesByShortname`, and its `expenses` as a
|
|
10
|
+
flat array), `createExpenseReport` / `updateExpenseReport` (addressed by
|
|
11
|
+
`userId`) and `createExpense` / `updateExpense`, both taking custom fields as
|
|
12
|
+
`fieldValues`, a map of the Field's GlobalID to the value. `listAnalyticAccounts`
|
|
13
|
+
and `allocateExpense` book an expense on an analytic account (commessa). Reads
|
|
14
|
+
and writes need an account Bearer token.
|
|
15
|
+
- b26a635: CRM organizations (companies). `@uidu/client` adds `getOrganization`,
|
|
16
|
+
`listOrganizations` and `createOrganization` — an organization is the
|
|
17
|
+
contactable a `Contact` wraps, so its own fields (`name`, `vatCode`,
|
|
18
|
+
`fiscalCode`…) nest under `attributes.organizationAttributes`, same shape as a
|
|
19
|
+
person contact's `userAttributes`. The CLI gets an `organizations` resource
|
|
20
|
+
(`list` / `get` / `create` — no `update`/`delete` yet, the backend doesn't
|
|
21
|
+
flag them as tool keys).
|
|
22
|
+
- a65aac7: Employment variation kinds — the reusable reasons a contract can change
|
|
23
|
+
(hours, pay, level, place, contract, benefits…), picked by a variation's
|
|
24
|
+
`employmentVariationKindId`. `@uidu/client` adds
|
|
25
|
+
`listEmploymentVariationKinds`, `createEmploymentVariationKind` and
|
|
26
|
+
`updateEmploymentVariationKind`. The CLI gets an `employment-variation-kinds`
|
|
27
|
+
resource (`list` / `create` / `update`).
|
|
28
|
+
|
|
3
29
|
## 3.17.0
|
|
4
30
|
|
|
5
31
|
### Minor Changes
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { UiduClient } from "./client.js";
|
|
2
|
-
import { type GetContactQuery, type GetContactQueryVariables, type GetDealQuery, type GetDealQueryVariables, type ListDealsQueryVariables } from "./generated/index.js";
|
|
2
|
+
import { type GetContactQuery, type GetContactQueryVariables, type GetDealQuery, type GetDealQueryVariables, type GetOrganizationQuery, type GetOrganizationQueryVariables, type ListDealsQueryVariables, type ListOrganizationsQueryVariables } from "./generated/index.js";
|
|
3
3
|
export type Contact = NonNullable<NonNullable<GetContactQuery['currentWorkspace']>['contact']>;
|
|
4
4
|
export type Deal = NonNullable<NonNullable<GetDealQuery['currentWorkspace']>['deal']>;
|
|
5
|
+
/** A CRM organization (company) — the contactable a `Contact` wraps. */
|
|
6
|
+
export type Organization = NonNullable<NonNullable<GetOrganizationQuery['currentWorkspace']>['organization']>;
|
|
5
7
|
/**
|
|
6
8
|
* One contact with its address and custom fields (`fieldValuesByShortname`),
|
|
7
9
|
* or null; a public token sees none.
|
|
@@ -50,3 +52,22 @@ export declare function listDeals(client: UiduClient, variables?: ListDealsQuery
|
|
|
50
52
|
name?: string | null;
|
|
51
53
|
} | null;
|
|
52
54
|
}[]>;
|
|
55
|
+
/**
|
|
56
|
+
* One organization (company) with its fiscal/VAT codes and custom fields, or
|
|
57
|
+
* null.
|
|
58
|
+
*/
|
|
59
|
+
export declare function getOrganization(client: UiduClient, variables: GetOrganizationQueryVariables): Promise<Organization | null>;
|
|
60
|
+
/**
|
|
61
|
+
* The workspace's organizations as a flat array, optionally filtered with
|
|
62
|
+
* search `params`; page with `first`/`after`.
|
|
63
|
+
*/
|
|
64
|
+
export declare function listOrganizations(client: UiduClient, variables?: ListOrganizationsQueryVariables): Promise<{
|
|
65
|
+
__typename?: "Organization";
|
|
66
|
+
id: string;
|
|
67
|
+
name?: string | null;
|
|
68
|
+
email?: string | null;
|
|
69
|
+
avatar?: string | null;
|
|
70
|
+
fiscalCode?: string | null;
|
|
71
|
+
vatCode?: string | null;
|
|
72
|
+
createdAt: any;
|
|
73
|
+
}[]>;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import type { UiduClient } from "./client.js";
|
|
2
|
+
import { type CreateAnalyticAccountAllocationMutationVariables, type CreateExpenseMutationVariables, type CreateExpenseReportMutationVariables, type GetExpenseReportQuery, type GetExpenseReportQueryVariables, type ListAnalyticAccountsQuery, type ListAnalyticAccountsQueryVariables, type ListExpenseReportsQueryVariables, type UpdateExpenseMutationVariables, type UpdateExpenseReportMutationVariables } from "./generated/index.js";
|
|
3
|
+
type ExpenseReportRecord = NonNullable<NonNullable<GetExpenseReportQuery['currentWorkspace']>['expenseReport']>;
|
|
4
|
+
export type ExpenseReport = Omit<ExpenseReportRecord, 'expenses'> & {
|
|
5
|
+
expenses: Expense[];
|
|
6
|
+
};
|
|
7
|
+
export type Expense = NonNullable<NonNullable<NonNullable<NonNullable<ExpenseReportRecord['expenses']>['edges']>[number]>['node']>;
|
|
8
|
+
export type AnalyticAccount = NonNullable<NonNullable<NonNullable<NonNullable<ListAnalyticAccountsQuery['currentWorkspace']>['analyticAccounts']>['edges']>[number]>['node'];
|
|
9
|
+
/**
|
|
10
|
+
* The workspace's expense reports, newest first, each with its `expenses` as a
|
|
11
|
+
* flat array; page with `first`/`after`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function listExpenseReports(client: UiduClient, variables?: ListExpenseReportsQueryVariables): Promise<ExpenseReport[]>;
|
|
14
|
+
/** One expense report with its `expenses` as a flat array, or null. */
|
|
15
|
+
export declare function getExpenseReport(client: UiduClient, variables: GetExpenseReportQueryVariables): Promise<ExpenseReport | null>;
|
|
16
|
+
/**
|
|
17
|
+
* Create an expense report for a person: `{ input: { attributes: { userId,
|
|
18
|
+
* name, fieldValues } } }`. Returns the payload (with `errors`) or null.
|
|
19
|
+
*/
|
|
20
|
+
export declare function createExpenseReport(client: UiduClient, variables: CreateExpenseReportMutationVariables): Promise<{
|
|
21
|
+
__typename?: "CreateExpenseReportPayload";
|
|
22
|
+
expenseReport?: {
|
|
23
|
+
__typename?: "ExpenseReportEdge";
|
|
24
|
+
node?: {
|
|
25
|
+
__typename?: "ExpenseReport";
|
|
26
|
+
id: string;
|
|
27
|
+
name?: string | null;
|
|
28
|
+
paidAt?: any | null;
|
|
29
|
+
fieldValuesByShortname?: any | null;
|
|
30
|
+
createdAt: any;
|
|
31
|
+
updatedAt: any;
|
|
32
|
+
user?: {
|
|
33
|
+
__typename?: "User";
|
|
34
|
+
id: string;
|
|
35
|
+
name?: string | null;
|
|
36
|
+
} | null;
|
|
37
|
+
} | null;
|
|
38
|
+
} | null;
|
|
39
|
+
errors: Array<{
|
|
40
|
+
__typename?: "Error";
|
|
41
|
+
key: string;
|
|
42
|
+
name: string;
|
|
43
|
+
type: string;
|
|
44
|
+
}>;
|
|
45
|
+
} | null>;
|
|
46
|
+
/**
|
|
47
|
+
* Update an expense report — rename it, set `paidAt`, change its custom
|
|
48
|
+
* `fieldValues`. Returns the payload (with `errors`) or null.
|
|
49
|
+
*/
|
|
50
|
+
export declare function updateExpenseReport(client: UiduClient, variables: UpdateExpenseReportMutationVariables): Promise<{
|
|
51
|
+
__typename?: "UpdateExpenseReportPayload";
|
|
52
|
+
expenseReport?: {
|
|
53
|
+
__typename?: "ExpenseReport";
|
|
54
|
+
id: string;
|
|
55
|
+
name?: string | null;
|
|
56
|
+
paidAt?: any | null;
|
|
57
|
+
fieldValuesByShortname?: any | null;
|
|
58
|
+
createdAt: any;
|
|
59
|
+
updatedAt: any;
|
|
60
|
+
user?: {
|
|
61
|
+
__typename?: "User";
|
|
62
|
+
id: string;
|
|
63
|
+
name?: string | null;
|
|
64
|
+
} | null;
|
|
65
|
+
} | null;
|
|
66
|
+
errors: Array<{
|
|
67
|
+
__typename?: "Error";
|
|
68
|
+
key: string;
|
|
69
|
+
name: string;
|
|
70
|
+
type: string;
|
|
71
|
+
}>;
|
|
72
|
+
} | null>;
|
|
73
|
+
/**
|
|
74
|
+
* Add an expense to a report: `{ input: { attributes: { expenseReportId,
|
|
75
|
+
* amount, currency, spentAt, category, paymentMethod, fieldValues } } }`, with
|
|
76
|
+
* `amount` in cents. Returns the payload (with `errors`) or null.
|
|
77
|
+
*/
|
|
78
|
+
export declare function createExpense(client: UiduClient, variables: CreateExpenseMutationVariables): Promise<{
|
|
79
|
+
__typename?: "CreateExpensePayload";
|
|
80
|
+
expense?: {
|
|
81
|
+
__typename?: "ExpenseEdge";
|
|
82
|
+
node?: {
|
|
83
|
+
__typename?: "Expense";
|
|
84
|
+
id: string;
|
|
85
|
+
amount?: any | null;
|
|
86
|
+
currency?: string | null;
|
|
87
|
+
spentAt?: any | null;
|
|
88
|
+
category?: number | null;
|
|
89
|
+
paymentMethod?: string | null;
|
|
90
|
+
fieldValuesByShortname?: any | null;
|
|
91
|
+
createdAt: any;
|
|
92
|
+
updatedAt: any;
|
|
93
|
+
} | null;
|
|
94
|
+
} | null;
|
|
95
|
+
errors: Array<{
|
|
96
|
+
__typename?: "Error";
|
|
97
|
+
key: string;
|
|
98
|
+
name: string;
|
|
99
|
+
type: string;
|
|
100
|
+
}>;
|
|
101
|
+
} | null>;
|
|
102
|
+
/** Update an expense. Returns the payload (with `errors`) or null. */
|
|
103
|
+
export declare function updateExpense(client: UiduClient, variables: UpdateExpenseMutationVariables): Promise<{
|
|
104
|
+
__typename?: "UpdateExpensePayload";
|
|
105
|
+
expense?: {
|
|
106
|
+
__typename?: "Expense";
|
|
107
|
+
id: string;
|
|
108
|
+
amount?: any | null;
|
|
109
|
+
currency?: string | null;
|
|
110
|
+
spentAt?: any | null;
|
|
111
|
+
category?: number | null;
|
|
112
|
+
paymentMethod?: string | null;
|
|
113
|
+
fieldValuesByShortname?: any | null;
|
|
114
|
+
createdAt: any;
|
|
115
|
+
updatedAt: any;
|
|
116
|
+
} | null;
|
|
117
|
+
errors: Array<{
|
|
118
|
+
__typename?: "Error";
|
|
119
|
+
key: string;
|
|
120
|
+
name: string;
|
|
121
|
+
type: string;
|
|
122
|
+
}>;
|
|
123
|
+
} | null>;
|
|
124
|
+
/**
|
|
125
|
+
* The workspace's analytic accounts (commesse, cost centres) as a flat array —
|
|
126
|
+
* what `allocateExpense` books an expense on. `parentId` narrows to the
|
|
127
|
+
* children of one account; page with `first`/`after`.
|
|
128
|
+
*/
|
|
129
|
+
export declare function listAnalyticAccounts(client: UiduClient, variables?: ListAnalyticAccountsQueryVariables): Promise<{
|
|
130
|
+
__typename?: "AnalyticAccount";
|
|
131
|
+
id: string;
|
|
132
|
+
code: string;
|
|
133
|
+
name: string;
|
|
134
|
+
status: import("./generated/index.js").AnalyticAccountStatusEnum;
|
|
135
|
+
currency: string;
|
|
136
|
+
}[]>;
|
|
137
|
+
/**
|
|
138
|
+
* Book an expense (or part of it) on an analytic account: `{ input: {
|
|
139
|
+
* attributes: { allocatableId: expense.id, analyticAccountId, amount } } }`,
|
|
140
|
+
* `amount` in cents, `currency` defaulting to the expense's. Call it once per
|
|
141
|
+
* account to split an expense. Returns the payload (with `errors`) or null.
|
|
142
|
+
*/
|
|
143
|
+
export declare function allocateExpense(client: UiduClient, variables: CreateAnalyticAccountAllocationMutationVariables): Promise<{
|
|
144
|
+
__typename?: "CreateAnalyticAccountAllocationPayload";
|
|
145
|
+
analyticAccountAllocation?: {
|
|
146
|
+
__typename?: "AnalyticAccountAllocationEdge";
|
|
147
|
+
node?: {
|
|
148
|
+
__typename?: "AnalyticAccountAllocation";
|
|
149
|
+
id: string;
|
|
150
|
+
amount: number;
|
|
151
|
+
currency: string;
|
|
152
|
+
kind: import("./generated/index.js").AnalyticAccountAllocationKindEnum;
|
|
153
|
+
note?: string | null;
|
|
154
|
+
analyticAccount: {
|
|
155
|
+
__typename?: "AnalyticAccount";
|
|
156
|
+
id: string;
|
|
157
|
+
code: string;
|
|
158
|
+
name: string;
|
|
159
|
+
};
|
|
160
|
+
} | null;
|
|
161
|
+
} | null;
|
|
162
|
+
errors: Array<{
|
|
163
|
+
__typename?: "Error";
|
|
164
|
+
key: string;
|
|
165
|
+
name: string;
|
|
166
|
+
type: string;
|
|
167
|
+
}>;
|
|
168
|
+
} | null>;
|
|
169
|
+
export {};
|