@uidu/client 3.4.1 → 3.6.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 +36 -0
- package/dist/declarations/src/bookings.d.ts +1 -1
- package/dist/declarations/src/generated/index.d.ts +8635 -263
- package/dist/declarations/src/index.d.ts +4 -3
- package/dist/declarations/src/mutations.d.ts +15 -3
- package/dist/declarations/src/people.d.ts +16 -1
- package/dist/declarations/src/utils/fieldValues.d.ts +37 -0
- package/dist/uidu-client.cjs.dev.js +137 -3
- package/dist/uidu-client.cjs.prod.js +137 -3
- package/dist/uidu-client.esm.js +136 -4
- package/package.json +1 -1
- package/src/client.test.ts +165 -0
- package/src/client.ts +5 -1
- package/src/generated/index.ts +9837 -297
- package/src/index.ts +8 -15
- package/src/people.test.ts +3 -0
- package/src/people.ts +12 -1
- package/src/queries/people/GetEmployee.graphql +4 -1
- package/src/queries/people/ListEmployees.graphql +4 -1
- package/src/queries/people/ListEmploymentHistory.graphql +4 -1
- package/src/queries/people/PeopleMutations.graphql +8 -2
- package/src/utils/fieldValues.test.ts +268 -0
- package/src/utils/fieldValues.ts +164 -0
|
@@ -3,10 +3,11 @@ export { UiduError } from "./types.js";
|
|
|
3
3
|
export type { UiduClientConfig, UiduErrorOptions } from "./types.js";
|
|
4
4
|
export { paginate } from "./utils/paginate.js";
|
|
5
5
|
export type { PaginateOptions } from "./utils/paginate.js";
|
|
6
|
+
export { normalizeFieldValueContent, normalizeFieldValuesAttributes, } from "./utils/fieldValues.js";
|
|
6
7
|
export { ListApplicationsDocument, ListBookingsDocument, ListCalendarsDocument, ListCalendarEventsDocument, ListCallsDocument, ListCampaignsDocument, ListEmailCampaignsDocument, ListCoursesDocument, ListDealsDocument, ListDonationCampaignsDocument, ListEmployeesDocument, ListEnrollmentsDocument, ListEventsDocument, ListFormsDocument, ListKbArticlesDocument, ListKbCollectionsDocument, ListLecturesDocument, ListPagesDocument, ListStoriesDocument, } from "./generated/index.js";
|
|
7
8
|
export { getPage, listPages, getTemplate, createProject, createPage, createPageBlock, createFieldValue, } from "./cms.js";
|
|
8
9
|
export type { Page, Template } from "./cms.js";
|
|
9
|
-
export { createWorkspace, generateWorkspaceApiCredentials
|
|
10
|
+
export { createWorkspace, generateWorkspaceApiCredentials } from "./system.js";
|
|
10
11
|
export { createSpace } from "./spaces.js";
|
|
11
12
|
export { createTask } from "./tasks.js";
|
|
12
13
|
export { createNote } from "./notes.js";
|
|
@@ -35,9 +36,9 @@ export { getBooking, listBookings, getCalendar, listCalendars, getCalendarEvent,
|
|
|
35
36
|
export type { Booking, Calendar, CalendarEvent } from "./bookings.js";
|
|
36
37
|
export { getCourse, listCourses, getEnrollment, listEnrollments, getLecture, listLectures, } from "./courses.js";
|
|
37
38
|
export type { Course, Enrollment, Lecture } from "./courses.js";
|
|
38
|
-
export { getCampaign, listCampaigns, listEmailCampaigns
|
|
39
|
+
export { getCampaign, listCampaigns, listEmailCampaigns } from "./campaigns.js";
|
|
39
40
|
export type { Campaign } from "./campaigns.js";
|
|
40
|
-
export { getContact, listContacts, getDeal, listDeals
|
|
41
|
+
export { getContact, listContacts, getDeal, listDeals } from "./contacts.js";
|
|
41
42
|
export type { Contact, Deal } from "./contacts.js";
|
|
42
43
|
export { getKbArticle, listKbArticles, getKbCollection, listKbCollections, } from "./kb.js";
|
|
43
44
|
export type { KbArticle, KbCollection } from "./kb.js";
|
|
@@ -181,11 +181,15 @@ export declare function createEmployment(c: UiduClient, v: CreateEmploymentMutat
|
|
|
181
181
|
__typename?: "Employment";
|
|
182
182
|
id: string;
|
|
183
183
|
jobTitle?: string | null;
|
|
184
|
-
contractType?: string | null;
|
|
185
184
|
classification?: string | null;
|
|
186
185
|
startDate: any;
|
|
187
186
|
endDate?: any | null;
|
|
188
187
|
isActive: boolean;
|
|
188
|
+
employmentKind?: {
|
|
189
|
+
__typename?: "EmploymentKind";
|
|
190
|
+
id: string;
|
|
191
|
+
name?: string | null;
|
|
192
|
+
} | null;
|
|
189
193
|
} | null;
|
|
190
194
|
} | null;
|
|
191
195
|
errors: Array<{
|
|
@@ -201,12 +205,16 @@ export declare function updateEmployment(c: UiduClient, v: UpdateEmploymentMutat
|
|
|
201
205
|
__typename?: "Employment";
|
|
202
206
|
id: string;
|
|
203
207
|
jobTitle?: string | null;
|
|
204
|
-
contractType?: string | null;
|
|
205
208
|
classification?: string | null;
|
|
206
209
|
startDate: any;
|
|
207
210
|
endDate?: any | null;
|
|
208
211
|
endReason?: string | null;
|
|
209
212
|
isActive: boolean;
|
|
213
|
+
employmentKind?: {
|
|
214
|
+
__typename?: "EmploymentKind";
|
|
215
|
+
id: string;
|
|
216
|
+
name?: string | null;
|
|
217
|
+
} | null;
|
|
210
218
|
} | null;
|
|
211
219
|
errors: Array<{
|
|
212
220
|
__typename?: "Error";
|
|
@@ -243,12 +251,16 @@ export declare function terminateEmployment(c: UiduClient, args: {
|
|
|
243
251
|
__typename?: "Employment";
|
|
244
252
|
id: string;
|
|
245
253
|
jobTitle?: string | null;
|
|
246
|
-
contractType?: string | null;
|
|
247
254
|
classification?: string | null;
|
|
248
255
|
startDate: any;
|
|
249
256
|
endDate?: any | null;
|
|
250
257
|
endReason?: string | null;
|
|
251
258
|
isActive: boolean;
|
|
259
|
+
employmentKind?: {
|
|
260
|
+
__typename?: "EmploymentKind";
|
|
261
|
+
id: string;
|
|
262
|
+
name?: string | null;
|
|
263
|
+
} | null;
|
|
252
264
|
} | null;
|
|
253
265
|
errors: Array<{
|
|
254
266
|
__typename?: "Error";
|
|
@@ -21,9 +21,13 @@ export declare function listEmployees(client: UiduClient, variables?: ListEmploy
|
|
|
21
21
|
__typename?: "Employment";
|
|
22
22
|
id: string;
|
|
23
23
|
jobTitle?: string | null;
|
|
24
|
-
contractType?: string | null;
|
|
25
24
|
isActive: boolean;
|
|
26
25
|
startDate: any;
|
|
26
|
+
employmentKind?: {
|
|
27
|
+
__typename?: "EmploymentKind";
|
|
28
|
+
id: string;
|
|
29
|
+
name?: string | null;
|
|
30
|
+
} | null;
|
|
27
31
|
} | null;
|
|
28
32
|
}[]>;
|
|
29
33
|
export declare function getEmployee(client: UiduClient, variables: GetEmployeeQueryVariables): Promise<Employee | null>;
|
|
@@ -69,6 +73,17 @@ export type EmploymentRecord = {
|
|
|
69
73
|
endDate: string | null;
|
|
70
74
|
endReason: string | null;
|
|
71
75
|
jobTitle: string | null;
|
|
76
|
+
/**
|
|
77
|
+
* The contract type, as a record. It used to be a free string on the
|
|
78
|
+
* employment (`contractType`); uidu promoted it to `EmploymentKind` so a
|
|
79
|
+
* workspace can configure its own, which is why writes take
|
|
80
|
+
* `employmentKindId`.
|
|
81
|
+
*/
|
|
82
|
+
employmentKind: {
|
|
83
|
+
id: string;
|
|
84
|
+
name: string | null;
|
|
85
|
+
} | null;
|
|
86
|
+
/** The contract type's name — `employmentKind.name`, kept flat for display. */
|
|
72
87
|
contractType: string | null;
|
|
73
88
|
/** The CCNL (national collective labor contract) that applies, if any. */
|
|
74
89
|
ccnl: {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The API stores every answer in a `content` JSON column and reads it back with
|
|
3
|
+
* `content['value']` — so `content` must always be an object shaped
|
|
4
|
+
* `{ value: <the answer> }`, never the bare answer.
|
|
5
|
+
*
|
|
6
|
+
* Passing a flat scalar (`content: 'hello'`) is the single most common mistake
|
|
7
|
+
* when writing field values by hand or via a code-generating agent: the server
|
|
8
|
+
* accepts the mutation but the typed columns silently stay empty, and later
|
|
9
|
+
* reads of that field blow up. We normalize here so the flat shape is
|
|
10
|
+
* impossible to send rather than merely documented.
|
|
11
|
+
*
|
|
12
|
+
* `fieldValuesAttributes` shows up on 15 different `*Attributes` types and
|
|
13
|
+
* nests arbitrarily (`contactAttributes.contactableAttributes.…`,
|
|
14
|
+
* `pageAttributes.pageBlocksAttributes[].…`), so the walk below is keyed on the
|
|
15
|
+
* property name at any depth rather than on a fixed path. It runs once per
|
|
16
|
+
* mutation in `UiduClient.mutate`.
|
|
17
|
+
*/
|
|
18
|
+
type FieldValueLike = {
|
|
19
|
+
content?: unknown;
|
|
20
|
+
} & Record<string, unknown>;
|
|
21
|
+
/**
|
|
22
|
+
* Wrap a `content` payload in `{ value }` unless it already carries a `value`
|
|
23
|
+
* key. Returns the input untouched when there is nothing to do.
|
|
24
|
+
*/
|
|
25
|
+
export declare function normalizeFieldValueContent(content: unknown): unknown;
|
|
26
|
+
/**
|
|
27
|
+
* Normalize a standalone `fieldValuesAttributes` array. Exported for callers
|
|
28
|
+
* that assemble one by hand outside an SDK mutation.
|
|
29
|
+
*/
|
|
30
|
+
export declare function normalizeFieldValuesAttributes<T extends FieldValueLike>(attributes: ReadonlyArray<T | null | undefined> | null | undefined): typeof attributes;
|
|
31
|
+
/**
|
|
32
|
+
* Normalize every `fieldValuesAttributes` array reachable from a mutation's
|
|
33
|
+
* variables, at any depth. Returns the input untouched — same reference, and
|
|
34
|
+
* same references for every unchanged subtree — when there is nothing to do.
|
|
35
|
+
*/
|
|
36
|
+
export declare function normalizeMutationVariables<V>(variables: V): V;
|
|
37
|
+
export {};
|