mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-09 23:16:18 +08:00
修改声明文件
This commit is contained in:
parent
9ea88e9286
commit
827e19b559
@ -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()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 错误处理
|
// 错误处理
|
||||||
|
270
src/plugins/monaco/types/utools.api.d.ts
vendored
270
src/plugins/monaco/types/utools.api.d.ts
vendored
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user