Updates
This commit is contained in:
+123
-3
@@ -1,4 +1,4 @@
|
||||
import http from "http";
|
||||
import type { IncomingMessage, ServerResponse } from "http";
|
||||
|
||||
import { Editor } from "tinymce";
|
||||
export type DSQL_DatabaseFullName = string;
|
||||
@@ -186,9 +186,9 @@ export interface PackageUserLoginLocalBody {
|
||||
dbSchema?: DSQL_DatabaseSchemaType;
|
||||
}
|
||||
|
||||
type Request = http.IncomingMessage;
|
||||
type Request = IncomingMessage;
|
||||
|
||||
type Response = http.ServerResponse;
|
||||
type Response = ServerResponse;
|
||||
|
||||
type ImageInputFileToBase64FunctionReturn = {
|
||||
imageBase64: string;
|
||||
@@ -1096,3 +1096,123 @@ export type CheckApiCredentialsFnParam = {
|
||||
database?: string;
|
||||
table?: string;
|
||||
};
|
||||
|
||||
export type FetchApiFn = (
|
||||
url: string,
|
||||
options?: FetchApiOptions,
|
||||
contentType?: "json" | "text" | "html" | "blob" | "file"
|
||||
) => Promise<any>;
|
||||
|
||||
export type FetchApiOptions = RequestInit & {
|
||||
method:
|
||||
| "POST"
|
||||
| "GET"
|
||||
| "DELETE"
|
||||
| "PUT"
|
||||
| "PATCH"
|
||||
| "post"
|
||||
| "get"
|
||||
| "delete"
|
||||
| "put"
|
||||
| "patch";
|
||||
body?: object | string;
|
||||
headers?: FetchHeader;
|
||||
query?: { [key: string]: any };
|
||||
};
|
||||
|
||||
export type AuthCsrfHeaderName = "x-csrf-auth";
|
||||
|
||||
type FetchHeader = HeadersInit & {
|
||||
[key in AuthCsrfHeaderName]?: string | null;
|
||||
} & {
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
export type FetchApiReturn = {
|
||||
success: boolean;
|
||||
payload: any;
|
||||
msg?: string;
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
export type ServerQueryParam = {
|
||||
selectFields?: string[];
|
||||
query?: ServerQueryQueryObject;
|
||||
limit?: number;
|
||||
order?: {
|
||||
field: string;
|
||||
strategy: "ASC" | "DESC";
|
||||
};
|
||||
searchOperator?: "AND" | "OR";
|
||||
searchEquality?: "EQUAL" | "LIKE";
|
||||
addUserId?: {
|
||||
fieldName: string;
|
||||
};
|
||||
join?: ServerQueryParamsJoin[];
|
||||
} & {
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
export type ServerQueryQueryObject<T extends object = { [key: string]: any }> =
|
||||
{
|
||||
[key in keyof T]: {
|
||||
value: string | string[];
|
||||
operator?: "AND" | "OR";
|
||||
equality?: "EQUAL" | "LIKE";
|
||||
tableName?: string;
|
||||
};
|
||||
};
|
||||
|
||||
export type FetchDataParams = {
|
||||
path: string;
|
||||
method?: "GET" | "POST" | "PATCH" | "PUT" | "DELETE";
|
||||
body?: object | string;
|
||||
query?: AuthFetchQuery;
|
||||
tableName?: string;
|
||||
};
|
||||
|
||||
export type AuthFetchQuery = ServerQueryParam & {
|
||||
[key: string]: string | number | { [key: string]: any };
|
||||
};
|
||||
|
||||
export type ServerQueryParamsJoin<
|
||||
Table extends string = string,
|
||||
Field extends object = { [key: string]: any }
|
||||
> = {
|
||||
joinType: "INNER JOIN" | "JOIN" | "LEFT JOIN" | "RIGHT JOIN";
|
||||
tableName: Table;
|
||||
match?:
|
||||
| ServerQueryParamsJoinMatchObject<Field>
|
||||
| ServerQueryParamsJoinMatchObject<Field>[];
|
||||
selectFields?: (
|
||||
| keyof Field
|
||||
| {
|
||||
field: keyof Field;
|
||||
alias?: string;
|
||||
}
|
||||
)[];
|
||||
};
|
||||
|
||||
export type ServerQueryParamsJoinMatchObject<
|
||||
Field extends object = { [key: string]: any }
|
||||
> = {
|
||||
/** Field name from the **Root Table** */
|
||||
source: string | ServerQueryParamsJoinMatchSourceTargetObject;
|
||||
/** Field name from the **Join Table** */
|
||||
target: keyof Field | ServerQueryParamsJoinMatchSourceTargetObject;
|
||||
};
|
||||
|
||||
export type ServerQueryParamsJoinMatchSourceTargetObject = {
|
||||
tableName: string;
|
||||
fieldName: string;
|
||||
};
|
||||
|
||||
export type SqlGeneratorFn = (Param0: {
|
||||
genObject?: ServerQueryParam;
|
||||
tableName: string;
|
||||
}) =>
|
||||
| {
|
||||
string: string;
|
||||
values: string[];
|
||||
}
|
||||
| undefined;
|
||||
|
||||
Reference in New Issue
Block a user