This commit is contained in:
Benjamin Toby
2024-12-06 11:44:26 +01:00
parent 1ab41929b2
commit c49513c189
54 changed files with 628 additions and 425 deletions
+14 -14
View File
@@ -1,28 +1,28 @@
export = addUser;
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/**
* Add User to Database
* ==============================================================================
* ============================================
* @async
*
* @param {object} props - Single object passed
* @param {string} props.key - FULL ACCESS API Key
* @param {string} props.database - Database Name
* @param {import("../package-shared/types").UserDataPayload} props.payload - User Data Payload
* @param {string} props.encryptionKey
* @param {string} [props.encryptionSalt]
* @param {object} param - Single object passed
* @param {string} param.key - FULL ACCESS API Key
* @param {string} param.database - Database Name
* @param {import("../package-shared/types").UserDataPayload} param.payload - User Data Payload
* @param {string} param.encryptionKey
* @param {string} [param.encryptionSalt]
* @param {string | number} [param.user_id]
* @param {string | number} param.apiUserId
* @param {boolean} [param.useLocal]
*
* @returns { Promise<import("../package-shared/types").AddUserFunctionReturn> }
*/
declare function addUser({ key, payload, database, encryptionKey, encryptionSalt, }: {
declare function addUser({ key, payload, database, encryptionKey, user_id, useLocal, apiUserId, }: {
key: string;
database: string;
payload: import("../package-shared/types").UserDataPayload;
encryptionKey: string;
encryptionSalt?: string;
user_id?: string | number;
apiUserId: string | number;
useLocal?: boolean;
}): Promise<import("../package-shared/types").AddUserFunctionReturn>;
+7 -7
View File
@@ -1,10 +1,4 @@
export = loginUser;
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/**
* Login A user
* ==============================================================================
@@ -26,10 +20,13 @@ export = loginUser;
* @param {string} [params.email_login_code] - Email login code
* @param {string} [params.temp_code_field] - Database table field name for temporary code
* @param {boolean} [params.token] - Send access key as part of response body?
* @param {boolean} [params.user_id] - User ID
* @param {boolean} [params.skipPassword]
* @param {boolean} [params.useLocal]
*
* @returns { Promise<import("../package-shared/types").AuthenticatedUser>}
*/
declare function loginUser({ key, payload, database, additionalFields, response, encryptionKey, encryptionSalt, email_login, email_login_code, temp_code_field, token, }: {
declare function loginUser({ key, payload, database, additionalFields, response, encryptionKey, encryptionSalt, email_login, email_login_code, temp_code_field, token, user_id, skipPassword, useLocal, }: {
key: string;
database: string;
payload: {
@@ -45,5 +42,8 @@ declare function loginUser({ key, payload, database, additionalFields, response,
email_login_code?: string;
temp_code_field?: string;
token?: boolean;
user_id?: boolean;
skipPassword?: boolean;
useLocal?: boolean;
}): Promise<import("../package-shared/types").AuthenticatedUser>;
import http = require("http");
+3 -1
View File
@@ -21,10 +21,11 @@ export = reauthUser;
* @param {String} params.encryptionSalt - Encryption Salt
* @param {string[]} [params.additionalFields] - Additional Fields to be added to the user object
* @param {string} [params.token] - access token to use instead of getting from cookie header
* @param {boolean} [params.user_id] - User ID
*
* @returns { Promise<import("../package-shared/types").ReauthUserFunctionReturn> }
*/
declare function reauthUser({ key, database, response, request, level, encryptionKey, encryptionSalt, additionalFields, token, }: {
declare function reauthUser({ key, database, response, request, level, encryptionKey, encryptionSalt, additionalFields, token, user_id, }: {
key: string;
database: string;
response: http.ServerResponse;
@@ -34,5 +35,6 @@ declare function reauthUser({ key, database, response, request, level, encryptio
encryptionSalt: string;
additionalFields?: string[];
token?: string;
user_id?: boolean;
}): Promise<import("../package-shared/types").ReauthUserFunctionReturn>;
import http = require("http");
+3 -1
View File
@@ -23,10 +23,11 @@ export = sendEmailCode;
* @param {string} [params.mail_password]
* @param {number} [params.mail_port]
* @param {string} [params.sender]
* @param {boolean} [params.user_id] - User ID
*
* @returns { Promise<boolean>}
*/
declare function sendEmailCode({ key, email, database, encryptionKey, encryptionSalt, temp_code_field, mail_domain, mail_password, mail_username, mail_port, sender, }: {
declare function sendEmailCode({ key, email, database, encryptionKey, encryptionSalt, temp_code_field, mail_domain, mail_password, mail_username, mail_port, sender, user_id, }: {
key: string;
database: string;
email: string;
@@ -39,5 +40,6 @@ declare function sendEmailCode({ key, email, database, encryptionKey, encryption
mail_password?: string;
mail_port?: number;
sender?: string;
user_id?: boolean;
}): Promise<boolean>;
import http = require("http");
+3 -1
View File
@@ -29,10 +29,11 @@ export = githubAuth;
* @param {string} params.encryptionKey - Encryption key
* @param {string} params.encryptionSalt - Encryption salt
* @param {object} [params.additionalFields] - Additional Fields to be added to the user object
* @param {boolean} [params.user_id] - User ID
*
* @returns { Promise<FunctionReturn | undefined> }
*/
declare function githubAuth({ key, code, email, database, clientId, clientSecret, response, encryptionKey, encryptionSalt, additionalFields, }: {
declare function githubAuth({ key, code, email, database, clientId, clientSecret, response, encryptionKey, encryptionSalt, additionalFields, user_id, }: {
key: string;
code: string;
email: string | null;
@@ -43,6 +44,7 @@ declare function githubAuth({ key, code, email, database, clientId, clientSecret
encryptionKey: string;
encryptionSalt: string;
additionalFields?: object;
user_id?: boolean;
}): Promise<FunctionReturn | undefined>;
declare namespace githubAuth {
export { FunctionReturn };
+7 -1
View File
@@ -27,10 +27,13 @@ export = googleAuth;
* @param {string} params.encryptionKey - Encryption key
* @param {string} params.encryptionSalt - Encryption salt
* @param {object} [params.additionalFields] - Additional Fields to be added to the user object
* @param {boolean} [params.user_id] - User ID
* @param {string | number} [params.apiUserID] - Required for Local
* @param {boolean} [params.useLocal] - Whether to use a remote database instead of API
*
* @returns { Promise<FunctionReturn> }
*/
declare function googleAuth({ key, token, database, clientId, response, encryptionKey, encryptionSalt, additionalFields, }: {
declare function googleAuth({ key, token, database, clientId, response, encryptionKey, encryptionSalt, additionalFields, user_id, apiUserID, useLocal, }: {
key: string;
token: string;
database: string;
@@ -39,6 +42,9 @@ declare function googleAuth({ key, token, database, clientId, response, encrypti
encryptionKey: string;
encryptionSalt: string;
additionalFields?: object;
user_id?: boolean;
apiUserID?: string | number;
useLocal?: boolean;
}): Promise<FunctionReturn>;
declare namespace googleAuth {
export { FunctionReturn };
+4 -10
View File
@@ -1,24 +1,17 @@
export = updateUser;
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/**
* ==============================================================================
* Main Function
* ==============================================================================
* # Update User
* @async
*
* @param {object} params - API Key
* @param {String} params.key - API Key
* @param {String} params.database - Target Database
* @param {{ id: number } & Object.<string, any>} params.payload - User Object: ID is required
* @param {boolean} [params.user_id] - User ID
*
* @returns { Promise<import("../package-shared/types").UpdateUserFunctionReturn>}
*/
declare function updateUser({ key, payload, database }: {
declare function updateUser({ key, payload, database, user_id }: {
key: string;
database: string;
payload: {
@@ -26,4 +19,5 @@ declare function updateUser({ key, payload, database }: {
} & {
[x: string]: any;
};
user_id?: boolean;
}): Promise<import("../package-shared/types").UpdateUserFunctionReturn>;