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