@dompling/trollscript-types 1.0.53 → 1.0.54

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.
Files changed (2) hide show
  1. package/index.d.ts +37 -69
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -164,7 +164,7 @@ interface Icloud {
164
164
  * @param path 目录路径,默认为根目录
165
165
  * @returns 文件名列表数组
166
166
  */
167
- list(path: string): any;
167
+ list(path?: string): any;
168
168
 
169
169
  }
170
170
 
@@ -330,42 +330,42 @@ interface Http {
330
330
  * @param options 请求选项 { headers, timeout }
331
331
  * @returns 包含状态码、响应数据、响应头的对象
332
332
  */
333
- get(url: string, options: Record<string, any>): any;
333
+ get(url: string, options?: Record<string, any>): any;
334
334
 
335
335
  /**
336
336
  * 发送 POST 请求
337
337
  * @param url 请求地址
338
338
  * @param options 请求选项 { body, headers, timeout }
339
339
  */
340
- post(url: string, options: Record<string, any>): any;
340
+ post(url: string, options?: Record<string, any>): any;
341
341
 
342
342
  /**
343
343
  * 发送 PUT 请求
344
344
  * @param url 请求地址
345
345
  * @param options 请求选项 { body, headers, timeout }
346
346
  */
347
- put(url: string, options: Record<string, any>): any;
347
+ put(url: string, options?: Record<string, any>): any;
348
348
 
349
349
  /**
350
350
  * 发送 DELETE 请求
351
351
  * @param url 请求地址
352
352
  * @param options 请求选项 { headers, timeout }
353
353
  */
354
- delete(url: string, options: Record<string, any>): any;
354
+ delete(url: string, options?: Record<string, any>): any;
355
355
 
356
356
  /**
357
357
  * 发送 PATCH 请求
358
358
  * @param url 请求地址
359
359
  * @param options 请求选项 { body, headers, timeout }
360
360
  */
361
- patch(url: string, options: Record<string, any>): any;
361
+ patch(url: string, options?: Record<string, any>): any;
362
362
 
363
363
  /**
364
364
  * 发送 HEAD 请求
365
365
  * @param url 请求地址
366
366
  * @param options 请求选项 { headers, timeout }
367
367
  */
368
- head(url: string, options: Record<string, any>): any;
368
+ head(url: string, options?: Record<string, any>): any;
369
369
 
370
370
  /**
371
371
  * 发送自定义请求
@@ -405,12 +405,6 @@ interface Network {
405
405
  */
406
406
  getIPAddress(): any;
407
407
 
408
- /**
409
- * 获取 WiFi 信息
410
- * @returns 包含 SSID 和 BSSID 的对象
411
- */
412
- getWiFiInfo(): any;
413
-
414
408
  /**
415
409
  * URL 编码
416
410
  * @param string 要编码的字符串
@@ -438,7 +432,7 @@ interface Network {
438
432
  * @param params 查询参数
439
433
  * @returns 构建的 URL 字符串
440
434
  */
441
- buildURL(baseURL: string, params: Record<string, any>): string;
435
+ buildURL(baseURL: string, params?: Record<string, any>): string;
442
436
 
443
437
  /**
444
438
  * Ping 主机
@@ -453,20 +447,7 @@ interface Network {
453
447
  * @param filename 保存文件名
454
448
  * @returns 包含本地文件路径的对象
455
449
  */
456
- download(url: string, filename: string): any;
457
-
458
- /**
459
- * 获取飞行模式状态
460
- * @returns 是否开启
461
- */
462
- getAirplaneMode(): boolean;
463
-
464
- /**
465
- * 设置飞行模式
466
- * @param enabled 是否开启
467
- * @returns 是否设置成功
468
- */
469
- setAirplaneMode(enabled: boolean): boolean;
450
+ download(url: string, filename?: string): any;
470
451
 
471
452
  /**
472
453
  * 列出 VPN 配置
@@ -479,7 +460,7 @@ interface Network {
479
460
  * @param name VPN 名称,默认第一个
480
461
  * @returns 是否发起连接成功
481
462
  */
482
- connectVPN(name: string): boolean;
463
+ connectVPN(name?: string): boolean;
483
464
 
484
465
  /**
485
466
  * 断开 VPN
@@ -493,25 +474,12 @@ interface Network {
493
474
  */
494
475
  getVPNStatus(): any;
495
476
 
496
- /**
497
- * 获取 WiFi 开关状态
498
- * @returns 是否开启
499
- */
500
- getWiFiEnabled(): boolean;
501
-
502
- /**
503
- * 设置 WiFi 开关
504
- * @param enabled 是否开启
505
- * @returns 是否设置成功
506
- */
507
- setWiFi(enabled: boolean): boolean;
508
-
509
477
  /**
510
478
  * 打开系统设置
511
479
  * @param section 设置页面(如 'WIFI')
512
480
  * @returns 是否成功打开
513
481
  */
514
- openSettings(section: string): boolean;
482
+ openSettings(section?: string): boolean;
515
483
 
516
484
  }
517
485
 
@@ -566,7 +534,7 @@ interface App {
566
534
  * @param limit 返回的日志条数
567
535
  * @returns 日志对象数组
568
536
  */
569
- getLogs(limit: number): any;
537
+ getLogs(limit?: number): any;
570
538
 
571
539
  /**
572
540
  * 导出日志为字符串
@@ -595,7 +563,7 @@ interface App {
595
563
  * 退出应用(仅用于调试)
596
564
  * @param code 退出码,默认为 0
597
565
  */
598
- exit(code: number): void;
566
+ exit(code?: number): void;
599
567
 
600
568
  /**
601
569
  * 打开应用设置页面
@@ -653,7 +621,7 @@ interface Haptic {
653
621
  * 触觉冲击反馈
654
622
  * @param style 'light' | 'medium' | 'heavy' | 'soft' | 'rigid'
655
623
  */
656
- impact(style: string): void;
624
+ impact(style?: string): void;
657
625
 
658
626
  /**
659
627
  * 通知触觉反馈
@@ -722,13 +690,13 @@ interface Display {
722
690
  * 增加亮度
723
691
  * @param amount 增加量 (默认 0.1)
724
692
  */
725
- increaseBrightness(amount: number): void;
693
+ increaseBrightness(amount?: number): void;
726
694
 
727
695
  /**
728
696
  * 降低亮度
729
697
  * @param amount 减少量 (默认 0.1)
730
698
  */
731
- decreaseBrightness(amount: number): void;
699
+ decreaseBrightness(amount?: number): void;
732
700
 
733
701
  /**
734
702
  * 获取屏幕信息
@@ -878,7 +846,7 @@ interface Location {
878
846
  * @param locale 语言区域标识(可选,如 'zh_CN'、'en_US',默认使用系统语言)
879
847
  * @returns 地址信息对象数组
880
848
  */
881
- reverseGeocode(lat: number, lng: number, locale: string): any;
849
+ reverseGeocode(lat: number, lng: number, locale?: string): any;
882
850
 
883
851
  /**
884
852
  * 定位服务是否开启
@@ -940,7 +908,7 @@ interface Calendar {
940
908
  * @param calendarId 日历 ID
941
909
  * @returns 事件数组
942
910
  */
943
- getEvents(start: number, end: number, calendarId: string): any;
911
+ getEvents(start: number, end: number, calendarId?: string): any;
944
912
 
945
913
  /**
946
914
  * 创建日历事件
@@ -950,7 +918,7 @@ interface Calendar {
950
918
  * @param options 选项 { calendarId, notes, location, url, allDay }
951
919
  * @returns 创建的事件 ID
952
920
  */
953
- create(title: string, start: number, end: number, options: Record<string, any>): any;
921
+ create(title: string, start: number, end: number, options?: Record<string, any>): any;
954
922
 
955
923
  /**
956
924
  * 删除日历事件
@@ -987,7 +955,7 @@ interface Reminder {
987
955
  * @param listId 列表 ID
988
956
  * @returns 提醒事项数组
989
957
  */
990
- getAll(listId: string): any;
958
+ getAll(listId?: string): any;
991
959
 
992
960
  /**
993
961
  * 创建提醒事项
@@ -995,7 +963,7 @@ interface Reminder {
995
963
  * @param options 选项 { listId, notes, dueDate, priority, sortOrder, isPinned }
996
964
  * @returns 创建的提醒 ID
997
965
  */
998
- create(title: string, options: Record<string, any>): any;
966
+ create(title: string, options?: Record<string, any>): any;
999
967
 
1000
968
  /**
1001
969
  * 标记为已完成
@@ -1016,14 +984,14 @@ interface Reminder {
1016
984
  * @param options { sortBy: 'createdAt'|'dueDate'|'priority'|'title', ascending: boolean, completed: boolean }
1017
985
  * @returns 排序后的提醒列表
1018
986
  */
1019
- getSorted(options: Record<string, any>): any;
987
+ getSorted(options?: Record<string, any>): any;
1020
988
 
1021
989
  /**
1022
990
  * 获取即将到期的提醒
1023
991
  * @param days 未来几天,默认 7 天
1024
992
  * @returns 即将到期的提醒列表
1025
993
  */
1026
- getUpcoming(days: number): any;
994
+ getUpcoming(days?: number): any;
1027
995
 
1028
996
  /**
1029
997
  * 获取已过期的提醒
@@ -1044,7 +1012,7 @@ interface Reminder {
1044
1012
  * @param options { listId, notes, dueDate, priority, location: { latitude, longitude, radius, onArrive, name } }
1045
1013
  * @returns { success: boolean, id: string, title: string, isSystemReminder: true }
1046
1014
  */
1047
- createSystemReminder(title: string, options: Record<string, any>): any;
1015
+ createSystemReminder(title: string, options?: Record<string, any>): any;
1048
1016
 
1049
1017
  /**
1050
1018
  * 获取系统提醒列表
@@ -1081,7 +1049,7 @@ interface Contacts {
1081
1049
  * @param limit 返回的最大数量,默认全部
1082
1050
  * @returns 联系人对象数组
1083
1051
  */
1084
- getAll(offset: number, limit: number): any;
1052
+ getAll(offset?: number, limit?: number): any;
1085
1053
 
1086
1054
  /**
1087
1055
  * 获取联系人总数
@@ -1164,7 +1132,7 @@ interface Notification {
1164
1132
  * @param options 选项 { url, userInfo, sound, badge }
1165
1133
  * @returns 发送的通知 ID
1166
1134
  */
1167
- send(title: string, body: string, options: Record<string, any>): any;
1135
+ send(title: string, body: string, options?: Record<string, any>): any;
1168
1136
 
1169
1137
  /**
1170
1138
  * 取消通知
@@ -1228,7 +1196,7 @@ interface Notification {
1228
1196
  * @param options 选项 { url, userInfo, sound, badge, repeat: 'daily'|'weekly'|'monthly' }
1229
1197
  * @returns 发送的通知 ID
1230
1198
  */
1231
- schedule(title: string, body: string, date: number, options: Record<string, any>): any;
1199
+ schedule(title: string, body: string, date: number, options?: Record<string, any>): any;
1232
1200
 
1233
1201
  }
1234
1202
 
@@ -1252,14 +1220,14 @@ interface Sms {
1252
1220
  * @param limit 限制条数 (默认 10)
1253
1221
  * @returns 短信对象数组
1254
1222
  */
1255
- read(limit: number): any;
1223
+ read(limit?: number): any;
1256
1224
 
1257
1225
  /**
1258
1226
  * 获取验证码
1259
1227
  * @param minutes 查找最近几分钟内的验证码 (默认 5)
1260
1228
  * @returns 验证码或 null
1261
1229
  */
1262
- getVerificationCode(minutes: number): any;
1230
+ getVerificationCode(minutes?: number): any;
1263
1231
 
1264
1232
  /**
1265
1233
  * 搜索短信
@@ -1311,7 +1279,7 @@ interface Sql {
1311
1279
  * @param params 参数列表
1312
1280
  * @returns 查询结果数组
1313
1281
  */
1314
- query(dbPath: string, sql: string, params: any[]): any[];
1282
+ query(dbPath: string, sql: string, params?: any[]): any[];
1315
1283
 
1316
1284
  /**
1317
1285
  * 执行 INSERT/UPDATE/DELETE
@@ -1320,7 +1288,7 @@ interface Sql {
1320
1288
  * @param params 参数列表
1321
1289
  * @returns 执行结果对象
1322
1290
  */
1323
- execute(dbPath: string, sql: string, params: any[]): any;
1291
+ execute(dbPath: string, sql: string, params?: any[]): any;
1324
1292
 
1325
1293
  /**
1326
1294
  * 列出数据库中的所有表
@@ -1348,7 +1316,7 @@ interface Shortcuts {
1348
1316
  * @param input 输入文本(可选)
1349
1317
  * @returns 是否成功打开快捷指令
1350
1318
  */
1351
- run(name: string, input: string): boolean;
1319
+ run(name: string, input?: string): boolean;
1352
1320
 
1353
1321
  /**
1354
1322
  * 运行快捷指令(带 x-callback-url 回调)
@@ -1356,7 +1324,7 @@ interface Shortcuts {
1356
1324
  * @param input 输入文本(可选)
1357
1325
  * @returns 是否成功打开快捷指令
1358
1326
  */
1359
- runWithCallback(name: string, input: string): boolean;
1327
+ runWithCallback(name: string, input?: string): boolean;
1360
1328
 
1361
1329
  /**
1362
1330
  * 打开快捷指令 App
@@ -1473,7 +1441,7 @@ interface System {
1473
1441
  * @param category 音量类别: 'System', 'Ringer', 'Media',默认 'Media'
1474
1442
  * @returns 当前音量 (0.0 - 1.0)
1475
1443
  */
1476
- getVolume(category: string): number;
1444
+ getVolume(category?: string): number;
1477
1445
 
1478
1446
  /**
1479
1447
  * 设置系统音量
@@ -1481,7 +1449,7 @@ interface System {
1481
1449
  * @param category 音量类别: 'System', 'Ringer', 'Media',默认 'Media'
1482
1450
  * @returns 是否设置成功
1483
1451
  */
1484
- setVolume(level: number, category: string): boolean;
1452
+ setVolume(level: number, category?: string): boolean;
1485
1453
 
1486
1454
  /**
1487
1455
  * 检查设备是否有闪光灯
@@ -1501,7 +1469,7 @@ interface System {
1501
1469
  * @param level 亮度级别 (0.0 - 1.0),默认 1.0
1502
1470
  * @returns 是否设置成功
1503
1471
  */
1504
- setFlashlight(enabled: boolean, level: number): boolean;
1472
+ setFlashlight(enabled: boolean, level?: number): boolean;
1505
1473
 
1506
1474
  /**
1507
1475
  * 检查方向锁定是否开启
@@ -1560,7 +1528,7 @@ interface System {
1560
1528
  * @param section 设置页面: 'WIFI', 'BLUETOOTH', 'CELLULAR', 'VPN', 'GENERAL', 'DISPLAY', 'SOUND', 'NOTIFICATION', 'PRIVACY', 'BATTERY', 'STORAGE', 'WALLPAPER', 'SIRI', 'ACCESSIBILITY', 'DND', 'SCREEN_TIME', 'PASSWORDS'
1561
1529
  * @returns 是否成功打开
1562
1530
  */
1563
- openSettings(section: string): boolean;
1531
+ openSettings(section?: string): boolean;
1564
1532
 
1565
1533
  }
1566
1534
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dompling/trollscript-types",
3
- "version": "1.0.53",
3
+ "version": "1.0.54",
4
4
  "description": "TypeScript definitions for TrollScript",
5
5
  "main": "",
6
6
  "types": "index.d.ts",