Skip to content

Commit 4b0d85c

Browse files
committed
Merge branch 'main' into #59-refactor-rx-directives-context-update
# Conflicts: # libs/components/package.json
2 parents 1c7556a + 7acd627 commit 4b0d85c

27 files changed

+387
-60
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Shows the mapping between the angular version and our lib versions.
2020

2121
| Angular Version | Lib Version |
2222
|-----------------|-------------------------------|
23-
| `^20` | `^11` |
23+
| `^20` | `^11 \|\| ^12` |
2424
| `^19` | `^7 \|\| ^8 \|\| ^9 \|\| ^10` |
2525
| `^18` | `^6` |
2626
| `^17` | `^5` |

libs/components/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+
## [12.0.1](https://github.com/shiftcode/sc-ng-commons-public/compare/@shiftcode/ngx-components@12.0.0...@shiftcode/ngx-components@12.0.1) (2025-10-02)
7+
8+
**Note:** Version bump only for package @shiftcode/ngx-components
9+
10+
# [12.0.0](https://github.com/shiftcode/sc-ng-commons-public/compare/@shiftcode/ngx-components@11.0.0...@shiftcode/ngx-components@12.0.0) (2025-09-09)
11+
12+
### Features
13+
14+
- **dependencies:** require @shiftcode/ngx-core@^12.0.0 ([5c93d4b](https://github.com/shiftcode/sc-ng-commons-public/commit/5c93d4bdfd9cada0c76f9eecbb4d4e358f163199))
15+
- **dependencies:** use @shiftcode/ngx-core@^12.0.0 ([8a75739](https://github.com/shiftcode/sc-ng-commons-public/commit/8a75739de97439247307d4e99a7cb640d0212c10))
16+
17+
### BREAKING CHANGES
18+
19+
- **dependencies:** require @shiftcode/ngx-core@^12.0.0
20+
621
# [11.0.0](https://github.com/shiftcode/sc-ng-commons-public/compare/@shiftcode/ngx-components@10.0.0...@shiftcode/ngx-components@11.0.0) (2025-06-30)
722

823
### Bug Fixes

libs/components/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@shiftcode/ngx-components",
3-
"version": "11.0.1-pr59.0",
3+
"version": "12.0.1",
44
"repository": "https://github.com/shiftcode/sc-ng-commons-public",
55
"license": "MIT",
66
"author": "shiftcode GmbH <team@shiftcode.ch>",
@@ -25,7 +25,7 @@
2525
"@angular/forms": "^20.0.0",
2626
"@angular/router": "^20.0.0",
2727
"@shiftcode/logger": "^3.0.0",
28-
"@shiftcode/ngx-core": "^11.0.0 || ^11.0.0-pr50",
28+
"@shiftcode/ngx-core": "^12.0.0 || ^12.1.0-pr61",
2929
"rxjs": "^6.5.3 || ^7.4.0"
3030
}
3131
}

libs/core/CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,32 @@
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+
# [12.1.0](https://github.com/shiftcode/sc-ng-commons-public/compare/@shiftcode/ngx-core@12.0.0...@shiftcode/ngx-core@12.1.0) (2025-10-02)
7+
8+
### Features
9+
10+
- **ensure-origin.interceptor:** introduce interceptor to prepend the origin on requests ([453b6e1](https://github.com/shiftcode/sc-ng-commons-public/commit/453b6e13be325447f8d6bb46afa9f2c4deb616a4))
11+
- **provide-origin-from-env:** introduce origin provider function for ssr ([03d10c2](https://github.com/shiftcode/sc-ng-commons-public/commit/03d10c2004b48c532f6183a517e9a67054a5a35b))
12+
13+
# [12.0.0](https://github.com/shiftcode/sc-ng-commons-public/compare/@shiftcode/ngx-core@11.1.0...@shiftcode/ngx-core@12.0.0) (2025-09-09)
14+
15+
### Bug Fixes
16+
17+
- **logger:** ensure `requestInfo` is optional in log data and improve injection syntax ([91f9bb9](https://github.com/shiftcode/sc-ng-commons-public/commit/91f9bb9abffbb4f69b39d586cf02955e820b8cfc))
18+
- **logger:** make the `LogRequestInfo` feature working again ([0e3d49d](https://github.com/shiftcode/sc-ng-commons-public/commit/0e3d49d6df80a866cc67c7c3973b75182c93d65f))
19+
20+
### Code Refactoring
21+
22+
- **logger:** do not expose internals ([8601529](https://github.com/shiftcode/sc-ng-commons-public/commit/86015291dee8f0eb528845c96c1bca28894bef79))
23+
24+
### BREAKING CHANGES
25+
26+
- **logger:** - the LOG_REQUEST_INFO token does no longer exist
27+
28+
* `provideLogRequestInfo` no longer exists. use `withRequestInfoFn` instead
29+
30+
- **logger:** - the LoggerFeature type and LoggerFeatureKind enum are no longer exported
31+
632
# [11.1.0](https://github.com/shiftcode/sc-ng-commons-public/compare/@shiftcode/ngx-core@11.0.0...@shiftcode/ngx-core@11.1.0) (2025-08-21)
733

834
### Features

libs/core/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,27 @@ class MyDirective {
6060
- Node Console: `withNodeConsoleTransport(...)`
6161
- Remote: `withRemoteTransport(...)`
6262
- AWS CloudWatch: see `withCloudwatchTransport(...)`
63+
64+
### LogRequestInfo Integration
65+
You can enrich your log requests for `Remote` and `CloudWatch` Transports with custom information like user/session/device metadata using the `withRequestInfoFn` feature.
66+
67+
#### Usage Example
68+
Use the feature `withRequestInfoFn` function to provide a factory for a `LogRequestInfoFn`.
69+
The `LogRequestInfoFn` is a function itself that is called prior every log request. Its return value needs to be an object with the information to be included.
70+
71+
```ts
72+
import { LogLevel, provideLogger, withRemoteTransport, withRequestInfoFn, LogRequestInfo } from '@shiftcode/ngx-core'
73+
74+
bootstrapApplication(AppComponent, {
75+
providers: [
76+
provideLogger(
77+
withRemoteTransport({ logLevel: LogLevel.INFO, /* ...other config... */ }),
78+
withRequestInfoFn(() => {
79+
const authService = inject(AuthService)
80+
const router = inject(Router)
81+
return (): LogRequestInfo => ({ userId: authService.currentUser?.id, url: this.router.url })
82+
})
83+
),
84+
],
85+
})
86+
```

libs/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@shiftcode/ngx-core",
3-
"version": "11.1.0",
3+
"version": "12.1.0",
44
"repository": "https://github.com/shiftcode/sc-ng-commons-public",
55
"license": "MIT",
66
"author": "shiftcode GmbH <team@shiftcode.ch>",

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
/* eslint-disable no-console */
2-
import { Injectable, inject } from '@angular/core'
2+
import { inject, Injectable } from '@angular/core'
33
import { createJsonLogObjectData, LogLevel } from '@shiftcode/logger'
44
import { jsonMapSetStringifyReplacer } from '@shiftcode/utilities'
55
import { BehaviorSubject, concatMap, Observable, of, retry, Subject, throwError } from 'rxjs'
66
import { catchError, filter, map, mergeMap, shareReplay, take } from 'rxjs/operators'
77
import { CLOUD_WATCH_LOG_TRANSPORT_CONFIG } from './cloud-watch-log-transport-config.injection-token'
8-
import { CloudWatchLogTransportConfig } from './cloud-watch-log-transport-config.model'
98
import { HttpClient } from '@angular/common/http'
109
import { isLogStreamNotFoundError } from './is-error.function'
1110
import { ClientIdService } from '../../client-id/client-id.service'
1211
import { RemoteLogData } from '../remote/remote-log-data.model'
13-
import { LOG_REQUEST_INFO } from '../log-request-info.token'
12+
import { LOG_REQUEST_INFO_FN } from '../log-request-info-fn.token'
1413

1514
interface CloudWatchLogEvent {
1615
logStreamName: string
@@ -25,8 +24,8 @@ interface CloudWatchLogEvent {
2524
@Injectable({ providedIn: 'root' })
2625
export class CloudWatchService {
2726
private readonly httpClient = inject(HttpClient)
28-
private readonly config = inject<CloudWatchLogTransportConfig>(CLOUD_WATCH_LOG_TRANSPORT_CONFIG)
29-
private readonly logRequestInfoProvider = inject<Record<string, string>>(LOG_REQUEST_INFO, { optional: true })
27+
private readonly config = inject(CLOUD_WATCH_LOG_TRANSPORT_CONFIG)
28+
private readonly logRequestInfoFn = inject(LOG_REQUEST_INFO_FN, { optional: true })
3029

3130
private readonly retrying$ = new BehaviorSubject<boolean>(false)
3231
private readonly logStream$ = new Observable<void>()
@@ -62,7 +61,9 @@ export class CloudWatchService {
6261

6362
const logDataObject: RemoteLogData = {
6463
...createJsonLogObjectData(level, context, dTimestamp, args),
65-
requestInfo: this.logRequestInfoProvider ?? {},
64+
}
65+
if (this.logRequestInfoFn) {
66+
logDataObject.requestInfo = this.logRequestInfoFn()
6667
}
6768

6869
this.logsSubject.next({

libs/core/src/lib/logger/cloudwatch/with-cloudwatch-transport.function.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import { LoggerFeature, LoggerFeatureKind } from '../provide-logger'
21
import { LogTransport } from '@shiftcode/logger'
32
import { CLOUD_WATCH_LOG_TRANSPORT_CONFIG } from './cloud-watch-log-transport-config.injection-token'
43
import { CloudWatchLogTransportConfig } from './cloud-watch-log-transport-config.model'
54
import { CloudWatchLogTransport } from './cloud-watch-log-transport.service'
5+
import { LoggerFeatureKind } from '../logger-feature-kind.enum'
6+
import { LoggerFeature } from '../logger-feature.type'
67

78
export function withCloudwatchTransport(
89
cloudWatchLogTransportConfigOrFactory: CloudWatchLogTransportConfig | (() => CloudWatchLogTransportConfig),

libs/core/src/lib/logger/console/with-browser-console-transport.function.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import { LoggerFeature, LoggerFeatureKind } from '../provide-logger'
21
import { ConsoleLogTransportConfig } from './console-log-transport-config'
32
import { CONSOLE_LOG_TRANSPORT_CONFIG } from './console-log-transport-config.injection-token'
43
import { ConsoleLogTransport } from './console-log-transport.service'
54
import { LogTransport } from '@shiftcode/logger'
5+
import { LoggerFeatureKind } from '../logger-feature-kind.enum'
6+
import { LoggerFeature } from '../logger-feature.type'
67

78
export function withBrowserConsoleTransport(
89
consoleLoggerConfigOrFactory: ConsoleLogTransportConfig | (() => ConsoleLogTransportConfig),

libs/core/src/lib/logger/console/with-node-console-transport.function.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import { LoggerFeature, LoggerFeatureKind } from '../provide-logger'
21
import { ConsoleLogTransportConfig } from './console-log-transport-config'
32
import { CONSOLE_LOG_TRANSPORT_CONFIG } from './console-log-transport-config.injection-token'
43
import { NodeConsoleLogTransport } from './node-console-log-transport.service'
54
import { LogTransport } from '@shiftcode/logger'
5+
import { LoggerFeatureKind } from '../logger-feature-kind.enum'
6+
import { LoggerFeature } from '../logger-feature.type'
67

78
export function withNodeConsoleTransport(
89
consoleLoggerConfigOrFactory: ConsoleLogTransportConfig | (() => ConsoleLogTransportConfig),

0 commit comments

Comments
 (0)