@platformatic/sql-mapper 0.27.0 → 0.28.1
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 +25 -4
- package/package.json +4 -2
package/mapper.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FastifyPluginAsync, FastifyInstance, FastifyReply, FastifyRequest } from 'fastify'
|
|
2
|
+
import type { PlatformaticApp } from '@platformatic/types'
|
|
2
3
|
import { SQL, SQLQuery } from '@databases/sql'
|
|
3
4
|
|
|
4
5
|
interface ILogger {
|
|
@@ -306,16 +307,35 @@ export interface SQLMapperPluginInterface {
|
|
|
306
307
|
addEntityHooks(entityName: string, hooks: EntityHooks): any
|
|
307
308
|
}
|
|
308
309
|
|
|
310
|
+
// Extend the PlatformaticApp interface,
|
|
311
|
+
// Unfortunately we neeed to copy over all the types from SQLMapperPluginInterface
|
|
312
|
+
declare module '@platformatic/types' {
|
|
313
|
+
interface PlatformaticApp {
|
|
314
|
+
/**
|
|
315
|
+
* A Database abstraction layer from [@Databases](https://www.atdatabases.org/)
|
|
316
|
+
*/
|
|
317
|
+
db: Database,
|
|
318
|
+
/**
|
|
319
|
+
* The SQL builder from [@Databases](https://www.atdatabases.org/)
|
|
320
|
+
*/
|
|
321
|
+
sql: SQL,
|
|
322
|
+
/**
|
|
323
|
+
* An object containing a key for each table found in the schema, with basic CRUD operations. See [entity.md](./entity.md) for details.
|
|
324
|
+
*/
|
|
325
|
+
entities: Entities,
|
|
326
|
+
/**
|
|
327
|
+
* Adds hooks to the entity.
|
|
328
|
+
*/
|
|
329
|
+
addEntityHooks(entityName: string, hooks: EntityHooks): any
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
309
333
|
export interface PlatformaticContext {
|
|
310
334
|
app: FastifyInstance,
|
|
311
335
|
reply: FastifyReply
|
|
312
336
|
}
|
|
313
337
|
|
|
314
338
|
declare module 'fastify' {
|
|
315
|
-
interface FastifyInstance {
|
|
316
|
-
platformatic: SQLMapperPluginInterface
|
|
317
|
-
}
|
|
318
|
-
|
|
319
339
|
interface FastifyRequest {
|
|
320
340
|
platformaticContext: PlatformaticContext
|
|
321
341
|
}
|
|
@@ -337,3 +357,4 @@ export default plugin
|
|
|
337
357
|
export module utils {
|
|
338
358
|
export function toSingular(str: string): string
|
|
339
359
|
}
|
|
360
|
+
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/sql-mapper",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.1",
|
|
4
4
|
"description": "A data mapper utility for SQL databases",
|
|
5
5
|
"main": "mapper.js",
|
|
6
|
+
"types": "mapper.d.ts",
|
|
6
7
|
"repository": {
|
|
7
8
|
"type": "git",
|
|
8
9
|
"url": "git+https://github.com/platformatic/platformatic.git"
|
|
@@ -27,7 +28,8 @@
|
|
|
27
28
|
"@databases/sqlite": "^4.0.2",
|
|
28
29
|
"camelcase": "^6.3.0",
|
|
29
30
|
"fastify-plugin": "^4.5.0",
|
|
30
|
-
"inflected": "^2.1.0"
|
|
31
|
+
"inflected": "^2.1.0",
|
|
32
|
+
"@platformatic/types": "0.28.1"
|
|
31
33
|
},
|
|
32
34
|
"tsd": {
|
|
33
35
|
"directory": "test/types"
|