修改声明文件

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 iconv = require('iconv-lite')
const electron = require('electron')
const { NodeVM } = require('./lib/vm2')
const {
NodeVM
} = require('./lib/vm2')
const path = require("path")
const util = require("util")
const PinyinMatch = require('pinyin-match');
@ -495,6 +497,8 @@ getuToolsLite = () => {
delete utoolsLite.dbStorage
delete utoolsLite.removeFeature
delete utoolsLite.setFeature
delete utoolsLite.onDbPull
delete utoolsLite.getFeatures
// 支付相关接口
delete utoolsLite.fetchUserServerTemporaryToken
delete utoolsLite.getUserServerTemporaryToken
@ -502,7 +506,7 @@ getuToolsLite = () => {
delete utoolsLite.fetchUserPayments
return utoolsLite
}
console.error
let getSandboxFuns = () => {
var sandbox = {
utools: getuToolsLite(),
@ -591,7 +595,7 @@ runCodeInVm = (cmd, cb, enterData = {}) => {
});
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
@ -302,59 +302,59 @@ interface UToolsApi {
/**
*
*/
fetchUserServerTemporaryToken(): Promise<{ token: string, expiredAt: number }>;
// fetchUserServerTemporaryToken(): Promise<{ token: string, expiredAt: number }>;
/**
*
* @param callback
*/
openPayment(options: {
/**
* ID uTools
*/
goodsId: string,
/**
* ()
*/
outOrderId?: string,
/**
* API和支付通知中原样返回使()
*/
attach?: string
}, callback?: () => void): void;
// openPayment(options: {
// /**
// * 商品ID在 “uTools 开发者工具” 插件中创建
// */
// goodsId: string,
// /**
// * 第三方服务生成的订单号(可选)
// */
// outOrderId?: string,
// /**
// * 第三方服务附加数据在查询API和支付通知中原样返回可作为自定义参数使用(可选)
// */
// attach?: string
// }, 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: {
code: string,
explain: string,
platform: ('darwin' | 'win32' | 'linux') | (Array<'darwin' | 'win32' | 'linux'>),
icon?: string,
cmds: string | {
type: 'img' | 'files' | 'regex' | 'over' | 'window',
label: string
}[]
}): boolean;
// setFeature(feature: {
// code: string,
// explain: string,
// platform: ('darwin' | 'win32' | 'linux') | (Array<'darwin' | 'win32' | 'linux'>),
// icon?: string,
// cmds: string | {
// type: 'img' | 'files' | 'regex' | 'over' | 'window',
// label: string
// }[]
// }): boolean;
/**
*
*/
removeFeature(code: string): boolean;
// removeFeature(code: string): boolean;
/**
*
*/
getFeatures(): {
code: string,
explain: string,
platform: ('darwin' | 'win32' | 'linux') | (Array<'darwin' | 'win32' | 'linux'>),
icon?: string,
cmds: string | {
type: 'img' | 'files' | 'regex' | 'over' | 'window',
label: string
}[]
}[];
// getFeatures(): {
// code: string,
// explain: string,
// platform: ('darwin' | 'win32' | 'linux') | (Array<'darwin' | 'win32' | 'linux'>),
// icon?: string,
// cmds: string | {
// type: 'img' | 'files' | 'regex' | 'over' | 'window',
// label: string
// }[]
// }[];
/**
*
*/
@ -544,104 +544,104 @@ interface UToolsApi {
*/
isLinux(): boolean;
db: {
/**
* /
*/
put(doc: DbDoc): DbReturn;
/**
*
*/
get(id: string): DbDoc | null;
/**
*
*/
remove(doc: string | DbDoc): DbReturn;
/**
* ()
*/
bulkDocs(docs: DbDoc[]): DbReturn[];
/**
* id前缀查找
*/
allDocs(key?: string): DbDoc[];
/**
*
* @param docId ID
* @param attachment buffer
* @param type image/png, text/plain
*/
postAttachment(docId: string, attachment: Uint8Array, type: string): DbReturn;
/**
*
* @param docId ID
*/
getAttachment(docId: string): Uint8Array | null;
/**
*
* @param docId ID
*/
getAttachmentType(docId: string): string | null;
/**
*
*/
promises: {
/**
* /
*/
put(doc: DbDoc): Promise<DbReturn>;
/**
*
*/
get(id: string): Promise<DbDoc | null>;
/**
*
*/
remove(doc: string | DbDoc): Promise<DbReturn>;
/**
* ()
*/
bulkDocs(docs: DbDoc[]): Promise<DbReturn[]>;
/**
* id前缀查找
*/
allDocs(key?: string): Promise<DbDoc[]>;
/**
*
* @param docId ID
* @param attachment buffer
* @param type image/png, text/plain
*/
postAttachment(docId: string, attachment: Uint8Array, type: string): Promise<DbReturn>;
/**
*
* @param docId ID
*/
getAttachment(docId: string): Promise<Uint8Array | null>;
/**
*
* @param docId ID
*/
getAttachmentType(docId: string): Promise<string | null>;
}
};
// db: {
// /**
// * 创建/更新文档
// */
// put(doc: DbDoc): DbReturn;
// /**
// * 获取文档
// */
// get(id: string): DbDoc | null;
// /**
// * 删除文档
// */
// remove(doc: string | DbDoc): DbReturn;
// /**
// * 批量操作文档(新增、修改、删除)
// */
// bulkDocs(docs: DbDoc[]): DbReturn[];
// /**
// * 获取所有文档 可根据文档id前缀查找
// */
// allDocs(key?: string): DbDoc[];
// /**
// * 存储附件到新文档
// * @param docId 文档ID
// * @param attachment 附件 buffer
// * @param type 附件类型示例image/png, text/plain
// */
// postAttachment(docId: string, attachment: Uint8Array, type: string): DbReturn;
// /**
// * 获取附件
// * @param docId 文档ID
// */
// getAttachment(docId: string): Uint8Array | null;
// /**
// * 获取附件类型
// * @param docId 文档ID
// */
// getAttachmentType(docId: string): string | null;
// /**
// * 异步
// */
// promises: {
// /**
// * 创建/更新文档
// */
// put(doc: DbDoc): Promise<DbReturn>;
// /**
// * 获取文档
// */
// get(id: string): Promise<DbDoc | null>;
// /**
// * 删除文档
// */
// remove(doc: string | DbDoc): Promise<DbReturn>;
// /**
// * 批量操作文档(新增、修改、删除)
// */
// bulkDocs(docs: DbDoc[]): Promise<DbReturn[]>;
// /**
// * 获取所有文档 可根据文档id前缀查找
// */
// allDocs(key?: string): Promise<DbDoc[]>;
// /**
// * 存储附件到新文档
// * @param docId 文档ID
// * @param attachment 附件 buffer
// * @param type 附件类型示例image/png, text/plain
// */
// postAttachment(docId: string, attachment: Uint8Array, type: string): Promise<DbReturn>;
// /**
// * 获取附件
// * @param docId 文档ID
// */
// getAttachment(docId: string): Promise<Uint8Array | null>;
// /**
// * 获取附件类型
// * @param docId 文档ID
// */
// getAttachmentType(docId: string): Promise<string | null>;
// }
// };
dbStorage: {
/**
*
* @param key (ID)
* @param value
*/
setItem (key: string, value: any): void;
/**
*
*/
getItem (key: string): any;
/**
* ()
*/
removeItem (key: string): void;
};
// dbStorage: {
// /**
// * 键值对存储,如果键名存在,则更新其对应的值
// * @param key 键名(同时为文档ID)
// * @param value 键值
// */
// setItem (key: string, value: any): void;
// /**
// * 获取键名对应的值
// */
// getItem (key: string): any;
// /**
// * 删除键值对(删除文档)
// */
// removeItem (key: string): void;
// };
ubrowser: UBrowser;
}