@gasket/plugin-elastic-apm 7.0.9 → 7.1.0-canary.1

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/actions.js CHANGED
@@ -1,20 +1,24 @@
1
+ const { withGasketRequest } = require('@gasket/request');
2
+
1
3
  /** @type {import('@gasket/core').ActionHandler<'getApmTransaction'>} */
2
- async function getApmTransaction(gasket, req) {
3
- const apm = require('elastic-apm-node');
4
+ const getApmTransaction = withGasketRequest(
5
+ async function getApmTransaction(gasket, req) {
6
+ const apm = require('elastic-apm-node');
4
7
 
5
- if (!apm?.isStarted()) {
6
- return;
7
- }
8
+ if (!apm?.isStarted()) {
9
+ return;
10
+ }
8
11
 
9
- const transaction = apm.currentTransaction;
10
- if (!transaction) {
11
- return;
12
- }
12
+ const transaction = apm.currentTransaction;
13
+ if (!transaction) {
14
+ return;
15
+ }
13
16
 
14
- await gasket.exec('apmTransaction', transaction, { req });
17
+ await gasket.exec('apmTransaction', transaction, { req });
15
18
 
16
- return transaction;
17
- }
19
+ return transaction;
20
+ }
21
+ );
18
22
 
19
23
  module.exports = {
20
24
  getApmTransaction
package/lib/index.d.ts CHANGED
@@ -1,7 +1,5 @@
1
- import type { IncomingMessage } from 'http';
2
1
  import type { AgentConfigOptions, Transaction, Payload, Agent } from 'elastic-apm-node';
3
- import type { MaybeAsync, GasketConfig, Plugin } from '@gasket/core';
4
- import type { Request } from 'express';
2
+ import type { GasketConfig, Plugin } from '@gasket/core';
5
3
 
6
4
  export function filterSensitiveCookies(config: GasketConfig): function(Payload): Payload;
7
5
 
@@ -10,6 +8,8 @@ export interface ExtendedAgentConfigOptions extends AgentConfigOptions {
10
8
  }
11
9
 
12
10
  declare module '@gasket/core' {
11
+ import { RequestLike, GasketRequest } from '@gasket/request';
12
+
13
13
  export interface GasketConfig {
14
14
  elasticAPM?: ExtendedAgentConfigOptions;
15
15
  }
@@ -19,8 +19,8 @@ declare module '@gasket/core' {
19
19
  }
20
20
 
21
21
  export interface GasketActions {
22
- async getApmTransaction(
23
- req: IncomingMessage | Request
22
+ getApmTransaction(
23
+ req: RequestLike
24
24
  ): Promise<Transaction | void>
25
25
  }
26
26
 
@@ -28,7 +28,7 @@ declare module '@gasket/core' {
28
28
  apmTransaction(
29
29
  transaction: Transaction,
30
30
  context: {
31
- req: IncomingMessage | Request;
31
+ req: GasketRequest;
32
32
  }
33
33
  ): MaybeAsync<void>;
34
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gasket/plugin-elastic-apm",
3
- "version": "7.0.9",
3
+ "version": "7.1.0-canary.1",
4
4
  "description": "Adds Elastic APM instrumentation to your application",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -36,8 +36,12 @@
36
36
  "url": "https://github.com/godaddy/gasket/issues"
37
37
  },
38
38
  "homepage": "https://github.com/godaddy/gasket/tree/main/packages/gasket-plugin-elastic-apm",
39
+ "dependencies": {
40
+ "@gasket/request": "7.1.0-canary.1"
41
+ },
39
42
  "devDependencies": {
40
- "@gasket/core": "^7.0.9",
43
+ "@gasket/core": "7.1.0-canary.1",
44
+ "cross-env": "^7.0.3",
41
45
  "dotenv": "^16.4.5",
42
46
  "elastic-apm-node": "^4.4.1",
43
47
  "eslint": "^8.56.0",
@@ -66,5 +70,5 @@
66
70
  "jest": {
67
71
  "testEnvironment": "node"
68
72
  },
69
- "gitHead": "ff3acd042a9a22cd43ac29c6b064bd2f49304b9e"
73
+ "gitHead": "79706568a4b2a7aa2621bf1f0bdaded08c396ed4"
70
74
  }