Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Types declaration for libs (pako & mmtf)
- Loading branch information
Showing
2 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Type definitions for mmtf | ||
export = Mmtf; | ||
export as namespace mmtf; | ||
|
||
declare namespace Mmtf { | ||
|
||
export type Fields = | ||
"mmtfVersion"| "mmtfProducer"| | ||
"unitCell"| "spaceGroup"| "structureId"| "title"| | ||
"depositionDate"| "releaseDate"| | ||
"experimentalMethods"| "resolution"| "rFree"| "rWork"| | ||
"bioAssemblyList"| "ncsOperatorList"| "entityList"| "groupList"| | ||
"numBonds"| "numAtoms"| "numGroups"| "numChains"| "numModels"| | ||
"groupsPerChain"| "chainsPerModel"| "xCoordList"| "yCoordList"| "zCoordList"| | ||
"groupIdList"| "groupTypeList"| | ||
"chainIdList"| | ||
// optional | ||
"bFactorList"| "atomIdList"| "altLocList"| "occupancyList"| | ||
"secStructList"| "insCodeList"| "sequenceIndexList"| | ||
"chainNameList"| | ||
"bondAtomList"| "bondOrderList" | ||
|
||
/** | ||
* decode binary encoded MessagePack v5 (http://msgpack.org/) data | ||
*/ | ||
export function decodeMsgpack( buffer: Uint8Array): {[k in Fields]: string|Uint8Array}; | ||
|
||
export interface DecodingParameters { | ||
ignoreFields: string[], | ||
[k: string]: any | ||
} | ||
|
||
export function decodeMmtf(inputDict: {[k in Fields]: Uint8Array|string}, params?:Partial<DecodingParameters>): {[k in Fields]: any} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// Type definitions for pako 1.0.4 | ||
// Project: https://github.com/nodeca/pako | ||
// Definitions by: Denis Cappellin <https://github.com/cappellin>, Caleb Eggensperger <https://github.com/calebegg> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
export = Pako; | ||
export as namespace pako; | ||
|
||
declare namespace Pako { | ||
export interface DeflateOptions { | ||
level?: number; | ||
windowBits?: number; | ||
memLevel?: number; | ||
strategy?: number; | ||
dictionary?: any; | ||
raw?: boolean; | ||
to?: 'string'; | ||
} | ||
|
||
export interface InflateOptions { | ||
windowBits?: number; | ||
raw?: boolean; | ||
to?: 'string'; | ||
} | ||
|
||
export type Data = Uint8Array | Array<number> | string; | ||
|
||
/** | ||
* Compress data with deflate algorithm and options. | ||
*/ | ||
export function deflate( data: Data, options: DeflateOptions & {to: 'string'} ): string; | ||
export function deflate( data: Data, options?: DeflateOptions ): Uint8Array; | ||
|
||
/** | ||
* The same as deflate, but creates raw data, without wrapper (header and adler32 crc). | ||
*/ | ||
export function deflateRaw( data: Data, options: DeflateOptions & {to: 'string'} ): string; | ||
export function deflateRaw( data: Data, options?: DeflateOptions ): Uint8Array; | ||
|
||
/** | ||
* The same as deflate, but create gzip wrapper instead of deflate one. | ||
*/ | ||
export function gzip( data: Data, options: DeflateOptions & {to: 'string'} ): string; | ||
export function gzip( data: Data, options?: DeflateOptions ): Uint8Array; | ||
|
||
/** | ||
* Decompress data with inflate/ungzip and options. Autodetect format via wrapper header | ||
* by default. That's why we don't provide separate ungzip method. | ||
*/ | ||
export function inflate( data: Data, options: InflateOptions & {to: 'string'} ): string; | ||
export function inflate( data: Data, options?: InflateOptions ): Uint8Array; | ||
|
||
/** | ||
* The same as inflate, but creates raw data, without wrapper (header and adler32 crc). | ||
*/ | ||
export function inflateRaw( data: Data, options: InflateOptions & {to: 'string'} ): string; | ||
export function inflateRaw( data: Data, options?: InflateOptions ): Uint8Array; | ||
|
||
/** | ||
* Just shortcut to inflate, because it autodetects format by header.content. Done for convenience. | ||
*/ | ||
export function ungzip( data: Data, options: InflateOptions & {to: 'string'} ): string; | ||
export function ungzip( data: Data, options?: InflateOptions ): Uint8Array; | ||
|
||
export class Deflate { | ||
constructor( options?: DeflateOptions ); | ||
err: number; | ||
msg: string; | ||
result: Uint8Array | Array<number>; | ||
onData( chunk: Data ): void; | ||
onEnd( status: number ): void; | ||
push( data: Data | ArrayBuffer, mode?: number | boolean ): boolean; | ||
} | ||
|
||
export class Inflate { | ||
constructor( options?: InflateOptions ); | ||
err: number; | ||
msg: string; | ||
result: Data; | ||
onData( chunk: Data ): void; | ||
onEnd( status: number ): void; | ||
push( data: Data | ArrayBuffer, mode?: number | boolean ): boolean; | ||
} | ||
} |