datasquirel/index.ts

105 lines
2.7 KiB
TypeScript
Raw Normal View History

2025-01-10 19:10:28 +00:00
// @ts-check
/**
* Imports
*/
import get from "./utils/get";
import post from "./utils/post";
import getSchema from "./utils/get-schema";
import uploadImage from "./utils/upload-image";
import uploadFile from "./utils/upload-file";
import deleteFile from "./utils/delete-file";
import createUser from "./users/add-user";
import updateUser from "./users/update-user";
import loginUser from "./users/login-user";
import sendEmailCode from "./users/send-email-code";
import logoutUser from "./users/logout-user";
import userAuth from "./users/user-auth";
import reAuthUser from "./users/reauth-user";
import getUser from "./users/get-user";
import loginWithGoogle from "./users/social/google-auth";
import loginWithGithub from "./users/social/github-auth";
import getToken from "./users/get-token";
import validateToken from "./users/validate-token";
import datasquirelClient from "./client";
import sqlGenerator from "./package-shared/functions/dsql/sql/sql-generator";
import sqlInsertGenerator from "./package-shared/functions/dsql/sql/sql-insert-generator";
import sqlDeleteGenerator from "./package-shared/functions/dsql/sql/sql-delete-generator";
import trimSql from "./package-shared/utils/trim-sql";
import parseCookies from "./package-shared/utils/backend/parseCookies";
import httpRequest from "./package-shared/functions/backend/httpRequest";
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* 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"),
},
parseCookies,
httpRequest,
},
};
export default datasquirel;