@tartine/common
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -6,5 +6,6 @@ export declare type ProblemDetailsResponse = { | ||
invalid_params?: { | ||
param: string; | ||
reason: string; | ||
}[]; | ||
[param: string]: { | ||
reason: string; | ||
}; | ||
}; | ||
}; | ||
@@ -11,0 +12,0 @@ export declare abstract class CustomError extends Error { |
@@ -11,7 +11,4 @@ import { ValidationError } from "express-validator"; | ||
status: number; | ||
invalid_params: { | ||
param: string; | ||
reason: any; | ||
}[]; | ||
invalid_params: {}; | ||
}; | ||
} |
@@ -17,2 +17,13 @@ "use strict"; | ||
})(); | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -31,9 +42,7 @@ exports.RequestValidationError = void 0; | ||
status: _this.statusCode, | ||
invalid_params: _this.errors.map(function (_a) { | ||
invalid_params: _this.errors.reduce(function (initial, _a) { | ||
var _b; | ||
var param = _a.param, msg = _a.msg; | ||
return ({ | ||
param: param, | ||
reason: msg, | ||
}); | ||
}), | ||
return (__assign(__assign({}, initial), (_b = {}, _b[param] = { reason: msg }, _b))); | ||
}, {}), | ||
}); }; | ||
@@ -40,0 +49,0 @@ Object.setPrototypeOf(_this, RequestValidationError.prototype); |
export * from "./error-handler"; | ||
export * from "./require-auth-handler"; | ||
export * from "./user-cookie-handler"; | ||
export * from "./validate-request-handler"; |
@@ -15,3 +15,2 @@ "use strict"; | ||
__exportStar(require("./require-auth-handler"), exports); | ||
__exportStar(require("./user-cookie-handler"), exports); | ||
__exportStar(require("./validate-request-handler"), exports); |
import { Request, Response, NextFunction } from "express"; | ||
/** | ||
* TODO: Move this to the common package | ||
*/ | ||
declare type UserPayload = { | ||
userId: string; | ||
export declare type UserSessionPayload = { | ||
id: string; | ||
}; | ||
@@ -11,11 +8,11 @@ declare global { | ||
interface Request { | ||
user?: UserPayload; | ||
user?: UserSessionPayload; | ||
} | ||
} | ||
} | ||
declare type Args = { | ||
declare type Params = { | ||
cookieName: string; | ||
cookieSecret: string; | ||
}; | ||
export declare const sessionCookieHandler: ({ cookieName, cookieSecret }: Args) => (req: Request, _: Response, next: NextFunction) => void; | ||
export declare const sessionCookieHandler: ({ cookieName, cookieSecret }: Params) => (req: Request, _: Response, next: NextFunction) => void; | ||
export {}; |
{ | ||
"name": "@tartine/common", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Nothing but commons", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
1
30596
56
754