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
|
* # 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
|
* # SERVER FUNCTION: Login with google Function
|
||||||
*/
|
*/
|
||||||
function googleAuth(_a) {
|
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 finalEncryptionKey = encryptionKey || process.env.DSQL_ENCRYPTION_PASSWORD;
|
||||||
const finalEncryptionSalt = encryptionSalt || process.env.DSQL_ENCRYPTION_SALT;
|
const finalEncryptionSalt = encryptionSalt || process.env.DSQL_ENCRYPTION_SALT;
|
||||||
if (!(finalEncryptionKey === null || finalEncryptionKey === void 0 ? void 0 : finalEncryptionKey.match(/.{8,}/))) {
|
if (!(finalEncryptionKey === null || finalEncryptionKey === void 0 ? void 0 : finalEncryptionKey.match(/.{8,}/))) {
|
||||||
@ -65,7 +65,6 @@ function googleAuth(_a) {
|
|||||||
debug,
|
debug,
|
||||||
loginOnly,
|
loginOnly,
|
||||||
database,
|
database,
|
||||||
apiUserId: apiUserID || process.env.DSQL_API_USER_ID,
|
|
||||||
};
|
};
|
||||||
if (useLocal) {
|
if (useLocal) {
|
||||||
if (debug) {
|
if (debug) {
|
||||||
|
@ -2,4 +2,4 @@ import { APIResponseObject, HandleSocialDbFunctionParams } from "../../../types"
|
|||||||
/**
|
/**
|
||||||
* # Handle Social DB
|
* # 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 encrypt_1 = __importDefault(require("../../dsql/encrypt"));
|
||||||
const addDbEntry_1 = __importDefault(require("../../backend/db/addDbEntry"));
|
const addDbEntry_1 = __importDefault(require("../../backend/db/addDbEntry"));
|
||||||
const loginSocialUser_1 = __importDefault(require("./loginSocialUser"));
|
const loginSocialUser_1 = __importDefault(require("./loginSocialUser"));
|
||||||
const grab_db_full_name_1 = __importDefault(require("../../../utils/grab-db-full-name"));
|
|
||||||
/**
|
/**
|
||||||
* # Handle Social DB
|
* # Handle Social DB
|
||||||
*/
|
*/
|
||||||
function handleSocialDb(_a) {
|
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;
|
var _b;
|
||||||
try {
|
try {
|
||||||
const finalDbName = (0, grab_db_full_name_1.default)({
|
const finalDbName = database;
|
||||||
dbName: database,
|
|
||||||
userId: apiUserId,
|
|
||||||
});
|
|
||||||
const existingSocialUserQUery = `SELECT * FROM users WHERE email = ? AND social_login='1' AND social_platform = ? `;
|
const existingSocialUserQUery = `SELECT * FROM users WHERE email = ? AND social_login='1' AND social_platform = ? `;
|
||||||
const existingSocialUserValues = [email, social_platform];
|
const existingSocialUserValues = [email, social_platform];
|
||||||
if (debug) {
|
if (debug) {
|
||||||
|
@ -3,4 +3,4 @@ import { APIResponseObject } from "../../../../types";
|
|||||||
/**
|
/**
|
||||||
* # API google login
|
* # 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
|
* # API google login
|
||||||
*/
|
*/
|
||||||
function apiGoogleLogin(_a) {
|
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 {
|
try {
|
||||||
const gUser = yield new Promise((resolve, reject) => {
|
const gUser = yield new Promise((resolve, reject) => {
|
||||||
https_1.default
|
https_1.default
|
||||||
@ -71,7 +71,6 @@ function apiGoogleLogin(_a) {
|
|||||||
additionalFields,
|
additionalFields,
|
||||||
debug,
|
debug,
|
||||||
loginOnly,
|
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;
|
debug?: boolean;
|
||||||
loginOnly?: boolean;
|
loginOnly?: boolean;
|
||||||
apiUserId?: string | number;
|
|
||||||
};
|
};
|
||||||
export type APIGoogleLoginFunction = (params: APIGoogleLoginFunctionParams) => Promise<APILoginFunctionReturn>;
|
export type APIGoogleLoginFunction = (params: APIGoogleLoginFunctionParams) => Promise<APILoginFunctionReturn>;
|
||||||
/**
|
/**
|
||||||
@ -985,7 +984,6 @@ export type HandleSocialDbFunctionParams = {
|
|||||||
debug?: boolean;
|
debug?: boolean;
|
||||||
loginOnly?: boolean;
|
loginOnly?: boolean;
|
||||||
social_id?: string | number;
|
social_id?: string | number;
|
||||||
apiUserId?: string | number;
|
|
||||||
};
|
};
|
||||||
export type HandleSocialDbFunctionReturn = {
|
export type HandleSocialDbFunctionReturn = {
|
||||||
success: boolean;
|
success: boolean;
|
||||||
@ -1925,7 +1923,6 @@ export type GoogleAuthParams = {
|
|||||||
additionalData?: {
|
additionalData?: {
|
||||||
[s: string]: string | number;
|
[s: string]: string | number;
|
||||||
};
|
};
|
||||||
apiUserID?: string | number;
|
|
||||||
debug?: boolean;
|
debug?: boolean;
|
||||||
secureCookie?: boolean;
|
secureCookie?: boolean;
|
||||||
loginOnly?: boolean;
|
loginOnly?: boolean;
|
||||||
|
@ -20,7 +20,6 @@ export default async function googleAuth({
|
|||||||
encryptionSalt,
|
encryptionSalt,
|
||||||
additionalFields,
|
additionalFields,
|
||||||
additionalData,
|
additionalData,
|
||||||
apiUserID,
|
|
||||||
debug,
|
debug,
|
||||||
secureCookie,
|
secureCookie,
|
||||||
loginOnly,
|
loginOnly,
|
||||||
@ -80,7 +79,6 @@ export default async function googleAuth({
|
|||||||
debug,
|
debug,
|
||||||
loginOnly,
|
loginOnly,
|
||||||
database,
|
database,
|
||||||
apiUserId: apiUserID || process.env.DSQL_API_USER_ID,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (useLocal) {
|
if (useLocal) {
|
||||||
|
@ -23,13 +23,9 @@ export default async function handleSocialDb({
|
|||||||
additionalFields,
|
additionalFields,
|
||||||
debug,
|
debug,
|
||||||
loginOnly,
|
loginOnly,
|
||||||
apiUserId,
|
|
||||||
}: HandleSocialDbFunctionParams): Promise<APIResponseObject> {
|
}: HandleSocialDbFunctionParams): Promise<APIResponseObject> {
|
||||||
try {
|
try {
|
||||||
const finalDbName = grabDbFullName({
|
const finalDbName = database;
|
||||||
dbName: database,
|
|
||||||
userId: apiUserId,
|
|
||||||
});
|
|
||||||
|
|
||||||
const existingSocialUserQUery = `SELECT * FROM users WHERE email = ? AND social_login='1' AND social_platform = ? `;
|
const existingSocialUserQUery = `SELECT * FROM users WHERE email = ? AND social_login='1' AND social_platform = ? `;
|
||||||
const existingSocialUserValues = [email, social_platform];
|
const existingSocialUserValues = [email, social_platform];
|
||||||
|
@ -17,7 +17,6 @@ export default async function apiGoogleLogin({
|
|||||||
additionalData,
|
additionalData,
|
||||||
debug,
|
debug,
|
||||||
loginOnly,
|
loginOnly,
|
||||||
apiUserId,
|
|
||||||
}: APIGoogleLoginFunctionParams): Promise<APIResponseObject> {
|
}: APIGoogleLoginFunctionParams): Promise<APIResponseObject> {
|
||||||
try {
|
try {
|
||||||
const gUser: GoogleOauth2User | undefined = await new Promise(
|
const gUser: GoogleOauth2User | undefined = await new Promise(
|
||||||
@ -79,7 +78,6 @@ export default async function apiGoogleLogin({
|
|||||||
additionalFields,
|
additionalFields,
|
||||||
debug,
|
debug,
|
||||||
loginOnly,
|
loginOnly,
|
||||||
apiUserId,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
|
@ -1170,7 +1170,6 @@ export type APIGoogleLoginFunctionParams = {
|
|||||||
additionalData?: { [key: string]: string | number };
|
additionalData?: { [key: string]: string | number };
|
||||||
debug?: boolean;
|
debug?: boolean;
|
||||||
loginOnly?: boolean;
|
loginOnly?: boolean;
|
||||||
apiUserId?: string | number;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type APIGoogleLoginFunction = (
|
export type APIGoogleLoginFunction = (
|
||||||
@ -1191,7 +1190,6 @@ export type HandleSocialDbFunctionParams = {
|
|||||||
debug?: boolean;
|
debug?: boolean;
|
||||||
loginOnly?: boolean;
|
loginOnly?: boolean;
|
||||||
social_id?: string | number;
|
social_id?: string | number;
|
||||||
apiUserId?: string | number;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type HandleSocialDbFunctionReturn = {
|
export type HandleSocialDbFunctionReturn = {
|
||||||
@ -2478,7 +2476,6 @@ export type GoogleAuthParams = {
|
|||||||
encryptionSalt?: string;
|
encryptionSalt?: string;
|
||||||
additionalFields?: string[];
|
additionalFields?: string[];
|
||||||
additionalData?: { [s: string]: string | number };
|
additionalData?: { [s: string]: string | number };
|
||||||
apiUserID?: string | number;
|
|
||||||
debug?: boolean;
|
debug?: boolean;
|
||||||
secureCookie?: boolean;
|
secureCookie?: boolean;
|
||||||
loginOnly?: boolean;
|
loginOnly?: boolean;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@moduletrace/datasquirel",
|
"name": "@moduletrace/datasquirel",
|
||||||
"version": "5.0.6",
|
"version": "5.0.7",
|
||||||
"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