@schorts/shared-kernel 3.1.3 → 3.1.4

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.4] - 2025-10-18
9
+
10
+ ### Added
11
+
12
+ - Added `converters` module.
13
+
8
14
  ## [3.1.3] - 2025-10-18
9
15
 
10
16
  ### Added
package/README.md CHANGED
@@ -96,6 +96,9 @@ Translation keys are centralized in registries for discoverability and tooling,
96
96
  - **ArrayValue**
97
97
  - **ObjectValue**
98
98
 
99
+ ### 🔄 Converters
100
+ - **RemoteFileToBase64:** Utility for converting remote files (via URL) into base64-encoded strings. Accepts a URL and returns a base64 representation using an injected `HTTPProvider`, enabling infrastructure-agnostic file transformation. Useful for image uploads, previews, and binary transport across domains.
101
+
99
102
  Each value object enforces domain constraints and immutability, ensuring correctness at the boundary of your system.
100
103
 
101
104
  ## 🧠 Philosophy
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RemoteFileToBase64 = void 0;
4
+ var remote_file_to_base64_1 = require("./remote-file-to-base64");
5
+ Object.defineProperty(exports, "RemoteFileToBase64", { enumerable: true, get: function () { return remote_file_to_base64_1.RemoteFileToBase64; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/converters/index.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAApD,2HAAA,kBAAkB,OAAA"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RemoteFileToBase64 = void 0;
4
+ class RemoteFileToBase64 {
5
+ httpProvider;
6
+ constructor(httpProvider) {
7
+ this.httpProvider = httpProvider;
8
+ }
9
+ async convert(url) {
10
+ const blob = await this.httpProvider.get(url);
11
+ return new Promise((resolve, reject) => {
12
+ const reader = new FileReader();
13
+ reader.readAsDataURL(blob);
14
+ reader.onload = () => resolve(reader.result);
15
+ reader.onerror = (error) => reject(error);
16
+ });
17
+ }
18
+ }
19
+ exports.RemoteFileToBase64 = RemoteFileToBase64;
20
+ //# sourceMappingURL=remote-file-to-base64.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote-file-to-base64.js","sourceRoot":"","sources":["../../../src/converters/remote-file-to-base64.ts"],"names":[],"mappings":";;;AAEA,MAAa,kBAAkB;IAEV;IADnB,YACmB,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IAC1C,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,GAAQ;QACpB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,GAAG,CAAO,GAAG,CAAC,CAAC;QAEpD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;YAEhC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YAC3B,MAAM,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,MAAgB,CAAC,CAAC;YACvD,MAAM,CAAC,OAAO,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAhBD,gDAgBC"}
package/dist/cjs/index.js CHANGED
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./auth"), exports);
18
+ __exportStar(require("./converters"), exports);
18
19
  __exportStar(require("./criteria"), exports);
19
20
  __exportStar(require("./dao"), exports);
20
21
  __exportStar(require("./domain-events"), 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,4CAA0B;AAC1B,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,+CAA6B;AAC7B,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,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RemoteFileToBase64 = void 0;
4
+ var remote_file_to_base64_1 = require("./remote-file-to-base64");
5
+ Object.defineProperty(exports, "RemoteFileToBase64", { enumerable: true, get: function () { return remote_file_to_base64_1.RemoteFileToBase64; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/converters/index.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAApD,2HAAA,kBAAkB,OAAA"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RemoteFileToBase64 = void 0;
4
+ class RemoteFileToBase64 {
5
+ httpProvider;
6
+ constructor(httpProvider) {
7
+ this.httpProvider = httpProvider;
8
+ }
9
+ async convert(url) {
10
+ const blob = await this.httpProvider.get(url);
11
+ return new Promise((resolve, reject) => {
12
+ const reader = new FileReader();
13
+ reader.readAsDataURL(blob);
14
+ reader.onload = () => resolve(reader.result);
15
+ reader.onerror = (error) => reject(error);
16
+ });
17
+ }
18
+ }
19
+ exports.RemoteFileToBase64 = RemoteFileToBase64;
20
+ //# sourceMappingURL=remote-file-to-base64.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote-file-to-base64.js","sourceRoot":"","sources":["../../../src/converters/remote-file-to-base64.ts"],"names":[],"mappings":";;;AAEA,MAAa,kBAAkB;IAEV;IADnB,YACmB,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IAC1C,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,GAAQ;QACpB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,GAAG,CAAO,GAAG,CAAC,CAAC;QAEpD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;YAEhC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YAC3B,MAAM,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,MAAgB,CAAC,CAAC;YACvD,MAAM,CAAC,OAAO,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAhBD,gDAgBC"}
package/dist/esm/index.js CHANGED
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./auth"), exports);
18
+ __exportStar(require("./converters"), exports);
18
19
  __exportStar(require("./criteria"), exports);
19
20
  __exportStar(require("./dao"), exports);
20
21
  __exportStar(require("./domain-events"), 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,4CAA0B;AAC1B,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,+CAA6B;AAC7B,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,2 @@
1
+ export { RemoteFileToBase64 } from "./remote-file-to-base64";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/converters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { HTTPProvider } from "../http";
2
+ export declare class RemoteFileToBase64 {
3
+ private readonly httpProvider;
4
+ constructor(httpProvider: HTTPProvider);
5
+ convert(url: URL): Promise<string>;
6
+ }
7
+ //# sourceMappingURL=remote-file-to-base64.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote-file-to-base64.d.ts","sourceRoot":"","sources":["../../../src/converters/remote-file-to-base64.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,qBAAa,kBAAkB;IAE3B,OAAO,CAAC,QAAQ,CAAC,YAAY;gBAAZ,YAAY,EAAE,YAAY;IAGvC,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;CAWzC"}
@@ -1,4 +1,5 @@
1
1
  export * from "./auth";
2
+ export * from "./converters";
2
3
  export * from "./criteria";
3
4
  export * from "./dao";
4
5
  export * from "./domain-events";
@@ -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,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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schorts/shared-kernel",
3
- "version": "3.1.3",
3
+ "version": "3.1.4",
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",
@@ -16,6 +16,11 @@
16
16
  "require": "./dist/cjs/auth/index.js",
17
17
  "types": "./dist/types/auth/index.d.ts"
18
18
  },
19
+ "./converters": {
20
+ "import": "./dist/esm/converters/index.js",
21
+ "require": "./dist/cjs/converters/index.js",
22
+ "types": "./dist/types/converters/index.d.ts"
23
+ },
19
24
  "./criteria": {
20
25
  "import": "./dist/esm/criteria/index.js",
21
26
  "require": "./dist/cjs/criteria/index.js",
@@ -0,0 +1 @@
1
+ export { RemoteFileToBase64 } from "./remote-file-to-base64";
@@ -0,0 +1,19 @@
1
+ import { HTTPProvider } from "../http";
2
+
3
+ export class RemoteFileToBase64 {
4
+ constructor(
5
+ private readonly httpProvider: HTTPProvider,
6
+ ) {}
7
+
8
+ async convert(url: URL): Promise<string> {
9
+ const blob = await this.httpProvider.get<Blob>(url);
10
+
11
+ return new Promise((resolve, reject) => {
12
+ const reader = new FileReader();
13
+
14
+ reader.readAsDataURL(blob);
15
+ reader.onload = () => resolve(reader.result as string);
16
+ reader.onerror = (error) => reject(error);
17
+ });
18
+ }
19
+ }
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./auth";
2
+ export * from "./converters";
2
3
  export * from "./criteria";
3
4
  export * from "./dao";
4
5
  export * from "./domain-events";