@re-ai/inner-tool-sdk
Advanced tools
Comparing version 0.3.2 to 0.3.3
@@ -17,2 +17,3 @@ import WebSocket from "ws"; | ||
import { FileService } from "../services/FileService"; | ||
import { WechatRPCService } from "../services/WechatService"; | ||
export declare class ReAITool { | ||
@@ -23,2 +24,3 @@ static sms(options?: RPCClientOptions): SMSService; | ||
static express(options?: RPCClientOptions): ExpressService; | ||
static wechat(options?: RPCClientOptions): WechatRPCService; | ||
static file(options?: OptionsFile): FileService; | ||
@@ -25,0 +27,0 @@ static oneapi(options?: OneAPIOptions): { |
@@ -15,2 +15,3 @@ "use strict"; | ||
const FileService_1 = require("../services/FileService"); | ||
const WechatService_1 = require("../services/WechatService"); | ||
class ReAITool { | ||
@@ -41,2 +42,8 @@ static sms(options) { | ||
} | ||
static wechat(options) { | ||
return new WechatService_1.WechatRPCService({ | ||
port: options?.port || parseInt(process.env.REAI_RPC_PORT_WECHAT || process.env.RPC_PORT_WECHAT || '4685'), | ||
host: options?.host || process.env.REAI_RPC_HOST_WECHAT || process.env.RPC_HOST_WECHAT || '127.0.0.1' | ||
}); | ||
} | ||
static file(options) { | ||
@@ -43,0 +50,0 @@ return new FileService_1.FileService({ |
import { RPCClientResponseResult } from "../types/rpc"; | ||
import { PubWebAuthorizeUrlGetArgs, PubWebAuthorizeUrlGetResponse, PubWebUserInfoGetArgs, PubWebUserInfoGetResponse } from "../types/wechat"; | ||
export interface WechatInterface { | ||
import { WechatMiniCode2SessionResult } from "../types/wechat"; | ||
export interface WechatRPCInterface { | ||
/** | ||
* 公众号授权链接获取 | ||
* @param data | ||
* 将小程序的code转换为sessionData。 | ||
* | ||
* 此函数用于对接微信小程序的登录流程,通过小程序的code换取session_key及openid。 | ||
* code是小程序调用getAuthCode接口获取的,用于标识用户的一次登录行为。 | ||
* 通过这个函数,可以将code转换为session_key和openid,以便于后续的用户身份识别和会话管理。 | ||
* | ||
* @param jsCode 小程序调用getAuthCode接口获取的code。 | ||
* @returns 返回一个Promise,解析后的结果包含session_key和openid等信息。 | ||
*/ | ||
pubAuthUrlGet(data: PubWebAuthorizeUrlGetArgs): Promise<RPCClientResponseResult<PubWebAuthorizeUrlGetResponse>>; | ||
/** | ||
* 公众号用户信息获取 | ||
* @param data | ||
*/ | ||
pubUserIhfoGet(data: PubWebUserInfoGetArgs): Promise<RPCClientResponseResult<PubWebUserInfoGetResponse>>; | ||
miniCode2Session(jsCode: string): Promise<RPCClientResponseResult<WechatMiniCode2SessionResult>>; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -1,9 +0,8 @@ | ||
import { WechatInterface } from "../interfaces/wechat"; | ||
import { WechatRPCInterface } from "../interfaces/wechat"; | ||
import { RPCClient } from "../libs/RPCClient"; | ||
import { RPCClientOptions, RPCClientResponseResult } from "../types/rpc"; | ||
import { PubWebAuthorizeUrlGetArgs, PubWebAuthorizeUrlGetResponse, PubWebUserInfoGetArgs, PubWebUserInfoGetResponse } from "../types/wechat"; | ||
export declare class WechatService extends RPCClient implements WechatInterface { | ||
import { WechatMiniCode2SessionResult } from "../types/wechat"; | ||
export declare class WechatRPCService extends RPCClient implements WechatRPCInterface { | ||
constructor(options?: RPCClientOptions); | ||
pubAuthUrlGet(data: PubWebAuthorizeUrlGetArgs): Promise<RPCClientResponseResult<PubWebAuthorizeUrlGetResponse>>; | ||
pubUserIhfoGet(data: PubWebUserInfoGetArgs): Promise<RPCClientResponseResult<PubWebUserInfoGetResponse>>; | ||
miniCode2Session(jsCode: string): Promise<RPCClientResponseResult<WechatMiniCode2SessionResult>>; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.WechatService = void 0; | ||
exports.WechatRPCService = void 0; | ||
const RPCClient_1 = require("../libs/RPCClient"); | ||
const wechat_1 = require("../types/wechat"); | ||
class WechatService extends RPCClient_1.RPCClient { | ||
class WechatRPCService extends RPCClient_1.RPCClient { | ||
constructor(options) { | ||
super(options); | ||
} | ||
async pubAuthUrlGet(data) { | ||
return await this._request(wechat_1.WechatRpcMethods.pubWebAuthorizeUrlGet, { query: data }); | ||
async miniCode2Session(jsCode) { | ||
return await this._request(wechat_1.WechatRPCMethods.MINI_CODE2SESSION, { | ||
body: { | ||
jsCode | ||
} | ||
}); | ||
} | ||
async pubUserIhfoGet(data) { | ||
return await this._request(wechat_1.WechatRpcMethods.pubWebUserInfoGet, { query: data }); | ||
} | ||
} | ||
exports.WechatService = WechatService; | ||
exports.WechatRPCService = WechatRPCService; |
@@ -1,52 +0,8 @@ | ||
/** | ||
* 微信相关 | ||
*/ | ||
export declare enum WechatRpcMethods { | ||
pubWebAuthorizeUrlGet = "pubWebAuthorizeUrlGet", | ||
pubWebUserInfoGet = "pubWebUserInfoGet" | ||
export declare enum WechatRPCMethods { | ||
MINI_CODE2SESSION = "miniCode2Session" | ||
} | ||
/** | ||
* 公众号网页授权 | ||
* @param redirectUri 授权后重定向的回调链接地址 | ||
* @param notifyUri 授权回调通知地址 | ||
* @param state 重定向后会带上state参数,开发者可以填写任意参数值,最多128字节 | ||
*/ | ||
export type PubWebAuthorizeUrlGetArgs = { | ||
redirectUri: string; | ||
notifyUri: string; | ||
state: string; | ||
export type WechatMiniCode2SessionResult = { | ||
openid: string; | ||
session_key: string; | ||
unionid?: string; | ||
}; | ||
/** | ||
* 公众号网页授权网页获取结果 | ||
* @param url 授权url | ||
*/ | ||
export type PubWebAuthorizeUrlGetResponse = { | ||
url: string; | ||
}; | ||
/** | ||
* 公众号网页授权网页用户信息获取参数 | ||
* @param code 授权码 | ||
* @param state 业务参数 | ||
*/ | ||
export type PubWebUserInfoGetArgs = { | ||
code: string; | ||
state: string; | ||
}; | ||
/** | ||
* 公众号网页授权网页用户信息获取结果 | ||
* @param userInfo 用户信息 | ||
*/ | ||
export type PubWebUserInfoGetResponse = { | ||
userInfo: { | ||
openid: string; | ||
nickname: string; | ||
sex: number; | ||
province: string; | ||
city: string; | ||
country: string; | ||
headimgurl: string; | ||
unionid: string; | ||
}; | ||
redirectUri?: string; | ||
notifyUri?: string; | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.WechatRpcMethods = void 0; | ||
/** | ||
* 微信相关 | ||
*/ | ||
var WechatRpcMethods; | ||
(function (WechatRpcMethods) { | ||
WechatRpcMethods["pubWebAuthorizeUrlGet"] = "pubWebAuthorizeUrlGet"; | ||
WechatRpcMethods["pubWebUserInfoGet"] = "pubWebUserInfoGet"; | ||
})(WechatRpcMethods || (exports.WechatRpcMethods = WechatRpcMethods = {})); | ||
exports.WechatRPCMethods = void 0; | ||
var WechatRPCMethods; | ||
(function (WechatRPCMethods) { | ||
WechatRPCMethods["MINI_CODE2SESSION"] = "miniCode2Session"; | ||
})(WechatRPCMethods || (exports.WechatRPCMethods = WechatRPCMethods = {})); |
@@ -0,0 +0,0 @@ ### 示例代码 |
@@ -0,0 +0,0 @@ # 文件上传及管理 |
@@ -0,0 +0,0 @@ # 硬件ws消息发送接口sdk |
@@ -0,0 +0,0 @@ # OneAPI 接口文档 |
{ | ||
"name": "@re-ai/inner-tool-sdk", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "ReAI内部接口sdk", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -0,0 +0,0 @@ |
@@ -18,2 +18,3 @@ | ||
import { FileService } from "../services/FileService"; | ||
import { WechatRPCService } from "../services/WechatService"; | ||
@@ -50,2 +51,9 @@ export class ReAITool { | ||
static wechat(options?: RPCClientOptions) { | ||
return new WechatRPCService({ | ||
port: options?.port || parseInt(process.env.REAI_RPC_PORT_WECHAT || process.env.RPC_PORT_WECHAT || '4685'), | ||
host: options?.host || process.env.REAI_RPC_HOST_WECHAT || process.env.RPC_HOST_WECHAT || '127.0.0.1' | ||
}) | ||
} | ||
static file(options?: OptionsFile) { | ||
@@ -52,0 +60,0 @@ return new FileService({ |
@@ -0,0 +0,0 @@ export * from './types/sms' |
@@ -0,0 +0,0 @@ import { WSBridgePayload } from "../types/bridge"; |
@@ -0,0 +0,0 @@ import { DIFYChatMessageData, DIFYChunkChatCompletionResponse, DIFYHitTestResult } from "../types/dify"; |
@@ -0,0 +0,0 @@ import { ExpressQueryReqData, ExpressQueryResData } from "../types/express"; |
@@ -0,0 +0,0 @@ import { FileData, FileListResult, FileUploadResult } from "../types/file"; |
@@ -0,0 +0,0 @@ import { HDWSMessageRecieveKeys, HDWSMessageRecieveResultData } from "../../types/hd/message"; |
@@ -0,0 +0,0 @@ import { HDInfoTypes } from "../../types/hd/message"; |
@@ -0,0 +0,0 @@ import { OneAPIChannelData, OneAPIChannelListData, OneAPIChannelListReq, OneAPILoginReq, OneAPILoginRes, OneAPILogsListData, OneAPILogsReq, OneAPIModelsData, OneAPIPriceData, OneAPIRedemptionAddReq, OneAPIRedemptionData, OneAPIRedemptionListData, OneAPIRedemptionReq, OneAPIRegisterReq, OneAPIResponse, OneAPISelfData, OneAPITokenAddReq, OneAPITokenData, OneAPITokenListData, OneAPITokenListReq, OneAPITokenUpdateReq, OneAPITopupReq } from "../types/oneapi"; |
@@ -0,0 +0,0 @@ import { PayOrderCreateData, PayOrderInfo, PayOrderRefundCreateData, PayOrderRefundCreateInfo, PayOrderRefundInfo, PayType } from "../types/pay"; |
@@ -0,0 +0,0 @@ import { RPCClientResponseResult } from "../types/rpc"; |
@@ -0,0 +0,0 @@ import { RPCClientResponseResult } from "../types/rpc"; |
@@ -0,0 +0,0 @@ export interface ITranslate { |
@@ -0,0 +0,0 @@ import { DIFYChatCompletionResponse, DIFYChatMessageData, DIFYChunkChatCompletionResponse, DIFYHitTestResult, DIFYOptions } from "../types/dify"; |
@@ -0,0 +0,0 @@ import axios, { AxiosRequestConfig, AxiosResponse } from "axios"; |
@@ -0,0 +0,0 @@ import jayson, { TcpClient } from "jayson"; |
@@ -0,0 +0,0 @@ import WebSocket, { CloseEvent, ErrorEvent, MessageEvent } from "ws" |
@@ -0,0 +0,0 @@ import { DifyInterface } from "../interfaces/dify"; |
@@ -0,0 +0,0 @@ import { ExpressInterface } from "../interfaces/express"; |
@@ -0,0 +0,0 @@ import { readFileSync } from "fs"; |
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ import WebSocket from "ws"; |
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ // import { join } from "path"; |
@@ -0,0 +0,0 @@ import { PayInterface } from "../interfaces/pay"; |
@@ -0,0 +0,0 @@ import WebSocket, { CloseEvent, Data, ErrorEvent, MessageEvent, OpenEvent } from "ws"; |
@@ -0,0 +0,0 @@ import { SMSInterface } from "../interfaces/sms"; |
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ export type DIFYChatMessageData = { |
@@ -0,0 +0,0 @@ export type ExpressQueryReqData = { |
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ export enum HDInfoTypes { |
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ export type SeamlessOptions = { |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ export enum TextPlatform { |
@@ -0,0 +0,0 @@ export const getCurrentDate = (): string => { |
@@ -0,0 +0,0 @@ export enum LogLevel { |
@@ -0,0 +0,0 @@ { |
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 4 instances 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
148
5770
220759
4
52