@kaito-http/core 4.0.0-beta.7 → 4.0.0-beta.8

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 CHANGED
@@ -178,7 +178,10 @@ var Router = class _Router {
178
178
  merge = (pathPrefix, other) => {
179
179
  const newRoutes = [...other.state.routes].map((route) => ({
180
180
  ...route,
181
- path: `${pathPrefix}${route.path}`
181
+ // handle pathPrefix = / & route.path = / case causing //
182
+ // we intentionally are replacing on the joining path and not the pathPrefix, in case of
183
+ // /named -> merged to -> / causing /named/ not /named
184
+ path: `${pathPrefix}${route.path === "/" ? "" : route.path}`
182
185
  }));
183
186
  return new _Router({
184
187
  ...this.state,
@@ -366,7 +369,7 @@ var Router = class _Router {
366
369
  const item = {
367
370
  description: route.openapi?.description ?? "Successful response",
368
371
  responses: {
369
- default: {
372
+ 200: {
370
373
  description: route.openapi?.description ?? "Successful response",
371
374
  content
372
375
  }
package/dist/index.d.cts CHANGED
@@ -148,7 +148,7 @@ type Route<ContextTo, Result, Path extends string, AdditionalParams extends Reco
148
148
  };
149
149
  type AnyRoute = Route<any, any, any, any, any, any, any>;
150
150
 
151
- type PrefixRoutesPathInner<R extends AnyRoute, Prefix extends `/${string}`> = R extends Route<infer ContextTo, infer Result, infer Path, infer AdditionalParams, infer Method, infer Query, infer BodyOutput> ? Route<ContextTo, Result, `${Prefix}${Path}`, AdditionalParams, Method, Query, BodyOutput> : never;
151
+ type PrefixRoutesPathInner<R extends AnyRoute, Prefix extends `/${string}`> = R extends Route<infer ContextTo, infer Result, infer Path, infer AdditionalParams, infer Method, infer Query, infer BodyOutput> ? Route<ContextTo, Result, `${Prefix}${Path extends '/' ? '' : Path}`, AdditionalParams, Method, Query, BodyOutput> : never;
152
152
  type PrefixRoutesPath<Prefix extends `/${string}`, R extends AnyRoute> = R extends R ? PrefixRoutesPathInner<R, Prefix> : never;
153
153
  type RouterState<ContextFrom, ContextTo, RequiredParams extends Record<string, unknown>, Routes extends AnyRoute> = {
154
154
  routes: Set<Routes>;
package/dist/index.d.ts CHANGED
@@ -148,7 +148,7 @@ type Route<ContextTo, Result, Path extends string, AdditionalParams extends Reco
148
148
  };
149
149
  type AnyRoute = Route<any, any, any, any, any, any, any>;
150
150
 
151
- type PrefixRoutesPathInner<R extends AnyRoute, Prefix extends `/${string}`> = R extends Route<infer ContextTo, infer Result, infer Path, infer AdditionalParams, infer Method, infer Query, infer BodyOutput> ? Route<ContextTo, Result, `${Prefix}${Path}`, AdditionalParams, Method, Query, BodyOutput> : never;
151
+ type PrefixRoutesPathInner<R extends AnyRoute, Prefix extends `/${string}`> = R extends Route<infer ContextTo, infer Result, infer Path, infer AdditionalParams, infer Method, infer Query, infer BodyOutput> ? Route<ContextTo, Result, `${Prefix}${Path extends '/' ? '' : Path}`, AdditionalParams, Method, Query, BodyOutput> : never;
152
152
  type PrefixRoutesPath<Prefix extends `/${string}`, R extends AnyRoute> = R extends R ? PrefixRoutesPathInner<R, Prefix> : never;
153
153
  type RouterState<ContextFrom, ContextTo, RequiredParams extends Record<string, unknown>, Routes extends AnyRoute> = {
154
154
  routes: Set<Routes>;
package/dist/index.js CHANGED
@@ -148,7 +148,10 @@ var Router = class _Router {
148
148
  merge = (pathPrefix, other) => {
149
149
  const newRoutes = [...other.state.routes].map((route) => ({
150
150
  ...route,
151
- path: `${pathPrefix}${route.path}`
151
+ // handle pathPrefix = / & route.path = / case causing //
152
+ // we intentionally are replacing on the joining path and not the pathPrefix, in case of
153
+ // /named -> merged to -> / causing /named/ not /named
154
+ path: `${pathPrefix}${route.path === "/" ? "" : route.path}`
152
155
  }));
153
156
  return new _Router({
154
157
  ...this.state,
@@ -336,7 +339,7 @@ var Router = class _Router {
336
339
  const item = {
337
340
  description: route.openapi?.description ?? "Successful response",
338
341
  responses: {
339
- default: {
342
+ 200: {
340
343
  description: route.openapi?.description ?? "Successful response",
341
344
  content
342
345
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaito-http/core",
3
- "version": "4.0.0-beta.7",
3
+ "version": "4.0.0-beta.8",
4
4
  "author": "Alistair Smith <hi@alistair.sh>",
5
5
  "repository": "https://github.com/kaito-http/kaito",
6
6
  "devDependencies": {