| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- import {Model} from "@vuex-orm/core";
- import {Ability} from "@casl/ability";
- import DataPersister from "~/services/dataPersister/dataPersister";
- import DataProvider from "~/services/dataProvider/dataProvider";
- import DataDeleter from "~/services/dataDeleter/dataDeleter";
- import {Store} from "vuex";
- import {ABILITIES, GENDER, QUERY_TYPE, TYPE_ALERT} from "~/types/enums";
- import {Context} from "@nuxt/types/app";
- /**
- * Upgrade du @nuxt/types pour TypeScript
- */
- declare module '@nuxt/types' {
- interface Context {
- $ability: Ability,
- $dataPersister: DataPersister,
- $dataProvider: DataProvider,
- $dataDeleter: DataDeleter,
- }
- }
- interface ItemMenu {
- title: string,
- icon?: string,
- to?: string,
- children?: ItemsMenu,
- isExternalLink?: boolean,
- }
- interface ItemsMenu extends Array<ItemMenu> {}
- 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 {
- dirty: boolean,
- showConfirmToLeave: boolean,
- goAfterLeave: string
- }
- interface alert{
- type: TYPE_ALERT,
- message: string
- }
- interface pageState {
- alerts: Array<alert>,
- }
- interface baseAccessState {
- id: number,
- name: string,
- givenName: string,
- gender: GENDER,
- avatarId: number
- }
- interface accessState extends baseAccessState{
- bearer: string,
- switchId: number,
- activityYear: number,
- roles: Array<string>,
- abilities: Array<AbilitiesType>,
- isAdminAccess: boolean,
- isAdmin: boolean,
- isAdministratifManager: boolean,
- isPedagogicManager: boolean,
- isFinancialManager: boolean,
- isCaMember: boolean,
- isStudent: boolean,
- isTeacher: boolean,
- isMember: boolean,
- isOther: boolean,
- hasLateralMenu: boolean,
- hasConfigurationMenu: boolean,
- hasAccessesMenu: boolean,
- hasFamilyMenu: boolean,
- multiAccesses: Array<baseOrganizationState>,
- familyAccesses: Array<baseAccessState>,
- originalAccess: baseAccessState
- }
- interface AccessStore extends Store<{profile:{access:accessState}}> {}
- interface baseOrganizationState {
- id: number,
- name: string,
- website?: string,
- subDomain?: string
- }
- interface organizationState extends baseOrganizationState{
- id: number,
- name: string,
- product?: string,
- modules?: Array<string>,
- hasChildren?: boolean,
- networks: Array<string>,
- parents: Array<organizationState>,
- }
- interface OrganizationStore extends Store<{profile:{organization:organizationState}}> {}
- interface AnyJson extends Record<string, any> {}
- interface AnyStore extends Store<any> {}
- interface EnumChoice {
- value: string,
- label: string
- }
- interface EnumChoices extends Array<EnumChoice> {}
- interface UrlArgs {
- readonly type: QUERY_TYPE,
- readonly url?:string,
- readonly enumType?:string,
- readonly model?: typeof Model,
- readonly root_model?: typeof Model,
- readonly id?:any,
- readonly root_id?:number
- readonly progress?:boolean
- }
- interface DataPersisterArgs extends UrlArgs{
- data?:AnyJson,
- readonly hook?:string
- }
- interface DataDeleterArgs extends UrlArgs{
- readonly hook?:string
- }
- interface HookPersister{
- invoke(args:DataPersisterArgs): Promise<any>,
- }
- interface HookDeleter{
- invoke(args:DataDeleterArgs): Promise<any>,
- }
- interface DataProviderArgs extends UrlArgs{
- readonly hook?:string
- }
- interface HookProvider{
- invoke(args:DataProviderArgs): Promise<any>,
- }
- interface Provider{
- invoke(data: AnyJson): Promise<any>,
- }
- interface Denormalizer{
- denormalize(data:any): any,
- }
- interface Normalizer{
- normalize(args:DataPersisterArgs): any,
- }
- interface DataProviders{
- initCtx(ctx:Context): void,
- invoke(args:DataProviderArgs): Promise<any>,
- }
|