@heyhru/business-dms-datasource
v0.8.3
Published
DMS data source domain logic: service, model, sql, pool management
Downloads
1,908
Readme
@heyhru/business-dms-datasource
DMS data source domain logic: service, model, sql, and connection pool management.
Exports
Route handlers
import {
datasourceList,
datasourceGet,
datasourceCreate,
datasourceDelete,
} from "@heyhru/business-dms-datasource";
// Direct handlers (no encryptionKey needed)
app.post("/datasources/list", datasourceList);
app.post("/datasources/get", datasourceGet);
app.post("/datasources/delete", datasourceDelete);
// Curried handlers (encryptionKey required)
app.post("/datasources/create", datasourceCreate(config.encryptionKey));
app.post("/datasources/update", datasourceUpdate(config.encryptionKey));Cross-module functions
import {
getDataSourceWithPassword,
getPool,
getPoolForDatabase,
} from "@heyhru/business-dms-datasource";
// Decrypt password and return full data source object
const ds = await getDataSourceWithPassword(dataSourceId, config.encryptionKey);
// Get or create a connection pool
const pool = getPool(ds);
// Get pool for a specific database within an instance
const pool = await getPoolForDatabase(dataSourceId, database, config.encryptionKey);Types
import type { DbPool, DataSourceWithPassword } from "@heyhru/business-dms-datasource";