Updates
This commit is contained in:
parent
fcc668d3a1
commit
3597b11342
@ -13,6 +13,7 @@ type Param<T extends {
|
||||
identifierColumnName: keyof T;
|
||||
identifierValue: string | number;
|
||||
forceLocal?: boolean;
|
||||
debug?: boolean;
|
||||
};
|
||||
/**
|
||||
* # Update DB Function
|
||||
@ -20,5 +21,5 @@ type Param<T extends {
|
||||
*/
|
||||
export default function updateDbEntry<T extends {
|
||||
[k: string]: any;
|
||||
} = any>({ dbContext, dbFullName, tableName, data, tableSchema, identifierColumnName, identifierValue, encryptionKey, encryptionSalt, forceLocal, }: Param<T>): Promise<APIResponseObject<PostInsertReturn>>;
|
||||
} = any>({ dbContext, dbFullName, tableName, data, tableSchema, identifierColumnName, identifierValue, encryptionKey, encryptionSalt, forceLocal, debug, }: Param<T>): Promise<APIResponseObject<PostInsertReturn>>;
|
||||
export {};
|
||||
|
@ -25,7 +25,7 @@ const purge_default_fields_1 = __importDefault(require("../../../utils/purge-def
|
||||
* @description
|
||||
*/
|
||||
function updateDbEntry(_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ dbContext, dbFullName, tableName, data, tableSchema, identifierColumnName, identifierValue, encryptionKey, encryptionSalt, forceLocal, }) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ dbContext, dbFullName, tableName, data, tableSchema, identifierColumnName, identifierValue, encryptionKey, encryptionSalt, forceLocal, debug, }) {
|
||||
var _b;
|
||||
/**
|
||||
* Check if data is valid
|
||||
@ -139,6 +139,7 @@ function updateDbEntry(_a) {
|
||||
sql: query,
|
||||
params: updateValues,
|
||||
},
|
||||
debug: debug ? { data, newData } : undefined,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ const addDbEntry_1 = __importDefault(require("../../functions/backend/db/addDbEn
|
||||
const updateDbEntry_1 = __importDefault(require("../../functions/backend/db/updateDbEntry"));
|
||||
function dsqlCrud(params) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { action, data, table, targetValue, sanitize, targetField, targetId, dbFullName, deleteData, batchData, deleteKeyValues, } = params;
|
||||
const { action, data, table, targetValue, sanitize, targetField, targetId, dbFullName, deleteData, batchData, deleteKeyValues, debug, } = params;
|
||||
const finalData = (sanitize ? sanitize({ data }) : data);
|
||||
const finalBatchData = (sanitize ? sanitize({ batchData }) : batchData);
|
||||
const DB_CONN = global.DSQL_READ_ONLY_DB_CONN || global.DSQL_DB_CONN;
|
||||
@ -35,6 +35,7 @@ function dsqlCrud(params) {
|
||||
batchData: finalBatchData,
|
||||
tableName: table,
|
||||
dbFullName,
|
||||
debug,
|
||||
});
|
||||
return INSERT_RESULT;
|
||||
case "update":
|
||||
@ -45,6 +46,7 @@ function dsqlCrud(params) {
|
||||
dbFullName,
|
||||
identifierColumnName: (targetField || "id"),
|
||||
identifierValue: String(targetValue || targetId),
|
||||
debug,
|
||||
});
|
||||
return UPDATE_RESULT;
|
||||
case "delete":
|
||||
|
@ -14,10 +14,13 @@ function setupGlobalNetwork() {
|
||||
(0, child_process_1.execSync)(`docker network rm ${globalNetworkName}`, {});
|
||||
}
|
||||
catch (error) { }
|
||||
let newNtwkCmd = `docker network create`;
|
||||
newNtwkCmd += ` --driver bridge`;
|
||||
newNtwkCmd += ` --subnet ${globalIPPrefix}.0/24`;
|
||||
newNtwkCmd += ` --gateway ${globalIPPrefix}.1`;
|
||||
newNtwkCmd += ` ${globalNetworkName}`;
|
||||
(0, child_process_1.execSync)(newNtwkCmd);
|
||||
try {
|
||||
let newNtwkCmd = `docker network create`;
|
||||
newNtwkCmd += ` --driver bridge`;
|
||||
newNtwkCmd += ` --subnet ${globalIPPrefix}.0/24`;
|
||||
newNtwkCmd += ` --gateway ${globalIPPrefix}.1`;
|
||||
newNtwkCmd += ` ${globalNetworkName}`;
|
||||
(0, child_process_1.execSync)(newNtwkCmd);
|
||||
}
|
||||
catch (error) { }
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ type Param<T extends { [k: string]: any } = any> = {
|
||||
identifierColumnName: keyof T;
|
||||
identifierValue: string | number;
|
||||
forceLocal?: boolean;
|
||||
debug?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -42,6 +43,7 @@ export default async function updateDbEntry<
|
||||
encryptionKey,
|
||||
encryptionSalt,
|
||||
forceLocal,
|
||||
debug,
|
||||
}: Param<T>): Promise<APIResponseObject<PostInsertReturn>> {
|
||||
/**
|
||||
* Check if data is valid
|
||||
@ -192,5 +194,6 @@ export default async function updateDbEntry<
|
||||
sql: query,
|
||||
params: updateValues,
|
||||
},
|
||||
debug: debug ? { data, newData } : undefined,
|
||||
};
|
||||
}
|
||||
|
@ -1,11 +1,8 @@
|
||||
import sqlDeleteGenerator from "../../functions/dsql/sql/sql-delete-generator";
|
||||
import sqlGenerator from "../../functions/dsql/sql/sql-generator";
|
||||
import {
|
||||
APIResponseObject,
|
||||
DsqlCrudParam,
|
||||
DSQLErrorObject,
|
||||
PostInsertReturn,
|
||||
PostReturn,
|
||||
} from "../../types";
|
||||
import dsqlCrudGet from "./crud-get";
|
||||
import connDbHandler from "../db/conn-db-handler";
|
||||
@ -28,7 +25,9 @@ export default async function dsqlCrud<
|
||||
deleteData,
|
||||
batchData,
|
||||
deleteKeyValues,
|
||||
debug,
|
||||
} = params;
|
||||
|
||||
const finalData = (sanitize ? sanitize({ data }) : data) as T;
|
||||
const finalBatchData = (
|
||||
sanitize ? sanitize({ batchData }) : batchData
|
||||
@ -49,6 +48,7 @@ export default async function dsqlCrud<
|
||||
batchData: finalBatchData,
|
||||
tableName: table,
|
||||
dbFullName,
|
||||
debug,
|
||||
});
|
||||
return INSERT_RESULT;
|
||||
|
||||
@ -61,6 +61,7 @@ export default async function dsqlCrud<
|
||||
dbFullName,
|
||||
identifierColumnName: (targetField || "id") as string,
|
||||
identifierValue: String(targetValue || targetId),
|
||||
debug,
|
||||
});
|
||||
|
||||
return UPDATE_RESULT;
|
||||
|
@ -10,11 +10,13 @@ export default function setupGlobalNetwork() {
|
||||
execSync(`docker network rm ${globalNetworkName}`, {});
|
||||
} catch (error) {}
|
||||
|
||||
let newNtwkCmd = `docker network create`;
|
||||
newNtwkCmd += ` --driver bridge`;
|
||||
newNtwkCmd += ` --subnet ${globalIPPrefix}.0/24`;
|
||||
newNtwkCmd += ` --gateway ${globalIPPrefix}.1`;
|
||||
newNtwkCmd += ` ${globalNetworkName}`;
|
||||
try {
|
||||
let newNtwkCmd = `docker network create`;
|
||||
newNtwkCmd += ` --driver bridge`;
|
||||
newNtwkCmd += ` --subnet ${globalIPPrefix}.0/24`;
|
||||
newNtwkCmd += ` --gateway ${globalIPPrefix}.1`;
|
||||
newNtwkCmd += ` ${globalNetworkName}`;
|
||||
|
||||
execSync(newNtwkCmd);
|
||||
execSync(newNtwkCmd);
|
||||
} catch (error) {}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@moduletrace/datasquirel",
|
||||
"version": "4.8.5",
|
||||
"version": "4.8.6",
|
||||
"description": "Cloud-based SQL data management tool",
|
||||
"main": "dist/index.js",
|
||||
"bin": {
|
||||
|
Loading…
Reference in New Issue
Block a user