pg-manipulator 1.0.9 → 1.0.11

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.
@@ -35,7 +35,8 @@ class db {
35
35
  });
36
36
  }
37
37
  static get(db_name) {
38
- if (!db_name || typeof db_name != 'string' || !this.connections[db_name]) {
38
+ console.log(this.connections[db_name], db_name);
39
+ if (!db_name || typeof db_name !== 'string' || !this.connections[db_name]) {
39
40
  throw `Incorrectly reported database`;
40
41
  }
41
42
  return this.connections[db_name];
@@ -55,7 +55,7 @@ class create_factory {
55
55
  }
56
56
  prepare() {
57
57
  return __awaiter(this, void 0, void 0, function* () {
58
- const schema = (yield Promise.resolve(`${`../../mapping/${this.database}/${this.table}.js`}`).then(s => __importStar(require(s)))).default;
58
+ const schema = (yield Promise.resolve(`${`../../mapping/${this.database}/index.js`}`).then(s => __importStar(require(s)))).default[this.table];
59
59
  let data = {};
60
60
  for (let index in schema.columns) {
61
61
  let column = schema.columns[index];
@@ -59,7 +59,7 @@ class select_factory {
59
59
  this.params.push(param);
60
60
  return `$${this.params.length}`;
61
61
  }) {
62
- const schema = (yield Promise.resolve(`${`../../mapping/${database}/${table}.js`}`).then(s => __importStar(require(s)))).default;
62
+ const schema = (yield Promise.resolve(`${`../../mapping/${this.database}/index.js`}`).then(s => __importStar(require(s)))).default[this.table];
63
63
  if (children_name) {
64
64
  addQuery('(SELECT JSON_BUILD_OBJECT(');
65
65
  }
@@ -55,7 +55,7 @@ class update_factory {
55
55
  }
56
56
  prepare() {
57
57
  return __awaiter(this, void 0, void 0, function* () {
58
- const schema = (yield Promise.resolve(`${`../../mapping/${this.database}/${this.table}.js`}`).then(s => __importStar(require(s)))).default;
58
+ const schema = (yield Promise.resolve(`${`../../mapping/${this.database}/index.js`}`).then(s => __importStar(require(s)))).default[this.table];
59
59
  if (!this.fields.where) {
60
60
  throw 'Where field not provided';
61
61
  }
@@ -50,7 +50,7 @@ function where(database_1, table_1, fields_1, index_1, addQuery_1, addParam_1) {
50
50
  return __awaiter(this, arguments, void 0, function* (database, table, fields, index, addQuery, addParam, initialized_clausule = ' WHERE ') {
51
51
  initialized = initialized_clausule === ' WHERE ' ? false : true;
52
52
  position = index;
53
- const schema = (yield Promise.resolve(`${`../../mapping/${database}/${table}.js`}`).then(s => __importStar(require(s)))).default;
53
+ const schema = (yield Promise.resolve(`${`../../mapping/${database}/index.js`}`).then(s => __importStar(require(s)))).default[table];
54
54
  addQuery(initialized_clausule);
55
55
  for (let colum of schema.columns) {
56
56
  if (!fields || ['undefined', 'function'].indexOf(typeof fields[colum.name]) > -1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pg-manipulator",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "postgresql database handler",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",