@fluxo-dev/api-client-base 25.2.9 → 25.2.11
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/index.cjs.js +6862 -2065
- package/package.json +2 -2
- package/src/index.d.ts +1 -0
- package/src/lib/auth/auth-service.d.ts +1 -0
- package/src/lib/configuration/configuration.service.d.ts +4 -0
- package/src/lib/configuration/models/index.d.ts +1 -0
- package/src/lib/configuration/models/web-menu-export.d.ts +21 -0
- package/src/lib/fluxo-client-interface.d.ts +2 -0
- package/src/lib/fluxo-client.d.ts +3 -0
- package/src/lib/security/apikey/apikey.d.ts +1 -0
- package/src/lib/security/user/user.d.ts +1 -0
- package/src/lib/session-hub/index.d.ts +1 -0
- package/src/lib/session-hub/session-hub.service.d.ts +90 -0
- package/src/lib/utils/device-id-manager.d.ts +22 -0
- package/src/lib/utils/index.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluxo-dev/api-client-base",
|
|
3
|
-
"version": "25.2.
|
|
3
|
+
"version": "25.2.11",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"react": "^18.3.1",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"react-router-dom": "^6.11.2",
|
|
9
9
|
"react-redux": "^8.0.5",
|
|
10
10
|
"@reduxjs/toolkit": "^1.9.1",
|
|
11
|
-
"@fluxo-dev/state": "^25.2.
|
|
11
|
+
"@fluxo-dev/state": "^25.2.11"
|
|
12
12
|
},
|
|
13
13
|
"main": "./index.cjs.js",
|
|
14
14
|
"types": "./index.cjs.d.ts"
|
package/src/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { DomainRole } from "../security/domain-role/index";
|
|
|
6
6
|
import { Permission } from "../security/permission/index";
|
|
7
7
|
import { AppMenu } from "./app-menu";
|
|
8
8
|
import { AppMenuCreateCommand } from "./app-menu-create-command";
|
|
9
|
+
import { WebMenuExport } from './models';
|
|
9
10
|
export type InitialConfiguration = {
|
|
10
11
|
apps: FluxoApp[];
|
|
11
12
|
menu: AppMenuItem[];
|
|
@@ -39,6 +40,9 @@ export declare class ConfigurationService {
|
|
|
39
40
|
getSystemFeatures(): Promise<FeatureList>;
|
|
40
41
|
saveAppMenu(webMenuId: number, menu: AppMenuItem[]): Promise<any>;
|
|
41
42
|
createAppMenu(menu: AppMenuCreateCommand): Promise<any>;
|
|
43
|
+
updateAppMenu(webMenuId: number, menu: AppMenuCreateCommand): Promise<any>;
|
|
44
|
+
exportAppMenu(webMenuId: number): Promise<WebMenuExport>;
|
|
45
|
+
importAppMenu(menuDefinition: WebMenuExport): Promise<void>;
|
|
42
46
|
getAppMenuList(): Promise<AppMenu[]>;
|
|
43
47
|
getAppMenu(webMenuId: number): Promise<AppMenuItem[]>;
|
|
44
48
|
getMenuItemPermissions(domainRoleId: string): Promise<Permission[]>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AppMenuContextType } from '../app-menu';
|
|
2
|
+
export interface WebMenuExport {
|
|
3
|
+
name: string | null;
|
|
4
|
+
frontend: string | null;
|
|
5
|
+
contextType: AppMenuContextType;
|
|
6
|
+
domainRoleId: number | null;
|
|
7
|
+
userId: string | null;
|
|
8
|
+
items: WebMenuExportItem[];
|
|
9
|
+
}
|
|
10
|
+
export interface WebMenuExportItem {
|
|
11
|
+
tempId: string | null;
|
|
12
|
+
parentTempId: string | null;
|
|
13
|
+
label: string | null;
|
|
14
|
+
icon: string | null;
|
|
15
|
+
hasIndex: boolean;
|
|
16
|
+
routerLink: string | null;
|
|
17
|
+
isGroup: boolean;
|
|
18
|
+
menuItemIdentifier: string | null;
|
|
19
|
+
permissions: string[];
|
|
20
|
+
children: WebMenuExportItem[];
|
|
21
|
+
}
|
|
@@ -10,6 +10,7 @@ import { ReportingService } from "./reporting";
|
|
|
10
10
|
import { PrintingService } from "./printing";
|
|
11
11
|
import { WorkflowService } from "./workflow";
|
|
12
12
|
import { BiFacade } from "./bi";
|
|
13
|
+
import { SessionHubService } from "./session-hub";
|
|
13
14
|
export interface FluxoClientInterface {
|
|
14
15
|
get clientConfig(): FluxoClientConfiguration;
|
|
15
16
|
get security(): SecurityFacade;
|
|
@@ -23,4 +24,5 @@ export interface FluxoClientInterface {
|
|
|
23
24
|
get communication(): CommunicationFacade;
|
|
24
25
|
get ravify(): RavifyFacade;
|
|
25
26
|
get bi(): BiFacade;
|
|
27
|
+
get sessionHub(): SessionHubService;
|
|
26
28
|
}
|
|
@@ -12,6 +12,7 @@ import { FluxoClientInterface } from "./fluxo-client-interface";
|
|
|
12
12
|
import { CommunicationFacade } from "./communication";
|
|
13
13
|
import { RavifyFacade } from "./ravify/ravify.facade";
|
|
14
14
|
import { BiFacade } from "./bi";
|
|
15
|
+
import { SessionHubService } from "./session-hub";
|
|
15
16
|
export declare abstract class FluxoClientBase implements FluxoClientInterface {
|
|
16
17
|
get modules(): any[];
|
|
17
18
|
static get HttpClient(): HttpClient;
|
|
@@ -28,6 +29,7 @@ export declare abstract class FluxoClientBase implements FluxoClientInterface {
|
|
|
28
29
|
private _config;
|
|
29
30
|
private _ravify;
|
|
30
31
|
private _biFacade;
|
|
32
|
+
private _sessionHub;
|
|
31
33
|
private _modules;
|
|
32
34
|
register(module: any): void;
|
|
33
35
|
protected abstract AddSetupConfiguration(config: FluxoClientConfiguration): void;
|
|
@@ -47,5 +49,6 @@ export declare abstract class FluxoClientBase implements FluxoClientInterface {
|
|
|
47
49
|
get workflow(): WorkflowService;
|
|
48
50
|
get ravify(): RavifyFacade;
|
|
49
51
|
get bi(): BiFacade;
|
|
52
|
+
get sessionHub(): SessionHubService;
|
|
50
53
|
private getBearerToken;
|
|
51
54
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './session-hub.service';
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { HubConnectionState } from '@microsoft/signalr';
|
|
2
|
+
/**
|
|
3
|
+
* SessionHubService manages the WebSocket connection to the backend session hub
|
|
4
|
+
* using SignalR with JWT authentication and automatic reconnection.
|
|
5
|
+
*/
|
|
6
|
+
export declare class SessionHubService {
|
|
7
|
+
private connection;
|
|
8
|
+
private hubUrl;
|
|
9
|
+
private getAccessToken;
|
|
10
|
+
private reconnectAttempts;
|
|
11
|
+
private maxReconnectAttempts;
|
|
12
|
+
private reconnectDelay;
|
|
13
|
+
private eventHandlers;
|
|
14
|
+
private reconnectTimeoutId;
|
|
15
|
+
private isManualStop;
|
|
16
|
+
constructor(baseUrl: string, getAccessToken: () => string);
|
|
17
|
+
getConnectedUsers(): Promise<{
|
|
18
|
+
userId: string;
|
|
19
|
+
count: number;
|
|
20
|
+
userName: string;
|
|
21
|
+
sessions: {
|
|
22
|
+
wsConnectionId: string;
|
|
23
|
+
userId: string;
|
|
24
|
+
userName: string;
|
|
25
|
+
ipAddress: string;
|
|
26
|
+
deviceId: string;
|
|
27
|
+
isPossibleFraud: boolean;
|
|
28
|
+
currentPage: string;
|
|
29
|
+
currentPath: string;
|
|
30
|
+
isActive: boolean;
|
|
31
|
+
browser: string;
|
|
32
|
+
}[];
|
|
33
|
+
}[]>;
|
|
34
|
+
/**
|
|
35
|
+
* Initializes and starts the SignalR connection
|
|
36
|
+
*/
|
|
37
|
+
start(): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Stops the SignalR connection
|
|
40
|
+
*/
|
|
41
|
+
stop(): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Subscribe to a hub event
|
|
44
|
+
* @param eventName The name of the event to listen to
|
|
45
|
+
* @param handler The callback function to execute when the event is received
|
|
46
|
+
*/
|
|
47
|
+
on(eventName: string, handler: (...args: any[]) => void): void;
|
|
48
|
+
/**
|
|
49
|
+
* Unsubscribe from a hub event
|
|
50
|
+
* @param eventName The name of the event to stop listening to
|
|
51
|
+
* @param handler The specific handler to remove (optional, removes all if not provided)
|
|
52
|
+
*/
|
|
53
|
+
off(eventName: string, handler?: (...args: any[]) => void): void;
|
|
54
|
+
/**
|
|
55
|
+
* Invoke a method on the server hub
|
|
56
|
+
* @param methodName The name of the method to invoke
|
|
57
|
+
* @param args Arguments to pass to the method
|
|
58
|
+
*/
|
|
59
|
+
invoke<T = any>(methodName: string, ...args: any[]): Promise<T>;
|
|
60
|
+
/**
|
|
61
|
+
* Send a message to the server hub (fire and forget)
|
|
62
|
+
* @param methodName The name of the method to send
|
|
63
|
+
* @param args Arguments to pass to the method
|
|
64
|
+
*/
|
|
65
|
+
send(methodName: string, ...args: any[]): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Get the current connection state
|
|
68
|
+
*/
|
|
69
|
+
get state(): HubConnectionState;
|
|
70
|
+
/**
|
|
71
|
+
* Check if the connection is currently active
|
|
72
|
+
*/
|
|
73
|
+
get isConnected(): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Get the connection ID
|
|
76
|
+
*/
|
|
77
|
+
get connectionId(): string | null;
|
|
78
|
+
/**
|
|
79
|
+
* Setup connection lifecycle handlers
|
|
80
|
+
*/
|
|
81
|
+
private setupConnectionHandlers;
|
|
82
|
+
/**
|
|
83
|
+
* Reattach all registered event handlers after reconnection
|
|
84
|
+
*/
|
|
85
|
+
private reattachEventHandlers;
|
|
86
|
+
/**
|
|
87
|
+
* Schedule a reconnection attempt
|
|
88
|
+
*/
|
|
89
|
+
private scheduleReconnect;
|
|
90
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Device ID Manager
|
|
3
|
+
* Gestisce la generazione e il recupero del device-id univoco per il dispositivo
|
|
4
|
+
*/
|
|
5
|
+
export declare class DeviceIdManager {
|
|
6
|
+
/**
|
|
7
|
+
* Genera un UUID v4
|
|
8
|
+
*/
|
|
9
|
+
private static generateUUID;
|
|
10
|
+
/**
|
|
11
|
+
* Ottiene il device-id dal localStorage o ne genera uno nuovo
|
|
12
|
+
*/
|
|
13
|
+
static getDeviceId(): string;
|
|
14
|
+
/**
|
|
15
|
+
* Genera forzatamente un nuovo device-id
|
|
16
|
+
*/
|
|
17
|
+
static regenerateDeviceId(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Rimuove il device-id dal localStorage
|
|
20
|
+
*/
|
|
21
|
+
static clearDeviceId(): void;
|
|
22
|
+
}
|
package/src/lib/utils/index.d.ts
CHANGED