Comparing version 2.0.3 to 2.0.4
@@ -12,3 +12,3 @@ interface Error { | ||
*/ | ||
export declare const httpError: <Status extends 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 422 | 423 | 424 | 425 | 426 | 428 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511, Name extends string, Data>(status: Status, name: Name, data?: Data | undefined) => { | ||
export declare const httpError: <Status extends 422 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 423 | 424 | 425 | 426 | 428 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511, Name extends string, Data>(status: Status, name: Name, data?: Data | undefined) => { | ||
error: { | ||
@@ -15,0 +15,0 @@ name: Name; |
export { handler } from './core'; | ||
export { httpError, onError, StatusCode } from './error'; | ||
export { apply } from './utilities'; | ||
export * from './server'; | ||
export { createExpressMiddleware } from './server'; | ||
export { RoutesToSDK } from './routes'; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.apply = exports.StatusCode = exports.onError = exports.httpError = exports.handler = void 0; | ||
exports.createExpressMiddleware = exports.apply = exports.StatusCode = exports.onError = exports.httpError = exports.handler = void 0; | ||
var core_1 = require("./core"); | ||
@@ -26,3 +12,4 @@ Object.defineProperty(exports, "handler", { enumerable: true, get: function () { return core_1.handler; } }); | ||
Object.defineProperty(exports, "apply", { enumerable: true, get: function () { return utilities_1.apply; } }); | ||
__exportStar(require("./server"), exports); | ||
var server_1 = require("./server"); | ||
Object.defineProperty(exports, "createExpressMiddleware", { enumerable: true, get: function () { return server_1.createExpressMiddleware; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -12,2 +12,32 @@ import { BridgeHandler } from '../core'; | ||
} | ||
type BridgeHandlerReturnType<H extends BridgeHandler> = H extends BridgeHandler<infer ResolveFct, infer Middlewares> ? { | ||
body: Parameters<ResolveFct>[0]['body']; | ||
query: Parameters<ResolveFct>[0]['query']; | ||
headers: Parameters<ResolveFct>[0]['headers']; | ||
return: (ReturnType<ResolveFct> extends Promise<infer RetWithoutPromise> ? RetWithoutPromise : ReturnType<ResolveFct>) | Extract<BridgeHandlerReturnType<Middlewares[number]>['return'], { | ||
error: any; | ||
}> | (Parameters<ResolveFct>[0]['body'] extends Record<any, any> ? { | ||
error: { | ||
name: 'Body schema validation error'; | ||
status: 422; | ||
data: any; | ||
}; | ||
} : never) | (Parameters<ResolveFct>[0]['headers'] extends Record<any, any> ? { | ||
error: { | ||
name: 'Headers schema validation error'; | ||
status: 422; | ||
data: any; | ||
}; | ||
} : never) | (Parameters<ResolveFct>[0]['query'] extends Record<any, any> ? { | ||
error: { | ||
name: 'Query schema validation error'; | ||
status: 422; | ||
data: any; | ||
}; | ||
} : never); | ||
} : {}; | ||
export type RoutesToSDK<T extends BridgeRoutes> = { | ||
[key in keyof T]: T[key] extends BridgeHandler ? BridgeHandlerReturnType<T[key]> : T[key] extends BridgeRoutes ? RoutesToSDK<T[key]> : never; | ||
}; | ||
export {}; | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "bridge", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "Bridge is a new way of developing your api's", | ||
@@ -5,0 +5,0 @@ "author": "El Ouahabi Nabil", |
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
98965
1070