Updates
This commit is contained in:
parent
c71c1c29ca
commit
e4c6c995ef
@ -14,9 +14,10 @@ type Param = {
|
||||
apiUserID?: string | number;
|
||||
debug?: boolean;
|
||||
secureCookie?: boolean;
|
||||
loginOnly?: boolean;
|
||||
};
|
||||
/**
|
||||
* # SERVER FUNCTION: Login with google Function
|
||||
*/
|
||||
export default function googleAuth({ key, token, database, response, encryptionKey, encryptionSalt, additionalFields, additionalData, apiUserID, debug, secureCookie, }: Param): Promise<APILoginFunctionReturn>;
|
||||
export default function googleAuth({ key, token, database, response, encryptionKey, encryptionSalt, additionalFields, additionalData, apiUserID, debug, secureCookie, loginOnly, }: Param): Promise<APILoginFunctionReturn>;
|
||||
export {};
|
||||
|
@ -23,7 +23,7 @@ const grab_cookie_expirt_date_1 = __importDefault(require("../../../utils/grab-c
|
||||
* # SERVER FUNCTION: Login with google Function
|
||||
*/
|
||||
function googleAuth(_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ key, token, database, response, encryptionKey, encryptionSalt, additionalFields, additionalData, apiUserID, debug, secureCookie, }) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ key, token, database, response, encryptionKey, encryptionSalt, additionalFields, additionalData, apiUserID, debug, secureCookie, loginOnly, }) {
|
||||
var _b;
|
||||
const grabedHostNames = (0, grab_host_names_1.default)({
|
||||
userId: apiUserID || process.env.DSQL_API_USER_ID,
|
||||
|
@ -2,4 +2,4 @@ import { APILoginFunctionReturn, HandleSocialDbFunctionParams } from "../../../t
|
||||
/**
|
||||
* # Handle Social DB
|
||||
*/
|
||||
export default function handleSocialDb({ database, social_id, email, social_platform, payload, invitation, supEmail, additionalFields, debug, }: HandleSocialDbFunctionParams): Promise<APILoginFunctionReturn>;
|
||||
export default function handleSocialDb({ database, social_id, email, social_platform, payload, invitation, supEmail, additionalFields, debug, loginOnly, }: HandleSocialDbFunctionParams): Promise<APILoginFunctionReturn>;
|
||||
|
@ -25,7 +25,7 @@ const loginSocialUser_1 = __importDefault(require("./loginSocialUser"));
|
||||
* # Handle Social DB
|
||||
*/
|
||||
function handleSocialDb(_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ database, social_id, email, social_platform, payload, invitation, supEmail, additionalFields, debug, }) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ database, social_id, email, social_platform, payload, invitation, supEmail, additionalFields, debug, loginOnly, }) {
|
||||
var _b;
|
||||
try {
|
||||
const finalDbName = global.DSQL_USE_LOCAL
|
||||
@ -62,6 +62,13 @@ function handleSocialDb(_a) {
|
||||
debug,
|
||||
});
|
||||
}
|
||||
else if (loginOnly) {
|
||||
return {
|
||||
success: false,
|
||||
payload: null,
|
||||
msg: "User Does not Exist",
|
||||
};
|
||||
}
|
||||
const finalEmail = email ? email : supEmail ? supEmail : null;
|
||||
if (!finalEmail) {
|
||||
return {
|
||||
|
@ -2,4 +2,4 @@ import { APIGoogleLoginFunctionParams, APILoginFunctionReturn } from "../../../.
|
||||
/**
|
||||
* # API google login
|
||||
*/
|
||||
export default function apiGoogleLogin({ token, database, additionalFields, additionalData, debug, }: APIGoogleLoginFunctionParams): Promise<APILoginFunctionReturn>;
|
||||
export default function apiGoogleLogin({ token, database, additionalFields, additionalData, debug, loginOnly, }: APIGoogleLoginFunctionParams): Promise<APILoginFunctionReturn>;
|
||||
|
@ -20,7 +20,7 @@ const ejson_1 = __importDefault(require("../../../../utils/ejson"));
|
||||
* # API google login
|
||||
*/
|
||||
function apiGoogleLogin(_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ token, database, additionalFields, additionalData, debug, }) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ token, database, additionalFields, additionalData, debug, loginOnly, }) {
|
||||
try {
|
||||
const gUser = yield new Promise((resolve, reject) => {
|
||||
https_1.default
|
||||
@ -71,6 +71,7 @@ function apiGoogleLogin(_a) {
|
||||
social_id: sub,
|
||||
additionalFields,
|
||||
debug,
|
||||
loginOnly,
|
||||
});
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
|
2
dist/package-shared/types/index.d.ts
vendored
2
dist/package-shared/types/index.d.ts
vendored
@ -1098,6 +1098,7 @@ export type APIGoogleLoginFunctionParams = {
|
||||
[key: string]: string | number;
|
||||
};
|
||||
debug?: boolean;
|
||||
loginOnly?: boolean;
|
||||
};
|
||||
export type APIGoogleLoginFunction = (params: APIGoogleLoginFunctionParams) => Promise<APILoginFunctionReturn>;
|
||||
/**
|
||||
@ -1113,6 +1114,7 @@ export type HandleSocialDbFunctionParams = {
|
||||
supEmail?: string;
|
||||
additionalFields?: string[];
|
||||
debug?: boolean;
|
||||
loginOnly?: boolean;
|
||||
};
|
||||
export type HandleSocialDbFunctionReturn = {
|
||||
success: boolean;
|
||||
|
@ -19,6 +19,7 @@ type Param = {
|
||||
apiUserID?: string | number;
|
||||
debug?: boolean;
|
||||
secureCookie?: boolean;
|
||||
loginOnly?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -36,6 +37,7 @@ export default async function googleAuth({
|
||||
apiUserID,
|
||||
debug,
|
||||
secureCookie,
|
||||
loginOnly,
|
||||
}: Param): Promise<APILoginFunctionReturn> {
|
||||
const grabedHostNames = grabHostNames({
|
||||
userId: apiUserID || process.env.DSQL_API_USER_ID,
|
||||
|
@ -24,6 +24,7 @@ export default async function handleSocialDb({
|
||||
supEmail,
|
||||
additionalFields,
|
||||
debug,
|
||||
loginOnly,
|
||||
}: HandleSocialDbFunctionParams): Promise<APILoginFunctionReturn> {
|
||||
try {
|
||||
const finalDbName = global.DSQL_USE_LOCAL
|
||||
@ -73,6 +74,12 @@ export default async function handleSocialDb({
|
||||
additionalFields,
|
||||
debug,
|
||||
});
|
||||
} else if (loginOnly) {
|
||||
return {
|
||||
success: false,
|
||||
payload: null,
|
||||
msg: "User Does not Exist",
|
||||
};
|
||||
}
|
||||
|
||||
const finalEmail = email ? email : supEmail ? supEmail : null;
|
||||
|
@ -16,6 +16,7 @@ export default async function apiGoogleLogin({
|
||||
additionalFields,
|
||||
additionalData,
|
||||
debug,
|
||||
loginOnly,
|
||||
}: APIGoogleLoginFunctionParams): Promise<APILoginFunctionReturn> {
|
||||
try {
|
||||
const gUser: GoogleOauth2User | undefined = await new Promise(
|
||||
@ -77,6 +78,7 @@ export default async function apiGoogleLogin({
|
||||
social_id: sub,
|
||||
additionalFields,
|
||||
debug,
|
||||
loginOnly,
|
||||
});
|
||||
|
||||
////////////////////////////////////////
|
||||
|
@ -1266,6 +1266,7 @@ export type APIGoogleLoginFunctionParams = {
|
||||
additionalFields?: string[];
|
||||
additionalData?: { [key: string]: string | number };
|
||||
debug?: boolean;
|
||||
loginOnly?: boolean;
|
||||
};
|
||||
|
||||
export type APIGoogleLoginFunction = (
|
||||
@ -1285,6 +1286,7 @@ export type HandleSocialDbFunctionParams = {
|
||||
supEmail?: string;
|
||||
additionalFields?: string[];
|
||||
debug?: boolean;
|
||||
loginOnly?: boolean;
|
||||
};
|
||||
|
||||
export type HandleSocialDbFunctionReturn = {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@moduletrace/datasquirel",
|
||||
"version": "4.4.9",
|
||||
"version": "4.5.0",
|
||||
"description": "Cloud-based SQL data management tool",
|
||||
"main": "dist/index.js",
|
||||
"bin": {
|
||||
|
Loading…
Reference in New Issue
Block a user