Updates
This commit is contained in:
parent
e67d69abc0
commit
f3ab535b67
105
dist/types/index.d.ts
vendored
105
dist/types/index.d.ts
vendored
@ -271,34 +271,6 @@ export interface GetReqQueryObject {
|
|||||||
tableName?: string;
|
tableName?: string;
|
||||||
debug?: boolean;
|
debug?: boolean;
|
||||||
}
|
}
|
||||||
export type DATASQUIREL_LoggedInUser = {
|
|
||||||
id: number;
|
|
||||||
uuid?: string;
|
|
||||||
first_name: string;
|
|
||||||
last_name: string;
|
|
||||||
email: string;
|
|
||||||
phone?: string;
|
|
||||||
user_type?: string;
|
|
||||||
username?: string;
|
|
||||||
image?: string;
|
|
||||||
image_thumbnail?: string;
|
|
||||||
social_login?: number;
|
|
||||||
social_platform?: string;
|
|
||||||
social_id?: string;
|
|
||||||
verification_status?: number;
|
|
||||||
csrf_k: string;
|
|
||||||
logged_in_status: boolean;
|
|
||||||
date: number;
|
|
||||||
} & {
|
|
||||||
[key: string]: any;
|
|
||||||
};
|
|
||||||
export interface AuthenticatedUser {
|
|
||||||
success: boolean;
|
|
||||||
payload: DATASQUIREL_LoggedInUser | null;
|
|
||||||
msg?: string;
|
|
||||||
userId?: number;
|
|
||||||
cookieNames?: any;
|
|
||||||
}
|
|
||||||
export interface SuccessUserObject {
|
export interface SuccessUserObject {
|
||||||
id: number;
|
id: number;
|
||||||
first_name: string;
|
first_name: string;
|
||||||
@ -346,13 +318,6 @@ export interface GetUserFunctionReturn {
|
|||||||
verification_status: [number];
|
verification_status: [number];
|
||||||
} | null;
|
} | null;
|
||||||
}
|
}
|
||||||
export interface ReauthUserFunctionReturn {
|
|
||||||
success: boolean;
|
|
||||||
payload: DATASQUIREL_LoggedInUser | null;
|
|
||||||
msg?: string;
|
|
||||||
userId?: number;
|
|
||||||
token?: string;
|
|
||||||
}
|
|
||||||
export interface UpdateUserFunctionReturn {
|
export interface UpdateUserFunctionReturn {
|
||||||
success: boolean;
|
success: boolean;
|
||||||
payload?: Object[] | string;
|
payload?: Object[] | string;
|
||||||
@ -417,12 +382,6 @@ export interface PostInsertReturn {
|
|||||||
changedRows?: number;
|
changedRows?: number;
|
||||||
error?: string;
|
error?: string;
|
||||||
}
|
}
|
||||||
export type UserType = DATASQUIREL_LoggedInUser & {
|
|
||||||
isSuperUser?: boolean;
|
|
||||||
staticHost?: string;
|
|
||||||
appHost?: string;
|
|
||||||
appName?: string;
|
|
||||||
};
|
|
||||||
export interface ApiKeyDef {
|
export interface ApiKeyDef {
|
||||||
name: string;
|
name: string;
|
||||||
scope: string;
|
scope: string;
|
||||||
@ -639,16 +598,6 @@ export type MariadbRemoteServerUserObject = {
|
|||||||
password: string;
|
password: string;
|
||||||
host: string;
|
host: string;
|
||||||
};
|
};
|
||||||
export type APILoginFunctionReturn = {
|
|
||||||
success: boolean;
|
|
||||||
msg?: string;
|
|
||||||
payload?: DATASQUIREL_LoggedInUser | null;
|
|
||||||
userId?: number | string;
|
|
||||||
key?: string;
|
|
||||||
token?: string;
|
|
||||||
csrf?: string;
|
|
||||||
cookieNames?: any;
|
|
||||||
};
|
|
||||||
export type APICreateUserFunctionParams = {
|
export type APICreateUserFunctionParams = {
|
||||||
encryptionKey?: string;
|
encryptionKey?: string;
|
||||||
payload: any;
|
payload: any;
|
||||||
@ -657,17 +606,6 @@ export type APICreateUserFunctionParams = {
|
|||||||
verify?: boolean;
|
verify?: boolean;
|
||||||
};
|
};
|
||||||
export type APICreateUserFunction = (params: APICreateUserFunctionParams) => Promise<AddUserFunctionReturn>;
|
export type APICreateUserFunction = (params: APICreateUserFunctionParams) => Promise<AddUserFunctionReturn>;
|
||||||
export type HandleSocialDbFunctionReturn = {
|
|
||||||
success: boolean;
|
|
||||||
user?: DATASQUIREL_LoggedInUser | null;
|
|
||||||
msg?: string;
|
|
||||||
social_id?: string | number;
|
|
||||||
social_platform?: string;
|
|
||||||
payload?: any;
|
|
||||||
alert?: boolean;
|
|
||||||
newUser?: any;
|
|
||||||
error?: any;
|
|
||||||
} | null;
|
|
||||||
export type CookieObject = {
|
export type CookieObject = {
|
||||||
name: string;
|
name: string;
|
||||||
value: string;
|
value: string;
|
||||||
@ -721,49 +659,6 @@ export type ApiGetQueryObject<T extends {
|
|||||||
};
|
};
|
||||||
export declare const DataCrudRequestMethods: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"];
|
export declare const DataCrudRequestMethods: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"];
|
||||||
export declare const DataCrudRequestMethodsLowerCase: readonly ["get", "post", "put", "patch", "delete", "options"];
|
export declare const DataCrudRequestMethodsLowerCase: readonly ["get", "post", "put", "patch", "delete", "options"];
|
||||||
export type DsqlMethodCrudParam<T extends {
|
|
||||||
[key: string]: any;
|
|
||||||
} = {
|
|
||||||
[key: string]: any;
|
|
||||||
}> = {
|
|
||||||
method: (typeof DataCrudRequestMethods)[number];
|
|
||||||
body?: T;
|
|
||||||
query?: DsqlCrudQueryObject<T>;
|
|
||||||
tableName: string;
|
|
||||||
addUser?: {
|
|
||||||
field: keyof T;
|
|
||||||
};
|
|
||||||
user?: DATASQUIREL_LoggedInUser;
|
|
||||||
extraData?: T;
|
|
||||||
transformData?: DsqlCrudTransformDataFunction<T>;
|
|
||||||
transformQuery?: DsqlCrudTransformQueryFunction<T>;
|
|
||||||
existingData?: T;
|
|
||||||
targetId?: string | number;
|
|
||||||
sanitize?: ({ data, batchData }: {
|
|
||||||
data?: T;
|
|
||||||
batchData?: T[];
|
|
||||||
}) => T | T[];
|
|
||||||
debug?: boolean;
|
|
||||||
};
|
|
||||||
export type DsqlCrudTransformDataFunction<T extends {
|
|
||||||
[key: string]: any;
|
|
||||||
} = {
|
|
||||||
[key: string]: any;
|
|
||||||
}> = (params: {
|
|
||||||
data: T;
|
|
||||||
user?: DATASQUIREL_LoggedInUser;
|
|
||||||
existingData?: T;
|
|
||||||
reqMethod: (typeof DataCrudRequestMethods)[number];
|
|
||||||
}) => Promise<T>;
|
|
||||||
export type DsqlCrudTransformQueryFunction<T extends {
|
|
||||||
[key: string]: any;
|
|
||||||
} = {
|
|
||||||
[key: string]: any;
|
|
||||||
}> = (params: {
|
|
||||||
query: DsqlCrudQueryObject<T>;
|
|
||||||
user?: DATASQUIREL_LoggedInUser;
|
|
||||||
reqMethod: (typeof DataCrudRequestMethods)[number];
|
|
||||||
}) => Promise<DsqlCrudQueryObject<T>>;
|
|
||||||
export declare const DsqlCrudActions: readonly ["insert", "update", "delete", "get"];
|
export declare const DsqlCrudActions: readonly ["insert", "update", "delete", "get"];
|
||||||
export type DsqlCrudQueryObject<T extends {
|
export type DsqlCrudQueryObject<T extends {
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@moduletrace/nsqlite",
|
"name": "@moduletrace/nsqlite",
|
||||||
"version": "1.0.4",
|
"version": "1.0.5",
|
||||||
"description": "SQLite manager for Node JS",
|
"description": "SQLite manager for Node JS",
|
||||||
"author": "Benjamin Toby",
|
"author": "Benjamin Toby",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
|||||||
@ -287,36 +287,6 @@ export interface GetReqQueryObject {
|
|||||||
debug?: boolean;
|
debug?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type DATASQUIREL_LoggedInUser = {
|
|
||||||
id: number;
|
|
||||||
uuid?: string;
|
|
||||||
first_name: string;
|
|
||||||
last_name: string;
|
|
||||||
email: string;
|
|
||||||
phone?: string;
|
|
||||||
user_type?: string;
|
|
||||||
username?: string;
|
|
||||||
image?: string;
|
|
||||||
image_thumbnail?: string;
|
|
||||||
social_login?: number;
|
|
||||||
social_platform?: string;
|
|
||||||
social_id?: string;
|
|
||||||
verification_status?: number;
|
|
||||||
csrf_k: string;
|
|
||||||
logged_in_status: boolean;
|
|
||||||
date: number;
|
|
||||||
} & {
|
|
||||||
[key: string]: any;
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface AuthenticatedUser {
|
|
||||||
success: boolean;
|
|
||||||
payload: DATASQUIREL_LoggedInUser | null;
|
|
||||||
msg?: string;
|
|
||||||
userId?: number;
|
|
||||||
cookieNames?: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface SuccessUserObject {
|
export interface SuccessUserObject {
|
||||||
id: number;
|
id: number;
|
||||||
first_name: string;
|
first_name: string;
|
||||||
@ -369,14 +339,6 @@ export interface GetUserFunctionReturn {
|
|||||||
} | null;
|
} | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ReauthUserFunctionReturn {
|
|
||||||
success: boolean;
|
|
||||||
payload: DATASQUIREL_LoggedInUser | null;
|
|
||||||
msg?: string;
|
|
||||||
userId?: number;
|
|
||||||
token?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface UpdateUserFunctionReturn {
|
export interface UpdateUserFunctionReturn {
|
||||||
success: boolean;
|
success: boolean;
|
||||||
payload?: Object[] | string;
|
payload?: Object[] | string;
|
||||||
@ -450,13 +412,6 @@ export interface PostInsertReturn {
|
|||||||
error?: string;
|
error?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserType = DATASQUIREL_LoggedInUser & {
|
|
||||||
isSuperUser?: boolean;
|
|
||||||
staticHost?: string;
|
|
||||||
appHost?: string;
|
|
||||||
appName?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface ApiKeyDef {
|
export interface ApiKeyDef {
|
||||||
name: string;
|
name: string;
|
||||||
scope: string;
|
scope: string;
|
||||||
@ -737,17 +692,6 @@ export type MariadbRemoteServerUserObject = {
|
|||||||
host: string;
|
host: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type APILoginFunctionReturn = {
|
|
||||||
success: boolean;
|
|
||||||
msg?: string;
|
|
||||||
payload?: DATASQUIREL_LoggedInUser | null;
|
|
||||||
userId?: number | string;
|
|
||||||
key?: string;
|
|
||||||
token?: string;
|
|
||||||
csrf?: string;
|
|
||||||
cookieNames?: any;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type APICreateUserFunctionParams = {
|
export type APICreateUserFunctionParams = {
|
||||||
encryptionKey?: string;
|
encryptionKey?: string;
|
||||||
payload: any;
|
payload: any;
|
||||||
@ -760,18 +704,6 @@ export type APICreateUserFunction = (
|
|||||||
params: APICreateUserFunctionParams,
|
params: APICreateUserFunctionParams,
|
||||||
) => Promise<AddUserFunctionReturn>;
|
) => Promise<AddUserFunctionReturn>;
|
||||||
|
|
||||||
export type HandleSocialDbFunctionReturn = {
|
|
||||||
success: boolean;
|
|
||||||
user?: DATASQUIREL_LoggedInUser | null;
|
|
||||||
msg?: string;
|
|
||||||
social_id?: string | number;
|
|
||||||
social_platform?: string;
|
|
||||||
payload?: any;
|
|
||||||
alert?: boolean;
|
|
||||||
newUser?: any;
|
|
||||||
error?: any;
|
|
||||||
} | null;
|
|
||||||
|
|
||||||
export type CookieObject = {
|
export type CookieObject = {
|
||||||
name: string;
|
name: string;
|
||||||
value: string;
|
value: string;
|
||||||
@ -835,43 +767,6 @@ export const DataCrudRequestMethodsLowerCase = [
|
|||||||
"options",
|
"options",
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export type DsqlMethodCrudParam<
|
|
||||||
T extends { [key: string]: any } = { [key: string]: any },
|
|
||||||
> = {
|
|
||||||
method: (typeof DataCrudRequestMethods)[number];
|
|
||||||
body?: T;
|
|
||||||
query?: DsqlCrudQueryObject<T>;
|
|
||||||
tableName: string;
|
|
||||||
addUser?: {
|
|
||||||
field: keyof T;
|
|
||||||
};
|
|
||||||
user?: DATASQUIREL_LoggedInUser;
|
|
||||||
extraData?: T;
|
|
||||||
transformData?: DsqlCrudTransformDataFunction<T>;
|
|
||||||
transformQuery?: DsqlCrudTransformQueryFunction<T>;
|
|
||||||
existingData?: T;
|
|
||||||
targetId?: string | number;
|
|
||||||
sanitize?: ({ data, batchData }: { data?: T; batchData?: T[] }) => T | T[];
|
|
||||||
debug?: boolean;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type DsqlCrudTransformDataFunction<
|
|
||||||
T extends { [key: string]: any } = { [key: string]: any },
|
|
||||||
> = (params: {
|
|
||||||
data: T;
|
|
||||||
user?: DATASQUIREL_LoggedInUser;
|
|
||||||
existingData?: T;
|
|
||||||
reqMethod: (typeof DataCrudRequestMethods)[number];
|
|
||||||
}) => Promise<T>;
|
|
||||||
|
|
||||||
export type DsqlCrudTransformQueryFunction<
|
|
||||||
T extends { [key: string]: any } = { [key: string]: any },
|
|
||||||
> = (params: {
|
|
||||||
query: DsqlCrudQueryObject<T>;
|
|
||||||
user?: DATASQUIREL_LoggedInUser;
|
|
||||||
reqMethod: (typeof DataCrudRequestMethods)[number];
|
|
||||||
}) => Promise<DsqlCrudQueryObject<T>>;
|
|
||||||
|
|
||||||
export const DsqlCrudActions = ["insert", "update", "delete", "get"] as const;
|
export const DsqlCrudActions = ["insert", "update", "delete", "get"] as const;
|
||||||
|
|
||||||
export type DsqlCrudQueryObject<
|
export type DsqlCrudQueryObject<
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user