@schorts/shared-kernel 4.1.1 โ†’ 4.2.0

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/CHANGELOG CHANGED
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [4.2.0] - 2025-10-21
9
+
10
+ ### Added
11
+
12
+ - Added `ConsoleTelemetry` for dev or test environments.
13
+
14
+ ## [4.1.2] - 2025-10-21
15
+
16
+ ### Changed
17
+
18
+ - Allow any params in the `init` method of the `Telemetry` and `Subscription`.
19
+
8
20
  ## [4.1.1] - 2025-10-21
9
21
 
10
22
  ### Added
package/README.md CHANGED
@@ -85,6 +85,7 @@ Translation keys are centralized in registries for discoverability and tooling,
85
85
  ### ๐Ÿ“ˆ Telemetry
86
86
 
87
87
  - **Telemetry:** Abstract interface for unified telemetry across frontend and backend environments. Supports initialization, error tracking, custom context attributes, and transaction naming. Enables integration with observability platforms like New Relic via a consistent API.
88
+ - **ConsoleTelemetry:** Development-friendly implementation of the `Telemetry` interface that logs errors, context, and transaction names to the console. Useful for local environments, testing, or CI pipelines where external observability is not required.
88
89
 
89
90
  ### ๐Ÿงช Value Objects
90
91
 
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConsoleTelemetry = void 0;
4
+ class ConsoleTelemetry {
5
+ customContext = {};
6
+ transaction = null;
7
+ init() {
8
+ console.log("Telemetry initialized");
9
+ }
10
+ trackError(error) {
11
+ console.error({
12
+ error,
13
+ timestamp: new Date(),
14
+ customContext: this.customContext,
15
+ transaction: this.transaction,
16
+ });
17
+ }
18
+ setCustomContext(key, value) {
19
+ this.customContext[key] = value;
20
+ }
21
+ setTransaction(name) {
22
+ this.transaction = name;
23
+ }
24
+ }
25
+ exports.ConsoleTelemetry = ConsoleTelemetry;
26
+ //# sourceMappingURL=console-telemetry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console-telemetry.js","sourceRoot":"","sources":["../../../src/telemetry/console-telemetry.ts"],"names":[],"mappings":";;;AAEA,MAAa,gBAAgB;IACV,aAAa,GAA2B,EAAE,CAAC;IACpD,WAAW,GAAkB,IAAI,CAAC;IAE1C,IAAI;QACF,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;IACvC,CAAC;IAED,UAAU,CAAC,KAAY;QACrB,OAAO,CAAC,KAAK,CAAC;YACZ,KAAK;YACL,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CAAC,CAAC;IACL,CAAC;IAED,gBAAgB,CAAC,GAAW,EAAE,KAAa;QACzC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAClC,CAAC;IAED,cAAc,CAAC,IAAY;QACzB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;CACF;AAxBD,4CAwBC"}
@@ -1,3 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConsoleTelemetry = void 0;
4
+ var console_telemetry_1 = require("./console-telemetry");
5
+ Object.defineProperty(exports, "ConsoleTelemetry", { enumerable: true, get: function () { return console_telemetry_1.ConsoleTelemetry; } });
3
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/telemetry/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/telemetry/index.ts"],"names":[],"mappings":";;;AACA,yDAAuD;AAA9C,qHAAA,gBAAgB,OAAA"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConsoleTelemetry = void 0;
4
+ class ConsoleTelemetry {
5
+ customContext = {};
6
+ transaction = null;
7
+ init() {
8
+ console.log("Telemetry initialized");
9
+ }
10
+ trackError(error) {
11
+ console.error({
12
+ error,
13
+ timestamp: new Date(),
14
+ customContext: this.customContext,
15
+ transaction: this.transaction,
16
+ });
17
+ }
18
+ setCustomContext(key, value) {
19
+ this.customContext[key] = value;
20
+ }
21
+ setTransaction(name) {
22
+ this.transaction = name;
23
+ }
24
+ }
25
+ exports.ConsoleTelemetry = ConsoleTelemetry;
26
+ //# sourceMappingURL=console-telemetry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console-telemetry.js","sourceRoot":"","sources":["../../../src/telemetry/console-telemetry.ts"],"names":[],"mappings":";;;AAEA,MAAa,gBAAgB;IACV,aAAa,GAA2B,EAAE,CAAC;IACpD,WAAW,GAAkB,IAAI,CAAC;IAE1C,IAAI;QACF,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;IACvC,CAAC;IAED,UAAU,CAAC,KAAY;QACrB,OAAO,CAAC,KAAK,CAAC;YACZ,KAAK;YACL,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CAAC,CAAC;IACL,CAAC;IAED,gBAAgB,CAAC,GAAW,EAAE,KAAa;QACzC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAClC,CAAC;IAED,cAAc,CAAC,IAAY;QACzB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;CACF;AAxBD,4CAwBC"}
@@ -1,3 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConsoleTelemetry = void 0;
4
+ var console_telemetry_1 = require("./console-telemetry");
5
+ Object.defineProperty(exports, "ConsoleTelemetry", { enumerable: true, get: function () { return console_telemetry_1.ConsoleTelemetry; } });
3
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/telemetry/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/telemetry/index.ts"],"names":[],"mappings":";;;AACA,yDAAuD;AAA9C,qHAAA,gBAAgB,OAAA"}
@@ -1,5 +1,5 @@
1
1
  export interface Subscription {
2
- init(): void;
2
+ init(...args: any[]): void;
3
3
  connect(): void;
4
4
  subscribe(channel: string, event: string, handler: (payload: any) => void): void;
5
5
  unsubscribe(channel: string): void;
@@ -1 +1 @@
1
- {"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../../src/pub-sub/subscription.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,IAAI,IAAI,IAAI,CAAC;IACb,OAAO,IAAI,IAAI,CAAC;IAChB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAAC;IACjF,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,UAAU,IAAI,IAAI,CAAC;CACpB"}
1
+ {"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../../src/pub-sub/subscription.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC3B,OAAO,IAAI,IAAI,CAAC;IAChB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAAC;IACjF,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,UAAU,IAAI,IAAI,CAAC;CACpB"}
@@ -0,0 +1,10 @@
1
+ import { Telemetry } from "./telemetry";
2
+ export declare class ConsoleTelemetry implements Telemetry {
3
+ private readonly customContext;
4
+ private transaction;
5
+ init(): void;
6
+ trackError(error: Error): void;
7
+ setCustomContext(key: string, value: string): void;
8
+ setTransaction(name: string): void;
9
+ }
10
+ //# sourceMappingURL=console-telemetry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console-telemetry.d.ts","sourceRoot":"","sources":["../../../src/telemetry/console-telemetry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,qBAAa,gBAAiB,YAAW,SAAS;IAChD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA8B;IAC5D,OAAO,CAAC,WAAW,CAAuB;IAE1C,IAAI,IAAI,IAAI;IAIZ,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAS9B,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAIlD,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CAGnC"}
@@ -1,2 +1,3 @@
1
1
  export type { Telemetry } from "./telemetry";
2
+ export { ConsoleTelemetry } from "./console-telemetry";
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/telemetry/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/telemetry/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  export interface Telemetry {
2
- init(): void;
2
+ init(...args: any[]): void;
3
3
  trackError(error: Error): void;
4
4
  setCustomContext(key: string, value: string): void;
5
5
  setTransaction(name: string): void;
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../../../src/telemetry/telemetry.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,IAAI,IAAI,IAAI,CAAC;IACb,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC/B,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACnD,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC"}
1
+ {"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../../../src/telemetry/telemetry.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC3B,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC/B,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACnD,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schorts/shared-kernel",
3
- "version": "4.1.1",
3
+ "version": "4.2.0",
4
4
  "description": "A modular, type-safe foundation for building expressive, maintainable applications. This package provides core abstractions for domain modeling, HTTP integration, authentication, state management, and more โ€” designed to be framework-agnostic and highly extensible.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -1,5 +1,5 @@
1
1
  export interface Subscription {
2
- init(): void;
2
+ init(...args: any[]): void;
3
3
  connect(): void;
4
4
  subscribe(channel: string, event: string, handler: (payload: any) => void): void;
5
5
  unsubscribe(channel: string): void;
@@ -0,0 +1,27 @@
1
+ import { Telemetry } from "./telemetry";
2
+
3
+ export class ConsoleTelemetry implements Telemetry {
4
+ private readonly customContext: Record<string, string> = {};
5
+ private transaction: string | null = null;
6
+
7
+ init(): void {
8
+ console.log("Telemetry initialized");
9
+ }
10
+
11
+ trackError(error: Error): void {
12
+ console.error({
13
+ error,
14
+ timestamp: new Date(),
15
+ customContext: this.customContext,
16
+ transaction: this.transaction,
17
+ });
18
+ }
19
+
20
+ setCustomContext(key: string, value: string): void {
21
+ this.customContext[key] = value;
22
+ }
23
+
24
+ setTransaction(name: string): void {
25
+ this.transaction = name;
26
+ }
27
+ }
@@ -1 +1,2 @@
1
- export type { Telemetry } from "./telemetry";
1
+ export type { Telemetry } from "./telemetry";
2
+ export { ConsoleTelemetry } from "./console-telemetry";
@@ -1,5 +1,5 @@
1
1
  export interface Telemetry {
2
- init(): void;
2
+ init(...args: any[]): void;
3
3
  trackError(error: Error): void;
4
4
  setCustomContext(key: string, value: string): void;
5
5
  setTransaction(name: string): void;