Kaynağa Gözat

documentation

Vincent GUFFON 4 yıl önce
ebeveyn
işleme
df1103705a

+ 4 - 3
components/Form/InputComponent.vue

@@ -16,7 +16,8 @@
 <script lang="ts">
   import {unref, defineComponent, ref, useFetch, watch, onUnmounted, useContext} from '@nuxtjs/composition-api'
   import {Query} from "@vuex-orm/core";
-  import {cloneAndFlatten, cloneAndNest} from "~/services/utils/objectProperties";
+  import {$objectProperties} from "~/services/utils/objectProperties";
+  import {AnyJson} from "~/types/types";
 
   export default defineComponent({
     props: {
@@ -39,11 +40,11 @@
 
       const { fetch, fetchState } = useFetch(async () => {
         const entry = await query.find(parseInt(route.value.params.id));
-        data.value = cloneAndFlatten(entry);
+        data.value = $objectProperties.cloneAndFlatten(entry as AnyJson);
       })
 
       const update = () => {
-        query.update(cloneAndNest(unref(data)))
+        query.update($objectProperties.cloneAndNest(unref(data)))
       }
 
       /* const unwatch = watch(

+ 2 - 3
plugins/Queries/rest.ts

@@ -1,5 +1,5 @@
 import {Plugin} from '@nuxt/types'
-import HydraParser from '../../services/utils/hydraParser'
+import  {$hydraParser} from '../../services/utils/hydraParser'
 import {AnyJson} from "~/types/types";
 
 declare module '@nuxt/types' {
@@ -23,8 +23,7 @@ const restPlugin: Plugin = (ctx) => {
   const queries = async (responseQuery: any) => {
     try {
       let response = await responseQuery.json();
-      const hydra = new HydraParser();
-      return hydra.parse(response);
+      return $hydraParser.parse(response);
     } catch (err) {
       console.log(err)
     }

+ 4 - 4
services/profile/accessProfile.ts

@@ -24,7 +24,7 @@ class AccessProfile{
   /**
    * Est ce que l'utilisateur possède le role.
    * @param {Array<string>} roles roles à tester
-   * @returns {boolean}
+   * @return {boolean}
    */
   hasRole(roles:Array<string>): boolean{
     if (null === roles)
@@ -41,7 +41,7 @@ class AccessProfile{
   /**
    * Est-ce que l'utilisateur possède l'abilité
    * @param {Array<AbilitiesType>} ability abilité à tester
-   * @returns {boolean}
+   * @return {boolean}
    */
   hasAbility(ability:Array<AbilitiesType>): boolean{
     if(ability === null)
@@ -57,7 +57,7 @@ class AccessProfile{
 
   /**
    * Factory
-   * @returns {AnyJson} retourne les fonction rendues publiques
+   * @return {AnyJson} retourne les fonction rendues publiques
    */
   handler():AnyJson{
     return {
@@ -67,5 +67,5 @@ class AccessProfile{
   }
 }
 
-export const accessProfile = (store:AccessStore, ability:Ability) => new AccessProfile(store, ability);
+export const $accessProfile = (store:AccessStore, ability:Ability) => new AccessProfile(store, ability);
 

+ 11 - 11
services/profile/organizationProfile.ts

@@ -19,7 +19,7 @@ class OrganizationProfile{
   /**
    * Est-ce que l'organisation possède le module
    * @param {Array<string>} modules Modules à tester
-   * @returns {boolean}
+   * @return {boolean}
    */
   hasModule(modules:Array<string>) {
     let hasModule = false;
@@ -32,7 +32,7 @@ class OrganizationProfile{
 
   /**
    * L'organization possède t'elle un produit school ou school premium
-   * @returns {boolean}
+   * @return {boolean}
    */
   isSchool():boolean {
     return this.isSchoolProduct() || this.isSchoolPremiumProduct();
@@ -40,7 +40,7 @@ class OrganizationProfile{
 
   /**
    * L'organization possède t'elle un produit artiste ou artiste premium
-   * @returns {boolean}
+   * @return {boolean}
    */
   isArtist():boolean {
     return this.isArtistProduct() || this.isArtistPremiumProduct();
@@ -48,7 +48,7 @@ class OrganizationProfile{
 
   /**
    * L'organization possède t'elle un produit school
-   * @returns {boolean}
+   * @return {boolean}
    */
   isSchoolProduct() {
     return this.organizationProfile.product === process.env.school_product
@@ -56,7 +56,7 @@ class OrganizationProfile{
 
   /**
    * L'organization possède t'elle un produit school premium
-   * @returns {boolean}
+   * @return {boolean}
    */
   isSchoolPremiumProduct() {
     return this.organizationProfile.product === process.env.school_premium_product
@@ -64,7 +64,7 @@ class OrganizationProfile{
 
   /**
    * L'organization possède t'elle un produit premium
-   * @returns {boolean}
+   * @return {boolean}
    */
   isArtistProduct() {
     return this.organizationProfile.product === process.env.artist_product
@@ -72,7 +72,7 @@ class OrganizationProfile{
 
   /**
    * L'organization possède t'elle un produit artiste premium
-   * @returns {boolean}
+   * @return {boolean}
    */
   isArtistPremiumProduct() {
     return this.organizationProfile.product === process.env.artist_premium_product
@@ -80,7 +80,7 @@ class OrganizationProfile{
 
   /**
    * L'organization possède t'elle un produit manager
-   * @returns {boolean}
+   * @return {boolean}
    */
   isManagerProduct() {
     return this.organizationProfile.product === process.env.manager_product
@@ -88,7 +88,7 @@ class OrganizationProfile{
 
   /**
    * L'organization possède t'elledes enfants
-   * @returns {boolean}
+   * @return {boolean}
    */
   isOrganizationWithChildren(){
     return this.organizationProfile.hasChildren;
@@ -96,7 +96,7 @@ class OrganizationProfile{
 
   /**
    * Factory
-   * @returns {AnyJson} retourne les fonction rendues publiques
+   * @return {AnyJson} retourne les fonction rendues publiques
    */
   handler():AnyJson{
     return {
@@ -109,5 +109,5 @@ class OrganizationProfile{
   }
 }
 
-export const organizationProfile = (store:OrganizationStore) => new OrganizationProfile(store);
+export const $organizationProfile = (store:OrganizationStore) => new OrganizationProfile(store);
 

+ 12 - 12
services/rights/abilitiesUtils.ts

@@ -1,9 +1,9 @@
-import {accessProfile} from "@/services/profile/accessProfile"
-import {organizationProfile} from "@/services/profile/organizationProfile"
+import {$accessProfile} from "@/services/profile/accessProfile"
+import {$organizationProfile} from "@/services/profile/organizationProfile"
 import {$roleUtils} from "~/services/rights/roleUtils";
 import {AbilitiesType, AccessStore, AnyJson, AnyStore} from "~/types/types";
 import {Ability} from "@casl/ability";
-import YamlParser from "~/services/utils/yamlParser";
+import {$yamlParser} from "~/services/utils/yamlParser";
 import * as _ from "lodash";
 
 /**
@@ -29,14 +29,14 @@ class AbilitiesUtils {
    */
   initFactory() {
     this.factory = {
-      access: accessProfile(this.$store, this.$ability),
-      organization: organizationProfile(this.$store)
+      access: $accessProfile(this.$store, this.$ability),
+      organization: $organizationProfile(this.$store)
     }
   }
 
   /**
    * Récupération de l'ensemble des abilities quelles soient par Roles ou par Config.
-   * @returns {Array<AbilitiesType>}
+   * @return {Array<AbilitiesType>}
    */
   getAbilities():Array<AbilitiesType> {
     const abilitiesByRoles = this.getAbilitiesByRoles(this.$store.state.profile.access.roles)
@@ -48,7 +48,7 @@ class AbilitiesUtils {
   /**
    * Adaptation et transformations des roles en abilities
    * @param {Array<string>} roles
-   * @returns {Array<AbilitiesType>}
+   * @return {Array<AbilitiesType>}
    */
   getAbilitiesByRoles(roles: Array<string>): Array<AbilitiesType> {
     roles = $roleUtils.transformUnderscoreToHyphenBeforeCompleteMigration(roles);
@@ -60,12 +60,12 @@ class AbilitiesUtils {
    * - filtres la config pour ne garder que les abilities autorisées
    * - transform la config restante en Object Abilities
    * @param {string} configPath
-   * @returns {Array<AbilitiesType>}
+   * @return {Array<AbilitiesType>}
    */
   getAbilitiesByConfig(configPath:string): Array<AbilitiesType> {
     let abilitiesByConfig: Array<AbilitiesType> = []
    try {
-      const doc = YamlParser.parse(configPath);
+      const doc = $yamlParser.parse(configPath);
       const abilitiesAvailable = doc['abilities']
       const abilitiesFiltered = this.abilitiesAvailableFilter(abilitiesAvailable)
       abilitiesByConfig = this.transformAbilitiesConfigToAbility(abilitiesFiltered)
@@ -78,7 +78,7 @@ class AbilitiesUtils {
   /**
    * Filtre toutes les abilities possible suivant si l'utilisateur est autorisé ou non à les posséder
    * @param {AnyJson} abilitiesAvailable
-   * @returns {AnyJson}
+   * @return {AnyJson}
    */
   abilitiesAvailableFilter(abilitiesAvailable:AnyJson):AnyJson{
     return _.pickBy(abilitiesAvailable, (ability:any) =>{
@@ -90,7 +90,7 @@ class AbilitiesUtils {
   /**
    * Transform une config d'abilities en un tableau d'Abilities
    * @param {AnyJson} abilitiesAvailable
-   * @returns {Array<AbilitiesType>}
+   * @return {Array<AbilitiesType>}
    */
   transformAbilitiesConfigToAbility(abilitiesAvailable:AnyJson):Array<AbilitiesType>{
     let abilitiesByConfig: Array<AbilitiesType> = []
@@ -107,7 +107,7 @@ class AbilitiesUtils {
   /**
    * Parcours les fonctions par services et établit si oui ou non l'abilité est autorisée
    * @param {AnyJson} functionByservices
-   * @returns {boolean}
+   * @return {boolean}
    */
   canHaveTheAbility(functionByservices: AnyJson) {
     let hasAbility = true;

+ 4 - 4
services/rights/roleUtils.ts

@@ -62,7 +62,7 @@ class RoleUtils {
    * Test si une personne possède le role lui permettant d'acquérir la fonction
    * @param {string} function_name
    * @param {Array<string>} roles
-   * @returns {boolean}
+   * @return {boolean}
    */
   isA(function_name:string, roles:Array<string>): boolean {
     return roles.indexOf('ROLE_' + function_name + '_CORE') >= 0
@@ -71,7 +71,7 @@ class RoleUtils {
   /**
    * Filtre les roles afin d'en exclure les "Roles fonctions"
    * @param {Array<string>} roles
-   * @returns {Array<string>}
+   * @return {Array<string>}
    */
   filterFunctionRoles(roles:Array<string>):Array<string>{
     return roles.filter(role => {
@@ -82,7 +82,7 @@ class RoleUtils {
   /**
    * Avant la migration complète, quelque role disposent d'underscore en trop, on corrige cela...
    * @param {Array<string>} roles
-   * @returns {Array<string>}
+   * @return {Array<string>}
    */
   transformUnderscoreToHyphenBeforeCompleteMigration(roles: Array<string>): Array<string> {
     const regex = /(ROLE\_)([A-Z]*\_[A-Z]*)([A-Z\_]*)*/i;
@@ -104,7 +104,7 @@ class RoleUtils {
   /**
    * On transforme les ROLES Symfony en Abilities
    * @param {Array<string>} roles
-   * @returns {Array<AbilitiesType>}
+   * @return {Array<AbilitiesType>}
    */
   transformRoleToAbilities(roles: Array<string>): [] | Array<AbilitiesType> {
     let abilities:any = [];

+ 71 - 45
services/utils/hydraParser.ts

@@ -1,64 +1,62 @@
 import {AnyJson} from "~/types/types";
 
-export default class HydraParser {
-  constructor() {
-  }
-
-  parse(response: AnyJson): AnyJson {
-    if (response['hydra:member']) {
-      response.totalCount = response['hydra:totalItems'];
-      return this.parseCollection(response);
+/**
+ * @category Services/utils
+ * @class HydraParser
+ * Classe permettant d'assurer le parsing d'une réponse Hydra
+ */
+class HydraParser {
+  /**
+   * Parcours une réponse Hydra pour retourner son équivalent en Json
+   * @param {AnyJson} hydraData
+   * @return {AnyJson} réponse parsée
+   */
+  parse(hydraData: AnyJson): AnyJson {
+    if (hydraData['hydra:member']) {
+      hydraData.totalCount = hydraData['hydra:totalItems'];
+      return this.parseCollection(hydraData);
     } else {
-      return this.parseItem(response);
-    }
-  }
-
-  populateId(data: AnyJson) {
-    if (data['@id'] && data['@id'] instanceof String) {
-      var iriParts = data['@id'].split('/');
-      data.id = iriParts[iriParts.length - 1];
-    }
-  }
-
-  populateAllData(data: AnyJson):void {
-    this.populateId(data);
-    for (const key in data) {
-      const value = data[key];
-      if (value instanceof Object) {
-        this.populateAllData(value);
-      }
+      return this.parseItem(hydraData);
     }
   }
 
-  parseItem(data: AnyJson): AnyJson {
-    this.populateId(data);
+  /**
+   * Méthode de parsing appelé si on est dans un GET
+   * @param {AnyJson} hydraData
+   */
+  parseItem(hydraData: AnyJson): AnyJson {
+    this.populateId(hydraData);
 
-    if (data['hydra:previous']) {
-      let iriParts = data['hydra:previous'].split('/');
-      data.previous = iriParts[iriParts.length - 1];
+    if (hydraData['hydra:previous']) {
+      let iriParts = hydraData['hydra:previous'].split('/');
+      hydraData.previous = iriParts[iriParts.length - 1];
     }
-    if (data['hydra:next']) {
-      let iriParts = data['hydra:next'].split('/');
-      data.next = iriParts[iriParts.length - 1];
+    if (hydraData['hydra:next']) {
+      let iriParts = hydraData['hydra:next'].split('/');
+      hydraData.next = iriParts[iriParts.length - 1];
     }
-    if (data['hydra:totalItems']) {
-      data.totalItems = data['hydra:totalItems'];
+    if (hydraData['hydra:totalItems']) {
+      hydraData.totalItems = hydraData['hydra:totalItems'];
     }
-    if (data['hydra:itemPosition']) {
-      data.itemPosition = data['hydra:itemPosition'];
+    if (hydraData['hydra:itemPosition']) {
+      hydraData.itemPosition = hydraData['hydra:itemPosition'];
     }
-    return data;
+    return hydraData;
   }
 
-  parseCollection(data: AnyJson): AnyJson {
-    let collectionResponse = data['hydra:member'];
+  /**
+   * Méthode de parsing appelé si on est dans un GET Collection
+   * @param {AnyJson} hydraData
+   */
+  parseCollection(hydraData: AnyJson): AnyJson {
+    let collectionResponse = hydraData['hydra:member'];
     collectionResponse.metadata = {};
     collectionResponse.order = {};
     collectionResponse.search = {};
 
     // Put metadata in a property of the collection
-    for (const key in data) {
-      const value = data[key];
+    for (const key in hydraData) {
+      const value = hydraData[key];
       if ('hydra:member' !== key) {
         collectionResponse.metadata[key] = value;
       }
@@ -70,8 +68,8 @@ export default class HydraParser {
       this.populateAllData(value);
     }
 
-    if ('undefined' !== typeof (data['hydra:search'])) {
-      let collectionSearch = data['hydra:search']['hydra:mapping'];
+    if ('undefined' !== typeof (hydraData['hydra:search'])) {
+      let collectionSearch = hydraData['hydra:search']['hydra:mapping'];
       for (const key in collectionSearch) {
         const value = collectionSearch[key];
         if (value['variable'].indexOf("filter[order]") === 0) {
@@ -83,4 +81,32 @@ export default class HydraParser {
     }
     return collectionResponse;
   }
+
+
+  /**
+   * Hydrate l'objet Json avec la valeur id correspondant à l'uri de l'objet
+   * @param {AnyJson} data
+   */
+  populateId(data: AnyJson): void{
+    if (data['@id'] && data['@id'] instanceof String) {
+      var iriParts = data['@id'].split('/');
+      data.id = iriParts[iriParts.length - 1];
+    }
+  }
+
+  /**
+   * Hydrate l'objet JSON de façon récursive (afin de gérer les objet nested)
+   * @param {AnyJson} data
+   */
+  populateAllData(data: AnyJson):void {
+    this.populateId(data);
+    for (const key in data) {
+      const value = data[key];
+      if (value instanceof Object) {
+        this.populateAllData(value);
+      }
+    }
+  }
 }
+
+export const $hydraParser = new HydraParser()

+ 0 - 81
services/utils/objectProperties.js

@@ -1,81 +0,0 @@
-function isObject(value) {
-    if (value === null) return false;
-    if (typeof value !== 'object') return false;
-    if (Array.isArray(value)) return false;
-    if (Object.prototype.toString.call(value) === '[object Date]') return false;
-    return true;
-}
-
-export function clone(object) {
-    return Object.keys(object).reduce((values, name) => {
-        if (object.hasOwnProperty(name)) {
-            values[name] = object[name];
-        }
-        return values;
-    }, {});
-}
-
-/*
- * Flatten nested object into a single level object with 'foo.bar' property names
- *
- * The parameter object is left unchanged. All values in the returned object are scalar.
- *
- *     cloneAndFlatten({ a: 1, b: { c: 2 }, d: { e: 3, f: { g: 4, h: 5 } }, i: { j: 6 } }, ['i'])
- *     // { a: 1, 'b.c': 2, 'd.e': 3, 'd.f.g': 4, 'd.f.h': 5, i: { j: 6 } } }
- *
- * @param {Object} object
- * @param {String[]} excludedProperties
- * @return {Object}
- */
-export function cloneAndFlatten(object, excludedProperties = []) {
-    if (typeof object !== 'object') {
-        throw new Error('Expecting an object parameter');
-    }
-    return Object.keys(object).reduce((values, name) => {
-        if (!object.hasOwnProperty(name)) return values;
-        if (isObject(object[name])) {
-            if (excludedProperties.indexOf(name) === -1) {
-                let flatObject = cloneAndFlatten(object[name]);
-                Object.keys(flatObject).forEach(flatObjectKey => {
-                    if (!flatObject.hasOwnProperty(flatObjectKey)) return;
-                    values[name + '.' + flatObjectKey] = flatObject[flatObjectKey];
-                })
-            } else {
-                values[name] = clone(object[name]);
-            }
-        } else {
-            values[name] = object[name];
-        }
-        return values;
-    }, {});
-};
-
-/*
- * Clone flattened object into a nested object
- *
- * The parameter object is left unchanged.
- *
- *     cloneAndNest({ a: 1, 'b.c': 2, 'd.e': 3, 'd.f.g': 4, 'd.f.h': 5 } )
- *     // { a: 1, b: { c: 2 }, d: { e: 3, f: { g: 4, h: 5 } } }
- *
- * @param {Object} object
- * @return {Object}
- */
-export function cloneAndNest(object) {
-    if (typeof object !== 'object') {
-        throw new Error('Expecting an object parameter');
-    }
-    return Object.keys(object).reduce((values, name) => {
-        if (!object.hasOwnProperty(name)) return values;
-        name.split('.').reduce((previous, current, index, list) => {
-            if (previous != null) {
-                if (typeof previous[current] === 'undefined') previous[current] = {};
-                if (index < (list.length - 1)) {
-                    return previous[current];
-                };
-                previous[current] = object[name];
-            }
-        }, values)
-        return values;
-    }, {})
-}

+ 94 - 0
services/utils/objectProperties.ts

@@ -0,0 +1,94 @@
+/**
+ * @category Services/utils
+ * @class ObjectProperties
+ * Classe aidant à manipuler des Objets
+ */
+import {AnyJson} from "~/types/types";
+
+class ObjectProperties {
+  /**
+   * Flatten un objet nested en un objet avec un seul niveau avec des noms de propriétés transformées comme cela 'foo.bar'
+   * L'objet passé en paramètre reste inchangé car il est cloné
+   * @example  cloneAndFlatten({ a: 1, b: { c: 2 }, d: { e: 3, f: { g: 4, h: 5 } }, i: { j: 6 } }, ['i']) => { a: 1, 'b.c': 2, 'd.e': 3, 'd.f.g': 4, 'd.f.h': 5, i: { j: 6 } } }
+   * @param {AnyJson} object
+   * @param {Array<string>} excludedProperties
+   * @param excludedProperties
+   * @return {AnyJson}
+   */
+  cloneAndFlatten(object:AnyJson, excludedProperties:Array<string> = []):AnyJson {
+    if (typeof object !== 'object') {
+      throw new Error('Expecting an object parameter');
+    }
+    return Object.keys(object).reduce((values: AnyJson, name: string) => {
+      if (!object.hasOwnProperty(name)) return values;
+      if (this.isObject(object[name])) {
+        if (excludedProperties.indexOf(name) === -1) {
+          let flatObject = this.cloneAndFlatten(object[name]);
+          Object.keys(flatObject).forEach(flatObjectKey => {
+            if (!flatObject.hasOwnProperty(flatObjectKey)) return;
+            values[name + '.' + flatObjectKey] = flatObject[flatObjectKey];
+          })
+        } else {
+          values[name] = this.clone(object[name]);
+        }
+      } else {
+        values[name] = object[name];
+      }
+      return values;
+    }, {});
+  };
+
+  /**
+   * Trasnforme un objet flattened en un objet nested. L'objet passé en paramètre reste inchangé
+   * @example cloneAndNest({ a: 1, 'b.c': 2, 'd.e': 3, 'd.f.g': 4, 'd.f.h': 5 } ) => { a: 1, b: { c: 2 }, d: { e: 3, f: { g: 4, h: 5 } } }
+   * @param {AnyJson} object
+   * @return {AnyJson}
+   */
+   cloneAndNest(object:AnyJson):AnyJson {
+    if (typeof object !== 'object') {
+      throw new Error('Expecting an object parameter');
+    }
+    return Object.keys(object).reduce((values, name) => {
+      if (!object.hasOwnProperty(name)) return values;
+      name.split('.').reduce((previous: AnyJson, current: string, index: number, list: Array<string>) => {
+        if (previous != null) {
+          if (typeof previous[current] === 'undefined') previous[current] = {};
+          if (index < (list.length - 1)) {
+            return previous[current];
+          };
+          previous[current] = object[name];
+        }
+      }, values)
+      return values;
+    }, {})
+  }
+
+  /**
+   * Test si le paramètre est un objet
+   * @param {AnyJson} value
+   * @return {boolean}
+   */
+  isObject(value:any):boolean {
+    if (value === null) return false;
+    if (typeof value !== 'object') return false;
+    if (Array.isArray(value)) return false;
+    if (Object.prototype.toString.call(value) === '[object Date]') return false;
+    return true;
+  }
+
+  /**
+   * Clone l'objet et ces propriétés.
+   * @param {Object} object
+   * @return {Object}
+   */
+  clone(object: AnyJson): AnyJson {
+    return Object.keys(object).reduce((values: AnyJson, name: string) => {
+      if (object.hasOwnProperty(name)) {
+        values[name] = object[name];
+      }
+      return values;
+    }, {});
+  }
+}
+
+export const $objectProperties = new ObjectProperties()

+ 15 - 2
services/utils/yamlParser.ts

@@ -2,8 +2,19 @@ import {AnyJson} from "~/types/types";
 import { read } from 'yaml-import';
 const yaml = require('js-yaml');
 
-export default class YamlParser {
-  static parse(inPath: string): AnyJson {
+/**
+ * @category Services/utils
+ * @class YamlParser
+ * Classe permettant d'assurer le parsing d'un fichier Yaml
+ */
+class YamlParser {
+
+  /**
+   * Parse un fichier Yaml pour en retourner son équivalent en Json
+   * @param {string} inPath
+   * @return {AnyJson}
+   */
+  parse(inPath: string): AnyJson {
     try {
       return yaml.load(yaml.dump(read(inPath)));
     }catch (e) {
@@ -12,3 +23,5 @@ export default class YamlParser {
     }
   }
 }
+
+export const $yamlParser = new YamlParser()

+ 2 - 4
test/services/utils/hydraParser.spec.js

@@ -1,8 +1,6 @@
-import HydraParser from "~/services/utils/hydraParser";
+import {$hydraParser} from "~/services/utils/hydraParser";
 
 test('test parseItem', () => {
-  const hydra = new HydraParser()
-
   let serverResponse = {
     "@context": "\/api\/contexts\/Access",
     "@id": "\/api\/accesses\/7351",
@@ -17,7 +15,7 @@ test('test parseItem', () => {
     }
   }
 
-  expect(hydra.parse(serverResponse)).toStrictEqual({
+  expect($hydraParser.parse(serverResponse)).toStrictEqual({
     "@context": "/api/contexts/Access",
     "@id": "/api/accesses/7351",
     "@type": "Access",

+ 2 - 2
test/services/utils/yamlParser.spec.js

@@ -1,8 +1,8 @@
-import YamlParser from "~/services/utils/yamlParser";
+import {$yamlParser} from "~/services/utils/yamlParser";
 
 test('test parse', () => {
   const path = './test/services/utils/files/test.yaml'
-  expect(YamlParser.parse(path)).toStrictEqual({
+  expect($yamlParser.parse(path)).toStrictEqual({
     "abilities": {
       "accesses": {
         "action": "display",

+ 2 - 2
use/template/menu.ts

@@ -1,6 +1,6 @@
 import {ref, useContext} from "@nuxtjs/composition-api";
 import {ItemMenu, ItemsMenu} from "~/types/types";
-import {organizationProfile} from "~/services/profile/organizationProfile";
+import {$organizationProfile} from "~/services/profile/organizationProfile";
 
 export default class Menu{
   private $ability:any;
@@ -39,7 +39,7 @@ export default class Menu{
     const children:ItemsMenu = [];
 
     if (this.$ability().can('display', 'accesses_page')) {
-      const organization = organizationProfile(this.$store)
+      const organization = $organizationProfile(this.$store)
       let to = organization.isSchool() ? `/students/list/` : `/adherent/list/`
       children.push(this.constructMenu('fa-user', 'person', to, true))
     }