@schorts/shared-kernel 3.0.0 โ†’ 3.1.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,12 @@ 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
+ ## [3.1.0] - 2025-10-16
9
+
10
+ ### Added
11
+
12
+ - Added `pub-sub` module.
13
+
8
14
  ## [3.0.0] - 2025-10-15
9
15
 
10
16
  ### Changed
package/README.md CHANGED
@@ -39,6 +39,11 @@ npm install @schorts/shared-kernel --save
39
39
  - **EventSubscriber:** Interface for subscribing to specific event types with clean, type-safe handlers.
40
40
  - **InMemoryEventStore:** Simple event store for tracking and replaying events, with retry metadata and bounded requeue support.
41
41
 
42
+ ### ๐Ÿ“ก Pub-Sub
43
+
44
+ - **Publisher:** Abstract interface for dispatching real-time events to external transports (e.g., Pusher, Socket.IO). Designed for event delivery, enabling type-safe, decoupled publishing from domain logic.
45
+ - **Subscription:** Client-side abstraction for subscribing to real-time channels and binding event handlers. Supports channel access and dynamic event routing.
46
+
42
47
  ### ๐Ÿงน Formatters
43
48
 
44
49
  - **PascalCamelToSnake:** Utility for converting PascalCase or camelCase to snake_case.
package/dist/cjs/index.js CHANGED
@@ -26,6 +26,7 @@ __exportStar(require("./i18n"), exports);
26
26
  __exportStar(require("./json-api"), exports);
27
27
  __exportStar(require("./messages"), exports);
28
28
  __exportStar(require("./models"), exports);
29
+ __exportStar(require("./pub-sub"), exports);
29
30
  __exportStar(require("./rbac"), exports);
30
31
  __exportStar(require("./result"), exports);
31
32
  __exportStar(require("./state-manager"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,6CAA2B;AAC3B,wCAAsB;AACtB,kDAAgC;AAChC,6CAA2B;AAC3B,8CAA4B;AAC5B,+CAA6B;AAC7B,yCAAuB;AACvB,yCAAuB;AACvB,6CAA2B;AAC3B,6CAA2B;AAC3B,2CAAyB;AACzB,yCAAuB;AACvB,2CAAyB;AACzB,kDAAgC;AAChC,iDAA+B;AAC/B,0CAAwB;AACxB,kDAAgC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,6CAA2B;AAC3B,wCAAsB;AACtB,kDAAgC;AAChC,6CAA2B;AAC3B,8CAA4B;AAC5B,+CAA6B;AAC7B,yCAAuB;AACvB,yCAAuB;AACvB,6CAA2B;AAC3B,6CAA2B;AAC3B,2CAAyB;AACzB,4CAA0B;AAC1B,yCAAuB;AACvB,2CAAyB;AACzB,kDAAgC;AAChC,iDAA+B;AAC/B,0CAAwB;AACxB,kDAAgC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/pub-sub/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=publisher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publisher.js","sourceRoot":"","sources":["../../../src/pub-sub/publisher.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=subscription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscription.js","sourceRoot":"","sources":["../../../src/pub-sub/subscription.ts"],"names":[],"mappings":""}
package/dist/esm/index.js CHANGED
@@ -26,6 +26,7 @@ __exportStar(require("./i18n"), exports);
26
26
  __exportStar(require("./json-api"), exports);
27
27
  __exportStar(require("./messages"), exports);
28
28
  __exportStar(require("./models"), exports);
29
+ __exportStar(require("./pub-sub"), exports);
29
30
  __exportStar(require("./rbac"), exports);
30
31
  __exportStar(require("./result"), exports);
31
32
  __exportStar(require("./state-manager"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,6CAA2B;AAC3B,wCAAsB;AACtB,kDAAgC;AAChC,6CAA2B;AAC3B,8CAA4B;AAC5B,+CAA6B;AAC7B,yCAAuB;AACvB,yCAAuB;AACvB,6CAA2B;AAC3B,6CAA2B;AAC3B,2CAAyB;AACzB,yCAAuB;AACvB,2CAAyB;AACzB,kDAAgC;AAChC,iDAA+B;AAC/B,0CAAwB;AACxB,kDAAgC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,6CAA2B;AAC3B,wCAAsB;AACtB,kDAAgC;AAChC,6CAA2B;AAC3B,8CAA4B;AAC5B,+CAA6B;AAC7B,yCAAuB;AACvB,yCAAuB;AACvB,6CAA2B;AAC3B,6CAA2B;AAC3B,2CAAyB;AACzB,4CAA0B;AAC1B,yCAAuB;AACvB,2CAAyB;AACzB,kDAAgC;AAChC,iDAA+B;AAC/B,0CAAwB;AACxB,kDAAgC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/pub-sub/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=publisher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publisher.js","sourceRoot":"","sources":["../../../src/pub-sub/publisher.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=subscription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscription.js","sourceRoot":"","sources":["../../../src/pub-sub/subscription.ts"],"names":[],"mappings":""}
@@ -10,6 +10,7 @@ export * from "./i18n";
10
10
  export * from "./json-api";
11
11
  export * from "./messages";
12
12
  export * from "./models";
13
+ export * from "./pub-sub";
13
14
  export * from "./rbac";
14
15
  export * from "./result";
15
16
  export * from "./state-manager";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export type { Publisher } from "./publisher";
2
+ export type { Subscription } from "./subscription";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pub-sub/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export interface Publisher {
2
+ publish(channel: string, event: string, payload: any): Promise<void>;
3
+ }
4
+ //# sourceMappingURL=publisher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publisher.d.ts","sourceRoot":"","sources":["../../../src/pub-sub/publisher.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtE"}
@@ -0,0 +1,7 @@
1
+ export interface Subscription {
2
+ connect(): void;
3
+ subscribe(channel: string, event: string, handler: (payload: any) => void): void;
4
+ unsubscribe(channel: string): void;
5
+ disconnect(): void;
6
+ }
7
+ //# sourceMappingURL=subscription.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../../src/pub-sub/subscription.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schorts/shared-kernel",
3
- "version": "3.0.0",
3
+ "version": "3.1.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",
@@ -71,6 +71,11 @@
71
71
  "require": "./dist/cjs/models/index.js",
72
72
  "types": "./dist/types/models/index.d.ts"
73
73
  },
74
+ "./pub-sub": {
75
+ "import": "./dist/esm/pub-sub/index.js",
76
+ "require": "./dist/cjs/pub-sub/index.js",
77
+ "types": "./dist/types/pub-sub/index.d.ts"
78
+ },
74
79
  "./rbac": {
75
80
  "import": "./dist/esm/rbac/index.js",
76
81
  "require": "./dist/cjs/rbac/index.js",
package/src/index.ts CHANGED
@@ -10,6 +10,7 @@ export * from "./i18n";
10
10
  export * from "./json-api";
11
11
  export * from "./messages";
12
12
  export * from "./models";
13
+ export * from "./pub-sub";
13
14
  export * from "./rbac";
14
15
  export * from "./result";
15
16
  export * from "./state-manager";
@@ -0,0 +1,2 @@
1
+ export type { Publisher } from "./publisher";
2
+ export type { Subscription } from "./subscription";
@@ -0,0 +1,3 @@
1
+ export interface Publisher {
2
+ publish(channel: string, event: string, payload: any): Promise<void>;
3
+ }
@@ -0,0 +1,6 @@
1
+ export interface Subscription {
2
+ connect(): void;
3
+ subscribe(channel: string, event: string, handler: (payload: any) => void): void;
4
+ unsubscribe(channel: string): void;
5
+ disconnect(): void;
6
+ }