@praxisui/core 1.0.0-beta.10 → 1.0.0-beta.12
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/README.md +10 -0
- package/fesm2022/praxisui-core.mjs +43 -4
- package/fesm2022/praxisui-core.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
> Biblioteca central com interfaces e serviços fundamentais para o Praxis UI Workspace
|
|
4
4
|
|
|
5
|
+
## 🔰 Exemplos / Quickstart
|
|
6
|
+
|
|
7
|
+
Para ver esta biblioteca em funcionamento em uma aplicação completa, utilize o projeto de exemplo (Quickstart):
|
|
8
|
+
|
|
9
|
+
- Repositório: https://github.com/codexrodrigues/praxis-ui-quickstart
|
|
10
|
+
- O Quickstart demonstra a integração das bibliotecas `@praxisui/*` em um app Angular, incluindo instalação, configuração e uso em telas reais.
|
|
11
|
+
|
|
5
12
|
## 🌟 Visão Geral
|
|
6
13
|
|
|
7
14
|
A biblioteca `@praxisui/core` é o núcleo do Praxis UI Workspace, fornecendo interfaces robustas, serviços base e utilitários essenciais para todas as outras bibliotecas do ecossistema. Com a arquitetura unificada, oferece uma experiência de desenvolvimento consistente e type-safe.
|
|
@@ -35,6 +42,9 @@ A biblioteca `@praxisui/core` é o núcleo do Praxis UI Workspace, fornecendo in
|
|
|
35
42
|
npm install @praxisui/core
|
|
36
43
|
```
|
|
37
44
|
|
|
45
|
+
Exemplo completo (app de referência)
|
|
46
|
+
- Quickstart: https://github.com/codexrodrigues/praxis-ui-quickstart
|
|
47
|
+
|
|
38
48
|
### Peer dependencies (Angular v20)
|
|
39
49
|
|
|
40
50
|
- `@angular/core` `^20.0.0`
|
|
@@ -1954,10 +1954,19 @@ class GenericCrudService {
|
|
|
1954
1954
|
const baseUrl = buildApiUrl(entry);
|
|
1955
1955
|
try {
|
|
1956
1956
|
const origin = new URL(baseUrl).origin;
|
|
1957
|
-
return `${origin}/schemas/filtered`;
|
|
1957
|
+
return `${origin.replace(/\/+$/, '')}/schemas/filtered`;
|
|
1958
1958
|
}
|
|
1959
1959
|
catch {
|
|
1960
|
-
|
|
1960
|
+
// Tolerate relative baseUrl (e.g., '/api') by resolving against app origin when available
|
|
1961
|
+
try {
|
|
1962
|
+
const appOrigin = globalThis?.location?.origin;
|
|
1963
|
+
if (appOrigin && typeof appOrigin === 'string' && appOrigin.startsWith('http')) {
|
|
1964
|
+
return `${appOrigin.replace(/\/+$/, '')}/schemas/filtered`;
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
catch { }
|
|
1968
|
+
// Last resort: localhost origin to build an absolute URL (document SSR guidance in docs)
|
|
1969
|
+
return 'http://localhost/schemas/filtered';
|
|
1961
1970
|
}
|
|
1962
1971
|
}
|
|
1963
1972
|
/**
|
|
@@ -6483,11 +6492,41 @@ class SchemaMetadataClient {
|
|
|
6483
6492
|
try {
|
|
6484
6493
|
apiOrigin = new URL(params.baseUrl).origin;
|
|
6485
6494
|
}
|
|
6486
|
-
catch {
|
|
6495
|
+
catch {
|
|
6496
|
+
try {
|
|
6497
|
+
apiOrigin = globalThis?.location?.origin || '';
|
|
6498
|
+
}
|
|
6499
|
+
catch { }
|
|
6500
|
+
}
|
|
6487
6501
|
const schemaId = buildSchemaId({ ...params, apiOrigin });
|
|
6488
6502
|
const cached = await this.cache.get(schemaId);
|
|
6489
6503
|
// Build URL with query params
|
|
6490
|
-
|
|
6504
|
+
let u;
|
|
6505
|
+
try {
|
|
6506
|
+
u = new URL(params.baseUrl);
|
|
6507
|
+
}
|
|
6508
|
+
catch (err) {
|
|
6509
|
+
// Accept relative baseUrl by resolving against the app origin when available
|
|
6510
|
+
const origin = (() => {
|
|
6511
|
+
try {
|
|
6512
|
+
return globalThis?.location?.origin;
|
|
6513
|
+
}
|
|
6514
|
+
catch {
|
|
6515
|
+
return undefined;
|
|
6516
|
+
}
|
|
6517
|
+
})();
|
|
6518
|
+
if (origin && origin.startsWith('http')) {
|
|
6519
|
+
u = new URL(params.baseUrl, origin);
|
|
6520
|
+
}
|
|
6521
|
+
else {
|
|
6522
|
+
// Friendly error for hosts: instruct to set absolute baseUrl or provide runtime origin
|
|
6523
|
+
const e = new Error(`Failed to construct schema URL. API_URL.baseUrl appears relative and no runtime origin is available. ` +
|
|
6524
|
+
`Set API_URL.baseUrl to an absolute URL (e.g., http://localhost:4200/api) or run in a browser context. ` +
|
|
6525
|
+
`Received baseUrl="${params.baseUrl}".`);
|
|
6526
|
+
e.cause = err;
|
|
6527
|
+
throw e;
|
|
6528
|
+
}
|
|
6529
|
+
}
|
|
6491
6530
|
u.searchParams.set('path', params.path);
|
|
6492
6531
|
u.searchParams.set('operation', (params.operation || 'get').toLowerCase());
|
|
6493
6532
|
u.searchParams.set('schemaType', (params.schemaType || 'response').toLowerCase());
|