Updates
This commit is contained in:
Vendored
+3
-3
@@ -73,12 +73,12 @@ declare const datasquirel: {
|
||||
post: typeof post;
|
||||
user: {
|
||||
auth: {
|
||||
login: (_: import("./package-shared/types").LoginUserParam) => Promise<import("./package-shared/types").APIResponseObject<import("./package-shared/types").DATASQUIREL_LoggedInUser | null>>;
|
||||
login: (_: import("./package-shared/types").LoginUserParam) => Promise<import("./package-shared/types").APIResponseObject>;
|
||||
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>;
|
||||
update: (_: import("./package-shared/types").UpdateUserParams) => Promise<import("./package-shared/types").APIResponseObject>;
|
||||
resetPassword: (_: import("./package-shared/types").ResetPasswordParams) => Promise<import("./package-shared/types").APIResponseObject>;
|
||||
googleLogin: (_: import("./package-shared/types").GoogleAuthParams) => Promise<import("./package-shared/types").APIResponseObject>;
|
||||
logout: typeof import("./package-shared/actions/users/logout-user").default;
|
||||
auth: typeof import("./package-shared/actions/users/user-auth").default;
|
||||
|
||||
Vendored
+1
-1
@@ -20,5 +20,5 @@ export default function get<T extends {
|
||||
[k: string]: any;
|
||||
} = {
|
||||
[k: string]: any;
|
||||
}, R extends any = any>({ key, database, query, table, debug, useLocal, apiVersion, }: Param<T>): Promise<APIResponseObject<R>>;
|
||||
}>({ key, database, query, table, debug, useLocal, apiVersion, }: Param<T>): Promise<APIResponseObject>;
|
||||
export {};
|
||||
|
||||
+1
-1
@@ -2,4 +2,4 @@ import { APIResponseObject, DATASQUIREL_LoggedInUser, LoginUserParam } from "../
|
||||
/**
|
||||
* # Login A user
|
||||
*/
|
||||
export default function loginUser<T extends DATASQUIREL_LoggedInUser = DATASQUIREL_LoggedInUser>({ apiKey, payload, database, additionalFields, response, encryptionKey, encryptionSalt, email_login, email_login_code, temp_code_field, token, skipPassword, apiUserID, skipWriteAuthFile, dbUserId, debug, cleanupTokens, secureCookie, useLocal, apiVersion, }: LoginUserParam): Promise<APIResponseObject<T | null>>;
|
||||
export default function loginUser<T extends DATASQUIREL_LoggedInUser = DATASQUIREL_LoggedInUser>({ apiKey, payload, database, additionalFields, response, encryptionKey, encryptionSalt, email_login, email_login_code, temp_code_field, token, skipPassword, apiUserID, skipWriteAuthFile, dbUserId, debug, cleanupTokens, secureCookie, useLocal, apiVersion, }: LoginUserParam): Promise<APIResponseObject>;
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import { ResetPasswordParams, UpdateUserFunctionReturn } from "../../types";
|
||||
import { APIResponseObject, ResetPasswordParams } from "../../types";
|
||||
/**
|
||||
* # Reset User Password
|
||||
*/
|
||||
export default function resetPassword(params: ResetPasswordParams): Promise<UpdateUserFunctionReturn>;
|
||||
export default function resetPassword(params: ResetPasswordParams): Promise<APIResponseObject>;
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
import { UpdateUserFunctionReturn, UpdateUserParams } from "../../types";
|
||||
import { APIResponseObject, UpdateUserParams } from "../../types";
|
||||
import { DSQL_DATASQUIREL_USERS } from "../../types/dsql";
|
||||
/**
|
||||
* # Update User
|
||||
*/
|
||||
export default function updateUser<T extends DSQL_DATASQUIREL_USERS = DSQL_DATASQUIREL_USERS & {
|
||||
[k: string]: any;
|
||||
}>({ payload, database, updatedUserId, useLocal, apiKey, apiVersion, dbUserId, }: UpdateUserParams<T>): Promise<UpdateUserFunctionReturn>;
|
||||
}>({ payload, database, updatedUserId, useLocal, apiKey, apiVersion, dbUserId, }: UpdateUserParams<T>): Promise<APIResponseObject>;
|
||||
|
||||
+1
-3
@@ -20,7 +20,5 @@ export default function apiCrudDELETE<T extends {
|
||||
[key: string]: any;
|
||||
} = {
|
||||
[key: string]: any;
|
||||
}>({ dbName, tableName, deleteSpec, targetID, apiKey, useDefault }: Params<T>): Promise<import("../../types").APIResponseObject<{
|
||||
[k: string]: any;
|
||||
}>>;
|
||||
}>({ dbName, tableName, deleteSpec, targetID, apiKey, useDefault }: Params<T>): Promise<import("../../types").APIResponseObject>;
|
||||
export {};
|
||||
|
||||
+1
-1
@@ -9,5 +9,5 @@ type Params = {
|
||||
grabbedHostnames?: GrabHostNamesReturn;
|
||||
useDefault?: boolean;
|
||||
};
|
||||
export default function <T extends DSQL_DatabaseSchemaType | DSQL_TableSchemaType | DSQL_FieldSchemaType = DSQL_DatabaseSchemaType>({ dbName, tableName, apiKey, useDefault, fieldName, apiConnectionConfig, grabbedHostnames, }: Params): Promise<APIResponseObject<T>>;
|
||||
export default function <T extends DSQL_DatabaseSchemaType | DSQL_TableSchemaType | DSQL_FieldSchemaType = DSQL_DatabaseSchemaType>({ dbName, tableName, apiKey, useDefault, fieldName, apiConnectionConfig, grabbedHostnames, }: Params): Promise<APIResponseObject>;
|
||||
export {};
|
||||
|
||||
+3
-3
@@ -4,12 +4,12 @@ import validateTempEmailCode from "../../actions/users/validate-temp-email-code"
|
||||
import { AddUserParams, GetUserParams, GoogleAuthParams, LoginUserParam, ResetPasswordParams, SendEmailCodeParams, UpdateUserParams } from "../../types";
|
||||
declare const localUser: {
|
||||
auth: {
|
||||
login: (_: LoginUserParam) => Promise<import("../../types").APIResponseObject<import("../../types").DATASQUIREL_LoggedInUser | null>>;
|
||||
login: (_: LoginUserParam) => Promise<import("../../types").APIResponseObject>;
|
||||
get: (_: GetUserParams) => Promise<import("../../types").GetUserFunctionReturn>;
|
||||
signup: (_: AddUserParams) => Promise<import("../../types").APIResponseObject>;
|
||||
sendEmailCode: (_: SendEmailCodeParams) => Promise<import("../../types").APIResponseObject>;
|
||||
update: (_: UpdateUserParams) => Promise<import("../../types").UpdateUserFunctionReturn>;
|
||||
resetPassword: (_: ResetPasswordParams) => Promise<import("../../types").UpdateUserFunctionReturn>;
|
||||
update: (_: UpdateUserParams) => Promise<import("../../types").APIResponseObject>;
|
||||
resetPassword: (_: ResetPasswordParams) => Promise<import("../../types").APIResponseObject>;
|
||||
googleLogin: (_: GoogleAuthParams) => Promise<import("../../types").APIResponseObject>;
|
||||
logout: typeof logoutUser;
|
||||
auth: typeof userAuth;
|
||||
|
||||
+1
-3
@@ -17,7 +17,5 @@ type Param<T = {
|
||||
*/
|
||||
export default function queryDSQLAPI<T = {
|
||||
[k: string]: any;
|
||||
}, P = {
|
||||
[k: string]: any;
|
||||
}>({ body, query, useDefault, path: passedPath, method, apiKey, apiConnectionConfig, grabbedHostnames, }: Param<T>): Promise<APIResponseObject<P>>;
|
||||
}>({ body, query, useDefault, path: passedPath, method, apiKey, apiConnectionConfig, grabbedHostnames, }: Param<T>): Promise<APIResponseObject>;
|
||||
export {};
|
||||
|
||||
@@ -121,8 +121,8 @@ function handleSocialDb(_a) {
|
||||
duplicateColumnValue: finalEmail,
|
||||
data: Object.assign(Object.assign({}, data), { email: finalEmail }),
|
||||
});
|
||||
if ((_b = newUser === null || newUser === void 0 ? void 0 : newUser.payload) === null || _b === void 0 ? void 0 : _b.insertId) {
|
||||
const newUserQueriedQuery = `SELECT * FROM users WHERE id='${newUser.payload.insertId}'`;
|
||||
if ((_b = newUser === null || newUser === void 0 ? void 0 : newUser.postInsertReturn) === null || _b === void 0 ? void 0 : _b.insertId) {
|
||||
const newUserQueriedQuery = `SELECT * FROM users WHERE id='${newUser.postInsertReturn.insertId}'`;
|
||||
const newUserQueried = (yield (0, dbHandler_1.default)({
|
||||
database: finalDbName,
|
||||
query: newUserQueriedQuery,
|
||||
@@ -141,7 +141,7 @@ function handleSocialDb(_a) {
|
||||
*/
|
||||
let generatedToken = (0, encrypt_1.default)({
|
||||
data: JSON.stringify({
|
||||
id: newUser.payload.insertId,
|
||||
id: newUser.postInsertReturn.insertId,
|
||||
email: supEmail,
|
||||
dateCode: Date.now(),
|
||||
}),
|
||||
|
||||
@@ -138,8 +138,8 @@ function apiCreateUser(_a) {
|
||||
"/images/user-preset.png", image_thumbnail: process.env.DSQL_DEFAULT_USER_IMAGE ||
|
||||
"/images/user-preset-thumbnail.png", verification_status: verify ? 1 : 0 }),
|
||||
});
|
||||
if ((_b = addUser === null || addUser === void 0 ? void 0 : addUser.payload) === null || _b === void 0 ? void 0 : _b.insertId) {
|
||||
const newlyAddedUserQuery = `SELECT id,uuid,first_name,last_name,email,username,image,image_thumbnail,verification_status FROM ${dbFullName}.users WHERE id='${addUser.payload.insertId}'`;
|
||||
if ((_b = addUser === null || addUser === void 0 ? void 0 : addUser.postInsertReturn) === null || _b === void 0 ? void 0 : _b.insertId) {
|
||||
const newlyAddedUserQuery = `SELECT id,uuid,first_name,last_name,email,username,image,image_thumbnail,verification_status FROM ${dbFullName}.users WHERE id='${addUser.postInsertReturn.insertId}'`;
|
||||
const newlyAddedUser = (yield (0, dbHandler_1.default)({
|
||||
query: newlyAddedUserQuery,
|
||||
values: [],
|
||||
|
||||
+1
-1
@@ -153,7 +153,7 @@ function apiLoginUser(_a) {
|
||||
const resposeObject = {
|
||||
success: true,
|
||||
msg: "Login Successful",
|
||||
payload: userPayload,
|
||||
singleRes: userPayload,
|
||||
userId: foundUser[0].id,
|
||||
csrf: csrfKey,
|
||||
};
|
||||
|
||||
@@ -49,7 +49,7 @@ function apiResetUserPassword(_a) {
|
||||
});
|
||||
return {
|
||||
success: true,
|
||||
payload: updateUser,
|
||||
singleRes: updateUser,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ function apiUpdateUser(_a) {
|
||||
});
|
||||
return {
|
||||
success: true,
|
||||
payload: updateUser,
|
||||
singleRes: updateUser,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { APILoginFunctionReturn } from "../../../../types";
|
||||
import { APIResponseObject } from "../../../../types";
|
||||
type Param = {
|
||||
code?: string;
|
||||
clientId?: string;
|
||||
@@ -13,5 +13,5 @@ type Param = {
|
||||
/**
|
||||
* # API Login with Github
|
||||
*/
|
||||
export default function apiGithubLogin({ code, clientId, clientSecret, database, additionalFields, email, additionalData, }: Param): Promise<APILoginFunctionReturn>;
|
||||
export default function apiGithubLogin({ code, clientId, clientSecret, database, additionalFields, email, additionalData, }: Param): Promise<APIResponseObject>;
|
||||
export {};
|
||||
|
||||
@@ -20,7 +20,7 @@ function postLoginResponseHandler({ database, httpResponse, response, encryption
|
||||
const COOKIE_EXPIRY_DATE = (0, grab_cookie_expirt_date_1.default)();
|
||||
if (httpResponse === null || httpResponse === void 0 ? void 0 : httpResponse.success) {
|
||||
let encryptedPayload = (0, encrypt_1.default)({
|
||||
data: JSON.stringify(httpResponse.payload),
|
||||
data: JSON.stringify(httpResponse.singleRes),
|
||||
encryptionKey,
|
||||
encryptionSalt,
|
||||
});
|
||||
@@ -35,8 +35,8 @@ function postLoginResponseHandler({ database, httpResponse, response, encryption
|
||||
database,
|
||||
});
|
||||
if (httpResponse.csrf && !skipWriteAuthFile) {
|
||||
(0, write_auth_files_1.writeAuthFile)(httpResponse.csrf, JSON.stringify(httpResponse.payload), cleanupTokens && ((_a = httpResponse.payload) === null || _a === void 0 ? void 0 : _a.id)
|
||||
? { userId: httpResponse.payload.id }
|
||||
(0, write_auth_files_1.writeAuthFile)(httpResponse.csrf, JSON.stringify(httpResponse.singleRes), cleanupTokens && ((_a = httpResponse.singleRes) === null || _a === void 0 ? void 0 : _a.id)
|
||||
? { userId: httpResponse.singleRes.id }
|
||||
: undefined);
|
||||
}
|
||||
httpResponse["cookieNames"] = cookieNames;
|
||||
@@ -50,7 +50,7 @@ function postLoginResponseHandler({ database, httpResponse, response, encryption
|
||||
}
|
||||
response === null || response === void 0 ? void 0 : response.setHeader("Set-Cookie", [
|
||||
`${authKeyName}=${encryptedPayload};samesite=strict;path=/;HttpOnly=true;Expires=${COOKIE_EXPIRY_DATE}${secureCookie ? ";Secure=true" : ""}`,
|
||||
`${csrfName}=${(_b = httpResponse.payload) === null || _b === void 0 ? void 0 : _b.csrf_k};samesite=strict;path=/;HttpOnly=true;Expires=${COOKIE_EXPIRY_DATE}`,
|
||||
`${csrfName}=${(_b = httpResponse.singleRes) === null || _b === void 0 ? void 0 : _b.csrf_k};samesite=strict;path=/;HttpOnly=true;Expires=${COOKIE_EXPIRY_DATE}`,
|
||||
]);
|
||||
if (debug) {
|
||||
debugFn("Response Sent!");
|
||||
|
||||
@@ -38,7 +38,7 @@ function suAddBackup(_a) {
|
||||
tableName: "backups",
|
||||
data: newBackup,
|
||||
});
|
||||
if (!((_b = newBackupEntry === null || newBackupEntry === void 0 ? void 0 : newBackupEntry.payload) === null || _b === void 0 ? void 0 : _b.insertId)) {
|
||||
if (!((_b = newBackupEntry === null || newBackupEntry === void 0 ? void 0 : newBackupEntry.postInsertReturn) === null || _b === void 0 ? void 0 : _b.insertId)) {
|
||||
return {
|
||||
success: false,
|
||||
msg: `Couldn't create new backup entry`,
|
||||
@@ -46,7 +46,7 @@ function suAddBackup(_a) {
|
||||
}
|
||||
const { single: newlyAddedBackup } = yield (0, grab_user_resource_1.default)({
|
||||
tableName: "backups",
|
||||
targetID: (_c = newBackupEntry.payload) === null || _c === void 0 ? void 0 : _c.insertId,
|
||||
targetID: (_c = newBackupEntry.postInsertReturn) === null || _c === void 0 ? void 0 : _c.insertId,
|
||||
isSuperUser: true,
|
||||
});
|
||||
if (!(newlyAddedBackup === null || newlyAddedBackup === void 0 ? void 0 : newlyAddedBackup.id)) {
|
||||
|
||||
@@ -53,7 +53,7 @@ function deleteDbEntry(_a) {
|
||||
*/
|
||||
return {
|
||||
success: Boolean(deletedEntry.affectedRows),
|
||||
payload: deletedEntry,
|
||||
postInsertReturn: deletedEntry,
|
||||
queryObject: {
|
||||
sql: (0, sql_formatter_1.format)(query),
|
||||
params: values,
|
||||
|
||||
@@ -115,7 +115,7 @@ function updateDbEntry(_a) {
|
||||
*/
|
||||
return {
|
||||
success: Boolean(updatedEntry === null || updatedEntry === void 0 ? void 0 : updatedEntry.affectedRows),
|
||||
payload: updatedEntry,
|
||||
postInsertReturn: updatedEntry,
|
||||
queryObject: {
|
||||
sql: (0, sql_formatter_1.format)(query),
|
||||
params: updateValues,
|
||||
|
||||
+3
-1
@@ -61,7 +61,9 @@ function handleMariadbUserRecord(_a) {
|
||||
query: {
|
||||
query: {
|
||||
id: {
|
||||
value: String((existingRecord === null || existingRecord === void 0 ? void 0 : existingRecord.id) || ((_d = record === null || record === void 0 ? void 0 : record.payload) === null || _d === void 0 ? void 0 : _d.insertId) || 0),
|
||||
value: String((existingRecord === null || existingRecord === void 0 ? void 0 : existingRecord.id) ||
|
||||
((_d = record === null || record === void 0 ? void 0 : record.postInsertReturn) === null || _d === void 0 ? void 0 : _d.insertId) ||
|
||||
0),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -52,7 +52,7 @@ function checkDbRecordCreateDbSchema(_a) {
|
||||
tableName: "user_databases",
|
||||
forceLocal: true,
|
||||
});
|
||||
if ((_b = newDbEntry.payload) === null || _b === void 0 ? void 0 : _b.insertId) {
|
||||
if ((_b = newDbEntry.postInsertReturn) === null || _b === void 0 ? void 0 : _b.insertId) {
|
||||
recordedDbEntryArray = (yield (0, dbHandler_1.default)({
|
||||
query: `SELECT * FROM datasquirel.user_databases WHERE db_full_name = ?`,
|
||||
values: [dbFullName || "NULL"],
|
||||
|
||||
@@ -74,7 +74,7 @@ function checkTableRecordCreateDbSchema(_a) {
|
||||
dbContext: "Master",
|
||||
forceLocal: true,
|
||||
});
|
||||
if ((_b = newTableRecordEntry.payload) === null || _b === void 0 ? void 0 : _b.insertId) {
|
||||
if ((_b = newTableRecordEntry.postInsertReturn) === null || _b === void 0 ? void 0 : _b.insertId) {
|
||||
recordedTableEntryArray = (yield (0, dbHandler_1.default)({
|
||||
query: (queryObj === null || queryObj === void 0 ? void 0 : queryObj.string) || "",
|
||||
values: queryObj === null || queryObj === void 0 ? void 0 : queryObj.values,
|
||||
|
||||
@@ -78,7 +78,7 @@ function createUser() {
|
||||
tableName: "users",
|
||||
data: Object.assign(Object.assign({}, userObj), { password: hashedPassword }),
|
||||
});
|
||||
if (!((_a = newUser === null || newUser === void 0 ? void 0 : newUser.payload) === null || _a === void 0 ? void 0 : _a.insertId))
|
||||
if (!((_a = newUser === null || newUser === void 0 ? void 0 : newUser.postInsertReturn) === null || _a === void 0 ? void 0 : _a.insertId))
|
||||
return false;
|
||||
const { STATIC_ROOT } = (0, grab_dir_names_1.default)();
|
||||
if (!STATIC_ROOT) {
|
||||
@@ -90,17 +90,17 @@ function createUser() {
|
||||
*
|
||||
* @description Create new user folder and file
|
||||
*/
|
||||
let newUserSchemaFolderPath = `${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${newUser.payload.insertId}`;
|
||||
let newUserMediaFolderPath = path_1.default.join(STATIC_ROOT, `images/user-images/user-${newUser.payload.insertId}`);
|
||||
let newUserSchemaFolderPath = `${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${newUser.postInsertReturn.insertId}`;
|
||||
let newUserMediaFolderPath = path_1.default.join(STATIC_ROOT, `images/user-images/user-${newUser.postInsertReturn.insertId}`);
|
||||
fs_1.default.mkdirSync(newUserSchemaFolderPath, { recursive: true });
|
||||
fs_1.default.mkdirSync(newUserMediaFolderPath, { recursive: true });
|
||||
fs_1.default.writeFileSync(`${newUserSchemaFolderPath}/main.json`, JSON.stringify([]), "utf8");
|
||||
const imageBasePath = path_1.default.join(STATIC_ROOT, `images/user-images/user-${newUser.payload.insertId}`);
|
||||
const imageBasePath = path_1.default.join(STATIC_ROOT, `images/user-images/user-${newUser.postInsertReturn.insertId}`);
|
||||
if (!fs_1.default.existsSync(imageBasePath)) {
|
||||
fs_1.default.mkdirSync(imageBasePath, { recursive: true });
|
||||
}
|
||||
let imagePath = path_1.default.join(STATIC_ROOT, `images/user-images/user-${newUser.payload.insertId}/user-${newUser.payload.insertId}-profile.jpg`);
|
||||
let imageThumbnailPath = path_1.default.join(STATIC_ROOT, `images/user-images/user-${newUser.payload.insertId}/user-${newUser.payload.insertId}-profile-thumbnail.jpg`);
|
||||
let imagePath = path_1.default.join(STATIC_ROOT, `images/user-images/user-${newUser.postInsertReturn.insertId}/user-${newUser.postInsertReturn.insertId}-profile.jpg`);
|
||||
let imageThumbnailPath = path_1.default.join(STATIC_ROOT, `images/user-images/user-${newUser.postInsertReturn.insertId}/user-${newUser.postInsertReturn.insertId}-profile-thumbnail.jpg`);
|
||||
let prodImageUrl = imagePath.replace(STATIC_ROOT, process.env.DSQL_STATIC_HOST || "");
|
||||
let prodImageThumbnailUrl = imageThumbnailPath.replace(STATIC_ROOT, process.env.DSQL_STATIC_HOST || "");
|
||||
fs_1.default.copyFileSync(path_1.default.join(ROOT_DIR, "/public/images/user-preset.png"), imagePath);
|
||||
@@ -110,7 +110,7 @@ function createUser() {
|
||||
dbFullName: "datasquirel",
|
||||
tableName: "users",
|
||||
identifierColumnName: "id",
|
||||
identifierValue: newUser.payload.insertId,
|
||||
identifierValue: newUser.postInsertReturn.insertId,
|
||||
data: {
|
||||
image: prodImageUrl,
|
||||
image_thumbnail: prodImageThumbnailUrl,
|
||||
|
||||
@@ -85,8 +85,8 @@ function default_1(_a) {
|
||||
tableName: targetTableName,
|
||||
dbFullName: targetDatabase,
|
||||
});
|
||||
if ((_b = newTableEntryRes === null || newTableEntryRes === void 0 ? void 0 : newTableEntryRes.payload) === null || _b === void 0 ? void 0 : _b.insertId) {
|
||||
tableId = newTableEntryRes.payload.insertId;
|
||||
if ((_b = newTableEntryRes === null || newTableEntryRes === void 0 ? void 0 : newTableEntryRes.postInsertReturn) === null || _b === void 0 ? void 0 : _b.insertId) {
|
||||
tableId = newTableEntryRes.postInsertReturn.insertId;
|
||||
}
|
||||
}
|
||||
if (newTableSchema.tableNameOld) {
|
||||
|
||||
Vendored
+8
-2
@@ -1444,9 +1444,15 @@ export type ResponseQueryObject = {
|
||||
sql?: string;
|
||||
params?: (string | number)[];
|
||||
};
|
||||
export type APIResponseObject<T extends any = any> = {
|
||||
export type APIResponseObject<T extends {
|
||||
[k: string]: any;
|
||||
} = {
|
||||
[k: string]: any;
|
||||
}> = {
|
||||
success: boolean;
|
||||
payload?: T;
|
||||
payload?: T[] | null;
|
||||
singleRes?: T | null;
|
||||
postInsertReturn?: PostInsertReturn | null;
|
||||
payloadBase64?: string;
|
||||
payloadThumbnailBase64?: string;
|
||||
payloadURL?: string;
|
||||
|
||||
+1
-1
@@ -99,7 +99,7 @@ function dsqlCrud(params) {
|
||||
}));
|
||||
return {
|
||||
success: Boolean(res.affectedRows),
|
||||
payload: res,
|
||||
postInsertReturn: res,
|
||||
queryObject: {
|
||||
sql: (0, sql_formatter_1.format)((deleteQuery === null || deleteQuery === void 0 ? void 0 : deleteQuery.query) || ""),
|
||||
params: (deleteQuery === null || deleteQuery === void 0 ? void 0 : deleteQuery.values) || [],
|
||||
|
||||
Reference in New Issue
Block a user