@forklaunch/core 0.14.7 → 0.14.9

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.
@@ -257,7 +257,7 @@ type TokenOptions = {
257
257
  type DecodeResource = (token: string) => JWTPayload | Promise<JWTPayload>;
258
258
  type AuthMethodsBase = TokenOptions & (HmacMethods | ({
259
259
  readonly decodeResource?: DecodeResource;
260
- } & (BasicAuthMethods | JwtAuthMethods)));
260
+ } & (PermissionSet | RoleSet) & (BasicAuthMethods | JwtAuthMethods)));
261
261
  type PermissionSet = {
262
262
  readonly allowedPermissions: Set<string>;
263
263
  } | {
@@ -271,11 +271,11 @@ type RoleSet = {
271
271
  /**
272
272
  * Type representing the authentication methods.
273
273
  */
274
- type SchemaAuthMethods<SV extends AnySchemaValidator, ParamsSchema extends ParamsObject<SV>, ReqBody extends Body<SV>, QuerySchema extends QueryObject<SV>, ReqHeaders extends HeadersObject<SV>, VersionedApi extends VersionSchema<SV, Method>, SessionSchema extends SessionObject<SV>, BaseRequest> = AuthMethodsBase & (({
274
+ type SchemaAuthMethods<SV extends AnySchemaValidator, ParamsSchema extends ParamsObject<SV>, ReqBody extends Body<SV>, QuerySchema extends QueryObject<SV>, ReqHeaders extends HeadersObject<SV>, VersionedApi extends VersionSchema<SV, Method>, SessionSchema extends SessionObject<SV>, BaseRequest> = AuthMethodsBase & ({
275
275
  readonly surfacePermissions?: ExpressLikeSchemaAuthMapper<SV, ParamsSchema, ReqBody, QuerySchema, ReqHeaders, VersionedApi, SessionSchema, BaseRequest>;
276
- } & PermissionSet) | ({
276
+ } | {
277
277
  readonly surfaceRoles?: ExpressLikeSchemaAuthMapper<SV, ParamsSchema, ReqBody, QuerySchema, ReqHeaders, VersionedApi, SessionSchema, BaseRequest>;
278
- } & RoleSet)) & {
278
+ }) & {
279
279
  readonly sessionSchema?: SessionSchema;
280
280
  readonly requiredScope?: string;
281
281
  readonly scopeHeirarchy?: string[];
@@ -1685,6 +1685,25 @@ interface ClusterConfig<ExpressApp> {
1685
1685
 
1686
1686
  declare function isPortBound(port: number, host?: string): Promise<boolean>;
1687
1687
 
1688
+ /**
1689
+ * Creates an HMAC token for a given method, path, body, timestamp, nonce, and secret key.
1690
+ * @param method - The HTTP method to use.
1691
+ * @param path - The path to use.
1692
+ * @param body - The body to use.
1693
+ * @param timestamp - The timestamp to use.
1694
+ * @param nonce - The nonce to use.
1695
+ * @param secretKey - The secret key to use.
1696
+ * @returns The HMAC token.
1697
+ */
1698
+ declare function createHmacToken({ method, path, body, timestamp, nonce, secretKey }: {
1699
+ method: string;
1700
+ path: string;
1701
+ body?: unknown;
1702
+ timestamp: string;
1703
+ nonce: string;
1704
+ secretKey: string;
1705
+ }): string;
1706
+
1688
1707
  /**
1689
1708
  * Type guard that checks if an object is a Forklaunch request.
1690
1709
  * A Forklaunch request is an object that contains contract details and follows the Forklaunch request structure.
@@ -2156,4 +2175,4 @@ declare function logger(level: LevelWithSilentOrString, meta?: AnyValueMap): Pin
2156
2175
 
2157
2176
  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;
2158
2177
 
2159
- 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 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, 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 };
2178
+ 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 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 };
@@ -257,7 +257,7 @@ type TokenOptions = {
257
257
  type DecodeResource = (token: string) => JWTPayload | Promise<JWTPayload>;
258
258
  type AuthMethodsBase = TokenOptions & (HmacMethods | ({
259
259
  readonly decodeResource?: DecodeResource;
260
- } & (BasicAuthMethods | JwtAuthMethods)));
260
+ } & (PermissionSet | RoleSet) & (BasicAuthMethods | JwtAuthMethods)));
261
261
  type PermissionSet = {
262
262
  readonly allowedPermissions: Set<string>;
263
263
  } | {
@@ -271,11 +271,11 @@ type RoleSet = {
271
271
  /**
272
272
  * Type representing the authentication methods.
273
273
  */
274
- type SchemaAuthMethods<SV extends AnySchemaValidator, ParamsSchema extends ParamsObject<SV>, ReqBody extends Body<SV>, QuerySchema extends QueryObject<SV>, ReqHeaders extends HeadersObject<SV>, VersionedApi extends VersionSchema<SV, Method>, SessionSchema extends SessionObject<SV>, BaseRequest> = AuthMethodsBase & (({
274
+ type SchemaAuthMethods<SV extends AnySchemaValidator, ParamsSchema extends ParamsObject<SV>, ReqBody extends Body<SV>, QuerySchema extends QueryObject<SV>, ReqHeaders extends HeadersObject<SV>, VersionedApi extends VersionSchema<SV, Method>, SessionSchema extends SessionObject<SV>, BaseRequest> = AuthMethodsBase & ({
275
275
  readonly surfacePermissions?: ExpressLikeSchemaAuthMapper<SV, ParamsSchema, ReqBody, QuerySchema, ReqHeaders, VersionedApi, SessionSchema, BaseRequest>;
276
- } & PermissionSet) | ({
276
+ } | {
277
277
  readonly surfaceRoles?: ExpressLikeSchemaAuthMapper<SV, ParamsSchema, ReqBody, QuerySchema, ReqHeaders, VersionedApi, SessionSchema, BaseRequest>;
278
- } & RoleSet)) & {
278
+ }) & {
279
279
  readonly sessionSchema?: SessionSchema;
280
280
  readonly requiredScope?: string;
281
281
  readonly scopeHeirarchy?: string[];
@@ -1685,6 +1685,25 @@ interface ClusterConfig<ExpressApp> {
1685
1685
 
1686
1686
  declare function isPortBound(port: number, host?: string): Promise<boolean>;
1687
1687
 
1688
+ /**
1689
+ * Creates an HMAC token for a given method, path, body, timestamp, nonce, and secret key.
1690
+ * @param method - The HTTP method to use.
1691
+ * @param path - The path to use.
1692
+ * @param body - The body to use.
1693
+ * @param timestamp - The timestamp to use.
1694
+ * @param nonce - The nonce to use.
1695
+ * @param secretKey - The secret key to use.
1696
+ * @returns The HMAC token.
1697
+ */
1698
+ declare function createHmacToken({ method, path, body, timestamp, nonce, secretKey }: {
1699
+ method: string;
1700
+ path: string;
1701
+ body?: unknown;
1702
+ timestamp: string;
1703
+ nonce: string;
1704
+ secretKey: string;
1705
+ }): string;
1706
+
1688
1707
  /**
1689
1708
  * Type guard that checks if an object is a Forklaunch request.
1690
1709
  * A Forklaunch request is an object that contains contract details and follows the Forklaunch request structure.
@@ -2156,4 +2175,4 @@ declare function logger(level: LevelWithSilentOrString, meta?: AnyValueMap): Pin
2156
2175
 
2157
2176
  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;
2158
2177
 
2159
- 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 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, 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 };
2178
+ 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 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 };
package/lib/http/index.js CHANGED
@@ -41,6 +41,7 @@ __export(http_exports, {
41
41
  HTTPStatuses: () => HTTPStatuses,
42
42
  OPENAPI_DEFAULT_VERSION: () => OPENAPI_DEFAULT_VERSION,
43
43
  OpenTelemetryCollector: () => OpenTelemetryCollector,
44
+ createHmacToken: () => createHmacToken,
44
45
  delete_: () => delete_,
45
46
  discriminateBody: () => discriminateBody,
46
47
  discriminateResponseBodies: () => discriminateResponseBodies,
@@ -101,7 +102,7 @@ function cors(corsOptions) {
101
102
  }
102
103
 
103
104
  // src/http/router/expressLikeRouter.ts
104
- var import_common8 = require("@forklaunch/common");
105
+ var import_common9 = require("@forklaunch/common");
105
106
 
106
107
  // src/http/guards/hasVersionedSchema.ts
107
108
  function hasVersionedSchema(contractDetails) {
@@ -156,12 +157,32 @@ function isTypedHandler(maybeTypedHandler) {
156
157
  }
157
158
 
158
159
  // src/http/middleware/request/auth.middleware.ts
159
- var import_common2 = require("@forklaunch/common");
160
+ var import_common3 = require("@forklaunch/common");
160
161
 
161
162
  // src/http/discriminateAuthMethod.ts
162
- var import_crypto = require("crypto");
163
163
  var import_jose = require("jose");
164
164
 
165
+ // src/http/createHmacToken.ts
166
+ var import_common2 = require("@forklaunch/common");
167
+ var import_crypto = require("crypto");
168
+ function createHmacToken({
169
+ method,
170
+ path,
171
+ body,
172
+ timestamp,
173
+ nonce,
174
+ secretKey
175
+ }) {
176
+ const hmac = (0, import_crypto.createHmac)("sha256", secretKey);
177
+ const bodyString = body ? `${(0, import_common2.safeStringify)(body)}
178
+ ` : void 0;
179
+ hmac.update(`${method}
180
+ ${path}
181
+ ${bodyString}${timestamp}
182
+ ${nonce}`);
183
+ return hmac.digest("base64");
184
+ }
185
+
165
186
  // src/http/guards/isBasicAuthMethod.ts
166
187
  function isBasicAuthMethod(maybeBasicAuthMethod) {
167
188
  return typeof maybeBasicAuthMethod === "object" && maybeBasicAuthMethod !== null && "basic" in maybeBasicAuthMethod && maybeBasicAuthMethod.basic != null;
@@ -230,15 +251,23 @@ async function discriminateAuthMethod(auth) {
230
251
  type: "hmac",
231
252
  auth: {
232
253
  secretKeys: auth.hmac.secretKeys,
233
- verificationFunction: async (method, path, body, timestamp, nonce, signature, secretKey) => {
234
- const hmac = (0, import_crypto.createHmac)("sha256", secretKey);
235
- hmac.update(`${method}
236
- ${path}
237
- ${body}
238
- ${timestamp}
239
- ${nonce}`);
240
- const digest = hmac.digest("base64");
241
- return digest === signature;
254
+ verificationFunction: async ({
255
+ method,
256
+ path,
257
+ body,
258
+ timestamp,
259
+ nonce,
260
+ signature,
261
+ secretKey
262
+ }) => {
263
+ return createHmacToken({
264
+ method,
265
+ path,
266
+ body,
267
+ timestamp,
268
+ nonce,
269
+ secretKey
270
+ }) === signature;
242
271
  }
243
272
  }
244
273
  };
@@ -343,15 +372,15 @@ async function checkAuthorizationToken(authorizationMethod, globalOptions, autho
343
372
  if (!parsedKeyId || !parsedTimestamp || !parsedNonce || !parsedSignature) {
344
373
  return invalidAuthorizationTokenFormat;
345
374
  }
346
- const verificationResult = await auth.verificationFunction(
347
- req?.method ?? "",
348
- req?.path ?? "",
349
- JSON.stringify(req?.body ?? ""),
350
- parsedTimestamp,
351
- parsedNonce,
352
- parsedSignature,
353
- collapsedAuthorizationMethod.hmac.secretKeys[parsedKeyId]
354
- );
375
+ const verificationResult = await auth.verificationFunction({
376
+ method: req?.method ?? "",
377
+ path: req?.path ?? "",
378
+ body: req?.body,
379
+ timestamp: parsedTimestamp,
380
+ nonce: parsedNonce,
381
+ signature: parsedSignature,
382
+ secretKey: collapsedAuthorizationMethod.hmac.secretKeys[parsedKeyId]
383
+ });
355
384
  if (!verificationResult) {
356
385
  return invalidAuthorizationSignature;
357
386
  }
@@ -397,7 +426,7 @@ async function checkAuthorizationToken(authorizationMethod, globalOptions, autho
397
426
  break;
398
427
  }
399
428
  default:
400
- (0, import_common2.isNever)(type);
429
+ (0, import_common3.isNever)(type);
401
430
  return [401, "Invalid Authorization method."];
402
431
  }
403
432
  if (isHmacMethod(collapsedAuthorizationMethod) && resourceId == null) {
@@ -484,7 +513,7 @@ async function parseRequestAuth(req, res, next) {
484
513
  }
485
514
 
486
515
  // src/http/middleware/request/createContext.middleware.ts
487
- var import_common3 = require("@forklaunch/common");
516
+ var import_common4 = require("@forklaunch/common");
488
517
  var import_api = require("@opentelemetry/api");
489
518
  var import_uuid = require("uuid");
490
519
 
@@ -511,7 +540,7 @@ function createContext(schemaValidator) {
511
540
  req.context.span?.setAttribute(ATTR_CORRELATION_ID, correlationId);
512
541
  req.context.span?.setAttribute(
513
542
  import_semantic_conventions.ATTR_SERVICE_NAME,
514
- (0, import_common3.getEnvVar)("OTEL_SERVICE_NAME")
543
+ (0, import_common4.getEnvVar)("OTEL_SERVICE_NAME")
515
544
  );
516
545
  }
517
546
  next?.();
@@ -519,10 +548,10 @@ function createContext(schemaValidator) {
519
548
  }
520
549
 
521
550
  // src/http/middleware/request/enrichDetails.middleware.ts
522
- var import_common6 = require("@forklaunch/common");
551
+ var import_common7 = require("@forklaunch/common");
523
552
 
524
553
  // src/http/telemetry/openTelemetryCollector.ts
525
- var import_common5 = require("@forklaunch/common");
554
+ var import_common6 = require("@forklaunch/common");
526
555
  var import_opentelemetry_instrumentation_hyper_express = require("@forklaunch/opentelemetry-instrumentation-hyper-express");
527
556
  var import_api3 = require("@opentelemetry/api");
528
557
  var import_exporter_logs_otlp_http = require("@opentelemetry/exporter-logs-otlp-http");
@@ -543,7 +572,7 @@ function isForklaunchRequest(request) {
543
572
  }
544
573
 
545
574
  // src/http/telemetry/pinoLogger.ts
546
- var import_common4 = require("@forklaunch/common");
575
+ var import_common5 = require("@forklaunch/common");
547
576
  var import_api2 = require("@opentelemetry/api");
548
577
  var import_api_logs = require("@opentelemetry/api-logs");
549
578
  var import_pino = __toESM(require("pino"));
@@ -575,7 +604,7 @@ function mapSeverity(level) {
575
604
  case "fatal":
576
605
  return 21;
577
606
  default:
578
- (0, import_common4.isNever)(level);
607
+ (0, import_common5.isNever)(level);
579
608
  return 0;
580
609
  }
581
610
  }
@@ -768,24 +797,24 @@ var OpenTelemetryCollector = class {
768
797
  return this.metrics[metricId];
769
798
  }
770
799
  };
771
- import_dotenv.default.config({ path: (0, import_common5.getEnvVar)("DOTENV_FILE_PATH") });
800
+ import_dotenv.default.config({ path: (0, import_common6.getEnvVar)("DOTENV_FILE_PATH") });
772
801
  new import_sdk_node.NodeSDK({
773
802
  resource: (0, import_resources.resourceFromAttributes)({
774
- [import_semantic_conventions2.ATTR_SERVICE_NAME]: (0, import_common5.getEnvVar)("OTEL_SERVICE_NAME")
803
+ [import_semantic_conventions2.ATTR_SERVICE_NAME]: (0, import_common6.getEnvVar)("OTEL_SERVICE_NAME")
775
804
  }),
776
805
  traceExporter: new import_exporter_trace_otlp_http.OTLPTraceExporter({
777
- url: `${(0, import_common5.getEnvVar)("OTEL_EXPORTER_OTLP_ENDPOINT") ?? "http://localhost:4318"}/v1/traces`
806
+ url: `${(0, import_common6.getEnvVar)("OTEL_EXPORTER_OTLP_ENDPOINT") ?? "http://localhost:4318"}/v1/traces`
778
807
  }),
779
808
  metricReader: new import_sdk_metrics.PeriodicExportingMetricReader({
780
809
  exporter: new import_exporter_metrics_otlp_http.OTLPMetricExporter({
781
- url: `${(0, import_common5.getEnvVar)("OTEL_EXPORTER_OTLP_ENDPOINT") ?? "http://localhost:4318"}/v1/metrics`
810
+ url: `${(0, import_common6.getEnvVar)("OTEL_EXPORTER_OTLP_ENDPOINT") ?? "http://localhost:4318"}/v1/metrics`
782
811
  }),
783
812
  exportIntervalMillis: 5e3
784
813
  }),
785
814
  logRecordProcessors: [
786
815
  new import_sdk_logs.BatchLogRecordProcessor(
787
816
  new import_exporter_logs_otlp_http.OTLPLogExporter({
788
- url: `${(0, import_common5.getEnvVar)("OTEL_EXPORTER_OTLP_ENDPOINT") ?? "http://localhost:4318"}/v1/logs`
817
+ url: `${(0, import_common6.getEnvVar)("OTEL_EXPORTER_OTLP_ENDPOINT") ?? "http://localhost:4318"}/v1/logs`
789
818
  })
790
819
  )
791
820
  ],
@@ -794,7 +823,7 @@ new import_sdk_node.NodeSDK({
794
823
  applyCustomAttributesOnSpan: (span, request) => {
795
824
  span.setAttribute(
796
825
  import_semantic_conventions2.ATTR_SERVICE_NAME,
797
- (0, import_common5.getEnvVar)("OTEL_SERVICE_NAME") ?? "unknown"
826
+ (0, import_common6.getEnvVar)("OTEL_SERVICE_NAME") ?? "unknown"
798
827
  );
799
828
  if (isForklaunchRequest(request)) {
800
829
  span.setAttribute(ATTR_API_NAME, request.contractDetails?.name);
@@ -806,10 +835,10 @@ new import_sdk_node.NodeSDK({
806
835
  new import_opentelemetry_instrumentation_hyper_express.HyperExpressInstrumentation()
807
836
  ]
808
837
  }).start();
809
- var httpRequestsTotalCounter = import_api3.metrics.getMeter((0, import_common5.getEnvVar)("OTEL_SERVICE_NAME") || "unknown").createCounter("http_requests_total", {
838
+ var httpRequestsTotalCounter = import_api3.metrics.getMeter((0, import_common6.getEnvVar)("OTEL_SERVICE_NAME") || "unknown").createCounter("http_requests_total", {
810
839
  description: "Number of HTTP requests"
811
840
  });
812
- var httpServerDurationHistogram = import_api3.metrics.getMeter((0, import_common5.getEnvVar)("OTEL_SERVICE_NAME") || "unknown").createHistogram("http_server_duration", {
841
+ var httpServerDurationHistogram = import_api3.metrics.getMeter((0, import_common6.getEnvVar)("OTEL_SERVICE_NAME") || "unknown").createHistogram("http_server_duration", {
813
842
  description: "Duration of HTTP server requests",
814
843
  unit: "s"
815
844
  });
@@ -829,7 +858,7 @@ function enrichDetails(path, contractDetails, requestSchema, responseSchemas, op
829
858
  const [seconds, nanoseconds] = process.hrtime(startTime);
830
859
  const durationMs = seconds + nanoseconds / 1e9;
831
860
  httpServerDurationHistogram.record(durationMs, {
832
- [import_semantic_conventions.ATTR_SERVICE_NAME]: (0, import_common6.getEnvVar)("OTEL_SERVICE_NAME") || "unknown",
861
+ [import_semantic_conventions.ATTR_SERVICE_NAME]: (0, import_common7.getEnvVar)("OTEL_SERVICE_NAME") || "unknown",
833
862
  [ATTR_API_NAME]: req.contractDetails?.name || "unknown",
834
863
  [import_semantic_conventions.ATTR_HTTP_REQUEST_METHOD]: req.method,
835
864
  [import_semantic_conventions.ATTR_HTTP_ROUTE]: req.originalPath || "unknown",
@@ -841,7 +870,7 @@ function enrichDetails(path, contractDetails, requestSchema, responseSchemas, op
841
870
  }
842
871
 
843
872
  // src/http/middleware/request/parse.middleware.ts
844
- var import_common7 = require("@forklaunch/common");
873
+ var import_common8 = require("@forklaunch/common");
845
874
  var import_validator = require("@forklaunch/validator");
846
875
 
847
876
  // src/http/guards/hasSend.ts
@@ -869,7 +898,7 @@ function parse(req, res, next) {
869
898
  let parsedRequest;
870
899
  let collectedParseErrors;
871
900
  if (req.contractDetails.versions) {
872
- if ((0, import_common7.isRecord)(req.requestSchema)) {
901
+ if ((0, import_common8.isRecord)(req.requestSchema)) {
873
902
  let runningParseErrors = "";
874
903
  matchedVersions = [];
875
904
  Object.entries(req.requestSchema).forEach(([version, schema]) => {
@@ -1261,13 +1290,13 @@ var ForklaunchExpressLikeRouter = class _ForklaunchExpressLikeRouter {
1261
1290
  versionedContractDetails,
1262
1291
  contractDetails.params
1263
1292
  );
1264
- if ((0, import_common8.isRecord)(requestSchema)) {
1293
+ if ((0, import_common9.isRecord)(requestSchema)) {
1265
1294
  requestSchema = {
1266
1295
  ...requestSchema,
1267
1296
  [version]: versionedRequestSchema
1268
1297
  };
1269
1298
  }
1270
- if ((0, import_common8.isRecord)(responseSchemas)) {
1299
+ if ((0, import_common9.isRecord)(responseSchemas)) {
1271
1300
  responseSchemas = {
1272
1301
  ...responseSchemas,
1273
1302
  [version]: versionedResponseSchemas
@@ -1456,8 +1485,8 @@ var ForklaunchExpressLikeRouter = class _ForklaunchExpressLikeRouter {
1456
1485
  ...resolvedMiddlewares,
1457
1486
  this.#parseAndRunControllerHandler(controllerHandler)
1458
1487
  );
1459
- (0, import_common8.toRecord)(this._fetchMap)[(0, import_common8.sanitizePathSlashes)(`${this.basePath}${path}`)] = {
1460
- ...this._fetchMap[(0, import_common8.sanitizePathSlashes)(`${this.basePath}${path}`)] ?? {},
1488
+ (0, import_common9.toRecord)(this._fetchMap)[(0, import_common9.sanitizePathSlashes)(`${this.basePath}${path}`)] = {
1489
+ ...this._fetchMap[(0, import_common9.sanitizePathSlashes)(`${this.basePath}${path}`)] ?? {},
1461
1490
  [method.toUpperCase()]: contractDetails.versions ? Object.fromEntries(
1462
1491
  Object.keys(contractDetails.versions).map((version) => [
1463
1492
  version,
@@ -1465,7 +1494,7 @@ var ForklaunchExpressLikeRouter = class _ForklaunchExpressLikeRouter {
1465
1494
  ])
1466
1495
  ) : this.#localParamRequest(handlers, controllerHandler)
1467
1496
  };
1468
- (0, import_common8.toRecord)(this.sdk)[(0, import_common8.toPrettyCamelCase)(contractDetails.name)] = contractDetails.versions ? Object.fromEntries(
1497
+ (0, import_common9.toRecord)(this.sdk)[(0, import_common9.toPrettyCamelCase)(contractDetails.name)] = contractDetails.versions ? Object.fromEntries(
1469
1498
  Object.keys(contractDetails.versions).map((version) => [
1470
1499
  version,
1471
1500
  (req) => this.#localParamRequest(
@@ -1564,10 +1593,10 @@ var ForklaunchExpressLikeRouter = class _ForklaunchExpressLikeRouter {
1564
1593
  }
1565
1594
  addRouterToSdk(router) {
1566
1595
  Object.entries(router._fetchMap).map(
1567
- ([key, value]) => (0, import_common8.toRecord)(this._fetchMap)[(0, import_common8.sanitizePathSlashes)(`${this.basePath}${key}`)] = value
1596
+ ([key, value]) => (0, import_common9.toRecord)(this._fetchMap)[(0, import_common9.sanitizePathSlashes)(`${this.basePath}${key}`)] = value
1568
1597
  );
1569
- const existingSdk = this.sdk[router.sdkName ?? (0, import_common8.toPrettyCamelCase)(router.basePath)];
1570
- (0, import_common8.toRecord)(this.sdk)[router.sdkName ?? (0, import_common8.toPrettyCamelCase)(router.basePath)] = {
1598
+ const existingSdk = this.sdk[router.sdkName ?? (0, import_common9.toPrettyCamelCase)(router.basePath)];
1599
+ (0, import_common9.toRecord)(this.sdk)[router.sdkName ?? (0, import_common9.toPrettyCamelCase)(router.basePath)] = {
1571
1600
  ...typeof existingSdk === "object" ? existingSdk : {},
1572
1601
  ...router.sdk
1573
1602
  };
@@ -2966,7 +2995,7 @@ var getCodeForStatus = (status) => {
2966
2995
  var httpStatusCodes_default = HTTPStatuses;
2967
2996
 
2968
2997
  // src/http/mcpGenerator/mcpGenerator.ts
2969
- var import_common9 = require("@forklaunch/common");
2998
+ var import_common10 = require("@forklaunch/common");
2970
2999
  var import_fastmcp_fork = require("@forklaunch/fastmcp-fork");
2971
3000
  var import_zod = require("@forklaunch/validator/zod");
2972
3001
 
@@ -3103,7 +3132,7 @@ function generateMcpServer(schemaValidator, protocol, host, port, version, appli
3103
3132
  if (discriminatedBody) {
3104
3133
  switch (discriminatedBody.parserType) {
3105
3134
  case "json": {
3106
- parsedBody = (0, import_common9.safeStringify)(body);
3135
+ parsedBody = (0, import_common10.safeStringify)(body);
3107
3136
  break;
3108
3137
  }
3109
3138
  case "text": {
@@ -3116,7 +3145,7 @@ function generateMcpServer(schemaValidator, protocol, host, port, version, appli
3116
3145
  }
3117
3146
  case "multipart": {
3118
3147
  const formData = new FormData();
3119
- if ((0, import_common9.isRecord)(body)) {
3148
+ if ((0, import_common10.isRecord)(body)) {
3120
3149
  for (const key in body) {
3121
3150
  if (typeof body[key] === "string" || body[key] instanceof Blob) {
3122
3151
  formData.append(key, body[key]);
@@ -3131,11 +3160,11 @@ function generateMcpServer(schemaValidator, protocol, host, port, version, appli
3131
3160
  break;
3132
3161
  }
3133
3162
  case "urlEncoded": {
3134
- if ((0, import_common9.isRecord)(body)) {
3163
+ if ((0, import_common10.isRecord)(body)) {
3135
3164
  parsedBody = new URLSearchParams(
3136
3165
  Object.entries(body).map(([key, value]) => [
3137
3166
  key,
3138
- (0, import_common9.safeStringify)(value)
3167
+ (0, import_common10.safeStringify)(value)
3139
3168
  ])
3140
3169
  );
3141
3170
  } else {
@@ -3144,8 +3173,8 @@ function generateMcpServer(schemaValidator, protocol, host, port, version, appli
3144
3173
  break;
3145
3174
  }
3146
3175
  default: {
3147
- (0, import_common9.isNever)(discriminatedBody.parserType);
3148
- parsedBody = (0, import_common9.safeStringify)(body);
3176
+ (0, import_common10.isNever)(discriminatedBody.parserType);
3177
+ parsedBody = (0, import_common10.safeStringify)(body);
3149
3178
  break;
3150
3179
  }
3151
3180
  }
@@ -3154,7 +3183,7 @@ function generateMcpServer(schemaValidator, protocol, host, port, version, appli
3154
3183
  const queryString = new URLSearchParams(
3155
3184
  Object.entries(query).map(([key, value]) => [
3156
3185
  key,
3157
- (0, import_common9.safeStringify)(value)
3186
+ (0, import_common10.safeStringify)(value)
3158
3187
  ])
3159
3188
  ).toString();
3160
3189
  url += queryString ? `?${queryString}` : "";
@@ -3187,7 +3216,7 @@ function generateMcpServer(schemaValidator, protocol, host, port, version, appli
3187
3216
  content: [
3188
3217
  {
3189
3218
  type: "text",
3190
- text: (0, import_common9.safeStringify)(await response.json())
3219
+ text: (0, import_common10.safeStringify)(await response.json())
3191
3220
  }
3192
3221
  ]
3193
3222
  };
@@ -3341,18 +3370,18 @@ ${parseErrors.join("\n\n")}`
3341
3370
  }
3342
3371
 
3343
3372
  // src/http/middleware/response/enrichExpressLikeSend.middleware.ts
3344
- var import_common11 = require("@forklaunch/common");
3373
+ var import_common12 = require("@forklaunch/common");
3345
3374
  var import_stream = require("stream");
3346
3375
 
3347
3376
  // src/http/telemetry/recordMetric.ts
3348
- var import_common10 = require("@forklaunch/common");
3377
+ var import_common11 = require("@forklaunch/common");
3349
3378
  var import_semantic_conventions3 = require("@opentelemetry/semantic-conventions");
3350
3379
  function recordMetric(req, res) {
3351
3380
  if (res.metricRecorded) {
3352
3381
  return;
3353
3382
  }
3354
3383
  httpRequestsTotalCounter.add(1, {
3355
- [import_semantic_conventions3.ATTR_SERVICE_NAME]: (0, import_common10.getEnvVar)("OTEL_SERVICE_NAME"),
3384
+ [import_semantic_conventions3.ATTR_SERVICE_NAME]: (0, import_common11.getEnvVar)("OTEL_SERVICE_NAME"),
3356
3385
  [ATTR_API_NAME]: req.contractDetails?.name,
3357
3386
  [import_semantic_conventions3.ATTR_HTTP_REQUEST_METHOD]: req.method,
3358
3387
  [import_semantic_conventions3.ATTR_HTTP_ROUTE]: req.originalPath,
@@ -3401,8 +3430,8 @@ function enrichExpressLikeSend(instance, req, res, originalOperation, originalSe
3401
3430
  `attachment; filename="${data.name}"`
3402
3431
  );
3403
3432
  }
3404
- if ((0, import_common11.isNodeJsWriteableStream)(res)) {
3405
- import_stream.Readable.from((0, import_common11.readableStreamToAsyncIterable)(data.stream())).pipe(
3433
+ if ((0, import_common12.isNodeJsWriteableStream)(res)) {
3434
+ import_stream.Readable.from((0, import_common12.readableStreamToAsyncIterable)(data.stream())).pipe(
3406
3435
  res
3407
3436
  );
3408
3437
  } else {
@@ -3411,7 +3440,7 @@ function enrichExpressLikeSend(instance, req, res, originalOperation, originalSe
3411
3440
  originalSend.call(instance, "Not a NodeJS WritableStream");
3412
3441
  errorSent = true;
3413
3442
  }
3414
- } else if ((0, import_common11.isAsyncGenerator)(data)) {
3443
+ } else if ((0, import_common12.isAsyncGenerator)(data)) {
3415
3444
  let firstPass = true;
3416
3445
  const transformer = new import_stream.Transform({
3417
3446
  objectMode: true,
@@ -3439,7 +3468,7 @@ ${res.locals.errorMessage}`;
3439
3468
  if (!errorSent) {
3440
3469
  let data2 = "";
3441
3470
  for (const [key, value] of Object.entries(chunk)) {
3442
- data2 += `${key}: ${typeof value === "string" ? value : (0, import_common11.safeStringify)(value)}
3471
+ data2 += `${key}: ${typeof value === "string" ? value : (0, import_common12.safeStringify)(value)}
3443
3472
  `;
3444
3473
  }
3445
3474
  data2 += "\n";
@@ -3447,7 +3476,7 @@ ${res.locals.errorMessage}`;
3447
3476
  }
3448
3477
  }
3449
3478
  });
3450
- if ((0, import_common11.isNodeJsWriteableStream)(res)) {
3479
+ if ((0, import_common12.isNodeJsWriteableStream)(res)) {
3451
3480
  import_stream.Readable.from(data).pipe(transformer).pipe(res);
3452
3481
  } else {
3453
3482
  res.type("text/plain");
@@ -3458,7 +3487,7 @@ ${res.locals.errorMessage}`;
3458
3487
  } else {
3459
3488
  const parserType = responseBodies?.[Number(res.statusCode)]?.parserType;
3460
3489
  res.bodyData = data;
3461
- if ((0, import_common11.isRecord)(data)) {
3490
+ if ((0, import_common12.isRecord)(data)) {
3462
3491
  switch (parserType) {
3463
3492
  case "json":
3464
3493
  res.bodyData = "json" in data ? data.json : data;
@@ -3479,7 +3508,7 @@ ${res.locals.errorMessage}`;
3479
3508
  res.bodyData = data;
3480
3509
  break;
3481
3510
  default:
3482
- (0, import_common11.isNever)(parserType);
3511
+ (0, import_common12.isNever)(parserType);
3483
3512
  res.bodyData = data;
3484
3513
  break;
3485
3514
  }
@@ -3515,7 +3544,7 @@ ${res.locals.errorMessage}`;
3515
3544
  }
3516
3545
 
3517
3546
  // src/http/openApiV3Generator/openApiV3Generator.ts
3518
- var import_common12 = require("@forklaunch/common");
3547
+ var import_common13 = require("@forklaunch/common");
3519
3548
  var OPENAPI_DEFAULT_VERSION = Symbol("default");
3520
3549
  function toUpperCase(str) {
3521
3550
  return str.charAt(0).toUpperCase() + str.slice(1);
@@ -3738,7 +3767,7 @@ function generateOpenApiSpecs(schemaValidator, serverUrls, serverDescriptions, a
3738
3767
  ].forEach(({ fullPath, router }) => {
3739
3768
  const controllerName = transformBasePath(fullPath);
3740
3769
  router.routes.forEach((route) => {
3741
- const openApiPath = (0, import_common12.openApiCompliantPath)(
3770
+ const openApiPath = (0, import_common13.openApiCompliantPath)(
3742
3771
  `${fullPath}${route.path === "/" ? "" : route.path}`
3743
3772
  );
3744
3773
  const { name, summary, params, versions, auth, options: options2 } = route.contractDetails;
@@ -3843,7 +3872,7 @@ function generateOpenApiSpecs(schemaValidator, serverUrls, serverDescriptions, a
3843
3872
  }
3844
3873
 
3845
3874
  // src/http/sdk/sdkClient.ts
3846
- var import_common13 = require("@forklaunch/common");
3875
+ var import_common14 = require("@forklaunch/common");
3847
3876
 
3848
3877
  // src/http/guards/isSdkRouter.ts
3849
3878
  function isSdkRouter(value) {
@@ -3855,12 +3884,12 @@ function mapToSdk(schemaValidator, routerMap, runningPath = void 0) {
3855
3884
  const routerUniquenessCache = /* @__PURE__ */ new Set();
3856
3885
  return Object.fromEntries(
3857
3886
  Object.entries(routerMap).map(([key, value]) => {
3858
- if (routerUniquenessCache.has((0, import_common13.hashString)((0, import_common13.safeStringify)(value)))) {
3887
+ if (routerUniquenessCache.has((0, import_common14.hashString)((0, import_common14.safeStringify)(value)))) {
3859
3888
  throw new Error(
3860
3889
  `SdkClient: Cannot use the same router pointer twice. Please clone the duplicate router with .clone() or only use the router once.`
3861
3890
  );
3862
3891
  }
3863
- routerUniquenessCache.add((0, import_common13.hashString)((0, import_common13.safeStringify)(value)));
3892
+ routerUniquenessCache.add((0, import_common14.hashString)((0, import_common14.safeStringify)(value)));
3864
3893
  const currentPath = runningPath ? [runningPath, key].join(".") : key;
3865
3894
  if (isSdkRouter(value)) {
3866
3895
  Object.entries(value.sdkPaths).forEach(([routePath, sdkKey]) => {
@@ -3909,7 +3938,7 @@ function mapToFetch(schemaValidator, routerMap) {
3909
3938
  return ((path, ...reqInit) => {
3910
3939
  const method = reqInit[0]?.method;
3911
3940
  const version = reqInit[0] != null && "version" in reqInit[0] ? reqInit[0].version : void 0;
3912
- return (version ? (0, import_common13.toRecord)((0, import_common13.toRecord)(flattenedFetchMap[path])[method ?? "GET"])[version] : (0, import_common13.toRecord)(flattenedFetchMap[path])[method ?? "GET"])(path, reqInit[0]);
3941
+ return (version ? (0, import_common14.toRecord)((0, import_common14.toRecord)(flattenedFetchMap[path])[method ?? "GET"])[version] : (0, import_common14.toRecord)(flattenedFetchMap[path])[method ?? "GET"])(path, reqInit[0]);
3913
3942
  });
3914
3943
  }
3915
3944
  function sdkClient(schemaValidator, routerMap) {
@@ -3921,7 +3950,7 @@ function sdkClient(schemaValidator, routerMap) {
3921
3950
  }
3922
3951
 
3923
3952
  // src/http/sdk/sdkRouter.ts
3924
- var import_common14 = require("@forklaunch/common");
3953
+ var import_common15 = require("@forklaunch/common");
3925
3954
  function sdkRouter(schemaValidator, controller, router) {
3926
3955
  const controllerSdkPaths = [];
3927
3956
  const mappedSdk = Object.fromEntries(
@@ -3931,7 +3960,7 @@ function sdkRouter(schemaValidator, controller, router) {
3931
3960
  router.sdkPaths[sdkPath] = key;
3932
3961
  return [
3933
3962
  key,
3934
- router.sdk[(0, import_common14.toPrettyCamelCase)(value.contractDetails.name)]
3963
+ router.sdk[(0, import_common15.toPrettyCamelCase)(value.contractDetails.name)]
3935
3964
  ];
3936
3965
  })
3937
3966
  );
@@ -3978,6 +4007,7 @@ function metricsDefinitions(metrics2) {
3978
4007
  HTTPStatuses,
3979
4008
  OPENAPI_DEFAULT_VERSION,
3980
4009
  OpenTelemetryCollector,
4010
+ createHmacToken,
3981
4011
  delete_,
3982
4012
  discriminateBody,
3983
4013
  discriminateResponseBodies,