@uidu/client 3.2.0 → 3.3.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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @uidu/client
2
2
 
3
+ ## 3.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - ccd1038: Add employment history reads for building contract timelines.
8
+
9
+ `listEmploymentHistory` returns every employee with their full list of
10
+ contracts (not just the current one), and `contractEvents` flattens that into a
11
+ dated, most-recent-first list of events: the earliest contract is a `hire`,
12
+ later contracts are `variation`s, and any contract with an end date yields a
13
+ `termination` — each tagged with a `month` bucket for grouping. Exports the
14
+ `EmploymentRecord`, `EmployeeContracts`, `ContractEvent` and `ContractEventType`
15
+ types.
16
+
3
17
  ## 3.2.0
4
18
 
5
19
  ### Minor Changes
@@ -44693,6 +44693,53 @@ export type ListEmployeesQuery = {
44693
44693
  };
44694
44694
  } | null;
44695
44695
  };
44696
+ export type ListEmploymentHistoryQueryVariables = Exact<{
44697
+ first?: InputMaybe<Scalars['Int']['input']>;
44698
+ after?: InputMaybe<Scalars['String']['input']>;
44699
+ employmentsFirst?: InputMaybe<Scalars['Int']['input']>;
44700
+ }>;
44701
+ export type ListEmploymentHistoryQuery = {
44702
+ __typename?: 'Query';
44703
+ currentWorkspace?: {
44704
+ __typename?: 'Workspace';
44705
+ employees: {
44706
+ __typename?: 'EmployeeConnection';
44707
+ pageInfo: {
44708
+ __typename?: 'PageInfo';
44709
+ hasNextPage: boolean;
44710
+ endCursor?: string | null;
44711
+ };
44712
+ edges?: Array<{
44713
+ __typename?: 'EmployeeEdge';
44714
+ node?: {
44715
+ __typename?: 'Employee';
44716
+ id: string;
44717
+ user?: {
44718
+ __typename?: 'User';
44719
+ id: string;
44720
+ name?: string | null;
44721
+ email?: string | null;
44722
+ } | null;
44723
+ employments: {
44724
+ __typename?: 'EmploymentConnection';
44725
+ edges?: Array<{
44726
+ __typename?: 'EmploymentEdge';
44727
+ node?: {
44728
+ __typename?: 'Employment';
44729
+ id: string;
44730
+ startDate: any;
44731
+ endDate?: any | null;
44732
+ endReason?: string | null;
44733
+ jobTitle?: string | null;
44734
+ contractType?: string | null;
44735
+ } | null;
44736
+ } | null> | null;
44737
+ };
44738
+ } | null;
44739
+ } | null> | null;
44740
+ };
44741
+ } | null;
44742
+ };
44696
44743
  export type ListKindsQueryVariables = Exact<{
44697
44744
  models: Array<Scalars['String']['input']> | Scalars['String']['input'];
44698
44745
  first?: InputMaybe<Scalars['Int']['input']>;
@@ -45331,6 +45378,7 @@ export declare const DeleteNoteDocument: DocumentNode<DeleteNoteMutation, Delete
45331
45378
  export declare const GetEmployeeDocument: DocumentNode<GetEmployeeQuery, GetEmployeeQueryVariables>;
45332
45379
  export declare const ListCirclesDocument: DocumentNode<ListCirclesQuery, ListCirclesQueryVariables>;
45333
45380
  export declare const ListEmployeesDocument: DocumentNode<ListEmployeesQuery, ListEmployeesQueryVariables>;
45381
+ export declare const ListEmploymentHistoryDocument: DocumentNode<ListEmploymentHistoryQuery, ListEmploymentHistoryQueryVariables>;
45334
45382
  export declare const ListKindsDocument: DocumentNode<ListKindsQuery, ListKindsQueryVariables>;
45335
45383
  export declare const ListOfficesDocument: DocumentNode<ListOfficesQuery, ListOfficesQueryVariables>;
45336
45384
  export declare const CreateEmployeeDocument: DocumentNode<CreateEmployeeMutation, CreateEmployeeMutationVariables>;
@@ -25,8 +25,8 @@ export { getDonationCampaign, listDonationCampaigns, createDonation, createDonat
25
25
  export type { DonationCampaign } from "./donations.js";
26
26
  export { getStory, listStories, createStory } from "./stories.js";
27
27
  export type { Story } from "./stories.js";
28
- export { listEmployees, getEmployee, weekStartFor, listOffices, listCircles, listRoles, listKinds, listCcnls, } from "./people.js";
29
- export type { Employee, Office, Circle, Kind } from "./people.js";
28
+ export { listEmployees, getEmployee, weekStartFor, listOffices, listCircles, listRoles, listKinds, listCcnls, listEmploymentHistory, contractEvents, } from "./people.js";
29
+ export type { Employee, Office, Circle, Kind, EmploymentRecord, EmployeeContracts, ContractEvent, ContractEventType, } from "./people.js";
30
30
  export { getBooking, listBookings, getCalendar, listCalendars, getCalendarEvent, listCalendarEvents, } from "./bookings.js";
31
31
  export type { Booking, Calendar, CalendarEvent } from "./bookings.js";
32
32
  export { getCourse, listCourses, getEnrollment, listEnrollments, getLecture, listLectures, } from "./courses.js";
@@ -1,5 +1,5 @@
1
1
  import type { UiduClient } from "./client.js";
2
- import { type GetEmployeeQuery, type GetEmployeeQueryVariables, type ListCirclesQuery, type ListCirclesQueryVariables, type ListEmployeesQueryVariables, type ListKindsQuery, type ListKindsQueryVariables, type ListOfficesQuery, type ListOfficesQueryVariables } from "./generated/index.js";
2
+ import { type GetEmployeeQuery, type GetEmployeeQueryVariables, type ListCirclesQuery, type ListCirclesQueryVariables, type ListEmployeesQueryVariables, type ListEmploymentHistoryQueryVariables, type ListKindsQuery, type ListKindsQueryVariables, type ListOfficesQuery, type ListOfficesQueryVariables } from "./generated/index.js";
3
3
  export type Employee = NonNullable<NonNullable<GetEmployeeQuery['currentWorkspace']>['employee']>;
4
4
  export type Circle = NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<ListCirclesQuery['currentWorkspace']>['circles']>['edges']>[number]>['node']>;
5
5
  export type Office = NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<ListOfficesQuery['currentWorkspace']>['offices']>['edges']>[number]>['node']>;
@@ -51,3 +51,49 @@ export declare function listKinds(client: UiduClient, variables: ListKindsQueryV
51
51
  * workspace — used for an employment's `ccnlId`.
52
52
  */
53
53
  export declare function listCcnls(client: UiduClient, variables?: Omit<ListKindsQueryVariables, 'models'>): Promise<Kind[]>;
54
+ /** A single contract (employment) reduced to the fields that describe its span. */
55
+ export type EmploymentRecord = {
56
+ id: string;
57
+ startDate: string | null;
58
+ endDate: string | null;
59
+ endReason: string | null;
60
+ jobTitle: string | null;
61
+ contractType: string | null;
62
+ };
63
+ /** An employee together with their full list of contracts. */
64
+ export type EmployeeContracts = {
65
+ id: string;
66
+ name: string;
67
+ employments: EmploymentRecord[];
68
+ };
69
+ /**
70
+ * List every employee with their full employment (contract) history — not just
71
+ * the current one. Use {@link contractEvents} to turn this into a flat, dated
72
+ * list of hires, terminations and contract variations.
73
+ */
74
+ export declare function listEmploymentHistory(client: UiduClient, variables?: ListEmploymentHistoryQueryVariables): Promise<EmployeeContracts[]>;
75
+ export type ContractEventType = 'hire' | 'variation' | 'termination';
76
+ /** A dated contract event derived from employment history. */
77
+ export type ContractEvent = {
78
+ type: ContractEventType;
79
+ /** ISO8601 date (YYYY-MM-DD) the event happened on. */
80
+ date: string;
81
+ /** Year-month bucket (YYYY-MM), convenient for grouping. */
82
+ month: string;
83
+ employeeId: string;
84
+ employeeName: string;
85
+ employmentId: string;
86
+ jobTitle: string | null;
87
+ contractType: string | null;
88
+ /** Only set on `termination` events. */
89
+ endReason: string | null;
90
+ };
91
+ /**
92
+ * Flatten employment history into dated contract events, most recent first:
93
+ * - the employee's earliest contract is a `hire` (assunzione) on its start date;
94
+ * - every later contract is a `variation` (variazione) on its start date;
95
+ * - any contract with an end date yields a `termination` (cessazione) on it.
96
+ *
97
+ * Contracts without a start date are ignored.
98
+ */
99
+ export declare function contractEvents(employees: EmployeeContracts[]): ContractEvent[];