Update types: Remove '@/' references

This commit is contained in:
Benjamin Toby 2024-10-19 17:45:42 +01:00
parent bf1d7f5fcd
commit 4462ba315d
27 changed files with 39 additions and 42 deletions

View File

@ -22,7 +22,7 @@ const updateApiSchemaFromLocalDb = require("../query/update-api-schema-from-loca
* ============================================================================== * ==============================================================================
* *
* @param {object} params - Single object passed * @param {object} params - Single object passed
* @param {import("@/package-shared/types").DSQL_DatabaseSchemaType | undefined} params.dbSchema - Database Schema Object * @param {import("../../package-shared/types").DSQL_DatabaseSchemaType | undefined} params.dbSchema - Database Schema Object
* *
* @returns {Promise<*>} new user auth object payload * @returns {Promise<*>} new user auth object payload
*/ */
@ -33,7 +33,7 @@ module.exports = async function addUsersTableToDb({ dbSchema }) {
* @description Initialize * @description Initialize
*/ */
const database = process.env.DSQL_DB_NAME || ""; const database = process.env.DSQL_DB_NAME || "";
/** @type {import("@/package-shared/types").DSQL_TableSchemaType} */ /** @type {import("../../package-shared/types").DSQL_TableSchemaType} */
const userPreset = require("./data/presets/users.json"); const userPreset = require("./data/presets/users.json");
try { try {

View File

@ -29,7 +29,7 @@ const runQuery = require("./utils/runQuery");
* *
* @param {Object} params - Single object passed * @param {Object} params - Single object passed
* @param {LocalQueryObject} params.options - SQL Query * @param {LocalQueryObject} params.options - SQL Query
* @param {import("@/package-shared/types").DSQL_DatabaseSchemaType | undefined} [params.dbSchema] - Name of the table to query * @param {import("../../package-shared/types").DSQL_DatabaseSchemaType | undefined} [params.dbSchema] - Name of the table to query
* *
* @returns { Promise<LocalGetReturn> } - Return Object * @returns { Promise<LocalGetReturn> } - Return Object
*/ */

View File

@ -24,7 +24,7 @@ const runQuery = require("./utils/runQuery");
* *
* @param {Object} params - Single object passed * @param {Object} params - Single object passed
* @param {LocalPostQueryObject} params.options - SQL Query * @param {LocalPostQueryObject} params.options - SQL Query
* @param {import("@/package-shared/types").DSQL_DatabaseSchemaType | undefined} [params.dbSchema] - Name of the table to query * @param {import("../../package-shared/types").DSQL_DatabaseSchemaType | undefined} [params.dbSchema] - Name of the table to query
* *
* @returns { Promise<LocalPostReturn> } - Return Object * @returns { Promise<LocalPostReturn> } - Return Object
*/ */

View File

@ -19,7 +19,7 @@ const updateDbEntry = require("./updateDbEntry");
* @param {string} params.dbFullName - Database full name * @param {string} params.dbFullName - Database full name
* @param {string} params.tableName - Table name * @param {string} params.tableName - Table name
* @param {*} params.data - Data to add * @param {*} params.data - Data to add
* @param {import("@/package-shared/types").DSQL_TableSchemaType} [params.tableSchema] - Table schema * @param {import("../../../package-shared/types").DSQL_TableSchemaType} [params.tableSchema] - Table schema
* @param {string} [params.duplicateColumnName] - Duplicate column name * @param {string} [params.duplicateColumnName] - Duplicate column name
* @param {string} [params.duplicateColumnValue] - Duplicate column value * @param {string} [params.duplicateColumnValue] - Duplicate column value
* @param {boolean} [params.update] - Update this row if it exists * @param {boolean} [params.update] - Update this row if it exists

View File

@ -19,7 +19,7 @@ const dbHandler = require("../../engine/utils/dbHandler");
* "Read only" or "Full Access"? Defaults to "Read Only" * "Read only" or "Full Access"? Defaults to "Read Only"
* @param {string} params.dbFullName - Database full name * @param {string} params.dbFullName - Database full name
* @param {string} params.tableName - Table name * @param {string} params.tableName - Table name
* @param {import("@/package-shared/types").DSQL_TableSchemaType} [params.tableSchema] - Table schema * @param {import("../../../package-shared/types").DSQL_TableSchemaType} [params.tableSchema] - Table schema
* @param {string} params.identifierColumnName - Update row identifier column name * @param {string} params.identifierColumnName - Update row identifier column name
* @param {string|number} params.identifierValue - Update row identifier column value * @param {string|number} params.identifierValue - Update row identifier column value
* *

View File

@ -31,7 +31,7 @@ const varDatabaseDbHandler = require("../../engine/utils/varDatabaseDbHandler");
* @param {string} params.dbFullName - Database full name. Eg. "datasquire_user_2_test" * @param {string} params.dbFullName - Database full name. Eg. "datasquire_user_2_test"
* @param {*} params.query - Query string or object * @param {*} params.query - Query string or object
* @param {boolean} [params.readOnly] - Is this operation read only? * @param {boolean} [params.readOnly] - Is this operation read only?
* @param {import("@/package-shared/types").DSQL_DatabaseSchemaType} [params.dbSchema] - Database schema * @param {import("../../../package-shared/types").DSQL_DatabaseSchemaType} [params.dbSchema] - Database schema
* @param {string[]} [params.queryValuesArray] - An optional array of query values if "?" is used in the query string * @param {string[]} [params.queryValuesArray] - An optional array of query values if "?" is used in the query string
* @param {string} [params.tableName] - Table Name * @param {string} [params.tableName] - Table Name
* *

View File

@ -21,7 +21,7 @@ const dbHandler = require("../../engine/utils/dbHandler");
* @param {string} params.dbFullName - Database full name * @param {string} params.dbFullName - Database full name
* @param {string} params.tableName - Table name * @param {string} params.tableName - Table name
* @param {*} params.data - Data to add * @param {*} params.data - Data to add
* @param {import("@/package-shared/types").DSQL_TableSchemaType} [params.tableSchema] - Table schema * @param {import("../../../package-shared/types").DSQL_TableSchemaType} [params.tableSchema] - Table schema
* @param {string} params.identifierColumnName - Update row identifier column name * @param {string} params.identifierColumnName - Update row identifier column name
* @param {string | number} params.identifierValue - Update row identifier column value * @param {string | number} params.identifierValue - Update row identifier column value
* @param {string} params.encryptionKey - Encryption key * @param {string} params.encryptionKey - Encryption key

View File

@ -20,8 +20,8 @@ const runQuery = require("../query/utils/runQuery");
* @async * @async
* *
* @param {Object} params - Single object passed * @param {Object} params - Single object passed
* @param {import("@/package-shared/types").UserDataPayload} params.payload - SQL Query * @param {import("../../package-shared/types").UserDataPayload} params.payload - SQL Query
* @param {import("@/package-shared/types").DSQL_DatabaseSchemaType | undefined} params.dbSchema - Name of the table to query * @param {import("../../package-shared/types").DSQL_DatabaseSchemaType | undefined} params.dbSchema - Name of the table to query
* @param {string} [params.encryptionKey] * @param {string} [params.encryptionKey]
* @param {string} [params.encryptionSalt] * @param {string} [params.encryptionSalt]
* *

View File

@ -36,7 +36,7 @@ const encryptionSalt = process.env.DSQL_ENCRYPTION_SALT || "";
* @param {string} params.clientId * @param {string} params.clientId
* @param {string} params.clientSecret * @param {string} params.clientSecret
* @param {object} [params.additionalFields] * @param {object} [params.additionalFields]
* @param {import("@/package-shared/types").DSQL_DatabaseSchemaType} params.dbSchema * @param {import("../../../package-shared/types").DSQL_DatabaseSchemaType} params.dbSchema
*/ */
async function localGithubAuth({ async function localGithubAuth({
res, res,

View File

@ -44,7 +44,7 @@ const encryptionSalt = process.env.DSQL_ENCRYPTION_SALT || "";
* @param {string} params.clientId - Google client id * @param {string} params.clientId - Google client id
* @param {http.ServerResponse} params.response - HTTPS response object * @param {http.ServerResponse} params.response - HTTPS response object
* @param {object} [params.additionalFields] - Additional Fields to be added to the user object * @param {object} [params.additionalFields] - Additional Fields to be added to the user object
* @param {import("@/package-shared/types").DSQL_DatabaseSchemaType} [params.dbSchema] - Database Schema * @param {import("../../../package-shared/types").DSQL_DatabaseSchemaType} [params.dbSchema] - Database Schema
* *
* @returns { Promise<FunctionReturn> } * @returns { Promise<FunctionReturn> }
*/ */

View File

@ -74,7 +74,7 @@ const encryptionSalt = process.env.DSQL_ENCRYPTION_SALT || "";
* res: http.ServerResponse, * res: http.ServerResponse,
* supEmail?: string | null, * supEmail?: string | null,
* additionalFields?: object, * additionalFields?: object,
* dbSchema: import("@/package-shared/types").DSQL_DatabaseSchemaType | undefined * dbSchema: import("../../../../package-shared/types").DSQL_DatabaseSchemaType | undefined
* }} params - function parameters inside an object * }} params - function parameters inside an object
* *
* @returns {Promise<FunctionReturn>} - Response object * @returns {Promise<FunctionReturn>} - Response object

View File

@ -17,7 +17,7 @@ const updateDbEntry = require("../query/utils/updateDbEntry");
* *
* @param {Object} params - Single object passed * @param {Object} params - Single object passed
* @param {*} params.payload - SQL Query * @param {*} params.payload - SQL Query
* @param {import("@/package-shared/types").DSQL_DatabaseSchemaType | undefined} params.dbSchema - Name of the table to query * @param {import("../../package-shared/types").DSQL_DatabaseSchemaType | undefined} params.dbSchema - Name of the table to query
* *
* @returns { Promise<LocalPostReturn> } - Return Object * @returns { Promise<LocalPostReturn> } - Return Object
*/ */

View File

@ -1,6 +1,6 @@
{ {
"name": "datasquirel", "name": "datasquirel",
"version": "2.2.0", "version": "2.2.1",
"description": "Cloud-based SQL data management tool", "description": "Cloud-based SQL data management tool",
"main": "index.js", "main": "index.js",
"bin": { "bin": {

View File

@ -2,9 +2,6 @@
"compilerOptions": { "compilerOptions": {
"target": "ES2015", "target": "ES2015",
"module": "commonjs", "module": "commonjs",
"paths": {
"@/*": ["./*"]
},
"maxNodeModuleJsDepth": 10, "maxNodeModuleJsDepth": 10,
"esModuleInterop": true, "esModuleInterop": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,

View File

@ -26,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 {import("@/package-shared/types").UserDataPayload} props.payload - User Data Payload * @param {import("../package-shared/types").UserDataPayload} props.payload - User Data Payload
* @param {string} props.encryptionKey * @param {string} props.encryptionKey
* @param {string} [props.encryptionSalt] * @param {string} [props.encryptionSalt]
* *
* @returns { Promise<import("@/package-shared/types").AddUserFunctionReturn> } * @returns { Promise<import("../package-shared/types").AddUserFunctionReturn> }
*/ */
async function addUser({ async function addUser({
key, key,
@ -64,7 +64,7 @@ async function addUser({
DSQL_PASS?.match(/./) && DSQL_PASS?.match(/./) &&
DSQL_DB_NAME?.match(/./) DSQL_DB_NAME?.match(/./)
) { ) {
/** @type {import("@/package-shared/types").DSQL_DatabaseSchemaType | undefined} */ /** @type {import("../package-shared/types").DSQL_DatabaseSchemaType | undefined} */
let dbSchema; let dbSchema;
try { try {

View File

@ -41,7 +41,7 @@ const loginLocalUser = require("../engine/user/login-user");
* @param {string} [params.temp_code_field] - Database table field name for temporary code * @param {string} [params.temp_code_field] - Database table field name for temporary code
* @param {boolean} [params.token] - Send access key as part of response body? * @param {boolean} [params.token] - Send access key as part of response body?
* *
* @returns { Promise<import("@/package-shared/types").AuthenticatedUser>} * @returns { Promise<import("../package-shared/types").AuthenticatedUser>}
*/ */
async function loginUser({ async function loginUser({
key, key,
@ -126,7 +126,7 @@ async function loginUser({
DSQL_PASS?.match(/./) && DSQL_PASS?.match(/./) &&
DSQL_DB_NAME?.match(/./) DSQL_DB_NAME?.match(/./)
) { ) {
/** @type {import("@/package-shared/types").DSQL_DatabaseSchemaType | undefined} */ /** @type {import("../package-shared/types").DSQL_DatabaseSchemaType | undefined} */
let dbSchema; let dbSchema;
try { try {
@ -154,10 +154,10 @@ async function loginUser({
* *
* @description make a request to datasquirel.com * @description make a request to datasquirel.com
* *
* @type {{ success: boolean, payload: import("@/package-shared/types").DATASQUIREL_LoggedInUser | null, userId?: number, msg?: string }} * @type {{ success: boolean, payload: import("../package-shared/types").DATASQUIREL_LoggedInUser | null, userId?: number, msg?: string }}
*/ */
httpResponse = await new Promise((resolve, reject) => { httpResponse = await new Promise((resolve, reject) => {
/** @type {import("@/package-shared/types").PackageUserLoginRequestBody} */ /** @type {import("../package-shared/types").PackageUserLoginRequestBody} */
const reqPayload = { const reqPayload = {
encryptionKey, encryptionKey,
payload, payload,

View File

@ -38,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<import("@/package-shared/types").ReauthUserFunctionReturn> } * @returns { Promise<import("../package-shared/types").ReauthUserFunctionReturn> }
*/ */
async function reauthUser({ async function reauthUser({
key, key,
@ -103,7 +103,7 @@ async function reauthUser({
DSQL_PASS?.match(/./) && DSQL_PASS?.match(/./) &&
DSQL_DB_NAME?.match(/./) DSQL_DB_NAME?.match(/./)
) { ) {
/** @type {import("@/package-shared/types").DSQL_DatabaseSchemaType | undefined} */ /** @type {import("../package-shared/types").DSQL_DatabaseSchemaType | undefined} */
let dbSchema; let dbSchema;
try { try {

View File

@ -114,7 +114,7 @@ async function sendEmailCode({
DSQL_PASS?.match(/./) && DSQL_PASS?.match(/./) &&
DSQL_DB_NAME?.match(/./) DSQL_DB_NAME?.match(/./)
) { ) {
/** @type {import("@/package-shared/types").DSQL_DatabaseSchemaType | undefined} */ /** @type {import("../package-shared/types").DSQL_DatabaseSchemaType | undefined} */
let dbSchema; let dbSchema;
try { try {
@ -143,7 +143,7 @@ async function sendEmailCode({
* *
* @description make a request to datasquirel.com * @description make a request to datasquirel.com
* *
* @type {{ success: boolean, payload: import("@/package-shared/types").DATASQUIREL_LoggedInUser | null, userId?: number, msg?: string }} * @type {{ success: boolean, payload: import("../package-shared/types").DATASQUIREL_LoggedInUser | null, userId?: number, msg?: string }}
*/ */
httpResponse = await new Promise((resolve, reject) => { httpResponse = await new Promise((resolve, reject) => {
const reqPayload = JSON.stringify({ const reqPayload = JSON.stringify({

View File

@ -154,7 +154,7 @@ async function githubAuth({
DSQL_PASS?.match(/./) && DSQL_PASS?.match(/./) &&
DSQL_DB_NAME?.match(/./) DSQL_DB_NAME?.match(/./)
) { ) {
/** @type {import("@/package-shared/types").DSQL_DatabaseSchemaType | undefined | undefined} */ /** @type {import("../../package-shared/types").DSQL_DatabaseSchemaType | undefined | undefined} */
let dbSchema; let dbSchema;
try { try {

View File

@ -150,7 +150,7 @@ async function googleAuth({
DSQL_PASS?.match(/./) && DSQL_PASS?.match(/./) &&
DSQL_DB_NAME?.match(/./) DSQL_DB_NAME?.match(/./)
) { ) {
/** @type {import("@/package-shared/types").DSQL_DatabaseSchemaType | undefined | undefined} */ /** @type {import("../../package-shared/types").DSQL_DatabaseSchemaType | undefined | undefined} */
let dbSchema; let dbSchema;
try { try {
@ -179,7 +179,7 @@ async function googleAuth({
* Make https request * Make https request
* *
* @description make a request to datasquirel.com * @description make a request to datasquirel.com
* @type {{ success: boolean, user: import("@/package-shared/types").DATASQUIREL_LoggedInUser | null, msg?: string, dsqlUserId?: number } | null } - Https response object * @type {{ success: boolean, user: import("../../package-shared/types").DATASQUIREL_LoggedInUser | null, msg?: string, dsqlUserId?: number } | null } - Https response object
*/ */
httpResponse = await new Promise((resolve, reject) => { httpResponse = await new Promise((resolve, reject) => {
const reqPayload = JSON.stringify({ const reqPayload = JSON.stringify({

View File

@ -29,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<import("@/package-shared/types").UpdateUserFunctionReturn>} * @returns { Promise<import("../package-shared/types").UpdateUserFunctionReturn>}
*/ */
async function updateUser({ key, payload, database }) { async function updateUser({ key, payload, database }) {
/** /**
@ -57,7 +57,7 @@ async function updateUser({ key, payload, database }) {
DSQL_PASS?.match(/./) && DSQL_PASS?.match(/./) &&
DSQL_DB_NAME?.match(/./) DSQL_DB_NAME?.match(/./)
) { ) {
/** @type {import("@/package-shared/types").DSQL_DatabaseSchemaType | undefined} */ /** @type {import("../package-shared/types").DSQL_DatabaseSchemaType | undefined} */
let dbSchema; let dbSchema;
try { try {

View File

@ -30,7 +30,7 @@ const parseCookies = require("../utils/functions/parseCookies");
* @param {string} params.database - Database Name * @param {string} params.database - Database Name
* @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 { import("@/package-shared/types").AuthenticatedUser } * @returns { import("../package-shared/types").AuthenticatedUser }
*/ */
function userAuth({ function userAuth({
request, request,

View File

@ -27,7 +27,7 @@ const decrypt = require("../functions/decrypt");
* @param {("deep" | "normal")?} [params.level] - Optional. "Deep" value indicates an extra layer of security * @param {("deep" | "normal")?} [params.level] - Optional. "Deep" value indicates an extra layer of security
* @param {string} params.database - Database Name * @param {string} params.database - Database Name
* *
* @returns { import("@/package-shared/types").DATASQUIREL_LoggedInUser | null} * @returns { import("../package-shared/types").DATASQUIREL_LoggedInUser | null}
*/ */
function validateToken({ token, encryptionKey, encryptionSalt }) { function validateToken({ token, encryptionKey, encryptionSalt }) {
try { try {

View File

@ -1,6 +1,6 @@
// @ts-check // @ts-check
/** @type {import("@/package-shared/types").SerializeQueryFnType} */ /** @type {import("../../package-shared/types").SerializeQueryFnType} */
function serializeQuery({ query }) { function serializeQuery({ query }) {
let str = "?"; let str = "?";
const keys = Object.keys(query); const keys = Object.keys(query);

View File

@ -18,7 +18,7 @@ const https = require("https");
/** /**
* @typedef {Object} GetSchemaReturn * @typedef {Object} GetSchemaReturn
* @property {boolean} success - Did the function run successfully? * @property {boolean} success - Did the function run successfully?
* @property {import("@/package-shared/types").DSQL_DatabaseSchemaType | null} payload - Response payload * @property {import("../package-shared/types").DSQL_DatabaseSchemaType | null} payload - Response payload
*/ */
/** /**

View File

@ -31,7 +31,7 @@ const serializeQuery = require("./functions/serialize-query");
* @param {string[]} [params.queryValues] - An array of query values if using "?" placeholders * @param {string[]} [params.queryValues] - An array of query values if using "?" placeholders
* @param {string} [params.tableName] - Name of the table to query * @param {string} [params.tableName] - Name of the table to query
* *
* @returns { Promise<import("@/package-shared/types").GetReturn> } - Return Object * @returns { Promise<import("../package-shared/types").GetReturn> } - Return Object
*/ */
async function get({ key, db, query, queryValues, tableName }) { async function get({ key, db, query, queryValues, tableName }) {
const scheme = process.env.DSQL_HTTP_SCHEME; const scheme = process.env.DSQL_HTTP_SCHEME;
@ -59,7 +59,7 @@ async function get({ key, db, query, queryValues, tableName }) {
DSQL_PASS?.match(/./) && DSQL_PASS?.match(/./) &&
DSQL_DB_NAME?.match(/./) DSQL_DB_NAME?.match(/./)
) { ) {
/** @type {import("@/package-shared/types").DSQL_DatabaseSchemaType | undefined} */ /** @type {import("../package-shared/types").DSQL_DatabaseSchemaType | undefined} */
let dbSchema; let dbSchema;
try { try {
@ -86,7 +86,7 @@ async function get({ key, db, query, queryValues, tableName }) {
* @description make a request to datasquirel.com * @description make a request to datasquirel.com
*/ */
const httpResponse = await new Promise((resolve, reject) => { const httpResponse = await new Promise((resolve, reject) => {
/** @type {import("@/package-shared/types").GetReqQueryObject} */ /** @type {import("../package-shared/types").GetReqQueryObject} */
const queryObject = { const queryObject = {
db: String(db), db: String(db),
query: String( query: String(

View File

@ -78,7 +78,7 @@ async function post({ key, query, queryValues, database, tableName }) {
DSQL_PASS?.match(/./) && DSQL_PASS?.match(/./) &&
DSQL_DB_NAME?.match(/./) DSQL_DB_NAME?.match(/./)
) { ) {
/** @type {import("@/package-shared/types").DSQL_DatabaseSchemaType | undefined} */ /** @type {import("../package-shared/types").DSQL_DatabaseSchemaType | undefined} */
let dbSchema; let dbSchema;
try { try {