/*! * Copyright 2020, OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { Request } from 'express'; import { LayerPath, ExpressLayersStore } from './runtime-layer'; /** * This const define where on the `request` object the plugin will mount the * current stack of express layer. * * It is necessary because express doesnt store the different layers * (ie: middleware, router etc) that it called to get to the current layer. * Given that, the only way to know the route of a given layer is to * store the path of where each previous layer has been mounted. * * ex: bodyParser > auth middleware > /users router > get /:id * in this case the stack would be: ["/users", "/:id"] * * ex2: bodyParser > /api router > /v1 router > /users router > get /:id * stack: ["/api", "/v1", "/users", ":id"] * */ export declare const _ASPECTO_LAYERS_STORE_PROPERTY = "__aspecto_layers_store"; export declare const _ASPECTO_PATH_STORE_PROPERTY: unique symbol; export declare type Parameters = T extends (...args: infer T) => any ? T : unknown[]; export declare type PatchedRequest = { [_ASPECTO_LAYERS_STORE_PROPERTY]?: ExpressLayersStore; } & Request; export declare type PathParams = string | RegExp | Array; export declare type ExpressRouter = { params: { [key: string]: string; }; _params: string[]; caseSensitive: boolean; mergeParams: boolean; strict: boolean; stack: ExpressLayer[]; }; export declare type ExpressLayer = { handle: Function; [_ASPECTO_PATH_STORE_PROPERTY]?: LayerPath; name: string; params: { [key: string]: string; }; path: string; regexp: RegExp; }; //# sourceMappingURL=types.d.ts.map