fastify-txstate 3.2.14 → 3.2.16

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.
Files changed (2) hide show
  1. package/lib/index.js +3 -3
  2. package/package.json +2 -2
package/lib/index.js CHANGED
@@ -104,7 +104,7 @@ class Server {
104
104
  else
105
105
  config.trustProxy = process.env.TRUST_PROXY;
106
106
  }
107
- config.ajv = { ...config.ajv, plugins: [...(config.ajv?.plugins ?? []), ajv_errors_1.default, [ajv_formats_1.default, { mode: 'fast' }]], customOptions: { ...config.ajv?.customOptions, allErrors: true, strictSchema: false } };
107
+ config.ajv = { ...config.ajv, plugins: [...(config.ajv?.plugins ?? []), ajv_errors_1.default, [ajv_formats_1.default, { mode: 'fast' }]], customOptions: { ...config.ajv?.customOptions, allErrors: true, strictSchema: false, coerceTypes: true } };
108
108
  this.healthCallback = config.checkHealth;
109
109
  this.app = (0, fastify_1.fastify)(config);
110
110
  this.app.addHook('onRoute', route => {
@@ -147,9 +147,9 @@ class Server {
147
147
  * undefined before we validate.
148
148
  */
149
149
  if (schema != null)
150
- (0, txstate_utils_1.destroyNulls)(data);
150
+ (0, txstate_utils_1.destroyNulls)((0, txstate_utils_1.stringifyDates)(data));
151
151
  if (!validate(data))
152
- throw new Error('Output validation failed: ' + validate.errors?.[0].message);
152
+ throw new Error('Output validation failed. ' + validate.errors?.[0].instancePath + ': ' + validate.errors?.[0].message);
153
153
  return JSON.stringify(data);
154
154
  };
155
155
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastify-txstate",
3
- "version": "3.2.14",
3
+ "version": "3.2.16",
4
4
  "description": "A small wrapper for fastify providing a set of common conventions & utility functions we use.",
5
5
  "exports": {
6
6
  ".": {
@@ -30,7 +30,7 @@
30
30
  "fastify-plugin": "^4.5.1",
31
31
  "http-status-codes": "^2.1.4",
32
32
  "jose": "^5.2.3",
33
- "txstate-utils": "^1.9.1",
33
+ "txstate-utils": "^1.9.5",
34
34
  "ua-parser-js": "^1.0.37"
35
35
  },
36
36
  "devDependencies": {