update types
This commit is contained in:
parent
d9b9076bb2
commit
11a4c1f4d9
@ -1,21 +1,3 @@
|
|||||||
/**
|
|
||||||
* Type Definitions
|
|
||||||
* ===============================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {object} GoogleIdentityPromptNotification
|
|
||||||
* @property {function(): string} getMomentType - Notification moment type
|
|
||||||
* @property {function(): string} getDismissedReason - Notification get Dismissed Reason
|
|
||||||
* @property {function(): string} getNotDisplayedReason - Notification get Not Displayed Reason
|
|
||||||
* @property {function(): string} getSkippedReason - Notification get Skipped Reason
|
|
||||||
* @property {function(): boolean} isDismissedMoment - Notification is Dismissed Moment
|
|
||||||
* @property {function(): boolean} isDisplayMoment - Notification is Display Moment
|
|
||||||
* @property {function(): boolean} isDisplayed - Notification is Displayed
|
|
||||||
* @property {function(): boolean} isNotDisplayed - Notification is Not Displayed
|
|
||||||
* @property {function(): boolean} isSkippedMoment - Notification is Skipped Moment
|
|
||||||
*/
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
//////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
//////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -38,7 +20,12 @@
|
|||||||
*
|
*
|
||||||
* @returns {Promise<boolean>} - Return
|
* @returns {Promise<boolean>} - Return
|
||||||
*/
|
*/
|
||||||
module.exports = async function getAccessToken({ clientId, element, triggerPrompt, readyStateDispatch }) {
|
module.exports = async function getAccessToken({
|
||||||
|
clientId,
|
||||||
|
element,
|
||||||
|
triggerPrompt,
|
||||||
|
readyStateDispatch,
|
||||||
|
}) {
|
||||||
/**
|
/**
|
||||||
* == Initialize
|
* == Initialize
|
||||||
*
|
*
|
||||||
@ -91,7 +78,7 @@ module.exports = async function getAccessToken({ clientId, element, triggerPromp
|
|||||||
/**
|
/**
|
||||||
* Google prompt notification callback
|
* Google prompt notification callback
|
||||||
* ========================================================
|
* ========================================================
|
||||||
* @param {GoogleIdentityPromptNotification} notification - Notification object
|
* @param {import("../../../types/user.td").GoogleIdentityPromptNotification} notification - Notification object
|
||||||
*/
|
*/
|
||||||
(notification) => {
|
(notification) => {
|
||||||
notification.isDisplayed();
|
notification.isDisplayed();
|
||||||
|
@ -1,12 +1,3 @@
|
|||||||
/**
|
|
||||||
* @typedef {{
|
|
||||||
* imageBase64: string,
|
|
||||||
* imageBase64Full: string,
|
|
||||||
* imageName: string,
|
|
||||||
* imageSize: number,
|
|
||||||
* }} FunctionReturn
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ==============================================================================
|
* ==============================================================================
|
||||||
* Main Function
|
* Main Function
|
||||||
@ -19,7 +10,7 @@
|
|||||||
* imagePreviewNode?: HTMLImageElement,
|
* imagePreviewNode?: HTMLImageElement,
|
||||||
* }} params - Single object passed
|
* }} params - Single object passed
|
||||||
*
|
*
|
||||||
* @returns { Promise<FunctionReturn> } - Return Object
|
* @returns { Promise<import("../../types/general.td").ImageInputFileToBase64FunctionReturn> } - Return Object
|
||||||
*/
|
*/
|
||||||
module.exports = async function imageInputFileToBase64({
|
module.exports = async function imageInputFileToBase64({
|
||||||
imageInputFile,
|
imageInputFile,
|
||||||
|
@ -8,4 +8,13 @@ const http = require("http");
|
|||||||
* @typedef {http.ServerResponse} Response
|
* @typedef {http.ServerResponse} Response
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports = { Request, Response };
|
/**
|
||||||
|
* @typedef {{
|
||||||
|
* imageBase64: string,
|
||||||
|
* imageBase64Full: string,
|
||||||
|
* imageName: string,
|
||||||
|
* imageSize: number,
|
||||||
|
* }} ImageInputFileToBase64FunctionReturn
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = { Request, Response, ImageInputFileToBase64FunctionReturn };
|
||||||
|
@ -46,4 +46,84 @@
|
|||||||
* @property {number} [userId] - An optional message
|
* @property {number} [userId] - An optional message
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports = { DATASQUIREL_LoggedInUser, AuthenticatedUser };
|
/**
|
||||||
|
* @typedef {object} SuccessUserObject
|
||||||
|
* @property {number} id
|
||||||
|
* @property {string} first_name
|
||||||
|
* @property {string} last_name
|
||||||
|
* @property {string} email
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {object} AddUserFunctionReturn
|
||||||
|
* @property {boolean} success - Did the function run successfully?
|
||||||
|
* @property {SuccessUserObject | null} [payload] - Payload
|
||||||
|
* @property {string} [msg]
|
||||||
|
* @property {any} [sqlResult]
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {object} GoogleIdentityPromptNotification
|
||||||
|
* @property {function(): string} getMomentType - Notification moment type
|
||||||
|
* @property {function(): string} getDismissedReason - Notification get Dismissed Reason
|
||||||
|
* @property {function(): string} getNotDisplayedReason - Notification get Not Displayed Reason
|
||||||
|
* @property {function(): string} getSkippedReason - Notification get Skipped Reason
|
||||||
|
* @property {function(): boolean} isDismissedMoment - Notification is Dismissed Moment
|
||||||
|
* @property {function(): boolean} isDisplayMoment - Notification is Display Moment
|
||||||
|
* @property {function(): boolean} isDisplayed - Notification is Displayed
|
||||||
|
* @property {function(): boolean} isNotDisplayed - Notification is Not Displayed
|
||||||
|
* @property {function(): boolean} isSkippedMoment - Notification is Skipped Moment
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {object} UserDataPayload
|
||||||
|
* @property {string} first_name - First Name *Required
|
||||||
|
* @property {string} last_name - Last Name *Required
|
||||||
|
* @property {string} email - Email *Required
|
||||||
|
* @property {string} password - Password *Required
|
||||||
|
* @property {string?} username - Username (Optional)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {object} GetUserFunctionReturn
|
||||||
|
* @property {boolean} success - Did the function run successfully?
|
||||||
|
* @property {{
|
||||||
|
* id: number,
|
||||||
|
* first_name: string,
|
||||||
|
* last_name: string,
|
||||||
|
* username: string,
|
||||||
|
* email: string,
|
||||||
|
* phone: string,
|
||||||
|
* social_id: [string],
|
||||||
|
* image: string,
|
||||||
|
* image_thumbnail: string,
|
||||||
|
* verification_status: [number=0],
|
||||||
|
* }} payload - Payload
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {object} ReauthUserFunctionReturn
|
||||||
|
* @property {boolean} success - Did the function run successfully?
|
||||||
|
* @property {import("../types/user.td").DATASQUIREL_LoggedInUser | null} payload - Payload
|
||||||
|
* @property {string} [msg] - Response Message
|
||||||
|
* @property {number} [userId] - user ID
|
||||||
|
* @property {string} [token] - new Token
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {object} UpdateUserFunctionReturn
|
||||||
|
* @property {boolean} success - Did the function run successfully?
|
||||||
|
* @property {(Object[]|string)} [payload=[]] - Payload
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
DATASQUIREL_LoggedInUser,
|
||||||
|
AuthenticatedUser,
|
||||||
|
AddUserFunctionReturn,
|
||||||
|
SuccessUserObject,
|
||||||
|
GoogleIdentityPromptNotification,
|
||||||
|
UserDataPayload,
|
||||||
|
GetUserFunctionReturn,
|
||||||
|
ReauthUserFunctionReturn,
|
||||||
|
UpdateUserFunctionReturn,
|
||||||
|
};
|
||||||
|
@ -18,31 +18,6 @@ const localAddUser = require("../engine/user/add-user");
|
|||||||
/** ****************************************************************************** */
|
/** ****************************************************************************** */
|
||||||
/** ****************************************************************************** */
|
/** ****************************************************************************** */
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {object} SuccessUserObject
|
|
||||||
* @property {number} id
|
|
||||||
* @property {string} first_name
|
|
||||||
* @property {string} last_name
|
|
||||||
* @property {string} email
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {object} FunctionReturn
|
|
||||||
* @property {boolean} success - Did the function run successfully?
|
|
||||||
* @property {SuccessUserObject | null} [payload] - Payload
|
|
||||||
* @property {string} [msg]
|
|
||||||
* @property {any} [sqlResult]
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {object} UserDataPayload
|
|
||||||
* @property {string} first_name - First Name *Required
|
|
||||||
* @property {string} last_name - Last Name *Required
|
|
||||||
* @property {string} email - Email *Required
|
|
||||||
* @property {string} password - Password *Required
|
|
||||||
* @property {string?} username - Username (Optional)
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add User to Database
|
* Add User to Database
|
||||||
* ==============================================================================
|
* ==============================================================================
|
||||||
@ -51,11 +26,11 @@ const localAddUser = require("../engine/user/add-user");
|
|||||||
* @param {object} props - Single object passed
|
* @param {object} props - Single object passed
|
||||||
* @param {string} props.key - FULL ACCESS API Key
|
* @param {string} props.key - FULL ACCESS API Key
|
||||||
* @param {string} props.database - Database Name
|
* @param {string} props.database - Database Name
|
||||||
* @param {UserDataPayload} props.payload - User Data Payload
|
* @param {import("../types/user.td").UserDataPayload} props.payload - User Data Payload
|
||||||
* @param {string} props.encryptionKey
|
* @param {string} props.encryptionKey
|
||||||
* @param {string} [props.encryptionSalt]
|
* @param {string} [props.encryptionSalt]
|
||||||
*
|
*
|
||||||
* @returns { Promise<FunctionReturn> }
|
* @returns { Promise<import("../types/user.td").AddUserFunctionReturn> }
|
||||||
*/
|
*/
|
||||||
async function addUser({
|
async function addUser({
|
||||||
key,
|
key,
|
||||||
|
@ -14,23 +14,6 @@ const getLocalUser = require("../engine/user/get-user");
|
|||||||
/** ****************************************************************************** */
|
/** ****************************************************************************** */
|
||||||
/** ****************************************************************************** */
|
/** ****************************************************************************** */
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {object} FunctionReturn
|
|
||||||
* @property {boolean} success - Did the function run successfully?
|
|
||||||
* @property {{
|
|
||||||
* id: number,
|
|
||||||
* first_name: string,
|
|
||||||
* last_name: string,
|
|
||||||
* username: string,
|
|
||||||
* email: string,
|
|
||||||
* phone: string,
|
|
||||||
* social_id: [string],
|
|
||||||
* image: string,
|
|
||||||
* image_thumbnail: string,
|
|
||||||
* verification_status: [number=0],
|
|
||||||
* }} payload - Payload
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ==============================================================================
|
* ==============================================================================
|
||||||
* Main Function
|
* Main Function
|
||||||
@ -43,7 +26,7 @@ const getLocalUser = require("../engine/user/get-user");
|
|||||||
* @param {number} params.userId - user id
|
* @param {number} params.userId - user id
|
||||||
* @param {string[]} [params.fields] - fields to select
|
* @param {string[]} [params.fields] - fields to select
|
||||||
*
|
*
|
||||||
* @returns { Promise<FunctionReturn>}
|
* @returns { Promise<import("../types/user.td").GetUserFunctionReturn>}
|
||||||
*/
|
*/
|
||||||
async function getUser({ key, userId, database, fields }) {
|
async function getUser({ key, userId, database, fields }) {
|
||||||
/**
|
/**
|
||||||
|
@ -21,15 +21,6 @@ const localReauthUser = require("../engine/user/reauth-user");
|
|||||||
/** ****************************************************************************** */
|
/** ****************************************************************************** */
|
||||||
/** ****************************************************************************** */
|
/** ****************************************************************************** */
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {object} FunctionReturn
|
|
||||||
* @property {boolean} success - Did the function run successfully?
|
|
||||||
* @property {import("../types/user.td").DATASQUIREL_LoggedInUser | null} payload - Payload
|
|
||||||
* @property {string} [msg] - Response Message
|
|
||||||
* @property {number} [userId] - user ID
|
|
||||||
* @property {string} [token] - new Token
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ==============================================================================
|
* ==============================================================================
|
||||||
* Main Function
|
* Main Function
|
||||||
@ -47,7 +38,7 @@ const localReauthUser = require("../engine/user/reauth-user");
|
|||||||
* @param {string[]} [params.additionalFields] - Additional Fields to be added to the user object
|
* @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 {string} [params.token] - access token to use instead of getting from cookie header
|
||||||
*
|
*
|
||||||
* @returns { Promise<FunctionReturn> }
|
* @returns { Promise<import("../types/user.td").ReauthUserFunctionReturn> }
|
||||||
*/
|
*/
|
||||||
async function reauthUser({
|
async function reauthUser({
|
||||||
key,
|
key,
|
||||||
|
@ -18,12 +18,6 @@ const localUpdateUser = require("../engine/user/update-user");
|
|||||||
/** ****************************************************************************** */
|
/** ****************************************************************************** */
|
||||||
/** ****************************************************************************** */
|
/** ****************************************************************************** */
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {object} FunctionReturn
|
|
||||||
* @property {boolean} success - Did the function run successfully?
|
|
||||||
* @property {(Object[]|string)} [payload=[]] - Payload
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ==============================================================================
|
* ==============================================================================
|
||||||
* Main Function
|
* Main Function
|
||||||
@ -35,7 +29,7 @@ const localUpdateUser = require("../engine/user/update-user");
|
|||||||
* @param {String} params.database - Target Database
|
* @param {String} params.database - Target Database
|
||||||
* @param {{ id: number } & Object.<string, *>} params.payload - User Object: ID is required
|
* @param {{ id: number } & Object.<string, *>} params.payload - User Object: ID is required
|
||||||
*
|
*
|
||||||
* @returns { Promise<FunctionReturn>}
|
* @returns { Promise<import("../types/user.td").UpdateUserFunctionReturn>}
|
||||||
*/
|
*/
|
||||||
async function updateUser({ key, payload, database }) {
|
async function updateUser({ key, payload, database }) {
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user