seamapi / seam-cli Goto Github PK
View Code? Open in Web Editor NEWCommand line interface for the Seam API
Command line interface for the Seam API
Github action that runs npm run download-openapi
and rebuilds the project on cron
Here's an example of a Github action cron that runs daily https://github.com/seamapi/roles/blob/main/.github/workflows/sync.yml
CC @kainpets
console.log cuts off objects like "properties", let's make it so it logs the entire object
the issue is it shows [Object object]
instead of fully printing some properties. We can fix this by using console.dir
It should show all the CLI built-in commands first for example it should show seam login
etc. There are lots of utility libraries to help with printing help strings e.g. https://www.npmjs.com/package/command-line-usage
Use pkg to build binaries and send to a github release. I've already verified that pkg works, so it's mainly figuring out the github package upload in an action
seam acs entrances get
then selecting an acs_entrance_id
should allow you to select from a list
There are many similar functions for this, e.g. you can already select ACS Users from a list
Sometimes I'm constructing a query and realize that I want to change something I've already set, or call a different function instead. Currently I have to control-c the whole thing, but it would be go backward. Either arrows or something like inverse select (shift+enter) would do the trick for me.
Issue:
Seems that the open api path maps are expected to be passed along with the "helper" object. Without these cli hard fails at any restful command requiring path map, throwing error.
Repro:
seam login
seam devices list
Expected:
Device List JSON result
Actual:
CLI Error: TypeError: Cannot read properties of undefined (reading 'paths')
TypeError: Cannot read properties of undefined (reading 'paths')
at getCommandOpenApiDef (/Users/badpirate/src/seam-cli/lib/get-command-open-api-def.ts:10:27)
at interactForCommandParams (/Users/badpirate/src/seam-cli/lib/interact-for-command-params.ts:29:12)
at cli (/Users/badpirate/src/seam-cli/cli.ts:136:24)
Allow selecting a fake Seam Connect instance and automatically set up the PAT
this is an example of a fake seam connect instance: https://SEED-seamconnect.fake.seam.vc/health
We should allow the user to input the server "SEED", this will let them configure demos etc.
You could do a text input after the select input to achieve this
Limit dependabot to update only minor and patch updates to all @seamapi/* dependencies that are in production
Probably should be coupled to semantic release
CC @kainpets
Web CLI does not have seam
in path, wasn't able to find elsewhere in web env.
Listing events currently requires to provide since or between param, which is kind of annoying if you quickly want to retrieve the latest event in a workspace. It would be nice to just stuff in some default value or simply fetch the last 10-20 events.
➜ seam seam
✔ Select a command: / › events
✔ Select a command: /events › list
✔ [/events/list] Parameters › [Make API Call] /events/list
/events/list
Request Params:
{}
[400]
{
error: {
type: 'invalid_input',
message: 'Must specify either since or between',
validation_errors: { _errors: [ 'Must specify either since or between' ] },
request_id: 'baf20eb5-ab0e-4824-8767-111eceece873'
},
ok: false
}
This is primarily for seam developers that always want openapi to be up to date for their CLI.
--remote-api-defs
brew install seam-cli
or something like that
👋 the github release should be technically in sync with npm release. Thanks!
relates to Homebrew/homebrew-core#164183
When creating an ACS User
When trying to change the set mode of a honeywell thermostat in the Seam HQ office, got the following error.
$ seam
✔ Select a command: / › thermostats
✔ Select a command: /thermostats › heat
✔ [/thermostats/heat] Parameters › device_id*
✔ Select a device: › 308 T6 Pro Smart
✔ [/thermostats/heat] Parameters › heating_set_point_fahrenheit
CLI Error: Error: Didn't know how to handle OpenAPI schema for property: "heating_set_point_fahrenheit"
Error: Didn't know how to handle OpenAPI schema for property: "heating_set_point_fahrenheit"
at /Users/sybohy/.nvm/versions/node/v20.11.1/lib/node_modules/seam-cli/dist/cli.cjs:17158:9
at Generator.next (<anonymous>)
at fulfilled (/Users/sybohy/.nvm/versions/node/v20.11.1/lib/node_modules/seam-cli/dist/cli.cjs:50:24)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Attempted installing per [README] instructions on Mac running latest Sonoma, and seam login
fails after entering PAT token, throwing "fetch is not defined" error:
✔ Personal Access Token: … seam_[redacted]
PAT saved! You may not begin using the CLI!
CLI Error: ReferenceError: fetch is not defined
ReferenceError: fetch is not defined
at n (/Users/badpirate/.nvm/versions/node/v16.17.0/lib/node_modules/seam-cli/node_modules/redaxios/dist/redaxios.js:1:891)
at Function.n.get (/Users/badpirate/.nvm/versions/node/v16.17.0/lib/node_modules/seam-cli/node_modules/redaxios/dist/redaxios.js:1:1380)
at /Users/badpirate/.nvm/versions/node/v16.17.0/lib/node_modules/seam-cli/dist/cli.cjs:25937:37
at Generator.next (<anonymous>)
at /Users/badpirate/.nvm/versions/node/v16.17.0/lib/node_modules/seam-cli/dist/cli.cjs:62:61
at new Promise (<anonymous>)
at __async (/Users/badpirate/.nvm/versions/node/v16.17.0/lib/node_modules/seam-cli/dist/cli.cjs:46:10)
at interactForWorkspaceId (/Users/badpirate/.nvm/versions/node/v16.17.0/lib/node_modules/seam-cli/dist/cli.cjs:25933:36)
at /Users/badpirate/.nvm/versions/node/v16.17.0/lib/node_modules/seam-cli/dist/cli.cjs:25969:9
at Generator.next (<anonymous>)
When you create a connect webview via the CLI and try to select specific accepted_providers (e.g. Yale), the selection does not go through.
Steps to reproduce:
seam
(my local version is [email protected]
)yale
➜ ~ seam
✔ Select a command: / › connect-webviews
✔ Select a command: /connect_webviews › create
✔ [/connect_webviews/create] Parameters › accepted_providers
✔ accepted_providers: ›
✔ [/connect_webviews/create] Parameters › [Make API Call] /connect_webviews/create
/connect_webviews/create
Request Params:
{ accepted_providers: [] }
[200]
{
connect_webview: {
url: 'https://connect.getseam.com/connect_webviews/view?connect_webview_id=xxx&auth_token=yyy,
status: 'pending',
workspace_id: 'zzz',
custom_metadata: {},
accepted_devices: [],
login_successful: false,
selected_provider: null,
accepted_providers: [
'august', 'avigilon_alta',
'brivo', 'schlage',
'smartthings', 'yale',
'nuki', 'salto',
'controlbyweb', 'minut',
'my_2n', 'kwikset',
'ttlock', 'noiseaware',
'igloohome', 'ecobee',
'hubitat', 'four_suites',
'dormakaba_oracode', 'lockly',
'wyze', 'google_nest'
],
any_device_allowed: false,
connect_webview_id: 'xxx',
custom_redirect_url: null,
any_provider_allowed: false,
device_selection_mode: 'none',
wait_for_device_creation: false,
custom_redirect_failure_url: null,
automatically_manage_new_devices: true,
created_at: '2024-02-05T22:29:26.432Z',
authorized_at: null
},
ok: true
}
#27 passes the api everywhere as the first arg, but functions may accept multiple args. This issue is to update the implementation to be similar to seam-connect's where a second arg, ctx
, accepts things like the api definition.
Some functions have over 2 params so we should switch to the "context helper" pattern imo with a context that contains the api, maybe the flags.
Eg interactForParams(cmd,ctx)
Originally posted by @seveibar in #27 (comment)
Repro:
On a clean environment:
npm install
Expected: Builds happy
Actual:
npm ERR! code E401
npm ERR! 401 Unauthorized - GET https://npm.pkg.github.com/download/@seamapi/types/1.63.1/a78935453802a84e228b56bf39c0e632483d079f - authentication token not provided
It should work if you uncomment this code:
seam-cli/lib/interact-for-workspace-id.ts
Line 13 in 8ca24f9
It would be super nice to prompt the user to redirect them in their browser to the connect webview url that gets generated after invoking a create command. Or at least offer to copy the url in the clipboard.
➜ ~ seam connect-webviews create
✔ [/connect_webviews/create] Parameters › [Make API Call] /connect_webviews/create
/connect_webviews/create
Request Params:
{}
[200]
{
connect_webview: {
url: 'https://connect.getseam.com/connect_webviews/view?connect_webview_id=3a966edd-9b46-41c1-a330-b899891b943e&auth_token=CjruEU1FABFwf1ZkpGEeVaUXvN94ugjpE',
status: 'pending',
A lot of packages allow you to install them by pasting a "one-liner" into the terminal with curl, something like curl https://install.seam.co | sh
. They do this by serving a shell file at the url. How can we create that shell file?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.