datasquirel/client/index.js

68 lines
1.6 KiB
JavaScript
Raw Normal View History

2023-09-21 14:00:04 +00:00
// @ts-check
/**
* Imports
*/
const imageInputFileToBase64 = require("./media/imageInputFileToBase64");
const imageInputToBase64 = require("./media/imageInputToBase64");
const inputFileToBase64 = require("./media/inputFileToBase64");
const getAccessToken = require("./auth/google/getAccessToken");
const getGithubAccessToken = require("./auth/github/getAccessToken");
const logout = require("./auth/logout");
2024-11-08 15:41:22 +00:00
const { fetchApi } = require("./fetch");
const clientFetch = require("./fetch");
2024-12-12 06:08:28 +00:00
const serializeQuery = require("../package-shared/utils/serialize-query");
const serializeCookies = require("../package-shared/utils/serialize-cookies");
const { EJSON } = require("../package-shared/utils");
const { numberfy } = require("../package-shared/utils");
const { slugify } = require("../package-shared/utils");
2023-09-21 14:00:04 +00:00
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Media Functions Object
*/
const media = {
imageInputToBase64: imageInputToBase64,
imageInputFileToBase64: imageInputFileToBase64,
inputFileToBase64: inputFileToBase64,
};
/**
* User Auth Object
*/
const auth = {
google: {
getAccessToken: getAccessToken,
},
github: {
getAccessToken: getGithubAccessToken,
},
logout: logout,
};
2024-12-12 06:08:28 +00:00
const utils = {
serializeQuery,
serializeCookies,
EJSON,
numberfy,
slugify,
};
2023-09-21 14:00:04 +00:00
/**
2024-11-08 15:41:22 +00:00
* Fetch
2023-09-21 14:00:04 +00:00
*/
2024-11-08 15:41:22 +00:00
const fetch = {
fetchApi,
clientFetch,
2023-09-21 14:00:04 +00:00
};
2024-11-08 15:41:22 +00:00
/**
* Main Export
*/
2024-12-12 06:08:28 +00:00
const datasquirelClient = { media, auth, fetch, utils };
2024-11-08 15:41:22 +00:00
2023-09-21 14:00:04 +00:00
module.exports = datasquirelClient;