From 4bbb4da274a4a5175f4b56c46f06ea24adbb0e60 Mon Sep 17 00:00:00 2001 From: Benjamin Toby Date: Fri, 18 Oct 2024 05:20:28 +0100 Subject: [PATCH] Update types --- .npmrc | 4 ++-- engine/user/add-user.js | 2 +- {types => package-shared/types}/engine.td.js | 0 {types => package-shared/types}/general.td.js | 0 {types => package-shared/types}/mysql.td.js | 0 {types => package-shared/types}/user.td.js | 12 ------------ users/add-user.js | 4 ++-- users/login-user.js | 4 ++-- users/reauth-user.js | 2 +- users/send-email-code.js | 2 +- users/social/google-auth.js | 2 +- users/update-user.js | 2 +- users/user-auth.js | 2 +- users/validate-token.js | 2 +- 14 files changed, 13 insertions(+), 25 deletions(-) rename {types => package-shared/types}/engine.td.js (100%) rename {types => package-shared/types}/general.td.js (100%) rename {types => package-shared/types}/mysql.td.js (100%) rename {types => package-shared/types}/user.td.js (91%) diff --git a/.npmrc b/.npmrc index 4e9ea73..4ac7177 100644 --- a/.npmrc +++ b/.npmrc @@ -1,4 +1,4 @@ # registry=https://git.tben.me/api/packages/Moduletrace/npm/ -# registry=https://git.tben.me/api/packages/Moduletrace/npm/ -# //git.tben.me/api/packages/Moduletrace/npm/:_authToken=${GITBEN_NPM_TOKEN} +registry=https://git.tben.me/api/packages/Moduletrace/npm/ +//git.tben.me/api/packages/Moduletrace/npm/:_authToken=${GITBEN_NPM_TOKEN} diff --git a/engine/user/add-user.js b/engine/user/add-user.js index 663d52e..3d9c25c 100644 --- a/engine/user/add-user.js +++ b/engine/user/add-user.js @@ -20,7 +20,7 @@ const runQuery = require("../query/utils/runQuery"); * @async * * @param {Object} params - Single object passed - * @param {import("@/types/user.td").UserDataPayload} params.payload - SQL Query + * @param {UserDataPayload} params.payload - SQL Query * @param {DSQL_DatabaseSchemaType | undefined} params.dbSchema - Name of the table to query * @param {string} [params.encryptionKey] * @param {string} [params.encryptionSalt] diff --git a/types/engine.td.js b/package-shared/types/engine.td.js similarity index 100% rename from types/engine.td.js rename to package-shared/types/engine.td.js diff --git a/types/general.td.js b/package-shared/types/general.td.js similarity index 100% rename from types/general.td.js rename to package-shared/types/general.td.js diff --git a/types/mysql.td.js b/package-shared/types/mysql.td.js similarity index 100% rename from types/mysql.td.js rename to package-shared/types/mysql.td.js diff --git a/types/user.td.js b/package-shared/types/user.td.js similarity index 91% rename from types/user.td.js rename to package-shared/types/user.td.js index 8b66a62..cb552db 100644 --- a/types/user.td.js +++ b/package-shared/types/user.td.js @@ -115,15 +115,3 @@ * @property {boolean} success - Did the function run successfully? * @property {(Object[]|string)} [payload=[]] - Payload */ - -module.exports = { - DATASQUIREL_LoggedInUser, - AuthenticatedUser, - AddUserFunctionReturn, - SuccessUserObject, - GoogleIdentityPromptNotification, - UserDataPayload, - GetUserFunctionReturn, - ReauthUserFunctionReturn, - UpdateUserFunctionReturn, -}; diff --git a/users/add-user.js b/users/add-user.js index 94b40ed..b7d1d5e 100644 --- a/users/add-user.js +++ b/users/add-user.js @@ -26,11 +26,11 @@ const localAddUser = require("../engine/user/add-user"); * @param {object} props - Single object passed * @param {string} props.key - FULL ACCESS API Key * @param {string} props.database - Database Name - * @param {import("../types/user.td").UserDataPayload} props.payload - User Data Payload + * @param {UserDataPayload} props.payload - User Data Payload * @param {string} props.encryptionKey * @param {string} [props.encryptionSalt] * - * @returns { Promise } + * @returns { Promise } */ async function addUser({ key, diff --git a/users/login-user.js b/users/login-user.js index 206e034..4aa3adb 100644 --- a/users/login-user.js +++ b/users/login-user.js @@ -41,7 +41,7 @@ const loginLocalUser = require("../engine/user/login-user"); * @param {string} [params.temp_code_field] - Database table field name for temporary code * @param {boolean} [params.token] - Send access key as part of response body? * - * @returns { Promise} + * @returns { Promise} */ async function loginUser({ key, @@ -154,7 +154,7 @@ async function loginUser({ * * @description make a request to datasquirel.com * - * @type {{ success: boolean, payload: import("../types/user.td").DATASQUIREL_LoggedInUser | null, userId?: number, msg?: string }} + * @type {{ success: boolean, payload: DATASQUIREL_LoggedInUser | null, userId?: number, msg?: string }} */ httpResponse = await new Promise((resolve, reject) => { /** @type {PackageUserLoginRequestBody} */ diff --git a/users/reauth-user.js b/users/reauth-user.js index 919be99..8c1b552 100644 --- a/users/reauth-user.js +++ b/users/reauth-user.js @@ -38,7 +38,7 @@ const localReauthUser = require("../engine/user/reauth-user"); * @param {string[]} [params.additionalFields] - Additional Fields to be added to the user object * @param {string} [params.token] - access token to use instead of getting from cookie header * - * @returns { Promise } + * @returns { Promise } */ async function reauthUser({ key, diff --git a/users/send-email-code.js b/users/send-email-code.js index 52b1e04..dd4761c 100644 --- a/users/send-email-code.js +++ b/users/send-email-code.js @@ -143,7 +143,7 @@ async function sendEmailCode({ * * @description make a request to datasquirel.com * - * @type {{ success: boolean, payload: import("../types/user.td").DATASQUIREL_LoggedInUser | null, userId?: number, msg?: string }} + * @type {{ success: boolean, payload: DATASQUIREL_LoggedInUser | null, userId?: number, msg?: string }} */ httpResponse = await new Promise((resolve, reject) => { const reqPayload = JSON.stringify({ diff --git a/users/social/google-auth.js b/users/social/google-auth.js index 744707e..c451e42 100644 --- a/users/social/google-auth.js +++ b/users/social/google-auth.js @@ -179,7 +179,7 @@ async function googleAuth({ * Make https request * * @description make a request to datasquirel.com - * @type {{ success: boolean, user: import("../../types/user.td").DATASQUIREL_LoggedInUser | null, msg?: string, dsqlUserId?: number } | null } - Https response object + * @type {{ success: boolean, user: DATASQUIREL_LoggedInUser | null, msg?: string, dsqlUserId?: number } | null } - Https response object */ httpResponse = await new Promise((resolve, reject) => { const reqPayload = JSON.stringify({ diff --git a/users/update-user.js b/users/update-user.js index 0de51ec..0eede73 100644 --- a/users/update-user.js +++ b/users/update-user.js @@ -29,7 +29,7 @@ const localUpdateUser = require("../engine/user/update-user"); * @param {String} params.database - Target Database * @param {{ id: number } & Object.} params.payload - User Object: ID is required * - * @returns { Promise} + * @returns { Promise} */ async function updateUser({ key, payload, database }) { /** diff --git a/users/user-auth.js b/users/user-auth.js index d89bb7b..5d312c7 100644 --- a/users/user-auth.js +++ b/users/user-auth.js @@ -30,7 +30,7 @@ const parseCookies = require("../utils/functions/parseCookies"); * @param {string} params.database - Database Name * @param {string} [params.token] - access token to use instead of getting from cookie header * - * @returns { import("../types/user.td").AuthenticatedUser } + * @returns { AuthenticatedUser } */ function userAuth({ request, diff --git a/users/validate-token.js b/users/validate-token.js index 8a06034..ea00de3 100644 --- a/users/validate-token.js +++ b/users/validate-token.js @@ -27,7 +27,7 @@ const decrypt = require("../functions/decrypt"); * @param {("deep" | "normal")?} [params.level] - Optional. "Deep" value indicates an extra layer of security * @param {string} params.database - Database Name * - * @returns { import("../types/user.td").DATASQUIREL_LoggedInUser | null} + * @returns { DATASQUIREL_LoggedInUser | null} */ function validateToken({ token, encryptionKey, encryptionSalt }) { try {