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.
- package/.github/npm-version-script-esm.js +97 -0
- package/.github/workflows/beta-release.yml +1 -1
- package/.github/workflows/release.yml +1 -1
- package/dist/device.d.ts +1193 -2
- package/dist/device.d.ts.map +1 -1
- package/dist/device.js +2478 -2
- package/dist/device.js.map +1 -1
- package/dist/index.d.ts +0 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -19
- package/dist/index.js.map +1 -1
- package/dist/{test/index.test.d.ts.map → index.test.d.ts.map} +1 -1
- package/dist/{test/index.test.js → index.test.js} +1 -1
- package/dist/index.test.js.map +1 -0
- package/dist/parameter-checker.d.ts +1 -1
- package/dist/parameter-checker.d.ts.map +1 -1
- package/dist/{test/settings.test.d.ts.map → settings.test.d.ts.map} +1 -1
- package/dist/{test/settings.test.js → settings.test.js} +1 -1
- package/dist/settings.test.js.map +1 -0
- package/dist/switchbot-ble.d.ts +1 -1
- package/dist/switchbot-ble.d.ts.map +1 -1
- package/dist/switchbot-ble.js +2 -27
- package/dist/switchbot-ble.js.map +1 -1
- package/dist/switchbot-openapi.d.ts.map +1 -1
- package/dist/switchbot-openapi.js +3 -2
- package/dist/switchbot-openapi.js.map +1 -1
- package/dist/types/bledevicestatus.d.ts +16 -1
- package/dist/types/bledevicestatus.d.ts.map +1 -1
- package/dist/types/types.d.ts +0 -232
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/types.js +1 -153
- package/dist/types/types.js.map +1 -1
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/Advertising.html +4 -4
- package/docs/classes/SwitchBotBLE.html +8 -8
- package/docs/classes/SwitchBotOpenAPI.html +7 -7
- package/docs/classes/SwitchbotDevice.html +14 -11
- package/docs/classes/WoBlindTilt.html +23 -20
- package/docs/classes/WoBulb.html +21 -18
- package/docs/classes/WoCeilingLight.html +24 -21
- package/docs/classes/WoContact.html +15 -12
- package/docs/classes/WoCurtain.html +20 -17
- package/docs/classes/WoHand.html +20 -17
- package/docs/classes/WoHub2.html +15 -12
- package/docs/classes/WoHumi.html +22 -19
- package/docs/classes/WoHumi2.html +67 -0
- package/docs/classes/WoIOSensorTH.html +15 -12
- package/docs/classes/WoKeypad.html +52 -0
- package/docs/classes/WoLeak.html +53 -0
- package/docs/classes/WoPlugMiniJP.html +78 -0
- package/docs/classes/WoPlugMiniUS.html +20 -17
- package/docs/classes/WoPresence.html +15 -12
- package/docs/classes/WoRelaySwitch1.html +17 -14
- package/docs/classes/WoRelaySwitch1PM.html +17 -14
- package/docs/classes/WoRemote.html +52 -0
- package/docs/classes/WoSensorTH.html +14 -11
- package/docs/classes/WoSensorTHPlus.html +46 -0
- package/docs/classes/WoSensorTHPro.html +46 -0
- package/docs/classes/WoSensorTHProCO2.html +46 -0
- package/docs/classes/WoSmartLock.html +25 -22
- package/docs/classes/WoSmartLockPro.html +25 -22
- package/docs/classes/WoStrip.html +22 -19
- package/docs/enums/LogLevel.html +2 -2
- package/docs/enums/SwitchBotBLEModel.html +3 -2
- package/docs/enums/SwitchBotBLEModelFriendlyName.html +3 -2
- package/docs/enums/SwitchBotBLEModelName.html +3 -2
- package/docs/enums/SwitchBotModel.html +2 -2
- package/docs/hierarchy.html +1 -1
- package/docs/interfaces/AdvertisementData.html +2 -2
- package/docs/interfaces/Chars.html +2 -2
- package/docs/interfaces/ErrorObject.html +2 -2
- package/docs/interfaces/NobleTypes.html +2 -2
- package/docs/interfaces/Params.html +2 -2
- package/docs/interfaces/Rule.html +2 -2
- package/docs/interfaces/ServiceData.html +2 -2
- package/docs/interfaces/SwitchBotBLEDevice.html +2 -2
- package/docs/interfaces/WebhookDetail.html +2 -2
- package/docs/interfaces/ad.html +2 -2
- package/docs/interfaces/body.html +2 -2
- package/docs/interfaces/bodyChange.html +2 -2
- package/docs/interfaces/deleteWebhookResponse.html +2 -2
- package/docs/interfaces/device.html +2 -2
- package/docs/interfaces/deviceList.html +2 -2
- package/docs/interfaces/deviceStatus.html +2 -2
- package/docs/interfaces/deviceStatusRequest.html +2 -2
- package/docs/interfaces/deviceWebhook.html +2 -2
- package/docs/interfaces/deviceWebhookContext.html +2 -2
- package/docs/interfaces/devices.html +2 -2
- package/docs/interfaces/infraredRemoteList.html +2 -2
- package/docs/interfaces/irdevice.html +2 -2
- package/docs/interfaces/pushResponse.html +2 -2
- package/docs/interfaces/queryWebhookResponse.html +2 -2
- package/docs/interfaces/setupWebhookResponse.html +2 -2
- package/docs/interfaces/switchbot.html +2 -2
- package/docs/interfaces/updateWebhookResponse.html +2 -2
- package/docs/interfaces/webhookRequest.html +2 -2
- package/docs/modules.html +1 -1
- package/docs/types/MacAddress.html +1 -1
- package/docs/types/batteryCirculatorFan.html +1 -1
- package/docs/types/batteryCirculatorFanServiceData.html +1 -1
- package/docs/types/batteryCirculatorFanStatus.html +1 -1
- package/docs/types/batteryCirculatorFanWebhookContext.html +1 -1
- package/docs/types/blindTilt.html +1 -1
- package/docs/types/blindTiltServiceData.html +1 -1
- package/docs/types/blindTiltStatus.html +1 -1
- package/docs/types/blindTiltWebhookContext.html +1 -1
- package/docs/types/bot.html +1 -1
- package/docs/types/botServiceData.html +1 -1
- package/docs/types/botStatus.html +1 -1
- package/docs/types/botWebhookContext.html +1 -1
- package/docs/types/ceilingLight.html +1 -1
- package/docs/types/ceilingLightPro.html +1 -1
- package/docs/types/ceilingLightProServiceData.html +1 -1
- package/docs/types/ceilingLightProStatus.html +1 -1
- package/docs/types/ceilingLightProWebhookContext.html +1 -1
- package/docs/types/ceilingLightServiceData.html +1 -1
- package/docs/types/ceilingLightStatus.html +1 -1
- package/docs/types/ceilingLightWebhookContext.html +1 -1
- package/docs/types/circulatorFanStatus.html +1 -1
- package/docs/types/circulatorFanWebhookContext.html +1 -1
- package/docs/types/colorBulb.html +1 -1
- package/docs/types/colorBulbServiceData.html +1 -1
- package/docs/types/colorBulbStatus.html +1 -1
- package/docs/types/colorBulbWebhookContext.html +1 -1
- package/docs/types/contactSensor.html +1 -1
- package/docs/types/contactSensorServiceData.html +1 -1
- package/docs/types/contactSensorStatus.html +1 -1
- package/docs/types/contactSensorWebhookContext.html +1 -1
- package/docs/types/curtain.html +1 -1
- package/docs/types/curtain3.html +1 -1
- package/docs/types/curtain3ServiceData.html +1 -1
- package/docs/types/curtain3WebhookContext.html +1 -1
- package/docs/types/curtainServiceData.html +1 -1
- package/docs/types/curtainStatus.html +1 -1
- package/docs/types/curtainWebhookContext.html +1 -1
- package/docs/types/floorCleaningRobotS10.html +1 -1
- package/docs/types/floorCleaningRobotS10Status.html +1 -1
- package/docs/types/floorCleaningRobotS10WebhookContext.html +1 -1
- package/docs/types/hub2.html +1 -1
- package/docs/types/hub2ServiceData.html +1 -1
- package/docs/types/hub2Status.html +1 -1
- package/docs/types/hub2WebhookContext.html +1 -1
- package/docs/types/humidifier.html +1 -1
- package/docs/types/humidifier2ServiceData.html +1 -1
- package/docs/types/humidifier2Status.html +1 -1
- package/docs/types/humidifier2WebhookContext.html +1 -1
- package/docs/types/humidifierServiceData.html +1 -1
- package/docs/types/humidifierStatus.html +1 -1
- package/docs/types/humidifierWebhookContext.html +1 -1
- package/docs/types/indoorCam.html +1 -1
- package/docs/types/indoorCameraWebhookContext.html +1 -1
- package/docs/types/keypad.html +1 -1
- package/docs/types/keypadDetectorServiceData.html +1 -1
- package/docs/types/keypadTouch.html +1 -1
- package/docs/types/keypadTouchWebhookContext.html +1 -1
- package/docs/types/keypadWebhookContext.html +1 -1
- package/docs/types/lock.html +1 -1
- package/docs/types/lockPro.html +1 -1
- package/docs/types/lockProServiceData.html +1 -1
- package/docs/types/lockProStatus.html +1 -1
- package/docs/types/lockProWebhookContext.html +1 -1
- package/docs/types/lockServiceData.html +1 -1
- package/docs/types/lockStatus.html +1 -1
- package/docs/types/lockWebhookContext.html +1 -1
- package/docs/types/meter.html +1 -1
- package/docs/types/meterPlus.html +1 -1
- package/docs/types/meterPlusServiceData.html +1 -1
- package/docs/types/meterPlusStatus.html +1 -1
- package/docs/types/meterPlusWebhookContext.html +1 -1
- package/docs/types/meterPro.html +1 -1
- package/docs/types/meterProCO2ServiceData.html +1 -1
- package/docs/types/meterProCO2Status.html +1 -1
- package/docs/types/meterProCO2WebhookContext.html +1 -1
- package/docs/types/meterProServiceData.html +1 -1
- package/docs/types/meterProStatus.html +1 -1
- package/docs/types/meterProWebhookContext.html +1 -1
- package/docs/types/meterServiceData.html +1 -1
- package/docs/types/meterStatus.html +1 -1
- package/docs/types/meterWebhookContext.html +1 -1
- package/docs/types/motionSensor.html +1 -1
- package/docs/types/motionSensorServiceData.html +1 -1
- package/docs/types/motionSensorStatus.html +1 -1
- package/docs/types/motionSensorWebhookContext.html +1 -1
- package/docs/types/onadvertisement.html +1 -1
- package/docs/types/ondiscover.html +1 -1
- package/docs/types/outdoorMeter.html +1 -1
- package/docs/types/outdoorMeterServiceData.html +1 -1
- package/docs/types/outdoorMeterStatus.html +1 -1
- package/docs/types/outdoorMeterWebhookContext.html +1 -1
- package/docs/types/panTiltCamWebhookContext.html +1 -1
- package/docs/types/pantiltCam.html +1 -1
- package/docs/types/pantiltCam2k.html +1 -1
- package/docs/types/plug.html +1 -1
- package/docs/types/plugMini.html +1 -1
- package/docs/types/plugMiniJPServiceData.html +1 -1
- package/docs/types/plugMiniJPWebhookContext.html +1 -1
- package/docs/types/plugMiniStatus.html +1 -1
- package/docs/types/plugMiniUSServiceData.html +1 -1
- package/docs/types/plugMiniUSWebhookContext.html +1 -1
- package/docs/types/plugStatus.html +1 -1
- package/docs/types/plugWebhookContext.html +1 -1
- package/docs/types/relaySwitch1Context.html +1 -1
- package/docs/types/relaySwitch1PMContext.html +1 -1
- package/docs/types/relaySwitch1PMServiceData.html +1 -1
- package/docs/types/relaySwitch1PMStatus.html +1 -1
- package/docs/types/relaySwitch1ServiceData.html +1 -1
- package/docs/types/relaySwitch1Status.html +1 -1
- package/docs/types/remote.html +1 -1
- package/docs/types/remoteServiceData.html +1 -0
- package/docs/types/robotVacuumCleanerS1.html +1 -1
- package/docs/types/robotVacuumCleanerS1Plus.html +1 -1
- package/docs/types/robotVacuumCleanerS1PlusStatus.html +1 -1
- package/docs/types/robotVacuumCleanerS1PlusWebhookContext.html +1 -1
- package/docs/types/robotVacuumCleanerS1Status.html +1 -1
- package/docs/types/robotVacuumCleanerS1WebhookContext.html +1 -1
- package/docs/types/robotVacuumCleanerServiceData.html +1 -1
- package/docs/types/stripLight.html +1 -1
- package/docs/types/stripLightServiceData.html +1 -1
- package/docs/types/stripLightStatus.html +1 -1
- package/docs/types/stripLightWebhookContext.html +1 -1
- package/docs/types/waterLeakDetector.html +1 -1
- package/docs/types/waterLeakDetectorServiceData.html +1 -1
- package/docs/types/waterLeakDetectorStatus.html +1 -1
- package/docs/types/waterLeakDetectorWebhookContext.html +1 -1
- package/package.json +1 -1
- package/dist/advertising.d.ts +0 -44
- package/dist/advertising.d.ts.map +0 -1
- package/dist/advertising.js +0 -166
- package/dist/advertising.js.map +0 -1
- package/dist/device/woblindtilt.d.ts +0 -78
- package/dist/device/woblindtilt.d.ts.map +0 -1
- package/dist/device/woblindtilt.js +0 -181
- package/dist/device/woblindtilt.js.map +0 -1
- package/dist/device/wobulb.d.ts +0 -70
- package/dist/device/wobulb.d.ts.map +0 -1
- package/dist/device/wobulb.js +0 -136
- package/dist/device/wobulb.js.map +0 -1
- package/dist/device/woceilinglight.d.ts +0 -74
- package/dist/device/woceilinglight.d.ts.map +0 -1
- package/dist/device/woceilinglight.js +0 -161
- package/dist/device/woceilinglight.js.map +0 -1
- package/dist/device/wocontact.d.ts +0 -19
- package/dist/device/wocontact.d.ts.map +0 -1
- package/dist/device/wocontact.js +0 -48
- package/dist/device/wocontact.js.map +0 -1
- package/dist/device/wocurtain.d.ts +0 -52
- package/dist/device/wocurtain.d.ts.map +0 -1
- package/dist/device/wocurtain.js +0 -135
- package/dist/device/wocurtain.js.map +0 -1
- package/dist/device/wohand.d.ts +0 -50
- package/dist/device/wohand.d.ts.map +0 -1
- package/dist/device/wohand.js +0 -83
- package/dist/device/wohand.js.map +0 -1
- package/dist/device/wohub2.d.ts +0 -19
- package/dist/device/wohub2.d.ts.map +0 -1
- package/dist/device/wohub2.js +0 -40
- package/dist/device/wohub2.js.map +0 -1
- package/dist/device/wohumi.d.ts +0 -61
- package/dist/device/wohumi.d.ts.map +0 -1
- package/dist/device/wohumi.js +0 -114
- package/dist/device/wohumi.js.map +0 -1
- package/dist/device/wohumi2.d.ts +0 -61
- package/dist/device/wohumi2.d.ts.map +0 -1
- package/dist/device/wohumi2.js +0 -114
- package/dist/device/wohumi2.js.map +0 -1
- package/dist/device/woiosensorth.d.ts +0 -20
- package/dist/device/woiosensorth.d.ts.map +0 -1
- package/dist/device/woiosensorth.js +0 -49
- package/dist/device/woiosensorth.js.map +0 -1
- package/dist/device/wokeypad.d.ts +0 -19
- package/dist/device/wokeypad.d.ts.map +0 -1
- package/dist/device/wokeypad.js +0 -51
- package/dist/device/wokeypad.js.map +0 -1
- package/dist/device/woleak.d.ts +0 -20
- package/dist/device/woleak.d.ts.map +0 -1
- package/dist/device/woleak.js +0 -44
- package/dist/device/woleak.js.map +0 -1
- package/dist/device/woplugmini.d.ts +0 -52
- package/dist/device/woplugmini.d.ts.map +0 -1
- package/dist/device/woplugmini.js +0 -110
- package/dist/device/woplugmini.js.map +0 -1
- package/dist/device/woplugmini_jp.d.ts +0 -52
- package/dist/device/woplugmini_jp.d.ts.map +0 -1
- package/dist/device/woplugmini_jp.js +0 -110
- package/dist/device/woplugmini_jp.js.map +0 -1
- package/dist/device/wopresence.d.ts +0 -19
- package/dist/device/wopresence.d.ts.map +0 -1
- package/dist/device/wopresence.js +0 -39
- package/dist/device/wopresence.js.map +0 -1
- package/dist/device/worelayswitch1.d.ts +0 -36
- package/dist/device/worelayswitch1.d.ts.map +0 -1
- package/dist/device/worelayswitch1.js +0 -61
- package/dist/device/worelayswitch1.js.map +0 -1
- package/dist/device/worelayswitch1pm.d.ts +0 -36
- package/dist/device/worelayswitch1pm.d.ts.map +0 -1
- package/dist/device/worelayswitch1pm.js +0 -64
- package/dist/device/worelayswitch1pm.js.map +0 -1
- package/dist/device/wosensorth.d.ts +0 -13
- package/dist/device/wosensorth.d.ts.map +0 -1
- package/dist/device/wosensorth.js +0 -38
- package/dist/device/wosensorth.js.map +0 -1
- package/dist/device/wosensorthplus.d.ts +0 -13
- package/dist/device/wosensorthplus.d.ts.map +0 -1
- package/dist/device/wosensorthplus.js +0 -38
- package/dist/device/wosensorthplus.js.map +0 -1
- package/dist/device/wosensorthpro.d.ts +0 -13
- package/dist/device/wosensorthpro.d.ts.map +0 -1
- package/dist/device/wosensorthpro.js +0 -38
- package/dist/device/wosensorthpro.js.map +0 -1
- package/dist/device/wosensorthproco2.d.ts +0 -13
- package/dist/device/wosensorthproco2.d.ts.map +0 -1
- package/dist/device/wosensorthproco2.js +0 -40
- package/dist/device/wosensorthproco2.js.map +0 -1
- package/dist/device/wosmartlock.d.ts +0 -86
- package/dist/device/wosmartlock.d.ts.map +0 -1
- package/dist/device/wosmartlock.js +0 -198
- package/dist/device/wosmartlock.js.map +0 -1
- package/dist/device/wosmartlockpro.d.ts +0 -86
- package/dist/device/wosmartlockpro.d.ts.map +0 -1
- package/dist/device/wosmartlockpro.js +0 -200
- package/dist/device/wosmartlockpro.js.map +0 -1
- package/dist/device/wostrip.d.ts +0 -63
- package/dist/device/wostrip.d.ts.map +0 -1
- package/dist/device/wostrip.js +0 -131
- package/dist/device/wostrip.js.map +0 -1
- package/dist/test/advertising.test.d.ts +0 -2
- package/dist/test/advertising.test.d.ts.map +0 -1
- package/dist/test/advertising.test.js +0 -99
- package/dist/test/advertising.test.js.map +0 -1
- package/dist/test/device.test.d.ts +0 -2
- package/dist/test/device.test.d.ts.map +0 -1
- package/dist/test/device.test.js +0 -39
- package/dist/test/device.test.js.map +0 -1
- package/dist/test/index.test.js.map +0 -1
- package/dist/test/parameter-checker.test.d.ts +0 -2
- package/dist/test/parameter-checker.test.d.ts.map +0 -1
- package/dist/test/parameter-checker.test.js +0 -108
- package/dist/test/parameter-checker.test.js.map +0 -1
- package/dist/test/settings.test.js.map +0 -1
- package/dist/test/switchbot-ble.test.d.ts +0 -2
- package/dist/test/switchbot-ble.test.d.ts.map +0 -1
- package/dist/test/switchbot-ble.test.js +0 -45
- package/dist/test/switchbot-ble.test.js.map +0 -1
- package/dist/test/switchbot-openapi.test.d.ts +0 -2
- package/dist/test/switchbot-openapi.test.d.ts.map +0 -1
- package/dist/test/switchbot-openapi.test.js +0 -96
- package/dist/test/switchbot-openapi.test.js.map +0 -1
- package/dist/test/woblindtilt.test.d.ts +0 -2
- package/dist/test/woblindtilt.test.d.ts.map +0 -1
- package/dist/test/woblindtilt.test.js +0 -76
- package/dist/test/woblindtilt.test.js.map +0 -1
- package/dist/test/wobulb.test.d.ts +0 -2
- package/dist/test/wobulb.test.d.ts.map +0 -1
- package/dist/test/wobulb.test.js +0 -95
- package/dist/test/wobulb.test.js.map +0 -1
- package/dist/test/woceilinglight.test.d.ts +0 -2
- package/dist/test/woceilinglight.test.d.ts.map +0 -1
- package/dist/test/woceilinglight.test.js +0 -81
- package/dist/test/woceilinglight.test.js.map +0 -1
- package/dist/test/wocontact.test.d.ts +0 -2
- package/dist/test/wocontact.test.d.ts.map +0 -1
- package/dist/test/wocontact.test.js +0 -65
- package/dist/test/wocontact.test.js.map +0 -1
- package/dist/test/wocurtain.test.d.ts +0 -2
- package/dist/test/wocurtain.test.d.ts.map +0 -1
- package/dist/test/wocurtain.test.js +0 -75
- package/dist/test/wocurtain.test.js.map +0 -1
- package/dist/test/wohand.test.d.ts +0 -2
- package/dist/test/wohand.test.d.ts.map +0 -1
- package/dist/test/wohand.test.js +0 -56
- package/dist/test/wohand.test.js.map +0 -1
- package/dist/test/wohub2.test.d.ts +0 -2
- package/dist/test/wohub2.test.d.ts.map +0 -1
- package/dist/test/wohub2.test.js +0 -80
- package/dist/test/wohub2.test.js.map +0 -1
- package/dist/test/wohumi.test.d.ts +0 -2
- package/dist/test/wohumi.test.d.ts.map +0 -1
- package/dist/test/wohumi.test.js +0 -34
- package/dist/test/wohumi.test.js.map +0 -1
- package/dist/test/wohumi2.test.d.ts +0 -2
- package/dist/test/wohumi2.test.d.ts.map +0 -1
- package/dist/test/wohumi2.test.js +0 -34
- package/dist/test/wohumi2.test.js.map +0 -1
- package/dist/test/woiosensorth.test.d.ts +0 -2
- package/dist/test/woiosensorth.test.d.ts.map +0 -1
- package/dist/test/woiosensorth.test.js +0 -40
- package/dist/test/woiosensorth.test.js.map +0 -1
- package/dist/test/wokeypad.test.d.ts +0 -2
- package/dist/test/wokeypad.test.d.ts.map +0 -1
- package/dist/test/wokeypad.test.js +0 -46
- package/dist/test/wokeypad.test.js.map +0 -1
- package/dist/test/woleak.test.d.ts +0 -2
- package/dist/test/woleak.test.d.ts.map +0 -1
- package/dist/test/woleak.test.js +0 -52
- package/dist/test/woleak.test.js.map +0 -1
- package/dist/test/woplugmini.test.d.ts +0 -2
- package/dist/test/woplugmini.test.d.ts.map +0 -1
- package/dist/test/woplugmini.test.js +0 -91
- package/dist/test/woplugmini.test.js.map +0 -1
- package/dist/test/woplugmini_jp.test.d.ts +0 -2
- package/dist/test/woplugmini_jp.test.d.ts.map +0 -1
- package/dist/test/woplugmini_jp.test.js +0 -91
- package/dist/test/woplugmini_jp.test.js.map +0 -1
- package/dist/test/wopresence.test.d.ts +0 -2
- package/dist/test/wopresence.test.d.ts.map +0 -1
- package/dist/test/wopresence.test.js +0 -68
- package/dist/test/wopresence.test.js.map +0 -1
- package/dist/test/wosensorth.test.d.ts +0 -2
- package/dist/test/wosensorth.test.d.ts.map +0 -1
- package/dist/test/wosensorth.test.js +0 -30
- package/dist/test/wosensorth.test.js.map +0 -1
- package/dist/test/wosensorthplus.test.d.ts +0 -2
- package/dist/test/wosensorthplus.test.d.ts.map +0 -1
- package/dist/test/wosensorthplus.test.js +0 -30
- package/dist/test/wosensorthplus.test.js.map +0 -1
- package/dist/test/wosensorthpro.test.d.ts +0 -2
- package/dist/test/wosensorthpro.test.d.ts.map +0 -1
- package/dist/test/wosensorthpro.test.js +0 -30
- package/dist/test/wosensorthpro.test.js.map +0 -1
- package/dist/test/wosensorthproco2.test.d.ts +0 -2
- package/dist/test/wosensorthproco2.test.d.ts.map +0 -1
- package/dist/test/wosensorthproco2.test.js +0 -33
- package/dist/test/wosensorthproco2.test.js.map +0 -1
- package/dist/test/wosmartlock.test.d.ts +0 -2
- package/dist/test/wosmartlock.test.d.ts.map +0 -1
- package/dist/test/wosmartlock.test.js +0 -151
- package/dist/test/wosmartlock.test.js.map +0 -1
- package/dist/test/wosmartlockpro.test.d.ts +0 -2
- package/dist/test/wosmartlockpro.test.d.ts.map +0 -1
- package/dist/test/wosmartlockpro.test.js +0 -150
- package/dist/test/wosmartlockpro.test.js.map +0 -1
- package/dist/test/wostrip.test.d.ts +0 -2
- package/dist/test/wostrip.test.d.ts.map +0 -1
- package/dist/test/wostrip.test.js +0 -102
- package/dist/test/wostrip.test.js.map +0 -1
- /package/dist/{test/index.test.d.ts → index.test.d.ts} +0 -0
- /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
|
|