Update types

This commit is contained in:
Benjamin Toby 2024-10-18 05:20:28 +01:00
parent 59c6f6dd40
commit 4bbb4da274
14 changed files with 13 additions and 25 deletions

4
.npmrc
View File

@ -1,4 +1,4 @@
# registry=https://git.tben.me/api/packages/Moduletrace/npm/ # registry=https://git.tben.me/api/packages/Moduletrace/npm/
# 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} //git.tben.me/api/packages/Moduletrace/npm/:_authToken=${GITBEN_NPM_TOKEN}

View File

@ -20,7 +20,7 @@ const runQuery = require("../query/utils/runQuery");
* @async * @async
* *
* @param {Object} params - Single object passed * @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 {DSQL_DatabaseSchemaType | undefined} params.dbSchema - Name of the table to query
* @param {string} [params.encryptionKey] * @param {string} [params.encryptionKey]
* @param {string} [params.encryptionSalt] * @param {string} [params.encryptionSalt]

View File

@ -115,15 +115,3 @@
* @property {boolean} success - Did the function run successfully? * @property {boolean} success - Did the function run successfully?
* @property {(Object[]|string)} [payload=[]] - Payload * @property {(Object[]|string)} [payload=[]] - Payload
*/ */
module.exports = {
DATASQUIREL_LoggedInUser,
AuthenticatedUser,
AddUserFunctionReturn,
SuccessUserObject,
GoogleIdentityPromptNotification,
UserDataPayload,
GetUserFunctionReturn,
ReauthUserFunctionReturn,
UpdateUserFunctionReturn,
};

View File

@ -26,11 +26,11 @@ const localAddUser = require("../engine/user/add-user");
* @param {object} props - Single object passed * @param {object} props - Single object passed
* @param {string} props.key - FULL ACCESS API Key * @param {string} props.key - FULL ACCESS API Key
* @param {string} props.database - Database Name * @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.encryptionKey
* @param {string} [props.encryptionSalt] * @param {string} [props.encryptionSalt]
* *
* @returns { Promise<import("../types/user.td").AddUserFunctionReturn> } * @returns { Promise<AddUserFunctionReturn> }
*/ */
async function addUser({ async function addUser({
key, key,

View File

@ -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 {string} [params.temp_code_field] - Database table field name for temporary code
* @param {boolean} [params.token] - Send access key as part of response body? * @param {boolean} [params.token] - Send access key as part of response body?
* *
* @returns { Promise<import("../types/user.td").AuthenticatedUser>} * @returns { Promise<AuthenticatedUser>}
*/ */
async function loginUser({ async function loginUser({
key, key,
@ -154,7 +154,7 @@ async function loginUser({
* *
* @description make a request to datasquirel.com * @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) => { httpResponse = await new Promise((resolve, reject) => {
/** @type {PackageUserLoginRequestBody} */ /** @type {PackageUserLoginRequestBody} */

View File

@ -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.additionalFields] - Additional Fields to be added to the user object
* @param {string} [params.token] - access token to use instead of getting from cookie header * @param {string} [params.token] - access token to use instead of getting from cookie header
* *
* @returns { Promise<import("../types/user.td").ReauthUserFunctionReturn> } * @returns { Promise<ReauthUserFunctionReturn> }
*/ */
async function reauthUser({ async function reauthUser({
key, key,

View File

@ -143,7 +143,7 @@ async function sendEmailCode({
* *
* @description make a request to datasquirel.com * @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) => { httpResponse = await new Promise((resolve, reject) => {
const reqPayload = JSON.stringify({ const reqPayload = JSON.stringify({

View File

@ -179,7 +179,7 @@ async function googleAuth({
* Make https request * Make https request
* *
* @description make a request to datasquirel.com * @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) => { httpResponse = await new Promise((resolve, reject) => {
const reqPayload = JSON.stringify({ const reqPayload = JSON.stringify({

View File

@ -29,7 +29,7 @@ const localUpdateUser = require("../engine/user/update-user");
* @param {String} params.database - Target Database * @param {String} params.database - Target Database
* @param {{ id: number } & Object.<string, *>} params.payload - User Object: ID is required * @param {{ id: number } & Object.<string, *>} params.payload - User Object: ID is required
* *
* @returns { Promise<import("../types/user.td").UpdateUserFunctionReturn>} * @returns { Promise<UpdateUserFunctionReturn>}
*/ */
async function updateUser({ key, payload, database }) { async function updateUser({ key, payload, database }) {
/** /**

View File

@ -30,7 +30,7 @@ const parseCookies = require("../utils/functions/parseCookies");
* @param {string} params.database - Database Name * @param {string} params.database - Database Name
* @param {string} [params.token] - access token to use instead of getting from cookie header * @param {string} [params.token] - access token to use instead of getting from cookie header
* *
* @returns { import("../types/user.td").AuthenticatedUser } * @returns { AuthenticatedUser }
*/ */
function userAuth({ function userAuth({
request, request,

View File

@ -27,7 +27,7 @@ const decrypt = require("../functions/decrypt");
* @param {("deep" | "normal")?} [params.level] - Optional. "Deep" value indicates an extra layer of security * @param {("deep" | "normal")?} [params.level] - Optional. "Deep" value indicates an extra layer of security
* @param {string} params.database - Database Name * @param {string} params.database - Database Name
* *
* @returns { import("../types/user.td").DATASQUIREL_LoggedInUser | null} * @returns { DATASQUIREL_LoggedInUser | null}
*/ */
function validateToken({ token, encryptionKey, encryptionSalt }) { function validateToken({ token, encryptionKey, encryptionSalt }) {
try { try {