@leancodepl/api-binary 8.5.0 → 8.6.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/README.md +45 -0
- package/index.cjs.default.js +1 -0
- package/index.cjs.js +36 -0
- package/index.cjs.mjs +2 -0
- package/index.d.ts +1 -0
- package/index.esm.js +33 -0
- package/package.json +1 -6
- package/src/index.d.ts +36 -0
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
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
exports._default = require('./index.cjs.js').default;
|
package/index.cjs.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
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) {
|
|
17
|
+
return apiBinary;
|
|
18
|
+
}
|
|
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) {
|
|
32
|
+
return apiBinaryRaw;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
exports.fromRaw = fromRaw;
|
|
36
|
+
exports.toRaw = toRaw;
|
package/index.cjs.mjs
ADDED
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/index";
|
package/index.esm.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
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) {
|
|
15
|
+
return apiBinary;
|
|
16
|
+
}
|
|
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) {
|
|
30
|
+
return apiBinaryRaw;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { fromRaw, toRaw };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leancodepl/api-binary",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.6.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -32,11 +32,6 @@
|
|
|
32
32
|
"name": "LeanCode",
|
|
33
33
|
"url": "https://leancode.co"
|
|
34
34
|
},
|
|
35
|
-
"files": [
|
|
36
|
-
"dist",
|
|
37
|
-
"README.md",
|
|
38
|
-
"CHANGELOG.md"
|
|
39
|
-
],
|
|
40
35
|
"sideEffects": false,
|
|
41
36
|
"exports": {
|
|
42
37
|
"./package.json": "./package.json",
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type ApiBinaryRaw = string;
|
|
2
|
+
declare class _ApiBinary {
|
|
3
|
+
private _;
|
|
4
|
+
}
|
|
5
|
+
export interface ApiBinary extends _ApiBinary {
|
|
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
|
+
*/
|
|
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
|
+
*/
|
|
35
|
+
export declare function fromRaw(apiBinaryRaw: ApiBinaryRaw): ApiBinary;
|
|
36
|
+
export {};
|