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
+52
View File
@@ -0,0 +1,52 @@
export = uploadImage;
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/**
* @typedef {Object} FunctionReturn
* @property {boolean} success - Did the function run successfully?
* @property {{
* urlPath: string,
* urlThumbnailPath: string
* }} payload - Payload containing the url for the image and its thumbnail
* @property {string} [msg] - An optional message
*/
/**
* ==============================================================================
* Main Function
* ==============================================================================
* @async
*
* @param {Object} params - Single Param object containing params
* @param {String} params.key - *FULL ACCESS API Key
* @param { string } params.url - File URL
*
* @returns { Promise<FunctionReturn> } - Image Url
*/
declare function uploadImage({ key, url }: {
key: string;
url: string;
}): Promise<FunctionReturn>;
declare namespace uploadImage {
export { FunctionReturn };
}
type FunctionReturn = {
/**
* - Did the function run successfully?
*/
success: boolean;
/**
* - Payload containing the url for the image and its thumbnail
*/
payload: {
urlPath: string;
urlThumbnailPath: string;
};
/**
* - An optional message
*/
msg?: string;
};
+5
View File
@@ -0,0 +1,5 @@
declare function _exports({ request }: {
request: http.IncomingMessage;
}): any | null;
export = _exports;
import http = require("http");
+13
View File
@@ -0,0 +1,13 @@
export = sanitizeSql;
/**
* Sanitize SQL function
* ==============================================================================
* @description this function takes in a text(or number) or object or array or
* boolean and returns a sanitized version of the same input.
*
* @param {string|number|object|boolean} input - Text or number or object or boolean
* @param {boolean?} spaces - Allow spaces?
*
* @returns {string|number|object|boolean}
*/
declare function sanitizeSql(input: string | number | object | boolean, spaces: boolean | null): string | number | object | boolean;
+2
View File
@@ -0,0 +1,2 @@
export = serializeQuery;
declare function serializeQuery(param0: import("../../package-shared/types").SerializeQueryParams): string;
+32
View File
@@ -0,0 +1,32 @@
export = getSchema;
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/**
* @typedef {Object} GetSchemaReturn
* @property {boolean} success - Did the function run successfully?
* @property {import("../package-shared/types").DSQL_DatabaseSchemaType | import("../package-shared/types").DSQL_TableSchemaType | import("../package-shared/types").DSQL_FieldSchemaType | null} payload - Response payload
*/
/**
* # Get Schema for Database, table, or field *
* @param {import("../package-shared/types").GetSchemaAPIParam} params
*
* @returns { Promise<GetSchemaReturn> } - Return Object
*/
declare function getSchema({ key, database, field, table }: import("../package-shared/types").GetSchemaAPIParam): Promise<GetSchemaReturn>;
declare namespace getSchema {
export { GetSchemaReturn };
}
type GetSchemaReturn = {
/**
* - Did the function run successfully?
*/
success: boolean;
/**
* - Response payload
*/
payload: import("../package-shared/types").DSQL_DatabaseSchemaType | import("../package-shared/types").DSQL_TableSchemaType | import("../package-shared/types").DSQL_FieldSchemaType | null;
};
+28
View File
@@ -0,0 +1,28 @@
export = get;
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/**
* Make a get request to Datasquirel API
* ==============================================================================
* @async
*
* @param {Object} params - Single object passed
* @param {string} [params.key] - API Key
* @param {string} [params.db] - Database Name
* @param {string} params.query - SQL 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<import("../package-shared/types").GetReturn> } - Return Object
*/
declare function get({ key, db, query, queryValues, tableName }: {
key?: string;
db?: string;
query: string;
queryValues?: string[];
tableName?: string;
}): Promise<import("../package-shared/types").GetReturn>;
+28
View File
@@ -0,0 +1,28 @@
export = post;
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/**
* Make a post request to Datasquirel API
* ==============================================================================
* @async
*
* @param {Object} params - Single object passed
* @param {string} [params.key] - FULL ACCESS API Key
* @param {string} [params.database] - Database Name
* @param {import("../package-shared/types").PostDataPayload | string} params.query - SQL query String or Request Object
* @param {any[]} [params.queryValues] - Query Values if using "?" placeholders
* @param {string} [params.tableName] - Name of the table to query
*
* @returns { Promise<import("../package-shared/types").PostReturn> } - Return Object
*/
declare function post({ key, query, queryValues, database, tableName }: {
key?: string;
database?: string;
query: import("../package-shared/types").PostDataPayload | string;
queryValues?: any[];
tableName?: string;
}): Promise<import("../package-shared/types").PostReturn>;
+62
View File
@@ -0,0 +1,62 @@
export = uploadImage;
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/**
* @typedef {Object} FunctionReturn
* @property {boolean} success - Did the function run successfully?
* @property {{
* urlPath: string,
* } | null} payload - Payload containing the url for the image and its thumbnail
* @property {string} [msg] - An optional message
*/
/**
* ==============================================================================
* Main Function
* ==============================================================================
* @async
*
* @param {Object} params - Single Param object containing params
* @param {String} params.key - *FULL ACCESS API Key
* @param {{
* fileData: string,
* fileName: string,
* mimeType?: string,
* folder?: string,
* isPrivate?: boolean,
* }} params.payload - Image Data Eg.
*
* @returns { Promise<FunctionReturn> } - Return Object
*/
declare function uploadImage({ key, payload }: {
key: string;
payload: {
fileData: string;
fileName: string;
mimeType?: string;
folder?: string;
isPrivate?: boolean;
};
}): Promise<FunctionReturn>;
declare namespace uploadImage {
export { FunctionReturn };
}
type FunctionReturn = {
/**
* - Did the function run successfully?
*/
success: boolean;
/**
* - Payload containing the url for the image and its thumbnail
*/
payload: {
urlPath: string;
} | null;
/**
* - An optional message
*/
msg?: string;
};
+66
View File
@@ -0,0 +1,66 @@
export = uploadImage;
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/**
* @typedef {Object} FunctionReturn
* @property {boolean} success - Did the function run successfully?
* @property {{
* urlPath: string,
* urlThumbnailPath: string
* } | null} payload - Payload containing the url for the image and its thumbnail
* @property {string} [msg] - An optional message
*/
/**
* ==============================================================================
* Main Function
* ==============================================================================
* @async
*
* @param {Object} params - Single Param object containing params
* @param {String} params.key - *FULL ACCESS API Key
* @param {{
* imageData: string,
* imageName: string,
* mimeType?: string,
* thumbnailSize?: number,
* folder?: string,
* isPrivate?: boolean,
* }} params.payload - Image Data Eg.
*
* @returns { Promise<FunctionReturn> } - Return Object
*/
declare function uploadImage({ key, payload }: {
key: string;
payload: {
imageData: string;
imageName: string;
mimeType?: string;
thumbnailSize?: number;
folder?: string;
isPrivate?: boolean;
};
}): Promise<FunctionReturn>;
declare namespace uploadImage {
export { FunctionReturn };
}
type FunctionReturn = {
/**
* - Did the function run successfully?
*/
success: boolean;
/**
* - Payload containing the url for the image and its thumbnail
*/
payload: {
urlPath: string;
urlThumbnailPath: string;
} | null;
/**
* - An optional message
*/
msg?: string;
};