@revenexx/cli 0.0.7 → 0.0.8

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 (75) hide show
  1. package/README.md +93 -84
  2. package/dist/bundle-win-arm64.mjs +64601 -57035
  3. package/dist/cli.cjs +64625 -57059
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/index.cjs +1243 -61
  6. package/dist/index.js +1243 -61
  7. package/dist/lib/client.d.ts +57 -1
  8. package/dist/lib/client.d.ts.map +1 -1
  9. package/dist/lib/command-picker.d.ts +17 -0
  10. package/dist/lib/command-picker.d.ts.map +1 -0
  11. package/dist/lib/commands/create/appsdk-core.d.ts +143 -0
  12. package/dist/lib/commands/create/appsdk-core.d.ts.map +1 -0
  13. package/dist/lib/commands/create/scaffold-app.d.ts +24 -0
  14. package/dist/lib/commands/create/scaffold-app.d.ts.map +1 -0
  15. package/dist/lib/commands/create/scaffold-theme.d.ts +22 -0
  16. package/dist/lib/commands/create/scaffold-theme.d.ts.map +1 -0
  17. package/dist/lib/commands/create.d.ts +3 -0
  18. package/dist/lib/commands/create.d.ts.map +1 -0
  19. package/dist/lib/commands/deploy.d.ts +3 -0
  20. package/dist/lib/commands/deploy.d.ts.map +1 -0
  21. package/dist/lib/commands/generic.d.ts +32 -1
  22. package/dist/lib/commands/generic.d.ts.map +1 -1
  23. package/dist/lib/commands/services/apps.d.ts.map +1 -1
  24. package/dist/lib/commands/services/avatars.d.ts.map +1 -1
  25. package/dist/lib/commands/services/carts.d.ts.map +1 -1
  26. package/dist/lib/commands/services/channels.d.ts.map +1 -1
  27. package/dist/lib/commands/services/customers.d.ts.map +1 -1
  28. package/dist/lib/commands/services/forms.d.ts.map +1 -1
  29. package/dist/lib/commands/services/greetings.d.ts.map +1 -1
  30. package/dist/lib/commands/services/inventories.d.ts.map +1 -1
  31. package/dist/lib/commands/services/locale.d.ts.map +1 -1
  32. package/dist/lib/commands/services/markets.d.ts.map +1 -1
  33. package/dist/lib/commands/services/messaging.d.ts.map +1 -1
  34. package/dist/lib/commands/services/orderlists.d.ts.map +1 -1
  35. package/dist/lib/commands/services/orders.d.ts.map +1 -1
  36. package/dist/lib/commands/services/pages.d.ts.map +1 -1
  37. package/dist/lib/commands/services/payments.d.ts.map +1 -1
  38. package/dist/lib/commands/services/prices.d.ts.map +1 -1
  39. package/dist/lib/commands/services/products.d.ts.map +1 -1
  40. package/dist/lib/commands/services/search.d.ts.map +1 -1
  41. package/dist/lib/commands/services/settings.d.ts.map +1 -1
  42. package/dist/lib/commands/services/shipping.d.ts.map +1 -1
  43. package/dist/lib/commands/services/sites.d.ts.map +1 -1
  44. package/dist/lib/commands/services/storage.d.ts.map +1 -1
  45. package/dist/lib/commands/services/tokens.d.ts.map +1 -1
  46. package/dist/lib/commands/tenants.d.ts.map +1 -1
  47. package/dist/lib/commands/update.d.ts.map +1 -1
  48. package/dist/lib/config.d.ts +21 -0
  49. package/dist/lib/config.d.ts.map +1 -1
  50. package/dist/lib/constants.d.ts +7 -3
  51. package/dist/lib/constants.d.ts.map +1 -1
  52. package/dist/lib/interactive.d.ts +68 -0
  53. package/dist/lib/interactive.d.ts.map +1 -0
  54. package/dist/lib/oauth.d.ts +97 -0
  55. package/dist/lib/oauth.d.ts.map +1 -0
  56. package/dist/lib/parser.d.ts +13 -6
  57. package/dist/lib/parser.d.ts.map +1 -1
  58. package/dist/lib/redact.d.ts +12 -0
  59. package/dist/lib/redact.d.ts.map +1 -0
  60. package/dist/lib/sdks.d.ts.map +1 -1
  61. package/dist/lib/spinner.d.ts +9 -1
  62. package/dist/lib/spinner.d.ts.map +1 -1
  63. package/dist/lib/types.d.ts +10 -2
  64. package/dist/lib/types.d.ts.map +1 -1
  65. package/dist/tests/client-transport.test.d.ts +2 -0
  66. package/dist/tests/client-transport.test.d.ts.map +1 -0
  67. package/dist/tests/command-picker.test.d.ts +2 -0
  68. package/dist/tests/command-picker.test.d.ts.map +1 -0
  69. package/dist/tests/endpoint.test.d.ts +2 -0
  70. package/dist/tests/endpoint.test.d.ts.map +1 -0
  71. package/dist/tests/interactive.test.d.ts +2 -0
  72. package/dist/tests/interactive.test.d.ts.map +1 -0
  73. package/dist/tests/oauth.test.d.ts +2 -0
  74. package/dist/tests/oauth.test.d.ts.map +1 -0
  75. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  > **This repository is auto-generated by the [Revenexx SDK Generator](https://github.com/revenexx/sdk-generator). Do not submit changes directly — they will be overwritten on the next generation run.**
2
2
 
3
- # Revenexx API — revenexx Revenexx CLI SDK
3
+ # Revenexx CLI SDK
4
4
 
5
5
  ![License](https://img.shields.io/github/license/revenexx-sdks/cli.svg?style=flat-square)
6
6
  ![Version](https://img.shields.io/badge/api%20version-1.0.0-blue.svg?style=flat-square)
@@ -9,11 +9,11 @@
9
9
 
10
10
  Revenexx command-line interface for managing your platform.
11
11
 
12
- ![Revenexx API — revenexx](https://revenexx.com/images/logo.svg)
12
+ ![Revenexx](https://revenexx.com/images/logo.svg)
13
13
 
14
14
  ## Installation
15
15
 
16
- The Revenexx API — revenexx CLI is a Node based command line tool to help you interact with the Revenexx API — revenexx API. The CLI is distributed both as an [`npm package`](https://www.npmjs.com/package/@revenexx/cli) as well as [pre built binaries](https://github.com/revenexx-sdks/cli/releases/latest) for specific operating systems and architectures.
16
+ The Revenexx CLI is a Node based command line tool to help you interact with the Revenexx API. The CLI is distributed both as an [`npm package`](https://www.npmjs.com/package/@revenexx/cli) as well as [pre built binaries](https://github.com/revenexx-sdks/cli/releases/latest) for specific operating systems and architectures.
17
17
 
18
18
  ### Install using NPM
19
19
  ---
@@ -28,7 +28,7 @@ Once the installation is complete, you can verify the install using
28
28
 
29
29
  ```sh
30
30
  $ revenexx -v
31
- 0.0.7
31
+ 0.0.8
32
32
  ```
33
33
 
34
34
  ### Install using prebuilt binaries
@@ -62,115 +62,114 @@ $ scoop install https://raw.githubusercontent.com/revenexx-sdks/cli/master/scoop
62
62
  Once the installation completes, you can verify your install using
63
63
  ```
64
64
  $ revenexx -v
65
- 0.0.7
65
+ 0.0.8
66
66
  ```
67
67
 
68
68
  ## Getting Started
69
69
 
70
- Before you can use the CLI, you need to login to your Revenexx account.
70
+ ### 1. Sign in
71
+
72
+ Authenticate once — the CLI stores your session under `~/.revenexx/`.
71
73
 
72
74
  ```sh
75
+ # Developers: interactive SSO sign-in via the browser (Zitadel)
73
76
  $ revenexx login
74
77
 
75
- ? Enter your email test@test.com
76
- ? Enter your password ********
77
- ✓ Success
78
+ # CI / scripts: a gateway API key
79
+ $ revenexx login --token <token> --tenant <tenant>
78
80
  ```
79
- This will also prompt you to enter your Revenexx endpoint ( default: https://revenexx.com/v1 )
80
81
 
81
- * ### Initialising your project
82
- Once logged in, the CLI needs to be initialised before you can use it with your Revenexx project. You can do this with the `revenexx init project` command.
82
+ Confirm who you're signed in as at any time:
83
83
 
84
84
  ```sh
85
- $ revenexx init project
85
+ $ revenexx whoami
86
86
  ```
87
87
 
88
- The following prompt will guide you through the setup process. The `init` command also creates a `revenexx.json` file representing your Revenexx project.
88
+ See the [Authentication](#authentication) section below for the full login, credential-resolution, and sign-out details.
89
89
 
90
- The `revenexx.json` file does a lot of things.
91
- * Provides context to the CLI
92
- * Keeps track of all your cloud functions
93
- * Keeps track of all your project's collections
94
- * Helps you deploy your Revenexx project to production and more..
90
+ ### 2. Choose a tenant
91
+
92
+ Every request is scoped to a tenant. Set the active one once and the CLI remembers it:
95
93
 
96
- You can also fetch all the collections in your current project using
97
94
  ```sh
98
- revenexx init collection
95
+ $ revenexx tenants use <slug>
96
+ $ revenexx tenants current
99
97
  ```
100
98
 
101
- * ### Creating and deploying cloud functions
99
+ ### 3. Run a command
102
100
 
103
- The CLI makes it extremely easy to create and deploy Revenexx's cloud functions. Initialise your new function using
101
+ Each API service is exposed as a command, and every method as a subcommand. Discover them with `--help`:
104
102
 
105
- ```
106
- $ revenexx init function
107
- ? What would you like to name your function? My Awesome Function
108
- ? What runtime would you like to use? Node.js (node-15.5)
109
- ✓ Success
103
+ ```sh
104
+ $ revenexx --help # list every service
105
+ $ revenexx <service> --help # list a service's methods
106
+ $ revenexx <service> <method> --help # show a method's flags
110
107
  ```
111
108
 
112
- This will create a new function `My Awesome Function` in your current Revenexx project and also create a template function for you to get started.
109
+ For example, to list products:
113
110
 
114
111
  ```sh
115
- $ tree My\ Awesome\ Function
116
-
117
- My Awesome Function
118
- ├── README.md
119
- ├── index.js
120
- ├── package-lock.json
121
- └── package.json
122
-
123
- 0 directories, 4 files
112
+ $ revenexx products products-list
124
113
  ```
125
114
 
126
- You can now deploy this function using
115
+ Ready-to-copy examples for every command are generated under [`docs/examples/`](docs/examples).
127
116
 
128
- ```sh
129
- $ revenexx push function
117
+ > ### Note
118
+ > By default, requests to domains with self-signed SSL certificates (or no certificates) are rejected. If you trust the host, you can bypass certificate validation using
119
+ > ```sh
120
+ > $ revenexx client --self-signed true
121
+ > ```
130
122
 
131
- ? Which functions would you like to deploy? My Awesome Function (61d1a4c81dfcd95bc834)
132
- ℹ Info Deploying function My Awesome Function ( 61d1a4c81dfcd95bc834 )
133
- ✓ Success Deployed My Awesome Function ( 61d1a4c81dfcd95bc834 )
134
- ```
123
+ ## Authentication
135
124
 
136
- Your function has now been deployed on your Revenexx server! As soon as the build process is finished, you can start executing the function.
125
+ The CLI supports two ways to authenticate:
137
126
 
138
- * ### Deploying Collections
127
+ - **Gateway API key** — non-interactive, ideal for CI and scripts. Sent as `X-Revenexx-Api-Key`.
128
+ - **Zitadel SSO** — interactive browser sign-in for developers, using OAuth2 Authorization Code + PKCE. Mints a JWT that the CLI sends in the standard `Authorization: Bearer` header.
139
129
 
140
- Similarly, you can deploy all your collections to your Revenexx server using
130
+ An API key always takes precedence; SSO is the fallback when no key is present (or when you force it with `--browser`).
141
131
 
142
- ```sh
143
- revenexx push collection
144
- ```
132
+ ### Interactive SSO login
145
133
 
146
- > ### Note
147
- > By default, requests to domains with self signed SSL certificates (or no certificates) are disabled. If you trust the domain, you can bypass the certificate validation using
148
134
  ```sh
149
- $ revenexx client --selfSigned true
135
+ # Sign in with the browser (used automatically when no API key is configured):
136
+ $ revenexx login
137
+
138
+ # Force SSO even if an API key is present (alias: --sso):
139
+ $ revenexx login --browser
150
140
  ```
151
141
 
152
- ## Authentication
142
+ This opens your browser to sign in with Zitadel, captures the response on a local loopback callback (a fixed port — `8000` by default; free it if `login` reports it's in use), exchanges it for a JWT, and stores the JWT (plus a refresh token) in `~/.revenexx/prefs.json`. Expired JWTs are refreshed automatically; if the refresh fails you're prompted to `login` again. Once signed in, commands authenticate with the JWT in the `Authorization: Bearer` header.
143
+
144
+ The Zitadel application is preconfigured, but every value can be overridden through the environment — useful for self-hosted or staging identity providers:
153
145
 
154
- The CLI is token-based. There is no email/password flow — every session uses a gateway API key.
146
+ | Variable | Default | Purpose |
147
+ |---|---|---|
148
+ | `REVENEXX_SSO_ISSUER` | `https://id.revenexx.com` | OIDC issuer; the authorize/token/userinfo endpoints come from its discovery document |
149
+ | `REVENEXX_SSO_CLIENT_ID` | built-in CLI client | Zitadel application (native / public) client ID |
150
+ | `REVENEXX_SSO_REDIRECT_URI` | `http://127.0.0.1:8000/callback` | Loopback callback — must exactly match a redirect URI registered on the Zitadel app |
155
151
 
156
- ### Default (non-interactive)
152
+ ### API key login (non-interactive)
157
153
 
158
154
  ```sh
155
+ # CI / scripts:
156
+ $ revenexx login --token <token> --tenant <tenant>
157
+
158
+ # Project workspace — drop credentials in `.env` or `.revenexx.yaml`:
159
159
  $ revenexx login
160
160
  ```
161
161
 
162
- With no flags, `login` resolves a token from (in order) `--token`, `REVENEXX_API_KEY`, then `.revenexx.yaml`. If a token is found, it's validated against the gateway (`GET /locale`) and persisted to `~/.revenexx/prefs.json`. If no token is found, the command errors out and tells you how to supply one.
162
+ With no flags, `login` resolves a token from (in order) `--token`, `REVENEXX_API_KEY`, then `.revenexx.yaml`. A found token is validated against the gateway (`GET /locale`) and persisted to `~/.revenexx/prefs.json`.
163
163
 
164
- Typical setups:
164
+ ### Inspecting and clearing your session
165
165
 
166
166
  ```sh
167
- # CI / scripts
168
- $ revenexx login --token <token> --tenant <tenant>
169
-
170
- # Project workspace — drop credentials in `.env` or `.revenexx.yaml`
171
- $ revenexx login
167
+ $ revenexx whoami # auth method, its source, tenant and endpoint
168
+ $ revenexx logout # clears the stored local session(s)
172
169
  ```
173
170
 
171
+ `whoami` reports **where** the active credential comes from — e.g. `REVENEXX_API_KEY env var`, `.revenexx.yaml`, or `login session`. Note that `logout` only clears the stored session: a key supplied via `REVENEXX_API_KEY` or `.revenexx.yaml` keeps authenticating you (and outranks any SSO session), so `logout` will warn you when one is still active. Unset it to fully sign out.
172
+
174
173
  ### Credential resolution order
175
174
 
176
175
  For any command that needs auth, credentials are resolved as:
@@ -178,9 +177,11 @@ For any command that needs auth, credentials are resolved as:
178
177
  1. CLI flag — `--token`, `--endpoint`, `--project-id`, `--tenant`
179
178
  2. Environment variables — `REVENEXX_API_KEY`, `REVENEXX_API_URL`, `REVENEXX_TENANT` (legacy alias `REVENEXX_PROJECT` is still honoured)
180
179
  3. Project file `.revenexx.yaml` — nearest one, walking up from the current directory
181
- 4. Global config at `~/.revenexx/prefs.json` — populated by `revenexx login`
180
+ 4. Global config at `~/.revenexx/prefs.json` — an API key, or an SSO JWT, populated by `revenexx login`
182
181
  5. Built-in default endpoint
183
182
 
183
+ When no API key resolves, a stored SSO JWT (from `login --browser`) is used instead, sent in the `Authorization: Bearer` header.
184
+
184
185
  Exception: the tenant slug prefers the explicit `tenants use` switch — `--tenant` flag → `~/.revenexx/tenant` → `REVENEXX_TENANT` → `.revenexx.yaml`.
185
186
 
186
187
  ## Versioning & changesets
@@ -229,31 +230,35 @@ Use the `--image` flag on the script to pin a specific Node base (e.g. `--image
229
230
 
230
231
  ## Global Configuration
231
232
 
232
- The CLI stores its configuration in `~/.revenexx/prefs.json`. You can seed this file manually before running any commands:
233
+ The CLI stores its state in `~/.revenexx/prefs.json`. It holds one entry per signed-in **session**, keyed by a generated session ID, plus a top-level `current` that points at the active one. You don't normally edit this by hand it's written by `login`, `logout`, `tenants use`, and `client`.
233
234
 
234
235
  ```json
235
236
  {
236
- "current": "",
237
- "endpoint": "https://api.revenexx.com",
238
- "selfSigned": false,
239
- "project": "",
240
- "key": "",
241
- "locale": "en-US",
242
- "mode": "default"
237
+ "current": "6a3ba27f0010bb19c8e6",
238
+ "6a3ba27f0010bb19c8e6": {
239
+ "endpoint": "https://api.revenexx.com",
240
+ "email": "you@example.com",
241
+ "authMethod": "sso",
242
+ "jwt": "<json-web-token>",
243
+ "refreshToken": "<refresh-token>",
244
+ "jwtExpiresAt": 1782336318182
245
+ }
243
246
  }
244
247
  ```
245
248
 
246
- | Key | Description |
247
- |-----|-------------|
248
- | `current` | Active session ID (set automatically on login) |
249
- | `endpoint` | Your Revenexx API revenexx server URL |
250
- | `selfSigned` | Allow self-signed TLS certificates (`true`/`false`) |
251
- | `project` | Default project ID |
252
- | `key` | API key for server-side access |
253
- | `locale` | Locale for API responses |
254
- | `mode` | Auth mode `default` (API key) or `admin` (cookie session) |
249
+ | Key | Scope | Description |
250
+ |-----|-------|-------------|
251
+ | `current` | top-level | ID of the active session (set on `login`, cleared on `logout`) |
252
+ | `authMethod` | session | `apikey` or `sso` |
253
+ | `endpoint` | session | Revenexx API URL for the session |
254
+ | `email` | session | Signed-in identity (or `apikey:<tenant>` for API-key sessions) |
255
+ | `key` | session | Gateway API key API-key sessions; sent as `X-Revenexx-Api-Key` |
256
+ | `jwt` | session | SSO JSON Web Token — sent as `Authorization: Bearer` |
257
+ | `refreshToken` | session | SSO refresh token, used to silently renew the JWT |
258
+ | `jwtExpiresAt` | session | JWT expiry (epoch ms); the CLI refreshes shortly before it lapses |
259
+ | `selfSigned` | session | Allow self-signed TLS certificates (`true`/`false`) |
255
260
 
256
- You can also configure these values via the CLI:
261
+ Rather than editing the file, configure the active session via the CLI:
257
262
 
258
263
  ```sh
259
264
  $ revenexx client --endpoint https://api.revenexx.com
@@ -261,9 +266,13 @@ $ revenexx client --key YOUR_API_KEY
261
266
  $ revenexx client --self-signed true
262
267
  ```
263
268
 
269
+ ## Sample
270
+
271
+ See a runnable example for this SDK in the [samples repo](https://github.com/revenexx-sdks/samples/tree/main/cli).
272
+
264
273
  ## Contribution
265
274
 
266
- This library is auto-generated by RevenexxAPIRevenexx custom [SDK Generator](https://github.com/revenexx api — revenexx/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/revenexx api — revenexx/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request.
275
+ This library is auto-generated by the Revenexx [SDK Generator](https://github.com/revenexx/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/revenexx/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request.
267
276
 
268
277
  To build and test the CLI for development, follow these steps
269
278