Skip to content

Commit 4a8470d

Browse files
committed
chore: all types from master
commit 4a36fb7 created with ``` mkdir diff-types1 ls vendor/**/*.d.ts | xargs -tn1 -I% sh -c 'cp % diff-types1/' ls dist/**/*.d.ts | xargs -tn1 -I% sh -c 'cp % diff-types1/' ```
1 parent 4a36fb7 commit 4a8470d

40 files changed

+871
-0
lines changed

diff-types1/base-x.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
export interface BaseConverter {
3+
encode(buffer: Uint8Array | number[]): string;
4+
decodeUnsafe(string: string): Uint8Array | undefined;
5+
decode(string: string): Uint8Array;
6+
}
7+
8+
export default function base(ALPHABET: string, name: string): BaseConverter

diff-types1/base.d.ts

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
export function or<L extends string, R extends string>(left: API.UnibaseDecoder<L> | API.CombobaseDecoder<L>, right: API.UnibaseDecoder<R> | API.CombobaseDecoder<R>): ComposedDecoder<L | R>;
2+
/**
3+
* @class
4+
* @template {string} Base
5+
* @template {string} Prefix
6+
* @implements {API.MultibaseCodec<Prefix>}
7+
* @implements {API.MultibaseEncoder<Prefix>}
8+
* @implements {API.MultibaseDecoder<Prefix>}
9+
* @implements {API.BaseCodec}
10+
* @implements {API.BaseEncoder}
11+
* @implements {API.BaseDecoder}
12+
*/
13+
export class Codec<Base extends string, Prefix extends string> implements API.MultibaseCodec<Prefix>, API.MultibaseEncoder<Prefix>, API.MultibaseDecoder<Prefix>, API.BaseCodec, API.BaseEncoder, API.BaseDecoder {
14+
/**
15+
* @param {Base} name
16+
* @param {Prefix} prefix
17+
* @param {(bytes:Uint8Array) => string} baseEncode
18+
* @param {(text:string) => Uint8Array} baseDecode
19+
*/
20+
constructor(name: Base, prefix: Prefix, baseEncode: (bytes: Uint8Array) => string, baseDecode: (text: string) => Uint8Array);
21+
name: Base;
22+
prefix: Prefix;
23+
baseEncode: (bytes: Uint8Array) => string;
24+
baseDecode: (text: string) => Uint8Array;
25+
encoder: Encoder<Base, Prefix>;
26+
decoder: Decoder<Base, Prefix>;
27+
/**
28+
* @param {Uint8Array} input
29+
*/
30+
encode(input: Uint8Array): API.Multibase<Prefix>;
31+
/**
32+
* @param {string} input
33+
*/
34+
decode(input: string): Uint8Array;
35+
}
36+
export function from<Base extends string, Prefix extends string>({ name, prefix, encode, decode }: {
37+
name: Base;
38+
prefix: Prefix;
39+
encode: (bytes: Uint8Array) => string;
40+
decode: (input: string) => Uint8Array;
41+
}): Codec<Base, Prefix>;
42+
export function baseX<Base extends string, Prefix extends string>({ prefix, name, alphabet }: {
43+
name: Base;
44+
prefix: Prefix;
45+
alphabet: string;
46+
}): Codec<Base, Prefix>;
47+
export function rfc4648<Base extends string, Prefix extends string>({ name, prefix, bitsPerChar, alphabet }: {
48+
name: Base;
49+
prefix: Prefix;
50+
alphabet: string;
51+
bitsPerChar: number;
52+
}): Codec<Base, Prefix>;
53+
export type Decoders<Prefix extends string> = Record<Prefix, API.UnibaseDecoder<Prefix>>;
54+
import * as API from "./interface.js";
55+
/**
56+
* @template {string} Prefix
57+
* @typedef {Record<Prefix, API.UnibaseDecoder<Prefix>>} Decoders
58+
*/
59+
/**
60+
* @template {string} Prefix
61+
* @implements {API.MultibaseDecoder<Prefix>}
62+
* @implements {API.CombobaseDecoder<Prefix>}
63+
*/
64+
declare class ComposedDecoder<Prefix extends string> implements API.MultibaseDecoder<Prefix>, API.CombobaseDecoder<Prefix> {
65+
/**
66+
* @param {Decoders<Prefix>} decoders
67+
*/
68+
constructor(decoders: Decoders<Prefix>);
69+
decoders: Decoders<Prefix>;
70+
/**
71+
* @template {string} OtherPrefix
72+
* @param {API.UnibaseDecoder<OtherPrefix>|ComposedDecoder<OtherPrefix>} decoder
73+
* @returns {ComposedDecoder<Prefix|OtherPrefix>}
74+
*/
75+
or<OtherPrefix extends string>(decoder: API.UnibaseDecoder<OtherPrefix> | ComposedDecoder<OtherPrefix>): ComposedDecoder<Prefix | OtherPrefix>;
76+
/**
77+
* @param {string} input
78+
* @returns {Uint8Array}
79+
*/
80+
decode(input: string): Uint8Array;
81+
}
82+
/**
83+
* Class represents both BaseEncoder and MultibaseEncoder meaning it
84+
* can be used to encode to multibase or base encode without multibase
85+
* prefix.
86+
*
87+
* @class
88+
* @template {string} Base
89+
* @template {string} Prefix
90+
* @implements {API.MultibaseEncoder<Prefix>}
91+
* @implements {API.BaseEncoder}
92+
*/
93+
declare class Encoder<Base extends string, Prefix extends string> implements API.MultibaseEncoder<Prefix>, API.BaseEncoder {
94+
/**
95+
* @param {Base} name
96+
* @param {Prefix} prefix
97+
* @param {(bytes:Uint8Array) => string} baseEncode
98+
*/
99+
constructor(name: Base, prefix: Prefix, baseEncode: (bytes: Uint8Array) => string);
100+
name: Base;
101+
prefix: Prefix;
102+
baseEncode: (bytes: Uint8Array) => string;
103+
/**
104+
* @param {Uint8Array} bytes
105+
* @returns {API.Multibase<Prefix>}
106+
*/
107+
encode(bytes: Uint8Array): API.Multibase<Prefix>;
108+
}
109+
/**
110+
* @template {string} Prefix
111+
*/
112+
/**
113+
* Class represents both BaseDecoder and MultibaseDecoder so it could be used
114+
* to decode multibases (with matching prefix) or just base decode strings
115+
* with corresponding base encoding.
116+
*
117+
* @class
118+
* @template {string} Base
119+
* @template {string} Prefix
120+
* @implements {API.MultibaseDecoder<Prefix>}
121+
* @implements {API.UnibaseDecoder<Prefix>}
122+
* @implements {API.BaseDecoder}
123+
*/
124+
declare class Decoder<Base extends string, Prefix extends string> implements API.MultibaseDecoder<Prefix>, API.UnibaseDecoder<Prefix>, API.BaseDecoder {
125+
/**
126+
* @param {Base} name
127+
* @param {Prefix} prefix
128+
* @param {(text:string) => Uint8Array} baseDecode
129+
*/
130+
constructor(name: Base, prefix: Prefix, baseDecode: (text: string) => Uint8Array);
131+
name: Base;
132+
prefix: Prefix;
133+
/** @private */
134+
private prefixCodePoint;
135+
baseDecode: (text: string) => Uint8Array;
136+
/**
137+
* @param {string} text
138+
*/
139+
decode(text: string): Uint8Array;
140+
/**
141+
* @template {string} OtherPrefix
142+
* @param {API.UnibaseDecoder<OtherPrefix>|ComposedDecoder<OtherPrefix>} decoder
143+
* @returns {ComposedDecoder<Prefix|OtherPrefix>}
144+
*/
145+
or<OtherPrefix extends string>(decoder: API.UnibaseDecoder<OtherPrefix> | ComposedDecoder<OtherPrefix>): ComposedDecoder<Prefix | OtherPrefix>;
146+
}
147+
export {};
148+
//# sourceMappingURL=base.d.ts.map

diff-types1/base10.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export const base10: import("./base.js").Codec<"base10", "9">;
2+
//# sourceMappingURL=base10.d.ts.map

diff-types1/base16.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const base16: import("./base.js").Codec<"base16", "f">;
2+
export const base16upper: import("./base.js").Codec<"base16upper", "F">;
3+
//# sourceMappingURL=base16.d.ts.map

diff-types1/base2.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export const base2: import("./base.js").Codec<"base2", "0">;
2+
//# sourceMappingURL=base2.d.ts.map

diff-types1/base256emoji.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export const base256emoji: import("./base.js").Codec<"base256emoji", "🚀">;
2+
//# sourceMappingURL=base256emoji.d.ts.map

diff-types1/base32.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export const base32: import("./base.js").Codec<"base32", "b">;
2+
export const base32upper: import("./base.js").Codec<"base32upper", "B">;
3+
export const base32pad: import("./base.js").Codec<"base32pad", "c">;
4+
export const base32padupper: import("./base.js").Codec<"base32padupper", "C">;
5+
export const base32hex: import("./base.js").Codec<"base32hex", "v">;
6+
export const base32hexupper: import("./base.js").Codec<"base32hexupper", "V">;
7+
export const base32hexpad: import("./base.js").Codec<"base32hexpad", "t">;
8+
export const base32hexpadupper: import("./base.js").Codec<"base32hexpadupper", "T">;
9+
export const base32z: import("./base.js").Codec<"base32z", "h">;
10+
//# sourceMappingURL=base32.d.ts.map

diff-types1/base36.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const base36: import("./base.js").Codec<"base36", "k">;
2+
export const base36upper: import("./base.js").Codec<"base36upper", "K">;
3+
//# sourceMappingURL=base36.d.ts.map

diff-types1/base58.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const base58btc: import("./base.js").Codec<"base58btc", "z">;
2+
export const base58flickr: import("./base.js").Codec<"base58flickr", "Z">;
3+
//# sourceMappingURL=base58.d.ts.map

diff-types1/base64.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export const base64: import("./base.js").Codec<"base64", "m">;
2+
export const base64pad: import("./base.js").Codec<"base64pad", "M">;
3+
export const base64url: import("./base.js").Codec<"base64url", "u">;
4+
export const base64urlpad: import("./base.js").Codec<"base64urlpad", "U">;
5+
//# sourceMappingURL=base64.d.ts.map

0 commit comments

Comments
 (0)