Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update dependencies supporting NestJS 10 #526

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ jobs:
strategy:
matrix:
node-version:
- 14.x # Maintenance
- 16.x # Active
- 17.x # Current
- 18.x

steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ jobs:

- uses: actions/setup-node@v2
with:
node-version: 16.x
node-version: 18.x

- run: npm ci

- run: npm install -g semantic-release @semantic-release/git @semantic-release/changelog @semantic-release/release-notes-generator @semantic-release/npm

# needed for npm publishing
- run: npm run build

- run: npm config set access public
- run: semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"@semantic-release/npm",
"@semantic-release/git"
],
"repositoryUrl": "https://github.com/narando/nest-xray"
"repositoryUrl": "https://github.com/TheRealMkadmi/nest-xray"
}
65 changes: 65 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,68 @@
## [1.0.2](https://github.com/TheRealMkadmi/nest-xray/compare/v1.0.1...v1.0.2) (2024-01-11)


### Bug Fixes

* **package.json:** remove support for nestjs 8 and add support for @nestjs/axios ^3.0.0 ([a24b890](https://github.com/TheRealMkadmi/nest-xray/commit/a24b890ff52d72a3df8afbb965c13bb99900bcf5))

## [1.0.1](https://github.com/TheRealMkadmi/nest-xray/compare/v1.0.0...v1.0.1) (2024-01-10)


### Bug Fixes

* **package.json:** add access to package.json ([73fb1b2](https://github.com/TheRealMkadmi/nest-xray/commit/73fb1b2b585820df09548d329f6d10e5faa86c29))

# 1.0.0 (2024-01-10)


### Bug Fixes

* broken prototype-chain for custom exceptions ([9b9978e](https://github.com/TheRealMkadmi/nest-xray/commit/9b9978ef3f6b5f3ea9895c083841de85564ce085))
* **ci:** add missing step to release pipeline ([18d4d69](https://github.com/TheRealMkadmi/nest-xray/commit/18d4d69f183cee85b5dc6fa063a392085bea590d))
* **ci:** fix version in package.json ([ff95014](https://github.com/TheRealMkadmi/nest-xray/commit/ff95014cc10310520de7931840c95c208ec3b1b4))
* **ci:** reference to coverage folder ([b38a3f1](https://github.com/TheRealMkadmi/nest-xray/commit/b38a3f1f982f982477e37c9b8d5be5b228741e51))
* **client/http:** error when used in context without Segment ([a2b7dd3](https://github.com/TheRealMkadmi/nest-xray/commit/a2b7dd3ae1e1bcb1173727d2342d4b7475e61912))
* **client/http:** subsegments get lost in parallel calls ([6f2bdae](https://github.com/TheRealMkadmi/nest-xray/commit/6f2bdaee40f57b9f353cdb171c647c52bff12c70))
* **client/http:** TracingService not available in module context ([fcd1566](https://github.com/TheRealMkadmi/nest-xray/commit/fcd1566f2d5b2d0d5b421ddcd54f541552f033a7))
* **deps:** remove rimraf from peerDeps ([bb45875](https://github.com/TheRealMkadmi/nest-xray/commit/bb45875e9bc843361575c48e39b10b8a194374c9))
* **deps:** update dependency aws-xray-sdk to v3 ([2f87b3d](https://github.com/TheRealMkadmi/nest-xray/commit/2f87b3dcc5cc464ba62b82162362a60aa255561f))
* duplicate TracingService instances without configuration ([4d89a75](https://github.com/TheRealMkadmi/nest-xray/commit/4d89a75928dbd56c242ece9c8f3ea6c8abb6329e))
* **env/http:** query parameter included twice [#140](https://github.com/TheRealMkadmi/nest-xray/issues/140) ([395b42c](https://github.com/TheRealMkadmi/nest-xray/commit/395b42ccd97aff8017cea322b874af7d53448ea9))
* **env/http:** segment has invalid URL when sampling decision is made ([dda8d58](https://github.com/TheRealMkadmi/nest-xray/commit/dda8d58fd8583704dd47fc3230218f5e5ba3b0da))
* **hooks:** throw named exception if async id is unknown ([cbdbd59](https://github.com/TheRealMkadmi/nest-xray/commit/cbdbd59d2c653b7fcc76b9835cdcca2984fe772f))
* **http-env.e2e-spec.ts:** fix package name ([f709b0d](https://github.com/TheRealMkadmi/nest-xray/commit/f709b0db8d9a176fb6ae13d379fee3f5dfbbad45))
* **http:** ignore missing tracing context in HttpService [#75](https://github.com/TheRealMkadmi/nest-xray/issues/75) ([b03160d](https://github.com/TheRealMkadmi/nest-xray/commit/b03160d03ee590ab7b416830a58ba8fb0508acc5))
* **lib:** linting after prettier update ([080c949](https://github.com/TheRealMkadmi/nest-xray/commit/080c94989dd2ce639ce7e4b616d98364b083fe4f))
* **lib:** typings after upgrading to typescript 4.5 ([faefd16](https://github.com/TheRealMkadmi/nest-xray/commit/faefd163a8b316b41445fe86894f4041d25e9e81))
* support aws xray sdk 3.3.3 ([9e596cd](https://github.com/TheRealMkadmi/nest-xray/commit/9e596cd561ba0537d083ff0690dabb78621a564d))
* **test:** broken imports of SegmentEmitter ([39ab6d7](https://github.com/TheRealMkadmi/nest-xray/commit/39ab6d72ff8078c3a935ed1478230f71f8edca84))
* **test:** hotpatch regex for subsegments ([e242114](https://github.com/TheRealMkadmi/nest-xray/commit/e2421146a1046c6dec1dcbe84287df9efb7996ff))
* **tests:** support new types (I'm not a ts dev) ([e9b5853](https://github.com/TheRealMkadmi/nest-xray/commit/e9b5853f3b8228ed9906a620e8611e341dd9a653))
* throw special exception if TracingService is used in unknown context ([688087c](https://github.com/TheRealMkadmi/nest-xray/commit/688087c09af4b8a2c95f1a8931f9e8e0b3c88d3b))


### Features

* add Github Actions CI ([e3040c5](https://github.com/TheRealMkadmi/nest-xray/commit/e3040c593e4b1b504a98d30cb68822254fb387af))
* add initial implementation ([65311a5](https://github.com/TheRealMkadmi/nest-xray/commit/65311a5f6a1d124bea7c081d63d5af28d130a4d5))
* add initial project setup ([ff161bc](https://github.com/TheRealMkadmi/nest-xray/commit/ff161bcabadd9862479ea1e4d4e18d8db1416101))
* add MIT license ([b201115](https://github.com/TheRealMkadmi/nest-xray/commit/b201115839449c68638bf570af9311a8af08c1a4))
* allow usages with Nestjs v7 ([13e19f0](https://github.com/TheRealMkadmi/nest-xray/commit/13e19f0a6750b86034cde4946370a319af267404))
* **ci:** add automatic changelog and releases on npm ([262b150](https://github.com/TheRealMkadmi/nest-xray/commit/262b1502819af8ba879291b9750d6a55f36b08a3))
* **core:** allow setting custom XRay plugins ([c82f824](https://github.com/TheRealMkadmi/nest-xray/commit/c82f8248d30282ae8caccbbb9f7559e39091b706))
* **deps:** bump to node 16 ([134771b](https://github.com/TheRealMkadmi/nest-xray/commit/134771b098c9a657db7c45cb1be11d01baf5dc7c))
* **deps:** support NestJS 8 and @nestjs/axios ([1b15ba7](https://github.com/TheRealMkadmi/nest-xray/commit/1b15ba747f98fc2a51c616dd99e137a44b08e298))
* export custom exceptions ([27a381c](https://github.com/TheRealMkadmi/nest-xray/commit/27a381c339329128483d49f7cd2fa99f82d2d766))
* NestJS v9 Compatibility ([#392](https://github.com/TheRealMkadmi/nest-xray/issues/392)) ([9b34c04](https://github.com/TheRealMkadmi/nest-xray/commit/9b34c043bf6d5343e60670ff3cd2cd1151ed8d4e))
* refactor code to enable multiple environments ([96bec82](https://github.com/TheRealMkadmi/nest-xray/commit/96bec82f6cde88702d167760d5d19b9661aedfe3))


### BREAKING CHANGES

* **deps:** Drop support for NestJS <8 and the HttpService from
@nestjs/common. Instead add support for NestJS 8 and the HttpService from
@nestjs/axios.

# [2.1.0](https://github.com/narando/nest-xray/compare/v2.0.0...v2.1.0) (2022-09-30)


Expand Down
21 changes: 13 additions & 8 deletions lib/clients/http/tracing.axios-interceptor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@ import { Test, TestingModule } from "@nestjs/testing";
import { Subsegment } from "aws-xray-sdk";
import {
AxiosError,
AxiosHeaders,
AxiosInstance,
AxiosRequestConfig,
AxiosResponse,
InternalAxiosRequestConfig,
} from "axios";
import { TracingService } from "../../core";
import { TracingNotInitializedException } from "../../exceptions";
import { HEADER_TRACE_CONTEXT } from "./http-tracing.constants";
import {
TracingAxiosInterceptor,
TRACING_CONFIG_KEY,
TracingConfig,
} from "./tracing.axios-interceptor";

describe("TracingAxiosInterceptor", () => {
Expand Down Expand Up @@ -60,15 +63,15 @@ describe("TracingAxiosInterceptor", () => {
});

describe("requestFulfilled", () => {
let interceptorFn: AxiosFulfilledInterceptor<AxiosRequestConfig>;
let interceptorFn: AxiosFulfilledInterceptor<TracingConfig>;
let config: AxiosRequestConfig;
let subSegment: Subsegment;

beforeEach(() => {
interceptorFn = interceptor.requestFulfilled();

config = {
headers: {},
headers: new AxiosHeaders({}),
};

subSegment = { id: "1337", name: "http-call" } as Subsegment;
Expand All @@ -84,7 +87,7 @@ describe("TracingAxiosInterceptor", () => {
});

it("should create a new sub segment", () => {
interceptorFn(config);
interceptorFn(config as TracingConfig);

expect(tracingService.createSubSegment).toHaveBeenCalledTimes(1);
expect(tracingService.createSubSegment).toHaveBeenCalledWith(
Expand All @@ -93,14 +96,14 @@ describe("TracingAxiosInterceptor", () => {
});

it("should persist the subsegment to the request config", () => {
interceptorFn(config);
interceptorFn(config as TracingConfig);

// @ts-ignore
expect(config[TRACING_CONFIG_KEY].subSegment).toBe(subSegment);
});

it("should add the tracing header to the request config", () => {
const returnedConfig = interceptorFn(config);
const returnedConfig = interceptorFn(config as TracingConfig);

expect(tracingService.getTracingHeader).toHaveBeenCalledTimes(1);
expect(tracingService.getTracingHeader).toHaveBeenCalledWith(subSegment);
Expand All @@ -120,7 +123,7 @@ describe("TracingAxiosInterceptor", () => {
throw new TracingNotInitializedException();
});

const returnedConfig = interceptorFn(config);
const returnedConfig = interceptorFn(config as TracingConfig);
expect(returnedConfig).toEqual(config);
});
});
Expand Down Expand Up @@ -148,7 +151,8 @@ describe("TracingAxiosInterceptor", () => {
[TRACING_CONFIG_KEY]: {
subSegment,
},
} as AxiosRequestConfig;
headers: new AxiosHeaders({}),
} as InternalAxiosRequestConfig;
});

it("should add the error data to the subsegment", () => {
Expand Down Expand Up @@ -291,7 +295,8 @@ describe("TracingAxiosInterceptor", () => {
[TRACING_CONFIG_KEY]: {
subSegment,
},
} as AxiosRequestConfig;
headers: new AxiosHeaders({}),
} as InternalAxiosRequestConfig;
});

it("should do nothing if no subsegment is returned", () => {
Expand Down
4 changes: 3 additions & 1 deletion lib/clients/http/tracing.axios-interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ import { ClientRequest, IncomingMessage } from "http";
import { TracingService } from "../../core";
import { TracingNotInitializedException } from "../../exceptions";
import { HEADER_TRACE_CONTEXT } from "./http-tracing.constants";
import axios, { AxiosRequestHeaders, AxiosHeaders } from "axios";

export const TRACING_CONFIG_KEY = Symbol("kTracingAxiosInterceptor");

export interface TracingConfig extends AxiosRequestConfig {
[TRACING_CONFIG_KEY]?: {
subSegment: Subsegment;
};
headers: AxiosRequestHeaders;
}

@Injectable()
Expand All @@ -42,7 +44,7 @@ export class TracingAxiosInterceptor extends AxiosInterceptor<TracingConfig> {
};

if (!config.headers) {
config.headers = {};
config.headers = new AxiosHeaders({});
}

config.headers[HEADER_TRACE_CONTEXT] =
Expand Down
Loading