@nhtio/encoder 0.1.0-master-ab456424
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/LICENSE.md +9 -0
- package/README.md +5 -0
- package/exceptions-BHfZbUPp.mjs +168 -0
- package/exceptions-BHfZbUPp.mjs.map +1 -0
- package/exceptions-iBYg29S4.js +2 -0
- package/exceptions-iBYg29S4.js.map +1 -0
- package/exceptions.cjs +2 -0
- package/exceptions.cjs.map +1 -0
- package/exceptions.d.ts +8 -0
- package/exceptions.mjs +11 -0
- package/exceptions.mjs.map +1 -0
- package/index.cjs +207 -0
- package/index.cjs.map +1 -0
- package/index.d.ts +27 -0
- package/index.mjs +54623 -0
- package/index.mjs.map +1 -0
- package/package.json +31 -0
- package/private/exceptions.d.ts +153 -0
- package/private/function_serializer.d.ts +32 -0
- package/private/schemas.d.ts +27 -0
- package/private/stringification.d.ts +12 -0
- package/private/structured_data.d.ts +10 -0
- package/private/type_guards.d.ts +59 -0
- package/private/types.d.ts +16 -0
- package/types.cjs +2 -0
- package/types.cjs.map +1 -0
- package/types.d.ts +9 -0
- package/types.mjs +2 -0
- package/types.mjs.map +1 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Encodable } from './private/types';
|
|
2
|
+
/**
|
|
3
|
+
* The current version of the package.
|
|
4
|
+
*
|
|
5
|
+
* @tip This is a constant that is replaced during the build process with the actual version of the package.
|
|
6
|
+
*/
|
|
7
|
+
export declare const version: string;
|
|
8
|
+
/**
|
|
9
|
+
* Encodes a value into a compressed base64 string
|
|
10
|
+
* @param what The value to be encoded
|
|
11
|
+
* @returns A compressed base64 string representing the encoded value
|
|
12
|
+
* @throws {@link @nhtio/encoder/exceptions!E_ENCODING_FAILED | E_ENCODING_FAILED} When the value cannot be encoded
|
|
13
|
+
* @throws {@link @nhtio/encoder/exceptions!E_CIRCULAR_REFERENCE | E_CIRCULAR_REFERENCE} When the value contains dangerous circular references
|
|
14
|
+
* @throws {@link @nhtio/encoder/exceptions!E_UNENCODABLE_VALUE | E_UNENCODABLE_VALUE} When the value contains unencodable data types
|
|
15
|
+
*/
|
|
16
|
+
export declare const encode: <T extends Encodable = Encodable>(what: T) => string;
|
|
17
|
+
/**
|
|
18
|
+
* Decodes a compressed base64 string back into a value
|
|
19
|
+
* @param base64 The compressed base64 string representing an encoded value
|
|
20
|
+
* @returns The decoded value
|
|
21
|
+
* @throws {@link @nhtio/encoder/exceptions!E_NOT_AN_ENCODED_VALUE | E_NOT_AN_ENCODED_VALUE} When the provided string is not a valid encoded value
|
|
22
|
+
* @throws {@link @nhtio/encoder/exceptions!E_INVALID_VERSION | E_INVALID_VERSION} When the encoded value has an invalid version
|
|
23
|
+
* @throws {@link @nhtio/encoder/exceptions!E_INCOMPATIBLE_VERSION | E_INCOMPATIBLE_VERSION} When the encoded value is from a version that is newer than the decoder version
|
|
24
|
+
* @throws {@link @nhtio/encoder/exceptions!E_UNDECODABLE_VALUE | E_UNDECODABLE_VALUE} When the encoded value cannot be decoded
|
|
25
|
+
*/
|
|
26
|
+
export declare const decode: <T extends Encodable = Encodable>(base64: string) => T;
|
|
27
|
+
export type { Encodable, EncodablePrimitive, EncodableTypedArray } from './private/types';
|