From 9f77036b91825d4a172748211ca0c68a2147afe2 Mon Sep 17 00:00:00 2001 From: Benjamin Toby Date: Sun, 5 Jan 2025 09:00:50 +0100 Subject: [PATCH] type fix --- package-shared/functions/backend/httpRequest.d.ts | 11 +---------- package-shared/functions/backend/httpRequest.js | 11 +---------- package-shared/types/index.d.ts | 11 +++++++++++ package-shared/types/index.ts | 8 ++++++++ package.json | 2 +- 5 files changed, 22 insertions(+), 21 deletions(-) diff --git a/package-shared/functions/backend/httpRequest.d.ts b/package-shared/functions/backend/httpRequest.d.ts index a2c6871..cb0ff5c 100644 --- a/package-shared/functions/backend/httpRequest.d.ts +++ b/package-shared/functions/backend/httpRequest.d.ts @@ -1,10 +1 @@ -export type HttpRequestExtraParams = { - scheme?: "http" | "https"; - body?: { - [x: string]: any; - }; - query?: { - [x: string]: any; - }; - urlEncodedFormBody?: boolean; -}; +export {}; diff --git a/package-shared/functions/backend/httpRequest.js b/package-shared/functions/backend/httpRequest.js index f815ca1..cdaea51 100644 --- a/package-shared/functions/backend/httpRequest.js +++ b/package-shared/functions/backend/httpRequest.js @@ -6,18 +6,9 @@ import querystring from "querystring"; import serializeQuery from "../../utils/serialize-query"; import _ from "lodash"; -/** - * @typedef {object} HttpRequestExtraParams - * @property {"http" | "https"} [scheme] - * @property {Object} [body] - * @property {Object} [query] - * @property {boolean} [urlEncodedFormBody] - */ - /** * # Generate a http Request - * @param {import("node:https").RequestOptions & HttpRequestExtraParams} params - * + * @param {import("../../types").HttpRequestParams} params * * @returns { Promise | string | null> } */ async function httpRequest(params) { diff --git a/package-shared/types/index.d.ts b/package-shared/types/index.d.ts index 044afa0..408ec0d 100644 --- a/package-shared/types/index.d.ts +++ b/package-shared/types/index.d.ts @@ -1,3 +1,4 @@ +import { RequestOptions } from "https"; import { Editor } from "tinymce"; export type DSQL_DatabaseFullName = string; export interface DSQL_DatabaseSchemaType { @@ -1224,4 +1225,14 @@ export type CookieObject = { sameSite?: "Strict" | "Lax" | "None"; priority?: "Low" | "Medium" | "High"; }; +export type HttpRequestParams = RequestOptions & { + scheme?: "http" | "https"; + body?: { + [key: string]: any; + }; + query?: { + [key: string]: any; + }; + urlEncodedFormBody?: boolean; +}; export {}; diff --git a/package-shared/types/index.ts b/package-shared/types/index.ts index a7c9936..18936fc 100644 --- a/package-shared/types/index.ts +++ b/package-shared/types/index.ts @@ -1,4 +1,5 @@ import type { IncomingMessage, ServerResponse } from "http"; +import { RequestOptions } from "https"; import { Editor } from "tinymce"; export type DSQL_DatabaseFullName = string; @@ -1442,3 +1443,10 @@ export type CookieObject = { sameSite?: "Strict" | "Lax" | "None"; priority?: "Low" | "Medium" | "High"; }; + +export type HttpRequestParams = RequestOptions & { + scheme?: "http" | "https"; + body?: { [key: string]: any }; + query?: { [key: string]: any }; + urlEncodedFormBody?: boolean; +}; diff --git a/package.json b/package.json index e5c4445..a9e1034 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@moduletrace/datasquirel", - "version": "3.3.1", + "version": "3.3.2", "description": "Cloud-based SQL data management tool", "main": "index.js", "bin": {