{"_id":"larsen","_rev":"38-ed54eb6fccd70375e3e08c2836b6eff2","name":"larsen","dist-tags":{"latest":"15.8.12"},"versions":{"15.8.8":{"name":"larsen","version":"15.8.8","keywords":["larsen"],"author":{"name":"yiyun"},"_id":"larsen@15.8.8","maintainers":[{"name":"zhangyt0906","email":"zhangyt0906@icloud.com"}],"dist":{"shasum":"c65ecc48496e68598e551f02e1b241b6c33b9369","tarball":"https://registry.npmjs.org/larsen/-/larsen-15.8.8.tgz","fileCount":68,"integrity":"sha512-ybbnfnEkDhrJbX4f+eKFS1Zh0Ri8BuQ13ADJNmhsOukOobtPAhRtwpHp+xU7a/q1WWAdvsp42aCpkXNRRWT9Yw==","signatures":[{"sig":"MEYCIQD86+rURSzKKfQF5jtN1m4MaYWfl7iqDRMiIZS/CGtx9wIhAJaVh7V74uvA1CVQ+vahFtwnBKbYwsr5JN1Djgnf55mG","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":119877},"jest":{"testMatch":["<rootDir>/src/**/__tests__/**/*.ts?(x)"],"transform":{".(ts|tsx)":"ts-jest"},"setupFiles":[],"collectCoverage":true,"coverageReporters":["html","json","lcov"],"collectCoverageFrom":["src/**/*.{ts,tsx}"],"moduleFileExtensions":["ts","tsx","js"]},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"5381a02556bd4e6d7b40929110d428e15b724698","scripts":{"test":"jest","build":"./build.sh","typecheck":"node_modules/typescript/bin/tsc --noEmit"},"targets":{"main":{"source":"src/larsen_single_file.js","distDir":"dist","engines":{"node":">=20.0"},"isLibrary":true,"sourceMap":false},"types":{"source":"src/index.ts","distDir":"dist","engines":{"node":">=20.0"},"isLibrary":true,"sourceMap":false},"single":{"source":"src/larsen_single_file.js","distDir":"dist","engines":{"node":">=20.0"},"optimize":true,"isLibrary":true,"sourceMap":true}},"_npmUser":{"name":"zhangyt0906","email":"zhangyt0906@icloud.com"},"repository":{"url":"git+https://codehub.devcloud.huaweicloud.com/zce/larsen-js.git","type":"git"},"_npmVersion":"10.9.0","description":"Larsen Javascript client.","directories":{},"_nodeVersion":"22.12.0","browserslist":"defaults","dependencies":{"mqtt":"5.12.0","jtest":"^0.0.1","@swc/wasm":"^1.11.24"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","parcel":"2.14.4","ts-jest":"29.3.2","@types/ws":"8.18.1","typescript":"5.8.3","@types/jest":"29.5.14","@types/node":"22.15.3","@parcel/packager-ts":"2.14.4","@parcel/transformer-typescript-tsc":"2.14.4","@parcel/transformer-typescript-types":"2.14.4"},"_npmOperationalInternal":{"tmp":"tmp/larsen_15.8.8_1747919099673_0.16196434212535782","host":"s3://npm-registry-packages-npm-production"}},"15.8.11":{"name":"larsen","version":"15.8.11","keywords":["larsen"],"author":{"name":"yiyun"},"_id":"larsen@15.8.11","maintainers":[{"name":"zhangyt0906","email":"zhangyt0906@icloud.com"}],"dist":{"shasum":"0ca08912cce1eeb228837a652d1d76f27ad1be55","tarball":"https://registry.npmjs.org/larsen/-/larsen-15.8.11.tgz","fileCount":68,"integrity":"sha512-QDqQJoj8E30i5vnDykAXVFpiYJcf8cYkyK8XBMvFfr3hyRAAKrEwesp2IIXsJwWtNQVwPSQ5QV3V/A2XopcPdQ==","signatures":[{"sig":"MEUCIQDUDPQm31XeXnXVQYFdAIm+hswpDtaoniyCCqPKiULZRwIgPF4uyNGFe5XP6882rrcd4SjU4d2nGMCpwICNcDwN2nw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":119808},"jest":{"testMatch":["<rootDir>/src/**/__tests__/**/*.ts?(x)"],"transform":{".(ts|tsx)":"ts-jest"},"setupFiles":[],"collectCoverage":true,"coverageReporters":["html","json","lcov"],"collectCoverageFrom":["src/**/*.{ts,tsx}"],"moduleFileExtensions":["ts","tsx","js"]},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"5381a02556bd4e6d7b40929110d428e15b724698","scripts":{"test":"jest","build":"./build.sh","typecheck":"node_modules/typescript/bin/tsc --noEmit"},"targets":{"main":{"source":"src/larsen_single_file.js","distDir":"dist","engines":{"node":">=20.0"},"isLibrary":true,"sourceMap":false},"types":{"source":"src/index.ts","distDir":"dist","engines":{"node":">=20.0"},"isLibrary":true,"sourceMap":false},"single":{"source":"src/larsen_single_file.js","distDir":"dist","engines":{"node":">=20.0"},"optimize":true,"isLibrary":true,"sourceMap":true}},"_npmUser":{"name":"zhangyt0906","email":"zhangyt0906@icloud.com"},"repository":{"url":"git+https://codehub.devcloud.huaweicloud.com/zce/larsen-js.git","type":"git"},"_npmVersion":"10.9.0","description":"Larsen Javascript client.","directories":{},"_nodeVersion":"22.12.0","browserslist":"defaults","dependencies":{"mqtt":"5.12.1"},"_hasShrinkwrap":false,"devDependencies":{"parcel":"2.14.4","ts-jest":"29.3.2","@types/ws":"8.18.1","typescript":"5.8.3","@types/jest":"29.5.14","@types/node":"22.15.14","@parcel/packager-ts":"2.14.4","@parcel/transformer-typescript-tsc":"2.14.4","@parcel/transformer-typescript-types":"2.14.4"},"_npmOperationalInternal":{"tmp":"tmp/larsen_15.8.11_1752370221791_0.7573137403574504","host":"s3://npm-registry-packages-npm-production"}},"15.8.12":{"name":"larsen","version":"15.8.12","description":"Larsen Javascript client.","browserslist":"defaults","scripts":{"build":"./build.sh","typecheck":"node_modules/typescript/bin/tsc --noEmit","test":"jest"},"author":{"name":"yiyun"},"devDependencies":{"@parcel/packager-ts":"2.14.4","@parcel/transformer-typescript-tsc":"2.14.4","@parcel/transformer-typescript-types":"2.14.4","@types/jest":"29.5.14","@types/node":"22.15.14","@types/ws":"8.18.1","parcel":"2.14.4","ts-jest":"29.3.2","typescript":"5.8.3"},"main":"dist/index.js","types":"dist/index.d.ts","targets":{"main":{"isLibrary":true,"distDir":"dist","sourceMap":false,"source":"src/larsen_single_file.js","engines":{"node":">=20.0"}},"single":{"isLibrary":true,"optimize":true,"distDir":"dist","sourceMap":true,"source":"src/larsen_single_file.js","engines":{"node":">=20.0"}},"types":{"isLibrary":true,"distDir":"dist","sourceMap":false,"source":"src/index.ts","engines":{"node":">=20.0"}}},"dependencies":{"mqtt":"5.12.1"},"repository":{"type":"git","url":"git+https://codehub.devcloud.huaweicloud.com/zce/larsen-js.git"},"keywords":["larsen"],"jest":{"setupFiles":[],"transform":{".(ts|tsx)":"ts-jest"},"testMatch":["<rootDir>/src/**/__tests__/**/*.ts?(x)"],"moduleFileExtensions":["ts","tsx","js"],"collectCoverage":true,"collectCoverageFrom":["src/**/*.{ts,tsx}"],"coverageReporters":["html","json","lcov"]},"_id":"larsen@15.8.12","gitHead":"5381a02556bd4e6d7b40929110d428e15b724698","_nodeVersion":"22.12.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-ie9H8nnU5XntMZtn5kIoSFB1+rqicBp95Z88aOmmxrmBMyuKwvPaWo23v1JCBiHVgQR+ng5r7nOpnt9dELjyhw==","shasum":"9bfb67a3588d93d333596c0ba021fc5853888f95","tarball":"https://registry.npmjs.org/larsen/-/larsen-15.8.12.tgz","fileCount":68,"unpackedSize":119781,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDwTNQ/xIb0ZMpPCAmq4d0BEos3THGIJKnlPDBgW5AcNgIgaJRe1YadHg01AmIhnRMrMlquT32MWVKKFxA6eL3VUCQ="}]},"_npmUser":{"name":"zhangyt0906","email":"zhangyt0906@icloud.com"},"directories":{},"maintainers":[{"name":"zhangyt0906","email":"zhangyt0906@icloud.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/larsen_15.8.12_1752375919785_0.38712138541568564"},"_hasShrinkwrap":false}},"time":{"created":"2025-05-22T13:04:59.672Z","modified":"2025-07-13T03:05:20.148Z","1.0.0":"2018-12-15T16:40:54.807Z","1.1.0":"2018-12-17T05:31:31.484Z","2.0.0":"2019-02-21T07:22:48.281Z","2.0.1":"2019-02-25T09:55:51.818Z","2.1.1":"2019-03-08T06:42:29.927Z","2.2.2":"2019-03-08T06:50:09.122Z","2.2.3":"2019-04-18T22:51:27.535Z","2.2.4":"2019-04-19T09:42:46.044Z","2.2.6":"2019-04-20T14:23:18.819Z","3.0.0":"2019-06-03T07:52:40.585Z","3.0.1":"2019-06-17T03:12:44.332Z","3.0.2":"2019-06-23T02:05:22.482Z","3.0.3":"2019-09-02T07:56:54.220Z","3.0.4":"2019-09-02T10:29:15.270Z","3.0.6":"2019-10-15T16:19:34.005Z","3.0.7":"2020-10-16T06:17:56.163Z","3.0.8":"2020-10-16T07:43:49.560Z","15.3.0":"2022-06-28T00:12:46.840Z","5.3.0":"2022-07-02T14:56:02.915Z","15.3.1":"2022-07-06T05:06:33.975Z","15.3.3":"2022-09-12T14:04:35.574Z","15.4.1":"2023-01-20T12:06:17.545Z","15.8.1":"2025-05-01T03:58:23.197Z","15.8.7":"2025-05-20T14:38:51.161Z","15.8.8":"2025-05-22T13:04:59.866Z","15.8.11":"2025-07-13T01:30:21.959Z","15.8.12":"2025-07-13T03:05:19.966Z"},"author":{"name":"yiyun"},"keywords":["larsen"],"repository":{"type":"git","url":"git+https://codehub.devcloud.huaweicloud.com/zce/larsen-js.git"},"description":"Larsen Javascript client.","maintainers":[{"name":"zhangyt0906","email":"zhangyt0906@icloud.com"}],"readme":"[![npm](https://img.shields.io/npm/v/larsen)](https://www.npmjs.com/package/larsen?activeTab=versions)\n[![ci](https://github.com/Larsen/larsen-js/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/Larsen/larsen-js/actions?query=branch%3Amain)\n[![Coverage Status](https://coveralls.io/repos/github/Larsen/larsen-js/badge.svg?branch=main)](https://coveralls.io/github/Larsen/larsen-js?branch=main)\n\n# LarsenJS: Larsen RPC wrapper\n\n## Browser Support\n\nWorks on all _modern_ browsers that were released in the last 12 months.\n\n## NodeJS Support\n\nIndependent developers have reported success when using LarsenJS in a Node environment, but we do not test against Node based setups, nor do we (Larsen, Inc) use LarsenJS in a production Node environment. Issue reports related to NodeJS are highly appreciated.\n\n## Installation (NPM)\n\n```bash\nnpm install larsen\n```\n\n## Installation (Vanilla JS)\n\n```\n<script src=\"https://cdn.jsdelivr.net/npm/larsen@latest/dist/larsen_single_file.js\"></script>\n<script>\n  var larsen123 = new lsjs.Larsen({ token: \"foo.bar.baz\" });\n</script>\n```\n\n## Running the Test Suite (Advanced)\n\n\n```bash\nnpm run test\n```\n\n## Other Package Managers\n\nPlease raise an issue if you require support with other package managers.\n\n## Login with an API Token\n\nLogin using your API token from the [Larsen Web App](http://my.larsen.bot).\n\n[Click here for instructions on how to generate an API token.](https://developer.larsen.bot/docs/rest-api#section-generating-an-api-token)\n\n### Example:\n\n```javascript\n\nimport { Larsen } from \"larsen\";\n\nvar SUPER_SECRET_TOKEN = \"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTIzQHRlc3QuY29tIiwiaWF0IjoxNDU5MTA5NzI4LCJqdGkiOiI5MjJhNWEwZC0wYjNhLTQ3NjctOTMxOC0xZTQxYWU2MDAzNTIiLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjMwMDAvIiwiZXhwIjoxNDU5NDU1MzI4LCJtcXR0IjoibG9jYWxob3N0IiwiYm90IjoiYWE3YmIzN2YtNWJhMy00NjU0LWIyZTQtNThlZDU3NDY1MDhjIn0.KpkNGR9YH68AF3iHP48GormqXzspBJrDGm23aMFGyL_eRIN8iKzy4gw733SaJgFjmebJOqZkz3cly9P5ZpCKwlaxAyn9RvfjQgFcUK0mywWAAvKp5lHfOFLhBBGICTW1r4HcZBgY1zTzVBw4BqS4zM7Y0BAAsflYRdl4dDRG_236p9ETCj0MSYxFagfLLLq0W63943jSJtNwv_nzfqi3TTi0xASB14k5vYMzUDXrC-Z2iBdgmwAYUZUVTi2HsfzkIkRcTZGE7l-rF6lvYKIiKpYx23x_d7xGjnQb8hqbDmLDRXZJnSBY3zGY7oEURxncGBMUp4F_Yaf3ftg4Ry7CiA\";\n\nlet bot = new Larsen({ token: SUPER_SECRET_TOKEN });\n\nbot\n  .connect()\n  .then(function () {\n    return bot.moveRelative({ x: 1, y: 2, z: 3, speed: 100 });\n  });\n\n```\n\n# Sending Commands to a Larsen Object\n\n```javascript\n\nbot\n  .connect()\n  .then(function(bot){\n    console.log(\"Bot online!\");\n    return bot.emergencyStop(); // You can chain commands.\n  })\n  .then(function(bot){\n    console.log(\"Bot has stopped!\");\n  })\n  .catch(function(error) {\n    console.log(\"Something went wrong :(\");\n  });\n\n```\n\n## Basic RPC Commands\n\nCall RPC commands using the corresponding method on `bot`. All RPC commands return a promise.\n\n### Example:\n\n```javascript\n\nbot\n  .home({ axis: \"x\", speed: 800 })\n  .then(function (ack) {\n    console.log(\"X Axis is now at 0.\");\n  })\n  .catch(function (err) {\n    console.log(\"Failed to bring X axis home.\");\n  })\n\n```\n\n### Currently supported commands:\n\n[See the annotated type definitions for available methods and properties.](https://github.com/Larsen/larsen-js/blob/main/dist/larsen.d.ts)\n\n## Using Events\n\n```javascript\n  var bot = Larsen({ token: '---'});\n  bot.on(\"eventName\", function(data, eventName) {\n    console.log(\"I just got an\" + eventName + \" event!\");\n    console.log(\"This is the payload: \" + data);\n  })\n   // \"I just got an eventName event!\"\n   // \"This is the payload: any javascript object or primitive\"\n  bot.emit(\"eventName\", \"any javascript object or primitive\");\n  var eventHandlers = bot.event(\"eventName\");\n   // [function(){...}]\n```\n\n## Routine Events\n\n * `\"status\"`: Most important. When the REMOTE device state changes (eg: \"x\" goes from 0 to 100), the bot will emit this event.\n * `\"logs\"`: The bot will send logs to this channel.\n * `\"offline\"`: Connection lost. **Note: LarsenJS will try to auto-reconnect**.\n * `\"online\"`: Client is connected and subscribed to bot.\n * `\"sent\"`: Triggered when the application begins sending a message.\n * `\"sync\"`: A resource on the API has changed.\n\n## Special Events\n\n * `<random uuid>`: RPC commands have UUIDs when they leave the browser. When the bot responds to that message, LarsenJS will emit an event named after the request's UUID. Mostly for internal use.\n * `\"malformed\"`: When the bot gets a bad RPC command, it will notify you via this channel.\n * `*`: Catch all events (for debugging).\n\n# Q: Where do I report security issues?\n\nWe take security seriously and value the input of independent researchers. Please see our [responsible disclosure guidelines](https://larsen.bot/responsible-disclosure-of-security-vulnerabilities/).\n","readmeFilename":"README.md"}