diff --git a/package-shared/functions/api/users/social/api-google-login.js b/package-shared/functions/api/users/social/api-google-login.js index 725ee6f..9b085cc 100644 --- a/package-shared/functions/api/users/social/api-google-login.js +++ b/package-shared/functions/api/users/social/api-google-login.js @@ -45,7 +45,7 @@ module.exports = async function apiGoogleLogin({ if (!database || typeof database != "string" || database?.match(/ /)) { return { success: false, - user: undefined, + payload: undefined, msg: "Please provide a database slug(database name in lowercase with no spaces)", }; } @@ -89,7 +89,7 @@ module.exports = async function apiGoogleLogin({ return { success: false, - user: undefined, + payload: undefined, msg: error.message, }; } diff --git a/package-shared/types/index.d.ts b/package-shared/types/index.d.ts index 98da320..23c4ca7 100644 --- a/package-shared/types/index.d.ts +++ b/package-shared/types/index.d.ts @@ -1057,10 +1057,7 @@ export type APIGoogleLoginFunctionParams = { database: string; additionalFields?: string[]; }; -export type APIGoogleLoginFunctionReturn = { - dsqlUserId?: number | string; -} & HandleSocialDbFunctionReturn; -export type APIGoogleLoginFunction = (params: APIGoogleLoginFunctionParams) => Promise; +export type APIGoogleLoginFunction = (params: APIGoogleLoginFunctionParams) => Promise; /** * Handle Social DB Function */ diff --git a/package-shared/types/index.ts b/package-shared/types/index.ts index 8edcdaa..031b433 100644 --- a/package-shared/types/index.ts +++ b/package-shared/types/index.ts @@ -1269,13 +1269,9 @@ export type APIGoogleLoginFunctionParams = { additionalFields?: string[]; }; -export type APIGoogleLoginFunctionReturn = { - dsqlUserId?: number | string; -} & HandleSocialDbFunctionReturn; - export type APIGoogleLoginFunction = ( params: APIGoogleLoginFunctionParams -) => Promise; +) => Promise; /** * Handle Social DB Function diff --git a/package.json b/package.json index 301e15e..e1f141d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@moduletrace/datasquirel", - "version": "2.9.2", + "version": "2.9.3", "description": "Cloud-based SQL data management tool", "main": "index.js", "bin": { diff --git a/users/social/google-auth.d.ts b/users/social/google-auth.d.ts index 0c153e5..2c532df 100644 --- a/users/social/google-auth.d.ts +++ b/users/social/google-auth.d.ts @@ -1,11 +1,4 @@ export = googleAuth; -/** - * @typedef {object | null} FunctionReturn - * @property {boolean} success - Did the function run successfully? - * @property {import("../../types/user.td").DATASQUIREL_LoggedInUser | null} user - Returned User - * @property {number} [dsqlUserId] - Dsql User Id - * @property {string} [msg] - Response message - */ /** * SERVER FUNCTION: Login with google Function * ============================================================================== @@ -23,7 +16,7 @@ export = googleAuth; * @param {string | number} [params.apiUserID] - API user ID * @param {boolean} [params.useLocal] - Whether to use a remote database instead of API * - * @returns { Promise } + * @returns { Promise } */ declare function googleAuth({ key, token, database, response, encryptionKey, encryptionSalt, additionalFields, apiUserID, useLocal, }: { key?: string; @@ -35,9 +28,5 @@ declare function googleAuth({ key, token, database, response, encryptionKey, enc additionalFields?: string[]; apiUserID?: string | number; useLocal?: boolean; -}): Promise; -declare namespace googleAuth { - export { FunctionReturn }; -} +}): Promise; import http = require("http"); -type FunctionReturn = object | null; diff --git a/users/social/google-auth.js b/users/social/google-auth.js index 504f029..e3203ad 100644 --- a/users/social/google-auth.js +++ b/users/social/google-auth.js @@ -1,8 +1,6 @@ // @ts-check const http = require("http"); -const fs = require("fs"); -const path = require("path"); const encrypt = require("../../package-shared/functions/dsql/encrypt"); const grabHostNames = require("../../package-shared/utils/grab-host-names"); const apiGoogleLogin = require("../../package-shared/functions/api/users/social/api-google-login"); @@ -11,14 +9,6 @@ const { writeAuthFile, } = require("../../package-shared/functions/backend/auth/write-auth-files"); -/** - * @typedef {object | null} FunctionReturn - * @property {boolean} success - Did the function run successfully? - * @property {import("../../types/user.td").DATASQUIREL_LoggedInUser | null} user - Returned User - * @property {number} [dsqlUserId] - Dsql User Id - * @property {string} [msg] - Response message - */ - /** * SERVER FUNCTION: Login with google Function * ============================================================================== @@ -36,7 +26,7 @@ const { * @param {string | number} [params.apiUserID] - API user ID * @param {boolean} [params.useLocal] - Whether to use a remote database instead of API * - * @returns { Promise } + * @returns { Promise } */ async function googleAuth({ key, @@ -83,7 +73,7 @@ async function googleAuth({ if (!token || token?.match(/ /)) { return { success: false, - user: null, + payload: null, msg: "Please enter Google Access Token", }; } @@ -91,7 +81,7 @@ async function googleAuth({ if (!database || database?.match(/ /)) { return { success: false, - user: null, + payload: null, msg: "Please provide database slug name you want to access", }; }