Updates
This commit is contained in:
parent
05d6d13ef0
commit
5a4d4448a5
@ -2,4 +2,4 @@ import { APIResponseObject, GoogleAuthParams } from "../../../types";
|
||||
/**
|
||||
* # SERVER FUNCTION: Login with google Function
|
||||
*/
|
||||
export default function googleAuth({ apiKey, token, database, response, encryptionKey, encryptionSalt, additionalFields, additionalData, apiUserID, debug, secureCookie, loginOnly, useLocal, apiVersion, skipWriteAuthFile, cleanupTokens, }: GoogleAuthParams): Promise<APIResponseObject>;
|
||||
export default function googleAuth({ apiKey, token, database, response, encryptionKey, encryptionSalt, additionalFields, additionalData, debug, secureCookie, loginOnly, useLocal, apiVersion, skipWriteAuthFile, cleanupTokens, }: GoogleAuthParams): Promise<APIResponseObject>;
|
||||
|
@ -21,7 +21,7 @@ const post_login_response_handler_1 = __importDefault(require("../../../function
|
||||
* # SERVER FUNCTION: Login with google Function
|
||||
*/
|
||||
function googleAuth(_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ apiKey, token, database, response, encryptionKey, encryptionSalt, additionalFields, additionalData, apiUserID, debug, secureCookie, loginOnly, useLocal, apiVersion, skipWriteAuthFile, cleanupTokens, }) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ apiKey, token, database, response, encryptionKey, encryptionSalt, additionalFields, additionalData, debug, secureCookie, loginOnly, useLocal, apiVersion, skipWriteAuthFile, cleanupTokens, }) {
|
||||
const finalEncryptionKey = encryptionKey || process.env.DSQL_ENCRYPTION_PASSWORD;
|
||||
const finalEncryptionSalt = encryptionSalt || process.env.DSQL_ENCRYPTION_SALT;
|
||||
if (!(finalEncryptionKey === null || finalEncryptionKey === void 0 ? void 0 : finalEncryptionKey.match(/.{8,}/))) {
|
||||
@ -65,7 +65,6 @@ function googleAuth(_a) {
|
||||
debug,
|
||||
loginOnly,
|
||||
database,
|
||||
apiUserId: apiUserID || process.env.DSQL_API_USER_ID,
|
||||
};
|
||||
if (useLocal) {
|
||||
if (debug) {
|
||||
|
@ -2,4 +2,4 @@ import { APIResponseObject, HandleSocialDbFunctionParams } from "../../../types"
|
||||
/**
|
||||
* # Handle Social DB
|
||||
*/
|
||||
export default function handleSocialDb({ database, email, social_platform, payload, invitation, supEmail, additionalFields, debug, loginOnly, apiUserId, }: HandleSocialDbFunctionParams): Promise<APIResponseObject>;
|
||||
export default function handleSocialDb({ database, email, social_platform, payload, invitation, supEmail, additionalFields, debug, loginOnly, }: HandleSocialDbFunctionParams): Promise<APIResponseObject>;
|
||||
|
@ -19,18 +19,14 @@ const dbHandler_1 = __importDefault(require("../../backend/dbHandler"));
|
||||
const encrypt_1 = __importDefault(require("../../dsql/encrypt"));
|
||||
const addDbEntry_1 = __importDefault(require("../../backend/db/addDbEntry"));
|
||||
const loginSocialUser_1 = __importDefault(require("./loginSocialUser"));
|
||||
const grab_db_full_name_1 = __importDefault(require("../../../utils/grab-db-full-name"));
|
||||
/**
|
||||
* # Handle Social DB
|
||||
*/
|
||||
function handleSocialDb(_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ database, email, social_platform, payload, invitation, supEmail, additionalFields, debug, loginOnly, apiUserId, }) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ database, email, social_platform, payload, invitation, supEmail, additionalFields, debug, loginOnly, }) {
|
||||
var _b;
|
||||
try {
|
||||
const finalDbName = (0, grab_db_full_name_1.default)({
|
||||
dbName: database,
|
||||
userId: apiUserId,
|
||||
});
|
||||
const finalDbName = database;
|
||||
const existingSocialUserQUery = `SELECT * FROM users WHERE email = ? AND social_login='1' AND social_platform = ? `;
|
||||
const existingSocialUserValues = [email, social_platform];
|
||||
if (debug) {
|
||||
|
@ -3,4 +3,4 @@ import { APIResponseObject } from "../../../../types";
|
||||
/**
|
||||
* # API google login
|
||||
*/
|
||||
export default function apiGoogleLogin({ token, database, additionalFields, additionalData, debug, loginOnly, apiUserId, }: APIGoogleLoginFunctionParams): Promise<APIResponseObject>;
|
||||
export default function apiGoogleLogin({ token, database, additionalFields, additionalData, debug, loginOnly, }: APIGoogleLoginFunctionParams): Promise<APIResponseObject>;
|
||||
|
@ -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, loginOnly, apiUserId, }) {
|
||||
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,7 +71,6 @@ function apiGoogleLogin(_a) {
|
||||
additionalFields,
|
||||
debug,
|
||||
loginOnly,
|
||||
apiUserId,
|
||||
});
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
|
3
dist/package-shared/types/index.d.ts
vendored
3
dist/package-shared/types/index.d.ts
vendored
@ -968,7 +968,6 @@ export type APIGoogleLoginFunctionParams = {
|
||||
};
|
||||
debug?: boolean;
|
||||
loginOnly?: boolean;
|
||||
apiUserId?: string | number;
|
||||
};
|
||||
export type APIGoogleLoginFunction = (params: APIGoogleLoginFunctionParams) => Promise<APILoginFunctionReturn>;
|
||||
/**
|
||||
@ -985,7 +984,6 @@ export type HandleSocialDbFunctionParams = {
|
||||
debug?: boolean;
|
||||
loginOnly?: boolean;
|
||||
social_id?: string | number;
|
||||
apiUserId?: string | number;
|
||||
};
|
||||
export type HandleSocialDbFunctionReturn = {
|
||||
success: boolean;
|
||||
@ -1925,7 +1923,6 @@ export type GoogleAuthParams = {
|
||||
additionalData?: {
|
||||
[s: string]: string | number;
|
||||
};
|
||||
apiUserID?: string | number;
|
||||
debug?: boolean;
|
||||
secureCookie?: boolean;
|
||||
loginOnly?: boolean;
|
||||
|
@ -20,7 +20,6 @@ export default async function googleAuth({
|
||||
encryptionSalt,
|
||||
additionalFields,
|
||||
additionalData,
|
||||
apiUserID,
|
||||
debug,
|
||||
secureCookie,
|
||||
loginOnly,
|
||||
@ -80,7 +79,6 @@ export default async function googleAuth({
|
||||
debug,
|
||||
loginOnly,
|
||||
database,
|
||||
apiUserId: apiUserID || process.env.DSQL_API_USER_ID,
|
||||
};
|
||||
|
||||
if (useLocal) {
|
||||
|
@ -23,13 +23,9 @@ export default async function handleSocialDb({
|
||||
additionalFields,
|
||||
debug,
|
||||
loginOnly,
|
||||
apiUserId,
|
||||
}: HandleSocialDbFunctionParams): Promise<APIResponseObject> {
|
||||
try {
|
||||
const finalDbName = grabDbFullName({
|
||||
dbName: database,
|
||||
userId: apiUserId,
|
||||
});
|
||||
const finalDbName = database;
|
||||
|
||||
const existingSocialUserQUery = `SELECT * FROM users WHERE email = ? AND social_login='1' AND social_platform = ? `;
|
||||
const existingSocialUserValues = [email, social_platform];
|
||||
|
@ -17,7 +17,6 @@ export default async function apiGoogleLogin({
|
||||
additionalData,
|
||||
debug,
|
||||
loginOnly,
|
||||
apiUserId,
|
||||
}: APIGoogleLoginFunctionParams): Promise<APIResponseObject> {
|
||||
try {
|
||||
const gUser: GoogleOauth2User | undefined = await new Promise(
|
||||
@ -79,7 +78,6 @@ export default async function apiGoogleLogin({
|
||||
additionalFields,
|
||||
debug,
|
||||
loginOnly,
|
||||
apiUserId,
|
||||
});
|
||||
|
||||
////////////////////////////////////////
|
||||
|
@ -1170,7 +1170,6 @@ export type APIGoogleLoginFunctionParams = {
|
||||
additionalData?: { [key: string]: string | number };
|
||||
debug?: boolean;
|
||||
loginOnly?: boolean;
|
||||
apiUserId?: string | number;
|
||||
};
|
||||
|
||||
export type APIGoogleLoginFunction = (
|
||||
@ -1191,7 +1190,6 @@ export type HandleSocialDbFunctionParams = {
|
||||
debug?: boolean;
|
||||
loginOnly?: boolean;
|
||||
social_id?: string | number;
|
||||
apiUserId?: string | number;
|
||||
};
|
||||
|
||||
export type HandleSocialDbFunctionReturn = {
|
||||
@ -2478,7 +2476,6 @@ export type GoogleAuthParams = {
|
||||
encryptionSalt?: string;
|
||||
additionalFields?: string[];
|
||||
additionalData?: { [s: string]: string | number };
|
||||
apiUserID?: string | number;
|
||||
debug?: boolean;
|
||||
secureCookie?: boolean;
|
||||
loginOnly?: boolean;
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@moduletrace/datasquirel",
|
||||
"version": "5.0.6",
|
||||
"version": "5.0.7",
|
||||
"description": "Cloud-based SQL data management tool",
|
||||
"main": "dist/index.js",
|
||||
"bin": {
|
||||
|
Loading…
Reference in New Issue
Block a user