mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 23:07:06 +00:00
@@ -0,0 +1 @@
|
||||
declare/_test_env.d.ts
|
||||
Vendored
+1131
File diff suppressed because it is too large
Load Diff
+144
@@ -0,0 +1,144 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 缓存读取对象
|
||||
* @detail BufferedReader 对象用于对二进制流对象数据进行缓存,并提供文本读取能力,仅支持 utf-8 格式转换。创建方法:,```JavaScript,var reader = new io.BufferedStream(stream);,```
|
||||
*/
|
||||
/// <reference path="Stream.d.ts" />
|
||||
declare class Class_BufferedStream extends Class_Stream {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询创建缓存对象时的流对象
|
||||
*
|
||||
* @readonly
|
||||
* @type Stream
|
||||
*/
|
||||
|
||||
stream: Class_Stream
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置当前对象处理文本时的字符集,缺省为 utf-8
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
charset: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置行结尾标识,缺省时,posix:\"\\n\";windows:\"\\r\\n\"
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
EOL: string
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief BufferedStream 构造函数
|
||||
* @param stm BufferedStream 的二进制基础流对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(stm: Class_Stream);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 读取指定字符的文本
|
||||
* @param size 指定读取的文本字符个数,以 utf8 或者指定的编码字节数为准
|
||||
* @return 返回读取的文本字符串,若无数据可读,或者连接中断,则返回 null
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
readText(size: number): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 读取一行文本,行结尾标识基于 EOL 属性的设置,缺省时,posix:\"\\n\";windows:\"\\r\\n\"
|
||||
* @param maxlen 指定此次读取的最大字符串,以 utf8 编码字节数为准,缺省不限制字符数
|
||||
* @return 返回读取的文本字符串,若无数据可读,或者连接中断,则返回 null
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
readLine(maxlen?: number/** = -1*/): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 以数组方式读取一组文本行,行结尾标识基于 EOL 属性的设置,缺省时,posix:\"\\n\";windows:\"\\r\\n\"
|
||||
* @param maxlines 指定此次读取的最大行数,缺省读取全部文本行
|
||||
* @return 返回读取的文本行数组,若无数据可读,或者连接中断,空数组
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
readLines(maxlines?: number/** = -1*/): any[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 读取一个文本字符串,以指定的字节为结尾
|
||||
* @param mk 指定结尾的字符串
|
||||
* @param maxlen 指定此次读取的最大字符串,以 utf8 编码字节数为准,缺省不限制字符数
|
||||
* @return 返回读取的文本字符串,若无数据可读,或者连接中断,则返回 null
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
readUntil(mk: string, maxlen?: number/** = -1*/): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 写入一个字符串
|
||||
* @param txt 指定写入的字符串
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
writeText(txt: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 写入一个字符串,并写入换行符
|
||||
* @param txt 指定写入的字符串
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
writeLine(txt: string): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+63
@@ -0,0 +1,63 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 消息处理器链处理对象
|
||||
* @detail 消息处理器链处理对象用于链接一系列消息处理器,按照指定的顺序链式处理。创建方法:,```JavaScript,var chain = new mq.Chain([, func1, func2,]);,```
|
||||
*/
|
||||
/// <reference path="Handler.d.ts" />
|
||||
declare class Class_Chain extends Class_Handler {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 构造一个消息处理器链处理对象
|
||||
* @param hdlrs 处理器数组
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(hdlrs: any[]);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 添加处理器数组
|
||||
* @param hdlrs 处理器数组
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
append(hdlrs: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 添加处理器
|
||||
* @param hdlr 内置消息处理器,处理函数,链式处理数组,路由对象,详见 mq.Handler
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
append(hdlr: Class_Handler): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+149
@@ -0,0 +1,149 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 对称加密算法对象
|
||||
* @detail Cipher 对象属于 crypto 模块,创建:,```JavaScript,var c = new crypto.Cipher(crypto.AES, crypto.ECB, ...);,```
|
||||
*/
|
||||
|
||||
declare class Class_Cipher extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回当前算法名称
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
name: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回当前算法密码长度,以位为单位
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
keySize: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回当前算法初始向量长度,以字节为单位
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
ivSize: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回当前算法数据块长度,以字节为单位
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
blockSize: number
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Cipher 构造函数,仅用于 ARC4 初始化
|
||||
* @param provider 指定加密算法
|
||||
* @param key 指定加密解密密码
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(provider: number, key: Class_Buffer);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Cipher 构造函数
|
||||
* @param provider 指定加密算法
|
||||
* @param mode 指定分组密码工作模式
|
||||
* @param key 指定加密解密密码
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(provider: number, mode: number, key: Class_Buffer);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Cipher 构造函数
|
||||
* @param provider 指定加密算法
|
||||
* @param mode 指定分组密码工作模式
|
||||
* @param key 指定加密解密密码
|
||||
* @param iv 指定初始向量
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(provider: number, mode: number, key: Class_Buffer, iv: Class_Buffer);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 使用填充模式
|
||||
* @param mode 指定填充模式,缺省为 PADDING_PKCS7
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
paddingMode(mode: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 使用当前算法密码加密数据
|
||||
* @param data 指定要加密的数据
|
||||
* @return 返回加密后的数据
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
encrypt(data: Class_Buffer): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 使用当前算法密码解密数据
|
||||
* @param data 指定要解密的数据
|
||||
* @return 返回解密后的数据
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
decrypt(data: Class_Buffer): Class_Buffer;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+75
@@ -0,0 +1,75 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 条件变量对象
|
||||
* @detail 条件变量是利用纤程间共享的全局变量来进行同步的一种机制,主要包括两个动作:,1)一个线程等待某个条件成立,而将自己挂起;,2)另一个线程使条件成立,并通知等待的纤程向下执行。,,为了防止竞争,每个条件变量都需要一个Lock的配合(Lock可自行显式创建并传递进来,也可交由fibjs为您创建),,通过使用条件变量,可以利用一个条件变量控制一批纤程的开关;,,以下是两个纤程调度的实例:,```JavaScript,var coroutine = require("coroutine");,var cond = new coroutine.Condition();,var ready = false;,var state = "ready";,,function funcwait() {, cond.acquire();, while (!ready), cond.wait();, state = "go", cond.release();,},,coroutine.start(funcwait);,,cond.acquire();,console.log(state),ready = true;,cond.notify();,coroutine.sleep();,console.log(state);,```,will output:,```sh,ready,go,```
|
||||
*/
|
||||
/// <reference path="Lock.d.ts" />
|
||||
declare class Class_Condition extends Class_Lock {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 条件变量构造函数(条件变量所需的锁由fibjs内部构造)
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor();
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 条件变量构造函数
|
||||
* @param lock 使用自行构造的锁
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(lock: Class_Lock);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 使纤程进入阻塞状态
|
||||
*
|
||||
*
|
||||
*/
|
||||
wait(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 通知一个被阻塞的纤程(最后加入纤程池的)向下继续执行
|
||||
*
|
||||
*
|
||||
*/
|
||||
notify(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 通知所有被阻塞的纤程向下继续执行
|
||||
*
|
||||
*
|
||||
*/
|
||||
notifyAll(): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 数据库连接对象,用于建立和维护一个数据库连接会话。
|
||||
* @detail
|
||||
*/
|
||||
|
||||
declare class Class_DbConnection extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询当前连接数据库类型
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
type: string
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 关闭当前数据库连接
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
close(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 在当前数据库连接上启动一个事务
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
begin(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 提交当前数据库连接上的事务
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
commit(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 回滚当前数据库连接上的事务
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
rollback(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 进入事务执行一个函数,并根据函数执行情况提交或者回滚
|
||||
* func 执行有三种结果:
|
||||
* * 函数正常返回,包括运行结束和主动 return,此时事务将自动提交
|
||||
* * 函数返回 false,此时事务将回滚
|
||||
* * 函数运行错误,事务自动回滚
|
||||
*
|
||||
* @param func 以事务方式执行的函数
|
||||
* @return 返回事务是否提交,正常 commit 时返回 true, rollback 时返回 false,如果事务出错则抛出错误
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
trans(func: Function): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 执行一个 sql 命令,并返回执行结果,可根据参数格式化字符串
|
||||
*
|
||||
* @param sql 格式化字符串,可选参数用 ? 指定。例如:'SELECT FROM TEST WHERE [id]=?'
|
||||
* @param args 可选参数列表
|
||||
* @return 返回包含结果记录的数组,如果请求是 UPDATE 或者 INSERT,返回结果还会包含 affected 和 insertId,mssql 不支持 insertId。
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
execute(sql: string, ...args: any[]): any[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 格式化一个 sql 命令,并返回格式化结果
|
||||
*
|
||||
* @param sql 格式化字符串,可选参数用 ? 指定。例如:'SELECT FROM TEST WHERE [id]=?'
|
||||
* @param args 可选参数列表
|
||||
* @return 返回格式化之后的 sql 命令
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
format(sql: string, ...args: any[]): string;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+180
@@ -0,0 +1,180 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief dgram.Socket 对象是一个封装了数据包函数功能的 EventEmitter。
|
||||
* @detail DgramSocket 实例是由 dgram.createSocket() 创建的。创建 dgram.Socket 实例不需要使用 new 关键字。,,创建方法:,```JavaScript,var dgram = require('dgram');,var sock = dgram.createSocket('udp4');,```,,## 事件,DgramSocket 继承于 EventEmitter,对象的状态变化,以及数据接受,都是以事件的方式实现。,,### close 事件,** `close` 事件将在使用 `close()` 关闭一个 `socket` 之后触发。该事件一旦触发,这个 `socket` 上将不会触发新的 `message` 事件。**,,### error 事件,** 当有任何错误发生时,`error` 事件将被触发。 **,,### listening 事件,** 当一个 `socket` 开始监听数据包信息时,`listening` 事件将被触发。该事件会在创建 UDP socket 之后被立即触发。 **,,### message 事件,** 当有新的数据包被 `socket` 接收时,`message` 事件会被触发。`msg` 和 `rinfo` 会作为参数传递到该事件的处理函数中。 **,- msg: Buffer,消息,- rinfo: Object,远程地址信息, - address: string,发送方地址, - family: string,地址类型 ('IPv4' or 'IPv6'), - port: number,发送者端口, - size: number,消息大小
|
||||
*/
|
||||
/// <reference path="EventEmitter.d.ts" />
|
||||
declare class Class_DgramSocket extends Class_EventEmitter {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 该方法会令 dgram.Socket 在指定的 `port` 和 `addr` 上监听数据包信息。绑定完成时会触发一个 `listening` 事件。
|
||||
* @param port 指定绑定端口,若 `port` 未指定或为 0,操作系统会尝试绑定一个随机的端口
|
||||
* @param addr 指定绑定地址,若 address 未指定,操作系统会尝试在所有地址上监听。
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
bind(port?: number/** = 0*/, addr?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 该方法会令 dgram.Socket 在 `opts` 指定的 `port` 和 `address` 上监听数据包信息。绑定完成时会触发一个 `listening` 事件。
|
||||
* @param opts 指定绑定参数
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
bind(opts: Object): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 在 socket 上发送一个数据包
|
||||
* @param msg 指定发送的数据
|
||||
* @param port 指定发送的目的端口
|
||||
* @param address 指定发送的目的地址
|
||||
* @return 返回发送尺寸
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
send(msg: Class_Buffer, port: number, address?: string/** = ""*/): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 在 socket 上发送一个数据包
|
||||
* @param msg 指定发送的数据
|
||||
* @param offset 从指定偏移开始发送
|
||||
* @param length 之发送指定长度
|
||||
* @param port 指定发送的目的端口
|
||||
* @param address 指定发送的目的地址
|
||||
* @return 返回发送尺寸
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
send(msg: Class_Buffer, offset: number, length: number, port: number, address?: string/** = ""*/): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回一个包含 socket 地址信息的对象。对于 UDP socket,该对象将包含 address、family 和 port 属性。
|
||||
* @return 返回对象绑定地址
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
address(): any;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 关闭当前 socket
|
||||
*
|
||||
*
|
||||
*/
|
||||
close(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 关闭当前 socket
|
||||
* @param callback 关闭完成后的回调函数,它相当于为 `close` 事件添加了一个监听器
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
close(callback: Function): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询 socket 接收缓冲区大小
|
||||
* @return 返回查询结果
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
getRecvBufferSize(): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询 socket 发送缓冲区大小
|
||||
* @return 返回查询结果
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
getSendBufferSize(): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 设置 socket 接收缓冲区大小
|
||||
* @param size 指定要设置的尺寸
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
setRecvBufferSize(size: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 设置 socket 发送缓冲区大小
|
||||
* @param size 指定要设置的尺寸
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
setSendBufferSize(size: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 设置或清除 SO_BROADCAST socket 选项
|
||||
* @param flag 当设置为 true, UDP包会被发送到一个本地接口的广播地址
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
setBroadcast(flag: boolean): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 维持 fibjs 进程不退出,在对象绑定期间阻止 fibjs 进程退出
|
||||
* @return 返回当前对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
ref(): Class_DgramSocket;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 允许 fibjs 进程退出,在对象绑定期间允许 fibjs 进程退出
|
||||
* @return 返回当前对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
unref(): Class_DgramSocket;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+77
@@ -0,0 +1,77 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 信息摘要对象
|
||||
* @detail
|
||||
*/
|
||||
|
||||
declare class Class_Digest extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询当前信息摘要算法的摘要字节数
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
size: number
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 更新二进制摘要信息
|
||||
* @param data 二进制数据块
|
||||
* @return 返回信息摘要对象本身
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
update(data: Class_Buffer): Class_Digest;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 计算并返回摘要
|
||||
* @param data 二进制数据块,此数据块将在计算前更新进摘要
|
||||
* @return 返回摘要的二进制数据
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
digest(data: Class_Buffer): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 计算并返回摘要
|
||||
* @return 返回摘要的二进制数据
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
digest(): Class_Buffer;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+85
@@ -0,0 +1,85 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 事件对象
|
||||
* @detail 通过一个事件达到对一组纤程进行控制的目的(事件对象的状态为bool类型)
|
||||
*/
|
||||
/// <reference path="Lock.d.ts" />
|
||||
declare class Class_Event extends Class_Lock {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 事件对象构造函数
|
||||
* @param value 指定是否等待,为 true 时等待,缺省为 false
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(value?: boolean/** = false*/);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 判断事件对象是否为真
|
||||
* @return 如果事件为真,返回 true
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
isSet(): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 激活事件(将事件状态改为true),并调用pulse()
|
||||
*
|
||||
*
|
||||
*/
|
||||
set(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 激活等待该事件的所有纤程
|
||||
*
|
||||
*
|
||||
*/
|
||||
pulse(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 重置事件(将事件状态改为false)
|
||||
*
|
||||
*
|
||||
*/
|
||||
clear(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 等待一个事件
|
||||
*
|
||||
*
|
||||
*/
|
||||
wait(): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
+311
@@ -0,0 +1,311 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 事件触发对象,可用于建立观察者模式,支持事件触发的对象均继承于此,同一事件的同一函数只会产生一次回调
|
||||
* @detail Event 对象可独立创建,以用于组建自定义的事件系统:,```JavaScript,var EventEmitter = require('events');,,var e = new EventEmitter();,```
|
||||
*/
|
||||
|
||||
declare class Class_EventEmitter extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 默认全局最大监听器数
|
||||
* @static
|
||||
*
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
defaultMaxListeners: number
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 构造函数
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor();
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 绑定一个事件处理函数到对象
|
||||
* @param ev 指定事件的名称
|
||||
* @param func 指定事件处理函数
|
||||
* @return 返回成功绑定的数量,如果函数已绑定则返回 0
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
on(ev: string, func: Function): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 绑定一个事件处理函数到对象
|
||||
* @param map 指定事件映射关系,对象属性名称将作为事件名称,属性的值将作为事件处理函数
|
||||
* @return 返回事件对象本身,便于链式调用
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
on(map: Object): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 绑定一个事件处理函数到对象
|
||||
* @param ev 指定事件的名称
|
||||
* @param func 指定事件处理函数
|
||||
* @return 返回事件对象本身,便于链式调用
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
addListener(ev: string, func: Function): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 绑定一个事件处理函数到对象
|
||||
* @param map 指定事件映射关系,对象属性名称将作为事件名称,属性的值将作为事件处理函数
|
||||
* @return 返回事件对象本身,便于链式调用
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
addListener(map: Object): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 绑定一个事件处理函数到对象起始
|
||||
* @param ev 指定事件的名称
|
||||
* @param func 指定事件处理函数
|
||||
* @return 返回成功绑定的数量,如果函数已绑定则返回 0
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
prependListener(ev: string, func: Function): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 绑定一个事件处理函数到对象起始
|
||||
* @param map 指定事件映射关系,对象属性名称将作为事件名称,属性的值将作为事件处理函数
|
||||
* @return 返回成功绑定的数量,如果函数已绑定则返回 0
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
prependListener(map: Object): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 绑定一个一次性事件处理函数到对象,一次性处理函数只会触发一次
|
||||
* @param ev 指定事件的名称
|
||||
* @param func 指定事件处理函数
|
||||
* @return 返回事件对象本身,便于链式调用
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
once(ev: string, func: Function): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 绑定一个一次性事件处理函数到对象,一次性处理函数只会触发一次
|
||||
* @param map 指定事件映射关系,对象属性名称将作为事件名称,属性的值将作为事件处理函数
|
||||
* @return 返回事件对象本身,便于链式调用
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
once(map: Object): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 绑定一个事件处理函数到对象起始
|
||||
* @param ev 指定事件的名称
|
||||
* @param func 指定事件处理函数
|
||||
* @return 返回成功绑定的数量,如果函数已绑定则返回 0
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
prependOnceListener(ev: string, func: Function): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 绑定一个事件处理函数到对象起始
|
||||
* @param map 指定事件映射关系,对象属性名称将作为事件名称,属性的值将作为事件处理函数
|
||||
* @return 返回成功绑定的数量,如果函数已绑定则返回 0
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
prependOnceListener(map: Object): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 从对象处理队列中取消指定函数
|
||||
* @param ev 指定事件的名称
|
||||
* @param func 指定事件处理函数
|
||||
* @return 返回事件对象本身,便于链式调用
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
off(ev: string, func: Function): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 取消对象处理队列中的全部函数
|
||||
* @param ev 指定事件的名称
|
||||
* @return 返回事件对象本身,便于链式调用
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
off(ev: string): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 从对象处理队列中取消指定函数
|
||||
* @param map 指定事件映射关系,对象属性名称作为事件名称,属性的值作为事件处理函数
|
||||
* @return 返回事件对象本身,便于链式调用
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
off(map: Object): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 从对象处理队列中取消指定函数
|
||||
* @param ev 指定事件的名称
|
||||
* @param func 指定事件处理函数
|
||||
* @return 返回事件对象本身,便于链式调用
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
removeListener(ev: string, func: Function): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 取消对象处理队列中的全部函数
|
||||
* @param ev 指定事件的名称
|
||||
* @return 返回事件对象本身,便于链式调用
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
removeListener(ev: string): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 从对象处理队列中取消指定函数
|
||||
* @param map 指定事件映射关系,对象属性名称作为事件名称,属性的值作为事件处理函数
|
||||
* @return 返回事件对象本身,便于链式调用
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
removeListener(map: Object): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 从对象处理队列中取消所有事件的所有监听器, 如果指定事件,则移除指定事件的所有监听器。
|
||||
* @param evs 指定事件的名称
|
||||
* @return 返回事件对象本身,便于链式调用
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
removeAllListeners(evs?: any[]/** = v8::Array::New(isolate)*/): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* 监听器的默认限制的数量,仅用于兼容
|
||||
* @param n 指定事件的数量
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
setMaxListeners(n: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* 获取监听器的默认限制的数量,仅用于兼容
|
||||
* @return 返回默认限制数量
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
getMaxListeners(): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询对象指定事件的监听器数组
|
||||
* @param ev 指定事件的名称
|
||||
* @return 返回指定事件的监听器数组
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
listeners(ev: string): any[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询对象指定事件的监听器数量
|
||||
* @param ev 指定事件的名称
|
||||
* @return 返回指定事件的监听器数量
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
listenerCount(ev: string): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询监听器事件名称
|
||||
* @return 返回事件名称数组
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
eventNames(): any[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 主动触发一个事件
|
||||
* @param ev 事件名称
|
||||
* @param args 事件参数,将会传递给事件处理函数
|
||||
* @return 返回事件触发状态,有响应事件返回 true,否则返回 false
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
emit(ev: string, ...args: any[]): boolean;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+81
@@ -0,0 +1,81 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 事件信息对象,用于在事件中传递信息
|
||||
* @detail
|
||||
*/
|
||||
|
||||
declare class Class_EventInfo extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* 查询事件错误编码
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
code: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* 查询事件错误信息
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
reason: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* 查询事件类型
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
type: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* 查询触发事件的对象
|
||||
*
|
||||
* @readonly
|
||||
* @type Object
|
||||
*/
|
||||
|
||||
target: Object
|
||||
|
||||
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+77
@@ -0,0 +1,77 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 纤程操作对象,此对象不可直接创建
|
||||
* @detail 使用 coroutine.start 创建纤程后,将返回此对象,用于纤程处理和纤程间通信。,纤程主函数可以通过 this 访问本纤程对象,也可通过 coroutine.current 获取当前纤程。,```JavaScript,function func(v1),{, console.log(v1 + this.v);,},,var fb = coroutine.start(func,100);,,fb.v = 123;,,fb.join();,```,,纤程局部存储通过共享的 Fiber 对象完成,通过 coroutine.current 获取当前纤程,通过修改和查询其变量达到共享数据的目的。,,```JavaScript,function func(),{, console.log(coroutine.current().v);,},,coroutine.current().v = 100;,,func();,```,,纤程在创建时,会自动复制当前纤程的局部变量到新的纤程,之后,各自的局部变量的修改不会相互影响,除非变量本身为对象引用。,,```JavaScript,function func(),{, console.log(coroutine.current().v);,},,coroutine.current().v = 100;,,var fb = coroutine.start(func);,,coroutine.current().v = 200;,,fb.join();,```
|
||||
*/
|
||||
|
||||
declare class Class_Fiber extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询纤程的唯一 id
|
||||
*
|
||||
* @readonly
|
||||
* @type Long
|
||||
*/
|
||||
|
||||
id: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询纤程的调用纤程
|
||||
*
|
||||
* @readonly
|
||||
* @type Fiber
|
||||
*/
|
||||
|
||||
caller: Class_Fiber
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询纤程的调用堆栈
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
stack: string
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 等待纤程结束
|
||||
*
|
||||
*
|
||||
*/
|
||||
join(): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+67
@@ -0,0 +1,67 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 文件操作对象,用于二进制文件读写
|
||||
* @detail 文件操作对象用于对二进制文件进行操作,可使用 fs 模块打开和创建文件:,```JavaScript,var f = fs.openFile('test.txt');,```
|
||||
*/
|
||||
/// <reference path="SeekableStream.d.ts" />
|
||||
declare class Class_File extends Class_SeekableStream {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询当前文件名
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
name: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询当前文件描述符
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
fd: number
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询当前文件的访问权限,Windows 不支持此方法
|
||||
* @param mode 指定设定的访问权限
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
chmod(mode: number): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+74
@@ -0,0 +1,74 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 消息处理器接口
|
||||
* @detail
|
||||
*/
|
||||
|
||||
declare class Class_Handler extends Class__object {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 构造一个消息处理器链处理对象
|
||||
* @param hdlrs 处理器数组
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(hdlrs: any[]);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 创建一个消息处理器路由对象
|
||||
* @param map 初始化路由参数
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(map: Object);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 创建一个 JavaSvript 消息处理器
|
||||
* @param hdlr JavaScript 处理器函数
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(hdlr: Function);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 处理一个消息或对象
|
||||
* @param v 指定处理的消息或对象
|
||||
* @return 返回下一步的处理器
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
invoke(v: Class__object): Class_Handler;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+90
@@ -0,0 +1,90 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 扩展消息处理器接口
|
||||
* @detail
|
||||
*/
|
||||
/// <reference path="Handler.d.ts" />
|
||||
declare class Class_HandlerEx extends Class_Handler {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief WebSocket 协议转换处理器当前事件处理接口对象
|
||||
*
|
||||
*
|
||||
* @type Handler
|
||||
*/
|
||||
|
||||
handler: Class_Handler
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询 WebSocket 包协议转换处理器的工作状态
|
||||
*
|
||||
* 返回的结果为一个 Stats 对象,结构如下:
|
||||
* ```JavaScript
|
||||
* {
|
||||
* total : 1000, // 总计处理的请求
|
||||
* pendding : 100, // 当前正在处理的请求
|
||||
* request : 10, // 新建的请求
|
||||
* response : 10, // 发送的响应
|
||||
* error : 100 // 发生的错误
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type Stats
|
||||
*/
|
||||
|
||||
stats: Class_Stats
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 设置错误处理器
|
||||
*
|
||||
* 使用方式:
|
||||
* ```JavaScript
|
||||
* hdlr.onerror({
|
||||
* "404": function(v)
|
||||
* {
|
||||
* ...
|
||||
* },
|
||||
* "500": new mq.Routing(...)
|
||||
* })
|
||||
* ```
|
||||
* @param hdlrs 指定不同的错误的处理器,key 是错误号,value 是处理器,可以是内置消息处理器,处理函数,链式处理数组,路由对象,详见 mq.Handler
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
onerror(hdlrs: Object): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief HeapGraphEdge表示两个HeapGraphNode节点间的关联,从上游节点到下游节点
|
||||
* @detail
|
||||
*/
|
||||
|
||||
declare class Class_HeapGraphEdge extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 下游节点的链接方式,可能的值:
|
||||
* - profiler.Edge_ContextVariable, 函数中的变量
|
||||
* - profiler.Edge_Element, 数组中的元素
|
||||
* - profiler.Edge_Property, 有名对象的属性
|
||||
* - profiler.Edge_Internal, JS无法进入的链接
|
||||
* - profiler.Edge_Hidden, 指向需要事先计算出空间大小的节点
|
||||
* - profiler.Edge_Shortcut, 指向无法事先计算出空间大小的节点
|
||||
* - profiler.Edge_Weak, 一个弱引用(被GC忽视)
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
type: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 链接名称
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
name: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 链接的描述
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
description: string
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 获取HeapGraphEdge的上游HeapGraphNode节点
|
||||
* @return 返回源HeapGraphNode节点
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
getFromNode(): Class_HeapGraphNode;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 获取HeapGraphEdge的下游HeapGraphNode节点
|
||||
* @return 返回目的HeapGraphNode节点
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
getToNode(): Class_HeapGraphNode;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief HeapGraphNode表示堆视图中的一个节点
|
||||
* @detail
|
||||
*/
|
||||
|
||||
declare class Class_HeapGraphNode extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 节点类型,可能的值:
|
||||
* - profiler.Node_Hidden, 隐藏节点,当显示给用户时可以被过滤掉
|
||||
* - profiler.Node_Array, 数组
|
||||
* - profiler.Node_String, 字符串
|
||||
* - profiler.Node_Object, JS对象(字符串和数组除外)
|
||||
* - profiler.Node_Code, 编译后的代码
|
||||
* - profiler.Node_Closure, 函数闭包
|
||||
* - profiler.Node_RegExp, 正则表达式
|
||||
* - profiler.Node_HeapNumber, 堆中排好序的数字
|
||||
* - profiler.Node_Native, Native对象(非v8堆上的)
|
||||
* - profiler.Node_Synthetic, Synthetic对象
|
||||
* - profiler.Node_ConsString, 拼接的字符串
|
||||
* - profiler.Node_SlicedString, 分割的字符串
|
||||
* - profiler.Node_Symbol, 符号(ES6)
|
||||
* - profiler.Node_SimdValue, 堆中排好序的SIMD值(ES7)
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
type: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 节点名称
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
name: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 节点的描述
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
description: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 节点ID
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
id: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 节点大小,单位为字节
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
shallowSize: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 子节点列表,由HeapGraphEdge类型对象组成
|
||||
*
|
||||
* @readonly
|
||||
* @type NArray
|
||||
*/
|
||||
|
||||
childs: any[]
|
||||
|
||||
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief HeapSnapshots记录JS堆在某个时刻的状态
|
||||
* @detail
|
||||
*/
|
||||
|
||||
declare class Class_HeapSnapshot extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 时间信息
|
||||
*
|
||||
* @readonly
|
||||
* @type Date
|
||||
*/
|
||||
|
||||
time: Date
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 堆视图的根节点
|
||||
*
|
||||
* @readonly
|
||||
* @type HeapGraphNode
|
||||
*/
|
||||
|
||||
root: Class_HeapGraphNode
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 堆视图节点组成的列表
|
||||
*
|
||||
* @readonly
|
||||
* @type NArray
|
||||
*/
|
||||
|
||||
nodes: any[]
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 和指定的堆快照进行比较
|
||||
* @param before 待比较的堆快照
|
||||
* @return 返回堆快照的比较结果
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
diff(before: Class_HeapSnapshot): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 根据ID获取堆视图节点
|
||||
* @param id 数字类型的节点ID
|
||||
* @return 返回获取到的堆视图节点
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
getNodeById(id: number): Class_HeapGraphNode;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 根据指定名称保存HeapSnapshot
|
||||
* @param fname 快照名称
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
save(fname: string): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+258
@@ -0,0 +1,258 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief http客户端对象
|
||||
* @detail http客户端对象模拟浏览器环境缓存cookie,并在访问url的时候携带对应的cookie,不同的http客户端对象是相互隔离的,提供http的request、get、post等方法。,用法如下:,,```JavaScript,var http = require('http');,var httpClient = new http.Client();,httpClient.request('GET', 'http://fibjs.org');,```
|
||||
*/
|
||||
|
||||
declare class Class_HttpClient extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回http客户端的 HttpCookie 对象列表
|
||||
*
|
||||
* @readonly
|
||||
* @type NArray
|
||||
*/
|
||||
|
||||
cookies: any[]
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置超时时间 单位毫秒
|
||||
*
|
||||
*
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
timeout: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置 body 最大尺寸,以 MB 为单位,缺省为 -1,不限制尺寸
|
||||
*
|
||||
*
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
maxBodySize: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief cookie功能开关,默认开启
|
||||
*
|
||||
*
|
||||
* @type Boolean
|
||||
*/
|
||||
|
||||
enableCookie: boolean
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 自动redirect功能开关,默认开启
|
||||
*
|
||||
*
|
||||
* @type Boolean
|
||||
*/
|
||||
|
||||
autoRedirect: boolean
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置 http 请求中的浏览器标识
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
userAgent: string
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief HttpClient 构造函数,创建一个新的HttpClient对象
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor();
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 发送 http 请求到指定的流对象,并返回结果
|
||||
* @param conn 指定处理请求的流对象
|
||||
* @param req 要发送的 HttpRequest 对象
|
||||
* @return 返回服务器响应
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
request(conn: Class_Stream, req: Class_HttpRequest): Class_HttpResponse;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 请求指定的 url,并返回结果
|
||||
* opts 包含请求的附加选项,支持的内容如下:
|
||||
* ```JavaScript
|
||||
* {
|
||||
* "query": {},
|
||||
* "body": SeekedStream | Buffer | String | {},
|
||||
* "json": {},
|
||||
* "headers": {}
|
||||
* }
|
||||
* ```
|
||||
* 其中 body,json 不得同时出现。缺省为 {},不包含任何附加信息
|
||||
* @param method 指定 http 请求方法:GET, POST 等
|
||||
* @param url 指定 url,必须是包含主机的完整 url
|
||||
* @param opts 指定附加信息
|
||||
* @return 返回服务器响应
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
request(method: string, url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 用 GET 方法请求指定的 url,并返回结果,等同于 request("GET", ...)
|
||||
* opts 包含请求的附加选项,支持的内容如下:
|
||||
* ```JavaScript
|
||||
* {
|
||||
* "query": {},
|
||||
* "body": SeekedStream | Buffer | String | {},
|
||||
* "json": {},
|
||||
* "headers": {}
|
||||
* }
|
||||
* ```
|
||||
* 其中 body,json 不得同时出现。缺省为 {},不包含任何附加信息
|
||||
* @param url 指定 url,必须是包含主机的完整 url
|
||||
* @param opts 指定附加信息
|
||||
* @return 返回服务器响应
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
get(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 用 POST 方法请求指定的 url,并返回结果,等同于 request("POST", ...)
|
||||
* opts 包含请求的附加选项,支持的内容如下:
|
||||
* ```JavaScript
|
||||
* {
|
||||
* "query": {},
|
||||
* "body": SeekedStream | Buffer | String | {},
|
||||
* "json": {},
|
||||
* "headers": {}
|
||||
* }
|
||||
* ```
|
||||
* 其中 body,json 不得同时出现。缺省为 {},不包含任何附加信息
|
||||
* @param url 指定 url,必须是包含主机的完整 url
|
||||
* @param opts 指定附加信息
|
||||
* @return 返回服务器响应
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
post(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 用 DELETE 方法请求指定的 url,并返回结果,等同于 request("DELETE", ...)
|
||||
* opts 包含请求的附加选项,支持的内容如下:
|
||||
* ```JavaScript
|
||||
* {
|
||||
* "query": {},
|
||||
* "body": SeekedStream | Buffer | String | {},
|
||||
* "json": {},
|
||||
* "headers": {}
|
||||
* }
|
||||
* ```
|
||||
* 其中 body,json 不得同时出现。缺省为 {},不包含任何附加信息
|
||||
* @param url 指定 url,必须是包含主机的完整 url
|
||||
* @param opts 指定附加信息
|
||||
* @return 返回服务器响应
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
del(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 用 PUT 方法请求指定的 url,并返回结果,等同于 request("PUT", ...)
|
||||
* opts 包含请求的附加选项,支持的内容如下:
|
||||
* ```JavaScript
|
||||
* {
|
||||
* "query": {},
|
||||
* "body": SeekedStream | Buffer | String | {},
|
||||
* "json": {},
|
||||
* "headers": {}
|
||||
* }
|
||||
* ```
|
||||
* 其中 body,json 不得同时出现。缺省为 {},不包含任何附加信息
|
||||
* @param url 指定 url,必须是包含主机的完整 url
|
||||
* @param opts 指定附加信息
|
||||
* @return 返回服务器响应
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
put(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 用 PATCH 方法请求指定的 url,并返回结果,等同于 request("PATCH", ...)
|
||||
* opts 包含请求的附加选项,支持的内容如下:
|
||||
* ```JavaScript
|
||||
* {
|
||||
* "query": {},
|
||||
* "body": SeekedStream | Buffer | String | {},
|
||||
* "json": {},
|
||||
* "headers": {}
|
||||
* }
|
||||
* ```
|
||||
* 其中 body,json 不得同时出现。缺省为 {},不包含任何附加信息
|
||||
* @param url 指定 url,必须是包含主机的完整 url
|
||||
* @param opts 指定附加信息
|
||||
* @return 返回服务器响应
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
patch(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief http 容器对象,用于 http header,cookie,query,form,等数据的存储与组织
|
||||
* @detail
|
||||
*/
|
||||
|
||||
declare class Class_HttpCollection extends Class__object {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 清除容器数据
|
||||
*
|
||||
*
|
||||
*/
|
||||
clear(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 检查容器内是否存在指定键值的数据
|
||||
* @param name 指定要检查的键值
|
||||
* @return 返回键值是否存在
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
has(name: string): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询指定键值的第一个值
|
||||
* @param name 指定要查询的键值
|
||||
* @return 返回键值所对应的值,若不存在,则返回 undefined
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
first(name: string): any;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询指定键值的全部值
|
||||
* @param name 指定要查询的键值
|
||||
* @return 返回键值所对应全部值的数组,若数据不存在,则返回 null
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
all(name: string): any[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 添加一个键值数据,添加数据并不修改已存在的键值的数据
|
||||
* @param map 指定要添加的键值数据字典
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
add(map: Object): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 添加一个键值数据,添加数据并不修改已存在的键值的数据
|
||||
* @param name 指定要添加的键值
|
||||
* @param value 指定要添加的数据
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
add(name: string, value: any): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 设定一个键值数据,设定数据将修改键值所对应的第一个数值,并清除相同键值的其余数据
|
||||
* @param map 指定要设定的键值数据字典
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
set(map: Object): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 设定一个键值数据,设定数据将修改键值所对应的第一个数值,并清除相同键值的其余数据
|
||||
* @param name 指定要设定的键值
|
||||
* @param value 指定要设定的数据
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
set(name: string, value: any): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 删除指定键值的全部值
|
||||
* @param name 指定要删除的键值
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
remove(name: string): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+160
@@ -0,0 +1,160 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief http Cookie 对象,用于添加和处理 cookie
|
||||
* @detail
|
||||
*/
|
||||
|
||||
declare class Class_HttpCookie extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置 cookie 名称
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
name: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置 cookie 的值
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
value: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置 cookie 的域名范围
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
domain: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置 cookie 的路径范围
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
path: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置 cookie 的过期时间
|
||||
*
|
||||
*
|
||||
* @type Date
|
||||
*/
|
||||
|
||||
expires: Date
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置 cookie 是否仅允许 http 请求,缺省 false
|
||||
*
|
||||
*
|
||||
* @type Boolean
|
||||
*/
|
||||
|
||||
httpOnly: boolean
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置 cookie 是否仅通过 https 传递,缺省 false
|
||||
*
|
||||
*
|
||||
* @type Boolean
|
||||
*/
|
||||
|
||||
secure: boolean
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief HttpCookie 构造函数,创建一个新的 HttpCookie 对象
|
||||
* @param opts 指定创建的 cookie 的属性
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(opts?: Object/** = v8::Object::New(isolate)*/);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief HttpCookie 构造函数,创建一个新的 HttpCookie 对象
|
||||
* @param name 指定创建的 cookie 名称
|
||||
* @param value 指定创建的 cookie 值
|
||||
* @param opts 指定创建的 cookie 的其它属性
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(name: string, value: string, opts?: Object/** = v8::Object::New(isolate)*/);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 解析给定的字符串,填充 cookie 对象
|
||||
* @param header 指定需要解析的 header 字符串
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
parse(header: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 检测给定的 url 是否匹配当前设置
|
||||
* @param url 指定测试的 url
|
||||
* @return 匹配成功返回 true
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
match(url: string): boolean;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+101
@@ -0,0 +1,101 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief http 协议转换处理器
|
||||
* @detail 用以将数据流转换为 http 协议消息,创建方式:,```JavaScript,var hdlr = new mq.HttpHandler(...);,```,或者:,```JavaScript,var hdlr = new http.Handler(...);,```
|
||||
*/
|
||||
/// <reference path="HandlerEx.d.ts" />
|
||||
declare class Class_HttpHandler extends Class_HandlerEx {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置是否允强制使用 gzip 压缩输出,缺省为 false
|
||||
*
|
||||
*
|
||||
* @type Boolean
|
||||
*/
|
||||
|
||||
forceGZIP: boolean
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置最大请求头个数,缺省为 128
|
||||
*
|
||||
*
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
maxHeadersCount: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置 body 最大尺寸,以 MB 为单位,缺省为 64
|
||||
*
|
||||
*
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
maxBodySize: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置服务器名称,缺省为:fibjs/0.x.0
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
serverName: string
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 创建一个 http 协议处理器对象,将流对象的数据转变为 http 消息对象
|
||||
* @param hdlr 内置消息处理器,处理函数,链式处理数组,路由对象,详见 mq.Handler
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(hdlr: Class_Handler);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 允许跨域请求
|
||||
* @param allowHeaders 指定接受的 http 头字段
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
enableCrossOrigin(allowHeaders?: string/** = "Content-Type"*/): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+202
@@ -0,0 +1,202 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief http 基础消息对象
|
||||
* @detail
|
||||
*/
|
||||
/// <reference path="Message.d.ts" />
|
||||
declare class Class_HttpMessage extends Class_Message {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 协议版本信息,允许的格式为:HTTP/#.#
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
protocol: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 包含消息中 http 消息头的容器,只读属性
|
||||
*
|
||||
* @readonly
|
||||
* @type HttpCollection
|
||||
*/
|
||||
|
||||
headers: Class_HttpCollection
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设定是否保持连接
|
||||
*
|
||||
*
|
||||
* @type Boolean
|
||||
*/
|
||||
|
||||
keepAlive: boolean
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设定是否是升级协议
|
||||
*
|
||||
*
|
||||
* @type Boolean
|
||||
*/
|
||||
|
||||
upgrade: boolean
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置最大请求头个数,缺省为 128
|
||||
*
|
||||
*
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
maxHeadersCount: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置 body 最大尺寸,以 MB 为单位,缺省为 64
|
||||
*
|
||||
*
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
maxBodySize: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询当前对象的来源 socket
|
||||
*
|
||||
* @readonly
|
||||
* @type Stream
|
||||
*/
|
||||
|
||||
socket: Class_Stream
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 检查是否存在指定键值的消息头
|
||||
* @param name 指定要检查的键值
|
||||
* @return 返回键值是否存在
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
hasHeader(name: string): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询指定键值的第一个消息头
|
||||
* @param name 指定要查询的键值
|
||||
* @return 返回键值所对应的值,若不存在,则返回 undefined
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
firstHeader(name: string): any;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询指定键值的全部消息头
|
||||
* @param name 指定要查询的键值
|
||||
* @return 返回键值所对应全部值的数组,若数据不存在,则返回 null
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
allHeader(name: string): any[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 添加一个消息头,添加数据并不修改已存在的键值的消息头
|
||||
* @param map 指定要添加的键值数据字典
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
addHeader(map: Object): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 添加一个消息头,添加数据并不修改已存在的键值的消息头
|
||||
* @param name 指定要添加的键值
|
||||
* @param value 指定要添加的数据
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
addHeader(name: string, value: any): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 设定一个消息头,设定数据将修改键值所对应的第一个数值,并清除相同键值的其余消息头
|
||||
* @param map 指定要设定的键值数据字典
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
setHeader(map: Object): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 设定一个消息头,设定数据将修改键值所对应的第一个数值,并清除相同键值的其余消息头
|
||||
* @param name 指定要设定的键值
|
||||
* @param value 指定要设定的数据
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
setHeader(name: string, value: any): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 删除指定键值的全部消息头
|
||||
* @param name 指定要删除的键值
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
removeHeader(name: string): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+125
@@ -0,0 +1,125 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief http 请求消息对象
|
||||
* @detail
|
||||
*/
|
||||
/// <reference path="HttpMessage.d.ts" />
|
||||
declare class Class_HttpRequest extends Class_HttpMessage {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 获取响应消息对象
|
||||
*
|
||||
* @readonly
|
||||
* @type HttpResponse
|
||||
*/
|
||||
|
||||
response: Class_HttpResponse
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置请求方法
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
method: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置请求地址
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
address: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置请求查询字符串
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
queryString: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 获取包含消息 cookies 的容器
|
||||
*
|
||||
* @readonly
|
||||
* @type HttpCollection
|
||||
*/
|
||||
|
||||
cookies: Class_HttpCollection
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 获取包含消息 form 的容器
|
||||
*
|
||||
* @readonly
|
||||
* @type HttpCollection
|
||||
*/
|
||||
|
||||
form: Class_HttpCollection
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 获取包含消息 query 的容器
|
||||
*
|
||||
* @readonly
|
||||
* @type HttpCollection
|
||||
*/
|
||||
|
||||
query: Class_HttpCollection
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief HttpRequest 构造函数,创建一个新的 HttpRequest 对象
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor();
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief http 响应消息对象
|
||||
* @detail
|
||||
*/
|
||||
/// <reference path="HttpMessage.d.ts" />
|
||||
declare class Class_HttpResponse extends Class_HttpMessage {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置响应消息的返回状态
|
||||
*
|
||||
*
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
statusCode: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置响应消息的返回消息
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
statusMessage: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回当前消息的 HttpCookie 对象列表
|
||||
*
|
||||
* @readonly
|
||||
* @type NArray
|
||||
*/
|
||||
|
||||
cookies: any[]
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief HttpResponse 构造函数,创建一个新的 HttpResponse 对象
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor();
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 设置响应消息的返回状态,返回消息,并添加响应头
|
||||
* @param statusCode 指定响应消息的返回状态
|
||||
* @param statusMessage 指定响应消息的返回消息
|
||||
* @param headers 指定响应消息添加的响应头
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
writeHead(statusCode: number, statusMessage: string, headers?: Object/** = v8::Object::New(isolate)*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 设置响应消息的返回状态,返回消息,并添加响应头
|
||||
* @param statusCode 指定响应消息的返回状态
|
||||
* @param headers 指定响应消息添加的响应头
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
writeHead(statusCode: number, headers?: Object/** = v8::Object::New(isolate)*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 向 cookies 添加一个 HttpCookie 对象
|
||||
* @param cookie 指定要添加的 HttpCookie 对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
addCookie(cookie: Class_HttpCookie): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 发送重定向到客户端
|
||||
* @param url 重定向的地址
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
redirect(url: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 仅发送格式化 http 头到给定的流对象
|
||||
* @param stm 指定接收格式化消息的流对象
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
sendHeader(stm: Class_Stream): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+162
@@ -0,0 +1,162 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief http 服务器对象
|
||||
* @detail http 服务器对象是将 TcpServer 和 HttpHandler 组合封装的对象,方便快速搭建服务器,逻辑上相当于:,```JavaScript,var svr = new net.TcpServer(addr, port, new http.Handler(function(req){, ...,}));,```,,创建方法:,```JavaScript,var http = require("http");,var svr = new http.Server(80, function(req){, ...,});,```
|
||||
*/
|
||||
/// <reference path="TcpServer.d.ts" />
|
||||
declare class Class_HttpServer extends Class_TcpServer {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置是否允强制使用 gzip 压缩输出,缺省为 false
|
||||
*
|
||||
*
|
||||
* @type Boolean
|
||||
*/
|
||||
|
||||
forceGZIP: boolean
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置最大请求头个数,缺省为 128
|
||||
*
|
||||
*
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
maxHeadersCount: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置 body 最大尺寸,以 MB 为单位,缺省为 64
|
||||
*
|
||||
*
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
maxBodySize: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置服务器名称,缺省为:fibjs/0.x.0
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
serverName: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询 http 协议转换处理器的工作状态
|
||||
*
|
||||
* 返回的结果为一个 Stats 对象,结构如下:
|
||||
* ```JavaScript
|
||||
* {
|
||||
* total : 1000, // 总计处理的请求
|
||||
* pendding : 100, // 当前正在处理的请求
|
||||
* request : 10, // 新建的请求
|
||||
* response : 10, // 发送的响应
|
||||
* error : 100, // 发生的错误(不计入 404)
|
||||
* error_400 : 10, // 发生的请求错误
|
||||
* error_404 : 12, // 文件未找到的数量
|
||||
* error_500 : 2 // 内部处理错误
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type Stats
|
||||
*/
|
||||
|
||||
httpStats: Class_Stats
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief HttpServer 构造函数,在所有本机地址侦听
|
||||
* @param port 指定 http 服务器侦听端口
|
||||
* @param hdlr http 内置消息处理器,处理函数,链式处理数组,路由对象,详见 mq.Handler
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(port: number, hdlr: Class_Handler);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief HttpServer 构造函数
|
||||
* @param addr 指定 http 服务器侦听地址,为 "" 则在本机所有地址侦听
|
||||
* @param port 指定 http 服务器侦听端口
|
||||
* @param hdlr http 内置消息处理器,处理函数,链式处理数组,路由对象,详见 mq.Handler
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(addr: string, port: number, hdlr: Class_Handler);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 设置错误处理器
|
||||
*
|
||||
* 使用方式:
|
||||
* ```JavaScript
|
||||
* hdlr.onerror({
|
||||
* "404": function(v)
|
||||
* {
|
||||
* ...
|
||||
* },
|
||||
* "500": new mq.Routing(...)
|
||||
* })
|
||||
* ```
|
||||
* @param hdlrs 指定不同的错误的处理器,key 是错误号,value 是处理器,可以是内置消息处理器,处理函数,链式处理数组,路由对象,详见 mq.Handler
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
onerror(hdlrs: Object): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 允许跨域请求
|
||||
* @param allowHeaders 指定接受的 http 头字段
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
enableCrossOrigin(allowHeaders?: string/** = "Content-Type"*/): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 包含 multipart 的一个条目数据
|
||||
* @detail
|
||||
*/
|
||||
|
||||
declare class Class_HttpUploadData extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 包含本条目数据的文件名
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
fileName: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 包含本条目数据的类型
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
contentType: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 包含本条目数据的传输编码类型
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
contentTransferEncoding: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 包含本条目数据部分的流对象
|
||||
*
|
||||
* @readonly
|
||||
* @type SeekableStream
|
||||
*/
|
||||
|
||||
body: Class_SeekableStream
|
||||
|
||||
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+137
@@ -0,0 +1,137 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief https 服务器对象
|
||||
* @detail https 服务器对象是将 SslServer 和 HttpHandler 组合封装的对象,方便快速搭建服务器,逻辑上相当于:,```JavaScript,var svr = new net.SslServer(crt, key, addr, port, new http.Handler(function(req){, ...,}));,```,,创建方法:,```JavaScript,var http = require("http");,var svr = new http.HttpsServer(crt, key, 443, function(req){, ...,});,```
|
||||
*/
|
||||
/// <reference path="HttpServer.d.ts" />
|
||||
declare class Class_HttpsServer extends Class_HttpServer {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 设定证书验证模式,缺省为 VERIFY_NONE
|
||||
*
|
||||
*
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
verification: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 客户端证书验证 ca
|
||||
*
|
||||
* @readonly
|
||||
* @type X509Cert
|
||||
*/
|
||||
|
||||
ca: Class_X509Cert
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief HttpsServer 构造函数,在所有本机地址侦听
|
||||
*
|
||||
* certs 格式为:
|
||||
* ```JavaScript
|
||||
* [
|
||||
* {
|
||||
* crt: [X509Cert object],
|
||||
* key: [PKey object]
|
||||
* },
|
||||
* {
|
||||
* crt: [X509Cert object],
|
||||
* key: [PKey object]
|
||||
* }
|
||||
* ]
|
||||
* ```
|
||||
* @param certs 服务器证书列表
|
||||
* @param port 指定 http 服务器侦听端口
|
||||
* @param hdlr http 内置消息处理器,处理函数,链式处理数组,路由对象,详见
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(certs: any[], port: number, hdlr: Class_Handler);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief HttpsServer 构造函数
|
||||
*
|
||||
* certs 格式为:
|
||||
* ```JavaScript
|
||||
* [
|
||||
* {
|
||||
* crt: [X509Cert object],
|
||||
* key: [PKey object]
|
||||
* },
|
||||
* {
|
||||
* crt: [X509Cert object],
|
||||
* key: [PKey object]
|
||||
* }
|
||||
* ]
|
||||
* ```
|
||||
* @param certs 服务器证书列表
|
||||
* @param addr 指定 http 服务器侦听地址,为 "" 则在本机所有地址侦听
|
||||
* @param port 指定 http 服务器侦听端口
|
||||
* @param hdlr http 内置消息处理器,处理函数,链式处理数组,路由对象,详见
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(certs: any[], addr: string, port: number, hdlr: Class_Handler);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief HttpsServer 构造函数,在所有本机地址侦听
|
||||
* @param crt X509Cert 证书,用于客户端验证服务器
|
||||
* @param key PKey 私钥,用于与客户端会话
|
||||
* @param port 指定 http 服务器侦听端口
|
||||
* @param hdlr http 内置消息处理器,处理函数,链式处理数组,路由对象,详见
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(crt: Class_X509Cert, key: Class_PKey, port: number, hdlr: Class_Handler);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief HttpsServer 构造函数
|
||||
* @param crt X509Cert 证书,用于客户端验证服务器
|
||||
* @param key PKey 私钥,用于与客户端会话
|
||||
* @param addr 指定 http 服务器侦听地址,为 "" 则在本机所有地址侦听
|
||||
* @param port 指定 http 服务器侦听端口
|
||||
* @param hdlr http 内置消息处理器,处理函数,链式处理数组,路由对象,详见
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(crt: Class_X509Cert, key: Class_PKey, addr: string, port: number, hdlr: Class_Handler);
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+856
@@ -0,0 +1,856 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 图像处理对象,用以对图像进行转换,绘制,存储等操作
|
||||
* @detail Image 对象属于 gd 模块,创建:,```JavaScript,var img = gd.create(640, 480);,var img1 = gd.load(data);,```
|
||||
*/
|
||||
|
||||
declare class Class_Image extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询图像宽度
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
width: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询图像高度
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
height: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询图像来源格式,结果为 gd.PNG, gd.JPEG, gd.GIF, gd.BMP, gd.WEBP
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
format: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询图像类型,结果为 gd.TRUECOLOR, gd.PALETTE
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
type: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询图像颜色表内的颜色总数
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
colorsTotal: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设定指定的颜色为透明色
|
||||
*
|
||||
*
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
transparent: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设定图像是否渐进式,仅支持 jpeg 格式时
|
||||
*
|
||||
*
|
||||
* @type Boolean
|
||||
*/
|
||||
|
||||
progressive: boolean
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief查询和设定绘图时是否计算 alpha 层,缺省为 true
|
||||
*
|
||||
*
|
||||
* @type Boolean
|
||||
*/
|
||||
|
||||
alphaBlending: boolean
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 按照指定的格式返回图像数据
|
||||
* @param format 指定返回数据的格式,允许值为 gd.PNG, gd.JPEG, gd.GIF, gd.BMP, gd.WEBP, 缺省为 gd.PNG
|
||||
* @param quality 当格式为 gd.JPEG 或 gd.WEBP 时用于指定压缩质量,缺省为 85,其他格式忽略此参数
|
||||
* @return 返回格式化的数据
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
getData(format?: number/** = undefined*/, quality?: number/** = 85*/): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 按照指定的格式将图像数据存入流对象
|
||||
* @param stm 指定要存入的流对象
|
||||
* @param format 指定返回数据的格式,允许值为 gd.PNG, gd.JPEG, gd.GIF, gd.BMP, gd.WEBP, 缺省为 gd.PNG
|
||||
* @param quality 当格式为 gd.JPEG 或 gd.WEBP 时用于指定压缩质量,缺省为 85,其他格式忽略此参数
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
save(stm: Class_Stream, format?: number/** = undefined*/, quality?: number/** = 85*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 按照指定的格式将图像数据存入指定文件,文件将被强制覆盖
|
||||
* @param fname 指定文件名
|
||||
* @param format 指定返回数据的格式,允许值为 gd.PNG, gd.JPEG, gd.GIF, gd.BMP, gd.WEBP, 缺省为 gd.PNG
|
||||
* @param quality 当格式为 gd.JPEG 时用于指定压缩质量,缺省为 85,其他格式忽略此参数
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
save(fname: string, format?: number/** = undefined*/, quality?: number/** = 85*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 为指定的颜色申请一个颜色号,对于 gd.PALETTE 图像,颜色号为调色板索引,对于 gd.TRUECOLOR 图像,颜色号为 rgb 编码数值
|
||||
* @param red 红色分量,范围为 0-255
|
||||
* @param green 绿色分量,范围为 0-255
|
||||
* @param blue 蓝色分量,范围为 0-255
|
||||
* @return 返回颜色号,不成功返回 -1
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
colorAllocate(red: number, green: number, blue: number): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 为指定的颜色申请一个颜色号,对于 gd.PALETTE 图像,颜色号为调色板索引,对于 gd.TRUECOLOR 图像,颜色号为 rgb 编码数值
|
||||
* @param color 组合颜色值,可由 gd.color, gb.rgb, gd.rgba 等函数生成
|
||||
* @return 返回颜色号,不成功返回 -1
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
colorAllocate(color: number): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 为指定的颜色及透明申请一个颜色号,对于 gd.PALETTE 图像,颜色号为调色板索引,对于 gd.TRUECOLOR 图像,颜色号为 rgba 编码数值
|
||||
* @param red 红色分量,范围为 0-255
|
||||
* @param green 绿色分量,范围为 0-255
|
||||
* @param blue 蓝色分量,范围为 0-255
|
||||
* @param alpha 透明分量,范围为 0-1.0
|
||||
* @return 返回颜色号,不成功返回 -1
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
colorAllocateAlpha(red: number, green: number, blue: number, alpha: number): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 为指定的颜色及透明申请一个颜色号,对于 gd.PALETTE 图像,颜色号为调色板索引,对于 gd.TRUECOLOR 图像,颜色号为 rgba 编码数值
|
||||
* @param color 组合颜色值,可由 gd.color, gb.rgb, gd.rgba 等函数生成
|
||||
* @return 返回颜色号,不成功返回 -1
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
colorAllocateAlpha(color: number): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 为指定的颜色查找一个最接近的颜色号,对于 gd.PALETTE 图像,颜色号为调色板索引,对于 gd.TRUECOLOR 图像,颜色号为 rgb 编码数值
|
||||
* @param red 红色分量,范围为 0-255
|
||||
* @param green 绿色分量,范围为 0-255
|
||||
* @param blue 蓝色分量,范围为 0-255
|
||||
* @return 返回颜色号,不成功返回 -1
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
colorClosest(red: number, green: number, blue: number): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 为指定的颜色查找一个最接近的颜色号,对于 gd.PALETTE 图像,颜色号为调色板索引,对于 gd.TRUECOLOR 图像,颜色号为 rgb 编码数值
|
||||
* @param color 组合颜色值,可由 gd.color, gb.rgb, gd.rgba 等函数生成
|
||||
* @return 返回颜色号,不成功返回 -1
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
colorClosest(color: number): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 为指定的颜色查找一个最接近的颜色号,此方法使用 Hue/White/Black 计算查找最接近颜色,对于 gd.PALETTE 图像,颜色号为调色板索引,对于 gd.TRUECOLOR 图像,颜色号为 rgb 编码数值
|
||||
* @param red 红色分量,范围为 0-255
|
||||
* @param green 绿色分量,范围为 0-255
|
||||
* @param blue 蓝色分量,范围为 0-255
|
||||
* @return 返回颜色号,不成功返回 -1
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
colorClosestHWB(red: number, green: number, blue: number): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 为指定的颜色查找一个最接近的颜色号,此方法使用 Hue/White/Black 计算查找最接近颜色,对于 gd.PALETTE 图像,颜色号为调色板索引,对于 gd.TRUECOLOR 图像,颜色号为 rgb 编码数值
|
||||
* @param color 组合颜色值,可由 gd.color, gb.rgb, gd.rgba 等函数生成
|
||||
* @return 返回颜色号,不成功返回 -1
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
colorClosestHWB(color: number): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 为指定的颜色及透明查找一个最接近的颜色号,对于 gd.PALETTE 图像,颜色号为调色板索引,对于 gd.TRUECOLOR 图像,颜色号为 rgba 编码数值
|
||||
* @param red 红色分量,范围为 0-255
|
||||
* @param green 绿色分量,范围为 0-255
|
||||
* @param blue 蓝色分量,范围为 0-255
|
||||
* @param alpha 透明分量,范围为 0-1.0
|
||||
* @return 返回颜色号,不成功返回 -1
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
colorClosestAlpha(red: number, green: number, blue: number, alpha: number): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 为指定的颜色及透明查找一个最接近的颜色号,对于 gd.PALETTE 图像,颜色号为调色板索引,对于 gd.TRUECOLOR 图像,颜色号为 rgba 编码数值
|
||||
* @param color 组合颜色值,可由 gd.color, gb.rgb, gd.rgba 等函数生成
|
||||
* @return 返回颜色号,不成功返回 -1
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
colorClosestAlpha(color: number): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查找指定的颜色对应的颜色号,对于 gd.PALETTE 图像,颜色号为调色板索引,对于 gd.TRUECOLOR 图像,颜色号为 rgb 编码数值
|
||||
* @param red 红色分量,范围为 0-255
|
||||
* @param green 绿色分量,范围为 0-255
|
||||
* @param blue 蓝色分量,范围为 0-255
|
||||
* @return 返回颜色号,不成功返回 -1
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
colorExact(red: number, green: number, blue: number): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查找指定的颜色对应的颜色号,对于 gd.PALETTE 图像,颜色号为调色板索引,对于 gd.TRUECOLOR 图像,颜色号为 rgb 编码数值
|
||||
* @param color 组合颜色值,可由 gd.color, gb.rgb, gd.rgba 等函数生成
|
||||
* @return 返回颜色号,不成功返回 -1
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
colorExact(color: number): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查找指定的颜色及透明对应的颜色号,对于 gd.PALETTE 图像,颜色号为调色板索引,对于 gd.TRUECOLOR 图像,颜色号为 rgba 编码数值
|
||||
* @param red 红色分量,范围为 0-255
|
||||
* @param green 绿色分量,范围为 0-255
|
||||
* @param blue 蓝色分量,范围为 0-255
|
||||
* @param alpha 透明分量,范围为 0-1.0
|
||||
* @return 返回颜色号,不成功返回 -1
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
colorExactAlpha(red: number, green: number, blue: number, alpha: number): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查找指定的颜色及透明对应的颜色号,对于 gd.PALETTE 图像,颜色号为调色板索引,对于 gd.TRUECOLOR 图像,颜色号为 rgba 编码数值
|
||||
* @param color 组合颜色值,可由 gd.color, gb.rgb, gd.rgba 等函数生成
|
||||
* @return 返回颜色号,不成功返回 -1
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
colorExactAlpha(color: number): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查找指定的颜色对应的颜色号,如果颜色不存在,则为其申请一个新颜色号,对于 gd.PALETTE 图像,颜色号为调色板索引,对于 gd.TRUECOLOR 图像,颜色号为 rgb 编码数值
|
||||
* @param red 红色分量,范围为 0-255
|
||||
* @param green 绿色分量,范围为 0-255
|
||||
* @param blue 蓝色分量,范围为 0-255
|
||||
* @return 返回颜色号,不成功返回 -1
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
colorResolve(red: number, green: number, blue: number): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查找指定的颜色对应的颜色号,如果颜色不存在,则为其申请一个新颜色号,对于 gd.PALETTE 图像,颜色号为调色板索引,对于 gd.TRUECOLOR 图像,颜色号为 rgb 编码数值
|
||||
* @param color 组合颜色值,可由 gd.color, gb.rgb, gd.rgba 等函数生成
|
||||
* @return 返回颜色号,不成功返回 -1
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
colorResolve(color: number): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查找指定的颜色及透明对应的颜色号,如果颜色不存在,则为其申请一个新颜色号,对于 gd.PALETTE 图像,颜色号为调色板索引,对于 gd.TRUECOLOR 图像,颜色号为 rgba 编码数值
|
||||
* @param red 红色分量,范围为 0-255
|
||||
* @param green 绿色分量,范围为 0-255
|
||||
* @param blue 蓝色分量,范围为 0-255
|
||||
* @param alpha 透明分量,范围为 0-1.0
|
||||
* @return 返回颜色号,不成功返回 -1
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
colorResolveAlpha(red: number, green: number, blue: number, alpha: number): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查找指定的颜色及透明对应的颜色号,如果颜色不存在,则为其申请一个新颜色号,对于 gd.PALETTE 图像,颜色号为调色板索引,对于 gd.TRUECOLOR 图像,颜色号为 rgba 编码数值
|
||||
* @param color 组合颜色值,可由 gd.color, gb.rgb, gd.rgba 等函数生成
|
||||
* @return 返回颜色号,不成功返回 -1
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
colorResolveAlpha(color: number): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 释放指定的颜色号,释放的颜色号将会被再次申请后替换
|
||||
* @param color 指定要释放的颜色号
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
colorDeallocate(color: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 设定绘图的剪切窗口,设定后,所有的绘制将被剪切在窗口内部
|
||||
* @param x1 剪切窗口的左上 x 坐标
|
||||
* @param y1 剪切窗口的左上 y 坐标
|
||||
* @param x2 剪切窗口的右下 x 坐标
|
||||
* @param y2 剪切窗口的右下 y 坐标
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
clip(x1: number, y1: number, x2: number, y2: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询指定位置点的颜色
|
||||
* @param x 指定查询的 x 坐标
|
||||
* @param y 指定查询的 y 坐标
|
||||
* @return 返回指定点的颜色号
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
getPixel(x: number, y: number): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询指定位置点的真彩色颜色
|
||||
* @param x 指定查询的 x 坐标
|
||||
* @param y 指定查询的 y 坐标
|
||||
* @return 返回指定点的颜色号
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
getTrueColorPixel(x: number, y: number): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 在指定位置画一个点
|
||||
* @param x 指定画点的 x 坐标
|
||||
* @param y 指定画点的 y 坐标
|
||||
* @param color 指定画点的颜色号
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
setPixel(x: number, y: number, color: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 设定画线的宽度,line, rectangle, arc 等方法画线时缺省宽度为一个像素,可使用此方法改变线的宽度
|
||||
* @param thickness 画线的宽度
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
setThickness(thickness: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 在指定的位置画一条线
|
||||
* @param x1 指定画线的起始 x 坐标
|
||||
* @param y1 指定画线的起始 y 坐标
|
||||
* @param x2 指定画线的结束 x 坐标
|
||||
* @param y2 指定画线的结束 y 坐标
|
||||
* @param color 指定画线的颜色号
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
line(x1: number, y1: number, x2: number, y2: number, color: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 在指定的位置画一个矩形
|
||||
* @param x1 指定左上角 x 坐标
|
||||
* @param y1 指定左上角 y 坐标
|
||||
* @param x2 指定右下角 x 坐标
|
||||
* @param y2 指定右下角 y 坐标
|
||||
* @param color 指定矩形的颜色号
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
rectangle(x1: number, y1: number, x2: number, y2: number, color: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 在指定的位置画一个填充的矩形
|
||||
* @param x1 指定左上角 x 坐标
|
||||
* @param y1 指定左上角 y 坐标
|
||||
* @param x2 指定右下角 x 坐标
|
||||
* @param y2 指定右下角 y 坐标
|
||||
* @param color 指定矩形的颜色号
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
filledRectangle(x1: number, y1: number, x2: number, y2: number, color: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 根据给定的点绘制一个多边形
|
||||
* @param points 包含多边形点的数组,如 [[1, 1], [1, 10], [10, 15], [10, 20]]
|
||||
* @param color 指定矩形的颜色号
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
polygon(points: any[], color: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 根据给定的点绘制一个开放多边形
|
||||
* @param points 包含多边形点的数组,如 [[1, 1], [1, 10], [10, 15], [10, 20]]
|
||||
* @param color 指定矩形的颜色号
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
openPolygon(points: any[], color: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 根据给定的点绘制一个填充多边形
|
||||
* @param points 包含多边形点的数组,如 [[1, 1], [1, 10], [10, 15], [10, 20]]
|
||||
* @param color 指定矩形的颜色号
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
filledPolygon(points: any[], color: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 画一个椭圆
|
||||
* @param x 椭圆中心的 x 坐标
|
||||
* @param y 椭圆中心的 y 坐标
|
||||
* @param width 椭圆的宽度
|
||||
* @param height 椭圆的高度
|
||||
* @param color 指定矩形的颜色号
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
ellipse(x: number, y: number, width: number, height: number, color: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 画一个填充的椭圆
|
||||
* @param x 椭圆中心的 x 坐标
|
||||
* @param y 椭圆中心的 y 坐标
|
||||
* @param width 椭圆的宽度
|
||||
* @param height 椭圆的高度
|
||||
* @param color 指定矩形的颜色号
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
filledEllipse(x: number, y: number, width: number, height: number, color: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 画一个扇形
|
||||
* @param x 扇形中心的 x 坐标
|
||||
* @param y 扇形中心的 y 坐标
|
||||
* @param width 扇形所在椭圆的宽度
|
||||
* @param height 扇形所在椭圆的高度
|
||||
* @param start 扇形开始的角度,范围为 0-360
|
||||
* @param end 扇形结束的角度,范围为 0-360
|
||||
* @param color 指定矩形的颜色号
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
arc(x: number, y: number, width: number, height: number, start: number, end: number, color: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 画一个填充扇形
|
||||
* @param x 扇形中心的 x 坐标
|
||||
* @param y 扇形中心的 y 坐标
|
||||
* @param width 扇形所在椭圆的宽度
|
||||
* @param height 扇形所在椭圆的高度
|
||||
* @param start 扇形开始的角度,范围为 0-360
|
||||
* @param end 扇形结束的角度,范围为 0-360
|
||||
* @param color 指定矩形的颜色号
|
||||
* @param style 指定扇形的样式,允许的值有 gd.ARC, gd.CHORD, gd.NOFILL, gd.EDGED 及其组合
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
filledArc(x: number, y: number, width: number, height: number, start: number, end: number, color: number, style?: number/** = undefined*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 从指定的点开始填充封闭区域
|
||||
* @param x 开始填充的 x 坐标
|
||||
* @param y 开始填充的 y 坐标
|
||||
* @param color 指定填充的颜色号
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
fill(x: number, y: number, color: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 从指定的点开始在指定颜色的边框内填充封闭区域
|
||||
* @param x 开始填充的 x 坐标
|
||||
* @param y 开始填充的 y 坐标
|
||||
* @param borderColor 指定边框的颜色号
|
||||
* @param color 指定填充的颜色号
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
fillToBorder(x: number, y: number, borderColor: number, color: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 替换图像中指定的颜色为新颜色
|
||||
* @param src 指定要替换的颜色
|
||||
* @param dst 指定新颜色
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
colorReplace(src: number, dst: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 复制当前图像为一个新图像
|
||||
* @return 返回复制的新图像对象
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
clone(): Class_Image;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 根据图像拉伸生成一个新尺寸的图像
|
||||
* @param width 指定拉伸的宽度
|
||||
* @param height 指定拉伸的高度
|
||||
* @return 返回新图像对象
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
resample(width: number, height: number): Class_Image;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 剪切图像的一部分为一个新的图像
|
||||
* @param x 剪切窗口的左上 x 坐标
|
||||
* @param y 剪切窗口的左上 y 坐标
|
||||
* @param width 剪切窗口的宽度
|
||||
* @param height 剪切窗口的高度
|
||||
* @return 返回剪切出的图像
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
crop(x: number, y: number, width: number, height: number): Class_Image;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 镜像当前图像
|
||||
* @param dir 镜像方向,允许值为 gd.BOTH,gd.HORIZONTAL, gd.VERTICAL, 缺省为 gd.HORIZONTAL
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
flip(dir?: number/** = undefined*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 旋转当前图像
|
||||
* @param dir 旋转方向,允许值为 gd.LEFT, gd.RIGHT
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
rotate(dir: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 转换当前图像类型
|
||||
* @param color 指定图像类型,允许值为 gd.TRUECOLOR 或 gd.PALETTE
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
convert(color?: number/** = undefined*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 从一个图像中复制一个区域到指定的位置
|
||||
* @param source 源图像对象
|
||||
* @param dstX 指定复制目标的 x 坐标
|
||||
* @param dstY 指定复制目标的 y 坐标
|
||||
* @param srcX 指定复制源左上角的 x 坐标
|
||||
* @param srcY 指定复制源左上角的 y 坐标
|
||||
* @param width 指定复制的宽度
|
||||
* @param height 指定复制的高度
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
copy(source: Class_Image, dstX: number, dstY: number, srcX: number, srcY: number, width: number, height: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 从一个图像中复制一个区域覆盖到指定的位置
|
||||
* @param source 源图像对象
|
||||
* @param dstX 指定复制目标的 x 坐标
|
||||
* @param dstY 指定复制目标的 y 坐标
|
||||
* @param srcX 指定复制源左上角的 x 坐标
|
||||
* @param srcY 指定复制源左上角的 y 坐标
|
||||
* @param width 指定复制的宽度
|
||||
* @param height 指定复制的高度
|
||||
* @param percent 指定覆盖的透明度
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
copyMerge(source: Class_Image, dstX: number, dstY: number, srcX: number, srcY: number, width: number, height: number, percent: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 从一个图像中复制一个区域的灰度覆盖到指定的位置
|
||||
* @param source 源图像对象
|
||||
* @param dstX 指定复制目标的 x 坐标
|
||||
* @param dstY 指定复制目标的 y 坐标
|
||||
* @param srcX 指定复制源左上角的 x 坐标
|
||||
* @param srcY 指定复制源左上角的 y 坐标
|
||||
* @param width 指定复制的宽度
|
||||
* @param height 指定复制的高度
|
||||
* @param percent 指定覆盖的透明度
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
copyMergeGray(source: Class_Image, dstX: number, dstY: number, srcX: number, srcY: number, width: number, height: number, percent: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将一个图像中的一个区域拉伸后复制到指定的位置
|
||||
* @param source 源图像对象
|
||||
* @param dstX 指定复制目标的 x 坐标
|
||||
* @param dstY 指定复制目标的 y 坐标
|
||||
* @param srcX 指定复制源左上角的 x 坐标
|
||||
* @param srcY 指定复制源左上角的 y 坐标
|
||||
* @param dstW 指定复制的拉伸宽度
|
||||
* @param dstH 指定复制的拉伸高度
|
||||
* @param srcW 指定复制的源宽度
|
||||
* @param srcH 指定复制的源高度
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
copyResized(source: Class_Image, dstX: number, dstY: number, srcX: number, srcY: number, dstW: number, dstH: number, srcW: number, srcH: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将一个图像中的一个区域拉伸后复制到指定的位置,不同与 copyResized,此方法拉伸时会对图像进行抖动
|
||||
* @param source 源图像对象
|
||||
* @param dstX 指定复制目标的 x 坐标
|
||||
* @param dstY 指定复制目标的 y 坐标
|
||||
* @param srcX 指定复制源左上角的 x 坐标
|
||||
* @param srcY 指定复制源左上角的 y 坐标
|
||||
* @param dstW 指定复制的拉伸宽度
|
||||
* @param dstH 指定复制的拉伸高度
|
||||
* @param srcW 指定复制的源宽度
|
||||
* @param srcH 指定复制的源高度
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
copyResampled(source: Class_Image, dstX: number, dstY: number, srcX: number, srcY: number, dstW: number, dstH: number, srcW: number, srcH: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将一个图像中的一个区域旋转后复制到指定的位置
|
||||
* @param source 源图像对象
|
||||
* @param dstX 指定复制目标的 x 坐标
|
||||
* @param dstY 指定复制目标的 y 坐标
|
||||
* @param srcX 指定复制源左上角的 x 坐标
|
||||
* @param srcY 指定复制源左上角的 y 坐标
|
||||
* @param width 指定复制的宽度
|
||||
* @param height 指定复制的高度
|
||||
* @param angle 指定旋转的角度
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
copyRotated(source: Class_Image, dstX: number, dstY: number, srcX: number, srcY: number, width: number, height: number, angle: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 把过滤器 filterType应用到图像上,根据过滤器类型传入所需参数
|
||||
*
|
||||
* 参数 filterType 可以为以下数值:
|
||||
* - MEAN_REMOVAL, 用平均移除法来达到轮廓效果
|
||||
* - EDGEDETECT, 用边缘检测来突出图像的边缘
|
||||
* - EMBOSS, 使图像浮雕化
|
||||
* - SELECTIVE_BLUR, 模糊图像
|
||||
* - GAUSSIAN_BLUR, 用高斯算法模糊图像
|
||||
* - NEGATE, 将图像中所有颜色反转
|
||||
* - GRAYSCALE, 将图像转换为灰度图
|
||||
* - SMOOTH, 使图像更柔滑,用arg1设定柔滑级别
|
||||
* - BRIGHTNESS, 改变图像的亮度,用arg1设定亮度级别,取值范围是-255~255
|
||||
* - CONTRAST, 改变图像的对比度,用arg1设定对比度级别,取值范围是0~100
|
||||
* - COLORIZE, 改变图像的色调,用arg1、arg2、arg3分别指定red、blue、green分值,每种颜色范围是0~255,arg4为透明度,取值返回是0~127
|
||||
* @param filterType 过滤器类型
|
||||
* @param arg1 过滤器所需参数: SMOOTH 的平滑级别、BRIGHTNESS 的亮度级别、CONTRAST 的对比度级别、COLORIZE 的 red 分值
|
||||
* @param arg2 过滤器所需参数: COLORIZE 的 green 分值
|
||||
* @param arg3 过滤器所需参数: COLORIZE 的 blue 分值
|
||||
* @param arg4 过滤器所需参数: COLORIZE 的透明度 alpha 分值
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
filter(filterType: number, arg1?: number/** = 0*/, arg2?: number/** = 0*/, arg3?: number/** = 0*/, arg4?: number/** = 0*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 根据给定的矩阵,对当前图像进行仿射
|
||||
*
|
||||
* 参数 affine 是一个数组:
|
||||
* ```JavaScript
|
||||
* affine = [ a0, a1, b0, b1, a2, b2 ];
|
||||
* x' = a0x + a1y + a2;
|
||||
* y' = b0x + b1y + b2;
|
||||
* ```
|
||||
* @param affine 仿射矩阵,由 6 个 double 类型的数字组成
|
||||
* @param x 可选剪切区域的原点 x 坐标
|
||||
* @param y 可选剪切区域的原点 y 坐标
|
||||
* @param width 可选剪切区域的的宽度
|
||||
* @param height 可选剪切区域的的高度
|
||||
* @return 返回仿射后的图像
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
affine(affine: any[], x?: number/** = -1*/, y?: number/** = -1*/, width?: number/** = -1*/, height?: number/** = -1*/): Class_Image;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 对当前图像进行高斯模糊处理
|
||||
* @param radius 模糊半径
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
gaussianBlur(radius: number): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+241
@@ -0,0 +1,241 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 64位整数对象
|
||||
* @detail 创建方法:,```JavaScript,var n = new Int64(123);,```
|
||||
*/
|
||||
|
||||
declare class Class_Int64 extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 高 32 位数值
|
||||
*
|
||||
*
|
||||
* @type Long
|
||||
*/
|
||||
|
||||
hi: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 低 32 位数值
|
||||
*
|
||||
*
|
||||
* @type Long
|
||||
*/
|
||||
|
||||
lo: number
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Int64 构造函数
|
||||
* @param num 初始化的值
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(num?: number/** = 0*/);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Int64 构造函数
|
||||
* @param hi 高32位数
|
||||
* @param lo 低32位数
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(hi: number, lo: number);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Int64 构造函数
|
||||
* @param num 初始化的值
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(num: Class_Int64);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Int64 构造函数
|
||||
* @param num 数字字符串
|
||||
* @param base 数字字符串的编码方式,可以接受 2-16, 32, 64,默认为 10,为 10 时自动识别 0x 编码
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(num: string, base?: number/** = 10*/);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将 Int64 内的数值与给定数值比较大小
|
||||
* @param num 指定比较的数值
|
||||
* @return 返回 1 表示 Int64 内的数值比指定数值更大,0 表示相等,-1 表示更小
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
compare(num: Class_Int64): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将 Int64 内的数值左移相应的位数,此操作不影响 Int64 原有数值
|
||||
* @param bits 指定移动的位数
|
||||
* @return 返回包含移位以后数值的对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
shiftLeft(bits: number): Class_Int64;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将 Int64 内的数值右移相应的位数,此操作不影响 Int64 原有数值
|
||||
* @param bits 指定移动的位数
|
||||
* @return 返回包含移位以后数值的对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
shiftRight(bits: number): Class_Int64;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将 Int64 内的数值与给定的数值进行按位 and 操作,此操作不影响 Int64 原有数值
|
||||
* @param num 指定运算的数值
|
||||
* @return 返回包含预算以后数值的对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
and(num: Class_Int64): Class_Int64;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将 Int64 内的数值与给定的数值进行按位 or 操作,此操作不影响 Int64 原有数值
|
||||
* @param num 指定运算的数值
|
||||
* @return 返回包含预算以后数值的对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
or(num: Class_Int64): Class_Int64;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将 Int64 内的数值与给定的数值进行按位 xor 操作,此操作不影响 Int64 原有数值
|
||||
* @param num 指定运算的数值
|
||||
* @return 返回包含预算以后数值的对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
xor(num: Class_Int64): Class_Int64;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将 Int64 内的数值与给定的数值进行加操作,此操作不影响 Int64 原有数值
|
||||
* @param num 指定运算的数值
|
||||
* @return 返回包含预算以后数值的对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
add(num: Class_Int64): Class_Int64;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将 Int64 内的数值与给定的数值进行减操作,此操作不影响 Int64 原有数值
|
||||
* @param num 指定运算的数值
|
||||
* @return 返回包含预算以后数值的对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
sub(num: Class_Int64): Class_Int64;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将 Int64 内的数值与给定的数值进行乘操作,此操作不影响 Int64 原有数值
|
||||
* @param num 指定运算的数值
|
||||
* @return 返回包含预算以后数值的对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
multi(num: Class_Int64): Class_Int64;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将 Int64 内的数值与给定的数值进行除操作,此操作不影响 Int64 原有数值
|
||||
* @param num 指定运算的数值
|
||||
* @return 返回包含预算以后数值的对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
div(num: Class_Int64): Class_Int64;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 比较当前对象与给定的对象是否相等
|
||||
* @param expected 制定比较的目标对象
|
||||
* @return 返回对象比较的结果
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
equals(expected: Class__object): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 转换成数字类型
|
||||
* @return 返回转换后的数字
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
toNumber(): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 转换成字符串类型
|
||||
* @param base 字符串进制数,可以接受 2-16, 32, 64,默认为 10
|
||||
* @return 返回转换后的字符串
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
toString(base?: number/** = 10*/): string;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+176
@@ -0,0 +1,176 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief LevelDB 数据库对象
|
||||
* @detail 用以创建和管理字典对象,创建方法:,```JavaScript,var db = require("db");,var test = new db.openLevelDB("test.db");,```
|
||||
*/
|
||||
|
||||
declare class Class_LevelDB extends Class__object {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 检查数据库内是否存在指定键值的数据
|
||||
* @param key 指定要检查的键值
|
||||
* @return 返回键值是否存在
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
has(key: Class_Buffer): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询指定键值的值
|
||||
* @param key 指定要查询的键值
|
||||
* @return 返回键值所对应的值,若不存在,则返回 null
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
get(key: Class_Buffer): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询一组指定键值的值
|
||||
* @param keys 指定要查询的键值数组
|
||||
* @return 返回包含键值得数组
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
mget(keys: any[]): any[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 设定一个键值数据,键值不存在则插入新数据
|
||||
* @param key 指定要设定的键值
|
||||
* @param value 指定要设定的数据
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
set(key: Class_Buffer, value: Class_Buffer): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 设定一组键值数据,键值不存在则插入新数据
|
||||
* @param map 指定要设定的键值数据字典
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
mset(map: Object): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 删除一组指定键值的值
|
||||
* @param keys 指定要删除的键值数组
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
mremove(keys: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 删除指定键值的全部值
|
||||
* @param key 指定要删除的键值
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
remove(key: Class_Buffer): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 枚举数据库中所有的键值对
|
||||
*
|
||||
* 回调函数有两个参数,(value, key)
|
||||
*
|
||||
* ```JavaScript
|
||||
* var db = require("db");
|
||||
* var test = new db.openLevelDB("test.db");
|
||||
*
|
||||
* test.forEach(function(value, key){
|
||||
* ...
|
||||
* });
|
||||
* ```
|
||||
* @param func 枚举回调函数
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
forEach(func: Function): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 枚举数据库中键值在 from 和 to 之间的键值对
|
||||
*
|
||||
* 回调函数有两个参数,(value, key)
|
||||
*
|
||||
* ```JavaScript
|
||||
* var db = require("db");
|
||||
* var test = new db.openLevelDB("test.db");
|
||||
*
|
||||
* test.between("aaa", "bbb", function(value, key){
|
||||
* ...
|
||||
* });
|
||||
* ```
|
||||
* @param from 枚举的最小键值,枚举时包含此键值
|
||||
* @param to 枚举的最大键值,枚举时不包含此键值
|
||||
* @param func 枚举回调函数
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
between(from: Class_Buffer, to: Class_Buffer, func: Function): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 在当前数据库上开启一个事务
|
||||
* @return 返回一个开启的事务对象
|
||||
*
|
||||
*
|
||||
*/
|
||||
begin(): Class_LevelDB;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 提交当前事务
|
||||
*
|
||||
*
|
||||
*/
|
||||
commit(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 关闭当前数据库连接或事务
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
close(): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+79
@@ -0,0 +1,79 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 纤程锁对象
|
||||
* @detail 不同于操作系统的锁,纤程锁是纯逻辑实现,加锁与解锁负荷很小,```JavaScript,var l = new coroutine.Lock();,l.acquire();,.....,l.release();,```
|
||||
*/
|
||||
|
||||
declare class Class_Lock extends Class__object {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 构造函数
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor();
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 获取锁的拥有权
|
||||
*
|
||||
* acquire 方法用于获取锁的拥有权,当锁处于可获取状态时,此方法立即返回 true。
|
||||
*
|
||||
* 当锁不可获取,且 blocking 为 true,则当前纤程进入休眠,当其他纤程释放锁后,此方法返回 true。
|
||||
*
|
||||
* 当锁不可获取,且 blocking 为 false,则方法返回 false。
|
||||
* @param blocking 指定是否等待,为 true 时等待,缺省为真
|
||||
* @return 返回是否成功获取锁,为 true 表示成功获取
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
acquire(blocking?: boolean/** = true*/): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 释放锁的拥有权
|
||||
*
|
||||
* 此方法将释放对锁的拥有权,如果当前纤程未拥有锁,此方法将抛出错误。
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
release(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询当前等待任务数
|
||||
* @return 返回任务数
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
count(): number;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+163
@@ -0,0 +1,163 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief LRU(least recently used) 缓存对象
|
||||
* @detail LruCache 用以维护一个 LRU 缓存,创建方法:,```JavaScript,var util = require("util");,var c = new util.LruCache(10, 100);,```
|
||||
*/
|
||||
/// <reference path="EventEmitter.d.ts" />
|
||||
declare class Class_LruCache extends Class_EventEmitter {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询容器内数值个数
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
size: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置容器内元素失效时间,单位是 ms,小于等于 0 不失效
|
||||
*
|
||||
*
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
timeout: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和绑定数据超时事件,相当于 on("expire", func);
|
||||
*
|
||||
*
|
||||
* @type Function
|
||||
*/
|
||||
|
||||
onexpire: Function
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief LruCache 对象构造函数
|
||||
* @param size 缓存最大尺寸
|
||||
* @param timeout 元素失效时间,单位是 ms,小于等于 0 不失效,缺省为 0
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(size: number, timeout?: number/** = 0*/);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 清除容器数据
|
||||
*
|
||||
*
|
||||
*/
|
||||
clear(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 检查容器内是否存在指定键值的数据
|
||||
* @param name 指定要检查的键值
|
||||
* @return 返回键值是否存在
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
has(name: string): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询指定键值的值
|
||||
* @param name 指定要查询的键值
|
||||
* @return 返回键值所对应的值,若不存在,则返回 undefined
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
get(name: string): any;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询指定键值的值,若不存在或过期,则调用回调函数更新数据
|
||||
* @param name 指定要查询的键值
|
||||
* @param updater 指定更新函数
|
||||
* @return 返回键值所对应的值
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
get(name: string, updater: Function): any;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 设定一个键值数据,键值不存在则插入一条新数据
|
||||
* @param name 指定要设定的键值
|
||||
* @param value 指定要设定的数据
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
set(name: string, value: any): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 设定一个键值数据,键值不存在则插入新数据
|
||||
* @param map 指定要设定的键值数据字典
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
set(map: Object): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 删除指定键值的全部值
|
||||
* @param name 指定要删除的键值
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
remove(name: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 检查容器是否为空
|
||||
* @return 容器内无数值则返回 true
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
isEmpty(): boolean;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+43
@@ -0,0 +1,43 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief SQL Server 数据库连接对象
|
||||
* @detail 使用 db.open 或 db.openMySQL 创建,创建方式:,```JavaScript,var sql = db.openMSSQL("mssql://user:pass@host/db");,```
|
||||
*/
|
||||
/// <reference path="DbConnection.d.ts" />
|
||||
declare class Class_MSSQL extends Class_DbConnection {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 选择当前数据库连接的缺省数据库
|
||||
* @param dbName 指定数据库名
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
use(dbName: string): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 内存流对象
|
||||
* @detail MemoryStream 对象创建一个基于内存的流对象,创建方法:,```JavaScript,var ms = new io.MemoryStream();,```
|
||||
*/
|
||||
/// <reference path="SeekableStream.d.ts" />
|
||||
declare class Class_MemoryStream extends Class_SeekableStream {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief MemoryStream 构造函数
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor();
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 强制设定内存流对象的最后更新时间
|
||||
* @param d 指定要设定的时间
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
setTime(d: Date): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 创建当前内存流的一个只读副本
|
||||
* @return 返回只读的内存流对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
clone(): Class_MemoryStream;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 清空内存文件数据,复位指针
|
||||
*
|
||||
*
|
||||
*/
|
||||
clear(): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+235
@@ -0,0 +1,235 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 基础消息对象
|
||||
* @detail Message 对象兼容于 mq 各个模块,可用于构建自定义消息处理系统,创建方法:,```JavaScript,var mq = require("mq");,var m = new mq.Message();,```
|
||||
*/
|
||||
|
||||
declare class Class_Message extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 消息的基本内容
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
value: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 消息的基本参数
|
||||
*
|
||||
* @readonly
|
||||
* @type NArray
|
||||
*/
|
||||
|
||||
params: any[]
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 消息类型
|
||||
*
|
||||
*
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
type: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询消息的数据
|
||||
*
|
||||
* @readonly
|
||||
* @type Value
|
||||
*/
|
||||
|
||||
data: any
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 包含消息数据部分的流对象
|
||||
*
|
||||
*
|
||||
* @type SeekableStream
|
||||
*/
|
||||
|
||||
body: Class_SeekableStream
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 消息数据部分的长度
|
||||
*
|
||||
* @readonly
|
||||
* @type Long
|
||||
*/
|
||||
|
||||
length: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询消息 readFrom 时的流对象
|
||||
*
|
||||
* @readonly
|
||||
* @type Stream
|
||||
*/
|
||||
|
||||
stream: Class_Stream
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置消息处理的最后错误
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
lastError: string
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 消息对象构造函数
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor();
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 从流内读取指定大小的数据,此方法为 body 相应方法的别名
|
||||
* @param bytes 指定要读取的数据量,缺省为读取随机大小的数据块,读出的数据尺寸取决于设备
|
||||
* @return 返回从流内读取的数据,若无数据可读,或者连接中断,则返回 null
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
read(bytes?: number/** = -1*/): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 从流内读取剩余的全部数据,此方法为 body 相应方法的别名
|
||||
* @return 返回从流内读取的数据,若无数据可读,或者连接中断,则返回 null
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
readAll(): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 写入给定的数据,此方法为 body 相应方法的别名
|
||||
* @param data 给定要写入的数据
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
write(data: Class_Buffer): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 以 JSON 编码写入给定的数据
|
||||
* @param data 给定要写入的数据
|
||||
* @return 此方法不会返回数据
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
json(data: any): any;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 以 JSON 编码解析消息中的数据
|
||||
* @return 返回解析的结果
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
json(): any;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 设置当前消息处理结束,Chain 处理器不再继续后面的事务
|
||||
*
|
||||
*
|
||||
*/
|
||||
end(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询当前消息是否结束
|
||||
* @return 结束则返回 true
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
isEnded(): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 清除消息的内容
|
||||
*
|
||||
*
|
||||
*/
|
||||
clear(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 发送格式化消息到给定的流对象
|
||||
* @param stm 指定接收格式化消息的流对象
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
sendTo(stm: Class_Stream): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 从给定的缓存流对象中读取格式化消息,并解析填充对象
|
||||
* @param stm 指定读取格式化消息的流对象
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
readFrom(stm: Class_Stream): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
+227
@@ -0,0 +1,227 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief mongodb 数据库数据集对象
|
||||
* @detail 使用 MongoDB.getCollection 创建:,```JavaScript,var col1 = mdb.getCollection('test');,var col = mdb.test;,```
|
||||
*/
|
||||
|
||||
declare class Class_MongoCollection extends Class__object {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 根据给定的查询条件和返回字段设定,建立游标对象
|
||||
* @param query 指定查询条件的对象
|
||||
* @param projection 指定返回字段的对象
|
||||
* @return 返回游标对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
find(query?: Object/** = v8::Object::New(isolate)*/, projection?: Object/** = v8::Object::New(isolate)*/): Class_MongoCursor;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 根据给定的查询条件和返回字段设定,查询一条结果
|
||||
* @param query 指定查询条件的对象
|
||||
* @param projection 指定返回字段的对象
|
||||
* @return 返回第一条结果
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
findOne(query?: Object/** = v8::Object::New(isolate)*/, projection?: Object/** = v8::Object::New(isolate)*/): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询并修改
|
||||
* @param query 指定查询条件,修改数据
|
||||
* @return 返回修改前的结果及其他信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
findAndModify(query: Object): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 插入一组数据
|
||||
* @param documents 指定要插入的数据数组
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
insert(documents: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 插入一条数据
|
||||
* @param document 指定要插入的数据
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
insert(document: Object): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 保存一条数据,若数据包含 _id 字段,则为更新,否则为插入
|
||||
* @param document 指定要保存的数据
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
save(document: Object): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 根据给定的查询条件更新数据
|
||||
* @param query 指定查询条件的对象
|
||||
* @param document 指定要更新的数据
|
||||
* @param upsert 数据不存在时,插入一条新数据,缺省为 false,不插入
|
||||
* @param multi 当符合条件的数据多于一条时,更新所有数据,缺省为 false,只更新第一条
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
update(query: Object, document: Object, upsert?: boolean/** = false*/, multi?: boolean/** = false*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 根据给定的查询条件更新数据
|
||||
* @param query 指定查询条件的对象
|
||||
* @param document 指定要更新的数据
|
||||
* @param options 以对象字段传递的 upsert 和 multi 选项
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
update(query: Object, document: Object, options: Object): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 根据给定的查询条件删除数据
|
||||
* @param query 指定查询条件的对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
remove(query: Object): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 执行数据库命令
|
||||
* @param cmd 给定命令对象
|
||||
* @return 返回命令返回结果
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
runCommand(cmd: Object): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 执行数据库命令
|
||||
* @param cmd 给定命令名称
|
||||
* @param arg 给定命令参数选项
|
||||
* @return 返回命令返回结果
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
runCommand(cmd: string, arg?: Object/** = v8::Object::New(isolate)*/): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 删除当前集合
|
||||
*
|
||||
*
|
||||
*/
|
||||
drop(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 在当前集合上创建索引
|
||||
* @param keys 给定索引字段、顺序和方向
|
||||
* @param options 给定索引的选项,唯一索引等
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
ensureIndex(keys: Object, options?: Object/** = v8::Object::New(isolate)*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 重建当前集合的索引
|
||||
* @return 返回命令执行结果
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
reIndex(): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 删除当前集合指定名称的索引
|
||||
* @param name 给定要删除的索引名称
|
||||
* @return 返回命令执行结果
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
dropIndex(name: string): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 删除当前集合全部索引
|
||||
* @return 返回命令执行结果
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
dropIndexes(): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询当前集合全部索引
|
||||
* @return 返回包含索引的结果集
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
getIndexes(): Class_MongoCursor;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 获取当前集合子命名空间的集合对象
|
||||
* @param name 子命名空间名称
|
||||
* @return 返回新集合对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
getCollection(name: string): Class_MongoCollection;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+149
@@ -0,0 +1,149 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief mongodb 数据库数据游标对象
|
||||
* @detail
|
||||
*/
|
||||
|
||||
declare class Class_MongoCursor extends Class__object {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定返回结果时跳过的记录数
|
||||
* @param num 记录数
|
||||
* @return 返回游标对象本身便于链式调用
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
skip(num: number): Class_MongoCursor;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定返回结果的最大记录数
|
||||
* @param size 记录数
|
||||
* @return 返回游标对象本身便于链式调用
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
limit(size: number): Class_MongoCursor;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 设定返回结果的排序
|
||||
* @param opts 指定排序条件
|
||||
* @return 返回游标对象本身便于链式调用
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
sort(opts: Object): Class_MongoCursor;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询当前游标是否有下一条记录
|
||||
* @return 有记录则返回 true
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
hasNext(): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回当前游标的下一条记录
|
||||
* @return 记录对象,无记录则返回 null
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
next(): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询游标的记录总数
|
||||
* @param applySkipLimit 指定是否查询 skip 和 limit 后的记录数,缺省为 false,查询全部记录数
|
||||
* @return 返回记录总数
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
count(applySkipLimit?: boolean/** = false*/): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询游标的记录总数,相当于 count(true)
|
||||
* @return 返回记录总数
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
size(): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 遍历全部记录并回调处理函数
|
||||
* @param func 指定处理函数
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
forEach(func: Function): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 遍历处理全部记录,并返回处理结果
|
||||
* @param func 指定处理函数
|
||||
* @return 返回处理结果数组
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
map(func: Function): any[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回当前游标全部记录的数组
|
||||
* @return 返回包含全部数据的 Javascript 数组
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
toArray(): any[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 修改 mongodb 服务器缺省索引策略,使用指定的索引进行查询
|
||||
* @param opts 指定强制使用的索引
|
||||
* @return 返回游标对象本身便于链式调用
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
hint(opts: Object): Class_MongoCursor;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+86
@@ -0,0 +1,86 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief mongodb 数据库连接对象
|
||||
* @detail 使用 db.open 或 db.openMongoDB 创建,创建方式:,```JavaScript,var mdb = db.openMongoDB("mongodb://host/db");,```
|
||||
*/
|
||||
|
||||
declare class Class_MongoDB extends Class__object {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 获取指定集合访问对象
|
||||
* @param name 指定集合的名称
|
||||
* @return 返回指定的集合对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
getCollection(name: string): Class_MongoCollection;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定一个 MongoDB 数据库命令
|
||||
* @param cmd 指定命令和参数的字典对象
|
||||
* @return 返回命令执行结果
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
runCommand(cmd: Object): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定一个简单的 MongoDB 数据库命令
|
||||
* @param cmd 指定命令名
|
||||
* @param arg 指定命令参数
|
||||
* @return 返回命令执行结果
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
runCommand(cmd: string, arg: any): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 生成一个 mongodb _objectid 对象
|
||||
* @param hexStr 初始化 16 进制字符串,缺省生成新的 id
|
||||
* @return 新 _objectid 对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
oid(hexStr?: string/** = ""*/): Class_MongoID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 关闭当前数据库连接
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
close(): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief mongodb 数据库数据唯一标识对象,用于存储传递 oid
|
||||
* @detail
|
||||
*/
|
||||
|
||||
declare class Class_MongoID extends Class__object {
|
||||
|
||||
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+67
@@ -0,0 +1,67 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief mysql 数据库连接对象
|
||||
* @detail 使用 db.open 或 db.openMySQL 创建,创建方式:,```JavaScript,var msql = db.openMySQL("mysql://user:pass@host/db");,```
|
||||
*/
|
||||
/// <reference path="DbConnection.d.ts" />
|
||||
declare class Class_MySQL extends Class_DbConnection {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 数据库连接接收缓存尺寸
|
||||
*
|
||||
*
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
rxBufferSize: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 数据库连接发送缓存尺寸
|
||||
*
|
||||
*
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
txBufferSize: number
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 选择当前数据库连接的缺省数据库
|
||||
* @param dbName 指定数据库名
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
use(dbName: string): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+355
@@ -0,0 +1,355 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 不对称加密算法对象
|
||||
* @detail PKey 对象属于 crypto 模块,创建:,```JavaScript,var k = new crypto.PKey();,```
|
||||
*/
|
||||
|
||||
declare class Class_PKey extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回当前算法名称
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
name: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回当前算法密码长度,以位为单位
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
keySize: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回当前密钥的公钥
|
||||
* @return 当前密钥的公钥
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type PKey
|
||||
*/
|
||||
|
||||
publicKey: Class_PKey
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief PKey 构造函数
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor();
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 通过 DER 格式的密钥构造 PKey
|
||||
* @param DerKey DER 格式的密钥
|
||||
* @param password 解密密码
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(DerKey: Class_Buffer, password?: string/** = ""*/);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 通过 PEM 格式的密钥构造 PKey
|
||||
* @param pemKey PEM 格式的密钥
|
||||
* @param password 解密密码
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(pemKey: string, password?: string/** = ""*/);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 通过 JSON 格式的密钥构造 PKey
|
||||
*
|
||||
* jsonKey 的格式支持以下四种,RSA 私钥:
|
||||
* ```JavaScript
|
||||
* {
|
||||
* "kty": "RSA",
|
||||
* "n": "0m5lvKpWqy9JS7tV2HIPqHCYHLquSuxIC3F8strIQLJKO3rZmTT96KTnhsOfBO7Y1bI7mnT0PB3_vcHd9ekWMEoZJQw7MuB8KeM_Wn54-elJr5DNLk5bMppSGxX7ZnumiXGG51_X3Yp-_EbGtDG80GxXXix7Mucyo7K25uE0uW8=",
|
||||
* "e": "AQAB",
|
||||
* "d": "agN2O9NxMHL1MTMi75WfL9Pxvl-KWXKqZSF6mjzAsF9iKI8euyHIXYFepzU8kual1RsjDhCnzvWqFvZplW8lXqrHf_P-rS_9Y4gBUw6pjnI_DnFIRwWHRvrUHHSCfWOdTCIKdOTkgLZuGFuhEY3RMIW0WSYejjLtftwy0RVxAzk=",
|
||||
* "p": "6a4G1qmfwWmn1biigN7IVFlkbLf9oVe6g7rOmHxI-hn1GRxKDSVuAUrmR1IhuAnca9M0y7SD-7TUs6wjOxWxaw==",
|
||||
* "q": "5ofkxFKdPBD0CQHMb9q13AMHUVe0rJ-hSjqqIBrmqApUOneyAcMV76M0QyIQnI2p3POa4Qu_7XChDwRVl7LlDQ==",
|
||||
* "dp": "2mXGiGwCHl8j-FBWuID-1C6z-BRB3MBEVoeKPOOzxOPruatB3mWEGXsqG7A8SWgV9URxTI2K6P3J6Z7RUpBkvw==",
|
||||
* "dq": "oagn5vfb5NQqnOpS9xkSsD67cfIj821ZSFlNFYhnuOzNVda7z_qCtnHm4zDPH0lEFXoKYMfBhfqWJpaugttjPQ==",
|
||||
* "qi": "dqEQgxNmOVFrF4s776hTqeC6oEDila8EvpVb2F2ZvwAOLjCQ66OiAZK1BiYGHqUy0NeqNmtlsLSuBEZQZvqZwg=="
|
||||
* }
|
||||
* ```
|
||||
* RSA 公钥:
|
||||
* ```JavaScript
|
||||
* {
|
||||
* "kty": "RSA",
|
||||
* "n": "0m5lvKpWqy9JS7tV2HIPqHCYHLquSuxIC3F8strIQLJKO3rZmTT96KTnhsOfBO7Y1bI7mnT0PB3_vcHd9ekWMEoZJQw7MuB8KeM_Wn54-elJr5DNLk5bMppSGxX7ZnumiXGG51_X3Yp-_EbGtDG80GxXXix7Mucyo7K25uE0uW8=",
|
||||
* "e": "AQAB"
|
||||
* }
|
||||
* ```
|
||||
* EC 私钥:
|
||||
* ```JavaScript
|
||||
* {
|
||||
* "kty": "EC",
|
||||
* "crv": "P-521",
|
||||
* "x": "ATfNNFuuvlGxrTGoXgyfSAGgRNNDnO3rN3k74urKJdVS14RYhdnSwm91Bm-F1l-T1XKlAY2yRnzG9w1Ukvo8c0wL",
|
||||
* "y": "ASBHqrruB6kdkEUB3vlW3-UIkk4HtKdUeTwN-7m3j2rgZvYR1ffRAapDvWqKGiBjomqWafxokBkbDI0c95f6f4XU",
|
||||
* "d": "AfkIbUHXfW41njdpoKuqqKludcoLJS8D_oMEwkj-GVaXFNKccIoF5iKGu2c69kNDjo83R_7wyGlfRczsklkik1ST"
|
||||
* }
|
||||
* ```
|
||||
* EC 公钥:
|
||||
* ```JavaScript
|
||||
* {
|
||||
* "kty": "EC",
|
||||
* "crv": "P-521",
|
||||
* "x": "ATfNNFuuvlGxrTGoXgyfSAGgRNNDnO3rN3k74urKJdVS14RYhdnSwm91Bm-F1l-T1XKlAY2yRnzG9w1Ukvo8c0wL",
|
||||
* "y": "ASBHqrruB6kdkEUB3vlW3-UIkk4HtKdUeTwN-7m3j2rgZvYR1ffRAapDvWqKGiBjomqWafxokBkbDI0c95f6f4XU"
|
||||
* }
|
||||
* ```
|
||||
* @param jsonKey JSON 格式的密钥
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(jsonKey: Object);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 生成一个 RSA 私钥
|
||||
* @param size 指定 RSA 密钥长度,bit 为单位
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
genRsaKey(size: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 生成一个 EC 私钥
|
||||
* @param curve 指定预置椭圆曲线,可选值为:"secp521r1", "brainpoolP512r1", "secp384r1", "brainpoolP384r1", "secp256r1", "secp256k1", "brainpoolP256r1", "secp224r1", "secp224k1", "secp192r1", "secp192k1"
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
genEcKey(curve?: string/** = "secp521r1"*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询当前密钥是否为私钥
|
||||
* @return 为 True 表示为私钥
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
isPrivate(): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 复制当前密钥
|
||||
* @return 当前密钥的复制对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
clone(): Class_PKey;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 加载一个 DER 格式的密钥
|
||||
* @param DerKey DER 格式的密钥
|
||||
* @param password 解密密码
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
importKey(DerKey: Class_Buffer, password?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 加载一个 PEM 格式的密钥
|
||||
* @param pemKey PEM 格式的密钥
|
||||
* @param password 解密密码
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
importKey(pemKey: string, password?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 加载一个 JSON 格式的密钥
|
||||
*
|
||||
* jsonKey 的格式支持以下四种,RSA 私钥:
|
||||
* ```JavaScript
|
||||
* {
|
||||
* "kty": "RSA",
|
||||
* "n": "0m5lvKpWqy9JS7tV2HIPqHCYHLquSuxIC3F8strIQLJKO3rZmTT96KTnhsOfBO7Y1bI7mnT0PB3_vcHd9ekWMEoZJQw7MuB8KeM_Wn54-elJr5DNLk5bMppSGxX7ZnumiXGG51_X3Yp-_EbGtDG80GxXXix7Mucyo7K25uE0uW8=",
|
||||
* "e": "AQAB",
|
||||
* "d": "agN2O9NxMHL1MTMi75WfL9Pxvl-KWXKqZSF6mjzAsF9iKI8euyHIXYFepzU8kual1RsjDhCnzvWqFvZplW8lXqrHf_P-rS_9Y4gBUw6pjnI_DnFIRwWHRvrUHHSCfWOdTCIKdOTkgLZuGFuhEY3RMIW0WSYejjLtftwy0RVxAzk=",
|
||||
* "p": "6a4G1qmfwWmn1biigN7IVFlkbLf9oVe6g7rOmHxI-hn1GRxKDSVuAUrmR1IhuAnca9M0y7SD-7TUs6wjOxWxaw==",
|
||||
* "q": "5ofkxFKdPBD0CQHMb9q13AMHUVe0rJ-hSjqqIBrmqApUOneyAcMV76M0QyIQnI2p3POa4Qu_7XChDwRVl7LlDQ==",
|
||||
* "dp": "2mXGiGwCHl8j-FBWuID-1C6z-BRB3MBEVoeKPOOzxOPruatB3mWEGXsqG7A8SWgV9URxTI2K6P3J6Z7RUpBkvw==",
|
||||
* "dq": "oagn5vfb5NQqnOpS9xkSsD67cfIj821ZSFlNFYhnuOzNVda7z_qCtnHm4zDPH0lEFXoKYMfBhfqWJpaugttjPQ==",
|
||||
* "qi": "dqEQgxNmOVFrF4s776hTqeC6oEDila8EvpVb2F2ZvwAOLjCQ66OiAZK1BiYGHqUy0NeqNmtlsLSuBEZQZvqZwg=="
|
||||
* }
|
||||
* ```
|
||||
* RSA 公钥:
|
||||
* ```JavaScript
|
||||
* {
|
||||
* "kty": "RSA",
|
||||
* "n": "0m5lvKpWqy9JS7tV2HIPqHCYHLquSuxIC3F8strIQLJKO3rZmTT96KTnhsOfBO7Y1bI7mnT0PB3_vcHd9ekWMEoZJQw7MuB8KeM_Wn54-elJr5DNLk5bMppSGxX7ZnumiXGG51_X3Yp-_EbGtDG80GxXXix7Mucyo7K25uE0uW8=",
|
||||
* "e": "AQAB"
|
||||
* }
|
||||
* ```
|
||||
* EC 私钥:
|
||||
* ```JavaScript
|
||||
* {
|
||||
* "kty": "EC",
|
||||
* "crv": "P-521",
|
||||
* "x": "ATfNNFuuvlGxrTGoXgyfSAGgRNNDnO3rN3k74urKJdVS14RYhdnSwm91Bm-F1l-T1XKlAY2yRnzG9w1Ukvo8c0wL",
|
||||
* "y": "ASBHqrruB6kdkEUB3vlW3-UIkk4HtKdUeTwN-7m3j2rgZvYR1ffRAapDvWqKGiBjomqWafxokBkbDI0c95f6f4XU",
|
||||
* "d": "AfkIbUHXfW41njdpoKuqqKludcoLJS8D_oMEwkj-GVaXFNKccIoF5iKGu2c69kNDjo83R_7wyGlfRczsklkik1ST"
|
||||
* }
|
||||
* ```
|
||||
* EC 公钥:
|
||||
* ```JavaScript
|
||||
* {
|
||||
* "kty": "EC",
|
||||
* "crv": "P-521",
|
||||
* "x": "ATfNNFuuvlGxrTGoXgyfSAGgRNNDnO3rN3k74urKJdVS14RYhdnSwm91Bm-F1l-T1XKlAY2yRnzG9w1Ukvo8c0wL",
|
||||
* "y": "ASBHqrruB6kdkEUB3vlW3-UIkk4HtKdUeTwN-7m3j2rgZvYR1ffRAapDvWqKGiBjomqWafxokBkbDI0c95f6f4XU"
|
||||
* }
|
||||
* ```
|
||||
* @param jsonKey JSON 格式的密钥
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
importKey(jsonKey: Object): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 加载一个 PEM/DER 格式的密钥文件
|
||||
* @param filename 密钥文件名
|
||||
* @param password 解密密码
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
importFile(filename: string, password?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回当前 key 的 PEM 格式编码
|
||||
* @return 当前 key 的 PEM 格式编码
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
exportPem(): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回当前 key 的 DER 格式编码
|
||||
* @return 当前 key 的 DER 格式编码
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
exportDer(): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回当前 key 的 DER 格式编码
|
||||
* @return 当前 key 的 DER 格式编码
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
exportJson(): Object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 使用当前算法密码公钥加密数据
|
||||
* @param data 指定要加密的数据
|
||||
* @return 返回加密后的数据
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
encrypt(data: Class_Buffer): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 使用当前算法密码私钥解密数据
|
||||
* @param data 指定要解密的数据
|
||||
* @return 返回解密后的数据
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
decrypt(data: Class_Buffer): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 使用当前算法密码私钥签名数据
|
||||
* @param data 指定要签名的数据
|
||||
* @param alg 指定要签名的算法, 默认0. 支持算法: 0=NONE,1=MD2,2=MD4,3=MD5,4=SHA1,5=SHA224,6=SHA256,7=SHA384,8=SHA512,9=RIPEMD160
|
||||
* @return 返回签名后的数据
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
sign(data: Class_Buffer, alg?: number/** = 0*/): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 使用当前算法密码公钥验证数据
|
||||
* @param data 指定要验证的数据
|
||||
* @param sign 指定要验证的签名
|
||||
* @param alg 指定要签名的算法, 默认0. 支持算法: 0=NONE,1=MD2,2=MD4,3=MD5,4=SHA1,5=SHA224,6=SHA256,7=SHA384,8=SHA512,9=RIPEMD160
|
||||
* @return 返回验证后的结果
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
verify(data: Class_Buffer, sign: Class_Buffer, alg?: number/** = 0*/): boolean;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+576
@@ -0,0 +1,576 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief Redis 数据库客户端对象
|
||||
* @detail 用以创建和管理 Redis 数据库,创建方法:,```JavaScript,var db = require("db");,var test = new db.openRedis("redis-server");,```
|
||||
*/
|
||||
|
||||
declare class Class_Redis extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置错误处理函数,当 sub 出现错误或者网络中断时回调,当回调发生后,本对象的一切 sub 都将中止
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type Function
|
||||
*/
|
||||
|
||||
onsuberror: Function
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief redis 基础命令方法
|
||||
* @param cmd 指定发送的命令
|
||||
* @param args 指定发送的参数
|
||||
* @return 返回服务器返回的结果
|
||||
*
|
||||
*
|
||||
*/
|
||||
command(cmd: string, ...args: any[]): any;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将字符串值 value 关联到 key,如果 key 已经持有其他值, SET 就覆写旧值,无视类型
|
||||
* @param key 指定要关联的 key
|
||||
* @param value 指定要关联的数据
|
||||
* @param ttl 以毫秒为单位为 key 设置生存时间;如果 ttl 为 0 ,那么不设置生存时间
|
||||
*
|
||||
*
|
||||
*/
|
||||
set(key: Class_Buffer, value: Class_Buffer, ttl?: number/** = 0*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将 key 的值设为 value ,当且仅当 key 不存在。若给定的 key 已经存在,则 SETNX 不做任何动作。
|
||||
* @param key 指定要关联的 key
|
||||
* @param value 指定要关联的数据
|
||||
* @param ttl 以毫秒为单位为 key 设置生存时间;如果 ttl 为 0 ,那么不设置生存时间
|
||||
*
|
||||
*
|
||||
*/
|
||||
setNX(key: Class_Buffer, value: Class_Buffer, ttl?: number/** = 0*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将 key 的值设为 value,只在键已经存在时,才对键进行设置操作。
|
||||
* @param key 指定要关联的 key
|
||||
* @param value 指定要关联的数据
|
||||
* @param ttl 以毫秒为单位为 key 设置生存时间;如果 ttl 为 0 ,那么不设置生存时间
|
||||
*
|
||||
*
|
||||
*/
|
||||
setXX(key: Class_Buffer, value: Class_Buffer, ttl?: number/** = 0*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 同时设置一个或多个 key-value 对。如果某个给定 key 已经存在,那么 MSET 会用新值覆盖原来的旧值
|
||||
* @param kvs 指定要设置的 key/value 对象
|
||||
*
|
||||
*
|
||||
*/
|
||||
mset(kvs: Object): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 同时设置一个或多个 key-value 对。如果某个给定 key 已经存在,那么 MSET 会用新值覆盖原来的旧值
|
||||
* @param kvs 指定要设置的 key/value 列表
|
||||
*
|
||||
*
|
||||
*/
|
||||
mset(...kvs: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 同时设置一个或多个 key-value 对,当且仅当所有给定 key 都不存在
|
||||
* @param kvs 指定要设置的 key/value 对象
|
||||
*
|
||||
*
|
||||
*/
|
||||
msetNX(kvs: Object): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 同时设置一个或多个 key-value 对,当且仅当所有给定 key 都不存在
|
||||
* @param kvs 指定要设置的 key/value 列表
|
||||
*
|
||||
*
|
||||
*/
|
||||
msetNX(...kvs: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 如果 key 已经存在并且是一个字符串,append 命令将 value 追加到 key 原来的值的末尾。如果 key 不存在,append 就简单地将给定 key 设为 value
|
||||
* @param key 指定要追加的 key
|
||||
* @param value 指定要追加的数据
|
||||
* @return 追加 value 之后, key 中字符串的长度
|
||||
*
|
||||
*
|
||||
*/
|
||||
append(key: Class_Buffer, value: Class_Buffer): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 用 value 参数覆写给定 key 所储存的字符串值,从偏移量 offset 开始
|
||||
* @param key 指定要修改的 key
|
||||
* @param offset 指定修改的字节偏移
|
||||
* @param value 指定要覆盖的数据
|
||||
* @return 被修改之后,字符串的长度
|
||||
*
|
||||
*
|
||||
*/
|
||||
setRange(key: Class_Buffer, offset: number, value: Class_Buffer): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回 key 中字符串值的子字符串,字符串的截取范围由 start 和 end 两个偏移量决定(包括 start 和 end 在内)
|
||||
* @param key 指定要查询的 key
|
||||
* @param start 指定查询的起始字节偏移
|
||||
* @param end 指定查询的结束字节偏移
|
||||
* @return 截取得出的子字符串
|
||||
*
|
||||
*
|
||||
*/
|
||||
getRange(key: Class_Buffer, start: number, end: number): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回 key 所储存的字符串值的长度。当 key 储存的不是字符串值时,返回一个错误
|
||||
* @param key 指定要计算的 key
|
||||
* @return 字符串值的长度。当 key 不存在时,返回 0
|
||||
*
|
||||
*
|
||||
*/
|
||||
strlen(key: Class_Buffer): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 计算给定字符串中,被设置为 1 的比特位的数量
|
||||
* @param key 指定要计算的 key
|
||||
* @param start 指定要计算的起始字节,可以使用负数值,-1 表示最后一个字节,而 -2 表示倒数第二个字节,以此类推
|
||||
* @param end 指定要计算的结束字节,可以使用负数值,-1 表示最后一个字节,而 -2 表示倒数第二个字节,以此类推
|
||||
* @return 被设置为 1 的位的数量
|
||||
*
|
||||
*
|
||||
*/
|
||||
bitcount(key: Class_Buffer, start?: number/** = 0*/, end?: number/** = -1*/): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回 key 所关联的字符串值,如果 key 不存在那么返回特殊值 Null
|
||||
* @param key 指定要关联的 key
|
||||
* @return 当 key 不存在时,返回 Null ,否则,返回 key 的值
|
||||
*
|
||||
*
|
||||
*/
|
||||
get(key: Class_Buffer): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回所有(一个或多个)给定 key 的值。如果给定的 key 里面,有某个 key 不存在,那么这个 key 返回特殊值 nil 。
|
||||
* @param keys 指定要查询的 key 数组
|
||||
* @return 一个包含所有给定 key 的值的列表
|
||||
*
|
||||
*
|
||||
*/
|
||||
mget(keys: any[]): any[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回所有(一个或多个)给定 key 的值。如果给定的 key 里面,有某个 key 不存在,那么这个 key 返回特殊值 nil 。
|
||||
* @param keys 指定要查询的 key 列表
|
||||
* @return 一个包含所有给定 key 的值的列表
|
||||
*
|
||||
*
|
||||
*/
|
||||
mget(...keys: any[]): any[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将给定 key 的值设为 value ,并返回 key 的旧值(old value)
|
||||
* @param key 指定要查询修改的 key
|
||||
* @param value 指定修改的数值
|
||||
* @return 返回给定 key 的旧值
|
||||
*
|
||||
*
|
||||
*/
|
||||
getset(key: Class_Buffer, value: Class_Buffer): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将 key 所储存的值减去减量
|
||||
* @param key 指定要修改的 key
|
||||
* @param num 指定要减去的数值
|
||||
* @return 减去 num 之后,key 的值
|
||||
*
|
||||
*
|
||||
*/
|
||||
decr(key: Class_Buffer, num?: number/** = 1*/): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将 key 所储存的值加上增量
|
||||
* @param key 指定要修改的 key
|
||||
* @param num 指定要加上的数值
|
||||
* @return 加上 num 之后,key 的值
|
||||
*
|
||||
*
|
||||
*/
|
||||
incr(key: Class_Buffer, num?: number/** = 1*/): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 对 key 所储存的字符串值,设置或清除指定偏移量上的位(bit)
|
||||
* @param key 指定要修改的 key
|
||||
* @param offset 指定修改的位偏移
|
||||
* @param value 指定设置或清除的参数,可以是 0 也可以是 1
|
||||
* @return 指定偏移量原来储存的位
|
||||
*
|
||||
*
|
||||
*/
|
||||
setBit(key: Class_Buffer, offset: number, value: number): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 对 key 所储存的字符串值,获取指定偏移量上的位(bit)
|
||||
* @param key 指定要查询的 key
|
||||
* @param offset 指定查询的位偏移
|
||||
* @return 字符串值指定偏移量上的位(bit)
|
||||
*
|
||||
*
|
||||
*/
|
||||
getBit(key: Class_Buffer, offset: number): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 检查给定 key 是否存在
|
||||
* @param key 指定要关联的 key
|
||||
* @return 若 key 存在,返回 True,否则返回 False
|
||||
*
|
||||
*
|
||||
*/
|
||||
exists(key: Class_Buffer): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回 key 所储存的值的类型
|
||||
* @param key 指定要查询的 key
|
||||
* @return 返回 key 所储存的值的类型,可能的值为 none(key不存在) string(字符串) list(列表) set(集合) zset(有序集) hash(哈希表)
|
||||
*
|
||||
*
|
||||
*/
|
||||
type(key: Class_Buffer): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查找所有符合给定模式 pattern 的 key
|
||||
* @param pattern 指定查询模式
|
||||
* @return 符合给定模式的 key 列表
|
||||
*
|
||||
*
|
||||
*/
|
||||
keys(pattern: string): any[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 删除给定的一个或多个 key,不存在的 key 会被忽略
|
||||
* @param keys 指定要删除的 key 数组
|
||||
* @return 被删除 key 的数量
|
||||
*
|
||||
*
|
||||
*/
|
||||
del(keys: any[]): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 删除给定的一个或多个 key,不存在的 key 会被忽略
|
||||
* @param keys 指定要删除的 key 列表
|
||||
* @return 被删除 key 的数量
|
||||
*
|
||||
*
|
||||
*/
|
||||
del(...keys: any[]): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 为给定 key 设置生存时间,当 key 过期时,它会被自动删除
|
||||
* @param key 指定要设定的 key
|
||||
* @param ttl 以毫秒为单位为 key 设置生存时间
|
||||
* @return 若 key 存在,返回 True,否则返回 False
|
||||
*
|
||||
*
|
||||
*/
|
||||
expire(key: Class_Buffer, ttl: number): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回给定 key 的剩余生存时间
|
||||
* @param key 指定要查询的 key
|
||||
* @return 以毫秒为单位,返回 key 的剩余生存时间,当 key 不存在时,返回 -2,当 key 存在但没有设置剩余生存时间时,返回 -1
|
||||
*
|
||||
*
|
||||
*/
|
||||
ttl(key: Class_Buffer): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 移除给定 key 的生存时间,将这个 key 从『易失的』(带生存时间 key )转换成『持久的』(一个不带生存时间、永不过期的 key)
|
||||
* @param key 指定要设定的 key
|
||||
* @return 若 key 存在,返回 True,否则返回 False
|
||||
*
|
||||
*
|
||||
*/
|
||||
persist(key: Class_Buffer): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将 key 改名为 newkey,当 key 和 newkey 相同,或者 key 不存在时,返回一个错误
|
||||
* @param key 指定要改名的 key
|
||||
* @param newkey 指定要改名的目的 key
|
||||
*
|
||||
*
|
||||
*/
|
||||
rename(key: Class_Buffer, newkey: Class_Buffer): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 当且仅当 newkey 不存在时,将 key 改名为 newkey,当 key 不存在时,返回一个错误
|
||||
* @param key 指定要改名的 key
|
||||
* @param newkey 指定要改名的目的 key
|
||||
* @return 修改成功时,返回 True,如果 newkey 已经存在,返回 False
|
||||
*
|
||||
*
|
||||
*/
|
||||
renameNX(key: Class_Buffer, newkey: Class_Buffer): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 订阅给定的一个频道的信息,当消息发生时自动调用 func,func 包含两个参数,依次为 channel 和 message,同一频道同一函数只会回调一次
|
||||
* @param channel 指定订阅的频道名称
|
||||
* @param func 指定回调函数
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
sub(channel: Class_Buffer, func: Function): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 订阅给定的一组频道的信息,当消息发生时自动调用相应的回调函数,同一频道同一函数只会回调一次
|
||||
* @param map 指定频道映射关系,对象属性名称将作为频道名称,属性的值将作为回调函数
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
sub(map: Object): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 退订给定的频道的全部回调
|
||||
* @param channel 指定退订的频道名称
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
unsub(channel: Class_Buffer): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 退订给定的频道的指定回调函数
|
||||
* @param channel 指定退订的频道名称
|
||||
* @param func 指定退订的回调函数
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
unsub(channel: Class_Buffer, func: Function): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 退订一组给定的频道的全部回调
|
||||
* @param channels 指定退订的频道数组
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
unsub(channels: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 退订给定的一组频道的指定回调函数
|
||||
* @param map 指定频道映射关系,对象属性名称将作为频道名称,属性的值将作为回调函数
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
unsub(map: Object): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 按照模板订阅一组频道的信息,当消息发生时自动调用 func,func 包含三个参数,依次为 channel,message 和 pattern,同一模板同一函数只会回调一次
|
||||
* @param pattern 指定订阅的频道模板
|
||||
* @param func 指定回调函数
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
psub(pattern: string, func: Function): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 订阅给定的一组频道模板的信息,当消息发生时自动调用相应的 func,同一频道同一函数只会回调一次
|
||||
* @param map 指定频道映射关系,对象属性名称将作为频道模板,属性的值将作为回调函数
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
psub(map: Object): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 退订给定模板的频道的全部回调
|
||||
* @param pattern 指定退订的频道模板
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
unpsub(pattern: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 退订给定模板的频道的指定回调函数
|
||||
* @param pattern 指定退订的频道模板
|
||||
* @param func 指定退订的回调函数
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
unpsub(pattern: string, func: Function): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 退订一组给定模板的频道的全部回调
|
||||
* @param patterns 指定发布的频道模板数组
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
unpsub(patterns: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 退订一组模板的频道的指定回调函数
|
||||
* @param map 指定频道映射关系,对象属性名称将作为频道模板,属性的值将作为回调函数
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
unpsub(map: Object): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将信息 message 发送到指定的频道 channel
|
||||
* @param channel 指定发布的频道
|
||||
* @param message 指定发布的消息
|
||||
* @return 接收此消息的客户端数量
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
pub(channel: Class_Buffer, message: Class_Buffer): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 获取指定 key 的 Hash 对象,此对象为包含指定 key 的客户端,只有调用其方法才会操作数据库
|
||||
* @param key 指定要获取的 key
|
||||
* @return 返回包含指定 key 的 Hash 对象
|
||||
*
|
||||
*
|
||||
*/
|
||||
getHash(key: Class_Buffer): Class_RedisHash;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 获取指定 key 的 List 对象,此对象为包含指定 key 的客户端,只有调用其方法才会操作数据库
|
||||
* @param key 指定要获取的 key
|
||||
* @return 返回包含指定 key 的 List 对象
|
||||
*
|
||||
*
|
||||
*/
|
||||
getList(key: Class_Buffer): Class_RedisList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 获取指定 key 的 Set 对象,此对象为包含指定 key 的客户端,只有调用其方法才会操作数据库
|
||||
* @param key 指定要获取的 key
|
||||
* @return 返回包含指定 key 的 Set 对象
|
||||
*
|
||||
*
|
||||
*/
|
||||
getSet(key: Class_Buffer): Class_RedisSet;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 获取指定 key 的 SortedSet 对象,此对象为包含指定 key 的客户端,只有调用其方法才会操作数据库
|
||||
* @param key 指定要获取的 key
|
||||
* @return 返回包含指定 key 的 SortedSet 对象
|
||||
*
|
||||
*
|
||||
*/
|
||||
getSortedSet(key: Class_Buffer): Class_RedisSortedSet;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 序列化给定 key ,并返回被序列化的值,使用 restore 命令可以将这个值反序列化为 Redis 键
|
||||
* @param key 指定要序列化的 key
|
||||
* @return 返回序列化之后的值,如果 key 不存在,那么返回 null
|
||||
*
|
||||
*
|
||||
*/
|
||||
dump(key: Class_Buffer): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 反序列化给定的序列化值,并将它和给定的 key 关联
|
||||
* @param key 指定要反序列化的 key
|
||||
* @param data 指定要反序列化的数据
|
||||
* @param ttl 以毫秒为单位为 key 设置生存时间;如果 ttl 为 0 ,那么不设置生存时间
|
||||
*
|
||||
*
|
||||
*/
|
||||
restore(key: Class_Buffer, data: Class_Buffer, ttl?: number/** = 0*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 关闭当前数据库连接或事务
|
||||
*
|
||||
*
|
||||
*/
|
||||
close(): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+169
@@ -0,0 +1,169 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief Redis 数据库客户端 Hash 对象,此对象为包含指定 key 的客户端,只有调用其方法才会操作数据库
|
||||
* @detail 用以操作 Redis 的 Hash 对象,创建方法:,```JavaScript,var db = require("db");,var rdb = new db.openRedis("redis-server");,var hash = rdb.getHash("test");,```
|
||||
*/
|
||||
|
||||
declare class Class_RedisHash extends Class__object {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将哈希表中的域 field 的值设为 value,如果域 field 已经存在于哈希表中,旧值将被覆盖
|
||||
* @param field 指定要修改的 field
|
||||
* @param value 指定要修改的数据
|
||||
*
|
||||
*
|
||||
*/
|
||||
set(field: Class_Buffer, value: Class_Buffer): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将哈希表中的域 field 的值设置为 value ,当且仅当域 field 不存在。若域 field 已经存在,该操作无效
|
||||
* @param field 指定要修改的 field
|
||||
* @param value 指定要修改的数据
|
||||
*
|
||||
*
|
||||
*/
|
||||
setNX(field: Class_Buffer, value: Class_Buffer): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 同时将多个 field-value (域-值)对设置到哈希表中,此命令会覆盖哈希表中已存在的域
|
||||
* @param kvs 指定要设置的 field/value 对象
|
||||
*
|
||||
*
|
||||
*/
|
||||
mset(kvs: Object): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 同时将多个 field-value (域-值)对设置到哈希表中,此命令会覆盖哈希表中已存在的域
|
||||
* @param kvs 指定要设置的 field/value 列表
|
||||
*
|
||||
*
|
||||
*/
|
||||
mset(...kvs: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回哈希表中给定域 field 的值
|
||||
* @param field 指定要查询的 field
|
||||
* @return 给定域的值,当给定域不存在或是给定 key 不存在时,返回 null
|
||||
*
|
||||
*
|
||||
*/
|
||||
get(field: Class_Buffer): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回哈希表中,一个或多个给定域的值
|
||||
* @param fields 指定要查询的域数组
|
||||
* @return 一个包含所有给定域的值的列表
|
||||
*
|
||||
*
|
||||
*/
|
||||
mget(fields: any[]): any[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回哈希表中,一个或多个给定域的值
|
||||
* @param fields 指定要查询的域列表
|
||||
* @return 一个包含所有给定域的值的列表
|
||||
*
|
||||
*
|
||||
*/
|
||||
mget(...fields: any[]): any[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将域所储存的值加上增量
|
||||
* @param field 指定要修改的域
|
||||
* @param num 指定要加上的数值
|
||||
* @return 加上 num 之后,域的值
|
||||
*
|
||||
*
|
||||
*/
|
||||
incr(field: Class_Buffer, num?: number/** = 1*/): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回哈希表中,所有的域和值
|
||||
* @return 返回一个包含哈希表中所有域的列表
|
||||
*
|
||||
*
|
||||
*/
|
||||
getAll(): any[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回哈希表中的所有域
|
||||
* @return 返回值里,紧跟每个域名(field name)之后是域的值(value),所以返回值的长度是哈希表大小的两倍
|
||||
*
|
||||
*
|
||||
*/
|
||||
keys(): any[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回哈希表中域的数量
|
||||
* @return 返回哈希表中域的数量
|
||||
*
|
||||
*
|
||||
*/
|
||||
len(): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查看哈希表中,给定域 field 是否存在
|
||||
* @param field 指定要查询的 field
|
||||
* @return 如果哈希表含有给定域,返回 true,如果哈希表不含有给定域,或 key 不存在,返回 false
|
||||
*
|
||||
*
|
||||
*/
|
||||
exists(field: Class_Buffer): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 删除哈希表中的一个或多个指定域,不存在的域将被忽略
|
||||
* @param fields 指定要删除的域数组
|
||||
* @return 被删除域的数量
|
||||
*
|
||||
*
|
||||
*/
|
||||
del(fields: any[]): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 删除哈希表中的一个或多个指定域,不存在的域将被忽略
|
||||
* @param fields 指定要删除的域列表
|
||||
* @return 被删除域的数量
|
||||
*
|
||||
*
|
||||
*/
|
||||
del(...fields: any[]): number;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+174
@@ -0,0 +1,174 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief Redis 数据库客户端 List 对象,此对象为包含指定 key 的客户端,只有调用其方法才会操作数据库
|
||||
* @detail 用以操作 Redis 的 List 对象,创建方法:,```JavaScript,var db = require("db");,var rdb = new db.openRedis("redis-server");,var list = rdb.getList("test");,```
|
||||
*/
|
||||
|
||||
declare class Class_RedisList extends Class__object {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将一个或多个值 value 插入到列表的表头
|
||||
* @param values 指定要插入的数据
|
||||
* @return 插入后,列表的长度
|
||||
*
|
||||
*
|
||||
*/
|
||||
push(values: any[]): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将一个或多个值 value 插入到列表的表头
|
||||
* @param values 指定要插入的数据
|
||||
* @return 插入后,列表的长度
|
||||
*
|
||||
*
|
||||
*/
|
||||
push(...values: any[]): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 移除并返回列表 key 的头元素
|
||||
* @return 列表的头元素,如果列表为空则返回 null
|
||||
*
|
||||
*
|
||||
*/
|
||||
pop(): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将一个或多个值 value 插入到列表的表尾(最右边)
|
||||
* @param values 指定要插入的数据
|
||||
* @return 插入后,列表的长度
|
||||
*
|
||||
*
|
||||
*/
|
||||
rpush(values: any[]): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将一个或多个值 value 插入到列表的表尾(最右边)
|
||||
* @param values 指定要插入的数据
|
||||
* @return 插入后,列表的长度
|
||||
*
|
||||
*
|
||||
*/
|
||||
rpush(...values: any[]): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 移除并返回列表 key 的表尾(最右边)元素
|
||||
* @return 列表的头元素,如果列表为空则返回 null
|
||||
*
|
||||
*
|
||||
*/
|
||||
rpop(): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将列表下标为 index 的元素的值设置为 value
|
||||
* @param index 指定要修改的下标
|
||||
* @param value 指定要修改的数据
|
||||
*
|
||||
*
|
||||
*/
|
||||
set(index: number, value: Class_Buffer): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回列表中,下标为 index 的元素
|
||||
* @param index 指定要查询的下标
|
||||
* @return 列表中下标为 index 的元素
|
||||
*
|
||||
*
|
||||
*/
|
||||
get(index: number): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将值 value 插入到列表当中,位于值 pivot 之前
|
||||
* @param pivot 指定插入时查找的数据
|
||||
* @param value 指定要插入的数据
|
||||
* @return 插入后,列表的长度
|
||||
*
|
||||
*
|
||||
*/
|
||||
insertBefore(pivot: Class_Buffer, value: Class_Buffer): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将值 value 插入到列表当中,位于值 pivot 之后
|
||||
* @param pivot 指定插入时查找的数据
|
||||
* @param value 指定要插入的数据
|
||||
* @return 插入后,列表的长度
|
||||
*
|
||||
*
|
||||
*/
|
||||
insertAfter(pivot: Class_Buffer, value: Class_Buffer): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 根据参数 count 的值,移除列表中与参数 value 相等的元素
|
||||
* @param count 指定删除的元素数量
|
||||
* @param value 指定要删除的数值
|
||||
* @return 被移除元素的数量
|
||||
*
|
||||
*
|
||||
*/
|
||||
remove(count: number, value: Class_Buffer): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 对一个列表进行修剪(trim),就是说,让列表只保留指定区间内的元素,不在指定区间之内的元素都将被删除
|
||||
* @param start 指定修剪的起始下标,0 表示第一个元素,-1 表示最后一个元素
|
||||
* @param stop 指定修剪的结束下标,0 表示第一个元素,-1 表示最后一个元素
|
||||
*
|
||||
*
|
||||
*/
|
||||
trim(start: number, stop: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回列表的长度
|
||||
* @return 返回列表的长度
|
||||
*
|
||||
*
|
||||
*/
|
||||
len(): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回列表中指定区间内的元素,区间以偏移量 start 和 stop 指定,包含 start 和 stop 的元素
|
||||
* @param start 指定查询的起始下标,0 表示第一个元素,-1 表示最后一个元素
|
||||
* @param stop 指定查询的结束下标,0 表示第一个元素,-1 表示最后一个元素
|
||||
* @return 包含指定区间内的元素的数组
|
||||
*
|
||||
*
|
||||
*/
|
||||
range(start: number, stop: number): any[];
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+129
@@ -0,0 +1,129 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief Redis 数据库客户端 Set 对象,此对象为包含指定 key 的客户端,只有调用其方法才会操作数据库
|
||||
* @detail 用以操作 Redis 的 Set 对象,创建方法:,```JavaScript,var db = require("db");,var rdb = new db.openRedis("redis-server");,var set = rdb.getSet("test");,```
|
||||
*/
|
||||
|
||||
declare class Class_RedisSet extends Class__object {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将一个或多个 member 元素加入到集合 key 当中,已经存在于集合的 member 元素将被忽略
|
||||
* @param members 指定要添加的元素数组
|
||||
* @return 被添加到集合中的新元素的数量,不包括被忽略的元素
|
||||
*
|
||||
*
|
||||
*/
|
||||
add(members: any[]): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 同时将多个 field-value (域-值)对设置到哈希表中,此命令会覆盖哈希表中已存在的域
|
||||
* @param members 指定要添加的元素列表
|
||||
* @return 被添加到集合中的新元素的数量,不包括被忽略的元素
|
||||
*
|
||||
*
|
||||
*/
|
||||
add(...members: any[]): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 移除集合中的一个或多个 member 元素
|
||||
* @param members 指定要移除的元素数组
|
||||
* @return 被成功移除的元素的数量,不包括被忽略的元素
|
||||
*
|
||||
*
|
||||
*/
|
||||
remove(members: any[]): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 移除集合中的一个或多个 member 元素
|
||||
* @param members 指定要移除的元素列表
|
||||
* @return 被成功移除的元素的数量,不包括被忽略的元素
|
||||
*
|
||||
*
|
||||
*/
|
||||
remove(...members: any[]): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回集合中元素的数量
|
||||
* @return 返回集合的长度
|
||||
*
|
||||
*
|
||||
*/
|
||||
len(): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 判断 member 元素是否集合的成员
|
||||
* @param member 指定检查的 member
|
||||
* @return 如果 member 元素是集合的成员,返回 true
|
||||
*
|
||||
*
|
||||
*/
|
||||
exists(member: Class_Buffer): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回集合中的所有成员
|
||||
* @return 集合中所有成员的列表
|
||||
*
|
||||
*
|
||||
*/
|
||||
members(): any[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 移除并返回集合中的一个随机元素
|
||||
* @return 被移除的随机元素。当集合是空集时,返回 null
|
||||
*
|
||||
*
|
||||
*/
|
||||
pop(): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 从集合中获取随机的一个元素
|
||||
* @return 返回一个元素;如果集合为空,返回 null
|
||||
*
|
||||
*
|
||||
*/
|
||||
randMember(): any;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 从集合中获取随机的若干元素
|
||||
* @param count 指定返回的元素个数。正数,返回一个包含 count 个元素的数组;负数,返回一个数组,数组中的元素可能会重复出现多次,而数组的长度为 count 的绝对值
|
||||
* @return 返回一个列表;如果集合为空,返回空列表
|
||||
*
|
||||
*
|
||||
*/
|
||||
randMember(count: number): any;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
+158
@@ -0,0 +1,158 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief Redis 数据库客户端 SortedSet 对象,此对象为包含指定 key 的客户端,只有调用其方法才会操作数据库
|
||||
* @detail 用以操作 Redis 的 SortedSet 对象,创建方法:,```JavaScript,var db = require("db");,var rdb = new db.openRedis("redis-server");,var set = rdb.getSortedSet("test");,```
|
||||
*/
|
||||
|
||||
declare class Class_RedisSortedSet extends Class__object {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将一个或多个 member 元素及其 score 值加入到有序集当中
|
||||
* @param sms 指定要添加的 member/score 对象
|
||||
* @return 被成功添加的新成员的数量,不包括那些被更新的、已经存在的成员
|
||||
*
|
||||
*
|
||||
*/
|
||||
add(sms: Object): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将一个或多个 member 元素及其 score 值加入到有序集当中
|
||||
* @param sms 指定要添加的 member/score 列表
|
||||
* @return 被成功添加的新成员的数量,不包括那些被更新的、已经存在的成员
|
||||
*
|
||||
*
|
||||
*/
|
||||
add(...sms: any[]): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回有序集中,成员 member 的 score 值
|
||||
* @param member 指定要查询的 member
|
||||
* @return member 成员的 score 值,以字符串形式表示
|
||||
*
|
||||
*
|
||||
*/
|
||||
score(member: Class_Buffer): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 为有序集的成员 member 的 score 值加上增量 num
|
||||
* @param member 指定要修改的 member
|
||||
* @param num 指定要加上的数值
|
||||
* @return member 成员的新 score 值,以字符串形式表示
|
||||
*
|
||||
*
|
||||
*/
|
||||
incr(member: Class_Buffer, num?: number/** = 1*/): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 移除有序集中的一个或多个 member 元素
|
||||
* @param members 指定要移除的元素数组
|
||||
* @return 被成功移除的元素的数量,不包括被忽略的元素
|
||||
*
|
||||
*
|
||||
*/
|
||||
remove(members: any[]): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 移除有序集中的一个或多个 member 元素
|
||||
* @param members 指定要移除的元素列表
|
||||
* @return 被成功移除的元素的数量,不包括被忽略的元素
|
||||
*
|
||||
*
|
||||
*/
|
||||
remove(...members: any[]): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回有序集中元素的数量
|
||||
* @return 返回有序集的长度
|
||||
*
|
||||
*
|
||||
*/
|
||||
len(): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回有序集中, score 值在 min 和 max 之间(默认包括 score 值等于 min 或 max )的成员的数量
|
||||
* @param min 指定统计的最小 score
|
||||
* @param max 指定统计的最大 score
|
||||
* @return score 值在 min 和 max 之间的成员的数量
|
||||
*
|
||||
*
|
||||
*/
|
||||
count(min: number, max: number): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回有序集中,指定区间内的成员,成员的位置按 score 值递增(从小到大)来排序
|
||||
* @param start 指定查询的起始下标,0 表示第一个元素,-1 表示最后一个元素
|
||||
* @param stop 指定查询的结束下标,0 表示第一个元素,-1 表示最后一个元素
|
||||
* @param withScores 指定是否在结果中包含 score
|
||||
* @return 指定区间内,带有 score 值(可选)的有序集成员的列表
|
||||
*
|
||||
*
|
||||
*/
|
||||
range(start: number, stop: number, withScores?: boolean/** = false*/): any[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回有序集中,指定区间内的成员,成员的位置按 score 值递减(从大到小)来排序
|
||||
* @param start 指定查询的起始下标,0 表示第一个元素,-1 表示最后一个元素
|
||||
* @param stop 指定查询的结束下标,0 表示第一个元素,-1 表示最后一个元素
|
||||
* @param withScores 指定是否在结果中包含 score
|
||||
* @return 指定区间内,带有 score 值(可选)的有序集成员的列表
|
||||
*
|
||||
*
|
||||
*/
|
||||
rangeRev(start: number, stop: number, withScores?: boolean/** = false*/): any[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 有序集中成员 member 的排名。其中有序集成员按 score 值递增(从小到大)顺序排列
|
||||
* @param member 指定要查询的 member
|
||||
* @return member 如果 member 是有序集 key 的成员,返回 member 的排名。如果 member 不是有序集 key 的成员,返回 nil
|
||||
*
|
||||
*
|
||||
*/
|
||||
rank(member: Class_Buffer): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 有序集中成员 member 的排名。其中有序集成员按 score 值递减(从大到小)顺序排列
|
||||
* @param member 指定要查询的 member
|
||||
* @return member 如果 member 是有序集 key 的成员,返回 member 的排名。如果 member 不是有序集 key 的成员,返回 nil
|
||||
*
|
||||
*
|
||||
*/
|
||||
rankRev(member: Class_Buffer): number;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+262
@@ -0,0 +1,262 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 消息处理器路由对象
|
||||
* @detail 路由对象是 http 消息处理的核心对象,服务器根据路由的设定,匹配 url 和 method,并将 http 消息转发到相应的处理器,以完成不同的事务。,,一个简单的路由,可以直接以 JSON 对象的形式提供,比如:,```JavaScript,var http = require('http');,,var svr = new http.Server(8080, {, '/': r => r.response.write('home'),, '/help': r => r.response.write('help'),});,,svr.run();,```,如果需要更复杂的路由定制,可以自行创建 Routing 对象并根据需要处理路由策略:,```JavaScript,var http = require('http');,var mq = require('mq');,,var app = new mq.Routing();,,app.get('/', r => r.response.write('home'));,app.get('/help', r => r.response.write('help'));,,app.post('/help', r => r.response.write('post a help.'));,,app.get('/home/:user', (r, user) => r.response.write('hello ' + user));,,app.get('/user/:id(\\d+)', (r, id) => r.response.write('get ' + id));,,app.get('/actions', {, '/run': r => r.response.write('running'),, '/sleep': r => r.response.write('sleeping'),, '(.*)': r => r.response.write('........'),});,,var svr = new http.Server(8080, app);,svr.run();,```,路由对象根据设定的规则匹配消息,将消息传递给符合规则的第一个处理器。后加入的路由规则优先匹配。创建方法:,```JavaScript,var routing = new mq.Routing({, "^/func1(/.*)$": func1,, "^/func2(/.*)$": func2,});,```,正则表达式匹配的项目修改消息的 value 属性,子项目存入消息的 params 属性。例如:,```JavaScript,var routing = new mq.Routing({, "^/func1(/([0-9]+)/([0-9]+)\.html)$": func1,,});,```,匹配消息 "/func1/123/456.html" 后,value == "/123/456.html",params == ["123", "456"];,,如果匹配的结果没有子项,则 value 为空,params 为空。例如:,```JavaScript,var routing = new mq.Routing({, "^/func1/[0-9]+/[0-9]+\.html$": func1,,});,```,匹配消息 "/func1/123/456.html" 后,value == "",params == [];,,如果匹配的结果第一级有多个子项,则 value 为空,params 为第一级子项。例如:,```JavaScript,var routing = new mq.Routing({, "^/func1/([0-9]+)/([0-9]+)\.html$": func1,,});,```,匹配消息 "/func1/123/456.html" 后,value == "",params == ["123", "456"];,,如果匹配的结果只有一个子项,并且无下级子项,则 value 和 params 均为此子项。例如:,```JavaScript,var routing = new mq.Routing({, "^/func1/([0-9]+)/[0-9]+\.html$": func1,,});,```,匹配消息 "/func1/123/456.html" 后,value == "123",params == ["123"];
|
||||
*/
|
||||
/// <reference path="Handler.d.ts" />
|
||||
declare class Class_Routing extends Class_Handler {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 创建一个消息处理器路由对象
|
||||
* @param map 初始化路由参数
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(map?: Object/** = v8::Object::New(isolate)*/);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 创建一个消息处理器路由对象
|
||||
* @param method 指定 http 请求方法,"*" 接受所有方法
|
||||
* @param map 初始化路由参数
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(method: string, map: Object);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 从已有路由对象中添加规则,添加后原路由将被清空
|
||||
* @param route 已经初始化的路由对象
|
||||
* @return 返回路由对象本身
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
append(route: Class_Routing): Class_Routing;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 添加一组路由规则
|
||||
* @param map 路由参数
|
||||
* @return 返回路由对象本身
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
append(map: Object): Class_Routing;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 添加一条路由规则
|
||||
* @param pattern 消息匹配格式
|
||||
* @param hdlr 内置消息处理器,处理函数,链式处理数组,路由对象,详见 mq.Handler
|
||||
* @return 返回路由对象本身
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
append(pattern: string, hdlr: Class_Handler): Class_Routing;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 添加一条路由规则
|
||||
* @param method 指定 http 请求方法,"*" 接受所有方法
|
||||
* @param pattern 消息匹配格式
|
||||
* @param hdlr 内置消息处理器,处理函数,链式处理数组,路由对象,详见 mq.Handler
|
||||
* @return 返回路由对象本身
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
append(method: string, pattern: string, hdlr: Class_Handler): Class_Routing;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 添加一组接受所有 http 方法路由规则
|
||||
* @param map 路由参数
|
||||
* @return 返回路由对象本身
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
all(map: Object): Class_Routing;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 添加一条接受所有 http 方法路由规则
|
||||
* @param pattern 消息匹配格式
|
||||
* @param hdlr 内置消息处理器,处理函数,链式处理数组,路由对象,详见 mq.Handler
|
||||
* @return 返回路由对象本身
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
all(pattern: string, hdlr: Class_Handler): Class_Routing;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 添加一组 GET 方法路由规则
|
||||
* @param map 路由参数
|
||||
* @return 返回路由对象本身
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
get(map: Object): Class_Routing;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 添加一条接受 http GET 方法路由规则
|
||||
* @param pattern 消息匹配格式
|
||||
* @param hdlr 内置消息处理器,处理函数,链式处理数组,路由对象,详见 mq.Handler
|
||||
* @return 返回路由对象本身
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
get(pattern: string, hdlr: Class_Handler): Class_Routing;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 添加一组接受 http POST 方法路由规则
|
||||
* @param map 路由参数
|
||||
* @return 返回路由对象本身
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
post(map: Object): Class_Routing;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 添加一条接受 http POST 方法路由规则
|
||||
* @param pattern 消息匹配格式
|
||||
* @param hdlr 内置消息处理器,处理函数,链式处理数组,路由对象,详见 mq.Handler
|
||||
* @return 返回路由对象本身
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
post(pattern: string, hdlr: Class_Handler): Class_Routing;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 添加一组接受 http DELETE 方法路由规则
|
||||
* @param map 路由参数
|
||||
* @return 返回路由对象本身
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
del(map: Object): Class_Routing;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 添加一条接受 http DELETE 方法路由规则
|
||||
* @param pattern 消息匹配格式
|
||||
* @param hdlr 内置消息处理器,处理函数,链式处理数组,路由对象,详见 mq.Handler
|
||||
* @return 返回路由对象本身
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
del(pattern: string, hdlr: Class_Handler): Class_Routing;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 添加一组 PUT 方法路由规则
|
||||
* @param map 路由参数
|
||||
* @return 返回路由对象本身
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
put(map: Object): Class_Routing;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 添加一条接受 http PUT 方法路由规则
|
||||
* @param pattern 消息匹配格式
|
||||
* @param hdlr 内置消息处理器,处理函数,链式处理数组,路由对象,详见 mq.Handler
|
||||
* @return 返回路由对象本身
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
put(pattern: string, hdlr: Class_Handler): Class_Routing;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 添加一组 PATCH 方法路由规则
|
||||
* @param map 路由参数
|
||||
* @return 返回路由对象本身
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
patch(map: Object): Class_Routing;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 添加一条接受 http PATCH 方法路由规则
|
||||
* @param pattern 消息匹配格式
|
||||
* @param hdlr 内置消息处理器,处理函数,链式处理数组,路由对象,详见 mq.Handler
|
||||
* @return 返回路由对象本身
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
patch(pattern: string, hdlr: Class_Handler): Class_Routing;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 添加一组 FIND 方法路由规则
|
||||
* @param map 路由参数
|
||||
* @return 返回路由对象本身
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
find(map: Object): Class_Routing;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 添加一条接受 http FIND 方法路由规则
|
||||
* @param pattern 消息匹配格式
|
||||
* @param hdlr 内置消息处理器,处理函数,链式处理数组,路由对象,详见 mq.Handler
|
||||
* @return 返回路由对象本身
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
find(pattern: string, hdlr: Class_Handler): Class_Routing;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+66
@@ -0,0 +1,66 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief sqlite 数据库连接对象
|
||||
* @detail 使用 db.open 或 db.openSQLite 创建,创建方式:,```JavaScript,var slite = db.openSQLite("sqlite:/path/to/db");,```
|
||||
*/
|
||||
/// <reference path="DbConnection.d.ts" />
|
||||
declare class Class_SQLite extends Class_DbConnection {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 当前数据库文件名
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
fileName: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置数据库超时时间,以毫秒为单位
|
||||
*
|
||||
*
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
timeout: number
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 备份当前数据库到新文件
|
||||
* @param fileName 指定备份的数据库文件名
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
backup(fileName: string): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+177
@@ -0,0 +1,177 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 安全沙箱对象,用于管理一个独立的运行空间
|
||||
* @detail 所有的代码都运行在自己的沙箱中,全局的 require 会调用当前沙箱加载模块,沙箱会通过 require 传递给加载的沙箱。下面的示例创建一个沙箱,限制只允许访问全局基础模块中的 assert 模块,并添加 a 和 b 两个定制模块:,```JavaScript,var vm = require('vm');,var sbox = new vm.SandBox({, a: 100,, b: 200,, assert: require('assert'),});,,var mod_in_sbox = sbox.require('./path/to/mod');,```
|
||||
*/
|
||||
|
||||
declare class Class_SandBox extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询沙箱的 global 对象
|
||||
*
|
||||
* @readonly
|
||||
* @type Object
|
||||
*/
|
||||
|
||||
global: Object
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 构造一个新的安全沙箱对象,并初始化基础模块
|
||||
* @param mods 指定要添加的模块对象字典
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(mods: Object);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 构造一个新的安全沙箱对象,并初始化基础模块
|
||||
* @param mods 指定要添加的模块对象字典
|
||||
* @param require 自定义 require 函数,当模块不存在时,先调用自定义函数,无返回再从文件中加载
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(mods: Object, require: Function);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 构造一个独立 Global 新的安全沙箱对象,并初始化基础模块
|
||||
* @param mods 指定要添加的模块对象字典
|
||||
* @param global 指定初始化的 Global 属性
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(mods: Object, global: Object);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 构造一个独立 Global 新的安全沙箱对象,并初始化基础模块
|
||||
* @param mods 指定要添加的模块对象字典
|
||||
* @param require 自定义 require 函数,当模块不存在时,先调用自定义函数,无返回再从文件中加载
|
||||
* @param global 指定初始化的 Global 属性
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(mods: Object, require: Function, global: Object);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 向沙箱中添加一个基础模块
|
||||
* @param id 指定要添加的模块名称,此路径与当前运行脚本无关,必须为绝对路径或者模块名
|
||||
* @param mod 指定要添加的模块对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
add(id: string, mod: any): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 向沙箱中添加一组基础模块
|
||||
* @param mods 指定要添加的模块对象字典,添加的 javascript 模块将会生成一份复制,以避免沙箱修改对象产生互相干扰
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
add(mods: Object): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 向沙箱中添加一个脚本模块
|
||||
* @param srcname 指定要添加的脚本名称,srcname 必须包含扩展名,比如 json 或者 js, jsc
|
||||
* @param script 指定要添加的二进制代码
|
||||
* @return 返回加载的模块对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
addScript(srcname: string, script: Class_Buffer): any;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 从沙箱中删除指定的基础模块
|
||||
* @param id 指定要删除的模块名称,此路径与当前运行脚本无关,必须为绝对路径或者模块名
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
remove(id: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 复制当前沙箱,新沙箱包含当前沙箱的模块,以及相同的名称和 require 函数
|
||||
* @return 复制的新沙箱
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
clone(): Class_SandBox;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 运行一个脚本
|
||||
* @param fname 指定要运行的脚本路径,此路径与当前运行脚本无关,必须为绝对路径
|
||||
* @param argv 指定要运行的参数,此参数可在脚本内使用 argv 获取
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
run(fname: string, argv?: any[]/** = v8::Array::New(isolate)*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询一个模块并返回模块完整文件名
|
||||
* @param id 指定要加载的模块名称
|
||||
* @param base 指定查找路径
|
||||
* @return 返回加载的模块完整文件名
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
resolve(id: string, base: string): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 加载一个模块并返回模块对象
|
||||
* @param id 指定要加载的模块名称
|
||||
* @param base 指定查找路径
|
||||
* @return 返回加载的模块对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
require(id: string, base: string): any;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 可移动当前指针的流对象接口
|
||||
* @detail
|
||||
*/
|
||||
/// <reference path="Stream.d.ts" />
|
||||
declare class Class_SeekableStream extends Class_Stream {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 移动文件当前操作位置
|
||||
* @param offset 指定新的位置
|
||||
* @param whence 指定位置基准,允许的值为:SEEK_SET, SEEK_CUR, SEEK_END
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
seek(offset: number, whence: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询流当前位置
|
||||
* @return 返回流当前位置
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
tell(): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 移动当前位置到流开头
|
||||
*
|
||||
*
|
||||
*/
|
||||
rewind(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询流尺寸
|
||||
* @return 返回流尺寸
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
size(): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 从流内读取剩余的全部数据
|
||||
* @return 返回从流内读取的数据,若无数据可读,或者连接中断,则返回 null
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
readAll(): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 修改文件尺寸,如果新尺寸小于原尺寸,则文件被截断
|
||||
* @param bytes 新的文件尺寸
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
truncate(bytes: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询文件是否到结尾
|
||||
* @return 返回 True 表示结尾
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
eof(): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询当前文件的基础信息
|
||||
* @return 返回 Stat 对象描述文件信息
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
stat(): Class_Stat;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+69
@@ -0,0 +1,69 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 纤程信号量对象
|
||||
* @detail 信号量对象管理一个内部计数器,此计数器调用 acquire 或者 wait 后减一,调用 release 或者 post 后加一。,计数器不会减至负数,因为 acquire 和 wait 在发现数值为 0 的时候,会休眠当前纤程,直至其它纤程通过 release 或 post 增加计数器的值。,,信号量常用的场合是限制资源并发使用,以及生产者/消费者模式的应用。,,以数据库请求为例,限制资源并发使用的情形:,```JavaScript,var maxconnections = 5;,var l = new coroutine.Semaphore(maxconnections);,,......,,l.acquire();,var conn = connectdb(),.....,conn.close();,l.release();,```,,生产者/消费者模式通常则将信号量与队列配合使用。生产者向队列中加入数据,并 post 一个信号,消费者则先 wait 信号,获取信号后去队查询取数据。
|
||||
*/
|
||||
/// <reference path="Lock.d.ts" />
|
||||
declare class Class_Semaphore extends Class_Lock {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 信号量构造函数
|
||||
* @param value 计数器初始数值
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(value?: number/** = 1*/);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 等待一个信号量,等同于 acquire(true)
|
||||
*
|
||||
*
|
||||
*/
|
||||
wait(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 释放一个信号量,等同于 release()
|
||||
*
|
||||
*
|
||||
*/
|
||||
post(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 尝试获取一个信号,如不能获取,则立即返回并返回 false,等同于 acquire(false)
|
||||
* @return 获取成功则返回 true
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
trywait(): boolean;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+176
@@ -0,0 +1,176 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 系统服务管理对象
|
||||
* @detail
|
||||
*/
|
||||
/// <reference path="EventEmitter.d.ts" />
|
||||
declare class Class_Service extends Class_EventEmitter {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置服务名称
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
name: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和绑定服务停止事件,相当于 on("stop", func);
|
||||
*
|
||||
*
|
||||
* @type Function
|
||||
*/
|
||||
|
||||
onstop: Function
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和绑定服务暂停事件,相当于 on("pause", func);
|
||||
*
|
||||
*
|
||||
* @type Function
|
||||
*/
|
||||
|
||||
onpause: Function
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和绑定服务恢复事件,相当于 on("continue", func);
|
||||
*
|
||||
*
|
||||
* @type Function
|
||||
*/
|
||||
|
||||
oncontinue: Function
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 系统服务管理对象构造函数
|
||||
* @param name 服务名称
|
||||
* @param worker 服务运行函数
|
||||
* @param event 服务事件处理
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(name: string, worker: Function, event?: Object/** = v8::Object::New(isolate)*/);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 开始运行服务实体
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
run(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 安装服务到系统
|
||||
* @param name 服务名称
|
||||
* @param cmd 服务命令行
|
||||
* @param displayName 服务显示名称
|
||||
* @param description 服务描述信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
static install(name: string, cmd: string, displayName?: string/** = ""*/, description?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 从系统中卸载服务
|
||||
* @param name 服务名称
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
static remove(name: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 启动服务
|
||||
* @param name 服务名称
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
static start(name: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 停止服务
|
||||
* @param name 服务名称
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
static stop(name: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 重启服务
|
||||
* @param name 服务名称
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
static restart(name: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 检测服务是否安装
|
||||
* @param name 服务名称
|
||||
* @return 服务安装返回 True
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
static isInstalled(name: string): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 检测服务是否运行
|
||||
* @param name 服务名称
|
||||
* @return 服务运行返回 True
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
static isRunning(name: string): boolean;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+146
@@ -0,0 +1,146 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief Smtp对象
|
||||
* @detail
|
||||
*/
|
||||
|
||||
declare class Class_Smtp extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置超时时间 单位毫秒
|
||||
*
|
||||
*
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
timeout: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询 Smtp 对象当前连接的 Socket
|
||||
*
|
||||
* @readonly
|
||||
* @type Stream
|
||||
*/
|
||||
|
||||
socket: Class_Stream
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Smtp 对象构造函数
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor();
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 建立到指定的服务器
|
||||
* @param url 指定连接的协议,可以是:tcp://host:port 或者 ssl://host:port
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
connect(url: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 发送指定命令,并返回响应,服务器报错则抛出错误
|
||||
* @param cmd 命令名
|
||||
* @param arg 参数
|
||||
* @return 如果成功,返回服务器响应
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
command(cmd: string, arg: string): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 发送 HELO 命令,服务器报错则抛出错误
|
||||
* @param hostname 主机名,缺省为“localhost”
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
hello(hostname?: string/** = "localhost"*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 用指定的用户及密码登录服务器,服务器报错则抛出错误
|
||||
* @param username 用户名
|
||||
* @param password 密码
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
login(username: string, password: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定发件人信箱,服务器报错则抛出错误
|
||||
* @param address 发件人信箱
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
from(address: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定收件人信箱,服务器报错则抛出错误
|
||||
* @param address 收件人信箱
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
to(address: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 发送文本到收件人,服务器报错则抛出错误
|
||||
* @param txt 要发送的文本
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
data(txt: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 退出并关闭连接,服务器报错则抛出错误
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
quit(): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+232
@@ -0,0 +1,232 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 网络套接口对象
|
||||
* @detail Socket 属于 net 模块,创建方法,```JavaScript,var s = new net.Socket();,```
|
||||
*/
|
||||
/// <reference path="Stream.d.ts" />
|
||||
declare class Class_Socket extends Class_Stream {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询当前 Socket 对象的地址集
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
family: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询当前 Socket 对象的协议族
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
type: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询当前连接的对方地址
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
remoteAddress: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询当前连接的对方端口
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
remotePort: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询当前连接的本地地址
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
localAddress: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询当前连接的本地端口
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
localPort: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置超时时间 单位毫秒
|
||||
*
|
||||
*
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
timeout: number
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Socket 构造函数,创建一个新的 Socket 对象
|
||||
* @param family 指定地址集,缺省为 AF_INET,ipv4
|
||||
* @param type 指定协议族,缺省为 SOCK_STREAM,tcp
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(family?: number/** = undefined*/, type?: number/** = undefined*/);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 建立一个 tcp 连接
|
||||
* @param host 指定对方地址或主机名
|
||||
* @param port 指定对方端口
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
connect(host: string, port: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将当前 Socket 绑定至本地所有地址的指定端口
|
||||
* @param port 指定绑定的端口
|
||||
* @param allowIPv4 指定是否接受 ipv4 连接,缺省为 true。本参数在 ipv6 时有效,并依赖于操作系统
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
bind(port: number, allowIPv4?: boolean/** = true*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将当前 Socket 绑定至指定地址的指定端口
|
||||
* @param addr 指定绑定的地址
|
||||
* @param port 指定绑定的端口
|
||||
* @param allowIPv4 指定是否接受 ipv4 连接,缺省为 true。本参数在 ipv6 时有效,并依赖于操作系统
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
bind(addr: string, port: number, allowIPv4?: boolean/** = true*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 开始监听连接请求
|
||||
* @param backlog 指定请求队列长度,超出的请求将被拒绝,缺省为 120
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
listen(backlog?: number/** = 120*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 等待并接受一个连接
|
||||
* @return 返回接收到得连接对象
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
accept(): Class_Socket;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 从连接读取指定大小的数据,不同于 read 方法,recv 并不保证读完要求的数据,而是在读取到数据后立即返回
|
||||
* @param bytes 指定要读取的数据量,缺省读取任意尺寸的数据
|
||||
* @return 返回从连接读取的数据
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
recv(bytes?: number/** = -1*/): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 读取一个 UDP 包
|
||||
* recvfrom 返回结果中包含以下内容:
|
||||
* - data: 接收到的二进制数据块
|
||||
* - address: 发送方的地址
|
||||
* - port: 发送方的端口
|
||||
* @param bytes 指定要读取的数据量,缺省读取任意尺寸的数据
|
||||
* @return 返回从连接读取的数据包
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
recvfrom(bytes?: number/** = -1*/): any;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将给定的数据写入连接,此方法等效于 write 方法
|
||||
* @param data 给定要写入的数据
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
send(data: Class_Buffer): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 向给定 ip:port 发送一个 UDP 包
|
||||
* @param data 给定要写入的数据
|
||||
* @param host 指定目标 ip 或主机名
|
||||
* @param port 指定目标端口
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
sendto(data: Class_Buffer, host: string, port: number): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+106
@@ -0,0 +1,106 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief ssl 协议转换处理器
|
||||
* @detail 用以将数据流转换为 ssl 流协议。SslHandler 是对 SslSocket 的封装,用于构建服务器,逻辑上相当于:,```JavaScript,var ss = new ssl.Socket(crt, key);,,function(s){, var s1 = ss.accept(s);, hdlr.invoke(s1);, s1.close();,},```
|
||||
*/
|
||||
/// <reference path="Handler.d.ts" />
|
||||
declare class Class_SslHandler extends Class_Handler {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 设定证书验证模式,缺省为 VERIFY_NONE
|
||||
*
|
||||
*
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
verification: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 客户端证书验证证书链
|
||||
*
|
||||
* @readonly
|
||||
* @type X509Cert
|
||||
*/
|
||||
|
||||
ca: Class_X509Cert
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief ssl 协议转换处理器当前事件处理接口对象
|
||||
*
|
||||
*
|
||||
* @type Handler
|
||||
*/
|
||||
|
||||
handler: Class_Handler
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief SslHandler 构造函数,创建一个新的 SslHandler 对象
|
||||
*
|
||||
* certs 格式为:
|
||||
* ```JavaScript
|
||||
* [
|
||||
* {
|
||||
* crt: [X509Cert object],
|
||||
* key: [PKey object]
|
||||
* },
|
||||
* {
|
||||
* crt: [X509Cert object],
|
||||
* key: [PKey object]
|
||||
* }
|
||||
* ]
|
||||
* ```
|
||||
* @param certs 服务器证书列表
|
||||
* @param hdlr 内置消息处理器,处理函数,链式处理数组,路由对象,详见 mq.Handler
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(certs: any[], hdlr: Class_Handler);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief SslHandler 构造函数,创建一个新的 SslHandler 对象
|
||||
* @param crt X509Cert 证书,用于客户端验证服务器
|
||||
* @param key PKey 私钥,用于与客户端会话
|
||||
* @param hdlr 内置消息处理器,处理函数,链式处理数组,路由对象,详见 mq.Handler
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(crt: Class_X509Cert, key: Class_PKey, hdlr: Class_Handler);
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+137
@@ -0,0 +1,137 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief ssl 服务器对象,可方便创建一个标准多纤程 ssl 服务器
|
||||
* @detail SslServer 对象是将 TcpServer 和 SslHandler 组合封装的对象,方便快速搭建服务器,逻辑上相当于:,```JavaScript,var svr = new net.SslServer(addr, port, new ssl.Handler(crt, key, function(req){, ...,}));,```,,创建方法:,```JavaScript,var ssl = require("ssl");,var svr = new http.Server(crt, key, function(req){, ...,});,```
|
||||
*/
|
||||
/// <reference path="TcpServer.d.ts" />
|
||||
declare class Class_SslServer extends Class_TcpServer {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 设定证书验证模式,缺省为 VERIFY_NONE
|
||||
*
|
||||
*
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
verification: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 客户端证书验证证书链
|
||||
*
|
||||
* @readonly
|
||||
* @type X509Cert
|
||||
*/
|
||||
|
||||
ca: Class_X509Cert
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief SslServer 构造函数,在所有本机地址侦听
|
||||
*
|
||||
* certs 格式为:
|
||||
* ```JavaScript
|
||||
* [
|
||||
* {
|
||||
* crt: [X509Cert object],
|
||||
* key: [PKey object]
|
||||
* },
|
||||
* {
|
||||
* crt: [X509Cert object],
|
||||
* key: [PKey object]
|
||||
* }
|
||||
* ]
|
||||
* ```
|
||||
* @param certs 服务器证书列表
|
||||
* @param port 指定 ssl 服务器侦听端口
|
||||
* @param listener 指定 ssl 接收到的内置消息处理器,处理函数,链式处理数组,路由对象,详见 mq.Handler
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(certs: any[], port: number, listener: Class_Handler);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief SslServer 构造函数
|
||||
*
|
||||
* certs 格式为:
|
||||
* ```JavaScript
|
||||
* [
|
||||
* {
|
||||
* crt: [X509Cert object],
|
||||
* key: [PKey object]
|
||||
* },
|
||||
* {
|
||||
* crt: [X509Cert object],
|
||||
* key: [PKey object]
|
||||
* }
|
||||
* ]
|
||||
* ```
|
||||
* @param certs 服务器证书列表
|
||||
* @param addr 指定 ssl 服务器侦听地址,为 "" 则在本机所有地址侦听
|
||||
* @param port 指定 ssl 服务器侦听端口
|
||||
* @param listener 指定 ssl 接收到的连接的内置消息处理器,处理函数,链式处理数组,路由对象,详见 mq.Handler
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(certs: any[], addr: string, port: number, listener: Class_Handler);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief SslServer 构造函数,在所有本机地址侦听
|
||||
* @param crt X509Cert 证书,用于客户端验证服务器
|
||||
* @param key PKey 私钥,用于与客户端会话
|
||||
* @param port 指定 ssl 服务器侦听端口
|
||||
* @param listener 指定 ssl 接收到的内置消息处理器,处理函数,链式处理数组,路由对象,详见 mq.Handler
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(crt: Class_X509Cert, key: Class_PKey, port: number, listener: Class_Handler);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief SslServer 构造函数
|
||||
* @param crt X509Cert 证书,用于客户端验证服务器
|
||||
* @param key PKey 私钥,用于与客户端会话
|
||||
* @param addr 指定 ssl 服务器侦听地址,为 "" 则在本机所有地址侦听
|
||||
* @param port 指定 ssl 服务器侦听端口
|
||||
* @param listener 指定 ssl 接收到的连接的内置消息处理器,处理函数,链式处理数组,路由对象,详见 mq.Handler
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(crt: Class_X509Cert, key: Class_PKey, addr: string, port: number, listener: Class_Handler);
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+139
@@ -0,0 +1,139 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief ssl 网络套接口对象
|
||||
* @detail SslSocket 属于 ssl 模块,创建方法,```JavaScript,var s = new ssl.Socket();,```
|
||||
*/
|
||||
/// <reference path="Stream.d.ts" />
|
||||
declare class Class_SslSocket extends Class_Stream {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 设定证书验证模式,缺省为 VERIFY_REQUIRED
|
||||
*
|
||||
*
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
verification: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 证书链,客户端模式 connect 时自动引用 ssl.ca,服务器模式 accept 生成 SslSocket 自动引用当前 SslSocket 的 ca
|
||||
*
|
||||
* @readonly
|
||||
* @type X509Cert
|
||||
*/
|
||||
|
||||
ca: Class_X509Cert
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 连接对方的证书
|
||||
*
|
||||
* @readonly
|
||||
* @type X509Cert
|
||||
*/
|
||||
|
||||
peerCert: Class_X509Cert
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询消息 ssl 建立时的下层流对象
|
||||
*
|
||||
* @readonly
|
||||
* @type Stream
|
||||
*/
|
||||
|
||||
stream: Class_Stream
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief SslSocket 构造函数,创建一个新的 SslSocket 对象
|
||||
*
|
||||
* certs 格式为:
|
||||
* ```JavaScript
|
||||
* [
|
||||
* {
|
||||
* crt: [X509Cert object],
|
||||
* key: [PKey object]
|
||||
* },
|
||||
* {
|
||||
* crt: [X509Cert object],
|
||||
* key: [PKey object]
|
||||
* }
|
||||
* ]
|
||||
* ```
|
||||
* @param certs 服务器证书列表
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(certs?: any[]/** = v8::Array::New(isolate)*/);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief SslSocket 构造函数,创建一个新的 SslSocket 对象
|
||||
* @param crt X509Cert 证书,用于客户端验证服务器
|
||||
* @param key PKey 私钥,用于与客户端会话
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(crt: Class_X509Cert, key: Class_PKey);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 在给定的连接上连接 ssl 连接,客户端模式
|
||||
* @param s 给定的底层连接
|
||||
* @param server_name 指定服务器名称,可缺省
|
||||
* @return 连接成功返回 0,证书可选验证时,验证不成功则返回非 0,详细错误见 ssl 模块
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
connect(s: Class_Stream, server_name?: string/** = ""*/): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 在给定的连接上接收一个 ssl 连接,并生成一个新的 SslSocket
|
||||
* @param s 给定的底层连接
|
||||
* @return 返回新建立的 SslSocket 对象
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
accept(s: Class_Stream): Class_SslSocket;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+219
@@ -0,0 +1,219 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 文件的基础信息对象
|
||||
* @detail Stat 对象通过 fs.stat, File.stat, fs.readdir 查询,不可独立创建
|
||||
*/
|
||||
|
||||
declare class Class_Stat extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 文件名称
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
name: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 文件尺寸
|
||||
*
|
||||
* @readonly
|
||||
* @type Long
|
||||
*/
|
||||
|
||||
size: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 文件权限,Windows 不支持此属性
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
mode: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 文件最后修改时间
|
||||
*
|
||||
* @readonly
|
||||
* @type Date
|
||||
*/
|
||||
|
||||
mtime: Date
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 文件最后访问时间
|
||||
*
|
||||
* @readonly
|
||||
* @type Date
|
||||
*/
|
||||
|
||||
atime: Date
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 文件创建时间
|
||||
*
|
||||
* @readonly
|
||||
* @type Date
|
||||
*/
|
||||
|
||||
ctime: Date
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 文件拥有者的id
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
uid: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 文件所属的组id
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
gid: number
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询文件是否有写入权限
|
||||
* @return 为 true 则有写入权限
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
isWritable(): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询文件是否有读权限
|
||||
* @return 为 true 则有读权限
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
isReadable(): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询文件是否有执行权限
|
||||
* @return 为 true 则有执行权限
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
isExecutable(): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询文件是否隐藏
|
||||
* @return 为 true 则隐藏
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
isHidden(): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询文件是否是目录
|
||||
* @return 为 true 则是目录
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
isDirectory(): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询文件是否是文件
|
||||
* @return 为 true 则是文件
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
isFile(): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询文件是否是符号链接
|
||||
* @return 为 true 则是符号链接
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
isSymbolicLink(): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询文件是否是内存文件
|
||||
* @return 为 true 则是内存文件
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
isMemory(): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询文件是否是 Socket
|
||||
* @return 为 true 则是 Socket
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
isSocket(): boolean;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+103
@@ -0,0 +1,103 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 数据统计对象,用以构建应用运行时数据收集
|
||||
* @detail 创建方法:,```JavaScript,var util = require("util");,var stats = new util.Stats(["begin", "end", "error"]);,```,一些内部对象会提供预先定义的的统计对象
|
||||
*/
|
||||
|
||||
declare class Class_Stats extends Class__object {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 数据统计对象构造方法
|
||||
* @param keys 指定计数器的名称
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(keys: any[]);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 数据统计对象构造方法
|
||||
* @param staticKeys 指定静态计数器的名称,静态计数器不会被 reset
|
||||
* @param keys 指定计数器的名称
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(staticKeys: any[], keys: any[]);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定的计数器增一
|
||||
* @param key 指定计数器名称
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
inc(key: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定的计数器减一
|
||||
* @param key 指定计数器名称
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
dec(key: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定的计数器加指定值
|
||||
* @param key 指定计数器名称
|
||||
* @param value 指定数值
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
add(key: string, value: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 初始化计数器,除 staticKeys 指定的计数器全部清零
|
||||
*
|
||||
*
|
||||
*/
|
||||
reset(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询上次 reset 到现在的运行时间
|
||||
* @return 返回上次 reset 到现在的运行时间
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
uptime(): number;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+82
@@ -0,0 +1,82 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 流操作对象,用于二进制数据流读写
|
||||
* @detail Stream 为基础对象,用于为流处理定义标准借口,不能独立创建
|
||||
*/
|
||||
|
||||
declare class Class_Stream extends Class__object {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 从流内读取指定大小的数据
|
||||
* @param bytes 指定要读取的数据量,缺省为读取随机大小的数据块,读出的数据尺寸取决于设备
|
||||
* @return 返回从流内读取的数据,若无数据可读,或者连接中断,则返回 null
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
read(bytes?: number/** = -1*/): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将给定的数据写入流
|
||||
* @param data 给定要写入的数据
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
write(data: Class_Buffer): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将文件缓冲区内容写入物理设备
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
flush(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 关闭当前流对象
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
close(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 复制流数据到目标流中
|
||||
* @param stm 目标流对象
|
||||
* @param bytes 复制的字节数
|
||||
* @return 返回复制的字节数
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
copyTo(stm: Class_Stream, bytes?: number/** = -1*/): number;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
+146
@@ -0,0 +1,146 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 流解码对象
|
||||
* @detail
|
||||
*/
|
||||
|
||||
declare class Class_StringDecoder extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 内部使用。
|
||||
*
|
||||
*
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
lastNeed: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 内部使用。
|
||||
*
|
||||
*
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
lastTotal: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 内部使用。
|
||||
*
|
||||
*
|
||||
* @type Buffer
|
||||
*/
|
||||
|
||||
lastChar: Class_Buffer
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 解码编码.内部使用。
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
encoding: string
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 解码器构造函数
|
||||
* @param encoding 解码编码. 默认 'utf8'.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(encoding?: string/** = "utf8"*/);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将内部存留的 buffer 作为字符返回。不完整的 UTF-8 和 UTF-16 字节会尝试补全。
|
||||
* @return 解码后的字符串.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
end(): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将内部存留的 buffer 作为字符返回。不完整的 UTF-8 和 UTF-16 字节会尝试补全。
|
||||
* @param buf 需要解码的 Buffer. 在执行 end 之前,会先调用 write 将 buffer 写入。
|
||||
* @return 解码后的字符串.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
end(buf: Class_Buffer): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回一个解码后的字符串, 确保任何非完整的末尾字符被省略此次不返回,并被存储在内部供下一次的 write 或者 end 方法使用。
|
||||
* @param buf 需要解码的 Buffer。
|
||||
* @return 解码后的字符串.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
write(buf: Class_Buffer): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 内部使用。.
|
||||
* @param buf 需要解码的 Buffer。
|
||||
* @param offset 解码偏移量
|
||||
* @return 解码后的字符串.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
text(buf: Class_Buffer, offset: number): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 内部使用。.
|
||||
* @param buf A Buffer containing the bytes to decode.
|
||||
* @return 解码后的字符串.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
fillLast(buf: Class_Buffer): string;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+103
@@ -0,0 +1,103 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 子进程对象
|
||||
* @detail ```JavaScript,var process = require("process");,var sub = process.open("ls");,```
|
||||
*/
|
||||
/// <reference path="BufferedStream.d.ts" />
|
||||
declare class Class_SubProcess extends Class_BufferedStream {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 读取当前对象指向的进程的 id
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
pid: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 读取当前对象指向的进程的标准输入对象
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type BufferedStream
|
||||
*/
|
||||
|
||||
stdin: Class_BufferedStream
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 读取当前对象指向的进程的标准输出对象
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type BufferedStream
|
||||
*/
|
||||
|
||||
stdout: Class_BufferedStream
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 杀掉当前对象指向的进程,并传递信号
|
||||
* @param signal 传递的信号
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
kill(signal: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 等待当前对象指向的进程结束,并返回进程结束代码
|
||||
* @return 进程的结束代码
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
wait(): number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询当前对象所指向的进程是否存在指定名称的窗口,仅限 windows
|
||||
* @param name 窗口名称
|
||||
* @return 窗口存在则返回窗口的 rect,否则返回 undefined
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
findWindow(name: string): any;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+127
@@ -0,0 +1,127 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief tcp 服务器对象,可方便创建一个标准多纤程 tcp 服务器
|
||||
* @detail 使用 TcpServer 对象可以迅速创建一个多纤程并发处理的 tcp 服务器。,```JavaScript,function func(conn),{, var data;,, while(data = conn.read()), conn.write(data);,, conn.close();,},,new net.TcpServer(8080, func).run();,```
|
||||
*/
|
||||
|
||||
declare class Class_TcpServer extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 服务器当前侦听的 Socket 对象
|
||||
*
|
||||
* @readonly
|
||||
* @type Socket
|
||||
*/
|
||||
|
||||
socket: Class_Socket
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 服务器当前事件处理接口对象
|
||||
*
|
||||
*
|
||||
* @type Handler
|
||||
*/
|
||||
|
||||
handler: Class_Handler
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询当前服务器运行状态
|
||||
*
|
||||
* 返回的结果为一个 Stats 对象,初始化计数器如下:
|
||||
* ```JavaScript
|
||||
* {
|
||||
* total : 1000, // 总计处理的连接
|
||||
* connections : 100, // 当前正在处理的连接
|
||||
* accept : 10, // 上次查询后新建的连接
|
||||
* close : 10 // 上次查询后关闭的连接
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type Stats
|
||||
*/
|
||||
|
||||
stats: Class_Stats
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief TcpServer 构造函数,在所有本机地址侦听
|
||||
* @param port 指定 tcp 服务器侦听端口
|
||||
* @param listener 指定 tcp 接收到的内置消息处理器,处理函数,链式处理数组,路由对象,详见 mq.Handler
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(port: number, listener: Class_Handler);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief TcpServer 构造函数
|
||||
* @param addr 指定 tcp 服务器侦听地址,为 "" 则在本机所有地址侦听
|
||||
* @param port 指定 tcp 服务器侦听端口
|
||||
* @param listener 指定 tcp 接收到的连接的内置消息处理器,处理函数,链式处理数组,路由对象,详见 mq.Handler
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(addr: string, port: number, listener: Class_Handler);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 运行服务器并开始接收和分发连接,此函数不会返回
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
run(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 异步运行服务器并开始接收和分发连接,调用后立即返回,服务器在后台运行
|
||||
*
|
||||
*
|
||||
*/
|
||||
asyncRun(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 关闭 socket中止正在运行的服务器
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
stop(): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+73
@@ -0,0 +1,73 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 定时器处理器对象
|
||||
* @detail
|
||||
*/
|
||||
|
||||
declare class Class_Timer extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询当前定时器是否已经终止
|
||||
*
|
||||
* @readonly
|
||||
* @type Boolean
|
||||
*/
|
||||
|
||||
stopped: boolean
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 维持 fibjs 进程不退出,在定时器等待期间阻止 fibjs 进程退出
|
||||
* @return 返回定时器对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
ref(): Class_Timer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 允许 fibjs 进程退出,在定时器等待期间允许 fibjs 进程退出
|
||||
* @return 返回定时器对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
unref(): Class_Timer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 取消当前定时器
|
||||
*
|
||||
*
|
||||
*/
|
||||
clear(): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+279
@@ -0,0 +1,279 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief Url 处理对象
|
||||
* @detail 基础模块。提供 url 的格式化,解析与拼装,```JavaScript,var url = new net.Url('http://www.xici.net/');,var url = new net.Url({protocol: 'http:', hostname:'www.xici.net', pathname:'/'});,```
|
||||
*/
|
||||
|
||||
declare class Class_UrlObject extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置当前 UrlObject 对象中的完整 url 地址描述,此描述由其他所有属性组装而成
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
href: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置当前 UrlObject 对象中的协议名称
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
protocol: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置当前 UrlObject 对象是否包含双斜杠
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type Boolean
|
||||
*/
|
||||
|
||||
slashes: boolean
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置当前 UrlObject 对象中的完整验证字符串,由 username 和 password 属性组装而成
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
auth: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置当前 UrlObject 对象中的验证用户
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
username: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置当前 UrlObject 对象中的验证密码
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
password: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置当前 UrlObject 对象中的完整主机描述,由 hastname 和 port 组装而成
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
host: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置当前 UrlObject 对象中的主机名
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
hostname: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置当前 UrlObject 对象中的端口号
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
port: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置当前 UrlObject 对象中的请求完整路径(含请求),由 pathname 和 query 组装而成
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
path: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置当前 UrlObject 对象中的路径
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
pathname: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置当前 UrlObject 对象中的请求字符串(含“?”),等效于“?”+query
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
search: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置当前 UrlObject 对象中的请求字符串( 不含“?”)
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type Value
|
||||
*/
|
||||
|
||||
query: any
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置当前 UrlObject 对象中的请求锚点(含“\#”)
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
hash: string
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief UrlObject 对象构造函数,使用参数构造
|
||||
* @param args 指定构造参数的字典对象,支持的字段有:protocol, slashes, username, password, hostname, port, pathname, query, hash
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(args: Object);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief UrlObject 对象构造函数,使用 url 字符串构造
|
||||
* @param url 指定构造 url 字符串
|
||||
* @param parseQueryString 指定是否解析 query
|
||||
* @param slashesDenoteHost 默认为false, 如果设置为true,则从字符串'//'之后到下一个'/'之前的字符串会被解析为host,例如'//foo/bar', 结果应该是{host: 'foo', pathname: '/bar'}而不是{pathname: '//foo/bar'}
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(url?: string/** = ""*/, parseQueryString?: boolean/** = false*/, slashesDenoteHost?: boolean/** = false*/);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 解析一个 url 字符串
|
||||
* @param url 指定需要解析的 url 字符串
|
||||
* @param parseQueryString 指定是否解析 query
|
||||
* @param slashesDenoteHost 默认为false, 如果设置为true,则从字符串'//'之后到下一个'/'之前的字符串会被解析为host,例如'//foo/bar', 结果应该是{host: 'foo', pathname: '/bar'}而不是{pathname: '//foo/bar'}
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
parse(url: string, parseQueryString?: boolean/** = false*/, slashesDenoteHost?: boolean/** = false*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 使用指定的参数构造 UrlObject
|
||||
* @param args 指定构造参数的字典对象,支持的字段有:protocol, slashes, username, password, hostname, port, pathname, query, hash
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
format(args: Object): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 重定位 url 路径,自动识别新路径为相对路径还是绝对路径
|
||||
* @param url 指定新的路径
|
||||
* @return 返回包含重定位数据的对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
resolve(url: string): Class_UrlObject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 标准化路径
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
normalize(): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+192
@@ -0,0 +1,192 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief WebSocket 包协议转换处理器
|
||||
* @detail 用以将 Http 协议转换为 WebSocket 包协议消息。创建方式:,```JavaScript,var ws = require('ws');,var http = require('http');,,var serv = new http.Server(8811, ws.upgrade((conn) => {,conn.onmessage = msg => {, conn.send(new Date());,};,}));,,serv.run(r => 0);,,var sock = new ws.Socket('ws://127.0.0.1:8811');,sock.on('open', () => {, setInterval(() => {, sock.send('get date');, }, 1000);,});,,sock.onmessage = evt => {, console.log(evt.data);,},```
|
||||
*/
|
||||
/// <reference path="EventEmitter.d.ts" />
|
||||
declare class Class_WebSocket extends Class_EventEmitter {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询当前对象连接的服务器
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
url: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询当前对象连接时的协议
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
protocol: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询当前对象连接的源
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
origin: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询当前对象的连接状态,参见 ws
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
readyState: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和绑定连接成功事件,相当于 on("open", func);
|
||||
*
|
||||
*
|
||||
* @type Function
|
||||
*/
|
||||
|
||||
onopen: Function
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和绑定接受到对方消息的事件,相当于 on("message", func);
|
||||
*
|
||||
*
|
||||
* @type Function
|
||||
*/
|
||||
|
||||
onmessage: Function
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和绑定连接关闭的事件,相当于 on("close", func);
|
||||
*
|
||||
*
|
||||
* @type Function
|
||||
*/
|
||||
|
||||
onclose: Function
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和绑定错误发生的事件,相当于 on("error", func);
|
||||
*
|
||||
*
|
||||
* @type Function
|
||||
*/
|
||||
|
||||
onerror: Function
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief WebSocket 构造函数
|
||||
* @param url 指定连接的服务器
|
||||
* @param protocol 指定握手协议,缺省为 ""
|
||||
* @param origin 指定握手时模拟的源
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(url: string, protocol?: string/** = ""*/, origin?: string/** = ""*/);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 关闭当前连接,此操作会向对方发送 CLOSE 数据包,并等待对方响应
|
||||
* @param code 指定关闭的代码,允许值为 3000-4999 或者 1000,缺省为 1000
|
||||
* @param reason 指定关闭的原因,缺省为 ""
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
close(code?: number/** = 1000*/, reason?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 向对方发送一段文本
|
||||
* @param data 指定发送的文本
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
send(data: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 向对方发送一段二进制数据
|
||||
* @param data 指定发送的二进制数据
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
send(data: Class_Buffer): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 维持 fibjs 进程不退出,在对象绑定期间阻止 fibjs 进程退出
|
||||
* @return 返回当前对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
ref(): Class_WebSocket;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 允许 fibjs 进程退出,在对象绑定期间允许 fibjs 进程退出
|
||||
* @return 返回当前对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
unref(): Class_WebSocket;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief websocket 消息对象
|
||||
* @detail 创建方法:,```JavaScript,var ws = require("ws");,,var msg = new ws.Message();,```
|
||||
*/
|
||||
/// <reference path="Message.d.ts" />
|
||||
declare class Class_WebSocketMessage extends Class_Message {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和读取 websocket 掩码标记,缺省为 true
|
||||
*
|
||||
*
|
||||
* @type Boolean
|
||||
*/
|
||||
|
||||
masked: boolean
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和读取 websocket 压缩状态,缺省为 false
|
||||
*
|
||||
*
|
||||
* @type Boolean
|
||||
*/
|
||||
|
||||
compress: boolean
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置最大包尺寸,以字节为单位,缺省为 67108864(64M)
|
||||
*
|
||||
*
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
maxSize: number
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 包处理消息对象构造函数
|
||||
* @param type websocket 消息类型,缺省为 websocket.BINARY
|
||||
* @param masked websocket 消息掩码,缺省为 true
|
||||
* @param compress 标记消息是否压缩,缺省为 false
|
||||
* @param maxSize 最大包尺寸,以 MB 为单位,缺省为 67108864(64M)
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(type?: number/** = undefined*/, masked?: boolean/** = true*/, compress?: boolean/** = false*/, maxSize?: number/** = 67108864*/);
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+172
@@ -0,0 +1,172 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 浏览器窗口对象
|
||||
* @detail WebView 是一个嵌入浏览器的窗口组件,目前仅支持 windows ie。,,由于 WebView 内的 JavaScript 程序与 fibjs 并不在同一个引擎内,所以如果需要与宿主程序进行通讯,需要通过消息进行。,,WebView 用于通讯的对象是 external,external 支持一个方法 postMessage 和两个事件 onmessage、onclose。,,一个简单的通讯示例代码如下:,```JavaScript,// index.js,var gui = require('gui');,var webview = gui.open('fs:index.html');,,webview.onmessage = msg => console.log(msg);,,webview.onload = evt => webview.postMessage("hello from fibjs");,,webview.wait();,```,,index.html 的内容如下:,```html,<script>, external.onclose = function() {, },, external.onmessage = function(msg){, external.postMessage("send back: " + msg);, };,</script>,```, 在用户窗口关闭之前,会触发 external.onclose 事件,external.onclose 可以决定是否关闭。如果 external.onclose 返回 false,则此次操作取消,否则将关闭窗口。,,以下的例子,会在用户点关闭后等待 5 秒后再关闭窗口。,```html,<script lang="JavaScript">, var bClose = false;, external.onclose = function () {, if (!bClose) {, setTimeout(function () {, bClose = true;, window.close();, }, 5000);, return false;, }, },</script>,```,上面的代码中,因为 window.close 本身也会触发 onclose 事件,所以需要增加一个开关变量,用于识别是否需要处理此次事件。
|
||||
*/
|
||||
/// <reference path="EventEmitter.d.ts" />
|
||||
declare class Class_WebView extends Class_EventEmitter {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置窗口是否显示
|
||||
*
|
||||
*
|
||||
* @type Boolean
|
||||
*/
|
||||
|
||||
visible: boolean
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和绑定加载成功事件,相当于 on("load", func);
|
||||
*
|
||||
*
|
||||
* @type Function
|
||||
*/
|
||||
|
||||
onload: Function
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和绑定窗口移动事件,相当于 on("move", func);
|
||||
*
|
||||
* 以下示例会在窗口移动时输出窗口的左上角坐标:
|
||||
* ```JavaScript
|
||||
* var gui = require('gui');
|
||||
* var webview = gui.open('fs:index.html');
|
||||
*
|
||||
* webview.onmove = evt => console.log(evt.left, evt.top);
|
||||
* ```
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type Function
|
||||
*/
|
||||
|
||||
onmove: Function
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和绑定窗口尺寸改变事件,相当于 on("size", func);
|
||||
*
|
||||
* 以下示例会在窗口改变大小时输出窗口的尺寸:
|
||||
* ```JavaScript
|
||||
* var gui = require('gui');
|
||||
* var webview = gui.open('fs:index.html');
|
||||
*
|
||||
* webview.onresize = evt => console.log(evt.width, evt.height);
|
||||
* ```
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type Function
|
||||
*/
|
||||
|
||||
onresize: Function
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和绑定窗口关闭事件,WebView 关闭后会触发此时间,相当于 on("closed", func);
|
||||
*
|
||||
*
|
||||
* @type Function
|
||||
*/
|
||||
|
||||
onclosed: Function
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和绑定接受 webview 内 postMessage 消息事件,相当于 on("message", func);
|
||||
*
|
||||
*
|
||||
* @type Function
|
||||
*/
|
||||
|
||||
onmessage: Function
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 设置 webview 的页面 html
|
||||
* @param html 设置的 html
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
setHtml(html: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 打印当前窗口文档
|
||||
* @param mode 打印参数,0: 快速打印; 1: 标准打印; 2: 打印预览。缺省为 1
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
print(mode?: number/** = 1*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 关闭当前窗口
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
close(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 等待当前窗口关闭
|
||||
* 宿主程序在创建窗口后,需要进入等待,否则随着宿主程序的退出,窗口将自动关闭。同时 wait 的调用也并不是必须的,你可以在打开窗口后处理其它业务,只需要保证程序不会自行退出即可。
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
wait(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 向 webview 内发送消息
|
||||
* postMessage 需要在窗口加载完成后发送消息,在此之前发送的消息会丢失。因此建议在 onload 事件触发后再调用此方法。
|
||||
* @param msg 要发送的消息
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
postMessage(msg: string): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+66
@@ -0,0 +1,66 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 独立线程工作对象
|
||||
* @detail
|
||||
*/
|
||||
/// <reference path="EventEmitter.d.ts" />
|
||||
declare class Class_Worker extends Class_EventEmitter {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和绑定接受 postMessage 消息事件,相当于 on("message", func);
|
||||
*
|
||||
*
|
||||
* @type Function
|
||||
*/
|
||||
|
||||
onmessage: Function
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Worker 对象构造函数
|
||||
* @param path 指定 Worker 入口脚本,只接受绝对路径
|
||||
* @param opts 构造选项,暂未支持
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(path: string, opts?: Object/** = v8::Object::New(isolate)*/);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 向 Master 或 Worker 发送消息,
|
||||
* @param data 指定发送的消息内容
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
postMessage(data: any): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+263
@@ -0,0 +1,263 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief x509 证书对象
|
||||
* @detail X509Cert 对象属于 crypto 模块,创建:,```JavaScript,var k = new crypto.X509Cert();,```
|
||||
*/
|
||||
|
||||
declare class Class_X509Cert extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 获取证书的版本
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
version: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 获取证书的序列号
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
serial: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 获取证书颁发者的可分辨名称
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
issuer: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 获取证书的主题可分辨名称
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
subject: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 获取证书的生效时间
|
||||
*
|
||||
* @readonly
|
||||
* @type Date
|
||||
*/
|
||||
|
||||
notBefore: Date
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 获取证书的到期时间
|
||||
*
|
||||
* @readonly
|
||||
* @type Date
|
||||
*/
|
||||
|
||||
notAfter: Date
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 获取证书是否是 ca 证书
|
||||
*
|
||||
* @readonly
|
||||
* @type Boolean
|
||||
*/
|
||||
|
||||
ca: boolean
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 获取证书的 pathlen
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
pathlen: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 获取证书的使用范围
|
||||
*
|
||||
* 结果为全部或部分以下内容:digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment, keyAgreement, keyCertSign, cRLSign
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
usage: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 获取证书的 Netscape 证书类型
|
||||
*
|
||||
* 结果为全部或部分以下内容:client, server, email, objsign, reserved, sslCA, emailCA, objCA
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
type: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 获取证书的公钥
|
||||
*
|
||||
* @readonly
|
||||
* @type PKey
|
||||
*/
|
||||
|
||||
publicKey: Class_PKey
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 获取证书链中得下一个证书
|
||||
*
|
||||
* @readonly
|
||||
* @type X509Cert
|
||||
*/
|
||||
|
||||
next: Class_X509Cert
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief X509Cert 构造函数
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor();
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 加载一个 DER 格式的证书,可多次调用
|
||||
* @param derCert DER 格式的证书
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
load(derCert: Class_Buffer): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 加载一个 CRT/PEM/TXT 格式的证书,可多次调用
|
||||
*
|
||||
* load 加载 mozilla 的 certdata,txt, 可于 http://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt 下载使用
|
||||
* @param txtCert PEM 格式的证书
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
load(txtCert: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 加载一个 CRT/PEM/DER/TXT 格式的证书,可多次调用
|
||||
*
|
||||
* loadFile 加载 mozilla 的 certdata,txt, 可于 http://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt 下载使用
|
||||
* @param filename 证书文件名
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
loadFile(filename: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 加载自带的缺省根证书
|
||||
* 此证书内容源自:http://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
|
||||
*
|
||||
*
|
||||
*/
|
||||
loadRootCerts(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 使用当前证书链验证给定的证书
|
||||
* @param cert 给定需要验证的证书
|
||||
* @return 如果验证成功则返回 True
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
verify(cert: Class_X509Cert): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 导出已经加载的证书
|
||||
* @return 以数组方式导出证书链
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
dump(): any[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 清空已经加载的证书
|
||||
*
|
||||
*
|
||||
*/
|
||||
clear(): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+90
@@ -0,0 +1,90 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief x509 撤销证书对象
|
||||
* @detail X509Crl 对象属于 crypto 模块,创建:,```JavaScript,var k = new crypto.X509Crl();,```
|
||||
*/
|
||||
|
||||
declare class Class_X509Crl extends Class__object {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief X509Crl 构造函数
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor();
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 加载一个 DER 格式的撤销证书,可多次调用
|
||||
* @param derCrl DER 格式的撤销证书
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
load(derCrl: Class_Buffer): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 加载一个 PEM 格式的撤销证书,可多次调用
|
||||
* @param pemCrl PEM 格式的撤销证书
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
load(pemCrl: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 加载一个 PEM/DER 格式的撤销证书,可多次调用
|
||||
* @param filename 撤销证书文件名
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
loadFile(filename: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 导出已经加载的撤销证书
|
||||
* @return 以数组方式导出撤销证书链
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
dump(): any[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 清空已经加载的撤销证书
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
clear(): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+155
@@ -0,0 +1,155 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief x509 证书请求对象
|
||||
* @detail X509Req 对象属于 crypto 模块,创建:,```JavaScript,var k = new crypto.X509Req();,```
|
||||
*/
|
||||
|
||||
declare class Class_X509Req extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 获取证书的主题可分辨名称
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
subject: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 获取证书的公钥
|
||||
*
|
||||
* @readonly
|
||||
* @type PKey
|
||||
*/
|
||||
|
||||
publicKey: Class_PKey
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief X509Req 构造函数
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor();
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief X509Req 构造函数,根据给定的信息创建一个证书请求
|
||||
*
|
||||
* @param subject 证书的主题可分辨名称
|
||||
* @param key 证书的公钥
|
||||
* @param hash 证书摘要算法,缺省为 hash.SHA1
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(subject: string, key: Class_PKey, hash?: number/** = undefined*/);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 加载一个 DER 格式的证书请求
|
||||
* @param derReq DER 格式的证书请求
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
load(derReq: Class_Buffer): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 加载一个 PEM 格式的证书请求
|
||||
* @param pemReq PEM 格式的证书请求
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
load(pemReq: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 加载一个 PEM/DER 格式的证书请求,可多次调用
|
||||
* @param filename 证书请求文件名
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
loadFile(filename: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回当前证书请求的 PEM 格式编码
|
||||
* @return 当前证书请求的 PEM 格式编码
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
exportPem(): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回当前证书请求的 DER 格式编码
|
||||
* @return 当前证书请求的 DER 格式编码
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
exportDer(): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 签名当前证书请求为正式证书
|
||||
*
|
||||
* opts 接收的字段如下:
|
||||
* ```JavaScript
|
||||
* {
|
||||
* ca: false, // 证书为 ca,缺省为 false
|
||||
* pathlen: -1, // 证书深度,缺省为 -1
|
||||
* notBefore: "", // 证书生效时间,缺省为当前时间
|
||||
* notAfter: "", // 证书失效时间,缺省为 notBefore 后一年
|
||||
* usage: "", // 证书使用范围,接收:digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment, keyAgreement, keyCertSign, cRLSign
|
||||
* type: "" // 证书 Netscape 证书类型,接收:client, server, email, objsign, reserved, sslCA, emailCA, objCA
|
||||
* }
|
||||
* ```
|
||||
* @param issuer 签名机构的可分辨名称
|
||||
* @param key 签名机构的私钥
|
||||
* @param opts 其他可选参数
|
||||
* @return 返回签名后的正式证书
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
sign(issuer: string, key: Class_PKey, opts?: Object/** = v8::Object::New(isolate)*/): Class_X509Cert;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+124
@@ -0,0 +1,124 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief XmlAttr 对象表示 XmlElement 对象的属性
|
||||
* @detail
|
||||
*/
|
||||
|
||||
declare class Class_XmlAttr extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询元素的本地名称。如果选定的节点无命名空间,则该属性等同于 nodeName
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
localName: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 属性的值
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
value: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 属性的名称
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
name: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询元素的命名空间的 URI。如果选定的节点无命名空间,则该属性返回 NULL
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
namespaceURI: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置元素的命名空间前缀。如果选定的节点无命名空间,则该属性返回 NULL
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
prefix: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 属性的名称,为兼容的目的
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
nodeName: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 属性的值,为兼容的目的
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
nodeValue: string
|
||||
|
||||
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief XmlCDATASection 对象表示文档中的 CDATA 区段
|
||||
* @detail XmlCDATASection 接口是 XmlText 接口的子接口,没有定义任何自己的属性和方法。通过从 XmlNode 接口继承 nodeValue 属性,或通过从 XmlCharacterData 接口继承 data 属性,可以访问 CDATA Section 的文本内容。,,虽然通常可以把 XmlCDATASection 节点作为 XmlText 节点处理,但要注意 XmlNode 的 normalize 方法不并入相邻的 CDATA 部分。,,使用 XmlDocument 的 createXmlCDATASection 方法来创建一个 XmlCDATASection 。,,CDATA 区段包含了不会被解析器解析的文本。CDATA 区段中的标签不会被视为标记,同时实体也不会被展开。主要的目的是为了包含诸如 XML 片段之类的材料,而无需转义所有的分隔符。,,在一个 CDATA 中唯一被识别的分隔符是 "]]>",它可标示 CDATA 区段的结束。CDATA 区段不能进行嵌套。
|
||||
*/
|
||||
/// <reference path="XmlText.d.ts" />
|
||||
declare class Class_XmlCDATASection extends Class_XmlText {
|
||||
|
||||
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief XmlCharacterData 接口提供了 XmlText 和 XmlComment 节点的常用功能
|
||||
* @detail XmlCharacterData 是 XmlText 和 XmlComment 节点的超接口。文档从不包含 XmlCharacterData 节点,它们只包含 XmlText 节点和 XmlComment 节点。但由于这两种节点具有相似的功能,因此此处定义了这些函数,以便 XmlText 和 XmlComment 可以继承它。
|
||||
*/
|
||||
/// <reference path="XmlNode.d.ts" />
|
||||
declare class Class_XmlCharacterData extends Class_XmlNode {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 该节点包含的文本
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
data: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 该节点包含的字符数
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
length: number
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 从节点中提取子串
|
||||
* @param offset 要返回的第一个字符的位置
|
||||
* @param count 要返回的子串中的字符数
|
||||
* @return 返回提取的字符串
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
substringData(offset: number, count: number): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 把字符串附加到节点上
|
||||
* @param arg 要附加到节点的字符串
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
appendData(arg: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 把字符串插入节点
|
||||
* @param offset 要把字符串插入节点的字符位置
|
||||
* @param arg 要插入的字符串
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
insertData(offset: number, arg: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 从节点删除文本
|
||||
* @param offset 要删除的第一个字符的位置
|
||||
* @param count 要删除的字符的数量
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
deleteData(offset: number, count: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 用指定的字符串替换节点的字符
|
||||
* @param offset 节点要替换的字符位置
|
||||
* @param count 要替换的字符的数量
|
||||
* @param arg 要插入的字符串
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
replaceData(offset: number, count: number, arg: string): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief XmlComment 对象表示文档中注释节点的内容
|
||||
* @detail XmlComment 节点表示 XML 文档中的注释。,使用由 XmlCharacterData 接口继承的 data 属性,或使用由 XmlNode 接口继承的 nodeValue 属性,可以访问注释的内容。(即 <!-- 和 --> 之间的文本)。使用由 XmlCharacterData 接口继承的各种方法可以操作注释的内容。,,使用 XmlDocument.createComment() 来创建一个注释对象。
|
||||
*/
|
||||
/// <reference path="XmlCharacterData.d.ts" />
|
||||
declare class Class_XmlComment extends Class_XmlCharacterData {
|
||||
|
||||
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+290
@@ -0,0 +1,290 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief XmlDocument 对象代表整个 XML 文档
|
||||
* @detail XmlDocument 对象是一棵文档树的根,可为我们提供对文档数据的最初(或最顶层)的访问入口。,用于元素节点、文本节点、注释、处理指令等均无法存在于 XmlDocument 之外, XmlDocument 对象同样提供了创建这些对象的方法。 XmlNode 对象提供了一个 ownerDocument 属性,此属性可把它们与在其中创建它们的 XmlDocument 关联起来。
|
||||
*/
|
||||
/// <reference path="XmlNode.d.ts" />
|
||||
declare class Class_XmlDocument extends Class_XmlNode {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回用于文档的编码(在解析时)
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
inputEncoding: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 设置或返回文档是否为 standalone
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type Boolean
|
||||
*/
|
||||
|
||||
xmlStandalone: boolean
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 设置或返回文档的 XML 版本
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
xmlVersion: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回与文档相关的文档类型声明(Document Type Declaration)
|
||||
*
|
||||
* 对于没有 DTD 的 XML 文档,则返回 null。此属性可提供对 XmlDocumentType 对象( XmlDocument 的一个子节点)的直接访问。
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type XmlDocumentType
|
||||
*/
|
||||
|
||||
doctype: Class_XmlDocumentType
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回文档的根节点
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type XmlElement
|
||||
*/
|
||||
|
||||
documentElement: Class_XmlElement
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回 HTML 文档的 head 节点,仅在 html 模式有效
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type XmlElement
|
||||
*/
|
||||
|
||||
head: Class_XmlElement
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回 HTML 文档的 title 节点的内容,仅在 html 模式有效
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
title: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回 HTML 文档的 body 节点,仅在 html 模式有效
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type XmlElement
|
||||
*/
|
||||
|
||||
body: Class_XmlElement
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 构造一个 XmlDocument 对象
|
||||
* @param type 指定文档对象的类型,缺省为 "text/xml",若需要处理 html 则需要指定 "text/html"
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(type?: string/** = "text/xml"*/);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 通过解析一个 XML/HTML 字符串来组成该文档,不支持多语种
|
||||
* @param source 要解析的 XML/HTML 文本,取决于文档创建时的类型
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
load(source: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 通过解析一个二进制 XML/HTML 字符串来组成该文档,并根据语种自动转换
|
||||
* @param source 要解析的 XML/HTML 文本,取决于文档创建时的类型
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
load(source: Class_Buffer): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回带有指定名称的所有元素的一个节点列表
|
||||
*
|
||||
* 该方法将返回一个 XmlNodeList 对象(可以作为只读数组处理),该对象存放文档中具有指定标签名的所有 XmlElement 节点,它们存放的顺序就是在源文档中出现的顺序。 XmlNodeList 对象是“活”的,即如果在文档中添加或删除了指定标签名的元素,它的内容会自动进行必要的更新。
|
||||
* @param tagName 需检索的标签名。值 "*" 匹配所有的标签
|
||||
* @return 文档树中具有指定标记的 XmlElement 节点的 XmlNodeList 集合。返回的元素节点的顺序就是它们在源文档中出现的顺序。
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
getElementsByTagName(tagName: string): Class_XmlNodeList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回带有指定命名空间和名称的所有元素的一个节点列表
|
||||
*
|
||||
* 该方法与 getElementsByTagName() 方法相似,只是它根据命名空间和名称来检索元素。
|
||||
* @param namespaceURI 指定检索的命名空间 URI。值 "*" 可匹配所有的标签
|
||||
* @param localName 需检索的标签名。值 "*" 匹配所有的标签
|
||||
* @return 文档树中具有指定标记的 XmlElement 节点的 XmlNodeList 集合。返回的元素节点的顺序就是它们在源文档中出现的顺序。
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
getElementsByTagNameNS(namespaceURI: string, localName: string): Class_XmlNodeList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回拥有指定 id 属性的元素
|
||||
*
|
||||
* 该方法将遍历文档的子孙节点,返回一个 XmlElement 节点对象,表示第一个具有指定 id 属性的文档元素。。
|
||||
* @param id 需检索的 id
|
||||
* @return 节点树中具有指定 id 属性的 XmlElement 节点
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
getElementById(id: string): Class_XmlElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回带有指定 class 名称的所有元素的一个节点列表
|
||||
*
|
||||
* 该方法将返回一个 XmlNodeList 对象(可以作为只读数组处理),该对象存放文档中具有指定 class 名的所有 XmlElement 节点,它们存放的顺序就是在源文档中出现的顺序。 XmlNodeList 对象是“活”的,即如果在文档中添加或删除了指定标签名的元素,它的内容会自动进行必要的更新。
|
||||
* @param className 需检索的 class 名称
|
||||
* @return 文档树中具有指定 class 名的 XmlElement 节点的 XmlNodeList 集合。返回的元素节点的顺序就是它们在源文档中出现的顺序。
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
getElementsByClassName(className: string): Class_XmlNodeList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 创建元素节点
|
||||
* @param tagName 指定元素节点规定名称
|
||||
* @return 返回新创建的 XmlElement 节点,具有指定的标签名
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
createElement(tagName: string): Class_XmlElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 创建带有指定命名空间的元素节点
|
||||
* @param namespaceURI 指定元素节点命名空间 URI
|
||||
* @param qualifiedName 指定元素节点规定名称
|
||||
* @return 返回新创建的 XmlElement 节点,具有指定的标签名
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
createElementNS(namespaceURI: string, qualifiedName: string): Class_XmlElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 创建文本节点
|
||||
* @param data 指定此节点的文本
|
||||
* @return 返回新创建的 XmlText 节点,表示指定的 data 字符串
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
createTextNode(data: string): Class_XmlText;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 创建注释节点
|
||||
* @param data 指定此节点的注释文本
|
||||
* @return 返回新创建的 XmlComment 节点,注释文本为指定的 data
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
createComment(data: string): Class_XmlComment;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 创建 XmlCDATASection 节点
|
||||
* @param data 指定此节点规定 CDATA 数据
|
||||
* @return 返回新创建的 XmlCDATASection 节点,内容为指定的 data
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
createCDATASection(data: string): Class_XmlCDATASection;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 创建 XmlProcessingInstruction 节点
|
||||
* @param target 指定处理指令的目标
|
||||
* @param data 指定处理指令的内容文本
|
||||
* @return 新创建的 ProcessingInstruction 节点
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
createProcessingInstruction(target: string, data: string): Class_XmlProcessingInstruction;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief XmlDocumentType 对象用于访问 XML 所定义的实体
|
||||
* @detail
|
||||
*/
|
||||
/// <reference path="XmlNode.d.ts" />
|
||||
declare class Class_XmlDocumentType extends Class_XmlNode {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回 DTD 的名称
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
name: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 可返回外部 DTD 的公共识别符
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
publicId: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 可返回外部 DTD 的系统识别符
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
systemId: string
|
||||
|
||||
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+301
@@ -0,0 +1,301 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief XmlElement 对象表示 XML 文档中的元素
|
||||
* @detail
|
||||
*/
|
||||
/// <reference path="XmlNode.d.ts" />
|
||||
declare class Class_XmlElement extends Class_XmlNode {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询元素的命名空间的 URI。如果选定的节点无命名空间,则该属性返回 NULL
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
namespaceURI: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询和设置元素的命名空间前缀。如果选定的节点无命名空间,则该属性返回 NULL
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
prefix: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询元素的本地名称。如果选定的节点无命名空间,则该属性等同于 nodeName
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
localName: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回元素的标签名
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
tagName: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* ! 查询和设置元素的 id 属性
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
id: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* ! 查询和设置选定元素的文本。查询时,返回元素节点内所有文本节点的值;设置时,删除所有子节点,并用单个文本节点来替换它们。
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
textContent: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* ! 查询和设置选定元素的 HTML 文本,仅在 html 模式有效。查询时,返回元素节点内所有子节点的 HTML 编码;设置时,删除所有子节点,并用指定的 HTML 解码后替换它们。
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
innerHTML: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* ! 查询和设置元素的 class 属性,仅在 html 模式有效
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
className: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回包含被选节点属性的 NamedNodeMap。如果被选节点不是元素,则该属性返回 NULL。
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type XmlNamedNodeMap
|
||||
*/
|
||||
|
||||
attributes: Class_XmlNamedNodeMap
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 通过名称查询属性的值
|
||||
* @param name 指定查询的属性名
|
||||
* @return 返回属性的值
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
getAttribute(name: string): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 通过命名空间 URI 和名称来获取属性值
|
||||
* @param namespaceURI 指定查询的命名空间 URI
|
||||
* @param localName 指定查询的属性名
|
||||
* @return 返回属性的值
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
getAttributeNS(namespaceURI: string, localName: string): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 创建或改变某个新属性
|
||||
*
|
||||
* 该方法把指定的属性设置为指定的值。如果不存在具有指定名称的属性,该方法将创建一个新属性
|
||||
* @param name 指定要设置的属性名
|
||||
* @param value 指定要设置的属性值
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
setAttribute(name: string, value: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 创建或改变具有命名空间的属性
|
||||
*
|
||||
* 该方法与 setAttribute 方法类似,只是要创建或设置的属性由命名空间 URI 和限定名(由名字空间前缀、冒号和名字空间中的本地名构成)共同指定。除了可以改变一个属性的值以外,使用该方法还可以改变属性的名字空间前缀
|
||||
* @param namespaceURI 指定要设置的命名空间 URI
|
||||
* @param qualifiedName 指定要设置的属性名
|
||||
* @param value 指定要设置的属性值
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 通过名称删除指定的属性
|
||||
* @param name 指定删除的属性名
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
removeAttribute(name: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 通过命名空间和名称删除指定的属性
|
||||
* @param namespaceURI 指定要删除的命名空间 URI
|
||||
* @param localName 指定删除的属性名
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
removeAttributeNS(namespaceURI: string, localName: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询当前节点是否拥有指定名称的属性
|
||||
* @param name 指定查询的属性名称
|
||||
* @return 如果当前元素节点拥有指定属性,则返回 true,否则返回 false
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
hasAttribute(name: string): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询当前节点是否拥有指定命名空间和名称的属性
|
||||
* @param namespaceURI 指定要查询的命名空间 URI
|
||||
* @param localName 指定查询的属性名称
|
||||
* @return 如果当前元素节点拥有指定属性,则返回 true,否则返回 false
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
hasAttributeNS(namespaceURI: string, localName: string): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回拥有指定名称的所有元素的 XmlNodeList
|
||||
*
|
||||
* 该方法将遍历指定元素的子孙节点,返回一个 XmlElement 节点的 XmlNodeList 对象,表示所有具有指定标签名的文档元素。元素在返回的数组中的顺序就是它们出现在文档源代码中的顺序。
|
||||
*
|
||||
* XmlDocument 接口也定义了 getElementsByTagName 方法,它与该方法相似,但遍历整个文档,而不是遍历某个元素的子孙节点。
|
||||
* @param tagName 需检索的标签名。值 "*" 匹配所有的标签
|
||||
* @return 节点树中具有指定标记的 XmlElement 节点的 XmlNodeList 集合。返回的元素节点的顺序就是它们在源文档中出现的顺序。
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
getElementsByTagName(tagName: string): Class_XmlNodeList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回拥有指定命名空间和名称的所有元素的 XmlNodeList
|
||||
*
|
||||
* 该方法与 getElementsByTagName 方法相似,只是想获取的元素的标记名被指定为命名空间 URI 和在命名空间中定义的本地名的组合。
|
||||
* @param namespaceURI 指定要查询的命名空间 URI
|
||||
* @param localName 需检索的标签名。值 "*" 匹配所有的标签
|
||||
* @return 节点树中具有指定标记的 XmlElement 节点的 XmlNodeList 集合。返回的元素节点的顺序就是它们在源文档中出现的顺序。
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
getElementsByTagNameNS(namespaceURI: string, localName: string): Class_XmlNodeList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回拥有指定 id 属性的元素
|
||||
*
|
||||
* 该方法将遍历指定元素的子孙节点,返回一个 XmlElement 节点对象,表示第一个具有指定 id 属性的文档元素。。
|
||||
*
|
||||
* XmlDocument 接口也定义了 getElementsByTagName 方法,它与该方法相似,但遍历整个文档,而不是遍历某个元素的子孙节点。
|
||||
* @param id 需检索的 id
|
||||
* @return 节点树中具有指定 id 属性的 XmlElement 节点
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
getElementById(id: string): Class_XmlElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回带有指定 class 名称的所有元素的一个节点列表
|
||||
*
|
||||
* 该方法将返回一个 XmlNodeList 对象(可以作为只读数组处理),该对象存放文档中具有指定 class 名的所有 XmlElement 节点,它们存放的顺序就是在源文档中出现的顺序。 XmlNodeList 对象是“活”的,即如果在文档中添加或删除了指定标签名的元素,它的内容会自动进行必要的更新。
|
||||
* @param className 需检索的 class 名称
|
||||
* @return 文档树中具有指定 class 名的 XmlElement 节点的 XmlNodeList 集合。返回的元素节点的顺序就是它们在源文档中出现的顺序。
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
getElementsByClassName(className: string): Class_XmlNodeList;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief XmlNamedNodeMap 对象表示一个无顺序的属性列表
|
||||
* @detail
|
||||
*/
|
||||
|
||||
declare class Class_XmlNamedNodeMap extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回属性列表中的属性数目
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
length: number
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回属性列表中处于指定的索引号的属性
|
||||
* @param index 指定要查询的索引
|
||||
* @return 指定索引号的属性
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
item(index: number): Class_XmlAttr;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询指定名称的属性
|
||||
* @param name 指定要查询的名称
|
||||
* @return 返回查询出的属性
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
getNamedItem(name: string): Class_XmlAttr;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+315
@@ -0,0 +1,315 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief XmlNode 对象是整个 DOM 的基础数据类型
|
||||
* @detail
|
||||
*/
|
||||
|
||||
declare class Class_XmlNode extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回节点的节点类型
|
||||
*
|
||||
* 不同对象的 nodeType 会返回不同的值:
|
||||
* - XmlElement: ELEMENT_NODE(1)
|
||||
* - XmlAttr: ATTRIBUTE_NODE(2)
|
||||
* - XmlText: TEXT_NODE(3)
|
||||
* - XmlCDATASection: CDATA_SECTION_NODE(4)
|
||||
* - XmlProcessingInstruction: PROCESSING_INSTRUCTION_NODE(7)
|
||||
* - XmlComment: COMMENT_NODE(8)
|
||||
* - XmlDocument: DOCUMENT_NODE(9)
|
||||
* - XmlDocumentType: DOCUMENT_TYPE_NODE(10)
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
nodeType: number
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回节点的名称,根据其类型
|
||||
*
|
||||
* 不同对象的 nodeName 会返回不同的值:
|
||||
* - XmlElement: element name
|
||||
* - XmlAttr: 属性名称
|
||||
* - XmlText: \#text
|
||||
* - XmlCDATASection: \#cdata-section
|
||||
* - XmlProcessingInstruction: 返回指定目标 target
|
||||
* - XmlComment: \#comment
|
||||
* - XmlDocument: \#document
|
||||
* - XmlDocumentType: doctype 名称
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
nodeName: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回节点的名称,根据其类型
|
||||
*
|
||||
* 不同对象的 nodeName 会返回不同的值:
|
||||
* - XmlElement: null
|
||||
* - XmlAttr: 属性的值
|
||||
* - XmlText: 节点的内容
|
||||
* - XmlCDATASection: 节点的内容
|
||||
* - XmlProcessingInstruction: 返回指定内容 data
|
||||
* - XmlComment: 注释文本
|
||||
* - XmlDocument: null
|
||||
* - XmlDocumentType: null
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
nodeValue: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回节点的根元素(XmlDocument 对象)
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type XmlDocument
|
||||
*/
|
||||
|
||||
ownerDocument: Class_XmlDocument
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 可返回某节点的父节点
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type XmlNode
|
||||
*/
|
||||
|
||||
parentNode: Class_XmlNode
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回指定节点的子节点的节点列表
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type XmlNodeList
|
||||
*/
|
||||
|
||||
childNodes: Class_XmlNodeList
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回节点的首个子节点
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type XmlNode
|
||||
*/
|
||||
|
||||
firstChild: Class_XmlNode
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回节点的最后一个子节点
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type XmlNode
|
||||
*/
|
||||
|
||||
lastChild: Class_XmlNode
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回某节点之前紧跟的节点(处于同一树层级),如果没有此节点,那么该属性返回 null
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type XmlNode
|
||||
*/
|
||||
|
||||
previousSibling: Class_XmlNode
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回某个元素之后紧跟的节点(处于同一树层级中),如果无此节点,则属性返回 null
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type XmlNode
|
||||
*/
|
||||
|
||||
nextSibling: Class_XmlNode
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 查询是否存在子节点
|
||||
* @return 存在任何子节点时返回 true,否则返回 false
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
hasChildNodes(): boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 合并相邻的 Text 节点并删除空的 Text 节点
|
||||
*
|
||||
* 这个方法将遍历当前节点的所有子孙节点,通过删除空的 Text 节点,已经合并所有相邻的 Text 节点来规范化文档。该方法在进行节点的插入或删除操作后,对于简化文档树的结构很有用。
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
normalize(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 创建指定的节点的精确拷贝
|
||||
*
|
||||
* 该方法将复制并返回调用它的节点的副本。如果传递给它的参数是 true,它还将递归复制当前节点的所有子孙节点。 否则,它只复制当前节点。返回的节点不属于文档树,它的 parentNode 属性为 null。当复制的是 Element 节点时,它的所有属性都将被复制。
|
||||
* @param deep 是否深度拷贝,为 true 时,被克隆的节点会克隆原节点的所有子节点
|
||||
* @return 返回所复制的节点
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
cloneNode(deep?: boolean/** = true*/): Class_XmlNode;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回在当前节点上匹配指定的命名空间 URI 的前缀
|
||||
* @param namespaceURI 指定匹配的命名空间 URI
|
||||
* @return 返回匹配的前缀,未匹配到返回 null
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
lookupPrefix(namespaceURI: string): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回在当前节点上匹配指定的前缀的命名空间 URI
|
||||
* @param prefix 指定匹配的前缀
|
||||
* @return 返回匹配的命名空间 URI,未匹配到返回 null
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
lookupNamespaceURI(prefix: string): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 在已有的子节点前插入一个新的子节点
|
||||
*
|
||||
* 如果文档树中已经存在了 newChild,它将从文档树中删除,然后重新插入它的新位置。来自一个文档的节点(或由一个文档创建的节点)不能插入另一个文档。也就是说,newChild 的 ownerDocument 属性必须与当前节点的 ownerDocument 属性相同。
|
||||
* @param newChild 插入新的节点
|
||||
* @param refChild 在此节点前插入新节点
|
||||
* @return 返回新的子节点
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
insertBefore(newChild: Class_XmlNode, refChild: Class_XmlNode): Class_XmlNode;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 在已有的子节点后插入一个新的子节点
|
||||
*
|
||||
* 如果文档树中已经存在了 newChild,它将从文档树中删除,然后重新插入它的新位置。来自一个文档的节点(或由一个文档创建的节点)不能插入另一个文档。也就是说,newChild 的 ownerDocument 属性必须与当前节点的 ownerDocument 属性相同。
|
||||
* @param newChild 插入新的节点
|
||||
* @param refChild 在此节点后插入新节点
|
||||
* @return 返回新的子节点
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
insertAfter(newChild: Class_XmlNode, refChild: Class_XmlNode): Class_XmlNode;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 向节点的子节点列表的末尾添加新的子节点
|
||||
*
|
||||
* 如果文档树中已经存在了 newChild,它将从文档树中删除,然后重新插入它的新位置。来自一个文档的节点(或由一个文档创建的节点)不能插入另一个文档。也就是说,newChild 的 ownerDocument 属性必须与当前节点的 ownerDocument 属性相同。
|
||||
* @param newChild 指定添加的节点
|
||||
* @return 返回这个新的子节点
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
appendChild(newChild: Class_XmlNode): Class_XmlNode;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将某个子节点替换为另一个
|
||||
*
|
||||
* 如果文档树中已经存在了 newChild,它将从文档树中删除,然后重新插入它的新位置。来自一个文档的节点(或由一个文档创建的节点)不能插入另一个文档。也就是说,newChild 的 ownerDocument 属性必须与当前节点的 ownerDocument 属性相同。
|
||||
* @param newChild 指定新的节点
|
||||
* @param oldChild 指定被替换的节点
|
||||
* @return 如替换成功,此方法可返回被替换的节点,如替换失败,则返回 null
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
replaceChild(newChild: Class_XmlNode, oldChild: Class_XmlNode): Class_XmlNode;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 从子节点列表中删除某个节点
|
||||
* @param oldChild 指定被删除的节点
|
||||
* @return 如删除成功,此方法可返回被删除的节点,如失败,则返回 null
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
removeChild(oldChild: Class_XmlNode): Class_XmlNode;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+57
@@ -0,0 +1,57 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief XmlNodeList 对象代表一个有顺序的节点列表
|
||||
* @detail
|
||||
*/
|
||||
|
||||
declare class Class_XmlNodeList extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回节点列表中的节点数目
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
length: number
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回节点列表中处于指定的索引号的节点
|
||||
* @param index 指定要查询的索引
|
||||
* @return 指定索引号的节点
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
item(index: number): Class_XmlNode;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief XmlProcessingInstruction 对象表示 xml 处理指令
|
||||
* @detail
|
||||
*/
|
||||
/// <reference path="XmlNode.d.ts" />
|
||||
declare class Class_XmlProcessingInstruction extends Class_XmlNode {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 返回此处理指令的目标
|
||||
*
|
||||
*
|
||||
* @readonly
|
||||
* @type String
|
||||
*/
|
||||
|
||||
target: string
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 设置或返回此处理指令的内容
|
||||
*
|
||||
*
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
|
||||
data: string
|
||||
|
||||
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+48
@@ -0,0 +1,48 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief XmlText 对象表示元素或属性的文本内容
|
||||
* @detail XmlText 节点表示 XML 文档中的一系列纯文本。因为纯文本出现在 XML 的元素和属性中,所以 XmlText 节点通常作为 XmlElement 节点和 XmlAttr 节点的子节点出现。,,XmlText 节点继承了 XmlCharacterData 接口,通过从 XmlCharacterData 接口继承的 data 属性或从 XmlNode 接口继承的 nadevalue 属性,可以访问 XmlText 节点的文本内容。,,用从 XmlCharacterData 继承的方法或 XmlText 接口自身定义的 splitText() 方法可以操作 XmlText 节点。使用 XmlDocument 的 createTextNode 来创建一个新的 XmlText 节点。,,XmlText 节点没有子节点。,,关于从文档的子树中删除空 XmlText 节点与合并相邻的 XmlText 节点的方法,请参阅 XmlNode.normalize 方法。
|
||||
*/
|
||||
/// <reference path="XmlCharacterData.d.ts" />
|
||||
declare class Class_XmlText extends Class_XmlCharacterData {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 按照指定的 offset 把文本节点分割为两个节点
|
||||
*
|
||||
* 该方法将在指定的 offset 处把 XmlText 节点分割成两个节点。原始的 XmlText 节点将被修改,使它包含 offset 指定的位置之前的文本内容(但不包括文本内容)。新的 XmlText 节点将被创建,用于存放从 offset 位置(包括该位置上的字符)到原字符结尾的所有字符。新的 XmlText 节点是该方法的返回值。此外,如果原始的 XmlText 节点具有 parentNode,新的 XmlText 节点将插入这个父节点,紧邻在原始节点之后。
|
||||
*
|
||||
* XmlCDATASection 接口继承了 XmlText 接口, XmlCDATASection 节点也可以使用该方法 ,只是新创建的节点是 XmlCDATASection 节点,而不是 XmlText 节点。
|
||||
* @param offset 规定在何处分割文本节点。开始值以 0 开始
|
||||
* @return 从当前节点分割出的 Text 节点
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
splitText(offset: number): Class_XmlText;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+168
@@ -0,0 +1,168 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief zip 文件访问对象
|
||||
* @detail
|
||||
*/
|
||||
|
||||
declare class Class_ZipFile extends Class__object {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 获取文件名列表
|
||||
* @return 返回包含文件名的列表对象
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
namelist(): any[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 获取文件信息列表
|
||||
* 文件信息包含字段有:filename, date, compress_type, compress_size, file_size, password, data
|
||||
* @return 返回包含文件信息的列表对象
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
infolist(): any[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 获取文件信息
|
||||
* 文件信息包含字段有:filename, date, compress_type, compress_size, file_size, password, data
|
||||
* @param member 指定要获取信息的文件名
|
||||
* @return 返回文件信息对象
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
getinfo(member: string): any;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回从压缩文件读取的数据
|
||||
* @param member 指定要读取的文件名
|
||||
* @param password 解压密码, 默认没有密码
|
||||
* @return 返回文件的所有数据
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
read(member: string, password?: string/** = ""*/): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 解压所有文件
|
||||
* @param password 解压密码, 默认没有密码
|
||||
* @return 包含所有文件数据及信息的列表
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
readAll(password?: string/** = ""*/): any[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 解压指定文件
|
||||
* @param member 指定要解压的文件名
|
||||
* @param path 指定要解压到的路径
|
||||
* @param password 解压密码, 默认没有密码
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
extract(member: string, path: string, password?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 解压指定文件到流
|
||||
* @param member 指定要解压的文件名
|
||||
* @param strm 指定要解压到的流
|
||||
* @param password 解压密码, 默认没有密码
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
extract(member: string, strm: Class_SeekableStream, password?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 解压所有文件到指定路径
|
||||
* @param path 指定要解压到的路径
|
||||
* @param password 解压密码, 默认没有密码
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
extractAll(path: string, password?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 写入指定文件到压缩文件
|
||||
* @param filename 指定要写入的文件
|
||||
* @param inZipName 压缩在zip文件内的文件名
|
||||
* @param password 解压密码, 默认没有密码
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
write(filename: string, inZipName: string, password?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 写入指定文件到压缩文件
|
||||
* @param data 指定要写入的文件数据
|
||||
* @param inZipName 压缩在zip文件内的文件名
|
||||
* @param password 解压密码, 默认没有密码
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
write(data: Class_Buffer, inZipName: string, password?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 写入指定文件到压缩文件
|
||||
* @param strm 指定要写入文件数据流
|
||||
* @param inZipName 压缩在zip文件内的文件名
|
||||
* @param password 解压密码, 默认没有密码
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
write(strm: Class_SeekableStream, inZipName: string, password?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 关闭打开的zip文件
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
close(): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+105
@@ -0,0 +1,105 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief ZeroMQ 套接口对象
|
||||
* @detail
|
||||
*/
|
||||
|
||||
declare class Class_ZmqSocket extends Class__object {
|
||||
|
||||
/**
|
||||
* class prop
|
||||
*
|
||||
*
|
||||
* @brief 查询当前 socket 类型
|
||||
*
|
||||
* @readonly
|
||||
* @type Integer
|
||||
*/
|
||||
|
||||
type: number
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief ZmqSocket 对象构造函数
|
||||
* @param type 指定 socket 类型,缺省为 zmq.PAIR
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
constructor(type?: number/** = undefined*/);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 绑定指定地址和端口
|
||||
* @param addr 指定绑定的地址,如:"tcp://*:3000"
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
bind(addr: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 连接到指定地址的服务器
|
||||
* @param addr 指定连接的地址,如:"tcp://*:3000"
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
connect(addr: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 接收一个数据包
|
||||
* @return 返回接收到的数据包
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
recv(): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 发送一个数据包
|
||||
* @param data 指定发送的数据包
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
send(data: Class_Buffer): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 关闭当前 socket
|
||||
*
|
||||
*
|
||||
*/
|
||||
close(): void;
|
||||
|
||||
} /** endof class */
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+41
@@ -0,0 +1,41 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/// <reference path="test.d.ts" />
|
||||
import test from 'test'
|
||||
|
||||
/// <reference path="assert.d.ts" />
|
||||
import _assert from 'assert'
|
||||
|
||||
declare global {
|
||||
const describe: typeof test.describe
|
||||
const xdescribe: typeof test.xdescribe
|
||||
const odescribe: typeof test.odescribe
|
||||
const it: typeof test.it
|
||||
const xit: typeof test.xit
|
||||
const oit: typeof test.oit
|
||||
const before: typeof test.before
|
||||
const after: typeof test.after
|
||||
const beforeEach: typeof test.beforeEach
|
||||
const afterEach: typeof test.afterEach
|
||||
const run: typeof test.run
|
||||
const setup: typeof test.setup
|
||||
|
||||
const assert: typeof _assert
|
||||
}
|
||||
/** declare const describe: test.describe; */
|
||||
|
||||
|
||||
Vendored
+794
@@ -0,0 +1,794 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <reference path="Buffer.d.ts" />
|
||||
|
||||
/// <reference path="BufferedStream.d.ts" />
|
||||
|
||||
/// <reference path="Chain.d.ts" />
|
||||
|
||||
/// <reference path="Cipher.d.ts" />
|
||||
|
||||
/// <reference path="Condition.d.ts" />
|
||||
|
||||
/// <reference path="DbConnection.d.ts" />
|
||||
|
||||
/// <reference path="DgramSocket.d.ts" />
|
||||
|
||||
/// <reference path="Digest.d.ts" />
|
||||
|
||||
/// <reference path="Event.d.ts" />
|
||||
|
||||
/// <reference path="EventEmitter.d.ts" />
|
||||
|
||||
/// <reference path="EventInfo.d.ts" />
|
||||
|
||||
/// <reference path="Fiber.d.ts" />
|
||||
|
||||
/// <reference path="File.d.ts" />
|
||||
|
||||
/// <reference path="Handler.d.ts" />
|
||||
|
||||
/// <reference path="HandlerEx.d.ts" />
|
||||
|
||||
/// <reference path="HeapGraphEdge.d.ts" />
|
||||
|
||||
/// <reference path="HeapGraphNode.d.ts" />
|
||||
|
||||
/// <reference path="HeapSnapshot.d.ts" />
|
||||
|
||||
/// <reference path="HttpClient.d.ts" />
|
||||
|
||||
/// <reference path="HttpCollection.d.ts" />
|
||||
|
||||
/// <reference path="HttpCookie.d.ts" />
|
||||
|
||||
/// <reference path="HttpHandler.d.ts" />
|
||||
|
||||
/// <reference path="HttpMessage.d.ts" />
|
||||
|
||||
/// <reference path="HttpRequest.d.ts" />
|
||||
|
||||
/// <reference path="HttpResponse.d.ts" />
|
||||
|
||||
/// <reference path="HttpServer.d.ts" />
|
||||
|
||||
/// <reference path="HttpUploadData.d.ts" />
|
||||
|
||||
/// <reference path="HttpsServer.d.ts" />
|
||||
|
||||
/// <reference path="Image.d.ts" />
|
||||
|
||||
/// <reference path="Int64.d.ts" />
|
||||
|
||||
/// <reference path="LevelDB.d.ts" />
|
||||
|
||||
/// <reference path="Lock.d.ts" />
|
||||
|
||||
/// <reference path="LruCache.d.ts" />
|
||||
|
||||
/// <reference path="MSSQL.d.ts" />
|
||||
|
||||
/// <reference path="MemoryStream.d.ts" />
|
||||
|
||||
/// <reference path="Message.d.ts" />
|
||||
|
||||
/// <reference path="MongoCollection.d.ts" />
|
||||
|
||||
/// <reference path="MongoCursor.d.ts" />
|
||||
|
||||
/// <reference path="MongoDB.d.ts" />
|
||||
|
||||
/// <reference path="MongoID.d.ts" />
|
||||
|
||||
/// <reference path="MySQL.d.ts" />
|
||||
|
||||
/// <reference path="PKey.d.ts" />
|
||||
|
||||
/// <reference path="Redis.d.ts" />
|
||||
|
||||
/// <reference path="RedisHash.d.ts" />
|
||||
|
||||
/// <reference path="RedisList.d.ts" />
|
||||
|
||||
/// <reference path="RedisSet.d.ts" />
|
||||
|
||||
/// <reference path="RedisSortedSet.d.ts" />
|
||||
|
||||
/// <reference path="Routing.d.ts" />
|
||||
|
||||
/// <reference path="SQLite.d.ts" />
|
||||
|
||||
/// <reference path="SandBox.d.ts" />
|
||||
|
||||
/// <reference path="SeekableStream.d.ts" />
|
||||
|
||||
/// <reference path="Semaphore.d.ts" />
|
||||
|
||||
/// <reference path="Service.d.ts" />
|
||||
|
||||
/// <reference path="Smtp.d.ts" />
|
||||
|
||||
/// <reference path="Socket.d.ts" />
|
||||
|
||||
/// <reference path="SslHandler.d.ts" />
|
||||
|
||||
/// <reference path="SslServer.d.ts" />
|
||||
|
||||
/// <reference path="SslSocket.d.ts" />
|
||||
|
||||
/// <reference path="Stat.d.ts" />
|
||||
|
||||
/// <reference path="Stats.d.ts" />
|
||||
|
||||
/// <reference path="Stream.d.ts" />
|
||||
|
||||
/// <reference path="StringDecoder.d.ts" />
|
||||
|
||||
/// <reference path="SubProcess.d.ts" />
|
||||
|
||||
/// <reference path="TcpServer.d.ts" />
|
||||
|
||||
/// <reference path="Timer.d.ts" />
|
||||
|
||||
/// <reference path="UrlObject.d.ts" />
|
||||
|
||||
/// <reference path="WebSocket.d.ts" />
|
||||
|
||||
/// <reference path="WebSocketMessage.d.ts" />
|
||||
|
||||
/// <reference path="WebView.d.ts" />
|
||||
|
||||
/// <reference path="Worker.d.ts" />
|
||||
|
||||
/// <reference path="X509Cert.d.ts" />
|
||||
|
||||
/// <reference path="X509Crl.d.ts" />
|
||||
|
||||
/// <reference path="X509Req.d.ts" />
|
||||
|
||||
/// <reference path="XmlAttr.d.ts" />
|
||||
|
||||
/// <reference path="XmlCDATASection.d.ts" />
|
||||
|
||||
/// <reference path="XmlCharacterData.d.ts" />
|
||||
|
||||
/// <reference path="XmlComment.d.ts" />
|
||||
|
||||
/// <reference path="XmlDocument.d.ts" />
|
||||
|
||||
/// <reference path="XmlDocumentType.d.ts" />
|
||||
|
||||
/// <reference path="XmlElement.d.ts" />
|
||||
|
||||
/// <reference path="XmlNamedNodeMap.d.ts" />
|
||||
|
||||
/// <reference path="XmlNode.d.ts" />
|
||||
|
||||
/// <reference path="XmlNodeList.d.ts" />
|
||||
|
||||
/// <reference path="XmlProcessingInstruction.d.ts" />
|
||||
|
||||
/// <reference path="XmlText.d.ts" />
|
||||
|
||||
/// <reference path="ZipFile.d.ts" />
|
||||
|
||||
/// <reference path="ZmqSocket.d.ts" />
|
||||
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 断言测试模块,如果测试值为假,则报错,报错行为可设定继续运行或者错误抛出
|
||||
* @detail 引用方法:,```JavaScript,var assert = require('assert');,```,或者通过 test 模块引用:,```JavaScript,var test = require('test');,var assert = test.assert;,```,或者通过 test.setup 配置:,```JavaScript,require("test").setup();,```
|
||||
*/
|
||||
declare module "assert" {
|
||||
|
||||
|
||||
module assert {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值为真,为假则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function Function(actual?: any/** = v8::Undefined(isolate)*/, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值为真,为假则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function ok(actual?: any/** = v8::Undefined(isolate)*/, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值为假,为真则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function notOk(actual?: any/** = v8::Undefined(isolate)*/, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值等于预期值,不相等则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param expected 预期的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function equal(actual?: any/** = v8::Undefined(isolate)*/, expected?: any/** = v8::Undefined(isolate)*/, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值不等于预期值,相等则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param expected 预期的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function notEqual(actual?: any/** = v8::Undefined(isolate)*/, expected?: any/** = v8::Undefined(isolate)*/, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值严格等于预期值,不相等则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param expected 预期的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function strictEqual(actual?: any/** = v8::Undefined(isolate)*/, expected?: any/** = v8::Undefined(isolate)*/, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值不严格等于预期值,相等则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param expected 预期的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function notStrictEqual(actual?: any/** = v8::Undefined(isolate)*/, expected?: any/** = v8::Undefined(isolate)*/, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值深度等于预期值,不相等则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param expected 预期的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function deepEqual(actual?: any/** = v8::Undefined(isolate)*/, expected?: any/** = v8::Undefined(isolate)*/, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值不深度等于预期值,相等则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param expected 预期的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function notDeepEqual(actual?: any/** = v8::Undefined(isolate)*/, expected?: any/** = v8::Undefined(isolate)*/, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值近似等于预期值,否则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param expected 预期的数值
|
||||
* @param delta 近似的小数精度
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function closeTo(actual: any, expected: any, delta: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值不近似等于预期值,否则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param expected 预期的数值
|
||||
* @param delta 近似的小数精度
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function notCloseTo(actual: any, expected: any, delta: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值小于预期值,大于或等于则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param expected 预期的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function lessThan(actual: any, expected: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值不小于预期值,小于则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param expected 预期的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function notLessThan(actual: any, expected: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值大于预期值,小于或等于则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param expected 预期的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function greaterThan(actual: any, expected: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值不大于预期值,大于则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param expected 预期的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function notGreaterThan(actual: any, expected: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试变量存在,为假则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function exist(actual: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试变量不存在,为真则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function notExist(actual: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值为布尔值真,否则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function isTrue(actual: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值不为布尔值真,否则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function isNotTrue(actual: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值为布尔值假,否则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function isFalse(actual: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值不为布尔值假,否则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function isNotFalse(actual: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值为 Null,否则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function isNull(actual: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值不为 Null,否则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function isNotNull(actual: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值为 undefined,否则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function isUndefined(actual: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值不为 undefined,否则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function isDefined(actual: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值为函数,否则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function isFunction(actual: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值不为函数,否则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function isNotFunction(actual: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值为对象,否则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function isObject(actual: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值不为对象,否则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function isNotObject(actual: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值为数组,否则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function isArray(actual: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值不为数组,否则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function isNotArray(actual: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值为字符串,否则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function isString(actual: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值不为字符串,否则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function isNotString(actual: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值为数字,否则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function isNumber(actual: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值不为数字,否则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function isNotNumber(actual: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值为布尔,否则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function isBoolean(actual: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值不为布尔,否则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function isNotBoolean(actual: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值为给定类型,否则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param type 指定的类型
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function typeOf(actual: any, type: string, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试数值不为给定类型,否则断言失败
|
||||
* @param actual 要测试的数值
|
||||
* @param type 指定的类型
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function notTypeOf(actual: any, type: string, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试对象中包含指定属性,否则断言失败
|
||||
* @param object 要测试的对象
|
||||
* @param prop 要测试的属性
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function property(object: any, prop: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试对象中不包含指定属性,否则断言失败
|
||||
* @param object 要测试的对象
|
||||
* @param prop 要测试的属性
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function notProperty(object: any, prop: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 深度测试对象中包含指定属性,否则断言失败
|
||||
* @param object 要测试的对象
|
||||
* @param prop 要测试的属性,以“.”分割
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function deepProperty(object: any, prop: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 深度测试对象中不包含指定属性,否则断言失败
|
||||
* @param object 要测试的对象
|
||||
* @param prop 要测试的属性,以“.”分割
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function notDeepProperty(object: any, prop: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试对象中指定属性的值为给定值,否则断言失败
|
||||
* @param object 要测试的对象
|
||||
* @param prop 要测试的属性
|
||||
* @param value 给定的值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function propertyVal(object: any, prop: any, value: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试对象中指定属性的值不为给定值,否则断言失败
|
||||
* @param object 要测试的对象
|
||||
* @param prop 要测试的属性
|
||||
* @param value 给定的值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function propertyNotVal(object: any, prop: any, value: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 深度测试对象中指定属性的值为给定值,否则断言失败
|
||||
* @param object 要测试的对象
|
||||
* @param prop 要测试的属性,以“.”分割
|
||||
* @param value 给定的值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function deepPropertyVal(object: any, prop: any, value: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 深度测试对象中指定属性的值不为给定值,否则断言失败
|
||||
* @param object 要测试的对象
|
||||
* @param prop 要测试的属性,以“.”分割
|
||||
* @param value 给定的值
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function deepPropertyNotVal(object: any, prop: any, value: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试给定的代码会抛出错误,未抛出则断言失败
|
||||
* @param block 指定测试的代码,以函数形式给出
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function throws(block: Function, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 测试给定的代码不会抛出错误,抛出则断言失败
|
||||
* @param block 指定测试的代码,以函数形式给出
|
||||
* @param msg 断言失败时的提示信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function doesNotThrow(block: Function, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 如果参数为真,则抛出
|
||||
* @param object 参数
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function ifError(object?: any/** = v8::Undefined(isolate)*/): void;
|
||||
|
||||
} /** end of `module assert` */
|
||||
export = assert
|
||||
}
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+239
@@ -0,0 +1,239 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <reference path="Buffer.d.ts" />
|
||||
|
||||
/// <reference path="BufferedStream.d.ts" />
|
||||
|
||||
/// <reference path="Chain.d.ts" />
|
||||
|
||||
/// <reference path="Cipher.d.ts" />
|
||||
|
||||
/// <reference path="Condition.d.ts" />
|
||||
|
||||
/// <reference path="DbConnection.d.ts" />
|
||||
|
||||
/// <reference path="DgramSocket.d.ts" />
|
||||
|
||||
/// <reference path="Digest.d.ts" />
|
||||
|
||||
/// <reference path="Event.d.ts" />
|
||||
|
||||
/// <reference path="EventEmitter.d.ts" />
|
||||
|
||||
/// <reference path="EventInfo.d.ts" />
|
||||
|
||||
/// <reference path="Fiber.d.ts" />
|
||||
|
||||
/// <reference path="File.d.ts" />
|
||||
|
||||
/// <reference path="Handler.d.ts" />
|
||||
|
||||
/// <reference path="HandlerEx.d.ts" />
|
||||
|
||||
/// <reference path="HeapGraphEdge.d.ts" />
|
||||
|
||||
/// <reference path="HeapGraphNode.d.ts" />
|
||||
|
||||
/// <reference path="HeapSnapshot.d.ts" />
|
||||
|
||||
/// <reference path="HttpClient.d.ts" />
|
||||
|
||||
/// <reference path="HttpCollection.d.ts" />
|
||||
|
||||
/// <reference path="HttpCookie.d.ts" />
|
||||
|
||||
/// <reference path="HttpHandler.d.ts" />
|
||||
|
||||
/// <reference path="HttpMessage.d.ts" />
|
||||
|
||||
/// <reference path="HttpRequest.d.ts" />
|
||||
|
||||
/// <reference path="HttpResponse.d.ts" />
|
||||
|
||||
/// <reference path="HttpServer.d.ts" />
|
||||
|
||||
/// <reference path="HttpUploadData.d.ts" />
|
||||
|
||||
/// <reference path="HttpsServer.d.ts" />
|
||||
|
||||
/// <reference path="Image.d.ts" />
|
||||
|
||||
/// <reference path="Int64.d.ts" />
|
||||
|
||||
/// <reference path="LevelDB.d.ts" />
|
||||
|
||||
/// <reference path="Lock.d.ts" />
|
||||
|
||||
/// <reference path="LruCache.d.ts" />
|
||||
|
||||
/// <reference path="MSSQL.d.ts" />
|
||||
|
||||
/// <reference path="MemoryStream.d.ts" />
|
||||
|
||||
/// <reference path="Message.d.ts" />
|
||||
|
||||
/// <reference path="MongoCollection.d.ts" />
|
||||
|
||||
/// <reference path="MongoCursor.d.ts" />
|
||||
|
||||
/// <reference path="MongoDB.d.ts" />
|
||||
|
||||
/// <reference path="MongoID.d.ts" />
|
||||
|
||||
/// <reference path="MySQL.d.ts" />
|
||||
|
||||
/// <reference path="PKey.d.ts" />
|
||||
|
||||
/// <reference path="Redis.d.ts" />
|
||||
|
||||
/// <reference path="RedisHash.d.ts" />
|
||||
|
||||
/// <reference path="RedisList.d.ts" />
|
||||
|
||||
/// <reference path="RedisSet.d.ts" />
|
||||
|
||||
/// <reference path="RedisSortedSet.d.ts" />
|
||||
|
||||
/// <reference path="Routing.d.ts" />
|
||||
|
||||
/// <reference path="SQLite.d.ts" />
|
||||
|
||||
/// <reference path="SandBox.d.ts" />
|
||||
|
||||
/// <reference path="SeekableStream.d.ts" />
|
||||
|
||||
/// <reference path="Semaphore.d.ts" />
|
||||
|
||||
/// <reference path="Service.d.ts" />
|
||||
|
||||
/// <reference path="Smtp.d.ts" />
|
||||
|
||||
/// <reference path="Socket.d.ts" />
|
||||
|
||||
/// <reference path="SslHandler.d.ts" />
|
||||
|
||||
/// <reference path="SslServer.d.ts" />
|
||||
|
||||
/// <reference path="SslSocket.d.ts" />
|
||||
|
||||
/// <reference path="Stat.d.ts" />
|
||||
|
||||
/// <reference path="Stats.d.ts" />
|
||||
|
||||
/// <reference path="Stream.d.ts" />
|
||||
|
||||
/// <reference path="StringDecoder.d.ts" />
|
||||
|
||||
/// <reference path="SubProcess.d.ts" />
|
||||
|
||||
/// <reference path="TcpServer.d.ts" />
|
||||
|
||||
/// <reference path="Timer.d.ts" />
|
||||
|
||||
/// <reference path="UrlObject.d.ts" />
|
||||
|
||||
/// <reference path="WebSocket.d.ts" />
|
||||
|
||||
/// <reference path="WebSocketMessage.d.ts" />
|
||||
|
||||
/// <reference path="WebView.d.ts" />
|
||||
|
||||
/// <reference path="Worker.d.ts" />
|
||||
|
||||
/// <reference path="X509Cert.d.ts" />
|
||||
|
||||
/// <reference path="X509Crl.d.ts" />
|
||||
|
||||
/// <reference path="X509Req.d.ts" />
|
||||
|
||||
/// <reference path="XmlAttr.d.ts" />
|
||||
|
||||
/// <reference path="XmlCDATASection.d.ts" />
|
||||
|
||||
/// <reference path="XmlCharacterData.d.ts" />
|
||||
|
||||
/// <reference path="XmlComment.d.ts" />
|
||||
|
||||
/// <reference path="XmlDocument.d.ts" />
|
||||
|
||||
/// <reference path="XmlDocumentType.d.ts" />
|
||||
|
||||
/// <reference path="XmlElement.d.ts" />
|
||||
|
||||
/// <reference path="XmlNamedNodeMap.d.ts" />
|
||||
|
||||
/// <reference path="XmlNode.d.ts" />
|
||||
|
||||
/// <reference path="XmlNodeList.d.ts" />
|
||||
|
||||
/// <reference path="XmlProcessingInstruction.d.ts" />
|
||||
|
||||
/// <reference path="XmlText.d.ts" />
|
||||
|
||||
/// <reference path="ZipFile.d.ts" />
|
||||
|
||||
/// <reference path="ZmqSocket.d.ts" />
|
||||
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief base32 编码与解码模块
|
||||
* @detail 引用方式:,```JavaScript,var encoding = require('encoding');,var base32 = encoding.base32;,```,或者,```JavaScript,var base32 = require('base32');,```
|
||||
*/
|
||||
declare module "base32" {
|
||||
|
||||
|
||||
module base32 {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 以 base32 方式编码数据
|
||||
* @param data 要编码的数据
|
||||
* @return 返回编码的字符串
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function encode(data: Class_Buffer): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 以 base32 方式解码字符串为二进制数据
|
||||
* @param data 要解码的字符串
|
||||
* @return 返回解码的二进制数据
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function decode(data: string): Class_Buffer;
|
||||
|
||||
} /** end of `module base32` */
|
||||
export = base32
|
||||
}
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+240
@@ -0,0 +1,240 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <reference path="Buffer.d.ts" />
|
||||
|
||||
/// <reference path="BufferedStream.d.ts" />
|
||||
|
||||
/// <reference path="Chain.d.ts" />
|
||||
|
||||
/// <reference path="Cipher.d.ts" />
|
||||
|
||||
/// <reference path="Condition.d.ts" />
|
||||
|
||||
/// <reference path="DbConnection.d.ts" />
|
||||
|
||||
/// <reference path="DgramSocket.d.ts" />
|
||||
|
||||
/// <reference path="Digest.d.ts" />
|
||||
|
||||
/// <reference path="Event.d.ts" />
|
||||
|
||||
/// <reference path="EventEmitter.d.ts" />
|
||||
|
||||
/// <reference path="EventInfo.d.ts" />
|
||||
|
||||
/// <reference path="Fiber.d.ts" />
|
||||
|
||||
/// <reference path="File.d.ts" />
|
||||
|
||||
/// <reference path="Handler.d.ts" />
|
||||
|
||||
/// <reference path="HandlerEx.d.ts" />
|
||||
|
||||
/// <reference path="HeapGraphEdge.d.ts" />
|
||||
|
||||
/// <reference path="HeapGraphNode.d.ts" />
|
||||
|
||||
/// <reference path="HeapSnapshot.d.ts" />
|
||||
|
||||
/// <reference path="HttpClient.d.ts" />
|
||||
|
||||
/// <reference path="HttpCollection.d.ts" />
|
||||
|
||||
/// <reference path="HttpCookie.d.ts" />
|
||||
|
||||
/// <reference path="HttpHandler.d.ts" />
|
||||
|
||||
/// <reference path="HttpMessage.d.ts" />
|
||||
|
||||
/// <reference path="HttpRequest.d.ts" />
|
||||
|
||||
/// <reference path="HttpResponse.d.ts" />
|
||||
|
||||
/// <reference path="HttpServer.d.ts" />
|
||||
|
||||
/// <reference path="HttpUploadData.d.ts" />
|
||||
|
||||
/// <reference path="HttpsServer.d.ts" />
|
||||
|
||||
/// <reference path="Image.d.ts" />
|
||||
|
||||
/// <reference path="Int64.d.ts" />
|
||||
|
||||
/// <reference path="LevelDB.d.ts" />
|
||||
|
||||
/// <reference path="Lock.d.ts" />
|
||||
|
||||
/// <reference path="LruCache.d.ts" />
|
||||
|
||||
/// <reference path="MSSQL.d.ts" />
|
||||
|
||||
/// <reference path="MemoryStream.d.ts" />
|
||||
|
||||
/// <reference path="Message.d.ts" />
|
||||
|
||||
/// <reference path="MongoCollection.d.ts" />
|
||||
|
||||
/// <reference path="MongoCursor.d.ts" />
|
||||
|
||||
/// <reference path="MongoDB.d.ts" />
|
||||
|
||||
/// <reference path="MongoID.d.ts" />
|
||||
|
||||
/// <reference path="MySQL.d.ts" />
|
||||
|
||||
/// <reference path="PKey.d.ts" />
|
||||
|
||||
/// <reference path="Redis.d.ts" />
|
||||
|
||||
/// <reference path="RedisHash.d.ts" />
|
||||
|
||||
/// <reference path="RedisList.d.ts" />
|
||||
|
||||
/// <reference path="RedisSet.d.ts" />
|
||||
|
||||
/// <reference path="RedisSortedSet.d.ts" />
|
||||
|
||||
/// <reference path="Routing.d.ts" />
|
||||
|
||||
/// <reference path="SQLite.d.ts" />
|
||||
|
||||
/// <reference path="SandBox.d.ts" />
|
||||
|
||||
/// <reference path="SeekableStream.d.ts" />
|
||||
|
||||
/// <reference path="Semaphore.d.ts" />
|
||||
|
||||
/// <reference path="Service.d.ts" />
|
||||
|
||||
/// <reference path="Smtp.d.ts" />
|
||||
|
||||
/// <reference path="Socket.d.ts" />
|
||||
|
||||
/// <reference path="SslHandler.d.ts" />
|
||||
|
||||
/// <reference path="SslServer.d.ts" />
|
||||
|
||||
/// <reference path="SslSocket.d.ts" />
|
||||
|
||||
/// <reference path="Stat.d.ts" />
|
||||
|
||||
/// <reference path="Stats.d.ts" />
|
||||
|
||||
/// <reference path="Stream.d.ts" />
|
||||
|
||||
/// <reference path="StringDecoder.d.ts" />
|
||||
|
||||
/// <reference path="SubProcess.d.ts" />
|
||||
|
||||
/// <reference path="TcpServer.d.ts" />
|
||||
|
||||
/// <reference path="Timer.d.ts" />
|
||||
|
||||
/// <reference path="UrlObject.d.ts" />
|
||||
|
||||
/// <reference path="WebSocket.d.ts" />
|
||||
|
||||
/// <reference path="WebSocketMessage.d.ts" />
|
||||
|
||||
/// <reference path="WebView.d.ts" />
|
||||
|
||||
/// <reference path="Worker.d.ts" />
|
||||
|
||||
/// <reference path="X509Cert.d.ts" />
|
||||
|
||||
/// <reference path="X509Crl.d.ts" />
|
||||
|
||||
/// <reference path="X509Req.d.ts" />
|
||||
|
||||
/// <reference path="XmlAttr.d.ts" />
|
||||
|
||||
/// <reference path="XmlCDATASection.d.ts" />
|
||||
|
||||
/// <reference path="XmlCharacterData.d.ts" />
|
||||
|
||||
/// <reference path="XmlComment.d.ts" />
|
||||
|
||||
/// <reference path="XmlDocument.d.ts" />
|
||||
|
||||
/// <reference path="XmlDocumentType.d.ts" />
|
||||
|
||||
/// <reference path="XmlElement.d.ts" />
|
||||
|
||||
/// <reference path="XmlNamedNodeMap.d.ts" />
|
||||
|
||||
/// <reference path="XmlNode.d.ts" />
|
||||
|
||||
/// <reference path="XmlNodeList.d.ts" />
|
||||
|
||||
/// <reference path="XmlProcessingInstruction.d.ts" />
|
||||
|
||||
/// <reference path="XmlText.d.ts" />
|
||||
|
||||
/// <reference path="ZipFile.d.ts" />
|
||||
|
||||
/// <reference path="ZmqSocket.d.ts" />
|
||||
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief base64 编码与解码模块
|
||||
* @detail 引用方式:,```JavaScript,var encoding = require('encoding');,var base64 = encoding.base64;,```,或者,```JavaScript,var base64 = require('base64');,```
|
||||
*/
|
||||
declare module "base64" {
|
||||
|
||||
|
||||
module base64 {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 以 base64 方式编码数据
|
||||
* @param data 要编码的数据
|
||||
* @param url 指定是否使用 url 安全字符编码
|
||||
* @return 返回编码的字符串
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function encode(data: Class_Buffer, url?: boolean/** = false*/): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 以 base64 方式解码字符串为二进制数据
|
||||
* @param data 要解码的字符串
|
||||
* @return 返回解码的二进制数据
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function decode(data: string): Class_Buffer;
|
||||
|
||||
} /** end of `module base64` */
|
||||
export = base64
|
||||
}
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+250
@@ -0,0 +1,250 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <reference path="Buffer.d.ts" />
|
||||
|
||||
/// <reference path="BufferedStream.d.ts" />
|
||||
|
||||
/// <reference path="Chain.d.ts" />
|
||||
|
||||
/// <reference path="Cipher.d.ts" />
|
||||
|
||||
/// <reference path="Condition.d.ts" />
|
||||
|
||||
/// <reference path="DbConnection.d.ts" />
|
||||
|
||||
/// <reference path="DgramSocket.d.ts" />
|
||||
|
||||
/// <reference path="Digest.d.ts" />
|
||||
|
||||
/// <reference path="Event.d.ts" />
|
||||
|
||||
/// <reference path="EventEmitter.d.ts" />
|
||||
|
||||
/// <reference path="EventInfo.d.ts" />
|
||||
|
||||
/// <reference path="Fiber.d.ts" />
|
||||
|
||||
/// <reference path="File.d.ts" />
|
||||
|
||||
/// <reference path="Handler.d.ts" />
|
||||
|
||||
/// <reference path="HandlerEx.d.ts" />
|
||||
|
||||
/// <reference path="HeapGraphEdge.d.ts" />
|
||||
|
||||
/// <reference path="HeapGraphNode.d.ts" />
|
||||
|
||||
/// <reference path="HeapSnapshot.d.ts" />
|
||||
|
||||
/// <reference path="HttpClient.d.ts" />
|
||||
|
||||
/// <reference path="HttpCollection.d.ts" />
|
||||
|
||||
/// <reference path="HttpCookie.d.ts" />
|
||||
|
||||
/// <reference path="HttpHandler.d.ts" />
|
||||
|
||||
/// <reference path="HttpMessage.d.ts" />
|
||||
|
||||
/// <reference path="HttpRequest.d.ts" />
|
||||
|
||||
/// <reference path="HttpResponse.d.ts" />
|
||||
|
||||
/// <reference path="HttpServer.d.ts" />
|
||||
|
||||
/// <reference path="HttpUploadData.d.ts" />
|
||||
|
||||
/// <reference path="HttpsServer.d.ts" />
|
||||
|
||||
/// <reference path="Image.d.ts" />
|
||||
|
||||
/// <reference path="Int64.d.ts" />
|
||||
|
||||
/// <reference path="LevelDB.d.ts" />
|
||||
|
||||
/// <reference path="Lock.d.ts" />
|
||||
|
||||
/// <reference path="LruCache.d.ts" />
|
||||
|
||||
/// <reference path="MSSQL.d.ts" />
|
||||
|
||||
/// <reference path="MemoryStream.d.ts" />
|
||||
|
||||
/// <reference path="Message.d.ts" />
|
||||
|
||||
/// <reference path="MongoCollection.d.ts" />
|
||||
|
||||
/// <reference path="MongoCursor.d.ts" />
|
||||
|
||||
/// <reference path="MongoDB.d.ts" />
|
||||
|
||||
/// <reference path="MongoID.d.ts" />
|
||||
|
||||
/// <reference path="MySQL.d.ts" />
|
||||
|
||||
/// <reference path="PKey.d.ts" />
|
||||
|
||||
/// <reference path="Redis.d.ts" />
|
||||
|
||||
/// <reference path="RedisHash.d.ts" />
|
||||
|
||||
/// <reference path="RedisList.d.ts" />
|
||||
|
||||
/// <reference path="RedisSet.d.ts" />
|
||||
|
||||
/// <reference path="RedisSortedSet.d.ts" />
|
||||
|
||||
/// <reference path="Routing.d.ts" />
|
||||
|
||||
/// <reference path="SQLite.d.ts" />
|
||||
|
||||
/// <reference path="SandBox.d.ts" />
|
||||
|
||||
/// <reference path="SeekableStream.d.ts" />
|
||||
|
||||
/// <reference path="Semaphore.d.ts" />
|
||||
|
||||
/// <reference path="Service.d.ts" />
|
||||
|
||||
/// <reference path="Smtp.d.ts" />
|
||||
|
||||
/// <reference path="Socket.d.ts" />
|
||||
|
||||
/// <reference path="SslHandler.d.ts" />
|
||||
|
||||
/// <reference path="SslServer.d.ts" />
|
||||
|
||||
/// <reference path="SslSocket.d.ts" />
|
||||
|
||||
/// <reference path="Stat.d.ts" />
|
||||
|
||||
/// <reference path="Stats.d.ts" />
|
||||
|
||||
/// <reference path="Stream.d.ts" />
|
||||
|
||||
/// <reference path="StringDecoder.d.ts" />
|
||||
|
||||
/// <reference path="SubProcess.d.ts" />
|
||||
|
||||
/// <reference path="TcpServer.d.ts" />
|
||||
|
||||
/// <reference path="Timer.d.ts" />
|
||||
|
||||
/// <reference path="UrlObject.d.ts" />
|
||||
|
||||
/// <reference path="WebSocket.d.ts" />
|
||||
|
||||
/// <reference path="WebSocketMessage.d.ts" />
|
||||
|
||||
/// <reference path="WebView.d.ts" />
|
||||
|
||||
/// <reference path="Worker.d.ts" />
|
||||
|
||||
/// <reference path="X509Cert.d.ts" />
|
||||
|
||||
/// <reference path="X509Crl.d.ts" />
|
||||
|
||||
/// <reference path="X509Req.d.ts" />
|
||||
|
||||
/// <reference path="XmlAttr.d.ts" />
|
||||
|
||||
/// <reference path="XmlCDATASection.d.ts" />
|
||||
|
||||
/// <reference path="XmlCharacterData.d.ts" />
|
||||
|
||||
/// <reference path="XmlComment.d.ts" />
|
||||
|
||||
/// <reference path="XmlDocument.d.ts" />
|
||||
|
||||
/// <reference path="XmlDocumentType.d.ts" />
|
||||
|
||||
/// <reference path="XmlElement.d.ts" />
|
||||
|
||||
/// <reference path="XmlNamedNodeMap.d.ts" />
|
||||
|
||||
/// <reference path="XmlNode.d.ts" />
|
||||
|
||||
/// <reference path="XmlNodeList.d.ts" />
|
||||
|
||||
/// <reference path="XmlProcessingInstruction.d.ts" />
|
||||
|
||||
/// <reference path="XmlText.d.ts" />
|
||||
|
||||
/// <reference path="ZipFile.d.ts" />
|
||||
|
||||
/// <reference path="ZmqSocket.d.ts" />
|
||||
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief base64vlq 编码与解码模块
|
||||
* @detail 引用方式:,```JavaScript,var encoding = require('encoding');,var base64vlq = encoding.base64vlq;,```,或者,```JavaScript,var base64vlq = require('base64vlq');,```
|
||||
*/
|
||||
declare module "base64vlq" {
|
||||
|
||||
|
||||
module base64vlq {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 以 base64vlq 方式编码数据
|
||||
* @param data 要编码的数据
|
||||
* @return 返回编码的字符串
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function encode(data: number): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 以 base64vlq 方式编码数据
|
||||
* @param data 要编码的数据
|
||||
* @return 返回编码的字符串
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function encode(data: any[]): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 以 base64vlq 方式解码字符串为二进制数据
|
||||
* @param data 要解码的字符串
|
||||
* @return 返回解码的二进制数据
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function decode(data: string): any[];
|
||||
|
||||
} /** end of `module base64vlq` */
|
||||
export = base64vlq
|
||||
}
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+239
@@ -0,0 +1,239 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <reference path="Buffer.d.ts" />
|
||||
|
||||
/// <reference path="BufferedStream.d.ts" />
|
||||
|
||||
/// <reference path="Chain.d.ts" />
|
||||
|
||||
/// <reference path="Cipher.d.ts" />
|
||||
|
||||
/// <reference path="Condition.d.ts" />
|
||||
|
||||
/// <reference path="DbConnection.d.ts" />
|
||||
|
||||
/// <reference path="DgramSocket.d.ts" />
|
||||
|
||||
/// <reference path="Digest.d.ts" />
|
||||
|
||||
/// <reference path="Event.d.ts" />
|
||||
|
||||
/// <reference path="EventEmitter.d.ts" />
|
||||
|
||||
/// <reference path="EventInfo.d.ts" />
|
||||
|
||||
/// <reference path="Fiber.d.ts" />
|
||||
|
||||
/// <reference path="File.d.ts" />
|
||||
|
||||
/// <reference path="Handler.d.ts" />
|
||||
|
||||
/// <reference path="HandlerEx.d.ts" />
|
||||
|
||||
/// <reference path="HeapGraphEdge.d.ts" />
|
||||
|
||||
/// <reference path="HeapGraphNode.d.ts" />
|
||||
|
||||
/// <reference path="HeapSnapshot.d.ts" />
|
||||
|
||||
/// <reference path="HttpClient.d.ts" />
|
||||
|
||||
/// <reference path="HttpCollection.d.ts" />
|
||||
|
||||
/// <reference path="HttpCookie.d.ts" />
|
||||
|
||||
/// <reference path="HttpHandler.d.ts" />
|
||||
|
||||
/// <reference path="HttpMessage.d.ts" />
|
||||
|
||||
/// <reference path="HttpRequest.d.ts" />
|
||||
|
||||
/// <reference path="HttpResponse.d.ts" />
|
||||
|
||||
/// <reference path="HttpServer.d.ts" />
|
||||
|
||||
/// <reference path="HttpUploadData.d.ts" />
|
||||
|
||||
/// <reference path="HttpsServer.d.ts" />
|
||||
|
||||
/// <reference path="Image.d.ts" />
|
||||
|
||||
/// <reference path="Int64.d.ts" />
|
||||
|
||||
/// <reference path="LevelDB.d.ts" />
|
||||
|
||||
/// <reference path="Lock.d.ts" />
|
||||
|
||||
/// <reference path="LruCache.d.ts" />
|
||||
|
||||
/// <reference path="MSSQL.d.ts" />
|
||||
|
||||
/// <reference path="MemoryStream.d.ts" />
|
||||
|
||||
/// <reference path="Message.d.ts" />
|
||||
|
||||
/// <reference path="MongoCollection.d.ts" />
|
||||
|
||||
/// <reference path="MongoCursor.d.ts" />
|
||||
|
||||
/// <reference path="MongoDB.d.ts" />
|
||||
|
||||
/// <reference path="MongoID.d.ts" />
|
||||
|
||||
/// <reference path="MySQL.d.ts" />
|
||||
|
||||
/// <reference path="PKey.d.ts" />
|
||||
|
||||
/// <reference path="Redis.d.ts" />
|
||||
|
||||
/// <reference path="RedisHash.d.ts" />
|
||||
|
||||
/// <reference path="RedisList.d.ts" />
|
||||
|
||||
/// <reference path="RedisSet.d.ts" />
|
||||
|
||||
/// <reference path="RedisSortedSet.d.ts" />
|
||||
|
||||
/// <reference path="Routing.d.ts" />
|
||||
|
||||
/// <reference path="SQLite.d.ts" />
|
||||
|
||||
/// <reference path="SandBox.d.ts" />
|
||||
|
||||
/// <reference path="SeekableStream.d.ts" />
|
||||
|
||||
/// <reference path="Semaphore.d.ts" />
|
||||
|
||||
/// <reference path="Service.d.ts" />
|
||||
|
||||
/// <reference path="Smtp.d.ts" />
|
||||
|
||||
/// <reference path="Socket.d.ts" />
|
||||
|
||||
/// <reference path="SslHandler.d.ts" />
|
||||
|
||||
/// <reference path="SslServer.d.ts" />
|
||||
|
||||
/// <reference path="SslSocket.d.ts" />
|
||||
|
||||
/// <reference path="Stat.d.ts" />
|
||||
|
||||
/// <reference path="Stats.d.ts" />
|
||||
|
||||
/// <reference path="Stream.d.ts" />
|
||||
|
||||
/// <reference path="StringDecoder.d.ts" />
|
||||
|
||||
/// <reference path="SubProcess.d.ts" />
|
||||
|
||||
/// <reference path="TcpServer.d.ts" />
|
||||
|
||||
/// <reference path="Timer.d.ts" />
|
||||
|
||||
/// <reference path="UrlObject.d.ts" />
|
||||
|
||||
/// <reference path="WebSocket.d.ts" />
|
||||
|
||||
/// <reference path="WebSocketMessage.d.ts" />
|
||||
|
||||
/// <reference path="WebView.d.ts" />
|
||||
|
||||
/// <reference path="Worker.d.ts" />
|
||||
|
||||
/// <reference path="X509Cert.d.ts" />
|
||||
|
||||
/// <reference path="X509Crl.d.ts" />
|
||||
|
||||
/// <reference path="X509Req.d.ts" />
|
||||
|
||||
/// <reference path="XmlAttr.d.ts" />
|
||||
|
||||
/// <reference path="XmlCDATASection.d.ts" />
|
||||
|
||||
/// <reference path="XmlCharacterData.d.ts" />
|
||||
|
||||
/// <reference path="XmlComment.d.ts" />
|
||||
|
||||
/// <reference path="XmlDocument.d.ts" />
|
||||
|
||||
/// <reference path="XmlDocumentType.d.ts" />
|
||||
|
||||
/// <reference path="XmlElement.d.ts" />
|
||||
|
||||
/// <reference path="XmlNamedNodeMap.d.ts" />
|
||||
|
||||
/// <reference path="XmlNode.d.ts" />
|
||||
|
||||
/// <reference path="XmlNodeList.d.ts" />
|
||||
|
||||
/// <reference path="XmlProcessingInstruction.d.ts" />
|
||||
|
||||
/// <reference path="XmlText.d.ts" />
|
||||
|
||||
/// <reference path="ZipFile.d.ts" />
|
||||
|
||||
/// <reference path="ZmqSocket.d.ts" />
|
||||
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief bson 编码与解码模块
|
||||
* @detail 引用方式:,```JavaScript,var encoding = require('encoding');,var bson = encoding.bson;,```,或者,```JavaScript,var bson = require('bson');,```
|
||||
*/
|
||||
declare module "bson" {
|
||||
|
||||
|
||||
module bson {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 以 bson 格式编码变量
|
||||
* @param data 要编码的变量
|
||||
* @return 返回编码的二进制数据
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function encode(data: Object): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 以 bson 方式解码字符串为一个变量
|
||||
* @param data 要解码的二进制数据
|
||||
* @return 返回解码的变量
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function decode(data: Class_Buffer): Object;
|
||||
|
||||
} /** end of `module bson` */
|
||||
export = bson
|
||||
}
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+892
@@ -0,0 +1,892 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <reference path="Buffer.d.ts" />
|
||||
|
||||
/// <reference path="BufferedStream.d.ts" />
|
||||
|
||||
/// <reference path="Chain.d.ts" />
|
||||
|
||||
/// <reference path="Cipher.d.ts" />
|
||||
|
||||
/// <reference path="Condition.d.ts" />
|
||||
|
||||
/// <reference path="DbConnection.d.ts" />
|
||||
|
||||
/// <reference path="DgramSocket.d.ts" />
|
||||
|
||||
/// <reference path="Digest.d.ts" />
|
||||
|
||||
/// <reference path="Event.d.ts" />
|
||||
|
||||
/// <reference path="EventEmitter.d.ts" />
|
||||
|
||||
/// <reference path="EventInfo.d.ts" />
|
||||
|
||||
/// <reference path="Fiber.d.ts" />
|
||||
|
||||
/// <reference path="File.d.ts" />
|
||||
|
||||
/// <reference path="Handler.d.ts" />
|
||||
|
||||
/// <reference path="HandlerEx.d.ts" />
|
||||
|
||||
/// <reference path="HeapGraphEdge.d.ts" />
|
||||
|
||||
/// <reference path="HeapGraphNode.d.ts" />
|
||||
|
||||
/// <reference path="HeapSnapshot.d.ts" />
|
||||
|
||||
/// <reference path="HttpClient.d.ts" />
|
||||
|
||||
/// <reference path="HttpCollection.d.ts" />
|
||||
|
||||
/// <reference path="HttpCookie.d.ts" />
|
||||
|
||||
/// <reference path="HttpHandler.d.ts" />
|
||||
|
||||
/// <reference path="HttpMessage.d.ts" />
|
||||
|
||||
/// <reference path="HttpRequest.d.ts" />
|
||||
|
||||
/// <reference path="HttpResponse.d.ts" />
|
||||
|
||||
/// <reference path="HttpServer.d.ts" />
|
||||
|
||||
/// <reference path="HttpUploadData.d.ts" />
|
||||
|
||||
/// <reference path="HttpsServer.d.ts" />
|
||||
|
||||
/// <reference path="Image.d.ts" />
|
||||
|
||||
/// <reference path="Int64.d.ts" />
|
||||
|
||||
/// <reference path="LevelDB.d.ts" />
|
||||
|
||||
/// <reference path="Lock.d.ts" />
|
||||
|
||||
/// <reference path="LruCache.d.ts" />
|
||||
|
||||
/// <reference path="MSSQL.d.ts" />
|
||||
|
||||
/// <reference path="MemoryStream.d.ts" />
|
||||
|
||||
/// <reference path="Message.d.ts" />
|
||||
|
||||
/// <reference path="MongoCollection.d.ts" />
|
||||
|
||||
/// <reference path="MongoCursor.d.ts" />
|
||||
|
||||
/// <reference path="MongoDB.d.ts" />
|
||||
|
||||
/// <reference path="MongoID.d.ts" />
|
||||
|
||||
/// <reference path="MySQL.d.ts" />
|
||||
|
||||
/// <reference path="PKey.d.ts" />
|
||||
|
||||
/// <reference path="Redis.d.ts" />
|
||||
|
||||
/// <reference path="RedisHash.d.ts" />
|
||||
|
||||
/// <reference path="RedisList.d.ts" />
|
||||
|
||||
/// <reference path="RedisSet.d.ts" />
|
||||
|
||||
/// <reference path="RedisSortedSet.d.ts" />
|
||||
|
||||
/// <reference path="Routing.d.ts" />
|
||||
|
||||
/// <reference path="SQLite.d.ts" />
|
||||
|
||||
/// <reference path="SandBox.d.ts" />
|
||||
|
||||
/// <reference path="SeekableStream.d.ts" />
|
||||
|
||||
/// <reference path="Semaphore.d.ts" />
|
||||
|
||||
/// <reference path="Service.d.ts" />
|
||||
|
||||
/// <reference path="Smtp.d.ts" />
|
||||
|
||||
/// <reference path="Socket.d.ts" />
|
||||
|
||||
/// <reference path="SslHandler.d.ts" />
|
||||
|
||||
/// <reference path="SslServer.d.ts" />
|
||||
|
||||
/// <reference path="SslSocket.d.ts" />
|
||||
|
||||
/// <reference path="Stat.d.ts" />
|
||||
|
||||
/// <reference path="Stats.d.ts" />
|
||||
|
||||
/// <reference path="Stream.d.ts" />
|
||||
|
||||
/// <reference path="StringDecoder.d.ts" />
|
||||
|
||||
/// <reference path="SubProcess.d.ts" />
|
||||
|
||||
/// <reference path="TcpServer.d.ts" />
|
||||
|
||||
/// <reference path="Timer.d.ts" />
|
||||
|
||||
/// <reference path="UrlObject.d.ts" />
|
||||
|
||||
/// <reference path="WebSocket.d.ts" />
|
||||
|
||||
/// <reference path="WebSocketMessage.d.ts" />
|
||||
|
||||
/// <reference path="WebView.d.ts" />
|
||||
|
||||
/// <reference path="Worker.d.ts" />
|
||||
|
||||
/// <reference path="X509Cert.d.ts" />
|
||||
|
||||
/// <reference path="X509Crl.d.ts" />
|
||||
|
||||
/// <reference path="X509Req.d.ts" />
|
||||
|
||||
/// <reference path="XmlAttr.d.ts" />
|
||||
|
||||
/// <reference path="XmlCDATASection.d.ts" />
|
||||
|
||||
/// <reference path="XmlCharacterData.d.ts" />
|
||||
|
||||
/// <reference path="XmlComment.d.ts" />
|
||||
|
||||
/// <reference path="XmlDocument.d.ts" />
|
||||
|
||||
/// <reference path="XmlDocumentType.d.ts" />
|
||||
|
||||
/// <reference path="XmlElement.d.ts" />
|
||||
|
||||
/// <reference path="XmlNamedNodeMap.d.ts" />
|
||||
|
||||
/// <reference path="XmlNode.d.ts" />
|
||||
|
||||
/// <reference path="XmlNodeList.d.ts" />
|
||||
|
||||
/// <reference path="XmlProcessingInstruction.d.ts" />
|
||||
|
||||
/// <reference path="XmlText.d.ts" />
|
||||
|
||||
/// <reference path="ZipFile.d.ts" />
|
||||
|
||||
/// <reference path="ZmqSocket.d.ts" />
|
||||
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 控制台访问对象
|
||||
* @detail 全局对象。可用于提示信息,警告和错误记录。通过启动配置文件,可将日志定位到不同的设备,以便于跟踪。日志支持格式化输出,例如:,```JavaScript,console.log("%d + %d = %d", 100, 200, 100 + 200);,```,可以使用的格式化参数如下:,- %s - 字符串,- %d - 数字,包括整数和数字,- %j - 以 JSON 格式输出对象,- %% - 输出字符 '%' 本身
|
||||
*/
|
||||
declare module "console" {
|
||||
|
||||
|
||||
module console {
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief loglevel 级别常量
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const FATAL = 0;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief loglevel 级别常量
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const ALERT = 1;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief loglevel 级别常量
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const CRIT = 2;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief loglevel 级别常量
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const ERROR = 3;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief loglevel 级别常量
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const WARN = 4;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief loglevel 级别常量
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const NOTICE = 5;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief loglevel 级别常量
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const INFO = 6;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief loglevel 级别常量
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const DEBUG = 7;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief loglevel 仅用于输出,信息输出后不换行,file 和 syslog 不保存此级别信息
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const PRINT = 9;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief loglevel 级别常量
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const NOTSET = 10;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 添加 console 输出系统,支持的设备为 console, syslog, event,最多可以添加 10 个输出
|
||||
*
|
||||
* 通过配置 console,可以将程序输出和系统错误发往不同设备,用于运行环境信息收集。
|
||||
*
|
||||
* type 为配置,为设备名称字符串:
|
||||
*
|
||||
* ```JavaScript
|
||||
* console.add("console");
|
||||
* ```
|
||||
*
|
||||
* syslog 仅在 posix 平台有效:
|
||||
* ```JavaScript
|
||||
* console.add("syslog");
|
||||
* ```
|
||||
*
|
||||
* event 仅在 windows 平台有效:
|
||||
* ```JavaScript
|
||||
* console.add("event");
|
||||
* ```
|
||||
*
|
||||
* @param type 输出设备
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function add(type: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 添加 console 输出系统,支持的设备为 console, syslog, event 和 file,最多可以添加 10 个输出
|
||||
*
|
||||
* 通过配置 console,可以将程序输出和系统错误发往不同设备,用于运行环境信息收集。
|
||||
*
|
||||
* cfg 可以为一个设备配置对象:
|
||||
* ```JavaScript
|
||||
* console.add({
|
||||
* type: "console",
|
||||
* levels: [console.INFO, console.ERROR] // 选项,省略则输出全部级别日志
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* syslog 仅在 posix 平台有效:
|
||||
* ```JavaScript
|
||||
* console.add({
|
||||
* type: "syslog",
|
||||
* levels: [console.INFO, console.ERROR]
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* event 仅在 windows 平台有效:
|
||||
* ```JavaScript
|
||||
* console.add({
|
||||
* type: "event",
|
||||
* levels: [console.INFO, console.ERROR]
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* file 日志:
|
||||
* ```JavaScript
|
||||
* console.add({
|
||||
* type: "file",
|
||||
* levels: [console.INFO, console.ERROR],
|
||||
* // 必选项,指定日志输出文件,可使用 s% 指定插入日期位置,不指定则添加在结尾
|
||||
* path: "path/to/file_%s.log",
|
||||
* // 选项,可选值为 "day", "hour", "minute", "###k", "###m", "###g",缺省为 "1m"
|
||||
* split: "30m",
|
||||
* // 选项,可选范围为 2-128,缺省为 128
|
||||
* count: 10
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @param cfg 输出配置
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function add(cfg: Object): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 批量添加 console 输出系统,支持的设备为 console, syslog, event 和 file,最多可以添加 10 个输出
|
||||
*
|
||||
* 通过配置 console,可以将程序输出和系统错误发往不同设备,用于运行环境信息收集。
|
||||
*
|
||||
* ```JavaScript
|
||||
* console.add(["console", {
|
||||
* type: "syslog",
|
||||
* levels: [console.INFO, console.ERROR]
|
||||
* }]);
|
||||
* ```
|
||||
*
|
||||
* @param cfg 输出配置数组
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function add(cfg: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 初始化到缺省设置,只在 console 输出信息
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function reset(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 记录普通日志信息,与 info 等同
|
||||
*
|
||||
* 记录一般等级的日志信息。通常用于输出非错误性提示信息。
|
||||
* @param fmt 格式化字符串
|
||||
* @param args 可选参数列表
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function log(fmt: string, ...args: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 记录普通日志信息,与 info 等同
|
||||
*
|
||||
* 记录一般等级的日志信息。通常用于输出非错误性提示信息。
|
||||
* @param args 可选参数列表
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function log(...args: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 记录调试日志信息
|
||||
*
|
||||
* 记录调试日志信息。通常用于输出调试信息。不重要。
|
||||
* @param fmt 格式化字符串
|
||||
* @param args 可选参数列表
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function debug(fmt: string, ...args: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 记录调试日志信息
|
||||
*
|
||||
* 记录调试日志信息。通常用于输出调试信息。不重要。
|
||||
* @param args 可选参数列表
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function debug(...args: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 记录普通日志信息,与 log 等同
|
||||
*
|
||||
* 记录一般等级的日志信息。通常用于输出非错误性提示信息。
|
||||
* @param fmt 格式化字符串
|
||||
* @param args 可选参数列表
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function info(fmt: string, ...args: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 记录普通日志信息,与 log 等同
|
||||
*
|
||||
* 记录一般等级的日志信息。通常用于输出非错误性提示信息。
|
||||
* @param args 可选参数列表
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function info(...args: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 记录警告日志信息
|
||||
*
|
||||
* 记录警告日志信息。通常用于输出提示性调试信息。一般重要。
|
||||
* @param fmt 格式化字符串
|
||||
* @param args 可选参数列表
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function notice(fmt: string, ...args: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 记录警告日志信息
|
||||
*
|
||||
* 记录警告日志信息。通常用于输出提示性调试信息。一般重要。
|
||||
* @param args 可选参数列表
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function notice(...args: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 记录警告日志信息
|
||||
*
|
||||
* 记录警告日志信息。通常用于输出警告性调试信息。重要。
|
||||
* @param fmt 格式化字符串
|
||||
* @param args 可选参数列表
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function warn(fmt: string, ...args: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 记录警告日志信息
|
||||
*
|
||||
* 记录警告日志信息。通常用于输出警告性调试信息。重要。
|
||||
* @param args 可选参数列表
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function warn(...args: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 记录错误日志信息
|
||||
*
|
||||
* 记录用于错误日志信息。通常用于输出错误信息。非常重要。系统的出错信息也会以此等级记录。
|
||||
* @param fmt 格式化字符串
|
||||
* @param args 可选参数列表
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function error(fmt: string, ...args: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 记录错误日志信息
|
||||
*
|
||||
* 记录用于错误日志信息。通常用于输出错误信息。非常重要。系统的出错信息也会以此等级记录。
|
||||
* @param args 可选参数列表
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function error(...args: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 记录关键错误日志信息
|
||||
*
|
||||
* 记录用于关键错误日志信息。通常用于输出关键错误信息。非常重要。
|
||||
* @param fmt 格式化字符串
|
||||
* @param args 可选参数列表
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function crit(fmt: string, ...args: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 记录关键错误日志信息
|
||||
*
|
||||
* 记录用于关键错误日志信息。通常用于输出关键错误信息。非常重要。
|
||||
* @param args 可选参数列表
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function crit(...args: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 记录警报错误日志信息
|
||||
*
|
||||
* 记录用于警报错误日志信息。通常用于输出警报错误信息。非常重要。为最高级别信息。
|
||||
* @param fmt 格式化字符串
|
||||
* @param args 可选参数列表
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function alert(fmt: string, ...args: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 记录警报错误日志信息
|
||||
*
|
||||
* 记录用于警报错误日志信息。通常用于输出警报错误信息。非常重要。为最高级别信息。
|
||||
* @param args 可选参数列表
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function alert(...args: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 用 JSON 格式输出对象
|
||||
* @param obj 给定要显示的对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function dir(obj: any): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 启动一个计时器
|
||||
*
|
||||
* @param label 标题,缺省为空字符串。
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function time(label?: string/** = "time"*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 输出指定计时器当前计时值
|
||||
*
|
||||
* @param label 标题,缺省为空字符串。
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function timeElapse(label?: string/** = "time"*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 结束指定计时器,并输出最后计时值
|
||||
*
|
||||
* @param label 标题,缺省为空字符串。
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function timeEnd(label?: string/** = "time"*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 输出当前调用堆栈
|
||||
*
|
||||
* 通过日志输出当前调用堆栈。
|
||||
* @param label 标题,缺省为空字符串。
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function trace(label?: string/** = "trace"*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 断言测试,如果测试值为假,则报错
|
||||
* @param value 测试的数值
|
||||
* @param msg 报错信息
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function assert(value: any, msg?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 向控制台输出格式化文本,输出内容不会记入日志系统,输出文本后不会自动换行,可连续输出
|
||||
* @param fmt 格式化字符串
|
||||
* @param args 可选参数列表
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function print(fmt: string, ...args: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 向控制台输出格式化文本,输出内容不会记入日志系统,输出文本后不会自动换行,可连续输出
|
||||
* @param args 可选参数列表
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function print(...args: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 移动控制台光标到指定位置
|
||||
* @param row 指定新光标的行坐标
|
||||
* @param column 指定新光标的列坐标
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function moveTo(row: number, column: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 隐藏控制台光标
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function hideCursor(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 显示控制台光标
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function showCursor(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 清除控制台
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function clear(): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 按下一个按键
|
||||
*
|
||||
* 参数 key 可以使用字符串传入功能键:
|
||||
* - 功能键:f1 - f12
|
||||
* - 方向键:up, down,left, right, home, end, pageup, pagedown
|
||||
* - 编辑键:backspace, delete, insert, enter, tab, escape, space
|
||||
* - 控制键:control, alt, shift, command
|
||||
* @param key 指定按键,单字符直接传入,功能键传入名称
|
||||
* @param modifier 指定控制键,可以为:control, alt, shift, command
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function keyDown(key: string, modifier?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 按下一个按键
|
||||
*
|
||||
* 参数 key 可以使用字符串传入功能键:
|
||||
* - 功能键:f1 - f12
|
||||
* - 方向键:up, down,left, right, home, end, pageup, pagedown
|
||||
* - 编辑键:backspace, delete, insert, enter, tab, escape, space
|
||||
* - 控制键:control, alt, shift, command
|
||||
* @param key 指定按键,单字符直接传入,功能键传入名称
|
||||
* @param modifier 指定控制键数组,可以为:control, alt, shift, command
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function keyDown(key: string, modifier: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 松开一个按键
|
||||
*
|
||||
* 参数 key 可以使用字符串传入功能键:
|
||||
* - 功能键:f1 - f12
|
||||
* - 方向键:up, down,left, right, home, end, pageup, pagedown
|
||||
* - 编辑键:backspace, delete, insert, enter, tab, escape, space
|
||||
* - 控制键:control, alt, shift, command
|
||||
* @param key 指定按键,单字符直接传入,功能键传入名称
|
||||
* @param modifier 指定控制键,可以为:control, alt, shift, command
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function keyUp(key: string, modifier?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 松开一个按键
|
||||
*
|
||||
* 参数 key 可以使用字符串传入功能键:
|
||||
* - 功能键:f1 - f12
|
||||
* - 方向键:up, down,left, right, home, end, pageup, pagedown
|
||||
* - 编辑键:backspace, delete, insert, enter, tab, escape, space
|
||||
* - 控制键:control, alt, shift, command
|
||||
* @param key 指定按键,单字符直接传入,功能键传入名称
|
||||
* @param modifier 指定控制键数组,可以为:control, alt, shift, command
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function keyUp(key: string, modifier: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 点击并松开一个按键
|
||||
*
|
||||
* 参数 key 可以使用字符串传入功能键:
|
||||
* - 功能键:f1 - f12
|
||||
* - 方向键:up, down,left, right, home, end, pageup, pagedown
|
||||
* - 编辑键:backspace, delete, insert, enter, tab, escape, space
|
||||
* - 控制键:control, alt, shift, command
|
||||
* @param key 指定按键,单字符直接传入,功能键传入名称
|
||||
* @param modifier 指定控制键,可以为:control, alt, shift, command
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function keyTap(key: string, modifier?: string/** = ""*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 点击并松开一个按键
|
||||
*
|
||||
* 参数 key 可以使用字符串传入功能键:
|
||||
* - 功能键:f1 - f12
|
||||
* - 方向键:up, down,left, right, home, end, pageup, pagedown
|
||||
* - 编辑键:backspace, delete, insert, enter, tab, escape, space
|
||||
* - 控制键:control, alt, shift, command
|
||||
* @param key 指定按键,单字符直接传入,功能键传入名称
|
||||
* @param modifier 指定控制键数组,可以为:control, alt, shift, command
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function keyTap(key: string, modifier: any[]): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 输入一个字符串
|
||||
* @param text 指定输入的字符串
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function typeString(text: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 移动鼠标到指定的位置
|
||||
* @param x 指定 x 坐标
|
||||
* @param y 指定 y 坐标
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function moveMouse(x: number, y: number): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 按下一个鼠标键
|
||||
* @param button 指定鼠标键名称,允许值为: left, right, moddle
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function mouseUp(button: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 放开一个鼠标键
|
||||
* @param button 指定鼠标键名称,允许值为: left, right, moddle
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function mouseDown(button: string): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 点击一个鼠标键
|
||||
* @param button 指定鼠标键名称,允许值为: left, right, moddle
|
||||
* @param dbclick 指定是否双击,缺省为 false
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function clickMouse(button: string, dbclick?: boolean/** = false*/): void;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 从控制台读取用户输入
|
||||
* @param msg 提示信息
|
||||
* @return 返回用户输入的信息
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
export function readLine(msg?: string/** = ""*/): string;
|
||||
|
||||
} /** end of `module console` */
|
||||
export = console
|
||||
}
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+217
@@ -0,0 +1,217 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <reference path="Buffer.d.ts" />
|
||||
|
||||
/// <reference path="BufferedStream.d.ts" />
|
||||
|
||||
/// <reference path="Chain.d.ts" />
|
||||
|
||||
/// <reference path="Cipher.d.ts" />
|
||||
|
||||
/// <reference path="Condition.d.ts" />
|
||||
|
||||
/// <reference path="DbConnection.d.ts" />
|
||||
|
||||
/// <reference path="DgramSocket.d.ts" />
|
||||
|
||||
/// <reference path="Digest.d.ts" />
|
||||
|
||||
/// <reference path="Event.d.ts" />
|
||||
|
||||
/// <reference path="EventEmitter.d.ts" />
|
||||
|
||||
/// <reference path="EventInfo.d.ts" />
|
||||
|
||||
/// <reference path="Fiber.d.ts" />
|
||||
|
||||
/// <reference path="File.d.ts" />
|
||||
|
||||
/// <reference path="Handler.d.ts" />
|
||||
|
||||
/// <reference path="HandlerEx.d.ts" />
|
||||
|
||||
/// <reference path="HeapGraphEdge.d.ts" />
|
||||
|
||||
/// <reference path="HeapGraphNode.d.ts" />
|
||||
|
||||
/// <reference path="HeapSnapshot.d.ts" />
|
||||
|
||||
/// <reference path="HttpClient.d.ts" />
|
||||
|
||||
/// <reference path="HttpCollection.d.ts" />
|
||||
|
||||
/// <reference path="HttpCookie.d.ts" />
|
||||
|
||||
/// <reference path="HttpHandler.d.ts" />
|
||||
|
||||
/// <reference path="HttpMessage.d.ts" />
|
||||
|
||||
/// <reference path="HttpRequest.d.ts" />
|
||||
|
||||
/// <reference path="HttpResponse.d.ts" />
|
||||
|
||||
/// <reference path="HttpServer.d.ts" />
|
||||
|
||||
/// <reference path="HttpUploadData.d.ts" />
|
||||
|
||||
/// <reference path="HttpsServer.d.ts" />
|
||||
|
||||
/// <reference path="Image.d.ts" />
|
||||
|
||||
/// <reference path="Int64.d.ts" />
|
||||
|
||||
/// <reference path="LevelDB.d.ts" />
|
||||
|
||||
/// <reference path="Lock.d.ts" />
|
||||
|
||||
/// <reference path="LruCache.d.ts" />
|
||||
|
||||
/// <reference path="MSSQL.d.ts" />
|
||||
|
||||
/// <reference path="MemoryStream.d.ts" />
|
||||
|
||||
/// <reference path="Message.d.ts" />
|
||||
|
||||
/// <reference path="MongoCollection.d.ts" />
|
||||
|
||||
/// <reference path="MongoCursor.d.ts" />
|
||||
|
||||
/// <reference path="MongoDB.d.ts" />
|
||||
|
||||
/// <reference path="MongoID.d.ts" />
|
||||
|
||||
/// <reference path="MySQL.d.ts" />
|
||||
|
||||
/// <reference path="PKey.d.ts" />
|
||||
|
||||
/// <reference path="Redis.d.ts" />
|
||||
|
||||
/// <reference path="RedisHash.d.ts" />
|
||||
|
||||
/// <reference path="RedisList.d.ts" />
|
||||
|
||||
/// <reference path="RedisSet.d.ts" />
|
||||
|
||||
/// <reference path="RedisSortedSet.d.ts" />
|
||||
|
||||
/// <reference path="Routing.d.ts" />
|
||||
|
||||
/// <reference path="SQLite.d.ts" />
|
||||
|
||||
/// <reference path="SandBox.d.ts" />
|
||||
|
||||
/// <reference path="SeekableStream.d.ts" />
|
||||
|
||||
/// <reference path="Semaphore.d.ts" />
|
||||
|
||||
/// <reference path="Service.d.ts" />
|
||||
|
||||
/// <reference path="Smtp.d.ts" />
|
||||
|
||||
/// <reference path="Socket.d.ts" />
|
||||
|
||||
/// <reference path="SslHandler.d.ts" />
|
||||
|
||||
/// <reference path="SslServer.d.ts" />
|
||||
|
||||
/// <reference path="SslSocket.d.ts" />
|
||||
|
||||
/// <reference path="Stat.d.ts" />
|
||||
|
||||
/// <reference path="Stats.d.ts" />
|
||||
|
||||
/// <reference path="Stream.d.ts" />
|
||||
|
||||
/// <reference path="StringDecoder.d.ts" />
|
||||
|
||||
/// <reference path="SubProcess.d.ts" />
|
||||
|
||||
/// <reference path="TcpServer.d.ts" />
|
||||
|
||||
/// <reference path="Timer.d.ts" />
|
||||
|
||||
/// <reference path="UrlObject.d.ts" />
|
||||
|
||||
/// <reference path="WebSocket.d.ts" />
|
||||
|
||||
/// <reference path="WebSocketMessage.d.ts" />
|
||||
|
||||
/// <reference path="WebView.d.ts" />
|
||||
|
||||
/// <reference path="Worker.d.ts" />
|
||||
|
||||
/// <reference path="X509Cert.d.ts" />
|
||||
|
||||
/// <reference path="X509Crl.d.ts" />
|
||||
|
||||
/// <reference path="X509Req.d.ts" />
|
||||
|
||||
/// <reference path="XmlAttr.d.ts" />
|
||||
|
||||
/// <reference path="XmlCDATASection.d.ts" />
|
||||
|
||||
/// <reference path="XmlCharacterData.d.ts" />
|
||||
|
||||
/// <reference path="XmlComment.d.ts" />
|
||||
|
||||
/// <reference path="XmlDocument.d.ts" />
|
||||
|
||||
/// <reference path="XmlDocumentType.d.ts" />
|
||||
|
||||
/// <reference path="XmlElement.d.ts" />
|
||||
|
||||
/// <reference path="XmlNamedNodeMap.d.ts" />
|
||||
|
||||
/// <reference path="XmlNode.d.ts" />
|
||||
|
||||
/// <reference path="XmlNodeList.d.ts" />
|
||||
|
||||
/// <reference path="XmlProcessingInstruction.d.ts" />
|
||||
|
||||
/// <reference path="XmlText.d.ts" />
|
||||
|
||||
/// <reference path="ZipFile.d.ts" />
|
||||
|
||||
/// <reference path="ZmqSocket.d.ts" />
|
||||
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 常用常量定义模块
|
||||
* @detail 引用方法:,```JavaScript,var constants = require('constants');,```
|
||||
*/
|
||||
declare module "constants" {
|
||||
|
||||
|
||||
module constants {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} /** end of `module constants` */
|
||||
export = constants
|
||||
}
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+343
@@ -0,0 +1,343 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <reference path="Buffer.d.ts" />
|
||||
|
||||
/// <reference path="BufferedStream.d.ts" />
|
||||
|
||||
/// <reference path="Chain.d.ts" />
|
||||
|
||||
/// <reference path="Cipher.d.ts" />
|
||||
|
||||
/// <reference path="Condition.d.ts" />
|
||||
|
||||
/// <reference path="DbConnection.d.ts" />
|
||||
|
||||
/// <reference path="DgramSocket.d.ts" />
|
||||
|
||||
/// <reference path="Digest.d.ts" />
|
||||
|
||||
/// <reference path="Event.d.ts" />
|
||||
|
||||
/// <reference path="EventEmitter.d.ts" />
|
||||
|
||||
/// <reference path="EventInfo.d.ts" />
|
||||
|
||||
/// <reference path="Fiber.d.ts" />
|
||||
|
||||
/// <reference path="File.d.ts" />
|
||||
|
||||
/// <reference path="Handler.d.ts" />
|
||||
|
||||
/// <reference path="HandlerEx.d.ts" />
|
||||
|
||||
/// <reference path="HeapGraphEdge.d.ts" />
|
||||
|
||||
/// <reference path="HeapGraphNode.d.ts" />
|
||||
|
||||
/// <reference path="HeapSnapshot.d.ts" />
|
||||
|
||||
/// <reference path="HttpClient.d.ts" />
|
||||
|
||||
/// <reference path="HttpCollection.d.ts" />
|
||||
|
||||
/// <reference path="HttpCookie.d.ts" />
|
||||
|
||||
/// <reference path="HttpHandler.d.ts" />
|
||||
|
||||
/// <reference path="HttpMessage.d.ts" />
|
||||
|
||||
/// <reference path="HttpRequest.d.ts" />
|
||||
|
||||
/// <reference path="HttpResponse.d.ts" />
|
||||
|
||||
/// <reference path="HttpServer.d.ts" />
|
||||
|
||||
/// <reference path="HttpUploadData.d.ts" />
|
||||
|
||||
/// <reference path="HttpsServer.d.ts" />
|
||||
|
||||
/// <reference path="Image.d.ts" />
|
||||
|
||||
/// <reference path="Int64.d.ts" />
|
||||
|
||||
/// <reference path="LevelDB.d.ts" />
|
||||
|
||||
/// <reference path="Lock.d.ts" />
|
||||
|
||||
/// <reference path="LruCache.d.ts" />
|
||||
|
||||
/// <reference path="MSSQL.d.ts" />
|
||||
|
||||
/// <reference path="MemoryStream.d.ts" />
|
||||
|
||||
/// <reference path="Message.d.ts" />
|
||||
|
||||
/// <reference path="MongoCollection.d.ts" />
|
||||
|
||||
/// <reference path="MongoCursor.d.ts" />
|
||||
|
||||
/// <reference path="MongoDB.d.ts" />
|
||||
|
||||
/// <reference path="MongoID.d.ts" />
|
||||
|
||||
/// <reference path="MySQL.d.ts" />
|
||||
|
||||
/// <reference path="PKey.d.ts" />
|
||||
|
||||
/// <reference path="Redis.d.ts" />
|
||||
|
||||
/// <reference path="RedisHash.d.ts" />
|
||||
|
||||
/// <reference path="RedisList.d.ts" />
|
||||
|
||||
/// <reference path="RedisSet.d.ts" />
|
||||
|
||||
/// <reference path="RedisSortedSet.d.ts" />
|
||||
|
||||
/// <reference path="Routing.d.ts" />
|
||||
|
||||
/// <reference path="SQLite.d.ts" />
|
||||
|
||||
/// <reference path="SandBox.d.ts" />
|
||||
|
||||
/// <reference path="SeekableStream.d.ts" />
|
||||
|
||||
/// <reference path="Semaphore.d.ts" />
|
||||
|
||||
/// <reference path="Service.d.ts" />
|
||||
|
||||
/// <reference path="Smtp.d.ts" />
|
||||
|
||||
/// <reference path="Socket.d.ts" />
|
||||
|
||||
/// <reference path="SslHandler.d.ts" />
|
||||
|
||||
/// <reference path="SslServer.d.ts" />
|
||||
|
||||
/// <reference path="SslSocket.d.ts" />
|
||||
|
||||
/// <reference path="Stat.d.ts" />
|
||||
|
||||
/// <reference path="Stats.d.ts" />
|
||||
|
||||
/// <reference path="Stream.d.ts" />
|
||||
|
||||
/// <reference path="StringDecoder.d.ts" />
|
||||
|
||||
/// <reference path="SubProcess.d.ts" />
|
||||
|
||||
/// <reference path="TcpServer.d.ts" />
|
||||
|
||||
/// <reference path="Timer.d.ts" />
|
||||
|
||||
/// <reference path="UrlObject.d.ts" />
|
||||
|
||||
/// <reference path="WebSocket.d.ts" />
|
||||
|
||||
/// <reference path="WebSocketMessage.d.ts" />
|
||||
|
||||
/// <reference path="WebView.d.ts" />
|
||||
|
||||
/// <reference path="Worker.d.ts" />
|
||||
|
||||
/// <reference path="X509Cert.d.ts" />
|
||||
|
||||
/// <reference path="X509Crl.d.ts" />
|
||||
|
||||
/// <reference path="X509Req.d.ts" />
|
||||
|
||||
/// <reference path="XmlAttr.d.ts" />
|
||||
|
||||
/// <reference path="XmlCDATASection.d.ts" />
|
||||
|
||||
/// <reference path="XmlCharacterData.d.ts" />
|
||||
|
||||
/// <reference path="XmlComment.d.ts" />
|
||||
|
||||
/// <reference path="XmlDocument.d.ts" />
|
||||
|
||||
/// <reference path="XmlDocumentType.d.ts" />
|
||||
|
||||
/// <reference path="XmlElement.d.ts" />
|
||||
|
||||
/// <reference path="XmlNamedNodeMap.d.ts" />
|
||||
|
||||
/// <reference path="XmlNode.d.ts" />
|
||||
|
||||
/// <reference path="XmlNodeList.d.ts" />
|
||||
|
||||
/// <reference path="XmlProcessingInstruction.d.ts" />
|
||||
|
||||
/// <reference path="XmlText.d.ts" />
|
||||
|
||||
/// <reference path="ZipFile.d.ts" />
|
||||
|
||||
/// <reference path="ZmqSocket.d.ts" />
|
||||
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 并发控制模块
|
||||
* @detail 引用方法:,```JavaScript,var coroutine = require('coroutine');,```
|
||||
*/
|
||||
declare module "coroutine" {
|
||||
|
||||
|
||||
module coroutine {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 锁对象,参见 Lock
|
||||
*
|
||||
*
|
||||
*/
|
||||
export class Lock extends Class_Lock {}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 信号量对象,参见 Semaphore
|
||||
*
|
||||
*
|
||||
*/
|
||||
export class Semaphore extends Class_Semaphore {}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 条件变量对象,参见 Condition
|
||||
*
|
||||
*
|
||||
*/
|
||||
export class Condition extends Class_Condition {}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 事件对象,参见 Event
|
||||
*
|
||||
*
|
||||
*/
|
||||
export class Event extends Class_Event {}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 独立线程工作对象,参见 Worker
|
||||
*
|
||||
*
|
||||
*/
|
||||
export class Worker extends Class_Worker {}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 启动一个纤程并返回纤程对象
|
||||
* @param func 制定纤程执行的函数
|
||||
* @param args 可变参数序列,此序列会在纤程内传递给函数
|
||||
* @return 返回纤程对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function start(func: Function, ...args: any[]): Class_Fiber;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 并行执行一组函数,并等待返回
|
||||
* @param funcs 并行执行的函数数组
|
||||
* @param fibers 限制并发 fiber 数量,缺省为 -1,启用与 funcs 数量相同 fiber
|
||||
* @return 返回函数执行结果的数组
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function parallel(funcs: any[], fibers?: number/** = -1*/): any[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 并行执行一个函数处理一组数据,并等待返回
|
||||
* @param datas 并行执行的数据数组
|
||||
* @param func 并行执行的函数
|
||||
* @param fibers 限制并发 fiber 数量,缺省为 -1,启用与 datas 数量相同 fiber
|
||||
* @return 返回函数执行结果的数组
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function parallel(datas: any[], func: Function, fibers?: number/** = -1*/): any[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 并行执行一个函数多次,并等待返回
|
||||
* @param func 并行执行的函数数
|
||||
* @param num 重复任务数量
|
||||
* @param fibers 限制并发 fiber 数量,缺省为 -1,启用与 funcs 数量相同 fiber
|
||||
* @return 返回函数执行结果的数组
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function parallel(func: Function, num: number, fibers?: number/** = -1*/): any[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 并行执行一组函数,并等待返回
|
||||
* @param funcs 一组并行执行的函数
|
||||
* @return 返回函数执行结果的数组
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function parallel(...funcs: any[]): any[];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 返回当前纤程
|
||||
* @return 当前纤程对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function current(): Class_Fiber;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 暂停当前纤程指定的时间
|
||||
* @param ms 指定要暂停的时间,以毫秒为单位,缺省为 0,即有空闲立即回恢复运行
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
export function sleep(ms?: number/** = 0*/): void;
|
||||
|
||||
} /** end of `module coroutine` */
|
||||
export = coroutine
|
||||
}
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+606
@@ -0,0 +1,606 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <reference path="Buffer.d.ts" />
|
||||
|
||||
/// <reference path="BufferedStream.d.ts" />
|
||||
|
||||
/// <reference path="Chain.d.ts" />
|
||||
|
||||
/// <reference path="Cipher.d.ts" />
|
||||
|
||||
/// <reference path="Condition.d.ts" />
|
||||
|
||||
/// <reference path="DbConnection.d.ts" />
|
||||
|
||||
/// <reference path="DgramSocket.d.ts" />
|
||||
|
||||
/// <reference path="Digest.d.ts" />
|
||||
|
||||
/// <reference path="Event.d.ts" />
|
||||
|
||||
/// <reference path="EventEmitter.d.ts" />
|
||||
|
||||
/// <reference path="EventInfo.d.ts" />
|
||||
|
||||
/// <reference path="Fiber.d.ts" />
|
||||
|
||||
/// <reference path="File.d.ts" />
|
||||
|
||||
/// <reference path="Handler.d.ts" />
|
||||
|
||||
/// <reference path="HandlerEx.d.ts" />
|
||||
|
||||
/// <reference path="HeapGraphEdge.d.ts" />
|
||||
|
||||
/// <reference path="HeapGraphNode.d.ts" />
|
||||
|
||||
/// <reference path="HeapSnapshot.d.ts" />
|
||||
|
||||
/// <reference path="HttpClient.d.ts" />
|
||||
|
||||
/// <reference path="HttpCollection.d.ts" />
|
||||
|
||||
/// <reference path="HttpCookie.d.ts" />
|
||||
|
||||
/// <reference path="HttpHandler.d.ts" />
|
||||
|
||||
/// <reference path="HttpMessage.d.ts" />
|
||||
|
||||
/// <reference path="HttpRequest.d.ts" />
|
||||
|
||||
/// <reference path="HttpResponse.d.ts" />
|
||||
|
||||
/// <reference path="HttpServer.d.ts" />
|
||||
|
||||
/// <reference path="HttpUploadData.d.ts" />
|
||||
|
||||
/// <reference path="HttpsServer.d.ts" />
|
||||
|
||||
/// <reference path="Image.d.ts" />
|
||||
|
||||
/// <reference path="Int64.d.ts" />
|
||||
|
||||
/// <reference path="LevelDB.d.ts" />
|
||||
|
||||
/// <reference path="Lock.d.ts" />
|
||||
|
||||
/// <reference path="LruCache.d.ts" />
|
||||
|
||||
/// <reference path="MSSQL.d.ts" />
|
||||
|
||||
/// <reference path="MemoryStream.d.ts" />
|
||||
|
||||
/// <reference path="Message.d.ts" />
|
||||
|
||||
/// <reference path="MongoCollection.d.ts" />
|
||||
|
||||
/// <reference path="MongoCursor.d.ts" />
|
||||
|
||||
/// <reference path="MongoDB.d.ts" />
|
||||
|
||||
/// <reference path="MongoID.d.ts" />
|
||||
|
||||
/// <reference path="MySQL.d.ts" />
|
||||
|
||||
/// <reference path="PKey.d.ts" />
|
||||
|
||||
/// <reference path="Redis.d.ts" />
|
||||
|
||||
/// <reference path="RedisHash.d.ts" />
|
||||
|
||||
/// <reference path="RedisList.d.ts" />
|
||||
|
||||
/// <reference path="RedisSet.d.ts" />
|
||||
|
||||
/// <reference path="RedisSortedSet.d.ts" />
|
||||
|
||||
/// <reference path="Routing.d.ts" />
|
||||
|
||||
/// <reference path="SQLite.d.ts" />
|
||||
|
||||
/// <reference path="SandBox.d.ts" />
|
||||
|
||||
/// <reference path="SeekableStream.d.ts" />
|
||||
|
||||
/// <reference path="Semaphore.d.ts" />
|
||||
|
||||
/// <reference path="Service.d.ts" />
|
||||
|
||||
/// <reference path="Smtp.d.ts" />
|
||||
|
||||
/// <reference path="Socket.d.ts" />
|
||||
|
||||
/// <reference path="SslHandler.d.ts" />
|
||||
|
||||
/// <reference path="SslServer.d.ts" />
|
||||
|
||||
/// <reference path="SslSocket.d.ts" />
|
||||
|
||||
/// <reference path="Stat.d.ts" />
|
||||
|
||||
/// <reference path="Stats.d.ts" />
|
||||
|
||||
/// <reference path="Stream.d.ts" />
|
||||
|
||||
/// <reference path="StringDecoder.d.ts" />
|
||||
|
||||
/// <reference path="SubProcess.d.ts" />
|
||||
|
||||
/// <reference path="TcpServer.d.ts" />
|
||||
|
||||
/// <reference path="Timer.d.ts" />
|
||||
|
||||
/// <reference path="UrlObject.d.ts" />
|
||||
|
||||
/// <reference path="WebSocket.d.ts" />
|
||||
|
||||
/// <reference path="WebSocketMessage.d.ts" />
|
||||
|
||||
/// <reference path="WebView.d.ts" />
|
||||
|
||||
/// <reference path="Worker.d.ts" />
|
||||
|
||||
/// <reference path="X509Cert.d.ts" />
|
||||
|
||||
/// <reference path="X509Crl.d.ts" />
|
||||
|
||||
/// <reference path="X509Req.d.ts" />
|
||||
|
||||
/// <reference path="XmlAttr.d.ts" />
|
||||
|
||||
/// <reference path="XmlCDATASection.d.ts" />
|
||||
|
||||
/// <reference path="XmlCharacterData.d.ts" />
|
||||
|
||||
/// <reference path="XmlComment.d.ts" />
|
||||
|
||||
/// <reference path="XmlDocument.d.ts" />
|
||||
|
||||
/// <reference path="XmlDocumentType.d.ts" />
|
||||
|
||||
/// <reference path="XmlElement.d.ts" />
|
||||
|
||||
/// <reference path="XmlNamedNodeMap.d.ts" />
|
||||
|
||||
/// <reference path="XmlNode.d.ts" />
|
||||
|
||||
/// <reference path="XmlNodeList.d.ts" />
|
||||
|
||||
/// <reference path="XmlProcessingInstruction.d.ts" />
|
||||
|
||||
/// <reference path="XmlText.d.ts" />
|
||||
|
||||
/// <reference path="ZipFile.d.ts" />
|
||||
|
||||
/// <reference path="ZmqSocket.d.ts" />
|
||||
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 加密算法模块
|
||||
* @detail 使用方法:,```JavaScript,var crypto = require('crypto');,```
|
||||
*/
|
||||
declare module "crypto" {
|
||||
|
||||
|
||||
module crypto {
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定对称加密算法 AES,支持 128, 192, 256 位 key,分组密码工作模式支持 ECB, CBC, CFB128, CTR, GCM
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const AES = 1;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定对称加密算法 CAMELLIA,支持 128, 192, 256 位 key,分组密码工作模式支持 ECB, CBC, CFB128, CTR, GCM
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const CAMELLIA = 2;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定对称加密算法 DES,支持 64 位 key,分组密码工作模式支持 ECB, CBC
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const DES = 3;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定对称加密算法 DES-EDE,支持 128 位 key,分组密码工作模式支持 ECB, CBC
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const DES_EDE = 4;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定对称加密算法 DES-EDE3,支持 192 位 key,分组密码工作模式支持 ECB, CBC
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const DES_EDE3 = 5;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定对称加密算法 BLOWFISH,支持 192 位 key,分组密码工作模式支持 ECB, CBC, CFB64, CTR
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const BLOWFISH = 6;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定对称加密算法 ARC4,支持 40, 56, 64, 128 位 key
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const ARC4 = 7;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定分组密码工作模式支持 ECB
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const ECB = 1;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定分组密码工作模式支持 CBC
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const CBC = 2;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定分组密码工作模式支持 CFB64
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const CFB64 = 3;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定分组密码工作模式支持 CFB128
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const CFB128 = 4;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定分组密码工作模式支持 OFB
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const OFB = 5;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定分组密码工作模式支持 CTR
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const CTR = 6;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定分组密码工作模式支持 GCM
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const GCM = 7;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定流密码模式
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const STREAM = 8;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定分组密码工作模式支持 CCM
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const CCM = 9;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定填充模式为 PKCS7
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const PKCS7 = 0;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定填充模式为 ONE_AND_ZEROS
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const ONE_AND_ZEROS = 1;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定填充模式为 ZEROS_AND_LEN
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const ZEROS_AND_LEN = 2;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定填充模式为 ZEROS
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const ZEROS = 3;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 指定填充模式为 NOPADDING
|
||||
*
|
||||
*
|
||||
*/
|
||||
export const NOPADDING = 4;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Cipher 构造函数,参见 Cipher
|
||||
*
|
||||
*
|
||||
*/
|
||||
export class Cipher extends Class_Cipher {}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief PKey 构造函数,参见 PKey
|
||||
*
|
||||
*
|
||||
*/
|
||||
export class PKey extends Class_PKey {}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief X509Cert 构造函数,参见 X509Cert
|
||||
*
|
||||
*
|
||||
*/
|
||||
export class X509Cert extends Class_X509Cert {}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief X509Crl 构造函数,参见 X509Crl
|
||||
*
|
||||
*
|
||||
*/
|
||||
export class X509Crl extends Class_X509Crl {}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief X509Req 构造函数,参见 X509Req
|
||||
*
|
||||
*
|
||||
*/
|
||||
export class X509Req extends Class_X509Req {}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 根据给定的算法名称创建一个信息摘要对象
|
||||
* @param algo 指定信息摘要对象的算法
|
||||
* @return 返回信息摘要对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function createHash(algo: string): Class_Digest;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 根据给定的算法名称创建一个 hmac 信息摘要对象
|
||||
* @param algo 指定信息摘要对象的算法
|
||||
* @param key 二进制签名密钥
|
||||
* @return 返回信息摘要对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function createHmac(algo: string, key: Class_Buffer): Class_Digest;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 加载一个 PEM/DER 格式的密钥文件
|
||||
* @param filename 密钥文件名
|
||||
* @param password 解密密码
|
||||
* @return 返回包含密钥的对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function loadPKey(filename: string, password?: string/** = ""*/): Class_PKey;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 加载一个 CRT/PEM/DER/TXT 格式的证书,可多次调用
|
||||
*
|
||||
* loadFile 加载 mozilla 的 certdata,txt, 可于 http://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt 下载使用
|
||||
* @param filename 证书文件名
|
||||
* @return 返回包含证书的对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function loadCert(filename: string): Class_X509Cert;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 加载一个 PEM/DER 格式的撤销证书,可多次调用
|
||||
* @param filename 撤销证书文件名
|
||||
* @return 返回包含撤销证书的对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function loadCrl(filename: string): Class_X509Crl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 加载一个 PEM/DER 格式的证书请求,可多次调用
|
||||
* @param filename 证书请求文件名
|
||||
* @return 返回包含请求证书的对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function loadReq(filename: string): Class_X509Req;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 生成指定尺寸的随机数,使用 havege 生成器
|
||||
* @param size 指定生成的随机数尺寸
|
||||
* @return 返回生成的随机数
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
export function randomBytes(size: number): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 生成指定尺寸的低强度随机数,使用快速的算法
|
||||
* @param size 指定生成的随机数尺寸
|
||||
* @return 返回生成的随机数
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
export function simpleRandomBytes(size: number): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 生成指定尺寸的伪随机数,使用 entropy 生成器
|
||||
* @param size 指定生成的随机数尺寸
|
||||
* @return 返回生成的随机数
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
export function pseudoRandomBytes(size: number): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 生成给定数据的可视化字符图像
|
||||
* @param data 指定要展示的数据
|
||||
* @param title 指定字符图像的标题,多字节字符会导致宽度错误
|
||||
* @param size 字符图像尺寸
|
||||
* @return 返回生成的可视化字符串图像
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function randomArt(data: Class_Buffer, title: string, size?: number/** = 8*/): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 依据 pbkdf1 根据明文 password 生成要求的二进制钥匙
|
||||
* @param password 指定使用的密码
|
||||
* @param salt 指定 hmac 使用的 salt
|
||||
* @param iterations 指定迭代次数
|
||||
* @param size 指定钥匙尺寸
|
||||
* @param algo 指定要使用的 hash 算法,详见 hash 模块
|
||||
* @return 返回生成的二进制钥匙
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
export function pbkdf1(password: Class_Buffer, salt: Class_Buffer, iterations: number, size: number, algo: number): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 依据 pbkdf1 根据明文 password 生成要求的二进制钥匙
|
||||
* @param password 指定使用的密码
|
||||
* @param salt 指定 hmac 使用的 salt
|
||||
* @param iterations 指定迭代次数
|
||||
* @param size 指定钥匙尺寸
|
||||
* @param algoName 指定要使用的 hash 算法,详见 hash 模块
|
||||
* @return 返回生成的二进制钥匙
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
export function pbkdf1(password: Class_Buffer, salt: Class_Buffer, iterations: number, size: number, algoName: string): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 依据 rfc2898 根据明文 password 生成要求的二进制钥匙
|
||||
* @param password 指定使用的密码
|
||||
* @param salt 指定 hmac 使用的 salt
|
||||
* @param iterations 指定迭代次数
|
||||
* @param size 指定钥匙尺寸
|
||||
* @param algo 指定要使用的 hash 算法,详见 hash 模块
|
||||
* @return 返回生成的二进制钥匙
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
export function pbkdf2(password: Class_Buffer, salt: Class_Buffer, iterations: number, size: number, algo: number): Class_Buffer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 依据 rfc2898 根据明文 password 生成要求的二进制钥匙
|
||||
* @param password 指定使用的密码
|
||||
* @param salt 指定 hmac 使用的 salt
|
||||
* @param iterations 指定迭代次数
|
||||
* @param size 指定钥匙尺寸
|
||||
* @param algoName 指定要使用的 hash 算法,详见 hash 模块
|
||||
* @return 返回生成的二进制钥匙
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
export function pbkdf2(password: Class_Buffer, salt: Class_Buffer, iterations: number, size: number, algoName: string): Class_Buffer;
|
||||
|
||||
} /** end of `module crypto` */
|
||||
export = crypto
|
||||
}
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+345
@@ -0,0 +1,345 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <reference path="Buffer.d.ts" />
|
||||
|
||||
/// <reference path="BufferedStream.d.ts" />
|
||||
|
||||
/// <reference path="Chain.d.ts" />
|
||||
|
||||
/// <reference path="Cipher.d.ts" />
|
||||
|
||||
/// <reference path="Condition.d.ts" />
|
||||
|
||||
/// <reference path="DbConnection.d.ts" />
|
||||
|
||||
/// <reference path="DgramSocket.d.ts" />
|
||||
|
||||
/// <reference path="Digest.d.ts" />
|
||||
|
||||
/// <reference path="Event.d.ts" />
|
||||
|
||||
/// <reference path="EventEmitter.d.ts" />
|
||||
|
||||
/// <reference path="EventInfo.d.ts" />
|
||||
|
||||
/// <reference path="Fiber.d.ts" />
|
||||
|
||||
/// <reference path="File.d.ts" />
|
||||
|
||||
/// <reference path="Handler.d.ts" />
|
||||
|
||||
/// <reference path="HandlerEx.d.ts" />
|
||||
|
||||
/// <reference path="HeapGraphEdge.d.ts" />
|
||||
|
||||
/// <reference path="HeapGraphNode.d.ts" />
|
||||
|
||||
/// <reference path="HeapSnapshot.d.ts" />
|
||||
|
||||
/// <reference path="HttpClient.d.ts" />
|
||||
|
||||
/// <reference path="HttpCollection.d.ts" />
|
||||
|
||||
/// <reference path="HttpCookie.d.ts" />
|
||||
|
||||
/// <reference path="HttpHandler.d.ts" />
|
||||
|
||||
/// <reference path="HttpMessage.d.ts" />
|
||||
|
||||
/// <reference path="HttpRequest.d.ts" />
|
||||
|
||||
/// <reference path="HttpResponse.d.ts" />
|
||||
|
||||
/// <reference path="HttpServer.d.ts" />
|
||||
|
||||
/// <reference path="HttpUploadData.d.ts" />
|
||||
|
||||
/// <reference path="HttpsServer.d.ts" />
|
||||
|
||||
/// <reference path="Image.d.ts" />
|
||||
|
||||
/// <reference path="Int64.d.ts" />
|
||||
|
||||
/// <reference path="LevelDB.d.ts" />
|
||||
|
||||
/// <reference path="Lock.d.ts" />
|
||||
|
||||
/// <reference path="LruCache.d.ts" />
|
||||
|
||||
/// <reference path="MSSQL.d.ts" />
|
||||
|
||||
/// <reference path="MemoryStream.d.ts" />
|
||||
|
||||
/// <reference path="Message.d.ts" />
|
||||
|
||||
/// <reference path="MongoCollection.d.ts" />
|
||||
|
||||
/// <reference path="MongoCursor.d.ts" />
|
||||
|
||||
/// <reference path="MongoDB.d.ts" />
|
||||
|
||||
/// <reference path="MongoID.d.ts" />
|
||||
|
||||
/// <reference path="MySQL.d.ts" />
|
||||
|
||||
/// <reference path="PKey.d.ts" />
|
||||
|
||||
/// <reference path="Redis.d.ts" />
|
||||
|
||||
/// <reference path="RedisHash.d.ts" />
|
||||
|
||||
/// <reference path="RedisList.d.ts" />
|
||||
|
||||
/// <reference path="RedisSet.d.ts" />
|
||||
|
||||
/// <reference path="RedisSortedSet.d.ts" />
|
||||
|
||||
/// <reference path="Routing.d.ts" />
|
||||
|
||||
/// <reference path="SQLite.d.ts" />
|
||||
|
||||
/// <reference path="SandBox.d.ts" />
|
||||
|
||||
/// <reference path="SeekableStream.d.ts" />
|
||||
|
||||
/// <reference path="Semaphore.d.ts" />
|
||||
|
||||
/// <reference path="Service.d.ts" />
|
||||
|
||||
/// <reference path="Smtp.d.ts" />
|
||||
|
||||
/// <reference path="Socket.d.ts" />
|
||||
|
||||
/// <reference path="SslHandler.d.ts" />
|
||||
|
||||
/// <reference path="SslServer.d.ts" />
|
||||
|
||||
/// <reference path="SslSocket.d.ts" />
|
||||
|
||||
/// <reference path="Stat.d.ts" />
|
||||
|
||||
/// <reference path="Stats.d.ts" />
|
||||
|
||||
/// <reference path="Stream.d.ts" />
|
||||
|
||||
/// <reference path="StringDecoder.d.ts" />
|
||||
|
||||
/// <reference path="SubProcess.d.ts" />
|
||||
|
||||
/// <reference path="TcpServer.d.ts" />
|
||||
|
||||
/// <reference path="Timer.d.ts" />
|
||||
|
||||
/// <reference path="UrlObject.d.ts" />
|
||||
|
||||
/// <reference path="WebSocket.d.ts" />
|
||||
|
||||
/// <reference path="WebSocketMessage.d.ts" />
|
||||
|
||||
/// <reference path="WebView.d.ts" />
|
||||
|
||||
/// <reference path="Worker.d.ts" />
|
||||
|
||||
/// <reference path="X509Cert.d.ts" />
|
||||
|
||||
/// <reference path="X509Crl.d.ts" />
|
||||
|
||||
/// <reference path="X509Req.d.ts" />
|
||||
|
||||
/// <reference path="XmlAttr.d.ts" />
|
||||
|
||||
/// <reference path="XmlCDATASection.d.ts" />
|
||||
|
||||
/// <reference path="XmlCharacterData.d.ts" />
|
||||
|
||||
/// <reference path="XmlComment.d.ts" />
|
||||
|
||||
/// <reference path="XmlDocument.d.ts" />
|
||||
|
||||
/// <reference path="XmlDocumentType.d.ts" />
|
||||
|
||||
/// <reference path="XmlElement.d.ts" />
|
||||
|
||||
/// <reference path="XmlNamedNodeMap.d.ts" />
|
||||
|
||||
/// <reference path="XmlNode.d.ts" />
|
||||
|
||||
/// <reference path="XmlNodeList.d.ts" />
|
||||
|
||||
/// <reference path="XmlProcessingInstruction.d.ts" />
|
||||
|
||||
/// <reference path="XmlText.d.ts" />
|
||||
|
||||
/// <reference path="ZipFile.d.ts" />
|
||||
|
||||
/// <reference path="ZmqSocket.d.ts" />
|
||||
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 数据库访问模块
|
||||
* @detail 基础模块。可用于创建和操作数据库资源,引用方式:,```JavaScript,var db = require('db');,```
|
||||
*/
|
||||
declare module "db" {
|
||||
|
||||
|
||||
module db {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 打开一个数据库,此方法为通用入口,根据提供的 connString 不同调用不同的引擎
|
||||
* @param connString 数据库描述,如:mysql://user:pass\@host/db
|
||||
* @return 返回数据库连接对象
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
export function open(connString: string): Class__object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 打开一个 mysql 数据库
|
||||
* @param connString 数据库描述,如:mysql://user:pass\@host/db
|
||||
* @return 返回数据库连接对象
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
export function openMySQL(connString: string): Class_MySQL;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 打开一个 mysql 数据库
|
||||
* @param connString 数据库描述,如:mssql://user:pass\@host/db
|
||||
* @return 返回数据库连接对象
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
export function openMSSQL(connString: string): Class_MSSQL;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 打开一个 sqlite 数据库
|
||||
* @param connString 数据库描述,如:sqlite:test.db 或者 test.db
|
||||
* @return 返回数据库连接对象
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
export function openSQLite(connString: string): Class_SQLite;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 打开一个 mongodb 数据库
|
||||
* @param connString 数据库描述
|
||||
* @return 返回数据库连接对象
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
export function openMongoDB(connString: string): Class_MongoDB;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 打开一个 leveldb 数据库
|
||||
* @param connString 数据库描述,如:level:test.db 或者 test.db
|
||||
* @return 返回数据库对象
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
export function openLevelDB(connString: string): Class_LevelDB;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 打开一个 Redis 数据库
|
||||
* @param connString 数据库描述,如:redis://server:port 或者 "server"
|
||||
* @return 返回数据库连接对象
|
||||
*
|
||||
*
|
||||
* @async
|
||||
*/
|
||||
export function openRedis(connString: string): Class_Redis;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 格式化一个 sql 命令,并返回格式化结果
|
||||
*
|
||||
* @param sql 格式化字符串,可选参数用 ? 指定。例如:'SELECT FROM TEST WHERE [id]=?'
|
||||
* @param args 可选参数列表
|
||||
* @return 返回格式化之后的 sql 命令
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function format(sql: string, ...args: any[]): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 格式化一个 mysql 命令,并返回格式化结果
|
||||
*
|
||||
* @param sql 格式化字符串,可选参数用 ? 指定。例如:'SELECT FROM TEST WHERE [id]=?'
|
||||
* @param args 可选参数列表
|
||||
* @return 返回格式化之后的 sql 命令
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function formatMySQL(sql: string, ...args: any[]): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 格式化一个 mssql 命令,并返回格式化结果
|
||||
*
|
||||
* @param sql 格式化字符串,可选参数用 ? 指定。例如:'SELECT FROM TEST WHERE [id]=?'
|
||||
* @param args 可选参数列表
|
||||
* @return 返回格式化之后的 sql 命令
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function formatMSSQL(sql: string, ...args: any[]): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 将字符串编码为 SQL 安全编码字符串
|
||||
* @param str 要编码的字符串
|
||||
* @param mysql 指定 mysql 编码,缺省为 false
|
||||
* @return 返回编码后的字符串
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function escape(str: string, mysql?: boolean/** = false*/): string;
|
||||
|
||||
} /** end of `module db` */
|
||||
export = db
|
||||
}
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Vendored
+294
@@ -0,0 +1,294 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This file was automatically generated with idlc.js *
|
||||
* build info: *
|
||||
* - fibjs : 0.25.0 *
|
||||
* - date : Jun 11 2018 14:17:22 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Richard <richardo2016@gmail.com>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <reference path="Buffer.d.ts" />
|
||||
|
||||
/// <reference path="BufferedStream.d.ts" />
|
||||
|
||||
/// <reference path="Chain.d.ts" />
|
||||
|
||||
/// <reference path="Cipher.d.ts" />
|
||||
|
||||
/// <reference path="Condition.d.ts" />
|
||||
|
||||
/// <reference path="DbConnection.d.ts" />
|
||||
|
||||
/// <reference path="DgramSocket.d.ts" />
|
||||
|
||||
/// <reference path="Digest.d.ts" />
|
||||
|
||||
/// <reference path="Event.d.ts" />
|
||||
|
||||
/// <reference path="EventEmitter.d.ts" />
|
||||
|
||||
/// <reference path="EventInfo.d.ts" />
|
||||
|
||||
/// <reference path="Fiber.d.ts" />
|
||||
|
||||
/// <reference path="File.d.ts" />
|
||||
|
||||
/// <reference path="Handler.d.ts" />
|
||||
|
||||
/// <reference path="HandlerEx.d.ts" />
|
||||
|
||||
/// <reference path="HeapGraphEdge.d.ts" />
|
||||
|
||||
/// <reference path="HeapGraphNode.d.ts" />
|
||||
|
||||
/// <reference path="HeapSnapshot.d.ts" />
|
||||
|
||||
/// <reference path="HttpClient.d.ts" />
|
||||
|
||||
/// <reference path="HttpCollection.d.ts" />
|
||||
|
||||
/// <reference path="HttpCookie.d.ts" />
|
||||
|
||||
/// <reference path="HttpHandler.d.ts" />
|
||||
|
||||
/// <reference path="HttpMessage.d.ts" />
|
||||
|
||||
/// <reference path="HttpRequest.d.ts" />
|
||||
|
||||
/// <reference path="HttpResponse.d.ts" />
|
||||
|
||||
/// <reference path="HttpServer.d.ts" />
|
||||
|
||||
/// <reference path="HttpUploadData.d.ts" />
|
||||
|
||||
/// <reference path="HttpsServer.d.ts" />
|
||||
|
||||
/// <reference path="Image.d.ts" />
|
||||
|
||||
/// <reference path="Int64.d.ts" />
|
||||
|
||||
/// <reference path="LevelDB.d.ts" />
|
||||
|
||||
/// <reference path="Lock.d.ts" />
|
||||
|
||||
/// <reference path="LruCache.d.ts" />
|
||||
|
||||
/// <reference path="MSSQL.d.ts" />
|
||||
|
||||
/// <reference path="MemoryStream.d.ts" />
|
||||
|
||||
/// <reference path="Message.d.ts" />
|
||||
|
||||
/// <reference path="MongoCollection.d.ts" />
|
||||
|
||||
/// <reference path="MongoCursor.d.ts" />
|
||||
|
||||
/// <reference path="MongoDB.d.ts" />
|
||||
|
||||
/// <reference path="MongoID.d.ts" />
|
||||
|
||||
/// <reference path="MySQL.d.ts" />
|
||||
|
||||
/// <reference path="PKey.d.ts" />
|
||||
|
||||
/// <reference path="Redis.d.ts" />
|
||||
|
||||
/// <reference path="RedisHash.d.ts" />
|
||||
|
||||
/// <reference path="RedisList.d.ts" />
|
||||
|
||||
/// <reference path="RedisSet.d.ts" />
|
||||
|
||||
/// <reference path="RedisSortedSet.d.ts" />
|
||||
|
||||
/// <reference path="Routing.d.ts" />
|
||||
|
||||
/// <reference path="SQLite.d.ts" />
|
||||
|
||||
/// <reference path="SandBox.d.ts" />
|
||||
|
||||
/// <reference path="SeekableStream.d.ts" />
|
||||
|
||||
/// <reference path="Semaphore.d.ts" />
|
||||
|
||||
/// <reference path="Service.d.ts" />
|
||||
|
||||
/// <reference path="Smtp.d.ts" />
|
||||
|
||||
/// <reference path="Socket.d.ts" />
|
||||
|
||||
/// <reference path="SslHandler.d.ts" />
|
||||
|
||||
/// <reference path="SslServer.d.ts" />
|
||||
|
||||
/// <reference path="SslSocket.d.ts" />
|
||||
|
||||
/// <reference path="Stat.d.ts" />
|
||||
|
||||
/// <reference path="Stats.d.ts" />
|
||||
|
||||
/// <reference path="Stream.d.ts" />
|
||||
|
||||
/// <reference path="StringDecoder.d.ts" />
|
||||
|
||||
/// <reference path="SubProcess.d.ts" />
|
||||
|
||||
/// <reference path="TcpServer.d.ts" />
|
||||
|
||||
/// <reference path="Timer.d.ts" />
|
||||
|
||||
/// <reference path="UrlObject.d.ts" />
|
||||
|
||||
/// <reference path="WebSocket.d.ts" />
|
||||
|
||||
/// <reference path="WebSocketMessage.d.ts" />
|
||||
|
||||
/// <reference path="WebView.d.ts" />
|
||||
|
||||
/// <reference path="Worker.d.ts" />
|
||||
|
||||
/// <reference path="X509Cert.d.ts" />
|
||||
|
||||
/// <reference path="X509Crl.d.ts" />
|
||||
|
||||
/// <reference path="X509Req.d.ts" />
|
||||
|
||||
/// <reference path="XmlAttr.d.ts" />
|
||||
|
||||
/// <reference path="XmlCDATASection.d.ts" />
|
||||
|
||||
/// <reference path="XmlCharacterData.d.ts" />
|
||||
|
||||
/// <reference path="XmlComment.d.ts" />
|
||||
|
||||
/// <reference path="XmlDocument.d.ts" />
|
||||
|
||||
/// <reference path="XmlDocumentType.d.ts" />
|
||||
|
||||
/// <reference path="XmlElement.d.ts" />
|
||||
|
||||
/// <reference path="XmlNamedNodeMap.d.ts" />
|
||||
|
||||
/// <reference path="XmlNode.d.ts" />
|
||||
|
||||
/// <reference path="XmlNodeList.d.ts" />
|
||||
|
||||
/// <reference path="XmlProcessingInstruction.d.ts" />
|
||||
|
||||
/// <reference path="XmlText.d.ts" />
|
||||
|
||||
/// <reference path="ZipFile.d.ts" />
|
||||
|
||||
/// <reference path="ZmqSocket.d.ts" />
|
||||
|
||||
/// <reference path="object.d.ts" />
|
||||
|
||||
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief dgram 模块提供了 UDP 数据包 socket 的实现
|
||||
* @detail 基础模块,引用方式:,```JavaScript,var dgram = require('dgram');,```
|
||||
*/
|
||||
declare module "dgram" {
|
||||
|
||||
|
||||
module dgram {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief dgram.Socket 对象是一个封装了数据包函数功能的 EventEmitter。参见 DgramSocket
|
||||
* dgram.Socket 实例是由 dgram.createSocket() 创建的。创建 dgram.Socket 实例不需要使用 new 关键字。
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export class DgramSocket extends Class_DgramSocket {}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 创建一个 dgram.Socket 对象
|
||||
*
|
||||
* opts 允许的选项是:
|
||||
* ```JavaScript
|
||||
* {
|
||||
* "type": "udp4" | "udp6", // 必填
|
||||
* "reuseAddr": true | false, //若设置为 true,socket.bind() 则会重用地址,即时另一个进程已经在其上面绑定了一个套接字。 默认是 false
|
||||
* "recvBufferSize": ###, // 设置 SO_RCVBUF 套接字值
|
||||
* "sendBufferSize": ### //设置 SO_RCVBUF 套接字值
|
||||
* }
|
||||
* ```
|
||||
* @param opts
|
||||
* @return 返回创建的 Socket 对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function createSocket(opts: Object): Class_DgramSocket;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 创建一个 dgram.Socket 对象
|
||||
*
|
||||
* opts 允许的选项是:
|
||||
* ```JavaScript
|
||||
* {
|
||||
* "type": "udp4" | "udp6", // 必填
|
||||
* "reuseAddr": true | false, //若设置为 true,socket.bind() 则会重用地址,即时另一个进程已经在其上面绑定了一个套接字。 默认是 false
|
||||
* "recvBufferSize": ###, // 设置 SO_RCVBUF 套接字值
|
||||
* "sendBufferSize": ### //设置 SO_RCVBUF 套接字值
|
||||
* }
|
||||
* ```
|
||||
* @param opts
|
||||
* @param callback 为 'message' 事件添加一个监听器。
|
||||
* @return 返回创建的 Socket 对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function createSocket(opts: Object, callback: Function): Class_DgramSocket;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 创建一个 dgram.Socket 对象
|
||||
* @param type 套接字族,'udp4' 或 'udp6'。
|
||||
* @return 返回创建的 Socket 对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function createSocket(type: string): Class_DgramSocket;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief 创建一个 dgram.Socket 对象
|
||||
* @param type 套接字族,'udp4' 或 'udp6'。
|
||||
* @param callback 为 'message' 事件添加一个监听器。
|
||||
* @return 返回创建的 Socket 对象
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
export function createSocket(type: string, callback: Function): Class_DgramSocket;
|
||||
|
||||
} /** end of `module dgram` */
|
||||
export = dgram
|
||||
}
|
||||
|
||||
/** } /** endof `module Or Internal Object` */
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user