updates
This commit is contained in:
parent
84bdfbe6f1
commit
e0fdfa9817
3
.gitignore
vendored
3
.gitignore
vendored
@ -128,3 +128,6 @@ dist
|
|||||||
.yarn/build-state.yml
|
.yarn/build-state.yml
|
||||||
.yarn/install-state.gz
|
.yarn/install-state.gz
|
||||||
.pnp.*
|
.pnp.*
|
||||||
|
|
||||||
|
# typescript
|
||||||
|
tsconfig.json
|
||||||
|
44
index.js
44
index.js
@ -21,23 +21,47 @@ const userAuth = require("./users/user-auth");
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* ==============================================================================
|
* ==============================================================================
|
||||||
* Main Function
|
* User Functions Object
|
||||||
* ==============================================================================
|
* ==============================================================================
|
||||||
* @param {Object} mailObject - foundUser if any
|
* @type {Object}
|
||||||
|
* @property {Function} createUser - Create User Function
|
||||||
|
* @property {Function} loginUser - Login User Function
|
||||||
|
* @property {Function} logoutUser - Logout User Function
|
||||||
|
* @property {Function} userAuth - User Auth Function
|
||||||
|
* @property {Function} updateUser - Update User Function
|
||||||
*/
|
*/
|
||||||
const datasquirel = {
|
const user = {
|
||||||
get: get,
|
|
||||||
post: post,
|
|
||||||
media: {
|
|
||||||
uploadImage: uploadImage,
|
|
||||||
},
|
|
||||||
user: {
|
|
||||||
createUser: createUser,
|
createUser: createUser,
|
||||||
loginUser: loginUser,
|
loginUser: loginUser,
|
||||||
logoutUser: logoutUser,
|
logoutUser: logoutUser,
|
||||||
userAuth: userAuth,
|
userAuth: userAuth,
|
||||||
updateUser: updateUser,
|
updateUser: updateUser,
|
||||||
},
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ==============================================================================
|
||||||
|
* Media Functions Object
|
||||||
|
* ==============================================================================
|
||||||
|
* @type {Object}
|
||||||
|
* @property {Function} uploadImage - Upload Image async Function
|
||||||
|
*/
|
||||||
|
const media = {
|
||||||
|
uploadImage: uploadImage,
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ==============================================================================
|
||||||
|
* Main Export
|
||||||
|
* ==============================================================================
|
||||||
|
* @type {Object}
|
||||||
|
* @property {Function} get - get Function
|
||||||
|
* @property {Function} post - post Function
|
||||||
|
*/
|
||||||
|
const datasquirel = {
|
||||||
|
get: get,
|
||||||
|
post: post,
|
||||||
|
media: media,
|
||||||
|
user: user,
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = datasquirel;
|
module.exports = datasquirel;
|
||||||
|
13
package-lock.json
generated
Normal file
13
package-lock.json
generated
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"name": "datasquirel",
|
||||||
|
"version": "1.1.4",
|
||||||
|
"lockfileVersion": 2,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"name": "datasquirel",
|
||||||
|
"version": "1.1.4",
|
||||||
|
"license": "ISC"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "datasquirel",
|
"name": "datasquirel",
|
||||||
"version": "1.1.4",
|
"version": "1.1.5",
|
||||||
"description": "Cloud-based SQL data management tool",
|
"description": "Cloud-based SQL data management tool",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
17
utils/get.js
17
utils/get.js
@ -12,13 +12,24 @@ const https = require("https");
|
|||||||
/** ****************************************************************************** */
|
/** ****************************************************************************** */
|
||||||
/** ****************************************************************************** */
|
/** ****************************************************************************** */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} GetReturn
|
||||||
|
* @property {boolean} success - Did the function run successfully?
|
||||||
|
* @property {(Object[]|string)} [payload=[]] - The Y Coordinate
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ==============================================================================
|
* ==============================================================================
|
||||||
* Main Function
|
* Main Function
|
||||||
* ==============================================================================
|
* ==============================================================================
|
||||||
* @param {String} key - API Key
|
* @async
|
||||||
* @param {String} db - Database Slug
|
*
|
||||||
* @param {String} query - SQL query
|
* @param {Object} params - Single object passed
|
||||||
|
* @param {string} params.key - API Key
|
||||||
|
* @param {string} params.db - Database Name
|
||||||
|
* @param {(string | Object)} params.query - SQL Query
|
||||||
|
*
|
||||||
|
* @returns {GetReturn} - Return Object
|
||||||
*/
|
*/
|
||||||
module.exports = async function ({ key, db, query }) {
|
module.exports = async function ({ key, db, query }) {
|
||||||
/**
|
/**
|
||||||
|
@ -12,24 +12,29 @@ const https = require("https");
|
|||||||
/** ****************************************************************************** */
|
/** ****************************************************************************** */
|
||||||
/** ****************************************************************************** */
|
/** ****************************************************************************** */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} PostReturn
|
||||||
|
* @property {boolean} success - Did the function run successfully?
|
||||||
|
* @property {(Object[]|string)} [payload=[]] - The Y Coordinate
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ==============================================================================
|
* ==============================================================================
|
||||||
* Main Function
|
* Main Function
|
||||||
* ==============================================================================
|
* ==============================================================================
|
||||||
* @param {String} key - API Key
|
* @async
|
||||||
* @param {String} database - Database Name
|
*
|
||||||
* @param {String | Object} query - SQL query String or Request Object. Eg. {
|
* @param {Object} params - Single object passed
|
||||||
action: "insert | update | delete",
|
* @param {string} params.key - API Key
|
||||||
data: {
|
* @param {string} params.database - Database Name
|
||||||
user_id: user.id,
|
* @param {(Object | string)} params.query - SQL query String or Request Object
|
||||||
user_first_name: user.first_name,
|
* @param {string} [params.query.action="insert"] - Query action => insert | update | delete
|
||||||
user_last_name: user.last_name,
|
* @param {string} params.query.table - Database table slug
|
||||||
},
|
* @param {string} params.query.identifierColumnName - Name of column(or field) to match
|
||||||
table: "posts",
|
* @param {(string | number)} params.query.identifierValue - Value attached to target column(or field)
|
||||||
identifierColumnName: "id",
|
* @param {Object} params.query.data - data to be inserted: eg. { id: 1267, first_name: John, last_name: Doe }
|
||||||
identifierValue: 1,
|
*
|
||||||
condition: "WHERE likes > 2"
|
* @returns { PostReturn } - Return Object
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
module.exports = async function ({ key, query, database }) {
|
module.exports = async function ({ key, query, database }) {
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user