import { Model, Query } from 'pinia-orm' import { Ability } from '@casl/ability' import { Store } from 'pinia' import DataPersister from '~/services/data/dataPersister' import DataProvider from '~/services/data/dataProvider' import DataDeleter from '~/services/data/dataDeleter' import { ABILITIES, FORM_FUNCTION, GENDER, METADATA_TYPE, QUERY_TYPE, TYPE_ALERT, } from '~/types/enums' import ApiResource from "~/models/ApiResource"; import {AnyJson} from "~/types/data"; /** * Upgrade du @nuxt/types pour TypeScript */ declare module '@nuxt/types' { interface Context { $ability: Ability $dataPersister: DataPersister $dataProvider: DataProvider $dataDeleter: DataDeleter } } declare module '@vuex-orm/core' { interface Query { getAllRelations: () => Array } } interface IconItem { name?: string avatarId?: number | null avatarByDefault?: string } interface ItemMenu { title: string icon?: IconItem avatar?: number to?: string // eslint-disable-next-line no-use-before-define children?: ItemsMenu isExternalLink?: boolean // eslint-disable-next-line no-use-before-define actions?: ItemsMenu active?: boolean } type ItemsMenu = Array interface Menu { getMenu: () => ItemMenu | null getHeaderMenu: () => ItemMenu | null } interface AbilitiesType { action: ABILITIES subject: string /** an array of fields to which user has (or not) access */ fields?: string[] /** an object of conditions which restricts the rule scope */ conditions?: any /** indicates whether rule allows or forbids something */ inverted?: boolean /** message which explains why rule is forbidden */ reason?: string } interface formState { violations: AnyJson readonly: boolean formFunction: FORM_FUNCTION dirty: boolean showConfirmToLeave: boolean goAfterLeave: string | null } interface Alert { type: TYPE_ALERT messages: Array } interface pageState { alerts: Array } interface ormState { initialValues: Map> } interface Historical { future?: boolean past?: boolean present?: boolean dateStart?: string dateEnd?: string } interface baseAccessState { id: number | null name: string | null givenName: string | null gender: GENDER | null avatarId: number | null } interface baseOrganizationState { id: number | null name: string | null website?: string | null } interface OrignalAccessState extends baseAccessState { isSuperAdminAccess: boolean organization: baseOrganizationState } interface accessState extends baseAccessState { bearer: string | null switchId: number | null activityYear: number | null historical: Historical | Array roles: Array abilities: Array isAdminAccess: boolean | null isSuperAdminAccess: boolean | null isAdmin: boolean | null isAdministratifManager: boolean | null isPedagogicManager: boolean | null isFinancialManager: boolean | null isCaMember: boolean | null isStudent: boolean | null isTeacher: boolean | null isMember: boolean | null isOther: boolean | null isGuardian: boolean | null isPayor: boolean | null hasLateralMenu: boolean | null hasConfigurationMenu: boolean | null hasAccessesMenu: boolean | null hasFamilyMenu: boolean | null multiAccesses: Array familyAccesses: Array originalAccess: OrignalAccessState | null } interface organizationState extends baseOrganizationState { id: number | null parametersId: number | null name: string | null product?: string | null currentActivityYear?: number | null modules?: Array hasChildren?: boolean | null showAdherentList?: boolean | null legalStatus?: string | null networks: Array parents: Array } type AnyStore = Store interface EnumChoice { value: string label: string } interface Filter { readonly key: string readonly value: string | boolean | number } type EnumChoices = Array interface HookProvider { invoke(args: DataProviderArgs): Promise } interface HookPersister { invoke(args: DataPersisterArgs): Promise } interface HookDeleter { invoke(args: DataDeleterArgs): Promise } interface Processor { process(data: AnyJson): Promise } interface Normalizer { normalize(args: DataPersisterArgs): any } interface Denormalizer { denormalize(data: any): any } interface DolibarrContractLine { id: number contractId: number dateStart: Date dateEnd: Date serviceRef: string serviceLabel: string } interface DolibarrContract { ref: string socId: number lines: Array } interface DolibarrBill { id: number ref: string socId: number date: Date taxExcludedAmount: number taxIncludedAmount: number paid: boolean } interface DolibarrAccount { organizationId: number socId: number clientNumber: string product: | 'PRODUCT_ARTIST' | 'PRODUCT_ARTIST_PREMIUM' | 'PRODUCT_SCHOOL' | 'PRODUCT_SCHOOL_PREMIUM' | 'PRODUCT_MANAGER' contract: DolibarrContract bills: Array } interface MobytUserStatus { organizationId: number active: boolean amount: number money: number } interface MercureEntityUpdate { iri: string operation: 'create' | 'delete' | 'update' data: any } interface sseState { connected: boolean events: Array }