node-switchbot 3.4.9 → 3.5.0-beta.1

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 (439) hide show
  1. package/.github/npm-version-script-esm.js +97 -0
  2. package/.github/workflows/beta-release.yml +1 -1
  3. package/.github/workflows/release.yml +1 -1
  4. package/dist/device.d.ts +1193 -2
  5. package/dist/device.d.ts.map +1 -1
  6. package/dist/device.js +2478 -2
  7. package/dist/device.js.map +1 -1
  8. package/dist/index.d.ts +0 -19
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +0 -19
  11. package/dist/index.js.map +1 -1
  12. package/dist/{test/index.test.d.ts.map → index.test.d.ts.map} +1 -1
  13. package/dist/{test/index.test.js → index.test.js} +1 -1
  14. package/dist/index.test.js.map +1 -0
  15. package/dist/parameter-checker.d.ts +1 -1
  16. package/dist/parameter-checker.d.ts.map +1 -1
  17. package/dist/{test/settings.test.d.ts.map → settings.test.d.ts.map} +1 -1
  18. package/dist/{test/settings.test.js → settings.test.js} +1 -1
  19. package/dist/settings.test.js.map +1 -0
  20. package/dist/switchbot-ble.d.ts +1 -1
  21. package/dist/switchbot-ble.d.ts.map +1 -1
  22. package/dist/switchbot-ble.js +2 -27
  23. package/dist/switchbot-ble.js.map +1 -1
  24. package/dist/switchbot-openapi.d.ts.map +1 -1
  25. package/dist/switchbot-openapi.js +3 -2
  26. package/dist/switchbot-openapi.js.map +1 -1
  27. package/dist/types/bledevicestatus.d.ts +16 -1
  28. package/dist/types/bledevicestatus.d.ts.map +1 -1
  29. package/dist/types/types.d.ts +0 -232
  30. package/dist/types/types.d.ts.map +1 -1
  31. package/dist/types/types.js +1 -153
  32. package/dist/types/types.js.map +1 -1
  33. package/docs/assets/hierarchy.js +1 -1
  34. package/docs/assets/navigation.js +1 -1
  35. package/docs/assets/search.js +1 -1
  36. package/docs/classes/Advertising.html +4 -4
  37. package/docs/classes/SwitchBotBLE.html +8 -8
  38. package/docs/classes/SwitchBotOpenAPI.html +7 -7
  39. package/docs/classes/SwitchbotDevice.html +14 -11
  40. package/docs/classes/WoBlindTilt.html +23 -20
  41. package/docs/classes/WoBulb.html +21 -18
  42. package/docs/classes/WoCeilingLight.html +24 -21
  43. package/docs/classes/WoContact.html +15 -12
  44. package/docs/classes/WoCurtain.html +20 -17
  45. package/docs/classes/WoHand.html +20 -17
  46. package/docs/classes/WoHub2.html +15 -12
  47. package/docs/classes/WoHumi.html +22 -19
  48. package/docs/classes/WoHumi2.html +67 -0
  49. package/docs/classes/WoIOSensorTH.html +15 -12
  50. package/docs/classes/WoKeypad.html +52 -0
  51. package/docs/classes/WoLeak.html +53 -0
  52. package/docs/classes/WoPlugMiniJP.html +78 -0
  53. package/docs/classes/WoPlugMiniUS.html +20 -17
  54. package/docs/classes/WoPresence.html +15 -12
  55. package/docs/classes/WoRelaySwitch1.html +17 -14
  56. package/docs/classes/WoRelaySwitch1PM.html +17 -14
  57. package/docs/classes/WoRemote.html +52 -0
  58. package/docs/classes/WoSensorTH.html +14 -11
  59. package/docs/classes/WoSensorTHPlus.html +46 -0
  60. package/docs/classes/WoSensorTHPro.html +46 -0
  61. package/docs/classes/WoSensorTHProCO2.html +46 -0
  62. package/docs/classes/WoSmartLock.html +25 -22
  63. package/docs/classes/WoSmartLockPro.html +25 -22
  64. package/docs/classes/WoStrip.html +22 -19
  65. package/docs/enums/LogLevel.html +2 -2
  66. package/docs/enums/SwitchBotBLEModel.html +3 -2
  67. package/docs/enums/SwitchBotBLEModelFriendlyName.html +3 -2
  68. package/docs/enums/SwitchBotBLEModelName.html +3 -2
  69. package/docs/enums/SwitchBotModel.html +2 -2
  70. package/docs/hierarchy.html +1 -1
  71. package/docs/interfaces/AdvertisementData.html +2 -2
  72. package/docs/interfaces/Chars.html +2 -2
  73. package/docs/interfaces/ErrorObject.html +2 -2
  74. package/docs/interfaces/NobleTypes.html +2 -2
  75. package/docs/interfaces/Params.html +2 -2
  76. package/docs/interfaces/Rule.html +2 -2
  77. package/docs/interfaces/ServiceData.html +2 -2
  78. package/docs/interfaces/SwitchBotBLEDevice.html +2 -2
  79. package/docs/interfaces/WebhookDetail.html +2 -2
  80. package/docs/interfaces/ad.html +2 -2
  81. package/docs/interfaces/body.html +2 -2
  82. package/docs/interfaces/bodyChange.html +2 -2
  83. package/docs/interfaces/deleteWebhookResponse.html +2 -2
  84. package/docs/interfaces/device.html +2 -2
  85. package/docs/interfaces/deviceList.html +2 -2
  86. package/docs/interfaces/deviceStatus.html +2 -2
  87. package/docs/interfaces/deviceStatusRequest.html +2 -2
  88. package/docs/interfaces/deviceWebhook.html +2 -2
  89. package/docs/interfaces/deviceWebhookContext.html +2 -2
  90. package/docs/interfaces/devices.html +2 -2
  91. package/docs/interfaces/infraredRemoteList.html +2 -2
  92. package/docs/interfaces/irdevice.html +2 -2
  93. package/docs/interfaces/pushResponse.html +2 -2
  94. package/docs/interfaces/queryWebhookResponse.html +2 -2
  95. package/docs/interfaces/setupWebhookResponse.html +2 -2
  96. package/docs/interfaces/switchbot.html +2 -2
  97. package/docs/interfaces/updateWebhookResponse.html +2 -2
  98. package/docs/interfaces/webhookRequest.html +2 -2
  99. package/docs/modules.html +1 -1
  100. package/docs/types/MacAddress.html +1 -1
  101. package/docs/types/batteryCirculatorFan.html +1 -1
  102. package/docs/types/batteryCirculatorFanServiceData.html +1 -1
  103. package/docs/types/batteryCirculatorFanStatus.html +1 -1
  104. package/docs/types/batteryCirculatorFanWebhookContext.html +1 -1
  105. package/docs/types/blindTilt.html +1 -1
  106. package/docs/types/blindTiltServiceData.html +1 -1
  107. package/docs/types/blindTiltStatus.html +1 -1
  108. package/docs/types/blindTiltWebhookContext.html +1 -1
  109. package/docs/types/bot.html +1 -1
  110. package/docs/types/botServiceData.html +1 -1
  111. package/docs/types/botStatus.html +1 -1
  112. package/docs/types/botWebhookContext.html +1 -1
  113. package/docs/types/ceilingLight.html +1 -1
  114. package/docs/types/ceilingLightPro.html +1 -1
  115. package/docs/types/ceilingLightProServiceData.html +1 -1
  116. package/docs/types/ceilingLightProStatus.html +1 -1
  117. package/docs/types/ceilingLightProWebhookContext.html +1 -1
  118. package/docs/types/ceilingLightServiceData.html +1 -1
  119. package/docs/types/ceilingLightStatus.html +1 -1
  120. package/docs/types/ceilingLightWebhookContext.html +1 -1
  121. package/docs/types/circulatorFanStatus.html +1 -1
  122. package/docs/types/circulatorFanWebhookContext.html +1 -1
  123. package/docs/types/colorBulb.html +1 -1
  124. package/docs/types/colorBulbServiceData.html +1 -1
  125. package/docs/types/colorBulbStatus.html +1 -1
  126. package/docs/types/colorBulbWebhookContext.html +1 -1
  127. package/docs/types/contactSensor.html +1 -1
  128. package/docs/types/contactSensorServiceData.html +1 -1
  129. package/docs/types/contactSensorStatus.html +1 -1
  130. package/docs/types/contactSensorWebhookContext.html +1 -1
  131. package/docs/types/curtain.html +1 -1
  132. package/docs/types/curtain3.html +1 -1
  133. package/docs/types/curtain3ServiceData.html +1 -1
  134. package/docs/types/curtain3WebhookContext.html +1 -1
  135. package/docs/types/curtainServiceData.html +1 -1
  136. package/docs/types/curtainStatus.html +1 -1
  137. package/docs/types/curtainWebhookContext.html +1 -1
  138. package/docs/types/floorCleaningRobotS10.html +1 -1
  139. package/docs/types/floorCleaningRobotS10Status.html +1 -1
  140. package/docs/types/floorCleaningRobotS10WebhookContext.html +1 -1
  141. package/docs/types/hub2.html +1 -1
  142. package/docs/types/hub2ServiceData.html +1 -1
  143. package/docs/types/hub2Status.html +1 -1
  144. package/docs/types/hub2WebhookContext.html +1 -1
  145. package/docs/types/humidifier.html +1 -1
  146. package/docs/types/humidifier2ServiceData.html +1 -1
  147. package/docs/types/humidifier2Status.html +1 -1
  148. package/docs/types/humidifier2WebhookContext.html +1 -1
  149. package/docs/types/humidifierServiceData.html +1 -1
  150. package/docs/types/humidifierStatus.html +1 -1
  151. package/docs/types/humidifierWebhookContext.html +1 -1
  152. package/docs/types/indoorCam.html +1 -1
  153. package/docs/types/indoorCameraWebhookContext.html +1 -1
  154. package/docs/types/keypad.html +1 -1
  155. package/docs/types/keypadDetectorServiceData.html +1 -1
  156. package/docs/types/keypadTouch.html +1 -1
  157. package/docs/types/keypadTouchWebhookContext.html +1 -1
  158. package/docs/types/keypadWebhookContext.html +1 -1
  159. package/docs/types/lock.html +1 -1
  160. package/docs/types/lockPro.html +1 -1
  161. package/docs/types/lockProServiceData.html +1 -1
  162. package/docs/types/lockProStatus.html +1 -1
  163. package/docs/types/lockProWebhookContext.html +1 -1
  164. package/docs/types/lockServiceData.html +1 -1
  165. package/docs/types/lockStatus.html +1 -1
  166. package/docs/types/lockWebhookContext.html +1 -1
  167. package/docs/types/meter.html +1 -1
  168. package/docs/types/meterPlus.html +1 -1
  169. package/docs/types/meterPlusServiceData.html +1 -1
  170. package/docs/types/meterPlusStatus.html +1 -1
  171. package/docs/types/meterPlusWebhookContext.html +1 -1
  172. package/docs/types/meterPro.html +1 -1
  173. package/docs/types/meterProCO2ServiceData.html +1 -1
  174. package/docs/types/meterProCO2Status.html +1 -1
  175. package/docs/types/meterProCO2WebhookContext.html +1 -1
  176. package/docs/types/meterProServiceData.html +1 -1
  177. package/docs/types/meterProStatus.html +1 -1
  178. package/docs/types/meterProWebhookContext.html +1 -1
  179. package/docs/types/meterServiceData.html +1 -1
  180. package/docs/types/meterStatus.html +1 -1
  181. package/docs/types/meterWebhookContext.html +1 -1
  182. package/docs/types/motionSensor.html +1 -1
  183. package/docs/types/motionSensorServiceData.html +1 -1
  184. package/docs/types/motionSensorStatus.html +1 -1
  185. package/docs/types/motionSensorWebhookContext.html +1 -1
  186. package/docs/types/onadvertisement.html +1 -1
  187. package/docs/types/ondiscover.html +1 -1
  188. package/docs/types/outdoorMeter.html +1 -1
  189. package/docs/types/outdoorMeterServiceData.html +1 -1
  190. package/docs/types/outdoorMeterStatus.html +1 -1
  191. package/docs/types/outdoorMeterWebhookContext.html +1 -1
  192. package/docs/types/panTiltCamWebhookContext.html +1 -1
  193. package/docs/types/pantiltCam.html +1 -1
  194. package/docs/types/pantiltCam2k.html +1 -1
  195. package/docs/types/plug.html +1 -1
  196. package/docs/types/plugMini.html +1 -1
  197. package/docs/types/plugMiniJPServiceData.html +1 -1
  198. package/docs/types/plugMiniJPWebhookContext.html +1 -1
  199. package/docs/types/plugMiniStatus.html +1 -1
  200. package/docs/types/plugMiniUSServiceData.html +1 -1
  201. package/docs/types/plugMiniUSWebhookContext.html +1 -1
  202. package/docs/types/plugStatus.html +1 -1
  203. package/docs/types/plugWebhookContext.html +1 -1
  204. package/docs/types/relaySwitch1Context.html +1 -1
  205. package/docs/types/relaySwitch1PMContext.html +1 -1
  206. package/docs/types/relaySwitch1PMServiceData.html +1 -1
  207. package/docs/types/relaySwitch1PMStatus.html +1 -1
  208. package/docs/types/relaySwitch1ServiceData.html +1 -1
  209. package/docs/types/relaySwitch1Status.html +1 -1
  210. package/docs/types/remote.html +1 -1
  211. package/docs/types/remoteServiceData.html +1 -0
  212. package/docs/types/robotVacuumCleanerS1.html +1 -1
  213. package/docs/types/robotVacuumCleanerS1Plus.html +1 -1
  214. package/docs/types/robotVacuumCleanerS1PlusStatus.html +1 -1
  215. package/docs/types/robotVacuumCleanerS1PlusWebhookContext.html +1 -1
  216. package/docs/types/robotVacuumCleanerS1Status.html +1 -1
  217. package/docs/types/robotVacuumCleanerS1WebhookContext.html +1 -1
  218. package/docs/types/robotVacuumCleanerServiceData.html +1 -1
  219. package/docs/types/stripLight.html +1 -1
  220. package/docs/types/stripLightServiceData.html +1 -1
  221. package/docs/types/stripLightStatus.html +1 -1
  222. package/docs/types/stripLightWebhookContext.html +1 -1
  223. package/docs/types/waterLeakDetector.html +1 -1
  224. package/docs/types/waterLeakDetectorServiceData.html +1 -1
  225. package/docs/types/waterLeakDetectorStatus.html +1 -1
  226. package/docs/types/waterLeakDetectorWebhookContext.html +1 -1
  227. package/package.json +1 -1
  228. package/dist/advertising.d.ts +0 -44
  229. package/dist/advertising.d.ts.map +0 -1
  230. package/dist/advertising.js +0 -166
  231. package/dist/advertising.js.map +0 -1
  232. package/dist/device/woblindtilt.d.ts +0 -78
  233. package/dist/device/woblindtilt.d.ts.map +0 -1
  234. package/dist/device/woblindtilt.js +0 -181
  235. package/dist/device/woblindtilt.js.map +0 -1
  236. package/dist/device/wobulb.d.ts +0 -70
  237. package/dist/device/wobulb.d.ts.map +0 -1
  238. package/dist/device/wobulb.js +0 -136
  239. package/dist/device/wobulb.js.map +0 -1
  240. package/dist/device/woceilinglight.d.ts +0 -74
  241. package/dist/device/woceilinglight.d.ts.map +0 -1
  242. package/dist/device/woceilinglight.js +0 -161
  243. package/dist/device/woceilinglight.js.map +0 -1
  244. package/dist/device/wocontact.d.ts +0 -19
  245. package/dist/device/wocontact.d.ts.map +0 -1
  246. package/dist/device/wocontact.js +0 -48
  247. package/dist/device/wocontact.js.map +0 -1
  248. package/dist/device/wocurtain.d.ts +0 -52
  249. package/dist/device/wocurtain.d.ts.map +0 -1
  250. package/dist/device/wocurtain.js +0 -135
  251. package/dist/device/wocurtain.js.map +0 -1
  252. package/dist/device/wohand.d.ts +0 -50
  253. package/dist/device/wohand.d.ts.map +0 -1
  254. package/dist/device/wohand.js +0 -83
  255. package/dist/device/wohand.js.map +0 -1
  256. package/dist/device/wohub2.d.ts +0 -19
  257. package/dist/device/wohub2.d.ts.map +0 -1
  258. package/dist/device/wohub2.js +0 -40
  259. package/dist/device/wohub2.js.map +0 -1
  260. package/dist/device/wohumi.d.ts +0 -61
  261. package/dist/device/wohumi.d.ts.map +0 -1
  262. package/dist/device/wohumi.js +0 -114
  263. package/dist/device/wohumi.js.map +0 -1
  264. package/dist/device/wohumi2.d.ts +0 -61
  265. package/dist/device/wohumi2.d.ts.map +0 -1
  266. package/dist/device/wohumi2.js +0 -114
  267. package/dist/device/wohumi2.js.map +0 -1
  268. package/dist/device/woiosensorth.d.ts +0 -20
  269. package/dist/device/woiosensorth.d.ts.map +0 -1
  270. package/dist/device/woiosensorth.js +0 -49
  271. package/dist/device/woiosensorth.js.map +0 -1
  272. package/dist/device/wokeypad.d.ts +0 -19
  273. package/dist/device/wokeypad.d.ts.map +0 -1
  274. package/dist/device/wokeypad.js +0 -51
  275. package/dist/device/wokeypad.js.map +0 -1
  276. package/dist/device/woleak.d.ts +0 -20
  277. package/dist/device/woleak.d.ts.map +0 -1
  278. package/dist/device/woleak.js +0 -44
  279. package/dist/device/woleak.js.map +0 -1
  280. package/dist/device/woplugmini.d.ts +0 -52
  281. package/dist/device/woplugmini.d.ts.map +0 -1
  282. package/dist/device/woplugmini.js +0 -110
  283. package/dist/device/woplugmini.js.map +0 -1
  284. package/dist/device/woplugmini_jp.d.ts +0 -52
  285. package/dist/device/woplugmini_jp.d.ts.map +0 -1
  286. package/dist/device/woplugmini_jp.js +0 -110
  287. package/dist/device/woplugmini_jp.js.map +0 -1
  288. package/dist/device/wopresence.d.ts +0 -19
  289. package/dist/device/wopresence.d.ts.map +0 -1
  290. package/dist/device/wopresence.js +0 -39
  291. package/dist/device/wopresence.js.map +0 -1
  292. package/dist/device/worelayswitch1.d.ts +0 -36
  293. package/dist/device/worelayswitch1.d.ts.map +0 -1
  294. package/dist/device/worelayswitch1.js +0 -61
  295. package/dist/device/worelayswitch1.js.map +0 -1
  296. package/dist/device/worelayswitch1pm.d.ts +0 -36
  297. package/dist/device/worelayswitch1pm.d.ts.map +0 -1
  298. package/dist/device/worelayswitch1pm.js +0 -64
  299. package/dist/device/worelayswitch1pm.js.map +0 -1
  300. package/dist/device/wosensorth.d.ts +0 -13
  301. package/dist/device/wosensorth.d.ts.map +0 -1
  302. package/dist/device/wosensorth.js +0 -38
  303. package/dist/device/wosensorth.js.map +0 -1
  304. package/dist/device/wosensorthplus.d.ts +0 -13
  305. package/dist/device/wosensorthplus.d.ts.map +0 -1
  306. package/dist/device/wosensorthplus.js +0 -38
  307. package/dist/device/wosensorthplus.js.map +0 -1
  308. package/dist/device/wosensorthpro.d.ts +0 -13
  309. package/dist/device/wosensorthpro.d.ts.map +0 -1
  310. package/dist/device/wosensorthpro.js +0 -38
  311. package/dist/device/wosensorthpro.js.map +0 -1
  312. package/dist/device/wosensorthproco2.d.ts +0 -13
  313. package/dist/device/wosensorthproco2.d.ts.map +0 -1
  314. package/dist/device/wosensorthproco2.js +0 -40
  315. package/dist/device/wosensorthproco2.js.map +0 -1
  316. package/dist/device/wosmartlock.d.ts +0 -86
  317. package/dist/device/wosmartlock.d.ts.map +0 -1
  318. package/dist/device/wosmartlock.js +0 -198
  319. package/dist/device/wosmartlock.js.map +0 -1
  320. package/dist/device/wosmartlockpro.d.ts +0 -86
  321. package/dist/device/wosmartlockpro.d.ts.map +0 -1
  322. package/dist/device/wosmartlockpro.js +0 -200
  323. package/dist/device/wosmartlockpro.js.map +0 -1
  324. package/dist/device/wostrip.d.ts +0 -63
  325. package/dist/device/wostrip.d.ts.map +0 -1
  326. package/dist/device/wostrip.js +0 -131
  327. package/dist/device/wostrip.js.map +0 -1
  328. package/dist/test/advertising.test.d.ts +0 -2
  329. package/dist/test/advertising.test.d.ts.map +0 -1
  330. package/dist/test/advertising.test.js +0 -99
  331. package/dist/test/advertising.test.js.map +0 -1
  332. package/dist/test/device.test.d.ts +0 -2
  333. package/dist/test/device.test.d.ts.map +0 -1
  334. package/dist/test/device.test.js +0 -39
  335. package/dist/test/device.test.js.map +0 -1
  336. package/dist/test/index.test.js.map +0 -1
  337. package/dist/test/parameter-checker.test.d.ts +0 -2
  338. package/dist/test/parameter-checker.test.d.ts.map +0 -1
  339. package/dist/test/parameter-checker.test.js +0 -108
  340. package/dist/test/parameter-checker.test.js.map +0 -1
  341. package/dist/test/settings.test.js.map +0 -1
  342. package/dist/test/switchbot-ble.test.d.ts +0 -2
  343. package/dist/test/switchbot-ble.test.d.ts.map +0 -1
  344. package/dist/test/switchbot-ble.test.js +0 -45
  345. package/dist/test/switchbot-ble.test.js.map +0 -1
  346. package/dist/test/switchbot-openapi.test.d.ts +0 -2
  347. package/dist/test/switchbot-openapi.test.d.ts.map +0 -1
  348. package/dist/test/switchbot-openapi.test.js +0 -96
  349. package/dist/test/switchbot-openapi.test.js.map +0 -1
  350. package/dist/test/woblindtilt.test.d.ts +0 -2
  351. package/dist/test/woblindtilt.test.d.ts.map +0 -1
  352. package/dist/test/woblindtilt.test.js +0 -76
  353. package/dist/test/woblindtilt.test.js.map +0 -1
  354. package/dist/test/wobulb.test.d.ts +0 -2
  355. package/dist/test/wobulb.test.d.ts.map +0 -1
  356. package/dist/test/wobulb.test.js +0 -95
  357. package/dist/test/wobulb.test.js.map +0 -1
  358. package/dist/test/woceilinglight.test.d.ts +0 -2
  359. package/dist/test/woceilinglight.test.d.ts.map +0 -1
  360. package/dist/test/woceilinglight.test.js +0 -81
  361. package/dist/test/woceilinglight.test.js.map +0 -1
  362. package/dist/test/wocontact.test.d.ts +0 -2
  363. package/dist/test/wocontact.test.d.ts.map +0 -1
  364. package/dist/test/wocontact.test.js +0 -65
  365. package/dist/test/wocontact.test.js.map +0 -1
  366. package/dist/test/wocurtain.test.d.ts +0 -2
  367. package/dist/test/wocurtain.test.d.ts.map +0 -1
  368. package/dist/test/wocurtain.test.js +0 -75
  369. package/dist/test/wocurtain.test.js.map +0 -1
  370. package/dist/test/wohand.test.d.ts +0 -2
  371. package/dist/test/wohand.test.d.ts.map +0 -1
  372. package/dist/test/wohand.test.js +0 -56
  373. package/dist/test/wohand.test.js.map +0 -1
  374. package/dist/test/wohub2.test.d.ts +0 -2
  375. package/dist/test/wohub2.test.d.ts.map +0 -1
  376. package/dist/test/wohub2.test.js +0 -80
  377. package/dist/test/wohub2.test.js.map +0 -1
  378. package/dist/test/wohumi.test.d.ts +0 -2
  379. package/dist/test/wohumi.test.d.ts.map +0 -1
  380. package/dist/test/wohumi.test.js +0 -34
  381. package/dist/test/wohumi.test.js.map +0 -1
  382. package/dist/test/wohumi2.test.d.ts +0 -2
  383. package/dist/test/wohumi2.test.d.ts.map +0 -1
  384. package/dist/test/wohumi2.test.js +0 -34
  385. package/dist/test/wohumi2.test.js.map +0 -1
  386. package/dist/test/woiosensorth.test.d.ts +0 -2
  387. package/dist/test/woiosensorth.test.d.ts.map +0 -1
  388. package/dist/test/woiosensorth.test.js +0 -40
  389. package/dist/test/woiosensorth.test.js.map +0 -1
  390. package/dist/test/wokeypad.test.d.ts +0 -2
  391. package/dist/test/wokeypad.test.d.ts.map +0 -1
  392. package/dist/test/wokeypad.test.js +0 -46
  393. package/dist/test/wokeypad.test.js.map +0 -1
  394. package/dist/test/woleak.test.d.ts +0 -2
  395. package/dist/test/woleak.test.d.ts.map +0 -1
  396. package/dist/test/woleak.test.js +0 -52
  397. package/dist/test/woleak.test.js.map +0 -1
  398. package/dist/test/woplugmini.test.d.ts +0 -2
  399. package/dist/test/woplugmini.test.d.ts.map +0 -1
  400. package/dist/test/woplugmini.test.js +0 -91
  401. package/dist/test/woplugmini.test.js.map +0 -1
  402. package/dist/test/woplugmini_jp.test.d.ts +0 -2
  403. package/dist/test/woplugmini_jp.test.d.ts.map +0 -1
  404. package/dist/test/woplugmini_jp.test.js +0 -91
  405. package/dist/test/woplugmini_jp.test.js.map +0 -1
  406. package/dist/test/wopresence.test.d.ts +0 -2
  407. package/dist/test/wopresence.test.d.ts.map +0 -1
  408. package/dist/test/wopresence.test.js +0 -68
  409. package/dist/test/wopresence.test.js.map +0 -1
  410. package/dist/test/wosensorth.test.d.ts +0 -2
  411. package/dist/test/wosensorth.test.d.ts.map +0 -1
  412. package/dist/test/wosensorth.test.js +0 -30
  413. package/dist/test/wosensorth.test.js.map +0 -1
  414. package/dist/test/wosensorthplus.test.d.ts +0 -2
  415. package/dist/test/wosensorthplus.test.d.ts.map +0 -1
  416. package/dist/test/wosensorthplus.test.js +0 -30
  417. package/dist/test/wosensorthplus.test.js.map +0 -1
  418. package/dist/test/wosensorthpro.test.d.ts +0 -2
  419. package/dist/test/wosensorthpro.test.d.ts.map +0 -1
  420. package/dist/test/wosensorthpro.test.js +0 -30
  421. package/dist/test/wosensorthpro.test.js.map +0 -1
  422. package/dist/test/wosensorthproco2.test.d.ts +0 -2
  423. package/dist/test/wosensorthproco2.test.d.ts.map +0 -1
  424. package/dist/test/wosensorthproco2.test.js +0 -33
  425. package/dist/test/wosensorthproco2.test.js.map +0 -1
  426. package/dist/test/wosmartlock.test.d.ts +0 -2
  427. package/dist/test/wosmartlock.test.d.ts.map +0 -1
  428. package/dist/test/wosmartlock.test.js +0 -151
  429. package/dist/test/wosmartlock.test.js.map +0 -1
  430. package/dist/test/wosmartlockpro.test.d.ts +0 -2
  431. package/dist/test/wosmartlockpro.test.d.ts.map +0 -1
  432. package/dist/test/wosmartlockpro.test.js +0 -150
  433. package/dist/test/wosmartlockpro.test.js.map +0 -1
  434. package/dist/test/wostrip.test.d.ts +0 -2
  435. package/dist/test/wostrip.test.d.ts.map +0 -1
  436. package/dist/test/wostrip.test.js +0 -102
  437. package/dist/test/wostrip.test.js.map +0 -1
  438. /package/dist/{test/index.test.d.ts → index.test.d.ts} +0 -0
  439. /package/dist/{test/settings.test.d.ts → settings.test.d.ts} +0 -0
@@ -0,0 +1,97 @@
1
+ #!/bin/env node
2
+
3
+ /**
4
+ * This scripts queries the npm registry to pull out the latest version for a given tag.
5
+ */
6
+
7
+ import assert from 'node:assert'
8
+ import child_process from 'node:child_process'
9
+ import fs from 'node:fs'
10
+ import process from 'node:process'
11
+
12
+ const BRANCH_VERSION_PATTERN = /^([A-Z]+)-(\d+\.\d+\.\d+)$/i
13
+
14
+ // Load the contents of the package.json file
15
+ const packageJSON = JSON.parse(fs.readFileSync('package.json', 'utf8'))
16
+
17
+ const refArgument = process.argv[2]
18
+ const tagArgument = process.argv[3] || 'latest'
19
+
20
+ if (!refArgument) {
21
+ console.error('ref argument is missing')
22
+ console.error('Usage: npm-version-script-esm.js <ref> [tag]')
23
+ process.exit(1)
24
+ }
25
+
26
+ /**
27
+ * Queries the NPM registry for the latest version for the provided base version and tag.
28
+ * If the tag is latest, then the base version is returned if it exists. For other tags, the latest
29
+ * version found for that base version and tag is returned.
30
+ * @param baseVersion The base version to query for, e.g. 2.0.0
31
+ * @param tag The tag to query for, e.g. beta or latest
32
+ * @returns {string} Returns the version, or '' if not found
33
+ */
34
+ function getTagVersionFromNpm(baseVersion, tag) {
35
+ try {
36
+ return JSON.parse(child_process.execSync(`npm info ${packageJSON.name} versions --json`).toString('utf8').trim())
37
+ .filter(v => tag === 'latest' ? v === baseVersion : v.startsWith(`${baseVersion}-${tag}.`)) // find all published versions for this base version and tag
38
+ .reduce((_, current) => current, '') // choose the last as they're sorted in ascending order, or '' if there are none
39
+ } catch (e) {
40
+ console.error(`Failed to query the npm registry for the latest version for tag: ${tag}`, e)
41
+ // throw e;
42
+ return ''
43
+ }
44
+ }
45
+
46
+ function desiredTargetVersion(ref) {
47
+ // ref is a GitHub action ref string
48
+ if (ref.startsWith('refs/pull/')) {
49
+ throw new Error('The version script was executed inside a PR!')
50
+ }
51
+
52
+ assert(ref.startsWith('refs/heads/'))
53
+ const branchName = ref.slice('refs/heads/'.length)
54
+
55
+ const results = branchName.match(BRANCH_VERSION_PATTERN)
56
+ if (results !== null) {
57
+ if (results[1] !== tagArgument) {
58
+ console.warn(`The base branch name (${results[1]}) differs from the tag name ${tagArgument}`)
59
+ }
60
+
61
+ return results[2]
62
+ }
63
+
64
+ throw new Error(`Malformed branch name for ref: ${ref}. Can't derive the base version. Use a branch name like: beta-x.x.x or alpha-x.x.x`)
65
+ }
66
+
67
+ // derive the base version from the branch ref
68
+ const baseVersion = desiredTargetVersion(refArgument)
69
+
70
+ // query the npm registry for the latest version of the provided tag name
71
+ const latestReleasedVersion = getTagVersionFromNpm(baseVersion, tagArgument) // e.g. 0.7.0-beta.12
72
+
73
+ let publishTag
74
+
75
+ if (latestReleasedVersion) {
76
+ console.warn(`Latest published version for ${baseVersion} with tag ${tagArgument} is ${latestReleasedVersion}`)
77
+ publishTag = latestReleasedVersion // set this released beta or alpha to be incremented
78
+ } else {
79
+ console.warn(`No published versions for ${baseVersion} with tag ${tagArgument}`)
80
+ publishTag = baseVersion // start off with a new beta or alpha version
81
+ }
82
+
83
+ if (packageJSON.version !== publishTag) {
84
+ // report the change for CI
85
+ console.warn(`Changing version in package.json from ${packageJSON.version} to ${publishTag}`)
86
+
87
+ // save the package.json
88
+ packageJSON.version = publishTag
89
+ fs.writeFileSync('package.json', JSON.stringify(packageJSON, null, 2))
90
+
91
+ // perform the same change to the package-lock.json
92
+ const packageLockJSON = JSON.parse(fs.readFileSync('package-lock.json', 'utf8'))
93
+ packageLockJSON.version = publishTag
94
+ fs.writeFileSync('package-lock.json', JSON.stringify(packageLockJSON, null, 2))
95
+ } else {
96
+ console.warn(`Leaving version in package.json at ${packageJSON.version}`)
97
+ }
@@ -22,7 +22,7 @@ jobs:
22
22
  if: ${{ github.repository == 'OpenWonderLabs/node-switchbot' }}
23
23
  permissions:
24
24
  id-token: write
25
- uses: OpenWonderLabs/.github/.github/workflows/npm-publish.yml@latest
25
+ uses: OpenWonderLabs/.github/.github/workflows/npm-publish-esm.yml@latest
26
26
  with:
27
27
  tag: 'beta'
28
28
  dynamically_adjust_version: true
@@ -17,7 +17,7 @@ jobs:
17
17
  if: ${{ github.repository == 'OpenWonderLabs/node-switchbot' }}
18
18
  permissions:
19
19
  id-token: write
20
- uses: OpenWonderLabs/.github/.github/workflows/npm-publish.yml@latest
20
+ uses: OpenWonderLabs/.github/.github/workflows/npm-publish-esm.yml@latest
21
21
  secrets:
22
22
  npm_auth_token: ${{ secrets.npm_token }}
23
23