This commit is contained in:
Benjamin Toby 2024-12-06 11:44:26 +01:00
parent 1ab41929b2
commit c49513c189
54 changed files with 628 additions and 425 deletions

View File

@ -1,5 +1,5 @@
export = clientFetch;
declare function clientFetch(url: string, options?: import("../../package-shared/types").FetchApiOptions, csrf?: boolean): Promise<any>;
declare function clientFetch(url: string, options?: import("../../package-shared/types").FetchApiOptions, contentType?: "json" | "text" | "html" | "blob" | "file"): Promise<any>;
declare namespace clientFetch {
export { clientFetch as fetchApi };
}

View File

@ -0,0 +1,8 @@
declare function _exports({ query, dbFullName, queryValues, tableName, dbSchema, }: {
query: string;
queryValues?: (string | number)[];
dbFullName: string;
tableName?: string;
dbSchema?: import("../../../types").DSQL_DatabaseSchemaType;
}): Promise<import("../../../types").GetReturn>;
export = _exports;

View File

@ -0,0 +1,8 @@
declare function _exports({ query, dbFullName, queryValues, tableName, dbSchema, }: {
query: any;
queryValues?: (string | number)[];
dbFullName: string;
tableName?: string;
dbSchema?: import("../../../types").DSQL_DatabaseSchemaType;
}): Promise<import("../../../types").PostReturn>;
export = _exports;

View File

@ -0,0 +1,135 @@
declare namespace _exports {
export { GithubUserPayload };
}
declare function _exports({ code, clientId, clientSecret }: {
code: string;
clientId: string;
clientSecret: string;
}): Promise<GithubUserPayload | null | undefined>;
export = _exports;
type GithubUserPayload = {
/**
* - Full name merged eg. "JohnDoe"
*/
login: string;
/**
* - github user id
*/
id: number;
/**
* - Some other id
*/
node_id: string;
/**
* - profile picture
*/
avatar_url: string;
/**
* - some other id
*/
gravatar_id: string;
/**
* - Github user URL
*/
url: string;
/**
* - User html URL - whatever that means
*/
html_url: string;
/**
* - Followers URL
*/
followers_url: string;
/**
* - Following URL
*/
following_url: string;
/**
* - Gists URL
*/
gists_url: string;
/**
* - Starred URL
*/
starred_url: string;
/**
* - Subscriptions URL
*/
subscriptions_url: string;
/**
* - Organizations URL
*/
organizations_url: string;
/**
* - Repositories URL
*/
repos_url: string;
/**
* - Received Events URL
*/
received_events_url: string;
/**
* - Common value => "User"
*/
type: string;
/**
* - Is site admin or not? Boolean
*/
site_admin: boolean;
/**
* - More like "username"
*/
name: string;
/**
* - User company
*/
company: string;
/**
* - User blog URL
*/
blog: string;
/**
* - User Location
*/
location: string;
/**
* - User Email
*/
email: string;
/**
* - Is user hireable
*/
hireable: string;
/**
* - User bio
*/
bio: string;
/**
* - User twitter username
*/
twitter_username: string;
/**
* - Number of public repositories
*/
public_repos: number;
/**
* - Number of public gists
*/
public_gists: number;
/**
* - Number of followers
*/
followers: number;
/**
* - Number of following
*/
following: number;
/**
* - Date created
*/
created_at: string;
/**
* - Date updated
*/
updated_at: string;
};

View File

@ -0,0 +1,19 @@
declare namespace _exports {
export { FunctionReturn };
}
declare const _exports: import("../../../types").HandleSocialDbFunction;
export = _exports;
type FunctionReturn = {
/**
* - Did the operation complete successfully or not?
*/
success: boolean;
/**
* - User payload object: or "null"
*/
user: {
id: number;
first_name: string;
last_name: string;
} | null;
};

View File

@ -0,0 +1,2 @@
declare const _exports: import("../../../types").APICreateUserFunction;
export = _exports;

View File

@ -0,0 +1,2 @@
declare const _exports: import("../../../types").APILoginFunction;
export = _exports;

View File

@ -0,0 +1,9 @@
declare function _exports({ existingUser, database, userId, additionalFields, }: {
existingUser: {
[x: string]: any;
};
database: string;
userId?: string | number;
additionalFields?: string[];
}): Promise<import("../../../types").ApiReauthUserReturn>;
export = _exports;

View File

@ -0,0 +1,15 @@
declare function _exports({ email, database, email_login_field, mail_domain, mail_port, sender, mail_username, mail_password, html, }: {
email: string;
database: string;
email_login_field?: string;
mail_domain?: string;
mail_port?: number;
sender?: string;
mail_username?: string;
mail_password?: string;
html: string;
}): Promise<{
success: boolean;
msg?: string;
}>;
export = _exports;

View File

@ -0,0 +1,12 @@
declare function _exports({ payload, dbFullName }: {
payload: {
id: string | number;
} & {
[x: string]: (string | number | null | undefined);
};
dbFullName: string;
}): Promise<{
success: boolean;
payload: any;
}>;
export = _exports;

View File

@ -0,0 +1,13 @@
declare function _exports({ code, clientId, clientSecret, database, additionalFields, res, email, userId, }: {
code?: string;
clientId?: string;
clientSecret?: string;
database?: string;
additionalFields?: {
[x: string]: any;
};
res?: any;
email?: string;
userId?: string | number;
}): Promise<import("../../../../types").APIGoogleLoginFunctionReturn>;
export = _exports;

View File

@ -0,0 +1,2 @@
declare const _exports: import("../../../../types").APIGoogleLoginFunction;
export = _exports;

View File

@ -0,0 +1,10 @@
declare function _exports({ query, user }: {
query: {
invite: number;
database_access: string;
priviledge: string;
email: string;
};
user: import("../../types").UserType;
}): Promise<any>;
export = _exports;

View File

@ -0,0 +1,4 @@
declare function _exports({ userId }: {
userId: number | string;
}): Promise<any>;
export = _exports;

View File

@ -0,0 +1,5 @@
declare function _exports({ userId, database }: {
userId: number;
database: string;
}): Promise<any>;
export = _exports;

View File

@ -0,0 +1,5 @@
declare function _exports(): {
keyCookieName: string;
csrfCookieName: string;
};
export = _exports;

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 | number)[]} [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 | number)[];
tableName?: string;
}): Promise<any>;

View File

@ -0,0 +1,15 @@
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/**
* ==============================================================================
* @param {Object} params
* @param {string | number} params.userId
* @returns {import("../../types").DSQL_DatabaseSchemaType[] | null}
*/
export default function grabUserSchemaData({ userId }: {
userId: string | number;
}): import("../../types").DSQL_DatabaseSchemaType[] | null;

View File

@ -0,0 +1,8 @@
declare function _exports({ to, subject, text, html, alias, }: {
to?: string;
subject?: string;
text?: string;
html?: string;
alias?: string | null;
}): Promise<any>;
export = _exports;

View File

@ -0,0 +1,11 @@
declare function _exports({ url, method, hostname, path, headers, body, port, scheme, }: {
scheme?: string;
url?: string;
method?: string;
hostname?: string;
path?: string;
port?: number | string;
headers?: object;
body?: object;
}): Promise<any>;
export = _exports;

View File

@ -0,0 +1,17 @@
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/**
* ==============================================================================
* @param {Object} params
* @param {string | number} params.userId
* @param {import("../../types").DSQL_DatabaseSchemaType[]} params.schemaData
* @returns {boolean}
*/
export default function setUserSchemaData({ userId, schemaData }: {
userId: string | number;
schemaData: import("../../types").DSQL_DatabaseSchemaType[];
}): boolean;

View File

@ -0,0 +1,13 @@
export = decrypt;
/**
* @param {object} param0
* @param {string} param0.encryptedString
* @param {string} [param0.encryptionKey]
* @param {string} [param0.encryptionSalt]
* @returns
*/
declare function decrypt({ encryptedString, encryptionKey, encryptionSalt }: {
encryptedString: string;
encryptionKey?: string;
encryptionSalt?: string;
}): string;

View File

@ -0,0 +1,14 @@
export = encrypt;
/**
*
* @param {object} param0
* @param {string} param0.data
* @param {string} [param0.encryptionKey]
* @param {string} [param0.encryptionSalt]
* @returns {string | null}
*/
declare function encrypt({ data, encryptionKey, encryptionSalt }: {
data: string;
encryptionKey?: string;
encryptionSalt?: string;
}): string | null;

View File

@ -2,9 +2,7 @@ export = sqlGenerator;
declare function sqlGenerator(Param0: {
genObject?: import("../../../types").ServerQueryParam;
tableName: string;
}):
| {
string: string;
values: string[];
}
| undefined;
}): {
string: string;
values: string[];
} | undefined;

View File

@ -1,6 +1,6 @@
export = sqlInsertGenerator;
/**
* @typedef {object} SQLINsertGenReturn
* @typedef {object} SQLInsertGenReturn
* @property {string} query
* @property {string[]} values
*/
@ -9,16 +9,16 @@ export = sqlInsertGenerator;
* @param {any[]} param0.data
* @param {string} param0.tableName
*
* @return {SQLINsertGenReturn | undefined}
* @return {SQLInsertGenReturn | undefined}
*/
declare function sqlInsertGenerator({ tableName, data }: {
data: any[];
tableName: string;
}): SQLINsertGenReturn | undefined;
}): SQLInsertGenReturn | undefined;
declare namespace sqlInsertGenerator {
export { SQLINsertGenReturn };
export { SQLInsertGenReturn };
}
type SQLINsertGenReturn = {
type SQLInsertGenReturn = {
query: string;
values: string[];
};

View File

@ -0,0 +1,14 @@
export = createDbFromSchema;
/**
* Create database from Schema Function
* ==============================================================================
* @param {object} params - Single object params
* @param {number|string|null} [params.userId] - User ID or null
* @param {string} [params.targetDatabase] - User Database full name
* @param {import("../types").DSQL_DatabaseSchemaType[]} [params.dbSchemaData]
*/
declare function createDbFromSchema({ userId, targetDatabase, dbSchemaData }: {
userId?: number | string | null;
targetDatabase?: string;
dbSchemaData?: import("../types").DSQL_DatabaseSchemaType[];
}): Promise<void>;

View File

@ -0,0 +1,10 @@
declare function _exports({ dbFullName, tableName, tableInfoArray, dbSchema, clone, tableSchema, recordedDbEntry, }: {
dbFullName: string;
tableName: string;
tableInfoArray: any[];
dbSchema?: import("../../types").DSQL_DatabaseSchemaType[];
tableSchema?: import("../../types").DSQL_TableSchemaType;
recordedDbEntry?: any;
clone?: boolean;
}): Promise<any>;
export = _exports;

View File

@ -0,0 +1,6 @@
declare function _exports({ query, values, database }: {
query: string;
values?: string[] | object;
database?: string;
}): Promise<any[] | object | null>;
export = _exports;

View File

@ -0,0 +1,8 @@
declare function _exports({ columnData, primaryKeySet, }: {
columnData: import("../../types").DSQL_FieldSchemaType;
primaryKeySet?: boolean;
}): {
fieldEntryText: string;
newPrimaryKeySet: boolean;
};
export = _exports;

View File

@ -0,0 +1,2 @@
declare function _exports(queryString: string): Promise<any>;
export = _exports;

View File

@ -0,0 +1,4 @@
declare function _exports({ tableInfoArray }: {
tableInfoArray: import("../../types").DSQL_FieldSchemaType[];
}): import("../../types").DSQL_FieldSchemaType[];
export = _exports;

View File

@ -0,0 +1,15 @@
declare function _exports({ dbFullName, tableName, tableInfoArray, userId, dbSchema, tableIndexes, tableSchema, clone, childDb, tableIndex, tableNameFull, recordedDbEntry, }: {
dbFullName: string;
tableName: string;
tableSchema: import("../../types").DSQL_TableSchemaType;
tableNameFull?: string;
tableInfoArray: import("../../types").DSQL_FieldSchemaType[];
userId?: number | string | null;
dbSchema: import("../../types").DSQL_DatabaseSchemaType[];
tableIndexes?: import("../../types").DSQL_IndexSchemaType[];
clone?: boolean;
tableIndex?: number;
childDb?: boolean;
recordedDbEntry?: any;
}): Promise<any>;
export = _exports;

View File

@ -0,0 +1,7 @@
declare function _exports({ queryString, queryValuesArray, database, tableSchema, }: {
queryString: string;
queryValuesArray?: string[];
database?: string;
tableSchema?: import("../../types").DSQL_TableSchemaType;
}): Promise<any>;
export = _exports;

File diff suppressed because it is too large Load Diff

View File

@ -206,7 +206,7 @@ export interface GetReqQueryObject {
tableName?: string;
}
type SerializeQueryFnType = (param0: SerializeQueryParams) => string;
export type SerializeQueryFnType = (param0: SerializeQueryParams) => string;
export interface SerializeQueryParams {
query: any;

View File

@ -0,0 +1,10 @@
export = LOCAL_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 LOCAL_DB_HANDLER(...args: any[]): Promise<any>;

View File

@ -0,0 +1,12 @@
export = NO_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 NO_DB_HANDLER(...args: any[]): Promise<any> | {
success: boolean;
error: any;
};

View File

@ -0,0 +1,12 @@
export = camelJoinedtoCamelSpace;
/**
* 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
*
* @param {string} text - text string without spaces
*
* @returns {string | null}
*/
declare function camelJoinedtoCamelSpace(text: string): string | null;

19
package-shared/utils/ejson.d.ts vendored Normal file
View File

@ -0,0 +1,19 @@
/**
*
* @param {string | null | number} string
* @param {(this: any, key: string, value: any) => any} [reviver]
* @returns {Object<string, any> | Object<string, any>[] | undefined}
*/
export function parse(string: string | null | number, reviver?: (this: any, key: string, value: any) => any): {
[x: string]: any;
} | {
[x: string]: any;
}[] | undefined;
/**
*
* @param {any} value
* @param {((this: any, key: string, value: any) => any) | null} [replacer]
* @param { string | number } [space]
* @returns {string | undefined}
*/
export function stringify(value: any, replacer?: ((this: any, key: string, value: any) => any) | null, space?: string | number): string | undefined;

View File

@ -8,7 +8,7 @@
"dsql-dump": "./engine/dump.js"
},
"scripts": {
"compile": "tsc --declaration --allowJs --emitDeclarationOnly --resolveJsonModule index.js",
"compile": "find . -name \"*.d.ts\" -type f -not -path \"./node_modules/*\" -delete && tsc --declaration --allowJs --emitDeclarationOnly --resolveJsonModule index.js",
"compile:full": "rm -rf dist && tsc --declaration --allowJs --outDir dist --emitDeclarationOnly --resolveJsonModule index.js && cat ./dist/index.d.ts > ./index.d.ts"
},
"repository": {

View File

@ -6,4 +6,5 @@ else
msg="$1"
fi
npm run compile && git add . && git commit -m "$msg" && git push && npm publish
npm run compile
git add . && git commit -m "$msg" && git push && npm publish

28
users/add-user.d.ts vendored
View File

@ -1,28 +1,28 @@
export = addUser;
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/**
* Add User to Database
* ==============================================================================
* ============================================
* @async
*
* @param {object} props - Single object passed
* @param {string} props.key - FULL ACCESS API Key
* @param {string} props.database - Database Name
* @param {import("../package-shared/types").UserDataPayload} props.payload - User Data Payload
* @param {string} props.encryptionKey
* @param {string} [props.encryptionSalt]
* @param {object} param - Single object passed
* @param {string} param.key - FULL ACCESS API Key
* @param {string} param.database - Database Name
* @param {import("../package-shared/types").UserDataPayload} param.payload - User Data Payload
* @param {string} param.encryptionKey
* @param {string} [param.encryptionSalt]
* @param {string | number} [param.user_id]
* @param {string | number} param.apiUserId
* @param {boolean} [param.useLocal]
*
* @returns { Promise<import("../package-shared/types").AddUserFunctionReturn> }
*/
declare function addUser({ key, payload, database, encryptionKey, encryptionSalt, }: {
declare function addUser({ key, payload, database, encryptionKey, user_id, useLocal, apiUserId, }: {
key: string;
database: string;
payload: import("../package-shared/types").UserDataPayload;
encryptionKey: string;
encryptionSalt?: string;
user_id?: string | number;
apiUserId: string | number;
useLocal?: boolean;
}): Promise<import("../package-shared/types").AddUserFunctionReturn>;

14
users/login-user.d.ts vendored
View File

@ -1,10 +1,4 @@
export = loginUser;
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/**
* Login A user
* ==============================================================================
@ -26,10 +20,13 @@ export = loginUser;
* @param {string} [params.email_login_code] - Email login code
* @param {string} [params.temp_code_field] - Database table field name for temporary code
* @param {boolean} [params.token] - Send access key as part of response body?
* @param {boolean} [params.user_id] - User ID
* @param {boolean} [params.skipPassword]
* @param {boolean} [params.useLocal]
*
* @returns { Promise<import("../package-shared/types").AuthenticatedUser>}
*/
declare function loginUser({ key, payload, database, additionalFields, response, encryptionKey, encryptionSalt, email_login, email_login_code, temp_code_field, token, }: {
declare function loginUser({ key, payload, database, additionalFields, response, encryptionKey, encryptionSalt, email_login, email_login_code, temp_code_field, token, user_id, skipPassword, useLocal, }: {
key: string;
database: string;
payload: {
@ -45,5 +42,8 @@ declare function loginUser({ key, payload, database, additionalFields, response,
email_login_code?: string;
temp_code_field?: string;
token?: boolean;
user_id?: boolean;
skipPassword?: boolean;
useLocal?: boolean;
}): Promise<import("../package-shared/types").AuthenticatedUser>;
import http = require("http");

View File

@ -21,10 +21,11 @@ export = reauthUser;
* @param {String} params.encryptionSalt - Encryption Salt
* @param {string[]} [params.additionalFields] - Additional Fields to be added to the user object
* @param {string} [params.token] - access token to use instead of getting from cookie header
* @param {boolean} [params.user_id] - User ID
*
* @returns { Promise<import("../package-shared/types").ReauthUserFunctionReturn> }
*/
declare function reauthUser({ key, database, response, request, level, encryptionKey, encryptionSalt, additionalFields, token, }: {
declare function reauthUser({ key, database, response, request, level, encryptionKey, encryptionSalt, additionalFields, token, user_id, }: {
key: string;
database: string;
response: http.ServerResponse;
@ -34,5 +35,6 @@ declare function reauthUser({ key, database, response, request, level, encryptio
encryptionSalt: string;
additionalFields?: string[];
token?: string;
user_id?: boolean;
}): Promise<import("../package-shared/types").ReauthUserFunctionReturn>;
import http = require("http");

View File

@ -23,10 +23,11 @@ export = sendEmailCode;
* @param {string} [params.mail_password]
* @param {number} [params.mail_port]
* @param {string} [params.sender]
* @param {boolean} [params.user_id] - User ID
*
* @returns { Promise<boolean>}
*/
declare function sendEmailCode({ key, email, database, encryptionKey, encryptionSalt, temp_code_field, mail_domain, mail_password, mail_username, mail_port, sender, }: {
declare function sendEmailCode({ key, email, database, encryptionKey, encryptionSalt, temp_code_field, mail_domain, mail_password, mail_username, mail_port, sender, user_id, }: {
key: string;
database: string;
email: string;
@ -39,5 +40,6 @@ declare function sendEmailCode({ key, email, database, encryptionKey, encryption
mail_password?: string;
mail_port?: number;
sender?: string;
user_id?: boolean;
}): Promise<boolean>;
import http = require("http");

View File

@ -29,10 +29,11 @@ export = githubAuth;
* @param {string} params.encryptionKey - Encryption key
* @param {string} params.encryptionSalt - Encryption salt
* @param {object} [params.additionalFields] - Additional Fields to be added to the user object
* @param {boolean} [params.user_id] - User ID
*
* @returns { Promise<FunctionReturn | undefined> }
*/
declare function githubAuth({ key, code, email, database, clientId, clientSecret, response, encryptionKey, encryptionSalt, additionalFields, }: {
declare function githubAuth({ key, code, email, database, clientId, clientSecret, response, encryptionKey, encryptionSalt, additionalFields, user_id, }: {
key: string;
code: string;
email: string | null;
@ -43,6 +44,7 @@ declare function githubAuth({ key, code, email, database, clientId, clientSecret
encryptionKey: string;
encryptionSalt: string;
additionalFields?: object;
user_id?: boolean;
}): Promise<FunctionReturn | undefined>;
declare namespace githubAuth {
export { FunctionReturn };

View File

@ -27,10 +27,13 @@ export = googleAuth;
* @param {string} params.encryptionKey - Encryption key
* @param {string} params.encryptionSalt - Encryption salt
* @param {object} [params.additionalFields] - Additional Fields to be added to the user object
* @param {boolean} [params.user_id] - User ID
* @param {string | number} [params.apiUserID] - Required for Local
* @param {boolean} [params.useLocal] - Whether to use a remote database instead of API
*
* @returns { Promise<FunctionReturn> }
*/
declare function googleAuth({ key, token, database, clientId, response, encryptionKey, encryptionSalt, additionalFields, }: {
declare function googleAuth({ key, token, database, clientId, response, encryptionKey, encryptionSalt, additionalFields, user_id, apiUserID, useLocal, }: {
key: string;
token: string;
database: string;
@ -39,6 +42,9 @@ declare function googleAuth({ key, token, database, clientId, response, encrypti
encryptionKey: string;
encryptionSalt: string;
additionalFields?: object;
user_id?: boolean;
apiUserID?: string | number;
useLocal?: boolean;
}): Promise<FunctionReturn>;
declare namespace googleAuth {
export { FunctionReturn };

View File

@ -1,24 +1,17 @@
export = updateUser;
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/**
* ==============================================================================
* Main Function
* ==============================================================================
* # Update User
* @async
*
* @param {object} params - API Key
* @param {String} params.key - API Key
* @param {String} params.database - Target Database
* @param {{ id: number } & Object.<string, any>} params.payload - User Object: ID is required
* @param {boolean} [params.user_id] - User ID
*
* @returns { Promise<import("../package-shared/types").UpdateUserFunctionReturn>}
*/
declare function updateUser({ key, payload, database }: {
declare function updateUser({ key, payload, database, user_id }: {
key: string;
database: string;
payload: {
@ -26,4 +19,5 @@ declare function updateUser({ key, payload, database }: {
} & {
[x: string]: any;
};
user_id?: boolean;
}): Promise<import("../package-shared/types").UpdateUserFunctionReturn>;

View File

@ -1,36 +1,30 @@
export = uploadImage;
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
export = deleteFile;
/**
* @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
* } | null} payload - Payload containing the url for the image and its thumbnail
* @property {string} [msg] - An optional message
*/
/**
* ==============================================================================
* Main Function
* ==============================================================================
* # Delete File via API
* @async
*
* @param {Object} params - Single Param object containing params
* @param {String} params.key - *FULL ACCESS API Key
* @param { string } params.url - File URL
* @param { string | number } [params.user_id]
*
* @returns { Promise<FunctionReturn> } - Image Url
*/
declare function uploadImage({ key, url }: {
declare function deleteFile({ key, url, user_id }: {
key: string;
url: string;
user_id?: string | number;
}): Promise<FunctionReturn>;
declare namespace uploadImage {
declare namespace deleteFile {
export { FunctionReturn };
}
type FunctionReturn = {
@ -44,7 +38,7 @@ type FunctionReturn = {
payload: {
urlPath: string;
urlThumbnailPath: string;
};
} | null;
/**
* - An optional message
*/

View File

@ -1,10 +1,4 @@
export = getSchema;
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/**
* @typedef {Object} GetSchemaReturn
* @property {boolean} success - Did the function run successfully?
@ -16,7 +10,7 @@ export = getSchema;
*
* @returns { Promise<GetSchemaReturn> } - Return Object
*/
declare function getSchema({ key, database, field, table }: import("../package-shared/types").GetSchemaAPIParam): Promise<GetSchemaReturn>;
declare function getSchema({ key, database, field, table, user_id }: import("../package-shared/types").GetSchemaAPIParam): Promise<GetSchemaReturn>;
declare namespace getSchema {
export { GetSchemaReturn };
}

18
utils/get.d.ts vendored
View File

@ -1,10 +1,4 @@
export = get;
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/**
* Make a get request to Datasquirel API
* ==============================================================================
@ -16,21 +10,17 @@ export = get;
* @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
* @param {boolean} [params.useLocal] - Whether to use a remote database instead of API
* @param {boolean} [params.user_id] - User ID
*
* @returns { Promise<import("../package-shared/types").GetReturn> } - Return Object
*/
declare function get({
key,
db,
query,
queryValues,
tableName,
useLocal,
}: {
declare function get({ key, db, query, queryValues, tableName, useLocal, user_id, }: {
key?: string;
db?: string;
query: string;
queryValues?: string[];
tableName?: string;
useLocal?: boolean;
user_id?: boolean;
}): Promise<import("../package-shared/types").GetReturn>;

21
utils/post.d.ts vendored
View File

@ -1,13 +1,6 @@
export = post;
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/**
* Make a post request to Datasquirel API
* ==============================================================================
* # Make a post request to Datasquirel API
* @async
*
* @param {Object} params - Single object passed
@ -16,21 +9,17 @@ export = post;
* @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
* @param {boolean} [params.useLocal] - Whether to use a remote database instead of API
* @param {boolean} [params.user_id] - User ID
*
* @returns { Promise<import("../package-shared/types").PostReturn> } - Return Object
*/
declare function post({
key,
query,
queryValues,
database,
tableName,
useLocal,
}: {
declare function post({ key, query, queryValues, database, tableName, useLocal, user_id, }: {
key?: string;
database?: string;
query: import("../package-shared/types").PostDataPayload | string;
queryValues?: any[];
tableName?: string;
useLocal?: boolean;
user_id?: boolean;
}): Promise<import("../package-shared/types").PostReturn>;

View File

@ -1,10 +1,4 @@
export = uploadImage;
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/**
* @typedef {Object} FunctionReturn
* @property {boolean} success - Did the function run successfully?
@ -14,9 +8,7 @@ export = uploadImage;
* @property {string} [msg] - An optional message
*/
/**
* ==============================================================================
* Main Function
* ==============================================================================
* # Upload File via API
* @async
*
* @param {Object} params - Single Param object containing params
@ -26,12 +18,13 @@ export = uploadImage;
* fileName: string,
* mimeType?: string,
* folder?: string,
* isPrivate?: boolean,
* isPrivate?: boolean
* }} params.payload - Image Data Eg.
* @param {boolean} [params.user_id] - User ID
*
* @returns { Promise<FunctionReturn> } - Return Object
*/
declare function uploadImage({ key, payload }: {
declare function uploadImage({ key, payload, user_id }: {
key: string;
payload: {
fileData: string;
@ -40,6 +33,7 @@ declare function uploadImage({ key, payload }: {
folder?: string;
isPrivate?: boolean;
};
user_id?: boolean;
}): Promise<FunctionReturn>;
declare namespace uploadImage {
export { FunctionReturn };

View File

@ -1,10 +1,4 @@
export = uploadImage;
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/** ****************************************************************************** */
/**
* @typedef {Object} FunctionReturn
* @property {boolean} success - Did the function run successfully?
@ -15,9 +9,7 @@ export = uploadImage;
* @property {string} [msg] - An optional message
*/
/**
* ==============================================================================
* Main Function
* ==============================================================================
* # Upload Image via API
* @async
*
* @param {Object} params - Single Param object containing params
@ -30,10 +22,11 @@ export = uploadImage;
* folder?: string,
* isPrivate?: boolean,
* }} params.payload - Image Data Eg.
* @param {boolean} [params.user_id] - User ID
*
* @returns { Promise<FunctionReturn> } - Return Object
*/
declare function uploadImage({ key, payload }: {
declare function uploadImage({ key, payload, user_id }: {
key: string;
payload: {
imageData: string;
@ -43,6 +36,7 @@ declare function uploadImage({ key, payload }: {
folder?: string;
isPrivate?: boolean;
};
user_id?: boolean;
}): Promise<FunctionReturn>;
declare namespace uploadImage {
export { FunctionReturn };