fastify-txstate 3.0.6 → 3.0.8

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
@@ -10,7 +10,7 @@ const http_1 = __importDefault(require("http"));
10
10
  const http_status_codes_1 = require("http-status-codes");
11
11
  exports.devLogger = {
12
12
  level: 'info',
13
- info: console.info,
13
+ info: (msg) => console.info(msg.req ? `${msg.req.method} ${msg.req.url}` : msg.res ? `${msg.res.statusCode}` : msg),
14
14
  error: console.error,
15
15
  debug: console.debug,
16
16
  fatal: console.error,
@@ -62,7 +62,9 @@ class Server {
62
62
  if (!req.headers.origin)
63
63
  return;
64
64
  let passed = this.validOrigins[req.headers.origin];
65
- if (!passed) {
65
+ if (!passed && req.headers.origin === 'null')
66
+ passed = process.env.NODE_ENV === 'development';
67
+ else if (!passed) {
66
68
  const parsedOrigin = new URL(req.headers.origin);
67
69
  if (req.hostname.replace(/:\d+$/, '') === parsedOrigin.hostname)
68
70
  passed = true;
@@ -12,10 +12,7 @@ export interface FastifyTxStateOptions extends Partial<FastifyServerOptions> {
12
12
  }
13
13
  export declare const devLogger: {
14
14
  level: string;
15
- info: {
16
- (...data: any[]): void;
17
- (message?: any, ...optionalParams: any[]): void;
18
- };
15
+ info: (msg: any) => void;
19
16
  error: {
20
17
  (...data: any[]): void;
21
18
  (message?: any, ...optionalParams: any[]): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastify-txstate",
3
- "version": "3.0.6",
3
+ "version": "3.0.8",
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",