Updates
This commit is contained in:
parent
b02399c64d
commit
d7cef41552
2
dist/engine/schema-to-typedef.js
vendored
2
dist/engine/schema-to-typedef.js
vendored
@ -108,7 +108,7 @@ if (!config.apiConnectionConfig.apiKey) {
|
|||||||
dbName: config.database || "",
|
dbName: config.database || "",
|
||||||
apiConnectionConfig: config.apiConnectionConfig,
|
apiConnectionConfig: config.apiConnectionConfig,
|
||||||
});
|
});
|
||||||
const dbSchema = schemaRes.payload;
|
const dbSchema = schemaRes.singleRes;
|
||||||
if (config.debug) {
|
if (config.debug) {
|
||||||
(0, debug_log_1.default)({
|
(0, debug_log_1.default)({
|
||||||
log: schemaRes,
|
log: schemaRes,
|
||||||
|
|||||||
2
dist/index.d.ts
vendored
2
dist/index.d.ts
vendored
@ -74,7 +74,7 @@ declare const datasquirel: {
|
|||||||
user: {
|
user: {
|
||||||
auth: {
|
auth: {
|
||||||
login: (_: import("./package-shared/types").LoginUserParam) => Promise<import("./package-shared/types").APIResponseObject>;
|
login: (_: import("./package-shared/types").LoginUserParam) => Promise<import("./package-shared/types").APIResponseObject>;
|
||||||
get: (_: import("./package-shared/types").GetUserParams) => Promise<import("./package-shared/types").GetUserFunctionReturn>;
|
get: (_: import("./package-shared/types").GetUserParams) => Promise<import("./package-shared/types").APIResponseObject>;
|
||||||
signup: (_: import("./package-shared/types").AddUserParams) => Promise<import("./package-shared/types").APIResponseObject>;
|
signup: (_: import("./package-shared/types").AddUserParams) => Promise<import("./package-shared/types").APIResponseObject>;
|
||||||
sendEmailCode: (_: import("./package-shared/types").SendEmailCodeParams) => 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").APIResponseObject>;
|
update: (_: import("./package-shared/types").UpdateUserParams) => Promise<import("./package-shared/types").APIResponseObject>;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { GetUserFunctionReturn, GetUserParams } from "../../types";
|
import { APIResponseObject, GetUserParams } from "../../types";
|
||||||
/**
|
/**
|
||||||
* # Get User
|
* # Get User
|
||||||
*/
|
*/
|
||||||
export default function getUser({ apiKey, userId, database, fields, useLocal, apiVersion, dbUserId, selectAll, }: GetUserParams): Promise<GetUserFunctionReturn>;
|
export default function getUser({ apiKey, userId, database, fields, useLocal, apiVersion, dbUserId, selectAll, }: GetUserParams): Promise<APIResponseObject>;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { APIResponseObject, DATASQUIREL_LoggedInUser, LoginUserParam } from "../../types";
|
import { APIResponseObject, LoginUserParam } from "../../types";
|
||||||
/**
|
/**
|
||||||
* # Login A user
|
* # 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>;
|
export default function loginUser({ 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
dist/package-shared/api/user/local-user.d.ts
vendored
2
dist/package-shared/api/user/local-user.d.ts
vendored
@ -5,7 +5,7 @@ import { AddUserParams, GetUserParams, GoogleAuthParams, LoginUserParam, ResetPa
|
|||||||
declare const localUser: {
|
declare const localUser: {
|
||||||
auth: {
|
auth: {
|
||||||
login: (_: LoginUserParam) => Promise<import("../../types").APIResponseObject>;
|
login: (_: LoginUserParam) => Promise<import("../../types").APIResponseObject>;
|
||||||
get: (_: GetUserParams) => Promise<import("../../types").GetUserFunctionReturn>;
|
get: (_: GetUserParams) => Promise<import("../../types").APIResponseObject>;
|
||||||
signup: (_: AddUserParams) => Promise<import("../../types").APIResponseObject>;
|
signup: (_: AddUserParams) => Promise<import("../../types").APIResponseObject>;
|
||||||
sendEmailCode: (_: SendEmailCodeParams) => Promise<import("../../types").APIResponseObject>;
|
sendEmailCode: (_: SendEmailCodeParams) => Promise<import("../../types").APIResponseObject>;
|
||||||
update: (_: UpdateUserParams) => Promise<import("../../types").APIResponseObject>;
|
update: (_: UpdateUserParams) => Promise<import("../../types").APIResponseObject>;
|
||||||
|
|||||||
@ -103,7 +103,7 @@ function queryDSQLAPI(_a) {
|
|||||||
response.on("error", (err) => {
|
response.on("error", (err) => {
|
||||||
resolve({
|
resolve({
|
||||||
success: false,
|
success: false,
|
||||||
payload: undefined,
|
singleRes: undefined,
|
||||||
msg: `An error occurred on the response`,
|
msg: `An error occurred on the response`,
|
||||||
error: err.message,
|
error: err.message,
|
||||||
errorData: { requestOptions, grabedHostNames },
|
errorData: { requestOptions, grabedHostNames },
|
||||||
@ -113,7 +113,7 @@ function queryDSQLAPI(_a) {
|
|||||||
httpsRequest.on("error", (err) => {
|
httpsRequest.on("error", (err) => {
|
||||||
resolve({
|
resolve({
|
||||||
success: false,
|
success: false,
|
||||||
payload: undefined,
|
singleRes: undefined,
|
||||||
msg: `An error occurred while making the request`,
|
msg: `An error occurred while making the request`,
|
||||||
error: err.message,
|
error: err.message,
|
||||||
errorData: {
|
errorData: {
|
||||||
@ -132,7 +132,7 @@ function queryDSQLAPI(_a) {
|
|||||||
catch (error) {
|
catch (error) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
payload: undefined,
|
singleRes: undefined,
|
||||||
msg: `Request Failed`,
|
msg: `Request Failed`,
|
||||||
error: error.message,
|
error: error.message,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { APIGetUserFunctionParams, GetUserFunctionReturn } from "../../../types";
|
import { APIGetUserFunctionParams, APIResponseObject } from "../../../types";
|
||||||
/**
|
/**
|
||||||
* # API Get User
|
* # API Get User
|
||||||
*/
|
*/
|
||||||
export default function apiGetUser({ fields, database, userId, dbUserId, selectAll, }: APIGetUserFunctionParams): Promise<GetUserFunctionReturn>;
|
export default function apiGetUser({ fields, database, userId, dbUserId, selectAll, }: APIGetUserFunctionParams): Promise<APIResponseObject>;
|
||||||
|
|||||||
@ -55,7 +55,7 @@ function addDbEntry(_a) {
|
|||||||
if ((duplicateValue === null || duplicateValue === void 0 ? void 0 : duplicateValue[0]) && !update) {
|
if ((duplicateValue === null || duplicateValue === void 0 ? void 0 : duplicateValue[0]) && !update) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
payload: undefined,
|
postInsertReturn: undefined,
|
||||||
msg: "Duplicate entry found",
|
msg: "Duplicate entry found",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -151,7 +151,7 @@ function addDbEntry(_a) {
|
|||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
success: Boolean(newInsert === null || newInsert === void 0 ? void 0 : newInsert.insertId),
|
success: Boolean(newInsert === null || newInsert === void 0 ? void 0 : newInsert.insertId),
|
||||||
payload: newInsert,
|
postInsertReturn: newInsert,
|
||||||
queryObject: {
|
queryObject: {
|
||||||
sql: query,
|
sql: query,
|
||||||
params: finalQueryValues,
|
params: finalQueryValues,
|
||||||
@ -190,7 +190,7 @@ function addDbEntry(_a) {
|
|||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
success: Boolean(newInsert === null || newInsert === void 0 ? void 0 : newInsert.insertId),
|
success: Boolean(newInsert === null || newInsert === void 0 ? void 0 : newInsert.insertId),
|
||||||
payload: newInsert,
|
postInsertReturn: newInsert,
|
||||||
queryObject: {
|
queryObject: {
|
||||||
sql: (0, sql_formatter_1.format)(query),
|
sql: (0, sql_formatter_1.format)(query),
|
||||||
params: finalQueryValues,
|
params: finalQueryValues,
|
||||||
@ -200,7 +200,7 @@ function addDbEntry(_a) {
|
|||||||
else {
|
else {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
payload: undefined,
|
postInsertReturn: undefined,
|
||||||
msg: "No data provided",
|
msg: "No data provided",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,7 @@ function updateDbEntry(_a) {
|
|||||||
if (!data || !Object.keys(data).length) {
|
if (!data || !Object.keys(data).length) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
payload: undefined,
|
postInsertReturn: undefined,
|
||||||
msg: "No data provided",
|
msg: "No data provided",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
4
dist/package-shared/types/dsql.d.ts
vendored
4
dist/package-shared/types/dsql.d.ts
vendored
@ -101,7 +101,7 @@ export type DSQL_DATASQUIREL_USER_DATABASES = {
|
|||||||
active_clone_parent_db?: string;
|
active_clone_parent_db?: string;
|
||||||
active_clone_parent_db_id?: number;
|
active_clone_parent_db_id?: number;
|
||||||
active_data?: number;
|
active_data?: number;
|
||||||
collation?: string;
|
collation?: "utf8mb4_bin" | "utf8mb4_unicode_520_ci";
|
||||||
last_checked_date_code?: number;
|
last_checked_date_code?: number;
|
||||||
date_created?: string;
|
date_created?: string;
|
||||||
date_created_code?: number;
|
date_created_code?: number;
|
||||||
@ -125,7 +125,7 @@ export type DSQL_DATASQUIREL_USER_DATABASE_TABLES = {
|
|||||||
child_table_parent_database_schema_id?: number;
|
child_table_parent_database_schema_id?: number;
|
||||||
child_table_parent_table_schema_id?: number;
|
child_table_parent_table_schema_id?: number;
|
||||||
active_data?: 0 | 1;
|
active_data?: 0 | 1;
|
||||||
collation?: string;
|
collation?: "utf8mb4_bin" | "utf8mb4_unicode_520_ci";
|
||||||
last_checked_date_code?: number;
|
last_checked_date_code?: number;
|
||||||
date_created?: string;
|
date_created?: string;
|
||||||
date_created_code?: number;
|
date_created_code?: number;
|
||||||
|
|||||||
2
dist/package-shared/types/index.d.ts
vendored
2
dist/package-shared/types/index.d.ts
vendored
@ -1452,6 +1452,8 @@ export type APIResponseObject<T extends {
|
|||||||
success: boolean;
|
success: boolean;
|
||||||
payload?: T[] | null;
|
payload?: T[] | null;
|
||||||
singleRes?: T | null;
|
singleRes?: T | null;
|
||||||
|
stringRes?: string | null;
|
||||||
|
numberRes?: number | null;
|
||||||
postInsertReturn?: PostInsertReturn | null;
|
postInsertReturn?: PostInsertReturn | null;
|
||||||
payloadBase64?: string;
|
payloadBase64?: string;
|
||||||
payloadThumbnailBase64?: string;
|
payloadThumbnailBase64?: string;
|
||||||
|
|||||||
@ -97,6 +97,13 @@ function default_1(_a) {
|
|||||||
return {
|
return {
|
||||||
success: isSuccess,
|
success: isSuccess,
|
||||||
payload: isSuccess ? (countOnly ? null : parsedRes) : null,
|
payload: isSuccess ? (countOnly ? null : parsedRes) : null,
|
||||||
|
singleRes: isSuccess
|
||||||
|
? countOnly
|
||||||
|
? null
|
||||||
|
: Array.isArray(parsedRes) && parsedRes.length == 1
|
||||||
|
? parsedRes[0]
|
||||||
|
: null
|
||||||
|
: null,
|
||||||
batchPayload: isSuccess ? (countOnly ? null : parsedBatchRes) : null,
|
batchPayload: isSuccess ? (countOnly ? null : parsedBatchRes) : null,
|
||||||
error: isSuccess
|
error: isSuccess
|
||||||
? undefined
|
? undefined
|
||||||
|
|||||||
@ -23,6 +23,7 @@ const sql_generator_1 = __importDefault(require("../../functions/dsql/sql/sql-ge
|
|||||||
const deleteDbEntry_1 = __importDefault(require("../../functions/backend/db/deleteDbEntry"));
|
const deleteDbEntry_1 = __importDefault(require("../../functions/backend/db/deleteDbEntry"));
|
||||||
function dsqlCrud(params) {
|
function dsqlCrud(params) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
var _a;
|
||||||
const { action, data, table, targetValue, sanitize, targetField, targetId, dbFullName, deleteData, batchData, deleteKeyValues, debug, tableSchema, deleteKeyValuesOperator, dbConfig, query, } = params;
|
const { action, data, table, targetValue, sanitize, targetField, targetId, dbFullName, deleteData, batchData, deleteKeyValues, debug, tableSchema, deleteKeyValuesOperator, dbConfig, query, } = params;
|
||||||
const finalData = (sanitize ? sanitize({ data }) : data);
|
const finalData = (sanitize ? sanitize({ data }) : data);
|
||||||
const finalBatchData = (sanitize ? sanitize({ batchData }) : batchData);
|
const finalBatchData = (sanitize ? sanitize({ batchData }) : batchData);
|
||||||
@ -33,7 +34,9 @@ function dsqlCrud(params) {
|
|||||||
dbFullName,
|
dbFullName,
|
||||||
})
|
})
|
||||||
: undefined;
|
: undefined;
|
||||||
const whereClause = queryObject === null || queryObject === void 0 ? void 0 : queryObject.string.replace(/^.*?( WHERE )/, "$1");
|
const whereClause = ((_a = queryObject === null || queryObject === void 0 ? void 0 : queryObject.string) === null || _a === void 0 ? void 0 : _a.match(/ WHERE /))
|
||||||
|
? queryObject.string.replace(/^.*?( WHERE )/, "$1")
|
||||||
|
: undefined;
|
||||||
const whereClauseObject = whereClause
|
const whereClauseObject = whereClause
|
||||||
? {
|
? {
|
||||||
clause: whereClause,
|
clause: whereClause,
|
||||||
|
|||||||
@ -6,7 +6,10 @@ import dbSchemaToType from "../package-shared/functions/dsql/db-schema-to-type";
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
import debugLog from "../package-shared/utils/logging/debug-log";
|
import debugLog from "../package-shared/utils/logging/debug-log";
|
||||||
import { AppNames } from "../package-shared/dict/app-names";
|
import { AppNames } from "../package-shared/dict/app-names";
|
||||||
import { APIConnectionOptions } from "../package-shared/types";
|
import {
|
||||||
|
APIConnectionOptions,
|
||||||
|
DSQL_DatabaseSchemaType,
|
||||||
|
} from "../package-shared/types";
|
||||||
|
|
||||||
type Config = {
|
type Config = {
|
||||||
database?: string;
|
database?: string;
|
||||||
@ -83,7 +86,9 @@ if (!config.apiConnectionConfig.apiKey) {
|
|||||||
apiConnectionConfig: config.apiConnectionConfig,
|
apiConnectionConfig: config.apiConnectionConfig,
|
||||||
});
|
});
|
||||||
|
|
||||||
const dbSchema = schemaRes.payload;
|
const dbSchema = schemaRes.singleRes as
|
||||||
|
| DSQL_DatabaseSchemaType
|
||||||
|
| undefined;
|
||||||
|
|
||||||
if (config.debug) {
|
if (config.debug) {
|
||||||
debugLog({
|
debugLog({
|
||||||
|
|||||||
@ -1,10 +1,8 @@
|
|||||||
import path from "path";
|
|
||||||
import fs from "fs";
|
|
||||||
import grabHostNames from "../../utils/grab-host-names";
|
import grabHostNames from "../../utils/grab-host-names";
|
||||||
import apiGetUser from "../../functions/api/users/api-get-user";
|
import apiGetUser from "../../functions/api/users/api-get-user";
|
||||||
import {
|
import {
|
||||||
APIGetUserFunctionParams,
|
APIGetUserFunctionParams,
|
||||||
GetUserFunctionReturn,
|
APIResponseObject,
|
||||||
GetUserParams,
|
GetUserParams,
|
||||||
} from "../../types";
|
} from "../../types";
|
||||||
import grabUserDSQLAPIPath from "../../utils/backend/users/grab-api-path";
|
import grabUserDSQLAPIPath from "../../utils/backend/users/grab-api-path";
|
||||||
@ -21,7 +19,7 @@ export default async function getUser({
|
|||||||
apiVersion = "v1",
|
apiVersion = "v1",
|
||||||
dbUserId,
|
dbUserId,
|
||||||
selectAll,
|
selectAll,
|
||||||
}: GetUserParams): Promise<GetUserFunctionReturn> {
|
}: GetUserParams): Promise<APIResponseObject> {
|
||||||
/**
|
/**
|
||||||
* Initialize
|
* Initialize
|
||||||
*/
|
*/
|
||||||
@ -119,5 +117,5 @@ export default async function getUser({
|
|||||||
httpsRequest.end();
|
httpsRequest.end();
|
||||||
});
|
});
|
||||||
|
|
||||||
return httpResponse as GetUserFunctionReturn;
|
return httpResponse as APIResponseObject;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,7 @@
|
|||||||
import encrypt from "../../functions/dsql/encrypt";
|
|
||||||
import apiLoginUser from "../../functions/api/users/api-login";
|
import apiLoginUser from "../../functions/api/users/api-login";
|
||||||
import getAuthCookieNames from "../../functions/backend/cookies/get-auth-cookie-names";
|
|
||||||
import { writeAuthFile } from "../../functions/backend/auth/write-auth-files";
|
|
||||||
import {
|
import {
|
||||||
APILoginFunctionParams,
|
APILoginFunctionParams,
|
||||||
APIResponseObject,
|
APIResponseObject,
|
||||||
DATASQUIREL_LoggedInUser,
|
|
||||||
LoginUserParam,
|
LoginUserParam,
|
||||||
} from "../../types";
|
} from "../../types";
|
||||||
import debugLog from "../../utils/logging/debug-log";
|
import debugLog from "../../utils/logging/debug-log";
|
||||||
@ -21,9 +17,7 @@ function debugFn(log: any, label?: string) {
|
|||||||
/**
|
/**
|
||||||
* # Login A user
|
* # Login A user
|
||||||
*/
|
*/
|
||||||
export default async function loginUser<
|
export default async function loginUser({
|
||||||
T extends DATASQUIREL_LoggedInUser = DATASQUIREL_LoggedInUser
|
|
||||||
>({
|
|
||||||
apiKey,
|
apiKey,
|
||||||
payload,
|
payload,
|
||||||
database,
|
database,
|
||||||
|
|||||||
@ -137,7 +137,7 @@ export default async function queryDSQLAPI<T = { [k: string]: any }>({
|
|||||||
response.on("error", (err) => {
|
response.on("error", (err) => {
|
||||||
resolve({
|
resolve({
|
||||||
success: false,
|
success: false,
|
||||||
payload: undefined,
|
singleRes: undefined,
|
||||||
msg: `An error occurred on the response`,
|
msg: `An error occurred on the response`,
|
||||||
error: err.message,
|
error: err.message,
|
||||||
errorData: { requestOptions, grabedHostNames },
|
errorData: { requestOptions, grabedHostNames },
|
||||||
@ -149,7 +149,7 @@ export default async function queryDSQLAPI<T = { [k: string]: any }>({
|
|||||||
httpsRequest.on("error", (err) => {
|
httpsRequest.on("error", (err) => {
|
||||||
resolve({
|
resolve({
|
||||||
success: false,
|
success: false,
|
||||||
payload: undefined,
|
singleRes: undefined,
|
||||||
msg: `An error occurred while making the request`,
|
msg: `An error occurred while making the request`,
|
||||||
error: err.message,
|
error: err.message,
|
||||||
errorData: {
|
errorData: {
|
||||||
@ -169,7 +169,7 @@ export default async function queryDSQLAPI<T = { [k: string]: any }>({
|
|||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
payload: undefined,
|
singleRes: undefined,
|
||||||
msg: `Request Failed`,
|
msg: `Request Failed`,
|
||||||
error: error.message,
|
error: error.message,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,7 +1,4 @@
|
|||||||
import {
|
import { APIGetUserFunctionParams, APIResponseObject } from "../../../types";
|
||||||
APIGetUserFunctionParams,
|
|
||||||
GetUserFunctionReturn,
|
|
||||||
} from "../../../types";
|
|
||||||
import grabDbFullName from "../../../utils/grab-db-full-name";
|
import grabDbFullName from "../../../utils/grab-db-full-name";
|
||||||
import dbHandler from "../../backend/dbHandler";
|
import dbHandler from "../../backend/dbHandler";
|
||||||
|
|
||||||
@ -14,7 +11,7 @@ export default async function apiGetUser({
|
|||||||
userId,
|
userId,
|
||||||
dbUserId,
|
dbUserId,
|
||||||
selectAll,
|
selectAll,
|
||||||
}: APIGetUserFunctionParams): Promise<GetUserFunctionReturn> {
|
}: APIGetUserFunctionParams): Promise<APIResponseObject> {
|
||||||
const finalDbName = grabDbFullName({ dbName: database, userId: dbUserId });
|
const finalDbName = grabDbFullName({ dbName: database, userId: dbUserId });
|
||||||
|
|
||||||
const selectFields = selectAll ? "*" : fields?.[0] ? fields.join(",") : "*";
|
const selectFields = selectAll ? "*" : fields?.[0] ? fields.join(",") : "*";
|
||||||
|
|||||||
@ -101,7 +101,7 @@ export default async function addDbEntry<
|
|||||||
if (duplicateValue?.[0] && !update) {
|
if (duplicateValue?.[0] && !update) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
payload: undefined,
|
postInsertReturn: undefined,
|
||||||
msg: "Duplicate entry found",
|
msg: "Duplicate entry found",
|
||||||
};
|
};
|
||||||
} else if (duplicateValue?.[0] && update) {
|
} else if (duplicateValue?.[0] && update) {
|
||||||
@ -222,7 +222,7 @@ export default async function addDbEntry<
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
success: Boolean(newInsert?.insertId),
|
success: Boolean(newInsert?.insertId),
|
||||||
payload: newInsert,
|
postInsertReturn: newInsert,
|
||||||
queryObject: {
|
queryObject: {
|
||||||
sql: query,
|
sql: query,
|
||||||
params: finalQueryValues,
|
params: finalQueryValues,
|
||||||
@ -275,7 +275,7 @@ export default async function addDbEntry<
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
success: Boolean(newInsert?.insertId),
|
success: Boolean(newInsert?.insertId),
|
||||||
payload: newInsert,
|
postInsertReturn: newInsert,
|
||||||
queryObject: {
|
queryObject: {
|
||||||
sql: format(query),
|
sql: format(query),
|
||||||
params: finalQueryValues,
|
params: finalQueryValues,
|
||||||
@ -284,7 +284,7 @@ export default async function addDbEntry<
|
|||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
payload: undefined,
|
postInsertReturn: undefined,
|
||||||
msg: "No data provided",
|
msg: "No data provided",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -56,7 +56,7 @@ export default async function updateDbEntry<
|
|||||||
if (!data || !Object.keys(data).length) {
|
if (!data || !Object.keys(data).length) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
payload: undefined,
|
postInsertReturn: undefined,
|
||||||
msg: "No data provided",
|
msg: "No data provided",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -128,7 +128,7 @@ export type DSQL_DATASQUIREL_USER_DATABASES = {
|
|||||||
active_clone_parent_db?: string;
|
active_clone_parent_db?: string;
|
||||||
active_clone_parent_db_id?: number;
|
active_clone_parent_db_id?: number;
|
||||||
active_data?: number;
|
active_data?: number;
|
||||||
collation?: string;
|
collation?: "utf8mb4_bin" | "utf8mb4_unicode_520_ci";
|
||||||
last_checked_date_code?: number;
|
last_checked_date_code?: number;
|
||||||
date_created?: string;
|
date_created?: string;
|
||||||
date_created_code?: number;
|
date_created_code?: number;
|
||||||
@ -153,7 +153,7 @@ export type DSQL_DATASQUIREL_USER_DATABASE_TABLES = {
|
|||||||
child_table_parent_database_schema_id?: number;
|
child_table_parent_database_schema_id?: number;
|
||||||
child_table_parent_table_schema_id?: number;
|
child_table_parent_table_schema_id?: number;
|
||||||
active_data?: 0 | 1;
|
active_data?: 0 | 1;
|
||||||
collation?: string;
|
collation?: "utf8mb4_bin" | "utf8mb4_unicode_520_ci";
|
||||||
last_checked_date_code?: number;
|
last_checked_date_code?: number;
|
||||||
date_created?: string;
|
date_created?: string;
|
||||||
date_created_code?: number;
|
date_created_code?: number;
|
||||||
|
|||||||
@ -1687,6 +1687,8 @@ export type APIResponseObject<
|
|||||||
success: boolean;
|
success: boolean;
|
||||||
payload?: T[] | null;
|
payload?: T[] | null;
|
||||||
singleRes?: T | null;
|
singleRes?: T | null;
|
||||||
|
stringRes?: string | null;
|
||||||
|
numberRes?: number | null;
|
||||||
postInsertReturn?: PostInsertReturn | null;
|
postInsertReturn?: PostInsertReturn | null;
|
||||||
payloadBase64?: string;
|
payloadBase64?: string;
|
||||||
payloadThumbnailBase64?: string;
|
payloadThumbnailBase64?: string;
|
||||||
|
|||||||
@ -125,6 +125,13 @@ export default async function <
|
|||||||
return {
|
return {
|
||||||
success: isSuccess,
|
success: isSuccess,
|
||||||
payload: isSuccess ? (countOnly ? null : parsedRes) : null,
|
payload: isSuccess ? (countOnly ? null : parsedRes) : null,
|
||||||
|
singleRes: isSuccess
|
||||||
|
? countOnly
|
||||||
|
? null
|
||||||
|
: Array.isArray(parsedRes) && parsedRes.length == 1
|
||||||
|
? parsedRes[0]
|
||||||
|
: null
|
||||||
|
: null,
|
||||||
batchPayload: isSuccess ? (countOnly ? null : parsedBatchRes) : null,
|
batchPayload: isSuccess ? (countOnly ? null : parsedBatchRes) : null,
|
||||||
error: isSuccess
|
error: isSuccess
|
||||||
? undefined
|
? undefined
|
||||||
|
|||||||
@ -48,7 +48,9 @@ export default async function dsqlCrud<
|
|||||||
})
|
})
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
const whereClause = queryObject?.string.replace(/^.*?( WHERE )/, "$1");
|
const whereClause = queryObject?.string?.match(/ WHERE /)
|
||||||
|
? queryObject.string.replace(/^.*?( WHERE )/, "$1")
|
||||||
|
: undefined;
|
||||||
|
|
||||||
const whereClauseObject = whereClause
|
const whereClauseObject = whereClause
|
||||||
? {
|
? {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@moduletrace/datasquirel",
|
"name": "@moduletrace/datasquirel",
|
||||||
"version": "5.5.8",
|
"version": "5.5.9",
|
||||||
"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