teraprox-core-sdk 0.3.3 → 0.3.6
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/{chunk-CLNYFYWU.mjs → chunk-JK654W4P.mjs} +23 -4
- package/dist/{federation-UNcGnNB-.d.mts → federation-Bhx0XhSP.d.mts} +47 -1
- package/dist/{federation-UNcGnNB-.d.ts → federation-Bhx0XhSP.d.ts} +47 -1
- package/dist/federation.d.mts +1 -1
- package/dist/federation.d.ts +1 -1
- package/dist/federation.js +24 -4
- package/dist/federation.mjs +1 -1
- package/dist/index.d.mts +292 -3
- package/dist/index.d.ts +292 -3
- package/dist/index.js +396 -7
- package/dist/index.mjs +364 -4
- package/package.json +2 -2
|
@@ -52,6 +52,23 @@ function createReducersBundle(config) {
|
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
// src/adapters/null/NullObservabilityAdapter.ts
|
|
56
|
+
var NullObservabilityAdapter = class {
|
|
57
|
+
trackInteraction(payload) {
|
|
58
|
+
var _a;
|
|
59
|
+
console.info(`[Observability] INTERACTION: ${payload.name}`, (_a = payload.properties) != null ? _a : {});
|
|
60
|
+
}
|
|
61
|
+
captureVitals(payload) {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
const unit = (_a = payload.unit) != null ? _a : "";
|
|
64
|
+
console.info(`[Observability] VITAL: ${payload.name} = ${payload.value}${unit}`, (_b = payload.meta) != null ? _b : {});
|
|
65
|
+
}
|
|
66
|
+
logBreadcrumb(payload) {
|
|
67
|
+
var _a;
|
|
68
|
+
console.info(`[Observability] BREADCRUMB [${payload.category}]: ${payload.message}`, (_a = payload.data) != null ? _a : {});
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
55
72
|
// src/federation/StandaloneProvider.tsx
|
|
56
73
|
import { useMemo, useCallback, useState, useEffect as useEffect2, useRef } from "react";
|
|
57
74
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
@@ -271,7 +288,8 @@ function StandaloneProvider({ createController, addToast, firebaseConfig, emulat
|
|
|
271
288
|
},
|
|
272
289
|
handleLogout: () => {
|
|
273
290
|
},
|
|
274
|
-
hostedByCore: false
|
|
291
|
+
hostedByCore: false,
|
|
292
|
+
observability: new NullObservabilityAdapter()
|
|
275
293
|
}),
|
|
276
294
|
[createController, toast, subscribe, unsubscribe]
|
|
277
295
|
);
|
|
@@ -290,14 +308,14 @@ var DEFAULT_DEV_USER = {
|
|
|
290
308
|
lastName: "User",
|
|
291
309
|
token: "dev-standalone-token",
|
|
292
310
|
email: "dev@teraprox.local",
|
|
293
|
-
id: "
|
|
311
|
+
id: "1",
|
|
294
312
|
role: "admin",
|
|
295
313
|
user: "devuser",
|
|
296
314
|
userName: "devuser",
|
|
297
315
|
setor: "Desenvolvimento",
|
|
298
|
-
userSetor: { setorId: "
|
|
316
|
+
userSetor: { setorId: "1" },
|
|
299
317
|
companyName: "Dev Company",
|
|
300
|
-
companyId: "
|
|
318
|
+
companyId: "1",
|
|
301
319
|
filters: []
|
|
302
320
|
};
|
|
303
321
|
function DevAutoLogin({ actions, devUser, children }) {
|
|
@@ -321,6 +339,7 @@ export {
|
|
|
321
339
|
CoreServiceContext,
|
|
322
340
|
FederatedBridge,
|
|
323
341
|
createReducersBundle,
|
|
342
|
+
NullObservabilityAdapter,
|
|
324
343
|
StandaloneProvider,
|
|
325
344
|
DevAutoLogin
|
|
326
345
|
};
|
|
@@ -34,6 +34,50 @@ interface MatchingObjectSubscription {
|
|
|
34
34
|
userId?: string;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Port de Observabilidade — contrato entre os Use Cases/Adapters e
|
|
39
|
+
* qualquer implementação de RUM (Datadog, Sentry, Grafana, console…).
|
|
40
|
+
*/
|
|
41
|
+
interface VitalsPayload {
|
|
42
|
+
/** Nome da métrica Web Vital: 'LCP', 'CLS', 'FID', 'TTFB', etc. */
|
|
43
|
+
name: string;
|
|
44
|
+
/** Valor numérico da métrica */
|
|
45
|
+
value: number;
|
|
46
|
+
/** Unidade da métrica: 'ms', 'score', 'count', etc. */
|
|
47
|
+
unit?: string;
|
|
48
|
+
/** Metadados adicionais opcionais */
|
|
49
|
+
meta?: Record<string, unknown>;
|
|
50
|
+
}
|
|
51
|
+
interface BreadcrumbPayload {
|
|
52
|
+
/** Categoria do breadcrumb: 'action', 'navigation', 'http', 'error', etc. */
|
|
53
|
+
category: string;
|
|
54
|
+
/** Mensagem legível descrevendo o evento */
|
|
55
|
+
message: string;
|
|
56
|
+
/** Dados estruturados adicionais */
|
|
57
|
+
data?: Record<string, unknown>;
|
|
58
|
+
}
|
|
59
|
+
interface InteractionPayload {
|
|
60
|
+
/** Nome da interação (ex.: 'save-solicitacao', 'approve-ss', 'reject-ss') */
|
|
61
|
+
name: string;
|
|
62
|
+
/** Propriedades associadas à interação */
|
|
63
|
+
properties?: Record<string, unknown>;
|
|
64
|
+
}
|
|
65
|
+
interface IObservabilityPort {
|
|
66
|
+
/**
|
|
67
|
+
* Registra uma interação do usuário (clique, submit, navegação intencional).
|
|
68
|
+
* Usado para rastrear fluxos de negócio e funis.
|
|
69
|
+
*/
|
|
70
|
+
trackInteraction(payload: InteractionPayload): void;
|
|
71
|
+
/**
|
|
72
|
+
* Captura métricas de performance (Web Vitals: LCP, CLS, FID, TTFB).
|
|
73
|
+
*/
|
|
74
|
+
captureVitals(payload: VitalsPayload): void;
|
|
75
|
+
/**
|
|
76
|
+
* Adiciona um breadcrumb ao trail de eventos para diagnóstico de erros.
|
|
77
|
+
*/
|
|
78
|
+
logBreadcrumb(payload: BreadcrumbPayload): void;
|
|
79
|
+
}
|
|
80
|
+
|
|
37
81
|
interface CoreService {
|
|
38
82
|
/** Cria um HttpController configurado para um contexto/endpoint */
|
|
39
83
|
createController(context: string, baseEndPoint?: string): HttpController;
|
|
@@ -51,6 +95,8 @@ interface CoreService {
|
|
|
51
95
|
handleLogout(): void;
|
|
52
96
|
/** Indica se o componente está hospedado pelo Core */
|
|
53
97
|
hostedByCore: boolean;
|
|
98
|
+
/** Porta de observabilidade — tracking, vitals e breadcrumbs */
|
|
99
|
+
observability: IObservabilityPort;
|
|
54
100
|
}
|
|
55
101
|
|
|
56
102
|
interface FederatedBridgeProps {
|
|
@@ -270,4 +316,4 @@ interface RemoteManifest {
|
|
|
270
316
|
menuSections: RemoteMenuSection[];
|
|
271
317
|
}
|
|
272
318
|
|
|
273
|
-
export { type CoreService as C, DevAutoLogin as D, FederatedBridge as F, type HttpController as H, type MatchingObjectSubscription as M, type ReducersBundle as R, StandaloneProvider as S, type ToastService as T, type
|
|
319
|
+
export { type BreadcrumbPayload as B, type CoreService as C, DevAutoLogin as D, FederatedBridge as F, type HttpController as H, type IObservabilityPort as I, type MatchingObjectSubscription as M, type ReducersBundle as R, StandaloneProvider as S, type ToastService as T, type VitalsPayload as V, type InteractionPayload as a, type ReducersBundleConfig as b, type RemoteManifest as c, type RemoteMenuItem as d, type RemoteMenuSection as e, type ToastOptions as f, createReducersBundle as g };
|
|
@@ -34,6 +34,50 @@ interface MatchingObjectSubscription {
|
|
|
34
34
|
userId?: string;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Port de Observabilidade — contrato entre os Use Cases/Adapters e
|
|
39
|
+
* qualquer implementação de RUM (Datadog, Sentry, Grafana, console…).
|
|
40
|
+
*/
|
|
41
|
+
interface VitalsPayload {
|
|
42
|
+
/** Nome da métrica Web Vital: 'LCP', 'CLS', 'FID', 'TTFB', etc. */
|
|
43
|
+
name: string;
|
|
44
|
+
/** Valor numérico da métrica */
|
|
45
|
+
value: number;
|
|
46
|
+
/** Unidade da métrica: 'ms', 'score', 'count', etc. */
|
|
47
|
+
unit?: string;
|
|
48
|
+
/** Metadados adicionais opcionais */
|
|
49
|
+
meta?: Record<string, unknown>;
|
|
50
|
+
}
|
|
51
|
+
interface BreadcrumbPayload {
|
|
52
|
+
/** Categoria do breadcrumb: 'action', 'navigation', 'http', 'error', etc. */
|
|
53
|
+
category: string;
|
|
54
|
+
/** Mensagem legível descrevendo o evento */
|
|
55
|
+
message: string;
|
|
56
|
+
/** Dados estruturados adicionais */
|
|
57
|
+
data?: Record<string, unknown>;
|
|
58
|
+
}
|
|
59
|
+
interface InteractionPayload {
|
|
60
|
+
/** Nome da interação (ex.: 'save-solicitacao', 'approve-ss', 'reject-ss') */
|
|
61
|
+
name: string;
|
|
62
|
+
/** Propriedades associadas à interação */
|
|
63
|
+
properties?: Record<string, unknown>;
|
|
64
|
+
}
|
|
65
|
+
interface IObservabilityPort {
|
|
66
|
+
/**
|
|
67
|
+
* Registra uma interação do usuário (clique, submit, navegação intencional).
|
|
68
|
+
* Usado para rastrear fluxos de negócio e funis.
|
|
69
|
+
*/
|
|
70
|
+
trackInteraction(payload: InteractionPayload): void;
|
|
71
|
+
/**
|
|
72
|
+
* Captura métricas de performance (Web Vitals: LCP, CLS, FID, TTFB).
|
|
73
|
+
*/
|
|
74
|
+
captureVitals(payload: VitalsPayload): void;
|
|
75
|
+
/**
|
|
76
|
+
* Adiciona um breadcrumb ao trail de eventos para diagnóstico de erros.
|
|
77
|
+
*/
|
|
78
|
+
logBreadcrumb(payload: BreadcrumbPayload): void;
|
|
79
|
+
}
|
|
80
|
+
|
|
37
81
|
interface CoreService {
|
|
38
82
|
/** Cria um HttpController configurado para um contexto/endpoint */
|
|
39
83
|
createController(context: string, baseEndPoint?: string): HttpController;
|
|
@@ -51,6 +95,8 @@ interface CoreService {
|
|
|
51
95
|
handleLogout(): void;
|
|
52
96
|
/** Indica se o componente está hospedado pelo Core */
|
|
53
97
|
hostedByCore: boolean;
|
|
98
|
+
/** Porta de observabilidade — tracking, vitals e breadcrumbs */
|
|
99
|
+
observability: IObservabilityPort;
|
|
54
100
|
}
|
|
55
101
|
|
|
56
102
|
interface FederatedBridgeProps {
|
|
@@ -270,4 +316,4 @@ interface RemoteManifest {
|
|
|
270
316
|
menuSections: RemoteMenuSection[];
|
|
271
317
|
}
|
|
272
318
|
|
|
273
|
-
export { type CoreService as C, DevAutoLogin as D, FederatedBridge as F, type HttpController as H, type MatchingObjectSubscription as M, type ReducersBundle as R, StandaloneProvider as S, type ToastService as T, type
|
|
319
|
+
export { type BreadcrumbPayload as B, type CoreService as C, DevAutoLogin as D, FederatedBridge as F, type HttpController as H, type IObservabilityPort as I, type MatchingObjectSubscription as M, type ReducersBundle as R, StandaloneProvider as S, type ToastService as T, type VitalsPayload as V, type InteractionPayload as a, type ReducersBundleConfig as b, type RemoteManifest as c, type RemoteMenuItem as d, type RemoteMenuSection as e, type ToastOptions as f, createReducersBundle as g };
|
package/dist/federation.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { D as DevAutoLogin, F as FederatedBridge, R as ReducersBundle,
|
|
1
|
+
export { D as DevAutoLogin, F as FederatedBridge, R as ReducersBundle, b as ReducersBundleConfig, c as RemoteManifest, d as RemoteMenuItem, e as RemoteMenuSection, S as StandaloneProvider, g as createReducersBundle } from './federation-Bhx0XhSP.mjs';
|
|
2
2
|
import 'react/jsx-runtime';
|
|
3
3
|
import 'react';
|
package/dist/federation.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { D as DevAutoLogin, F as FederatedBridge, R as ReducersBundle,
|
|
1
|
+
export { D as DevAutoLogin, F as FederatedBridge, R as ReducersBundle, b as ReducersBundleConfig, c as RemoteManifest, d as RemoteMenuItem, e as RemoteMenuSection, S as StandaloneProvider, g as createReducersBundle } from './federation-Bhx0XhSP.js';
|
|
2
2
|
import 'react/jsx-runtime';
|
|
3
3
|
import 'react';
|
package/dist/federation.js
CHANGED
|
@@ -95,6 +95,25 @@ function createReducersBundle(config) {
|
|
|
95
95
|
|
|
96
96
|
// src/federation/StandaloneProvider.tsx
|
|
97
97
|
var import_react3 = require("react");
|
|
98
|
+
|
|
99
|
+
// src/adapters/null/NullObservabilityAdapter.ts
|
|
100
|
+
var NullObservabilityAdapter = class {
|
|
101
|
+
trackInteraction(payload) {
|
|
102
|
+
var _a;
|
|
103
|
+
console.info(`[Observability] INTERACTION: ${payload.name}`, (_a = payload.properties) != null ? _a : {});
|
|
104
|
+
}
|
|
105
|
+
captureVitals(payload) {
|
|
106
|
+
var _a, _b;
|
|
107
|
+
const unit = (_a = payload.unit) != null ? _a : "";
|
|
108
|
+
console.info(`[Observability] VITAL: ${payload.name} = ${payload.value}${unit}`, (_b = payload.meta) != null ? _b : {});
|
|
109
|
+
}
|
|
110
|
+
logBreadcrumb(payload) {
|
|
111
|
+
var _a;
|
|
112
|
+
console.info(`[Observability] BREADCRUMB [${payload.category}]: ${payload.message}`, (_a = payload.data) != null ? _a : {});
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// src/federation/StandaloneProvider.tsx
|
|
98
117
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
99
118
|
async function probeEmulator(host, port) {
|
|
100
119
|
try {
|
|
@@ -312,7 +331,8 @@ function StandaloneProvider({ createController, addToast, firebaseConfig, emulat
|
|
|
312
331
|
},
|
|
313
332
|
handleLogout: () => {
|
|
314
333
|
},
|
|
315
|
-
hostedByCore: false
|
|
334
|
+
hostedByCore: false,
|
|
335
|
+
observability: new NullObservabilityAdapter()
|
|
316
336
|
}),
|
|
317
337
|
[createController, toast, subscribe, unsubscribe]
|
|
318
338
|
);
|
|
@@ -331,14 +351,14 @@ var DEFAULT_DEV_USER = {
|
|
|
331
351
|
lastName: "User",
|
|
332
352
|
token: "dev-standalone-token",
|
|
333
353
|
email: "dev@teraprox.local",
|
|
334
|
-
id: "
|
|
354
|
+
id: "1",
|
|
335
355
|
role: "admin",
|
|
336
356
|
user: "devuser",
|
|
337
357
|
userName: "devuser",
|
|
338
358
|
setor: "Desenvolvimento",
|
|
339
|
-
userSetor: { setorId: "
|
|
359
|
+
userSetor: { setorId: "1" },
|
|
340
360
|
companyName: "Dev Company",
|
|
341
|
-
companyId: "
|
|
361
|
+
companyId: "1",
|
|
342
362
|
filters: []
|
|
343
363
|
};
|
|
344
364
|
function DevAutoLogin({ actions, devUser, children }) {
|
package/dist/federation.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CoreService, H as HttpController,
|
|
2
|
-
export { D as DevAutoLogin, F as FederatedBridge, M as MatchingObjectSubscription, R as ReducersBundle,
|
|
1
|
+
import { C as CoreService, T as ToastService, I as IObservabilityPort, H as HttpController, a as InteractionPayload, V as VitalsPayload, B as BreadcrumbPayload } from './federation-Bhx0XhSP.mjs';
|
|
2
|
+
export { D as DevAutoLogin, F as FederatedBridge, M as MatchingObjectSubscription, R as ReducersBundle, b as ReducersBundleConfig, c as RemoteManifest, d as RemoteMenuItem, e as RemoteMenuSection, S as StandaloneProvider, f as ToastOptions, g as createReducersBundle } from './federation-Bhx0XhSP.mjs';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { Dispatch } from 'react';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
@@ -34,8 +34,257 @@ interface NavigationConfig {
|
|
|
34
34
|
}
|
|
35
35
|
type NavigateFn = (path: string | number, config?: NavigationConfig, pageName?: string) => void;
|
|
36
36
|
|
|
37
|
+
type StatusSolicitacao = 'PENDENTE' | 'APROVADO' | 'REPROVADO' | 'CANCELADO' | 'EM_EXECUCAO';
|
|
38
|
+
interface SolicitacaoDeServico {
|
|
39
|
+
id: string | number;
|
|
40
|
+
status: StatusSolicitacao;
|
|
41
|
+
dataDeAbertura: string;
|
|
42
|
+
descricaoDoProblema: string;
|
|
43
|
+
solicitante: {
|
|
44
|
+
id: string | number;
|
|
45
|
+
nome: string;
|
|
46
|
+
};
|
|
47
|
+
recurso?: {
|
|
48
|
+
id: string | number;
|
|
49
|
+
nome: string;
|
|
50
|
+
};
|
|
51
|
+
recursoNome?: string;
|
|
52
|
+
prioridade?: 'BAIXA' | 'MEDIA' | 'ALTA' | 'URGENTE';
|
|
53
|
+
setor?: string;
|
|
54
|
+
equipamento?: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
37
57
|
declare const CoreServiceContext: React.Context<CoreService | null>;
|
|
38
58
|
|
|
59
|
+
declare class FetchHttpAdapter implements HttpController {
|
|
60
|
+
private endpoint;
|
|
61
|
+
private extraHeaders?;
|
|
62
|
+
constructor(endpoint: string, extraHeaders?: Record<string, string> | undefined);
|
|
63
|
+
private request;
|
|
64
|
+
get(path?: string): Promise<any>;
|
|
65
|
+
post(path?: string, data?: any): Promise<any>;
|
|
66
|
+
put(path?: string, data?: any): Promise<any>;
|
|
67
|
+
patch(path?: string, data?: any): Promise<any>;
|
|
68
|
+
delete(path?: string, id?: string | number): Promise<any>;
|
|
69
|
+
deleteSimple(path?: string): Promise<any>;
|
|
70
|
+
save(path?: string, data?: any): Promise<any>;
|
|
71
|
+
read(path?: string, id?: string | number): Promise<any>;
|
|
72
|
+
readAll(path?: string): Promise<any>;
|
|
73
|
+
readAllwithPage(path?: string): Promise<any>;
|
|
74
|
+
bulkDelete(path?: string): Promise<any>;
|
|
75
|
+
}
|
|
76
|
+
declare class CoreServiceBuilder {
|
|
77
|
+
private _toast;
|
|
78
|
+
private _httpEndpoint?;
|
|
79
|
+
private _rtdbConfig?;
|
|
80
|
+
private _hostedByCore;
|
|
81
|
+
private _observability;
|
|
82
|
+
private _tracing;
|
|
83
|
+
withToast(toast: ToastService): this;
|
|
84
|
+
withHttpEndpoint(url: string): this;
|
|
85
|
+
withRtdbConfig(config: any): this;
|
|
86
|
+
setHostedByCore(hosted: boolean): this;
|
|
87
|
+
withObservability(observability: IObservabilityPort): this;
|
|
88
|
+
/**
|
|
89
|
+
* Ativa Distributed Tracing W3C nos controllers HTTP.
|
|
90
|
+
* Quando habilitado, `createController` retorna `TracingHttpAdapter` em vez de `FetchHttpAdapter`.
|
|
91
|
+
* O header `traceparent` é injetado em todas as requisições automaticamente.
|
|
92
|
+
*/
|
|
93
|
+
withTracing(enabled?: boolean): this;
|
|
94
|
+
build(): CoreService;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
declare class NullToastService implements ToastService {
|
|
98
|
+
success(message: string): void;
|
|
99
|
+
warning(message: string): void;
|
|
100
|
+
error(message: string): void;
|
|
101
|
+
info(message: string): void;
|
|
102
|
+
}
|
|
103
|
+
declare class NullHttpController implements HttpController {
|
|
104
|
+
private logAndResolve;
|
|
105
|
+
get(path?: string): Promise<{
|
|
106
|
+
id: number;
|
|
107
|
+
nome: string;
|
|
108
|
+
branchLevel: {
|
|
109
|
+
level: number;
|
|
110
|
+
};
|
|
111
|
+
status: string;
|
|
112
|
+
}[]> | Promise<{
|
|
113
|
+
id: number;
|
|
114
|
+
level: number;
|
|
115
|
+
nome: string;
|
|
116
|
+
}[]>;
|
|
117
|
+
post(path?: string): Promise<{
|
|
118
|
+
id: number;
|
|
119
|
+
nome: string;
|
|
120
|
+
branchLevel: {
|
|
121
|
+
level: number;
|
|
122
|
+
};
|
|
123
|
+
status: string;
|
|
124
|
+
}[]> | Promise<{
|
|
125
|
+
id: number;
|
|
126
|
+
level: number;
|
|
127
|
+
nome: string;
|
|
128
|
+
}[]>;
|
|
129
|
+
put(path?: string): Promise<{
|
|
130
|
+
id: number;
|
|
131
|
+
nome: string;
|
|
132
|
+
branchLevel: {
|
|
133
|
+
level: number;
|
|
134
|
+
};
|
|
135
|
+
status: string;
|
|
136
|
+
}[]> | Promise<{
|
|
137
|
+
id: number;
|
|
138
|
+
level: number;
|
|
139
|
+
nome: string;
|
|
140
|
+
}[]>;
|
|
141
|
+
patch(path?: string): Promise<{
|
|
142
|
+
id: number;
|
|
143
|
+
nome: string;
|
|
144
|
+
branchLevel: {
|
|
145
|
+
level: number;
|
|
146
|
+
};
|
|
147
|
+
status: string;
|
|
148
|
+
}[]> | Promise<{
|
|
149
|
+
id: number;
|
|
150
|
+
level: number;
|
|
151
|
+
nome: string;
|
|
152
|
+
}[]>;
|
|
153
|
+
delete(path?: string, id?: string | number): Promise<{
|
|
154
|
+
id: number;
|
|
155
|
+
nome: string;
|
|
156
|
+
branchLevel: {
|
|
157
|
+
level: number;
|
|
158
|
+
};
|
|
159
|
+
status: string;
|
|
160
|
+
}[]> | Promise<{
|
|
161
|
+
id: number;
|
|
162
|
+
level: number;
|
|
163
|
+
nome: string;
|
|
164
|
+
}[]>;
|
|
165
|
+
deleteSimple(path?: string): Promise<{
|
|
166
|
+
id: number;
|
|
167
|
+
nome: string;
|
|
168
|
+
branchLevel: {
|
|
169
|
+
level: number;
|
|
170
|
+
};
|
|
171
|
+
status: string;
|
|
172
|
+
}[]> | Promise<{
|
|
173
|
+
id: number;
|
|
174
|
+
level: number;
|
|
175
|
+
nome: string;
|
|
176
|
+
}[]>;
|
|
177
|
+
save(path?: string): Promise<{
|
|
178
|
+
id: number;
|
|
179
|
+
nome: string;
|
|
180
|
+
branchLevel: {
|
|
181
|
+
level: number;
|
|
182
|
+
};
|
|
183
|
+
status: string;
|
|
184
|
+
}[]> | Promise<{
|
|
185
|
+
id: number;
|
|
186
|
+
level: number;
|
|
187
|
+
nome: string;
|
|
188
|
+
}[]>;
|
|
189
|
+
read(path?: string, id?: string | number): Promise<{
|
|
190
|
+
id: number;
|
|
191
|
+
nome: string;
|
|
192
|
+
branchLevel: {
|
|
193
|
+
level: number;
|
|
194
|
+
};
|
|
195
|
+
status: string;
|
|
196
|
+
}[]> | Promise<{
|
|
197
|
+
id: number;
|
|
198
|
+
level: number;
|
|
199
|
+
nome: string;
|
|
200
|
+
}[]>;
|
|
201
|
+
readAll(path?: string): Promise<{
|
|
202
|
+
id: number;
|
|
203
|
+
nome: string;
|
|
204
|
+
branchLevel: {
|
|
205
|
+
level: number;
|
|
206
|
+
};
|
|
207
|
+
status: string;
|
|
208
|
+
}[]> | Promise<{
|
|
209
|
+
id: number;
|
|
210
|
+
level: number;
|
|
211
|
+
nome: string;
|
|
212
|
+
}[]>;
|
|
213
|
+
readAllwithPage(path?: string): Promise<{
|
|
214
|
+
id: number;
|
|
215
|
+
nome: string;
|
|
216
|
+
branchLevel: {
|
|
217
|
+
level: number;
|
|
218
|
+
};
|
|
219
|
+
status: string;
|
|
220
|
+
}[]> | Promise<{
|
|
221
|
+
id: number;
|
|
222
|
+
level: number;
|
|
223
|
+
nome: string;
|
|
224
|
+
}[]>;
|
|
225
|
+
bulkDelete(path?: string): Promise<{
|
|
226
|
+
id: number;
|
|
227
|
+
nome: string;
|
|
228
|
+
branchLevel: {
|
|
229
|
+
level: number;
|
|
230
|
+
};
|
|
231
|
+
status: string;
|
|
232
|
+
}[]> | Promise<{
|
|
233
|
+
id: number;
|
|
234
|
+
level: number;
|
|
235
|
+
nome: string;
|
|
236
|
+
}[]>;
|
|
237
|
+
}
|
|
238
|
+
declare const NullCoreService: CoreService;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Null Object Pattern — implementação fallback de `IObservabilityPort`.
|
|
242
|
+
* Apenas loga no console; substitua pela implementação real (Datadog/Sentry/Grafana)
|
|
243
|
+
* via `CoreServiceBuilder.withObservability()` no host.
|
|
244
|
+
*/
|
|
245
|
+
declare class NullObservabilityAdapter implements IObservabilityPort {
|
|
246
|
+
trackInteraction(payload: InteractionPayload): void;
|
|
247
|
+
captureVitals(payload: VitalsPayload): void;
|
|
248
|
+
logBreadcrumb(payload: BreadcrumbPayload): void;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Decorator de HTTP que implementa Distributed Tracing via W3C TraceContext.
|
|
253
|
+
*
|
|
254
|
+
* - Gera um `trace-id` único por instância (cobre todos os spans de um contexto/controller).
|
|
255
|
+
* - Gera um `span-id` único por requisição HTTP.
|
|
256
|
+
* - Injeta o header `traceparent` em todas as chamadas: GET, POST, PUT, PATCH, DELETE, etc.
|
|
257
|
+
* - Mesclado com quaisquer `extraHeaders` já presentes na chamada.
|
|
258
|
+
*
|
|
259
|
+
* Uso via CoreServiceBuilder:
|
|
260
|
+
* ```ts
|
|
261
|
+
* new CoreServiceBuilder()
|
|
262
|
+
* .withHttpEndpoint(process.env.REACT_APP_END_POINT)
|
|
263
|
+
* .withTracing()
|
|
264
|
+
* .build()
|
|
265
|
+
* ```
|
|
266
|
+
*/
|
|
267
|
+
declare class TracingHttpAdapter implements HttpController {
|
|
268
|
+
private readonly endpoint;
|
|
269
|
+
private readonly extraHeaders?;
|
|
270
|
+
/** Identificador único desta cadeia de spans — compartilhado por todas as reqs do controller. */
|
|
271
|
+
private readonly traceId;
|
|
272
|
+
constructor(endpoint: string, extraHeaders?: Record<string, string> | undefined);
|
|
273
|
+
private mergeHeaders;
|
|
274
|
+
private request;
|
|
275
|
+
get(path?: string): Promise<any>;
|
|
276
|
+
post(path?: string, data?: any, extraHeaders?: Record<string, string>): Promise<any>;
|
|
277
|
+
put(path?: string, data?: any, extraHeaders?: Record<string, string>): Promise<any>;
|
|
278
|
+
patch(path?: string, data?: any, extraHeaders?: Record<string, string>): Promise<any>;
|
|
279
|
+
delete(path?: string, id?: string | number, extraHeaders?: Record<string, string>): Promise<any>;
|
|
280
|
+
deleteSimple(path?: string, extraHeaders?: Record<string, string>): Promise<any>;
|
|
281
|
+
save(path?: string, data?: any, extraHeaders?: Record<string, string>): Promise<any>;
|
|
282
|
+
read(path?: string, id?: string | number, extraHeaders?: Record<string, string>): Promise<any>;
|
|
283
|
+
readAll(path?: string, extraHeaders?: Record<string, string>): Promise<any>;
|
|
284
|
+
readAllwithPage(path?: string): Promise<any>;
|
|
285
|
+
bulkDelete(path?: string, ids?: (string | number)[], extraHeaders?: Record<string, string>): Promise<any>;
|
|
286
|
+
}
|
|
287
|
+
|
|
39
288
|
declare function useCoreService(): CoreService;
|
|
40
289
|
|
|
41
290
|
declare function useHttpController(context: string, baseEndPoint?: string): HttpController;
|
|
@@ -80,6 +329,16 @@ interface NavigatorConfig {
|
|
|
80
329
|
*/
|
|
81
330
|
declare function useNavigator(config: NavigatorConfig): NavigateFn;
|
|
82
331
|
|
|
332
|
+
/**
|
|
333
|
+
* Atalho para acessar o Port de observabilidade via React context.
|
|
334
|
+
* Retorna a implementação real (quando fornecida pelo host) ou o NullObservabilityAdapter.
|
|
335
|
+
*
|
|
336
|
+
* @example
|
|
337
|
+
* const obs = useObservability()
|
|
338
|
+
* obs.logBreadcrumb({ category: 'action', message: 'Solicitação aprovada', data: { id } })
|
|
339
|
+
*/
|
|
340
|
+
declare function useObservability(): IObservabilityPort;
|
|
341
|
+
|
|
83
342
|
interface FetchDataReturn<T = any> {
|
|
84
343
|
data: T | null;
|
|
85
344
|
loading: boolean;
|
|
@@ -198,6 +457,36 @@ declare const _default: redux.Reducer<PickerState>;
|
|
|
198
457
|
|
|
199
458
|
declare function pickTextColorBasedOnBgColorAdvanced(bgColor: string, lightColor: string, darkColor: string): string;
|
|
200
459
|
|
|
460
|
+
/**
|
|
461
|
+
* Instala PerformanceObserver para LCP e CLS automaticamente no bootstrap do módulo.
|
|
462
|
+
* Fallback silencioso em ambientes que não suportam a API (Node, browsers antigos).
|
|
463
|
+
*
|
|
464
|
+
* @param observability - Implementação de IObservabilityPort para receber as métricas.
|
|
465
|
+
*/
|
|
466
|
+
declare function initWebVitals(observability: IObservabilityPort): void;
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Utilitários de Distributed Tracing seguindo a especificação W3C TraceContext.
|
|
470
|
+
* https://www.w3.org/TR/trace-context/
|
|
471
|
+
*/
|
|
472
|
+
/**
|
|
473
|
+
* Gera um trace-id de 128 bits (32 chars hex) conforme W3C TraceContext.
|
|
474
|
+
* Usado uma vez por instância de adapter — identifica toda a cadeia de spans de um contexto.
|
|
475
|
+
*/
|
|
476
|
+
declare function generateTraceId(): string;
|
|
477
|
+
/**
|
|
478
|
+
* Gera um span-id de 64 bits (16 chars hex) conforme W3C TraceContext.
|
|
479
|
+
* Chamado a cada requisição HTTP — identifica um span individual.
|
|
480
|
+
*/
|
|
481
|
+
declare function generateSpanId(): string;
|
|
482
|
+
/**
|
|
483
|
+
* Monta o header `traceparent` no formato W3C:
|
|
484
|
+
* `{version}-{traceId}-{spanId}-{flags}`
|
|
485
|
+
*
|
|
486
|
+
* Flags: `01` = sampled (enviado ao coletor), `00` = não-amostrado.
|
|
487
|
+
*/
|
|
488
|
+
declare function buildTraceparent(traceId: string, spanId: string, sampled?: boolean): string;
|
|
489
|
+
|
|
201
490
|
/**
|
|
202
491
|
* Formats a date for display in Brazilian format.
|
|
203
492
|
* Corresponds to the duplicated dateUtils.js in SGM/SGP/Services/default/.
|
|
@@ -219,4 +508,4 @@ declare function removeAccents(str: string): string;
|
|
|
219
508
|
declare function slugify(str: string): string;
|
|
220
509
|
declare function isBlank(str: string | null | undefined): boolean;
|
|
221
510
|
|
|
222
|
-
export { CoreService, CoreServiceContext, HttpController, type NavigateFn, type NavigationConfig, type Notification, type NotificationState, RecursoDisplayer, ToastService, addDays, _default$1 as branchLevelReducer, capitalize, clearBranchLevelForm, clearPicker, daysBetween, formatDate, formatDateTime, isBlank, isDateAfter, isDateBefore, pickTextColorBasedOnBgColorAdvanced, _default as pickerReducer, populateToEdit, removeAccents, setColor, setExcludeLevels, setHaveComponente, setLevel, setLevels, setNome, setPickerContext, setPickerItems, setPickerSelected, setPickerVisible, slugify, toISOString, truncate, useAnexoUpload, useCoreService, useFetchData, useFormStorage, useHttpController, useMatchingObject, useNavigator, useNotifications, usePostData, useSmartSearch, useToast, useValidation };
|
|
511
|
+
export { BreadcrumbPayload, CoreService, CoreServiceBuilder, CoreServiceContext, FetchHttpAdapter, HttpController, IObservabilityPort, InteractionPayload, type NavigateFn, type NavigationConfig, type Notification, type NotificationState, NullCoreService, NullHttpController, NullObservabilityAdapter, NullToastService, RecursoDisplayer, type SolicitacaoDeServico, type StatusSolicitacao, ToastService, TracingHttpAdapter, VitalsPayload, addDays, _default$1 as branchLevelReducer, buildTraceparent, capitalize, clearBranchLevelForm, clearPicker, daysBetween, formatDate, formatDateTime, generateSpanId, generateTraceId, initWebVitals, isBlank, isDateAfter, isDateBefore, pickTextColorBasedOnBgColorAdvanced, _default as pickerReducer, populateToEdit, removeAccents, setColor, setExcludeLevels, setHaveComponente, setLevel, setLevels, setNome, setPickerContext, setPickerItems, setPickerSelected, setPickerVisible, slugify, toISOString, truncate, useAnexoUpload, useCoreService, useFetchData, useFormStorage, useHttpController, useMatchingObject, useNavigator, useNotifications, useObservability, usePostData, useSmartSearch, useToast, useValidation };
|