@luizleon/sf.prefeiturasp.vuecomponents 4.0.16 → 4.1.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/dist/http-client/apiClient.d.ts +32 -0
- package/dist/index.d.ts +3 -1
- package/dist/keycloak.d.ts +14 -17
- package/dist/services/authService.d.ts +18 -18
- package/dist/sf.prefeiturasp.vuecomponents.cjs +50 -57
- package/dist/sf.prefeiturasp.vuecomponents.cjs.map +1 -1
- package/dist/sf.prefeiturasp.vuecomponents.js +3627 -3458
- package/dist/sf.prefeiturasp.vuecomponents.js.map +1 -1
- package/dist/sf.prefeiturasp.vuecomponents.umd.cjs +26 -33
- package/dist/sf.prefeiturasp.vuecomponents.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/index.d.ts +15 -1
- package/package.json +3 -3
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AxiosInstance, AxiosResponse } from 'axios';
|
|
2
|
+
import { AppResult } from '../types';
|
|
3
|
+
declare class ApiClient {
|
|
4
|
+
constructor();
|
|
5
|
+
private axios;
|
|
6
|
+
private authService;
|
|
7
|
+
/**
|
|
8
|
+
* Retorna a instância do axios.
|
|
9
|
+
* @param idempotent Se 'true', retorna sempre a mesma instância, com todas as configurações. Este é o valor padrão. Se 'false', retorna uma nova instância.
|
|
10
|
+
*/
|
|
11
|
+
GetAxios(idempotent?: boolean): AxiosInstance;
|
|
12
|
+
GetAccessToken(): Promise<any>;
|
|
13
|
+
GetAsync<T>(url: string): Promise<AppResult<T>>;
|
|
14
|
+
PostAsync<T>(url: string, data: any): Promise<AppResult<T>>;
|
|
15
|
+
PutAsync<T>(url: string, data: any): Promise<AppResult<T>>;
|
|
16
|
+
DeleteAsync<T>(url: string): Promise<AppResult<T>>;
|
|
17
|
+
/**
|
|
18
|
+
* Usar após 'then' (httpStatuscode 2xx) para obter o resultado da requisição.
|
|
19
|
+
* @param r
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
HandleThen<T>(r: AxiosResponse<any, any>): AppResult<T>;
|
|
23
|
+
/**
|
|
24
|
+
* Usar após 'catch' (httpStatuscode 4xx ou 5xx) para obter o resultado da requisição.
|
|
25
|
+
* @param e
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
HandleCatch<T>(e: any): AppResult<T>;
|
|
29
|
+
private ParsedResponse;
|
|
30
|
+
}
|
|
31
|
+
declare const UseApiClient: () => ApiClient;
|
|
32
|
+
export { ApiClient, UseApiClient };
|
package/dist/index.d.ts
CHANGED
|
@@ -12,9 +12,11 @@ import { UseAlertService, UseConfirmService } from './services/dialogService';
|
|
|
12
12
|
import { StartAuthService, UseAuthService } from './services/authService';
|
|
13
13
|
import { AppResult } from './common/appResult';
|
|
14
14
|
import { AxiosClient, UseAxiosClient } from './axios/axiosClient';
|
|
15
|
+
import { default as Keycloak } from './keycloak';
|
|
16
|
+
import { ApiClient, UseApiClient } from './http-client/apiClient';
|
|
15
17
|
declare function RemovePreloader(): void;
|
|
16
18
|
declare function ToggleTheme(): void;
|
|
17
19
|
declare function EnableDarkMode(): void;
|
|
18
20
|
declare function EnableLightMode(): void;
|
|
19
|
-
export { SfLayout, SfIcon, SfContent, SfTabNavigation, SfButton, SfDrawer, SfMessage, SfTooltip, SfNavMenu, StartAuthService, UseAuthService, UseNavMenuService, UseConfirmService, UseAlertService, UseAxiosClient, RemovePreloader, AppResult, AxiosClient, ToggleTheme, EnableDarkMode, EnableLightMode, };
|
|
21
|
+
export { SfLayout, SfIcon, SfContent, SfTabNavigation, SfButton, SfDrawer, SfMessage, SfTooltip, SfNavMenu, StartAuthService, UseAuthService, UseNavMenuService, UseConfirmService, UseAlertService, UseAxiosClient, RemovePreloader, AppResult, AxiosClient, ToggleTheme, EnableDarkMode, EnableLightMode, Keycloak, ApiClient, UseApiClient, };
|
|
20
22
|
export * from './types';
|
package/dist/keycloak.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export type KeycloakResponseType =
|
|
|
25
25
|
| "id_token token"
|
|
26
26
|
| "code id_token token";
|
|
27
27
|
export type KeycloakFlow = "standard" | "implicit" | "hybrid";
|
|
28
|
-
export type KeycloakPkceMethod = "S256";
|
|
28
|
+
export type KeycloakPkceMethod = "S256" | false;
|
|
29
29
|
|
|
30
30
|
export interface KeycloakConfig {
|
|
31
31
|
/**
|
|
@@ -176,9 +176,8 @@ export interface KeycloakInitOptions {
|
|
|
176
176
|
flow?: KeycloakFlow;
|
|
177
177
|
|
|
178
178
|
/**
|
|
179
|
-
* Configures the Proof Key for Code Exchange (PKCE) method to use.
|
|
180
|
-
*
|
|
181
|
-
* If not configured, PKCE will not be used.
|
|
179
|
+
* Configures the Proof Key for Code Exchange (PKCE) method to use. This will default to 'S256'.
|
|
180
|
+
* Can be disabled by passing `false`.
|
|
182
181
|
*/
|
|
183
182
|
pkceMethod?: KeycloakPkceMethod;
|
|
184
183
|
|
|
@@ -215,6 +214,11 @@ export interface KeycloakInitOptions {
|
|
|
215
214
|
* of the OIDC 1.0 specification.
|
|
216
215
|
*/
|
|
217
216
|
locale?: string;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* HTTP method for calling the end_session endpoint. Defaults to 'GET'.
|
|
220
|
+
*/
|
|
221
|
+
logoutMethod?: "GET" | "POST";
|
|
218
222
|
}
|
|
219
223
|
|
|
220
224
|
export interface KeycloakLoginOptions {
|
|
@@ -296,6 +300,11 @@ export interface KeycloakLogoutOptions {
|
|
|
296
300
|
* Specifies the uri to redirect to after logout.
|
|
297
301
|
*/
|
|
298
302
|
redirectUri?: string;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* HTTP method for calling the end_session endpoint. Defaults to 'GET'.
|
|
306
|
+
*/
|
|
307
|
+
logoutMethod?: "GET" | "POST";
|
|
299
308
|
}
|
|
300
309
|
|
|
301
310
|
export interface KeycloakRegisterOptions
|
|
@@ -333,6 +342,7 @@ export interface KeycloakProfile {
|
|
|
333
342
|
emailVerified?: boolean;
|
|
334
343
|
totp?: boolean;
|
|
335
344
|
createdTimestamp?: number;
|
|
345
|
+
attributes?: Record<string, unknown>;
|
|
336
346
|
}
|
|
337
347
|
|
|
338
348
|
export interface KeycloakTokenParsed {
|
|
@@ -625,19 +635,6 @@ declare class Keycloak {
|
|
|
625
635
|
*/
|
|
626
636
|
clearToken(): void;
|
|
627
637
|
|
|
628
|
-
/**
|
|
629
|
-
* Método para setar os tokens. Como o adaptador original não disponibiliza esta função,
|
|
630
|
-
* alteramos o código para permitir que seja chamada.
|
|
631
|
-
* @see keycloak.js
|
|
632
|
-
*/
|
|
633
|
-
|
|
634
|
-
setToken(
|
|
635
|
-
token: any,
|
|
636
|
-
refreshToken: any,
|
|
637
|
-
idToken: any,
|
|
638
|
-
timeLocal?: number
|
|
639
|
-
): void;
|
|
640
|
-
|
|
641
638
|
/**
|
|
642
639
|
* Returns true if the token has the given realm role.
|
|
643
640
|
* @param role A realm role name.
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { IAuthService } from '../types';
|
|
2
|
-
import { KeycloakConfig, KeycloakInitOptions } from '
|
|
2
|
+
import { KeycloakConfig, KeycloakInitOptions } from '../keycloak';
|
|
3
3
|
declare const UseAuthService: () => {
|
|
4
4
|
Instance: {
|
|
5
5
|
authenticated?: boolean | undefined;
|
|
6
6
|
subject?: string | undefined;
|
|
7
|
-
responseMode?: import('
|
|
8
|
-
responseType?: import('
|
|
9
|
-
flow?: import('
|
|
7
|
+
responseMode?: import('../keycloak').KeycloakResponseMode | undefined;
|
|
8
|
+
responseType?: import('../keycloak').KeycloakResponseType | undefined;
|
|
9
|
+
flow?: import('../keycloak').KeycloakFlow | undefined;
|
|
10
10
|
realmAccess?: {
|
|
11
11
|
roles: string[];
|
|
12
12
|
} | undefined;
|
|
13
|
-
resourceAccess?: import('
|
|
13
|
+
resourceAccess?: import('../keycloak').KeycloakResourceAccess | undefined;
|
|
14
14
|
token?: string | undefined;
|
|
15
15
|
tokenParsed?: {
|
|
16
16
|
[x: string]: any;
|
|
@@ -28,7 +28,7 @@ declare const UseAuthService: () => {
|
|
|
28
28
|
realm_access?: {
|
|
29
29
|
roles: string[];
|
|
30
30
|
} | undefined;
|
|
31
|
-
resource_access?: import('
|
|
31
|
+
resource_access?: import('../keycloak').KeycloakResourceAccess | undefined;
|
|
32
32
|
} | undefined;
|
|
33
33
|
refreshToken?: string | undefined;
|
|
34
34
|
refreshTokenParsed?: {
|
|
@@ -47,7 +47,7 @@ declare const UseAuthService: () => {
|
|
|
47
47
|
realm_access?: {
|
|
48
48
|
roles: string[];
|
|
49
49
|
} | undefined;
|
|
50
|
-
resource_access?: import('
|
|
50
|
+
resource_access?: import('../keycloak').KeycloakResourceAccess | undefined;
|
|
51
51
|
} | undefined;
|
|
52
52
|
idToken?: string | undefined;
|
|
53
53
|
idTokenParsed?: {
|
|
@@ -66,7 +66,7 @@ declare const UseAuthService: () => {
|
|
|
66
66
|
realm_access?: {
|
|
67
67
|
roles: string[];
|
|
68
68
|
} | undefined;
|
|
69
|
-
resource_access?: import('
|
|
69
|
+
resource_access?: import('../keycloak').KeycloakResourceAccess | undefined;
|
|
70
70
|
} | undefined;
|
|
71
71
|
timeSkew?: number | undefined;
|
|
72
72
|
loginRequired?: boolean | undefined;
|
|
@@ -85,32 +85,32 @@ declare const UseAuthService: () => {
|
|
|
85
85
|
emailVerified?: boolean | undefined;
|
|
86
86
|
totp?: boolean | undefined;
|
|
87
87
|
createdTimestamp?: number | undefined;
|
|
88
|
+
attributes?: Record<string, unknown> | undefined;
|
|
88
89
|
} | undefined;
|
|
89
90
|
userInfo?: {} | undefined;
|
|
90
91
|
onReady?: ((authenticated?: boolean | undefined) => void) | undefined;
|
|
91
92
|
onAuthSuccess?: (() => void) | undefined;
|
|
92
|
-
onAuthError?: ((errorData: import('
|
|
93
|
+
onAuthError?: ((errorData: import('../keycloak').KeycloakError) => void) | undefined;
|
|
93
94
|
onAuthRefreshSuccess?: (() => void) | undefined;
|
|
94
95
|
onAuthRefreshError?: (() => void) | undefined;
|
|
95
96
|
onAuthLogout?: (() => void) | undefined;
|
|
96
97
|
onTokenExpired?: (() => void) | undefined;
|
|
97
98
|
onActionUpdate?: ((status: "success" | "error" | "cancelled") => void) | undefined;
|
|
98
99
|
init: (initOptions: KeycloakInitOptions) => Promise<boolean>;
|
|
99
|
-
login: (options?: import('
|
|
100
|
-
logout: (options?: import('
|
|
101
|
-
register: (options?: import('
|
|
100
|
+
login: (options?: import('../keycloak').KeycloakLoginOptions | undefined) => Promise<void>;
|
|
101
|
+
logout: (options?: import('../keycloak').KeycloakLogoutOptions | undefined) => Promise<void>;
|
|
102
|
+
register: (options?: import('../keycloak').KeycloakRegisterOptions | undefined) => Promise<void>;
|
|
102
103
|
accountManagement: () => Promise<void>;
|
|
103
|
-
createLoginUrl: (options?: import('
|
|
104
|
-
createLogoutUrl: (options?: import('
|
|
105
|
-
createRegisterUrl: (options?: import('
|
|
106
|
-
createAccountUrl: (options?: import('
|
|
104
|
+
createLoginUrl: (options?: import('../keycloak').KeycloakLoginOptions | undefined) => string;
|
|
105
|
+
createLogoutUrl: (options?: import('../keycloak').KeycloakLogoutOptions | undefined) => string;
|
|
106
|
+
createRegisterUrl: (options?: import('../keycloak').KeycloakRegisterOptions | undefined) => string;
|
|
107
|
+
createAccountUrl: (options?: import('../keycloak').KeycloakAccountOptions | undefined) => string;
|
|
107
108
|
isTokenExpired: (minValidity?: number | undefined) => boolean;
|
|
108
109
|
updateToken: (minValidity?: number | undefined) => Promise<boolean>;
|
|
109
110
|
clearToken: () => void;
|
|
110
|
-
setToken: (token: any, refreshToken: any, idToken: any, timeLocal?: number | undefined) => void;
|
|
111
111
|
hasRealmRole: (role: string) => boolean;
|
|
112
112
|
hasResourceRole: (role: string, resource?: string | undefined) => boolean;
|
|
113
|
-
loadUserProfile: () => Promise<import('
|
|
113
|
+
loadUserProfile: () => Promise<import('../keycloak').KeycloakProfile>;
|
|
114
114
|
loadUserInfo: () => Promise<{}>;
|
|
115
115
|
};
|
|
116
116
|
InitAsync: (initOptions?: KeycloakInitOptions | undefined) => Promise<import('../types').User | null>;
|