Updates
This commit is contained in:
parent
4adb5af430
commit
0fc2c7fb3e
2
dist/package-shared/actions/get.d.ts
vendored
2
dist/package-shared/actions/get.d.ts
vendored
@ -21,5 +21,5 @@ export default function get<T extends {
|
|||||||
[k: string]: any;
|
[k: string]: any;
|
||||||
} = {
|
} = {
|
||||||
[k: string]: any;
|
[k: string]: any;
|
||||||
}>({ key, db, query, queryValues, tableName, user_id, debug, forceLocal, }: Param<T>): Promise<GetReturn>;
|
}, R extends any = any>({ key, db, query, queryValues, tableName, user_id, debug, forceLocal, }: Param<T>): Promise<GetReturn<R>>;
|
||||||
export {};
|
export {};
|
||||||
|
@ -30,6 +30,12 @@ function sqlGenerator({ tableName, genObject, dbFullName }) {
|
|||||||
if (queryObj.equality == "LIKE") {
|
if (queryObj.equality == "LIKE") {
|
||||||
str = `LOWER(${finalFieldName}) LIKE LOWER('%${valueParsed}%')`;
|
str = `LOWER(${finalFieldName}) LIKE LOWER('%${valueParsed}%')`;
|
||||||
}
|
}
|
||||||
|
else if (queryObj.equality == "REGEXP") {
|
||||||
|
str = `${finalFieldName} REGEXP '${valueParsed}'`;
|
||||||
|
}
|
||||||
|
else if (queryObj.equality == "FULLTEXT") {
|
||||||
|
str = `MATCH(${finalFieldName}) AGAINST('${valueParsed}' IN BOOLEAN MODE)`;
|
||||||
|
}
|
||||||
else if (queryObj.equality == "NOT EQUAL") {
|
else if (queryObj.equality == "NOT EQUAL") {
|
||||||
str = `${finalFieldName} != ?`;
|
str = `${finalFieldName} != ?`;
|
||||||
sqlSearhValues.push(valueParsed);
|
sqlSearhValues.push(valueParsed);
|
||||||
|
7
dist/package-shared/types/index.d.ts
vendored
7
dist/package-shared/types/index.d.ts
vendored
@ -277,9 +277,9 @@ export interface UpdateUserFunctionReturn {
|
|||||||
success: boolean;
|
success: boolean;
|
||||||
payload?: Object[] | string;
|
payload?: Object[] | string;
|
||||||
}
|
}
|
||||||
export interface GetReturn {
|
export interface GetReturn<R extends any = any> {
|
||||||
success: boolean;
|
success: boolean;
|
||||||
payload?: any;
|
payload?: R;
|
||||||
msg?: string;
|
msg?: string;
|
||||||
error?: string;
|
error?: string;
|
||||||
schema?: DSQL_TableSchemaType;
|
schema?: DSQL_TableSchemaType;
|
||||||
@ -942,7 +942,7 @@ export type FetchApiReturn = {
|
|||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
};
|
};
|
||||||
export declare const ServerQueryOperators: readonly ["AND", "OR"];
|
export declare const ServerQueryOperators: readonly ["AND", "OR"];
|
||||||
export declare const ServerQueryEqualities: readonly ["EQUAL", "LIKE", "NOT EQUAL"];
|
export declare const ServerQueryEqualities: readonly ["EQUAL", "LIKE", "NOT EQUAL", "REGEXP", "FULLTEXT"];
|
||||||
export type ServerQueryParam<T extends {
|
export type ServerQueryParam<T extends {
|
||||||
[k: string]: any;
|
[k: string]: any;
|
||||||
} = {
|
} = {
|
||||||
@ -1120,6 +1120,7 @@ export type HandleSocialDbFunctionParams = {
|
|||||||
additionalFields?: string[];
|
additionalFields?: string[];
|
||||||
debug?: boolean;
|
debug?: boolean;
|
||||||
loginOnly?: boolean;
|
loginOnly?: boolean;
|
||||||
|
social_id?: string | number;
|
||||||
};
|
};
|
||||||
export type HandleSocialDbFunctionReturn = {
|
export type HandleSocialDbFunctionReturn = {
|
||||||
success: boolean;
|
success: boolean;
|
||||||
|
8
dist/package-shared/types/index.js
vendored
8
dist/package-shared/types/index.js
vendored
@ -12,6 +12,12 @@ exports.TextFieldTypesArray = [
|
|||||||
{ title: "Shell", value: "shell" },
|
{ title: "Shell", value: "shell" },
|
||||||
];
|
];
|
||||||
exports.ServerQueryOperators = ["AND", "OR"];
|
exports.ServerQueryOperators = ["AND", "OR"];
|
||||||
exports.ServerQueryEqualities = ["EQUAL", "LIKE", "NOT EQUAL"];
|
exports.ServerQueryEqualities = [
|
||||||
|
"EQUAL",
|
||||||
|
"LIKE",
|
||||||
|
"NOT EQUAL",
|
||||||
|
"REGEXP",
|
||||||
|
"FULLTEXT",
|
||||||
|
];
|
||||||
exports.DataCrudRequestMethods = ["GET", "POST", "PUT", "DELETE"];
|
exports.DataCrudRequestMethods = ["GET", "POST", "PUT", "DELETE"];
|
||||||
exports.DsqlCrudActions = ["insert", "update", "delete", "get"];
|
exports.DsqlCrudActions = ["insert", "update", "delete", "get"];
|
||||||
|
@ -30,7 +30,8 @@ export type ApiGetParams = Param;
|
|||||||
* # Make a get request to Datasquirel API
|
* # Make a get request to Datasquirel API
|
||||||
*/
|
*/
|
||||||
export default async function get<
|
export default async function get<
|
||||||
T extends { [k: string]: any } = { [k: string]: any }
|
T extends { [k: string]: any } = { [k: string]: any },
|
||||||
|
R extends any = any
|
||||||
>({
|
>({
|
||||||
key,
|
key,
|
||||||
db,
|
db,
|
||||||
@ -40,7 +41,7 @@ export default async function get<
|
|||||||
user_id,
|
user_id,
|
||||||
debug,
|
debug,
|
||||||
forceLocal,
|
forceLocal,
|
||||||
}: Param<T>): Promise<GetReturn> {
|
}: Param<T>): Promise<GetReturn<R>> {
|
||||||
const grabedHostNames = grabHostNames();
|
const grabedHostNames = grabHostNames();
|
||||||
const { host, port, scheme } = grabedHostNames;
|
const { host, port, scheme } = grabedHostNames;
|
||||||
|
|
||||||
|
@ -62,6 +62,10 @@ export default function sqlGenerator<
|
|||||||
|
|
||||||
if (queryObj.equality == "LIKE") {
|
if (queryObj.equality == "LIKE") {
|
||||||
str = `LOWER(${finalFieldName}) LIKE LOWER('%${valueParsed}%')`;
|
str = `LOWER(${finalFieldName}) LIKE LOWER('%${valueParsed}%')`;
|
||||||
|
} else if (queryObj.equality == "REGEXP") {
|
||||||
|
str = `${finalFieldName} REGEXP '${valueParsed}'`;
|
||||||
|
} else if (queryObj.equality == "FULLTEXT") {
|
||||||
|
str = `MATCH(${finalFieldName}) AGAINST('${valueParsed}' IN BOOLEAN MODE)`;
|
||||||
} else if (queryObj.equality == "NOT EQUAL") {
|
} else if (queryObj.equality == "NOT EQUAL") {
|
||||||
str = `${finalFieldName} != ?`;
|
str = `${finalFieldName} != ?`;
|
||||||
sqlSearhValues.push(valueParsed);
|
sqlSearhValues.push(valueParsed);
|
||||||
|
@ -291,9 +291,9 @@ export interface UpdateUserFunctionReturn {
|
|||||||
payload?: Object[] | string;
|
payload?: Object[] | string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetReturn {
|
export interface GetReturn<R extends any = any> {
|
||||||
success: boolean;
|
success: boolean;
|
||||||
payload?: any;
|
payload?: R;
|
||||||
msg?: string;
|
msg?: string;
|
||||||
error?: string;
|
error?: string;
|
||||||
schema?: DSQL_TableSchemaType;
|
schema?: DSQL_TableSchemaType;
|
||||||
@ -1092,7 +1092,13 @@ export type FetchApiReturn = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const ServerQueryOperators = ["AND", "OR"] as const;
|
export const ServerQueryOperators = ["AND", "OR"] as const;
|
||||||
export const ServerQueryEqualities = ["EQUAL", "LIKE", "NOT EQUAL"] as const;
|
export const ServerQueryEqualities = [
|
||||||
|
"EQUAL",
|
||||||
|
"LIKE",
|
||||||
|
"NOT EQUAL",
|
||||||
|
"REGEXP",
|
||||||
|
"FULLTEXT",
|
||||||
|
] as const;
|
||||||
|
|
||||||
export type ServerQueryParam<
|
export type ServerQueryParam<
|
||||||
T extends { [k: string]: any } = { [k: string]: any }
|
T extends { [k: string]: any } = { [k: string]: any }
|
||||||
@ -1295,6 +1301,7 @@ export type HandleSocialDbFunctionParams = {
|
|||||||
additionalFields?: string[];
|
additionalFields?: string[];
|
||||||
debug?: boolean;
|
debug?: boolean;
|
||||||
loginOnly?: boolean;
|
loginOnly?: boolean;
|
||||||
|
social_id?: string | number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type HandleSocialDbFunctionReturn = {
|
export type HandleSocialDbFunctionReturn = {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@moduletrace/datasquirel",
|
"name": "@moduletrace/datasquirel",
|
||||||
"version": "4.6.1",
|
"version": "4.6.2",
|
||||||
"description": "Cloud-based SQL data management tool",
|
"description": "Cloud-based SQL data management tool",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
Loading…
Reference in New Issue
Block a user