teraprox-core-sdk 0.2.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/index.d.mts +163 -0
- package/dist/index.d.ts +163 -0
- package/dist/index.js +1015 -0
- package/dist/index.mjs +961 -0
- package/package.json +49 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { Dispatch } from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import * as redux from 'redux';
|
|
5
|
+
import * as _reduxjs_toolkit from '@reduxjs/toolkit';
|
|
6
|
+
|
|
7
|
+
interface HttpController {
|
|
8
|
+
get(path?: string, query?: string): Promise<any>;
|
|
9
|
+
post(path?: string, data?: any, extraHeaders?: Record<string, string>, query?: string): Promise<any>;
|
|
10
|
+
put(path?: string, data?: any, extraHeaders?: Record<string, string>, query?: string): Promise<any>;
|
|
11
|
+
patch(path?: string, data?: any, extraHeaders?: Record<string, string>, query?: string): Promise<any>;
|
|
12
|
+
delete(path?: string, id?: string | number, extraHeaders?: Record<string, string>, query?: string): Promise<any>;
|
|
13
|
+
deleteSimple(path?: string, extraHeaders?: Record<string, string>, query?: string): Promise<any>;
|
|
14
|
+
save(path?: string, data?: any, extraHeaders?: Record<string, string>, query?: string): Promise<any>;
|
|
15
|
+
read(path?: string, id?: string | number, extraHeaders?: Record<string, string>, query?: string): Promise<any>;
|
|
16
|
+
readAll(path?: string, extraHeaders?: Record<string, string>, query?: string): Promise<any>;
|
|
17
|
+
readAllwithPage(path?: string, page?: number, size?: number): Promise<any>;
|
|
18
|
+
bulkDelete(path?: string, ids?: (string | number)[], extraHeaders?: Record<string, string>, query?: string): Promise<any>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface ToastOptions {
|
|
22
|
+
autoDismiss?: boolean;
|
|
23
|
+
autoDismissTimeout?: number;
|
|
24
|
+
}
|
|
25
|
+
interface ToastService {
|
|
26
|
+
success(message: string, options?: ToastOptions): void;
|
|
27
|
+
warning(message: string, options?: ToastOptions): void;
|
|
28
|
+
error(message: string, options?: ToastOptions): void;
|
|
29
|
+
info(message: string, options?: ToastOptions): void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface MatchingObjectSubscription {
|
|
33
|
+
context: string;
|
|
34
|
+
location: string;
|
|
35
|
+
refresher?: (payload: any, dispatch: Dispatch<any>) => void;
|
|
36
|
+
persist?: boolean;
|
|
37
|
+
userId?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface CoreService {
|
|
41
|
+
/** Cria um HttpController configurado para um contexto/endpoint */
|
|
42
|
+
createController(context: string, baseEndPoint?: string): HttpController;
|
|
43
|
+
/** Serviço de toast/notificações */
|
|
44
|
+
toast: ToastService;
|
|
45
|
+
/** Subscreve a um MatchingObject (real-time via Firebase RTDB) */
|
|
46
|
+
subscribe(mo: MatchingObjectSubscription): void;
|
|
47
|
+
/** Remove subscrição de um MatchingObject */
|
|
48
|
+
unsubscribe(mo: MatchingObjectSubscription): void;
|
|
49
|
+
/** Subscreve a eventos de MatchingObject via EventTarget */
|
|
50
|
+
subscribeEvent(context: string, location: string, handler: EventListenerOrEventListenerObject): void;
|
|
51
|
+
/** Remove subscrição de evento de MatchingObject */
|
|
52
|
+
unsubscribeEvent(context: string, location: string, handler: EventListenerOrEventListenerObject): void;
|
|
53
|
+
/** Encerra a sessão do usuário */
|
|
54
|
+
handleLogout(): void;
|
|
55
|
+
/** Indica se o componente está hospedado pelo Core */
|
|
56
|
+
hostedByCore: boolean;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
interface Notification {
|
|
60
|
+
id?: string | number;
|
|
61
|
+
_id?: string | number;
|
|
62
|
+
deliveryId?: string | number;
|
|
63
|
+
title?: string;
|
|
64
|
+
message?: string;
|
|
65
|
+
type?: string;
|
|
66
|
+
createdAt?: string;
|
|
67
|
+
[key: string]: any;
|
|
68
|
+
}
|
|
69
|
+
interface NotificationState {
|
|
70
|
+
unreadNotifications: Notification[];
|
|
71
|
+
archivedNotifications: {
|
|
72
|
+
read: Notification[];
|
|
73
|
+
dismissed: Notification[];
|
|
74
|
+
};
|
|
75
|
+
readNotificationIds: (string | number)[];
|
|
76
|
+
unreadCount: number;
|
|
77
|
+
initialLoadComplete: boolean;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
interface NavigationConfig {
|
|
81
|
+
replace?: boolean;
|
|
82
|
+
state?: any;
|
|
83
|
+
[key: string]: any;
|
|
84
|
+
}
|
|
85
|
+
type NavigateFn = (path: string | number, config?: NavigationConfig, pageName?: string) => void;
|
|
86
|
+
|
|
87
|
+
declare const CoreServiceContext: react.Context<CoreService | null>;
|
|
88
|
+
|
|
89
|
+
declare function useCoreService(): CoreService;
|
|
90
|
+
|
|
91
|
+
declare function useHttpController(context: string, baseEndPoint?: string): HttpController;
|
|
92
|
+
|
|
93
|
+
declare function useToast(): ToastService;
|
|
94
|
+
|
|
95
|
+
declare function useMatchingObject(context: string, location: string, refresher: (payload: any, dispatch: Dispatch<any>) => void, deps?: any[]): void;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Hook read-only para estado de notificações do Redux (shared store).
|
|
99
|
+
* Funciona tanto em modo federado quanto standalone pois react-redux é singleton.
|
|
100
|
+
*/
|
|
101
|
+
declare function useNotifications(): NotificationState;
|
|
102
|
+
|
|
103
|
+
interface PageTrackingActions {
|
|
104
|
+
setPageLocation: (pageName: string) => {
|
|
105
|
+
type: string;
|
|
106
|
+
payload: string;
|
|
107
|
+
};
|
|
108
|
+
setPrevPage: (pageName: string) => {
|
|
109
|
+
type: string;
|
|
110
|
+
payload: string;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
interface NavigatorConfig {
|
|
114
|
+
/** Redux actions para tracking de página (setPageLocation, setPrevPage) */
|
|
115
|
+
pageTracking: PageTrackingActions;
|
|
116
|
+
/** Paths constantes do app (loginForm, acessoNaoPermitido) */
|
|
117
|
+
paths: {
|
|
118
|
+
loginForm: string;
|
|
119
|
+
acessoNaoPermitido: string;
|
|
120
|
+
inativeUser?: string;
|
|
121
|
+
};
|
|
122
|
+
/** Seletores para permissões e estado de navegação */
|
|
123
|
+
permissionsSelector?: (state: any) => any[] | undefined;
|
|
124
|
+
pageLocationSelector?: (state: any) => string;
|
|
125
|
+
prevPageSelector?: (state: any) => string;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Hook de navegação padronizado com checagem de permissão.
|
|
129
|
+
* Unifica a lógica duplicada entre SGP e SGM.
|
|
130
|
+
*/
|
|
131
|
+
declare function useNavigator(config: NavigatorConfig): NavigateFn;
|
|
132
|
+
|
|
133
|
+
interface RecursoDisplayerProps {
|
|
134
|
+
selectedList?: any[];
|
|
135
|
+
onSaveRecurso: (recursos: any[], checked?: boolean) => void;
|
|
136
|
+
singleReturn?: boolean;
|
|
137
|
+
}
|
|
138
|
+
declare const RecursoDisplayer: ({ selectedList, onSaveRecurso, singleReturn, }: RecursoDisplayerProps) => react_jsx_runtime.JSX.Element;
|
|
139
|
+
|
|
140
|
+
interface BranchLevelForm {
|
|
141
|
+
nome: string;
|
|
142
|
+
level: number;
|
|
143
|
+
color: string;
|
|
144
|
+
hasComponents: boolean;
|
|
145
|
+
excludeLevels: number;
|
|
146
|
+
}
|
|
147
|
+
interface BranchLevelState {
|
|
148
|
+
form: BranchLevelForm;
|
|
149
|
+
levels: any[];
|
|
150
|
+
}
|
|
151
|
+
declare const setNome: _reduxjs_toolkit.ActionCreatorWithPayload<string, "branchLevelReducer/setNome">;
|
|
152
|
+
declare const setLevel: _reduxjs_toolkit.ActionCreatorWithPayload<number, "branchLevelReducer/setLevel">;
|
|
153
|
+
declare const populateToEdit: _reduxjs_toolkit.ActionCreatorWithPayload<BranchLevelForm, "branchLevelReducer/populateToEdit">;
|
|
154
|
+
declare const setColor: _reduxjs_toolkit.ActionCreatorWithPayload<string, "branchLevelReducer/setColor">;
|
|
155
|
+
declare const setHaveComponente: _reduxjs_toolkit.ActionCreatorWithPayload<boolean, "branchLevelReducer/setHaveComponente">;
|
|
156
|
+
declare const clearBranchLevelForm: _reduxjs_toolkit.ActionCreatorWithoutPayload<"branchLevelReducer/clear">;
|
|
157
|
+
declare const setExcludeLevels: _reduxjs_toolkit.ActionCreatorWithPayload<number, "branchLevelReducer/setExcludeLevels">;
|
|
158
|
+
declare const setLevels: _reduxjs_toolkit.ActionCreatorWithPayload<any[], "branchLevelReducer/setLevels">;
|
|
159
|
+
declare const _default: redux.Reducer<BranchLevelState>;
|
|
160
|
+
|
|
161
|
+
declare function pickTextColorBasedOnBgColorAdvanced(bgColor: string, lightColor: string, darkColor: string): string;
|
|
162
|
+
|
|
163
|
+
export { type CoreService, CoreServiceContext, type HttpController, type MatchingObjectSubscription, type NavigateFn, type NavigationConfig, type Notification, type NotificationState, RecursoDisplayer, type ToastOptions, type ToastService, _default as branchLevelReducer, clearBranchLevelForm, pickTextColorBasedOnBgColorAdvanced, populateToEdit, setColor, setExcludeLevels, setHaveComponente, setLevel, setLevels, setNome, useCoreService, useHttpController, useMatchingObject, useNavigator, useNotifications, useToast };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { Dispatch } from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import * as redux from 'redux';
|
|
5
|
+
import * as _reduxjs_toolkit from '@reduxjs/toolkit';
|
|
6
|
+
|
|
7
|
+
interface HttpController {
|
|
8
|
+
get(path?: string, query?: string): Promise<any>;
|
|
9
|
+
post(path?: string, data?: any, extraHeaders?: Record<string, string>, query?: string): Promise<any>;
|
|
10
|
+
put(path?: string, data?: any, extraHeaders?: Record<string, string>, query?: string): Promise<any>;
|
|
11
|
+
patch(path?: string, data?: any, extraHeaders?: Record<string, string>, query?: string): Promise<any>;
|
|
12
|
+
delete(path?: string, id?: string | number, extraHeaders?: Record<string, string>, query?: string): Promise<any>;
|
|
13
|
+
deleteSimple(path?: string, extraHeaders?: Record<string, string>, query?: string): Promise<any>;
|
|
14
|
+
save(path?: string, data?: any, extraHeaders?: Record<string, string>, query?: string): Promise<any>;
|
|
15
|
+
read(path?: string, id?: string | number, extraHeaders?: Record<string, string>, query?: string): Promise<any>;
|
|
16
|
+
readAll(path?: string, extraHeaders?: Record<string, string>, query?: string): Promise<any>;
|
|
17
|
+
readAllwithPage(path?: string, page?: number, size?: number): Promise<any>;
|
|
18
|
+
bulkDelete(path?: string, ids?: (string | number)[], extraHeaders?: Record<string, string>, query?: string): Promise<any>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface ToastOptions {
|
|
22
|
+
autoDismiss?: boolean;
|
|
23
|
+
autoDismissTimeout?: number;
|
|
24
|
+
}
|
|
25
|
+
interface ToastService {
|
|
26
|
+
success(message: string, options?: ToastOptions): void;
|
|
27
|
+
warning(message: string, options?: ToastOptions): void;
|
|
28
|
+
error(message: string, options?: ToastOptions): void;
|
|
29
|
+
info(message: string, options?: ToastOptions): void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface MatchingObjectSubscription {
|
|
33
|
+
context: string;
|
|
34
|
+
location: string;
|
|
35
|
+
refresher?: (payload: any, dispatch: Dispatch<any>) => void;
|
|
36
|
+
persist?: boolean;
|
|
37
|
+
userId?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface CoreService {
|
|
41
|
+
/** Cria um HttpController configurado para um contexto/endpoint */
|
|
42
|
+
createController(context: string, baseEndPoint?: string): HttpController;
|
|
43
|
+
/** Serviço de toast/notificações */
|
|
44
|
+
toast: ToastService;
|
|
45
|
+
/** Subscreve a um MatchingObject (real-time via Firebase RTDB) */
|
|
46
|
+
subscribe(mo: MatchingObjectSubscription): void;
|
|
47
|
+
/** Remove subscrição de um MatchingObject */
|
|
48
|
+
unsubscribe(mo: MatchingObjectSubscription): void;
|
|
49
|
+
/** Subscreve a eventos de MatchingObject via EventTarget */
|
|
50
|
+
subscribeEvent(context: string, location: string, handler: EventListenerOrEventListenerObject): void;
|
|
51
|
+
/** Remove subscrição de evento de MatchingObject */
|
|
52
|
+
unsubscribeEvent(context: string, location: string, handler: EventListenerOrEventListenerObject): void;
|
|
53
|
+
/** Encerra a sessão do usuário */
|
|
54
|
+
handleLogout(): void;
|
|
55
|
+
/** Indica se o componente está hospedado pelo Core */
|
|
56
|
+
hostedByCore: boolean;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
interface Notification {
|
|
60
|
+
id?: string | number;
|
|
61
|
+
_id?: string | number;
|
|
62
|
+
deliveryId?: string | number;
|
|
63
|
+
title?: string;
|
|
64
|
+
message?: string;
|
|
65
|
+
type?: string;
|
|
66
|
+
createdAt?: string;
|
|
67
|
+
[key: string]: any;
|
|
68
|
+
}
|
|
69
|
+
interface NotificationState {
|
|
70
|
+
unreadNotifications: Notification[];
|
|
71
|
+
archivedNotifications: {
|
|
72
|
+
read: Notification[];
|
|
73
|
+
dismissed: Notification[];
|
|
74
|
+
};
|
|
75
|
+
readNotificationIds: (string | number)[];
|
|
76
|
+
unreadCount: number;
|
|
77
|
+
initialLoadComplete: boolean;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
interface NavigationConfig {
|
|
81
|
+
replace?: boolean;
|
|
82
|
+
state?: any;
|
|
83
|
+
[key: string]: any;
|
|
84
|
+
}
|
|
85
|
+
type NavigateFn = (path: string | number, config?: NavigationConfig, pageName?: string) => void;
|
|
86
|
+
|
|
87
|
+
declare const CoreServiceContext: react.Context<CoreService | null>;
|
|
88
|
+
|
|
89
|
+
declare function useCoreService(): CoreService;
|
|
90
|
+
|
|
91
|
+
declare function useHttpController(context: string, baseEndPoint?: string): HttpController;
|
|
92
|
+
|
|
93
|
+
declare function useToast(): ToastService;
|
|
94
|
+
|
|
95
|
+
declare function useMatchingObject(context: string, location: string, refresher: (payload: any, dispatch: Dispatch<any>) => void, deps?: any[]): void;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Hook read-only para estado de notificações do Redux (shared store).
|
|
99
|
+
* Funciona tanto em modo federado quanto standalone pois react-redux é singleton.
|
|
100
|
+
*/
|
|
101
|
+
declare function useNotifications(): NotificationState;
|
|
102
|
+
|
|
103
|
+
interface PageTrackingActions {
|
|
104
|
+
setPageLocation: (pageName: string) => {
|
|
105
|
+
type: string;
|
|
106
|
+
payload: string;
|
|
107
|
+
};
|
|
108
|
+
setPrevPage: (pageName: string) => {
|
|
109
|
+
type: string;
|
|
110
|
+
payload: string;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
interface NavigatorConfig {
|
|
114
|
+
/** Redux actions para tracking de página (setPageLocation, setPrevPage) */
|
|
115
|
+
pageTracking: PageTrackingActions;
|
|
116
|
+
/** Paths constantes do app (loginForm, acessoNaoPermitido) */
|
|
117
|
+
paths: {
|
|
118
|
+
loginForm: string;
|
|
119
|
+
acessoNaoPermitido: string;
|
|
120
|
+
inativeUser?: string;
|
|
121
|
+
};
|
|
122
|
+
/** Seletores para permissões e estado de navegação */
|
|
123
|
+
permissionsSelector?: (state: any) => any[] | undefined;
|
|
124
|
+
pageLocationSelector?: (state: any) => string;
|
|
125
|
+
prevPageSelector?: (state: any) => string;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Hook de navegação padronizado com checagem de permissão.
|
|
129
|
+
* Unifica a lógica duplicada entre SGP e SGM.
|
|
130
|
+
*/
|
|
131
|
+
declare function useNavigator(config: NavigatorConfig): NavigateFn;
|
|
132
|
+
|
|
133
|
+
interface RecursoDisplayerProps {
|
|
134
|
+
selectedList?: any[];
|
|
135
|
+
onSaveRecurso: (recursos: any[], checked?: boolean) => void;
|
|
136
|
+
singleReturn?: boolean;
|
|
137
|
+
}
|
|
138
|
+
declare const RecursoDisplayer: ({ selectedList, onSaveRecurso, singleReturn, }: RecursoDisplayerProps) => react_jsx_runtime.JSX.Element;
|
|
139
|
+
|
|
140
|
+
interface BranchLevelForm {
|
|
141
|
+
nome: string;
|
|
142
|
+
level: number;
|
|
143
|
+
color: string;
|
|
144
|
+
hasComponents: boolean;
|
|
145
|
+
excludeLevels: number;
|
|
146
|
+
}
|
|
147
|
+
interface BranchLevelState {
|
|
148
|
+
form: BranchLevelForm;
|
|
149
|
+
levels: any[];
|
|
150
|
+
}
|
|
151
|
+
declare const setNome: _reduxjs_toolkit.ActionCreatorWithPayload<string, "branchLevelReducer/setNome">;
|
|
152
|
+
declare const setLevel: _reduxjs_toolkit.ActionCreatorWithPayload<number, "branchLevelReducer/setLevel">;
|
|
153
|
+
declare const populateToEdit: _reduxjs_toolkit.ActionCreatorWithPayload<BranchLevelForm, "branchLevelReducer/populateToEdit">;
|
|
154
|
+
declare const setColor: _reduxjs_toolkit.ActionCreatorWithPayload<string, "branchLevelReducer/setColor">;
|
|
155
|
+
declare const setHaveComponente: _reduxjs_toolkit.ActionCreatorWithPayload<boolean, "branchLevelReducer/setHaveComponente">;
|
|
156
|
+
declare const clearBranchLevelForm: _reduxjs_toolkit.ActionCreatorWithoutPayload<"branchLevelReducer/clear">;
|
|
157
|
+
declare const setExcludeLevels: _reduxjs_toolkit.ActionCreatorWithPayload<number, "branchLevelReducer/setExcludeLevels">;
|
|
158
|
+
declare const setLevels: _reduxjs_toolkit.ActionCreatorWithPayload<any[], "branchLevelReducer/setLevels">;
|
|
159
|
+
declare const _default: redux.Reducer<BranchLevelState>;
|
|
160
|
+
|
|
161
|
+
declare function pickTextColorBasedOnBgColorAdvanced(bgColor: string, lightColor: string, darkColor: string): string;
|
|
162
|
+
|
|
163
|
+
export { type CoreService, CoreServiceContext, type HttpController, type MatchingObjectSubscription, type NavigateFn, type NavigationConfig, type Notification, type NotificationState, RecursoDisplayer, type ToastOptions, type ToastService, _default as branchLevelReducer, clearBranchLevelForm, pickTextColorBasedOnBgColorAdvanced, populateToEdit, setColor, setExcludeLevels, setHaveComponente, setLevel, setLevels, setNome, useCoreService, useHttpController, useMatchingObject, useNavigator, useNotifications, useToast };
|