From 33f377aa17d2ce9430f439d475905171f45c129a Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Fri, 8 Sep 2023 09:48:23 +1000 Subject: [PATCH] feat: add types --- .gitignore | 2 - types/cborg.d.ts | 22 +++++++ types/cborg.d.ts.map | 1 + types/example.d.ts | 2 + types/example.d.ts.map | 1 + types/interface.d.ts | 46 +++++++++++++ types/interface.d.ts.map | 1 + types/lib/0uint.d.ts | 100 +++++++++++++++++++++++++++++ types/lib/0uint.d.ts.map | 1 + types/lib/1negint.d.ts | 58 +++++++++++++++++ types/lib/1negint.d.ts.map | 1 + types/lib/2bytes.d.ts | 68 ++++++++++++++++++++ types/lib/2bytes.d.ts.map | 1 + types/lib/3string.d.ts | 46 +++++++++++++ types/lib/3string.d.ts.map | 1 + types/lib/4array.d.ts | 65 +++++++++++++++++++ types/lib/4array.d.ts.map | 1 + types/lib/5map.d.ts | 65 +++++++++++++++++++ types/lib/5map.d.ts.map | 1 + types/lib/6tag.d.ts | 61 ++++++++++++++++++ types/lib/6tag.d.ts.map | 1 + types/lib/7float.d.ts | 60 +++++++++++++++++ types/lib/7float.d.ts.map | 1 + types/lib/bin.d.ts | 4 ++ types/lib/bin.d.ts.map | 1 + types/lib/bl.d.ts | 26 ++++++++ types/lib/bl.d.ts.map | 1 + types/lib/byte-utils.d.ts | 53 +++++++++++++++ types/lib/byte-utils.d.ts.map | 1 + types/lib/common.d.ts | 10 +++ types/lib/common.d.ts.map | 1 + types/lib/decode.d.ts | 34 ++++++++++ types/lib/decode.d.ts.map | 1 + types/lib/diagnostic.d.ts | 12 ++++ types/lib/diagnostic.d.ts.map | 1 + types/lib/diagnostic_test.d.ts | 2 + types/lib/diagnostic_test.d.ts.map | 1 + types/lib/encode.d.ts | 50 +++++++++++++++ types/lib/encode.d.ts.map | 1 + types/lib/is.d.ts | 6 ++ types/lib/is.d.ts.map | 1 + types/lib/json/decode.d.ts | 60 +++++++++++++++++ types/lib/json/decode.d.ts.map | 1 + types/lib/json/encode.d.ts | 10 +++ types/lib/json/encode.d.ts.map | 1 + types/lib/json/json.d.ts | 5 ++ types/lib/json/json.d.ts.map | 1 + types/lib/jump.d.ts | 12 ++++ types/lib/jump.d.ts.map | 1 + types/lib/length.d.ts | 27 ++++++++ types/lib/length.d.ts.map | 1 + types/lib/token.d.ts | 54 ++++++++++++++++ types/lib/token.d.ts.map | 1 + types/taglib.d.ts | 18 ++++++ types/taglib.d.ts.map | 1 + 55 files changed, 1003 insertions(+), 2 deletions(-) create mode 100644 types/cborg.d.ts create mode 100644 types/cborg.d.ts.map create mode 100644 types/example.d.ts create mode 100644 types/example.d.ts.map create mode 100644 types/interface.d.ts create mode 100644 types/interface.d.ts.map create mode 100644 types/lib/0uint.d.ts create mode 100644 types/lib/0uint.d.ts.map create mode 100644 types/lib/1negint.d.ts create mode 100644 types/lib/1negint.d.ts.map create mode 100644 types/lib/2bytes.d.ts create mode 100644 types/lib/2bytes.d.ts.map create mode 100644 types/lib/3string.d.ts create mode 100644 types/lib/3string.d.ts.map create mode 100644 types/lib/4array.d.ts create mode 100644 types/lib/4array.d.ts.map create mode 100644 types/lib/5map.d.ts create mode 100644 types/lib/5map.d.ts.map create mode 100644 types/lib/6tag.d.ts create mode 100644 types/lib/6tag.d.ts.map create mode 100644 types/lib/7float.d.ts create mode 100644 types/lib/7float.d.ts.map create mode 100644 types/lib/bin.d.ts create mode 100644 types/lib/bin.d.ts.map create mode 100644 types/lib/bl.d.ts create mode 100644 types/lib/bl.d.ts.map create mode 100644 types/lib/byte-utils.d.ts create mode 100644 types/lib/byte-utils.d.ts.map create mode 100644 types/lib/common.d.ts create mode 100644 types/lib/common.d.ts.map create mode 100644 types/lib/decode.d.ts create mode 100644 types/lib/decode.d.ts.map create mode 100644 types/lib/diagnostic.d.ts create mode 100644 types/lib/diagnostic.d.ts.map create mode 100644 types/lib/diagnostic_test.d.ts create mode 100644 types/lib/diagnostic_test.d.ts.map create mode 100644 types/lib/encode.d.ts create mode 100644 types/lib/encode.d.ts.map create mode 100644 types/lib/is.d.ts create mode 100644 types/lib/is.d.ts.map create mode 100644 types/lib/json/decode.d.ts create mode 100644 types/lib/json/decode.d.ts.map create mode 100644 types/lib/json/encode.d.ts create mode 100644 types/lib/json/encode.d.ts.map create mode 100644 types/lib/json/json.d.ts create mode 100644 types/lib/json/json.d.ts.map create mode 100644 types/lib/jump.d.ts create mode 100644 types/lib/jump.d.ts.map create mode 100644 types/lib/length.d.ts create mode 100644 types/lib/length.d.ts.map create mode 100644 types/lib/token.d.ts create mode 100644 types/lib/token.d.ts.map create mode 100644 types/taglib.d.ts create mode 100644 types/taglib.d.ts.map diff --git a/.gitignore b/.gitignore index f07d670..59d78f3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,5 @@ .DS_Store -build/ node_modules/ coverage/ c/ dist/ -types/ diff --git a/types/cborg.d.ts b/types/cborg.d.ts new file mode 100644 index 0000000..e6aa080 --- /dev/null +++ b/types/cborg.d.ts @@ -0,0 +1,22 @@ +/** + * There was originally just `TypeEncoder` so don't break types by renaming or not exporting + */ +export type TagDecoder = import('./interface').TagDecoder; +/** + * Export the types that were present in the original manual cborg.d.ts + */ +export type TypeEncoder = import('./interface').OptionalTypeEncoder; +/** + * Export the types that were present in the original manual cborg.d.ts + */ +export type DecodeOptions = import('./interface').DecodeOptions; +/** + * Export the types that were present in the original manual cborg.d.ts + */ +export type EncodeOptions = import('./interface').EncodeOptions; +import { decode } from './lib/decode.js'; +import { encode } from './lib/encode.js'; +import { Token } from './lib/token.js'; +import { Type } from './lib/token.js'; +export { decode, encode, Token, Type }; +//# sourceMappingURL=cborg.d.ts.map \ No newline at end of file diff --git a/types/cborg.d.ts.map b/types/cborg.d.ts.map new file mode 100644 index 0000000..cb7a5fc --- /dev/null +++ b/types/cborg.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"cborg.d.ts","sourceRoot":"","sources":["../cborg.js"],"names":[],"mappings":";;;yBAMa,OAAO,aAAa,EAAE,UAAU;;;;0BAEhC,OAAO,aAAa,EAAE,mBAAmB;;;;4BACzC,OAAO,aAAa,EAAE,aAAa;;;;4BACnC,OAAO,aAAa,EAAE,aAAa;uBATzB,iBAAiB;uBADjB,iBAAiB;sBAEZ,gBAAgB;qBAAhB,gBAAgB"} \ No newline at end of file diff --git a/types/example.d.ts b/types/example.d.ts new file mode 100644 index 0000000..71d77e6 --- /dev/null +++ b/types/example.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=example.d.ts.map \ No newline at end of file diff --git a/types/example.d.ts.map b/types/example.d.ts.map new file mode 100644 index 0000000..b868ec0 --- /dev/null +++ b/types/example.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../example.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/types/interface.d.ts b/types/interface.d.ts new file mode 100644 index 0000000..315b3d3 --- /dev/null +++ b/types/interface.d.ts @@ -0,0 +1,46 @@ +import { Token } from './lib/token'; +import { Bl } from './lib/bl'; +export type TokenOrNestedTokens = Token | Token[] | TokenOrNestedTokens[]; +export interface Reference { + parent: Reference | undefined; + obj: object | any[]; + includes(obj: object | any[]): boolean; +} +export type OptionalTypeEncoder = (data: any, typ: string, options: EncodeOptions, refStack?: Reference) => TokenOrNestedTokens | null; +export type StrictTypeEncoder = (data: any, typ: string, options: EncodeOptions, refStack?: Reference) => TokenOrNestedTokens; +export type TokenTypeEncoder = { + (buf: Bl, token: Token, options?: EncodeOptions): void; + compareTokens(t1: Token, t2: Token): number; + encodedSize?(token: Token, options?: EncodeOptions): number; +}; +export type MapSorter = (e1: (Token | Token[])[], e2: (Token | Token[])[]) => number; +export type QuickEncodeToken = (token: Token) => Uint8Array | undefined; +export interface DecodeTokenizer { + done(): boolean; + next(): Token; +} +export type TagDecoder = (inner: any) => any; +export interface DecodeOptions { + allowIndefinite?: boolean; + allowUndefined?: boolean; + coerceUndefinedToNull?: boolean; + allowInfinity?: boolean; + allowNaN?: boolean; + allowBigInt?: boolean; + strict?: boolean; + useMaps?: boolean; + rejectDuplicateMapKeys?: boolean; + retainStringBytes?: boolean; + tags?: TagDecoder[]; + tokenizer?: DecodeTokenizer; +} +export interface EncodeOptions { + float64?: boolean; + addBreakTokens?: boolean; + mapSorter?: MapSorter; + quickEncodeToken?: QuickEncodeToken; + typeEncoders?: { + [typeName: string]: OptionalTypeEncoder; + }; +} +//# sourceMappingURL=interface.d.ts.map \ No newline at end of file diff --git a/types/interface.d.ts.map b/types/interface.d.ts.map new file mode 100644 index 0000000..f86aab6 --- /dev/null +++ b/types/interface.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAA;AAE7B,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG,KAAK,EAAE,GAAG,mBAAmB,EAAE,CAAA;AAEzE,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,SAAS,GAAG,SAAS,CAAA;IAC7B,GAAG,EAAE,MAAM,GAAG,GAAG,EAAE,CAAA;IACnB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,EAAE,GAAG,OAAO,CAAA;CACvC;AAED,MAAM,MAAM,mBAAmB,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,CAAC,EAAE,SAAS,KAAK,mBAAmB,GAAG,IAAI,CAAA;AAEtI,MAAM,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,CAAC,EAAE,SAAS,KAAK,mBAAmB,CAAA;AAE7H,MAAM,MAAM,gBAAgB,GAAG;IAC7B,CAAC,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IACvD,aAAa,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,GAAG,MAAM,CAAC;IAE5C,WAAW,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM,CAAC;CAC7D,CAAA;AAED,MAAM,MAAM,SAAS,GAAG,CAAC,EAAE,EAAE,CAAC,KAAK,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,KAAK,GAAG,KAAK,EAAE,CAAC,EAAE,KAAK,MAAM,CAAA;AAEpF,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,UAAU,GAAG,SAAS,CAAA;AAEvE,MAAM,WAAW,eAAe;IAC9B,IAAI,IAAI,OAAO,CAAC;IAChB,IAAI,IAAI,KAAK,CAAA;CACd;AAED,MAAM,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAA;AAE5C,MAAM,WAAW,aAAa;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,IAAI,CAAC,EAAE,UAAU,EAAE,CAAC;IACpB,SAAS,CAAC,EAAE,eAAe,CAAA;CAC5B;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,YAAY,CAAC,EAAE;QAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB,CAAA;KAAE,CAAA;CAC3D"} \ No newline at end of file diff --git a/types/lib/0uint.d.ts b/types/lib/0uint.d.ts new file mode 100644 index 0000000..bea332b --- /dev/null +++ b/types/lib/0uint.d.ts @@ -0,0 +1,100 @@ +/** + * @typedef {import('./bl.js').Bl} Bl + * @typedef {import('../interface').DecodeOptions} DecodeOptions + */ +/** + * @param {Uint8Array} data + * @param {number} offset + * @param {DecodeOptions} options + * @returns {number} + */ +export function readUint8(data: Uint8Array, offset: number, options: DecodeOptions): number; +/** + * @param {Uint8Array} data + * @param {number} offset + * @param {DecodeOptions} options + * @returns {number} + */ +export function readUint16(data: Uint8Array, offset: number, options: DecodeOptions): number; +/** + * @param {Uint8Array} data + * @param {number} offset + * @param {DecodeOptions} options + * @returns {number} + */ +export function readUint32(data: Uint8Array, offset: number, options: DecodeOptions): number; +/** + * @param {Uint8Array} data + * @param {number} offset + * @param {DecodeOptions} options + * @returns {number|bigint} + */ +export function readUint64(data: Uint8Array, offset: number, options: DecodeOptions): number | bigint; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeUint8(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeUint16(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeUint32(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeUint64(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Bl} buf + * @param {Token} token + */ +export function encodeUint(buf: Bl, token: Token): void; +export namespace encodeUint { + /** + * @param {Token} token + * @returns {number} + */ + function encodedSize(token: Token): number; + /** + * @param {Token} tok1 + * @param {Token} tok2 + * @returns {number} + */ + function compareTokens(tok1: Token, tok2: Token): number; +} +/** + * @param {Bl} buf + * @param {number} major + * @param {number|bigint} uint + */ +export function encodeUintValue(buf: Bl, major: number, uint: number | bigint): void; +export namespace encodeUintValue { + /** + * @param {number} uint + * @returns {number} + */ + function encodedSize(uint: number): number; +} +export const uintBoundaries: (number | bigint)[]; +export type Bl = import('./bl.js').Bl; +export type DecodeOptions = import('../interface').DecodeOptions; +import { Token } from './token.js'; +//# sourceMappingURL=0uint.d.ts.map \ No newline at end of file diff --git a/types/lib/0uint.d.ts.map b/types/lib/0uint.d.ts.map new file mode 100644 index 0000000..72d6cf9 --- /dev/null +++ b/types/lib/0uint.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"0uint.d.ts","sourceRoot":"","sources":["../../lib/0uint.js"],"names":[],"mappings":"AAOA;;;GAGG;AAEH;;;;;GAKG;AACH,gCALW,UAAU,UACV,MAAM,WACN,aAAa,GACX,MAAM,CASlB;AAED;;;;;GAKG;AACH,iCALW,UAAU,UACV,MAAM,WACN,aAAa,GACX,MAAM,CASlB;AAED;;;;;GAKG;AACH,iCALW,UAAU,UACV,MAAM,WACN,aAAa,GACX,MAAM,CASlB;AAED;;;;;GAKG;AACH,iCALW,UAAU,UACV,MAAM,WACN,aAAa,GACX,MAAM,GAAC,MAAM,CAkBzB;AASD;;;;;;GAMG;AACH,kCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAIjB;AAED;;;;;;GAMG;AACH,mCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAIjB;AAED;;;;;;GAMG;AACH,mCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAIjB;AAED;;;;;;GAMG;AACH,mCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAIjB;AAED;;;GAGG;AACH,gCAHW,EAAE,SACF,KAAK,QAIf;;IAqDD;;;OAGG;IACH,2CAEC;IAsBD;;;;OAIG;IACH,yDAEC;;AAtFD;;;;GAIG;AACH,qCAJW,EAAE,SACF,MAAM,QACN,MAAM,GAAC,MAAM,QA8CvB;;IAUD;;;OAGG;IACH,2CAcC;;AApND,iDAA0F;iBAG7E,OAAO,SAAS,EAAE,EAAE;4BACpB,OAAO,cAAc,EAAE,aAAa;sBAPrB,YAAY"} \ No newline at end of file diff --git a/types/lib/1negint.d.ts b/types/lib/1negint.d.ts new file mode 100644 index 0000000..cee5e61 --- /dev/null +++ b/types/lib/1negint.d.ts @@ -0,0 +1,58 @@ +/** + * @typedef {import('./bl.js').Bl} Bl + * @typedef {import('../interface').DecodeOptions} DecodeOptions + */ +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeNegint8(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeNegint16(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeNegint32(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeNegint64(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Bl} buf + * @param {Token} token + */ +export function encodeNegint(buf: Bl, token: Token): void; +export namespace encodeNegint { + /** + * @param {Token} token + * @returns {number} + */ + function encodedSize(token: Token): number; + /** + * @param {Token} tok1 + * @param {Token} tok2 + * @returns {number} + */ + function compareTokens(tok1: Token, tok2: Token): number; +} +export type Bl = import('./bl.js').Bl; +export type DecodeOptions = import('../interface').DecodeOptions; +import { Token } from './token.js'; +//# sourceMappingURL=1negint.d.ts.map \ No newline at end of file diff --git a/types/lib/1negint.d.ts.map b/types/lib/1negint.d.ts.map new file mode 100644 index 0000000..b32002d --- /dev/null +++ b/types/lib/1negint.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"1negint.d.ts","sourceRoot":"","sources":["../../lib/1negint.js"],"names":[],"mappings":"AAMA;;;GAGG;AAEH;;;;;;GAMG;AACH,oCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAIjB;AAED;;;;;;GAMG;AACH,qCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAIjB;AAED;;;;;;GAMG;AACH,qCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAIjB;AAKD;;;;;;GAMG;AACH,qCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAcjB;AAED;;;GAGG;AACH,kCAHW,EAAE,SACF,KAAK,QAMf;;IAED;;;OAGG;IACH,2CAkBC;IAED;;;;OAIG;IACH,yDAGC;;iBAvGY,OAAO,SAAS,EAAE,EAAE;4BACpB,OAAO,cAAc,EAAE,aAAa;sBANrB,YAAY"} \ No newline at end of file diff --git a/types/lib/2bytes.d.ts b/types/lib/2bytes.d.ts new file mode 100644 index 0000000..9b4312e --- /dev/null +++ b/types/lib/2bytes.d.ts @@ -0,0 +1,68 @@ +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} minor + * @param {DecodeOptions} _options + * @returns {Token} + */ +export function decodeBytesCompact(data: Uint8Array, pos: number, minor: number, _options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeBytes8(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeBytes16(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeBytes32(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeBytes64(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Bl} buf + * @param {Token} token + */ +export function encodeBytes(buf: Bl, token: Token): void; +export namespace encodeBytes { + /** + * @param {Token} token + * @returns {number} + */ + function encodedSize(token: Token): number; + /** + * @param {Token} tok1 + * @param {Token} tok2 + * @returns {number} + */ + function compareTokens(tok1: Token, tok2: Token): number; +} +/** + * @param {Uint8Array} b1 + * @param {Uint8Array} b2 + * @returns {number} + */ +export function compareBytes(b1: Uint8Array, b2: Uint8Array): number; +export type Bl = import('./bl.js').Bl; +export type DecodeOptions = import('../interface').DecodeOptions; +import { Token } from './token.js'; +//# sourceMappingURL=2bytes.d.ts.map \ No newline at end of file diff --git a/types/lib/2bytes.d.ts.map b/types/lib/2bytes.d.ts.map new file mode 100644 index 0000000..7912700 --- /dev/null +++ b/types/lib/2bytes.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"2bytes.d.ts","sourceRoot":"","sources":["../../lib/2bytes.js"],"names":[],"mappings":"AAuBA;;;;;;GAMG;AACH,yCANW,UAAU,OACV,MAAM,SACN,MAAM,YACN,aAAa,GACX,KAAK,CAIjB;AAED;;;;;;GAMG;AACH,mCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAIjB;AAED;;;;;;GAMG;AACH,oCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAIjB;AAED;;;;;;GAMG;AACH,oCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAIjB;AAGD;;;;;;GAMG;AACH,oCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAQjB;AAgBD;;;GAGG;AACH,iCAHW,EAAE,SACF,KAAK,QAMf;;IAED;;;OAGG;IACH,2CAGC;IAED;;;;OAIG;IACH,yDAEC;;AAED;;;;GAIG;AACH,iCAJW,UAAU,MACV,UAAU,GACR,MAAM,CAIlB;iBA9HY,OAAO,SAAS,EAAE,EAAE;4BACpB,OAAO,cAAc,EAAE,aAAa;sBAPrB,YAAY"} \ No newline at end of file diff --git a/types/lib/3string.d.ts b/types/lib/3string.d.ts new file mode 100644 index 0000000..eb7bb5e --- /dev/null +++ b/types/lib/3string.d.ts @@ -0,0 +1,46 @@ +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeStringCompact(data: Uint8Array, pos: number, minor: number, options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeString8(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeString16(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeString32(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeString64(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +export const encodeString: typeof encodeBytes; +export type Bl = import('./bl.js').Bl; +export type DecodeOptions = import('../interface').DecodeOptions; +import { Token } from './token.js'; +import { encodeBytes } from './2bytes.js'; +//# sourceMappingURL=3string.d.ts.map \ No newline at end of file diff --git a/types/lib/3string.d.ts.map b/types/lib/3string.d.ts.map new file mode 100644 index 0000000..d8ec26f --- /dev/null +++ b/types/lib/3string.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"3string.d.ts","sourceRoot":"","sources":["../../lib/3string.js"],"names":[],"mappings":"AA6BA;;;;;;GAMG;AACH,0CANW,UAAU,OACV,MAAM,SACN,MAAM,WACN,aAAa,GACX,KAAK,CAIjB;AAED;;;;;;GAMG;AACH,oCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAIjB;AAED;;;;;;GAMG;AACH,qCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAIjB;AAED;;;;;;GAMG;AACH,qCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAIjB;AAGD;;;;;;GAMG;AACH,qCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAQjB;AAED,8CAAuC;iBAlF1B,OAAO,SAAS,EAAE,EAAE;4BACpB,OAAO,cAAc,EAAE,aAAa;sBARrB,YAAY;4BAGZ,aAAa"} \ No newline at end of file diff --git a/types/lib/4array.d.ts b/types/lib/4array.d.ts new file mode 100644 index 0000000..25067e4 --- /dev/null +++ b/types/lib/4array.d.ts @@ -0,0 +1,65 @@ +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} minor + * @param {DecodeOptions} _options + * @returns {Token} + */ +export function decodeArrayCompact(data: Uint8Array, pos: number, minor: number, _options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeArray8(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeArray16(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeArray32(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeArray64(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeArrayIndefinite(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Bl} buf + * @param {Token} token + */ +export function encodeArray(buf: Bl, token: Token): void; +export namespace encodeArray { + let compareTokens: (tok1: Token, tok2: Token) => number; + /** + * @param {Token} token + * @returns {number} + */ + function encodedSize(token: Token): number; +} +export type Bl = import('./bl.js').Bl; +export type DecodeOptions = import('../interface').DecodeOptions; +import { Token } from './token.js'; +//# sourceMappingURL=4array.d.ts.map \ No newline at end of file diff --git a/types/lib/4array.d.ts.map b/types/lib/4array.d.ts.map new file mode 100644 index 0000000..11d6b4f --- /dev/null +++ b/types/lib/4array.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"4array.d.ts","sourceRoot":"","sources":["../../lib/4array.js"],"names":[],"mappings":"AAoBA;;;;;;GAMG;AACH,yCANW,UAAU,OACV,MAAM,SACN,MAAM,YACN,aAAa,GACX,KAAK,CAIjB;AAED;;;;;;GAMG;AACH,mCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAIjB;AAED;;;;;;GAMG;AACH,oCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAIjB;AAED;;;;;;GAMG;AACH,oCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAIjB;AAGD;;;;;;GAMG;AACH,oCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAQjB;AAED;;;;;;GAMG;AACH,4CANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAOjB;AAED;;;GAGG;AACH,iCAHW,EAAE,SACF,KAAK,QAIf;;;IAMD;;;OAGG;IACH,2CAEC;;iBA3GY,OAAO,SAAS,EAAE,EAAE;4BACpB,OAAO,cAAc,EAAE,aAAa;sBANrB,YAAY"} \ No newline at end of file diff --git a/types/lib/5map.d.ts b/types/lib/5map.d.ts new file mode 100644 index 0000000..e1d8df0 --- /dev/null +++ b/types/lib/5map.d.ts @@ -0,0 +1,65 @@ +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} minor + * @param {DecodeOptions} _options + * @returns {Token} + */ +export function decodeMapCompact(data: Uint8Array, pos: number, minor: number, _options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeMap8(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeMap16(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeMap32(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeMap64(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeMapIndefinite(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Bl} buf + * @param {Token} token + */ +export function encodeMap(buf: Bl, token: Token): void; +export namespace encodeMap { + let compareTokens: (tok1: Token, tok2: Token) => number; + /** + * @param {Token} token + * @returns {number} + */ + function encodedSize(token: Token): number; +} +export type Bl = import('./bl.js').Bl; +export type DecodeOptions = import('../interface').DecodeOptions; +import { Token } from './token.js'; +//# sourceMappingURL=5map.d.ts.map \ No newline at end of file diff --git a/types/lib/5map.d.ts.map b/types/lib/5map.d.ts.map new file mode 100644 index 0000000..bc8fae5 --- /dev/null +++ b/types/lib/5map.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"5map.d.ts","sourceRoot":"","sources":["../../lib/5map.js"],"names":[],"mappings":"AAoBA;;;;;;GAMG;AACH,uCANW,UAAU,OACV,MAAM,SACN,MAAM,YACN,aAAa,GACX,KAAK,CAIjB;AAED;;;;;;GAMG;AACH,iCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAIjB;AAED;;;;;;GAMG;AACH,kCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAIjB;AAED;;;;;;GAMG;AACH,kCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAIjB;AAGD;;;;;;GAMG;AACH,kCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAQjB;AAED;;;;;;GAMG;AACH,0CANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAOjB;AAED;;;GAGG;AACH,+BAHW,EAAE,SACF,KAAK,QAIf;;;IAMD;;;OAGG;IACH,2CAEC;;iBA3GY,OAAO,SAAS,EAAE,EAAE;4BACpB,OAAO,cAAc,EAAE,aAAa;sBANrB,YAAY"} \ No newline at end of file diff --git a/types/lib/6tag.d.ts b/types/lib/6tag.d.ts new file mode 100644 index 0000000..2ff2dce --- /dev/null +++ b/types/lib/6tag.d.ts @@ -0,0 +1,61 @@ +/** + * @typedef {import('./bl.js').Bl} Bl + * @typedef {import('../interface').DecodeOptions} DecodeOptions + */ +/** + * @param {Uint8Array} _data + * @param {number} _pos + * @param {number} minor + * @param {DecodeOptions} _options + * @returns {Token} + */ +export function decodeTagCompact(_data: Uint8Array, _pos: number, minor: number, _options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeTag8(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeTag16(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeTag32(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeTag64(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Bl} buf + * @param {Token} token + */ +export function encodeTag(buf: Bl, token: Token): void; +export namespace encodeTag { + let compareTokens: (tok1: Token, tok2: Token) => number; + /** + * @param {Token} token + * @returns {number} + */ + function encodedSize(token: Token): number; +} +export type Bl = import('./bl.js').Bl; +export type DecodeOptions = import('../interface').DecodeOptions; +import { Token } from './token.js'; +//# sourceMappingURL=6tag.d.ts.map \ No newline at end of file diff --git a/types/lib/6tag.d.ts.map b/types/lib/6tag.d.ts.map new file mode 100644 index 0000000..c4a67ba --- /dev/null +++ b/types/lib/6tag.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"6tag.d.ts","sourceRoot":"","sources":["../../lib/6tag.js"],"names":[],"mappings":"AAGA;;;GAGG;AAEH;;;;;;GAMG;AACH,wCANW,UAAU,QACV,MAAM,SACN,MAAM,YACN,aAAa,GACX,KAAK,CAIjB;AAED;;;;;;GAMG;AACH,iCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAIjB;AAED;;;;;;GAMG;AACH,kCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAIjB;AAED;;;;;;GAMG;AACH,kCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAIjB;AAED;;;;;;GAMG;AACH,kCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAIjB;AAED;;;GAGG;AACH,+BAHW,EAAE,SACF,KAAK,QAIf;;;IAID;;;OAGG;IACH,2CAEC;;iBA3EY,OAAO,SAAS,EAAE,EAAE;4BACpB,OAAO,cAAc,EAAE,aAAa;sBALrB,YAAY"} \ No newline at end of file diff --git a/types/lib/7float.d.ts b/types/lib/7float.d.ts new file mode 100644 index 0000000..16eeb3c --- /dev/null +++ b/types/lib/7float.d.ts @@ -0,0 +1,60 @@ +/** + * @param {Uint8Array} _data + * @param {number} _pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeUndefined(_data: Uint8Array, _pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Uint8Array} _data + * @param {number} _pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeBreak(_data: Uint8Array, _pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeFloat16(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeFloat32(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} _minor + * @param {DecodeOptions} options + * @returns {Token} + */ +export function decodeFloat64(data: Uint8Array, pos: number, _minor: number, options: DecodeOptions): Token; +/** + * @param {Bl} buf + * @param {Token} token + * @param {EncodeOptions} options + */ +export function encodeFloat(buf: Bl, token: Token, options: EncodeOptions): void; +export namespace encodeFloat { + /** + * @param {Token} token + * @param {EncodeOptions} options + * @returns {number} + */ + function encodedSize(token: Token, options: import("../interface").EncodeOptions): number; + let compareTokens: (tok1: Token, tok2: Token) => number; +} +export type Bl = import('./bl.js').Bl; +export type DecodeOptions = import('../interface').DecodeOptions; +export type EncodeOptions = import('../interface').EncodeOptions; +import { Token } from './token.js'; +//# sourceMappingURL=7float.d.ts.map \ No newline at end of file diff --git a/types/lib/7float.d.ts.map b/types/lib/7float.d.ts.map new file mode 100644 index 0000000..a7f1d2b --- /dev/null +++ b/types/lib/7float.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"7float.d.ts","sourceRoot":"","sources":["../../lib/7float.js"],"names":[],"mappings":"AAkBA;;;;;;GAMG;AACH,uCANW,UAAU,QACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CASjB;AAED;;;;;;GAMG;AACH,mCANW,UAAU,QACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAOjB;AAoBD;;;;;;GAMG;AACH,oCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAIjB;AAED;;;;;;GAMG;AACH,oCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAIjB;AAED;;;;;;GAMG;AACH,oCANW,UAAU,OACV,MAAM,UACN,MAAM,WACN,aAAa,GACX,KAAK,CAIjB;AAED;;;;GAIG;AACH,iCAJW,EAAE,SACF,KAAK,WACL,aAAa,QAwCvB;;IAED;;;;OAIG;IACH,0FAoBC;;;iBAjKY,OAAO,SAAS,EAAE,EAAE;4BACpB,OAAO,cAAc,EAAE,aAAa;4BACpC,OAAO,cAAc,EAAE,aAAa;sBAPrB,YAAY"} \ No newline at end of file diff --git a/types/lib/bin.d.ts b/types/lib/bin.d.ts new file mode 100644 index 0000000..b3fd6ab --- /dev/null +++ b/types/lib/bin.d.ts @@ -0,0 +1,4 @@ +#!/usr/bin/env node +declare const _default: true; +export default _default; +//# sourceMappingURL=bin.d.ts.map \ No newline at end of file diff --git a/types/lib/bin.d.ts.map b/types/lib/bin.d.ts.map new file mode 100644 index 0000000..5e91ab7 --- /dev/null +++ b/types/lib/bin.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../lib/bin.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/types/lib/bl.d.ts b/types/lib/bl.d.ts new file mode 100644 index 0000000..8f6d3aa --- /dev/null +++ b/types/lib/bl.d.ts @@ -0,0 +1,26 @@ +export class Bl { + /** + * @param {number} [chunkSize] + */ + constructor(chunkSize?: number | undefined); + chunkSize: number; + /** @type {number} */ + cursor: number; + /** @type {number} */ + maxCursor: number; + /** @type {(Uint8Array|number[])[]} */ + chunks: (Uint8Array | number[])[]; + /** @type {Uint8Array|number[]|null} */ + _initReuseChunk: Uint8Array | number[] | null; + reset(): void; + /** + * @param {Uint8Array|number[]} bytes + */ + push(bytes: Uint8Array | number[]): void; + /** + * @param {boolean} [reset] + * @returns {Uint8Array} + */ + toBytes(reset?: boolean | undefined): Uint8Array; +} +//# sourceMappingURL=bl.d.ts.map \ No newline at end of file diff --git a/types/lib/bl.d.ts.map b/types/lib/bl.d.ts.map new file mode 100644 index 0000000..c80a00d --- /dev/null +++ b/types/lib/bl.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bl.d.ts","sourceRoot":"","sources":["../../lib/bl.js"],"names":[],"mappings":"AA0BA;IACE;;OAEG;IACH,4CAWC;IAVC,kBAA0B;IAC1B,qBAAqB;IACrB,QADW,MAAM,CACF;IACf,qBAAqB;IACrB,WADW,MAAM,CACE;IACnB,sCAAsC;IACtC,QADW,CAAC,UAAU,GAAC,MAAM,EAAE,CAAC,EAAE,CAClB;IAEhB,uCAAuC;IACvC,iBADW,UAAU,GAAC,MAAM,EAAE,GAAC,IAAI,CACR;IAG7B,cAUC;IAED;;OAEG;IACH,YAFW,UAAU,GAAC,MAAM,EAAE,QAsC7B;IAED;;;OAGG;IACH,sCAFa,UAAU,CAwBtB;CACF"} \ No newline at end of file diff --git a/types/lib/byte-utils.d.ts b/types/lib/byte-utils.d.ts new file mode 100644 index 0000000..f8abf66 --- /dev/null +++ b/types/lib/byte-utils.d.ts @@ -0,0 +1,53 @@ +/** + * @param {Uint8Array|number[]} buf + * @returns {Uint8Array} + */ +export function asU8A(buf: Uint8Array | number[]): Uint8Array; +/** + * @param {Uint8Array} b1 + * @param {Uint8Array} b2 + * @returns {number} + */ +export function compare(b1: Uint8Array, b2: Uint8Array): number; +/** + * @param {number[]} codePoints + * @returns {string} + */ +export function decodeCodePointsArray(codePoints: number[]): string; +export const useBuffer: boolean; +/** + * @param {Uint8Array} bytes + * @param {number} start + * @param {number} end + */ +export function toString(bytes: Uint8Array, start: number, end: number): string; +export const fromString: ((string: string) => number[] | Buffer) | ((string: string) => Uint8Array | number[]); +export function fromArray(arr: number[]): Uint8Array; +/** + * @param {Uint8Array} bytes + * @param {number} start + * @param {number} end + */ +export function slice(bytes: Uint8Array, start: number, end: number): Uint8Array; +/** + * @param {Uint8Array[]} chunks + * @param {number} length + * @returns {Uint8Array} + */ +export function concat(chunks: Uint8Array[], length: number): Uint8Array; +/** + * @param {number} size + * @returns {Uint8Array} + */ +export function alloc(size: number): Uint8Array; +/** + * @param {Uint8Array} d + * @returns {string} + */ +export function toHex(d: Uint8Array): string; +/** + * @param {string|Uint8Array} hex + * @returns {Uint8Array} + */ +export function fromHex(hex: string | Uint8Array): Uint8Array; +//# sourceMappingURL=byte-utils.d.ts.map \ No newline at end of file diff --git a/types/lib/byte-utils.d.ts.map b/types/lib/byte-utils.d.ts.map new file mode 100644 index 0000000..f025422 --- /dev/null +++ b/types/lib/byte-utils.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"byte-utils.d.ts","sourceRoot":"","sources":["../../lib/byte-utils.js"],"names":[],"mappings":"AAwBA;;;GAGG;AACH,2BAHW,UAAU,GAAC,MAAM,EAAE,GACjB,UAAU,CAQtB;AA8ND;;;;GAIG;AACH,4BAJW,UAAU,MACV,UAAU,GACR,MAAM,CAgBlB;AAkLD;;;GAGG;AACH,kDAHW,MAAM,EAAE,GACN,MAAM,CAkBlB;AArdD,gCAMkD;AA4B9C;;;;GAIG;AACH,gCAJW,UAAU,SACV,MAAM,OACN,MAAM,UAQhB;AAcL,mCAGe,MAAM,oCAYN,MAAM,4BAIhB;AAOE,+BAHI,MAAM,EAAE,GACN,UAAU,CAItB;AAIG;;;;GAIG;AACH,6BAJW,UAAU,SACV,MAAM,OACN,MAAM,cAOhB;AAcD;;;;GAIG;AACH,+BAJW,UAAU,EAAE,UACZ,MAAM,GACJ,UAAU,CActB;AAwBD;;;GAGG;AACH,4BAHW,MAAM,GACJ,UAAU,CAMtB;AAaD;;;GAGG;AACH,yBAHW,UAAU,GACR,MAAM,CAQlB;AAiBH;;;GAGG;AACD,6BAHS,MAAM,GAAC,UAAU,GACf,UAAU,CAQpB"} \ No newline at end of file diff --git a/types/lib/common.d.ts b/types/lib/common.d.ts new file mode 100644 index 0000000..69e8342 --- /dev/null +++ b/types/lib/common.d.ts @@ -0,0 +1,10 @@ +export const decodeErrPrefix: "CBOR decode error:"; +export const encodeErrPrefix: "CBOR encode error:"; +export const uintMinorPrefixBytes: any[]; +/** + * @param {Uint8Array} data + * @param {number} pos + * @param {number} need + */ +export function assertEnoughData(data: Uint8Array, pos: number, need: number): void; +//# sourceMappingURL=common.d.ts.map \ No newline at end of file diff --git a/types/lib/common.d.ts.map b/types/lib/common.d.ts.map new file mode 100644 index 0000000..78aa052 --- /dev/null +++ b/types/lib/common.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../lib/common.js"],"names":[],"mappings":"AAAA,mDAA4C;AAC5C,mDAA4C;AAE5C,yCAA+B;AAO/B;;;;GAIG;AACH,uCAJW,UAAU,OACV,MAAM,QACN,MAAM,QAMhB"} \ No newline at end of file diff --git a/types/lib/decode.d.ts b/types/lib/decode.d.ts new file mode 100644 index 0000000..897fab2 --- /dev/null +++ b/types/lib/decode.d.ts @@ -0,0 +1,34 @@ +export type Token = import('./token.js').Token; +export type DecodeOptions = import('../interface').DecodeOptions; +export type DecodeTokenizer = import('../interface').DecodeTokenizer; +/** + * @implements {DecodeTokenizer} + */ +export class Tokeniser implements DecodeTokenizer { + /** + * @param {Uint8Array} data + * @param {DecodeOptions} options + */ + constructor(data: Uint8Array, options?: DecodeOptions); + pos: number; + data: Uint8Array; + options: import("../interface").DecodeOptions; + done(): boolean; + next(): import("./token.js").Token; +} +/** + * @param {DecodeTokenizer} tokeniser + * @param {DecodeOptions} options + * @returns {any|BREAK|DONE} + */ +export function tokensToObject(tokeniser: DecodeTokenizer, options: DecodeOptions): any | typeof BREAK | typeof DONE; +/** + * @param {Uint8Array} data + * @param {DecodeOptions} [options] + * @returns {any} + */ +export function decode(data: Uint8Array, options?: import("../interface").DecodeOptions | undefined): any; +declare const BREAK: unique symbol; +declare const DONE: unique symbol; +export {}; +//# sourceMappingURL=decode.d.ts.map \ No newline at end of file diff --git a/types/lib/decode.d.ts.map b/types/lib/decode.d.ts.map new file mode 100644 index 0000000..eb78373 --- /dev/null +++ b/types/lib/decode.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../lib/decode.js"],"names":[],"mappings":"oBAKa,OAAO,YAAY,EAAE,KAAK;4BAC1B,OAAO,cAAc,EAAE,aAAa;8BACpC,OAAO,cAAc,EAAE,eAAe;AAUnD;;GAEG;AACH;IACE;;;OAGG;IACH,kBAHW,UAAU,YACV,aAAa,EAMvB;IAHC,YAAY;IACZ,iBAAgB;IAChB,8CAAsB;IAGxB,gBAEC;IAED,mCAgBC;CACF;AA6ED;;;;GAIG;AACH,0CAJW,eAAe,WACf,aAAa,GACX,GAAG,6BAAW,CAoC1B;AAED;;;;GAIG;AACH,6BAJW,UAAU,+DAER,GAAG,CAmBf;AAzID,mCAAiC;AADjC,kCAA+B"} \ No newline at end of file diff --git a/types/lib/diagnostic.d.ts b/types/lib/diagnostic.d.ts new file mode 100644 index 0000000..38da7fc --- /dev/null +++ b/types/lib/diagnostic.d.ts @@ -0,0 +1,12 @@ +/** + * @param {Uint8Array} inp + * @param {number} [width] + */ +export function tokensToDiagnostic(inp: Uint8Array, width?: number | undefined): Generator; +/** + * Convert an input string formatted as CBOR diagnostic output into binary CBOR form. + * @param {string} input + * @returns {Uint8Array} + */ +export function fromDiag(input: string): Uint8Array; +//# sourceMappingURL=diagnostic.d.ts.map \ No newline at end of file diff --git a/types/lib/diagnostic.d.ts.map b/types/lib/diagnostic.d.ts.map new file mode 100644 index 0000000..611d727 --- /dev/null +++ b/types/lib/diagnostic.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"diagnostic.d.ts","sourceRoot":"","sources":["../../lib/diagnostic.js"],"names":[],"mappings":"AAOA;;;GAGG;AACH,wCAHW,UAAU,gEA6HpB;AAED;;;;GAIG;AACH,gCAHW,MAAM,GACJ,UAAU,CAatB"} \ No newline at end of file diff --git a/types/lib/diagnostic_test.d.ts b/types/lib/diagnostic_test.d.ts new file mode 100644 index 0000000..131d932 --- /dev/null +++ b/types/lib/diagnostic_test.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=diagnostic_test.d.ts.map \ No newline at end of file diff --git a/types/lib/diagnostic_test.d.ts.map b/types/lib/diagnostic_test.d.ts.map new file mode 100644 index 0000000..373951e --- /dev/null +++ b/types/lib/diagnostic_test.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"diagnostic_test.d.ts","sourceRoot":"","sources":["../../lib/diagnostic_test.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/types/lib/encode.d.ts b/types/lib/encode.d.ts new file mode 100644 index 0000000..234890c --- /dev/null +++ b/types/lib/encode.d.ts @@ -0,0 +1,50 @@ +/** @returns {TokenTypeEncoder[]} */ +export function makeCborEncoders(): TokenTypeEncoder[]; +export type EncodeOptions = import('../interface').EncodeOptions; +export type OptionalTypeEncoder = import('../interface').OptionalTypeEncoder; +export type Reference = import('../interface').Reference; +export type StrictTypeEncoder = import('../interface').StrictTypeEncoder; +export type TokenTypeEncoder = import('../interface').TokenTypeEncoder; +export type TokenOrNestedTokens = import('../interface').TokenOrNestedTokens; +/** + * @param {any} obj + * @param {EncodeOptions} [options] + * @param {Reference} [refStack] + * @returns {TokenOrNestedTokens} + */ +export function objectToTokens(obj: any, options?: import("../interface").EncodeOptions | undefined, refStack?: import("../interface").Reference | undefined): TokenOrNestedTokens; +/** + * @param {any} data + * @param {EncodeOptions} [options] + * @returns {Uint8Array} + */ +export function encode(data: any, options?: import("../interface").EncodeOptions | undefined): Uint8Array; +/** + * @param {any} data + * @param {TokenTypeEncoder[]} encoders + * @param {EncodeOptions} options + * @returns {Uint8Array} + */ +export function encodeCustom(data: any, encoders: TokenTypeEncoder[], options: EncodeOptions): Uint8Array; +/** @implements {Reference} */ +export class Ref implements Reference { + /** + * @param {Reference|undefined} stack + * @param {object|any[]} obj + * @returns {Reference} + */ + static createCheck(stack: Reference | undefined, obj: object | any[]): Reference; + /** + * @param {object|any[]} obj + * @param {Reference|undefined} parent + */ + constructor(obj: object | any[], parent: Reference | undefined); + obj: object | any[]; + parent: import("../interface").Reference | undefined; + /** + * @param {object|any[]} obj + * @returns {boolean} + */ + includes(obj: object | any[]): boolean; +} +//# sourceMappingURL=encode.d.ts.map \ No newline at end of file diff --git a/types/lib/encode.d.ts.map b/types/lib/encode.d.ts.map new file mode 100644 index 0000000..9aafff2 --- /dev/null +++ b/types/lib/encode.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../lib/encode.js"],"names":[],"mappings":"AAgCA,oCAAoC;AACpC,oCADc,gBAAgB,EAAE,CAY/B;4BA3BY,OAAO,cAAc,EAAE,aAAa;kCACpC,OAAO,cAAc,EAAE,mBAAmB;wBAC1C,OAAO,cAAc,EAAE,SAAS;gCAChC,OAAO,cAAc,EAAE,iBAAiB;+BACxC,OAAO,cAAc,EAAE,gBAAgB;kCACvC,OAAO,cAAc,EAAE,mBAAmB;AAgQvD;;;;;GAKG;AACH,oCALW,GAAG,wHAGD,mBAAmB,CAgB/B;AA2JD;;;;GAIG;AACH,6BAJW,GAAG,+DAED,UAAU,CAKtB;AAvCD;;;;;GAKG;AACH,mCALW,GAAG,YACH,gBAAgB,EAAE,WAClB,aAAa,GACX,UAAU,CAyBtB;AAjZD,8BAA8B;AAC9B;IAyBE;;;;OAIG;IACH,0BAJW,SAAS,GAAC,SAAS,OACnB,MAAM,GAAC,GAAG,EAAE,GACV,SAAS,CAOrB;IAlCD;;;OAGG;IACH,iBAHW,MAAM,GAAC,GAAG,EAAE,UACZ,SAAS,GAAC,SAAS,EAK7B;IAFC,oBAAc;IACd,qDAAoB;IAGtB;;;OAGG;IACH,cAHW,MAAM,GAAC,GAAG,EAAE,GACV,OAAO,CAWnB;CAaF"} \ No newline at end of file diff --git a/types/lib/is.d.ts b/types/lib/is.d.ts new file mode 100644 index 0000000..30d30f9 --- /dev/null +++ b/types/lib/is.d.ts @@ -0,0 +1,6 @@ +/** + * @param {any} value + * @returns {string} + */ +export function is(value: any): string; +//# sourceMappingURL=is.d.ts.map \ No newline at end of file diff --git a/types/lib/is.d.ts.map b/types/lib/is.d.ts.map new file mode 100644 index 0000000..f8da276 --- /dev/null +++ b/types/lib/is.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"is.d.ts","sourceRoot":"","sources":["../../lib/is.js"],"names":[],"mappings":"AAiDA;;;GAGG;AACH,0BAHW,GAAG,GACD,MAAM,CAiClB"} \ No newline at end of file diff --git a/types/lib/json/decode.d.ts b/types/lib/json/decode.d.ts new file mode 100644 index 0000000..c1003db --- /dev/null +++ b/types/lib/json/decode.d.ts @@ -0,0 +1,60 @@ +export type DecodeOptions = import('../../interface').DecodeOptions; +export type DecodeTokenizer = import('../../interface').DecodeTokenizer; +/** + * @param {Uint8Array} data + * @param {DecodeOptions} [options] + * @returns {any} + */ +export function decode(data: Uint8Array, options?: import("../../interface").DecodeOptions | undefined): any; +/** + * @typedef {import('../../interface').DecodeOptions} DecodeOptions + * @typedef {import('../../interface').DecodeTokenizer} DecodeTokenizer + */ +/** + * @implements {DecodeTokenizer} + */ +export class Tokenizer implements DecodeTokenizer { + /** + * @param {Uint8Array} data + * @param {DecodeOptions} options + */ + constructor(data: Uint8Array, options?: DecodeOptions); + pos: number; + data: Uint8Array; + options: import("../../interface").DecodeOptions; + /** @type {string[]} */ + modeStack: string[]; + lastToken: string; + /** + * @returns {boolean} + */ + done(): boolean; + /** + * @returns {number} + */ + ch(): number; + /** + * @returns {string} + */ + currentMode(): string; + skipWhitespace(): void; + /** + * @param {number[]} str + */ + expect(str: number[]): void; + parseNumber(): Token; + /** + * @returns {Token} + */ + parseString(): Token; + /** + * @returns {Token} + */ + parseValue(): Token; + /** + * @returns {Token} + */ + next(): Token; +} +import { Token } from '../token.js'; +//# sourceMappingURL=decode.d.ts.map \ No newline at end of file diff --git a/types/lib/json/decode.d.ts.map b/types/lib/json/decode.d.ts.map new file mode 100644 index 0000000..0da2f22 --- /dev/null +++ b/types/lib/json/decode.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../../lib/json/decode.js"],"names":[],"mappings":"4BAMa,OAAO,iBAAiB,EAAE,aAAa;8BACvC,OAAO,iBAAiB,EAAE,eAAe;AA4atD;;;;GAIG;AACH,6BAJW,UAAU,kEAER,GAAG,CAKf;AAtbD;;;GAGG;AAEH;;GAEG;AACH;IACE;;;OAGG;IACH,kBAHW,UAAU,YACV,aAAa,EASvB;IANC,YAAY;IACZ,iBAAgB;IAChB,iDAAsB;IACtB,uBAAuB;IACvB,WADW,MAAM,EAAE,CACO;IAC1B,kBAAmB;IAGrB;;OAEG;IACH,QAFa,OAAO,CAInB;IAED;;OAEG;IACH,MAFa,MAAM,CAIlB;IAED;;OAEG;IACH,eAFa,MAAM,CAIlB;IAED,uBAMC;IAED;;OAEG;IACH,YAFW,MAAM,EAAE,QAWlB;IAED,qBA+DC;IAED;;OAEG;IACH,eAFa,KAAK,CAkLjB;IAED;;OAEG;IACH,cAFa,KAAK,CAuCjB;IAED;;OAEG;IACH,QAFa,KAAK,CAyEjB;CACF;sBAhb2B,aAAa"} \ No newline at end of file diff --git a/types/lib/json/encode.d.ts b/types/lib/json/encode.d.ts new file mode 100644 index 0000000..1feca14 --- /dev/null +++ b/types/lib/json/encode.d.ts @@ -0,0 +1,10 @@ +export type EncodeOptions = import('../../interface').EncodeOptions; +export type Token = import('../token').Token; +export type Bl = import('../bl').Bl; +/** + * @param {any} data + * @param {EncodeOptions} [options] + * @returns {Uint8Array} + */ +export function encode(data: any, options?: import("../../interface").EncodeOptions | undefined): Uint8Array; +//# sourceMappingURL=encode.d.ts.map \ No newline at end of file diff --git a/types/lib/json/encode.d.ts.map b/types/lib/json/encode.d.ts.map new file mode 100644 index 0000000..c37412a --- /dev/null +++ b/types/lib/json/encode.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../../lib/json/encode.js"],"names":[],"mappings":"4BAMa,OAAO,iBAAiB,EAAE,aAAa;oBACvC,OAAO,UAAU,EAAE,KAAK;iBACxB,OAAO,OAAO,EAAE,EAAE;AAoS/B;;;;GAIG;AACH,6BAJW,GAAG,kEAED,UAAU,CAKtB"} \ No newline at end of file diff --git a/types/lib/json/json.d.ts b/types/lib/json/json.d.ts new file mode 100644 index 0000000..3a17b50 --- /dev/null +++ b/types/lib/json/json.d.ts @@ -0,0 +1,5 @@ +import { encode } from './encode.js'; +import { decode } from './decode.js'; +import { Tokenizer } from './decode.js'; +export { encode, decode, Tokenizer }; +//# sourceMappingURL=json.d.ts.map \ No newline at end of file diff --git a/types/lib/json/json.d.ts.map b/types/lib/json/json.d.ts.map new file mode 100644 index 0000000..e1014ed --- /dev/null +++ b/types/lib/json/json.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../../lib/json/json.js"],"names":[],"mappings":"uBAAuB,aAAa;uBACF,aAAa;0BAAb,aAAa"} \ No newline at end of file diff --git a/types/lib/jump.d.ts b/types/lib/jump.d.ts new file mode 100644 index 0000000..d9557d3 --- /dev/null +++ b/types/lib/jump.d.ts @@ -0,0 +1,12 @@ +/** + * @param {Token} token + * @returns {Uint8Array|undefined} + */ +export function quickEncodeToken(token: Token): Uint8Array | undefined; +/** @type {((data:Uint8Array, pos:number, minor:number, options?:DecodeOptions) => any)[]} */ +export const jump: ((data: Uint8Array, pos: number, minor: number, options?: DecodeOptions) => any)[]; +/** @type {Token[]} */ +export const quick: Token[]; +export type DecodeOptions = import('../interface').DecodeOptions; +import { Token } from './token.js'; +//# sourceMappingURL=jump.d.ts.map \ No newline at end of file diff --git a/types/lib/jump.d.ts.map b/types/lib/jump.d.ts.map new file mode 100644 index 0000000..01b2adb --- /dev/null +++ b/types/lib/jump.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"jump.d.ts","sourceRoot":"","sources":["../../lib/jump.js"],"names":[],"mappings":"AAkKA;;;GAGG;AACH,wCAHW,KAAK,GACH,UAAU,GAAC,SAAS,CA4ChC;AA/KD,6FAA6F;AAC7F,2BADkB,UAAU,OAAM,MAAM,SAAQ,MAAM,YAAW,aAAa,KAAK,GAAG,IAChE;AAuGtB,sBAAsB;AACtB,oBADW,KAAK,EAAE,CACK;4BA7HV,OAAO,cAAc,EAAE,aAAa;sBAbrB,YAAY"} \ No newline at end of file diff --git a/types/lib/length.d.ts b/types/lib/length.d.ts new file mode 100644 index 0000000..92524c6 --- /dev/null +++ b/types/lib/length.d.ts @@ -0,0 +1,27 @@ +/** + * Calculate the byte length of the given data when encoded as CBOR with the + * options provided. + * This calculation will be accurate if the same options are used as when + * performing a normal encode. Some encode options can change the encoding + * output length. + * + * @param {any} data + * @param {EncodeOptions} [options] + * @returns {number} + */ +export function encodedLength(data: any, options?: import("../interface").EncodeOptions | undefined): number; +/** + * Calculate the byte length of the data as represented by the given tokens when + * encoded as CBOR with the options provided. + * This function is for advanced users and would not normally be called + * directly. See `encodedLength()` for appropriate use. + * + * @param {TokenOrNestedTokens} tokens + * @param {TokenTypeEncoder[]} [encoders] + * @param {EncodeOptions} [options] + */ +export function tokensToLength(tokens: TokenOrNestedTokens, encoders?: import("../interface").TokenTypeEncoder[] | undefined, options?: import("../interface").EncodeOptions | undefined): number; +export type EncodeOptions = import('../interface').EncodeOptions; +export type TokenTypeEncoder = import('../interface').TokenTypeEncoder; +export type TokenOrNestedTokens = import('../interface').TokenOrNestedTokens; +//# sourceMappingURL=length.d.ts.map \ No newline at end of file diff --git a/types/lib/length.d.ts.map b/types/lib/length.d.ts.map new file mode 100644 index 0000000..77fde7a --- /dev/null +++ b/types/lib/length.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"length.d.ts","sourceRoot":"","sources":["../../lib/length.js"],"names":[],"mappings":"AAiBA;;;;;;;;;;GAUG;AACH,oCAJW,GAAG,+DAED,MAAM,CAOlB;AAED;;;;;;;;;GASG;AACH,uCAJW,mBAAmB,wIAmB7B;4BAxDY,OAAO,cAAc,EAAE,aAAa;+BACpC,OAAO,cAAc,EAAE,gBAAgB;kCACvC,OAAO,cAAc,EAAE,mBAAmB"} \ No newline at end of file diff --git a/types/lib/token.d.ts b/types/lib/token.d.ts new file mode 100644 index 0000000..a2bbbbd --- /dev/null +++ b/types/lib/token.d.ts @@ -0,0 +1,54 @@ +export class Type { + /** + * @param {number} major + * @param {string} name + * @param {boolean} terminal + */ + constructor(major: number, name: string, terminal: boolean); + major: number; + majorEncoded: number; + name: string; + terminal: boolean; + toString(): string; + /** + * @param {Type} typ + * @returns {number} + */ + compare(typ: Type): number; +} +export namespace Type { + export let uint: Type; + export let negint: Type; + export let bytes: Type; + export let string: Type; + export let array: Type; + export let map: Type; + export let tag: Type; + export let float: Type; + let _false: Type; + export { _false as false }; + let _true: Type; + export { _true as true }; + let _null: Type; + export { _null as null }; + export let undefined: Type; + let _break: Type; + export { _break as break }; +} +export class Token { + /** + * @param {Type} type + * @param {any} [value] + * @param {number} [encodedLength] + */ + constructor(type: Type, value?: any, encodedLength?: number | undefined); + type: Type; + value: any; + encodedLength: number | undefined; + /** @type {Uint8Array|undefined} */ + encodedBytes: Uint8Array | undefined; + /** @type {Uint8Array|undefined} */ + byteValue: Uint8Array | undefined; + toString(): string; +} +//# sourceMappingURL=token.d.ts.map \ No newline at end of file diff --git a/types/lib/token.d.ts.map b/types/lib/token.d.ts.map new file mode 100644 index 0000000..dc3add5 --- /dev/null +++ b/types/lib/token.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../lib/token.js"],"names":[],"mappings":"AAAA;IACE;;;;OAIG;IACH,mBAJW,MAAM,QACN,MAAM,YACN,OAAO,EAOjB;IAJC,cAAkB;IAClB,qBAA8B;IAC9B,aAAgB;IAChB,kBAAwB;IAI1B,mBAEC;IAED;;;OAGG;IACH,aAHW,IAAI,GACF,MAAM,CAKlB;CACF;;;;;;;;;;;;;;;;;;;;AAkBD;IACE;;;;OAIG;IACH,kBAJW,IAAI,UACJ,GAAG,sCAWb;IAPC,WAAgB;IAChB,WAAkB;IAClB,kCAAkC;IAClC,mCAAmC;IACnC,cADW,UAAU,GAAC,SAAS,CACF;IAC7B,mCAAmC;IACnC,WADW,UAAU,GAAC,SAAS,CACL;IAI5B,mBAEC;CACF"} \ No newline at end of file diff --git a/types/taglib.d.ts b/types/taglib.d.ts new file mode 100644 index 0000000..cd6a86c --- /dev/null +++ b/types/taglib.d.ts @@ -0,0 +1,18 @@ +/** + * @param {Uint8Array} bytes + * @returns {bigint} + */ +export function bigIntDecoder(bytes: Uint8Array): bigint; +/** + * @param {bigint} obj + * @returns {Token[]|null} + */ +export function bigIntEncoder(obj: bigint): Token[] | null; +/** + * TAG(3) Negative Bignums https://tools.ietf.org/html/rfc8949#section-3.4.3 + * @param {Uint8Array} bytes + * @returns {bigint} + */ +export function bigNegIntDecoder(bytes: Uint8Array): bigint; +import { Token } from './cborg.js'; +//# sourceMappingURL=taglib.d.ts.map \ No newline at end of file diff --git a/types/taglib.d.ts.map b/types/taglib.d.ts.map new file mode 100644 index 0000000..fa3a92a --- /dev/null +++ b/types/taglib.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"taglib.d.ts","sourceRoot":"","sources":["../taglib.js"],"names":[],"mappings":"AAqBA;;;GAGG;AACH,qCAHW,UAAU,GACR,MAAM,CASlB;AAmBD;;;GAGG;AACH,mCAHW,MAAM,GACJ,KAAK,EAAE,GAAC,IAAI,CAUxB;AAED;;;;GAIG;AACH,wCAHW,UAAU,GACR,MAAM,CAIlB;sBAxE2B,YAAY"} \ No newline at end of file