Updates
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { DATASQUIREL_LoggedInUser } from "../../types";
|
||||
type Param = {
|
||||
query: {
|
||||
invite: number;
|
||||
database_access: string;
|
||||
priviledge: string;
|
||||
email: string;
|
||||
};
|
||||
user: DATASQUIREL_LoggedInUser;
|
||||
};
|
||||
/**
|
||||
* Add Admin User on Login
|
||||
* ==============================================================================
|
||||
*
|
||||
* @description this function handles admin users that have been invited by another
|
||||
* admin user. This fires when the invited user has been logged in or a new account
|
||||
* has been created for the invited user
|
||||
*/
|
||||
export default function addAdminUserOnLogin({ query, user, }: Param): Promise<any>;
|
||||
export {};
|
||||
@@ -0,0 +1,8 @@
|
||||
type Param = {
|
||||
userId: number | string;
|
||||
};
|
||||
/**
|
||||
* # Add Mariadb User
|
||||
*/
|
||||
export default function addMariadbUser({ userId }: Param): Promise<any>;
|
||||
export {};
|
||||
@@ -0,0 +1,12 @@
|
||||
type Param = {
|
||||
userId: number;
|
||||
database: string;
|
||||
payload?: {
|
||||
[s: string]: any;
|
||||
};
|
||||
};
|
||||
/**
|
||||
* # Add User Table to Database
|
||||
*/
|
||||
export default function addUsersTableToDb({ userId, database, payload, }: Param): Promise<any>;
|
||||
export {};
|
||||
@@ -0,0 +1,6 @@
|
||||
import { CheckApiCredentialsFn } from "../../types";
|
||||
/**
|
||||
* # Grap API Credentials
|
||||
*/
|
||||
declare const grabApiCred: CheckApiCredentialsFn;
|
||||
export default grabApiCred;
|
||||
@@ -0,0 +1,29 @@
|
||||
export declare const grabAuthDirs: () => {
|
||||
root: string;
|
||||
auth: string;
|
||||
};
|
||||
export declare const initAuthFiles: () => boolean;
|
||||
/**
|
||||
* # Write Auth Files
|
||||
*/
|
||||
export declare const writeAuthFile: (name: string, data: string, cleanup?: {
|
||||
userId: string | number;
|
||||
}) => boolean;
|
||||
/**
|
||||
* # Clean up User Auth Files
|
||||
*/
|
||||
export declare const cleanupUserAuthFiles: (userId: string | number) => boolean;
|
||||
/**
|
||||
* # Get Auth Files
|
||||
*/
|
||||
export declare const getAuthFile: (name: string) => string | null;
|
||||
/**
|
||||
* # Delete Auth Files
|
||||
* @param {string} name
|
||||
*/
|
||||
export declare const deleteAuthFile: (name: string) => void | null;
|
||||
/**
|
||||
* # Delete Auth Files
|
||||
* @param {string} name
|
||||
*/
|
||||
export declare const checkAuthFile: (name: string) => boolean;
|
||||
@@ -0,0 +1,14 @@
|
||||
type Param = {
|
||||
database?: string;
|
||||
userId?: string | number;
|
||||
};
|
||||
type Return = {
|
||||
keyCookieName: string;
|
||||
csrfCookieName: string;
|
||||
oneTimeCodeName: string;
|
||||
};
|
||||
/**
|
||||
* # Grab Auth Cookie Names
|
||||
*/
|
||||
export default function getAuthCookieNames(params?: Param): Return;
|
||||
export {};
|
||||
@@ -0,0 +1,20 @@
|
||||
import { DbContextsArray } from "./runQuery";
|
||||
type Param = {
|
||||
dbContext?: (typeof DbContextsArray)[number];
|
||||
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;
|
||||
forceLocal?: boolean;
|
||||
};
|
||||
/**
|
||||
* Add a db Entry Function
|
||||
*/
|
||||
export default function addDbEntry({ dbContext, paradigm, dbFullName, tableName, data, tableSchema, duplicateColumnName, duplicateColumnValue, update, encryptionKey, encryptionSalt, forceLocal, }: Param): Promise<any>;
|
||||
export {};
|
||||
@@ -0,0 +1,16 @@
|
||||
import { DbContextsArray } from "./runQuery";
|
||||
type Param = {
|
||||
dbContext?: (typeof DbContextsArray)[number];
|
||||
dbFullName: string;
|
||||
tableName: string;
|
||||
tableSchema?: import("../../../types").DSQL_TableSchemaType;
|
||||
identifierColumnName: string;
|
||||
identifierValue: string | number;
|
||||
forceLocal?: boolean;
|
||||
};
|
||||
/**
|
||||
* # Delete DB Entry Function
|
||||
* @description
|
||||
*/
|
||||
export default function deleteDbEntry({ dbContext, dbFullName, tableName, identifierColumnName, identifierValue, forceLocal, }: Param): Promise<object | null>;
|
||||
export {};
|
||||
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
* # Path Traversal Check
|
||||
* @returns {string}
|
||||
*/
|
||||
export default function pathTraversalCheck(text: string | number): string;
|
||||
@@ -0,0 +1,21 @@
|
||||
export declare const DbContextsArray: readonly ["Master", "Dsql User"];
|
||||
type Param = {
|
||||
dbContext?: (typeof DbContextsArray)[number];
|
||||
dbFullName: string;
|
||||
query: string | any;
|
||||
readOnly?: boolean;
|
||||
debug?: boolean;
|
||||
dbSchema?: import("../../../types").DSQL_DatabaseSchemaType;
|
||||
queryValuesArray?: (string | number)[];
|
||||
tableName?: string;
|
||||
forceLocal?: boolean;
|
||||
};
|
||||
type Return = {
|
||||
result: any;
|
||||
error?: string;
|
||||
};
|
||||
/**
|
||||
* # Run DSQL users queries
|
||||
*/
|
||||
export default function runQuery({ dbFullName, query, readOnly, dbSchema, queryValuesArray, tableName, debug, dbContext, forceLocal, }: Param): Promise<Return>;
|
||||
export {};
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Sanitize SQL function
|
||||
* ==============================================================================
|
||||
* @description this function takes in a text(or number) and returns a sanitized
|
||||
* text, usually without spaces
|
||||
*/
|
||||
declare function sanitizeSql(text: any, spaces?: boolean, regex?: RegExp | null): any;
|
||||
export default sanitizeSql;
|
||||
@@ -0,0 +1,19 @@
|
||||
import { DbContextsArray } from "./runQuery";
|
||||
type Param = {
|
||||
dbContext?: (typeof DbContextsArray)[number];
|
||||
dbFullName?: string;
|
||||
tableName: string;
|
||||
encryptionKey?: string;
|
||||
encryptionSalt?: string;
|
||||
data: any;
|
||||
tableSchema?: import("../../../types").DSQL_TableSchemaType;
|
||||
identifierColumnName: string;
|
||||
identifierValue: string | number;
|
||||
forceLocal?: boolean;
|
||||
};
|
||||
/**
|
||||
* # Update DB Function
|
||||
* @description
|
||||
*/
|
||||
export default function updateDbEntry({ dbContext, dbFullName, tableName, data, tableSchema, identifierColumnName, identifierValue, encryptionKey, encryptionSalt, forceLocal, }: Param): Promise<object | null>;
|
||||
export {};
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* # Main DB Handler Function
|
||||
*/
|
||||
export default function dbHandler(...args: any[]): Promise<any>;
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Regular expression to match default fields
|
||||
*
|
||||
* @description Regular expression to match default fields
|
||||
*/
|
||||
declare const defaultFieldsRegexp: RegExp;
|
||||
export default defaultFieldsRegexp;
|
||||
@@ -0,0 +1,11 @@
|
||||
type Param = {
|
||||
queryString: string;
|
||||
tableSchema?: import("../../types").DSQL_TableSchemaType | null;
|
||||
queryValuesArray?: string[];
|
||||
forceLocal?: boolean;
|
||||
};
|
||||
/**
|
||||
* # Full Access Db Handler
|
||||
*/
|
||||
export default function fullAccessDbHandler({ queryString, tableSchema, queryValuesArray, forceLocal, }: Param): Promise<any>;
|
||||
export {};
|
||||
@@ -0,0 +1,9 @@
|
||||
import { DSQL_TableSchemaType } from "../../types";
|
||||
/**
|
||||
* # Add User Table to Database
|
||||
*/
|
||||
export default function grabNewUsersTableSchema(params: {
|
||||
payload?: {
|
||||
[s: string]: any;
|
||||
};
|
||||
}): DSQL_TableSchemaType | null;
|
||||
@@ -0,0 +1,16 @@
|
||||
import { DSQL_FieldSchemaType } from "../../types";
|
||||
type Param = {
|
||||
data?: {
|
||||
[s: string]: any;
|
||||
};
|
||||
fields?: string[];
|
||||
excludeData?: {
|
||||
[s: string]: any;
|
||||
};
|
||||
excludeFields?: DSQL_FieldSchemaType[];
|
||||
};
|
||||
/**
|
||||
* # Add User Table to Database
|
||||
*/
|
||||
export default function grabSchemaFieldsFromData({ data, fields, excludeData, excludeFields, }: Param): DSQL_FieldSchemaType[];
|
||||
export {};
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* # Grab User Schema Data
|
||||
*/
|
||||
export default function grabUserSchemaData({ userId, }: {
|
||||
userId: string | number;
|
||||
}): import("../../types").DSQL_DatabaseSchemaType[] | null;
|
||||
@@ -0,0 +1,11 @@
|
||||
import Mail from "nodemailer/lib/mailer";
|
||||
import SMTPTransport from "nodemailer/lib/smtp-transport";
|
||||
export type HandleNodemailerParam = Mail.Options & {
|
||||
senderName?: string;
|
||||
alias?: string | null;
|
||||
options?: SMTPTransport.Options;
|
||||
};
|
||||
/**
|
||||
* # Handle mails With Nodemailer
|
||||
*/
|
||||
export default function handleNodemailer(params: HandleNodemailerParam): Promise<SMTPTransport.SentMessageInfo | undefined>;
|
||||
@@ -0,0 +1,9 @@
|
||||
declare const sanitizeHtmlOptions: {
|
||||
allowedTags: string[];
|
||||
allowedAttributes: {
|
||||
a: string[];
|
||||
img: string[];
|
||||
"*": string[];
|
||||
};
|
||||
};
|
||||
export default sanitizeHtmlOptions;
|
||||
@@ -0,0 +1,13 @@
|
||||
import { HttpFunctionResponse, HttpRequestParams } from "../../types";
|
||||
/**
|
||||
* # Generate a http Request
|
||||
*/
|
||||
export default function httpRequest<ReqObj extends {
|
||||
[k: string]: any;
|
||||
} = {
|
||||
[k: string]: any;
|
||||
}, ResObj extends {
|
||||
[k: string]: any;
|
||||
} = {
|
||||
[k: string]: any;
|
||||
}>(params: HttpRequestParams<ReqObj>): Promise<HttpFunctionResponse<ResObj>>;
|
||||
@@ -0,0 +1,15 @@
|
||||
type Param = {
|
||||
scheme?: string;
|
||||
url?: string;
|
||||
method?: string;
|
||||
hostname?: string;
|
||||
path?: string;
|
||||
port?: number | string;
|
||||
headers?: object;
|
||||
body?: object;
|
||||
};
|
||||
/**
|
||||
* # Make Https Request
|
||||
*/
|
||||
export default function httpsRequest({ url, method, hostname, path, headers, body, port, scheme, }: Param): Promise<unknown>;
|
||||
export {};
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* # No Database DB Handler
|
||||
*/
|
||||
export default function noDatabaseDbHandler(queryString: string): Promise<any>;
|
||||
@@ -0,0 +1,13 @@
|
||||
type Param = {
|
||||
unparsedResults: any[];
|
||||
tableSchema?: import("../../types").DSQL_TableSchemaType;
|
||||
};
|
||||
/**
|
||||
* Parse Database results
|
||||
* ==============================================================================
|
||||
* @description this function takes a database results array gotten from a DB handler
|
||||
* function, decrypts encrypted fields, and returns an updated array with no encrypted
|
||||
* fields
|
||||
*/
|
||||
export default function parseDbResults({ unparsedResults, tableSchema, }: Param): Promise<any[] | null>;
|
||||
export {};
|
||||
@@ -0,0 +1,10 @@
|
||||
import { DSQL_DATASQUIREL_PROCESS_QUEUE } from "../../../types/dsql";
|
||||
type Param = {
|
||||
queue: DSQL_DATASQUIREL_PROCESS_QUEUE;
|
||||
userId: string | number;
|
||||
dummy?: boolean;
|
||||
};
|
||||
export default function addQueue({ queue, userId, dummy }: Param): Promise<(import("../../../types").PostReturn & {
|
||||
queryObject?: ReturnType<Awaited<typeof import("../../dsql/sql/sql-generator").default>>;
|
||||
}) | null | undefined>;
|
||||
export {};
|
||||
@@ -0,0 +1,6 @@
|
||||
type Param = {
|
||||
queueId: string | number;
|
||||
userId: string | number;
|
||||
};
|
||||
export default function deleteQueue({ queueId, userId }: Param): Promise<boolean>;
|
||||
export {};
|
||||
@@ -0,0 +1,10 @@
|
||||
import { DSQL_DATASQUIREL_PROCESS_QUEUE } from "../../../types/dsql";
|
||||
import { DsqlCrudQueryObject } from "../../../types";
|
||||
type Param = {
|
||||
queueId?: string | number;
|
||||
userId?: string | number;
|
||||
query?: DsqlCrudQueryObject<DSQL_DATASQUIREL_PROCESS_QUEUE>;
|
||||
single?: boolean;
|
||||
};
|
||||
export default function getQueue({ queueId, userId, query, single, }: Param): Promise<DSQL_DATASQUIREL_PROCESS_QUEUE | DSQL_DATASQUIREL_PROCESS_QUEUE[] | undefined>;
|
||||
export {};
|
||||
@@ -0,0 +1,7 @@
|
||||
import { DSQL_DATASQUIREL_PROCESS_QUEUE } from "../../../types/dsql";
|
||||
type Param = {
|
||||
queueId: string | number;
|
||||
queue: DSQL_DATASQUIREL_PROCESS_QUEUE;
|
||||
};
|
||||
export default function updateQueue({ queueId, queue }: Param): Promise<boolean>;
|
||||
export {};
|
||||
@@ -0,0 +1,18 @@
|
||||
import { IncomingMessage } from "http";
|
||||
type Param = {
|
||||
user?: {
|
||||
id?: number | string;
|
||||
first_name?: string;
|
||||
last_name?: string;
|
||||
email?: string;
|
||||
} & any;
|
||||
message: string;
|
||||
component?: string;
|
||||
noMail?: boolean;
|
||||
req?: import("next").NextApiRequest & IncomingMessage;
|
||||
};
|
||||
/**
|
||||
* # Server Error
|
||||
*/
|
||||
export default function serverError({ user, message, component, noMail, req, }: Param): Promise<void>;
|
||||
export {};
|
||||
@@ -0,0 +1,10 @@
|
||||
import { DSQL_DatabaseSchemaType } from "../../types";
|
||||
type Param = {
|
||||
userId: string | number;
|
||||
schemaData: DSQL_DatabaseSchemaType[];
|
||||
};
|
||||
/**
|
||||
* # Set User Schema Data
|
||||
*/
|
||||
export default function setUserSchemaData({ userId, schemaData, }: Param): boolean;
|
||||
export {};
|
||||
@@ -0,0 +1,8 @@
|
||||
import { IncomingMessage } from "http";
|
||||
export default function (req: IncomingMessage): Promise<{
|
||||
email: string;
|
||||
password: string;
|
||||
authKey: string;
|
||||
logged_in_status: boolean;
|
||||
date: number;
|
||||
} | null>;
|
||||
@@ -0,0 +1,13 @@
|
||||
type Param = {
|
||||
userId: number | string;
|
||||
database: string;
|
||||
newFields?: string[];
|
||||
newPayload?: {
|
||||
[s: string]: any;
|
||||
};
|
||||
};
|
||||
/**
|
||||
* # Add User Table to Database
|
||||
*/
|
||||
export default function updateUsersTableSchema({ userId, database, newFields, newPayload, }: Param): Promise<any>;
|
||||
export {};
|
||||
@@ -0,0 +1,12 @@
|
||||
type Param = {
|
||||
queryString: string;
|
||||
queryValuesArray?: any[];
|
||||
database?: string;
|
||||
tableSchema?: import("../../types").DSQL_TableSchemaType;
|
||||
debug?: boolean;
|
||||
};
|
||||
/**
|
||||
* # DB handler for specific database
|
||||
*/
|
||||
export default function varDatabaseDbHandler({ queryString, queryValuesArray, database, tableSchema, debug, }: Param): Promise<any>;
|
||||
export {};
|
||||
@@ -0,0 +1,12 @@
|
||||
type Param = {
|
||||
queryString: string;
|
||||
queryValuesArray?: string[];
|
||||
tableSchema?: import("../../types").DSQL_TableSchemaType;
|
||||
forceLocal?: boolean;
|
||||
};
|
||||
/**
|
||||
* # Read Only Db Handler with Varaibles
|
||||
* @returns
|
||||
*/
|
||||
export default function varReadOnlyDatabaseDbHandler({ queryString, queryValuesArray, tableSchema, forceLocal, }: Param): Promise<any>;
|
||||
export {};
|
||||
Reference in New Issue
Block a user