datasquirel/index.js
Benjamin Toby 7b9ec5404e Updates
2024-12-12 07:01:57 +01:00

107 lines
3.0 KiB
JavaScript

// @ts-check
/**
* Imports
*/
const get = require("./utils/get");
const post = require("./utils/post");
const getSchema = require("./utils/get-schema");
const uploadImage = require("./utils/upload-image");
const uploadFile = require("./utils/upload-file");
const deleteFile = require("./utils/delete-file");
const createUser = require("./users/add-user");
const updateUser = require("./users/update-user");
const loginUser = require("./users/login-user");
const sendEmailCode = require("./users/send-email-code");
const logoutUser = require("./users/logout-user");
const userAuth = require("./users/user-auth");
const reAuthUser = require("./users/reauth-user");
const getUser = require("./users/get-user");
const loginWithGoogle = require("./users/social/google-auth");
const loginWithGithub = require("./users/social/github-auth");
const getToken = require("./users/get-token");
const validateToken = require("./users/validate-token");
const datasquirelClient = require("./client");
const sqlGenerator = require("./package-shared/functions/dsql/sql/sql-generator");
const sqlInsertGenerator = require("./package-shared/functions/dsql/sql/sql-insert-generator");
const sqlDeleteGenerator = require("./package-shared/functions/dsql/sql/sql-delete-generator");
const trimSql = require("./package-shared/utils/trim-sql");
const serializeQuery = require("./package-shared/utils/serialize-query");
const serializeCookies = require("./package-shared/utils/serialize-cookies");
const EJSON = require("./package-shared/utils/ejson");
const numberfy = require("./package-shared/utils/numberfy");
const slugify = require("./package-shared/utils/slugify");
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* User Functions Object
*/
const user = {
createUser: createUser,
deleteUser: require("./users/delete-user"),
loginUser: loginUser,
sendEmailCode: sendEmailCode,
logoutUser: logoutUser,
userAuth: userAuth,
reAuthUser: reAuthUser,
updateUser: updateUser,
getUser: getUser,
getToken: getToken,
validateToken: validateToken,
validateTempEmailCode: require("./users/validate-temp-email-code"),
social: {
loginWithGoogle: loginWithGoogle,
loginWithGithub: loginWithGithub,
},
};
/**
* Media Functions Object
*/
const media = {
uploadImage: uploadImage,
uploadFile: uploadFile,
deleteFile: deleteFile,
};
/**
* SQL Utils
*/
const sql = {
sqlGenerator,
sqlInsertGenerator,
sqlDeleteGenerator,
trim: trimSql,
};
/**
* Main Export
*/
const datasquirel = {
get,
post,
media,
user,
getSchema,
client: datasquirelClient,
sql,
utils: {
crypto: {
encrypt: require("./package-shared/functions/dsql/encrypt"),
decrypt: require("./package-shared/functions/dsql/decrypt"),
hash: require("./package-shared/functions/dsql/hashPassword"),
},
},
};
module.exports = datasquirel;
exports.dsqlUtils = require("./package-shared/utils");