@platformatic/sql-mapper
Advanced tools
Comparing version 0.26.1 to 0.27.0
@@ -1,2 +0,2 @@ | ||
import { FastifyPluginAsync } from 'fastify' | ||
import { FastifyPluginAsync, FastifyInstance, FastifyReply, FastifyRequest } from 'fastify' | ||
import { SQL, SQLQuery } from '@databases/sql' | ||
@@ -309,2 +309,7 @@ | ||
export interface PlatformaticContext { | ||
app: FastifyInstance, | ||
reply: FastifyReply | ||
} | ||
declare module 'fastify' { | ||
@@ -314,2 +319,6 @@ interface FastifyInstance { | ||
} | ||
interface FastifyRequest { | ||
platformaticContext: PlatformaticContext | ||
} | ||
} | ||
@@ -316,0 +325,0 @@ |
{ | ||
"name": "@platformatic/sql-mapper", | ||
"version": "0.26.1", | ||
"version": "0.27.0", | ||
"description": "A data mapper utility for SQL databases", | ||
@@ -17,6 +17,6 @@ "main": "mapper.js", | ||
"devDependencies": { | ||
"fastify": "^4.17.0", | ||
"fastify": "^4.18.0", | ||
"snazzy": "^9.0.0", | ||
"standard": "^17.0.0", | ||
"tap": "^16.3.4", | ||
"standard": "^17.1.0", | ||
"tap": "^16.3.6", | ||
"tsd": "^0.28.1" | ||
@@ -23,0 +23,0 @@ }, |
@@ -0,1 +1,2 @@ | ||
'use strict' | ||
@@ -2,0 +3,0 @@ const { test } = require('tap') |
import { expectType } from 'tsd' | ||
import { SQL, SQLQuery } from '@databases/sql' | ||
import { fastify, FastifyInstance } from 'fastify' | ||
import { fastify, FastifyInstance, FastifyReply } from 'fastify' | ||
import { | ||
@@ -75,4 +75,11 @@ connect, | ||
instance.register(plugin, { connectionString: '', autoTimestamp: true }) | ||
instance.register((instance) => { expectType<SQLMapperPluginInterface>(instance.platformatic) }) | ||
instance.register((instance) => { | ||
expectType<SQLMapperPluginInterface>(instance.platformatic) | ||
instance.get('/', async (request, reply) => { | ||
const ctx = request.platformaticContext | ||
expectType<FastifyInstance>(ctx.app) | ||
expectType<FastifyReply>(ctx.reply) | ||
}) | ||
}) | ||
expectType<(str: string) => string>(utils.toSingular) |
163651
5181