@forklaunch/core 0.14.15 → 0.15.0

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,6 +1,6 @@
1
1
  import { ParsedQs } from 'qs';
2
2
  export { ParsedQs } from 'qs';
3
- import { UnionToIntersection, TypeSafeFunction, StringWithoutSlash, Prettify, SanitizePathSlashes, MakePropertyOptionalIfChildrenOptional, PrettyCamelCase, EmptyObject } from '@forklaunch/common';
3
+ import { UnionToIntersection, TypeSafeFunction, StringWithoutSlash, Prettify, MakePropertyOptionalIfChildrenOptional, SanitizePathSlashes, PrettyCamelCase, EmptyObject } from '@forklaunch/common';
4
4
  import { AnySchemaValidator, UnboxedObjectSchema, IdiomaticSchema, Schema } from '@forklaunch/validator';
5
5
  import { ServerOptions, IncomingMessage, ServerResponse } from 'node:http';
6
6
  import { Counter, Gauge, Histogram, UpDownCounter, ObservableCounter, ObservableGauge, ObservableUpDownCounter, Span } from '@opentelemetry/api';
@@ -1111,6 +1111,13 @@ interface ForklaunchRouter<SV extends AnySchemaValidator> {
1111
1111
  sdkPaths: Record<string, string>;
1112
1112
  /** Options for the router */
1113
1113
  routerOptions?: ExpressLikeRouterOptions<SV, SessionObject<SV>>;
1114
+ /** Insert the SDK path into the router */
1115
+ insertIntoRouterSdkPaths?: (params: {
1116
+ sdkPath: string;
1117
+ path: string;
1118
+ method: string;
1119
+ name: string;
1120
+ }) => void;
1114
1121
  }
1115
1122
  /**
1116
1123
  * Interface representing a Forklaunch route.
@@ -1356,33 +1363,28 @@ type RouterMap<SV extends AnySchemaValidator> = {
1356
1363
  [K: string]: SdkRouter | RouterMap<SV>;
1357
1364
  };
1358
1365
  /**
1359
- * Tail-recursive type that extracts SDK interfaces from a RouterMap structure.
1360
- * This version uses an accumulator pattern to avoid deep recursion and improve performance.
1361
- * Traverses the nested router map and collects all SDK interfaces into a flat structure.
1366
+ * Recursive type representing a hierarchical map of SDK handlers.
1367
+ * Each key can either be a leaf node containing a SdkHandler, or a nested SdkHandlerObject for deeper structures.
1362
1368
  *
1363
- * @template SV - The schema validator type
1364
- * @template T - The RouterMap to extract SDKs from
1365
- * @template Acc - The accumulator type for collecting SDK interfaces (defaults to empty object)
1366
- * @param SV - Must extend AnySchemaValidator
1367
- * @param T - Must extend RouterMap<SV>
1368
- * @param Acc - The accumulated SDK interfaces so far
1369
- *
1370
- * @returns A mapped type where each key corresponds to the original router structure,
1371
- * but values are the extracted SDK interfaces instead of the full router configuration
1369
+ * @template SV - The schema validator type that constrains the handler structure.
1372
1370
  *
1373
1371
  * @example
1374
1372
  * ```typescript
1375
- * // Given a RouterMap with nested structure
1376
- * type ExtractedSdk = MapToSdk<ZodValidator, typeof routerMap>;
1377
- * // Results in: { api: { users: { getUser: () => Promise<{}> }, posts: { getPosts: () => Promise<[]> } } }
1373
+ * const handlers: SdkHandlerObject<ZodValidator> = {
1374
+ * users: {
1375
+ * getUser: someSdkHandler,
1376
+ * posts: {
1377
+ * getPosts: anotherSdkHandler
1378
+ * }
1379
+ * }
1380
+ * };
1378
1381
  * ```
1379
1382
  */
1380
- type MapToSdk<SV extends AnySchemaValidator, T extends RouterMap<SV>, Acc extends Record<string, unknown> = Record<string, never>> = Prettify<{
1381
- [K in keyof T]: T[K] extends {
1382
- sdk: unknown;
1383
- } ? T[K]['sdk'] : T[K] extends RouterMap<SV> ? MapToSdk<SV, T[K], Acc> : never;
1384
- }>;
1383
+ type SdkHandlerObject<SV extends AnySchemaValidator> = {
1384
+ [K: string]: SdkHandler | SdkHandlerObject<SV>;
1385
+ };
1385
1386
  /**
1387
+ * @deprecated
1386
1388
  * Tail-recursive type that extracts and flattens fetch map interfaces from a RouterMap structure.
1387
1389
  * This version uses an accumulator pattern to avoid deep recursion and improve performance.
1388
1390
  * Similar to MapToSdk but focuses on _fetchMap properties and merges all fetch maps into a single intersection type.
@@ -1409,7 +1411,6 @@ type MapToFetch<SV extends AnySchemaValidator, T extends RouterMap<SV>> = UnionT
1409
1411
  _fetchMap: unknown;
1410
1412
  } ? T[K]['_fetchMap'] extends Record<string, unknown> ? T[K]['_fetchMap'] : never : never;
1411
1413
  }[keyof T]>>;
1412
- type CollectionOptimized<T> = T extends infer U ? U : never;
1413
1414
  /**
1414
1415
  * Base interface for controller entries that defines the structure
1415
1416
  * of each controller method with its path, HTTP method, and contract details.
@@ -1458,10 +1459,25 @@ type SdkHandler = {
1458
1459
  versions?: unknown;
1459
1460
  };
1460
1461
  };
1461
- type MapControllerToSdk<SV extends AnySchemaValidator, T extends Record<string, SdkHandler>> = CollectionOptimized<{
1462
- [K in keyof T]: LiveSdkFunction<SV, T[K]['contractDetails']['params'] extends infer Params | undefined ? Params extends ParamsObject<SV> ? Params : ParamsObject<SV> : ParamsObject<SV>, T[K]['contractDetails']['responses'] extends infer Responses | undefined ? Responses extends ResponsesObject<SV> ? Responses : ResponsesObject<SV> : ResponsesObject<SV>, T[K]['contractDetails']['body'] extends infer B | undefined ? B extends Body<SV> ? B : Body<SV> : Body<SV>, T[K]['contractDetails']['query'] extends infer Q | undefined ? Q extends QueryObject<SV> ? Q : QueryObject<SV> : QueryObject<SV>, T[K]['contractDetails']['requestHeaders'] extends infer RequestHeaders | undefined ? RequestHeaders extends HeadersObject<SV> ? RequestHeaders : HeadersObject<SV> : HeadersObject<SV>, T[K]['contractDetails']['responseHeaders'] extends infer ResponseHeaders | undefined ? ResponseHeaders extends HeadersObject<SV> ? ResponseHeaders : HeadersObject<SV> : HeadersObject<SV>, T[K]['contractDetails']['versions'] extends infer Versions | undefined ? Versions extends VersionSchema<SV, Method> ? Versions : VersionSchema<SV, Method> : VersionSchema<SV, Method>, T[K]['contractDetails']['auth'] extends infer Auth | undefined ? Auth extends AuthMethodsBase ? Auth : AuthMethodsBase : AuthMethodsBase>;
1463
- }>;
1464
1462
  /**
1463
+ * Recursively maps a client controller definition to its corresponding live SDK function types.
1464
+ *
1465
+ * This utility type traverses the structure of a client controller object, replacing each
1466
+ * {@link SdkHandler} with its corresponding {@link MapHandlerToLiveSdk} type, while recursively
1467
+ * processing nested objects. This enables type-safe SDK generation for complex controller hierarchies.
1468
+ *
1469
+ * @template SV - The schema validator type (e.g., zod, typebox).
1470
+ * @template Client - The client controller object to map.
1471
+ *
1472
+ * @example
1473
+ * type MySdk = MapToSdk<typeof z, typeof myController>;
1474
+ */
1475
+ type MapToSdk<SV extends AnySchemaValidator, Client> = {
1476
+ [K in keyof Client]: Client[K] extends SdkHandler ? MapHandlerToLiveSdk<SV, Client[K]> : MapToSdk<SV, Client[K]>;
1477
+ };
1478
+ type MapHandlerToLiveSdk<SV extends AnySchemaValidator, T extends SdkHandler> = LiveSdkFunction<SV, T['contractDetails']['params'] extends infer Params | undefined ? Params extends ParamsObject<SV> ? Params : ParamsObject<SV> : ParamsObject<SV>, T['contractDetails']['responses'] extends infer Responses | undefined ? Responses extends ResponsesObject<SV> ? Responses : ResponsesObject<SV> : ResponsesObject<SV>, T['contractDetails']['body'] extends infer B | undefined ? B extends Body<SV> ? B : Body<SV> : Body<SV>, T['contractDetails']['query'] extends infer Q | undefined ? Q extends QueryObject<SV> ? Q : QueryObject<SV> : QueryObject<SV>, T['contractDetails']['requestHeaders'] extends infer RequestHeaders | undefined ? RequestHeaders extends HeadersObject<SV> ? RequestHeaders : HeadersObject<SV> : HeadersObject<SV>, T['contractDetails']['responseHeaders'] extends infer ResponseHeaders | undefined ? ResponseHeaders extends HeadersObject<SV> ? ResponseHeaders : HeadersObject<SV> : HeadersObject<SV>, T['contractDetails']['versions'] extends infer Versions | undefined ? Versions extends VersionSchema<SV, Method> ? Versions : VersionSchema<SV, Method> : VersionSchema<SV, Method>, T['contractDetails']['auth'] extends infer Auth | undefined ? Auth extends AuthMethodsBase ? Auth : AuthMethodsBase : AuthMethodsBase>;
1479
+ /**
1480
+ * @deprecated
1465
1481
  * Extracts and constructs a LiveTypeFunction from an SdkHandler object.
1466
1482
  * This optimized version reduces redundant type inference while maintaining type safety.
1467
1483
  *
@@ -1480,6 +1496,7 @@ type MapControllerToSdk<SV extends AnySchemaValidator, T extends Record<string,
1480
1496
  */
1481
1497
  type ExtractLiveTypeFn<Entry extends SdkHandler, SV extends AnySchemaValidator, BasePath extends `/${string}`> = LiveTypeFunction<SV, Entry['_path'] extends infer Path | undefined ? Path extends `/${string}` ? `${BasePath}${Path}` : never : never, Entry['contractDetails']['params'] extends infer Params | undefined ? Params extends ParamsObject<SV> ? Params : ParamsObject<SV> : ParamsObject<SV>, Entry['contractDetails']['responses'] extends infer Responses | undefined ? Responses extends ResponsesObject<SV> ? Responses : ResponsesObject<SV> : ResponsesObject<SV>, Entry['contractDetails']['body'] extends infer B | undefined ? B extends Body<SV> ? B : Body<SV> : Body<SV>, Entry['contractDetails']['query'] extends infer Q | undefined ? Q extends QueryObject<SV> ? Q : QueryObject<SV> : QueryObject<SV>, Entry['contractDetails']['requestHeaders'] extends infer RequestHeaders | undefined ? RequestHeaders extends HeadersObject<SV> ? RequestHeaders : HeadersObject<SV> : HeadersObject<SV>, Entry['contractDetails']['responseHeaders'] extends infer ResponseHeaders | undefined ? ResponseHeaders extends HeadersObject<SV> ? ResponseHeaders : HeadersObject<SV> : HeadersObject<SV>, Entry['_method'] extends Method ? Entry['_method'] : never, Entry['contractDetails']['versions'] extends infer Versions | undefined ? Versions extends VersionSchema<SV, Method> ? Versions : VersionSchema<SV, Method> : VersionSchema<SV, Method>, Entry['contractDetails']['auth'] extends infer Auth | undefined ? Auth extends AuthMethodsBase ? Auth : AuthMethodsBase : AuthMethodsBase>;
1482
1498
  /**
1499
+ * @deprecated
1483
1500
  * Transforms a controller object into a fetch map structure that provides
1484
1501
  * type-safe access to HTTP endpoints. This optimized version reduces complexity
1485
1502
  * while maintaining full type safety and discriminated union behavior.
@@ -1657,6 +1674,14 @@ declare class ForklaunchExpressLikeRouter<SV extends AnySchemaValidator, BasePat
1657
1674
  * @returns {ExpressRouter} - The Express router.
1658
1675
  */
1659
1676
  trace: LiveTypeRouteDefinition<SV, BasePath, 'trace', RouterHandler, Internal, RouterSession, BaseRequest, BaseResponse, NextFunction, this>;
1677
+ insertIntoRouterSdkPaths({ sdkPath, path, method, name }: {
1678
+ sdkPath: string;
1679
+ name: string;
1680
+ path: string;
1681
+ method: string;
1682
+ }): void;
1683
+ private unpackSdks;
1684
+ registerSdks(sdks: SdkHandlerObject<SV>): void;
1660
1685
  protected cloneInternals(clone: this): void;
1661
1686
  clone(): this;
1662
1687
  }
@@ -1718,6 +1743,84 @@ declare function createHmacToken({ method, path, body, timestamp, nonce, secretK
1718
1743
  secretKey: string;
1719
1744
  }): string;
1720
1745
 
1746
+ /**
1747
+ * Retrieves and caches the JSON Web Key Set (JWKS) from a given public key URL.
1748
+ *
1749
+ * This function fetches the JWKS from the specified URL and caches the result in memory
1750
+ * to avoid unnecessary network requests. The cache is considered valid for a duration
1751
+ * specified by the `cache-control` header in the JWKS HTTP response (in seconds), or
1752
+ * falls back to a default TTL if the header is not present. If the cache is still valid,
1753
+ * the cached keys are returned immediately.
1754
+ *
1755
+ * @param {string} jwksPublicKeyUrl - The URL to fetch the JWKS from.
1756
+ * @returns {Promise<JWK[]>} A promise that resolves to an array of JWK objects.
1757
+ *
1758
+ * @example
1759
+ * const jwks = await getCachedJwks('https://example.com/.well-known/jwks.json');
1760
+ * // Use jwks for JWT verification, etc.
1761
+ */
1762
+ declare function getCachedJwks(jwksPublicKeyUrl: string): Promise<JWK[]>;
1763
+ /**
1764
+ * Discriminates between different authentication methods and returns a typed result.
1765
+ *
1766
+ * This function analyzes the provided authentication configuration and determines
1767
+ * whether it uses basic authentication or JWT authentication. It returns a
1768
+ * discriminated union type that includes the authentication type and the
1769
+ * corresponding authentication configuration.
1770
+ *
1771
+ * @template SV - A type that extends AnySchemaValidator
1772
+ * @template P - A type that extends ParamsDictionary
1773
+ * @template ReqBody - A type that extends Record<string, unknown>
1774
+ * @template ReqQuery - A type that extends ParsedQs
1775
+ * @template ReqHeaders - A type that extends Record<string, unknown>
1776
+ * @template BaseRequest - The base request type
1777
+ *
1778
+ * @param auth - The authentication methods configuration object
1779
+ * @returns A discriminated union object with either:
1780
+ * - `{ type: 'basic', auth: BasicAuthMethods['basic'] }` for basic authentication
1781
+ * - `{ type: 'jwt', auth?: JwtAuthMethods['jwt'] }` for JWT authentication (auth is optional)
1782
+ *
1783
+ * @example
1784
+ * ```typescript
1785
+ * const authConfig = {
1786
+ * basic: {
1787
+ * login: (username: string, password: string) => boolean
1788
+ * }
1789
+ * };
1790
+ * const result = discriminateAuthMethod(authConfig);
1791
+ * // result.type === 'basic'
1792
+ * // result.auth === authConfig.basic
1793
+ * ```
1794
+ */
1795
+ declare function discriminateAuthMethod<SV extends AnySchemaValidator, P extends ParamsDictionary, ReqBody extends Record<string, unknown>, ReqQuery extends ParsedQs, ReqHeaders extends Record<string, string>, VersionedReqs extends VersionedRequests, BaseRequest>(auth: AuthMethods<SV, P, ReqBody, ReqQuery, ReqHeaders, VersionedReqs, BaseRequest>): Promise<{
1796
+ type: 'basic';
1797
+ auth: {
1798
+ decodeResource?: DecodeResource;
1799
+ login: BasicAuthMethods['basic']['login'];
1800
+ };
1801
+ } | {
1802
+ type: 'jwt';
1803
+ auth: {
1804
+ decodeResource?: DecodeResource;
1805
+ } | {
1806
+ verificationFunction: (token: string) => Promise<JWTPayload | undefined>;
1807
+ };
1808
+ } | {
1809
+ type: 'hmac';
1810
+ auth: {
1811
+ secretKeys: Record<string, string>;
1812
+ verificationFunction: ({ body, path, method, timestamp, nonce, signature, secretKey }: {
1813
+ method: string;
1814
+ path: string;
1815
+ body?: unknown;
1816
+ timestamp: Date;
1817
+ nonce: string;
1818
+ signature: string;
1819
+ secretKey: string;
1820
+ }) => Promise<boolean | undefined>;
1821
+ };
1822
+ }>;
1823
+
1721
1824
  /**
1722
1825
  * Type guard that checks if an object is a Forklaunch request.
1723
1826
  * A Forklaunch request is an object that contains contract details and follows the Forklaunch request structure.
@@ -1960,202 +2063,6 @@ declare function discriminateResponseBodies<SV extends AnySchemaValidator>(schem
1960
2063
  schema: SV["_ValidSchemaObject"];
1961
2064
  }>;
1962
2065
 
1963
- /**
1964
- * Creates a complete SDK client from a RouterMap configuration.
1965
- * This is the main entry point for creating type-safe SDK clients that combine
1966
- * both SDK interfaces and fetch functionality from router configurations.
1967
- *
1968
- * @template SV - The schema validator type that constrains the router structure
1969
- * @template T - The RouterMap type to create the SDK client from
1970
- * @param schemaValidator - The schema validator instance used for validation and type constraints
1971
- * @param routerMap - The router map containing the complete API configuration
1972
- *
1973
- * @returns An object containing both the SDK interface and fetch function:
1974
- * - `sdk`: The extracted SDK interfaces for direct method calls
1975
- * - `fetch`: The unified fetch function for making HTTP requests
1976
- *
1977
- * @example
1978
- * ```typescript
1979
- * const routerMap = {
1980
- * api: {
1981
- * users: {
1982
- * sdk: { getUser: (id: string) => Promise.resolve({ id, name: 'John' }) },
1983
- * _fetchMap: { getUser: { get: (id: string) => fetch(`/api/users/${id}`) } }
1984
- * },
1985
- * posts: {
1986
- * sdk: { getPosts: () => Promise.resolve([]) },
1987
- * _fetchMap: { getPosts: { get: () => fetch('/api/posts') } }
1988
- * }
1989
- * }
1990
- * };
1991
- *
1992
- * const client = sdkClient(zodValidator, routerMap);
1993
- *
1994
- * // Use SDK methods directly
1995
- * const user = await client.sdk.api.users.getUser('123');
1996
- *
1997
- * // Use fetch function for custom requests
1998
- * const response = await client.fetch('getUser', { params: { id: '123' } });
1999
- * ```
2000
- */
2001
- declare function sdkClient<SV extends AnySchemaValidator, T extends RouterMap<SV>>(schemaValidator: SV, routerMap: T): {
2002
- _finalizedSdk: true;
2003
- sdk: MapToSdk<SV, T>;
2004
- fetch: FetchFunction<MapToFetch<SV, T>>;
2005
- };
2006
-
2007
- /**
2008
- * Creates a type-safe SDK router by mapping controller definitions to router SDK functions.
2009
- * This function takes a controller object with contract details and maps each controller method
2010
- * to the corresponding SDK function from the router, ensuring type safety throughout the process.
2011
- * The function now uses `const` template parameters for better type inference and includes
2012
- * a comprehensive fetch map for enhanced type safety.
2013
- *
2014
- * @template SV - The schema validator type that constrains the router and controller structure
2015
- * @template T - The controller type containing contract details for each endpoint (const parameter)
2016
- * @template Router - The router type that provides SDK functions, fetch, and _fetchMap capabilities (const parameter)
2017
- * @param SV - Must extend AnySchemaValidator to ensure type safety
2018
- * @param T - Must be a const record where each key maps to a controller method with contract details
2019
- * @param Router - Must be a const object with optional sdk, fetch, and _fetchMap properties
2020
- *
2021
- * @param schemaValidator - The schema validator instance used for validation and type constraints
2022
- * @param controller - The controller object containing contract details for each endpoint
2023
- * @param router - The router instance that provides SDK functions, fetch, and _fetchMap capabilities
2024
- *
2025
- * @returns An object containing:
2026
- * - `sdk`: Type-safe SDK functions mapped from controller methods using LiveSdkFunction
2027
- * - `fetch`: The router's fetch function cast to FetchFunction with proper typing
2028
- * - `_fetchMap`: A comprehensive fetch map with LiveTypeFunction for each endpoint and method
2029
- *
2030
- * @example
2031
- * ```typescript
2032
- * const controller = {
2033
- * createAgent: {
2034
- * _path: '/agents',
2035
- * _method: 'POST',
2036
- * contractDetails: {
2037
- * name: 'createAgent',
2038
- * body: { name: 'string', organizationId: 'string' },
2039
- * responses: { 200: { id: 'string', name: 'string' } }
2040
- * }
2041
- * },
2042
- * getAgent: {
2043
- * _path: '/agents/:id',
2044
- * _method: 'GET',
2045
- * contractDetails: {
2046
- * name: 'getAgent',
2047
- * params: { id: 'string' },
2048
- * responses: { 200: { id: 'string', name: 'string' } }
2049
- * }
2050
- * }
2051
- * } as const;
2052
- *
2053
- * const router = {
2054
- * sdk: { createAgent: () => Promise.resolve({}), getAgent: () => Promise.resolve({}) },
2055
- * fetch: (path: string, options: any) => fetch(path, options),
2056
- * _fetchMap: { '/agents': { POST: () => fetch('/agents', { method: 'POST' }) } }
2057
- * } as const;
2058
- *
2059
- * const sdkRouter = sdkRouter(zodValidator, controller, router);
2060
- *
2061
- * // Use SDK functions with full type safety
2062
- * const agent = await sdkRouter.sdk.createAgent({
2063
- * body: { name: 'My Agent', organizationId: 'org123' }
2064
- * });
2065
- *
2066
- * const agentData = await sdkRouter.sdk.getAgent({
2067
- * params: { id: 'agent123' }
2068
- * });
2069
- *
2070
- * // Use fetch function with enhanced type safety
2071
- * const response = await sdkRouter.fetch('/agents', {
2072
- * method: 'POST',
2073
- * body: { name: 'Custom Agent', organizationId: 'org456' }
2074
- * });
2075
- *
2076
- * // Access the fetch map for advanced usage
2077
- * const _fetchMap = sdkRouter._fetchMap;
2078
- * ```
2079
- */
2080
- declare function sdkRouter<SV extends AnySchemaValidator, const T extends Record<string, SdkHandler>, const Router extends {
2081
- sdk?: unknown;
2082
- fetch?: unknown;
2083
- _fetchMap?: unknown;
2084
- basePath?: string;
2085
- sdkPaths: Record<string, string>;
2086
- }>(schemaValidator: SV, controller: T, router: Router): {
2087
- sdk: MapControllerToSdk<SV, T>;
2088
- fetch: FetchFunction<{ [K_1 in keyof T as T[K_1]["_path"] extends infer P | undefined ? P extends `/${string}` ? `${Router["basePath"] extends `/${string}` ? Router["basePath"] : "/"}${P}` : never : never]: { [M in T[K_1]["_method"] as M extends Method ? Uppercase<M> : never]: LiveTypeFunction<SV, Extract<T[K_1], {
2089
- _path: T[K_1]["_path"];
2090
- _method: M;
2091
- }>["_path"] extends infer Path | undefined ? Path extends `/${string}` ? `${Router["basePath"] extends `/${string}` ? Router["basePath"] : "/"}${Path}` : never : never, Extract<T[K_1], {
2092
- _path: T[K_1]["_path"];
2093
- _method: M;
2094
- }>["contractDetails"]["params"] extends infer Params | undefined ? Params extends ParamsObject<SV> ? Params : ParamsObject<SV> : ParamsObject<SV>, Extract<T[K_1], {
2095
- _path: T[K_1]["_path"];
2096
- _method: M;
2097
- }>["contractDetails"]["responses"] extends infer Responses | undefined ? Responses extends ResponsesObject<SV> ? Responses : ResponsesObject<SV> : ResponsesObject<SV>, Extract<T[K_1], {
2098
- _path: T[K_1]["_path"];
2099
- _method: M;
2100
- }>["contractDetails"]["body"] extends infer B | undefined ? B extends Body<SV> ? B : Body<SV> : Body<SV>, Extract<T[K_1], {
2101
- _path: T[K_1]["_path"];
2102
- _method: M;
2103
- }>["contractDetails"]["query"] extends infer Q | undefined ? Q extends QueryObject<SV> ? Q : QueryObject<SV> : QueryObject<SV>, Extract<T[K_1], {
2104
- _path: T[K_1]["_path"];
2105
- _method: M;
2106
- }>["contractDetails"]["requestHeaders"] extends infer RequestHeaders | undefined ? RequestHeaders extends HeadersObject<SV> ? RequestHeaders : HeadersObject<SV> : HeadersObject<SV>, Extract<T[K_1], {
2107
- _path: T[K_1]["_path"];
2108
- _method: M;
2109
- }>["contractDetails"]["responseHeaders"] extends infer ResponseHeaders | undefined ? ResponseHeaders extends HeadersObject<SV> ? ResponseHeaders : HeadersObject<SV> : HeadersObject<SV>, Extract<T[K_1], {
2110
- _path: T[K_1]["_path"];
2111
- _method: M;
2112
- }>["_method"] extends Method ? Extract<T[K_1], {
2113
- _path: T[K_1]["_path"];
2114
- _method: M;
2115
- }>["_method"] : never, Extract<T[K_1], {
2116
- _path: T[K_1]["_path"];
2117
- _method: M;
2118
- }>["contractDetails"]["versions"] extends infer Versions | undefined ? Versions extends VersionSchema<SV, Method> ? Versions : VersionSchema<SV, Method> : VersionSchema<SV, Method>, Extract<T[K_1], {
2119
- _path: T[K_1]["_path"];
2120
- _method: M;
2121
- }>["contractDetails"]["auth"] extends infer Auth | undefined ? Auth extends AuthMethodsBase ? Auth : AuthMethodsBase : AuthMethodsBase>; }; } extends infer T_1 ? { [K in keyof T_1]: T_1[K]; } : never>;
2122
- _fetchMap: { [K_1 in keyof T as T[K_1]["_path"] extends infer P | undefined ? P extends `/${string}` ? `${Router["basePath"] extends `/${string}` ? Router["basePath"] : "/"}${P}` : never : never]: { [M in T[K_1]["_method"] as M extends Method ? Uppercase<M> : never]: LiveTypeFunction<SV, Extract<T[K_1], {
2123
- _path: T[K_1]["_path"];
2124
- _method: M;
2125
- }>["_path"] extends infer Path | undefined ? Path extends `/${string}` ? `${Router["basePath"] extends `/${string}` ? Router["basePath"] : "/"}${Path}` : never : never, Extract<T[K_1], {
2126
- _path: T[K_1]["_path"];
2127
- _method: M;
2128
- }>["contractDetails"]["params"] extends infer Params | undefined ? Params extends ParamsObject<SV> ? Params : ParamsObject<SV> : ParamsObject<SV>, Extract<T[K_1], {
2129
- _path: T[K_1]["_path"];
2130
- _method: M;
2131
- }>["contractDetails"]["responses"] extends infer Responses | undefined ? Responses extends ResponsesObject<SV> ? Responses : ResponsesObject<SV> : ResponsesObject<SV>, Extract<T[K_1], {
2132
- _path: T[K_1]["_path"];
2133
- _method: M;
2134
- }>["contractDetails"]["body"] extends infer B | undefined ? B extends Body<SV> ? B : Body<SV> : Body<SV>, Extract<T[K_1], {
2135
- _path: T[K_1]["_path"];
2136
- _method: M;
2137
- }>["contractDetails"]["query"] extends infer Q | undefined ? Q extends QueryObject<SV> ? Q : QueryObject<SV> : QueryObject<SV>, Extract<T[K_1], {
2138
- _path: T[K_1]["_path"];
2139
- _method: M;
2140
- }>["contractDetails"]["requestHeaders"] extends infer RequestHeaders | undefined ? RequestHeaders extends HeadersObject<SV> ? RequestHeaders : HeadersObject<SV> : HeadersObject<SV>, Extract<T[K_1], {
2141
- _path: T[K_1]["_path"];
2142
- _method: M;
2143
- }>["contractDetails"]["responseHeaders"] extends infer ResponseHeaders | undefined ? ResponseHeaders extends HeadersObject<SV> ? ResponseHeaders : HeadersObject<SV> : HeadersObject<SV>, Extract<T[K_1], {
2144
- _path: T[K_1]["_path"];
2145
- _method: M;
2146
- }>["_method"] extends Method ? Extract<T[K_1], {
2147
- _path: T[K_1]["_path"];
2148
- _method: M;
2149
- }>["_method"] : never, Extract<T[K_1], {
2150
- _path: T[K_1]["_path"];
2151
- _method: M;
2152
- }>["contractDetails"]["versions"] extends infer Versions | undefined ? Versions extends VersionSchema<SV, Method> ? Versions : VersionSchema<SV, Method> : VersionSchema<SV, Method>, Extract<T[K_1], {
2153
- _path: T[K_1]["_path"];
2154
- _method: M;
2155
- }>["contractDetails"]["auth"] extends infer Auth | undefined ? Auth extends AuthMethodsBase ? Auth : AuthMethodsBase : AuthMethodsBase>; }; } extends infer T_2 ? { [K in keyof T_2]: T_2[K]; } : never;
2156
- sdkPaths: Router["sdkPaths"];
2157
- };
2158
-
2159
2066
  declare const ATTR_API_NAME = "api.name";
2160
2067
  declare const ATTR_CORRELATION_ID = "correlation.id";
2161
2068
 
@@ -2189,4 +2096,4 @@ declare function logger(level: LevelWithSilentOrString, meta?: AnyValueMap): Pin
2189
2096
 
2190
2097
  declare function recordMetric<SV extends AnySchemaValidator, P extends ParamsDictionary, ReqBody extends Record<string, unknown>, ReqQuery extends ParsedQs, ResBodyMap extends Record<string, unknown>, ReqHeaders extends Record<string, string>, ResHeaders extends Record<string, unknown>, LocalsObj extends Record<string, unknown>, VersionedReqs extends VersionedRequests, SessionSchema extends Record<string, unknown>>(req: ForklaunchRequest<SV, P, ReqBody, ReqQuery, ReqHeaders, Extract<keyof VersionedReqs, string>, SessionSchema>, res: ForklaunchResponse<unknown, ResBodyMap, ResHeaders, LocalsObj, Extract<keyof VersionedReqs, string>>): void;
2191
2098
 
2192
- export { ATTR_API_NAME, ATTR_CORRELATION_ID, type AuthMethods, type AuthMethodsBase, type BasicAuthMethods, type Body, type BodyObject, type ClusterConfig, type ConstrainedForklaunchRouter, type ContractDetails, type ContractDetailsExpressLikeSchemaHandler, type ContractDetailsOrMiddlewareOrTypedHandler, type DecodeResource, type DocsConfiguration, type ErrorContainer, type ExpressLikeApplicationOptions, type ExpressLikeAuthMapper, type ExpressLikeGlobalAuthOptions, type ExpressLikeHandler, type ExpressLikeRouter, type ExpressLikeRouterOptions, type ExpressLikeSchemaAuthMapper, type ExpressLikeSchemaGlobalAuthOptions, type ExpressLikeSchemaHandler, type ExpressLikeTypedHandler, type ExtractBody, type ExtractContentType, type ExtractLiveTypeFn, type ExtractResponseBody, type ExtractedParamsObject, type FetchFunction, type FileBody, type ForklaunchBaseRequest, ForklaunchExpressLikeApplication, ForklaunchExpressLikeRouter, type ForklaunchNextFunction, type ForklaunchRequest, type ForklaunchResErrors, type ForklaunchResHeaders, type ForklaunchResponse, type ForklaunchRoute, type ForklaunchRouter, type ForklaunchSendableData, type ForklaunchStatusResponse, HTTPStatuses, type HeadersObject, type HmacMethods, type HttpContractDetails, type HttpMethod, type JsonBody, type JwtAuthMethods, type LiveSdkFunction, type LiveTypeFunction, type LiveTypeFunctionRequestInit, type LiveTypeRouteDefinition, type LogFn, type LoggerMeta, type MapControllerToSdk, type MapParamsSchema, type MapReqBodySchema, type MapReqHeadersSchema, type MapReqQuerySchema, type MapResBodyMapSchema, type MapResHeadersSchema, type MapSchema, type MapSessionSchema, type MapToFetch, type MapToSdk, type MapVersionedReqsSchema, type MapVersionedRespsSchema, type Method, type MetricType, type MetricsDefinition, type MiddlewareContractDetails, type MiddlewareOrMiddlewareWithTypedHandler, type MultipartForm, type NestableRouterBasedHandler, type NumberOnlyObject, OPENAPI_DEFAULT_VERSION, OpenTelemetryCollector, type ParamsDictionary, type ParamsObject, type PathBasedHandler, type PathMatch, type PathOrMiddlewareBasedHandler, type PathParamHttpContractDetails, type PathParamMethod, type QueryObject, type RawTypedResponseBody, type RequestContext, type ResolvedForklaunchAuthRequest, type ResolvedForklaunchRequest, type ResolvedForklaunchResponse, type ResolvedSessionObject, type ResponseBody, type ResponseCompiledSchema, type ResponseShape, type ResponsesObject, type RouterMap, type RoutingStrategy, type SchemaAuthMethods, type SdkHandler, type SdkRouter, type ServerSentEventBody, type SessionObject, type StatusCode, type StringOnlyObject, type TelemetryOptions, type TextBody, type ToFetchMap, type TypedBody, type TypedHandler, type TypedMiddlewareDefinition, type TypedNestableMiddlewareDefinition, type TypedRequestBody, type TypedResponseBody, type UnknownBody, type UnknownResponseBody, type UrlEncodedForm, type VersionSchema, type VersionedRequests, type VersionedResponses, createHmacToken, delete_, discriminateBody, discriminateResponseBodies, enrichExpressLikeSend, evaluateTelemetryOptions, generateMcpServer, generateOpenApiSpecs, get, getCodeForStatus, head, httpRequestsTotalCounter, httpServerDurationHistogram, isClientError, isForklaunchRequest, isForklaunchRouter, isInformational, isPortBound, isRedirection, isServerError, isSuccessful, isValidStatusCode, logger, meta, metricsDefinitions, middleware, options, patch, post, put, recordMetric, sdkClient, sdkRouter, trace, typedAuthHandler, typedHandler };
2099
+ export { ATTR_API_NAME, ATTR_CORRELATION_ID, type AuthMethods, type AuthMethodsBase, type BasicAuthMethods, type Body, type BodyObject, type ClusterConfig, type ConstrainedForklaunchRouter, type ContractDetails, type ContractDetailsExpressLikeSchemaHandler, type ContractDetailsOrMiddlewareOrTypedHandler, type DecodeResource, type DocsConfiguration, type ErrorContainer, type ExpressLikeApplicationOptions, type ExpressLikeAuthMapper, type ExpressLikeGlobalAuthOptions, type ExpressLikeHandler, type ExpressLikeRouter, type ExpressLikeRouterOptions, type ExpressLikeSchemaAuthMapper, type ExpressLikeSchemaGlobalAuthOptions, type ExpressLikeSchemaHandler, type ExpressLikeTypedHandler, type ExtractBody, type ExtractContentType, type ExtractLiveTypeFn, type ExtractResponseBody, type ExtractedParamsObject, type FetchFunction, type FileBody, type ForklaunchBaseRequest, ForklaunchExpressLikeApplication, ForklaunchExpressLikeRouter, type ForklaunchNextFunction, type ForklaunchRequest, type ForklaunchResErrors, type ForklaunchResHeaders, type ForklaunchResponse, type ForklaunchRoute, type ForklaunchRouter, type ForklaunchSendableData, type ForklaunchStatusResponse, HTTPStatuses, type HeadersObject, type HmacMethods, type HttpContractDetails, type HttpMethod, type JsonBody, type JwtAuthMethods, type LiveSdkFunction, type LiveTypeFunction, type LiveTypeFunctionRequestInit, type LiveTypeRouteDefinition, type LogFn, type LoggerMeta, type MapHandlerToLiveSdk, type MapParamsSchema, type MapReqBodySchema, type MapReqHeadersSchema, type MapReqQuerySchema, type MapResBodyMapSchema, type MapResHeadersSchema, type MapSchema, type MapSessionSchema, type MapToFetch, type MapToSdk, type MapVersionedReqsSchema, type MapVersionedRespsSchema, type Method, type MetricType, type MetricsDefinition, type MiddlewareContractDetails, type MiddlewareOrMiddlewareWithTypedHandler, type MultipartForm, type NestableRouterBasedHandler, type NumberOnlyObject, OPENAPI_DEFAULT_VERSION, OpenTelemetryCollector, type ParamsDictionary, type ParamsObject, type PathBasedHandler, type PathMatch, type PathOrMiddlewareBasedHandler, type PathParamHttpContractDetails, type PathParamMethod, type QueryObject, type RawTypedResponseBody, type RequestContext, type ResolvedForklaunchAuthRequest, type ResolvedForklaunchRequest, type ResolvedForklaunchResponse, type ResolvedSessionObject, type ResponseBody, type ResponseCompiledSchema, type ResponseShape, type ResponsesObject, type RouterMap, type RoutingStrategy, type SchemaAuthMethods, type SdkHandler, type SdkHandlerObject, type SdkRouter, type ServerSentEventBody, type SessionObject, type StatusCode, type StringOnlyObject, type TelemetryOptions, type TextBody, type ToFetchMap, type TypedBody, type TypedHandler, type TypedMiddlewareDefinition, type TypedNestableMiddlewareDefinition, type TypedRequestBody, type TypedResponseBody, type UnknownBody, type UnknownResponseBody, type UrlEncodedForm, type VersionSchema, type VersionedRequests, type VersionedResponses, createHmacToken, delete_, discriminateAuthMethod, discriminateBody, discriminateResponseBodies, enrichExpressLikeSend, evaluateTelemetryOptions, generateMcpServer, generateOpenApiSpecs, get, getCachedJwks, getCodeForStatus, head, httpRequestsTotalCounter, httpServerDurationHistogram, isClientError, isForklaunchRequest, isForklaunchRouter, isInformational, isPortBound, isRedirection, isServerError, isSuccessful, isValidStatusCode, logger, meta, metricsDefinitions, middleware, options, patch, post, put, recordMetric, trace, typedAuthHandler, typedHandler };