@webdecoy/fastify 0.5.0 → 0.6.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/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -0
- package/dist/index.mjs +2 -0
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FastifyRequest, FastifyReply, FastifyInstance } from 'fastify';
|
|
2
|
-
import { ProtectOptions, WebDecoyConfig, CaptchaEndpointsOptions } from '@webdecoy/node';
|
|
2
|
+
import { EdgeVerdict, ProtectOptions, WebDecoyConfig, CaptchaEndpointsOptions } from '@webdecoy/node';
|
|
3
3
|
export { CaptchaEndpointsOptions, ProtectResult, RequestMetadata, SDKDetectionResponse, WebDecoyConfig } from '@webdecoy/node';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -42,6 +42,8 @@ interface WebDecoyDetection {
|
|
|
42
42
|
declare module 'fastify' {
|
|
43
43
|
interface FastifyRequest {
|
|
44
44
|
webdecoy?: WebDecoyDetection;
|
|
45
|
+
/** What the edge validator said about this request (#481). */
|
|
46
|
+
webdecoyEdge?: EdgeVerdict;
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FastifyRequest, FastifyReply, FastifyInstance } from 'fastify';
|
|
2
|
-
import { ProtectOptions, WebDecoyConfig, CaptchaEndpointsOptions } from '@webdecoy/node';
|
|
2
|
+
import { EdgeVerdict, ProtectOptions, WebDecoyConfig, CaptchaEndpointsOptions } from '@webdecoy/node';
|
|
3
3
|
export { CaptchaEndpointsOptions, ProtectResult, RequestMetadata, SDKDetectionResponse, WebDecoyConfig } from '@webdecoy/node';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -42,6 +42,8 @@ interface WebDecoyDetection {
|
|
|
42
42
|
declare module 'fastify' {
|
|
43
43
|
interface FastifyRequest {
|
|
44
44
|
webdecoy?: WebDecoyDetection;
|
|
45
|
+
/** What the edge validator said about this request (#481). */
|
|
46
|
+
webdecoyEdge?: EdgeVerdict;
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
/**
|
package/dist/index.js
CHANGED
|
@@ -70,6 +70,7 @@ async function webdecoyPluginImpl(fastify, options) {
|
|
|
70
70
|
const onError = options.onError || defaultOnError;
|
|
71
71
|
const skipPaths = options.skipPaths;
|
|
72
72
|
fastify.decorateRequest("webdecoy", null);
|
|
73
|
+
fastify.decorateRequest("webdecoyEdge", null);
|
|
73
74
|
fastify.addHook("preHandler", async (req, reply) => {
|
|
74
75
|
try {
|
|
75
76
|
if (shouldSkipPath(req.url, skipPaths)) {
|
|
@@ -119,6 +120,7 @@ async function webdecoyPluginImpl(fastify, options) {
|
|
|
119
120
|
}
|
|
120
121
|
if (result.allowed) {
|
|
121
122
|
req.webdecoy = result.detection;
|
|
123
|
+
req.webdecoyEdge = result.edge;
|
|
122
124
|
} else {
|
|
123
125
|
onBlocked(req, reply, result.detection);
|
|
124
126
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -32,6 +32,7 @@ async function webdecoyPluginImpl(fastify, options) {
|
|
|
32
32
|
const onError = options.onError || defaultOnError;
|
|
33
33
|
const skipPaths = options.skipPaths;
|
|
34
34
|
fastify.decorateRequest("webdecoy", null);
|
|
35
|
+
fastify.decorateRequest("webdecoyEdge", null);
|
|
35
36
|
fastify.addHook("preHandler", async (req, reply) => {
|
|
36
37
|
try {
|
|
37
38
|
if (shouldSkipPath(req.url, skipPaths)) {
|
|
@@ -81,6 +82,7 @@ async function webdecoyPluginImpl(fastify, options) {
|
|
|
81
82
|
}
|
|
82
83
|
if (result.allowed) {
|
|
83
84
|
req.webdecoy = result.detection;
|
|
85
|
+
req.webdecoyEdge = result.edge;
|
|
84
86
|
} else {
|
|
85
87
|
onBlocked(req, reply, result.detection);
|
|
86
88
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webdecoy/fastify",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Web Decoy plugin for Fastify",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"url": "https://github.com/WebDecoy/node/issues"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@webdecoy/node": "^0.
|
|
43
|
+
"@webdecoy/node": "^0.6.0",
|
|
44
44
|
"fastify-plugin": "^4.5.1"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|