@re-ai/inner-tool-sdk
Advanced tools
Comparing version 0.2.9 to 0.2.10
@@ -12,2 +12,3 @@ import WebSocket from "ws"; | ||
import { RPCClientOptions } from "../types/rpc"; | ||
import { NetBridgeService } from "../services/NetBridgeService"; | ||
export declare class ReAITool { | ||
@@ -23,2 +24,4 @@ static sms(options?: RPCClientOptions): SMSService; | ||
static hdMessage(ws: WebSocket): HDMessageService; | ||
static bridgeAgentGet(id: string): NetBridgeService; | ||
static bridgeAgentSet(id: string, ws: WebSocket): void; | ||
} |
@@ -11,2 +11,3 @@ "use strict"; | ||
const userService_1 = require("../services/oneapi/userService"); | ||
const NetBridgeService_1 = require("../services/NetBridgeService"); | ||
class ReAITool { | ||
@@ -58,3 +59,9 @@ static sms(options) { | ||
} | ||
static bridgeAgentGet(id) { | ||
return new NetBridgeService_1.NetBridgeService(id); | ||
} | ||
static bridgeAgentSet(id, ws) { | ||
return NetBridgeService_1.NetBridgeService.set(id, ws); | ||
} | ||
} | ||
exports.ReAITool = ReAITool; |
@@ -42,2 +42,6 @@ import { HDInfoTypes } from "../../types/hd/message"; | ||
sendForTokenReset(): Promise<boolean>; | ||
/** | ||
* 更新app | ||
*/ | ||
sendForUpdateApp(): Promise<boolean>; | ||
} |
@@ -16,3 +16,4 @@ import WebSocket from "ws"; | ||
sendForTokenReset(): Promise<boolean>; | ||
sendForUpdateApp(): Promise<boolean>; | ||
handle(message: string, onResult: (msgId: string, key: HDWSMessageRecieveKeys, data: HDWSMessageRecieveResultData) => Promise<any>): Promise<boolean | any>; | ||
} |
@@ -68,2 +68,5 @@ "use strict"; | ||
} | ||
sendForUpdateApp() { | ||
return this.send(message_1.HDActionNames.UPDATE_APP); | ||
} | ||
async handle(message, onResult) { | ||
@@ -70,0 +73,0 @@ try { |
export declare enum HDInfoTypes { | ||
base = "base", | ||
wifiList = "wifiList", | ||
bluetoothList = "bluetoothList", | ||
gps = "gps", | ||
sensor = "sensor" | ||
sensor = "sensor", | ||
network = "network", | ||
battery = "battery" | ||
} | ||
@@ -14,3 +17,4 @@ export declare enum HDActionNames { | ||
SCAN_QRCODE = "scanQrcode", | ||
TOKEN_RESET = "tokenReset" | ||
TOKEN_RESET = "tokenReset", | ||
UPDATE_APP = "updateApp" | ||
} | ||
@@ -32,2 +36,3 @@ export type HDWSMessageRecieve = { | ||
export declare enum HDWSMessageRecieveKeys { | ||
infoBase = "base", | ||
infoWifiList = "wifiList", | ||
@@ -38,3 +43,5 @@ infoWifiListSync = "wifiListSync", | ||
infoGps = "gps", | ||
infoSensor = "sensor" | ||
infoSensor = "sensor", | ||
infoNetwork = "network", | ||
infoBattery = "battery" | ||
} | ||
@@ -44,3 +51,9 @@ export type HDWSMessageRecieveResultData = { | ||
message: "success" | "fail"; | ||
} | HDWifiInfo[] | HDBluetoothInfo[] | HDGPSInfo | HDSensorInfo; | ||
} | HDWifiInfo[] | HDBluetoothInfo[] | HDGPSInfo | HDSensorInfo | HDBaseInfo | HDBatteryInfo | HDNetworkInfo; | ||
export type HDBaseInfo = { | ||
versionCode: number; | ||
versionName: string; | ||
imei?: number; | ||
iccid?: number; | ||
}; | ||
export type HDWifiInfo = { | ||
@@ -62,4 +75,12 @@ ssid: string; | ||
}; | ||
export type HDBatteryInfo = { | ||
level: number; | ||
isCharging: boolean; | ||
}; | ||
export type HDNetworkInfo = { | ||
networkType: string; | ||
signalStrength?: any; | ||
}; | ||
export type HDSensorInfo = { | ||
[key: string]: any; | ||
}; |
@@ -6,2 +6,3 @@ "use strict"; | ||
(function (HDInfoTypes) { | ||
HDInfoTypes["base"] = "base"; | ||
HDInfoTypes["wifiList"] = "wifiList"; | ||
@@ -11,2 +12,4 @@ HDInfoTypes["bluetoothList"] = "bluetoothList"; | ||
HDInfoTypes["sensor"] = "sensor"; | ||
HDInfoTypes["network"] = "network"; | ||
HDInfoTypes["battery"] = "battery"; | ||
})(HDInfoTypes || (exports.HDInfoTypes = HDInfoTypes = {})); | ||
@@ -22,5 +25,7 @@ var HDActionNames; | ||
HDActionNames["TOKEN_RESET"] = "tokenReset"; | ||
HDActionNames["UPDATE_APP"] = "updateApp"; | ||
})(HDActionNames || (exports.HDActionNames = HDActionNames = {})); | ||
var HDWSMessageRecieveKeys; | ||
(function (HDWSMessageRecieveKeys) { | ||
HDWSMessageRecieveKeys["infoBase"] = "base"; | ||
HDWSMessageRecieveKeys["infoWifiList"] = "wifiList"; | ||
@@ -32,2 +37,4 @@ HDWSMessageRecieveKeys["infoWifiListSync"] = "wifiListSync"; | ||
HDWSMessageRecieveKeys["infoSensor"] = "sensor"; | ||
HDWSMessageRecieveKeys["infoNetwork"] = "network"; | ||
HDWSMessageRecieveKeys["infoBattery"] = "battery"; | ||
})(HDWSMessageRecieveKeys || (exports.HDWSMessageRecieveKeys = HDWSMessageRecieveKeys = {})); |
@@ -58,2 +58,3 @@ # 硬件ws消息发送接口sdk | ||
- `infoType`: (`HDInfoTypes`) 需要查询的信息类型,可选值包括: | ||
- `"base"`: 查询设备基础信息。 | ||
- `"wifiList"`: 查询WiFi列表。 | ||
@@ -63,2 +64,4 @@ - `"bluetoothList"`: 查询蓝牙设备列表。 | ||
- `"sensor"`: 获取传感器信息。 | ||
- `"battery"`: 获取电池信息。 | ||
- `"network"`: 获取网络信息。 | ||
- **返回**: `Promise<boolean>`,操作是否成功完成。 | ||
@@ -101,2 +104,7 @@ | ||
- **描述**: 重置硬件的认证Token。 | ||
- **返回**: `Promise<boolean>`,Token重置操作是否成功。 | ||
- **返回**: `Promise<boolean>`,Token重置操作是否成功。 | ||
#### `sendForUpdateApp(): Promise<boolean>` | ||
- **描述**: 触发硬件更新应用。 | ||
- **返回**: `Promise<boolean>`,更新操作是否成功。 |
{ | ||
"name": "@re-ai/inner-tool-sdk", | ||
"version": "0.2.9", | ||
"version": "0.2.10", | ||
"description": "ReAI内部接口sdk", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -9,3 +9,3 @@ | ||
+ 2024.06.17 | ||
+ 添加文本处理(快递地址解析) | ||
+ 添加文本处理(快递地址解析,支持阿里云,百度接口,已测试) | ||
+ 添加硬件ws消息的处理个发送,[文档](./doc/hd.md) | ||
@@ -12,0 +12,0 @@ + 2024.06.07 |
@@ -13,2 +13,3 @@ | ||
import { RPCClientOptions } from "../types/rpc"; | ||
import { NetBridgeService } from "../services/NetBridgeService"; | ||
@@ -68,2 +69,10 @@ export class ReAITool { | ||
static bridgeAgentGet(id: string) { | ||
return new NetBridgeService(id) | ||
} | ||
static bridgeAgentSet(id: string, ws: WebSocket) { | ||
return NetBridgeService.set(id, ws) | ||
} | ||
} |
@@ -51,2 +51,7 @@ import { HDInfoTypes } from "../../types/hd/message"; | ||
sendForTokenReset(): Promise<boolean> ; | ||
/** | ||
* 更新app | ||
*/ | ||
sendForUpdateApp(): Promise<boolean> ; | ||
} |
@@ -83,2 +83,6 @@ | ||
sendForUpdateApp(): Promise<boolean> { | ||
return this.send(HDActionNames.UPDATE_APP) | ||
} | ||
async handle(message: string, onResult: ( | ||
@@ -85,0 +89,0 @@ msgId: string, |
export enum HDInfoTypes { | ||
base = "base", | ||
wifiList = "wifiList", | ||
bluetoothList = "bluetoothList", | ||
gps = "gps", | ||
sensor = "sensor" | ||
sensor = "sensor", | ||
network = "network", | ||
battery = "battery" | ||
} | ||
@@ -15,3 +18,4 @@ | ||
SCAN_QRCODE = "scanQrcode", | ||
TOKEN_RESET = "tokenReset" | ||
TOKEN_RESET = "tokenReset", | ||
UPDATE_APP = "updateApp" | ||
} | ||
@@ -36,2 +40,3 @@ | ||
export enum HDWSMessageRecieveKeys { | ||
infoBase = "base", | ||
infoWifiList = "wifiList", | ||
@@ -42,3 +47,5 @@ infoWifiListSync = "wifiListSync", | ||
infoGps = "gps", | ||
infoSensor = "sensor" | ||
infoSensor = "sensor", | ||
infoNetwork = "network", | ||
infoBattery = "battery" | ||
} | ||
@@ -49,4 +56,11 @@ | ||
message: "success" | "fail" | ||
} | HDWifiInfo[] | HDBluetoothInfo[] | HDGPSInfo | HDSensorInfo | ||
} | HDWifiInfo[] | HDBluetoothInfo[] | HDGPSInfo | HDSensorInfo | HDBaseInfo | HDBatteryInfo | HDNetworkInfo | ||
export type HDBaseInfo = { | ||
versionCode: number, | ||
versionName: string, | ||
imei?: number, | ||
iccid?: number | ||
} | ||
export type HDWifiInfo = { | ||
@@ -71,4 +85,14 @@ ssid: string, | ||
export type HDBatteryInfo = { | ||
level: number, | ||
isCharging: boolean | ||
} | ||
export type HDNetworkInfo = { | ||
networkType: string, | ||
signalStrength?: any // 4G的 | ||
} | ||
export type HDSensorInfo = { | ||
[key: string] : any | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
156659
108
4152
28