Add .d.ts files

This commit is contained in:
Benjamin Toby
2024-11-08 16:44:31 +01:00
parent afd50caf42
commit 4e42a1f895
69 changed files with 1870 additions and 1 deletions
+37
View File
@@ -0,0 +1,37 @@
export = addDbEntry;
/**
* Add a db Entry Function
* ==============================================================================
* @description Description
* @async
*
* @param {object} params - An object containing the function parameters.
* @param {("Master" | "Dsql User")} [params.dbContext] - What is the database context? "Master"
* or "Dsql User". Defaults to "Master"
* @param {("Read Only" | "Full Access")} [params.paradigm] - What is the paradigm for "Dsql User"?
* "Read only" or "Full Access"? Defaults to "Read Only"
* @param {string} [params.dbFullName] - Database full name
* @param {string} params.tableName - Table name
* @param {any} params.data - Data to add
* @param {import("../../../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
* @param {string} [params.encryptionKey] - Update this row if it exists
* @param {string} [params.encryptionSalt] - Update this row if it exists
*
* @returns {Promise<any>}
*/
declare function addDbEntry({ dbContext, paradigm, dbFullName, tableName, data, tableSchema, duplicateColumnName, duplicateColumnValue, update, encryptionKey, encryptionSalt, }: {
dbContext?: ("Master" | "Dsql User");
paradigm?: ("Read Only" | "Full Access");
dbFullName?: string;
tableName: string;
data: any;
tableSchema?: import("../../../types").DSQL_TableSchemaType;
duplicateColumnName?: string;
duplicateColumnValue?: string;
update?: boolean;
encryptionKey?: string;
encryptionSalt?: string;
}): Promise<any>;
+32
View File
@@ -0,0 +1,32 @@
export = deleteDbEntry;
/**
* Imports: Handle imports
*/
/**
* Delete DB Entry Function
* ==============================================================================
* @description Description
* @async
*
* @param {object} params - An object containing the function parameters.
* @param {string} [params.dbContext] - What is the database context? "Master"
* or "Dsql User". Defaults to "Master"
* @param {("Read Only" | "Full Access")} [params.paradigm] - What is the paradigm for "Dsql User"?
* "Read only" or "Full Access"? Defaults to "Read Only"
* @param {string} params.dbFullName - Database full name
* @param {string} params.tableName - Table name
* @param {import("../../../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
*
* @returns {Promise<object|null>}
*/
declare function deleteDbEntry({ dbContext, paradigm, dbFullName, tableName, identifierColumnName, identifierValue, }: {
dbContext?: string;
paradigm?: ("Read Only" | "Full Access");
dbFullName: string;
tableName: string;
tableSchema?: import("../../../types").DSQL_TableSchemaType;
identifierColumnName: string;
identifierValue: string | number;
}): Promise<object | null>;
+30
View File
@@ -0,0 +1,30 @@
export = runQuery;
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/**
* Run DSQL users queries
* ==============================================================================
* @param {object} params - An object containing the function parameters.
* @param {string} params.dbFullName - Database full name. Eg. "datasquire_user_2_test"
* @param {string | any} params.query - Query string or object
* @param {boolean} [params.readOnly] - Is this operation read only?
* @param {boolean} [params.local] - Is this operation read only?
* @param {import("../../../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
*
* @return {Promise<any>}
*/
declare function runQuery({ dbFullName, query, readOnly, dbSchema, queryValuesArray, tableName, local, }: {
dbFullName: string;
query: string | any;
readOnly?: boolean;
local?: boolean;
dbSchema?: import("../../../types").DSQL_DatabaseSchemaType;
queryValuesArray?: string[];
tableName?: string;
}): Promise<any>;
+35
View File
@@ -0,0 +1,35 @@
export = updateDbEntry;
/**
* Update DB Function
* ==============================================================================
* @description Description
* @async
*
* @param {object} params - An object containing the function parameters.
* @param {("Master" | "Dsql User")} [params.dbContext] - What is the database context? "Master"
* or "Dsql User". Defaults to "Master"
* @param {("Read Only" | "Full Access")} [params.paradigm] - What is the paradigm for "Dsql User"?
* "Read only" or "Full Access"? Defaults to "Read Only"
* @param {string} [params.dbFullName] - Database full name
* @param {string} params.tableName - Table name
* @param {string} [params.encryptionKey]
* @param {string} [params.encryptionSalt]
* @param {any} params.data - Data to add
* @param {import("../../../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
*
* @returns {Promise<object|null>}
*/
declare function updateDbEntry({ dbContext, paradigm, dbFullName, tableName, data, tableSchema, identifierColumnName, identifierValue, encryptionKey, encryptionSalt, }: {
dbContext?: ("Master" | "Dsql User");
paradigm?: ("Read Only" | "Full Access");
dbFullName?: string;
tableName: string;
encryptionKey?: string;
encryptionSalt?: string;
data: any;
tableSchema?: import("../../../types").DSQL_TableSchemaType;
identifierColumnName: string;
identifierValue: string | number;
}): Promise<object | null>;
+6
View File
@@ -0,0 +1,6 @@
export = decrypt;
/**
* @param {string} encryptedString
* @returns {string | null}
*/
declare function decrypt(encryptedString: string): string | null;
@@ -0,0 +1,7 @@
export = defaultFieldsRegexp;
/**
* Regular expression to match default fields
*
* @description Regular expression to match default fields
*/
declare const defaultFieldsRegexp: RegExp;
+9
View File
@@ -0,0 +1,9 @@
export = encrypt;
/**
* @async
* @param {string} data
* @param {string} [encryptionKey]
* @param {string} [encryptionSalt]
* @returns {string | null}
*/
declare function encrypt(data: string, encryptionKey?: string, encryptionSalt?: string): string | null;
@@ -0,0 +1,8 @@
declare function _exports({ queryString, database, tableSchema, queryValuesArray, local, }: {
queryString: string;
database: string;
local?: boolean;
tableSchema?: import("../../types").DSQL_TableSchemaType | null;
queryValuesArray?: string[];
}): Promise<any>;
export = _exports;
@@ -0,0 +1,6 @@
export let allowedTags: string[];
export let allowedAttributes: {
a: string[];
img: string[];
"*": string[];
};
+5
View File
@@ -0,0 +1,5 @@
declare function _exports({ unparsedResults, tableSchema, }: {
unparsedResults: any[];
tableSchema?: import("../../types").DSQL_TableSchemaType;
}): Promise<object[] | null>;
export = _exports;
+12
View File
@@ -0,0 +1,12 @@
declare function _exports({ user, message, component, noMail, }: {
user?: {
id?: number | string;
first_name?: string;
last_name?: string;
email?: string;
} & any;
message: string;
component?: string;
noMail?: boolean;
}): Promise<void>;
export = _exports;
@@ -0,0 +1,7 @@
declare function _exports({ queryString, database, queryValuesArray, tableSchema, }: {
queryString: string;
database: string;
queryValuesArray?: string[];
tableSchema?: import("../../types").DSQL_TableSchemaType;
}): Promise<any>;
export = _exports;
@@ -0,0 +1,9 @@
export = DB_HANDLER;
/**
* DSQL user read-only DB handler
* @param {object} params
* @param {string} params.paradigm
* @param {string} params.database
* @param {string} params.queryString
* @param {string[]} [params.queryValues]
*/ declare function DB_HANDLER(...args: any[]): Promise<any>;
@@ -0,0 +1,18 @@
export = DSQL_USER_DB_HANDLER;
/**
* DSQL user read-only DB handler
* @param {object} params
* @param {"Full Access" | "FA" | "Read Only"} params.paradigm
* @param {string} params.database
* @param {string} params.queryString
* @param {string[]} [params.queryValues]
*/
declare function DSQL_USER_DB_HANDLER({ paradigm, database, queryString, queryValues, }: {
paradigm: "Full Access" | "FA" | "Read Only";
database: string;
queryString: string;
queryValues?: string[];
}): Promise<any> | {
success: boolean;
error: any;
};
+4
View File
@@ -0,0 +1,4 @@
declare function _exports(): string | (import("tls").SecureContextOptions & {
rejectUnauthorized?: boolean | undefined;
}) | undefined;
export = _exports;