scheduler-node-models 1.2.118 → 1.2.120

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/config/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export * from './logging';
2
- export * from './mariadb';
2
+ export * from './sqldb';
3
3
  export * from './mongoconnect';
4
4
  export * from './logPosting';
package/config/index.js CHANGED
@@ -15,6 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./logging"), exports);
18
- __exportStar(require("./mariadb"), exports);
18
+ __exportStar(require("./sqldb"), exports);
19
19
  __exportStar(require("./mongoconnect"), exports);
20
20
  __exportStar(require("./logPosting"), exports);
package/config/logging.js CHANGED
@@ -4,7 +4,7 @@ exports.logConnection = void 0;
4
4
  exports.createLogs = createLogs;
5
5
  exports.postLogEntry = postLogEntry;
6
6
  const general_1 = require("../general");
7
- const mariadb_1 = require("./mariadb");
7
+ const sqldb_1 = require("./sqldb");
8
8
  exports.logConnection = {};
9
9
  async function createLogs(application) {
10
10
  exports.logConnection.log = new general_1.Logger(`${process.env.LOG_DIR}/${application}/process_${(new Date().toDateString())}.log`);
@@ -16,9 +16,9 @@ async function postLogEntry(application, message) {
16
16
  let conn;
17
17
  let logEntry = new general_1.LogEntry();
18
18
  try {
19
- if (mariadb_1.mdbConnection.pool) {
19
+ if (sqldb_1.mdbConnection.pool) {
20
20
  // get a connection from the db.pool
21
- conn = await mariadb_1.mdbConnection.pool.getConnection();
21
+ conn = await sqldb_1.mdbConnection.pool.getConnection();
22
22
  const entryDate = new Date();
23
23
  // execute a query for notices for the user
24
24
  const insert = `INSERT INTO logentries VALUES ( ?, ?, ?)`;
@@ -0,0 +1,5 @@
1
+ import * as mariadb from 'mariadb';
2
+ export declare const mdbConnection: {
3
+ pool?: mariadb.Pool;
4
+ };
5
+ export declare function createPool(): Promise<void>;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.mdbConnection = void 0;
37
+ exports.createPool = createPool;
38
+ const mariadb = __importStar(require("mariadb"));
39
+ exports.mdbConnection = {};
40
+ async function createPool() {
41
+ exports.mdbConnection.pool = await mariadb.createPool({
42
+ host: process.env.MYSQL_SERVER,
43
+ port: (process.env.MYSQL_PORT) ? Number(process.env.MYSQL_PORT) : 3306,
44
+ user: process.env.MYSQL_USER,
45
+ password: process.env.MYSQL_PASSWORD,
46
+ database: 'scheduler',
47
+ connectionLimit: 5
48
+ });
49
+ console.log('Connected to mariadb');
50
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scheduler-node-models",
3
- "version": "1.2.118",
3
+ "version": "1.2.120",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "files": [