Skip to content

Commit 2006c1a

Browse files
Merge branch 'main' into #50-angular20
# Conflicts: # README.md # libs/components/package.json # libs/core/package.json
2 parents f4b3fef + f7d04dd commit 2006c1a

9 files changed

Lines changed: 74 additions & 20 deletions

File tree

README.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,23 @@ Public Angular libraries used in various shiftcode projects.
1111
> ![@shiftcode/ngx-ssr](https://img.shields.io/badge/@shiftcode/ngx--ssr-deprecated-f48700)\
1212
> Not used anymore starting with Angular 17. See necessary changes in [ssr.md](./ssr.md)
1313
14+
> ![@shiftcode/ngx-aws](https://img.shields.io/badge/@shiftcode/ngx--aws-deprecated-f48700)\
15+
> Not used anymore since we refactored how the logging to AWS CloudWatch works. See [Changlog](https://github.com/shiftcode/sc-ng-commons-public/blob/%40shiftcode/ngx-aws%407.0.0/libs/aws/CHANGELOG.md)
16+
> for previous versions.
17+
1418
## Angular to Lib Version Mapping
1519
Shows the mapping between the angular version and our lib versions.
1620

17-
| Angular Version | Lib Version |
18-
|-----------------|-------------|
19-
| `^20` | `^11` |
20-
| `^19` | `^7` |
21-
| `^18` | `^6` |
22-
| `^17` | `^5` |
23-
| `^16` | `^4` |
24-
| `^15` | `^3` |
25-
| `^14` | `^2` |
26-
| `^13` | `^1` |
21+
| Angular Version | Lib Version |
22+
|-----------------|-------------------------------|
23+
| `^20` | `^11` |
24+
| `^19` | `^7 \|\| ^8 \|\| ^9 \|\| ^10` |
25+
| `^18` | `^6` |
26+
| `^17` | `^5` |
27+
| `^16` | `^4` |
28+
| `^15` | `^3` |
29+
| `^14` | `^2` |
30+
| `^13` | `^1` |
2731

2832

2933
## Anatomy of this workspace

libs/components/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
# [10.0.0](https://github.com/shiftcode/sc-ng-commons-public/compare/@shiftcode/ngx-components@9.0.0...@shiftcode/ngx-components@10.0.0) (2025-06-30)
7+
8+
### Build System
9+
10+
- **components:** update peer dependency version ([1bdcbac](https://github.com/shiftcode/sc-ng-commons-public/commit/1bdcbacbb83b270daf35026134961afc2bc6d59c))
11+
12+
### BREAKING CHANGES
13+
14+
- **components:** requires @shiftcode/ngx-core ^10.0.0
15+
616
# [9.0.0](https://github.com/shiftcode/sc-ng-commons-public/compare/@shiftcode/ngx-components@8.0.0...@shiftcode/ngx-components@9.0.0) (2025-05-22)
717

818
### Build System

libs/core/CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,21 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
# [10.0.0](https://github.com/shiftcode/sc-ng-commons-public/compare/@shiftcode/ngx-core@9.0.0...@shiftcode/ngx-core@10.0.0) (2025-06-30)
7+
8+
### Bug Fixes
9+
10+
- **core:** also allow undefined for log request info values ([5f6e51d](https://github.com/shiftcode/sc-ng-commons-public/commit/5f6e51dbabeefbe3438d047a05b2223962cad293))
11+
- **core:** remove self reference in import ([bc7a1af](https://github.com/shiftcode/sc-ng-commons-public/commit/bc7a1af281dd3438d6cdeb56cde58dabcd3ce6d8))
12+
13+
### Features
14+
15+
- **core:** replace abstract class LogRequestInfoProvider with provider function for better DX ([7ce3626](https://github.com/shiftcode/sc-ng-commons-public/commit/7ce362631b1b6358cc7e774def042a2ebefbeb6a))
16+
17+
### BREAKING CHANGES
18+
19+
- **core:** The abstract class LogRequestInfoProvider is no longer available please provide the value using
20+
621
# [9.0.0](https://github.com/shiftcode/sc-ng-commons-public/compare/@shiftcode/ngx-core@8.0.0...@shiftcode/ngx-core@9.0.0) (2025-05-22)
722

823
### Build System

libs/core/src/lib/logger/cloudwatch/cloud-watch.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import { CloudWatchLogTransportConfig } from './cloud-watch-log-transport-config
99
import { HttpClient } from '@angular/common/http'
1010
import { isLogStreamNotFoundError } from './is-error.function'
1111
import { ClientIdService } from '../../client-id/client-id.service'
12-
import { LogRequestInfoProvider } from '../log-request-info-provider'
1312
import { RemoteLogData } from '../remote/remote-log-data.model'
13+
import { LOG_REQUEST_INFO } from '../log-request-info.token'
1414

1515
interface CloudWatchLogEvent {
1616
logStreamName: string
@@ -34,7 +34,7 @@ export class CloudWatchService {
3434
private httpClient: HttpClient,
3535
clientIdService: ClientIdService,
3636
@Inject(CLOUD_WATCH_LOG_TRANSPORT_CONFIG) private readonly config: CloudWatchLogTransportConfig,
37-
@Optional() private logRequestInfoProvider?: LogRequestInfoProvider,
37+
@Optional() @Inject(LOG_REQUEST_INFO) private logRequestInfoProvider?: Record<string, string>,
3838
) {
3939
this.clientId = clientIdService.clientId
4040
this.jsonStringifyReplacer = config.jsonStringifyReplacer || jsonMapSetStringifyReplacer
@@ -61,7 +61,7 @@ export class CloudWatchService {
6161

6262
const logDataObject: RemoteLogData = {
6363
...createJsonLogObjectData(level, context, dTimestamp, args),
64-
requestInfo: this.logRequestInfoProvider?.getRequestInfo() ?? {},
64+
requestInfo: this.logRequestInfoProvider ?? {},
6565
}
6666

6767
this.logsSubject.next({

libs/core/src/lib/logger/log-request-info-provider.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { InjectionToken } from '@angular/core'
2+
3+
export const LOG_REQUEST_INFO = new InjectionToken<Record<string, string>>('LOG_REQUEST_INFO')
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { EnvironmentProviders, FactoryProvider, makeEnvironmentProviders, ValueProvider } from '@angular/core'
2+
import { LOG_REQUEST_INFO } from './log-request-info.token'
3+
4+
type LogRequestInfo = Record<string, string | undefined>
5+
6+
export function provideLogRequestInfo(
7+
logRequestInfoOrFactory: LogRequestInfo | (() => LogRequestInfo),
8+
): EnvironmentProviders {
9+
if (typeof logRequestInfoOrFactory === 'function') {
10+
return makeEnvironmentProviders([
11+
{
12+
provide: LOG_REQUEST_INFO,
13+
useFactory: logRequestInfoOrFactory,
14+
} satisfies FactoryProvider,
15+
])
16+
} else {
17+
return makeEnvironmentProviders([
18+
{
19+
provide: LOG_REQUEST_INFO,
20+
useValue: logRequestInfoOrFactory,
21+
} satisfies ValueProvider,
22+
])
23+
}
24+
}

libs/core/src/lib/logger/remote/remote-log.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22
import { HttpClient, HttpHeaders } from '@angular/common/http'
33
import { Inject, Injectable, Optional } from '@angular/core'
44
import { createJsonLogObjectData, LogLevel } from '@shiftcode/logger'
5-
import { LogRequestInfoProvider } from '../log-request-info-provider'
65
import { REMOTE_LOG_CONFIG } from './remote-log-config.injection-token'
76
import { RemoteLogConfig } from './remote-log-config.model'
87
import { RemoteLogData } from './remote-log-data.model'
8+
import { LOG_REQUEST_INFO } from '../log-request-info.token'
99

1010
@Injectable({ providedIn: 'root' })
1111
export class RemoteLogService {
1212
protected constructor(
1313
private httpClient: HttpClient,
1414
@Inject(REMOTE_LOG_CONFIG) private config: RemoteLogConfig,
15-
@Optional() private logRequestInfoProvider?: LogRequestInfoProvider,
15+
@Optional() @Inject(LOG_REQUEST_INFO) private logRequestInfoProvider?: Record<string, string>,
1616
) {}
1717

1818
sendMessage(level: LogLevel, context: string, timestamp: Date, args: any[]) {
1919
const remoteLogData: RemoteLogData = {
2020
...createJsonLogObjectData(level, context, timestamp, args),
21-
requestInfo: this.logRequestInfoProvider?.getRequestInfo() ?? {},
21+
requestInfo: this.logRequestInfoProvider ?? {},
2222
}
2323
this.postToBackend(remoteLogData)
2424
}

libs/core/src/public-api.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ export * from './lib/local-storage/local-storage-options'
1313
export * from './lib/local-storage/provide-local-storage'
1414

1515
// logger
16-
export * from './lib/logger/log-request-info-provider'
16+
export * from './lib/logger/log-request-info.token'
17+
export * from './lib/logger/provide-log-request-info'
1718
export * from './lib/logger/logger.service'
1819
export * from './lib/logger/provide-logger'
1920

0 commit comments

Comments
 (0)