aws-xray-sdk-fastify 3.10.1 → 3.10.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.
@@ -16,6 +16,7 @@ module.exports = function onRequestHook(request, reply, done) {
16
16
 
17
17
  ns.run(() => {
18
18
  AWSXRay.setSegment(segment);
19
+ done();
19
20
  });
20
21
  } else {
21
22
  request.log.info('Manual mode, skipping segment');
@@ -25,7 +26,7 @@ module.exports = function onRequestHook(request, reply, done) {
25
26
  } else {
26
27
  request.log.warn('Request already has a segment, skipping');
27
28
  }
28
- }
29
29
 
30
- done();
30
+ done();
31
+ }
31
32
  };
package/lib/index.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export * from './plugin';
2
+ export { default } from './plugin';
package/lib/plugin.js CHANGED
@@ -1,11 +1,12 @@
1
1
  // @ts-check
2
+ const fp = require('fastify-plugin').default;
2
3
  const configureAWSXRaySync = require('./private/configure-aws-x-ray-sync');
3
4
  const onRequestHook = require('./hooks/on-request.hook');
4
5
  const onResponseHook = require('./hooks/on-response.hook');
5
6
  const onErrorHook = require('./hooks/on-error.hook');
6
7
 
7
8
  /** @type {import('fastify').FastifyPluginAsync} */
8
- const xRayFastifyPlugin = async (fastify, opts) => {
9
+ const xRayFastifyPlugin = fp(async (fastify, opts) => {
9
10
  configureAWSXRaySync(fastify, opts);
10
11
 
11
12
  fastify.decorateRequest('segment', null);
@@ -13,6 +14,8 @@ const xRayFastifyPlugin = async (fastify, opts) => {
13
14
  .addHook('onRequest', onRequestHook)
14
15
  .addHook('onResponse', onResponseHook)
15
16
  .addHook('onError', onErrorHook);
16
- };
17
+ });
17
18
 
18
19
  module.exports = xRayFastifyPlugin;
20
+
21
+ exports.xRayFastifyPlugin = xRayFastifyPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aws-xray-sdk-fastify",
3
- "version": "3.10.1",
3
+ "version": "3.10.3",
4
4
  "description": "AWS X-Ray plugin for Fastify",
5
5
  "author": "Amazon Web Services",
6
6
  "contributors": [
@@ -22,7 +22,7 @@
22
22
  "node": ">= 14.x"
23
23
  },
24
24
  "peerDependencies": {
25
- "aws-xray-sdk-core": "^3.10.1",
25
+ "aws-xray-sdk-core": "^3.10.3",
26
26
  "fastify": "^4.0.1",
27
27
  "fastify-plugin": "^4.2.0"
28
28
  },
@@ -40,5 +40,5 @@
40
40
  },
41
41
  "license": "Apache-2.0",
42
42
  "repository": "https://github.com/aws/aws-xray-sdk-node/tree/master/sdk_contrib/fastify",
43
- "gitHead": "5539f1ab3a33f8df7b8add9e450b536886250a3a"
43
+ "gitHead": "f838200543af28912291e2bf309991366cd9abea"
44
44
  }