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
+8
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;
+8
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;
@@ -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;
};
@@ -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;
};
@@ -0,0 +1,2 @@
declare const _exports: import("../../../types").APICreateUserFunction;
export = _exports;
+2
View File
@@ -0,0 +1,2 @@
declare const _exports: import("../../../types").APILoginFunction;
export = _exports;
@@ -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;
@@ -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;
+12
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;
@@ -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;
@@ -0,0 +1,2 @@
declare const _exports: import("../../../../types").APIGoogleLoginFunction;
export = _exports;
@@ -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;
+4
View File
@@ -0,0 +1,4 @@
declare function _exports({ userId }: {
userId: number | string;
}): Promise<any>;
export = _exports;
@@ -0,0 +1,5 @@
declare function _exports({ userId, database }: {
userId: number;
database: string;
}): Promise<any>;
export = _exports;
@@ -0,0 +1,5 @@
declare function _exports(): {
keyCookieName: string;
csrfCookieName: string;
};
export = _exports;
+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 | 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>;
@@ -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;
@@ -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;
+11
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;
+17
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;
+13
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;
+14
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;
+4 -6
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;
@@ -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[];
};
+14
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>;
+10
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;
+6
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;
@@ -0,0 +1,8 @@
declare function _exports({ columnData, primaryKeySet, }: {
columnData: import("../../types").DSQL_FieldSchemaType;
primaryKeySet?: boolean;
}): {
fieldEntryText: string;
newPrimaryKeySet: boolean;
};
export = _exports;
+2
View File
@@ -0,0 +1,2 @@
declare function _exports(queryString: string): Promise<any>;
export = _exports;
+4
View File
@@ -0,0 +1,4 @@
declare function _exports({ tableInfoArray }: {
tableInfoArray: import("../../types").DSQL_FieldSchemaType[];
}): import("../../types").DSQL_FieldSchemaType[];
export = _exports;
+15
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;
+7
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;
+70 -303
View File
File diff suppressed because it is too large Load Diff
+1 -1
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;
@@ -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>;
@@ -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;
};
+12
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
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;