Type Checking
This commit is contained in:
parent
65d6424dcf
commit
4da665efd4
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "datasquirel",
|
"name": "datasquirel",
|
||||||
"version": "1.2.5",
|
"version": "1.2.6",
|
||||||
"description": "Cloud-based SQL data management tool",
|
"description": "Cloud-based SQL data management tool",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -54,7 +54,7 @@ function logoutUser({ request, response, database }) {
|
|||||||
/** ********************************************** */
|
/** ********************************************** */
|
||||||
/** ********************************************** */
|
/** ********************************************** */
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error.message);
|
console.log(error);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
* Imports
|
* Imports
|
||||||
* ==============================================================================
|
* ==============================================================================
|
||||||
*/
|
*/
|
||||||
|
const http = require("http");
|
||||||
const decrypt = require("../functions/decrypt");
|
const decrypt = require("../functions/decrypt");
|
||||||
const parseCookies = require("../utils/functions/parseCookies");
|
const parseCookies = require("../utils/functions/parseCookies");
|
||||||
|
|
||||||
@ -19,7 +20,7 @@ const parseCookies = require("../utils/functions/parseCookies");
|
|||||||
* @typedef {object} AuthenticatedUserObject
|
* @typedef {object} AuthenticatedUserObject
|
||||||
* @property {boolean} success - Did the function run successfully?
|
* @property {boolean} success - Did the function run successfully?
|
||||||
* @property {import("../types/user.td").DATASQUIREL_LoggedInUser | null} payload - Payload
|
* @property {import("../types/user.td").DATASQUIREL_LoggedInUser | null} payload - Payload
|
||||||
* @property {string} [msg] - Response Message
|
* @property {string | unknown} [msg] - Response Message
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -29,7 +30,7 @@ const parseCookies = require("../utils/functions/parseCookies");
|
|||||||
* with the user's data
|
* with the user's data
|
||||||
*
|
*
|
||||||
* @param {Object} params - Arg
|
* @param {Object} params - Arg
|
||||||
* @param {Object} params.request - Http request object
|
* @param {http.IncomingMessage} params.request - Http request object
|
||||||
* @param {String} params.encryptionKey - Encryption Key
|
* @param {String} params.encryptionKey - Encryption Key
|
||||||
* @param {String} params.encryptionSalt - Encryption Salt
|
* @param {String} params.encryptionSalt - Encryption Salt
|
||||||
* @param {String} params.level - Optional. "Deep" value indicates an extra layer of security
|
* @param {String} params.level - Optional. "Deep" value indicates an extra layer of security
|
||||||
@ -130,7 +131,7 @@ function userAuth({ request, encryptionKey, encryptionSalt, level, database }) {
|
|||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
payload: null,
|
payload: null,
|
||||||
msg: error.message,
|
msg: error,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
|
// @ts-check
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ==============================================================================
|
* ==============================================================================
|
||||||
* Imports
|
* Imports
|
||||||
* ==============================================================================
|
* ==============================================================================
|
||||||
*/
|
*/
|
||||||
|
const http = require("http");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse request cookies
|
* Parse request cookies
|
||||||
@ -13,9 +16,9 @@
|
|||||||
* @async
|
* @async
|
||||||
*
|
*
|
||||||
* @param {object} params - main params object
|
* @param {object} params - main params object
|
||||||
* @param {object} params.request - HTTPS request object
|
* @param {http.IncomingMessage} params.request - HTTPS request object
|
||||||
*
|
*
|
||||||
* @returns {object|null}
|
* @returns {* | null}
|
||||||
*/
|
*/
|
||||||
module.exports = function ({ request }) {
|
module.exports = function ({ request }) {
|
||||||
/**
|
/**
|
||||||
@ -28,7 +31,7 @@ module.exports = function ({ request }) {
|
|||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
|
|
||||||
/** @type {string|null} */
|
/** @type {string | undefined} */
|
||||||
const cookieString = request.headers.cookie;
|
const cookieString = request.headers.cookie;
|
||||||
|
|
||||||
if (!cookieString || typeof cookieString !== "string") {
|
if (!cookieString || typeof cookieString !== "string") {
|
||||||
|
Loading…
Reference in New Issue
Block a user