2017-02-03 20:50:45 +00:00
|
|
|
/*::
|
|
|
|
declare module 'exit-on-epipe' {};
|
|
|
|
|
2018-04-21 15:16:37 +00:00
|
|
|
declare module 'xlsx' { declare module.exports:XLSXModule; };
|
|
|
|
declare module '../' { declare module.exports:XLSXModule; };
|
2017-02-03 20:50:45 +00:00
|
|
|
|
2018-04-21 15:16:37 +00:00
|
|
|
declare module 'commander' { declare module.exports:any; };
|
|
|
|
declare module './jszip.js' { declare module.exports:any; };
|
|
|
|
declare module './dist/cpexcel.js' { declare module.exports:any; };
|
|
|
|
declare module 'crypto' { declare module.exports:any; };
|
|
|
|
declare module 'fs' { declare module.exports:any; };
|
2017-02-10 19:23:01 +00:00
|
|
|
|
|
|
|
type ZIP = any;
|
2017-05-13 18:21:22 +00:00
|
|
|
|
2017-07-28 23:27:16 +00:00
|
|
|
type SSFTable = {[key:number|string]:string};
|
|
|
|
type SSFDate = {
|
|
|
|
D:number; T:number;
|
|
|
|
y:number; m:number; d:number; q:number;
|
|
|
|
H:number; M:number; S:number; u:number;
|
|
|
|
};
|
|
|
|
|
|
|
|
type SSFModule = {
|
|
|
|
format:(fmt:string|number, v:any, o:any)=>string;
|
|
|
|
|
|
|
|
is_date:(fmt:string)=>boolean;
|
|
|
|
parse_date_code:(v:number,opts:any)=>?SSFDate;
|
|
|
|
|
|
|
|
load:(fmt:string, idx:?number)=>number;
|
|
|
|
get_table:()=>SSFTable;
|
|
|
|
load_table:(table:any)=>void;
|
|
|
|
_table:SSFTable;
|
|
|
|
init_table:any;
|
|
|
|
|
|
|
|
_general_int:(v:number)=>string;
|
|
|
|
_general_num:(v:number)=>string;
|
|
|
|
_general:(v:number, o:?any)=>string;
|
|
|
|
_eval:any;
|
|
|
|
_split:any;
|
|
|
|
version:string;
|
|
|
|
};
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// Note: The following override is needed because ReadShift includes more cases
|
|
|
|
// ----------------------------------------------------------------------------
|
2017-09-30 06:18:11 +00:00
|
|
|
type ReadShiftFunc = any;
|
|
|
|
type WriteShiftFunc = any;
|
2017-07-28 23:27:16 +00:00
|
|
|
|
|
|
|
type CFBModule = {
|
|
|
|
version:string;
|
2017-08-09 22:38:23 +00:00
|
|
|
find:(cfb:CFBContainer, path:string)=>?CFBEntry;
|
2017-07-28 23:27:16 +00:00
|
|
|
read:(blob:RawBytes|string, opts:CFBReadOpts)=>CFBContainer;
|
2017-09-30 06:18:11 +00:00
|
|
|
write:(cfb:CFBContainer, opts:CFBWriteOpts)=>RawBytes|string;
|
|
|
|
writeFile:(cfb:CFBContainer, filename:string, opts:CFBWriteOpts)=>void;
|
2017-07-28 23:27:16 +00:00
|
|
|
parse:(file:RawBytes, opts:CFBReadOpts)=>CFBContainer;
|
|
|
|
utils:CFBUtils;
|
|
|
|
};
|
|
|
|
|
|
|
|
type CFBUtils = any;
|
|
|
|
|
|
|
|
type CheckFieldFunc = {(hexstr:string, fld:string):void;};
|
|
|
|
|
|
|
|
type RawBytes = Array<number> | Buffer | Uint8Array;
|
|
|
|
|
|
|
|
class CFBlobArray extends Array<number> {
|
|
|
|
l:number;
|
2017-09-30 06:18:11 +00:00
|
|
|
write_shift:WriteShiftFunc;
|
2017-07-28 23:27:16 +00:00
|
|
|
read_shift:ReadShiftFunc;
|
|
|
|
chk:CheckFieldFunc;
|
|
|
|
};
|
|
|
|
interface CFBlobBuffer extends Buffer {
|
|
|
|
l:number;
|
2017-09-30 06:18:11 +00:00
|
|
|
slice:(start?:number, end:?number)=>Buffer;
|
|
|
|
write_shift:WriteShiftFunc;
|
2017-07-28 23:27:16 +00:00
|
|
|
read_shift:ReadShiftFunc;
|
|
|
|
chk:CheckFieldFunc;
|
|
|
|
};
|
|
|
|
interface CFBlobUint8 extends Uint8Array {
|
|
|
|
l:number;
|
2017-09-30 06:18:11 +00:00
|
|
|
slice:(start?:number, end:?number)=>Uint8Array;
|
|
|
|
write_shift:WriteShiftFunc;
|
2017-07-28 23:27:16 +00:00
|
|
|
read_shift:ReadShiftFunc;
|
|
|
|
chk:CheckFieldFunc;
|
|
|
|
};
|
|
|
|
|
|
|
|
interface CFBlobber {
|
|
|
|
[n:number]:number;
|
|
|
|
l:number;
|
|
|
|
length:number;
|
2017-09-30 06:18:11 +00:00
|
|
|
slice:(start:?number, end:?number)=>RawBytes;
|
|
|
|
write_shift:WriteShiftFunc;
|
2017-07-28 23:27:16 +00:00
|
|
|
read_shift:ReadShiftFunc;
|
|
|
|
chk:CheckFieldFunc;
|
|
|
|
};
|
|
|
|
|
|
|
|
type CFBlob = CFBlobArray | CFBlobBuffer | CFBlobUint8;
|
|
|
|
|
2017-09-30 06:18:11 +00:00
|
|
|
type CFBWriteOpts = any;
|
|
|
|
|
2017-07-28 23:27:16 +00:00
|
|
|
interface CFBReadOpts {
|
|
|
|
type?:string;
|
|
|
|
};
|
|
|
|
|
|
|
|
type CFBFileIndex = Array<CFBEntry>;
|
|
|
|
|
|
|
|
type CFBFindPath = (n:string)=>?CFBEntry;
|
|
|
|
|
|
|
|
type CFBContainer = {
|
2017-09-30 06:18:11 +00:00
|
|
|
raw?:{
|
2017-07-28 23:27:16 +00:00
|
|
|
header:any;
|
|
|
|
sectors:Array<any>;
|
|
|
|
};
|
|
|
|
FileIndex:CFBFileIndex;
|
|
|
|
FullPaths:Array<string>;
|
|
|
|
}
|
|
|
|
|
|
|
|
type CFBEntry = {
|
|
|
|
name: string;
|
|
|
|
type: number;
|
|
|
|
ct?: Date;
|
|
|
|
mt?: Date;
|
|
|
|
color: number;
|
|
|
|
clsid: string;
|
|
|
|
state: number;
|
|
|
|
start: number;
|
|
|
|
size: number;
|
|
|
|
storage?: "fat" | "minifat";
|
|
|
|
L: number;
|
|
|
|
R: number;
|
|
|
|
C: number;
|
|
|
|
content?: CFBlob;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-05-13 18:21:22 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// Note: The following override is needed because Flow is missing Date#getYear
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
type Date$LocaleOptions = {
|
|
|
|
localeMatcher?: string,
|
|
|
|
timeZone?: string,
|
|
|
|
hour12?: boolean,
|
|
|
|
formatMatcher?: string,
|
|
|
|
weekday?: string,
|
|
|
|
era?: string,
|
|
|
|
year?: string,
|
|
|
|
month?: string,
|
|
|
|
day?: string,
|
|
|
|
hour?: string,
|
|
|
|
minute?: string,
|
|
|
|
second?: string,
|
|
|
|
timeZoneName?: string,
|
|
|
|
};
|
|
|
|
|
|
|
|
declare class Date {
|
|
|
|
constructor(): void;
|
|
|
|
constructor(timestamp: number): void;
|
|
|
|
constructor(dateString: string): void;
|
|
|
|
constructor(year: number, month: number, day?: number, hour?: number, minute?: number, second?: number, millisecond?: number): void;
|
|
|
|
getDate(): number;
|
|
|
|
getDay(): number;
|
|
|
|
getYear(): number;
|
|
|
|
getFullYear(): number;
|
|
|
|
getHours(): number;
|
|
|
|
getMilliseconds(): number;
|
|
|
|
getMinutes(): number;
|
|
|
|
getMonth(): number;
|
|
|
|
getSeconds(): number;
|
|
|
|
getTime(): number;
|
|
|
|
getTimezoneOffset(): number;
|
|
|
|
getUTCDate(): number;
|
|
|
|
getUTCDay(): number;
|
|
|
|
getUTCFullYear(): number;
|
|
|
|
getUTCHours(): number;
|
|
|
|
getUTCMilliseconds(): number;
|
|
|
|
getUTCMinutes(): number;
|
|
|
|
getUTCMonth(): number;
|
|
|
|
getUTCSeconds(): number;
|
|
|
|
setDate(date: number): number;
|
|
|
|
setFullYear(year: number, month?: number, date?: number): number;
|
|
|
|
setHours(hours: number, min?: number, sec?: number, ms?: number): number;
|
|
|
|
setMilliseconds(ms: number): number;
|
|
|
|
setMinutes(min: number, sec?: number, ms?: number): number;
|
|
|
|
setMonth(month: number, date?: number): number;
|
|
|
|
setSeconds(sec: number, ms?: number): number;
|
|
|
|
setTime(time: number): number;
|
|
|
|
setUTCDate(date: number): number;
|
|
|
|
setUTCFullYear(year: number, month?: number, date?: number): number;
|
|
|
|
setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number;
|
|
|
|
setUTCMilliseconds(ms: number): number;
|
|
|
|
setUTCMinutes(min: number, sec?: number, ms?: number): number;
|
|
|
|
setUTCMonth(month: number, date?: number): number;
|
|
|
|
setUTCSeconds(sec: number, ms?: number): number;
|
|
|
|
toDateString(): string;
|
|
|
|
toISOString(): string;
|
|
|
|
toJSON(key?: any): string;
|
|
|
|
toLocaleDateString(locales?: string, options?: Date$LocaleOptions): string;
|
|
|
|
toLocaleString(locales?: string, options?: Date$LocaleOptions): string;
|
|
|
|
toLocaleTimeString(locales?: string, options?: Date$LocaleOptions): string;
|
|
|
|
toTimeString(): string;
|
|
|
|
toUTCString(): string;
|
|
|
|
valueOf(): number;
|
|
|
|
static ():string;
|
|
|
|
static now(): number;
|
|
|
|
static parse(s: string): number;
|
|
|
|
static UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number;
|
|
|
|
// multiple indexers not yet supported
|
|
|
|
[key: $SymbolToPrimitive]: (hint: 'string' | 'default' | 'number') => string | number;
|
|
|
|
}
|
|
|
|
|
2017-02-03 20:50:45 +00:00
|
|
|
*/
|