@faasjs/knex 3.1.1 → 3.1.3

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/index.js CHANGED
@@ -58,9 +58,9 @@ var Knex = class {
58
58
  this.config.connection[key.replace("connection_", "")] = value;
59
59
  } else this.config[key] = value;
60
60
  }
61
- if (data.config.plugins?.[this.name]?.config)
61
+ if (data.config.plugins?.[this.name || this.type]?.config)
62
62
  this.config = deep_merge.deepMerge(
63
- data.config.plugins[this.name].config,
63
+ data.config.plugins[this.name || this.type].config,
64
64
  this.config
65
65
  );
66
66
  switch (this.config.client) {
@@ -96,13 +96,11 @@ var Knex = class {
96
96
  this.config.client = client.default;
97
97
  break;
98
98
  }
99
- console.log(client);
100
99
  throw Error(`Invalid client: ${this.config.client}`);
101
100
  }
102
101
  }
103
102
  break;
104
103
  }
105
- console.log(this.config);
106
104
  this.adapter = knex__default.default(this.config);
107
105
  if (this.config.client === "pg") {
108
106
  const pg = __require("pg");
@@ -193,6 +191,7 @@ var Knex = class {
193
191
  return this.adapter.schema;
194
192
  }
195
193
  async quit() {
194
+ if (!global.FaasJS_Knex[this.name]) return;
196
195
  try {
197
196
  await global.FaasJS_Knex[this.name].adapter.destroy();
198
197
  delete global.FaasJS_Knex[this.name];
package/dist/index.mjs CHANGED
@@ -52,9 +52,9 @@ var Knex = class {
52
52
  this.config.connection[key.replace("connection_", "")] = value;
53
53
  } else this.config[key] = value;
54
54
  }
55
- if (data.config.plugins?.[this.name]?.config)
55
+ if (data.config.plugins?.[this.name || this.type]?.config)
56
56
  this.config = deepMerge(
57
- data.config.plugins[this.name].config,
57
+ data.config.plugins[this.name || this.type].config,
58
58
  this.config
59
59
  );
60
60
  switch (this.config.client) {
@@ -90,13 +90,11 @@ var Knex = class {
90
90
  this.config.client = client.default;
91
91
  break;
92
92
  }
93
- console.log(client);
94
93
  throw Error(`Invalid client: ${this.config.client}`);
95
94
  }
96
95
  }
97
96
  break;
98
97
  }
99
- console.log(this.config);
100
98
  this.adapter = knex(this.config);
101
99
  if (this.config.client === "pg") {
102
100
  const pg = __require("pg");
@@ -187,6 +185,7 @@ var Knex = class {
187
185
  return this.adapter.schema;
188
186
  }
189
187
  async quit() {
188
+ if (!global.FaasJS_Knex[this.name]) return;
190
189
  try {
191
190
  await global.FaasJS_Knex[this.name].adapter.destroy();
192
191
  delete global.FaasJS_Knex[this.name];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/knex",
3
- "version": "3.1.1",
3
+ "version": "3.1.3",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -34,9 +34,9 @@
34
34
  "dist"
35
35
  ],
36
36
  "dependencies": {
37
- "@faasjs/deep_merge": "3.1.1",
38
- "@faasjs/func": "3.1.1",
39
- "@faasjs/logger": "3.1.1"
37
+ "@faasjs/deep_merge": "3.1.3",
38
+ "@faasjs/func": "3.1.3",
39
+ "@faasjs/logger": "3.1.3"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "knex": "*"