This commit is contained in:
Benjamin Toby
2025-04-18 12:05:10 +01:00
parent fb0bc4b753
commit 8d38f99bf1
180 changed files with 3 additions and 3974 deletions
@@ -1,8 +0,0 @@
export type ExportMariaDBDatabaseParam = {
dbFullName: string;
targetFilePath: string;
mariadbUser?: string;
mariadbHost?: string;
mariadbPass?: string;
};
export default function exportMariadbDatabase({ dbFullName, targetFilePath, mariadbHost, mariadbPass, mariadbUser, }: ExportMariaDBDatabaseParam): string | Buffer<ArrayBufferLike>;
@@ -1,5 +0,0 @@
/**
* # DSQL user read-only DB handler
* @requires DSQL_DB_CONN - Gobal Variable for Datasquirel Database
*/
export default function DB_HANDLER(...args: any[]): Promise<any>;
@@ -1,10 +0,0 @@
type Param = {
paradigm: "Full Access" | "FA" | "Read Only";
queryString: string;
queryValues?: string[];
};
/**
* # DSQL user read-only DB handler
*/
export default function DSQL_USER_DB_HANDLER({ paradigm, queryString, queryValues, }: Param): Promise<any>;
export {};
@@ -1,4 +0,0 @@
/**
* # DSQL user read-only DB handler
*/
export default function LOCAL_DB_HANDLER(...args: any[]): Promise<any>;
@@ -1,7 +0,0 @@
/**
* # DSQL user read-only DB handler
*/
export default function NO_DB_HANDLER(...args: any[]): Promise<unknown> | {
success: boolean;
error: any;
};
@@ -1,7 +0,0 @@
/**
* # Root DB handler
*/
export default function ROOT_DB_HANDLER(...args: any[]): Promise<unknown> | {
success: boolean;
error: any;
};
-8
View File
@@ -1,8 +0,0 @@
type Return = string | (import("tls").SecureContextOptions & {
rejectUnauthorized?: boolean | undefined;
}) | undefined;
/**
* # Grall SSL
*/
export default function grabDbSSL(): Return;
export {};
@@ -1,8 +0,0 @@
export type ExportMariaDBDatabaseParam = {
dbFullName: string;
targetFilePath: string;
mariadbUser?: string;
mariadbHost?: string;
mariadbPass?: string;
};
export default function importMariadbDatabase({ dbFullName, targetFilePath, mariadbHost, mariadbPass, mariadbUser, }: ExportMariaDBDatabaseParam): Promise<string | Buffer<ArrayBufferLike>>;
@@ -1,34 +0,0 @@
import { DATASQUIREL_LoggedInUser, UserType } from "../../../types";
type Param = {
user?: DATASQUIREL_LoggedInUser | UserType;
userId?: string | number | null;
appDir?: string;
};
export default function grabDirNames(param?: Param): {
appDir: string;
schemasDir: string;
userDirPath: string | undefined;
mainShemaJSONFilePath: string;
mainDbTypeDefFile: string;
tempDirName: string;
defaultTableFieldsJSONFilePath: string;
usersSchemaDir: string;
userSchemaMainJSONFilePath: string | undefined;
userPrivateMediaDir: string | undefined;
userPrivateExportsDir: string | undefined;
userPrivateSQLExportsDir: string | undefined;
userPrivateTempSQLExportsDir: string | undefined;
userPrivateTempJSONSchemaFilePath: string | undefined;
userPrivateDbExportZipFileName: string;
userPrivateDbExportZipFilePath: string | undefined;
userPrivateDbImportZipFileName: string;
userPrivateDbImportZipFilePath: string | undefined;
dbNginxLoadBalancerConfigFile: string;
dockerComposeFile: string;
testDockerComposeFile: string;
extraDockerComposeFile: string;
siteSetupFile: string;
envFile: string;
testEnvFile: string;
};
export {};
@@ -1,6 +0,0 @@
type Param = {
str: string;
userId: string | number;
};
export default function replaceDatasquirelDbName({ str, userId, }: Param): string;
export {};
-16
View File
@@ -1,16 +0,0 @@
import { IncomingMessage } from "http";
/**
* Parse request cookies
* ===================================================
*
* @description This function takes in a request object and
* returns the cookies as a JS object
*/
export default function parseCookies({ request, cookieString, }: {
request?: IncomingMessage & {
[s: string]: any;
};
cookieString?: string;
}): {
[s: string]: string;
};
@@ -1,7 +0,0 @@
/**
* Convert Camel Joined Text to Camel Spaced Text
* ==============================================================================
* @description this function takes a camel cased text without spaces, and returns
* a camel-case-spaced text
*/
export default function camelJoinedtoCamelSpace(text: string): string | null;
-6
View File
@@ -1,6 +0,0 @@
type Param = {
dbContext?: "Master" | "Dsql User";
dbFullName?: string;
};
export default function checkIfIsMaster({ dbContext, dbFullName }: Param): boolean;
export {};
-55
View File
@@ -1,55 +0,0 @@
declare const consoleColors: {
Reset: string;
Bright: string;
Dim: string;
Underscore: string;
Blink: string;
Reverse: string;
Hidden: string;
FgBlack: string;
FgRed: string;
FgGreen: string;
FgYellow: string;
FgBlue: string;
FgMagenta: string;
FgCyan: string;
FgWhite: string;
FgGray: string;
BgBlack: string;
BgRed: string;
BgGreen: string;
BgYellow: string;
BgBlue: string;
BgMagenta: string;
BgCyan: string;
BgWhite: string;
BgGray: string;
};
export default consoleColors;
export declare const ccol: {
Reset: string;
Bright: string;
Dim: string;
Underscore: string;
Blink: string;
Reverse: string;
Hidden: string;
FgBlack: string;
FgRed: string;
FgGreen: string;
FgYellow: string;
FgBlue: string;
FgMagenta: string;
FgCyan: string;
FgWhite: string;
FgGray: string;
BgBlack: string;
BgRed: string;
BgGreen: string;
BgYellow: string;
BgBlue: string;
BgMagenta: string;
BgCyan: string;
BgWhite: string;
BgGray: string;
};
-9
View File
@@ -1,9 +0,0 @@
import sqlGenerator from "../../functions/dsql/sql/sql-generator";
import { DsqlCrudParam, PostReturn } from "../../types";
export default function dsqlCrud<T extends {
[key: string]: any;
} = {
[key: string]: any;
}>({ action, data, table, targetId, query, sanitize, debug, }: DsqlCrudParam<T>): Promise<(PostReturn & {
queryObject?: ReturnType<Awaited<typeof sqlGenerator>>;
}) | null>;
@@ -1,21 +0,0 @@
import sqlGenerator from "../../functions/dsql/sql/sql-generator";
import { DsqlMethodCrudParam, ServerQueryParam } from "../../types";
export type APIDataCrudQuery = ServerQueryParam & {
page?: number;
};
export type CRUDResponseObject<P extends any = any> = {
success: boolean;
payload?: P;
msg?: string;
error?: string;
queryObject?: ReturnType<Awaited<typeof sqlGenerator>>;
};
export default function dsqlMethodCrud<T extends {
[key: string]: any;
} = {
[key: string]: any;
}, P extends {
[key: string]: any;
} = {
[key: string]: any;
}>({ method, tableName, addUser, user, extraData, transformData, existingData, body, query, targetId, sanitize, transformQuery, debug, }: DsqlMethodCrudParam<T>): Promise<CRUDResponseObject<P>>;
-25
View File
@@ -1,25 +0,0 @@
import { ServerlessMysql } from "serverless-mysql";
type QueryObject = {
query: string;
values?: (string | number | undefined)[];
};
type Return<ReturnType = any> = ReturnType | null;
/**
* # Run Query From MySQL Connection
* @description Run a query from a pre-existing MySQL/Mariadb Connection
* setup with `serverless-mysql` npm module
*/
export default function connDbHandler<ReturnType = any>(
/**
* ServerlessMySQL Connection Object
*/
conn?: ServerlessMysql,
/**
* String Or `QueryObject` Array
*/
query?: QueryObject["query"] | QueryObject[],
/**
* Array of Values to Sanitize and Inject
*/
values?: QueryObject["values"]): Promise<Return<ReturnType>>;
export {};
-8
View File
@@ -1,8 +0,0 @@
/**
* # Convert Serialized Query back to object
*/
export default function deserializeQuery(query: string | {
[s: string]: any;
}): {
[s: string]: any;
};
-17
View File
@@ -1,17 +0,0 @@
/**
* # EJSON parse string
*/
declare function parse(string: string | null | number, reviver?: (this: any, key: string, value: any) => any): {
[s: string]: any;
} | {
[s: string]: any;
}[] | undefined;
/**
* # EJSON stringify object
*/
declare function stringify(value: any, replacer?: ((this: any, key: string, value: any) => any) | null, space?: string | number): string | undefined;
declare const EJSON: {
parse: typeof parse;
stringify: typeof stringify;
};
export default EJSON;
-1
View File
@@ -1 +0,0 @@
export default function emptyDirectory(dir: string): void;
-6
View File
@@ -1,6 +0,0 @@
import mysql from "mysql";
/**
* # End MYSQL Connection
*/
declare function endConnection(connection: mysql.Connection): void;
export default endConnection;
@@ -1,21 +0,0 @@
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/**
* # Generate SQL text for Field
*/
export default function generateColumnDescription({ columnData, primaryKeySet, }: {
columnData: import("../types").DSQL_FieldSchemaType;
primaryKeySet?: boolean;
}): {
fieldEntryText: string;
newPrimaryKeySet: boolean;
};
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
@@ -1 +0,0 @@
export default function grabCookieExpiryDate(): string;
-9
View File
@@ -1,9 +0,0 @@
type Param = {
dbName: string;
userId?: string | number;
};
/**
* # Grab Database Full Name
*/
export default function grabDbFullName({ dbName, userId }: Param): string;
export {};
-24
View File
@@ -1,24 +0,0 @@
import { ServerlessMysql } from "serverless-mysql";
type Param = {
/**
* Read Only?
*/
ro?: boolean;
/**
* Full Access?
*/
fa?: boolean;
/**
* No Database Connection
*/
noDb?: boolean;
/**
* Is this a local connection?
*/
local?: boolean;
};
/**
* # Grab General CONNECTION for DSQL
*/
export default function grabDSQLConnection(param?: Param): ServerlessMysql;
export {};
-19
View File
@@ -1,19 +0,0 @@
import https from "https";
import http from "http";
type GrabHostNamesReturn = {
host: string;
port: number | string;
scheme: typeof http | typeof https;
user_id: string | number;
};
type Param = {
userId?: string | number;
env?: {
[k: string]: string;
};
};
/**
* # Grab Names For Query
*/
export default function grabHostNames(param?: Param): GrabHostNamesReturn;
export {};
-19
View File
@@ -1,19 +0,0 @@
export type GrabEncryptionKeysParam = {
encryptionKey?: string;
encryptionSalt?: string;
apiKey?: string;
algorithm?: string;
bufferAllocSize?: number;
};
/**
* # Grab Encryption Keys
* @description Grab Required Encryption Keys
*/
export default function grabKeys(param?: GrabEncryptionKeysParam): {
key: string | undefined;
keyLen: number;
salt: string | undefined;
apiKey: string | undefined;
algorithm: string;
bufferAllocSize: number;
};
-19
View File
@@ -1,19 +0,0 @@
import { ApiGetQueryObject } from "../types";
type Param<T extends {
[key: string]: any;
} = {
[key: string]: any;
}> = {
query: string | ApiGetQueryObject<T>;
values?: (string | number)[];
};
export default function apiGetGrabQueryAndValues<T extends {
[key: string]: any;
} = {
[key: string]: any;
}>({ query, values }: Param<T>): {
query: string;
values: (string | number)[] | undefined;
valuesString: string | undefined;
};
export {};
-25
View File
@@ -1,25 +0,0 @@
declare const LogTypes: readonly ["error", "warning"];
type Param = {
/**
* data to be logged.
*/
log: any;
/**
* Log Title. Could be name of function or name of variable
*/
title?: string;
/**
* Label for the log
*/
label?: string;
/**
* Log type. `error` or `warning` or default
*/
type?: (typeof LogTypes)[number];
/**
* Whether to add a time stamp
*/
addTime?: boolean;
};
export default function debugLog({ log, label, title, type, addTime }: Param): void;
export {};
-10
View File
@@ -1,10 +0,0 @@
/**
* # Get Number from any input
* @example
* numberfy("123") // 123
* numberfy("123.456") // 123
* numberfy("123.456", 2) // 123.46
* numberfy("123.456", 0) // 123
* numberfy("123.456", 3) // 123.456
*/
export default function numberfy(num: any, decimals?: number): number;
-3
View File
@@ -1,3 +0,0 @@
export default function parseEnv(/** Env File Path */ envPath: string): {
[k: string]: string;
};
-8
View File
@@ -1,8 +0,0 @@
import { CookieObject } from "../types";
/**
* # Serialize Cookies
* @description Convert cookie object to string array
*/
export default function serializeCookies({ cookies, }: {
cookies: CookieObject[];
}): string[];
-4
View File
@@ -1,4 +0,0 @@
/**
* # Serialize Query
*/
export default function serializeQuery(query: any): string;
-4
View File
@@ -1,4 +0,0 @@
/**
* # Slug to Camel case Title
*/
export default function slugToCamelTitle(text: String): string | null;
-9
View File
@@ -1,9 +0,0 @@
/**
* # Return the slug of a string
*
* @example
* slugify("Hello World") // "hello-world"
* slugify("Yes!") // "yes"
* slugify("Hello!!! World!") // "hello-world"
*/
export default function slugify(str: string): string;
-5
View File
@@ -1,5 +0,0 @@
/**
* # Trim SQL
* @description Remove Returns and miltiple spaces from SQL Query
*/
export default function trimSql(sql: string): string;