@faasjs/knex 0.0.2-beta.394 → 0.0.2-beta.397

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
@@ -15,7 +15,7 @@ FaasJS's sql plugin, base on [Knex](https://knexjs.org/).
15
15
 
16
16
  - [Knex](classes/Knex.md)
17
17
 
18
- ### Type aliases
18
+ ### Type Aliases
19
19
 
20
20
  - [KnexConfig](#knexconfig)
21
21
 
@@ -26,7 +26,7 @@ FaasJS's sql plugin, base on [Knex](https://knexjs.org/).
26
26
  - [transaction](#transaction)
27
27
  - [useKnex](#useknex)
28
28
 
29
- ## Type aliases
29
+ ## Type Aliases
30
30
 
31
31
  ### KnexConfig
32
32
 
@@ -43,7 +43,7 @@ FaasJS's sql plugin, base on [Knex](https://knexjs.org/).
43
43
 
44
44
  ### query
45
45
 
46
- ▸ **query**<`TName`\>(`table`): `QueryBuilder`<`TableType`<`TName`\>, `DeferredKeySelection`<`ResolveTableType`<`TableType`<`TName`\>, ``"base"``\>, `never`, ``false``, {}, ``false``, {}, `never`\>[]\>
46
+ ▸ **query**<`TName`\>(`table`): `QueryBuilder`<`any`, `DeferredKeySelection`<`any`, `never`, ``false``, {}, ``false``, {}, `never`\>[]\>
47
47
 
48
48
  #### Type parameters
49
49
 
@@ -55,11 +55,11 @@ FaasJS's sql plugin, base on [Knex](https://knexjs.org/).
55
55
 
56
56
  | Name | Type |
57
57
  | :------ | :------ |
58
- | `table` | `TName` |
58
+ | `table` | `string` \| `TName` |
59
59
 
60
60
  #### Returns
61
61
 
62
- `QueryBuilder`<`TableType`<`TName`\>, `DeferredKeySelection`<`ResolveTableType`<`TableType`<`TName`\>, ``"base"``\>, `never`, ``false``, {}, ``false``, {}, `never`\>[]\>
62
+ `QueryBuilder`<`any`, `DeferredKeySelection`<`any`, `never`, ``false``, {}, ``false``, {}, `never`\>[]\>
63
63
 
64
64
  ___
65
65
 
@@ -78,7 +78,7 @@ ___
78
78
  | Name | Type | Default value |
79
79
  | :------ | :------ | :------ |
80
80
  | `sql` | `string` | `undefined` |
81
- | `bindings` | `RawBinding`[] \| `ValueDict` | `[]` |
81
+ | `bindings` | `ValueDict` \| `RawBinding`[] | `[]` |
82
82
 
83
83
  #### Returns
84
84
 
package/dist/index.d.ts CHANGED
@@ -31,8 +31,8 @@ declare class Knex implements Plugin {
31
31
  quit(): Promise<void>;
32
32
  }
33
33
  declare function useKnex(config?: KnexConfig): Knex & UseifyPlugin;
34
- declare function query<TName extends Knex$1.TableNames>(table: TName): Knex$1.QueryBuilder<Knex$1.TableType<TName>, {
35
- _base: Knex$1.ResolveTableType<Knex$1.TableType<TName>, "base">;
34
+ declare function query<TName extends Knex$1.TableNames>(table: TName | string): Knex$1.QueryBuilder<any, {
35
+ _base: any;
36
36
  _hasSelection: false;
37
37
  _keys: never;
38
38
  _aliases: {};
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -16,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
16
17
  }
17
18
  return to;
18
19
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
20
24
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
25
 
22
26
  // src/index.ts
@@ -97,13 +101,19 @@ var Knex = class {
97
101
  "INT4",
98
102
  "INT8"
99
103
  ];
100
- intTypes.forEach((t) => pg.types.setTypeParser(pg.types.builtins[t], (v) => parseInt(v)));
104
+ intTypes.forEach((t) => pg.types.setTypeParser(
105
+ pg.types.builtins[t],
106
+ (v) => parseInt(v)
107
+ ));
101
108
  const floatTypes = [
102
109
  "FLOAT4",
103
110
  "FLOAT8",
104
111
  "NUMERIC"
105
112
  ];
106
- floatTypes.forEach((t) => pg.types.setTypeParser(pg.types.builtins[t], (v) => parseFloat(v)));
113
+ floatTypes.forEach((t) => pg.types.setTypeParser(
114
+ pg.types.builtins[t],
115
+ (v) => parseFloat(v)
116
+ ));
107
117
  }
108
118
  this.adapter.on("query", ({
109
119
  sql,
@@ -132,17 +142,17 @@ var Knex = class {
132
142
  }
133
143
  async raw(sql, bindings = []) {
134
144
  if (!this.adapter)
135
- throw Error("[Knex] Client not inited.");
145
+ throw Error("[Knex] Client not initialized.");
136
146
  return this.adapter.raw(sql, bindings);
137
147
  }
138
148
  async transaction(scope, config) {
139
149
  if (!this.adapter)
140
- throw Error("[Knex] Client not inited.");
150
+ throw Error("[Knex] Client not initialized.");
141
151
  return this.adapter.transaction(scope, config);
142
152
  }
143
153
  schema() {
144
154
  if (!this.adapter)
145
- throw Error("[Knex] Client not inited.");
155
+ throw Error("[Knex] Client not initialized.");
146
156
  return this.adapter.schema;
147
157
  }
148
158
  async quit() {
package/dist/index.mjs CHANGED
@@ -77,13 +77,19 @@ var Knex = class {
77
77
  "INT4",
78
78
  "INT8"
79
79
  ];
80
- intTypes.forEach((t) => pg.types.setTypeParser(pg.types.builtins[t], (v) => parseInt(v)));
80
+ intTypes.forEach((t) => pg.types.setTypeParser(
81
+ pg.types.builtins[t],
82
+ (v) => parseInt(v)
83
+ ));
81
84
  const floatTypes = [
82
85
  "FLOAT4",
83
86
  "FLOAT8",
84
87
  "NUMERIC"
85
88
  ];
86
- floatTypes.forEach((t) => pg.types.setTypeParser(pg.types.builtins[t], (v) => parseFloat(v)));
89
+ floatTypes.forEach((t) => pg.types.setTypeParser(
90
+ pg.types.builtins[t],
91
+ (v) => parseFloat(v)
92
+ ));
87
93
  }
88
94
  this.adapter.on("query", ({
89
95
  sql,
@@ -112,17 +118,17 @@ var Knex = class {
112
118
  }
113
119
  async raw(sql, bindings = []) {
114
120
  if (!this.adapter)
115
- throw Error("[Knex] Client not inited.");
121
+ throw Error("[Knex] Client not initialized.");
116
122
  return this.adapter.raw(sql, bindings);
117
123
  }
118
124
  async transaction(scope, config) {
119
125
  if (!this.adapter)
120
- throw Error("[Knex] Client not inited.");
126
+ throw Error("[Knex] Client not initialized.");
121
127
  return this.adapter.transaction(scope, config);
122
128
  }
123
129
  schema() {
124
130
  if (!this.adapter)
125
- throw Error("[Knex] Client not inited.");
131
+ throw Error("[Knex] Client not initialized.");
126
132
  return this.adapter.schema;
127
133
  }
128
134
  async quit() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/knex",
3
- "version": "0.0.2-beta.394",
3
+ "version": "0.0.2-beta.397",
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
  "peerDependencies": {
25
- "@faasjs/deep_merge": "^0.0.2-beta.394",
26
- "@faasjs/func": "^0.0.2-beta.394",
27
- "@faasjs/logger": "^0.0.2-beta.394",
25
+ "@faasjs/deep_merge": "^0.0.2-beta.397",
26
+ "@faasjs/func": "^0.0.2-beta.397",
27
+ "@faasjs/logger": "^0.0.2-beta.397",
28
28
  "knex": "*"
29
29
  },
30
30
  "devDependencies": {