una-nuxt-module 1.0.13 → 2.0.1

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/dist/module.d.mts CHANGED
@@ -1,7 +1,5 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
- import type { IUnaNuxtModuleOptions } from '../dist/runtime/types/index.js';
3
-
4
-
2
+ import { IUnaNuxtModuleOptions } from '../dist/runtime/types/index.js';
5
3
 
6
4
  declare const _default: _nuxt_schema.NuxtModule<IUnaNuxtModuleOptions, IUnaNuxtModuleOptions, false>;
7
5
 
package/dist/module.d.ts CHANGED
@@ -1,7 +1,5 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
- import type { IUnaNuxtModuleOptions } from '../dist/runtime/types/index.js';
3
-
4
-
2
+ import { IUnaNuxtModuleOptions } from '../dist/runtime/types/index.js';
5
3
 
6
4
  declare const _default: _nuxt_schema.NuxtModule<IUnaNuxtModuleOptions, IUnaNuxtModuleOptions, false>;
7
5
 
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "una-nuxt-module",
3
- "version": "1.0.13",
3
+ "version": "2.0.1",
4
4
  "configKey": "unaNuxtModule",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
package/dist/module.mjs CHANGED
@@ -2,7 +2,7 @@ import { createResolver, defineNuxtModule, useLogger, extendPages, addLayout, ad
2
2
  import { defu } from 'defu';
3
3
 
4
4
  const name = "una-nuxt-module";
5
- const version = "1.0.13";
5
+ const version = "2.0.1";
6
6
 
7
7
  function resolve(path) {
8
8
  const resolver = createResolver(import.meta.url);
@@ -16,7 +16,7 @@ import { useUiCustomizerStore } from "../../../stores/UiCustomizer";
16
16
  const uiCustomizer = useUiCustomizerStore();
17
17
 
18
18
  const extendMenuIcon = computed(() => {
19
- return uiCustomizer.isSidebarMini ? "mdi-menu-close" : "mdi-menu-open";
19
+ return uiCustomizer.isSidebarMinimized ? "mdi-menu-close" : "mdi-menu-open";
20
20
  });
21
21
 
22
22
  const handleClick = () => {
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div>
3
3
  <v-navigation-drawer
4
- :rail="uiCustomizer.isSidebarMini"
4
+ :rail="uiCustomizer.isSidebarMinimized"
5
5
  @mouseleave="isHoveringSideBar = false"
6
6
  @mouseover="isHoveringSideBar = true"
7
7
  app
@@ -68,7 +68,7 @@ const menuItems = shallowRef(authorization.getAuthorizedPaths());
68
68
 
69
69
  const uiCustomizerRef = storeToRefs(uiCustomizer);
70
70
 
71
- watch(uiCustomizerRef.isSidebarMini, (newValue, oldValue) => {
71
+ watch(uiCustomizerRef.isSidebarMinimized, (newValue, oldValue) => {
72
72
  if (newValue) openedMenus.value = [];
73
73
  });
74
74
  </script>
@@ -16,7 +16,7 @@
16
16
  :true-value="ETheme.DARK"
17
17
  color="primary"
18
18
  hide-details
19
- v-if="!uiCustomizer.isSidebarMini || openSidebar"
19
+ v-if="!uiCustomizer.isSidebarMinimized || openSidebar"
20
20
  v-model="currentTheme"
21
21
  />
22
22
  </template>
@@ -2,7 +2,7 @@
2
2
  <div class="d-flex justify-center">
3
3
  <NuxtLink to="/" style="text-decoration: none; color: inherit">
4
4
  <img
5
- v-if="!uiCustomizer.isSidebarMini || openSidebar"
5
+ v-if="!uiCustomizer.isSidebarMinimized || openSidebar"
6
6
  alt=""
7
7
  height="40"
8
8
  src="/images/logos/UNA_LogoType_LogoMark_Red.png"
@@ -11,7 +11,7 @@ export declare const useAuthorization: () => {
11
11
  isPageUnprotected: (page: string) => boolean;
12
12
  hasAuthorizationIn: (params: IHasAuthorizationInResourceParams) => boolean;
13
13
  getAuthorizedPaths: () => ({
14
- header: any;
14
+ header: string;
15
15
  title?: string;
16
16
  icon?: string;
17
17
  to?: string;
@@ -20,7 +20,7 @@ export declare const useAuthorization: () => {
20
20
  disabled?: boolean;
21
21
  description?: string;
22
22
  } | {
23
- title: any;
23
+ title: string;
24
24
  header?: string;
25
25
  icon?: string;
26
26
  to?: string;
@@ -10,7 +10,7 @@ interface IUseCrudStateParams {
10
10
  export declare const useTableState: (params: IUseCrudStateParams) => {
11
11
  pagination: import("vue").ComputedRef<{
12
12
  page: number;
13
- size: number;
13
+ size: any;
14
14
  }>;
15
15
  resetTableStatus: () => void;
16
16
  updatePagination: (params: {
File without changes
@@ -6,5 +6,5 @@
6
6
  *
7
7
  * Nota: solo se ejecuta una vez, debido a que posteriormente los datos de la sesión estaran sincronizados en Pinia.
8
8
  */
9
- declare const _default: any;
9
+ declare const _default: import("#app").RouteMiddleware;
10
10
  export default _default;
@@ -3,5 +3,5 @@
3
3
  *
4
4
  * Nota: se ejecuta con cada cambio de ruta.
5
5
  */
6
- declare const _default: any;
6
+ declare const _default: import("#app").RouteMiddleware;
7
7
  export default _default;
@@ -8,5 +8,63 @@
8
8
  const { $isAuthenticated, $authData } = useNuxtApp();
9
9
  * ```
10
10
  */
11
- declare const _default: any;
11
+ declare const _default: import("#app").Plugin<{
12
+ /**
13
+ * Método para cerrar la sesión del usuario en WSO2.
14
+ */
15
+ signOut: () => Promise<void>;
16
+ /**
17
+ * Método si el usuario esta autenticado en WSO2.
18
+ */
19
+ isAuthenticated: () => Promise<boolean | undefined>;
20
+ /**
21
+ * Método que retorna la informacion de la sesión del usuario.
22
+ */
23
+ authData: () => Promise<import("@asgardeo/auth-spa").BasicUserInfo | undefined>;
24
+ /**
25
+ * Método que retorna el ID Token decodificado.
26
+ */
27
+ decodedIDToken: () => Promise<import("@asgardeo/auth-spa").DecodedIDTokenPayload | undefined>;
28
+ /**
29
+ * Método que retorna el Access Token del usuario.
30
+ */
31
+ accessToken: () => Promise<string | undefined>;
32
+ /**
33
+ * Método que retorna el ID Token.
34
+ */
35
+ getIDToken: () => Promise<string | undefined>;
36
+ /**
37
+ * Método que retorna los endpoints de OpenId Connect.
38
+ */
39
+ OIDCServiceEndpoints: () => Promise<import("@asgardeo/auth-spa").OIDCEndpoints | undefined>;
40
+ }> & import("#app").ObjectPlugin<{
41
+ /**
42
+ * Método para cerrar la sesión del usuario en WSO2.
43
+ */
44
+ signOut: () => Promise<void>;
45
+ /**
46
+ * Método si el usuario esta autenticado en WSO2.
47
+ */
48
+ isAuthenticated: () => Promise<boolean | undefined>;
49
+ /**
50
+ * Método que retorna la informacion de la sesión del usuario.
51
+ */
52
+ authData: () => Promise<import("@asgardeo/auth-spa").BasicUserInfo | undefined>;
53
+ /**
54
+ * Método que retorna el ID Token decodificado.
55
+ */
56
+ decodedIDToken: () => Promise<import("@asgardeo/auth-spa").DecodedIDTokenPayload | undefined>;
57
+ /**
58
+ * Método que retorna el Access Token del usuario.
59
+ */
60
+ accessToken: () => Promise<string | undefined>;
61
+ /**
62
+ * Método que retorna el ID Token.
63
+ */
64
+ getIDToken: () => Promise<string | undefined>;
65
+ /**
66
+ * Método que retorna los endpoints de OpenId Connect.
67
+ */
68
+ OIDCServiceEndpoints: () => Promise<import("@asgardeo/auth-spa").OIDCEndpoints | undefined>;
69
+ }>;
12
70
  export default _default;
@@ -8,5 +8,5 @@
8
8
  </div>
9
9
  * ```
10
10
  */
11
- declare const _default: any;
11
+ declare const _default: import("#app").Plugin<Record<string, unknown>> & import("#app").ObjectPlugin<Record<string, unknown>>;
12
12
  export default _default;
@@ -1,40 +1,26 @@
1
1
  import { ETheme } from "../enums/index.js";
2
- import type { IUiCustomizerState } from "../types/index.js";
3
2
  /**
4
3
  * Store encargado de almacenar y gestionar las preferencias visuales del usuario.
5
4
  */
6
- export declare const useUiCustomizerStore: import("pinia").StoreDefinition<"UiCustomizerStore", IUiCustomizerState, {
7
- /**
8
- * Obtiene si la barra lateral está minimizada.
9
- */
10
- isSidebarMinimized(state: {
11
- drawSidebar: boolean;
12
- isSidebarMini: boolean;
13
- currentTheme: string;
14
- } & import("pinia").PiniaCustomStateProperties<IUiCustomizerState>): boolean;
15
- /**
16
- * Obtiene el estado de la barra lateral (si debe dibujarse o no).
17
- */
18
- shouldDrawSidebar(state: {
19
- drawSidebar: boolean;
20
- isSidebarMini: boolean;
21
- currentTheme: string;
22
- } & import("pinia").PiniaCustomStateProperties<IUiCustomizerState>): boolean;
23
- }, {
24
- /**
25
- * Alterna el estado de renderizar el menú de la barra lateral.
26
- */
27
- toggleSidebar(): void;
28
- /**
29
- * Cambia el estado de la barra lateral a minimizado o expandido.
30
- *
31
- * @param newValue
32
- */
33
- setSidebarMini(newValue: boolean): void;
34
- /**
35
- * Cambia el tema de la aplicación.
36
- *
37
- * @param newTheme - Nuevo tema de la aplicación
38
- */
39
- setTheme(newTheme: ETheme): void;
40
- }>;
5
+ export declare const useUiCustomizerStore: import("pinia").StoreDefinition<"UiCustomizerStore", Pick<{
6
+ drawSidebar: import("vue").Ref<boolean, boolean>;
7
+ isSidebarMinimized: import("vue").Ref<boolean, boolean>;
8
+ currentTheme: import("vue").Ref<"dark" | "light", "dark" | "light">;
9
+ toggleSidebar: () => void;
10
+ setSidebarMini: (newValue: boolean) => void;
11
+ setTheme: (newTheme: ETheme) => void;
12
+ }, "drawSidebar" | "isSidebarMinimized" | "currentTheme">, Pick<{
13
+ drawSidebar: import("vue").Ref<boolean, boolean>;
14
+ isSidebarMinimized: import("vue").Ref<boolean, boolean>;
15
+ currentTheme: import("vue").Ref<"dark" | "light", "dark" | "light">;
16
+ toggleSidebar: () => void;
17
+ setSidebarMini: (newValue: boolean) => void;
18
+ setTheme: (newTheme: ETheme) => void;
19
+ }, never>, Pick<{
20
+ drawSidebar: import("vue").Ref<boolean, boolean>;
21
+ isSidebarMinimized: import("vue").Ref<boolean, boolean>;
22
+ currentTheme: import("vue").Ref<"dark" | "light", "dark" | "light">;
23
+ toggleSidebar: () => void;
24
+ setSidebarMini: (newValue: boolean) => void;
25
+ setTheme: (newTheme: ETheme) => void;
26
+ }, "toggleSidebar" | "setSidebarMini" | "setTheme">>;
@@ -1,48 +1,25 @@
1
1
  import { defineStore } from "pinia";
2
2
  import { ETheme } from "../enums/index.js";
3
- export const useUiCustomizerStore = defineStore({
4
- id: "UiCustomizerStore",
5
- state: () => ({
6
- drawSidebar: true,
7
- isSidebarMini: false,
8
- currentTheme: ETheme.LIGHT
9
- }),
10
- getters: {
11
- /**
12
- * Obtiene si la barra lateral está minimizada.
13
- */
14
- isSidebarMinimized(state) {
15
- return state.isSidebarMini;
16
- },
17
- /**
18
- * Obtiene el estado de la barra lateral (si debe dibujarse o no).
19
- */
20
- shouldDrawSidebar(state) {
21
- return state.drawSidebar;
22
- }
23
- },
24
- actions: {
25
- /**
26
- * Alterna el estado de renderizar el menú de la barra lateral.
27
- */
28
- toggleSidebar() {
29
- this.drawSidebar = !this.drawSidebar;
30
- },
31
- /**
32
- * Cambia el estado de la barra lateral a minimizado o expandido.
33
- *
34
- * @param newValue
35
- */
36
- setSidebarMini(newValue) {
37
- this.isSidebarMini = newValue;
38
- },
39
- /**
40
- * Cambia el tema de la aplicación.
41
- *
42
- * @param newTheme - Nuevo tema de la aplicación
43
- */
44
- setTheme(newTheme) {
45
- this.currentTheme = newTheme;
46
- }
47
- }
3
+ import { ref } from "#imports";
4
+ export const useUiCustomizerStore = defineStore("UiCustomizerStore", () => {
5
+ const drawSidebar = ref(true);
6
+ const isSidebarMinimized = ref(false);
7
+ const currentTheme = ref(ETheme.LIGHT);
8
+ const toggleSidebar = () => {
9
+ drawSidebar.value = !drawSidebar.value;
10
+ };
11
+ const setSidebarMini = (newValue) => {
12
+ isSidebarMinimized.value = newValue;
13
+ };
14
+ const setTheme = (newTheme) => {
15
+ currentTheme.value = newTheme;
16
+ };
17
+ return {
18
+ drawSidebar,
19
+ isSidebarMinimized,
20
+ currentTheme,
21
+ toggleSidebar,
22
+ setSidebarMini,
23
+ setTheme
24
+ };
48
25
  });
@@ -1,80 +1,134 @@
1
- import type { IAuthData, IAuthenticatedUser, IAuthState, IHasAuthorizationInResourceParams } from "../types/index.js";
1
+ import type { IAuthData, IAuthenticatedUser, IHasAuthorizationInResourceParams } from "../types/index.js";
2
2
  /**
3
3
  * Store encargado de almacenar y gestionar la autenticación y autorización del usuario.
4
4
  */
5
- export declare const useAuthStore: import("pinia").StoreDefinition<"AuthStore", IAuthState, {
6
- /**
7
- * Retorna si el usuario está autenticado.
8
- */
9
- isAuthenticated: (state: {
10
- user: {
11
- email: string;
12
- fullName: string;
13
- name?: string | undefined;
14
- lastName?: string | undefined;
15
- photoUrl?: string | undefined;
16
- mainRole?: string | undefined;
17
- } | null;
18
- authData: {
19
- isAuthenticated: boolean;
20
- accessToken: string;
21
- resources: {
22
- id: number;
23
- nombre: string;
24
- permisoInsertar: boolean;
25
- permisoModificar: boolean;
26
- permisoEliminar: boolean;
27
- }[];
28
- } | null;
29
- } & import("pinia").PiniaCustomStateProperties<IAuthState>) => boolean;
30
- /**
31
- * Retorna el token de acceso del usuario autenticado.
32
- */
33
- token: (state: {
34
- user: {
35
- email: string;
36
- fullName: string;
37
- name?: string | undefined;
38
- lastName?: string | undefined;
39
- photoUrl?: string | undefined;
40
- mainRole?: string | undefined;
41
- } | null;
42
- authData: {
43
- isAuthenticated: boolean;
44
- accessToken: string;
45
- resources: {
46
- id: number;
47
- nombre: string;
48
- permisoInsertar: boolean;
49
- permisoModificar: boolean;
50
- permisoEliminar: boolean;
51
- }[];
52
- } | null;
53
- } & import("pinia").PiniaCustomStateProperties<IAuthState>) => string | null;
54
- }, {
55
- /**
56
- * Cierra la sesión del usuario
57
- */
58
- logout(): Promise<void>;
59
- /**
60
- * Actualiza la información del usuario autenticado y la información de la sesión.
61
- *
62
- * @param [IAuthenticatedUser] userInfo - Datos del usuario autenticado
63
- * @param [IAuthData] authData - Datos de la sesión del usuario autenticado
64
- */
65
- update(userInfo: IAuthenticatedUser, authData: IAuthData): void;
66
- /**
67
- * Verifica si el usuario tiene acceso a un recurso.
68
- *
69
- * @param resource - Recurso que se desea validar.
70
- * @returns
71
- */
72
- hasResource(resource: string): boolean;
73
- /**
74
- * Verifica si el usuario tiene la autorización sobre un recurso.
75
- *
76
- * @param params - Objeto con los parámetros de recurso y autorización.
77
- * @returns
78
- */
79
- hasAuthorizationInResource({ resource, authorization, }: IHasAuthorizationInResourceParams): boolean;
80
- }>;
5
+ export declare const useAuthStore: import("pinia").StoreDefinition<"AuthStore", Pick<{
6
+ user: import("vue").Ref<{
7
+ email: string;
8
+ fullName: string;
9
+ name?: string | undefined;
10
+ lastName?: string | undefined;
11
+ photoUrl?: string | undefined;
12
+ mainRole?: string | undefined;
13
+ } | null, IAuthenticatedUser | {
14
+ email: string;
15
+ fullName: string;
16
+ name?: string | undefined;
17
+ lastName?: string | undefined;
18
+ photoUrl?: string | undefined;
19
+ mainRole?: string | undefined;
20
+ } | null>;
21
+ authData: import("vue").Ref<{
22
+ isAuthenticated: boolean;
23
+ accessToken: string;
24
+ resources: {
25
+ id: number;
26
+ nombre: string;
27
+ permisoInsertar: boolean;
28
+ permisoModificar: boolean;
29
+ permisoEliminar: boolean;
30
+ }[];
31
+ } | null, IAuthData | {
32
+ isAuthenticated: boolean;
33
+ accessToken: string;
34
+ resources: {
35
+ id: number;
36
+ nombre: string;
37
+ permisoInsertar: boolean;
38
+ permisoModificar: boolean;
39
+ permisoEliminar: boolean;
40
+ }[];
41
+ } | null>;
42
+ isAuthenticated: import("vue").ComputedRef<boolean>;
43
+ token: import("vue").ComputedRef<string | null>;
44
+ logout: () => Promise<void>;
45
+ update: (userInfo: IAuthenticatedUser, data: IAuthData) => void;
46
+ hasResource: (resource: string) => boolean;
47
+ hasAuthorizationInResource: ({ resource, authorization, }: IHasAuthorizationInResourceParams) => boolean;
48
+ }, "authData" | "user">, Pick<{
49
+ user: import("vue").Ref<{
50
+ email: string;
51
+ fullName: string;
52
+ name?: string | undefined;
53
+ lastName?: string | undefined;
54
+ photoUrl?: string | undefined;
55
+ mainRole?: string | undefined;
56
+ } | null, IAuthenticatedUser | {
57
+ email: string;
58
+ fullName: string;
59
+ name?: string | undefined;
60
+ lastName?: string | undefined;
61
+ photoUrl?: string | undefined;
62
+ mainRole?: string | undefined;
63
+ } | null>;
64
+ authData: import("vue").Ref<{
65
+ isAuthenticated: boolean;
66
+ accessToken: string;
67
+ resources: {
68
+ id: number;
69
+ nombre: string;
70
+ permisoInsertar: boolean;
71
+ permisoModificar: boolean;
72
+ permisoEliminar: boolean;
73
+ }[];
74
+ } | null, IAuthData | {
75
+ isAuthenticated: boolean;
76
+ accessToken: string;
77
+ resources: {
78
+ id: number;
79
+ nombre: string;
80
+ permisoInsertar: boolean;
81
+ permisoModificar: boolean;
82
+ permisoEliminar: boolean;
83
+ }[];
84
+ } | null>;
85
+ isAuthenticated: import("vue").ComputedRef<boolean>;
86
+ token: import("vue").ComputedRef<string | null>;
87
+ logout: () => Promise<void>;
88
+ update: (userInfo: IAuthenticatedUser, data: IAuthData) => void;
89
+ hasResource: (resource: string) => boolean;
90
+ hasAuthorizationInResource: ({ resource, authorization, }: IHasAuthorizationInResourceParams) => boolean;
91
+ }, "isAuthenticated" | "token">, Pick<{
92
+ user: import("vue").Ref<{
93
+ email: string;
94
+ fullName: string;
95
+ name?: string | undefined;
96
+ lastName?: string | undefined;
97
+ photoUrl?: string | undefined;
98
+ mainRole?: string | undefined;
99
+ } | null, IAuthenticatedUser | {
100
+ email: string;
101
+ fullName: string;
102
+ name?: string | undefined;
103
+ lastName?: string | undefined;
104
+ photoUrl?: string | undefined;
105
+ mainRole?: string | undefined;
106
+ } | null>;
107
+ authData: import("vue").Ref<{
108
+ isAuthenticated: boolean;
109
+ accessToken: string;
110
+ resources: {
111
+ id: number;
112
+ nombre: string;
113
+ permisoInsertar: boolean;
114
+ permisoModificar: boolean;
115
+ permisoEliminar: boolean;
116
+ }[];
117
+ } | null, IAuthData | {
118
+ isAuthenticated: boolean;
119
+ accessToken: string;
120
+ resources: {
121
+ id: number;
122
+ nombre: string;
123
+ permisoInsertar: boolean;
124
+ permisoModificar: boolean;
125
+ permisoEliminar: boolean;
126
+ }[];
127
+ } | null>;
128
+ isAuthenticated: import("vue").ComputedRef<boolean>;
129
+ token: import("vue").ComputedRef<string | null>;
130
+ logout: () => Promise<void>;
131
+ update: (userInfo: IAuthenticatedUser, data: IAuthData) => void;
132
+ hasResource: (resource: string) => boolean;
133
+ hasAuthorizationInResource: ({ resource, authorization, }: IHasAuthorizationInResourceParams) => boolean;
134
+ }, "logout" | "update" | "hasResource" | "hasAuthorizationInResource">>;
@@ -1,69 +1,47 @@
1
1
  import { defineStore } from "pinia";
2
2
  import { EAuthorization } from "../enums/EAuthorization.js";
3
- import { useNuxtApp } from "#app";
4
- export const useAuthStore = defineStore({
5
- id: "AuthStore",
6
- state: () => ({
7
- user: null,
8
- authData: null
9
- }),
10
- getters: {
11
- /**
12
- * Retorna si el usuario está autenticado.
13
- */
14
- isAuthenticated: (state) => state.authData?.isAuthenticated ?? false,
15
- /**
16
- * Retorna el token de acceso del usuario autenticado.
17
- */
18
- token: (state) => state.authData?.accessToken ?? null
19
- },
20
- actions: {
21
- /**
22
- * Cierra la sesión del usuario
23
- */
24
- async logout() {
25
- const { $signOut } = useNuxtApp();
26
- await $signOut();
27
- },
28
- /**
29
- * Actualiza la información del usuario autenticado y la información de la sesión.
30
- *
31
- * @param [IAuthenticatedUser] userInfo - Datos del usuario autenticado
32
- * @param [IAuthData] authData - Datos de la sesión del usuario autenticado
33
- */
34
- update(userInfo, authData) {
35
- this.user = userInfo;
36
- this.authData = authData;
37
- },
38
- /**
39
- * Verifica si el usuario tiene acceso a un recurso.
40
- *
41
- * @param resource - Recurso que se desea validar.
42
- * @returns
43
- */
44
- hasResource(resource) {
45
- return !!this.authData?.resources?.find((r) => r.nombre === resource);
46
- },
47
- /**
48
- * Verifica si el usuario tiene la autorización sobre un recurso.
49
- *
50
- * @param params - Objeto con los parámetros de recurso y autorización.
51
- * @returns
52
- */
53
- hasAuthorizationInResource({
54
- resource,
55
- authorization
56
- }) {
57
- const resourceData = this.authData?.resources.find(
58
- (r) => r.nombre === resource
59
- );
60
- if (!resourceData) return false;
61
- const permissions = /* @__PURE__ */ new Map([
62
- [EAuthorization.CREATE, resourceData.permisoInsertar],
63
- [EAuthorization.EDIT, resourceData.permisoModificar],
64
- [EAuthorization.DELETE, resourceData.permisoEliminar]
65
- ]);
66
- return permissions.get(authorization) ?? false;
67
- }
68
- }
3
+ import { computed, ref, useNuxtApp } from "#imports";
4
+ export const useAuthStore = defineStore("AuthStore", () => {
5
+ const user = ref(null);
6
+ const authData = ref(null);
7
+ const isAuthenticated = computed(
8
+ () => authData.value?.isAuthenticated ?? false
9
+ );
10
+ const token = computed(() => authData.value?.accessToken ?? null);
11
+ const logout = async () => {
12
+ const { $signOut } = useNuxtApp();
13
+ await $signOut();
14
+ };
15
+ const update = (userInfo, data) => {
16
+ user.value = userInfo;
17
+ authData.value = data;
18
+ };
19
+ const hasResource = (resource) => {
20
+ return !!authData.value?.resources?.find((r) => r.nombre === resource);
21
+ };
22
+ const hasAuthorizationInResource = ({
23
+ resource,
24
+ authorization
25
+ }) => {
26
+ const resourceData = authData.value?.resources.find(
27
+ (r) => r.nombre === resource
28
+ );
29
+ if (!resourceData) return false;
30
+ const permissions = /* @__PURE__ */ new Map([
31
+ [EAuthorization.CREATE, resourceData.permisoInsertar],
32
+ [EAuthorization.EDIT, resourceData.permisoModificar],
33
+ [EAuthorization.DELETE, resourceData.permisoEliminar]
34
+ ]);
35
+ return permissions.get(authorization) ?? false;
36
+ };
37
+ return {
38
+ user,
39
+ authData,
40
+ isAuthenticated,
41
+ token,
42
+ logout,
43
+ update,
44
+ hasResource,
45
+ hasAuthorizationInResource
46
+ };
69
47
  });
@@ -357,23 +357,6 @@ export interface IAppStatusState {
357
357
  /** Almacena si se debe abrir el diálogo de exportar */
358
358
  openDialogExport: boolean;
359
359
  }
360
- /**
361
- * Interfaz para el Store de preferencias visuales del usuario.
362
- *
363
- * @interface IUiCustomizerState
364
- *
365
- * @property {boolean} - *drawSidebar* - Almacena si se debe renderizar el menú
366
- * @property {boolean} - *isSidebarMini* - Almacena si el menú esta minimizado
367
- * @property {string} - *currentTheme* - Almacena el tema actual
368
- */
369
- export interface IUiCustomizerState {
370
- /** Almacena si se debe renderizar el menú */
371
- drawSidebar: boolean;
372
- /** Almacena si el menú esta minimizado */
373
- isSidebarMini: boolean;
374
- /** Almacena el tema actual */
375
- currentTheme: string;
376
- }
377
360
  /**
378
361
  * Interfaz para la información del usuario autenticado.
379
362
  *
@@ -441,20 +424,6 @@ export interface IAuthData {
441
424
  /** Recursos del usuario */
442
425
  resources: IResource[];
443
426
  }
444
- /**
445
- * Interfaz para el Store de autenticación y autorización.
446
- *
447
- * @interface IAuthState
448
- *
449
- * @property {IAuthenticatedUser, null} - *user* - Información del usuario
450
- * @property {IAuthData, null} - *authData* - Información de la sesión del usuario
451
- */
452
- export interface IAuthState {
453
- /** Información del usuario */
454
- user: IAuthenticatedUser | null;
455
- /** Información de la sesión del usuario */
456
- authData: IAuthData | null;
457
- }
458
427
  /**
459
428
  * Interfaz para los parámetros de métodos de validacion de permisos en recursos.
460
429
  *
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "una-nuxt-module",
3
- "version": "1.0.13",
3
+ "version": "2.0.1",
4
4
  "description": "Módulo Nuxt para desarrollo CGI",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "ssh://git@bitbucket.una.ac.cr:7999/~evega/una-nuxt-module.git"
7
+ "url": ""
8
8
  },
9
9
  "license": "MIT",
10
10
  "type": "module",
@@ -32,31 +32,31 @@
32
32
  "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
33
33
  },
34
34
  "dependencies": {
35
- "@asgardeo/auth-spa": "^3.1.2",
36
- "@nuxt/image": "^1.8.1",
37
- "@nuxt/kit": "^3.13.2",
38
- "@nuxtjs/i18n": "^8.5.5",
35
+ "@asgardeo/auth-spa": "^3.1.4",
36
+ "@nuxt/image": "^1.10.0",
37
+ "@nuxt/kit": "^3.16.1",
38
+ "@nuxtjs/i18n": "9.4.0",
39
39
  "defu": "^6.1.4",
40
- "pinia": "^2.2.2",
40
+ "pinia": "^3.0.1",
41
41
  "vue-json-pretty": "^2.4.0",
42
- "vuetify": "^3.7.2"
42
+ "vuetify": "^3.7.19"
43
43
  },
44
44
  "devDependencies": {
45
- "@nuxt/devtools": "^1.5.0",
46
- "@nuxt/eslint-config": "^0.5.7",
45
+ "@nuxt/devtools": "^2.3.2",
46
+ "@nuxt/eslint-config": "^1.2.0",
47
47
  "@nuxt/module-builder": "^0.8.4",
48
- "@nuxt/schema": "^3.13.2",
49
- "@nuxt/test-utils": "^3.14.2",
50
- "@pinia/nuxt": "^0.5.4",
48
+ "@nuxt/schema": "^3.16.1",
49
+ "@nuxt/test-utils": "^3.17.2",
50
+ "@pinia/nuxt": "^0.10.1",
51
51
  "@types/node": "latest",
52
- "changelogen": "^0.5.7",
53
- "eslint": "^9.11.0",
54
- "nuxt": "^3.13.0",
55
- "sass": "^1.77.8",
56
- "sass-loader": "^16.0.0",
52
+ "changelogen": "^0.6.1",
53
+ "eslint": "^9.23.0",
54
+ "nuxt": "^3.16.1",
55
+ "sass": "^1.86.0",
56
+ "sass-loader": "^16.0.5",
57
57
  "typescript": "latest",
58
- "vitest": "^2.1.1",
59
- "vue-tsc": "^2.1.6"
58
+ "vitest": "^3.0.9",
59
+ "vue-tsc": "^2.2.8"
60
60
  },
61
61
  "directories": {
62
62
  "test": "test"
@@ -1,5 +0,0 @@
1
- /**
2
- * Se define la configuración de internalización para el plugin de vue-i18n.
3
- */
4
- declare const _default: any;
5
- export default _default;