151 lines
7.5 KiB
TypeScript
151 lines
7.5 KiB
TypeScript
import type { Connection } from "mariadb";
|
|
declare global {
|
|
var DSQL_DB_CONN: Connection | undefined;
|
|
var DSQL_READ_ONLY_DB_CONN: Connection | undefined;
|
|
var DSQL_FULL_ACCESS_DB_CONN: Connection | undefined;
|
|
var DSQL_USE_LOCAL: boolean | undefined;
|
|
var ERROR_CALLBACK: ErrorCallback | undefined;
|
|
}
|
|
import get from "./package-shared/actions/get";
|
|
import post from "./package-shared/actions/post";
|
|
import getSchema from "./package-shared/actions/get-schema";
|
|
import sqlGenerator from "./package-shared/functions/dsql/sql/sql-generator";
|
|
import sqlInsertGenerator from "./package-shared/functions/dsql/sql/sql-insert-generator";
|
|
import sqlDeleteGenerator from "./package-shared/functions/dsql/sql/sql-delete-generator";
|
|
import trimSql from "./package-shared/utils/trim-sql";
|
|
import parseCookies from "./package-shared/utils/backend/parseCookies";
|
|
import connDbHandler from "./package-shared/utils/db/conn-db-handler";
|
|
import encrypt from "./package-shared/functions/dsql/encrypt";
|
|
import decrypt from "./package-shared/functions/dsql/decrypt";
|
|
import hashPassword from "./package-shared/functions/dsql/hashPassword";
|
|
import dsqlCrud from "./package-shared/utils/data-fetching/crud";
|
|
import dsqlMethodCrud from "./package-shared/utils/data-fetching/method-crud";
|
|
import debugLog from "./package-shared/utils/logging/debug-log";
|
|
import { ErrorCallback } from "./package-shared/types";
|
|
import parseEnv from "./package-shared/utils/parse-env";
|
|
import dbHandler from "./package-shared/functions/backend/dbHandler";
|
|
/**
|
|
* Main Export
|
|
*/
|
|
declare const datasquirel: {
|
|
/**
|
|
* API Actions
|
|
*/
|
|
api: {
|
|
crud: {
|
|
get: typeof import("./package-shared/api/crud/get").default;
|
|
insert: typeof import("./package-shared/api/crud/post").default;
|
|
update: typeof import("./package-shared/api/crud/put").default;
|
|
delete: typeof import("./package-shared/api/crud/delete").default;
|
|
options: () => Promise<void>;
|
|
};
|
|
media: {
|
|
get: typeof import("./package-shared/api/media/get").default;
|
|
add: typeof import("./package-shared/api/media/post").default;
|
|
delete: typeof import("./package-shared/api/media/delete").default;
|
|
};
|
|
user: {
|
|
auth: {
|
|
login: (_: import("./package-shared/types").LoginUserParam) => Promise<import("./package-shared/types").APIResponseObject<import("./package-shared/types").DATASQUIREL_LoggedInUser | null>>;
|
|
get: (_: import("./package-shared/types").GetUserParams) => Promise<import("./package-shared/types").GetUserFunctionReturn>;
|
|
signup: (_: import("./package-shared/types").AddUserParams) => Promise<import("./package-shared/types").APIResponseObject>;
|
|
sendEmailCode: (_: import("./package-shared/types").SendEmailCodeParams) => Promise<import("./package-shared/types").APIResponseObject>;
|
|
update: (_: import("./package-shared/types").UpdateUserParams) => Promise<import("./package-shared/types").UpdateUserFunctionReturn>;
|
|
resetPassword: (_: import("./package-shared/types").ResetPasswordParams) => Promise<import("./package-shared/types").UpdateUserFunctionReturn>;
|
|
logout: typeof import("./package-shared/actions/users/logout-user").default;
|
|
auth: typeof import("./package-shared/actions/users/user-auth").default;
|
|
};
|
|
};
|
|
};
|
|
/**
|
|
* Get Action
|
|
*/
|
|
get: typeof get;
|
|
/**
|
|
* Post Action
|
|
*/
|
|
post: typeof post;
|
|
user: {
|
|
auth: {
|
|
login: (_: import("./package-shared/types").LoginUserParam) => Promise<import("./package-shared/types").APIResponseObject<import("./package-shared/types").DATASQUIREL_LoggedInUser | null>>;
|
|
get: (_: import("./package-shared/types").GetUserParams) => Promise<import("./package-shared/types").GetUserFunctionReturn>;
|
|
signup: (_: import("./package-shared/types").AddUserParams) => Promise<import("./package-shared/types").APIResponseObject>;
|
|
sendEmailCode: (_: import("./package-shared/types").SendEmailCodeParams) => Promise<import("./package-shared/types").APIResponseObject>;
|
|
update: (_: import("./package-shared/types").UpdateUserParams) => Promise<import("./package-shared/types").UpdateUserFunctionReturn>;
|
|
resetPassword: (_: import("./package-shared/types").ResetPasswordParams) => Promise<import("./package-shared/types").UpdateUserFunctionReturn>;
|
|
logout: typeof import("./package-shared/actions/users/logout-user").default;
|
|
auth: typeof import("./package-shared/actions/users/user-auth").default;
|
|
};
|
|
};
|
|
getSchema: typeof getSchema;
|
|
client: {
|
|
media: {
|
|
imageInputToBase64: typeof import("./client/media/imageInputToBase64").default;
|
|
imageInputFileToBase64: typeof import("./client/media/imageInputFileToBase64").default;
|
|
inputFileToBase64: typeof import("./client/media/inputFileToBase64").default;
|
|
};
|
|
auth: {
|
|
google: {
|
|
getAccessToken: typeof import("./client/auth/google/getAccessToken").default;
|
|
};
|
|
github: {
|
|
getAccessToken: typeof import("./client/auth/github/getAccessToken").default;
|
|
};
|
|
logout: typeof import("./client/auth/logout").default;
|
|
postLogin: typeof import("./client/auth/post-login").default;
|
|
};
|
|
fetch: {
|
|
fetchApi: typeof import("./client/fetch").default;
|
|
clientFetch: typeof import("./client/fetch").default;
|
|
};
|
|
utils: {
|
|
deserializeQuery: typeof import("./package-shared/utils/deserialize-query").default;
|
|
serializeQuery: typeof import("./package-shared/utils/serialize-query").default;
|
|
serializeCookies: typeof import("./package-shared/utils/serialize-cookies").default;
|
|
EJSON: {
|
|
parse: (string: string | null | number, reviver?: (this: any, key: string, value: any) => any) => {
|
|
[s: string]: any;
|
|
} | {
|
|
[s: string]: any;
|
|
}[] | undefined;
|
|
stringify: (value: any, replacer?: ((this: any, key: string, value: any) => any) | null, space?: string | number) => string | undefined;
|
|
};
|
|
numberfy: typeof import("./package-shared/utils/numberfy").default;
|
|
slugify: typeof import("./package-shared/utils/slugify").default;
|
|
debugLog: typeof debugLog;
|
|
};
|
|
};
|
|
sql: {
|
|
sqlGenerator: typeof sqlGenerator;
|
|
sqlInsertGenerator: typeof sqlInsertGenerator;
|
|
sqlDeleteGenerator: typeof sqlDeleteGenerator;
|
|
trim: typeof trimSql;
|
|
};
|
|
utils: {
|
|
crypto: {
|
|
encrypt: typeof encrypt;
|
|
decrypt: typeof decrypt;
|
|
hashPassword: typeof hashPassword;
|
|
};
|
|
parseCookies: typeof parseCookies;
|
|
connDbHandler: typeof connDbHandler;
|
|
debugLog: typeof debugLog;
|
|
parseEnv: typeof parseEnv;
|
|
};
|
|
/**
|
|
* Run Crud actions `get`, `insert`, `update`, `delete`
|
|
* @description *Requires global variables `DSQL_USE_LOCAL` and `DSQL_DB_CONN`
|
|
*/
|
|
crud: typeof dsqlCrud;
|
|
/**
|
|
* Run Crud based on request Methods `GET`, `POST`, `PUT`, `PATCH`
|
|
* @description *Requires global variables `DSQL_USE_LOCAL` and `DSQL_DB_CONN`
|
|
*/
|
|
methodCrud: typeof dsqlMethodCrud;
|
|
/**
|
|
* General Database Handler
|
|
*/
|
|
dbHandler: typeof dbHandler;
|
|
};
|
|
export default datasquirel;
|