@uidu/client 3.1.1 → 3.2.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.2.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,58 @@ 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 ListKindsQueryVariables = Exact<{
49846
+ models: Array<Scalars['String']['input']> | Scalars['String']['input'];
49847
+ first?: InputMaybe<Scalars['Int']['input']>;
49848
+ after?: InputMaybe<Scalars['String']['input']>;
49849
+ }>;
49850
+
49851
+
49852
+ 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 };
49853
+
49854
+ export type ListOfficesQueryVariables = Exact<{
49855
+ first?: InputMaybe<Scalars['Int']['input']>;
49856
+ after?: InputMaybe<Scalars['String']['input']>;
49857
+ }>;
49858
+
49859
+
49860
+ 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 };
49861
+
49862
+ export type CreateEmployeeMutationVariables = Exact<{
49863
+ input: CreateEmployeeInput;
49864
+ }>;
49865
+
49866
+
49867
+ 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 };
49868
+
49869
+ export type UpdateEmployeeMutationVariables = Exact<{
49870
+ input: UpdateEmployeeInput;
49871
+ }>;
49872
+
49873
+
49874
+ 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 };
49875
+
49876
+ export type CreateEmploymentMutationVariables = Exact<{
49877
+ input: CreateEmploymentInput;
49878
+ }>;
49879
+
49880
+
49881
+ 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 };
49882
+
49883
+ export type UpdateEmploymentMutationVariables = Exact<{
49884
+ input: UpdateEmploymentInput;
49885
+ }>;
49886
+
49887
+
49888
+ 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 };
49889
+
49890
+ export type DeleteEmploymentMutationVariables = Exact<{
49891
+ input: DeleteEmploymentInput;
49892
+ }>;
49893
+
49894
+
49895
+ 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 };
49896
+
49837
49897
  export type SearchQueryVariables = Exact<{
49838
49898
  models?: InputMaybe<Array<Scalars['String']['input']> | Scalars['String']['input']>;
49839
49899
  params?: InputMaybe<SearchParams>;
@@ -50007,7 +50067,15 @@ export const CreateNoteDocument = {"kind":"Document","definitions":[{"kind":"Ope
50007
50067
  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
50068
  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
50069
  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>;
50070
+ 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
50071
  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>;
50072
+ 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>;
50073
+ 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>;
50074
+ 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>;
50075
+ 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>;
50076
+ 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>;
50077
+ 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>;
50078
+ 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
50079
  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
50080
  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
50081
  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,17 @@ 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
+ } from './people';
128
+ export type { Employee, Office, Circle, Kind } from './people';
114
129
 
115
130
  export {
116
131
  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,16 @@
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 { listCcnls, listRoles, weekStartFor } from './people';
4
+
5
+ /** Minimal fake client whose `query` returns a fixed `currentWorkspace` payload. */
6
+ function fakeClient(currentWorkspace: unknown) {
7
+ const query = vi.fn().mockResolvedValue({ currentWorkspace });
8
+ return { client: { query } as unknown as UiduClient, query };
9
+ }
10
+
11
+ function circleEdges(...circles: Array<{ id: string; name: string; kind: string }>) {
12
+ return { circles: { edges: circles.map((node) => ({ node })) } };
13
+ }
3
14
 
4
15
  describe('weekStartFor', () => {
5
16
  it('returns the week Monday for a Wednesday', () => {
@@ -26,3 +37,27 @@ describe('weekStartFor', () => {
26
37
  expect(weekStartFor(date)).toBe('2026-07-27');
27
38
  });
28
39
  });
40
+
41
+ describe('listRoles', () => {
42
+ it('keeps only role-Circles and drops org-unit circles', async () => {
43
+ const { client } = fakeClient(
44
+ circleEdges(
45
+ { id: '1', name: 'Engineering', kind: 'circle' },
46
+ { id: '2', name: 'Developer', kind: 'role' },
47
+ { id: '3', name: 'Designer', kind: 'role' },
48
+ ),
49
+ );
50
+ const roles = await listRoles(client);
51
+ expect(roles.map((r) => r.name)).toEqual(['Developer', 'Designer']);
52
+ });
53
+ });
54
+
55
+ describe('listCcnls', () => {
56
+ it('queries kinds scoped to the Ccnl model', async () => {
57
+ const { client, query } = fakeClient({ kinds: { edges: [] } });
58
+ await listCcnls(client);
59
+ expect(query).toHaveBeenCalledTimes(1);
60
+ const variables = query.mock.calls[0][1];
61
+ expect(variables).toMatchObject({ models: ['Ccnl'] });
62
+ });
63
+ });
package/src/people.ts CHANGED
@@ -3,15 +3,54 @@ import {
3
3
  GetEmployeeDocument,
4
4
  type GetEmployeeQuery,
5
5
  type GetEmployeeQueryVariables,
6
+ ListCirclesDocument,
7
+ type ListCirclesQuery,
8
+ type ListCirclesQueryVariables,
6
9
  ListEmployeesDocument,
7
10
  type ListEmployeesQueryVariables,
11
+ ListKindsDocument,
12
+ type ListKindsQuery,
13
+ type ListKindsQueryVariables,
14
+ ListOfficesDocument,
15
+ type ListOfficesQuery,
16
+ type ListOfficesQueryVariables,
8
17
  } from './generated';
18
+
9
19
  import { nodes } from './utils/relay';
10
20
 
11
21
  export type Employee = NonNullable<
12
22
  NonNullable<GetEmployeeQuery['currentWorkspace']>['employee']
13
23
  >;
14
24
 
25
+ export type Circle = NonNullable<
26
+ NonNullable<
27
+ NonNullable<
28
+ NonNullable<
29
+ NonNullable<ListCirclesQuery['currentWorkspace']>['circles']
30
+ >['edges']
31
+ >[number]
32
+ >['node']
33
+ >;
34
+ export type Office = NonNullable<
35
+ NonNullable<
36
+ NonNullable<
37
+ NonNullable<
38
+ NonNullable<ListOfficesQuery['currentWorkspace']>['offices']
39
+ >['edges']
40
+ >[number]
41
+ >['node']
42
+ >;
43
+ /** A `Kind` record — CCNLs (national collective labor contracts) are Kinds. */
44
+ export type Kind = NonNullable<
45
+ NonNullable<
46
+ NonNullable<
47
+ NonNullable<
48
+ NonNullable<ListKindsQuery['currentWorkspace']>['kinds']
49
+ >['edges']
50
+ >[number]
51
+ >['node']
52
+ >;
53
+
15
54
  export async function listEmployees(
16
55
  client: UiduClient,
17
56
  variables: ListEmployeesQueryVariables = {},
@@ -41,3 +80,57 @@ export function weekStartFor(date: Date = new Date()): string {
41
80
  d.setUTCDate(d.getUTCDate() - diff);
42
81
  return d.toISOString().slice(0, 10);
43
82
  }
83
+
84
+ // --- Reference data (for populating employment forms) ---
85
+
86
+ /** List the workspace offices — used for an employment's `employmentOfficesAttributes`. */
87
+ export async function listOffices(
88
+ client: UiduClient,
89
+ variables: ListOfficesQueryVariables = {},
90
+ ): Promise<Office[]> {
91
+ const result = await client.query(ListOfficesDocument, variables);
92
+ return nodes(result.currentWorkspace?.offices);
93
+ }
94
+
95
+ /**
96
+ * List the workspace circles. Circles come in two flavours distinguished by
97
+ * `kind`: org units (e.g. departments — used as an employment's `circleId`) and
98
+ * roles (`kind === 'role'` — used as an employment's `roleId`). Use
99
+ * {@link listRoles} when you only want the role-Circles.
100
+ */
101
+ export async function listCircles(
102
+ client: UiduClient,
103
+ variables: ListCirclesQueryVariables = {},
104
+ ): Promise<Circle[]> {
105
+ const result = await client.query(ListCirclesDocument, variables);
106
+ return nodes(result.currentWorkspace?.circles);
107
+ }
108
+
109
+ /** List only the role-Circles (structured job titles) — an employment's `roleId`. */
110
+ export async function listRoles(
111
+ client: UiduClient,
112
+ variables: ListCirclesQueryVariables = {},
113
+ ): Promise<Circle[]> {
114
+ const circles = await listCircles(client, variables);
115
+ return circles.filter((c) => c.kind === 'role');
116
+ }
117
+
118
+ /** List `Kind` records for the given polymorphic models. */
119
+ export async function listKinds(
120
+ client: UiduClient,
121
+ variables: ListKindsQueryVariables,
122
+ ): Promise<Kind[]> {
123
+ const result = await client.query(ListKindsDocument, variables);
124
+ return nodes(result.currentWorkspace?.kinds);
125
+ }
126
+
127
+ /**
128
+ * List the CCNLs (national collective labor contracts) configured for the
129
+ * workspace — used for an employment's `ccnlId`.
130
+ */
131
+ export async function listCcnls(
132
+ client: UiduClient,
133
+ variables: Omit<ListKindsQueryVariables, 'models'> = {},
134
+ ): Promise<Kind[]> {
135
+ return listKinds(client, { ...variables, models: ['Ccnl'] });
136
+ }
@@ -0,0 +1,17 @@
1
+ query ListCircles($first: Int, $after: String) {
2
+ currentWorkspace {
3
+ circles(first: $first, after: $after) {
4
+ pageInfo {
5
+ hasNextPage
6
+ endCursor
7
+ }
8
+ edges {
9
+ node {
10
+ id
11
+ name
12
+ kind
13
+ }
14
+ }
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,18 @@
1
+ query ListKinds($models: [String!]!, $first: Int, $after: String) {
2
+ currentWorkspace {
3
+ kinds(models: $models, first: $first, after: $after) {
4
+ pageInfo {
5
+ hasNextPage
6
+ endCursor
7
+ }
8
+ edges {
9
+ node {
10
+ id
11
+ name
12
+ code
13
+ model
14
+ }
15
+ }
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,16 @@
1
+ query ListOffices($first: Int, $after: String) {
2
+ currentWorkspace {
3
+ offices(first: $first, after: $after) {
4
+ pageInfo {
5
+ hasNextPage
6
+ endCursor
7
+ }
8
+ edges {
9
+ node {
10
+ id
11
+ name
12
+ }
13
+ }
14
+ }
15
+ }
16
+ }