@lastbrain/ai-ui-core 1.0.11 → 1.0.13

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.
@@ -1 +1 @@
1
- {"version":3,"file":"enhanced-gateway.d.ts","sourceRoot":"","sources":["../../../src/route-handlers/nextjs/enhanced-gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AA8IxD,wBAAsB,GAAG,CACvB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAA;CAAE,8BAGjD;AAED,wBAAsB,IAAI,CACxB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAA;CAAE,8BAGjD;AAED,wBAAsB,GAAG,CACvB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAA;CAAE,8BAGjD"}
1
+ {"version":3,"file":"enhanced-gateway.d.ts","sourceRoot":"","sources":["../../../src/route-handlers/nextjs/enhanced-gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAuJxD,wBAAsB,GAAG,CACvB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAA;CAAE,8BAGjD;AAED,wBAAsB,IAAI,CACxB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAA;CAAE,8BAGjD;AAED,wBAAsB,GAAG,CACvB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAA;CAAE,8BAGjD"}
@@ -15,6 +15,13 @@ if (!LB_API_KEY) {
15
15
  * Maps internal auth routes to public API routes
16
16
  */
17
17
  function mapAuthRouteToPublicRoute(path) {
18
+ // Si le path contient déjà api/public/v1, extraire seulement la partie après
19
+ if (path.includes("api/public/v1/")) {
20
+ return path.split("api/public/v1/")[1] || path;
21
+ }
22
+ if (path.startsWith("api/public/v1")) {
23
+ return path.slice("api/public/v1".length).replace(/^\//, "") || path;
24
+ }
18
25
  // Remove leading 'ai/' if present
19
26
  const cleanPath = path.startsWith("ai/") ? path.slice(3) : path;
20
27
  // Route mapping for auth routes -> public routes
@@ -32,8 +39,8 @@ function mapAuthRouteToPublicRoute(path) {
32
39
  // Image generation
33
40
  "auth/generate-image": "api/public/v1/image-ai",
34
41
  // Status and provider (with and without public prefix)
35
- "status": "api/public/v1/status",
36
- "provider": "api/public/v1/provider",
42
+ status: "api/public/v1/status",
43
+ provider: "api/public/v1/provider",
37
44
  "public/gateway-models": "api/public/v1/provider",
38
45
  "public/status": "api/public/v1/status",
39
46
  };
@@ -47,7 +54,7 @@ function mapAuthRouteToPublicRoute(path) {
47
54
  return target + cleanPath.slice(pattern.length);
48
55
  }
49
56
  }
50
- // Default: assume it's already a public route
57
+ // Default: if already a public route, return as-is
51
58
  if (cleanPath.startsWith("api/public/")) {
52
59
  return cleanPath;
53
60
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lastbrain/ai-ui-core",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "Framework-agnostic core library for LastBrain AI UI Kit",
5
5
  "private": false,
6
6
  "type": "module",
@@ -21,6 +21,15 @@ if (!LB_API_KEY) {
21
21
  * Maps internal auth routes to public API routes
22
22
  */
23
23
  function mapAuthRouteToPublicRoute(path: string): string {
24
+ // Si le path contient déjà api/public/v1, extraire seulement la partie après
25
+ if (path.includes("api/public/v1/")) {
26
+ return path.split("api/public/v1/")[1] || path;
27
+ }
28
+
29
+ if (path.startsWith("api/public/v1")) {
30
+ return path.slice("api/public/v1".length).replace(/^\//, "") || path;
31
+ }
32
+
24
33
  // Remove leading 'ai/' if present
25
34
  const cleanPath = path.startsWith("ai/") ? path.slice(3) : path;
26
35
 
@@ -43,8 +52,8 @@ function mapAuthRouteToPublicRoute(path: string): string {
43
52
  "auth/generate-image": "api/public/v1/image-ai",
44
53
 
45
54
  // Status and provider (with and without public prefix)
46
- "status": "api/public/v1/status",
47
- "provider": "api/public/v1/provider",
55
+ status: "api/public/v1/status",
56
+ provider: "api/public/v1/provider",
48
57
  "public/gateway-models": "api/public/v1/provider",
49
58
  "public/status": "api/public/v1/status",
50
59
  };
@@ -61,7 +70,7 @@ function mapAuthRouteToPublicRoute(path: string): string {
61
70
  }
62
71
  }
63
72
 
64
- // Default: assume it's already a public route
73
+ // Default: if already a public route, return as-is
65
74
  if (cleanPath.startsWith("api/public/")) {
66
75
  return cleanPath;
67
76
  }