Remove all 'useLocal' params

This commit is contained in:
Benjamin Toby
2025-01-20 09:12:43 +01:00
parent 16191975f9
commit 7d0f3e12f3
113 changed files with 164 additions and 425 deletions
+1 -2
View File
@@ -7,10 +7,9 @@ type Param = {
encryptionSalt?: string;
user_id?: string | number;
apiUserId?: string | number;
useLocal?: boolean;
};
/**
* # Add User to Database
*/
export default function addUser({ key, payload, database, encryptionKey, user_id, useLocal, apiUserId, }: Param): Promise<AddUserFunctionReturn>;
export default function addUser({ key, payload, database, encryptionKey, user_id, apiUserId, }: Param): Promise<AddUserFunctionReturn>;
export {};
+2 -3
View File
@@ -21,7 +21,7 @@ const api_create_user_1 = __importDefault(require("../package-shared/functions/a
* # Add User to Database
*/
function addUser(_a) {
return __awaiter(this, arguments, void 0, function* ({ key, payload, database, encryptionKey, user_id, useLocal, apiUserId, }) {
return __awaiter(this, arguments, void 0, function* ({ key, payload, database, encryptionKey, user_id, apiUserId, }) {
/**
* Check for local DB settings
*
@@ -34,7 +34,7 @@ function addUser(_a) {
(DSQL_DB_USERNAME === null || DSQL_DB_USERNAME === void 0 ? void 0 : DSQL_DB_USERNAME.match(/./)) &&
(DSQL_DB_PASSWORD === null || DSQL_DB_PASSWORD === void 0 ? void 0 : DSQL_DB_PASSWORD.match(/./)) &&
(DSQL_DB_NAME === null || DSQL_DB_NAME === void 0 ? void 0 : DSQL_DB_NAME.match(/./)) &&
useLocal) {
global.DSQL_USE_LOCAL) {
/** @type {import("../package-shared/types").DSQL_DatabaseSchemaType | undefined} */
let dbSchema;
try {
@@ -47,7 +47,6 @@ function addUser(_a) {
encryptionKey,
payload,
userId: apiUserId,
useLocal,
});
}
/**
+1 -2
View File
@@ -4,10 +4,9 @@ type Param = {
database?: string;
deletedUserId: string | number;
user_id?: boolean;
useLocal?: boolean;
};
/**
* # Update User
*/
export default function deleteUser({ key, database, user_id, useLocal, deletedUserId, }: Param): Promise<UpdateUserFunctionReturn>;
export default function deleteUser({ key, database, user_id, deletedUserId, }: Param): Promise<UpdateUserFunctionReturn>;
export {};
+2 -3
View File
@@ -21,7 +21,7 @@ const api_delete_user_1 = __importDefault(require("../package-shared/functions/a
* # Update User
*/
function deleteUser(_a) {
return __awaiter(this, arguments, void 0, function* ({ key, database, user_id, useLocal, deletedUserId, }) {
return __awaiter(this, arguments, void 0, function* ({ key, database, user_id, deletedUserId, }) {
/**
* Check for local DB settings
*
@@ -34,7 +34,7 @@ function deleteUser(_a) {
(DSQL_DB_USERNAME === null || DSQL_DB_USERNAME === void 0 ? void 0 : DSQL_DB_USERNAME.match(/./)) &&
(DSQL_DB_PASSWORD === null || DSQL_DB_PASSWORD === void 0 ? void 0 : DSQL_DB_PASSWORD.match(/./)) &&
(DSQL_DB_NAME === null || DSQL_DB_NAME === void 0 ? void 0 : DSQL_DB_NAME.match(/./)) &&
useLocal) {
global.DSQL_USE_LOCAL) {
/** @type {import("../package-shared/types").DSQL_DatabaseSchemaType | undefined} */
let dbSchema;
try {
@@ -44,7 +44,6 @@ function deleteUser(_a) {
catch (error) { }
return yield (0, api_delete_user_1.default)({
dbFullName: DSQL_DB_NAME,
useLocal,
deletedUserId,
});
}
+1 -2
View File
@@ -5,7 +5,6 @@ type Param = {
encryptionKey: string;
encryptionSalt: string;
database: string;
useLocal?: boolean;
};
type Return = {
key: string | undefined;
@@ -17,5 +16,5 @@ type Return = {
* @description This Function takes in a request object and returns a user token
* string and csrf token string
*/
export default function getToken({ request, encryptionKey, encryptionSalt, database, useLocal, cookieString, }: Param): Return;
export default function getToken({ request, encryptionKey, encryptionSalt, cookieString, }: Param): Return;
export {};
+1 -1
View File
@@ -13,7 +13,7 @@ const parseCookies_1 = __importDefault(require("../package-shared/utils/backend/
* @description This Function takes in a request object and returns a user token
* string and csrf token string
*/
function getToken({ request, encryptionKey, encryptionSalt, database, useLocal, cookieString, }) {
function getToken({ request, encryptionKey, encryptionSalt, cookieString, }) {
try {
/**
* Grab the payload
+1 -2
View File
@@ -5,10 +5,9 @@ type Param = {
userId: number;
fields?: string[];
apiUserId?: boolean;
useLocal?: boolean;
};
/**
* # Get User
*/
export default function getUser({ key, userId, database, fields, apiUserId, useLocal, }: Param): Promise<GetUserFunctionReturn>;
export default function getUser({ key, userId, database, fields, apiUserId, }: Param): Promise<GetUserFunctionReturn>;
export {};
+2 -3
View File
@@ -21,7 +21,7 @@ const api_get_user_1 = __importDefault(require("../package-shared/functions/api/
* # Get User
*/
function getUser(_a) {
return __awaiter(this, arguments, void 0, function* ({ key, userId, database, fields, apiUserId, useLocal, }) {
return __awaiter(this, arguments, void 0, function* ({ key, userId, database, fields, apiUserId, }) {
/**
* Initialize
*/
@@ -59,7 +59,7 @@ function getUser(_a) {
(DSQL_DB_USERNAME === null || DSQL_DB_USERNAME === void 0 ? void 0 : DSQL_DB_USERNAME.match(/./)) &&
(DSQL_DB_PASSWORD === null || DSQL_DB_PASSWORD === void 0 ? void 0 : DSQL_DB_PASSWORD.match(/./)) &&
(DSQL_DB_NAME === null || DSQL_DB_NAME === void 0 ? void 0 : DSQL_DB_NAME.match(/./)) &&
useLocal) {
global.DSQL_USE_LOCAL) {
/** @type {import("../package-shared/types").DSQL_DatabaseSchemaType | undefined} */
let dbSchema;
try {
@@ -71,7 +71,6 @@ function getUser(_a) {
userId,
fields: [...new Set(updatedFields)],
dbFullName: DSQL_DB_NAME,
useLocal,
});
}
/**
+1 -2
View File
@@ -20,7 +20,6 @@ type Param = {
token?: boolean;
user_id?: string | number;
skipPassword?: boolean;
useLocal?: boolean;
debug?: boolean;
skipWriteAuthFile?: boolean;
apiUserID?: string | number;
@@ -29,5 +28,5 @@ type Param = {
/**
* # Login A user
*/
export default function loginUser({ key, payload, database, additionalFields, response, encryptionKey, encryptionSalt, email_login, email_login_code, temp_code_field, token, user_id, skipPassword, useLocal, apiUserID, skipWriteAuthFile, dbUserId, debug, }: Param): Promise<APILoginFunctionReturn>;
export default function loginUser({ key, payload, database, additionalFields, response, encryptionKey, encryptionSalt, email_login, email_login_code, temp_code_field, token, user_id, skipPassword, apiUserID, skipWriteAuthFile, dbUserId, debug, }: Param): Promise<APILoginFunctionReturn>;
export {};
+2 -3
View File
@@ -24,7 +24,7 @@ const write_auth_files_1 = require("../package-shared/functions/backend/auth/wri
* # Login A user
*/
function loginUser(_a) {
return __awaiter(this, arguments, void 0, function* ({ key, payload, database, additionalFields, response, encryptionKey, encryptionSalt, email_login, email_login_code, temp_code_field, token, user_id, skipPassword, useLocal, apiUserID, skipWriteAuthFile, dbUserId, debug, }) {
return __awaiter(this, arguments, void 0, function* ({ key, payload, database, additionalFields, response, encryptionKey, encryptionSalt, email_login, email_login_code, temp_code_field, token, user_id, skipPassword, apiUserID, skipWriteAuthFile, dbUserId, debug, }) {
var _b;
const grabedHostNames = (0, grab_host_names_1.default)({ userId: user_id || apiUserID });
const { host, port, scheme } = grabedHostNames;
@@ -81,7 +81,7 @@ function loginUser(_a) {
(DSQL_DB_USERNAME === null || DSQL_DB_USERNAME === void 0 ? void 0 : DSQL_DB_USERNAME.match(/./)) &&
(DSQL_DB_PASSWORD === null || DSQL_DB_PASSWORD === void 0 ? void 0 : DSQL_DB_PASSWORD.match(/./)) &&
(DSQL_DB_NAME === null || DSQL_DB_NAME === void 0 ? void 0 : DSQL_DB_NAME.match(/./)) &&
useLocal) {
global.DSQL_USE_LOCAL) {
let dbSchema;
try {
const localDbSchemaPath = path_1.default.resolve(process.cwd(), "dsql.schema.json");
@@ -100,7 +100,6 @@ function loginUser(_a) {
email_login_code,
email_login_field: emailLoginTempCodeFieldName,
token,
useLocal,
dbUserId,
debug,
});
+1 -2
View File
@@ -11,10 +11,9 @@ type Param = {
additionalFields?: string[];
encryptedUserString?: string;
user_id?: string | number;
useLocal?: boolean;
};
/**
* # Reauthorize User
*/
export default function reauthUser({ key, database, response, request, level, encryptionKey, encryptionSalt, additionalFields, encryptedUserString, user_id, useLocal, }: Param): Promise<APILoginFunctionReturn>;
export default function reauthUser({ key, database, response, request, level, encryptionKey, encryptionSalt, additionalFields, encryptedUserString, user_id, }: Param): Promise<APILoginFunctionReturn>;
export {};
+2 -3
View File
@@ -25,7 +25,7 @@ const get_auth_cookie_names_1 = __importDefault(require("../package-shared/funct
* # Reauthorize User
*/
function reauthUser(_a) {
return __awaiter(this, arguments, void 0, function* ({ key, database, response, request, level, encryptionKey, encryptionSalt, additionalFields, encryptedUserString, user_id, useLocal, }) {
return __awaiter(this, arguments, void 0, function* ({ key, database, response, request, level, encryptionKey, encryptionSalt, additionalFields, encryptedUserString, user_id, }) {
var _b, _c;
/**
* Check Encryption Keys
@@ -65,7 +65,7 @@ function reauthUser(_a) {
(DSQL_DB_USERNAME === null || DSQL_DB_USERNAME === void 0 ? void 0 : DSQL_DB_USERNAME.match(/./)) &&
(DSQL_DB_PASSWORD === null || DSQL_DB_PASSWORD === void 0 ? void 0 : DSQL_DB_PASSWORD.match(/./)) &&
(DSQL_DB_NAME === null || DSQL_DB_NAME === void 0 ? void 0 : DSQL_DB_NAME.match(/./)) &&
useLocal) {
global.DSQL_USE_LOCAL) {
/** @type {import("../package-shared/types").DSQL_DatabaseSchemaType | undefined} */
let dbSchema;
try {
@@ -76,7 +76,6 @@ function reauthUser(_a) {
httpResponse = yield (0, api_reauth_user_1.default)({
existingUser: existingUser.payload,
additionalFields,
useLocal,
});
}
else {
+1 -2
View File
@@ -14,11 +14,10 @@ type Param = {
mail_port?: number;
sender?: string;
user_id?: boolean;
useLocal?: boolean;
extraCookies?: import("../package-shared/types").CookieObject[];
};
/**
* # Send Email Code to a User
*/
export default function sendEmailCode({ key, email, database, temp_code_field_name, mail_domain, mail_password, mail_username, mail_port, sender, user_id, useLocal, response, extraCookies, }: Param): Promise<SendOneTimeCodeEmailResponse>;
export default function sendEmailCode({ key, email, database, temp_code_field_name, mail_domain, mail_password, mail_username, mail_port, sender, user_id, response, extraCookies, }: Param): Promise<SendOneTimeCodeEmailResponse>;
export {};
+2 -3
View File
@@ -21,7 +21,7 @@ const api_send_email_code_1 = __importDefault(require("../package-shared/functio
* # Send Email Code to a User
*/
function sendEmailCode(_a) {
return __awaiter(this, arguments, void 0, function* ({ key, email, database, temp_code_field_name, mail_domain, mail_password, mail_username, mail_port, sender, user_id, useLocal, response, extraCookies, }) {
return __awaiter(this, arguments, void 0, function* ({ key, email, database, temp_code_field_name, mail_domain, mail_password, mail_username, mail_port, sender, user_id, response, extraCookies, }) {
const grabedHostNames = (0, grab_host_names_1.default)();
const { host, port, scheme } = grabedHostNames;
const defaultTempLoginFieldName = "temp_login_code";
@@ -39,7 +39,7 @@ function sendEmailCode(_a) {
(DSQL_DB_USERNAME === null || DSQL_DB_USERNAME === void 0 ? void 0 : DSQL_DB_USERNAME.match(/./)) &&
(DSQL_DB_PASSWORD === null || DSQL_DB_PASSWORD === void 0 ? void 0 : DSQL_DB_PASSWORD.match(/./)) &&
(DSQL_DB_NAME === null || DSQL_DB_NAME === void 0 ? void 0 : DSQL_DB_NAME.match(/./)) &&
useLocal) {
global.DSQL_USE_LOCAL) {
/** @type {import("../package-shared/types").DSQL_DatabaseSchemaType | undefined} */
let dbSchema;
try {
@@ -57,7 +57,6 @@ function sendEmailCode(_a) {
mail_port,
mail_username,
sender,
useLocal,
response,
extraCookies,
});
+1 -2
View File
@@ -12,11 +12,10 @@ type Param = {
[s: string]: string | number;
};
apiUserID?: string | number;
useLocal?: boolean;
debug?: boolean;
};
/**
* # SERVER FUNCTION: Login with google Function
*/
export default function googleAuth({ key, token, database, response, encryptionKey, encryptionSalt, additionalFields, additionalData, apiUserID, useLocal, debug, }: Param): Promise<APILoginFunctionReturn>;
export default function googleAuth({ key, token, database, response, encryptionKey, encryptionSalt, additionalFields, additionalData, apiUserID, debug, }: Param): Promise<APILoginFunctionReturn>;
export {};
+2 -3
View File
@@ -22,7 +22,7 @@ const write_auth_files_1 = require("../../package-shared/functions/backend/auth/
* # 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, useLocal, debug, }) {
return __awaiter(this, arguments, void 0, function* ({ key, token, database, response, encryptionKey, encryptionSalt, additionalFields, additionalData, apiUserID, debug, }) {
var _b;
const grabedHostNames = (0, grab_host_names_1.default)();
const { host, port, scheme } = grabedHostNames;
@@ -72,7 +72,7 @@ function googleAuth(_a) {
(DSQL_DB_USERNAME === null || DSQL_DB_USERNAME === void 0 ? void 0 : DSQL_DB_USERNAME.match(/./)) &&
(DSQL_DB_PASSWORD === null || DSQL_DB_PASSWORD === void 0 ? void 0 : DSQL_DB_PASSWORD.match(/./)) &&
(DSQL_DB_NAME === null || DSQL_DB_NAME === void 0 ? void 0 : DSQL_DB_NAME.match(/./)) &&
useLocal) {
global.DSQL_USE_LOCAL) {
if (debug) {
console.log(`Google login with Local Paradigm ...`);
}
@@ -81,7 +81,6 @@ function googleAuth(_a) {
additionalFields,
additionalData,
debug,
useLocal: true,
});
}
else {
+1 -2
View File
@@ -7,10 +7,9 @@ type Param = {
[s: string]: any;
};
user_id?: boolean;
useLocal?: boolean;
};
/**
* # Update User
*/
export default function updateUser({ key, payload, database, user_id, useLocal, updatedUserId, }: Param): Promise<UpdateUserFunctionReturn>;
export default function updateUser({ key, payload, database, user_id, updatedUserId, }: Param): Promise<UpdateUserFunctionReturn>;
export {};
+2 -3
View File
@@ -21,7 +21,7 @@ const api_update_user_1 = __importDefault(require("../package-shared/functions/a
* # Update User
*/
function updateUser(_a) {
return __awaiter(this, arguments, void 0, function* ({ key, payload, database, user_id, useLocal, updatedUserId, }) {
return __awaiter(this, arguments, void 0, function* ({ key, payload, database, user_id, updatedUserId, }) {
/**
* Check for local DB settings
*
@@ -34,7 +34,7 @@ function updateUser(_a) {
(DSQL_DB_USERNAME === null || DSQL_DB_USERNAME === void 0 ? void 0 : DSQL_DB_USERNAME.match(/./)) &&
(DSQL_DB_PASSWORD === null || DSQL_DB_PASSWORD === void 0 ? void 0 : DSQL_DB_PASSWORD.match(/./)) &&
(DSQL_DB_NAME === null || DSQL_DB_NAME === void 0 ? void 0 : DSQL_DB_NAME.match(/./)) &&
useLocal) {
global.DSQL_USE_LOCAL) {
/** @type {import("../package-shared/types").DSQL_DatabaseSchemaType | undefined} */
let dbSchema;
try {
@@ -45,7 +45,6 @@ function updateUser(_a) {
return yield (0, api_update_user_1.default)({
payload: payload,
dbFullName: DSQL_DB_NAME,
useLocal,
updatedUserId,
dbSchema,
});