Comparing version 1.1.6 to 1.1.7
@@ -7,13 +7,7 @@ "use strict"; | ||
const standard = (req, res) => ({ | ||
update: req.body, | ||
update: Promise.resolve(req.body), | ||
end: () => res.end(), | ||
respond: json => res.send(json), | ||
}); | ||
const withCtx = ctx => ({ | ||
update: ctx.request.body, | ||
end: () => { | ||
ctx.body = ''; | ||
}, | ||
respond: json => (ctx.response.body = json), | ||
}); | ||
// Integrations with popular frameworks | ||
const frameworkAdapters = { | ||
@@ -23,6 +17,17 @@ express: standard, | ||
https: standard, | ||
koa: withCtx, | ||
oak: withCtx, | ||
koa: ctx => ({ | ||
update: Promise.resolve(ctx.request.body), | ||
end: () => (ctx.body = ''), | ||
respond: json => (ctx.response.body = json), | ||
}), | ||
oak: ctx => ({ | ||
update: ctx.request.body({ type: 'json' }).value, | ||
end: () => (ctx.response.status = 200), | ||
respond: json => { | ||
ctx.response.type = 'json'; | ||
ctx.response.body = json; | ||
}, | ||
}), | ||
fastify: (req, reply) => ({ | ||
update: req.body, | ||
update: Promise.resolve(req.body), | ||
respond: json => reply.send(json), | ||
@@ -74,3 +79,3 @@ }), | ||
} | ||
await timeoutIfNecessary(bot.handleUpdate(update, webhookReplyEnvelope), typeof onTimeout === 'function' | ||
await timeoutIfNecessary(bot.handleUpdate(await update, webhookReplyEnvelope), typeof onTimeout === 'function' | ||
? () => onTimeout(...args) | ||
@@ -77,0 +82,0 @@ : onTimeout, timeoutMilliseconds); |
@@ -17,3 +17,3 @@ import { ApiError, ResponseParameters } from '../platform'; | ||
/** The payload that was passed when calling the method. */ | ||
readonly payload: object; | ||
readonly payload: Record<string, unknown>; | ||
/** Flag that this request was unsuccessful. Always `false`. */ | ||
@@ -31,3 +31,3 @@ readonly ok: false; | ||
/** The payload that was passed when calling the method. */ | ||
payload: object); | ||
payload: Record<string, unknown>); | ||
} | ||
@@ -34,0 +34,0 @@ /** |
{ | ||
"name": "grammy", | ||
"description": "grammY core package ported to Node.js", | ||
"version": "1.1.6", | ||
"version": "1.1.7", | ||
"author": "KnorpelSenf", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
435818
8104