@xingm/http-request-sdk 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  ## 安装
6
6
 
7
7
  ```bash
8
- npm install http-request-sdk axios
8
+ npm install @xingm/http-request-sdk
9
9
  ```
10
10
 
11
11
  如果你要使用内置的 Ant Design Vue UI 适配器,再安装:
@@ -155,6 +155,9 @@ setupRequestSdk({
155
155
  baseURL: "/admin-api",
156
156
  timeout: 30000,
157
157
  lang: "zh-CN",
158
+ headers: {
159
+ tenantId: "xxx",
160
+ },
158
161
  unwrapData: true,
159
162
  successCodes: [0, 200],
160
163
  authHeaderName: "Authorization",
@@ -191,6 +194,8 @@ setupRequestSdk({
191
194
  });
192
195
  ```
193
196
 
197
+ `lang` 只用于 SDK 内置提示文案,不会自动拼到接口 URL 或请求参数中,也不会自动作为请求头发送。如果需要发送语言请求头,请显式配置 `getLocale` 或 `locale.getLocale`。
198
+
194
199
  如果项目已有自己的 i18n,可以继续使用 `locale.translate`,它的优先级高于 `lang` 内置文案:
195
200
 
196
201
  ```ts
@@ -1 +1 @@
1
- {"version":3,"file":"create-request-sdk.d.ts","sourceRoot":"","sources":["../src/create-request-sdk.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EASV,UAAU,EACV,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAWjB,eAAO,MAAM,2BAA2B,2CACE,CAAC;AAE3C,eAAO,MAAM,gBAAgB,GAAI,SAAS,GAAG,OAAO,EAClD,UAAS,iBAAiB,CAAC,SAAS,CAAM,KACzC,UA+cF,CAAC"}
1
+ {"version":3,"file":"create-request-sdk.d.ts","sourceRoot":"","sources":["../src/create-request-sdk.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EASV,UAAU,EACV,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAWjB,eAAO,MAAM,2BAA2B,2CACE,CAAC;AAK3C,eAAO,MAAM,gBAAgB,GAAI,SAAS,GAAG,OAAO,EAClD,UAAS,iBAAiB,CAAC,SAAS,CAAM,KACzC,UAwgBF,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";const z=require("axios"),Y="System error",X={400:"Invalid request parameters",401:"Unauthorized. Token, username, or password is incorrect.",403:"Access is forbidden.",404:"Network request error. Resource not found.",405:"Network request error. Method not allowed.",408:"Network request timed out.",500:"System error",501:"Network request is not implemented.",502:"Network error.",503:"Service unavailable. The server is overloaded or under maintenance.",504:"Network timeout.",505:"HTTP version is not supported.",507:"The maximum export quantity is 100000.",7e5:"Invalid code [{}]",700001:"The export quantity exceeds the limit. The maximum allowed is [{}].",700002:"The data exceeds [{}] records. Please narrow the query range.",700003:"Device [{}] is offline.",700004:"Device [{}] has no GPS information.",700005:"File already exists. Path: [{}]",700006:"Invalid file name.",700007:"File size exceeds the limit.",700008:"Unsupported file type.",700009:"File is empty.",700010:"Only [{}] files are supported.",700011:"File parsing failed.",700012:"File saving failed.",700013:"No online devices.",700014:"Invalid file path.",700015:"File upload failed.",700016:"File export failed.",700017:"User does not exist.",700018:"File does not exist.",700019:"Parameter is empty.",700020:"Local language is empty.",700021:"Device history data does not exist.",700022:"Device [{}] longitude is empty.",700023:"Device [{}] latitude is empty.",700025:"MD5 algorithm is unavailable.",700026:"Export exception.",700027:"ID is empty.",701e3:"DPD-TDOA raw data is empty.",701001:"DPD-TDOA raw data details are empty.",701002:"TDOA collection frequency is incorrect.",701003:"Algorithm type is empty.",701004:"Flight task ID is empty.",701005:"Target coordinates are empty.",701006:"The number of devices for single collection cannot be less than [{}].",701007:"The number of devices for continuous collection cannot be less than [{}].",701008:"Device reported abnormal gpsTime.",701009:"Failed to correct collection task and record.",701010:"Device code is empty.",701011:"Device [{}] has unfinished collection tasks. Duplicate dispatch is not allowed.",701012:"No warning level matched for area type [{}].",701013:"Failed to store IQ data file.",701014:"Failed to store IQ data file.",701015:"Firmware metadata not found.",701016:"Firmware data is empty.",701017:"Firmware for this device model and version already exists.",701018:"Failed to upload and parse firmware.",701019:"Collection data is empty.",701020:"Collection task ID is empty.",701021:"Failed to save drone reported image.",701022:"Failed to convert drone reported image.",701023:"Device height above ground is invalid.",701024:"Device detection range is invalid.",701025:"Failed to convert drone reported video.",701026:"Failed to save trajectory data.",701027:"Drone [{}] whitelist data has expired and cannot be modified.",701028:"Drone [{}] whitelist data has overlapping time and cannot be added.",701029:"Seconds cannot be negative.",701030:"Start time is empty.",701031:"End time is empty.",701032:"Start time is later than end time.",701033:"End time is earlier than current time.",701034:"Start time and end time are the same.",701035:"Failed to build drone warning data.",701036:"Failed to save drone data.",701040:"Area name already exists.",701041:"Area name is empty.",701052:"There are locked drones. Please unlock them before operating.",701056:"Only hourly or daily grouping is supported.",701057:"Firmware package is damaged or unreadable. Please check the firmware file.",704001:"Event identifier cannot be empty.",704002:"Event type cannot be empty.",704003:"Defense area number cannot be empty.",704004:"Data forwarding endpoint cannot be empty.",704020:"Reporting method cannot be empty.",704021:"Platform code cannot be empty.",704022:"Platform name cannot be empty.",704023:"The defense area does not exist.",704024:"Platform code already exists. Please use another one.",704028:"Currently only MQTT forwarding protocol is supported.",704033:"Connection test failed: [{}]",704034:"Test sending failed: [{}]",704037:"Data forwarding task does not exist.",704040:"Data forwarding endpoint does not exist.",705e3:"Configuration ID cannot be empty.",705001:"System configuration information cannot be empty.",705002:"Configuration value cannot be empty.",705003:"Configuration key cannot be empty.",705004:"Configuration key length cannot exceed [{}] characters.",705005:"Configuration key already exists.",705006:"Configuration does not exist.",1001000001:"Parameter configuration does not exist.",1001000002:"Parameter configuration key is duplicated.",1001000003:"Built-in system parameter configurations cannot be deleted.",1001000004:"Failed to get parameter configuration because hidden configurations are not allowed.",1001003001:"File does not exist.",1001003002:"File is empty.",1001003003:"Unsupported image format.",1001003004:"Image file is too large.",1001003005:"Unable to read image file.",1001006e3:"File configuration does not exist.",1001006001:"This file configuration cannot be deleted because it is the primary configuration.",1002e6:"Incorrect account or password.",1002000001:"Login failed. The account has been disabled.",1002000004:"Incorrect verification code.",1002000005:"Account is not bound. Binding is required.",1002000007:"Phone number does not exist.",1002000008:"Incorrect verification code.",1002001e3:"A menu with this name already exists.",1002001001:"Parent menu does not exist.",1002001002:"Cannot set itself as parent menu.",1002001003:"Menu does not exist.",1002001004:"Child menus exist and cannot be deleted.",1002001005:"Parent menu type must be directory or menu.",1002001006:"A menu with this component name already exists.",1002001007:"Invalid menu subtype.",1002001008:"Menu synchronization failed.",1002001009:"Menu node level exceeds the limit.",1002001010:"Invalid menu UUID.",1002001011:"Parent menu does not meet the specification.",1002002e3:"Role does not exist.",1002002001:"Role name is duplicated.",1002002002:"Role code already exists.",1002002003:"Built-in system roles cannot be operated.",1002002004:"Role has been disabled.",1002002005:"Role identifier cannot be used.",1002002006:"This role cannot be deleted.",1002003e3:"This account is already used. Please change it.",1002003001:"The phone number already exists.",1002003002:"The email address already exists.",1002003003:"User does not exist.",1002003004:"Imported user data cannot be empty.",1002003005:"Old password is incorrect.",1002003006:"This user has been disabled.",1002003008:"Failed to create user. Tenant quota exceeded.",1002003010:"This phone number has not been registered.",1002003011:"Registration is disabled.",1002003012:"This user is enabled and cannot be deleted.",1002003013:"Invalid region code.",1002003014:"Login account is display-only and cannot be edited.",1002003015:"Parsing failed.",1002003016:"Parsing failed: each import cannot exceed 10000 records. Please split the file.",1002003017:"Parsing failed: imported data cannot be empty.",1002003018:"Upload failed: file size exceeds the 10MB limit.",1002003019:"File parsing failed: only .xlsx template files are supported.",1002005e3:"The current position does not exist.",1002005001:"The position is not enabled and cannot be selected.",1002005002:"A position with this name already exists.",1002005003:"A position with this identifier already exists.",1002006001:"The current dictionary type does not exist.",1002006002:"The dictionary type is not enabled and cannot be selected.",1002006003:"Dictionary name already exists.",1002006004:"Dictionary code already exists.",1002006005:"Cannot delete. Dictionary values still exist under this dictionary.",1002006006:"Invalid dictionary synchronization request.",1002007001:"The current dictionary data does not exist.",1002007002:"The dictionary data is not enabled and cannot be selected.",1002007003:"Dictionary key already exists.",1002007004:"Dictionary label already exists.",1002031001:"Authorization has expired.",10021e5:"File service exception. Please check and test the file configuration.",1086001001:"System error.",1086001002:"Request error.",1086001003:"Enum not found.",1086001004:"Invalid parameter.",1086001005:"File is empty.",1086001006:"Invalid format.",1086002001:"Manufacturer code does not exist.",1086002002:"Device is not registered. Please register it first.",1086002003:"Invalid device creation parameters.",1086002004:"Dock or drone device already exists. Please check the SN.",1086002005:"Device does not exist.",1086002006:"Device is offline.",1086003004:"No flight or payload control permission.",1086003005:"Dock is offline.",1086003006:"Drone is offline.",1086003028:"Device is offline. DRC control cannot be performed.",1086003032:"Live stream failed because the device is offline.",1086003033:"Unable to pull the device stream. Please try again.",1086003034:"Live stream type is not supported.",1086004001:'File name cannot contain illegal characters <>:"/',1086004002:"Route does not exist.",1086004003:"This route is used by pending tasks. Please delete the tasks first.",1086004004:"Route creation failed.",1086004005:"Route file name already exists.",1086004006:"The number of waypoints is less than 2.",1086004007:"The number of waypoints is greater than 50.",1086004008:"Route update failed.",1086005001:"Speaker or TTS file does not exist.",1086005002:"Speaker file upload failed.",1086005003:"Speaker file saving failed.",1086005004:"Invalid speaker file format. Only MP3 is supported.",1086005005:"Speaker file size exceeds the limit. A single file cannot exceed 5MB.",1086005006:"Speaker file name is duplicated on this device.",1086008001:"Route name cannot be empty.",1086008002:"Plan name already exists.",1086008003:"Execution time cannot be earlier than current time.",1086008004:"Plan does not exist.",1086008008:"Route task does not exist.",1086008014:"Task report is being generated. Please try again later.",1086009001:"Space name is duplicated.",1086009002:"Invalid parent space.",1086009003:"Detected circular parent space.",1086009004:"Space or child nodes are bound to devices and cannot be deleted.",1086009005:"Space level has reached the maximum limit.",1086009006:"Root node cannot be deleted.",1086009007:"Root node already exists and cannot be created again.",1086009008:"Failed to query monitoring device list.",1500000001:"Failed to initialize platform MQTT client instance.",1500000002:"Failed to connect to MQTT broker.",1500000003:"MQTT connection lost unexpectedly.",1500000004:"instanceName cannot be empty.",1500000005:"Forwarding configuration already exists.",1500000006:"Forwarding configuration does not exist.",1500000008:"Target instance is unavailable: {}",1500000009:"Request instance {} does not match current node {}.",1500000010:"Please disable forwarding configuration before deleting it.",1500000011:"Failed to release MQTT physical connection.",1500000012:"Changing forwarding configuration ownership through update is not allowed.",1500000013:"payloadTransformScript length cannot exceed {} characters.",1500000014:"payloadTransformScript compilation failed: {}",1500000015:"Invalid brokerUrl format. Use mqtt://host:port, mqtts://host:port, tcp://host:port, or ssl://host:port.",other:Y},Z="系统异常",e0={400:"参数错误",401:"用户没有权限(令牌、用户名、密码错误)!",403:"用户得到授权,但是访问是被禁止的。!",404:"网络请求错误,未找到该资源!",405:"网络请求错误,请求方法未允许!",408:"网络请求超时!",500:"系统错误",501:"网络未实现!",502:"网络错误!",503:"服务不可用,服务器暂时过载或维护!",504:"网络超时!",505:"http版本不支持该请求!",507:"超过最大导出数量为100000",7e5:"非法的CODE[{}]",700001:"导出数量超过限制,最大允许导出[{}]条",700002:"数据超过[{}]条,请缩小查询范围",700003:"设备[{}]不在线",700004:"设备[{}]未获取到GPS信息",700005:"文件已存在, 路径[{}]",700006:"文件名非法",700007:"文件大小超出限制",700008:"不支持的文件类型",700009:"文件为空",700010:"仅支持[{}]格式的文件",700011:"文件解析失败",700012:"文件保存失败",700013:"当前无在线设备",700014:"文件路径非法",700015:"文件上传失败",700016:"文件导出失败",700017:"用户不存在",700018:"文件不存在",700019:"参数为空",700020:"当地语言为空",700021:"设备历史数据不存在",700022:"设备[{}]经度为空",700023:"设备[{}]纬度为空",700025:"MD5算法不可用",700026:"导出异常",700027:"ID为空",701e3:"dpd-tdoa原始数据为空",701001:"dpd-tdoa原始数据详情为空",701002:"TDOA采集频率不正确",701003:"算法类型为空",701004:"飞行任务ID为空",701005:"靶标坐标为空",701006:"单次采集设备数量不能小于[{}]台",701007:"连续采集设备数量不能小于[{}]台",701008:"设备上报gpsTime异常",701009:"订正采集任务和采集记录异常",701010:"设备编码为空",701011:"设备[{}]有未完成采集任务,禁止重复下发",701012:"区域类型未匹配到预警等级[{}]",701013:"IQ数据文件存储失败",701014:"IQ数据文件存储失败",701015:"未找到固件元信息",701016:"固件数据为空",701017:"该设备型号和固件版本的固件已存在",701018:"上传解析固件失败",701019:"采集数据为空",701020:"采集任务ID为空",701021:"无人机上报图片保存失败",701022:"无人机上报图片转换失败",701023:"设备相对地面高度非法",701024:"设备侦测范围非法",701025:"无人机上报视频转换失败",701026:"轨迹数据保存失败",701027:"无人机[{}]白名单数据已失效, 禁止修改",701028:"无人机[{}]白名单数据已存在时间交叉, 禁止新增",701029:"秒数不能为负数",701030:"有效时间起为空",701031:"有效时间止为空",701032:"有效时间起大于有效时间止",701033:"有效时间止小于当前时间",701034:"有效时间起止相同",701035:"构建无人机预警数据异常",701036:"保存无人机数据失败",701037:"固件文件访问URL不存在, 固件ID[{}]",701038:"没有找到对应设备型号的设备,无法下发固件升级命令",701039:"设备固件发布状态为空",701040:"区域名称已存在",701041:"区域名称为空",701042:"无人机停飞事件处理推送失败",701043:"无人机通用识别类型为空",701044:"无人机识别类型为空",701045:"DISCERN_PARSE识别类型暂不支持锁定和解锁",701046:"TDOA结果上报事件处理失败, 设备编码[{}]",701047:"仿真日志推送事件处理失败",701048:"单次数据采集少于[{}]个IQ文件",701049:"侦测设备位置信息列表为空",701050:"无人机数据为空",701051:"算法结果是否合并参数为空",701052:"有无人机锁定,请先解锁后操作",701053:"锁定信息序列化失败",701054:"解析锁定信息失败",701055:"更新锁定成功动作失败",701056:"仅支持按小时或按天分组",701057:"固件包文件损坏或无法读取, 请检查固件文件是否符合规范",701058:"固件包中存在多个JSON文件, 请检查固件文件是否符合规范",701059:"固件包中存在多个BIN文件, 请检查固件文件是否符合规范",701060:"固件包中缺少JSON文件, 请检查固件文件是否符合规范",701061:"固件包中缺少BIN文件, 请检查固件文件是否符合规范",704e3:"标准化转发事件不能为空",704001:"事件标识不能为空",704002:"事件类型不能为空",704003:"防区编号不能为空",704004:"数据转发端点不能为空",704005:"待发送消息ID不能为空",704006:"待发送消息不存在",704007:"发送成功的消息不允许重发",704008:"待发送消息ID列表不能为空",704009:"待发送消息关联的端点不存在",704010:"待发送消息关联的主任务不存在",704011:"数据转发任务已禁用,请先启用后再重发",704012:"数据转发任务新增请求不能为空",704013:"数据转发任务更新请求不能为空",704014:"更新时任务ID不能为空",704015:"状态更新请求不能为空",704016:"数据转发任务ID不能为空",704017:"端点ID不能为空",704018:"端点状态请求不能为空",704019:"端点配置不能为空",704020:"上报方式不能为空",704021:"平台编码不能为空",704022:"平台名称不能为空",704023:"所属防区不存在",704024:"平台编码已存在,请更换后重试",704025:"启用数据转发任务前至少需要配置一个端点",704026:"同一任务下服务地址与Topic不允许重复",704027:"启用数据转发任务时至少需要一个启用中的端点",704028:"当前仅支持MQTT转发协议",704029:"消息可靠性仅允许0、1、2",704030:"持久会话配置非法",704031:"至少需要选择一种推送数据类型",704032:"存在不支持的推送数据类型",704033:"测试连接失败: [{}]",704034:"测试发送失败: [{}]",704035:"初始化数据转发MQTT客户端失败: [{}]",704036:"刷新数据转发MQTT客户端失败: [{}]",704037:"数据转发任务不存在",704038:"数据转发任务不能为空",704039:"数据转发任务已被其他用户修改,请刷新后重试",704040:"数据转发端点不存在",704041:"当前主任务已启用,至少需要保留一个启用中的端点",704042:"接口地址不能为空",704043:"Topic不能为空",704044:"MQTT客户端标识不能为空",704045:"接口地址格式非法,请使用tcp://ip:port",704046:"接口地址中的IP非法",704047:"接口地址中的端口非法,范围为1-65535",705e3:"配置ID不能为空",705001:"系统配置信息不能为空",705002:"配置值不能为空",705003:"配置键不能为空",705004:"配置键长度不能超过[{}]个字符",705005:"配置键已存在",705006:"配置不存在",1001000001:"参数配置不存在",1001000002:"参数配置 key 重复",1001000003:"不能删除类型为系统内置的参数配置",1001000004:"获取参数配置失败,原因:不允许获取不可见配置",1001003001:"文件不存在",1001003002:"文件为空",1001003003:"不支持的图片格式",1001003004:"图片文件过大",1001003005:"无法读取图片文件",1001006e3:"文件配置不存在",1001006001:"该文件配置不允许删除,原因:它是主配置,删除会导致无法上传文件",1002e6:"账号或密码错误!",1002000001:"登录失败,账号已停用!",1002000004:"验证码不正确",1002000005:"未绑定账号,需要进行绑定",1002000007:"手机号不存在",1002000008:"验证码不正确",1002001e3:"已经存在该名字的菜单",1002001001:"父菜单不存在",1002001002:"不能设置自己为父菜单",1002001003:"菜单不存在",1002001004:"存在子菜单,无法删除",1002001005:"父菜单的类型必须是目录或者菜单",1002001006:"已经存在该组件名的菜单",1002001007:"菜单子类型非法",1002001008:"菜单同步失败",1002001009:"菜单子节点层级超过限制",1002001010:"菜单 UUID 非法",1002001011:"父菜单不符合规范",1002002e3:"角色不存在",1002002001:"角色名称重复",1002002002:"角色编码已存在",1002002003:"不能操作类型为系统内置的角色",1002002004:"角色已被禁用",1002002005:"角色标识不能使用",1002002006:"不允许删除该角色",1002003e3:"该账号已被占用,请更换!",1002003001:"输入手机号已存在!",1002003002:"输入电子邮箱已存在!",1002003003:"用户不存在",1002003004:"导入用户数据不能为空!",1002003005:"旧密码输入错误!",1002003006:"该用户已被禁用",1002003008:"创建用户失败,超过租户最大租户配额",1002003010:"该手机号尚未注册",1002003011:"注册功能已关闭",1002003012:"该用户处于开启状态,不能删除",1002003013:"地区编码错误",1002003014:"登录账号仅展示,不允许编辑",1002003015:"解析失败",1002003016:"解析失败:单次导入数据不得超过10000条,请拆分文件!",1002003017:"解析失败:导入数据不能为空!",1002003018:"上传失败:文件大小超过 10MB 上限!",1002003019:"文件解析失败:仅支持上传 .xlsx 模板文件,请检查后重试!",1002005e3:"当前岗位不存在",1002005001:"岗位不处于开启状态,不允许选择",1002005002:"已经存在该名字的岗位",1002005003:"已经存在该标识的岗位",1002006001:"当前字典类型不存在",1002006002:"字典类型不处于开启状态,不允许选择",1002006003:"字典名称已存在",1002006004:"字典编码已存在",1002006005:"无法删除!当前字典下仍存在字典值!",1002006006:"字典同步请求不合法",1002007001:"当前字典数据不存在",1002007002:"字典数据不处于开启状态,不允许选择",1002007003:"字典键值已存在",1002007004:"字典标签已存在",1002031001:"授权已过期",10021e5:"文件服务异常,请检查并测试文件配置是否正确",1086001001:"系统错误",1086001002:"请求错误",1086001003:"枚举未找到",1086001004:"参数无效",1086001005:"文件为空",1086001006:"格式错误",1086002001:"制造商代码不存在",1086002002:"设备未注册,请先注册后再试!",1086002003:"设备创建参数无效",1086002004:"机库/无人机设备已存在,请检查SN码",1086002005:"设备不存在",1086002006:"设备离线",1086002007:"创建设备型号失败",1086002008:"查询所有列表失败",1086002009:"从父代码查询列表失败",1086002010:"远程调试操作失败",1086002011:"设备未注册远程调试",1086002012:"设备离线,无法进行远程调试",1086002013:"远程调试通信超时",1086002014:"远程调试MQTT错误",1086003001:"飞机调试未知错误",1086003002:"飞机已在返航中",1086003003:"飞机已在调试模式",1086003004:"无飞行/挂载控制权限",1086003005:"机库离线",1086003006:"无人机离线",1086003007:"机库控制指令报错",1086003008:"直点飞行启动报错",1086003009:"直点飞行停止报错",1086003010:"正在执行指令飞行操作,无法执行指点飞行,请稍后重试",1086003011:"正在执行指令飞行操作,无法执行航线下发,请稍后重试",1086003012:"正在执行自动降落/返航操作,无法执行指点飞行",1086003013:"正在执行自动降落/返航操作,无法执行航线下发",1086003014:"下发空中航线报错,具体错误原因:",1086003015:"下发空中航线报错,没有对应一键起飞参数",1086003016:"飞行基础配置不存在",1086003017:"无人机无法起飞,原因是",1086003018:"获取飞行控制权失败",1086003019:"获取负载控制权失败",1086003020:"负载控制命令执行报错",1086003021:"飞行基础配置未找到",1086003022:"保存飞行基础配置失败",1086003023:"进入DRC模式失败",1086003024:"DRC摇杆控制失败",1086003025:"DRC急停失败",1086003026:"DRC紧急迫降失败",1086003027:"设备离线,无法执行DRC控制",1086003028:"DRC探照灯模式设置失败",1086003029:"DRC探照灯亮度设置失败",1086003030:"DRC探照灯角度微调失败",1086003031:"DRC探照灯校准失败",1086003032:"直播流失败原因:设备离线",1086003033:"设备拉不到流,请重试",1086003034:"直播流类型不支持",1086004001:'文件名不能包含非法字符 <>:"/',1086004002:"航线不存在",1086004003:"存在有待执行任务使用该航线,请删除任务后重试!",1086004004:"航线创建失败",1086004005:"航线文件名称已存在",1086004006:"航点数小于2",1086004007:"航点数大于50",1086004008:"航线更新失败",1086004009:"全局返航高度必须为正整数",1086004010:"全局返航高度必须在20-1500之间",1086005001:"扬声器/tts文件不存在",1086005002:"扬声器文件上传失败",1086005003:"扬声器文件保存失败",1086005004:"扬声器文件格式无效,仅支持 MP3 格式",1086005005:"扬声器文件大小超出限制,单个文件大小不得超过 5MB",1086005006:"扬声器文件名重复,该设备已存在同名文件",1086005007:"扬声器文件参数无效",1086005008:"当文件类型为 0 时,必须提供录音文件",1086005009:"当文件类型为 1 时,必须提供扬声器内容",1086005010:"喊话文件超过最大限制数",1086005011:"当前文件状态为下载或传输中,不支持切换文件播放",1086005012:"扬声器未同步到设备,请稍后重试",1086005013:"MP3格式转PCM格式失败,请重新上传MP3文件后重试",1086005014:"录音内容为空",1086005015:"媒体文件不存在",1086005016:"媒体文件删除失败",1086005017:"媒体文件下载失败",1086005018:"文件路径不能为空",1086005019:"OSS文件删除失败",1086005020:"文件压缩失败",1086006001:"http服务调用失败",1086006002:"算法服务未配置",1086006003:"请等待算法服务处理完成!",1086007001:"地图标注不存在",1086008001:"航线名称不能为空",1086008002:"计划名称已存在",1086008003:"执行时间不能早于当前时间",1086008004:"计划不存在",1086008005:"方案计划不存在可执行任务",1086008006:"飞机尚未进入航线或已退出航线,无法暂停",1086008007:"不支持的航线任务控制指令",1086008008:"航线任务不存在",1086008009:"恢复航线任务失败",1086008010:"任务状态不为执行中,暂停失败",1086008011:"任务状态不支持终止",1086008012:"取消航线任务失败",1086008013:"飞机返航失败",1086008014:"任务报告生成中,请稍后重试",1086009001:"空间名称重复",1086009002:"空间父级无效",1086009003:"检测到空间父级循环",1086009004:"空间或其子节点已绑定设备,不允许删除",1086009005:"空间层级已达到最大限制,无法继续新增",1086009006:"根节点不允许删除",1086009007:"根节点已存在,不能重复创建根节点",1086009008:"查询监控设备列表错误",1086010001:"飞行区不存在",1500000001:"初始化平台 MQTT 客户端实例异常",1500000002:"与 MQTT 代理服务器连接失败",1500000003:"MQTT 连接意外丢失",1500000004:"instanceName 不能为空",1500000005:"转发配置已存在",1500000006:"转发配置不存在",1500000008:"目标实例不可用:{}",1500000009:"请求实例 {} 与当前节点 {} 不匹配",1500000010:"请先停用转发配置再删除",1500000011:"MQTT 物理连接释放失败",1500000012:"不允许通过更新变更转发配置归属实例",1500000013:"payloadTransformScript 长度不能超过 {} 字符",1500000014:"payloadTransformScript 编译失败:{}",1500000015:"brokerUrl 格式非法,需使用 mqtt://host:port、mqtts://host:port、tcp://host:port 或 ssl://host:port",other:Z},t0=[0,200],r0={"api.accountExpired":"Your account has expired. Please log in again.","api.permissionExpiredTitle":"Permission expired","api.permissionExpiredContent":"Your account has expired. Please log in again.","api.permissionExpiredOkText":"OK","api.networkExceptionMsg":"Network connection error","api.systemException":"System error","api.noPermissionOperation":"No permission to perform this operation","api.exportFailed":"Export failed","api.tokenExpired":"Your account has expired. Please log in again."},H=(e,t,n)=>a0(n)?r0[e]??t??e:t??e,a0=e=>typeof e=="string"&&e.toLowerCase().startsWith("en"),$=e=>{var o,u,c;if(typeof e!="string")return;const t=((o=e.match(/【([^】]+)】/))==null?void 0:o[1])||((u=e.match(/\(([^)]+)\)/))==null?void 0:u[1]),n=(c=e.match(/原因[::]\s*(.+)$/))==null?void 0:c[1],i={};return t&&(i.value=t),n&&(i.reason=n),Object.keys(i).length?i:void 0},n0=(e,t)=>(n,i,o)=>{var c;const u=(c=e==null?void 0:e.translate)==null?void 0:c.call(e,n,i,o);return u&&u!==n?u:H(n,i,t)},q=(e,t,n,i)=>{var x,w;const u=`api.errMsg${String(e??"")}`,c=(x=n==null?void 0:n.translate)==null?void 0:x.call(n,u,void 0,$(t));return c&&c!==u?c:typeof t=="string"&&t||((w=n==null?void 0:n.translate)==null?void 0:w.call(n,"api.systemException","系统异常"))||H("api.systemException","系统异常",i)},i0=(e,t,n="/admin-api")=>typeof e=="function"?e(t):e??`${n}/system/auth/refresh-token?refreshToken=${t??""}`,s0=e=>typeof e=="function"?e():e??"/login",O=(e,t=t0)=>t.some(n=>String(n)===String(e)),V=(e,t="Bearer")=>typeof t=="function"?t(e):t?`${t} ${e}`:e,I=()=>typeof window<"u"&&typeof document<"u",G="http-request-sdk:authorization-expired",_=e0,L=X,W=(e={})=>{const t=n0(e.locale,e.lang);let n=!1,i=null;const o=z.create({baseURL:e.baseURL??"/admin-api",timeout:e.timeout??3e4,validateStatus:a=>a>=200&&a<300||a===400,headers:{"Content-Type":"application/json;charset=UTF-8"},...e.axiosConfig}),u=()=>{var h,y,p,l;const a=typeof e.getAccessToken=="function",r=typeof((h=e.token)==null?void 0:h.getAccessToken)=="function",s=((y=e.getAccessToken)==null?void 0:y.call(e))??((l=(p=e.token)==null?void 0:p.getAccessToken)==null?void 0:l.call(p));return console.info("[http-request-sdk][token]","access-token:resolve",{hasGetAccessToken:a,hasTokenGetAccessToken:r,hasToken:!!s,tokenLength:(s==null?void 0:s.length)??0}),s},c=(a,r)=>{console.info("[http-request-sdk][token]",a,{hasToken:!!r,tokenLength:(r==null?void 0:r.length)??0})},x=()=>{var a,r,s;return((a=e.getLocale)==null?void 0:a.call(e))??((s=(r=e.locale)==null?void 0:r.getLocale)==null?void 0:s.call(r))},w=()=>x()??e.lang,g=(a,r)=>C(a,r,w()),D=a=>{var r;(r=e.onBusinessError)==null||r.call(e,a)},E=a=>{var r;(r=e.onHttpError)==null||r.call(e,a)},k=a=>{var r,s;(s=(r=e.ui)==null?void 0:r.error)==null||s.call(r,a)},f=(a,r)=>{console.info("[http-request-sdk][permission-expired]",a,r??{})},v=()=>t("api.accountExpired","您的账号已失效,请重新登录"),T=async a=>{var y,p;const r={...a,message:v()};if(f("triggerTokenExpired:start",{code:r.code,message:r.message,hasShowPermissionExpired:!!((y=e.ui)!=null&&y.showPermissionExpired),modalVisible:n}),n){f("triggerTokenExpired:skip-visible",{code:r.code});return}const s=()=>{n=!1,f("modal:visible-reset",{code:r.code})},h=async()=>{var l,m,d,b;f("modal:onOk:start",{code:r.code,hasOnTokenExpired:!!e.onTokenExpired});try{e.onTokenExpired?await e.onTokenExpired(r):(await((m=(l=e.token)==null?void 0:l.logout)==null?void 0:m.call(l)),(b=(d=e.token)==null?void 0:d.clearToken)==null||b.call(d),I()&&(window.location.href=s0(e.loginUrl))),s(),f("modal:onOk:success",{code:r.code})}catch(M){f("modal:onOk:error",{code:r.code,error:M}),s()}};if(n=!0,f("modal:visible-set",{code:r.code}),(p=e.ui)!=null&&p.showPermissionExpired){f("modal:showPermissionExpired:call",{code:r.code}),e.ui.showPermissionExpired({title:t("api.permissionExpiredTitle","权限失效提醒"),content:r.message,okText:t("api.permissionExpiredOkText","我知道了"),onOk:h,onCancel:s});return}if(I()){f("modal:adapter-missing:native-alert",{code:r.code}),window.alert(`${t("api.permissionExpiredTitle","权限失效提醒")}
2
+
3
+ ${r.message}`),await h();return}f("modal:adapter-missing:run-onOk-without-browser",{code:r.code}),await h()},P=a=>{var r,s,h,y,p;if(a)return a.accessToken&&((s=(r=e.token)==null?void 0:r.setToken)==null||s.call(r,a.accessToken)),a.refreshToken&&((y=(h=e.token)==null?void 0:h.setRefreshToken)==null||y.call(h,a.refreshToken)),(p=e.onRefreshTokenSuccess)==null||p.call(e,a),a.loginInfo},R=async()=>{var h,y,p,l,m,d;if(e.refreshAccessToken){const b=(y=(h=e.token)==null?void 0:h.getRefreshToken)==null?void 0:y.call(h);c("refresh-token:custom-get-refresh-token",b);const M=await e.refreshAccessToken({refreshToken:b,service:o});return P(M)}const a=(l=(p=e.token)==null?void 0:p.getRefreshToken)==null?void 0:l.call(p);c("refresh-token:get-refresh-token",a);const r=await z.post(i0(e.refreshTokenUrl,a,e.baseURL??"/admin-api"),void 0,{headers:h0(e.headers)}),s=((d=(m=e.token)==null?void 0:m.normalizeRefreshResponse)==null?void 0:d.call(m,r))??o0(r);if(s.code===401||s.code===400)throw new Error(v());return P(s)},J=()=>(i||(i=R().finally(()=>{i=null})),i);o.interceptors.request.use(a=>{const r=u();c("request:get-access-token",r);const s=x();return r&&F(a,e.authHeaderName??"Authorization",V(r,e.authScheme)),s&&F(a,e.localeHeaderName??"Accept-Language",s),m0(a,e.headers),a},a=>{var r;return(r=e.onRequestError)==null||r.call(e,a),Promise.reject(a)});const K=(async a=>{var m;if(a.config.responseType==="blob")return d0(a,e,t);if(a.status!==200&&a.status!==400){const d=g((m=a.data)==null?void 0:m.code,t("api.networkExceptionMsg","网络连接异常"));return k(d),E({message:d,response:a}),Promise.reject(new Error(d))}const{code:r,msg:s,message:h,data:y}=a.data,l=s||h||t("api.systemException","系统异常");if(Number(r)===400){const d=v();return f("response:code-400:show-modal",{httpStatus:a.status,code:r,message:d,url:a.config.url}),await T({code:r,message:d,response:a}),D({code:r,message:d,response:a}),Promise.reject(new Error(d))}if(f0(a,e)){f("response:should-refresh-token",{httpStatus:a.status,code:r,message:l,url:a.config.url});const d=a.config;if(d._retry){const b=v();return f("response:retry-already-used",{code:r,url:a.config.url}),await T({code:r,message:b,response:a}),Promise.reject(new Error(b))}d._retry=!0;try{return f("refresh-token:start",{code:r,url:a.config.url}),await J(),f("refresh-token:success:retry-request",{code:r,url:a.config.url}),o.request(d)}catch(b){const M=v();return f("refresh-token:error:trigger-modal",{code:r,url:a.config.url,error:b}),await T({code:r,message:M,response:a,error:b}),Promise.reject(new Error(M))}}if(Number(r)===403){const d=g(r,t("api.noPermissionOperation","暂无操作权限"));return k(d),D({code:r,message:d,response:a}),Promise.reject(new Error(d))}if(Number(r)===510){const d={machineCode:U(y,"machineCode"),expireTime:U(y,"expireTime"),rawData:y};c0(d,a,e);return}if(Number(r)===1002031003)return D({code:r,message:l,response:a}),Promise.reject(new Error(l));if(!O(r,e.successCodes)){const d=g(r,q(r,l,e.locale,e.lang));return k(d),D({code:r,message:d,response:a}),Promise.reject(new Error(d))}return e.transformResponse?e.transformResponse(a.data):e.unwrapData?a.data.data:a.data});return o.interceptors.response.use(K,a=>{var s,h,y,p;const{response:r}=a;if(r&&((s=r.config)==null?void 0:s.responseType)==="blob"&&typeof Blob<"u"&&r.data instanceof Blob)r.data.text().then(l=>{try{const m=JSON.parse(l),d=q(m.code,m.msg||m.message,e.locale,e.lang);Number(m.code)===403?k(g(m.code,t("api.noPermissionOperation","暂无操作权限"))):k(g(m.code,d||t("api.exportFailed","导出失败"))),E({code:m.code,message:g(m.code,d||t("api.exportFailed","导出失败")),response:r,error:a})}catch{const m=t("api.exportFailed","导出失败");k(m),E({message:m,response:r,error:a})}});else if((r==null?void 0:r.status)===403){const l=g((h=r.data)==null?void 0:h.code,t("api.noPermissionOperation","暂无操作权限"));k(l),E({code:403,message:l,response:r,error:a})}else if(r){const l=g((y=r.data)==null?void 0:y.code,t("api.networkExceptionMsg","网络连接异常"));k(l),E({code:r==null?void 0:r.status,message:l,response:r,error:a})}else{const l=t("api.networkExceptionMsg","网络连接异常");k(l),E({message:l,error:a})}return(p=e.onResponseError)==null||p.call(e,a),Promise.reject(a)}),{service:o,refreshToken:R,request:{request:a=>o.request(a),get:(a,r={})=>typeof a=="string"?o.get(a,Q(r)):o.request({...a,method:"get"}),post:(a,r,s={})=>typeof a=="string"?o.post(a,r,s):o.request(N(a,"post",r,s)),put:(a,r,s={})=>typeof a=="string"?o.put(a,r,s):o.request(N(a,"put",r,s)),patch:(a,r,s={})=>typeof a=="string"?o.patch(a,r,s):o.request(N(a,"patch",r,s)),delete:(a,r={})=>typeof a=="string"?o.delete(a,Q(r)):o.request({...a,method:"delete"})}}},o0=e=>{const t=e.data.data,n=e.data;return{code:e.data.code,accessToken:(t==null?void 0:t.accessToken)??n.accessToken,refreshToken:(t==null?void 0:t.refreshToken)??n.refreshToken,loginInfo:t}},d0=async(e,t,n)=>{var u,c,x,w,g,D,E,k,f,v;const i=((u=e.headers)==null?void 0:u["content-type"])||"";if(!String(i).includes("application/json"))return e.data;const o=await e.data.text();try{const T=JSON.parse(o);if(Number(T.code)===403){const R=C(T.code,n("api.noPermissionOperation","暂无操作权限"),j(t));return(x=(c=t.ui)==null?void 0:c.error)==null||x.call(c,R),(w=t.onBusinessError)==null||w.call(t,{code:T.code,message:R,response:e}),Promise.reject(new Error(R))}if(O(T.code,t.successCodes))return e.data;const P=C(T.code,q(T.code,T.msg||T.message,t.locale,t.lang),j(t));return(D=(g=t.ui)==null?void 0:g.error)==null||D.call(g,P),(E=t.onBusinessError)==null||E.call(t,{code:T.code,message:P,response:e}),Promise.reject(new Error(P))}catch{const T=n("api.exportFailed","导出失败");return(f=(k=t.ui)==null?void 0:k.error)==null||f.call(k,T),(v=t.onHttpError)==null||v.call(t,{message:T,response:e}),Promise.reject(new Error(T))}},c0=(e,t,n)=>{var i,o,u,c,x;if((i=n.onAuthorizationExpired)==null||i.call(n,{payload:e,response:t}),l0(n)){u0(e,n);return}e.expireTime?(u=(o=n.authorization)==null?void 0:o.openExpired)==null||u.call(o,e):(x=(c=n.authorization)==null?void 0:c.open)==null||x.call(c,e)},l0=e=>{var n;if((n=e.authorization)!=null&&n.isInMicroApp)return e.authorization.isInMicroApp();if(!I())return!1;const t=window;return!!(t.__MICRO_APP_ENVIRONMENT__||t.__MICRO_APP_BASE_APPLICATION__)},u0=(e,t)=>{var o,u,c,x;if((o=t.authorization)!=null&&o.dispatchMicroAppEvent){t.authorization.dispatchMicroAppEvent(e);return}if(!I())return;const n={type:"authorization_expired",machineCode:e.machineCode,expireTime:e.expireTime},i=(u=t.authorization)==null?void 0:u.eventCenterName;if(i){const g=window[i];if(typeof(g==null?void 0:g.dispatch)=="function"){g.dispatch({myname:((c=t.authorization)==null?void 0:c.microAppName)??i,data:n});return}}window.dispatchEvent(new CustomEvent(((x=t.authorization)==null?void 0:x.eventName)??G,{detail:n}))},U=(e,t)=>{if(!e||typeof e!="object")return;const n=e;return typeof n[t]=="string"?n[t]:void 0},C=(e,t,n)=>{if(e==null||e==="")return t;const i=B(n)?L:_,o=B(n)?_:L,u=String(e);return(i[u]??o[u])||t||i.other||o.other},B=e=>typeof e=="string"&&e.toLowerCase().startsWith("en"),j=e=>{var t,n,i;return((t=e.getLocale)==null?void 0:t.call(e))??((i=(n=e.locale)==null?void 0:n.getLocale)==null?void 0:i.call(n))??e.lang},F=(e,t,n)=>{const i=e.headers;if(i&&typeof i.set=="function"){i.set(t,String(n));return}e.headers[t]=String(n)},m0=(e,t)=>{Object.entries(t??{}).forEach(([n,i])=>{i!=null&&F(e,n,i)})},h0=e=>Object.entries(e??{}).reduce((t,[n,i])=>(i==null||(t[n]=String(i)),t),{}),f0=(e,t)=>{var n;return t.shouldRefreshToken?t.shouldRefreshToken(e):Number((n=e.data)==null?void 0:n.code)===401},N=(e,t,n,i={})=>({...i,...e,method:t,data:e.data??n??i.data}),Q=e=>e?g0(e)?e:{params:e}:{},p0=new Set(["adapter","auth","baseURL","cancelToken","data","decompress","headers","httpAgent","httpsAgent","maxBodyLength","maxContentLength","method","onDownloadProgress","onUploadProgress","params","paramsSerializer","proxy","responseEncoding","responseType","signal","socketPath","timeout","timeoutErrorMessage","transformRequest","transformResponse","transitional","url","validateStatus","withCredentials","xsrfCookieName","xsrfHeaderName"]),g0=e=>!e||typeof e!="object"||typeof URLSearchParams<"u"&&e instanceof URLSearchParams?!1:Object.keys(e).some(t=>p0.has(t));let A=null;const y0=e=>{const t=W(e);return A=t,t},T0=e=>(A=e,e),S=()=>{if(!A)throw new Error("Request SDK is not initialized. Call setupRequestSdk(...) or install the Vue plugin first.");return A},x0={request:e=>S().request.request(e),get:(e,t)=>S().request.get(e,t),post:(e,t,n)=>S().request.post(e,t,n),put:(e,t,n)=>S().request.put(e,t,n),patch:(e,t,n)=>S().request.patch(e,t,n),delete:(e,t)=>S().request.delete(e,t)},k0=new Proxy({},{get(e,t){return Reflect.get(S().service,t)}});exports.AUTHORIZATION_EXPIRED_EVENT=G;exports.buildAuthHeaderValue=V;exports.createRequestSdk=W;exports.extractI18nParams=$;exports.getBizErrorMsg=q;exports.getDefaultRequestSdk=S;exports.http=k0;exports.isSuccessCode=O;exports.request=x0;exports.setDefaultRequestSdk=T0;exports.setupRequestSdk=y0;