@faasjs/knex 0.0.3-beta.6 → 0.0.3-beta.61

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/README.md CHANGED
@@ -130,7 +130,7 @@ ___
130
130
 
131
131
  ### useKnex
132
132
 
133
- ▸ **useKnex**(`config?`): [`Knex`](classes/Knex.md) & `UseifyPlugin`
133
+ ▸ **useKnex**(`config?`): `UseifyPlugin`<[`Knex`](classes/Knex.md)\>
134
134
 
135
135
  #### Parameters
136
136
 
@@ -140,4 +140,4 @@ ___
140
140
 
141
141
  #### Returns
142
142
 
143
- [`Knex`](classes/Knex.md) & `UseifyPlugin`
143
+ `UseifyPlugin`<[`Knex`](classes/Knex.md)\>
package/dist/index.d.ts CHANGED
@@ -23,7 +23,7 @@ declare class Knex implements Plugin {
23
23
  schema(): Knex$1.SchemaBuilder;
24
24
  quit(): Promise<void>;
25
25
  }
26
- declare function useKnex(config?: KnexConfig): Knex & UseifyPlugin;
26
+ declare function useKnex(config?: KnexConfig): UseifyPlugin<Knex>;
27
27
  declare function query<TName extends Knex$1.TableNames>(table: TName): Knex$1.QueryBuilder<Knex$1.TableType<TName>, {
28
28
  _base: Knex$1.ResolveTableType<Knex$1.TableType<TName>, 'base'>;
29
29
  _hasSelection: false;
package/dist/index.js CHANGED
@@ -66,7 +66,7 @@ var Knex = class {
66
66
  await next();
67
67
  }
68
68
  async onMount(data, next) {
69
- var _a;
69
+ var _a, _b;
70
70
  this.logger = data.logger;
71
71
  if (global.FaasJS_Knex[this.name]) {
72
72
  this.config = global.FaasJS_Knex[this.name].config;
@@ -93,6 +93,17 @@ var Knex = class {
93
93
  this.config = (0, import_deep_merge.deepMerge)(data.config.plugins[this.name].config, this.config);
94
94
  if (this.config.client === "sqlite3")
95
95
  this.config.client = "better-sqlite3";
96
+ if (this.config.client === "pg" && typeof ((_b = this.config.pool) == null ? void 0 : _b.propagateCreateError) === "undefined") {
97
+ if (!this.config.pool)
98
+ this.config.pool = /* @__PURE__ */ Object.create(null);
99
+ this.config.pool = Object.assign({
100
+ propagateCreateError: false,
101
+ min: 0,
102
+ max: 10,
103
+ acquireTimeoutMillis: 5e3,
104
+ idleTimeoutMillis: 3e4
105
+ }, this.config.pool);
106
+ }
96
107
  this.adapter = (0, import_knex.default)(this.config);
97
108
  if (this.config.client === "pg") {
98
109
  const pg = require("pg");
package/dist/index.mjs CHANGED
@@ -42,7 +42,7 @@ var Knex = class {
42
42
  await next();
43
43
  }
44
44
  async onMount(data, next) {
45
- var _a;
45
+ var _a, _b;
46
46
  this.logger = data.logger;
47
47
  if (global.FaasJS_Knex[this.name]) {
48
48
  this.config = global.FaasJS_Knex[this.name].config;
@@ -69,6 +69,17 @@ var Knex = class {
69
69
  this.config = deepMerge(data.config.plugins[this.name].config, this.config);
70
70
  if (this.config.client === "sqlite3")
71
71
  this.config.client = "better-sqlite3";
72
+ if (this.config.client === "pg" && typeof ((_b = this.config.pool) == null ? void 0 : _b.propagateCreateError) === "undefined") {
73
+ if (!this.config.pool)
74
+ this.config.pool = /* @__PURE__ */ Object.create(null);
75
+ this.config.pool = Object.assign({
76
+ propagateCreateError: false,
77
+ min: 0,
78
+ max: 10,
79
+ acquireTimeoutMillis: 5e3,
80
+ idleTimeoutMillis: 3e4
81
+ }, this.config.pool);
82
+ }
72
83
  this.adapter = knex(this.config);
73
84
  if (this.config.client === "pg") {
74
85
  const pg = __require("pg");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/knex",
3
- "version": "0.0.3-beta.6",
3
+ "version": "0.0.3-beta.61",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,9 +22,9 @@
22
22
  "dist"
23
23
  ],
24
24
  "dependencies": {
25
- "@faasjs/deep_merge": "^0.0.3-beta.6",
26
- "@faasjs/func": "^0.0.3-beta.6",
27
- "@faasjs/logger": "^0.0.3-beta.6",
25
+ "@faasjs/deep_merge": "^0.0.3-beta.61",
26
+ "@faasjs/func": "^0.0.3-beta.61",
27
+ "@faasjs/logger": "^0.0.3-beta.61",
28
28
  "knex": "*"
29
29
  },
30
30
  "devDependencies": {