修改声明文件

This commit is contained in:
fofolee 2022-04-07 16:08:49 +08:00
parent 9ea88e9286
commit 827e19b559
2 changed files with 142 additions and 138 deletions

View File

@ -3,7 +3,9 @@ const os = require('os');
const child_process = require("child_process") const child_process = require("child_process")
const iconv = require('iconv-lite') const iconv = require('iconv-lite')
const electron = require('electron') const electron = require('electron')
const { NodeVM } = require('./lib/vm2') const {
NodeVM
} = require('./lib/vm2')
const path = require("path") const path = require("path")
const util = require("util") const util = require("util")
const PinyinMatch = require('pinyin-match'); const PinyinMatch = require('pinyin-match');
@ -495,6 +497,8 @@ getuToolsLite = () => {
delete utoolsLite.dbStorage delete utoolsLite.dbStorage
delete utoolsLite.removeFeature delete utoolsLite.removeFeature
delete utoolsLite.setFeature delete utoolsLite.setFeature
delete utoolsLite.onDbPull
delete utoolsLite.getFeatures
// 支付相关接口 // 支付相关接口
delete utoolsLite.fetchUserServerTemporaryToken delete utoolsLite.fetchUserServerTemporaryToken
delete utoolsLite.getUserServerTemporaryToken delete utoolsLite.getUserServerTemporaryToken
@ -502,7 +506,7 @@ getuToolsLite = () => {
delete utoolsLite.fetchUserPayments delete utoolsLite.fetchUserPayments
return utoolsLite return utoolsLite
} }
console.error
let getSandboxFuns = () => { let getSandboxFuns = () => {
var sandbox = { var sandbox = {
utools: getuToolsLite(), utools: getuToolsLite(),
@ -591,7 +595,7 @@ runCodeInVm = (cmd, cb, enterData = {}) => {
}); });
let liteErr = e => { let liteErr = e => {
return e.stack.replace(/([ ] +at.+)|(.+\.js:\d+)/g, '').trim() return e?.stack.replace(/([ ] +at.+)|(.+\.js:\d+)/g, '').trim()
} }
// 错误处理 // 错误处理

View File

@ -239,7 +239,7 @@ interface UToolsApi {
/** /**
* *
*/ */
onDbPull(callback: (docs: { _id: string, _rev: string }[]) => void): void; // onDbPull(callback: (docs: { _id: string, _rev: string }[]) => void): void;
/** /**
* *
* @param isRestorePreWindow true * @param isRestorePreWindow true
@ -302,59 +302,59 @@ interface UToolsApi {
/** /**
* *
*/ */
fetchUserServerTemporaryToken(): Promise<{ token: string, expiredAt: number }>; // fetchUserServerTemporaryToken(): Promise<{ token: string, expiredAt: number }>;
/** /**
* *
* @param callback * @param callback
*/ */
openPayment(options: { // openPayment(options: {
/** // /**
* ID uTools // * 商品ID在 “uTools 开发者工具” 插件中创建
*/ // */
goodsId: string, // goodsId: string,
/** // /**
* () // * 第三方服务生成的订单号(可选)
*/ // */
outOrderId?: string, // outOrderId?: string,
/** // /**
* API和支付通知中原样返回使() // * 第三方服务附加数据在查询API和支付通知中原样返回可作为自定义参数使用(可选)
*/ // */
attach?: string // attach?: string
}, callback?: () => void): void; // }, callback?: () => void): void;
/** /**
* *
*/ */
fetchUserPayments(): Promise<{ order_id: string, total_fee: number, body: string, attach: string, goods_id: string, out_order_id: string, paid_at: string }[]>; // fetchUserPayments(): Promise<{ order_id: string, total_fee: number, body: string, attach: string, goods_id: string, out_order_id: string, paid_at: string }[]>;
/** /**
* *
*/ */
setFeature(feature: { // setFeature(feature: {
code: string, // code: string,
explain: string, // explain: string,
platform: ('darwin' | 'win32' | 'linux') | (Array<'darwin' | 'win32' | 'linux'>), // platform: ('darwin' | 'win32' | 'linux') | (Array<'darwin' | 'win32' | 'linux'>),
icon?: string, // icon?: string,
cmds: string | { // cmds: string | {
type: 'img' | 'files' | 'regex' | 'over' | 'window', // type: 'img' | 'files' | 'regex' | 'over' | 'window',
label: string // label: string
}[] // }[]
}): boolean; // }): boolean;
/** /**
* *
*/ */
removeFeature(code: string): boolean; // removeFeature(code: string): boolean;
/** /**
* *
*/ */
getFeatures(): { // getFeatures(): {
code: string, // code: string,
explain: string, // explain: string,
platform: ('darwin' | 'win32' | 'linux') | (Array<'darwin' | 'win32' | 'linux'>), // platform: ('darwin' | 'win32' | 'linux') | (Array<'darwin' | 'win32' | 'linux'>),
icon?: string, // icon?: string,
cmds: string | { // cmds: string | {
type: 'img' | 'files' | 'regex' | 'over' | 'window', // type: 'img' | 'files' | 'regex' | 'over' | 'window',
label: string // label: string
}[] // }[]
}[]; // }[];
/** /**
* *
*/ */
@ -544,104 +544,104 @@ interface UToolsApi {
*/ */
isLinux(): boolean; isLinux(): boolean;
db: { // db: {
/** // /**
* / // * 创建/更新文档
*/ // */
put(doc: DbDoc): DbReturn; // put(doc: DbDoc): DbReturn;
/** // /**
* // * 获取文档
*/ // */
get(id: string): DbDoc | null; // get(id: string): DbDoc | null;
/** // /**
* // * 删除文档
*/ // */
remove(doc: string | DbDoc): DbReturn; // remove(doc: string | DbDoc): DbReturn;
/** // /**
* () // * 批量操作文档(新增、修改、删除)
*/ // */
bulkDocs(docs: DbDoc[]): DbReturn[]; // bulkDocs(docs: DbDoc[]): DbReturn[];
/** // /**
* id前缀查找 // * 获取所有文档 可根据文档id前缀查找
*/ // */
allDocs(key?: string): DbDoc[]; // allDocs(key?: string): DbDoc[];
/** // /**
* // * 存储附件到新文档
* @param docId ID // * @param docId 文档ID
* @param attachment buffer // * @param attachment 附件 buffer
* @param type image/png, text/plain // * @param type 附件类型示例image/png, text/plain
*/ // */
postAttachment(docId: string, attachment: Uint8Array, type: string): DbReturn; // postAttachment(docId: string, attachment: Uint8Array, type: string): DbReturn;
/** // /**
* // * 获取附件
* @param docId ID // * @param docId 文档ID
*/ // */
getAttachment(docId: string): Uint8Array | null; // getAttachment(docId: string): Uint8Array | null;
/** // /**
* // * 获取附件类型
* @param docId ID // * @param docId 文档ID
*/ // */
getAttachmentType(docId: string): string | null; // getAttachmentType(docId: string): string | null;
/** // /**
* // * 异步
*/ // */
promises: { // promises: {
/** // /**
* / // * 创建/更新文档
*/ // */
put(doc: DbDoc): Promise<DbReturn>; // put(doc: DbDoc): Promise<DbReturn>;
/** // /**
* // * 获取文档
*/ // */
get(id: string): Promise<DbDoc | null>; // get(id: string): Promise<DbDoc | null>;
/** // /**
* // * 删除文档
*/ // */
remove(doc: string | DbDoc): Promise<DbReturn>; // remove(doc: string | DbDoc): Promise<DbReturn>;
/** // /**
* () // * 批量操作文档(新增、修改、删除)
*/ // */
bulkDocs(docs: DbDoc[]): Promise<DbReturn[]>; // bulkDocs(docs: DbDoc[]): Promise<DbReturn[]>;
/** // /**
* id前缀查找 // * 获取所有文档 可根据文档id前缀查找
*/ // */
allDocs(key?: string): Promise<DbDoc[]>; // allDocs(key?: string): Promise<DbDoc[]>;
/** // /**
* // * 存储附件到新文档
* @param docId ID // * @param docId 文档ID
* @param attachment buffer // * @param attachment 附件 buffer
* @param type image/png, text/plain // * @param type 附件类型示例image/png, text/plain
*/ // */
postAttachment(docId: string, attachment: Uint8Array, type: string): Promise<DbReturn>; // postAttachment(docId: string, attachment: Uint8Array, type: string): Promise<DbReturn>;
/** // /**
* // * 获取附件
* @param docId ID // * @param docId 文档ID
*/ // */
getAttachment(docId: string): Promise<Uint8Array | null>; // getAttachment(docId: string): Promise<Uint8Array | null>;
/** // /**
* // * 获取附件类型
* @param docId ID // * @param docId 文档ID
*/ // */
getAttachmentType(docId: string): Promise<string | null>; // getAttachmentType(docId: string): Promise<string | null>;
} // }
}; // };
dbStorage: { // dbStorage: {
/** // /**
* // * 键值对存储,如果键名存在,则更新其对应的值
* @param key (ID) // * @param key 键名(同时为文档ID)
* @param value // * @param value 键值
*/ // */
setItem (key: string, value: any): void; // setItem (key: string, value: any): void;
/** // /**
* // * 获取键名对应的值
*/ // */
getItem (key: string): any; // getItem (key: string): any;
/** // /**
* () // * 删除键值对(删除文档)
*/ // */
removeItem (key: string): void; // removeItem (key: string): void;
}; // };
ubrowser: UBrowser; ubrowser: UBrowser;
} }