From 34868ee0cf138acf6f79b4ad65df310edb773981 Mon Sep 17 00:00:00 2001 From: Benjamin Toby Date: Fri, 6 Dec 2024 11:53:26 +0100 Subject: [PATCH] Updates --- index.d.ts | 18 ++++++++++++++++++ index.js | 7 +++++++ package.json | 2 +- users/add-user.d.ts | 4 ++-- users/add-user.js | 2 +- 5 files changed, 29 insertions(+), 4 deletions(-) diff --git a/index.d.ts b/index.d.ts index dad38a0..243822c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -49,4 +49,22 @@ import sqlGenerator = require("./package-shared/functions/dsql/sql/sql-generator import sqlInsertGenerator = require("./package-shared/functions/dsql/sql/sql-insert-generator"); import sqlDeleteGenerator = require("./package-shared/functions/dsql/sql/sql-delete-generator"); import trimSql = require("./package-shared/utils/trim-sql"); +export declare namespace utils { + namespace crypto { + let encrypt: ({ data, encryptionKey, encryptionSalt }: { + data: string; + encryptionKey?: string; + encryptionSalt?: string; + }) => string | null; + let decrypt: ({ encryptedString, encryptionKey, encryptionSalt }: { + encryptedString: string; + encryptionKey?: string; + encryptionSalt?: string; + }) => string; + let hashPassword: ({ password, encryptionKey }: { + password: string; + encryptionKey: string; + }) => string; + } +} export { get, post, getSchema, sanitizeSql, datasquirelClient as client }; diff --git a/index.js b/index.js index 8f66b79..ca91661 100644 --- a/index.js +++ b/index.js @@ -88,6 +88,13 @@ const datasquirel = { sanitizeSql, client: datasquirelClient, sql, + utils: { + crypto: { + encrypt: require("./package-shared/functions/dsql/encrypt"), + decrypt: require("./package-shared/functions/dsql/decrypt"), + hashPassword: require("./package-shared/functions/dsql/hashPassword"), + }, + }, }; module.exports = datasquirel; diff --git a/package.json b/package.json index 581a047..05d3896 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@moduletrace/datasquirel", - "version": "2.7.5", + "version": "2.7.6", "description": "Cloud-based SQL data management tool", "main": "index.js", "bin": { diff --git a/users/add-user.d.ts b/users/add-user.d.ts index 78353c0..1f279c1 100644 --- a/users/add-user.d.ts +++ b/users/add-user.d.ts @@ -11,7 +11,7 @@ export = addUser; * @param {string} param.encryptionKey * @param {string} [param.encryptionSalt] * @param {string | number} [param.user_id] - * @param {string | number} param.apiUserId + * @param {string | number} [param.apiUserId] * @param {boolean} [param.useLocal] * * @returns { Promise } @@ -23,6 +23,6 @@ declare function addUser({ key, payload, database, encryptionKey, user_id, useLo encryptionKey: string; encryptionSalt?: string; user_id?: string | number; - apiUserId: string | number; + apiUserId?: string | number; useLocal?: boolean; }): Promise; diff --git a/users/add-user.js b/users/add-user.js index 7c6baf9..99dcb35 100644 --- a/users/add-user.js +++ b/users/add-user.js @@ -17,7 +17,7 @@ const apiCreateUser = require("../package-shared/functions/api/users/api-create- * @param {string} param.encryptionKey * @param {string} [param.encryptionSalt] * @param {string | number} [param.user_id] - * @param {string | number} param.apiUserId + * @param {string | number} [param.apiUserId] * @param {boolean} [param.useLocal] * * @returns { Promise }