express-yaschema-api-handler
Advanced tools
Comparing version 2.5.0 to 2.6.0
@@ -17,7 +17,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./http-api-handler-wrapper"), exports); | ||
__exportStar(require("./logging"), exports); | ||
__exportStar(require("./on-request-validation-error"), exports); | ||
__exportStar(require("./on-response-validation-error"), exports); | ||
__exportStar(require("./validation-mode"), exports); | ||
__exportStar(require("./http-api-handler-wrapper.js"), exports); | ||
__exportStar(require("./logging.js"), exports); | ||
__exportStar(require("./on-request-validation-error.js"), exports); | ||
__exportStar(require("./on-response-validation-error.js"), exports); | ||
__exportStar(require("./validation-mode.js"), exports); | ||
//# sourceMappingURL=exports.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isUnsupportedHttpMethod = void 0; | ||
const express_handlers_by_http_method_1 = require("../internal-consts/express-handlers-by-http-method"); | ||
const isUnsupportedHttpMethod = (method) => express_handlers_by_http_method_1.unsupportedHttpMethods.has(method); | ||
const express_handlers_by_http_method_js_1 = require("../internal-consts/express-handlers-by-http-method.js"); | ||
const isUnsupportedHttpMethod = (method) => express_handlers_by_http_method_js_1.unsupportedHttpMethods.has(method); | ||
exports.isUnsupportedHttpMethod = isUnsupportedHttpMethod; | ||
//# sourceMappingURL=is-unsupported-http-method.js.map |
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.acceptFilesMiddlewares = void 0; | ||
const http_status_codes_1 = __importDefault(require("http-status-codes")); | ||
const http_status_codes_1 = require("http-status-codes"); | ||
const multer_1 = __importDefault(require("multer")); | ||
@@ -22,3 +22,3 @@ const acceptFilesMiddlewares = (maxCountsByField, multerOptions) => [ | ||
else if (typeof req.body !== 'object') { | ||
res.status(http_status_codes_1.default.INTERNAL_SERVER_ERROR).send('Internal server error'); | ||
res.status(http_status_codes_1.StatusCodes.INTERNAL_SERVER_ERROR).send('Internal server error'); | ||
return; | ||
@@ -25,0 +25,0 @@ } |
@@ -17,3 +17,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./accept-files-middlewares"), exports); | ||
__exportStar(require("./accept-files-middlewares.js"), exports); | ||
//# sourceMappingURL=exports.js.map |
@@ -17,3 +17,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./register-api-handler"), exports); | ||
__exportStar(require("./register-api-handler.js"), exports); | ||
//# sourceMappingURL=exports.js.map |
@@ -5,3 +5,3 @@ "use strict"; | ||
const yaschema_api_1 = require("yaschema-api"); | ||
const logging_1 = require("../config/logging"); | ||
const logging_js_1 = require("../config/logging.js"); | ||
let globalPendingApiRegistrations = {}; | ||
@@ -23,3 +23,3 @@ const globalRegisteredApis = new Set(); | ||
} | ||
(_b = (_a = (0, logging_1.getLogger)())[logLevel]) === null || _b === void 0 ? void 0 : _b.call(_a, `API handler missing for`, api.name); | ||
(_b = (_a = (0, logging_js_1.getLogger)())[logLevel]) === null || _b === void 0 ? void 0 : _b.call(_a, `API handler missing for`, api.name); | ||
} | ||
@@ -38,3 +38,3 @@ } | ||
for (const key of keys) { | ||
(_b = (_a = (0, logging_1.getLogger)()).info) === null || _b === void 0 ? void 0 : _b.call(_a, `Registering API handler for ${pendingApiRegistrations[key].api.name}`); | ||
(_b = (_a = (0, logging_js_1.getLogger)()).info) === null || _b === void 0 ? void 0 : _b.call(_a, `Registering API handler for ${pendingApiRegistrations[key].api.name}`); | ||
pendingApiRegistrations[key].finalizer(); | ||
@@ -41,0 +41,0 @@ } |
@@ -17,3 +17,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./register-http-api-handler"), exports); | ||
__exportStar(require("./register-http-api-handler.js"), exports); | ||
//# sourceMappingURL=exports.js.map |
@@ -16,12 +16,12 @@ "use strict"; | ||
const yaschema_api_1 = require("yaschema-api"); | ||
const http_api_handler_wrapper_1 = require("../config/http-api-handler-wrapper"); | ||
const on_request_validation_error_1 = require("../config/on-request-validation-error"); | ||
const on_response_validation_error_1 = require("../config/on-response-validation-error"); | ||
const validation_mode_1 = require("../config/validation-mode"); | ||
const express_handlers_by_http_method_1 = require("../internal-consts/express-handlers-by-http-method"); | ||
const convert_yaschema_param_syntax_for_express_1 = require("../internal-utils/convert-yaschema-param-syntax-for-express"); | ||
const get_url_pathname_1 = require("../internal-utils/get-url-pathname"); | ||
const is_unsupported_http_method_1 = require("../internal-utils/is-unsupported-http-method"); | ||
const resolve_special_form_data_fields_1 = require("../internal-utils/resolve-special-form-data-fields"); | ||
const register_api_handler_1 = require("../register-api-handler/register-api-handler"); | ||
const http_api_handler_wrapper_js_1 = require("../config/http-api-handler-wrapper.js"); | ||
const on_request_validation_error_js_1 = require("../config/on-request-validation-error.js"); | ||
const on_response_validation_error_js_1 = require("../config/on-response-validation-error.js"); | ||
const validation_mode_js_1 = require("../config/validation-mode.js"); | ||
const express_handlers_by_http_method_js_1 = require("../internal-consts/express-handlers-by-http-method.js"); | ||
const convert_yaschema_param_syntax_for_express_js_1 = require("../internal-utils/convert-yaschema-param-syntax-for-express.js"); | ||
const get_url_pathname_js_1 = require("../internal-utils/get-url-pathname.js"); | ||
const is_unsupported_http_method_js_1 = require("../internal-utils/is-unsupported-http-method.js"); | ||
const resolve_special_form_data_fields_js_1 = require("../internal-utils/resolve-special-form-data-fields.js"); | ||
const register_api_handler_js_1 = require("../register-api-handler/register-api-handler.js"); | ||
const anyStringSerializableTypeSchema = yaschema_1.schema.oneOf3(yaschema_1.schema.number().setAllowedSerializationForms(['number', 'string']), yaschema_1.schema.boolean().setAllowedSerializationForms(['boolean', 'string']), yaschema_1.schema.string().allowEmptyString()); | ||
@@ -38,3 +38,3 @@ const anyReqHeadersSchema = yaschema_1.schema.record(yaschema_1.schema.string(), anyStringSerializableTypeSchema).optional(); | ||
/** Be sure to call `finalizeApiHandlerRegistrations` once all API registrations have been added. */ | ||
const registerHttpApiHandler = (app, api, { requestValidationMode = (0, validation_mode_1.getDefaultRequestValidationMode)(), responseValidationMode = (0, validation_mode_1.getDefaultResponseValidationMode)(), middlewares = [] }, handler) => { | ||
const registerHttpApiHandler = (app, api, { requestValidationMode = (0, validation_mode_js_1.getDefaultRequestValidationMode)(), responseValidationMode = (0, validation_mode_js_1.getDefaultResponseValidationMode)(), middlewares = [] }, handler) => { | ||
const expressHandler = (req, res, next) => __awaiter(void 0, void 0, void 0, function* () { | ||
@@ -46,3 +46,3 @@ var _a, _b, _c, _d, _e; | ||
// In-place substitution of prefixed JSON strings with their resolved values | ||
(0, resolve_special_form_data_fields_1.resolveSpecialFormDataFields)(req.body); | ||
(0, resolve_special_form_data_fields_js_1.resolveSpecialFormDataFields)(req.body); | ||
} | ||
@@ -64,3 +64,3 @@ const [reqHeaders, reqParams, reqQuery, reqBody] = yield Promise.all([ | ||
if (!checkedRequestValidation.ok || checkedRequestValidation.hadSoftValidationError) { | ||
(0, on_request_validation_error_1.triggerOnRequestValidationErrorHandler)({ | ||
(0, on_request_validation_error_js_1.triggerOnRequestValidationErrorHandler)({ | ||
api: api, | ||
@@ -89,4 +89,4 @@ req: { | ||
let alreadyOutput = false; | ||
const makeOutputHandler = (schemas) => (status_1, _f) => __awaiter(void 0, [status_1, _f], void 0, function* (status, { headers, body }) { | ||
var _g, _h, _j, _k, _l; | ||
const makeOutputHandler = (schemas) => (status_1, _a) => __awaiter(void 0, [status_1, _a], void 0, function* (status, { headers, body }) { | ||
var _b, _c, _d, _e, _f; | ||
if (alreadyOutput) { | ||
@@ -98,7 +98,7 @@ console.warn('Multiple outputs attempted for', req.url); | ||
const [resStatus, resHeaders, resBody] = yield Promise.all([ | ||
((_g = schemas.status) !== null && _g !== void 0 ? _g : anyResStatusSchema).serializeAsync(status, { validation: responseValidationMode }), | ||
((_h = schemas.headers) !== null && _h !== void 0 ? _h : anyResHeadersSchema).serializeAsync((headers !== null && headers !== void 0 ? headers : {}), { | ||
((_b = schemas.status) !== null && _b !== void 0 ? _b : anyResStatusSchema).serializeAsync(status, { validation: responseValidationMode }), | ||
((_c = schemas.headers) !== null && _c !== void 0 ? _c : anyResHeadersSchema).serializeAsync((headers !== null && headers !== void 0 ? headers : {}), { | ||
validation: responseValidationMode | ||
}), | ||
((_j = schemas.body) !== null && _j !== void 0 ? _j : anyResBodySchema).serializeAsync(body, { validation: responseValidationMode }) | ||
((_d = schemas.body) !== null && _d !== void 0 ? _d : anyResBodySchema).serializeAsync(body, { validation: responseValidationMode }) | ||
]); | ||
@@ -113,3 +113,3 @@ if (responseValidationMode !== 'none') { | ||
if (!checkedResponseValidation.ok || checkedResponseValidation.hadSoftValidationError) { | ||
(0, on_response_validation_error_1.triggerOnResponseValidationErrorHandler)({ | ||
(0, on_response_validation_error_js_1.triggerOnResponseValidationErrorHandler)({ | ||
api: api, | ||
@@ -134,6 +134,6 @@ req: { | ||
res.setHeader('Content-Type', 'application/json'); | ||
const cachePolicy = (_k = api.cachePolicy) !== null && _k !== void 0 ? _k : { canCache: false }; | ||
const cachePolicy = (_e = api.cachePolicy) !== null && _e !== void 0 ? _e : { canCache: false }; | ||
if (cachePolicy !== 'dynamic' && cachePolicy.canCache !== false) { | ||
const cacheIntervalSec = Math.floor(cachePolicy.cacheIntervalSec); | ||
res.setHeader('Cache-Control', `${cachePolicy.canCache === 'public' ? 'public' : 'private'}, ${((_l = cachePolicy.mustRevalidate) !== null && _l !== void 0 ? _l : false) ? 'must-revalidate' : 'immutable'}, max-age=${cacheIntervalSec}, min-fresh=${cacheIntervalSec}`); | ||
res.setHeader('Cache-Control', `${cachePolicy.canCache === 'public' ? 'public' : 'private'}, ${((_f = cachePolicy.mustRevalidate) !== null && _f !== void 0 ? _f : false) ? 'must-revalidate' : 'immutable'}, max-age=${cacheIntervalSec}, min-fresh=${cacheIntervalSec}`); | ||
} | ||
@@ -156,14 +156,14 @@ const serializedResHeaders = resHeaders.serialized; | ||
}); | ||
if ((0, is_unsupported_http_method_1.isUnsupportedHttpMethod)(api.method)) { | ||
if ((0, is_unsupported_http_method_js_1.isUnsupportedHttpMethod)(api.method)) { | ||
throw new Error(`Unsupported HTTP method (${api.method}) encountered for ${api.url}`); | ||
} | ||
// Note: this strips any host-related info and doesn't check whether this server is the "right" server to handle these requests | ||
const relativizedUrl = (0, get_url_pathname_1.getUrlPathnameUsingRouteType)(api.routeType, api.url); | ||
const methodName = express_handlers_by_http_method_1.expressHandlersByHttpMethod[api.method]; | ||
const asyncHandlerWrapper = (0, http_api_handler_wrapper_1.getHttpApiHandlerWrapper)(); | ||
const relativizedUrl = (0, get_url_pathname_js_1.getUrlPathnameUsingRouteType)(api.routeType, api.url); | ||
const methodName = express_handlers_by_http_method_js_1.expressHandlersByHttpMethod[api.method]; | ||
const asyncHandlerWrapper = (0, http_api_handler_wrapper_js_1.getHttpApiHandlerWrapper)(); | ||
const handlers = [...middlewares, asyncHandlerWrapper(expressHandler)]; | ||
// Delaying the actual registration with Express slightly so we can re-order the registrations to be handled in the correct order (e.g. | ||
// longer exact matches first) | ||
(0, register_api_handler_1.registerApiHandler)(api, 'http', methodName, relativizedUrl, () => { | ||
app[methodName]((0, convert_yaschema_param_syntax_for_express_1.convertYaschemaParamSyntaxForExpress)(relativizedUrl), ...handlers); | ||
(0, register_api_handler_js_1.registerApiHandler)(api, 'http', methodName, relativizedUrl, () => { | ||
app[methodName]((0, convert_yaschema_param_syntax_for_express_js_1.convertYaschemaParamSyntaxForExpress)(relativizedUrl), ...handlers); | ||
}); | ||
@@ -170,0 +170,0 @@ }; |
@@ -17,5 +17,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./HttpApiHandler"), exports); | ||
__exportStar(require("./HttpApiHandlerArgs"), exports); | ||
__exportStar(require("./HttpApiHandlerOptions"), exports); | ||
__exportStar(require("./HttpApiHandler.js"), exports); | ||
__exportStar(require("./HttpApiHandlerArgs.js"), exports); | ||
__exportStar(require("./HttpApiHandlerOptions.js"), exports); | ||
//# sourceMappingURL=exports.js.map |
@@ -1,6 +0,6 @@ | ||
export * from './http-api-handler-wrapper'; | ||
export * from './logging'; | ||
export * from './on-request-validation-error'; | ||
export * from './on-response-validation-error'; | ||
export * from './validation-mode'; | ||
export * from './http-api-handler-wrapper.js'; | ||
export * from './logging.js'; | ||
export * from './on-request-validation-error.js'; | ||
export * from './on-response-validation-error.js'; | ||
export * from './validation-mode.js'; | ||
//# sourceMappingURL=exports.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export * from './accept-files-middlewares'; | ||
export * from './accept-files-middlewares.js'; | ||
//# sourceMappingURL=exports.d.ts.map |
@@ -1,6 +0,6 @@ | ||
export * from './http-api-handler-wrapper'; | ||
export * from './logging'; | ||
export * from './on-request-validation-error'; | ||
export * from './on-response-validation-error'; | ||
export * from './validation-mode'; | ||
export * from './http-api-handler-wrapper.js'; | ||
export * from './logging.js'; | ||
export * from './on-request-validation-error.js'; | ||
export * from './on-response-validation-error.js'; | ||
export * from './validation-mode.js'; | ||
//# sourceMappingURL=exports.js.map |
@@ -1,3 +0,3 @@ | ||
import { unsupportedHttpMethods } from '../internal-consts/express-handlers-by-http-method'; | ||
import { unsupportedHttpMethods } from '../internal-consts/express-handlers-by-http-method.js'; | ||
export const isUnsupportedHttpMethod = (method) => unsupportedHttpMethods.has(method); | ||
//# sourceMappingURL=is-unsupported-http-method.js.map |
@@ -1,2 +0,2 @@ | ||
import HttpStatusCodes from 'http-status-codes'; | ||
import { StatusCodes } from 'http-status-codes'; | ||
import multer from 'multer'; | ||
@@ -14,3 +14,3 @@ export const acceptFilesMiddlewares = (maxCountsByField, multerOptions) => [ | ||
else if (typeof req.body !== 'object') { | ||
res.status(HttpStatusCodes.INTERNAL_SERVER_ERROR).send('Internal server error'); | ||
res.status(StatusCodes.INTERNAL_SERVER_ERROR).send('Internal server error'); | ||
return; | ||
@@ -17,0 +17,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export * from './accept-files-middlewares'; | ||
export * from './accept-files-middlewares.js'; | ||
//# sourceMappingURL=exports.js.map |
@@ -1,2 +0,2 @@ | ||
export * from './register-api-handler'; | ||
export * from './register-api-handler.js'; | ||
//# sourceMappingURL=exports.js.map |
import { findAllApisInRoot } from 'yaschema-api'; | ||
import { getLogger } from '../config/logging'; | ||
import { getLogger } from '../config/logging.js'; | ||
let globalPendingApiRegistrations = {}; | ||
@@ -4,0 +4,0 @@ const globalRegisteredApis = new Set(); |
@@ -1,2 +0,2 @@ | ||
export * from './register-http-api-handler'; | ||
export * from './register-http-api-handler.js'; | ||
//# sourceMappingURL=exports.js.map |
@@ -13,12 +13,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { checkRequestValidation, checkResponseValidation } from 'yaschema-api'; | ||
import { getHttpApiHandlerWrapper } from '../config/http-api-handler-wrapper'; | ||
import { triggerOnRequestValidationErrorHandler } from '../config/on-request-validation-error'; | ||
import { triggerOnResponseValidationErrorHandler } from '../config/on-response-validation-error'; | ||
import { getDefaultRequestValidationMode, getDefaultResponseValidationMode } from '../config/validation-mode'; | ||
import { expressHandlersByHttpMethod } from '../internal-consts/express-handlers-by-http-method'; | ||
import { convertYaschemaParamSyntaxForExpress } from '../internal-utils/convert-yaschema-param-syntax-for-express'; | ||
import { getUrlPathnameUsingRouteType } from '../internal-utils/get-url-pathname'; | ||
import { isUnsupportedHttpMethod } from '../internal-utils/is-unsupported-http-method'; | ||
import { resolveSpecialFormDataFields } from '../internal-utils/resolve-special-form-data-fields'; | ||
import { registerApiHandler } from '../register-api-handler/register-api-handler'; | ||
import { getHttpApiHandlerWrapper } from '../config/http-api-handler-wrapper.js'; | ||
import { triggerOnRequestValidationErrorHandler } from '../config/on-request-validation-error.js'; | ||
import { triggerOnResponseValidationErrorHandler } from '../config/on-response-validation-error.js'; | ||
import { getDefaultRequestValidationMode, getDefaultResponseValidationMode } from '../config/validation-mode.js'; | ||
import { expressHandlersByHttpMethod } from '../internal-consts/express-handlers-by-http-method.js'; | ||
import { convertYaschemaParamSyntaxForExpress } from '../internal-utils/convert-yaschema-param-syntax-for-express.js'; | ||
import { getUrlPathnameUsingRouteType } from '../internal-utils/get-url-pathname.js'; | ||
import { isUnsupportedHttpMethod } from '../internal-utils/is-unsupported-http-method.js'; | ||
import { resolveSpecialFormDataFields } from '../internal-utils/resolve-special-form-data-fields.js'; | ||
import { registerApiHandler } from '../register-api-handler/register-api-handler.js'; | ||
const anyStringSerializableTypeSchema = schema.oneOf3(schema.number().setAllowedSerializationForms(['number', 'string']), schema.boolean().setAllowedSerializationForms(['boolean', 'string']), schema.string().allowEmptyString()); | ||
@@ -83,4 +83,4 @@ const anyReqHeadersSchema = schema.record(schema.string(), anyStringSerializableTypeSchema).optional(); | ||
let alreadyOutput = false; | ||
const makeOutputHandler = (schemas) => (status_1, _f) => __awaiter(void 0, [status_1, _f], void 0, function* (status, { headers, body }) { | ||
var _g, _h, _j, _k, _l; | ||
const makeOutputHandler = (schemas) => (status_1, _a) => __awaiter(void 0, [status_1, _a], void 0, function* (status, { headers, body }) { | ||
var _b, _c, _d, _e, _f; | ||
if (alreadyOutput) { | ||
@@ -92,7 +92,7 @@ console.warn('Multiple outputs attempted for', req.url); | ||
const [resStatus, resHeaders, resBody] = yield Promise.all([ | ||
((_g = schemas.status) !== null && _g !== void 0 ? _g : anyResStatusSchema).serializeAsync(status, { validation: responseValidationMode }), | ||
((_h = schemas.headers) !== null && _h !== void 0 ? _h : anyResHeadersSchema).serializeAsync((headers !== null && headers !== void 0 ? headers : {}), { | ||
((_b = schemas.status) !== null && _b !== void 0 ? _b : anyResStatusSchema).serializeAsync(status, { validation: responseValidationMode }), | ||
((_c = schemas.headers) !== null && _c !== void 0 ? _c : anyResHeadersSchema).serializeAsync((headers !== null && headers !== void 0 ? headers : {}), { | ||
validation: responseValidationMode | ||
}), | ||
((_j = schemas.body) !== null && _j !== void 0 ? _j : anyResBodySchema).serializeAsync(body, { validation: responseValidationMode }) | ||
((_d = schemas.body) !== null && _d !== void 0 ? _d : anyResBodySchema).serializeAsync(body, { validation: responseValidationMode }) | ||
]); | ||
@@ -127,6 +127,6 @@ if (responseValidationMode !== 'none') { | ||
res.setHeader('Content-Type', 'application/json'); | ||
const cachePolicy = (_k = api.cachePolicy) !== null && _k !== void 0 ? _k : { canCache: false }; | ||
const cachePolicy = (_e = api.cachePolicy) !== null && _e !== void 0 ? _e : { canCache: false }; | ||
if (cachePolicy !== 'dynamic' && cachePolicy.canCache !== false) { | ||
const cacheIntervalSec = Math.floor(cachePolicy.cacheIntervalSec); | ||
res.setHeader('Cache-Control', `${cachePolicy.canCache === 'public' ? 'public' : 'private'}, ${((_l = cachePolicy.mustRevalidate) !== null && _l !== void 0 ? _l : false) ? 'must-revalidate' : 'immutable'}, max-age=${cacheIntervalSec}, min-fresh=${cacheIntervalSec}`); | ||
res.setHeader('Cache-Control', `${cachePolicy.canCache === 'public' ? 'public' : 'private'}, ${((_f = cachePolicy.mustRevalidate) !== null && _f !== void 0 ? _f : false) ? 'must-revalidate' : 'immutable'}, max-age=${cacheIntervalSec}, min-fresh=${cacheIntervalSec}`); | ||
} | ||
@@ -133,0 +133,0 @@ const serializedResHeaders = resHeaders.serialized; |
@@ -1,4 +0,4 @@ | ||
export * from './HttpApiHandler'; | ||
export * from './HttpApiHandlerArgs'; | ||
export * from './HttpApiHandlerOptions'; | ||
export * from './HttpApiHandler.js'; | ||
export * from './HttpApiHandlerArgs.js'; | ||
export * from './HttpApiHandlerOptions.js'; | ||
//# sourceMappingURL=exports.js.map |
@@ -1,2 +0,2 @@ | ||
export * from './register-api-handler'; | ||
export * from './register-api-handler.js'; | ||
//# sourceMappingURL=exports.d.ts.map |
@@ -12,8 +12,8 @@ import type { Api } from 'yaschema-api'; | ||
export declare const finalizeApiHandlerRegistrations: ({ detectMissingApiHandlersInApiRoots, missingApiHandlerLogLevel, ignoreMissingApisForRouteTypes, ignoreMissingApis }?: { | ||
detectMissingApiHandlersInApiRoots?: any[] | undefined; | ||
missingApiHandlerLogLevel?: keyof Logger | undefined; | ||
ignoreMissingApisForRouteTypes?: string[] | undefined; | ||
ignoreMissingApis?: Api[] | undefined; | ||
detectMissingApiHandlersInApiRoots?: any[]; | ||
missingApiHandlerLogLevel?: keyof Logger; | ||
ignoreMissingApisForRouteTypes?: string[]; | ||
ignoreMissingApis?: Api[]; | ||
}) => void; | ||
export declare const registerApiHandler: (api: Api, protocol: string, methodName: string | undefined, relativeUrl: string, finalizer: () => void) => void; | ||
//# sourceMappingURL=register-api-handler.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export * from './register-http-api-handler'; | ||
export * from './register-http-api-handler.js'; | ||
//# sourceMappingURL=exports.d.ts.map |
import type { Express } from 'express'; | ||
import type { AnyHeaders, AnyParams, AnyQuery, HttpApi } from 'yaschema-api'; | ||
import type { AnyHeaders, AnyParams, AnyQuery, AnyStatus, HttpApi } from 'yaschema-api'; | ||
import type { HttpApiHandler } from '../types/HttpApiHandler'; | ||
import type { HttpApiHandlerOptions } from '../types/HttpApiHandlerOptions'; | ||
/** Be sure to call `finalizeApiHandlerRegistrations` once all API registrations have been added. */ | ||
export declare const registerHttpApiHandler: <ReqHeadersT extends AnyHeaders, ReqParamsT extends AnyParams, ReqQueryT extends AnyQuery, ReqBodyT extends unknown, ResStatusT extends number, ResHeadersT extends AnyHeaders, ResBodyT extends unknown, ErrResStatusT extends number, ErrResHeadersT extends AnyHeaders, ErrResBodyT extends unknown>(app: Express, api: HttpApi<ReqHeadersT, ReqParamsT, ReqQueryT, ReqBodyT, ResStatusT, ResHeadersT, ResBodyT, ErrResStatusT, ErrResHeadersT, ErrResBodyT>, { requestValidationMode, responseValidationMode, middlewares }: HttpApiHandlerOptions, handler: HttpApiHandler<ReqHeadersT, ReqParamsT, ReqQueryT, ReqBodyT, ResStatusT, ResHeadersT, ResBodyT, ErrResStatusT, ErrResHeadersT, ErrResBodyT>) => void; | ||
export declare const registerHttpApiHandler: <ReqHeadersT extends AnyHeaders, ReqParamsT extends AnyParams, ReqQueryT extends AnyQuery, ReqBodyT extends unknown, ResStatusT extends AnyStatus, ResHeadersT extends AnyHeaders, ResBodyT extends unknown, ErrResStatusT extends AnyStatus, ErrResHeadersT extends AnyHeaders, ErrResBodyT extends unknown>(app: Express, api: HttpApi<ReqHeadersT, ReqParamsT, ReqQueryT, ReqBodyT, ResStatusT, ResHeadersT, ResBodyT, ErrResStatusT, ErrResHeadersT, ErrResBodyT>, { requestValidationMode, responseValidationMode, middlewares }: HttpApiHandlerOptions, handler: HttpApiHandler<ReqHeadersT, ReqParamsT, ReqQueryT, ReqBodyT, ResStatusT, ResHeadersT, ResBodyT, ErrResStatusT, ErrResHeadersT, ErrResBodyT>) => void; | ||
//# sourceMappingURL=register-http-api-handler.d.ts.map |
@@ -1,4 +0,4 @@ | ||
export * from './HttpApiHandler'; | ||
export * from './HttpApiHandlerArgs'; | ||
export * from './HttpApiHandlerOptions'; | ||
export * from './HttpApiHandler.js'; | ||
export * from './HttpApiHandlerArgs.js'; | ||
export * from './HttpApiHandlerOptions.js'; | ||
//# sourceMappingURL=exports.d.ts.map |
{ | ||
"name": "express-yaschema-api-handler", | ||
"version": "2.5.0", | ||
"version": "2.6.0", | ||
"description": "Express handler support for yaschema-api", | ||
@@ -11,5 +11,5 @@ "keywords": [ | ||
], | ||
"main": "lib/cjs/index.js", | ||
"module": "lib/mjs/index.js", | ||
"types": "lib/index.d.ts", | ||
"main": "lib/cjs/exports.js", | ||
"module": "lib/mjs/exports.js", | ||
"types": "lib/exports.d.ts", | ||
"repository": "https://github.com/TypeScript-OSS/express-yaschema-api-handler.git", | ||
@@ -23,3 +23,3 @@ "homepage": "https://typescript-oss.github.io/express-yaschema-api-handler/", | ||
"clean": "trash coverage dev-build docs lib", | ||
"generate:docs": "npx typedoc src/index.ts --out docs --skipErrorChecking", | ||
"generate:docs": "npx typedoc src/exports.ts --out docs --skipErrorChecking", | ||
"lint": "eslint 'src/**/*.ts?(x)' --max-warnings 0", | ||
@@ -36,36 +36,36 @@ "prepublishOnly": "yarn clean && yarn test && yarn lint && yarn test:audit && yarn clean && yarn build && yarn generate:docs", | ||
"multer": "^1.4.5-lts.1", | ||
"yaschema": "^3.4.0", | ||
"yaschema-api": "^3.5.0" | ||
"yaschema": "^3.5.0", | ||
"yaschema-api": "^3.6.0" | ||
}, | ||
"devDependencies": { | ||
"@eslint/compat": "1.1.0", | ||
"@eslint/eslintrc": "3.1.0", | ||
"@eslint/js": "9.5.0", | ||
"@types/body-parser": "^1.19.5", | ||
"@types/express": "^4.17.21", | ||
"@types/jest": "^29.5.12", | ||
"@types/lodash": "4.17.0", | ||
"@types/multer": "^1.4.11", | ||
"@types/node-fetch": "^2.6.11", | ||
"@typescript-eslint/eslint-plugin": "^7.2.0", | ||
"@typescript-eslint/parser": "^7.2.0", | ||
"@typescript-eslint/eslint-plugin": "^7.14.1", | ||
"@typescript-eslint/parser": "^7.14.1", | ||
"body-parser": "^1.20.2", | ||
"eslint": "8.57.0", | ||
"eslint": "9.5.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-import-resolver-typescript": "^3.6.1", | ||
"eslint-plugin-file-extension-in-import-ts": "2.1.0", | ||
"eslint-plugin-import": "^2.29.1", | ||
"eslint-plugin-prefer-arrow": "^1.2.3", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"eslint-plugin-simple-import-sort": "^12.0.0", | ||
"eslint-plugin-tsdoc": "^0.2.17", | ||
"eslint-plugin-simple-import-sort": "^12.1.0", | ||
"eslint-plugin-tsdoc": "^0.3.0", | ||
"express": "^4.19.2", | ||
"fast-text-encoding": "^1.0.6", | ||
"jest": "29.7.0", | ||
"jest-environment-jsdom": "^29.7.0", | ||
"madge": "6.1.0", | ||
"node-fetch": "^3.3.2", | ||
"prettier": "3.2.5", | ||
"madge": "7.0.0", | ||
"prettier": "3.3.2", | ||
"trash-cli": "5.0.0", | ||
"ts-jest": "^29.1.2", | ||
"typedoc": "^0.25.12", | ||
"typescript": "5.4.2", | ||
"yaschema-api-fetcher": "^2.6.0" | ||
"ts-jest": "^29.1.5", | ||
"typedoc": "^0.26.2", | ||
"typescript": "5.5.2", | ||
"yaschema-api-fetcher": "^2.7.1" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
119370
136
1120
Updatedyaschema@^3.5.0
Updatedyaschema-api@^3.6.0