From 0d9b247b6ed97a94bb14dbb43535e04b14a8591d Mon Sep 17 00:00:00 2001 From: ChanRay Date: Fri, 17 Aug 2018 19:49:17 +0800 Subject: [PATCH] [fibjs] add types of fibjs 0.26.0 --- types/fibjs/declare/DgramSocket.d.ts | 2 +- types/fibjs/declare/Digest.d.ts | 16 +---- types/fibjs/declare/EventEmitter.d.ts | 34 ++++----- types/fibjs/declare/EventInfo.d.ts | 2 +- types/fibjs/declare/Handler.d.ts | 2 +- types/fibjs/declare/HandlerEx.d.ts | 2 +- types/fibjs/declare/HeapSnapshot.d.ts | 2 +- types/fibjs/declare/HttpClient.d.ts | 36 ++++++++-- types/fibjs/declare/HttpCollection.d.ts | 4 +- types/fibjs/declare/HttpCookie.d.ts | 4 +- types/fibjs/declare/HttpMessage.d.ts | 4 +- types/fibjs/declare/HttpResponse.d.ts | 4 +- types/fibjs/declare/HttpServer.d.ts | 2 +- types/fibjs/declare/LevelDB.d.ts | 2 +- types/fibjs/declare/LruCache.d.ts | 2 +- types/fibjs/declare/MongoCollection.d.ts | 28 ++++---- types/fibjs/declare/MongoCursor.d.ts | 6 +- types/fibjs/declare/MongoDB.d.ts | 4 +- types/fibjs/declare/PKey.d.ts | 6 +- types/fibjs/declare/Redis.d.ts | 12 ++-- types/fibjs/declare/RedisHash.d.ts | 2 +- types/fibjs/declare/RedisSortedSet.d.ts | 2 +- types/fibjs/declare/Routing.d.ts | 20 +++--- types/fibjs/declare/SandBox.d.ts | 90 ++++++++++++++++++++++-- types/fibjs/declare/Service.d.ts | 2 +- types/fibjs/declare/UrlObject.d.ts | 4 +- types/fibjs/declare/Worker.d.ts | 2 +- types/fibjs/declare/X509Req.d.ts | 2 +- types/fibjs/declare/bson.d.ts | 4 +- types/fibjs/declare/console.d.ts | 2 +- types/fibjs/declare/dgram.d.ts | 4 +- types/fibjs/declare/fs.d.ts | 21 ++++++ types/fibjs/declare/global.d.ts | 2 +- types/fibjs/declare/gui.d.ts | 2 +- types/fibjs/declare/http.d.ts | 40 ++++++++--- types/fibjs/declare/index.d.ts | 68 +++++++++--------- types/fibjs/declare/net.d.ts | 2 +- types/fibjs/declare/os.d.ts | 6 +- types/fibjs/declare/path.d.ts | 13 ++++ types/fibjs/declare/path_posix.d.ts | 13 ++++ types/fibjs/declare/path_win32.d.ts | 13 ++++ types/fibjs/declare/process.d.ts | 14 ++-- types/fibjs/declare/profiler.d.ts | 2 +- types/fibjs/declare/querystring.d.ts | 4 +- types/fibjs/declare/ssl.d.ts | 2 +- types/fibjs/declare/timers.d.ts | 15 +++- types/fibjs/declare/url.d.ts | 2 +- types/fibjs/declare/util.d.ts | 40 +++++++---- types/fibjs/declare/zlib.d.ts | 36 ++++++---- types/fibjs/index.d.ts | 2 +- 50 files changed, 410 insertions(+), 195 deletions(-) diff --git a/types/fibjs/declare/DgramSocket.d.ts b/types/fibjs/declare/DgramSocket.d.ts index 6618ae9c1c..22486d5832 100644 --- a/types/fibjs/declare/DgramSocket.d.ts +++ b/types/fibjs/declare/DgramSocket.d.ts @@ -45,7 +45,7 @@ declare class Class_DgramSocket extends Class_EventEmitter { * * @async */ - bind(opts: Object): void; + bind(opts: object): void; /** * diff --git a/types/fibjs/declare/Digest.d.ts b/types/fibjs/declare/Digest.d.ts index d440f31486..71c62f0386 100644 --- a/types/fibjs/declare/Digest.d.ts +++ b/types/fibjs/declare/Digest.d.ts @@ -52,23 +52,13 @@ declare class Class_Digest extends Class__object { /** * * @brief 计算并返回摘要 - * @param data 二进制数据块,此数据块将在计算前更新进摘要 - * @return 返回摘要的二进制数据 + * @param codec 指定编码格式,允许值为:"buffer", "hex", "base64", "utf8", 或者系统支持的字符集 + * @return 返回指定编码的摘要表示 * * * */ - digest(data: Class_Buffer): Class_Buffer; - - /** - * - * @brief 计算并返回摘要 - * @return 返回摘要的二进制数据 - * - * - * - */ - digest(): Class_Buffer; + digest(codec?: string/** = "buffer"*/): any; } /** endof class */ diff --git a/types/fibjs/declare/EventEmitter.d.ts b/types/fibjs/declare/EventEmitter.d.ts index 608b6f2edb..0008b2faa3 100644 --- a/types/fibjs/declare/EventEmitter.d.ts +++ b/types/fibjs/declare/EventEmitter.d.ts @@ -56,7 +56,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - on(ev: string, func: Function): Object; + on(ev: string, func: Function): object; /** * @@ -67,7 +67,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - on(map: Object): Object; + on(map: object): object; /** * @@ -79,7 +79,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - addListener(ev: string, func: Function): Object; + addListener(ev: string, func: Function): object; /** * @@ -90,7 +90,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - addListener(map: Object): Object; + addListener(map: object): object; /** * @@ -102,7 +102,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - prependListener(ev: string, func: Function): Object; + prependListener(ev: string, func: Function): object; /** * @@ -113,7 +113,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - prependListener(map: Object): Object; + prependListener(map: object): object; /** * @@ -125,7 +125,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - once(ev: string, func: Function): Object; + once(ev: string, func: Function): object; /** * @@ -136,7 +136,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - once(map: Object): Object; + once(map: object): object; /** * @@ -148,7 +148,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - prependOnceListener(ev: string, func: Function): Object; + prependOnceListener(ev: string, func: Function): object; /** * @@ -159,7 +159,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - prependOnceListener(map: Object): Object; + prependOnceListener(map: object): object; /** * @@ -171,7 +171,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - off(ev: string, func: Function): Object; + off(ev: string, func: Function): object; /** * @@ -182,7 +182,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - off(ev: string): Object; + off(ev: string): object; /** * @@ -193,7 +193,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - off(map: Object): Object; + off(map: object): object; /** * @@ -205,7 +205,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - removeListener(ev: string, func: Function): Object; + removeListener(ev: string, func: Function): object; /** * @@ -216,7 +216,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - removeListener(ev: string): Object; + removeListener(ev: string): object; /** * @@ -227,7 +227,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - removeListener(map: Object): Object; + removeListener(map: object): object; /** * @@ -238,7 +238,7 @@ declare class Class_EventEmitter extends Class__object { * * */ - removeAllListeners(evs?: any[]/** = v8::Array::New(isolate)*/): Object; + removeAllListeners(evs?: any[]/** = v8::Array::New(isolate)*/): object; /** * diff --git a/types/fibjs/declare/EventInfo.d.ts b/types/fibjs/declare/EventInfo.d.ts index a7c43a70a7..f60190d315 100644 --- a/types/fibjs/declare/EventInfo.d.ts +++ b/types/fibjs/declare/EventInfo.d.ts @@ -70,7 +70,7 @@ declare class Class_EventInfo extends Class__object { * @type Object */ - target: Object + target: object diff --git a/types/fibjs/declare/Handler.d.ts b/types/fibjs/declare/Handler.d.ts index ae7af823a2..df2ef6463f 100644 --- a/types/fibjs/declare/Handler.d.ts +++ b/types/fibjs/declare/Handler.d.ts @@ -44,7 +44,7 @@ declare class Class_Handler extends Class__object { * * */ - constructor(map: Object); + constructor(map: object); /** * diff --git a/types/fibjs/declare/HandlerEx.d.ts b/types/fibjs/declare/HandlerEx.d.ts index 504ab42c1a..22bca1ce76 100644 --- a/types/fibjs/declare/HandlerEx.d.ts +++ b/types/fibjs/declare/HandlerEx.d.ts @@ -81,7 +81,7 @@ declare class Class_HandlerEx extends Class_Handler { * * */ - onerror(hdlrs: Object): void; + onerror(hdlrs: object): void; } /** endof class */ diff --git a/types/fibjs/declare/HeapSnapshot.d.ts b/types/fibjs/declare/HeapSnapshot.d.ts index c65282165c..0a10a6b68f 100644 --- a/types/fibjs/declare/HeapSnapshot.d.ts +++ b/types/fibjs/declare/HeapSnapshot.d.ts @@ -71,7 +71,7 @@ declare class Class_HeapSnapshot extends Class__object { * * */ - diff(before: Class_HeapSnapshot): Object; + diff(before: Class_HeapSnapshot): object; /** * diff --git a/types/fibjs/declare/HttpClient.d.ts b/types/fibjs/declare/HttpClient.d.ts index 580e90c70c..7c9f6c073f 100644 --- a/types/fibjs/declare/HttpClient.d.ts +++ b/types/fibjs/declare/HttpClient.d.ts @@ -96,6 +96,30 @@ declare class Class_HttpClient extends Class__object { userAgent: string + /** + * class prop + * + * + * @brief 查询和设置 keep-alive 最大缓存连接数,缺省 128 + * + * + * @type Integer + */ + + poolSize: number + + /** + * class prop + * + * + * @brief 查询和设置 keep-alive 缓存连接超时时间,缺省 10000 ms + * + * + * @type Integer + */ + + poolTimeout: number + /** @@ -139,7 +163,7 @@ declare class Class_HttpClient extends Class__object { * * @async */ - request(method: string, url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse; + request(method: string, url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse; /** * @@ -161,7 +185,7 @@ declare class Class_HttpClient extends Class__object { * * @async */ - get(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse; + get(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse; /** * @@ -183,7 +207,7 @@ declare class Class_HttpClient extends Class__object { * * @async */ - post(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse; + post(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse; /** * @@ -205,7 +229,7 @@ declare class Class_HttpClient extends Class__object { * * @async */ - del(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse; + del(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse; /** * @@ -227,7 +251,7 @@ declare class Class_HttpClient extends Class__object { * * @async */ - put(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse; + put(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse; /** * @@ -249,7 +273,7 @@ declare class Class_HttpClient extends Class__object { * * @async */ - patch(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse; + patch(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse; } /** endof class */ diff --git a/types/fibjs/declare/HttpCollection.d.ts b/types/fibjs/declare/HttpCollection.d.ts index 5aa34c40bb..1936011e1d 100644 --- a/types/fibjs/declare/HttpCollection.d.ts +++ b/types/fibjs/declare/HttpCollection.d.ts @@ -75,7 +75,7 @@ declare class Class_HttpCollection extends Class__object { * * */ - add(map: Object): void; + add(map: object): void; /** * @@ -96,7 +96,7 @@ declare class Class_HttpCollection extends Class__object { * * */ - set(map: Object): void; + set(map: object): void; /** * diff --git a/types/fibjs/declare/HttpCookie.d.ts b/types/fibjs/declare/HttpCookie.d.ts index 5be7604293..b7c3980150 100644 --- a/types/fibjs/declare/HttpCookie.d.ts +++ b/types/fibjs/declare/HttpCookie.d.ts @@ -118,7 +118,7 @@ declare class Class_HttpCookie extends Class__object { * * */ - constructor(opts?: Object/** = v8::Object::New(isolate)*/); + constructor(opts?: object/** = v8::Object::New(isolate)*/); /** * @@ -130,7 +130,7 @@ declare class Class_HttpCookie extends Class__object { * * */ - constructor(name: string, value: string, opts?: Object/** = v8::Object::New(isolate)*/); + constructor(name: string, value: string, opts?: object/** = v8::Object::New(isolate)*/); /** * diff --git a/types/fibjs/declare/HttpMessage.d.ts b/types/fibjs/declare/HttpMessage.d.ts index 89ef9c96c6..1d64ba5c5f 100644 --- a/types/fibjs/declare/HttpMessage.d.ts +++ b/types/fibjs/declare/HttpMessage.d.ts @@ -151,7 +151,7 @@ declare class Class_HttpMessage extends Class_Message { * * */ - addHeader(map: Object): void; + addHeader(map: object): void; /** * @@ -172,7 +172,7 @@ declare class Class_HttpMessage extends Class_Message { * * */ - setHeader(map: Object): void; + setHeader(map: object): void; /** * diff --git a/types/fibjs/declare/HttpResponse.d.ts b/types/fibjs/declare/HttpResponse.d.ts index 4ecf06866d..7f69b8509a 100644 --- a/types/fibjs/declare/HttpResponse.d.ts +++ b/types/fibjs/declare/HttpResponse.d.ts @@ -80,7 +80,7 @@ declare class Class_HttpResponse extends Class_HttpMessage { * * */ - writeHead(statusCode: number, statusMessage: string, headers?: Object/** = v8::Object::New(isolate)*/): void; + writeHead(statusCode: number, statusMessage: string, headers?: object/** = v8::Object::New(isolate)*/): void; /** * @@ -91,7 +91,7 @@ declare class Class_HttpResponse extends Class_HttpMessage { * * */ - writeHead(statusCode: number, headers?: Object/** = v8::Object::New(isolate)*/): void; + writeHead(statusCode: number, headers?: object/** = v8::Object::New(isolate)*/): void; /** * diff --git a/types/fibjs/declare/HttpServer.d.ts b/types/fibjs/declare/HttpServer.d.ts index 157c951ea8..75ba24c290 100644 --- a/types/fibjs/declare/HttpServer.d.ts +++ b/types/fibjs/declare/HttpServer.d.ts @@ -143,7 +143,7 @@ declare class Class_HttpServer extends Class_TcpServer { * * */ - onerror(hdlrs: Object): void; + onerror(hdlrs: object): void; /** * diff --git a/types/fibjs/declare/LevelDB.d.ts b/types/fibjs/declare/LevelDB.d.ts index feb6ce2b6b..c9721bf337 100644 --- a/types/fibjs/declare/LevelDB.d.ts +++ b/types/fibjs/declare/LevelDB.d.ts @@ -78,7 +78,7 @@ declare class Class_LevelDB extends Class__object { * * */ - mset(map: Object): void; + mset(map: object): void; /** * diff --git a/types/fibjs/declare/LruCache.d.ts b/types/fibjs/declare/LruCache.d.ts index 884bb65d26..f68ac413cd 100644 --- a/types/fibjs/declare/LruCache.d.ts +++ b/types/fibjs/declare/LruCache.d.ts @@ -134,7 +134,7 @@ declare class Class_LruCache extends Class_EventEmitter { * * */ - set(map: Object): void; + set(map: object): void; /** * diff --git a/types/fibjs/declare/MongoCollection.d.ts b/types/fibjs/declare/MongoCollection.d.ts index 4b1f07478b..e721feabcd 100644 --- a/types/fibjs/declare/MongoCollection.d.ts +++ b/types/fibjs/declare/MongoCollection.d.ts @@ -36,7 +36,7 @@ declare class Class_MongoCollection extends Class__object { * * */ - find(query?: Object/** = v8::Object::New(isolate)*/, projection?: Object/** = v8::Object::New(isolate)*/): Class_MongoCursor; + find(query?: object/** = v8::Object::New(isolate)*/, projection?: object/** = v8::Object::New(isolate)*/): Class_MongoCursor; /** * @@ -48,7 +48,7 @@ declare class Class_MongoCollection extends Class__object { * * */ - findOne(query?: Object/** = v8::Object::New(isolate)*/, projection?: Object/** = v8::Object::New(isolate)*/): Object; + findOne(query?: object/** = v8::Object::New(isolate)*/, projection?: object/** = v8::Object::New(isolate)*/): object; /** * @@ -59,7 +59,7 @@ declare class Class_MongoCollection extends Class__object { * * */ - findAndModify(query: Object): Object; + findAndModify(query: object): object; /** * @@ -79,7 +79,7 @@ declare class Class_MongoCollection extends Class__object { * * */ - insert(document: Object): void; + insert(document: object): void; /** * @@ -89,7 +89,7 @@ declare class Class_MongoCollection extends Class__object { * * */ - save(document: Object): void; + save(document: object): void; /** * @@ -102,7 +102,7 @@ declare class Class_MongoCollection extends Class__object { * * */ - update(query: Object, document: Object, upsert?: boolean/** = false*/, multi?: boolean/** = false*/): void; + update(query: object, document: object, upsert?: boolean/** = false*/, multi?: boolean/** = false*/): void; /** * @@ -114,7 +114,7 @@ declare class Class_MongoCollection extends Class__object { * * */ - update(query: Object, document: Object, options: Object): void; + update(query: object, document: object, options: object): void; /** * @@ -124,7 +124,7 @@ declare class Class_MongoCollection extends Class__object { * * */ - remove(query: Object): void; + remove(query: object): void; /** * @@ -135,7 +135,7 @@ declare class Class_MongoCollection extends Class__object { * * */ - runCommand(cmd: Object): Object; + runCommand(cmd: object): object; /** * @@ -147,7 +147,7 @@ declare class Class_MongoCollection extends Class__object { * * */ - runCommand(cmd: string, arg?: Object/** = v8::Object::New(isolate)*/): Object; + runCommand(cmd: string, arg?: object/** = v8::Object::New(isolate)*/): object; /** * @@ -166,7 +166,7 @@ declare class Class_MongoCollection extends Class__object { * * */ - ensureIndex(keys: Object, options?: Object/** = v8::Object::New(isolate)*/): void; + ensureIndex(keys: object, options?: object/** = v8::Object::New(isolate)*/): void; /** * @@ -176,7 +176,7 @@ declare class Class_MongoCollection extends Class__object { * * */ - reIndex(): Object; + reIndex(): object; /** * @@ -187,7 +187,7 @@ declare class Class_MongoCollection extends Class__object { * * */ - dropIndex(name: string): Object; + dropIndex(name: string): object; /** * @@ -197,7 +197,7 @@ declare class Class_MongoCollection extends Class__object { * * */ - dropIndexes(): Object; + dropIndexes(): object; /** * diff --git a/types/fibjs/declare/MongoCursor.d.ts b/types/fibjs/declare/MongoCursor.d.ts index d9e26b833f..2dc99b5e96 100644 --- a/types/fibjs/declare/MongoCursor.d.ts +++ b/types/fibjs/declare/MongoCursor.d.ts @@ -57,7 +57,7 @@ declare class Class_MongoCursor extends Class__object { * * */ - sort(opts: Object): Class_MongoCursor; + sort(opts: object): Class_MongoCursor; /** * @@ -77,7 +77,7 @@ declare class Class_MongoCursor extends Class__object { * * */ - next(): Object; + next(): object; /** * @@ -140,7 +140,7 @@ declare class Class_MongoCursor extends Class__object { * * */ - hint(opts: Object): Class_MongoCursor; + hint(opts: object): Class_MongoCursor; } /** endof class */ diff --git a/types/fibjs/declare/MongoDB.d.ts b/types/fibjs/declare/MongoDB.d.ts index c0bf5432bd..11bcf1456d 100644 --- a/types/fibjs/declare/MongoDB.d.ts +++ b/types/fibjs/declare/MongoDB.d.ts @@ -46,7 +46,7 @@ declare class Class_MongoDB extends Class__object { * * */ - runCommand(cmd: Object): Object; + runCommand(cmd: object): object; /** * @@ -58,7 +58,7 @@ declare class Class_MongoDB extends Class__object { * * */ - runCommand(cmd: string, arg: any): Object; + runCommand(cmd: string, arg: any): object; /** * diff --git a/types/fibjs/declare/PKey.d.ts b/types/fibjs/declare/PKey.d.ts index 0c3f939e3e..297cfb2a13 100644 --- a/types/fibjs/declare/PKey.d.ts +++ b/types/fibjs/declare/PKey.d.ts @@ -144,7 +144,7 @@ declare class Class_PKey extends Class__object { * * */ - constructor(jsonKey: Object); + constructor(jsonKey: object); /** * @@ -258,7 +258,7 @@ declare class Class_PKey extends Class__object { * * */ - importKey(jsonKey: Object): void; + importKey(jsonKey: object): void; /** * @@ -299,7 +299,7 @@ declare class Class_PKey extends Class__object { * * */ - exportJson(): Object; + exportJson(): object; /** * diff --git a/types/fibjs/declare/Redis.d.ts b/types/fibjs/declare/Redis.d.ts index 4c5201d62c..384e0e4d80 100644 --- a/types/fibjs/declare/Redis.d.ts +++ b/types/fibjs/declare/Redis.d.ts @@ -90,7 +90,7 @@ declare class Class_Redis extends Class__object { * * */ - mset(kvs: Object): void; + mset(kvs: object): void; /** * @@ -108,7 +108,7 @@ declare class Class_Redis extends Class__object { * * */ - msetNX(kvs: Object): void; + msetNX(kvs: object): void; /** * @@ -383,7 +383,7 @@ declare class Class_Redis extends Class__object { * * */ - sub(map: Object): void; + sub(map: object): void; /** * @@ -424,7 +424,7 @@ declare class Class_Redis extends Class__object { * * */ - unsub(map: Object): void; + unsub(map: object): void; /** * @@ -445,7 +445,7 @@ declare class Class_Redis extends Class__object { * * */ - psub(map: Object): void; + psub(map: object): void; /** * @@ -486,7 +486,7 @@ declare class Class_Redis extends Class__object { * * */ - unpsub(map: Object): void; + unpsub(map: object): void; /** * diff --git a/types/fibjs/declare/RedisHash.d.ts b/types/fibjs/declare/RedisHash.d.ts index 0c8c9ea362..0c16eef47d 100644 --- a/types/fibjs/declare/RedisHash.d.ts +++ b/types/fibjs/declare/RedisHash.d.ts @@ -53,7 +53,7 @@ declare class Class_RedisHash extends Class__object { * * */ - mset(kvs: Object): void; + mset(kvs: object): void; /** * diff --git a/types/fibjs/declare/RedisSortedSet.d.ts b/types/fibjs/declare/RedisSortedSet.d.ts index ed2bcfaf5c..1769fb0a79 100644 --- a/types/fibjs/declare/RedisSortedSet.d.ts +++ b/types/fibjs/declare/RedisSortedSet.d.ts @@ -34,7 +34,7 @@ declare class Class_RedisSortedSet extends Class__object { * * */ - add(sms: Object): number; + add(sms: object): number; /** * diff --git a/types/fibjs/declare/Routing.d.ts b/types/fibjs/declare/Routing.d.ts index c06bc4e887..aef820feae 100644 --- a/types/fibjs/declare/Routing.d.ts +++ b/types/fibjs/declare/Routing.d.ts @@ -34,7 +34,7 @@ declare class Class_Routing extends Class_Handler { * * */ - constructor(map?: Object/** = v8::Object::New(isolate)*/); + constructor(map?: object/** = v8::Object::New(isolate)*/); /** * @@ -45,7 +45,7 @@ declare class Class_Routing extends Class_Handler { * * */ - constructor(method: string, map: Object); + constructor(method: string, map: object); /** * @@ -67,7 +67,7 @@ declare class Class_Routing extends Class_Handler { * * */ - append(map: Object): Class_Routing; + append(map: object): Class_Routing; /** * @@ -103,7 +103,7 @@ declare class Class_Routing extends Class_Handler { * * */ - all(map: Object): Class_Routing; + all(map: object): Class_Routing; /** * @@ -126,7 +126,7 @@ declare class Class_Routing extends Class_Handler { * * */ - get(map: Object): Class_Routing; + get(map: object): Class_Routing; /** * @@ -149,7 +149,7 @@ declare class Class_Routing extends Class_Handler { * * */ - post(map: Object): Class_Routing; + post(map: object): Class_Routing; /** * @@ -172,7 +172,7 @@ declare class Class_Routing extends Class_Handler { * * */ - del(map: Object): Class_Routing; + del(map: object): Class_Routing; /** * @@ -195,7 +195,7 @@ declare class Class_Routing extends Class_Handler { * * */ - put(map: Object): Class_Routing; + put(map: object): Class_Routing; /** * @@ -218,7 +218,7 @@ declare class Class_Routing extends Class_Handler { * * */ - patch(map: Object): Class_Routing; + patch(map: object): Class_Routing; /** * @@ -241,7 +241,7 @@ declare class Class_Routing extends Class_Handler { * * */ - find(map: Object): Class_Routing; + find(map: object): Class_Routing; /** * diff --git a/types/fibjs/declare/SandBox.d.ts b/types/fibjs/declare/SandBox.d.ts index 31f9dc53ce..fc3152b232 100644 --- a/types/fibjs/declare/SandBox.d.ts +++ b/types/fibjs/declare/SandBox.d.ts @@ -34,7 +34,20 @@ declare class Class_SandBox extends Class__object { * @type Object */ - global: Object + global: object + + /** + * class prop + * + * + * @brief 查询沙箱中现存的所有模块的字典对象 + * + * + * @readonly + * @type Object + */ + + modules: object @@ -46,7 +59,7 @@ declare class Class_SandBox extends Class__object { * * */ - constructor(mods: Object); + constructor(mods: object); /** * @@ -57,7 +70,7 @@ declare class Class_SandBox extends Class__object { * * */ - constructor(mods: Object, require: Function); + constructor(mods: object, require: Function); /** * @@ -68,7 +81,7 @@ declare class Class_SandBox extends Class__object { * * */ - constructor(mods: Object, global: Object); + constructor(mods: object, global: object); /** * @@ -80,7 +93,7 @@ declare class Class_SandBox extends Class__object { * * */ - constructor(mods: Object, require: Function, global: Object); + constructor(mods: object, require: Function, global: object); /** * @@ -101,7 +114,7 @@ declare class Class_SandBox extends Class__object { * * */ - add(mods: Object): void; + add(mods: object): void; /** * @@ -125,6 +138,17 @@ declare class Class_SandBox extends Class__object { */ remove(id: string): void; + /** + * + * @brief 从沙箱中检测基础模块是否存在 + * @param id 指定要检测的模块名称,此路径与当前运行脚本无关,必须为绝对路径或者模块名 + * @return 是否存在 + * + * + * + */ + has(id: string): boolean; + /** * * @brief 复制当前沙箱,新沙箱包含当前沙箱的模块,以及相同的名称和 require 函数 @@ -135,6 +159,22 @@ declare class Class_SandBox extends Class__object { */ clone(): Class_SandBox; + /** + * + * @brief 冻结当前沙箱,冻结后的沙箱,对 global 所做的修改将被忽略 + * + * + */ + freeze(): void; + + /** + * + * @brief 重新加载沙箱内的模块,此操作只会重新初始化模块,复位模块内的变量,不更新模块代码 + * + * + */ + refresh(): void; + /** * * @brief 运行一个脚本 @@ -170,6 +210,44 @@ declare class Class_SandBox extends Class__object { */ require(id: string, base: string): any; + /** + * + * @brief 对指定的 extname 添加 compiler, extname 不可为系统内置扩展名 (包括 {'.js', '.json', '.jsc', '.wasm'}), compiler 需返回有效的 javascript 脚本. + * + * ```JavaScript + * var vm = require('vm'); + * var sbox = new vm.SandBox({ + * }); + * + * // 编译 typescript 脚本为 js 并加载 + * sbox.setModuleCompiler('.ts', tsCompiler); + * var mod_ts = sbox.require('./a.ts'); + * + * // 编译 coffee 脚本为 js 并加载 + * sbox.setModuleCompiler('.coffee', cafeCompiler); + * var mod_coffee = sbox.require('./a.coffee'); + * + * // 编译 jsx 脚本为 js 并加载 + * sbox.setModuleCompiler('.jsx', reactCompiler); + * var mod_react = sbox.require('./a.jsx'); + * + * // 编译 yml 脚本为自定义的内容(如 API 集合) 并加载 + * sbox.setModuleCompiler('.yml', yaml2Rest) + * sbox.setModuleCompiler('.yaml', yaml2Rest) + * + * // 编译 markdown 为自定义的内容(如 html 字符串或 XmlDocument 对象) 并加载 + * sbox.setModuleCompiler('.md', mdCompiler) + * sbox.setModuleCompiler('.markdown', mdCompiler) + * ``` + * + * @param extname 指定的 extname, 必须以 '.' 开头, 且为非系统内置扩展名 + * @param compiler 编译回调函数, 所有带 extname 的文件仅会 require 一次. 该回调函数格式为 `compiler(buf, requireInfo)`, buf 为读取到的文件 Buffer, requireInfo 结构为 `{filename: string}`. + * + * + * + */ + setModuleCompiler(extname: string, compiler: Function): void; + } /** endof class */ /** endof `module Or Internal Object` */ diff --git a/types/fibjs/declare/Service.d.ts b/types/fibjs/declare/Service.d.ts index 6ca8feab53..7816e2d8bc 100644 --- a/types/fibjs/declare/Service.d.ts +++ b/types/fibjs/declare/Service.d.ts @@ -84,7 +84,7 @@ declare class Class_Service extends Class_EventEmitter { * * */ - constructor(name: string, worker: Function, event?: Object/** = v8::Object::New(isolate)*/); + constructor(name: string, worker: Function, event?: object/** = v8::Object::New(isolate)*/); /** * diff --git a/types/fibjs/declare/UrlObject.d.ts b/types/fibjs/declare/UrlObject.d.ts index 578d3b5079..5baa5b2d7d 100644 --- a/types/fibjs/declare/UrlObject.d.ts +++ b/types/fibjs/declare/UrlObject.d.ts @@ -216,7 +216,7 @@ declare class Class_UrlObject extends Class__object { * * */ - constructor(args: Object); + constructor(args: object); /** * @@ -250,7 +250,7 @@ declare class Class_UrlObject extends Class__object { * * */ - format(args: Object): void; + format(args: object): void; /** * diff --git a/types/fibjs/declare/Worker.d.ts b/types/fibjs/declare/Worker.d.ts index 1bbc793b85..c427f6f41c 100644 --- a/types/fibjs/declare/Worker.d.ts +++ b/types/fibjs/declare/Worker.d.ts @@ -47,7 +47,7 @@ declare class Class_Worker extends Class_EventEmitter { * * */ - constructor(path: string, opts?: Object/** = v8::Object::New(isolate)*/); + constructor(path: string, opts?: object/** = v8::Object::New(isolate)*/); /** * diff --git a/types/fibjs/declare/X509Req.d.ts b/types/fibjs/declare/X509Req.d.ts index 6317e9afa1..502c078402 100644 --- a/types/fibjs/declare/X509Req.d.ts +++ b/types/fibjs/declare/X509Req.d.ts @@ -146,7 +146,7 @@ declare class Class_X509Req extends Class__object { * * @async */ - sign(issuer: string, key: Class_PKey, opts?: Object/** = v8::Object::New(isolate)*/): Class_X509Cert; + sign(issuer: string, key: Class_PKey, opts?: object/** = v8::Object::New(isolate)*/): Class_X509Cert; } /** endof class */ diff --git a/types/fibjs/declare/bson.d.ts b/types/fibjs/declare/bson.d.ts index 920a1ace79..f9eeab19cb 100644 --- a/types/fibjs/declare/bson.d.ts +++ b/types/fibjs/declare/bson.d.ts @@ -217,7 +217,7 @@ declare module "bson" { * * */ - export function encode(data: Object): Class_Buffer; + export function encode(data: object): Class_Buffer; /** * @@ -228,7 +228,7 @@ declare module "bson" { * * */ - export function decode(data: Class_Buffer): Object; + export function decode(data: Class_Buffer): object; } /** end of `module bson` */ export = bson diff --git a/types/fibjs/declare/console.d.ts b/types/fibjs/declare/console.d.ts index 7a657ecd93..43f8603c2e 100644 --- a/types/fibjs/declare/console.d.ts +++ b/types/fibjs/declare/console.d.ts @@ -391,7 +391,7 @@ declare module "console" { * * */ - export function add(cfg: Object): void; + export function add(cfg: object): void; /** * diff --git a/types/fibjs/declare/dgram.d.ts b/types/fibjs/declare/dgram.d.ts index e925eac7af..0d3ccd20a9 100644 --- a/types/fibjs/declare/dgram.d.ts +++ b/types/fibjs/declare/dgram.d.ts @@ -238,7 +238,7 @@ declare module "dgram" { * * */ - export function createSocket(opts: Object): Class_DgramSocket; + export function createSocket(opts: object): Class_DgramSocket; /** * @@ -260,7 +260,7 @@ declare module "dgram" { * * */ - export function createSocket(opts: Object, callback: Function): Class_DgramSocket; + export function createSocket(opts: object, callback: Function): Class_DgramSocket; /** * diff --git a/types/fibjs/declare/fs.d.ts b/types/fibjs/declare/fs.d.ts index ec22c54c3d..b0971e3ee5 100644 --- a/types/fibjs/declare/fs.d.ts +++ b/types/fibjs/declare/fs.d.ts @@ -647,6 +647,27 @@ declare module "fs" { */ export function appendFile(fname: string, data: Class_Buffer): void; + /** + * + * @brief 设置 zip 虚拟文件映射 + * @param fname 指定映射路径 + * @param data 指定映射的 zip 文件数据 + * + * + * + */ + export function setZipFS(fname: string, data: Class_Buffer): void; + + /** + * + * @brief 清除 zip 虚拟文件映射 + * @param fname 指定映射路径,缺省清除全部缓存 + * + * + * + */ + export function clearZipFS(fname?: string/** = ""*/): void; + } /** end of `module fs` */ export = fs } diff --git a/types/fibjs/declare/global.d.ts b/types/fibjs/declare/global.d.ts index 3c58e8289c..19d539d932 100644 --- a/types/fibjs/declare/global.d.ts +++ b/types/fibjs/declare/global.d.ts @@ -379,7 +379,7 @@ declare module "global" { * * */ - export function setTimeout(callback: Function, timeout: number, ...args: any[]): Class_Timer; + export function setTimeout(callback: Function, timeout?: number/** = 1*/, ...args: any[]): Class_Timer; /** * diff --git a/types/fibjs/declare/gui.d.ts b/types/fibjs/declare/gui.d.ts index e2522b8331..60768a9d93 100644 --- a/types/fibjs/declare/gui.d.ts +++ b/types/fibjs/declare/gui.d.ts @@ -293,7 +293,7 @@ declare module "gui" { * * */ - export function open(url: string, opt?: Object/** = v8::Object::New(isolate)*/): Class_WebView; + export function open(url: string, opt?: object/** = v8::Object::New(isolate)*/): Class_WebView; } /** end of `module gui` */ export = gui diff --git a/types/fibjs/declare/http.d.ts b/types/fibjs/declare/http.d.ts index 2712b08370..000f4a6b79 100644 --- a/types/fibjs/declare/http.d.ts +++ b/types/fibjs/declare/http.d.ts @@ -196,7 +196,7 @@ /** module Or Internal Object */ /** - * @brief 超文本传输协议模块,用以支持 http 协议处理 + * @brief 超文本传输协议模块,用以支持 http 协议处理,模块别名:https * @detail */ declare module "http" { @@ -205,6 +205,14 @@ declare module "http" { module http { + /** + * + * @brief 返回标准的 HTTP 响应状态码的集合,以及各自的简短描述。 + * + * + */ + export const STATUS_CODES: any[]; + /** * * @brief 返回http客户端的 HttpCookie 对象列表 @@ -253,6 +261,22 @@ declare module "http" { */ export const userAgent: string; + /** + * + * @brief 查询和设置 keep-alive 最大缓存连接数,缺省 128 + * + * + */ + export const poolSize: number; + + /** + * + * @brief 查询和设置 keep-alive 缓存连接超时时间,缺省 10000 ms + * + * + */ + export const poolTimeout: number; + /** * @@ -333,7 +357,7 @@ declare module "http" { * * */ - export function fileHandler(root: string, mimes?: Object/** = v8::Object::New(isolate)*/, autoIndex?: boolean/** = false*/): Class_Handler; + export function fileHandler(root: string, mimes?: object/** = v8::Object::New(isolate)*/, autoIndex?: boolean/** = false*/): Class_Handler; /** * @@ -368,7 +392,7 @@ declare module "http" { * * @async */ - export function request(method: string, url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse; + export function request(method: string, url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse; /** * @@ -390,7 +414,7 @@ declare module "http" { * * @async */ - export function get(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse; + export function get(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse; /** * @@ -412,7 +436,7 @@ declare module "http" { * * @async */ - export function post(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse; + export function post(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse; /** * @@ -434,7 +458,7 @@ declare module "http" { * * @async */ - export function del(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse; + export function del(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse; /** * @@ -456,7 +480,7 @@ declare module "http" { * * @async */ - export function put(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse; + export function put(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse; /** * @@ -478,7 +502,7 @@ declare module "http" { * * @async */ - export function patch(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse; + export function patch(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse; } /** end of `module http` */ export = http diff --git a/types/fibjs/declare/index.d.ts b/types/fibjs/declare/index.d.ts index 53be0766e3..df0e02e683 100644 --- a/types/fibjs/declare/index.d.ts +++ b/types/fibjs/declare/index.d.ts @@ -14,54 +14,54 @@ -/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// /// /// /// /// -/// -/// -/// -/// -/// -/// -/// /// -/// -/// -/// -/// -/// /// -/// /// -/// /// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// /// +/// +/// +/// +/// +/// +/// /// -/// -/// -/// +/// +/// /// /// /// -/// /// -/// -/// -/// +/// import _Global from 'global'; import _Process from 'process'; diff --git a/types/fibjs/declare/net.d.ts b/types/fibjs/declare/net.d.ts index 831b958124..8c2bf58055 100644 --- a/types/fibjs/declare/net.d.ts +++ b/types/fibjs/declare/net.d.ts @@ -284,7 +284,7 @@ declare module "net" { * * */ - export function info(): Object; + export function info(): object; /** * diff --git a/types/fibjs/declare/os.d.ts b/types/fibjs/declare/os.d.ts index d98d2b58d5..977fc4c6ce 100644 --- a/types/fibjs/declare/os.d.ts +++ b/types/fibjs/declare/os.d.ts @@ -380,7 +380,7 @@ declare module "os" { * * */ - export function userInfo(options?: Object/** = v8::Object::New(isolate)*/): Object; + export function userInfo(options?: object/** = v8::Object::New(isolate)*/): object; /** * @@ -390,7 +390,7 @@ declare module "os" { * * */ - export function networkInterfaces(): Object; + export function networkInterfaces(): object; /** * @@ -470,7 +470,7 @@ declare module "os" { * * */ - export function memoryUsage(): Object; + export function memoryUsage(): object; } /** end of `module os` */ export = os diff --git a/types/fibjs/declare/path.d.ts b/types/fibjs/declare/path.d.ts index 2764664778..9b6ae9cfec 100644 --- a/types/fibjs/declare/path.d.ts +++ b/types/fibjs/declare/path.d.ts @@ -341,6 +341,19 @@ declare module "path" { */ export function resolve(...ps: any[]): string; + /** + * + * @brief 求 _from 到 to 的相对路径 + * + * @param _from 源路径 + * @param to 目标路径 + * @return 返回得到的相对路径 + * + * + * + */ + export function relative(_from: string, to: string): string; + /** * * @brief 转换成 namespace-prefixed 路径。只在 windows 有效,其他系统直接返回。 diff --git a/types/fibjs/declare/path_posix.d.ts b/types/fibjs/declare/path_posix.d.ts index e28fbfee0a..bfeea21068 100644 --- a/types/fibjs/declare/path_posix.d.ts +++ b/types/fibjs/declare/path_posix.d.ts @@ -341,6 +341,19 @@ declare module "path_posix" { */ export function resolve(...ps: any[]): string; + /** + * + * @brief 求 _from 到 to 的相对路径 + * + * @param _from 源路径 + * @param to 目标路径 + * @return 返回得到的相对路径 + * + * + * + */ + export function relative(_from: string, to: string): string; + /** * * @brief 转换成 namespace-prefixed 路径。只在 windows 有效,其他系统直接返回。 diff --git a/types/fibjs/declare/path_win32.d.ts b/types/fibjs/declare/path_win32.d.ts index 80f236ba50..25ce64db09 100644 --- a/types/fibjs/declare/path_win32.d.ts +++ b/types/fibjs/declare/path_win32.d.ts @@ -341,6 +341,19 @@ declare module "path_win32" { */ export function resolve(...ps: any[]): string; + /** + * + * @brief 求 _from 到 to 的相对路径 + * + * @param _from 源路径 + * @param to 目标路径 + * @return 返回得到的相对路径 + * + * + * + */ + export function relative(_from: string, to: string): string; + /** * * @brief 转换成 namespace-prefixed 路径。只在 windows 有效,其他系统直接返回。 diff --git a/types/fibjs/declare/process.d.ts b/types/fibjs/declare/process.d.ts index 669eff12d2..1e6e1c8739 100644 --- a/types/fibjs/declare/process.d.ts +++ b/types/fibjs/declare/process.d.ts @@ -416,7 +416,7 @@ declare module "process" { * * */ - export function memoryUsage(): Object; + export function memoryUsage(): object; /** * @@ -448,7 +448,7 @@ declare module "process" { * * */ - export function open(command: string, args: any[], opts?: Object/** = v8::Object::New(isolate)*/): Class_SubProcess; + export function open(command: string, args: any[], opts?: object/** = v8::Object::New(isolate)*/): Class_SubProcess; /** * @@ -468,7 +468,7 @@ declare module "process" { * * */ - export function open(command: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_SubProcess; + export function open(command: string, opts?: object/** = v8::Object::New(isolate)*/): Class_SubProcess; /** * @@ -489,7 +489,7 @@ declare module "process" { * * */ - export function start(command: string, args: any[], opts?: Object/** = v8::Object::New(isolate)*/): Class_SubProcess; + export function start(command: string, args: any[], opts?: object/** = v8::Object::New(isolate)*/): Class_SubProcess; /** * @@ -509,7 +509,7 @@ declare module "process" { * * */ - export function start(command: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_SubProcess; + export function start(command: string, opts?: object/** = v8::Object::New(isolate)*/): Class_SubProcess; /** * @@ -530,7 +530,7 @@ declare module "process" { * * */ - export function run(command: string, args: any[], opts?: Object/** = v8::Object::New(isolate)*/): number; + export function run(command: string, args: any[], opts?: object/** = v8::Object::New(isolate)*/): number; /** * @@ -550,7 +550,7 @@ declare module "process" { * * */ - export function run(command: string, opts?: Object/** = v8::Object::New(isolate)*/): number; + export function run(command: string, opts?: object/** = v8::Object::New(isolate)*/): number; } /** end of `module process` */ export = process diff --git a/types/fibjs/declare/profiler.d.ts b/types/fibjs/declare/profiler.d.ts index 36a89b2644..5d3459ddbb 100644 --- a/types/fibjs/declare/profiler.d.ts +++ b/types/fibjs/declare/profiler.d.ts @@ -416,7 +416,7 @@ declare module "profiler" { * * */ - export function diff(test: Function): Object; + export function diff(test: Function): object; /** * diff --git a/types/fibjs/declare/querystring.d.ts b/types/fibjs/declare/querystring.d.ts index 9010d119e5..bd939a0621 100644 --- a/types/fibjs/declare/querystring.d.ts +++ b/types/fibjs/declare/querystring.d.ts @@ -242,7 +242,7 @@ declare module "querystring" { * * */ - export function parse(str: string, sep?: string/** = "&"*/, eq?: string/** = "="*/, opt?: Object/** = v8::Object::New(isolate)*/): Class_HttpCollection; + export function parse(str: string, sep?: string/** = "&"*/, eq?: string/** = "="*/, opt?: object/** = v8::Object::New(isolate)*/): Class_HttpCollection; /** * @@ -256,7 +256,7 @@ declare module "querystring" { * * */ - export function stringify(obj: Object, sep?: string/** = "&"*/, eq?: string/** = "="*/, opt?: Object/** = v8::Object::New(isolate)*/): string; + export function stringify(obj: object, sep?: string/** = "&"*/, eq?: string/** = "="*/, opt?: object/** = v8::Object::New(isolate)*/): string; } /** end of `module querystring` */ export = querystring diff --git a/types/fibjs/declare/ssl.d.ts b/types/fibjs/declare/ssl.d.ts index 2799f59be3..e331eeb691 100644 --- a/types/fibjs/declare/ssl.d.ts +++ b/types/fibjs/declare/ssl.d.ts @@ -196,7 +196,7 @@ /** module Or Internal Object */ /** - * @brief ssl/tls 模块 + * @brief ssl/tls 模块,模块别名:tls * @detail */ declare module "ssl" { diff --git a/types/fibjs/declare/timers.d.ts b/types/fibjs/declare/timers.d.ts index 7469a7ea68..8de6e72812 100644 --- a/types/fibjs/declare/timers.d.ts +++ b/types/fibjs/declare/timers.d.ts @@ -219,7 +219,7 @@ declare module "timers" { * * */ - export function setTimeout(callback: Function, timeout: number, ...args: any[]): Class_Timer; + export function setTimeout(callback: Function, timeout?: number/** = 1*/, ...args: any[]): Class_Timer; /** * @@ -313,6 +313,19 @@ declare module "timers" { */ export function clearImmediate(t: any): void; + /** + * + * @brief 调用给定的函数,并在超时时间到期时中断函数运行 + * @param func 指定要运行的函数 + * @param timeout 指定超时时间 + * @param args 额外的参数,传入到指定的 callback 内,可选。 + * @return 返回 func 的运行结果 + * + * + * + */ + export function call(func: Function, timeout: number, ...args: any[]): any; + } /** end of `module timers` */ export = timers } diff --git a/types/fibjs/declare/url.d.ts b/types/fibjs/declare/url.d.ts index 7728d433a2..545b516cd2 100644 --- a/types/fibjs/declare/url.d.ts +++ b/types/fibjs/declare/url.d.ts @@ -217,7 +217,7 @@ declare module "url" { * * */ - export function format(args: Object): string; + export function format(args: object): string; /** * diff --git a/types/fibjs/declare/util.d.ts b/types/fibjs/declare/util.d.ts index 6998b4aab1..1b38c49399 100644 --- a/types/fibjs/declare/util.d.ts +++ b/types/fibjs/declare/util.d.ts @@ -274,7 +274,7 @@ declare module "util" { * * */ - export function inspect(obj: Object, options?: Object/** = v8::Object::New(isolate)*/): string; + export function inspect(obj: object, options?: object/** = v8::Object::New(isolate)*/): string; /** * @@ -637,6 +637,17 @@ declare module "util" { */ export function clone(v: any): any; + /** + * + * @brief 深度冻结一个对象,被冻结后的对象及其包含的对象都将不允许修改 + * + * @param v 指定要冻结的对象 + * + * + * + */ + export function deepFreeze(v: any): void; + /** * * @brief 将一个或者多个对象的键值扩展到指定对象 @@ -674,7 +685,7 @@ declare module "util" { * * */ - export function pick(v: any, ...objs: any[]): Object; + export function pick(v: any, ...objs: any[]): object; /** * @@ -687,7 +698,7 @@ declare module "util" { * * */ - export function omit(v: any, ...keys: any[]): Object; + export function omit(v: any, ...keys: any[]): object; /** * @@ -937,22 +948,25 @@ declare module "util" { * * ```JavaScript * { - * "fibjs": "0.1.0", - * "svn": 1753, - * "build": "Dec 10 2013 21:44:17", + * "fibjs": "0.25.0", + * "clang": "9.1", + * "date": "Jun 12 2018 07:22:40", * "vender": { - * "ev": "4.11", - * "exif": "0.6.21", - * "gd": "2.1.0-alpha", + * "ev": "4.24", + * "expat": "2.2.5", + * "gd": "2.2.4", * "jpeg": "8.3", - * "log4cpp": "1.0", + * "leveldb": "1.17", * "mongo": "0.7", * "pcre": "8.21", * "png": "1.5.4", - * "sqlite": "3.8.1", + * "mbedtls": "2.6.1", + * "snappy": "1.1.2", + * "sqlite": "3.23.0", * "tiff": "3.9.5", * "uuid": "1.6.2", - * "v8": "3.23.17 (candidate)", + * "v8": "6.7.288.20", + * "v8-snapshot": true, * "zlib": "1.2.7", * "zmq": "3.1" * } @@ -963,7 +977,7 @@ declare module "util" { * * */ - export function buildInfo(): Object; + export function buildInfo(): object; } /** end of `module util` */ export = util diff --git a/types/fibjs/declare/zlib.d.ts b/types/fibjs/declare/zlib.d.ts index 049d70f365..693dcf81bf 100644 --- a/types/fibjs/declare/zlib.d.ts +++ b/types/fibjs/declare/zlib.d.ts @@ -264,11 +264,12 @@ declare module "zlib" { * * @brief 创建一个 gunzip 流对象 * @param to 用于存储处理结果的流 + * @param maxSize 指定解压缩尺寸限制,缺省为 -1,不限制 * @return 返回封装过的流对象 * * */ - export function createGunzip(to: Class_Stream): Class_Stream; + export function createGunzip(to: Class_Stream, maxSize?: number/** = -1*/): Class_Stream; /** * @@ -284,21 +285,23 @@ declare module "zlib" { * * @brief 创建一个 inflate 流对象 * @param to 用于存储处理结果的流 + * @param maxSize 指定解压缩尺寸限制,缺省为 -1,不限制 * @return 返回封装过的流对象 * * */ - export function createInflate(to: Class_Stream): Class_Stream; + export function createInflate(to: Class_Stream, maxSize?: number/** = -1*/): Class_Stream; /** * * @brief 创建一个 inflateRaw 流对象 * @param to 用于存储处理结果的流 + * @param maxSize 指定解压缩尺寸限制,缺省为 -1,不限制 * @return 返回封装过的流对象 * * */ - export function createInflateRaw(to: Class_Stream): Class_Stream; + export function createInflateRaw(to: Class_Stream, maxSize?: number/** = -1*/): Class_Stream; /** * @@ -340,34 +343,37 @@ declare module "zlib" { * * @brief 解压缩 deflate 算法压缩的数据(zlib格式) * @param data 给定压缩后的数据 + * @param maxSize 指定解压缩尺寸限制,缺省为 -1,不限制 * @return 返回解压缩后的二进制数据 * * * @async */ - export function inflate(data: Class_Buffer): Class_Buffer; + export function inflate(data: Class_Buffer, maxSize?: number/** = -1*/): Class_Buffer; /** * * @brief 解压缩 deflate 算法压缩的数据到流对象中(zlib格式) * @param data 给定要解压缩的数据 * @param stm 指定存储解压缩数据的流 + * @param maxSize 指定解压缩尺寸限制,缺省为 -1,不限制 * * * @async */ - export function inflateTo(data: Class_Buffer, stm: Class_Stream): void; + export function inflateTo(data: Class_Buffer, stm: Class_Stream, maxSize?: number/** = -1*/): void; /** * * @brief 解压缩源流中 deflate 算法压缩的数据到流对象中(zlib格式) * @param src 给定要解压缩的数据所在的流 * @param stm 指定存储解压缩数据的流 + * @param maxSize 指定解压缩尺寸限制,缺省为 -1,不限制 * * * @async */ - export function inflateTo(src: Class_Stream, stm: Class_Stream): void; + export function inflateTo(src: Class_Stream, stm: Class_Stream, maxSize?: number/** = -1*/): void; /** * @@ -406,34 +412,37 @@ declare module "zlib" { * * @brief 解压缩 gzip 算法压缩的数据 * @param data 给定压缩后的数据 + * @param maxSize 指定解压缩尺寸限制,缺省为 -1,不限制 * @return 返回解压缩后的二进制数据 * * * @async */ - export function gunzip(data: Class_Buffer): Class_Buffer; + export function gunzip(data: Class_Buffer, maxSize?: number/** = -1*/): Class_Buffer; /** * * @brief 解压缩 gzip 算法压缩的数据到流对象中 * @param data 给定要解压缩的数据 * @param stm 指定存储解压缩数据的流 + * @param maxSize 指定解压缩尺寸限制,缺省为 -1,不限制 * * * @async */ - export function gunzipTo(data: Class_Buffer, stm: Class_Stream): void; + export function gunzipTo(data: Class_Buffer, stm: Class_Stream, maxSize?: number/** = -1*/): void; /** * * @brief 解压缩源流中 gzip 算法压缩的数据到流对象中 * @param src 给定要解压缩的数据所在的流 * @param stm 指定存储解压缩数据的流 + * @param maxSize 指定解压缩尺寸限制,缺省为 -1,不限制 * * * @async */ - export function gunzipTo(src: Class_Stream, stm: Class_Stream): void; + export function gunzipTo(src: Class_Stream, stm: Class_Stream, maxSize?: number/** = -1*/): void; /** * @@ -475,34 +484,37 @@ declare module "zlib" { * * @brief 解压缩 deflate 算法压缩的数据(inflateRaw) * @param data 给定压缩后的数据 + * @param maxSize 指定解压缩尺寸限制,缺省为 -1,不限制 * @return 返回解压缩后的二进制数据 * * * @async */ - export function inflateRaw(data: Class_Buffer): Class_Buffer; + export function inflateRaw(data: Class_Buffer, maxSize?: number/** = -1*/): Class_Buffer; /** * * @brief 解压缩 deflate 算法压缩的数据到流对象中(inflateRaw) * @param data 给定要解压缩的数据 * @param stm 指定存储解压缩数据的流 + * @param maxSize 指定解压缩尺寸限制,缺省为 -1,不限制 * * * @async */ - export function inflateRawTo(data: Class_Buffer, stm: Class_Stream): void; + export function inflateRawTo(data: Class_Buffer, stm: Class_Stream, maxSize?: number/** = -1*/): void; /** * * @brief 解压缩源流中 deflate 算法压缩的数据到流对象中(inflateRaw) * @param src 给定要解压缩的数据所在的流 * @param stm 指定存储解压缩数据的流 + * @param maxSize 指定解压缩尺寸限制,缺省为 -1,不限制 * * * @async */ - export function inflateRawTo(src: Class_Stream, stm: Class_Stream): void; + export function inflateRawTo(src: Class_Stream, stm: Class_Stream, maxSize?: number/** = -1*/): void; } /** end of `module zlib` */ export = zlib diff --git a/types/fibjs/index.d.ts b/types/fibjs/index.d.ts index 0b4ef29975..02201fd904 100644 --- a/types/fibjs/index.d.ts +++ b/types/fibjs/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for fibjs 0.25 +// Type definitions for fibjs 0.26 // Project: https://github.com/fibjs/fibjs // Definitions by: richardo2016 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped