@solana/codecs-core 2.0.0-canary-20240731173615
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 +20 -0
- package/README.md +665 -0
- package/dist/index.browser.cjs +504 -0
- package/dist/index.browser.cjs.map +1 -0
- package/dist/index.browser.mjs +460 -0
- package/dist/index.browser.mjs.map +1 -0
- package/dist/index.native.mjs +460 -0
- package/dist/index.native.mjs.map +1 -0
- package/dist/index.node.cjs +504 -0
- package/dist/index.node.cjs.map +1 -0
- package/dist/index.node.mjs +460 -0
- package/dist/index.node.mjs.map +1 -0
- package/dist/types/add-codec-sentinel.d.ts +27 -0
- package/dist/types/add-codec-sentinel.d.ts.map +1 -0
- package/dist/types/add-codec-size-prefix.d.ts +24 -0
- package/dist/types/add-codec-size-prefix.d.ts.map +1 -0
- package/dist/types/assertions.d.ts +17 -0
- package/dist/types/assertions.d.ts.map +1 -0
- package/dist/types/bytes.d.ts +23 -0
- package/dist/types/bytes.d.ts.map +1 -0
- package/dist/types/codec.d.ts +123 -0
- package/dist/types/codec.d.ts.map +1 -0
- package/dist/types/combine-codec.d.ts +10 -0
- package/dist/types/combine-codec.d.ts.map +1 -0
- package/dist/types/fix-codec-size.d.ts +23 -0
- package/dist/types/fix-codec-size.d.ts.map +1 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/offset-codec.d.ts +38 -0
- package/dist/types/offset-codec.d.ts.map +1 -0
- package/dist/types/pad-codec.d.ts +30 -0
- package/dist/types/pad-codec.d.ts.map +1 -0
- package/dist/types/readonly-uint8array.d.ts +6 -0
- package/dist/types/readonly-uint8array.d.ts.map +1 -0
- package/dist/types/resize-codec.d.ts +21 -0
- package/dist/types/resize-codec.d.ts.map +1 -0
- package/dist/types/reverse-codec.d.ts +14 -0
- package/dist/types/reverse-codec.d.ts.map +1 -0
- package/dist/types/transform-codec.d.ts +24 -0
- package/dist/types/transform-codec.d.ts.map +1 -0
- package/package.json +82 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Codec, Decoder, Encoder, FixedSizeCodec, FixedSizeDecoder, FixedSizeEncoder, VariableSizeCodec, VariableSizeDecoder, VariableSizeEncoder } from './codec';
|
|
2
|
+
type NumberEncoder = Encoder<bigint | number> | Encoder<number>;
|
|
3
|
+
type FixedSizeNumberEncoder<TSize extends number = number> = FixedSizeEncoder<bigint | number, TSize> | FixedSizeEncoder<number, TSize>;
|
|
4
|
+
type NumberDecoder = Decoder<bigint> | Decoder<number>;
|
|
5
|
+
type FixedSizeNumberDecoder<TSize extends number = number> = FixedSizeDecoder<bigint, TSize> | FixedSizeDecoder<number, TSize>;
|
|
6
|
+
type NumberCodec = Codec<bigint | number, bigint> | Codec<number>;
|
|
7
|
+
type FixedSizeNumberCodec<TSize extends number = number> = FixedSizeCodec<bigint | number, bigint, TSize> | FixedSizeCodec<number, number, TSize>;
|
|
8
|
+
/**
|
|
9
|
+
* Stores the size of the `encoder` in bytes as a prefix using the `prefix` encoder.
|
|
10
|
+
*/
|
|
11
|
+
export declare function addEncoderSizePrefix<TFrom>(encoder: FixedSizeEncoder<TFrom>, prefix: FixedSizeNumberEncoder): FixedSizeEncoder<TFrom>;
|
|
12
|
+
export declare function addEncoderSizePrefix<TFrom>(encoder: Encoder<TFrom>, prefix: NumberEncoder): VariableSizeEncoder<TFrom>;
|
|
13
|
+
/**
|
|
14
|
+
* Bounds the size of the `decoder` by reading the `prefix` encoder prefix.
|
|
15
|
+
*/
|
|
16
|
+
export declare function addDecoderSizePrefix<TTo>(decoder: FixedSizeDecoder<TTo>, prefix: FixedSizeNumberDecoder): FixedSizeDecoder<TTo>;
|
|
17
|
+
export declare function addDecoderSizePrefix<TTo>(decoder: Decoder<TTo>, prefix: NumberDecoder): VariableSizeDecoder<TTo>;
|
|
18
|
+
/**
|
|
19
|
+
* Bounds the size of the `codec` using the provided `prefix` codec prefix.
|
|
20
|
+
*/
|
|
21
|
+
export declare function addCodecSizePrefix<TFrom, TTo extends TFrom>(codec: FixedSizeCodec<TFrom, TTo>, prefix: FixedSizeNumberCodec): FixedSizeCodec<TFrom, TTo>;
|
|
22
|
+
export declare function addCodecSizePrefix<TFrom, TTo extends TFrom>(codec: Codec<TFrom, TTo>, prefix: NumberCodec): VariableSizeCodec<TFrom, TTo>;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=add-codec-size-prefix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-codec-size-prefix.d.ts","sourceRoot":"","sources":["../../src/add-codec-size-prefix.ts"],"names":[],"mappings":"AACA,OAAO,EACH,KAAK,EAGL,OAAO,EACP,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAGhB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,SAAS,CAAC;AAGjB,KAAK,aAAa,GAAG,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAChE,KAAK,sBAAsB,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,IACnD,gBAAgB,CAAC,MAAM,GAAG,MAAM,EAAE,KAAK,CAAC,GACxC,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACtC,KAAK,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AACvD,KAAK,sBAAsB,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,IACnD,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,GAC/B,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACtC,KAAK,WAAW,GAAG,KAAK,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;AAClE,KAAK,oBAAoB,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,IACjD,cAAc,CAAC,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+
*/
|
|
5
|
+
export declare function assertByteArrayIsNotEmptyForCodec(codecDescription: string, bytes: ReadonlyUint8Array | Uint8Array, offset?: number): void;
|
|
6
|
+
/**
|
|
7
|
+
* Asserts that a given byte array has enough bytes to decode.
|
|
8
|
+
*/
|
|
9
|
+
export declare function assertByteArrayHasEnoughBytesForCodec(codecDescription: string, expected: number, bytes: ReadonlyUint8Array | Uint8Array, offset?: number): void;
|
|
10
|
+
/**
|
|
11
|
+
* Asserts that a given offset is within the byte array bounds.
|
|
12
|
+
* This range is between 0 and the byte array length and is inclusive.
|
|
13
|
+
* An offset equals to the byte array length is considered a valid offset
|
|
14
|
+
* as it allows the post-offset of codecs to signal the end of the byte array.
|
|
15
|
+
*/
|
|
16
|
+
export declare function assertByteArrayOffsetIsNotOutOfRange(codecDescription: string, offset: number, bytesLength: number): void;
|
|
17
|
+
//# sourceMappingURL=assertions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertions.d.ts","sourceRoot":"","sources":["../../src/assertions.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;GAEG;AACH,wBAAgB,iCAAiC,CAC7C,gBAAgB,EAAE,MAAM,EACxB,KAAK,EAAE,kBAAkB,GAAG,UAAU,EACtC,MAAM,SAAI,QAOb;AAED;;GAEG;AACH,wBAAgB,qCAAqC,CACjD,gBAAgB,EAAE,MAAM,EACxB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,kBAAkB,GAAG,UAAU,EACtC,MAAM,SAAI,QAUb;AAED;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAAC,gBAAgB,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,QAQjH"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReadonlyUint8Array } from './readonly-uint8array';
|
|
2
|
+
/**
|
|
3
|
+
* Concatenates an array of `Uint8Array`s into a single `Uint8Array`.
|
|
4
|
+
* Reuses the original byte array when applicable.
|
|
5
|
+
*/
|
|
6
|
+
export declare const mergeBytes: (byteArrays: Uint8Array[]) => Uint8Array;
|
|
7
|
+
/**
|
|
8
|
+
* Pads a `Uint8Array` with zeroes to the specified length.
|
|
9
|
+
* If the array is longer than the specified length, it is returned as-is.
|
|
10
|
+
*/
|
|
11
|
+
export declare const padBytes: (bytes: ReadonlyUint8Array | Uint8Array, length: number) => ReadonlyUint8Array | Uint8Array;
|
|
12
|
+
/**
|
|
13
|
+
* Fixes a `Uint8Array` to the specified length.
|
|
14
|
+
* If the array is longer than the specified length, it is truncated.
|
|
15
|
+
* If the array is shorter than the specified length, it is padded with zeroes.
|
|
16
|
+
*/
|
|
17
|
+
export declare const fixBytes: (bytes: ReadonlyUint8Array | Uint8Array, length: number) => ReadonlyUint8Array | Uint8Array;
|
|
18
|
+
/**
|
|
19
|
+
* Returns true if and only if the provided `data` byte array contains
|
|
20
|
+
* the provided `bytes` byte array at the specified `offset`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function containsBytes(data: ReadonlyUint8Array | Uint8Array, bytes: ReadonlyUint8Array | Uint8Array, offset: number): boolean;
|
|
23
|
+
//# sourceMappingURL=bytes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["../../src/bytes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,UAAU,eAAgB,UAAU,EAAE,KAAG,UAkBrD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ,UAAW,kBAAkB,GAAG,UAAU,UAAU,MAAM,KAAG,kBAAkB,GAAG,UAKtG,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,QAAQ,UAAW,kBAAkB,GAAG,UAAU,UAAU,MAAM,KAAG,kBAAkB,GAAG,UAC1B,CAAC;AAE9E;;;GAGG;AACH,wBAAgB,aAAa,CACzB,IAAI,EAAE,kBAAkB,GAAG,UAAU,EACrC,KAAK,EAAE,kBAAkB,GAAG,UAAU,EACtC,MAAM,EAAE,MAAM,GACf,OAAO,CAIT"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { ReadonlyUint8Array } from './readonly-uint8array';
|
|
2
|
+
/**
|
|
3
|
+
* Defines an offset in bytes.
|
|
4
|
+
*/
|
|
5
|
+
export type Offset = number;
|
|
6
|
+
type BaseEncoder<TFrom> = {
|
|
7
|
+
/** Encode the provided value and return the encoded bytes directly. */
|
|
8
|
+
readonly encode: (value: TFrom) => ReadonlyUint8Array;
|
|
9
|
+
/**
|
|
10
|
+
* Writes the encoded value into the provided byte array at the given offset.
|
|
11
|
+
* Returns the offset of the next byte after the encoded value.
|
|
12
|
+
*/
|
|
13
|
+
readonly write: (value: TFrom, bytes: Uint8Array, offset: Offset) => Offset;
|
|
14
|
+
};
|
|
15
|
+
export type FixedSizeEncoder<TFrom, TSize extends number = number> = BaseEncoder<TFrom> & {
|
|
16
|
+
/** The fixed size of the encoded value in bytes. */
|
|
17
|
+
readonly fixedSize: TSize;
|
|
18
|
+
};
|
|
19
|
+
export type VariableSizeEncoder<TFrom> = BaseEncoder<TFrom> & {
|
|
20
|
+
/** The total size of the encoded value in bytes. */
|
|
21
|
+
readonly getSizeFromValue: (value: TFrom) => number;
|
|
22
|
+
/** The maximum size an encoded value can be in bytes, if applicable. */
|
|
23
|
+
readonly maxSize?: number;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* An object that can encode a value to a `Uint8Array`.
|
|
27
|
+
*/
|
|
28
|
+
export type Encoder<TFrom> = FixedSizeEncoder<TFrom> | VariableSizeEncoder<TFrom>;
|
|
29
|
+
type BaseDecoder<TTo> = {
|
|
30
|
+
/** Decodes the provided byte array at the given offset (or zero) and returns the value directly. */
|
|
31
|
+
readonly decode: (bytes: ReadonlyUint8Array | Uint8Array, offset?: Offset) => TTo;
|
|
32
|
+
/**
|
|
33
|
+
* Reads the encoded value from the provided byte array at the given offset.
|
|
34
|
+
* Returns the decoded value and the offset of the next byte after the encoded value.
|
|
35
|
+
*/
|
|
36
|
+
readonly read: (bytes: ReadonlyUint8Array | Uint8Array, offset: Offset) => [TTo, Offset];
|
|
37
|
+
};
|
|
38
|
+
export type FixedSizeDecoder<TTo, TSize extends number = number> = BaseDecoder<TTo> & {
|
|
39
|
+
/** The fixed size of the encoded value in bytes. */
|
|
40
|
+
readonly fixedSize: TSize;
|
|
41
|
+
};
|
|
42
|
+
export type VariableSizeDecoder<TTo> = BaseDecoder<TTo> & {
|
|
43
|
+
/** The maximum size an encoded value can be in bytes, if applicable. */
|
|
44
|
+
readonly maxSize?: number;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* An object that can decode a value from a `Uint8Array`.
|
|
48
|
+
*/
|
|
49
|
+
export type Decoder<TTo> = FixedSizeDecoder<TTo> | VariableSizeDecoder<TTo>;
|
|
50
|
+
export type FixedSizeCodec<TFrom, TTo extends TFrom = TFrom, TSize extends number = number> = FixedSizeDecoder<TTo, TSize> & FixedSizeEncoder<TFrom, TSize>;
|
|
51
|
+
export type VariableSizeCodec<TFrom, TTo extends TFrom = TFrom> = VariableSizeDecoder<TTo> & VariableSizeEncoder<TFrom>;
|
|
52
|
+
/**
|
|
53
|
+
* An object that can encode and decode a value to and from a `Uint8Array`.
|
|
54
|
+
* It supports encoding looser types than it decodes for convenience.
|
|
55
|
+
* For example, a `bigint` encoder will always decode to a `bigint`
|
|
56
|
+
* but can be used to encode a `number`.
|
|
57
|
+
*
|
|
58
|
+
* @typeParam TFrom - The type of the value to encode.
|
|
59
|
+
* @typeParam TTo - The type of the decoded value. Defaults to `TFrom`.
|
|
60
|
+
*/
|
|
61
|
+
export type Codec<TFrom, TTo extends TFrom = TFrom> = FixedSizeCodec<TFrom, TTo> | VariableSizeCodec<TFrom, TTo>;
|
|
62
|
+
/**
|
|
63
|
+
* Get the encoded size of a given value in bytes.
|
|
64
|
+
*/
|
|
65
|
+
export declare function getEncodedSize<TFrom>(value: TFrom, encoder: {
|
|
66
|
+
fixedSize: number;
|
|
67
|
+
} | {
|
|
68
|
+
getSizeFromValue: (value: TFrom) => number;
|
|
69
|
+
}): number;
|
|
70
|
+
/** Fills the missing `encode` function using the existing `write` function. */
|
|
71
|
+
export declare function createEncoder<TFrom, TSize extends number>(encoder: Omit<FixedSizeEncoder<TFrom, TSize>, 'encode'>): FixedSizeEncoder<TFrom, TSize>;
|
|
72
|
+
export declare function createEncoder<TFrom>(encoder: Omit<VariableSizeEncoder<TFrom>, 'encode'>): VariableSizeEncoder<TFrom>;
|
|
73
|
+
export declare function createEncoder<TFrom>(encoder: Omit<FixedSizeEncoder<TFrom>, 'encode'> | Omit<VariableSizeEncoder<TFrom>, 'encode'>): Encoder<TFrom>;
|
|
74
|
+
/** Fills the missing `decode` function using the existing `read` function. */
|
|
75
|
+
export declare function createDecoder<TTo, TSize extends number>(decoder: Omit<FixedSizeDecoder<TTo, TSize>, 'decode'>): FixedSizeDecoder<TTo, TSize>;
|
|
76
|
+
export declare function createDecoder<TTo>(decoder: Omit<VariableSizeDecoder<TTo>, 'decode'>): VariableSizeDecoder<TTo>;
|
|
77
|
+
export declare function createDecoder<TTo>(decoder: Omit<FixedSizeDecoder<TTo>, 'decode'> | Omit<VariableSizeDecoder<TTo>, 'decode'>): Decoder<TTo>;
|
|
78
|
+
/** Fills the missing `encode` and `decode` function using the existing `write` and `read` functions. */
|
|
79
|
+
export declare function createCodec<TFrom, TTo extends TFrom = TFrom, TSize extends number = number>(codec: Omit<FixedSizeCodec<TFrom, TTo, TSize>, 'decode' | 'encode'>): FixedSizeCodec<TFrom, TTo, TSize>;
|
|
80
|
+
export declare function createCodec<TFrom, TTo extends TFrom = TFrom>(codec: Omit<VariableSizeCodec<TFrom, TTo>, 'decode' | 'encode'>): VariableSizeCodec<TFrom, TTo>;
|
|
81
|
+
export declare function createCodec<TFrom, TTo extends TFrom = TFrom>(codec: Omit<FixedSizeCodec<TFrom, TTo>, 'decode' | 'encode'> | Omit<VariableSizeCodec<TFrom, TTo>, 'decode' | 'encode'>): Codec<TFrom, TTo>;
|
|
82
|
+
export declare function isFixedSize<TFrom, TSize extends number>(encoder: FixedSizeEncoder<TFrom, TSize> | VariableSizeEncoder<TFrom>): encoder is FixedSizeEncoder<TFrom, TSize>;
|
|
83
|
+
export declare function isFixedSize<TTo, TSize extends number>(decoder: FixedSizeDecoder<TTo, TSize> | VariableSizeDecoder<TTo>): decoder is FixedSizeDecoder<TTo, TSize>;
|
|
84
|
+
export declare function isFixedSize<TFrom, TTo extends TFrom, TSize extends number>(codec: FixedSizeCodec<TFrom, TTo, TSize> | VariableSizeCodec<TFrom, TTo>): codec is FixedSizeCodec<TFrom, TTo, TSize>;
|
|
85
|
+
export declare function isFixedSize<TSize extends number>(codec: {
|
|
86
|
+
fixedSize: TSize;
|
|
87
|
+
} | {
|
|
88
|
+
maxSize?: number;
|
|
89
|
+
}): codec is {
|
|
90
|
+
fixedSize: TSize;
|
|
91
|
+
};
|
|
92
|
+
export declare function assertIsFixedSize<TFrom, TSize extends number>(encoder: FixedSizeEncoder<TFrom, TSize> | VariableSizeEncoder<TFrom>): asserts encoder is FixedSizeEncoder<TFrom, TSize>;
|
|
93
|
+
export declare function assertIsFixedSize<TTo, TSize extends number>(decoder: FixedSizeDecoder<TTo, TSize> | VariableSizeDecoder<TTo>): asserts decoder is FixedSizeDecoder<TTo, TSize>;
|
|
94
|
+
export declare function assertIsFixedSize<TFrom, TTo extends TFrom, TSize extends number>(codec: FixedSizeCodec<TFrom, TTo, TSize> | VariableSizeCodec<TFrom, TTo>): asserts codec is FixedSizeCodec<TFrom, TTo, TSize>;
|
|
95
|
+
export declare function assertIsFixedSize<TSize extends number>(codec: {
|
|
96
|
+
fixedSize: TSize;
|
|
97
|
+
} | {
|
|
98
|
+
maxSize?: number;
|
|
99
|
+
}): asserts codec is {
|
|
100
|
+
fixedSize: TSize;
|
|
101
|
+
};
|
|
102
|
+
export declare function isVariableSize<TFrom>(encoder: Encoder<TFrom>): encoder is VariableSizeEncoder<TFrom>;
|
|
103
|
+
export declare function isVariableSize<TTo>(decoder: Decoder<TTo>): decoder is VariableSizeDecoder<TTo>;
|
|
104
|
+
export declare function isVariableSize<TFrom, TTo extends TFrom>(codec: Codec<TFrom, TTo>): codec is VariableSizeCodec<TFrom, TTo>;
|
|
105
|
+
export declare function isVariableSize(codec: {
|
|
106
|
+
fixedSize: number;
|
|
107
|
+
} | {
|
|
108
|
+
maxSize?: number;
|
|
109
|
+
}): codec is {
|
|
110
|
+
maxSize?: number;
|
|
111
|
+
};
|
|
112
|
+
export declare function assertIsVariableSize<T>(encoder: Encoder<T>): asserts encoder is VariableSizeEncoder<T>;
|
|
113
|
+
export declare function assertIsVariableSize<T>(decoder: Decoder<T>): asserts decoder is VariableSizeDecoder<T>;
|
|
114
|
+
export declare function assertIsVariableSize<TFrom, TTo extends TFrom>(codec: Codec<TFrom, TTo>): asserts codec is VariableSizeCodec<TFrom, TTo>;
|
|
115
|
+
export declare function assertIsVariableSize(codec: {
|
|
116
|
+
fixedSize: number;
|
|
117
|
+
} | {
|
|
118
|
+
maxSize?: number;
|
|
119
|
+
}): asserts codec is {
|
|
120
|
+
maxSize?: number;
|
|
121
|
+
};
|
|
122
|
+
export {};
|
|
123
|
+
//# sourceMappingURL=codec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../src/codec.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAE5B,KAAK,WAAW,CAAC,KAAK,IAAI;IACtB,uEAAuE;IACvE,QAAQ,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,kBAAkB,CAAC;IACtD;;;O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SizeCodec, VariableSizeDecoder, VariableSizeEncoder } from './codec';
|
|
2
|
+
/**
|
|
3
|
+
* Combines an encoder and a decoder into a codec.
|
|
4
|
+
* The encoder and decoder must have the same fixed size, max size and description.
|
|
5
|
+
* If a description is provided, it will override the encoder and decoder descriptions.
|
|
6
|
+
*/
|
|
7
|
+
export declare function combineCodec<TFrom, TTo extends TFrom, TSize extends number>(encoder: FixedSizeEncoder<TFrom, TSize>, decoder: FixedSizeDecoder<TTo, TSize>): FixedSizeCodec<TFrom, TTo, TSize>;
|
|
8
|
+
export declare function combineCodec<TFrom, TTo extends TFrom>(encoder: VariableSizeEncoder<TFrom>, decoder: VariableSizeDecoder<TTo>): VariableSizeCodec<TFrom, TTo>;
|
|
9
|
+
export declare function combineCodec<TFrom, TTo extends TFrom>(encoder: Encoder<TFrom>, decoder: Decoder<TTo>): Codec<TFrom, TTo>;
|
|
10
|
+
//# sourceMappingURL=combine-codec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combine-codec.d.ts","sourceRoot":"","sources":["../../src/combine-codec.ts"],"names":[],"mappings":"AAOA,OAAO,EACH,KAAK,EACL,OAAO,EACP,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAEhB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,SAAS,CAAC;AAEjB;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,SAAS,KAAK,EAAE,KAAK,SAAS,MAAM,EACvE,OAAO,EAAE,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,EACvC,OAAO,EAAE,gBAAgB,CAAC,GAAG,EAAE,KAAK,CAAC,GACtC,cAAc,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AACrC,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,SAAS,KAAK,EACjD,OAAO,EAAE,mBAAmB,CAAC,KAAK,CAAC,EACnC,OAAO,EAAE,mBAAmB,CAAC,GAAG,CAAC,GAClC,iBAAiB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACjC,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,SAAS,KAAK,EACjD,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,EACvB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,GACtB,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Codec, Decoder, Encoder, FixedSizeCodec, FixedSizeDecoder, FixedSizeEncoder } from './codec';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a fixed-size encoder from a given encoder.
|
|
4
|
+
*
|
|
5
|
+
* @param encoder - The encoder to wrap into a fixed-size encoder.
|
|
6
|
+
* @param fixedBytes - The fixed number of bytes to write.
|
|
7
|
+
*/
|
|
8
|
+
export declare function fixEncoderSize<TFrom, TSize extends number>(encoder: Encoder<TFrom>, fixedBytes: TSize): FixedSizeEncoder<TFrom, TSize>;
|
|
9
|
+
/**
|
|
10
|
+
* Creates a fixed-size decoder from a given decoder.
|
|
11
|
+
*
|
|
12
|
+
* @param decoder - The decoder to wrap into a fixed-size decoder.
|
|
13
|
+
* @param fixedBytes - The fixed number of bytes to read.
|
|
14
|
+
*/
|
|
15
|
+
export declare function fixDecoderSize<TTo, TSize extends number>(decoder: Decoder<TTo>, fixedBytes: TSize): FixedSizeDecoder<TTo, TSize>;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a fixed-size codec from a given codec.
|
|
18
|
+
*
|
|
19
|
+
* @param codec - The codec to wrap into a fixed-size codec.
|
|
20
|
+
* @param fixedBytes - The fixed number of bytes to read/write.
|
|
21
|
+
*/
|
|
22
|
+
export declare function fixCodecSize<TFrom, TTo extends TFrom, TSize extends number>(codec: Codec<TFrom, TTo>, fixedBytes: TSize): FixedSizeCodec<TFrom, TTo, TSize>;
|
|
23
|
+
//# sourceMappingURL=fix-codec-size.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fix-codec-size.d.ts","sourceRoot":"","sources":["../../src/fix-codec-size.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,EAGL,OAAO,EACP,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAGnB,MAAM,SAAS,CAAC;AAGjB;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,SAAS,MAAM,EACtD,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,EACvB,UAAU,EAAE,KAAK,GAClB,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,CAchC;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,KAAK,SAAS,MAAM,EACpD,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,EACrB,UAAU,EAAE,KAAK,GAClB,gBAAgB,CAAC,GAAG,EAAE,KAAK,CAAC,CAkB9B;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,SAAS,KAAK,EAAE,KAAK,SAAS,MAAM,EACvE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,EACxB,UAAU,EAAE,KAAK,GAClB,cAAc,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,CAEnC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './add-codec-sentinel';
|
|
2
|
+
export * from './add-codec-size-prefix';
|
|
3
|
+
export * from './assertions';
|
|
4
|
+
export * from './bytes';
|
|
5
|
+
export * from './codec';
|
|
6
|
+
export * from './combine-codec';
|
|
7
|
+
export * from './fix-codec-size';
|
|
8
|
+
export * from './offset-codec';
|
|
9
|
+
export * from './pad-codec';
|
|
10
|
+
export * from './readonly-uint8array';
|
|
11
|
+
export * from './resize-codec';
|
|
12
|
+
export * from './reverse-codec';
|
|
13
|
+
export * from './transform-codec';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Codec, Decoder, Encoder, Offset } from './codec';
|
|
2
|
+
import { ReadonlyUint8Array } from './readonly-uint8array';
|
|
3
|
+
type AnyEncoder = Encoder<any>;
|
|
4
|
+
type AnyDecoder = Decoder<any>;
|
|
5
|
+
type AnyCodec = Codec<any>;
|
|
6
|
+
type OffsetConfig = {
|
|
7
|
+
postOffset?: PostOffsetFunction;
|
|
8
|
+
preOffset?: PreOffsetFunction;
|
|
9
|
+
};
|
|
10
|
+
type PreOffsetFunctionScope = {
|
|
11
|
+
/** The entire byte array. */
|
|
12
|
+
bytes: ReadonlyUint8Array | Uint8Array;
|
|
13
|
+
/** The original offset prior to encode or decode. */
|
|
14
|
+
preOffset: Offset;
|
|
15
|
+
/** Wraps the offset to the byte array length. */
|
|
16
|
+
wrapBytes: (offset: Offset) => Offset;
|
|
17
|
+
};
|
|
18
|
+
type PreOffsetFunction = (scope: PreOffsetFunctionScope) => Offset;
|
|
19
|
+
type PostOffsetFunction = (scope: PreOffsetFunctionScope & {
|
|
20
|
+
/** The modified offset used to encode or decode. */
|
|
21
|
+
newPreOffset: Offset;
|
|
22
|
+
/** The original offset returned by the encoder or decoder. */
|
|
23
|
+
postOffset: Offset;
|
|
24
|
+
}) => Offset;
|
|
25
|
+
/**
|
|
26
|
+
* Moves the offset of a given encoder.
|
|
27
|
+
*/
|
|
28
|
+
export declare function offsetEncoder<TEncoder extends AnyEncoder>(encoder: TEncoder, config: OffsetConfig): TEncoder;
|
|
29
|
+
/**
|
|
30
|
+
* Moves the offset of a given decoder.
|
|
31
|
+
*/
|
|
32
|
+
export declare function offsetDecoder<TDecoder extends AnyDecoder>(decoder: TDecoder, config: OffsetConfig): TDecoder;
|
|
33
|
+
/**
|
|
34
|
+
* Moves the offset of a given codec.
|
|
35
|
+
*/
|
|
36
|
+
export declare function offsetCodec<TCodec extends AnyCodec>(codec: TCodec, config: OffsetConfig): TCodec;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=offset-codec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offset-codec.d.ts","sourceRoot":"","sources":["../../src/offset-codec.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAgC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAExF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAG3D,KAAK,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;AAE/B,KAAK,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;AAE/B,KAAK,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;AAE3B,KAAK,YAAY,GAAG;IAChB,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,SAAS,CAAC,EAAE,iBAAiB,CAAC;CACjC,CAAC;AAEF,KAAK,sBAAsB,GAAG;IAC1B,6BAA6B;IAC7B,KAAK,EAAE,kBAAkB,GAAG,UAAU,CAAC;IACvC,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CACzC,CAAC;AAEF,KAAK,iBAAiB,GAAG,CAAC,KAAK,EAAE,sBAAsB,KAAK,MAAM,CAAC;AACnE,KAAK,kBAAkB,GAAG,CACtB,KAAK,EAAE,sBAAsB,GAAG;IAC5B,oDAAoD;IACpD,YAAY,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,UAAU,EAAE,MAAM,CAAC;CACtB,KACA,MAAM,CAAC;AAEZ;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,SAAS,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,GAAG,QAAQ,CAe5G;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,SAAS,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,GAAG,QAAQ,CAe5G;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,SAAS,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,MAAM,CAEhG"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Codec, Decoder, Encoder, Offset } from './codec';
|
|
2
|
+
type AnyEncoder = Encoder<any>;
|
|
3
|
+
type AnyDecoder = Decoder<any>;
|
|
4
|
+
type AnyCodec = Codec<any>;
|
|
5
|
+
/**
|
|
6
|
+
* Adds left padding to the given encoder.
|
|
7
|
+
*/
|
|
8
|
+
export declare function padLeftEncoder<TEncoder extends AnyEncoder>(encoder: TEncoder, offset: Offset): TEncoder;
|
|
9
|
+
/**
|
|
10
|
+
* Adds right padding to the given encoder.
|
|
11
|
+
*/
|
|
12
|
+
export declare function padRightEncoder<TEncoder extends AnyEncoder>(encoder: TEncoder, offset: Offset): TEncoder;
|
|
13
|
+
/**
|
|
14
|
+
* Adds left padding to the given decoder.
|
|
15
|
+
*/
|
|
16
|
+
export declare function padLeftDecoder<TDecoder extends AnyDecoder>(decoder: TDecoder, offset: Offset): TDecoder;
|
|
17
|
+
/**
|
|
18
|
+
* Adds right padding to the given decoder.
|
|
19
|
+
*/
|
|
20
|
+
export declare function padRightDecoder<TDecoder extends AnyDecoder>(decoder: TDecoder, offset: Offset): TDecoder;
|
|
21
|
+
/**
|
|
22
|
+
* Adds left padding to the given codec.
|
|
23
|
+
*/
|
|
24
|
+
export declare function padLeftCodec<TCodec extends AnyCodec>(codec: TCodec, offset: Offset): TCodec;
|
|
25
|
+
/**
|
|
26
|
+
* Adds right padding to the given codec.
|
|
27
|
+
*/
|
|
28
|
+
export declare function padRightCodec<TCodec extends AnyCodec>(codec: TCodec, offset: Offset): TCodec;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=pad-codec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pad-codec.d.ts","sourceRoot":"","sources":["../../src/pad-codec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAM1D,KAAK,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;AAE/B,KAAK,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;AAE/B,KAAK,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;AAE3B;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,SAAS,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAG,QAAQ,CAKvG;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,SAAS,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAG,QAAQ,CAKxG;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,SAAS,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAG,QAAQ,CAKvG;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,SAAS,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAG,QAAQ,CAKxG;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,SAAS,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAE3F;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,SAAS,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAE5F"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type TypedArrayMutableProperties = 'copyWithin' | 'fill' | 'reverse' | 'set' | 'sort';
|
|
2
|
+
export interface ReadonlyUint8Array extends Omit<Uint8Array, TypedArrayMutableProperties> {
|
|
3
|
+
readonly [n: number]: number;
|
|
4
|
+
}
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=readonly-uint8array.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readonly-uint8array.d.ts","sourceRoot":"","sources":["../../src/readonly-uint8array.ts"],"names":[],"mappings":"AAAA,KAAK,2BAA2B,GAAG,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,KAAK,GAAG,MAAM,CAAC;AACtF,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,UAAU,EAAE,2BAA2B,CAAC;IACrF,QAAQ,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAChC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Codec, Decoder, Encoder, FixedSizeCodec, FixedSizeDecoder, FixedSizeEncoder } from './codec';
|
|
2
|
+
type AnyEncoder = Encoder<any>;
|
|
3
|
+
type AnyDecoder = Decoder<any>;
|
|
4
|
+
type AnyCodec = Codec<any>;
|
|
5
|
+
/**
|
|
6
|
+
* Updates the size of a given encoder.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resizeEncoder<TFrom, TSize extends number, TNewSize extends number>(encoder: FixedSizeEncoder<TFrom, TSize>, resize: (size: TSize) => TNewSize): FixedSizeEncoder<TFrom, TNewSize>;
|
|
9
|
+
export declare function resizeEncoder<TEncoder extends AnyEncoder>(encoder: TEncoder, resize: (size: number) => number): TEncoder;
|
|
10
|
+
/**
|
|
11
|
+
* Updates the size of a given decoder.
|
|
12
|
+
*/
|
|
13
|
+
export declare function resizeDecoder<TFrom, TSize extends number, TNewSize extends number>(decoder: FixedSizeDecoder<TFrom, TSize>, resize: (size: TSize) => TNewSize): FixedSizeDecoder<TFrom, TNewSize>;
|
|
14
|
+
export declare function resizeDecoder<TDecoder extends AnyDecoder>(decoder: TDecoder, resize: (size: number) => number): TDecoder;
|
|
15
|
+
/**
|
|
16
|
+
* Updates the size of a given codec.
|
|
17
|
+
*/
|
|
18
|
+
export declare function resizeCodec<TFrom, TTo extends TFrom, TSize extends number, TNewSize extends number>(codec: FixedSizeCodec<TFrom, TTo, TSize>, resize: (size: TSize) => TNewSize): FixedSizeCodec<TFrom, TTo, TNewSize>;
|
|
19
|
+
export declare function resizeCodec<TCodec extends AnyCodec>(codec: TCodec, resize: (size: number) => number): TCodec;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=resize-codec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resize-codec.d.ts","sourceRoot":"","sources":["../../src/resize-codec.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,EAGL,OAAO,EACP,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAEnB,MAAM,SAAS,CAAC;AAIjB,KAAK,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;AAE/B,KAAK,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;AAE/B,KAAK,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;AAE3B;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,SAAS,MAAM,EAAE,QAAQ,SAAS,MAAM,EAC9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eEncoder } from './codec';
|
|
2
|
+
/**
|
|
3
|
+
* Reverses the bytes of a fixed-size encoder.
|
|
4
|
+
*/
|
|
5
|
+
export declare function reverseEncoder<TFrom, TSize extends number>(encoder: FixedSizeEncoder<TFrom, TSize>): FixedSizeEncoder<TFrom, TSize>;
|
|
6
|
+
/**
|
|
7
|
+
* Reverses the bytes of a fixed-size decoder.
|
|
8
|
+
*/
|
|
9
|
+
export declare function reverseDecoder<TTo, TSize extends number>(decoder: FixedSizeDecoder<TTo, TSize>): FixedSizeDecoder<TTo, TSize>;
|
|
10
|
+
/**
|
|
11
|
+
* Reverses the bytes of a fixed-size codec.
|
|
12
|
+
*/
|
|
13
|
+
export declare function reverseCodec<TFrom, TTo extends TFrom, TSize extends number>(codec: FixedSizeCodec<TFrom, TTo, TSize>): FixedSizeCodec<TFrom, TTo, TSize>;
|
|
14
|
+
//# sourceMappingURL=reverse-codec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reverse-codec.d.ts","sourceRoot":"","sources":["../../src/reverse-codec.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EACnB,MAAM,SAAS,CAAC;AAsBjB;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,SAAS,MAAM,EACtD,OAAO,EAAE,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,GACxC,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,CAehC;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,KAAK,SAAS,MAAM,EACpD,OAAO,EAAE,gBAAgB,CAAC,GAAG,EAAE,KAAK,CAAC,GACtC,gBAAgB,CAAC,GAAG,EAAE,KAAK,CAAC,CAe9B;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,SAAS,KAAK,EAAE,KAAK,SAAS,MAAM,EACvE,KAAK,EAAE,cAAc,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,GACzC,cAAc,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,CAEnC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Codec, Decoder, Encoder, FixedSizeCodec, FixedSizeDecoder, FixedSizeEncoder, VariableSizeCodec, VariableSizeDecoder, VariableSizeEncoder } from './codec';
|
|
2
|
+
import { ReadonlyUint8Array } from './readonly-uint8array';
|
|
3
|
+
/**
|
|
4
|
+
* Converts an encoder A to a encoder B by mapping their values.
|
|
5
|
+
*/
|
|
6
|
+
export declare function transformEncoder<TOldFrom, TNewFrom, TSize extends number>(encoder: FixedSizeEncoder<TOldFrom, TSize>, unmap: (value: TNewFrom) => TOldFrom): FixedSizeEncoder<TNewFrom, TSize>;
|
|
7
|
+
export declare function transformEncoder<TOldFrom, TNewFrom>(encoder: VariableSizeEncoder<TOldFrom>, unmap: (value: TNewFrom) => TOldFrom): VariableSizeEncoder<TNewFrom>;
|
|
8
|
+
export declare function transformEncoder<TOldFrom, TNewFrom>(encoder: Encoder<TOldFrom>, unmap: (value: TNewFrom) => TOldFrom): Encoder<TNewFrom>;
|
|
9
|
+
/**
|
|
10
|
+
* Converts an decoder A to a decoder B by mapping their values.
|
|
11
|
+
*/
|
|
12
|
+
export declare function transformDecoder<TOldTo, TNewTo, TSize extends number>(decoder: FixedSizeDecoder<TOldTo, TSize>, map: (value: TOldTo, bytes: ReadonlyUint8Array | Uint8Array, offset: number) => TNewTo): FixedSizeDecoder<TNewTo, TSize>;
|
|
13
|
+
export declare function transformDecoder<TOldTo, TNewTo>(decoder: VariableSizeDecoder<TOldTo>, map: (value: TOldTo, bytes: ReadonlyUint8Array | Uint8Array, offset: number) => TNewTo): VariableSizeDecoder<TNewTo>;
|
|
14
|
+
export declare function transformDecoder<TOldTo, TNewTo>(decoder: Decoder<TOldTo>, map: (value: TOldTo, bytes: ReadonlyUint8Array | Uint8Array, offset: number) => TNewTo): Decoder<TNewTo>;
|
|
15
|
+
/**
|
|
16
|
+
* Converts a codec A to a codec B by mapping their values.
|
|
17
|
+
*/
|
|
18
|
+
export declare function transformCodec<TOldFrom, TNewFrom, TTo extends TNewFrom & TOldFrom, TSize extends number>(codec: FixedSizeCodec<TOldFrom, TTo, TSize>, unmap: (value: TNewFrom) => TOldFrom): FixedSizeCodec<TNewFrom, TTo, TSize>;
|
|
19
|
+
export declare function transformCodec<TOldFrom, TNewFrom, TTo extends TNewFrom & TOldFrom>(codec: VariableSizeCodec<TOldFrom, TTo>, unmap: (value: TNewFrom) => TOldFrom): VariableSizeCodec<TNewFrom, TTo>;
|
|
20
|
+
export declare function transformCodec<TOldFrom, TNewFrom, TTo extends TNewFrom & TOldFrom>(codec: Codec<TOldFrom, TTo>, unmap: (value: TNewFrom) => TOldFrom): Codec<TNewFrom, TTo>;
|
|
21
|
+
export declare function transformCodec<TOldFrom, TNewFrom, TOldTo extends TOldFrom, TNewTo extends TNewFrom, TSize extends number>(codec: FixedSizeCodec<TOldFrom, TOldTo, TSize>, unmap: (value: TNewFrom) => TOldFrom, map: (value: TOldTo, bytes: ReadonlyUint8Array | Uint8Array, offset: number) => TNewTo): FixedSizeCodec<TNewFrom, TNewTo, TSize>;
|
|
22
|
+
export declare function transformCodec<TOldFrom, TNewFrom, TOldTo extends TOldFrom, TNewTo extends TNewFrom>(codec: VariableSizeCodec<TOldFrom, TOldTo>, unmap: (value: TNewFrom) => TOldFrom, map: (value: TOldTo, bytes: ReadonlyUint8Array | Uint8Array, offset: number) => TNewTo): VariableSizeCodec<TNewFrom, TNewTo>;
|
|
23
|
+
export declare function transformCodec<TOldFrom, TNewFrom, TOldTo extends TOldFrom, TNewTo extends TNewFrom>(codec: Codec<TOldFrom, TOldTo>, unmap: (value: TNewFrom) => TOldFrom, map: (value: TOldTo, bytes: ReadonlyUint8Array | Uint8Array, offset: number) => TNewTo): Codec<TNewFrom, TNewTo>;
|
|
24
|
+
//# sourceMappingURL=transform-codec.d.ts.map
|
|
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KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@solana/codecs-core",
|
|
3
|
+
"version": "2.0.0-canary-20240731173615",
|
|
4
|
+
"description": "Core types and helpers for encoding and decoding byte arrays on Solana",
|
|
5
|
+
"exports": {
|
|
6
|
+
"browser": {
|
|
7
|
+
"import": "./dist/index.browser.mjs",
|
|
8
|
+
"require": "./dist/index.browser.cjs"
|
|
9
|
+
},
|
|
10
|
+
"node": {
|
|
11
|
+
"import": "./dist/index.node.mjs",
|
|
12
|
+
"require": "./dist/index.node.cjs"
|
|
13
|
+
},
|
|
14
|
+
"react-native": "./dist/index.native.mjs",
|
|
15
|
+
"types": "./dist/types/index.d.ts"
|
|
16
|
+
},
|
|
17
|
+
"browser": {
|
|
18
|
+
"./dist/index.node.cjs": "./dist/index.browser.cjs",
|
|
19
|
+
"./dist/index.node.mjs": "./dist/index.browser.mjs"
|
|
20
|
+
},
|
|
21
|
+
"main": "./dist/index.node.cjs",
|
|
22
|
+
"module": "./dist/index.node.mjs",
|
|
23
|
+
"react-native": "./dist/index.native.mjs",
|
|
24
|
+
"types": "./dist/types/index.d.ts",
|
|
25
|
+
"type": "commonjs",
|
|
26
|
+
"files": [
|
|
27
|
+
"./dist/"
|
|
28
|
+
],
|
|
29
|
+
"sideEffects": false,
|
|
30
|
+
"keywords": [
|
|
31
|
+
"blockchain",
|
|
32
|
+
"solana",
|
|
33
|
+
"web3"
|
|
34
|
+
],
|
|
35
|
+
"author": "Solana Labs Maintainers <maintainers@solanalabs.com>",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "https://github.com/solana-labs/solana-web3.js"
|
|
40
|
+
},
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "http://github.com/solana-labs/solana-web3.js/issues"
|
|
43
|
+
},
|
|
44
|
+
"browserslist": [
|
|
45
|
+
"supports bigint and not dead",
|
|
46
|
+
"maintained node versions"
|
|
47
|
+
],
|
|
48
|
+
"engine": {
|
|
49
|
+
"node": ">=17.4"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@solana/errors": "2.0.0-canary-20240731173615"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"typescript": ">=5"
|
|
56
|
+
},
|
|
57
|
+
"bundlewatch": {
|
|
58
|
+
"defaultCompression": "gzip",
|
|
59
|
+
"files": [
|
|
60
|
+
{
|
|
61
|
+
"path": "./dist/index*.js"
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
"scripts": {
|
|
66
|
+
"benchmark": "./src/__benchmarks__/run.ts",
|
|
67
|
+
"compile:js": "tsup --config build-scripts/tsup.config.package.ts",
|
|
68
|
+
"compile:typedefs": "tsc -p ./tsconfig.declarations.json",
|
|
69
|
+
"dev": "jest -c ../../node_modules/@solana/test-config/jest-dev.config.ts --rootDir . --watch",
|
|
70
|
+
"publish-impl": "npm view $npm_package_name@$npm_package_version > /dev/null 2>&1 || pnpm publish --tag ${PUBLISH_TAG:-canary} --access public --no-git-checks",
|
|
71
|
+
"publish-packages": "pnpm prepublishOnly && pnpm publish-impl",
|
|
72
|
+
"style:fix": "pnpm eslint --fix src/* && pnpm prettier --log-level warn --ignore-unknown --write ./*",
|
|
73
|
+
"test:lint": "TERM_OVERRIDE=\"${TURBO_HASH:+dumb}\" TERM=${TERM_OVERRIDE:-$TERM} jest -c ../../node_modules/@solana/test-config/jest-lint.config.ts --rootDir . --silent",
|
|
74
|
+
"test:prettier": "TERM_OVERRIDE=\"${TURBO_HASH:+dumb}\" TERM=${TERM_OVERRIDE:-$TERM} jest -c ../../node_modules/@solana/test-config/jest-prettier.config.ts --rootDir . --silent",
|
|
75
|
+
"test:treeshakability:browser": "agadoo dist/index.browser.mjs",
|
|
76
|
+
"test:treeshakability:native": "agadoo dist/index.native.mjs",
|
|
77
|
+
"test:treeshakability:node": "agadoo dist/index.node.mjs",
|
|
78
|
+
"test:typecheck": "tsc --noEmit",
|
|
79
|
+
"test:unit:browser": "TERM_OVERRIDE=\"${TURBO_HASH:+dumb}\" TERM=${TERM_OVERRIDE:-$TERM} jest -c ../../node_modules/@solana/test-config/jest-unit.config.browser.ts --rootDir . --silent",
|
|
80
|
+
"test:unit:node": "TERM_OVERRIDE=\"${TURBO_HASH:+dumb}\" TERM=${TERM_OVERRIDE:-$TERM} jest -c ../../node_modules/@solana/test-config/jest-unit.config.node.ts --rootDir . --silent"
|
|
81
|
+
}
|
|
82
|
+
}
|