mielk-api 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/db/mssql/connection/pool.d.ts +2 -2
- package/dist/db/mssql/index.d.ts +2 -2
- package/dist/db/mssql/types/DbConfig.d.ts +2 -1
- package/dist/db/pg/connection/pool.d.ts +2 -2
- package/dist/db/pg/index.d.ts +2 -2
- package/dist/db/pg/types/DbConfig.d.ts +2 -1
- package/dist/express.d.ts +3 -1
- package/dist/express.js +10 -3
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RawData } from 'msnodesqlv8/types';
|
|
2
|
-
import {
|
|
3
|
-
export declare const initDb: (dbConfig:
|
|
2
|
+
import { MsSqlDbConfig } from '../types/DbConfig.js';
|
|
3
|
+
export declare const initDb: (dbConfig: MsSqlDbConfig) => void;
|
|
4
4
|
export declare const query: (queryText: string) => Promise<any[]>;
|
|
5
5
|
export declare const spExecute: (sqlText: string, params: MsNodeSqlV8.sqlQueryParamType[]) => Promise<RawData | undefined>;
|
package/dist/db/mssql/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Pool } from 'pg';
|
|
2
|
-
import {
|
|
3
|
-
export declare const initDb: (dbConfig:
|
|
2
|
+
import { PostgreDbConfig } from '../types/DbConfig.js';
|
|
3
|
+
export declare const initDb: (dbConfig: PostgreDbConfig) => void;
|
|
4
4
|
export declare function getPool(): Promise<Pool>;
|
package/dist/db/pg/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { POSTGRE_ERRORS } from './static/PostgreErrorCodes.js';
|
|
2
2
|
import { initDb, getPool } from './connection/pool.js';
|
|
3
|
-
import {
|
|
3
|
+
import { PostgreDbConfig } from './types/DbConfig.js';
|
|
4
4
|
export { POSTGRE_ERRORS };
|
|
5
5
|
export { initDb, getPool };
|
|
6
|
-
export {
|
|
6
|
+
export { PostgreDbConfig };
|
package/dist/express.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PostgreDbConfig } from './db/pg/index.js';
|
|
2
|
+
import { MsSqlDbConfig } from './db/mssql/index.js';
|
|
2
3
|
import { CorsConfig, RateLimitConfig } from './middlewares/index.js';
|
|
4
|
+
export type DbConfig = PostgreDbConfig | MsSqlDbConfig;
|
|
3
5
|
export declare const createExpressApp: (isProd: boolean, dbConfig: DbConfig, corsConfig: CorsConfig, rateLimitConfig?: RateLimitConfig) => import("express-serve-static-core").Express;
|
|
4
6
|
export declare const isProd: () => boolean;
|
package/dist/express.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
|
-
import { initDb } from './db/pg/index.js';
|
|
2
|
+
import { initDb as postgreInitDb } from './db/pg/index.js';
|
|
3
|
+
import { initDb as msSqlInitDb } from './db/mssql/index.js';
|
|
3
4
|
import { initCors, setRateLimit } from './middlewares/index.js';
|
|
4
5
|
const env = {
|
|
5
6
|
isProd: true
|
|
@@ -7,8 +8,14 @@ const env = {
|
|
|
7
8
|
export const createExpressApp = (isProd, dbConfig, corsConfig, rateLimitConfig) => {
|
|
8
9
|
const app = express();
|
|
9
10
|
env.isProd = isProd;
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
switch (dbConfig.provider) {
|
|
12
|
+
case 'mssql':
|
|
13
|
+
msSqlInitDb(dbConfig);
|
|
14
|
+
break;
|
|
15
|
+
case 'postgre':
|
|
16
|
+
postgreInitDb(dbConfig);
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
12
19
|
initCors(corsConfig);
|
|
13
20
|
setRateLimit(app, rateLimitConfig);
|
|
14
21
|
app.use(express.json());
|