@platformatic/sql-mapper 0.47.6 → 1.1.0
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/mapper.d.ts +27 -7
- package/package.json +6 -6
package/mapper.d.ts
CHANGED
|
@@ -32,7 +32,11 @@ export interface Database {
|
|
|
32
32
|
/**
|
|
33
33
|
* Dispose the connection. Once this is called, any subsequent queries will fail.
|
|
34
34
|
*/
|
|
35
|
-
dispose(): Promise<void
|
|
35
|
+
dispose(): Promise<void>,
|
|
36
|
+
/**
|
|
37
|
+
* Begin new transaction
|
|
38
|
+
*/
|
|
39
|
+
tx<T = any>(fn: (tx: Database) => Promise<T>, options?: any): Promise<T>
|
|
36
40
|
}
|
|
37
41
|
|
|
38
42
|
export interface DBEntityField {
|
|
@@ -150,8 +154,8 @@ interface Find<EntityFields> {
|
|
|
150
154
|
*/
|
|
151
155
|
offset?: number,
|
|
152
156
|
/**
|
|
153
|
-
* If present, the entity
|
|
154
|
-
|
|
157
|
+
* If present, the entity participates in transaction
|
|
158
|
+
*/
|
|
155
159
|
tx?: Database
|
|
156
160
|
}): Promise<Partial<EntityFields>[]>
|
|
157
161
|
}
|
|
@@ -162,6 +166,10 @@ interface Count {
|
|
|
162
166
|
* SQL where condition.
|
|
163
167
|
*/
|
|
164
168
|
where?: WhereCondition,
|
|
169
|
+
/**
|
|
170
|
+
* If present, the entity participates in transaction
|
|
171
|
+
*/
|
|
172
|
+
tx?: Database
|
|
165
173
|
}): Promise<number>
|
|
166
174
|
}
|
|
167
175
|
|
|
@@ -174,7 +182,11 @@ interface Insert<EntityFields> {
|
|
|
174
182
|
/**
|
|
175
183
|
* List of fields to be returned for each object
|
|
176
184
|
*/
|
|
177
|
-
fields?: string[]
|
|
185
|
+
fields?: string[],
|
|
186
|
+
/**
|
|
187
|
+
* If present, the entity participates in transaction
|
|
188
|
+
*/
|
|
189
|
+
tx?: Database
|
|
178
190
|
}): Promise<Partial<EntityFields>[]>
|
|
179
191
|
}
|
|
180
192
|
|
|
@@ -187,7 +199,11 @@ interface Save<EntityFields> {
|
|
|
187
199
|
/**
|
|
188
200
|
* List of fields to be returned for each object
|
|
189
201
|
*/
|
|
190
|
-
fields?: string[]
|
|
202
|
+
fields?: string[],
|
|
203
|
+
/**
|
|
204
|
+
* If present, the entity participates in transaction
|
|
205
|
+
*/
|
|
206
|
+
tx?: Database
|
|
191
207
|
}): Promise<Partial<EntityFields>>
|
|
192
208
|
}
|
|
193
209
|
|
|
@@ -196,11 +212,15 @@ interface Delete<EntityFields> {
|
|
|
196
212
|
/**
|
|
197
213
|
* SQL where condition.
|
|
198
214
|
*/
|
|
199
|
-
where
|
|
215
|
+
where?: WhereCondition,
|
|
200
216
|
/**
|
|
201
217
|
* List of fields to be returned for each object
|
|
202
218
|
*/
|
|
203
|
-
fields
|
|
219
|
+
fields?: string[],
|
|
220
|
+
/**
|
|
221
|
+
* If present, the entity participates in transaction
|
|
222
|
+
*/
|
|
223
|
+
tx?: Database
|
|
204
224
|
}): Promise<Partial<EntityFields>[]>,
|
|
205
225
|
}
|
|
206
226
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/sql-mapper",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "A data mapper utility for SQL databases",
|
|
5
5
|
"main": "mapper.js",
|
|
6
6
|
"types": "mapper.d.ts",
|
|
@@ -15,23 +15,23 @@
|
|
|
15
15
|
},
|
|
16
16
|
"homepage": "https://github.com/platformatic/platformatic#readme",
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"fastify": "^4.
|
|
18
|
+
"fastify": "^4.23.2",
|
|
19
19
|
"snazzy": "^9.0.0",
|
|
20
20
|
"standard": "^17.1.0",
|
|
21
|
-
"tap": "^16.3.
|
|
21
|
+
"tap": "^16.3.9",
|
|
22
22
|
"tsd": "^0.29.0"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@databases/mysql": "^6.0.0",
|
|
26
26
|
"@databases/pg": "^5.4.1",
|
|
27
27
|
"@databases/sql": "^3.3.0",
|
|
28
|
-
"@fastify/error": "^3.
|
|
28
|
+
"@fastify/error": "^3.3.0",
|
|
29
29
|
"@hapi/topo": "^6.0.2",
|
|
30
30
|
"@matteo.collina/sqlite-pool": "^0.3.0",
|
|
31
31
|
"camelcase": "^6.3.0",
|
|
32
|
-
"fastify-plugin": "^4.5.
|
|
32
|
+
"fastify-plugin": "^4.5.1",
|
|
33
33
|
"inflected": "^2.1.0",
|
|
34
|
-
"@platformatic/utils": "
|
|
34
|
+
"@platformatic/utils": "1.1.0"
|
|
35
35
|
},
|
|
36
36
|
"tsd": {
|
|
37
37
|
"directory": "test/types"
|