@forklaunch/core 1.5.1 → 1.5.3
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/lib/cache/{index.d.mts → cacheKey.d.ts} +2 -6
- package/lib/cache/cacheKey.d.ts.map +1 -0
- package/lib/cache/index.d.ts +4 -15
- package/lib/cache/index.d.ts.map +1 -0
- package/lib/{ttlCache.interface-B3xaLT00.d.ts → cache/interfaces/ttlCache.interface.d.ts} +3 -5
- package/lib/cache/interfaces/ttlCache.interface.d.ts.map +1 -0
- package/lib/{ttlCacheRecord.types-oX0ti5SP.d.mts → cache/types/ttlCacheRecord.types.d.ts} +3 -4
- package/lib/cache/types/ttlCacheRecord.types.d.ts.map +1 -0
- package/lib/controllers/index.d.ts +2 -13
- package/lib/controllers/index.d.ts.map +1 -0
- package/lib/controllers/{index.d.mts → interfaces/controller.interface.d.ts} +2 -3
- package/lib/controllers/interfaces/controller.interface.d.ts.map +1 -0
- package/lib/environment/index.d.ts +2 -28
- package/lib/environment/index.d.ts.map +1 -0
- package/lib/environment/{index.d.mts → loadCascadingEnv.d.ts} +4 -5
- package/lib/environment/loadCascadingEnv.d.ts.map +1 -0
- package/lib/http/application/expressLikeApplication.d.ts +34 -0
- package/lib/http/application/expressLikeApplication.d.ts.map +1 -0
- package/lib/http/bootstrap/listen.d.ts +2 -0
- package/lib/http/bootstrap/listen.d.ts.map +1 -0
- package/lib/http/cluster/cluster.types.d.ts +17 -0
- package/lib/http/cluster/cluster.types.d.ts.map +1 -0
- package/lib/http/cluster/isPortBound.d.ts +2 -0
- package/lib/http/cluster/isPortBound.d.ts.map +1 -0
- package/lib/http/createHmacToken.d.ts +19 -0
- package/lib/http/createHmacToken.d.ts.map +1 -0
- package/lib/http/discriminateAuthMethod.d.ts +85 -0
- package/lib/http/discriminateAuthMethod.d.ts.map +1 -0
- package/lib/http/generateHmacAuthHeaders.d.ts +31 -0
- package/lib/http/generateHmacAuthHeaders.d.ts.map +1 -0
- package/lib/http/guards/hasFeatureChecks.d.ts +2 -0
- package/lib/http/guards/hasFeatureChecks.d.ts.map +1 -0
- package/lib/http/guards/hasPermissionChecks.d.ts +2 -0
- package/lib/http/guards/hasPermissionChecks.d.ts.map +1 -0
- package/lib/http/guards/hasRoleChecks.d.ts +2 -0
- package/lib/http/guards/hasRoleChecks.d.ts.map +1 -0
- package/lib/http/guards/hasScopeChecks.d.ts +2 -0
- package/lib/http/guards/hasScopeChecks.d.ts.map +1 -0
- package/lib/http/guards/hasSend.d.ts +17 -0
- package/lib/http/guards/hasSend.d.ts.map +1 -0
- package/lib/http/guards/hasSubscriptionChecks.d.ts +2 -0
- package/lib/http/guards/hasSubscriptionChecks.d.ts.map +1 -0
- package/lib/http/guards/hasVersionedSchema.d.ts +2 -0
- package/lib/http/guards/hasVersionedSchema.d.ts.map +1 -0
- package/lib/http/guards/isBasicAuthMethod.d.ts +3 -0
- package/lib/http/guards/isBasicAuthMethod.d.ts.map +1 -0
- package/lib/http/guards/isConstrainedForklaunchRouter.d.ts +21 -0
- package/lib/http/guards/isConstrainedForklaunchRouter.d.ts.map +1 -0
- package/lib/http/guards/isExpressLikeSchemaHandler.d.ts +32 -0
- package/lib/http/guards/isExpressLikeSchemaHandler.d.ts.map +1 -0
- package/lib/http/guards/isForklaunchExpressLikeRouter.d.ts +28 -0
- package/lib/http/guards/isForklaunchExpressLikeRouter.d.ts.map +1 -0
- package/lib/http/guards/isForklaunchRequest.d.ts +26 -0
- package/lib/http/guards/isForklaunchRequest.d.ts.map +1 -0
- package/lib/http/guards/isForklaunchResponse.d.ts +23 -0
- package/lib/http/guards/isForklaunchResponse.d.ts.map +1 -0
- package/lib/http/guards/isForklaunchRouter.d.ts +21 -0
- package/lib/http/guards/isForklaunchRouter.d.ts.map +1 -0
- package/lib/http/guards/isHmacMethod.d.ts +9 -0
- package/lib/http/guards/isHmacMethod.d.ts.map +1 -0
- package/lib/http/guards/isHttpContractDetails.d.ts +29 -0
- package/lib/http/guards/isHttpContractDetails.d.ts.map +1 -0
- package/lib/http/guards/isJwtAuthMethod.d.ts +3 -0
- package/lib/http/guards/isJwtAuthMethod.d.ts.map +1 -0
- package/lib/http/guards/isLoggerMeta.d.ts +3 -0
- package/lib/http/guards/isLoggerMeta.d.ts.map +1 -0
- package/lib/http/guards/isPath.d.ts +2 -0
- package/lib/http/guards/isPath.d.ts.map +1 -0
- package/lib/http/guards/isPathParamContractDetails.d.ts +4 -0
- package/lib/http/guards/isPathParamContractDetails.d.ts.map +1 -0
- package/lib/http/guards/isRequestShape.d.ts +3 -0
- package/lib/http/guards/isRequestShape.d.ts.map +1 -0
- package/lib/http/guards/isResponseCompiledSchema.d.ts +3 -0
- package/lib/http/guards/isResponseCompiledSchema.d.ts.map +1 -0
- package/lib/http/guards/isSdkHandler.d.ts +9 -0
- package/lib/http/guards/isSdkHandler.d.ts.map +1 -0
- package/lib/http/guards/isSdkRouter.d.ts +9 -0
- package/lib/http/guards/isSdkRouter.d.ts.map +1 -0
- package/lib/http/guards/isTypedHandler.d.ts +5 -0
- package/lib/http/guards/isTypedHandler.d.ts.map +1 -0
- package/lib/http/guards/isVersionedInputSchema.d.ts +3 -0
- package/lib/http/guards/isVersionedInputSchema.d.ts.map +1 -0
- package/lib/http/handlers/delete.d.ts +5 -0
- package/lib/http/handlers/delete.d.ts.map +1 -0
- package/lib/http/handlers/get.d.ts +5 -0
- package/lib/http/handlers/get.d.ts.map +1 -0
- package/lib/http/handlers/head.d.ts +5 -0
- package/lib/http/handlers/head.d.ts.map +1 -0
- package/lib/http/handlers/middleware.d.ts +10 -0
- package/lib/http/handlers/middleware.d.ts.map +1 -0
- package/lib/http/handlers/options.d.ts +5 -0
- package/lib/http/handlers/options.d.ts.map +1 -0
- package/lib/http/handlers/patch.d.ts +5 -0
- package/lib/http/handlers/patch.d.ts.map +1 -0
- package/lib/http/handlers/post.d.ts +5 -0
- package/lib/http/handlers/post.d.ts.map +1 -0
- package/lib/http/handlers/put.d.ts +5 -0
- package/lib/http/handlers/put.d.ts.map +1 -0
- package/lib/http/handlers/trace.d.ts +5 -0
- package/lib/http/handlers/trace.d.ts.map +1 -0
- package/lib/http/handlers/typedAuthHandler.d.ts +5 -0
- package/lib/http/handlers/typedAuthHandler.d.ts.map +1 -0
- package/lib/http/handlers/typedHandler.d.ts +14 -0
- package/lib/http/handlers/typedHandler.d.ts.map +1 -0
- package/lib/http/httpStatusCodes.d.ts +75 -0
- package/lib/http/httpStatusCodes.d.ts.map +1 -0
- package/lib/http/index.d.ts +47 -1244
- package/lib/http/index.d.ts.map +1 -0
- package/lib/http/index.js +445 -410
- package/lib/http/index.js.map +1 -1
- package/lib/http/index.mjs +439 -407
- package/lib/http/index.mjs.map +1 -1
- package/lib/http/interfaces/expressLikeRouter.interface.d.ts +25 -0
- package/lib/http/interfaces/expressLikeRouter.interface.d.ts.map +1 -0
- package/lib/http/mcpGenerator/mcpGenerator.d.ts +17 -0
- package/lib/http/mcpGenerator/mcpGenerator.d.ts.map +1 -0
- package/lib/http/middleware/request/auth.middleware.d.ts +16 -0
- package/lib/http/middleware/request/auth.middleware.d.ts.map +1 -0
- package/lib/http/middleware/request/cors.middleware.d.ts +13 -0
- package/lib/http/middleware/request/cors.middleware.d.ts.map +1 -0
- package/lib/http/middleware/request/createContext.middleware.d.ts +15 -0
- package/lib/http/middleware/request/createContext.middleware.d.ts.map +1 -0
- package/lib/http/middleware/request/enrichDetails.middleware.d.ts +18 -0
- package/lib/http/middleware/request/enrichDetails.middleware.d.ts.map +1 -0
- package/lib/http/middleware/request/parse.middleware.d.ts +17 -0
- package/lib/http/middleware/request/parse.middleware.d.ts.map +1 -0
- package/lib/http/middleware/request/tenantContext.middleware.d.ts +41 -0
- package/lib/http/middleware/request/tenantContext.middleware.d.ts.map +1 -0
- package/lib/http/middleware/response/enrichExpressLikeSend.middleware.d.ts +32 -0
- package/lib/http/middleware/response/enrichExpressLikeSend.middleware.d.ts.map +1 -0
- package/lib/http/middleware/response/parse.middleware.d.ts +31 -0
- package/lib/http/middleware/response/parse.middleware.d.ts.map +1 -0
- package/lib/http/openApiV3Generator/openApiV3Generator.d.ts +17 -0
- package/lib/http/openApiV3Generator/openApiV3Generator.d.ts.map +1 -0
- package/lib/http/rateLimit/index.d.ts +2 -0
- package/lib/http/rateLimit/index.d.ts.map +1 -0
- package/lib/http/rateLimit/rateLimiter.d.ts +66 -0
- package/lib/http/rateLimit/rateLimiter.d.ts.map +1 -0
- package/lib/http/router/discriminateBody.d.ts +43 -0
- package/lib/http/router/discriminateBody.d.ts.map +1 -0
- package/lib/http/router/expressLikeRouter.d.ts +240 -0
- package/lib/http/router/expressLikeRouter.d.ts.map +1 -0
- package/lib/http/router/routerSharedLogic.d.ts +50 -0
- package/lib/http/router/routerSharedLogic.d.ts.map +1 -0
- package/lib/http/router/unpackRouters.d.ts +7 -0
- package/lib/http/router/unpackRouters.d.ts.map +1 -0
- package/lib/http/telemetry/auditLogger.d.ts +21 -0
- package/lib/http/telemetry/auditLogger.d.ts.map +1 -0
- package/lib/http/telemetry/constants.d.ts +6 -0
- package/lib/http/telemetry/constants.d.ts.map +1 -0
- package/lib/http/telemetry/evaluateTelemetryOptions.d.ts +11 -0
- package/lib/http/telemetry/evaluateTelemetryOptions.d.ts.map +1 -0
- package/lib/http/telemetry/metricsDefinition.d.ts +3 -0
- package/lib/http/telemetry/metricsDefinition.d.ts.map +1 -0
- package/lib/http/telemetry/openTelemetryCollector.d.ts +53 -0
- package/lib/http/telemetry/openTelemetryCollector.d.ts.map +1 -0
- package/lib/http/telemetry/pinoLogger.d.ts +20 -0
- package/lib/http/telemetry/pinoLogger.d.ts.map +1 -0
- package/lib/http/telemetry/recordMetric.d.ts +5 -0
- package/lib/http/telemetry/recordMetric.d.ts.map +1 -0
- package/lib/http/types/apiDefinition.types.d.ts +471 -0
- package/lib/http/types/apiDefinition.types.d.ts.map +1 -0
- package/lib/http/types/contractDetails.types.d.ts +404 -0
- package/lib/http/types/contractDetails.types.d.ts.map +1 -0
- package/lib/http/types/docsConfiguration.types.d.ts +7 -0
- package/lib/http/types/docsConfiguration.types.d.ts.map +1 -0
- package/lib/http/types/expressLikeOptions.d.ts +224 -0
- package/lib/http/types/expressLikeOptions.d.ts.map +1 -0
- package/lib/http/types/expressLikeRouter.types.d.ts +127 -0
- package/lib/http/types/expressLikeRouter.types.d.ts.map +1 -0
- package/lib/http/types/openTelemetryCollector.types.d.ts +21 -0
- package/lib/http/types/openTelemetryCollector.types.d.ts.map +1 -0
- package/lib/http/types/router.types.d.ts +52 -0
- package/lib/http/types/router.types.d.ts.map +1 -0
- package/lib/http/types/sdk.types.d.ts +259 -0
- package/lib/http/types/sdk.types.d.ts.map +1 -0
- package/lib/http/types/typedHandler.types.d.ts +18 -0
- package/lib/http/types/typedHandler.types.d.ts.map +1 -0
- package/lib/mappers/guards/isSchemaResolutionFunction.d.ts +10 -0
- package/lib/mappers/guards/isSchemaResolutionFunction.d.ts.map +1 -0
- package/lib/mappers/index.d.ts +3 -68
- package/lib/mappers/index.d.ts.map +1 -0
- package/lib/mappers/mapServiceSchemas.d.ts +33 -0
- package/lib/mappers/mapServiceSchemas.d.ts.map +1 -0
- package/lib/mappers/mapper.d.ts +26 -0
- package/lib/mappers/mapper.d.ts.map +1 -0
- package/lib/mappers/types/schemaResolution.types.d.ts +9 -0
- package/lib/mappers/types/schemaResolution.types.d.ts.map +1 -0
- package/lib/objectstore/index.d.ts +3 -71
- package/lib/objectstore/index.d.ts.map +1 -0
- package/lib/objectstore/{index.d.mts → interfaces/objectstore.interface.d.ts} +3 -16
- package/lib/objectstore/interfaces/objectstore.interface.d.ts.map +1 -0
- package/lib/objectstore/objectstoreKey.d.ts +11 -0
- package/lib/objectstore/objectstoreKey.d.ts.map +1 -0
- package/lib/persistence/complianceEventSubscriber.d.ts +13 -0
- package/lib/persistence/complianceEventSubscriber.d.ts.map +1 -0
- package/lib/persistence/compliancePropertyBuilder.d.ts +26 -0
- package/lib/persistence/compliancePropertyBuilder.d.ts.map +1 -0
- package/lib/persistence/complianceTypes.d.ts +64 -0
- package/lib/persistence/complianceTypes.d.ts.map +1 -0
- package/lib/persistence/defineComplianceEntity.d.ts +19 -0
- package/lib/persistence/defineComplianceEntity.d.ts.map +1 -0
- package/lib/persistence/encryptedType.d.ts +85 -0
- package/lib/persistence/encryptedType.d.ts.map +1 -0
- package/lib/persistence/fieldEncryptor.d.ts +48 -0
- package/lib/persistence/fieldEncryptor.d.ts.map +1 -0
- package/lib/persistence/index.d.ts +10 -403
- package/lib/persistence/index.d.ts.map +1 -0
- package/lib/persistence/index.js.map +1 -1
- package/lib/persistence/index.mjs.map +1 -1
- package/lib/persistence/rls.d.ts +56 -0
- package/lib/persistence/rls.d.ts.map +1 -0
- package/lib/persistence/tenantEm.d.ts +60 -0
- package/lib/persistence/tenantEm.d.ts.map +1 -0
- package/lib/persistence/tenantFilter.d.ts +47 -0
- package/lib/persistence/tenantFilter.d.ts.map +1 -0
- package/lib/secrets/index.d.ts +2 -0
- package/lib/secrets/index.d.ts.map +1 -0
- package/lib/secrets/secretsAccessor.d.ts +17 -0
- package/lib/secrets/secretsAccessor.d.ts.map +1 -0
- package/lib/services/complianceDataService.d.ts +47 -0
- package/lib/services/complianceDataService.d.ts.map +1 -0
- package/lib/services/configInjector.d.ts +43 -0
- package/lib/services/configInjector.d.ts.map +1 -0
- package/lib/services/guards/isConstructed.d.ts +3 -0
- package/lib/services/guards/isConstructed.d.ts.map +1 -0
- package/lib/services/guards/isConstructedSingleton.d.ts +3 -0
- package/lib/services/guards/isConstructedSingleton.d.ts.map +1 -0
- package/lib/services/guards/isConstructor.d.ts +3 -0
- package/lib/services/guards/isConstructor.d.ts.map +1 -0
- package/lib/services/index.d.ts +10 -184
- package/lib/services/index.d.ts.map +1 -0
- package/lib/services/retentionService.d.ts +31 -0
- package/lib/services/retentionService.d.ts.map +1 -0
- package/lib/services/runRetentionEnforcement.d.ts +19 -0
- package/lib/services/runRetentionEnforcement.d.ts.map +1 -0
- package/lib/services/types/configInjector.types.d.ts +39 -0
- package/lib/services/types/configInjector.types.d.ts.map +1 -0
- package/lib/services/types/entityManager.types.d.ts +4 -0
- package/lib/services/types/entityManager.types.d.ts.map +1 -0
- package/lib/services/types/service.types.d.ts +5 -0
- package/lib/services/types/service.types.d.ts.map +1 -0
- package/lib/ws/asyncApiV3Generator/asyncApiV3Generator.d.ts +12 -0
- package/lib/ws/asyncApiV3Generator/asyncApiV3Generator.d.ts.map +1 -0
- package/lib/ws/index.d.ts +4 -67
- package/lib/ws/index.d.ts.map +1 -0
- package/lib/ws/index.js.map +1 -1
- package/lib/ws/index.mjs.map +1 -1
- package/lib/ws/types/eventSchema.types.d.ts +28 -0
- package/lib/ws/types/eventSchema.types.d.ts.map +1 -0
- package/lib/ws/webSocketLike.d.ts +18 -0
- package/lib/ws/webSocketLike.d.ts.map +1 -0
- package/package.json +47 -46
- package/LICENSE +0 -21
- package/lib/apiDefinition.types-DF_crhB0.d.mts +0 -1092
- package/lib/apiDefinition.types-DW4lfZqy.d.ts +0 -1092
- package/lib/http/index.d.mts +0 -1244
- package/lib/mappers/index.d.mts +0 -68
- package/lib/openTelemetryCollector-BS-ej09T.d.mts +0 -70
- package/lib/openTelemetryCollector-BS-ej09T.d.ts +0 -70
- package/lib/persistence/index.d.mts +0 -403
- package/lib/services/index.d.mts +0 -185
- package/lib/ttlCache.interface-CEOkrt8d.d.mts +0 -77
- package/lib/ttlCacheRecord.types-oX0ti5SP.d.ts +0 -25
- package/lib/ws/index.d.mts +0 -67
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { AnySchemaValidator } from '@forklaunch/validator';
|
|
2
|
+
import { EmptyObject, Prettify, PrettyCamelCase, SanitizePathSlashes } from '@forklaunch/common';
|
|
3
|
+
import { ExpressLikeRouter, NestableRouterBasedHandler, PathBasedHandler, PathOrMiddlewareBasedHandler } from '../interfaces/expressLikeRouter.interface';
|
|
4
|
+
import { OpenTelemetryCollector } from '../telemetry/openTelemetryCollector';
|
|
5
|
+
import { ExpressLikeSchemaHandler, LiveSdkFunction, LiveTypeFunction } from '../types/apiDefinition.types';
|
|
6
|
+
import { Body, HeadersObject, Method, ParamsObject, QueryObject, ResponsesObject, SchemaAuthMethods, SessionObject, VersionSchema } from '../types/contractDetails.types';
|
|
7
|
+
import { ExpressLikeRouterOptions } from '../types/expressLikeOptions';
|
|
8
|
+
import { ContractDetailsOrMiddlewareOrTypedHandler, LiveTypeRouteDefinition, MiddlewareOrMiddlewareWithTypedHandler, TypedMiddlewareDefinition, TypedNestableMiddlewareDefinition } from '../types/expressLikeRouter.types';
|
|
9
|
+
import { MetricsDefinition } from '../types/openTelemetryCollector.types';
|
|
10
|
+
import { ConstrainedForklaunchRouter, ForklaunchRoute, ForklaunchRouter } from '../types/router.types';
|
|
11
|
+
import { FetchFunction, SdkHandlerObject } from '../types/sdk.types';
|
|
12
|
+
/**
|
|
13
|
+
* Extracts route middleware and handlers from route registration arguments.
|
|
14
|
+
* This is a port function that converts typed handlers into Express middleware
|
|
15
|
+
* without actually registering them on a router.
|
|
16
|
+
*
|
|
17
|
+
* @template SV - The schema validator type.
|
|
18
|
+
* @template Name - The route name.
|
|
19
|
+
* @template ContractMethod - The HTTP method.
|
|
20
|
+
* @template Path - The route path.
|
|
21
|
+
* @template P - The type of request parameters.
|
|
22
|
+
* @template ResBodyMap - The type of response body map.
|
|
23
|
+
* @template ReqBody - The type of request body.
|
|
24
|
+
* @template ReqQuery - The type of request query.
|
|
25
|
+
* @template ReqHeaders - The type of request headers.
|
|
26
|
+
* @template ResHeaders - The type of response headers.
|
|
27
|
+
* @template LocalsObj - The type of local variables.
|
|
28
|
+
* @template VersionedApi - The versioned API schema.
|
|
29
|
+
* @template RouterSession - The router session type.
|
|
30
|
+
* @template BaseRequest - The base request type.
|
|
31
|
+
* @template BaseResponse - The base response type.
|
|
32
|
+
* @template NextFunction - The next function type.
|
|
33
|
+
* @template Auth - The auth schema.
|
|
34
|
+
* @template RouterHandler - The router handler type.
|
|
35
|
+
* @param {object} params - The parameters for extracting route handlers.
|
|
36
|
+
* @param {ContractMethod} params.method - The HTTP method.
|
|
37
|
+
* @param {Path} params.path - The route path.
|
|
38
|
+
* @param {string} params.basePath - The base path for the router.
|
|
39
|
+
* @param {SV} params.schemaValidator - The schema validator.
|
|
40
|
+
* @param {ContractDetailsOrMiddlewareOrTypedHandler<SV, Name, ContractMethod, Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, VersionedApi, BaseRequest, BaseResponse, NextFunction, RouterSession, Auth>} params.contractDetailsOrMiddlewareOrTypedHandler - The contract details or typed handler.
|
|
41
|
+
* @param {MiddlewareOrMiddlewareWithTypedHandler<SV, Name, ContractMethod, Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, VersionedApi, BaseRequest, BaseResponse, NextFunction, RouterSession, Auth>[]} params.middlewareOrMiddlewareAndTypedHandler - Additional middleware or typed handlers.
|
|
42
|
+
* @param {OpenTelemetryCollector<MetricsDefinition>} params.openTelemetryCollector - The OpenTelemetry collector.
|
|
43
|
+
* @param {RouterHandler[]} params.postEnrichMiddleware - Additional middleware to run after enrichment.
|
|
44
|
+
* @param {ExpressLikeRouterOptions<SV, RouterSession> | undefined} params.routerOptions - Router options.
|
|
45
|
+
* @returns {{ middlewares: RouterHandler[]; controllerHandler: ExpressLikeHandler<SV, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, VersionedRequests, VersionedResponses, RouterSession, BaseRequest, BaseResponse, NextFunction> }} - The extracted middlewares and controller handler.
|
|
46
|
+
*/
|
|
47
|
+
export declare function extractRouteHandlers<SV extends AnySchemaValidator, Name extends string, ContractMethod extends Method, Path extends `/${string}`, P extends ParamsObject<SV>, ResBodyMap extends ResponsesObject<SV>, ReqBody extends Body<SV>, ReqQuery extends QueryObject<SV>, ReqHeaders extends HeadersObject<SV>, ResHeaders extends HeadersObject<SV>, LocalsObj extends Record<string, unknown>, VersionedApi extends VersionSchema<SV, ContractMethod>, RouterSession extends SessionObject<SV>, BaseRequest, BaseResponse, NextFunction, Auth extends SchemaAuthMethods<SV, P, ReqBody, ReqQuery, ReqHeaders, VersionedApi, BaseRequest>, RouterHandler>(params: {
|
|
48
|
+
method: ContractMethod;
|
|
49
|
+
path: Path;
|
|
50
|
+
basePath: string;
|
|
51
|
+
schemaValidator: SV;
|
|
52
|
+
contractDetailsOrMiddlewareOrTypedHandler: ContractDetailsOrMiddlewareOrTypedHandler<SV, Name, ContractMethod, Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, VersionedApi, BaseRequest, BaseResponse, NextFunction, RouterSession, Auth>;
|
|
53
|
+
middlewareOrMiddlewareAndTypedHandler: MiddlewareOrMiddlewareWithTypedHandler<SV, Name, ContractMethod, Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, VersionedApi, BaseRequest, BaseResponse, NextFunction, RouterSession, Auth>[];
|
|
54
|
+
openTelemetryCollector?: OpenTelemetryCollector<MetricsDefinition>;
|
|
55
|
+
postEnrichMiddleware?: RouterHandler[];
|
|
56
|
+
routerOptions?: ExpressLikeRouterOptions<SV, RouterSession>;
|
|
57
|
+
}): {
|
|
58
|
+
middlewares: RouterHandler[];
|
|
59
|
+
controllerHandler: ExpressLikeSchemaHandler<SV, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, VersionedApi, RouterSession, BaseRequest, BaseResponse, NextFunction>;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* A class that represents an Express-like router.
|
|
63
|
+
*/
|
|
64
|
+
export declare class ForklaunchExpressLikeRouter<SV extends AnySchemaValidator, BasePath extends `/${string}`, RouterHandler, Internal extends ExpressLikeRouter<RouterHandler, Internal>, BaseRequest, BaseResponse, NextFunction, RouterSession extends SessionObject<SV>, FetchMap extends Record<string, unknown> = EmptyObject, Sdk extends Record<string, unknown> = EmptyObject> implements ConstrainedForklaunchRouter<SV, RouterHandler> {
|
|
65
|
+
#private;
|
|
66
|
+
readonly basePath: BasePath;
|
|
67
|
+
readonly schemaValidator: SV;
|
|
68
|
+
readonly internal: Internal;
|
|
69
|
+
readonly postEnrichMiddleware: RouterHandler[];
|
|
70
|
+
readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
|
|
71
|
+
readonly routerOptions?: ExpressLikeRouterOptions<SV, RouterSession> | undefined;
|
|
72
|
+
requestHandler: RouterHandler;
|
|
73
|
+
routers: ForklaunchRouter<SV>[];
|
|
74
|
+
routes: ForklaunchRoute<SV>[];
|
|
75
|
+
_fetchMap: FetchMap;
|
|
76
|
+
sdk: Sdk;
|
|
77
|
+
sdkPaths: Record<string, string>;
|
|
78
|
+
constructor(basePath: BasePath, schemaValidator: SV, internal: Internal, postEnrichMiddleware: RouterHandler[], openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, routerOptions?: ExpressLikeRouterOptions<SV, RouterSession> | undefined);
|
|
79
|
+
/**
|
|
80
|
+
* Extracts the controller handler from the provided handlers.
|
|
81
|
+
*
|
|
82
|
+
* @template P - The type of request parameters.
|
|
83
|
+
* @template ResBodyMap - The type of response body.
|
|
84
|
+
* @template ReqBody - The type of request body.
|
|
85
|
+
* @template ReqQuery - The type of request query.
|
|
86
|
+
* @template LocalsObj - The type of local variables.
|
|
87
|
+
* @param {MiddlewareHandler<SV, P, ResBodyMap, ReqBody, ReqQuery, LocalsObj>[]} handlers - The provided handlers.
|
|
88
|
+
* @returns {MiddlewareHandler<SV, P, ResBodyMap, ReqBody, ReqQuery, LocalsObj>} - The extracted controller handler.
|
|
89
|
+
* @throws {Error} - Throws an error if the last argument is not a handler.
|
|
90
|
+
*/
|
|
91
|
+
/**
|
|
92
|
+
* Fetches a route from the route map and executes it with the given parameters.
|
|
93
|
+
*
|
|
94
|
+
* @template Path - The path type that extends keyof _fetchMap and string.
|
|
95
|
+
* @param {Path} path - The route path
|
|
96
|
+
* @param {Parameters<_fetchMap[Path]>[1]} [requestInit] - Optional request initialization parameters.
|
|
97
|
+
* @returns {Promise<ReturnType<_fetchMap[Path]>>} - The result of executing the route handler.
|
|
98
|
+
*/
|
|
99
|
+
fetch: FetchFunction<this['_fetchMap']>;
|
|
100
|
+
registerRoute<Name extends string, ContractMethod extends Method, Path extends `/${string}`, P extends ParamsObject<SV>, ResBodyMap extends ResponsesObject<SV>, ReqBody extends Body<SV>, ReqQuery extends QueryObject<SV>, ReqHeaders extends HeadersObject<SV>, ResHeaders extends HeadersObject<SV>, LocalsObj extends Record<string, unknown>, VersionedApi extends VersionSchema<SV, ContractMethod>, Auth extends SchemaAuthMethods<SV, P, ReqBody, ReqQuery, ReqHeaders, VersionedApi, BaseRequest>>(method: ContractMethod, path: Path, registrationMethod: PathBasedHandler<RouterHandler>, contractDetailsOrMiddlewareOrTypedHandler: ContractDetailsOrMiddlewareOrTypedHandler<SV, Name, ContractMethod, Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, VersionedApi, BaseRequest, BaseResponse, NextFunction, RouterSession, Auth>, ...middlewareOrMiddlewareAndTypedHandler: MiddlewareOrMiddlewareWithTypedHandler<SV, Name, ContractMethod, Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, VersionedApi, BaseRequest, BaseResponse, NextFunction, RouterSession, Auth>[]): this & {
|
|
101
|
+
_fetchMap: Prettify<FetchMap extends Record<SanitizePathSlashes<`${BasePath}${Path}`>, unknown> ? FetchMap & Record<SanitizePathSlashes<`${BasePath}${Path}`>, FetchMap[SanitizePathSlashes<`${BasePath}${Path}`>] & Record<Uppercase<ContractMethod>, LiveTypeFunction<SV, SanitizePathSlashes<`${BasePath}${Path}`>, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, ContractMethod, VersionedApi, Auth>>> : FetchMap & Record<SanitizePathSlashes<`${BasePath}${Path}`>, Record<Uppercase<ContractMethod>, LiveTypeFunction<SV, SanitizePathSlashes<`${BasePath}${Path}`>, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, ContractMethod, VersionedApi, Auth>>>>;
|
|
102
|
+
sdk: Prettify<Sdk & Record<PrettyCamelCase<Name extends string ? Name : SanitizePathSlashes<`${BasePath}${Path}`>>, LiveSdkFunction<SV, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, VersionedApi, Auth>>>;
|
|
103
|
+
};
|
|
104
|
+
registerMiddlewareHandler<Name extends string, Path extends `/${string}`, P extends ParamsObject<SV>, ResBodyMap extends ResponsesObject<SV>, ReqBody extends Body<SV>, ReqQuery extends QueryObject<SV>, ReqHeaders extends HeadersObject<SV>, ResHeaders extends HeadersObject<SV>, LocalsObj extends Record<string, unknown>, VersionedApi extends VersionSchema<SV, 'middleware'>, Auth extends SchemaAuthMethods<SV, P, ReqBody, ReqQuery, ReqHeaders, VersionedApi, BaseRequest>>(registrationMethod: PathOrMiddlewareBasedHandler<RouterHandler>, pathOrContractDetailsOrMiddlewareOrTypedHandler: Path | ContractDetailsOrMiddlewareOrTypedHandler<SV, Name, 'middleware', Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, VersionedApi, BaseRequest, BaseResponse, NextFunction, RouterSession, Auth> | RouterHandler, contractDetailsOrMiddlewareOrTypedHandler?: ContractDetailsOrMiddlewareOrTypedHandler<SV, Name, 'middleware', Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, VersionedApi, BaseRequest, BaseResponse, NextFunction, RouterSession, Auth> | RouterHandler, ...middlewareOrMiddlewareWithTypedHandler: (MiddlewareOrMiddlewareWithTypedHandler<SV, Name, 'middleware', Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, VersionedApi, BaseRequest, BaseResponse, NextFunction, RouterSession, Auth> | RouterHandler)[]): this;
|
|
105
|
+
private addRouterToSdk;
|
|
106
|
+
registerNestableMiddlewareHandler<Name extends string, Path extends `/${string}`, P extends ParamsObject<SV>, ResBodyMap extends ResponsesObject<SV>, ReqBody extends Body<SV>, ReqQuery extends QueryObject<SV>, ReqHeaders extends HeadersObject<SV>, ResHeaders extends HeadersObject<SV>, LocalsObj extends Record<string, unknown>, VersionedApi extends VersionSchema<SV, 'middleware'>, const SessionSchema extends SessionObject<SV>, Auth extends SchemaAuthMethods<SV, P, ReqBody, ReqQuery, ReqHeaders, VersionedApi, BaseRequest>>(registrationMethod: NestableRouterBasedHandler<RouterHandler, Internal>, pathOrContractDetailsOrMiddlewareOrTypedHandler: Path | ContractDetailsOrMiddlewareOrTypedHandler<SV, Name, 'middleware', Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, VersionedApi, BaseRequest, BaseResponse, NextFunction, RouterSession, Auth> | ConstrainedForklaunchRouter<SV, RouterHandler>, contractDetailsOrMiddlewareOrTypedHandler?: ContractDetailsOrMiddlewareOrTypedHandler<SV, Name, 'middleware', Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, VersionedApi, BaseRequest, BaseResponse, NextFunction, RouterSession, Auth> | ConstrainedForklaunchRouter<SV, RouterHandler>, ...middlewareOrMiddlewareWithTypedHandler: (MiddlewareOrMiddlewareWithTypedHandler<SV, Name, 'middleware', Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, VersionedApi, BaseRequest, BaseResponse, NextFunction, RouterSession, Auth> | ConstrainedForklaunchRouter<SV, RouterHandler>)[]): this;
|
|
107
|
+
private addRouterOptions;
|
|
108
|
+
/**
|
|
109
|
+
* Validates that all protected routes have the required surfacing functions
|
|
110
|
+
* available (from the route, router, or application level).
|
|
111
|
+
* Call this at listen() time when the full option chain is assembled.
|
|
112
|
+
*/
|
|
113
|
+
validateSurfacingFunctions(router?: ForklaunchRouter<SV>, parentAuth?: Record<string, unknown>): void;
|
|
114
|
+
use: TypedNestableMiddlewareDefinition<this, RouterHandler, Internal, SV, RouterSession, BaseRequest, BaseResponse, NextFunction>;
|
|
115
|
+
all: TypedMiddlewareDefinition<this, SV, RouterSession, BaseRequest, BaseResponse, NextFunction, RouterHandler>;
|
|
116
|
+
connect: TypedMiddlewareDefinition<this, SV, RouterSession, BaseRequest, BaseResponse, NextFunction, RouterHandler>;
|
|
117
|
+
/**
|
|
118
|
+
* Registers a GET route with the specified contract details and handler handlers.
|
|
119
|
+
*
|
|
120
|
+
* @template P - The type of request parameters.
|
|
121
|
+
* @template ResBodyMap - The type of response body.
|
|
122
|
+
* @template ReqBody - The type of request body.
|
|
123
|
+
* @template ReqQuery - The type of request query.
|
|
124
|
+
* @template LocalsObj - The type of local variables.
|
|
125
|
+
* @param {string} path - The path for the route.
|
|
126
|
+
* @param {PathParamHttpContractDetails<SV, P, ResBodyMap, ReqQuery>} contractDetails - The contract details.
|
|
127
|
+
* @param {...SchemaHandler<SV, P, ResBodyMap, ReqBody, ReqQuery, LocalsObj>[]} handlers - The handler handlers.
|
|
128
|
+
* @returns {ExpressRouter} - The Express router.
|
|
129
|
+
*/
|
|
130
|
+
get: LiveTypeRouteDefinition<SV, BasePath, 'get', RouterHandler, Internal, RouterSession, BaseRequest, BaseResponse, NextFunction, this>;
|
|
131
|
+
/**
|
|
132
|
+
* Registers a POST route with the specified contract details and handler handlers.
|
|
133
|
+
*
|
|
134
|
+
* @template P - The type of request parameters.
|
|
135
|
+
* @template ResBodyMap - The type of response body.
|
|
136
|
+
* @template ReqBody - The type of request body.
|
|
137
|
+
* @template ReqQuery - The type of request query.
|
|
138
|
+
* @template LocalsObj - The type of local variables.
|
|
139
|
+
* @param {string} path - The path for the route.
|
|
140
|
+
* @param {HttpContractDetails<SV, P, ResBodyMap, ReqBody, ReqQuery>} contractDetails - The contract details.
|
|
141
|
+
* @param {...SchemaHandler<SV, P, ResBodyMap, ReqBody, ReqQuery, LocalsObj>[]} handlers - The handler handlers.
|
|
142
|
+
* @returns {ExpressRouter} - The Expxwress router.
|
|
143
|
+
*/
|
|
144
|
+
post: LiveTypeRouteDefinition<SV, BasePath, 'post', RouterHandler, Internal, RouterSession, BaseRequest, BaseResponse, NextFunction, this>;
|
|
145
|
+
/**
|
|
146
|
+
* Registers a PUT route with the specified contract details and handler handlers.
|
|
147
|
+
*
|
|
148
|
+
* @template P - The type of request parameters.
|
|
149
|
+
* @template ResBodyMap - The type of response body.
|
|
150
|
+
* @template ReqBody - The type of request body.
|
|
151
|
+
* @template ReqQuery - The type of request query.
|
|
152
|
+
* @template LocalsObj - The type of local variables.
|
|
153
|
+
* @param {string} path - The path for the route.
|
|
154
|
+
* @param {HttpContractDetails<SV, P, ResBodyMap, ReqBody, ReqQuery>} contractDetails - The contract details.
|
|
155
|
+
* @param {...SchemaHandler<SV, P, ResBodyMap, ReqBody, ReqQuery, LocalsObj>[]} handlers - The handler handlers.
|
|
156
|
+
* @returns {ExpressRouter} - The Express router.
|
|
157
|
+
*/
|
|
158
|
+
put: LiveTypeRouteDefinition<SV, BasePath, 'put', RouterHandler, Internal, RouterSession, BaseRequest, BaseResponse, NextFunction, this>;
|
|
159
|
+
/**
|
|
160
|
+
* Registers a PATCH route with the specified contract details and handler handlers.
|
|
161
|
+
*
|
|
162
|
+
* @template P - The type of request parameters.
|
|
163
|
+
* @template ResBodyMap - The type of response body.
|
|
164
|
+
* @template ReqBody - The type of request body.
|
|
165
|
+
* @template ReqQuery - The type of request query.
|
|
166
|
+
* @template LocalsObj - The type of local variables.
|
|
167
|
+
* @param {string} path - The path for the route.
|
|
168
|
+
* @param {HttpContractDetails<SV, P, ResBodyMap, ReqBody, ReqQuery>} contractDetails - The contract details.
|
|
169
|
+
* @param {...SchemaHandler<SV, P, ResBodyMap, ReqBody, ReqQuery, LocalsObj>[]} handlers - The handler handlers.
|
|
170
|
+
* @returns {ExpressRouter} - The Express router.
|
|
171
|
+
*/
|
|
172
|
+
patch: LiveTypeRouteDefinition<SV, BasePath, 'patch', RouterHandler, Internal, RouterSession, BaseRequest, BaseResponse, NextFunction, this>;
|
|
173
|
+
/**
|
|
174
|
+
* Registers a DELETE route with the specified contract details and handler handlers.
|
|
175
|
+
*
|
|
176
|
+
* @template P - The type of request parameters.
|
|
177
|
+
* @template ResBodyMap - The type of response body.
|
|
178
|
+
* @template ReqBody - The type of request body.
|
|
179
|
+
* @template ReqQuery - The type of request query.
|
|
180
|
+
* @template LocalsObj - The type of local variables.
|
|
181
|
+
* @param {string} path - The path for the route.
|
|
182
|
+
* @param {PathParamHttpContractDetails<SV, P, ResBodyMap, ReqQuery>} contractDetails - The contract details.
|
|
183
|
+
* @param {...SchemaHandler<SV, P, ResBodyMap, ReqBody, ReqQuery, LocalsObj>[]} handlers - The handler handlers.
|
|
184
|
+
* @returns {ExpressRouter} - The Express router.
|
|
185
|
+
*/
|
|
186
|
+
delete: LiveTypeRouteDefinition<SV, BasePath, 'delete', RouterHandler, Internal, RouterSession, BaseRequest, BaseResponse, NextFunction, this>;
|
|
187
|
+
/**
|
|
188
|
+
* Registers a OPTIONS route with the specified contract details and handler handlers.
|
|
189
|
+
*
|
|
190
|
+
* @template P - The type of request parameters.
|
|
191
|
+
* @template ResBodyMap - The type of response body.
|
|
192
|
+
* @template ReqBody - The type of request body.
|
|
193
|
+
* @template ReqQuery - The type of request query.
|
|
194
|
+
* @template LocalsObj - The type of local variables.
|
|
195
|
+
* @param {string} path - The path for the route.
|
|
196
|
+
* @param {PathParamHttpContractDetails<SV, P, ResBodyMap, ReqQuery>} contractDetails - The contract details.
|
|
197
|
+
* @param {...SchemaHandler<SV, P, ResBodyMap, ReqBody, ReqQuery, LocalsObj>[]} handlers - The handler handlers.
|
|
198
|
+
* @returns {ExpressRouter} - The Express router.
|
|
199
|
+
*/
|
|
200
|
+
options: LiveTypeRouteDefinition<SV, BasePath, 'options', RouterHandler, Internal, RouterSession, BaseRequest, BaseResponse, NextFunction, this>;
|
|
201
|
+
/**
|
|
202
|
+
* Registers a HEAD route with the specified contract details and handler handlers.
|
|
203
|
+
*
|
|
204
|
+
* @template P - The type of request parameters.
|
|
205
|
+
* @template ResBodyMap - The type of response body.
|
|
206
|
+
* @template ReqBody - The type of request body.
|
|
207
|
+
* @template ReqQuery - The type of request query.
|
|
208
|
+
* @template LocalsObj - The type of local variables.
|
|
209
|
+
* @param {string} path - The path for the route.
|
|
210
|
+
* @param {PathParamHttpContractDetails<SV, P, ResBodyMap, ReqQuery>} contractDetails - The contract details.
|
|
211
|
+
* @param {...SchemaHandler<SV, P, ResBodyMap, ReqBody, ReqQuery, LocalsObj>[]} handlers - The handler handlers.
|
|
212
|
+
* @returns {ExpressRouter} - The Express router.
|
|
213
|
+
*/
|
|
214
|
+
head: LiveTypeRouteDefinition<SV, BasePath, 'head', RouterHandler, Internal, RouterSession, BaseRequest, BaseResponse, NextFunction, this>;
|
|
215
|
+
/**
|
|
216
|
+
* Registers a TRACE route with the specified contract details and handler handlers.
|
|
217
|
+
*
|
|
218
|
+
* @template P - The type of request parameters.
|
|
219
|
+
* @template ResBodyMap - The type of response body.
|
|
220
|
+
* @template ReqBody - The type of request body.
|
|
221
|
+
* @template ReqQuery - The type of request query.
|
|
222
|
+
* @template LocalsObj - The type of local variables.
|
|
223
|
+
* @param {string} path - The path for the route.
|
|
224
|
+
* @param {PathParamHttpContractDetails<SV, P, ResBodyMap, ReqQuery>} contractDetails - The contract details.
|
|
225
|
+
* @param {...SchemaHandler<SV, P, ResBodyMap, ReqBody, ReqQuery, LocalsObj>[]} handlers - The handler handlers.
|
|
226
|
+
* @returns {ExpressRouter} - The Express router.
|
|
227
|
+
*/
|
|
228
|
+
trace: LiveTypeRouteDefinition<SV, BasePath, 'trace', RouterHandler, Internal, RouterSession, BaseRequest, BaseResponse, NextFunction, this>;
|
|
229
|
+
insertIntoRouterSdkPaths({ sdkPath, path, method, name }: {
|
|
230
|
+
sdkPath: string;
|
|
231
|
+
name: string;
|
|
232
|
+
path: string;
|
|
233
|
+
method: string;
|
|
234
|
+
}): void;
|
|
235
|
+
private unpackSdks;
|
|
236
|
+
registerSdks(sdks: SdkHandlerObject<SV>): void;
|
|
237
|
+
protected cloneInternals(clone: this): void;
|
|
238
|
+
clone(): this;
|
|
239
|
+
}
|
|
240
|
+
//# sourceMappingURL=expressLikeRouter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expressLikeRouter.d.ts","sourceRoot":"","sources":["../../../src/http/router/expressLikeRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAmB,MAAM,uBAAuB,CAAC;AAG5E,OAAO,EACL,WAAW,EAEX,QAAQ,EACR,eAAe,EAGf,mBAAmB,EAIpB,MAAM,oBAAoB,CAAC;AAU5B,OAAO,EACL,iBAAiB,EACjB,0BAA0B,EAC1B,gBAAgB,EAChB,4BAA4B,EAC7B,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAEL,wBAAwB,EACxB,eAAe,EACf,gBAAgB,EAGjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,IAAI,EACJ,aAAa,EACb,MAAM,EAEN,YAAY,EAEZ,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,aAAa,EACd,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EACL,yCAAyC,EACzC,uBAAuB,EACvB,sCAAsC,EACtC,yBAAyB,EACzB,iCAAiC,EAClC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EACL,2BAA2B,EAC3B,eAAe,EACf,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AASrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,oB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,aAAa,EACb,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,IAAI,CACL,CAiFC;IAEF;;;;;;;;;;;;OAYG;IACH,IAAI,EAAE,uBAAuB,CAC3B,EAAE,EACF,QAAQ,EACR,MAAM,EACN,aAAa,EACb,QAAQ,EACR,aAAa,EACb,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,IAAI,CACL,CAiFC;IAEF;;;;;;;;;;;;OAYG;IACH,KAAK,EAAE,uBAAuB,CAC5B,EAAE,EACF,QAAQ,EACR,OAAO,EACP,aAAa,EACb,QAAQ,EACR,aAAa,EACb,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,IAAI,CACL,CAiFC;IAEF,wBAAwB,CAAC,EACvB,OAAO,EACP,IAAI,EACJ,MAAM,EACN,IAAI,EACL,EAAE;QACD,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;KAChB,QAoBA;IAED,OAAO,CAAC,UAAU;IA4BlB,YAAY,CAAC,IAAI,EAAE,gBAAgB,CAAC,EAAE,CAAC,QAEtC;IAED,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,CAM1C;IAED,KAAK,IAAI,IAAI,CAwBZ;CACF"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { AnySchemaValidator, SchemaValidator } from '@forklaunch/validator';
|
|
2
|
+
import { OpenTelemetryCollector } from '../telemetry/openTelemetryCollector';
|
|
3
|
+
import { ExpressLikeSchemaHandler } from '../types/apiDefinition.types';
|
|
4
|
+
import { Body, ContractDetails, HeadersObject, Method, ParamsObject, QueryObject, ResponseCompiledSchema, ResponsesObject, SchemaAuthMethods, SessionObject, VersionSchema } from '../types/contractDetails.types';
|
|
5
|
+
import { ExpressLikeRouterOptions } from '../types/expressLikeOptions';
|
|
6
|
+
import { ContractDetailsOrMiddlewareOrTypedHandler, MiddlewareOrMiddlewareWithTypedHandler } from '../types/expressLikeRouter.types';
|
|
7
|
+
import { MetricsDefinition } from '../types/openTelemetryCollector.types';
|
|
8
|
+
export declare function resolveContractDetailsAndHandlers<SV extends AnySchemaValidator, Name extends string, ContractMethod extends Method, Path extends `/${string}`, P extends ParamsObject<SV>, ResBodyMap extends ResponsesObject<SV>, ReqBody extends Body<SV>, ReqQuery extends QueryObject<SV>, ReqHeaders extends HeadersObject<SV>, ResHeaders extends HeadersObject<SV>, LocalsObj extends Record<string, unknown>, VersionedApi extends VersionSchema<SV, ContractMethod>, RouterSession extends SessionObject<SV>, BaseRequest, BaseResponse, NextFunction, Auth extends SchemaAuthMethods<SV, P, ReqBody, ReqQuery, ReqHeaders, VersionedApi, BaseRequest>>(contractDetailsOrMiddlewareOrTypedHandler: ContractDetailsOrMiddlewareOrTypedHandler<SV, Name, ContractMethod, Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, VersionedApi, BaseRequest, BaseResponse, NextFunction, RouterSession, Auth>, middlewareOrMiddlewareAndTypedHandler: MiddlewareOrMiddlewareWithTypedHandler<SV, Name, ContractMethod, Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, VersionedApi, BaseRequest, BaseResponse, NextFunction, RouterSession, Auth>[]): {
|
|
9
|
+
contractDetails: ContractDetails<SV, Name, ContractMethod, Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, VersionedApi, BaseRequest, Auth>;
|
|
10
|
+
handlers: ExpressLikeSchemaHandler<SV, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, VersionedApi, RouterSession, BaseRequest, BaseResponse, NextFunction>[];
|
|
11
|
+
};
|
|
12
|
+
export declare function validateContractDetails<SV extends AnySchemaValidator, Name extends string, ContractMethod extends Method, Path extends `/${string}`, P extends ParamsObject<SV>, ResBodyMap extends ResponsesObject<SV>, ReqBody extends Body<SV>, ReqQuery extends QueryObject<SV>, ReqHeaders extends HeadersObject<SV>, ResHeaders extends HeadersObject<SV>, VersionedApi extends VersionSchema<SV, ContractMethod>, BaseRequest, Auth extends SchemaAuthMethods<SV, P, ReqBody, ReqQuery, ReqHeaders, VersionedApi, BaseRequest>>(contractDetails: ContractDetails<SV, Name, ContractMethod, Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, VersionedApi, BaseRequest, Auth>, schemaValidator: SV): void;
|
|
13
|
+
export declare function processContractDetailsIO<SV extends AnySchemaValidator, P extends ParamsObject<SV>>(schemaValidator: SV & SchemaValidator, contractDetailsIO: {
|
|
14
|
+
requestHeaders?: HeadersObject<SV>;
|
|
15
|
+
responseHeaders?: HeadersObject<SV>;
|
|
16
|
+
query?: QueryObject<SV>;
|
|
17
|
+
body?: Body<SV>;
|
|
18
|
+
responses: ResponsesObject<SV>;
|
|
19
|
+
}, routeParams?: P): {
|
|
20
|
+
requestSchema: unknown;
|
|
21
|
+
responseSchemas: {
|
|
22
|
+
headers: unknown;
|
|
23
|
+
responses: {
|
|
24
|
+
[k: string]: unknown;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export declare function compileRouteSchemas<SV extends AnySchemaValidator, Name extends string, ContractMethod extends Method, Path extends `/${string}`, P extends ParamsObject<SV>, ResBodyMap extends ResponsesObject<SV>, ReqBody extends Body<SV>, ReqQuery extends QueryObject<SV>, ReqHeaders extends HeadersObject<SV>, ResHeaders extends HeadersObject<SV>, VersionedApi extends VersionSchema<SV, ContractMethod>, BaseRequest, Auth extends SchemaAuthMethods<SV, P, ReqBody, ReqQuery, ReqHeaders, VersionedApi, BaseRequest>>(contractDetails: ContractDetails<SV, Name, ContractMethod, Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, VersionedApi, BaseRequest, Auth>, schemaValidator: SV): {
|
|
29
|
+
requestSchema: unknown;
|
|
30
|
+
responseSchemas: Record<string, ResponseCompiledSchema> | ResponseCompiledSchema;
|
|
31
|
+
};
|
|
32
|
+
export declare function resolveRouteMiddlewares<SV extends AnySchemaValidator, Name extends string, ContractMethod extends Method, Path extends `/${string}`, P extends ParamsObject<SV>, ResBodyMap extends ResponsesObject<SV>, ReqBody extends Body<SV>, ReqQuery extends QueryObject<SV>, ReqHeaders extends HeadersObject<SV>, ResHeaders extends HeadersObject<SV>, LocalsObj extends Record<string, unknown>, VersionedApi extends VersionSchema<SV, ContractMethod>, RouterSession extends SessionObject<SV>, BaseRequest, BaseResponse, NextFunction, Auth extends SchemaAuthMethods<SV, P, ReqBody, ReqQuery, ReqHeaders, VersionedApi, BaseRequest>, RouterHandler>(params: {
|
|
33
|
+
basePath: string;
|
|
34
|
+
path: Path;
|
|
35
|
+
contractDetails: ContractDetails<SV, Name, ContractMethod, Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, VersionedApi, BaseRequest, Auth>;
|
|
36
|
+
requestSchema: unknown;
|
|
37
|
+
responseSchemas: ResponseCompiledSchema | Record<string, ResponseCompiledSchema>;
|
|
38
|
+
openTelemetryCollector?: OpenTelemetryCollector<MetricsDefinition>;
|
|
39
|
+
routerOptions?: ExpressLikeRouterOptions<SV, RouterSession>;
|
|
40
|
+
postEnrichMiddleware?: RouterHandler[];
|
|
41
|
+
includeCreateContext?: boolean;
|
|
42
|
+
handlers: ExpressLikeSchemaHandler<SV, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, VersionedApi, RouterSession, BaseRequest, BaseResponse, NextFunction>[];
|
|
43
|
+
router?: {
|
|
44
|
+
routerOptions?: ExpressLikeRouterOptions<SV, RouterSession>;
|
|
45
|
+
};
|
|
46
|
+
}): {
|
|
47
|
+
middlewares: RouterHandler[];
|
|
48
|
+
controllerHandler: ExpressLikeSchemaHandler<SV, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, VersionedApi, RouterSession, BaseRequest, BaseResponse, NextFunction>;
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=routerSharedLogic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routerSharedLogic.d.ts","sourceRoot":"","sources":["../../../src/http/router/routerSharedLogic.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAc5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,IAAI,EACJ,eAAe,EACf,aAAa,EAEb,MAAM,EAEN,YAAY,EAGZ,WAAW,EACX,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,aAAa,EACd,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EACL,yCAAyC,EACzC,sCAAsC,EACvC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAM1E,wBAAgB,iCAAiC,CAC/C,EAAE,SAAS,kBAAkB,EAC7B,IAAI,SAAS,MAAM,EACnB,cAAc,SAAS,MAAM,EAC7B,IAAI,SAAS,IAAI,MAAM,EAAE,EACzB,CAAC,SAAS,YAAY,CAAC,EAAE,CAAC,EAC1B,UAAU,SAAS,eAAe,CAAC,EAAE,CAAC,EACtC,OAAO,SAAS,IAAI,CAAC,EAAE,CAAC,EACxB,QAAQ,SAAS,WAAW,CAAC,EAAE,CAAC,EAChC,UAAU,SAAS,aAAa,CAAC,EAAE,CAAC,EACpC,UAAU,SAAS,aAAa,CAAC,EAAE,CAAC,EACpC,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzC,YAAY,SAAS,aAAa,CAAC,EAAE,EAAE,cAAc,CAAC,EACtD,aAAa,SAAS,aAAa,CAAC,EAAE,CAAC,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IAClE,sBAAsB,CAAC,EAAE,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;IACnE,aAAa,CAAC,EAAE,wBAAwB,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;IAC5D,oBAAoB,CAAC,EAAE,aAAa,EAAE,CAAC;IACvC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,EAAE,wBAAwB,CAChC,EAAE,EACF,CAAC,EACD,UAAU,EACV,OAAO,EACP,QAAQ,EACR,UAAU,EACV,UAAU,EACV,SAAS,EACT,YAAY,EACZ,aAAa,EACb,WAAW,EACX,YAAY,EACZ,YAAY,CACb,EAAE,CAAC;IACJ,MAAM,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,wBAAwB,CAAC,EAAE,EAAE,aAAa,CAAC,CAAA;KAAE,CAAC;CAC1E,GAAG;IACF,WAAW,EAAE,aAAa,EAAE,CAAC;IAC7B,iBAAiB,EAAE,wBAAwB,CACzC,EAAE,EACF,CAAC,EACD,UAAU,EACV,OAAO,EACP,QAAQ,EACR,UAAU,EACV,UAAU,EACV,SAAS,EACT,YAAY,EACZ,aAAa,EACb,WAAW,EACX,YAAY,EACZ,YAAY,CACb,CAAC;CACH,CAqEA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AnySchemaValidator } from '@forklaunch/validator';
|
|
2
|
+
import { ForklaunchRouter } from '../types/router.types';
|
|
3
|
+
export declare function unpackRouters<SV extends AnySchemaValidator>(routers: ForklaunchRouter<SV>[], recursiveBasePath?: string[]): {
|
|
4
|
+
fullPath: string;
|
|
5
|
+
router: ForklaunchRouter<SV>;
|
|
6
|
+
}[];
|
|
7
|
+
//# sourceMappingURL=unpackRouters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unpackRouters.d.ts","sourceRoot":"","sources":["../../../src/http/router/unpackRouters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,wBAAgB,aAAa,CAAC,EAAE,SAAS,kBAAkB,EACzD,OAAO,EAAE,gBAAgB,CAAC,EAAE,CAAC,EAAE,EAC/B,iBAAiB,GAAE,MAAM,EAAO,GAC/B;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,gBAAgB,CAAC,EAAE,CAAC,CAAC;CAC9B,EAAE,CAoBF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { MetricsDefinition } from '../types/openTelemetryCollector.types';
|
|
2
|
+
import { OpenTelemetryCollector } from './openTelemetryCollector';
|
|
3
|
+
export type AuditEntry = {
|
|
4
|
+
timestamp: string;
|
|
5
|
+
userId: string | null;
|
|
6
|
+
tenantId: string | null;
|
|
7
|
+
route: string;
|
|
8
|
+
method: string;
|
|
9
|
+
bodyHash: string;
|
|
10
|
+
status: number;
|
|
11
|
+
duration: number;
|
|
12
|
+
redactedFields: string[];
|
|
13
|
+
eventType: 'http' | 'ws' | 'auth_failure' | 'rate_limit' | 'rbac_deny' | 'super_admin_bypass';
|
|
14
|
+
};
|
|
15
|
+
export declare class AuditLogger {
|
|
16
|
+
_otel: OpenTelemetryCollector<MetricsDefinition>;
|
|
17
|
+
constructor(otel: OpenTelemetryCollector<MetricsDefinition>);
|
|
18
|
+
append(entry: AuditEntry): void;
|
|
19
|
+
static hashBody(body: string | Buffer | undefined | null): string;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=auditLogger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auditLogger.d.ts","sourceRoot":"","sources":["../../../src/http/telemetry/auditLogger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,SAAS,EACL,MAAM,GACN,IAAI,GACJ,cAAc,GACd,YAAY,GACZ,WAAW,GACX,oBAAoB,CAAC;CAC1B,CAAC;AAEF,qBAAa,WAAW;IACtB,KAAK,EAAE,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;IAEjD,YAAY,IAAI,EAAE,sBAAsB,CAAC,iBAAiB,CAAC,EAE1D;IAED,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAsB9B;IAED,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,CAKhE;CACF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ATTR_HTTP_REQUEST_METHOD, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_HTTP_ROUTE, ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
|
|
2
|
+
export declare const ATTR_API_NAME = "api.name";
|
|
3
|
+
export declare const ATTR_CORRELATION_ID = "correlation.id";
|
|
4
|
+
export declare const ATTR_APPLICATION_ID = "application_id";
|
|
5
|
+
export { ATTR_HTTP_REQUEST_METHOD, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_HTTP_ROUTE, ATTR_SERVICE_NAME };
|
|
6
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/http/telemetry/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,8BAA8B,EAC9B,eAAe,EACf,iBAAiB,EAClB,MAAM,qCAAqC,CAAC;AAE7C,eAAO,MAAM,aAAa,aAAa,CAAC;AACxC,eAAO,MAAM,mBAAmB,mBAAmB,CAAC;AACpD,eAAO,MAAM,mBAAmB,mBAAmB,CAAC;AAEpD,OAAO,EACL,wBAAwB,EACxB,8BAA8B,EAC9B,eAAe,EACf,iBAAiB,EAClB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LevelWithSilentOrString } from 'pino';
|
|
2
|
+
import { TelemetryOptions } from '../types/openTelemetryCollector.types';
|
|
3
|
+
export declare function evaluateTelemetryOptions(telemetryOptions: TelemetryOptions): {
|
|
4
|
+
enabled: {
|
|
5
|
+
metrics?: boolean;
|
|
6
|
+
tracing?: boolean;
|
|
7
|
+
logging?: boolean;
|
|
8
|
+
};
|
|
9
|
+
level: LevelWithSilentOrString;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=evaluateTelemetryOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluateTelemetryOptions.d.ts","sourceRoot":"","sources":["../../../src/http/telemetry/evaluateTelemetryOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAEzE,wBAAgB,wBAAwB,CAAC,gBAAgB,EAAE,gBAAgB,GAAG;IAC5E,OAAO,EAAE;QACP,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;IACF,KAAK,EAAE,uBAAuB,CAAC;CAChC,CAgBA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metricsDefinition.d.ts","sourceRoot":"","sources":["../../../src/http/telemetry/metricsDefinition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAE1E,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,iBAAiB,EAAE,OAAO,EAAE,CAAC,KAEzE"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Counter, Gauge, Histogram, ObservableCounter, ObservableGauge, ObservableUpDownCounter, UpDownCounter } from '@opentelemetry/api';
|
|
2
|
+
import { LevelWithSilent, LevelWithSilentOrString } from 'pino';
|
|
3
|
+
import { LogFn, LoggerMeta, MetricsDefinition, MetricType } from '../types/openTelemetryCollector.types';
|
|
4
|
+
import { PinoLogger } from './pinoLogger';
|
|
5
|
+
export declare class OpenTelemetryCollector<AppliedMetricsDefinition extends MetricsDefinition> {
|
|
6
|
+
_logger: PinoLogger;
|
|
7
|
+
_serviceName: string;
|
|
8
|
+
_metrics: Record<keyof AppliedMetricsDefinition, Counter | Gauge | Histogram | UpDownCounter | ObservableCounter | ObservableGauge | ObservableUpDownCounter>;
|
|
9
|
+
constructor(serviceName: string, level?: LevelWithSilentOrString, metricDefinitions?: AppliedMetricsDefinition);
|
|
10
|
+
log(level: LevelWithSilent, ...args: (string | unknown | LoggerMeta)[]): void;
|
|
11
|
+
info: LogFn;
|
|
12
|
+
error: LogFn;
|
|
13
|
+
warn: LogFn;
|
|
14
|
+
debug: LogFn;
|
|
15
|
+
trace: LogFn;
|
|
16
|
+
getMetric<T extends keyof AppliedMetricsDefinition>(metricId: T): MetricType<AppliedMetricsDefinition[T]>;
|
|
17
|
+
}
|
|
18
|
+
export declare const httpRequestsTotalCounter: Counter<{
|
|
19
|
+
"service.name": string;
|
|
20
|
+
application_id?: string;
|
|
21
|
+
"api.name": string;
|
|
22
|
+
"http.request.method": string;
|
|
23
|
+
"http.route": string;
|
|
24
|
+
"http.response.status_code": number;
|
|
25
|
+
}>;
|
|
26
|
+
export declare const httpServerDurationHistogram: Histogram<{
|
|
27
|
+
"service.name": string;
|
|
28
|
+
application_id?: string;
|
|
29
|
+
"api.name": string;
|
|
30
|
+
"http.request.method": string;
|
|
31
|
+
"http.route": string;
|
|
32
|
+
"http.response.status_code": number;
|
|
33
|
+
}>;
|
|
34
|
+
export declare const httpRequestDurationMsHistogram: Histogram<{
|
|
35
|
+
"service.name": string;
|
|
36
|
+
application_id?: string;
|
|
37
|
+
"api.name": string;
|
|
38
|
+
"http.request.method": string;
|
|
39
|
+
"http.route": string;
|
|
40
|
+
"http.response.status_code": number;
|
|
41
|
+
}>;
|
|
42
|
+
export declare const httpErrorsTotalCounter: Counter<{
|
|
43
|
+
"service.name": string;
|
|
44
|
+
application_id?: string;
|
|
45
|
+
"api.name": string;
|
|
46
|
+
"http.request.method": string;
|
|
47
|
+
"http.route": string;
|
|
48
|
+
"http.response.status_code": number;
|
|
49
|
+
}>;
|
|
50
|
+
export declare const httpRequestsInFlightCounter: UpDownCounter<{
|
|
51
|
+
"service.name": string;
|
|
52
|
+
}>;
|
|
53
|
+
//# sourceMappingURL=openTelemetryCollector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openTelemetryCollector.d.ts","sourceRoot":"","sources":["../../../src/http/telemetry/openTelemetryCollector.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,OAAO,EACP,KAAK,EACL,SAAS,EAET,iBAAiB,EACjB,eAAe,EACf,uBAAuB,EACvB,aAAa,EACd,MAAM,oBAAoB,CAAC;AAiB5B,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,MAAM,CAAC;AAEhE,OAAO,EACL,KAAK,EACL,UAAU,EACV,iBAAiB,EACjB,UAAU,EACX,MAAM,uCAAuC,CAAC;AAM/C,OAAO,EAAU,UAAU,EAAE,MAAM,cAAc,CAAC;AAElD,qBAAa,sBAAsB,CACjC,wBAAwB,SAAS,iBAAiB;IAElD,OAAO,EAAE,UAAU,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAA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entOrString, Logger } from 'pino';
|
|
3
|
+
import { LogFn, LoggerMeta } from '../types/openTelemetryCollector.types';
|
|
4
|
+
export type { LevelWithSilent, LevelWithSilentOrString, Logger };
|
|
5
|
+
export declare function meta(meta: Record<string, unknown>): LoggerMeta;
|
|
6
|
+
export declare class PinoLogger {
|
|
7
|
+
_pinoLogger: Logger;
|
|
8
|
+
_meta: AnyValueMap;
|
|
9
|
+
constructor(level: LevelWithSilentOrString, meta?: AnyValueMap);
|
|
10
|
+
log(level: LevelWithSilent, ...args: (string | unknown | LoggerMeta)[]): void;
|
|
11
|
+
error: LogFn;
|
|
12
|
+
info: LogFn;
|
|
13
|
+
debug: LogFn;
|
|
14
|
+
warn: LogFn;
|
|
15
|
+
trace: LogFn;
|
|
16
|
+
child(meta?: AnyValueMap): PinoLogger;
|
|
17
|
+
getBaseLogger(): Logger;
|
|
18
|
+
}
|
|
19
|
+
export declare function logger(level: LevelWithSilentOrString, meta?: AnyValueMap): PinoLogger;
|
|
20
|
+
//# sourceMappingURL=pinoLogger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pinoLogger.d.ts","sourceRoot":"","sources":["../../../src/http/telemetry/pinoLogger.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAQ,MAAM,yBAAyB,CAAC;AAC5D,OAAa,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9E,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAE1E,YAAY,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,EAAE,CAAC;AAEjE,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,UAAU,CAC1B;AAqGD,qBAAa,UAAU;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,WAAW,CAAC;IAEnB,YAAY,KAAK,EAAE,uBAAuB,EAAE,IAAI,GAAE,WAAgB,EAoBjE;IAED,GAAG,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,IAAI,EAAE,CAAC,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC,EAAE,QAmDrE;IAED,KAAK,EAAE,KAAK,CAGyB;IAErC,IAAI,EAAE,KAAK,CAGyB;IAEpC,KAAK,EAAE,KAAK,CAGyB;IACrC,IAAI,EAAE,KAAK,CAGyB;IAEpC,KAAK,EAAE,KAAK,CAGyB;IAErC,KAAK,CAAC,IAAI,GAAE,WAAgB,cAE3B;IAED,aAAa,WAEZ;CACF;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,uBAAuB,EAAE,IAAI,GAAE,WAAgB,cAE5E"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AnySchemaValidator } from '@forklaunch/validator';
|
|
2
|
+
import { ParsedQs } from 'qs';
|
|
3
|
+
import { ForklaunchRequest, ForklaunchResponse, ParamsDictionary, VersionedRequests } from '..';
|
|
4
|
+
export 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;
|
|
5
|
+
//# sourceMappingURL=recordMetric.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recordMetric.d.ts","sourceRoot":"","sources":["../../../src/http/telemetry/recordMetric.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAO3D,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,IAAI,CAAC;AAQZ,wBAAgB,YAAY,CAC1B,EAAE,SAAS,kBAAkB,EAC7B,CAAC,SAAS,gBAAgB,EAC1B,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvC,QAAQ,SAAS,QAAQ,EACzB,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1C,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACzC,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1C,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzC,aAAa,SAAS,iBAAiB,EACvC,aAAa,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAE7C,GAAG,EAAE,iBAAiB,CACpB,EAAE,EACF,CAAC,EACD,OAAO,EACP,QAAQ,EACR,UAAU,EACV,OAAO,CAAC,MAAM,aAAa,EAAE,MAAM,CAAC,EACpC,aAAa,CACd,EACD,GAAG,EAAE,kBAAkB,CACrB,OAAO,EACP,UAAU,EACV,UAAU,EACV,SAAS,EACT,OAAO,CAAC,MAAM,aAAa,EAAE,MAAM,CAAC,CACrC,QA6BF"}
|