@leancodepl/api-binary 8.4.0 → 8.5.1

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/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # @leancodepl/api-binary
2
+
3
+ Type-safe binary data handling for API communication.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @leancodepl/api-binary
9
+ # or
10
+ yarn add @leancodepl/api-binary
11
+ ```
12
+
13
+ ## API
14
+
15
+ ### `toRaw(apiBinary)`
16
+
17
+ Converts ApiBinary to raw string representation.
18
+
19
+ **Parameters:**
20
+
21
+ - `apiBinary: ApiBinary` - The ApiBinary value to convert
22
+
23
+ **Returns:** Raw string representation of the binary data
24
+
25
+ ### `fromRaw(apiBinaryRaw)`
26
+
27
+ Converts raw string to ApiBinary type.
28
+
29
+ **Parameters:**
30
+
31
+ - `apiBinaryRaw: ApiBinaryRaw` - The raw string representation to convert
32
+
33
+ **Returns:** ApiBinary instance from the raw string
34
+
35
+ ## Usage Examples
36
+
37
+ ### Basic Conversion
38
+
39
+ ```typescript
40
+ import { fromRaw, toRaw } from "@leancodepl/api-binary"
41
+
42
+ const binary = fromRaw("SGVsbG8gV29ybGQ=")
43
+ const raw = toRaw(binary)
44
+ console.log(raw) // 'SGVsbG8gV29ybGQ='
45
+ ```
package/index.cjs.js CHANGED
@@ -1,9 +1,34 @@
1
1
  'use strict';
2
2
 
3
- function toRaw(apiBinary) {
3
+ /**
4
+ * Converts ApiBinary to raw string representation.
5
+ *
6
+ * Transforms the ApiBinary type to its underlying string representation
7
+ * for serialization or API communication.
8
+ *
9
+ * @param apiBinary - The ApiBinary value to convert
10
+ * @returns Raw string representation of the binary data
11
+ * @example
12
+ * ```typescript
13
+ * const binary = fromRaw('SGVsbG8gV29ybGQ=');
14
+ * const raw = toRaw(binary);
15
+ * ```
16
+ */ function toRaw(apiBinary) {
4
17
  return apiBinary;
5
18
  }
6
- function fromRaw(apiBinaryRaw) {
19
+ /**
20
+ * Converts raw string to ApiBinary type.
21
+ *
22
+ * Transforms a raw string representation to the ApiBinary type
23
+ * for type-safe handling of binary data in the application.
24
+ *
25
+ * @param apiBinaryRaw - The raw string representation to convert
26
+ * @returns ApiBinary instance from the raw string
27
+ * @example
28
+ * ```typescript
29
+ * const binary = fromRaw('SGVsbG8gV29ybGQ=');
30
+ * ```
31
+ */ function fromRaw(apiBinaryRaw) {
7
32
  return apiBinaryRaw;
8
33
  }
9
34
 
package/index.esm.js CHANGED
@@ -1,7 +1,32 @@
1
- function toRaw(apiBinary) {
1
+ /**
2
+ * Converts ApiBinary to raw string representation.
3
+ *
4
+ * Transforms the ApiBinary type to its underlying string representation
5
+ * for serialization or API communication.
6
+ *
7
+ * @param apiBinary - The ApiBinary value to convert
8
+ * @returns Raw string representation of the binary data
9
+ * @example
10
+ * ```typescript
11
+ * const binary = fromRaw('SGVsbG8gV29ybGQ=');
12
+ * const raw = toRaw(binary);
13
+ * ```
14
+ */ function toRaw(apiBinary) {
2
15
  return apiBinary;
3
16
  }
4
- function fromRaw(apiBinaryRaw) {
17
+ /**
18
+ * Converts raw string to ApiBinary type.
19
+ *
20
+ * Transforms a raw string representation to the ApiBinary type
21
+ * for type-safe handling of binary data in the application.
22
+ *
23
+ * @param apiBinaryRaw - The raw string representation to convert
24
+ * @returns ApiBinary instance from the raw string
25
+ * @example
26
+ * ```typescript
27
+ * const binary = fromRaw('SGVsbG8gV29ybGQ=');
28
+ * ```
29
+ */ function fromRaw(apiBinaryRaw) {
5
30
  return apiBinaryRaw;
6
31
  }
7
32
 
package/package.json CHANGED
@@ -1,17 +1,48 @@
1
1
  {
2
2
  "name": "@leancodepl/api-binary",
3
- "version": "8.4.0",
3
+ "version": "8.5.1",
4
4
  "license": "Apache-2.0",
5
+ "publishConfig": {
6
+ "access": "public",
7
+ "registry": "https://registry.npmjs.org/"
8
+ },
9
+ "engines": {
10
+ "node": ">=18.0.0"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/leancodepl/js_corelibrary.git",
15
+ "directory": "packages/cqrs-clients/custom-types/binary/api-binary"
16
+ },
17
+ "homepage": "https://github.com/leancodepl/js_corelibrary",
18
+ "bugs": {
19
+ "url": "https://github.com/leancodepl/js_corelibrary/issues"
20
+ },
21
+ "description": "Core binary data types for API communication",
22
+ "keywords": [
23
+ "binary",
24
+ "api",
25
+ "types",
26
+ "serialization",
27
+ "typescript",
28
+ "javascript",
29
+ "leancode"
30
+ ],
31
+ "author": {
32
+ "name": "LeanCode",
33
+ "url": "https://leancode.co"
34
+ },
35
+ "sideEffects": false,
5
36
  "exports": {
6
37
  "./package.json": "./package.json",
7
38
  ".": {
8
39
  "module": "./index.esm.js",
9
- "types": "./index.esm.d.ts",
40
+ "types": "./index.d.ts",
10
41
  "import": "./index.cjs.mjs",
11
42
  "default": "./index.cjs.js"
12
43
  }
13
44
  },
14
45
  "module": "./index.esm.js",
15
46
  "main": "./index.cjs.js",
16
- "types": "./index.esm.d.ts"
47
+ "types": "./index.d.ts"
17
48
  }
package/src/index.d.ts CHANGED
@@ -4,6 +4,33 @@ declare class _ApiBinary {
4
4
  }
5
5
  export interface ApiBinary extends _ApiBinary {
6
6
  }
7
+ /**
8
+ * Converts ApiBinary to raw string representation.
9
+ *
10
+ * Transforms the ApiBinary type to its underlying string representation
11
+ * for serialization or API communication.
12
+ *
13
+ * @param apiBinary - The ApiBinary value to convert
14
+ * @returns Raw string representation of the binary data
15
+ * @example
16
+ * ```typescript
17
+ * const binary = fromRaw('SGVsbG8gV29ybGQ=');
18
+ * const raw = toRaw(binary);
19
+ * ```
20
+ */
7
21
  export declare function toRaw(apiBinary: ApiBinary): ApiBinaryRaw;
22
+ /**
23
+ * Converts raw string to ApiBinary type.
24
+ *
25
+ * Transforms a raw string representation to the ApiBinary type
26
+ * for type-safe handling of binary data in the application.
27
+ *
28
+ * @param apiBinaryRaw - The raw string representation to convert
29
+ * @returns ApiBinary instance from the raw string
30
+ * @example
31
+ * ```typescript
32
+ * const binary = fromRaw('SGVsbG8gV29ybGQ=');
33
+ * ```
34
+ */
8
35
  export declare function fromRaw(apiBinaryRaw: ApiBinaryRaw): ApiBinary;
9
36
  export {};
package/index.esm.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./src/index";
File without changes