@uidu/client 3.1.1 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uidu/client",
3
- "version": "3.1.1",
3
+ "version": "3.3.0",
4
4
  "description": "Typed GraphQL client for the uidu platform. Server-first, framework-agnostic.",
5
5
  "license": "MIT",
6
6
  "author": "uidu",
@@ -49826,6 +49826,14 @@ export type GetEmployeeQueryVariables = Exact<{
49826
49826
 
49827
49827
  export type GetEmployeeQuery = { __typename?: 'Query', currentWorkspace?: { __typename?: 'Workspace', employee?: { __typename?: 'Employee', id: string, employeeCode?: string | null, user?: { __typename?: 'User', id: string, name?: string | null, firstName?: string | null, lastName?: string | null, email?: string | null } | null, currentEmployment?: { __typename?: 'Employment', id: string, jobTitle?: string | null, contractType?: string | null, contractLevel?: string | null, classification?: string | null, isActive: boolean, startDate: any, endDate?: any | null, fteRatio?: number | null, primaryOffice?: { __typename?: 'Office', id: string, name?: string | null } | null } | null, todayTimeClocks: Array<{ __typename?: 'TimeClock', id: string, beginsAt?: any | null, finishesAt?: any | null, kind?: number | null }>, weeklyShifts?: { __typename?: 'ShiftConnection', edges?: Array<{ __typename?: 'ShiftEdge', node?: { __typename?: 'Shift', id: string, name?: string | null, beginsAt?: any | null, finishesAt?: any | null, aasmState: string } | null } | null> | null } | null } | null } | null };
49828
49828
 
49829
+ export type ListCirclesQueryVariables = Exact<{
49830
+ first?: InputMaybe<Scalars['Int']['input']>;
49831
+ after?: InputMaybe<Scalars['String']['input']>;
49832
+ }>;
49833
+
49834
+
49835
+ export type ListCirclesQuery = { __typename?: 'Query', currentWorkspace?: { __typename?: 'Workspace', circles: { __typename?: 'CircleConnection', pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean, endCursor?: string | null }, edges?: Array<{ __typename?: 'CircleEdge', node?: { __typename?: 'Circle', id: string, name?: string | null, kind?: string | null } | null } | null> | null } } | null };
49836
+
49829
49837
  export type ListEmployeesQueryVariables = Exact<{
49830
49838
  first?: InputMaybe<Scalars['Int']['input']>;
49831
49839
  after?: InputMaybe<Scalars['String']['input']>;
@@ -49834,6 +49842,67 @@ export type ListEmployeesQueryVariables = Exact<{
49834
49842
 
49835
49843
  export type ListEmployeesQuery = { __typename?: 'Query', currentWorkspace?: { __typename?: 'Workspace', employees: { __typename?: 'EmployeeConnection', pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean, endCursor?: string | null }, edges?: Array<{ __typename?: 'EmployeeEdge', node?: { __typename?: 'Employee', id: string, employeeCode?: string | null, user?: { __typename?: 'User', id: string, name?: string | null, firstName?: string | null, lastName?: string | null, email?: string | null } | null, currentEmployment?: { __typename?: 'Employment', id: string, jobTitle?: string | null, contractType?: string | null, isActive: boolean, startDate: any } | null } | null } | null> | null } } | null };
49836
49844
 
49845
+ export type ListEmploymentHistoryQueryVariables = Exact<{
49846
+ first?: InputMaybe<Scalars['Int']['input']>;
49847
+ after?: InputMaybe<Scalars['String']['input']>;
49848
+ employmentsFirst?: InputMaybe<Scalars['Int']['input']>;
49849
+ }>;
49850
+
49851
+
49852
+ export type ListEmploymentHistoryQuery = { __typename?: 'Query', currentWorkspace?: { __typename?: 'Workspace', employees: { __typename?: 'EmployeeConnection', pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean, endCursor?: string | null }, edges?: Array<{ __typename?: 'EmployeeEdge', node?: { __typename?: 'Employee', id: string, user?: { __typename?: 'User', id: string, name?: string | null, email?: string | null } | null, employments: { __typename?: 'EmploymentConnection', edges?: Array<{ __typename?: 'EmploymentEdge', node?: { __typename?: 'Employment', id: string, startDate: any, endDate?: any | null, endReason?: string | null, jobTitle?: string | null, contractType?: string | null } | null } | null> | null } } | null } | null> | null } } | null };
49853
+
49854
+ export type ListKindsQueryVariables = Exact<{
49855
+ models: Array<Scalars['String']['input']> | Scalars['String']['input'];
49856
+ first?: InputMaybe<Scalars['Int']['input']>;
49857
+ after?: InputMaybe<Scalars['String']['input']>;
49858
+ }>;
49859
+
49860
+
49861
+ export type ListKindsQuery = { __typename?: 'Query', currentWorkspace?: { __typename?: 'Workspace', kinds?: { __typename?: 'KindConnection', pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean, endCursor?: string | null }, edges?: Array<{ __typename?: 'KindEdge', node?: { __typename?: 'Kind', id: string, name?: string | null, code?: string | null, model?: string | null } | null } | null> | null } | null } | null };
49862
+
49863
+ export type ListOfficesQueryVariables = Exact<{
49864
+ first?: InputMaybe<Scalars['Int']['input']>;
49865
+ after?: InputMaybe<Scalars['String']['input']>;
49866
+ }>;
49867
+
49868
+
49869
+ export type ListOfficesQuery = { __typename?: 'Query', currentWorkspace?: { __typename?: 'Workspace', offices?: { __typename?: 'OfficeConnection', pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean, endCursor?: string | null }, edges?: Array<{ __typename?: 'OfficeEdge', node?: { __typename?: 'Office', id: string, name?: string | null } | null } | null> | null } | null } | null };
49870
+
49871
+ export type CreateEmployeeMutationVariables = Exact<{
49872
+ input: CreateEmployeeInput;
49873
+ }>;
49874
+
49875
+
49876
+ export type CreateEmployeeMutation = { __typename?: 'Mutation', createEmployee?: { __typename?: 'CreateEmployeePayload', employee?: { __typename?: 'EmployeeEdge', node?: { __typename?: 'Employee', id: string, employeeCode?: string | null, user?: { __typename?: 'User', id: string, name?: string | null, email?: string | null } | null } | null } | null, errors: Array<{ __typename?: 'Error', key: string, name: string, type: string }> } | null };
49877
+
49878
+ export type UpdateEmployeeMutationVariables = Exact<{
49879
+ input: UpdateEmployeeInput;
49880
+ }>;
49881
+
49882
+
49883
+ export type UpdateEmployeeMutation = { __typename?: 'Mutation', updateEmployee?: { __typename?: 'UpdateEmployeePayload', employee?: { __typename?: 'Employee', id: string, employeeCode?: string | null } | null, errors: Array<{ __typename?: 'Error', key: string, name: string, type: string }> } | null };
49884
+
49885
+ export type CreateEmploymentMutationVariables = Exact<{
49886
+ input: CreateEmploymentInput;
49887
+ }>;
49888
+
49889
+
49890
+ export type CreateEmploymentMutation = { __typename?: 'Mutation', createEmployment?: { __typename?: 'CreateEmploymentPayload', employment?: { __typename?: 'EmploymentEdge', node?: { __typename?: 'Employment', id: string, jobTitle?: string | null, contractType?: string | null, classification?: string | null, startDate: any, endDate?: any | null, isActive: boolean } | null } | null, errors: Array<{ __typename?: 'Error', key: string, name: string, type: string }> } | null };
49891
+
49892
+ export type UpdateEmploymentMutationVariables = Exact<{
49893
+ input: UpdateEmploymentInput;
49894
+ }>;
49895
+
49896
+
49897
+ export type UpdateEmploymentMutation = { __typename?: 'Mutation', updateEmployment?: { __typename?: 'UpdateEmploymentPayload', employment?: { __typename?: 'Employment', id: string, jobTitle?: string | null, contractType?: string | null, classification?: string | null, startDate: any, endDate?: any | null, endReason?: string | null, isActive: boolean } | null, errors: Array<{ __typename?: 'Error', key: string, name: string, type: string }> } | null };
49898
+
49899
+ export type DeleteEmploymentMutationVariables = Exact<{
49900
+ input: DeleteEmploymentInput;
49901
+ }>;
49902
+
49903
+
49904
+ export type DeleteEmploymentMutation = { __typename?: 'Mutation', deleteEmployment?: { __typename?: 'DeleteEmploymentPayload', employment?: { __typename?: 'Employment', id: string } | null, errors: Array<{ __typename?: 'Error', key: string, name: string, type: string }> } | null };
49905
+
49837
49906
  export type SearchQueryVariables = Exact<{
49838
49907
  models?: InputMaybe<Array<Scalars['String']['input']> | Scalars['String']['input']>;
49839
49908
  params?: InputMaybe<SearchParams>;
@@ -50007,7 +50076,16 @@ export const CreateNoteDocument = {"kind":"Document","definitions":[{"kind":"Ope
50007
50076
  export const UpdateNoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateNote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateNoteInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateNote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"note"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"errors"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}}]}}]} as unknown as DocumentNode<UpdateNoteMutation, UpdateNoteMutationVariables>;
50008
50077
  export const DeleteNoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteNote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"DeleteNoteInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteNote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"note"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"errors"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}}]}}]} as unknown as DocumentNode<DeleteNoteMutation, DeleteNoteMutationVariables>;
50009
50078
  export const GetEmployeeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetEmployee"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"weekStartingAt"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ISO8601Date"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currentWorkspace"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"employee"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"employeeCode"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}}]}},{"kind":"Field","name":{"kind":"Name","value":"currentEmployment"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"jobTitle"}},{"kind":"Field","name":{"kind":"Name","value":"contractType"}},{"kind":"Field","name":{"kind":"Name","value":"contractLevel"}},{"kind":"Field","name":{"kind":"Name","value":"classification"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"startDate"}},{"kind":"Field","name":{"kind":"Name","value":"endDate"}},{"kind":"Field","name":{"kind":"Name","value":"fteRatio"}},{"kind":"Field","name":{"kind":"Name","value":"primaryOffice"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"todayTimeClocks"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"beginsAt"}},{"kind":"Field","name":{"kind":"Name","value":"finishesAt"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}}]}},{"kind":"Field","name":{"kind":"Name","value":"weeklyShifts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"weekStartingAt"},"value":{"kind":"Variable","name":{"kind":"Name","value":"weekStartingAt"}}},{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"IntValue","value":"20"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"beginsAt"}},{"kind":"Field","name":{"kind":"Name","value":"finishesAt"}},{"kind":"Field","name":{"kind":"Name","value":"aasmState"}}]}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetEmployeeQuery, GetEmployeeQueryVariables>;
50079
+ export const ListCirclesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ListCircles"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"first"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"after"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currentWorkspace"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"circles"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"Variable","name":{"kind":"Name","value":"first"}}},{"kind":"Argument","name":{"kind":"Name","value":"after"},"value":{"kind":"Variable","name":{"kind":"Name","value":"after"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"pageInfo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"hasNextPage"}},{"kind":"Field","name":{"kind":"Name","value":"endCursor"}}]}},{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode<ListCirclesQuery, ListCirclesQueryVariables>;
50010
50080
  export const ListEmployeesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ListEmployees"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"first"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"after"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currentWorkspace"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"employees"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"Variable","name":{"kind":"Name","value":"first"}}},{"kind":"Argument","name":{"kind":"Name","value":"after"},"value":{"kind":"Variable","name":{"kind":"Name","value":"after"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"pageInfo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"hasNextPage"}},{"kind":"Field","name":{"kind":"Name","value":"endCursor"}}]}},{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"employeeCode"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}}]}},{"kind":"Field","name":{"kind":"Name","value":"currentEmployment"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"jobTitle"}},{"kind":"Field","name":{"kind":"Name","value":"contractType"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"startDate"}}]}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode<ListEmployeesQuery, ListEmployeesQueryVariables>;
50081
+ export const ListEmploymentHistoryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ListEmploymentHistory"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"first"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"after"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"employmentsFirst"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currentWorkspace"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"employees"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"Variable","name":{"kind":"Name","value":"first"}}},{"kind":"Argument","name":{"kind":"Name","value":"after"},"value":{"kind":"Variable","name":{"kind":"Name","value":"after"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"pageInfo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"hasNextPage"}},{"kind":"Field","name":{"kind":"Name","value":"endCursor"}}]}},{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}}]}},{"kind":"Field","name":{"kind":"Name","value":"employments"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"Variable","name":{"kind":"Name","value":"employmentsFirst"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"startDate"}},{"kind":"Field","name":{"kind":"Name","value":"endDate"}},{"kind":"Field","name":{"kind":"Name","value":"endReason"}},{"kind":"Field","name":{"kind":"Name","value":"jobTitle"}},{"kind":"Field","name":{"kind":"Name","value":"contractType"}}]}}]}}]}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode<ListEmploymentHistoryQuery, ListEmploymentHistoryQueryVariables>;
50082
+ export const ListKindsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ListKinds"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"models"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"first"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"after"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currentWorkspace"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"kinds"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"models"},"value":{"kind":"Variable","name":{"kind":"Name","value":"models"}}},{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"Variable","name":{"kind":"Name","value":"first"}}},{"kind":"Argument","name":{"kind":"Name","value":"after"},"value":{"kind":"Variable","name":{"kind":"Name","value":"after"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"pageInfo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"hasNextPage"}},{"kind":"Field","name":{"kind":"Name","value":"endCursor"}}]}},{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"model"}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode<ListKindsQuery, ListKindsQueryVariables>;
50083
+ export const ListOfficesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ListOffices"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"first"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"after"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currentWorkspace"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"offices"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"Variable","name":{"kind":"Name","value":"first"}}},{"kind":"Argument","name":{"kind":"Name","value":"after"},"value":{"kind":"Variable","name":{"kind":"Name","value":"after"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"pageInfo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"hasNextPage"}},{"kind":"Field","name":{"kind":"Name","value":"endCursor"}}]}},{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode<ListOfficesQuery, ListOfficesQueryVariables>;
50084
+ export const CreateEmployeeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateEmployee"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateEmployeeInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createEmployee"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"employee"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"employeeCode"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"errors"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}}]}}]} as unknown as DocumentNode<CreateEmployeeMutation, CreateEmployeeMutationVariables>;
50085
+ export const UpdateEmployeeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateEmployee"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateEmployeeInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateEmployee"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"employee"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"employeeCode"}}]}},{"kind":"Field","name":{"kind":"Name","value":"errors"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}}]}}]} as unknown as DocumentNode<UpdateEmployeeMutation, UpdateEmployeeMutationVariables>;
50086
+ export const CreateEmploymentDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateEmployment"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateEmploymentInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createEmployment"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"employment"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"jobTitle"}},{"kind":"Field","name":{"kind":"Name","value":"contractType"}},{"kind":"Field","name":{"kind":"Name","value":"classification"}},{"kind":"Field","name":{"kind":"Name","value":"startDate"}},{"kind":"Field","name":{"kind":"Name","value":"endDate"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"errors"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}}]}}]} as unknown as DocumentNode<CreateEmploymentMutation, CreateEmploymentMutationVariables>;
50087
+ export const UpdateEmploymentDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateEmployment"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateEmploymentInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateEmployment"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"employment"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"jobTitle"}},{"kind":"Field","name":{"kind":"Name","value":"contractType"}},{"kind":"Field","name":{"kind":"Name","value":"classification"}},{"kind":"Field","name":{"kind":"Name","value":"startDate"}},{"kind":"Field","name":{"kind":"Name","value":"endDate"}},{"kind":"Field","name":{"kind":"Name","value":"endReason"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}}]}},{"kind":"Field","name":{"kind":"Name","value":"errors"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}}]}}]} as unknown as DocumentNode<UpdateEmploymentMutation, UpdateEmploymentMutationVariables>;
50088
+ export const DeleteEmploymentDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteEmployment"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"DeleteEmploymentInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteEmployment"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"employment"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"errors"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}}]}}]} as unknown as DocumentNode<DeleteEmploymentMutation, DeleteEmploymentMutationVariables>;
50011
50089
  export const SearchDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Search"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"models"}},"type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"params"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"SearchParams"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"first"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"after"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currentWorkspace"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"search"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"models"},"value":{"kind":"Variable","name":{"kind":"Name","value":"models"}}},{"kind":"Argument","name":{"kind":"Name","value":"params"},"value":{"kind":"Variable","name":{"kind":"Name","value":"params"}}},{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"Variable","name":{"kind":"Name","value":"first"}}},{"kind":"Argument","name":{"kind":"Name","value":"after"},"value":{"kind":"Variable","name":{"kind":"Name","value":"after"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalCount"}},{"kind":"Field","name":{"kind":"Name","value":"totalPages"}},{"kind":"Field","name":{"kind":"Name","value":"term"}},{"kind":"Field","name":{"kind":"Name","value":"took"}},{"kind":"Field","name":{"kind":"Name","value":"pageInfo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"hasNextPage"}},{"kind":"Field","name":{"kind":"Name","value":"endCursor"}}]}},{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cursor"}},{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Node"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode<SearchQuery, SearchQueryVariables>;
50012
50090
  export const CreateSpaceDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateSpace"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateSpaceInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createSpace"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"space"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"errors"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}}]}}]} as unknown as DocumentNode<CreateSpaceMutation, CreateSpaceMutationVariables>;
50013
50091
  export const UpdateSpaceDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateSpace"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateSpaceInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateSpace"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"space"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"errors"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}}]}}]} as unknown as DocumentNode<UpdateSpaceMutation, UpdateSpaceMutationVariables>;
package/src/index.ts CHANGED
@@ -76,6 +76,12 @@ export {
76
76
  deleteNote,
77
77
  updateSpace,
78
78
  deleteSpace,
79
+ createEmployee,
80
+ updateEmployee,
81
+ createEmployment,
82
+ updateEmployment,
83
+ deleteEmployment,
84
+ terminateEmployment,
79
85
  } from './mutations';
80
86
 
81
87
  export {
@@ -109,8 +115,28 @@ export type { DonationCampaign } from './donations';
109
115
  export { getStory, listStories, createStory } from './stories';
110
116
  export type { Story } from './stories';
111
117
 
112
- export { listEmployees, getEmployee, weekStartFor } from './people';
113
- export type { Employee } from './people';
118
+ export {
119
+ listEmployees,
120
+ getEmployee,
121
+ weekStartFor,
122
+ listOffices,
123
+ listCircles,
124
+ listRoles,
125
+ listKinds,
126
+ listCcnls,
127
+ listEmploymentHistory,
128
+ contractEvents,
129
+ } from './people';
130
+ export type {
131
+ Employee,
132
+ Office,
133
+ Circle,
134
+ Kind,
135
+ EmploymentRecord,
136
+ EmployeeContracts,
137
+ ContractEvent,
138
+ ContractEventType,
139
+ } from './people';
114
140
 
115
141
  export {
116
142
  getBooking,
@@ -0,0 +1,43 @@
1
+ import { describe, expect, it, vi } from 'vitest';
2
+ import type { UiduClient } from './client';
3
+ import { terminateEmployment } from './mutations';
4
+
5
+ describe('terminateEmployment', () => {
6
+ it('closes an employment via updateEmployment with endDate + endReason', async () => {
7
+ const mutate = vi
8
+ .fn()
9
+ .mockResolvedValue({ updateEmployment: { employment: { id: 'e1' }, errors: [] } });
10
+ const client = { mutate } as unknown as UiduClient;
11
+
12
+ const result = await terminateEmployment(client, {
13
+ id: 'e1',
14
+ endDate: '2026-07-31',
15
+ endReason: 'resignation',
16
+ });
17
+
18
+ expect(mutate).toHaveBeenCalledTimes(1);
19
+ const variables = mutate.mock.calls[0][1];
20
+ expect(variables).toEqual({
21
+ input: {
22
+ id: 'e1',
23
+ attributes: { endDate: '2026-07-31', endReason: 'resignation' },
24
+ },
25
+ });
26
+ expect(result).toEqual({ employment: { id: 'e1' }, errors: [] });
27
+ });
28
+
29
+ it('leaves endReason undefined when not provided', async () => {
30
+ const mutate = vi
31
+ .fn()
32
+ .mockResolvedValue({ updateEmployment: { employment: { id: 'e2' }, errors: [] } });
33
+ const client = { mutate } as unknown as UiduClient;
34
+
35
+ await terminateEmployment(client, { id: 'e2', endDate: '2026-08-15' });
36
+
37
+ const variables = mutate.mock.calls[0][1];
38
+ expect(variables.input.attributes).toEqual({
39
+ endDate: '2026-08-15',
40
+ endReason: undefined,
41
+ });
42
+ });
43
+ });
package/src/mutations.ts CHANGED
@@ -13,6 +13,10 @@ import {
13
13
  type CreateCourseMutationVariables,
14
14
  CreateDealDocument,
15
15
  type CreateDealMutationVariables,
16
+ CreateEmployeeDocument,
17
+ type CreateEmployeeMutationVariables,
18
+ CreateEmploymentDocument,
19
+ type CreateEmploymentMutationVariables,
16
20
  CreateFormDocument,
17
21
  type CreateFormMutationVariables,
18
22
  CreateKbArticleDocument,
@@ -27,6 +31,8 @@ import {
27
31
  type DeleteCourseMutationVariables,
28
32
  DeleteDonationCampaignDocument,
29
33
  type DeleteDonationCampaignMutationVariables,
34
+ DeleteEmploymentDocument,
35
+ type DeleteEmploymentMutationVariables,
30
36
  DeleteFormDocument,
31
37
  type DeleteFormMutationVariables,
32
38
  DeleteKbArticleDocument,
@@ -47,6 +53,10 @@ import {
47
53
  type UpdateDealMutationVariables,
48
54
  UpdateDonationCampaignDocument,
49
55
  type UpdateDonationCampaignMutationVariables,
56
+ UpdateEmployeeDocument,
57
+ type UpdateEmployeeMutationVariables,
58
+ UpdateEmploymentDocument,
59
+ type UpdateEmploymentMutationVariables,
50
60
  UpdateEventDocument,
51
61
  type UpdateEventMutationVariables,
52
62
  UpdateFormDocument,
@@ -101,6 +111,45 @@ export async function updateDeal(c: UiduClient, v: UpdateDealMutationVariables)
101
111
  return (await c.mutate(UpdateDealDocument, v)).updateDeal ?? null;
102
112
  }
103
113
 
114
+ // --- People / HR (employees & employments) ---
115
+ // An Employee is the HR record wrapping a workspace User (`userId`); an
116
+ // Employment is a single contract (start/end dates, contract type, CCNL, role,
117
+ // offices, FTE…). A hire = createEmployment; a termination = updateEmployment
118
+ // with an `endDate` + `endReason` (see `terminateEmployment`); a contract
119
+ // variation = a new createEmployment (or updateEmployment on the current one).
120
+ export async function createEmployee(c: UiduClient, v: CreateEmployeeMutationVariables) {
121
+ return (await c.mutate(CreateEmployeeDocument, v)).createEmployee ?? null;
122
+ }
123
+ export async function updateEmployee(c: UiduClient, v: UpdateEmployeeMutationVariables) {
124
+ return (await c.mutate(UpdateEmployeeDocument, v)).updateEmployee ?? null;
125
+ }
126
+ export async function createEmployment(c: UiduClient, v: CreateEmploymentMutationVariables) {
127
+ return (await c.mutate(CreateEmploymentDocument, v)).createEmployment ?? null;
128
+ }
129
+ export async function updateEmployment(c: UiduClient, v: UpdateEmploymentMutationVariables) {
130
+ return (await c.mutate(UpdateEmploymentDocument, v)).updateEmployment ?? null;
131
+ }
132
+ export async function deleteEmployment(c: UiduClient, v: DeleteEmploymentMutationVariables) {
133
+ return (await c.mutate(DeleteEmploymentDocument, v)).deleteEmployment ?? null;
134
+ }
135
+
136
+ /**
137
+ * Terminate (cessazione) an employment by closing it with an end date and
138
+ * reason. Thin semantic wrapper over {@link updateEmployment}.
139
+ * `endReason` is one of: resignation, termination, contract_end, retirement, other.
140
+ */
141
+ export async function terminateEmployment(
142
+ c: UiduClient,
143
+ args: { id: string; endDate: string; endReason?: string },
144
+ ) {
145
+ return updateEmployment(c, {
146
+ input: {
147
+ id: args.id,
148
+ attributes: { endDate: args.endDate, endReason: args.endReason },
149
+ },
150
+ });
151
+ }
152
+
104
153
  // --- Knowledge base ---
105
154
  export async function createKbCollection(c: UiduClient, v: CreateKbCollectionMutationVariables) {
106
155
  return (await c.mutate(CreateKbCollectionDocument, v)).createKbCollection ?? null;
@@ -1,5 +1,22 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { weekStartFor } from './people';
1
+ import { describe, expect, it, vi } from 'vitest';
2
+ import type { UiduClient } from './client';
3
+ import {
4
+ type EmployeeContracts,
5
+ contractEvents,
6
+ listCcnls,
7
+ listRoles,
8
+ weekStartFor,
9
+ } from './people';
10
+
11
+ /** Minimal fake client whose `query` returns a fixed `currentWorkspace` payload. */
12
+ function fakeClient(currentWorkspace: unknown) {
13
+ const query = vi.fn().mockResolvedValue({ currentWorkspace });
14
+ return { client: { query } as unknown as UiduClient, query };
15
+ }
16
+
17
+ function circleEdges(...circles: Array<{ id: string; name: string; kind: string }>) {
18
+ return { circles: { edges: circles.map((node) => ({ node })) } };
19
+ }
3
20
 
4
21
  describe('weekStartFor', () => {
5
22
  it('returns the week Monday for a Wednesday', () => {
@@ -26,3 +43,98 @@ describe('weekStartFor', () => {
26
43
  expect(weekStartFor(date)).toBe('2026-07-27');
27
44
  });
28
45
  });
46
+
47
+ describe('listRoles', () => {
48
+ it('keeps only role-Circles and drops org-unit circles', async () => {
49
+ const { client } = fakeClient(
50
+ circleEdges(
51
+ { id: '1', name: 'Engineering', kind: 'circle' },
52
+ { id: '2', name: 'Developer', kind: 'role' },
53
+ { id: '3', name: 'Designer', kind: 'role' },
54
+ ),
55
+ );
56
+ const roles = await listRoles(client);
57
+ expect(roles.map((r) => r.name)).toEqual(['Developer', 'Designer']);
58
+ });
59
+ });
60
+
61
+ describe('listCcnls', () => {
62
+ it('queries kinds scoped to the Ccnl model', async () => {
63
+ const { client, query } = fakeClient({ kinds: { edges: [] } });
64
+ await listCcnls(client);
65
+ expect(query).toHaveBeenCalledTimes(1);
66
+ const variables = query.mock.calls[0][1];
67
+ expect(variables).toMatchObject({ models: ['Ccnl'] });
68
+ });
69
+ });
70
+
71
+ describe('contractEvents', () => {
72
+ const employees: EmployeeContracts[] = [
73
+ {
74
+ id: 'e1',
75
+ name: 'Alice',
76
+ employments: [
77
+ // deliberately out of order to exercise the sort
78
+ {
79
+ id: 'c2',
80
+ startDate: '2024-06-01',
81
+ endDate: '2025-03-31',
82
+ endReason: 'contract_end',
83
+ jobTitle: 'Senior Dev',
84
+ contractType: 'determinato',
85
+ },
86
+ {
87
+ id: 'c1',
88
+ startDate: '2022-01-15',
89
+ endDate: null,
90
+ endReason: null,
91
+ jobTitle: 'Dev',
92
+ contractType: 'indeterminato',
93
+ },
94
+ ],
95
+ },
96
+ {
97
+ id: 'e2',
98
+ name: 'Bob',
99
+ employments: [
100
+ {
101
+ id: 'c3',
102
+ startDate: null, // no start date → ignored
103
+ endDate: null,
104
+ endReason: null,
105
+ jobTitle: null,
106
+ contractType: null,
107
+ },
108
+ ],
109
+ },
110
+ ];
111
+
112
+ it('classifies first contract as hire and later ones as variation', () => {
113
+ const events = contractEvents(employees);
114
+ const alice = events.filter((e) => e.employeeId === 'e1');
115
+ expect(alice.find((e) => e.employmentId === 'c1')?.type).toBe('hire');
116
+ // c2 yields both a variation (on its start) and a termination (on its end).
117
+ const c2Types = alice.filter((e) => e.employmentId === 'c2').map((e) => e.type);
118
+ expect(c2Types).toContain('variation');
119
+ expect(c2Types).not.toContain('hire');
120
+ });
121
+
122
+ it('emits a termination event for contracts with an end date', () => {
123
+ const events = contractEvents(employees);
124
+ const term = events.find((e) => e.type === 'termination');
125
+ expect(term).toMatchObject({
126
+ employmentId: 'c2',
127
+ date: '2025-03-31',
128
+ month: '2025-03',
129
+ endReason: 'contract_end',
130
+ });
131
+ });
132
+
133
+ it('ignores contracts without a start date and sorts most-recent first', () => {
134
+ const events = contractEvents(employees);
135
+ // Bob's undated contract produces no events.
136
+ expect(events.some((e) => e.employeeId === 'e2')).toBe(false);
137
+ const dates = events.map((e) => e.date);
138
+ expect(dates).toEqual([...dates].sort().reverse());
139
+ });
140
+ });