Bugfix
This commit is contained in:
parent
04a4452821
commit
2ae4610dca
@ -1,5 +1,9 @@
|
||||
declare function _exports({ request }: {
|
||||
request: http.IncomingMessage;
|
||||
}): any | null;
|
||||
request?: http.IncomingMessage & {
|
||||
[x: string]: any;
|
||||
};
|
||||
}): {
|
||||
[x: string]: any;
|
||||
};
|
||||
export = _exports;
|
||||
import http = require("http");
|
||||
|
@ -16,22 +16,18 @@ const http = require("http");
|
||||
* @async
|
||||
*
|
||||
* @param {object} params - main params object
|
||||
* @param {http.IncomingMessage} params.request - HTTPS request object
|
||||
* @param {http.IncomingMessage & Object<string, any>} [params.request] - HTTPS request object
|
||||
*
|
||||
* @returns {any | null}
|
||||
* @returns {Object<string, any>}
|
||||
*/
|
||||
module.exports = function ({ request }) {
|
||||
/**
|
||||
* Check inputs
|
||||
*
|
||||
* @description Check inputs
|
||||
*/
|
||||
if (!request) return {};
|
||||
|
||||
/** @type {string | undefined} */
|
||||
const cookieString = request.headers.cookie;
|
||||
|
||||
if (!cookieString || typeof cookieString !== "string") {
|
||||
return null;
|
||||
return {};
|
||||
}
|
||||
|
||||
/** @type {string[]} */
|
||||
|
2
package-shared/utils/serialize-query.d.ts
vendored
Normal file
2
package-shared/utils/serialize-query.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export = serializeQuery;
|
||||
declare function serializeQuery(param0: import("../types").SerializeQueryParams): string;
|
18
package-shared/utils/serialize-query.js
Normal file
18
package-shared/utils/serialize-query.js
Normal file
@ -0,0 +1,18 @@
|
||||
// @ts-check
|
||||
|
||||
/** @type {import("../types").SerializeQueryFnType} */
|
||||
function serializeQuery({ query }) {
|
||||
let str = "?";
|
||||
const keys = Object.keys(query);
|
||||
|
||||
/** @type {string[]} */
|
||||
const queryArr = [];
|
||||
keys.forEach((key) => {
|
||||
if (!key || !query[key]) return;
|
||||
queryArr.push(`${key}=${query[key]}`);
|
||||
});
|
||||
str += queryArr.join("&");
|
||||
return str;
|
||||
}
|
||||
|
||||
module.exports = serializeQuery;
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@moduletrace/datasquirel",
|
||||
"version": "2.8.3",
|
||||
"version": "2.8.4",
|
||||
"description": "Cloud-based SQL data management tool",
|
||||
"main": "index.js",
|
||||
"bin": {
|
||||
|
@ -7,8 +7,8 @@
|
||||
*/
|
||||
const http = require("http");
|
||||
const decrypt = require("../package-shared/functions/dsql/decrypt");
|
||||
const parseCookies = require("../utils/functions/parseCookies");
|
||||
const getAuthCookieNames = require("../package-shared/functions/backend/cookies/get-auth-cookie-names");
|
||||
const parseCookies = require("../package-shared/utils/backend/parseCookies");
|
||||
|
||||
/** ****************************************************************************** */
|
||||
/** ****************************************************************************** */
|
||||
|
@ -2,11 +2,11 @@
|
||||
|
||||
const http = require("http");
|
||||
const decrypt = require("../package-shared/functions/dsql/decrypt");
|
||||
const parseCookies = require("../utils/functions/parseCookies");
|
||||
const getAuthCookieNames = require("../package-shared/functions/backend/cookies/get-auth-cookie-names");
|
||||
const {
|
||||
checkAuthFile,
|
||||
} = require("../package-shared/functions/backend/auth/write-auth-files");
|
||||
const parseCookies = require("../package-shared/utils/backend/parseCookies");
|
||||
|
||||
const minuteInMilliseconds = 60000;
|
||||
const hourInMilliseconds = minuteInMilliseconds * 60;
|
||||
|
@ -3,9 +3,9 @@
|
||||
const https = require("node:https");
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
const serializeQuery = require("./functions/serialize-query");
|
||||
const grabHostNames = require("../package-shared/utils/grab-host-names");
|
||||
const apiGet = require("../package-shared/functions/api/query/get");
|
||||
const serializeQuery = require("../package-shared/utils/serialize-query");
|
||||
|
||||
/**
|
||||
* Make a get request to Datasquirel API
|
||||
|
Loading…
Reference in New Issue
Block a user