From 4462ba315da7270d14fadc83d03c3eff1824e7ad Mon Sep 17 00:00:00 2001 From: Benjamin Toby Date: Sat, 19 Oct 2024 17:45:42 +0100 Subject: [PATCH] Update types: Remove '@/' references --- engine/engine/addUsersTableToDb.js | 4 ++-- engine/query/get.js | 2 +- engine/query/post.js | 2 +- engine/query/utils/addDbEntry.js | 2 +- engine/query/utils/deleteDbEntry.js | 2 +- engine/query/utils/runQuery.js | 2 +- engine/query/utils/updateDbEntry.js | 2 +- engine/user/add-user.js | 4 ++-- engine/user/social/github-auth.js | 2 +- engine/user/social/google-auth.js | 2 +- engine/user/social/utils/handleSocialDb.js | 2 +- engine/user/update-user.js | 2 +- package.json | 2 +- tsconfig.json | 3 --- users/add-user.js | 6 +++--- users/login-user.js | 8 ++++---- users/reauth-user.js | 4 ++-- users/send-email-code.js | 4 ++-- users/social/github-auth.js | 2 +- users/social/google-auth.js | 4 ++-- users/update-user.js | 4 ++-- users/user-auth.js | 2 +- users/validate-token.js | 2 +- utils/functions/serialize-query.js | 2 +- utils/get-schema.js | 2 +- utils/get.js | 6 +++--- utils/post.js | 2 +- 27 files changed, 39 insertions(+), 42 deletions(-) diff --git a/engine/engine/addUsersTableToDb.js b/engine/engine/addUsersTableToDb.js index 31aad98..02dbcb4 100644 --- a/engine/engine/addUsersTableToDb.js +++ b/engine/engine/addUsersTableToDb.js @@ -22,7 +22,7 @@ const updateApiSchemaFromLocalDb = require("../query/update-api-schema-from-loca * ============================================================================== * * @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 */ @@ -33,7 +33,7 @@ module.exports = async function addUsersTableToDb({ dbSchema }) { * @description Initialize */ 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"); try { diff --git a/engine/query/get.js b/engine/query/get.js index a42f5a4..34f5987 100644 --- a/engine/query/get.js +++ b/engine/query/get.js @@ -29,7 +29,7 @@ const runQuery = require("./utils/runQuery"); * * @param {Object} params - Single object passed * @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 } - Return Object */ diff --git a/engine/query/post.js b/engine/query/post.js index 7a03c25..3e070d0 100644 --- a/engine/query/post.js +++ b/engine/query/post.js @@ -24,7 +24,7 @@ const runQuery = require("./utils/runQuery"); * * @param {Object} params - Single object passed * @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 } - Return Object */ diff --git a/engine/query/utils/addDbEntry.js b/engine/query/utils/addDbEntry.js index 561e56e..cf654b5 100644 --- a/engine/query/utils/addDbEntry.js +++ b/engine/query/utils/addDbEntry.js @@ -19,7 +19,7 @@ const updateDbEntry = require("./updateDbEntry"); * @param {string} params.dbFullName - Database full name * @param {string} params.tableName - Table name * @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.duplicateColumnValue] - Duplicate column value * @param {boolean} [params.update] - Update this row if it exists diff --git a/engine/query/utils/deleteDbEntry.js b/engine/query/utils/deleteDbEntry.js index 357e9b0..bdbd31e 100644 --- a/engine/query/utils/deleteDbEntry.js +++ b/engine/query/utils/deleteDbEntry.js @@ -19,7 +19,7 @@ const dbHandler = require("../../engine/utils/dbHandler"); * "Read only" or "Full Access"? Defaults to "Read Only" * @param {string} params.dbFullName - Database full 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|number} params.identifierValue - Update row identifier column value * diff --git a/engine/query/utils/runQuery.js b/engine/query/utils/runQuery.js index 198a578..ceb49f0 100644 --- a/engine/query/utils/runQuery.js +++ b/engine/query/utils/runQuery.js @@ -31,7 +31,7 @@ const varDatabaseDbHandler = require("../../engine/utils/varDatabaseDbHandler"); * @param {string} params.dbFullName - Database full name. Eg. "datasquire_user_2_test" * @param {*} params.query - Query string or object * @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.tableName] - Table Name * diff --git a/engine/query/utils/updateDbEntry.js b/engine/query/utils/updateDbEntry.js index 170f894..9f2a327 100644 --- a/engine/query/utils/updateDbEntry.js +++ b/engine/query/utils/updateDbEntry.js @@ -21,7 +21,7 @@ const dbHandler = require("../../engine/utils/dbHandler"); * @param {string} params.dbFullName - Database full name * @param {string} params.tableName - Table name * @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 | number} params.identifierValue - Update row identifier column value * @param {string} params.encryptionKey - Encryption key diff --git a/engine/user/add-user.js b/engine/user/add-user.js index 3285c32..816f508 100644 --- a/engine/user/add-user.js +++ b/engine/user/add-user.js @@ -20,8 +20,8 @@ const runQuery = require("../query/utils/runQuery"); * @async * * @param {Object} params - Single object passed - * @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").UserDataPayload} params.payload - SQL Query + * @param {import("../../package-shared/types").DSQL_DatabaseSchemaType | undefined} params.dbSchema - Name of the table to query * @param {string} [params.encryptionKey] * @param {string} [params.encryptionSalt] * diff --git a/engine/user/social/github-auth.js b/engine/user/social/github-auth.js index b29b95f..c497b99 100644 --- a/engine/user/social/github-auth.js +++ b/engine/user/social/github-auth.js @@ -36,7 +36,7 @@ const encryptionSalt = process.env.DSQL_ENCRYPTION_SALT || ""; * @param {string} params.clientId * @param {string} params.clientSecret * @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({ res, diff --git a/engine/user/social/google-auth.js b/engine/user/social/google-auth.js index fefcae1..f4e0ecf 100644 --- a/engine/user/social/google-auth.js +++ b/engine/user/social/google-auth.js @@ -44,7 +44,7 @@ const encryptionSalt = process.env.DSQL_ENCRYPTION_SALT || ""; * @param {string} params.clientId - Google client id * @param {http.ServerResponse} params.response - HTTPS response 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 } */ diff --git a/engine/user/social/utils/handleSocialDb.js b/engine/user/social/utils/handleSocialDb.js index 43530f4..f471a6c 100644 --- a/engine/user/social/utils/handleSocialDb.js +++ b/engine/user/social/utils/handleSocialDb.js @@ -74,7 +74,7 @@ const encryptionSalt = process.env.DSQL_ENCRYPTION_SALT || ""; * res: http.ServerResponse, * supEmail?: string | null, * additionalFields?: object, - * dbSchema: import("@/package-shared/types").DSQL_DatabaseSchemaType | undefined + * dbSchema: import("../../../../package-shared/types").DSQL_DatabaseSchemaType | undefined * }} params - function parameters inside an object * * @returns {Promise} - Response object diff --git a/engine/user/update-user.js b/engine/user/update-user.js index 41b5332..79fed3e 100644 --- a/engine/user/update-user.js +++ b/engine/user/update-user.js @@ -17,7 +17,7 @@ const updateDbEntry = require("../query/utils/updateDbEntry"); * * @param {Object} params - Single object passed * @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 } - Return Object */ diff --git a/package.json b/package.json index 7950ee0..f0dd91f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "datasquirel", - "version": "2.2.0", + "version": "2.2.1", "description": "Cloud-based SQL data management tool", "main": "index.js", "bin": { diff --git a/tsconfig.json b/tsconfig.json index 88569e6..392c662 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,9 +2,6 @@ "compilerOptions": { "target": "ES2015", "module": "commonjs", - "paths": { - "@/*": ["./*"] - }, "maxNodeModuleJsDepth": 10, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, diff --git a/users/add-user.js b/users/add-user.js index bbcbbf9..9723aca 100644 --- a/users/add-user.js +++ b/users/add-user.js @@ -26,11 +26,11 @@ const localAddUser = require("../engine/user/add-user"); * @param {object} props - Single object passed * @param {string} props.key - FULL ACCESS API Key * @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.encryptionSalt] * - * @returns { Promise } + * @returns { Promise } */ async function addUser({ key, @@ -64,7 +64,7 @@ async function addUser({ DSQL_PASS?.match(/./) && DSQL_DB_NAME?.match(/./) ) { - /** @type {import("@/package-shared/types").DSQL_DatabaseSchemaType | undefined} */ + /** @type {import("../package-shared/types").DSQL_DatabaseSchemaType | undefined} */ let dbSchema; try { diff --git a/users/login-user.js b/users/login-user.js index 1616280..56531ce 100644 --- a/users/login-user.js +++ b/users/login-user.js @@ -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 {boolean} [params.token] - Send access key as part of response body? * - * @returns { Promise} + * @returns { Promise} */ async function loginUser({ key, @@ -126,7 +126,7 @@ async function loginUser({ DSQL_PASS?.match(/./) && DSQL_DB_NAME?.match(/./) ) { - /** @type {import("@/package-shared/types").DSQL_DatabaseSchemaType | undefined} */ + /** @type {import("../package-shared/types").DSQL_DatabaseSchemaType | undefined} */ let dbSchema; try { @@ -154,10 +154,10 @@ async function loginUser({ * * @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) => { - /** @type {import("@/package-shared/types").PackageUserLoginRequestBody} */ + /** @type {import("../package-shared/types").PackageUserLoginRequestBody} */ const reqPayload = { encryptionKey, payload, diff --git a/users/reauth-user.js b/users/reauth-user.js index 2497429..8d62455 100644 --- a/users/reauth-user.js +++ b/users/reauth-user.js @@ -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.token] - access token to use instead of getting from cookie header * - * @returns { Promise } + * @returns { Promise } */ async function reauthUser({ key, @@ -103,7 +103,7 @@ async function reauthUser({ DSQL_PASS?.match(/./) && DSQL_DB_NAME?.match(/./) ) { - /** @type {import("@/package-shared/types").DSQL_DatabaseSchemaType | undefined} */ + /** @type {import("../package-shared/types").DSQL_DatabaseSchemaType | undefined} */ let dbSchema; try { diff --git a/users/send-email-code.js b/users/send-email-code.js index 2c1e2e0..2125db8 100644 --- a/users/send-email-code.js +++ b/users/send-email-code.js @@ -114,7 +114,7 @@ async function sendEmailCode({ DSQL_PASS?.match(/./) && DSQL_DB_NAME?.match(/./) ) { - /** @type {import("@/package-shared/types").DSQL_DatabaseSchemaType | undefined} */ + /** @type {import("../package-shared/types").DSQL_DatabaseSchemaType | undefined} */ let dbSchema; try { @@ -143,7 +143,7 @@ async function sendEmailCode({ * * @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) => { const reqPayload = JSON.stringify({ diff --git a/users/social/github-auth.js b/users/social/github-auth.js index cf885b2..94a5ae6 100644 --- a/users/social/github-auth.js +++ b/users/social/github-auth.js @@ -154,7 +154,7 @@ async function githubAuth({ DSQL_PASS?.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; try { diff --git a/users/social/google-auth.js b/users/social/google-auth.js index 05d2ffa..7305f0e 100644 --- a/users/social/google-auth.js +++ b/users/social/google-auth.js @@ -150,7 +150,7 @@ async function googleAuth({ DSQL_PASS?.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; try { @@ -179,7 +179,7 @@ async function googleAuth({ * Make https request * * @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) => { const reqPayload = JSON.stringify({ diff --git a/users/update-user.js b/users/update-user.js index ac27a22..fb665ff 100644 --- a/users/update-user.js +++ b/users/update-user.js @@ -29,7 +29,7 @@ const localUpdateUser = require("../engine/user/update-user"); * @param {String} params.database - Target Database * @param {{ id: number } & Object.} params.payload - User Object: ID is required * - * @returns { Promise} + * @returns { Promise} */ async function updateUser({ key, payload, database }) { /** @@ -57,7 +57,7 @@ async function updateUser({ key, payload, database }) { DSQL_PASS?.match(/./) && DSQL_DB_NAME?.match(/./) ) { - /** @type {import("@/package-shared/types").DSQL_DatabaseSchemaType | undefined} */ + /** @type {import("../package-shared/types").DSQL_DatabaseSchemaType | undefined} */ let dbSchema; try { diff --git a/users/user-auth.js b/users/user-auth.js index 942d65d..29597d1 100644 --- a/users/user-auth.js +++ b/users/user-auth.js @@ -30,7 +30,7 @@ const parseCookies = require("../utils/functions/parseCookies"); * @param {string} params.database - Database Name * @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({ request, diff --git a/users/validate-token.js b/users/validate-token.js index 6a862bb..27fc63e 100644 --- a/users/validate-token.js +++ b/users/validate-token.js @@ -27,7 +27,7 @@ const decrypt = require("../functions/decrypt"); * @param {("deep" | "normal")?} [params.level] - Optional. "Deep" value indicates an extra layer of security * @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 }) { try { diff --git a/utils/functions/serialize-query.js b/utils/functions/serialize-query.js index 5e56d62..4ebff2a 100644 --- a/utils/functions/serialize-query.js +++ b/utils/functions/serialize-query.js @@ -1,6 +1,6 @@ // @ts-check -/** @type {import("@/package-shared/types").SerializeQueryFnType} */ +/** @type {import("../../package-shared/types").SerializeQueryFnType} */ function serializeQuery({ query }) { let str = "?"; const keys = Object.keys(query); diff --git a/utils/get-schema.js b/utils/get-schema.js index 0769d8c..c31314a 100644 --- a/utils/get-schema.js +++ b/utils/get-schema.js @@ -18,7 +18,7 @@ const https = require("https"); /** * @typedef {Object} GetSchemaReturn * @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 */ /** diff --git a/utils/get.js b/utils/get.js index 29b3b0e..bfa7b0d 100644 --- a/utils/get.js +++ b/utils/get.js @@ -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.tableName] - Name of the table to query * - * @returns { Promise } - Return Object + * @returns { Promise } - Return Object */ async function get({ key, db, query, queryValues, tableName }) { const scheme = process.env.DSQL_HTTP_SCHEME; @@ -59,7 +59,7 @@ async function get({ key, db, query, queryValues, tableName }) { DSQL_PASS?.match(/./) && DSQL_DB_NAME?.match(/./) ) { - /** @type {import("@/package-shared/types").DSQL_DatabaseSchemaType | undefined} */ + /** @type {import("../package-shared/types").DSQL_DatabaseSchemaType | undefined} */ let dbSchema; try { @@ -86,7 +86,7 @@ async function get({ key, db, query, queryValues, tableName }) { * @description make a request to datasquirel.com */ const httpResponse = await new Promise((resolve, reject) => { - /** @type {import("@/package-shared/types").GetReqQueryObject} */ + /** @type {import("../package-shared/types").GetReqQueryObject} */ const queryObject = { db: String(db), query: String( diff --git a/utils/post.js b/utils/post.js index 1e35f19..5a5eea1 100644 --- a/utils/post.js +++ b/utils/post.js @@ -78,7 +78,7 @@ async function post({ key, query, queryValues, database, tableName }) { DSQL_PASS?.match(/./) && DSQL_DB_NAME?.match(/./) ) { - /** @type {import("@/package-shared/types").DSQL_DatabaseSchemaType | undefined} */ + /** @type {import("../package-shared/types").DSQL_DatabaseSchemaType | undefined} */ let dbSchema; try {