@djangocfg/api 1.2.40 → 1.2.41
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.cjs +2001 -1978
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +46 -4
- package/dist/index.d.ts +46 -4
- package/dist/index.mjs +2001 -1978
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/cfg/generated/_utils/schemas/APIZone.schema.ts +2 -0
- package/src/cfg/generated/_utils/schemas/APIZonesSummary.schema.ts +2 -1
- package/src/cfg/generated/_utils/schemas/ZonesSummaryStats.schema.ts +21 -0
- package/src/cfg/generated/_utils/schemas/index.ts +1 -0
- package/src/cfg/generated/cfg__dashboard__dashboard_api_zones/models.ts +14 -1
- package/src/cfg/generated/client.ts +14 -1
- package/src/cfg/generated/schema.json +35 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/api",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.41",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "DjangoCFG",
|
|
6
6
|
"url": "https://djangocfg.com"
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@types/node": "^22.15.3",
|
|
69
69
|
"@types/react": "19.2.2",
|
|
70
70
|
"@types/react-dom": "19.2.1",
|
|
71
|
-
"@djangocfg/typescript-config": "^1.2.
|
|
71
|
+
"@djangocfg/typescript-config": "^1.2.41",
|
|
72
72
|
"react": "^19.1.0",
|
|
73
73
|
"react-dom": "^19.1.0",
|
|
74
74
|
"tsup": "^8.5.0",
|
|
@@ -6,13 +6,14 @@
|
|
|
6
6
|
* */
|
|
7
7
|
import { z } from 'zod'
|
|
8
8
|
import { APIZoneSchema } from './APIZone.schema'
|
|
9
|
+
import { ZonesSummaryStatsSchema } from './ZonesSummaryStats.schema'
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* API zones summary serializer.
|
|
12
13
|
*/
|
|
13
14
|
export const APIZonesSummarySchema = z.object({
|
|
14
15
|
zones: z.array(APIZoneSchema),
|
|
15
|
-
summary:
|
|
16
|
+
summary: ZonesSummaryStatsSchema,
|
|
16
17
|
})
|
|
17
18
|
|
|
18
19
|
/**
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for ZonesSummaryStats
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Summary statistics for API zones.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Summary statistics for API zones.
|
|
11
|
+
*/
|
|
12
|
+
export const ZonesSummaryStatsSchema = z.object({
|
|
13
|
+
total_apps: z.int(),
|
|
14
|
+
total_endpoints: z.int(),
|
|
15
|
+
total_zones: z.int(),
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Infer TypeScript type from Zod schema
|
|
20
|
+
*/
|
|
21
|
+
export type ZonesSummaryStats = z.infer<typeof ZonesSummaryStatsSchema>
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export interface APIZonesSummary {
|
|
7
7
|
zones: Array<APIZone>;
|
|
8
|
-
summary:
|
|
8
|
+
summary: ZonesSummaryStats;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -21,7 +21,20 @@ export interface APIZone {
|
|
|
21
21
|
endpoint_count: number;
|
|
22
22
|
status: string;
|
|
23
23
|
schema_url: string;
|
|
24
|
+
relative_schema_url: string;
|
|
24
25
|
api_url: string;
|
|
26
|
+
relative_api_url: string;
|
|
25
27
|
apps: Array<string>;
|
|
26
28
|
}
|
|
27
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Summary statistics for API zones.
|
|
32
|
+
*
|
|
33
|
+
* Response model (includes read-only fields).
|
|
34
|
+
*/
|
|
35
|
+
export interface ZonesSummaryStats {
|
|
36
|
+
total_apps: number;
|
|
37
|
+
total_endpoints: number;
|
|
38
|
+
total_zones: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
@@ -353,6 +353,19 @@ export class APIClient {
|
|
|
353
353
|
error.message.toLowerCase().includes('failed to fetch') ||
|
|
354
354
|
error.message.toLowerCase().includes('network request failed'));
|
|
355
355
|
|
|
356
|
+
// Log specific error type first
|
|
357
|
+
if (this.logger) {
|
|
358
|
+
if (isCORSError) {
|
|
359
|
+
this.logger.error(`🚫 CORS Error: ${method} ${url}`);
|
|
360
|
+
this.logger.error(` → ${error instanceof Error ? error.message : String(error)}`);
|
|
361
|
+
this.logger.error(` → Configure security_domains parameter on the server`);
|
|
362
|
+
} else {
|
|
363
|
+
this.logger.error(`⚠️ Network Error: ${method} ${url}`);
|
|
364
|
+
this.logger.error(` → ${error instanceof Error ? error.message : String(error)}`);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
// Dispatch browser events
|
|
356
369
|
if (typeof window !== 'undefined') {
|
|
357
370
|
try {
|
|
358
371
|
if (isCORSError) {
|
|
@@ -390,7 +403,7 @@ export class APIClient {
|
|
|
390
403
|
? new NetworkError(error.message, url, error)
|
|
391
404
|
: new NetworkError('Unknown error', url);
|
|
392
405
|
|
|
393
|
-
//
|
|
406
|
+
// Detailed logging via logger.logError
|
|
394
407
|
if (this.logger) {
|
|
395
408
|
this.logger.logError(
|
|
396
409
|
{
|
|
@@ -10785,9 +10785,15 @@
|
|
|
10785
10785
|
"schema_url": {
|
|
10786
10786
|
"type": "string"
|
|
10787
10787
|
},
|
|
10788
|
+
"relative_schema_url": {
|
|
10789
|
+
"type": "string"
|
|
10790
|
+
},
|
|
10788
10791
|
"api_url": {
|
|
10789
10792
|
"type": "string"
|
|
10790
10793
|
},
|
|
10794
|
+
"relative_api_url": {
|
|
10795
|
+
"type": "string"
|
|
10796
|
+
},
|
|
10791
10797
|
"apps": {
|
|
10792
10798
|
"type": "array",
|
|
10793
10799
|
"items": {
|
|
@@ -10802,6 +10808,8 @@
|
|
|
10802
10808
|
"description",
|
|
10803
10809
|
"endpoint_count",
|
|
10804
10810
|
"name",
|
|
10811
|
+
"relative_api_url",
|
|
10812
|
+
"relative_schema_url",
|
|
10805
10813
|
"schema_url",
|
|
10806
10814
|
"status",
|
|
10807
10815
|
"title"
|
|
@@ -10818,8 +10826,7 @@
|
|
|
10818
10826
|
}
|
|
10819
10827
|
},
|
|
10820
10828
|
"summary": {
|
|
10821
|
-
"
|
|
10822
|
-
"additionalProperties": {}
|
|
10829
|
+
"$ref": "#/components/schemas/ZonesSummaryStats"
|
|
10823
10830
|
}
|
|
10824
10831
|
},
|
|
10825
10832
|
"required": [
|
|
@@ -22588,6 +22595,26 @@
|
|
|
22588
22595
|
"required": [
|
|
22589
22596
|
"total_workers"
|
|
22590
22597
|
]
|
|
22598
|
+
},
|
|
22599
|
+
"ZonesSummaryStats": {
|
|
22600
|
+
"type": "object",
|
|
22601
|
+
"description": "Summary statistics for API zones.",
|
|
22602
|
+
"properties": {
|
|
22603
|
+
"total_apps": {
|
|
22604
|
+
"type": "integer"
|
|
22605
|
+
},
|
|
22606
|
+
"total_endpoints": {
|
|
22607
|
+
"type": "integer"
|
|
22608
|
+
},
|
|
22609
|
+
"total_zones": {
|
|
22610
|
+
"type": "integer"
|
|
22611
|
+
}
|
|
22612
|
+
},
|
|
22613
|
+
"required": [
|
|
22614
|
+
"total_apps",
|
|
22615
|
+
"total_endpoints",
|
|
22616
|
+
"total_zones"
|
|
22617
|
+
]
|
|
22591
22618
|
}
|
|
22592
22619
|
},
|
|
22593
22620
|
"securitySchemes": {
|
|
@@ -22611,5 +22638,10 @@
|
|
|
22611
22638
|
"bearerFormat": "JWT"
|
|
22612
22639
|
}
|
|
22613
22640
|
}
|
|
22614
|
-
}
|
|
22641
|
+
},
|
|
22642
|
+
"servers": [
|
|
22643
|
+
{
|
|
22644
|
+
"url": "http://localhost:8000"
|
|
22645
|
+
}
|
|
22646
|
+
]
|
|
22615
22647
|
}
|