fastify-txstate 3.1.1 → 3.1.3

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/lib/index.js CHANGED
@@ -90,7 +90,7 @@ class Server {
90
90
  let passed = this.validOrigins[req.headers.origin];
91
91
  if (!passed && req.headers.origin === 'null')
92
92
  passed = process.env.NODE_ENV === 'development';
93
- if (!passed) {
93
+ else if (!passed) {
94
94
  const parsedOrigin = new URL(req.headers.origin);
95
95
  if (req.hostname.replace(/:\d+$/, '') === parsedOrigin.hostname)
96
96
  passed = true;
@@ -104,9 +104,9 @@ class Server {
104
104
  passed = true;
105
105
  }
106
106
  }
107
- if (!passed && ((_a = config.checkOrigin) === null || _a === void 0 ? void 0 : _a.call(config, req)))
108
- passed = true;
109
107
  }
108
+ if (!passed && ((_a = config.checkOrigin) === null || _a === void 0 ? void 0 : _a.call(config, req)))
109
+ passed = true;
110
110
  if (!passed) {
111
111
  await res.status(403).send('Origin check failed. Suspected XSRF attack.');
112
112
  return res;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import { FastifyInstance, FastifyRequest, FastifyReply, FastifyServerOptions, FastifyLoggerOptions } from 'fastify';
3
3
  import http2 from 'http2';
4
- declare type ErrorHandler = (error: Error, req: FastifyRequest, res: FastifyReply) => Promise<void>;
4
+ type ErrorHandler = (error: Error, req: FastifyRequest, res: FastifyReply) => Promise<void>;
5
5
  export interface FastifyTxStateOptions extends Partial<FastifyServerOptions> {
6
6
  https?: http2.SecureServerOptions;
7
7
  validOrigins?: string[];
package/lib-esm/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import ftxst from '../lib/index.js'
2
2
 
3
+ export const devLogger = ftxst.devLogger
4
+ export const prodLogger = ftsxt.prodLogger
3
5
  export const HttpError = ftxst.HttpError
4
6
  export const FailedValidationError = ftxst.FailedValidationError
5
7
  export default ftxst.default
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastify-txstate",
3
- "version": "3.1.1",
3
+ "version": "3.1.3",
4
4
  "description": "A small wrapper for fastify providing a set of common conventions & utility functions we use.",
5
5
  "exports": {
6
6
  "types": "./lib-esm/index.d.ts",